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