@rockshin/tao-ui 0.0.56 → 0.0.58

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 (37) hide show
  1. package/component-manifest.json +1 -1
  2. package/dist/components/app/app-notices.js +10 -3
  3. package/dist/components/avatar/avatar.js +1 -1
  4. package/dist/components/badge/badge.js +2 -2
  5. package/dist/components/breadcrumb/breadcrumb.js +5 -1
  6. package/dist/components/calendar/calendar.js +4 -1
  7. package/dist/components/carousel/carousel.js +8 -2
  8. package/dist/components/collapse/collapse-panels.js +68 -67
  9. package/dist/components/date-picker/date-localization.js +12 -14
  10. package/dist/components/divider/divider.js +1 -1
  11. package/dist/components/float-button/float-button.js +7 -5
  12. package/dist/components/form/use-form.d.ts +1 -1
  13. package/dist/components/form/use-form.js +20 -0
  14. package/dist/components/image/image.js +135 -143
  15. package/dist/components/input/otp.js +6 -0
  16. package/dist/components/input/search.js +7 -5
  17. package/dist/components/list/list.js +106 -105
  18. package/dist/components/masonry/masonry.js +1 -1
  19. package/dist/components/modal/modal.js +112 -35
  20. package/dist/components/pagination/pagination.d.ts +2 -0
  21. package/dist/components/pagination/pagination.js +4 -0
  22. package/dist/components/rate/rate.js +83 -72
  23. package/dist/components/scroll-area/scroll-area.css +1 -1
  24. package/dist/components/scroll-area/scroll-area.js +294 -222
  25. package/dist/components/select/select-tags.js +2 -1
  26. package/dist/components/select/use-select-selection.d.ts +1 -1
  27. package/dist/components/select/use-select-selection.js +60 -53
  28. package/dist/components/statistic/statistic.js +84 -78
  29. package/dist/components/steps/steps.css +8 -0
  30. package/dist/components/steps/steps.d.ts +5 -1
  31. package/dist/components/steps/steps.js +126 -116
  32. package/dist/components/table/table.js +4 -1
  33. package/dist/components/upload/upload.js +2 -2
  34. package/dist/number-input/cursor.js +20 -8
  35. package/dist/number-input/format.js +12 -4
  36. package/dist/number-input/use-number-input.js +4 -1
  37. package/package.json +1 -1
@@ -117,8 +117,8 @@ function resolveStatuses(displaySteps, displayCurrent, currentStatus) {
117
117
  });
118
118
  }
119
119
  function Steps(t0) {
120
- const $ = c(96);
121
- const { items, current: t1, initial: t2, status: t3, orientation, titlePlacement, responsive: t4, size, variant: t5, type, percent, maxCount, offset: t6, ellipsis: t7, iconRender, onChange, className, style, classNames, styles } = t0;
120
+ const $ = c(100);
121
+ const { items, current: t1, initial: t2, status: t3, orientation, titlePlacement, responsive: t4, size, variant: t5, type, percent, maxCount, offset: t6, ellipsis: t7, iconRender, finishIconBackground, finishIconColor, onChange, className, style, classNames, styles } = t0;
122
122
  const current = void 0 === t1 ? 0 : t1;
123
123
  const initial = void 0 === t2 ? 0 : t2;
124
124
  const status = void 0 === t3 ? "process" : t3;
@@ -148,7 +148,7 @@ function Steps(t0) {
148
148
  const isPanel = "panel" === mergedType;
149
149
  const mergedOrientation = isPanel ? "horizontal" : "vertical" === orientation || responsive && true === screens.xs ? "vertical" : "horizontal";
150
150
  const mergedTitlePlacement = isDot || "vertical" === mergedOrientation ? "vertical" === mergedOrientation ? "horizontal" : "vertical" : "navigation" === mergedType ? "horizontal" : titlePlacement ?? "horizontal";
151
- const mergedPercent = isInline ? void 0 : percent;
151
+ const mergedPercent = isInline || void 0 === percent ? void 0 : Math.min(100, Math.max(0, percent || 0));
152
152
  const { canApplyMaxCount, displaySteps, displayCurrent } = useDisplaySteps(mergedItems, current, initial, maxCount);
153
153
  let t10;
154
154
  if ($[4] !== displayCurrent || $[5] !== displaySteps || $[6] !== status) {
@@ -188,34 +188,40 @@ function Steps(t0) {
188
188
  const t13 = String(isInline ? offset : 0);
189
189
  const t14 = styles?.root;
190
190
  let t15;
191
- if ($[16] !== style || $[17] !== t13 || $[18] !== t14) {
191
+ if ($[16] !== finishIconBackground || $[17] !== finishIconColor || $[18] !== style || $[19] !== t13 || $[20] !== t14) {
192
192
  t15 = {
193
193
  "--tao-steps-items-offset": t13,
194
+ "--tao-steps-finish-icon-background": finishIconBackground,
195
+ "--tao-steps-finish-icon-color": finishIconColor,
194
196
  ...t14,
195
197
  ...style
196
198
  };
197
- $[16] = style;
198
- $[17] = t13;
199
- $[18] = t14;
200
- $[19] = t15;
201
- } else t15 = $[19];
199
+ $[16] = finishIconBackground;
200
+ $[17] = finishIconColor;
201
+ $[18] = style;
202
+ $[19] = t13;
203
+ $[20] = t14;
204
+ $[21] = t15;
205
+ } else t15 = $[21];
202
206
  const rootStyle = t15;
203
- const t16 = ellipsis || void 0;
204
- const t17 = canApplyMaxCount || void 0;
205
- const t18 = void 0 !== mergedPercent || void 0;
206
- const t19 = classNames?.root;
207
- let t20;
208
- if ($[20] !== className || $[21] !== t19) {
209
- t20 = cx(t19, className);
210
- $[20] = className;
211
- $[21] = t19;
212
- $[22] = t20;
213
- } else t20 = $[22];
214
- let t21;
215
- if ($[23] !== classNames?.item || $[24] !== classNames?.itemContent || $[25] !== classNames?.itemHeader || $[26] !== classNames?.itemRail || $[27] !== classNames?.itemSection || $[28] !== classNames?.itemSubtitle || $[29] !== classNames?.itemTitle || $[30] !== classNames?.itemWrapper || $[31] !== contextDisabled || $[32] !== displayCurrent || $[33] !== displaySteps || $[34] !== handleStepClick || $[35] !== iconRender || $[36] !== initial || $[37] !== isDot || $[38] !== isInline || $[39] !== isPanel || $[40] !== mergedPercent || $[41] !== onChange || $[42] !== statuses || $[43] !== styles?.item || $[44] !== styles?.itemContent || $[45] !== styles?.itemHeader || $[46] !== styles?.itemRail || $[47] !== styles?.itemSection || $[48] !== styles?.itemSubtitle || $[49] !== styles?.itemTitle || $[50] !== styles?.itemWrapper) {
216
- let t22;
217
- if ($[52] !== classNames?.item || $[53] !== classNames?.itemContent || $[54] !== classNames?.itemHeader || $[55] !== classNames?.itemRail || $[56] !== classNames?.itemSection || $[57] !== classNames?.itemSubtitle || $[58] !== classNames?.itemTitle || $[59] !== classNames?.itemWrapper || $[60] !== contextDisabled || $[61] !== displayCurrent || $[62] !== displaySteps.length || $[63] !== handleStepClick || $[64] !== iconRender || $[65] !== initial || $[66] !== isDot || $[67] !== isInline || $[68] !== isPanel || $[69] !== mergedPercent || $[70] !== onChange || $[71] !== statuses || $[72] !== styles?.item || $[73] !== styles?.itemContent || $[74] !== styles?.itemHeader || $[75] !== styles?.itemRail || $[76] !== styles?.itemSection || $[77] !== styles?.itemSubtitle || $[78] !== styles?.itemTitle || $[79] !== styles?.itemWrapper) {
218
- t22 = (displayStep, displayIndex_0)=>{
207
+ const t16 = void 0 !== finishIconBackground || void 0;
208
+ const t17 = void 0 !== finishIconColor || void 0;
209
+ const t18 = ellipsis || void 0;
210
+ const t19 = canApplyMaxCount || void 0;
211
+ const t20 = void 0 !== mergedPercent || void 0;
212
+ const t21 = classNames?.root;
213
+ let t22;
214
+ if ($[22] !== className || $[23] !== t21) {
215
+ t22 = cx(t21, className);
216
+ $[22] = className;
217
+ $[23] = t21;
218
+ $[24] = t22;
219
+ } else t22 = $[24];
220
+ let t23;
221
+ if ($[25] !== classNames?.item || $[26] !== classNames?.itemContent || $[27] !== classNames?.itemHeader || $[28] !== classNames?.itemRail || $[29] !== classNames?.itemSection || $[30] !== classNames?.itemSubtitle || $[31] !== classNames?.itemTitle || $[32] !== classNames?.itemWrapper || $[33] !== contextDisabled || $[34] !== displayCurrent || $[35] !== displaySteps || $[36] !== handleStepClick || $[37] !== iconRender || $[38] !== initial || $[39] !== isDot || $[40] !== isInline || $[41] !== isPanel || $[42] !== mergedPercent || $[43] !== onChange || $[44] !== statuses || $[45] !== styles?.item || $[46] !== styles?.itemContent || $[47] !== styles?.itemHeader || $[48] !== styles?.itemRail || $[49] !== styles?.itemSection || $[50] !== styles?.itemSubtitle || $[51] !== styles?.itemTitle || $[52] !== styles?.itemWrapper) {
222
+ let t24;
223
+ if ($[54] !== classNames?.item || $[55] !== classNames?.itemContent || $[56] !== classNames?.itemHeader || $[57] !== classNames?.itemRail || $[58] !== classNames?.itemSection || $[59] !== classNames?.itemSubtitle || $[60] !== classNames?.itemTitle || $[61] !== classNames?.itemWrapper || $[62] !== contextDisabled || $[63] !== displayCurrent || $[64] !== displaySteps.length || $[65] !== handleStepClick || $[66] !== iconRender || $[67] !== initial || $[68] !== isDot || $[69] !== isInline || $[70] !== isPanel || $[71] !== mergedPercent || $[72] !== onChange || $[73] !== statuses || $[74] !== styles?.item || $[75] !== styles?.itemContent || $[76] !== styles?.itemHeader || $[77] !== styles?.itemRail || $[78] !== styles?.itemSection || $[79] !== styles?.itemSubtitle || $[80] !== styles?.itemTitle || $[81] !== styles?.itemWrapper) {
224
+ t24 = (displayStep, displayIndex_0)=>{
219
225
  const { item, originIndex, ellipsis: isEllipsisStep } = displayStep;
220
226
  const stepStatus = statuses[displayIndex_0];
221
227
  const nextStatus = statuses[displayIndex_0 + 1];
@@ -369,107 +375,111 @@ function Steps(t0) {
369
375
  }, itemKey);
370
376
  return stepNode;
371
377
  };
372
- $[52] = classNames?.item;
373
- $[53] = classNames?.itemContent;
374
- $[54] = classNames?.itemHeader;
375
- $[55] = classNames?.itemRail;
376
- $[56] = classNames?.itemSection;
377
- $[57] = classNames?.itemSubtitle;
378
- $[58] = classNames?.itemTitle;
379
- $[59] = classNames?.itemWrapper;
380
- $[60] = contextDisabled;
381
- $[61] = displayCurrent;
382
- $[62] = displaySteps.length;
383
- $[63] = handleStepClick;
384
- $[64] = iconRender;
385
- $[65] = initial;
386
- $[66] = isDot;
387
- $[67] = isInline;
388
- $[68] = isPanel;
389
- $[69] = mergedPercent;
390
- $[70] = onChange;
391
- $[71] = statuses;
392
- $[72] = styles?.item;
393
- $[73] = styles?.itemContent;
394
- $[74] = styles?.itemHeader;
395
- $[75] = styles?.itemRail;
396
- $[76] = styles?.itemSection;
397
- $[77] = styles?.itemSubtitle;
398
- $[78] = styles?.itemTitle;
399
- $[79] = styles?.itemWrapper;
400
- $[80] = t22;
401
- } else t22 = $[80];
402
- t21 = displaySteps.map(t22);
403
- $[23] = classNames?.item;
404
- $[24] = classNames?.itemContent;
405
- $[25] = classNames?.itemHeader;
406
- $[26] = classNames?.itemRail;
407
- $[27] = classNames?.itemSection;
408
- $[28] = classNames?.itemSubtitle;
409
- $[29] = classNames?.itemTitle;
410
- $[30] = classNames?.itemWrapper;
411
- $[31] = contextDisabled;
412
- $[32] = displayCurrent;
413
- $[33] = displaySteps;
414
- $[34] = handleStepClick;
415
- $[35] = iconRender;
416
- $[36] = initial;
417
- $[37] = isDot;
418
- $[38] = isInline;
419
- $[39] = isPanel;
420
- $[40] = mergedPercent;
421
- $[41] = onChange;
422
- $[42] = statuses;
423
- $[43] = styles?.item;
424
- $[44] = styles?.itemContent;
425
- $[45] = styles?.itemHeader;
426
- $[46] = styles?.itemRail;
427
- $[47] = styles?.itemSection;
428
- $[48] = styles?.itemSubtitle;
429
- $[49] = styles?.itemTitle;
430
- $[50] = styles?.itemWrapper;
431
- $[51] = t21;
432
- } else t21 = $[51];
433
- let t22;
434
- if ($[81] !== semanticValue || $[82] !== t21) {
435
- t22 = /*#__PURE__*/ jsx(StepsSemanticContext.Provider, {
378
+ $[54] = classNames?.item;
379
+ $[55] = classNames?.itemContent;
380
+ $[56] = classNames?.itemHeader;
381
+ $[57] = classNames?.itemRail;
382
+ $[58] = classNames?.itemSection;
383
+ $[59] = classNames?.itemSubtitle;
384
+ $[60] = classNames?.itemTitle;
385
+ $[61] = classNames?.itemWrapper;
386
+ $[62] = contextDisabled;
387
+ $[63] = displayCurrent;
388
+ $[64] = displaySteps.length;
389
+ $[65] = handleStepClick;
390
+ $[66] = iconRender;
391
+ $[67] = initial;
392
+ $[68] = isDot;
393
+ $[69] = isInline;
394
+ $[70] = isPanel;
395
+ $[71] = mergedPercent;
396
+ $[72] = onChange;
397
+ $[73] = statuses;
398
+ $[74] = styles?.item;
399
+ $[75] = styles?.itemContent;
400
+ $[76] = styles?.itemHeader;
401
+ $[77] = styles?.itemRail;
402
+ $[78] = styles?.itemSection;
403
+ $[79] = styles?.itemSubtitle;
404
+ $[80] = styles?.itemTitle;
405
+ $[81] = styles?.itemWrapper;
406
+ $[82] = t24;
407
+ } else t24 = $[82];
408
+ t23 = displaySteps.map(t24);
409
+ $[25] = classNames?.item;
410
+ $[26] = classNames?.itemContent;
411
+ $[27] = classNames?.itemHeader;
412
+ $[28] = classNames?.itemRail;
413
+ $[29] = classNames?.itemSection;
414
+ $[30] = classNames?.itemSubtitle;
415
+ $[31] = classNames?.itemTitle;
416
+ $[32] = classNames?.itemWrapper;
417
+ $[33] = contextDisabled;
418
+ $[34] = displayCurrent;
419
+ $[35] = displaySteps;
420
+ $[36] = handleStepClick;
421
+ $[37] = iconRender;
422
+ $[38] = initial;
423
+ $[39] = isDot;
424
+ $[40] = isInline;
425
+ $[41] = isPanel;
426
+ $[42] = mergedPercent;
427
+ $[43] = onChange;
428
+ $[44] = statuses;
429
+ $[45] = styles?.item;
430
+ $[46] = styles?.itemContent;
431
+ $[47] = styles?.itemHeader;
432
+ $[48] = styles?.itemRail;
433
+ $[49] = styles?.itemSection;
434
+ $[50] = styles?.itemSubtitle;
435
+ $[51] = styles?.itemTitle;
436
+ $[52] = styles?.itemWrapper;
437
+ $[53] = t23;
438
+ } else t23 = $[53];
439
+ let t24;
440
+ if ($[83] !== semanticValue || $[84] !== t23) {
441
+ t24 = /*#__PURE__*/ jsx(StepsSemanticContext.Provider, {
436
442
  value: semanticValue,
437
- children: t21
443
+ children: t23
438
444
  });
439
- $[81] = semanticValue;
440
- $[82] = t21;
441
- $[83] = t22;
442
- } else t22 = $[83];
443
- let t23;
444
- if ($[84] !== mergedOrientation || $[85] !== mergedTitlePlacement || $[86] !== mergedType || $[87] !== resolvedSize || $[88] !== rootStyle || $[89] !== t16 || $[90] !== t17 || $[91] !== t18 || $[92] !== t20 || $[93] !== t22 || $[94] !== variant) {
445
- t23 = /*#__PURE__*/ jsx("div", {
445
+ $[83] = semanticValue;
446
+ $[84] = t23;
447
+ $[85] = t24;
448
+ } else t24 = $[85];
449
+ let t25;
450
+ if ($[86] !== mergedOrientation || $[87] !== mergedTitlePlacement || $[88] !== mergedType || $[89] !== resolvedSize || $[90] !== rootStyle || $[91] !== t16 || $[92] !== t17 || $[93] !== t18 || $[94] !== t19 || $[95] !== t20 || $[96] !== t22 || $[97] !== t24 || $[98] !== variant) {
451
+ t25 = /*#__PURE__*/ jsx("div", {
446
452
  "data-tao-steps": "",
453
+ "data-tao-finish-icon-background": t16,
454
+ "data-tao-finish-icon-color": t17,
447
455
  "data-tao-orientation": mergedOrientation,
448
456
  "data-tao-title-placement": mergedTitlePlacement,
449
457
  "data-tao-type": mergedType,
450
458
  "data-tao-variant": variant,
451
459
  "data-tao-size": resolvedSize,
452
- "data-tao-ellipsis": t16,
453
- "data-tao-max-count": t17,
454
- "data-tao-with-progress": t18,
455
- className: t20,
460
+ "data-tao-ellipsis": t18,
461
+ "data-tao-max-count": t19,
462
+ "data-tao-with-progress": t20,
463
+ className: t22,
456
464
  style: rootStyle,
457
- children: t22
465
+ children: t24
458
466
  });
459
- $[84] = mergedOrientation;
460
- $[85] = mergedTitlePlacement;
461
- $[86] = mergedType;
462
- $[87] = resolvedSize;
463
- $[88] = rootStyle;
464
- $[89] = t16;
465
- $[90] = t17;
466
- $[91] = t18;
467
- $[92] = t20;
468
- $[93] = t22;
469
- $[94] = variant;
470
- $[95] = t23;
471
- } else t23 = $[95];
472
- return t23;
467
+ $[86] = mergedOrientation;
468
+ $[87] = mergedTitlePlacement;
469
+ $[88] = mergedType;
470
+ $[89] = resolvedSize;
471
+ $[90] = rootStyle;
472
+ $[91] = t16;
473
+ $[92] = t17;
474
+ $[93] = t18;
475
+ $[94] = t19;
476
+ $[95] = t20;
477
+ $[96] = t22;
478
+ $[97] = t24;
479
+ $[98] = variant;
480
+ $[99] = t25;
481
+ } else t25 = $[99];
482
+ return t25;
473
483
  }
474
484
  function _temp(event_0) {
475
485
  if (!event_0.defaultPrevented && event_0.target === event_0.currentTarget && ("Enter" === event_0.key || " " === event_0.key)) {
@@ -143,7 +143,9 @@ function Table({ columns: columnsProp, dataSource, rowKey, loading = false, pagi
143
143
  ] : expandedKeys.filter((k_0)=>k_0 !== key_1);
144
144
  if (!isExpansionControlled) setInternalExpandedKeys(nextKeys_1);
145
145
  expandable?.onExpand?.(expanded, record_2);
146
- expandable?.onExpandedRowsChange?.(nextKeys_1);
146
+ expandable?.onExpandedRowsChange?.([
147
+ ...nextKeys_1
148
+ ]);
147
149
  };
148
150
  const scrollRef = useRef(null);
149
151
  const headerRowRef = useRef(null);
@@ -416,6 +418,7 @@ function Table({ columns: columnsProp, dataSource, rowKey, loading = false, pagi
416
418
  "data-tao-table-row": "",
417
419
  "data-tao-selected": isSelected || void 0,
418
420
  onClick: (event)=>{
421
+ if (!event.currentTarget.contains(event.target)) return;
419
422
  const selectionCell = event.target.closest('[data-tao-table-selection-cell]');
420
423
  if (selectionCell && event.target !== selectionCell) return void event.stopPropagation();
421
424
  rowProps.onClick?.(event);
@@ -572,8 +572,8 @@ const UploadRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
572
572
  showInfo: false,
573
573
  ...props.progress,
574
574
  percent: file_15.percent ?? 0,
575
- "aria-label": file_15['aria-label'] ?? file_15.name,
576
- "aria-labelledby": file_15['aria-labelledby']
575
+ "aria-label": file_15['aria-label'] ?? props.progress?.['aria-label'] ?? file_15.name,
576
+ "aria-labelledby": file_15['aria-labelledby'] ?? props.progress?.['aria-labelledby']
577
577
  }),
578
578
  null != listConfig.extra && /*#__PURE__*/ jsx("span", {
579
579
  "data-tao-upload-extra": "",
@@ -2,16 +2,22 @@ function countAnchored(display, upTo, thousandsSeparator) {
2
2
  const limit = Math.min(upTo, display.length);
3
3
  if (!thousandsSeparator) return Math.max(0, limit);
4
4
  let count = 0;
5
- for(let i = 0; i < limit; i++)if (display[i] !== thousandsSeparator) count++;
5
+ for(let i = 0; i < limit;)if (display.startsWith(thousandsSeparator, i)) i += thousandsSeparator.length;
6
+ else {
7
+ count++;
8
+ i++;
9
+ }
6
10
  return count;
7
11
  }
8
12
  function findCursorAt(display, anchorCount, thousandsSeparator) {
9
13
  if (anchorCount <= 0) return 0;
10
14
  if (!thousandsSeparator) return Math.min(anchorCount, display.length);
11
15
  let count = 0;
12
- for(let i = 0; i < display.length; i++){
13
- if (display[i] !== thousandsSeparator) count++;
14
- if (count === anchorCount) return i + 1;
16
+ for(let i = 0; i < display.length;)if (display.startsWith(thousandsSeparator, i)) i += thousandsSeparator.length;
17
+ else {
18
+ count++;
19
+ i++;
20
+ if (count === anchorCount) return i;
15
21
  }
16
22
  return display.length;
17
23
  }
@@ -19,15 +25,21 @@ function countAnchoredFromEnd(display, fromPos, thousandsSeparator) {
19
25
  if (fromPos >= display.length) return 0;
20
26
  if (!thousandsSeparator) return display.length - Math.max(0, fromPos);
21
27
  let count = 0;
22
- for(let i = Math.max(0, fromPos); i < display.length; i++)if (display[i] !== thousandsSeparator) count++;
28
+ for(let i = display.length; i > Math.max(0, fromPos);)if (display.endsWith(thousandsSeparator, i)) i -= thousandsSeparator.length;
29
+ else {
30
+ count++;
31
+ i--;
32
+ }
23
33
  return count;
24
34
  }
25
35
  function findCursorFromEnd(display, anchoredFromEnd, thousandsSeparator) {
26
36
  if (anchoredFromEnd <= 0) return display.length;
27
37
  if (!thousandsSeparator) return Math.max(0, display.length - anchoredFromEnd);
28
38
  let count = 0;
29
- for(let i = display.length - 1; i >= 0; i--){
30
- if (display[i] !== thousandsSeparator) count++;
39
+ for(let i = display.length; i > 0;)if (display.endsWith(thousandsSeparator, i)) i -= thousandsSeparator.length;
40
+ else {
41
+ count++;
42
+ i--;
31
43
  if (count === anchoredFromEnd) return i;
32
44
  }
33
45
  return 0;
@@ -39,6 +51,6 @@ function reposition(args) {
39
51
  }
40
52
  function isThousandSepBeforeCursor(display, cursor, thousandsSeparator) {
41
53
  if (!thousandsSeparator || cursor <= 0) return false;
42
- return display[cursor - 1] === thousandsSeparator;
54
+ return display.endsWith(thousandsSeparator, cursor);
43
55
  }
44
56
  export { countAnchored, findCursorAt, isThousandSepBeforeCursor, reposition };
@@ -19,10 +19,18 @@ function parse(display, opts) {
19
19
  const body = negative ? text.slice(1) : text;
20
20
  let cleaned = '';
21
21
  let seenDecimal = false;
22
- for (const ch of body)if (ch >= '0' && ch <= '9') cleaned += ch;
23
- else if (!seenDecimal && (ch === opts.decimalSeparator || opts.allowAsciiDecimal && '.' === ch && '.' !== opts.thousandsSeparator)) {
24
- cleaned += '.';
25
- seenDecimal = true;
22
+ const { decimalSeparator } = opts;
23
+ for(let index = 0; index < body.length; index++){
24
+ const ch = body[index];
25
+ if (decimalSeparator && body.startsWith(decimalSeparator, index)) {
26
+ if (!seenDecimal) cleaned += '.';
27
+ seenDecimal = true;
28
+ index += decimalSeparator.length - 1;
29
+ } else if (ch >= '0' && ch <= '9') cleaned += ch;
30
+ else if (!seenDecimal && opts.allowAsciiDecimal && '.' === ch && '.' !== opts.thousandsSeparator) {
31
+ cleaned += '.';
32
+ seenDecimal = true;
33
+ }
26
34
  }
27
35
  if (cleaned.startsWith('.')) cleaned = `0${cleaned}`;
28
36
  return (negative ? '-' : '') + cleaned;
@@ -294,7 +294,10 @@ function useNumberInput(opts) {
294
294
  const el = inputRef.current;
295
295
  if (!el) return;
296
296
  const cursor_0 = el.selectionStart ?? 0;
297
- if (cursor_0 > 0 && el.selectionEnd === cursor_0 && isThousandSepBeforeCursor(displayBuffer, cursor_0, thousandsSeparator)) el.setSelectionRange(cursor_0 - 1, cursor_0 - 1);
297
+ if (cursor_0 > 0 && el.selectionEnd === cursor_0 && isThousandSepBeforeCursor(displayBuffer, cursor_0, thousandsSeparator)) {
298
+ const beforeSeparator = cursor_0 - thousandsSeparator.length;
299
+ el.setSelectionRange(beforeSeparator, beforeSeparator);
300
+ }
298
301
  };
299
302
  $[74] = displayBuffer;
300
303
  $[75] = thousandsSeparator;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rockshin/tao-ui",
3
- "version": "0.0.56",
3
+ "version": "0.0.58",
4
4
  "type": "module",
5
5
  "description": "A modern React component library with semantic DOM customization and OKLCH-based theming.",
6
6
  "keywords": [