@rockshin/tao-ui 0.0.58 → 0.0.60

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 (111) 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 +18 -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.css +1 -1
  11. package/dist/components/color-picker/color-picker.js +386 -362
  12. package/dist/components/context-menu/context-menu.d.ts +3 -1
  13. package/dist/components/context-menu/context-menu.js +48 -43
  14. package/dist/components/date-picker/calendar/calendar-grid.d.ts +5 -3
  15. package/dist/components/date-picker/calendar/calendar-grid.js +9 -4
  16. package/dist/components/date-picker/calendar/month-grid.d.ts +2 -1
  17. package/dist/components/date-picker/calendar/month-grid.js +61 -45
  18. package/dist/components/date-picker/calendar/time-panel.d.ts +8 -1
  19. package/dist/components/date-picker/calendar/time-panel.js +93 -88
  20. package/dist/components/date-picker/calendar/year-grid.d.ts +2 -1
  21. package/dist/components/date-picker/calendar/year-grid.js +60 -44
  22. package/dist/components/date-picker/date-picker.css +9 -0
  23. package/dist/components/date-picker/date-picker.js +25 -14
  24. package/dist/components/date-picker/range-picker.d.ts +2 -0
  25. package/dist/components/date-picker/range-picker.js +132 -73
  26. package/dist/components/date-picker/types.js +1 -1
  27. package/dist/components/drawer/drawer.d.ts +1 -1
  28. package/dist/components/drawer/drawer.js +4 -3
  29. package/dist/components/dropdown/dropdown.d.ts +1 -0
  30. package/dist/components/dropdown/dropdown.js +29 -21
  31. package/dist/components/float-button/float-button.js +6 -5
  32. package/dist/components/form/form-item.d.ts +1 -1
  33. package/dist/components/form/form-item.js +160 -120
  34. package/dist/components/form/use-form.js +2 -1
  35. package/dist/components/form-field/form-field-view.d.ts +2 -1
  36. package/dist/components/form-field/form-field-view.js +173 -108
  37. package/dist/components/input/input-shared.js +3 -2
  38. package/dist/components/input/otp.js +114 -110
  39. package/dist/components/input/password.js +55 -61
  40. package/dist/components/input/search.js +8 -4
  41. package/dist/components/input-number/input-number.d.ts +2 -1
  42. package/dist/components/input-number/input-number.js +67 -52
  43. package/dist/components/mentions/mentions.js +4 -2
  44. package/dist/components/menu/menu-render.d.ts +6 -0
  45. package/dist/components/menu/menu-render.js +39 -26
  46. package/dist/components/modal/confirm-dialog.js +22 -10
  47. package/dist/components/modal/modal.js +320 -315
  48. package/dist/components/modal/use-modal.js +1 -1
  49. package/dist/components/pagination/pagination.d.ts +4 -2
  50. package/dist/components/pagination/pagination.js +128 -117
  51. package/dist/components/popover/popover.js +214 -351
  52. package/dist/components/qr-code/qr-code.js +157 -150
  53. package/dist/components/radio/radio.d.ts +3 -1
  54. package/dist/components/radio/radio.js +73 -64
  55. package/dist/components/select/mobile-select.js +7 -4
  56. package/dist/components/select/select-model.js +3 -3
  57. package/dist/components/select/select.js +78 -39
  58. package/dist/components/select/use-select-selection.js +100 -92
  59. package/dist/components/slider/slider.d.ts +2 -2
  60. package/dist/components/slider/slider.js +13 -2
  61. package/dist/components/sonner/sonner.js +2 -2
  62. package/dist/components/splitter/splitter.css +1 -0
  63. package/dist/components/splitter/splitter.js +152 -126
  64. package/dist/components/statistic/statistic.js +38 -31
  65. package/dist/components/switch/switch.js +45 -39
  66. package/dist/components/table/table-filter.d.ts +3 -1
  67. package/dist/components/table/table-filter.js +100 -74
  68. package/dist/components/table/table.js +2 -0
  69. package/dist/components/table/use-table-data.js +2 -2
  70. package/dist/components/tabs/tabs.d.ts +3 -2
  71. package/dist/components/tabs/tabs.js +122 -112
  72. package/dist/components/time-picker/time-picker.js +35 -3
  73. package/dist/components/tooltip/tooltip.d.ts +1 -1
  74. package/dist/components/tooltip/tooltip.js +220 -124
  75. package/dist/components/tree/tree.js +31 -3
  76. package/dist/components/tree-select/tree-select.js +2 -1
  77. package/dist/components/upload/upload.js +67 -40
  78. package/dist/locales/ar-EG.js +2 -0
  79. package/dist/locales/de-DE.js +2 -0
  80. package/dist/locales/en-US.js +2 -0
  81. package/dist/locales/es-ES.js +2 -0
  82. package/dist/locales/fr-FR.js +2 -0
  83. package/dist/locales/hi-IN.js +2 -0
  84. package/dist/locales/id-ID.js +2 -0
  85. package/dist/locales/it-IT.js +2 -0
  86. package/dist/locales/ja-JP.js +2 -0
  87. package/dist/locales/ko-KR.js +2 -0
  88. package/dist/locales/pt-BR.js +2 -0
  89. package/dist/locales/ru-RU.js +2 -0
  90. package/dist/locales/th-TH.js +2 -0
  91. package/dist/locales/tr-TR.js +2 -0
  92. package/dist/locales/types.d.ts +2 -0
  93. package/dist/locales/vi-VN.js +2 -0
  94. package/dist/locales/zh-CN.js +2 -0
  95. package/dist/locales/zh-TW.js +2 -0
  96. package/dist/number-input/format.js +1 -1
  97. package/dist/number-input/use-number-input.d.ts +1 -0
  98. package/dist/number-input/use-number-input.js +170 -321
  99. package/dist/number-input/validate.d.ts +1 -0
  100. package/dist/number-input/validate.js +1 -1
  101. package/dist/provider/tao-provider.d.ts +2 -2
  102. package/dist/provider/tao-provider.js +66 -52
  103. package/dist/theme/control.css +5 -1
  104. package/dist/theme/theme.css +2 -2
  105. package/dist/utils/composed-parent.d.ts +1 -0
  106. package/dist/utils/composed-parent.js +7 -0
  107. package/dist/utils/portal.d.ts +5 -0
  108. package/dist/utils/portal.js +7 -1
  109. package/dist/utils/refs.d.ts +3 -1
  110. package/dist/utils/refs.js +25 -1
  111. package/package.json +1 -1
@@ -8,7 +8,7 @@ function buildSelectIndex(options) {
8
8
  forEachLeafOption(options, (option)=>{
9
9
  if (!optionByValue.has(option.value)) optionByValue.set(option.value, option);
10
10
  if (!optionByToken.has(option.value)) optionByToken.set(option.value, option);
11
- if ('string' == typeof option.label && !optionByToken.has(option.label)) optionByToken.set(option.label, option);
11
+ if (('string' == typeof option.label || 'number' == typeof option.label) && !optionByToken.has(String(option.label))) optionByToken.set(String(option.label), option);
12
12
  });
13
13
  return {
14
14
  optionByValue,
@@ -28,8 +28,8 @@ function countLeafOptions(options) {
28
28
  return count;
29
29
  }
30
30
  function defaultFilter(input, option) {
31
- const label = 'string' == typeof option.label ? option.label : String(option.label);
32
- return label.toLowerCase().includes(input.toLowerCase());
31
+ const text = 'string' == typeof option.label || 'number' == typeof option.label ? String(option.label) : option.value;
32
+ return text.toLowerCase().includes(input.toLowerCase());
33
33
  }
34
34
  function filterTree(options, filter, input) {
35
35
  const result = [];
@@ -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, {
@@ -2,7 +2,7 @@ import { c } from "react-compiler-runtime";
2
2
  import { useState } from "react";
3
3
  import { buildSelectIndex } from "./select-model.js";
4
4
  function useSelectSelection(props, disabled) {
5
- const $ = c(76);
5
+ const $ = c(80);
6
6
  const { options, value: valueProp, defaultValue, mode, maxCount, tokenSeparators, onChange, onSelect, onDeselect, onClear } = props;
7
7
  const multiple = "multiple" === mode || "tags" === mode;
8
8
  const controlled = "value" in props;
@@ -69,40 +69,45 @@ 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] !== mode || $[18] !== multiple || $[19] !== onDeselect || $[20] !== onSelect || $[21] !== optionByToken || $[22] !== optionByValue || $[23] !== publish || $[24] !== selectedValueSet || $[25] !== value || $[26] !== valueArray) {
73
73
  t5 = (next_0)=>{
74
74
  if (disabled) return false;
75
- const option_0 = optionByValue.get(next_0);
75
+ const option_0 = optionByValue.get(next_0) ?? ("tags" === mode ? optionByToken.get(next_0) : void 0);
76
+ if (option_0?.disabled) return false;
77
+ const canonical = option_0?.value ?? next_0;
76
78
  if (!multiple) {
77
- publish(next_0);
78
- if (option_0) onSelect?.(next_0, option_0);
79
+ if (canonical !== value) publish(canonical);
80
+ if (option_0) onSelect?.(canonical, option_0);
79
81
  return true;
80
82
  }
81
- const existed = selectedValueSet.has(next_0);
82
- const nextArray = existed ? valueArray.filter((item_0)=>item_0 !== next_0) : [
83
+ const existed = selectedValueSet.has(canonical);
84
+ const nextArray = existed ? valueArray.filter((item_0)=>item_0 !== canonical) : [
83
85
  ...valueArray,
84
- next_0
86
+ canonical
85
87
  ];
86
88
  if (!existed && null != maxCount && nextArray.length > maxCount) return false;
87
89
  publish(nextArray);
88
- if (option_0) if (existed) onDeselect?.(next_0, option_0);
89
- else onSelect?.(next_0, option_0);
90
+ if (option_0) if (existed) onDeselect?.(canonical, option_0);
91
+ else onSelect?.(canonical, option_0);
90
92
  return true;
91
93
  };
92
94
  $[15] = disabled;
93
95
  $[16] = maxCount;
94
- $[17] = multiple;
95
- $[18] = onDeselect;
96
- $[19] = onSelect;
97
- $[20] = optionByValue;
98
- $[21] = publish;
99
- $[22] = selectedValueSet;
100
- $[23] = valueArray;
101
- $[24] = t5;
102
- } else t5 = $[24];
96
+ $[17] = mode;
97
+ $[18] = multiple;
98
+ $[19] = onDeselect;
99
+ $[20] = onSelect;
100
+ $[21] = optionByToken;
101
+ $[22] = optionByValue;
102
+ $[23] = publish;
103
+ $[24] = selectedValueSet;
104
+ $[25] = value;
105
+ $[26] = valueArray;
106
+ $[27] = t5;
107
+ } else t5 = $[27];
103
108
  const select = t5;
104
109
  let t6;
105
- if ($[25] !== disabled || $[26] !== maxCount || $[27] !== mode || $[28] !== onSelect || $[29] !== optionByToken || $[30] !== optionByValue || $[31] !== publish || $[32] !== selectedValueSet || $[33] !== tokenSeparators || $[34] !== valueArray) {
110
+ if ($[28] !== disabled || $[29] !== maxCount || $[30] !== mode || $[31] !== onSelect || $[32] !== optionByToken || $[33] !== optionByValue || $[34] !== publish || $[35] !== selectedValueSet || $[36] !== tokenSeparators || $[37] !== valueArray) {
106
111
  t6 = (input)=>{
107
112
  if (disabled) return false;
108
113
  const tokens = (tokenSeparators ?? []).reduce(_temp2, [
@@ -132,37 +137,39 @@ function useSelectSelection(props, disabled) {
132
137
  }
133
138
  return true;
134
139
  };
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];
140
+ $[28] = disabled;
141
+ $[29] = maxCount;
142
+ $[30] = mode;
143
+ $[31] = onSelect;
144
+ $[32] = optionByToken;
145
+ $[33] = optionByValue;
146
+ $[34] = publish;
147
+ $[35] = selectedValueSet;
148
+ $[36] = tokenSeparators;
149
+ $[37] = valueArray;
150
+ $[38] = t6;
151
+ } else t6 = $[38];
147
152
  const addTokens = t6;
148
153
  let t7;
149
- if ($[36] !== multiple || $[37] !== onDeselect || $[38] !== optionByValue || $[39] !== publish || $[40] !== valueArray) {
154
+ if ($[39] !== disabled || $[40] !== multiple || $[41] !== onDeselect || $[42] !== optionByValue || $[43] !== publish || $[44] !== valueArray) {
150
155
  t7 = (removed)=>{
151
- if (!multiple) return;
152
- publish(valueArray.filter((item_1)=>item_1 !== removed));
156
+ if (disabled || !multiple) return;
153
157
  const option_3 = optionByValue.get(removed);
158
+ if (option_3?.disabled) return;
159
+ publish(valueArray.filter((item_1)=>item_1 !== removed));
154
160
  if (option_3) onDeselect?.(removed, option_3);
155
161
  };
156
- $[36] = multiple;
157
- $[37] = onDeselect;
158
- $[38] = optionByValue;
159
- $[39] = publish;
160
- $[40] = valueArray;
161
- $[41] = t7;
162
- } else t7 = $[41];
162
+ $[39] = disabled;
163
+ $[40] = multiple;
164
+ $[41] = onDeselect;
165
+ $[42] = optionByValue;
166
+ $[43] = publish;
167
+ $[44] = valueArray;
168
+ $[45] = t7;
169
+ } else t7 = $[45];
163
170
  const remove = t7;
164
171
  let t8;
165
- if ($[42] !== disabled || $[43] !== maxCount || $[44] !== mode || $[45] !== onDeselect || $[46] !== onSelect || $[47] !== optionByValue || $[48] !== publish || $[49] !== selectedValueSet || $[50] !== valueArray) {
172
+ if ($[46] !== disabled || $[47] !== maxCount || $[48] !== mode || $[49] !== onDeselect || $[50] !== onSelect || $[51] !== optionByValue || $[52] !== publish || $[53] !== selectedValueSet || $[54] !== valueArray) {
166
173
  t8 = (draft)=>{
167
174
  if (disabled) return;
168
175
  const nextArray_1 = draft.filter((item_2)=>{
@@ -182,54 +189,58 @@ function useSelectSelection(props, disabled) {
182
189
  if (option_6) onDeselect?.(previous, option_6);
183
190
  }
184
191
  };
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];
192
+ $[46] = disabled;
193
+ $[47] = maxCount;
194
+ $[48] = mode;
195
+ $[49] = onDeselect;
196
+ $[50] = onSelect;
197
+ $[51] = optionByValue;
198
+ $[52] = publish;
199
+ $[53] = selectedValueSet;
200
+ $[54] = valueArray;
201
+ $[55] = t8;
202
+ } else t8 = $[55];
196
203
  const commit = t8;
197
204
  let t9;
198
- if ($[52] !== multiple || $[53] !== onClear || $[54] !== publish) {
205
+ if ($[56] !== disabled || $[57] !== multiple || $[58] !== onClear || $[59] !== publish) {
199
206
  t9 = ()=>{
207
+ if (disabled) return;
200
208
  publish(multiple ? [] : void 0, true);
201
209
  onClear?.();
202
210
  };
203
- $[52] = multiple;
204
- $[53] = onClear;
205
- $[54] = publish;
206
- $[55] = t9;
207
- } else t9 = $[55];
211
+ $[56] = disabled;
212
+ $[57] = multiple;
213
+ $[58] = onClear;
214
+ $[59] = publish;
215
+ $[60] = t9;
216
+ } else t9 = $[60];
208
217
  const clear_0 = t9;
209
218
  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];
219
+ if ($[61] !== multiple || $[62] !== optionByValue || $[63] !== value) {
220
+ t10 = !multiple && value ? optionByValue.get(value) ?? {
221
+ label: value,
222
+ value: value
223
+ } : void 0;
224
+ $[61] = multiple;
225
+ $[62] = optionByValue;
226
+ $[63] = value;
227
+ $[64] = t10;
228
+ } else t10 = $[64];
217
229
  const selectedOption = t10;
218
230
  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 ? {
231
+ if ($[65] !== multiple || $[66] !== optionByValue || $[67] !== valueArray) {
232
+ t11 = multiple ? valueArray.map((item_3)=>optionByValue.get(item_3) ?? {
221
233
  label: item_3,
222
234
  value: item_3
223
- } : void 0)).filter(_temp4) : [];
224
- $[60] = mode;
225
- $[61] = multiple;
226
- $[62] = optionByValue;
227
- $[63] = valueArray;
228
- $[64] = t11;
229
- } else t11 = $[64];
235
+ }) : [];
236
+ $[65] = multiple;
237
+ $[66] = optionByValue;
238
+ $[67] = valueArray;
239
+ $[68] = t11;
240
+ } else t11 = $[68];
230
241
  const selectedOptions = t11;
231
242
  let t12;
232
- if ($[65] !== addTokens || $[66] !== clear_0 || $[67] !== commit || $[68] !== remove || $[69] !== select || $[70] !== selectedOption || $[71] !== selectedOptions || $[72] !== selectedValueSet || $[73] !== value || $[74] !== valueArray) {
243
+ if ($[69] !== addTokens || $[70] !== clear_0 || $[71] !== commit || $[72] !== remove || $[73] !== select || $[74] !== selectedOption || $[75] !== selectedOptions || $[76] !== selectedValueSet || $[77] !== value || $[78] !== valueArray) {
233
244
  t12 = {
234
245
  value,
235
246
  valueArray,
@@ -242,23 +253,20 @@ function useSelectSelection(props, disabled) {
242
253
  commit,
243
254
  clear: clear_0
244
255
  };
245
- $[65] = addTokens;
246
- $[66] = clear_0;
247
- $[67] = commit;
248
- $[68] = remove;
249
- $[69] = select;
250
- $[70] = selectedOption;
251
- $[71] = selectedOptions;
252
- $[72] = selectedValueSet;
253
- $[73] = value;
254
- $[74] = valueArray;
255
- $[75] = t12;
256
- } else t12 = $[75];
256
+ $[69] = addTokens;
257
+ $[70] = clear_0;
258
+ $[71] = commit;
259
+ $[72] = remove;
260
+ $[73] = select;
261
+ $[74] = selectedOption;
262
+ $[75] = selectedOptions;
263
+ $[76] = selectedValueSet;
264
+ $[77] = value;
265
+ $[78] = valueArray;
266
+ $[79] = t12;
267
+ } else t12 = $[79];
257
268
  return t12;
258
269
  }
259
- function _temp4(option_7) {
260
- return void 0 !== option_7;
261
- }
262
270
  function _temp3(token) {
263
271
  return token.trim();
264
272
  }
@@ -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