@rockshin/tao-ui 0.0.57 → 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 (30) hide show
  1. package/dist/components/app/app-notices.js +10 -3
  2. package/dist/components/avatar/avatar.js +1 -1
  3. package/dist/components/badge/badge.js +2 -2
  4. package/dist/components/breadcrumb/breadcrumb.js +5 -1
  5. package/dist/components/calendar/calendar.js +4 -1
  6. package/dist/components/carousel/carousel.js +8 -2
  7. package/dist/components/collapse/collapse-panels.js +68 -67
  8. package/dist/components/date-picker/date-localization.js +12 -14
  9. package/dist/components/divider/divider.js +1 -1
  10. package/dist/components/float-button/float-button.js +7 -5
  11. package/dist/components/image/image.js +135 -143
  12. package/dist/components/input/otp.js +6 -0
  13. package/dist/components/input/search.js +7 -5
  14. package/dist/components/list/list.js +106 -105
  15. package/dist/components/masonry/masonry.js +1 -1
  16. package/dist/components/pagination/pagination.d.ts +2 -0
  17. package/dist/components/pagination/pagination.js +4 -0
  18. package/dist/components/rate/rate.js +83 -72
  19. package/dist/components/scroll-area/scroll-area.css +1 -1
  20. package/dist/components/scroll-area/scroll-area.js +294 -222
  21. package/dist/components/select/use-select-selection.d.ts +1 -1
  22. package/dist/components/select/use-select-selection.js +60 -53
  23. package/dist/components/statistic/statistic.js +84 -78
  24. package/dist/components/steps/steps.js +1 -1
  25. package/dist/components/table/table.js +4 -1
  26. package/dist/components/upload/upload.js +2 -2
  27. package/dist/number-input/cursor.js +20 -8
  28. package/dist/number-input/format.js +12 -4
  29. package/dist/number-input/use-number-input.js +4 -1
  30. package/package.json +1 -1
@@ -254,10 +254,17 @@ function useAppMessages(config = {}) {
254
254
  error: typed('error'),
255
255
  loading: typed('loading'),
256
256
  destroy: (key_2)=>{
257
- if (void 0 !== key_2) close(key_2);
258
- else for (const current of [
257
+ if (void 0 !== key_2) return void close(key_2);
258
+ const failures = [];
259
+ for (const current of [
259
260
  ...active.current.keys()
260
- ])close(current);
261
+ ])try {
262
+ close(current);
263
+ } catch (error) {
264
+ failures.push(error);
265
+ }
266
+ if (1 === failures.length) throw failures[0];
267
+ if (failures.length > 1) throw new AggregateError(failures, 'Message cleanup failed');
261
268
  }
262
269
  };
263
270
  }, [
@@ -22,7 +22,7 @@ const AvatarRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
22
22
  const imageSrc = 'string' == typeof src && '' !== src ? src : void 0;
23
23
  const hasNativeImage = !customImage && !failed && (!!imageSrc || !!srcSet);
24
24
  const hasImage = hasNativeImage || null !== customImage;
25
- const hasIcon = null != icon && 'boolean' != typeof icon;
25
+ const hasIcon = null != icon && '' !== icon && 'boolean' != typeof icon;
26
26
  const [scale, setScale] = useState(1);
27
27
  useLayoutEffect(()=>{
28
28
  if (hasImage || hasIcon) return;
@@ -1,6 +1,6 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { c } from "react-compiler-runtime";
3
- import { forwardRef, isValidElement, useImperativeHandle, useRef } from "react";
3
+ import { Children, forwardRef, isValidElement, useImperativeHandle, useRef } from "react";
4
4
  import { useTaoConfig } from "../../provider/tao-provider.js";
5
5
  import { cx } from "../../utils/semantic.js";
6
6
  import "./badge.css";
@@ -35,7 +35,7 @@ const BadgeRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
35
35
  const label = void 0 !== numeric && numeric > overflowCount ? `${overflowCount}+` : count;
36
36
  const zero = 0 === label || '0' === label;
37
37
  const statusMode = (void 0 !== status || void 0 !== color) && (!renderable(label) || zero && !showZero);
38
- const hasChildren = Boolean(children) || 0 === children;
38
+ const hasChildren = Children.toArray(children).some(renderable);
39
39
  const statusDot = statusMode && (!!text || void 0 !== status || !zero);
40
40
  const standaloneStatus = !hasChildren && statusDot;
41
41
  const asDot = statusDot || dot && !zero;
@@ -140,7 +140,8 @@ function Breadcrumb(t0) {
140
140
  ..."button" === content.type ? {
141
141
  disabled: true
142
142
  } : {},
143
- onClick: _temp2
143
+ onClick: _temp2,
144
+ onAuxClick: _temp3
144
145
  });
145
146
  return /*#__PURE__*/ jsx(Slot, {
146
147
  ...linkProps,
@@ -282,6 +283,9 @@ function Breadcrumb(t0) {
282
283
  } else t18 = $[31];
283
284
  return t18;
284
285
  }
286
+ function _temp3(event_1) {
287
+ return event_1.preventDefault();
288
+ }
285
289
  function _temp2(event_0) {
286
290
  return event_0.preventDefault();
287
291
  }
@@ -110,7 +110,10 @@ const Calendar = /*#__PURE__*/ forwardRef((props, ref)=>{
110
110
  props.headerRender ? props.headerRender({
111
111
  value,
112
112
  type: mode,
113
- onChange: (date_4)=>select(clamp(date_4), 'customize'),
113
+ onChange: (date_4)=>{
114
+ const next_0 = clamp(date_4);
115
+ if (!props.disabledDate?.(next_0)) select(next_0, 'customize');
116
+ },
114
117
  onTypeChange: changeMode
115
118
  }) : /*#__PURE__*/ jsxs("div", {
116
119
  "data-tao-calendar-toolbar": "",
@@ -185,7 +185,13 @@ const carousel_Carousel = /*#__PURE__*/ forwardRef(function(props, ref) {
185
185
  const mergedRootRef = useMemo(()=>mergeRefs(rootRef, directionRef), [
186
186
  directionRef
187
187
  ]);
188
- const childCount = Children.toArray(children).filter((child)=>'string' == typeof child ? Boolean(child.trim()) : Boolean(child)).length;
188
+ const slides = Children.map(children, (child)=>{
189
+ if ('string' == typeof child && !child.trim()) return null;
190
+ return 'string' == typeof child || 'number' == typeof child ? /*#__PURE__*/ jsx("span", {
191
+ children: child
192
+ }) : child;
193
+ });
194
+ const childCount = slides?.length ?? 0;
189
195
  const itemsPerSlide = (rest.rows ?? 1) * (rest.slidesPerRow ?? 1);
190
196
  const count = Math.ceil(childCount / itemsPerSlide);
191
197
  const ready = count > 0 && !unslick && null !== responsiveSettings;
@@ -284,7 +290,7 @@ const carousel_Carousel = /*#__PURE__*/ forwardRef(function(props, ref) {
284
290
  autoplay: !!autoplay,
285
291
  autoplaySpeed: autoplaySpeed,
286
292
  waitForAnimate: waitForAnimate,
287
- children: children
293
+ children: slides
288
294
  })
289
295
  });
290
296
  });
@@ -281,12 +281,13 @@ function CollapsePanel(t0) {
281
281
  } else t19 = $[27];
282
282
  const t20 = open ? "open" : "closed";
283
283
  const t21 = disabled || void 0;
284
- const t22 = classNames?.trigger;
285
- const t23 = styles?.trigger;
286
- const t24 = !iconOnly && title;
287
- let t25;
288
- if ($[28] !== bodyId || $[29] !== disabled || $[30] !== icon || $[31] !== onToggle || $[32] !== open || $[33] !== t20 || $[34] !== t21 || $[35] !== t22 || $[36] !== t23 || $[37] !== t24 || $[38] !== titleId) {
289
- t25 = /*#__PURE__*/ jsxs("button", {
284
+ const t22 = renderBody ? bodyId : void 0;
285
+ const t23 = classNames?.trigger;
286
+ const t24 = styles?.trigger;
287
+ const t25 = !iconOnly && title;
288
+ let t26;
289
+ if ($[28] !== disabled || $[29] !== icon || $[30] !== onToggle || $[31] !== open || $[32] !== t20 || $[33] !== t21 || $[34] !== t22 || $[35] !== t23 || $[36] !== t24 || $[37] !== t25 || $[38] !== titleId) {
290
+ t26 = /*#__PURE__*/ jsxs("button", {
290
291
  type: "button",
291
292
  "data-tao-collapse-trigger": "",
292
293
  "data-tao-collapse-panel-trigger": "",
@@ -294,33 +295,33 @@ function CollapsePanel(t0) {
294
295
  "data-disabled": t21,
295
296
  disabled: disabled,
296
297
  "aria-expanded": open,
297
- "aria-controls": bodyId,
298
+ "aria-controls": t22,
298
299
  "aria-labelledby": titleId,
299
300
  onClick: onToggle,
300
- className: t22,
301
- style: t23,
301
+ className: t23,
302
+ style: t24,
302
303
  children: [
303
304
  icon,
304
- t24
305
+ t25
305
306
  ]
306
307
  });
307
- $[28] = bodyId;
308
- $[29] = disabled;
309
- $[30] = icon;
310
- $[31] = onToggle;
311
- $[32] = open;
312
- $[33] = t20;
313
- $[34] = t21;
314
- $[35] = t22;
315
- $[36] = t23;
316
- $[37] = t24;
308
+ $[28] = disabled;
309
+ $[29] = icon;
310
+ $[30] = onToggle;
311
+ $[31] = open;
312
+ $[32] = t20;
313
+ $[33] = t21;
314
+ $[34] = t22;
315
+ $[35] = t23;
316
+ $[36] = t24;
317
+ $[37] = t25;
317
318
  $[38] = titleId;
318
- $[39] = t25;
319
- } else t25 = $[39];
320
- const t26 = iconOnly && title;
321
- let t27;
319
+ $[39] = t26;
320
+ } else t26 = $[39];
321
+ const t27 = iconOnly && title;
322
+ let t28;
322
323
  if ($[40] !== classNames?.extra || $[41] !== item.extra || $[42] !== styles?.extra) {
323
- t27 = null != item.extra && /*#__PURE__*/ jsx("span", {
324
+ t28 = null != item.extra && /*#__PURE__*/ jsx("span", {
324
325
  "data-tao-collapse-extra": "",
325
326
  className: classNames?.extra,
326
327
  style: styles?.extra,
@@ -329,37 +330,37 @@ function CollapsePanel(t0) {
329
330
  $[40] = classNames?.extra;
330
331
  $[41] = item.extra;
331
332
  $[42] = styles?.extra;
332
- $[43] = t27;
333
- } else t27 = $[43];
334
- let t28;
335
- if ($[44] !== expandIconPlacement || $[45] !== t13 || $[46] !== t16 || $[47] !== t19 || $[48] !== t25 || $[49] !== t26 || $[50] !== t27) {
336
- t28 = /*#__PURE__*/ jsxs("div", {
333
+ $[43] = t28;
334
+ } else t28 = $[43];
335
+ let t29;
336
+ if ($[44] !== expandIconPlacement || $[45] !== t13 || $[46] !== t16 || $[47] !== t19 || $[48] !== t26 || $[49] !== t27 || $[50] !== t28) {
337
+ t29 = /*#__PURE__*/ jsxs("div", {
337
338
  "data-tao-collapse-header": "",
338
339
  "data-tao-trigger-mode": t13,
339
340
  "data-tao-icon-placement": expandIconPlacement,
340
341
  className: t16,
341
342
  style: t19,
342
343
  children: [
343
- t25,
344
344
  t26,
345
- t27
345
+ t27,
346
+ t28
346
347
  ]
347
348
  });
348
349
  $[44] = expandIconPlacement;
349
350
  $[45] = t13;
350
351
  $[46] = t16;
351
352
  $[47] = t19;
352
- $[48] = t25;
353
- $[49] = t26;
354
- $[50] = t27;
355
- $[51] = t28;
356
- } else t28 = $[51];
357
- const t29 = !open;
358
- const t30 = classNames?.content;
359
- const t31 = styles?.content;
360
- let t32;
353
+ $[48] = t26;
354
+ $[49] = t27;
355
+ $[50] = t28;
356
+ $[51] = t29;
357
+ } else t29 = $[51];
358
+ const t30 = !open;
359
+ const t31 = classNames?.content;
360
+ const t32 = styles?.content;
361
+ let t33;
361
362
  if ($[52] !== classNames?.body || $[53] !== item.children || $[54] !== item.classNames?.body || $[55] !== item.styles?.body || $[56] !== renderBody || $[57] !== styles?.body) {
362
- t32 = renderBody && /*#__PURE__*/ jsx("div", {
363
+ t33 = renderBody && /*#__PURE__*/ jsx("div", {
363
364
  "data-tao-collapse-body": "",
364
365
  className: cx(classNames?.body, item.classNames?.body),
365
366
  style: {
@@ -374,49 +375,49 @@ function CollapsePanel(t0) {
374
375
  $[55] = item.styles?.body;
375
376
  $[56] = renderBody;
376
377
  $[57] = styles?.body;
377
- $[58] = t32;
378
- } else t32 = $[58];
379
- let t33;
380
- if ($[59] !== bodyId || $[60] !== t29 || $[61] !== t30 || $[62] !== t31 || $[63] !== t32 || $[64] !== titleId) {
381
- t33 = /*#__PURE__*/ jsx("section", {
378
+ $[58] = t33;
379
+ } else t33 = $[58];
380
+ let t34;
381
+ if ($[59] !== bodyId || $[60] !== t30 || $[61] !== t31 || $[62] !== t32 || $[63] !== t33 || $[64] !== titleId) {
382
+ t34 = /*#__PURE__*/ jsx("section", {
382
383
  id: bodyId,
383
384
  "aria-labelledby": titleId,
384
- hidden: t29,
385
+ hidden: t30,
385
386
  "data-tao-collapse-content": "",
386
387
  "data-tao-collapse-panel-content": "",
387
- className: t30,
388
- style: t31,
389
- children: t32
388
+ className: t31,
389
+ style: t32,
390
+ children: t33
390
391
  });
391
392
  $[59] = bodyId;
392
- $[60] = t29;
393
- $[61] = t30;
394
- $[62] = t31;
395
- $[63] = t32;
393
+ $[60] = t30;
394
+ $[61] = t31;
395
+ $[62] = t32;
396
+ $[63] = t33;
396
397
  $[64] = titleId;
397
- $[65] = t33;
398
- } else t33 = $[65];
399
- let t34;
400
- if ($[66] !== t10 || $[67] !== t12 || $[68] !== t28 || $[69] !== t33 || $[70] !== t7 || $[71] !== t8) {
401
- t34 = /*#__PURE__*/ jsxs("div", {
398
+ $[65] = t34;
399
+ } else t34 = $[65];
400
+ let t35;
401
+ if ($[66] !== t10 || $[67] !== t12 || $[68] !== t29 || $[69] !== t34 || $[70] !== t7 || $[71] !== t8) {
402
+ t35 = /*#__PURE__*/ jsxs("div", {
402
403
  "data-tao-collapse-item": "",
403
404
  "data-state": t7,
404
405
  "data-disabled": t8,
405
406
  className: t10,
406
407
  style: t12,
407
408
  children: [
408
- t28,
409
- t33
409
+ t29,
410
+ t34
410
411
  ]
411
412
  });
412
413
  $[66] = t10;
413
414
  $[67] = t12;
414
- $[68] = t28;
415
- $[69] = t33;
415
+ $[68] = t29;
416
+ $[69] = t34;
416
417
  $[70] = t7;
417
418
  $[71] = t8;
418
- $[72] = t34;
419
- } else t34 = $[72];
420
- return t34;
419
+ $[72] = t35;
420
+ } else t35 = $[72];
421
+ return t35;
421
422
  }
422
423
  export { CollapsePanels };
@@ -58,19 +58,17 @@ function parsePickerDate(text, format, locale, numberLocale) {
58
58
  date.format(`D ${token}`).slice(2)
59
59
  ];
60
60
  };
61
- const selected = Array.from({
62
- length: 12
63
- }, (_, month)=>monthNames(month, monthTokens[0]).map((name)=>({
64
- month,
65
- name
66
- }))).flat().sort((left, right)=>right.name.length - left.name.length).find(({ name })=>normalized.includes(name));
67
- if (!selected) return dayjs(0 / 0);
68
- const numericFormat = namedFormat.replace(/(\[[^\]]*])|(MMMM|MMM)/g, (token, literal)=>{
69
- if (literal) return literal;
70
- const name = monthNames(selected.month, token).sort((left, right)=>right.length - left.length).find((candidate)=>normalized.includes(candidate));
71
- return `[${name}]`;
72
- });
73
- const parsedMonth = dayjs(`${normalized} ${String(selected.month + 1).padStart(2, '0')}`, `${numericFormat} MM`, locale, true);
74
- return exactResult(parsedMonth);
61
+ for(let month = 0; month < 12; month++){
62
+ const matchesMonth = monthNames(month, monthTokens[0]).some((name)=>normalized.includes(name));
63
+ if (!matchesMonth) continue;
64
+ const numericFormat = namedFormat.replace(/(\[[^\]]*])|(MMMM|MMM)/g, (token, literal)=>{
65
+ if (literal) return literal;
66
+ const name = monthNames(month, token).sort((left, right)=>right.length - left.length).find((candidate)=>normalized.includes(candidate));
67
+ return `[${name}]`;
68
+ });
69
+ const parsed = exactResult(dayjs(`${normalized} ${String(month + 1).padStart(2, '0')}`, `${numericFormat} MM`, locale, true));
70
+ if (parsed.isValid()) return parsed;
71
+ }
72
+ return dayjs(0 / 0);
75
73
  }
76
74
  export { formatPickerDate, parsePickerDate };
@@ -24,7 +24,7 @@ const Divider = /*#__PURE__*/ forwardRef((props, ref)=>{
24
24
  useImperativeHandle(ref, ()=>({
25
25
  nativeElement: node.current
26
26
  }));
27
- const hasTitle = 'horizontal' === direction && null != children && 'boolean' != typeof children;
27
+ const hasTitle = 'horizontal' === direction && null != children && '' !== children && 'boolean' != typeof children;
28
28
  const margin = 'string' == typeof orientationMargin && /^-?(?:\d+\.?\d*|\.\d+)$/.test(orientationMargin.trim()) ? Number(orientationMargin) : orientationMargin;
29
29
  const titleStyle = {
30
30
  ...'start' === titlePlacement ? {
@@ -49,7 +49,8 @@ const FloatButtonRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
49
49
  const slots = 'function' == typeof styles ? styles({
50
50
  props: merged
51
51
  }) : styles;
52
- const Tag = href ? 'a' : 'button';
52
+ const isLink = null != href;
53
+ const Tag = isLink ? 'a' : 'button';
53
54
  const node = useRef(null);
54
55
  useImperativeHandle(ref, ()=>node.current);
55
56
  const hasLabel = null != label && 'boolean' != typeof label;
@@ -61,10 +62,10 @@ const FloatButtonRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
61
62
  },
62
63
  href: disabled ? void 0 : href,
63
64
  target: target,
64
- type: href ? void 0 : htmlType,
65
- disabled: href ? void 0 : disabled,
66
- "aria-disabled": href && disabled || void 0,
67
- tabIndex: href && disabled ? -1 : rest.tabIndex,
65
+ type: isLink ? void 0 : htmlType,
66
+ disabled: isLink ? void 0 : disabled,
67
+ "aria-disabled": isLink && disabled || void 0,
68
+ tabIndex: isLink && disabled ? -1 : rest.tabIndex,
68
69
  "aria-label": props['aria-label'] ?? (hasLabel ? void 0 : 'string' == typeof tooltip ? tooltip : 'Action'),
69
70
  "data-tao-float-button": "",
70
71
  "data-tao-type": type,
@@ -80,6 +81,7 @@ const FloatButtonRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
80
81
  if (disabled) return void event.preventDefault();
81
82
  rest.onClick?.(event);
82
83
  },
84
+ onAuxClick: disabled ? (event_0)=>event_0.preventDefault() : rest.onAuxClick,
83
85
  children: [
84
86
  null !== glyph && /*#__PURE__*/ jsx("span", {
85
87
  "data-tao-float-button-icon": "",