@northlight/ui 1.0.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.
@@ -0,0 +1,3562 @@
1
+ import React, { forwardRef as forwardRef$1, useRef, cloneElement, createContext, memo, useState, useEffect, useMemo, useContext, Suspense } from 'react';
2
+ import { Switch as Switch$3, Route, Redirect, NavLink, useLocation, useHistory, BrowserRouter } from 'react-router-dom';
3
+ import { last, map, prop, difference, times, merge, is, identity, filter, test, toLower, head } from 'ramda';
4
+ import { forwardRef, useStyleConfig, Icon as Icon$2, Box, Button as Button$2, FormLabel as FormLabel$1, VisuallyHidden, IconButton as IconButton$1, useMultiStyleConfig, chakra, Table, Thead, Tbody, Tr, Tag as Tag$2, TagLabel, TagRightIcon, useEditableControls, useEditableState, HStack, Editable, InputGroup, InputLeftElement, Input as Input$1, EditablePreview, EditableInput, InputRightElement, Modal as Modal$2, ModalOverlay, ModalContent, ModalCloseButton, ModalHeader, ModalBody, Stack, Slider, SliderTrack, SliderFilledTrack, SliderThumb, ModalFooter, keyframes, useToken as useToken$1, extendTheme, ChakraProvider, Switch as Switch$2, Text, useDisclosure, Card, Grid, Flex, FormControl } from '@chakra-ui/react';
5
+ import { CheckDuo, SearchDuo, DotsMatrixSolid, XCloseSolid, EditDuo, ZoomInDuo, ArrowCircleRightDuo } from '@mediatool/icons';
6
+ import { useToken, useMultiStyleConfig as useMultiStyleConfig$1, chakra as chakra$1 } from '@chakra-ui/system';
7
+ import { palette, WebappSkin as WebappSkin$1, typography, TottSkin as TottSkin$1, coreZIndex, coreSizing, coreSpacing, coreFontWeight, coreBoxShadow, coreFontSize, coreLineHeight, coreBorderRadius } from '@mediatool/tokens';
8
+ import 'react-hook-form';
9
+ import { useFocusManager } from '@react-aria/focus';
10
+ import '@react-aria/checkbox';
11
+ import '@react-aria/radio';
12
+ import '@react-aria/utils';
13
+ import '@react-stately/radio';
14
+ import '@react-stately/checkbox';
15
+ import '@react-aria/datepicker';
16
+ import '@react-stately/datepicker';
17
+ import { today, isSameMonth, getWeeksInMonth } from '@internationalized/date';
18
+ import '@react-aria/button';
19
+ import { I18nProvider as I18nProvider$1 } from '@react-aria/i18n';
20
+ import '@react-stately/calendar';
21
+ import { useCalendarCell, useCalendarGrid } from '@react-aria/calendar';
22
+ import '@chakra-ui/clickable';
23
+ import 'framer-motion';
24
+ import { chakraComponents, AsyncSelect } from 'chakra-react-select';
25
+ import debounce from 'lodash.debounce';
26
+ import '@dnd-kit/core';
27
+ import '@dnd-kit/utilities';
28
+ import '@dnd-kit/sortable';
29
+ import '@dnd-kit/modifiers';
30
+ import { VariableSizeList, VariableSizeGrid } from 'react-window';
31
+ import AutoSizer from 'react-virtualized-auto-sizer';
32
+ import AvatarEditor from 'react-avatar-editor';
33
+ import 'react-input-mask';
34
+ import { I18nManager, I18nContext } from '@shopify/react-i18n';
35
+ import Fuse from 'fuse.js';
36
+
37
+ const Icon$1 = forwardRef(({
38
+ as: As,
39
+ size,
40
+ color,
41
+ boxSize,
42
+ ...rest
43
+ }, ref) => {
44
+ const CustomIcon = As ?? (() => /* @__PURE__ */ React.createElement(Icon$2, null));
45
+ const styles = useStyleConfig("Icon", { size, color, boxSize });
46
+ return /* @__PURE__ */ React.createElement(Icon$2, {
47
+ ref,
48
+ sx: styles,
49
+ ...rest
50
+ }, /* @__PURE__ */ React.createElement(CustomIcon, null));
51
+ });
52
+
53
+ const luminosity = (hexcolor) => {
54
+ let color = hexcolor;
55
+ if (color.slice(0, 1) === "#") {
56
+ color = color.slice(1);
57
+ }
58
+ if (color.length === 3) {
59
+ color = color.split("").map((hex) => hex + hex).join("");
60
+ }
61
+ const r = parseInt(color.substring(0, 2), 16);
62
+ const g = parseInt(color.substring(2, 4), 16);
63
+ const b = parseInt(color.substring(4, 6), 16);
64
+ const brightness = (r * 299 + g * 587 + b * 114) / 1e3;
65
+ return brightness;
66
+ };
67
+
68
+ const getContrastColor = (color) => {
69
+ const colorTwo = useToken("colors", "text.default");
70
+ const colorOne = useToken("colors", "text.inverted");
71
+ const colorInHex = useToken("colors", color);
72
+ const l1 = luminosity(colorOne);
73
+ const l2 = luminosity(colorTwo);
74
+ const threshold = (l1 + l2) / 2;
75
+ const brightColor = l1 > l2 ? colorOne : colorTwo;
76
+ const darkColor = l1 > l2 ? colorTwo : colorOne;
77
+ return luminosity(colorInHex) >= threshold ? darkColor : brightColor;
78
+ };
79
+
80
+ const ring = {
81
+ _focusVisible: {
82
+ outline: "none",
83
+ ring: "2px",
84
+ ringColor: "border.wcag",
85
+ ringOffset: "1px"
86
+ }
87
+ };
88
+
89
+ const getShades = (startShade, endShade) => {
90
+ let start;
91
+ let end;
92
+ if (!endShade) {
93
+ start = startShade;
94
+ end = startShade;
95
+ } else if (endShade > startShade) {
96
+ start = startShade;
97
+ end = endShade;
98
+ } else {
99
+ start = endShade;
100
+ end = startShade;
101
+ }
102
+ return Object.keys(palette).reduce((colors, color) => {
103
+ if (color === "mono")
104
+ return colors;
105
+ return colors.concat(
106
+ Object.keys(palette[color]).filter(
107
+ (value) => parseInt(value, 10) >= start && parseInt(value, 10) <= end
108
+ ).map((shade) => palette[color][shade])
109
+ );
110
+ }, []);
111
+ };
112
+
113
+ const Blinker$1 = ({
114
+ color = "",
115
+ size,
116
+ isBlinking = true,
117
+ ...rest
118
+ }) => {
119
+ const styles = useStyleConfig("Blinker", { color, size, isBlinking });
120
+ return /* @__PURE__ */ React.createElement(Box, {
121
+ sx: styles,
122
+ "data-testid": "blinker-test-id",
123
+ ...rest
124
+ });
125
+ };
126
+
127
+ const Button$1 = forwardRef$1(({
128
+ variant = "default",
129
+ children,
130
+ ...rest
131
+ }, ref) => /* @__PURE__ */ React.createElement(Button$2, {
132
+ variant,
133
+ ref,
134
+ ...rest
135
+ }, children));
136
+
137
+ const Label$1 = ({
138
+ children,
139
+ size = "sm",
140
+ sx = {},
141
+ ...rest
142
+ }) => {
143
+ const styles = useStyleConfig("Label", { sx, size });
144
+ return /* @__PURE__ */ React.createElement(FormLabel$1, {
145
+ sx: styles,
146
+ requiredIndicator: /* @__PURE__ */ React.createElement(VisuallyHidden, null),
147
+ ...rest
148
+ }, children);
149
+ };
150
+
151
+ const FormLabel = ({
152
+ children: label,
153
+ ...rest
154
+ }) => /* @__PURE__ */ React.createElement(Label$1, {
155
+ size: "sm",
156
+ sx: {
157
+ width: "80%",
158
+ maxWidth: "45ch",
159
+ marginBottom: 1,
160
+ marginInlineEnd: 3
161
+ },
162
+ requiredIndicator: void 0,
163
+ ...rest
164
+ }, label);
165
+
166
+ const useArrowFocus = (columns) => {
167
+ const {
168
+ focusNext: next,
169
+ focusPrevious: previous,
170
+ focusFirst,
171
+ focusLast
172
+ } = useFocusManager();
173
+ const defaultOpts = {
174
+ ArrowRight: {
175
+ wrap: true,
176
+ repeat: 1
177
+ },
178
+ ArrowLeft: {
179
+ wrap: true,
180
+ repeat: 1
181
+ },
182
+ ArrowDown: {
183
+ wrap: false,
184
+ repeat: columns
185
+ },
186
+ ArrowUp: {
187
+ wrap: false,
188
+ repeat: columns
189
+ }
190
+ };
191
+ const focusPrevious = ({
192
+ repeat,
193
+ wrap
194
+ } = defaultOpts.ArrowLeft) => {
195
+ for (let i = 0; i < repeat; i += 1) {
196
+ previous({ wrap });
197
+ }
198
+ };
199
+ const focusNext = ({
200
+ repeat,
201
+ wrap
202
+ } = defaultOpts.ArrowRight) => {
203
+ for (let i = 0; i < repeat; i += 1) {
204
+ next({ wrap });
205
+ }
206
+ };
207
+ const defaultArrows = (e) => {
208
+ switch (e.key) {
209
+ case "ArrowRight":
210
+ focusNext(defaultOpts.ArrowRight);
211
+ break;
212
+ case "ArrowLeft":
213
+ focusPrevious(defaultOpts.ArrowLeft);
214
+ break;
215
+ case "ArrowDown":
216
+ e.preventDefault();
217
+ focusNext(defaultOpts.ArrowDown);
218
+ break;
219
+ case "ArrowUp":
220
+ e.preventDefault();
221
+ focusPrevious(defaultOpts.ArrowUp);
222
+ break;
223
+ }
224
+ };
225
+ return {
226
+ defaultArrows,
227
+ focusPrevious,
228
+ focusNext,
229
+ focusFirst,
230
+ focusLast
231
+ };
232
+ };
233
+
234
+ const useSelectCallbacks = ({
235
+ onChange,
236
+ onAdd,
237
+ onRemove,
238
+ isMulti,
239
+ value
240
+ }) => {
241
+ const items = useRef(value);
242
+ const handleChange = (val, event) => {
243
+ onChange(val, event);
244
+ if (!isMulti) {
245
+ onAdd(val.value);
246
+ } else if (val.length > items.current.length) {
247
+ onAdd(last(val)?.value);
248
+ } else {
249
+ const removedItems = map(
250
+ prop("value"),
251
+ difference(items.current, val)
252
+ );
253
+ onRemove(removedItems.length === 1 ? removedItems[0] : removedItems);
254
+ }
255
+ items.current = val;
256
+ };
257
+ return handleChange;
258
+ };
259
+
260
+ const IconButton = forwardRef$1(({
261
+ variant = "default",
262
+ icon,
263
+ "aria-label": ariaLabel,
264
+ children,
265
+ ...rest
266
+ }, ref) => {
267
+ const IconComponent = icon ?? children;
268
+ const IconWithSize = cloneElement(IconComponent, { size: rest.size });
269
+ return /* @__PURE__ */ React.createElement(IconButton$1, {
270
+ variant,
271
+ icon: IconWithSize,
272
+ "aria-label": ariaLabel,
273
+ ref,
274
+ ...rest
275
+ });
276
+ });
277
+
278
+ const columns = 5;
279
+ getShades(100, 500);
280
+ getShades(500);
281
+
282
+ forwardRef$1(({
283
+ color,
284
+ onClick,
285
+ size,
286
+ selected = false
287
+ }, ref) => {
288
+ if (!color)
289
+ return /* @__PURE__ */ React.createElement(Box, null);
290
+ const { defaultArrows, focusPrevious, focusNext } = useArrowFocus(columns);
291
+ const onKeyDown = (e) => {
292
+ switch (e.key) {
293
+ case "PageUp":
294
+ e.preventDefault();
295
+ focusPrevious({ wrap: false, repeat: columns * 5 });
296
+ break;
297
+ case "PageDown":
298
+ e.preventDefault();
299
+ focusNext({ wrap: false, repeat: columns * 5 });
300
+ break;
301
+ default:
302
+ defaultArrows(e);
303
+ break;
304
+ }
305
+ };
306
+ const { colorButton } = useMultiStyleConfig("ColorPicker", { size });
307
+ return /* @__PURE__ */ React.createElement(IconButton, {
308
+ bg: color,
309
+ ref,
310
+ onKeyDown,
311
+ "aria-label": `select-${color}`,
312
+ onClick,
313
+ sx: colorButton,
314
+ icon: /* @__PURE__ */ React.createElement(Icon$1, {
315
+ as: CheckDuo,
316
+ boxSize: selected ? void 0 : "0"
317
+ }),
318
+ color: getContrastColor(color)
319
+ });
320
+ });
321
+
322
+ createContext(null);
323
+
324
+ forwardRef$1(
325
+ ({ isInvalid, isDisabled, children, ...rest }, ref) => {
326
+ const { styledField } = useMultiStyleConfig("DatePicker");
327
+ return /* @__PURE__ */ React.createElement(Box, {
328
+ ...rest,
329
+ ref,
330
+ "aria-invalid": isInvalid,
331
+ "aria-disabled": isDisabled,
332
+ display: "flex",
333
+ alignItems: "center",
334
+ h: 10,
335
+ __css: styledField
336
+ }, children);
337
+ }
338
+ );
339
+
340
+ const CalendarCell = ({
341
+ state,
342
+ date,
343
+ currentMonth
344
+ }) => {
345
+ const ref = useRef(null);
346
+ const { cellProps, buttonProps, isSelected, formattedDate } = useCalendarCell(
347
+ { date },
348
+ state,
349
+ ref
350
+ );
351
+ const isToday = date.compare(today(state.timeZone)) === 0;
352
+ const isOutsideMonth = !isSameMonth(currentMonth, date);
353
+ return /* @__PURE__ */ React.createElement(chakra.td, {
354
+ ...cellProps
355
+ }, /* @__PURE__ */ React.createElement(Button$1, {
356
+ ...buttonProps,
357
+ ref,
358
+ rounded: "full",
359
+ boxSize: 8,
360
+ hidden: isOutsideMonth,
361
+ size: "sm",
362
+ fontWeight: "medium",
363
+ variant: isSelected ? "brand" : "ghost",
364
+ borderWidth: isToday ? "1px" : "none"
365
+ }, formattedDate));
366
+ };
367
+
368
+ const DayLabels = memo(({
369
+ weekDays
370
+ }) => {
371
+ const { dayLabel } = useMultiStyleConfig$1("Calendar");
372
+ const weekDaysWithIds = weekDays.map((day, i) => ({ label: day, _id: i }));
373
+ return /* @__PURE__ */ React.createElement(chakra$1.tr, null, weekDaysWithIds.map(({ label, _id }) => /* @__PURE__ */ React.createElement(chakra$1.th, {
374
+ key: _id,
375
+ __css: dayLabel
376
+ }, label)));
377
+ });
378
+
379
+ memo(
380
+ ({ state, locale, ...rest }) => {
381
+ const startDate = state.visibleRange.start;
382
+ const { gridProps, headerProps, weekDays } = useCalendarGrid(rest, state);
383
+ const weeksInMonth = getWeeksInMonth(startDate, locale);
384
+ return /* @__PURE__ */ React.createElement(Table, {
385
+ variant: "unstyled",
386
+ ...gridProps
387
+ }, /* @__PURE__ */ React.createElement(Thead, {
388
+ ...headerProps
389
+ }, /* @__PURE__ */ React.createElement(DayLabels, {
390
+ weekDays
391
+ })), /* @__PURE__ */ React.createElement(Tbody, null, times((weekIndex) => /* @__PURE__ */ React.createElement(Tr, {
392
+ key: weekIndex
393
+ }, state.getDatesInWeek(weekIndex, startDate).map(
394
+ (date) => date ? /* @__PURE__ */ React.createElement(CalendarCell, {
395
+ key: date.day,
396
+ state,
397
+ date,
398
+ currentMonth: startDate
399
+ }) : /* @__PURE__ */ React.createElement(chakra.td, null)
400
+ )), weeksInMonth)));
401
+ }
402
+ );
403
+
404
+ `1px solid ${palette.gray["100"]}`;
405
+
406
+ const searchBarStyles = (sx) => merge({
407
+ container: (provided) => ({
408
+ ...provided,
409
+ width: "100%",
410
+ color: "text.default"
411
+ }),
412
+ option: (provided, state) => ({
413
+ ...provided,
414
+ background: state.isFocused && "background.select.option-focus",
415
+ _active: {
416
+ background: "background.select.option-active"
417
+ }
418
+ }),
419
+ valueContainer: (provided) => ({
420
+ ...provided,
421
+ paddingInlineStart: "padding-inline.select.default"
422
+ }),
423
+ downChevron: (provided) => ({
424
+ ...provided,
425
+ color: "icon.select.default"
426
+ }),
427
+ placeholder: (provided) => ({
428
+ ...provided,
429
+ color: "text.select.placeholder"
430
+ }),
431
+ multiValue: (provided, state) => {
432
+ const background = state.data.isFixed ? "background.select.option-disabled" : state.data.color ?? provided.bgColor;
433
+ return {
434
+ ...provided,
435
+ bgColor: background,
436
+ color: getContrastColor(background),
437
+ ...sx.multiValue
438
+ };
439
+ },
440
+ menuList: (provided) => ({
441
+ ...provided,
442
+ bgColor: "background.default"
443
+ })
444
+ }, sx);
445
+
446
+ function getComponents() {
447
+ return {
448
+ DropdownIndicator: (props) => props.selectProps.icon ? /* @__PURE__ */ React.createElement(chakraComponents.DropdownIndicator, {
449
+ ...props
450
+ }, /* @__PURE__ */ React.createElement(Icon$1, {
451
+ as: props.selectProps.icon
452
+ })) : /* @__PURE__ */ React.createElement(chakraComponents.DropdownIndicator, {
453
+ ...props
454
+ }),
455
+ Option: (props) => props.selectProps.customOption ? /* @__PURE__ */ React.createElement(chakraComponents.Option, {
456
+ ...props
457
+ }, props.selectProps.customOption(props.data)) : /* @__PURE__ */ React.createElement(chakraComponents.Option, {
458
+ ...props
459
+ }),
460
+ MultiValueContainer: (props) => props.selectProps.customTag ? /* @__PURE__ */ React.createElement(chakraComponents.MultiValueContainer, {
461
+ ...props
462
+ }, props.selectProps.customTag(props.data)) : /* @__PURE__ */ React.createElement(chakraComponents.MultiValueContainer, {
463
+ ...props
464
+ })
465
+ };
466
+ }
467
+
468
+ const SearchBar = forwardRef$1(
469
+ ({
470
+ defaultOptions = [],
471
+ isMulti = false,
472
+ customOption = null,
473
+ customTag = null,
474
+ sx = {},
475
+ debouncedWaitTime = 300,
476
+ debouncedOptions = {},
477
+ loadOptions: getCustomOptions = null,
478
+ clearInputOnSelect = true,
479
+ closeMenuOnSelect = false,
480
+ onChange = identity,
481
+ onAdd = identity,
482
+ onRemove = identity,
483
+ "data-testid": testId,
484
+ value,
485
+ onSearchInputChange = identity,
486
+ icon = SearchDuo,
487
+ ...rest
488
+ }, ref) => {
489
+ const [filtered, setFiltered] = useState(defaultOptions);
490
+ const [filterInput, setFilterInput] = useState("");
491
+ const handleChange = useSelectCallbacks({
492
+ onChange,
493
+ onAdd,
494
+ onRemove,
495
+ isMulti,
496
+ value: is(Array, value) ? value : []
497
+ });
498
+ const customComponents = getComponents();
499
+ const simpleFilter = (query) => filter(
500
+ (option) => test(new RegExp(toLower(query), "g"), toLower(option.label)),
501
+ defaultOptions
502
+ );
503
+ const getOptions = async (query) => {
504
+ const newOptions = getCustomOptions ? await getCustomOptions(query) : simpleFilter(query);
505
+ setFiltered(newOptions);
506
+ return newOptions;
507
+ };
508
+ const loadOptions = async (query, callback) => {
509
+ const newOptions = await getOptions(query);
510
+ callback(newOptions);
511
+ return [];
512
+ };
513
+ const debouncedLoadOptions = debounce(
514
+ loadOptions,
515
+ debouncedWaitTime,
516
+ debouncedOptions
517
+ );
518
+ const resetFiltered = (v, { action }) => {
519
+ if (clearInputOnSelect || action !== "set-value") {
520
+ setFilterInput(v);
521
+ onSearchInputChange(v);
522
+ if (v === "") {
523
+ setFiltered(defaultOptions);
524
+ }
525
+ }
526
+ };
527
+ return /* @__PURE__ */ React.createElement(Box, {
528
+ w: "full",
529
+ "data-testid": testId
530
+ }, /* @__PURE__ */ React.createElement(AsyncSelect, {
531
+ cacheOptions: true,
532
+ defaultOptions: filtered,
533
+ loadOptions: debouncedLoadOptions,
534
+ onChange: handleChange,
535
+ placeholder: "Search ...",
536
+ chakraStyles: searchBarStyles(sx),
537
+ isMulti,
538
+ useBasicStyles: true,
539
+ selectedOptionStyle: "check",
540
+ hideSelectedOptions: false,
541
+ closeMenuOnSelect,
542
+ isClearable: false,
543
+ onInputChange: resetFiltered,
544
+ inputValue: filterInput,
545
+ customOption,
546
+ customTag,
547
+ icon,
548
+ components: customComponents,
549
+ ref,
550
+ value,
551
+ ...rest
552
+ }));
553
+ }
554
+ );
555
+
556
+ const Tag$1 = forwardRef$1(({
557
+ children,
558
+ variant = "solid",
559
+ bgColor,
560
+ colorScheme,
561
+ ...rest
562
+ }, ref) => /* @__PURE__ */ React.createElement(Tag$2, {
563
+ bgColor,
564
+ colorScheme,
565
+ ref,
566
+ variant,
567
+ ...rest
568
+ }, children));
569
+
570
+ forwardRef$1(
571
+ ({
572
+ size = "md",
573
+ isDragging,
574
+ itemLabel = "Drag Me",
575
+ bgColor,
576
+ ...rest
577
+ }, ref) => /* @__PURE__ */ React.createElement(Tag$1, {
578
+ ref,
579
+ cursor: isDragging ? "grabbing" : "grab",
580
+ bgColor: bgColor || (isDragging ? "blue.200" : void 0),
581
+ size,
582
+ minW: "max-content",
583
+ ...rest
584
+ }, /* @__PURE__ */ React.createElement(TagLabel, null, itemLabel), /* @__PURE__ */ React.createElement(TagRightIcon, null, /* @__PURE__ */ React.createElement(Icon$1, {
585
+ as: DotsMatrixSolid
586
+ })))
587
+ );
588
+
589
+ forwardRef$1(({
590
+ itemCount,
591
+ itemSize,
592
+ direction = "column",
593
+ children,
594
+ width,
595
+ height,
596
+ overscanCount = 0,
597
+ initialScrollOffset,
598
+ ...rest
599
+ }, ref) => /* @__PURE__ */ React.createElement(AutoSizer, null, ({ width: autoWidth, height: autoHeight }) => /* @__PURE__ */ React.createElement(VariableSizeList, {
600
+ itemCount,
601
+ itemSize: typeof itemSize === "number" ? (_index) => itemSize : itemSize,
602
+ height: height ?? autoHeight,
603
+ width: width ?? autoWidth,
604
+ layout: direction === "column" ? "vertical" : "horizontal",
605
+ initialScrollOffset,
606
+ overscanCount,
607
+ ref,
608
+ ...rest
609
+ }, ({ style, index }) => /* @__PURE__ */ React.createElement("div", {
610
+ style
611
+ }, typeof children === "function" ? children(index) : children))));
612
+
613
+ forwardRef$1(({
614
+ columns,
615
+ rows,
616
+ columnSize,
617
+ rowSize,
618
+ children,
619
+ width,
620
+ height,
621
+ overscanRowCount = 0,
622
+ overscanColumnCount = 0,
623
+ ...rest
624
+ }, ref) => /* @__PURE__ */ React.createElement(AutoSizer, null, ({ width: autoWidth, height: autoHeight }) => /* @__PURE__ */ React.createElement(VariableSizeGrid, {
625
+ rowCount: rows,
626
+ columnCount: columns,
627
+ columnWidth: typeof columnSize === "number" ? (_index) => columnSize : columnSize,
628
+ rowHeight: typeof rowSize === "number" ? (_index) => rowSize : rowSize,
629
+ height: height ?? autoHeight,
630
+ width: width ?? autoWidth,
631
+ overscanRowCount,
632
+ overscanColumnCount,
633
+ ref,
634
+ ...rest
635
+ }, ({ style, rowIndex, columnIndex }) => /* @__PURE__ */ React.createElement("div", {
636
+ style
637
+ }, typeof children === "function" ? children(rowIndex, columnIndex) : children))));
638
+
639
+ const EditableControls = ({ size }) => {
640
+ const {
641
+ getSubmitButtonProps,
642
+ getCancelButtonProps
643
+ } = useEditableControls();
644
+ const { onEdit, isEditing } = useEditableState();
645
+ const { button, icon, controls } = useMultiStyleConfig("EditableText", { size, isEditing });
646
+ return /* @__PURE__ */ React.createElement(HStack, {
647
+ spacing: 1,
648
+ sx: controls
649
+ }, isEditing ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(IconButton, {
650
+ "aria-label": "Cancel",
651
+ sx: button,
652
+ variant: "danger",
653
+ ...getCancelButtonProps()
654
+ }, /* @__PURE__ */ React.createElement(Icon$1, {
655
+ sx: icon,
656
+ as: XCloseSolid
657
+ })), /* @__PURE__ */ React.createElement(IconButton, {
658
+ "aria-label": "Save",
659
+ sx: button,
660
+ variant: "success",
661
+ ...getSubmitButtonProps()
662
+ }, /* @__PURE__ */ React.createElement(Icon$1, {
663
+ sx: icon,
664
+ as: CheckDuo
665
+ }))) : /* @__PURE__ */ React.createElement(IconButton, {
666
+ "aria-label": "Edit",
667
+ variant: "ghost",
668
+ sx: button,
669
+ onClick: onEdit
670
+ }, /* @__PURE__ */ React.createElement(Icon$1, {
671
+ sx: icon,
672
+ as: EditDuo
673
+ })));
674
+ };
675
+
676
+ const EditableText$1 = ({
677
+ size = "md",
678
+ value: inputValue,
679
+ onSubmit,
680
+ leftItem,
681
+ ...rest
682
+ }) => {
683
+ const [value, setValue] = useState(inputValue);
684
+ const { input, preview } = useMultiStyleConfig("EditableText", { size });
685
+ useEffect(() => {
686
+ setValue(inputValue);
687
+ }, [inputValue]);
688
+ return /* @__PURE__ */ React.createElement(Editable, {
689
+ isPreviewFocusable: true,
690
+ selectAllOnFocus: false,
691
+ value,
692
+ onChange: (newValue) => setValue(newValue),
693
+ onSubmit,
694
+ ...rest
695
+ }, /* @__PURE__ */ React.createElement(InputGroup, {
696
+ size
697
+ }, leftItem && /* @__PURE__ */ React.createElement(InputLeftElement, null, leftItem), /* @__PURE__ */ React.createElement(Input$1, {
698
+ as: EditablePreview,
699
+ sx: preview
700
+ }), /* @__PURE__ */ React.createElement(Input$1, {
701
+ as: EditableInput,
702
+ size,
703
+ sx: input
704
+ }), /* @__PURE__ */ React.createElement(InputRightElement, {
705
+ sx: { width: "min-content" }
706
+ }, /* @__PURE__ */ React.createElement(EditableControls, {
707
+ size
708
+ }))));
709
+ };
710
+
711
+ const Modal$1 = ({
712
+ isCentered = true,
713
+ children,
714
+ ...rest
715
+ }) => /* @__PURE__ */ React.createElement(Modal$2, {
716
+ isCentered,
717
+ scrollBehavior: "inside",
718
+ motionPreset: "slideInBottom",
719
+ ...rest
720
+ }, /* @__PURE__ */ React.createElement(ModalOverlay, null), /* @__PURE__ */ React.createElement(ModalContent, {
721
+ "data-testid": "modal-test-id"
722
+ }, /* @__PURE__ */ React.createElement(ModalCloseButton, {
723
+ "data-testid": "modal-test-button-id"
724
+ }), children));
725
+
726
+ forwardRef$1(({
727
+ fileName,
728
+ setFileName,
729
+ isOpen,
730
+ onClose,
731
+ image = "",
732
+ handleCrop,
733
+ isImage,
734
+ canEditFileName = true,
735
+ canCropImage = false,
736
+ ...rest
737
+ }, ref) => {
738
+ const [zoomLevel, setZoomLevel] = useState(1);
739
+ const [position, setPosition] = useState({ x: 0.5, y: 0.5 });
740
+ const handleClose = () => {
741
+ setZoomLevel(1);
742
+ onClose();
743
+ };
744
+ return /* @__PURE__ */ React.createElement(Modal$1, {
745
+ isOpen,
746
+ onClose,
747
+ closeOnOverlayClick: false,
748
+ ...rest
749
+ }, /* @__PURE__ */ React.createElement(ModalHeader, null, "Edit ", isImage ? "image" : "file"), /* @__PURE__ */ React.createElement(ModalBody, {
750
+ display: "flex",
751
+ justifyContent: "start",
752
+ flexDirection: "column",
753
+ alignItems: "center",
754
+ gap: 4,
755
+ minH: "300px"
756
+ }, /* @__PURE__ */ React.createElement(Stack, {
757
+ display: isImage && canCropImage ? "inherit" : "none"
758
+ }, /* @__PURE__ */ React.createElement(AvatarEditor, {
759
+ ref,
760
+ image: image || "",
761
+ onPositionChange: (pos) => setPosition(pos),
762
+ position,
763
+ width: 250,
764
+ height: 250,
765
+ border: 50,
766
+ color: [255, 255, 255, 0.7],
767
+ scale: zoomLevel,
768
+ rotate: 0
769
+ }), /* @__PURE__ */ React.createElement(HStack, {
770
+ w: "90%"
771
+ }, /* @__PURE__ */ React.createElement(FormLabel, null, "Zoom"), /* @__PURE__ */ React.createElement(Slider, {
772
+ "aria-label": "zoom",
773
+ defaultValue: zoomLevel,
774
+ maxW: "50%",
775
+ min: 0.1,
776
+ step: 0.05,
777
+ max: 10,
778
+ onChange: (value) => setZoomLevel(value)
779
+ }, /* @__PURE__ */ React.createElement(SliderTrack, null, /* @__PURE__ */ React.createElement(SliderFilledTrack, null)), /* @__PURE__ */ React.createElement(SliderThumb, {
780
+ boxSize: 6
781
+ }, /* @__PURE__ */ React.createElement(Icon$1, {
782
+ as: ZoomInDuo
783
+ }))))), canEditFileName && /* @__PURE__ */ React.createElement(Stack, {
784
+ w: "90%",
785
+ direction: isImage ? "row" : "column",
786
+ pt: 2
787
+ }, /* @__PURE__ */ React.createElement(FormLabel, null, "Name the file:"), /* @__PURE__ */ React.createElement(Box, {
788
+ maxW: "50%"
789
+ }, /* @__PURE__ */ React.createElement(EditableText$1, {
790
+ onSubmit: (v) => setFileName(v),
791
+ value: fileName,
792
+ size: "sm"
793
+ })))), /* @__PURE__ */ React.createElement(ModalFooter, null, /* @__PURE__ */ React.createElement(HStack, null, /* @__PURE__ */ React.createElement(Button$1, {
794
+ variant: "danger",
795
+ onClick: handleClose
796
+ }, "Cancel"), /* @__PURE__ */ React.createElement(Button$1, {
797
+ variant: "success",
798
+ onClick: handleCrop
799
+ }, "Save"))));
800
+ });
801
+
802
+ const scrollbarStyles = {
803
+ "::-webkit-scrollbar": {
804
+ width: "8px",
805
+ height: "8px"
806
+ },
807
+ "::-webkit-scrollbar-track": {
808
+ background: "background.scrollbar.track"
809
+ },
810
+ "::-webkit-scrollbar-thumb": {
811
+ borderRadius: "scrollbar.thumb",
812
+ border: "2px solid",
813
+ borderColor: "border.scrollbar.thumb",
814
+ backgroundClip: "padding-box !important",
815
+ background: "background.scrollbar.thumb"
816
+ },
817
+ "::-webkit-scrollbar-thumb:hover": {
818
+ borderRadius: "scrollbar.thumb",
819
+ border: "1px solid ",
820
+ borderColor: "border.scrollbar.thumb",
821
+ backgroundClip: "padding-box !important",
822
+ background: "background.scrollbar.thumb"
823
+ }
824
+ };
825
+
826
+ const Breadcrumb = {
827
+ parts: ["link", "separator"],
828
+ baseStyle: {
829
+ link: {
830
+ padding: [0.5, 1],
831
+ color: "primary",
832
+ fontWeight: "600",
833
+ fontSize: "semibold",
834
+ _hover: {
835
+ bg: "blue.50",
836
+ borderRadius: "base",
837
+ textDecor: "none"
838
+ }
839
+ },
840
+ separator: {
841
+ color: "gray.300",
842
+ fontSize: "semibold"
843
+ }
844
+ }
845
+ };
846
+
847
+ const Button = {
848
+ sizes: {
849
+ xs: ({ theme: { sizes: sizing, space: spacing } }) => ({
850
+ height: sizing.button.xs,
851
+ minWidth: sizing.button.xs,
852
+ paddingInlineStart: spacing["padding-inline"].button.xs,
853
+ paddingInlineEnd: spacing["padding-inline"].button.xs
854
+ }),
855
+ sm: ({ theme: { sizes: sizing, space: spacing } }) => ({
856
+ height: sizing.button.sm,
857
+ minWidth: sizing.button.sm,
858
+ paddingInlineStart: spacing["padding-inline"].button.md,
859
+ paddingInlineEnd: spacing["padding-inline"].button.md
860
+ }),
861
+ md: ({ theme: { sizes: sizing, space: spacing } }) => ({
862
+ height: sizing.button.md,
863
+ minWidth: sizing.button.md,
864
+ paddingInlineStart: spacing["padding-inline"].button.md,
865
+ paddingInlineEnd: spacing["padding-inline"].button.md
866
+ }),
867
+ lg: ({ theme: { sizes: sizing, space: spacing } }) => ({
868
+ height: sizing.button.lg,
869
+ minWidth: sizing.button.lg,
870
+ paddingInlineStart: spacing["padding-inline"].button.lg,
871
+ paddingInlineEnd: spacing["padding-inline"].button.lg
872
+ })
873
+ },
874
+ baseStyle: ({ theme: { colors: color, radii: borderRadius } }) => ({
875
+ color: color.text.default,
876
+ borderRadius: borderRadius.button.default,
877
+ _focusVisible: {
878
+ ring: "2px",
879
+ ringColor: color.border.wcag,
880
+ ringOffset: "1px"
881
+ }
882
+ }),
883
+ variants: {
884
+ default: ({ theme: { colors: color } }) => ({
885
+ bgColor: color.background.button.default,
886
+ _hover: {
887
+ bgColor: color.background.button["default-hover"]
888
+ },
889
+ _active: {
890
+ bgColor: color.background.button["default-active"]
891
+ }
892
+ }),
893
+ danger: ({ theme: { colors: color } }) => ({
894
+ bgColor: color.background.button.danger,
895
+ color: color.text.button.danger,
896
+ _hover: {
897
+ bg: color.background.button["danger-hover"],
898
+ _disabled: {
899
+ bgColor: color.background.button.danger
900
+ }
901
+ },
902
+ _active: {
903
+ bgColor: color.background.button["danger-active"]
904
+ }
905
+ }),
906
+ success: ({ theme: { colors: color } }) => ({
907
+ bgColor: color.background.button.success,
908
+ _hover: {
909
+ bg: color.background.button["success-hover"],
910
+ _disabled: {
911
+ bgColor: color.background.button.success
912
+ }
913
+ },
914
+ _active: {
915
+ bgColor: color.background.button["success-active"]
916
+ }
917
+ }),
918
+ brand: ({ theme: { colors: color } }) => ({
919
+ color: color.text.inverted,
920
+ bgColor: color.background.button.brand,
921
+ _hover: {
922
+ bg: color.background.button["brand-hover"],
923
+ _disabled: {
924
+ bgColor: color.background.button.brand
925
+ }
926
+ },
927
+ _active: {
928
+ bgColor: color.background.button["brand-active"]
929
+ }
930
+ }),
931
+ link: ({ theme: { colors: color } }) => ({
932
+ textDecoration: "underline",
933
+ color: color.text.button.link,
934
+ bgColor: color.background.button.link,
935
+ _hover: {
936
+ color: color.text.button["link-hover"],
937
+ bgColor: color.background.button["link-hover"]
938
+ },
939
+ _active: {
940
+ color: color.text.button["link-hover"],
941
+ bgColor: color.background.button["link-active"]
942
+ }
943
+ }),
944
+ ghost: ({ theme: { colors: color } }) => ({
945
+ color: color.text.default,
946
+ bgColor: color.background.button.ghost,
947
+ _hover: {
948
+ bg: color.background.button["ghost-hover"],
949
+ _disabled: {
950
+ bgColor: color.background.button.ghost
951
+ }
952
+ },
953
+ _active: {
954
+ bgColor: color.background.button["ghost-active"]
955
+ }
956
+ })
957
+ },
958
+ defaultProps: {
959
+ size: "md"
960
+ }
961
+ };
962
+
963
+ const pulseRing = keyframes`
964
+ 0% {
965
+ transform: scale(0.33);
966
+ }
967
+ 30% {
968
+ transform: scale(0.66);
969
+ },
970
+ 40%,
971
+ 50% {
972
+ opacity: 0;
973
+ }
974
+ 100% {
975
+ opacity: 0;
976
+ }
977
+ `;
978
+ const Blinker = {
979
+ baseStyle: ({ theme: { colors: palette }, color, isBlinking }) => ({
980
+ position: "relative",
981
+ borderRadius: "50%",
982
+ bgColor: color === "" ? palette.blue["500"] : color,
983
+ _before: isBlinking ? {
984
+ content: "''",
985
+ position: "absolute",
986
+ display: "block",
987
+ width: "300%",
988
+ height: "300%",
989
+ marginLeft: "-100%",
990
+ marginTop: "-100%",
991
+ borderRadius: "50%",
992
+ bgColor: color === "" ? "blue.500" : color,
993
+ animation: `2.25s ${pulseRing} cubic-bezier(0.455, 0.03, 0.515, 0.955) -0.4s infinite`,
994
+ zIndex: "base"
995
+ } : {}
996
+ }),
997
+ sizes: {
998
+ "2xs": ({ theme: { sizes: sizing } }) => ({
999
+ height: sizing.blinker["2xs"],
1000
+ width: sizing.blinker["2xs"]
1001
+ }),
1002
+ xs: ({ theme: { sizes: sizing } }) => ({
1003
+ height: sizing.blinker.xs,
1004
+ width: sizing.blinker.xs
1005
+ }),
1006
+ sm: ({ theme: { sizes: sizing } }) => ({
1007
+ height: sizing.blinker.sm,
1008
+ width: sizing.blinker.sm
1009
+ }),
1010
+ md: ({ theme: { sizes: sizing } }) => ({
1011
+ height: sizing.blinker.md,
1012
+ width: sizing.blinker.md
1013
+ }),
1014
+ lg: ({ theme: { sizes: sizing } }) => ({
1015
+ height: sizing.blinker.lg,
1016
+ width: sizing.blinker.lg
1017
+ })
1018
+ },
1019
+ defaultProps: {
1020
+ size: "md",
1021
+ color: "blue.500"
1022
+ }
1023
+ };
1024
+
1025
+ const Checkbox = {
1026
+ parts: ["control", "label"],
1027
+ sizes: {
1028
+ sm: {
1029
+ control: {
1030
+ fontSize: 5
1031
+ }
1032
+ },
1033
+ md: {
1034
+ control: {
1035
+ fontSize: 7
1036
+ }
1037
+ },
1038
+ lg: {
1039
+ control: {
1040
+ fontSize: 8
1041
+ }
1042
+ }
1043
+ },
1044
+ baseStyle: ({ theme: { colors: color, opacity } }) => ({
1045
+ control: {
1046
+ borderColor: color.border.checkbox.default,
1047
+ bg: color.background.checkbox.default,
1048
+ borderWidth: 2,
1049
+ _checked: {
1050
+ borderColor: color.border.checkbox.checked,
1051
+ bg: color.background.checkbox.checked,
1052
+ _hover: {
1053
+ borderColor: color.border.checkbox.checked,
1054
+ bg: color.background.checkbox.checked
1055
+ }
1056
+ },
1057
+ _invalid: {
1058
+ borderColor: color.border.checkbox.error,
1059
+ bg: color.background.checkbox.default,
1060
+ _checked: {
1061
+ bg: color.background.checkbox.error
1062
+ },
1063
+ _hover: {
1064
+ borderColor: color.border.checkbox.error,
1065
+ bg: color.background.checkbox.default
1066
+ }
1067
+ },
1068
+ _focusVisible: {
1069
+ ring: "2px",
1070
+ ringColor: color.border.wcag,
1071
+ ringOffset: "1px"
1072
+ },
1073
+ _hover: {
1074
+ borderColor: color.border.checkbox["default-hover"],
1075
+ bg: color.background.checkbox.default
1076
+ },
1077
+ _disabled: {
1078
+ borderColor: color.border.checkbox.disabled,
1079
+ bg: color.background.checkbox.disabled,
1080
+ opacity: opacity.checkbox.disabled,
1081
+ _checked: {
1082
+ borderColor: color.border.checkbox.checked,
1083
+ bg: color.background.checkbox.checked,
1084
+ opacity: opacity.checkbox.disabled,
1085
+ color: "white",
1086
+ _hover: {
1087
+ borderColor: color.border.checkbox.checked,
1088
+ bg: color.background.checkbox.checked,
1089
+ opacity: opacity.checkbox.disabled
1090
+ }
1091
+ },
1092
+ _hover: {
1093
+ borderColor: color.border.checkbox.disabled,
1094
+ bg: color.background.checkbox.disabled,
1095
+ opacity: opacity.checkbox.disabled
1096
+ }
1097
+ }
1098
+ }
1099
+ }),
1100
+ variants: {
1101
+ default: ({ theme: { radii: borderRadius } }) => ({
1102
+ control: {
1103
+ borderRadius: borderRadius.checkbox.default
1104
+ }
1105
+ }),
1106
+ rounded: ({ theme: { radii: borderRadius } }) => ({
1107
+ control: {
1108
+ borderRadius: borderRadius.checkbox.full
1109
+ }
1110
+ })
1111
+ }
1112
+ };
1113
+
1114
+ const Input = {
1115
+ parts: ["field", "addon"],
1116
+ baseStyle: ({ theme: { colors: color } }) => ({
1117
+ field: {
1118
+ color: color.text.default,
1119
+ _placeholder: {
1120
+ color: color.text.input.placeholder,
1121
+ opacity: 1
1122
+ }
1123
+ }
1124
+ }),
1125
+ variants: {
1126
+ outline: ({ theme: {
1127
+ colors: color,
1128
+ space: spacing,
1129
+ radii: borderRadius,
1130
+ borders: borderWidth,
1131
+ opacity
1132
+ } }) => ({
1133
+ field: {
1134
+ paddingInlineStart: spacing["padding-inline"].input.default,
1135
+ paddingInlineEnd: spacing["padding-inline"].input.default,
1136
+ bgColor: color.background.input["outline-default"],
1137
+ borderRadius: borderRadius.input.outline,
1138
+ borderWidth: borderWidth.input.default,
1139
+ borderColor: color.border.input.default,
1140
+ _readOnly: {
1141
+ _focusVisible: {
1142
+ borderColor: color.border.input.readonly
1143
+ },
1144
+ _hover: {
1145
+ borderColor: color.border.input.readonly
1146
+ }
1147
+ },
1148
+ _focusVisible: {
1149
+ bgColor: color.background.input["outline-focus"],
1150
+ borderColor: color.border.input.focus,
1151
+ _invalid: {
1152
+ boxShadow: `0 0 0 1px ${color.border.input.error}`,
1153
+ bgColor: color.background.input["outline-error"],
1154
+ borderColor: color.border.input.error
1155
+ }
1156
+ },
1157
+ _hover: {
1158
+ bgColor: color.background.input["outline-hover"],
1159
+ borderColor: color.border.input["default-hover"]
1160
+ },
1161
+ _invalid: {
1162
+ bgColor: color.background.input["outline-error"],
1163
+ borderColor: color.border.input.error
1164
+ },
1165
+ _disabled: {
1166
+ bgColor: color.background.input["outline-disabled"],
1167
+ borderColor: color.border.input.disabled,
1168
+ opacity: opacity.input.disabled
1169
+ }
1170
+ },
1171
+ addon: {
1172
+ border: "none",
1173
+ background: "none",
1174
+ color: color.text.default
1175
+ }
1176
+ }),
1177
+ filled: ({ theme: {
1178
+ colors: color,
1179
+ space: spacing,
1180
+ radii: borderRadius,
1181
+ borders: borderWidth,
1182
+ opacity
1183
+ } }) => ({
1184
+ field: {
1185
+ paddingInlineStart: spacing["padding-inline"].input.default,
1186
+ paddingInlineEnd: spacing["padding-inline"].input.default,
1187
+ borderRadius: borderRadius.input.filled,
1188
+ borderWidth: borderWidth.input.default,
1189
+ bgColor: color.background.input["filled-default"],
1190
+ _readOnly: {
1191
+ _focusVisible: {
1192
+ borderColor: color.border.input.readonly
1193
+ },
1194
+ _hover: {
1195
+ bgColor: color.background.input["filled-default"]
1196
+ }
1197
+ },
1198
+ _hover: {
1199
+ bgColor: color.background.input["filled-hover"]
1200
+ },
1201
+ _focusVisible: {
1202
+ boxShadow: `0 0 0 1px ${color.border.input.focus}`,
1203
+ borderColor: color.border.input.focus,
1204
+ bgColor: color.background.input["filled-focus"],
1205
+ _readOnly: {
1206
+ bgColor: color.background.input["filled-default"]
1207
+ },
1208
+ _invalid: {
1209
+ boxShadow: `0 0 0 1px ${color.border.input.error}`,
1210
+ bgColor: color.background.input["outline-error"],
1211
+ borderColor: color.border.input.error
1212
+ }
1213
+ },
1214
+ _invalid: {
1215
+ boxShadow: `0 0 0 1px ${color.border.input.error}`,
1216
+ bgColor: color.background.input["filled-error"],
1217
+ borderColor: color.border.input.error
1218
+ },
1219
+ _disabled: {
1220
+ bgColor: color.background.input["filled-disabled"],
1221
+ borderColor: color.border.input.disabled,
1222
+ opacity: opacity.input.disabled
1223
+ }
1224
+ }
1225
+ }),
1226
+ flushed: ({ theme: {
1227
+ colors: color,
1228
+ space: spacing,
1229
+ radii: borderRadius,
1230
+ borders: borderWidth,
1231
+ opacity
1232
+ } }) => ({
1233
+ field: {
1234
+ paddingInlineStart: spacing["padding-inline"].input.flushed,
1235
+ paddingInlineEnd: spacing["padding-inline"].input.flushed,
1236
+ bgColor: color.background.input["flushed-default"],
1237
+ borderRadius: borderRadius.input.flushed,
1238
+ borderBottomWidth: borderWidth.input.default,
1239
+ borderBottomColor: color.border.input.default,
1240
+ _readOnly: {
1241
+ _focusVisible: {
1242
+ borderColor: color.border.input.readonly
1243
+ },
1244
+ _hover: {
1245
+ borderColor: color.border.input.readonly
1246
+ }
1247
+ },
1248
+ _hover: {
1249
+ bgColor: color.background.input["flushed-hover"],
1250
+ borderColor: color.border.input["default-hover"]
1251
+ },
1252
+ _focusVisible: {
1253
+ _hover: {
1254
+ boxShadow: `0 1px 0 0 ${color.border.input.focus}`,
1255
+ borderColor: color.border.input.focus
1256
+ },
1257
+ _invalid: {
1258
+ boxShadow: `0 1px 0 0 ${color.border.input.error}`,
1259
+ borderColor: color.border.input.error,
1260
+ bgColor: color.background.input["flushed-error"]
1261
+ }
1262
+ },
1263
+ _invalid: {
1264
+ _hover: {
1265
+ boxShadow: `0 1px 0 0 ${color.border.input.error}`,
1266
+ borderColor: color.border.input.error
1267
+ },
1268
+ bgColor: color.background.input["flushed-error"]
1269
+ },
1270
+ _disabled: {
1271
+ bgColor: color.background.input["flushed-disabled"],
1272
+ borderColor: color.border.input.disabled,
1273
+ opacity: opacity.input.disabled
1274
+ }
1275
+ }
1276
+ })
1277
+ }
1278
+ };
1279
+
1280
+ const PinInput = {
1281
+ variants: {
1282
+ outline: ({ theme: {
1283
+ radii: borderRadius,
1284
+ borders: borderWidth,
1285
+ colors: color,
1286
+ space: spacing,
1287
+ opacity
1288
+ } }) => ({
1289
+ borderColor: color.border.input.default,
1290
+ borderRadius: borderRadius.input.outline,
1291
+ borderWidth: borderWidth.input.default,
1292
+ bg: color.background.input["outline-default"],
1293
+ color: color.text.default,
1294
+ paddingInline: spacing["padding-inline"].input.default,
1295
+ _hover: {
1296
+ bg: color.background.input["outline-hover"],
1297
+ borderColor: color.border.input["default-hover"]
1298
+ },
1299
+ _focus: {
1300
+ borderColor: color.border.input.focus,
1301
+ bg: color.background.input["outline-focus"]
1302
+ },
1303
+ _invalid: {
1304
+ bg: color.background.input["outline-error"],
1305
+ borderColor: color.border.input.error,
1306
+ _placeholder: {
1307
+ color: "transparent"
1308
+ }
1309
+ },
1310
+ _disabled: {
1311
+ bg: color.background.input["outline-disabled"],
1312
+ borderColor: color.border.input.disabled,
1313
+ opacity: opacity.input.disabled,
1314
+ _hover: {
1315
+ bg: color.background.input["outline-disabled"],
1316
+ borderColor: color.border.input.disabled
1317
+ }
1318
+ },
1319
+ _placeholder: {
1320
+ color: color.text.input.placeholder
1321
+ },
1322
+ _readonly: {
1323
+ borderColor: color.border.input.readonly
1324
+ }
1325
+ })
1326
+ }
1327
+ };
1328
+
1329
+ const Select = {
1330
+ parts: ["field", "icon"],
1331
+ variants: {
1332
+ outline: ({ theme: {
1333
+ radii: borderRadius,
1334
+ borders: borderWidth,
1335
+ colors: color,
1336
+ space: spacing
1337
+ } }) => ({
1338
+ field: {
1339
+ paddingInlineStart: spacing["padding-inline"].select.default,
1340
+ paddingInlineEnd: spacing["padding-inline"].select.default,
1341
+ borderWidth: borderWidth.select,
1342
+ color: color.text.default,
1343
+ borderColor: color.border.select.default,
1344
+ borderRadius: borderRadius.select.default,
1345
+ _hover: {
1346
+ borderColor: color.border.select["default-hover"]
1347
+ },
1348
+ _focusVisible: {
1349
+ borderColor: color.border.select.focus,
1350
+ boxShadow: `0 0 0 1px ${color.border.select.focus}`
1351
+ },
1352
+ _invalid: {
1353
+ borderColor: color.border.select.error,
1354
+ boxShadow: "none"
1355
+ },
1356
+ _readOnly: {
1357
+ borderWidth: borderWidth.select,
1358
+ borderColor: color.border.select.readonly,
1359
+ _focusVisible: {
1360
+ borderColor: color.border.select.readonly
1361
+ }
1362
+ },
1363
+ _disabled: {
1364
+ borderColor: color.border.select.disabled,
1365
+ bg: color.background.select.disabled,
1366
+ _hover: {
1367
+ borderColor: color.border.select.disabled
1368
+ }
1369
+ },
1370
+ _placeholder: {
1371
+ color: color.text.select.placeholder
1372
+ }
1373
+ },
1374
+ icon: {
1375
+ color: color.icon.select.default
1376
+ }
1377
+ })
1378
+ }
1379
+ };
1380
+
1381
+ const Radio = {
1382
+ parts: ["control", "label", "container"],
1383
+ sizes: {
1384
+ sm: ({ theme: { borders: borderWidth } }) => ({
1385
+ control: {
1386
+ _checked: {
1387
+ borderWidth: borderWidth.radio["checked-sm"]
1388
+ }
1389
+ }
1390
+ }),
1391
+ md: ({ theme: { borders: borderWidth } }) => ({
1392
+ control: {
1393
+ _checked: {
1394
+ borderWidth: borderWidth.radio["checked-md"]
1395
+ }
1396
+ }
1397
+ }),
1398
+ lg: ({ theme: { borders: borderWidth } }) => ({
1399
+ control: {
1400
+ _checked: {
1401
+ borderWidth: borderWidth.radio["checked-lg"]
1402
+ }
1403
+ }
1404
+ })
1405
+ },
1406
+ baseStyle: ({ theme: { borders: borderWidth, colors: color } }) => ({
1407
+ control: {
1408
+ borderColor: color.border.radio.default,
1409
+ bg: color.background.radio.default,
1410
+ borderWidth: borderWidth.radio.default,
1411
+ _checked: {
1412
+ borderColor: color.border.radio.checked,
1413
+ bg: color.background.radio.checked,
1414
+ _hover: {
1415
+ borderColor: color.border.radio.checked,
1416
+ bg: color.background.radio.checked
1417
+ }
1418
+ },
1419
+ _hover: {
1420
+ borderColor: color.border.radio["default-hover"],
1421
+ bg: color.background.radio.default
1422
+ },
1423
+ _disabled: {
1424
+ borderColor: color.border.radio.disabled,
1425
+ bg: color.background.radio.disabled,
1426
+ _hover: {
1427
+ borderColor: color.border.radio.disabled,
1428
+ bg: color.background.radio.disabled
1429
+ }
1430
+ },
1431
+ _invalid: {
1432
+ borderColor: color.border.radio.error,
1433
+ bg: color.background.radio.error,
1434
+ borderWidth: borderWidth.radio.default,
1435
+ _hover: {
1436
+ borderColor: color.border.radio.error,
1437
+ bg: color.background.radio.error,
1438
+ borderWidth: borderWidth.radio.default
1439
+ }
1440
+ },
1441
+ _focusVisible: {
1442
+ ring: "2px",
1443
+ ringColor: color.border.wcag,
1444
+ ringOffset: "1px"
1445
+ }
1446
+ },
1447
+ defaultProps: {
1448
+ size: "md"
1449
+ }
1450
+ })
1451
+ };
1452
+
1453
+ const Tabs = {
1454
+ parts: ["tab"],
1455
+ variants: {
1456
+ "soft-rounded": ({ theme: { colors: color } }) => ({
1457
+ tab: {
1458
+ borderRadius: 999,
1459
+ color: color.text.subdued,
1460
+ _selected: {
1461
+ bg: color.background.tabs["soft-rounded-active"],
1462
+ color: color.text.tabs["soft-rounded-active"]
1463
+ },
1464
+ _focusVisible: {
1465
+ ring: "2px",
1466
+ ringColor: color.border.wcag,
1467
+ ringOffset: "1px"
1468
+ }
1469
+ }
1470
+ })
1471
+ }
1472
+ };
1473
+
1474
+ const Textarea = {
1475
+ variants: {
1476
+ outline: ({ theme: {
1477
+ space: spacing,
1478
+ colors: color,
1479
+ borders: borderWidth,
1480
+ radii: borderRadius
1481
+ } }) => ({
1482
+ paddingInlineStart: spacing["padding-inline"].textarea.default,
1483
+ paddingInlineEnd: spacing["padding-inline"].textarea.default,
1484
+ borderRadius: borderRadius.textarea.default,
1485
+ borderWidth: borderWidth.textarea.default,
1486
+ borderColor: color.border.textarea.default,
1487
+ color: color.text.default,
1488
+ bgColor: color.background.textarea.default,
1489
+ _hover: {
1490
+ borderColor: color.border.textarea["default-hover"],
1491
+ bgColor: color.background.textarea.hover
1492
+ },
1493
+ _focusVisible: {
1494
+ borderColor: color.border.textarea.focus,
1495
+ boxShadow: `0 0 0 1px ${color.border.textarea.focus}`,
1496
+ bgColor: color.background.textarea.active
1497
+ },
1498
+ _invalid: {
1499
+ boxShadow: "none",
1500
+ borderColor: color.border.textarea.error,
1501
+ bgColor: color.background.textarea.error
1502
+ },
1503
+ _readOnly: {
1504
+ _focusVisible: {
1505
+ borderColor: color.border.textarea.readonly,
1506
+ bgColor: color.background.textarea.default
1507
+ },
1508
+ _hover: {
1509
+ borderColor: color.border.textarea.readonly
1510
+ }
1511
+ },
1512
+ _disabled: {
1513
+ bgColor: color.background.textarea.disabled,
1514
+ _hover: {
1515
+ borderColor: color.border.textarea.default
1516
+ }
1517
+ },
1518
+ _placeholder: {
1519
+ color: color.text.textarea.placeholder
1520
+ }
1521
+ })
1522
+ }
1523
+ };
1524
+
1525
+ const Link = {
1526
+ baseStyle: ({ colorScheme }) => ({
1527
+ _focus: {
1528
+ ring: "2px",
1529
+ ringColor: `${colorScheme}.100`,
1530
+ ringOffset: "1px"
1531
+ }
1532
+ }),
1533
+ defaultProps: {
1534
+ colorScheme: "mediatoolBlue"
1535
+ }
1536
+ };
1537
+
1538
+ const Switch$1 = {
1539
+ baseStyle: ({ theme: { colors: color, opacity } }) => ({
1540
+ _disabled: {
1541
+ opacity: opacity.switch.disabled
1542
+ },
1543
+ track: {
1544
+ bgColor: color.background.switch.default,
1545
+ _checked: {
1546
+ bgColor: color.background.switch["default-checked"]
1547
+ },
1548
+ _focusVisible: {
1549
+ ring: "2px",
1550
+ ringColor: color.border.wcag,
1551
+ ringOffset: "1px"
1552
+ }
1553
+ },
1554
+ thumb: {
1555
+ bgColor: color.background.switch.thumb
1556
+ }
1557
+ })
1558
+ };
1559
+
1560
+ const Tag = {
1561
+ parts: ["container"],
1562
+ baseStyle: {
1563
+ container: {
1564
+ fontWeight: "semibold"
1565
+ }
1566
+ },
1567
+ sizes: {
1568
+ sm: {
1569
+ container: {
1570
+ borderRadius: "tag.default"
1571
+ }
1572
+ },
1573
+ md: {
1574
+ container: {
1575
+ borderRadius: "tag.default"
1576
+ }
1577
+ },
1578
+ lg: {
1579
+ container: {
1580
+ borderRadius: "tag.default"
1581
+ }
1582
+ }
1583
+ },
1584
+ variants: {
1585
+ solid: ({ bgColor, colorScheme }) => ({
1586
+ container: {
1587
+ bgColor: bgColor ?? colorScheme,
1588
+ color: getContrastColor(bgColor ?? useToken$1("colors", colorScheme))
1589
+ }
1590
+ }),
1591
+ subtle: () => ({
1592
+ container: {
1593
+ bgColor: useToken$1("colors", "background.tag.subtle"),
1594
+ color: "text.default"
1595
+ }
1596
+ })
1597
+ },
1598
+ defaultProps: {
1599
+ size: "md",
1600
+ colorScheme: "background.tag.default"
1601
+ }
1602
+ };
1603
+
1604
+ const Alert = {
1605
+ parts: ["container", "title", "description"],
1606
+ baseStyle: ({ theme: {
1607
+ radii: borderRadius,
1608
+ colors: color,
1609
+ space: coreSpacing
1610
+ } }) => ({
1611
+ container: {
1612
+ borderRadius: borderRadius.toast.default,
1613
+ color: color.text.default,
1614
+ paddingEnd: coreSpacing[8],
1615
+ width: "auto",
1616
+ display: "flex"
1617
+ }
1618
+ }),
1619
+ variants: {
1620
+ success: ({ theme: { colors: color } }) => ({
1621
+ container: {
1622
+ bgColor: color.background.toast.success
1623
+ }
1624
+ }),
1625
+ warning: ({ theme: { colors: color } }) => ({
1626
+ container: {
1627
+ bgColor: color.background.toast.warning
1628
+ }
1629
+ }),
1630
+ info: ({ theme: { colors: color } }) => ({
1631
+ container: {
1632
+ bgColor: color.background.toast.info
1633
+ }
1634
+ }),
1635
+ error: ({ theme: { colors: color } }) => ({
1636
+ container: {
1637
+ bgColor: color.background.toast.error,
1638
+ color: color.text.toast.error
1639
+ }
1640
+ })
1641
+ }
1642
+ };
1643
+
1644
+ const NumberInput = {
1645
+ parts: ["root", "field", "stepper", "stepperGroup"],
1646
+ sizes: {
1647
+ sm: ({ theme: { radii: borderRadius, sizes: sizing } }) => ({
1648
+ field: {
1649
+ borderRadius: borderRadius.input.outline
1650
+ },
1651
+ stepperGroup: {
1652
+ height: sizing["8"]
1653
+ }
1654
+ }),
1655
+ md: ({ theme: { sizes: sizing } }) => ({
1656
+ stepperGroup: {
1657
+ height: sizing["10"]
1658
+ }
1659
+ }),
1660
+ lg: ({ theme: { sizes: sizing } }) => ({
1661
+ stepperGroup: {
1662
+ height: sizing["12"]
1663
+ }
1664
+ })
1665
+ },
1666
+ baseStyle: ({ theme: {
1667
+ sizes: sizing,
1668
+ space: spacing,
1669
+ colors: color,
1670
+ radii: borderRadius,
1671
+ borders: borderWidth,
1672
+ opacity
1673
+ }, isReadOnly }) => ({
1674
+ root: {
1675
+ borderRadius: borderRadius.input.outline
1676
+ },
1677
+ field: {
1678
+ minWidth: sizing["44"],
1679
+ paddingInlineStart: spacing["padding-inline"].input.default,
1680
+ paddingInlineEnd: spacing["padding-inline"].input.default,
1681
+ WebkitPaddingStart: spacing["padding-inline"].input.default,
1682
+ WebkitPaddingEnd: spacing["padding-inline"].input.default,
1683
+ color: color.text.default,
1684
+ bg: color.background.input["outline-default"],
1685
+ borderWidth: borderWidth.input.default,
1686
+ borderColor: color.border.input.default,
1687
+ paddingRight: spacing.paddingRight["number-input"].field,
1688
+ _hover: {
1689
+ bg: color.background.input["outline-hover"],
1690
+ borderColor: color.border.input["default-hover"]
1691
+ },
1692
+ _focusVisible: {
1693
+ bg: color.background.input["outline-focus"],
1694
+ borderColor: color.border.input.focus,
1695
+ boxShadow: `0 0 0 1px ${color.border.textarea.focus}`
1696
+ },
1697
+ _invalid: {
1698
+ bg: color.background.input["outline-error"],
1699
+ borderColor: color.border.input.error,
1700
+ boxShadow: `0 0 0 1px ${color.border.input.error}`
1701
+ },
1702
+ _disabled: {
1703
+ bg: color.background.input["outline-disabled"],
1704
+ opacity: opacity.input.disabled,
1705
+ borderColor: color.border.input.disabled
1706
+ },
1707
+ _readOnly: {
1708
+ _focusVisible: {
1709
+ borderColor: color.border.input.readonly,
1710
+ boxShadow: "none"
1711
+ },
1712
+ _hover: {
1713
+ borderColor: color.border.input.readonly
1714
+ }
1715
+ }
1716
+ },
1717
+ stepperGroup: {
1718
+ width: "auto",
1719
+ paddingRight: spacing.paddingRight["number-input"].stepper
1720
+ },
1721
+ stepper: {
1722
+ _first: {
1723
+ border: "none",
1724
+ borderTopRightRadius: borderRadius["input-stepper"].default,
1725
+ borderRadius: borderRadius["input-stepper"].default,
1726
+ bg: color.background["input-stepper"].default,
1727
+ opacity: isReadOnly ? opacity.input.disabled : "auto",
1728
+ _hover: {
1729
+ bg: isReadOnly ? "none" : color.background["input-stepper"].hover
1730
+ },
1731
+ _active: {
1732
+ bg: color.background["input-stepper"].active
1733
+ },
1734
+ _disabled: {
1735
+ bg: color.background["input-stepper"].disabled,
1736
+ color: color.icon["input-stepper"].disabled
1737
+ }
1738
+ },
1739
+ _last: {
1740
+ border: "none",
1741
+ bg: color.background["input-stepper"].default,
1742
+ borderBottomRightRadius: borderRadius["input-stepper"].default,
1743
+ borderRadius: borderRadius["input-stepper"].default,
1744
+ opacity: isReadOnly ? opacity.input.disabled : "auto",
1745
+ _hover: {
1746
+ bg: isReadOnly ? "none" : color.background["input-stepper"].hover
1747
+ },
1748
+ _active: {
1749
+ bg: color.background["input-stepper"].active
1750
+ },
1751
+ _disabled: {
1752
+ bg: color.background["input-stepper"].disabled,
1753
+ color: color.icon["input-stepper"].disabled
1754
+ }
1755
+ }
1756
+ }
1757
+ })
1758
+ };
1759
+
1760
+ const NotificationIconButton = {
1761
+ parts: ["container", "notifier"],
1762
+ sizes: {
1763
+ xs: {
1764
+ notifier: {
1765
+ top: "0.5",
1766
+ right: "0.5"
1767
+ }
1768
+ },
1769
+ sm: {
1770
+ notifier: {
1771
+ top: "0.5",
1772
+ right: "0.5"
1773
+ }
1774
+ },
1775
+ md: {
1776
+ notifier: {
1777
+ top: "1",
1778
+ right: "1"
1779
+ }
1780
+ },
1781
+ lg: {
1782
+ notifier: {
1783
+ top: "2",
1784
+ right: "2"
1785
+ }
1786
+ }
1787
+ },
1788
+ variants: {
1789
+ link: {
1790
+ notifier: {
1791
+ position: "absolute",
1792
+ top: "0",
1793
+ right: "0",
1794
+ zIndex: "base"
1795
+ }
1796
+ }
1797
+ },
1798
+ baseStyle: () => ({
1799
+ container: {
1800
+ position: "relative"
1801
+ },
1802
+ notifier: {
1803
+ position: "absolute",
1804
+ top: "1",
1805
+ right: "1",
1806
+ zIndex: "base"
1807
+ }
1808
+ })
1809
+ };
1810
+
1811
+ const Calendar = {
1812
+ parts: ["container", "dateSelect", "dayLabel", "rangeCalendarContainer"],
1813
+ baseStyle: ({ theme: {
1814
+ space: spacing,
1815
+ sizes: sizing,
1816
+ colors: color
1817
+ } }) => ({
1818
+ container: {
1819
+ p: spacing[2],
1820
+ w: sizing[64],
1821
+ bgColor: "background.default",
1822
+ border: "1px solid",
1823
+ borderColor: "border.input.default",
1824
+ borderRadius: "input.outline"
1825
+ },
1826
+ rangeCalendarContainer: {
1827
+ p: "3",
1828
+ w: "128",
1829
+ bgColor: "background.default",
1830
+ borderRadius: "input.outline"
1831
+ },
1832
+ dateSelect: {
1833
+ fontWeight: "semibold",
1834
+ border: "none",
1835
+ padding: "0",
1836
+ borderRadius: "md",
1837
+ color: color.text.default,
1838
+ bgColor: color.background.button.ghost,
1839
+ _hover: {
1840
+ cursor: "pointer",
1841
+ bgColor: color.background.button["ghost-hover"]
1842
+ },
1843
+ _active: {
1844
+ bgColor: color.background.button["ghost-active"]
1845
+ },
1846
+ ...ring
1847
+ },
1848
+ dayLabel: {
1849
+ color: color.gray[600],
1850
+ fontSize: "xs",
1851
+ p: spacing[2]
1852
+ }
1853
+ })
1854
+ };
1855
+
1856
+ const DragAndDrop = {
1857
+ parts: ["dropZone"],
1858
+ baseStyle: ({ theme: { colors: palette, space: spacing, sizes: sizing }, sx }) => ({
1859
+ dropZone: merge({
1860
+ border: `2px dashed ${palette.mono.black}`,
1861
+ padding: spacing["4"],
1862
+ display: "flex",
1863
+ flexDirection: "column",
1864
+ alignItems: "center",
1865
+ gap: spacing["4"],
1866
+ justifyContent: "center",
1867
+ textAlign: "center",
1868
+ minH: sizing["56"],
1869
+ minW: sizing["56"],
1870
+ bgColor: palette.blue["50"],
1871
+ _hover: {
1872
+ bgColor: palette.blue["100"]
1873
+ }
1874
+ }, sx)
1875
+ })
1876
+ };
1877
+
1878
+ const DatePicker = {
1879
+ parts: ["group", "styledField", "dateField", "dateSegment"],
1880
+ baseStyle: ({ theme: {
1881
+ colors: color,
1882
+ borders: borderWidth,
1883
+ radii: borderRadius,
1884
+ opacity
1885
+ } }) => ({
1886
+ group: {
1887
+ position: "relative",
1888
+ alignItems: "center",
1889
+ flex: 1
1890
+ },
1891
+ styledField: {
1892
+ bgColor: "text.inverted",
1893
+ borderWidth: borderWidth.input.default,
1894
+ borderColor: color.border.input.default,
1895
+ borderRadius: borderRadius.input.outline,
1896
+ _hover: {
1897
+ borderColor: color.border.input["default-hover"]
1898
+ },
1899
+ _focusWithin: {
1900
+ bgColor: color.background.input["outline-focus"],
1901
+ borderColor: color.border.textarea.focus,
1902
+ boxShadow: `0 0 0 1px ${color.border.textarea.focus}`
1903
+ },
1904
+ _invalid: {
1905
+ boxShadow: `0 0 0 1px ${color.border.input.error}`,
1906
+ borderColor: color.border.input.error
1907
+ },
1908
+ _disabled: {
1909
+ bgColor: color.background.input["outline-disabled"],
1910
+ borderColor: color.border.input.disabled,
1911
+ opacity: opacity.input.disabled
1912
+ }
1913
+ },
1914
+ dateField: {
1915
+ width: "100%",
1916
+ height: "100%",
1917
+ alignItems: "center",
1918
+ paddingInlineStart: "0.375rem"
1919
+ },
1920
+ dateSegment: {
1921
+ caretColor: "transparent",
1922
+ boxSizing: "content-box",
1923
+ textAlign: "center",
1924
+ outline: "none",
1925
+ rounded: "md",
1926
+ _focus: {
1927
+ bgColor: "blue.500",
1928
+ color: color.text.inverted
1929
+ },
1930
+ _placeholder: {
1931
+ color: "red.500"
1932
+ }
1933
+ }
1934
+ })
1935
+ };
1936
+
1937
+ const FlipButton = {
1938
+ parts: ["container", "button", "buttonIcon"],
1939
+ sizes: {
1940
+ xs: ({ theme: { sizes: sizing, space: spacing } }) => ({
1941
+ button: {
1942
+ height: sizing["flip-button"].xs,
1943
+ minWidth: sizing["flip-button"].xs,
1944
+ paddingInlineStart: spacing["padding-inline"]["flip-button"].xs,
1945
+ paddingInlineEnd: spacing["padding-inline"]["flip-button"].xs,
1946
+ fontSize: "xs"
1947
+ },
1948
+ buttonIcon: {
1949
+ boxSize: sizing.icon.xs
1950
+ }
1951
+ }),
1952
+ sm: ({ theme: { sizes: sizing, space: spacing } }) => ({
1953
+ button: {
1954
+ height: sizing["flip-button"].sm,
1955
+ minWidth: sizing["flip-button"].sm,
1956
+ paddingInlineStart: spacing["padding-inline"]["flip-button"].md,
1957
+ paddingInlineEnd: spacing["padding-inline"]["flip-button"].md,
1958
+ fontSize: "sm",
1959
+ buttonIcon: {
1960
+ boxSize: sizing.icon.sm
1961
+ }
1962
+ }
1963
+ }),
1964
+ md: ({ theme: { sizes: sizing, space: spacing } }) => ({
1965
+ button: {
1966
+ height: sizing["flip-button"].md,
1967
+ minWidth: sizing["flip-button"].md,
1968
+ paddingInlineStart: spacing["padding-inline"]["flip-button"].md,
1969
+ paddingInlineEnd: spacing["padding-inline"]["flip-button"].md,
1970
+ fontSize: "md",
1971
+ buttonIcon: {
1972
+ boxSize: sizing.icon.md
1973
+ }
1974
+ }
1975
+ }),
1976
+ lg: ({ theme: { sizes: sizing, space: spacing } }) => ({
1977
+ button: {
1978
+ height: sizing["flip-button"].lg,
1979
+ minWidth: sizing["flip-button"].lg,
1980
+ paddingInlineStart: spacing["padding-inline"]["flip-button"].lg,
1981
+ paddingInlineEnd: spacing["padding-inline"]["flip-button"].lg,
1982
+ fontSize: "lg",
1983
+ buttonIcon: {
1984
+ boxSize: sizing.icon.lg
1985
+ }
1986
+ }
1987
+ })
1988
+ },
1989
+ baseStyle: ({ theme: {
1990
+ space: spacing,
1991
+ sizes: sizing,
1992
+ colors: color,
1993
+ opacity,
1994
+ radii: borderRadius,
1995
+ fontWeights: coreFontWeight
1996
+ }, numberOfButtons }) => ({
1997
+ container: {
1998
+ borderRadius: borderRadius["flip-button"].default,
1999
+ paddingInlineStart: spacing["padding-inline"]["flip-button-group"].default,
2000
+ paddingInlineEnd: spacing["padding-inline"]["flip-button-group"].default,
2001
+ paddingY: spacing.paddingY["flip-button-group"].default,
2002
+ disply: "grid",
2003
+ width: "100%",
2004
+ gap: spacing["padding-inline"]["flip-button"].gap,
2005
+ gridTemplateColumns: `repeat(${numberOfButtons}, minmax(${sizing[32]}, 1fr))`,
2006
+ gridTemplateRows: "1fr",
2007
+ overflowX: "auto"
2008
+ },
2009
+ button: {
2010
+ width: "100%",
2011
+ justifyContent: "center",
2012
+ alignItems: "center",
2013
+ color: color.text["flip-button"].default,
2014
+ cursor: "pointer",
2015
+ borderRadius: borderRadius["flip-button"].default,
2016
+ fontWeight: coreFontWeight.semiBold,
2017
+ _disabled: {
2018
+ opacity: opacity["flip-button"].disabled
2019
+ },
2020
+ _checked: {
2021
+ color: color.text["flip-button"].inverted
2022
+ }
2023
+ }
2024
+ }),
2025
+ variants: {
2026
+ default: ({ theme: { colors: color }, sx }) => ({
2027
+ container: merge({
2028
+ bgColor: color.background["flip-button"]["default-deselected-blue"]
2029
+ }, sx),
2030
+ button: {
2031
+ bgColor: color.background["flip-button"]["default-deselected-blue"],
2032
+ _hover: {
2033
+ bgColor: color.background["flip-button"]["hover-deselected-blue"]
2034
+ },
2035
+ _checked: {
2036
+ bgColor: color.background["flip-button"]["default-selected-blue"],
2037
+ _hover: {
2038
+ bgColor: color.background["flip-button"]["default-selected-blue"]
2039
+ }
2040
+ }
2041
+ }
2042
+ }),
2043
+ brand: ({ theme: { colors: color }, sx }) => ({
2044
+ container: merge({
2045
+ bgColor: color.background["flip-button"]["default-deselected-brand"]
2046
+ }, sx),
2047
+ button: {
2048
+ bgColor: color.background["flip-button"]["default-deselected-brand"],
2049
+ _hover: {
2050
+ bgColor: color.background["flip-button"]["hover-deselected-brand"]
2051
+ },
2052
+ _checked: {
2053
+ bgColor: color.background["flip-button"]["default-selected-brand"],
2054
+ _hover: {
2055
+ bgColor: color.background["flip-button"]["default-selected-brand"]
2056
+ }
2057
+ }
2058
+ }
2059
+ })
2060
+ },
2061
+ defaultProps: {
2062
+ size: "md",
2063
+ variant: "default"
2064
+ }
2065
+ };
2066
+
2067
+ const Spinner = {
2068
+ baseStyle: ({ theme: { colors: color, borders: borderWidth } }) => ({
2069
+ borderWidth: borderWidth.spinner.default,
2070
+ color: color.background.spinner.thumb,
2071
+ borderBottomColor: color.background.spinner.track,
2072
+ borderLeftColor: color.background.spinner.track
2073
+ })
2074
+ };
2075
+
2076
+ const Avatar = {
2077
+ parts: ["container", "text", "badge", "icon"],
2078
+ sizes: {
2079
+ "2xs": ({ theme: { sizes: sizing } }) => ({
2080
+ container: {
2081
+ width: sizing.avatar["2xs"],
2082
+ height: sizing.avatar["2xs"]
2083
+ },
2084
+ text: {
2085
+ lineHeight: sizing.avatar["2xs"]
2086
+ }
2087
+ }),
2088
+ xs: ({ theme: { sizes: sizing } }) => ({
2089
+ container: {
2090
+ width: sizing.avatar.xs,
2091
+ height: sizing.avatar.xs
2092
+ },
2093
+ text: {
2094
+ lineHeight: sizing.avatar.xs
2095
+ }
2096
+ }),
2097
+ sm: ({ theme: { sizes: sizing } }) => ({
2098
+ container: {
2099
+ width: sizing.avatar.sm,
2100
+ height: sizing.avatar.sm
2101
+ },
2102
+ text: {
2103
+ lineHeight: sizing.avatar.sm
2104
+ },
2105
+ icon: {
2106
+ boxSize: sizing.avatar.sm
2107
+ }
2108
+ }),
2109
+ md: ({ theme: { sizes: sizing } }) => ({
2110
+ container: {
2111
+ width: sizing.avatar.md,
2112
+ height: sizing.avatar.md
2113
+ },
2114
+ text: {
2115
+ lineHeight: sizing.avatar.md
2116
+ },
2117
+ icon: {
2118
+ boxSize: sizing.avatar.md
2119
+ }
2120
+ }),
2121
+ lg: ({ theme: { sizes: sizing } }) => ({
2122
+ container: {
2123
+ width: sizing.avatar.lg,
2124
+ height: sizing.avatar.lg
2125
+ },
2126
+ text: {
2127
+ lineHeight: sizing.avatar.lg
2128
+ },
2129
+ icon: {
2130
+ boxSize: sizing.avatar.lg
2131
+ }
2132
+ }),
2133
+ xl: ({ theme: { sizes: sizing } }) => ({
2134
+ container: {
2135
+ width: sizing.avatar.xl,
2136
+ height: sizing.avatar.xl
2137
+ },
2138
+ text: {
2139
+ lineHeight: sizing.avatar.xl
2140
+ }
2141
+ }),
2142
+ "2xl": ({ theme: { sizes: sizing } }) => ({
2143
+ container: {
2144
+ width: sizing.avatar["2xl"],
2145
+ height: sizing.avatar["2xl"]
2146
+ },
2147
+ text: {
2148
+ lineHeight: sizing.avatar["2xl"]
2149
+ }
2150
+ })
2151
+ },
2152
+ baseStyle: ({ theme: {
2153
+ colors: color,
2154
+ sizes: sizing,
2155
+ radii: borderRadius
2156
+ }, image }) => ({
2157
+ container: {
2158
+ bgColor: image ? color.background.avatar.image : color.background.avatar.default,
2159
+ color: color.text.inverted,
2160
+ display: "grid",
2161
+ placeItems: "center",
2162
+ objectFit: "cover",
2163
+ position: "relative"
2164
+ },
2165
+ userImage: {
2166
+ width: "100%",
2167
+ height: "100%",
2168
+ objectFit: "cover"
2169
+ },
2170
+ badge: {
2171
+ position: "absolute",
2172
+ bottom: `-${sizing["1"]}`,
2173
+ right: `-${sizing["1"]}`,
2174
+ minWidth: sizing["5"],
2175
+ height: sizing["5"],
2176
+ display: "flex",
2177
+ justifyContent: "center",
2178
+ alignItems: "center",
2179
+ fontSize: "xs",
2180
+ fontWeight: "semibold",
2181
+ padding: sizing["0a"],
2182
+ bgColor: color.red["500"],
2183
+ color: color.text.inverted,
2184
+ borderRadius: borderRadius.avatar.square,
2185
+ border: "none"
2186
+ }
2187
+ }),
2188
+ variants: {
2189
+ square: ({ theme: { radii: borderRadius } }) => ({
2190
+ container: {
2191
+ aspectRatio: "1 / 1",
2192
+ borderRadius: borderRadius.avatar.square,
2193
+ "> img": {
2194
+ borderRadius: borderRadius.avatar.square,
2195
+ aspectRatio: "1 / 1"
2196
+ }
2197
+ },
2198
+ badge: {
2199
+ borderRadius: borderRadius.avatar.square
2200
+ }
2201
+ }),
2202
+ rounded: ({ theme: { radii: borderRadius } }) => ({
2203
+ container: {
2204
+ aspectRatio: "1 / 1",
2205
+ borderRadius: borderRadius.avatar.rounded,
2206
+ "> img": {
2207
+ borderRadius: borderRadius.avatar.rounded,
2208
+ aspectRatio: "1 / 1"
2209
+ }
2210
+ },
2211
+ badge: {
2212
+ borderRadius: borderRadius.avatar.rounded
2213
+ }
2214
+ })
2215
+ }
2216
+ };
2217
+
2218
+ const CloseButton = {
2219
+ baseStyle: ({ theme: { colors: color } }) => ({
2220
+ color: color.text.default,
2221
+ bgColor: color.background.button.ghost,
2222
+ _hover: {
2223
+ bg: color.background.button["ghost-hover"],
2224
+ _disabled: {
2225
+ bgColor: color.background.button.ghost
2226
+ }
2227
+ },
2228
+ _active: {
2229
+ bgColor: color.background.button["ghost-active"]
2230
+ },
2231
+ _focusVisible: {
2232
+ ring: "2px",
2233
+ ringColor: color.border.wcag,
2234
+ ringOffset: "1px"
2235
+ }
2236
+ }),
2237
+ defaultProps: {
2238
+ size: "md"
2239
+ }
2240
+ };
2241
+
2242
+ const Modal = {
2243
+ parts: ["overlay", "closeButton", "dialog"],
2244
+ sizes: {
2245
+ huge: {
2246
+ dialog: {
2247
+ width: "90%",
2248
+ maxW: "96rem",
2249
+ aspectRatio: "16/9"
2250
+ }
2251
+ }
2252
+ },
2253
+ baseStyle: ({ theme }) => {
2254
+ const {
2255
+ typography: { headings: { h3 } }
2256
+ } = theme;
2257
+ return {
2258
+ overlay: {
2259
+ bgColor: "background.modal.overlay",
2260
+ backdropFilter: "blur(8px)"
2261
+ },
2262
+ closeButton: {
2263
+ top: 4,
2264
+ right: 4
2265
+ },
2266
+ dialog: {
2267
+ bgColor: "background.default",
2268
+ borderRadius: "modal.dialog"
2269
+ },
2270
+ header: {
2271
+ fontSize: h3.fontSize,
2272
+ paddingTop: "paddingTop.modal.header",
2273
+ paddingBottom: "paddingBottom.modal.header",
2274
+ border: "modal.header",
2275
+ borderBottomColor: "border.modal.header",
2276
+ borderBottomStyle: "solid"
2277
+ },
2278
+ body: {
2279
+ paddingTop: "paddingTop.modal.body",
2280
+ paddingBottom: "paddingBottom.modal.body"
2281
+ },
2282
+ footer: {
2283
+ paddingTop: "paddingTop.modal.footer",
2284
+ paddingBottom: "paddingBottom.modal.footer"
2285
+ }
2286
+ };
2287
+ }
2288
+ };
2289
+
2290
+ const Tooltip = {
2291
+ baseStyle: ({ theme: { colors: color, space: spacing, radii: borderRadius } }) => ({
2292
+ backgroundColor: color.background.tooltip.default,
2293
+ color: color.text.inverted,
2294
+ paddingInline: spacing["padding-inline"].tooltip.default,
2295
+ paddingY: spacing.paddingY.tooltip.default,
2296
+ borderRadius: borderRadius.tooltip.default
2297
+ })
2298
+ };
2299
+
2300
+ const Icon = {
2301
+ sizes: {
2302
+ xs: {
2303
+ boxSize: "icon.xs"
2304
+ },
2305
+ sm: {
2306
+ boxSize: "icon.sm"
2307
+ },
2308
+ md: {
2309
+ boxSize: "icon.md"
2310
+ },
2311
+ lg: {
2312
+ boxSize: "icon.lg"
2313
+ }
2314
+ },
2315
+ baseStyle: ({ boxSize, color }) => ({
2316
+ boxSize: boxSize || "icon.default",
2317
+ color: color || "inherit"
2318
+ })
2319
+ };
2320
+
2321
+ const ClipboardInput = {
2322
+ parts: ["button", "icon", "tooltip"],
2323
+ sizes: {
2324
+ sm: ({ theme: { sizes: sizing, space: spacing } }) => ({
2325
+ button: {
2326
+ height: sizing.button.xs,
2327
+ minWidth: sizing.button.xs
2328
+ },
2329
+ icon: {
2330
+ boxSize: sizing.icon.xs
2331
+ },
2332
+ tooltip: {
2333
+ paddingInline: spacing["padding-inline"].tooltip.sm,
2334
+ paddingY: spacing.paddingY.tooltip.sm
2335
+ }
2336
+ }),
2337
+ md: ({ theme: { sizes: sizing } }) => ({
2338
+ button: {
2339
+ height: sizing.button.sm,
2340
+ minWidth: sizing.button.sm
2341
+ },
2342
+ icon: {
2343
+ boxSize: sizing.icon.sm
2344
+ }
2345
+ }),
2346
+ lg: ({ theme: { sizes: sizing } }) => ({
2347
+ button: {
2348
+ height: sizing.button.md,
2349
+ minWidth: sizing.button.md
2350
+ },
2351
+ icon: {
2352
+ boxSize: sizing.icon.md
2353
+ }
2354
+ })
2355
+ }
2356
+ };
2357
+
2358
+ const ColorPicker = {
2359
+ parts: ["colorButton", "trigger", "heading"],
2360
+ baseStyle: ({ theme, selectedColor }) => {
2361
+ const { sizes: sizing, colors: color } = theme;
2362
+ return {
2363
+ heading: {
2364
+ border: "none",
2365
+ paddingInlineStart: sizing["4"],
2366
+ paddingInlineEnd: sizing["2"],
2367
+ paddingBottom: sizing["0"],
2368
+ fontSize: "md",
2369
+ fontWeight: "semibold"
2370
+ },
2371
+ trigger: {
2372
+ bgColor: selectedColor ?? color.background.button.default,
2373
+ color: selectedColor ? getContrastColor(selectedColor) : "unset",
2374
+ _hover: {
2375
+ bgColor: selectedColor ?? color.background.button["default-hover"]
2376
+ },
2377
+ _active: {
2378
+ bgColor: selectedColor ?? color.background.button["default-active"]
2379
+ }
2380
+ },
2381
+ colorButton: {
2382
+ height: sizing.button.sm,
2383
+ minWidth: sizing.button.sm,
2384
+ _hover: {
2385
+ ring: "2px",
2386
+ ringOffset: "1px",
2387
+ ringColor: `${color.border.input["default-hover"]}`
2388
+ }
2389
+ }
2390
+ };
2391
+ },
2392
+ sizes: {
2393
+ sm: ({ theme: { sizes: sizing } }) => ({
2394
+ trigger: {
2395
+ height: sizing.button.sm,
2396
+ minWidth: sizing.button.sm
2397
+ }
2398
+ }),
2399
+ md: ({ theme: { sizes: sizing } }) => ({
2400
+ trigger: {
2401
+ height: sizing.button.md,
2402
+ minWidth: sizing.button.md
2403
+ }
2404
+ }),
2405
+ lg: ({ theme: { sizes: sizing } }) => ({
2406
+ trigger: {
2407
+ height: sizing.button.lg,
2408
+ minWidth: sizing.button.lg
2409
+ }
2410
+ })
2411
+ }
2412
+ };
2413
+
2414
+ const Step = {
2415
+ parts: ["step", "label", "description"],
2416
+ baseStyle: ({ theme: {
2417
+ colors: color,
2418
+ fontWeights,
2419
+ space: spacing,
2420
+ borders: borderWidth
2421
+ } }) => ({
2422
+ step: {
2423
+ justifyContent: "start",
2424
+ alignItems: "start",
2425
+ bgColor: color.background.step.default,
2426
+ borderTopWidth: borderWidth.step.default,
2427
+ borderColor: color.border.step.default,
2428
+ borderBottom: "none",
2429
+ paddingInline: spacing["padding-inline"].step.default,
2430
+ color: color.text.subdued,
2431
+ _hover: {
2432
+ bgColor: color.background.step.hover,
2433
+ borderColor: color.border.step.hover
2434
+ },
2435
+ _active: {
2436
+ bgColor: color.background.step.active
2437
+ },
2438
+ _selected: {
2439
+ bgColor: color.background.step.selected,
2440
+ borderColor: color.border.step.selected,
2441
+ color: color.border.step.selected,
2442
+ _hover: {
2443
+ borderColor: color.border.step.selected,
2444
+ color: color.border.step.selected
2445
+ }
2446
+ }
2447
+ },
2448
+ label: {
2449
+ color: "inherit",
2450
+ pt: spacing.paddingTop.step.label,
2451
+ textAlign: "start",
2452
+ fontWeight: fontWeights.bold
2453
+ },
2454
+ description: {
2455
+ textAlign: "start",
2456
+ fontWeight: fontWeights.semiBold,
2457
+ color: color.text.default
2458
+ }
2459
+ })
2460
+ };
2461
+
2462
+ const StepList = {
2463
+ baseStyle: ({ theme: { sizes: sizing }, tabs }) => ({
2464
+ display: "grid",
2465
+ width: "100%",
2466
+ gridTemplateColumns: `repeat(${tabs}, minmax(${sizing[32]}, 1fr))`,
2467
+ gridTemplateRows: "1fr",
2468
+ overflowX: "auto",
2469
+ borderBottom: "none",
2470
+ paddingBottom: sizing[2]
2471
+ })
2472
+ };
2473
+
2474
+ const H1 = {
2475
+ baseStyle: ({ theme, sx }) => {
2476
+ const {
2477
+ colors: color,
2478
+ typography: { headings: { h1 } }
2479
+ } = theme;
2480
+ return merge({
2481
+ color: color.text.default,
2482
+ fontFamily: h1.fontFamily,
2483
+ fontWeight: h1.fontWeight,
2484
+ lineHeight: h1.lineHeight,
2485
+ fontSize: h1.fontSize,
2486
+ letterSpacing: h1.letterSpacing,
2487
+ textTransform: h1.textCase
2488
+ }, sx);
2489
+ }
2490
+ };
2491
+
2492
+ const H2 = {
2493
+ baseStyle: ({ theme, sx }) => {
2494
+ const {
2495
+ colors: color,
2496
+ typography: { headings: { h2 } }
2497
+ } = theme;
2498
+ return merge({
2499
+ color: color.text.default,
2500
+ fontFamily: h2.fontFamily,
2501
+ fontWeight: h2.fontWeight,
2502
+ lineHeight: h2.lineHeight,
2503
+ fontSize: h2.fontSize,
2504
+ letterSpacing: h2.letterSpacing,
2505
+ textTransform: h2.textCase
2506
+ }, sx);
2507
+ }
2508
+ };
2509
+
2510
+ const H3 = {
2511
+ baseStyle: ({ theme, sx }) => {
2512
+ const {
2513
+ colors: color,
2514
+ typography: { headings: { h3 } }
2515
+ } = theme;
2516
+ return merge({
2517
+ color: color.text.default,
2518
+ fontFamily: h3.fontFamily,
2519
+ fontWeight: h3.fontWeight,
2520
+ lineHeight: h3.lineHeight,
2521
+ fontSize: h3.fontSize,
2522
+ letterSpacing: h3.letterSpacing,
2523
+ textTransform: h3.textCase
2524
+ }, sx);
2525
+ }
2526
+ };
2527
+
2528
+ const H4 = {
2529
+ baseStyle: ({ theme, sx }) => {
2530
+ const {
2531
+ colors: color,
2532
+ typography: { headings: { h4 } }
2533
+ } = theme;
2534
+ return merge({
2535
+ color: color.text.default,
2536
+ fontFamily: h4.fontFamily,
2537
+ fontWeight: h4.fontWeight,
2538
+ lineHeight: h4.lineHeight,
2539
+ fontSize: h4.fontSize,
2540
+ letterSpacing: h4.letterSpacing,
2541
+ textTransform: h4.textCase
2542
+ }, sx);
2543
+ }
2544
+ };
2545
+
2546
+ const H5 = {
2547
+ baseStyle: ({ theme, sx }) => {
2548
+ const {
2549
+ colors: color,
2550
+ typography: { headings: { h5 } }
2551
+ } = theme;
2552
+ return merge({
2553
+ color: color.text.default,
2554
+ fontFamily: h5.fontFamily,
2555
+ fontWeight: h5.fontWeight,
2556
+ lineHeight: h5.lineHeight,
2557
+ fontSize: h5.fontSize,
2558
+ letterSpacing: h5.letterSpacing,
2559
+ textTransform: h5.textCase
2560
+ }, sx);
2561
+ }
2562
+ };
2563
+
2564
+ const H6 = {
2565
+ baseStyle: ({ theme, sx }) => {
2566
+ const {
2567
+ colors: color,
2568
+ typography: { headings: { h6 } }
2569
+ } = theme;
2570
+ return merge({
2571
+ color: color.text.default,
2572
+ fontFamily: h6.fontFamily,
2573
+ fontWeight: h6.fontWeight,
2574
+ lineHeight: h6.lineHeight,
2575
+ fontSize: h6.fontSize,
2576
+ letterSpacing: h6.letterSpacing,
2577
+ textTransform: h6.textCase
2578
+ }, sx);
2579
+ }
2580
+ };
2581
+
2582
+ const Blockquote = {
2583
+ baseStyle: ({ theme, sx }) => {
2584
+ const { blockquote } = theme.typography.stylized;
2585
+ return merge({
2586
+ color: "text.default",
2587
+ fontFamily: blockquote.fontFamily,
2588
+ fontWeight: blockquote.fontWeight,
2589
+ lineHeight: blockquote.lineHeight,
2590
+ fontSize: blockquote.fontSize,
2591
+ letterSpacing: blockquote.letterSpacing,
2592
+ textTransform: blockquote.textCase
2593
+ }, sx);
2594
+ }
2595
+ };
2596
+
2597
+ const Tiny = {
2598
+ baseStyle: ({ theme, sx }) => {
2599
+ const { tiny } = theme.typography.stylized;
2600
+ return merge({
2601
+ color: "text.default",
2602
+ fontFamily: tiny.fontFamily,
2603
+ fontWeight: tiny.fontWeight,
2604
+ lineHeight: tiny.lineHeight,
2605
+ fontSize: tiny.fontSize,
2606
+ letterSpacing: tiny.letterSpacing,
2607
+ textTransform: tiny.textCase
2608
+ }, sx);
2609
+ }
2610
+ };
2611
+
2612
+ const Capitalized = {
2613
+ baseStyle: ({ theme, sx }) => {
2614
+ const { CAPITALIZED } = theme.typography.stylized;
2615
+ return merge({
2616
+ color: "text.default",
2617
+ fontFamily: CAPITALIZED.fontFamily,
2618
+ fontWeight: CAPITALIZED.fontWeight,
2619
+ lineHeight: CAPITALIZED.lineHeight,
2620
+ fontSize: CAPITALIZED.fontSize,
2621
+ letterSpacing: CAPITALIZED.letterSpacing,
2622
+ textTransform: CAPITALIZED.textCase
2623
+ }, sx);
2624
+ }
2625
+ };
2626
+
2627
+ const Lead = {
2628
+ baseStyle: ({ theme, sx }) => {
2629
+ const { lead } = theme.typography.stylized;
2630
+ return merge({
2631
+ color: "text.default",
2632
+ fontFamily: lead.fontFamily,
2633
+ fontWeight: lead.fontWeight,
2634
+ lineHeight: lead.lineHeight,
2635
+ fontSize: lead.fontSize,
2636
+ letterSpacing: lead.letterSpacing,
2637
+ textTransform: lead.textCase
2638
+ }, sx);
2639
+ }
2640
+ };
2641
+
2642
+ const Small = {
2643
+ baseStyle: ({ theme, sx }) => {
2644
+ const { small } = theme.typography.stylized;
2645
+ return merge({
2646
+ color: "text.default",
2647
+ fontFamily: small.fontFamily,
2648
+ fontWeight: small.fontWeight,
2649
+ lineHeight: small.lineHeight,
2650
+ fontSize: small.fontSize,
2651
+ letterSpacing: small.letterSpacing,
2652
+ textTransform: small.textCase
2653
+ }, sx);
2654
+ }
2655
+ };
2656
+
2657
+ const P = {
2658
+ variants: {
2659
+ 14: ({ theme, sx }) => {
2660
+ const { body14 } = theme.typography.body;
2661
+ return merge({
2662
+ fontFamily: body14.fontFamily,
2663
+ fontWeight: body14.fontWeight,
2664
+ lineHeight: body14.lineHeight,
2665
+ fontSize: body14.fontSize,
2666
+ letterSpacing: body14.letterSpacing,
2667
+ textTransform: body14.textCase
2668
+ }, sx);
2669
+ },
2670
+ 16: ({ theme, sx }) => {
2671
+ const { body16 } = theme.typography.body;
2672
+ return merge({
2673
+ fontFamily: body16.fontFamily,
2674
+ fontWeight: body16.fontWeight,
2675
+ lineHeight: body16.lineHeight,
2676
+ fontSize: body16.fontSize,
2677
+ letterSpacing: body16.letterSpacing,
2678
+ textTransform: body16.textCase
2679
+ }, sx);
2680
+ }
2681
+ },
2682
+ baseStyle: {
2683
+ color: "text.default"
2684
+ }
2685
+ };
2686
+
2687
+ const Label = {
2688
+ baseStyle: ({ theme: { sizes: sizing }, sx }) => merge({
2689
+ color: "inherit",
2690
+ width: "100%",
2691
+ maxWidth: "100%",
2692
+ marginBottom: sizing[0],
2693
+ marginInlineStart: sizing[0],
2694
+ marginEnd: sizing[0],
2695
+ marginInlineEnd: sizing[0]
2696
+ }, sx),
2697
+ sizes: {
2698
+ "2xs": ({ theme, sx }) => {
2699
+ const { tinyLabel } = theme.typography.labels;
2700
+ return merge({
2701
+ fontFamily: tinyLabel.fontFamily,
2702
+ fontWeight: tinyLabel.fontWeight,
2703
+ lineHeight: tinyLabel.lineHeight,
2704
+ fontSize: tinyLabel.fontSize,
2705
+ letterSpacing: tinyLabel.letterSpacing,
2706
+ textTransform: tinyLabel.textCase
2707
+ }, sx);
2708
+ },
2709
+ xs: ({ theme, sx }) => {
2710
+ const { xsLabel } = theme.typography.labels;
2711
+ return merge({
2712
+ fontFamily: xsLabel.fontFamily,
2713
+ fontWeight: xsLabel.fontWeight,
2714
+ lineHeight: xsLabel.lineHeight,
2715
+ fontSize: xsLabel.fontSize,
2716
+ letterSpacing: xsLabel.letterSpacing,
2717
+ textTransform: xsLabel.textCase
2718
+ }, sx);
2719
+ },
2720
+ sm: ({ theme, sx }) => {
2721
+ const { smLabel } = theme.typography.labels;
2722
+ return merge({
2723
+ fontFamily: smLabel.fontFamily,
2724
+ fontWeight: smLabel.fontWeight,
2725
+ lineHeight: smLabel.lineHeight,
2726
+ fontSize: smLabel.fontSize,
2727
+ letterSpacing: smLabel.letterSpacing,
2728
+ textTransform: smLabel.textCase
2729
+ }, sx);
2730
+ },
2731
+ md: ({ theme, sx }) => {
2732
+ const { mdLabel } = theme.typography.labels;
2733
+ return merge({
2734
+ fontFamily: mdLabel.fontFamily,
2735
+ fontWeight: mdLabel.fontWeight,
2736
+ lineHeight: mdLabel.lineHeight,
2737
+ fontSize: mdLabel.fontSize,
2738
+ letterSpacing: mdLabel.letterSpacing,
2739
+ textTransform: mdLabel.textCase
2740
+ }, sx);
2741
+ },
2742
+ lg: ({ theme, sx }) => {
2743
+ const { lgLabel } = theme.typography.labels;
2744
+ return merge({
2745
+ fontFamily: lgLabel.fontFamily,
2746
+ fontWeight: lgLabel.fontWeight,
2747
+ lineHeight: lgLabel.lineHeight,
2748
+ fontSize: lgLabel.fontSize,
2749
+ letterSpacing: lgLabel.letterSpacing,
2750
+ textTransform: lgLabel.textCase
2751
+ }, sx);
2752
+ }
2753
+ }
2754
+ };
2755
+
2756
+ const SplitPane = {
2757
+ baseStyle: ({ minLeftWidth, minRightWidth, initialSplit, isOpen }) => ({
2758
+ display: "grid",
2759
+ overflow: "hidden",
2760
+ gridTemplateColumns: !isOpen ? "1fr" : `minmax(${minLeftWidth}%, var(--split-pos, ${initialSplit}%)) auto minmax(${minRightWidth}%, 1fr)`,
2761
+ alignItems: "stretch",
2762
+ justifyItems: "stretch",
2763
+ height: "100%",
2764
+ width: "100%"
2765
+ })
2766
+ };
2767
+ const PaneDivider = {
2768
+ baseStyle: ({ theme: { colors: color, sizes: sizing } }) => ({
2769
+ bgColor: color.background["pane-divider"].default,
2770
+ zIndex: 300,
2771
+ cursor: "col-resize",
2772
+ height: "100%",
2773
+ width: sizing[1],
2774
+ _hover: {
2775
+ outlineColor: color.border["pane-divider"].hover,
2776
+ outlineWidth: sizing["0a"],
2777
+ outlineStyle: "solid"
2778
+ },
2779
+ _active: {
2780
+ outlineColor: color.border["pane-divider"].hover,
2781
+ outlineWidth: sizing["0a"],
2782
+ outlineStyle: "solid"
2783
+ }
2784
+ })
2785
+ };
2786
+
2787
+ const Carousel = {
2788
+ parts: ["container", "arrow", "radio"],
2789
+ baseStyle: {
2790
+ container: {
2791
+ display: "grid",
2792
+ placeItems: "center",
2793
+ position: "relative",
2794
+ overflow: "hidden",
2795
+ width: "full",
2796
+ height: "full"
2797
+ },
2798
+ radio: {
2799
+ position: "absolute",
2800
+ bottom: "1",
2801
+ left: "50%",
2802
+ transform: "translateX(-50%)",
2803
+ overflowX: "scroll",
2804
+ maxWidth: "90%",
2805
+ padding: "2"
2806
+ },
2807
+ arrow: {
2808
+ position: "absolute",
2809
+ bottom: "0",
2810
+ height: "100%",
2811
+ cursor: "pointer"
2812
+ }
2813
+ }
2814
+ };
2815
+
2816
+ const EditableText = {
2817
+ parts: ["button", "icon", "controls", "preview", "input"],
2818
+ sizes: {
2819
+ sm: ({ isEditing, theme: { sizes: sizing } }) => ({
2820
+ button: {
2821
+ height: sizing.button.xs,
2822
+ minWidth: sizing.button.xs
2823
+ },
2824
+ icon: {
2825
+ boxSize: sizing.icon.xs
2826
+ },
2827
+ controls: {
2828
+ width: !isEditing ? 6 : "3.25rem"
2829
+ },
2830
+ preview: {
2831
+ pt: 1
2832
+ },
2833
+ input: {
2834
+ paddingInlineEnd: 16,
2835
+ paddingRight: 16
2836
+ }
2837
+ }),
2838
+ md: ({ isEditing, theme: { sizes: sizing } }) => ({
2839
+ button: {
2840
+ height: sizing.button.sm,
2841
+ minWidth: sizing.button.sm
2842
+ },
2843
+ icon: {
2844
+ boxSize: sizing.icon.sm
2845
+ },
2846
+ controls: {
2847
+ width: !isEditing ? 8 : "4.25rem"
2848
+ },
2849
+ preview: {
2850
+ pt: "7px"
2851
+ },
2852
+ input: {
2853
+ paddingInlineEnd: 20,
2854
+ paddingRight: 20
2855
+ }
2856
+ }),
2857
+ lg: ({ isEditing, theme: { sizes: sizing } }) => ({
2858
+ button: {
2859
+ height: sizing.button.md,
2860
+ minWidth: sizing.button.md
2861
+ },
2862
+ icon: {
2863
+ boxSize: sizing.icon.md
2864
+ },
2865
+ controls: {
2866
+ width: !isEditing ? 10 : "5.25rem"
2867
+ },
2868
+ preview: {
2869
+ pt: "8px"
2870
+ },
2871
+ input: {
2872
+ paddingInlineEnd: 24,
2873
+ paddingRight: 24
2874
+ }
2875
+ })
2876
+ },
2877
+ baseStyle: {
2878
+ controls: {
2879
+ mr: 1
2880
+ },
2881
+ preview: {
2882
+ fontWeight: "semibold",
2883
+ textOverflow: "ellipsis",
2884
+ whiteSpace: "nowrap",
2885
+ overflow: "hidden",
2886
+ paddingTop: 0,
2887
+ paddingBottom: 0
2888
+ },
2889
+ input: {
2890
+ fontWeight: "semibold"
2891
+ }
2892
+ }
2893
+ };
2894
+
2895
+ const Toolbox = {
2896
+ parts: ["container", "header", "body", "footer"],
2897
+ baseStyle: ({ theme: { sizes: sizing } }) => ({
2898
+ container: {
2899
+ position: "relative",
2900
+ flexDirection: "column",
2901
+ bg: "text.inverted",
2902
+ h: "100vh",
2903
+ borderLeftWidth: "1px",
2904
+ borderLeftStyle: "solid",
2905
+ borderLeftColor: "gray.100"
2906
+ },
2907
+ header: {
2908
+ alignItems: "center",
2909
+ height: "16",
2910
+ borderBottomWidth: "1px",
2911
+ borderBottomStyle: "solid",
2912
+ borderBottomColor: "gray.100",
2913
+ pl: "4",
2914
+ pr: "16"
2915
+ },
2916
+ footer: {
2917
+ position: "absolute",
2918
+ bottom: "0",
2919
+ w: "full",
2920
+ p: "4",
2921
+ alignItems: "center",
2922
+ height: "16",
2923
+ borderTopWidth: "1px",
2924
+ borderTopStyle: "solid",
2925
+ borderTopColor: "gray.100"
2926
+ },
2927
+ body: {
2928
+ p: sizing["4"],
2929
+ flexDirection: "column",
2930
+ w: "100%",
2931
+ h: "100%",
2932
+ maxH: `calc(100vh - ${sizing["16"]} * 2)`,
2933
+ overflowY: "scroll"
2934
+ }
2935
+ }),
2936
+ sizes: {
2937
+ sm: {
2938
+ container: {
2939
+ w: "xs"
2940
+ }
2941
+ },
2942
+ md: {
2943
+ container: {
2944
+ w: "md"
2945
+ }
2946
+ },
2947
+ lg: {
2948
+ container: {
2949
+ w: "xl"
2950
+ }
2951
+ }
2952
+ }
2953
+ };
2954
+
2955
+ const shakeAnimation = keyframes`
2956
+ 0% { transform: translate(1px, 1px) rotate(0deg); }
2957
+ 10% { transform: translate(-1px, -2px) rotate(-1deg); }
2958
+ 20% { transform: translate(-3px, 0px) rotate(1deg); }
2959
+ 30% { transform: translate(3px, 2px) rotate(0deg); }
2960
+ 40% { transform: translate(1px, -1px) rotate(1deg); }
2961
+ 50% { transform: translate(-1px, 2px) rotate(-1deg); }
2962
+ 60% { transform: translate(-3px, 1px) rotate(0deg); }
2963
+ 70% { transform: translate(3px, 1px) rotate(-1deg); }
2964
+ 80% { transform: translate(-1px, -1px) rotate(1deg); }
2965
+ 90% { transform: translate(1px, 2px) rotate(0deg); }
2966
+ 100% { transform: translate(1px, -2px) rotate(-1deg); }
2967
+ `;
2968
+ const thickRing = {
2969
+ _focusVisible: {
2970
+ outline: "none",
2971
+ ring: "3px",
2972
+ ringColor: "border.wcag",
2973
+ ringOffset: "1px"
2974
+ }
2975
+ };
2976
+ const getInvalidColorStyles = (isInvalid, isImage = true) => ({
2977
+ borderColor: isInvalid ? "red.500" : "gray.300",
2978
+ bgColor: isInvalid && "red.50",
2979
+ animation: isInvalid && `500ms ${shakeAnimation} ease`,
2980
+ _hover: isImage && {
2981
+ bgColor: isInvalid ? "red.50" : "blue.50",
2982
+ borderColor: isInvalid ? "red.500" : "blue.500"
2983
+ }
2984
+ });
2985
+ const FilePicker = {
2986
+ parts: ["filePicker", "fileItem", "multiFilePicker"],
2987
+ baseStyle: ({ theme: { sizes, colors }, hasLoaded, isImage, isInvalid }) => ({
2988
+ filePicker: {
2989
+ display: "flex",
2990
+ flexDirection: "column",
2991
+ alignItems: "center",
2992
+ justifyContent: "center",
2993
+ width: "44",
2994
+ height: "40",
2995
+ textAlign: "center",
2996
+ position: "relative",
2997
+ borderWidth: hasLoaded && isImage ? "0" : sizes["0a"],
2998
+ borderStyle: "dashed",
2999
+ borderRadius: "lg",
3000
+ ...getInvalidColorStyles(isInvalid, isImage),
3001
+ ...thickRing
3002
+ },
3003
+ multiFilePicker: {
3004
+ width: "full",
3005
+ maxWidth: "inherit",
3006
+ height: "32",
3007
+ position: "relative",
3008
+ borderWidth: sizes["0a"],
3009
+ borderStyle: "dashed",
3010
+ borderRadius: "lg",
3011
+ ...getInvalidColorStyles(isInvalid),
3012
+ ...thickRing
3013
+ },
3014
+ fileItem: {
3015
+ display: "flex",
3016
+ flexDirection: "column",
3017
+ alignItems: "center",
3018
+ justifyContent: "center",
3019
+ paddingX: "2",
3020
+ paddingY: "1",
3021
+ borderRadius: sizes["2"],
3022
+ textAlign: "center",
3023
+ position: "relative",
3024
+ border: `2px solid ${colors.gray["100"]}`,
3025
+ minHeight: "20"
3026
+ }
3027
+ })
3028
+ };
3029
+
3030
+ var components = /*#__PURE__*/Object.freeze({
3031
+ __proto__: null,
3032
+ Breadcrumb: Breadcrumb,
3033
+ Button: Button,
3034
+ Blinker: Blinker,
3035
+ Checkbox: Checkbox,
3036
+ Input: Input,
3037
+ PinInput: PinInput,
3038
+ Select: Select,
3039
+ Radio: Radio,
3040
+ Tabs: Tabs,
3041
+ Textarea: Textarea,
3042
+ Link: Link,
3043
+ Switch: Switch$1,
3044
+ Tag: Tag,
3045
+ Alert: Alert,
3046
+ NumberInput: NumberInput,
3047
+ NotificationIconButton: NotificationIconButton,
3048
+ Calendar: Calendar,
3049
+ DragAndDrop: DragAndDrop,
3050
+ DatePicker: DatePicker,
3051
+ FlipButton: FlipButton,
3052
+ Spinner: Spinner,
3053
+ Avatar: Avatar,
3054
+ CloseButton: CloseButton,
3055
+ Modal: Modal,
3056
+ Tooltip: Tooltip,
3057
+ Icon: Icon,
3058
+ ClipboardInput: ClipboardInput,
3059
+ ColorPicker: ColorPicker,
3060
+ Step: Step,
3061
+ StepList: StepList,
3062
+ H1: H1,
3063
+ H2: H2,
3064
+ H3: H3,
3065
+ H4: H4,
3066
+ H5: H5,
3067
+ H6: H6,
3068
+ Blockquote: Blockquote,
3069
+ Tiny: Tiny,
3070
+ Capitalized: Capitalized,
3071
+ Lead: Lead,
3072
+ Small: Small,
3073
+ P: P,
3074
+ Label: Label,
3075
+ SplitPane: SplitPane,
3076
+ PaneDivider: PaneDivider,
3077
+ Carousel: Carousel,
3078
+ EditableText: EditableText,
3079
+ Toolbox: Toolbox,
3080
+ FilePicker: FilePicker
3081
+ });
3082
+
3083
+ const WebappSkin = {
3084
+ colors: WebappSkin$1.color,
3085
+ sizes: WebappSkin$1.sizing,
3086
+ space: WebappSkin$1.spacing,
3087
+ radii: WebappSkin$1.borderRadius,
3088
+ borders: WebappSkin$1.borderWidth,
3089
+ opacity: WebappSkin$1.opacity,
3090
+ typography
3091
+ };
3092
+
3093
+ const TottSkin = {
3094
+ colors: TottSkin$1.color,
3095
+ sizes: TottSkin$1.sizing,
3096
+ space: TottSkin$1.spacing,
3097
+ radii: TottSkin$1.borderRadius,
3098
+ borders: TottSkin$1.borderWidth,
3099
+ opacity: TottSkin$1.opacity,
3100
+ typography
3101
+ };
3102
+
3103
+ const overrides = {
3104
+ config: {
3105
+ cssVarPrefix: ""
3106
+ },
3107
+ semanticTokens: {
3108
+ colors: {
3109
+ "chakra-body-text": {
3110
+ _light: "text.default",
3111
+ _dark: "text.inverted"
3112
+ }
3113
+ }
3114
+ },
3115
+ styles: {
3116
+ global: {
3117
+ body: {
3118
+ height: "100%"
3119
+ },
3120
+ "#app": {
3121
+ height: "100%"
3122
+ },
3123
+ ...scrollbarStyles
3124
+ }
3125
+ },
3126
+ fonts: {
3127
+ heading: "Inter, sans-serif",
3128
+ body: "Inter, sans-serif"
3129
+ },
3130
+ components: { ...components },
3131
+ colors: palette,
3132
+ zIndices: coreZIndex,
3133
+ sizes: coreSizing,
3134
+ space: coreSpacing,
3135
+ fontWeights: coreFontWeight,
3136
+ shadows: coreBoxShadow,
3137
+ fontSizes: coreFontSize,
3138
+ lineHeights: coreLineHeight,
3139
+ radii: coreBorderRadius
3140
+ };
3141
+ const theme = extendTheme(overrides, WebappSkin);
3142
+ const tottTheme = extendTheme(overrides, TottSkin);
3143
+
3144
+ const MediatoolThemeProvider = ({
3145
+ children,
3146
+ theme: theme$1 = theme
3147
+ }) => /* @__PURE__ */ React.createElement(ChakraProvider, {
3148
+ resetCSS: true,
3149
+ theme: theme$1
3150
+ }, children);
3151
+
3152
+ forwardRef$1(({
3153
+ variant = "ghost",
3154
+ icon,
3155
+ "aria-label": ariaLabel,
3156
+ hasNotification = false,
3157
+ blinkerColor = "green.500",
3158
+ size,
3159
+ ...rest
3160
+ }, ref) => {
3161
+ const [isBlinking, setIsBlinking] = useState(false);
3162
+ const { container, notifier } = useMultiStyleConfig("NotificationIconButton", { size, variant });
3163
+ return /* @__PURE__ */ React.createElement(Box, {
3164
+ onMouseEnter: () => setIsBlinking(true),
3165
+ onMouseLeave: () => setIsBlinking(false),
3166
+ sx: container
3167
+ }, hasNotification && /* @__PURE__ */ React.createElement(Box, {
3168
+ sx: notifier
3169
+ }, /* @__PURE__ */ React.createElement(Blinker$1, {
3170
+ isBlinking,
3171
+ color: blinkerColor,
3172
+ size: "2xs"
3173
+ })), /* @__PURE__ */ React.createElement(IconButton, {
3174
+ variant,
3175
+ icon,
3176
+ "aria-label": ariaLabel,
3177
+ ref,
3178
+ size,
3179
+ ...rest
3180
+ }));
3181
+ });
3182
+
3183
+ const Switch = ({
3184
+ value,
3185
+ onChange,
3186
+ name,
3187
+ size = "md",
3188
+ ...rest
3189
+ }) => /* @__PURE__ */ React.createElement(Switch$2, {
3190
+ size,
3191
+ id: name,
3192
+ isChecked: value,
3193
+ onChange,
3194
+ ...rest
3195
+ });
3196
+
3197
+ forwardRef((props, ref) => {
3198
+ const style = useStyleConfig("PaneDivider");
3199
+ return /* @__PURE__ */ React.createElement(Box, {
3200
+ ref,
3201
+ sx: style,
3202
+ ...props
3203
+ });
3204
+ });
3205
+
3206
+ const users = {
3207
+ "obi-wan": {
3208
+ name: "Obi-Wan Kenobi",
3209
+ country: "Germany",
3210
+ image: `
3211
+ https://www.gamereactor.se/media/08/redaxresonerar_3470803.jpg
3212
+ `,
3213
+ preferences: {
3214
+ locale: "de-DE",
3215
+ currency: "EUR",
3216
+ firstDayOfWeek: "monday"
3217
+ }
3218
+ },
3219
+ anakin: {
3220
+ name: "Anakin Skywalker",
3221
+ country: "US",
3222
+ image: `
3223
+ https://thenerdstash.com/wp-content/uploads/2021/10/Hayden-Christensen-Anakin-Skywalker.jpg
3224
+ `,
3225
+ preferences: {
3226
+ locale: "en-US",
3227
+ currency: "USD",
3228
+ firstDayOfWeek: "sunday"
3229
+ }
3230
+ },
3231
+ han: {
3232
+ name: "Han Solo",
3233
+ country: "Sweden",
3234
+ image: `
3235
+ https://fictionhorizon.com/wp-content/uploads/2021/09/Han-Solo.jpg
3236
+ `,
3237
+ preferences: {
3238
+ locale: "sv-SE",
3239
+ currency: "SEK",
3240
+ firstDayOfWeek: "sunday"
3241
+ }
3242
+ },
3243
+ yoda: {
3244
+ name: "Yoda",
3245
+ country: "England",
3246
+ image: `
3247
+ https://markerasomolast.files.wordpress.com/2013/08/yoda.jpg
3248
+ `,
3249
+ preferences: {
3250
+ locale: "en-GB",
3251
+ currency: "GBP",
3252
+ firstDayOfWeek: "monday"
3253
+ }
3254
+ }
3255
+ };
3256
+ const UserContext = createContext(null);
3257
+ const UserProvider = ({ children }) => {
3258
+ const [user, setUser] = useState(users["obi-wan"]);
3259
+ const contextValue = useMemo(() => ({
3260
+ user,
3261
+ setUser
3262
+ }), [user]);
3263
+ return /* @__PURE__ */ React.createElement(UserContext.Provider, {
3264
+ value: contextValue
3265
+ }, children);
3266
+ };
3267
+ const useUser = () => {
3268
+ const context = useContext(UserContext);
3269
+ if (!context) {
3270
+ throw new Error("Cannot find <UserProvider> anywhere in your React tree");
3271
+ }
3272
+ return context;
3273
+ };
3274
+
3275
+ const I18nProvider = ({ children }) => {
3276
+ const { user } = useUser();
3277
+ const i18nManager = useMemo(() => {
3278
+ const { preferences: { locale, currency } } = user;
3279
+ return new I18nManager({
3280
+ locale,
3281
+ currency
3282
+ });
3283
+ }, [user]);
3284
+ return /* @__PURE__ */ React.createElement(I18nContext.Provider, {
3285
+ value: i18nManager
3286
+ }, children);
3287
+ };
3288
+
3289
+ const CalendarProvider = ({ children }) => {
3290
+ const { user: { preferences: { firstDayOfWeek = "monday" } } } = useUser();
3291
+ const calendarLocale = firstDayOfWeek === "monday" ? "en-GB" : "en-US";
3292
+ return /* @__PURE__ */ React.createElement(I18nProvider$1, {
3293
+ locale: calendarLocale
3294
+ }, children);
3295
+ };
3296
+
3297
+ const LazyPage = ({ loader, children, ...rest }) => {
3298
+ const Component = useMemo(() => React.lazy(loader), []);
3299
+ return /* @__PURE__ */ React.createElement(Suspense, {
3300
+ fallback: /* @__PURE__ */ React.createElement("p", null, "Loading....")
3301
+ }, children ? children(Component, { ...rest }) : /* @__PURE__ */ React.createElement(Component, {
3302
+ ...rest
3303
+ }));
3304
+ };
3305
+
3306
+ const normalizePath = ({
3307
+ basename,
3308
+ path
3309
+ }) => basename ? `${basename}${path}` : path;
3310
+ const Routing = ({ routes, basename, fallback }) => /* @__PURE__ */ React.createElement(Switch$3, null, routes.flatMap(({ path, component, subItems = [] }) => {
3311
+ const routePath = normalizePath({ basename, path });
3312
+ const mainRoute = /* @__PURE__ */ React.createElement(Route, {
3313
+ key: routePath,
3314
+ exact: true,
3315
+ path: routePath,
3316
+ render: (props) => /* @__PURE__ */ React.createElement(LazyPage, {
3317
+ ...props,
3318
+ loader: component
3319
+ })
3320
+ });
3321
+ const subRoutes = subItems.map(({ path: subPath, component: subComponent }) => {
3322
+ const fullPath = `${path}${subPath}`;
3323
+ return /* @__PURE__ */ React.createElement(Route, {
3324
+ key: fullPath,
3325
+ path: fullPath,
3326
+ render: (props) => /* @__PURE__ */ React.createElement(LazyPage, {
3327
+ ...props,
3328
+ loader: subComponent
3329
+ })
3330
+ });
3331
+ });
3332
+ return [mainRoute, ...subRoutes];
3333
+ }), fallback && /* @__PURE__ */ React.createElement(Redirect, {
3334
+ to: fallback
3335
+ }));
3336
+
3337
+ const MenuItem = ({ path, Icon: IconComponent, title }) => /* @__PURE__ */ React.createElement(HStack, {
3338
+ p: 2,
3339
+ to: path,
3340
+ as: NavLink,
3341
+ borderRadius: 6,
3342
+ _hover: { bgColor: "background.button.default-hover" },
3343
+ _activeLink: { bgColor: "background.button.brand", color: "text.inverted" }
3344
+ }, /* @__PURE__ */ React.createElement(Icon$1, {
3345
+ as: IconComponent,
3346
+ boxSize: 6
3347
+ }), /* @__PURE__ */ React.createElement(Label$1, {
3348
+ size: "md",
3349
+ sx: { color: "inherit", cursor: "pointer" }
3350
+ }, title));
3351
+ const MainMenu = ({ menuItems }) => /* @__PURE__ */ React.createElement(Stack, {
3352
+ spacing: 2,
3353
+ mb: 6,
3354
+ color: "text.default",
3355
+ bgColor: "background.default"
3356
+ }, menuItems.map((item) => /* @__PURE__ */ React.createElement(MenuItem, {
3357
+ key: item.path,
3358
+ ...item
3359
+ })));
3360
+
3361
+ const SubMenuItem = ({ path, title }) => /* @__PURE__ */ React.createElement(HStack, {
3362
+ as: NavLink,
3363
+ to: path,
3364
+ borderRadius: 6,
3365
+ p: 2,
3366
+ _hover: { bgColor: "background.button.default-hover" },
3367
+ _activeLink: { bgColor: "background.button.default-hover" }
3368
+ }, /* @__PURE__ */ React.createElement(Label$1, {
3369
+ size: "md",
3370
+ sx: { color: "inherit", cursor: "pointer" }
3371
+ }, title));
3372
+ const SubMenu = ({ mainRoutes }) => /* @__PURE__ */ React.createElement(Stack, {
3373
+ color: "text.default",
3374
+ overflow: "auto",
3375
+ pr: 2,
3376
+ bgColor: "background.default"
3377
+ }, /* @__PURE__ */ React.createElement(Switch$3, null, mainRoutes.map(({ path: mainPath, subItems = [] }) => /* @__PURE__ */ React.createElement(Route, {
3378
+ key: mainPath,
3379
+ path: mainPath,
3380
+ render: () => subItems.map(
3381
+ ({ path, ...rest }) => {
3382
+ const subPath = `${mainPath}${path}`;
3383
+ return /* @__PURE__ */ React.createElement(SubMenuItem, {
3384
+ key: path,
3385
+ path: subPath,
3386
+ ...rest
3387
+ });
3388
+ }
3389
+ )
3390
+ }))));
3391
+
3392
+ const searchComponentsBarStyles = {
3393
+ loadingIndicator: () => ({ display: "none" }),
3394
+ control: (styles, { menuIsOpen, options }) => ({
3395
+ ...styles,
3396
+ _focusVisible: {},
3397
+ border: "none",
3398
+ p: "4",
3399
+ width: "95%",
3400
+ mx: "auto",
3401
+ borderBottom: menuIsOpen && options.length > 0 ? `2px dashed ${palette.gray["100"]}` : "2px dashed transparent",
3402
+ zIndex: "maxnus"
3403
+ }),
3404
+ menu: (styles) => ({
3405
+ ...styles,
3406
+ mb: "0",
3407
+ mt: "-1"
3408
+ }),
3409
+ menuList: (styles) => ({
3410
+ ...styles,
3411
+ pt: "2",
3412
+ pb: "16",
3413
+ height: "auto",
3414
+ maxHeight: "3xl",
3415
+ borderTopLeftRadius: "0",
3416
+ borderTopRightRadius: "0",
3417
+ borderBottomLeftRadius: "md",
3418
+ borderBottomRightRadius: "md",
3419
+ border: "none",
3420
+ bgColor: "text.inverted"
3421
+ }),
3422
+ option: (styles, { isFocused }) => {
3423
+ const focusRing = isFocused && {
3424
+ outline: "none",
3425
+ ring: "2px",
3426
+ ringColor: "border.wcag",
3427
+ ringOffset: "1px"
3428
+ };
3429
+ return {
3430
+ ...styles,
3431
+ mt: "4",
3432
+ p: "4",
3433
+ borderRadius: "md",
3434
+ w: "90%",
3435
+ mx: "auto",
3436
+ transition: "none",
3437
+ bgColor: isFocused ? "blue.500" : "gray.50",
3438
+ color: isFocused ? "text.inverted" : "text.default",
3439
+ fontWeight: "semibold",
3440
+ ...focusRing
3441
+ };
3442
+ }
3443
+ };
3444
+
3445
+ const ComponentPageLink = ({ label }) => /* @__PURE__ */ React.createElement(HStack, {
3446
+ justifyContent: "space-between",
3447
+ w: "full"
3448
+ }, /* @__PURE__ */ React.createElement(Text, null, label), /* @__PURE__ */ React.createElement(Icon$1, {
3449
+ as: ArrowCircleRightDuo,
3450
+ size: "lg"
3451
+ }));
3452
+
3453
+ const SearchComponentsBar = ({
3454
+ routes
3455
+ }) => {
3456
+ const location = useLocation();
3457
+ const { isOpen, onOpen, onClose } = useDisclosure();
3458
+ const history = useHistory();
3459
+ const ref = useRef(null);
3460
+ const handleKeyboardShortcut = (e) => {
3461
+ if ((e.metaKey || e.ctrlKey) && e.key === "k") {
3462
+ onOpen();
3463
+ }
3464
+ };
3465
+ useEffect(() => {
3466
+ window.addEventListener("keydown", handleKeyboardShortcut);
3467
+ return () => {
3468
+ window.removeEventListener("keydown", handleKeyboardShortcut);
3469
+ };
3470
+ }, []);
3471
+ const options = map(
3472
+ (route) => ({
3473
+ value: route.path,
3474
+ label: route.title
3475
+ }),
3476
+ routes
3477
+ );
3478
+ const fuse = useMemo(() => new Fuse(options, {
3479
+ threshold: 0.2,
3480
+ keys: ["label"]
3481
+ }), [options]);
3482
+ const handleChange = ({ value }) => {
3483
+ history.push(`/components${value}`);
3484
+ onClose();
3485
+ };
3486
+ const loadOptions = async (query) => map(prop("item"), fuse.search(query));
3487
+ const handleKeyDown = (e) => {
3488
+ if (e.key === "Escape") {
3489
+ onClose();
3490
+ }
3491
+ };
3492
+ const currentPage = location.pathname.split("/")[1];
3493
+ if (currentPage !== "components")
3494
+ return null;
3495
+ return /* @__PURE__ */ React.createElement(Stack, {
3496
+ p: "4"
3497
+ }, /* @__PURE__ */ React.createElement(Card, {
3498
+ w: "lg"
3499
+ }, /* @__PURE__ */ React.createElement(SearchBar, {
3500
+ placeholder: "Ctrl + k...",
3501
+ onMenuOpen: onOpen
3502
+ })), /* @__PURE__ */ React.createElement(Modal$2, {
3503
+ isOpen,
3504
+ onClose,
3505
+ size: "3xl",
3506
+ autoFocus: true,
3507
+ initialFocusRef: ref
3508
+ }, /* @__PURE__ */ React.createElement(ModalOverlay, null), /* @__PURE__ */ React.createElement(ModalContent, null, /* @__PURE__ */ React.createElement(SearchBar, {
3509
+ loadOptions,
3510
+ debouncedWaitTime: 0,
3511
+ closeMenuOnSelect: true,
3512
+ onChange: handleChange,
3513
+ ref,
3514
+ sx: searchComponentsBarStyles,
3515
+ customOption: ComponentPageLink,
3516
+ noOptionsMessage: () => null,
3517
+ loadingMessage: () => null,
3518
+ onKeyDown: handleKeyDown
3519
+ }))));
3520
+ };
3521
+
3522
+ const Sandbox = ({ routes }) => {
3523
+ const [tott, setTott] = useState(false);
3524
+ return /* @__PURE__ */ React.createElement(MediatoolThemeProvider, {
3525
+ theme: tott ? tottTheme : void 0
3526
+ }, /* @__PURE__ */ React.createElement(UserProvider, null, /* @__PURE__ */ React.createElement(CalendarProvider, null, /* @__PURE__ */ React.createElement(I18nProvider, null, /* @__PURE__ */ React.createElement(BrowserRouter, null, /* @__PURE__ */ React.createElement(Grid, {
3527
+ height: "100vh",
3528
+ gridTemplateColumns: "280px auto",
3529
+ color: "text.default",
3530
+ bgColor: "background.default"
3531
+ }, /* @__PURE__ */ React.createElement(Flex, {
3532
+ direction: "column",
3533
+ overflow: "auto",
3534
+ p: 2
3535
+ }, /* @__PURE__ */ React.createElement(FormControl, {
3536
+ display: "flex",
3537
+ alignItems: "center",
3538
+ my: 2,
3539
+ pl: 2
3540
+ }, /* @__PURE__ */ React.createElement(FormLabel, {
3541
+ htmlFor: "tott",
3542
+ mb: "0"
3543
+ }, "TOTT theme, uhm?"), /* @__PURE__ */ React.createElement(Switch, {
3544
+ id: "tott",
3545
+ onChange: () => setTott(!tott)
3546
+ })), /* @__PURE__ */ React.createElement(MainMenu, {
3547
+ menuItems: routes
3548
+ }), /* @__PURE__ */ React.createElement(SubMenu, {
3549
+ mainRoutes: routes
3550
+ })), /* @__PURE__ */ React.createElement(Stack, {
3551
+ spacing: "4",
3552
+ pt: "4"
3553
+ }, /* @__PURE__ */ React.createElement(SearchComponentsBar, {
3554
+ routes: head(routes)?.subItems || []
3555
+ }), /* @__PURE__ */ React.createElement(Routing, {
3556
+ fallback: head(routes)?.path,
3557
+ routes
3558
+ }))))))));
3559
+ };
3560
+
3561
+ export { Sandbox };
3562
+ //# sourceMappingURL=sandbox.mjs.map