@rockshin/tao-ui 0.0.58 → 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 (93) hide show
  1. package/dist/components/affix/affix.js +38 -4
  2. package/dist/components/app/app-modals.js +11 -6
  3. package/dist/components/app/app-notices.js +105 -47
  4. package/dist/components/auto-complete/auto-complete.js +9 -2
  5. package/dist/components/calendar/calendar.js +22 -18
  6. package/dist/components/carousel/carousel.js +27 -14
  7. package/dist/components/cascader/cascader.js +17 -12
  8. package/dist/components/checkbox/checkbox.d.ts +3 -1
  9. package/dist/components/checkbox/checkbox.js +65 -58
  10. package/dist/components/color-picker/color-picker.js +383 -360
  11. package/dist/components/date-picker/calendar/calendar-grid.d.ts +5 -3
  12. package/dist/components/date-picker/calendar/calendar-grid.js +9 -4
  13. package/dist/components/date-picker/calendar/month-grid.d.ts +2 -1
  14. package/dist/components/date-picker/calendar/month-grid.js +61 -45
  15. package/dist/components/date-picker/calendar/time-panel.d.ts +8 -1
  16. package/dist/components/date-picker/calendar/time-panel.js +89 -88
  17. package/dist/components/date-picker/calendar/year-grid.d.ts +2 -1
  18. package/dist/components/date-picker/calendar/year-grid.js +60 -44
  19. package/dist/components/date-picker/date-picker.css +9 -0
  20. package/dist/components/date-picker/date-picker.js +22 -13
  21. package/dist/components/date-picker/range-picker.d.ts +2 -0
  22. package/dist/components/date-picker/range-picker.js +127 -70
  23. package/dist/components/date-picker/types.js +1 -1
  24. package/dist/components/drawer/drawer.d.ts +1 -1
  25. package/dist/components/drawer/drawer.js +4 -3
  26. package/dist/components/dropdown/dropdown.js +11 -9
  27. package/dist/components/float-button/float-button.js +4 -4
  28. package/dist/components/form/form-item.d.ts +1 -1
  29. package/dist/components/form/form-item.js +160 -120
  30. package/dist/components/form-field/form-field-view.d.ts +2 -1
  31. package/dist/components/form-field/form-field-view.js +173 -108
  32. package/dist/components/input/input-shared.js +3 -2
  33. package/dist/components/input/otp.js +114 -110
  34. package/dist/components/input/password.js +55 -61
  35. package/dist/components/input/search.js +8 -4
  36. package/dist/components/mentions/mentions.js +1 -0
  37. package/dist/components/menu/menu-render.js +1 -0
  38. package/dist/components/modal/confirm-dialog.js +11 -4
  39. package/dist/components/modal/modal.js +320 -315
  40. package/dist/components/pagination/pagination.d.ts +1 -0
  41. package/dist/components/pagination/pagination.js +1 -0
  42. package/dist/components/popover/popover.js +325 -289
  43. package/dist/components/qr-code/qr-code.js +157 -150
  44. package/dist/components/radio/radio.d.ts +3 -1
  45. package/dist/components/radio/radio.js +73 -64
  46. package/dist/components/select/mobile-select.js +6 -3
  47. package/dist/components/select/select-model.js +2 -2
  48. package/dist/components/select/select.js +78 -39
  49. package/dist/components/select/use-select-selection.js +58 -58
  50. package/dist/components/slider/slider.d.ts +2 -2
  51. package/dist/components/slider/slider.js +13 -2
  52. package/dist/components/sonner/sonner.js +2 -2
  53. package/dist/components/splitter/splitter.css +1 -0
  54. package/dist/components/splitter/splitter.js +152 -126
  55. package/dist/components/switch/switch.js +45 -39
  56. package/dist/components/table/table.js +1 -0
  57. package/dist/components/table/use-table-data.js +2 -2
  58. package/dist/components/time-picker/time-picker.js +31 -1
  59. package/dist/components/tooltip/tooltip.js +237 -99
  60. package/dist/components/tree/tree.js +31 -3
  61. package/dist/components/tree-select/tree-select.js +1 -1
  62. package/dist/components/upload/upload.js +67 -40
  63. package/dist/locales/ar-EG.js +2 -0
  64. package/dist/locales/de-DE.js +2 -0
  65. package/dist/locales/en-US.js +2 -0
  66. package/dist/locales/es-ES.js +2 -0
  67. package/dist/locales/fr-FR.js +2 -0
  68. package/dist/locales/hi-IN.js +2 -0
  69. package/dist/locales/id-ID.js +2 -0
  70. package/dist/locales/it-IT.js +2 -0
  71. package/dist/locales/ja-JP.js +2 -0
  72. package/dist/locales/ko-KR.js +2 -0
  73. package/dist/locales/pt-BR.js +2 -0
  74. package/dist/locales/ru-RU.js +2 -0
  75. package/dist/locales/th-TH.js +2 -0
  76. package/dist/locales/tr-TR.js +2 -0
  77. package/dist/locales/types.d.ts +2 -0
  78. package/dist/locales/vi-VN.js +2 -0
  79. package/dist/locales/zh-CN.js +2 -0
  80. package/dist/locales/zh-TW.js +2 -0
  81. package/dist/number-input/format.js +1 -1
  82. package/dist/number-input/use-number-input.js +166 -321
  83. package/dist/number-input/validate.d.ts +1 -0
  84. package/dist/number-input/validate.js +1 -1
  85. package/dist/provider/tao-provider.d.ts +2 -2
  86. package/dist/provider/tao-provider.js +49 -49
  87. package/dist/utils/composed-parent.d.ts +1 -0
  88. package/dist/utils/composed-parent.js +7 -0
  89. package/dist/utils/portal.d.ts +5 -0
  90. package/dist/utils/portal.js +7 -1
  91. package/dist/utils/refs.d.ts +3 -1
  92. package/dist/utils/refs.js +25 -1
  93. 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,12 +257,12 @@ function useAppMessages(config = {}) {
254
257
  error: typed('error'),
255
258
  loading: typed('loading'),
256
259
  destroy: (key_2)=>{
257
- if (void 0 !== key_2) return void close(key_2);
260
+ if (void 0 !== key_2) return void close(explicitMessageKey(key_2));
258
261
  const failures = [];
259
- for (const current of [
260
- ...active.current.keys()
262
+ for (const [key_3, life_3] of [
263
+ ...active.current
261
264
  ])try {
262
- close(current);
265
+ close(key_3, life_3);
263
266
  } catch (error) {
264
267
  failures.push(error);
265
268
  }
@@ -268,6 +271,7 @@ function useAppMessages(config = {}) {
268
271
  }
269
272
  };
270
273
  }, [
274
+ latest,
271
275
  notices
272
276
  ]);
273
277
  return [
@@ -275,29 +279,36 @@ function useAppMessages(config = {}) {
275
279
  holder
276
280
  ];
277
281
  }
278
- 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;
279
291
  const { locale } = useTaoConfig();
280
- const closeLabel = useRef(locale.close);
281
- closeLabel.current = locale.close;
282
- const [notices, holder] = useNoticeHolder('notification', config);
283
- const latest = useRef(config);
284
- latest.current = config;
285
- const api = useMemo(()=>{
286
- 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)=>{
287
298
  const defaults = latest.current;
288
299
  const merged = {
289
300
  ...defaults,
290
301
  ...args
291
302
  };
292
- 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;
293
304
  const closable = false === args.closable || null === args.closable || false === closeIcon || null === closeIcon ? false : {
294
305
  closeIcon,
295
- 'aria-label': closeLabel.current,
296
- ...'object' == typeof args.closable ? args.closable : {}
306
+ "aria-label": closeLabel.current,
307
+ ..."object" == typeof args.closable ? args.closable : {}
297
308
  };
298
309
  const classNames = noticeClasses(resolveAppSemantic(defaults.classNames, merged), resolveAppSemantic(args.classNames, merged));
299
310
  const styles = noticeStyles(resolveAppSemantic(defaults.styles, merged), resolveAppSemantic(args.styles, merged));
300
- const disabledClose = 'object' == typeof closable && closable?.disabled;
311
+ const disabledClose = "object" == typeof closable && closable?.disabled;
301
312
  const title = args.title ?? args.message;
302
313
  notices.open({
303
314
  ...args,
@@ -307,7 +318,7 @@ function useAppNotifications(config = {}) {
307
318
  /*#__PURE__*/ jsx("button", {
308
319
  type: "button",
309
320
  disabled: true,
310
- "aria-label": closable['aria-label'] ?? closeLabel.current,
321
+ "aria-label": closable["aria-label"] ?? closeLabel.current,
311
322
  className: classNames.close,
312
323
  style: styles.close,
313
324
  children: closable.closeIcon
@@ -315,43 +326,90 @@ function useAppNotifications(config = {}) {
315
326
  ]
316
327
  }) : title,
317
328
  actions: args.actions ?? args.btn,
318
- placement: args.placement ?? defaults.placement ?? 'topRight',
329
+ placement: args.placement ?? defaults.placement ?? "topRight",
319
330
  duration: args.duration ?? defaults.duration ?? 4.5,
320
331
  pauseOnHover: args.pauseOnHover ?? defaults.pauseOnHover ?? true,
321
332
  showProgress: args.showProgress ?? defaults.showProgress,
322
- role: args.role ?? 'alert',
333
+ role: args.role ?? "alert",
323
334
  icon: iconFor(args.type, args.icon),
324
335
  classNames,
325
336
  styles,
326
337
  closable: disabledClose ? false : closable
327
338
  });
328
339
  };
329
- 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 = {
330
387
  open,
331
- success: (args_0)=>open({
332
- ...args_0,
333
- type: 'success'
334
- }),
335
- info: (args_1)=>open({
336
- ...args_1,
337
- type: 'info'
338
- }),
339
- error: (args_2)=>open({
340
- ...args_2,
341
- type: 'error'
342
- }),
343
- warning: (args_3)=>open({
344
- ...args_3,
345
- type: 'warning'
346
- }),
347
- 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
348
393
  };
349
- }, [
350
- notices
351
- ]);
352
- return [
353
- api,
354
- holder
355
- ];
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;
356
414
  }
357
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();
@@ -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,8 +114,8 @@ const Calendar = /*#__PURE__*/ forwardRef((props, ref)=>{
110
114
  props.headerRender ? props.headerRender({
111
115
  value,
112
116
  type: mode,
113
- onChange: (date_4)=>{
114
- const next_0 = clamp(date_4);
117
+ onChange: (date_5)=>{
118
+ const next_0 = clamp(date_5);
115
119
  if (!props.disabledDate?.(next_0)) select(next_0, 'customize');
116
120
  },
117
121
  onTypeChange: changeMode
@@ -180,9 +184,9 @@ const Calendar = /*#__PURE__*/ forwardRef((props, ref)=>{
180
184
  picker: 'year' === mode ? 'month' : 'date',
181
185
  hideHeader: true,
182
186
  showWeek: props.showWeek,
183
- disabledDate: disabled,
184
- onSelect: (date_5)=>'year' === mode ? select(clamp(date_5), 'month') : select(date_5, 'date'),
185
- 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),
186
190
  classNames: {
187
191
  body: names?.body,
188
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
  };
@@ -195,17 +199,21 @@ const carousel_Carousel = /*#__PURE__*/ forwardRef(function(props, ref) {
195
199
  const itemsPerSlide = (rest.rows ?? 1) * (rest.slidesPerRow ?? 1);
196
200
  const count = Math.ceil(childCount / itemsPerSlide);
197
201
  const ready = count > 0 && !unslick && null !== responsiveSettings;
202
+ const mirror = (index)=>isRtl ? count - 1 - index : index;
198
203
  const previousPosition = useRef(null);
199
204
  useImperativeHandle(ref, ()=>({
200
205
  nativeElement: rootRef.current,
201
- goTo: (slide, dontAnimate = false)=>sliderRef.current?.slickGoTo(slide, dontAnimate),
202
- next: ()=>sliderRef.current?.slickNext(),
203
- 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(),
204
209
  autoPlay: (playType)=>sliderRef.current?.innerSlider?.autoPlay(playType),
205
210
  get innerSlider () {
206
211
  return sliderRef.current?.innerSlider;
207
212
  }
208
- }), []);
213
+ }), [
214
+ count,
215
+ isRtl
216
+ ]);
209
217
  useEffect(()=>{
210
218
  const root = rootRef.current;
211
219
  if (!root) return;
@@ -234,7 +242,7 @@ const carousel_Carousel = /*#__PURE__*/ forwardRef(function(props, ref) {
234
242
  };
235
243
  if (!ready) return;
236
244
  if (void 0 !== slickGoTo) {
237
- 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);
238
246
  } else if (!previous?.ready || previous.isRtl !== isRtl || previous.initialSlide !== initialSlide) sliderRef.current?.slickGoTo(isRtl ? count - initialSlide - 1 : initialSlide, true);
239
247
  }, [
240
248
  count,
@@ -268,14 +276,19 @@ const carousel_Carousel = /*#__PURE__*/ forwardRef(function(props, ref) {
268
276
  fade: 'fade' === effect || !!rest.fade,
269
277
  dots: !!dots,
270
278
  dotsClass: cx('slick-dots', 'object' == typeof dots && dots.className, classNames?.dots),
271
- 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", {
272
285
  style: styles?.dots,
273
- children: items
274
- })),
275
- customPaging: customPaging ?? ((index)=>/*#__PURE__*/ jsx("button", {
276
- type: "button",
277
- children: index + 1
278
- })),
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))),
279
292
  arrows: arrows,
280
293
  prevArrow: prevArrow ?? /*#__PURE__*/ jsx(Arrow, {
281
294
  "aria-label": isRtl ? locale.next : locale.previous
@@ -63,7 +63,8 @@ function InternalCascader(props, ref) {
63
63
  const screens = useBreakpoint();
64
64
  const requestedMobile = mobile ?? screens.xs;
65
65
  const [internalOpen, setInternalOpen] = useState(defaultOpen);
66
- const open = openProp ?? internalOpen;
66
+ if (disabled && internalOpen) setInternalOpen(false);
67
+ const open = openProp ?? (!disabled && internalOpen);
67
68
  const [mobilePresentation, setMobilePresentation] = useState(requestedMobile);
68
69
  if ((!open || void 0 === mobilePresentation) && mobilePresentation !== requestedMobile) setMobilePresentation(requestedMobile);
69
70
  const isMobile = (open ? mobilePresentation : requestedMobile) ?? false;
@@ -108,8 +109,11 @@ function InternalCascader(props, ref) {
108
109
  (onOpenChange ?? onPopupVisibleChange ?? onDropdownVisibleChange)?.(next_0);
109
110
  };
110
111
  const commit = (...args)=>{
111
- setInternalValue(args[0]);
112
- onChange?.(...args);
112
+ const [next_1, selected] = args;
113
+ setInternalValue(next_1);
114
+ onChange?.(null == next_1 ? next_1 : next_1.map((value_0)=>Array.isArray(value_0) ? [
115
+ ...value_0
116
+ ] : value_0), selected);
113
117
  };
114
118
  const changeValue = (...args_0)=>{
115
119
  if (mobileOpen && multiple) {
@@ -117,13 +121,11 @@ function InternalCascader(props, ref) {
117
121
  if (searchConfig.autoClearSearchValue ?? props.autoClearSearchValue ?? true) setInternalSearch('');
118
122
  return;
119
123
  }
124
+ const last = mobileOpen ? args_0[1]?.at(-1) : void 0;
125
+ const children = last?.[props.fieldNames?.children ?? 'children'];
126
+ const selectionFinished = mobileOpen && (!last || (last.isLeaf ?? !children?.length));
120
127
  commit(...args_0);
121
- if (mobileOpen) {
122
- const selected = args_0[1];
123
- const last = selected?.at(-1);
124
- const children = last?.[props.fieldNames?.children ?? 'children'];
125
- if (!last || (last.isLeaf ?? !children?.length)) changeOpen(false);
126
- }
128
+ if (selectionFinished) changeOpen(false);
127
129
  };
128
130
  const navigateMobile = (event)=>{
129
131
  if (event.nativeEvent.isComposing || 229 === event.keyCode) return;
@@ -220,8 +222,8 @@ function InternalCascader(props, ref) {
220
222
  });
221
223
  },
222
224
  popupMenuColumnStyle: popupMenuColumnStyle ?? dropdownMenuColumnStyle,
223
- onPopupVisibleChange: (next_1)=>{
224
- if (!isMobile || next_1) changeOpen(next_1);
225
+ onPopupVisibleChange: (next_2)=>{
226
+ if (!isMobile || next_2) changeOpen(next_2);
225
227
  }
226
228
  }),
227
229
  isMobile && /*#__PURE__*/ jsxs(Drawer, {
@@ -293,7 +295,7 @@ function CascaderPanel(props) {
293
295
  const config = useTaoInternalConfig();
294
296
  const { multiple, className, rootClassName, style, prefixCls = 'tao-cascader', disabled = config.disabled, notFoundContent = config.locale.noResults, expandIcon = /*#__PURE__*/ jsx(ExpandIcon, {}), loadingIcon = /*#__PURE__*/ jsx(Spinner, {
295
297
  size: "small"
296
- }), value, ...rest } = props;
298
+ }), value, onChange, ...rest } = props;
297
299
  const [direction, directionRef] = useTaoDirection(props.direction);
298
300
  return /*#__PURE__*/ jsx("div", {
299
301
  ref: directionRef,
@@ -306,6 +308,9 @@ function CascaderPanel(props) {
306
308
  ...rest,
307
309
  direction: direction,
308
310
  value: 'value' in props ? value ?? [] : void 0,
311
+ onChange: onChange && ((next, selected)=>onChange(null == next ? next : next.map((path)=>Array.isArray(path) ? [
312
+ ...path
313
+ ] : path), selected)),
309
314
  prefixCls: prefixCls,
310
315
  checkable: multiple,
311
316
  disabled: disabled,
@@ -1,4 +1,4 @@
1
- import { type AriaAttributes, type ChangeEvent, type ReactNode, type Ref } from 'react';
1
+ import { type AriaAttributes, type ChangeEvent, type FocusEventHandler, type ReactNode, type Ref } from 'react';
2
2
  import { type TaoSize } from '../../provider/tao-provider.js';
3
3
  import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic.js';
4
4
  import './checkbox.css';
@@ -30,6 +30,8 @@ export interface CheckboxGroupProps extends Pick<AriaAttributes, 'aria-label' |
30
30
  value?: string[];
31
31
  defaultValue?: string[];
32
32
  onChange?: (values: string[]) => void;
33
+ /** Fires when focus leaves any checkbox in the group (Form validateTrigger). */
34
+ onBlur?: FocusEventHandler<HTMLFieldSetElement>;
33
35
  disabled?: boolean;
34
36
  size?: TaoSize;
35
37
  direction?: 'horizontal' | 'vertical';