@rockshin/tao-ui 0.0.48 → 0.0.51

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 (147) hide show
  1. package/dist/components/affix/affix.js +20 -16
  2. package/dist/components/alert/alert.js +114 -99
  3. package/dist/components/app/app-modals.js +134 -96
  4. package/dist/components/app/app-notices.js +39 -23
  5. package/dist/components/auto-complete/auto-complete.js +21 -7
  6. package/dist/components/avatar/avatar.js +31 -11
  7. package/dist/components/badge/badge.css +1 -1
  8. package/dist/components/badge/badge.js +72 -257
  9. package/dist/components/border-beam/border-beam.js +21 -17
  10. package/dist/components/breadcrumb/breadcrumb.js +178 -159
  11. package/dist/components/button/button.css +9 -1
  12. package/dist/components/button/button.js +61 -53
  13. package/dist/components/calendar/calendar.js +6 -4
  14. package/dist/components/card/card.js +24 -8
  15. package/dist/components/carousel/carousel.d.ts +1 -1
  16. package/dist/components/carousel/carousel.js +105 -68
  17. package/dist/components/cascader/cascader.js +54 -19
  18. package/dist/components/checkbox/checkbox.css +13 -2
  19. package/dist/components/checkbox/checkbox.d.ts +2 -0
  20. package/dist/components/checkbox/checkbox.js +320 -229
  21. package/dist/components/collapse/collapse-panels.d.ts +1 -1
  22. package/dist/components/collapse/collapse-panels.js +122 -113
  23. package/dist/components/collapse/collapse.js +98 -63
  24. package/dist/components/color-picker/color-picker.js +539 -441
  25. package/dist/components/color-picker/color.js +1 -1
  26. package/dist/components/context-menu/context-menu.d.ts +1 -1
  27. package/dist/components/context-menu/context-menu.js +108 -68
  28. package/dist/components/date-picker/calendar/calendar-grid.js +42 -39
  29. package/dist/components/date-picker/calendar/month-grid.d.ts +8 -1
  30. package/dist/components/date-picker/calendar/month-grid.js +79 -37
  31. package/dist/components/date-picker/calendar/time-panel.d.ts +2 -1
  32. package/dist/components/date-picker/calendar/time-panel.js +94 -89
  33. package/dist/components/date-picker/calendar/year-grid.d.ts +8 -1
  34. package/dist/components/date-picker/calendar/year-grid.js +66 -35
  35. package/dist/components/date-picker/date-picker.css +24 -1
  36. package/dist/components/date-picker/date-picker.js +99 -53
  37. package/dist/components/date-picker/presets.d.ts +2 -1
  38. package/dist/components/date-picker/presets.js +27 -24
  39. package/dist/components/date-picker/range-picker.js +308 -153
  40. package/dist/components/descriptions/descriptions.js +7 -3
  41. package/dist/components/divider/divider.css +1 -1
  42. package/dist/components/divider/divider.js +1 -1
  43. package/dist/components/drawer/drawer.js +201 -369
  44. package/dist/components/dropdown/dropdown.d.ts +1 -1
  45. package/dist/components/dropdown/dropdown.js +183 -279
  46. package/dist/components/empty/empty.js +57 -78
  47. package/dist/components/float-button/float-button.d.ts +1 -0
  48. package/dist/components/float-button/float-button.js +47 -30
  49. package/dist/components/form/field-control.d.ts +4 -2
  50. package/dist/components/form/field-control.js +17 -9
  51. package/dist/components/form/form-context.d.ts +8 -2
  52. package/dist/components/form/form-context.js +2 -1
  53. package/dist/components/form/form-item.js +85 -63
  54. package/dist/components/form/use-form.d.ts +2 -1
  55. package/dist/components/form/use-form.js +2 -1
  56. package/dist/components/form-field/form-field-view.d.ts +3 -1
  57. package/dist/components/form-field/form-field-view.js +194 -141
  58. package/dist/components/form-section/form-section.d.ts +1 -1
  59. package/dist/components/form-section/form-section.js +52 -45
  60. package/dist/components/image/image.js +585 -477
  61. package/dist/components/input/base-input.js +8 -9
  62. package/dist/components/input/input-shared.d.ts +5 -2
  63. package/dist/components/input/input-shared.js +42 -18
  64. package/dist/components/input/input.css +1 -0
  65. package/dist/components/input/otp.js +236 -217
  66. package/dist/components/input/password.js +2 -1
  67. package/dist/components/input/search.js +8 -7
  68. package/dist/components/list/list-pagination.js +41 -36
  69. package/dist/components/list/list.js +141 -125
  70. package/dist/components/listy/listy.js +175 -106
  71. package/dist/components/masonry/masonry.js +108 -85
  72. package/dist/components/mentions/mentions.js +12 -3
  73. package/dist/components/menu/menu-render.d.ts +9 -3
  74. package/dist/components/menu/menu-render.js +99 -36
  75. package/dist/components/modal/confirm-dialog.js +10 -4
  76. package/dist/components/modal/confirm.js +3 -7
  77. package/dist/components/modal/index.js +9 -3
  78. package/dist/components/modal/modal.js +390 -365
  79. package/dist/components/pagination/pagination.js +105 -96
  80. package/dist/components/popconfirm/popconfirm.d.ts +1 -1
  81. package/dist/components/popconfirm/popconfirm.js +219 -168
  82. package/dist/components/popover/popover.js +330 -243
  83. package/dist/components/progress/progress.css +2 -2
  84. package/dist/components/progress/progress.js +232 -458
  85. package/dist/components/qr-code/qr-code.js +72 -66
  86. package/dist/components/radio/radio.css +15 -4
  87. package/dist/components/radio/radio.d.ts +2 -1
  88. package/dist/components/radio/radio.js +260 -198
  89. package/dist/components/rate/rate.js +173 -113
  90. package/dist/components/scroll-area/scroll-area.js +241 -211
  91. package/dist/components/segmented/segmented.js +73 -41
  92. package/dist/components/select/mobile-select.d.ts +2 -1
  93. package/dist/components/select/mobile-select.js +24 -13
  94. package/dist/components/select/select-searchable-list.d.ts +2 -1
  95. package/dist/components/select/select-searchable-list.js +2 -3
  96. package/dist/components/select/select.css +3 -2
  97. package/dist/components/select/select.js +49 -25
  98. package/dist/components/select/use-select-selection.d.ts +1 -1
  99. package/dist/components/select/use-select-selection.js +7 -4
  100. package/dist/components/skeleton/skeleton.js +56 -48
  101. package/dist/components/slider/slider.js +87 -212
  102. package/dist/components/sonner/sonner.js +109 -93
  103. package/dist/components/spinner/spinner.js +147 -138
  104. package/dist/components/splitter/splitter.js +222 -159
  105. package/dist/components/statistic/statistic.js +7 -6
  106. package/dist/components/steps/steps.js +88 -81
  107. package/dist/components/steps/use-display-steps.js +1 -1
  108. package/dist/components/switch/switch.js +89 -89
  109. package/dist/components/table/table-filter.js +66 -56
  110. package/dist/components/table/table-icons.d.ts +2 -1
  111. package/dist/components/table/table-icons.js +11 -9
  112. package/dist/components/table/table-model.js +1 -1
  113. package/dist/components/table/table.js +107 -83
  114. package/dist/components/table/use-table-data.d.ts +6 -3
  115. package/dist/components/table/use-table-data.js +166 -130
  116. package/dist/components/tabs/tabs.css +1 -1
  117. package/dist/components/tabs/tabs.js +236 -179
  118. package/dist/components/tag/tag.d.ts +2 -2
  119. package/dist/components/tag/tag.js +111 -108
  120. package/dist/components/textarea/textarea.js +22 -17
  121. package/dist/components/time-picker/time-picker.js +5 -3
  122. package/dist/components/timeline/timeline.css +6 -1
  123. package/dist/components/timeline/timeline.js +21 -11
  124. package/dist/components/tooltip/tooltip.d.ts +2 -2
  125. package/dist/components/tooltip/tooltip.js +123 -233
  126. package/dist/components/tour/tour.css +4 -0
  127. package/dist/components/tour/tour.js +400 -331
  128. package/dist/components/transfer/transfer-list.js +31 -12
  129. package/dist/components/transfer/transfer-parts.js +1 -1
  130. package/dist/components/transfer/transfer-types.d.ts +1 -0
  131. package/dist/components/transfer/transfer.css +5 -0
  132. package/dist/components/transfer/transfer.js +29 -14
  133. package/dist/components/tree/tree-keyboard.d.ts +1 -1
  134. package/dist/components/tree/tree-keyboard.js +5 -3
  135. package/dist/components/tree/tree.js +74 -59
  136. package/dist/components/tree-select/select-engine.d.ts +3 -2
  137. package/dist/components/tree-select/select-engine.js +18 -16
  138. package/dist/components/tree-select/tree-select.js +21 -5
  139. package/dist/components/upload/upload.css +8 -0
  140. package/dist/components/upload/upload.js +160 -72
  141. package/dist/components/watermark/watermark.js +36 -29
  142. package/dist/number-input/use-number-input.js +129 -90
  143. package/dist/number-input/validate.js +32 -5
  144. package/dist/provider/merge-locale.js +12 -9
  145. package/dist/provider/tao-provider.d.ts +3 -1
  146. package/dist/provider/tao-provider.js +123 -86
  147. package/package.json +4 -3
@@ -3,7 +3,7 @@ import { c } from "react-compiler-runtime";
3
3
  import { FocusScope } from "@radix-ui/react-focus-scope";
4
4
  import tour from "@rc-component/tour";
5
5
  import { getPlacements } from "@rc-component/tour/es/placements";
6
- import { useEffect, useId, useRef } from "react";
6
+ import { useEffect, useId, useLayoutEffect, useRef, useState } from "react";
7
7
  import { TaoPortalScope, useTaoInternalConfig } from "../../provider/tao-provider.js";
8
8
  import { cx } from "../../utils/semantic.js";
9
9
  import { Button } from "../button/button.js";
@@ -12,61 +12,78 @@ import "./tour.css";
12
12
  import { interopDefault } from "../../utils/interop-default.js";
13
13
  const RcTourComponent = /*#__PURE__*/ interopDefault(tour);
14
14
  function TourPanel(t0) {
15
- const $ = c(101);
16
- const { step, current, type, indicatorsRender, actionsRender, classes, styles, modal } = t0;
15
+ const $ = c(108);
16
+ const { step, current, type, indicatorsRender, actionsRender, classes, styles, masked, disabledInteraction, stepActions } = t0;
17
17
  const { locale, mode, compact, tokenStyle } = useTaoInternalConfig();
18
18
  const titleId = useId();
19
19
  const descriptionId = useId();
20
20
  const panelRef = useRef(null);
21
- const { total: t1, title, description, cover, nextButtonProps, prevButtonProps, closable: t2 } = step;
22
- const total = void 0 === t1 ? 1 : t1;
23
- const closable = void 0 === t2 ? true : t2;
24
- let t3;
25
- if ($[0] !== classes || $[1] !== step.classNames) {
26
- t3 = {
27
- ...classes,
28
- ...step.classNames
21
+ const [hasTarget, setHasTarget] = useState(false);
22
+ let t1;
23
+ if ($[0] !== disabledInteraction || $[1] !== hasTarget || $[2] !== masked || $[3] !== step) {
24
+ t1 = ()=>{
25
+ if (!masked || disabledInteraction) return;
26
+ const target = "function" == typeof step.target ? step.target() : step.target;
27
+ const available = Boolean(target);
28
+ if (available !== hasTarget) setHasTarget(available);
29
29
  };
30
- $[0] = classes;
31
- $[1] = step.classNames;
32
- $[2] = t3;
33
- } else t3 = $[2];
34
- const cn = t3;
30
+ $[0] = disabledInteraction;
31
+ $[1] = hasTarget;
32
+ $[2] = masked;
33
+ $[3] = step;
34
+ $[4] = t1;
35
+ } else t1 = $[4];
36
+ useLayoutEffect(t1);
37
+ const modal = masked && (disabledInteraction || !hasTarget);
38
+ const { total: t2, title, description, cover, nextButtonProps, prevButtonProps, closable: t3 } = step;
39
+ const total = void 0 === t2 ? 1 : t2;
40
+ const closable = void 0 === t3 ? true : t3;
35
41
  let t4;
36
- if ($[3] !== step.styles || $[4] !== styles) {
42
+ if ($[5] !== classes || $[6] !== step.classNames) {
37
43
  t4 = {
44
+ ...classes,
45
+ ...step.classNames
46
+ };
47
+ $[5] = classes;
48
+ $[6] = step.classNames;
49
+ $[7] = t4;
50
+ } else t4 = $[7];
51
+ const cn = t4;
52
+ let t5;
53
+ if ($[8] !== step.styles || $[9] !== styles) {
54
+ t5 = {
38
55
  ...styles,
39
56
  ...step.styles
40
57
  };
41
- $[3] = step.styles;
42
- $[4] = styles;
43
- $[5] = t4;
44
- } else t4 = $[5];
45
- const st = t4;
58
+ $[8] = step.styles;
59
+ $[9] = styles;
60
+ $[10] = t5;
61
+ } else t5 = $[10];
62
+ const st = t5;
46
63
  const primary = (step.type ?? type) === "primary";
47
64
  const last = current === total - 1;
48
- let t5;
49
- if ($[6] !== closable) {
50
- t5 = closable && "object" == typeof closable ? closable : {};
51
- $[6] = closable;
52
- $[7] = t5;
53
- } else t5 = $[7];
54
- const closeProps = t5;
65
+ let t6;
66
+ if ($[11] !== closable) {
67
+ t6 = closable && "object" == typeof closable ? closable : {};
68
+ $[11] = closable;
69
+ $[12] = t6;
70
+ } else t6 = $[12];
71
+ const closeProps = t6;
55
72
  let closeAttrs;
56
73
  let closeIcon;
57
- if ($[8] !== closeProps) {
74
+ if ($[13] !== closeProps) {
58
75
  ({ closeIcon, ...closeAttrs } = closeProps);
59
- $[8] = closeProps;
60
- $[9] = closeAttrs;
61
- $[10] = closeIcon;
76
+ $[13] = closeProps;
77
+ $[14] = closeAttrs;
78
+ $[15] = closeIcon;
62
79
  } else {
63
- closeAttrs = $[9];
64
- closeIcon = $[10];
80
+ closeAttrs = $[14];
81
+ closeIcon = $[15];
65
82
  }
66
- let t6;
67
83
  let t7;
68
- if ($[11] !== compact || $[12] !== mode || $[13] !== tokenStyle) {
69
- t6 = ()=>{
84
+ let t8;
85
+ if ($[16] !== compact || $[17] !== mode || $[18] !== tokenStyle) {
86
+ t7 = ()=>{
70
87
  const popup = panelRef.current.parentElement;
71
88
  popup.dataset.taoTourPopup = "";
72
89
  popup.dataset.taoProvider = "";
@@ -76,132 +93,145 @@ function TourPanel(t0) {
76
93
  else delete popup.dataset.taoDensity;
77
94
  for (const [name, value] of Object.entries(tokenStyle ?? {}))popup.style.setProperty(name, String(value));
78
95
  };
79
- t7 = [
96
+ t8 = [
80
97
  mode,
81
98
  compact,
82
99
  tokenStyle
83
100
  ];
84
- $[11] = compact;
85
- $[12] = mode;
86
- $[13] = tokenStyle;
87
- $[14] = t6;
88
- $[15] = t7;
101
+ $[16] = compact;
102
+ $[17] = mode;
103
+ $[18] = tokenStyle;
104
+ $[19] = t7;
105
+ $[20] = t8;
89
106
  } else {
90
- t6 = $[14];
91
- t7 = $[15];
107
+ t7 = $[19];
108
+ t8 = $[20];
92
109
  }
93
- useEffect(t6, t7);
94
- let t8;
95
- if ($[16] !== current || $[17] !== locale || $[18] !== prevButtonProps || $[19] !== primary || $[20] !== step) {
96
- t8 = current > 0 && /*#__PURE__*/ jsx(Button, {
110
+ useEffect(t7, t8);
111
+ let t9;
112
+ if ($[21] !== current || $[22] !== locale || $[23] !== prevButtonProps || $[24] !== primary || $[25] !== step || $[26] !== stepActions) {
113
+ t9 = current > 0 && /*#__PURE__*/ jsx(Button, {
97
114
  size: "small",
98
115
  variant: primary ? "ghost" : "secondary",
99
116
  ...prevButtonProps,
100
117
  onClick: (event)=>{
101
- step.onPrev?.();
102
118
  prevButtonProps?.onClick?.(event);
119
+ if (event.defaultPrevented) return;
120
+ stepActions?.onPrev?.();
121
+ step.onPrev?.();
103
122
  },
104
123
  children: prevButtonProps?.children ?? locale.previous
105
124
  });
106
- $[16] = current;
107
- $[17] = locale;
108
- $[18] = prevButtonProps;
109
- $[19] = primary;
110
- $[20] = step;
111
- $[21] = t8;
112
- } else t8 = $[21];
113
- const t9 = primary ? "secondary" : "primary";
114
- let t10;
115
- if ($[22] !== last || $[23] !== nextButtonProps || $[24] !== step) {
116
- t10 = (event_0)=>{
117
- if (last) step.onFinish?.();
118
- else step.onNext?.();
125
+ $[21] = current;
126
+ $[22] = locale;
127
+ $[23] = prevButtonProps;
128
+ $[24] = primary;
129
+ $[25] = step;
130
+ $[26] = stepActions;
131
+ $[27] = t9;
132
+ } else t9 = $[27];
133
+ const t10 = primary ? "secondary" : "primary";
134
+ let t11;
135
+ if ($[28] !== last || $[29] !== nextButtonProps || $[30] !== step || $[31] !== stepActions) {
136
+ t11 = (event_0)=>{
119
137
  nextButtonProps?.onClick?.(event_0);
138
+ if (event_0.defaultPrevented) return;
139
+ if (last) {
140
+ stepActions?.onFinish?.();
141
+ step.onFinish?.();
142
+ } else {
143
+ stepActions?.onNext?.();
144
+ step.onNext?.();
145
+ }
120
146
  };
121
- $[22] = last;
122
- $[23] = nextButtonProps;
123
- $[24] = step;
124
- $[25] = t10;
125
- } else t10 = $[25];
126
- const t11 = nextButtonProps?.children ?? (last ? locale.done : locale.next);
127
- let t12;
128
- if ($[26] !== nextButtonProps || $[27] !== t10 || $[28] !== t11 || $[29] !== t9) {
129
- t12 = /*#__PURE__*/ jsx(Button, {
147
+ $[28] = last;
148
+ $[29] = nextButtonProps;
149
+ $[30] = step;
150
+ $[31] = stepActions;
151
+ $[32] = t11;
152
+ } else t11 = $[32];
153
+ const t12 = nextButtonProps?.children ?? (last ? locale.done : locale.next);
154
+ let t13;
155
+ if ($[33] !== nextButtonProps || $[34] !== t10 || $[35] !== t11 || $[36] !== t12) {
156
+ t13 = /*#__PURE__*/ jsx(Button, {
130
157
  size: "small",
131
- variant: t9,
158
+ variant: t10,
132
159
  ...nextButtonProps,
133
- onClick: t10,
134
- children: t11
160
+ onClick: t11,
161
+ children: t12
135
162
  });
136
- $[26] = nextButtonProps;
137
- $[27] = t10;
138
- $[28] = t11;
139
- $[29] = t9;
140
- $[30] = t12;
141
- } else t12 = $[30];
142
- let t13;
143
- if ($[31] !== t12 || $[32] !== t8) {
144
- t13 = /*#__PURE__*/ jsxs(Fragment, {
163
+ $[33] = nextButtonProps;
164
+ $[34] = t10;
165
+ $[35] = t11;
166
+ $[36] = t12;
167
+ $[37] = t13;
168
+ } else t13 = $[37];
169
+ let t14;
170
+ if ($[38] !== t13 || $[39] !== t9) {
171
+ t14 = /*#__PURE__*/ jsxs(Fragment, {
145
172
  children: [
146
- t8,
147
- t12
173
+ t9,
174
+ t13
148
175
  ]
149
176
  });
150
- $[31] = t12;
151
- $[32] = t8;
152
- $[33] = t13;
153
- } else t13 = $[33];
154
- const actions = t13;
155
- let t14;
156
- if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
157
- t14 = (event_1)=>{
177
+ $[38] = t13;
178
+ $[39] = t9;
179
+ $[40] = t14;
180
+ } else t14 = $[40];
181
+ const actions = t14;
182
+ let t15;
183
+ if ($[41] === Symbol.for("react.memo_cache_sentinel")) {
184
+ t15 = (event_1)=>{
158
185
  event_1.preventDefault();
159
186
  panelRef.current?.focus();
160
187
  };
161
- $[34] = t14;
162
- } else t14 = $[34];
163
- const t15 = primary ? "primary" : "default";
164
- const t16 = modal || void 0;
165
- const t17 = null != title ? titleId : void 0;
166
- const t18 = null != description ? descriptionId : void 0;
167
- let t19;
168
- if ($[35] !== closable || $[36] !== closeAttrs || $[37] !== closeIcon || $[38] !== cn.close || $[39] !== locale || $[40] !== st.close || $[41] !== step.closeIcon || $[42] !== step.onClose) {
169
- t19 = closable && /*#__PURE__*/ jsx("button", {
188
+ $[41] = t15;
189
+ } else t15 = $[41];
190
+ const t16 = primary ? "primary" : "default";
191
+ const t17 = modal || void 0;
192
+ const t18 = null != title ? titleId : void 0;
193
+ const t19 = null != description ? descriptionId : void 0;
194
+ let t20;
195
+ if ($[42] !== closable || $[43] !== closeAttrs || $[44] !== closeIcon || $[45] !== cn.close || $[46] !== locale || $[47] !== st.close || $[48] !== step || $[49] !== stepActions) {
196
+ t20 = closable && /*#__PURE__*/ jsx("button", {
170
197
  type: "button",
171
198
  "data-tao-tour-close": "",
172
199
  "aria-label": locale.close,
173
200
  ...closeAttrs,
174
201
  className: cn.close,
175
202
  style: st.close,
176
- onClick: step.onClose,
203
+ onClick: ()=>{
204
+ stepActions?.onClose?.();
205
+ step.onClose?.();
206
+ },
177
207
  children: closeIcon ?? step.closeIcon ?? /*#__PURE__*/ jsx(CloseIcon, {})
178
208
  });
179
- $[35] = closable;
180
- $[36] = closeAttrs;
181
- $[37] = closeIcon;
182
- $[38] = cn.close;
183
- $[39] = locale;
184
- $[40] = st.close;
185
- $[41] = step.closeIcon;
186
- $[42] = step.onClose;
187
- $[43] = t19;
188
- } else t19 = $[43];
189
- let t20;
190
- if ($[44] !== cn.cover || $[45] !== cover || $[46] !== st.cover) {
191
- t20 = null != cover && /*#__PURE__*/ jsx("div", {
209
+ $[42] = closable;
210
+ $[43] = closeAttrs;
211
+ $[44] = closeIcon;
212
+ $[45] = cn.close;
213
+ $[46] = locale;
214
+ $[47] = st.close;
215
+ $[48] = step;
216
+ $[49] = stepActions;
217
+ $[50] = t20;
218
+ } else t20 = $[50];
219
+ let t21;
220
+ if ($[51] !== cn.cover || $[52] !== cover || $[53] !== st.cover) {
221
+ t21 = null != cover && /*#__PURE__*/ jsx("div", {
192
222
  "data-tao-tour-cover": "",
193
223
  className: cn.cover,
194
224
  style: st.cover,
195
225
  children: cover
196
226
  });
197
- $[44] = cn.cover;
198
- $[45] = cover;
199
- $[46] = st.cover;
200
- $[47] = t20;
201
- } else t20 = $[47];
202
- let t21;
203
- if ($[48] !== cn.header || $[49] !== cn.title || $[50] !== st.header || $[51] !== st.title || $[52] !== title || $[53] !== titleId) {
204
- t21 = null != title && /*#__PURE__*/ jsx("div", {
227
+ $[51] = cn.cover;
228
+ $[52] = cover;
229
+ $[53] = st.cover;
230
+ $[54] = t21;
231
+ } else t21 = $[54];
232
+ let t22;
233
+ if ($[55] !== cn.header || $[56] !== cn.title || $[57] !== st.header || $[58] !== st.title || $[59] !== title || $[60] !== titleId) {
234
+ t22 = null != title && /*#__PURE__*/ jsx("div", {
205
235
  "data-tao-tour-header": "",
206
236
  className: cn.header,
207
237
  style: st.header,
@@ -213,32 +243,32 @@ function TourPanel(t0) {
213
243
  children: title
214
244
  })
215
245
  });
216
- $[48] = cn.header;
217
- $[49] = cn.title;
218
- $[50] = st.header;
219
- $[51] = st.title;
220
- $[52] = title;
221
- $[53] = titleId;
222
- $[54] = t21;
223
- } else t21 = $[54];
224
- let t22;
225
- if ($[55] !== cn.description || $[56] !== description || $[57] !== descriptionId || $[58] !== st.description) {
226
- t22 = null != description && /*#__PURE__*/ jsx("div", {
246
+ $[55] = cn.header;
247
+ $[56] = cn.title;
248
+ $[57] = st.header;
249
+ $[58] = st.title;
250
+ $[59] = title;
251
+ $[60] = titleId;
252
+ $[61] = t22;
253
+ } else t22 = $[61];
254
+ let t23;
255
+ if ($[62] !== cn.description || $[63] !== description || $[64] !== descriptionId || $[65] !== st.description) {
256
+ t23 = null != description && /*#__PURE__*/ jsx("div", {
227
257
  id: descriptionId,
228
258
  "data-tao-tour-description": "",
229
259
  className: cn.description,
230
260
  style: st.description,
231
261
  children: description
232
262
  });
233
- $[55] = cn.description;
234
- $[56] = description;
235
- $[57] = descriptionId;
236
- $[58] = st.description;
237
- $[59] = t22;
238
- } else t22 = $[59];
239
- let t23;
240
- if ($[60] !== cn.indicator || $[61] !== cn.indicators || $[62] !== current || $[63] !== indicatorsRender || $[64] !== st.indicator || $[65] !== st.indicators || $[66] !== total) {
241
- t23 = total > 1 && /*#__PURE__*/ jsx("div", {
263
+ $[62] = cn.description;
264
+ $[63] = description;
265
+ $[64] = descriptionId;
266
+ $[65] = st.description;
267
+ $[66] = t23;
268
+ } else t23 = $[66];
269
+ let t24;
270
+ if ($[67] !== cn.indicator || $[68] !== cn.indicators || $[69] !== current || $[70] !== indicatorsRender || $[71] !== st.indicator || $[72] !== st.indicators || $[73] !== total) {
271
+ t24 = total > 1 && /*#__PURE__*/ jsx("div", {
242
272
  "data-tao-tour-indicators": "",
243
273
  className: cn.indicators,
244
274
  style: st.indicators,
@@ -251,132 +281,135 @@ function TourPanel(t0) {
251
281
  style: st.indicator
252
282
  }, stepIndex))
253
283
  });
254
- $[60] = cn.indicator;
255
- $[61] = cn.indicators;
256
- $[62] = current;
257
- $[63] = indicatorsRender;
258
- $[64] = st.indicator;
259
- $[65] = st.indicators;
260
- $[66] = total;
261
- $[67] = t23;
262
- } else t23 = $[67];
263
- let t24;
264
- if ($[68] !== actions || $[69] !== actionsRender || $[70] !== current || $[71] !== total) {
265
- t24 = actionsRender ? actionsRender(actions, {
284
+ $[67] = cn.indicator;
285
+ $[68] = cn.indicators;
286
+ $[69] = current;
287
+ $[70] = indicatorsRender;
288
+ $[71] = st.indicator;
289
+ $[72] = st.indicators;
290
+ $[73] = total;
291
+ $[74] = t24;
292
+ } else t24 = $[74];
293
+ let t25;
294
+ if ($[75] !== actions || $[76] !== actionsRender || $[77] !== current || $[78] !== total) {
295
+ t25 = actionsRender ? actionsRender(actions, {
266
296
  current,
267
297
  total
268
298
  }) : actions;
269
- $[68] = actions;
270
- $[69] = actionsRender;
271
- $[70] = current;
272
- $[71] = total;
273
- $[72] = t24;
274
- } else t24 = $[72];
275
- let t25;
276
- if ($[73] !== cn.actions || $[74] !== st.actions || $[75] !== t24) {
277
- t25 = /*#__PURE__*/ jsx("div", {
299
+ $[75] = actions;
300
+ $[76] = actionsRender;
301
+ $[77] = current;
302
+ $[78] = total;
303
+ $[79] = t25;
304
+ } else t25 = $[79];
305
+ let t26;
306
+ if ($[80] !== cn.actions || $[81] !== st.actions || $[82] !== t25) {
307
+ t26 = /*#__PURE__*/ jsx("div", {
278
308
  "data-tao-tour-actions": "",
279
309
  className: cn.actions,
280
310
  style: st.actions,
281
- children: t24
311
+ children: t25
282
312
  });
283
- $[73] = cn.actions;
284
- $[74] = st.actions;
285
- $[75] = t24;
286
- $[76] = t25;
287
- } else t25 = $[76];
288
- let t26;
289
- if ($[77] !== cn.footer || $[78] !== st.footer || $[79] !== t23 || $[80] !== t25) {
290
- t26 = /*#__PURE__*/ jsxs("div", {
313
+ $[80] = cn.actions;
314
+ $[81] = st.actions;
315
+ $[82] = t25;
316
+ $[83] = t26;
317
+ } else t26 = $[83];
318
+ let t27;
319
+ if ($[84] !== cn.footer || $[85] !== st.footer || $[86] !== t24 || $[87] !== t26) {
320
+ t27 = /*#__PURE__*/ jsxs("div", {
291
321
  "data-tao-tour-footer": "",
292
322
  className: cn.footer,
293
323
  style: st.footer,
294
324
  children: [
295
- t23,
296
- t25
325
+ t24,
326
+ t26
297
327
  ]
298
328
  });
299
- $[77] = cn.footer;
300
- $[78] = st.footer;
301
- $[79] = t23;
302
- $[80] = t25;
303
- $[81] = t26;
304
- } else t26 = $[81];
305
- let t27;
306
- if ($[82] !== cn.section || $[83] !== st.section || $[84] !== t19 || $[85] !== t20 || $[86] !== t21 || $[87] !== t22 || $[88] !== t26) {
307
- t27 = /*#__PURE__*/ jsxs("div", {
329
+ $[84] = cn.footer;
330
+ $[85] = st.footer;
331
+ $[86] = t24;
332
+ $[87] = t26;
333
+ $[88] = t27;
334
+ } else t27 = $[88];
335
+ let t28;
336
+ if ($[89] !== cn.section || $[90] !== st.section || $[91] !== t20 || $[92] !== t21 || $[93] !== t22 || $[94] !== t23 || $[95] !== t27) {
337
+ t28 = /*#__PURE__*/ jsxs("div", {
308
338
  "data-tao-tour-section": "",
309
339
  className: cn.section,
310
340
  style: st.section,
311
341
  children: [
312
- t19,
313
342
  t20,
314
343
  t21,
315
344
  t22,
316
- t26
345
+ t23,
346
+ t27
317
347
  ]
318
348
  });
319
- $[82] = cn.section;
320
- $[83] = st.section;
321
- $[84] = t19;
322
- $[85] = t20;
323
- $[86] = t21;
324
- $[87] = t22;
325
- $[88] = t26;
326
- $[89] = t27;
327
- } else t27 = $[89];
328
- let t28;
329
- if ($[90] !== cn.root || $[91] !== st.root || $[92] !== t15 || $[93] !== t16 || $[94] !== t17 || $[95] !== t18 || $[96] !== t27) {
330
- t28 = /*#__PURE__*/ jsx("div", {
349
+ $[89] = cn.section;
350
+ $[90] = st.section;
351
+ $[91] = t20;
352
+ $[92] = t21;
353
+ $[93] = t22;
354
+ $[94] = t23;
355
+ $[95] = t27;
356
+ $[96] = t28;
357
+ } else t28 = $[96];
358
+ let t29;
359
+ if ($[97] !== cn.root || $[98] !== st.root || $[99] !== t16 || $[100] !== t17 || $[101] !== t18 || $[102] !== t19 || $[103] !== t28) {
360
+ t29 = /*#__PURE__*/ jsx("div", {
331
361
  ref: panelRef,
332
362
  "data-tao-tour": "",
333
- "data-type": t15,
363
+ "data-type": t16,
334
364
  role: "dialog",
335
- "aria-modal": t16,
336
- "aria-labelledby": t17,
337
- "aria-describedby": t18,
365
+ "aria-modal": t17,
366
+ "aria-labelledby": t18,
367
+ "aria-describedby": t19,
338
368
  tabIndex: -1,
339
369
  className: cn.root,
340
370
  style: st.root,
341
- children: t27
371
+ children: t28
342
372
  });
343
- $[90] = cn.root;
344
- $[91] = st.root;
345
- $[92] = t15;
346
- $[93] = t16;
347
- $[94] = t17;
348
- $[95] = t18;
349
- $[96] = t27;
350
- $[97] = t28;
351
- } else t28 = $[97];
352
- let t29;
353
- if ($[98] !== modal || $[99] !== t28) {
354
- t29 = /*#__PURE__*/ jsx(TaoPortalScope, {
373
+ $[97] = cn.root;
374
+ $[98] = st.root;
375
+ $[99] = t16;
376
+ $[100] = t17;
377
+ $[101] = t18;
378
+ $[102] = t19;
379
+ $[103] = t28;
380
+ $[104] = t29;
381
+ } else t29 = $[104];
382
+ let t30;
383
+ if ($[105] !== modal || $[106] !== t29) {
384
+ t30 = /*#__PURE__*/ jsx(TaoPortalScope, {
355
385
  asChild: true,
356
386
  children: /*#__PURE__*/ jsx(FocusScope, {
357
387
  asChild: true,
358
388
  trapped: modal,
359
389
  loop: modal,
360
- onMountAutoFocus: t14,
361
- children: t28
390
+ onMountAutoFocus: t15,
391
+ children: t29
362
392
  })
363
393
  });
364
- $[98] = modal;
365
- $[99] = t28;
366
- $[100] = t29;
367
- } else t29 = $[100];
368
- return t29;
394
+ $[105] = modal;
395
+ $[106] = t29;
396
+ $[107] = t30;
397
+ } else t30 = $[107];
398
+ return t30;
369
399
  }
370
400
  function _temp(_, index) {
371
401
  return index;
372
402
  }
373
403
  function Tour(props) {
374
- const $ = c(59);
404
+ const $ = c(71);
375
405
  const { tokenStyle } = useTaoInternalConfig();
376
406
  let actionsRender;
377
407
  let className;
378
408
  let classNames;
409
+ let defaultOpen;
379
410
  let indicatorsRender;
411
+ let onClose;
412
+ let open;
380
413
  let rest;
381
414
  let rootClassName;
382
415
  let style;
@@ -387,72 +420,82 @@ function Tour(props) {
387
420
  let type;
388
421
  let zIndex;
389
422
  if ($[0] !== props) {
390
- ({ steps: t0, type, indicatorsRender, actionsRender, classNames, styles, className, style, prefixCls: t1, rootClassName, keyboard: t2, zIndex, ...rest } = props);
423
+ ({ steps: t0, type, indicatorsRender, actionsRender, classNames, styles, className, style, prefixCls: t1, rootClassName, keyboard: t2, zIndex, open, defaultOpen, onClose, ...rest } = props);
391
424
  $[0] = props;
392
425
  $[1] = actionsRender;
393
426
  $[2] = className;
394
427
  $[3] = classNames;
395
- $[4] = indicatorsRender;
396
- $[5] = rest;
397
- $[6] = rootClassName;
398
- $[7] = style;
399
- $[8] = styles;
400
- $[9] = t0;
401
- $[10] = t1;
402
- $[11] = t2;
403
- $[12] = type;
404
- $[13] = zIndex;
428
+ $[4] = defaultOpen;
429
+ $[5] = indicatorsRender;
430
+ $[6] = onClose;
431
+ $[7] = open;
432
+ $[8] = rest;
433
+ $[9] = rootClassName;
434
+ $[10] = style;
435
+ $[11] = styles;
436
+ $[12] = t0;
437
+ $[13] = t1;
438
+ $[14] = t2;
439
+ $[15] = type;
440
+ $[16] = zIndex;
405
441
  } else {
406
442
  actionsRender = $[1];
407
443
  className = $[2];
408
444
  classNames = $[3];
409
- indicatorsRender = $[4];
410
- rest = $[5];
411
- rootClassName = $[6];
412
- style = $[7];
413
- styles = $[8];
414
- t0 = $[9];
415
- t1 = $[10];
416
- t2 = $[11];
417
- type = $[12];
418
- zIndex = $[13];
445
+ defaultOpen = $[4];
446
+ indicatorsRender = $[5];
447
+ onClose = $[6];
448
+ open = $[7];
449
+ rest = $[8];
450
+ rootClassName = $[9];
451
+ style = $[10];
452
+ styles = $[11];
453
+ t0 = $[12];
454
+ t1 = $[13];
455
+ t2 = $[14];
456
+ type = $[15];
457
+ zIndex = $[16];
419
458
  }
420
459
  let t3;
421
- if ($[14] !== t0) {
460
+ if ($[17] !== t0) {
422
461
  t3 = void 0 === t0 ? [] : t0;
423
- $[14] = t0;
424
- $[15] = t3;
425
- } else t3 = $[15];
462
+ $[17] = t0;
463
+ $[18] = t3;
464
+ } else t3 = $[18];
426
465
  const steps = t3;
427
466
  const prefixCls = void 0 === t1 ? "tao-tour" : t1;
428
467
  const keyboard = void 0 === t2 ? true : t2;
468
+ const [innerOpen, setInnerOpen] = useState(defaultOpen ?? true);
429
469
  let t4;
430
- if ($[16] !== classNames || $[17] !== props) {
470
+ if ($[19] !== classNames || $[20] !== props) {
431
471
  t4 = "function" == typeof classNames ? classNames({
432
472
  props
433
473
  }) : classNames;
434
- $[16] = classNames;
435
- $[17] = props;
436
- $[18] = t4;
437
- } else t4 = $[18];
474
+ $[19] = classNames;
475
+ $[20] = props;
476
+ $[21] = t4;
477
+ } else t4 = $[21];
438
478
  const cn = t4;
439
479
  let t5;
440
- if ($[19] !== props || $[20] !== styles) {
480
+ if ($[22] !== props || $[23] !== styles) {
441
481
  t5 = "function" == typeof styles ? styles({
442
482
  props
443
483
  }) : styles;
444
- $[19] = props;
445
- $[20] = styles;
446
- $[21] = t5;
447
- } else t5 = $[21];
484
+ $[22] = props;
485
+ $[23] = styles;
486
+ $[24] = t5;
487
+ } else t5 = $[24];
448
488
  const st = t5;
449
489
  const layer = zIndex ?? "calc(var(--tao-z-index-base) + var(--tao-z-index-popup-base) + 170)";
450
490
  let t6;
451
- if ($[22] !== className || $[23] !== layer || $[24] !== steps || $[25] !== style || $[26] !== tokenStyle) {
491
+ if ($[25] !== className || $[26] !== layer || $[27] !== props.scrollIntoViewOptions || $[28] !== steps || $[29] !== style || $[30] !== tokenStyle) {
452
492
  let t7;
453
- if ($[28] !== className || $[29] !== layer || $[30] !== style || $[31] !== tokenStyle) {
454
- t7 = (step)=>({
493
+ if ($[32] !== className || $[33] !== layer || $[34] !== props.scrollIntoViewOptions || $[35] !== style || $[36] !== tokenStyle) {
494
+ t7 = (t8)=>{
495
+ const { onClose: _close, onFinish: _finish, onNext: _next, onPrev: _prev, ...step } = t8;
496
+ return {
455
497
  ...step,
498
+ scrollIntoViewOptions: step.scrollIntoViewOptions ?? props.scrollIntoViewOptions,
456
499
  style: {
457
500
  ...tokenStyle,
458
501
  position: "absolute",
@@ -463,96 +506,122 @@ function Tour(props) {
463
506
  ...step.style
464
507
  },
465
508
  className: cx(className, step.className)
466
- });
467
- $[28] = className;
468
- $[29] = layer;
469
- $[30] = style;
470
- $[31] = tokenStyle;
471
- $[32] = t7;
472
- } else t7 = $[32];
509
+ };
510
+ };
511
+ $[32] = className;
512
+ $[33] = layer;
513
+ $[34] = props.scrollIntoViewOptions;
514
+ $[35] = style;
515
+ $[36] = tokenStyle;
516
+ $[37] = t7;
517
+ } else t7 = $[37];
473
518
  t6 = steps.map(t7);
474
- $[22] = className;
475
- $[23] = layer;
476
- $[24] = steps;
477
- $[25] = style;
478
- $[26] = tokenStyle;
479
- $[27] = t6;
480
- } else t6 = $[27];
519
+ $[25] = className;
520
+ $[26] = layer;
521
+ $[27] = props.scrollIntoViewOptions;
522
+ $[28] = steps;
523
+ $[29] = style;
524
+ $[30] = tokenStyle;
525
+ $[31] = t6;
526
+ } else t6 = $[31];
481
527
  const mergedSteps = t6;
482
- const t7 = props.builtinPlacements ?? _temp3;
483
- const t8 = cn?.mask;
484
- let t9;
485
- if ($[33] !== t8) {
486
- t9 = {
487
- mask: t8
528
+ const t7 = open ?? innerOpen;
529
+ let t8;
530
+ if ($[38] !== onClose || $[39] !== open) {
531
+ t8 = (current)=>{
532
+ if (void 0 === open) setInnerOpen(false);
533
+ onClose?.(current);
488
534
  };
489
- $[33] = t8;
490
- $[34] = t9;
491
- } else t9 = $[34];
492
- const t10 = st?.mask;
535
+ $[38] = onClose;
536
+ $[39] = open;
537
+ $[40] = t8;
538
+ } else t8 = $[40];
539
+ const t9 = props.builtinPlacements ?? _temp3;
540
+ const t10 = cn?.mask;
493
541
  let t11;
494
- if ($[35] !== layer || $[36] !== t10 || $[37] !== tokenStyle) {
495
- t11 = {
542
+ if ($[41] !== t10) {
543
+ t11 = cx("tao-tour-mask-layer", t10);
544
+ $[41] = t10;
545
+ $[42] = t11;
546
+ } else t11 = $[42];
547
+ let t12;
548
+ if ($[43] !== t11) {
549
+ t12 = {
550
+ mask: t11
551
+ };
552
+ $[43] = t11;
553
+ $[44] = t12;
554
+ } else t12 = $[44];
555
+ const t13 = st?.mask;
556
+ let t14;
557
+ if ($[45] !== layer || $[46] !== t13 || $[47] !== tokenStyle) {
558
+ t14 = {
496
559
  mask: {
497
560
  ...tokenStyle,
498
561
  zIndex: layer,
499
- ...t10
562
+ ...t13
500
563
  }
501
564
  };
502
- $[35] = layer;
503
- $[36] = t10;
504
- $[37] = tokenStyle;
505
- $[38] = t11;
506
- } else t11 = $[38];
507
- let t12;
508
- if ($[39] !== actionsRender || $[40] !== cn || $[41] !== indicatorsRender || $[42] !== props.disabledInteraction || $[43] !== props.mask || $[44] !== st || $[45] !== steps || $[46] !== type) {
509
- t12 = (step_0, current)=>/*#__PURE__*/ jsx(TourPanel, {
565
+ $[45] = layer;
566
+ $[46] = t13;
567
+ $[47] = tokenStyle;
568
+ $[48] = t14;
569
+ } else t14 = $[48];
570
+ let t15;
571
+ if ($[49] !== actionsRender || $[50] !== cn || $[51] !== indicatorsRender || $[52] !== props.disabledInteraction || $[53] !== props.mask || $[54] !== st || $[55] !== steps || $[56] !== type) {
572
+ t15 = (step_0, current_0)=>/*#__PURE__*/ jsx(TourPanel, {
510
573
  step: step_0,
511
- current: current,
574
+ stepActions: steps[current_0],
575
+ current: current_0,
512
576
  type: type,
513
577
  classes: cn,
514
578
  styles: st,
515
579
  indicatorsRender: indicatorsRender,
516
580
  actionsRender: actionsRender,
517
- modal: (steps[current]?.mask ?? props.mask) !== false && (true === props.disabledInteraction || !steps[current]?.target)
581
+ masked: (step_0.mask ?? props.mask) !== false,
582
+ disabledInteraction: props.disabledInteraction
518
583
  });
519
- $[39] = actionsRender;
520
- $[40] = cn;
521
- $[41] = indicatorsRender;
522
- $[42] = props.disabledInteraction;
523
- $[43] = props.mask;
524
- $[44] = st;
525
- $[45] = steps;
526
- $[46] = type;
527
- $[47] = t12;
528
- } else t12 = $[47];
529
- let t13;
530
- if ($[48] !== keyboard || $[49] !== mergedSteps || $[50] !== prefixCls || $[51] !== rest || $[52] !== rootClassName || $[53] !== t11 || $[54] !== t12 || $[55] !== t7 || $[56] !== t9 || $[57] !== zIndex) {
531
- t13 = /*#__PURE__*/ jsx(RcTourComponent, {
584
+ $[49] = actionsRender;
585
+ $[50] = cn;
586
+ $[51] = indicatorsRender;
587
+ $[52] = props.disabledInteraction;
588
+ $[53] = props.mask;
589
+ $[54] = st;
590
+ $[55] = steps;
591
+ $[56] = type;
592
+ $[57] = t15;
593
+ } else t15 = $[57];
594
+ let t16;
595
+ if ($[58] !== keyboard || $[59] !== mergedSteps || $[60] !== prefixCls || $[61] !== rest || $[62] !== rootClassName || $[63] !== t12 || $[64] !== t14 || $[65] !== t15 || $[66] !== t7 || $[67] !== t8 || $[68] !== t9 || $[69] !== zIndex) {
596
+ t16 = /*#__PURE__*/ jsx(RcTourComponent, {
532
597
  ...rest,
598
+ open: t7,
599
+ onClose: t8,
533
600
  prefixCls: prefixCls,
534
601
  steps: mergedSteps,
535
602
  keyboard: keyboard,
536
603
  zIndex: zIndex,
537
- builtinPlacements: t7,
604
+ builtinPlacements: t9,
538
605
  rootClassName: rootClassName,
539
- classNames: t9,
540
- styles: t11,
541
- renderPanel: t12
606
+ classNames: t12,
607
+ styles: t14,
608
+ renderPanel: t15
542
609
  });
543
- $[48] = keyboard;
544
- $[49] = mergedSteps;
545
- $[50] = prefixCls;
546
- $[51] = rest;
547
- $[52] = rootClassName;
548
- $[53] = t11;
549
- $[54] = t12;
550
- $[55] = t7;
551
- $[56] = t9;
552
- $[57] = zIndex;
553
- $[58] = t13;
554
- } else t13 = $[58];
555
- return t13;
610
+ $[58] = keyboard;
611
+ $[59] = mergedSteps;
612
+ $[60] = prefixCls;
613
+ $[61] = rest;
614
+ $[62] = rootClassName;
615
+ $[63] = t12;
616
+ $[64] = t14;
617
+ $[65] = t15;
618
+ $[66] = t7;
619
+ $[67] = t8;
620
+ $[68] = t9;
621
+ $[69] = zIndex;
622
+ $[70] = t16;
623
+ } else t16 = $[70];
624
+ return t16;
556
625
  }
557
626
  function _temp3(config) {
558
627
  return Object.fromEntries(Object.entries(getPlacements(config?.arrowPointAtCenter)).map(_temp2));