@teamturing/react-kit 2.16.1 → 2.16.3

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,19 +1,21 @@
1
1
  import { HTMLAttributes, RefObject } from 'react';
2
- import { ResponsiveValue } from 'styled-system';
2
+ import { MaxHeightProps, ResponsiveValue } from 'styled-system';
3
+ import { SxProp } from '../../utils/styled-system';
4
+ type OverlaySizeType = 's' | 'm' | 'l';
3
5
  type Props = {
4
6
  isOpen?: boolean;
5
7
  onDismiss?: () => void;
6
- size?: ResponsiveValue<'m'>;
8
+ size?: ResponsiveValue<OverlaySizeType>;
7
9
  ignoreOutsideClickRefs?: RefObject<HTMLElement>[];
8
10
  dismissFocusRef?: RefObject<HTMLElement>;
9
- } & HTMLAttributes<HTMLElement>;
11
+ } & MaxHeightProps & SxProp & HTMLAttributes<HTMLElement>;
10
12
  declare const _default: import("react").ForwardRefExoticComponent<{
11
13
  isOpen?: boolean | undefined;
12
14
  onDismiss?: (() => void) | undefined;
13
- size?: ResponsiveValue<"m"> | undefined;
15
+ size?: ResponsiveValue<OverlaySizeType> | undefined;
14
16
  ignoreOutsideClickRefs?: RefObject<HTMLElement>[] | undefined;
15
17
  dismissFocusRef?: RefObject<HTMLElement> | undefined;
16
- } & HTMLAttributes<HTMLElement> & {
18
+ } & MaxHeightProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.MaxHeight<import("styled-system").TLengthStyledSystem>> & SxProp & HTMLAttributes<HTMLElement> & {
17
19
  children?: import("react").ReactNode;
18
20
  } & import("react").RefAttributes<HTMLDivElement>>;
19
21
  export default _default;
@@ -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
@@ -977,7 +977,7 @@ layout$1.width;
977
977
  layout$1.minWidth;
978
978
  layout$1.minHeight;
979
979
  layout$1.maxWidth;
980
- layout$1.maxHeight;
980
+ var maxHeight = layout$1.maxHeight;
981
981
  layout$1.size;
982
982
  layout$1.verticalAlign;
983
983
  layout$1.display;
@@ -18871,6 +18871,7 @@ const Overlay = ({
18871
18871
  size = 'm',
18872
18872
  ignoreOutsideClickRefs = [],
18873
18873
  dismissFocusRef,
18874
+ maxHeight = forcePixelValue(600),
18874
18875
  ...props
18875
18876
  }, ref) => {
18876
18877
  const overlayRef = React.useRef(null);
@@ -18923,7 +18924,9 @@ const Overlay = ({
18923
18924
  return isOpen ? /*#__PURE__*/jsxRuntimeExports.jsx(BaseOverlay, {
18924
18925
  ref: overlayRef,
18925
18926
  size: size,
18927
+ maxHeight: maxHeight,
18926
18928
  ...props,
18929
+ role: 'dialog',
18927
18930
  children: children
18928
18931
  }) : null;
18929
18932
  };
@@ -18945,11 +18948,19 @@ const BaseOverlay = styled__default.default.div`
18945
18948
  ${variant({
18946
18949
  prop: 'size',
18947
18950
  variants: {
18951
+ s: {
18952
+ width: forcePixelValue(256)
18953
+ },
18948
18954
  m: {
18949
- width: forcePixelValue(180)
18955
+ width: forcePixelValue(320)
18956
+ },
18957
+ l: {
18958
+ width: forcePixelValue(480)
18950
18959
  }
18951
18960
  }
18952
18961
  })}
18962
+
18963
+ ${maxHeight}
18953
18964
  ${sx}
18954
18965
  `;
18955
18966
  var Overlay$1 = /*#__PURE__*/React.forwardRef(Overlay);
@@ -20541,6 +20552,7 @@ const useToggleHandler = ({
20541
20552
  const OverlayPopper = ({
20542
20553
  children: propChildren,
20543
20554
  renderOverlay,
20555
+ overlayProps,
20544
20556
  placement = 'bottom-start',
20545
20557
  focusZoneSettings,
20546
20558
  focusTrapSettings
@@ -20562,6 +20574,10 @@ const OverlayPopper = ({
20562
20574
  } = useToggleHandler({
20563
20575
  initialState: false
20564
20576
  });
20577
+ const handleDismiss = () => {
20578
+ overlayProps?.onDismiss?.();
20579
+ closeOverlay();
20580
+ };
20565
20581
  const children = React.Children.map(propChildren, child => /*#__PURE__*/React.cloneElement(child, {
20566
20582
  onClick: toggleOverlay,
20567
20583
  tabIndex: 0,
@@ -20583,10 +20599,11 @@ const OverlayPopper = ({
20583
20599
  children: [children, /*#__PURE__*/jsxRuntimeExports.jsx(Overlay$1, {
20584
20600
  ref: refs.setFloating,
20585
20601
  isOpen: isOpen,
20586
- onDismiss: closeOverlay,
20587
20602
  dismissFocusRef: refs.reference,
20588
20603
  ignoreOutsideClickRefs: [refs.reference],
20604
+ ...overlayProps,
20589
20605
  style: floatingStyles,
20606
+ onDismiss: handleDismiss,
20590
20607
  children: renderOverlay({
20591
20608
  isOpen,
20592
20609
  closeOverlay
@@ -1,6 +1,6 @@
1
1
  import { forwardRef, useRef, useImperativeHandle, useCallback, useEffect } from 'react';
2
2
  import styled from 'styled-components';
3
- import '../../node_modules/styled-system/dist/index.esm.js';
3
+ import { maxHeight } from '../../node_modules/styled-system/dist/index.esm.js';
4
4
  import { forcePixelValue } from '../../utils/forcePixelValue.js';
5
5
  import { sx } from '../../utils/styled-system/index.js';
6
6
  import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
@@ -14,6 +14,7 @@ const Overlay = ({
14
14
  size = 'm',
15
15
  ignoreOutsideClickRefs = [],
16
16
  dismissFocusRef,
17
+ maxHeight = forcePixelValue(600),
17
18
  ...props
18
19
  }, ref) => {
19
20
  const overlayRef = useRef(null);
@@ -66,7 +67,9 @@ const Overlay = ({
66
67
  return isOpen ? /*#__PURE__*/jsxRuntimeExports.jsx(BaseOverlay, {
67
68
  ref: overlayRef,
68
69
  size: size,
70
+ maxHeight: maxHeight,
69
71
  ...props,
72
+ role: 'dialog',
70
73
  children: children
71
74
  }) : null;
72
75
  };
@@ -88,11 +91,19 @@ const BaseOverlay = styled.div`
88
91
  ${variant({
89
92
  prop: 'size',
90
93
  variants: {
94
+ s: {
95
+ width: forcePixelValue(256)
96
+ },
91
97
  m: {
92
- width: forcePixelValue(180)
98
+ width: forcePixelValue(320)
99
+ },
100
+ l: {
101
+ width: forcePixelValue(480)
93
102
  }
94
103
  }
95
104
  })}
105
+
106
+ ${maxHeight}
96
107
  ${sx}
97
108
  `;
98
109
  var Overlay$1 = /*#__PURE__*/forwardRef(Overlay);
@@ -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
@@ -16,7 +16,7 @@ layout.width;
16
16
  layout.minWidth;
17
17
  layout.minHeight;
18
18
  layout.maxWidth;
19
- layout.maxHeight;
19
+ var maxHeight = layout.maxHeight;
20
20
  layout.size;
21
21
  layout.verticalAlign;
22
22
  layout.display;
@@ -74,4 +74,4 @@ position.zIndex;
74
74
  position.bottom;
75
75
  position.left;
76
76
 
77
- export { background, border, border as borders, color, flexbox, fontSize, fontWeight, grid, layout, lineHeight, position, textAlign, typography };
77
+ export { background, border, border as borders, color, flexbox, fontSize, fontWeight, grid, layout, lineHeight, maxHeight, position, textAlign, typography };
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.3",
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": "5d22785a97a7991ab894c44c6ea913202821cd01"
66
66
  }