@teamturing/react-kit 2.71.1 → 2.72.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 +5 -1
- package/dist/index.js +26 -19
- package/esm/core/Dialog/index.js +27 -20
- 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,14 @@ 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;
|
|
18
21
|
} & SxProp;
|
|
19
22
|
declare const _default: import("react").ForwardRefExoticComponent<{
|
|
20
23
|
isOpen?: boolean | undefined;
|
|
@@ -22,6 +25,7 @@ declare const _default: import("react").ForwardRefExoticComponent<{
|
|
|
22
25
|
isOutsideClickDismissable?: boolean | undefined;
|
|
23
26
|
size?: DialogSizeType | undefined;
|
|
24
27
|
initialFocusRef?: RefObject<HTMLElement> | undefined;
|
|
28
|
+
motionProps?: Partial<Pick<HTMLMotionProps<"div">, "transition" | "initial" | "animate" | "exit">> | undefined;
|
|
25
29
|
} & SxProp & {
|
|
26
30
|
children?: import("react").ReactNode;
|
|
27
31
|
} & import("react").RefAttributes<HTMLDivElement>> & {
|
|
@@ -842,4 +846,4 @@ declare const _default: import("react").ForwardRefExoticComponent<{
|
|
|
842
846
|
Footer: ({ children, sx, ...props }: PropsWithChildren<DialogFooterProps>) => import("react/jsx-runtime").JSX.Element;
|
|
843
847
|
};
|
|
844
848
|
export default _default;
|
|
845
|
-
export type { Props as DialogProps, UnstyledDialogHeaderProps, UnstyledDialogBodyProps, UnstyledDialogFooterProps, DialogHeaderProps, DialogHeaderTitleProps, DialogHeaderSubtitleProps, DialogBodyProps, DialogFooterProps, };
|
|
849
|
+
export type { Props as DialogProps, DialogMotionProps, UnstyledDialogHeaderProps, UnstyledDialogBodyProps, UnstyledDialogFooterProps, DialogHeaderProps, DialogHeaderTitleProps, DialogHeaderSubtitleProps, DialogBodyProps, DialogFooterProps, };
|
package/dist/index.js
CHANGED
|
@@ -5622,6 +5622,27 @@ 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
|
+
};
|
|
5625
5646
|
const Dialog = ({
|
|
5626
5647
|
children,
|
|
5627
5648
|
isOpen,
|
|
@@ -5629,6 +5650,7 @@ const Dialog = ({
|
|
|
5629
5650
|
isOutsideClickDismissable = true,
|
|
5630
5651
|
size = 'm',
|
|
5631
5652
|
initialFocusRef,
|
|
5653
|
+
motionProps,
|
|
5632
5654
|
sx
|
|
5633
5655
|
}, ref) => {
|
|
5634
5656
|
const theme = styled.useTheme();
|
|
@@ -5668,25 +5690,10 @@ const Dialog = ({
|
|
|
5668
5690
|
return /*#__PURE__*/jsxRuntime.jsx(framerMotion.AnimatePresence, {
|
|
5669
5691
|
children: isOpen ? /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
5670
5692
|
children: /*#__PURE__*/jsxRuntime.jsxs(MotionView, {
|
|
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
|
-
},
|
|
5693
|
+
initial: motionProps?.initial ?? DEFAULT_MOTION_PROPS.initial,
|
|
5694
|
+
animate: motionProps?.animate ?? DEFAULT_MOTION_PROPS.animate,
|
|
5695
|
+
exit: motionProps?.exit ?? DEFAULT_MOTION_PROPS.exit,
|
|
5696
|
+
transition: motionProps?.transition ?? DEFAULT_MOTION_PROPS.transition,
|
|
5690
5697
|
sx: {
|
|
5691
5698
|
position: 'fixed',
|
|
5692
5699
|
top: 0,
|
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';
|
|
@@ -19,6 +19,27 @@ import UnstyledDialogFooter from './_UnstyledDialogFooter.js';
|
|
|
19
19
|
import UnstyledDialogHeader from './_UnstyledDialogHeader.js';
|
|
20
20
|
import { jsx, Fragment, jsxs } 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
|
+
};
|
|
22
43
|
const Dialog = ({
|
|
23
44
|
children,
|
|
24
45
|
isOpen,
|
|
@@ -26,6 +47,7 @@ const Dialog = ({
|
|
|
26
47
|
isOutsideClickDismissable = true,
|
|
27
48
|
size = 'm',
|
|
28
49
|
initialFocusRef,
|
|
50
|
+
motionProps,
|
|
29
51
|
sx
|
|
30
52
|
}, ref) => {
|
|
31
53
|
const theme = useTheme();
|
|
@@ -65,25 +87,10 @@ const Dialog = ({
|
|
|
65
87
|
return /*#__PURE__*/jsx(AnimatePresence, {
|
|
66
88
|
children: isOpen ? /*#__PURE__*/jsx(Fragment, {
|
|
67
89
|
children: /*#__PURE__*/jsxs(MotionView, {
|
|
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
|
-
},
|
|
90
|
+
initial: motionProps?.initial ?? DEFAULT_MOTION_PROPS.initial,
|
|
91
|
+
animate: motionProps?.animate ?? DEFAULT_MOTION_PROPS.animate,
|
|
92
|
+
exit: motionProps?.exit ?? DEFAULT_MOTION_PROPS.exit,
|
|
93
|
+
transition: motionProps?.transition ?? DEFAULT_MOTION_PROPS.transition,
|
|
87
94
|
sx: {
|
|
88
95
|
position: 'fixed',
|
|
89
96
|
top: 0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamturing/react-kit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.72.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": "edc5ac0a6961a8ee1a543659662dcfd8b2e4980f"
|
|
69
69
|
}
|