@teamturing/react-kit 2.16.1 → 2.16.2

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,16 +1,17 @@
1
1
  import { HTMLAttributes, RefObject } from 'react';
2
2
  import { ResponsiveValue } from 'styled-system';
3
+ type OverlaySizeType = 's' | 'm' | 'l';
3
4
  type Props = {
4
5
  isOpen?: boolean;
5
6
  onDismiss?: () => void;
6
- size?: ResponsiveValue<'m'>;
7
+ size?: ResponsiveValue<OverlaySizeType>;
7
8
  ignoreOutsideClickRefs?: RefObject<HTMLElement>[];
8
9
  dismissFocusRef?: RefObject<HTMLElement>;
9
10
  } & HTMLAttributes<HTMLElement>;
10
11
  declare const _default: import("react").ForwardRefExoticComponent<{
11
12
  isOpen?: boolean | undefined;
12
13
  onDismiss?: (() => void) | undefined;
13
- size?: ResponsiveValue<"m"> | undefined;
14
+ size?: ResponsiveValue<OverlaySizeType> | undefined;
14
15
  ignoreOutsideClickRefs?: RefObject<HTMLElement>[] | undefined;
15
16
  dismissFocusRef?: RefObject<HTMLElement> | undefined;
16
17
  } & HTMLAttributes<HTMLElement> & {
@@ -2,15 +2,17 @@ import { Placement } from '@floating-ui/react-dom';
2
2
  import { PropsWithChildren, ReactNode } from 'react';
3
3
  import { FocusTrapHookSettings } from '../../hook/useFocusTrap';
4
4
  import { FocusZoneHookSettings } from '../../hook/useFocusZone';
5
+ import { OverlayProps } from '../Overlay';
5
6
  type Props = {
6
7
  renderOverlay: ({ isOpen, closeOverlay }: {
7
8
  isOpen: boolean;
8
9
  closeOverlay: () => void;
9
10
  }) => ReactNode;
11
+ overlayProps?: OverlayProps;
10
12
  placement?: Placement;
11
13
  focusZoneSettings?: Partial<FocusZoneHookSettings>;
12
14
  focusTrapSettings?: Partial<FocusTrapHookSettings>;
13
15
  };
14
- declare const OverlayPopper: ({ children: propChildren, renderOverlay, placement, focusZoneSettings, focusTrapSettings, }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element;
16
+ declare const OverlayPopper: ({ children: propChildren, renderOverlay, overlayProps, placement, focusZoneSettings, focusTrapSettings, }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element;
15
17
  export default OverlayPopper;
16
18
  export type { Props as OverlayPopperProps };
package/dist/index.js CHANGED
@@ -18924,6 +18924,7 @@ const Overlay = ({
18924
18924
  ref: overlayRef,
18925
18925
  size: size,
18926
18926
  ...props,
18927
+ role: 'dialog',
18927
18928
  children: children
18928
18929
  }) : null;
18929
18930
  };
@@ -18945,8 +18946,14 @@ const BaseOverlay = styled__default.default.div`
18945
18946
  ${variant({
18946
18947
  prop: 'size',
18947
18948
  variants: {
18949
+ s: {
18950
+ width: forcePixelValue(256)
18951
+ },
18948
18952
  m: {
18949
- width: forcePixelValue(180)
18953
+ width: forcePixelValue(320)
18954
+ },
18955
+ l: {
18956
+ width: forcePixelValue(480)
18950
18957
  }
18951
18958
  }
18952
18959
  })}
@@ -20541,6 +20548,7 @@ const useToggleHandler = ({
20541
20548
  const OverlayPopper = ({
20542
20549
  children: propChildren,
20543
20550
  renderOverlay,
20551
+ overlayProps,
20544
20552
  placement = 'bottom-start',
20545
20553
  focusZoneSettings,
20546
20554
  focusTrapSettings
@@ -20562,6 +20570,10 @@ const OverlayPopper = ({
20562
20570
  } = useToggleHandler({
20563
20571
  initialState: false
20564
20572
  });
20573
+ const handleDismiss = () => {
20574
+ overlayProps?.onDismiss?.();
20575
+ closeOverlay();
20576
+ };
20565
20577
  const children = React.Children.map(propChildren, child => /*#__PURE__*/React.cloneElement(child, {
20566
20578
  onClick: toggleOverlay,
20567
20579
  tabIndex: 0,
@@ -20583,10 +20595,11 @@ const OverlayPopper = ({
20583
20595
  children: [children, /*#__PURE__*/jsxRuntimeExports.jsx(Overlay$1, {
20584
20596
  ref: refs.setFloating,
20585
20597
  isOpen: isOpen,
20586
- onDismiss: closeOverlay,
20587
20598
  dismissFocusRef: refs.reference,
20588
20599
  ignoreOutsideClickRefs: [refs.reference],
20600
+ ...overlayProps,
20589
20601
  style: floatingStyles,
20602
+ onDismiss: handleDismiss,
20590
20603
  children: renderOverlay({
20591
20604
  isOpen,
20592
20605
  closeOverlay
@@ -67,6 +67,7 @@ const Overlay = ({
67
67
  ref: overlayRef,
68
68
  size: size,
69
69
  ...props,
70
+ role: 'dialog',
70
71
  children: children
71
72
  }) : null;
72
73
  };
@@ -88,8 +89,14 @@ const BaseOverlay = styled.div`
88
89
  ${variant({
89
90
  prop: 'size',
90
91
  variants: {
92
+ s: {
93
+ width: forcePixelValue(256)
94
+ },
91
95
  m: {
92
- width: forcePixelValue(180)
96
+ width: forcePixelValue(320)
97
+ },
98
+ l: {
99
+ width: forcePixelValue(480)
93
100
  }
94
101
  }
95
102
  })}
@@ -13,6 +13,7 @@ import { offset, flip, shift } from '../../node_modules/@floating-ui/core/dist/f
13
13
  const OverlayPopper = ({
14
14
  children: propChildren,
15
15
  renderOverlay,
16
+ overlayProps,
16
17
  placement = 'bottom-start',
17
18
  focusZoneSettings,
18
19
  focusTrapSettings
@@ -34,6 +35,10 @@ const OverlayPopper = ({
34
35
  } = useToggleHandler({
35
36
  initialState: false
36
37
  });
38
+ const handleDismiss = () => {
39
+ overlayProps?.onDismiss?.();
40
+ closeOverlay();
41
+ };
37
42
  const children = Children.map(propChildren, child => /*#__PURE__*/cloneElement(child, {
38
43
  onClick: toggleOverlay,
39
44
  tabIndex: 0,
@@ -55,10 +60,11 @@ const OverlayPopper = ({
55
60
  children: [children, /*#__PURE__*/jsxRuntimeExports.jsx(Overlay, {
56
61
  ref: refs.setFloating,
57
62
  isOpen: isOpen,
58
- onDismiss: closeOverlay,
59
63
  dismissFocusRef: refs.reference,
60
64
  ignoreOutsideClickRefs: [refs.reference],
65
+ ...overlayProps,
61
66
  style: floatingStyles,
67
+ onDismiss: handleDismiss,
62
68
  children: renderOverlay({
63
69
  isOpen,
64
70
  closeOverlay
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamturing/react-kit",
3
- "version": "2.16.1",
3
+ "version": "2.16.2",
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": "b202599554a5c0aaf45652c3f5815d171b7ba8fb"
65
+ "gitHead": "0118720b3b7893121d2252a7098195f196cccf68"
66
66
  }