@rockshin/tao-ui 0.0.57 → 0.0.59
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 +112 -47
- package/dist/components/auto-complete/auto-complete.js +9 -2
- package/dist/components/avatar/avatar.js +1 -1
- package/dist/components/badge/badge.js +2 -2
- package/dist/components/breadcrumb/breadcrumb.js +5 -1
- package/dist/components/calendar/calendar.js +24 -17
- package/dist/components/carousel/carousel.js +35 -16
- package/dist/components/cascader/cascader.js +17 -12
- package/dist/components/checkbox/checkbox.d.ts +3 -1
- package/dist/components/checkbox/checkbox.js +65 -58
- package/dist/components/collapse/collapse-panels.js +68 -67
- package/dist/components/color-picker/color-picker.js +383 -360
- 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 +89 -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-localization.js +12 -14
- package/dist/components/date-picker/date-picker.css +9 -0
- package/dist/components/date-picker/date-picker.js +22 -13
- package/dist/components/date-picker/range-picker.d.ts +2 -0
- package/dist/components/date-picker/range-picker.js +127 -70
- package/dist/components/date-picker/types.js +1 -1
- package/dist/components/divider/divider.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.js +11 -9
- package/dist/components/float-button/float-button.js +11 -9
- package/dist/components/form/form-item.d.ts +1 -1
- package/dist/components/form/form-item.js +160 -120
- 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/image/image.js +135 -143
- package/dist/components/input/input-shared.js +3 -2
- package/dist/components/input/otp.js +120 -110
- package/dist/components/input/password.js +55 -61
- package/dist/components/input/search.js +13 -7
- package/dist/components/list/list.js +106 -105
- package/dist/components/masonry/masonry.js +1 -1
- package/dist/components/mentions/mentions.js +1 -0
- package/dist/components/menu/menu-render.js +1 -0
- package/dist/components/modal/confirm-dialog.js +11 -4
- package/dist/components/modal/modal.js +320 -315
- package/dist/components/pagination/pagination.d.ts +3 -0
- package/dist/components/pagination/pagination.js +5 -0
- package/dist/components/popover/popover.js +325 -289
- 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/rate/rate.js +83 -72
- package/dist/components/scroll-area/scroll-area.css +1 -1
- package/dist/components/scroll-area/scroll-area.js +294 -222
- package/dist/components/select/mobile-select.js +6 -3
- package/dist/components/select/select-model.js +2 -2
- package/dist/components/select/select.js +78 -39
- package/dist/components/select/use-select-selection.d.ts +1 -1
- package/dist/components/select/use-select-selection.js +91 -84
- 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 +84 -78
- package/dist/components/steps/steps.js +1 -1
- package/dist/components/switch/switch.js +45 -39
- package/dist/components/table/table.js +5 -1
- package/dist/components/table/use-table-data.js +2 -2
- package/dist/components/time-picker/time-picker.js +31 -1
- package/dist/components/tooltip/tooltip.js +237 -99
- package/dist/components/tree/tree.js +31 -3
- package/dist/components/tree-select/tree-select.js +1 -1
- package/dist/components/upload/upload.js +69 -42
- 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/cursor.js +20 -8
- package/dist/number-input/format.js +13 -5
- package/dist/number-input/use-number-input.js +166 -318
- 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 +49 -49
- 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
|
@@ -17,14 +17,15 @@ function useTextControlRef(ref, nodeRef, rootRef) {
|
|
|
17
17
|
if ($[2] !== nodeRef || $[3] !== rootRef) {
|
|
18
18
|
t1 = ()=>{
|
|
19
19
|
const node = nodeRef.current;
|
|
20
|
-
const nativeFocus = Object.getPrototypeOf(node).focus
|
|
20
|
+
const nativeFocus = Object.getPrototypeOf(node).focus;
|
|
21
|
+
if (!nativeFocus) return node;
|
|
21
22
|
return Object.assign(node, {
|
|
22
23
|
input: node,
|
|
23
24
|
textArea: node,
|
|
24
25
|
nativeElement: rootRef.current,
|
|
25
26
|
focus (options) {
|
|
26
27
|
nativeFocus.call(node, options);
|
|
27
|
-
if (options?.cursor && (
|
|
28
|
+
if (options?.cursor && ("textarea" === node.localName || [
|
|
28
29
|
"text",
|
|
29
30
|
"search",
|
|
30
31
|
"password",
|
|
@@ -6,7 +6,8 @@ import { cx } from "../../utils/semantic.js";
|
|
|
6
6
|
import { FormFieldChangeContext } from "../form/form-context.js";
|
|
7
7
|
import { BaseInput } from "./base-input.js";
|
|
8
8
|
const otp_OTP = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
9
|
-
const $ = c(
|
|
9
|
+
const $ = c(62);
|
|
10
|
+
let ariaRequired;
|
|
10
11
|
let autoComplete;
|
|
11
12
|
let autoFocus;
|
|
12
13
|
let className;
|
|
@@ -29,51 +30,53 @@ const otp_OTP = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
29
30
|
let value;
|
|
30
31
|
let variant;
|
|
31
32
|
if ($[0] !== props) {
|
|
32
|
-
({ value, defaultValue: t0, length: t1, formatter, separator, mask: t2, type: t3, autoComplete, disabled, status, size, variant, onChange, onInput, classNames: customClassNames, styles: customStyles, className, style, autoFocus, inputMode, ...rest } = props);
|
|
33
|
+
({ value, defaultValue: t0, length: t1, formatter, separator, mask: t2, type: t3, autoComplete, disabled, status, size, variant, onChange, onInput, classNames: customClassNames, styles: customStyles, className, style, autoFocus, inputMode, "aria-required": ariaRequired, ...rest } = props);
|
|
33
34
|
$[0] = props;
|
|
34
|
-
$[1] =
|
|
35
|
-
$[2] =
|
|
36
|
-
$[3] =
|
|
37
|
-
$[4] =
|
|
38
|
-
$[5] =
|
|
39
|
-
$[6] =
|
|
40
|
-
$[7] =
|
|
41
|
-
$[8] =
|
|
42
|
-
$[9] =
|
|
43
|
-
$[10] =
|
|
44
|
-
$[11] =
|
|
45
|
-
$[12] =
|
|
46
|
-
$[13] =
|
|
47
|
-
$[14] =
|
|
48
|
-
$[15] =
|
|
49
|
-
$[16] =
|
|
50
|
-
$[17] =
|
|
51
|
-
$[18] =
|
|
52
|
-
$[19] =
|
|
53
|
-
$[20] =
|
|
54
|
-
$[21] =
|
|
35
|
+
$[1] = ariaRequired;
|
|
36
|
+
$[2] = autoComplete;
|
|
37
|
+
$[3] = autoFocus;
|
|
38
|
+
$[4] = className;
|
|
39
|
+
$[5] = customClassNames;
|
|
40
|
+
$[6] = customStyles;
|
|
41
|
+
$[7] = disabled;
|
|
42
|
+
$[8] = formatter;
|
|
43
|
+
$[9] = inputMode;
|
|
44
|
+
$[10] = onChange;
|
|
45
|
+
$[11] = onInput;
|
|
46
|
+
$[12] = rest;
|
|
47
|
+
$[13] = separator;
|
|
48
|
+
$[14] = size;
|
|
49
|
+
$[15] = status;
|
|
50
|
+
$[16] = style;
|
|
51
|
+
$[17] = t0;
|
|
52
|
+
$[18] = t1;
|
|
53
|
+
$[19] = t2;
|
|
54
|
+
$[20] = t3;
|
|
55
|
+
$[21] = value;
|
|
56
|
+
$[22] = variant;
|
|
55
57
|
} else {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
58
|
+
ariaRequired = $[1];
|
|
59
|
+
autoComplete = $[2];
|
|
60
|
+
autoFocus = $[3];
|
|
61
|
+
className = $[4];
|
|
62
|
+
customClassNames = $[5];
|
|
63
|
+
customStyles = $[6];
|
|
64
|
+
disabled = $[7];
|
|
65
|
+
formatter = $[8];
|
|
66
|
+
inputMode = $[9];
|
|
67
|
+
onChange = $[10];
|
|
68
|
+
onInput = $[11];
|
|
69
|
+
rest = $[12];
|
|
70
|
+
separator = $[13];
|
|
71
|
+
size = $[14];
|
|
72
|
+
status = $[15];
|
|
73
|
+
style = $[16];
|
|
74
|
+
t0 = $[17];
|
|
75
|
+
t1 = $[18];
|
|
76
|
+
t2 = $[19];
|
|
77
|
+
t3 = $[20];
|
|
78
|
+
value = $[21];
|
|
79
|
+
variant = $[22];
|
|
77
80
|
}
|
|
78
81
|
const defaultValue = void 0 === t0 ? "" : t0;
|
|
79
82
|
const length = void 0 === t1 ? 6 : t1;
|
|
@@ -83,42 +86,42 @@ const otp_OTP = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
83
86
|
const ctx = useTaoConfig();
|
|
84
87
|
const fieldChange = useContext(FormFieldChangeContext);
|
|
85
88
|
let t4;
|
|
86
|
-
if ($[
|
|
89
|
+
if ($[23] !== formatter || $[24] !== length) {
|
|
87
90
|
t4 = (text)=>Array.from(formatter ? formatter(text) : text).slice(0, length);
|
|
88
|
-
$[
|
|
89
|
-
$[
|
|
90
|
-
$[
|
|
91
|
-
} else t4 = $[
|
|
91
|
+
$[23] = formatter;
|
|
92
|
+
$[24] = length;
|
|
93
|
+
$[25] = t4;
|
|
94
|
+
} else t4 = $[25];
|
|
92
95
|
const format = t4;
|
|
93
96
|
let t5;
|
|
94
|
-
if ($[
|
|
97
|
+
if ($[26] !== format || $[27] !== props || $[28] !== value) {
|
|
95
98
|
t5 = "value" in props ? format(value ?? "").join("") : void 0;
|
|
96
|
-
$[
|
|
97
|
-
$[
|
|
98
|
-
$[
|
|
99
|
-
$[
|
|
100
|
-
} else t5 = $[
|
|
99
|
+
$[26] = format;
|
|
100
|
+
$[27] = props;
|
|
101
|
+
$[28] = value;
|
|
102
|
+
$[29] = t5;
|
|
103
|
+
} else t5 = $[29];
|
|
101
104
|
const formattedValue = t5;
|
|
102
105
|
let t6;
|
|
103
|
-
if ($[
|
|
106
|
+
if ($[30] !== defaultValue || $[31] !== format || $[32] !== props || $[33] !== value) {
|
|
104
107
|
t6 = ()=>format("value" in props ? value ?? "" : defaultValue);
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
109
|
-
$[
|
|
110
|
-
} else t6 = $[
|
|
108
|
+
$[30] = defaultValue;
|
|
109
|
+
$[31] = format;
|
|
110
|
+
$[32] = props;
|
|
111
|
+
$[33] = value;
|
|
112
|
+
$[34] = t6;
|
|
113
|
+
} else t6 = $[34];
|
|
111
114
|
const [innerValue, setInnerValue] = useState(t6);
|
|
112
115
|
let t7;
|
|
113
|
-
if ($[
|
|
116
|
+
if ($[35] !== formattedValue || $[36] !== value) {
|
|
114
117
|
t7 = {
|
|
115
118
|
value,
|
|
116
119
|
formattedValue
|
|
117
120
|
};
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
121
|
-
} else t7 = $[
|
|
121
|
+
$[35] = formattedValue;
|
|
122
|
+
$[36] = value;
|
|
123
|
+
$[37] = t7;
|
|
124
|
+
} else t7 = $[37];
|
|
122
125
|
const [previousValue, setPreviousValue] = useState(t7);
|
|
123
126
|
const [draft, setDraft] = useState(null);
|
|
124
127
|
if (previousValue.value !== value || previousValue.formattedValue !== formattedValue) {
|
|
@@ -131,16 +134,16 @@ const otp_OTP = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
131
134
|
}
|
|
132
135
|
const cells = innerValue.slice(0, length);
|
|
133
136
|
let t8;
|
|
134
|
-
if ($[
|
|
137
|
+
if ($[38] === Symbol.for("react.memo_cache_sentinel")) {
|
|
135
138
|
t8 = [];
|
|
136
|
-
$[
|
|
137
|
-
} else t8 = $[
|
|
139
|
+
$[38] = t8;
|
|
140
|
+
} else t8 = $[38];
|
|
138
141
|
const inputs = useRef(t8);
|
|
139
142
|
const root = useRef(null);
|
|
140
143
|
const composing = useRef(null);
|
|
141
144
|
let t10;
|
|
142
145
|
let t9;
|
|
143
|
-
if ($[
|
|
146
|
+
if ($[39] !== length) {
|
|
144
147
|
t9 = ()=>{
|
|
145
148
|
if (null !== composing.current && composing.current >= length) {
|
|
146
149
|
composing.current = null;
|
|
@@ -150,52 +153,52 @@ const otp_OTP = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
150
153
|
t10 = [
|
|
151
154
|
length
|
|
152
155
|
];
|
|
153
|
-
$[
|
|
154
|
-
$[
|
|
155
|
-
$[
|
|
156
|
+
$[39] = length;
|
|
157
|
+
$[40] = t10;
|
|
158
|
+
$[41] = t9;
|
|
156
159
|
} else {
|
|
157
|
-
t10 = $[
|
|
158
|
-
t9 = $[
|
|
160
|
+
t10 = $[40];
|
|
161
|
+
t9 = $[41];
|
|
159
162
|
}
|
|
160
163
|
useEffect(t9, t10);
|
|
161
164
|
let t11;
|
|
162
|
-
if ($[
|
|
165
|
+
if ($[42] !== customClassNames || $[43] !== props) {
|
|
163
166
|
t11 = "function" == typeof customClassNames ? customClassNames({
|
|
164
167
|
props
|
|
165
168
|
}) : customClassNames;
|
|
166
|
-
$[
|
|
167
|
-
$[
|
|
168
|
-
$[
|
|
169
|
-
} else t11 = $[
|
|
169
|
+
$[42] = customClassNames;
|
|
170
|
+
$[43] = props;
|
|
171
|
+
$[44] = t11;
|
|
172
|
+
} else t11 = $[44];
|
|
170
173
|
const classNames = t11;
|
|
171
174
|
let t12;
|
|
172
|
-
if ($[
|
|
175
|
+
if ($[45] !== customStyles || $[46] !== props) {
|
|
173
176
|
t12 = "function" == typeof customStyles ? customStyles({
|
|
174
177
|
props
|
|
175
178
|
}) : customStyles;
|
|
176
|
-
$[
|
|
177
|
-
$[
|
|
178
|
-
$[
|
|
179
|
-
} else t12 = $[
|
|
179
|
+
$[45] = customStyles;
|
|
180
|
+
$[46] = props;
|
|
181
|
+
$[47] = t12;
|
|
182
|
+
} else t12 = $[47];
|
|
180
183
|
const styles = t12;
|
|
181
184
|
let t13;
|
|
182
|
-
if ($[
|
|
185
|
+
if ($[48] === Symbol.for("react.memo_cache_sentinel")) {
|
|
183
186
|
t13 = (index)=>{
|
|
184
187
|
inputs.current[index]?.focus();
|
|
185
188
|
inputs.current[index]?.select();
|
|
186
189
|
};
|
|
187
|
-
$[
|
|
188
|
-
} else t13 = $[
|
|
190
|
+
$[48] = t13;
|
|
191
|
+
} else t13 = $[48];
|
|
189
192
|
const focus = t13;
|
|
190
193
|
let t14;
|
|
191
|
-
if ($[
|
|
194
|
+
if ($[49] === Symbol.for("react.memo_cache_sentinel")) {
|
|
192
195
|
t14 = ()=>({
|
|
193
196
|
focus: ()=>focus(0),
|
|
194
197
|
blur: ()=>inputs.current.forEach(_temp),
|
|
195
198
|
nativeElement: root.current
|
|
196
199
|
});
|
|
197
|
-
$[
|
|
198
|
-
} else t14 = $[
|
|
200
|
+
$[49] = t14;
|
|
201
|
+
} else t14 = $[49];
|
|
199
202
|
useImperativeHandle(ref, t14);
|
|
200
203
|
const update = (index_0, text_0)=>{
|
|
201
204
|
const chars = format(text_0);
|
|
@@ -227,23 +230,23 @@ const otp_OTP = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
227
230
|
const t16 = "";
|
|
228
231
|
const t17 = classNames?.root;
|
|
229
232
|
let t18;
|
|
230
|
-
if ($[
|
|
233
|
+
if ($[50] !== className || $[51] !== t17) {
|
|
231
234
|
t18 = cx(t17, className);
|
|
232
|
-
$[
|
|
233
|
-
$[
|
|
234
|
-
$[
|
|
235
|
-
} else t18 = $[
|
|
235
|
+
$[50] = className;
|
|
236
|
+
$[51] = t17;
|
|
237
|
+
$[52] = t18;
|
|
238
|
+
} else t18 = $[52];
|
|
236
239
|
const t19 = styles?.root;
|
|
237
240
|
let t20;
|
|
238
|
-
if ($[
|
|
241
|
+
if ($[53] !== style || $[54] !== t19) {
|
|
239
242
|
t20 = {
|
|
240
243
|
...t19,
|
|
241
244
|
...style
|
|
242
245
|
};
|
|
243
|
-
$[
|
|
244
|
-
$[
|
|
245
|
-
$[
|
|
246
|
-
} else t20 = $[
|
|
246
|
+
$[53] = style;
|
|
247
|
+
$[54] = t19;
|
|
248
|
+
$[55] = t20;
|
|
249
|
+
} else t20 = $[55];
|
|
247
250
|
const t21 = Array.from({
|
|
248
251
|
length
|
|
249
252
|
}, (__0, index_1)=>/*#__PURE__*/ jsxs(Fragment, {
|
|
@@ -268,6 +271,7 @@ const otp_OTP = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
268
271
|
"aria-label": ctx.locale.otpLabel?.(index_1 + 1, length) ?? `Character ${index_1 + 1} of ${length}`,
|
|
269
272
|
"aria-describedby": rest["aria-describedby"],
|
|
270
273
|
"aria-invalid": rest["aria-invalid"],
|
|
274
|
+
"aria-required": ariaRequired,
|
|
271
275
|
classNames: {
|
|
272
276
|
input: classNames?.input
|
|
273
277
|
},
|
|
@@ -275,6 +279,12 @@ const otp_OTP = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
275
279
|
input: styles?.input
|
|
276
280
|
},
|
|
277
281
|
onFocus: _temp2,
|
|
282
|
+
onBlur: ()=>{
|
|
283
|
+
if (composing.current === index_1) {
|
|
284
|
+
composing.current = null;
|
|
285
|
+
setDraft(null);
|
|
286
|
+
}
|
|
287
|
+
},
|
|
278
288
|
onChange: (event_0)=>{
|
|
279
289
|
if (composing.current === index_1) setDraft({
|
|
280
290
|
index: index_1,
|
|
@@ -326,7 +336,7 @@ const otp_OTP = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
326
336
|
]
|
|
327
337
|
}, `otp-${index_1}`));
|
|
328
338
|
let t22;
|
|
329
|
-
if ($[
|
|
339
|
+
if ($[56] !== rest || $[57] !== t15 || $[58] !== t18 || $[59] !== t20 || $[60] !== t21) {
|
|
330
340
|
t22 = /*#__PURE__*/ jsx("div", {
|
|
331
341
|
...rest,
|
|
332
342
|
ref: root,
|
|
@@ -336,13 +346,13 @@ const otp_OTP = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
336
346
|
style: t20,
|
|
337
347
|
children: t21
|
|
338
348
|
});
|
|
339
|
-
$[
|
|
340
|
-
$[
|
|
341
|
-
$[
|
|
342
|
-
$[
|
|
343
|
-
$[
|
|
344
|
-
$[
|
|
345
|
-
} else t22 = $[
|
|
349
|
+
$[56] = rest;
|
|
350
|
+
$[57] = t15;
|
|
351
|
+
$[58] = t18;
|
|
352
|
+
$[59] = t20;
|
|
353
|
+
$[60] = t21;
|
|
354
|
+
$[61] = t22;
|
|
355
|
+
} else t22 = $[61];
|
|
346
356
|
return t22;
|
|
347
357
|
});
|
|
348
358
|
function _temp(input) {
|
|
@@ -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();
|
|
@@ -19,16 +19,22 @@ const search_Search = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
19
19
|
}) : customStyles;
|
|
20
20
|
const customButton = /*#__PURE__*/ isValidElement(enterButton) && ('button' === enterButton.type || enterButton.type === Button);
|
|
21
21
|
const isLoading = loading || customButton && enterButton.type === Button && enterButton.props.loading;
|
|
22
|
+
const submitDisabled = disabled || isLoading || customButton && enterButton.props.disabled;
|
|
22
23
|
const search = (event)=>{
|
|
23
|
-
|
|
24
|
+
const input = inputRef.current;
|
|
25
|
+
if (input && !submitDisabled && !event.defaultPrevented) onSearch?.(input.value, event, {
|
|
24
26
|
source: 'input'
|
|
25
27
|
});
|
|
26
28
|
};
|
|
29
|
+
const searchLabel = ctx.locale.search ?? 'Search';
|
|
30
|
+
const hasButtonContent = 0 === enterButton || Boolean(enterButton);
|
|
31
|
+
const iconOnly = true === enterButton || !hasButtonContent;
|
|
27
32
|
const buttonProps = {
|
|
28
33
|
type: 'button',
|
|
29
|
-
disabled:
|
|
34
|
+
disabled: submitDisabled,
|
|
30
35
|
'aria-busy': isLoading || void 0,
|
|
31
|
-
'aria-label':
|
|
36
|
+
'aria-label': iconOnly ? searchLabel : void 0,
|
|
37
|
+
title: iconOnly ? void 0 : searchLabel,
|
|
32
38
|
className: classNames?.button,
|
|
33
39
|
style: styles?.button,
|
|
34
40
|
onMouseDown: (event_0)=>event_0.preventDefault(),
|
|
@@ -41,8 +47,8 @@ const search_Search = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
41
47
|
...enterButton.props.style,
|
|
42
48
|
...styles?.button
|
|
43
49
|
},
|
|
44
|
-
'aria-label': enterButton.props['aria-label']
|
|
45
|
-
|
|
50
|
+
'aria-label': enterButton.props['aria-label'],
|
|
51
|
+
title: enterButton.props.title ?? searchLabel,
|
|
46
52
|
...enterButton.type === Button ? {
|
|
47
53
|
loading: isLoading,
|
|
48
54
|
size: props.size ?? enterButton.props.size
|
|
@@ -59,8 +65,8 @@ const search_Search = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
59
65
|
...buttonProps,
|
|
60
66
|
loading: isLoading,
|
|
61
67
|
size: props.size,
|
|
62
|
-
variant:
|
|
63
|
-
children:
|
|
68
|
+
variant: hasButtonContent ? 'primary' : 'secondary',
|
|
69
|
+
children: iconOnly ? searchIcon ?? /*#__PURE__*/ jsx(SearchIcon, {}) : enterButton
|
|
64
70
|
});
|
|
65
71
|
return /*#__PURE__*/ jsxs("div", {
|
|
66
72
|
"data-tao-input-search": "",
|