@teamturing/react-kit 2.19.9 → 2.19.11
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/index.d.ts +0 -2
- package/dist/index.js +63 -120
- package/esm/core/Dialog/index.js +56 -80
- package/esm/core/Pagination/index.js +5 -1
- package/esm/index.js +0 -2
- package/package.json +2 -2
- package/dist/core/DialogHandler/index.d.ts +0 -13
- package/dist/hook/useDialogHandler.d.ts +0 -6
- package/esm/core/DialogHandler/index.js +0 -33
- package/esm/hook/useDialogHandler.js +0 -14
package/dist/index.d.ts
CHANGED
|
@@ -25,7 +25,6 @@ export { default as DescriptionList } from './core/DescriptionList';
|
|
|
25
25
|
export type { DescriptionListProps } from './core/DescriptionList';
|
|
26
26
|
export { default as Dialog } from './core/Dialog';
|
|
27
27
|
export type { DialogProps, UnstyledDialogHeaderProps, UnstyledDialogBodyProps, UnstyledDialogFooterProps, DialogHeaderProps, DialogHeaderTitleProps, DialogHeaderSubtitleProps, DialogBodyProps, DialogFooterProps, } from './core/Dialog';
|
|
28
|
-
export { default as DialogHandler } from './core/DialogHandler';
|
|
29
28
|
export { default as EmptyState } from './core/EmptyState';
|
|
30
29
|
export type { EmptyStateProps } from './core/EmptyState';
|
|
31
30
|
export { default as FormControl } from './core/FormControl';
|
|
@@ -90,7 +89,6 @@ export { default as EnigmaUI } from './enigma/EnigmaUI';
|
|
|
90
89
|
* hooks
|
|
91
90
|
*/
|
|
92
91
|
export { default as useDevice } from './hook/useDevice';
|
|
93
|
-
export { default as useDialogHandler } from './hook/useDialogHandler';
|
|
94
92
|
export { default as useFocusTrap } from './hook/useFocusTrap';
|
|
95
93
|
export { default as useFocusZone } from './hook/useFocusZone';
|
|
96
94
|
export { default as useMediaQuery } from './hook/useMediaQuery';
|
package/dist/index.js
CHANGED
|
@@ -18766,8 +18766,6 @@ const useFocusTrap = (settings, dependencies = []) => {
|
|
|
18766
18766
|
};
|
|
18767
18767
|
};
|
|
18768
18768
|
|
|
18769
|
-
const MotionView = motion(View);
|
|
18770
|
-
|
|
18771
18769
|
const UnstyledDialogBody = styled__default.default.div`
|
|
18772
18770
|
flex-grow: 1;
|
|
18773
18771
|
flex-shrink: 1;
|
|
@@ -18904,87 +18902,66 @@ const Dialog = ({
|
|
|
18904
18902
|
};
|
|
18905
18903
|
}
|
|
18906
18904
|
}, [isOpen, handleOutsideClick]);
|
|
18907
|
-
return /*#__PURE__*/jsxRuntimeExports.
|
|
18908
|
-
|
|
18909
|
-
|
|
18910
|
-
|
|
18911
|
-
|
|
18912
|
-
|
|
18913
|
-
|
|
18914
|
-
|
|
18915
|
-
|
|
18916
|
-
|
|
18917
|
-
|
|
18918
|
-
|
|
18919
|
-
|
|
18920
|
-
|
|
18921
|
-
|
|
18922
|
-
|
|
18923
|
-
|
|
18924
|
-
* easeOutQuad by https://easings.net/ko#easeOutQuad
|
|
18925
|
-
*/
|
|
18926
|
-
ease: cubicBezier(0.5, 1, 0.89, 1)
|
|
18927
|
-
},
|
|
18905
|
+
return isOpen ? /*#__PURE__*/jsxRuntimeExports.jsxs(View, {
|
|
18906
|
+
sx: {
|
|
18907
|
+
position: 'fixed',
|
|
18908
|
+
display: 'flex',
|
|
18909
|
+
top: 0,
|
|
18910
|
+
left: 0,
|
|
18911
|
+
width: '100%',
|
|
18912
|
+
height: '100%',
|
|
18913
|
+
zIndex: 9999
|
|
18914
|
+
},
|
|
18915
|
+
children: [/*#__PURE__*/jsxRuntimeExports.jsx(Blanket, {
|
|
18916
|
+
ref: overlayRef
|
|
18917
|
+
}), /*#__PURE__*/jsxRuntimeExports.jsxs(BaseDialog, {
|
|
18918
|
+
ref: dialogRef,
|
|
18919
|
+
"aria-modal": 'true',
|
|
18920
|
+
role: 'dialog',
|
|
18921
|
+
tabIndex: -1,
|
|
18928
18922
|
sx: {
|
|
18929
|
-
|
|
18930
|
-
|
|
18931
|
-
|
|
18932
|
-
|
|
18933
|
-
|
|
18934
|
-
|
|
18935
|
-
|
|
18923
|
+
...(size === 's' ? {
|
|
18924
|
+
maxHeight: 'calc(100vh - 64px)',
|
|
18925
|
+
width: ['calc(100% - 64px)', 400, 400],
|
|
18926
|
+
marginX: 'auto',
|
|
18927
|
+
marginY: 'auto',
|
|
18928
|
+
borderRadius: 'l'
|
|
18929
|
+
} : size === 'm' ? {
|
|
18930
|
+
maxHeight: ['100%', '100%', 'calc(100vh - 64px)'],
|
|
18931
|
+
height: ['100%', '100%', 'auto'],
|
|
18932
|
+
minHeight: ['-webkit-fill-available', '-webkit-fill-available', 'auto'],
|
|
18933
|
+
width: ['100%', '100%', 640],
|
|
18934
|
+
marginX: [0, 0, 'auto'],
|
|
18935
|
+
marginY: 'auto',
|
|
18936
|
+
borderRadius: ['none', 'none', 'l']
|
|
18937
|
+
} : size === 'l' ? {
|
|
18938
|
+
maxHeight: ['100%', '100%', 'calc(100vh - 64px)'],
|
|
18939
|
+
height: ['100%', '100%', 'auto'],
|
|
18940
|
+
minHeight: ['-webkit-fill-available', '-webkit-fill-available', 'auto'],
|
|
18941
|
+
width: ['100%', '100%', 860],
|
|
18942
|
+
marginX: [0, 0, 'auto'],
|
|
18943
|
+
marginY: 'auto',
|
|
18944
|
+
borderRadius: ['none', 'none', 'l']
|
|
18945
|
+
} : {}),
|
|
18946
|
+
...sx
|
|
18936
18947
|
},
|
|
18937
|
-
|
|
18938
|
-
|
|
18939
|
-
}), /*#__PURE__*/jsxRuntimeExports.jsxs(BaseDialog, {
|
|
18940
|
-
ref: dialogRef,
|
|
18941
|
-
"aria-modal": 'true',
|
|
18942
|
-
role: 'dialog',
|
|
18943
|
-
tabIndex: -1,
|
|
18948
|
+
onKeyDown: handleKeyDown,
|
|
18949
|
+
children: [/*#__PURE__*/jsxRuntimeExports.jsx(View, {
|
|
18944
18950
|
sx: {
|
|
18945
|
-
|
|
18946
|
-
|
|
18947
|
-
|
|
18948
|
-
marginX: 'auto',
|
|
18949
|
-
marginY: 'auto',
|
|
18950
|
-
borderRadius: 'l'
|
|
18951
|
-
} : size === 'm' ? {
|
|
18952
|
-
maxHeight: ['100%', '100%', 'calc(100vh - 64px)'],
|
|
18953
|
-
height: ['100%', '100%', 'auto'],
|
|
18954
|
-
minHeight: ['-webkit-fill-available', '-webkit-fill-available', 'auto'],
|
|
18955
|
-
width: ['100%', '100%', 640],
|
|
18956
|
-
marginX: [0, 0, 'auto'],
|
|
18957
|
-
marginY: 'auto',
|
|
18958
|
-
borderRadius: ['none', 'none', 'l']
|
|
18959
|
-
} : size === 'l' ? {
|
|
18960
|
-
maxHeight: ['100%', '100%', 'calc(100vh - 64px)'],
|
|
18961
|
-
height: ['100%', '100%', 'auto'],
|
|
18962
|
-
minHeight: ['-webkit-fill-available', '-webkit-fill-available', 'auto'],
|
|
18963
|
-
width: ['100%', '100%', 860],
|
|
18964
|
-
marginX: [0, 0, 'auto'],
|
|
18965
|
-
marginY: 'auto',
|
|
18966
|
-
borderRadius: ['none', 'none', 'l']
|
|
18967
|
-
} : {}),
|
|
18968
|
-
...sx
|
|
18951
|
+
position: 'absolute',
|
|
18952
|
+
top: 3,
|
|
18953
|
+
right: 3
|
|
18969
18954
|
},
|
|
18970
|
-
|
|
18971
|
-
|
|
18972
|
-
|
|
18973
|
-
|
|
18974
|
-
|
|
18975
|
-
|
|
18976
|
-
|
|
18977
|
-
|
|
18978
|
-
|
|
18979
|
-
|
|
18980
|
-
variant: 'plain',
|
|
18981
|
-
size: 'm',
|
|
18982
|
-
onClick: handleDismiss
|
|
18983
|
-
})
|
|
18984
|
-
}), children]
|
|
18985
|
-
})]
|
|
18986
|
-
}) : null
|
|
18987
|
-
});
|
|
18955
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx(IconButton, {
|
|
18956
|
+
ref: closeButtonRef,
|
|
18957
|
+
icon: SvgClose,
|
|
18958
|
+
variant: 'plain',
|
|
18959
|
+
size: 'm',
|
|
18960
|
+
onClick: handleDismiss
|
|
18961
|
+
})
|
|
18962
|
+
}), children]
|
|
18963
|
+
})]
|
|
18964
|
+
}) : null;
|
|
18988
18965
|
};
|
|
18989
18966
|
const Blanket = styled__default.default.span`
|
|
18990
18967
|
&:before {
|
|
@@ -19020,44 +18997,6 @@ var index$6 = Object.assign( /*#__PURE__*/React.forwardRef(Dialog), {
|
|
|
19020
18997
|
Footer: DialogFooter
|
|
19021
18998
|
});
|
|
19022
18999
|
|
|
19023
|
-
const useDialogHandler = () => {
|
|
19024
|
-
const [isOpen, setIsOpen] = React.useState(false);
|
|
19025
|
-
const openDialog = () => setIsOpen(true);
|
|
19026
|
-
const closeDialog = () => setIsOpen(false);
|
|
19027
|
-
return {
|
|
19028
|
-
isOpen,
|
|
19029
|
-
openDialog,
|
|
19030
|
-
closeDialog
|
|
19031
|
-
};
|
|
19032
|
-
};
|
|
19033
|
-
|
|
19034
|
-
const DialogHandler = ({
|
|
19035
|
-
renderDialog,
|
|
19036
|
-
onClick,
|
|
19037
|
-
children: propChildren
|
|
19038
|
-
}) => {
|
|
19039
|
-
const {
|
|
19040
|
-
isOpen,
|
|
19041
|
-
openDialog,
|
|
19042
|
-
closeDialog
|
|
19043
|
-
} = useDialogHandler();
|
|
19044
|
-
const handleClick = e => {
|
|
19045
|
-
onClick?.(e);
|
|
19046
|
-
openDialog();
|
|
19047
|
-
};
|
|
19048
|
-
const children = isFunction(propChildren) ? propChildren({
|
|
19049
|
-
openDialog
|
|
19050
|
-
}) : React.Children.map(propChildren, child => /*#__PURE__*/React.cloneElement(child, {
|
|
19051
|
-
onClick: handleClick
|
|
19052
|
-
}));
|
|
19053
|
-
return /*#__PURE__*/jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
|
|
19054
|
-
children: [children, renderDialog({
|
|
19055
|
-
isOpen,
|
|
19056
|
-
closeDialog
|
|
19057
|
-
})]
|
|
19058
|
-
});
|
|
19059
|
-
};
|
|
19060
|
-
|
|
19061
19000
|
const EmptyState = ({
|
|
19062
19001
|
title,
|
|
19063
19002
|
icon: Icon = SvgDocument,
|
|
@@ -21965,6 +21904,8 @@ const BaseIconToggleButton = styled__default.default(UnstyledButton)(({
|
|
|
21965
21904
|
}
|
|
21966
21905
|
}), sx);
|
|
21967
21906
|
|
|
21907
|
+
const MotionView = motion(View);
|
|
21908
|
+
|
|
21968
21909
|
const Pagination = ({
|
|
21969
21910
|
pages: propPages,
|
|
21970
21911
|
currentPageIndex,
|
|
@@ -22072,7 +22013,11 @@ const BasePagination = styled__default.default.nav`
|
|
|
22072
22013
|
${variant({
|
|
22073
22014
|
prop: 'type',
|
|
22074
22015
|
variants: {
|
|
22075
|
-
default: {
|
|
22016
|
+
default: {
|
|
22017
|
+
'& > *:not(:first-child):not(:last-child)': {
|
|
22018
|
+
display: 'inline-block !important'
|
|
22019
|
+
}
|
|
22020
|
+
},
|
|
22076
22021
|
simple: {
|
|
22077
22022
|
'& > *:not(:first-child):not(:last-child)': {
|
|
22078
22023
|
display: 'none !important'
|
|
@@ -24187,7 +24132,6 @@ exports.CounterBadge = CounterBadge;
|
|
|
24187
24132
|
exports.Datagrid = index$7;
|
|
24188
24133
|
exports.DescriptionList = DescriptionList;
|
|
24189
24134
|
exports.Dialog = index$6;
|
|
24190
|
-
exports.DialogHandler = DialogHandler;
|
|
24191
24135
|
exports.EmptyState = EmptyState;
|
|
24192
24136
|
exports.EnigmaUI = index;
|
|
24193
24137
|
exports.FormControl = index$4;
|
|
@@ -24223,7 +24167,6 @@ exports.sx = sx;
|
|
|
24223
24167
|
exports.textDecoration = textDecoration;
|
|
24224
24168
|
exports.theme = theme;
|
|
24225
24169
|
exports.useDevice = useDevice;
|
|
24226
|
-
exports.useDialogHandler = useDialogHandler;
|
|
24227
24170
|
exports.useFocusTrap = useFocusTrap;
|
|
24228
24171
|
exports.useFocusZone = useFocusZone;
|
|
24229
24172
|
exports.useMediaQuery = useMediaQuery;
|
package/esm/core/Dialog/index.js
CHANGED
|
@@ -8,7 +8,6 @@ import IconButton from '../IconButton/index.js';
|
|
|
8
8
|
import View from '../View/index.js';
|
|
9
9
|
import useFocusTrap from '../../hook/useFocusTrap.js';
|
|
10
10
|
import { sx } from '../../utils/styled-system/index.js';
|
|
11
|
-
import MotionView from '../MotionView/index.js';
|
|
12
11
|
import DialogBody from './DialogBody.js';
|
|
13
12
|
import DialogFooter from './DialogFooter.js';
|
|
14
13
|
import DialogHeader from './DialogHeader.js';
|
|
@@ -18,8 +17,6 @@ import UnstyledDialogBody from './_UnstyledDialogBody.js';
|
|
|
18
17
|
import UnstyledDialogFooter from './_UnstyledDialogFooter.js';
|
|
19
18
|
import UnstyledDialogHeader from './_UnstyledDialogHeader.js';
|
|
20
19
|
import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
|
|
21
|
-
import { AnimatePresence } from '../../node_modules/framer-motion/dist/es/components/AnimatePresence/index.js';
|
|
22
|
-
import { cubicBezier } from '../../node_modules/framer-motion/dist/es/easing/cubic-bezier.js';
|
|
23
20
|
|
|
24
21
|
const Dialog = ({
|
|
25
22
|
children,
|
|
@@ -59,87 +56,66 @@ const Dialog = ({
|
|
|
59
56
|
};
|
|
60
57
|
}
|
|
61
58
|
}, [isOpen, handleOutsideClick]);
|
|
62
|
-
return /*#__PURE__*/jsxRuntimeExports.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
* easeOutQuad by https://easings.net/ko#easeOutQuad
|
|
80
|
-
*/
|
|
81
|
-
ease: cubicBezier(0.5, 1, 0.89, 1)
|
|
82
|
-
},
|
|
59
|
+
return isOpen ? /*#__PURE__*/jsxRuntimeExports.jsxs(View, {
|
|
60
|
+
sx: {
|
|
61
|
+
position: 'fixed',
|
|
62
|
+
display: 'flex',
|
|
63
|
+
top: 0,
|
|
64
|
+
left: 0,
|
|
65
|
+
width: '100%',
|
|
66
|
+
height: '100%',
|
|
67
|
+
zIndex: 9999
|
|
68
|
+
},
|
|
69
|
+
children: [/*#__PURE__*/jsxRuntimeExports.jsx(Blanket, {
|
|
70
|
+
ref: overlayRef
|
|
71
|
+
}), /*#__PURE__*/jsxRuntimeExports.jsxs(BaseDialog, {
|
|
72
|
+
ref: dialogRef,
|
|
73
|
+
"aria-modal": 'true',
|
|
74
|
+
role: 'dialog',
|
|
75
|
+
tabIndex: -1,
|
|
83
76
|
sx: {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
77
|
+
...(size === 's' ? {
|
|
78
|
+
maxHeight: 'calc(100vh - 64px)',
|
|
79
|
+
width: ['calc(100% - 64px)', 400, 400],
|
|
80
|
+
marginX: 'auto',
|
|
81
|
+
marginY: 'auto',
|
|
82
|
+
borderRadius: 'l'
|
|
83
|
+
} : size === 'm' ? {
|
|
84
|
+
maxHeight: ['100%', '100%', 'calc(100vh - 64px)'],
|
|
85
|
+
height: ['100%', '100%', 'auto'],
|
|
86
|
+
minHeight: ['-webkit-fill-available', '-webkit-fill-available', 'auto'],
|
|
87
|
+
width: ['100%', '100%', 640],
|
|
88
|
+
marginX: [0, 0, 'auto'],
|
|
89
|
+
marginY: 'auto',
|
|
90
|
+
borderRadius: ['none', 'none', 'l']
|
|
91
|
+
} : size === 'l' ? {
|
|
92
|
+
maxHeight: ['100%', '100%', 'calc(100vh - 64px)'],
|
|
93
|
+
height: ['100%', '100%', 'auto'],
|
|
94
|
+
minHeight: ['-webkit-fill-available', '-webkit-fill-available', 'auto'],
|
|
95
|
+
width: ['100%', '100%', 860],
|
|
96
|
+
marginX: [0, 0, 'auto'],
|
|
97
|
+
marginY: 'auto',
|
|
98
|
+
borderRadius: ['none', 'none', 'l']
|
|
99
|
+
} : {}),
|
|
100
|
+
...sx
|
|
91
101
|
},
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}), /*#__PURE__*/jsxRuntimeExports.jsxs(BaseDialog, {
|
|
95
|
-
ref: dialogRef,
|
|
96
|
-
"aria-modal": 'true',
|
|
97
|
-
role: 'dialog',
|
|
98
|
-
tabIndex: -1,
|
|
102
|
+
onKeyDown: handleKeyDown,
|
|
103
|
+
children: [/*#__PURE__*/jsxRuntimeExports.jsx(View, {
|
|
99
104
|
sx: {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
marginX: 'auto',
|
|
104
|
-
marginY: 'auto',
|
|
105
|
-
borderRadius: 'l'
|
|
106
|
-
} : size === 'm' ? {
|
|
107
|
-
maxHeight: ['100%', '100%', 'calc(100vh - 64px)'],
|
|
108
|
-
height: ['100%', '100%', 'auto'],
|
|
109
|
-
minHeight: ['-webkit-fill-available', '-webkit-fill-available', 'auto'],
|
|
110
|
-
width: ['100%', '100%', 640],
|
|
111
|
-
marginX: [0, 0, 'auto'],
|
|
112
|
-
marginY: 'auto',
|
|
113
|
-
borderRadius: ['none', 'none', 'l']
|
|
114
|
-
} : size === 'l' ? {
|
|
115
|
-
maxHeight: ['100%', '100%', 'calc(100vh - 64px)'],
|
|
116
|
-
height: ['100%', '100%', 'auto'],
|
|
117
|
-
minHeight: ['-webkit-fill-available', '-webkit-fill-available', 'auto'],
|
|
118
|
-
width: ['100%', '100%', 860],
|
|
119
|
-
marginX: [0, 0, 'auto'],
|
|
120
|
-
marginY: 'auto',
|
|
121
|
-
borderRadius: ['none', 'none', 'l']
|
|
122
|
-
} : {}),
|
|
123
|
-
...sx
|
|
105
|
+
position: 'absolute',
|
|
106
|
+
top: 3,
|
|
107
|
+
right: 3
|
|
124
108
|
},
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
variant: 'plain',
|
|
136
|
-
size: 'm',
|
|
137
|
-
onClick: handleDismiss
|
|
138
|
-
})
|
|
139
|
-
}), children]
|
|
140
|
-
})]
|
|
141
|
-
}) : null
|
|
142
|
-
});
|
|
109
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx(IconButton, {
|
|
110
|
+
ref: closeButtonRef,
|
|
111
|
+
icon: SvgClose,
|
|
112
|
+
variant: 'plain',
|
|
113
|
+
size: 'm',
|
|
114
|
+
onClick: handleDismiss
|
|
115
|
+
})
|
|
116
|
+
}), children]
|
|
117
|
+
})]
|
|
118
|
+
}) : null;
|
|
143
119
|
};
|
|
144
120
|
const Blanket = styled.span`
|
|
145
121
|
&:before {
|
|
@@ -117,7 +117,11 @@ const BasePagination = styled.nav`
|
|
|
117
117
|
${variant({
|
|
118
118
|
prop: 'type',
|
|
119
119
|
variants: {
|
|
120
|
-
default: {
|
|
120
|
+
default: {
|
|
121
|
+
'& > *:not(:first-child):not(:last-child)': {
|
|
122
|
+
display: 'inline-block !important'
|
|
123
|
+
}
|
|
124
|
+
},
|
|
121
125
|
simple: {
|
|
122
126
|
'& > *:not(:first-child):not(:last-child)': {
|
|
123
127
|
display: 'none !important'
|
package/esm/index.js
CHANGED
|
@@ -9,7 +9,6 @@ export { default as CounterBadge } from './core/CounterBadge/index.js';
|
|
|
9
9
|
export { default as Datagrid } from './core/Datagrid/index.js';
|
|
10
10
|
export { default as DescriptionList } from './core/DescriptionList/index.js';
|
|
11
11
|
export { default as Dialog } from './core/Dialog/index.js';
|
|
12
|
-
export { default as DialogHandler } from './core/DialogHandler/index.js';
|
|
13
12
|
export { default as EmptyState } from './core/EmptyState/index.js';
|
|
14
13
|
export { default as FormControl } from './core/FormControl/index.js';
|
|
15
14
|
export { default as GradientText } from './core/GradientText/index.js';
|
|
@@ -41,7 +40,6 @@ export { default as View } from './core/View/index.js';
|
|
|
41
40
|
export { default as UnstyledButton } from './core/_UnstyledButton.js';
|
|
42
41
|
export { default as EnigmaUI } from './enigma/EnigmaUI/index.js';
|
|
43
42
|
export { default as useDevice } from './hook/useDevice.js';
|
|
44
|
-
export { default as useDialogHandler } from './hook/useDialogHandler.js';
|
|
45
43
|
export { default as useFocusTrap } from './hook/useFocusTrap.js';
|
|
46
44
|
export { default as useFocusZone } from './hook/useFocusZone.js';
|
|
47
45
|
export { default as useMediaQuery } from './hook/useMediaQuery.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamturing/react-kit",
|
|
3
|
-
"version": "2.19.
|
|
3
|
+
"version": "2.19.11",
|
|
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": "
|
|
65
|
+
"gitHead": "23c5345fb1eebd5b871f0b3c10e49cd3fe044178"
|
|
66
66
|
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { MouseEvent as ReactMouseEvent, ReactNode } from 'react';
|
|
2
|
-
type Props<Element extends HTMLElement> = {
|
|
3
|
-
renderDialog: ({ isOpen, closeDialog }: {
|
|
4
|
-
isOpen: boolean;
|
|
5
|
-
closeDialog: () => void;
|
|
6
|
-
}) => React.ReactNode;
|
|
7
|
-
onClick?: (e: ReactMouseEvent<Element, MouseEvent>) => void;
|
|
8
|
-
children: ReactNode | (({ openDialog }: {
|
|
9
|
-
openDialog: () => void;
|
|
10
|
-
}) => ReactNode);
|
|
11
|
-
};
|
|
12
|
-
declare const DialogHandler: <Element_1 extends HTMLElement>({ renderDialog, onClick, children: propChildren, }: Props<Element_1>) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
export default DialogHandler;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { isFunction } from '../../packages/utils/esm/isFunction.js';
|
|
2
|
-
import { Children, cloneElement } from 'react';
|
|
3
|
-
import useDialogHandler from '../../hook/useDialogHandler.js';
|
|
4
|
-
import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
|
|
5
|
-
|
|
6
|
-
const DialogHandler = ({
|
|
7
|
-
renderDialog,
|
|
8
|
-
onClick,
|
|
9
|
-
children: propChildren
|
|
10
|
-
}) => {
|
|
11
|
-
const {
|
|
12
|
-
isOpen,
|
|
13
|
-
openDialog,
|
|
14
|
-
closeDialog
|
|
15
|
-
} = useDialogHandler();
|
|
16
|
-
const handleClick = e => {
|
|
17
|
-
onClick?.(e);
|
|
18
|
-
openDialog();
|
|
19
|
-
};
|
|
20
|
-
const children = isFunction(propChildren) ? propChildren({
|
|
21
|
-
openDialog
|
|
22
|
-
}) : Children.map(propChildren, child => /*#__PURE__*/cloneElement(child, {
|
|
23
|
-
onClick: handleClick
|
|
24
|
-
}));
|
|
25
|
-
return /*#__PURE__*/jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
|
|
26
|
-
children: [children, renderDialog({
|
|
27
|
-
isOpen,
|
|
28
|
-
closeDialog
|
|
29
|
-
})]
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export { DialogHandler as default };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
|
|
3
|
-
const useDialogHandler = () => {
|
|
4
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
5
|
-
const openDialog = () => setIsOpen(true);
|
|
6
|
-
const closeDialog = () => setIsOpen(false);
|
|
7
|
-
return {
|
|
8
|
-
isOpen,
|
|
9
|
-
openDialog,
|
|
10
|
-
closeDialog
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export { useDialogHandler as default };
|