@charcoal-ui/react 4.0.0-beta.1 → 4.0.0-beta.11

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 (265) hide show
  1. package/README.md +1 -1
  2. package/dist/_lib/compat.d.ts +0 -12
  3. package/dist/_lib/compat.d.ts.map +1 -1
  4. package/dist/_lib/createDivComponent.d.ts +4 -0
  5. package/dist/_lib/createDivComponent.d.ts.map +1 -0
  6. package/dist/_lib/useClassNames.d.ts +2 -2
  7. package/dist/_lib/useClassNames.d.ts.map +1 -1
  8. package/dist/components/Button/index.d.ts +5 -1
  9. package/dist/components/Button/index.d.ts.map +1 -1
  10. package/dist/components/Checkbox/CheckboxInput/index.d.ts +11 -0
  11. package/dist/components/Checkbox/CheckboxInput/index.d.ts.map +1 -0
  12. package/dist/components/Checkbox/CheckboxWithLabel.d.ts +9 -0
  13. package/dist/components/Checkbox/CheckboxWithLabel.d.ts.map +1 -0
  14. package/dist/components/Checkbox/index.d.ts +12 -21
  15. package/dist/components/Checkbox/index.d.ts.map +1 -1
  16. package/dist/components/Clickable/index.d.ts +9 -15
  17. package/dist/components/Clickable/index.d.ts.map +1 -1
  18. package/dist/components/DropdownSelector/Divider/index.d.ts +3 -0
  19. package/dist/components/DropdownSelector/Divider/index.d.ts.map +1 -0
  20. package/dist/components/DropdownSelector/DropdownMenuItem/index.d.ts +8 -0
  21. package/dist/components/DropdownSelector/DropdownMenuItem/index.d.ts.map +1 -0
  22. package/dist/components/DropdownSelector/DropdownPopover.d.ts.map +1 -1
  23. package/dist/components/DropdownSelector/ListItem/index.d.ts +5 -13
  24. package/dist/components/DropdownSelector/ListItem/index.d.ts.map +1 -1
  25. package/dist/components/DropdownSelector/MenuItem/index.d.ts +10 -3
  26. package/dist/components/DropdownSelector/MenuItem/index.d.ts.map +1 -1
  27. package/dist/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.d.ts +1 -1
  28. package/dist/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.d.ts.map +1 -1
  29. package/dist/components/DropdownSelector/MenuItemGroup/index.d.ts +1 -3
  30. package/dist/components/DropdownSelector/MenuItemGroup/index.d.ts.map +1 -1
  31. package/dist/components/DropdownSelector/MenuList/index.d.ts +1 -4
  32. package/dist/components/DropdownSelector/MenuList/index.d.ts.map +1 -1
  33. package/dist/components/DropdownSelector/Popover/index.d.ts +2 -2
  34. package/dist/components/DropdownSelector/Popover/index.d.ts.map +1 -1
  35. package/dist/components/DropdownSelector/index.d.ts +3 -1
  36. package/dist/components/DropdownSelector/index.d.ts.map +1 -1
  37. package/dist/components/FieldLabel/index.d.ts +1 -0
  38. package/dist/components/FieldLabel/index.d.ts.map +1 -1
  39. package/dist/components/IconButton/index.d.ts +7 -5
  40. package/dist/components/IconButton/index.d.ts.map +1 -1
  41. package/dist/components/LoadingSpinner/index.d.ts +1 -0
  42. package/dist/components/LoadingSpinner/index.d.ts.map +1 -1
  43. package/dist/components/Modal/Dialog/index.d.ts +6 -24
  44. package/dist/components/Modal/Dialog/index.d.ts.map +1 -1
  45. package/dist/components/Modal/ModalPlumbing.d.ts +10 -3
  46. package/dist/components/Modal/ModalPlumbing.d.ts.map +1 -1
  47. package/dist/components/Modal/index.d.ts +6 -2
  48. package/dist/components/Modal/index.d.ts.map +1 -1
  49. package/dist/components/Modal/useCustomModalOverlay.d.ts +1 -0
  50. package/dist/components/Modal/useCustomModalOverlay.d.ts.map +1 -1
  51. package/dist/components/Radio/RadioGroup/index.d.ts +20 -0
  52. package/dist/components/Radio/RadioGroup/index.d.ts.map +1 -0
  53. package/dist/components/Radio/RadioGroupContext.d.ts +11 -0
  54. package/dist/components/Radio/RadioGroupContext.d.ts.map +1 -0
  55. package/dist/components/Radio/RadioInput/index.d.ts +10 -0
  56. package/dist/components/Radio/RadioInput/index.d.ts.map +1 -0
  57. package/dist/components/Radio/index.d.ts +1 -14
  58. package/dist/components/Radio/index.d.ts.map +1 -1
  59. package/dist/components/SegmentedControl/index.d.ts +1 -0
  60. package/dist/components/SegmentedControl/index.d.ts.map +1 -1
  61. package/dist/components/Switch/SwitchInput/index.d.ts +9 -0
  62. package/dist/components/Switch/SwitchInput/index.d.ts.map +1 -0
  63. package/dist/components/Switch/SwitchWithLabel.d.ts +9 -0
  64. package/dist/components/Switch/SwitchWithLabel.d.ts.map +1 -0
  65. package/dist/components/Switch/index.d.ts +4 -15
  66. package/dist/components/Switch/index.d.ts.map +1 -1
  67. package/dist/components/TagItem/index.d.ts +10 -15
  68. package/dist/components/TagItem/index.d.ts.map +1 -1
  69. package/dist/components/TextArea/index.d.ts +29 -18
  70. package/dist/components/TextArea/index.d.ts.map +1 -1
  71. package/dist/components/TextField/AssistiveText/index.d.ts +5 -0
  72. package/dist/components/TextField/AssistiveText/index.d.ts.map +1 -0
  73. package/dist/components/TextField/index.d.ts +33 -22
  74. package/dist/components/TextField/index.d.ts.map +1 -1
  75. package/dist/core/CharcoalProvider.d.ts +4 -11
  76. package/dist/core/CharcoalProvider.d.ts.map +1 -1
  77. package/dist/core/SSRProvider.d.ts +3 -1
  78. package/dist/core/SSRProvider.d.ts.map +1 -1
  79. package/dist/index.cjs.js +576 -1255
  80. package/dist/index.cjs.js.map +1 -1
  81. package/dist/index.css +1097 -3
  82. package/dist/index.css.map +1 -1
  83. package/dist/index.d.ts +4 -5
  84. package/dist/index.d.ts.map +1 -1
  85. package/dist/index.esm.js +555 -1231
  86. package/dist/index.esm.js.map +1 -1
  87. package/package.json +25 -23
  88. package/src/README.mdx +68 -0
  89. package/src/SSR.mdx +67 -0
  90. package/src/_lib/compat.ts +0 -11
  91. package/src/_lib/createDivComponent.tsx +11 -0
  92. package/src/_lib/useClassNames.ts +3 -9
  93. package/src/components/Button/__snapshots__/index.story.storyshot +18 -56
  94. package/src/components/Button/index.css +2 -3
  95. package/src/components/Button/index.story.tsx +14 -67
  96. package/src/components/Button/index.tsx +7 -3
  97. package/src/components/Checkbox/CheckboxInput/__snapshots__/index.story.storyshot +77 -0
  98. package/src/components/Checkbox/CheckboxInput/index.css +110 -0
  99. package/src/components/Checkbox/CheckboxInput/index.story.tsx +51 -0
  100. package/src/components/Checkbox/CheckboxInput/index.tsx +47 -0
  101. package/src/components/Checkbox/CheckboxWithLabel.tsx +24 -0
  102. package/src/components/Checkbox/__snapshots__/index.story.storyshot +103 -538
  103. package/src/components/Checkbox/index.css +21 -0
  104. package/src/components/Checkbox/index.story.tsx +49 -79
  105. package/src/components/Checkbox/index.tsx +32 -162
  106. package/src/components/Clickable/__snapshots__/index.story.storyshot +4 -80
  107. package/src/components/Clickable/index.css +41 -0
  108. package/src/components/Clickable/index.story.tsx +2 -2
  109. package/src/components/Clickable/index.tsx +19 -84
  110. package/src/components/DropdownSelector/Divider/index.css +11 -0
  111. package/src/components/DropdownSelector/Divider/index.tsx +5 -0
  112. package/src/components/DropdownSelector/DropdownMenuItem/index.css +20 -0
  113. package/src/components/DropdownSelector/DropdownMenuItem/index.tsx +34 -0
  114. package/src/components/DropdownSelector/DropdownPopover.tsx +16 -9
  115. package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +41 -224
  116. package/src/components/DropdownSelector/ListItem/index.css +24 -0
  117. package/src/components/DropdownSelector/ListItem/index.story.tsx +12 -6
  118. package/src/components/DropdownSelector/ListItem/index.tsx +14 -53
  119. package/src/components/DropdownSelector/MenuItem/index.tsx +17 -12
  120. package/src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx +2 -2
  121. package/src/components/DropdownSelector/MenuItemGroup/index.css +19 -0
  122. package/src/components/DropdownSelector/MenuItemGroup/index.tsx +6 -28
  123. package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +162 -416
  124. package/src/components/DropdownSelector/MenuList/index.css +4 -0
  125. package/src/components/DropdownSelector/MenuList/index.story.tsx +1 -1
  126. package/src/components/DropdownSelector/MenuList/index.tsx +4 -12
  127. package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +5 -5
  128. package/src/components/DropdownSelector/Popover/index.css +11 -0
  129. package/src/components/DropdownSelector/Popover/index.story.tsx +1 -1
  130. package/src/components/DropdownSelector/Popover/index.tsx +7 -17
  131. package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +468 -2494
  132. package/src/components/DropdownSelector/index.css +84 -0
  133. package/src/components/DropdownSelector/index.story.tsx +2 -6
  134. package/src/components/DropdownSelector/index.tsx +61 -137
  135. package/src/components/FieldLabel/index.css +35 -0
  136. package/src/components/FieldLabel/index.tsx +15 -105
  137. package/src/components/Icon/__snapshots__/index.story.storyshot +1 -1
  138. package/src/components/Icon/index.story.tsx +1 -1
  139. package/src/components/IconButton/__snapshots__/index.story.storyshot +19 -297
  140. package/src/components/IconButton/index.css +118 -0
  141. package/src/components/IconButton/index.story.tsx +17 -40
  142. package/src/components/IconButton/index.tsx +41 -118
  143. package/src/components/LoadingSpinner/__snapshots__/LoadingSpinnerIcon.story.storyshot +2 -17
  144. package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +80 -30
  145. package/src/components/LoadingSpinner/index.css +42 -0
  146. package/src/components/LoadingSpinner/index.story.tsx +19 -8
  147. package/src/components/LoadingSpinner/index.tsx +26 -52
  148. package/src/components/Modal/Dialog/index.css +44 -0
  149. package/src/components/Modal/Dialog/index.tsx +14 -57
  150. package/src/components/Modal/ModalPlumbing.css +40 -0
  151. package/src/components/Modal/ModalPlumbing.tsx +13 -61
  152. package/src/components/Modal/__snapshots__/index.story.storyshot +281 -2221
  153. package/src/components/Modal/index.css +36 -0
  154. package/src/components/Modal/index.story.tsx +26 -13
  155. package/src/components/Modal/index.tsx +42 -78
  156. package/src/components/Modal/useCustomModalOverlay.tsx +19 -4
  157. package/src/components/Radio/RadioGroup/index.css +5 -0
  158. package/src/components/Radio/RadioGroup/index.tsx +80 -0
  159. package/src/components/Radio/RadioGroupContext.ts +23 -0
  160. package/src/components/Radio/RadioInput/index.css +82 -0
  161. package/src/components/Radio/RadioInput/index.tsx +41 -0
  162. package/src/components/Radio/__snapshots__/index.story.storyshot +111 -855
  163. package/src/components/Radio/index.css +18 -0
  164. package/src/components/Radio/index.story.tsx +47 -40
  165. package/src/components/Radio/index.test.tsx +18 -26
  166. package/src/components/Radio/index.tsx +16 -208
  167. package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +32 -262
  168. package/src/components/SegmentedControl/index.css +50 -0
  169. package/src/components/SegmentedControl/index.story.tsx +1 -1
  170. package/src/components/SegmentedControl/index.tsx +20 -89
  171. package/src/components/Switch/SwitchInput/index.css +82 -0
  172. package/src/components/Switch/SwitchInput/index.tsx +40 -0
  173. package/src/components/Switch/SwitchWithLabel.tsx +24 -0
  174. package/src/components/Switch/__snapshots__/index.story.storyshot +35 -539
  175. package/src/components/Switch/index.css +23 -0
  176. package/src/components/Switch/index.story.tsx +16 -19
  177. package/src/components/Switch/index.tsx +43 -140
  178. package/src/components/TagItem/__snapshots__/index.story.storyshot +212 -1063
  179. package/src/components/TagItem/index.css +140 -0
  180. package/src/components/TagItem/index.story.tsx +45 -162
  181. package/src/components/TagItem/index.tsx +72 -220
  182. package/src/components/TextArea/TextArea.story.tsx +63 -25
  183. package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +615 -1055
  184. package/src/components/TextArea/index.css +78 -0
  185. package/src/components/TextArea/index.tsx +83 -174
  186. package/src/components/TextField/AssistiveText/index.css +10 -0
  187. package/src/components/TextField/AssistiveText/index.tsx +6 -0
  188. package/src/components/TextField/TextField.story.tsx +85 -76
  189. package/src/components/TextField/__snapshots__/TextField.story.storyshot +632 -1710
  190. package/src/components/TextField/index.css +87 -0
  191. package/src/components/TextField/index.tsx +92 -211
  192. package/src/core/CharcoalProvider.tsx +5 -29
  193. package/src/core/SSRProvider.tsx +12 -1
  194. package/src/index.ts +7 -19
  195. package/src/type.d.ts +3 -8
  196. package/dist/components/Button/index.story.d.ts +0 -24
  197. package/dist/components/Button/index.story.d.ts.map +0 -1
  198. package/dist/components/Checkbox/index.story.d.ts +0 -8
  199. package/dist/components/Checkbox/index.story.d.ts.map +0 -1
  200. package/dist/components/Clickable/index.story.d.ts +0 -6
  201. package/dist/components/Clickable/index.story.d.ts.map +0 -1
  202. package/dist/components/DropdownSelector/Divider.d.ts +0 -7
  203. package/dist/components/DropdownSelector/Divider.d.ts.map +0 -1
  204. package/dist/components/DropdownSelector/DropdownMenuItem.d.ts +0 -7
  205. package/dist/components/DropdownSelector/DropdownMenuItem.d.ts.map +0 -1
  206. package/dist/components/DropdownSelector/ListItem/index.story.d.ts +0 -9
  207. package/dist/components/DropdownSelector/ListItem/index.story.d.ts.map +0 -1
  208. package/dist/components/DropdownSelector/MenuList/index.story.d.ts +0 -8
  209. package/dist/components/DropdownSelector/MenuList/index.story.d.ts.map +0 -1
  210. package/dist/components/DropdownSelector/Popover/index.story.d.ts +0 -5
  211. package/dist/components/DropdownSelector/Popover/index.story.d.ts.map +0 -1
  212. package/dist/components/DropdownSelector/index.story.d.ts +0 -19
  213. package/dist/components/DropdownSelector/index.story.d.ts.map +0 -1
  214. package/dist/components/Icon/index.story.d.ts +0 -6
  215. package/dist/components/Icon/index.story.d.ts.map +0 -1
  216. package/dist/components/IconButton/index.story.d.ts +0 -9
  217. package/dist/components/IconButton/index.story.d.ts.map +0 -1
  218. package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts +0 -8
  219. package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts.map +0 -1
  220. package/dist/components/LoadingSpinner/index.story.d.ts +0 -6
  221. package/dist/components/LoadingSpinner/index.story.d.ts.map +0 -1
  222. package/dist/components/Modal/__stories__/InternalScrollStory.d.ts +0 -4
  223. package/dist/components/Modal/__stories__/InternalScrollStory.d.ts.map +0 -1
  224. package/dist/components/Modal/index.story.d.ts +0 -21
  225. package/dist/components/Modal/index.story.d.ts.map +0 -1
  226. package/dist/components/MultiSelect/context.d.ts +0 -14
  227. package/dist/components/MultiSelect/context.d.ts.map +0 -1
  228. package/dist/components/MultiSelect/index.d.ts +0 -36
  229. package/dist/components/MultiSelect/index.d.ts.map +0 -1
  230. package/dist/components/MultiSelect/index.story.d.ts +0 -82
  231. package/dist/components/MultiSelect/index.story.d.ts.map +0 -1
  232. package/dist/components/MultiSelect/index.test.d.ts +0 -2
  233. package/dist/components/MultiSelect/index.test.d.ts.map +0 -1
  234. package/dist/components/Radio/index.story.d.ts +0 -26
  235. package/dist/components/Radio/index.story.d.ts.map +0 -1
  236. package/dist/components/Radio/index.test.d.ts +0 -2
  237. package/dist/components/Radio/index.test.d.ts.map +0 -1
  238. package/dist/components/SegmentedControl/index.story.d.ts +0 -7
  239. package/dist/components/SegmentedControl/index.story.d.ts.map +0 -1
  240. package/dist/components/Switch/index.story.d.ts +0 -9
  241. package/dist/components/Switch/index.story.d.ts.map +0 -1
  242. package/dist/components/TagItem/index.story.d.ts +0 -16
  243. package/dist/components/TagItem/index.story.d.ts.map +0 -1
  244. package/dist/components/TextArea/TextArea.story.d.ts +0 -9
  245. package/dist/components/TextArea/TextArea.story.d.ts.map +0 -1
  246. package/dist/components/TextField/TextField.story.d.ts +0 -22
  247. package/dist/components/TextField/TextField.story.d.ts.map +0 -1
  248. package/dist/components/a11y.test.d.ts +0 -2
  249. package/dist/components/a11y.test.d.ts.map +0 -1
  250. package/dist/core/ComponentAbstraction.d.ts +0 -24
  251. package/dist/core/ComponentAbstraction.d.ts.map +0 -1
  252. package/dist/styled.d.ts +0 -95
  253. package/dist/styled.d.ts.map +0 -1
  254. package/src/components/DropdownSelector/Divider.tsx +0 -16
  255. package/src/components/DropdownSelector/DropdownMenuItem.tsx +0 -43
  256. package/src/components/LoadingSpinner/LoadingSpinnerIcon.story.tsx +0 -13
  257. package/src/components/Modal/__stories__/InternalScrollStory.tsx +0 -75
  258. package/src/components/MultiSelect/__snapshots__/index.story.storyshot +0 -1066
  259. package/src/components/MultiSelect/context.ts +0 -23
  260. package/src/components/MultiSelect/index.story.tsx +0 -216
  261. package/src/components/MultiSelect/index.test.tsx +0 -263
  262. package/src/components/MultiSelect/index.tsx +0 -281
  263. package/src/components/a11y.test.tsx +0 -99
  264. package/src/core/ComponentAbstraction.tsx +0 -48
  265. package/src/styled.ts +0 -3
package/dist/index.esm.js CHANGED
@@ -1,177 +1,80 @@
1
- // src/core/ComponentAbstraction.tsx
2
- import { useContext } from "react";
3
- import * as React from "react";
4
- import { jsx } from "react/jsx-runtime";
5
- var DefaultLink = React.forwardRef(function DefaultLink2({
6
- to,
7
- children,
8
- ...rest
9
- }, ref) {
10
- return /* @__PURE__ */ jsx("a", { href: to, ref, ...rest, children });
11
- });
12
- var DefaultValue = {
13
- Link: DefaultLink
14
- };
15
- var ComponentAbstractionContext = React.createContext(DefaultValue);
16
- function ComponentAbstraction({
17
- children,
18
- components
19
- }) {
20
- return /* @__PURE__ */ jsx(ComponentAbstractionContext.Provider, { value: {
21
- ...DefaultValue,
22
- ...components
23
- }, children });
24
- }
25
- function useComponentAbstraction() {
26
- return useContext(ComponentAbstractionContext);
27
- }
28
-
29
1
  // src/core/SSRProvider.tsx
30
- import { SSRProvider } from "@react-aria/ssr";
2
+ import { SSRProvider as OriginSSRProvider } from "@react-aria/ssr";
3
+ import { version, Fragment } from "react";
4
+ function isReactVersionOver(minVersion) {
5
+ const reactMajorVersion = parseInt(version.split(".")[0], 10);
6
+ return Number.isFinite(reactMajorVersion) ? reactMajorVersion >= minVersion : false;
7
+ }
8
+ var SSRProvider = isReactVersionOver(18) ? Fragment : OriginSSRProvider;
31
9
 
32
10
  // src/core/OverlayProvider.tsx
33
11
  import { OverlayProvider } from "@react-aria/overlays";
34
12
 
35
13
  // src/core/CharcoalProvider.tsx
36
- import { ThemeProvider } from "styled-components";
37
- import { TokenInjector } from "@charcoal-ui/styled";
38
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
14
+ import { jsx } from "react/jsx-runtime";
39
15
  function CharcoalProvider({
40
- themeMap,
41
- defaultTheme = themeMap[":root"],
42
- components = {},
43
- injectTokens = true,
44
- children,
45
- background
16
+ children
46
17
  }) {
47
- return /* @__PURE__ */ jsx2(SSRProvider, { children: /* @__PURE__ */ jsxs(ThemeProvider, { theme: defaultTheme, children: [
48
- injectTokens && /* @__PURE__ */ jsx2(TokenInjector, { theme: themeMap, background }),
49
- /* @__PURE__ */ jsx2(ComponentAbstraction, { components, children: /* @__PURE__ */ jsx2(OverlayProvider, { children }) })
50
- ] }) });
18
+ return /* @__PURE__ */ jsx(SSRProvider, { children: /* @__PURE__ */ jsx(OverlayProvider, { children }) });
51
19
  }
52
20
 
53
21
  // src/components/Button/index.tsx
54
- import { forwardRef as forwardRef2, useMemo as useMemo2 } from "react";
22
+ import { forwardRef, useMemo as useMemo2 } from "react";
55
23
 
56
24
  // src/_lib/useClassNames.ts
57
25
  import { useMemo } from "react";
58
- function useClassNames(defaultClassName, propsClassName) {
59
- return useMemo(() => [defaultClassName, propsClassName].filter((v) => v).join(" "), [defaultClassName, propsClassName]);
26
+ function useClassNames(...classNames) {
27
+ return useMemo(() => classNames.filter((v) => v).join(" "), [classNames]);
60
28
  }
61
29
 
62
30
  // src/components/Button/index.tsx
63
- import { jsx as jsx3 } from "react/jsx-runtime";
64
- var Button = forwardRef2(function Button2({
31
+ import { jsx as jsx2 } from "react/jsx-runtime";
32
+ var Button = forwardRef(function Button2({
65
33
  variant,
66
34
  fullWidth,
67
35
  size,
68
36
  className,
69
- as,
37
+ component,
70
38
  isActive,
71
39
  ...props
72
40
  }, ref) {
73
- const Component = useMemo2(() => as ?? "button", [as]);
41
+ const Component = useMemo2(() => component ?? "button", [component]);
74
42
  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 });
43
+ return /* @__PURE__ */ jsx2(Component, { ...props, className: classNames, "data-variant": variant, "data-size": size, "data-full-width": fullWidth, "data-active": isActive, ref });
76
44
  });
77
45
  var Button_default = Button;
78
46
 
79
47
  // src/components/Clickable/index.tsx
80
- import * as React3 from "react";
81
- import styled from "styled-components";
82
- import { disabledSelector } from "@charcoal-ui/utils";
83
- import { jsx as jsx4 } from "react/jsx-runtime";
84
- var Clickable = React3.forwardRef(function Clickable2(props, ref) {
85
- const {
86
- Link
87
- } = useComponentAbstraction();
88
- const isLink = "to" in props;
89
- const as = isLink ? Link : "button";
90
- const ariaDisabled = isLink && props.disabled === true ? true : void 0;
91
- let rest = props;
92
- if (isLink) {
93
- const {
94
- disabled,
95
- ..._rest
96
- } = props;
97
- rest = _rest;
98
- }
99
- return /* @__PURE__ */ jsx4(StyledClickableDiv, { ...rest, ref, as, "aria-disabled": ariaDisabled });
48
+ import { useMemo as useMemo3, forwardRef as forwardRef2 } from "react";
49
+ import { jsx as jsx3 } from "react/jsx-runtime";
50
+ var Clickable = forwardRef2(function Clickable2({
51
+ component,
52
+ ...props
53
+ }, ref) {
54
+ const className = useClassNames("charcoal-clickable", props.className);
55
+ const Component = useMemo3(() => component ?? "button", [component]);
56
+ return /* @__PURE__ */ jsx3(Component, { ...props, ref, className });
100
57
  });
101
58
  var Clickable_default = Clickable;
102
- var StyledClickableDiv = styled.div.withConfig({
103
- componentId: "ccl__sc-1lxyknw-0"
104
- })(["cursor:pointer;", "{cursor:default;}appearance:none;background:transparent;padding:0;border-style:none;outline:none;color:inherit;text-rendering:inherit;letter-spacing:inherit;word-spacing:inherit;text-decoration:none;&:focus{outline:none;}font:inherit;margin:0;overflow:visible;text-transform:none;&::-moz-focus-inner{border-style:none;padding:0;}"], disabledSelector);
105
59
 
106
60
  // src/components/IconButton/index.tsx
107
- import { forwardRef as forwardRef4 } from "react";
108
- import styled2, { css } from "styled-components";
109
- import { focusVisibleFocusRingCss } from "@charcoal-ui/styled";
110
- import { jsx as jsx5 } from "react/jsx-runtime";
111
- var IconButton = forwardRef4(function IconButtonInner({
61
+ import { forwardRef as forwardRef3, useMemo as useMemo4 } from "react";
62
+ import { jsx as jsx4 } from "react/jsx-runtime";
63
+ var IconButton = forwardRef3(function IconButtonInner({
112
64
  variant = "Default",
113
65
  size = "M",
114
66
  icon,
115
67
  isActive = false,
68
+ componentAs,
69
+ as,
116
70
  ...rest
117
71
  }, ref) {
118
72
  validateIconSize(size, icon);
119
- return /* @__PURE__ */ jsx5(StyledIconButton, { ...rest, ref, $size: size, $variant: variant, $isActive: isActive, children: /* @__PURE__ */ jsx5("pixiv-icon", { name: icon }) });
73
+ const Component = useMemo4(() => as ?? "button", [as]);
74
+ const classNames = useClassNames("charcoal-icon-button", rest.className);
75
+ return /* @__PURE__ */ jsx4(Component, { ...rest, as: componentAs, ref, className: classNames, "data-size": size, "data-active": isActive, "data-variant": variant, children: /* @__PURE__ */ jsx4("pixiv-icon", { name: icon }) });
120
76
  });
121
77
  var IconButton_default = IconButton;
122
- var StyledIconButton = styled2(Clickable_default).attrs(styledProps).withConfig({
123
- componentId: "ccl__sc-zssehl-0"
124
- })(["user-select:none;width:", "px;height:", "px;display:flex;align-items:center;justify-content:center;color:var(", ");background-color:var(", ");border-radius:999999px;transition:0.2s background-color,0.2s box-shadow;&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{", " ", "}&:disabled,&[aria-disabled]:not([aria-disabled='false']){opacity:0.32;}"], (p) => p.$width, (p) => p.$height, ({
125
- $font
126
- }) => `--charcoal-${$font}`, ({
127
- $background
128
- }) => `--charcoal-${$background}`, ({
129
- $isActive,
130
- $background,
131
- $font
132
- }) => $isActive ? css(["color:var(--charcoal-", "-press);background-color:var(--charcoal-", "-press);"], $font, $background) : css(["&:hover{color:var(--charcoal-", "-hover);background-color:var(--charcoal-", "-hover);}&:active{color:var(--charcoal-", "-press);background-color:var(--charcoal-", "-press);}"], $font, $background, $font, $background), focusVisibleFocusRingCss);
133
- function styledProps({
134
- $size,
135
- $variant
136
- }) {
137
- return {
138
- ...variantToProps($variant),
139
- ...sizeToProps($size)
140
- };
141
- }
142
- function variantToProps(variant) {
143
- switch (variant) {
144
- case "Default":
145
- return {
146
- $font: "text3",
147
- $background: "transparent"
148
- };
149
- case "Overlay":
150
- return {
151
- $font: "text5",
152
- $background: "surface4"
153
- };
154
- }
155
- }
156
- function sizeToProps(size) {
157
- switch (size) {
158
- case "XS":
159
- return {
160
- $width: 20,
161
- $height: 20
162
- };
163
- case "S":
164
- return {
165
- $width: 32,
166
- $height: 32
167
- };
168
- case "M":
169
- return {
170
- $width: 40,
171
- $height: 40
172
- };
173
- }
174
- }
175
78
  function validateIconSize(size, icon) {
176
79
  let requiredIconSize;
177
80
  switch (size) {
@@ -194,17 +97,47 @@ function validateIconSize(size, icon) {
194
97
  }
195
98
 
196
99
  // src/components/Radio/index.tsx
197
- import { memo, forwardRef as forwardRef5, useCallback, useContext as useContext2 } from "react";
198
- import * as React4 from "react";
199
- import styled3 from "styled-components";
100
+ import { memo as memo2, forwardRef as forwardRef5, useContext } from "react";
200
101
  import warning from "warning";
201
- import { focusVisibleFocusRingCss as focusVisibleFocusRingCss2 } from "@charcoal-ui/styled";
202
- import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
102
+
103
+ // src/components/Radio/RadioGroupContext.ts
104
+ import * as React4 from "react";
105
+ var RadioGroupContext = React4.createContext({
106
+ name: void 0,
107
+ selected: void 0,
108
+ disabled: false,
109
+ readonly: false,
110
+ invalid: false,
111
+ onChange() {
112
+ throw new Error("Cannot find onChange() handler. Perhaps you forgot to wrap with <RadioGroup> ?");
113
+ }
114
+ });
115
+
116
+ // src/components/Radio/RadioInput/index.tsx
117
+ import { forwardRef as forwardRef4, memo, useCallback } from "react";
118
+ import { jsx as jsx5 } from "react/jsx-runtime";
119
+ var RadioInput = forwardRef4(function RadioInput2({
120
+ onChange,
121
+ invalid,
122
+ className,
123
+ ...props
124
+ }, ref) {
125
+ const handleChange = useCallback((e) => {
126
+ const el = e.currentTarget;
127
+ onChange?.(el.value);
128
+ }, [onChange]);
129
+ const classNames = useClassNames("charcoal-radio-input", className);
130
+ return /* @__PURE__ */ jsx5("input", { className: classNames, ref, type: "radio", onChange: handleChange, "aria-invalid": invalid, ...props });
131
+ });
132
+ var RadioInput_default = memo(RadioInput);
133
+
134
+ // src/components/Radio/index.tsx
135
+ import { jsx as jsx6, jsxs } from "react/jsx-runtime";
203
136
  var Radio = forwardRef5(function RadioInner({
204
137
  value,
205
138
  disabled = false,
206
139
  children,
207
- className
140
+ ...props
208
141
  }, ref) {
209
142
  const {
210
143
  name,
@@ -213,7 +146,8 @@ var Radio = forwardRef5(function RadioInner({
213
146
  readonly,
214
147
  invalid,
215
148
  onChange
216
- } = useContext2(RadioGroupContext);
149
+ } = useContext(RadioGroupContext);
150
+ const classNames = useClassNames("charcoal-radio__label", props.className);
217
151
  warning(
218
152
  name !== void 0,
219
153
  `"name" is not Provided for <Radio>. Perhaps you forgot to wrap with <RadioGroup> ?`
@@ -221,41 +155,17 @@ var Radio = forwardRef5(function RadioInner({
221
155
  const isSelected = value === selected;
222
156
  const isDisabled = disabled || isParentDisabled;
223
157
  const isReadonly = readonly && !isSelected;
224
- const handleChange = useCallback((e) => {
225
- onChange(e.currentTarget.value);
226
- }, [onChange]);
227
- return /* @__PURE__ */ jsxs2(RadioRoot, { "aria-disabled": isDisabled || isReadonly, className, children: [
228
- /* @__PURE__ */ jsx6(RadioInput, { name, value, checked: isSelected, "aria-invalid": invalid, onChange: handleChange, disabled: isDisabled || isReadonly, ref }),
229
- children != null && /* @__PURE__ */ jsx6(RadioLabel, { children })
158
+ return /* @__PURE__ */ jsxs("label", { "aria-disabled": isDisabled || isReadonly, className: classNames, children: [
159
+ /* @__PURE__ */ jsx6(RadioInput_default, { name, value, checked: isSelected, "aria-invalid": invalid, onChange, disabled: isDisabled || isReadonly, ref }),
160
+ children != null && /* @__PURE__ */ jsx6("div", { className: "charcoal-radio__label_div", children })
230
161
  ] });
231
162
  });
232
- var Radio_default = memo(Radio);
233
- var RadioRoot = styled3.label.withConfig({
234
- componentId: "ccl__sc-1hitkzn-0"
235
- })(["display:grid;grid-template-columns:auto 1fr;grid-gap:4px;align-items:center;cursor:pointer;&[aria-disabled]:not([aria-disabled='false']){opacity:0.32;cursor:default;}"]);
236
- var RadioInput = styled3.input.attrs({
237
- type: "radio"
238
- }).withConfig({
239
- componentId: "ccl__sc-1hitkzn-1"
240
- })(["&[type='radio']{appearance:none;display:block;box-sizing:border-box;margin:0;padding:6px;width:20px;height:20px;cursor:pointer;border-radius:999999px;background-color:var(--charcoal-surface1);transition:0.2s background-color,0.2s box-shadow;:disabled{cursor:default;}&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{&:hover{background-color:var(--charcoal-surface1-hover);}&:active{background-color:var(--charcoal-surface1-press);}", " &[aria-invalid='true']{box-shadow:0 0 0 4px rgba(255,43,0,0.32);&:focus{box-shadow:0 0 0 4px rgba(255,43,0,0.32);}}}&:not(:checked){border-width:2px;border-style:solid;border-color:var(--charcoal-text3);}&:checked{background-color:var(--charcoal-brand);&::after{content:'';display:block;width:8px;height:8px;pointer-events:none;background-color:var(--charcoal-text5);border-radius:999999px;transition:0.2s background-color,0.2s box-shadow;}&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{&:hover{background-color:var(--charcoal-brand-hover);&::after{background-color:var(--charcoal-text5-hover);}}&:active{background-color:var(--charcoal-brand-press);&::after{background-color:var(--charcoal-text5-press);}}}}}"], focusVisibleFocusRingCss2);
241
- var RadioLabel = styled3.div.withConfig({
242
- componentId: "ccl__sc-1hitkzn-2"
243
- })(["font-size:14px;line-height:22px;display:flow-root;color:var(--charcoal-text2);&::before{display:block;width:0;height:0;content:'';margin-top:-4px;}&::after{display:block;width:0;height:0;content:'';margin-bottom:-4px;}"]);
244
- var StyledRadioGroup = styled3.div.withConfig({
245
- componentId: "ccl__sc-1hitkzn-3"
246
- })(["display:grid;grid-template-columns:1fr;grid-gap:8px;"]);
247
- var RadioGroupContext = React4.createContext({
248
- name: void 0,
249
- selected: void 0,
250
- disabled: false,
251
- readonly: false,
252
- invalid: false,
253
- onChange() {
254
- throw new Error("Cannot find onChange() handler. Perhaps you forgot to wrap with <RadioGroup> ?");
255
- }
256
- });
257
- function RadioGroup({
258
- className,
163
+ var Radio_default = memo2(Radio);
164
+
165
+ // src/components/Radio/RadioGroup/index.tsx
166
+ import { forwardRef as forwardRef6, useCallback as useCallback2, useMemo as useMemo5 } from "react";
167
+ import { jsx as jsx7 } from "react/jsx-runtime";
168
+ var RadioGroup = forwardRef6(function RadioGroupInner({
259
169
  value,
260
170
  label,
261
171
  name,
@@ -263,207 +173,93 @@ function RadioGroup({
263
173
  disabled,
264
174
  readonly,
265
175
  invalid,
266
- children
267
- }) {
268
- const handleChange = useCallback((next) => {
176
+ children,
177
+ "aria-orientation": ariaOrientation = "vertical",
178
+ ...props
179
+ }, ref) {
180
+ const classNames = useClassNames("charcoal-radio-group", props.className);
181
+ const handleChange = useCallback2((next) => {
269
182
  onChange(next);
270
183
  }, [onChange]);
271
- return /* @__PURE__ */ jsx6(RadioGroupContext.Provider, { value: {
184
+ const contextValue = useMemo5(() => ({
272
185
  name,
273
186
  selected: value,
274
187
  disabled: disabled ?? false,
275
188
  readonly: readonly ?? false,
276
189
  invalid: invalid ?? false,
277
190
  onChange: handleChange
278
- }, children: /* @__PURE__ */ jsx6(StyledRadioGroup, { role: "radiogroup", "aria-orientation": "vertical", "aria-label": label, "aria-invalid": invalid, className, children }) });
279
- }
280
-
281
- // src/components/MultiSelect/index.tsx
282
- import { useCallback as useCallback2, useContext as useContext3, forwardRef as forwardRef6, memo as memo2 } from "react";
283
- import styled4, { css as css2 } from "styled-components";
284
- import warning2 from "warning";
285
- import { px } from "@charcoal-ui/utils";
286
-
287
- // src/components/MultiSelect/context.ts
288
- import { createContext as createContext3 } from "react";
289
- var MultiSelectGroupContext = createContext3({
290
- name: void 0,
291
- selected: [],
292
- disabled: false,
293
- readonly: false,
294
- invalid: false,
295
- onChange() {
296
- throw new Error("Cannot find `onChange()` handler. Perhaps you forgot to wrap it with `<MultiSelectGroup />` ?");
297
- }
191
+ }), [disabled, handleChange, invalid, name, readonly, value]);
192
+ return /* @__PURE__ */ jsx7(RadioGroupContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx7("div", { role: "radiogroup", "aria-disabled": disabled, "aria-invalid": invalid, "aria-label": label, "aria-labelledby": props["aria-labelledby"], "aria-orientation": ariaOrientation, className: classNames, ref, children }) });
298
193
  });
299
194
 
300
- // src/components/MultiSelect/index.tsx
301
- 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({
304
- value,
305
- disabled = false,
195
+ // src/components/Switch/index.tsx
196
+ import { memo as memo4, forwardRef as forwardRef8 } from "react";
197
+ import { useId } from "@react-aria/utils";
198
+
199
+ // src/components/Switch/SwitchInput/index.tsx
200
+ import { forwardRef as forwardRef7, useCallback as useCallback3 } from "react";
201
+ import { jsx as jsx8 } from "react/jsx-runtime";
202
+ var SwitchInput = forwardRef7(function SwitchInput2({
306
203
  onChange,
307
- variant = "default",
308
204
  className,
309
- children
205
+ ...props
310
206
  }, ref) {
311
- const {
312
- name,
313
- selected,
314
- disabled: parentDisabled,
315
- readonly,
316
- invalid,
317
- onChange: parentOnChange
318
- } = useContext3(MultiSelectGroupContext);
319
- warning2(
320
- name !== void 0,
321
- `"name" is not Provided for <MultiSelect>. Perhaps you forgot to wrap with <MultiSelectGroup> ?`
322
- );
323
- const isSelected = selected.includes(value);
324
- const isDisabled = disabled || parentDisabled || readonly;
325
- const handleChange = useCallback2((event) => {
326
- if (!(event.currentTarget instanceof HTMLInputElement)) {
327
- return;
328
- }
329
- if (onChange)
330
- onChange({
331
- value,
332
- selected: event.currentTarget.checked
333
- });
334
- parentOnChange({
335
- value,
336
- selected: event.currentTarget.checked
337
- });
338
- }, [onChange, parentOnChange, value]);
339
- return /* @__PURE__ */ jsxs3(MultiSelectRoot, { "aria-disabled": isDisabled, className, children: [
340
- /* @__PURE__ */ jsx7(MultiSelectInput, { ...{
341
- name,
342
- value,
343
- invalid
344
- }, 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 })
347
- ] });
207
+ const handleChange = useCallback3((e) => {
208
+ const el = e.currentTarget;
209
+ onChange?.(el.checked);
210
+ }, [onChange]);
211
+ props.children;
212
+ const classNames = useClassNames("charcoal-switch-input", className);
213
+ return /* @__PURE__ */ jsx8("input", { ref, className: classNames, type: "checkbox", onChange: handleChange, ...props });
348
214
  });
349
- var MultiSelect_default = memo2(MultiSelect);
350
- var MultiSelectRoot = styled4.label.withConfig({
351
- componentId: "ccl__sc-wpr5y9-0"
352
- })(["display:grid;grid-template-columns:auto 1fr;align-items:center;position:relative;cursor:pointer;gap:", ";&:disabled,&[aria-disabled]:not([aria-disabled='false']){opacity:0.32;cursor:default;}"], ({
353
- theme
354
- }) => px(theme.spacing[4]));
355
- var MultiSelectLabel = styled4.div.withConfig({
356
- componentId: "ccl__sc-wpr5y9-1"
357
- })(["display:flex;align-items:center;font-size:14px;line-height:22px;display:flow-root;color:var(--charcoal-text2);&::before{display:block;width:0;height:0;content:'';margin-top:-4px;}&::after{display:block;width:0;height:0;content:'';margin-bottom:-4px;}"]);
358
- var MultiSelectInput = styled4.input.attrs({
359
- type: "checkbox"
360
- }).withConfig({
361
- componentId: "ccl__sc-wpr5y9-2"
362
- })(["&[type='checkbox']{appearance:none;display:block;width:20px;height:20px;margin:0;background-color:var(--charcoal-text3);border-radius:999999px;transition:0.2s background-color,0.2s box-shadow;&:checked{background-color:var(--charcoal-brand);&:hover{&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{background-color:var(--charcoal-brand-hover);}}&:active{&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{background-color:var(--charcoal-brand-press);}}}&:hover{&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{background-color:var(--charcoal-text3-hover);}}&:active{&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{background-color:var(--charcoal-text3-press);}}", " ", " ", "}"], focusVisibleFocusRingCss3, ({
363
- invalid,
364
- overlay
365
- }) => invalid && !overlay && css2(["&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{box-shadow:0 0 0 4px rgba(255,43,0,0.32);}"]), ({
366
- overlay
367
- }) => overlay && css2(["background-color:var(--charcoal-surface4);"]));
368
- var MultiSelectInputOverlay = styled4.div.withConfig({
369
- componentId: "ccl__sc-wpr5y9-3"
370
- })(["position:absolute;top:-2px;left:-2px;box-sizing:border-box;display:flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:999999px;color:var(--charcoal-text5);transition:0.2s box-shadow;", " ", ""], ({
371
- invalid,
372
- overlay
373
- }) => invalid && overlay && css2(["&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{box-shadow:0 0 0 4px rgba(255,43,0,0.32);}"]), ({
374
- overlay
375
- }) => overlay && css2(["border-color:var(--charcoal-text5);border-width:2px;border-style:solid;"]));
376
- function MultiSelectGroup({
215
+ var SwitchInput_default = SwitchInput;
216
+
217
+ // src/components/Switch/SwitchWithLabel.tsx
218
+ import * as React5 from "react";
219
+ import { jsx as jsx9, jsxs as jsxs2 } from "react/jsx-runtime";
220
+ var SwitchWithLabel = React5.memo(function SwitchWithLabel2({
221
+ children,
377
222
  className,
378
- name,
379
- label,
380
- selected,
381
- onChange,
382
- disabled = false,
383
- readonly = false,
384
- invalid = false,
385
- children
223
+ disabled,
224
+ id,
225
+ input
386
226
  }) {
387
- const handleChange = useCallback2((payload) => {
388
- const index = selected.indexOf(payload.value);
389
- if (payload.selected) {
390
- if (index < 0) {
391
- onChange([...selected, payload.value]);
392
- }
393
- } else {
394
- if (index >= 0) {
395
- onChange([...selected.slice(0, index), ...selected.slice(index + 1)]);
396
- }
397
- }
398
- }, [onChange, selected]);
399
- return /* @__PURE__ */ jsx7(MultiSelectGroupContext.Provider, { value: {
400
- name,
401
- selected: Array.from(new Set(selected)),
402
- disabled,
403
- readonly,
404
- invalid,
405
- onChange: handleChange
406
- }, children: /* @__PURE__ */ jsx7("div", { className, "aria-label": label, "data-testid": "SelectGroup", children }) });
407
- }
227
+ const classNames = useClassNames("charcoal-switch__label", className);
228
+ return /* @__PURE__ */ jsxs2("label", { htmlFor: id, className: classNames, "aria-disabled": disabled, children: [
229
+ input,
230
+ /* @__PURE__ */ jsx9("div", { className: "charcoal-switch__label_div", children })
231
+ ] });
232
+ });
408
233
 
409
234
  // src/components/Switch/index.tsx
410
- import { useSwitch } from "@react-aria/switch";
411
- import { useMemo as useMemo3, memo as memo3, forwardRef as forwardRef7 } from "react";
412
- import { useToggleState } from "react-stately";
413
- import styled5 from "styled-components";
414
- import { useObjectRef } from "@react-aria/utils";
415
- 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) {
418
- const {
419
- disabled,
420
- className
421
- } = props;
422
- const ariaSwitchProps = useMemo3(() => ({
423
- ...props,
424
- "aria-label": "children" in props ? void 0 : props.label,
425
- isDisabled: props.disabled,
426
- isSelected: props.checked
427
- }), [props]);
428
- const state = useToggleState(ariaSwitchProps);
429
- const ref = useObjectRef(external);
430
- const {
431
- inputProps: {
432
- className: _className,
433
- type: _type,
434
- ...rest
435
- }
436
- } = useSwitch(ariaSwitchProps, state, ref);
437
- 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
440
- ] });
235
+ import { jsx as jsx10 } from "react/jsx-runtime";
236
+ var Switch = forwardRef8(function Switch2({
237
+ children,
238
+ onChange,
239
+ disabled,
240
+ className,
241
+ id,
242
+ ...props
243
+ }, ref) {
244
+ const htmlId = useId(id);
245
+ const noChildren = children === void 0;
246
+ const input = /* @__PURE__ */ jsx10(SwitchInput_default, { ...props, disabled, className: noChildren ? className : void 0, id: htmlId, onChange, ref, role: "switch", type: "checkbox" });
247
+ if (noChildren) {
248
+ return input;
249
+ }
250
+ return /* @__PURE__ */ jsx10(SwitchWithLabel, { className, disabled, id: htmlId, input, children });
441
251
  });
442
- var Switch_default = memo3(SwitchCheckbox);
443
- var Label = styled5.label.withConfig({
444
- componentId: "ccl__sc-1wy6z5h-0"
445
- })(["display:inline-grid;grid-template-columns:auto 1fr;align-items:center;cursor:pointer;outline:0;&:disabled,&[aria-disabled]:not([aria-disabled='false']){opacity:0.32;cursor:default;}"]);
446
- var LabelInner = styled5.div.withConfig({
447
- componentId: "ccl__sc-1wy6z5h-1"
448
- })(["font-size:14px;line-height:22px;color:var(--charcoal-text2);margin-left:4px;"]);
449
- var SwitchInput = styled5.input.attrs({
450
- type: "checkbox"
451
- }).withConfig({
452
- componentId: "ccl__sc-1wy6z5h-2"
453
- })(["appearance:none;display:inline-flex;position:relative;box-sizing:border-box;width:28px;border:2px solid transparent;transition-property:background-color,box-shadow;transition-duration:0.2s;cursor:inherit;outline:none;border-radius:16px;height:16px;margin:0;background-color:var(--charcoal-text4);:hover{background-color:var(--charcoal-text4-hover);}:active{background-color:var(--charcoal-text4-press);}", " &::after{content:'';position:absolute;display:block;top:0;left:0;width:12px;height:12px;transform:translateX(0);transition:transform 0.2s;border-radius:1024px;background-color:var(--charcoal-text5);:hover{background-color:var(--charcoal-text5-hover);}:active{background-color:var(--charcoal-text5-press);}}&:checked{background-color:var(--charcoal-brand);:hover{background-color:var(--charcoal-brand-hover);}:active{background-color:var(--charcoal-brand-press);}&::after{transform:translateX(12px);transition:transform 0.2s;}}"], focusVisibleFocusRingCss4);
252
+ var Switch_default = memo4(Switch);
454
253
 
455
254
  // src/components/TextField/index.tsx
456
- import { useTextField } from "@react-aria/textfield";
457
255
  import { useVisuallyHidden } from "@react-aria/visually-hidden";
458
- import { useCallback as useCallback3, useEffect as useEffect2, useRef, useState } from "react";
459
- import * as React6 from "react";
460
- import styled7, { css as css3 } from "styled-components";
256
+ import { useCallback as useCallback4, useEffect as useEffect2, useRef, useState } from "react";
257
+ import * as React7 from "react";
461
258
 
462
259
  // src/components/FieldLabel/index.tsx
463
- import * as React5 from "react";
464
- import styled6 from "styled-components";
465
- import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
466
- var FieldLabel = React5.forwardRef(function FieldLabel2({
260
+ import * as React6 from "react";
261
+ import { jsx as jsx11, jsxs as jsxs3 } from "react/jsx-runtime";
262
+ var FieldLabel = React6.forwardRef(function FieldLabel2({
467
263
  style,
468
264
  className,
469
265
  label,
@@ -472,30 +268,16 @@ var FieldLabel = React5.forwardRef(function FieldLabel2({
472
268
  subLabel,
473
269
  ...labelProps
474
270
  }, ref) {
475
- 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 }) })
271
+ const classNames = useClassNames("charcoal-field-label-root", className);
272
+ return /* @__PURE__ */ jsxs3("div", { style, className: classNames, children: [
273
+ /* @__PURE__ */ jsx11("label", { ref, className: "charcoal-field-label", ...labelProps, children: label }),
274
+ required && /* @__PURE__ */ jsx11("div", { className: "charcoal-field-label-required-text", children: requiredText }),
275
+ /* @__PURE__ */ jsx11("div", { className: "charcoal-field-label-sub-label", children: /* @__PURE__ */ jsx11("span", { children: subLabel }) })
479
276
  ] });
480
277
  });
481
278
  var FieldLabel_default = FieldLabel;
482
- var Label2 = styled6.label.withConfig({
483
- componentId: "ccl__sc-1iotshb-0"
484
- })(["font-size:14px;line-height:22px;font-weight:bold;display:flow-root;color:var(--charcoal-text1);&::before{display:block;width:0;height:0;content:'';margin-top:-4px;}&::after{display:block;width:0;height:0;content:'';margin-bottom:-4px;}"]);
485
- var RequiredText = styled6.span.withConfig({
486
- componentId: "ccl__sc-1iotshb-1"
487
- })(["font-size:14px;line-height:22px;display:flow-root;color:var(--charcoal-text2);&::before{display:block;width:0;height:0;content:'';margin-top:-4px;}&::after{display:block;width:0;height:0;content:'';margin-bottom:-4px;}"]);
488
- var SubLabelClickable = styled6.div.withConfig({
489
- componentId: "ccl__sc-1iotshb-2"
490
- })(["font-size:14px;line-height:22px;display:flow-root;color:var(--charcoal-text3);transition:0.2s color,0.2s box-shadow;&::before{display:block;width:0;height:0;content:'';margin-top:-4px;}&::after{display:block;width:0;height:0;content:'';margin-bottom:-4px;}&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{&:hover{color:var(--charcoal-text3-hover);}&:active{color:var(--charcoal-text3-press);}&:active,&:focus,&:focus-visible{outline:none;box-shadow:0 0 0 4px rgba(0,150,250,0.32);}}"]);
491
- var FieldLabelWrapper = styled6.div.withConfig({
492
- componentId: "ccl__sc-1iotshb-3"
493
- })(["display:inline-flex;align-items:center;> ", "{margin-left:4px;}> ", "{margin-left:auto;}"], RequiredText, SubLabelClickable);
494
279
 
495
280
  // src/_lib/index.ts
496
- function unreachable(value) {
497
- throw new Error(arguments.length === 0 ? "unreachable" : `unreachable (${JSON.stringify(value)})`);
498
- }
499
281
  function mergeRefs(...refs) {
500
282
  return (value) => {
501
283
  for (const ref of refs) {
@@ -532,148 +314,124 @@ function useFocusWithClick(containerRef, inputRef) {
532
314
  }
533
315
 
534
316
  // src/components/TextField/index.tsx
535
- 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({
317
+ import { mergeRefs as mergeRefs2, useId as useId2 } from "@react-aria/utils";
318
+
319
+ // src/_lib/createDivComponent.tsx
320
+ import { forwardRef as forwardRef10 } from "react";
321
+ import { jsx as jsx12 } from "react/jsx-runtime";
322
+ function createDivComponent(mainClassName) {
323
+ return forwardRef10(function DivComponent({
324
+ className,
325
+ ...props
326
+ }, ref) {
327
+ const classNames = useClassNames(mainClassName, className);
328
+ return /* @__PURE__ */ jsx12("div", { className: classNames, ref, ...props });
329
+ });
330
+ }
331
+
332
+ // src/components/TextField/AssistiveText/index.tsx
333
+ var AssistiveText = createDivComponent("charcoal-text-field-assistive-text");
334
+
335
+ // src/components/TextField/index.tsx
336
+ import { jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
337
+ var TextField = React7.forwardRef(function SingleLineTextFieldInner({
338
+ assistiveText,
339
+ className,
340
+ disabled = false,
341
+ label = "",
342
+ maxLength,
538
343
  onChange,
344
+ prefix = null,
345
+ required,
346
+ requiredText,
347
+ showCount = false,
348
+ showLabel = false,
349
+ subLabel,
350
+ suffix = null,
351
+ type = "text",
352
+ invalid,
353
+ value,
354
+ getCount = countCodePointsInString,
539
355
  ...props
540
- }, forwardRef18) {
541
- const {
542
- className,
543
- showLabel = false,
544
- showCount = false,
545
- label,
546
- requiredText,
547
- subLabel,
548
- disabled = false,
549
- required,
550
- invalid = false,
551
- assistiveText,
552
- maxLength,
553
- prefix = null,
554
- suffix = null,
555
- ...restProps
556
- } = props;
356
+ }, forwardRef23) {
357
+ const inputRef = useRef(null);
557
358
  const {
558
359
  visuallyHiddenProps
559
360
  } = useVisuallyHidden();
560
- const ariaRef = useRef(null);
561
- const [count, setCount] = useState(countCodePointsInString(props.value ?? ""));
562
- const nonControlled = props.value === void 0;
563
- const handleChange = useCallback3((value) => {
564
- const count2 = countCodePointsInString(value);
361
+ const [count, setCount] = useState(getCount(value ?? ""));
362
+ const handleChange = useCallback4((e) => {
363
+ const value2 = e.target.value;
364
+ const count2 = getCount(value2);
565
365
  if (maxLength !== void 0 && count2 > maxLength) {
566
366
  return;
567
367
  }
568
- if (nonControlled) {
569
- setCount(count2);
570
- }
571
- onChange?.(value);
572
- }, [maxLength, nonControlled, onChange]);
368
+ setCount(count2);
369
+ onChange?.(value2);
370
+ }, [getCount, maxLength, onChange]);
573
371
  useEffect2(() => {
574
- setCount(countCodePointsInString(props.value ?? ""));
575
- }, [props.value]);
576
- const {
577
- inputProps: ariaInputProps,
578
- labelProps,
579
- descriptionProps,
580
- errorMessageProps
581
- } = useTextField({
582
- inputElementType: "input",
583
- isDisabled: disabled,
584
- isRequired: required,
585
- validationState: invalid ? "invalid" : "valid",
586
- description: !invalid && assistiveText,
587
- errorMessage: invalid && assistiveText,
588
- onChange: handleChange,
589
- ...props
590
- }, ariaRef);
372
+ setCount(getCount(value ?? ""));
373
+ }, [getCount, value]);
591
374
  const containerRef = useRef(null);
592
- useFocusWithClick(containerRef, ariaRef);
593
- const inputProps = mergeProps(restProps, ariaInputProps);
594
- return /* @__PURE__ */ jsxs6(TextFieldRoot, { className, isDisabled: disabled, children: [
595
- /* @__PURE__ */ jsx10(TextFieldLabel, { label, requiredText, required, subLabel, ...labelProps, ...!showLabel ? visuallyHiddenProps : {} }),
596
- /* @__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 }),
599
- (suffix || showCount) && /* @__PURE__ */ jsxs6(SuffixContainer, { children: [
375
+ useFocusWithClick(containerRef, inputRef);
376
+ const inputId = useId2(props.id);
377
+ const describedbyId = useId2();
378
+ const labelledbyId = useId2();
379
+ const showAssistiveText = assistiveText != null && assistiveText.length !== 0;
380
+ const classNames = useClassNames("charcoal-text-field-root");
381
+ return /* @__PURE__ */ jsxs4("div", { className: classNames, "aria-disabled": disabled, children: [
382
+ /* @__PURE__ */ jsx13(FieldLabel_default, { htmlFor: inputId, id: labelledbyId, label, required, requiredText, subLabel, ...!showLabel ? visuallyHiddenProps : {} }),
383
+ /* @__PURE__ */ jsxs4("div", { className: "charcoal-text-field-container", "aria-disabled": disabled === true ? true : void 0, "data-invalid": invalid === true, ref: containerRef, children: [
384
+ prefix && /* @__PURE__ */ jsx13("div", { className: "charcoal-text-field-prefix", children: prefix }),
385
+ /* @__PURE__ */ jsx13("input", { className: "charcoal-text-field-input", "aria-describedby": showAssistiveText ? describedbyId : void 0, "aria-invalid": invalid, "aria-labelledby": labelledbyId, id: inputId, "data-invalid": invalid === true, maxLength, onChange: handleChange, disabled, ref: mergeRefs2(forwardRef23, inputRef), type, value, ...props }),
386
+ (suffix || showCount) && /* @__PURE__ */ jsxs4("div", { className: "charcoal-text-field-suffix", children: [
600
387
  suffix,
601
- showCount && /* @__PURE__ */ jsx10(SingleLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
388
+ showCount && /* @__PURE__ */ jsx13("span", { className: "charcoal-text-field-line-counter", children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
602
389
  ] })
603
390
  ] }),
604
- assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ jsx10(AssistiveText, { invalid, ...invalid ? errorMessageProps : descriptionProps, children: assistiveText })
391
+ showAssistiveText && /* @__PURE__ */ jsx13(AssistiveText, { "data-invalid": invalid === true, id: describedbyId, children: assistiveText })
605
392
  ] });
606
393
  });
607
394
  var TextField_default = TextField;
608
- var TextFieldRoot = styled7.div.withConfig({
609
- componentId: "ccl__sc-3dd0tt-0"
610
- })(["display:flex;flex-direction:column;", ""], (p) => p.isDisabled && {
611
- opacity: p.theme.elementEffect.disabled.opacity
612
- });
613
- var TextFieldLabel = styled7(FieldLabel_default).withConfig({
614
- componentId: "ccl__sc-3dd0tt-1"
615
- })(["margin-bottom:8px;"]);
616
- var StyledInputContainer = styled7.div.withConfig({
617
- componentId: "ccl__sc-3dd0tt-2"
618
- })(["display:grid;grid-template-columns:", ";height:40px;transition:0.2s background-color,0.2s box-shadow;color:var(--charcoal-text2);background-color:var(--charcoal-surface3);border-radius:4px;gap:4px;padding:0 8px;line-height:22px;font-size:14px;:not(:disabled):not([aria-disabled]):hover,[aria-disabled='false']:hover{background-color:var(--charcoal-surface3-hover);}:focus-within{outline:none;box-shadow:0 0 0 4px ", ";}", ""], (p) => [p.hasPrefix && "auto", "1fr", p.hasSuffix && "auto"].filter(Boolean).join(" "), (p) => p.invalid ? `rgba(255,43,0,0.32)` : `rgba(0, 150, 250, 0.32);`, (p) => p.invalid && css3(["box-shadow:0 0 0 4px rgba(255,43,0,0.32);"]));
619
- var PrefixContainer = styled7.div.withConfig({
620
- componentId: "ccl__sc-3dd0tt-3"
621
- })(["display:flex;align-items:center;"]);
622
- var SuffixContainer = styled7.span.withConfig({
623
- componentId: "ccl__sc-3dd0tt-4"
624
- })(["display:flex;align-items:center;gap:8px;"]);
625
- var StyledInput = styled7.input.withConfig({
626
- componentId: "ccl__sc-3dd0tt-5"
627
- })(["border:none;box-sizing:border-box;outline:none;font-family:inherit;transform-origin:top left;transform:scale(0.875);width:calc(100% / 0.875);height:calc(100% / 0.875);font-size:calc(14px / 0.875);line-height:calc(22px / 0.875);padding-left:0;padding-right:0;border-radius:calc(4px / 0.875);appearance:none;background:transparent;color:var(--charcoal-text2);&::placeholder{color:var(--charcoal-text3);}"]);
628
- var SingleLineCounter = styled7.span.withConfig({
629
- componentId: "ccl__sc-3dd0tt-6"
630
- })(["line-height:22px;font-size:14px;color:var(--charcoal-text3);"]);
631
- var AssistiveText = styled7.p.withConfig({
632
- componentId: "ccl__sc-3dd0tt-7"
633
- })(["font-size:14px;line-height:22px;margin-top:4px;margin-bottom:-4px;color:", ";"], (p) => `var(--charcoal-${p.invalid ? `assertive` : `text2`})`);
634
395
 
635
396
  // src/components/TextArea/index.tsx
636
- import { useTextField as useTextField2 } from "@react-aria/textfield";
637
397
  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";
639
- import styled8, { css as css4 } from "styled-components";
640
- 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({
398
+ import { forwardRef as forwardRef12, useCallback as useCallback5, useEffect as useEffect3, useRef as useRef2, useState as useState2 } from "react";
399
+ import { useId as useId3 } from "@react-aria/utils";
400
+ import { jsx as jsx14, jsxs as jsxs5 } from "react/jsx-runtime";
401
+ var TextArea = forwardRef12(function TextAreaInner({
643
402
  onChange,
403
+ className,
404
+ value,
405
+ showCount = false,
406
+ showLabel = false,
407
+ label = "",
408
+ requiredText,
409
+ subLabel,
410
+ disabled = false,
411
+ required,
412
+ assistiveText,
413
+ maxLength,
414
+ autoHeight = false,
415
+ rows: initialRows = 4,
416
+ invalid,
417
+ getCount = countCodePointsInString,
644
418
  ...props
645
- }, forwardRef18) {
646
- const {
647
- className,
648
- showCount = false,
649
- showLabel = false,
650
- label,
651
- requiredText,
652
- subLabel,
653
- disabled = false,
654
- required,
655
- invalid = false,
656
- assistiveText,
657
- maxLength,
658
- autoHeight = false,
659
- rows: initialRows = 4,
660
- ...restProps
661
- } = props;
419
+ }, forwardRef23) {
662
420
  const {
663
421
  visuallyHiddenProps
664
422
  } = useVisuallyHidden2();
665
423
  const textareaRef = useRef2(null);
666
- const ariaRef = useRef2(null);
667
- const [count, setCount] = useState2(countCodePointsInString(props.value ?? ""));
424
+ const [count, setCount] = useState2(getCount(value ?? ""));
668
425
  const [rows, setRows] = useState2(initialRows);
669
- const syncHeight = useCallback4((textarea) => {
426
+ const syncHeight = useCallback5((textarea) => {
670
427
  const rows2 = (`${textarea.value}
671
428
  `.match(/\n/gu)?.length ?? 0) || 1;
672
429
  setRows(initialRows <= rows2 ? rows2 : initialRows);
673
430
  }, [initialRows]);
674
- const nonControlled = props.value === void 0;
675
- const handleChange = useCallback4((value) => {
676
- const count2 = countCodePointsInString(value);
431
+ const nonControlled = value === void 0;
432
+ const handleChange = useCallback5((e) => {
433
+ const value2 = e.target.value;
434
+ const count2 = getCount(value2);
677
435
  if (maxLength !== void 0 && count2 > maxLength) {
678
436
  return;
679
437
  }
@@ -683,110 +441,67 @@ var TextArea = forwardRef10(function TextAreaInner({
683
441
  if (autoHeight && textareaRef.current !== null) {
684
442
  syncHeight(textareaRef.current);
685
443
  }
686
- onChange?.(value);
687
- }, [autoHeight, maxLength, nonControlled, onChange, syncHeight]);
444
+ onChange?.(value2);
445
+ }, [autoHeight, getCount, maxLength, nonControlled, onChange, syncHeight]);
688
446
  useEffect3(() => {
689
- setCount(countCodePointsInString(props.value ?? ""));
690
- }, [props.value]);
691
- const {
692
- inputProps: ariaInputProps,
693
- labelProps,
694
- descriptionProps,
695
- errorMessageProps
696
- } = useTextField2({
697
- inputElementType: "textarea",
698
- isDisabled: disabled,
699
- isRequired: required,
700
- validationState: invalid ? "invalid" : "valid",
701
- description: !invalid && assistiveText,
702
- errorMessage: invalid && assistiveText,
703
- onChange: handleChange,
704
- ...props
705
- }, ariaRef);
447
+ setCount(getCount(value ?? ""));
448
+ }, [getCount, value]);
706
449
  useEffect3(() => {
707
450
  if (autoHeight && textareaRef.current !== null) {
708
451
  syncHeight(textareaRef.current);
709
452
  }
710
453
  }, [autoHeight, syncHeight]);
711
454
  const containerRef = useRef2(null);
712
- useFocusWithClick(containerRef, ariaRef);
713
- const inputProps = mergeProps2(restProps, ariaInputProps);
714
- return /* @__PURE__ */ jsxs7(TextFieldRoot2, { className, isDisabled: disabled, children: [
715
- /* @__PURE__ */ jsx11(TextFieldLabel, { label, requiredText, required, subLabel, ...labelProps, ...!showLabel ? visuallyHiddenProps : {} }),
716
- /* @__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 })
455
+ useFocusWithClick(containerRef, textareaRef);
456
+ const textAreaId = useId3(props.id);
457
+ const describedbyId = useId3();
458
+ const labelledbyId = useId3();
459
+ const classNames = useClassNames("charcoal-text-area-root", className);
460
+ const showAssistiveText = assistiveText != null && assistiveText.length !== 0;
461
+ return /* @__PURE__ */ jsxs5("div", { className: classNames, "aria-disabled": disabled, children: [
462
+ /* @__PURE__ */ jsx14(FieldLabel_default, { htmlFor: textAreaId, id: labelledbyId, label, required, requiredText, subLabel, ...!showLabel ? visuallyHiddenProps : {} }),
463
+ /* @__PURE__ */ jsxs5("div", { className: "charcoal-text-area-container", "aria-disabled": disabled === true ? "true" : void 0, "aria-invalid": invalid === true, ref: containerRef, style: {
464
+ "--charcoal-text-area-rows": `${showCount ? rows + 1 : rows}`
465
+ }, children: [
466
+ /* @__PURE__ */ jsx14("textarea", { className: "charcoal-text-area-textarea", "aria-describedby": showAssistiveText ? describedbyId : void 0, "aria-invalid": invalid, "aria-labelledby": labelledbyId, id: textAreaId, maxLength, "data-no-bottom-padding": showCount, onChange: handleChange, ref: mergeRefs(forwardRef23, textareaRef), rows, value, disabled, ...props }),
467
+ showCount && /* @__PURE__ */ jsx14("span", { className: "charcoal-text-area-counter", children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
719
468
  ] }),
720
- assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ jsx11(AssistiveText, { invalid, ...invalid ? errorMessageProps : descriptionProps, children: assistiveText })
469
+ showAssistiveText && /* @__PURE__ */ jsx14(AssistiveText, { "data-invalid": invalid === true, id: describedbyId, children: assistiveText })
721
470
  ] });
722
471
  });
723
472
  var TextArea_default = TextArea;
724
- var TextFieldRoot2 = styled8.div.withConfig({
725
- componentId: "ccl__sc-58waht-0"
726
- })(["display:flex;flex-direction:column;", ""], (p) => p.isDisabled && {
727
- opacity: p.theme.elementEffect.disabled.opacity
728
- });
729
- var StyledTextareaContainer = styled8.div.withConfig({
730
- componentId: "ccl__sc-58waht-1"
731
- })(["position:relative;overflow:hidden;color:var(--charcoal-text2);background-color:var(--charcoal-surface3);border-radius:4px;transition:0.2s background-color,0.2s box-shadow;", ";:not([aria-disabled]):hover,[aria-disabled='false']:hover{background-color:var(--charcoal-surface3-hover);}:focus-within{outline:none;box-shadow:0 0 0 4px ", ";}", ""], ({
732
- rows
733
- }) => css4(["height:calc(22px * ", " + 18px);"], rows), (p) => p.invalid ? `rgba(255,43,0,0.32)` : `rgba(0, 150, 250, 0.32);`, (p) => p.invalid && css4(["box-shadow:0 0 0 4px rgba(255,43,0,0.32);"]));
734
- var StyledTextarea = styled8.textarea.withConfig({
735
- componentId: "ccl__sc-58waht-2"
736
- })(["border:none;outline:none;resize:none;font-family:inherit;color:inherit;box-sizing:border-box;transform-origin:top left;transform:scale(0.875);width:calc(100% / 0.875);font-size:calc(14px / 0.875);line-height:calc(22px / 0.875);padding:calc(9px / 0.875) calc(8px / 0.875) ", ";", ";appearance:none;background:none;&::placeholder{color:var(--charcoal-text3);}"], (p) => p.noBottomPadding ? 0 : "", ({
737
- rows = 1,
738
- noBottomPadding
739
- }) => css4(["height:calc(22px / 0.875 * ", " + ", "px);"], rows, noBottomPadding ? 9 : 20));
740
- var MultiLineCounter = styled8.span.withConfig({
741
- componentId: "ccl__sc-58waht-3"
742
- })(["position:absolute;bottom:9px;right:8px;line-height:22px;font-size:14px;color:var(--charcoal-text3);"]);
743
473
 
744
474
  // src/components/Icon/index.tsx
745
- import * as React7 from "react";
475
+ import * as React8 from "react";
746
476
  import "@charcoal-ui/icons";
747
- import { jsx as jsx12 } from "react/jsx-runtime";
748
- var Icon = React7.forwardRef(function IconInner({
477
+ import { jsx as jsx15 } from "react/jsx-runtime";
478
+ var Icon = React8.forwardRef(function IconInner({
749
479
  name,
750
480
  scale,
751
481
  unsafeNonGuidelineScale,
752
482
  className,
753
483
  ...rest
754
484
  }, ref) {
755
- return /* @__PURE__ */ jsx12("pixiv-icon", { ref, name, scale, "unsafe-non-guideline-scale": unsafeNonGuidelineScale, class: className, ...rest });
485
+ return /* @__PURE__ */ jsx15("pixiv-icon", { ref, name, scale, "unsafe-non-guideline-scale": unsafeNonGuidelineScale, class: className, ...rest });
756
486
  });
757
487
  var Icon_default = Icon;
758
488
 
759
489
  // src/components/Modal/index.tsx
760
- import { useContext as useContext4, forwardRef as forwardRef13, memo as memo4 } from "react";
761
- import * as React11 from "react";
490
+ import { useContext as useContext2, forwardRef as forwardRef15, memo as memo5 } from "react";
491
+ import * as React12 from "react";
762
492
  import { Overlay } from "@react-aria/overlays";
763
- import styled10, { css as css6, useTheme } from "styled-components";
764
- import { maxWidth as maxWidth2 } from "@charcoal-ui/utils";
765
- import { useMedia } from "@charcoal-ui/styled";
766
- import { animated as animated2, useTransition, easings } from "react-spring";
767
- import { useObjectRef as useObjectRef2 } from "@react-aria/utils";
493
+ import { animated, useTransition, easings } from "react-spring";
494
+ import { useObjectRef } from "@react-aria/utils";
768
495
 
769
496
  // src/components/Modal/Dialog/index.tsx
770
- import { forwardRef as forwardRef12 } from "react";
771
- import styled9, { css as css5 } from "styled-components";
497
+ import { forwardRef as forwardRef14 } from "react";
772
498
  import { useDialog } from "@react-aria/dialog";
773
499
 
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
782
- import { maxWidth } from "@charcoal-ui/utils";
783
- import { animated } from "react-spring";
784
-
785
500
  // src/_lib/useForwardedRef.tsx
786
- import * as React8 from "react";
501
+ import * as React9 from "react";
787
502
  function useForwardedRef(ref) {
788
- const innerRef = React8.useRef(null);
789
- React8.useEffect(() => {
503
+ const innerRef = React9.useRef(null);
504
+ React9.useEffect(() => {
790
505
  if (!ref)
791
506
  return;
792
507
  if (typeof ref === "function") {
@@ -799,44 +514,49 @@ function useForwardedRef(ref) {
799
514
  }
800
515
 
801
516
  // src/components/Modal/Dialog/index.tsx
802
- import { jsx as jsx13 } from "react/jsx-runtime";
803
- var Dialog = forwardRef12(function Dialog2(props, forwardRef18) {
804
- const ref = useForwardedRef(forwardRef18);
517
+ import { jsx as jsx16 } from "react/jsx-runtime";
518
+ var Dialog = forwardRef14(function Dialog2({
519
+ size,
520
+ bottomSheet,
521
+ className,
522
+ ...props
523
+ }, forwardRef23) {
524
+ const ref = useForwardedRef(forwardRef23);
805
525
  const {
806
526
  dialogProps
807
527
  } = useDialog({
808
528
  role: "dialog"
809
529
  }, ref);
810
- return /* @__PURE__ */ jsx13(AnimatedStyledDialogDiv, { ...props, role: dialogProps.role, tabIndex: dialogProps.tabIndex, "aria-labelledby": dialogProps["aria-labelledby"], onBlur: dialogProps.onBlur, ref });
530
+ const classNames = useClassNames("charcoal-modal-dialog", className);
531
+ return /* @__PURE__ */ jsx16("div", { className: classNames, role: dialogProps.role, "data-bottom-sheet": bottomSheet, tabIndex: dialogProps.tabIndex, "aria-labelledby": dialogProps["aria-labelledby"], onBlur: dialogProps.onBlur, "data-size": size, ref, ...props });
811
532
  });
812
- var AnimatedStyledDialogDiv = animated(styled9.div.withConfig({
813
- componentId: "ccl__sc-1ep4f6v-0"
814
- })(["margin:auto;position:relative;height:fit-content;width:", "px;background-color:var(--charcoal-surface1);border-radius:24px;@media ", "{max-width:440px;width:calc(100% - 48px);", "}:focus{outline:none;}"], (p) => {
815
- switch (p.size) {
816
- case "S": {
817
- return columnSystem(3, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2;
818
- }
819
- case "M": {
820
- return columnSystem(4, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2;
821
- }
822
- case "L": {
823
- return columnSystem(6, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2;
824
- }
825
- default: {
826
- return unreachable(p.size);
827
- }
828
- }
829
- }, ({
830
- theme
831
- }) => maxWidth(theme.breakpoint.screen1), (p) => p.bottomSheet !== false && css5(["max-width:unset;width:100%;border-radius:0;margin:auto 0 0 0;", ""], p.bottomSheet === "full" && css5(["min-height:100%;"]))));
832
533
 
833
534
  // src/components/Modal/ModalBackgroundContext.tsx
834
- import * as React9 from "react";
835
- var ModalBackgroundContext = React9.createContext(null);
535
+ import * as React10 from "react";
536
+ var ModalBackgroundContext = React10.createContext(null);
537
+
538
+ // src/components/Modal/useCustomModalOverlay.tsx
539
+ import * as React11 from "react";
540
+ import { ariaHideOutside, useOverlay, useOverlayFocusContain } from "@react-aria/overlays";
541
+
542
+ // src/components/DropdownSelector/Popover/usePreventScroll.tsx
543
+ import { useEffect as useEffect5 } from "react";
544
+ function usePreventScroll(element, isOpen) {
545
+ useEffect5(() => {
546
+ if (isOpen && element) {
547
+ const defaultPaddingRight = element.style.paddingRight;
548
+ const defaultOverflow = element.style.overflow;
549
+ element.style.paddingRight = `${window.innerWidth - element.clientWidth}px`;
550
+ element.style.overflow = "hidden";
551
+ return () => {
552
+ element.style.paddingRight = defaultPaddingRight;
553
+ element.style.overflow = defaultOverflow;
554
+ };
555
+ }
556
+ }, [element, isOpen]);
557
+ }
836
558
 
837
559
  // src/components/Modal/useCustomModalOverlay.tsx
838
- import * as React10 from "react";
839
- import { ariaHideOutside, useOverlay, useOverlayFocusContain, usePreventScroll } from "@react-aria/overlays";
840
560
  function useCharcoalModalOverlay(props, state, ref) {
841
561
  const {
842
562
  overlayProps,
@@ -847,11 +567,9 @@ function useCharcoalModalOverlay(props, state, ref) {
847
567
  onClose: state.onClose,
848
568
  shouldCloseOnInteractOutside: () => false
849
569
  }, ref);
850
- usePreventScroll({
851
- isDisabled: !state.isOpen
852
- });
570
+ usePreventScroll(typeof document !== "undefined" ? document.body : null, state.isOpen);
853
571
  useOverlayFocusContain();
854
- React10.useEffect(() => {
572
+ React11.useEffect(() => {
855
573
  if (state.isOpen && ref.current) {
856
574
  return ariaHideOutside([ref.current]);
857
575
  }
@@ -861,11 +579,24 @@ function useCharcoalModalOverlay(props, state, ref) {
861
579
  underlayProps
862
580
  };
863
581
  }
582
+ function useWindowWidth() {
583
+ const [width, setWidth] = React11.useState(window.innerWidth);
584
+ React11.useEffect(() => {
585
+ const handleResize = () => {
586
+ setWidth(window.innerWidth);
587
+ };
588
+ window.addEventListener("resize", handleResize);
589
+ return () => {
590
+ window.removeEventListener("resize", handleResize);
591
+ };
592
+ });
593
+ return width;
594
+ }
864
595
 
865
596
  // src/components/Modal/index.tsx
866
- import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
597
+ import { jsx as jsx17, jsxs as jsxs6 } from "react/jsx-runtime";
867
598
  var DEFAULT_Z_INDEX = 10;
868
- var Modal = forwardRef13(function ModalInner({
599
+ var Modal = forwardRef15(function ModalInner({
869
600
  children,
870
601
  zIndex = DEFAULT_Z_INDEX,
871
602
  portalContainer,
@@ -878,9 +609,10 @@ var Modal = forwardRef13(function ModalInner({
878
609
  isDismissable,
879
610
  onClose,
880
611
  className,
881
- isOpen = false
612
+ isOpen = false,
613
+ closeButtonAriaLabel = "Close"
882
614
  } = props;
883
- const ref = useObjectRef2(external);
615
+ const ref = useObjectRef(external);
884
616
  const {
885
617
  modalProps,
886
618
  underlayProps
@@ -891,8 +623,7 @@ var Modal = forwardRef13(function ModalInner({
891
623
  onClose,
892
624
  isOpen
893
625
  }, ref);
894
- const theme = useTheme();
895
- const isMobile = useMedia(maxWidth2(theme.breakpoint.screen1)) ?? false;
626
+ const isMobile = useWindowWidth() < 744;
896
627
  const transitionEnabled = isMobile && bottomSheet !== false;
897
628
  const showDismiss = !isMobile || bottomSheet !== true;
898
629
  const transition = useTransition(isOpen, {
@@ -920,8 +651,8 @@ var Modal = forwardRef13(function ModalInner({
920
651
  duration: 0
921
652
  }
922
653
  });
923
- const bgRef = React11.useRef(null);
924
- const handleClick = React11.useCallback((e) => {
654
+ const bgRef = React12.useRef(null);
655
+ const handleClick = React12.useCallback((e) => {
925
656
  if (e.currentTarget === e.target) {
926
657
  onClose();
927
658
  }
@@ -930,12 +661,15 @@ var Modal = forwardRef13(function ModalInner({
930
661
  backgroundColor,
931
662
  overflow,
932
663
  transform
933
- }, item) => item && /* @__PURE__ */ jsx14(Overlay, { portalContainer, children: /* @__PURE__ */ jsx14(ModalBackground, { ref: bgRef, zIndex, ...underlayProps, style: transitionEnabled ? {
664
+ }, item) => item && /* @__PURE__ */ jsx17(Overlay, { portalContainer, children: /* @__PURE__ */ jsx17(animated.div, { className: "charcoal-modal-background", ref: bgRef, ...underlayProps, style: transitionEnabled ? {
934
665
  backgroundColor,
935
- overflow
936
- } : {}, $bottomSheet: bottomSheet, onClick: handleClick, children: /* @__PURE__ */ jsx14(ModalBackgroundContext.Provider, { value: bgRef.current, children: /* @__PURE__ */ jsx14(Dialog, { ref, ...modalProps, style: transitionEnabled ? {
666
+ overflow,
667
+ zIndex
668
+ } : {
669
+ zIndex
670
+ }, "data-bottom-sheet": bottomSheet, onClick: handleClick, children: /* @__PURE__ */ jsx17(ModalBackgroundContext.Provider, { value: bgRef.current, children: /* @__PURE__ */ jsx17(AnimatedDialog, { ref, ...modalProps, style: transitionEnabled ? {
937
671
  transform
938
- } : {}, size, bottomSheet, className, children: /* @__PURE__ */ jsxs8(ModalContext.Provider, { value: {
672
+ } : {}, size, bottomSheet, className, children: /* @__PURE__ */ jsxs6(ModalContext.Provider, { value: {
939
673
  titleProps: {},
940
674
  title,
941
675
  close: onClose,
@@ -943,92 +677,50 @@ var Modal = forwardRef13(function ModalInner({
943
677
  bottomSheet
944
678
  }, children: [
945
679
  children,
946
- isDismissable === true && /* @__PURE__ */ jsx14(ModalCrossButton, { size: "S", icon: "24/Close", onClick: onClose })
680
+ isDismissable === true && /* @__PURE__ */ jsx17(ModalCloseButton, { "aria-label": closeButtonAriaLabel, onClick: onClose })
947
681
  ] }) }) }) }) }));
948
682
  });
949
- var Modal_default = memo4(Modal);
950
- var ModalContext = React11.createContext({
683
+ var AnimatedDialog = animated(Dialog);
684
+ var Modal_default = memo5(Modal);
685
+ var ModalContext = React12.createContext({
951
686
  titleProps: {},
952
687
  title: "",
953
688
  close: void 0,
954
689
  showDismiss: true,
955
690
  bottomSheet: false
956
691
  });
957
- var ModalBackground = animated2(styled10.div.withConfig({
958
- componentId: "ccl__sc-h2bc55-0"
959
- })(["z-index:", ";overflow:auto;display:flex;position:fixed;top:0;left:0;width:-webkit-fill-available;width:-moz-available;height:100%;justify-content:center;padding:40px 0;box-sizing:border-box;background-color:var(--charcoal-surface4);@media ", "{", "}"], ({
960
- zIndex
961
- }) => zIndex, ({
962
- theme
963
- }) => maxWidth2(theme.breakpoint.screen1), (p) => p.$bottomSheet !== false && css6(["padding:0;"])));
964
- var ModalCrossButton = styled10(IconButton_default).withConfig({
965
- componentId: "ccl__sc-h2bc55-1"
966
- })(["position:absolute;top:8px;right:8px;color:var(--charcoal-text3);transition:0.2s color;&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{&:hover{color:var(--charcoal-text3-hover);}&:active{color:var(--charcoal-text3-press);}}"]);
967
- function ModalTitle(props) {
968
- const {
969
- titleProps,
970
- title
971
- } = useContext4(ModalContext);
972
- return /* @__PURE__ */ jsx14(ModalHeading, { ...titleProps, ...props, children: title });
692
+ function ModalCloseButton(props) {
693
+ return /* @__PURE__ */ jsx17(IconButton_default, { className: "charcoal-modal-close-button", size: "S", icon: "24/Close", type: "button", ...props });
973
694
  }
974
- var ModalHeading = styled10.h3.withConfig({
975
- componentId: "ccl__sc-h2bc55-2"
976
- })(["margin:0;font-weight:inherit;font-size:inherit;"]);
977
695
 
978
696
  // src/components/Modal/ModalPlumbing.tsx
979
- import styled11, { css as css7 } from "styled-components";
980
- import { useContext as useContext5 } from "react";
981
- import { maxWidth as maxWidth3 } from "@charcoal-ui/utils";
982
- import { jsx as jsx15 } from "react/jsx-runtime";
697
+ import { useContext as useContext3 } from "react";
698
+ import { jsx as jsx18 } from "react/jsx-runtime";
983
699
  function ModalHeader() {
984
- const modalCtx = useContext5(ModalContext);
985
- return /* @__PURE__ */ jsx15(ModalHeaderRoot, { $bottomSheet: modalCtx.bottomSheet, children: /* @__PURE__ */ jsx15(StyledModalTitle, {}) });
700
+ const modalCtx = useContext3(ModalContext);
701
+ return /* @__PURE__ */ jsx18("div", { className: "charcoal-modal-header-root", "data-bottom-sheet": modalCtx.bottomSheet, children: /* @__PURE__ */ jsx18("div", { className: "charcoal-modal-header-title", children: modalCtx.title }) });
986
702
  }
987
- var ModalHeaderRoot = styled11.div.withConfig({
988
- componentId: "ccl__sc-1k33wze-0"
989
- })(["height:64px;display:grid;align-content:center;justify-content:center;@media ", "{", "}"], ({
990
- theme
991
- }) => maxWidth3(theme.breakpoint.screen1), (p) => p.$bottomSheet !== false && css7(["height:48px;"]));
992
- var StyledModalTitle = styled11(ModalTitle).withConfig({
993
- componentId: "ccl__sc-1k33wze-1"
994
- })(["color:var(--charcoal-text1);font-size:16px;line-height:24px;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;}"]);
995
- var ModalAlign = styled11.div.withConfig({
996
- componentId: "ccl__sc-1k33wze-2"
997
- })(["padding-left:16px;padding-right:16px;"]);
998
- var ModalBody = styled11.div.withConfig({
999
- componentId: "ccl__sc-1k33wze-3"
1000
- })(["padding-bottom:40px;"]);
1001
- var ModalButtons = styled11.div.withConfig({
1002
- componentId: "ccl__sc-1k33wze-4"
1003
- })(["display:grid;grid-auto-flow:row;grid-row-gap:8px;padding-top:16px;padding-left:16px;padding-right:16px;"]);
703
+ var ModalAlign = createDivComponent("charcoal-modal-align");
704
+ var ModalBody = createDivComponent("charcoal-modal-body");
705
+ var ModalButtons = createDivComponent("charcoal-modal-buttons");
1004
706
 
1005
707
  // src/components/LoadingSpinner/index.tsx
1006
- import { forwardRef as forwardRef14, useImperativeHandle, useRef as useRef5, memo as memo5 } from "react";
1007
- import styled12, { keyframes } from "styled-components";
1008
- import { jsx as jsx16 } from "react/jsx-runtime";
1009
- var LoadingSpinner = forwardRef14(function LoadingSpinnerInner({
708
+ import { forwardRef as forwardRef16, useImperativeHandle, useRef as useRef5, memo as memo6 } from "react";
709
+ import { jsx as jsx19 } from "react/jsx-runtime";
710
+ var LoadingSpinner = forwardRef16(function LoadingSpinnerInner({
1010
711
  size = 48,
1011
712
  padding = 16,
1012
713
  transparent = false,
1013
- className
714
+ ...props
1014
715
  }, ref) {
1015
- return /* @__PURE__ */ jsx16(LoadingSpinnerRoot, { size, padding, transparent, className, ref, children: /* @__PURE__ */ jsx16(LoadingSpinnerIcon, {}) });
716
+ const classNames = useClassNames("charcoal-loading-spinner", props.className);
717
+ return /* @__PURE__ */ jsx19("div", { role: "progressbar", style: {
718
+ "--charcoal-loading-spinner-size": `${size}px`,
719
+ "--charcoal-loading-spinner-padding": `${padding}px`
720
+ }, "data-transparent": transparent, className: classNames, ref, children: /* @__PURE__ */ jsx19(LoadingSpinnerIcon, {}) });
1016
721
  });
1017
- var LoadingSpinner_default = memo5(LoadingSpinner);
1018
- var LoadingSpinnerRoot = styled12.div.attrs({
1019
- role: "progressbar"
1020
- }).withConfig({
1021
- componentId: "ccl__sc-1id6yz4-0"
1022
- })(["box-sizing:content-box;margin:auto;padding:", "px;border-radius:8px;font-size:", "px;width:", "px;height:", "px;opacity:0.84;color:var(--charcoal-text4);background-color:", ";"], (props) => props.padding, (props) => props.size, (props) => props.size, (props) => props.size, ({
1023
- transparent
1024
- }) => `var(--charcoal-${transparent ? "transparent" : "background1"})`);
1025
- var scaleOut = keyframes(["from{transform:scale(0);opacity:1;}to{transform:scale(1);opacity:0;}"]);
1026
- var Icon2 = styled12.div.attrs({
1027
- role: "presentation"
1028
- }).withConfig({
1029
- componentId: "ccl__sc-1id6yz4-1"
1030
- })(["width:1em;height:1em;border-radius:1em;background-color:currentColor;animation:", " 1s both ease-out;animation-iteration-count:", ";&[data-reset-animation]{animation:none;}"], scaleOut, (p) => p.once ? 1 : "infinite");
1031
- var LoadingSpinnerIcon = forwardRef14(function LoadingSpinnerIcon2({
722
+ var LoadingSpinner_default = memo6(LoadingSpinner);
723
+ var LoadingSpinnerIcon = forwardRef16(function LoadingSpinnerIcon2({
1032
724
  once = false
1033
725
  }, ref) {
1034
726
  const iconRef = useRef5(null);
@@ -1042,41 +734,19 @@ var LoadingSpinnerIcon = forwardRef14(function LoadingSpinnerIcon2({
1042
734
  delete iconRef.current.dataset.resetAnimation;
1043
735
  }
1044
736
  }));
1045
- return /* @__PURE__ */ jsx16(Icon2, { ref: iconRef, once });
737
+ return /* @__PURE__ */ jsx19("div", { role: "presentation", ref: iconRef, "data-once": once, className: "charcoal-loading-spinner-icon" });
1046
738
  });
1047
739
 
1048
740
  // src/components/DropdownSelector/index.tsx
1049
- import { useState as useState3, useRef as useRef9, useMemo as useMemo5 } from "react";
1050
- import styled15, { css as css8 } from "styled-components";
1051
- import { disabledSelector as disabledSelector2 } from "@charcoal-ui/utils";
741
+ import { useState as useState4, useRef as useRef9, useMemo as useMemo7, useCallback as useCallback7 } from "react";
1052
742
 
1053
743
  // src/components/DropdownSelector/DropdownPopover.tsx
1054
744
  import { useEffect as useEffect7, useRef as useRef7 } from "react";
1055
745
 
1056
746
  // src/components/DropdownSelector/Popover/index.tsx
1057
- import { useContext as useContext6, useRef as useRef6 } from "react";
747
+ import { useContext as useContext4, useRef as useRef6 } from "react";
1058
748
  import { DismissButton, Overlay as Overlay2, usePopover } from "@react-aria/overlays";
1059
- 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
- import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
749
+ import { jsx as jsx20, jsxs as jsxs7 } from "react/jsx-runtime";
1080
750
  var _empty = () => null;
1081
751
  function Popover(props) {
1082
752
  const defaultPopoverRef = useRef6(null);
@@ -1095,29 +765,28 @@ function Popover(props) {
1095
765
  setOpen: _empty,
1096
766
  toggle: _empty
1097
767
  });
1098
- const modalBackground = useContext6(ModalBackgroundContext);
1099
- usePreventScroll2(modalBackground, props.isOpen);
768
+ const modalBackground = useContext4(ModalBackgroundContext);
769
+ usePreventScroll(modalBackground, props.isOpen);
1100
770
  if (!props.isOpen)
1101
771
  return null;
1102
- return /* @__PURE__ */ jsxs9(Overlay2, { portalContainer: document.body, children: [
1103
- /* @__PURE__ */ jsx17("div", { ...underlayProps, style: {
772
+ return /* @__PURE__ */ jsxs7(Overlay2, { portalContainer: document.body, children: [
773
+ /* @__PURE__ */ jsx20("div", { ...underlayProps, style: {
1104
774
  position: "fixed",
1105
775
  zIndex: typeof popoverProps.style?.zIndex === "number" ? popoverProps.style.zIndex - 1 : 99999,
1106
776
  inset: 0
1107
777
  } }),
1108
- /* @__PURE__ */ jsxs9(DropdownPopoverDiv, { ...popoverProps, ref: finalPopoverRef, children: [
1109
- /* @__PURE__ */ jsx17(DismissButton, { onDismiss: () => props.onClose() }),
778
+ /* @__PURE__ */ jsxs7("div", { ...popoverProps, ref: finalPopoverRef, className: "charcoal-popover", children: [
779
+ /* @__PURE__ */ jsx20(DismissButton, { onDismiss: () => props.onClose() }),
780
+ /* @__PURE__ */ jsx20("div", { tabIndex: 0, onFocus: props.onClose }),
1110
781
  props.children,
1111
- /* @__PURE__ */ jsx17(DismissButton, { onDismiss: () => props.onClose() })
782
+ /* @__PURE__ */ jsx20("div", { tabIndex: 0, onFocus: props.onClose }),
783
+ /* @__PURE__ */ jsx20(DismissButton, { onDismiss: () => props.onClose() })
1112
784
  ] })
1113
785
  ] });
1114
786
  }
1115
- var DropdownPopoverDiv = styled13.div.withConfig({
1116
- componentId: "ccl__sc-jwnoy6-0"
1117
- })(["margin:4px 0;list-style:none;overflow:auto;max-height:inherit;background-color:var(--charcoal-background1);border:solid 1px var(--charcoal-border-default);border-radius:8px;padding-top:8px;padding-bottom:8px;"]);
1118
787
 
1119
788
  // src/components/DropdownSelector/DropdownPopover.tsx
1120
- import { jsx as jsx18 } from "react/jsx-runtime";
789
+ import { jsx as jsx21 } from "react/jsx-runtime";
1121
790
  function DropdownPopover({
1122
791
  children,
1123
792
  ...props
@@ -1129,24 +798,31 @@ function DropdownPopover({
1129
798
  }
1130
799
  }, [props.triggerRef, props.isOpen]);
1131
800
  useEffect7(() => {
1132
- if (props.isOpen && props.value !== void 0) {
1133
- const windowScrollY = window.scrollY;
1134
- const windowScrollX = window.scrollX;
1135
- const selectedElement = document.querySelector(`[data-key="${props.value.toString()}"]`);
1136
- selectedElement?.focus();
1137
- window.scrollTo(windowScrollX, windowScrollY);
801
+ if (props.isOpen) {
802
+ if (props.value !== void 0 && props.value !== "") {
803
+ const windowScrollY = window.scrollY;
804
+ const windowScrollX = window.scrollX;
805
+ const selectedElement = document.querySelector(`[data-key="${props.value.toString()}"]`);
806
+ selectedElement?.focus();
807
+ window.scrollTo(windowScrollX, windowScrollY);
808
+ } else {
809
+ const el = ref.current?.querySelector("[role='option']");
810
+ if (el instanceof HTMLElement) {
811
+ el.focus();
812
+ }
813
+ }
1138
814
  }
1139
815
  }, [props.value, props.isOpen]);
1140
- return /* @__PURE__ */ jsx18(Popover, { isOpen: props.isOpen, onClose: props.onClose, popoverRef: ref, triggerRef: props.triggerRef, children });
816
+ return /* @__PURE__ */ jsx21(Popover, { isOpen: props.isOpen, onClose: props.onClose, popoverRef: ref, triggerRef: props.triggerRef, children });
1141
817
  }
1142
818
 
1143
819
  // src/components/DropdownSelector/utils/findPreviewRecursive.tsx
1144
- import * as React12 from "react";
820
+ import * as React13 from "react";
1145
821
  function findPreviewRecursive(children, value) {
1146
- const childArray = React12.Children.toArray(children);
822
+ const childArray = React13.Children.toArray(children);
1147
823
  for (let i = 0; i < childArray.length; i++) {
1148
824
  const child = childArray[i];
1149
- if (React12.isValidElement(child)) {
825
+ if (React13.isValidElement(child)) {
1150
826
  if ("value" in child.props) {
1151
827
  const childValue = child.props.value;
1152
828
  if (childValue === value && "children" in child.props) {
@@ -1165,12 +841,11 @@ function findPreviewRecursive(children, value) {
1165
841
  }
1166
842
 
1167
843
  // src/components/DropdownSelector/MenuList/index.tsx
1168
- import { useMemo as useMemo4, useRef as useRef8 } from "react";
1169
- import styled14 from "styled-components";
844
+ import { useMemo as useMemo6, useRef as useRef8 } from "react";
1170
845
 
1171
846
  // src/components/DropdownSelector/MenuList/MenuListContext.ts
1172
- import { createContext as createContext6 } from "react";
1173
- var MenuListContext = createContext6({
847
+ import { createContext as createContext4 } from "react";
848
+ var MenuListContext = createContext4({
1174
849
  root: void 0,
1175
850
  value: "",
1176
851
  propsArray: [],
@@ -1179,13 +854,13 @@ var MenuListContext = createContext6({
1179
854
  });
1180
855
 
1181
856
  // src/components/DropdownSelector/MenuList/internals/getValuesRecursive.tsx
1182
- import * as React13 from "react";
857
+ import * as React14 from "react";
1183
858
  function getValuesRecursive(children) {
1184
- const childArray = React13.Children.toArray(children);
859
+ const childArray = React14.Children.toArray(children);
1185
860
  const propsArray = [];
1186
861
  for (let i = 0; i < childArray.length; i++) {
1187
862
  const child = childArray[i];
1188
- if (React13.isValidElement(child)) {
863
+ if (React14.isValidElement(child)) {
1189
864
  const props = child.props;
1190
865
  if ("value" in props && typeof props.value === "string") {
1191
866
  propsArray.push({
@@ -1202,11 +877,11 @@ function getValuesRecursive(children) {
1202
877
  }
1203
878
 
1204
879
  // src/components/DropdownSelector/MenuList/index.tsx
1205
- import { jsx as jsx19 } from "react/jsx-runtime";
880
+ import { jsx as jsx22 } from "react/jsx-runtime";
1206
881
  function MenuList(props) {
1207
882
  const root = useRef8(null);
1208
- const propsArray = useMemo4(() => getValuesRecursive(props.children), [props.children]);
1209
- return /* @__PURE__ */ jsx19(StyledUl, { ref: root, children: /* @__PURE__ */ jsx19(MenuListContext.Provider, { value: {
883
+ const propsArray = useMemo6(() => getValuesRecursive(props.children), [props.children]);
884
+ return /* @__PURE__ */ jsx22("ul", { className: "charcoal-menu-list", ref: root, children: /* @__PURE__ */ jsx22(MenuListContext.Provider, { value: {
1210
885
  value: props.value ?? "",
1211
886
  root,
1212
887
  propsArray,
@@ -1215,91 +890,70 @@ function MenuList(props) {
1215
890
  }
1216
891
  }, children: props.children }) });
1217
892
  }
1218
- var StyledUl = styled14.ul.withConfig({
1219
- componentId: "ccl__sc-1y72v02-0"
1220
- })(["padding:0;margin:0;"]);
1221
893
 
1222
894
  // src/components/DropdownSelector/index.tsx
1223
- import { focusVisibleFocusRingCss as focusVisibleFocusRingCss5 } from "@charcoal-ui/styled";
1224
895
  import { useVisuallyHidden as useVisuallyHidden3 } from "@react-aria/visually-hidden";
1225
- import { jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
1226
- var defaultRequiredText = "*\u5FC5\u9808";
1227
- function DropdownSelector(props) {
896
+ import { useId as useId4 } from "@react-aria/utils";
897
+ import { jsx as jsx23, jsxs as jsxs8 } from "react/jsx-runtime";
898
+ function DropdownSelector({
899
+ onChange,
900
+ showLabel = false,
901
+ ...props
902
+ }) {
1228
903
  const triggerRef = useRef9(null);
1229
- const [isOpen, setIsOpen] = useState3(false);
904
+ const [isOpen, setIsOpen] = useState4(false);
1230
905
  const preview = findPreviewRecursive(props.children, props.value);
1231
- const isPlaceholder = useMemo5(() => props.placeholder !== void 0 && preview === void 0, [preview, props.placeholder]);
906
+ const isPlaceholder = useMemo7(() => props.placeholder !== void 0 && preview === void 0, [preview, props.placeholder]);
1232
907
  const propsArray = getValuesRecursive(props.children);
1233
908
  const {
1234
909
  visuallyHiddenProps
1235
910
  } = useVisuallyHidden3();
1236
- return /* @__PURE__ */ jsxs10(DropdownSelectorRoot, { "aria-disabled": props.disabled, children: [
1237
- 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) => {
1239
- return /* @__PURE__ */ jsx20("option", { value: itemProps.value, disabled: itemProps.disabled, children: itemProps.value }, itemProps.value);
911
+ const handleChange = useCallback7((e) => {
912
+ onChange(e.target.value);
913
+ }, [onChange]);
914
+ const labelId = useId4();
915
+ const describedbyId = useId4();
916
+ const classNames = useClassNames("charcoal-dropdown-selector-root", props.className);
917
+ return /* @__PURE__ */ jsxs8("div", { className: classNames, "aria-disabled": props.disabled, children: [
918
+ /* @__PURE__ */ jsx23(FieldLabel_default, { id: labelId, label: props.label, required: props.required, requiredText: props.requiredText, subLabel: props.subLabel, ...!showLabel ? visuallyHiddenProps : {} }),
919
+ /* @__PURE__ */ jsx23("div", { ...visuallyHiddenProps, "aria-hidden": "true", children: /* @__PURE__ */ jsx23("select", { name: props.name, value: props.value, onChange: handleChange, tabIndex: -1, children: propsArray.map((itemProps) => {
920
+ return /* @__PURE__ */ jsx23("option", { value: itemProps.value, disabled: itemProps.disabled, children: itemProps.value }, itemProps.value);
1240
921
  }) }) }),
1241
- /* @__PURE__ */ jsxs10(DropdownButton, { invalid: props.invalid, disabled: props.disabled, onClick: () => {
922
+ /* @__PURE__ */ jsxs8("button", { className: "charcoal-dropdown-selector-button", "aria-labelledby": labelId, "aria-invalid": props.invalid, "aria-describedby": props.assistiveText !== void 0 ? describedbyId : void 0, disabled: props.disabled, onClick: () => {
1242
923
  if (props.disabled === true)
1243
924
  return;
1244
925
  setIsOpen(true);
1245
- }, ref: triggerRef, type: "button", $active: isOpen, children: [
1246
- /* @__PURE__ */ jsx20(DropdownButtonText, { $isText3: isPlaceholder, children: isPlaceholder ? props.placeholder : preview }),
1247
- /* @__PURE__ */ jsx20(DropdownButtonIcon, { name: "16/Menu" })
926
+ }, ref: triggerRef, type: "button", "data-active": isOpen, children: [
927
+ /* @__PURE__ */ jsx23("span", { className: "charcoal-ui-dropdown-selector-text", "data-placeholder": isPlaceholder, children: isPlaceholder ? props.placeholder : preview }),
928
+ /* @__PURE__ */ jsx23(Icon_default, { className: "charcoal-ui-dropdown-selector-icon", name: "16/Menu" })
1248
929
  ] }),
1249
- 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);
930
+ isOpen && /* @__PURE__ */ jsx23(DropdownPopover, { isOpen, onClose: () => setIsOpen(false), triggerRef, value: props.value, children: /* @__PURE__ */ jsx23(MenuList, { value: props.value, onChange: (v) => {
931
+ onChange(v);
1251
932
  setIsOpen(false);
1252
933
  }, children: props.children }) }),
1253
- props.assistiveText !== void 0 && /* @__PURE__ */ jsx20(AssertiveText, { invalid: props.invalid, children: props.assistiveText })
934
+ props.assistiveText !== void 0 && /* @__PURE__ */ jsx23(AssistiveText, { "data-invalid": props.invalid === true, id: describedbyId, children: props.assistiveText })
1254
935
  ] });
1255
936
  }
1256
- var DropdownSelectorRoot = styled15.div.withConfig({
1257
- componentId: "ccl__sc-1vnxmc8-0"
1258
- })(["display:inline-block;width:100%;", "{cursor:default;opacity:0.32;}"], disabledSelector2);
1259
- var DropdownFieldLabel = styled15(FieldLabel_default).withConfig({
1260
- componentId: "ccl__sc-1vnxmc8-1"
1261
- })(["width:100%;margin-bottom:8px;"]);
1262
- var DropdownButton = styled15.button.withConfig({
1263
- componentId: "ccl__sc-1vnxmc8-2"
1264
- })(["display:flex;justify-content:space-between;align-items:center;height:40px;width:100%;box-sizing:border-box;border:none;cursor:pointer;gap:4px;", "{cursor:default;}padding-right:8px;padding-left:8px;background-color:var(--charcoal-surface3);border-radius:4px;transition:0.2s box-shadow,0.2s background-color;&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{", " ", "}", ""], disabledSelector2, focusVisibleFocusRingCss5, ({
1265
- $active
1266
- }) => $active === true ? css8(["background-color:var(--charcoal-surface3-press);"]) : css8(["&:hover{background-color:var(--charcoal-surface3-hover);}&:active{background-color:var(--charcoal-surface3-press);}"]), ({
1267
- invalid
1268
- }) => invalid === true && css8(["&:not(:disabled):not([aria-disabled]),&[aria-disabled='false']{box-shadow:0 0 0 4px rgba(255,43,0,0.32);}"]));
1269
- var DropdownButtonText = styled15.span.withConfig({
1270
- componentId: "ccl__sc-1vnxmc8-3"
1271
- })(["text-align:left;font-size:14px;line-height:22px;display:flow-root;color:var(--charcoal-", ");overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"], (p) => p.$isText3 ? "text3" : "text2");
1272
- var DropdownButtonIcon = styled15(Icon_default).withConfig({
1273
- componentId: "ccl__sc-1vnxmc8-4"
1274
- })(["color:var(--charcoal-text2);"]);
1275
- var AssertiveText = styled15.div.withConfig({
1276
- componentId: "ccl__sc-1vnxmc8-5"
1277
- })(["margin-top:8px;font-size:14px;color:var(--charcoal-text2);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;}", ""], ({
1278
- invalid
1279
- }) => invalid === true && css8(["color:var(--charcoal-assertive);"]));
1280
937
 
1281
- // src/components/DropdownSelector/DropdownMenuItem.tsx
1282
- import styled17 from "styled-components";
938
+ // src/components/DropdownSelector/MenuItem/index.tsx
939
+ import { forwardRef as forwardRef18 } from "react";
1283
940
 
1284
941
  // src/components/DropdownSelector/ListItem/index.tsx
1285
- import styled16 from "styled-components";
1286
- import { jsx as jsx21 } from "react/jsx-runtime";
1287
- function ListItem(props) {
1288
- const {
1289
- children,
1290
- ...rest
1291
- } = props;
1292
- return /* @__PURE__ */ jsx21(StyledLi, { role: "option", children: /* @__PURE__ */ jsx21(ItemDiv, { ...rest, children: props.children }) });
1293
- }
1294
- var StyledLi = styled16.li.withConfig({
1295
- componentId: "ccl__sc-p1vs75-0"
1296
- })(["list-style:none;"]);
1297
- var ItemDiv = styled16.div.withConfig({
1298
- componentId: "ccl__sc-p1vs75-1"
1299
- })(["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);}}"]);
942
+ import { forwardRef as forwardRef17, useMemo as useMemo8 } from "react";
943
+ import { jsx as jsx24 } from "react/jsx-runtime";
944
+ var ListItem = forwardRef17(function ListItem2({
945
+ as,
946
+ className,
947
+ ...props
948
+ }, ref) {
949
+ const Component = useMemo8(() => as ?? "li", [as]);
950
+ const classNames = useClassNames("charcoal-list-item", className);
951
+ return /* @__PURE__ */ jsx24(Component, { className: classNames, ref, ...props });
952
+ });
953
+ var ListItem_default = ListItem;
1300
954
 
1301
955
  // src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx
1302
- import { useCallback as useCallback6, useContext as useContext7 } from "react";
956
+ import { useCallback as useCallback8, useContext as useContext5 } from "react";
1303
957
 
1304
958
  // src/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.tsx
1305
959
  function handleFocusByKeyBoard(element, parent) {
@@ -1336,12 +990,12 @@ function useMenuItemHandleKeyDown(value) {
1336
990
  setValue,
1337
991
  root,
1338
992
  propsArray
1339
- } = useContext7(MenuListContext);
1340
- const setContextValue = useCallback6(() => {
993
+ } = useContext5(MenuListContext);
994
+ const setContextValue = useCallback8(() => {
1341
995
  if (value !== void 0)
1342
996
  setValue(value);
1343
997
  }, [value, setValue]);
1344
- const handleKeyDown = useCallback6((e) => {
998
+ const handleKeyDown = useCallback8((e) => {
1345
999
  if (e.key === "Enter") {
1346
1000
  setContextValue();
1347
1001
  } else if (e.key === "ArrowUp" || e.key === "ArrowDown") {
@@ -1376,337 +1030,95 @@ function useMenuItemHandleKeyDown(value) {
1376
1030
  }
1377
1031
 
1378
1032
  // src/components/DropdownSelector/MenuItem/index.tsx
1379
- import { jsx as jsx22 } from "react/jsx-runtime";
1380
- function MenuItem(props) {
1381
- const {
1382
- children,
1383
- as,
1384
- ...rest
1385
- } = props;
1386
- const [handleKeyDown, setContextValue] = useMenuItemHandleKeyDown(props.value);
1387
- return /* @__PURE__ */ jsx22(ListItem, { ...rest, as, "data-key": props.value, onKeyDown: handleKeyDown, onClick: props.disabled === true ? void 0 : setContextValue, tabIndex: -1, "aria-disabled": props.disabled, children: props.children });
1388
- }
1033
+ import { jsx as jsx25 } from "react/jsx-runtime";
1034
+ var MenuItem = forwardRef18(function MenuItem2({
1035
+ className,
1036
+ value,
1037
+ disabled,
1038
+ ...props
1039
+ }, ref) {
1040
+ const [handleKeyDown, setContextValue] = useMenuItemHandleKeyDown(value);
1041
+ return /* @__PURE__ */ jsx25(ListItem_default, { ...props, ref, "data-key": value, onKeyDown: handleKeyDown, onClick: disabled === true ? void 0 : setContextValue, tabIndex: -1, "aria-disabled": disabled, role: "option", children: props.children });
1042
+ });
1043
+ var MenuItem_default = MenuItem;
1389
1044
 
1390
- // src/components/DropdownSelector/DropdownMenuItem.tsx
1391
- import { useContext as useContext8 } from "react";
1392
- import { jsx as jsx23, jsxs as jsxs11 } from "react/jsx-runtime";
1045
+ // src/components/DropdownSelector/DropdownMenuItem/index.tsx
1046
+ import { useContext as useContext6 } from "react";
1047
+ import { jsx as jsx26, jsxs as jsxs9 } from "react/jsx-runtime";
1393
1048
  function DropdownMenuItem(props) {
1394
1049
  const {
1395
1050
  value: ctxValue
1396
- } = useContext8(MenuListContext);
1051
+ } = useContext6(MenuListContext);
1397
1052
  const isSelected = props.value === ctxValue;
1398
1053
  const {
1399
1054
  children,
1400
1055
  ...rest
1401
1056
  } = props;
1402
- return /* @__PURE__ */ jsxs11(MenuItem, { ...rest, children: [
1403
- isSelected && /* @__PURE__ */ jsx23(Text2ColorIcon, { name: "16/Check" }),
1404
- /* @__PURE__ */ jsx23(StyledSpan, { isSelected, children: props.children })
1057
+ return /* @__PURE__ */ jsxs9(MenuItem_default, { ...rest, "aria-selected": isSelected, children: [
1058
+ isSelected && /* @__PURE__ */ jsx26(Icon_default, { className: "charcoal-dropdown-selector-menu-item-icon", name: "16/Check" }),
1059
+ /* @__PURE__ */ jsx26("span", { className: "charcoal-dropdown-selector-menu-item", "data-selected": isSelected, children: props.children })
1405
1060
  ] });
1406
1061
  }
1407
- var StyledSpan = styled17.span.withConfig({
1408
- componentId: "ccl__sc-108wg2j-0"
1409
- })(["font-size:14px;line-height:22px;color:var(--charcoal-text2);padding:9px 0;display:flex;align-items:center;width:100%;margin-left:", "px;"], ({
1410
- isSelected
1411
- }) => isSelected === true ? 0 : 20);
1412
- var Text2ColorIcon = styled17(Icon_default).withConfig({
1413
- componentId: "ccl__sc-108wg2j-1"
1414
- })(["color:var(--charcoal-text2);padding-right:4px;"]);
1415
1062
 
1416
1063
  // src/components/DropdownSelector/MenuItemGroup/index.tsx
1417
- import styled18 from "styled-components";
1418
- import { jsx as jsx24, jsxs as jsxs12 } from "react/jsx-runtime";
1064
+ import { jsx as jsx27, jsxs as jsxs10 } from "react/jsx-runtime";
1419
1065
  function MenuItemGroup(props) {
1420
- return /* @__PURE__ */ jsxs12(StyledLi2, { role: "presentation", children: [
1421
- /* @__PURE__ */ jsx24(TextSpan, { children: props.text }),
1422
- /* @__PURE__ */ jsx24(StyledUl2, { role: "group", children: props.children })
1066
+ return /* @__PURE__ */ jsxs10("li", { className: "charcoal-menu-item-group", role: "presentation", children: [
1067
+ /* @__PURE__ */ jsx27("span", { children: props.text }),
1068
+ /* @__PURE__ */ jsx27("ul", { role: "group", children: props.children })
1423
1069
  ] });
1424
1070
  }
1425
- var TextSpan = styled18.span.withConfig({
1426
- componentId: "ccl__sc-1ubjfz7-0"
1427
- })(["display:block;color:var(--charcoal-text3);font-size:12px;font-weight:bold;padding:12px 0 8px 16px;"]);
1428
- var StyledUl2 = styled18.ul.withConfig({
1429
- componentId: "ccl__sc-1ubjfz7-1"
1430
- })(["padding-left:0;margin:0;box-sizing:border-box;list-style:none;overflow:hidden;"]);
1431
- var StyledLi2 = styled18.li.withConfig({
1432
- componentId: "ccl__sc-1ubjfz7-2"
1433
- })(["display:block;"]);
1434
-
1435
- // src/components/SegmentedControl/index.tsx
1436
- 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
1071
 
1662
1072
  // src/components/SegmentedControl/index.tsx
1073
+ import { forwardRef as forwardRef19, memo as memo7, useMemo as useMemo9, useRef as useRef10 } from "react";
1074
+ import { useRadioGroupState } from "@react-stately/radio";
1663
1075
  import { useRadio, useRadioGroup } from "@react-aria/radio";
1664
- import styled19, { css as css9 } from "styled-components";
1665
1076
 
1666
1077
  // src/components/SegmentedControl/RadioGroupContext.tsx
1667
- import { createContext as createContext7, useContext as useContext9 } from "react";
1668
- import { jsx as jsx25 } from "react/jsx-runtime";
1669
- var RadioContext = createContext7(null);
1078
+ import { createContext as createContext5, useContext as useContext7 } from "react";
1079
+ import { jsx as jsx28 } from "react/jsx-runtime";
1080
+ var RadioContext = createContext5(null);
1670
1081
  var RadioProvider = ({
1671
1082
  value,
1672
1083
  children
1673
1084
  }) => {
1674
- return /* @__PURE__ */ jsx25(RadioContext.Provider, { value, children });
1085
+ return /* @__PURE__ */ jsx28(RadioContext.Provider, { value, children });
1675
1086
  };
1676
1087
  var useRadioContext = () => {
1677
- const state = useContext9(RadioContext);
1088
+ const state = useContext7(RadioContext);
1678
1089
  if (state === null)
1679
1090
  throw new Error("`<RadioProvider>` is not likely mounted.");
1680
1091
  return state;
1681
1092
  };
1682
1093
 
1683
1094
  // src/components/SegmentedControl/index.tsx
1684
- import { jsx as jsx26, jsxs as jsxs13 } from "react/jsx-runtime";
1685
- var SegmentedControl = forwardRef15(function SegmentedControlInner(props, ref) {
1686
- const ariaRadioGroupProps = useMemo6(() => ({
1095
+ import { jsx as jsx29, jsxs as jsxs11 } from "react/jsx-runtime";
1096
+ var SegmentedControl = forwardRef19(function SegmentedControlInner(props, ref) {
1097
+ const className = useClassNames("charcoal-segmented-control", props.className);
1098
+ const ariaRadioGroupProps = useMemo9(() => ({
1687
1099
  ...props,
1688
1100
  isDisabled: props.disabled,
1689
1101
  isReadOnly: props.readonly,
1690
1102
  isRequired: props.required,
1691
1103
  "aria-label": props.name
1692
1104
  }), [props]);
1693
- const state = $a54cdc5c1942b639$export$bca9d026f8e704eb(ariaRadioGroupProps);
1105
+ const state = useRadioGroupState(ariaRadioGroupProps);
1694
1106
  const {
1695
1107
  radioGroupProps
1696
1108
  } = useRadioGroup(ariaRadioGroupProps, state);
1697
- const segmentedControlItems = useMemo6(() => {
1109
+ const segmentedControlItems = useMemo9(() => {
1698
1110
  return props.data.map((d) => typeof d === "string" ? {
1699
1111
  value: d,
1700
1112
  label: d
1701
1113
  } : d);
1702
1114
  }, [props.data]);
1703
- return /* @__PURE__ */ jsx26(SegmentedControlRoot, { ref, ...radioGroupProps, className: props.className, children: /* @__PURE__ */ jsx26(RadioProvider, { value: state, children: segmentedControlItems.map((item) => /* @__PURE__ */ jsx26(Segmented, { value: item.value, disabled: item.disabled, children: item.label }, item.value)) }) });
1115
+ return /* @__PURE__ */ jsx29("div", { ref, ...radioGroupProps, className, children: /* @__PURE__ */ jsx29(RadioProvider, { value: state, children: segmentedControlItems.map((item) => /* @__PURE__ */ jsx29(Segmented, { value: item.value, disabled: item.disabled, children: item.label }, item.value)) }) });
1704
1116
  });
1705
- var SegmentedControl_default = memo6(SegmentedControl);
1117
+ var SegmentedControl_default = memo7(SegmentedControl);
1706
1118
  var Segmented = (props) => {
1707
1119
  const state = useRadioContext();
1708
1120
  const ref = useRef10(null);
1709
- const ariaRadioProps = useMemo6(() => ({
1121
+ const ariaRadioProps = useMemo9(() => ({
1710
1122
  value: props.value,
1711
1123
  isDisabled: props.disabled,
1712
1124
  children: props.children
@@ -1716,194 +1128,108 @@ var Segmented = (props) => {
1716
1128
  isDisabled,
1717
1129
  isSelected
1718
1130
  } = useRadio(ariaRadioProps, state, ref);
1719
- return /* @__PURE__ */ jsxs13(SegmentedRoot, { "aria-disabled": isDisabled || state.isReadOnly, checked: isSelected, children: [
1720
- /* @__PURE__ */ jsx26(SegmentedInput, { ...inputProps, ref }),
1721
- /* @__PURE__ */ jsx26(RadioLabel2, { children: /* @__PURE__ */ jsx26(SegmentedLabelInner, { children: props.children }) })
1131
+ return /* @__PURE__ */ jsxs11("label", { className: "charcoal-segmented-control-radio__label", "aria-disabled": isDisabled || state.isReadOnly, "data-checked": isSelected, children: [
1132
+ /* @__PURE__ */ jsx29("input", { className: "charcoal-segmented-control-radio__input", ...inputProps, ref }),
1133
+ props.children
1722
1134
  ] });
1723
1135
  };
1724
- var SegmentedControlRoot = styled19.div.withConfig({
1725
- componentId: "ccl__sc-1xmkkqt-0"
1726
- })(["display:inline-flex;align-items:center;background-color:var(--charcoal-surface3);border-radius:16px;"]);
1727
- var SegmentedRoot = styled19.label.withConfig({
1728
- componentId: "ccl__sc-1xmkkqt-1"
1729
- })(["position:relative;display:flex;align-items:center;cursor:pointer;height:32px;padding-right:16px;padding-left:16px;border-radius:16px;&:disabled,&[aria-disabled]:not([aria-disabled='false']){cursor:default;opacity:0.32;}color:var(--charcoal-text2);", ""], ({
1730
- checked = false
1731
- }) => checked && css9(["background-color:var(--charcoal-brand);color:var(--charcoal-text5);"]));
1732
- var SegmentedInput = styled19.input.withConfig({
1733
- componentId: "ccl__sc-1xmkkqt-2"
1734
- })(["position:absolute;height:0px;width:0px;padding:0;margin:0;appearance:none;box-sizing:border-box;overflow:hidden;white-space:nowrap;opacity:0;"]);
1735
- var RadioLabel2 = styled19.div.withConfig({
1736
- componentId: "ccl__sc-1xmkkqt-3"
1737
- })(["background:transparent;display:flex;align-items:center;height:22px;"]);
1738
- var SegmentedLabelInner = styled19.div.withConfig({
1739
- componentId: "ccl__sc-1xmkkqt-4"
1740
- })(["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
1136
 
1742
1137
  // 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";
1749
- import { jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
1750
- var Checkbox = forwardRef16(function CheckboxInner({
1751
- invalid = false,
1138
+ import { forwardRef as forwardRef21, memo as memo9 } from "react";
1139
+ import { useId as useId5 } from "@react-aria/utils";
1140
+
1141
+ // src/components/Checkbox/CheckboxInput/index.tsx
1142
+ import { forwardRef as forwardRef20, memo as memo8, useCallback as useCallback9 } from "react";
1143
+ import { jsx as jsx30 } from "react/jsx-runtime";
1144
+ var CheckboxInput = forwardRef20(function CheckboxInput2({
1145
+ onChange,
1146
+ checked,
1147
+ invalid,
1148
+ className,
1149
+ rounded,
1752
1150
  ...props
1753
1151
  }, 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 })
1152
+ const handleChange = useCallback9((e) => {
1153
+ const el = e.currentTarget;
1154
+ onChange?.(el.checked);
1155
+ }, [onChange]);
1156
+ const classNames = useClassNames("charcoal-checkbox-input", className);
1157
+ return /* @__PURE__ */ jsx30("input", { className: classNames, ref, type: "checkbox", onChange: handleChange, "aria-invalid": invalid, checked, "data-rounded": rounded, ...props });
1158
+ });
1159
+ var CheckboxInput_default = memo8(CheckboxInput);
1160
+
1161
+ // src/components/Checkbox/CheckboxWithLabel.tsx
1162
+ import React16 from "react";
1163
+ import { jsx as jsx31, jsxs as jsxs12 } from "react/jsx-runtime";
1164
+ var CheckboxWithLabel = React16.memo(function CheckboxWithLabel2({
1165
+ className,
1166
+ children,
1167
+ input,
1168
+ id,
1169
+ disabled
1170
+ }) {
1171
+ const classNames = useClassNames("charcoal-checkbox__label", className);
1172
+ return /* @__PURE__ */ jsxs12("label", { htmlFor: id, "aria-disabled": disabled, className: classNames, children: [
1173
+ input,
1174
+ /* @__PURE__ */ jsx31("div", { className: "charcoal-checkbox__label_div", children })
1775
1175
  ] });
1776
1176
  });
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;"]);
1177
+
1178
+ // src/components/Checkbox/index.tsx
1179
+ import { jsx as jsx32 } from "react/jsx-runtime";
1180
+ var Checkbox = forwardRef21(function Checkbox2({
1181
+ disabled,
1182
+ className,
1183
+ id,
1184
+ children,
1185
+ ...props
1186
+ }, ref) {
1187
+ const htmlId = useId5(id);
1188
+ const noChildren = children === void 0;
1189
+ const input = /* @__PURE__ */ jsx32(CheckboxInput_default, { ...props, className: noChildren ? className : void 0, disabled, id: htmlId, ref });
1190
+ if (noChildren) {
1191
+ return input;
1192
+ }
1193
+ return /* @__PURE__ */ jsx32(CheckboxWithLabel, { className, disabled, id: htmlId, input, children });
1194
+ });
1195
+ var Checkbox_default = memo9(Checkbox);
1796
1196
 
1797
1197
  // 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";
1801
- import { px as px2 } from "@charcoal-ui/utils";
1802
- 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";
1805
- var sizeMap = {
1806
- S: 32,
1807
- M: 40
1808
- };
1809
- var TagItem = forwardRef17(function TagItemInner({
1198
+ import { forwardRef as forwardRef22, memo as memo10, useMemo as useMemo10 } from "react";
1199
+ import { useObjectRef as useObjectRef2 } from "@react-aria/utils";
1200
+ import { jsx as jsx33, jsxs as jsxs13 } from "react/jsx-runtime";
1201
+ var TagItem = forwardRef22(function TagItemInner({
1202
+ component,
1810
1203
  label,
1811
1204
  translatedLabel,
1812
1205
  bgColor = "#7ACCB1",
1813
1206
  bgImage,
1814
1207
  size = "M",
1815
- disabled,
1816
1208
  status = "default",
1817
- className,
1818
1209
  ...props
1819
1210
  }, _ref) {
1820
- const ref = useObjectRef4(_ref);
1821
- const ariaButtonProps = useMemo8(() => ({
1822
- elementType: "a",
1823
- isDisabled: disabled,
1824
- ...props
1825
- }), [disabled, props]);
1826
- const {
1827
- buttonProps
1828
- } = useButton(ariaButtonProps, ref);
1211
+ const ref = useObjectRef2(_ref);
1829
1212
  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 })
1836
- ] }),
1837
- status === "active" && /* @__PURE__ */ jsx28(Icon_default, { name: "16/Remove" })
1838
- ] })
1213
+ const className = useClassNames("charcoal-tag-item", "charcoal-tag-item__bg", props.className);
1214
+ const bgVariant = bgImage !== void 0 && bgImage.length > 0 ? "image" : "color";
1215
+ const bg = bgVariant === "color" ? bgColor : `url(${bgImage ?? ""})`;
1216
+ const Component = useMemo10(() => component ?? "button", [component]);
1217
+ return /* @__PURE__ */ jsxs13(Component, { ...props, ref, className, "data-state": status, "data-bg-variant": bgVariant, "data-size": hasTranslatedLabel ? "M" : size, style: {
1218
+ "--charcoal-tag-item-bg": bg
1219
+ }, children: [
1220
+ /* @__PURE__ */ jsxs13("div", { className: "charcoal-tag-item__label", "data-has-translate": hasTranslatedLabel, children: [
1221
+ hasTranslatedLabel && /* @__PURE__ */ jsx33("span", { className: "charcoal-tag-item__label__translated", children: translatedLabel }),
1222
+ /* @__PURE__ */ jsx33("span", { className: "charcoal-tag-item__label__text", "data-has-translate": hasTranslatedLabel, children: label })
1223
+ ] }),
1224
+ status === "active" && /* @__PURE__ */ jsx33(Icon_default, { name: "16/Remove" })
1839
1225
  ] });
1840
1226
  });
1841
- var TagItem_default = memo8(TagItem);
1842
- var horizontalPadding = ({
1843
- left,
1844
- right
1845
- }) => css11(["padding-right:", ";padding-left:", ";"], px2(right), px2(left));
1846
- var tagItemRootSize = (size) => {
1847
- switch (size) {
1848
- case "M":
1849
- return horizontalPadding({
1850
- left: 24,
1851
- right: 24
1852
- });
1853
- case "S":
1854
- return horizontalPadding({
1855
- left: 16,
1856
- right: 16
1857
- });
1858
- }
1859
- };
1860
- var activeTagItemRoot = horizontalPadding({
1861
- left: 16,
1862
- right: 8
1863
- });
1864
- var TagItemRoot = styled21.a.withConfig({
1865
- componentId: "ccl__sc-11j9pu2-0"
1866
- })(["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
- size
1868
- }) => sizeMap[size], ({
1869
- size,
1870
- status
1871
- }) => status !== "active" && tagItemRootSize(size), ({
1872
- status
1873
- }) => status === "active" && activeTagItemRoot, ({
1874
- status
1875
- }) => status === "inactive" ? "var(--charcoal-text2)" : "var(--charcoal-text5)", focusVisibleFocusRingCss7);
1876
- var Background = styled21.div.withConfig({
1877
- componentId: "ccl__sc-11j9pu2-1"
1878
- })(["position:absolute;z-index:1;top:0;left:0;width:100%;height:100%;background-color:", ";", " ", ""], ({
1879
- bgColor
1880
- }) => bgColor, ({
1881
- status
1882
- }) => status === "inactive" && css11(["background-color:var(--charcoal-surface3);"]), ({
1883
- 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({
1886
- componentId: "ccl__sc-11j9pu2-2"
1887
- })(["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({
1891
- componentId: "ccl__sc-11j9pu2-3"
1892
- })(["", ""], ({
1893
- isTranslate
1894
- }) => isTranslate ?? false ? translateLabelCSS : labelCSS);
1895
- var Label3 = styled21.span.withConfig({
1896
- componentId: "ccl__sc-11j9pu2-4"
1897
- })(["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({
1899
- componentId: "ccl__sc-11j9pu2-5"
1900
- })(["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;}"]);
1227
+ var TagItem_default = memo10(TagItem);
1901
1228
  export {
1902
1229
  Button_default as Button,
1903
1230
  CharcoalProvider,
1904
1231
  Checkbox_default as Checkbox,
1905
1232
  Clickable_default as Clickable,
1906
- ComponentAbstraction,
1907
1233
  DropdownMenuItem,
1908
1234
  DropdownSelector,
1909
1235
  Icon_default as Icon,
@@ -1915,9 +1241,8 @@ export {
1915
1241
  ModalAlign,
1916
1242
  ModalBody,
1917
1243
  ModalButtons,
1244
+ ModalCloseButton,
1918
1245
  ModalHeader,
1919
- MultiSelect_default as MultiSelect,
1920
- MultiSelectGroup,
1921
1246
  OverlayProvider,
1922
1247
  Radio_default as Radio,
1923
1248
  RadioGroup,
@@ -1926,7 +1251,6 @@ export {
1926
1251
  Switch_default as Switch,
1927
1252
  TagItem_default as TagItem,
1928
1253
  TextArea_default as TextArea,
1929
- TextField_default as TextField,
1930
- useComponentAbstraction
1254
+ TextField_default as TextField
1931
1255
  };
1932
1256
  //# sourceMappingURL=index.esm.js.map