@teamturing/react-kit 2.71.1 → 2.73.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/Dialog/index.d.ts +7 -1
- package/dist/index.js +68 -26
- package/esm/core/Dialog/index.js +70 -28
- package/package.json +2 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HTMLMotionProps } from 'framer-motion';
|
|
1
2
|
import { PropsWithChildren, RefObject } from 'react';
|
|
2
3
|
import { SxProp } from '../../utils/styled-system';
|
|
3
4
|
import { DialogBodyProps } from './DialogBody';
|
|
@@ -9,12 +10,15 @@ import { UnstyledDialogBodyProps } from './_UnstyledDialogBody';
|
|
|
9
10
|
import { UnstyledDialogFooterProps } from './_UnstyledDialogFooter';
|
|
10
11
|
import { UnstyledDialogHeaderProps } from './_UnstyledDialogHeader';
|
|
11
12
|
type DialogSizeType = 'full' | 'l' | 'm' | 's';
|
|
13
|
+
type DialogMotionProps = Partial<Pick<HTMLMotionProps<'div'>, 'initial' | 'animate' | 'exit' | 'transition'>>;
|
|
12
14
|
type Props = {
|
|
13
15
|
isOpen?: boolean;
|
|
14
16
|
onDismiss?: () => void;
|
|
15
17
|
isOutsideClickDismissable?: boolean;
|
|
16
18
|
size?: DialogSizeType;
|
|
17
19
|
initialFocusRef?: RefObject<HTMLElement>;
|
|
20
|
+
motionProps?: DialogMotionProps;
|
|
21
|
+
blanketMotionProps?: DialogMotionProps;
|
|
18
22
|
} & SxProp;
|
|
19
23
|
declare const _default: import("react").ForwardRefExoticComponent<{
|
|
20
24
|
isOpen?: boolean | undefined;
|
|
@@ -22,6 +26,8 @@ declare const _default: import("react").ForwardRefExoticComponent<{
|
|
|
22
26
|
isOutsideClickDismissable?: boolean | undefined;
|
|
23
27
|
size?: DialogSizeType | undefined;
|
|
24
28
|
initialFocusRef?: RefObject<HTMLElement> | undefined;
|
|
29
|
+
motionProps?: Partial<Pick<HTMLMotionProps<"div">, "transition" | "initial" | "animate" | "exit">> | undefined;
|
|
30
|
+
blanketMotionProps?: Partial<Pick<HTMLMotionProps<"div">, "transition" | "initial" | "animate" | "exit">> | undefined;
|
|
25
31
|
} & SxProp & {
|
|
26
32
|
children?: import("react").ReactNode;
|
|
27
33
|
} & import("react").RefAttributes<HTMLDivElement>> & {
|
|
@@ -842,4 +848,4 @@ declare const _default: import("react").ForwardRefExoticComponent<{
|
|
|
842
848
|
Footer: ({ children, sx, ...props }: PropsWithChildren<DialogFooterProps>) => import("react/jsx-runtime").JSX.Element;
|
|
843
849
|
};
|
|
844
850
|
export default _default;
|
|
845
|
-
export type { Props as DialogProps, UnstyledDialogHeaderProps, UnstyledDialogBodyProps, UnstyledDialogFooterProps, DialogHeaderProps, DialogHeaderTitleProps, DialogHeaderSubtitleProps, DialogBodyProps, DialogFooterProps, };
|
|
851
|
+
export type { Props as DialogProps, DialogMotionProps, UnstyledDialogHeaderProps, UnstyledDialogBodyProps, UnstyledDialogFooterProps, DialogHeaderProps, DialogHeaderTitleProps, DialogHeaderSubtitleProps, DialogBodyProps, DialogFooterProps, };
|
package/dist/index.js
CHANGED
|
@@ -5622,6 +5622,42 @@ const DialogHeaderTitle = ({
|
|
|
5622
5622
|
});
|
|
5623
5623
|
};
|
|
5624
5624
|
|
|
5625
|
+
const DEFAULT_MOTION_PROPS = {
|
|
5626
|
+
initial: {
|
|
5627
|
+
opacity: 0,
|
|
5628
|
+
scale: 1.1
|
|
5629
|
+
},
|
|
5630
|
+
animate: {
|
|
5631
|
+
opacity: 1,
|
|
5632
|
+
scale: 1
|
|
5633
|
+
},
|
|
5634
|
+
exit: {
|
|
5635
|
+
opacity: 0,
|
|
5636
|
+
scale: 1.1
|
|
5637
|
+
},
|
|
5638
|
+
transition: {
|
|
5639
|
+
duration: 0.25,
|
|
5640
|
+
/**
|
|
5641
|
+
* easeOutQuad by https://easings.net/ko#easeOutQuad
|
|
5642
|
+
*/
|
|
5643
|
+
ease: framerMotion.cubicBezier(0.5, 1, 0.89, 1)
|
|
5644
|
+
}
|
|
5645
|
+
};
|
|
5646
|
+
const DEFAULT_BLANKET_MOTION_PROPS = {
|
|
5647
|
+
initial: {
|
|
5648
|
+
opacity: 0
|
|
5649
|
+
},
|
|
5650
|
+
animate: {
|
|
5651
|
+
opacity: 1
|
|
5652
|
+
},
|
|
5653
|
+
exit: {
|
|
5654
|
+
opacity: 0
|
|
5655
|
+
},
|
|
5656
|
+
transition: {
|
|
5657
|
+
duration: 0.25,
|
|
5658
|
+
ease: framerMotion.cubicBezier(0.5, 1, 0.89, 1)
|
|
5659
|
+
}
|
|
5660
|
+
};
|
|
5625
5661
|
const Dialog = ({
|
|
5626
5662
|
children,
|
|
5627
5663
|
isOpen,
|
|
@@ -5629,6 +5665,8 @@ const Dialog = ({
|
|
|
5629
5665
|
isOutsideClickDismissable = true,
|
|
5630
5666
|
size = 'm',
|
|
5631
5667
|
initialFocusRef,
|
|
5668
|
+
motionProps,
|
|
5669
|
+
blanketMotionProps,
|
|
5632
5670
|
sx
|
|
5633
5671
|
}, ref) => {
|
|
5634
5672
|
const theme = styled.useTheme();
|
|
@@ -5666,27 +5704,12 @@ const Dialog = ({
|
|
|
5666
5704
|
}
|
|
5667
5705
|
}, [isOpen, isOutsideClickDismissable, handleOutsideClick]);
|
|
5668
5706
|
return /*#__PURE__*/jsxRuntime.jsx(framerMotion.AnimatePresence, {
|
|
5669
|
-
children: isOpen ? /*#__PURE__*/jsxRuntime.
|
|
5670
|
-
children: /*#__PURE__*/jsxRuntime.
|
|
5671
|
-
initial:
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
animate: {
|
|
5676
|
-
opacity: 1,
|
|
5677
|
-
scale: 1
|
|
5678
|
-
},
|
|
5679
|
-
exit: {
|
|
5680
|
-
opacity: 0,
|
|
5681
|
-
scale: 1.1
|
|
5682
|
-
},
|
|
5683
|
-
transition: {
|
|
5684
|
-
duration: 0.25,
|
|
5685
|
-
/**
|
|
5686
|
-
* easeOutQuad by https://easings.net/ko#easeOutQuad
|
|
5687
|
-
*/
|
|
5688
|
-
ease: framerMotion.cubicBezier(0.5, 1, 0.89, 1)
|
|
5689
|
-
},
|
|
5707
|
+
children: isOpen ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
5708
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(MotionView, {
|
|
5709
|
+
initial: blanketMotionProps?.initial ?? DEFAULT_BLANKET_MOTION_PROPS.initial,
|
|
5710
|
+
animate: blanketMotionProps?.animate ?? DEFAULT_BLANKET_MOTION_PROPS.animate,
|
|
5711
|
+
exit: blanketMotionProps?.exit ?? DEFAULT_BLANKET_MOTION_PROPS.exit,
|
|
5712
|
+
transition: blanketMotionProps?.transition ?? DEFAULT_BLANKET_MOTION_PROPS.transition,
|
|
5690
5713
|
sx: {
|
|
5691
5714
|
position: 'fixed',
|
|
5692
5715
|
top: 0,
|
|
@@ -5695,12 +5718,30 @@ const Dialog = ({
|
|
|
5695
5718
|
left: 0,
|
|
5696
5719
|
zIndex: 9999
|
|
5697
5720
|
},
|
|
5698
|
-
children:
|
|
5721
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Blanket$1, {
|
|
5699
5722
|
ref: blanketRef
|
|
5700
|
-
})
|
|
5723
|
+
})
|
|
5724
|
+
}), /*#__PURE__*/jsxRuntime.jsx(MotionView, {
|
|
5725
|
+
initial: motionProps?.initial ?? DEFAULT_MOTION_PROPS.initial,
|
|
5726
|
+
animate: motionProps?.animate ?? DEFAULT_MOTION_PROPS.animate,
|
|
5727
|
+
exit: motionProps?.exit ?? DEFAULT_MOTION_PROPS.exit,
|
|
5728
|
+
transition: motionProps?.transition ?? DEFAULT_MOTION_PROPS.transition,
|
|
5729
|
+
sx: {
|
|
5730
|
+
position: 'fixed',
|
|
5731
|
+
top: 0,
|
|
5732
|
+
right: 0,
|
|
5733
|
+
bottom: 0,
|
|
5734
|
+
left: 0,
|
|
5735
|
+
zIndex: 9999,
|
|
5736
|
+
pointerEvents: 'none'
|
|
5737
|
+
},
|
|
5738
|
+
children: /*#__PURE__*/jsxRuntime.jsx(View, {
|
|
5701
5739
|
display: 'flex',
|
|
5702
5740
|
width: '100%',
|
|
5703
5741
|
height: '100%',
|
|
5742
|
+
sx: {
|
|
5743
|
+
pointerEvents: 'none'
|
|
5744
|
+
},
|
|
5704
5745
|
children: /*#__PURE__*/jsxRuntime.jsxs(BaseDialog, {
|
|
5705
5746
|
className: `trk-dialog--${size}`,
|
|
5706
5747
|
ref: dialogRef,
|
|
@@ -5762,8 +5803,8 @@ const Dialog = ({
|
|
|
5762
5803
|
children: children
|
|
5763
5804
|
})]
|
|
5764
5805
|
})
|
|
5765
|
-
})
|
|
5766
|
-
})
|
|
5806
|
+
})
|
|
5807
|
+
})]
|
|
5767
5808
|
}) : null
|
|
5768
5809
|
});
|
|
5769
5810
|
};
|
|
@@ -5786,7 +5827,8 @@ const BaseDialog = /*#__PURE__*/styled__default.default.div.withConfig({
|
|
|
5786
5827
|
backgroundColor: theme.colors['surface'],
|
|
5787
5828
|
outline: 'none',
|
|
5788
5829
|
overflow: 'hidden',
|
|
5789
|
-
margin: 'auto'
|
|
5830
|
+
margin: 'auto',
|
|
5831
|
+
pointerEvents: 'auto'
|
|
5790
5832
|
}), sx);
|
|
5791
5833
|
var index$8 = Object.assign( /*#__PURE__*/React.forwardRef(Dialog), {
|
|
5792
5834
|
UnstyledHeader: UnstyledDialogHeader,
|
package/esm/core/Dialog/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CloseIcon } from '@teamturing/icons';
|
|
2
2
|
import { forcePixelValue } from '@teamturing/utils';
|
|
3
|
-
import {
|
|
3
|
+
import { cubicBezier, AnimatePresence } from 'framer-motion';
|
|
4
4
|
import { forwardRef, useId, useCallback, useRef, useImperativeHandle, useEffect } from 'react';
|
|
5
5
|
import styled, { useTheme } from 'styled-components';
|
|
6
6
|
import IconButton from '../IconButton/index.js';
|
|
@@ -17,8 +17,44 @@ import DialogHeaderTitle from './DialogHeaderTitle.js';
|
|
|
17
17
|
import UnstyledDialogBody from './_UnstyledDialogBody.js';
|
|
18
18
|
import UnstyledDialogFooter from './_UnstyledDialogFooter.js';
|
|
19
19
|
import UnstyledDialogHeader from './_UnstyledDialogHeader.js';
|
|
20
|
-
import { jsx,
|
|
20
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
21
21
|
|
|
22
|
+
const DEFAULT_MOTION_PROPS = {
|
|
23
|
+
initial: {
|
|
24
|
+
opacity: 0,
|
|
25
|
+
scale: 1.1
|
|
26
|
+
},
|
|
27
|
+
animate: {
|
|
28
|
+
opacity: 1,
|
|
29
|
+
scale: 1
|
|
30
|
+
},
|
|
31
|
+
exit: {
|
|
32
|
+
opacity: 0,
|
|
33
|
+
scale: 1.1
|
|
34
|
+
},
|
|
35
|
+
transition: {
|
|
36
|
+
duration: 0.25,
|
|
37
|
+
/**
|
|
38
|
+
* easeOutQuad by https://easings.net/ko#easeOutQuad
|
|
39
|
+
*/
|
|
40
|
+
ease: cubicBezier(0.5, 1, 0.89, 1)
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const DEFAULT_BLANKET_MOTION_PROPS = {
|
|
44
|
+
initial: {
|
|
45
|
+
opacity: 0
|
|
46
|
+
},
|
|
47
|
+
animate: {
|
|
48
|
+
opacity: 1
|
|
49
|
+
},
|
|
50
|
+
exit: {
|
|
51
|
+
opacity: 0
|
|
52
|
+
},
|
|
53
|
+
transition: {
|
|
54
|
+
duration: 0.25,
|
|
55
|
+
ease: cubicBezier(0.5, 1, 0.89, 1)
|
|
56
|
+
}
|
|
57
|
+
};
|
|
22
58
|
const Dialog = ({
|
|
23
59
|
children,
|
|
24
60
|
isOpen,
|
|
@@ -26,6 +62,8 @@ const Dialog = ({
|
|
|
26
62
|
isOutsideClickDismissable = true,
|
|
27
63
|
size = 'm',
|
|
28
64
|
initialFocusRef,
|
|
65
|
+
motionProps,
|
|
66
|
+
blanketMotionProps,
|
|
29
67
|
sx
|
|
30
68
|
}, ref) => {
|
|
31
69
|
const theme = useTheme();
|
|
@@ -63,27 +101,12 @@ const Dialog = ({
|
|
|
63
101
|
}
|
|
64
102
|
}, [isOpen, isOutsideClickDismissable, handleOutsideClick]);
|
|
65
103
|
return /*#__PURE__*/jsx(AnimatePresence, {
|
|
66
|
-
children: isOpen ? /*#__PURE__*/
|
|
67
|
-
children: /*#__PURE__*/
|
|
68
|
-
initial:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
animate: {
|
|
73
|
-
opacity: 1,
|
|
74
|
-
scale: 1
|
|
75
|
-
},
|
|
76
|
-
exit: {
|
|
77
|
-
opacity: 0,
|
|
78
|
-
scale: 1.1
|
|
79
|
-
},
|
|
80
|
-
transition: {
|
|
81
|
-
duration: 0.25,
|
|
82
|
-
/**
|
|
83
|
-
* easeOutQuad by https://easings.net/ko#easeOutQuad
|
|
84
|
-
*/
|
|
85
|
-
ease: cubicBezier(0.5, 1, 0.89, 1)
|
|
86
|
-
},
|
|
104
|
+
children: isOpen ? /*#__PURE__*/jsxs(Fragment, {
|
|
105
|
+
children: [/*#__PURE__*/jsx(MotionView, {
|
|
106
|
+
initial: blanketMotionProps?.initial ?? DEFAULT_BLANKET_MOTION_PROPS.initial,
|
|
107
|
+
animate: blanketMotionProps?.animate ?? DEFAULT_BLANKET_MOTION_PROPS.animate,
|
|
108
|
+
exit: blanketMotionProps?.exit ?? DEFAULT_BLANKET_MOTION_PROPS.exit,
|
|
109
|
+
transition: blanketMotionProps?.transition ?? DEFAULT_BLANKET_MOTION_PROPS.transition,
|
|
87
110
|
sx: {
|
|
88
111
|
position: 'fixed',
|
|
89
112
|
top: 0,
|
|
@@ -92,12 +115,30 @@ const Dialog = ({
|
|
|
92
115
|
left: 0,
|
|
93
116
|
zIndex: 9999
|
|
94
117
|
},
|
|
95
|
-
children:
|
|
118
|
+
children: /*#__PURE__*/jsx(Blanket, {
|
|
96
119
|
ref: blanketRef
|
|
97
|
-
})
|
|
120
|
+
})
|
|
121
|
+
}), /*#__PURE__*/jsx(MotionView, {
|
|
122
|
+
initial: motionProps?.initial ?? DEFAULT_MOTION_PROPS.initial,
|
|
123
|
+
animate: motionProps?.animate ?? DEFAULT_MOTION_PROPS.animate,
|
|
124
|
+
exit: motionProps?.exit ?? DEFAULT_MOTION_PROPS.exit,
|
|
125
|
+
transition: motionProps?.transition ?? DEFAULT_MOTION_PROPS.transition,
|
|
126
|
+
sx: {
|
|
127
|
+
position: 'fixed',
|
|
128
|
+
top: 0,
|
|
129
|
+
right: 0,
|
|
130
|
+
bottom: 0,
|
|
131
|
+
left: 0,
|
|
132
|
+
zIndex: 9999,
|
|
133
|
+
pointerEvents: 'none'
|
|
134
|
+
},
|
|
135
|
+
children: /*#__PURE__*/jsx(View, {
|
|
98
136
|
display: 'flex',
|
|
99
137
|
width: '100%',
|
|
100
138
|
height: '100%',
|
|
139
|
+
sx: {
|
|
140
|
+
pointerEvents: 'none'
|
|
141
|
+
},
|
|
101
142
|
children: /*#__PURE__*/jsxs(BaseDialog, {
|
|
102
143
|
className: `trk-dialog--${size}`,
|
|
103
144
|
ref: dialogRef,
|
|
@@ -159,8 +200,8 @@ const Dialog = ({
|
|
|
159
200
|
children: children
|
|
160
201
|
})]
|
|
161
202
|
})
|
|
162
|
-
})
|
|
163
|
-
})
|
|
203
|
+
})
|
|
204
|
+
})]
|
|
164
205
|
}) : null
|
|
165
206
|
});
|
|
166
207
|
};
|
|
@@ -183,7 +224,8 @@ const BaseDialog = /*#__PURE__*/styled.div.withConfig({
|
|
|
183
224
|
backgroundColor: theme.colors['surface'],
|
|
184
225
|
outline: 'none',
|
|
185
226
|
overflow: 'hidden',
|
|
186
|
-
margin: 'auto'
|
|
227
|
+
margin: 'auto',
|
|
228
|
+
pointerEvents: 'auto'
|
|
187
229
|
}), sx);
|
|
188
230
|
var index = Object.assign( /*#__PURE__*/forwardRef(Dialog), {
|
|
189
231
|
UnstyledHeader: UnstyledDialogHeader,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamturing/react-kit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.73.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",
|
|
@@ -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": "b803956a45b587b87b805a0eff212037d35d29fa"
|
|
69
69
|
}
|