@rockshin/tao-ui 0.0.58 → 0.0.60
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/affix/affix.js +38 -4
- package/dist/components/app/app-modals.js +11 -6
- package/dist/components/app/app-notices.js +105 -47
- package/dist/components/auto-complete/auto-complete.js +9 -2
- package/dist/components/calendar/calendar.js +22 -18
- package/dist/components/carousel/carousel.js +27 -14
- package/dist/components/cascader/cascader.js +18 -12
- package/dist/components/checkbox/checkbox.d.ts +3 -1
- package/dist/components/checkbox/checkbox.js +65 -58
- package/dist/components/color-picker/color-picker.css +1 -1
- package/dist/components/color-picker/color-picker.js +386 -362
- package/dist/components/context-menu/context-menu.d.ts +3 -1
- package/dist/components/context-menu/context-menu.js +48 -43
- package/dist/components/date-picker/calendar/calendar-grid.d.ts +5 -3
- package/dist/components/date-picker/calendar/calendar-grid.js +9 -4
- package/dist/components/date-picker/calendar/month-grid.d.ts +2 -1
- package/dist/components/date-picker/calendar/month-grid.js +61 -45
- package/dist/components/date-picker/calendar/time-panel.d.ts +8 -1
- package/dist/components/date-picker/calendar/time-panel.js +93 -88
- package/dist/components/date-picker/calendar/year-grid.d.ts +2 -1
- package/dist/components/date-picker/calendar/year-grid.js +60 -44
- package/dist/components/date-picker/date-picker.css +9 -0
- package/dist/components/date-picker/date-picker.js +25 -14
- package/dist/components/date-picker/range-picker.d.ts +2 -0
- package/dist/components/date-picker/range-picker.js +132 -73
- package/dist/components/date-picker/types.js +1 -1
- package/dist/components/drawer/drawer.d.ts +1 -1
- package/dist/components/drawer/drawer.js +4 -3
- package/dist/components/dropdown/dropdown.d.ts +1 -0
- package/dist/components/dropdown/dropdown.js +29 -21
- package/dist/components/float-button/float-button.js +6 -5
- package/dist/components/form/form-item.d.ts +1 -1
- package/dist/components/form/form-item.js +160 -120
- package/dist/components/form/use-form.js +2 -1
- package/dist/components/form-field/form-field-view.d.ts +2 -1
- package/dist/components/form-field/form-field-view.js +173 -108
- package/dist/components/input/input-shared.js +3 -2
- package/dist/components/input/otp.js +114 -110
- package/dist/components/input/password.js +55 -61
- package/dist/components/input/search.js +8 -4
- package/dist/components/input-number/input-number.d.ts +2 -1
- package/dist/components/input-number/input-number.js +67 -52
- package/dist/components/mentions/mentions.js +4 -2
- package/dist/components/menu/menu-render.d.ts +6 -0
- package/dist/components/menu/menu-render.js +39 -26
- package/dist/components/modal/confirm-dialog.js +22 -10
- package/dist/components/modal/modal.js +320 -315
- package/dist/components/modal/use-modal.js +1 -1
- package/dist/components/pagination/pagination.d.ts +4 -2
- package/dist/components/pagination/pagination.js +128 -117
- package/dist/components/popover/popover.js +214 -351
- package/dist/components/qr-code/qr-code.js +157 -150
- package/dist/components/radio/radio.d.ts +3 -1
- package/dist/components/radio/radio.js +73 -64
- package/dist/components/select/mobile-select.js +7 -4
- package/dist/components/select/select-model.js +3 -3
- package/dist/components/select/select.js +78 -39
- package/dist/components/select/use-select-selection.js +100 -92
- package/dist/components/slider/slider.d.ts +2 -2
- package/dist/components/slider/slider.js +13 -2
- package/dist/components/sonner/sonner.js +2 -2
- package/dist/components/splitter/splitter.css +1 -0
- package/dist/components/splitter/splitter.js +152 -126
- package/dist/components/statistic/statistic.js +38 -31
- package/dist/components/switch/switch.js +45 -39
- package/dist/components/table/table-filter.d.ts +3 -1
- package/dist/components/table/table-filter.js +100 -74
- package/dist/components/table/table.js +2 -0
- package/dist/components/table/use-table-data.js +2 -2
- package/dist/components/tabs/tabs.d.ts +3 -2
- package/dist/components/tabs/tabs.js +122 -112
- package/dist/components/time-picker/time-picker.js +35 -3
- package/dist/components/tooltip/tooltip.d.ts +1 -1
- package/dist/components/tooltip/tooltip.js +220 -124
- package/dist/components/tree/tree.js +31 -3
- package/dist/components/tree-select/tree-select.js +2 -1
- package/dist/components/upload/upload.js +67 -40
- package/dist/locales/ar-EG.js +2 -0
- package/dist/locales/de-DE.js +2 -0
- package/dist/locales/en-US.js +2 -0
- package/dist/locales/es-ES.js +2 -0
- package/dist/locales/fr-FR.js +2 -0
- package/dist/locales/hi-IN.js +2 -0
- package/dist/locales/id-ID.js +2 -0
- package/dist/locales/it-IT.js +2 -0
- package/dist/locales/ja-JP.js +2 -0
- package/dist/locales/ko-KR.js +2 -0
- package/dist/locales/pt-BR.js +2 -0
- package/dist/locales/ru-RU.js +2 -0
- package/dist/locales/th-TH.js +2 -0
- package/dist/locales/tr-TR.js +2 -0
- package/dist/locales/types.d.ts +2 -0
- package/dist/locales/vi-VN.js +2 -0
- package/dist/locales/zh-CN.js +2 -0
- package/dist/locales/zh-TW.js +2 -0
- package/dist/number-input/format.js +1 -1
- package/dist/number-input/use-number-input.d.ts +1 -0
- package/dist/number-input/use-number-input.js +170 -321
- package/dist/number-input/validate.d.ts +1 -0
- package/dist/number-input/validate.js +1 -1
- package/dist/provider/tao-provider.d.ts +2 -2
- package/dist/provider/tao-provider.js +66 -52
- package/dist/theme/control.css +5 -1
- package/dist/theme/theme.css +2 -2
- package/dist/utils/composed-parent.d.ts +1 -0
- package/dist/utils/composed-parent.js +7 -0
- package/dist/utils/portal.d.ts +5 -0
- package/dist/utils/portal.js +7 -1
- package/dist/utils/refs.d.ts +3 -1
- package/dist/utils/refs.js +25 -1
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ import { forwardRef, useState } from "react";
|
|
|
4
4
|
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
5
5
|
import { BaseInput } from "./base-input.js";
|
|
6
6
|
const password_Password = /*#__PURE__*/ forwardRef(function(t0, ref) {
|
|
7
|
-
const $ = c(
|
|
7
|
+
const $ = c(22);
|
|
8
8
|
let disabled;
|
|
9
9
|
let iconRender;
|
|
10
10
|
let props;
|
|
@@ -40,77 +40,71 @@ const password_Password = /*#__PURE__*/ forwardRef(function(t0, ref) {
|
|
|
40
40
|
const resolvedDisabled = disabled ?? ctx.disabled;
|
|
41
41
|
const t3 = visible ? "text" : "password";
|
|
42
42
|
let t4;
|
|
43
|
-
if ($[8] !== config || $[9] !== ctx || $[10] !== iconRender || $[11] !== resolvedDisabled || $[12] !==
|
|
44
|
-
t4 = visibilityToggle
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
43
|
+
if ($[8] !== config || $[9] !== ctx || $[10] !== iconRender || $[11] !== resolvedDisabled || $[12] !== suffix || $[13] !== visibilityToggle || $[14] !== visible) {
|
|
44
|
+
t4 = visibilityToggle ? /*#__PURE__*/ jsxs(Fragment, {
|
|
45
|
+
children: [
|
|
46
|
+
suffix,
|
|
47
|
+
/*#__PURE__*/ jsx("button", {
|
|
48
|
+
type: "button",
|
|
49
|
+
"data-tao-input-action": "",
|
|
50
|
+
"aria-label": visible ? ctx.locale.hidePassword ?? "Hide password" : ctx.locale.showPassword ?? "Show password",
|
|
51
|
+
"aria-pressed": visible,
|
|
52
|
+
tabIndex: config.tabIndex,
|
|
53
|
+
disabled: resolvedDisabled,
|
|
54
|
+
onMouseDown: _temp,
|
|
55
|
+
onClick: ()=>{
|
|
56
|
+
if (void 0 === config.visible) setVisible(!visible);
|
|
57
|
+
config.onVisibleChange?.(!visible);
|
|
58
|
+
},
|
|
59
|
+
children: iconRender ? iconRender(visible) : /*#__PURE__*/ jsxs("svg", {
|
|
60
|
+
viewBox: "0 0 24 24",
|
|
61
|
+
fill: "none",
|
|
62
|
+
stroke: "currentColor",
|
|
63
|
+
strokeWidth: "1.8",
|
|
64
|
+
"aria-hidden": "true",
|
|
65
|
+
children: [
|
|
66
|
+
/*#__PURE__*/ jsx("path", {
|
|
67
|
+
d: "M2 12s3-7 10-7 10 7 10 7-3 7-10 7S2 12 2 12Z"
|
|
68
|
+
}),
|
|
69
|
+
/*#__PURE__*/ jsx("circle", {
|
|
70
|
+
cx: "12",
|
|
71
|
+
cy: "12",
|
|
72
|
+
r: "3"
|
|
73
|
+
}),
|
|
74
|
+
!visible && /*#__PURE__*/ jsx("path", {
|
|
75
|
+
d: "m3 3 18 18"
|
|
76
|
+
})
|
|
77
|
+
]
|
|
73
78
|
})
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
});
|
|
79
|
+
})
|
|
80
|
+
]
|
|
81
|
+
}) : suffix;
|
|
77
82
|
$[8] = config;
|
|
78
83
|
$[9] = ctx;
|
|
79
84
|
$[10] = iconRender;
|
|
80
85
|
$[11] = resolvedDisabled;
|
|
81
|
-
$[12] =
|
|
82
|
-
$[13] =
|
|
83
|
-
$[14] =
|
|
84
|
-
|
|
86
|
+
$[12] = suffix;
|
|
87
|
+
$[13] = visibilityToggle;
|
|
88
|
+
$[14] = visible;
|
|
89
|
+
$[15] = t4;
|
|
90
|
+
} else t4 = $[15];
|
|
85
91
|
let t5;
|
|
86
|
-
if ($[
|
|
87
|
-
t5 = /*#__PURE__*/
|
|
88
|
-
children: [
|
|
89
|
-
suffix,
|
|
90
|
-
t4
|
|
91
|
-
]
|
|
92
|
-
});
|
|
93
|
-
$[15] = suffix;
|
|
94
|
-
$[16] = t4;
|
|
95
|
-
$[17] = t5;
|
|
96
|
-
} else t5 = $[17];
|
|
97
|
-
let t6;
|
|
98
|
-
if ($[18] !== props || $[19] !== ref || $[20] !== resolvedDisabled || $[21] !== t3 || $[22] !== t5) {
|
|
99
|
-
t6 = /*#__PURE__*/ jsx(BaseInput, {
|
|
92
|
+
if ($[16] !== props || $[17] !== ref || $[18] !== resolvedDisabled || $[19] !== t3 || $[20] !== t4) {
|
|
93
|
+
t5 = /*#__PURE__*/ jsx(BaseInput, {
|
|
100
94
|
...props,
|
|
101
95
|
disabled: resolvedDisabled,
|
|
102
96
|
ref: ref,
|
|
103
97
|
type: t3,
|
|
104
|
-
suffix:
|
|
98
|
+
suffix: t4
|
|
105
99
|
});
|
|
106
|
-
$[
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
112
|
-
} else
|
|
113
|
-
return
|
|
100
|
+
$[16] = props;
|
|
101
|
+
$[17] = ref;
|
|
102
|
+
$[18] = resolvedDisabled;
|
|
103
|
+
$[19] = t3;
|
|
104
|
+
$[20] = t4;
|
|
105
|
+
$[21] = t5;
|
|
106
|
+
} else t5 = $[21];
|
|
107
|
+
return t5;
|
|
114
108
|
});
|
|
115
109
|
function _temp(event) {
|
|
116
110
|
return event.preventDefault();
|
|
@@ -26,17 +26,20 @@ const search_Search = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
26
26
|
source: 'input'
|
|
27
27
|
});
|
|
28
28
|
};
|
|
29
|
+
const searchLabel = ctx.locale.search ?? 'Search';
|
|
30
|
+
const hasButtonContent = 0 === enterButton || Boolean(enterButton);
|
|
31
|
+
const iconOnly = true === enterButton || !hasButtonContent;
|
|
29
32
|
const buttonProps = {
|
|
30
33
|
type: 'button',
|
|
31
34
|
disabled: submitDisabled,
|
|
32
35
|
'aria-busy': isLoading || void 0,
|
|
33
|
-
'aria-label':
|
|
36
|
+
'aria-label': iconOnly ? searchLabel : void 0,
|
|
37
|
+
title: iconOnly ? void 0 : searchLabel,
|
|
34
38
|
className: classNames?.button,
|
|
35
39
|
style: styles?.button,
|
|
36
40
|
onMouseDown: (event_0)=>event_0.preventDefault(),
|
|
37
41
|
onClick: search
|
|
38
42
|
};
|
|
39
|
-
const hasButtonContent = 0 === enterButton || Boolean(enterButton);
|
|
40
43
|
const button = customButton ? /*#__PURE__*/ cloneElement(enterButton, {
|
|
41
44
|
...buttonProps,
|
|
42
45
|
className: cx(enterButton.props.className, classNames?.button),
|
|
@@ -44,7 +47,8 @@ const search_Search = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
44
47
|
...enterButton.props.style,
|
|
45
48
|
...styles?.button
|
|
46
49
|
},
|
|
47
|
-
'aria-label': enterButton.props['aria-label']
|
|
50
|
+
'aria-label': enterButton.props['aria-label'],
|
|
51
|
+
title: enterButton.props.title ?? searchLabel,
|
|
48
52
|
...enterButton.type === Button ? {
|
|
49
53
|
loading: isLoading,
|
|
50
54
|
size: props.size ?? enterButton.props.size
|
|
@@ -62,7 +66,7 @@ const search_Search = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
62
66
|
loading: isLoading,
|
|
63
67
|
size: props.size,
|
|
64
68
|
variant: hasButtonContent ? 'primary' : 'secondary',
|
|
65
|
-
children:
|
|
69
|
+
children: iconOnly ? searchIcon ?? /*#__PURE__*/ jsx(SearchIcon, {}) : enterButton
|
|
66
70
|
});
|
|
67
71
|
return /*#__PURE__*/ jsxs("div", {
|
|
68
72
|
"data-tao-input-search": "",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AriaAttributes, type ReactNode, type Ref } from 'react';
|
|
1
|
+
import { type AriaAttributes, type CSSProperties, type ReactNode, type Ref } from 'react';
|
|
2
2
|
import { type UseNumberInputOptions } from '../../number-input/use-number-input.js';
|
|
3
3
|
import type { TaoSize, TaoStatus, TaoVariant } from '../../provider/tao-provider.js';
|
|
4
4
|
import type { SemanticClassNames, SemanticStyles } from '../../utils/semantic.js';
|
|
@@ -17,6 +17,7 @@ export interface InputNumberProps extends UseNumberInputOptions, Pick<AriaAttrib
|
|
|
17
17
|
id?: string;
|
|
18
18
|
name?: string;
|
|
19
19
|
className?: string;
|
|
20
|
+
style?: CSSProperties;
|
|
20
21
|
classNames?: SemanticClassNames<InputNumberSemanticPart>;
|
|
21
22
|
styles?: SemanticStyles<InputNumberSemanticPart>;
|
|
22
23
|
}
|
|
@@ -5,7 +5,7 @@ import { useNumberInput } from "../../number-input/use-number-input.js";
|
|
|
5
5
|
import { mergeRefs } from "../../utils/refs.js";
|
|
6
6
|
import { BaseInput } from "../input/base-input.js";
|
|
7
7
|
const input_number_InputNumber = /*#__PURE__*/ forwardRef(function(t0, forwardedRef) {
|
|
8
|
-
const $ = c(
|
|
8
|
+
const $ = c(54);
|
|
9
9
|
let ariaDescribedBy;
|
|
10
10
|
let ariaErrorMessage;
|
|
11
11
|
let ariaInvalid;
|
|
@@ -23,11 +23,12 @@ const input_number_InputNumber = /*#__PURE__*/ forwardRef(function(t0, forwarded
|
|
|
23
23
|
let prefix;
|
|
24
24
|
let size;
|
|
25
25
|
let status;
|
|
26
|
+
let style;
|
|
26
27
|
let styles;
|
|
27
28
|
let suffix;
|
|
28
29
|
let variant;
|
|
29
30
|
if ($[0] !== t0) {
|
|
30
|
-
({ prefix, suffix, size, variant, error, status, disabled, placeholder, id, name, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-errormessage": ariaErrorMessage, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, className, classNames, styles, ...hookOptions } = t0);
|
|
31
|
+
({ prefix, suffix, size, variant, error, status, disabled, placeholder, id, name, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-errormessage": ariaErrorMessage, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, className, style, classNames, styles, ...hookOptions } = t0);
|
|
31
32
|
$[0] = t0;
|
|
32
33
|
$[1] = ariaDescribedBy;
|
|
33
34
|
$[2] = ariaErrorMessage;
|
|
@@ -46,9 +47,10 @@ const input_number_InputNumber = /*#__PURE__*/ forwardRef(function(t0, forwarded
|
|
|
46
47
|
$[15] = prefix;
|
|
47
48
|
$[16] = size;
|
|
48
49
|
$[17] = status;
|
|
49
|
-
$[18] =
|
|
50
|
-
$[19] =
|
|
51
|
-
$[20] =
|
|
50
|
+
$[18] = style;
|
|
51
|
+
$[19] = styles;
|
|
52
|
+
$[20] = suffix;
|
|
53
|
+
$[21] = variant;
|
|
52
54
|
} else {
|
|
53
55
|
ariaDescribedBy = $[1];
|
|
54
56
|
ariaErrorMessage = $[2];
|
|
@@ -67,34 +69,45 @@ const input_number_InputNumber = /*#__PURE__*/ forwardRef(function(t0, forwarded
|
|
|
67
69
|
prefix = $[15];
|
|
68
70
|
size = $[16];
|
|
69
71
|
status = $[17];
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
style = $[18];
|
|
73
|
+
styles = $[19];
|
|
74
|
+
suffix = $[20];
|
|
75
|
+
variant = $[21];
|
|
73
76
|
}
|
|
74
|
-
|
|
77
|
+
let t1;
|
|
78
|
+
if ($[22] !== disabled || $[23] !== hookOptions) {
|
|
79
|
+
t1 = {
|
|
80
|
+
...hookOptions,
|
|
81
|
+
disabled
|
|
82
|
+
};
|
|
83
|
+
$[22] = disabled;
|
|
84
|
+
$[23] = hookOptions;
|
|
85
|
+
$[24] = t1;
|
|
86
|
+
} else t1 = $[24];
|
|
87
|
+
const { inputProps } = useNumberInput(t1);
|
|
75
88
|
let inputRest;
|
|
76
89
|
let ref;
|
|
77
|
-
if ($[
|
|
90
|
+
if ($[25] !== inputProps) {
|
|
78
91
|
({ ref, ...inputRest } = inputProps);
|
|
79
|
-
$[
|
|
80
|
-
$[
|
|
81
|
-
$[
|
|
92
|
+
$[25] = inputProps;
|
|
93
|
+
$[26] = inputRest;
|
|
94
|
+
$[27] = ref;
|
|
82
95
|
} else {
|
|
83
|
-
inputRest = $[
|
|
84
|
-
ref = $[
|
|
96
|
+
inputRest = $[26];
|
|
97
|
+
ref = $[27];
|
|
85
98
|
}
|
|
86
|
-
let
|
|
87
|
-
if ($[
|
|
88
|
-
|
|
89
|
-
$[
|
|
90
|
-
$[
|
|
91
|
-
$[
|
|
92
|
-
} else
|
|
93
|
-
const
|
|
94
|
-
let
|
|
95
|
-
if ($[
|
|
96
|
-
|
|
97
|
-
ref:
|
|
99
|
+
let t2;
|
|
100
|
+
if ($[28] !== forwardedRef || $[29] !== ref) {
|
|
101
|
+
t2 = mergeRefs(ref, forwardedRef);
|
|
102
|
+
$[28] = forwardedRef;
|
|
103
|
+
$[29] = ref;
|
|
104
|
+
$[30] = t2;
|
|
105
|
+
} else t2 = $[30];
|
|
106
|
+
const t3 = "error" === status || error ? true : ariaInvalid;
|
|
107
|
+
let t4;
|
|
108
|
+
if ($[31] !== ariaDescribedBy || $[32] !== ariaErrorMessage || $[33] !== ariaLabel || $[34] !== ariaLabelledBy || $[35] !== ariaRequired || $[36] !== className || $[37] !== classNames || $[38] !== disabled || $[39] !== error || $[40] !== id || $[41] !== inputRest || $[42] !== name || $[43] !== placeholder || $[44] !== prefix || $[45] !== size || $[46] !== status || $[47] !== style || $[48] !== styles || $[49] !== suffix || $[50] !== t2 || $[51] !== t3 || $[52] !== variant) {
|
|
109
|
+
t4 = /*#__PURE__*/ jsx(BaseInput, {
|
|
110
|
+
ref: t2,
|
|
98
111
|
prefix: prefix,
|
|
99
112
|
suffix: suffix,
|
|
100
113
|
size: size,
|
|
@@ -109,36 +122,38 @@ const input_number_InputNumber = /*#__PURE__*/ forwardRef(function(t0, forwarded
|
|
|
109
122
|
"aria-labelledby": ariaLabelledBy,
|
|
110
123
|
"aria-describedby": ariaDescribedBy,
|
|
111
124
|
"aria-errormessage": ariaErrorMessage,
|
|
112
|
-
"aria-invalid":
|
|
125
|
+
"aria-invalid": t3,
|
|
113
126
|
"aria-required": ariaRequired,
|
|
114
127
|
className: className,
|
|
128
|
+
style: style,
|
|
115
129
|
classNames: classNames,
|
|
116
130
|
styles: styles,
|
|
117
131
|
...inputRest
|
|
118
132
|
});
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
121
|
-
$[
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
124
|
-
$[
|
|
125
|
-
$[
|
|
126
|
-
$[
|
|
127
|
-
$[
|
|
128
|
-
$[
|
|
129
|
-
$[
|
|
130
|
-
$[
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
$[
|
|
139
|
-
$[
|
|
140
|
-
$[
|
|
141
|
-
|
|
142
|
-
|
|
133
|
+
$[31] = ariaDescribedBy;
|
|
134
|
+
$[32] = ariaErrorMessage;
|
|
135
|
+
$[33] = ariaLabel;
|
|
136
|
+
$[34] = ariaLabelledBy;
|
|
137
|
+
$[35] = ariaRequired;
|
|
138
|
+
$[36] = className;
|
|
139
|
+
$[37] = classNames;
|
|
140
|
+
$[38] = disabled;
|
|
141
|
+
$[39] = error;
|
|
142
|
+
$[40] = id;
|
|
143
|
+
$[41] = inputRest;
|
|
144
|
+
$[42] = name;
|
|
145
|
+
$[43] = placeholder;
|
|
146
|
+
$[44] = prefix;
|
|
147
|
+
$[45] = size;
|
|
148
|
+
$[46] = status;
|
|
149
|
+
$[47] = style;
|
|
150
|
+
$[48] = styles;
|
|
151
|
+
$[49] = suffix;
|
|
152
|
+
$[50] = t2;
|
|
153
|
+
$[51] = t3;
|
|
154
|
+
$[52] = variant;
|
|
155
|
+
$[53] = t4;
|
|
156
|
+
} else t4 = $[53];
|
|
157
|
+
return t4;
|
|
143
158
|
});
|
|
144
159
|
export { input_number_InputNumber as InputNumber };
|
|
@@ -9,9 +9,10 @@ import "./mentions.css";
|
|
|
9
9
|
import { interopDefault } from "../../utils/interop-default.js";
|
|
10
10
|
const RcMentionsComponent = /*#__PURE__*/ interopDefault(mentions);
|
|
11
11
|
function getMentions(value = '', { prefix = '@', split = ' ' } = {}) {
|
|
12
|
-
const prefixes = Array.isArray(prefix) ? prefix : [
|
|
12
|
+
const prefixes = (Array.isArray(prefix) ? prefix : [
|
|
13
13
|
prefix
|
|
14
|
-
];
|
|
14
|
+
]).filter(Boolean).sort((a, b)=>b.length - a.length);
|
|
15
|
+
if (!prefixes.length) return [];
|
|
15
16
|
const tokens = ' ' === split ? value.split(/\s+/u) : value.split(split);
|
|
16
17
|
return tokens.flatMap((text)=>{
|
|
17
18
|
const match = prefixes.find((candidate)=>text.startsWith(candidate));
|
|
@@ -75,6 +76,7 @@ const MentionsComponent = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
75
76
|
ref: ref,
|
|
76
77
|
prefixCls: prefixCls,
|
|
77
78
|
disabled: disabled,
|
|
79
|
+
"aria-invalid": 'error' === status ? true : props['aria-invalid'],
|
|
78
80
|
onKeyDownCapture: (event)=>{
|
|
79
81
|
props.onKeyDownCapture?.(event);
|
|
80
82
|
if (!event.isPropagationStopped() && 'Enter' === event.key && (event.nativeEvent.isComposing || 229 === event.keyCode)) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type ComponentType, type ReactNode } from 'react';
|
|
2
|
+
import { type TaoDirection, type TaoSize } from '../../provider/tao-provider.js';
|
|
2
3
|
import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic.js';
|
|
3
4
|
import './menu.css';
|
|
4
5
|
export type MenuSemanticPart = 'root' | 'content' | 'item' | 'itemIcon' | 'itemLabel' | 'itemExtra' | 'divider' | 'groupLabel' | 'subTrigger' | 'subContent';
|
|
@@ -67,6 +68,8 @@ export interface MenuPrimitives {
|
|
|
67
68
|
}
|
|
68
69
|
export interface RenderCtx {
|
|
69
70
|
P: MenuPrimitives;
|
|
71
|
+
size?: TaoSize;
|
|
72
|
+
direction?: TaoDirection;
|
|
70
73
|
classNames?: SemanticClassNames<MenuSemanticPart>;
|
|
71
74
|
styles?: SemanticStyles<MenuSemanticPart>;
|
|
72
75
|
/** Fire item.onClick + menu.onClick for a plain action item. */
|
|
@@ -76,6 +79,7 @@ export interface RenderCtx {
|
|
|
76
79
|
multiple: boolean;
|
|
77
80
|
selectable: boolean;
|
|
78
81
|
onToggle: (key: string) => void;
|
|
82
|
+
onRadioChange: (key: string) => void;
|
|
79
83
|
}
|
|
80
84
|
export declare function renderMenuItems(items: MenuItem[], ctx: RenderCtx): ReactNode;
|
|
81
85
|
/**
|
|
@@ -85,6 +89,8 @@ export declare function renderMenuItems(items: MenuItem[], ctx: RenderCtx): Reac
|
|
|
85
89
|
* and ContextMenu.
|
|
86
90
|
*/
|
|
87
91
|
export declare function useMenuController(menu: MenuProps, P: MenuPrimitives, semantic: {
|
|
92
|
+
size?: TaoSize;
|
|
93
|
+
direction?: TaoDirection;
|
|
88
94
|
classNames?: SemanticClassNames<MenuSemanticPart>;
|
|
89
95
|
styles?: SemanticStyles<MenuSemanticPart>;
|
|
90
96
|
}): {
|
|
@@ -227,14 +227,20 @@ function renderMenuItems(items, ctx) {
|
|
|
227
227
|
/*#__PURE__*/ jsx(P.Portal, {
|
|
228
228
|
children: /*#__PURE__*/ jsx(TaoPortalScope, {
|
|
229
229
|
asChild: true,
|
|
230
|
+
direction: ctx.direction,
|
|
230
231
|
children: /*#__PURE__*/ jsx(P.SubContent, {
|
|
231
232
|
"data-tao-menu-content": "",
|
|
232
233
|
"data-tao-menu-sub-content": "",
|
|
234
|
+
"data-tao-size": ctx.size,
|
|
233
235
|
className: cx(ctx.classNames?.subContent),
|
|
234
236
|
style: ctx.styles?.subContent,
|
|
235
237
|
sideOffset: 2,
|
|
236
238
|
alignOffset: -4,
|
|
237
|
-
children:
|
|
239
|
+
children: ctx.selectable && !ctx.multiple ? /*#__PURE__*/ jsx(P.RadioGroup, {
|
|
240
|
+
value: ctx.selectedKeys[0],
|
|
241
|
+
onValueChange: ctx.onRadioChange,
|
|
242
|
+
children: renderMenuItems(item.children, ctx)
|
|
243
|
+
}) : renderMenuItems(item.children, ctx)
|
|
238
244
|
})
|
|
239
245
|
})
|
|
240
246
|
})
|
|
@@ -245,6 +251,7 @@ function renderMenuItems(items, ctx) {
|
|
|
245
251
|
disabled: item.disabled,
|
|
246
252
|
textValue: textValue,
|
|
247
253
|
checked: ctx.selectedKeys.includes(item.key),
|
|
254
|
+
onSelect: (event)=>event.preventDefault(),
|
|
248
255
|
onCheckedChange: ()=>{
|
|
249
256
|
ctx.onToggle(item.key);
|
|
250
257
|
ctx.onAction(item);
|
|
@@ -315,7 +322,7 @@ function renderMenuItems(items, ctx) {
|
|
|
315
322
|
});
|
|
316
323
|
}
|
|
317
324
|
function useMenuController(menu, P, semantic) {
|
|
318
|
-
const $ = c(
|
|
325
|
+
const $ = c(40);
|
|
319
326
|
const selectable = !!menu.selectable;
|
|
320
327
|
const multiple = !!menu.multiple;
|
|
321
328
|
const isSelControlled = "selectedKeys" in menu;
|
|
@@ -389,58 +396,64 @@ function useMenuController(menu, P, semantic) {
|
|
|
389
396
|
} else t5 = $[15];
|
|
390
397
|
const onAction = t5;
|
|
391
398
|
let t6;
|
|
392
|
-
if ($[16] !== P || $[17] !== menu.items || $[18] !== multiple || $[19] !== onAction || $[20] !==
|
|
399
|
+
if ($[16] !== P || $[17] !== menu.items || $[18] !== multiple || $[19] !== onAction || $[20] !== radioChange || $[21] !== selectable || $[22] !== selectedKeys || $[23] !== semantic.classNames || $[24] !== semantic.direction || $[25] !== semantic.size || $[26] !== semantic.styles || $[27] !== toggleKey) {
|
|
393
400
|
const ctx = {
|
|
394
401
|
P,
|
|
402
|
+
size: semantic.size,
|
|
403
|
+
direction: semantic.direction,
|
|
395
404
|
classNames: semantic.classNames,
|
|
396
405
|
styles: semantic.styles,
|
|
397
406
|
onAction,
|
|
398
407
|
selectedKeys,
|
|
399
408
|
multiple,
|
|
400
409
|
selectable,
|
|
401
|
-
onToggle: toggleKey
|
|
410
|
+
onToggle: toggleKey,
|
|
411
|
+
onRadioChange: radioChange
|
|
402
412
|
};
|
|
403
413
|
t6 = renderMenuItems(menu.items, ctx);
|
|
404
414
|
$[16] = P;
|
|
405
415
|
$[17] = menu.items;
|
|
406
416
|
$[18] = multiple;
|
|
407
417
|
$[19] = onAction;
|
|
408
|
-
$[20] =
|
|
409
|
-
$[21] =
|
|
410
|
-
$[22] =
|
|
411
|
-
$[23] = semantic.
|
|
412
|
-
$[24] =
|
|
413
|
-
$[25] =
|
|
414
|
-
|
|
418
|
+
$[20] = radioChange;
|
|
419
|
+
$[21] = selectable;
|
|
420
|
+
$[22] = selectedKeys;
|
|
421
|
+
$[23] = semantic.classNames;
|
|
422
|
+
$[24] = semantic.direction;
|
|
423
|
+
$[25] = semantic.size;
|
|
424
|
+
$[26] = semantic.styles;
|
|
425
|
+
$[27] = toggleKey;
|
|
426
|
+
$[28] = t6;
|
|
427
|
+
} else t6 = $[28];
|
|
415
428
|
const body = t6;
|
|
416
429
|
let t7;
|
|
417
|
-
if ($[
|
|
430
|
+
if ($[29] !== P || $[30] !== body || $[31] !== multiple || $[32] !== radioChange || $[33] !== selectable || $[34] !== selectedKeys) {
|
|
418
431
|
t7 = selectable && !multiple ? /*#__PURE__*/ jsx(P.RadioGroup, {
|
|
419
432
|
value: selectedKeys[0],
|
|
420
433
|
onValueChange: radioChange,
|
|
421
434
|
children: body
|
|
422
435
|
}) : body;
|
|
423
|
-
$[
|
|
424
|
-
$[
|
|
425
|
-
$[
|
|
426
|
-
$[
|
|
427
|
-
$[
|
|
428
|
-
$[
|
|
429
|
-
$[
|
|
430
|
-
} else t7 = $[
|
|
436
|
+
$[29] = P;
|
|
437
|
+
$[30] = body;
|
|
438
|
+
$[31] = multiple;
|
|
439
|
+
$[32] = radioChange;
|
|
440
|
+
$[33] = selectable;
|
|
441
|
+
$[34] = selectedKeys;
|
|
442
|
+
$[35] = t7;
|
|
443
|
+
} else t7 = $[35];
|
|
431
444
|
const content = t7;
|
|
432
445
|
let t8;
|
|
433
|
-
if ($[
|
|
446
|
+
if ($[36] !== commitSel || $[37] !== content || $[38] !== selectedKeys) {
|
|
434
447
|
t8 = {
|
|
435
448
|
content,
|
|
436
449
|
selectedKeys,
|
|
437
450
|
commitSelection: commitSel
|
|
438
451
|
};
|
|
439
|
-
$[
|
|
440
|
-
$[
|
|
441
|
-
$[
|
|
442
|
-
$[
|
|
443
|
-
} else t8 = $[
|
|
452
|
+
$[36] = commitSel;
|
|
453
|
+
$[37] = content;
|
|
454
|
+
$[38] = selectedKeys;
|
|
455
|
+
$[39] = t8;
|
|
456
|
+
} else t8 = $[39];
|
|
444
457
|
return t8;
|
|
445
458
|
}
|
|
446
459
|
export { menuItemAsChild, renderMenuItems, useMenuController };
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
|
-
import { useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
import { useId, useLayoutEffect, useRef, useState } from "react";
|
|
4
|
+
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
4
5
|
import { cx } from "../../utils/semantic.js";
|
|
5
6
|
import { Button } from "../button/button.js";
|
|
6
7
|
import { StatusIcon } from "../status-icon/status-icon.js";
|
|
7
8
|
import { Modal } from "./modal.js";
|
|
8
|
-
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
9
9
|
function isPromise(v) {
|
|
10
10
|
return !!v && 'function' == typeof v.then;
|
|
11
11
|
}
|
|
12
|
-
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
|
|
13
|
-
const { locale } = useTaoConfig();
|
|
12
|
+
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, keyboard = true, className, classNames, styles }) {
|
|
13
|
+
const { locale, disabled } = useTaoConfig();
|
|
14
|
+
const titleId = useId();
|
|
15
|
+
const contentId = useId();
|
|
14
16
|
const [loading, setLoading] = useState(false);
|
|
15
17
|
const [cancelLoading, setCancelLoading] = useState(false);
|
|
18
|
+
const okPending = useRef(false);
|
|
16
19
|
const cancelPending = useRef(false);
|
|
17
20
|
useLayoutEffect(()=>onMount?.(), [
|
|
18
21
|
onMount
|
|
@@ -21,19 +24,23 @@ function ConfirmDialog({ onMount, open, close, type = 'confirm', icon, title, co
|
|
|
21
24
|
const runAndClose = async (handler, withLoading)=>{
|
|
22
25
|
const result = handler?.();
|
|
23
26
|
if (isPromise(result)) {
|
|
24
|
-
if (withLoading)
|
|
25
|
-
|
|
27
|
+
if (withLoading) {
|
|
28
|
+
okPending.current = true;
|
|
29
|
+
setLoading(true);
|
|
30
|
+
} else setCancelLoading(true);
|
|
26
31
|
try {
|
|
27
32
|
await result;
|
|
28
33
|
close();
|
|
29
34
|
} catch {} finally{
|
|
30
|
-
if (withLoading)
|
|
31
|
-
|
|
35
|
+
if (withLoading) {
|
|
36
|
+
okPending.current = false;
|
|
37
|
+
setLoading(false);
|
|
38
|
+
} else setCancelLoading(false);
|
|
32
39
|
}
|
|
33
40
|
} else close();
|
|
34
41
|
};
|
|
35
42
|
const handleOk = ()=>{
|
|
36
|
-
if (cancelPending.current) return;
|
|
43
|
+
if (cancelPending.current || okPending.current) return;
|
|
37
44
|
return runAndClose(onOk, true);
|
|
38
45
|
};
|
|
39
46
|
const handleCancel = async ()=>{
|
|
@@ -55,11 +62,13 @@ function ConfirmDialog({ onMount, open, close, type = 'confirm', icon, title, co
|
|
|
55
62
|
return /*#__PURE__*/ jsx(Modal, {
|
|
56
63
|
open: open,
|
|
57
64
|
title: null,
|
|
65
|
+
"aria-labelledby": null != title ? titleId : void 0,
|
|
66
|
+
"aria-describedby": null != content ? contentId : void 0,
|
|
58
67
|
onClose: handleCancel,
|
|
59
68
|
afterClose: afterClose,
|
|
60
69
|
width: width,
|
|
61
70
|
centered: centered,
|
|
62
|
-
closable: closable,
|
|
71
|
+
closable: closable ?? (!!(okButtonProps?.disabled ?? disabled) && (!showCancel || !!cancelButtonProps?.disabled)),
|
|
63
72
|
maskClosable: maskClosable,
|
|
64
73
|
keyboard: keyboard,
|
|
65
74
|
classNames: mergedClassNames,
|
|
@@ -69,6 +78,7 @@ function ConfirmDialog({ onMount, open, close, type = 'confirm', icon, title, co
|
|
|
69
78
|
showCancel && /*#__PURE__*/ jsx(Button, {
|
|
70
79
|
variant: "secondary",
|
|
71
80
|
...cancelButtonProps,
|
|
81
|
+
disabled: cancelButtonProps?.disabled ?? false,
|
|
72
82
|
loading: cancelLoading || cancelButtonProps?.loading,
|
|
73
83
|
onClick: (event)=>{
|
|
74
84
|
cancelButtonProps?.onClick?.(event);
|
|
@@ -101,10 +111,12 @@ function ConfirmDialog({ onMount, open, close, type = 'confirm', icon, title, co
|
|
|
101
111
|
"data-tao-modal-confirm-main": "",
|
|
102
112
|
children: [
|
|
103
113
|
null != title && /*#__PURE__*/ jsx("div", {
|
|
114
|
+
id: titleId,
|
|
104
115
|
"data-tao-modal-confirm-title": "",
|
|
105
116
|
children: title
|
|
106
117
|
}),
|
|
107
118
|
null != content && /*#__PURE__*/ jsx("div", {
|
|
119
|
+
id: contentId,
|
|
108
120
|
"data-tao-modal-confirm-content": "",
|
|
109
121
|
children: content
|
|
110
122
|
})
|