@rockshin/tao-ui 0.0.58 → 0.0.59

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 (93) hide show
  1. package/dist/components/affix/affix.js +38 -4
  2. package/dist/components/app/app-modals.js +11 -6
  3. package/dist/components/app/app-notices.js +105 -47
  4. package/dist/components/auto-complete/auto-complete.js +9 -2
  5. package/dist/components/calendar/calendar.js +22 -18
  6. package/dist/components/carousel/carousel.js +27 -14
  7. package/dist/components/cascader/cascader.js +17 -12
  8. package/dist/components/checkbox/checkbox.d.ts +3 -1
  9. package/dist/components/checkbox/checkbox.js +65 -58
  10. package/dist/components/color-picker/color-picker.js +383 -360
  11. package/dist/components/date-picker/calendar/calendar-grid.d.ts +5 -3
  12. package/dist/components/date-picker/calendar/calendar-grid.js +9 -4
  13. package/dist/components/date-picker/calendar/month-grid.d.ts +2 -1
  14. package/dist/components/date-picker/calendar/month-grid.js +61 -45
  15. package/dist/components/date-picker/calendar/time-panel.d.ts +8 -1
  16. package/dist/components/date-picker/calendar/time-panel.js +89 -88
  17. package/dist/components/date-picker/calendar/year-grid.d.ts +2 -1
  18. package/dist/components/date-picker/calendar/year-grid.js +60 -44
  19. package/dist/components/date-picker/date-picker.css +9 -0
  20. package/dist/components/date-picker/date-picker.js +22 -13
  21. package/dist/components/date-picker/range-picker.d.ts +2 -0
  22. package/dist/components/date-picker/range-picker.js +127 -70
  23. package/dist/components/date-picker/types.js +1 -1
  24. package/dist/components/drawer/drawer.d.ts +1 -1
  25. package/dist/components/drawer/drawer.js +4 -3
  26. package/dist/components/dropdown/dropdown.js +11 -9
  27. package/dist/components/float-button/float-button.js +4 -4
  28. package/dist/components/form/form-item.d.ts +1 -1
  29. package/dist/components/form/form-item.js +160 -120
  30. package/dist/components/form-field/form-field-view.d.ts +2 -1
  31. package/dist/components/form-field/form-field-view.js +173 -108
  32. package/dist/components/input/input-shared.js +3 -2
  33. package/dist/components/input/otp.js +114 -110
  34. package/dist/components/input/password.js +55 -61
  35. package/dist/components/input/search.js +8 -4
  36. package/dist/components/mentions/mentions.js +1 -0
  37. package/dist/components/menu/menu-render.js +1 -0
  38. package/dist/components/modal/confirm-dialog.js +11 -4
  39. package/dist/components/modal/modal.js +320 -315
  40. package/dist/components/pagination/pagination.d.ts +1 -0
  41. package/dist/components/pagination/pagination.js +1 -0
  42. package/dist/components/popover/popover.js +325 -289
  43. package/dist/components/qr-code/qr-code.js +157 -150
  44. package/dist/components/radio/radio.d.ts +3 -1
  45. package/dist/components/radio/radio.js +73 -64
  46. package/dist/components/select/mobile-select.js +6 -3
  47. package/dist/components/select/select-model.js +2 -2
  48. package/dist/components/select/select.js +78 -39
  49. package/dist/components/select/use-select-selection.js +58 -58
  50. package/dist/components/slider/slider.d.ts +2 -2
  51. package/dist/components/slider/slider.js +13 -2
  52. package/dist/components/sonner/sonner.js +2 -2
  53. package/dist/components/splitter/splitter.css +1 -0
  54. package/dist/components/splitter/splitter.js +152 -126
  55. package/dist/components/switch/switch.js +45 -39
  56. package/dist/components/table/table.js +1 -0
  57. package/dist/components/table/use-table-data.js +2 -2
  58. package/dist/components/time-picker/time-picker.js +31 -1
  59. package/dist/components/tooltip/tooltip.js +237 -99
  60. package/dist/components/tree/tree.js +31 -3
  61. package/dist/components/tree-select/tree-select.js +1 -1
  62. package/dist/components/upload/upload.js +67 -40
  63. package/dist/locales/ar-EG.js +2 -0
  64. package/dist/locales/de-DE.js +2 -0
  65. package/dist/locales/en-US.js +2 -0
  66. package/dist/locales/es-ES.js +2 -0
  67. package/dist/locales/fr-FR.js +2 -0
  68. package/dist/locales/hi-IN.js +2 -0
  69. package/dist/locales/id-ID.js +2 -0
  70. package/dist/locales/it-IT.js +2 -0
  71. package/dist/locales/ja-JP.js +2 -0
  72. package/dist/locales/ko-KR.js +2 -0
  73. package/dist/locales/pt-BR.js +2 -0
  74. package/dist/locales/ru-RU.js +2 -0
  75. package/dist/locales/th-TH.js +2 -0
  76. package/dist/locales/tr-TR.js +2 -0
  77. package/dist/locales/types.d.ts +2 -0
  78. package/dist/locales/vi-VN.js +2 -0
  79. package/dist/locales/zh-CN.js +2 -0
  80. package/dist/locales/zh-TW.js +2 -0
  81. package/dist/number-input/format.js +1 -1
  82. package/dist/number-input/use-number-input.js +166 -321
  83. package/dist/number-input/validate.d.ts +1 -0
  84. package/dist/number-input/validate.js +1 -1
  85. package/dist/provider/tao-provider.d.ts +2 -2
  86. package/dist/provider/tao-provider.js +49 -49
  87. package/dist/utils/composed-parent.d.ts +1 -0
  88. package/dist/utils/composed-parent.js +7 -0
  89. package/dist/utils/portal.d.ts +5 -0
  90. package/dist/utils/portal.js +7 -1
  91. package/dist/utils/refs.d.ts +3 -1
  92. package/dist/utils/refs.js +25 -1
  93. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useCallback, useId, useImperativeHandle, useMemo, useRef, useState } from "react";
2
+ import { forwardRef, useCallback, useEffect, useId, useImperativeHandle, useMemo, useRef, useState } from "react";
3
3
  import { TaoPortalScope, useTaoConfig, useTaoDirection } from "../../provider/tao-provider.js";
4
4
  import { mergeRefs } from "../../utils/refs.js";
5
5
  import { cx } from "../../utils/semantic.js";
@@ -57,6 +57,10 @@ const select_Select = /*#__PURE__*/ forwardRef(function(props, ref) {
57
57
  const searchListboxId = useId();
58
58
  const isMultiple = 'multiple' === mode || 'tags' === mode;
59
59
  const hasInlineSearch = !!showSearch && !isMobile;
60
+ const autoFocusTrigger = useRef(autoFocus && !hasInlineSearch && !resolvedDisabled);
61
+ useEffect(()=>{
62
+ if (autoFocusTrigger.current) triggerRef.current?.focus();
63
+ }, []);
60
64
  useImperativeHandle(ref, ()=>({
61
65
  focus: ()=>(hasInlineSearch ? inputRef.current : triggerRef.current)?.focus(),
62
66
  blur: ()=>(hasInlineSearch ? inputRef.current : triggerRef.current)?.blur(),
@@ -70,14 +74,21 @@ const select_Select = /*#__PURE__*/ forwardRef(function(props, ref) {
70
74
  const isSearchControlled = void 0 !== searchValueProp;
71
75
  const [searchInternal, setSearchInternal] = useState('');
72
76
  const search = isSearchControlled ? searchValueProp : searchInternal;
77
+ const [activeSearch, setActiveSearch] = useState(()=>({
78
+ index: 0,
79
+ value: isMultiple ? void 0 : value
80
+ }));
73
81
  const [previousOpen, setPreviousOpen] = useState(requestedOpen);
74
- if (previousOpen !== requestedOpen) {
82
+ const [previousValue, setPreviousValue] = useState(value);
83
+ if (previousOpen !== requestedOpen || !isMultiple && previousValue !== value) {
84
+ if (previousOpen !== requestedOpen && !requestedOpen && !isSearchControlled) setSearchInternal('');
75
85
  setPreviousOpen(requestedOpen);
76
- if (!requestedOpen && !isSearchControlled) setSearchInternal('');
86
+ setPreviousValue(value);
87
+ if (!requestedOpen && !isMultiple && value) setActiveSearch({
88
+ index: 0,
89
+ value: value
90
+ });
77
91
  }
78
- const [activeSearch, setActiveSearch] = useState({
79
- index: 0
80
- });
81
92
  const composingRef = useRef(false);
82
93
  const isComposingKey = useCallback((event)=>composingRef.current || event.isComposing || 229 === event.keyCode, []);
83
94
  const handleEscapeKeyDown = useCallback((event_0)=>{
@@ -86,6 +97,7 @@ const select_Select = /*#__PURE__*/ forwardRef(function(props, ref) {
86
97
  isComposingKey
87
98
  ]);
88
99
  const suppressCloseRef = useRef(false);
100
+ const repeatedOptionRef = useRef(void 0);
89
101
  const handleValueChange = useCallback((next)=>{
90
102
  if (resolvedDisabled) return;
91
103
  if (isMultiple && !hasInlineSearch) suppressCloseRef.current = true;
@@ -101,6 +113,11 @@ const select_Select = /*#__PURE__*/ forwardRef(function(props, ref) {
101
113
  ]);
102
114
  const handleOpenChange = useCallback((next_0)=>{
103
115
  if (next_0 && resolvedDisabled) return;
116
+ if (!next_0 && void 0 !== repeatedOptionRef.current) {
117
+ const selected = repeatedOptionRef.current;
118
+ repeatedOptionRef.current = void 0;
119
+ handleValueChange(selected);
120
+ }
104
121
  if (isMultiple && !hasInlineSearch && !next_0 && suppressCloseRef.current) {
105
122
  suppressCloseRef.current = false;
106
123
  return;
@@ -113,6 +130,7 @@ const select_Select = /*#__PURE__*/ forwardRef(function(props, ref) {
113
130
  if (next_0 && showSearch && !isMobile) setTimeout(()=>inputRef.current?.focus(), 0);
114
131
  onOpenChange?.(next_0);
115
132
  }, [
133
+ handleValueChange,
116
134
  isMultiple,
117
135
  hasInlineSearch,
118
136
  isOpenControlled,
@@ -132,10 +150,11 @@ const select_Select = /*#__PURE__*/ forwardRef(function(props, ref) {
132
150
  if (isComposingKey(e.nativeEvent)) return;
133
151
  if (!isMultiple || !tokenSeparators || 0 === tokenSeparators.length) return;
134
152
  const value_0 = e.target.value;
135
- const sep = tokenSeparators.find((s)=>s && value_0.includes(s));
136
- if (!sep) return;
137
- e.preventDefault();
138
- if (addTokens(value_0) && !isSearchControlled) setSearchInternal('');
153
+ const separatorKey = tokenSeparators.includes(e.key);
154
+ if (!separatorKey && ('Enter' !== e.key || !tokenSeparators.some((s)=>s && value_0.includes(s)))) return;
155
+ const added = addTokens(value_0);
156
+ if (added || !separatorKey) e.preventDefault();
157
+ if (added && !isSearchControlled) setSearchInternal('');
139
158
  }, [
140
159
  isMultiple,
141
160
  tokenSeparators,
@@ -153,6 +172,7 @@ const select_Select = /*#__PURE__*/ forwardRef(function(props, ref) {
153
172
  e_1.stopPropagation();
154
173
  e_1.preventDefault();
155
174
  removeValue(removedValue);
175
+ if ('keydown' === e_1.type) (inputRef.current ?? triggerRef.current)?.focus();
156
176
  }, [
157
177
  removeValue
158
178
  ]);
@@ -289,6 +309,17 @@ const select_Select = /*#__PURE__*/ forwardRef(function(props, ref) {
289
309
  ]
290
310
  })
291
311
  });
312
+ const hiddenInputs = name && (isMultiple ? valueArray.map((item)=>/*#__PURE__*/ jsx("input", {
313
+ type: "hidden",
314
+ name: name,
315
+ value: item,
316
+ disabled: resolvedDisabled
317
+ }, item)) : /*#__PURE__*/ jsx("input", {
318
+ type: "hidden",
319
+ name: name,
320
+ value: value ?? '',
321
+ disabled: resolvedDisabled
322
+ }));
292
323
  if (isMobile) return /*#__PURE__*/ jsxs(Fragment, {
293
324
  children: [
294
325
  /*#__PURE__*/ jsxs("div", {
@@ -302,7 +333,6 @@ const select_Select = /*#__PURE__*/ forwardRef(function(props, ref) {
302
333
  "data-tao-variant": resolvedVariant,
303
334
  "data-tao-disabled": resolvedDisabled || void 0,
304
335
  ...statusProps,
305
- autoFocus: autoFocus,
306
336
  role: "button",
307
337
  tabIndex: resolvedDisabled ? void 0 : 0,
308
338
  ...ariaProps,
@@ -362,6 +392,7 @@ const select_Select = /*#__PURE__*/ forwardRef(function(props, ref) {
362
392
  trailingIcons
363
393
  ]
364
394
  }),
395
+ hiddenInputs,
365
396
  /*#__PURE__*/ jsx(MobileSelectDrawer, {
366
397
  direction: direction,
367
398
  mobileTitle: props.mobileTitle,
@@ -417,9 +448,21 @@ const select_Select = /*#__PURE__*/ forwardRef(function(props, ref) {
417
448
  const textLabel = 'string' == typeof opt.label ? opt.label : String(opt.label);
418
449
  const isSelected = selectedValueSet.has(opt.value);
419
450
  const itemDisabled = resolvedDisabled || opt.disabled || !isSelected && overMaxCount;
451
+ const markReselection = ()=>{
452
+ repeatedOptionRef.current = opt.value;
453
+ queueMicrotask(()=>{
454
+ repeatedOptionRef.current = void 0;
455
+ });
456
+ };
457
+ const reselectable = !isMultiple && isSelected && !itemDisabled;
420
458
  return /*#__PURE__*/ jsxs(__rspack_external__radix_ui_react_select_4606f4d3.Item, {
421
459
  value: opt.value,
422
460
  disabled: itemDisabled,
461
+ onPointerUp: reselectable ? markReselection : void 0,
462
+ onClick: reselectable ? markReselection : void 0,
463
+ onKeyDown: reselectable ? (event_2)=>{
464
+ if ('Enter' === event_2.key || ' ' === event_2.key) markReselection();
465
+ } : void 0,
423
466
  "data-tao-select-item": "",
424
467
  "data-tao-label-wrap": optionLabelWrap || void 0,
425
468
  "data-tao-has-desc": null != opt.description || void 0,
@@ -564,45 +607,45 @@ const select_Select = /*#__PURE__*/ forwardRef(function(props, ref) {
564
607
  onBlur: ()=>{
565
608
  composingRef.current = false;
566
609
  },
567
- onClick: (event_2)=>{
568
- if (open) event_2.stopPropagation();
610
+ onClick: (event_3)=>{
611
+ if (open) event_3.stopPropagation();
569
612
  },
570
- onChange: (event_3)=>{
571
- handleSearchChange(event_3.target.value);
613
+ onChange: (event_4)=>{
614
+ handleSearchChange(event_4.target.value);
572
615
  setActiveSearch({
573
- index: 0
616
+ index: 'tags' === mode ? -1 : 0
574
617
  });
575
618
  if (!open) handleOpenChange(true);
576
619
  },
577
- onKeyDown: (event_4)=>{
578
- event_4.stopPropagation();
579
- if (isComposingKey(event_4.nativeEvent)) return;
580
- handleSearchKeyDown(event_4);
581
- if (event_4.defaultPrevented) return;
582
- if ('Escape' === event_4.key) {
620
+ onKeyDown: (event_5)=>{
621
+ event_5.stopPropagation();
622
+ if (isComposingKey(event_5.nativeEvent)) return;
623
+ handleSearchKeyDown(event_5);
624
+ if (event_5.defaultPrevented) return;
625
+ if ('Escape' === event_5.key) {
583
626
  handleSearchChange('');
584
627
  handleOpenChange(false);
585
628
  return;
586
629
  }
587
- if ('ArrowDown' === event_4.key) {
588
- event_4.preventDefault();
630
+ if ('ArrowDown' === event_5.key) {
631
+ event_5.preventDefault();
589
632
  setActiveSearchIndex(Math.min(boundedSearchIndex + 1, lastSearchIndex));
590
633
  if (!open) handleOpenChange(true);
591
634
  return;
592
635
  }
593
- if ('ArrowUp' === event_4.key) {
594
- event_4.preventDefault();
636
+ if ('ArrowUp' === event_5.key) {
637
+ event_5.preventDefault();
595
638
  setActiveSearchIndex(Math.max(boundedSearchIndex - 1, 0));
596
639
  return;
597
640
  }
598
- if ('Enter' === event_4.key && !requestedOpen) {
599
- event_4.preventDefault();
641
+ if ('Enter' === event_5.key && !requestedOpen) {
642
+ event_5.preventDefault();
600
643
  handleOpenChange(true);
601
644
  return;
602
645
  }
603
646
  const nextValue = activeSearchOption?.value ?? ('tags' === mode ? search.trim() : void 0);
604
- if ('Enter' === event_4.key && nextValue) {
605
- event_4.preventDefault();
647
+ if ('Enter' === event_5.key && nextValue) {
648
+ event_5.preventDefault();
606
649
  handleValueChange(nextValue);
607
650
  if (!isMultiple) handleOpenChange(false);
608
651
  }
@@ -682,12 +725,7 @@ const select_Select = /*#__PURE__*/ forwardRef(function(props, ref) {
682
725
  ]
683
726
  })
684
727
  }),
685
- name && !isMultiple && /*#__PURE__*/ jsx("input", {
686
- type: "hidden",
687
- name: name,
688
- value: value ?? '',
689
- disabled: resolvedDisabled
690
- }),
728
+ hiddenInputs,
691
729
  /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_popover_c8444160.Portal, {
692
730
  container: container,
693
731
  children: /*#__PURE__*/ jsx(TaoPortalScope, {
@@ -703,9 +741,9 @@ const select_Select = /*#__PURE__*/ forwardRef(function(props, ref) {
703
741
  align: align,
704
742
  sideOffset: 4,
705
743
  onEscapeKeyDown: handleEscapeKeyDown,
706
- onOpenAutoFocus: (event_5)=>event_5.preventDefault(),
707
- onCloseAutoFocus: (event_6)=>{
708
- event_6.preventDefault();
744
+ onOpenAutoFocus: (event_6)=>event_6.preventDefault(),
745
+ onCloseAutoFocus: (event_7)=>{
746
+ event_7.preventDefault();
709
747
  inputRef.current?.focus();
710
748
  },
711
749
  children: popupRender ? popupRender(searchableMenuNode) : searchableMenuNode
@@ -785,6 +823,7 @@ const select_Select = /*#__PURE__*/ forwardRef(function(props, ref) {
785
823
  ]
786
824
  })
787
825
  }),
826
+ isMultiple && hiddenInputs,
788
827
  /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_select_4606f4d3.Portal, {
789
828
  container: container,
790
829
  children: /*#__PURE__*/ jsx(TaoPortalScope, {
@@ -69,12 +69,12 @@ function useSelectSelection(props, disabled) {
69
69
  } else t4 = $[14];
70
70
  const publish = t4;
71
71
  let t5;
72
- if ($[15] !== disabled || $[16] !== maxCount || $[17] !== multiple || $[18] !== onDeselect || $[19] !== onSelect || $[20] !== optionByValue || $[21] !== publish || $[22] !== selectedValueSet || $[23] !== valueArray) {
72
+ if ($[15] !== disabled || $[16] !== maxCount || $[17] !== multiple || $[18] !== onDeselect || $[19] !== onSelect || $[20] !== optionByValue || $[21] !== publish || $[22] !== selectedValueSet || $[23] !== value || $[24] !== valueArray) {
73
73
  t5 = (next_0)=>{
74
74
  if (disabled) return false;
75
75
  const option_0 = optionByValue.get(next_0);
76
76
  if (!multiple) {
77
- publish(next_0);
77
+ if (next_0 !== value) publish(next_0);
78
78
  if (option_0) onSelect?.(next_0, option_0);
79
79
  return true;
80
80
  }
@@ -97,12 +97,13 @@ function useSelectSelection(props, disabled) {
97
97
  $[20] = optionByValue;
98
98
  $[21] = publish;
99
99
  $[22] = selectedValueSet;
100
- $[23] = valueArray;
101
- $[24] = t5;
102
- } else t5 = $[24];
100
+ $[23] = value;
101
+ $[24] = valueArray;
102
+ $[25] = t5;
103
+ } else t5 = $[25];
103
104
  const select = t5;
104
105
  let t6;
105
- if ($[25] !== disabled || $[26] !== maxCount || $[27] !== mode || $[28] !== onSelect || $[29] !== optionByToken || $[30] !== optionByValue || $[31] !== publish || $[32] !== selectedValueSet || $[33] !== tokenSeparators || $[34] !== valueArray) {
106
+ if ($[26] !== disabled || $[27] !== maxCount || $[28] !== mode || $[29] !== onSelect || $[30] !== optionByToken || $[31] !== optionByValue || $[32] !== publish || $[33] !== selectedValueSet || $[34] !== tokenSeparators || $[35] !== valueArray) {
106
107
  t6 = (input)=>{
107
108
  if (disabled) return false;
108
109
  const tokens = (tokenSeparators ?? []).reduce(_temp2, [
@@ -132,37 +133,37 @@ function useSelectSelection(props, disabled) {
132
133
  }
133
134
  return true;
134
135
  };
135
- $[25] = disabled;
136
- $[26] = maxCount;
137
- $[27] = mode;
138
- $[28] = onSelect;
139
- $[29] = optionByToken;
140
- $[30] = optionByValue;
141
- $[31] = publish;
142
- $[32] = selectedValueSet;
143
- $[33] = tokenSeparators;
144
- $[34] = valueArray;
145
- $[35] = t6;
146
- } else t6 = $[35];
136
+ $[26] = disabled;
137
+ $[27] = maxCount;
138
+ $[28] = mode;
139
+ $[29] = onSelect;
140
+ $[30] = optionByToken;
141
+ $[31] = optionByValue;
142
+ $[32] = publish;
143
+ $[33] = selectedValueSet;
144
+ $[34] = tokenSeparators;
145
+ $[35] = valueArray;
146
+ $[36] = t6;
147
+ } else t6 = $[36];
147
148
  const addTokens = t6;
148
149
  let t7;
149
- if ($[36] !== multiple || $[37] !== onDeselect || $[38] !== optionByValue || $[39] !== publish || $[40] !== valueArray) {
150
+ if ($[37] !== multiple || $[38] !== onDeselect || $[39] !== optionByValue || $[40] !== publish || $[41] !== valueArray) {
150
151
  t7 = (removed)=>{
151
152
  if (!multiple) return;
152
153
  publish(valueArray.filter((item_1)=>item_1 !== removed));
153
154
  const option_3 = optionByValue.get(removed);
154
155
  if (option_3) onDeselect?.(removed, option_3);
155
156
  };
156
- $[36] = multiple;
157
- $[37] = onDeselect;
158
- $[38] = optionByValue;
159
- $[39] = publish;
160
- $[40] = valueArray;
161
- $[41] = t7;
162
- } else t7 = $[41];
157
+ $[37] = multiple;
158
+ $[38] = onDeselect;
159
+ $[39] = optionByValue;
160
+ $[40] = publish;
161
+ $[41] = valueArray;
162
+ $[42] = t7;
163
+ } else t7 = $[42];
163
164
  const remove = t7;
164
165
  let t8;
165
- if ($[42] !== disabled || $[43] !== maxCount || $[44] !== mode || $[45] !== onDeselect || $[46] !== onSelect || $[47] !== optionByValue || $[48] !== publish || $[49] !== selectedValueSet || $[50] !== valueArray) {
166
+ if ($[43] !== disabled || $[44] !== maxCount || $[45] !== mode || $[46] !== onDeselect || $[47] !== onSelect || $[48] !== optionByValue || $[49] !== publish || $[50] !== selectedValueSet || $[51] !== valueArray) {
166
167
  t8 = (draft)=>{
167
168
  if (disabled) return;
168
169
  const nextArray_1 = draft.filter((item_2)=>{
@@ -182,46 +183,48 @@ function useSelectSelection(props, disabled) {
182
183
  if (option_6) onDeselect?.(previous, option_6);
183
184
  }
184
185
  };
185
- $[42] = disabled;
186
- $[43] = maxCount;
187
- $[44] = mode;
188
- $[45] = onDeselect;
189
- $[46] = onSelect;
190
- $[47] = optionByValue;
191
- $[48] = publish;
192
- $[49] = selectedValueSet;
193
- $[50] = valueArray;
194
- $[51] = t8;
195
- } else t8 = $[51];
186
+ $[43] = disabled;
187
+ $[44] = maxCount;
188
+ $[45] = mode;
189
+ $[46] = onDeselect;
190
+ $[47] = onSelect;
191
+ $[48] = optionByValue;
192
+ $[49] = publish;
193
+ $[50] = selectedValueSet;
194
+ $[51] = valueArray;
195
+ $[52] = t8;
196
+ } else t8 = $[52];
196
197
  const commit = t8;
197
198
  let t9;
198
- if ($[52] !== multiple || $[53] !== onClear || $[54] !== publish) {
199
+ if ($[53] !== multiple || $[54] !== onClear || $[55] !== publish) {
199
200
  t9 = ()=>{
200
201
  publish(multiple ? [] : void 0, true);
201
202
  onClear?.();
202
203
  };
203
- $[52] = multiple;
204
- $[53] = onClear;
205
- $[54] = publish;
206
- $[55] = t9;
207
- } else t9 = $[55];
204
+ $[53] = multiple;
205
+ $[54] = onClear;
206
+ $[55] = publish;
207
+ $[56] = t9;
208
+ } else t9 = $[56];
208
209
  const clear_0 = t9;
209
210
  let t10;
210
- if ($[56] !== multiple || $[57] !== optionByValue || $[58] !== value) {
211
- t10 = !multiple && value ? optionByValue.get(value) : void 0;
212
- $[56] = multiple;
213
- $[57] = optionByValue;
214
- $[58] = value;
215
- $[59] = t10;
216
- } else t10 = $[59];
211
+ if ($[57] !== multiple || $[58] !== optionByValue || $[59] !== value) {
212
+ t10 = !multiple && value ? optionByValue.get(value) ?? {
213
+ label: value,
214
+ value: value
215
+ } : void 0;
216
+ $[57] = multiple;
217
+ $[58] = optionByValue;
218
+ $[59] = value;
219
+ $[60] = t10;
220
+ } else t10 = $[60];
217
221
  const selectedOption = t10;
218
222
  let t11;
219
- if ($[60] !== mode || $[61] !== multiple || $[62] !== optionByValue || $[63] !== valueArray) {
220
- t11 = multiple ? valueArray.map((item_3)=>optionByValue.get(item_3) ?? ("tags" === mode ? {
223
+ if ($[61] !== multiple || $[62] !== optionByValue || $[63] !== valueArray) {
224
+ t11 = multiple ? valueArray.map((item_3)=>optionByValue.get(item_3) ?? {
221
225
  label: item_3,
222
226
  value: item_3
223
- } : void 0)).filter(_temp4) : [];
224
- $[60] = mode;
227
+ }) : [];
225
228
  $[61] = multiple;
226
229
  $[62] = optionByValue;
227
230
  $[63] = valueArray;
@@ -256,9 +259,6 @@ function useSelectSelection(props, disabled) {
256
259
  } else t12 = $[75];
257
260
  return t12;
258
261
  }
259
- function _temp4(option_7) {
260
- return void 0 !== option_7;
261
- }
262
262
  function _temp3(token) {
263
263
  return token.trim();
264
264
  }
@@ -1,5 +1,5 @@
1
1
  import { type SliderProps as RcSliderProps, type SliderRef } from '@rc-component/slider';
2
- import { type ReactNode } from 'react';
2
+ import { type AriaAttributes, type ReactNode } from 'react';
3
3
  import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic.js';
4
4
  import type { TooltipProps } from '../tooltip/tooltip.js';
5
5
  import '../tooltip/tooltip.css';
@@ -15,7 +15,7 @@ export interface SliderTooltipProps extends Omit<TooltipProps, 'children' | 'tit
15
15
  formatter?: Formatter;
16
16
  autoAdjustOverflow?: boolean;
17
17
  }
18
- export interface SliderBaseProps extends Omit<RcSliderProps, 'value' | 'defaultValue' | 'onChange' | 'onAfterChange' | 'onChangeComplete' | 'range' | 'classNames' | 'styles'> {
18
+ export interface SliderBaseProps extends Omit<RcSliderProps, 'value' | 'defaultValue' | 'onChange' | 'onAfterChange' | 'onChangeComplete' | 'range' | 'classNames' | 'styles'>, Pick<AriaAttributes, 'aria-label' | 'aria-labelledby' | 'aria-describedby'> {
19
19
  rootClassName?: string;
20
20
  orientation?: 'horizontal' | 'vertical';
21
21
  direction?: 'ltr' | 'rtl';
@@ -2,6 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import slider from "@rc-component/slider";
3
3
  import { cloneElement, forwardRef, useEffect, useRef, useState } from "react";
4
4
  import { TaoPortalScope, useTaoConfig, useTaoDirection } from "../../provider/tao-provider.js";
5
+ import { useCommittedRef } from "../../utils/refs.js";
5
6
  import { cx } from "../../utils/semantic.js";
6
7
  import "../tooltip/tooltip.css";
7
8
  import "./slider.css";
@@ -15,6 +16,7 @@ function SliderTip({ children, value, dragging, disabled, vertical, direction, o
15
16
  const closeTimer = useRef(void 0);
16
17
  useEffect(()=>()=>clearTimeout(closeTimer.current), []);
17
18
  const { formatter, open, placement = vertical ? 'rtl' === direction ? 'left' : 'right' : 'top', getPopupContainer, autoAdjustOverflow = true, arrow = true, prefixCls, className, classNames, styles, style, color, mouseEnterDelay = 0.1, mouseLeaveDelay = 0.1, onOpenChange, defaultOpen } = options;
19
+ const latestOpenChange = useCommittedRef(onOpenChange);
18
20
  const title = null === formatter ? null : formatter ? formatter(value) : String(value);
19
21
  const side = placement.startsWith('top') ? 'top' : placement.startsWith('bottom') ? 'bottom' : placement.startsWith('left') ? 'left' : 'right';
20
22
  const align = placement.endsWith('Left') || placement.endsWith('Top') ? 'start' : placement.endsWith('Right') || placement.endsWith('Bottom') ? 'end' : 'center';
@@ -28,7 +30,7 @@ function SliderTip({ children, value, dragging, disabled, vertical, direction, o
28
30
  clearTimeout(closeTimer.current);
29
31
  const update = ()=>{
30
32
  setActive(next);
31
- onOpenChange?.(next);
33
+ latestOpenChange.current?.(next);
32
34
  };
33
35
  if (!next && pointerDriven.current && mouseLeaveDelay > 0) closeTimer.current = setTimeout(update, 1000 * mouseLeaveDelay);
34
36
  else update();
@@ -57,6 +59,12 @@ function SliderTip({ children, value, dragging, disabled, vertical, direction, o
57
59
  sideOffset: 8,
58
60
  avoidCollisions: autoAdjustOverflow,
59
61
  updatePositionStrategy: "always",
62
+ onEscapeKeyDown: ()=>{
63
+ pointerDriven.current = false;
64
+ },
65
+ onPointerDownOutside: ()=>{
66
+ pointerDriven.current = false;
67
+ },
60
68
  className: cx(prefixCls, classNames?.content, className),
61
69
  style: {
62
70
  ...color ? {
@@ -92,7 +100,7 @@ const withValueSnapshot = (callback)=>callback ? (value)=>callback(Array.isArray
92
100
  ...value
93
101
  ] : value) : void 0;
94
102
  const Slider = /*#__PURE__*/ forwardRef((props, ref)=>{
95
- const { prefixCls = 'tao-slider', classNames, styles, rootClassName, className, style, orientation, vertical = false, direction: directionProp, disabled, keyboard, tooltip = {}, handleRender, reverse, ...rest } = props;
103
+ const { prefixCls = 'tao-slider', classNames, styles, rootClassName, className, style, orientation, vertical = false, direction: directionProp, disabled, keyboard, tooltip = {}, handleRender, reverse, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, 'aria-describedby': ariaDescribedBy, ...rest } = props;
96
104
  const [direction, directionRef] = useTaoDirection(directionProp);
97
105
  const config = useTaoConfig();
98
106
  const resolvedDisabled = disabled ?? config.disabled;
@@ -125,6 +133,9 @@ const Slider = /*#__PURE__*/ forwardRef((props, ref)=>{
125
133
  ...engineProps,
126
134
  ref: ref,
127
135
  prefixCls: prefixCls,
136
+ ariaLabelForHandle: engineProps.ariaLabelForHandle ?? ariaLabel,
137
+ ariaLabelledByForHandle: engineProps.ariaLabelledByForHandle ?? ariaLabelledBy,
138
+ ariaDescribedByForHandle: engineProps.ariaDescribedByForHandle ?? ariaDescribedBy,
128
139
  disabled: resolvedDisabled,
129
140
  keyboard: keyboard,
130
141
  onBeforeChange: withValueSnapshot(engineProps.onBeforeChange),
@@ -92,8 +92,8 @@ function create(type, options, custom) {
92
92
  phase: 'active'
93
93
  };
94
94
  state = {
95
- toasts: [
96
- ...state.toasts.filter((toast)=>toast.id !== id),
95
+ toasts: state.toasts.some((toast)=>toast.id === id) ? state.toasts.map((toast)=>toast.id === id ? next : toast) : [
96
+ ...state.toasts,
97
97
  next
98
98
  ]
99
99
  };
@@ -20,6 +20,7 @@
20
20
  }
21
21
 
22
22
  [data-tao-splitter-panel][data-tao-collapsed] {
23
+ visibility: hidden;
23
24
  overflow: hidden;
24
25
  }
25
26