@charcoal-ui/react 3.10.1 → 3.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/DropdownSelector/Popover/index.d.ts +1 -2
- package/dist/components/DropdownSelector/Popover/index.d.ts.map +1 -1
- package/dist/components/Modal/index.d.ts +1 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/useCustomModalOverlay.d.ts.map +1 -1
- package/dist/components/MultiSelect/index.d.ts.map +1 -1
- package/dist/components/Radio/index.d.ts +4 -4
- package/dist/components/Radio/index.d.ts.map +1 -1
- package/dist/components/TextArea/index.d.ts.map +1 -1
- package/dist/components/TextField/index.d.ts.map +1 -1
- package/dist/core/CharcoalProvider.d.ts +1 -1
- package/dist/core/CharcoalProvider.d.ts.map +1 -1
- package/dist/index.cjs.js +123 -351
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +85 -313
- package/dist/index.esm.js.map +1 -1
- package/package.json +13 -17
- package/src/components/Checkbox/__snapshots__/index.story.storyshot +601 -173
- package/src/components/Checkbox/index.story.tsx +57 -77
- package/src/components/Checkbox/index.tsx +7 -2
- package/src/components/DropdownSelector/Popover/index.tsx +1 -2
- package/src/components/IconButton/__snapshots__/index.story.storyshot +6 -8
- package/src/components/IconButton/index.story.tsx +14 -37
- package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +139 -1
- package/src/components/LoadingSpinner/index.story.tsx +18 -7
- package/src/components/Modal/index.tsx +1 -1
- package/src/components/Modal/useCustomModalOverlay.tsx +5 -4
- package/src/components/MultiSelect/__snapshots__/index.story.storyshot +32 -44
- package/src/components/MultiSelect/index.story.tsx +88 -192
- package/src/components/MultiSelect/index.tsx +2 -1
- package/src/components/Radio/__snapshots__/index.story.storyshot +1 -1
- package/src/components/Radio/index.story.tsx +20 -21
- package/src/components/Radio/index.tsx +14 -13
- package/src/components/Switch/__snapshots__/index.story.storyshot +8 -9
- package/src/components/Switch/index.story.tsx +10 -18
- package/src/components/TagItem/__snapshots__/index.story.storyshot +791 -665
- package/src/components/TagItem/index.story.tsx +44 -161
- package/src/components/TextArea/TextArea.story.tsx +62 -24
- package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +1858 -472
- package/src/components/TextArea/index.tsx +2 -0
- package/src/components/TextField/TextField.story.tsx +77 -67
- package/src/components/TextField/__snapshots__/TextField.story.storyshot +2004 -786
- package/src/components/TextField/index.tsx +2 -0
- package/src/components/a11y.test.tsx +1 -1
- package/src/core/CharcoalProvider.tsx +1 -1
- package/dist/components/Button/index.story.d.ts +0 -14
- package/dist/components/Button/index.story.d.ts.map +0 -1
- package/dist/components/Checkbox/index.story.d.ts +0 -8
- package/dist/components/Checkbox/index.story.d.ts.map +0 -1
- package/dist/components/Clickable/index.story.d.ts +0 -6
- package/dist/components/Clickable/index.story.d.ts.map +0 -1
- package/dist/components/DropdownSelector/ListItem/index.story.d.ts +0 -9
- package/dist/components/DropdownSelector/ListItem/index.story.d.ts.map +0 -1
- package/dist/components/DropdownSelector/MenuList/index.story.d.ts +0 -8
- package/dist/components/DropdownSelector/MenuList/index.story.d.ts.map +0 -1
- package/dist/components/DropdownSelector/Popover/index.story.d.ts +0 -5
- package/dist/components/DropdownSelector/Popover/index.story.d.ts.map +0 -1
- package/dist/components/DropdownSelector/index.story.d.ts +0 -19
- package/dist/components/DropdownSelector/index.story.d.ts.map +0 -1
- package/dist/components/Icon/index.story.d.ts +0 -6
- package/dist/components/Icon/index.story.d.ts.map +0 -1
- package/dist/components/IconButton/index.story.d.ts +0 -9
- package/dist/components/IconButton/index.story.d.ts.map +0 -1
- package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts +0 -8
- package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts.map +0 -1
- package/dist/components/LoadingSpinner/index.story.d.ts +0 -6
- package/dist/components/LoadingSpinner/index.story.d.ts.map +0 -1
- package/dist/components/Modal/index.story.d.ts +0 -21
- package/dist/components/Modal/index.story.d.ts.map +0 -1
- package/dist/components/MultiSelect/index.story.d.ts +0 -82
- package/dist/components/MultiSelect/index.story.d.ts.map +0 -1
- package/dist/components/MultiSelect/index.test.d.ts +0 -2
- package/dist/components/MultiSelect/index.test.d.ts.map +0 -1
- package/dist/components/Radio/index.story.d.ts +0 -26
- package/dist/components/Radio/index.story.d.ts.map +0 -1
- package/dist/components/Radio/index.test.d.ts +0 -2
- package/dist/components/Radio/index.test.d.ts.map +0 -1
- package/dist/components/SegmentedControl/index.story.d.ts +0 -7
- package/dist/components/SegmentedControl/index.story.d.ts.map +0 -1
- package/dist/components/Switch/index.story.d.ts +0 -9
- package/dist/components/Switch/index.story.d.ts.map +0 -1
- package/dist/components/TagItem/index.story.d.ts +0 -16
- package/dist/components/TagItem/index.story.d.ts.map +0 -1
- package/dist/components/TextArea/TextArea.story.d.ts +0 -9
- package/dist/components/TextArea/TextArea.story.d.ts.map +0 -1
- package/dist/components/TextField/TextField.story.d.ts +0 -22
- package/dist/components/TextField/TextField.story.d.ts.map +0 -1
- package/dist/components/a11y.test.d.ts +0 -2
- package/dist/components/a11y.test.d.ts.map +0 -1
- package/src/components/LoadingSpinner/LoadingSpinnerIcon.story.tsx +0 -13
package/dist/index.cjs.js
CHANGED
|
@@ -422,7 +422,24 @@ var MultiSelectGroupContext = (0, import_react5.createContext)({
|
|
|
422
422
|
|
|
423
423
|
// src/components/MultiSelect/index.tsx
|
|
424
424
|
var import_styled5 = require("@charcoal-ui/styled");
|
|
425
|
+
|
|
426
|
+
// src/components/Icon/index.tsx
|
|
427
|
+
var React4 = __toESM(require("react"));
|
|
428
|
+
var import_icons = require("@charcoal-ui/icons");
|
|
425
429
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
430
|
+
var Icon = React4.forwardRef(function IconInner({
|
|
431
|
+
name,
|
|
432
|
+
scale,
|
|
433
|
+
unsafeNonGuidelineScale,
|
|
434
|
+
className,
|
|
435
|
+
...rest
|
|
436
|
+
}, ref) {
|
|
437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("pixiv-icon", { ref, name, scale, "unsafe-non-guideline-scale": unsafeNonGuidelineScale, class: className, ...rest });
|
|
438
|
+
});
|
|
439
|
+
var Icon_default = Icon;
|
|
440
|
+
|
|
441
|
+
// src/components/MultiSelect/index.tsx
|
|
442
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
426
443
|
var MultiSelect = (0, import_react6.forwardRef)(function MultiSelectInner({
|
|
427
444
|
value,
|
|
428
445
|
disabled = false,
|
|
@@ -459,14 +476,14 @@ var MultiSelect = (0, import_react6.forwardRef)(function MultiSelectInner({
|
|
|
459
476
|
selected: event.currentTarget.checked
|
|
460
477
|
});
|
|
461
478
|
}, [onChange, parentOnChange, value]);
|
|
462
|
-
return /* @__PURE__ */ (0,
|
|
463
|
-
/* @__PURE__ */ (0,
|
|
479
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(MultiSelectRoot, { "aria-disabled": isDisabled, className, children: [
|
|
480
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MultiSelectInput, { ...{
|
|
464
481
|
name,
|
|
465
482
|
value,
|
|
466
483
|
invalid
|
|
467
484
|
}, checked: isSelected, disabled: isDisabled, onChange: handleChange, overlay: variant === "overlay", "aria-invalid": invalid, ref }),
|
|
468
|
-
/* @__PURE__ */ (0,
|
|
469
|
-
Boolean(children) && /* @__PURE__ */ (0,
|
|
485
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MultiSelectInputOverlay, { overlay: variant === "overlay", invalid, "aria-hidden": true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Icon_default, { name: "24/Check", "unsafe-non-guideline-scale": 16 / 24 }) }),
|
|
486
|
+
Boolean(children) && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MultiSelectLabel, { children })
|
|
470
487
|
] });
|
|
471
488
|
});
|
|
472
489
|
var MultiSelect_default = (0, import_react6.memo)(MultiSelect);
|
|
@@ -519,14 +536,14 @@ function MultiSelectGroup({
|
|
|
519
536
|
}
|
|
520
537
|
}
|
|
521
538
|
}, [onChange, selected]);
|
|
522
|
-
return /* @__PURE__ */ (0,
|
|
539
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MultiSelectGroupContext.Provider, { value: {
|
|
523
540
|
name,
|
|
524
541
|
selected: Array.from(new Set(selected)),
|
|
525
542
|
disabled,
|
|
526
543
|
readonly,
|
|
527
544
|
invalid,
|
|
528
545
|
onChange: handleChange
|
|
529
|
-
}, children: /* @__PURE__ */ (0,
|
|
546
|
+
}, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className, "aria-label": label, "data-testid": "SelectGroup", children }) });
|
|
530
547
|
}
|
|
531
548
|
|
|
532
549
|
// src/components/Switch/index.tsx
|
|
@@ -536,7 +553,7 @@ var import_react_stately = require("react-stately");
|
|
|
536
553
|
var import_styled_components7 = __toESM(require("styled-components"));
|
|
537
554
|
var import_utils3 = require("@react-aria/utils");
|
|
538
555
|
var import_styled6 = require("@charcoal-ui/styled");
|
|
539
|
-
var
|
|
556
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
540
557
|
var SwitchCheckbox = (0, import_react7.forwardRef)(function SwitchCheckboxInner(props, external) {
|
|
541
558
|
const {
|
|
542
559
|
disabled,
|
|
@@ -557,9 +574,9 @@ var SwitchCheckbox = (0, import_react7.forwardRef)(function SwitchCheckboxInner(
|
|
|
557
574
|
...rest
|
|
558
575
|
}
|
|
559
576
|
} = (0, import_switch.useSwitch)(ariaSwitchProps, state, ref);
|
|
560
|
-
return /* @__PURE__ */ (0,
|
|
561
|
-
/* @__PURE__ */ (0,
|
|
562
|
-
"children" in props ? /* @__PURE__ */ (0,
|
|
577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Label, { className, "aria-disabled": disabled, children: [
|
|
578
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SwitchInput, { ...rest, ref }),
|
|
579
|
+
"children" in props ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(LabelInner, { children: props.children }) : void 0
|
|
563
580
|
] });
|
|
564
581
|
});
|
|
565
582
|
var Switch_default = (0, import_react7.memo)(SwitchCheckbox);
|
|
@@ -579,14 +596,14 @@ var SwitchInput = import_styled_components7.default.input.attrs({
|
|
|
579
596
|
var import_textfield = require("@react-aria/textfield");
|
|
580
597
|
var import_visually_hidden = require("@react-aria/visually-hidden");
|
|
581
598
|
var import_react9 = require("react");
|
|
582
|
-
var
|
|
599
|
+
var React6 = __toESM(require("react"));
|
|
583
600
|
var import_styled_components9 = __toESM(require("styled-components"));
|
|
584
601
|
|
|
585
602
|
// src/components/FieldLabel/index.tsx
|
|
586
|
-
var
|
|
603
|
+
var React5 = __toESM(require("react"));
|
|
587
604
|
var import_styled_components8 = __toESM(require("styled-components"));
|
|
588
|
-
var
|
|
589
|
-
var FieldLabel =
|
|
605
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
606
|
+
var FieldLabel = React5.forwardRef(function FieldLabel2({
|
|
590
607
|
style,
|
|
591
608
|
className,
|
|
592
609
|
label,
|
|
@@ -595,10 +612,10 @@ var FieldLabel = React4.forwardRef(function FieldLabel2({
|
|
|
595
612
|
subLabel,
|
|
596
613
|
...labelProps
|
|
597
614
|
}, ref) {
|
|
598
|
-
return /* @__PURE__ */ (0,
|
|
599
|
-
/* @__PURE__ */ (0,
|
|
600
|
-
required && /* @__PURE__ */ (0,
|
|
601
|
-
/* @__PURE__ */ (0,
|
|
615
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(FieldLabelWrapper, { style, className, children: [
|
|
616
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Label2, { ref, ...labelProps, children: label }),
|
|
617
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(RequiredText, { children: requiredText }),
|
|
618
|
+
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(SubLabelClickable, { children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: subLabel }) })
|
|
602
619
|
] });
|
|
603
620
|
});
|
|
604
621
|
var FieldLabel_default = FieldLabel;
|
|
@@ -636,8 +653,8 @@ function useFocusWithClick(containerRef, inputRef) {
|
|
|
636
653
|
|
|
637
654
|
// src/components/TextField/index.tsx
|
|
638
655
|
var import_utils4 = require("@react-aria/utils");
|
|
639
|
-
var
|
|
640
|
-
var TextField =
|
|
656
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
657
|
+
var TextField = React6.forwardRef(function SingleLineTextFieldInner({
|
|
641
658
|
onChange,
|
|
642
659
|
...props
|
|
643
660
|
}, forwardRef18) {
|
|
@@ -651,6 +668,7 @@ var TextField = React5.forwardRef(function SingleLineTextFieldInner({
|
|
|
651
668
|
disabled = false,
|
|
652
669
|
required,
|
|
653
670
|
invalid = false,
|
|
671
|
+
readOnly = false,
|
|
654
672
|
assistiveText,
|
|
655
673
|
maxLength,
|
|
656
674
|
prefix = null,
|
|
@@ -685,6 +703,7 @@ var TextField = React5.forwardRef(function SingleLineTextFieldInner({
|
|
|
685
703
|
inputElementType: "input",
|
|
686
704
|
isDisabled: disabled,
|
|
687
705
|
isRequired: required,
|
|
706
|
+
isReadOnly: readOnly,
|
|
688
707
|
validationState: invalid ? "invalid" : "valid",
|
|
689
708
|
description: !invalid && assistiveText,
|
|
690
709
|
errorMessage: invalid && assistiveText,
|
|
@@ -694,17 +713,17 @@ var TextField = React5.forwardRef(function SingleLineTextFieldInner({
|
|
|
694
713
|
const containerRef = (0, import_react9.useRef)(null);
|
|
695
714
|
useFocusWithClick(containerRef, ariaRef);
|
|
696
715
|
const inputProps = (0, import_utils4.mergeProps)(restProps, ariaInputProps);
|
|
697
|
-
return /* @__PURE__ */ (0,
|
|
698
|
-
/* @__PURE__ */ (0,
|
|
699
|
-
/* @__PURE__ */ (0,
|
|
700
|
-
prefix && /* @__PURE__ */ (0,
|
|
701
|
-
/* @__PURE__ */ (0,
|
|
702
|
-
(suffix || showCount) && /* @__PURE__ */ (0,
|
|
716
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(TextFieldRoot, { className, isDisabled: disabled, children: [
|
|
717
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(TextFieldLabel, { label, requiredText, required, subLabel, ...labelProps, ...!showLabel ? visuallyHiddenProps : {} }),
|
|
718
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(StyledInputContainer, { ref: containerRef, invalid, "aria-disabled": disabled === true ? true : void 0, hasPrefix: prefix != null, hasSuffix: suffix != null || showCount, children: [
|
|
719
|
+
prefix && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(PrefixContainer, { children: prefix }),
|
|
720
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(StyledInput, { ref: mergeRefs(forwardRef18, ariaRef), invalid, ...inputProps }),
|
|
721
|
+
(suffix || showCount) && /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(SuffixContainer, { children: [
|
|
703
722
|
suffix,
|
|
704
|
-
showCount && /* @__PURE__ */ (0,
|
|
723
|
+
showCount && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SingleLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
|
|
705
724
|
] })
|
|
706
725
|
] }),
|
|
707
|
-
assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ (0,
|
|
726
|
+
assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(AssistiveText, { invalid, ...invalid ? errorMessageProps : descriptionProps, children: assistiveText })
|
|
708
727
|
] });
|
|
709
728
|
});
|
|
710
729
|
var TextField_default = TextField;
|
|
@@ -741,7 +760,7 @@ var import_visually_hidden2 = require("@react-aria/visually-hidden");
|
|
|
741
760
|
var import_react10 = require("react");
|
|
742
761
|
var import_styled_components10 = __toESM(require("styled-components"));
|
|
743
762
|
var import_utils5 = require("@react-aria/utils");
|
|
744
|
-
var
|
|
763
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
745
764
|
var TextArea = (0, import_react10.forwardRef)(function TextAreaInner({
|
|
746
765
|
onChange,
|
|
747
766
|
...props
|
|
@@ -756,6 +775,7 @@ var TextArea = (0, import_react10.forwardRef)(function TextAreaInner({
|
|
|
756
775
|
disabled = false,
|
|
757
776
|
required,
|
|
758
777
|
invalid = false,
|
|
778
|
+
readOnly = false,
|
|
759
779
|
assistiveText,
|
|
760
780
|
maxLength,
|
|
761
781
|
autoHeight = false,
|
|
@@ -800,6 +820,7 @@ var TextArea = (0, import_react10.forwardRef)(function TextAreaInner({
|
|
|
800
820
|
inputElementType: "textarea",
|
|
801
821
|
isDisabled: disabled,
|
|
802
822
|
isRequired: required,
|
|
823
|
+
isReadOnly: readOnly,
|
|
803
824
|
validationState: invalid ? "invalid" : "valid",
|
|
804
825
|
description: !invalid && assistiveText,
|
|
805
826
|
errorMessage: invalid && assistiveText,
|
|
@@ -814,13 +835,13 @@ var TextArea = (0, import_react10.forwardRef)(function TextAreaInner({
|
|
|
814
835
|
const containerRef = (0, import_react10.useRef)(null);
|
|
815
836
|
useFocusWithClick(containerRef, ariaRef);
|
|
816
837
|
const inputProps = (0, import_utils5.mergeProps)(restProps, ariaInputProps);
|
|
817
|
-
return /* @__PURE__ */ (0,
|
|
818
|
-
/* @__PURE__ */ (0,
|
|
819
|
-
/* @__PURE__ */ (0,
|
|
820
|
-
/* @__PURE__ */ (0,
|
|
821
|
-
showCount && /* @__PURE__ */ (0,
|
|
838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(TextFieldRoot2, { className, isDisabled: disabled, children: [
|
|
839
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TextFieldLabel, { label, requiredText, required, subLabel, ...labelProps, ...!showLabel ? visuallyHiddenProps : {} }),
|
|
840
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(StyledTextareaContainer, { ref: containerRef, invalid, rows: showCount ? rows + 1 : rows, "aria-disabled": disabled === true ? "true" : void 0, children: [
|
|
841
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(StyledTextarea, { ref: mergeRefs(textareaRef, forwardRef18, ariaRef), rows, noBottomPadding: showCount, ...inputProps }),
|
|
842
|
+
showCount && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(MultiLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
|
|
822
843
|
] }),
|
|
823
|
-
assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ (0,
|
|
844
|
+
assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(AssistiveText, { invalid, ...invalid ? errorMessageProps : descriptionProps, children: assistiveText })
|
|
824
845
|
] });
|
|
825
846
|
});
|
|
826
847
|
var TextArea_default = TextArea;
|
|
@@ -844,23 +865,8 @@ var MultiLineCounter = import_styled_components10.default.span.withConfig({
|
|
|
844
865
|
componentId: "ccl__sc-58waht-3"
|
|
845
866
|
})(["position:absolute;bottom:9px;right:8px;line-height:22px;font-size:14px;color:var(--charcoal-text3);"]);
|
|
846
867
|
|
|
847
|
-
// src/components/Icon/index.tsx
|
|
848
|
-
var React6 = __toESM(require("react"));
|
|
849
|
-
var import_icons = require("@charcoal-ui/icons");
|
|
850
|
-
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
851
|
-
var Icon = React6.forwardRef(function IconInner({
|
|
852
|
-
name,
|
|
853
|
-
scale,
|
|
854
|
-
unsafeNonGuidelineScale,
|
|
855
|
-
className,
|
|
856
|
-
...rest
|
|
857
|
-
}, ref) {
|
|
858
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("pixiv-icon", { ref, name, scale, "unsafe-non-guideline-scale": unsafeNonGuidelineScale, class: className, ...rest });
|
|
859
|
-
});
|
|
860
|
-
var Icon_default = Icon;
|
|
861
|
-
|
|
862
868
|
// src/components/Modal/index.tsx
|
|
863
|
-
var
|
|
869
|
+
var import_react13 = require("react");
|
|
864
870
|
var React10 = __toESM(require("react"));
|
|
865
871
|
var import_overlays3 = require("@react-aria/overlays");
|
|
866
872
|
var import_styled_components12 = __toESM(require("styled-components"));
|
|
@@ -873,15 +879,7 @@ var import_utils8 = require("@react-aria/utils");
|
|
|
873
879
|
var import_react11 = require("react");
|
|
874
880
|
var import_styled_components11 = __toESM(require("styled-components"));
|
|
875
881
|
var import_dialog = require("@react-aria/dialog");
|
|
876
|
-
|
|
877
|
-
// ../foundation/src/grid.ts
|
|
878
|
-
var COLUMN_UNIT = 80;
|
|
879
|
-
var GUTTER_UNIT = 24;
|
|
880
|
-
function columnSystem(span, column, gutter) {
|
|
881
|
-
return span * column + (span - 1) * gutter;
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
// src/components/Modal/Dialog/index.tsx
|
|
882
|
+
var import_foundation = require("@charcoal-ui/foundation");
|
|
885
883
|
var import_utils6 = require("@charcoal-ui/utils");
|
|
886
884
|
var import_react_spring = require("react-spring");
|
|
887
885
|
|
|
@@ -917,13 +915,13 @@ var AnimatedStyledDialogDiv = (0, import_react_spring.animated)(import_styled_co
|
|
|
917
915
|
})(["margin:auto;position:relative;height:fit-content;width:", "px;background-color:var(--charcoal-surface1);border-radius:24px;@media ", "{max-width:440px;width:calc(100% - 48px);", "}:focus{outline:none;}"], (p) => {
|
|
918
916
|
switch (p.size) {
|
|
919
917
|
case "S": {
|
|
920
|
-
return columnSystem(3, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2;
|
|
918
|
+
return (0, import_foundation.columnSystem)(3, import_foundation.COLUMN_UNIT, import_foundation.GUTTER_UNIT) + import_foundation.GUTTER_UNIT * 2;
|
|
921
919
|
}
|
|
922
920
|
case "M": {
|
|
923
|
-
return columnSystem(4, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2;
|
|
921
|
+
return (0, import_foundation.columnSystem)(4, import_foundation.COLUMN_UNIT, import_foundation.GUTTER_UNIT) + import_foundation.GUTTER_UNIT * 2;
|
|
924
922
|
}
|
|
925
923
|
case "L": {
|
|
926
|
-
return columnSystem(6, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2;
|
|
924
|
+
return (0, import_foundation.columnSystem)(6, import_foundation.COLUMN_UNIT, import_foundation.GUTTER_UNIT) + import_foundation.GUTTER_UNIT * 2;
|
|
927
925
|
}
|
|
928
926
|
default: {
|
|
929
927
|
return unreachable(p.size);
|
|
@@ -940,6 +938,25 @@ var ModalBackgroundContext = React8.createContext(null);
|
|
|
940
938
|
// src/components/Modal/useCustomModalOverlay.tsx
|
|
941
939
|
var React9 = __toESM(require("react"));
|
|
942
940
|
var import_overlays2 = require("@react-aria/overlays");
|
|
941
|
+
|
|
942
|
+
// src/components/DropdownSelector/Popover/usePreventScroll.tsx
|
|
943
|
+
var import_react12 = require("react");
|
|
944
|
+
function usePreventScroll(element, isOpen) {
|
|
945
|
+
(0, import_react12.useEffect)(() => {
|
|
946
|
+
if (isOpen && element) {
|
|
947
|
+
const defaultPaddingRight = element.style.paddingRight;
|
|
948
|
+
const defaultOverflow = element.style.overflow;
|
|
949
|
+
element.style.paddingRight = `${window.innerWidth - element.clientWidth}px`;
|
|
950
|
+
element.style.overflow = "hidden";
|
|
951
|
+
return () => {
|
|
952
|
+
element.style.paddingRight = defaultPaddingRight;
|
|
953
|
+
element.style.overflow = defaultOverflow;
|
|
954
|
+
};
|
|
955
|
+
}
|
|
956
|
+
}, [element, isOpen]);
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
// src/components/Modal/useCustomModalOverlay.tsx
|
|
943
960
|
function useCharcoalModalOverlay(props, state, ref) {
|
|
944
961
|
const {
|
|
945
962
|
overlayProps,
|
|
@@ -950,9 +967,7 @@ function useCharcoalModalOverlay(props, state, ref) {
|
|
|
950
967
|
onClose: state.onClose,
|
|
951
968
|
shouldCloseOnInteractOutside: () => false
|
|
952
969
|
}, ref);
|
|
953
|
-
(
|
|
954
|
-
isDisabled: !state.isOpen
|
|
955
|
-
});
|
|
970
|
+
usePreventScroll(typeof document !== "undefined" ? document.body : null, state.isOpen);
|
|
956
971
|
(0, import_overlays2.useOverlayFocusContain)();
|
|
957
972
|
React9.useEffect(() => {
|
|
958
973
|
if (state.isOpen && ref.current) {
|
|
@@ -968,7 +983,7 @@ function useCharcoalModalOverlay(props, state, ref) {
|
|
|
968
983
|
// src/components/Modal/index.tsx
|
|
969
984
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
970
985
|
var DEFAULT_Z_INDEX = 10;
|
|
971
|
-
var Modal = (0,
|
|
986
|
+
var Modal = (0, import_react13.forwardRef)(function ModalInner({
|
|
972
987
|
children,
|
|
973
988
|
zIndex = DEFAULT_Z_INDEX,
|
|
974
989
|
portalContainer,
|
|
@@ -1049,7 +1064,7 @@ var Modal = (0, import_react12.forwardRef)(function ModalInner({
|
|
|
1049
1064
|
isDismissable === true && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ModalCrossButton, { size: "S", icon: "24/Close", onClick: onClose })
|
|
1050
1065
|
] }) }) }) }) }));
|
|
1051
1066
|
});
|
|
1052
|
-
var Modal_default = (0,
|
|
1067
|
+
var Modal_default = (0, import_react13.memo)(Modal);
|
|
1053
1068
|
var ModalContext = React10.createContext({
|
|
1054
1069
|
titleProps: {},
|
|
1055
1070
|
title: "",
|
|
@@ -1071,7 +1086,7 @@ function ModalTitle(props) {
|
|
|
1071
1086
|
const {
|
|
1072
1087
|
titleProps,
|
|
1073
1088
|
title
|
|
1074
|
-
} = (0,
|
|
1089
|
+
} = (0, import_react13.useContext)(ModalContext);
|
|
1075
1090
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ModalHeading, { ...titleProps, ...props, children: title });
|
|
1076
1091
|
}
|
|
1077
1092
|
var ModalHeading = import_styled_components12.default.h3.withConfig({
|
|
@@ -1080,11 +1095,11 @@ var ModalHeading = import_styled_components12.default.h3.withConfig({
|
|
|
1080
1095
|
|
|
1081
1096
|
// src/components/Modal/ModalPlumbing.tsx
|
|
1082
1097
|
var import_styled_components13 = __toESM(require("styled-components"));
|
|
1083
|
-
var
|
|
1098
|
+
var import_react14 = require("react");
|
|
1084
1099
|
var import_utils9 = require("@charcoal-ui/utils");
|
|
1085
1100
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1086
1101
|
function ModalHeader() {
|
|
1087
|
-
const modalCtx = (0,
|
|
1102
|
+
const modalCtx = (0, import_react14.useContext)(ModalContext);
|
|
1088
1103
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ModalHeaderRoot, { $bottomSheet: modalCtx.bottomSheet, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(StyledModalTitle, {}) });
|
|
1089
1104
|
}
|
|
1090
1105
|
var ModalHeaderRoot = import_styled_components13.default.div.withConfig({
|
|
@@ -1106,10 +1121,10 @@ var ModalButtons = import_styled_components13.default.div.withConfig({
|
|
|
1106
1121
|
})(["display:grid;grid-auto-flow:row;grid-row-gap:8px;padding-top:16px;padding-left:16px;padding-right:16px;"]);
|
|
1107
1122
|
|
|
1108
1123
|
// src/components/LoadingSpinner/index.tsx
|
|
1109
|
-
var
|
|
1124
|
+
var import_react15 = require("react");
|
|
1110
1125
|
var import_styled_components14 = __toESM(require("styled-components"));
|
|
1111
1126
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1112
|
-
var LoadingSpinner = (0,
|
|
1127
|
+
var LoadingSpinner = (0, import_react15.forwardRef)(function LoadingSpinnerInner({
|
|
1113
1128
|
size = 48,
|
|
1114
1129
|
padding = 16,
|
|
1115
1130
|
transparent = false,
|
|
@@ -1117,7 +1132,7 @@ var LoadingSpinner = (0, import_react14.forwardRef)(function LoadingSpinnerInner
|
|
|
1117
1132
|
}, ref) {
|
|
1118
1133
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LoadingSpinnerRoot, { size, padding, transparent, className, ref, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LoadingSpinnerIcon, {}) });
|
|
1119
1134
|
});
|
|
1120
|
-
var LoadingSpinner_default = (0,
|
|
1135
|
+
var LoadingSpinner_default = (0, import_react15.memo)(LoadingSpinner);
|
|
1121
1136
|
var LoadingSpinnerRoot = import_styled_components14.default.div.attrs({
|
|
1122
1137
|
role: "progressbar"
|
|
1123
1138
|
}).withConfig({
|
|
@@ -1131,11 +1146,11 @@ var Icon2 = import_styled_components14.default.div.attrs({
|
|
|
1131
1146
|
}).withConfig({
|
|
1132
1147
|
componentId: "ccl__sc-1id6yz4-1"
|
|
1133
1148
|
})(["width:1em;height:1em;border-radius:1em;background-color:currentColor;animation:", " 1s both ease-out;animation-iteration-count:", ";&[data-reset-animation]{animation:none;}"], scaleOut, (p) => p.once ? 1 : "infinite");
|
|
1134
|
-
var LoadingSpinnerIcon = (0,
|
|
1149
|
+
var LoadingSpinnerIcon = (0, import_react15.forwardRef)(function LoadingSpinnerIcon2({
|
|
1135
1150
|
once = false
|
|
1136
1151
|
}, ref) {
|
|
1137
|
-
const iconRef = (0,
|
|
1138
|
-
(0,
|
|
1152
|
+
const iconRef = (0, import_react15.useRef)(null);
|
|
1153
|
+
(0, import_react15.useImperativeHandle)(ref, () => ({
|
|
1139
1154
|
restart: () => {
|
|
1140
1155
|
if (!iconRef.current) {
|
|
1141
1156
|
return;
|
|
@@ -1160,25 +1175,6 @@ var import_react17 = require("react");
|
|
|
1160
1175
|
var import_react16 = require("react");
|
|
1161
1176
|
var import_overlays4 = require("@react-aria/overlays");
|
|
1162
1177
|
var import_styled_components15 = __toESM(require("styled-components"));
|
|
1163
|
-
|
|
1164
|
-
// src/components/DropdownSelector/Popover/usePreventScroll.tsx
|
|
1165
|
-
var import_react15 = require("react");
|
|
1166
|
-
function usePreventScroll2(element, isOpen) {
|
|
1167
|
-
(0, import_react15.useEffect)(() => {
|
|
1168
|
-
if (isOpen && element) {
|
|
1169
|
-
const defaultPaddingRight = element.style.paddingRight;
|
|
1170
|
-
const defaultOverflow = element.style.overflow;
|
|
1171
|
-
element.style.paddingRight = `${window.innerWidth - element.clientWidth}px`;
|
|
1172
|
-
element.style.overflow = "hidden";
|
|
1173
|
-
return () => {
|
|
1174
|
-
element.style.paddingRight = defaultPaddingRight;
|
|
1175
|
-
element.style.overflow = defaultOverflow;
|
|
1176
|
-
};
|
|
1177
|
-
}
|
|
1178
|
-
}, [element, isOpen]);
|
|
1179
|
-
}
|
|
1180
|
-
|
|
1181
|
-
// src/components/DropdownSelector/Popover/index.tsx
|
|
1182
1178
|
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1183
1179
|
var _empty = () => null;
|
|
1184
1180
|
function Popover(props) {
|
|
@@ -1199,7 +1195,7 @@ function Popover(props) {
|
|
|
1199
1195
|
toggle: _empty
|
|
1200
1196
|
});
|
|
1201
1197
|
const modalBackground = (0, import_react16.useContext)(ModalBackgroundContext);
|
|
1202
|
-
|
|
1198
|
+
usePreventScroll(modalBackground, props.isOpen);
|
|
1203
1199
|
if (!props.isOpen)
|
|
1204
1200
|
return null;
|
|
1205
1201
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_overlays4.Overlay, { portalContainer: document.body, children: [
|
|
@@ -1542,240 +1538,15 @@ var StyledLi2 = import_styled_components20.default.li.withConfig({
|
|
|
1542
1538
|
})(["display:block;"]);
|
|
1543
1539
|
|
|
1544
1540
|
// src/components/SegmentedControl/index.tsx
|
|
1545
|
-
var import_react27 = require("react");
|
|
1546
|
-
|
|
1547
|
-
// ../../node_modules/@react-stately/form/dist/import.mjs
|
|
1548
|
-
var import_react23 = require("react");
|
|
1549
|
-
var $e5be200c675c3b3a$export$aca958c65c314e6c = {
|
|
1550
|
-
badInput: false,
|
|
1551
|
-
customError: false,
|
|
1552
|
-
patternMismatch: false,
|
|
1553
|
-
rangeOverflow: false,
|
|
1554
|
-
rangeUnderflow: false,
|
|
1555
|
-
stepMismatch: false,
|
|
1556
|
-
tooLong: false,
|
|
1557
|
-
tooShort: false,
|
|
1558
|
-
typeMismatch: false,
|
|
1559
|
-
valueMissing: false,
|
|
1560
|
-
valid: true
|
|
1561
|
-
};
|
|
1562
|
-
var $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE = {
|
|
1563
|
-
...$e5be200c675c3b3a$export$aca958c65c314e6c,
|
|
1564
|
-
customError: true,
|
|
1565
|
-
valid: false
|
|
1566
|
-
};
|
|
1567
|
-
var $e5be200c675c3b3a$export$dad6ae84456c676a = {
|
|
1568
|
-
isInvalid: false,
|
|
1569
|
-
validationDetails: $e5be200c675c3b3a$export$aca958c65c314e6c,
|
|
1570
|
-
validationErrors: []
|
|
1571
|
-
};
|
|
1572
|
-
var $e5be200c675c3b3a$export$571b5131b7e65c11 = (0, import_react23.createContext)({});
|
|
1573
|
-
var $e5be200c675c3b3a$export$a763b9476acd3eb = "__formValidationState" + Date.now();
|
|
1574
|
-
function $e5be200c675c3b3a$export$fc1a364ae1f3ff10(props) {
|
|
1575
|
-
if (props[$e5be200c675c3b3a$export$a763b9476acd3eb]) {
|
|
1576
|
-
let {
|
|
1577
|
-
realtimeValidation,
|
|
1578
|
-
displayValidation,
|
|
1579
|
-
updateValidation,
|
|
1580
|
-
resetValidation,
|
|
1581
|
-
commitValidation
|
|
1582
|
-
} = props[$e5be200c675c3b3a$export$a763b9476acd3eb];
|
|
1583
|
-
return {
|
|
1584
|
-
realtimeValidation,
|
|
1585
|
-
displayValidation,
|
|
1586
|
-
updateValidation,
|
|
1587
|
-
resetValidation,
|
|
1588
|
-
commitValidation
|
|
1589
|
-
};
|
|
1590
|
-
}
|
|
1591
|
-
return $e5be200c675c3b3a$var$useFormValidationStateImpl(props);
|
|
1592
|
-
}
|
|
1593
|
-
function $e5be200c675c3b3a$var$useFormValidationStateImpl(props) {
|
|
1594
|
-
let {
|
|
1595
|
-
isInvalid,
|
|
1596
|
-
validationState,
|
|
1597
|
-
name,
|
|
1598
|
-
value,
|
|
1599
|
-
builtinValidation,
|
|
1600
|
-
validate,
|
|
1601
|
-
validationBehavior = "aria"
|
|
1602
|
-
} = props;
|
|
1603
|
-
if (validationState)
|
|
1604
|
-
isInvalid || (isInvalid = validationState === "invalid");
|
|
1605
|
-
let controlledError = isInvalid ? {
|
|
1606
|
-
isInvalid: true,
|
|
1607
|
-
validationErrors: [],
|
|
1608
|
-
validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE
|
|
1609
|
-
} : null;
|
|
1610
|
-
let clientError = (0, import_react23.useMemo)(() => $e5be200c675c3b3a$var$getValidationResult($e5be200c675c3b3a$var$runValidate(validate, value)), [validate, value]);
|
|
1611
|
-
if (builtinValidation === null || builtinValidation === void 0 ? void 0 : builtinValidation.validationDetails.valid)
|
|
1612
|
-
builtinValidation = null;
|
|
1613
|
-
let serverErrors = (0, import_react23.useContext)($e5be200c675c3b3a$export$571b5131b7e65c11);
|
|
1614
|
-
let serverErrorMessages = (0, import_react23.useMemo)(() => {
|
|
1615
|
-
if (name)
|
|
1616
|
-
return Array.isArray(name) ? name.flatMap((name2) => $e5be200c675c3b3a$var$asArray(serverErrors[name2])) : $e5be200c675c3b3a$var$asArray(serverErrors[name]);
|
|
1617
|
-
return [];
|
|
1618
|
-
}, [serverErrors, name]);
|
|
1619
|
-
let [lastServerErrors, setLastServerErrors] = (0, import_react23.useState)(serverErrors);
|
|
1620
|
-
let [isServerErrorCleared, setServerErrorCleared] = (0, import_react23.useState)(false);
|
|
1621
|
-
if (serverErrors !== lastServerErrors) {
|
|
1622
|
-
setLastServerErrors(serverErrors);
|
|
1623
|
-
setServerErrorCleared(false);
|
|
1624
|
-
}
|
|
1625
|
-
let serverError = (0, import_react23.useMemo)(() => $e5be200c675c3b3a$var$getValidationResult(isServerErrorCleared ? [] : serverErrorMessages), [isServerErrorCleared, serverErrorMessages]);
|
|
1626
|
-
let nextValidation = (0, import_react23.useRef)($e5be200c675c3b3a$export$dad6ae84456c676a);
|
|
1627
|
-
let [currentValidity, setCurrentValidity] = (0, import_react23.useState)($e5be200c675c3b3a$export$dad6ae84456c676a);
|
|
1628
|
-
let lastError = (0, import_react23.useRef)($e5be200c675c3b3a$export$dad6ae84456c676a);
|
|
1629
|
-
let commitValidation = () => {
|
|
1630
|
-
if (!commitQueued)
|
|
1631
|
-
return;
|
|
1632
|
-
setCommitQueued(false);
|
|
1633
|
-
let error = clientError || builtinValidation || nextValidation.current;
|
|
1634
|
-
if (!$e5be200c675c3b3a$var$isEqualValidation(error, lastError.current)) {
|
|
1635
|
-
lastError.current = error;
|
|
1636
|
-
setCurrentValidity(error);
|
|
1637
|
-
}
|
|
1638
|
-
};
|
|
1639
|
-
let [commitQueued, setCommitQueued] = (0, import_react23.useState)(false);
|
|
1640
|
-
(0, import_react23.useEffect)(commitValidation);
|
|
1641
|
-
let realtimeValidation = controlledError || serverError || clientError || builtinValidation || $e5be200c675c3b3a$export$dad6ae84456c676a;
|
|
1642
|
-
let displayValidation = validationBehavior === "native" ? controlledError || serverError || currentValidity : controlledError || serverError || clientError || builtinValidation || currentValidity;
|
|
1643
|
-
return {
|
|
1644
|
-
realtimeValidation,
|
|
1645
|
-
displayValidation,
|
|
1646
|
-
updateValidation(value2) {
|
|
1647
|
-
if (validationBehavior === "aria" && !$e5be200c675c3b3a$var$isEqualValidation(currentValidity, value2))
|
|
1648
|
-
setCurrentValidity(value2);
|
|
1649
|
-
else
|
|
1650
|
-
nextValidation.current = value2;
|
|
1651
|
-
},
|
|
1652
|
-
resetValidation() {
|
|
1653
|
-
let error = $e5be200c675c3b3a$export$dad6ae84456c676a;
|
|
1654
|
-
if (!$e5be200c675c3b3a$var$isEqualValidation(error, lastError.current)) {
|
|
1655
|
-
lastError.current = error;
|
|
1656
|
-
setCurrentValidity(error);
|
|
1657
|
-
}
|
|
1658
|
-
if (validationBehavior === "native")
|
|
1659
|
-
setCommitQueued(false);
|
|
1660
|
-
setServerErrorCleared(true);
|
|
1661
|
-
},
|
|
1662
|
-
commitValidation() {
|
|
1663
|
-
if (validationBehavior === "native")
|
|
1664
|
-
setCommitQueued(true);
|
|
1665
|
-
setServerErrorCleared(true);
|
|
1666
|
-
}
|
|
1667
|
-
};
|
|
1668
|
-
}
|
|
1669
|
-
function $e5be200c675c3b3a$var$asArray(v) {
|
|
1670
|
-
if (!v)
|
|
1671
|
-
return [];
|
|
1672
|
-
return Array.isArray(v) ? v : [v];
|
|
1673
|
-
}
|
|
1674
|
-
function $e5be200c675c3b3a$var$runValidate(validate, value) {
|
|
1675
|
-
if (typeof validate === "function") {
|
|
1676
|
-
let e = validate(value);
|
|
1677
|
-
if (e && typeof e !== "boolean")
|
|
1678
|
-
return $e5be200c675c3b3a$var$asArray(e);
|
|
1679
|
-
}
|
|
1680
|
-
return [];
|
|
1681
|
-
}
|
|
1682
|
-
function $e5be200c675c3b3a$var$getValidationResult(errors) {
|
|
1683
|
-
return errors.length ? {
|
|
1684
|
-
isInvalid: true,
|
|
1685
|
-
validationErrors: errors,
|
|
1686
|
-
validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE
|
|
1687
|
-
} : null;
|
|
1688
|
-
}
|
|
1689
|
-
function $e5be200c675c3b3a$var$isEqualValidation(a, b) {
|
|
1690
|
-
if (a === b)
|
|
1691
|
-
return true;
|
|
1692
|
-
return a && b && a.isInvalid === b.isInvalid && a.validationErrors.length === b.validationErrors.length && a.validationErrors.every((a2, i) => a2 === b.validationErrors[i]) && Object.entries(a.validationDetails).every(([k, v]) => b.validationDetails[k] === v);
|
|
1693
|
-
}
|
|
1694
|
-
|
|
1695
|
-
// ../../node_modules/@react-stately/utils/dist/import.mjs
|
|
1696
1541
|
var import_react24 = require("react");
|
|
1697
|
-
|
|
1698
|
-
let [stateValue, setStateValue] = (0, import_react24.useState)(value || defaultValue);
|
|
1699
|
-
let isControlledRef = (0, import_react24.useRef)(value !== void 0);
|
|
1700
|
-
let isControlled = value !== void 0;
|
|
1701
|
-
(0, import_react24.useEffect)(() => {
|
|
1702
|
-
let wasControlled = isControlledRef.current;
|
|
1703
|
-
if (wasControlled !== isControlled)
|
|
1704
|
-
console.warn(`WARN: A component changed from ${wasControlled ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}.`);
|
|
1705
|
-
isControlledRef.current = isControlled;
|
|
1706
|
-
}, [isControlled]);
|
|
1707
|
-
let currentValue = isControlled ? value : stateValue;
|
|
1708
|
-
let setValue = (0, import_react24.useCallback)((value2, ...args) => {
|
|
1709
|
-
let onChangeCaller = (value3, ...onChangeArgs) => {
|
|
1710
|
-
if (onChange) {
|
|
1711
|
-
if (!Object.is(currentValue, value3))
|
|
1712
|
-
onChange(value3, ...onChangeArgs);
|
|
1713
|
-
}
|
|
1714
|
-
if (!isControlled)
|
|
1715
|
-
currentValue = value3;
|
|
1716
|
-
};
|
|
1717
|
-
if (typeof value2 === "function") {
|
|
1718
|
-
console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320");
|
|
1719
|
-
let updateFunction = (oldValue, ...functionArgs) => {
|
|
1720
|
-
let interceptedValue = value2(isControlled ? currentValue : oldValue, ...functionArgs);
|
|
1721
|
-
onChangeCaller(interceptedValue, ...args);
|
|
1722
|
-
if (!isControlled)
|
|
1723
|
-
return interceptedValue;
|
|
1724
|
-
return oldValue;
|
|
1725
|
-
};
|
|
1726
|
-
setStateValue(updateFunction);
|
|
1727
|
-
} else {
|
|
1728
|
-
if (!isControlled)
|
|
1729
|
-
setStateValue(value2);
|
|
1730
|
-
onChangeCaller(value2, ...args);
|
|
1731
|
-
}
|
|
1732
|
-
}, [isControlled, currentValue, onChange]);
|
|
1733
|
-
return [currentValue, setValue];
|
|
1734
|
-
}
|
|
1735
|
-
|
|
1736
|
-
// ../../node_modules/@react-stately/radio/dist/import.mjs
|
|
1737
|
-
var import_react25 = require("react");
|
|
1738
|
-
var $a54cdc5c1942b639$var$instance = Math.round(Math.random() * 1e10);
|
|
1739
|
-
var $a54cdc5c1942b639$var$i = 0;
|
|
1740
|
-
function $a54cdc5c1942b639$export$bca9d026f8e704eb(props) {
|
|
1741
|
-
let name = (0, import_react25.useMemo)(() => props.name || `radio-group-${$a54cdc5c1942b639$var$instance}-${++$a54cdc5c1942b639$var$i}`, [props.name]);
|
|
1742
|
-
var _props_defaultValue;
|
|
1743
|
-
let [selectedValue, setSelected] = (0, $458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : null, props.onChange);
|
|
1744
|
-
let [lastFocusedValue, setLastFocusedValue] = (0, import_react25.useState)(null);
|
|
1745
|
-
let validation = (0, $e5be200c675c3b3a$export$fc1a364ae1f3ff10)({
|
|
1746
|
-
...props,
|
|
1747
|
-
value: selectedValue
|
|
1748
|
-
});
|
|
1749
|
-
let setSelectedValue = (value) => {
|
|
1750
|
-
if (!props.isReadOnly && !props.isDisabled) {
|
|
1751
|
-
setSelected(value);
|
|
1752
|
-
validation.commitValidation();
|
|
1753
|
-
}
|
|
1754
|
-
};
|
|
1755
|
-
let isInvalid = validation.displayValidation.isInvalid;
|
|
1756
|
-
return {
|
|
1757
|
-
...validation,
|
|
1758
|
-
name,
|
|
1759
|
-
selectedValue,
|
|
1760
|
-
setSelectedValue,
|
|
1761
|
-
lastFocusedValue,
|
|
1762
|
-
setLastFocusedValue,
|
|
1763
|
-
isDisabled: props.isDisabled || false,
|
|
1764
|
-
isReadOnly: props.isReadOnly || false,
|
|
1765
|
-
isRequired: props.isRequired || false,
|
|
1766
|
-
validationState: props.validationState || (isInvalid ? "invalid" : null),
|
|
1767
|
-
isInvalid
|
|
1768
|
-
};
|
|
1769
|
-
}
|
|
1770
|
-
|
|
1771
|
-
// src/components/SegmentedControl/index.tsx
|
|
1542
|
+
var import_radio = require("@react-stately/radio");
|
|
1772
1543
|
var import_radio2 = require("@react-aria/radio");
|
|
1773
1544
|
var import_styled_components21 = __toESM(require("styled-components"));
|
|
1774
1545
|
|
|
1775
1546
|
// src/components/SegmentedControl/RadioGroupContext.tsx
|
|
1776
|
-
var
|
|
1547
|
+
var import_react23 = require("react");
|
|
1777
1548
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1778
|
-
var RadioContext = (0,
|
|
1549
|
+
var RadioContext = (0, import_react23.createContext)(null);
|
|
1779
1550
|
var RadioProvider = ({
|
|
1780
1551
|
value,
|
|
1781
1552
|
children
|
|
@@ -1783,7 +1554,7 @@ var RadioProvider = ({
|
|
|
1783
1554
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(RadioContext.Provider, { value, children });
|
|
1784
1555
|
};
|
|
1785
1556
|
var useRadioContext = () => {
|
|
1786
|
-
const state = (0,
|
|
1557
|
+
const state = (0, import_react23.useContext)(RadioContext);
|
|
1787
1558
|
if (state === null)
|
|
1788
1559
|
throw new Error("`<RadioProvider>` is not likely mounted.");
|
|
1789
1560
|
return state;
|
|
@@ -1791,19 +1562,19 @@ var useRadioContext = () => {
|
|
|
1791
1562
|
|
|
1792
1563
|
// src/components/SegmentedControl/index.tsx
|
|
1793
1564
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1794
|
-
var SegmentedControl = (0,
|
|
1795
|
-
const ariaRadioGroupProps = (0,
|
|
1565
|
+
var SegmentedControl = (0, import_react24.forwardRef)(function SegmentedControlInner(props, ref) {
|
|
1566
|
+
const ariaRadioGroupProps = (0, import_react24.useMemo)(() => ({
|
|
1796
1567
|
...props,
|
|
1797
1568
|
isDisabled: props.disabled,
|
|
1798
1569
|
isReadOnly: props.readonly,
|
|
1799
1570
|
isRequired: props.required,
|
|
1800
1571
|
"aria-label": props.name
|
|
1801
1572
|
}), [props]);
|
|
1802
|
-
const state =
|
|
1573
|
+
const state = (0, import_radio.useRadioGroupState)(ariaRadioGroupProps);
|
|
1803
1574
|
const {
|
|
1804
1575
|
radioGroupProps
|
|
1805
1576
|
} = (0, import_radio2.useRadioGroup)(ariaRadioGroupProps, state);
|
|
1806
|
-
const segmentedControlItems = (0,
|
|
1577
|
+
const segmentedControlItems = (0, import_react24.useMemo)(() => {
|
|
1807
1578
|
return props.data.map((d) => typeof d === "string" ? {
|
|
1808
1579
|
value: d,
|
|
1809
1580
|
label: d
|
|
@@ -1811,11 +1582,11 @@ var SegmentedControl = (0, import_react27.forwardRef)(function SegmentedControlI
|
|
|
1811
1582
|
}, [props.data]);
|
|
1812
1583
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SegmentedControlRoot, { ref, ...radioGroupProps, className: props.className, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(RadioProvider, { value: state, children: segmentedControlItems.map((item) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Segmented, { value: item.value, disabled: item.disabled, children: item.label }, item.value)) }) });
|
|
1813
1584
|
});
|
|
1814
|
-
var SegmentedControl_default = (0,
|
|
1585
|
+
var SegmentedControl_default = (0, import_react24.memo)(SegmentedControl);
|
|
1815
1586
|
var Segmented = (props) => {
|
|
1816
1587
|
const state = useRadioContext();
|
|
1817
|
-
const ref = (0,
|
|
1818
|
-
const ariaRadioProps = (0,
|
|
1588
|
+
const ref = (0, import_react24.useRef)(null);
|
|
1589
|
+
const ariaRadioProps = (0, import_react24.useMemo)(() => ({
|
|
1819
1590
|
value: props.value,
|
|
1820
1591
|
isDisabled: props.disabled,
|
|
1821
1592
|
children: props.children
|
|
@@ -1849,32 +1620,33 @@ var SegmentedLabelInner = import_styled_components21.default.div.withConfig({
|
|
|
1849
1620
|
})(["font-size:14px;line-height:22px;display:flow-root;&::before{display:block;width:0;height:0;content:'';margin-top:-4px;}&::after{display:block;width:0;height:0;content:'';margin-bottom:-4px;}"]);
|
|
1850
1621
|
|
|
1851
1622
|
// src/components/Checkbox/index.tsx
|
|
1852
|
-
var
|
|
1623
|
+
var import_react25 = require("react");
|
|
1853
1624
|
var import_styled_components22 = __toESM(require("styled-components"));
|
|
1854
1625
|
var import_checkbox = require("@react-aria/checkbox");
|
|
1855
|
-
var
|
|
1626
|
+
var import_utils11 = require("@react-aria/utils");
|
|
1856
1627
|
var import_react_stately2 = require("react-stately");
|
|
1857
1628
|
var import_styled9 = require("@charcoal-ui/styled");
|
|
1858
1629
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1859
|
-
var Checkbox = (0,
|
|
1630
|
+
var Checkbox = (0, import_react25.forwardRef)(function CheckboxInner({
|
|
1860
1631
|
invalid = false,
|
|
1861
1632
|
...props
|
|
1862
1633
|
}, ref) {
|
|
1863
|
-
const ariaCheckboxProps = (0,
|
|
1634
|
+
const ariaCheckboxProps = (0, import_react25.useMemo)(() => ({
|
|
1864
1635
|
...props,
|
|
1865
1636
|
isInValid: invalid,
|
|
1866
1637
|
isSelected: props.checked,
|
|
1867
1638
|
defaultSelected: props.defaultChecked,
|
|
1868
1639
|
validationState: invalid ? "invalid" : "valid",
|
|
1869
1640
|
"aria-label": "children" in props ? void 0 : props.label,
|
|
1870
|
-
isDisabled: props.disabled
|
|
1641
|
+
isDisabled: props.disabled,
|
|
1642
|
+
isReadOnly: props.readonly
|
|
1871
1643
|
}), [invalid, props]);
|
|
1872
1644
|
const state = (0, import_react_stately2.useToggleState)(ariaCheckboxProps);
|
|
1873
|
-
const objectRef = (0,
|
|
1645
|
+
const objectRef = (0, import_utils11.useObjectRef)(ref);
|
|
1874
1646
|
const {
|
|
1875
1647
|
inputProps
|
|
1876
1648
|
} = (0, import_checkbox.useCheckbox)(ariaCheckboxProps, state, objectRef);
|
|
1877
|
-
const isDisabled =
|
|
1649
|
+
const isDisabled = props.disabled ?? false;
|
|
1878
1650
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(InputRoot, { "aria-disabled": isDisabled, className: props.className, children: [
|
|
1879
1651
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(CheckboxRoot, { children: [
|
|
1880
1652
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CheckboxInput, { type: "checkbox", ...inputProps, readOnly: props.readonly }),
|
|
@@ -1883,17 +1655,17 @@ var Checkbox = (0, import_react28.forwardRef)(function CheckboxInner({
|
|
|
1883
1655
|
"children" in props && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(InputLabel, { children: props.children })
|
|
1884
1656
|
] });
|
|
1885
1657
|
});
|
|
1886
|
-
var Checkbox_default = (0,
|
|
1658
|
+
var Checkbox_default = (0, import_react25.memo)(Checkbox);
|
|
1887
1659
|
var hiddenCss = (0, import_styled_components22.css)(["visibility:hidden;"]);
|
|
1888
1660
|
var InputRoot = import_styled_components22.default.label.withConfig({
|
|
1889
1661
|
componentId: "ccl__sc-wrdmwj-0"
|
|
1890
|
-
})(["position:relative;display:flex;cursor:pointer;gap:4px;&:disabled,&[aria-disabled]:not([aria-disabled='false']){cursor:default;opacity:0.32;}"]);
|
|
1662
|
+
})(["position:relative;display:flex;cursor:pointer;gap:4px;&:has(input[readonly]){cursor:default;}&:disabled,&[aria-disabled]:not([aria-disabled='false']){cursor:default;opacity:0.32;}"]);
|
|
1891
1663
|
var CheckboxRoot = import_styled_components22.default.div.withConfig({
|
|
1892
1664
|
componentId: "ccl__sc-wrdmwj-1"
|
|
1893
1665
|
})(["position:relative;"]);
|
|
1894
1666
|
var CheckboxInput = import_styled_components22.default.input.withConfig({
|
|
1895
1667
|
componentId: "ccl__sc-wrdmwj-2"
|
|
1896
|
-
})(["&[type='checkbox']{appearance:none;display:block;cursor:pointer;margin:0;width:20px;height:20px;border-radius:4px;transition:0.2s box-shadow,0.2s background-color;&:disabled{cursor:default;}
|
|
1668
|
+
})(["&[type='checkbox']{appearance:none;display:block;cursor:pointer;margin:0;width:20px;height:20px;border-radius:4px;transition:0.2s box-shadow,0.2s background-color;&:disabled{cursor:default;}&[readonly]{cursor:default;opacity:0.32;}&:checked{background-color:var(--charcoal-brand);&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{&:hover{background-color:var(--charcoal-brand-hover);}&:active{background-color:var(--charcoal-brand-press);}}}&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{", " &[aria-invalid='true']{box-shadow:0 0 0 4px rgba(255,43,0,0.32);}}&:not(:checked){border-width:2px;border-style:solid;border-color:var(--charcoal-text4);}}"], import_styled9.focusVisibleFocusRingCss);
|
|
1897
1669
|
var CheckboxInputOverlay = import_styled_components22.default.div.withConfig({
|
|
1898
1670
|
componentId: "ccl__sc-wrdmwj-3"
|
|
1899
1671
|
})(["position:absolute;top:-2px;left:-2px;box-sizing:border-box;display:flex;align-items:center;justify-content:center;width:24px;height:24px;color:var(--charcoal-text5);", ";"], ({
|
|
@@ -1904,10 +1676,10 @@ var InputLabel = import_styled_components22.default.div.withConfig({
|
|
|
1904
1676
|
})(["color:var(--charcoal-text2);font-size:14px;line-height:20px;"]);
|
|
1905
1677
|
|
|
1906
1678
|
// src/components/TagItem/index.tsx
|
|
1907
|
-
var
|
|
1908
|
-
var
|
|
1679
|
+
var import_react26 = require("react");
|
|
1680
|
+
var import_utils12 = require("@react-aria/utils");
|
|
1909
1681
|
var import_styled_components23 = __toESM(require("styled-components"));
|
|
1910
|
-
var
|
|
1682
|
+
var import_utils13 = require("@charcoal-ui/utils");
|
|
1911
1683
|
var import_button = require("@react-aria/button");
|
|
1912
1684
|
var import_styled10 = require("@charcoal-ui/styled");
|
|
1913
1685
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
@@ -1915,7 +1687,7 @@ var sizeMap = {
|
|
|
1915
1687
|
S: 32,
|
|
1916
1688
|
M: 40
|
|
1917
1689
|
};
|
|
1918
|
-
var TagItem = (0,
|
|
1690
|
+
var TagItem = (0, import_react26.forwardRef)(function TagItemInner({
|
|
1919
1691
|
label,
|
|
1920
1692
|
translatedLabel,
|
|
1921
1693
|
bgColor = "#7ACCB1",
|
|
@@ -1926,8 +1698,8 @@ var TagItem = (0, import_react29.forwardRef)(function TagItemInner({
|
|
|
1926
1698
|
className,
|
|
1927
1699
|
...props
|
|
1928
1700
|
}, _ref) {
|
|
1929
|
-
const ref = (0,
|
|
1930
|
-
const ariaButtonProps = (0,
|
|
1701
|
+
const ref = (0, import_utils12.useObjectRef)(_ref);
|
|
1702
|
+
const ariaButtonProps = (0, import_react26.useMemo)(() => ({
|
|
1931
1703
|
elementType: "a",
|
|
1932
1704
|
isDisabled: disabled,
|
|
1933
1705
|
...props
|
|
@@ -1947,11 +1719,11 @@ var TagItem = (0, import_react29.forwardRef)(function TagItemInner({
|
|
|
1947
1719
|
] })
|
|
1948
1720
|
] });
|
|
1949
1721
|
});
|
|
1950
|
-
var TagItem_default = (0,
|
|
1722
|
+
var TagItem_default = (0, import_react26.memo)(TagItem);
|
|
1951
1723
|
var horizontalPadding = ({
|
|
1952
1724
|
left,
|
|
1953
1725
|
right
|
|
1954
|
-
}) => (0, import_styled_components23.css)(["padding-right:", ";padding-left:", ";"], (0,
|
|
1726
|
+
}) => (0, import_styled_components23.css)(["padding-right:", ";padding-left:", ";"], (0, import_utils13.px)(right), (0, import_utils13.px)(left));
|
|
1955
1727
|
var tagItemRootSize = (size) => {
|
|
1956
1728
|
switch (size) {
|
|
1957
1729
|
case "M":
|