@officesdk/design 0.1.5 → 0.1.8
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/cjs/index.d.ts +103 -23
- package/dist/components/cjs/index.js +1474 -960
- package/dist/components/cjs/index.js.map +1 -1
- package/dist/components/esm/index.d.ts +103 -23
- package/dist/components/esm/index.js +1408 -885
- package/dist/components/esm/index.js.map +1 -1
- package/dist/theme/cjs/index.js +64 -66
- package/dist/theme/cjs/index.js.map +1 -1
- package/dist/theme/esm/index.js +64 -66
- package/dist/theme/esm/index.js.map +1 -1
- package/package.json +2 -4
|
@@ -1,62 +1,590 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React3, { forwardRef, useState, createContext, useEffect, useRef, useCallback, useContext } from 'react';
|
|
2
2
|
import baseStyled, { createGlobalStyle } from 'styled-components';
|
|
3
3
|
import RcTooltip from 'rc-tooltip';
|
|
4
4
|
import 'rc-tooltip/assets/bootstrap.css';
|
|
5
|
+
import ReactDOM from 'react-dom';
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var registerGlobalTheme = (theme2) => {
|
|
11
|
-
Object.assign(globalTheme, { ...globalTheme, ...theme2 });
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
9
|
+
var __esm = (fn, res) => function __init() {
|
|
10
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
12
11
|
};
|
|
13
|
-
var
|
|
14
|
-
|
|
12
|
+
var __export = (target, all) => {
|
|
13
|
+
for (var name in all)
|
|
14
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
15
|
};
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
var IconContext, IconProvider, useIconRegistry;
|
|
17
|
+
var init_IconProvider = __esm({
|
|
18
|
+
"src/Icon/IconProvider.tsx"() {
|
|
19
|
+
IconContext = createContext(null);
|
|
20
|
+
IconProvider = ({
|
|
21
|
+
icons,
|
|
22
|
+
children
|
|
23
|
+
}) => {
|
|
24
|
+
return /* @__PURE__ */ React3.createElement(IconContext.Provider, { value: icons }, children);
|
|
25
|
+
};
|
|
26
|
+
useIconRegistry = () => {
|
|
27
|
+
return useContext(IconContext);
|
|
28
|
+
};
|
|
29
|
+
IconProvider.displayName = "IconProvider";
|
|
19
30
|
}
|
|
20
|
-
};
|
|
31
|
+
});
|
|
32
|
+
var IconContainer, Icon;
|
|
33
|
+
var init_Icon = __esm({
|
|
34
|
+
"src/Icon/Icon.tsx"() {
|
|
35
|
+
init_styled();
|
|
36
|
+
init_IconProvider();
|
|
37
|
+
IconContainer = styled.span`
|
|
38
|
+
display: inline-flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
width: ${({ $size }) => typeof $size === "number" ? `${$size}px` : $size};
|
|
42
|
+
height: ${({ $size }) => typeof $size === "number" ? `${$size}px` : $size};
|
|
43
|
+
color: ${({ $color }) => $color};
|
|
44
|
+
flex-shrink: 0;
|
|
45
|
+
line-height: 1;
|
|
21
46
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
47
|
+
svg {
|
|
48
|
+
width: 100%;
|
|
49
|
+
height: 100%;
|
|
50
|
+
display: block;
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
53
|
+
Icon = ({
|
|
54
|
+
name,
|
|
55
|
+
src,
|
|
56
|
+
children,
|
|
57
|
+
size = 16,
|
|
58
|
+
color = "currentColor",
|
|
59
|
+
alt = "icon",
|
|
60
|
+
className,
|
|
61
|
+
style,
|
|
62
|
+
onClick
|
|
63
|
+
}) => {
|
|
64
|
+
const registry = useIconRegistry();
|
|
65
|
+
let iconElement = children;
|
|
66
|
+
if (!iconElement && src) {
|
|
67
|
+
iconElement = /* @__PURE__ */ React3.createElement(
|
|
68
|
+
"img",
|
|
69
|
+
{
|
|
70
|
+
src,
|
|
71
|
+
alt,
|
|
72
|
+
style: { width: "100%", height: "100%", display: "block" }
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
if (!iconElement && name && registry) {
|
|
77
|
+
const IconComponent = registry[name];
|
|
78
|
+
if (IconComponent) {
|
|
79
|
+
iconElement = /* @__PURE__ */ React3.createElement(IconComponent, null);
|
|
80
|
+
} else if (process.env.NODE_ENV !== "production") {
|
|
81
|
+
console.warn(`Icon "${name}" not found in registry. Make sure IconProvider is set up.`);
|
|
82
|
+
}
|
|
29
83
|
}
|
|
84
|
+
if (!iconElement) {
|
|
85
|
+
if (process.env.NODE_ENV !== "production" && !children && !name && !src) {
|
|
86
|
+
console.warn('Icon: one of "name", "src", or "children" must be provided');
|
|
87
|
+
}
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
return /* @__PURE__ */ React3.createElement(
|
|
91
|
+
IconContainer,
|
|
92
|
+
{
|
|
93
|
+
$size: size,
|
|
94
|
+
$color: color,
|
|
95
|
+
className,
|
|
96
|
+
style,
|
|
97
|
+
onClick
|
|
98
|
+
},
|
|
99
|
+
iconElement
|
|
100
|
+
);
|
|
30
101
|
};
|
|
102
|
+
Icon.displayName = "Icon";
|
|
31
103
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
// src/Icon/index.ts
|
|
107
|
+
var init_Icon2 = __esm({
|
|
108
|
+
"src/Icon/index.ts"() {
|
|
109
|
+
init_Icon();
|
|
110
|
+
init_IconProvider();
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
var ToastContainer, IconWrapper, ContentWrapper, Message, Description, ActionGroup, SuccessIcon, InfoIcon, ErrorIcon, WarnIcon, CloseIconSvg, Toast;
|
|
114
|
+
var init_Toast = __esm({
|
|
115
|
+
"src/Toast/Toast.tsx"() {
|
|
116
|
+
init_styled();
|
|
117
|
+
init_Icon2();
|
|
118
|
+
init_Button2();
|
|
119
|
+
init_context();
|
|
120
|
+
ToastContainer = styled.div`
|
|
121
|
+
display: inline-flex;
|
|
122
|
+
align-items: center;
|
|
123
|
+
gap: 8px;
|
|
124
|
+
border: 1px solid;
|
|
125
|
+
box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.08);
|
|
126
|
+
|
|
127
|
+
${({ theme: theme2 }) => {
|
|
128
|
+
const baseConfig = theme2.components.toast;
|
|
129
|
+
return `
|
|
130
|
+
padding: ${baseConfig.padding};
|
|
131
|
+
border-radius: ${baseConfig.borderRadius};
|
|
132
|
+
font-size: ${baseConfig.fontSize};
|
|
133
|
+
font-weight: ${baseConfig.fontWeight};
|
|
134
|
+
`;
|
|
135
|
+
}}
|
|
136
|
+
|
|
137
|
+
${({ $variant, theme: theme2 }) => {
|
|
138
|
+
const variantConfig = theme2.components.toast[$variant];
|
|
139
|
+
return `
|
|
140
|
+
background: ${variantConfig.background};
|
|
141
|
+
border-color: ${variantConfig.borderColor};
|
|
142
|
+
`;
|
|
143
|
+
}}
|
|
144
|
+
`;
|
|
145
|
+
IconWrapper = styled.div`
|
|
146
|
+
display: flex;
|
|
147
|
+
align-items: center;
|
|
148
|
+
justify-content: center;
|
|
149
|
+
flex-shrink: 0;
|
|
150
|
+
|
|
151
|
+
${({ $hasDescription }) => {
|
|
152
|
+
const size = $hasDescription ? "28px" : "18px";
|
|
153
|
+
return `
|
|
154
|
+
width: ${size};
|
|
155
|
+
height: ${size};
|
|
156
|
+
`;
|
|
157
|
+
}}
|
|
158
|
+
`;
|
|
159
|
+
ContentWrapper = styled.div`
|
|
160
|
+
display: flex;
|
|
161
|
+
flex-direction: ${({ $hasDescription }) => $hasDescription ? "column" : "row"};
|
|
162
|
+
align-items: ${({ $hasDescription }) => $hasDescription ? "flex-start" : "center"};
|
|
163
|
+
gap: ${({ $hasDescription }) => $hasDescription ? "2px" : "0"};
|
|
164
|
+
flex: 1;
|
|
165
|
+
`;
|
|
166
|
+
Message = styled.span`
|
|
167
|
+
font-size: 13px;
|
|
168
|
+
line-height: 20px;
|
|
169
|
+
color: ${({ theme: theme2 }) => theme2.colors.palettes.gray["100"]};
|
|
170
|
+
`;
|
|
171
|
+
Description = styled.span`
|
|
172
|
+
font-size: 12px;
|
|
173
|
+
line-height: 20px;
|
|
174
|
+
color: ${({ theme: theme2 }) => theme2.colors.palettes.transparency["60"]};
|
|
175
|
+
`;
|
|
176
|
+
ActionGroup = styled.div`
|
|
177
|
+
display: flex;
|
|
178
|
+
gap: 2px;
|
|
179
|
+
align-items: center;
|
|
180
|
+
`;
|
|
181
|
+
SuccessIcon = () => /* @__PURE__ */ React3.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React3.createElement("circle", { cx: "10", cy: "10", r: "8", fill: "#4ea44b" }), /* @__PURE__ */ React3.createElement("path", { d: "M6 10L9 13L14 7", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }));
|
|
182
|
+
InfoIcon = () => /* @__PURE__ */ React3.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React3.createElement("circle", { cx: "10", cy: "10", r: "8", fill: "#5ba0e7" }), /* @__PURE__ */ React3.createElement("path", { d: "M10 9V14M10 6H10.01", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }));
|
|
183
|
+
ErrorIcon = () => /* @__PURE__ */ React3.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React3.createElement("circle", { cx: "10", cy: "10", r: "8", fill: "#e95555" }), /* @__PURE__ */ React3.createElement("path", { d: "M7 7L13 13M13 7L7 13", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }));
|
|
184
|
+
WarnIcon = () => /* @__PURE__ */ React3.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React3.createElement("circle", { cx: "10", cy: "10", r: "8", fill: "#ebe361" }), /* @__PURE__ */ React3.createElement("path", { d: "M10 6V11M10 14H10.01", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }));
|
|
185
|
+
CloseIconSvg = () => /* @__PURE__ */ React3.createElement("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React3.createElement("path", { d: "M9 3L3 9M3 3L9 9", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }));
|
|
186
|
+
Toast = ({
|
|
187
|
+
variant = "info",
|
|
188
|
+
message,
|
|
189
|
+
description,
|
|
190
|
+
mainButtonText,
|
|
191
|
+
onMainButtonClick,
|
|
192
|
+
secondaryButtonText,
|
|
193
|
+
onSecondaryButtonClick,
|
|
194
|
+
closable = false,
|
|
195
|
+
onClose,
|
|
196
|
+
duration = 0,
|
|
197
|
+
icon,
|
|
198
|
+
showIcon = true,
|
|
199
|
+
className,
|
|
200
|
+
style
|
|
201
|
+
}) => {
|
|
202
|
+
const [visible, setVisible] = useState(true);
|
|
203
|
+
useEffect(() => {
|
|
204
|
+
if (duration > 0) {
|
|
205
|
+
const timer = setTimeout(() => {
|
|
206
|
+
setVisible(false);
|
|
207
|
+
onClose?.();
|
|
208
|
+
}, duration);
|
|
209
|
+
return () => clearTimeout(timer);
|
|
210
|
+
}
|
|
211
|
+
}, [duration, onClose]);
|
|
212
|
+
const handleClose = () => {
|
|
213
|
+
setVisible(false);
|
|
214
|
+
onClose?.();
|
|
215
|
+
};
|
|
216
|
+
if (!visible) {
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
const getIconElement = () => {
|
|
220
|
+
if (icon) {
|
|
221
|
+
return icon;
|
|
222
|
+
}
|
|
223
|
+
const theme2 = getGlobalTheme();
|
|
224
|
+
const themeIconUrl = theme2?.components?.toast?.[variant]?.icon?.url;
|
|
225
|
+
if (themeIconUrl) {
|
|
226
|
+
return /* @__PURE__ */ React3.createElement(Icon, { src: themeIconUrl });
|
|
227
|
+
}
|
|
228
|
+
const defaultIcons = {
|
|
229
|
+
success: /* @__PURE__ */ React3.createElement(SuccessIcon, null),
|
|
230
|
+
info: /* @__PURE__ */ React3.createElement(InfoIcon, null),
|
|
231
|
+
error: /* @__PURE__ */ React3.createElement(ErrorIcon, null),
|
|
232
|
+
warn: /* @__PURE__ */ React3.createElement(WarnIcon, null)
|
|
233
|
+
};
|
|
234
|
+
return defaultIcons[variant];
|
|
235
|
+
};
|
|
236
|
+
const iconElement = getIconElement();
|
|
237
|
+
const hasDescription = !!description;
|
|
238
|
+
const hasActions = !!(mainButtonText || secondaryButtonText || closable);
|
|
239
|
+
return /* @__PURE__ */ React3.createElement(
|
|
240
|
+
ToastContainer,
|
|
241
|
+
{
|
|
242
|
+
$variant: variant,
|
|
243
|
+
className,
|
|
244
|
+
style,
|
|
245
|
+
role: "alert",
|
|
246
|
+
"aria-live": "polite"
|
|
247
|
+
},
|
|
248
|
+
showIcon && /* @__PURE__ */ React3.createElement(IconWrapper, { $variant: variant, $hasDescription: hasDescription }, iconElement),
|
|
249
|
+
/* @__PURE__ */ React3.createElement(ContentWrapper, { $hasDescription: hasDescription }, /* @__PURE__ */ React3.createElement(Message, null, message), description && /* @__PURE__ */ React3.createElement(Description, null, description)),
|
|
250
|
+
hasActions && /* @__PURE__ */ React3.createElement(ActionGroup, null, mainButtonText && onMainButtonClick && /* @__PURE__ */ React3.createElement(
|
|
251
|
+
Button,
|
|
252
|
+
{
|
|
253
|
+
variant: "text",
|
|
254
|
+
colorType: "guidance",
|
|
255
|
+
size: "small",
|
|
256
|
+
onClick: onMainButtonClick
|
|
257
|
+
},
|
|
258
|
+
mainButtonText
|
|
259
|
+
), secondaryButtonText && onSecondaryButtonClick && /* @__PURE__ */ React3.createElement(
|
|
260
|
+
Button,
|
|
261
|
+
{
|
|
262
|
+
variant: "text",
|
|
263
|
+
colorType: "default",
|
|
264
|
+
size: "small",
|
|
265
|
+
onClick: onSecondaryButtonClick
|
|
266
|
+
},
|
|
267
|
+
secondaryButtonText
|
|
268
|
+
), closable && /* @__PURE__ */ React3.createElement(
|
|
269
|
+
Button,
|
|
270
|
+
{
|
|
271
|
+
variant: "icon",
|
|
272
|
+
colorType: "default",
|
|
273
|
+
size: "small",
|
|
274
|
+
onClick: handleClose,
|
|
275
|
+
"aria-label": "Close",
|
|
276
|
+
icon: /* @__PURE__ */ React3.createElement(CloseIconSvg, null),
|
|
277
|
+
iconBordered: false
|
|
278
|
+
}
|
|
279
|
+
))
|
|
280
|
+
);
|
|
281
|
+
};
|
|
282
|
+
Toast.displayName = "Toast";
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
// src/Toast/toastManager.tsx
|
|
287
|
+
var toastManager_exports = {};
|
|
288
|
+
__export(toastManager_exports, {
|
|
289
|
+
toast: () => toast,
|
|
290
|
+
toastManager: () => toastManager
|
|
291
|
+
});
|
|
292
|
+
var ToastWrapper, ToastManager, toastManager, toast;
|
|
293
|
+
var init_toastManager = __esm({
|
|
294
|
+
"src/Toast/toastManager.tsx"() {
|
|
295
|
+
init_Toast();
|
|
296
|
+
init_styled();
|
|
297
|
+
ToastWrapper = styled.div`
|
|
298
|
+
position: fixed;
|
|
299
|
+
z-index: 9999;
|
|
300
|
+
display: flex;
|
|
301
|
+
flex-direction: column;
|
|
302
|
+
gap: 12px;
|
|
303
|
+
pointer-events: none;
|
|
304
|
+
|
|
305
|
+
> * {
|
|
306
|
+
pointer-events: auto;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
${({ $placement, theme: theme2 }) => {
|
|
310
|
+
const offset = theme2.components?.toast?.offset || { vertical: "24px", horizontal: "24px" };
|
|
311
|
+
const vertical = offset.vertical || "24px";
|
|
312
|
+
const horizontal = offset.horizontal || "24px";
|
|
313
|
+
const styles = {
|
|
314
|
+
"top-right": `
|
|
315
|
+
top: ${vertical};
|
|
316
|
+
right: ${horizontal};
|
|
317
|
+
`,
|
|
318
|
+
"top-left": `
|
|
319
|
+
top: ${vertical};
|
|
320
|
+
left: ${horizontal};
|
|
321
|
+
`,
|
|
322
|
+
"top-center": `
|
|
323
|
+
top: ${vertical};
|
|
324
|
+
left: 50%;
|
|
325
|
+
transform: translateX(-50%);
|
|
326
|
+
`,
|
|
327
|
+
"bottom-right": `
|
|
328
|
+
bottom: ${vertical};
|
|
329
|
+
right: ${horizontal};
|
|
330
|
+
`,
|
|
331
|
+
"bottom-left": `
|
|
332
|
+
bottom: ${vertical};
|
|
333
|
+
left: ${horizontal};
|
|
334
|
+
`,
|
|
335
|
+
"bottom-center": `
|
|
336
|
+
bottom: ${vertical};
|
|
337
|
+
left: 50%;
|
|
338
|
+
transform: translateX(-50%);
|
|
339
|
+
`
|
|
340
|
+
};
|
|
341
|
+
return styles[$placement] || styles["top-right"];
|
|
342
|
+
}}
|
|
343
|
+
`;
|
|
344
|
+
ToastManager = class {
|
|
345
|
+
constructor() {
|
|
346
|
+
this.toasts = [];
|
|
347
|
+
this.container = null;
|
|
348
|
+
this.renderFunc = null;
|
|
349
|
+
this.config = {
|
|
350
|
+
placement: "top-right",
|
|
351
|
+
maxCount: 5,
|
|
352
|
+
defaultDuration: 3e3
|
|
353
|
+
};
|
|
354
|
+
this.tryGetRenderFunction();
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Try to get render function from global context
|
|
358
|
+
*/
|
|
359
|
+
tryGetRenderFunction() {
|
|
360
|
+
if (typeof window !== "undefined") {
|
|
361
|
+
Promise.resolve().then(() => (init_context(), context_exports)).then(({ getGlobalRenderFunction: getGlobalRenderFunction2 }) => {
|
|
362
|
+
const renderFunc = getGlobalRenderFunction2();
|
|
363
|
+
if (renderFunc) {
|
|
364
|
+
this.renderFunc = renderFunc;
|
|
365
|
+
}
|
|
366
|
+
}).catch(() => {
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Set render function (from registerGlobalContext)
|
|
372
|
+
*/
|
|
373
|
+
setRenderFunction(renderFunc) {
|
|
374
|
+
this.renderFunc = renderFunc;
|
|
375
|
+
}
|
|
376
|
+
/**
|
|
377
|
+
* Initialize the toast container
|
|
378
|
+
*/
|
|
379
|
+
initialize() {
|
|
380
|
+
if (this.container) return;
|
|
381
|
+
if (!this.renderFunc) {
|
|
382
|
+
console.warn("Toast render function not set. Please call registerGlobalContext first.");
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
this.container = document.createElement("div");
|
|
386
|
+
this.container.id = "officesdk-toast-container";
|
|
387
|
+
document.body.appendChild(this.container);
|
|
388
|
+
this.render();
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Render toasts to DOM
|
|
392
|
+
*/
|
|
393
|
+
render() {
|
|
394
|
+
if (!this.container || !this.renderFunc) return;
|
|
395
|
+
const element = /* @__PURE__ */ React3.createElement(React3.Fragment, null, this.toasts.map((toast2) => {
|
|
396
|
+
return /* @__PURE__ */ React3.createElement(ToastWrapper, { key: toast2.id, $placement: toast2.placement || "top-center" }, /* @__PURE__ */ React3.createElement(Toast, { ...toast2, onClose: () => this.hide(toast2.id) }));
|
|
397
|
+
}));
|
|
398
|
+
this.renderFunc(element, this.container);
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Configure toast container
|
|
402
|
+
*/
|
|
403
|
+
configure(config) {
|
|
404
|
+
this.config = { ...this.config, ...config };
|
|
405
|
+
this.render();
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Show a toast
|
|
409
|
+
*/
|
|
410
|
+
show(props) {
|
|
411
|
+
this.initialize();
|
|
412
|
+
const id = `toast-${Date.now()}-${Math.random()}`;
|
|
413
|
+
const newToast = {
|
|
414
|
+
...props,
|
|
415
|
+
id,
|
|
416
|
+
duration: props.duration ?? this.config.defaultDuration
|
|
417
|
+
};
|
|
418
|
+
this.toasts = [...this.toasts, newToast].slice(-(this.config.maxCount || 5));
|
|
419
|
+
this.render();
|
|
420
|
+
return id;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Hide a toast by id
|
|
424
|
+
*/
|
|
425
|
+
hide(id) {
|
|
426
|
+
this.toasts = this.toasts.filter((toast2) => toast2.id !== id);
|
|
427
|
+
this.render();
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Hide all toasts
|
|
431
|
+
*/
|
|
432
|
+
hideAll() {
|
|
433
|
+
this.toasts = [];
|
|
434
|
+
this.render();
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Show success toast
|
|
438
|
+
*/
|
|
439
|
+
success(message, options) {
|
|
440
|
+
return this.show({ ...options, variant: "success", message });
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
443
|
+
* Show info toast
|
|
444
|
+
*/
|
|
445
|
+
info(message, options) {
|
|
446
|
+
return this.show({ ...options, variant: "info", message });
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* Show error toast
|
|
450
|
+
*/
|
|
451
|
+
error(message, options) {
|
|
452
|
+
return this.show({ ...options, variant: "error", message });
|
|
453
|
+
}
|
|
454
|
+
/**
|
|
455
|
+
* Show warning toast
|
|
456
|
+
*/
|
|
457
|
+
warn(message, options) {
|
|
458
|
+
return this.show({ ...options, variant: "warn", message });
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Destroy the toast container
|
|
462
|
+
*/
|
|
463
|
+
destroy() {
|
|
464
|
+
if (this.container) {
|
|
465
|
+
if (this.renderFunc) {
|
|
466
|
+
this.renderFunc(/* @__PURE__ */ React3.createElement(React3.Fragment, null), this.container);
|
|
467
|
+
}
|
|
468
|
+
if (this.container.parentNode) {
|
|
469
|
+
this.container.parentNode.removeChild(this.container);
|
|
470
|
+
}
|
|
471
|
+
this.container = null;
|
|
472
|
+
}
|
|
473
|
+
this.toasts = [];
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Get current toasts
|
|
477
|
+
*/
|
|
478
|
+
getToasts() {
|
|
479
|
+
return this.toasts;
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Clear all toasts (for testing)
|
|
483
|
+
*/
|
|
484
|
+
clear() {
|
|
485
|
+
this.toasts = [];
|
|
486
|
+
this.render();
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
toastManager = new ToastManager();
|
|
490
|
+
toast = {
|
|
491
|
+
configure: (config) => toastManager.configure(config),
|
|
492
|
+
show: (props) => toastManager.show(props),
|
|
493
|
+
hide: (id) => toastManager.hide(id),
|
|
494
|
+
hideAll: () => toastManager.hideAll(),
|
|
495
|
+
success: (message, options) => toastManager.success(message, options),
|
|
496
|
+
info: (message, options) => toastManager.info(message, options),
|
|
497
|
+
error: (message, options) => toastManager.error(message, options),
|
|
498
|
+
warn: (message, options) => toastManager.warn(message, options),
|
|
499
|
+
destroy: () => toastManager.destroy()
|
|
44
500
|
};
|
|
45
501
|
}
|
|
46
502
|
});
|
|
47
|
-
var styled = styledWithBase;
|
|
48
503
|
|
|
49
|
-
// src/
|
|
50
|
-
var
|
|
504
|
+
// src/utils/context.ts
|
|
505
|
+
var context_exports = {};
|
|
506
|
+
__export(context_exports, {
|
|
507
|
+
getGlobalRenderFunction: () => getGlobalRenderFunction,
|
|
508
|
+
getGlobalTheme: () => getGlobalTheme,
|
|
509
|
+
registerGlobalContext: () => registerGlobalContext
|
|
510
|
+
});
|
|
511
|
+
var globalTheme, registerGlobalTheme, getGlobalTheme, globalRenderFunction, getGlobalRenderFunction, registerGlobalContext;
|
|
512
|
+
var init_context = __esm({
|
|
513
|
+
"src/utils/context.ts"() {
|
|
514
|
+
globalTheme = {};
|
|
515
|
+
registerGlobalTheme = (theme2) => {
|
|
516
|
+
Object.assign(globalTheme, { ...globalTheme, ...theme2 });
|
|
517
|
+
};
|
|
518
|
+
getGlobalTheme = () => {
|
|
519
|
+
return globalTheme;
|
|
520
|
+
};
|
|
521
|
+
globalRenderFunction = null;
|
|
522
|
+
getGlobalRenderFunction = () => globalRenderFunction;
|
|
523
|
+
registerGlobalContext = (context) => {
|
|
524
|
+
if (context.theme) {
|
|
525
|
+
registerGlobalTheme(context.theme);
|
|
526
|
+
}
|
|
527
|
+
if (context.render) {
|
|
528
|
+
globalRenderFunction = context.render;
|
|
529
|
+
if (typeof window !== "undefined") {
|
|
530
|
+
setTimeout(() => {
|
|
531
|
+
Promise.resolve().then(() => (init_toastManager(), toastManager_exports)).then(({ toastManager: toastManager2 }) => {
|
|
532
|
+
toastManager2.setRenderFunction(context.render);
|
|
533
|
+
}).catch(() => {
|
|
534
|
+
});
|
|
535
|
+
}, 0);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
var wrapWithTheme, styledFunction, styledWithBase, styled;
|
|
542
|
+
var init_styled = __esm({
|
|
543
|
+
"src/utils/styled.ts"() {
|
|
544
|
+
init_context();
|
|
545
|
+
wrapWithTheme = (component) => {
|
|
546
|
+
if (component && typeof component === "object") {
|
|
547
|
+
component.defaultProps = {
|
|
548
|
+
...component.defaultProps,
|
|
549
|
+
get theme() {
|
|
550
|
+
return getGlobalTheme();
|
|
551
|
+
}
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
return component;
|
|
555
|
+
};
|
|
556
|
+
styledFunction = (tag) => {
|
|
557
|
+
return wrapWithTheme(baseStyled(tag));
|
|
558
|
+
};
|
|
559
|
+
styledWithBase = Object.assign(styledFunction, baseStyled);
|
|
560
|
+
Object.keys(baseStyled).forEach((key) => {
|
|
561
|
+
const originalMethod = baseStyled[key];
|
|
562
|
+
if (typeof originalMethod === "function") {
|
|
563
|
+
styledWithBase[key] = (...args) => {
|
|
564
|
+
const component = originalMethod(...args);
|
|
565
|
+
return wrapWithTheme(component);
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
styled = styledWithBase;
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
var IconWrapper2, TextWrapper, IconOnlyWrapper, StyledButton, Button;
|
|
573
|
+
var init_Button = __esm({
|
|
574
|
+
"src/Button/Button.tsx"() {
|
|
575
|
+
init_styled();
|
|
576
|
+
init_Icon2();
|
|
577
|
+
IconWrapper2 = styled.span`
|
|
51
578
|
display: inline-flex;
|
|
52
579
|
align-items: center;
|
|
53
580
|
justify-content: center;
|
|
54
581
|
flex-shrink: 0;
|
|
55
582
|
|
|
56
|
-
${({ $size, $
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
583
|
+
${({ $size, $iconPlacement, theme: theme2 }) => {
|
|
584
|
+
const buttonConfig = theme2.components.button[$size || "medium"];
|
|
585
|
+
const sizeConfig = buttonConfig?.withIcon || buttonConfig;
|
|
586
|
+
const marginSide = $iconPlacement === "before" ? "margin-right" : "margin-left";
|
|
587
|
+
return `
|
|
60
588
|
width: ${sizeConfig.iconSize.width};
|
|
61
589
|
height: ${sizeConfig.iconSize.height};
|
|
62
590
|
${marginSide}: ${sizeConfig.iconGap};
|
|
@@ -67,9 +595,39 @@ var IconWrapper = styled.span`
|
|
|
67
595
|
display: block;
|
|
68
596
|
}
|
|
69
597
|
`;
|
|
70
|
-
}}
|
|
598
|
+
}}
|
|
599
|
+
`;
|
|
600
|
+
TextWrapper = styled.span`
|
|
601
|
+
${({ $size, theme: theme2 }) => {
|
|
602
|
+
const buttonConfig = theme2.components.button[$size || "medium"];
|
|
603
|
+
const sizeConfig = buttonConfig?.withIcon || buttonConfig;
|
|
604
|
+
return `
|
|
605
|
+
padding: ${sizeConfig.textPadding || "0"};
|
|
606
|
+
`;
|
|
607
|
+
}}
|
|
71
608
|
`;
|
|
72
|
-
|
|
609
|
+
IconOnlyWrapper = styled.span`
|
|
610
|
+
display: inline-flex;
|
|
611
|
+
align-items: center;
|
|
612
|
+
justify-content: center;
|
|
613
|
+
flex-shrink: 0;
|
|
614
|
+
|
|
615
|
+
${({ $size, theme: theme2 }) => {
|
|
616
|
+
const buttonConfig = theme2.components.button[$size || "medium"];
|
|
617
|
+
const sizeConfig = buttonConfig?.onlyIcon || buttonConfig;
|
|
618
|
+
return `
|
|
619
|
+
width: ${sizeConfig.iconSize?.width || "14px"};
|
|
620
|
+
height: ${sizeConfig.iconSize?.height || "14px"};
|
|
621
|
+
|
|
622
|
+
svg, img {
|
|
623
|
+
width: 100%;
|
|
624
|
+
height: 100%;
|
|
625
|
+
display: block;
|
|
626
|
+
}
|
|
627
|
+
`;
|
|
628
|
+
}}
|
|
629
|
+
`;
|
|
630
|
+
StyledButton = styled.button`
|
|
73
631
|
display: inline-flex;
|
|
74
632
|
align-items: center;
|
|
75
633
|
justify-content: center;
|
|
@@ -79,31 +637,32 @@ var StyledButton = styled.button`
|
|
|
79
637
|
width: ${({ $fullWidth }) => $fullWidth ? "100%" : "auto"};
|
|
80
638
|
|
|
81
639
|
/* Size variants */
|
|
82
|
-
${({ $size, $
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
border-radius: ${
|
|
640
|
+
${({ $size, $variant, theme: theme2 }) => {
|
|
641
|
+
const sizeName = $size || "medium";
|
|
642
|
+
const buttonConfig = theme2.components.button[sizeName];
|
|
643
|
+
if ($variant === "icon") {
|
|
644
|
+
const sizeConfig2 = buttonConfig?.onlyIcon || buttonConfig;
|
|
645
|
+
return `
|
|
646
|
+
padding: ${sizeConfig2.padding || "7px"};
|
|
647
|
+
border-radius: ${sizeConfig2.borderRadius || theme2.borderRadius.small};
|
|
90
648
|
`;
|
|
91
|
-
|
|
92
|
-
|
|
649
|
+
}
|
|
650
|
+
const sizeConfig = buttonConfig?.withIcon || buttonConfig;
|
|
651
|
+
return `
|
|
93
652
|
padding: ${sizeConfig.padding};
|
|
94
653
|
font-size: ${sizeConfig.fontSize};
|
|
95
654
|
line-height: ${sizeConfig.lineHeight};
|
|
96
655
|
border-radius: ${sizeConfig.borderRadius};
|
|
97
656
|
min-height: ${sizeConfig.height};
|
|
98
657
|
`;
|
|
99
|
-
}}
|
|
658
|
+
}}
|
|
100
659
|
|
|
101
660
|
/* Variant and color type styles */
|
|
102
|
-
${({ $variant, $colorType, $
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
661
|
+
${({ $variant, $colorType, $iconBordered, theme: theme2 }) => {
|
|
662
|
+
if ($variant === "icon") {
|
|
663
|
+
const baseVariant = $iconBordered ? "outlined" : "text";
|
|
664
|
+
const styles2 = theme2.components.button[baseVariant]["default"];
|
|
665
|
+
return `
|
|
107
666
|
background: ${styles2.background};
|
|
108
667
|
color: ${styles2.color};
|
|
109
668
|
border: 1px solid ${styles2.borderColor};
|
|
@@ -131,17 +690,17 @@ var StyledButton = styled.button`
|
|
|
131
690
|
cursor: not-allowed;
|
|
132
691
|
}
|
|
133
692
|
`;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
693
|
+
}
|
|
694
|
+
const variant = $variant || "solid";
|
|
695
|
+
const colorType = $colorType || "default";
|
|
696
|
+
if (colorType === "status" && variant !== "text") {
|
|
697
|
+
console.warn(
|
|
698
|
+
`colorType 'status' is only available for 'text' variant. Falling back to 'default'.`
|
|
699
|
+
);
|
|
700
|
+
}
|
|
701
|
+
const effectiveColorType = colorType === "status" && variant !== "text" ? "default" : colorType;
|
|
702
|
+
const styles = theme2.components.button[variant][effectiveColorType];
|
|
703
|
+
return `
|
|
145
704
|
background: ${styles.background};
|
|
146
705
|
color: ${styles.color};
|
|
147
706
|
border: 1px solid ${styles.borderColor};
|
|
@@ -170,40 +729,46 @@ var StyledButton = styled.button`
|
|
|
170
729
|
cursor: not-allowed;
|
|
171
730
|
}
|
|
172
731
|
`;
|
|
173
|
-
}}
|
|
732
|
+
}}
|
|
174
733
|
`;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
...rest
|
|
187
|
-
}) => {
|
|
188
|
-
const isIconOnly = variant === "icon" || !children && !!(iconBefore || iconAfter);
|
|
189
|
-
const iconOnlyContent = iconBefore || iconAfter;
|
|
190
|
-
return /* @__PURE__ */ React12.createElement(
|
|
191
|
-
StyledButton,
|
|
192
|
-
{
|
|
193
|
-
$variant: variant,
|
|
194
|
-
$colorType: colorType,
|
|
195
|
-
$size: size,
|
|
196
|
-
$fullWidth: fullWidth,
|
|
197
|
-
$isIconOnly: isIconOnly,
|
|
198
|
-
$iconBordered: iconBordered,
|
|
199
|
-
disabled: disabled || loading,
|
|
734
|
+
Button = ({
|
|
735
|
+
variant = "solid",
|
|
736
|
+
colorType = "default",
|
|
737
|
+
size = "medium",
|
|
738
|
+
disabled = false,
|
|
739
|
+
loading = false,
|
|
740
|
+
fullWidth = false,
|
|
741
|
+
icon,
|
|
742
|
+
iconPlacement = "before",
|
|
743
|
+
iconBordered = false,
|
|
744
|
+
children,
|
|
200
745
|
...rest
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
746
|
+
}) => {
|
|
747
|
+
return /* @__PURE__ */ React3.createElement(
|
|
748
|
+
StyledButton,
|
|
749
|
+
{
|
|
750
|
+
$variant: variant,
|
|
751
|
+
$colorType: colorType,
|
|
752
|
+
$size: size,
|
|
753
|
+
$fullWidth: fullWidth,
|
|
754
|
+
$iconBordered: iconBordered,
|
|
755
|
+
disabled: disabled || loading,
|
|
756
|
+
...rest
|
|
757
|
+
},
|
|
758
|
+
loading ? /* @__PURE__ */ React3.createElement(TextWrapper, { $size: size }, "Loading...") : variant === "icon" ? (
|
|
759
|
+
// Icon variant: render icon with onlyIcon wrapper (uses onlyIcon config)
|
|
760
|
+
/* @__PURE__ */ React3.createElement(IconOnlyWrapper, { $size: size }, typeof icon === "string" ? /* @__PURE__ */ React3.createElement(Icon, { src: icon }) : icon || children)
|
|
761
|
+
) : /* @__PURE__ */ React3.createElement(React3.Fragment, null, icon && iconPlacement === "before" && /* @__PURE__ */ React3.createElement(IconWrapper2, { $size: size, $iconPlacement: "before" }, typeof icon === "string" ? /* @__PURE__ */ React3.createElement(Icon, { src: icon }) : icon), /* @__PURE__ */ React3.createElement(TextWrapper, { $size: size }, children), icon && iconPlacement === "after" && /* @__PURE__ */ React3.createElement(IconWrapper2, { $size: size, $iconPlacement: "after" }, typeof icon === "string" ? /* @__PURE__ */ React3.createElement(Icon, { src: icon }) : icon))
|
|
762
|
+
);
|
|
763
|
+
};
|
|
764
|
+
Button.displayName = "Button";
|
|
765
|
+
}
|
|
766
|
+
});
|
|
767
|
+
var SliderContainer, SliderTrack, SliderFill, SliderThumb, Slider;
|
|
768
|
+
var init_Slider = __esm({
|
|
769
|
+
"src/Slider/Slider.tsx"() {
|
|
770
|
+
init_styled();
|
|
771
|
+
SliderContainer = styled.div`
|
|
207
772
|
position: relative;
|
|
208
773
|
display: flex;
|
|
209
774
|
align-items: center;
|
|
@@ -212,7 +777,7 @@ var SliderContainer = styled.div`
|
|
|
212
777
|
cursor: ${({ $disabled }) => $disabled ? "not-allowed" : "pointer"};
|
|
213
778
|
user-select: none;
|
|
214
779
|
`;
|
|
215
|
-
|
|
780
|
+
SliderTrack = styled.div`
|
|
216
781
|
position: absolute;
|
|
217
782
|
left: 0;
|
|
218
783
|
right: 0;
|
|
@@ -222,7 +787,7 @@ var SliderTrack = styled.div`
|
|
|
222
787
|
top: 50%;
|
|
223
788
|
transform: translateY(-50%);
|
|
224
789
|
`;
|
|
225
|
-
|
|
790
|
+
SliderFill = styled.div`
|
|
226
791
|
position: absolute;
|
|
227
792
|
left: 0;
|
|
228
793
|
height: 2px;
|
|
@@ -232,7 +797,7 @@ var SliderFill = styled.div`
|
|
|
232
797
|
width: ${({ $percentage }) => $percentage}%;
|
|
233
798
|
background: ${({ $disabled, theme: theme2 }) => $disabled ? theme2.colors.palettes.transparency["10"] : theme2.colors.palettes.gray["100"]};
|
|
234
799
|
`;
|
|
235
|
-
|
|
800
|
+
SliderThumb = styled.div`
|
|
236
801
|
position: absolute;
|
|
237
802
|
width: 10px;
|
|
238
803
|
height: 10px;
|
|
@@ -256,131 +821,144 @@ var SliderThumb = styled.div`
|
|
|
256
821
|
}
|
|
257
822
|
`}
|
|
258
823
|
`;
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
className,
|
|
270
|
-
style
|
|
271
|
-
}) => {
|
|
272
|
-
const [internalValue, setInternalValue] = useState(
|
|
273
|
-
controlledValue ?? defaultValue
|
|
274
|
-
);
|
|
275
|
-
const [isDragging, setIsDragging] = useState(false);
|
|
276
|
-
const containerRef = useRef(null);
|
|
277
|
-
const value = controlledValue !== void 0 ? controlledValue : internalValue;
|
|
278
|
-
const percentage = (value - min) / (max - min) * 100;
|
|
279
|
-
const updateValue = useCallback(
|
|
280
|
-
(clientX) => {
|
|
281
|
-
if (!containerRef.current || disabled) return;
|
|
282
|
-
const rect = containerRef.current.getBoundingClientRect();
|
|
283
|
-
const offsetX = clientX - rect.left;
|
|
284
|
-
const newPercentage = Math.max(0, Math.min(100, offsetX / rect.width * 100));
|
|
285
|
-
const rawValue = newPercentage / 100 * (max - min) + min;
|
|
286
|
-
const steppedValue = Math.round(rawValue / step) * step;
|
|
287
|
-
const clampedValue = Math.max(min, Math.min(max, steppedValue));
|
|
288
|
-
if (controlledValue === void 0) {
|
|
289
|
-
setInternalValue(clampedValue);
|
|
290
|
-
}
|
|
291
|
-
onChange?.(clampedValue);
|
|
292
|
-
},
|
|
293
|
-
[min, max, step, disabled, controlledValue, onChange]
|
|
294
|
-
);
|
|
295
|
-
const handleMouseDown = useCallback(
|
|
296
|
-
(e) => {
|
|
297
|
-
if (disabled) return;
|
|
298
|
-
e.preventDefault();
|
|
299
|
-
setIsDragging(true);
|
|
300
|
-
onDragStart?.();
|
|
301
|
-
updateValue(e.clientX);
|
|
302
|
-
},
|
|
303
|
-
[disabled, onDragStart, updateValue]
|
|
304
|
-
);
|
|
305
|
-
useEffect(() => {
|
|
306
|
-
if (!isDragging) return;
|
|
307
|
-
const handleMouseMove = (e) => {
|
|
308
|
-
updateValue(e.clientX);
|
|
309
|
-
};
|
|
310
|
-
const handleMouseUp = () => {
|
|
311
|
-
setIsDragging(false);
|
|
312
|
-
onDragEnd?.();
|
|
313
|
-
};
|
|
314
|
-
document.addEventListener("mousemove", handleMouseMove);
|
|
315
|
-
document.addEventListener("mouseup", handleMouseUp);
|
|
316
|
-
return () => {
|
|
317
|
-
document.removeEventListener("mousemove", handleMouseMove);
|
|
318
|
-
document.removeEventListener("mouseup", handleMouseUp);
|
|
319
|
-
};
|
|
320
|
-
}, [isDragging, updateValue, onDragEnd]);
|
|
321
|
-
const handleKeyDown = useCallback(
|
|
322
|
-
(e) => {
|
|
323
|
-
if (disabled) return;
|
|
324
|
-
let newValue = value;
|
|
325
|
-
switch (e.key) {
|
|
326
|
-
case "ArrowLeft":
|
|
327
|
-
case "ArrowDown":
|
|
328
|
-
e.preventDefault();
|
|
329
|
-
newValue = Math.max(min, value - step);
|
|
330
|
-
break;
|
|
331
|
-
case "ArrowRight":
|
|
332
|
-
case "ArrowUp":
|
|
333
|
-
e.preventDefault();
|
|
334
|
-
newValue = Math.min(max, value + step);
|
|
335
|
-
break;
|
|
336
|
-
case "Home":
|
|
337
|
-
e.preventDefault();
|
|
338
|
-
newValue = min;
|
|
339
|
-
break;
|
|
340
|
-
case "End":
|
|
341
|
-
e.preventDefault();
|
|
342
|
-
newValue = max;
|
|
343
|
-
break;
|
|
344
|
-
default:
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
|
-
if (controlledValue === void 0) {
|
|
348
|
-
setInternalValue(newValue);
|
|
349
|
-
}
|
|
350
|
-
onChange?.(newValue);
|
|
351
|
-
},
|
|
352
|
-
[disabled, value, min, max, step, controlledValue, onChange]
|
|
353
|
-
);
|
|
354
|
-
return /* @__PURE__ */ React12.createElement(
|
|
355
|
-
SliderContainer,
|
|
356
|
-
{
|
|
357
|
-
ref: containerRef,
|
|
358
|
-
$disabled: disabled,
|
|
824
|
+
Slider = ({
|
|
825
|
+
value: controlledValue,
|
|
826
|
+
defaultValue = 0,
|
|
827
|
+
min = 0,
|
|
828
|
+
max = 100,
|
|
829
|
+
step = 1,
|
|
830
|
+
disabled = false,
|
|
831
|
+
onChange,
|
|
832
|
+
onDragStart,
|
|
833
|
+
onDragEnd,
|
|
359
834
|
className,
|
|
360
|
-
style
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
835
|
+
style
|
|
836
|
+
}) => {
|
|
837
|
+
const [internalValue, setInternalValue] = useState(
|
|
838
|
+
controlledValue ?? defaultValue
|
|
839
|
+
);
|
|
840
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
841
|
+
const containerRef = useRef(null);
|
|
842
|
+
const value = controlledValue !== void 0 ? controlledValue : internalValue;
|
|
843
|
+
const percentage = (value - min) / (max - min) * 100;
|
|
844
|
+
const updateValue = useCallback(
|
|
845
|
+
(clientX) => {
|
|
846
|
+
if (!containerRef.current || disabled) return;
|
|
847
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
848
|
+
const offsetX = clientX - rect.left;
|
|
849
|
+
const newPercentage = Math.max(0, Math.min(100, offsetX / rect.width * 100));
|
|
850
|
+
const rawValue = newPercentage / 100 * (max - min) + min;
|
|
851
|
+
const steppedValue = Math.round(rawValue / step) * step;
|
|
852
|
+
const clampedValue = Math.max(min, Math.min(max, steppedValue));
|
|
853
|
+
if (controlledValue === void 0) {
|
|
854
|
+
setInternalValue(clampedValue);
|
|
855
|
+
}
|
|
856
|
+
onChange?.(clampedValue);
|
|
857
|
+
},
|
|
858
|
+
[min, max, step, disabled, controlledValue, onChange]
|
|
859
|
+
);
|
|
860
|
+
const handleMouseDown = useCallback(
|
|
861
|
+
(e) => {
|
|
862
|
+
if (disabled) return;
|
|
863
|
+
e.preventDefault();
|
|
864
|
+
setIsDragging(true);
|
|
865
|
+
onDragStart?.();
|
|
866
|
+
updateValue(e.clientX);
|
|
867
|
+
},
|
|
868
|
+
[disabled, onDragStart, updateValue]
|
|
869
|
+
);
|
|
870
|
+
useEffect(() => {
|
|
871
|
+
if (!isDragging) return;
|
|
872
|
+
const handleMouseMove = (e) => {
|
|
873
|
+
updateValue(e.clientX);
|
|
874
|
+
};
|
|
875
|
+
const handleMouseUp = () => {
|
|
876
|
+
setIsDragging(false);
|
|
877
|
+
onDragEnd?.();
|
|
878
|
+
};
|
|
879
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
880
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
881
|
+
return () => {
|
|
882
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
883
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
884
|
+
};
|
|
885
|
+
}, [isDragging, updateValue, onDragEnd]);
|
|
886
|
+
const handleKeyDown = useCallback(
|
|
887
|
+
(e) => {
|
|
888
|
+
if (disabled) return;
|
|
889
|
+
let newValue = value;
|
|
890
|
+
switch (e.key) {
|
|
891
|
+
case "ArrowLeft":
|
|
892
|
+
case "ArrowDown":
|
|
893
|
+
e.preventDefault();
|
|
894
|
+
newValue = Math.max(min, value - step);
|
|
895
|
+
break;
|
|
896
|
+
case "ArrowRight":
|
|
897
|
+
case "ArrowUp":
|
|
898
|
+
e.preventDefault();
|
|
899
|
+
newValue = Math.min(max, value + step);
|
|
900
|
+
break;
|
|
901
|
+
case "Home":
|
|
902
|
+
e.preventDefault();
|
|
903
|
+
newValue = min;
|
|
904
|
+
break;
|
|
905
|
+
case "End":
|
|
906
|
+
e.preventDefault();
|
|
907
|
+
newValue = max;
|
|
908
|
+
break;
|
|
909
|
+
default:
|
|
910
|
+
return;
|
|
911
|
+
}
|
|
912
|
+
if (controlledValue === void 0) {
|
|
913
|
+
setInternalValue(newValue);
|
|
914
|
+
}
|
|
915
|
+
onChange?.(newValue);
|
|
916
|
+
},
|
|
917
|
+
[disabled, value, min, max, step, controlledValue, onChange]
|
|
918
|
+
);
|
|
919
|
+
return /* @__PURE__ */ React3.createElement(
|
|
920
|
+
SliderContainer,
|
|
921
|
+
{
|
|
922
|
+
ref: containerRef,
|
|
923
|
+
$disabled: disabled,
|
|
924
|
+
className,
|
|
925
|
+
style,
|
|
926
|
+
onMouseDown: handleMouseDown,
|
|
927
|
+
onKeyDown: handleKeyDown,
|
|
928
|
+
tabIndex: disabled ? -1 : 0,
|
|
929
|
+
role: "slider",
|
|
930
|
+
"aria-valuemin": min,
|
|
931
|
+
"aria-valuemax": max,
|
|
932
|
+
"aria-valuenow": value,
|
|
933
|
+
"aria-disabled": disabled
|
|
934
|
+
},
|
|
935
|
+
/* @__PURE__ */ React3.createElement(SliderTrack, { $disabled: disabled }),
|
|
936
|
+
/* @__PURE__ */ React3.createElement(SliderFill, { $percentage: percentage, $disabled: disabled }),
|
|
937
|
+
/* @__PURE__ */ React3.createElement(
|
|
938
|
+
SliderThumb,
|
|
939
|
+
{
|
|
940
|
+
$percentage: percentage,
|
|
941
|
+
$disabled: disabled,
|
|
942
|
+
$isDragging: isDragging
|
|
943
|
+
}
|
|
944
|
+
)
|
|
945
|
+
);
|
|
946
|
+
};
|
|
947
|
+
Slider.displayName = "Slider";
|
|
948
|
+
}
|
|
949
|
+
});
|
|
950
|
+
|
|
951
|
+
// src/Slider/index.ts
|
|
952
|
+
var init_Slider2 = __esm({
|
|
953
|
+
"src/Slider/index.ts"() {
|
|
954
|
+
init_Slider();
|
|
955
|
+
}
|
|
956
|
+
});
|
|
957
|
+
var NumberInputContainer, InputWrapper, UnitText, StyledInput, ButtonGroup, StepButton, UpArrow, DownArrow, NumberInput;
|
|
958
|
+
var init_NumberInput = __esm({
|
|
959
|
+
"src/NumberInput/NumberInput.tsx"() {
|
|
960
|
+
init_styled();
|
|
961
|
+
NumberInputContainer = styled.div`
|
|
384
962
|
display: inline-flex;
|
|
385
963
|
align-items: center;
|
|
386
964
|
background: white;
|
|
@@ -397,24 +975,24 @@ var NumberInputContainer = styled.div`
|
|
|
397
975
|
`}
|
|
398
976
|
|
|
399
977
|
${({ $disabled, $alert, $isFocused, theme: theme2 }) => {
|
|
400
|
-
|
|
401
|
-
|
|
978
|
+
if ($disabled) {
|
|
979
|
+
return `
|
|
402
980
|
border-color: ${theme2.colors.palettes.transparency["10"]};
|
|
403
981
|
cursor: not-allowed;
|
|
404
982
|
`;
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
983
|
+
}
|
|
984
|
+
if ($alert) {
|
|
985
|
+
return `
|
|
408
986
|
border-color: ${theme2.colors.palettes.red["6"]};
|
|
409
987
|
`;
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
988
|
+
}
|
|
989
|
+
if ($isFocused) {
|
|
990
|
+
return `
|
|
413
991
|
border-color: ${theme2.colors.palettes.transparency["30"]};
|
|
414
992
|
box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.04);
|
|
415
993
|
`;
|
|
416
|
-
|
|
417
|
-
|
|
994
|
+
}
|
|
995
|
+
return `
|
|
418
996
|
border-color: ${theme2.colors.palettes.transparency["10"]};
|
|
419
997
|
|
|
420
998
|
&:hover {
|
|
@@ -422,9 +1000,9 @@ var NumberInputContainer = styled.div`
|
|
|
422
1000
|
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.04);
|
|
423
1001
|
}
|
|
424
1002
|
`;
|
|
425
|
-
}}
|
|
1003
|
+
}}
|
|
426
1004
|
`;
|
|
427
|
-
|
|
1005
|
+
InputWrapper = styled.div`
|
|
428
1006
|
flex: 1;
|
|
429
1007
|
display: flex;
|
|
430
1008
|
align-items: center;
|
|
@@ -432,7 +1010,7 @@ var InputWrapper = styled.div`
|
|
|
432
1010
|
min-width: 0;
|
|
433
1011
|
gap: 4px;
|
|
434
1012
|
`;
|
|
435
|
-
|
|
1013
|
+
UnitText = styled.span`
|
|
436
1014
|
flex-shrink: 0;
|
|
437
1015
|
font-family: 'PingFang SC', sans-serif;
|
|
438
1016
|
font-weight: 400;
|
|
@@ -450,7 +1028,7 @@ var UnitText = styled.span`
|
|
|
450
1028
|
color: ${theme2.colors.palettes.gray["120"]};
|
|
451
1029
|
`}
|
|
452
1030
|
`;
|
|
453
|
-
|
|
1031
|
+
StyledInput = styled.input`
|
|
454
1032
|
width: 100%;
|
|
455
1033
|
border: none;
|
|
456
1034
|
outline: none;
|
|
@@ -490,7 +1068,7 @@ var StyledInput = styled.input`
|
|
|
490
1068
|
-moz-appearance: textfield;
|
|
491
1069
|
}
|
|
492
1070
|
`;
|
|
493
|
-
|
|
1071
|
+
ButtonGroup = styled.div`
|
|
494
1072
|
display: flex;
|
|
495
1073
|
flex-direction: column;
|
|
496
1074
|
height: 100%;
|
|
@@ -498,16 +1076,16 @@ var ButtonGroup = styled.div`
|
|
|
498
1076
|
flex-shrink: 0;
|
|
499
1077
|
|
|
500
1078
|
${({ $disabled, $alert, theme: theme2 }) => {
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
}}
|
|
1079
|
+
if ($disabled) {
|
|
1080
|
+
return `border-color: ${theme2.colors.palettes.transparency["10"]};`;
|
|
1081
|
+
}
|
|
1082
|
+
if ($alert) {
|
|
1083
|
+
return `border-color: ${theme2.colors.palettes.red["6"]};`;
|
|
1084
|
+
}
|
|
1085
|
+
return `border-color: ${theme2.colors.palettes.transparency["10"]};`;
|
|
1086
|
+
}}
|
|
509
1087
|
`;
|
|
510
|
-
|
|
1088
|
+
StepButton = styled.button`
|
|
511
1089
|
flex: 1 1 50%;
|
|
512
1090
|
display: flex;
|
|
513
1091
|
align-items: center;
|
|
@@ -521,22 +1099,22 @@ var StepButton = styled.button`
|
|
|
521
1099
|
overflow: hidden;
|
|
522
1100
|
|
|
523
1101
|
${({ $position, $alert, $disabled, theme: theme2 }) => {
|
|
524
|
-
|
|
525
|
-
|
|
1102
|
+
if ($position === "up") {
|
|
1103
|
+
return `
|
|
526
1104
|
border-bottom: 1px solid ${$disabled ? theme2.colors.palettes.transparency["10"] : $alert ? theme2.colors.palettes.red["6"] : theme2.colors.palettes.transparency["10"]};
|
|
527
1105
|
`;
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
}}
|
|
1106
|
+
}
|
|
1107
|
+
return "";
|
|
1108
|
+
}}
|
|
531
1109
|
|
|
532
1110
|
${({ $disabled, theme: theme2 }) => {
|
|
533
|
-
|
|
534
|
-
|
|
1111
|
+
if ($disabled) {
|
|
1112
|
+
return `
|
|
535
1113
|
cursor: not-allowed;
|
|
536
1114
|
opacity: 0.4;
|
|
537
1115
|
`;
|
|
538
|
-
|
|
539
|
-
|
|
1116
|
+
}
|
|
1117
|
+
return `
|
|
540
1118
|
&:hover {
|
|
541
1119
|
background-color: ${theme2.colors.palettes.transparency["5"]};
|
|
542
1120
|
}
|
|
@@ -545,7 +1123,7 @@ var StepButton = styled.button`
|
|
|
545
1123
|
background-color: ${theme2.colors.palettes.transparency["10"]};
|
|
546
1124
|
}
|
|
547
1125
|
`;
|
|
548
|
-
}}
|
|
1126
|
+
}}
|
|
549
1127
|
|
|
550
1128
|
svg {
|
|
551
1129
|
width: 14px;
|
|
@@ -553,173 +1131,186 @@ var StepButton = styled.button`
|
|
|
553
1131
|
fill: ${({ $disabled, theme: theme2 }) => $disabled ? theme2.colors.palettes.transparency["30"] : theme2.colors.palettes.gray["120"]};
|
|
554
1132
|
}
|
|
555
1133
|
`;
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
className,
|
|
573
|
-
style
|
|
574
|
-
}) => {
|
|
575
|
-
const [internalValue, setInternalValue] = useState(controlledValue ?? defaultValue);
|
|
576
|
-
const [displayValue, setDisplayValue] = useState("");
|
|
577
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
578
|
-
const inputRef = useRef(null);
|
|
579
|
-
const value = controlledValue !== void 0 ? controlledValue : internalValue;
|
|
580
|
-
const formatValue = useCallback(
|
|
581
|
-
(val) => {
|
|
582
|
-
if (formatter) {
|
|
583
|
-
return formatter(val);
|
|
584
|
-
}
|
|
585
|
-
if (precision !== void 0) {
|
|
586
|
-
return val.toFixed(precision);
|
|
587
|
-
}
|
|
588
|
-
return String(val);
|
|
589
|
-
},
|
|
590
|
-
[formatter, precision]
|
|
591
|
-
);
|
|
592
|
-
const parseValue = useCallback(
|
|
593
|
-
(displayVal) => {
|
|
594
|
-
if (parser) {
|
|
595
|
-
return parser(displayVal);
|
|
596
|
-
}
|
|
597
|
-
const parsed = parseFloat(displayVal);
|
|
598
|
-
return isNaN(parsed) ? null : parsed;
|
|
599
|
-
},
|
|
600
|
-
[parser]
|
|
601
|
-
);
|
|
602
|
-
useEffect(() => {
|
|
603
|
-
if (!isFocused) {
|
|
604
|
-
setDisplayValue(formatValue(value));
|
|
605
|
-
}
|
|
606
|
-
}, [value, isFocused, formatValue]);
|
|
607
|
-
const clampValue = useCallback(
|
|
608
|
-
(val) => {
|
|
609
|
-
return Math.max(min, Math.min(max, val));
|
|
610
|
-
},
|
|
611
|
-
[min, max]
|
|
612
|
-
);
|
|
613
|
-
const handleValueChange = useCallback(
|
|
614
|
-
(newValue) => {
|
|
615
|
-
const clampedValue = clampValue(newValue);
|
|
616
|
-
if (controlledValue === void 0) {
|
|
617
|
-
setInternalValue(clampedValue);
|
|
618
|
-
}
|
|
619
|
-
onChange?.(clampedValue);
|
|
620
|
-
},
|
|
621
|
-
[clampValue, controlledValue, onChange]
|
|
622
|
-
);
|
|
623
|
-
const increment = useCallback(() => {
|
|
624
|
-
if (disabled) return;
|
|
625
|
-
handleValueChange(value + step);
|
|
626
|
-
}, [disabled, value, step, handleValueChange]);
|
|
627
|
-
const decrement = useCallback(() => {
|
|
628
|
-
if (disabled) return;
|
|
629
|
-
handleValueChange(value - step);
|
|
630
|
-
}, [disabled, value, step, handleValueChange]);
|
|
631
|
-
const handleInputChange = useCallback((e) => {
|
|
632
|
-
setDisplayValue(e.target.value);
|
|
633
|
-
}, []);
|
|
634
|
-
const handleBlur = useCallback(() => {
|
|
635
|
-
setIsFocused(false);
|
|
636
|
-
const parsed = parseValue(displayValue);
|
|
637
|
-
if (parsed !== null) {
|
|
638
|
-
handleValueChange(parsed);
|
|
639
|
-
} else {
|
|
640
|
-
setDisplayValue(formatValue(value));
|
|
641
|
-
}
|
|
642
|
-
}, [displayValue, parseValue, handleValueChange, value, formatValue]);
|
|
643
|
-
const handleFocus = useCallback(() => {
|
|
644
|
-
setIsFocused(true);
|
|
645
|
-
setDisplayValue(String(value));
|
|
646
|
-
}, [value]);
|
|
647
|
-
const handleKeyDown = useCallback(
|
|
648
|
-
(e) => {
|
|
649
|
-
if (e.key === "ArrowUp") {
|
|
650
|
-
e.preventDefault();
|
|
651
|
-
increment();
|
|
652
|
-
} else if (e.key === "ArrowDown") {
|
|
653
|
-
e.preventDefault();
|
|
654
|
-
decrement();
|
|
655
|
-
} else if (e.key === "Enter") {
|
|
656
|
-
inputRef.current?.blur();
|
|
657
|
-
}
|
|
658
|
-
},
|
|
659
|
-
[increment, decrement]
|
|
660
|
-
);
|
|
661
|
-
return /* @__PURE__ */ React12.createElement(
|
|
662
|
-
NumberInputContainer,
|
|
663
|
-
{
|
|
664
|
-
$size: size,
|
|
665
|
-
$disabled: disabled,
|
|
666
|
-
$alert: alert,
|
|
667
|
-
$isFocused: isFocused,
|
|
1134
|
+
UpArrow = () => /* @__PURE__ */ React3.createElement("svg", { viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React3.createElement("path", { d: "M7 4.5L10.5 8.5H3.5L7 4.5Z", fill: "currentColor" }));
|
|
1135
|
+
DownArrow = () => /* @__PURE__ */ React3.createElement("svg", { viewBox: "0 0 14 14", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React3.createElement("path", { d: "M7 9.5L3.5 5.5H10.5L7 9.5Z", fill: "currentColor" }));
|
|
1136
|
+
NumberInput = ({
|
|
1137
|
+
value: controlledValue,
|
|
1138
|
+
defaultValue = 0,
|
|
1139
|
+
min = -Infinity,
|
|
1140
|
+
max = Infinity,
|
|
1141
|
+
step = 1,
|
|
1142
|
+
size = "large",
|
|
1143
|
+
disabled = false,
|
|
1144
|
+
alert = false,
|
|
1145
|
+
precision,
|
|
1146
|
+
formatter,
|
|
1147
|
+
parser,
|
|
1148
|
+
unit,
|
|
1149
|
+
onChange,
|
|
668
1150
|
className,
|
|
669
1151
|
style
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
1152
|
+
}) => {
|
|
1153
|
+
const [internalValue, setInternalValue] = useState(controlledValue ?? defaultValue);
|
|
1154
|
+
const [displayValue, setDisplayValue] = useState("");
|
|
1155
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
1156
|
+
const inputRef = useRef(null);
|
|
1157
|
+
const value = controlledValue !== void 0 ? controlledValue : internalValue;
|
|
1158
|
+
const formatValue = useCallback(
|
|
1159
|
+
(val) => {
|
|
1160
|
+
if (formatter) {
|
|
1161
|
+
return formatter(val);
|
|
1162
|
+
}
|
|
1163
|
+
if (precision !== void 0) {
|
|
1164
|
+
return val.toFixed(precision);
|
|
1165
|
+
}
|
|
1166
|
+
return String(val);
|
|
1167
|
+
},
|
|
1168
|
+
[formatter, precision]
|
|
1169
|
+
);
|
|
1170
|
+
const parseValue = useCallback(
|
|
1171
|
+
(displayVal) => {
|
|
1172
|
+
if (parser) {
|
|
1173
|
+
return parser(displayVal);
|
|
1174
|
+
}
|
|
1175
|
+
const parsed = parseFloat(displayVal);
|
|
1176
|
+
return isNaN(parsed) ? null : parsed;
|
|
1177
|
+
},
|
|
1178
|
+
[parser]
|
|
1179
|
+
);
|
|
1180
|
+
useEffect(() => {
|
|
1181
|
+
if (!isFocused) {
|
|
1182
|
+
setDisplayValue(formatValue(value));
|
|
1183
|
+
}
|
|
1184
|
+
}, [value, isFocused, formatValue]);
|
|
1185
|
+
const clampValue = useCallback(
|
|
1186
|
+
(val) => {
|
|
1187
|
+
return Math.max(min, Math.min(max, val));
|
|
1188
|
+
},
|
|
1189
|
+
[min, max]
|
|
1190
|
+
);
|
|
1191
|
+
const handleValueChange = useCallback(
|
|
1192
|
+
(newValue) => {
|
|
1193
|
+
const clampedValue = clampValue(newValue);
|
|
1194
|
+
if (controlledValue === void 0) {
|
|
1195
|
+
setInternalValue(clampedValue);
|
|
1196
|
+
}
|
|
1197
|
+
onChange?.(clampedValue);
|
|
1198
|
+
},
|
|
1199
|
+
[clampValue, controlledValue, onChange]
|
|
1200
|
+
);
|
|
1201
|
+
const increment = useCallback(() => {
|
|
1202
|
+
if (disabled) return;
|
|
1203
|
+
handleValueChange(value + step);
|
|
1204
|
+
}, [disabled, value, step, handleValueChange]);
|
|
1205
|
+
const decrement = useCallback(() => {
|
|
1206
|
+
if (disabled) return;
|
|
1207
|
+
handleValueChange(value - step);
|
|
1208
|
+
}, [disabled, value, step, handleValueChange]);
|
|
1209
|
+
const handleInputChange = useCallback((e) => {
|
|
1210
|
+
setDisplayValue(e.target.value);
|
|
1211
|
+
}, []);
|
|
1212
|
+
const handleBlur = useCallback(() => {
|
|
1213
|
+
setIsFocused(false);
|
|
1214
|
+
const parsed = parseValue(displayValue);
|
|
1215
|
+
if (parsed !== null) {
|
|
1216
|
+
handleValueChange(parsed);
|
|
1217
|
+
} else {
|
|
1218
|
+
setDisplayValue(formatValue(value));
|
|
1219
|
+
}
|
|
1220
|
+
}, [displayValue, parseValue, handleValueChange, value, formatValue]);
|
|
1221
|
+
const handleFocus = useCallback(() => {
|
|
1222
|
+
setIsFocused(true);
|
|
1223
|
+
setDisplayValue(String(value));
|
|
1224
|
+
}, [value]);
|
|
1225
|
+
const handleKeyDown = useCallback(
|
|
1226
|
+
(e) => {
|
|
1227
|
+
if (e.key === "ArrowUp") {
|
|
1228
|
+
e.preventDefault();
|
|
1229
|
+
increment();
|
|
1230
|
+
} else if (e.key === "ArrowDown") {
|
|
1231
|
+
e.preventDefault();
|
|
1232
|
+
decrement();
|
|
1233
|
+
} else if (e.key === "Enter") {
|
|
1234
|
+
inputRef.current?.blur();
|
|
1235
|
+
}
|
|
1236
|
+
},
|
|
1237
|
+
[increment, decrement]
|
|
1238
|
+
);
|
|
1239
|
+
return /* @__PURE__ */ React3.createElement(
|
|
1240
|
+
NumberInputContainer,
|
|
1241
|
+
{
|
|
1242
|
+
$size: size,
|
|
1243
|
+
$disabled: disabled,
|
|
1244
|
+
$alert: alert,
|
|
1245
|
+
$isFocused: isFocused,
|
|
1246
|
+
className,
|
|
1247
|
+
style
|
|
1248
|
+
},
|
|
1249
|
+
/* @__PURE__ */ React3.createElement(InputWrapper, null, /* @__PURE__ */ React3.createElement(
|
|
1250
|
+
StyledInput,
|
|
1251
|
+
{
|
|
1252
|
+
ref: inputRef,
|
|
1253
|
+
type: "text",
|
|
1254
|
+
value: displayValue,
|
|
1255
|
+
onChange: handleInputChange,
|
|
1256
|
+
onFocus: handleFocus,
|
|
1257
|
+
onBlur: handleBlur,
|
|
1258
|
+
onKeyDown: handleKeyDown,
|
|
1259
|
+
disabled,
|
|
1260
|
+
$size: size,
|
|
1261
|
+
$disabled: disabled
|
|
1262
|
+
}
|
|
1263
|
+
), unit && /* @__PURE__ */ React3.createElement(UnitText, { $size: size, $disabled: disabled }, unit)),
|
|
1264
|
+
/* @__PURE__ */ React3.createElement(ButtonGroup, { $alert: alert, $disabled: disabled }, /* @__PURE__ */ React3.createElement(
|
|
1265
|
+
StepButton,
|
|
1266
|
+
{
|
|
1267
|
+
type: "button",
|
|
1268
|
+
$position: "up",
|
|
1269
|
+
$alert: alert,
|
|
1270
|
+
$disabled: disabled,
|
|
1271
|
+
onClick: increment,
|
|
1272
|
+
disabled,
|
|
1273
|
+
tabIndex: -1
|
|
1274
|
+
},
|
|
1275
|
+
/* @__PURE__ */ React3.createElement(UpArrow, null)
|
|
1276
|
+
), /* @__PURE__ */ React3.createElement(
|
|
1277
|
+
StepButton,
|
|
1278
|
+
{
|
|
1279
|
+
type: "button",
|
|
1280
|
+
$position: "down",
|
|
1281
|
+
$alert: alert,
|
|
1282
|
+
$disabled: disabled,
|
|
1283
|
+
onClick: decrement,
|
|
1284
|
+
disabled,
|
|
1285
|
+
tabIndex: -1
|
|
1286
|
+
},
|
|
1287
|
+
/* @__PURE__ */ React3.createElement(DownArrow, null)
|
|
1288
|
+
))
|
|
1289
|
+
);
|
|
1290
|
+
};
|
|
1291
|
+
NumberInput.displayName = "NumberInput";
|
|
1292
|
+
}
|
|
1293
|
+
});
|
|
714
1294
|
|
|
715
|
-
// src/
|
|
716
|
-
var
|
|
1295
|
+
// src/NumberInput/index.ts
|
|
1296
|
+
var init_NumberInput2 = __esm({
|
|
1297
|
+
"src/NumberInput/index.ts"() {
|
|
1298
|
+
init_NumberInput();
|
|
1299
|
+
}
|
|
1300
|
+
});
|
|
1301
|
+
var SpinButtonWrapper, SliderWrapper, SpinButton;
|
|
1302
|
+
var init_SpinButton = __esm({
|
|
1303
|
+
"src/Button/SpinButton.tsx"() {
|
|
1304
|
+
init_styled();
|
|
1305
|
+
init_Slider2();
|
|
1306
|
+
init_NumberInput2();
|
|
1307
|
+
SpinButtonWrapper = styled.div`
|
|
717
1308
|
display: inline-flex;
|
|
718
1309
|
align-items: center;
|
|
719
1310
|
gap: ${({ $showSlider }) => $showSlider ? "0" : "0"};
|
|
720
1311
|
width: ${({ $showSlider }) => $showSlider ? "100%" : "auto"};
|
|
721
1312
|
`;
|
|
722
|
-
|
|
1313
|
+
SliderWrapper = styled.div`
|
|
723
1314
|
flex: 1;
|
|
724
1315
|
display: flex;
|
|
725
1316
|
align-items: center;
|
|
@@ -727,63 +1318,79 @@ var SliderWrapper = styled.div`
|
|
|
727
1318
|
padding-right: ${({ $size }) => $size === "small" ? "83px" : "72px"};
|
|
728
1319
|
min-width: 0;
|
|
729
1320
|
`;
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
precision,
|
|
741
|
-
formatter,
|
|
742
|
-
parser,
|
|
743
|
-
onChange,
|
|
744
|
-
className,
|
|
745
|
-
style
|
|
746
|
-
}) => {
|
|
747
|
-
const [internalValue, setInternalValue] = useState(controlledValue ?? defaultValue);
|
|
748
|
-
const value = controlledValue !== void 0 ? controlledValue : internalValue;
|
|
749
|
-
const handleValueChange = useCallback(
|
|
750
|
-
(newValue) => {
|
|
751
|
-
if (newValue === null) return;
|
|
752
|
-
if (controlledValue === void 0) {
|
|
753
|
-
setInternalValue(newValue);
|
|
754
|
-
}
|
|
755
|
-
onChange?.(newValue);
|
|
756
|
-
},
|
|
757
|
-
[controlledValue, onChange]
|
|
758
|
-
);
|
|
759
|
-
return /* @__PURE__ */ React12.createElement(SpinButtonWrapper, { $showSlider: showSlider, className, style }, showSlider && /* @__PURE__ */ React12.createElement(SliderWrapper, { $size: size }, /* @__PURE__ */ React12.createElement(
|
|
760
|
-
Slider,
|
|
761
|
-
{
|
|
762
|
-
value,
|
|
763
|
-
min,
|
|
764
|
-
max,
|
|
765
|
-
step,
|
|
766
|
-
disabled,
|
|
767
|
-
onChange: handleValueChange
|
|
768
|
-
}
|
|
769
|
-
)), /* @__PURE__ */ React12.createElement(
|
|
770
|
-
NumberInput,
|
|
771
|
-
{
|
|
772
|
-
value,
|
|
773
|
-
min,
|
|
774
|
-
max,
|
|
775
|
-
step,
|
|
776
|
-
size,
|
|
777
|
-
disabled,
|
|
778
|
-
alert,
|
|
1321
|
+
SpinButton = ({
|
|
1322
|
+
value: controlledValue,
|
|
1323
|
+
defaultValue = 0,
|
|
1324
|
+
min = -Infinity,
|
|
1325
|
+
max = Infinity,
|
|
1326
|
+
step = 1,
|
|
1327
|
+
size = "large",
|
|
1328
|
+
disabled = false,
|
|
1329
|
+
alert = false,
|
|
1330
|
+
showSlider = false,
|
|
779
1331
|
precision,
|
|
780
1332
|
formatter,
|
|
781
1333
|
parser,
|
|
782
|
-
onChange
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
}
|
|
786
|
-
|
|
1334
|
+
onChange,
|
|
1335
|
+
className,
|
|
1336
|
+
style
|
|
1337
|
+
}) => {
|
|
1338
|
+
const [internalValue, setInternalValue] = useState(controlledValue ?? defaultValue);
|
|
1339
|
+
const value = controlledValue !== void 0 ? controlledValue : internalValue;
|
|
1340
|
+
const handleValueChange = useCallback(
|
|
1341
|
+
(newValue) => {
|
|
1342
|
+
if (newValue === null) return;
|
|
1343
|
+
if (controlledValue === void 0) {
|
|
1344
|
+
setInternalValue(newValue);
|
|
1345
|
+
}
|
|
1346
|
+
onChange?.(newValue);
|
|
1347
|
+
},
|
|
1348
|
+
[controlledValue, onChange]
|
|
1349
|
+
);
|
|
1350
|
+
return /* @__PURE__ */ React3.createElement(SpinButtonWrapper, { $showSlider: showSlider, className, style }, showSlider && /* @__PURE__ */ React3.createElement(SliderWrapper, { $size: size }, /* @__PURE__ */ React3.createElement(
|
|
1351
|
+
Slider,
|
|
1352
|
+
{
|
|
1353
|
+
value,
|
|
1354
|
+
min,
|
|
1355
|
+
max,
|
|
1356
|
+
step,
|
|
1357
|
+
disabled,
|
|
1358
|
+
onChange: handleValueChange
|
|
1359
|
+
}
|
|
1360
|
+
)), /* @__PURE__ */ React3.createElement(
|
|
1361
|
+
NumberInput,
|
|
1362
|
+
{
|
|
1363
|
+
value,
|
|
1364
|
+
min,
|
|
1365
|
+
max,
|
|
1366
|
+
step,
|
|
1367
|
+
size,
|
|
1368
|
+
disabled,
|
|
1369
|
+
alert,
|
|
1370
|
+
precision,
|
|
1371
|
+
formatter,
|
|
1372
|
+
parser,
|
|
1373
|
+
onChange: handleValueChange
|
|
1374
|
+
}
|
|
1375
|
+
));
|
|
1376
|
+
};
|
|
1377
|
+
SpinButton.displayName = "SpinButton";
|
|
1378
|
+
}
|
|
1379
|
+
});
|
|
1380
|
+
|
|
1381
|
+
// src/Button/index.ts
|
|
1382
|
+
var init_Button2 = __esm({
|
|
1383
|
+
"src/Button/index.ts"() {
|
|
1384
|
+
init_Button();
|
|
1385
|
+
init_SpinButton();
|
|
1386
|
+
}
|
|
1387
|
+
});
|
|
1388
|
+
|
|
1389
|
+
// src/index.ts
|
|
1390
|
+
init_Button2();
|
|
1391
|
+
|
|
1392
|
+
// src/Switch/Switch.tsx
|
|
1393
|
+
init_styled();
|
|
787
1394
|
var SwitchContainer = styled.label`
|
|
788
1395
|
position: relative;
|
|
789
1396
|
display: inline-block;
|
|
@@ -928,7 +1535,7 @@ var Switch = ({
|
|
|
928
1535
|
const handleBlur = useCallback(() => {
|
|
929
1536
|
setIsFocused(false);
|
|
930
1537
|
}, []);
|
|
931
|
-
return /* @__PURE__ */
|
|
1538
|
+
return /* @__PURE__ */ React3.createElement(
|
|
932
1539
|
SwitchContainer,
|
|
933
1540
|
{
|
|
934
1541
|
$size: size,
|
|
@@ -937,7 +1544,7 @@ var Switch = ({
|
|
|
937
1544
|
className,
|
|
938
1545
|
style
|
|
939
1546
|
},
|
|
940
|
-
/* @__PURE__ */
|
|
1547
|
+
/* @__PURE__ */ React3.createElement(
|
|
941
1548
|
HiddenInput,
|
|
942
1549
|
{
|
|
943
1550
|
type: "checkbox",
|
|
@@ -948,7 +1555,7 @@ var Switch = ({
|
|
|
948
1555
|
disabled
|
|
949
1556
|
}
|
|
950
1557
|
),
|
|
951
|
-
/* @__PURE__ */
|
|
1558
|
+
/* @__PURE__ */ React3.createElement(
|
|
952
1559
|
Track,
|
|
953
1560
|
{
|
|
954
1561
|
$size: size,
|
|
@@ -957,7 +1564,7 @@ var Switch = ({
|
|
|
957
1564
|
$isFocused: isFocused
|
|
958
1565
|
}
|
|
959
1566
|
),
|
|
960
|
-
/* @__PURE__ */
|
|
1567
|
+
/* @__PURE__ */ React3.createElement(
|
|
961
1568
|
Thumb,
|
|
962
1569
|
{
|
|
963
1570
|
$size: size,
|
|
@@ -969,6 +1576,9 @@ var Switch = ({
|
|
|
969
1576
|
);
|
|
970
1577
|
};
|
|
971
1578
|
Switch.displayName = "Switch";
|
|
1579
|
+
|
|
1580
|
+
// src/Radio/Radio.tsx
|
|
1581
|
+
init_styled();
|
|
972
1582
|
var RadioContainer = styled.label`
|
|
973
1583
|
position: relative;
|
|
974
1584
|
display: inline-block;
|
|
@@ -1084,14 +1694,14 @@ var Radio = ({
|
|
|
1084
1694
|
const handleBlur = useCallback(() => {
|
|
1085
1695
|
setIsFocused(false);
|
|
1086
1696
|
}, []);
|
|
1087
|
-
return /* @__PURE__ */
|
|
1697
|
+
return /* @__PURE__ */ React3.createElement(
|
|
1088
1698
|
RadioContainer,
|
|
1089
1699
|
{
|
|
1090
1700
|
$disabled: disabled,
|
|
1091
1701
|
className,
|
|
1092
1702
|
style
|
|
1093
1703
|
},
|
|
1094
|
-
/* @__PURE__ */
|
|
1704
|
+
/* @__PURE__ */ React3.createElement(
|
|
1095
1705
|
HiddenInput2,
|
|
1096
1706
|
{
|
|
1097
1707
|
type: "radio",
|
|
@@ -1105,7 +1715,7 @@ var Radio = ({
|
|
|
1105
1715
|
disabled
|
|
1106
1716
|
}
|
|
1107
1717
|
),
|
|
1108
|
-
/* @__PURE__ */
|
|
1718
|
+
/* @__PURE__ */ React3.createElement(
|
|
1109
1719
|
RadioOuter,
|
|
1110
1720
|
{
|
|
1111
1721
|
$checked: checked,
|
|
@@ -1113,7 +1723,7 @@ var Radio = ({
|
|
|
1113
1723
|
$isFocused: isFocused
|
|
1114
1724
|
}
|
|
1115
1725
|
),
|
|
1116
|
-
/* @__PURE__ */
|
|
1726
|
+
/* @__PURE__ */ React3.createElement(
|
|
1117
1727
|
RadioInner,
|
|
1118
1728
|
{
|
|
1119
1729
|
$checked: checked,
|
|
@@ -1123,6 +1733,9 @@ var Radio = ({
|
|
|
1123
1733
|
);
|
|
1124
1734
|
};
|
|
1125
1735
|
Radio.displayName = "Radio";
|
|
1736
|
+
|
|
1737
|
+
// src/Checkbox/Checkbox.tsx
|
|
1738
|
+
init_styled();
|
|
1126
1739
|
var CheckboxContainer = styled.label`
|
|
1127
1740
|
position: relative;
|
|
1128
1741
|
display: inline-block;
|
|
@@ -1200,7 +1813,7 @@ var CheckboxBox = styled.div`
|
|
|
1200
1813
|
`;
|
|
1201
1814
|
}}
|
|
1202
1815
|
`;
|
|
1203
|
-
var
|
|
1816
|
+
var IconWrapper3 = styled.div`
|
|
1204
1817
|
position: absolute;
|
|
1205
1818
|
left: 50%;
|
|
1206
1819
|
top: 50%;
|
|
@@ -1269,14 +1882,14 @@ var Checkbox = ({
|
|
|
1269
1882
|
const handleBlur = useCallback(() => {
|
|
1270
1883
|
setIsFocused(false);
|
|
1271
1884
|
}, []);
|
|
1272
|
-
return /* @__PURE__ */
|
|
1885
|
+
return /* @__PURE__ */ React3.createElement(
|
|
1273
1886
|
CheckboxContainer,
|
|
1274
1887
|
{
|
|
1275
1888
|
$disabled: disabled,
|
|
1276
1889
|
className,
|
|
1277
1890
|
style
|
|
1278
1891
|
},
|
|
1279
|
-
/* @__PURE__ */
|
|
1892
|
+
/* @__PURE__ */ React3.createElement(
|
|
1280
1893
|
HiddenInput3,
|
|
1281
1894
|
{
|
|
1282
1895
|
ref: inputRef,
|
|
@@ -1291,7 +1904,7 @@ var Checkbox = ({
|
|
|
1291
1904
|
disabled
|
|
1292
1905
|
}
|
|
1293
1906
|
),
|
|
1294
|
-
/* @__PURE__ */
|
|
1907
|
+
/* @__PURE__ */ React3.createElement(
|
|
1295
1908
|
CheckboxBox,
|
|
1296
1909
|
{
|
|
1297
1910
|
$checked: checked,
|
|
@@ -1300,11 +1913,17 @@ var Checkbox = ({
|
|
|
1300
1913
|
$isFocused: isFocused
|
|
1301
1914
|
}
|
|
1302
1915
|
),
|
|
1303
|
-
!indeterminate && /* @__PURE__ */
|
|
1304
|
-
indeterminate && /* @__PURE__ */
|
|
1916
|
+
!indeterminate && /* @__PURE__ */ React3.createElement(IconWrapper3, { $visible: checked }, /* @__PURE__ */ React3.createElement("svg", { width: 10, height: 8, viewBox: "0 0 10 8", fill: "#fff" }, /* @__PURE__ */ React3.createElement("path", { d: "M1.05426 3.16164L0 4.27945L3.50904 8L10 1.11781L8.94573 0L3.50904 5.76438L1.05426 3.16164Z" }))),
|
|
1917
|
+
indeterminate && /* @__PURE__ */ React3.createElement(IconWrapper3, { $visible: indeterminate }, /* @__PURE__ */ React3.createElement(DefaultIndeterminateIcon, null))
|
|
1305
1918
|
);
|
|
1306
1919
|
};
|
|
1307
1920
|
Checkbox.displayName = "Checkbox";
|
|
1921
|
+
|
|
1922
|
+
// src/index.ts
|
|
1923
|
+
init_Slider2();
|
|
1924
|
+
|
|
1925
|
+
// src/Input/Input.tsx
|
|
1926
|
+
init_styled();
|
|
1308
1927
|
var InputWrapper2 = styled.div`
|
|
1309
1928
|
display: inline-flex;
|
|
1310
1929
|
align-items: center;
|
|
@@ -1454,7 +2073,7 @@ var Input = forwardRef(
|
|
|
1454
2073
|
setIsFocused(false);
|
|
1455
2074
|
onBlur?.(e);
|
|
1456
2075
|
};
|
|
1457
|
-
return /* @__PURE__ */
|
|
2076
|
+
return /* @__PURE__ */ React3.createElement(
|
|
1458
2077
|
InputWrapper2,
|
|
1459
2078
|
{
|
|
1460
2079
|
$size: size,
|
|
@@ -1465,8 +2084,8 @@ var Input = forwardRef(
|
|
|
1465
2084
|
className,
|
|
1466
2085
|
style
|
|
1467
2086
|
},
|
|
1468
|
-
prefixNode && /* @__PURE__ */
|
|
1469
|
-
/* @__PURE__ */
|
|
2087
|
+
prefixNode && /* @__PURE__ */ React3.createElement(PrefixNode, { $size: size }, prefixNode),
|
|
2088
|
+
/* @__PURE__ */ React3.createElement(
|
|
1470
2089
|
StyledInput2,
|
|
1471
2090
|
{
|
|
1472
2091
|
ref,
|
|
@@ -1480,11 +2099,14 @@ var Input = forwardRef(
|
|
|
1480
2099
|
...rest
|
|
1481
2100
|
}
|
|
1482
2101
|
),
|
|
1483
|
-
suffixNode && /* @__PURE__ */
|
|
2102
|
+
suffixNode && /* @__PURE__ */ React3.createElement(SuffixNode, { $size: size }, suffixNode)
|
|
1484
2103
|
);
|
|
1485
2104
|
}
|
|
1486
2105
|
);
|
|
1487
2106
|
Input.displayName = "Input";
|
|
2107
|
+
|
|
2108
|
+
// src/Input/SearchInput.tsx
|
|
2109
|
+
init_styled();
|
|
1488
2110
|
var SearchIconWrapper = styled.div`
|
|
1489
2111
|
display: inline-flex;
|
|
1490
2112
|
align-items: center;
|
|
@@ -1540,7 +2162,7 @@ var ClearButton = styled.button`
|
|
|
1540
2162
|
opacity: 0.5;
|
|
1541
2163
|
}
|
|
1542
2164
|
`;
|
|
1543
|
-
var DefaultSearchIcon = () => /* @__PURE__ */
|
|
2165
|
+
var DefaultSearchIcon = () => /* @__PURE__ */ React3.createElement("svg", { viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React3.createElement(
|
|
1544
2166
|
"path",
|
|
1545
2167
|
{
|
|
1546
2168
|
d: "M7.33333 12.6667C10.2789 12.6667 12.6667 10.2789 12.6667 7.33333C12.6667 4.38781 10.2789 2 7.33333 2C4.38781 2 2 4.38781 2 7.33333C2 10.2789 4.38781 12.6667 7.33333 12.6667Z",
|
|
@@ -1549,7 +2171,7 @@ var DefaultSearchIcon = () => /* @__PURE__ */ React12.createElement("svg", { vie
|
|
|
1549
2171
|
strokeLinecap: "round",
|
|
1550
2172
|
strokeLinejoin: "round"
|
|
1551
2173
|
}
|
|
1552
|
-
), /* @__PURE__ */
|
|
2174
|
+
), /* @__PURE__ */ React3.createElement(
|
|
1553
2175
|
"path",
|
|
1554
2176
|
{
|
|
1555
2177
|
d: "M14 14L11.1 11.1",
|
|
@@ -1559,7 +2181,7 @@ var DefaultSearchIcon = () => /* @__PURE__ */ React12.createElement("svg", { vie
|
|
|
1559
2181
|
strokeLinejoin: "round"
|
|
1560
2182
|
}
|
|
1561
2183
|
));
|
|
1562
|
-
var DefaultCloseIcon = () => /* @__PURE__ */
|
|
2184
|
+
var DefaultCloseIcon = () => /* @__PURE__ */ React3.createElement("svg", { viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React3.createElement(
|
|
1563
2185
|
"path",
|
|
1564
2186
|
{
|
|
1565
2187
|
d: "M12 4L4 12",
|
|
@@ -1568,7 +2190,7 @@ var DefaultCloseIcon = () => /* @__PURE__ */ React12.createElement("svg", { view
|
|
|
1568
2190
|
strokeLinecap: "round",
|
|
1569
2191
|
strokeLinejoin: "round"
|
|
1570
2192
|
}
|
|
1571
|
-
), /* @__PURE__ */
|
|
2193
|
+
), /* @__PURE__ */ React3.createElement(
|
|
1572
2194
|
"path",
|
|
1573
2195
|
{
|
|
1574
2196
|
d: "M4 4L12 12",
|
|
@@ -1606,8 +2228,8 @@ var SearchInput = forwardRef(
|
|
|
1606
2228
|
}
|
|
1607
2229
|
onClear?.();
|
|
1608
2230
|
};
|
|
1609
|
-
const prefixNode = /* @__PURE__ */
|
|
1610
|
-
const suffixNode = clearable && currentValue && !disabled && !readOnly ? /* @__PURE__ */
|
|
2231
|
+
const prefixNode = /* @__PURE__ */ React3.createElement(SearchIconWrapper, { $size: size }, searchIcon || /* @__PURE__ */ React3.createElement(DefaultSearchIcon, null));
|
|
2232
|
+
const suffixNode = clearable && currentValue && !disabled && !readOnly ? /* @__PURE__ */ React3.createElement(
|
|
1611
2233
|
ClearButton,
|
|
1612
2234
|
{
|
|
1613
2235
|
$size: size,
|
|
@@ -1615,9 +2237,9 @@ var SearchInput = forwardRef(
|
|
|
1615
2237
|
type: "button",
|
|
1616
2238
|
tabIndex: -1
|
|
1617
2239
|
},
|
|
1618
|
-
/* @__PURE__ */
|
|
2240
|
+
/* @__PURE__ */ React3.createElement(DefaultCloseIcon, null)
|
|
1619
2241
|
) : null;
|
|
1620
|
-
return /* @__PURE__ */
|
|
2242
|
+
return /* @__PURE__ */ React3.createElement(
|
|
1621
2243
|
Input,
|
|
1622
2244
|
{
|
|
1623
2245
|
ref,
|
|
@@ -1634,255 +2256,20 @@ var SearchInput = forwardRef(
|
|
|
1634
2256
|
}
|
|
1635
2257
|
);
|
|
1636
2258
|
SearchInput.displayName = "SearchInput";
|
|
1637
|
-
var IconContext = createContext(null);
|
|
1638
|
-
var IconProvider = ({
|
|
1639
|
-
icons,
|
|
1640
|
-
children
|
|
1641
|
-
}) => {
|
|
1642
|
-
return /* @__PURE__ */ React12.createElement(IconContext.Provider, { value: icons }, children);
|
|
1643
|
-
};
|
|
1644
|
-
var useIconRegistry = () => {
|
|
1645
|
-
return useContext(IconContext);
|
|
1646
|
-
};
|
|
1647
|
-
IconProvider.displayName = "IconProvider";
|
|
1648
|
-
|
|
1649
|
-
// src/Icon/Icon.tsx
|
|
1650
|
-
var IconContainer = styled.span`
|
|
1651
|
-
display: inline-flex;
|
|
1652
|
-
align-items: center;
|
|
1653
|
-
justify-content: center;
|
|
1654
|
-
width: ${({ $size }) => typeof $size === "number" ? `${$size}px` : $size};
|
|
1655
|
-
height: ${({ $size }) => typeof $size === "number" ? `${$size}px` : $size};
|
|
1656
|
-
color: ${({ $color }) => $color};
|
|
1657
|
-
flex-shrink: 0;
|
|
1658
|
-
line-height: 1;
|
|
1659
|
-
|
|
1660
|
-
svg {
|
|
1661
|
-
width: 100%;
|
|
1662
|
-
height: 100%;
|
|
1663
|
-
display: block;
|
|
1664
|
-
}
|
|
1665
|
-
`;
|
|
1666
|
-
var Icon = ({
|
|
1667
|
-
name,
|
|
1668
|
-
src,
|
|
1669
|
-
children,
|
|
1670
|
-
size = 16,
|
|
1671
|
-
color = "currentColor",
|
|
1672
|
-
alt = "icon",
|
|
1673
|
-
className,
|
|
1674
|
-
style,
|
|
1675
|
-
onClick
|
|
1676
|
-
}) => {
|
|
1677
|
-
const registry = useIconRegistry();
|
|
1678
|
-
let iconElement = children;
|
|
1679
|
-
if (!iconElement && src) {
|
|
1680
|
-
iconElement = /* @__PURE__ */ React12.createElement(
|
|
1681
|
-
"img",
|
|
1682
|
-
{
|
|
1683
|
-
src,
|
|
1684
|
-
alt,
|
|
1685
|
-
style: { width: "100%", height: "100%", display: "block" }
|
|
1686
|
-
}
|
|
1687
|
-
);
|
|
1688
|
-
}
|
|
1689
|
-
if (!iconElement && name && registry) {
|
|
1690
|
-
const IconComponent = registry[name];
|
|
1691
|
-
if (IconComponent) {
|
|
1692
|
-
iconElement = /* @__PURE__ */ React12.createElement(IconComponent, null);
|
|
1693
|
-
} else if (process.env.NODE_ENV !== "production") {
|
|
1694
|
-
console.warn(`Icon "${name}" not found in registry. Make sure IconProvider is set up.`);
|
|
1695
|
-
}
|
|
1696
|
-
}
|
|
1697
|
-
if (!iconElement) {
|
|
1698
|
-
if (process.env.NODE_ENV !== "production" && !children && !name && !src) {
|
|
1699
|
-
console.warn('Icon: one of "name", "src", or "children" must be provided');
|
|
1700
|
-
}
|
|
1701
|
-
return null;
|
|
1702
|
-
}
|
|
1703
|
-
return /* @__PURE__ */ React12.createElement(
|
|
1704
|
-
IconContainer,
|
|
1705
|
-
{
|
|
1706
|
-
$size: size,
|
|
1707
|
-
$color: color,
|
|
1708
|
-
className,
|
|
1709
|
-
style,
|
|
1710
|
-
onClick
|
|
1711
|
-
},
|
|
1712
|
-
iconElement
|
|
1713
|
-
);
|
|
1714
|
-
};
|
|
1715
|
-
Icon.displayName = "Icon";
|
|
1716
|
-
var ToastContainer = styled.div`
|
|
1717
|
-
display: inline-flex;
|
|
1718
|
-
align-items: center;
|
|
1719
|
-
gap: 8px;
|
|
1720
|
-
border: 1px solid;
|
|
1721
|
-
box-shadow: 0px 4px 12px 0px rgba(0, 0, 0, 0.08);
|
|
1722
|
-
|
|
1723
|
-
${({ theme: theme2 }) => {
|
|
1724
|
-
const baseConfig = theme2.components.toast;
|
|
1725
|
-
return `
|
|
1726
|
-
padding: ${baseConfig.padding};
|
|
1727
|
-
border-radius: ${baseConfig.borderRadius};
|
|
1728
|
-
font-size: ${baseConfig.fontSize};
|
|
1729
|
-
font-weight: ${baseConfig.fontWeight};
|
|
1730
|
-
`;
|
|
1731
|
-
}}
|
|
1732
|
-
|
|
1733
|
-
${({ $variant, theme: theme2 }) => {
|
|
1734
|
-
const variantConfig = theme2.components.toast[$variant];
|
|
1735
|
-
return `
|
|
1736
|
-
background: ${variantConfig.background};
|
|
1737
|
-
border-color: ${variantConfig.borderColor};
|
|
1738
|
-
`;
|
|
1739
|
-
}}
|
|
1740
|
-
`;
|
|
1741
|
-
var IconWrapper3 = styled.div`
|
|
1742
|
-
display: flex;
|
|
1743
|
-
align-items: center;
|
|
1744
|
-
justify-content: center;
|
|
1745
|
-
flex-shrink: 0;
|
|
1746
|
-
|
|
1747
|
-
${({ $variant, theme: theme2 }) => {
|
|
1748
|
-
const iconConfig = theme2.components.toast[$variant].icon;
|
|
1749
|
-
return `
|
|
1750
|
-
width: ${iconConfig.size.width};
|
|
1751
|
-
height: ${iconConfig.size.height};
|
|
1752
|
-
`;
|
|
1753
|
-
}}
|
|
1754
|
-
`;
|
|
1755
|
-
var Message = styled.span`
|
|
1756
|
-
flex: 1;
|
|
1757
|
-
line-height: 20px;
|
|
1758
|
-
color: ${({ theme: theme2 }) => theme2.colors.palettes.gray["120"]};
|
|
1759
|
-
`;
|
|
1760
|
-
var ActionButton = styled.button`
|
|
1761
|
-
background: transparent;
|
|
1762
|
-
border: none;
|
|
1763
|
-
cursor: pointer;
|
|
1764
|
-
padding: 0;
|
|
1765
|
-
outline: none;
|
|
1766
|
-
|
|
1767
|
-
${({ $variant, theme: theme2 }) => {
|
|
1768
|
-
const buttonConfig = theme2.components.toast[$variant].button;
|
|
1769
|
-
return `
|
|
1770
|
-
font-size: ${buttonConfig.fontSize};
|
|
1771
|
-
font-weight: ${buttonConfig.fontWeight};
|
|
1772
|
-
color: ${buttonConfig.color};
|
|
1773
|
-
margin-left: ${buttonConfig.gap};
|
|
1774
|
-
`;
|
|
1775
|
-
}}
|
|
1776
|
-
|
|
1777
|
-
&:hover {
|
|
1778
|
-
opacity: 0.8;
|
|
1779
|
-
}
|
|
1780
2259
|
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
`;
|
|
1785
|
-
var CloseButton = styled.button`
|
|
1786
|
-
background: transparent;
|
|
1787
|
-
border: none;
|
|
1788
|
-
cursor: pointer;
|
|
1789
|
-
padding: 0;
|
|
1790
|
-
width: 16px;
|
|
1791
|
-
height: 16px;
|
|
1792
|
-
display: flex;
|
|
1793
|
-
align-items: center;
|
|
1794
|
-
justify-content: center;
|
|
1795
|
-
color: ${({ theme: theme2 }) => theme2.colors.palettes.gray["60"]};
|
|
1796
|
-
flex-shrink: 0;
|
|
1797
|
-
outline: none;
|
|
2260
|
+
// src/index.ts
|
|
2261
|
+
init_NumberInput2();
|
|
2262
|
+
init_Icon2();
|
|
1798
2263
|
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
}
|
|
2264
|
+
// src/Toast/index.ts
|
|
2265
|
+
init_Toast();
|
|
1802
2266
|
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
`;
|
|
1807
|
-
var SuccessIcon = () => /* @__PURE__ */ React12.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React12.createElement("circle", { cx: "10", cy: "10", r: "8", fill: "#4ea44b" }), /* @__PURE__ */ React12.createElement("path", { d: "M6 10L9 13L14 7", stroke: "white", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }));
|
|
1808
|
-
var InfoIcon = () => /* @__PURE__ */ React12.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React12.createElement("circle", { cx: "10", cy: "10", r: "8", fill: "#5ba0e7" }), /* @__PURE__ */ React12.createElement("path", { d: "M10 9V14M10 6H10.01", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }));
|
|
1809
|
-
var ErrorIcon = () => /* @__PURE__ */ React12.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React12.createElement("circle", { cx: "10", cy: "10", r: "8", fill: "#e95555" }), /* @__PURE__ */ React12.createElement("path", { d: "M7 7L13 13M13 7L7 13", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }));
|
|
1810
|
-
var WarnIcon = () => /* @__PURE__ */ React12.createElement("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React12.createElement("circle", { cx: "10", cy: "10", r: "8", fill: "#ebe361" }), /* @__PURE__ */ React12.createElement("path", { d: "M10 6V11M10 14H10.01", stroke: "white", strokeWidth: "2", strokeLinecap: "round" }));
|
|
1811
|
-
var CloseIconSvg = () => /* @__PURE__ */ React12.createElement("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, /* @__PURE__ */ React12.createElement("path", { d: "M9 3L3 9M3 3L9 9", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }));
|
|
1812
|
-
var Toast = ({
|
|
1813
|
-
variant = "info",
|
|
1814
|
-
message,
|
|
1815
|
-
actionText,
|
|
1816
|
-
onAction,
|
|
1817
|
-
closable = false,
|
|
1818
|
-
onClose,
|
|
1819
|
-
duration = 0,
|
|
1820
|
-
icon,
|
|
1821
|
-
showIcon = true,
|
|
1822
|
-
className,
|
|
1823
|
-
style
|
|
1824
|
-
}) => {
|
|
1825
|
-
const [visible, setVisible] = useState(true);
|
|
1826
|
-
useEffect(() => {
|
|
1827
|
-
if (duration > 0) {
|
|
1828
|
-
const timer = setTimeout(() => {
|
|
1829
|
-
setVisible(false);
|
|
1830
|
-
onClose?.();
|
|
1831
|
-
}, duration);
|
|
1832
|
-
return () => clearTimeout(timer);
|
|
1833
|
-
}
|
|
1834
|
-
}, [duration, onClose]);
|
|
1835
|
-
const handleClose = () => {
|
|
1836
|
-
setVisible(false);
|
|
1837
|
-
onClose?.();
|
|
1838
|
-
};
|
|
1839
|
-
if (!visible) {
|
|
1840
|
-
return null;
|
|
1841
|
-
}
|
|
1842
|
-
const defaultIcons = {
|
|
1843
|
-
success: /* @__PURE__ */ React12.createElement(SuccessIcon, null),
|
|
1844
|
-
info: /* @__PURE__ */ React12.createElement(InfoIcon, null),
|
|
1845
|
-
error: /* @__PURE__ */ React12.createElement(ErrorIcon, null),
|
|
1846
|
-
warn: /* @__PURE__ */ React12.createElement(WarnIcon, null)
|
|
1847
|
-
};
|
|
1848
|
-
const iconElement = icon || defaultIcons[variant];
|
|
1849
|
-
return /* @__PURE__ */ React12.createElement(
|
|
1850
|
-
ToastContainer,
|
|
1851
|
-
{
|
|
1852
|
-
$variant: variant,
|
|
1853
|
-
className,
|
|
1854
|
-
style,
|
|
1855
|
-
role: "alert",
|
|
1856
|
-
"aria-live": "polite"
|
|
1857
|
-
},
|
|
1858
|
-
showIcon && /* @__PURE__ */ React12.createElement(IconWrapper3, { $variant: variant }, iconElement),
|
|
1859
|
-
/* @__PURE__ */ React12.createElement(Message, null, message),
|
|
1860
|
-
actionText && onAction && /* @__PURE__ */ React12.createElement(
|
|
1861
|
-
ActionButton,
|
|
1862
|
-
{
|
|
1863
|
-
$variant: variant,
|
|
1864
|
-
onClick: onAction,
|
|
1865
|
-
type: "button"
|
|
1866
|
-
},
|
|
1867
|
-
actionText
|
|
1868
|
-
),
|
|
1869
|
-
closable && /* @__PURE__ */ React12.createElement(
|
|
1870
|
-
CloseButton,
|
|
1871
|
-
{
|
|
1872
|
-
onClick: handleClose,
|
|
1873
|
-
type: "button",
|
|
1874
|
-
"aria-label": "Close"
|
|
1875
|
-
},
|
|
1876
|
-
/* @__PURE__ */ React12.createElement(CloseIconSvg, null)
|
|
1877
|
-
)
|
|
1878
|
-
);
|
|
1879
|
-
};
|
|
1880
|
-
Toast.displayName = "Toast";
|
|
2267
|
+
// src/Toast/ToastContainer.tsx
|
|
2268
|
+
init_styled();
|
|
2269
|
+
init_Toast();
|
|
1881
2270
|
var ToastContext = createContext(null);
|
|
1882
|
-
var
|
|
2271
|
+
var ToastWrapper2 = styled.div`
|
|
1883
2272
|
position: fixed;
|
|
1884
|
-
top: 24px;
|
|
1885
|
-
right: 24px;
|
|
1886
2273
|
z-index: 9999;
|
|
1887
2274
|
display: flex;
|
|
1888
2275
|
flex-direction: column;
|
|
@@ -1892,8 +2279,44 @@ var ToastWrapper = styled.div`
|
|
|
1892
2279
|
> * {
|
|
1893
2280
|
pointer-events: auto;
|
|
1894
2281
|
}
|
|
2282
|
+
|
|
2283
|
+
${({ $placement, theme: theme2 }) => {
|
|
2284
|
+
const offset = theme2.components?.toast?.offset || { vertical: "24px", horizontal: "24px" };
|
|
2285
|
+
const vertical = offset.vertical || "24px";
|
|
2286
|
+
const horizontal = offset.horizontal || "24px";
|
|
2287
|
+
const styles = {
|
|
2288
|
+
"top-right": `
|
|
2289
|
+
top: ${vertical};
|
|
2290
|
+
right: ${horizontal};
|
|
2291
|
+
`,
|
|
2292
|
+
"top-left": `
|
|
2293
|
+
top: ${vertical};
|
|
2294
|
+
left: ${horizontal};
|
|
2295
|
+
`,
|
|
2296
|
+
"top-center": `
|
|
2297
|
+
top: ${vertical};
|
|
2298
|
+
left: 50%;
|
|
2299
|
+
transform: translateX(-50%);
|
|
2300
|
+
`,
|
|
2301
|
+
"bottom-right": `
|
|
2302
|
+
bottom: ${vertical};
|
|
2303
|
+
right: ${horizontal};
|
|
2304
|
+
`,
|
|
2305
|
+
"bottom-left": `
|
|
2306
|
+
bottom: ${vertical};
|
|
2307
|
+
left: ${horizontal};
|
|
2308
|
+
`,
|
|
2309
|
+
"bottom-center": `
|
|
2310
|
+
bottom: ${vertical};
|
|
2311
|
+
left: 50%;
|
|
2312
|
+
transform: translateX(-50%);
|
|
2313
|
+
`
|
|
2314
|
+
};
|
|
2315
|
+
return styles[$placement] || styles["top-right"];
|
|
2316
|
+
}}
|
|
1895
2317
|
`;
|
|
1896
2318
|
var ToastContainer2 = ({
|
|
2319
|
+
placement = "top-right",
|
|
1897
2320
|
maxCount = 5,
|
|
1898
2321
|
defaultDuration = 3e3,
|
|
1899
2322
|
children
|
|
@@ -1913,7 +2336,7 @@ var ToastContainer2 = ({
|
|
|
1913
2336
|
return id;
|
|
1914
2337
|
}, [maxCount, defaultDuration]);
|
|
1915
2338
|
const hideToast = useCallback((id) => {
|
|
1916
|
-
setToasts((prev) => prev.filter((
|
|
2339
|
+
setToasts((prev) => prev.filter((toast2) => toast2.id !== id));
|
|
1917
2340
|
}, []);
|
|
1918
2341
|
const success = useCallback((message, options) => {
|
|
1919
2342
|
return showToast({ ...options, variant: "success", message });
|
|
@@ -1935,12 +2358,12 @@ var ToastContainer2 = ({
|
|
|
1935
2358
|
error,
|
|
1936
2359
|
warn
|
|
1937
2360
|
};
|
|
1938
|
-
return /* @__PURE__ */
|
|
2361
|
+
return /* @__PURE__ */ React3.createElement(ToastContext.Provider, { value: contextValue }, children, /* @__PURE__ */ React3.createElement(ToastWrapper2, { $placement: placement }, toasts.map((toast2) => /* @__PURE__ */ React3.createElement(
|
|
1939
2362
|
Toast,
|
|
1940
2363
|
{
|
|
1941
|
-
key:
|
|
1942
|
-
...
|
|
1943
|
-
onClose: () => hideToast(
|
|
2364
|
+
key: toast2.id,
|
|
2365
|
+
...toast2,
|
|
2366
|
+
onClose: () => hideToast(toast2.id)
|
|
1944
2367
|
}
|
|
1945
2368
|
))));
|
|
1946
2369
|
};
|
|
@@ -1952,6 +2375,12 @@ var useToast = () => {
|
|
|
1952
2375
|
return context;
|
|
1953
2376
|
};
|
|
1954
2377
|
ToastContainer2.displayName = "ToastContainer";
|
|
2378
|
+
|
|
2379
|
+
// src/Toast/index.ts
|
|
2380
|
+
init_toastManager();
|
|
2381
|
+
|
|
2382
|
+
// src/Tabs/Tabs.tsx
|
|
2383
|
+
init_styled();
|
|
1955
2384
|
var TabContainer = styled.div`
|
|
1956
2385
|
display: flex;
|
|
1957
2386
|
flex-direction: column;
|
|
@@ -2089,7 +2518,7 @@ var Tabs = ({
|
|
|
2089
2518
|
},
|
|
2090
2519
|
[controlledActiveKey, onChange]
|
|
2091
2520
|
);
|
|
2092
|
-
return /* @__PURE__ */
|
|
2521
|
+
return /* @__PURE__ */ React3.createElement(TabContainer, { className, style }, /* @__PURE__ */ React3.createElement(TabList, { $variant: variant, role: "tablist" }, items.map((item) => /* @__PURE__ */ React3.createElement(
|
|
2093
2522
|
TabItem,
|
|
2094
2523
|
{
|
|
2095
2524
|
key: item.key,
|
|
@@ -2103,7 +2532,7 @@ var Tabs = ({
|
|
|
2103
2532
|
disabled: item.disabled,
|
|
2104
2533
|
type: "button"
|
|
2105
2534
|
},
|
|
2106
|
-
item.icon && /* @__PURE__ */
|
|
2535
|
+
item.icon && /* @__PURE__ */ React3.createElement("span", null, item.icon),
|
|
2107
2536
|
item.label
|
|
2108
2537
|
))));
|
|
2109
2538
|
};
|
|
@@ -2120,7 +2549,7 @@ var Tooltip = ({
|
|
|
2120
2549
|
getPopupContainer,
|
|
2121
2550
|
...rest
|
|
2122
2551
|
}) => {
|
|
2123
|
-
const overlayContent =
|
|
2552
|
+
const overlayContent = React3.useMemo(() => /* @__PURE__ */ React3.createElement("div", null, content), [content]);
|
|
2124
2553
|
const variantClass = `tooltip-variant-${variant}`;
|
|
2125
2554
|
const sizeClass = variant === "white" ? `tooltip-size-${size}` : "";
|
|
2126
2555
|
const combinedClassName = [variantClass, sizeClass, overlayClassName].filter(Boolean).join(" ");
|
|
@@ -2133,65 +2562,136 @@ var Tooltip = ({
|
|
|
2133
2562
|
...getPopupContainer && { getPopupContainer },
|
|
2134
2563
|
...rest
|
|
2135
2564
|
};
|
|
2136
|
-
return /* @__PURE__ */
|
|
2565
|
+
return /* @__PURE__ */ React3.createElement(RcTooltip, { ...tooltipProps, prefixCls: "od-tooltip" }, children);
|
|
2137
2566
|
};
|
|
2138
2567
|
Tooltip.displayName = "Tooltip";
|
|
2568
|
+
|
|
2569
|
+
// src/Tooltip/globalStyle.ts
|
|
2570
|
+
init_context();
|
|
2139
2571
|
var theme = getGlobalTheme();
|
|
2140
|
-
var
|
|
2141
|
-
var
|
|
2572
|
+
var arrowSize = 5;
|
|
2573
|
+
var paddingDistance = `${arrowSize}px`;
|
|
2574
|
+
var arrowDistance = `${arrowSize}px`;
|
|
2142
2575
|
var TooltipGlobalStyles = createGlobalStyle`
|
|
2143
|
-
|
|
2576
|
+
/* Base tooltip container */
|
|
2577
|
+
.od-tooltip {
|
|
2578
|
+
position: absolute;
|
|
2579
|
+
z-index: 1070;
|
|
2580
|
+
display: block;
|
|
2581
|
+
visibility: visible;
|
|
2582
|
+
font-size: 12px;
|
|
2583
|
+
line-height: 1.5;
|
|
2144
2584
|
opacity: 1;
|
|
2145
2585
|
}
|
|
2146
2586
|
|
|
2147
|
-
.
|
|
2587
|
+
.od-tooltip-hidden {
|
|
2148
2588
|
display: none;
|
|
2149
2589
|
}
|
|
2150
2590
|
|
|
2151
|
-
|
|
2152
|
-
.
|
|
2153
|
-
|
|
2591
|
+
/* Tooltip content wrapper */
|
|
2592
|
+
.od-tooltip-content {
|
|
2593
|
+
position: relative;
|
|
2594
|
+
}
|
|
2595
|
+
|
|
2596
|
+
/* Tooltip inner content */
|
|
2597
|
+
.od-tooltip-inner {
|
|
2598
|
+
padding: 6px 8px;
|
|
2599
|
+
text-align: left;
|
|
2600
|
+
text-decoration: none;
|
|
2601
|
+
word-wrap: break-word;
|
|
2602
|
+
min-height: unset;
|
|
2603
|
+
}
|
|
2604
|
+
|
|
2605
|
+
/* Tooltip arrow base */
|
|
2606
|
+
.od-tooltip-arrow {
|
|
2607
|
+
position: absolute;
|
|
2608
|
+
width: 0;
|
|
2609
|
+
height: 0;
|
|
2610
|
+
border-color: transparent;
|
|
2611
|
+
border-style: solid;
|
|
2612
|
+
}
|
|
2613
|
+
|
|
2614
|
+
.od-tooltip-placement-top,
|
|
2615
|
+
.od-tooltip-placement-topLeft,
|
|
2616
|
+
.od-tooltip-placement-topRight {
|
|
2154
2617
|
padding-bottom: ${paddingDistance};
|
|
2155
2618
|
}
|
|
2156
2619
|
|
|
2157
|
-
.
|
|
2158
|
-
.
|
|
2159
|
-
.
|
|
2620
|
+
.od-tooltip-placement-right,
|
|
2621
|
+
.od-tooltip-placement-rightTop,
|
|
2622
|
+
.od-tooltip-placement-rightBottom {
|
|
2160
2623
|
padding-left: ${paddingDistance};
|
|
2161
2624
|
}
|
|
2162
2625
|
|
|
2163
|
-
.
|
|
2164
|
-
.
|
|
2165
|
-
.
|
|
2626
|
+
.od-tooltip-placement-bottom,
|
|
2627
|
+
.od-tooltip-placement-bottomLeft,
|
|
2628
|
+
.od-tooltip-placement-bottomRight {
|
|
2166
2629
|
padding-top: ${paddingDistance};
|
|
2167
2630
|
}
|
|
2168
2631
|
|
|
2169
|
-
.
|
|
2170
|
-
.
|
|
2171
|
-
.
|
|
2632
|
+
.od-tooltip-placement-left,
|
|
2633
|
+
.od-tooltip-placement-leftTop,
|
|
2634
|
+
.od-tooltip-placement-leftBottom {
|
|
2172
2635
|
padding-right: ${paddingDistance};
|
|
2173
2636
|
}
|
|
2174
2637
|
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2638
|
+
/* Placement specific adjustments - position arrows close to content edge */
|
|
2639
|
+
.od-tooltip-placement-top .od-tooltip-arrow,
|
|
2640
|
+
.od-tooltip-placement-topLeft .od-tooltip-arrow,
|
|
2641
|
+
.od-tooltip-placement-topRight .od-tooltip-arrow {
|
|
2642
|
+
bottom: ${arrowDistance};
|
|
2643
|
+
margin-left: -${arrowSize}px;
|
|
2178
2644
|
}
|
|
2179
2645
|
|
|
2180
|
-
.
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2646
|
+
.od-tooltip-placement-right .od-tooltip-arrow,
|
|
2647
|
+
.od-tooltip-placement-rightTop .od-tooltip-arrow,
|
|
2648
|
+
.od-tooltip-placement-rightBottom .od-tooltip-arrow {
|
|
2649
|
+
left: ${arrowDistance};
|
|
2650
|
+
margin-top: -${arrowSize}px;
|
|
2651
|
+
}
|
|
2652
|
+
|
|
2653
|
+
.od-tooltip-placement-left .od-tooltip-arrow,
|
|
2654
|
+
.od-tooltip-placement-leftTop .od-tooltip-arrow,
|
|
2655
|
+
.od-tooltip-placement-leftBottom .od-tooltip-arrow {
|
|
2656
|
+
right: ${arrowDistance};
|
|
2657
|
+
margin-top: -${arrowSize}px;
|
|
2658
|
+
}
|
|
2659
|
+
|
|
2660
|
+
.od-tooltip-placement-bottom .od-tooltip-arrow,
|
|
2661
|
+
.od-tooltip-placement-bottomLeft .od-tooltip-arrow,
|
|
2662
|
+
.od-tooltip-placement-bottomRight .od-tooltip-arrow {
|
|
2663
|
+
top: ${arrowDistance};
|
|
2664
|
+
margin-left: -${arrowSize}px;
|
|
2665
|
+
}
|
|
2666
|
+
|
|
2667
|
+
/* Alignment adjustments */
|
|
2668
|
+
.od-tooltip-placement-topLeft .od-tooltip-arrow,
|
|
2669
|
+
.od-tooltip-placement-bottomLeft .od-tooltip-arrow {
|
|
2670
|
+
left: 15%;
|
|
2671
|
+
}
|
|
2672
|
+
|
|
2673
|
+
.od-tooltip-placement-topRight .od-tooltip-arrow,
|
|
2674
|
+
.od-tooltip-placement-bottomRight .od-tooltip-arrow {
|
|
2675
|
+
right: 15%;
|
|
2676
|
+
}
|
|
2677
|
+
|
|
2678
|
+
.od-tooltip-placement-rightTop .od-tooltip-arrow,
|
|
2679
|
+
.od-tooltip-placement-leftTop .od-tooltip-arrow {
|
|
2680
|
+
top: 15%;
|
|
2681
|
+
}
|
|
2682
|
+
|
|
2683
|
+
.od-tooltip-placement-rightBottom .od-tooltip-arrow,
|
|
2684
|
+
.od-tooltip-placement-leftBottom .od-tooltip-arrow {
|
|
2685
|
+
bottom: 15%;
|
|
2186
2686
|
}
|
|
2187
2687
|
|
|
2188
|
-
.
|
|
2189
|
-
.
|
|
2688
|
+
.od-tooltip.od-tooltip-zoom-enter,
|
|
2689
|
+
.od-tooltip.od-tooltip-zoom-leave {
|
|
2190
2690
|
display: block;
|
|
2191
2691
|
}
|
|
2192
2692
|
|
|
2193
|
-
.
|
|
2194
|
-
.
|
|
2693
|
+
.od-tooltip-zoom-enter,
|
|
2694
|
+
.od-tooltip-zoom-appear {
|
|
2195
2695
|
opacity: 0;
|
|
2196
2696
|
animation-duration: 0.3s;
|
|
2197
2697
|
animation-fill-mode: both;
|
|
@@ -2199,20 +2699,20 @@ var TooltipGlobalStyles = createGlobalStyle`
|
|
|
2199
2699
|
animation-play-state: paused;
|
|
2200
2700
|
}
|
|
2201
2701
|
|
|
2202
|
-
.
|
|
2702
|
+
.od-tooltip-zoom-leave {
|
|
2203
2703
|
animation-duration: 0.3s;
|
|
2204
2704
|
animation-fill-mode: both;
|
|
2205
2705
|
animation-timing-function: cubic-bezier(0.6, -0.3, 0.74, 0.05);
|
|
2206
2706
|
animation-play-state: paused;
|
|
2207
2707
|
}
|
|
2208
2708
|
|
|
2209
|
-
.
|
|
2210
|
-
.
|
|
2709
|
+
.od-tooltip-zoom-enter.od-tooltip-zoom-enter-active,
|
|
2710
|
+
.od-tooltip-zoom-appear.od-tooltip-zoom-appear-active {
|
|
2211
2711
|
animation-name: rcToolTipZoomIn;
|
|
2212
2712
|
animation-play-state: running;
|
|
2213
2713
|
}
|
|
2214
2714
|
|
|
2215
|
-
.
|
|
2715
|
+
.od-tooltip-zoom-leave.od-tooltip-zoom-leave-active {
|
|
2216
2716
|
animation-name: rcToolTipZoomOut;
|
|
2217
2717
|
animation-play-state: running;
|
|
2218
2718
|
}
|
|
@@ -2244,7 +2744,7 @@ var TooltipGlobalStyles = createGlobalStyle`
|
|
|
2244
2744
|
}
|
|
2245
2745
|
|
|
2246
2746
|
/* Black variant */
|
|
2247
|
-
.tooltip-variant-black .
|
|
2747
|
+
.tooltip-variant-black .od-tooltip-inner {
|
|
2248
2748
|
background: ${() => theme.components.tooltip.black.background};
|
|
2249
2749
|
border: 1px solid ${() => theme.components.tooltip.black.borderColor};
|
|
2250
2750
|
color: ${() => theme.components.tooltip.black.color};
|
|
@@ -2259,44 +2759,44 @@ var TooltipGlobalStyles = createGlobalStyle`
|
|
|
2259
2759
|
text-decoration: none;
|
|
2260
2760
|
}
|
|
2261
2761
|
|
|
2262
|
-
.tooltip-variant-black.
|
|
2263
|
-
.tooltip-variant-black.
|
|
2264
|
-
.tooltip-variant-black.
|
|
2265
|
-
bottom: ${
|
|
2266
|
-
margin-left:
|
|
2267
|
-
border-width:
|
|
2762
|
+
.tooltip-variant-black.od-tooltip-placement-top .od-tooltip-arrow,
|
|
2763
|
+
.tooltip-variant-black.od-tooltip-placement-topLeft .od-tooltip-arrow,
|
|
2764
|
+
.tooltip-variant-black.od-tooltip-placement-topRight .od-tooltip-arrow {
|
|
2765
|
+
bottom: ${arrowDistance};
|
|
2766
|
+
margin-left: -${arrowSize}px;
|
|
2767
|
+
border-width: ${arrowSize}px ${arrowSize}px 0;
|
|
2268
2768
|
border-top-color: ${() => theme.components.tooltip.black.background};
|
|
2269
2769
|
}
|
|
2270
2770
|
|
|
2271
|
-
.tooltip-variant-black.
|
|
2272
|
-
.tooltip-variant-black.
|
|
2273
|
-
.tooltip-variant-black.
|
|
2274
|
-
left: ${
|
|
2275
|
-
margin-top:
|
|
2276
|
-
border-width:
|
|
2771
|
+
.tooltip-variant-black.od-tooltip-placement-right .od-tooltip-arrow,
|
|
2772
|
+
.tooltip-variant-black.od-tooltip-placement-rightTop .od-tooltip-arrow,
|
|
2773
|
+
.tooltip-variant-black.od-tooltip-placement-rightBottom .od-tooltip-arrow {
|
|
2774
|
+
left: ${arrowDistance};
|
|
2775
|
+
margin-top: -${arrowSize}px;
|
|
2776
|
+
border-width: ${arrowSize}px ${arrowSize}px ${arrowSize}px 0;
|
|
2277
2777
|
border-right-color: ${() => theme.components.tooltip.black.background};
|
|
2278
2778
|
}
|
|
2279
2779
|
|
|
2280
|
-
.tooltip-variant-black.
|
|
2281
|
-
.tooltip-variant-black.
|
|
2282
|
-
.tooltip-variant-black.
|
|
2283
|
-
right: ${
|
|
2284
|
-
margin-top:
|
|
2285
|
-
border-width:
|
|
2780
|
+
.tooltip-variant-black.od-tooltip-placement-left .od-tooltip-arrow,
|
|
2781
|
+
.tooltip-variant-black.od-tooltip-placement-leftTop .od-tooltip-arrow,
|
|
2782
|
+
.tooltip-variant-black.od-tooltip-placement-leftBottom .od-tooltip-arrow {
|
|
2783
|
+
right: ${arrowDistance};
|
|
2784
|
+
margin-top: -${arrowSize}px;
|
|
2785
|
+
border-width: ${arrowSize}px 0 ${arrowSize}px ${arrowSize}px;
|
|
2286
2786
|
border-left-color: ${() => theme.components.tooltip.black.background};
|
|
2287
2787
|
}
|
|
2288
2788
|
|
|
2289
|
-
.tooltip-variant-black.
|
|
2290
|
-
.tooltip-variant-black.
|
|
2291
|
-
.tooltip-variant-black.
|
|
2292
|
-
top: ${
|
|
2293
|
-
margin-left:
|
|
2294
|
-
border-width: 0
|
|
2789
|
+
.tooltip-variant-black.od-tooltip-placement-bottom .od-tooltip-arrow,
|
|
2790
|
+
.tooltip-variant-black.od-tooltip-placement-bottomLeft .od-tooltip-arrow,
|
|
2791
|
+
.tooltip-variant-black.od-tooltip-placement-bottomRight .od-tooltip-arrow {
|
|
2792
|
+
top: ${arrowDistance};
|
|
2793
|
+
margin-left: -${arrowSize}px;
|
|
2794
|
+
border-width: 0 ${arrowSize}px ${arrowSize}px;
|
|
2295
2795
|
border-bottom-color: ${() => theme.components.tooltip.black.background};
|
|
2296
2796
|
}
|
|
2297
2797
|
|
|
2298
2798
|
/* White variant - small size */
|
|
2299
|
-
.tooltip-variant-white.tooltip-size-small .
|
|
2799
|
+
.tooltip-variant-white.tooltip-size-small .od-tooltip-inner {
|
|
2300
2800
|
background: ${() => theme.components.tooltip.white.small.background};
|
|
2301
2801
|
border: 1px solid ${() => theme.components.tooltip.white.small.borderColor};
|
|
2302
2802
|
color: ${() => theme.components.tooltip.white.small.color};
|
|
@@ -2310,44 +2810,44 @@ var TooltipGlobalStyles = createGlobalStyle`
|
|
|
2310
2810
|
text-decoration: none;
|
|
2311
2811
|
}
|
|
2312
2812
|
|
|
2313
|
-
.tooltip-variant-white.tooltip-size-small.
|
|
2314
|
-
.tooltip-variant-white.tooltip-size-small.
|
|
2315
|
-
.tooltip-variant-white.tooltip-size-small.
|
|
2316
|
-
bottom: ${
|
|
2317
|
-
margin-left:
|
|
2318
|
-
border-width:
|
|
2813
|
+
.tooltip-variant-white.tooltip-size-small.od-tooltip-placement-top .od-tooltip-arrow,
|
|
2814
|
+
.tooltip-variant-white.tooltip-size-small.od-tooltip-placement-topLeft .od-tooltip-arrow,
|
|
2815
|
+
.tooltip-variant-white.tooltip-size-small.od-tooltip-placement-topRight .od-tooltip-arrow {
|
|
2816
|
+
bottom: ${arrowDistance};
|
|
2817
|
+
margin-left: -${arrowSize}px;
|
|
2818
|
+
border-width: ${arrowSize}px ${arrowSize}px 0;
|
|
2319
2819
|
border-top-color: ${() => theme.components.tooltip.white.small.background};
|
|
2320
2820
|
}
|
|
2321
2821
|
|
|
2322
|
-
.tooltip-variant-white.tooltip-size-small.
|
|
2323
|
-
.tooltip-variant-white.tooltip-size-small.
|
|
2324
|
-
.tooltip-variant-white.tooltip-size-small.
|
|
2325
|
-
left: ${
|
|
2326
|
-
margin-top:
|
|
2327
|
-
border-width:
|
|
2822
|
+
.tooltip-variant-white.tooltip-size-small.od-tooltip-placement-right .od-tooltip-arrow,
|
|
2823
|
+
.tooltip-variant-white.tooltip-size-small.od-tooltip-placement-rightTop .od-tooltip-arrow,
|
|
2824
|
+
.tooltip-variant-white.tooltip-size-small.od-tooltip-placement-rightBottom .od-tooltip-arrow {
|
|
2825
|
+
left: ${arrowDistance};
|
|
2826
|
+
margin-top: -${arrowSize}px;
|
|
2827
|
+
border-width: ${arrowSize}px ${arrowSize}px ${arrowSize}px 0;
|
|
2328
2828
|
border-right-color: ${() => theme.components.tooltip.white.small.background};
|
|
2329
2829
|
}
|
|
2330
2830
|
|
|
2331
|
-
.tooltip-variant-white.tooltip-size-small.
|
|
2332
|
-
.tooltip-variant-white.tooltip-size-small.
|
|
2333
|
-
.tooltip-variant-white.tooltip-size-small.
|
|
2334
|
-
right: ${
|
|
2335
|
-
margin-top:
|
|
2336
|
-
border-width:
|
|
2831
|
+
.tooltip-variant-white.tooltip-size-small.od-tooltip-placement-left .od-tooltip-arrow,
|
|
2832
|
+
.tooltip-variant-white.tooltip-size-small.od-tooltip-placement-leftTop .od-tooltip-arrow,
|
|
2833
|
+
.tooltip-variant-white.tooltip-size-small.od-tooltip-placement-leftBottom .od-tooltip-arrow {
|
|
2834
|
+
right: ${arrowDistance};
|
|
2835
|
+
margin-top: -${arrowSize}px;
|
|
2836
|
+
border-width: ${arrowSize}px 0 ${arrowSize}px ${arrowSize}px;
|
|
2337
2837
|
border-left-color: ${() => theme.components.tooltip.white.small.background};
|
|
2338
2838
|
}
|
|
2339
2839
|
|
|
2340
|
-
.tooltip-variant-white.tooltip-size-small.
|
|
2341
|
-
.tooltip-variant-white.tooltip-size-small.
|
|
2342
|
-
.tooltip-variant-white.tooltip-size-small.
|
|
2343
|
-
top: ${
|
|
2344
|
-
margin-left:
|
|
2345
|
-
border-width: 0
|
|
2840
|
+
.tooltip-variant-white.tooltip-size-small.od-tooltip-placement-bottom .od-tooltip-arrow,
|
|
2841
|
+
.tooltip-variant-white.tooltip-size-small.od-tooltip-placement-bottomLeft .od-tooltip-arrow,
|
|
2842
|
+
.tooltip-variant-white.tooltip-size-small.od-tooltip-placement-bottomRight .od-tooltip-arrow {
|
|
2843
|
+
top: ${arrowDistance};
|
|
2844
|
+
margin-left: -${arrowSize}px;
|
|
2845
|
+
border-width: 0 ${arrowSize}px ${arrowSize}px;
|
|
2346
2846
|
border-bottom-color: ${() => theme.components.tooltip.white.small.background};
|
|
2347
2847
|
}
|
|
2348
2848
|
|
|
2349
2849
|
/* White variant - large size */
|
|
2350
|
-
.tooltip-variant-white.tooltip-size-large .
|
|
2850
|
+
.tooltip-variant-white.tooltip-size-large .od-tooltip-inner {
|
|
2351
2851
|
background: ${() => theme.components.tooltip.white.large.background};
|
|
2352
2852
|
border: 1px solid ${() => theme.components.tooltip.white.large.borderColor};
|
|
2353
2853
|
color: ${() => theme.components.tooltip.white.large.color};
|
|
@@ -2361,42 +2861,45 @@ var TooltipGlobalStyles = createGlobalStyle`
|
|
|
2361
2861
|
text-decoration: none;
|
|
2362
2862
|
}
|
|
2363
2863
|
|
|
2364
|
-
.tooltip-variant-white.tooltip-size-large.
|
|
2365
|
-
.tooltip-variant-white.tooltip-size-large.
|
|
2366
|
-
.tooltip-variant-white.tooltip-size-large.
|
|
2367
|
-
bottom: ${
|
|
2368
|
-
margin-left:
|
|
2369
|
-
border-width:
|
|
2370
|
-
border-top-color: ${() => theme.components.tooltip.white.large.
|
|
2864
|
+
.tooltip-variant-white.tooltip-size-large.od-tooltip-placement-top .od-tooltip-arrow,
|
|
2865
|
+
.tooltip-variant-white.tooltip-size-large.od-tooltip-placement-topLeft .od-tooltip-arrow,
|
|
2866
|
+
.tooltip-variant-white.tooltip-size-large.od-tooltip-placement-topRight .od-tooltip-arrow {
|
|
2867
|
+
bottom: ${arrowDistance};
|
|
2868
|
+
margin-left: -${arrowSize}px;
|
|
2869
|
+
border-width: ${arrowSize}px ${arrowSize}px 0;
|
|
2870
|
+
border-top-color: ${() => theme.components.tooltip.white.large.borderColor};
|
|
2371
2871
|
}
|
|
2372
2872
|
|
|
2373
|
-
.tooltip-variant-white.tooltip-size-large.
|
|
2374
|
-
.tooltip-variant-white.tooltip-size-large.
|
|
2375
|
-
.tooltip-variant-white.tooltip-size-large.
|
|
2376
|
-
left: ${
|
|
2377
|
-
margin-top:
|
|
2378
|
-
border-width:
|
|
2873
|
+
.tooltip-variant-white.tooltip-size-large.od-tooltip-placement-right .od-tooltip-arrow,
|
|
2874
|
+
.tooltip-variant-white.tooltip-size-large.od-tooltip-placement-rightTop .od-tooltip-arrow,
|
|
2875
|
+
.tooltip-variant-white.tooltip-size-large.od-tooltip-placement-rightBottom .od-tooltip-arrow {
|
|
2876
|
+
left: ${arrowDistance};
|
|
2877
|
+
margin-top: -${arrowSize}px;
|
|
2878
|
+
border-width: ${arrowSize}px ${arrowSize}px ${arrowSize}px 0;
|
|
2379
2879
|
border-right-color: ${() => theme.components.tooltip.white.large.background};
|
|
2380
2880
|
}
|
|
2381
2881
|
|
|
2382
|
-
.tooltip-variant-white.tooltip-size-large.
|
|
2383
|
-
.tooltip-variant-white.tooltip-size-large.
|
|
2384
|
-
.tooltip-variant-white.tooltip-size-large.
|
|
2385
|
-
right: ${
|
|
2386
|
-
margin-top:
|
|
2387
|
-
border-width:
|
|
2882
|
+
.tooltip-variant-white.tooltip-size-large.od-tooltip-placement-left .od-tooltip-arrow,
|
|
2883
|
+
.tooltip-variant-white.tooltip-size-large.od-tooltip-placement-leftTop .od-tooltip-arrow,
|
|
2884
|
+
.tooltip-variant-white.tooltip-size-large.od-tooltip-placement-leftBottom .od-tooltip-arrow {
|
|
2885
|
+
right: ${arrowDistance};
|
|
2886
|
+
margin-top: -${arrowSize}px;
|
|
2887
|
+
border-width: ${arrowSize}px 0 ${arrowSize}px ${arrowSize}px;
|
|
2388
2888
|
border-left-color: ${() => theme.components.tooltip.white.large.background};
|
|
2389
2889
|
}
|
|
2390
2890
|
|
|
2391
|
-
.tooltip-variant-white.tooltip-size-large.
|
|
2392
|
-
.tooltip-variant-white.tooltip-size-large.
|
|
2393
|
-
.tooltip-variant-white.tooltip-size-large.
|
|
2394
|
-
top: ${
|
|
2395
|
-
margin-left:
|
|
2396
|
-
border-width: 0
|
|
2891
|
+
.tooltip-variant-white.tooltip-size-large.od-tooltip-placement-bottom .od-tooltip-arrow,
|
|
2892
|
+
.tooltip-variant-white.tooltip-size-large.od-tooltip-placement-bottomLeft .od-tooltip-arrow,
|
|
2893
|
+
.tooltip-variant-white.tooltip-size-large.od-tooltip-placement-bottomRight .od-tooltip-arrow {
|
|
2894
|
+
top: ${arrowDistance};
|
|
2895
|
+
margin-left: -${arrowSize}px;
|
|
2896
|
+
border-width: 0 ${arrowSize}px ${arrowSize}px;
|
|
2397
2897
|
border-bottom-color: ${() => theme.components.tooltip.white.large.background};
|
|
2398
2898
|
}
|
|
2399
2899
|
`;
|
|
2900
|
+
|
|
2901
|
+
// src/ToolbarButton/ToolbarButton.tsx
|
|
2902
|
+
init_styled();
|
|
2400
2903
|
var ToolbarButtonContainer = styled.div`
|
|
2401
2904
|
display: inline-flex;
|
|
2402
2905
|
align-items: center;
|
|
@@ -2628,7 +3131,7 @@ var Divider = styled.div`
|
|
|
2628
3131
|
`;
|
|
2629
3132
|
}}
|
|
2630
3133
|
`;
|
|
2631
|
-
var ArrowIcon = () => /* @__PURE__ */
|
|
3134
|
+
var ArrowIcon = () => /* @__PURE__ */ React3.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none" }, /* @__PURE__ */ React3.createElement(
|
|
2632
3135
|
"path",
|
|
2633
3136
|
{
|
|
2634
3137
|
d: "M8.1858 9.79353C8.08649 9.90387 7.91346 9.90387 7.81415 9.79353L4.77549 6.41724C4.6307 6.25636 4.74487 6 4.96132 6L11.0386 6C11.2551 6 11.3693 6.25636 11.2245 6.41724L8.1858 9.79353Z",
|
|
@@ -2658,7 +3161,7 @@ var ToolbarButton = ({
|
|
|
2658
3161
|
onDropdownClick?.(e);
|
|
2659
3162
|
};
|
|
2660
3163
|
if (!splitDropdown && hasDropdown) {
|
|
2661
|
-
return /* @__PURE__ */
|
|
3164
|
+
return /* @__PURE__ */ React3.createElement(
|
|
2662
3165
|
ToolbarButtonContainer,
|
|
2663
3166
|
{
|
|
2664
3167
|
className,
|
|
@@ -2666,7 +3169,7 @@ var ToolbarButton = ({
|
|
|
2666
3169
|
$disabled: disabled,
|
|
2667
3170
|
$active: active
|
|
2668
3171
|
},
|
|
2669
|
-
/* @__PURE__ */
|
|
3172
|
+
/* @__PURE__ */ React3.createElement(
|
|
2670
3173
|
MainButton,
|
|
2671
3174
|
{
|
|
2672
3175
|
$disabled: disabled,
|
|
@@ -2675,14 +3178,14 @@ var ToolbarButton = ({
|
|
|
2675
3178
|
onClick: handleMainClick,
|
|
2676
3179
|
disabled
|
|
2677
3180
|
},
|
|
2678
|
-
icon && /* @__PURE__ */
|
|
2679
|
-
label && /* @__PURE__ */
|
|
2680
|
-
/* @__PURE__ */
|
|
3181
|
+
icon && /* @__PURE__ */ React3.createElement(IconWrapper4, { $disabled: disabled }, icon),
|
|
3182
|
+
label && /* @__PURE__ */ React3.createElement(LabelText, { $disabled: disabled }, label),
|
|
3183
|
+
/* @__PURE__ */ React3.createElement(DropdownArrow, { $disabled: disabled }, /* @__PURE__ */ React3.createElement(ArrowIcon, null))
|
|
2681
3184
|
)
|
|
2682
3185
|
);
|
|
2683
3186
|
}
|
|
2684
3187
|
if (splitDropdown && hasDropdown) {
|
|
2685
|
-
return /* @__PURE__ */
|
|
3188
|
+
return /* @__PURE__ */ React3.createElement(
|
|
2686
3189
|
ToolbarButtonContainer,
|
|
2687
3190
|
{
|
|
2688
3191
|
className,
|
|
@@ -2690,7 +3193,7 @@ var ToolbarButton = ({
|
|
|
2690
3193
|
$disabled: disabled,
|
|
2691
3194
|
$active: active
|
|
2692
3195
|
},
|
|
2693
|
-
/* @__PURE__ */
|
|
3196
|
+
/* @__PURE__ */ React3.createElement(
|
|
2694
3197
|
MainButton,
|
|
2695
3198
|
{
|
|
2696
3199
|
$disabled: disabled,
|
|
@@ -2699,11 +3202,11 @@ var ToolbarButton = ({
|
|
|
2699
3202
|
onClick: handleMainClick,
|
|
2700
3203
|
disabled
|
|
2701
3204
|
},
|
|
2702
|
-
icon && /* @__PURE__ */
|
|
2703
|
-
label && /* @__PURE__ */
|
|
3205
|
+
icon && /* @__PURE__ */ React3.createElement(IconWrapper4, { $disabled: disabled }, icon),
|
|
3206
|
+
label && /* @__PURE__ */ React3.createElement(LabelText, { $disabled: disabled }, label)
|
|
2704
3207
|
),
|
|
2705
|
-
/* @__PURE__ */
|
|
2706
|
-
/* @__PURE__ */
|
|
3208
|
+
/* @__PURE__ */ React3.createElement(Divider, { $disabled: disabled, $active: active }),
|
|
3209
|
+
/* @__PURE__ */ React3.createElement(
|
|
2707
3210
|
DropdownButton,
|
|
2708
3211
|
{
|
|
2709
3212
|
$disabled: disabled,
|
|
@@ -2712,11 +3215,11 @@ var ToolbarButton = ({
|
|
|
2712
3215
|
onClick: handleDropdownClick,
|
|
2713
3216
|
disabled
|
|
2714
3217
|
},
|
|
2715
|
-
/* @__PURE__ */
|
|
3218
|
+
/* @__PURE__ */ React3.createElement(DropdownArrow, { $disabled: disabled }, /* @__PURE__ */ React3.createElement(ArrowIcon, null))
|
|
2716
3219
|
)
|
|
2717
3220
|
);
|
|
2718
3221
|
}
|
|
2719
|
-
return /* @__PURE__ */
|
|
3222
|
+
return /* @__PURE__ */ React3.createElement(
|
|
2720
3223
|
ToolbarButtonContainer,
|
|
2721
3224
|
{
|
|
2722
3225
|
className,
|
|
@@ -2724,7 +3227,7 @@ var ToolbarButton = ({
|
|
|
2724
3227
|
$disabled: disabled,
|
|
2725
3228
|
$active: active
|
|
2726
3229
|
},
|
|
2727
|
-
/* @__PURE__ */
|
|
3230
|
+
/* @__PURE__ */ React3.createElement(
|
|
2728
3231
|
MainButton,
|
|
2729
3232
|
{
|
|
2730
3233
|
$disabled: disabled,
|
|
@@ -2733,22 +3236,38 @@ var ToolbarButton = ({
|
|
|
2733
3236
|
onClick: handleMainClick,
|
|
2734
3237
|
disabled
|
|
2735
3238
|
},
|
|
2736
|
-
icon && /* @__PURE__ */
|
|
2737
|
-
label && /* @__PURE__ */
|
|
3239
|
+
icon && /* @__PURE__ */ React3.createElement(IconWrapper4, { $disabled: disabled }, icon),
|
|
3240
|
+
label && /* @__PURE__ */ React3.createElement(LabelText, { $disabled: disabled }, label)
|
|
2738
3241
|
)
|
|
2739
3242
|
);
|
|
2740
3243
|
};
|
|
2741
3244
|
ToolbarButton.displayName = "ToolbarButton";
|
|
3245
|
+
|
|
3246
|
+
// src/UIConfigProvider/UIConfigProvider.tsx
|
|
3247
|
+
init_IconProvider();
|
|
3248
|
+
init_context();
|
|
2742
3249
|
var UIConfigContext = createContext(null);
|
|
2743
3250
|
var UIConfigProvider = ({ config, children }) => {
|
|
2744
|
-
|
|
2745
|
-
const
|
|
3251
|
+
const { icons = {}, toast: toast2 = {} } = config;
|
|
3252
|
+
const renderFunction = (element, container) => {
|
|
3253
|
+
if ("createRoot" in ReactDOM) {
|
|
3254
|
+
const { createRoot } = ReactDOM;
|
|
3255
|
+
const root = createRoot(container);
|
|
3256
|
+
root.render(element);
|
|
3257
|
+
} else {
|
|
3258
|
+
ReactDOM.render(element, container);
|
|
3259
|
+
}
|
|
3260
|
+
};
|
|
3261
|
+
registerGlobalContext({
|
|
3262
|
+
theme: config.theme,
|
|
3263
|
+
render: renderFunction
|
|
3264
|
+
});
|
|
2746
3265
|
const toastConfig = {
|
|
2747
|
-
maxCount:
|
|
2748
|
-
defaultDuration:
|
|
3266
|
+
maxCount: toast2.maxCount ?? 5,
|
|
3267
|
+
defaultDuration: toast2.defaultDuration ?? 3e3
|
|
2749
3268
|
};
|
|
2750
3269
|
const TooltipStyles = TooltipGlobalStyles;
|
|
2751
|
-
return /* @__PURE__ */
|
|
3270
|
+
return /* @__PURE__ */ React3.createElement(UIConfigContext.Provider, { value: config }, /* @__PURE__ */ React3.createElement(TooltipStyles, null), /* @__PURE__ */ React3.createElement(IconProvider, { icons }, /* @__PURE__ */ React3.createElement(
|
|
2752
3271
|
ToastContainer2,
|
|
2753
3272
|
{
|
|
2754
3273
|
maxCount: toastConfig.maxCount,
|
|
@@ -2833,6 +3352,10 @@ var mergeUIConfig = (baseConfig, ...configs) => {
|
|
|
2833
3352
|
return merged;
|
|
2834
3353
|
};
|
|
2835
3354
|
|
|
2836
|
-
|
|
3355
|
+
// src/index.ts
|
|
3356
|
+
init_styled();
|
|
3357
|
+
init_context();
|
|
3358
|
+
|
|
3359
|
+
export { Button, Checkbox, Icon, IconProvider, Input, NumberInput, Radio, SearchInput, Slider, SpinButton, Switch, Tabs, Toast, ToastContainer2 as ToastContainer, ToolbarButton, Tooltip, UIConfigProvider, createUIConfig, getGlobalTheme, mergeUIConfig, styled, toast, useIconRegistry, useToast, useUIConfig };
|
|
2837
3360
|
//# sourceMappingURL=index.js.map
|
|
2838
3361
|
//# sourceMappingURL=index.js.map
|