@charcoal-ui/react 3.10.1-beta.1 → 3.11.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 (98) 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/DropdownSelector/index.d.ts +1 -1
  5. package/dist/components/DropdownSelector/index.d.ts.map +1 -1
  6. package/dist/components/Modal/index.d.ts +1 -1
  7. package/dist/components/Modal/index.d.ts.map +1 -1
  8. package/dist/components/Modal/useCustomModalOverlay.d.ts.map +1 -1
  9. package/dist/components/MultiSelect/index.d.ts.map +1 -1
  10. package/dist/components/Radio/index.d.ts +4 -4
  11. package/dist/components/Radio/index.d.ts.map +1 -1
  12. package/dist/components/TextArea/index.d.ts.map +1 -1
  13. package/dist/components/TextField/index.d.ts.map +1 -1
  14. package/dist/core/CharcoalProvider.d.ts +1 -1
  15. package/dist/core/CharcoalProvider.d.ts.map +1 -1
  16. package/dist/index.cjs.js +129 -351
  17. package/dist/index.cjs.js.map +1 -1
  18. package/dist/index.esm.js +95 -317
  19. package/dist/index.esm.js.map +1 -1
  20. package/package.json +13 -17
  21. package/src/components/Button/__snapshots__/index.story.storyshot +91 -939
  22. package/src/components/Button/index.story.tsx +14 -161
  23. package/src/components/Checkbox/__snapshots__/index.story.storyshot +560 -154
  24. package/src/components/Checkbox/index.story.tsx +46 -74
  25. package/src/components/Checkbox/index.tsx +1 -0
  26. package/src/components/DropdownSelector/Popover/index.tsx +1 -2
  27. package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +15 -0
  28. package/src/components/DropdownSelector/index.tsx +19 -4
  29. package/src/components/IconButton/__snapshots__/index.story.storyshot +6 -8
  30. package/src/components/IconButton/index.story.tsx +14 -37
  31. package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +139 -1
  32. package/src/components/LoadingSpinner/index.story.tsx +18 -7
  33. package/src/components/Modal/__snapshots__/index.story.storyshot +2 -0
  34. package/src/components/Modal/index.tsx +1 -1
  35. package/src/components/Modal/useCustomModalOverlay.tsx +5 -4
  36. package/src/components/MultiSelect/__snapshots__/index.story.storyshot +32 -44
  37. package/src/components/MultiSelect/index.story.tsx +88 -192
  38. package/src/components/MultiSelect/index.tsx +2 -1
  39. package/src/components/Radio/__snapshots__/index.story.storyshot +1 -1
  40. package/src/components/Radio/index.story.tsx +20 -21
  41. package/src/components/Radio/index.tsx +14 -13
  42. package/src/components/Switch/__snapshots__/index.story.storyshot +8 -9
  43. package/src/components/Switch/index.story.tsx +10 -18
  44. package/src/components/TagItem/__snapshots__/index.story.storyshot +791 -665
  45. package/src/components/TagItem/index.story.tsx +44 -161
  46. package/src/components/TextArea/TextArea.story.tsx +62 -24
  47. package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +1858 -472
  48. package/src/components/TextArea/index.tsx +2 -0
  49. package/src/components/TextField/TextField.story.tsx +77 -67
  50. package/src/components/TextField/__snapshots__/TextField.story.storyshot +2004 -786
  51. package/src/components/TextField/index.tsx +2 -0
  52. package/src/components/a11y.test.tsx +1 -1
  53. package/src/core/CharcoalProvider.tsx +1 -1
  54. package/dist/components/Button/index.story.d.ts +0 -19
  55. package/dist/components/Button/index.story.d.ts.map +0 -1
  56. package/dist/components/Checkbox/index.story.d.ts +0 -8
  57. package/dist/components/Checkbox/index.story.d.ts.map +0 -1
  58. package/dist/components/Clickable/index.story.d.ts +0 -6
  59. package/dist/components/Clickable/index.story.d.ts.map +0 -1
  60. package/dist/components/DropdownSelector/ListItem/index.story.d.ts +0 -9
  61. package/dist/components/DropdownSelector/ListItem/index.story.d.ts.map +0 -1
  62. package/dist/components/DropdownSelector/MenuList/index.story.d.ts +0 -8
  63. package/dist/components/DropdownSelector/MenuList/index.story.d.ts.map +0 -1
  64. package/dist/components/DropdownSelector/Popover/index.story.d.ts +0 -5
  65. package/dist/components/DropdownSelector/Popover/index.story.d.ts.map +0 -1
  66. package/dist/components/DropdownSelector/index.story.d.ts +0 -19
  67. package/dist/components/DropdownSelector/index.story.d.ts.map +0 -1
  68. package/dist/components/Icon/index.story.d.ts +0 -6
  69. package/dist/components/Icon/index.story.d.ts.map +0 -1
  70. package/dist/components/IconButton/index.story.d.ts +0 -9
  71. package/dist/components/IconButton/index.story.d.ts.map +0 -1
  72. package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts +0 -8
  73. package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts.map +0 -1
  74. package/dist/components/LoadingSpinner/index.story.d.ts +0 -6
  75. package/dist/components/LoadingSpinner/index.story.d.ts.map +0 -1
  76. package/dist/components/Modal/index.story.d.ts +0 -21
  77. package/dist/components/Modal/index.story.d.ts.map +0 -1
  78. package/dist/components/MultiSelect/index.story.d.ts +0 -82
  79. package/dist/components/MultiSelect/index.story.d.ts.map +0 -1
  80. package/dist/components/MultiSelect/index.test.d.ts +0 -2
  81. package/dist/components/MultiSelect/index.test.d.ts.map +0 -1
  82. package/dist/components/Radio/index.story.d.ts +0 -26
  83. package/dist/components/Radio/index.story.d.ts.map +0 -1
  84. package/dist/components/Radio/index.test.d.ts +0 -2
  85. package/dist/components/Radio/index.test.d.ts.map +0 -1
  86. package/dist/components/SegmentedControl/index.story.d.ts +0 -7
  87. package/dist/components/SegmentedControl/index.story.d.ts.map +0 -1
  88. package/dist/components/Switch/index.story.d.ts +0 -9
  89. package/dist/components/Switch/index.story.d.ts.map +0 -1
  90. package/dist/components/TagItem/index.story.d.ts +0 -16
  91. package/dist/components/TagItem/index.story.d.ts.map +0 -1
  92. package/dist/components/TextArea/TextArea.story.d.ts +0 -9
  93. package/dist/components/TextArea/TextArea.story.d.ts.map +0 -1
  94. package/dist/components/TextField/TextField.story.d.ts +0 -22
  95. package/dist/components/TextField/TextField.story.d.ts.map +0 -1
  96. package/dist/components/a11y.test.d.ts +0 -2
  97. package/dist/components/a11y.test.d.ts.map +0 -1
  98. 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) {
@@ -1089,7 +1104,7 @@ var LoadingSpinnerIcon = forwardRef14(function LoadingSpinnerIcon2({
1089
1104
  });
1090
1105
 
1091
1106
  // src/components/DropdownSelector/index.tsx
1092
- import { useState as useState3, useRef as useRef9, useMemo as useMemo3 } from "react";
1107
+ import { useState as useState3, useRef as useRef9, useMemo as useMemo3, useCallback as useCallback6 } from "react";
1093
1108
  import styled16, { css as css9 } from "styled-components";
1094
1109
  import { disabledSelector as disabledSelector2 } from "@charcoal-ui/utils";
1095
1110
 
@@ -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: [
@@ -1267,7 +1263,10 @@ import { focusVisibleFocusRingCss as focusVisibleFocusRingCss6 } from "@charcoal
1267
1263
  import { useVisuallyHidden as useVisuallyHidden3 } from "@react-aria/visually-hidden";
1268
1264
  import { jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
1269
1265
  var defaultRequiredText = "*\u5FC5\u9808";
1270
- function DropdownSelector(props) {
1266
+ function DropdownSelector({
1267
+ onChange,
1268
+ ...props
1269
+ }) {
1271
1270
  const triggerRef = useRef9(null);
1272
1271
  const [isOpen, setIsOpen] = useState3(false);
1273
1272
  const preview = findPreviewRecursive(props.children, props.value);
@@ -1276,9 +1275,12 @@ function DropdownSelector(props) {
1276
1275
  const {
1277
1276
  visuallyHiddenProps
1278
1277
  } = useVisuallyHidden3();
1278
+ const handleChange = useCallback6((e) => {
1279
+ onChange(e.target.value);
1280
+ }, [onChange]);
1279
1281
  return /* @__PURE__ */ jsxs10(DropdownSelectorRoot, { "aria-disabled": props.disabled, children: [
1280
1282
  props.showLabel === true && /* @__PURE__ */ jsx20(DropdownFieldLabel, { label: props.label, required: props.required, requiredText: props.requiredText ?? defaultRequiredText, subLabel: props.subLabel }),
1281
- /* @__PURE__ */ jsx20("div", { ...visuallyHiddenProps, "aria-hidden": "true", children: /* @__PURE__ */ jsx20("select", { name: props.name, value: props.value, tabIndex: -1, children: propsArray.map((itemProps) => {
1283
+ /* @__PURE__ */ jsx20("div", { ...visuallyHiddenProps, "aria-hidden": "true", children: /* @__PURE__ */ jsx20("select", { name: props.name, value: props.value, onChange: handleChange, tabIndex: -1, children: propsArray.map((itemProps) => {
1282
1284
  return /* @__PURE__ */ jsx20("option", { value: itemProps.value, disabled: itemProps.disabled, children: itemProps.value }, itemProps.value);
1283
1285
  }) }) }),
1284
1286
  /* @__PURE__ */ jsxs10(DropdownButton, { invalid: props.invalid, disabled: props.disabled, onClick: () => {
@@ -1290,7 +1292,7 @@ function DropdownSelector(props) {
1290
1292
  /* @__PURE__ */ jsx20(DropdownButtonIcon, { name: "16/Menu" })
1291
1293
  ] }),
1292
1294
  isOpen && /* @__PURE__ */ jsx20(DropdownPopover, { isOpen, onClose: () => setIsOpen(false), triggerRef, value: props.value, children: /* @__PURE__ */ jsx20(MenuList, { value: props.value, onChange: (v) => {
1293
- props.onChange(v);
1295
+ onChange(v);
1294
1296
  setIsOpen(false);
1295
1297
  }, children: props.children }) }),
1296
1298
  props.assistiveText !== void 0 && /* @__PURE__ */ jsx20(AssertiveText, { invalid: props.invalid, children: props.assistiveText })
@@ -1342,7 +1344,7 @@ var ItemDiv = styled17.div.withConfig({
1342
1344
  })(["display:flex;align-items:center;min-height:40px;cursor:pointer;outline:none;padding-right:16px;padding-left:16px;transition:background-color 0.2s;&:disabled,&[aria-disabled]:not([aria-disabled='false']){opacity:0.32;cursor:default;}:hover,:focus,:focus-within{&:not(disabled):not([aria-disabled='true']){background-color:var(--charcoal-surface3);}}"]);
1343
1345
 
1344
1346
  // src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx
1345
- import { useCallback as useCallback6, useContext as useContext7 } from "react";
1347
+ import { useCallback as useCallback7, useContext as useContext7 } from "react";
1346
1348
 
1347
1349
  // src/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.tsx
1348
1350
  function handleFocusByKeyBoard(element, parent) {
@@ -1380,11 +1382,11 @@ function useMenuItemHandleKeyDown(value) {
1380
1382
  root,
1381
1383
  propsArray
1382
1384
  } = useContext7(MenuListContext);
1383
- const setContextValue = useCallback6(() => {
1385
+ const setContextValue = useCallback7(() => {
1384
1386
  if (value !== void 0)
1385
1387
  setValue(value);
1386
1388
  }, [value, setValue]);
1387
- const handleKeyDown = useCallback6((e) => {
1389
+ const handleKeyDown = useCallback7((e) => {
1388
1390
  if (e.key === "Enter") {
1389
1391
  setContextValue();
1390
1392
  } else if (e.key === "ArrowUp" || e.key === "ArrowDown") {
@@ -1477,232 +1479,7 @@ var StyledLi2 = styled19.li.withConfig({
1477
1479
 
1478
1480
  // src/components/SegmentedControl/index.tsx
1479
1481
  import { forwardRef as forwardRef15, memo as memo6, useMemo as useMemo4, useRef as useRef10 } from "react";
1480
-
1481
- // ../../node_modules/@react-stately/form/dist/import.mjs
1482
- 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";
1483
- var $e5be200c675c3b3a$export$aca958c65c314e6c = {
1484
- badInput: false,
1485
- customError: false,
1486
- patternMismatch: false,
1487
- rangeOverflow: false,
1488
- rangeUnderflow: false,
1489
- stepMismatch: false,
1490
- tooLong: false,
1491
- tooShort: false,
1492
- typeMismatch: false,
1493
- valueMissing: false,
1494
- valid: true
1495
- };
1496
- var $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE = {
1497
- ...$e5be200c675c3b3a$export$aca958c65c314e6c,
1498
- customError: true,
1499
- valid: false
1500
- };
1501
- var $e5be200c675c3b3a$export$dad6ae84456c676a = {
1502
- isInvalid: false,
1503
- validationDetails: $e5be200c675c3b3a$export$aca958c65c314e6c,
1504
- validationErrors: []
1505
- };
1506
- var $e5be200c675c3b3a$export$571b5131b7e65c11 = (0, $jcIOw$createContext)({});
1507
- var $e5be200c675c3b3a$export$a763b9476acd3eb = "__formValidationState" + Date.now();
1508
- function $e5be200c675c3b3a$export$fc1a364ae1f3ff10(props) {
1509
- if (props[$e5be200c675c3b3a$export$a763b9476acd3eb]) {
1510
- let {
1511
- realtimeValidation,
1512
- displayValidation,
1513
- updateValidation,
1514
- resetValidation,
1515
- commitValidation
1516
- } = props[$e5be200c675c3b3a$export$a763b9476acd3eb];
1517
- return {
1518
- realtimeValidation,
1519
- displayValidation,
1520
- updateValidation,
1521
- resetValidation,
1522
- commitValidation
1523
- };
1524
- }
1525
- return $e5be200c675c3b3a$var$useFormValidationStateImpl(props);
1526
- }
1527
- function $e5be200c675c3b3a$var$useFormValidationStateImpl(props) {
1528
- let {
1529
- isInvalid,
1530
- validationState,
1531
- name,
1532
- value,
1533
- builtinValidation,
1534
- validate,
1535
- validationBehavior = "aria"
1536
- } = props;
1537
- if (validationState)
1538
- isInvalid || (isInvalid = validationState === "invalid");
1539
- let controlledError = isInvalid ? {
1540
- isInvalid: true,
1541
- validationErrors: [],
1542
- validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE
1543
- } : null;
1544
- let clientError = (0, $jcIOw$useMemo)(() => $e5be200c675c3b3a$var$getValidationResult($e5be200c675c3b3a$var$runValidate(validate, value)), [validate, value]);
1545
- if (builtinValidation === null || builtinValidation === void 0 ? void 0 : builtinValidation.validationDetails.valid)
1546
- builtinValidation = null;
1547
- let serverErrors = (0, $jcIOw$useContext)($e5be200c675c3b3a$export$571b5131b7e65c11);
1548
- let serverErrorMessages = (0, $jcIOw$useMemo)(() => {
1549
- if (name)
1550
- return Array.isArray(name) ? name.flatMap((name2) => $e5be200c675c3b3a$var$asArray(serverErrors[name2])) : $e5be200c675c3b3a$var$asArray(serverErrors[name]);
1551
- return [];
1552
- }, [serverErrors, name]);
1553
- let [lastServerErrors, setLastServerErrors] = (0, $jcIOw$useState)(serverErrors);
1554
- let [isServerErrorCleared, setServerErrorCleared] = (0, $jcIOw$useState)(false);
1555
- if (serverErrors !== lastServerErrors) {
1556
- setLastServerErrors(serverErrors);
1557
- setServerErrorCleared(false);
1558
- }
1559
- let serverError = (0, $jcIOw$useMemo)(() => $e5be200c675c3b3a$var$getValidationResult(isServerErrorCleared ? [] : serverErrorMessages), [isServerErrorCleared, serverErrorMessages]);
1560
- let nextValidation = (0, $jcIOw$useRef)($e5be200c675c3b3a$export$dad6ae84456c676a);
1561
- let [currentValidity, setCurrentValidity] = (0, $jcIOw$useState)($e5be200c675c3b3a$export$dad6ae84456c676a);
1562
- let lastError = (0, $jcIOw$useRef)($e5be200c675c3b3a$export$dad6ae84456c676a);
1563
- let commitValidation = () => {
1564
- if (!commitQueued)
1565
- return;
1566
- setCommitQueued(false);
1567
- let error = clientError || builtinValidation || nextValidation.current;
1568
- if (!$e5be200c675c3b3a$var$isEqualValidation(error, lastError.current)) {
1569
- lastError.current = error;
1570
- setCurrentValidity(error);
1571
- }
1572
- };
1573
- let [commitQueued, setCommitQueued] = (0, $jcIOw$useState)(false);
1574
- (0, $jcIOw$useEffect)(commitValidation);
1575
- let realtimeValidation = controlledError || serverError || clientError || builtinValidation || $e5be200c675c3b3a$export$dad6ae84456c676a;
1576
- let displayValidation = validationBehavior === "native" ? controlledError || serverError || currentValidity : controlledError || serverError || clientError || builtinValidation || currentValidity;
1577
- return {
1578
- realtimeValidation,
1579
- displayValidation,
1580
- updateValidation(value2) {
1581
- if (validationBehavior === "aria" && !$e5be200c675c3b3a$var$isEqualValidation(currentValidity, value2))
1582
- setCurrentValidity(value2);
1583
- else
1584
- nextValidation.current = value2;
1585
- },
1586
- resetValidation() {
1587
- let error = $e5be200c675c3b3a$export$dad6ae84456c676a;
1588
- if (!$e5be200c675c3b3a$var$isEqualValidation(error, lastError.current)) {
1589
- lastError.current = error;
1590
- setCurrentValidity(error);
1591
- }
1592
- if (validationBehavior === "native")
1593
- setCommitQueued(false);
1594
- setServerErrorCleared(true);
1595
- },
1596
- commitValidation() {
1597
- if (validationBehavior === "native")
1598
- setCommitQueued(true);
1599
- setServerErrorCleared(true);
1600
- }
1601
- };
1602
- }
1603
- function $e5be200c675c3b3a$var$asArray(v) {
1604
- if (!v)
1605
- return [];
1606
- return Array.isArray(v) ? v : [v];
1607
- }
1608
- function $e5be200c675c3b3a$var$runValidate(validate, value) {
1609
- if (typeof validate === "function") {
1610
- let e = validate(value);
1611
- if (e && typeof e !== "boolean")
1612
- return $e5be200c675c3b3a$var$asArray(e);
1613
- }
1614
- return [];
1615
- }
1616
- function $e5be200c675c3b3a$var$getValidationResult(errors) {
1617
- return errors.length ? {
1618
- isInvalid: true,
1619
- validationErrors: errors,
1620
- validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE
1621
- } : null;
1622
- }
1623
- function $e5be200c675c3b3a$var$isEqualValidation(a, b) {
1624
- if (a === b)
1625
- return true;
1626
- 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);
1627
- }
1628
-
1629
- // ../../node_modules/@react-stately/utils/dist/import.mjs
1630
- import { useState as $6imuh$useState, useRef as $6imuh$useRef, useEffect as $6imuh$useEffect, useCallback as $6imuh$useCallback } from "react";
1631
- function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange) {
1632
- let [stateValue, setStateValue] = (0, $6imuh$useState)(value || defaultValue);
1633
- let isControlledRef = (0, $6imuh$useRef)(value !== void 0);
1634
- let isControlled = value !== void 0;
1635
- (0, $6imuh$useEffect)(() => {
1636
- let wasControlled = isControlledRef.current;
1637
- if (wasControlled !== isControlled)
1638
- console.warn(`WARN: A component changed from ${wasControlled ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}.`);
1639
- isControlledRef.current = isControlled;
1640
- }, [isControlled]);
1641
- let currentValue = isControlled ? value : stateValue;
1642
- let setValue = (0, $6imuh$useCallback)((value2, ...args) => {
1643
- let onChangeCaller = (value3, ...onChangeArgs) => {
1644
- if (onChange) {
1645
- if (!Object.is(currentValue, value3))
1646
- onChange(value3, ...onChangeArgs);
1647
- }
1648
- if (!isControlled)
1649
- currentValue = value3;
1650
- };
1651
- if (typeof value2 === "function") {
1652
- console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320");
1653
- let updateFunction = (oldValue, ...functionArgs) => {
1654
- let interceptedValue = value2(isControlled ? currentValue : oldValue, ...functionArgs);
1655
- onChangeCaller(interceptedValue, ...args);
1656
- if (!isControlled)
1657
- return interceptedValue;
1658
- return oldValue;
1659
- };
1660
- setStateValue(updateFunction);
1661
- } else {
1662
- if (!isControlled)
1663
- setStateValue(value2);
1664
- onChangeCaller(value2, ...args);
1665
- }
1666
- }, [isControlled, currentValue, onChange]);
1667
- return [currentValue, setValue];
1668
- }
1669
-
1670
- // ../../node_modules/@react-stately/radio/dist/import.mjs
1671
- import { useMemo as $fQ2SF$useMemo, useState as $fQ2SF$useState } from "react";
1672
- var $a54cdc5c1942b639$var$instance = Math.round(Math.random() * 1e10);
1673
- var $a54cdc5c1942b639$var$i = 0;
1674
- function $a54cdc5c1942b639$export$bca9d026f8e704eb(props) {
1675
- let name = (0, $fQ2SF$useMemo)(() => props.name || `radio-group-${$a54cdc5c1942b639$var$instance}-${++$a54cdc5c1942b639$var$i}`, [props.name]);
1676
- var _props_defaultValue;
1677
- let [selectedValue, setSelected] = (0, $458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : null, props.onChange);
1678
- let [lastFocusedValue, setLastFocusedValue] = (0, $fQ2SF$useState)(null);
1679
- let validation = (0, $e5be200c675c3b3a$export$fc1a364ae1f3ff10)({
1680
- ...props,
1681
- value: selectedValue
1682
- });
1683
- let setSelectedValue = (value) => {
1684
- if (!props.isReadOnly && !props.isDisabled) {
1685
- setSelected(value);
1686
- validation.commitValidation();
1687
- }
1688
- };
1689
- let isInvalid = validation.displayValidation.isInvalid;
1690
- return {
1691
- ...validation,
1692
- name,
1693
- selectedValue,
1694
- setSelectedValue,
1695
- lastFocusedValue,
1696
- setLastFocusedValue,
1697
- isDisabled: props.isDisabled || false,
1698
- isReadOnly: props.isReadOnly || false,
1699
- isRequired: props.isRequired || false,
1700
- validationState: props.validationState || (isInvalid ? "invalid" : null),
1701
- isInvalid
1702
- };
1703
- }
1704
-
1705
- // src/components/SegmentedControl/index.tsx
1482
+ import { useRadioGroupState } from "@react-stately/radio";
1706
1483
  import { useRadio, useRadioGroup } from "@react-aria/radio";
1707
1484
  import styled20, { css as css10 } from "styled-components";
1708
1485
 
@@ -1733,7 +1510,7 @@ var SegmentedControl = forwardRef15(function SegmentedControlInner(props, ref) {
1733
1510
  isRequired: props.required,
1734
1511
  "aria-label": props.name
1735
1512
  }), [props]);
1736
- const state = $a54cdc5c1942b639$export$bca9d026f8e704eb(ariaRadioGroupProps);
1513
+ const state = useRadioGroupState(ariaRadioGroupProps);
1737
1514
  const {
1738
1515
  radioGroupProps
1739
1516
  } = useRadioGroup(ariaRadioGroupProps, state);
@@ -1801,7 +1578,8 @@ var Checkbox = forwardRef16(function CheckboxInner({
1801
1578
  defaultSelected: props.defaultChecked,
1802
1579
  validationState: invalid ? "invalid" : "valid",
1803
1580
  "aria-label": "children" in props ? void 0 : props.label,
1804
- isDisabled: props.disabled
1581
+ isDisabled: props.disabled,
1582
+ isReadOnly: props.readonly
1805
1583
  }), [invalid, props]);
1806
1584
  const state = useToggleState2(ariaCheckboxProps);
1807
1585
  const objectRef = useObjectRef3(ref);