@rockshin/tao-ui 0.0.31 → 0.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -3
- package/dist/components/alert/alert.js +1 -1
- package/dist/components/breadcrumb/breadcrumb.js +1 -1
- package/dist/components/button/button.d.ts +2 -2
- package/dist/components/button/button.js +48 -50
- package/dist/components/checkbox/checkbox.css +5 -1
- package/dist/components/checkbox/checkbox.d.ts +2 -2
- package/dist/components/checkbox/checkbox.js +135 -120
- package/dist/components/collapsible/collapsible.js +1 -1
- package/dist/components/context-menu/context-menu.js +1 -1
- package/dist/components/date-picker/calendar/calendar-header.js +1 -1
- package/dist/components/date-picker/calendar/month-grid.d.ts +3 -1
- package/dist/components/date-picker/calendar/month-grid.js +19 -17
- package/dist/components/date-picker/calendar/time-panel.js +1 -1
- package/dist/components/date-picker/calendar/year-grid.d.ts +3 -1
- package/dist/components/date-picker/calendar/year-grid.js +28 -24
- package/dist/components/date-picker/date-picker.d.ts +1 -1
- package/dist/components/date-picker/date-picker.js +37 -24
- package/dist/components/date-picker/presets.js +1 -1
- package/dist/components/date-picker/range-picker.d.ts +1 -1
- package/dist/components/date-picker/range-picker.js +104 -56
- package/dist/components/drawer/drawer.d.ts +1 -1
- package/dist/components/drawer/drawer.js +98 -91
- package/dist/components/dropdown/dropdown.js +84 -84
- package/dist/components/form/form-item.js +8 -4
- package/dist/components/form/form.js +1 -1
- package/dist/components/form-actions/form-actions.js +1 -1
- package/dist/components/form-field/form-field-view.js +58 -51
- package/dist/components/form-field/form-field.js +1 -1
- package/dist/components/form-section/form-section.js +1 -1
- package/dist/components/input/input.js +42 -39
- package/dist/components/input-number/input-number.d.ts +2 -2
- package/dist/components/input-number/input-number.js +57 -59
- package/dist/components/menu/menu-render.js +1 -1
- package/dist/components/modal/confirm-dialog.d.ts +2 -1
- package/dist/components/modal/confirm-dialog.js +25 -5
- package/dist/components/modal/confirm.js +15 -3
- package/dist/components/modal/modal.d.ts +1 -1
- package/dist/components/modal/modal.js +131 -132
- package/dist/components/modal/use-modal.js +48 -35
- package/dist/components/pagination/pagination.js +3 -1
- package/dist/components/popconfirm/popconfirm.js +1 -1
- package/dist/components/popover/popover.js +253 -228
- package/dist/components/radio/radio.css +2 -2
- package/dist/components/radio/radio.d.ts +1 -1
- package/dist/components/radio/radio.js +7 -7
- package/dist/components/scroll-area/scroll-area.css +2 -2
- package/dist/components/scroll-area/scroll-area.js +187 -165
- package/dist/components/select/mobile-select.d.ts +2 -1
- package/dist/components/select/mobile-select.js +12 -6
- package/dist/components/select/select-icons.js +1 -1
- package/dist/components/select/select-searchable-list.d.ts +1 -1
- package/dist/components/select/select-searchable-list.js +35 -21
- package/dist/components/select/select-tags.js +1 -1
- package/dist/components/select/select-types.d.ts +2 -2
- package/dist/components/select/select.css +4 -0
- package/dist/components/select/select.d.ts +2 -2
- package/dist/components/select/select.js +127 -73
- package/dist/components/sonner/sonner.js +6 -5
- package/dist/components/spinner/spinner.js +1 -1
- package/dist/components/splitter/splitter.js +187 -194
- package/dist/components/status-icon/status-icon.js +1 -1
- package/dist/components/switch/switch.d.ts +1 -1
- package/dist/components/switch/switch.js +6 -6
- package/dist/components/table/table-filter.js +1 -1
- package/dist/components/table/table-icons.js +1 -1
- package/dist/components/table/table.js +483 -599
- package/dist/components/tabs/tabs.js +179 -161
- package/dist/components/tag/tag.js +1 -1
- package/dist/components/textarea/textarea.d.ts +1 -1
- package/dist/components/textarea/textarea.js +142 -108
- package/dist/components/tooltip/tooltip.js +88 -72
- package/dist/entries/alert.d.ts +3 -0
- package/dist/entries/alert.js +4 -0
- package/dist/entries/breadcrumb.d.ts +3 -0
- package/dist/entries/breadcrumb.js +4 -0
- package/dist/entries/button.d.ts +3 -0
- package/dist/entries/button.js +4 -0
- package/dist/entries/checkbox.d.ts +3 -0
- package/dist/entries/checkbox.js +4 -0
- package/dist/entries/collapsible.d.ts +3 -0
- package/dist/entries/collapsible.js +4 -0
- package/dist/entries/context-menu.d.ts +3 -0
- package/dist/entries/context-menu.js +4 -0
- package/dist/entries/date-picker.d.ts +3 -0
- package/dist/entries/date-picker.js +4 -0
- package/dist/entries/drawer.d.ts +3 -0
- package/dist/entries/drawer.js +4 -0
- package/dist/entries/dropdown.d.ts +3 -0
- package/dist/entries/dropdown.js +4 -0
- package/dist/entries/form-actions.d.ts +3 -0
- package/dist/entries/form-actions.js +4 -0
- package/dist/entries/form-field.d.ts +3 -0
- package/dist/entries/form-field.js +4 -0
- package/dist/entries/form-layout.d.ts +3 -0
- package/dist/entries/form-layout.js +4 -0
- package/dist/entries/form-section.d.ts +3 -0
- package/dist/entries/form-section.js +4 -0
- package/dist/entries/form.d.ts +4 -0
- package/dist/entries/form.js +4 -0
- package/dist/entries/input-number.d.ts +3 -0
- package/dist/entries/input-number.js +4 -0
- package/dist/entries/input.d.ts +3 -0
- package/dist/entries/input.js +4 -0
- package/dist/entries/modal.d.ts +3 -0
- package/dist/entries/modal.js +4 -0
- package/dist/entries/number-input.d.ts +3 -0
- package/dist/entries/number-input.js +4 -0
- package/dist/entries/pagination.d.ts +3 -0
- package/dist/entries/pagination.js +4 -0
- package/dist/entries/popconfirm.d.ts +3 -0
- package/dist/entries/popconfirm.js +4 -0
- package/dist/entries/popover.d.ts +3 -0
- package/dist/entries/popover.js +4 -0
- package/dist/entries/provider.d.ts +3 -0
- package/dist/entries/provider.js +4 -0
- package/dist/entries/radio.d.ts +3 -0
- package/dist/entries/radio.js +4 -0
- package/dist/entries/range-picker.d.ts +3 -0
- package/dist/entries/range-picker.js +4 -0
- package/dist/entries/scroll-area.d.ts +3 -0
- package/dist/entries/scroll-area.js +4 -0
- package/dist/entries/select.d.ts +3 -0
- package/dist/entries/select.js +4 -0
- package/dist/entries/sonner.d.ts +3 -0
- package/dist/entries/sonner.js +4 -0
- package/dist/entries/spinner.d.ts +3 -0
- package/dist/entries/spinner.js +4 -0
- package/dist/entries/splitter.d.ts +3 -0
- package/dist/entries/splitter.js +4 -0
- package/dist/entries/stack.d.ts +3 -0
- package/dist/entries/stack.js +4 -0
- package/dist/entries/switch.d.ts +3 -0
- package/dist/entries/switch.js +4 -0
- package/dist/entries/table.d.ts +3 -0
- package/dist/entries/table.js +4 -0
- package/dist/entries/tabs.d.ts +3 -0
- package/dist/entries/tabs.js +4 -0
- package/dist/entries/tag.d.ts +3 -0
- package/dist/entries/tag.js +4 -0
- package/dist/entries/textarea.d.ts +3 -0
- package/dist/entries/textarea.js +4 -0
- package/dist/entries/tooltip.d.ts +3 -0
- package/dist/entries/tooltip.js +4 -0
- package/dist/layouts/form-layout/form-layout.js +1 -1
- package/dist/layouts/stack/stack.js +1 -1
- package/dist/number-input/number-input.js +1 -1
- package/dist/number-input/use-number-input.d.ts +2 -2
- package/dist/number-input/use-number-input.js +224 -131
- package/dist/number-input/validate.js +7 -2
- package/dist/provider/tao-provider.js +1 -1
- package/dist/utils/dialog-content.d.ts +10 -0
- package/dist/utils/dialog-content.js +222 -0
- package/dist/utils/overlay.d.ts +2 -2
- package/dist/utils/overlay.js +8 -3
- package/dist/utils/refs.js +17 -2
- package/llms.txt +5 -3
- package/package.json +21 -8
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { c } from "react
|
|
2
|
+
import { c } from "react-compiler-runtime";
|
|
3
3
|
import { useEffect, useRef, useState } from "react";
|
|
4
4
|
import { cx } from "../../utils/semantic.js";
|
|
5
5
|
import "./scroll-area.css";
|
|
6
6
|
function ScrollArea(t0) {
|
|
7
|
-
const $ = c(
|
|
7
|
+
const $ = c(76);
|
|
8
8
|
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
9
|
const type = void 0 === t1 ? "hover" : t1;
|
|
10
10
|
const direction = void 0 === t2 ? "vertical" : t2;
|
|
@@ -43,8 +43,8 @@ function ScrollArea(t0) {
|
|
|
43
43
|
hasHorizontal: hasH,
|
|
44
44
|
thumbYRatio: hasV ? clientHeight / scrollHeight : 0,
|
|
45
45
|
thumbXRatio: hasH ? clientWidth / scrollWidth : 0,
|
|
46
|
-
thumbYOffset: hasV ? scrollTop / (scrollHeight - clientHeight) : 0,
|
|
47
|
-
thumbXOffset: hasH ? scrollLeft / (scrollWidth - clientWidth) : 0,
|
|
46
|
+
thumbYOffset: hasV ? Math.max(0, Math.min(1, scrollTop / (scrollHeight - clientHeight))) : 0,
|
|
47
|
+
thumbXOffset: hasH ? Math.max(0, Math.min(1, scrollLeft / (scrollWidth - clientWidth))) : 0,
|
|
48
48
|
atTop: scrollTop <= 1,
|
|
49
49
|
atBottom: scrollTop + clientHeight >= scrollHeight - 1,
|
|
50
50
|
atLeft: scrollLeft <= 1,
|
|
@@ -98,46 +98,66 @@ function ScrollArea(t0) {
|
|
|
98
98
|
$[7] = t11;
|
|
99
99
|
} else t11 = $[7];
|
|
100
100
|
const handleScroll = t11;
|
|
101
|
-
const
|
|
101
|
+
const dragCleanup = useRef(null);
|
|
102
102
|
let t12;
|
|
103
|
+
let t13;
|
|
103
104
|
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
104
|
-
t12 = (
|
|
105
|
+
t12 = ()=>()=>dragCleanup.current?.();
|
|
106
|
+
t13 = [];
|
|
107
|
+
$[8] = t12;
|
|
108
|
+
$[9] = t13;
|
|
109
|
+
} else {
|
|
110
|
+
t12 = $[8];
|
|
111
|
+
t13 = $[9];
|
|
112
|
+
}
|
|
113
|
+
useEffect(t12, t13);
|
|
114
|
+
let t14;
|
|
115
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
116
|
+
t14 = (axis, e_0)=>{
|
|
105
117
|
e_0.preventDefault();
|
|
106
118
|
e_0.stopPropagation();
|
|
119
|
+
dragCleanup.current?.();
|
|
107
120
|
const el_2 = viewportRef.current;
|
|
108
121
|
if (!el_2) return;
|
|
122
|
+
const thumb = e_0.currentTarget;
|
|
123
|
+
const track = thumb.parentElement;
|
|
124
|
+
if (!track) return;
|
|
109
125
|
const pos = "y" === axis ? e_0.clientY : e_0.clientX;
|
|
110
126
|
const scroll = "y" === axis ? el_2.scrollTop : el_2.scrollLeft;
|
|
111
|
-
|
|
112
|
-
axis,
|
|
113
|
-
startPos: pos,
|
|
114
|
-
startScroll: scroll
|
|
115
|
-
};
|
|
127
|
+
const pointerId = e_0.pointerId;
|
|
116
128
|
const handleMove = (ev)=>{
|
|
117
|
-
if (
|
|
118
|
-
const
|
|
119
|
-
const delta = ("y" === a ? ev.clientY : ev.clientX) - sp;
|
|
129
|
+
if (ev.pointerId !== pointerId || !viewportRef.current) return;
|
|
130
|
+
const delta = ("y" === axis ? ev.clientY : ev.clientX) - pos;
|
|
120
131
|
const vp = viewportRef.current;
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
132
|
+
const trackRect = track.getBoundingClientRect();
|
|
133
|
+
const thumbRect = thumb.getBoundingClientRect();
|
|
134
|
+
const travel = "y" === axis ? trackRect.height - thumbRect.height : trackRect.width - thumbRect.width;
|
|
135
|
+
const maxScroll = "y" === axis ? vp.scrollHeight - vp.clientHeight : vp.scrollWidth - vp.clientWidth;
|
|
136
|
+
if (travel <= 0 || maxScroll <= 0) return;
|
|
137
|
+
const nextScroll = Math.max(0, Math.min(maxScroll, scroll + delta / travel * maxScroll));
|
|
138
|
+
if ("y" === axis) vp.scrollTop = nextScroll;
|
|
139
|
+
else vp.scrollLeft = nextScroll;
|
|
126
140
|
};
|
|
127
|
-
const
|
|
128
|
-
dragging.current = null;
|
|
141
|
+
const cleanup = ()=>{
|
|
129
142
|
document.removeEventListener("pointermove", handleMove);
|
|
130
|
-
document.removeEventListener("pointerup",
|
|
143
|
+
document.removeEventListener("pointerup", handleEnd);
|
|
144
|
+
document.removeEventListener("pointercancel", handleEnd);
|
|
145
|
+
dragCleanup.current = null;
|
|
131
146
|
};
|
|
147
|
+
const handleEnd = (ev_0)=>{
|
|
148
|
+
if (ev_0.pointerId === pointerId) cleanup();
|
|
149
|
+
};
|
|
150
|
+
dragCleanup.current = cleanup;
|
|
132
151
|
document.addEventListener("pointermove", handleMove);
|
|
133
|
-
document.addEventListener("pointerup",
|
|
152
|
+
document.addEventListener("pointerup", handleEnd);
|
|
153
|
+
document.addEventListener("pointercancel", handleEnd);
|
|
134
154
|
};
|
|
135
|
-
$[
|
|
136
|
-
} else
|
|
137
|
-
const handleThumbPointerDown =
|
|
138
|
-
let
|
|
139
|
-
if ($[
|
|
140
|
-
|
|
155
|
+
$[10] = t14;
|
|
156
|
+
} else t14 = $[10];
|
|
157
|
+
const handleThumbPointerDown = t14;
|
|
158
|
+
let t15;
|
|
159
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
160
|
+
t15 = (axis_0, e_1)=>{
|
|
141
161
|
const el_3 = viewportRef.current;
|
|
142
162
|
if (!el_3) return;
|
|
143
163
|
if (e_1.target.hasAttribute("data-tao-scroll-thumb")) return;
|
|
@@ -146,104 +166,104 @@ function ScrollArea(t0) {
|
|
|
146
166
|
if ("y" === axis_0) el_3.scrollTop = clickPos * (el_3.scrollHeight - el_3.clientHeight);
|
|
147
167
|
else el_3.scrollLeft = clickPos * (el_3.scrollWidth - el_3.clientWidth);
|
|
148
168
|
};
|
|
149
|
-
$[
|
|
150
|
-
} else
|
|
151
|
-
const handleTrackClick =
|
|
169
|
+
$[11] = t15;
|
|
170
|
+
} else t15 = $[11];
|
|
171
|
+
const handleTrackClick = t15;
|
|
152
172
|
const showVertical = "vertical" === direction || "both" === direction;
|
|
153
173
|
const showHorizontal = "horizontal" === direction || "both" === direction;
|
|
154
|
-
const
|
|
155
|
-
const
|
|
156
|
-
let
|
|
157
|
-
if ($[
|
|
158
|
-
|
|
159
|
-
maxHeight:
|
|
160
|
-
maxWidth:
|
|
174
|
+
const t16 = maxHeight ?? void 0;
|
|
175
|
+
const t17 = maxWidth ?? void 0;
|
|
176
|
+
let t18;
|
|
177
|
+
if ($[12] !== t16 || $[13] !== t17) {
|
|
178
|
+
t18 = {
|
|
179
|
+
maxHeight: t16,
|
|
180
|
+
maxWidth: t17
|
|
161
181
|
};
|
|
162
|
-
$[10] = t14;
|
|
163
|
-
$[11] = t15;
|
|
164
182
|
$[12] = t16;
|
|
165
|
-
} else t16 = $[12];
|
|
166
|
-
const rootStyle = t16;
|
|
167
|
-
const t17 = showVertical ? "scroll" : "hidden";
|
|
168
|
-
const t18 = showHorizontal ? "scroll" : "hidden";
|
|
169
|
-
const t19 = styles?.viewport;
|
|
170
|
-
let t20;
|
|
171
|
-
if ($[13] !== t17 || $[14] !== t18 || $[15] !== t19) {
|
|
172
|
-
t20 = {
|
|
173
|
-
overflowY: t17,
|
|
174
|
-
overflowX: t18,
|
|
175
|
-
...t19
|
|
176
|
-
};
|
|
177
183
|
$[13] = t17;
|
|
178
184
|
$[14] = t18;
|
|
185
|
+
} else t18 = $[14];
|
|
186
|
+
const rootStyle = t18;
|
|
187
|
+
const t19 = showVertical ? "scroll" : "hidden";
|
|
188
|
+
const t20 = showHorizontal ? "scroll" : "hidden";
|
|
189
|
+
const t21 = styles?.viewport;
|
|
190
|
+
let t22;
|
|
191
|
+
if ($[15] !== t19 || $[16] !== t20 || $[17] !== t21) {
|
|
192
|
+
t22 = {
|
|
193
|
+
overflowY: t19,
|
|
194
|
+
overflowX: t20,
|
|
195
|
+
...t21
|
|
196
|
+
};
|
|
179
197
|
$[15] = t19;
|
|
180
198
|
$[16] = t20;
|
|
181
|
-
} else t20 = $[16];
|
|
182
|
-
const viewportStyle = t20;
|
|
183
|
-
const t21 = `${scrollbarSize}px`;
|
|
184
|
-
const t22 = `${scrollbarOffset}px`;
|
|
185
|
-
let t23;
|
|
186
|
-
if ($[17] !== t21 || $[18] !== t22) {
|
|
187
|
-
t23 = {
|
|
188
|
-
"--tao-scrollbar-size": t21,
|
|
189
|
-
"--tao-scrollbar-offset": t22
|
|
190
|
-
};
|
|
191
199
|
$[17] = t21;
|
|
192
200
|
$[18] = t22;
|
|
201
|
+
} else t22 = $[18];
|
|
202
|
+
const viewportStyle = t22;
|
|
203
|
+
const t23 = `${scrollbarSize}px`;
|
|
204
|
+
const t24 = `${scrollbarOffset}px`;
|
|
205
|
+
let t25;
|
|
206
|
+
if ($[19] !== t23 || $[20] !== t24) {
|
|
207
|
+
t25 = {
|
|
208
|
+
"--tao-scrollbar-size": t23,
|
|
209
|
+
"--tao-scrollbar-offset": t24
|
|
210
|
+
};
|
|
193
211
|
$[19] = t23;
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
const
|
|
198
|
-
const t26 =
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
t27 = cx(t26, className);
|
|
202
|
-
$[20] = className;
|
|
203
|
-
$[21] = t26;
|
|
204
|
-
$[22] = t27;
|
|
205
|
-
} else t27 = $[22];
|
|
206
|
-
const t28 = styles?.root;
|
|
212
|
+
$[20] = t24;
|
|
213
|
+
$[21] = t25;
|
|
214
|
+
} else t25 = $[21];
|
|
215
|
+
const scrollbarVars = t25;
|
|
216
|
+
const t26 = scrollState.hasVertical || void 0;
|
|
217
|
+
const t27 = scrollState.hasHorizontal || void 0;
|
|
218
|
+
const t28 = classNames?.root;
|
|
207
219
|
let t29;
|
|
208
|
-
if ($[
|
|
209
|
-
t29 =
|
|
220
|
+
if ($[22] !== className || $[23] !== t28) {
|
|
221
|
+
t29 = cx(t28, className);
|
|
222
|
+
$[22] = className;
|
|
223
|
+
$[23] = t28;
|
|
224
|
+
$[24] = t29;
|
|
225
|
+
} else t29 = $[24];
|
|
226
|
+
const t30 = styles?.root;
|
|
227
|
+
let t31;
|
|
228
|
+
if ($[25] !== rootStyle || $[26] !== scrollbarVars || $[27] !== style || $[28] !== t30) {
|
|
229
|
+
t31 = {
|
|
210
230
|
...rootStyle,
|
|
211
231
|
...scrollbarVars,
|
|
212
|
-
...
|
|
232
|
+
...t30,
|
|
213
233
|
...style
|
|
214
234
|
};
|
|
215
|
-
$[
|
|
216
|
-
$[
|
|
217
|
-
$[
|
|
218
|
-
$[26] = t28;
|
|
219
|
-
$[27] = t29;
|
|
220
|
-
} else t29 = $[27];
|
|
221
|
-
const t30 = classNames?.viewport;
|
|
222
|
-
let t31;
|
|
223
|
-
if ($[28] !== t30) {
|
|
224
|
-
t31 = cx(t30);
|
|
235
|
+
$[25] = rootStyle;
|
|
236
|
+
$[26] = scrollbarVars;
|
|
237
|
+
$[27] = style;
|
|
225
238
|
$[28] = t30;
|
|
226
239
|
$[29] = t31;
|
|
227
240
|
} else t31 = $[29];
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
241
|
+
const t32 = classNames?.viewport;
|
|
242
|
+
let t33;
|
|
243
|
+
if ($[30] !== t32) {
|
|
244
|
+
t33 = cx(t32);
|
|
245
|
+
$[30] = t32;
|
|
246
|
+
$[31] = t33;
|
|
247
|
+
} else t33 = $[31];
|
|
248
|
+
let t34;
|
|
249
|
+
if ($[32] !== children || $[33] !== handleScroll || $[34] !== t33 || $[35] !== viewportStyle) {
|
|
250
|
+
t34 = /*#__PURE__*/ jsx("div", {
|
|
231
251
|
ref: viewportRef,
|
|
232
252
|
"data-tao-scroll-viewport": "",
|
|
233
|
-
className:
|
|
253
|
+
className: t33,
|
|
234
254
|
style: viewportStyle,
|
|
235
255
|
onScroll: handleScroll,
|
|
236
256
|
children: children
|
|
237
257
|
});
|
|
238
|
-
$[
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
242
|
-
$[
|
|
243
|
-
} else
|
|
244
|
-
let
|
|
245
|
-
if ($[
|
|
246
|
-
|
|
258
|
+
$[32] = children;
|
|
259
|
+
$[33] = handleScroll;
|
|
260
|
+
$[34] = t33;
|
|
261
|
+
$[35] = viewportStyle;
|
|
262
|
+
$[36] = t34;
|
|
263
|
+
} else t34 = $[36];
|
|
264
|
+
let t35;
|
|
265
|
+
if ($[37] !== scrollShadow || $[38] !== scrollState.atBottom || $[39] !== scrollState.atTop || $[40] !== showVertical) {
|
|
266
|
+
t35 = scrollShadow && showVertical && /*#__PURE__*/ jsxs(Fragment, {
|
|
247
267
|
children: [
|
|
248
268
|
/*#__PURE__*/ jsx("div", {
|
|
249
269
|
"data-tao-scroll-shadow": "top",
|
|
@@ -255,15 +275,15 @@ function ScrollArea(t0) {
|
|
|
255
275
|
})
|
|
256
276
|
]
|
|
257
277
|
});
|
|
258
|
-
$[
|
|
259
|
-
$[
|
|
260
|
-
$[
|
|
261
|
-
$[
|
|
262
|
-
$[
|
|
263
|
-
} else
|
|
264
|
-
let
|
|
265
|
-
if ($[
|
|
266
|
-
|
|
278
|
+
$[37] = scrollShadow;
|
|
279
|
+
$[38] = scrollState.atBottom;
|
|
280
|
+
$[39] = scrollState.atTop;
|
|
281
|
+
$[40] = showVertical;
|
|
282
|
+
$[41] = t35;
|
|
283
|
+
} else t35 = $[41];
|
|
284
|
+
let t36;
|
|
285
|
+
if ($[42] !== scrollShadow || $[43] !== scrollState.atLeft || $[44] !== scrollState.atRight || $[45] !== showHorizontal) {
|
|
286
|
+
t36 = scrollShadow && showHorizontal && /*#__PURE__*/ jsxs(Fragment, {
|
|
267
287
|
children: [
|
|
268
288
|
/*#__PURE__*/ jsx("div", {
|
|
269
289
|
"data-tao-scroll-shadow": "left",
|
|
@@ -275,15 +295,15 @@ function ScrollArea(t0) {
|
|
|
275
295
|
})
|
|
276
296
|
]
|
|
277
297
|
});
|
|
278
|
-
$[
|
|
279
|
-
$[
|
|
280
|
-
$[
|
|
281
|
-
$[
|
|
282
|
-
$[
|
|
283
|
-
} else
|
|
284
|
-
let
|
|
285
|
-
if ($[
|
|
286
|
-
|
|
298
|
+
$[42] = scrollShadow;
|
|
299
|
+
$[43] = scrollState.atLeft;
|
|
300
|
+
$[44] = scrollState.atRight;
|
|
301
|
+
$[45] = showHorizontal;
|
|
302
|
+
$[46] = t36;
|
|
303
|
+
} else t36 = $[46];
|
|
304
|
+
let t37;
|
|
305
|
+
if ($[47] !== classNames?.scrollbar || $[48] !== classNames?.thumb || $[49] !== scrollState.hasVertical || $[50] !== scrollState.thumbYOffset || $[51] !== scrollState.thumbYRatio || $[52] !== showVertical || $[53] !== styles?.scrollbar || $[54] !== styles?.thumb) {
|
|
306
|
+
t37 = showVertical && scrollState.hasVertical && /*#__PURE__*/ jsx("button", {
|
|
287
307
|
type: "button",
|
|
288
308
|
"data-tao-scrollbar": "",
|
|
289
309
|
"data-tao-orientation": "vertical",
|
|
@@ -297,25 +317,26 @@ function ScrollArea(t0) {
|
|
|
297
317
|
className: cx(classNames?.thumb),
|
|
298
318
|
style: {
|
|
299
319
|
height: `${Math.max(100 * scrollState.thumbYRatio, 10)}%`,
|
|
300
|
-
top: `${
|
|
320
|
+
top: `${100 * scrollState.thumbYOffset}%`,
|
|
321
|
+
transform: `translateY(-${100 * scrollState.thumbYOffset}%)`,
|
|
301
322
|
...styles?.thumb
|
|
302
323
|
},
|
|
303
324
|
onPointerDown: (e_3)=>handleThumbPointerDown("y", e_3)
|
|
304
325
|
})
|
|
305
326
|
});
|
|
306
|
-
$[
|
|
307
|
-
$[
|
|
308
|
-
$[
|
|
309
|
-
$[
|
|
310
|
-
$[
|
|
311
|
-
$[
|
|
312
|
-
$[
|
|
313
|
-
$[
|
|
314
|
-
$[
|
|
315
|
-
} else
|
|
316
|
-
let
|
|
317
|
-
if ($[
|
|
318
|
-
|
|
327
|
+
$[47] = classNames?.scrollbar;
|
|
328
|
+
$[48] = classNames?.thumb;
|
|
329
|
+
$[49] = scrollState.hasVertical;
|
|
330
|
+
$[50] = scrollState.thumbYOffset;
|
|
331
|
+
$[51] = scrollState.thumbYRatio;
|
|
332
|
+
$[52] = showVertical;
|
|
333
|
+
$[53] = styles?.scrollbar;
|
|
334
|
+
$[54] = styles?.thumb;
|
|
335
|
+
$[55] = t37;
|
|
336
|
+
} else t37 = $[55];
|
|
337
|
+
let t38;
|
|
338
|
+
if ($[56] !== classNames?.scrollbar || $[57] !== classNames?.thumb || $[58] !== scrollState.hasHorizontal || $[59] !== scrollState.thumbXOffset || $[60] !== scrollState.thumbXRatio || $[61] !== showHorizontal || $[62] !== styles?.scrollbar || $[63] !== styles?.thumb) {
|
|
339
|
+
t38 = showHorizontal && scrollState.hasHorizontal && /*#__PURE__*/ jsx("button", {
|
|
319
340
|
type: "button",
|
|
320
341
|
"data-tao-scrollbar": "",
|
|
321
342
|
"data-tao-orientation": "horizontal",
|
|
@@ -329,51 +350,52 @@ function ScrollArea(t0) {
|
|
|
329
350
|
className: cx(classNames?.thumb),
|
|
330
351
|
style: {
|
|
331
352
|
width: `${Math.max(100 * scrollState.thumbXRatio, 10)}%`,
|
|
332
|
-
left: `${
|
|
353
|
+
left: `${100 * scrollState.thumbXOffset}%`,
|
|
354
|
+
transform: `translateX(-${100 * scrollState.thumbXOffset}%)`,
|
|
333
355
|
...styles?.thumb
|
|
334
356
|
},
|
|
335
357
|
onPointerDown: (e_5)=>handleThumbPointerDown("x", e_5)
|
|
336
358
|
})
|
|
337
359
|
});
|
|
338
|
-
$[
|
|
339
|
-
$[
|
|
340
|
-
$[
|
|
341
|
-
$[
|
|
342
|
-
$[
|
|
343
|
-
$[
|
|
344
|
-
$[
|
|
345
|
-
$[
|
|
346
|
-
$[
|
|
347
|
-
} else
|
|
348
|
-
let
|
|
349
|
-
if ($[
|
|
350
|
-
|
|
360
|
+
$[56] = classNames?.scrollbar;
|
|
361
|
+
$[57] = classNames?.thumb;
|
|
362
|
+
$[58] = scrollState.hasHorizontal;
|
|
363
|
+
$[59] = scrollState.thumbXOffset;
|
|
364
|
+
$[60] = scrollState.thumbXRatio;
|
|
365
|
+
$[61] = showHorizontal;
|
|
366
|
+
$[62] = styles?.scrollbar;
|
|
367
|
+
$[63] = styles?.thumb;
|
|
368
|
+
$[64] = t38;
|
|
369
|
+
} else t38 = $[64];
|
|
370
|
+
let t39;
|
|
371
|
+
if ($[65] !== t26 || $[66] !== t27 || $[67] !== t29 || $[68] !== t31 || $[69] !== t34 || $[70] !== t35 || $[71] !== t36 || $[72] !== t37 || $[73] !== t38 || $[74] !== type) {
|
|
372
|
+
t39 = /*#__PURE__*/ jsxs("div", {
|
|
351
373
|
"data-tao-scroll-area": "",
|
|
352
374
|
"data-tao-scroll-type": type,
|
|
353
|
-
"data-tao-has-v":
|
|
354
|
-
"data-tao-has-h":
|
|
355
|
-
className:
|
|
356
|
-
style:
|
|
375
|
+
"data-tao-has-v": t26,
|
|
376
|
+
"data-tao-has-h": t27,
|
|
377
|
+
className: t29,
|
|
378
|
+
style: t31,
|
|
357
379
|
children: [
|
|
358
|
-
t32,
|
|
359
|
-
t33,
|
|
360
380
|
t34,
|
|
361
381
|
t35,
|
|
362
|
-
t36
|
|
382
|
+
t36,
|
|
383
|
+
t37,
|
|
384
|
+
t38
|
|
363
385
|
]
|
|
364
386
|
});
|
|
365
|
-
$[
|
|
366
|
-
$[
|
|
367
|
-
$[
|
|
368
|
-
$[
|
|
369
|
-
$[67] = t32;
|
|
370
|
-
$[68] = t33;
|
|
387
|
+
$[65] = t26;
|
|
388
|
+
$[66] = t27;
|
|
389
|
+
$[67] = t29;
|
|
390
|
+
$[68] = t31;
|
|
371
391
|
$[69] = t34;
|
|
372
392
|
$[70] = t35;
|
|
373
393
|
$[71] = t36;
|
|
374
|
-
$[72] =
|
|
375
|
-
$[73] =
|
|
376
|
-
|
|
377
|
-
|
|
394
|
+
$[72] = t37;
|
|
395
|
+
$[73] = t38;
|
|
396
|
+
$[74] = type;
|
|
397
|
+
$[75] = t39;
|
|
398
|
+
} else t39 = $[75];
|
|
399
|
+
return t39;
|
|
378
400
|
}
|
|
379
401
|
export { ScrollArea };
|
|
@@ -9,6 +9,7 @@ interface MobileSelectContentProps {
|
|
|
9
9
|
onMultiChange?: (values: string[]) => void;
|
|
10
10
|
placeholder?: string;
|
|
11
11
|
showSearch?: boolean;
|
|
12
|
+
disabled?: boolean;
|
|
12
13
|
filterOption?: (input: string, option: SelectOption) => boolean;
|
|
13
14
|
notFoundContent?: ReactNode;
|
|
14
15
|
optionRender?: (option: SelectOption, info: {
|
|
@@ -18,7 +19,7 @@ interface MobileSelectContentProps {
|
|
|
18
19
|
/** Enable multi-select checkboxes + Done button flow. */
|
|
19
20
|
multiple?: boolean;
|
|
20
21
|
}
|
|
21
|
-
declare function MobileSelectContentInner({ options, value, onChange, onMultiChange, showSearch, filterOption, notFoundContent, optionRender, onClose, multiple, }: MobileSelectContentProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
declare function MobileSelectContentInner({ options, value, onChange, onMultiChange, showSearch, filterOption, notFoundContent, optionRender, onClose, multiple, disabled, }: MobileSelectContentProps): import("react/jsx-runtime").JSX.Element;
|
|
22
23
|
export { MobileSelectContentInner as MobileSelectContent };
|
|
23
24
|
export interface MobileSelectDrawerProps extends MobileSelectContentProps {
|
|
24
25
|
open: boolean;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { c } from "react
|
|
2
|
+
import { c } from "react-compiler-runtime";
|
|
3
3
|
import { useCallback, useMemo, useState } from "react";
|
|
4
4
|
import { Drawer } from "../drawer/drawer.js";
|
|
5
5
|
import { SearchIcon } from "./select-icons.js";
|
|
6
6
|
import { countLeafOptions, defaultFilter, filterTree } from "./select-model.js";
|
|
7
7
|
import "./mobile-select.css";
|
|
8
|
-
function MobileSelectContentInner({ options, value, onChange, onMultiChange, showSearch, filterOption, notFoundContent = 'No results', optionRender, onClose, multiple }) {
|
|
8
|
+
function MobileSelectContentInner({ options, value, onChange, onMultiChange, showSearch, filterOption, notFoundContent = 'No results', optionRender, onClose, multiple, disabled }) {
|
|
9
9
|
const [search, setSearch] = useState('');
|
|
10
10
|
const valueArray = useMemo(()=>{
|
|
11
11
|
if (multiple) return value ?? [];
|
|
@@ -34,6 +34,7 @@ function MobileSelectContentInner({ options, value, onChange, onMultiChange, sho
|
|
|
34
34
|
filteredOptions
|
|
35
35
|
]);
|
|
36
36
|
const handleSelect = useCallback((optValue)=>{
|
|
37
|
+
if (disabled) return;
|
|
37
38
|
if (multiple) setDraft((prev)=>prev.includes(optValue) ? prev.filter((v)=>v !== optValue) : [
|
|
38
39
|
...prev,
|
|
39
40
|
optValue
|
|
@@ -45,15 +46,18 @@ function MobileSelectContentInner({ options, value, onChange, onMultiChange, sho
|
|
|
45
46
|
}, [
|
|
46
47
|
multiple,
|
|
47
48
|
onChange,
|
|
48
|
-
onClose
|
|
49
|
+
onClose,
|
|
50
|
+
disabled
|
|
49
51
|
]);
|
|
50
52
|
const handleDone = useCallback(()=>{
|
|
53
|
+
if (disabled) return;
|
|
51
54
|
onMultiChange?.(draft);
|
|
52
55
|
onClose();
|
|
53
56
|
}, [
|
|
54
57
|
draft,
|
|
55
58
|
onMultiChange,
|
|
56
|
-
onClose
|
|
59
|
+
onClose,
|
|
60
|
+
disabled
|
|
57
61
|
]);
|
|
58
62
|
let optIndex = 0;
|
|
59
63
|
const renderItem = (opt)=>{
|
|
@@ -63,8 +67,8 @@ function MobileSelectContentInner({ options, value, onChange, onMultiChange, sho
|
|
|
63
67
|
type: "button",
|
|
64
68
|
"data-tao-sheet-item": "",
|
|
65
69
|
"data-tao-selected": isSelected || void 0,
|
|
66
|
-
"data-tao-disabled": opt.disabled || void 0,
|
|
67
|
-
disabled: opt.disabled,
|
|
70
|
+
"data-tao-disabled": disabled || opt.disabled || void 0,
|
|
71
|
+
disabled: disabled || opt.disabled,
|
|
68
72
|
onClick: ()=>{
|
|
69
73
|
handleSelect(opt.value);
|
|
70
74
|
},
|
|
@@ -119,6 +123,7 @@ function MobileSelectContentInner({ options, value, onChange, onMultiChange, sho
|
|
|
119
123
|
/*#__PURE__*/ jsx("input", {
|
|
120
124
|
"data-tao-sheet-search-input": "",
|
|
121
125
|
value: search,
|
|
126
|
+
disabled: disabled,
|
|
122
127
|
onChange: (e)=>setSearch(e.target.value),
|
|
123
128
|
placeholder: "Search..."
|
|
124
129
|
})
|
|
@@ -136,6 +141,7 @@ function MobileSelectContentInner({ options, value, onChange, onMultiChange, sho
|
|
|
136
141
|
children: /*#__PURE__*/ jsx("button", {
|
|
137
142
|
type: "button",
|
|
138
143
|
"data-tao-sheet-done": "",
|
|
144
|
+
disabled: disabled,
|
|
139
145
|
onClick: handleDone,
|
|
140
146
|
children: "Done"
|
|
141
147
|
})
|