@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.
Files changed (152) hide show
  1. package/README.md +9 -1
  2. package/component-manifest.json +38 -4
  3. package/dist/components/alert/alert.js +20 -17
  4. package/dist/components/auto-complete/auto-complete.js +12 -3
  5. package/dist/components/avatar/avatar.js +2 -1
  6. package/dist/components/breadcrumb/breadcrumb.css +4 -0
  7. package/dist/components/breadcrumb/breadcrumb.js +82 -77
  8. package/dist/components/calendar/calendar.d.ts +1 -1
  9. package/dist/components/calendar/calendar.js +51 -33
  10. package/dist/components/card/card-tabs.js +204 -182
  11. package/dist/components/card/card.js +1 -1
  12. package/dist/components/carousel/carousel.js +11 -5
  13. package/dist/components/cascader/cascader.js +16 -4
  14. package/dist/components/collapse/collapse.css +8 -0
  15. package/dist/components/color-picker/color-picker.js +273 -269
  16. package/dist/components/context-menu/context-menu.d.ts +2 -1
  17. package/dist/components/context-menu/context-menu.js +57 -44
  18. package/dist/components/date-picker/calendar/calendar-grid.js +13 -6
  19. package/dist/components/date-picker/calendar/use-calendar.d.ts +2 -2
  20. package/dist/components/date-picker/calendar/use-calendar.js +2 -3
  21. package/dist/components/date-picker/date-localization.d.ts +3 -0
  22. package/dist/components/date-picker/date-localization.js +76 -0
  23. package/dist/components/date-picker/date-picker.css +4 -0
  24. package/dist/components/date-picker/date-picker.d.ts +1 -0
  25. package/dist/components/date-picker/date-picker.js +48 -30
  26. package/dist/components/date-picker/range-picker.d.ts +1 -0
  27. package/dist/components/date-picker/range-picker.js +41 -23
  28. package/dist/components/drawer/drawer.d.ts +2 -1
  29. package/dist/components/drawer/drawer.js +32 -20
  30. package/dist/components/dropdown/dropdown.d.ts +1 -0
  31. package/dist/components/dropdown/dropdown.js +160 -143
  32. package/dist/components/float-button/float-button.js +3 -2
  33. package/dist/components/form/form.js +88 -103
  34. package/dist/components/image/image.js +202 -137
  35. package/dist/components/list/list-pagination.js +148 -147
  36. package/dist/components/mentions/mentions.js +6 -2
  37. package/dist/components/modal/confirm-dialog.js +4 -2
  38. package/dist/components/modal/modal.d.ts +2 -1
  39. package/dist/components/modal/modal.js +387 -375
  40. package/dist/components/pagination/pagination.css +4 -0
  41. package/dist/components/pagination/pagination.js +115 -110
  42. package/dist/components/popconfirm/popconfirm.js +109 -107
  43. package/dist/components/popover/popover.d.ts +2 -1
  44. package/dist/components/popover/popover.js +185 -176
  45. package/dist/components/qr-code/qr-code.js +22 -21
  46. package/dist/components/rate/rate.js +114 -88
  47. package/dist/components/scroll-area/scroll-area.js +132 -120
  48. package/dist/components/segmented/segmented.js +52 -29
  49. package/dist/components/select/mobile-select.d.ts +3 -2
  50. package/dist/components/select/mobile-select.js +54 -48
  51. package/dist/components/select/select-types.d.ts +1 -0
  52. package/dist/components/select/select.js +19 -6
  53. package/dist/components/slider/slider.js +136 -133
  54. package/dist/components/sonner/sonner.js +10 -10
  55. package/dist/components/spinner/spinner.js +1 -1
  56. package/dist/components/splitter/splitter.css +4 -0
  57. package/dist/components/splitter/splitter.js +29 -24
  58. package/dist/components/statistic/statistic.d.ts +2 -0
  59. package/dist/components/statistic/statistic.js +203 -187
  60. package/dist/components/table/table-filter.js +61 -52
  61. package/dist/components/table/table-icons.js +3 -1
  62. package/dist/components/table/table.css +29 -11
  63. package/dist/components/table/table.d.ts +1 -1
  64. package/dist/components/table/table.js +384 -547
  65. package/dist/components/tabs/tabs.js +3 -2
  66. package/dist/components/tag/tag.js +22 -19
  67. package/dist/components/time-picker/time-picker.d.ts +0 -1
  68. package/dist/components/time-picker/time-picker.js +160 -103
  69. package/dist/components/tooltip/tooltip.d.ts +2 -1
  70. package/dist/components/tooltip/tooltip.js +82 -71
  71. package/dist/components/transfer/transfer-list.js +224 -488
  72. package/dist/components/transfer/transfer-parts.js +14 -4
  73. package/dist/components/transfer/transfer-types.d.ts +1 -0
  74. package/dist/components/transfer/transfer.js +23 -20
  75. package/dist/components/tree/tree-keyboard.d.ts +6 -0
  76. package/dist/components/tree/tree-keyboard.js +27 -0
  77. package/dist/components/tree/tree.js +14 -3
  78. package/dist/components/tree-select/select-engine.d.ts +2 -1
  79. package/dist/components/tree-select/select-engine.js +23 -15
  80. package/dist/components/tree-select/tree-select.js +20 -10
  81. package/dist/components/upload/upload.js +30 -26
  82. package/dist/docs/component-docs.d.ts +13 -2
  83. package/dist/docs/components/headless-input-number.doc.d.ts +5 -0
  84. package/dist/docs/components/headless-input-number.doc.js +7 -0
  85. package/dist/docs/components/input-number.doc.d.ts +5 -0
  86. package/dist/docs/components/input-number.doc.js +7 -0
  87. package/dist/docs/components/statistic.doc.d.ts +5 -0
  88. package/dist/docs/components/statistic.doc.js +7 -0
  89. package/dist/docs/components/tao-provider.doc.d.ts +8 -2
  90. package/dist/docs/components/tao-provider.doc.js +16 -3
  91. package/dist/docs/components/tooltip.doc.d.ts +2 -2
  92. package/dist/entries/provider.d.ts +2 -1
  93. package/dist/entries/provider.js +1 -0
  94. package/dist/index.d.ts +2 -1
  95. package/dist/index.js +1 -0
  96. package/dist/locales/ar-EG.d.ts +3 -0
  97. package/dist/locales/ar-EG.js +199 -0
  98. package/dist/locales/create-locale.d.ts +41 -0
  99. package/dist/locales/create-locale.js +88 -0
  100. package/dist/locales/de-DE.d.ts +3 -0
  101. package/dist/locales/de-DE.js +195 -0
  102. package/dist/locales/en-US.d.ts +2 -0
  103. package/dist/locales/en-US.js +194 -0
  104. package/dist/locales/es-ES.d.ts +3 -0
  105. package/dist/locales/es-ES.js +195 -0
  106. package/dist/locales/fr-FR.d.ts +3 -0
  107. package/dist/locales/fr-FR.js +195 -0
  108. package/dist/locales/hi-IN.d.ts +3 -0
  109. package/dist/locales/hi-IN.js +194 -0
  110. package/dist/locales/id-ID.d.ts +3 -0
  111. package/dist/locales/id-ID.js +194 -0
  112. package/dist/locales/index.d.ts +18 -0
  113. package/dist/locales/index.js +17 -0
  114. package/dist/locales/it-IT.d.ts +3 -0
  115. package/dist/locales/it-IT.js +195 -0
  116. package/dist/locales/ja-JP.d.ts +3 -0
  117. package/dist/locales/ja-JP.js +194 -0
  118. package/dist/locales/ko-KR.d.ts +3 -0
  119. package/dist/locales/ko-KR.js +194 -0
  120. package/dist/locales/pt-BR.d.ts +3 -0
  121. package/dist/locales/pt-BR.js +195 -0
  122. package/dist/locales/ru-RU.d.ts +3 -0
  123. package/dist/locales/ru-RU.js +197 -0
  124. package/dist/locales/th-TH.d.ts +3 -0
  125. package/dist/locales/th-TH.js +194 -0
  126. package/dist/locales/tr-TR.d.ts +3 -0
  127. package/dist/locales/tr-TR.js +194 -0
  128. package/dist/locales/types.d.ts +176 -0
  129. package/dist/locales/types.js +0 -0
  130. package/dist/locales/vi-VN.d.ts +3 -0
  131. package/dist/locales/vi-VN.js +194 -0
  132. package/dist/locales/zh-CN.d.ts +3 -0
  133. package/dist/locales/zh-CN.js +194 -0
  134. package/dist/locales/zh-TW.d.ts +3 -0
  135. package/dist/locales/zh-TW.js +194 -0
  136. package/dist/number-input/format.d.ts +4 -3
  137. package/dist/number-input/format.js +9 -7
  138. package/dist/number-input/locale.d.ts +19 -0
  139. package/dist/number-input/locale.js +44 -0
  140. package/dist/number-input/number-input.js +1 -0
  141. package/dist/number-input/use-number-input.d.ts +2 -0
  142. package/dist/number-input/use-number-input.js +180 -176
  143. package/dist/provider/locale.d.ts +3 -65
  144. package/dist/provider/locale.js +2 -146
  145. package/dist/provider/merge-locale.d.ts +8 -0
  146. package/dist/provider/merge-locale.js +53 -0
  147. package/dist/provider/tao-provider.d.ts +16 -5
  148. package/dist/provider/tao-provider.js +200 -92
  149. package/dist/utils/scroll-left.d.ts +3 -0
  150. package/dist/utils/scroll-left.js +7 -0
  151. package/llms.txt +3 -3
  152. 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(76);
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] === Symbol.for("react.memo_cache_sentinel")) {
38
+ if ($[1] !== textDirection) {
35
39
  t8 = ()=>{
36
40
  const el = viewportRef.current;
37
41
  if (!el) return;
38
- const { scrollTop, scrollLeft, scrollHeight, scrollWidth, clientHeight, clientWidth } = el;
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] = t8;
55
- } else t8 = $[1];
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 ($[2] === Symbol.for("react.memo_cache_sentinel")) {
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
- $[2] = t10;
73
- $[3] = t9;
78
+ $[3] = updateScrollState;
79
+ $[4] = t10;
80
+ $[5] = t9;
74
81
  } else {
75
- t10 = $[2];
76
- t9 = $[3];
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 ($[4] !== onScrollEnd || $[5] !== onScrollProp || $[6] !== scrollEndThreshold) {
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
- $[4] = onScrollEnd;
96
- $[5] = onScrollProp;
97
- $[6] = scrollEndThreshold;
98
- $[7] = t11;
99
- } else t11 = $[7];
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 ($[8] === Symbol.for("react.memo_cache_sentinel")) {
112
+ if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
105
113
  t12 = ()=>()=>dragCleanup.current?.();
106
114
  t13 = [];
107
- $[8] = t12;
108
- $[9] = t13;
115
+ $[11] = t12;
116
+ $[12] = t13;
109
117
  } else {
110
- t12 = $[8];
111
- t13 = $[9];
118
+ t12 = $[11];
119
+ t13 = $[12];
112
120
  }
113
121
  useEffect(t12, t13);
114
122
  let t14;
115
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
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.scrollLeft;
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.scrollLeft = nextScroll;
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
- $[10] = t14;
156
- } else t14 = $[10];
163
+ $[13] = t14;
164
+ } else t14 = $[13];
157
165
  const handleThumbPointerDown = t14;
158
166
  let t15;
159
- if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
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.scrollLeft = clickPos * (el_3.scrollWidth - el_3.clientWidth);
175
+ else setScrollLeft(el_3, clickPos * (el_3.scrollWidth - el_3.clientWidth));
168
176
  };
169
- $[11] = t15;
170
- } else t15 = $[11];
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 ($[12] !== t16 || $[13] !== t17) {
185
+ if ($[15] !== t16 || $[16] !== t17) {
178
186
  t18 = {
179
187
  maxHeight: t16,
180
188
  maxWidth: t17
181
189
  };
182
- $[12] = t16;
183
- $[13] = t17;
184
- $[14] = t18;
185
- } else t18 = $[14];
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 ($[15] !== t19 || $[16] !== t20 || $[17] !== t21) {
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
- $[15] = t19;
198
- $[16] = t20;
199
- $[17] = t21;
200
- $[18] = t22;
201
- } else t22 = $[18];
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 ($[19] !== t23 || $[20] !== t24) {
214
+ if ($[22] !== t23 || $[23] !== t24) {
207
215
  t25 = {
208
216
  "--tao-scrollbar-size": t23,
209
217
  "--tao-scrollbar-offset": t24
210
218
  };
211
- $[19] = t23;
212
- $[20] = t24;
213
- $[21] = t25;
214
- } else t25 = $[21];
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 ($[22] !== className || $[23] !== t28) {
228
+ if ($[25] !== className || $[26] !== t28) {
221
229
  t29 = cx(t28, className);
222
- $[22] = className;
223
- $[23] = t28;
224
- $[24] = t29;
225
- } else t29 = $[24];
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 ($[25] !== rootStyle || $[26] !== scrollbarVars || $[27] !== style || $[28] !== t30) {
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
- $[25] = rootStyle;
236
- $[26] = scrollbarVars;
237
- $[27] = style;
238
- $[28] = t30;
239
- $[29] = t31;
240
- } else t31 = $[29];
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 ($[30] !== t32) {
251
+ if ($[33] !== t32) {
244
252
  t33 = cx(t32);
245
- $[30] = t32;
246
- $[31] = t33;
247
- } else t33 = $[31];
253
+ $[33] = t32;
254
+ $[34] = t33;
255
+ } else t33 = $[34];
248
256
  let t34;
249
- if ($[32] !== children || $[33] !== handleScroll || $[34] !== t33 || $[35] !== viewportStyle) {
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
- $[32] = children;
259
- $[33] = handleScroll;
260
- $[34] = t33;
261
- $[35] = viewportStyle;
262
- $[36] = t34;
263
- } else t34 = $[36];
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 ($[37] !== scrollShadow || $[38] !== scrollState.atBottom || $[39] !== scrollState.atTop || $[40] !== showVertical) {
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
- $[37] = scrollShadow;
279
- $[38] = scrollState.atBottom;
280
- $[39] = scrollState.atTop;
281
- $[40] = showVertical;
282
- $[41] = t35;
283
- } else t35 = $[41];
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 ($[42] !== scrollShadow || $[43] !== scrollState.atLeft || $[44] !== scrollState.atRight || $[45] !== showHorizontal) {
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
- $[42] = scrollShadow;
299
- $[43] = scrollState.atLeft;
300
- $[44] = scrollState.atRight;
301
- $[45] = showHorizontal;
302
- $[46] = t36;
303
- } else t36 = $[46];
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 ($[47] !== classNames?.scrollbar || $[48] !== classNames?.thumb || $[49] !== scrollState.hasVertical || $[50] !== scrollState.thumbYOffset || $[51] !== scrollState.thumbYRatio || $[52] !== showVertical || $[53] !== styles?.scrollbar || $[54] !== styles?.thumb) {
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": "Scroll vertically",
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
- $[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];
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 ($[56] !== classNames?.scrollbar || $[57] !== classNames?.thumb || $[58] !== scrollState.hasHorizontal || $[59] !== scrollState.thumbXOffset || $[60] !== scrollState.thumbXRatio || $[61] !== showHorizontal || $[62] !== styles?.scrollbar || $[63] !== styles?.thumb) {
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": "Scroll horizontally",
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
- $[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];
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 ($[65] !== t26 || $[66] !== t27 || $[67] !== t29 || $[68] !== t31 || $[69] !== t34 || $[70] !== t35 || $[71] !== t36 || $[72] !== t37 || $[73] !== t38 || $[74] !== type) {
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
- $[65] = t26;
388
- $[66] = t27;
389
- $[67] = t29;
390
- $[68] = t31;
391
- $[69] = t34;
392
- $[70] = t35;
393
- $[71] = t36;
394
- $[72] = t37;
395
- $[73] = t38;
396
- $[74] = type;
397
- $[75] = t39;
398
- } else t39 = $[75];
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
- value: option,
13
- label: String(option)
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 item = container.querySelector('[data-tao-segmented-item][data-tao-checked]');
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(item);
57
- return ()=>observer.disconnect();
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: root,
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((option_0)=>{
123
- const isDisabled = disabled || option_0.disabled;
124
- const key = `${typeof option_0.value}:${String(option_0.value)}`;
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": option_0.value === selected || void 0,
150
+ "data-tao-checked": option_1.value === selected || void 0,
128
151
  "data-tao-disabled": isDisabled || void 0,
129
- className: cx(classes?.item, option_0.className),
152
+ className: cx(classes?.item, option_1.className),
130
153
  style: slots?.item,
131
- title: option_0.title ?? ('string' == typeof option_0.label || 'number' == typeof option_0.label ? String(option_0.label) : void 0),
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(option_0.value),
137
- checked: option_0.value === selected,
159
+ value: String(option_1.value),
160
+ checked: option_1.value === selected,
138
161
  disabled: isDisabled,
139
- onChange: ()=>select(option_0.value),
140
- "aria-label": void 0 === option_0.label ? String(option_0.value) : 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 !== option_0.icon && /*#__PURE__*/ jsx("span", {
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: option_0.icon
174
+ children: option_1.icon
152
175
  }),
153
- option_0.label
176
+ option_1.label
154
177
  ]
155
178
  })
156
179
  ]
157
180
  }, key);
158
- return option_0.tooltip ? /*#__PURE__*/ jsx(Tooltip, {
159
- ...'string' == typeof option_0.tooltip ? {
160
- title: option_0.tooltip
161
- } : option_0.tooltip,
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;