Skip to content

Commit

Permalink
fix(plasma-core): Popover refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
kayman233 committed Sep 27, 2023
1 parent 003f4e9 commit 21ff51f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Live.args = {
trigger: 'click',
closeOnOverlayClick: true,
closeOnEsc: true,
isFocusTrapped: false,
isFocusTrapped: true,
skidding: 0,
distance: 6,
};
Expand Down
10 changes: 5 additions & 5 deletions packages/plasma-core/api/plasma-core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -818,10 +818,10 @@ export interface PinProps {
// @public
export const Popover: React_2.NamedExoticComponent<PopoverProps & React_2.RefAttributes<HTMLDivElement>>;

// Warning: (ae-forgotten-export) The symbol "PopoverBasicPlacement" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "PopoverPlacementBasic" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type PopoverPlacement = PopoverBasicPlacement | 'auto';
export type PopoverPlacement = PopoverPlacementBasic | 'auto';

// @public (undocumented)
export interface PopoverProps extends HTMLAttributes<HTMLDivElement> {
Expand All @@ -830,12 +830,12 @@ export interface PopoverProps extends HTMLAttributes<HTMLDivElement> {
closeOnEsc?: boolean;
closeOnOverlayClick?: boolean;
isFocusTrapped?: boolean;
isOpen?: boolean;
isOpen: boolean;
offset?: [number, number];
onToggle?: (isOpen: boolean, event: SyntheticEvent | Event) => void;
placement?: PopoverPlacement | Array<PopoverBasicPlacement>;
placement?: PopoverPlacement | Array<PopoverPlacementBasic>;
target?: ReactNode;
trigger: 'hover' | 'click';
trigger?: 'hover' | 'click';
}

// @public @deprecated
Expand Down
16 changes: 8 additions & 8 deletions packages/plasma-core/src/components/Popover/Popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ import { useFocusTrap, useForkRef } from '../../hooks';

const ESCAPE_KEYCODE = 27;

export type PopoverBasicPlacement = 'top' | 'bottom' | 'right' | 'left';
export type PopoverPlacement = PopoverBasicPlacement | 'auto';
export type PopoverPlacementBasic = 'top' | 'bottom' | 'right' | 'left';
export type PopoverPlacement = PopoverPlacementBasic | 'auto';

export interface PopoverProps extends HTMLAttributes<HTMLDivElement> {
/**
* Всплывающее окно раскрыто или нет.
*/
isOpen?: boolean;
isOpen: boolean;
/**
* Способ всплывающего окна - наведение или клик мышью.
*/
trigger: 'hover' | 'click';
trigger?: 'hover' | 'click';
/**
* Расположение всплывающего окна. По умолчанию "auto".
* Сторона открытия окна относительно target элемента. По умолчанию "auto".
*/
placement?: PopoverPlacement | Array<PopoverBasicPlacement>;
placement?: PopoverPlacement | Array<PopoverPlacementBasic>;
/**
* Отступ окна относительно элемента, у которого оно вызвано.
*/
Expand All @@ -41,7 +41,7 @@ export interface PopoverProps extends HTMLAttributes<HTMLDivElement> {
*/
children?: ReactNode;
/**
* Блокировать ли фокус на всплывающем окне.
* Блокировать ли фокус на всплывающем окне(по умолчанию true).
*/
isFocusTrapped?: boolean;
/**
Expand Down Expand Up @@ -109,7 +109,7 @@ export const Popover = memo<PopoverProps & RefAttributes<HTMLDivElement>>(
arrow,
placement = 'auto',
offset = [0, 0],
isFocusTrapped = false,
isFocusTrapped = true,
closeOnOverlayClick = true,
closeOnEsc = true,
onToggle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Live.args = {
trigger: 'click',
closeOnOverlayClick: true,
closeOnEsc: true,
isFocusTrapped: false,
isFocusTrapped: true,
skidding: 0,
distance: 6,
};
Expand Down

0 comments on commit 21ff51f

Please sign in to comment.