@rockshin/tao-ui 0.0.1 → 0.0.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.
- package/dist/components/breadcrumb/breadcrumb.css +1091 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +43 -0
- package/dist/components/breadcrumb/breadcrumb.js +268 -0
- package/dist/components/button/button.css +46 -21
- package/dist/components/checkbox/checkbox.css +33 -12
- package/dist/components/collapsible/collapsible.css +1026 -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 +1149 -0
- package/dist/components/context-menu/context-menu.d.ts +19 -0
- package/dist/components/context-menu/context-menu.js +106 -0
- package/dist/components/date-picker/calendar/month-grid.d.ts +1 -1
- package/dist/components/date-picker/calendar/time-panel.d.ts +1 -1
- package/dist/components/date-picker/calendar/year-grid.d.ts +1 -1
- package/dist/components/date-picker/date-picker.css +87 -17
- package/dist/components/date-picker/date-picker.js +9 -7
- package/dist/components/date-picker/range-picker.js +9 -7
- package/dist/components/drawer/drawer.css +128 -15
- package/dist/components/drawer/drawer.d.ts +36 -3
- package/dist/components/drawer/drawer.js +323 -121
- package/dist/components/dropdown/dropdown.css +999 -0
- package/dist/components/dropdown/dropdown.d.ts +45 -0
- package/dist/components/dropdown/dropdown.js +383 -0
- package/dist/components/form-field/form.css +33 -12
- package/dist/components/input/input.css +86 -14
- package/dist/components/menu/menu-render.d.ts +89 -0
- package/dist/components/menu/menu-render.js +379 -0
- package/dist/components/menu/menu.css +1145 -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 +1169 -0
- package/dist/components/modal/modal.d.ts +50 -0
- package/dist/components/modal/modal.js +362 -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 +33 -12
- package/dist/components/pagination/pagination.js +3 -1
- package/dist/components/radio/radio.css +33 -12
- package/dist/components/scroll-area/scroll-area.css +33 -12
- package/dist/components/select/mobile-select.css +75 -13
- package/dist/components/select/mobile-select.d.ts +4 -1
- package/dist/components/select/mobile-select.js +103 -107
- package/dist/components/select/select.css +167 -26
- package/dist/components/select/select.d.ts +62 -4
- package/dist/components/select/select.js +359 -377
- package/dist/components/spinner/spinner.css +1084 -0
- package/dist/components/spinner/spinner.d.ts +26 -0
- package/dist/components/spinner/spinner.js +229 -0
- package/dist/components/splitter/splitter.css +33 -12
- package/dist/components/switch/switch.css +33 -12
- package/dist/components/table/table.css +57 -18
- package/dist/components/table/table.d.ts +17 -2
- package/dist/components/table/table.js +214 -206
- package/dist/components/tabs/tabs.css +36 -17
- package/dist/components/tag/tag.css +33 -12
- package/dist/components/textarea/textarea.css +1246 -0
- package/dist/components/textarea/textarea.d.ts +19 -0
- package/dist/components/textarea/textarea.js +181 -0
- package/dist/index.d.ts +25 -18
- package/dist/index.js +22 -15
- package/dist/layouts/stack/layout.css +33 -12
- package/dist/provider/tao-provider.d.ts +17 -1
- package/dist/provider/tao-provider.js +53 -15
- package/dist/theme/control.css +86 -13
- package/dist/theme/theme.css +33 -12
- package/llms.txt +7 -6
- package/package.json +18 -13
|
@@ -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,362 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useEffect, useRef } from "react";
|
|
4
|
+
import { TaoPortalScope } from "../../provider/tao-provider.js";
|
|
5
|
+
import { cx } from "../../utils/semantic.js";
|
|
6
|
+
import { Button } from "../button/button.js";
|
|
7
|
+
import "./modal.css";
|
|
8
|
+
import * as __rspack_external__radix_ui_react_dialog_6b867f3d from "@radix-ui/react-dialog";
|
|
9
|
+
function Modal(t0) {
|
|
10
|
+
const $ = c(87);
|
|
11
|
+
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;
|
|
12
|
+
const okText = void 0 === t1 ? "OK" : t1;
|
|
13
|
+
const cancelText = void 0 === t2 ? "Cancel" : t2;
|
|
14
|
+
const width = void 0 === t3 ? 520 : t3;
|
|
15
|
+
const centered = void 0 === t4 ? true : t4;
|
|
16
|
+
const closable = void 0 === t5 ? true : t5;
|
|
17
|
+
const maskClosable = void 0 === t6 ? true : t6;
|
|
18
|
+
const keyboard = void 0 === t7 ? true : t7;
|
|
19
|
+
const destroyOnHidden = void 0 === t8 ? true : t8;
|
|
20
|
+
const prevOpen = useRef(open);
|
|
21
|
+
let t10;
|
|
22
|
+
let t9;
|
|
23
|
+
if ($[0] !== afterClose || $[1] !== open) {
|
|
24
|
+
t9 = ()=>{
|
|
25
|
+
if (prevOpen.current && !open) afterClose?.();
|
|
26
|
+
prevOpen.current = open;
|
|
27
|
+
};
|
|
28
|
+
t10 = [
|
|
29
|
+
open,
|
|
30
|
+
afterClose
|
|
31
|
+
];
|
|
32
|
+
$[0] = afterClose;
|
|
33
|
+
$[1] = open;
|
|
34
|
+
$[2] = t10;
|
|
35
|
+
$[3] = t9;
|
|
36
|
+
} else {
|
|
37
|
+
t10 = $[2];
|
|
38
|
+
t9 = $[3];
|
|
39
|
+
}
|
|
40
|
+
useEffect(t9, t10);
|
|
41
|
+
const t11 = "number" == typeof width ? `${width}px` : width;
|
|
42
|
+
const t12 = stylesProp?.root;
|
|
43
|
+
let t13;
|
|
44
|
+
if ($[4] !== t11 || $[5] !== t12) {
|
|
45
|
+
t13 = {
|
|
46
|
+
width: t11,
|
|
47
|
+
...t12
|
|
48
|
+
};
|
|
49
|
+
$[4] = t11;
|
|
50
|
+
$[5] = t12;
|
|
51
|
+
$[6] = t13;
|
|
52
|
+
} else t13 = $[6];
|
|
53
|
+
const contentStyle = t13;
|
|
54
|
+
let t14;
|
|
55
|
+
if ($[7] !== cancelButtonProps || $[8] !== cancelText || $[9] !== onClose) {
|
|
56
|
+
t14 = ()=>/*#__PURE__*/ jsx(Button, {
|
|
57
|
+
variant: "secondary",
|
|
58
|
+
onClick: onClose,
|
|
59
|
+
...cancelButtonProps,
|
|
60
|
+
children: cancelText
|
|
61
|
+
});
|
|
62
|
+
$[7] = cancelButtonProps;
|
|
63
|
+
$[8] = cancelText;
|
|
64
|
+
$[9] = onClose;
|
|
65
|
+
$[10] = t14;
|
|
66
|
+
} else t14 = $[10];
|
|
67
|
+
const CancelBtn = t14;
|
|
68
|
+
let t15;
|
|
69
|
+
if ($[11] !== confirmLoading || $[12] !== okButtonProps || $[13] !== okText || $[14] !== onOk) {
|
|
70
|
+
t15 = ()=>/*#__PURE__*/ jsx(Button, {
|
|
71
|
+
variant: "primary",
|
|
72
|
+
loading: confirmLoading,
|
|
73
|
+
onClick: onOk,
|
|
74
|
+
...okButtonProps,
|
|
75
|
+
children: okText
|
|
76
|
+
});
|
|
77
|
+
$[11] = confirmLoading;
|
|
78
|
+
$[12] = okButtonProps;
|
|
79
|
+
$[13] = okText;
|
|
80
|
+
$[14] = onOk;
|
|
81
|
+
$[15] = t15;
|
|
82
|
+
} else t15 = $[15];
|
|
83
|
+
const OkBtn = t15;
|
|
84
|
+
let t16;
|
|
85
|
+
if ($[16] !== CancelBtn) {
|
|
86
|
+
t16 = /*#__PURE__*/ jsx(CancelBtn, {});
|
|
87
|
+
$[16] = CancelBtn;
|
|
88
|
+
$[17] = t16;
|
|
89
|
+
} else t16 = $[17];
|
|
90
|
+
let t17;
|
|
91
|
+
if ($[18] !== OkBtn) {
|
|
92
|
+
t17 = /*#__PURE__*/ jsx(OkBtn, {});
|
|
93
|
+
$[18] = OkBtn;
|
|
94
|
+
$[19] = t17;
|
|
95
|
+
} else t17 = $[19];
|
|
96
|
+
let t18;
|
|
97
|
+
if ($[20] !== t16 || $[21] !== t17) {
|
|
98
|
+
t18 = /*#__PURE__*/ jsxs(Fragment, {
|
|
99
|
+
children: [
|
|
100
|
+
t16,
|
|
101
|
+
t17
|
|
102
|
+
]
|
|
103
|
+
});
|
|
104
|
+
$[20] = t16;
|
|
105
|
+
$[21] = t17;
|
|
106
|
+
$[22] = t18;
|
|
107
|
+
} else t18 = $[22];
|
|
108
|
+
const defaultFooter = t18;
|
|
109
|
+
let footerContent;
|
|
110
|
+
if (void 0 === footer) footerContent = defaultFooter;
|
|
111
|
+
else if ("function" == typeof footer) {
|
|
112
|
+
let t19;
|
|
113
|
+
if ($[23] !== CancelBtn || $[24] !== OkBtn || $[25] !== defaultFooter || $[26] !== footer) {
|
|
114
|
+
t19 = footer(defaultFooter, {
|
|
115
|
+
OkBtn,
|
|
116
|
+
CancelBtn
|
|
117
|
+
});
|
|
118
|
+
$[23] = CancelBtn;
|
|
119
|
+
$[24] = OkBtn;
|
|
120
|
+
$[25] = defaultFooter;
|
|
121
|
+
$[26] = footer;
|
|
122
|
+
$[27] = t19;
|
|
123
|
+
} else t19 = $[27];
|
|
124
|
+
footerContent = t19;
|
|
125
|
+
} else footerContent = footer;
|
|
126
|
+
const keepAlive = !destroyOnHidden;
|
|
127
|
+
const forceMount = keepAlive ? true : void 0;
|
|
128
|
+
let t19;
|
|
129
|
+
if ($[28] !== onClose) {
|
|
130
|
+
t19 = (v)=>{
|
|
131
|
+
if (!v) onClose?.();
|
|
132
|
+
};
|
|
133
|
+
$[28] = onClose;
|
|
134
|
+
$[29] = t19;
|
|
135
|
+
} else t19 = $[29];
|
|
136
|
+
const t20 = classNames?.overlay;
|
|
137
|
+
let t21;
|
|
138
|
+
if ($[30] !== t20) {
|
|
139
|
+
t21 = cx(t20);
|
|
140
|
+
$[30] = t20;
|
|
141
|
+
$[31] = t21;
|
|
142
|
+
} else t21 = $[31];
|
|
143
|
+
const t22 = stylesProp?.overlay;
|
|
144
|
+
let t23;
|
|
145
|
+
if ($[32] !== forceMount || $[33] !== t21 || $[34] !== t22) {
|
|
146
|
+
t23 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dialog_6b867f3d.Overlay, {
|
|
147
|
+
forceMount: forceMount,
|
|
148
|
+
"data-tao-modal-overlay": "",
|
|
149
|
+
className: t21,
|
|
150
|
+
style: t22
|
|
151
|
+
});
|
|
152
|
+
$[32] = forceMount;
|
|
153
|
+
$[33] = t21;
|
|
154
|
+
$[34] = t22;
|
|
155
|
+
$[35] = t23;
|
|
156
|
+
} else t23 = $[35];
|
|
157
|
+
const t24 = centered ? "" : void 0;
|
|
158
|
+
const t25 = open ? "" : void 0;
|
|
159
|
+
const t26 = classNames?.root;
|
|
160
|
+
let t27;
|
|
161
|
+
if ($[36] !== t26) {
|
|
162
|
+
t27 = cx(t26);
|
|
163
|
+
$[36] = t26;
|
|
164
|
+
$[37] = t27;
|
|
165
|
+
} else t27 = $[37];
|
|
166
|
+
let t28;
|
|
167
|
+
if ($[38] !== keyboard) {
|
|
168
|
+
t28 = (e)=>{
|
|
169
|
+
if (!keyboard) e.preventDefault();
|
|
170
|
+
};
|
|
171
|
+
$[38] = keyboard;
|
|
172
|
+
$[39] = t28;
|
|
173
|
+
} else t28 = $[39];
|
|
174
|
+
let t29;
|
|
175
|
+
let t30;
|
|
176
|
+
if ($[40] !== maskClosable) {
|
|
177
|
+
t29 = (e_0)=>{
|
|
178
|
+
if (!maskClosable) e_0.preventDefault();
|
|
179
|
+
};
|
|
180
|
+
t30 = (e_1)=>{
|
|
181
|
+
if (!maskClosable) e_1.preventDefault();
|
|
182
|
+
};
|
|
183
|
+
$[40] = maskClosable;
|
|
184
|
+
$[41] = t29;
|
|
185
|
+
$[42] = t30;
|
|
186
|
+
} else {
|
|
187
|
+
t29 = $[41];
|
|
188
|
+
t30 = $[42];
|
|
189
|
+
}
|
|
190
|
+
let t31;
|
|
191
|
+
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) {
|
|
192
|
+
t31 = (null != title || closable) && /*#__PURE__*/ jsxs("div", {
|
|
193
|
+
"data-tao-modal-header": "",
|
|
194
|
+
className: cx(classNames?.header),
|
|
195
|
+
style: stylesProp?.header,
|
|
196
|
+
children: [
|
|
197
|
+
null != title ? /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dialog_6b867f3d.Title, {
|
|
198
|
+
"data-tao-modal-title": "",
|
|
199
|
+
className: cx(classNames?.title),
|
|
200
|
+
style: stylesProp?.title,
|
|
201
|
+
children: title
|
|
202
|
+
}) : /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dialog_6b867f3d.Title, {
|
|
203
|
+
"data-tao-modal-title": "",
|
|
204
|
+
style: {
|
|
205
|
+
display: "none"
|
|
206
|
+
}
|
|
207
|
+
}),
|
|
208
|
+
closable && /*#__PURE__*/ jsx("button", {
|
|
209
|
+
type: "button",
|
|
210
|
+
"data-tao-modal-close": "",
|
|
211
|
+
className: cx(classNames?.close),
|
|
212
|
+
style: stylesProp?.close,
|
|
213
|
+
onClick: onClose,
|
|
214
|
+
"aria-label": "Close",
|
|
215
|
+
children: /*#__PURE__*/ jsx(CloseIcon, {})
|
|
216
|
+
})
|
|
217
|
+
]
|
|
218
|
+
});
|
|
219
|
+
$[43] = classNames?.close;
|
|
220
|
+
$[44] = classNames?.header;
|
|
221
|
+
$[45] = classNames?.title;
|
|
222
|
+
$[46] = closable;
|
|
223
|
+
$[47] = onClose;
|
|
224
|
+
$[48] = stylesProp?.close;
|
|
225
|
+
$[49] = stylesProp?.header;
|
|
226
|
+
$[50] = stylesProp?.title;
|
|
227
|
+
$[51] = title;
|
|
228
|
+
$[52] = t31;
|
|
229
|
+
} else t31 = $[52];
|
|
230
|
+
const t32 = classNames?.body;
|
|
231
|
+
let t33;
|
|
232
|
+
if ($[53] !== t32) {
|
|
233
|
+
t33 = cx(t32);
|
|
234
|
+
$[53] = t32;
|
|
235
|
+
$[54] = t33;
|
|
236
|
+
} else t33 = $[54];
|
|
237
|
+
const t34 = stylesProp?.body;
|
|
238
|
+
let t35;
|
|
239
|
+
if ($[55] !== children || $[56] !== t33 || $[57] !== t34) {
|
|
240
|
+
t35 = /*#__PURE__*/ jsx("div", {
|
|
241
|
+
"data-tao-modal-body": "",
|
|
242
|
+
className: t33,
|
|
243
|
+
style: t34,
|
|
244
|
+
children: children
|
|
245
|
+
});
|
|
246
|
+
$[55] = children;
|
|
247
|
+
$[56] = t33;
|
|
248
|
+
$[57] = t34;
|
|
249
|
+
$[58] = t35;
|
|
250
|
+
} else t35 = $[58];
|
|
251
|
+
let t36;
|
|
252
|
+
if ($[59] !== classNames?.footer || $[60] !== footerContent || $[61] !== stylesProp?.footer) {
|
|
253
|
+
t36 = null != footerContent && /*#__PURE__*/ jsx("div", {
|
|
254
|
+
"data-tao-modal-footer": "",
|
|
255
|
+
className: cx(classNames?.footer),
|
|
256
|
+
style: stylesProp?.footer,
|
|
257
|
+
children: footerContent
|
|
258
|
+
});
|
|
259
|
+
$[59] = classNames?.footer;
|
|
260
|
+
$[60] = footerContent;
|
|
261
|
+
$[61] = stylesProp?.footer;
|
|
262
|
+
$[62] = t36;
|
|
263
|
+
} else t36 = $[62];
|
|
264
|
+
let t37;
|
|
265
|
+
if ($[63] !== contentStyle || $[64] !== forceMount || $[65] !== t27 || $[66] !== t28 || $[67] !== t29 || $[68] !== t30 || $[69] !== t31 || $[70] !== t35 || $[71] !== t36) {
|
|
266
|
+
t37 = /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_dialog_6b867f3d.Content, {
|
|
267
|
+
forceMount: forceMount,
|
|
268
|
+
"data-tao-modal": "",
|
|
269
|
+
style: contentStyle,
|
|
270
|
+
className: t27,
|
|
271
|
+
"aria-describedby": void 0,
|
|
272
|
+
onEscapeKeyDown: t28,
|
|
273
|
+
onPointerDownOutside: t29,
|
|
274
|
+
onInteractOutside: t30,
|
|
275
|
+
children: [
|
|
276
|
+
t31,
|
|
277
|
+
t35,
|
|
278
|
+
t36
|
|
279
|
+
]
|
|
280
|
+
});
|
|
281
|
+
$[63] = contentStyle;
|
|
282
|
+
$[64] = forceMount;
|
|
283
|
+
$[65] = t27;
|
|
284
|
+
$[66] = t28;
|
|
285
|
+
$[67] = t29;
|
|
286
|
+
$[68] = t30;
|
|
287
|
+
$[69] = t31;
|
|
288
|
+
$[70] = t35;
|
|
289
|
+
$[71] = t36;
|
|
290
|
+
$[72] = t37;
|
|
291
|
+
} else t37 = $[72];
|
|
292
|
+
let t38;
|
|
293
|
+
if ($[73] !== t24 || $[74] !== t25 || $[75] !== t37) {
|
|
294
|
+
t38 = /*#__PURE__*/ jsx("div", {
|
|
295
|
+
"data-tao-modal-wrap": "",
|
|
296
|
+
"data-tao-centered": t24,
|
|
297
|
+
"data-tao-open": t25,
|
|
298
|
+
children: t37
|
|
299
|
+
});
|
|
300
|
+
$[73] = t24;
|
|
301
|
+
$[74] = t25;
|
|
302
|
+
$[75] = t37;
|
|
303
|
+
$[76] = t38;
|
|
304
|
+
} else t38 = $[76];
|
|
305
|
+
let t39;
|
|
306
|
+
if ($[77] !== t23 || $[78] !== t38) {
|
|
307
|
+
t39 = /*#__PURE__*/ jsxs(TaoPortalScope, {
|
|
308
|
+
children: [
|
|
309
|
+
t23,
|
|
310
|
+
t38
|
|
311
|
+
]
|
|
312
|
+
});
|
|
313
|
+
$[77] = t23;
|
|
314
|
+
$[78] = t38;
|
|
315
|
+
$[79] = t39;
|
|
316
|
+
} else t39 = $[79];
|
|
317
|
+
let t40;
|
|
318
|
+
if ($[80] !== forceMount || $[81] !== t39) {
|
|
319
|
+
t40 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dialog_6b867f3d.Portal, {
|
|
320
|
+
forceMount: forceMount,
|
|
321
|
+
children: t39
|
|
322
|
+
});
|
|
323
|
+
$[80] = forceMount;
|
|
324
|
+
$[81] = t39;
|
|
325
|
+
$[82] = t40;
|
|
326
|
+
} else t40 = $[82];
|
|
327
|
+
let t41;
|
|
328
|
+
if ($[83] !== open || $[84] !== t19 || $[85] !== t40) {
|
|
329
|
+
t41 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dialog_6b867f3d.Root, {
|
|
330
|
+
open: open,
|
|
331
|
+
onOpenChange: t19,
|
|
332
|
+
children: t40
|
|
333
|
+
});
|
|
334
|
+
$[83] = open;
|
|
335
|
+
$[84] = t19;
|
|
336
|
+
$[85] = t40;
|
|
337
|
+
$[86] = t41;
|
|
338
|
+
} else t41 = $[86];
|
|
339
|
+
return t41;
|
|
340
|
+
}
|
|
341
|
+
function CloseIcon() {
|
|
342
|
+
const $ = c(1);
|
|
343
|
+
let t0;
|
|
344
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
345
|
+
t0 = /*#__PURE__*/ jsx("svg", {
|
|
346
|
+
width: "16",
|
|
347
|
+
height: "16",
|
|
348
|
+
viewBox: "0 0 24 24",
|
|
349
|
+
fill: "none",
|
|
350
|
+
stroke: "currentColor",
|
|
351
|
+
strokeWidth: "2",
|
|
352
|
+
strokeLinecap: "round",
|
|
353
|
+
strokeLinejoin: "round",
|
|
354
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
355
|
+
d: "M18 6 6 18M6 6l12 12"
|
|
356
|
+
})
|
|
357
|
+
});
|
|
358
|
+
$[0] = t0;
|
|
359
|
+
} else t0 = $[0];
|
|
360
|
+
return t0;
|
|
361
|
+
}
|
|
362
|
+
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,11 +307,16 @@
|
|
|
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;
|
|
313
315
|
--tao-font-family-code: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
|
|
314
316
|
--tao-motion-unit: .1s;
|
|
317
|
+
--tao-z-index-drawer: 1000;
|
|
318
|
+
--tao-z-index-modal: 1000;
|
|
319
|
+
--tao-z-index-popup: 1100;
|
|
315
320
|
--tao-primary: var(--tao-color-primary);
|
|
316
321
|
--tao-primary-hover: var(--tao-color-primary);
|
|
317
322
|
}
|
|
@@ -529,8 +534,8 @@
|
|
|
529
534
|
}
|
|
530
535
|
|
|
531
536
|
:root, [data-tao-provider] {
|
|
532
|
-
--tao-color-bg-container:
|
|
533
|
-
--tao-color-bg-elevated:
|
|
537
|
+
--tao-color-bg-container: oklch(100% 0 0);
|
|
538
|
+
--tao-color-bg-elevated: oklch(100% 0 0);
|
|
534
539
|
--tao-color-border: var(--tao-color-text-base);
|
|
535
540
|
}
|
|
536
541
|
|
|
@@ -541,16 +546,7 @@
|
|
|
541
546
|
}
|
|
542
547
|
|
|
543
548
|
: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] {
|
|
549
|
+
--tao-color-border-secondary: #0000170b;
|
|
554
550
|
--tao-radius-xs: 2px;
|
|
555
551
|
--tao-radius-sm: calc(var(--tao-radius) - 2px);
|
|
556
552
|
--tao-radius-md: var(--tao-radius);
|
|
@@ -633,6 +629,10 @@
|
|
|
633
629
|
visibility: collapse;
|
|
634
630
|
}
|
|
635
631
|
|
|
632
|
+
.visible {
|
|
633
|
+
visibility: visible;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
636
|
.absolute {
|
|
637
637
|
position: absolute;
|
|
638
638
|
}
|
|
@@ -715,6 +715,10 @@
|
|
|
715
715
|
display: inline;
|
|
716
716
|
}
|
|
717
717
|
|
|
718
|
+
.inline-flex {
|
|
719
|
+
display: inline-flex;
|
|
720
|
+
}
|
|
721
|
+
|
|
718
722
|
.table {
|
|
719
723
|
display: table;
|
|
720
724
|
}
|
|
@@ -727,6 +731,10 @@
|
|
|
727
731
|
transform: var(--tw-rotate-x, ) var(--tw-rotate-y, ) var(--tw-rotate-z, ) var(--tw-skew-x, ) var(--tw-skew-y, );
|
|
728
732
|
}
|
|
729
733
|
|
|
734
|
+
.resize {
|
|
735
|
+
resize: both;
|
|
736
|
+
}
|
|
737
|
+
|
|
730
738
|
.flex-wrap {
|
|
731
739
|
flex-wrap: wrap;
|
|
732
740
|
}
|
|
@@ -742,6 +750,14 @@
|
|
|
742
750
|
border-width: 1px;
|
|
743
751
|
}
|
|
744
752
|
|
|
753
|
+
.italic {
|
|
754
|
+
font-style: italic;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
.underline {
|
|
758
|
+
text-decoration-line: underline;
|
|
759
|
+
}
|
|
760
|
+
|
|
745
761
|
.shadow {
|
|
746
762
|
--tw-shadow: 0 1px 3px 0 var(--tw-shadow-color, #0000001a), 0 1px 2px -1px var(--tw-shadow-color, #0000001a);
|
|
747
763
|
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 +787,11 @@
|
|
|
771
787
|
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
772
788
|
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
773
789
|
}
|
|
790
|
+
|
|
791
|
+
.select-all {
|
|
792
|
+
-webkit-user-select: all;
|
|
793
|
+
user-select: all;
|
|
794
|
+
}
|
|
774
795
|
}
|
|
775
796
|
|
|
776
797
|
[data-tao-pagination] {
|
|
@@ -253,7 +253,9 @@ function Pagination(t0) {
|
|
|
253
253
|
let t26;
|
|
254
254
|
if ($[52] !== goTo || $[53] !== pageSize || $[54] !== pageSizeOptions || $[55] !== resolvedDisabled || $[56] !== resolvedSize || $[57] !== showSizeChanger) {
|
|
255
255
|
t26 = showSizeChanger && /*#__PURE__*/ jsx(Select, {
|
|
256
|
-
|
|
256
|
+
style: {
|
|
257
|
+
width: "auto"
|
|
258
|
+
},
|
|
257
259
|
options: pageSizeOptions.map(_temp),
|
|
258
260
|
value: String(pageSize),
|
|
259
261
|
onChange: (val)=>{
|