Skip to content

Commit

Permalink
feat: move legacy Popover to the new entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
amje committed Dec 28, 2024
1 parent 0b9e240 commit 45ac6e1
Show file tree
Hide file tree
Showing 30 changed files with 48 additions and 34 deletions.
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@
"default": "./build/cjs/i18n/index.js"
}
},
"./legacy": {
"import": {
"types": "./build/esm/legacy.d.ts",
"default": "./build/esm/legacy.js"
},
"require": {
"types": "./build/cjs/legacy.d.ts",
"default": "./build/cjs/legacy.js"
}
},
"./unstable": {
"import": {
"types": "./build/esm/unstable.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/components/HelpMark/HelpMark.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type * as React from 'react';
import {CircleQuestion} from '@gravity-ui/icons';

import {Icon} from '../Icon';
import {Popover} from '../Popover';
import type {PopupPlacement} from '../Popup';
import {Popover} from '../legacy';
import type {QAProps} from '../types';
import {block} from '../utils/cn';

Expand Down
3 changes: 0 additions & 3 deletions src/components/Popover/Popover.classname.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/components/Popover/__stories__/PopoverDemo.classname.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import isEmpty from 'lodash/isEmpty';

import {useUniqId} from '../../../../hooks';
import {Icon} from '../../../Icon';
import {Popover} from '../../../Popover';
import {Popover} from '../../../legacy';
import type {CnMods} from '../../../utils/cn';
import {selectControlBlock, selectControlButtonBlock} from '../../constants';
import i18n from '../../i18n';
Expand Down
2 changes: 1 addition & 1 deletion src/components/controls/TextInput/TextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {TriangleExclamation} from '@gravity-ui/icons';
import {useControlledState, useForkRef, useUniqId} from '../../../hooks';
import {useElementSize, useFormResetHandler} from '../../../hooks/private';
import {Icon} from '../../Icon';
import {Popover} from '../../Popover';
import {Popover} from '../../legacy';
import {block} from '../../utils/cn';
import {ClearButton, mapTextInputSizeToButtonSize} from '../common';
import {OuterAdditionalContent} from '../common/OuterAdditionalContent/OuterAdditionalContent';
Expand Down
1 change: 0 additions & 1 deletion src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export * from './Palette';
export * from './UserLabel';
export * from './PinInput';
export * from './PlaceholderContainer';
export * from './Popover';
export * from './Popup';
export * from './Portal';
export * from './Progress';
Expand Down
3 changes: 3 additions & 0 deletions src/components/legacy/Popover/Popover.classname.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import {block} from '../../utils/cn';

export const cnPopover = block('popover-legacy');
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@use '../../../styles/mixins';
@use '../variables';
@use '../../../../styles/mixins';
@use '../../variables';

$block: '.#{variables.$ns}popover';
$block: '.#{variables.$ns}popover-legacy';

#{$block} {
display: inline-block;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import * as React from 'react';

import {Xmark} from '@gravity-ui/icons';

import {useUniqId} from '../../hooks/useUniqId';
import {Button} from '../Button';
import {Icon} from '../Icon';
import type {PopupPlacement} from '../Popup';
import {Popup} from '../Popup';
import {useDirection} from '../theme';
import type {QAProps} from '../types';
import {warnOnce} from '../utils/warn';
import {useUniqId} from '../../../hooks/useUniqId';
import {Button} from '../../Button';
import {Icon} from '../../Icon';
import type {PopupPlacement} from '../../Popup';
import {Popup} from '../../Popup';
import {useDirection} from '../../theme';
import type {QAProps} from '../../types';
import {warnOnce} from '../../utils/warn';

import {cnPopover} from './Popover.classname';
import {Buttons} from './components/Buttons/Buttons';
Expand All @@ -24,6 +24,9 @@ import type {PopoverInstanceProps, PopoverProps} from './types';

import './Popover.scss';

/**
* @deprecated
*/
export const Popover = React.forwardRef<PopoverInstanceProps, PopoverProps & QAProps>(function (
{
initialOpen = false,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {Meta, StoryFn} from '@storybook/react';

import {Popover, PopoverBehavior} from '../';
import type {PopoverProps} from '../';
import {Button} from '../../Button';
import {Button} from '../../../Button';

import {cnPopoverDemo} from './PopoverDemo.classname';
import {Base} from './examples/Base/Base';
Expand All @@ -13,7 +13,7 @@ import {WithCustomAnchor as WithCustomAnchorExample} from './examples/WithCustom
import './PopoverDemo.scss';

const meta: Meta<typeof Popover> = {
title: 'Components/Overlays/Popover',
title: 'Legacy/Popover',
component: Popover,
args: {
initialOpen: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import {block} from '../../../utils/cn';

export const cnPopoverDemo = block('popover-legacy-demo');
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@use '../../variables';
@use '../../../variables';

$block: '.#{variables.$ns}popover-demo';
$block: '.#{variables.$ns}popover-legacy-demo';

#{$block} {
display: flex;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';

import {Popover} from '../../../';
import {Button} from '../../../../Button';
import {Loader} from '../../../../Loader';
import {Button} from '../../../../../Button';
import {Loader} from '../../../../../Loader';
import type {PopoverInstanceProps} from '../../../types';
import {cnPopoverDemo} from '../../PopoverDemo.classname';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {setupTimersMock} from '../../../../test-utils/setupTimersMock';
import {act, fireEvent, render, screen, waitFor} from '../../../../test-utils/utils';
import {setupTimersMock} from '../../../../../test-utils/setupTimersMock';
import {act, fireEvent, render, screen, waitFor} from '../../../../../test-utils/utils';
import {Popover} from '../Popover';
import {PopoverBehavior, delayByBehavior} from '../config';
import type {PopoverProps} from '../types';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Button} from '../../../Button';
import {Button} from '../../../../Button';
import {cnPopover} from '../../Popover.classname';
import type {PopoverButtonProps, PopoverTheme} from '../../types';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';

import {Link} from '../../../Link';
import {Link} from '../../../../Link';
import {cnPopover} from '../../Popover.classname';

export type LinksProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import * as React from 'react';

import {useActionHandlers} from '../../../../hooks';
import {useActionHandlers} from '../../../../../hooks';

interface TriggerArgs {
onClick: React.MouseEventHandler;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';

import {useUpdateEffect} from '../../../hooks/private';
import {useUpdateEffect} from '../../../../hooks/private';
import {delayByBehavior} from '../config';
import type {PopoverBehavior} from '../config';

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {PopupAnchorElement, PopupAnchorRef, PopupOffset, PopupProps} from '../Popup';
import type {PopupAnchorElement, PopupAnchorRef, PopupOffset, PopupProps} from '../../Popup';

import type {ButtonsProps} from './components/Buttons/Buttons';
import type {ContentProps} from './components/Content/Content';
Expand Down
1 change: 1 addition & 0 deletions src/components/legacy/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './Popover';
1 change: 1 addition & 0 deletions src/legacy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './components/legacy';

0 comments on commit 45ac6e1

Please sign in to comment.