@rockshin/tao-ui 0.0.57 → 0.0.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) 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 +112 -47
  4. package/dist/components/auto-complete/auto-complete.js +9 -2
  5. package/dist/components/avatar/avatar.js +1 -1
  6. package/dist/components/badge/badge.js +2 -2
  7. package/dist/components/breadcrumb/breadcrumb.js +5 -1
  8. package/dist/components/calendar/calendar.js +24 -17
  9. package/dist/components/carousel/carousel.js +35 -16
  10. package/dist/components/cascader/cascader.js +17 -12
  11. package/dist/components/checkbox/checkbox.d.ts +3 -1
  12. package/dist/components/checkbox/checkbox.js +65 -58
  13. package/dist/components/collapse/collapse-panels.js +68 -67
  14. package/dist/components/color-picker/color-picker.js +383 -360
  15. package/dist/components/date-picker/calendar/calendar-grid.d.ts +5 -3
  16. package/dist/components/date-picker/calendar/calendar-grid.js +9 -4
  17. package/dist/components/date-picker/calendar/month-grid.d.ts +2 -1
  18. package/dist/components/date-picker/calendar/month-grid.js +61 -45
  19. package/dist/components/date-picker/calendar/time-panel.d.ts +8 -1
  20. package/dist/components/date-picker/calendar/time-panel.js +89 -88
  21. package/dist/components/date-picker/calendar/year-grid.d.ts +2 -1
  22. package/dist/components/date-picker/calendar/year-grid.js +60 -44
  23. package/dist/components/date-picker/date-localization.js +12 -14
  24. package/dist/components/date-picker/date-picker.css +9 -0
  25. package/dist/components/date-picker/date-picker.js +22 -13
  26. package/dist/components/date-picker/range-picker.d.ts +2 -0
  27. package/dist/components/date-picker/range-picker.js +127 -70
  28. package/dist/components/date-picker/types.js +1 -1
  29. package/dist/components/divider/divider.js +1 -1
  30. package/dist/components/drawer/drawer.d.ts +1 -1
  31. package/dist/components/drawer/drawer.js +4 -3
  32. package/dist/components/dropdown/dropdown.js +11 -9
  33. package/dist/components/float-button/float-button.js +11 -9
  34. package/dist/components/form/form-item.d.ts +1 -1
  35. package/dist/components/form/form-item.js +160 -120
  36. package/dist/components/form-field/form-field-view.d.ts +2 -1
  37. package/dist/components/form-field/form-field-view.js +173 -108
  38. package/dist/components/image/image.js +135 -143
  39. package/dist/components/input/input-shared.js +3 -2
  40. package/dist/components/input/otp.js +120 -110
  41. package/dist/components/input/password.js +55 -61
  42. package/dist/components/input/search.js +13 -7
  43. package/dist/components/list/list.js +106 -105
  44. package/dist/components/masonry/masonry.js +1 -1
  45. package/dist/components/mentions/mentions.js +1 -0
  46. package/dist/components/menu/menu-render.js +1 -0
  47. package/dist/components/modal/confirm-dialog.js +11 -4
  48. package/dist/components/modal/modal.js +320 -315
  49. package/dist/components/pagination/pagination.d.ts +3 -0
  50. package/dist/components/pagination/pagination.js +5 -0
  51. package/dist/components/popover/popover.js +325 -289
  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/rate/rate.js +83 -72
  56. package/dist/components/scroll-area/scroll-area.css +1 -1
  57. package/dist/components/scroll-area/scroll-area.js +294 -222
  58. package/dist/components/select/mobile-select.js +6 -3
  59. package/dist/components/select/select-model.js +2 -2
  60. package/dist/components/select/select.js +78 -39
  61. package/dist/components/select/use-select-selection.d.ts +1 -1
  62. package/dist/components/select/use-select-selection.js +91 -84
  63. package/dist/components/slider/slider.d.ts +2 -2
  64. package/dist/components/slider/slider.js +13 -2
  65. package/dist/components/sonner/sonner.js +2 -2
  66. package/dist/components/splitter/splitter.css +1 -0
  67. package/dist/components/splitter/splitter.js +152 -126
  68. package/dist/components/statistic/statistic.js +84 -78
  69. package/dist/components/steps/steps.js +1 -1
  70. package/dist/components/switch/switch.js +45 -39
  71. package/dist/components/table/table.js +5 -1
  72. package/dist/components/table/use-table-data.js +2 -2
  73. package/dist/components/time-picker/time-picker.js +31 -1
  74. package/dist/components/tooltip/tooltip.js +237 -99
  75. package/dist/components/tree/tree.js +31 -3
  76. package/dist/components/tree-select/tree-select.js +1 -1
  77. package/dist/components/upload/upload.js +69 -42
  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/cursor.js +20 -8
  97. package/dist/number-input/format.js +13 -5
  98. package/dist/number-input/use-number-input.js +166 -318
  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 +49 -49
  103. package/dist/utils/composed-parent.d.ts +1 -0
  104. package/dist/utils/composed-parent.js +7 -0
  105. package/dist/utils/portal.d.ts +5 -0
  106. package/dist/utils/portal.js +7 -1
  107. package/dist/utils/refs.d.ts +3 -1
  108. package/dist/utils/refs.js +25 -1
  109. package/package.json +1 -1
@@ -1,5 +1,6 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { forwardRef, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
3
+ import { getComposedParent } from "../../utils/composed-parent.js";
3
4
  import { cx } from "../../utils/semantic.js";
4
5
  import "./affix.css";
5
6
  const Affix = /*#__PURE__*/ forwardRef((props, ref)=>{
@@ -82,17 +83,47 @@ const Affix = /*#__PURE__*/ forwardRef((props, ref)=>{
82
83
  passive: true
83
84
  });
84
85
  });
85
- if (scrollTarget !== view_0) view_0.addEventListener('resize', updatePosition);
86
+ if (scrollTarget !== view_0) {
87
+ view_0.addEventListener('resize', updatePosition);
88
+ view_0.addEventListener('scroll', updatePosition, {
89
+ passive: true
90
+ });
91
+ }
92
+ const targetElement = scrollTarget && 'getBoundingClientRect' in scrollTarget ? scrollTarget : null;
93
+ const sources = [
94
+ holder.current,
95
+ targetElement
96
+ ];
97
+ function* ancestors() {
98
+ for (const source of sources)for(let node_0 = source; node_0; node_0 = getComposedParent(node_0))yield node_0;
99
+ }
100
+ const scrollRoots = new Set([
101
+ view_0
102
+ ]);
103
+ for (const node_1 of ancestors()){
104
+ const root = node_1.getRootNode();
105
+ if ('host' in root) scrollRoots.add(root);
106
+ }
107
+ const onAncestorScroll = (event_0)=>{
108
+ if (event_0.target === scrollTarget) return;
109
+ for (const node_2 of ancestors())if (node_2 === event_0.target) return void updatePosition();
110
+ };
111
+ for (const root_0 of scrollRoots)root_0.addEventListener('scroll', onAncestorScroll, {
112
+ capture: true,
113
+ passive: true
114
+ });
86
115
  const observer = new ResizeObserver(updatePosition);
87
116
  if (holder.current) observer.observe(holder.current);
88
117
  if (content.current) observer.observe(content.current);
89
118
  if (scrollTarget && 'getBoundingClientRect' in scrollTarget) observer.observe(scrollTarget);
90
119
  updatePosition();
91
120
  return ()=>{
92
- events.forEach((event_0)=>{
93
- scrollTarget?.removeEventListener(event_0, updatePosition);
121
+ events.forEach((event_1)=>{
122
+ scrollTarget?.removeEventListener(event_1, updatePosition);
94
123
  });
95
124
  view_0.removeEventListener('resize', updatePosition);
125
+ view_0.removeEventListener('scroll', updatePosition);
126
+ for (const root_1 of scrollRoots)root_1.removeEventListener('scroll', onAncestorScroll, true);
96
127
  observer.disconnect();
97
128
  updatePosition.cancel();
98
129
  };
@@ -107,7 +138,10 @@ const Affix = /*#__PURE__*/ forwardRef((props, ref)=>{
107
138
  });
108
139
  const fixedStyle = position ? {
109
140
  position: 'fixed',
110
- ...position
141
+ top: position.top,
142
+ bottom: position.bottom,
143
+ left: position.left,
144
+ width: position.width
111
145
  } : {};
112
146
  return /*#__PURE__*/ jsxs("div", {
113
147
  ...rest,
@@ -1,5 +1,5 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { createContext, createElement, useContext, useLayoutEffect, useRef, useState } from "react";
2
+ import { createContext, createElement, useContext, useId, useLayoutEffect, useRef, useState } from "react";
3
3
  import { c } from "react-compiler-runtime";
4
4
  import { useLayoutEffect as util_useLayoutEffect } from "@rc-component/util";
5
5
  import { useTaoConfig } from "../../provider/tao-provider.js";
@@ -19,9 +19,12 @@ function CancelBtn() {
19
19
  return useContext(ActionContext).cancel;
20
20
  }
21
21
  function AppConfirm({ config, open, markOpen, close, remove }) {
22
- const { locale } = useTaoConfig();
22
+ const { locale, disabled } = useTaoConfig();
23
+ const showCancel = config.okCancel ?? 'confirm' === config.type;
24
+ const closable = config.closable ?? (!!(config.okButtonProps?.disabled ?? disabled) && (null === config.footer || !showCancel || !!config.cancelButtonProps?.disabled));
23
25
  const [pending, setPending] = useState(null);
24
26
  const busy = useRef(false);
27
+ const contentId = useId();
25
28
  useLayoutEffect(()=>markOpen(open), [
26
29
  markOpen,
27
30
  open
@@ -61,7 +64,7 @@ function AppConfirm({ config, open, markOpen, close, remove }) {
61
64
  ...config.cancelButtonProps,
62
65
  "data-tao-modal-action": "cancel",
63
66
  loading: 'cancel' === pending || config.cancelButtonProps?.loading,
64
- disabled: 'ok' === pending || config.cancelButtonProps?.disabled,
67
+ disabled: 'ok' === pending || !!config.cancelButtonProps?.disabled,
65
68
  onClick: (event_0)=>{
66
69
  config.cancelButtonProps?.onClick?.(event_0);
67
70
  if (!event_0.defaultPrevented) run('cancel');
@@ -70,7 +73,7 @@ function AppConfirm({ config, open, markOpen, close, remove }) {
70
73
  });
71
74
  const defaultFooter = /*#__PURE__*/ jsxs(Fragment, {
72
75
  children: [
73
- (config.okCancel ?? 'confirm' === config.type) && /*#__PURE__*/ jsx(CancelBtn, {}),
76
+ showCancel && /*#__PURE__*/ jsx(CancelBtn, {}),
74
77
  /*#__PURE__*/ jsx(OkBtn, {})
75
78
  ]
76
79
  });
@@ -93,11 +96,12 @@ function AppConfirm({ config, open, markOpen, close, remove }) {
93
96
  ...config,
94
97
  open: open,
95
98
  title: config.title,
99
+ "aria-describedby": config['aria-describedby'] ?? (null != config.content ? contentId : void 0),
96
100
  width: config.width ?? 416,
97
101
  centered: config.centered ?? false,
98
- closable: config.closable ? {
102
+ closable: closable ? {
99
103
  'aria-label': locale.close,
100
- ...'object' == typeof config.closable ? config.closable : {}
104
+ ...'object' == typeof closable ? closable : {}
101
105
  } : false,
102
106
  maskClosable: config.maskClosable ?? false,
103
107
  onClose: ()=>{
@@ -140,6 +144,7 @@ function AppConfirm({ config, open, markOpen, close, remove }) {
140
144
  children: icon
141
145
  }),
142
146
  /*#__PURE__*/ jsx("div", {
147
+ id: contentId,
143
148
  "data-tao-app-modal-content": "",
144
149
  children: config.content
145
150
  })
@@ -4,6 +4,7 @@ import { useNotification } from "@rc-component/notification";
4
4
  import { useLayoutEffect } from "@rc-component/util";
5
5
  import { useMemo, useRef } from "react";
6
6
  import { TaoPortalScope, useTaoConfig, useTaoInternalConfig } from "../../provider/tao-provider.js";
7
+ import { useCommittedRef } from "../../utils/refs.js";
7
8
  import { cx } from "../../utils/semantic.js";
8
9
  import { Spinner } from "../spinner/spinner.js";
9
10
  import { StatusIcon } from "../status-icon/status-icon.js";
@@ -165,13 +166,15 @@ function messageResult(promise, close) {
165
166
  then: promise.then.bind(promise)
166
167
  });
167
168
  }
169
+ function explicitMessageKey(key) {
170
+ return `tao-app-explicit:${typeof key}:${key}`;
171
+ }
168
172
  function useAppMessages(config = {}) {
169
173
  const [notices, holder] = useNoticeHolder('message', config);
170
174
  const active = useRef(new Map());
171
175
  const sequence = useRef(0);
172
176
  const disposed = useRef(false);
173
- const latest = useRef(config);
174
- latest.current = config;
177
+ const latest = useCommittedRef(config);
175
178
  useLayoutEffect(()=>{
176
179
  disposed.current = false;
177
180
  return ()=>{
@@ -198,7 +201,7 @@ function useAppMessages(config = {}) {
198
201
  const open = (args)=>{
199
202
  if (disposed.current) return messageResult(Promise.resolve(true), ()=>{});
200
203
  const defaults = latest.current;
201
- const key_1 = args.key ?? `tao-app-message-${sequence.current++}`;
204
+ const key_1 = null == args.key ? `tao-app-message-${sequence.current++}` : explicitMessageKey(args.key);
202
205
  const merged = {
203
206
  ...defaults,
204
207
  ...args
@@ -254,13 +257,21 @@ function useAppMessages(config = {}) {
254
257
  error: typed('error'),
255
258
  loading: typed('loading'),
256
259
  destroy: (key_2)=>{
257
- if (void 0 !== key_2) close(key_2);
258
- else for (const current of [
259
- ...active.current.keys()
260
- ])close(current);
260
+ if (void 0 !== key_2) return void close(explicitMessageKey(key_2));
261
+ const failures = [];
262
+ for (const [key_3, life_3] of [
263
+ ...active.current
264
+ ])try {
265
+ close(key_3, life_3);
266
+ } catch (error) {
267
+ failures.push(error);
268
+ }
269
+ if (1 === failures.length) throw failures[0];
270
+ if (failures.length > 1) throw new AggregateError(failures, 'Message cleanup failed');
261
271
  }
262
272
  };
263
273
  }, [
274
+ latest,
264
275
  notices
265
276
  ]);
266
277
  return [
@@ -268,29 +279,36 @@ function useAppMessages(config = {}) {
268
279
  holder
269
280
  ];
270
281
  }
271
- function useAppNotifications(config = {}) {
282
+ function useAppNotifications(t0) {
283
+ const $ = c(23);
284
+ let t1;
285
+ if ($[0] !== t0) {
286
+ t1 = void 0 === t0 ? {} : t0;
287
+ $[0] = t0;
288
+ $[1] = t1;
289
+ } else t1 = $[1];
290
+ const config = t1;
272
291
  const { locale } = useTaoConfig();
273
- const closeLabel = useRef(locale.close);
274
- closeLabel.current = locale.close;
275
- const [notices, holder] = useNoticeHolder('notification', config);
276
- const latest = useRef(config);
277
- latest.current = config;
278
- const api = useMemo(()=>{
279
- const open = (args)=>{
292
+ const closeLabel = useCommittedRef(locale.close);
293
+ const [notices, holder] = useNoticeHolder("notification", config);
294
+ const latest = useCommittedRef(config);
295
+ let t2;
296
+ if ($[2] !== closeLabel || $[3] !== latest || $[4] !== notices) {
297
+ t2 = (args)=>{
280
298
  const defaults = latest.current;
281
299
  const merged = {
282
300
  ...defaults,
283
301
  ...args
284
302
  };
285
- const closeIcon = void 0 === args.closeIcon ? void 0 === defaults.closeIcon ? '×' : defaults.closeIcon : args.closeIcon;
303
+ const closeIcon = void 0 === args.closeIcon ? void 0 === defaults.closeIcon ? "\xD7" : defaults.closeIcon : args.closeIcon;
286
304
  const closable = false === args.closable || null === args.closable || false === closeIcon || null === closeIcon ? false : {
287
305
  closeIcon,
288
- 'aria-label': closeLabel.current,
289
- ...'object' == typeof args.closable ? args.closable : {}
306
+ "aria-label": closeLabel.current,
307
+ ..."object" == typeof args.closable ? args.closable : {}
290
308
  };
291
309
  const classNames = noticeClasses(resolveAppSemantic(defaults.classNames, merged), resolveAppSemantic(args.classNames, merged));
292
310
  const styles = noticeStyles(resolveAppSemantic(defaults.styles, merged), resolveAppSemantic(args.styles, merged));
293
- const disabledClose = 'object' == typeof closable && closable?.disabled;
311
+ const disabledClose = "object" == typeof closable && closable?.disabled;
294
312
  const title = args.title ?? args.message;
295
313
  notices.open({
296
314
  ...args,
@@ -300,7 +318,7 @@ function useAppNotifications(config = {}) {
300
318
  /*#__PURE__*/ jsx("button", {
301
319
  type: "button",
302
320
  disabled: true,
303
- "aria-label": closable['aria-label'] ?? closeLabel.current,
321
+ "aria-label": closable["aria-label"] ?? closeLabel.current,
304
322
  className: classNames.close,
305
323
  style: styles.close,
306
324
  children: closable.closeIcon
@@ -308,43 +326,90 @@ function useAppNotifications(config = {}) {
308
326
  ]
309
327
  }) : title,
310
328
  actions: args.actions ?? args.btn,
311
- placement: args.placement ?? defaults.placement ?? 'topRight',
329
+ placement: args.placement ?? defaults.placement ?? "topRight",
312
330
  duration: args.duration ?? defaults.duration ?? 4.5,
313
331
  pauseOnHover: args.pauseOnHover ?? defaults.pauseOnHover ?? true,
314
332
  showProgress: args.showProgress ?? defaults.showProgress,
315
- role: args.role ?? 'alert',
333
+ role: args.role ?? "alert",
316
334
  icon: iconFor(args.type, args.icon),
317
335
  classNames,
318
336
  styles,
319
337
  closable: disabledClose ? false : closable
320
338
  });
321
339
  };
322
- return {
340
+ $[2] = closeLabel;
341
+ $[3] = latest;
342
+ $[4] = notices;
343
+ $[5] = t2;
344
+ } else t2 = $[5];
345
+ const open = t2;
346
+ let t3;
347
+ let t4;
348
+ let t5;
349
+ let t6;
350
+ if ($[6] !== open) {
351
+ t3 = (args_0)=>open({
352
+ ...args_0,
353
+ type: "success"
354
+ });
355
+ t4 = (args_1)=>open({
356
+ ...args_1,
357
+ type: "info"
358
+ });
359
+ t5 = (args_2)=>open({
360
+ ...args_2,
361
+ type: "error"
362
+ });
363
+ t6 = (args_3)=>open({
364
+ ...args_3,
365
+ type: "warning"
366
+ });
367
+ $[6] = open;
368
+ $[7] = t3;
369
+ $[8] = t4;
370
+ $[9] = t5;
371
+ $[10] = t6;
372
+ } else {
373
+ t3 = $[7];
374
+ t4 = $[8];
375
+ t5 = $[9];
376
+ t6 = $[10];
377
+ }
378
+ let t7;
379
+ if ($[11] !== notices) {
380
+ t7 = (key)=>void 0 === key ? notices.destroy() : notices.close(key);
381
+ $[11] = notices;
382
+ $[12] = t7;
383
+ } else t7 = $[12];
384
+ let t8;
385
+ if ($[13] !== open || $[14] !== t3 || $[15] !== t4 || $[16] !== t5 || $[17] !== t6 || $[18] !== t7) {
386
+ t8 = {
323
387
  open,
324
- success: (args_0)=>open({
325
- ...args_0,
326
- type: 'success'
327
- }),
328
- info: (args_1)=>open({
329
- ...args_1,
330
- type: 'info'
331
- }),
332
- error: (args_2)=>open({
333
- ...args_2,
334
- type: 'error'
335
- }),
336
- warning: (args_3)=>open({
337
- ...args_3,
338
- type: 'warning'
339
- }),
340
- destroy: (key)=>void 0 === key ? notices.destroy() : notices.close(key)
388
+ success: t3,
389
+ info: t4,
390
+ error: t5,
391
+ warning: t6,
392
+ destroy: t7
341
393
  };
342
- }, [
343
- notices
344
- ]);
345
- return [
346
- api,
347
- holder
348
- ];
394
+ $[13] = open;
395
+ $[14] = t3;
396
+ $[15] = t4;
397
+ $[16] = t5;
398
+ $[17] = t6;
399
+ $[18] = t7;
400
+ $[19] = t8;
401
+ } else t8 = $[19];
402
+ const api = t8;
403
+ let t9;
404
+ if ($[20] !== api || $[21] !== holder) {
405
+ t9 = [
406
+ api,
407
+ holder
408
+ ];
409
+ $[20] = api;
410
+ $[21] = holder;
411
+ $[22] = t9;
412
+ } else t9 = $[22];
413
+ return t9;
349
414
  }
350
415
  export { resolveAppSemantic, useAppMessages, useAppNotifications };
@@ -16,10 +16,16 @@ function InternalAutoComplete(props, ref) {
16
16
  const customInput = 1 === nodes.length && /*#__PURE__*/ isValidElement(nodes[0]) && nodes[0].type !== RcSelectComponent.Option && nodes[0].type !== RcSelectComponent.OptGroup ? nodes[0] : void 0;
17
17
  const optionsChildren = customInput ? void 0 : children;
18
18
  const input = customInput ?? components?.input;
19
- const mergedComponents = disabled && /*#__PURE__*/ isValidElement(input) ? {
19
+ const inheritsStatus = status && /*#__PURE__*/ isValidElement(input) && 'string' != typeof input.type && null == input.props.status;
20
+ const mergedComponents = /*#__PURE__*/ isValidElement(input) && (disabled || inheritsStatus) ? {
20
21
  ...components,
21
22
  input: /*#__PURE__*/ cloneElement(input, {
22
- disabled: true
23
+ ...disabled ? {
24
+ disabled: true
25
+ } : {},
26
+ ...inheritsStatus ? {
27
+ status
28
+ } : {}
23
29
  })
24
30
  } : customInput ? {
25
31
  ...components,
@@ -73,6 +79,7 @@ function InternalAutoComplete(props, ref) {
73
79
  "data-tao-error": 'error' === status || void 0,
74
80
  "data-tao-warning": 'warning' === status || void 0,
75
81
  disabled: disabled,
82
+ "aria-invalid": 'error' === status ? true : props['aria-invalid'],
76
83
  onInputKeyDown: (event)=>{
77
84
  props.onInputKeyDown?.(event);
78
85
  if ('Enter' === event.key && (event.nativeEvent.isComposing || 229 === event.keyCode)) event.stopPropagation();
@@ -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
  }
@@ -53,14 +53,18 @@ const Calendar = /*#__PURE__*/ forwardRef((props, ref)=>{
53
53
  const { calendarView } = config.locale.messages;
54
54
  const months = locale.shortMonths ?? dayjs.locale.getShortMonths?.(locale.locale) ?? [];
55
55
  const disabled = (date_0)=>config.disabled || !!(validRange && (date_0.isBefore(validRange[0], 'day') || date_0.isAfter(validRange[1], 'day'))) || !!props.disabledDate?.(date_0);
56
- const select = (date_1, source)=>{
56
+ const monthDisabled = (date_1)=>{
57
+ for(let day = date_1.startOf('month'); day.isSame(date_1, 'month'); day = day.add(1, 'day'))if (!disabled(day)) return false;
58
+ return true;
59
+ };
60
+ const select = (date_2, source)=>{
57
61
  if (config.disabled) return;
58
- if (void 0 === props.value) setValue(date_1);
59
- if (!date_1.isSame(value, 'day')) {
60
- if (!date_1.isSame(value, 'month' === mode ? 'month' : 'year')) props.onPanelChange?.(date_1, mode);
61
- props.onChange?.(date_1);
62
+ if (void 0 === props.value) setValue(date_2);
63
+ if (!date_2.isSame(value, 'day')) {
64
+ if (!date_2.isSame(value, 'month' === mode ? 'month' : 'year')) props.onPanelChange?.(date_2, mode);
65
+ props.onChange?.(date_2);
62
66
  }
63
- props.onSelect?.(date_1, {
67
+ props.onSelect?.(date_2, {
64
68
  source
65
69
  });
66
70
  };
@@ -69,23 +73,23 @@ const Calendar = /*#__PURE__*/ forwardRef((props, ref)=>{
69
73
  if (void 0 === props.mode) setMode(next);
70
74
  props.onPanelChange?.(value, next);
71
75
  };
72
- const clamp = (date_2)=>validRange ? date_2.isBefore(validRange[0], 'day') ? validRange[0] : date_2.isAfter(validRange[1], 'day') ? validRange[1] : date_2 : date_2;
76
+ const clamp = (date_3)=>validRange ? date_3.isBefore(validRange[0], 'day') ? validRange[0] : date_3.isAfter(validRange[1], 'day') ? validRange[1] : date_3 : date_3;
73
77
  const firstYear = validRange?.[0].year() ?? value.year() - 10;
74
78
  const lastYear = validRange?.[1].year() ?? value.year() + 10;
75
79
  const minMonth = validRange && value.year() === validRange[0].year() ? validRange[0].month() : 0;
76
80
  const maxMonth = validRange && value.year() === validRange[1].year() ? validRange[1].month() : 11;
77
- const renderCell = (date_3, info)=>{
78
- if (props.fullCellRender) return props.fullCellRender(date_3, info);
81
+ const renderCell = (date_4, info)=>{
82
+ if (props.fullCellRender) return props.fullCellRender(date_4, info);
79
83
  const legacyFull = 'month' === info.type ? props.monthFullCellRender : props.dateFullCellRender;
80
- if (legacyFull) return legacyFull(date_3);
81
- const extra = props.cellRender ? props.cellRender(date_3, info) : 'month' === info.type ? props.monthCellRender?.(date_3) : props.dateCellRender?.(date_3);
84
+ if (legacyFull) return legacyFull(date_4);
85
+ const extra = props.cellRender ? props.cellRender(date_4, info) : 'month' === info.type ? props.monthCellRender?.(date_4) : props.dateCellRender?.(date_4);
82
86
  return /*#__PURE__*/ jsxs("div", {
83
87
  "data-tao-calendar-item": "",
84
- "data-today": date_3.isSame(dayjs_0(), 'month' === info.type ? 'month' : 'day') || void 0,
88
+ "data-today": date_4.isSame(dayjs_0(), 'month' === info.type ? 'month' : 'day') || void 0,
85
89
  children: [
86
90
  /*#__PURE__*/ jsx("span", {
87
91
  "data-tao-calendar-value": "",
88
- children: 'month' === info.type ? months[date_3.month()] : String(date_3.date()).padStart(2, '0')
92
+ children: 'month' === info.type ? months[date_4.month()] : String(date_4.date()).padStart(2, '0')
89
93
  }),
90
94
  /*#__PURE__*/ jsx("div", {
91
95
  "data-tao-calendar-events": "",
@@ -110,7 +114,10 @@ const Calendar = /*#__PURE__*/ forwardRef((props, ref)=>{
110
114
  props.headerRender ? props.headerRender({
111
115
  value,
112
116
  type: mode,
113
- onChange: (date_4)=>select(clamp(date_4), 'customize'),
117
+ onChange: (date_5)=>{
118
+ const next_0 = clamp(date_5);
119
+ if (!props.disabledDate?.(next_0)) select(next_0, 'customize');
120
+ },
114
121
  onTypeChange: changeMode
115
122
  }) : /*#__PURE__*/ jsxs("div", {
116
123
  "data-tao-calendar-toolbar": "",
@@ -177,9 +184,9 @@ const Calendar = /*#__PURE__*/ forwardRef((props, ref)=>{
177
184
  picker: 'year' === mode ? 'month' : 'date',
178
185
  hideHeader: true,
179
186
  showWeek: props.showWeek,
180
- disabledDate: disabled,
181
- onSelect: (date_5)=>'year' === mode ? select(clamp(date_5), 'month') : select(date_5, 'date'),
182
- cellRender: (date_6, info_0)=>renderCell(date_6, info_0),
187
+ disabledDate: 'year' === mode ? monthDisabled : disabled,
188
+ onSelect: (date_6)=>'year' === mode ? select(clamp(date_6), 'month') : select(date_6, 'date'),
189
+ cellRender: (date_7, info_0)=>renderCell(date_7, info_0),
183
190
  classNames: {
184
191
  body: names?.body,
185
192
  content: names?.content,
@@ -1,7 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { c } from "react-compiler-runtime";
3
3
  import react_slick from "@ant-design/react-slick";
4
- import { Children, forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
4
+ import { Children, cloneElement, forwardRef, isValidElement, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
5
5
  import { useTaoDirection, useTaoInternalConfig } from "../../provider/tao-provider.js";
6
6
  import { interopDefault } from "../../utils/interop-default.js";
7
7
  import { mergeRefs } from "../../utils/refs.js";
@@ -52,6 +52,10 @@ function _temp2(t0) {
52
52
  function _temp(a, b) {
53
53
  return a.breakpoint - b.breakpoint;
54
54
  }
55
+ const defaultPaging = (index)=>/*#__PURE__*/ jsx("button", {
56
+ type: "button",
57
+ children: index + 1
58
+ });
55
59
  function Arrow(t0) {
56
60
  const $ = c(34);
57
61
  let t1;
@@ -172,7 +176,7 @@ const carousel_Carousel = /*#__PURE__*/ forwardRef(function(props, ref) {
172
176
  const { responsive, ...baseProps } = props;
173
177
  const responsiveSettings = useResponsiveSettings(responsive);
174
178
  const unslick = 'unslick' === responsiveSettings;
175
- const { dots = true, arrows = false, prevArrow, nextArrow, draggable = false, waitForAnimate = false, dotPosition, dotPlacement, vertical, rootClassName, className, style, id, autoplay = false, autoplaySpeed = 3000, initialSlide = 0, rtl, children, effect = 'scrollx', slickGoTo, prefixCls, classNames, styles, appendDots, customPaging, ...rest } = {
179
+ const { dots = true, arrows = false, prevArrow, nextArrow, draggable = false, waitForAnimate = false, dotPosition, dotPlacement, vertical, rootClassName, className, style, id, autoplay = false, autoplaySpeed = 3000, initialSlide = 0, rtl, children, effect = 'scrollx', slickGoTo, prefixCls, classNames, styles, appendDots, customPaging, beforeChange, afterChange, ...rest } = {
176
180
  ...baseProps,
177
181
  ...unslick ? {} : responsiveSettings
178
182
  };
@@ -185,21 +189,31 @@ const carousel_Carousel = /*#__PURE__*/ forwardRef(function(props, ref) {
185
189
  const mergedRootRef = useMemo(()=>mergeRefs(rootRef, directionRef), [
186
190
  directionRef
187
191
  ]);
188
- const childCount = Children.toArray(children).filter((child)=>'string' == typeof child ? Boolean(child.trim()) : Boolean(child)).length;
192
+ const slides = Children.map(children, (child)=>{
193
+ if ('string' == typeof child && !child.trim()) return null;
194
+ return 'string' == typeof child || 'number' == typeof child ? /*#__PURE__*/ jsx("span", {
195
+ children: child
196
+ }) : child;
197
+ });
198
+ const childCount = slides?.length ?? 0;
189
199
  const itemsPerSlide = (rest.rows ?? 1) * (rest.slidesPerRow ?? 1);
190
200
  const count = Math.ceil(childCount / itemsPerSlide);
191
201
  const ready = count > 0 && !unslick && null !== responsiveSettings;
202
+ const mirror = (index)=>isRtl ? count - 1 - index : index;
192
203
  const previousPosition = useRef(null);
193
204
  useImperativeHandle(ref, ()=>({
194
205
  nativeElement: rootRef.current,
195
- goTo: (slide, dontAnimate = false)=>sliderRef.current?.slickGoTo(slide, dontAnimate),
196
- next: ()=>sliderRef.current?.slickNext(),
197
- prev: ()=>sliderRef.current?.slickPrev(),
206
+ goTo: (slide, dontAnimate = false)=>sliderRef.current?.slickGoTo(isRtl ? count - 1 - slide : slide, dontAnimate),
207
+ next: ()=>isRtl ? sliderRef.current?.slickPrev() : sliderRef.current?.slickNext(),
208
+ prev: ()=>isRtl ? sliderRef.current?.slickNext() : sliderRef.current?.slickPrev(),
198
209
  autoPlay: (playType)=>sliderRef.current?.innerSlider?.autoPlay(playType),
199
210
  get innerSlider () {
200
211
  return sliderRef.current?.innerSlider;
201
212
  }
202
- }), []);
213
+ }), [
214
+ count,
215
+ isRtl
216
+ ]);
203
217
  useEffect(()=>{
204
218
  const root = rootRef.current;
205
219
  if (!root) return;
@@ -228,7 +242,7 @@ const carousel_Carousel = /*#__PURE__*/ forwardRef(function(props, ref) {
228
242
  };
229
243
  if (!ready) return;
230
244
  if (void 0 !== slickGoTo) {
231
- if (!previous?.ready || previous.slickGoTo !== slickGoTo) sliderRef.current?.slickGoTo(slickGoTo);
245
+ if (!previous?.ready || previous.isRtl !== isRtl || previous.slickGoTo !== slickGoTo) sliderRef.current?.slickGoTo(isRtl ? count - slickGoTo - 1 : slickGoTo);
232
246
  } else if (!previous?.ready || previous.isRtl !== isRtl || previous.initialSlide !== initialSlide) sliderRef.current?.slickGoTo(isRtl ? count - initialSlide - 1 : initialSlide, true);
233
247
  }, [
234
248
  count,
@@ -262,14 +276,19 @@ const carousel_Carousel = /*#__PURE__*/ forwardRef(function(props, ref) {
262
276
  fade: 'fade' === effect || !!rest.fade,
263
277
  dots: !!dots,
264
278
  dotsClass: cx('slick-dots', 'object' == typeof dots && dots.className, classNames?.dots),
265
- appendDots: appendDots ?? ((items)=>/*#__PURE__*/ jsx("ul", {
279
+ appendDots: (items)=>{
280
+ const dotItems = Children.toArray(items);
281
+ const ordered = (isRtl ? dotItems.reverse() : dotItems).map((item, index_0)=>/*#__PURE__*/ isValidElement(item) ? /*#__PURE__*/ cloneElement(item, void 0, /*#__PURE__*/ cloneElement((customPaging ?? defaultPaging)(index_0), {
282
+ onClick: item.props.children.props.onClick
283
+ })) : item);
284
+ return appendDots ? appendDots(ordered) : /*#__PURE__*/ jsx("ul", {
266
285
  style: styles?.dots,
267
- children: items
268
- })),
269
- customPaging: customPaging ?? ((index)=>/*#__PURE__*/ jsx("button", {
270
- type: "button",
271
- children: index + 1
272
- })),
286
+ children: ordered
287
+ });
288
+ },
289
+ customPaging: ()=>/*#__PURE__*/ jsx("span", {}),
290
+ beforeChange: beforeChange && ((current, next)=>beforeChange(mirror(current), mirror(next))),
291
+ afterChange: afterChange && ((current_0)=>afterChange(mirror(current_0))),
273
292
  arrows: arrows,
274
293
  prevArrow: prevArrow ?? /*#__PURE__*/ jsx(Arrow, {
275
294
  "aria-label": isRtl ? locale.next : locale.previous
@@ -284,7 +303,7 @@ const carousel_Carousel = /*#__PURE__*/ forwardRef(function(props, ref) {
284
303
  autoplay: !!autoplay,
285
304
  autoplaySpeed: autoplaySpeed,
286
305
  waitForAnimate: waitForAnimate,
287
- children: children
306
+ children: slides
288
307
  })
289
308
  });
290
309
  });