@charcoal-ui/react 4.0.0-beta.2 → 4.0.0-beta.4

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 (113) hide show
  1. package/dist/components/Button/index.d.ts +9 -1
  2. package/dist/components/Button/index.d.ts.map +1 -1
  3. package/dist/components/Checkbox/index.d.ts +9 -20
  4. package/dist/components/Checkbox/index.d.ts.map +1 -1
  5. package/dist/components/CheckboxInput/index.d.ts +9 -0
  6. package/dist/components/CheckboxInput/index.d.ts.map +1 -0
  7. package/dist/components/DropdownSelector/Popover/index.d.ts +1 -2
  8. package/dist/components/DropdownSelector/Popover/index.d.ts.map +1 -1
  9. package/dist/components/DropdownSelector/index.d.ts +1 -1
  10. package/dist/components/DropdownSelector/index.d.ts.map +1 -1
  11. package/dist/components/Modal/index.d.ts +1 -1
  12. package/dist/components/Modal/index.d.ts.map +1 -1
  13. package/dist/components/Modal/useCustomModalOverlay.d.ts.map +1 -1
  14. package/dist/components/MultiSelect/index.d.ts.map +1 -1
  15. package/dist/components/Radio/index.d.ts +4 -4
  16. package/dist/components/Radio/index.d.ts.map +1 -1
  17. package/dist/components/TextArea/index.d.ts.map +1 -1
  18. package/dist/components/TextField/index.d.ts.map +1 -1
  19. package/dist/core/CharcoalProvider.d.ts +1 -1
  20. package/dist/core/CharcoalProvider.d.ts.map +1 -1
  21. package/dist/index.cjs.js +188 -418
  22. package/dist/index.cjs.js.map +1 -1
  23. package/dist/index.css +86 -0
  24. package/dist/index.css.map +1 -1
  25. package/dist/index.esm.js +167 -397
  26. package/dist/index.esm.js.map +1 -1
  27. package/package.json +14 -17
  28. package/src/components/Button/__snapshots__/index.story.storyshot +11 -49
  29. package/src/components/Button/__snapshots__/index.test.tsx.snap +11 -0
  30. package/src/components/Button/index.story.tsx +13 -66
  31. package/src/components/Button/index.test.tsx +32 -0
  32. package/src/components/Button/index.tsx +11 -1
  33. package/src/components/Checkbox/__snapshots__/index.story.storyshot +163 -517
  34. package/src/components/Checkbox/index.css +21 -0
  35. package/src/components/Checkbox/index.story.tsx +44 -79
  36. package/src/components/Checkbox/index.tsx +19 -157
  37. package/src/components/CheckboxInput/__snapshots__/index.story.storyshot +109 -0
  38. package/src/components/CheckboxInput/index.css +77 -0
  39. package/src/components/CheckboxInput/index.story.tsx +35 -0
  40. package/src/components/CheckboxInput/index.tsx +53 -0
  41. package/src/components/DropdownSelector/Popover/index.tsx +1 -2
  42. package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +15 -0
  43. package/src/components/DropdownSelector/index.tsx +19 -4
  44. package/src/components/IconButton/__snapshots__/index.story.storyshot +6 -8
  45. package/src/components/IconButton/index.story.tsx +14 -37
  46. package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +139 -1
  47. package/src/components/LoadingSpinner/index.story.tsx +18 -7
  48. package/src/components/Modal/__snapshots__/index.story.storyshot +2 -0
  49. package/src/components/Modal/index.tsx +1 -1
  50. package/src/components/Modal/useCustomModalOverlay.tsx +5 -4
  51. package/src/components/MultiSelect/__snapshots__/index.story.storyshot +32 -44
  52. package/src/components/MultiSelect/index.story.tsx +88 -192
  53. package/src/components/MultiSelect/index.tsx +2 -1
  54. package/src/components/Radio/__snapshots__/index.story.storyshot +1 -1
  55. package/src/components/Radio/index.story.tsx +20 -21
  56. package/src/components/Radio/index.tsx +14 -13
  57. package/src/components/Switch/__snapshots__/index.story.storyshot +8 -9
  58. package/src/components/Switch/index.story.tsx +10 -18
  59. package/src/components/TagItem/__snapshots__/index.story.storyshot +791 -665
  60. package/src/components/TagItem/index.story.tsx +44 -161
  61. package/src/components/TextArea/TextArea.story.tsx +62 -24
  62. package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +1858 -472
  63. package/src/components/TextArea/index.tsx +2 -0
  64. package/src/components/TextField/TextField.story.tsx +77 -67
  65. package/src/components/TextField/__snapshots__/TextField.story.storyshot +2004 -786
  66. package/src/components/TextField/index.tsx +2 -0
  67. package/src/components/a11y.test.tsx +1 -1
  68. package/src/core/CharcoalProvider.tsx +1 -1
  69. package/dist/components/Button/index.story.d.ts +0 -24
  70. package/dist/components/Button/index.story.d.ts.map +0 -1
  71. package/dist/components/Checkbox/index.story.d.ts +0 -8
  72. package/dist/components/Checkbox/index.story.d.ts.map +0 -1
  73. package/dist/components/Clickable/index.story.d.ts +0 -6
  74. package/dist/components/Clickable/index.story.d.ts.map +0 -1
  75. package/dist/components/DropdownSelector/ListItem/index.story.d.ts +0 -9
  76. package/dist/components/DropdownSelector/ListItem/index.story.d.ts.map +0 -1
  77. package/dist/components/DropdownSelector/MenuList/index.story.d.ts +0 -8
  78. package/dist/components/DropdownSelector/MenuList/index.story.d.ts.map +0 -1
  79. package/dist/components/DropdownSelector/Popover/index.story.d.ts +0 -5
  80. package/dist/components/DropdownSelector/Popover/index.story.d.ts.map +0 -1
  81. package/dist/components/DropdownSelector/index.story.d.ts +0 -19
  82. package/dist/components/DropdownSelector/index.story.d.ts.map +0 -1
  83. package/dist/components/Icon/index.story.d.ts +0 -6
  84. package/dist/components/Icon/index.story.d.ts.map +0 -1
  85. package/dist/components/IconButton/index.story.d.ts +0 -9
  86. package/dist/components/IconButton/index.story.d.ts.map +0 -1
  87. package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts +0 -8
  88. package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts.map +0 -1
  89. package/dist/components/LoadingSpinner/index.story.d.ts +0 -6
  90. package/dist/components/LoadingSpinner/index.story.d.ts.map +0 -1
  91. package/dist/components/Modal/index.story.d.ts +0 -21
  92. package/dist/components/Modal/index.story.d.ts.map +0 -1
  93. package/dist/components/MultiSelect/index.story.d.ts +0 -82
  94. package/dist/components/MultiSelect/index.story.d.ts.map +0 -1
  95. package/dist/components/MultiSelect/index.test.d.ts +0 -2
  96. package/dist/components/MultiSelect/index.test.d.ts.map +0 -1
  97. package/dist/components/Radio/index.story.d.ts +0 -26
  98. package/dist/components/Radio/index.story.d.ts.map +0 -1
  99. package/dist/components/Radio/index.test.d.ts +0 -2
  100. package/dist/components/Radio/index.test.d.ts.map +0 -1
  101. package/dist/components/SegmentedControl/index.story.d.ts +0 -7
  102. package/dist/components/SegmentedControl/index.story.d.ts.map +0 -1
  103. package/dist/components/Switch/index.story.d.ts +0 -9
  104. package/dist/components/Switch/index.story.d.ts.map +0 -1
  105. package/dist/components/TagItem/index.story.d.ts +0 -16
  106. package/dist/components/TagItem/index.story.d.ts.map +0 -1
  107. package/dist/components/TextArea/TextArea.story.d.ts +0 -9
  108. package/dist/components/TextArea/TextArea.story.d.ts.map +0 -1
  109. package/dist/components/TextField/TextField.story.d.ts +0 -22
  110. package/dist/components/TextField/TextField.story.d.ts.map +0 -1
  111. package/dist/components/a11y.test.d.ts +0 -2
  112. package/dist/components/a11y.test.d.ts.map +0 -1
  113. package/src/components/LoadingSpinner/LoadingSpinnerIcon.story.tsx +0 -13
package/dist/index.esm.js CHANGED
@@ -68,11 +68,12 @@ var Button = forwardRef2(function Button2({
68
68
  className,
69
69
  as,
70
70
  isActive,
71
+ componentAs,
71
72
  ...props
72
73
  }, ref) {
73
74
  const Component = useMemo2(() => as ?? "button", [as]);
74
75
  const classNames = useClassNames("charcoal-button", className);
75
- return /* @__PURE__ */ jsx3(Component, { ...props, className: classNames, "data-variant": variant, "data-size": size, "data-full-width": fullWidth, "data-active": isActive, ref });
76
+ return /* @__PURE__ */ jsx3(Component, { ...props, as: componentAs, className: classNames, "data-variant": variant, "data-size": size, "data-full-width": fullWidth, "data-active": isActive, ref });
76
77
  });
77
78
  var Button_default = Button;
78
79
 
@@ -279,7 +280,7 @@ function RadioGroup({
279
280
  }
280
281
 
281
282
  // src/components/MultiSelect/index.tsx
282
- import { useCallback as useCallback2, useContext as useContext3, forwardRef as forwardRef6, memo as memo2 } from "react";
283
+ import { useCallback as useCallback2, useContext as useContext3, forwardRef as forwardRef7, memo as memo2 } from "react";
283
284
  import styled4, { css as css2 } from "styled-components";
284
285
  import warning2 from "warning";
285
286
  import { px } from "@charcoal-ui/utils";
@@ -299,8 +300,25 @@ var MultiSelectGroupContext = createContext3({
299
300
 
300
301
  // src/components/MultiSelect/index.tsx
301
302
  import { focusVisibleFocusRingCss as focusVisibleFocusRingCss3 } from "@charcoal-ui/styled";
302
- import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
303
- var MultiSelect = forwardRef6(function MultiSelectInner({
303
+
304
+ // src/components/Icon/index.tsx
305
+ import * as React5 from "react";
306
+ import "@charcoal-ui/icons";
307
+ import { jsx as jsx7 } from "react/jsx-runtime";
308
+ var Icon = React5.forwardRef(function IconInner({
309
+ name,
310
+ scale,
311
+ unsafeNonGuidelineScale,
312
+ className,
313
+ ...rest
314
+ }, ref) {
315
+ return /* @__PURE__ */ jsx7("pixiv-icon", { ref, name, scale, "unsafe-non-guideline-scale": unsafeNonGuidelineScale, class: className, ...rest });
316
+ });
317
+ var Icon_default = Icon;
318
+
319
+ // src/components/MultiSelect/index.tsx
320
+ import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
321
+ var MultiSelect = forwardRef7(function MultiSelectInner({
304
322
  value,
305
323
  disabled = false,
306
324
  onChange,
@@ -337,13 +355,13 @@ var MultiSelect = forwardRef6(function MultiSelectInner({
337
355
  });
338
356
  }, [onChange, parentOnChange, value]);
339
357
  return /* @__PURE__ */ jsxs3(MultiSelectRoot, { "aria-disabled": isDisabled, className, children: [
340
- /* @__PURE__ */ jsx7(MultiSelectInput, { ...{
358
+ /* @__PURE__ */ jsx8(MultiSelectInput, { ...{
341
359
  name,
342
360
  value,
343
361
  invalid
344
362
  }, checked: isSelected, disabled: isDisabled, onChange: handleChange, overlay: variant === "overlay", "aria-invalid": invalid, ref }),
345
- /* @__PURE__ */ jsx7(MultiSelectInputOverlay, { overlay: variant === "overlay", invalid, "aria-hidden": true, children: /* @__PURE__ */ jsx7("pixiv-icon", { name: "24/Check", "unsafe-non-guideline-scale": 16 / 24 }) }),
346
- Boolean(children) && /* @__PURE__ */ jsx7(MultiSelectLabel, { children })
363
+ /* @__PURE__ */ jsx8(MultiSelectInputOverlay, { overlay: variant === "overlay", invalid, "aria-hidden": true, children: /* @__PURE__ */ jsx8(Icon_default, { name: "24/Check", "unsafe-non-guideline-scale": 16 / 24 }) }),
364
+ Boolean(children) && /* @__PURE__ */ jsx8(MultiSelectLabel, { children })
347
365
  ] });
348
366
  });
349
367
  var MultiSelect_default = memo2(MultiSelect);
@@ -396,25 +414,25 @@ function MultiSelectGroup({
396
414
  }
397
415
  }
398
416
  }, [onChange, selected]);
399
- return /* @__PURE__ */ jsx7(MultiSelectGroupContext.Provider, { value: {
417
+ return /* @__PURE__ */ jsx8(MultiSelectGroupContext.Provider, { value: {
400
418
  name,
401
419
  selected: Array.from(new Set(selected)),
402
420
  disabled,
403
421
  readonly,
404
422
  invalid,
405
423
  onChange: handleChange
406
- }, children: /* @__PURE__ */ jsx7("div", { className, "aria-label": label, "data-testid": "SelectGroup", children }) });
424
+ }, children: /* @__PURE__ */ jsx8("div", { className, "aria-label": label, "data-testid": "SelectGroup", children }) });
407
425
  }
408
426
 
409
427
  // src/components/Switch/index.tsx
410
428
  import { useSwitch } from "@react-aria/switch";
411
- import { useMemo as useMemo3, memo as memo3, forwardRef as forwardRef7 } from "react";
429
+ import { useMemo as useMemo3, memo as memo3, forwardRef as forwardRef8 } from "react";
412
430
  import { useToggleState } from "react-stately";
413
431
  import styled5 from "styled-components";
414
432
  import { useObjectRef } from "@react-aria/utils";
415
433
  import { focusVisibleFocusRingCss as focusVisibleFocusRingCss4 } from "@charcoal-ui/styled";
416
- import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
417
- var SwitchCheckbox = forwardRef7(function SwitchCheckboxInner(props, external) {
434
+ import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
435
+ var SwitchCheckbox = forwardRef8(function SwitchCheckboxInner(props, external) {
418
436
  const {
419
437
  disabled,
420
438
  className
@@ -435,8 +453,8 @@ var SwitchCheckbox = forwardRef7(function SwitchCheckboxInner(props, external) {
435
453
  }
436
454
  } = useSwitch(ariaSwitchProps, state, ref);
437
455
  return /* @__PURE__ */ jsxs4(Label, { className, "aria-disabled": disabled, children: [
438
- /* @__PURE__ */ jsx8(SwitchInput, { ...rest, ref }),
439
- "children" in props ? /* @__PURE__ */ jsx8(LabelInner, { children: props.children }) : void 0
456
+ /* @__PURE__ */ jsx9(SwitchInput, { ...rest, ref }),
457
+ "children" in props ? /* @__PURE__ */ jsx9(LabelInner, { children: props.children }) : void 0
440
458
  ] });
441
459
  });
442
460
  var Switch_default = memo3(SwitchCheckbox);
@@ -456,14 +474,14 @@ var SwitchInput = styled5.input.attrs({
456
474
  import { useTextField } from "@react-aria/textfield";
457
475
  import { useVisuallyHidden } from "@react-aria/visually-hidden";
458
476
  import { useCallback as useCallback3, useEffect as useEffect2, useRef, useState } from "react";
459
- import * as React6 from "react";
477
+ import * as React7 from "react";
460
478
  import styled7, { css as css3 } from "styled-components";
461
479
 
462
480
  // src/components/FieldLabel/index.tsx
463
- import * as React5 from "react";
481
+ import * as React6 from "react";
464
482
  import styled6 from "styled-components";
465
- import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
466
- var FieldLabel = React5.forwardRef(function FieldLabel2({
483
+ import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
484
+ var FieldLabel = React6.forwardRef(function FieldLabel2({
467
485
  style,
468
486
  className,
469
487
  label,
@@ -473,9 +491,9 @@ var FieldLabel = React5.forwardRef(function FieldLabel2({
473
491
  ...labelProps
474
492
  }, ref) {
475
493
  return /* @__PURE__ */ jsxs5(FieldLabelWrapper, { style, className, children: [
476
- /* @__PURE__ */ jsx9(Label2, { ref, ...labelProps, children: label }),
477
- required && /* @__PURE__ */ jsx9(RequiredText, { children: requiredText }),
478
- /* @__PURE__ */ jsx9(SubLabelClickable, { children: /* @__PURE__ */ jsx9("span", { children: subLabel }) })
494
+ /* @__PURE__ */ jsx10(Label2, { ref, ...labelProps, children: label }),
495
+ required && /* @__PURE__ */ jsx10(RequiredText, { children: requiredText }),
496
+ /* @__PURE__ */ jsx10(SubLabelClickable, { children: /* @__PURE__ */ jsx10("span", { children: subLabel }) })
479
497
  ] });
480
498
  });
481
499
  var FieldLabel_default = FieldLabel;
@@ -533,11 +551,11 @@ function useFocusWithClick(containerRef, inputRef) {
533
551
 
534
552
  // src/components/TextField/index.tsx
535
553
  import { mergeProps } from "@react-aria/utils";
536
- import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
537
- var TextField = React6.forwardRef(function SingleLineTextFieldInner({
554
+ import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
555
+ var TextField = React7.forwardRef(function SingleLineTextFieldInner({
538
556
  onChange,
539
557
  ...props
540
- }, forwardRef18) {
558
+ }, forwardRef19) {
541
559
  const {
542
560
  className,
543
561
  showLabel = false,
@@ -548,6 +566,7 @@ var TextField = React6.forwardRef(function SingleLineTextFieldInner({
548
566
  disabled = false,
549
567
  required,
550
568
  invalid = false,
569
+ readOnly = false,
551
570
  assistiveText,
552
571
  maxLength,
553
572
  prefix = null,
@@ -582,6 +601,7 @@ var TextField = React6.forwardRef(function SingleLineTextFieldInner({
582
601
  inputElementType: "input",
583
602
  isDisabled: disabled,
584
603
  isRequired: required,
604
+ isReadOnly: readOnly,
585
605
  validationState: invalid ? "invalid" : "valid",
586
606
  description: !invalid && assistiveText,
587
607
  errorMessage: invalid && assistiveText,
@@ -592,16 +612,16 @@ var TextField = React6.forwardRef(function SingleLineTextFieldInner({
592
612
  useFocusWithClick(containerRef, ariaRef);
593
613
  const inputProps = mergeProps(restProps, ariaInputProps);
594
614
  return /* @__PURE__ */ jsxs6(TextFieldRoot, { className, isDisabled: disabled, children: [
595
- /* @__PURE__ */ jsx10(TextFieldLabel, { label, requiredText, required, subLabel, ...labelProps, ...!showLabel ? visuallyHiddenProps : {} }),
615
+ /* @__PURE__ */ jsx11(TextFieldLabel, { label, requiredText, required, subLabel, ...labelProps, ...!showLabel ? visuallyHiddenProps : {} }),
596
616
  /* @__PURE__ */ jsxs6(StyledInputContainer, { ref: containerRef, invalid, "aria-disabled": disabled === true ? true : void 0, hasPrefix: prefix != null, hasSuffix: suffix != null || showCount, children: [
597
- prefix && /* @__PURE__ */ jsx10(PrefixContainer, { children: prefix }),
598
- /* @__PURE__ */ jsx10(StyledInput, { ref: mergeRefs(forwardRef18, ariaRef), invalid, ...inputProps }),
617
+ prefix && /* @__PURE__ */ jsx11(PrefixContainer, { children: prefix }),
618
+ /* @__PURE__ */ jsx11(StyledInput, { ref: mergeRefs(forwardRef19, ariaRef), invalid, ...inputProps }),
599
619
  (suffix || showCount) && /* @__PURE__ */ jsxs6(SuffixContainer, { children: [
600
620
  suffix,
601
- showCount && /* @__PURE__ */ jsx10(SingleLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
621
+ showCount && /* @__PURE__ */ jsx11(SingleLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
602
622
  ] })
603
623
  ] }),
604
- assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ jsx10(AssistiveText, { invalid, ...invalid ? errorMessageProps : descriptionProps, children: assistiveText })
624
+ assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ jsx11(AssistiveText, { invalid, ...invalid ? errorMessageProps : descriptionProps, children: assistiveText })
605
625
  ] });
606
626
  });
607
627
  var TextField_default = TextField;
@@ -635,14 +655,14 @@ var AssistiveText = styled7.p.withConfig({
635
655
  // src/components/TextArea/index.tsx
636
656
  import { useTextField as useTextField2 } from "@react-aria/textfield";
637
657
  import { useVisuallyHidden as useVisuallyHidden2 } from "@react-aria/visually-hidden";
638
- import { forwardRef as forwardRef10, useCallback as useCallback4, useEffect as useEffect3, useRef as useRef2, useState as useState2 } from "react";
658
+ import { forwardRef as forwardRef11, useCallback as useCallback4, useEffect as useEffect3, useRef as useRef2, useState as useState2 } from "react";
639
659
  import styled8, { css as css4 } from "styled-components";
640
660
  import { mergeProps as mergeProps2 } from "@react-aria/utils";
641
- import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
642
- var TextArea = forwardRef10(function TextAreaInner({
661
+ import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
662
+ var TextArea = forwardRef11(function TextAreaInner({
643
663
  onChange,
644
664
  ...props
645
- }, forwardRef18) {
665
+ }, forwardRef19) {
646
666
  const {
647
667
  className,
648
668
  showCount = false,
@@ -653,6 +673,7 @@ var TextArea = forwardRef10(function TextAreaInner({
653
673
  disabled = false,
654
674
  required,
655
675
  invalid = false,
676
+ readOnly = false,
656
677
  assistiveText,
657
678
  maxLength,
658
679
  autoHeight = false,
@@ -697,6 +718,7 @@ var TextArea = forwardRef10(function TextAreaInner({
697
718
  inputElementType: "textarea",
698
719
  isDisabled: disabled,
699
720
  isRequired: required,
721
+ isReadOnly: readOnly,
700
722
  validationState: invalid ? "invalid" : "valid",
701
723
  description: !invalid && assistiveText,
702
724
  errorMessage: invalid && assistiveText,
@@ -712,12 +734,12 @@ var TextArea = forwardRef10(function TextAreaInner({
712
734
  useFocusWithClick(containerRef, ariaRef);
713
735
  const inputProps = mergeProps2(restProps, ariaInputProps);
714
736
  return /* @__PURE__ */ jsxs7(TextFieldRoot2, { className, isDisabled: disabled, children: [
715
- /* @__PURE__ */ jsx11(TextFieldLabel, { label, requiredText, required, subLabel, ...labelProps, ...!showLabel ? visuallyHiddenProps : {} }),
737
+ /* @__PURE__ */ jsx12(TextFieldLabel, { label, requiredText, required, subLabel, ...labelProps, ...!showLabel ? visuallyHiddenProps : {} }),
716
738
  /* @__PURE__ */ jsxs7(StyledTextareaContainer, { ref: containerRef, invalid, rows: showCount ? rows + 1 : rows, "aria-disabled": disabled === true ? "true" : void 0, children: [
717
- /* @__PURE__ */ jsx11(StyledTextarea, { ref: mergeRefs(textareaRef, forwardRef18, ariaRef), rows, noBottomPadding: showCount, ...inputProps }),
718
- showCount && /* @__PURE__ */ jsx11(MultiLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
739
+ /* @__PURE__ */ jsx12(StyledTextarea, { ref: mergeRefs(textareaRef, forwardRef19, ariaRef), rows, noBottomPadding: showCount, ...inputProps }),
740
+ showCount && /* @__PURE__ */ jsx12(MultiLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
719
741
  ] }),
720
- assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ jsx11(AssistiveText, { invalid, ...invalid ? errorMessageProps : descriptionProps, children: assistiveText })
742
+ assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ jsx12(AssistiveText, { invalid, ...invalid ? errorMessageProps : descriptionProps, children: assistiveText })
721
743
  ] });
722
744
  });
723
745
  var TextArea_default = TextArea;
@@ -741,21 +763,6 @@ var MultiLineCounter = styled8.span.withConfig({
741
763
  componentId: "ccl__sc-58waht-3"
742
764
  })(["position:absolute;bottom:9px;right:8px;line-height:22px;font-size:14px;color:var(--charcoal-text3);"]);
743
765
 
744
- // src/components/Icon/index.tsx
745
- import * as React7 from "react";
746
- import "@charcoal-ui/icons";
747
- import { jsx as jsx12 } from "react/jsx-runtime";
748
- var Icon = React7.forwardRef(function IconInner({
749
- name,
750
- scale,
751
- unsafeNonGuidelineScale,
752
- className,
753
- ...rest
754
- }, ref) {
755
- return /* @__PURE__ */ jsx12("pixiv-icon", { ref, name, scale, "unsafe-non-guideline-scale": unsafeNonGuidelineScale, class: className, ...rest });
756
- });
757
- var Icon_default = Icon;
758
-
759
766
  // src/components/Modal/index.tsx
760
767
  import { useContext as useContext4, forwardRef as forwardRef13, memo as memo4 } from "react";
761
768
  import * as React11 from "react";
@@ -770,15 +777,7 @@ import { useObjectRef as useObjectRef2 } from "@react-aria/utils";
770
777
  import { forwardRef as forwardRef12 } from "react";
771
778
  import styled9, { css as css5 } from "styled-components";
772
779
  import { useDialog } from "@react-aria/dialog";
773
-
774
- // ../foundation/src/grid.ts
775
- var COLUMN_UNIT = 80;
776
- var GUTTER_UNIT = 24;
777
- function columnSystem(span, column, gutter) {
778
- return span * column + (span - 1) * gutter;
779
- }
780
-
781
- // src/components/Modal/Dialog/index.tsx
780
+ import { columnSystem, COLUMN_UNIT, GUTTER_UNIT } from "@charcoal-ui/foundation";
782
781
  import { maxWidth } from "@charcoal-ui/utils";
783
782
  import { animated } from "react-spring";
784
783
 
@@ -800,8 +799,8 @@ function useForwardedRef(ref) {
800
799
 
801
800
  // src/components/Modal/Dialog/index.tsx
802
801
  import { jsx as jsx13 } from "react/jsx-runtime";
803
- var Dialog = forwardRef12(function Dialog2(props, forwardRef18) {
804
- const ref = useForwardedRef(forwardRef18);
802
+ var Dialog = forwardRef12(function Dialog2(props, forwardRef19) {
803
+ const ref = useForwardedRef(forwardRef19);
805
804
  const {
806
805
  dialogProps
807
806
  } = useDialog({
@@ -836,7 +835,26 @@ var ModalBackgroundContext = React9.createContext(null);
836
835
 
837
836
  // src/components/Modal/useCustomModalOverlay.tsx
838
837
  import * as React10 from "react";
839
- import { ariaHideOutside, useOverlay, useOverlayFocusContain, usePreventScroll } from "@react-aria/overlays";
838
+ import { ariaHideOutside, useOverlay, useOverlayFocusContain } from "@react-aria/overlays";
839
+
840
+ // src/components/DropdownSelector/Popover/usePreventScroll.tsx
841
+ import { useEffect as useEffect5 } from "react";
842
+ function usePreventScroll(element, isOpen) {
843
+ useEffect5(() => {
844
+ if (isOpen && element) {
845
+ const defaultPaddingRight = element.style.paddingRight;
846
+ const defaultOverflow = element.style.overflow;
847
+ element.style.paddingRight = `${window.innerWidth - element.clientWidth}px`;
848
+ element.style.overflow = "hidden";
849
+ return () => {
850
+ element.style.paddingRight = defaultPaddingRight;
851
+ element.style.overflow = defaultOverflow;
852
+ };
853
+ }
854
+ }, [element, isOpen]);
855
+ }
856
+
857
+ // src/components/Modal/useCustomModalOverlay.tsx
840
858
  function useCharcoalModalOverlay(props, state, ref) {
841
859
  const {
842
860
  overlayProps,
@@ -847,9 +865,7 @@ function useCharcoalModalOverlay(props, state, ref) {
847
865
  onClose: state.onClose,
848
866
  shouldCloseOnInteractOutside: () => false
849
867
  }, ref);
850
- usePreventScroll({
851
- isDisabled: !state.isOpen
852
- });
868
+ usePreventScroll(typeof document !== "undefined" ? document.body : null, state.isOpen);
853
869
  useOverlayFocusContain();
854
870
  React10.useEffect(() => {
855
871
  if (state.isOpen && ref.current) {
@@ -1046,7 +1062,7 @@ var LoadingSpinnerIcon = forwardRef14(function LoadingSpinnerIcon2({
1046
1062
  });
1047
1063
 
1048
1064
  // src/components/DropdownSelector/index.tsx
1049
- import { useState as useState3, useRef as useRef9, useMemo as useMemo5 } from "react";
1065
+ import { useState as useState3, useRef as useRef9, useMemo as useMemo5, useCallback as useCallback6 } from "react";
1050
1066
  import styled15, { css as css8 } from "styled-components";
1051
1067
  import { disabledSelector as disabledSelector2 } from "@charcoal-ui/utils";
1052
1068
 
@@ -1057,25 +1073,6 @@ import { useEffect as useEffect7, useRef as useRef7 } from "react";
1057
1073
  import { useContext as useContext6, useRef as useRef6 } from "react";
1058
1074
  import { DismissButton, Overlay as Overlay2, usePopover } from "@react-aria/overlays";
1059
1075
  import styled13 from "styled-components";
1060
-
1061
- // src/components/DropdownSelector/Popover/usePreventScroll.tsx
1062
- import { useEffect as useEffect6 } from "react";
1063
- function usePreventScroll2(element, isOpen) {
1064
- useEffect6(() => {
1065
- if (isOpen && element) {
1066
- const defaultPaddingRight = element.style.paddingRight;
1067
- const defaultOverflow = element.style.overflow;
1068
- element.style.paddingRight = `${window.innerWidth - element.clientWidth}px`;
1069
- element.style.overflow = "hidden";
1070
- return () => {
1071
- element.style.paddingRight = defaultPaddingRight;
1072
- element.style.overflow = defaultOverflow;
1073
- };
1074
- }
1075
- }, [element, isOpen]);
1076
- }
1077
-
1078
- // src/components/DropdownSelector/Popover/index.tsx
1079
1076
  import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
1080
1077
  var _empty = () => null;
1081
1078
  function Popover(props) {
@@ -1096,7 +1093,7 @@ function Popover(props) {
1096
1093
  toggle: _empty
1097
1094
  });
1098
1095
  const modalBackground = useContext6(ModalBackgroundContext);
1099
- usePreventScroll2(modalBackground, props.isOpen);
1096
+ usePreventScroll(modalBackground, props.isOpen);
1100
1097
  if (!props.isOpen)
1101
1098
  return null;
1102
1099
  return /* @__PURE__ */ jsxs9(Overlay2, { portalContainer: document.body, children: [
@@ -1224,7 +1221,10 @@ import { focusVisibleFocusRingCss as focusVisibleFocusRingCss5 } from "@charcoal
1224
1221
  import { useVisuallyHidden as useVisuallyHidden3 } from "@react-aria/visually-hidden";
1225
1222
  import { jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
1226
1223
  var defaultRequiredText = "*\u5FC5\u9808";
1227
- function DropdownSelector(props) {
1224
+ function DropdownSelector({
1225
+ onChange,
1226
+ ...props
1227
+ }) {
1228
1228
  const triggerRef = useRef9(null);
1229
1229
  const [isOpen, setIsOpen] = useState3(false);
1230
1230
  const preview = findPreviewRecursive(props.children, props.value);
@@ -1233,9 +1233,12 @@ function DropdownSelector(props) {
1233
1233
  const {
1234
1234
  visuallyHiddenProps
1235
1235
  } = useVisuallyHidden3();
1236
+ const handleChange = useCallback6((e) => {
1237
+ onChange(e.target.value);
1238
+ }, [onChange]);
1236
1239
  return /* @__PURE__ */ jsxs10(DropdownSelectorRoot, { "aria-disabled": props.disabled, children: [
1237
1240
  props.showLabel === true && /* @__PURE__ */ jsx20(DropdownFieldLabel, { label: props.label, required: props.required, requiredText: props.requiredText ?? defaultRequiredText, subLabel: props.subLabel }),
1238
- /* @__PURE__ */ jsx20("div", { ...visuallyHiddenProps, "aria-hidden": "true", children: /* @__PURE__ */ jsx20("select", { name: props.name, value: props.value, tabIndex: -1, children: propsArray.map((itemProps) => {
1241
+ /* @__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) => {
1239
1242
  return /* @__PURE__ */ jsx20("option", { value: itemProps.value, disabled: itemProps.disabled, children: itemProps.value }, itemProps.value);
1240
1243
  }) }) }),
1241
1244
  /* @__PURE__ */ jsxs10(DropdownButton, { invalid: props.invalid, disabled: props.disabled, onClick: () => {
@@ -1247,7 +1250,7 @@ function DropdownSelector(props) {
1247
1250
  /* @__PURE__ */ jsx20(DropdownButtonIcon, { name: "16/Menu" })
1248
1251
  ] }),
1249
1252
  isOpen && /* @__PURE__ */ jsx20(DropdownPopover, { isOpen, onClose: () => setIsOpen(false), triggerRef, value: props.value, children: /* @__PURE__ */ jsx20(MenuList, { value: props.value, onChange: (v) => {
1250
- props.onChange(v);
1253
+ onChange(v);
1251
1254
  setIsOpen(false);
1252
1255
  }, children: props.children }) }),
1253
1256
  props.assistiveText !== void 0 && /* @__PURE__ */ jsx20(AssertiveText, { invalid: props.invalid, children: props.assistiveText })
@@ -1299,7 +1302,7 @@ var ItemDiv = styled16.div.withConfig({
1299
1302
  })(["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);}}"]);
1300
1303
 
1301
1304
  // src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx
1302
- import { useCallback as useCallback6, useContext as useContext7 } from "react";
1305
+ import { useCallback as useCallback7, useContext as useContext7 } from "react";
1303
1306
 
1304
1307
  // src/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.tsx
1305
1308
  function handleFocusByKeyBoard(element, parent) {
@@ -1337,11 +1340,11 @@ function useMenuItemHandleKeyDown(value) {
1337
1340
  root,
1338
1341
  propsArray
1339
1342
  } = useContext7(MenuListContext);
1340
- const setContextValue = useCallback6(() => {
1343
+ const setContextValue = useCallback7(() => {
1341
1344
  if (value !== void 0)
1342
1345
  setValue(value);
1343
1346
  }, [value, setValue]);
1344
- const handleKeyDown = useCallback6((e) => {
1347
+ const handleKeyDown = useCallback7((e) => {
1345
1348
  if (e.key === "Enter") {
1346
1349
  setContextValue();
1347
1350
  } else if (e.key === "ArrowUp" || e.key === "ArrowDown") {
@@ -1434,232 +1437,7 @@ var StyledLi2 = styled18.li.withConfig({
1434
1437
 
1435
1438
  // src/components/SegmentedControl/index.tsx
1436
1439
  import { forwardRef as forwardRef15, memo as memo6, useMemo as useMemo6, useRef as useRef10 } from "react";
1437
-
1438
- // ../../node_modules/@react-stately/form/dist/import.mjs
1439
- 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";
1440
- var $e5be200c675c3b3a$export$aca958c65c314e6c = {
1441
- badInput: false,
1442
- customError: false,
1443
- patternMismatch: false,
1444
- rangeOverflow: false,
1445
- rangeUnderflow: false,
1446
- stepMismatch: false,
1447
- tooLong: false,
1448
- tooShort: false,
1449
- typeMismatch: false,
1450
- valueMissing: false,
1451
- valid: true
1452
- };
1453
- var $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE = {
1454
- ...$e5be200c675c3b3a$export$aca958c65c314e6c,
1455
- customError: true,
1456
- valid: false
1457
- };
1458
- var $e5be200c675c3b3a$export$dad6ae84456c676a = {
1459
- isInvalid: false,
1460
- validationDetails: $e5be200c675c3b3a$export$aca958c65c314e6c,
1461
- validationErrors: []
1462
- };
1463
- var $e5be200c675c3b3a$export$571b5131b7e65c11 = (0, $jcIOw$createContext)({});
1464
- var $e5be200c675c3b3a$export$a763b9476acd3eb = "__formValidationState" + Date.now();
1465
- function $e5be200c675c3b3a$export$fc1a364ae1f3ff10(props) {
1466
- if (props[$e5be200c675c3b3a$export$a763b9476acd3eb]) {
1467
- let {
1468
- realtimeValidation,
1469
- displayValidation,
1470
- updateValidation,
1471
- resetValidation,
1472
- commitValidation
1473
- } = props[$e5be200c675c3b3a$export$a763b9476acd3eb];
1474
- return {
1475
- realtimeValidation,
1476
- displayValidation,
1477
- updateValidation,
1478
- resetValidation,
1479
- commitValidation
1480
- };
1481
- }
1482
- return $e5be200c675c3b3a$var$useFormValidationStateImpl(props);
1483
- }
1484
- function $e5be200c675c3b3a$var$useFormValidationStateImpl(props) {
1485
- let {
1486
- isInvalid,
1487
- validationState,
1488
- name,
1489
- value,
1490
- builtinValidation,
1491
- validate,
1492
- validationBehavior = "aria"
1493
- } = props;
1494
- if (validationState)
1495
- isInvalid || (isInvalid = validationState === "invalid");
1496
- let controlledError = isInvalid ? {
1497
- isInvalid: true,
1498
- validationErrors: [],
1499
- validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE
1500
- } : null;
1501
- let clientError = (0, $jcIOw$useMemo)(() => $e5be200c675c3b3a$var$getValidationResult($e5be200c675c3b3a$var$runValidate(validate, value)), [validate, value]);
1502
- if (builtinValidation === null || builtinValidation === void 0 ? void 0 : builtinValidation.validationDetails.valid)
1503
- builtinValidation = null;
1504
- let serverErrors = (0, $jcIOw$useContext)($e5be200c675c3b3a$export$571b5131b7e65c11);
1505
- let serverErrorMessages = (0, $jcIOw$useMemo)(() => {
1506
- if (name)
1507
- return Array.isArray(name) ? name.flatMap((name2) => $e5be200c675c3b3a$var$asArray(serverErrors[name2])) : $e5be200c675c3b3a$var$asArray(serverErrors[name]);
1508
- return [];
1509
- }, [serverErrors, name]);
1510
- let [lastServerErrors, setLastServerErrors] = (0, $jcIOw$useState)(serverErrors);
1511
- let [isServerErrorCleared, setServerErrorCleared] = (0, $jcIOw$useState)(false);
1512
- if (serverErrors !== lastServerErrors) {
1513
- setLastServerErrors(serverErrors);
1514
- setServerErrorCleared(false);
1515
- }
1516
- let serverError = (0, $jcIOw$useMemo)(() => $e5be200c675c3b3a$var$getValidationResult(isServerErrorCleared ? [] : serverErrorMessages), [isServerErrorCleared, serverErrorMessages]);
1517
- let nextValidation = (0, $jcIOw$useRef)($e5be200c675c3b3a$export$dad6ae84456c676a);
1518
- let [currentValidity, setCurrentValidity] = (0, $jcIOw$useState)($e5be200c675c3b3a$export$dad6ae84456c676a);
1519
- let lastError = (0, $jcIOw$useRef)($e5be200c675c3b3a$export$dad6ae84456c676a);
1520
- let commitValidation = () => {
1521
- if (!commitQueued)
1522
- return;
1523
- setCommitQueued(false);
1524
- let error = clientError || builtinValidation || nextValidation.current;
1525
- if (!$e5be200c675c3b3a$var$isEqualValidation(error, lastError.current)) {
1526
- lastError.current = error;
1527
- setCurrentValidity(error);
1528
- }
1529
- };
1530
- let [commitQueued, setCommitQueued] = (0, $jcIOw$useState)(false);
1531
- (0, $jcIOw$useEffect)(commitValidation);
1532
- let realtimeValidation = controlledError || serverError || clientError || builtinValidation || $e5be200c675c3b3a$export$dad6ae84456c676a;
1533
- let displayValidation = validationBehavior === "native" ? controlledError || serverError || currentValidity : controlledError || serverError || clientError || builtinValidation || currentValidity;
1534
- return {
1535
- realtimeValidation,
1536
- displayValidation,
1537
- updateValidation(value2) {
1538
- if (validationBehavior === "aria" && !$e5be200c675c3b3a$var$isEqualValidation(currentValidity, value2))
1539
- setCurrentValidity(value2);
1540
- else
1541
- nextValidation.current = value2;
1542
- },
1543
- resetValidation() {
1544
- let error = $e5be200c675c3b3a$export$dad6ae84456c676a;
1545
- if (!$e5be200c675c3b3a$var$isEqualValidation(error, lastError.current)) {
1546
- lastError.current = error;
1547
- setCurrentValidity(error);
1548
- }
1549
- if (validationBehavior === "native")
1550
- setCommitQueued(false);
1551
- setServerErrorCleared(true);
1552
- },
1553
- commitValidation() {
1554
- if (validationBehavior === "native")
1555
- setCommitQueued(true);
1556
- setServerErrorCleared(true);
1557
- }
1558
- };
1559
- }
1560
- function $e5be200c675c3b3a$var$asArray(v) {
1561
- if (!v)
1562
- return [];
1563
- return Array.isArray(v) ? v : [v];
1564
- }
1565
- function $e5be200c675c3b3a$var$runValidate(validate, value) {
1566
- if (typeof validate === "function") {
1567
- let e = validate(value);
1568
- if (e && typeof e !== "boolean")
1569
- return $e5be200c675c3b3a$var$asArray(e);
1570
- }
1571
- return [];
1572
- }
1573
- function $e5be200c675c3b3a$var$getValidationResult(errors) {
1574
- return errors.length ? {
1575
- isInvalid: true,
1576
- validationErrors: errors,
1577
- validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE
1578
- } : null;
1579
- }
1580
- function $e5be200c675c3b3a$var$isEqualValidation(a, b) {
1581
- if (a === b)
1582
- return true;
1583
- 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);
1584
- }
1585
-
1586
- // ../../node_modules/@react-stately/utils/dist/import.mjs
1587
- import { useState as $6imuh$useState, useRef as $6imuh$useRef, useEffect as $6imuh$useEffect, useCallback as $6imuh$useCallback } from "react";
1588
- function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange) {
1589
- let [stateValue, setStateValue] = (0, $6imuh$useState)(value || defaultValue);
1590
- let isControlledRef = (0, $6imuh$useRef)(value !== void 0);
1591
- let isControlled = value !== void 0;
1592
- (0, $6imuh$useEffect)(() => {
1593
- let wasControlled = isControlledRef.current;
1594
- if (wasControlled !== isControlled)
1595
- console.warn(`WARN: A component changed from ${wasControlled ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}.`);
1596
- isControlledRef.current = isControlled;
1597
- }, [isControlled]);
1598
- let currentValue = isControlled ? value : stateValue;
1599
- let setValue = (0, $6imuh$useCallback)((value2, ...args) => {
1600
- let onChangeCaller = (value3, ...onChangeArgs) => {
1601
- if (onChange) {
1602
- if (!Object.is(currentValue, value3))
1603
- onChange(value3, ...onChangeArgs);
1604
- }
1605
- if (!isControlled)
1606
- currentValue = value3;
1607
- };
1608
- if (typeof value2 === "function") {
1609
- console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320");
1610
- let updateFunction = (oldValue, ...functionArgs) => {
1611
- let interceptedValue = value2(isControlled ? currentValue : oldValue, ...functionArgs);
1612
- onChangeCaller(interceptedValue, ...args);
1613
- if (!isControlled)
1614
- return interceptedValue;
1615
- return oldValue;
1616
- };
1617
- setStateValue(updateFunction);
1618
- } else {
1619
- if (!isControlled)
1620
- setStateValue(value2);
1621
- onChangeCaller(value2, ...args);
1622
- }
1623
- }, [isControlled, currentValue, onChange]);
1624
- return [currentValue, setValue];
1625
- }
1626
-
1627
- // ../../node_modules/@react-stately/radio/dist/import.mjs
1628
- import { useMemo as $fQ2SF$useMemo, useState as $fQ2SF$useState } from "react";
1629
- var $a54cdc5c1942b639$var$instance = Math.round(Math.random() * 1e10);
1630
- var $a54cdc5c1942b639$var$i = 0;
1631
- function $a54cdc5c1942b639$export$bca9d026f8e704eb(props) {
1632
- let name = (0, $fQ2SF$useMemo)(() => props.name || `radio-group-${$a54cdc5c1942b639$var$instance}-${++$a54cdc5c1942b639$var$i}`, [props.name]);
1633
- var _props_defaultValue;
1634
- let [selectedValue, setSelected] = (0, $458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : null, props.onChange);
1635
- let [lastFocusedValue, setLastFocusedValue] = (0, $fQ2SF$useState)(null);
1636
- let validation = (0, $e5be200c675c3b3a$export$fc1a364ae1f3ff10)({
1637
- ...props,
1638
- value: selectedValue
1639
- });
1640
- let setSelectedValue = (value) => {
1641
- if (!props.isReadOnly && !props.isDisabled) {
1642
- setSelected(value);
1643
- validation.commitValidation();
1644
- }
1645
- };
1646
- let isInvalid = validation.displayValidation.isInvalid;
1647
- return {
1648
- ...validation,
1649
- name,
1650
- selectedValue,
1651
- setSelectedValue,
1652
- lastFocusedValue,
1653
- setLastFocusedValue,
1654
- isDisabled: props.isDisabled || false,
1655
- isReadOnly: props.isReadOnly || false,
1656
- isRequired: props.isRequired || false,
1657
- validationState: props.validationState || (isInvalid ? "invalid" : null),
1658
- isInvalid
1659
- };
1660
- }
1661
-
1662
- // src/components/SegmentedControl/index.tsx
1440
+ import { useRadioGroupState } from "@react-stately/radio";
1663
1441
  import { useRadio, useRadioGroup } from "@react-aria/radio";
1664
1442
  import styled19, { css as css9 } from "styled-components";
1665
1443
 
@@ -1690,7 +1468,7 @@ var SegmentedControl = forwardRef15(function SegmentedControlInner(props, ref) {
1690
1468
  isRequired: props.required,
1691
1469
  "aria-label": props.name
1692
1470
  }), [props]);
1693
- const state = $a54cdc5c1942b639$export$bca9d026f8e704eb(ariaRadioGroupProps);
1471
+ const state = useRadioGroupState(ariaRadioGroupProps);
1694
1472
  const {
1695
1473
  radioGroupProps
1696
1474
  } = useRadioGroup(ariaRadioGroupProps, state);
@@ -1740,73 +1518,65 @@ var SegmentedLabelInner = styled19.div.withConfig({
1740
1518
  })(["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;}"]);
1741
1519
 
1742
1520
  // src/components/Checkbox/index.tsx
1743
- import { forwardRef as forwardRef16, memo as memo7, useMemo as useMemo7 } from "react";
1744
- import styled20, { css as css10 } from "styled-components";
1745
- import { useCheckbox } from "@react-aria/checkbox";
1746
- import { useObjectRef as useObjectRef3 } from "@react-aria/utils";
1747
- import { useToggleState as useToggleState2 } from "react-stately";
1748
- import { focusVisibleFocusRingCss as focusVisibleFocusRingCss6 } from "@charcoal-ui/styled";
1521
+ import { forwardRef as forwardRef17, memo as memo8 } from "react";
1522
+ import { useId } from "@react-aria/utils";
1523
+
1524
+ // src/components/CheckboxInput/index.tsx
1525
+ import { forwardRef as forwardRef16, memo as memo7, useCallback as useCallback8 } from "react";
1749
1526
  import { jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
1750
- var Checkbox = forwardRef16(function CheckboxInner({
1751
- invalid = false,
1527
+ var CheckboxInput = forwardRef16(function CheckboxInput2({
1528
+ onChange,
1529
+ checked,
1530
+ invalid,
1752
1531
  ...props
1753
1532
  }, ref) {
1754
- const ariaCheckboxProps = useMemo7(() => ({
1755
- ...props,
1756
- isInValid: invalid,
1757
- isSelected: props.checked,
1758
- defaultSelected: props.defaultChecked,
1759
- validationState: invalid ? "invalid" : "valid",
1760
- "aria-label": "children" in props ? void 0 : props.label,
1761
- isDisabled: props.disabled
1762
- }), [invalid, props]);
1763
- const state = useToggleState2(ariaCheckboxProps);
1764
- const objectRef = useObjectRef3(ref);
1765
- const {
1766
- inputProps
1767
- } = useCheckbox(ariaCheckboxProps, state, objectRef);
1768
- const isDisabled = (props.disabled ?? false) || (props.readonly ?? false);
1769
- return /* @__PURE__ */ jsxs14(InputRoot, { "aria-disabled": isDisabled, className: props.className, children: [
1770
- /* @__PURE__ */ jsxs14(CheckboxRoot, { children: [
1771
- /* @__PURE__ */ jsx27(CheckboxInput, { type: "checkbox", ...inputProps, readOnly: props.readonly }),
1772
- /* @__PURE__ */ jsx27(CheckboxInputOverlay, { "aria-hidden": true, checked: inputProps.checked, children: /* @__PURE__ */ jsx27(Icon_default, { name: "24/Check", unsafeNonGuidelineScale: 2 / 3 }) })
1773
- ] }),
1774
- "children" in props && /* @__PURE__ */ jsx27(InputLabel, { children: props.children })
1533
+ const handleChange = useCallback8((e) => {
1534
+ const el = e.currentTarget;
1535
+ onChange?.(el.checked);
1536
+ }, [onChange]);
1537
+ const classNames = useClassNames("charcoal-checkbox-input__root", props.className);
1538
+ return /* @__PURE__ */ jsxs14("div", { className: classNames, children: [
1539
+ /* @__PURE__ */ jsx27("input", { ref, className: "charcoal-checkbox-input__input", type: "checkbox", onChange: handleChange, "aria-invalid": invalid, checked, ...props }),
1540
+ /* @__PURE__ */ jsx27("div", { className: "charcoal-checkbox-input__overlay", "aria-hidden": true, "data-checked": checked, children: /* @__PURE__ */ jsx27(Icon_default, { name: "24/Check", unsafeNonGuidelineScale: 2 / 3 }) })
1541
+ ] });
1542
+ });
1543
+ var CheckboxInput_default = memo7(CheckboxInput);
1544
+
1545
+ // src/components/Checkbox/index.tsx
1546
+ import { jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
1547
+ var Checkbox = forwardRef17(function CheckboxInner({
1548
+ disabled,
1549
+ className,
1550
+ id,
1551
+ children,
1552
+ ...props
1553
+ }, ref) {
1554
+ const classNames = useClassNames("charcoal-checkbox__label", className);
1555
+ const htmlId = useId(id);
1556
+ const input = /* @__PURE__ */ jsx28(CheckboxInput_default, { ...props, id: htmlId, disabled, ref });
1557
+ if (children === void 0) {
1558
+ return input;
1559
+ }
1560
+ return /* @__PURE__ */ jsxs15("label", { htmlFor: htmlId, "aria-disabled": disabled, className: classNames, children: [
1561
+ input,
1562
+ /* @__PURE__ */ jsx28("div", { className: "charcoal-checkbox__text", children })
1775
1563
  ] });
1776
1564
  });
1777
- var Checkbox_default = memo7(Checkbox);
1778
- var hiddenCss = css10(["visibility:hidden;"]);
1779
- var InputRoot = styled20.label.withConfig({
1780
- componentId: "ccl__sc-wrdmwj-0"
1781
- })(["position:relative;display:flex;cursor:pointer;gap:4px;&:disabled,&[aria-disabled]:not([aria-disabled='false']){cursor:default;opacity:0.32;}"]);
1782
- var CheckboxRoot = styled20.div.withConfig({
1783
- componentId: "ccl__sc-wrdmwj-1"
1784
- })(["position:relative;"]);
1785
- var CheckboxInput = styled20.input.withConfig({
1786
- componentId: "ccl__sc-wrdmwj-2"
1787
- })(["&[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);}}"], focusVisibleFocusRingCss6);
1788
- var CheckboxInputOverlay = styled20.div.withConfig({
1789
- componentId: "ccl__sc-wrdmwj-3"
1790
- })(["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);", ";"], ({
1791
- checked
1792
- }) => checked !== true && hiddenCss);
1793
- var InputLabel = styled20.div.withConfig({
1794
- componentId: "ccl__sc-wrdmwj-4"
1795
- })(["color:var(--charcoal-text2);font-size:14px;line-height:20px;"]);
1565
+ var Checkbox_default = memo8(Checkbox);
1796
1566
 
1797
1567
  // src/components/TagItem/index.tsx
1798
- import { forwardRef as forwardRef17, memo as memo8, useMemo as useMemo8 } from "react";
1799
- import { useObjectRef as useObjectRef4 } from "@react-aria/utils";
1800
- import styled21, { css as css11 } from "styled-components";
1568
+ import { forwardRef as forwardRef18, memo as memo9, useMemo as useMemo7 } from "react";
1569
+ import { useObjectRef as useObjectRef3 } from "@react-aria/utils";
1570
+ import styled20, { css as css10 } from "styled-components";
1801
1571
  import { px as px2 } from "@charcoal-ui/utils";
1802
1572
  import { useButton } from "@react-aria/button";
1803
- import { focusVisibleFocusRingCss as focusVisibleFocusRingCss7 } from "@charcoal-ui/styled";
1804
- import { jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
1573
+ import { focusVisibleFocusRingCss as focusVisibleFocusRingCss6 } from "@charcoal-ui/styled";
1574
+ import { jsx as jsx29, jsxs as jsxs16 } from "react/jsx-runtime";
1805
1575
  var sizeMap = {
1806
1576
  S: 32,
1807
1577
  M: 40
1808
1578
  };
1809
- var TagItem = forwardRef17(function TagItemInner({
1579
+ var TagItem = forwardRef18(function TagItemInner({
1810
1580
  label,
1811
1581
  translatedLabel,
1812
1582
  bgColor = "#7ACCB1",
@@ -1817,8 +1587,8 @@ var TagItem = forwardRef17(function TagItemInner({
1817
1587
  className,
1818
1588
  ...props
1819
1589
  }, _ref) {
1820
- const ref = useObjectRef4(_ref);
1821
- const ariaButtonProps = useMemo8(() => ({
1590
+ const ref = useObjectRef3(_ref);
1591
+ const ariaButtonProps = useMemo7(() => ({
1822
1592
  elementType: "a",
1823
1593
  isDisabled: disabled,
1824
1594
  ...props
@@ -1827,22 +1597,22 @@ var TagItem = forwardRef17(function TagItemInner({
1827
1597
  buttonProps
1828
1598
  } = useButton(ariaButtonProps, ref);
1829
1599
  const hasTranslatedLabel = translatedLabel !== void 0 && translatedLabel.length > 0;
1830
- return /* @__PURE__ */ jsxs15(TagItemRoot, { ref, size: hasTranslatedLabel ? "M" : size, status, ...buttonProps, className, children: [
1831
- /* @__PURE__ */ jsx28(Background, { bgColor, bgImage, status }),
1832
- /* @__PURE__ */ jsxs15(Inner, { children: [
1833
- /* @__PURE__ */ jsxs15(LabelWrapper, { isTranslate: hasTranslatedLabel, children: [
1834
- hasTranslatedLabel && /* @__PURE__ */ jsx28(TranslatedLabel, { children: /* @__PURE__ */ jsx28(Label3, { children: translatedLabel }) }),
1835
- /* @__PURE__ */ jsx28(Label3, { children: label })
1600
+ return /* @__PURE__ */ jsxs16(TagItemRoot, { ref, size: hasTranslatedLabel ? "M" : size, status, ...buttonProps, className, children: [
1601
+ /* @__PURE__ */ jsx29(Background, { bgColor, bgImage, status }),
1602
+ /* @__PURE__ */ jsxs16(Inner, { children: [
1603
+ /* @__PURE__ */ jsxs16(LabelWrapper, { isTranslate: hasTranslatedLabel, children: [
1604
+ hasTranslatedLabel && /* @__PURE__ */ jsx29(TranslatedLabel, { children: /* @__PURE__ */ jsx29(Label3, { children: translatedLabel }) }),
1605
+ /* @__PURE__ */ jsx29(Label3, { children: label })
1836
1606
  ] }),
1837
- status === "active" && /* @__PURE__ */ jsx28(Icon_default, { name: "16/Remove" })
1607
+ status === "active" && /* @__PURE__ */ jsx29(Icon_default, { name: "16/Remove" })
1838
1608
  ] })
1839
1609
  ] });
1840
1610
  });
1841
- var TagItem_default = memo8(TagItem);
1611
+ var TagItem_default = memo9(TagItem);
1842
1612
  var horizontalPadding = ({
1843
1613
  left,
1844
1614
  right
1845
- }) => css11(["padding-right:", ";padding-left:", ";"], px2(right), px2(left));
1615
+ }) => css10(["padding-right:", ";padding-left:", ";"], px2(right), px2(left));
1846
1616
  var tagItemRootSize = (size) => {
1847
1617
  switch (size) {
1848
1618
  case "M":
@@ -1861,7 +1631,7 @@ var activeTagItemRoot = horizontalPadding({
1861
1631
  left: 16,
1862
1632
  right: 8
1863
1633
  });
1864
- var TagItemRoot = styled21.a.withConfig({
1634
+ var TagItemRoot = styled20.a.withConfig({
1865
1635
  componentId: "ccl__sc-11j9pu2-0"
1866
1636
  })(["isolation:isolate;position:relative;height:", "px;display:inline-flex;align-items:center;justify-content:center;text-decoration:none;cursor:pointer;overflow:hidden;border-radius:4px;", " ", " color:", ";transition:0.2s box-shadow;&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{", "}&:disabled,&[aria-disabled]:not([aria-disabled='false']){opacity:0.32;cursor:default;}"], ({
1867
1637
  size
@@ -1872,30 +1642,30 @@ var TagItemRoot = styled21.a.withConfig({
1872
1642
  status
1873
1643
  }) => status === "active" && activeTagItemRoot, ({
1874
1644
  status
1875
- }) => status === "inactive" ? "var(--charcoal-text2)" : "var(--charcoal-text5)", focusVisibleFocusRingCss7);
1876
- var Background = styled21.div.withConfig({
1645
+ }) => status === "inactive" ? "var(--charcoal-text2)" : "var(--charcoal-text5)", focusVisibleFocusRingCss6);
1646
+ var Background = styled20.div.withConfig({
1877
1647
  componentId: "ccl__sc-11j9pu2-1"
1878
1648
  })(["position:absolute;z-index:1;top:0;left:0;width:100%;height:100%;background-color:", ";", " ", ""], ({
1879
1649
  bgColor
1880
1650
  }) => bgColor, ({
1881
1651
  status
1882
- }) => status === "inactive" && css11(["background-color:var(--charcoal-surface3);"]), ({
1652
+ }) => status === "inactive" && css10(["background-color:var(--charcoal-surface3);"]), ({
1883
1653
  bgImage
1884
- }) => bgImage !== void 0 && css11(["background-color:var(--charcoal-surface4);&::before{content:'';position:absolute;top:0;left:0;width:100%;height:100%;background-position:center;background-size:cover;background-image:url(", ");mix-blend-mode:overlay;}"], bgImage));
1885
- var Inner = styled21.div.withConfig({
1654
+ }) => bgImage !== void 0 && css10(["background-color:var(--charcoal-surface4);&::before{content:'';position:absolute;top:0;left:0;width:100%;height:100%;background-position:center;background-size:cover;background-image:url(", ");mix-blend-mode:overlay;}"], bgImage));
1655
+ var Inner = styled20.div.withConfig({
1886
1656
  componentId: "ccl__sc-11j9pu2-2"
1887
1657
  })(["display:inline-flex;gap:8px;align-items:center;z-index:2;"]);
1888
- var labelCSS = css11(["font-size:14px;line-height:22px;font-weight:bold;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;}"]);
1889
- var translateLabelCSS = css11(["display:flex;align-items:center;flex-direction:column;font-size:10px;"]);
1890
- var LabelWrapper = styled21.div.withConfig({
1658
+ var labelCSS = css10(["font-size:14px;line-height:22px;font-weight:bold;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;}"]);
1659
+ var translateLabelCSS = css10(["display:flex;align-items:center;flex-direction:column;font-size:10px;"]);
1660
+ var LabelWrapper = styled20.div.withConfig({
1891
1661
  componentId: "ccl__sc-11j9pu2-3"
1892
1662
  })(["", ""], ({
1893
1663
  isTranslate
1894
1664
  }) => isTranslate ?? false ? translateLabelCSS : labelCSS);
1895
- var Label3 = styled21.span.withConfig({
1665
+ var Label3 = styled20.span.withConfig({
1896
1666
  componentId: "ccl__sc-11j9pu2-4"
1897
1667
  })(["max-width:152px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:inherit;color:inherit;line-height:inherit;"]);
1898
- var TranslatedLabel = styled21.div.withConfig({
1668
+ var TranslatedLabel = styled20.div.withConfig({
1899
1669
  componentId: "ccl__sc-11j9pu2-5"
1900
1670
  })(["font-size:12px;line-height:20px;font-weight:bold;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;}"]);
1901
1671
  export {