@teamturing/react-kit 2.69.1 → 2.70.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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ElementType,
|
|
1
|
+
import { ElementType, ReactNode, MouseEvent as ReactMouseEvent, KeyboardEvent as ReactKeyboardEvent, LiHTMLAttributes } from 'react';
|
|
2
2
|
import { SxProp } from '../../utils/styled-system';
|
|
3
3
|
type Props = {
|
|
4
4
|
variant?: 'neutral' | 'danger';
|
|
@@ -9,7 +9,18 @@ type Props = {
|
|
|
9
9
|
disabled?: boolean;
|
|
10
10
|
selected?: boolean;
|
|
11
11
|
onSelect?: (event: ReactMouseEvent<HTMLLIElement> | ReactKeyboardEvent<HTMLLIElement>) => void;
|
|
12
|
-
} & Pick<LiHTMLAttributes<HTMLLIElement>, 'onFocus' | 'onBlur'> & SxProp;
|
|
13
|
-
declare const
|
|
14
|
-
|
|
12
|
+
} & Pick<LiHTMLAttributes<HTMLLIElement>, 'onFocus' | 'onBlur' | 'onClick' | 'onKeyDown' | 'tabIndex' | 'onMouseEnter' | 'onMouseLeave'> & SxProp;
|
|
13
|
+
declare const _default: import("react").ForwardRefExoticComponent<{
|
|
14
|
+
variant?: "neutral" | "danger" | undefined;
|
|
15
|
+
leadingVisual?: string | number | boolean | import("react").ComponentClass<any, any> | import("react").FunctionComponent<any> | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | import("react").ReactPortal | null | undefined;
|
|
16
|
+
trailingVisual?: string | number | boolean | import("react").ComponentClass<any, any> | import("react").FunctionComponent<any> | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode> | import("react").ReactPortal | null | undefined;
|
|
17
|
+
description?: ReactNode;
|
|
18
|
+
descriptionLayout?: "block" | "inline" | undefined;
|
|
19
|
+
disabled?: boolean | undefined;
|
|
20
|
+
selected?: boolean | undefined;
|
|
21
|
+
onSelect?: ((event: ReactMouseEvent<HTMLLIElement, MouseEvent> | ReactKeyboardEvent<HTMLLIElement>) => void) | undefined;
|
|
22
|
+
} & Pick<LiHTMLAttributes<HTMLLIElement>, "tabIndex" | "onFocus" | "onBlur" | "onKeyDown" | "onClick" | "onMouseEnter" | "onMouseLeave"> & SxProp & {
|
|
23
|
+
children?: ReactNode;
|
|
24
|
+
} & import("react").RefAttributes<HTMLLIElement>>;
|
|
25
|
+
export default _default;
|
|
15
26
|
export type { Props as ActionListItemProps };
|
|
@@ -22,7 +22,18 @@ type Props = {
|
|
|
22
22
|
type ActionListContextValue = {} & Pick<Props, 'selectionVariant' | 'selectionPosition' | 'onSelect'>;
|
|
23
23
|
declare const ActionListContext: import("react").Context<Pick<Props, "onSelect" | "selectionVariant" | "selectionPosition">>;
|
|
24
24
|
declare const _default: (({ selectionVariant, selectionPosition, onSelect, ...props }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element) & {
|
|
25
|
-
Item:
|
|
25
|
+
Item: import("react").ForwardRefExoticComponent<{
|
|
26
|
+
variant?: "neutral" | "danger" | undefined;
|
|
27
|
+
leadingVisual?: string | number | boolean | import("react").ComponentClass<any, any> | import("react").FunctionComponent<any> | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | import("react").ReactPortal | null | undefined;
|
|
28
|
+
trailingVisual?: string | number | boolean | import("react").ComponentClass<any, any> | import("react").FunctionComponent<any> | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | import("react").ReactPortal | null | undefined;
|
|
29
|
+
description?: import("react").ReactNode;
|
|
30
|
+
descriptionLayout?: "block" | "inline" | undefined;
|
|
31
|
+
disabled?: boolean | undefined;
|
|
32
|
+
selected?: boolean | undefined;
|
|
33
|
+
onSelect?: ((event: ReactMouseEvent<HTMLLIElement, MouseEvent> | ReactKeyboardEvent<HTMLLIElement>) => void) | undefined;
|
|
34
|
+
} & Pick<import("react").LiHTMLAttributes<HTMLLIElement>, "tabIndex" | "onFocus" | "onBlur" | "onKeyDown" | "onClick" | "onMouseEnter" | "onMouseLeave"> & SxProp & {
|
|
35
|
+
children?: import("react").ReactNode;
|
|
36
|
+
} & import("react").RefAttributes<HTMLLIElement>>;
|
|
26
37
|
SectionDivider: ({ color, variant, width, sx }: ActionListSectionDividerProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
38
|
SectionHeader: ({ ...props }: PropsWithChildren<SxProp>) => import("react/jsx-runtime").JSX.Element;
|
|
28
39
|
};
|
package/dist/index.js
CHANGED
|
@@ -1124,6 +1124,14 @@ var index$f = Object.assign(UnstyledTable, {
|
|
|
1124
1124
|
Cell: UnstyledTableCell
|
|
1125
1125
|
});
|
|
1126
1126
|
|
|
1127
|
+
/**
|
|
1128
|
+
* 제공된 `ref`가 없는 경우 새로운 `ref`를 만들어 사용하고, 있는 경우 제공된 ref를 사용할 수 있는 훅입니다.
|
|
1129
|
+
*/
|
|
1130
|
+
const useProvidedOrCreatedRef = providedRef => {
|
|
1131
|
+
const createdRef = React.useRef(null);
|
|
1132
|
+
return providedRef ?? createdRef;
|
|
1133
|
+
};
|
|
1134
|
+
|
|
1127
1135
|
const View = /*#__PURE__*/styled__default.default.div.withConfig({
|
|
1128
1136
|
displayName: "View",
|
|
1129
1137
|
componentId: "sc-1v428e-0"
|
|
@@ -1427,8 +1435,14 @@ const ActionListItem = ({
|
|
|
1427
1435
|
children,
|
|
1428
1436
|
onFocus,
|
|
1429
1437
|
onBlur,
|
|
1438
|
+
onClick: externalOnClick,
|
|
1439
|
+
onKeyDown: externalOnKeyDown,
|
|
1440
|
+
onMouseEnter,
|
|
1441
|
+
onMouseLeave,
|
|
1442
|
+
tabIndex: externalTabIndex,
|
|
1430
1443
|
sx
|
|
1431
|
-
}) => {
|
|
1444
|
+
}, ref) => {
|
|
1445
|
+
const itemRef = useProvidedOrCreatedRef(ref);
|
|
1432
1446
|
const {
|
|
1433
1447
|
selectionVariant,
|
|
1434
1448
|
selectionPosition = 'leading',
|
|
@@ -1440,17 +1454,17 @@ const ActionListItem = ({
|
|
|
1440
1454
|
const handleSelect = React.useCallback(event => {
|
|
1441
1455
|
defaultOnSelect?.(event);
|
|
1442
1456
|
propOnSelect?.(event);
|
|
1443
|
-
}, [propOnSelect]);
|
|
1457
|
+
}, [propOnSelect, defaultOnSelect]);
|
|
1444
1458
|
const handleClick = React.useCallback(event => {
|
|
1445
|
-
if (disabled)
|
|
1446
|
-
|
|
1447
|
-
}, [handleSelect, disabled]);
|
|
1459
|
+
if (!disabled) handleSelect(event);
|
|
1460
|
+
externalOnClick?.(event);
|
|
1461
|
+
}, [handleSelect, disabled, externalOnClick]);
|
|
1448
1462
|
const handleKeyDown = React.useCallback(event => {
|
|
1449
|
-
if (disabled)
|
|
1450
|
-
if ([' ', 'Enter'].includes(event.key)) {
|
|
1463
|
+
if (!disabled && [' ', 'Enter'].includes(event.key)) {
|
|
1451
1464
|
handleSelect(event);
|
|
1452
1465
|
}
|
|
1453
|
-
|
|
1466
|
+
externalOnKeyDown?.(event);
|
|
1467
|
+
}, [handleSelect, disabled, externalOnKeyDown]);
|
|
1454
1468
|
const selectionContent = !utils.isNullable(selectionVariant) ? /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
1455
1469
|
className: 'action_list_item__selection_wrapper',
|
|
1456
1470
|
display: 'inline-flex',
|
|
@@ -1479,17 +1493,20 @@ const ActionListItem = ({
|
|
|
1479
1493
|
}) : null
|
|
1480
1494
|
}) : null;
|
|
1481
1495
|
return /*#__PURE__*/jsxRuntime.jsxs(BaseActionListItem, {
|
|
1496
|
+
ref: itemRef,
|
|
1482
1497
|
variant: variant,
|
|
1483
1498
|
...(disabled ? {
|
|
1484
1499
|
disabled
|
|
1485
1500
|
} : {
|
|
1486
|
-
tabIndex: 0
|
|
1501
|
+
tabIndex: externalTabIndex ?? 0
|
|
1487
1502
|
}),
|
|
1488
1503
|
sx: sx,
|
|
1489
1504
|
onClick: handleClick,
|
|
1490
1505
|
onKeyDown: handleKeyDown,
|
|
1491
1506
|
onFocus: onFocus,
|
|
1492
1507
|
onBlur: onBlur,
|
|
1508
|
+
onMouseEnter: onMouseEnter,
|
|
1509
|
+
onMouseLeave: onMouseLeave,
|
|
1493
1510
|
children: [selectionPosition === 'leading' && selectionContent, /*#__PURE__*/jsxRuntime.jsx(VisualWrapper, {
|
|
1494
1511
|
className: 'action_list_item__leading_visual',
|
|
1495
1512
|
display: 'inline-flex',
|
|
@@ -1628,6 +1645,7 @@ const FakeCheckbox = /*#__PURE__*/styled__default.default.div.withConfig({
|
|
|
1628
1645
|
}) => theme.colors['border/disabled'], ({
|
|
1629
1646
|
theme
|
|
1630
1647
|
}) => theme.colors['icon/disabled'], sx);
|
|
1648
|
+
var ActionListItem$1 = /*#__PURE__*/React.forwardRef(ActionListItem);
|
|
1631
1649
|
|
|
1632
1650
|
const HorizontalDivider = ({
|
|
1633
1651
|
className,
|
|
@@ -1713,7 +1731,7 @@ const BaseActionList = /*#__PURE__*/styled__default.default.ul.withConfig({
|
|
|
1713
1731
|
componentId: "sc-1epqzss-0"
|
|
1714
1732
|
})(["list-style:none;padding:0;margin:0;", ""], sx);
|
|
1715
1733
|
var index$e = Object.assign(ActionList, {
|
|
1716
|
-
Item: ActionListItem,
|
|
1734
|
+
Item: ActionListItem$1,
|
|
1717
1735
|
SectionDivider: ActionListSectionDivider,
|
|
1718
1736
|
SectionHeader: ActionListSectionHeader
|
|
1719
1737
|
});
|
|
@@ -1897,14 +1915,6 @@ const useDelayedFunction = ({
|
|
|
1897
1915
|
return delayedFunc;
|
|
1898
1916
|
};
|
|
1899
1917
|
|
|
1900
|
-
/**
|
|
1901
|
-
* 제공된 `ref`가 없는 경우 새로운 `ref`를 만들어 사용하고, 있는 경우 제공된 ref를 사용할 수 있는 훅입니다.
|
|
1902
|
-
*/
|
|
1903
|
-
const useProvidedOrCreatedRef = providedRef => {
|
|
1904
|
-
const createdRef = React.useRef(null);
|
|
1905
|
-
return providedRef ?? createdRef;
|
|
1906
|
-
};
|
|
1907
|
-
|
|
1908
1918
|
const useFocusTrap = (settings, dependencies = []) => {
|
|
1909
1919
|
const containerRef = useProvidedOrCreatedRef(settings?.containerRef);
|
|
1910
1920
|
const initialFocusRef = useProvidedOrCreatedRef(settings?.initialFocusRef);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { CheckIcon } from '@teamturing/icons';
|
|
2
2
|
import { forcePixelValue, isNullable, noop } from '@teamturing/utils';
|
|
3
|
-
import { useContext, useCallback } from 'react';
|
|
3
|
+
import { forwardRef, useContext, useCallback } from 'react';
|
|
4
4
|
import { isValidElementType } from 'react-is';
|
|
5
5
|
import styled, { css } from 'styled-components';
|
|
6
6
|
import '../../node_modules/styled-system/dist/index.esm.js';
|
|
7
|
+
import useProvidedOrCreatedRef from '../../hook/useProvidedOrCreatedRef.js';
|
|
7
8
|
import { sx } from '../../utils/styled-system/index.js';
|
|
8
9
|
import Grid from '../Grid/index.js';
|
|
9
10
|
import StyledIcon from '../StyledIcon/index.js';
|
|
@@ -25,8 +26,14 @@ const ActionListItem = ({
|
|
|
25
26
|
children,
|
|
26
27
|
onFocus,
|
|
27
28
|
onBlur,
|
|
29
|
+
onClick: externalOnClick,
|
|
30
|
+
onKeyDown: externalOnKeyDown,
|
|
31
|
+
onMouseEnter,
|
|
32
|
+
onMouseLeave,
|
|
33
|
+
tabIndex: externalTabIndex,
|
|
28
34
|
sx
|
|
29
|
-
}) => {
|
|
35
|
+
}, ref) => {
|
|
36
|
+
const itemRef = useProvidedOrCreatedRef(ref);
|
|
30
37
|
const {
|
|
31
38
|
selectionVariant,
|
|
32
39
|
selectionPosition = 'leading',
|
|
@@ -38,17 +45,17 @@ const ActionListItem = ({
|
|
|
38
45
|
const handleSelect = useCallback(event => {
|
|
39
46
|
defaultOnSelect?.(event);
|
|
40
47
|
propOnSelect?.(event);
|
|
41
|
-
}, [propOnSelect]);
|
|
48
|
+
}, [propOnSelect, defaultOnSelect]);
|
|
42
49
|
const handleClick = useCallback(event => {
|
|
43
|
-
if (disabled)
|
|
44
|
-
|
|
45
|
-
}, [handleSelect, disabled]);
|
|
50
|
+
if (!disabled) handleSelect(event);
|
|
51
|
+
externalOnClick?.(event);
|
|
52
|
+
}, [handleSelect, disabled, externalOnClick]);
|
|
46
53
|
const handleKeyDown = useCallback(event => {
|
|
47
|
-
if (disabled)
|
|
48
|
-
if ([' ', 'Enter'].includes(event.key)) {
|
|
54
|
+
if (!disabled && [' ', 'Enter'].includes(event.key)) {
|
|
49
55
|
handleSelect(event);
|
|
50
56
|
}
|
|
51
|
-
|
|
57
|
+
externalOnKeyDown?.(event);
|
|
58
|
+
}, [handleSelect, disabled, externalOnKeyDown]);
|
|
52
59
|
const selectionContent = !isNullable(selectionVariant) ? /*#__PURE__*/jsx(View, {
|
|
53
60
|
className: 'action_list_item__selection_wrapper',
|
|
54
61
|
display: 'inline-flex',
|
|
@@ -77,17 +84,20 @@ const ActionListItem = ({
|
|
|
77
84
|
}) : null
|
|
78
85
|
}) : null;
|
|
79
86
|
return /*#__PURE__*/jsxs(BaseActionListItem, {
|
|
87
|
+
ref: itemRef,
|
|
80
88
|
variant: variant,
|
|
81
89
|
...(disabled ? {
|
|
82
90
|
disabled
|
|
83
91
|
} : {
|
|
84
|
-
tabIndex: 0
|
|
92
|
+
tabIndex: externalTabIndex ?? 0
|
|
85
93
|
}),
|
|
86
94
|
sx: sx,
|
|
87
95
|
onClick: handleClick,
|
|
88
96
|
onKeyDown: handleKeyDown,
|
|
89
97
|
onFocus: onFocus,
|
|
90
98
|
onBlur: onBlur,
|
|
99
|
+
onMouseEnter: onMouseEnter,
|
|
100
|
+
onMouseLeave: onMouseLeave,
|
|
91
101
|
children: [selectionPosition === 'leading' && selectionContent, /*#__PURE__*/jsx(VisualWrapper, {
|
|
92
102
|
className: 'action_list_item__leading_visual',
|
|
93
103
|
display: 'inline-flex',
|
|
@@ -226,5 +236,6 @@ const FakeCheckbox = /*#__PURE__*/styled.div.withConfig({
|
|
|
226
236
|
}) => theme.colors['border/disabled'], ({
|
|
227
237
|
theme
|
|
228
238
|
}) => theme.colors['icon/disabled'], sx);
|
|
239
|
+
var ActionListItem$1 = /*#__PURE__*/forwardRef(ActionListItem);
|
|
229
240
|
|
|
230
|
-
export { ActionListItem as default };
|
|
241
|
+
export { ActionListItem$1 as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamturing/react-kit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.70.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",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@floating-ui/react": "^0.27.16",
|
|
57
57
|
"@primer/behaviors": "^1.3.6",
|
|
58
|
-
"@teamturing/icons": "^1.
|
|
58
|
+
"@teamturing/icons": "^1.74.0",
|
|
59
59
|
"@teamturing/token-studio": "^1.16.4",
|
|
60
60
|
"@teamturing/utils": "^1.6.1",
|
|
61
61
|
"framer-motion": "^10.16.4",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"react-textarea-autosize": "^8.5.3",
|
|
66
66
|
"styled-system": "^5.1.5"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "a35243eca8bde7bca4d3569f7b77166ab9e0e86b"
|
|
69
69
|
}
|