@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
@@ -116,20 +116,20 @@ function resolveDataType(type, richColors) {
116
116
  if (!richColors) return 'default';
117
117
  return type;
118
118
  }
119
- function getAriaLabel(type) {
119
+ function getAriaLabel(type, messages) {
120
120
  switch(type){
121
121
  case 'success':
122
- return 'Success notification';
122
+ return messages.successNotification;
123
123
  case 'error':
124
- return 'Error notification';
124
+ return messages.errorNotification;
125
125
  case 'warning':
126
- return 'Warning notification';
126
+ return messages.warningNotification;
127
127
  case 'info':
128
- return 'Info notification';
128
+ return messages.infoNotification;
129
129
  case 'loading':
130
- return 'Loading notification';
130
+ return messages.loadingNotification;
131
131
  default:
132
- return 'Notification';
132
+ return messages.notification;
133
133
  }
134
134
  }
135
135
  function renderPromiseState(stateValue, payload) {
@@ -138,7 +138,6 @@ function renderPromiseState(stateValue, payload) {
138
138
  return stateValue;
139
139
  }
140
140
  function Sonner({ position = 'bottom-right', visibleToasts = 3, offset = 24, gap = 12, expand = true, richColors = false, closeButton = false, duration = 4000, className, style, classNames, styles }) {
141
- useTaoConfig();
142
141
  const snapshot = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
143
142
  const [heights, setHeights] = useState(()=>new Map());
144
143
  useEffect(()=>{
@@ -197,6 +196,7 @@ function Sonner({ position = 'bottom-right', visibleToasts = 3, offset = 24, gap
197
196
  });
198
197
  }
199
198
  function ToastView({ toast, richColors, showClose, yPosition, index, visibleToasts, expanded, offset, frontToastHeight, setHeights, classNames, styles }) {
199
+ const { locale: { messages } } = useTaoConfig();
200
200
  const [mounted, setMounted] = useState(false);
201
201
  const [offsetBeforeRemove, setOffsetBeforeRemove] = useState(0);
202
202
  const ref = useRef(null);
@@ -245,7 +245,7 @@ function ToastView({ toast, richColors, showClose, yPosition, index, visibleToas
245
245
  className: cx(classNames?.toast),
246
246
  role: "status",
247
247
  "aria-live": "polite",
248
- "aria-label": getAriaLabel(toast.type),
248
+ "aria-label": getAriaLabel(toast.type, messages),
249
249
  "data-tao-sonner-toast": "",
250
250
  "data-tao-type": resolveDataType(toast.type, richColors),
251
251
  "data-tao-mounted": mounted,
@@ -312,7 +312,7 @@ function ToastView({ toast, richColors, showClose, yPosition, index, visibleToas
312
312
  }) : null,
313
313
  showClose ? /*#__PURE__*/ jsx("button", {
314
314
  type: "button",
315
- "aria-label": "Close notification",
315
+ "aria-label": messages.closeNotification,
316
316
  className: cx(classNames?.close),
317
317
  style: styles?.close,
318
318
  "data-tao-sonner-close": "",
@@ -56,7 +56,7 @@ function Spinner(t0) {
56
56
  $[10] = styles?.root;
57
57
  $[11] = t8;
58
58
  } else t8 = $[11];
59
- const t9 = ariaLabel ?? (null != tip || ariaLabelledBy ? void 0 : "Loading");
59
+ const t9 = ariaLabel ?? (null != tip || ariaLabelledBy ? void 0 : ctx.locale.messages.loading);
60
60
  const t10 = classNames?.indicator;
61
61
  let t11;
62
62
  if ($[12] !== t10) {
@@ -149,3 +149,7 @@
149
149
  transform: rotate(-90deg);
150
150
  }
151
151
 
152
+ [data-tao-splitter]:dir(rtl) [data-tao-splitter-collapse][data-tao-orientation="horizontal"] {
153
+ transform: scaleX(-1);
154
+ }
155
+
@@ -3,6 +3,7 @@ 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 "./splitter.css";
6
+ import { useTaoConfig } from "../../provider/tao-provider.js";
6
7
  function parseSize(value, total) {
7
8
  if (void 0 === value) return;
8
9
  if ('number' == typeof value) return value;
@@ -83,9 +84,10 @@ function Panel(_props) {
83
84
  return null;
84
85
  }
85
86
  function Splitter(t0) {
86
- const $ = c(71);
87
+ const $ = c(72);
87
88
  const { orientation: t1, onResize, onResizeEnd, onResizeStart, className, classNames, styles, children } = t0;
88
89
  const orientation = void 0 === t1 ? "horizontal" : t1;
90
+ const { locale } = useTaoConfig();
89
91
  const containerRef = useRef(null);
90
92
  let t2;
91
93
  if ($[0] !== children) {
@@ -221,6 +223,7 @@ function Splitter(t0) {
221
223
  dragCleanup.current?.();
222
224
  const pos = isHorizontal ? e.clientX : e.clientY;
223
225
  const pointerId = e.pointerId;
226
+ const sign = isHorizontal && "rtl" === getComputedStyle(containerRef.current).direction ? -1 : 1;
224
227
  const startSizes_0 = [
225
228
  ...sizes
226
229
  ];
@@ -228,7 +231,7 @@ function Splitter(t0) {
228
231
  onResizeStart?.(sizes);
229
232
  const handleMove = (ev)=>{
230
233
  if (ev.pointerId !== pointerId) return;
231
- const delta_0 = (isHorizontal ? ev.clientX : ev.clientY) - pos;
234
+ const delta_0 = ((isHorizontal ? ev.clientX : ev.clientY) - pos) * sign;
232
235
  const next_1 = resizePanels(index_0, delta_0, startSizes_0);
233
236
  currentSizes = next_1;
234
237
  setSizes(next_1);
@@ -262,8 +265,9 @@ function Splitter(t0) {
262
265
  let t12;
263
266
  if ($[25] !== isHorizontal || $[26] !== onResize || $[27] !== onResizeEnd || $[28] !== onResizeStart || $[29] !== resizePanels || $[30] !== sizes) {
264
267
  t12 = (index_1, event)=>{
265
- const growKey = isHorizontal ? "ArrowRight" : "ArrowDown";
266
- const shrinkKey = isHorizontal ? "ArrowLeft" : "ArrowUp";
268
+ const rtl = "rtl" === getComputedStyle(event.currentTarget).direction;
269
+ const growKey = isHorizontal ? rtl ? "ArrowLeft" : "ArrowRight" : "ArrowDown";
270
+ const shrinkKey = isHorizontal ? rtl ? "ArrowRight" : "ArrowLeft" : "ArrowUp";
267
271
  if (event.key !== growKey && event.key !== shrinkKey) return;
268
272
  event.preventDefault();
269
273
  const delta_1 = event.key === growKey ? 10 : -10;
@@ -377,7 +381,7 @@ function Splitter(t0) {
377
381
  } else t16 = $[49];
378
382
  const t17 = styles?.root;
379
383
  let t18;
380
- if ($[50] !== classNames?.dragger || $[51] !== classNames?.panel || $[52] !== containerSize || $[53] !== getDraggerCollapse || $[54] !== handleCollapse || $[55] !== handleDragStart || $[56] !== handleDraggerKeyDown || $[57] !== isHorizontal || $[58] !== orientation || $[59] !== panelChildren || $[60] !== panelCount || $[61] !== panels || $[62] !== sizes || $[63] !== styles?.dragger || $[64] !== styles?.panel) {
384
+ if ($[50] !== classNames?.dragger || $[51] !== classNames?.panel || $[52] !== containerSize || $[53] !== getDraggerCollapse || $[54] !== handleCollapse || $[55] !== handleDragStart || $[56] !== handleDraggerKeyDown || $[57] !== isHorizontal || $[58] !== locale || $[59] !== orientation || $[60] !== panelChildren || $[61] !== panelCount || $[62] !== panels || $[63] !== sizes || $[64] !== styles?.dragger || $[65] !== styles?.panel) {
381
385
  t18 = panels.map((panel, i_0)=>{
382
386
  const sizeStyle = isHorizontal ? {
383
387
  width: sizes[i_0],
@@ -415,7 +419,7 @@ function Splitter(t0) {
415
419
  "data-tao-splitter-dragger": "",
416
420
  "data-tao-orientation": orientation,
417
421
  role: "separator",
418
- "aria-label": `Resize panels ${i_0 + 1} and ${i_0 + 2}`,
422
+ "aria-label": locale.messages.resizePanels(i_0 + 1, i_0 + 2),
419
423
  "aria-orientation": isHorizontal ? "vertical" : "horizontal",
420
424
  "aria-valuemin": Math.round(valueMin),
421
425
  "aria-valuemax": Math.round(valueMax),
@@ -442,7 +446,7 @@ function Splitter(t0) {
442
446
  "data-tao-splitter-collapse": "",
443
447
  "data-tao-collapse-direction": "start",
444
448
  "data-tao-orientation": orientation,
445
- "aria-label": "Collapse panel",
449
+ "aria-label": locale.messages.collapsePanel,
446
450
  onClick: ()=>handleCollapse(i_0, "start"),
447
451
  children: /*#__PURE__*/ jsx(CollapseIcon, {
448
452
  direction: sizes[i_0] <= 0 ? "end" : "start",
@@ -454,7 +458,7 @@ function Splitter(t0) {
454
458
  "data-tao-splitter-collapse": "",
455
459
  "data-tao-collapse-direction": "end",
456
460
  "data-tao-orientation": orientation,
457
- "aria-label": "Collapse panel",
461
+ "aria-label": locale.messages.collapsePanel,
458
462
  onClick: ()=>handleCollapse(i_0, "end"),
459
463
  children: /*#__PURE__*/ jsx(CollapseIcon, {
460
464
  direction: sizes[i_0 + 1] <= 0 ? "start" : "end",
@@ -477,17 +481,18 @@ function Splitter(t0) {
477
481
  $[55] = handleDragStart;
478
482
  $[56] = handleDraggerKeyDown;
479
483
  $[57] = isHorizontal;
480
- $[58] = orientation;
481
- $[59] = panelChildren;
482
- $[60] = panelCount;
483
- $[61] = panels;
484
- $[62] = sizes;
485
- $[63] = styles?.dragger;
486
- $[64] = styles?.panel;
487
- $[65] = t18;
488
- } else t18 = $[65];
484
+ $[58] = locale;
485
+ $[59] = orientation;
486
+ $[60] = panelChildren;
487
+ $[61] = panelCount;
488
+ $[62] = panels;
489
+ $[63] = sizes;
490
+ $[64] = styles?.dragger;
491
+ $[65] = styles?.panel;
492
+ $[66] = t18;
493
+ } else t18 = $[66];
489
494
  let t19;
490
- if ($[66] !== orientation || $[67] !== t16 || $[68] !== t17 || $[69] !== t18) {
495
+ if ($[67] !== orientation || $[68] !== t16 || $[69] !== t17 || $[70] !== t18) {
491
496
  t19 = /*#__PURE__*/ jsx("div", {
492
497
  ref: containerRef,
493
498
  "data-tao-splitter": "",
@@ -496,12 +501,12 @@ function Splitter(t0) {
496
501
  style: t17,
497
502
  children: t18
498
503
  });
499
- $[66] = orientation;
500
- $[67] = t16;
501
- $[68] = t17;
502
- $[69] = t18;
503
- $[70] = t19;
504
- } else t19 = $[70];
504
+ $[67] = orientation;
505
+ $[68] = t16;
506
+ $[69] = t17;
507
+ $[70] = t18;
508
+ $[71] = t19;
509
+ } else t19 = $[71];
505
510
  return t19;
506
511
  }
507
512
  Splitter.Panel = Panel;
@@ -4,6 +4,8 @@ import './statistic.css';
4
4
  export type StatisticValue = number | string;
5
5
  export type StatisticSemanticPart = 'root' | 'content' | 'value' | 'title' | 'header' | 'prefix' | 'suffix';
6
6
  export interface StatisticFormatConfig {
7
+ /** BCP 47 locale. Defaults to the provider's number locale. */
8
+ locale?: string;
7
9
  formatter?: false | 'number' | 'countdown' | ((value: StatisticValue, config?: StatisticFormatConfig) => ReactNode);
8
10
  decimalSeparator?: string;
9
11
  groupSeparator?: string;