@rockshin/tao-ui 0.0.47 → 0.0.49

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 (144) 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.js +61 -53
  12. package/dist/components/calendar/calendar.js +6 -4
  13. package/dist/components/card/card.js +24 -8
  14. package/dist/components/carousel/carousel.d.ts +1 -1
  15. package/dist/components/carousel/carousel.js +105 -68
  16. package/dist/components/cascader/cascader.js +54 -19
  17. package/dist/components/checkbox/checkbox.css +13 -2
  18. package/dist/components/checkbox/checkbox.d.ts +2 -0
  19. package/dist/components/checkbox/checkbox.js +320 -229
  20. package/dist/components/collapse/collapse-panels.d.ts +1 -1
  21. package/dist/components/collapse/collapse-panels.js +122 -113
  22. package/dist/components/collapse/collapse.js +98 -63
  23. package/dist/components/color-picker/color-picker.js +539 -441
  24. package/dist/components/color-picker/color.js +1 -1
  25. package/dist/components/context-menu/context-menu.d.ts +1 -1
  26. package/dist/components/context-menu/context-menu.js +108 -68
  27. package/dist/components/date-picker/calendar/calendar-grid.js +42 -39
  28. package/dist/components/date-picker/calendar/month-grid.d.ts +8 -1
  29. package/dist/components/date-picker/calendar/month-grid.js +79 -37
  30. package/dist/components/date-picker/calendar/time-panel.d.ts +2 -1
  31. package/dist/components/date-picker/calendar/time-panel.js +94 -89
  32. package/dist/components/date-picker/calendar/year-grid.d.ts +8 -1
  33. package/dist/components/date-picker/calendar/year-grid.js +66 -35
  34. package/dist/components/date-picker/date-picker.css +24 -1
  35. package/dist/components/date-picker/date-picker.js +99 -53
  36. package/dist/components/date-picker/presets.d.ts +2 -1
  37. package/dist/components/date-picker/presets.js +27 -24
  38. package/dist/components/date-picker/range-picker.js +308 -153
  39. package/dist/components/descriptions/descriptions.js +7 -3
  40. package/dist/components/divider/divider.css +1 -1
  41. package/dist/components/divider/divider.js +1 -1
  42. package/dist/components/drawer/drawer.js +201 -369
  43. package/dist/components/dropdown/dropdown.d.ts +1 -1
  44. package/dist/components/dropdown/dropdown.js +183 -279
  45. package/dist/components/empty/empty.js +57 -78
  46. package/dist/components/float-button/float-button.d.ts +1 -0
  47. package/dist/components/float-button/float-button.js +47 -30
  48. package/dist/components/form/field-control.d.ts +4 -2
  49. package/dist/components/form/field-control.js +17 -9
  50. package/dist/components/form/form-context.d.ts +8 -2
  51. package/dist/components/form/form-context.js +2 -1
  52. package/dist/components/form/form-item.js +85 -63
  53. package/dist/components/form/form.css +3 -2
  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/otp.js +236 -217
  65. package/dist/components/input/password.js +2 -1
  66. package/dist/components/input/search.js +8 -7
  67. package/dist/components/list/list-pagination.js +41 -36
  68. package/dist/components/list/list.js +141 -125
  69. package/dist/components/listy/listy.js +175 -106
  70. package/dist/components/masonry/masonry.js +108 -85
  71. package/dist/components/mentions/mentions.js +12 -3
  72. package/dist/components/menu/menu-render.d.ts +9 -3
  73. package/dist/components/menu/menu-render.js +99 -36
  74. package/dist/components/modal/confirm-dialog.js +10 -4
  75. package/dist/components/modal/confirm.js +3 -7
  76. package/dist/components/modal/index.js +9 -3
  77. package/dist/components/modal/modal.js +390 -365
  78. package/dist/components/pagination/pagination.js +105 -96
  79. package/dist/components/popconfirm/popconfirm.d.ts +1 -1
  80. package/dist/components/popconfirm/popconfirm.js +219 -168
  81. package/dist/components/popover/popover.js +330 -243
  82. package/dist/components/progress/progress.css +2 -2
  83. package/dist/components/progress/progress.js +232 -458
  84. package/dist/components/qr-code/qr-code.js +72 -66
  85. package/dist/components/radio/radio.css +15 -4
  86. package/dist/components/radio/radio.d.ts +2 -1
  87. package/dist/components/radio/radio.js +260 -198
  88. package/dist/components/rate/rate.js +173 -113
  89. package/dist/components/scroll-area/scroll-area.js +241 -211
  90. package/dist/components/segmented/segmented.js +73 -41
  91. package/dist/components/select/mobile-select.d.ts +2 -1
  92. package/dist/components/select/mobile-select.js +24 -13
  93. package/dist/components/select/select-searchable-list.d.ts +2 -1
  94. package/dist/components/select/select-searchable-list.js +2 -3
  95. package/dist/components/select/select.js +49 -25
  96. package/dist/components/select/use-select-selection.d.ts +1 -1
  97. package/dist/components/select/use-select-selection.js +7 -4
  98. package/dist/components/skeleton/skeleton.js +56 -48
  99. package/dist/components/slider/slider.js +87 -212
  100. package/dist/components/sonner/sonner.js +109 -93
  101. package/dist/components/spinner/spinner.js +147 -138
  102. package/dist/components/splitter/splitter.js +222 -159
  103. package/dist/components/statistic/statistic.js +7 -6
  104. package/dist/components/steps/steps.js +88 -81
  105. package/dist/components/steps/use-display-steps.js +1 -1
  106. package/dist/components/switch/switch.js +89 -89
  107. package/dist/components/table/table-filter.js +66 -56
  108. package/dist/components/table/table-icons.d.ts +2 -1
  109. package/dist/components/table/table-icons.js +11 -9
  110. package/dist/components/table/table-model.js +1 -1
  111. package/dist/components/table/table.js +107 -83
  112. package/dist/components/table/use-table-data.d.ts +6 -3
  113. package/dist/components/table/use-table-data.js +166 -130
  114. package/dist/components/tabs/tabs.css +1 -1
  115. package/dist/components/tabs/tabs.js +236 -179
  116. package/dist/components/tag/tag.d.ts +2 -2
  117. package/dist/components/tag/tag.js +111 -108
  118. package/dist/components/textarea/textarea.js +22 -17
  119. package/dist/components/time-picker/time-picker.js +5 -3
  120. package/dist/components/timeline/timeline.css +6 -1
  121. package/dist/components/timeline/timeline.js +21 -11
  122. package/dist/components/tooltip/tooltip.d.ts +2 -2
  123. package/dist/components/tooltip/tooltip.js +123 -233
  124. package/dist/components/tour/tour.css +4 -0
  125. package/dist/components/tour/tour.js +400 -331
  126. package/dist/components/transfer/transfer-list.js +29 -11
  127. package/dist/components/transfer/transfer-parts.js +1 -1
  128. package/dist/components/transfer/transfer-types.d.ts +1 -0
  129. package/dist/components/transfer/transfer.js +29 -14
  130. package/dist/components/tree/tree-keyboard.d.ts +1 -1
  131. package/dist/components/tree/tree-keyboard.js +5 -3
  132. package/dist/components/tree/tree.js +74 -59
  133. package/dist/components/tree-select/select-engine.d.ts +3 -2
  134. package/dist/components/tree-select/select-engine.js +18 -16
  135. package/dist/components/tree-select/tree-select.js +21 -5
  136. package/dist/components/upload/upload.css +8 -0
  137. package/dist/components/upload/upload.js +160 -72
  138. package/dist/components/watermark/watermark.js +36 -29
  139. package/dist/number-input/use-number-input.js +129 -90
  140. package/dist/number-input/validate.js +32 -5
  141. package/dist/provider/merge-locale.js +12 -9
  142. package/dist/provider/tao-provider.d.ts +3 -1
  143. package/dist/provider/tao-provider.js +123 -86
  144. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { c } from "react-compiler-runtime";
3
3
  import { forwardRef, isValidElement, useImperativeHandle, useRef } from "react";
4
+ import { useTaoConfig } from "../../provider/tao-provider.js";
4
5
  import { cx } from "../../utils/semantic.js";
5
6
  import "./badge.css";
6
7
  const presetColors = {
@@ -12,267 +13,81 @@ const presetColors = {
12
13
  processing: 'var(--tao-color-primary)',
13
14
  default: 'var(--tao-color-text-quaternary)'
14
15
  };
15
- const renderable = (node)=>null != node && 'boolean' != typeof node;
16
+ const renderable = (node)=>null != node && '' !== node && 'boolean' != typeof node;
16
17
  const BadgeRoot = /*#__PURE__*/ forwardRef((props, ref)=>{
17
- const $ = c(85);
18
- let children;
19
- let className;
20
- let classNames;
21
- let color;
22
- let offset;
23
- let prefixCls;
24
- let rest;
25
- let rootClassName;
26
- let scrollNumberPrefixCls;
27
- let status;
28
- let style;
29
- let styles;
30
- let t0;
31
- let t1;
32
- let t2;
33
- let t3;
34
- let t4;
35
- let text;
36
- let title;
37
- if ($[0] !== props) {
38
- ({ count: t0, showZero: t1, overflowCount: t2, dot: t3, prefixCls, scrollNumberPrefixCls, rootClassName, status, color, text, size: t4, offset, title, children, className, style, classNames, styles, ...rest } = props);
39
- $[0] = props;
40
- $[1] = children;
41
- $[2] = className;
42
- $[3] = classNames;
43
- $[4] = color;
44
- $[5] = offset;
45
- $[6] = prefixCls;
46
- $[7] = rest;
47
- $[8] = rootClassName;
48
- $[9] = scrollNumberPrefixCls;
49
- $[10] = status;
50
- $[11] = style;
51
- $[12] = styles;
52
- $[13] = t0;
53
- $[14] = t1;
54
- $[15] = t2;
55
- $[16] = t3;
56
- $[17] = t4;
57
- $[18] = text;
58
- $[19] = title;
59
- } else {
60
- children = $[1];
61
- className = $[2];
62
- classNames = $[3];
63
- color = $[4];
64
- offset = $[5];
65
- prefixCls = $[6];
66
- rest = $[7];
67
- rootClassName = $[8];
68
- scrollNumberPrefixCls = $[9];
69
- status = $[10];
70
- style = $[11];
71
- styles = $[12];
72
- t0 = $[13];
73
- t1 = $[14];
74
- t2 = $[15];
75
- t3 = $[16];
76
- t4 = $[17];
77
- text = $[18];
78
- title = $[19];
79
- }
80
- const count = void 0 === t0 ? null : t0;
81
- const showZero = void 0 === t1 ? false : t1;
82
- const overflowCount = void 0 === t2 ? 99 : t2;
83
- const dot = void 0 === t3 ? false : t3;
84
- const size = void 0 === t4 ? "medium" : t4;
85
- let classes;
86
- let t5;
87
- if ($[20] !== classNames || $[21] !== count || $[22] !== dot || $[23] !== overflowCount || $[24] !== props || $[25] !== showZero || $[26] !== size || $[27] !== styles) {
88
- const mergedProps = {
89
- ...props,
90
- count,
91
- showZero,
92
- overflowCount,
93
- dot,
94
- size
95
- };
96
- classes = "function" == typeof classNames ? classNames({
97
- props: mergedProps
98
- }) : classNames;
99
- t5 = "function" == typeof styles ? styles({
100
- props: mergedProps
101
- }) : styles;
102
- $[20] = classNames;
103
- $[21] = count;
104
- $[22] = dot;
105
- $[23] = overflowCount;
106
- $[24] = props;
107
- $[25] = showZero;
108
- $[26] = size;
109
- $[27] = styles;
110
- $[28] = classes;
111
- $[29] = t5;
112
- } else {
113
- classes = $[28];
114
- t5 = $[29];
115
- }
116
- const slots = t5;
117
- const numeric = "number" == typeof count || "string" == typeof count ? Number(count) : void 0;
18
+ const { size: contextSize } = useTaoConfig();
19
+ const { count = null, showZero = false, overflowCount = 99, dot = false, prefixCls, scrollNumberPrefixCls, rootClassName, status, color, text, size = 'small' === contextSize ? 'small' : 'medium', offset, title, children, className, style, classNames, styles, ...rest } = props;
20
+ const mergedProps = {
21
+ ...props,
22
+ count,
23
+ showZero,
24
+ overflowCount,
25
+ dot,
26
+ size
27
+ };
28
+ const classes = 'function' == typeof classNames ? classNames({
29
+ props: mergedProps
30
+ }) : classNames;
31
+ const slots = 'function' == typeof styles ? styles({
32
+ props: mergedProps
33
+ }) : styles;
34
+ const numeric = 'number' == typeof count || 'string' == typeof count ? Number(count) : void 0;
118
35
  const label = void 0 !== numeric && numeric > overflowCount ? `${overflowCount}+` : count;
119
- const zero = 0 === label || "0" === label || 0 === text || "0" === text;
120
- const statusMode = (void 0 !== status || void 0 !== color) && (null === count || zero && !showZero);
121
- const standaloneStatus = !children && statusMode && (!!text || void 0 !== status || !zero);
122
- const asDot = dot && !zero;
123
- let t6;
124
- if ($[30] !== asDot || $[31] !== label || $[32] !== showZero || $[33] !== text || $[34] !== zero) {
125
- t6 = (!renderable(label) && !renderable(text) || zero && !showZero) && !asDot;
126
- $[30] = asDot;
127
- $[31] = label;
128
- $[32] = showZero;
129
- $[33] = text;
130
- $[34] = zero;
131
- $[35] = t6;
132
- } else t6 = $[35];
133
- const hidden = t6;
134
- let t7;
135
- if ($[36] !== offset) {
136
- t7 = offset ? {
137
- marginTop: offset[1],
138
- insetInlineEnd: -Number.parseFloat(String(offset[0]))
139
- } : {};
140
- $[36] = offset;
141
- $[37] = t7;
142
- } else t7 = $[37];
143
- const offsetStyle = t7;
36
+ const zero = 0 === label || '0' === label;
37
+ const statusMode = (void 0 !== status || void 0 !== color) && (!renderable(label) || zero && !showZero);
38
+ const hasChildren = Boolean(children) || 0 === children;
39
+ const statusDot = statusMode && (!!text || void 0 !== status || !zero);
40
+ const standaloneStatus = !hasChildren && statusDot;
41
+ const asDot = statusDot || dot && !zero;
42
+ const visibleText = renderable(text) && (showZero || 0 !== text && '0' !== text);
43
+ const hidden = (!renderable(label) && !visibleText || zero && !showZero) && !asDot;
44
+ const offsetStyle = offset ? {
45
+ marginTop: offset[1],
46
+ insetInlineEnd: Number.isFinite(Number(offset[0])) ? -Number(offset[0]) : `calc(0px - (${offset[0]}))`
47
+ } : {};
144
48
  const customColor = void 0 === color ? void 0 : presetColors[color] ?? color;
145
- const titleValue = null === title || false === title ? void 0 : title ?? ("number" == typeof count || "string" == typeof count ? String(count) : void 0);
146
- const visibleText = !hidden && (0 === text ? showZero : !!text && true !== text);
147
- const t8 = slots?.indicator;
148
- let t9;
149
- if ($[38] !== standaloneStatus || $[39] !== style) {
150
- t9 = standaloneStatus ? {} : style;
151
- $[38] = standaloneStatus;
152
- $[39] = style;
153
- $[40] = t9;
154
- } else t9 = $[40];
155
- let t10;
156
- if ($[41] !== customColor) {
157
- t10 = customColor ? {
49
+ const titleValue = null === title || false === title ? void 0 : title ?? ('number' == typeof count || 'string' == typeof count ? String(count) : void 0);
50
+ const indicatorStyle = {
51
+ ...offsetStyle,
52
+ ...slots?.indicator,
53
+ ...!standaloneStatus ? style : {},
54
+ ...customColor ? {
158
55
  background: customColor
159
- } : {};
160
- $[41] = customColor;
161
- $[42] = t10;
162
- } else t10 = $[42];
163
- let t11;
164
- if ($[43] !== offsetStyle || $[44] !== t10 || $[45] !== t8 || $[46] !== t9) {
165
- t11 = {
166
- ...offsetStyle,
167
- ...t8,
168
- ...t9,
169
- ...t10
170
- };
171
- $[43] = offsetStyle;
172
- $[44] = t10;
173
- $[45] = t8;
174
- $[46] = t9;
175
- $[47] = t11;
176
- } else t11 = $[47];
177
- const indicatorStyle = t11;
178
- const t12 = !!children || void 0;
179
- const t13 = standaloneStatus || void 0;
180
- const t14 = classes?.root;
181
- let t15;
182
- if ($[48] !== className || $[49] !== prefixCls || $[50] !== rootClassName || $[51] !== t14) {
183
- t15 = cx(prefixCls, t14, className, rootClassName);
184
- $[48] = className;
185
- $[49] = prefixCls;
186
- $[50] = rootClassName;
187
- $[51] = t14;
188
- $[52] = t15;
189
- } else t15 = $[52];
190
- const t16 = slots?.root;
191
- let t17;
192
- if ($[53] !== offsetStyle || $[54] !== standaloneStatus || $[55] !== style) {
193
- t17 = standaloneStatus ? {
194
- ...offsetStyle,
195
- ...style
196
- } : {};
197
- $[53] = offsetStyle;
198
- $[54] = standaloneStatus;
199
- $[55] = style;
200
- $[56] = t17;
201
- } else t17 = $[56];
202
- let t18;
203
- if ($[57] !== t16 || $[58] !== t17) {
204
- t18 = {
205
- ...t16,
206
- ...t17
207
- };
208
- $[57] = t16;
209
- $[58] = t17;
210
- $[59] = t18;
211
- } else t18 = $[59];
212
- let t19;
213
- if ($[60] !== asDot || $[61] !== classes?.indicator || $[62] !== count || $[63] !== hidden || $[64] !== indicatorStyle || $[65] !== label || $[66] !== scrollNumberPrefixCls || $[67] !== size || $[68] !== standaloneStatus || $[69] !== status || $[70] !== titleValue) {
214
- t19 = (standaloneStatus || !hidden) && /*#__PURE__*/ jsx("span", {
215
- "data-tao-badge-indicator": "",
216
- "data-tao-status": status,
217
- "data-tao-dot": standaloneStatus || asDot || void 0,
218
- "data-tao-size": "small" === size ? "small" : "medium",
219
- "data-tao-custom": /*#__PURE__*/ isValidElement(count) || void 0,
220
- className: cx(scrollNumberPrefixCls, classes?.indicator),
221
- title: standaloneStatus ? void 0 : titleValue,
222
- style: indicatorStyle,
223
- children: !standaloneStatus && !asDot && label
224
- });
225
- $[60] = asDot;
226
- $[61] = classes?.indicator;
227
- $[62] = count;
228
- $[63] = hidden;
229
- $[64] = indicatorStyle;
230
- $[65] = label;
231
- $[66] = scrollNumberPrefixCls;
232
- $[67] = size;
233
- $[68] = standaloneStatus;
234
- $[69] = status;
235
- $[70] = titleValue;
236
- $[71] = t19;
237
- } else t19 = $[71];
238
- let t20;
239
- if ($[72] !== text || $[73] !== visibleText) {
240
- t20 = visibleText && /*#__PURE__*/ jsx("span", {
241
- "data-tao-badge-text": "",
242
- children: text
243
- });
244
- $[72] = text;
245
- $[73] = visibleText;
246
- $[74] = t20;
247
- } else t20 = $[74];
248
- let t21;
249
- if ($[75] !== children || $[76] !== ref || $[77] !== rest || $[78] !== t12 || $[79] !== t13 || $[80] !== t15 || $[81] !== t18 || $[82] !== t19 || $[83] !== t20) {
250
- t21 = /*#__PURE__*/ jsxs("span", {
251
- ...rest,
252
- ref: ref,
253
- "data-tao-badge": "",
254
- "data-tao-wrapper": t12,
255
- "data-tao-status-only": t13,
256
- className: t15,
257
- style: t18,
258
- children: [
259
- children,
260
- t19,
261
- t20
262
- ]
263
- });
264
- $[75] = children;
265
- $[76] = ref;
266
- $[77] = rest;
267
- $[78] = t12;
268
- $[79] = t13;
269
- $[80] = t15;
270
- $[81] = t18;
271
- $[82] = t19;
272
- $[83] = t20;
273
- $[84] = t21;
274
- } else t21 = $[84];
275
- return t21;
56
+ } : {}
57
+ };
58
+ return /*#__PURE__*/ jsxs("span", {
59
+ ...rest,
60
+ ref: ref,
61
+ "data-tao-badge": "",
62
+ "data-tao-wrapper": hasChildren || void 0,
63
+ "data-tao-status-only": standaloneStatus || void 0,
64
+ className: cx(prefixCls, classes?.root, className, rootClassName),
65
+ style: {
66
+ ...slots?.root,
67
+ ...standaloneStatus ? {
68
+ ...offsetStyle,
69
+ ...style
70
+ } : {}
71
+ },
72
+ children: [
73
+ children,
74
+ !hidden && /*#__PURE__*/ jsx("span", {
75
+ "data-tao-badge-indicator": "",
76
+ "data-tao-status": status,
77
+ "data-tao-dot": asDot || void 0,
78
+ "data-tao-size": 'small' === size ? 'small' : 'medium',
79
+ "data-tao-custom": /*#__PURE__*/ isValidElement(count) || void 0,
80
+ className: cx(scrollNumberPrefixCls, classes?.indicator),
81
+ title: standaloneStatus ? void 0 : titleValue,
82
+ style: indicatorStyle,
83
+ children: !asDot && label
84
+ }),
85
+ visibleText && /*#__PURE__*/ jsx("span", {
86
+ "data-tao-badge-text": "",
87
+ children: text
88
+ })
89
+ ]
90
+ });
276
91
  });
277
92
  BadgeRoot.displayName = 'Badge';
278
93
  const Ribbon = /*#__PURE__*/ forwardRef((props, ref)=>{
@@ -90,7 +90,8 @@ function perimeterPoint(distance, points) {
90
90
  function BeamEffect({ host, item, duration, phase, prefixCls, className, style, classNames, styles }) {
91
91
  const root = useRef(null);
92
92
  const beam = useRef(null);
93
- const border = getComputedStyle(host);
93
+ const ownerWindow = host.ownerDocument.defaultView ?? window;
94
+ const border = ownerWindow.getComputedStyle(host);
94
95
  const inset = void 0 === item.outset ? [
95
96
  border.borderTopWidth,
96
97
  border.borderRightWidth,
@@ -100,7 +101,8 @@ function BeamEffect({ host, item, duration, phase, prefixCls, className, style,
100
101
  useEffect(()=>{
101
102
  const overlay = root.current;
102
103
  const light = beam.current;
103
- const motion = matchMedia('(prefers-reduced-motion: reduce)');
104
+ const view = host.ownerDocument.defaultView ?? window;
105
+ const motion = view.matchMedia('(prefers-reduced-motion: reduce)');
104
106
  let width = 0;
105
107
  let height = 0;
106
108
  let path = [];
@@ -111,7 +113,7 @@ function BeamEffect({ host, item, duration, phase, prefixCls, className, style,
111
113
  const measure = ()=>{
112
114
  width = overlay.clientWidth;
113
115
  height = overlay.clientHeight;
114
- path = borderPath(width, height, getComputedStyle(overlay));
116
+ path = borderPath(width, height, view.getComputedStyle(overlay));
115
117
  beamWidth = light.offsetWidth;
116
118
  beamHeight = light.offsetHeight;
117
119
  };
@@ -121,13 +123,13 @@ function BeamEffect({ host, item, duration, phase, prefixCls, className, style,
121
123
  const distance = ((now - start) / (1000 * duration) + phase) % 1 * perimeter;
122
124
  const [x, y, angle] = perimeterPoint(distance, path);
123
125
  light.style.transform = `translate(${x - 0.9 * beamWidth}px, ${y - beamHeight / 2}px) rotate(${angle}deg)`;
124
- frame = requestAnimationFrame(tick);
126
+ frame = view.requestAnimationFrame(tick);
125
127
  };
126
128
  const updateMotion = ()=>{
127
- cancelAnimationFrame(frame);
128
- if (!motion.matches) frame = requestAnimationFrame(tick);
129
+ view.cancelAnimationFrame(frame);
130
+ if (!motion.matches) frame = view.requestAnimationFrame(tick);
129
131
  };
130
- const observer = new ResizeObserver(measure);
132
+ const observer = new view.ResizeObserver(measure);
131
133
  observer.observe(overlay);
132
134
  observer.observe(light);
133
135
  measure();
@@ -135,11 +137,12 @@ function BeamEffect({ host, item, duration, phase, prefixCls, className, style,
135
137
  motion.addEventListener('change', updateMotion);
136
138
  return ()=>{
137
139
  observer.disconnect();
138
- cancelAnimationFrame(frame);
140
+ view.cancelAnimationFrame(frame);
139
141
  motion.removeEventListener('change', updateMotion);
140
142
  };
141
143
  }, [
142
144
  duration,
145
+ host,
143
146
  phase
144
147
  ]);
145
148
  return /*#__PURE__*/ createPortal(/*#__PURE__*/ jsx("div", {
@@ -167,18 +170,19 @@ function BeamEffect({ host, item, duration, phase, prefixCls, className, style,
167
170
  }
168
171
  function BorderBeam({ prefixCls, className, style, children, color, count, duration, items, lineWidth, outset, size, classNames, styles }) {
169
172
  const [host, setHost] = useState(null);
170
- const assignHost = useCallback((node)=>setHost(node instanceof HTMLElement ? node : node?.nativeElement ?? null), []);
173
+ const assignHost = useCallback((node)=>setHost(node && 'nativeElement' in node ? node.nativeElement : node), []);
174
+ const total = items?.length ?? (void 0 !== count && Number.isFinite(count) && count >= 1 ? Math.floor(count) : 1);
175
+ const activeHost = total ? host : null;
171
176
  useEffect(()=>{
172
- if (!host || 'static' !== getComputedStyle(host).position) return;
173
- const original = host.style.position;
174
- host.style.position = 'relative';
177
+ if (!activeHost || 'static' !== getComputedStyle(activeHost).position) return;
178
+ const original = activeHost.style.position;
179
+ activeHost.style.position = 'relative';
175
180
  return ()=>{
176
- if ('relative' === host.style.position) host.style.position = original;
181
+ if ('relative' === activeHost.style.position) activeHost.style.position = original;
177
182
  };
178
183
  }, [
179
- host
184
+ activeHost
180
185
  ]);
181
- const total = items?.length ?? (void 0 !== count && Number.isFinite(count) && count >= 1 ? Math.floor(count) : 1);
182
186
  const seconds = void 0 !== duration && duration > 0 ? duration : 6;
183
187
  const child = /*#__PURE__*/ isValidElement(children) && children.type !== external_react_Fragment ? /*#__PURE__*/ jsx(Slot, {
184
188
  ref: assignHost,
@@ -187,13 +191,13 @@ function BorderBeam({ prefixCls, className, style, children, color, count, durat
187
191
  return /*#__PURE__*/ jsxs(Fragment, {
188
192
  children: [
189
193
  child,
190
- host && Array.from({
194
+ activeHost && Array.from({
191
195
  length: total
192
196
  }, (_, index)=>({
193
197
  phase: index / total,
194
198
  item: items?.[index]
195
199
  })).map(({ phase, item })=>/*#__PURE__*/ jsx(BeamEffect, {
196
- host: host,
200
+ host: activeHost,
197
201
  item: {
198
202
  color,
199
203
  lineWidth,