@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.
Files changed (91) hide show
  1. package/dist/components/Checkbox/index.d.ts.map +1 -1
  2. package/dist/components/DropdownSelector/Popover/index.d.ts +1 -2
  3. package/dist/components/DropdownSelector/Popover/index.d.ts.map +1 -1
  4. package/dist/components/Modal/index.d.ts +1 -1
  5. package/dist/components/Modal/index.d.ts.map +1 -1
  6. package/dist/components/Modal/useCustomModalOverlay.d.ts.map +1 -1
  7. package/dist/components/MultiSelect/index.d.ts.map +1 -1
  8. package/dist/components/Radio/index.d.ts +4 -4
  9. package/dist/components/Radio/index.d.ts.map +1 -1
  10. package/dist/components/TextArea/index.d.ts.map +1 -1
  11. package/dist/components/TextField/index.d.ts.map +1 -1
  12. package/dist/core/CharcoalProvider.d.ts +1 -1
  13. package/dist/core/CharcoalProvider.d.ts.map +1 -1
  14. package/dist/index.cjs.js +123 -351
  15. package/dist/index.cjs.js.map +1 -1
  16. package/dist/index.esm.js +85 -313
  17. package/dist/index.esm.js.map +1 -1
  18. package/package.json +13 -17
  19. package/src/components/Checkbox/__snapshots__/index.story.storyshot +601 -173
  20. package/src/components/Checkbox/index.story.tsx +57 -77
  21. package/src/components/Checkbox/index.tsx +7 -2
  22. package/src/components/DropdownSelector/Popover/index.tsx +1 -2
  23. package/src/components/IconButton/__snapshots__/index.story.storyshot +6 -8
  24. package/src/components/IconButton/index.story.tsx +14 -37
  25. package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +139 -1
  26. package/src/components/LoadingSpinner/index.story.tsx +18 -7
  27. package/src/components/Modal/index.tsx +1 -1
  28. package/src/components/Modal/useCustomModalOverlay.tsx +5 -4
  29. package/src/components/MultiSelect/__snapshots__/index.story.storyshot +32 -44
  30. package/src/components/MultiSelect/index.story.tsx +88 -192
  31. package/src/components/MultiSelect/index.tsx +2 -1
  32. package/src/components/Radio/__snapshots__/index.story.storyshot +1 -1
  33. package/src/components/Radio/index.story.tsx +20 -21
  34. package/src/components/Radio/index.tsx +14 -13
  35. package/src/components/Switch/__snapshots__/index.story.storyshot +8 -9
  36. package/src/components/Switch/index.story.tsx +10 -18
  37. package/src/components/TagItem/__snapshots__/index.story.storyshot +791 -665
  38. package/src/components/TagItem/index.story.tsx +44 -161
  39. package/src/components/TextArea/TextArea.story.tsx +62 -24
  40. package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +1858 -472
  41. package/src/components/TextArea/index.tsx +2 -0
  42. package/src/components/TextField/TextField.story.tsx +77 -67
  43. package/src/components/TextField/__snapshots__/TextField.story.storyshot +2004 -786
  44. package/src/components/TextField/index.tsx +2 -0
  45. package/src/components/a11y.test.tsx +1 -1
  46. package/src/core/CharcoalProvider.tsx +1 -1
  47. package/dist/components/Button/index.story.d.ts +0 -14
  48. package/dist/components/Button/index.story.d.ts.map +0 -1
  49. package/dist/components/Checkbox/index.story.d.ts +0 -8
  50. package/dist/components/Checkbox/index.story.d.ts.map +0 -1
  51. package/dist/components/Clickable/index.story.d.ts +0 -6
  52. package/dist/components/Clickable/index.story.d.ts.map +0 -1
  53. package/dist/components/DropdownSelector/ListItem/index.story.d.ts +0 -9
  54. package/dist/components/DropdownSelector/ListItem/index.story.d.ts.map +0 -1
  55. package/dist/components/DropdownSelector/MenuList/index.story.d.ts +0 -8
  56. package/dist/components/DropdownSelector/MenuList/index.story.d.ts.map +0 -1
  57. package/dist/components/DropdownSelector/Popover/index.story.d.ts +0 -5
  58. package/dist/components/DropdownSelector/Popover/index.story.d.ts.map +0 -1
  59. package/dist/components/DropdownSelector/index.story.d.ts +0 -19
  60. package/dist/components/DropdownSelector/index.story.d.ts.map +0 -1
  61. package/dist/components/Icon/index.story.d.ts +0 -6
  62. package/dist/components/Icon/index.story.d.ts.map +0 -1
  63. package/dist/components/IconButton/index.story.d.ts +0 -9
  64. package/dist/components/IconButton/index.story.d.ts.map +0 -1
  65. package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts +0 -8
  66. package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts.map +0 -1
  67. package/dist/components/LoadingSpinner/index.story.d.ts +0 -6
  68. package/dist/components/LoadingSpinner/index.story.d.ts.map +0 -1
  69. package/dist/components/Modal/index.story.d.ts +0 -21
  70. package/dist/components/Modal/index.story.d.ts.map +0 -1
  71. package/dist/components/MultiSelect/index.story.d.ts +0 -82
  72. package/dist/components/MultiSelect/index.story.d.ts.map +0 -1
  73. package/dist/components/MultiSelect/index.test.d.ts +0 -2
  74. package/dist/components/MultiSelect/index.test.d.ts.map +0 -1
  75. package/dist/components/Radio/index.story.d.ts +0 -26
  76. package/dist/components/Radio/index.story.d.ts.map +0 -1
  77. package/dist/components/Radio/index.test.d.ts +0 -2
  78. package/dist/components/Radio/index.test.d.ts.map +0 -1
  79. package/dist/components/SegmentedControl/index.story.d.ts +0 -7
  80. package/dist/components/SegmentedControl/index.story.d.ts.map +0 -1
  81. package/dist/components/Switch/index.story.d.ts +0 -9
  82. package/dist/components/Switch/index.story.d.ts.map +0 -1
  83. package/dist/components/TagItem/index.story.d.ts +0 -16
  84. package/dist/components/TagItem/index.story.d.ts.map +0 -1
  85. package/dist/components/TextArea/TextArea.story.d.ts +0 -9
  86. package/dist/components/TextArea/TextArea.story.d.ts.map +0 -1
  87. package/dist/components/TextField/TextField.story.d.ts +0 -22
  88. package/dist/components/TextField/TextField.story.d.ts.map +0 -1
  89. package/dist/components/a11y.test.d.ts +0 -2
  90. package/dist/components/a11y.test.d.ts.map +0 -1
  91. package/src/components/LoadingSpinner/LoadingSpinnerIcon.story.tsx +0 -13
package/dist/index.esm.js CHANGED
@@ -342,7 +342,7 @@ function RadioGroup({
342
342
  }
343
343
 
344
344
  // src/components/MultiSelect/index.tsx
345
- import { useCallback as useCallback2, useContext as useContext3, forwardRef as forwardRef6, memo as memo2 } from "react";
345
+ import { useCallback as useCallback2, useContext as useContext3, forwardRef as forwardRef7, memo as memo2 } from "react";
346
346
  import styled5, { css as css3 } from "styled-components";
347
347
  import warning2 from "warning";
348
348
  import { px } from "@charcoal-ui/utils";
@@ -362,8 +362,25 @@ var MultiSelectGroupContext = createContext3({
362
362
 
363
363
  // src/components/MultiSelect/index.tsx
364
364
  import { focusVisibleFocusRingCss as focusVisibleFocusRingCss4 } from "@charcoal-ui/styled";
365
- import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
366
- var MultiSelect = forwardRef6(function MultiSelectInner({
365
+
366
+ // src/components/Icon/index.tsx
367
+ import * as React4 from "react";
368
+ import "@charcoal-ui/icons";
369
+ import { jsx as jsx7 } from "react/jsx-runtime";
370
+ var Icon = React4.forwardRef(function IconInner({
371
+ name,
372
+ scale,
373
+ unsafeNonGuidelineScale,
374
+ className,
375
+ ...rest
376
+ }, ref) {
377
+ return /* @__PURE__ */ jsx7("pixiv-icon", { ref, name, scale, "unsafe-non-guideline-scale": unsafeNonGuidelineScale, class: className, ...rest });
378
+ });
379
+ var Icon_default = Icon;
380
+
381
+ // src/components/MultiSelect/index.tsx
382
+ import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
383
+ var MultiSelect = forwardRef7(function MultiSelectInner({
367
384
  value,
368
385
  disabled = false,
369
386
  onChange,
@@ -400,13 +417,13 @@ var MultiSelect = forwardRef6(function MultiSelectInner({
400
417
  });
401
418
  }, [onChange, parentOnChange, value]);
402
419
  return /* @__PURE__ */ jsxs3(MultiSelectRoot, { "aria-disabled": isDisabled, className, children: [
403
- /* @__PURE__ */ jsx7(MultiSelectInput, { ...{
420
+ /* @__PURE__ */ jsx8(MultiSelectInput, { ...{
404
421
  name,
405
422
  value,
406
423
  invalid
407
424
  }, checked: isSelected, disabled: isDisabled, onChange: handleChange, overlay: variant === "overlay", "aria-invalid": invalid, ref }),
408
- /* @__PURE__ */ jsx7(MultiSelectInputOverlay, { overlay: variant === "overlay", invalid, "aria-hidden": true, children: /* @__PURE__ */ jsx7("pixiv-icon", { name: "24/Check", "unsafe-non-guideline-scale": 16 / 24 }) }),
409
- Boolean(children) && /* @__PURE__ */ jsx7(MultiSelectLabel, { children })
425
+ /* @__PURE__ */ jsx8(MultiSelectInputOverlay, { overlay: variant === "overlay", invalid, "aria-hidden": true, children: /* @__PURE__ */ jsx8(Icon_default, { name: "24/Check", "unsafe-non-guideline-scale": 16 / 24 }) }),
426
+ Boolean(children) && /* @__PURE__ */ jsx8(MultiSelectLabel, { children })
410
427
  ] });
411
428
  });
412
429
  var MultiSelect_default = memo2(MultiSelect);
@@ -459,25 +476,25 @@ function MultiSelectGroup({
459
476
  }
460
477
  }
461
478
  }, [onChange, selected]);
462
- return /* @__PURE__ */ jsx7(MultiSelectGroupContext.Provider, { value: {
479
+ return /* @__PURE__ */ jsx8(MultiSelectGroupContext.Provider, { value: {
463
480
  name,
464
481
  selected: Array.from(new Set(selected)),
465
482
  disabled,
466
483
  readonly,
467
484
  invalid,
468
485
  onChange: handleChange
469
- }, children: /* @__PURE__ */ jsx7("div", { className, "aria-label": label, "data-testid": "SelectGroup", children }) });
486
+ }, children: /* @__PURE__ */ jsx8("div", { className, "aria-label": label, "data-testid": "SelectGroup", children }) });
470
487
  }
471
488
 
472
489
  // src/components/Switch/index.tsx
473
490
  import { useSwitch } from "@react-aria/switch";
474
- import { useMemo, memo as memo3, forwardRef as forwardRef7 } from "react";
491
+ import { useMemo, memo as memo3, forwardRef as forwardRef8 } from "react";
475
492
  import { useToggleState } from "react-stately";
476
493
  import styled6 from "styled-components";
477
494
  import { useObjectRef } from "@react-aria/utils";
478
495
  import { focusVisibleFocusRingCss as focusVisibleFocusRingCss5 } from "@charcoal-ui/styled";
479
- import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
480
- var SwitchCheckbox = forwardRef7(function SwitchCheckboxInner(props, external) {
496
+ import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
497
+ var SwitchCheckbox = forwardRef8(function SwitchCheckboxInner(props, external) {
481
498
  const {
482
499
  disabled,
483
500
  className
@@ -498,8 +515,8 @@ var SwitchCheckbox = forwardRef7(function SwitchCheckboxInner(props, external) {
498
515
  }
499
516
  } = useSwitch(ariaSwitchProps, state, ref);
500
517
  return /* @__PURE__ */ jsxs4(Label, { className, "aria-disabled": disabled, children: [
501
- /* @__PURE__ */ jsx8(SwitchInput, { ...rest, ref }),
502
- "children" in props ? /* @__PURE__ */ jsx8(LabelInner, { children: props.children }) : void 0
518
+ /* @__PURE__ */ jsx9(SwitchInput, { ...rest, ref }),
519
+ "children" in props ? /* @__PURE__ */ jsx9(LabelInner, { children: props.children }) : void 0
503
520
  ] });
504
521
  });
505
522
  var Switch_default = memo3(SwitchCheckbox);
@@ -519,14 +536,14 @@ var SwitchInput = styled6.input.attrs({
519
536
  import { useTextField } from "@react-aria/textfield";
520
537
  import { useVisuallyHidden } from "@react-aria/visually-hidden";
521
538
  import { useCallback as useCallback3, useEffect as useEffect2, useRef, useState } from "react";
522
- import * as React5 from "react";
539
+ import * as React6 from "react";
523
540
  import styled8, { css as css4 } from "styled-components";
524
541
 
525
542
  // src/components/FieldLabel/index.tsx
526
- import * as React4 from "react";
543
+ import * as React5 from "react";
527
544
  import styled7 from "styled-components";
528
- import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
529
- var FieldLabel = React4.forwardRef(function FieldLabel2({
545
+ import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
546
+ var FieldLabel = React5.forwardRef(function FieldLabel2({
530
547
  style,
531
548
  className,
532
549
  label,
@@ -536,9 +553,9 @@ var FieldLabel = React4.forwardRef(function FieldLabel2({
536
553
  ...labelProps
537
554
  }, ref) {
538
555
  return /* @__PURE__ */ jsxs5(FieldLabelWrapper, { style, className, children: [
539
- /* @__PURE__ */ jsx9(Label2, { ref, ...labelProps, children: label }),
540
- required && /* @__PURE__ */ jsx9(RequiredText, { children: requiredText }),
541
- /* @__PURE__ */ jsx9(SubLabelClickable, { children: /* @__PURE__ */ jsx9("span", { children: subLabel }) })
556
+ /* @__PURE__ */ jsx10(Label2, { ref, ...labelProps, children: label }),
557
+ required && /* @__PURE__ */ jsx10(RequiredText, { children: requiredText }),
558
+ /* @__PURE__ */ jsx10(SubLabelClickable, { children: /* @__PURE__ */ jsx10("span", { children: subLabel }) })
542
559
  ] });
543
560
  });
544
561
  var FieldLabel_default = FieldLabel;
@@ -576,8 +593,8 @@ function useFocusWithClick(containerRef, inputRef) {
576
593
 
577
594
  // src/components/TextField/index.tsx
578
595
  import { mergeProps } from "@react-aria/utils";
579
- import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
580
- var TextField = React5.forwardRef(function SingleLineTextFieldInner({
596
+ import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
597
+ var TextField = React6.forwardRef(function SingleLineTextFieldInner({
581
598
  onChange,
582
599
  ...props
583
600
  }, forwardRef18) {
@@ -591,6 +608,7 @@ var TextField = React5.forwardRef(function SingleLineTextFieldInner({
591
608
  disabled = false,
592
609
  required,
593
610
  invalid = false,
611
+ readOnly = false,
594
612
  assistiveText,
595
613
  maxLength,
596
614
  prefix = null,
@@ -625,6 +643,7 @@ var TextField = React5.forwardRef(function SingleLineTextFieldInner({
625
643
  inputElementType: "input",
626
644
  isDisabled: disabled,
627
645
  isRequired: required,
646
+ isReadOnly: readOnly,
628
647
  validationState: invalid ? "invalid" : "valid",
629
648
  description: !invalid && assistiveText,
630
649
  errorMessage: invalid && assistiveText,
@@ -635,16 +654,16 @@ var TextField = React5.forwardRef(function SingleLineTextFieldInner({
635
654
  useFocusWithClick(containerRef, ariaRef);
636
655
  const inputProps = mergeProps(restProps, ariaInputProps);
637
656
  return /* @__PURE__ */ jsxs6(TextFieldRoot, { className, isDisabled: disabled, children: [
638
- /* @__PURE__ */ jsx10(TextFieldLabel, { label, requiredText, required, subLabel, ...labelProps, ...!showLabel ? visuallyHiddenProps : {} }),
657
+ /* @__PURE__ */ jsx11(TextFieldLabel, { label, requiredText, required, subLabel, ...labelProps, ...!showLabel ? visuallyHiddenProps : {} }),
639
658
  /* @__PURE__ */ jsxs6(StyledInputContainer, { ref: containerRef, invalid, "aria-disabled": disabled === true ? true : void 0, hasPrefix: prefix != null, hasSuffix: suffix != null || showCount, children: [
640
- prefix && /* @__PURE__ */ jsx10(PrefixContainer, { children: prefix }),
641
- /* @__PURE__ */ jsx10(StyledInput, { ref: mergeRefs(forwardRef18, ariaRef), invalid, ...inputProps }),
659
+ prefix && /* @__PURE__ */ jsx11(PrefixContainer, { children: prefix }),
660
+ /* @__PURE__ */ jsx11(StyledInput, { ref: mergeRefs(forwardRef18, ariaRef), invalid, ...inputProps }),
642
661
  (suffix || showCount) && /* @__PURE__ */ jsxs6(SuffixContainer, { children: [
643
662
  suffix,
644
- showCount && /* @__PURE__ */ jsx10(SingleLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
663
+ showCount && /* @__PURE__ */ jsx11(SingleLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
645
664
  ] })
646
665
  ] }),
647
- assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ jsx10(AssistiveText, { invalid, ...invalid ? errorMessageProps : descriptionProps, children: assistiveText })
666
+ assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ jsx11(AssistiveText, { invalid, ...invalid ? errorMessageProps : descriptionProps, children: assistiveText })
648
667
  ] });
649
668
  });
650
669
  var TextField_default = TextField;
@@ -678,11 +697,11 @@ var AssistiveText = styled8.p.withConfig({
678
697
  // src/components/TextArea/index.tsx
679
698
  import { useTextField as useTextField2 } from "@react-aria/textfield";
680
699
  import { useVisuallyHidden as useVisuallyHidden2 } from "@react-aria/visually-hidden";
681
- import { forwardRef as forwardRef10, useCallback as useCallback4, useEffect as useEffect3, useRef as useRef2, useState as useState2 } from "react";
700
+ import { forwardRef as forwardRef11, useCallback as useCallback4, useEffect as useEffect3, useRef as useRef2, useState as useState2 } from "react";
682
701
  import styled9, { css as css5 } from "styled-components";
683
702
  import { mergeProps as mergeProps2 } from "@react-aria/utils";
684
- import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
685
- var TextArea = forwardRef10(function TextAreaInner({
703
+ import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
704
+ var TextArea = forwardRef11(function TextAreaInner({
686
705
  onChange,
687
706
  ...props
688
707
  }, forwardRef18) {
@@ -696,6 +715,7 @@ var TextArea = forwardRef10(function TextAreaInner({
696
715
  disabled = false,
697
716
  required,
698
717
  invalid = false,
718
+ readOnly = false,
699
719
  assistiveText,
700
720
  maxLength,
701
721
  autoHeight = false,
@@ -740,6 +760,7 @@ var TextArea = forwardRef10(function TextAreaInner({
740
760
  inputElementType: "textarea",
741
761
  isDisabled: disabled,
742
762
  isRequired: required,
763
+ isReadOnly: readOnly,
743
764
  validationState: invalid ? "invalid" : "valid",
744
765
  description: !invalid && assistiveText,
745
766
  errorMessage: invalid && assistiveText,
@@ -755,12 +776,12 @@ var TextArea = forwardRef10(function TextAreaInner({
755
776
  useFocusWithClick(containerRef, ariaRef);
756
777
  const inputProps = mergeProps2(restProps, ariaInputProps);
757
778
  return /* @__PURE__ */ jsxs7(TextFieldRoot2, { className, isDisabled: disabled, children: [
758
- /* @__PURE__ */ jsx11(TextFieldLabel, { label, requiredText, required, subLabel, ...labelProps, ...!showLabel ? visuallyHiddenProps : {} }),
779
+ /* @__PURE__ */ jsx12(TextFieldLabel, { label, requiredText, required, subLabel, ...labelProps, ...!showLabel ? visuallyHiddenProps : {} }),
759
780
  /* @__PURE__ */ jsxs7(StyledTextareaContainer, { ref: containerRef, invalid, rows: showCount ? rows + 1 : rows, "aria-disabled": disabled === true ? "true" : void 0, children: [
760
- /* @__PURE__ */ jsx11(StyledTextarea, { ref: mergeRefs(textareaRef, forwardRef18, ariaRef), rows, noBottomPadding: showCount, ...inputProps }),
761
- showCount && /* @__PURE__ */ jsx11(MultiLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
781
+ /* @__PURE__ */ jsx12(StyledTextarea, { ref: mergeRefs(textareaRef, forwardRef18, ariaRef), rows, noBottomPadding: showCount, ...inputProps }),
782
+ showCount && /* @__PURE__ */ jsx12(MultiLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
762
783
  ] }),
763
- assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ jsx11(AssistiveText, { invalid, ...invalid ? errorMessageProps : descriptionProps, children: assistiveText })
784
+ assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ jsx12(AssistiveText, { invalid, ...invalid ? errorMessageProps : descriptionProps, children: assistiveText })
764
785
  ] });
765
786
  });
766
787
  var TextArea_default = TextArea;
@@ -784,21 +805,6 @@ var MultiLineCounter = styled9.span.withConfig({
784
805
  componentId: "ccl__sc-58waht-3"
785
806
  })(["position:absolute;bottom:9px;right:8px;line-height:22px;font-size:14px;color:var(--charcoal-text3);"]);
786
807
 
787
- // src/components/Icon/index.tsx
788
- import * as React6 from "react";
789
- import "@charcoal-ui/icons";
790
- import { jsx as jsx12 } from "react/jsx-runtime";
791
- var Icon = React6.forwardRef(function IconInner({
792
- name,
793
- scale,
794
- unsafeNonGuidelineScale,
795
- className,
796
- ...rest
797
- }, ref) {
798
- return /* @__PURE__ */ jsx12("pixiv-icon", { ref, name, scale, "unsafe-non-guideline-scale": unsafeNonGuidelineScale, class: className, ...rest });
799
- });
800
- var Icon_default = Icon;
801
-
802
808
  // src/components/Modal/index.tsx
803
809
  import { useContext as useContext4, forwardRef as forwardRef13, memo as memo4 } from "react";
804
810
  import * as React10 from "react";
@@ -813,15 +819,7 @@ import { useObjectRef as useObjectRef2 } from "@react-aria/utils";
813
819
  import { forwardRef as forwardRef12 } from "react";
814
820
  import styled10, { css as css6 } from "styled-components";
815
821
  import { useDialog } from "@react-aria/dialog";
816
-
817
- // ../foundation/src/grid.ts
818
- var COLUMN_UNIT = 80;
819
- var GUTTER_UNIT = 24;
820
- function columnSystem(span, column, gutter) {
821
- return span * column + (span - 1) * gutter;
822
- }
823
-
824
- // src/components/Modal/Dialog/index.tsx
822
+ import { columnSystem, COLUMN_UNIT, GUTTER_UNIT } from "@charcoal-ui/foundation";
825
823
  import { maxWidth } from "@charcoal-ui/utils";
826
824
  import { animated } from "react-spring";
827
825
 
@@ -879,7 +877,26 @@ var ModalBackgroundContext = React8.createContext(null);
879
877
 
880
878
  // src/components/Modal/useCustomModalOverlay.tsx
881
879
  import * as React9 from "react";
882
- import { ariaHideOutside, useOverlay, useOverlayFocusContain, usePreventScroll } from "@react-aria/overlays";
880
+ import { ariaHideOutside, useOverlay, useOverlayFocusContain } from "@react-aria/overlays";
881
+
882
+ // src/components/DropdownSelector/Popover/usePreventScroll.tsx
883
+ import { useEffect as useEffect5 } from "react";
884
+ function usePreventScroll(element, isOpen) {
885
+ useEffect5(() => {
886
+ if (isOpen && element) {
887
+ const defaultPaddingRight = element.style.paddingRight;
888
+ const defaultOverflow = element.style.overflow;
889
+ element.style.paddingRight = `${window.innerWidth - element.clientWidth}px`;
890
+ element.style.overflow = "hidden";
891
+ return () => {
892
+ element.style.paddingRight = defaultPaddingRight;
893
+ element.style.overflow = defaultOverflow;
894
+ };
895
+ }
896
+ }, [element, isOpen]);
897
+ }
898
+
899
+ // src/components/Modal/useCustomModalOverlay.tsx
883
900
  function useCharcoalModalOverlay(props, state, ref) {
884
901
  const {
885
902
  overlayProps,
@@ -890,9 +907,7 @@ function useCharcoalModalOverlay(props, state, ref) {
890
907
  onClose: state.onClose,
891
908
  shouldCloseOnInteractOutside: () => false
892
909
  }, ref);
893
- usePreventScroll({
894
- isDisabled: !state.isOpen
895
- });
910
+ usePreventScroll(typeof document !== "undefined" ? document.body : null, state.isOpen);
896
911
  useOverlayFocusContain();
897
912
  React9.useEffect(() => {
898
913
  if (state.isOpen && ref.current) {
@@ -1100,25 +1115,6 @@ import { useEffect as useEffect7, useRef as useRef7 } from "react";
1100
1115
  import { useContext as useContext6, useRef as useRef6 } from "react";
1101
1116
  import { DismissButton, Overlay as Overlay2, usePopover } from "@react-aria/overlays";
1102
1117
  import styled14 from "styled-components";
1103
-
1104
- // src/components/DropdownSelector/Popover/usePreventScroll.tsx
1105
- import { useEffect as useEffect6 } from "react";
1106
- function usePreventScroll2(element, isOpen) {
1107
- useEffect6(() => {
1108
- if (isOpen && element) {
1109
- const defaultPaddingRight = element.style.paddingRight;
1110
- const defaultOverflow = element.style.overflow;
1111
- element.style.paddingRight = `${window.innerWidth - element.clientWidth}px`;
1112
- element.style.overflow = "hidden";
1113
- return () => {
1114
- element.style.paddingRight = defaultPaddingRight;
1115
- element.style.overflow = defaultOverflow;
1116
- };
1117
- }
1118
- }, [element, isOpen]);
1119
- }
1120
-
1121
- // src/components/DropdownSelector/Popover/index.tsx
1122
1118
  import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
1123
1119
  var _empty = () => null;
1124
1120
  function Popover(props) {
@@ -1139,7 +1135,7 @@ function Popover(props) {
1139
1135
  toggle: _empty
1140
1136
  });
1141
1137
  const modalBackground = useContext6(ModalBackgroundContext);
1142
- usePreventScroll2(modalBackground, props.isOpen);
1138
+ usePreventScroll(modalBackground, props.isOpen);
1143
1139
  if (!props.isOpen)
1144
1140
  return null;
1145
1141
  return /* @__PURE__ */ jsxs9(Overlay2, { portalContainer: document.body, children: [
@@ -1483,232 +1479,7 @@ var StyledLi2 = styled19.li.withConfig({
1483
1479
 
1484
1480
  // src/components/SegmentedControl/index.tsx
1485
1481
  import { forwardRef as forwardRef15, memo as memo6, useMemo as useMemo4, useRef as useRef10 } from "react";
1486
-
1487
- // ../../node_modules/@react-stately/form/dist/import.mjs
1488
- import { createContext as $jcIOw$createContext, useMemo as $jcIOw$useMemo, useContext as $jcIOw$useContext, useState as $jcIOw$useState, useRef as $jcIOw$useRef, useEffect as $jcIOw$useEffect } from "react";
1489
- var $e5be200c675c3b3a$export$aca958c65c314e6c = {
1490
- badInput: false,
1491
- customError: false,
1492
- patternMismatch: false,
1493
- rangeOverflow: false,
1494
- rangeUnderflow: false,
1495
- stepMismatch: false,
1496
- tooLong: false,
1497
- tooShort: false,
1498
- typeMismatch: false,
1499
- valueMissing: false,
1500
- valid: true
1501
- };
1502
- var $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE = {
1503
- ...$e5be200c675c3b3a$export$aca958c65c314e6c,
1504
- customError: true,
1505
- valid: false
1506
- };
1507
- var $e5be200c675c3b3a$export$dad6ae84456c676a = {
1508
- isInvalid: false,
1509
- validationDetails: $e5be200c675c3b3a$export$aca958c65c314e6c,
1510
- validationErrors: []
1511
- };
1512
- var $e5be200c675c3b3a$export$571b5131b7e65c11 = (0, $jcIOw$createContext)({});
1513
- var $e5be200c675c3b3a$export$a763b9476acd3eb = "__formValidationState" + Date.now();
1514
- function $e5be200c675c3b3a$export$fc1a364ae1f3ff10(props) {
1515
- if (props[$e5be200c675c3b3a$export$a763b9476acd3eb]) {
1516
- let {
1517
- realtimeValidation,
1518
- displayValidation,
1519
- updateValidation,
1520
- resetValidation,
1521
- commitValidation
1522
- } = props[$e5be200c675c3b3a$export$a763b9476acd3eb];
1523
- return {
1524
- realtimeValidation,
1525
- displayValidation,
1526
- updateValidation,
1527
- resetValidation,
1528
- commitValidation
1529
- };
1530
- }
1531
- return $e5be200c675c3b3a$var$useFormValidationStateImpl(props);
1532
- }
1533
- function $e5be200c675c3b3a$var$useFormValidationStateImpl(props) {
1534
- let {
1535
- isInvalid,
1536
- validationState,
1537
- name,
1538
- value,
1539
- builtinValidation,
1540
- validate,
1541
- validationBehavior = "aria"
1542
- } = props;
1543
- if (validationState)
1544
- isInvalid || (isInvalid = validationState === "invalid");
1545
- let controlledError = isInvalid ? {
1546
- isInvalid: true,
1547
- validationErrors: [],
1548
- validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE
1549
- } : null;
1550
- let clientError = (0, $jcIOw$useMemo)(() => $e5be200c675c3b3a$var$getValidationResult($e5be200c675c3b3a$var$runValidate(validate, value)), [validate, value]);
1551
- if (builtinValidation === null || builtinValidation === void 0 ? void 0 : builtinValidation.validationDetails.valid)
1552
- builtinValidation = null;
1553
- let serverErrors = (0, $jcIOw$useContext)($e5be200c675c3b3a$export$571b5131b7e65c11);
1554
- let serverErrorMessages = (0, $jcIOw$useMemo)(() => {
1555
- if (name)
1556
- return Array.isArray(name) ? name.flatMap((name2) => $e5be200c675c3b3a$var$asArray(serverErrors[name2])) : $e5be200c675c3b3a$var$asArray(serverErrors[name]);
1557
- return [];
1558
- }, [serverErrors, name]);
1559
- let [lastServerErrors, setLastServerErrors] = (0, $jcIOw$useState)(serverErrors);
1560
- let [isServerErrorCleared, setServerErrorCleared] = (0, $jcIOw$useState)(false);
1561
- if (serverErrors !== lastServerErrors) {
1562
- setLastServerErrors(serverErrors);
1563
- setServerErrorCleared(false);
1564
- }
1565
- let serverError = (0, $jcIOw$useMemo)(() => $e5be200c675c3b3a$var$getValidationResult(isServerErrorCleared ? [] : serverErrorMessages), [isServerErrorCleared, serverErrorMessages]);
1566
- let nextValidation = (0, $jcIOw$useRef)($e5be200c675c3b3a$export$dad6ae84456c676a);
1567
- let [currentValidity, setCurrentValidity] = (0, $jcIOw$useState)($e5be200c675c3b3a$export$dad6ae84456c676a);
1568
- let lastError = (0, $jcIOw$useRef)($e5be200c675c3b3a$export$dad6ae84456c676a);
1569
- let commitValidation = () => {
1570
- if (!commitQueued)
1571
- return;
1572
- setCommitQueued(false);
1573
- let error = clientError || builtinValidation || nextValidation.current;
1574
- if (!$e5be200c675c3b3a$var$isEqualValidation(error, lastError.current)) {
1575
- lastError.current = error;
1576
- setCurrentValidity(error);
1577
- }
1578
- };
1579
- let [commitQueued, setCommitQueued] = (0, $jcIOw$useState)(false);
1580
- (0, $jcIOw$useEffect)(commitValidation);
1581
- let realtimeValidation = controlledError || serverError || clientError || builtinValidation || $e5be200c675c3b3a$export$dad6ae84456c676a;
1582
- let displayValidation = validationBehavior === "native" ? controlledError || serverError || currentValidity : controlledError || serverError || clientError || builtinValidation || currentValidity;
1583
- return {
1584
- realtimeValidation,
1585
- displayValidation,
1586
- updateValidation(value2) {
1587
- if (validationBehavior === "aria" && !$e5be200c675c3b3a$var$isEqualValidation(currentValidity, value2))
1588
- setCurrentValidity(value2);
1589
- else
1590
- nextValidation.current = value2;
1591
- },
1592
- resetValidation() {
1593
- let error = $e5be200c675c3b3a$export$dad6ae84456c676a;
1594
- if (!$e5be200c675c3b3a$var$isEqualValidation(error, lastError.current)) {
1595
- lastError.current = error;
1596
- setCurrentValidity(error);
1597
- }
1598
- if (validationBehavior === "native")
1599
- setCommitQueued(false);
1600
- setServerErrorCleared(true);
1601
- },
1602
- commitValidation() {
1603
- if (validationBehavior === "native")
1604
- setCommitQueued(true);
1605
- setServerErrorCleared(true);
1606
- }
1607
- };
1608
- }
1609
- function $e5be200c675c3b3a$var$asArray(v) {
1610
- if (!v)
1611
- return [];
1612
- return Array.isArray(v) ? v : [v];
1613
- }
1614
- function $e5be200c675c3b3a$var$runValidate(validate, value) {
1615
- if (typeof validate === "function") {
1616
- let e = validate(value);
1617
- if (e && typeof e !== "boolean")
1618
- return $e5be200c675c3b3a$var$asArray(e);
1619
- }
1620
- return [];
1621
- }
1622
- function $e5be200c675c3b3a$var$getValidationResult(errors) {
1623
- return errors.length ? {
1624
- isInvalid: true,
1625
- validationErrors: errors,
1626
- validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE
1627
- } : null;
1628
- }
1629
- function $e5be200c675c3b3a$var$isEqualValidation(a, b) {
1630
- if (a === b)
1631
- return true;
1632
- 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);
1633
- }
1634
-
1635
- // ../../node_modules/@react-stately/utils/dist/import.mjs
1636
- import { useState as $6imuh$useState, useRef as $6imuh$useRef, useEffect as $6imuh$useEffect, useCallback as $6imuh$useCallback } from "react";
1637
- function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange) {
1638
- let [stateValue, setStateValue] = (0, $6imuh$useState)(value || defaultValue);
1639
- let isControlledRef = (0, $6imuh$useRef)(value !== void 0);
1640
- let isControlled = value !== void 0;
1641
- (0, $6imuh$useEffect)(() => {
1642
- let wasControlled = isControlledRef.current;
1643
- if (wasControlled !== isControlled)
1644
- console.warn(`WARN: A component changed from ${wasControlled ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}.`);
1645
- isControlledRef.current = isControlled;
1646
- }, [isControlled]);
1647
- let currentValue = isControlled ? value : stateValue;
1648
- let setValue = (0, $6imuh$useCallback)((value2, ...args) => {
1649
- let onChangeCaller = (value3, ...onChangeArgs) => {
1650
- if (onChange) {
1651
- if (!Object.is(currentValue, value3))
1652
- onChange(value3, ...onChangeArgs);
1653
- }
1654
- if (!isControlled)
1655
- currentValue = value3;
1656
- };
1657
- if (typeof value2 === "function") {
1658
- console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320");
1659
- let updateFunction = (oldValue, ...functionArgs) => {
1660
- let interceptedValue = value2(isControlled ? currentValue : oldValue, ...functionArgs);
1661
- onChangeCaller(interceptedValue, ...args);
1662
- if (!isControlled)
1663
- return interceptedValue;
1664
- return oldValue;
1665
- };
1666
- setStateValue(updateFunction);
1667
- } else {
1668
- if (!isControlled)
1669
- setStateValue(value2);
1670
- onChangeCaller(value2, ...args);
1671
- }
1672
- }, [isControlled, currentValue, onChange]);
1673
- return [currentValue, setValue];
1674
- }
1675
-
1676
- // ../../node_modules/@react-stately/radio/dist/import.mjs
1677
- import { useMemo as $fQ2SF$useMemo, useState as $fQ2SF$useState } from "react";
1678
- var $a54cdc5c1942b639$var$instance = Math.round(Math.random() * 1e10);
1679
- var $a54cdc5c1942b639$var$i = 0;
1680
- function $a54cdc5c1942b639$export$bca9d026f8e704eb(props) {
1681
- let name = (0, $fQ2SF$useMemo)(() => props.name || `radio-group-${$a54cdc5c1942b639$var$instance}-${++$a54cdc5c1942b639$var$i}`, [props.name]);
1682
- var _props_defaultValue;
1683
- let [selectedValue, setSelected] = (0, $458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : null, props.onChange);
1684
- let [lastFocusedValue, setLastFocusedValue] = (0, $fQ2SF$useState)(null);
1685
- let validation = (0, $e5be200c675c3b3a$export$fc1a364ae1f3ff10)({
1686
- ...props,
1687
- value: selectedValue
1688
- });
1689
- let setSelectedValue = (value) => {
1690
- if (!props.isReadOnly && !props.isDisabled) {
1691
- setSelected(value);
1692
- validation.commitValidation();
1693
- }
1694
- };
1695
- let isInvalid = validation.displayValidation.isInvalid;
1696
- return {
1697
- ...validation,
1698
- name,
1699
- selectedValue,
1700
- setSelectedValue,
1701
- lastFocusedValue,
1702
- setLastFocusedValue,
1703
- isDisabled: props.isDisabled || false,
1704
- isReadOnly: props.isReadOnly || false,
1705
- isRequired: props.isRequired || false,
1706
- validationState: props.validationState || (isInvalid ? "invalid" : null),
1707
- isInvalid
1708
- };
1709
- }
1710
-
1711
- // src/components/SegmentedControl/index.tsx
1482
+ import { useRadioGroupState } from "@react-stately/radio";
1712
1483
  import { useRadio, useRadioGroup } from "@react-aria/radio";
1713
1484
  import styled20, { css as css10 } from "styled-components";
1714
1485
 
@@ -1739,7 +1510,7 @@ var SegmentedControl = forwardRef15(function SegmentedControlInner(props, ref) {
1739
1510
  isRequired: props.required,
1740
1511
  "aria-label": props.name
1741
1512
  }), [props]);
1742
- const state = $a54cdc5c1942b639$export$bca9d026f8e704eb(ariaRadioGroupProps);
1513
+ const state = useRadioGroupState(ariaRadioGroupProps);
1743
1514
  const {
1744
1515
  radioGroupProps
1745
1516
  } = useRadioGroup(ariaRadioGroupProps, state);
@@ -1807,14 +1578,15 @@ var Checkbox = forwardRef16(function CheckboxInner({
1807
1578
  defaultSelected: props.defaultChecked,
1808
1579
  validationState: invalid ? "invalid" : "valid",
1809
1580
  "aria-label": "children" in props ? void 0 : props.label,
1810
- isDisabled: props.disabled
1581
+ isDisabled: props.disabled,
1582
+ isReadOnly: props.readonly
1811
1583
  }), [invalid, props]);
1812
1584
  const state = useToggleState2(ariaCheckboxProps);
1813
1585
  const objectRef = useObjectRef3(ref);
1814
1586
  const {
1815
1587
  inputProps
1816
1588
  } = useCheckbox(ariaCheckboxProps, state, objectRef);
1817
- const isDisabled = (props.disabled ?? false) || (props.readonly ?? false);
1589
+ const isDisabled = props.disabled ?? false;
1818
1590
  return /* @__PURE__ */ jsxs14(InputRoot, { "aria-disabled": isDisabled, className: props.className, children: [
1819
1591
  /* @__PURE__ */ jsxs14(CheckboxRoot, { children: [
1820
1592
  /* @__PURE__ */ jsx27(CheckboxInput, { type: "checkbox", ...inputProps, readOnly: props.readonly }),
@@ -1827,13 +1599,13 @@ var Checkbox_default = memo7(Checkbox);
1827
1599
  var hiddenCss = css11(["visibility:hidden;"]);
1828
1600
  var InputRoot = styled21.label.withConfig({
1829
1601
  componentId: "ccl__sc-wrdmwj-0"
1830
- })(["position:relative;display:flex;cursor:pointer;gap:4px;&:disabled,&[aria-disabled]:not([aria-disabled='false']){cursor:default;opacity:0.32;}"]);
1602
+ })(["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;}"]);
1831
1603
  var CheckboxRoot = styled21.div.withConfig({
1832
1604
  componentId: "ccl__sc-wrdmwj-1"
1833
1605
  })(["position:relative;"]);
1834
1606
  var CheckboxInput = styled21.input.withConfig({
1835
1607
  componentId: "ccl__sc-wrdmwj-2"
1836
- })(["&[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;}&:read-only{cursor:default;}&: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);}}"], focusVisibleFocusRingCss7);
1608
+ })(["&[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);}}"], focusVisibleFocusRingCss7);
1837
1609
  var CheckboxInputOverlay = styled21.div.withConfig({
1838
1610
  componentId: "ccl__sc-wrdmwj-3"
1839
1611
  })(["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);", ";"], ({