@rockshin/tao-ui 0.0.44 → 0.0.46
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 +9 -1
- package/component-manifest.json +38 -4
- package/dist/components/alert/alert.js +20 -17
- package/dist/components/auto-complete/auto-complete.js +12 -3
- package/dist/components/avatar/avatar.js +2 -1
- package/dist/components/breadcrumb/breadcrumb.css +4 -0
- package/dist/components/breadcrumb/breadcrumb.js +82 -77
- package/dist/components/calendar/calendar.d.ts +1 -1
- package/dist/components/calendar/calendar.js +51 -33
- package/dist/components/card/card-tabs.js +204 -182
- package/dist/components/card/card.js +1 -1
- package/dist/components/carousel/carousel.js +11 -5
- package/dist/components/cascader/cascader.js +16 -4
- package/dist/components/collapse/collapse.css +8 -0
- package/dist/components/color-picker/color-picker.js +273 -269
- package/dist/components/context-menu/context-menu.d.ts +2 -1
- package/dist/components/context-menu/context-menu.js +57 -44
- package/dist/components/date-picker/calendar/calendar-grid.js +13 -6
- package/dist/components/date-picker/calendar/use-calendar.d.ts +2 -2
- package/dist/components/date-picker/calendar/use-calendar.js +2 -3
- package/dist/components/date-picker/date-localization.d.ts +3 -0
- package/dist/components/date-picker/date-localization.js +76 -0
- package/dist/components/date-picker/date-picker.css +4 -0
- package/dist/components/date-picker/date-picker.d.ts +1 -0
- package/dist/components/date-picker/date-picker.js +48 -30
- package/dist/components/date-picker/range-picker.d.ts +1 -0
- package/dist/components/date-picker/range-picker.js +41 -23
- package/dist/components/drawer/drawer.d.ts +2 -1
- package/dist/components/drawer/drawer.js +32 -20
- package/dist/components/dropdown/dropdown.d.ts +1 -0
- package/dist/components/dropdown/dropdown.js +160 -143
- package/dist/components/float-button/float-button.js +3 -2
- package/dist/components/form/form.js +88 -103
- package/dist/components/image/image.js +202 -137
- package/dist/components/list/list-pagination.js +148 -147
- package/dist/components/mentions/mentions.js +6 -2
- package/dist/components/modal/confirm-dialog.js +4 -2
- package/dist/components/modal/modal.d.ts +2 -1
- package/dist/components/modal/modal.js +387 -375
- package/dist/components/pagination/pagination.css +4 -0
- package/dist/components/pagination/pagination.js +115 -110
- package/dist/components/popconfirm/popconfirm.js +109 -107
- package/dist/components/popover/popover.d.ts +2 -1
- package/dist/components/popover/popover.js +185 -176
- package/dist/components/qr-code/qr-code.js +22 -21
- package/dist/components/rate/rate.js +114 -88
- package/dist/components/scroll-area/scroll-area.js +132 -120
- package/dist/components/segmented/segmented.js +52 -29
- package/dist/components/select/mobile-select.d.ts +3 -2
- package/dist/components/select/mobile-select.js +54 -48
- package/dist/components/select/select-types.d.ts +1 -0
- package/dist/components/select/select.js +19 -6
- package/dist/components/slider/slider.js +136 -133
- package/dist/components/sonner/sonner.js +10 -10
- package/dist/components/spinner/spinner.js +1 -1
- package/dist/components/splitter/splitter.css +4 -0
- package/dist/components/splitter/splitter.js +29 -24
- package/dist/components/statistic/statistic.d.ts +2 -0
- package/dist/components/statistic/statistic.js +203 -187
- package/dist/components/table/table-filter.js +61 -52
- package/dist/components/table/table-icons.js +3 -1
- package/dist/components/table/table.css +29 -11
- package/dist/components/table/table.d.ts +1 -1
- package/dist/components/table/table.js +384 -547
- package/dist/components/tabs/tabs.js +3 -2
- package/dist/components/tag/tag.js +22 -19
- package/dist/components/time-picker/time-picker.d.ts +0 -1
- package/dist/components/time-picker/time-picker.js +160 -103
- package/dist/components/tooltip/tooltip.d.ts +2 -1
- package/dist/components/tooltip/tooltip.js +82 -71
- package/dist/components/transfer/transfer-list.js +224 -488
- package/dist/components/transfer/transfer-parts.js +14 -4
- package/dist/components/transfer/transfer-types.d.ts +1 -0
- package/dist/components/transfer/transfer.js +23 -20
- package/dist/components/tree/tree-keyboard.d.ts +6 -0
- package/dist/components/tree/tree-keyboard.js +27 -0
- package/dist/components/tree/tree.js +14 -3
- package/dist/components/tree-select/select-engine.d.ts +2 -1
- package/dist/components/tree-select/select-engine.js +23 -15
- package/dist/components/tree-select/tree-select.js +20 -10
- package/dist/components/upload/upload.js +30 -26
- package/dist/docs/component-docs.d.ts +13 -2
- package/dist/docs/components/headless-input-number.doc.d.ts +5 -0
- package/dist/docs/components/headless-input-number.doc.js +7 -0
- package/dist/docs/components/input-number.doc.d.ts +5 -0
- package/dist/docs/components/input-number.doc.js +7 -0
- package/dist/docs/components/statistic.doc.d.ts +5 -0
- package/dist/docs/components/statistic.doc.js +7 -0
- package/dist/docs/components/tao-provider.doc.d.ts +8 -2
- package/dist/docs/components/tao-provider.doc.js +16 -3
- package/dist/docs/components/tooltip.doc.d.ts +2 -2
- package/dist/entries/provider.d.ts +2 -1
- package/dist/entries/provider.js +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/locales/ar-EG.d.ts +3 -0
- package/dist/locales/ar-EG.js +199 -0
- package/dist/locales/create-locale.d.ts +41 -0
- package/dist/locales/create-locale.js +88 -0
- package/dist/locales/de-DE.d.ts +3 -0
- package/dist/locales/de-DE.js +195 -0
- package/dist/locales/en-US.d.ts +2 -0
- package/dist/locales/en-US.js +194 -0
- package/dist/locales/es-ES.d.ts +3 -0
- package/dist/locales/es-ES.js +195 -0
- package/dist/locales/fr-FR.d.ts +3 -0
- package/dist/locales/fr-FR.js +195 -0
- package/dist/locales/hi-IN.d.ts +3 -0
- package/dist/locales/hi-IN.js +194 -0
- package/dist/locales/id-ID.d.ts +3 -0
- package/dist/locales/id-ID.js +194 -0
- package/dist/locales/index.d.ts +18 -0
- package/dist/locales/index.js +17 -0
- package/dist/locales/it-IT.d.ts +3 -0
- package/dist/locales/it-IT.js +195 -0
- package/dist/locales/ja-JP.d.ts +3 -0
- package/dist/locales/ja-JP.js +194 -0
- package/dist/locales/ko-KR.d.ts +3 -0
- package/dist/locales/ko-KR.js +194 -0
- package/dist/locales/pt-BR.d.ts +3 -0
- package/dist/locales/pt-BR.js +195 -0
- package/dist/locales/ru-RU.d.ts +3 -0
- package/dist/locales/ru-RU.js +197 -0
- package/dist/locales/th-TH.d.ts +3 -0
- package/dist/locales/th-TH.js +194 -0
- package/dist/locales/tr-TR.d.ts +3 -0
- package/dist/locales/tr-TR.js +194 -0
- package/dist/locales/types.d.ts +176 -0
- package/dist/locales/types.js +0 -0
- package/dist/locales/vi-VN.d.ts +3 -0
- package/dist/locales/vi-VN.js +194 -0
- package/dist/locales/zh-CN.d.ts +3 -0
- package/dist/locales/zh-CN.js +194 -0
- package/dist/locales/zh-TW.d.ts +3 -0
- package/dist/locales/zh-TW.js +194 -0
- package/dist/number-input/format.d.ts +4 -3
- package/dist/number-input/format.js +9 -7
- package/dist/number-input/locale.d.ts +19 -0
- package/dist/number-input/locale.js +44 -0
- package/dist/number-input/number-input.js +1 -0
- package/dist/number-input/use-number-input.d.ts +2 -0
- package/dist/number-input/use-number-input.js +180 -176
- package/dist/provider/locale.d.ts +3 -65
- package/dist/provider/locale.js +2 -146
- package/dist/provider/merge-locale.d.ts +8 -0
- package/dist/provider/merge-locale.js +53 -0
- package/dist/provider/tao-provider.d.ts +16 -5
- package/dist/provider/tao-provider.js +200 -92
- package/dist/utils/scroll-left.d.ts +3 -0
- package/dist/utils/scroll-left.js +7 -0
- package/llms.txt +3 -3
- package/package.json +5 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
3
|
import { useEffect, useRef, useState } from "react";
|
|
4
|
+
import { useTaoConfig, useTaoDirection } from "../../provider/tao-provider.js";
|
|
5
|
+
import { getScrollLeft, setScrollLeft } from "../../utils/scroll-left.js";
|
|
4
6
|
import { cx } from "../../utils/semantic.js";
|
|
5
7
|
import "./scroll-area.css";
|
|
6
8
|
function ScrollArea(t0) {
|
|
7
|
-
const $ = c(
|
|
9
|
+
const $ = c(82);
|
|
8
10
|
const { children, type: t1, direction: t2, maxHeight, maxWidth, scrollbarSize: t3, scrollbarOffset: t4, scrollShadow: t5, onScroll: onScrollProp, onScrollEnd, scrollEndThreshold: t6, className, style, classNames, styles } = t0;
|
|
9
11
|
const type = void 0 === t1 ? "hover" : t1;
|
|
10
12
|
const direction = void 0 === t2 ? "vertical" : t2;
|
|
@@ -30,12 +32,15 @@ function ScrollArea(t0) {
|
|
|
30
32
|
$[0] = t7;
|
|
31
33
|
} else t7 = $[0];
|
|
32
34
|
const [scrollState, setScrollState] = useState(t7);
|
|
35
|
+
const [textDirection, directionRef] = useTaoDirection(void 0, "self");
|
|
36
|
+
const { locale } = useTaoConfig();
|
|
33
37
|
let t8;
|
|
34
|
-
if ($[1]
|
|
38
|
+
if ($[1] !== textDirection) {
|
|
35
39
|
t8 = ()=>{
|
|
36
40
|
const el = viewportRef.current;
|
|
37
41
|
if (!el) return;
|
|
38
|
-
const { scrollTop,
|
|
42
|
+
const { scrollTop, scrollHeight, scrollWidth, clientHeight, clientWidth } = el;
|
|
43
|
+
const scrollLeft = getScrollLeft(el, getComputedStyle(el).direction || textDirection);
|
|
39
44
|
const hasV = scrollHeight > clientHeight + 1;
|
|
40
45
|
const hasH = scrollWidth > clientWidth + 1;
|
|
41
46
|
setScrollState({
|
|
@@ -51,12 +56,13 @@ function ScrollArea(t0) {
|
|
|
51
56
|
atRight: scrollLeft + clientWidth >= scrollWidth - 1
|
|
52
57
|
});
|
|
53
58
|
};
|
|
54
|
-
$[1] =
|
|
55
|
-
|
|
59
|
+
$[1] = textDirection;
|
|
60
|
+
$[2] = t8;
|
|
61
|
+
} else t8 = $[2];
|
|
56
62
|
const updateScrollState = t8;
|
|
57
63
|
let t10;
|
|
58
64
|
let t9;
|
|
59
|
-
if ($[
|
|
65
|
+
if ($[3] !== updateScrollState) {
|
|
60
66
|
t9 = ()=>{
|
|
61
67
|
const el_0 = viewportRef.current;
|
|
62
68
|
if (!el_0) return;
|
|
@@ -69,16 +75,17 @@ function ScrollArea(t0) {
|
|
|
69
75
|
t10 = [
|
|
70
76
|
updateScrollState
|
|
71
77
|
];
|
|
72
|
-
$[
|
|
73
|
-
$[
|
|
78
|
+
$[3] = updateScrollState;
|
|
79
|
+
$[4] = t10;
|
|
80
|
+
$[5] = t9;
|
|
74
81
|
} else {
|
|
75
|
-
t10 = $[
|
|
76
|
-
t9 = $[
|
|
82
|
+
t10 = $[4];
|
|
83
|
+
t9 = $[5];
|
|
77
84
|
}
|
|
78
85
|
useEffect(t9, t10);
|
|
79
86
|
const firedScrollEnd = useRef(false);
|
|
80
87
|
let t11;
|
|
81
|
-
if ($[
|
|
88
|
+
if ($[6] !== onScrollEnd || $[7] !== onScrollProp || $[8] !== scrollEndThreshold || $[9] !== updateScrollState) {
|
|
82
89
|
t11 = (e)=>{
|
|
83
90
|
updateScrollState();
|
|
84
91
|
onScrollProp?.(e);
|
|
@@ -92,27 +99,28 @@ function ScrollArea(t0) {
|
|
|
92
99
|
} else if (!nearBottom) firedScrollEnd.current = false;
|
|
93
100
|
}
|
|
94
101
|
};
|
|
95
|
-
$[
|
|
96
|
-
$[
|
|
97
|
-
$[
|
|
98
|
-
$[
|
|
99
|
-
|
|
102
|
+
$[6] = onScrollEnd;
|
|
103
|
+
$[7] = onScrollProp;
|
|
104
|
+
$[8] = scrollEndThreshold;
|
|
105
|
+
$[9] = updateScrollState;
|
|
106
|
+
$[10] = t11;
|
|
107
|
+
} else t11 = $[10];
|
|
100
108
|
const handleScroll = t11;
|
|
101
109
|
const dragCleanup = useRef(null);
|
|
102
110
|
let t12;
|
|
103
111
|
let t13;
|
|
104
|
-
if ($[
|
|
112
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
105
113
|
t12 = ()=>()=>dragCleanup.current?.();
|
|
106
114
|
t13 = [];
|
|
107
|
-
$[
|
|
108
|
-
$[
|
|
115
|
+
$[11] = t12;
|
|
116
|
+
$[12] = t13;
|
|
109
117
|
} else {
|
|
110
|
-
t12 = $[
|
|
111
|
-
t13 = $[
|
|
118
|
+
t12 = $[11];
|
|
119
|
+
t13 = $[12];
|
|
112
120
|
}
|
|
113
121
|
useEffect(t12, t13);
|
|
114
122
|
let t14;
|
|
115
|
-
if ($[
|
|
123
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
116
124
|
t14 = (axis, e_0)=>{
|
|
117
125
|
e_0.preventDefault();
|
|
118
126
|
e_0.stopPropagation();
|
|
@@ -123,7 +131,7 @@ function ScrollArea(t0) {
|
|
|
123
131
|
const track = thumb.parentElement;
|
|
124
132
|
if (!track) return;
|
|
125
133
|
const pos = "y" === axis ? e_0.clientY : e_0.clientX;
|
|
126
|
-
const scroll = "y" === axis ? el_2.scrollTop : el_2
|
|
134
|
+
const scroll = "y" === axis ? el_2.scrollTop : getScrollLeft(el_2);
|
|
127
135
|
const pointerId = e_0.pointerId;
|
|
128
136
|
const handleMove = (ev)=>{
|
|
129
137
|
if (ev.pointerId !== pointerId || !viewportRef.current) return;
|
|
@@ -136,7 +144,7 @@ function ScrollArea(t0) {
|
|
|
136
144
|
if (travel <= 0 || maxScroll <= 0) return;
|
|
137
145
|
const nextScroll = Math.max(0, Math.min(maxScroll, scroll + delta / travel * maxScroll));
|
|
138
146
|
if ("y" === axis) vp.scrollTop = nextScroll;
|
|
139
|
-
else vp
|
|
147
|
+
else setScrollLeft(vp, nextScroll);
|
|
140
148
|
};
|
|
141
149
|
const cleanup = ()=>{
|
|
142
150
|
document.removeEventListener("pointermove", handleMove);
|
|
@@ -152,11 +160,11 @@ function ScrollArea(t0) {
|
|
|
152
160
|
document.addEventListener("pointerup", handleEnd);
|
|
153
161
|
document.addEventListener("pointercancel", handleEnd);
|
|
154
162
|
};
|
|
155
|
-
$[
|
|
156
|
-
} else t14 = $[
|
|
163
|
+
$[13] = t14;
|
|
164
|
+
} else t14 = $[13];
|
|
157
165
|
const handleThumbPointerDown = t14;
|
|
158
166
|
let t15;
|
|
159
|
-
if ($[
|
|
167
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
160
168
|
t15 = (axis_0, e_1)=>{
|
|
161
169
|
const el_3 = viewportRef.current;
|
|
162
170
|
if (!el_3) return;
|
|
@@ -164,89 +172,89 @@ function ScrollArea(t0) {
|
|
|
164
172
|
const rect = e_1.currentTarget.getBoundingClientRect();
|
|
165
173
|
const clickPos = "y" === axis_0 ? (e_1.clientY - rect.top) / rect.height : (e_1.clientX - rect.left) / rect.width;
|
|
166
174
|
if ("y" === axis_0) el_3.scrollTop = clickPos * (el_3.scrollHeight - el_3.clientHeight);
|
|
167
|
-
else el_3
|
|
175
|
+
else setScrollLeft(el_3, clickPos * (el_3.scrollWidth - el_3.clientWidth));
|
|
168
176
|
};
|
|
169
|
-
$[
|
|
170
|
-
} else t15 = $[
|
|
177
|
+
$[14] = t15;
|
|
178
|
+
} else t15 = $[14];
|
|
171
179
|
const handleTrackClick = t15;
|
|
172
180
|
const showVertical = "vertical" === direction || "both" === direction;
|
|
173
181
|
const showHorizontal = "horizontal" === direction || "both" === direction;
|
|
174
182
|
const t16 = maxHeight ?? void 0;
|
|
175
183
|
const t17 = maxWidth ?? void 0;
|
|
176
184
|
let t18;
|
|
177
|
-
if ($[
|
|
185
|
+
if ($[15] !== t16 || $[16] !== t17) {
|
|
178
186
|
t18 = {
|
|
179
187
|
maxHeight: t16,
|
|
180
188
|
maxWidth: t17
|
|
181
189
|
};
|
|
182
|
-
$[
|
|
183
|
-
$[
|
|
184
|
-
$[
|
|
185
|
-
} else t18 = $[
|
|
190
|
+
$[15] = t16;
|
|
191
|
+
$[16] = t17;
|
|
192
|
+
$[17] = t18;
|
|
193
|
+
} else t18 = $[17];
|
|
186
194
|
const rootStyle = t18;
|
|
187
195
|
const t19 = showVertical ? "scroll" : "hidden";
|
|
188
196
|
const t20 = showHorizontal ? "scroll" : "hidden";
|
|
189
197
|
const t21 = styles?.viewport;
|
|
190
198
|
let t22;
|
|
191
|
-
if ($[
|
|
199
|
+
if ($[18] !== t19 || $[19] !== t20 || $[20] !== t21) {
|
|
192
200
|
t22 = {
|
|
193
201
|
overflowY: t19,
|
|
194
202
|
overflowX: t20,
|
|
195
203
|
...t21
|
|
196
204
|
};
|
|
197
|
-
$[
|
|
198
|
-
$[
|
|
199
|
-
$[
|
|
200
|
-
$[
|
|
201
|
-
} else t22 = $[
|
|
205
|
+
$[18] = t19;
|
|
206
|
+
$[19] = t20;
|
|
207
|
+
$[20] = t21;
|
|
208
|
+
$[21] = t22;
|
|
209
|
+
} else t22 = $[21];
|
|
202
210
|
const viewportStyle = t22;
|
|
203
211
|
const t23 = `${scrollbarSize}px`;
|
|
204
212
|
const t24 = `${scrollbarOffset}px`;
|
|
205
213
|
let t25;
|
|
206
|
-
if ($[
|
|
214
|
+
if ($[22] !== t23 || $[23] !== t24) {
|
|
207
215
|
t25 = {
|
|
208
216
|
"--tao-scrollbar-size": t23,
|
|
209
217
|
"--tao-scrollbar-offset": t24
|
|
210
218
|
};
|
|
211
|
-
$[
|
|
212
|
-
$[
|
|
213
|
-
$[
|
|
214
|
-
} else t25 = $[
|
|
219
|
+
$[22] = t23;
|
|
220
|
+
$[23] = t24;
|
|
221
|
+
$[24] = t25;
|
|
222
|
+
} else t25 = $[24];
|
|
215
223
|
const scrollbarVars = t25;
|
|
216
224
|
const t26 = scrollState.hasVertical || void 0;
|
|
217
225
|
const t27 = scrollState.hasHorizontal || void 0;
|
|
218
226
|
const t28 = classNames?.root;
|
|
219
227
|
let t29;
|
|
220
|
-
if ($[
|
|
228
|
+
if ($[25] !== className || $[26] !== t28) {
|
|
221
229
|
t29 = cx(t28, className);
|
|
222
|
-
$[
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
} else t29 = $[
|
|
230
|
+
$[25] = className;
|
|
231
|
+
$[26] = t28;
|
|
232
|
+
$[27] = t29;
|
|
233
|
+
} else t29 = $[27];
|
|
226
234
|
const t30 = styles?.root;
|
|
227
235
|
let t31;
|
|
228
|
-
if ($[
|
|
236
|
+
if ($[28] !== rootStyle || $[29] !== scrollbarVars || $[30] !== style || $[31] !== t30) {
|
|
229
237
|
t31 = {
|
|
230
238
|
...rootStyle,
|
|
231
239
|
...scrollbarVars,
|
|
232
240
|
...t30,
|
|
233
241
|
...style
|
|
234
242
|
};
|
|
235
|
-
$[
|
|
236
|
-
$[
|
|
237
|
-
$[
|
|
238
|
-
$[
|
|
239
|
-
$[
|
|
240
|
-
} else t31 = $[
|
|
243
|
+
$[28] = rootStyle;
|
|
244
|
+
$[29] = scrollbarVars;
|
|
245
|
+
$[30] = style;
|
|
246
|
+
$[31] = t30;
|
|
247
|
+
$[32] = t31;
|
|
248
|
+
} else t31 = $[32];
|
|
241
249
|
const t32 = classNames?.viewport;
|
|
242
250
|
let t33;
|
|
243
|
-
if ($[
|
|
251
|
+
if ($[33] !== t32) {
|
|
244
252
|
t33 = cx(t32);
|
|
245
|
-
$[
|
|
246
|
-
$[
|
|
247
|
-
} else t33 = $[
|
|
253
|
+
$[33] = t32;
|
|
254
|
+
$[34] = t33;
|
|
255
|
+
} else t33 = $[34];
|
|
248
256
|
let t34;
|
|
249
|
-
if ($[
|
|
257
|
+
if ($[35] !== children || $[36] !== handleScroll || $[37] !== t33 || $[38] !== viewportStyle) {
|
|
250
258
|
t34 = /*#__PURE__*/ jsx("div", {
|
|
251
259
|
ref: viewportRef,
|
|
252
260
|
"data-tao-scroll-viewport": "",
|
|
@@ -255,14 +263,14 @@ function ScrollArea(t0) {
|
|
|
255
263
|
onScroll: handleScroll,
|
|
256
264
|
children: children
|
|
257
265
|
});
|
|
258
|
-
$[
|
|
259
|
-
$[
|
|
260
|
-
$[
|
|
261
|
-
$[
|
|
262
|
-
$[
|
|
263
|
-
} else t34 = $[
|
|
266
|
+
$[35] = children;
|
|
267
|
+
$[36] = handleScroll;
|
|
268
|
+
$[37] = t33;
|
|
269
|
+
$[38] = viewportStyle;
|
|
270
|
+
$[39] = t34;
|
|
271
|
+
} else t34 = $[39];
|
|
264
272
|
let t35;
|
|
265
|
-
if ($[
|
|
273
|
+
if ($[40] !== scrollShadow || $[41] !== scrollState.atBottom || $[42] !== scrollState.atTop || $[43] !== showVertical) {
|
|
266
274
|
t35 = scrollShadow && showVertical && /*#__PURE__*/ jsxs(Fragment, {
|
|
267
275
|
children: [
|
|
268
276
|
/*#__PURE__*/ jsx("div", {
|
|
@@ -275,14 +283,14 @@ function ScrollArea(t0) {
|
|
|
275
283
|
})
|
|
276
284
|
]
|
|
277
285
|
});
|
|
278
|
-
$[
|
|
279
|
-
$[
|
|
280
|
-
$[
|
|
281
|
-
$[
|
|
282
|
-
$[
|
|
283
|
-
} else t35 = $[
|
|
286
|
+
$[40] = scrollShadow;
|
|
287
|
+
$[41] = scrollState.atBottom;
|
|
288
|
+
$[42] = scrollState.atTop;
|
|
289
|
+
$[43] = showVertical;
|
|
290
|
+
$[44] = t35;
|
|
291
|
+
} else t35 = $[44];
|
|
284
292
|
let t36;
|
|
285
|
-
if ($[
|
|
293
|
+
if ($[45] !== scrollShadow || $[46] !== scrollState.atLeft || $[47] !== scrollState.atRight || $[48] !== showHorizontal) {
|
|
286
294
|
t36 = scrollShadow && showHorizontal && /*#__PURE__*/ jsxs(Fragment, {
|
|
287
295
|
children: [
|
|
288
296
|
/*#__PURE__*/ jsx("div", {
|
|
@@ -295,19 +303,19 @@ function ScrollArea(t0) {
|
|
|
295
303
|
})
|
|
296
304
|
]
|
|
297
305
|
});
|
|
298
|
-
$[
|
|
299
|
-
$[
|
|
300
|
-
$[
|
|
301
|
-
$[
|
|
302
|
-
$[
|
|
303
|
-
} else t36 = $[
|
|
306
|
+
$[45] = scrollShadow;
|
|
307
|
+
$[46] = scrollState.atLeft;
|
|
308
|
+
$[47] = scrollState.atRight;
|
|
309
|
+
$[48] = showHorizontal;
|
|
310
|
+
$[49] = t36;
|
|
311
|
+
} else t36 = $[49];
|
|
304
312
|
let t37;
|
|
305
|
-
if ($[
|
|
313
|
+
if ($[50] !== classNames?.scrollbar || $[51] !== classNames?.thumb || $[52] !== locale || $[53] !== scrollState.hasVertical || $[54] !== scrollState.thumbYOffset || $[55] !== scrollState.thumbYRatio || $[56] !== showVertical || $[57] !== styles?.scrollbar || $[58] !== styles?.thumb) {
|
|
306
314
|
t37 = showVertical && scrollState.hasVertical && /*#__PURE__*/ jsx("button", {
|
|
307
315
|
type: "button",
|
|
308
316
|
"data-tao-scrollbar": "",
|
|
309
317
|
"data-tao-orientation": "vertical",
|
|
310
|
-
"aria-label":
|
|
318
|
+
"aria-label": locale.messages.scrollVertically,
|
|
311
319
|
className: cx(classNames?.scrollbar),
|
|
312
320
|
style: styles?.scrollbar,
|
|
313
321
|
onClick: (e_2)=>handleTrackClick("y", e_2),
|
|
@@ -324,23 +332,24 @@ function ScrollArea(t0) {
|
|
|
324
332
|
onPointerDown: (e_3)=>handleThumbPointerDown("y", e_3)
|
|
325
333
|
})
|
|
326
334
|
});
|
|
327
|
-
$[
|
|
328
|
-
$[
|
|
329
|
-
$[
|
|
330
|
-
$[
|
|
331
|
-
$[
|
|
332
|
-
$[
|
|
333
|
-
$[
|
|
334
|
-
$[
|
|
335
|
-
$[
|
|
336
|
-
|
|
335
|
+
$[50] = classNames?.scrollbar;
|
|
336
|
+
$[51] = classNames?.thumb;
|
|
337
|
+
$[52] = locale;
|
|
338
|
+
$[53] = scrollState.hasVertical;
|
|
339
|
+
$[54] = scrollState.thumbYOffset;
|
|
340
|
+
$[55] = scrollState.thumbYRatio;
|
|
341
|
+
$[56] = showVertical;
|
|
342
|
+
$[57] = styles?.scrollbar;
|
|
343
|
+
$[58] = styles?.thumb;
|
|
344
|
+
$[59] = t37;
|
|
345
|
+
} else t37 = $[59];
|
|
337
346
|
let t38;
|
|
338
|
-
if ($[
|
|
347
|
+
if ($[60] !== classNames?.scrollbar || $[61] !== classNames?.thumb || $[62] !== locale || $[63] !== scrollState.hasHorizontal || $[64] !== scrollState.thumbXOffset || $[65] !== scrollState.thumbXRatio || $[66] !== showHorizontal || $[67] !== styles?.scrollbar || $[68] !== styles?.thumb) {
|
|
339
348
|
t38 = showHorizontal && scrollState.hasHorizontal && /*#__PURE__*/ jsx("button", {
|
|
340
349
|
type: "button",
|
|
341
350
|
"data-tao-scrollbar": "",
|
|
342
351
|
"data-tao-orientation": "horizontal",
|
|
343
|
-
"aria-label":
|
|
352
|
+
"aria-label": locale.messages.scrollHorizontally,
|
|
344
353
|
className: cx(classNames?.scrollbar),
|
|
345
354
|
style: styles?.scrollbar,
|
|
346
355
|
onClick: (e_4)=>handleTrackClick("x", e_4),
|
|
@@ -357,19 +366,21 @@ function ScrollArea(t0) {
|
|
|
357
366
|
onPointerDown: (e_5)=>handleThumbPointerDown("x", e_5)
|
|
358
367
|
})
|
|
359
368
|
});
|
|
360
|
-
$[
|
|
361
|
-
$[
|
|
362
|
-
$[
|
|
363
|
-
$[
|
|
364
|
-
$[
|
|
365
|
-
$[
|
|
366
|
-
$[
|
|
367
|
-
$[
|
|
368
|
-
$[
|
|
369
|
-
|
|
369
|
+
$[60] = classNames?.scrollbar;
|
|
370
|
+
$[61] = classNames?.thumb;
|
|
371
|
+
$[62] = locale;
|
|
372
|
+
$[63] = scrollState.hasHorizontal;
|
|
373
|
+
$[64] = scrollState.thumbXOffset;
|
|
374
|
+
$[65] = scrollState.thumbXRatio;
|
|
375
|
+
$[66] = showHorizontal;
|
|
376
|
+
$[67] = styles?.scrollbar;
|
|
377
|
+
$[68] = styles?.thumb;
|
|
378
|
+
$[69] = t38;
|
|
379
|
+
} else t38 = $[69];
|
|
370
380
|
let t39;
|
|
371
|
-
if ($[
|
|
381
|
+
if ($[70] !== directionRef || $[71] !== t26 || $[72] !== t27 || $[73] !== t29 || $[74] !== t31 || $[75] !== t34 || $[76] !== t35 || $[77] !== t36 || $[78] !== t37 || $[79] !== t38 || $[80] !== type) {
|
|
372
382
|
t39 = /*#__PURE__*/ jsxs("div", {
|
|
383
|
+
ref: directionRef,
|
|
373
384
|
"data-tao-scroll-area": "",
|
|
374
385
|
"data-tao-scroll-type": type,
|
|
375
386
|
"data-tao-has-v": t26,
|
|
@@ -384,18 +395,19 @@ function ScrollArea(t0) {
|
|
|
384
395
|
t38
|
|
385
396
|
]
|
|
386
397
|
});
|
|
387
|
-
$[
|
|
388
|
-
$[
|
|
389
|
-
$[
|
|
390
|
-
$[
|
|
391
|
-
$[
|
|
392
|
-
$[
|
|
393
|
-
$[
|
|
394
|
-
$[
|
|
395
|
-
$[
|
|
396
|
-
$[
|
|
397
|
-
$[
|
|
398
|
-
|
|
398
|
+
$[70] = directionRef;
|
|
399
|
+
$[71] = t26;
|
|
400
|
+
$[72] = t27;
|
|
401
|
+
$[73] = t29;
|
|
402
|
+
$[74] = t31;
|
|
403
|
+
$[75] = t34;
|
|
404
|
+
$[76] = t35;
|
|
405
|
+
$[77] = t36;
|
|
406
|
+
$[78] = t37;
|
|
407
|
+
$[79] = t38;
|
|
408
|
+
$[80] = type;
|
|
409
|
+
$[81] = t39;
|
|
410
|
+
} else t39 = $[81];
|
|
399
411
|
return t39;
|
|
400
412
|
}
|
|
401
413
|
export { ScrollArea };
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef, useId, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
-
import { useTaoConfig } from "../../provider/tao-provider.js";
|
|
2
|
+
import { forwardRef, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { useTaoConfig, useTaoDirection } from "../../provider/tao-provider.js";
|
|
4
4
|
import { cx } from "../../utils/semantic.js";
|
|
5
5
|
import { Tooltip } from "../tooltip/tooltip.js";
|
|
6
|
+
import { mergeRefs } from "../../utils/refs.js";
|
|
6
7
|
import "./segmented.css";
|
|
7
8
|
function SegmentedInner(props, ref) {
|
|
8
9
|
const config = useTaoConfig();
|
|
9
10
|
const id = useId();
|
|
10
11
|
const { prefixCls, rootClassName, options, value, defaultValue, onChange, disabled = config.disabled, name = id, block, size = config.size, vertical, orientation, direction, shape = 'default', motionName = 'tao-segmented-thumb-motion', classNames, styles, className, style, onKeyDown, ...rest } = props;
|
|
11
|
-
const resolved = options.map((option)=>'object' == typeof option && null !== option ? option : {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const resolved = useMemo(()=>options.map((option)=>'object' == typeof option && null !== option ? option : {
|
|
13
|
+
value: option,
|
|
14
|
+
label: String(option)
|
|
15
|
+
}), [
|
|
16
|
+
options
|
|
17
|
+
]);
|
|
15
18
|
const [internal, setInternal] = useState(defaultValue ?? resolved[0]?.value);
|
|
16
19
|
const selected = void 0 !== value ? value : internal;
|
|
17
20
|
const axis = orientation ?? (vertical ? 'vertical' : 'horizontal');
|
|
@@ -30,11 +33,16 @@ function SegmentedInner(props, ref) {
|
|
|
30
33
|
props: merged
|
|
31
34
|
}) : styles;
|
|
32
35
|
const root = useRef(null);
|
|
36
|
+
const [resolvedDirection, directionRef] = useTaoDirection(direction ?? ('auto' === props.dir || 'ltr' === props.dir || 'rtl' === props.dir ? props.dir : void 0));
|
|
37
|
+
const mergedRootRef = useMemo(()=>mergeRefs(root, directionRef), [
|
|
38
|
+
directionRef
|
|
39
|
+
]);
|
|
33
40
|
useImperativeHandle(ref, ()=>root.current);
|
|
34
41
|
const [thumb, setThumb] = useState(null);
|
|
35
42
|
useLayoutEffect(()=>{
|
|
36
43
|
const container = root.current;
|
|
37
|
-
const
|
|
44
|
+
const items = container.querySelectorAll('[data-tao-segmented-item]');
|
|
45
|
+
const item = items[resolved.findIndex((option_0)=>option_0.value === selected)];
|
|
38
46
|
if (!item) return void setThumb(null);
|
|
39
47
|
const measure = ()=>{
|
|
40
48
|
const bounds = container.getBoundingClientRect();
|
|
@@ -53,9 +61,24 @@ function SegmentedInner(props, ref) {
|
|
|
53
61
|
measure();
|
|
54
62
|
const observer = new ResizeObserver(measure);
|
|
55
63
|
observer.observe(container);
|
|
56
|
-
observer.observe(
|
|
57
|
-
|
|
58
|
-
|
|
64
|
+
for (const element of items)observer.observe(element);
|
|
65
|
+
const attributes = new MutationObserver(measure);
|
|
66
|
+
attributes.observe(container, {
|
|
67
|
+
attributes: true,
|
|
68
|
+
attributeFilter: [
|
|
69
|
+
'dir',
|
|
70
|
+
'style',
|
|
71
|
+
'class'
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
return ()=>{
|
|
75
|
+
observer.disconnect();
|
|
76
|
+
attributes.disconnect();
|
|
77
|
+
};
|
|
78
|
+
}, [
|
|
79
|
+
resolved,
|
|
80
|
+
selected
|
|
81
|
+
]);
|
|
59
82
|
function select(next_0) {
|
|
60
83
|
if (next_0 === selected) return;
|
|
61
84
|
if (void 0 === value) setInternal(next_0);
|
|
@@ -63,10 +86,10 @@ function SegmentedInner(props, ref) {
|
|
|
63
86
|
}
|
|
64
87
|
return /*#__PURE__*/ jsxs("div", {
|
|
65
88
|
...rest,
|
|
66
|
-
ref:
|
|
89
|
+
ref: mergedRootRef,
|
|
67
90
|
role: "radiogroup",
|
|
68
91
|
"aria-orientation": axis,
|
|
69
|
-
dir: direction ?? props.dir,
|
|
92
|
+
dir: direction ?? ('auto' === props.dir ? 'auto' : resolvedDirection),
|
|
70
93
|
"data-tao-segmented": "",
|
|
71
94
|
"data-tao-has-thumb": null !== thumb || void 0,
|
|
72
95
|
"data-tao-disabled": disabled || void 0,
|
|
@@ -119,46 +142,46 @@ function SegmentedInner(props, ref) {
|
|
|
119
142
|
moving: false
|
|
120
143
|
} : previous_1)
|
|
121
144
|
}),
|
|
122
|
-
resolved.map((
|
|
123
|
-
const isDisabled = disabled ||
|
|
124
|
-
const key = `${typeof
|
|
145
|
+
resolved.map((option_1)=>{
|
|
146
|
+
const isDisabled = disabled || option_1.disabled;
|
|
147
|
+
const key = `${typeof option_1.value}:${String(option_1.value)}`;
|
|
125
148
|
const item_0 = /*#__PURE__*/ jsxs("label", {
|
|
126
149
|
"data-tao-segmented-item": "",
|
|
127
|
-
"data-tao-checked":
|
|
150
|
+
"data-tao-checked": option_1.value === selected || void 0,
|
|
128
151
|
"data-tao-disabled": isDisabled || void 0,
|
|
129
|
-
className: cx(classes?.item,
|
|
152
|
+
className: cx(classes?.item, option_1.className),
|
|
130
153
|
style: slots?.item,
|
|
131
|
-
title:
|
|
154
|
+
title: option_1.title ?? ('string' == typeof option_1.label || 'number' == typeof option_1.label ? String(option_1.label) : void 0),
|
|
132
155
|
children: [
|
|
133
156
|
/*#__PURE__*/ jsx("input", {
|
|
134
157
|
type: "radio",
|
|
135
158
|
name: name,
|
|
136
|
-
value: String(
|
|
137
|
-
checked:
|
|
159
|
+
value: String(option_1.value),
|
|
160
|
+
checked: option_1.value === selected,
|
|
138
161
|
disabled: isDisabled,
|
|
139
|
-
onChange: ()=>select(
|
|
140
|
-
"aria-label": void 0 ===
|
|
162
|
+
onChange: ()=>select(option_1.value),
|
|
163
|
+
"aria-label": void 0 === option_1.label ? String(option_1.value) : void 0
|
|
141
164
|
}),
|
|
142
165
|
/*#__PURE__*/ jsxs("span", {
|
|
143
166
|
"data-tao-segmented-label": "",
|
|
144
167
|
className: classes?.label,
|
|
145
168
|
style: slots?.label,
|
|
146
169
|
children: [
|
|
147
|
-
void 0 !==
|
|
170
|
+
void 0 !== option_1.icon && /*#__PURE__*/ jsx("span", {
|
|
148
171
|
"data-tao-segmented-icon": "",
|
|
149
172
|
className: classes?.icon,
|
|
150
173
|
style: slots?.icon,
|
|
151
|
-
children:
|
|
174
|
+
children: option_1.icon
|
|
152
175
|
}),
|
|
153
|
-
|
|
176
|
+
option_1.label
|
|
154
177
|
]
|
|
155
178
|
})
|
|
156
179
|
]
|
|
157
180
|
}, key);
|
|
158
|
-
return
|
|
159
|
-
...'string' == typeof
|
|
160
|
-
title:
|
|
161
|
-
} :
|
|
181
|
+
return option_1.tooltip ? /*#__PURE__*/ jsx(Tooltip, {
|
|
182
|
+
...'string' == typeof option_1.tooltip ? {
|
|
183
|
+
title: option_1.tooltip
|
|
184
|
+
} : option_1.tooltip,
|
|
162
185
|
children: item_0
|
|
163
186
|
}, key) : item_0;
|
|
164
187
|
})
|
|
@@ -25,10 +25,11 @@ interface MobileSelectContentProps extends Pick<SelectProps, 'classNames' | 'sty
|
|
|
25
25
|
tokenSeparators?: string[];
|
|
26
26
|
onSearchClear: () => void;
|
|
27
27
|
}
|
|
28
|
-
declare function MobileSelectContentInner({ options, value, onChange, onMultiChange, showSearch, searchValue: search, onSearch, filterOption, notFoundContent, optionRender, onClose, multiple, maxCount, mode, tokenSeparators, onSearchClear, disabled, classNames, styles, }: MobileSelectContentProps): import("react").JSX.Element;
|
|
28
|
+
declare function MobileSelectContentInner({ options, value, onChange, onMultiChange, showSearch, searchValue: search, onSearch, filterOption, notFoundContent: notFoundContentProp, optionRender, onClose, multiple, maxCount, mode, tokenSeparators, onSearchClear, disabled, classNames, styles, }: MobileSelectContentProps): import("react").JSX.Element;
|
|
29
29
|
export { MobileSelectContentInner as MobileSelectContent };
|
|
30
30
|
export interface MobileSelectDrawerProps extends MobileSelectContentProps {
|
|
31
|
+
direction?: 'ltr' | 'rtl';
|
|
31
32
|
open: boolean;
|
|
32
33
|
mobileTitle?: ReactNode;
|
|
33
34
|
}
|
|
34
|
-
export declare function MobileSelectDrawer({ open, mobileTitle, onClose, placeholder, classNames, styles, popupRender, ...rest }: MobileSelectDrawerProps): import("react").JSX.Element;
|
|
35
|
+
export declare function MobileSelectDrawer({ direction, open, mobileTitle, onClose, placeholder, classNames, styles, popupRender, ...rest }: MobileSelectDrawerProps): import("react").JSX.Element;
|