@ttoss/ui 6.0.3 → 6.1.0
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/package.json +7 -7
- package/dist/esm/index.js +0 -1353
- package/dist/index.d.ts +0 -238
package/dist/esm/index.js
DELETED
|
@@ -1,1353 +0,0 @@
|
|
|
1
|
-
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", {
|
|
5
|
-
value,
|
|
6
|
-
configurable: true
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
// src/components/Button.tsx
|
|
10
|
-
import { Icon } from "@ttoss/react-icons";
|
|
11
|
-
import * as React2 from "react";
|
|
12
|
-
import { Button as ButtonUi } from "theme-ui";
|
|
13
|
-
var Button = /* @__PURE__ */React2.forwardRef((props, ref) => {
|
|
14
|
-
const {
|
|
15
|
-
children,
|
|
16
|
-
leftIcon,
|
|
17
|
-
rightIcon,
|
|
18
|
-
loading,
|
|
19
|
-
...restProps
|
|
20
|
-
} = props;
|
|
21
|
-
return /* @__PURE__ */React2.createElement(ButtonUi, {
|
|
22
|
-
type: "button",
|
|
23
|
-
...restProps,
|
|
24
|
-
ref,
|
|
25
|
-
sx: {
|
|
26
|
-
cursor: "pointer",
|
|
27
|
-
paddingX: "6",
|
|
28
|
-
paddingY: "4",
|
|
29
|
-
fontFamily: "body",
|
|
30
|
-
display: "inline-flex",
|
|
31
|
-
alignItems: "center",
|
|
32
|
-
gap: "4",
|
|
33
|
-
"&:disabled": {
|
|
34
|
-
cursor: "not-allowed"
|
|
35
|
-
},
|
|
36
|
-
...restProps.sx
|
|
37
|
-
}
|
|
38
|
-
}, loading && /* @__PURE__ */React2.createElement(Icon, {
|
|
39
|
-
inline: true,
|
|
40
|
-
icon: "three-dots-loading"
|
|
41
|
-
}), !loading && leftIcon && /* @__PURE__ */React2.createElement(Icon, {
|
|
42
|
-
inline: true,
|
|
43
|
-
icon: leftIcon
|
|
44
|
-
}), children, rightIcon && /* @__PURE__ */React2.createElement(Icon, {
|
|
45
|
-
inline: true,
|
|
46
|
-
icon: rightIcon
|
|
47
|
-
}));
|
|
48
|
-
});
|
|
49
|
-
Button.displayName = "Button";
|
|
50
|
-
|
|
51
|
-
// src/components/ActionButton.tsx
|
|
52
|
-
var ActionButton = /* @__PURE__ */__name(({
|
|
53
|
-
icon,
|
|
54
|
-
variant = "default",
|
|
55
|
-
sx,
|
|
56
|
-
...props
|
|
57
|
-
}) => {
|
|
58
|
-
const variantStyles = {
|
|
59
|
-
default: {
|
|
60
|
-
backgroundColor: "action.background.secondary.default",
|
|
61
|
-
color: "action.text.primary.default",
|
|
62
|
-
border: "sm",
|
|
63
|
-
borderColor: "action.background.primary.default",
|
|
64
|
-
transition: "all 0.2s",
|
|
65
|
-
":is(:focus-within, :hover):not(:disabled)": {
|
|
66
|
-
backgroundColor: "action.background.secondary.active",
|
|
67
|
-
borderColor: "action.border.secondary.active",
|
|
68
|
-
color: "action.text.secondary.active"
|
|
69
|
-
},
|
|
70
|
-
":disabled": {
|
|
71
|
-
cursor: "default",
|
|
72
|
-
backgroundColor: "action.background.muted.default",
|
|
73
|
-
borderColor: "action.border.muted.default",
|
|
74
|
-
color: "action.text.muted.default"
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
accent: {
|
|
78
|
-
backgroundColor: "action.background.accent.default",
|
|
79
|
-
color: "action.text.accent.default",
|
|
80
|
-
border: "none",
|
|
81
|
-
":disabled": {
|
|
82
|
-
cursor: "default",
|
|
83
|
-
backgroundColor: "action.background.muted.default",
|
|
84
|
-
color: "action.text.muted.default"
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
quiet: {
|
|
88
|
-
backgroundColor: "action.background.muted.default",
|
|
89
|
-
color: "action.text.accent.default",
|
|
90
|
-
border: "none",
|
|
91
|
-
borderColor: "transparent",
|
|
92
|
-
":disabled": {
|
|
93
|
-
cursor: "default",
|
|
94
|
-
opacity: 0.6,
|
|
95
|
-
color: "action.text.muted.default"
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
return /* @__PURE__ */React.createElement(Button, {
|
|
100
|
-
leftIcon: icon,
|
|
101
|
-
sx: {
|
|
102
|
-
paddingY: "2",
|
|
103
|
-
paddingX: "4",
|
|
104
|
-
// Apply variant-specific styles
|
|
105
|
-
...variantStyles[variant],
|
|
106
|
-
...sx
|
|
107
|
-
},
|
|
108
|
-
...props
|
|
109
|
-
});
|
|
110
|
-
}, "ActionButton");
|
|
111
|
-
|
|
112
|
-
// src/components/Badge.tsx
|
|
113
|
-
import { Icon as Icon2 } from "@ttoss/react-icons";
|
|
114
|
-
import { Badge as BadgeUi } from "theme-ui";
|
|
115
|
-
|
|
116
|
-
// src/components/Text.tsx
|
|
117
|
-
import { Text } from "theme-ui";
|
|
118
|
-
|
|
119
|
-
// src/components/Badge.tsx
|
|
120
|
-
var Badge = /* @__PURE__ */__name(({
|
|
121
|
-
icon,
|
|
122
|
-
children,
|
|
123
|
-
sx,
|
|
124
|
-
chip,
|
|
125
|
-
onDelete,
|
|
126
|
-
...props
|
|
127
|
-
}) => {
|
|
128
|
-
return /* @__PURE__ */React.createElement(BadgeUi, {
|
|
129
|
-
sx: {
|
|
130
|
-
display: "flex",
|
|
131
|
-
alignItems: "center",
|
|
132
|
-
fontFamily: "body",
|
|
133
|
-
fontWeight: "normal",
|
|
134
|
-
lineHeight: "base",
|
|
135
|
-
fontSize: "sm",
|
|
136
|
-
paddingX: "2",
|
|
137
|
-
borderRadius: "informative",
|
|
138
|
-
paddingY: "1",
|
|
139
|
-
gap: "2",
|
|
140
|
-
...sx
|
|
141
|
-
},
|
|
142
|
-
...props
|
|
143
|
-
}, icon && /* @__PURE__ */React.createElement(Icon2, {
|
|
144
|
-
inline: true,
|
|
145
|
-
icon
|
|
146
|
-
}), children, chip && /* @__PURE__ */React.createElement(Text, {
|
|
147
|
-
sx: {
|
|
148
|
-
cursor: "pointer",
|
|
149
|
-
lineHeight: 0,
|
|
150
|
-
color: "currentcolor",
|
|
151
|
-
alignSelf: "center"
|
|
152
|
-
}
|
|
153
|
-
}, /* @__PURE__ */React.createElement(Icon2, {
|
|
154
|
-
onClick: onDelete,
|
|
155
|
-
inline: true,
|
|
156
|
-
icon: "close"
|
|
157
|
-
})));
|
|
158
|
-
}, "Badge");
|
|
159
|
-
|
|
160
|
-
// src/components/Box.tsx
|
|
161
|
-
import { Box } from "theme-ui";
|
|
162
|
-
|
|
163
|
-
// src/components/Card.tsx
|
|
164
|
-
import * as React3 from "react";
|
|
165
|
-
import { Box as Box2, Card as CardUi } from "theme-ui";
|
|
166
|
-
var Card = /* @__PURE__ */__name(props => {
|
|
167
|
-
return /* @__PURE__ */React3.createElement(CardUi, {
|
|
168
|
-
...props,
|
|
169
|
-
sx: {
|
|
170
|
-
backgroundColor: "display.background.secondary.default",
|
|
171
|
-
border: "md",
|
|
172
|
-
borderColor: "display.border.muted.default",
|
|
173
|
-
borderRadius: "lg",
|
|
174
|
-
display: "flex",
|
|
175
|
-
flexDirection: "column",
|
|
176
|
-
alignItems: "center",
|
|
177
|
-
width: "fit-content",
|
|
178
|
-
boxShadow: "2px 4px 8px #E5E7EB",
|
|
179
|
-
...props.sx
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
}, "Card");
|
|
183
|
-
var CardTitle = /* @__PURE__ */__name(({
|
|
184
|
-
children,
|
|
185
|
-
...props
|
|
186
|
-
}) => {
|
|
187
|
-
return /* @__PURE__ */React3.createElement(Box2, {
|
|
188
|
-
...props,
|
|
189
|
-
sx: {
|
|
190
|
-
paddingY: "4",
|
|
191
|
-
paddingX: "8",
|
|
192
|
-
width: "full",
|
|
193
|
-
borderBottom: "md",
|
|
194
|
-
borderBottomColor: "display.border.muted.default",
|
|
195
|
-
...props.sx
|
|
196
|
-
}
|
|
197
|
-
}, children);
|
|
198
|
-
}, "CardTitle");
|
|
199
|
-
var CardBody = /* @__PURE__ */__name(({
|
|
200
|
-
children,
|
|
201
|
-
...props
|
|
202
|
-
}) => {
|
|
203
|
-
return /* @__PURE__ */React3.createElement(Box2, {
|
|
204
|
-
...props,
|
|
205
|
-
sx: {
|
|
206
|
-
paddingY: "4",
|
|
207
|
-
paddingX: "8",
|
|
208
|
-
width: "full",
|
|
209
|
-
backgroundColor: "display.background.muted.default",
|
|
210
|
-
...props.sx
|
|
211
|
-
}
|
|
212
|
-
}, children);
|
|
213
|
-
}, "CardBody");
|
|
214
|
-
var CardFooter = /* @__PURE__ */__name(({
|
|
215
|
-
children,
|
|
216
|
-
...props
|
|
217
|
-
}) => {
|
|
218
|
-
return /* @__PURE__ */React3.createElement(Box2, {
|
|
219
|
-
...props,
|
|
220
|
-
sx: {
|
|
221
|
-
paddingY: "2",
|
|
222
|
-
paddingX: "8",
|
|
223
|
-
width: "full",
|
|
224
|
-
...props.sx
|
|
225
|
-
}
|
|
226
|
-
}, children);
|
|
227
|
-
}, "CardFooter");
|
|
228
|
-
Card.Title = CardTitle;
|
|
229
|
-
Card.Body = CardBody;
|
|
230
|
-
Card.Footer = CardFooter;
|
|
231
|
-
|
|
232
|
-
// src/components/Checkbox.tsx
|
|
233
|
-
import * as React4 from "react";
|
|
234
|
-
import { Checkbox as CheckBoxUi } from "theme-ui";
|
|
235
|
-
var Checkbox = /* @__PURE__ */React4.forwardRef(({
|
|
236
|
-
indeterminate = false,
|
|
237
|
-
...rest
|
|
238
|
-
}, ref) => {
|
|
239
|
-
const innerRef = React4.useRef(null);
|
|
240
|
-
const setRefs = React4.useCallback(element => {
|
|
241
|
-
innerRef.current = element;
|
|
242
|
-
if (typeof ref === "function") {
|
|
243
|
-
ref(element);
|
|
244
|
-
} else if (ref) {
|
|
245
|
-
ref.current = element;
|
|
246
|
-
}
|
|
247
|
-
}, [ref]);
|
|
248
|
-
React4.useEffect(() => {
|
|
249
|
-
if (innerRef.current) {
|
|
250
|
-
innerRef.current.indeterminate = indeterminate;
|
|
251
|
-
}
|
|
252
|
-
}, [indeterminate]);
|
|
253
|
-
if (indeterminate) {
|
|
254
|
-
return /* @__PURE__ */React4.createElement("input", {
|
|
255
|
-
type: "checkbox",
|
|
256
|
-
ref: setRefs,
|
|
257
|
-
...rest
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
return /* @__PURE__ */React4.createElement(CheckBoxUi, {
|
|
261
|
-
ref: setRefs,
|
|
262
|
-
...rest
|
|
263
|
-
});
|
|
264
|
-
});
|
|
265
|
-
Checkbox.displayName = "Checkbox";
|
|
266
|
-
|
|
267
|
-
// src/components/CloseButton.tsx
|
|
268
|
-
import { Close as CloseUI } from "theme-ui";
|
|
269
|
-
var CloseButton = /* @__PURE__ */__name(props => {
|
|
270
|
-
return /* @__PURE__ */React.createElement(CloseUI, {
|
|
271
|
-
type: "button",
|
|
272
|
-
"aria-label": props.ariaLabel,
|
|
273
|
-
sx: {
|
|
274
|
-
...props.sx
|
|
275
|
-
},
|
|
276
|
-
...props
|
|
277
|
-
});
|
|
278
|
-
}, "CloseButton");
|
|
279
|
-
|
|
280
|
-
// src/components/Container.tsx
|
|
281
|
-
import * as React5 from "react";
|
|
282
|
-
import { Container as ContainerUi } from "theme-ui";
|
|
283
|
-
var Container = /* @__PURE__ */React5.forwardRef((props, ref) => {
|
|
284
|
-
return /* @__PURE__ */React5.createElement(ContainerUi, {
|
|
285
|
-
ref,
|
|
286
|
-
...props
|
|
287
|
-
});
|
|
288
|
-
});
|
|
289
|
-
Container.displayName = "Container";
|
|
290
|
-
|
|
291
|
-
// src/components/Divider.tsx
|
|
292
|
-
import { Divider } from "theme-ui";
|
|
293
|
-
|
|
294
|
-
// src/components/Flex.tsx
|
|
295
|
-
import { Flex } from "theme-ui";
|
|
296
|
-
|
|
297
|
-
// src/components/Grid.tsx
|
|
298
|
-
import { Grid } from "theme-ui";
|
|
299
|
-
|
|
300
|
-
// src/components/Heading.tsx
|
|
301
|
-
import { Heading } from "theme-ui";
|
|
302
|
-
|
|
303
|
-
// src/components/HelpText.tsx
|
|
304
|
-
var HelpText = /* @__PURE__ */__name(({
|
|
305
|
-
sx,
|
|
306
|
-
disabled,
|
|
307
|
-
negative,
|
|
308
|
-
...props
|
|
309
|
-
}) => {
|
|
310
|
-
const variant = ["text.help", negative ? "negative" : void 0].filter(Boolean).join(".");
|
|
311
|
-
return /* @__PURE__ */React.createElement(Text, {
|
|
312
|
-
variant,
|
|
313
|
-
sx: {
|
|
314
|
-
fontSize: "sm",
|
|
315
|
-
fontFamily: "body",
|
|
316
|
-
lineHeight: "normal",
|
|
317
|
-
...sx
|
|
318
|
-
},
|
|
319
|
-
"aria-disabled": disabled ? "true" : void 0,
|
|
320
|
-
...props
|
|
321
|
-
});
|
|
322
|
-
}, "HelpText");
|
|
323
|
-
|
|
324
|
-
// src/components/IconButton.tsx
|
|
325
|
-
import { Icon as Icon3 } from "@ttoss/react-icons";
|
|
326
|
-
import { IconButton as IconButtonUi } from "theme-ui";
|
|
327
|
-
var IconButton = /* @__PURE__ */__name(props => {
|
|
328
|
-
const {
|
|
329
|
-
icon,
|
|
330
|
-
children,
|
|
331
|
-
...restProps
|
|
332
|
-
} = props;
|
|
333
|
-
return /* @__PURE__ */React.createElement(IconButtonUi, {
|
|
334
|
-
type: "button",
|
|
335
|
-
...restProps,
|
|
336
|
-
sx: {
|
|
337
|
-
cursor: "pointer",
|
|
338
|
-
borderRadius: "sm",
|
|
339
|
-
"&:disabled": {
|
|
340
|
-
cursor: "not-allowed"
|
|
341
|
-
},
|
|
342
|
-
...restProps.sx
|
|
343
|
-
}
|
|
344
|
-
}, icon ? /* @__PURE__ */React.createElement(Icon3, {
|
|
345
|
-
inline: true,
|
|
346
|
-
icon
|
|
347
|
-
}) : children);
|
|
348
|
-
}, "IconButton");
|
|
349
|
-
|
|
350
|
-
// src/components/Image.tsx
|
|
351
|
-
import { Image } from "theme-ui";
|
|
352
|
-
|
|
353
|
-
// src/components/InfiniteLinearProgress.tsx
|
|
354
|
-
import * as React6 from "react";
|
|
355
|
-
|
|
356
|
-
// src/components/LinearProgress.tsx
|
|
357
|
-
import { Progress } from "theme-ui";
|
|
358
|
-
|
|
359
|
-
// src/components/InfiniteLinearProgress.tsx
|
|
360
|
-
var MAX_PROGRESS = 100;
|
|
361
|
-
var InfiniteLinearProgress = /* @__PURE__ */__name(() => {
|
|
362
|
-
const [progress, setProgress] = React6.useState(0);
|
|
363
|
-
React6.useEffect(() => {
|
|
364
|
-
const timer = setInterval(() => {
|
|
365
|
-
setProgress(oldProgress => {
|
|
366
|
-
if (oldProgress === MAX_PROGRESS) {
|
|
367
|
-
return 0;
|
|
368
|
-
}
|
|
369
|
-
let diff = 0;
|
|
370
|
-
if (oldProgress > 0.97 * MAX_PROGRESS) {
|
|
371
|
-
diff -= 0.75 * MAX_PROGRESS;
|
|
372
|
-
} else if (oldProgress > 0.6 * MAX_PROGRESS) {
|
|
373
|
-
diff = Math.random() * (MAX_PROGRESS - oldProgress) * 0.1;
|
|
374
|
-
} else {
|
|
375
|
-
diff = Math.random() * (MAX_PROGRESS * 0.02);
|
|
376
|
-
}
|
|
377
|
-
return Math.min(oldProgress + diff, MAX_PROGRESS);
|
|
378
|
-
});
|
|
379
|
-
}, 100);
|
|
380
|
-
return () => {
|
|
381
|
-
clearInterval(timer);
|
|
382
|
-
};
|
|
383
|
-
}, []);
|
|
384
|
-
return /* @__PURE__ */React6.createElement(Progress, {
|
|
385
|
-
max: MAX_PROGRESS,
|
|
386
|
-
value: progress,
|
|
387
|
-
role: "progressbar"
|
|
388
|
-
});
|
|
389
|
-
}, "InfiniteLinearProgress");
|
|
390
|
-
|
|
391
|
-
// src/components/Input.tsx
|
|
392
|
-
import { Input as InputUI } from "theme-ui";
|
|
393
|
-
var isInputIconConfig = /* @__PURE__ */__name(icon => {
|
|
394
|
-
return icon !== void 0 && typeof icon === "object" && "icon" in icon && (typeof icon.icon === "string" || typeof icon.icon === "object" && "body" in icon.icon);
|
|
395
|
-
}, "isInputIconConfig");
|
|
396
|
-
var normalizeIcon = /* @__PURE__ */__name(icon => {
|
|
397
|
-
if (!icon) {
|
|
398
|
-
return void 0;
|
|
399
|
-
}
|
|
400
|
-
if (isInputIconConfig(icon)) {
|
|
401
|
-
return icon;
|
|
402
|
-
}
|
|
403
|
-
return {
|
|
404
|
-
icon
|
|
405
|
-
};
|
|
406
|
-
}, "normalizeIcon");
|
|
407
|
-
var Input = /* @__PURE__ */__name(({
|
|
408
|
-
leadingIcon,
|
|
409
|
-
trailingIcon: trailingIconProp,
|
|
410
|
-
className,
|
|
411
|
-
sx,
|
|
412
|
-
...inputProps
|
|
413
|
-
}) => {
|
|
414
|
-
const normalizedLeadingIcon = normalizeIcon(leadingIcon);
|
|
415
|
-
const normalizedTrailingIconProp = normalizeIcon(trailingIconProp);
|
|
416
|
-
const ariaInvalid = inputProps["aria-invalid"];
|
|
417
|
-
const isInvalid = ariaInvalid === true || ariaInvalid === "true";
|
|
418
|
-
const trailingIcon = isInvalid ? {
|
|
419
|
-
...normalizedTrailingIconProp,
|
|
420
|
-
icon: "warning-alt"
|
|
421
|
-
} : normalizedTrailingIconProp;
|
|
422
|
-
const isWarning = !isInvalid && trailingIcon?.icon === "warning-alt";
|
|
423
|
-
const wrapperClassName = [className, isWarning && "is-warning"].filter(Boolean).join(" ");
|
|
424
|
-
return /* @__PURE__ */React.createElement(Flex, {
|
|
425
|
-
className: wrapperClassName,
|
|
426
|
-
sx: {
|
|
427
|
-
...sx,
|
|
428
|
-
position: "relative",
|
|
429
|
-
padding: 0,
|
|
430
|
-
border: "none"
|
|
431
|
-
}
|
|
432
|
-
}, normalizedLeadingIcon && /* @__PURE__ */React.createElement(TooltipIcon, {
|
|
433
|
-
...normalizedLeadingIcon,
|
|
434
|
-
"data-testid": "input-leading-icon",
|
|
435
|
-
variant: normalizedLeadingIcon.variant ?? "info",
|
|
436
|
-
sx: {
|
|
437
|
-
position: "absolute",
|
|
438
|
-
alignSelf: "center",
|
|
439
|
-
left: "1rem",
|
|
440
|
-
...normalizedLeadingIcon.sx
|
|
441
|
-
}
|
|
442
|
-
}), /* @__PURE__ */React.createElement(InputUI, {
|
|
443
|
-
sx: {
|
|
444
|
-
fontFamily: "body",
|
|
445
|
-
paddingY: "3",
|
|
446
|
-
paddingX: "4",
|
|
447
|
-
...sx,
|
|
448
|
-
paddingLeft: leadingIcon ? "10" : void 0,
|
|
449
|
-
paddingRight: trailingIcon ? "10" : void 0,
|
|
450
|
-
margin: 0
|
|
451
|
-
},
|
|
452
|
-
className,
|
|
453
|
-
...inputProps
|
|
454
|
-
}), trailingIcon && /* @__PURE__ */React.createElement(TooltipIcon, {
|
|
455
|
-
...trailingIcon,
|
|
456
|
-
"data-testid": "input-trailing-icon",
|
|
457
|
-
variant: trailingIcon.variant ?? "info",
|
|
458
|
-
sx: {
|
|
459
|
-
position: "absolute",
|
|
460
|
-
right: "1rem",
|
|
461
|
-
alignSelf: "center",
|
|
462
|
-
color: isWarning ? "feedback.text.caution.default" : void 0,
|
|
463
|
-
fontSize: "xl",
|
|
464
|
-
...trailingIcon.sx
|
|
465
|
-
}
|
|
466
|
-
}));
|
|
467
|
-
}, "Input");
|
|
468
|
-
|
|
469
|
-
// src/components/InputNumber.tsx
|
|
470
|
-
import { Icon as Icon4 } from "@ttoss/react-icons";
|
|
471
|
-
import * as React7 from "react";
|
|
472
|
-
import { Input as Input2 } from "theme-ui";
|
|
473
|
-
var InputNumber = /* @__PURE__ */React7.forwardRef(({
|
|
474
|
-
sx,
|
|
475
|
-
value,
|
|
476
|
-
infoIcon,
|
|
477
|
-
onChange,
|
|
478
|
-
onClickInfoIcon,
|
|
479
|
-
...inputProps
|
|
480
|
-
}, ref) => {
|
|
481
|
-
const sxProps = React7.useMemo(() => {
|
|
482
|
-
const size = String(typeof value === "undefined" ? 0 : value).length;
|
|
483
|
-
if (inputProps["aria-invalid"] === "true") {
|
|
484
|
-
return {
|
|
485
|
-
width: `calc(139px + ${size > 1 ? size * 10 : 0}px)`,
|
|
486
|
-
textAlign: "left",
|
|
487
|
-
"&[type=number]::-webkit-inner-spin-button, &[type=number]::-webkit-outer-spin-button": {
|
|
488
|
-
WebkitAppearance: "none",
|
|
489
|
-
margin: 0
|
|
490
|
-
},
|
|
491
|
-
...sx,
|
|
492
|
-
paddingLeft: "6",
|
|
493
|
-
paddingRight: "5",
|
|
494
|
-
margin: 0
|
|
495
|
-
};
|
|
496
|
-
}
|
|
497
|
-
return {
|
|
498
|
-
width: `calc(108px + ${size > 1 ? size * 10 : 0}px)`,
|
|
499
|
-
textAlign: "center",
|
|
500
|
-
"&[type=number]::-webkit-inner-spin-button, &[type=number]::-webkit-outer-spin-button": {
|
|
501
|
-
WebkitAppearance: "none",
|
|
502
|
-
margin: 0
|
|
503
|
-
},
|
|
504
|
-
fontFamily: "body",
|
|
505
|
-
paddingY: "2",
|
|
506
|
-
paddingX: "4",
|
|
507
|
-
...sx,
|
|
508
|
-
paddingLeft: "5",
|
|
509
|
-
paddingRight: "5",
|
|
510
|
-
margin: 0
|
|
511
|
-
};
|
|
512
|
-
}, [inputProps, value, sx]);
|
|
513
|
-
const handleChangeUp = /* @__PURE__ */__name(() => {
|
|
514
|
-
if (inputProps.disabled) {
|
|
515
|
-
return;
|
|
516
|
-
}
|
|
517
|
-
if (typeof value !== "number") {
|
|
518
|
-
onChange(-1);
|
|
519
|
-
return;
|
|
520
|
-
}
|
|
521
|
-
onChange(value - 1);
|
|
522
|
-
}, "handleChangeUp");
|
|
523
|
-
const handleChangeDown = /* @__PURE__ */__name(() => {
|
|
524
|
-
if (inputProps.disabled) {
|
|
525
|
-
return;
|
|
526
|
-
}
|
|
527
|
-
if (typeof value !== "number") {
|
|
528
|
-
onChange(1);
|
|
529
|
-
return;
|
|
530
|
-
}
|
|
531
|
-
onChange(value + 1);
|
|
532
|
-
}, "handleChangeDown");
|
|
533
|
-
return /* @__PURE__ */React7.createElement(Flex, {
|
|
534
|
-
sx: {
|
|
535
|
-
width: "fit-content",
|
|
536
|
-
...sx,
|
|
537
|
-
position: "relative",
|
|
538
|
-
padding: 0,
|
|
539
|
-
border: "none"
|
|
540
|
-
},
|
|
541
|
-
ref,
|
|
542
|
-
"aria-invalid": inputProps["aria-invalid"]
|
|
543
|
-
}, /* @__PURE__ */React7.createElement(Input2, {
|
|
544
|
-
ref,
|
|
545
|
-
variant: "forms.inputNumber",
|
|
546
|
-
sx: sxProps,
|
|
547
|
-
type: "number",
|
|
548
|
-
onChange: /* @__PURE__ */__name(e => {
|
|
549
|
-
onChange(Number(e.target.value));
|
|
550
|
-
}, "onChange"),
|
|
551
|
-
value,
|
|
552
|
-
...inputProps
|
|
553
|
-
}), /* @__PURE__ */React7.createElement(Text, {
|
|
554
|
-
sx: {
|
|
555
|
-
position: "absolute",
|
|
556
|
-
alignSelf: "center",
|
|
557
|
-
left: "1rem",
|
|
558
|
-
zIndex: 1,
|
|
559
|
-
cursor: "pointer"
|
|
560
|
-
},
|
|
561
|
-
onClick: handleChangeUp
|
|
562
|
-
}, /* @__PURE__ */React7.createElement(Icon4, {
|
|
563
|
-
icon: "picker-down"
|
|
564
|
-
})), infoIcon && /* @__PURE__ */React7.createElement(Text, {
|
|
565
|
-
sx: {
|
|
566
|
-
position: "absolute",
|
|
567
|
-
alignSelf: "center",
|
|
568
|
-
right: "2.5rem",
|
|
569
|
-
zIndex: 1,
|
|
570
|
-
cursor: onClickInfoIcon ? "pointer" : "default"
|
|
571
|
-
},
|
|
572
|
-
onClick: onClickInfoIcon
|
|
573
|
-
}, /* @__PURE__ */React7.createElement(Icon4, {
|
|
574
|
-
icon: "info"
|
|
575
|
-
})), /* @__PURE__ */React7.createElement(Text, {
|
|
576
|
-
sx: {
|
|
577
|
-
position: "absolute",
|
|
578
|
-
alignSelf: "center",
|
|
579
|
-
right: "1rem",
|
|
580
|
-
zIndex: 1,
|
|
581
|
-
cursor: "pointer"
|
|
582
|
-
},
|
|
583
|
-
onClick: handleChangeDown
|
|
584
|
-
}, /* @__PURE__ */React7.createElement(Icon4, {
|
|
585
|
-
icon: "picker-up"
|
|
586
|
-
})));
|
|
587
|
-
});
|
|
588
|
-
InputNumber.displayName = "InputNumber";
|
|
589
|
-
|
|
590
|
-
// src/components/InputPassword.tsx
|
|
591
|
-
import * as React8 from "react";
|
|
592
|
-
var InputPassword = /* @__PURE__ */__name(({
|
|
593
|
-
showPasswordByDefault = false,
|
|
594
|
-
...inputPasswordProps
|
|
595
|
-
}) => {
|
|
596
|
-
const [hidePass, setHidePass] = React8.useState(Boolean(!showPasswordByDefault));
|
|
597
|
-
const {
|
|
598
|
-
icon,
|
|
599
|
-
inputType
|
|
600
|
-
} = React8.useMemo(() => {
|
|
601
|
-
return {
|
|
602
|
-
icon: hidePass ? "view-off" : "view-on",
|
|
603
|
-
inputType: hidePass ? "password" : "text"
|
|
604
|
-
};
|
|
605
|
-
}, [hidePass]);
|
|
606
|
-
const handleClick = /* @__PURE__ */__name(() => {
|
|
607
|
-
setHidePass(prev => {
|
|
608
|
-
return !prev;
|
|
609
|
-
});
|
|
610
|
-
}, "handleClick");
|
|
611
|
-
return /* @__PURE__ */React8.createElement(Input, {
|
|
612
|
-
...inputPasswordProps,
|
|
613
|
-
trailingIcon: {
|
|
614
|
-
icon,
|
|
615
|
-
onClick: handleClick
|
|
616
|
-
},
|
|
617
|
-
type: inputType
|
|
618
|
-
});
|
|
619
|
-
}, "InputPassword");
|
|
620
|
-
|
|
621
|
-
// src/components/Label.tsx
|
|
622
|
-
import { Icon as Icon5 } from "@ttoss/react-icons";
|
|
623
|
-
import * as React9 from "react";
|
|
624
|
-
import { Label as LabelUi } from "theme-ui";
|
|
625
|
-
|
|
626
|
-
// src/components/Tooltip.tsx
|
|
627
|
-
import { Tooltip as TooltipReact } from "react-tooltip";
|
|
628
|
-
var Tooltip = /* @__PURE__ */__name(({
|
|
629
|
-
variant = "info",
|
|
630
|
-
sx,
|
|
631
|
-
...props
|
|
632
|
-
}) => {
|
|
633
|
-
const className = `tooltip-component tooltip-${variant}`;
|
|
634
|
-
const getVariantStyles = /* @__PURE__ */__name(variantType => {
|
|
635
|
-
const variants = {
|
|
636
|
-
info: {
|
|
637
|
-
backgroundColor: "input.background.secondary.default",
|
|
638
|
-
color: "feedback.text.secondary.default",
|
|
639
|
-
borderColor: "feedback.border.secondary.default"
|
|
640
|
-
},
|
|
641
|
-
success: {
|
|
642
|
-
backgroundColor: "feedback.background.positive.default",
|
|
643
|
-
color: "feedback.text.positive.default",
|
|
644
|
-
borderColor: "feedback.border.positive.default"
|
|
645
|
-
},
|
|
646
|
-
warning: {
|
|
647
|
-
backgroundColor: "feedback.background.caution.default",
|
|
648
|
-
color: "feedback.text.caution.default",
|
|
649
|
-
borderColor: "feedback.border.caution.default"
|
|
650
|
-
},
|
|
651
|
-
error: {
|
|
652
|
-
backgroundColor: "feedback.background.negative.default",
|
|
653
|
-
color: "feedback.text.negative.default",
|
|
654
|
-
borderColor: "feedback.border.negative.default"
|
|
655
|
-
}
|
|
656
|
-
};
|
|
657
|
-
return variants[variantType] || variants.info;
|
|
658
|
-
}, "getVariantStyles");
|
|
659
|
-
return /* @__PURE__ */React.createElement(Box, {
|
|
660
|
-
sx: /* @__PURE__ */__name(({
|
|
661
|
-
fonts
|
|
662
|
-
}) => {
|
|
663
|
-
const variantStyles = getVariantStyles(variant);
|
|
664
|
-
return {
|
|
665
|
-
".example-arrow": {
|
|
666
|
-
display: "none"
|
|
667
|
-
},
|
|
668
|
-
".tooltip-component": {
|
|
669
|
-
fontFamily: fonts?.body,
|
|
670
|
-
paddingY: "2",
|
|
671
|
-
paddingX: "3",
|
|
672
|
-
border: "sm",
|
|
673
|
-
borderRadius: "xl",
|
|
674
|
-
zIndex: "tooltip",
|
|
675
|
-
opacity: "1",
|
|
676
|
-
lineHeight: "shorter",
|
|
677
|
-
letterSpacing: "wide",
|
|
678
|
-
a: {
|
|
679
|
-
color: "feedback.text.secondary.default",
|
|
680
|
-
fontFamily: "body",
|
|
681
|
-
textDecorationLine: "underline",
|
|
682
|
-
lineHeight: "normal"
|
|
683
|
-
},
|
|
684
|
-
...variantStyles,
|
|
685
|
-
...sx
|
|
686
|
-
},
|
|
687
|
-
[`&.tooltip-${variant}`]: variantStyles
|
|
688
|
-
};
|
|
689
|
-
}, "sx")
|
|
690
|
-
}, /* @__PURE__ */React.createElement(TooltipReact, {
|
|
691
|
-
className,
|
|
692
|
-
...props,
|
|
693
|
-
classNameArrow: "example-arrow"
|
|
694
|
-
}, props.children));
|
|
695
|
-
}, "Tooltip");
|
|
696
|
-
|
|
697
|
-
// src/components/Label.tsx
|
|
698
|
-
var TOOLTIP_LABEL = "tooltip";
|
|
699
|
-
var Label = /* @__PURE__ */__name(({
|
|
700
|
-
children,
|
|
701
|
-
tooltip,
|
|
702
|
-
sx,
|
|
703
|
-
...props
|
|
704
|
-
}) => {
|
|
705
|
-
const id = React9.useId();
|
|
706
|
-
const tooltipId = `${id}-tooltip`;
|
|
707
|
-
return /* @__PURE__ */React9.createElement(LabelUi, {
|
|
708
|
-
sx: {
|
|
709
|
-
alignItems: "center",
|
|
710
|
-
fontSize: "sm",
|
|
711
|
-
lineHeight: "normal",
|
|
712
|
-
width: "fit-content",
|
|
713
|
-
color: "input.text.secondary.default",
|
|
714
|
-
...sx
|
|
715
|
-
},
|
|
716
|
-
...props
|
|
717
|
-
}, children, tooltip && /* @__PURE__ */React9.createElement(Text, {
|
|
718
|
-
"data-tooltip-id": tooltipId,
|
|
719
|
-
sx: {
|
|
720
|
-
color: "currentcolor",
|
|
721
|
-
cursor: "pointer",
|
|
722
|
-
marginLeft: "1"
|
|
723
|
-
},
|
|
724
|
-
"aria-label": TOOLTIP_LABEL
|
|
725
|
-
}, /* @__PURE__ */React9.createElement(Icon5, {
|
|
726
|
-
icon: "info"
|
|
727
|
-
}), /* @__PURE__ */React9.createElement(Tooltip, {
|
|
728
|
-
id: tooltipId,
|
|
729
|
-
...tooltip
|
|
730
|
-
})));
|
|
731
|
-
}, "Label");
|
|
732
|
-
|
|
733
|
-
// src/components/Link.tsx
|
|
734
|
-
import * as React10 from "react";
|
|
735
|
-
import { Link as LinkUi } from "theme-ui";
|
|
736
|
-
var Link = /* @__PURE__ */React10.forwardRef(({
|
|
737
|
-
quiet,
|
|
738
|
-
className,
|
|
739
|
-
...props
|
|
740
|
-
}, ref) => {
|
|
741
|
-
return /* @__PURE__ */React10.createElement(LinkUi, {
|
|
742
|
-
className: `${quiet ? "quiet" : ""} ${className ?? ""}`,
|
|
743
|
-
...props,
|
|
744
|
-
ref
|
|
745
|
-
});
|
|
746
|
-
});
|
|
747
|
-
Link.displayName = "Link";
|
|
748
|
-
|
|
749
|
-
// src/components/Paragraph.tsx
|
|
750
|
-
import { Paragraph } from "theme-ui";
|
|
751
|
-
|
|
752
|
-
// src/components/Radio.tsx
|
|
753
|
-
import { Radio } from "theme-ui";
|
|
754
|
-
|
|
755
|
-
// src/components/SegmentedControl.tsx
|
|
756
|
-
import * as React11 from "react";
|
|
757
|
-
import { Box as Box3, Flex as Flex2 } from "theme-ui";
|
|
758
|
-
var SegmentedControl = /* @__PURE__ */__name(({
|
|
759
|
-
options,
|
|
760
|
-
value: propValue,
|
|
761
|
-
defaultValue,
|
|
762
|
-
onChange,
|
|
763
|
-
disabled,
|
|
764
|
-
className,
|
|
765
|
-
sx,
|
|
766
|
-
...rest
|
|
767
|
-
}) => {
|
|
768
|
-
const [internalValue, setInternalValue] = React11.useState(propValue || defaultValue);
|
|
769
|
-
React11.useEffect(() => {
|
|
770
|
-
if (propValue !== void 0) {
|
|
771
|
-
setInternalValue(propValue);
|
|
772
|
-
}
|
|
773
|
-
}, [propValue]);
|
|
774
|
-
const handleChange = /* @__PURE__ */__name(newValue => {
|
|
775
|
-
setInternalValue(newValue);
|
|
776
|
-
if (onChange) {
|
|
777
|
-
onChange(newValue);
|
|
778
|
-
}
|
|
779
|
-
}, "handleChange");
|
|
780
|
-
const normalizedOptions = options.map(option => {
|
|
781
|
-
return typeof option === "string" || typeof option === "number" ? {
|
|
782
|
-
label: option,
|
|
783
|
-
value: option
|
|
784
|
-
} : option;
|
|
785
|
-
});
|
|
786
|
-
const currentValue = propValue !== void 0 ? propValue : internalValue;
|
|
787
|
-
return /* @__PURE__ */React11.createElement(Flex2, {
|
|
788
|
-
className,
|
|
789
|
-
sx: {
|
|
790
|
-
width: "100%",
|
|
791
|
-
borderRadius: "4xl",
|
|
792
|
-
border: "sm",
|
|
793
|
-
borderColor: "display.border.primary.default",
|
|
794
|
-
overflow: "hidden",
|
|
795
|
-
position: "relative",
|
|
796
|
-
".rc-segmented": {
|
|
797
|
-
width: "100%",
|
|
798
|
-
padding: "0",
|
|
799
|
-
backgroundColor: "display.background.primary.default",
|
|
800
|
-
position: "relative",
|
|
801
|
-
display: "flex",
|
|
802
|
-
flexGrow: 1
|
|
803
|
-
},
|
|
804
|
-
".rc-segmented-group, .custom-segmented-group": {
|
|
805
|
-
borderRadius: "4xl",
|
|
806
|
-
gap: "0",
|
|
807
|
-
display: "flex",
|
|
808
|
-
width: "100%",
|
|
809
|
-
position: "relative"
|
|
810
|
-
},
|
|
811
|
-
".rc-segmented-item": {
|
|
812
|
-
borderRadius: "4xl",
|
|
813
|
-
margin: 0,
|
|
814
|
-
paddingX: "5",
|
|
815
|
-
paddingY: "3",
|
|
816
|
-
fontSize: "lg",
|
|
817
|
-
display: "flex",
|
|
818
|
-
alignItems: "center",
|
|
819
|
-
justifyContent: "center",
|
|
820
|
-
color: "action.text.accent.default",
|
|
821
|
-
flex: "1 1 auto",
|
|
822
|
-
minWidth: "min-content",
|
|
823
|
-
whiteSpace: "nowrap",
|
|
824
|
-
overflow: "hidden",
|
|
825
|
-
textOverflow: "ellipsis",
|
|
826
|
-
zIndex: 2,
|
|
827
|
-
transition: "background-color 0.2s ease, color 0.2s ease",
|
|
828
|
-
cursor: "pointer",
|
|
829
|
-
"&:focus": {
|
|
830
|
-
outline: "2px solid",
|
|
831
|
-
outlineColor: "action.background.accent.default",
|
|
832
|
-
outlineOffset: "2px",
|
|
833
|
-
boxShadow: "0 0 0 1px rgba(0, 0, 0, 0.1)"
|
|
834
|
-
},
|
|
835
|
-
"&:focus-visible": {
|
|
836
|
-
outline: "2px solid",
|
|
837
|
-
outlineColor: "action.background.accent.default",
|
|
838
|
-
outlineOffset: "2px"
|
|
839
|
-
},
|
|
840
|
-
"&:hover:not(.rc-segmented-item-selected)": {
|
|
841
|
-
backgroundColor: "action.background.muted.default"
|
|
842
|
-
},
|
|
843
|
-
'input[type="radio"]': {
|
|
844
|
-
display: "none"
|
|
845
|
-
}
|
|
846
|
-
},
|
|
847
|
-
".rc-segmented-item-selected": {
|
|
848
|
-
backgroundColor: "action.background.accent.default",
|
|
849
|
-
color: "action.text.accent.active"
|
|
850
|
-
},
|
|
851
|
-
".rc-segmented-thumb": {
|
|
852
|
-
backgroundColor: "action.background.accent.default",
|
|
853
|
-
borderRadius: "4xl",
|
|
854
|
-
zIndex: -1,
|
|
855
|
-
margin: 0,
|
|
856
|
-
position: "absolute",
|
|
857
|
-
height: "100%",
|
|
858
|
-
width: "100%",
|
|
859
|
-
left: 0,
|
|
860
|
-
transition: "transform 0.2s ease, left 0.2s ease"
|
|
861
|
-
},
|
|
862
|
-
".rc-segmented-item-disabled": {
|
|
863
|
-
opacity: 0.5,
|
|
864
|
-
cursor: "not-allowed",
|
|
865
|
-
backgroundColor: "action.background.muted.disabled"
|
|
866
|
-
},
|
|
867
|
-
...sx
|
|
868
|
-
},
|
|
869
|
-
...rest
|
|
870
|
-
}, /* @__PURE__ */React11.createElement("div", {
|
|
871
|
-
className: "rc-segmented"
|
|
872
|
-
}, /* @__PURE__ */React11.createElement(Flex2, {
|
|
873
|
-
className: "rc-segmented-group custom-segmented-group"
|
|
874
|
-
}, normalizedOptions.map((option, index) => {
|
|
875
|
-
const isSelected = option.value === currentValue;
|
|
876
|
-
const isLastItem = index === normalizedOptions.length - 1;
|
|
877
|
-
const isItemDisabled = disabled || option.disabled;
|
|
878
|
-
const showDivider = !isLastItem && option.value !== currentValue && normalizedOptions[index + 1].value !== currentValue;
|
|
879
|
-
return /* @__PURE__ */React11.createElement(React11.Fragment, {
|
|
880
|
-
key: `${index}-${option.value}`
|
|
881
|
-
}, /* @__PURE__ */React11.createElement(Box3, {
|
|
882
|
-
as: "label",
|
|
883
|
-
className: `rc-segmented-item ${isSelected ? "rc-segmented-item-selected" : ""} ${isItemDisabled ? "rc-segmented-item-disabled" : ""}`,
|
|
884
|
-
onClick: /* @__PURE__ */__name(() => {
|
|
885
|
-
if (!disabled && !option.disabled) {
|
|
886
|
-
handleChange(option.value);
|
|
887
|
-
}
|
|
888
|
-
}, "onClick")
|
|
889
|
-
}, /* @__PURE__ */React11.createElement("input", {
|
|
890
|
-
type: "radio",
|
|
891
|
-
value: option.value,
|
|
892
|
-
checked: isSelected,
|
|
893
|
-
disabled: isItemDisabled,
|
|
894
|
-
onChange: /* @__PURE__ */__name(e => {
|
|
895
|
-
if (!disabled && !option.disabled && e.target.checked) {
|
|
896
|
-
handleChange(option.value);
|
|
897
|
-
}
|
|
898
|
-
}, "onChange")
|
|
899
|
-
}), /* @__PURE__ */React11.createElement("div", {
|
|
900
|
-
className: "rc-segmented-item-label"
|
|
901
|
-
}, option.label)), showDivider && /* @__PURE__ */React11.createElement(Box3, {
|
|
902
|
-
className: "segmented-divider",
|
|
903
|
-
sx: {
|
|
904
|
-
height: "60%",
|
|
905
|
-
width: "1px",
|
|
906
|
-
backgroundColor: "action.text.accent.default",
|
|
907
|
-
opacity: 0.4,
|
|
908
|
-
alignSelf: "center",
|
|
909
|
-
zIndex: 3
|
|
910
|
-
}
|
|
911
|
-
}));
|
|
912
|
-
}), currentValue !== void 0 && /* @__PURE__ */React11.createElement("div", {
|
|
913
|
-
className: "rc-segmented-thumb",
|
|
914
|
-
style: {
|
|
915
|
-
width: `${100 / normalizedOptions.length}%`,
|
|
916
|
-
transform: `translateX(${normalizedOptions.findIndex(option => {
|
|
917
|
-
return option.value === currentValue;
|
|
918
|
-
}) * 100}%)`
|
|
919
|
-
}
|
|
920
|
-
}))));
|
|
921
|
-
}, "SegmentedControl");
|
|
922
|
-
|
|
923
|
-
// src/components/Select.tsx
|
|
924
|
-
import { Icon as Icon6 } from "@ttoss/react-icons";
|
|
925
|
-
import * as React12 from "react";
|
|
926
|
-
import ReactSelect, { components } from "react-select";
|
|
927
|
-
var Control = /* @__PURE__ */__name(props => {
|
|
928
|
-
const isDisabled = props.selectProps.isDisabled;
|
|
929
|
-
const hasError = props.selectProps["aria-invalid"] === "true";
|
|
930
|
-
const borderColor = (() => {
|
|
931
|
-
if (isDisabled) {
|
|
932
|
-
return "display.border.muted.default";
|
|
933
|
-
}
|
|
934
|
-
if (hasError) {
|
|
935
|
-
return "display.border.negative.default";
|
|
936
|
-
}
|
|
937
|
-
return "display.border.muted.default";
|
|
938
|
-
})();
|
|
939
|
-
const backgroundColor = (() => {
|
|
940
|
-
if (isDisabled) {
|
|
941
|
-
return "display.background.muted.default";
|
|
942
|
-
}
|
|
943
|
-
return "display.background.secondary.default";
|
|
944
|
-
})();
|
|
945
|
-
return /* @__PURE__ */React12.createElement(Box, {
|
|
946
|
-
sx: {
|
|
947
|
-
".react-select__control": {
|
|
948
|
-
borderColor,
|
|
949
|
-
backgroundColor,
|
|
950
|
-
paddingX: "4",
|
|
951
|
-
paddingY: "3"
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
}, /* @__PURE__ */React12.createElement(components.Control, props));
|
|
955
|
-
}, "Control");
|
|
956
|
-
var DropdownIndicator = /* @__PURE__ */__name(props => {
|
|
957
|
-
const isDisabled = props.selectProps.isDisabled;
|
|
958
|
-
const color = (() => {
|
|
959
|
-
if (isDisabled) {
|
|
960
|
-
return "display.text.muted.default";
|
|
961
|
-
}
|
|
962
|
-
return "text";
|
|
963
|
-
})();
|
|
964
|
-
return /* @__PURE__ */React12.createElement(Text, {
|
|
965
|
-
sx: {
|
|
966
|
-
fontSize: "md",
|
|
967
|
-
color,
|
|
968
|
-
alignSelf: "center",
|
|
969
|
-
display: "flex",
|
|
970
|
-
alignItems: "center"
|
|
971
|
-
}
|
|
972
|
-
}, /* @__PURE__ */React12.createElement(Icon6, {
|
|
973
|
-
icon: "picker-down"
|
|
974
|
-
}));
|
|
975
|
-
}, "DropdownIndicator");
|
|
976
|
-
var IndicatorsContainer = /* @__PURE__ */__name(({
|
|
977
|
-
children
|
|
978
|
-
}) => {
|
|
979
|
-
return /* @__PURE__ */React12.createElement(Box, {
|
|
980
|
-
sx: {
|
|
981
|
-
marginLeft: "4",
|
|
982
|
-
border: "none"
|
|
983
|
-
}
|
|
984
|
-
}, children);
|
|
985
|
-
}, "IndicatorsContainer");
|
|
986
|
-
var Placeholder = /* @__PURE__ */__name(({
|
|
987
|
-
children
|
|
988
|
-
}) => {
|
|
989
|
-
return /* @__PURE__ */React12.createElement(Text, {
|
|
990
|
-
sx: {
|
|
991
|
-
color: "onMuted",
|
|
992
|
-
alignSelf: "center"
|
|
993
|
-
}
|
|
994
|
-
}, children);
|
|
995
|
-
}, "Placeholder");
|
|
996
|
-
var SelectContainer = /* @__PURE__ */__name(({
|
|
997
|
-
children,
|
|
998
|
-
...props
|
|
999
|
-
}) => {
|
|
1000
|
-
const {
|
|
1001
|
-
sx,
|
|
1002
|
-
css: css2
|
|
1003
|
-
} = props.selectProps;
|
|
1004
|
-
return (
|
|
1005
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1006
|
-
/* @__PURE__ */
|
|
1007
|
-
React12.createElement(Box, {
|
|
1008
|
-
sx,
|
|
1009
|
-
css: css2
|
|
1010
|
-
}, /* @__PURE__ */React12.createElement(components.SelectContainer, props, children))
|
|
1011
|
-
);
|
|
1012
|
-
}, "SelectContainer");
|
|
1013
|
-
var ValueContainer = /* @__PURE__ */__name(({
|
|
1014
|
-
children,
|
|
1015
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1016
|
-
...props
|
|
1017
|
-
}) => {
|
|
1018
|
-
const {
|
|
1019
|
-
leadingIcon,
|
|
1020
|
-
trailingIcon,
|
|
1021
|
-
isSearchable
|
|
1022
|
-
} = props.selectProps;
|
|
1023
|
-
const hasError = props.selectProps["aria-invalid"] === "true";
|
|
1024
|
-
const trailingIconColor = (() => {
|
|
1025
|
-
if (hasError) {
|
|
1026
|
-
return "danger";
|
|
1027
|
-
}
|
|
1028
|
-
return "text";
|
|
1029
|
-
})();
|
|
1030
|
-
const finalLeadingIcon = (() => {
|
|
1031
|
-
if (!isSearchable) {
|
|
1032
|
-
return leadingIcon;
|
|
1033
|
-
}
|
|
1034
|
-
return leadingIcon || "search";
|
|
1035
|
-
})();
|
|
1036
|
-
return /* @__PURE__ */React12.createElement(Flex, {
|
|
1037
|
-
sx: {
|
|
1038
|
-
gap: "4",
|
|
1039
|
-
flex: 1
|
|
1040
|
-
}
|
|
1041
|
-
}, finalLeadingIcon && /* @__PURE__ */React12.createElement(Text, {
|
|
1042
|
-
sx: {
|
|
1043
|
-
alignSelf: "center",
|
|
1044
|
-
pointerEvents: "none",
|
|
1045
|
-
lineHeight: 0,
|
|
1046
|
-
fontSize: "md"
|
|
1047
|
-
}
|
|
1048
|
-
}, /* @__PURE__ */React12.createElement(Icon6, {
|
|
1049
|
-
icon: finalLeadingIcon
|
|
1050
|
-
})), /* @__PURE__ */React12.createElement(Flex, {
|
|
1051
|
-
sx: {
|
|
1052
|
-
flex: 1,
|
|
1053
|
-
alignItems: "center"
|
|
1054
|
-
}
|
|
1055
|
-
}, children), (trailingIcon || hasError) && /* @__PURE__ */React12.createElement(Text, {
|
|
1056
|
-
className: hasError ? "error-icon" : "",
|
|
1057
|
-
sx: {
|
|
1058
|
-
alignSelf: "center",
|
|
1059
|
-
pointerEvents: "none",
|
|
1060
|
-
lineHeight: 0,
|
|
1061
|
-
fontSize: "md",
|
|
1062
|
-
color: trailingIconColor
|
|
1063
|
-
}
|
|
1064
|
-
}, /* @__PURE__ */React12.createElement(Icon6, {
|
|
1065
|
-
icon: hasError ? "warning-alt" : trailingIcon
|
|
1066
|
-
})));
|
|
1067
|
-
}, "ValueContainer");
|
|
1068
|
-
var Select = /* @__PURE__ */React12.forwardRef(({
|
|
1069
|
-
...props
|
|
1070
|
-
}, ref) => {
|
|
1071
|
-
const value = props.options?.find(option => {
|
|
1072
|
-
if ("value" in option) {
|
|
1073
|
-
return option.value === props.value;
|
|
1074
|
-
}
|
|
1075
|
-
return false;
|
|
1076
|
-
});
|
|
1077
|
-
return /* @__PURE__ */React12.createElement(ReactSelect, {
|
|
1078
|
-
ref,
|
|
1079
|
-
/**
|
|
1080
|
-
* https://react-select.com/components
|
|
1081
|
-
*/
|
|
1082
|
-
components: {
|
|
1083
|
-
Control,
|
|
1084
|
-
DropdownIndicator,
|
|
1085
|
-
IndicatorsContainer,
|
|
1086
|
-
Placeholder,
|
|
1087
|
-
SelectContainer,
|
|
1088
|
-
ValueContainer
|
|
1089
|
-
},
|
|
1090
|
-
isDisabled: props.disabled,
|
|
1091
|
-
...props,
|
|
1092
|
-
value,
|
|
1093
|
-
onChange: /* @__PURE__ */__name(value2 => {
|
|
1094
|
-
props.onChange?.(value2?.value);
|
|
1095
|
-
}, "onChange"),
|
|
1096
|
-
styles: {
|
|
1097
|
-
input: /* @__PURE__ */__name(baseStyles => {
|
|
1098
|
-
return {
|
|
1099
|
-
...baseStyles,
|
|
1100
|
-
position: "absolute"
|
|
1101
|
-
};
|
|
1102
|
-
}, "input")
|
|
1103
|
-
},
|
|
1104
|
-
/**
|
|
1105
|
-
* https://react-select.com/styles#the-classnameprefix-prop
|
|
1106
|
-
*/
|
|
1107
|
-
classNamePrefix: "react-select"
|
|
1108
|
-
});
|
|
1109
|
-
});
|
|
1110
|
-
Select.displayName = "Select";
|
|
1111
|
-
|
|
1112
|
-
// src/components/Slider.tsx
|
|
1113
|
-
import { Slider } from "theme-ui";
|
|
1114
|
-
|
|
1115
|
-
// src/components/Spinner.tsx
|
|
1116
|
-
import { Spinner } from "theme-ui";
|
|
1117
|
-
|
|
1118
|
-
// src/components/Stack.tsx
|
|
1119
|
-
var Stack = /* @__PURE__ */__name(props => {
|
|
1120
|
-
return /* @__PURE__ */React.createElement(Flex, {
|
|
1121
|
-
...props,
|
|
1122
|
-
sx: {
|
|
1123
|
-
flexDirection: "column",
|
|
1124
|
-
alignItems: "flex-start",
|
|
1125
|
-
...props.sx
|
|
1126
|
-
}
|
|
1127
|
-
});
|
|
1128
|
-
}, "Stack");
|
|
1129
|
-
|
|
1130
|
-
// src/components/Switch.tsx
|
|
1131
|
-
import { Switch as SwitchUi } from "theme-ui";
|
|
1132
|
-
var Switch = /* @__PURE__ */__name(props => {
|
|
1133
|
-
return /* @__PURE__ */React.createElement(SwitchUi, {
|
|
1134
|
-
...props,
|
|
1135
|
-
role: "switch",
|
|
1136
|
-
"aria-checked": props.checked || false,
|
|
1137
|
-
sx: {
|
|
1138
|
-
backgroundColor: "input.background.muted.disabled",
|
|
1139
|
-
"input:checked ~ &": {
|
|
1140
|
-
backgroundColor: "input.background.accent.default"
|
|
1141
|
-
},
|
|
1142
|
-
"input ~ & > div": {
|
|
1143
|
-
backgroundColor: "input.background.primary.default"
|
|
1144
|
-
},
|
|
1145
|
-
"input:checked ~ & > div": {
|
|
1146
|
-
backgroundColor: "input.text.primary.default"
|
|
1147
|
-
},
|
|
1148
|
-
"input:focus ~ &": {
|
|
1149
|
-
outline: "md",
|
|
1150
|
-
outlineColor: "input.border.accent.default",
|
|
1151
|
-
outlineOffset: "0px"
|
|
1152
|
-
},
|
|
1153
|
-
...props.sx
|
|
1154
|
-
}
|
|
1155
|
-
});
|
|
1156
|
-
}, "Switch");
|
|
1157
|
-
|
|
1158
|
-
// src/components/Tag.tsx
|
|
1159
|
-
import * as React13 from "react";
|
|
1160
|
-
var tagVariantMap = {
|
|
1161
|
-
positive: {
|
|
1162
|
-
bg: "feedback.background.positive.default",
|
|
1163
|
-
color: "feedback.text.positive.default"
|
|
1164
|
-
},
|
|
1165
|
-
accent: {
|
|
1166
|
-
bg: "action.background.accent.default",
|
|
1167
|
-
color: "action.text.accent.default"
|
|
1168
|
-
},
|
|
1169
|
-
caution: {
|
|
1170
|
-
bg: "feedback.background.caution.default",
|
|
1171
|
-
color: "feedback.text.caution.default"
|
|
1172
|
-
},
|
|
1173
|
-
muted: {
|
|
1174
|
-
bg: "display.background.muted.default",
|
|
1175
|
-
color: "display.text.muted.default"
|
|
1176
|
-
},
|
|
1177
|
-
negative: {
|
|
1178
|
-
bg: "feedback.background.negative.default",
|
|
1179
|
-
color: "feedback.text.negative.default"
|
|
1180
|
-
},
|
|
1181
|
-
primary: {
|
|
1182
|
-
bg: "action.background.primary.default",
|
|
1183
|
-
color: "action.text.primary.default"
|
|
1184
|
-
},
|
|
1185
|
-
secondary: {
|
|
1186
|
-
bg: "action.background.secondary.default",
|
|
1187
|
-
color: "action.text.secondary.default"
|
|
1188
|
-
},
|
|
1189
|
-
default: {
|
|
1190
|
-
bg: "action.background.muted.default",
|
|
1191
|
-
color: "action.text.muted.default"
|
|
1192
|
-
}
|
|
1193
|
-
};
|
|
1194
|
-
var Tag = /* @__PURE__ */__name(({
|
|
1195
|
-
children,
|
|
1196
|
-
variant = "default",
|
|
1197
|
-
sx
|
|
1198
|
-
}) => {
|
|
1199
|
-
const colors = tagVariantMap[variant];
|
|
1200
|
-
const baseStyles = {
|
|
1201
|
-
ml: 2,
|
|
1202
|
-
px: 2,
|
|
1203
|
-
py: 0,
|
|
1204
|
-
fontSize: "xs",
|
|
1205
|
-
borderRadius: "full",
|
|
1206
|
-
backgroundColor: colors.bg,
|
|
1207
|
-
color: colors.color,
|
|
1208
|
-
border: "1px solid",
|
|
1209
|
-
borderColor: "border.default",
|
|
1210
|
-
fontWeight: "medium",
|
|
1211
|
-
lineHeight: 1.5,
|
|
1212
|
-
display: "inline-flex",
|
|
1213
|
-
alignItems: "center"
|
|
1214
|
-
};
|
|
1215
|
-
if (Array.isArray(children)) {
|
|
1216
|
-
return /* @__PURE__ */React13.createElement(Box, {
|
|
1217
|
-
as: "span",
|
|
1218
|
-
sx: {
|
|
1219
|
-
ml: 2,
|
|
1220
|
-
display: "inline-flex",
|
|
1221
|
-
alignItems: "center",
|
|
1222
|
-
gap: 1,
|
|
1223
|
-
...sx
|
|
1224
|
-
}
|
|
1225
|
-
}, children.map((child, i) => {
|
|
1226
|
-
return /* @__PURE__ */React13.createElement(Box, {
|
|
1227
|
-
key: i,
|
|
1228
|
-
as: "span",
|
|
1229
|
-
sx: {
|
|
1230
|
-
...baseStyles,
|
|
1231
|
-
px: 2,
|
|
1232
|
-
py: 0,
|
|
1233
|
-
fontSize: "xs",
|
|
1234
|
-
backgroundColor: colors.bg,
|
|
1235
|
-
color: colors.color
|
|
1236
|
-
}
|
|
1237
|
-
}, child);
|
|
1238
|
-
}));
|
|
1239
|
-
}
|
|
1240
|
-
return /* @__PURE__ */React13.createElement(Box, {
|
|
1241
|
-
as: "span",
|
|
1242
|
-
sx: {
|
|
1243
|
-
...baseStyles,
|
|
1244
|
-
...sx
|
|
1245
|
-
}
|
|
1246
|
-
}, children);
|
|
1247
|
-
}, "Tag");
|
|
1248
|
-
|
|
1249
|
-
// src/components/Textarea.tsx
|
|
1250
|
-
import { Icon as Icon7 } from "@ttoss/react-icons";
|
|
1251
|
-
import * as React14 from "react";
|
|
1252
|
-
import { Textarea as TextareaUI } from "theme-ui";
|
|
1253
|
-
var Textarea = /* @__PURE__ */React14.forwardRef(({
|
|
1254
|
-
trailingIcon,
|
|
1255
|
-
className,
|
|
1256
|
-
sx,
|
|
1257
|
-
...textareaProps
|
|
1258
|
-
}, ref) => {
|
|
1259
|
-
return /* @__PURE__ */React14.createElement(Flex, {
|
|
1260
|
-
className,
|
|
1261
|
-
sx: {
|
|
1262
|
-
...sx,
|
|
1263
|
-
position: "relative",
|
|
1264
|
-
padding: 0,
|
|
1265
|
-
border: "none"
|
|
1266
|
-
}
|
|
1267
|
-
}, /* @__PURE__ */React14.createElement(TextareaUI, {
|
|
1268
|
-
ref,
|
|
1269
|
-
sx: {
|
|
1270
|
-
fontFamily: "body",
|
|
1271
|
-
paddingY: "4",
|
|
1272
|
-
paddingX: "5",
|
|
1273
|
-
...sx,
|
|
1274
|
-
paddingRight: trailingIcon ? "7" : void 0,
|
|
1275
|
-
margin: 0
|
|
1276
|
-
},
|
|
1277
|
-
className,
|
|
1278
|
-
...textareaProps
|
|
1279
|
-
}), trailingIcon && /* @__PURE__ */React14.createElement(Text, {
|
|
1280
|
-
sx: {
|
|
1281
|
-
position: "absolute",
|
|
1282
|
-
right: "1.25rem",
|
|
1283
|
-
top: "0.75rem"
|
|
1284
|
-
}
|
|
1285
|
-
}, /* @__PURE__ */React14.createElement(Icon7, {
|
|
1286
|
-
inline: true,
|
|
1287
|
-
icon: trailingIcon
|
|
1288
|
-
})));
|
|
1289
|
-
});
|
|
1290
|
-
Textarea.displayName = "Textarea";
|
|
1291
|
-
|
|
1292
|
-
// src/components/TooltipIcon.tsx
|
|
1293
|
-
import { Icon as Icon8 } from "@ttoss/react-icons";
|
|
1294
|
-
import * as React15 from "react";
|
|
1295
|
-
var TooltipIcon = /* @__PURE__ */__name(({
|
|
1296
|
-
icon,
|
|
1297
|
-
onClick,
|
|
1298
|
-
tooltip,
|
|
1299
|
-
"data-testid": dataTestId,
|
|
1300
|
-
variant,
|
|
1301
|
-
sx
|
|
1302
|
-
}) => {
|
|
1303
|
-
const id = React15.useId();
|
|
1304
|
-
const tooltipId = `${id}-tooltip`;
|
|
1305
|
-
return /* @__PURE__ */React15.createElement(React15.Fragment, null, /* @__PURE__ */React15.createElement(Text, {
|
|
1306
|
-
"data-testid": dataTestId,
|
|
1307
|
-
"data-tooltip-id": tooltip ? tooltipId : void 0,
|
|
1308
|
-
sx: {
|
|
1309
|
-
cursor: onClick ? "pointer" : "default",
|
|
1310
|
-
...sx
|
|
1311
|
-
},
|
|
1312
|
-
onClick,
|
|
1313
|
-
variant
|
|
1314
|
-
}, /* @__PURE__ */React15.createElement(Icon8, {
|
|
1315
|
-
inline: true,
|
|
1316
|
-
icon
|
|
1317
|
-
})), tooltip && /* @__PURE__ */React15.createElement(Tooltip, {
|
|
1318
|
-
id: tooltipId,
|
|
1319
|
-
...tooltip,
|
|
1320
|
-
variant
|
|
1321
|
-
}));
|
|
1322
|
-
}, "TooltipIcon");
|
|
1323
|
-
|
|
1324
|
-
// src/theme/ThemeProvider.tsx
|
|
1325
|
-
import { css, Global } from "@emotion/react";
|
|
1326
|
-
import { BruttalFonts, BruttalTheme } from "@ttoss/theme/Bruttal";
|
|
1327
|
-
import * as React16 from "react";
|
|
1328
|
-
import { ThemeUIProvider } from "theme-ui";
|
|
1329
|
-
var ThemeProvider = /* @__PURE__ */__name(({
|
|
1330
|
-
children,
|
|
1331
|
-
theme = BruttalTheme,
|
|
1332
|
-
fonts = BruttalFonts
|
|
1333
|
-
}) => {
|
|
1334
|
-
return /* @__PURE__ */React16.createElement(React16.Fragment, null, /* @__PURE__ */React16.createElement(ThemeUIProvider, {
|
|
1335
|
-
theme
|
|
1336
|
-
}, /* @__PURE__ */React16.createElement(Global, {
|
|
1337
|
-
styles: css`
|
|
1338
|
-
${fonts.map(url => {
|
|
1339
|
-
return `@import url('${url}');`;
|
|
1340
|
-
}).join("\n")}
|
|
1341
|
-
`
|
|
1342
|
-
}), children));
|
|
1343
|
-
}, "ThemeProvider");
|
|
1344
|
-
|
|
1345
|
-
// src/theme/useTheme.ts
|
|
1346
|
-
import { useThemeUI } from "theme-ui";
|
|
1347
|
-
var useTheme = useThemeUI;
|
|
1348
|
-
|
|
1349
|
-
// src/index.ts
|
|
1350
|
-
import { keyframes } from "@emotion/react";
|
|
1351
|
-
import { useBreakpointIndex, useResponsiveValue } from "@theme-ui/match-media";
|
|
1352
|
-
import { BaseStyles, Global as Global2 } from "theme-ui";
|
|
1353
|
-
export { ActionButton, Badge, BaseStyles, Box, Button, Card, Checkbox, CloseButton, Container, Divider, Flex, Global2 as Global, Grid, Heading, HelpText, IconButton, Image, InfiniteLinearProgress, Input, InputNumber, InputPassword, Label, Progress as LinearProgress, Link, Paragraph, Radio, SegmentedControl, Select, Slider, Spinner, Stack, Switch, Tag, Text, Textarea, ThemeProvider, Tooltip, TooltipIcon, keyframes, useBreakpointIndex, useResponsiveValue, useTheme };
|