@teamturing/react-kit 2.19.21 → 2.19.23

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 { PropsWithChildren } from 'react';
1
+ import { PropsWithChildren, MouseEvent as ReactMouseEvent, KeyboardEvent as ReactKeyboardEvent } from 'react';
2
2
  import { SxProp } from '../../utils/styled-system';
3
3
  import { ActionListItemProps } from './ActionListItem';
4
4
  import { ActionListSectionDividerProps } from './ActionListSectionDivider';
@@ -11,10 +11,11 @@ type Props = {
11
11
  * `multiple`: 모든 아이템에 Checkbox를 표시합니다.
12
12
  */
13
13
  selectionVariant?: 'single' | 'multiple';
14
+ onSelect?: (event: ReactMouseEvent<HTMLLIElement> | ReactKeyboardEvent<HTMLLIElement>) => void;
14
15
  } & SxProp;
15
- type ActionListContextValue = {} & Pick<Props, 'selectionVariant'>;
16
- declare const ActionListContext: import("react").Context<Pick<Props, "selectionVariant">>;
17
- declare const _default: (({ ...props }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element) & {
16
+ type ActionListContextValue = {} & Pick<Props, 'selectionVariant' | 'onSelect'>;
17
+ declare const ActionListContext: import("react").Context<Pick<Props, "onSelect" | "selectionVariant">>;
18
+ declare const _default: (({ selectionVariant, onSelect, ...props }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element) & {
18
19
  Item: ({ variant, leadingVisual: LeadingVisual, trailingVisual: TrailingVisual, description, descriptionLayout, disabled, selected, onSelect: propOnSelect, children, sx, }: PropsWithChildren<ActionListItemProps>) => import("react/jsx-runtime").JSX.Element;
19
20
  SectionDivider: ({ color, variant, width, sx }: ActionListSectionDividerProps) => import("react/jsx-runtime").JSX.Element;
20
21
  SectionHeader: ({ ...props }: PropsWithChildren<SxProp>) => import("react/jsx-runtime").JSX.Element;
package/dist/index.js CHANGED
@@ -6944,12 +6944,14 @@ const ActionListItem = ({
6944
6944
  sx
6945
6945
  }) => {
6946
6946
  const {
6947
- selectionVariant
6947
+ selectionVariant,
6948
+ onSelect: defaultOnSelect
6948
6949
  } = React.useContext(ActionListContext);
6949
6950
  if (!selectionVariant && selected) {
6950
6951
  throw new Error('To use selected props in ActionList.Item, ActionList selectionVariant props should be defined.');
6951
6952
  }
6952
6953
  const handleSelect = React.useCallback(event => {
6954
+ defaultOnSelect?.(event);
6953
6955
  propOnSelect?.(event);
6954
6956
  }, [propOnSelect]);
6955
6957
  const handleClick = React.useCallback(event => {
@@ -7277,11 +7279,14 @@ const BaseActionListSectionHeader = styled__default.default.div`
7277
7279
 
7278
7280
  const ActionListContext = /*#__PURE__*/React.createContext({});
7279
7281
  const ActionList = ({
7282
+ selectionVariant,
7283
+ onSelect,
7280
7284
  ...props
7281
7285
  }) => {
7282
7286
  return /*#__PURE__*/jsxRuntimeExports.jsx(ActionListContext.Provider, {
7283
7287
  value: {
7284
- selectionVariant: props.selectionVariant
7288
+ selectionVariant,
7289
+ onSelect
7285
7290
  },
7286
7291
  children: /*#__PURE__*/jsxRuntimeExports.jsx(BaseActionList, {
7287
7292
  role: 'menu',
@@ -21337,6 +21342,10 @@ const SearchSelectInput = ({
21337
21342
  const focusInput = () => {
21338
21343
  labelInputRef.current?.focus();
21339
21344
  };
21345
+ const handleClose = () => {
21346
+ focusInput();
21347
+ onClose?.();
21348
+ };
21340
21349
  const {
21341
21350
  id,
21342
21351
  disabled,
@@ -21390,7 +21399,7 @@ const SearchSelectInput = ({
21390
21399
  ...focusZoneSettings
21391
21400
  },
21392
21401
  onOpen: onOpen,
21393
- onClose: onClose,
21402
+ onClose: handleClose,
21394
21403
  renderOverlay: (overlayProps, overlayHandler, {
21395
21404
  elements
21396
21405
  }) => /*#__PURE__*/jsxRuntimeExports.jsxs(Overlay$1, {
@@ -28,12 +28,14 @@ const ActionListItem = ({
28
28
  sx
29
29
  }) => {
30
30
  const {
31
- selectionVariant
31
+ selectionVariant,
32
+ onSelect: defaultOnSelect
32
33
  } = useContext(ActionListContext);
33
34
  if (!selectionVariant && selected) {
34
35
  throw new Error('To use selected props in ActionList.Item, ActionList selectionVariant props should be defined.');
35
36
  }
36
37
  const handleSelect = useCallback(event => {
38
+ defaultOnSelect?.(event);
37
39
  propOnSelect?.(event);
38
40
  }, [propOnSelect]);
39
41
  const handleClick = useCallback(event => {
@@ -8,11 +8,14 @@ import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js'
8
8
 
9
9
  const ActionListContext = /*#__PURE__*/createContext({});
10
10
  const ActionList = ({
11
+ selectionVariant,
12
+ onSelect,
11
13
  ...props
12
14
  }) => {
13
15
  return /*#__PURE__*/jsxRuntimeExports.jsx(ActionListContext.Provider, {
14
16
  value: {
15
- selectionVariant: props.selectionVariant
17
+ selectionVariant,
18
+ onSelect
16
19
  },
17
20
  children: /*#__PURE__*/jsxRuntimeExports.jsx(BaseActionList, {
18
21
  role: 'menu',
@@ -39,6 +39,10 @@ const SearchSelectInput = ({
39
39
  const focusInput = () => {
40
40
  labelInputRef.current?.focus();
41
41
  };
42
+ const handleClose = () => {
43
+ focusInput();
44
+ onClose?.();
45
+ };
42
46
  const {
43
47
  id,
44
48
  disabled,
@@ -92,7 +96,7 @@ const SearchSelectInput = ({
92
96
  ...focusZoneSettings
93
97
  },
94
98
  onOpen: onOpen,
95
- onClose: onClose,
99
+ onClose: handleClose,
96
100
  renderOverlay: (overlayProps, overlayHandler, {
97
101
  elements
98
102
  }) => /*#__PURE__*/jsxRuntimeExports.jsxs(Overlay, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamturing/react-kit",
3
- "version": "2.19.21",
3
+ "version": "2.19.23",
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": "6404b5d83461fa7855d12802cb4d1fe1f0649e31"
65
+ "gitHead": "58ccb149838349dd9245d2deaf370d14d4040ce9"
66
66
  }