@teamturing/react-kit 2.15.1 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/ActionList/ActionListItem.d.ts +15 -0
- package/dist/core/ActionList/ActionListSectionDivider.d.ts +5 -0
- package/dist/core/ActionList/ActionListSectionHeader.d.ts +6 -0
- package/dist/core/ActionList/index.d.ts +21 -0
- package/dist/core/Overlay/index.d.ts +2 -0
- package/dist/index.js +10 -1
- package/esm/core/Overlay/index.js +9 -1
- package/esm/core/OverlayPopper/index.js +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ElementType, PropsWithChildren, ReactNode, MouseEvent as ReactMouseEvent, KeyboardEvent as ReactKeyboardEvent } from 'react';
|
|
2
|
+
import { SxProp } from '../../utils/styled-system';
|
|
3
|
+
type Props = {
|
|
4
|
+
variant?: 'neutral' | 'danger';
|
|
5
|
+
leadingVisual?: ElementType | ReactNode;
|
|
6
|
+
trailingVisual?: ElementType | ReactNode;
|
|
7
|
+
description?: string;
|
|
8
|
+
descriptionLayout?: 'inline' | 'block';
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
selected?: boolean;
|
|
11
|
+
onSelect?: (event: ReactMouseEvent<HTMLLIElement> | ReactKeyboardEvent<HTMLLIElement>) => void;
|
|
12
|
+
} & SxProp;
|
|
13
|
+
declare const ActionListItem: ({ variant, leadingVisual: LeadingVisual, trailingVisual: TrailingVisual, description, descriptionLayout, disabled, selected, onSelect: propOnSelect, children, sx, }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export default ActionListItem;
|
|
15
|
+
export type { Props as ActionListItemProps };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { HorizontalDividerProps } from '../HorizontalDivider';
|
|
2
|
+
type Props = {} & HorizontalDividerProps;
|
|
3
|
+
declare const ActionListSectionDivider: ({ color, variant, width, sx }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default ActionListSectionDivider;
|
|
5
|
+
export type { Props as ActionListSectionDividerProps };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { SxProp } from '../../utils/styled-system';
|
|
3
|
+
type Props = {} & SxProp;
|
|
4
|
+
declare const ActionListSectionHeader: ({ ...props }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export default ActionListSectionHeader;
|
|
6
|
+
export type { Props as ActionListSectionHeaderProps };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { SxProp } from '../../utils/styled-system';
|
|
3
|
+
type Props = {
|
|
4
|
+
/**
|
|
5
|
+
* ActionList의 아이템에 선택이 되어있다는 것을 표시할 때 사용하는 속성입니다.
|
|
6
|
+
* `undefine`: 선택에 대한 표시를 하지 않습니다.
|
|
7
|
+
* `single`: 하나의 선택된 아이템에 대해, CheckIcon을 보여줍니다.
|
|
8
|
+
* `multiple`: 모든 아이템에 Checkbox를 표시합니다.
|
|
9
|
+
*/
|
|
10
|
+
selectionVariant?: 'single' | 'multiple';
|
|
11
|
+
} & SxProp;
|
|
12
|
+
type ActionListContextValue = {} & Pick<Props, 'selectionVariant'>;
|
|
13
|
+
declare const ActionListContext: import("react").Context<Pick<Props, "selectionVariant">>;
|
|
14
|
+
declare const _default: (({ ...props }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element) & {
|
|
15
|
+
Item: ({ variant, leadingVisual: LeadingVisual, trailingVisual: TrailingVisual, description, descriptionLayout, disabled, selected, onSelect: propOnSelect, children, sx, }: PropsWithChildren<import("./ActionListItem").ActionListItemProps>) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
SectionDivider: ({ color, variant, width, sx }: import("./ActionListSectionDivider").ActionListSectionDividerProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
SectionHeader: ({ ...props }: PropsWithChildren<SxProp>) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
};
|
|
19
|
+
export default _default;
|
|
20
|
+
export { ActionListContext };
|
|
21
|
+
export type { Props as ActionListProps, ActionListContextValue };
|
|
@@ -5,12 +5,14 @@ type Props = {
|
|
|
5
5
|
onDismiss?: () => void;
|
|
6
6
|
size?: ResponsiveValue<'m'>;
|
|
7
7
|
ignoreOutsideClickRefs?: RefObject<HTMLElement>[];
|
|
8
|
+
dismissFocusRef?: RefObject<HTMLElement>;
|
|
8
9
|
} & HTMLAttributes<HTMLElement>;
|
|
9
10
|
declare const _default: import("react").ForwardRefExoticComponent<{
|
|
10
11
|
isOpen?: boolean | undefined;
|
|
11
12
|
onDismiss?: (() => void) | undefined;
|
|
12
13
|
size?: ResponsiveValue<"m"> | undefined;
|
|
13
14
|
ignoreOutsideClickRefs?: RefObject<HTMLElement>[] | undefined;
|
|
15
|
+
dismissFocusRef?: RefObject<HTMLElement> | undefined;
|
|
14
16
|
} & HTMLAttributes<HTMLElement> & {
|
|
15
17
|
children?: import("react").ReactNode;
|
|
16
18
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
package/dist/index.js
CHANGED
|
@@ -18517,11 +18517,19 @@ const Overlay = ({
|
|
|
18517
18517
|
onDismiss,
|
|
18518
18518
|
size = 'm',
|
|
18519
18519
|
ignoreOutsideClickRefs = [],
|
|
18520
|
+
dismissFocusRef,
|
|
18520
18521
|
...props
|
|
18521
18522
|
}, ref) => {
|
|
18522
18523
|
const overlayRef = React.useRef(null);
|
|
18523
18524
|
React.useImperativeHandle(ref, () => overlayRef.current);
|
|
18524
|
-
const handleDismiss = React.useCallback(() =>
|
|
18525
|
+
const handleDismiss = React.useCallback(() => {
|
|
18526
|
+
if (dismissFocusRef && dismissFocusRef.current) {
|
|
18527
|
+
setTimeout(() => {
|
|
18528
|
+
dismissFocusRef.current?.focus();
|
|
18529
|
+
}, 0);
|
|
18530
|
+
}
|
|
18531
|
+
onDismiss?.();
|
|
18532
|
+
}, [onDismiss]);
|
|
18525
18533
|
const handleOutsideClick = React.useCallback(e => {
|
|
18526
18534
|
if (overlayRef.current && e.target instanceof Node && !overlayRef.current.contains(e.target) && ignoreOutsideClickRefs && !ignoreOutsideClickRefs.some(({
|
|
18527
18535
|
current
|
|
@@ -20223,6 +20231,7 @@ const OverlayPopper = ({
|
|
|
20223
20231
|
ref: refs.setFloating,
|
|
20224
20232
|
isOpen: isOpen,
|
|
20225
20233
|
onDismiss: closeOverlay,
|
|
20234
|
+
dismissFocusRef: refs.reference,
|
|
20226
20235
|
ignoreOutsideClickRefs: [refs.reference],
|
|
20227
20236
|
style: floatingStyles,
|
|
20228
20237
|
children: renderOverlay({
|
|
@@ -13,11 +13,19 @@ const Overlay = ({
|
|
|
13
13
|
onDismiss,
|
|
14
14
|
size = 'm',
|
|
15
15
|
ignoreOutsideClickRefs = [],
|
|
16
|
+
dismissFocusRef,
|
|
16
17
|
...props
|
|
17
18
|
}, ref) => {
|
|
18
19
|
const overlayRef = useRef(null);
|
|
19
20
|
useImperativeHandle(ref, () => overlayRef.current);
|
|
20
|
-
const handleDismiss = useCallback(() =>
|
|
21
|
+
const handleDismiss = useCallback(() => {
|
|
22
|
+
if (dismissFocusRef && dismissFocusRef.current) {
|
|
23
|
+
setTimeout(() => {
|
|
24
|
+
dismissFocusRef.current?.focus();
|
|
25
|
+
}, 0);
|
|
26
|
+
}
|
|
27
|
+
onDismiss?.();
|
|
28
|
+
}, [onDismiss]);
|
|
21
29
|
const handleOutsideClick = useCallback(e => {
|
|
22
30
|
if (overlayRef.current && e.target instanceof Node && !overlayRef.current.contains(e.target) && ignoreOutsideClickRefs && !ignoreOutsideClickRefs.some(({
|
|
23
31
|
current
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamturing/react-kit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.16.0",
|
|
4
4
|
"description": "React components, hooks for create teamturing web application",
|
|
5
5
|
"author": "Sungchang Park <psch300@gmail.com> (https://github.com/psch300)",
|
|
6
6
|
"homepage": "https://github.com/weareteamturing/bombe#readme",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"react-is": "^18.2.0",
|
|
63
63
|
"styled-system": "^5.1.5"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "8b02a8dd365e7ddc45036f1dd2fd05ebcbf03f72"
|
|
66
66
|
}
|