@rockshin/tao-ui 0.0.31 → 0.0.32
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/README.md +14 -3
- package/dist/components/alert/alert.js +1 -1
- package/dist/components/breadcrumb/breadcrumb.js +1 -1
- package/dist/components/button/button.d.ts +2 -2
- package/dist/components/button/button.js +48 -50
- package/dist/components/checkbox/checkbox.css +5 -1
- package/dist/components/checkbox/checkbox.d.ts +2 -2
- package/dist/components/checkbox/checkbox.js +135 -120
- package/dist/components/collapsible/collapsible.js +1 -1
- package/dist/components/context-menu/context-menu.js +1 -1
- package/dist/components/date-picker/calendar/calendar-header.js +1 -1
- package/dist/components/date-picker/calendar/month-grid.d.ts +3 -1
- package/dist/components/date-picker/calendar/month-grid.js +19 -17
- package/dist/components/date-picker/calendar/time-panel.js +1 -1
- package/dist/components/date-picker/calendar/year-grid.d.ts +3 -1
- package/dist/components/date-picker/calendar/year-grid.js +28 -24
- package/dist/components/date-picker/date-picker.d.ts +1 -1
- package/dist/components/date-picker/date-picker.js +37 -24
- package/dist/components/date-picker/presets.js +1 -1
- package/dist/components/date-picker/range-picker.d.ts +1 -1
- package/dist/components/date-picker/range-picker.js +104 -56
- package/dist/components/drawer/drawer.d.ts +1 -1
- package/dist/components/drawer/drawer.js +98 -91
- package/dist/components/dropdown/dropdown.js +84 -84
- package/dist/components/form/form-item.js +8 -4
- package/dist/components/form/form.js +1 -1
- package/dist/components/form-actions/form-actions.js +1 -1
- package/dist/components/form-field/form-field-view.js +58 -51
- package/dist/components/form-field/form-field.js +1 -1
- package/dist/components/form-section/form-section.js +1 -1
- package/dist/components/input/input.js +42 -39
- package/dist/components/input-number/input-number.d.ts +2 -2
- package/dist/components/input-number/input-number.js +57 -59
- package/dist/components/menu/menu-render.js +1 -1
- package/dist/components/modal/confirm-dialog.d.ts +2 -1
- package/dist/components/modal/confirm-dialog.js +25 -5
- package/dist/components/modal/confirm.js +15 -3
- package/dist/components/modal/modal.d.ts +1 -1
- package/dist/components/modal/modal.js +131 -132
- package/dist/components/modal/use-modal.js +48 -35
- package/dist/components/pagination/pagination.js +3 -1
- package/dist/components/popconfirm/popconfirm.js +1 -1
- package/dist/components/popover/popover.js +253 -228
- package/dist/components/radio/radio.css +2 -2
- package/dist/components/radio/radio.d.ts +1 -1
- package/dist/components/radio/radio.js +7 -7
- package/dist/components/scroll-area/scroll-area.css +2 -2
- package/dist/components/scroll-area/scroll-area.js +187 -165
- package/dist/components/select/mobile-select.d.ts +2 -1
- package/dist/components/select/mobile-select.js +12 -6
- package/dist/components/select/select-icons.js +1 -1
- package/dist/components/select/select-searchable-list.d.ts +1 -1
- package/dist/components/select/select-searchable-list.js +35 -21
- package/dist/components/select/select-tags.js +1 -1
- package/dist/components/select/select-types.d.ts +2 -2
- package/dist/components/select/select.css +4 -0
- package/dist/components/select/select.d.ts +2 -2
- package/dist/components/select/select.js +124 -72
- package/dist/components/sonner/sonner.js +6 -5
- package/dist/components/spinner/spinner.js +1 -1
- package/dist/components/splitter/splitter.js +187 -194
- package/dist/components/status-icon/status-icon.js +1 -1
- package/dist/components/switch/switch.d.ts +1 -1
- package/dist/components/switch/switch.js +6 -6
- package/dist/components/table/table-filter.js +1 -1
- package/dist/components/table/table-icons.js +1 -1
- package/dist/components/table/table.js +483 -599
- package/dist/components/tabs/tabs.js +179 -161
- package/dist/components/tag/tag.js +1 -1
- package/dist/components/textarea/textarea.d.ts +1 -1
- package/dist/components/textarea/textarea.js +142 -108
- package/dist/components/tooltip/tooltip.js +88 -72
- package/dist/entries/alert.d.ts +3 -0
- package/dist/entries/alert.js +4 -0
- package/dist/entries/breadcrumb.d.ts +3 -0
- package/dist/entries/breadcrumb.js +4 -0
- package/dist/entries/button.d.ts +3 -0
- package/dist/entries/button.js +4 -0
- package/dist/entries/checkbox.d.ts +3 -0
- package/dist/entries/checkbox.js +4 -0
- package/dist/entries/collapsible.d.ts +3 -0
- package/dist/entries/collapsible.js +4 -0
- package/dist/entries/context-menu.d.ts +3 -0
- package/dist/entries/context-menu.js +4 -0
- package/dist/entries/date-picker.d.ts +3 -0
- package/dist/entries/date-picker.js +4 -0
- package/dist/entries/drawer.d.ts +3 -0
- package/dist/entries/drawer.js +4 -0
- package/dist/entries/dropdown.d.ts +3 -0
- package/dist/entries/dropdown.js +4 -0
- package/dist/entries/form-actions.d.ts +3 -0
- package/dist/entries/form-actions.js +4 -0
- package/dist/entries/form-field.d.ts +3 -0
- package/dist/entries/form-field.js +4 -0
- package/dist/entries/form-layout.d.ts +3 -0
- package/dist/entries/form-layout.js +4 -0
- package/dist/entries/form-section.d.ts +3 -0
- package/dist/entries/form-section.js +4 -0
- package/dist/entries/form.d.ts +4 -0
- package/dist/entries/form.js +4 -0
- package/dist/entries/input-number.d.ts +3 -0
- package/dist/entries/input-number.js +4 -0
- package/dist/entries/input.d.ts +3 -0
- package/dist/entries/input.js +4 -0
- package/dist/entries/modal.d.ts +3 -0
- package/dist/entries/modal.js +4 -0
- package/dist/entries/number-input.d.ts +3 -0
- package/dist/entries/number-input.js +4 -0
- package/dist/entries/pagination.d.ts +3 -0
- package/dist/entries/pagination.js +4 -0
- package/dist/entries/popconfirm.d.ts +3 -0
- package/dist/entries/popconfirm.js +4 -0
- package/dist/entries/popover.d.ts +3 -0
- package/dist/entries/popover.js +4 -0
- package/dist/entries/provider.d.ts +3 -0
- package/dist/entries/provider.js +4 -0
- package/dist/entries/radio.d.ts +3 -0
- package/dist/entries/radio.js +4 -0
- package/dist/entries/range-picker.d.ts +3 -0
- package/dist/entries/range-picker.js +4 -0
- package/dist/entries/scroll-area.d.ts +3 -0
- package/dist/entries/scroll-area.js +4 -0
- package/dist/entries/select.d.ts +3 -0
- package/dist/entries/select.js +4 -0
- package/dist/entries/sonner.d.ts +3 -0
- package/dist/entries/sonner.js +4 -0
- package/dist/entries/spinner.d.ts +3 -0
- package/dist/entries/spinner.js +4 -0
- package/dist/entries/splitter.d.ts +3 -0
- package/dist/entries/splitter.js +4 -0
- package/dist/entries/stack.d.ts +3 -0
- package/dist/entries/stack.js +4 -0
- package/dist/entries/switch.d.ts +3 -0
- package/dist/entries/switch.js +4 -0
- package/dist/entries/table.d.ts +3 -0
- package/dist/entries/table.js +4 -0
- package/dist/entries/tabs.d.ts +3 -0
- package/dist/entries/tabs.js +4 -0
- package/dist/entries/tag.d.ts +3 -0
- package/dist/entries/tag.js +4 -0
- package/dist/entries/textarea.d.ts +3 -0
- package/dist/entries/textarea.js +4 -0
- package/dist/entries/tooltip.d.ts +3 -0
- package/dist/entries/tooltip.js +4 -0
- package/dist/layouts/form-layout/form-layout.js +1 -1
- package/dist/layouts/stack/stack.js +1 -1
- package/dist/number-input/number-input.js +1 -1
- package/dist/number-input/use-number-input.d.ts +2 -2
- package/dist/number-input/use-number-input.js +224 -131
- package/dist/number-input/validate.js +7 -2
- package/dist/provider/tao-provider.js +1 -1
- package/dist/utils/dialog-content.d.ts +10 -0
- package/dist/utils/dialog-content.js +222 -0
- package/dist/utils/overlay.d.ts +2 -2
- package/dist/utils/overlay.js +8 -3
- package/dist/utils/refs.js +17 -2
- package/llms.txt +5 -3
- package/package.json +21 -8
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { c } from "react
|
|
2
|
+
import { c } from "react-compiler-runtime";
|
|
3
|
+
import { forwardRef } from "react";
|
|
3
4
|
import { useNumberInput } from "../../number-input/use-number-input.js";
|
|
4
5
|
import { mergeRefs } from "../../utils/refs.js";
|
|
5
6
|
import { Input } from "../input/input.js";
|
|
6
|
-
|
|
7
|
-
const $ = c(
|
|
7
|
+
const input_number_InputNumber = /*#__PURE__*/ forwardRef(function(t0, forwardedRef) {
|
|
8
|
+
const $ = c(39);
|
|
8
9
|
let ariaLabel;
|
|
9
10
|
let className;
|
|
10
11
|
let classNames;
|
|
11
12
|
let disabled;
|
|
12
13
|
let error;
|
|
13
|
-
let forwardedRef;
|
|
14
14
|
let hookOptions;
|
|
15
15
|
let id;
|
|
16
16
|
let name;
|
|
@@ -22,63 +22,61 @@ function InputNumber(t0) {
|
|
|
22
22
|
let suffix;
|
|
23
23
|
let variant;
|
|
24
24
|
if ($[0] !== t0) {
|
|
25
|
-
({ prefix, suffix, size, variant, error, status, disabled, placeholder, id, name, "aria-label": ariaLabel, className, classNames, styles,
|
|
25
|
+
({ prefix, suffix, size, variant, error, status, disabled, placeholder, id, name, "aria-label": ariaLabel, className, classNames, styles, ...hookOptions } = t0);
|
|
26
26
|
$[0] = t0;
|
|
27
27
|
$[1] = ariaLabel;
|
|
28
28
|
$[2] = className;
|
|
29
29
|
$[3] = classNames;
|
|
30
30
|
$[4] = disabled;
|
|
31
31
|
$[5] = error;
|
|
32
|
-
$[6] =
|
|
33
|
-
$[7] =
|
|
34
|
-
$[8] =
|
|
35
|
-
$[9] =
|
|
36
|
-
$[10] =
|
|
37
|
-
$[11] =
|
|
38
|
-
$[12] =
|
|
39
|
-
$[13] =
|
|
40
|
-
$[14] =
|
|
41
|
-
$[15] =
|
|
42
|
-
$[16] = variant;
|
|
32
|
+
$[6] = hookOptions;
|
|
33
|
+
$[7] = id;
|
|
34
|
+
$[8] = name;
|
|
35
|
+
$[9] = placeholder;
|
|
36
|
+
$[10] = prefix;
|
|
37
|
+
$[11] = size;
|
|
38
|
+
$[12] = status;
|
|
39
|
+
$[13] = styles;
|
|
40
|
+
$[14] = suffix;
|
|
41
|
+
$[15] = variant;
|
|
43
42
|
} else {
|
|
44
43
|
ariaLabel = $[1];
|
|
45
44
|
className = $[2];
|
|
46
45
|
classNames = $[3];
|
|
47
46
|
disabled = $[4];
|
|
48
47
|
error = $[5];
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
variant = $[16];
|
|
48
|
+
hookOptions = $[6];
|
|
49
|
+
id = $[7];
|
|
50
|
+
name = $[8];
|
|
51
|
+
placeholder = $[9];
|
|
52
|
+
prefix = $[10];
|
|
53
|
+
size = $[11];
|
|
54
|
+
status = $[12];
|
|
55
|
+
styles = $[13];
|
|
56
|
+
suffix = $[14];
|
|
57
|
+
variant = $[15];
|
|
60
58
|
}
|
|
61
59
|
const { inputProps } = useNumberInput(hookOptions);
|
|
62
60
|
let inputRest;
|
|
63
61
|
let ref;
|
|
64
|
-
if ($[
|
|
62
|
+
if ($[16] !== inputProps) {
|
|
65
63
|
({ ref, ...inputRest } = inputProps);
|
|
66
|
-
$[
|
|
67
|
-
$[
|
|
68
|
-
$[
|
|
64
|
+
$[16] = inputProps;
|
|
65
|
+
$[17] = inputRest;
|
|
66
|
+
$[18] = ref;
|
|
69
67
|
} else {
|
|
70
|
-
inputRest = $[
|
|
71
|
-
ref = $[
|
|
68
|
+
inputRest = $[17];
|
|
69
|
+
ref = $[18];
|
|
72
70
|
}
|
|
73
71
|
let t1;
|
|
74
|
-
if ($[
|
|
72
|
+
if ($[19] !== forwardedRef || $[20] !== ref) {
|
|
75
73
|
t1 = mergeRefs(ref, forwardedRef);
|
|
76
|
-
$[
|
|
77
|
-
$[
|
|
78
|
-
$[
|
|
79
|
-
} else t1 = $[
|
|
74
|
+
$[19] = forwardedRef;
|
|
75
|
+
$[20] = ref;
|
|
76
|
+
$[21] = t1;
|
|
77
|
+
} else t1 = $[21];
|
|
80
78
|
let t2;
|
|
81
|
-
if ($[
|
|
79
|
+
if ($[22] !== ariaLabel || $[23] !== className || $[24] !== classNames || $[25] !== disabled || $[26] !== error || $[27] !== id || $[28] !== inputRest || $[29] !== name || $[30] !== placeholder || $[31] !== prefix || $[32] !== size || $[33] !== status || $[34] !== styles || $[35] !== suffix || $[36] !== t1 || $[37] !== variant) {
|
|
82
80
|
t2 = /*#__PURE__*/ jsx(Input, {
|
|
83
81
|
ref: t1,
|
|
84
82
|
prefix: prefix,
|
|
@@ -97,24 +95,24 @@ function InputNumber(t0) {
|
|
|
97
95
|
styles: styles,
|
|
98
96
|
...inputRest
|
|
99
97
|
});
|
|
100
|
-
$[
|
|
101
|
-
$[
|
|
102
|
-
$[
|
|
103
|
-
$[
|
|
104
|
-
$[
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
$[
|
|
114
|
-
$[
|
|
115
|
-
$[
|
|
116
|
-
$[
|
|
117
|
-
} else t2 = $[
|
|
98
|
+
$[22] = ariaLabel;
|
|
99
|
+
$[23] = className;
|
|
100
|
+
$[24] = classNames;
|
|
101
|
+
$[25] = disabled;
|
|
102
|
+
$[26] = error;
|
|
103
|
+
$[27] = id;
|
|
104
|
+
$[28] = inputRest;
|
|
105
|
+
$[29] = name;
|
|
106
|
+
$[30] = placeholder;
|
|
107
|
+
$[31] = prefix;
|
|
108
|
+
$[32] = size;
|
|
109
|
+
$[33] = status;
|
|
110
|
+
$[34] = styles;
|
|
111
|
+
$[35] = suffix;
|
|
112
|
+
$[36] = t1;
|
|
113
|
+
$[37] = variant;
|
|
114
|
+
$[38] = t2;
|
|
115
|
+
} else t2 = $[38];
|
|
118
116
|
return t2;
|
|
119
|
-
}
|
|
120
|
-
export { InputNumber };
|
|
117
|
+
});
|
|
118
|
+
export { input_number_InputNumber as InputNumber };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { c } from "react
|
|
2
|
+
import { c } from "react-compiler-runtime";
|
|
3
3
|
import { useState } from "react";
|
|
4
4
|
import { TaoPortalScope } from "../../provider/tao-provider.js";
|
|
5
5
|
import { cx } from "../../utils/semantic.js";
|
|
@@ -33,5 +33,6 @@ export interface ConfirmDialogProps extends ModalFuncProps {
|
|
|
33
33
|
open: boolean;
|
|
34
34
|
/** Requests close (container flips `open` to false). */
|
|
35
35
|
close: () => void;
|
|
36
|
+
onMount?: () => void;
|
|
36
37
|
}
|
|
37
|
-
export declare function ConfirmDialog({ open, close, type, icon, title, content, okText, cancelText, okCancel, okButtonProps, cancelButtonProps, onOk, onCancel, afterClose, centered, width, maskClosable, closable, keyboard, className, classNames, styles, }: ConfirmDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export declare function ConfirmDialog({ onMount, open, close, type, icon, title, content, okText, cancelText, okCancel, okButtonProps, cancelButtonProps, onOk, onCancel, afterClose, centered, width, maskClosable, closable, keyboard, className, classNames, styles, }: ConfirmDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { c } from "react
|
|
3
|
-
import { useState } from "react";
|
|
2
|
+
import { c } from "react-compiler-runtime";
|
|
3
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
4
4
|
import { cx } from "../../utils/semantic.js";
|
|
5
5
|
import { Button } from "../button/button.js";
|
|
6
6
|
import { StatusIcon } from "../status-icon/status-icon.js";
|
|
@@ -8,23 +8,41 @@ import { Modal } from "./modal.js";
|
|
|
8
8
|
function isPromise(v) {
|
|
9
9
|
return !!v && 'function' == typeof v.then;
|
|
10
10
|
}
|
|
11
|
-
function ConfirmDialog({ open, close, type = 'confirm', icon, title, content, okText, cancelText, okCancel, okButtonProps, cancelButtonProps, onOk, onCancel, afterClose, centered = true, width = 416, maskClosable = false, closable = false, keyboard = true, className, classNames, styles }) {
|
|
11
|
+
function ConfirmDialog({ onMount, open, close, type = 'confirm', icon, title, content, okText, cancelText, okCancel, okButtonProps, cancelButtonProps, onOk, onCancel, afterClose, centered = true, width = 416, maskClosable = false, closable = false, keyboard = true, className, classNames, styles }) {
|
|
12
12
|
const [loading, setLoading] = useState(false);
|
|
13
|
+
const [cancelLoading, setCancelLoading] = useState(false);
|
|
14
|
+
const cancelPending = useRef(false);
|
|
15
|
+
useLayoutEffect(()=>onMount?.(), [
|
|
16
|
+
onMount
|
|
17
|
+
]);
|
|
13
18
|
const showCancel = okCancel ?? 'confirm' === type;
|
|
14
19
|
const runAndClose = async (handler, withLoading)=>{
|
|
15
20
|
const result = handler?.();
|
|
16
21
|
if (isPromise(result)) {
|
|
17
22
|
if (withLoading) setLoading(true);
|
|
23
|
+
else setCancelLoading(true);
|
|
18
24
|
try {
|
|
19
25
|
await result;
|
|
20
26
|
close();
|
|
21
27
|
} catch {} finally{
|
|
22
28
|
if (withLoading) setLoading(false);
|
|
29
|
+
else setCancelLoading(false);
|
|
23
30
|
}
|
|
24
31
|
} else close();
|
|
25
32
|
};
|
|
26
|
-
const handleOk = ()=>
|
|
27
|
-
|
|
33
|
+
const handleOk = ()=>{
|
|
34
|
+
if (cancelPending.current) return;
|
|
35
|
+
return runAndClose(onOk, true);
|
|
36
|
+
};
|
|
37
|
+
const handleCancel = async ()=>{
|
|
38
|
+
if (cancelPending.current) return;
|
|
39
|
+
cancelPending.current = true;
|
|
40
|
+
try {
|
|
41
|
+
await runAndClose(onCancel, false);
|
|
42
|
+
} finally{
|
|
43
|
+
cancelPending.current = false;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
28
46
|
const iconNode = null === icon ? null : icon ?? /*#__PURE__*/ jsx(StatusIconFor, {
|
|
29
47
|
type: type
|
|
30
48
|
});
|
|
@@ -48,6 +66,7 @@ function ConfirmDialog({ open, close, type = 'confirm', icon, title, content, ok
|
|
|
48
66
|
children: [
|
|
49
67
|
showCancel && /*#__PURE__*/ jsx(Button, {
|
|
50
68
|
variant: "secondary",
|
|
69
|
+
loading: cancelLoading,
|
|
51
70
|
onClick: handleCancel,
|
|
52
71
|
...cancelButtonProps,
|
|
53
72
|
children: cancelText ?? 'Cancel'
|
|
@@ -57,6 +76,7 @@ function ConfirmDialog({ open, close, type = 'confirm', icon, title, content, ok
|
|
|
57
76
|
loading: loading,
|
|
58
77
|
onClick: handleOk,
|
|
59
78
|
...okButtonProps,
|
|
79
|
+
disabled: cancelLoading || okButtonProps?.disabled,
|
|
60
80
|
children: okText ?? 'OK'
|
|
61
81
|
})
|
|
62
82
|
]
|
|
@@ -7,28 +7,40 @@ function confirm_confirm(config) {
|
|
|
7
7
|
const root = createRoot(container);
|
|
8
8
|
let currentConfig = config;
|
|
9
9
|
let open = true;
|
|
10
|
+
let mounted = false;
|
|
11
|
+
let destroyed = false;
|
|
12
|
+
function onMount() {
|
|
13
|
+
mounted = true;
|
|
14
|
+
}
|
|
10
15
|
function destroy() {
|
|
16
|
+
if (destroyed) return;
|
|
17
|
+
destroyed = true;
|
|
11
18
|
root.unmount();
|
|
12
19
|
const idx = destroyFns.indexOf(destroy);
|
|
13
20
|
if (-1 !== idx) destroyFns.splice(idx, 1);
|
|
14
21
|
}
|
|
15
22
|
function afterClose() {
|
|
16
|
-
|
|
23
|
+
if (destroyed) return;
|
|
17
24
|
destroy();
|
|
25
|
+
currentConfig.afterClose?.();
|
|
18
26
|
}
|
|
19
27
|
function close() {
|
|
28
|
+
if (destroyed || !open) return;
|
|
20
29
|
open = false;
|
|
21
|
-
render();
|
|
30
|
+
if (mounted) render();
|
|
31
|
+
else afterClose();
|
|
22
32
|
}
|
|
23
33
|
function render() {
|
|
24
34
|
root.render(/*#__PURE__*/ jsx(ConfirmDialog, {
|
|
25
35
|
...currentConfig,
|
|
26
36
|
open: open,
|
|
27
37
|
close: close,
|
|
28
|
-
afterClose: afterClose
|
|
38
|
+
afterClose: afterClose,
|
|
39
|
+
onMount: onMount
|
|
29
40
|
}));
|
|
30
41
|
}
|
|
31
42
|
function update(configUpdate) {
|
|
43
|
+
if (destroyed) return;
|
|
32
44
|
currentConfig = 'function' == typeof configUpdate ? configUpdate(currentConfig) : {
|
|
33
45
|
...currentConfig,
|
|
34
46
|
...configUpdate
|
|
@@ -46,7 +46,7 @@ export interface ModalProps {
|
|
|
46
46
|
afterClose?: () => void;
|
|
47
47
|
/**
|
|
48
48
|
* Unmount children when closed. Defaults to `true`.
|
|
49
|
-
* Set `false` to keep children mounted
|
|
49
|
+
* Set `false` to keep children mounted while releasing modal interaction locks when hidden.
|
|
50
50
|
*/
|
|
51
51
|
destroyOnHidden?: boolean;
|
|
52
52
|
children?: ReactNode;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { c } from "react
|
|
2
|
+
import { c } from "react-compiler-runtime";
|
|
3
3
|
import { useEffect, useRef } from "react";
|
|
4
4
|
import { TaoPortalScope } from "../../provider/tao-provider.js";
|
|
5
5
|
import { resolveResponsiveValue, useBreakpoint } from "../../utils/breakpoint.js";
|
|
6
|
+
import { DialogContent } from "../../utils/dialog-content.js";
|
|
6
7
|
import { preventParentOutsideDismiss } from "../../utils/portal.js";
|
|
7
8
|
import { cx } from "../../utils/semantic.js";
|
|
8
9
|
import { Button } from "../button/button.js";
|
|
9
10
|
import "./modal.css";
|
|
10
11
|
import * as __rspack_external__radix_ui_react_dialog_dabd8325 from "@radix-ui/react-dialog";
|
|
11
12
|
function Modal(t0) {
|
|
12
|
-
const $ = c(
|
|
13
|
+
const $ = c(89);
|
|
13
14
|
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;
|
|
14
15
|
const okText = void 0 === t1 ? "OK" : t1;
|
|
15
16
|
const cancelText = void 0 === t2 ? "Cancel" : t2;
|
|
@@ -144,50 +145,44 @@ function Modal(t0) {
|
|
|
144
145
|
$[31] = onClose;
|
|
145
146
|
$[32] = t20;
|
|
146
147
|
} else t20 = $[32];
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
t22 = cx(t21);
|
|
151
|
-
$[33] = t21;
|
|
152
|
-
$[34] = t22;
|
|
153
|
-
} else t22 = $[34];
|
|
154
|
-
const t23 = stylesProp?.overlay;
|
|
155
|
-
const t24 = maskClosable ? onClose : void 0;
|
|
156
|
-
let t25;
|
|
157
|
-
if ($[35] !== forceMount || $[36] !== t22 || $[37] !== t23 || $[38] !== t24) {
|
|
158
|
-
t25 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dialog_dabd8325.Overlay, {
|
|
148
|
+
let t21;
|
|
149
|
+
if ($[33] !== classNames?.overlay || $[34] !== forceMount || $[35] !== keepAlive || $[36] !== maskClosable || $[37] !== onClose || $[38] !== open || $[39] !== stylesProp?.overlay) {
|
|
150
|
+
t21 = (!keepAlive || open) && /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dialog_dabd8325.Overlay, {
|
|
159
151
|
forceMount: forceMount,
|
|
160
152
|
"data-tao-modal-overlay": "",
|
|
161
|
-
className:
|
|
162
|
-
style:
|
|
163
|
-
onClick:
|
|
153
|
+
className: cx(classNames?.overlay),
|
|
154
|
+
style: stylesProp?.overlay,
|
|
155
|
+
onClick: maskClosable ? onClose : void 0
|
|
164
156
|
});
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
167
|
-
$[
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
157
|
+
$[33] = classNames?.overlay;
|
|
158
|
+
$[34] = forceMount;
|
|
159
|
+
$[35] = keepAlive;
|
|
160
|
+
$[36] = maskClosable;
|
|
161
|
+
$[37] = onClose;
|
|
162
|
+
$[38] = open;
|
|
163
|
+
$[39] = stylesProp?.overlay;
|
|
164
|
+
$[40] = t21;
|
|
165
|
+
} else t21 = $[40];
|
|
166
|
+
const t22 = centered ? "" : void 0;
|
|
167
|
+
const t23 = open ? "" : void 0;
|
|
168
|
+
const t24 = classNames?.root;
|
|
169
|
+
let t25;
|
|
170
|
+
if ($[41] !== t24) {
|
|
171
|
+
t25 = cx(t24);
|
|
172
|
+
$[41] = t24;
|
|
173
|
+
$[42] = t25;
|
|
174
|
+
} else t25 = $[42];
|
|
175
|
+
let t26;
|
|
176
|
+
if ($[43] !== keyboard) {
|
|
177
|
+
t26 = (e)=>{
|
|
183
178
|
if (!keyboard) e.preventDefault();
|
|
184
179
|
};
|
|
185
|
-
$[
|
|
186
|
-
$[
|
|
187
|
-
} else
|
|
188
|
-
let
|
|
189
|
-
if ($[
|
|
190
|
-
|
|
180
|
+
$[43] = keyboard;
|
|
181
|
+
$[44] = t26;
|
|
182
|
+
} else t26 = $[44];
|
|
183
|
+
let t27;
|
|
184
|
+
if ($[45] !== classNames?.close || $[46] !== classNames?.header || $[47] !== classNames?.title || $[48] !== closable || $[49] !== onClose || $[50] !== stylesProp?.close || $[51] !== stylesProp?.header || $[52] !== stylesProp?.title || $[53] !== title) {
|
|
185
|
+
t27 = (null != title || closable) && /*#__PURE__*/ jsxs("div", {
|
|
191
186
|
"data-tao-modal-header": "",
|
|
192
187
|
className: cx(classNames?.header),
|
|
193
188
|
style: stylesProp?.header,
|
|
@@ -214,125 +209,129 @@ function Modal(t0) {
|
|
|
214
209
|
})
|
|
215
210
|
]
|
|
216
211
|
});
|
|
217
|
-
$[
|
|
218
|
-
$[
|
|
219
|
-
$[
|
|
220
|
-
$[
|
|
221
|
-
$[
|
|
222
|
-
$[
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
} else
|
|
228
|
-
const
|
|
229
|
-
let
|
|
230
|
-
if ($[
|
|
231
|
-
|
|
232
|
-
$[
|
|
233
|
-
$[
|
|
234
|
-
} else
|
|
235
|
-
const
|
|
236
|
-
let
|
|
237
|
-
if ($[
|
|
238
|
-
|
|
212
|
+
$[45] = classNames?.close;
|
|
213
|
+
$[46] = classNames?.header;
|
|
214
|
+
$[47] = classNames?.title;
|
|
215
|
+
$[48] = closable;
|
|
216
|
+
$[49] = onClose;
|
|
217
|
+
$[50] = stylesProp?.close;
|
|
218
|
+
$[51] = stylesProp?.header;
|
|
219
|
+
$[52] = stylesProp?.title;
|
|
220
|
+
$[53] = title;
|
|
221
|
+
$[54] = t27;
|
|
222
|
+
} else t27 = $[54];
|
|
223
|
+
const t28 = classNames?.body;
|
|
224
|
+
let t29;
|
|
225
|
+
if ($[55] !== t28) {
|
|
226
|
+
t29 = cx(t28);
|
|
227
|
+
$[55] = t28;
|
|
228
|
+
$[56] = t29;
|
|
229
|
+
} else t29 = $[56];
|
|
230
|
+
const t30 = stylesProp?.body;
|
|
231
|
+
let t31;
|
|
232
|
+
if ($[57] !== children || $[58] !== t29 || $[59] !== t30) {
|
|
233
|
+
t31 = /*#__PURE__*/ jsx("div", {
|
|
239
234
|
"data-tao-modal-body": "",
|
|
240
|
-
className:
|
|
241
|
-
style:
|
|
235
|
+
className: t29,
|
|
236
|
+
style: t30,
|
|
242
237
|
children: children
|
|
243
238
|
});
|
|
244
|
-
$[
|
|
245
|
-
$[
|
|
246
|
-
$[
|
|
247
|
-
$[
|
|
248
|
-
} else
|
|
249
|
-
let
|
|
250
|
-
if ($[
|
|
251
|
-
|
|
239
|
+
$[57] = children;
|
|
240
|
+
$[58] = t29;
|
|
241
|
+
$[59] = t30;
|
|
242
|
+
$[60] = t31;
|
|
243
|
+
} else t31 = $[60];
|
|
244
|
+
let t32;
|
|
245
|
+
if ($[61] !== classNames?.footer || $[62] !== footerContent || $[63] !== stylesProp?.footer) {
|
|
246
|
+
t32 = null != footerContent && /*#__PURE__*/ jsx("div", {
|
|
252
247
|
"data-tao-modal-footer": "",
|
|
253
248
|
className: cx(classNames?.footer),
|
|
254
249
|
style: stylesProp?.footer,
|
|
255
250
|
children: footerContent
|
|
256
251
|
});
|
|
257
|
-
$[
|
|
258
|
-
$[
|
|
259
|
-
$[
|
|
260
|
-
$[
|
|
261
|
-
} else
|
|
262
|
-
let
|
|
263
|
-
if ($[
|
|
264
|
-
|
|
252
|
+
$[61] = classNames?.footer;
|
|
253
|
+
$[62] = footerContent;
|
|
254
|
+
$[63] = stylesProp?.footer;
|
|
255
|
+
$[64] = t32;
|
|
256
|
+
} else t32 = $[64];
|
|
257
|
+
let t33;
|
|
258
|
+
if ($[65] !== contentStyle || $[66] !== forceMount || $[67] !== keepAlive || $[68] !== open || $[69] !== t25 || $[70] !== t26 || $[71] !== t27 || $[72] !== t31 || $[73] !== t32) {
|
|
259
|
+
t33 = /*#__PURE__*/ jsxs(DialogContent, {
|
|
260
|
+
open: open,
|
|
261
|
+
keepAlive: keepAlive,
|
|
265
262
|
forceMount: forceMount,
|
|
266
263
|
"data-tao-modal": "",
|
|
267
264
|
style: contentStyle,
|
|
268
|
-
className:
|
|
265
|
+
className: t25,
|
|
269
266
|
"aria-describedby": void 0,
|
|
270
|
-
onEscapeKeyDown:
|
|
267
|
+
onEscapeKeyDown: t26,
|
|
271
268
|
onPointerDownOutside: preventParentOutsideDismiss,
|
|
272
269
|
onInteractOutside: preventParentOutsideDismiss,
|
|
273
270
|
children: [
|
|
271
|
+
t27,
|
|
274
272
|
t31,
|
|
275
|
-
|
|
276
|
-
t36
|
|
273
|
+
t32
|
|
277
274
|
]
|
|
278
275
|
});
|
|
279
|
-
$[
|
|
280
|
-
$[
|
|
281
|
-
$[
|
|
282
|
-
$[
|
|
283
|
-
$[
|
|
284
|
-
$[
|
|
285
|
-
$[
|
|
286
|
-
$[
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
276
|
+
$[65] = contentStyle;
|
|
277
|
+
$[66] = forceMount;
|
|
278
|
+
$[67] = keepAlive;
|
|
279
|
+
$[68] = open;
|
|
280
|
+
$[69] = t25;
|
|
281
|
+
$[70] = t26;
|
|
282
|
+
$[71] = t27;
|
|
283
|
+
$[72] = t31;
|
|
284
|
+
$[73] = t32;
|
|
285
|
+
$[74] = t33;
|
|
286
|
+
} else t33 = $[74];
|
|
287
|
+
let t34;
|
|
288
|
+
if ($[75] !== t22 || $[76] !== t23 || $[77] !== t33) {
|
|
289
|
+
t34 = /*#__PURE__*/ jsx("div", {
|
|
291
290
|
"data-tao-modal-wrap": "",
|
|
292
|
-
"data-tao-centered":
|
|
293
|
-
"data-tao-open":
|
|
294
|
-
children:
|
|
291
|
+
"data-tao-centered": t22,
|
|
292
|
+
"data-tao-open": t23,
|
|
293
|
+
children: t33
|
|
295
294
|
});
|
|
296
|
-
$[
|
|
297
|
-
$[
|
|
298
|
-
$[
|
|
299
|
-
$[
|
|
300
|
-
} else
|
|
301
|
-
let
|
|
302
|
-
if ($[
|
|
303
|
-
|
|
295
|
+
$[75] = t22;
|
|
296
|
+
$[76] = t23;
|
|
297
|
+
$[77] = t33;
|
|
298
|
+
$[78] = t34;
|
|
299
|
+
} else t34 = $[78];
|
|
300
|
+
let t35;
|
|
301
|
+
if ($[79] !== t21 || $[80] !== t34) {
|
|
302
|
+
t35 = /*#__PURE__*/ jsxs(TaoPortalScope, {
|
|
304
303
|
children: [
|
|
305
|
-
|
|
306
|
-
|
|
304
|
+
t21,
|
|
305
|
+
t34
|
|
307
306
|
]
|
|
308
307
|
});
|
|
309
|
-
$[
|
|
310
|
-
$[
|
|
311
|
-
$[
|
|
312
|
-
} else
|
|
313
|
-
let
|
|
314
|
-
if ($[
|
|
315
|
-
|
|
308
|
+
$[79] = t21;
|
|
309
|
+
$[80] = t34;
|
|
310
|
+
$[81] = t35;
|
|
311
|
+
} else t35 = $[81];
|
|
312
|
+
let t36;
|
|
313
|
+
if ($[82] !== forceMount || $[83] !== t35) {
|
|
314
|
+
t36 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dialog_dabd8325.Portal, {
|
|
316
315
|
forceMount: forceMount,
|
|
317
|
-
children:
|
|
316
|
+
children: t35
|
|
318
317
|
});
|
|
319
|
-
$[
|
|
320
|
-
$[
|
|
321
|
-
$[
|
|
322
|
-
} else
|
|
323
|
-
let
|
|
324
|
-
if ($[
|
|
325
|
-
|
|
318
|
+
$[82] = forceMount;
|
|
319
|
+
$[83] = t35;
|
|
320
|
+
$[84] = t36;
|
|
321
|
+
} else t36 = $[84];
|
|
322
|
+
let t37;
|
|
323
|
+
if ($[85] !== open || $[86] !== t20 || $[87] !== t36) {
|
|
324
|
+
t37 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dialog_dabd8325.Root, {
|
|
326
325
|
open: open,
|
|
327
326
|
onOpenChange: t20,
|
|
328
|
-
children:
|
|
327
|
+
children: t36
|
|
329
328
|
});
|
|
330
|
-
$[
|
|
331
|
-
$[
|
|
332
|
-
$[
|
|
333
|
-
$[
|
|
334
|
-
} else
|
|
335
|
-
return
|
|
329
|
+
$[85] = open;
|
|
330
|
+
$[86] = t20;
|
|
331
|
+
$[87] = t36;
|
|
332
|
+
$[88] = t37;
|
|
333
|
+
} else t37 = $[88];
|
|
334
|
+
return t37;
|
|
336
335
|
}
|
|
337
336
|
function CloseIcon() {
|
|
338
337
|
const $ = c(1);
|