@rockshin/tao-ui 0.0.1 → 0.0.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.
- package/dist/components/breadcrumb/breadcrumb.css +1088 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +43 -0
- package/dist/components/breadcrumb/breadcrumb.js +268 -0
- package/dist/components/button/button.css +43 -21
- package/dist/components/checkbox/checkbox.css +30 -12
- package/dist/components/collapsible/collapsible.css +1023 -0
- package/dist/components/collapsible/collapsible.d.ts +39 -0
- package/dist/components/collapsible/collapsible.js +168 -0
- package/dist/components/context-menu/context-menu.css +1146 -0
- package/dist/components/context-menu/context-menu.d.ts +19 -0
- package/dist/components/context-menu/context-menu.js +104 -0
- package/dist/components/date-picker/date-picker.css +44 -16
- package/dist/components/drawer/drawer.css +123 -13
- package/dist/components/drawer/drawer.d.ts +36 -3
- package/dist/components/drawer/drawer.js +314 -121
- package/dist/components/dropdown/dropdown.css +996 -0
- package/dist/components/dropdown/dropdown.d.ts +45 -0
- package/dist/components/dropdown/dropdown.js +381 -0
- package/dist/components/form-field/form.css +30 -12
- package/dist/components/input/input.css +44 -14
- package/dist/components/menu/menu-render.d.ts +89 -0
- package/dist/components/menu/menu-render.js +376 -0
- package/dist/components/menu/menu.css +1142 -0
- package/dist/components/modal/confirm-dialog.d.ts +37 -0
- package/dist/components/modal/confirm-dialog.js +193 -0
- package/dist/components/modal/confirm.d.ts +13 -0
- package/dist/components/modal/confirm.js +56 -0
- package/dist/components/modal/index.d.ts +21 -0
- package/dist/components/modal/index.js +18 -0
- package/dist/components/modal/modal.css +1166 -0
- package/dist/components/modal/modal.d.ts +50 -0
- package/dist/components/modal/modal.js +353 -0
- package/dist/components/modal/use-modal.d.ts +21 -0
- package/dist/components/modal/use-modal.js +83 -0
- package/dist/components/pagination/pagination.css +30 -12
- package/dist/components/radio/radio.css +30 -12
- package/dist/components/scroll-area/scroll-area.css +30 -12
- package/dist/components/select/mobile-select.css +65 -13
- package/dist/components/select/mobile-select.js +17 -3
- package/dist/components/select/select.css +102 -15
- package/dist/components/select/select.d.ts +4 -0
- package/dist/components/select/select.js +204 -168
- package/dist/components/splitter/splitter.css +30 -12
- package/dist/components/switch/switch.css +30 -12
- package/dist/components/table/table.css +54 -18
- package/dist/components/table/table.d.ts +17 -2
- package/dist/components/table/table.js +214 -206
- package/dist/components/tabs/tabs.css +33 -17
- package/dist/components/tag/tag.css +30 -12
- package/dist/components/textarea/textarea.css +1204 -0
- package/dist/components/textarea/textarea.d.ts +19 -0
- package/dist/components/textarea/textarea.js +181 -0
- package/dist/index.d.ts +24 -18
- package/dist/index.js +21 -15
- package/dist/layouts/stack/layout.css +30 -12
- package/dist/theme/control.css +44 -13
- package/dist/theme/theme.css +30 -12
- package/llms.txt +7 -6
- package/package.json +6 -1
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type FC, type ReactNode } from 'react';
|
|
2
|
+
import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic';
|
|
3
|
+
import { type ButtonProps } from '../button/button';
|
|
4
|
+
import './modal.css';
|
|
5
|
+
export type ModalSemanticPart = 'root' | 'overlay' | 'header' | 'title' | 'body' | 'footer' | 'close';
|
|
6
|
+
/** Render-prop form of `footer`: receives the default node and the two default button components. */
|
|
7
|
+
export type ModalFooterRender = (originNode: ReactNode, extra: {
|
|
8
|
+
OkBtn: FC;
|
|
9
|
+
CancelBtn: FC;
|
|
10
|
+
}) => ReactNode;
|
|
11
|
+
export interface ModalProps {
|
|
12
|
+
open: boolean;
|
|
13
|
+
onClose?: () => void;
|
|
14
|
+
title?: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Footer content.
|
|
17
|
+
* - `undefined` renders default OK/Cancel buttons
|
|
18
|
+
* - `null` renders no footer
|
|
19
|
+
* - a function receives `(originNode, { OkBtn, CancelBtn })` to compose around the defaults
|
|
20
|
+
*/
|
|
21
|
+
footer?: ReactNode | ModalFooterRender | null;
|
|
22
|
+
onOk?: () => void;
|
|
23
|
+
okText?: ReactNode;
|
|
24
|
+
cancelText?: ReactNode;
|
|
25
|
+
confirmLoading?: boolean;
|
|
26
|
+
/** Extra props forwarded to the default OK button. */
|
|
27
|
+
okButtonProps?: ButtonProps;
|
|
28
|
+
/** Extra props forwarded to the default Cancel button. */
|
|
29
|
+
cancelButtonProps?: ButtonProps;
|
|
30
|
+
width?: number | string;
|
|
31
|
+
/** Vertically center the dialog. Defaults to true. */
|
|
32
|
+
centered?: boolean;
|
|
33
|
+
/** Show the close (×) button. Defaults to true. */
|
|
34
|
+
closable?: boolean;
|
|
35
|
+
/** Close when clicking the mask/overlay. Defaults to true. */
|
|
36
|
+
maskClosable?: boolean;
|
|
37
|
+
/** Close on Esc key. Defaults to true. */
|
|
38
|
+
keyboard?: boolean;
|
|
39
|
+
/** Called after the modal has fully closed (open transitions true → false). */
|
|
40
|
+
afterClose?: () => void;
|
|
41
|
+
/**
|
|
42
|
+
* Unmount children when closed. Defaults to `true`.
|
|
43
|
+
* Set `false` to keep children mounted and preserve their state across open/close.
|
|
44
|
+
*/
|
|
45
|
+
destroyOnHidden?: boolean;
|
|
46
|
+
children?: ReactNode;
|
|
47
|
+
classNames?: SemanticClassNames<ModalSemanticPart>;
|
|
48
|
+
styles?: SemanticStyles<ModalSemanticPart>;
|
|
49
|
+
}
|
|
50
|
+
export declare function Modal({ open, onClose, title, footer, onOk, okText, cancelText, confirmLoading, okButtonProps, cancelButtonProps, width, centered, closable, maskClosable, keyboard, afterClose, destroyOnHidden, children, classNames, styles: stylesProp, }: ModalProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
4
|
+
import { cx } from "../../utils/semantic.js";
|
|
5
|
+
import { Button } from "../button/button.js";
|
|
6
|
+
import "./modal.css";
|
|
7
|
+
import * as __rspack_external__radix_ui_react_dialog_6b867f3d from "@radix-ui/react-dialog";
|
|
8
|
+
function Modal(t0) {
|
|
9
|
+
const $ = c(85);
|
|
10
|
+
const { open, onClose, title, footer, onOk, okText: t1, cancelText: t2, confirmLoading, okButtonProps, cancelButtonProps, width: t3, centered: t4, closable: t5, maskClosable: t6, keyboard: t7, afterClose, destroyOnHidden: t8, children, classNames, styles: stylesProp } = t0;
|
|
11
|
+
const okText = void 0 === t1 ? "OK" : t1;
|
|
12
|
+
const cancelText = void 0 === t2 ? "Cancel" : t2;
|
|
13
|
+
const width = void 0 === t3 ? 520 : t3;
|
|
14
|
+
const centered = void 0 === t4 ? true : t4;
|
|
15
|
+
const closable = void 0 === t5 ? true : t5;
|
|
16
|
+
const maskClosable = void 0 === t6 ? true : t6;
|
|
17
|
+
const keyboard = void 0 === t7 ? true : t7;
|
|
18
|
+
const destroyOnHidden = void 0 === t8 ? true : t8;
|
|
19
|
+
const prevOpen = useRef(open);
|
|
20
|
+
let t10;
|
|
21
|
+
let t9;
|
|
22
|
+
if ($[0] !== afterClose || $[1] !== open) {
|
|
23
|
+
t9 = ()=>{
|
|
24
|
+
if (prevOpen.current && !open) afterClose?.();
|
|
25
|
+
prevOpen.current = open;
|
|
26
|
+
};
|
|
27
|
+
t10 = [
|
|
28
|
+
open,
|
|
29
|
+
afterClose
|
|
30
|
+
];
|
|
31
|
+
$[0] = afterClose;
|
|
32
|
+
$[1] = open;
|
|
33
|
+
$[2] = t10;
|
|
34
|
+
$[3] = t9;
|
|
35
|
+
} else {
|
|
36
|
+
t10 = $[2];
|
|
37
|
+
t9 = $[3];
|
|
38
|
+
}
|
|
39
|
+
useEffect(t9, t10);
|
|
40
|
+
const t11 = "number" == typeof width ? `${width}px` : width;
|
|
41
|
+
const t12 = stylesProp?.root;
|
|
42
|
+
let t13;
|
|
43
|
+
if ($[4] !== t11 || $[5] !== t12) {
|
|
44
|
+
t13 = {
|
|
45
|
+
width: t11,
|
|
46
|
+
...t12
|
|
47
|
+
};
|
|
48
|
+
$[4] = t11;
|
|
49
|
+
$[5] = t12;
|
|
50
|
+
$[6] = t13;
|
|
51
|
+
} else t13 = $[6];
|
|
52
|
+
const contentStyle = t13;
|
|
53
|
+
let t14;
|
|
54
|
+
if ($[7] !== cancelButtonProps || $[8] !== cancelText || $[9] !== onClose) {
|
|
55
|
+
t14 = ()=>/*#__PURE__*/ jsx(Button, {
|
|
56
|
+
variant: "secondary",
|
|
57
|
+
onClick: onClose,
|
|
58
|
+
...cancelButtonProps,
|
|
59
|
+
children: cancelText
|
|
60
|
+
});
|
|
61
|
+
$[7] = cancelButtonProps;
|
|
62
|
+
$[8] = cancelText;
|
|
63
|
+
$[9] = onClose;
|
|
64
|
+
$[10] = t14;
|
|
65
|
+
} else t14 = $[10];
|
|
66
|
+
const CancelBtn = t14;
|
|
67
|
+
let t15;
|
|
68
|
+
if ($[11] !== confirmLoading || $[12] !== okButtonProps || $[13] !== okText || $[14] !== onOk) {
|
|
69
|
+
t15 = ()=>/*#__PURE__*/ jsx(Button, {
|
|
70
|
+
variant: "primary",
|
|
71
|
+
loading: confirmLoading,
|
|
72
|
+
onClick: onOk,
|
|
73
|
+
...okButtonProps,
|
|
74
|
+
children: okText
|
|
75
|
+
});
|
|
76
|
+
$[11] = confirmLoading;
|
|
77
|
+
$[12] = okButtonProps;
|
|
78
|
+
$[13] = okText;
|
|
79
|
+
$[14] = onOk;
|
|
80
|
+
$[15] = t15;
|
|
81
|
+
} else t15 = $[15];
|
|
82
|
+
const OkBtn = t15;
|
|
83
|
+
let t16;
|
|
84
|
+
if ($[16] !== CancelBtn) {
|
|
85
|
+
t16 = /*#__PURE__*/ jsx(CancelBtn, {});
|
|
86
|
+
$[16] = CancelBtn;
|
|
87
|
+
$[17] = t16;
|
|
88
|
+
} else t16 = $[17];
|
|
89
|
+
let t17;
|
|
90
|
+
if ($[18] !== OkBtn) {
|
|
91
|
+
t17 = /*#__PURE__*/ jsx(OkBtn, {});
|
|
92
|
+
$[18] = OkBtn;
|
|
93
|
+
$[19] = t17;
|
|
94
|
+
} else t17 = $[19];
|
|
95
|
+
let t18;
|
|
96
|
+
if ($[20] !== t16 || $[21] !== t17) {
|
|
97
|
+
t18 = /*#__PURE__*/ jsxs(Fragment, {
|
|
98
|
+
children: [
|
|
99
|
+
t16,
|
|
100
|
+
t17
|
|
101
|
+
]
|
|
102
|
+
});
|
|
103
|
+
$[20] = t16;
|
|
104
|
+
$[21] = t17;
|
|
105
|
+
$[22] = t18;
|
|
106
|
+
} else t18 = $[22];
|
|
107
|
+
const defaultFooter = t18;
|
|
108
|
+
let footerContent;
|
|
109
|
+
if (void 0 === footer) footerContent = defaultFooter;
|
|
110
|
+
else if ("function" == typeof footer) {
|
|
111
|
+
let t19;
|
|
112
|
+
if ($[23] !== CancelBtn || $[24] !== OkBtn || $[25] !== defaultFooter || $[26] !== footer) {
|
|
113
|
+
t19 = footer(defaultFooter, {
|
|
114
|
+
OkBtn,
|
|
115
|
+
CancelBtn
|
|
116
|
+
});
|
|
117
|
+
$[23] = CancelBtn;
|
|
118
|
+
$[24] = OkBtn;
|
|
119
|
+
$[25] = defaultFooter;
|
|
120
|
+
$[26] = footer;
|
|
121
|
+
$[27] = t19;
|
|
122
|
+
} else t19 = $[27];
|
|
123
|
+
footerContent = t19;
|
|
124
|
+
} else footerContent = footer;
|
|
125
|
+
const keepAlive = !destroyOnHidden;
|
|
126
|
+
const forceMount = keepAlive ? true : void 0;
|
|
127
|
+
let t19;
|
|
128
|
+
if ($[28] !== onClose) {
|
|
129
|
+
t19 = (v)=>{
|
|
130
|
+
if (!v) onClose?.();
|
|
131
|
+
};
|
|
132
|
+
$[28] = onClose;
|
|
133
|
+
$[29] = t19;
|
|
134
|
+
} else t19 = $[29];
|
|
135
|
+
const t20 = classNames?.overlay;
|
|
136
|
+
let t21;
|
|
137
|
+
if ($[30] !== t20) {
|
|
138
|
+
t21 = cx(t20);
|
|
139
|
+
$[30] = t20;
|
|
140
|
+
$[31] = t21;
|
|
141
|
+
} else t21 = $[31];
|
|
142
|
+
const t22 = stylesProp?.overlay;
|
|
143
|
+
let t23;
|
|
144
|
+
if ($[32] !== forceMount || $[33] !== t21 || $[34] !== t22) {
|
|
145
|
+
t23 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dialog_6b867f3d.Overlay, {
|
|
146
|
+
forceMount: forceMount,
|
|
147
|
+
"data-tao-modal-overlay": "",
|
|
148
|
+
className: t21,
|
|
149
|
+
style: t22
|
|
150
|
+
});
|
|
151
|
+
$[32] = forceMount;
|
|
152
|
+
$[33] = t21;
|
|
153
|
+
$[34] = t22;
|
|
154
|
+
$[35] = t23;
|
|
155
|
+
} else t23 = $[35];
|
|
156
|
+
const t24 = centered ? "" : void 0;
|
|
157
|
+
const t25 = open ? "" : void 0;
|
|
158
|
+
const t26 = classNames?.root;
|
|
159
|
+
let t27;
|
|
160
|
+
if ($[36] !== t26) {
|
|
161
|
+
t27 = cx(t26);
|
|
162
|
+
$[36] = t26;
|
|
163
|
+
$[37] = t27;
|
|
164
|
+
} else t27 = $[37];
|
|
165
|
+
let t28;
|
|
166
|
+
if ($[38] !== keyboard) {
|
|
167
|
+
t28 = (e)=>{
|
|
168
|
+
if (!keyboard) e.preventDefault();
|
|
169
|
+
};
|
|
170
|
+
$[38] = keyboard;
|
|
171
|
+
$[39] = t28;
|
|
172
|
+
} else t28 = $[39];
|
|
173
|
+
let t29;
|
|
174
|
+
let t30;
|
|
175
|
+
if ($[40] !== maskClosable) {
|
|
176
|
+
t29 = (e_0)=>{
|
|
177
|
+
if (!maskClosable) e_0.preventDefault();
|
|
178
|
+
};
|
|
179
|
+
t30 = (e_1)=>{
|
|
180
|
+
if (!maskClosable) e_1.preventDefault();
|
|
181
|
+
};
|
|
182
|
+
$[40] = maskClosable;
|
|
183
|
+
$[41] = t29;
|
|
184
|
+
$[42] = t30;
|
|
185
|
+
} else {
|
|
186
|
+
t29 = $[41];
|
|
187
|
+
t30 = $[42];
|
|
188
|
+
}
|
|
189
|
+
let t31;
|
|
190
|
+
if ($[43] !== classNames?.close || $[44] !== classNames?.header || $[45] !== classNames?.title || $[46] !== closable || $[47] !== onClose || $[48] !== stylesProp?.close || $[49] !== stylesProp?.header || $[50] !== stylesProp?.title || $[51] !== title) {
|
|
191
|
+
t31 = (null != title || closable) && /*#__PURE__*/ jsxs("div", {
|
|
192
|
+
"data-tao-modal-header": "",
|
|
193
|
+
className: cx(classNames?.header),
|
|
194
|
+
style: stylesProp?.header,
|
|
195
|
+
children: [
|
|
196
|
+
null != title ? /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dialog_6b867f3d.Title, {
|
|
197
|
+
"data-tao-modal-title": "",
|
|
198
|
+
className: cx(classNames?.title),
|
|
199
|
+
style: stylesProp?.title,
|
|
200
|
+
children: title
|
|
201
|
+
}) : /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dialog_6b867f3d.Title, {
|
|
202
|
+
"data-tao-modal-title": "",
|
|
203
|
+
style: {
|
|
204
|
+
display: "none"
|
|
205
|
+
}
|
|
206
|
+
}),
|
|
207
|
+
closable && /*#__PURE__*/ jsx("button", {
|
|
208
|
+
type: "button",
|
|
209
|
+
"data-tao-modal-close": "",
|
|
210
|
+
className: cx(classNames?.close),
|
|
211
|
+
style: stylesProp?.close,
|
|
212
|
+
onClick: onClose,
|
|
213
|
+
"aria-label": "Close",
|
|
214
|
+
children: /*#__PURE__*/ jsx(CloseIcon, {})
|
|
215
|
+
})
|
|
216
|
+
]
|
|
217
|
+
});
|
|
218
|
+
$[43] = classNames?.close;
|
|
219
|
+
$[44] = classNames?.header;
|
|
220
|
+
$[45] = classNames?.title;
|
|
221
|
+
$[46] = closable;
|
|
222
|
+
$[47] = onClose;
|
|
223
|
+
$[48] = stylesProp?.close;
|
|
224
|
+
$[49] = stylesProp?.header;
|
|
225
|
+
$[50] = stylesProp?.title;
|
|
226
|
+
$[51] = title;
|
|
227
|
+
$[52] = t31;
|
|
228
|
+
} else t31 = $[52];
|
|
229
|
+
const t32 = classNames?.body;
|
|
230
|
+
let t33;
|
|
231
|
+
if ($[53] !== t32) {
|
|
232
|
+
t33 = cx(t32);
|
|
233
|
+
$[53] = t32;
|
|
234
|
+
$[54] = t33;
|
|
235
|
+
} else t33 = $[54];
|
|
236
|
+
const t34 = stylesProp?.body;
|
|
237
|
+
let t35;
|
|
238
|
+
if ($[55] !== children || $[56] !== t33 || $[57] !== t34) {
|
|
239
|
+
t35 = /*#__PURE__*/ jsx("div", {
|
|
240
|
+
"data-tao-modal-body": "",
|
|
241
|
+
className: t33,
|
|
242
|
+
style: t34,
|
|
243
|
+
children: children
|
|
244
|
+
});
|
|
245
|
+
$[55] = children;
|
|
246
|
+
$[56] = t33;
|
|
247
|
+
$[57] = t34;
|
|
248
|
+
$[58] = t35;
|
|
249
|
+
} else t35 = $[58];
|
|
250
|
+
let t36;
|
|
251
|
+
if ($[59] !== classNames?.footer || $[60] !== footerContent || $[61] !== stylesProp?.footer) {
|
|
252
|
+
t36 = null != footerContent && /*#__PURE__*/ jsx("div", {
|
|
253
|
+
"data-tao-modal-footer": "",
|
|
254
|
+
className: cx(classNames?.footer),
|
|
255
|
+
style: stylesProp?.footer,
|
|
256
|
+
children: footerContent
|
|
257
|
+
});
|
|
258
|
+
$[59] = classNames?.footer;
|
|
259
|
+
$[60] = footerContent;
|
|
260
|
+
$[61] = stylesProp?.footer;
|
|
261
|
+
$[62] = t36;
|
|
262
|
+
} else t36 = $[62];
|
|
263
|
+
let t37;
|
|
264
|
+
if ($[63] !== contentStyle || $[64] !== forceMount || $[65] !== t27 || $[66] !== t28 || $[67] !== t29 || $[68] !== t30 || $[69] !== t31 || $[70] !== t35 || $[71] !== t36) {
|
|
265
|
+
t37 = /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_dialog_6b867f3d.Content, {
|
|
266
|
+
forceMount: forceMount,
|
|
267
|
+
"data-tao-modal": "",
|
|
268
|
+
style: contentStyle,
|
|
269
|
+
className: t27,
|
|
270
|
+
"aria-describedby": void 0,
|
|
271
|
+
onEscapeKeyDown: t28,
|
|
272
|
+
onPointerDownOutside: t29,
|
|
273
|
+
onInteractOutside: t30,
|
|
274
|
+
children: [
|
|
275
|
+
t31,
|
|
276
|
+
t35,
|
|
277
|
+
t36
|
|
278
|
+
]
|
|
279
|
+
});
|
|
280
|
+
$[63] = contentStyle;
|
|
281
|
+
$[64] = forceMount;
|
|
282
|
+
$[65] = t27;
|
|
283
|
+
$[66] = t28;
|
|
284
|
+
$[67] = t29;
|
|
285
|
+
$[68] = t30;
|
|
286
|
+
$[69] = t31;
|
|
287
|
+
$[70] = t35;
|
|
288
|
+
$[71] = t36;
|
|
289
|
+
$[72] = t37;
|
|
290
|
+
} else t37 = $[72];
|
|
291
|
+
let t38;
|
|
292
|
+
if ($[73] !== t24 || $[74] !== t25 || $[75] !== t37) {
|
|
293
|
+
t38 = /*#__PURE__*/ jsx("div", {
|
|
294
|
+
"data-tao-modal-wrap": "",
|
|
295
|
+
"data-tao-centered": t24,
|
|
296
|
+
"data-tao-open": t25,
|
|
297
|
+
children: t37
|
|
298
|
+
});
|
|
299
|
+
$[73] = t24;
|
|
300
|
+
$[74] = t25;
|
|
301
|
+
$[75] = t37;
|
|
302
|
+
$[76] = t38;
|
|
303
|
+
} else t38 = $[76];
|
|
304
|
+
let t39;
|
|
305
|
+
if ($[77] !== forceMount || $[78] !== t23 || $[79] !== t38) {
|
|
306
|
+
t39 = /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_dialog_6b867f3d.Portal, {
|
|
307
|
+
forceMount: forceMount,
|
|
308
|
+
children: [
|
|
309
|
+
t23,
|
|
310
|
+
t38
|
|
311
|
+
]
|
|
312
|
+
});
|
|
313
|
+
$[77] = forceMount;
|
|
314
|
+
$[78] = t23;
|
|
315
|
+
$[79] = t38;
|
|
316
|
+
$[80] = t39;
|
|
317
|
+
} else t39 = $[80];
|
|
318
|
+
let t40;
|
|
319
|
+
if ($[81] !== open || $[82] !== t19 || $[83] !== t39) {
|
|
320
|
+
t40 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dialog_6b867f3d.Root, {
|
|
321
|
+
open: open,
|
|
322
|
+
onOpenChange: t19,
|
|
323
|
+
children: t39
|
|
324
|
+
});
|
|
325
|
+
$[81] = open;
|
|
326
|
+
$[82] = t19;
|
|
327
|
+
$[83] = t39;
|
|
328
|
+
$[84] = t40;
|
|
329
|
+
} else t40 = $[84];
|
|
330
|
+
return t40;
|
|
331
|
+
}
|
|
332
|
+
function CloseIcon() {
|
|
333
|
+
const $ = c(1);
|
|
334
|
+
let t0;
|
|
335
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
336
|
+
t0 = /*#__PURE__*/ jsx("svg", {
|
|
337
|
+
width: "16",
|
|
338
|
+
height: "16",
|
|
339
|
+
viewBox: "0 0 24 24",
|
|
340
|
+
fill: "none",
|
|
341
|
+
stroke: "currentColor",
|
|
342
|
+
strokeWidth: "2",
|
|
343
|
+
strokeLinecap: "round",
|
|
344
|
+
strokeLinejoin: "round",
|
|
345
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
346
|
+
d: "M18 6 6 18M6 6l12 12"
|
|
347
|
+
})
|
|
348
|
+
});
|
|
349
|
+
$[0] = t0;
|
|
350
|
+
} else t0 = $[0];
|
|
351
|
+
return t0;
|
|
352
|
+
}
|
|
353
|
+
export { Modal };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
import type { ModalFuncReturn } from './confirm';
|
|
3
|
+
import { type ModalFuncProps } from './confirm-dialog';
|
|
4
|
+
export interface ModalHookApi {
|
|
5
|
+
confirm: (config: ModalFuncProps) => ModalFuncReturn;
|
|
6
|
+
info: (config: ModalFuncProps) => ModalFuncReturn;
|
|
7
|
+
success: (config: ModalFuncProps) => ModalFuncReturn;
|
|
8
|
+
error: (config: ModalFuncProps) => ModalFuncReturn;
|
|
9
|
+
warning: (config: ModalFuncProps) => ModalFuncReturn;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Context-aware imperative modals. Render `contextHolder` inside your tree so the
|
|
13
|
+
* dialogs inherit `TaoProvider` config and theme.
|
|
14
|
+
*
|
|
15
|
+
* ```tsx
|
|
16
|
+
* const [modal, contextHolder] = Modal.useModal();
|
|
17
|
+
* modal.confirm({ title: 'Delete?', onOk });
|
|
18
|
+
* return <>{contextHolder}</>;
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare function useModal(): [ModalHookApi, ReactElement];
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createElement, useCallback, useMemo, useState } from "react";
|
|
3
|
+
import { ConfirmDialog } from "./confirm-dialog.js";
|
|
4
|
+
let uuid = 0;
|
|
5
|
+
function useModal() {
|
|
6
|
+
const [dialogs, setDialogs] = useState([]);
|
|
7
|
+
const closeDialog = useCallback((key)=>{
|
|
8
|
+
setDialogs((prev)=>prev.map((d)=>d.key === key ? {
|
|
9
|
+
...d,
|
|
10
|
+
open: false
|
|
11
|
+
} : d));
|
|
12
|
+
}, []);
|
|
13
|
+
const destroyDialog = useCallback((key_0)=>{
|
|
14
|
+
setDialogs((prev_0)=>prev_0.filter((d_0)=>d_0.key !== key_0));
|
|
15
|
+
}, []);
|
|
16
|
+
const updateDialog = useCallback((key_1, configUpdate)=>{
|
|
17
|
+
setDialogs((prev_1)=>prev_1.map((d_1)=>d_1.key === key_1 ? {
|
|
18
|
+
...d_1,
|
|
19
|
+
config: 'function' == typeof configUpdate ? configUpdate(d_1.config) : {
|
|
20
|
+
...d_1.config,
|
|
21
|
+
...configUpdate
|
|
22
|
+
}
|
|
23
|
+
} : d_1));
|
|
24
|
+
}, []);
|
|
25
|
+
const api = useMemo(()=>{
|
|
26
|
+
const open = (config, type)=>{
|
|
27
|
+
const key_2 = `tao-modal-${uuid++}`;
|
|
28
|
+
setDialogs((prev_2)=>[
|
|
29
|
+
...prev_2,
|
|
30
|
+
{
|
|
31
|
+
key: key_2,
|
|
32
|
+
type,
|
|
33
|
+
open: true,
|
|
34
|
+
config
|
|
35
|
+
}
|
|
36
|
+
]);
|
|
37
|
+
return {
|
|
38
|
+
destroy: ()=>closeDialog(key_2),
|
|
39
|
+
update: (configUpdate_0)=>updateDialog(key_2, configUpdate_0)
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
confirm: (config_0)=>open(config_0, 'confirm'),
|
|
44
|
+
info: (config_1)=>open({
|
|
45
|
+
okCancel: false,
|
|
46
|
+
...config_1
|
|
47
|
+
}, 'info'),
|
|
48
|
+
success: (config_2)=>open({
|
|
49
|
+
okCancel: false,
|
|
50
|
+
...config_2
|
|
51
|
+
}, 'success'),
|
|
52
|
+
error: (config_3)=>open({
|
|
53
|
+
okCancel: false,
|
|
54
|
+
...config_3
|
|
55
|
+
}, 'error'),
|
|
56
|
+
warning: (config_4)=>open({
|
|
57
|
+
okCancel: false,
|
|
58
|
+
...config_4
|
|
59
|
+
}, 'warning')
|
|
60
|
+
};
|
|
61
|
+
}, [
|
|
62
|
+
closeDialog,
|
|
63
|
+
updateDialog
|
|
64
|
+
]);
|
|
65
|
+
const contextHolder = /*#__PURE__*/ jsx(Fragment, {
|
|
66
|
+
children: dialogs.map((d_2)=>/*#__PURE__*/ createElement(ConfirmDialog, {
|
|
67
|
+
...d_2.config,
|
|
68
|
+
key: d_2.key,
|
|
69
|
+
type: d_2.type,
|
|
70
|
+
open: d_2.open,
|
|
71
|
+
close: ()=>closeDialog(d_2.key),
|
|
72
|
+
afterClose: ()=>{
|
|
73
|
+
d_2.config.afterClose?.();
|
|
74
|
+
destroyDialog(d_2.key);
|
|
75
|
+
}
|
|
76
|
+
}))
|
|
77
|
+
});
|
|
78
|
+
return [
|
|
79
|
+
api,
|
|
80
|
+
contextHolder
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
export { useModal };
|
|
@@ -307,6 +307,8 @@
|
|
|
307
307
|
--tao-radius: 6px;
|
|
308
308
|
--tao-font-size: 14px;
|
|
309
309
|
--tao-control-height: 36px;
|
|
310
|
+
--tao-control-width: 200px;
|
|
311
|
+
--tao-control-range-width: 360px;
|
|
310
312
|
--tao-size-unit: 4px;
|
|
311
313
|
--tao-line-width: 1px;
|
|
312
314
|
--tao-font-family: "Geist Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
|
|
@@ -529,8 +531,8 @@
|
|
|
529
531
|
}
|
|
530
532
|
|
|
531
533
|
:root, [data-tao-provider] {
|
|
532
|
-
--tao-color-bg-container:
|
|
533
|
-
--tao-color-bg-elevated:
|
|
534
|
+
--tao-color-bg-container: oklch(100% 0 0);
|
|
535
|
+
--tao-color-bg-elevated: oklch(100% 0 0);
|
|
534
536
|
--tao-color-border: var(--tao-color-text-base);
|
|
535
537
|
}
|
|
536
538
|
|
|
@@ -541,16 +543,7 @@
|
|
|
541
543
|
}
|
|
542
544
|
|
|
543
545
|
:root, [data-tao-provider] {
|
|
544
|
-
--tao-color-border-secondary:
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
548
|
-
:root, [data-tao-provider] {
|
|
549
|
-
--tao-color-border-secondary: color-mix(in oklch, var(--tao-color-text-base) 10%, var(--tao-color-bg-base));
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
:root, [data-tao-provider] {
|
|
546
|
+
--tao-color-border-secondary: #0000170b;
|
|
554
547
|
--tao-radius-xs: 2px;
|
|
555
548
|
--tao-radius-sm: calc(var(--tao-radius) - 2px);
|
|
556
549
|
--tao-radius-md: var(--tao-radius);
|
|
@@ -633,6 +626,10 @@
|
|
|
633
626
|
visibility: collapse;
|
|
634
627
|
}
|
|
635
628
|
|
|
629
|
+
.visible {
|
|
630
|
+
visibility: visible;
|
|
631
|
+
}
|
|
632
|
+
|
|
636
633
|
.absolute {
|
|
637
634
|
position: absolute;
|
|
638
635
|
}
|
|
@@ -715,6 +712,10 @@
|
|
|
715
712
|
display: inline;
|
|
716
713
|
}
|
|
717
714
|
|
|
715
|
+
.inline-flex {
|
|
716
|
+
display: inline-flex;
|
|
717
|
+
}
|
|
718
|
+
|
|
718
719
|
.table {
|
|
719
720
|
display: table;
|
|
720
721
|
}
|
|
@@ -727,6 +728,10 @@
|
|
|
727
728
|
transform: var(--tw-rotate-x, ) var(--tw-rotate-y, ) var(--tw-rotate-z, ) var(--tw-skew-x, ) var(--tw-skew-y, );
|
|
728
729
|
}
|
|
729
730
|
|
|
731
|
+
.resize {
|
|
732
|
+
resize: both;
|
|
733
|
+
}
|
|
734
|
+
|
|
730
735
|
.flex-wrap {
|
|
731
736
|
flex-wrap: wrap;
|
|
732
737
|
}
|
|
@@ -742,6 +747,14 @@
|
|
|
742
747
|
border-width: 1px;
|
|
743
748
|
}
|
|
744
749
|
|
|
750
|
+
.italic {
|
|
751
|
+
font-style: italic;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
.underline {
|
|
755
|
+
text-decoration-line: underline;
|
|
756
|
+
}
|
|
757
|
+
|
|
745
758
|
.shadow {
|
|
746
759
|
--tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, #0000001a), 0 1px 2px -1px var(--tw-shadow-color, #0000001a);
|
|
747
760
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
@@ -771,6 +784,11 @@
|
|
|
771
784
|
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
772
785
|
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
773
786
|
}
|
|
787
|
+
|
|
788
|
+
.select-all {
|
|
789
|
+
-webkit-user-select: all;
|
|
790
|
+
user-select: all;
|
|
791
|
+
}
|
|
774
792
|
}
|
|
775
793
|
|
|
776
794
|
[data-tao-pagination] {
|
|
@@ -307,6 +307,8 @@
|
|
|
307
307
|
--tao-radius: 6px;
|
|
308
308
|
--tao-font-size: 14px;
|
|
309
309
|
--tao-control-height: 36px;
|
|
310
|
+
--tao-control-width: 200px;
|
|
311
|
+
--tao-control-range-width: 360px;
|
|
310
312
|
--tao-size-unit: 4px;
|
|
311
313
|
--tao-line-width: 1px;
|
|
312
314
|
--tao-font-family: "Geist Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
|
|
@@ -529,8 +531,8 @@
|
|
|
529
531
|
}
|
|
530
532
|
|
|
531
533
|
:root, [data-tao-provider] {
|
|
532
|
-
--tao-color-bg-container:
|
|
533
|
-
--tao-color-bg-elevated:
|
|
534
|
+
--tao-color-bg-container: oklch(100% 0 0);
|
|
535
|
+
--tao-color-bg-elevated: oklch(100% 0 0);
|
|
534
536
|
--tao-color-border: var(--tao-color-text-base);
|
|
535
537
|
}
|
|
536
538
|
|
|
@@ -541,16 +543,7 @@
|
|
|
541
543
|
}
|
|
542
544
|
|
|
543
545
|
:root, [data-tao-provider] {
|
|
544
|
-
--tao-color-border-secondary:
|
|
545
|
-
}
|
|
546
|
-
|
|
547
|
-
@supports (color: color-mix(in lab, red, red)) {
|
|
548
|
-
:root, [data-tao-provider] {
|
|
549
|
-
--tao-color-border-secondary: color-mix(in oklch, var(--tao-color-text-base) 10%, var(--tao-color-bg-base));
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
:root, [data-tao-provider] {
|
|
546
|
+
--tao-color-border-secondary: #0000170b;
|
|
554
547
|
--tao-radius-xs: 2px;
|
|
555
548
|
--tao-radius-sm: calc(var(--tao-radius) - 2px);
|
|
556
549
|
--tao-radius-md: var(--tao-radius);
|
|
@@ -633,6 +626,10 @@
|
|
|
633
626
|
visibility: collapse;
|
|
634
627
|
}
|
|
635
628
|
|
|
629
|
+
.visible {
|
|
630
|
+
visibility: visible;
|
|
631
|
+
}
|
|
632
|
+
|
|
636
633
|
.absolute {
|
|
637
634
|
position: absolute;
|
|
638
635
|
}
|
|
@@ -715,6 +712,10 @@
|
|
|
715
712
|
display: inline;
|
|
716
713
|
}
|
|
717
714
|
|
|
715
|
+
.inline-flex {
|
|
716
|
+
display: inline-flex;
|
|
717
|
+
}
|
|
718
|
+
|
|
718
719
|
.table {
|
|
719
720
|
display: table;
|
|
720
721
|
}
|
|
@@ -727,6 +728,10 @@
|
|
|
727
728
|
transform: var(--tw-rotate-x, ) var(--tw-rotate-y, ) var(--tw-rotate-z, ) var(--tw-skew-x, ) var(--tw-skew-y, );
|
|
728
729
|
}
|
|
729
730
|
|
|
731
|
+
.resize {
|
|
732
|
+
resize: both;
|
|
733
|
+
}
|
|
734
|
+
|
|
730
735
|
.flex-wrap {
|
|
731
736
|
flex-wrap: wrap;
|
|
732
737
|
}
|
|
@@ -742,6 +747,14 @@
|
|
|
742
747
|
border-width: 1px;
|
|
743
748
|
}
|
|
744
749
|
|
|
750
|
+
.italic {
|
|
751
|
+
font-style: italic;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
.underline {
|
|
755
|
+
text-decoration-line: underline;
|
|
756
|
+
}
|
|
757
|
+
|
|
745
758
|
.shadow {
|
|
746
759
|
--tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, #0000001a), 0 1px 2px -1px var(--tw-shadow-color, #0000001a);
|
|
747
760
|
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
@@ -771,6 +784,11 @@
|
|
|
771
784
|
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
772
785
|
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
773
786
|
}
|
|
787
|
+
|
|
788
|
+
.select-all {
|
|
789
|
+
-webkit-user-select: all;
|
|
790
|
+
user-select: all;
|
|
791
|
+
}
|
|
774
792
|
}
|
|
775
793
|
|
|
776
794
|
[data-tao-radio-wrapper] {
|