@rockshin/tao-ui 0.0.48 → 0.0.49
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 +20 -16
- package/dist/components/alert/alert.js +114 -99
- package/dist/components/app/app-modals.js +134 -96
- package/dist/components/app/app-notices.js +39 -23
- package/dist/components/auto-complete/auto-complete.js +21 -7
- package/dist/components/avatar/avatar.js +31 -11
- package/dist/components/badge/badge.css +1 -1
- package/dist/components/badge/badge.js +72 -257
- package/dist/components/border-beam/border-beam.js +21 -17
- package/dist/components/breadcrumb/breadcrumb.js +178 -159
- package/dist/components/button/button.js +61 -53
- package/dist/components/calendar/calendar.js +6 -4
- package/dist/components/card/card.js +24 -8
- package/dist/components/carousel/carousel.d.ts +1 -1
- package/dist/components/carousel/carousel.js +105 -68
- package/dist/components/cascader/cascader.js +54 -19
- package/dist/components/checkbox/checkbox.css +13 -2
- package/dist/components/checkbox/checkbox.d.ts +2 -0
- package/dist/components/checkbox/checkbox.js +320 -229
- package/dist/components/collapse/collapse-panels.d.ts +1 -1
- package/dist/components/collapse/collapse-panels.js +122 -113
- package/dist/components/collapse/collapse.js +98 -63
- package/dist/components/color-picker/color-picker.js +539 -441
- package/dist/components/color-picker/color.js +1 -1
- package/dist/components/context-menu/context-menu.d.ts +1 -1
- package/dist/components/context-menu/context-menu.js +108 -68
- package/dist/components/date-picker/calendar/calendar-grid.js +42 -39
- package/dist/components/date-picker/calendar/month-grid.d.ts +8 -1
- package/dist/components/date-picker/calendar/month-grid.js +79 -37
- package/dist/components/date-picker/calendar/time-panel.d.ts +2 -1
- package/dist/components/date-picker/calendar/time-panel.js +94 -89
- package/dist/components/date-picker/calendar/year-grid.d.ts +8 -1
- package/dist/components/date-picker/calendar/year-grid.js +66 -35
- package/dist/components/date-picker/date-picker.css +24 -1
- package/dist/components/date-picker/date-picker.js +99 -53
- package/dist/components/date-picker/presets.d.ts +2 -1
- package/dist/components/date-picker/presets.js +27 -24
- package/dist/components/date-picker/range-picker.js +308 -153
- package/dist/components/descriptions/descriptions.js +7 -3
- package/dist/components/divider/divider.css +1 -1
- package/dist/components/divider/divider.js +1 -1
- package/dist/components/drawer/drawer.js +201 -369
- package/dist/components/dropdown/dropdown.d.ts +1 -1
- package/dist/components/dropdown/dropdown.js +183 -279
- package/dist/components/empty/empty.js +57 -78
- package/dist/components/float-button/float-button.d.ts +1 -0
- package/dist/components/float-button/float-button.js +47 -30
- package/dist/components/form/field-control.d.ts +4 -2
- package/dist/components/form/field-control.js +17 -9
- package/dist/components/form/form-context.d.ts +8 -2
- package/dist/components/form/form-context.js +2 -1
- package/dist/components/form/form-item.js +85 -63
- package/dist/components/form/use-form.d.ts +2 -1
- package/dist/components/form/use-form.js +2 -1
- package/dist/components/form-field/form-field-view.d.ts +3 -1
- package/dist/components/form-field/form-field-view.js +194 -141
- package/dist/components/form-section/form-section.d.ts +1 -1
- package/dist/components/form-section/form-section.js +52 -45
- package/dist/components/image/image.js +585 -477
- package/dist/components/input/base-input.js +8 -9
- package/dist/components/input/input-shared.d.ts +5 -2
- package/dist/components/input/input-shared.js +42 -18
- package/dist/components/input/otp.js +236 -217
- package/dist/components/input/password.js +2 -1
- package/dist/components/input/search.js +8 -7
- package/dist/components/list/list-pagination.js +41 -36
- package/dist/components/list/list.js +141 -125
- package/dist/components/listy/listy.js +175 -106
- package/dist/components/masonry/masonry.js +108 -85
- package/dist/components/mentions/mentions.js +12 -3
- package/dist/components/menu/menu-render.d.ts +9 -3
- package/dist/components/menu/menu-render.js +99 -36
- package/dist/components/modal/confirm-dialog.js +10 -4
- package/dist/components/modal/confirm.js +3 -7
- package/dist/components/modal/index.js +9 -3
- package/dist/components/modal/modal.js +390 -365
- package/dist/components/pagination/pagination.js +105 -96
- package/dist/components/popconfirm/popconfirm.d.ts +1 -1
- package/dist/components/popconfirm/popconfirm.js +219 -168
- package/dist/components/popover/popover.js +330 -243
- package/dist/components/progress/progress.css +2 -2
- package/dist/components/progress/progress.js +232 -458
- package/dist/components/qr-code/qr-code.js +72 -66
- package/dist/components/radio/radio.css +15 -4
- package/dist/components/radio/radio.d.ts +2 -1
- package/dist/components/radio/radio.js +260 -198
- package/dist/components/rate/rate.js +173 -113
- package/dist/components/scroll-area/scroll-area.js +241 -211
- package/dist/components/segmented/segmented.js +73 -41
- package/dist/components/select/mobile-select.d.ts +2 -1
- package/dist/components/select/mobile-select.js +24 -13
- package/dist/components/select/select-searchable-list.d.ts +2 -1
- package/dist/components/select/select-searchable-list.js +2 -3
- package/dist/components/select/select.js +49 -25
- package/dist/components/select/use-select-selection.d.ts +1 -1
- package/dist/components/select/use-select-selection.js +7 -4
- package/dist/components/skeleton/skeleton.js +56 -48
- package/dist/components/slider/slider.js +87 -212
- package/dist/components/sonner/sonner.js +109 -93
- package/dist/components/spinner/spinner.js +147 -138
- package/dist/components/splitter/splitter.js +222 -159
- package/dist/components/statistic/statistic.js +7 -6
- package/dist/components/steps/steps.js +88 -81
- package/dist/components/steps/use-display-steps.js +1 -1
- package/dist/components/switch/switch.js +89 -89
- package/dist/components/table/table-filter.js +66 -56
- package/dist/components/table/table-icons.d.ts +2 -1
- package/dist/components/table/table-icons.js +11 -9
- package/dist/components/table/table-model.js +1 -1
- package/dist/components/table/table.js +107 -83
- package/dist/components/table/use-table-data.d.ts +6 -3
- package/dist/components/table/use-table-data.js +166 -130
- package/dist/components/tabs/tabs.css +1 -1
- package/dist/components/tabs/tabs.js +236 -179
- package/dist/components/tag/tag.d.ts +2 -2
- package/dist/components/tag/tag.js +111 -108
- package/dist/components/textarea/textarea.js +22 -17
- package/dist/components/time-picker/time-picker.js +5 -3
- package/dist/components/timeline/timeline.css +6 -1
- package/dist/components/timeline/timeline.js +21 -11
- package/dist/components/tooltip/tooltip.d.ts +2 -2
- package/dist/components/tooltip/tooltip.js +123 -233
- package/dist/components/tour/tour.css +4 -0
- package/dist/components/tour/tour.js +400 -331
- package/dist/components/transfer/transfer-list.js +29 -11
- package/dist/components/transfer/transfer-parts.js +1 -1
- package/dist/components/transfer/transfer-types.d.ts +1 -0
- package/dist/components/transfer/transfer.js +29 -14
- package/dist/components/tree/tree-keyboard.d.ts +1 -1
- package/dist/components/tree/tree-keyboard.js +5 -3
- package/dist/components/tree/tree.js +74 -59
- package/dist/components/tree-select/select-engine.d.ts +3 -2
- package/dist/components/tree-select/select-engine.js +18 -16
- package/dist/components/tree-select/tree-select.js +21 -5
- package/dist/components/upload/upload.css +8 -0
- package/dist/components/upload/upload.js +160 -72
- package/dist/components/watermark/watermark.js +36 -29
- package/dist/number-input/use-number-input.js +129 -90
- package/dist/number-input/validate.js +32 -5
- package/dist/provider/merge-locale.js +12 -9
- package/dist/provider/tao-provider.d.ts +3 -1
- package/dist/provider/tao-provider.js +123 -86
- package/package.json +1 -1
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
|
-
import { Fragment, forwardRef, useImperativeHandle, useRef, useState } from "react";
|
|
3
|
+
import { Fragment, forwardRef, useContext, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
4
4
|
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
5
5
|
import { cx } from "../../utils/semantic.js";
|
|
6
|
+
import { FormFieldChangeContext } from "../form/form-context.js";
|
|
6
7
|
import { BaseInput } from "./base-input.js";
|
|
7
8
|
const otp_OTP = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
8
|
-
const $ = c(
|
|
9
|
+
const $ = c(61);
|
|
9
10
|
let autoComplete;
|
|
10
11
|
let autoFocus;
|
|
11
12
|
let className;
|
|
@@ -80,6 +81,7 @@ const otp_OTP = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
80
81
|
const type = void 0 === t3 ? "text" : t3;
|
|
81
82
|
if (!Number.isInteger(length) || length < 1) throw new RangeError("Input.OTP length must be a positive integer");
|
|
82
83
|
const ctx = useTaoConfig();
|
|
84
|
+
const fieldChange = useContext(FormFieldChangeContext);
|
|
83
85
|
let t4;
|
|
84
86
|
if ($[22] !== formatter || $[23] !== length) {
|
|
85
87
|
t4 = (text)=>Array.from(formatter ? formatter(text) : text).slice(0, length);
|
|
@@ -89,242 +91,259 @@ const otp_OTP = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
89
91
|
} else t4 = $[24];
|
|
90
92
|
const format = t4;
|
|
91
93
|
let t5;
|
|
92
|
-
if ($[25] !==
|
|
93
|
-
t5 = ()
|
|
94
|
-
$[25] =
|
|
95
|
-
$[26] =
|
|
96
|
-
$[27] =
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const
|
|
94
|
+
if ($[25] !== format || $[26] !== props || $[27] !== value) {
|
|
95
|
+
t5 = "value" in props ? format(value ?? "").join("") : void 0;
|
|
96
|
+
$[25] = format;
|
|
97
|
+
$[26] = props;
|
|
98
|
+
$[27] = value;
|
|
99
|
+
$[28] = t5;
|
|
100
|
+
} else t5 = $[28];
|
|
101
|
+
const formattedValue = t5;
|
|
100
102
|
let t6;
|
|
101
|
-
if ($[
|
|
102
|
-
t6 =
|
|
103
|
-
$[
|
|
104
|
-
$[
|
|
105
|
-
$[
|
|
106
|
-
$[
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
if ($[29] !== defaultValue || $[30] !== format || $[31] !== props || $[32] !== value) {
|
|
104
|
+
t6 = ()=>format("value" in props ? value ?? "" : defaultValue);
|
|
105
|
+
$[29] = defaultValue;
|
|
106
|
+
$[30] = format;
|
|
107
|
+
$[31] = props;
|
|
108
|
+
$[32] = value;
|
|
109
|
+
$[33] = t6;
|
|
110
|
+
} else t6 = $[33];
|
|
111
|
+
const [innerValue, setInnerValue] = useState(t6);
|
|
109
112
|
let t7;
|
|
110
|
-
if ($[
|
|
111
|
-
t7 =
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
if ($[34] !== formattedValue || $[35] !== value) {
|
|
114
|
+
t7 = {
|
|
115
|
+
value,
|
|
116
|
+
formattedValue
|
|
117
|
+
};
|
|
118
|
+
$[34] = formattedValue;
|
|
119
|
+
$[35] = value;
|
|
120
|
+
$[36] = t7;
|
|
121
|
+
} else t7 = $[36];
|
|
122
|
+
const [previousValue, setPreviousValue] = useState(t7);
|
|
123
|
+
const [draft, setDraft] = useState(null);
|
|
124
|
+
if (previousValue.value !== value || previousValue.formattedValue !== formattedValue) {
|
|
125
|
+
setPreviousValue({
|
|
126
|
+
value,
|
|
127
|
+
formattedValue
|
|
128
|
+
});
|
|
129
|
+
setInnerValue(Array.from(formattedValue ?? ""));
|
|
130
|
+
setDraft(null);
|
|
131
|
+
}
|
|
132
|
+
const cells = innerValue.slice(0, length);
|
|
117
133
|
let t8;
|
|
118
|
-
if ($[
|
|
119
|
-
t8 =
|
|
134
|
+
if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
|
|
135
|
+
t8 = [];
|
|
136
|
+
$[37] = t8;
|
|
137
|
+
} else t8 = $[37];
|
|
138
|
+
const inputs = useRef(t8);
|
|
139
|
+
const root = useRef(null);
|
|
140
|
+
const composing = useRef(null);
|
|
141
|
+
let t10;
|
|
142
|
+
let t9;
|
|
143
|
+
if ($[38] !== length) {
|
|
144
|
+
t9 = ()=>{
|
|
145
|
+
if (null !== composing.current && composing.current >= length) {
|
|
146
|
+
composing.current = null;
|
|
147
|
+
setDraft(null);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
t10 = [
|
|
151
|
+
length
|
|
152
|
+
];
|
|
153
|
+
$[38] = length;
|
|
154
|
+
$[39] = t10;
|
|
155
|
+
$[40] = t9;
|
|
156
|
+
} else {
|
|
157
|
+
t10 = $[39];
|
|
158
|
+
t9 = $[40];
|
|
159
|
+
}
|
|
160
|
+
useEffect(t9, t10);
|
|
161
|
+
let t11;
|
|
162
|
+
if ($[41] !== customClassNames || $[42] !== props) {
|
|
163
|
+
t11 = "function" == typeof customClassNames ? customClassNames({
|
|
120
164
|
props
|
|
121
165
|
}) : customClassNames;
|
|
122
|
-
$[
|
|
123
|
-
$[
|
|
124
|
-
$[
|
|
125
|
-
} else
|
|
126
|
-
const classNames =
|
|
127
|
-
let
|
|
128
|
-
if ($[
|
|
129
|
-
|
|
166
|
+
$[41] = customClassNames;
|
|
167
|
+
$[42] = props;
|
|
168
|
+
$[43] = t11;
|
|
169
|
+
} else t11 = $[43];
|
|
170
|
+
const classNames = t11;
|
|
171
|
+
let t12;
|
|
172
|
+
if ($[44] !== customStyles || $[45] !== props) {
|
|
173
|
+
t12 = "function" == typeof customStyles ? customStyles({
|
|
130
174
|
props
|
|
131
175
|
}) : customStyles;
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
} else
|
|
136
|
-
const styles =
|
|
137
|
-
let
|
|
138
|
-
if ($[
|
|
139
|
-
|
|
176
|
+
$[44] = customStyles;
|
|
177
|
+
$[45] = props;
|
|
178
|
+
$[46] = t12;
|
|
179
|
+
} else t12 = $[46];
|
|
180
|
+
const styles = t12;
|
|
181
|
+
let t13;
|
|
182
|
+
if ($[47] === Symbol.for("react.memo_cache_sentinel")) {
|
|
183
|
+
t13 = (index)=>{
|
|
140
184
|
inputs.current[index]?.focus();
|
|
141
185
|
inputs.current[index]?.select();
|
|
142
186
|
};
|
|
143
|
-
$[
|
|
144
|
-
} else
|
|
145
|
-
const focus =
|
|
146
|
-
let
|
|
147
|
-
if ($[
|
|
148
|
-
|
|
187
|
+
$[47] = t13;
|
|
188
|
+
} else t13 = $[47];
|
|
189
|
+
const focus = t13;
|
|
190
|
+
let t14;
|
|
191
|
+
if ($[48] === Symbol.for("react.memo_cache_sentinel")) {
|
|
192
|
+
t14 = ()=>({
|
|
149
193
|
focus: ()=>focus(0),
|
|
150
194
|
blur: ()=>inputs.current.forEach(_temp),
|
|
151
195
|
nativeElement: root.current
|
|
152
196
|
});
|
|
153
|
-
$[
|
|
154
|
-
} else
|
|
155
|
-
useImperativeHandle(ref,
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
197
|
+
$[48] = t14;
|
|
198
|
+
} else t14 = $[48];
|
|
199
|
+
useImperativeHandle(ref, t14);
|
|
200
|
+
const update = (index_0, text_0)=>{
|
|
201
|
+
const chars = format(text_0);
|
|
202
|
+
const next = Array.from({
|
|
203
|
+
length
|
|
204
|
+
}, (_, i)=>cells[i] ?? "");
|
|
205
|
+
if (chars.length) chars.forEach((char, offset)=>{
|
|
206
|
+
if (index_0 + offset < length) next[index_0 + offset] = char;
|
|
207
|
+
});
|
|
208
|
+
else next[index_0] = "";
|
|
209
|
+
while(next.length && !next[next.length - 1])next.pop();
|
|
210
|
+
if (next.length !== cells.length || next.some((char_0, i_0)=>char_0 !== cells[i_0])) {
|
|
211
|
+
setInnerValue(next);
|
|
212
|
+
onInput?.([
|
|
213
|
+
...next
|
|
214
|
+
]);
|
|
215
|
+
if (next.length === length && next.every(Boolean)) onChange?.(next.join(""));
|
|
216
|
+
else if (value && fieldChange && onChange === fieldChange.onChange) {
|
|
217
|
+
setPreviousValue({
|
|
218
|
+
value: "",
|
|
219
|
+
formattedValue: format("").join("")
|
|
220
|
+
});
|
|
221
|
+
fieldChange.collect("");
|
|
172
222
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
$[50] = t15;
|
|
192
|
-
} else t15 = $[50];
|
|
193
|
-
const t16 = styles?.root;
|
|
194
|
-
let t17;
|
|
195
|
-
if ($[51] !== style || $[52] !== t16) {
|
|
196
|
-
t17 = {
|
|
197
|
-
...t16,
|
|
223
|
+
}
|
|
224
|
+
if (chars.length) focus(Math.min(index_0 + chars.length, length - 1));
|
|
225
|
+
};
|
|
226
|
+
const t15 = rest.role ?? "group";
|
|
227
|
+
const t16 = "";
|
|
228
|
+
const t17 = classNames?.root;
|
|
229
|
+
let t18;
|
|
230
|
+
if ($[49] !== className || $[50] !== t17) {
|
|
231
|
+
t18 = cx(t17, className);
|
|
232
|
+
$[49] = className;
|
|
233
|
+
$[50] = t17;
|
|
234
|
+
$[51] = t18;
|
|
235
|
+
} else t18 = $[51];
|
|
236
|
+
const t19 = styles?.root;
|
|
237
|
+
let t20;
|
|
238
|
+
if ($[52] !== style || $[53] !== t19) {
|
|
239
|
+
t20 = {
|
|
240
|
+
...t19,
|
|
198
241
|
...style
|
|
199
242
|
};
|
|
200
|
-
$[
|
|
201
|
-
$[
|
|
202
|
-
$[
|
|
203
|
-
} else
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
event_3.preventDefault();
|
|
268
|
-
update(index_1, "");
|
|
269
|
-
}
|
|
243
|
+
$[52] = style;
|
|
244
|
+
$[53] = t19;
|
|
245
|
+
$[54] = t20;
|
|
246
|
+
} else t20 = $[54];
|
|
247
|
+
const t21 = Array.from({
|
|
248
|
+
length
|
|
249
|
+
}, (__0, index_1)=>/*#__PURE__*/ jsxs(Fragment, {
|
|
250
|
+
children: [
|
|
251
|
+
/*#__PURE__*/ jsxs("div", {
|
|
252
|
+
"data-tao-otp-cell": "",
|
|
253
|
+
"data-tao-otp-masked": "string" == typeof mask && cells[index_1] ? "" : void 0,
|
|
254
|
+
children: [
|
|
255
|
+
/*#__PURE__*/ jsx(BaseInput, {
|
|
256
|
+
ref: (node)=>{
|
|
257
|
+
inputs.current[index_1] = node;
|
|
258
|
+
},
|
|
259
|
+
value: draft?.index === index_1 ? draft.value : cells[index_1] ?? "",
|
|
260
|
+
autoFocus: autoFocus && 0 === index_1,
|
|
261
|
+
type: true === mask ? "password" : type,
|
|
262
|
+
inputMode: inputMode,
|
|
263
|
+
autoComplete: autoComplete,
|
|
264
|
+
disabled: disabled,
|
|
265
|
+
status: status,
|
|
266
|
+
size: size,
|
|
267
|
+
variant: variant,
|
|
268
|
+
"aria-label": ctx.locale.otpLabel?.(index_1 + 1, length) ?? `Character ${index_1 + 1} of ${length}`,
|
|
269
|
+
"aria-describedby": rest["aria-describedby"],
|
|
270
|
+
"aria-invalid": rest["aria-invalid"],
|
|
271
|
+
classNames: {
|
|
272
|
+
input: classNames?.input
|
|
273
|
+
},
|
|
274
|
+
styles: {
|
|
275
|
+
input: styles?.input
|
|
276
|
+
},
|
|
277
|
+
onFocus: _temp2,
|
|
278
|
+
onChange: (event_0)=>{
|
|
279
|
+
if (composing.current === index_1) setDraft({
|
|
280
|
+
index: index_1,
|
|
281
|
+
value: event_0.target.value
|
|
282
|
+
});
|
|
283
|
+
else update(index_1, event_0.target.value);
|
|
284
|
+
},
|
|
285
|
+
onCompositionStart: ()=>{
|
|
286
|
+
composing.current = index_1;
|
|
287
|
+
},
|
|
288
|
+
onCompositionEnd: (event_1)=>{
|
|
289
|
+
composing.current = null;
|
|
290
|
+
setDraft(null);
|
|
291
|
+
update(index_1, event_1.currentTarget.value);
|
|
292
|
+
},
|
|
293
|
+
onPaste: (event_2)=>{
|
|
294
|
+
event_2.preventDefault();
|
|
295
|
+
update(index_1, event_2.clipboardData.getData("text"));
|
|
296
|
+
},
|
|
297
|
+
onKeyDown: (event_3)=>{
|
|
298
|
+
if (composing.current === index_1 || event_3.nativeEvent.isComposing || 229 === event_3.keyCode) return;
|
|
299
|
+
if ("ArrowLeft" === event_3.key || "ArrowRight" === event_3.key) {
|
|
300
|
+
event_3.preventDefault();
|
|
301
|
+
const direction = "rtl" === getComputedStyle(root.current).direction ? -1 : 1;
|
|
302
|
+
focus(Math.min(length - 1, Math.max(0, index_1 + ("ArrowRight" === event_3.key ? direction : -direction))));
|
|
303
|
+
} else if ("Backspace" === event_3.key && !cells[index_1] && index_1 > 0) {
|
|
304
|
+
event_3.preventDefault();
|
|
305
|
+
update(index_1 - 1, "");
|
|
306
|
+
focus(index_1 - 1);
|
|
307
|
+
} else if ("Delete" === event_3.key) {
|
|
308
|
+
event_3.preventDefault();
|
|
309
|
+
update(index_1, "");
|
|
270
310
|
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
$[58] = classNames?.separator;
|
|
292
|
-
$[59] = ctx;
|
|
293
|
-
$[60] = disabled;
|
|
294
|
-
$[61] = draft;
|
|
295
|
-
$[62] = inputMode;
|
|
296
|
-
$[63] = length;
|
|
297
|
-
$[64] = mask;
|
|
298
|
-
$[65] = rest;
|
|
299
|
-
$[66] = separator;
|
|
300
|
-
$[67] = size;
|
|
301
|
-
$[68] = status;
|
|
302
|
-
$[69] = styles?.input;
|
|
303
|
-
$[70] = styles?.separator;
|
|
304
|
-
$[71] = type;
|
|
305
|
-
$[72] = update;
|
|
306
|
-
$[73] = variant;
|
|
307
|
-
$[74] = t18;
|
|
308
|
-
} else t18 = $[74];
|
|
309
|
-
let t19;
|
|
310
|
-
if ($[75] !== rest || $[76] !== t13 || $[77] !== t15 || $[78] !== t17 || $[79] !== t18) {
|
|
311
|
-
t19 = /*#__PURE__*/ jsx("div", {
|
|
311
|
+
}
|
|
312
|
+
}),
|
|
313
|
+
"string" == typeof mask && cells[index_1] && /*#__PURE__*/ jsx("span", {
|
|
314
|
+
"data-tao-otp-mask": "",
|
|
315
|
+
"aria-hidden": "true",
|
|
316
|
+
children: mask
|
|
317
|
+
})
|
|
318
|
+
]
|
|
319
|
+
}),
|
|
320
|
+
index_1 < length - 1 && null != separator && /*#__PURE__*/ jsx("span", {
|
|
321
|
+
"data-tao-otp-separator": "",
|
|
322
|
+
className: classNames?.separator,
|
|
323
|
+
style: styles?.separator,
|
|
324
|
+
children: "function" == typeof separator ? separator(index_1) : separator
|
|
325
|
+
})
|
|
326
|
+
]
|
|
327
|
+
}, `otp-${index_1}`));
|
|
328
|
+
let t22;
|
|
329
|
+
if ($[55] !== rest || $[56] !== t15 || $[57] !== t18 || $[58] !== t20 || $[59] !== t21) {
|
|
330
|
+
t22 = /*#__PURE__*/ jsx("div", {
|
|
312
331
|
...rest,
|
|
313
332
|
ref: root,
|
|
314
|
-
role:
|
|
315
|
-
"data-tao-input-otp":
|
|
316
|
-
className:
|
|
317
|
-
style:
|
|
318
|
-
children:
|
|
333
|
+
role: t15,
|
|
334
|
+
"data-tao-input-otp": t16,
|
|
335
|
+
className: t18,
|
|
336
|
+
style: t20,
|
|
337
|
+
children: t21
|
|
319
338
|
});
|
|
320
|
-
$[
|
|
321
|
-
$[
|
|
322
|
-
$[
|
|
323
|
-
$[
|
|
324
|
-
$[
|
|
325
|
-
$[
|
|
326
|
-
} else
|
|
327
|
-
return
|
|
339
|
+
$[55] = rest;
|
|
340
|
+
$[56] = t15;
|
|
341
|
+
$[57] = t18;
|
|
342
|
+
$[58] = t20;
|
|
343
|
+
$[59] = t21;
|
|
344
|
+
$[60] = t22;
|
|
345
|
+
} else t22 = $[60];
|
|
346
|
+
return t22;
|
|
328
347
|
});
|
|
329
348
|
function _temp(input) {
|
|
330
349
|
input?.blur();
|
|
@@ -28,6 +28,7 @@ const password_Password = /*#__PURE__*/ forwardRef(function(t0, ref) {
|
|
|
28
28
|
const visibilityToggle = void 0 === t1 ? true : t1;
|
|
29
29
|
const ctx = useTaoConfig();
|
|
30
30
|
const [innerVisible, setVisible] = useState(false);
|
|
31
|
+
if (false === visibilityToggle && innerVisible) setVisible(false);
|
|
31
32
|
let t2;
|
|
32
33
|
if ($[6] !== visibilityToggle) {
|
|
33
34
|
t2 = "object" == typeof visibilityToggle ? visibilityToggle : {};
|
|
@@ -35,7 +36,7 @@ const password_Password = /*#__PURE__*/ forwardRef(function(t0, ref) {
|
|
|
35
36
|
$[7] = t2;
|
|
36
37
|
} else t2 = $[7];
|
|
37
38
|
const config = t2;
|
|
38
|
-
const visible = config.visible ?? innerVisible;
|
|
39
|
+
const visible = false !== visibilityToggle && (config.visible ?? innerVisible);
|
|
39
40
|
const resolvedDisabled = disabled ?? ctx.disabled;
|
|
40
41
|
const t3 = visible ? "text" : "password";
|
|
41
42
|
let t4;
|
|
@@ -17,22 +17,23 @@ const search_Search = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
17
17
|
const styles = 'function' == typeof customStyles ? customStyles({
|
|
18
18
|
props
|
|
19
19
|
}) : customStyles;
|
|
20
|
+
const customButton = /*#__PURE__*/ isValidElement(enterButton) && ('button' === enterButton.type || enterButton.type === Button);
|
|
21
|
+
const isLoading = loading || customButton && enterButton.type === Button && enterButton.props.loading;
|
|
20
22
|
const search = (event)=>{
|
|
21
|
-
if (!disabled && !
|
|
23
|
+
if (!disabled && !isLoading && !event.defaultPrevented) onSearch?.(inputRef.current.value, event, {
|
|
22
24
|
source: 'input'
|
|
23
25
|
});
|
|
24
26
|
};
|
|
25
27
|
const buttonProps = {
|
|
26
28
|
type: 'button',
|
|
27
|
-
disabled: disabled ||
|
|
28
|
-
'aria-busy':
|
|
29
|
+
disabled: disabled || isLoading,
|
|
30
|
+
'aria-busy': isLoading || void 0,
|
|
29
31
|
'aria-label': ctx.locale.search ?? 'Search',
|
|
30
32
|
className: classNames?.button,
|
|
31
33
|
style: styles?.button,
|
|
32
34
|
onMouseDown: (event_0)=>event_0.preventDefault(),
|
|
33
35
|
onClick: search
|
|
34
36
|
};
|
|
35
|
-
const customButton = /*#__PURE__*/ isValidElement(enterButton) && ('button' === enterButton.type || enterButton.type === Button);
|
|
36
37
|
const button = customButton ? /*#__PURE__*/ cloneElement(enterButton, {
|
|
37
38
|
...buttonProps,
|
|
38
39
|
className: cx(enterButton.props.className, classNames?.button),
|
|
@@ -43,7 +44,7 @@ const search_Search = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
43
44
|
'aria-label': enterButton.props['aria-label'] ?? buttonProps['aria-label'],
|
|
44
45
|
disabled: buttonProps.disabled || enterButton.props.disabled,
|
|
45
46
|
...enterButton.type === Button ? {
|
|
46
|
-
loading,
|
|
47
|
+
loading: isLoading,
|
|
47
48
|
size: props.size ?? enterButton.props.size
|
|
48
49
|
} : {},
|
|
49
50
|
onMouseDown: (event_1)=>{
|
|
@@ -56,7 +57,7 @@ const search_Search = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
56
57
|
}
|
|
57
58
|
}) : /*#__PURE__*/ jsx(Button, {
|
|
58
59
|
...buttonProps,
|
|
59
|
-
loading:
|
|
60
|
+
loading: isLoading,
|
|
60
61
|
size: props.size,
|
|
61
62
|
variant: enterButton ? 'primary' : 'secondary',
|
|
62
63
|
children: true !== enterButton && enterButton ? enterButton : searchIcon ?? /*#__PURE__*/ jsx(SearchIcon, {})
|
|
@@ -82,7 +83,7 @@ const search_Search = /*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
82
83
|
},
|
|
83
84
|
onChange: (event_3)=>{
|
|
84
85
|
onChange?.(event_3);
|
|
85
|
-
if ('click' === event_3.type && !disabled && !
|
|
86
|
+
if ('click' === event_3.type && !event_3.defaultPrevented && !disabled && !isLoading) onSearch?.('', event_3, {
|
|
86
87
|
source: 'clear'
|
|
87
88
|
});
|
|
88
89
|
},
|