@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.
- package/dist/components/affix/affix.js +20 -16
- package/dist/components/alert/alert.js +114 -99
- package/dist/components/app/app-modals.js +134 -96
- package/dist/components/app/app-notices.js +39 -23
- package/dist/components/auto-complete/auto-complete.js +21 -7
- package/dist/components/avatar/avatar.js +31 -11
- package/dist/components/badge/badge.css +1 -1
- package/dist/components/badge/badge.js +72 -257
- package/dist/components/border-beam/border-beam.js +21 -17
- package/dist/components/breadcrumb/breadcrumb.js +178 -159
- package/dist/components/button/button.js +61 -53
- package/dist/components/calendar/calendar.js +6 -4
- package/dist/components/card/card.js +24 -8
- package/dist/components/carousel/carousel.d.ts +1 -1
- package/dist/components/carousel/carousel.js +105 -68
- package/dist/components/cascader/cascader.js +54 -19
- package/dist/components/checkbox/checkbox.css +13 -2
- package/dist/components/checkbox/checkbox.d.ts +2 -0
- package/dist/components/checkbox/checkbox.js +320 -229
- package/dist/components/collapse/collapse-panels.d.ts +1 -1
- package/dist/components/collapse/collapse-panels.js +122 -113
- package/dist/components/collapse/collapse.js +98 -63
- package/dist/components/color-picker/color-picker.js +539 -441
- package/dist/components/color-picker/color.js +1 -1
- package/dist/components/context-menu/context-menu.d.ts +1 -1
- package/dist/components/context-menu/context-menu.js +108 -68
- package/dist/components/date-picker/calendar/calendar-grid.js +42 -39
- package/dist/components/date-picker/calendar/month-grid.d.ts +8 -1
- package/dist/components/date-picker/calendar/month-grid.js +79 -37
- package/dist/components/date-picker/calendar/time-panel.d.ts +2 -1
- package/dist/components/date-picker/calendar/time-panel.js +94 -89
- package/dist/components/date-picker/calendar/year-grid.d.ts +8 -1
- package/dist/components/date-picker/calendar/year-grid.js +66 -35
- package/dist/components/date-picker/date-picker.css +24 -1
- package/dist/components/date-picker/date-picker.js +99 -53
- package/dist/components/date-picker/presets.d.ts +2 -1
- package/dist/components/date-picker/presets.js +27 -24
- package/dist/components/date-picker/range-picker.js +308 -153
- package/dist/components/descriptions/descriptions.js +7 -3
- package/dist/components/divider/divider.css +1 -1
- package/dist/components/divider/divider.js +1 -1
- package/dist/components/drawer/drawer.js +201 -369
- package/dist/components/dropdown/dropdown.d.ts +1 -1
- package/dist/components/dropdown/dropdown.js +183 -279
- package/dist/components/empty/empty.js +57 -78
- package/dist/components/float-button/float-button.d.ts +1 -0
- package/dist/components/float-button/float-button.js +47 -30
- package/dist/components/form/field-control.d.ts +4 -2
- package/dist/components/form/field-control.js +17 -9
- package/dist/components/form/form-context.d.ts +8 -2
- package/dist/components/form/form-context.js +2 -1
- package/dist/components/form/form-item.js +85 -63
- package/dist/components/form/form.css +3 -2
- package/dist/components/form/use-form.d.ts +2 -1
- package/dist/components/form/use-form.js +2 -1
- package/dist/components/form-field/form-field-view.d.ts +3 -1
- package/dist/components/form-field/form-field-view.js +194 -141
- package/dist/components/form-section/form-section.d.ts +1 -1
- package/dist/components/form-section/form-section.js +52 -45
- package/dist/components/image/image.js +585 -477
- package/dist/components/input/base-input.js +8 -9
- package/dist/components/input/input-shared.d.ts +5 -2
- package/dist/components/input/input-shared.js +42 -18
- package/dist/components/input/otp.js +236 -217
- package/dist/components/input/password.js +2 -1
- package/dist/components/input/search.js +8 -7
- package/dist/components/list/list-pagination.js +41 -36
- package/dist/components/list/list.js +141 -125
- package/dist/components/listy/listy.js +175 -106
- package/dist/components/masonry/masonry.js +108 -85
- package/dist/components/mentions/mentions.js +12 -3
- package/dist/components/menu/menu-render.d.ts +9 -3
- package/dist/components/menu/menu-render.js +99 -36
- package/dist/components/modal/confirm-dialog.js +10 -4
- package/dist/components/modal/confirm.js +3 -7
- package/dist/components/modal/index.js +9 -3
- package/dist/components/modal/modal.js +390 -365
- package/dist/components/pagination/pagination.js +105 -96
- package/dist/components/popconfirm/popconfirm.d.ts +1 -1
- package/dist/components/popconfirm/popconfirm.js +219 -168
- package/dist/components/popover/popover.js +330 -243
- package/dist/components/progress/progress.css +2 -2
- package/dist/components/progress/progress.js +232 -458
- package/dist/components/qr-code/qr-code.js +72 -66
- package/dist/components/radio/radio.css +15 -4
- package/dist/components/radio/radio.d.ts +2 -1
- package/dist/components/radio/radio.js +260 -198
- package/dist/components/rate/rate.js +173 -113
- package/dist/components/scroll-area/scroll-area.js +241 -211
- package/dist/components/segmented/segmented.js +73 -41
- package/dist/components/select/mobile-select.d.ts +2 -1
- package/dist/components/select/mobile-select.js +24 -13
- package/dist/components/select/select-searchable-list.d.ts +2 -1
- package/dist/components/select/select-searchable-list.js +2 -3
- package/dist/components/select/select.js +49 -25
- package/dist/components/select/use-select-selection.d.ts +1 -1
- package/dist/components/select/use-select-selection.js +7 -4
- package/dist/components/skeleton/skeleton.js +56 -48
- package/dist/components/slider/slider.js +87 -212
- package/dist/components/sonner/sonner.js +109 -93
- package/dist/components/spinner/spinner.js +147 -138
- package/dist/components/splitter/splitter.js +222 -159
- package/dist/components/statistic/statistic.js +7 -6
- package/dist/components/steps/steps.js +88 -81
- package/dist/components/steps/use-display-steps.js +1 -1
- package/dist/components/switch/switch.js +89 -89
- package/dist/components/table/table-filter.js +66 -56
- package/dist/components/table/table-icons.d.ts +2 -1
- package/dist/components/table/table-icons.js +11 -9
- package/dist/components/table/table-model.js +1 -1
- package/dist/components/table/table.js +107 -83
- package/dist/components/table/use-table-data.d.ts +6 -3
- package/dist/components/table/use-table-data.js +166 -130
- package/dist/components/tabs/tabs.css +1 -1
- package/dist/components/tabs/tabs.js +236 -179
- package/dist/components/tag/tag.d.ts +2 -2
- package/dist/components/tag/tag.js +111 -108
- package/dist/components/textarea/textarea.js +22 -17
- package/dist/components/time-picker/time-picker.js +5 -3
- package/dist/components/timeline/timeline.css +6 -1
- package/dist/components/timeline/timeline.js +21 -11
- package/dist/components/tooltip/tooltip.d.ts +2 -2
- package/dist/components/tooltip/tooltip.js +123 -233
- package/dist/components/tour/tour.css +4 -0
- package/dist/components/tour/tour.js +400 -331
- package/dist/components/transfer/transfer-list.js +29 -11
- package/dist/components/transfer/transfer-parts.js +1 -1
- package/dist/components/transfer/transfer-types.d.ts +1 -0
- package/dist/components/transfer/transfer.js +29 -14
- package/dist/components/tree/tree-keyboard.d.ts +1 -1
- package/dist/components/tree/tree-keyboard.js +5 -3
- package/dist/components/tree/tree.js +74 -59
- package/dist/components/tree-select/select-engine.d.ts +3 -2
- package/dist/components/tree-select/select-engine.js +18 -16
- package/dist/components/tree-select/tree-select.js +21 -5
- package/dist/components/upload/upload.css +8 -0
- package/dist/components/upload/upload.js +160 -72
- package/dist/components/watermark/watermark.js +36 -29
- package/dist/number-input/use-number-input.js +129 -90
- package/dist/number-input/validate.js +32 -5
- package/dist/provider/merge-locale.js +12 -9
- package/dist/provider/tao-provider.d.ts +3 -1
- package/dist/provider/tao-provider.js +123 -86
- 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
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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 ||
|
|
120
|
-
const statusMode = (void 0 !== status || void 0 !== color) && (
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
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 ?? (
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
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
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
...
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
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
|
|
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
|
|
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
|
|
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 (!
|
|
173
|
-
const original =
|
|
174
|
-
|
|
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' ===
|
|
181
|
+
if ('relative' === activeHost.style.position) activeHost.style.position = original;
|
|
177
182
|
};
|
|
178
183
|
}, [
|
|
179
|
-
|
|
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
|
-
|
|
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:
|
|
200
|
+
host: activeHost,
|
|
197
201
|
item: {
|
|
198
202
|
color,
|
|
199
203
|
lineWidth,
|