@rockshin/tao-ui 0.0.31 → 0.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (158) hide show
  1. package/README.md +14 -3
  2. package/dist/components/alert/alert.js +1 -1
  3. package/dist/components/breadcrumb/breadcrumb.js +1 -1
  4. package/dist/components/button/button.d.ts +2 -2
  5. package/dist/components/button/button.js +48 -50
  6. package/dist/components/checkbox/checkbox.css +5 -1
  7. package/dist/components/checkbox/checkbox.d.ts +2 -2
  8. package/dist/components/checkbox/checkbox.js +135 -120
  9. package/dist/components/collapsible/collapsible.js +1 -1
  10. package/dist/components/context-menu/context-menu.js +1 -1
  11. package/dist/components/date-picker/calendar/calendar-header.js +1 -1
  12. package/dist/components/date-picker/calendar/month-grid.d.ts +3 -1
  13. package/dist/components/date-picker/calendar/month-grid.js +19 -17
  14. package/dist/components/date-picker/calendar/time-panel.js +1 -1
  15. package/dist/components/date-picker/calendar/year-grid.d.ts +3 -1
  16. package/dist/components/date-picker/calendar/year-grid.js +28 -24
  17. package/dist/components/date-picker/date-picker.d.ts +1 -1
  18. package/dist/components/date-picker/date-picker.js +37 -24
  19. package/dist/components/date-picker/presets.js +1 -1
  20. package/dist/components/date-picker/range-picker.d.ts +1 -1
  21. package/dist/components/date-picker/range-picker.js +104 -56
  22. package/dist/components/drawer/drawer.d.ts +1 -1
  23. package/dist/components/drawer/drawer.js +98 -91
  24. package/dist/components/dropdown/dropdown.js +84 -84
  25. package/dist/components/form/form-item.js +8 -4
  26. package/dist/components/form/form.js +1 -1
  27. package/dist/components/form-actions/form-actions.js +1 -1
  28. package/dist/components/form-field/form-field-view.js +58 -51
  29. package/dist/components/form-field/form-field.js +1 -1
  30. package/dist/components/form-section/form-section.js +1 -1
  31. package/dist/components/input/input.js +42 -39
  32. package/dist/components/input-number/input-number.d.ts +2 -2
  33. package/dist/components/input-number/input-number.js +57 -59
  34. package/dist/components/menu/menu-render.js +1 -1
  35. package/dist/components/modal/confirm-dialog.d.ts +2 -1
  36. package/dist/components/modal/confirm-dialog.js +25 -5
  37. package/dist/components/modal/confirm.js +15 -3
  38. package/dist/components/modal/modal.d.ts +1 -1
  39. package/dist/components/modal/modal.js +131 -132
  40. package/dist/components/modal/use-modal.js +48 -35
  41. package/dist/components/pagination/pagination.js +3 -1
  42. package/dist/components/popconfirm/popconfirm.js +1 -1
  43. package/dist/components/popover/popover.js +253 -228
  44. package/dist/components/radio/radio.css +2 -2
  45. package/dist/components/radio/radio.d.ts +1 -1
  46. package/dist/components/radio/radio.js +7 -7
  47. package/dist/components/scroll-area/scroll-area.css +2 -2
  48. package/dist/components/scroll-area/scroll-area.js +187 -165
  49. package/dist/components/select/mobile-select.d.ts +2 -1
  50. package/dist/components/select/mobile-select.js +12 -6
  51. package/dist/components/select/select-icons.js +1 -1
  52. package/dist/components/select/select-searchable-list.d.ts +1 -1
  53. package/dist/components/select/select-searchable-list.js +35 -21
  54. package/dist/components/select/select-tags.js +1 -1
  55. package/dist/components/select/select-types.d.ts +2 -2
  56. package/dist/components/select/select.css +4 -0
  57. package/dist/components/select/select.d.ts +2 -2
  58. package/dist/components/select/select.js +127 -73
  59. package/dist/components/sonner/sonner.js +6 -5
  60. package/dist/components/spinner/spinner.js +1 -1
  61. package/dist/components/splitter/splitter.js +187 -194
  62. package/dist/components/status-icon/status-icon.js +1 -1
  63. package/dist/components/switch/switch.d.ts +1 -1
  64. package/dist/components/switch/switch.js +6 -6
  65. package/dist/components/table/table-filter.js +1 -1
  66. package/dist/components/table/table-icons.js +1 -1
  67. package/dist/components/table/table.js +483 -599
  68. package/dist/components/tabs/tabs.js +179 -161
  69. package/dist/components/tag/tag.js +1 -1
  70. package/dist/components/textarea/textarea.d.ts +1 -1
  71. package/dist/components/textarea/textarea.js +142 -108
  72. package/dist/components/tooltip/tooltip.js +88 -72
  73. package/dist/entries/alert.d.ts +3 -0
  74. package/dist/entries/alert.js +4 -0
  75. package/dist/entries/breadcrumb.d.ts +3 -0
  76. package/dist/entries/breadcrumb.js +4 -0
  77. package/dist/entries/button.d.ts +3 -0
  78. package/dist/entries/button.js +4 -0
  79. package/dist/entries/checkbox.d.ts +3 -0
  80. package/dist/entries/checkbox.js +4 -0
  81. package/dist/entries/collapsible.d.ts +3 -0
  82. package/dist/entries/collapsible.js +4 -0
  83. package/dist/entries/context-menu.d.ts +3 -0
  84. package/dist/entries/context-menu.js +4 -0
  85. package/dist/entries/date-picker.d.ts +3 -0
  86. package/dist/entries/date-picker.js +4 -0
  87. package/dist/entries/drawer.d.ts +3 -0
  88. package/dist/entries/drawer.js +4 -0
  89. package/dist/entries/dropdown.d.ts +3 -0
  90. package/dist/entries/dropdown.js +4 -0
  91. package/dist/entries/form-actions.d.ts +3 -0
  92. package/dist/entries/form-actions.js +4 -0
  93. package/dist/entries/form-field.d.ts +3 -0
  94. package/dist/entries/form-field.js +4 -0
  95. package/dist/entries/form-layout.d.ts +3 -0
  96. package/dist/entries/form-layout.js +4 -0
  97. package/dist/entries/form-section.d.ts +3 -0
  98. package/dist/entries/form-section.js +4 -0
  99. package/dist/entries/form.d.ts +4 -0
  100. package/dist/entries/form.js +4 -0
  101. package/dist/entries/input-number.d.ts +3 -0
  102. package/dist/entries/input-number.js +4 -0
  103. package/dist/entries/input.d.ts +3 -0
  104. package/dist/entries/input.js +4 -0
  105. package/dist/entries/modal.d.ts +3 -0
  106. package/dist/entries/modal.js +4 -0
  107. package/dist/entries/number-input.d.ts +3 -0
  108. package/dist/entries/number-input.js +4 -0
  109. package/dist/entries/pagination.d.ts +3 -0
  110. package/dist/entries/pagination.js +4 -0
  111. package/dist/entries/popconfirm.d.ts +3 -0
  112. package/dist/entries/popconfirm.js +4 -0
  113. package/dist/entries/popover.d.ts +3 -0
  114. package/dist/entries/popover.js +4 -0
  115. package/dist/entries/provider.d.ts +3 -0
  116. package/dist/entries/provider.js +4 -0
  117. package/dist/entries/radio.d.ts +3 -0
  118. package/dist/entries/radio.js +4 -0
  119. package/dist/entries/range-picker.d.ts +3 -0
  120. package/dist/entries/range-picker.js +4 -0
  121. package/dist/entries/scroll-area.d.ts +3 -0
  122. package/dist/entries/scroll-area.js +4 -0
  123. package/dist/entries/select.d.ts +3 -0
  124. package/dist/entries/select.js +4 -0
  125. package/dist/entries/sonner.d.ts +3 -0
  126. package/dist/entries/sonner.js +4 -0
  127. package/dist/entries/spinner.d.ts +3 -0
  128. package/dist/entries/spinner.js +4 -0
  129. package/dist/entries/splitter.d.ts +3 -0
  130. package/dist/entries/splitter.js +4 -0
  131. package/dist/entries/stack.d.ts +3 -0
  132. package/dist/entries/stack.js +4 -0
  133. package/dist/entries/switch.d.ts +3 -0
  134. package/dist/entries/switch.js +4 -0
  135. package/dist/entries/table.d.ts +3 -0
  136. package/dist/entries/table.js +4 -0
  137. package/dist/entries/tabs.d.ts +3 -0
  138. package/dist/entries/tabs.js +4 -0
  139. package/dist/entries/tag.d.ts +3 -0
  140. package/dist/entries/tag.js +4 -0
  141. package/dist/entries/textarea.d.ts +3 -0
  142. package/dist/entries/textarea.js +4 -0
  143. package/dist/entries/tooltip.d.ts +3 -0
  144. package/dist/entries/tooltip.js +4 -0
  145. package/dist/layouts/form-layout/form-layout.js +1 -1
  146. package/dist/layouts/stack/stack.js +1 -1
  147. package/dist/number-input/number-input.js +1 -1
  148. package/dist/number-input/use-number-input.d.ts +2 -2
  149. package/dist/number-input/use-number-input.js +224 -131
  150. package/dist/number-input/validate.js +7 -2
  151. package/dist/provider/tao-provider.js +1 -1
  152. package/dist/utils/dialog-content.d.ts +10 -0
  153. package/dist/utils/dialog-content.js +222 -0
  154. package/dist/utils/overlay.d.ts +2 -2
  155. package/dist/utils/overlay.js +8 -3
  156. package/dist/utils/refs.js +17 -2
  157. package/llms.txt +5 -3
  158. package/package.json +21 -8
@@ -1,11 +1,11 @@
1
- import { c } from "react/compiler-runtime";
1
+ import { c } from "react-compiler-runtime";
2
2
  import { useEffect, useLayoutEffect, useRef, useState } from "react";
3
- import { isThousandSepBeforeCursor, reposition } from "./cursor.js";
3
+ import { countAnchored, findCursorAt, isThousandSepBeforeCursor, reposition } from "./cursor.js";
4
4
  import { format, padOnBlur, parse, truncateDecimals } from "./format.js";
5
5
  import { fromPercent, toPercent } from "./percentage.js";
6
6
  import { clampToRange, isValidCanonical, stripDisallowedSign } from "./validate.js";
7
7
  function useNumberInput(opts) {
8
- const $ = c(53);
8
+ const $ = c(84);
9
9
  const { value, defaultValue, onChange, onBlur, decimalSeparator: t0, thousandsSeparator: t1, decimalPlaces: t2, padDecimalsOnBlur: t3, isPercentage: t4, allowNegative: t5, min, max } = opts;
10
10
  const decimalSeparator = void 0 === t0 ? "." : t0;
11
11
  const thousandsSeparator = void 0 === t1 ? "," : t1;
@@ -35,177 +35,270 @@ function useNumberInput(opts) {
35
35
  $[5] = t7;
36
36
  } else t7 = $[5];
37
37
  const canonicalToDisplay = t7;
38
+ const isValueControlled = "value" in opts;
38
39
  let t8;
39
- if ($[6] !== canonicalToDisplay || $[7] !== defaultValue || $[8] !== value) {
40
- t8 = ()=>canonicalToDisplay(value ?? defaultValue ?? "");
40
+ if ($[6] !== canonicalToDisplay || $[7] !== defaultValue || $[8] !== fmtOpts || $[9] !== isPercentage || $[10] !== isValueControlled || $[11] !== value) {
41
+ t8 = ()=>({
42
+ display: canonicalToDisplay(isValueControlled ? value ?? "" : defaultValue ?? ""),
43
+ format: fmtOpts,
44
+ isPercentage
45
+ });
41
46
  $[6] = canonicalToDisplay;
42
47
  $[7] = defaultValue;
43
- $[8] = value;
44
- $[9] = t8;
45
- } else t8 = $[9];
46
- const [displayBuffer, setDisplayBuffer] = useState(t8);
48
+ $[8] = fmtOpts;
49
+ $[9] = isPercentage;
50
+ $[10] = isValueControlled;
51
+ $[11] = value;
52
+ $[12] = t8;
53
+ } else t8 = $[12];
54
+ const [buffer, setBuffer] = useState(t8);
55
+ const displayBuffer = buffer.display;
56
+ let t9;
57
+ if ($[13] !== fmtOpts || $[14] !== isPercentage) {
58
+ t9 = (display)=>setBuffer({
59
+ display,
60
+ format: fmtOpts,
61
+ isPercentage
62
+ });
63
+ $[13] = fmtOpts;
64
+ $[14] = isPercentage;
65
+ $[15] = t9;
66
+ } else t9 = $[15];
67
+ const setDisplayBuffer = t9;
47
68
  const isFocusedRef = useRef(false);
48
69
  const inputRef = useRef(null);
49
70
  const pendingCursorRef = useRef(null);
50
- let t9;
51
- if ($[10] !== canonicalToDisplay || $[11] !== value) {
52
- t9 = ()=>{
53
- if (void 0 === value) return;
71
+ let t10;
72
+ if ($[16] !== buffer.display || $[17] !== buffer.format || $[18] !== buffer.isPercentage || $[19] !== fmtOpts || $[20] !== isPercentage || $[21] !== isValueControlled || $[22] !== thousandsSeparator || $[23] !== value) {
73
+ t10 = ()=>{
74
+ if (buffer.format === fmtOpts && buffer.isPercentage === isPercentage) return;
75
+ const previousCanonical = parse(buffer.display, buffer.format);
76
+ const useExternalValue = isValueControlled && !isFocusedRef.current;
77
+ const actual_0 = useExternalValue ? value ?? "" : buffer.isPercentage ? fromPercent(previousCanonical) : previousCanonical;
78
+ let canonical_0 = isPercentage ? toPercent(actual_0) : actual_0;
79
+ if (!useExternalValue && previousCanonical.endsWith(".") && !canonical_0.includes(".")) canonical_0 += ".";
80
+ const display_0 = format(canonical_0, fmtOpts);
81
+ const input = inputRef.current;
82
+ if (isFocusedRef.current && input && display_0 !== buffer.display) {
83
+ const beforeCount = countAnchored(buffer.display, buffer.display.length, buffer.format.thousandsSeparator);
84
+ const afterCount = countAnchored(display_0, display_0.length, thousandsSeparator);
85
+ const mapCursor = (position)=>findCursorAt(display_0, afterCount - beforeCount + countAnchored(buffer.display, position, buffer.format.thousandsSeparator), thousandsSeparator);
86
+ pendingCursorRef.current = {
87
+ display: display_0,
88
+ start: mapCursor(input.selectionStart ?? buffer.display.length),
89
+ end: mapCursor(input.selectionEnd ?? buffer.display.length)
90
+ };
91
+ }
92
+ setBuffer({
93
+ display: display_0,
94
+ format: fmtOpts,
95
+ isPercentage
96
+ });
97
+ };
98
+ $[16] = buffer.display;
99
+ $[17] = buffer.format;
100
+ $[18] = buffer.isPercentage;
101
+ $[19] = fmtOpts;
102
+ $[20] = isPercentage;
103
+ $[21] = isValueControlled;
104
+ $[22] = thousandsSeparator;
105
+ $[23] = value;
106
+ $[24] = t10;
107
+ } else t10 = $[24];
108
+ let t11;
109
+ if ($[25] !== buffer || $[26] !== fmtOpts || $[27] !== isPercentage || $[28] !== isValueControlled || $[29] !== thousandsSeparator || $[30] !== value) {
110
+ t11 = [
111
+ buffer,
112
+ fmtOpts,
113
+ isPercentage,
114
+ isValueControlled,
115
+ value,
116
+ thousandsSeparator
117
+ ];
118
+ $[25] = buffer;
119
+ $[26] = fmtOpts;
120
+ $[27] = isPercentage;
121
+ $[28] = isValueControlled;
122
+ $[29] = thousandsSeparator;
123
+ $[30] = value;
124
+ $[31] = t11;
125
+ } else t11 = $[31];
126
+ useLayoutEffect(t10, t11);
127
+ let t12;
128
+ if ($[32] !== canonicalToDisplay || $[33] !== displayBuffer || $[34] !== isValueControlled || $[35] !== setDisplayBuffer || $[36] !== value) {
129
+ t12 = ()=>{
130
+ if (!isValueControlled) return;
54
131
  if (isFocusedRef.current) return;
55
- const display = canonicalToDisplay(value);
56
- setDisplayBuffer((prev)=>prev === display ? prev : display);
132
+ const display_1 = canonicalToDisplay(value ?? "");
133
+ if (displayBuffer !== display_1) setDisplayBuffer(display_1);
57
134
  };
58
- $[10] = canonicalToDisplay;
59
- $[11] = value;
60
- $[12] = t9;
61
- } else t9 = $[12];
62
- let t10;
63
- if ($[13] !== value) {
64
- t10 = [
65
- value
135
+ $[32] = canonicalToDisplay;
136
+ $[33] = displayBuffer;
137
+ $[34] = isValueControlled;
138
+ $[35] = setDisplayBuffer;
139
+ $[36] = value;
140
+ $[37] = t12;
141
+ } else t12 = $[37];
142
+ let t13;
143
+ if ($[38] !== isValueControlled || $[39] !== value) {
144
+ t13 = [
145
+ value,
146
+ isValueControlled
66
147
  ];
67
- $[13] = value;
68
- $[14] = t10;
69
- } else t10 = $[14];
70
- useEffect(t9, t10);
71
- let t11;
72
- if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
73
- t11 = ()=>{
74
- if (null === pendingCursorRef.current) return;
75
- const pos = pendingCursorRef.current;
76
- inputRef.current?.setSelectionRange(pos, pos);
148
+ $[38] = isValueControlled;
149
+ $[39] = value;
150
+ $[40] = t13;
151
+ } else t13 = $[40];
152
+ useEffect(t12, t13);
153
+ let t14;
154
+ let t15;
155
+ if ($[41] !== displayBuffer) {
156
+ t14 = ()=>{
157
+ const pending = pendingCursorRef.current;
158
+ if (pending?.display !== displayBuffer) return;
159
+ inputRef.current?.setSelectionRange(pending.start, pending.end);
77
160
  pendingCursorRef.current = null;
78
161
  };
79
- $[15] = t11;
80
- } else t11 = $[15];
81
- let t12;
82
- if ($[16] !== displayBuffer) {
83
- t12 = [
162
+ t15 = [
84
163
  displayBuffer
85
164
  ];
86
- $[16] = displayBuffer;
87
- $[17] = t12;
88
- } else t12 = $[17];
89
- useLayoutEffect(t11, t12);
90
- let t13;
91
- if ($[18] !== allowNegative || $[19] !== decimalPlaces || $[20] !== fmtOpts || $[21] !== isPercentage || $[22] !== onChange || $[23] !== thousandsSeparator) {
92
- t13 = (e)=>{
165
+ $[41] = displayBuffer;
166
+ $[42] = t14;
167
+ $[43] = t15;
168
+ } else {
169
+ t14 = $[42];
170
+ t15 = $[43];
171
+ }
172
+ useLayoutEffect(t14, t15);
173
+ let t16;
174
+ if ($[44] !== allowNegative || $[45] !== decimalPlaces || $[46] !== fmtOpts || $[47] !== isPercentage || $[48] !== onChange || $[49] !== setDisplayBuffer || $[50] !== thousandsSeparator) {
175
+ t16 = (e)=>{
93
176
  const raw = e.target.value;
94
177
  const cursor = e.target.selectionStart ?? raw.length;
95
- let canonical_0 = parse(raw, fmtOpts);
96
- canonical_0 = stripDisallowedSign(canonical_0, allowNegative);
97
- canonical_0 = truncateDecimals(canonical_0, decimalPlaces);
98
- if (!isValidCanonical(canonical_0)) return;
99
- const newDisplay = format(canonical_0, fmtOpts);
100
- pendingCursorRef.current = reposition({
178
+ let canonical_1 = parse(raw, fmtOpts);
179
+ canonical_1 = stripDisallowedSign(canonical_1, allowNegative);
180
+ canonical_1 = truncateDecimals(canonical_1, decimalPlaces);
181
+ if (!isValidCanonical(canonical_1)) return;
182
+ const newDisplay = format(canonical_1, fmtOpts);
183
+ const cursorPosition = reposition({
101
184
  before: raw,
102
185
  beforeCursor: cursor,
103
186
  after: newDisplay,
104
187
  thousandsSeparator
105
188
  });
189
+ pendingCursorRef.current = {
190
+ display: newDisplay,
191
+ start: cursorPosition,
192
+ end: cursorPosition
193
+ };
106
194
  setDisplayBuffer(newDisplay);
107
- const actual_0 = isPercentage ? fromPercent(canonical_0) : canonical_0;
108
- onChange?.(actual_0);
195
+ const actual_1 = isPercentage ? fromPercent(canonical_1) : canonical_1;
196
+ onChange?.(actual_1);
109
197
  };
110
- $[18] = allowNegative;
111
- $[19] = decimalPlaces;
112
- $[20] = fmtOpts;
113
- $[21] = isPercentage;
114
- $[22] = onChange;
115
- $[23] = thousandsSeparator;
116
- $[24] = t13;
117
- } else t13 = $[24];
118
- const handleChange = t13;
119
- let t14;
120
- if ($[25] !== decimalPlaces || $[26] !== displayBuffer || $[27] !== fmtOpts || $[28] !== isPercentage || $[29] !== max || $[30] !== min || $[31] !== onBlur || $[32] !== onChange || $[33] !== padMode) {
121
- t14 = ()=>{
198
+ $[44] = allowNegative;
199
+ $[45] = decimalPlaces;
200
+ $[46] = fmtOpts;
201
+ $[47] = isPercentage;
202
+ $[48] = onChange;
203
+ $[49] = setDisplayBuffer;
204
+ $[50] = thousandsSeparator;
205
+ $[51] = t16;
206
+ } else t16 = $[51];
207
+ const handleChange = t16;
208
+ let t17;
209
+ if ($[52] !== canonicalToDisplay || $[53] !== decimalPlaces || $[54] !== displayBuffer || $[55] !== fmtOpts || $[56] !== isPercentage || $[57] !== isValueControlled || $[58] !== max || $[59] !== min || $[60] !== onBlur || $[61] !== onChange || $[62] !== padMode || $[63] !== setDisplayBuffer || $[64] !== value) {
210
+ t17 = ()=>{
122
211
  isFocusedRef.current = false;
123
- const raw_0 = inputRef.current?.value ?? displayBuffer;
124
- let canonical_1 = parse(raw_0, fmtOpts);
125
- canonical_1 = padOnBlur(canonical_1, decimalPlaces, padMode);
126
- let actual_1 = isPercentage ? fromPercent(canonical_1) : canonical_1;
127
- actual_1 = clampToRange(actual_1, min, max);
128
- const canonicalAfter = isPercentage ? toPercent(actual_1) : actual_1;
212
+ const raw_0 = isValueControlled ? canonicalToDisplay(value ?? "") : inputRef.current?.value ?? displayBuffer;
213
+ let canonical_2 = parse(raw_0, fmtOpts);
214
+ canonical_2 = padOnBlur(canonical_2, decimalPlaces, padMode);
215
+ let actual_2 = isPercentage ? fromPercent(canonical_2) : canonical_2;
216
+ actual_2 = clampToRange(actual_2, min, max);
217
+ const canonicalAfter = isPercentage ? toPercent(actual_2) : actual_2;
129
218
  const newDisplay_0 = format(canonicalAfter, fmtOpts);
130
219
  setDisplayBuffer(newDisplay_0);
131
- onChange?.(actual_1);
132
- onBlur?.(actual_1);
220
+ onChange?.(actual_2);
221
+ onBlur?.(actual_2);
133
222
  };
134
- $[25] = decimalPlaces;
135
- $[26] = displayBuffer;
136
- $[27] = fmtOpts;
137
- $[28] = isPercentage;
138
- $[29] = max;
139
- $[30] = min;
140
- $[31] = onBlur;
141
- $[32] = onChange;
142
- $[33] = padMode;
143
- $[34] = t14;
144
- } else t14 = $[34];
145
- const handleBlur = t14;
146
- let t15;
147
- if ($[35] === Symbol.for("react.memo_cache_sentinel")) {
148
- t15 = ()=>{
223
+ $[52] = canonicalToDisplay;
224
+ $[53] = decimalPlaces;
225
+ $[54] = displayBuffer;
226
+ $[55] = fmtOpts;
227
+ $[56] = isPercentage;
228
+ $[57] = isValueControlled;
229
+ $[58] = max;
230
+ $[59] = min;
231
+ $[60] = onBlur;
232
+ $[61] = onChange;
233
+ $[62] = padMode;
234
+ $[63] = setDisplayBuffer;
235
+ $[64] = value;
236
+ $[65] = t17;
237
+ } else t17 = $[65];
238
+ const handleBlur = t17;
239
+ let t18;
240
+ if ($[66] === Symbol.for("react.memo_cache_sentinel")) {
241
+ t18 = ()=>{
149
242
  isFocusedRef.current = true;
150
243
  };
151
- $[35] = t15;
152
- } else t15 = $[35];
153
- const handleFocus = t15;
154
- let t16;
155
- if ($[36] !== displayBuffer || $[37] !== thousandsSeparator) {
156
- t16 = (e_0)=>{
244
+ $[66] = t18;
245
+ } else t18 = $[66];
246
+ const handleFocus = t18;
247
+ let t19;
248
+ if ($[67] !== displayBuffer || $[68] !== thousandsSeparator) {
249
+ t19 = (e_0)=>{
157
250
  if ("Backspace" !== e_0.key) return;
158
251
  const el = inputRef.current;
159
252
  if (!el) return;
160
253
  const cursor_0 = el.selectionStart ?? 0;
161
254
  if (cursor_0 > 0 && isThousandSepBeforeCursor(displayBuffer, cursor_0, thousandsSeparator)) el.setSelectionRange(cursor_0 - 1, cursor_0 - 1);
162
255
  };
163
- $[36] = displayBuffer;
164
- $[37] = thousandsSeparator;
165
- $[38] = t16;
166
- } else t16 = $[38];
167
- const handleKeyDown = t16;
168
- let t17;
169
- if ($[39] !== displayBuffer || $[40] !== fmtOpts || $[41] !== isPercentage) {
170
- const canonical_2 = parse(displayBuffer, fmtOpts);
171
- t17 = isPercentage ? fromPercent(canonical_2) : canonical_2;
172
- $[39] = displayBuffer;
173
- $[40] = fmtOpts;
174
- $[41] = isPercentage;
175
- $[42] = t17;
176
- } else t17 = $[42];
177
- const derivedActual = t17;
178
- const t18 = decimalPlaces > 0 ? "decimal" : "numeric";
179
- let t19;
180
- if ($[43] !== displayBuffer || $[44] !== handleBlur || $[45] !== handleChange || $[46] !== handleKeyDown || $[47] !== t18) {
181
- t19 = {
256
+ $[67] = displayBuffer;
257
+ $[68] = thousandsSeparator;
258
+ $[69] = t19;
259
+ } else t19 = $[69];
260
+ const handleKeyDown = t19;
261
+ let t20;
262
+ if ($[70] !== buffer.display || $[71] !== buffer.format || $[72] !== buffer.isPercentage) {
263
+ const canonical_3 = parse(buffer.display, buffer.format);
264
+ t20 = buffer.isPercentage ? fromPercent(canonical_3) : canonical_3;
265
+ $[70] = buffer.display;
266
+ $[71] = buffer.format;
267
+ $[72] = buffer.isPercentage;
268
+ $[73] = t20;
269
+ } else t20 = $[73];
270
+ const derivedActual = t20;
271
+ const t21 = decimalPlaces > 0 ? "decimal" : "numeric";
272
+ let t22;
273
+ if ($[74] !== displayBuffer || $[75] !== handleBlur || $[76] !== handleChange || $[77] !== handleKeyDown || $[78] !== t21) {
274
+ t22 = {
182
275
  value: displayBuffer,
183
276
  onChange: handleChange,
184
277
  onBlur: handleBlur,
185
278
  onFocus: handleFocus,
186
279
  onKeyDown: handleKeyDown,
187
280
  ref: inputRef,
188
- inputMode: t18
281
+ inputMode: t21
189
282
  };
190
- $[43] = displayBuffer;
191
- $[44] = handleBlur;
192
- $[45] = handleChange;
193
- $[46] = handleKeyDown;
194
- $[47] = t18;
195
- $[48] = t19;
196
- } else t19 = $[48];
197
- let t20;
198
- if ($[49] !== derivedActual || $[50] !== displayBuffer || $[51] !== t19) {
199
- t20 = {
200
- inputProps: t19,
283
+ $[74] = displayBuffer;
284
+ $[75] = handleBlur;
285
+ $[76] = handleChange;
286
+ $[77] = handleKeyDown;
287
+ $[78] = t21;
288
+ $[79] = t22;
289
+ } else t22 = $[79];
290
+ let t23;
291
+ if ($[80] !== derivedActual || $[81] !== displayBuffer || $[82] !== t22) {
292
+ t23 = {
293
+ inputProps: t22,
201
294
  value: derivedActual,
202
295
  displayValue: displayBuffer
203
296
  };
204
- $[49] = derivedActual;
205
- $[50] = displayBuffer;
206
- $[51] = t19;
207
- $[52] = t20;
208
- } else t20 = $[52];
209
- return t20;
297
+ $[80] = derivedActual;
298
+ $[81] = displayBuffer;
299
+ $[82] = t22;
300
+ $[83] = t23;
301
+ } else t23 = $[83];
302
+ return t23;
210
303
  }
211
304
  export { useNumberInput };
@@ -1,4 +1,9 @@
1
+ import { shiftDecimal } from "./percentage.js";
1
2
  const CANONICAL_REGEX = /^-?\d*\.?\d*$/;
3
+ function toCanonical(value) {
4
+ const [coefficient, exponent] = String(value).split('e');
5
+ return void 0 === exponent ? coefficient : shiftDecimal(coefficient, Number(exponent));
6
+ }
2
7
  function isValidCanonical(canonical) {
3
8
  return CANONICAL_REGEX.test(canonical);
4
9
  }
@@ -10,8 +15,8 @@ function clampToRange(canonical, min, max) {
10
15
  if ('' === canonical || '-' === canonical) return canonical;
11
16
  const n = Number(canonical);
12
17
  if (!Number.isFinite(n)) return canonical;
13
- if (void 0 !== min && n < min) return String(min);
14
- if (void 0 !== max && n > max) return String(max);
18
+ if (void 0 !== min && n < min) return toCanonical(min);
19
+ if (void 0 !== max && n > max) return toCanonical(max);
15
20
  return canonical;
16
21
  }
17
22
  export { clampToRange, isValidCanonical, stripDisallowedSign };
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { c } from "react/compiler-runtime";
2
+ import { c } from "react-compiler-runtime";
3
3
  import { Slot } from "@radix-ui/react-slot";
4
4
  import { createContext, useContext, useRef } from "react";
5
5
  import { taoTokenVars } from "../theme/tokens.js";
@@ -0,0 +1,10 @@
1
+ import * as Dialog from '@radix-ui/react-dialog';
2
+ import { type ComponentPropsWithoutRef, type Ref } from 'react';
3
+ type ContentProps = ComponentPropsWithoutRef<typeof Dialog.Content>;
4
+ interface DialogContentProps extends ContentProps {
5
+ open: boolean;
6
+ keepAlive: boolean;
7
+ contentRef?: Ref<HTMLDivElement>;
8
+ }
9
+ export declare function DialogContent({ open, keepAlive, contentRef, ...props }: DialogContentProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,222 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { c } from "react-compiler-runtime";
3
+ import { forwardRef, memo, useImperativeHandle, useLayoutEffect, useState } from "react";
4
+ import * as __rspack_external__radix_ui_react_dialog_dabd8325 from "@radix-ui/react-dialog";
5
+ function DialogContent(t0) {
6
+ const $ = c(10);
7
+ let contentRef;
8
+ let keepAlive;
9
+ let open;
10
+ let props;
11
+ if ($[0] !== t0) {
12
+ ({ open, keepAlive, contentRef, ...props } = t0);
13
+ $[0] = t0;
14
+ $[1] = contentRef;
15
+ $[2] = keepAlive;
16
+ $[3] = open;
17
+ $[4] = props;
18
+ } else {
19
+ contentRef = $[1];
20
+ keepAlive = $[2];
21
+ open = $[3];
22
+ props = $[4];
23
+ }
24
+ let t1;
25
+ if ($[5] !== contentRef || $[6] !== keepAlive || $[7] !== open || $[8] !== props) {
26
+ t1 = keepAlive ? /*#__PURE__*/ jsx(KeptDialogContent, {
27
+ open: open,
28
+ contentRef: contentRef,
29
+ contentProps: props
30
+ }) : /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dialog_dabd8325.Content, {
31
+ ...props,
32
+ ref: contentRef
33
+ });
34
+ $[5] = contentRef;
35
+ $[6] = keepAlive;
36
+ $[7] = open;
37
+ $[8] = props;
38
+ $[9] = t1;
39
+ } else t1 = $[9];
40
+ return t1;
41
+ }
42
+ function KeptDialogContent(t0) {
43
+ const $ = c(29);
44
+ const { open, contentRef, contentProps } = t0;
45
+ const [node, setNode] = useState(null);
46
+ let t1;
47
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
48
+ t1 = {};
49
+ $[0] = t1;
50
+ } else t1 = $[0];
51
+ const [layerProps, setLayerProps] = useState(t1);
52
+ let t2;
53
+ let t3;
54
+ if ($[1] !== node) {
55
+ t2 = ()=>node;
56
+ t3 = [
57
+ node
58
+ ];
59
+ $[1] = node;
60
+ $[2] = t2;
61
+ $[3] = t3;
62
+ } else {
63
+ t2 = $[2];
64
+ t3 = $[3];
65
+ }
66
+ useImperativeHandle(contentRef, t2, t3);
67
+ let children;
68
+ let hostProps;
69
+ if ($[4] !== contentProps) {
70
+ const { children: t4, forceMount: _forceMount, asChild: _asChild, onOpenAutoFocus: _onOpenAutoFocus, onCloseAutoFocus: _onCloseAutoFocus, onEscapeKeyDown: _onEscapeKeyDown, onPointerDownOutside: _onPointerDownOutside, onFocusOutside: _onFocusOutside, onInteractOutside: _onInteractOutside, ...t5 } = contentProps;
71
+ children = t4;
72
+ hostProps = t5;
73
+ $[4] = contentProps;
74
+ $[5] = children;
75
+ $[6] = hostProps;
76
+ } else {
77
+ children = $[5];
78
+ hostProps = $[6];
79
+ }
80
+ let t4;
81
+ if ($[7] !== contentProps || $[8] !== node || $[9] !== open) {
82
+ t4 = open && node && /*#__PURE__*/ jsx(dialog_content_ModalLayer, {
83
+ node: node,
84
+ contentProps: contentProps,
85
+ onPropsChange: setLayerProps
86
+ });
87
+ $[7] = contentProps;
88
+ $[8] = node;
89
+ $[9] = open;
90
+ $[10] = t4;
91
+ } else t4 = $[10];
92
+ const t5 = layerProps["aria-labelledby"];
93
+ const t6 = layerProps["aria-describedby"];
94
+ const t7 = open ? layerProps : void 0;
95
+ const t8 = open ? "open" : "closed";
96
+ let t9;
97
+ if ($[11] !== layerProps.style || $[12] !== open) {
98
+ t9 = open ? layerProps.style : {
99
+ display: "none"
100
+ };
101
+ $[11] = layerProps.style;
102
+ $[12] = open;
103
+ $[13] = t9;
104
+ } else t9 = $[13];
105
+ let t10;
106
+ if ($[14] !== hostProps.style || $[15] !== t9) {
107
+ t10 = {
108
+ ...hostProps.style,
109
+ ...t9
110
+ };
111
+ $[14] = hostProps.style;
112
+ $[15] = t9;
113
+ $[16] = t10;
114
+ } else t10 = $[16];
115
+ let t11;
116
+ if ($[17] !== children || $[18] !== hostProps || $[19] !== layerProps.id || $[20] !== t10 || $[21] !== t5 || $[22] !== t6 || $[23] !== t7 || $[24] !== t8) {
117
+ t11 = /*#__PURE__*/ jsx("div", {
118
+ role: "dialog",
119
+ id: layerProps.id,
120
+ "aria-labelledby": t5,
121
+ "aria-describedby": t6,
122
+ ...hostProps,
123
+ ...t7,
124
+ ref: setNode,
125
+ "data-state": t8,
126
+ style: t10,
127
+ children: children
128
+ });
129
+ $[17] = children;
130
+ $[18] = hostProps;
131
+ $[19] = layerProps.id;
132
+ $[20] = t10;
133
+ $[21] = t5;
134
+ $[22] = t6;
135
+ $[23] = t7;
136
+ $[24] = t8;
137
+ $[25] = t11;
138
+ } else t11 = $[25];
139
+ let t12;
140
+ if ($[26] !== t11 || $[27] !== t4) {
141
+ t12 = /*#__PURE__*/ jsxs(Fragment, {
142
+ children: [
143
+ t4,
144
+ t11
145
+ ]
146
+ });
147
+ $[26] = t11;
148
+ $[27] = t4;
149
+ $[28] = t12;
150
+ } else t12 = $[28];
151
+ return t12;
152
+ }
153
+ const dialog_content_ModalLayer = /*#__PURE__*/ memo(function(t0) {
154
+ const $ = c(6);
155
+ const { node, contentProps, onPropsChange } = t0;
156
+ let t1;
157
+ if ($[0] !== node || $[1] !== onPropsChange) {
158
+ t1 = /*#__PURE__*/ jsx(dialog_content_HostBridge, {
159
+ node: node,
160
+ onPropsChange: onPropsChange
161
+ });
162
+ $[0] = node;
163
+ $[1] = onPropsChange;
164
+ $[2] = t1;
165
+ } else t1 = $[2];
166
+ let t2;
167
+ if ($[3] !== contentProps || $[4] !== t1) {
168
+ t2 = /*#__PURE__*/ jsx(__rspack_external__radix_ui_react_dialog_dabd8325.Content, {
169
+ ...contentProps,
170
+ asChild: true,
171
+ children: t1
172
+ });
173
+ $[3] = contentProps;
174
+ $[4] = t1;
175
+ $[5] = t2;
176
+ } else t2 = $[5];
177
+ return t2;
178
+ });
179
+ const dialog_content_HostBridge = /*#__PURE__*/ forwardRef(function(t0, ref) {
180
+ const $ = c(10);
181
+ let node;
182
+ let onPropsChange;
183
+ let props;
184
+ if ($[0] !== t0) {
185
+ ({ node, onPropsChange, ...props } = t0);
186
+ $[0] = t0;
187
+ $[1] = node;
188
+ $[2] = onPropsChange;
189
+ $[3] = props;
190
+ } else {
191
+ node = $[1];
192
+ onPropsChange = $[2];
193
+ props = $[3];
194
+ }
195
+ let t1;
196
+ let t2;
197
+ if ($[4] !== node) {
198
+ t1 = ()=>node;
199
+ t2 = [
200
+ node
201
+ ];
202
+ $[4] = node;
203
+ $[5] = t1;
204
+ $[6] = t2;
205
+ } else {
206
+ t1 = $[5];
207
+ t2 = $[6];
208
+ }
209
+ useImperativeHandle(ref, t1, t2);
210
+ let t3;
211
+ if ($[7] !== onPropsChange || $[8] !== props) {
212
+ t3 = ()=>{
213
+ onPropsChange(props);
214
+ };
215
+ $[7] = onPropsChange;
216
+ $[8] = props;
217
+ $[9] = t3;
218
+ } else t3 = $[9];
219
+ useLayoutEffect(t3);
220
+ return null;
221
+ });
222
+ export { DialogContent };