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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/dist/_lib/compat.d.ts +19 -1
  2. package/dist/_lib/compat.d.ts.map +1 -1
  3. package/dist/_lib/index.d.ts +7 -0
  4. package/dist/_lib/index.d.ts.map +1 -1
  5. package/dist/components/Button/index.d.ts +1 -2
  6. package/dist/components/Button/index.d.ts.map +1 -1
  7. package/dist/components/Button/index.story.d.ts +1 -2
  8. package/dist/components/Button/index.story.d.ts.map +1 -1
  9. package/dist/components/Button/index.test.d.ts +4 -0
  10. package/dist/components/Button/index.test.d.ts.map +1 -0
  11. package/dist/components/Checkbox/index.d.ts +2 -1
  12. package/dist/components/Checkbox/index.d.ts.map +1 -1
  13. package/dist/components/Checkbox/index.story.d.ts +2 -2
  14. package/dist/components/Checkbox/index.story.d.ts.map +1 -1
  15. package/dist/components/Clickable/index.d.ts +1 -1
  16. package/dist/components/Clickable/index.d.ts.map +1 -1
  17. package/dist/components/Clickable/index.story.d.ts +1 -2
  18. package/dist/components/Clickable/index.story.d.ts.map +1 -1
  19. package/dist/components/DropdownSelector/Divider.d.ts +3 -0
  20. package/dist/components/DropdownSelector/Divider.d.ts.map +1 -1
  21. package/dist/components/DropdownSelector/DropdownMenuItem.d.ts +7 -0
  22. package/dist/components/DropdownSelector/DropdownMenuItem.d.ts.map +1 -0
  23. package/dist/components/DropdownSelector/DropdownPopover.d.ts +8 -8
  24. package/dist/components/DropdownSelector/DropdownPopover.d.ts.map +1 -1
  25. package/dist/components/DropdownSelector/ListItem/index.d.ts +18 -0
  26. package/dist/components/DropdownSelector/ListItem/index.d.ts.map +1 -0
  27. package/dist/components/DropdownSelector/ListItem/index.story.d.ts +9 -0
  28. package/dist/components/DropdownSelector/ListItem/index.story.d.ts.map +1 -0
  29. package/dist/components/DropdownSelector/MenuItem/index.d.ts +11 -0
  30. package/dist/components/DropdownSelector/MenuItem/index.d.ts.map +1 -0
  31. package/dist/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.d.ts +9 -0
  32. package/dist/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.d.ts.map +1 -0
  33. package/dist/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.d.ts +10 -0
  34. package/dist/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.d.ts.map +1 -0
  35. package/dist/components/DropdownSelector/MenuItemGroup/index.d.ts +14 -0
  36. package/dist/components/DropdownSelector/MenuItemGroup/index.d.ts.map +1 -0
  37. package/dist/components/DropdownSelector/MenuList/MenuListContext.d.ts +10 -0
  38. package/dist/components/DropdownSelector/MenuList/MenuListContext.d.ts.map +1 -0
  39. package/dist/components/DropdownSelector/MenuList/index.d.ts +18 -0
  40. package/dist/components/DropdownSelector/MenuList/index.d.ts.map +1 -0
  41. package/dist/components/DropdownSelector/MenuList/index.story.d.ts +11 -0
  42. package/dist/components/DropdownSelector/MenuList/index.story.d.ts.map +1 -0
  43. package/dist/components/DropdownSelector/MenuList/internals/getValuesRecursive.d.ts +11 -0
  44. package/dist/components/DropdownSelector/MenuList/internals/getValuesRecursive.d.ts.map +1 -0
  45. package/dist/components/DropdownSelector/Popover/index.d.ts +17 -0
  46. package/dist/components/DropdownSelector/Popover/index.d.ts.map +1 -0
  47. package/dist/components/DropdownSelector/Popover/index.story.d.ts +9 -0
  48. package/dist/components/DropdownSelector/Popover/index.story.d.ts.map +1 -0
  49. package/dist/components/DropdownSelector/index.d.ts +3 -10
  50. package/dist/components/DropdownSelector/index.d.ts.map +1 -1
  51. package/dist/components/DropdownSelector/index.story.d.ts +4 -4
  52. package/dist/components/DropdownSelector/index.story.d.ts.map +1 -1
  53. package/dist/components/DropdownSelector/utils/findPreviewRecursive.d.ts +12 -0
  54. package/dist/components/DropdownSelector/utils/findPreviewRecursive.d.ts.map +1 -0
  55. package/dist/components/FieldLabel/index.d.ts +1 -1
  56. package/dist/components/FieldLabel/index.d.ts.map +1 -1
  57. package/dist/components/Icon/index.d.ts +1 -1
  58. package/dist/components/Icon/index.d.ts.map +1 -1
  59. package/dist/components/Icon/index.story.d.ts +2 -3
  60. package/dist/components/Icon/index.story.d.ts.map +1 -1
  61. package/dist/components/IconButton/index.d.ts +1 -2
  62. package/dist/components/IconButton/index.d.ts.map +1 -1
  63. package/dist/components/IconButton/index.story.d.ts +1 -2
  64. package/dist/components/IconButton/index.story.d.ts.map +1 -1
  65. package/dist/components/LoadingSpinner/index.d.ts +9 -8
  66. package/dist/components/LoadingSpinner/index.d.ts.map +1 -1
  67. package/dist/components/LoadingSpinner/index.story.d.ts +1 -2
  68. package/dist/components/LoadingSpinner/index.story.d.ts.map +1 -1
  69. package/dist/components/Modal/ModalPlumbing.d.ts.map +1 -1
  70. package/dist/components/Modal/index.d.ts +18 -27
  71. package/dist/components/Modal/index.d.ts.map +1 -1
  72. package/dist/components/Modal/index.story.d.ts +12 -2
  73. package/dist/components/Modal/index.story.d.ts.map +1 -1
  74. package/dist/components/MultiSelect/context.d.ts +1 -1
  75. package/dist/components/MultiSelect/context.d.ts.map +1 -1
  76. package/dist/components/MultiSelect/index.d.ts +18 -6
  77. package/dist/components/MultiSelect/index.d.ts.map +1 -1
  78. package/dist/components/MultiSelect/index.story.d.ts +21 -16
  79. package/dist/components/MultiSelect/index.story.d.ts.map +1 -1
  80. package/dist/components/Radio/index.d.ts +13 -6
  81. package/dist/components/Radio/index.d.ts.map +1 -1
  82. package/dist/components/Radio/index.story.d.ts +11 -8
  83. package/dist/components/Radio/index.story.d.ts.map +1 -1
  84. package/dist/components/SegmentedControl/RadioGroupContext.d.ts +1 -1
  85. package/dist/components/SegmentedControl/RadioGroupContext.d.ts.map +1 -1
  86. package/dist/components/SegmentedControl/index.d.ts +2 -1
  87. package/dist/components/SegmentedControl/index.d.ts.map +1 -1
  88. package/dist/components/SegmentedControl/index.story.d.ts +1 -2
  89. package/dist/components/SegmentedControl/index.story.d.ts.map +1 -1
  90. package/dist/components/Switch/index.d.ts +3 -2
  91. package/dist/components/Switch/index.d.ts.map +1 -1
  92. package/dist/components/Switch/index.story.d.ts +1 -2
  93. package/dist/components/Switch/index.story.d.ts.map +1 -1
  94. package/dist/components/TagItem/index.d.ts +3 -3
  95. package/dist/components/TagItem/index.d.ts.map +1 -1
  96. package/dist/components/TagItem/index.story.d.ts +2 -3
  97. package/dist/components/TagItem/index.story.d.ts.map +1 -1
  98. package/dist/components/TextArea/TextArea.story.d.ts +28 -0
  99. package/dist/components/TextArea/TextArea.story.d.ts.map +1 -0
  100. package/dist/components/TextArea/index.d.ts +21 -0
  101. package/dist/components/TextArea/index.d.ts.map +1 -0
  102. package/dist/components/TextField/TextField.story.d.ts +28 -0
  103. package/dist/components/TextField/TextField.story.d.ts.map +1 -0
  104. package/dist/components/TextField/index.d.ts +8 -30
  105. package/dist/components/TextField/index.d.ts.map +1 -1
  106. package/dist/core/CharcoalProvider.d.ts +1 -1
  107. package/dist/core/CharcoalProvider.d.ts.map +1 -1
  108. package/dist/core/ComponentAbstraction.d.ts +1 -1
  109. package/dist/core/ComponentAbstraction.d.ts.map +1 -1
  110. package/dist/index.cjs.js +1064 -771
  111. package/dist/index.cjs.js.map +1 -1
  112. package/dist/index.d.ts +5 -3
  113. package/dist/index.d.ts.map +1 -1
  114. package/dist/index.esm.js +1028 -750
  115. package/dist/index.esm.js.map +1 -1
  116. package/dist/styled.d.ts +13 -13
  117. package/package.json +7 -7
  118. package/src/_lib/compat.ts +20 -1
  119. package/src/_lib/index.ts +23 -0
  120. package/src/components/Button/__snapshots__/index.test.tsx.snap +385 -0
  121. package/src/components/Button/index.story.tsx +1 -1
  122. package/src/components/Button/index.test.tsx +24 -0
  123. package/src/components/Button/index.tsx +2 -2
  124. package/src/components/Checkbox/index.story.tsx +1 -1
  125. package/src/components/Checkbox/index.tsx +4 -2
  126. package/src/components/Clickable/index.story.tsx +0 -1
  127. package/src/components/Clickable/index.tsx +1 -1
  128. package/src/components/DropdownSelector/Divider.tsx +3 -0
  129. package/src/components/DropdownSelector/DropdownMenuItem.tsx +40 -0
  130. package/src/components/DropdownSelector/DropdownPopover.tsx +21 -42
  131. package/src/components/DropdownSelector/ListItem/index.story.tsx +51 -0
  132. package/src/components/DropdownSelector/ListItem/index.tsx +58 -0
  133. package/src/components/DropdownSelector/MenuItem/index.tsx +31 -0
  134. package/src/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.tsx +43 -0
  135. package/src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx +55 -0
  136. package/src/components/DropdownSelector/MenuItemGroup/index.tsx +42 -0
  137. package/src/components/DropdownSelector/MenuList/MenuListContext.ts +17 -0
  138. package/src/components/DropdownSelector/MenuList/index.story.tsx +51 -0
  139. package/src/components/DropdownSelector/MenuList/index.tsx +51 -0
  140. package/src/components/DropdownSelector/MenuList/internals/getValuesRecursive.tsx +35 -0
  141. package/src/components/DropdownSelector/Popover/index.story.tsx +65 -0
  142. package/src/components/DropdownSelector/Popover/index.tsx +69 -0
  143. package/src/components/DropdownSelector/index.story.tsx +56 -21
  144. package/src/components/DropdownSelector/index.tsx +19 -60
  145. package/src/components/DropdownSelector/utils/findPreviewRecursive.tsx +39 -0
  146. package/src/components/FieldLabel/index.tsx +1 -1
  147. package/src/components/Icon/index.story.tsx +0 -1
  148. package/src/components/Icon/index.tsx +1 -1
  149. package/src/components/IconButton/index.story.tsx +0 -1
  150. package/src/components/IconButton/index.tsx +2 -2
  151. package/src/components/LoadingSpinner/index.story.tsx +8 -2
  152. package/src/components/LoadingSpinner/index.tsx +44 -29
  153. package/src/components/Modal/ModalPlumbing.tsx +0 -1
  154. package/src/components/Modal/index.story.tsx +0 -1
  155. package/src/components/Modal/index.tsx +19 -12
  156. package/src/components/MultiSelect/context.ts +2 -2
  157. package/src/components/MultiSelect/index.story.tsx +26 -27
  158. package/src/components/MultiSelect/index.test.tsx +5 -23
  159. package/src/components/MultiSelect/index.tsx +83 -78
  160. package/src/components/Radio/index.story.tsx +7 -9
  161. package/src/components/Radio/index.test.tsx +3 -4
  162. package/src/components/Radio/index.tsx +24 -23
  163. package/src/components/SegmentedControl/RadioGroupContext.tsx +2 -1
  164. package/src/components/SegmentedControl/index.story.tsx +0 -1
  165. package/src/components/SegmentedControl/index.tsx +16 -5
  166. package/src/components/Switch/index.story.tsx +1 -1
  167. package/src/components/Switch/index.tsx +38 -32
  168. package/src/components/TagItem/index.story.tsx +0 -1
  169. package/src/components/TagItem/index.tsx +1 -6
  170. package/src/components/TextArea/TextArea.story.tsx +61 -0
  171. package/src/components/TextArea/index.tsx +246 -0
  172. package/src/components/TextField/{index.story.tsx → TextField.story.tsx} +6 -29
  173. package/src/components/TextField/index.tsx +148 -378
  174. package/src/components/a11y.test.tsx +0 -1
  175. package/src/core/CharcoalProvider.tsx +1 -1
  176. package/src/core/ComponentAbstraction.tsx +2 -1
  177. package/src/index.ts +8 -6
  178. package/dist/components/DropdownSelector/OptionItem.d.ts +0 -7
  179. package/dist/components/DropdownSelector/OptionItem.d.ts.map +0 -1
  180. package/dist/components/DropdownSelector/utils/focusIfHTMLLIElement.d.ts +0 -6
  181. package/dist/components/DropdownSelector/utils/focusIfHTMLLIElement.d.ts.map +0 -1
  182. package/dist/components/DropdownSelector/utils/handleFocusByKeyBoard.d.ts +0 -6
  183. package/dist/components/DropdownSelector/utils/handleFocusByKeyBoard.d.ts.map +0 -1
  184. package/src/components/DropdownSelector/OptionItem.tsx +0 -85
  185. package/src/components/DropdownSelector/utils/focusIfHTMLLIElement.tsx +0 -12
  186. package/src/components/DropdownSelector/utils/handleFocusByKeyBoard.tsx +0 -20
package/dist/index.esm.js CHANGED
@@ -1,8 +1,10 @@
1
1
  // src/core/ComponentAbstraction.tsx
2
- import React, { useContext } from "react";
2
+ import { useContext } from "react";
3
+ import * as React from "react";
4
+ import { jsx } from "react/jsx-runtime";
3
5
  var DefaultLink = React.forwardRef(
4
6
  function DefaultLink2({ to, children, ...rest }, ref) {
5
- return /* @__PURE__ */ React.createElement("a", { href: to, ref, ...rest }, children);
7
+ return /* @__PURE__ */ jsx("a", { href: to, ref, ...rest, children });
6
8
  }
7
9
  );
8
10
  var DefaultValue = {
@@ -10,12 +12,12 @@ var DefaultValue = {
10
12
  };
11
13
  var ComponentAbstractionContext = React.createContext(DefaultValue);
12
14
  function ComponentAbstraction({ children, components }) {
13
- return /* @__PURE__ */ React.createElement(
15
+ return /* @__PURE__ */ jsx(
14
16
  ComponentAbstractionContext.Provider,
15
17
  {
16
- value: { ...DefaultValue, ...components }
17
- },
18
- children
18
+ value: { ...DefaultValue, ...components },
19
+ children
20
+ }
19
21
  );
20
22
  }
21
23
  function useComponentAbstraction() {
@@ -29,9 +31,9 @@ import { SSRProvider } from "@react-aria/ssr";
29
31
  import { OverlayProvider } from "@react-aria/overlays";
30
32
 
31
33
  // src/core/CharcoalProvider.tsx
32
- import React2 from "react";
33
34
  import { ThemeProvider } from "styled-components";
34
35
  import { TokenInjector } from "@charcoal-ui/styled";
36
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
35
37
  function CharcoalProvider({
36
38
  themeMap,
37
39
  defaultTheme = themeMap[":root"],
@@ -39,11 +41,14 @@ function CharcoalProvider({
39
41
  injectTokens = true,
40
42
  children
41
43
  }) {
42
- return /* @__PURE__ */ React2.createElement(SSRProvider, null, /* @__PURE__ */ React2.createElement(ThemeProvider, { theme: defaultTheme }, injectTokens && /* @__PURE__ */ React2.createElement(TokenInjector, { theme: themeMap }), /* @__PURE__ */ React2.createElement(ComponentAbstraction, { components }, /* @__PURE__ */ React2.createElement(OverlayProvider, null, children))));
44
+ return /* @__PURE__ */ jsx2(SSRProvider, { children: /* @__PURE__ */ jsxs(ThemeProvider, { theme: defaultTheme, children: [
45
+ injectTokens && /* @__PURE__ */ jsx2(TokenInjector, { theme: themeMap }),
46
+ /* @__PURE__ */ jsx2(ComponentAbstraction, { components, children: /* @__PURE__ */ jsx2(OverlayProvider, { children }) })
47
+ ] }) });
43
48
  }
44
49
 
45
50
  // src/components/Button/index.tsx
46
- import React4 from "react";
51
+ import { forwardRef as forwardRef3 } from "react";
47
52
  import styled3 from "styled-components";
48
53
 
49
54
  // src/_lib/index.ts
@@ -52,6 +57,21 @@ function unreachable(value) {
52
57
  arguments.length === 0 ? "unreachable" : `unreachable (${JSON.stringify(value)})`
53
58
  );
54
59
  }
60
+ function mergeRefs(...refs) {
61
+ return (value) => {
62
+ for (const ref of refs) {
63
+ if (typeof ref === "function") {
64
+ ref(value);
65
+ } else if (ref !== null) {
66
+ ;
67
+ ref.current = value;
68
+ }
69
+ }
70
+ };
71
+ }
72
+ function countCodePointsInString(string) {
73
+ return Array.from(string).length;
74
+ }
55
75
 
56
76
  // src/styled.ts
57
77
  import styled from "styled-components";
@@ -59,15 +79,16 @@ import { createTheme } from "@charcoal-ui/styled";
59
79
  var theme = createTheme(styled);
60
80
 
61
81
  // src/components/Clickable/index.tsx
62
- import React3 from "react";
82
+ import * as React2 from "react";
63
83
  import styled2, { css } from "styled-components";
64
84
  import { disabledSelector } from "@charcoal-ui/utils";
65
- var Clickable = React3.forwardRef(
85
+ import { jsx as jsx3 } from "react/jsx-runtime";
86
+ var Clickable = React2.forwardRef(
66
87
  function Clickable2(props, ref) {
67
88
  const { Link } = useComponentAbstraction();
68
89
  if ("to" in props) {
69
90
  const { onClick, disabled = false, ...rest } = props;
70
- return /* @__PURE__ */ React3.createElement(
91
+ return /* @__PURE__ */ jsx3(
71
92
  A,
72
93
  {
73
94
  ...rest,
@@ -78,7 +99,7 @@ var Clickable = React3.forwardRef(
78
99
  }
79
100
  );
80
101
  } else {
81
- return /* @__PURE__ */ React3.createElement(Button, { ...props, ref });
102
+ return /* @__PURE__ */ jsx3(Button, { ...props, ref });
82
103
  }
83
104
  }
84
105
  );
@@ -143,7 +164,8 @@ var A = styled2.span`
143
164
  `;
144
165
 
145
166
  // src/components/Button/index.tsx
146
- var Button2 = React4.forwardRef(function Button3({
167
+ import { jsx as jsx4 } from "react/jsx-runtime";
168
+ var Button2 = forwardRef3(function Button3({
147
169
  children,
148
170
  variant = "Default",
149
171
  size = "M",
@@ -151,7 +173,7 @@ var Button2 = React4.forwardRef(function Button3({
151
173
  disabled = false,
152
174
  ...rest
153
175
  }, ref) {
154
- return /* @__PURE__ */ React4.createElement(
176
+ return /* @__PURE__ */ jsx4(
155
177
  StyledButton,
156
178
  {
157
179
  ...rest,
@@ -159,9 +181,9 @@ var Button2 = React4.forwardRef(function Button3({
159
181
  variant,
160
182
  size,
161
183
  fullWidth: fixed,
162
- ref
163
- },
164
- children
184
+ ref,
185
+ children
186
+ }
165
187
  );
166
188
  });
167
189
  var Button_default = Button2;
@@ -230,12 +252,13 @@ function sizeToProps(size) {
230
252
  }
231
253
 
232
254
  // src/components/IconButton/index.tsx
233
- import React5 from "react";
255
+ import { forwardRef as forwardRef4 } from "react";
234
256
  import styled4 from "styled-components";
235
- var IconButton = React5.forwardRef(
257
+ import { jsx as jsx5 } from "react/jsx-runtime";
258
+ var IconButton = forwardRef4(
236
259
  function IconButtonInner({ variant = "Default", size = "M", icon, ...rest }, ref) {
237
260
  validateIconSize(size, icon);
238
- return /* @__PURE__ */ React5.createElement(StyledIconButton, { ...rest, ref, variant, size }, /* @__PURE__ */ React5.createElement("pixiv-icon", { name: icon }));
261
+ return /* @__PURE__ */ jsx5(StyledIconButton, { ...rest, ref, variant, size, children: /* @__PURE__ */ jsx5("pixiv-icon", { name: icon }) });
239
262
  }
240
263
  );
241
264
  var IconButton_default = IconButton;
@@ -314,22 +337,19 @@ function validateIconSize(size, icon) {
314
337
  }
315
338
 
316
339
  // src/components/Radio/index.tsx
317
- import React6, { useCallback, useContext as useContext2 } from "react";
340
+ import { memo, forwardRef as forwardRef5, useCallback, useContext as useContext2 } from "react";
341
+ import * as React3 from "react";
318
342
  import styled5 from "styled-components";
319
343
  import warning from "warning";
320
344
  import { px } from "@charcoal-ui/utils";
321
- function Radio({
322
- value,
323
- forceChecked = false,
324
- disabled = false,
325
- children
326
- }) {
345
+ import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
346
+ var Radio = forwardRef5(function RadioInner({ value, disabled = false, children, className }, ref) {
327
347
  const {
328
348
  name,
329
349
  selected,
330
350
  disabled: isParentDisabled,
331
351
  readonly,
332
- hasError,
352
+ invalid,
333
353
  onChange
334
354
  } = useContext2(RadioGroupContext);
335
355
  warning(
@@ -345,22 +365,27 @@ function Radio({
345
365
  },
346
366
  [onChange]
347
367
  );
348
- return /* @__PURE__ */ React6.createElement(RadioRoot, { "aria-disabled": isDisabled || isReadonly }, /* @__PURE__ */ React6.createElement(
349
- RadioInput,
350
- {
351
- name,
352
- value,
353
- checked: forceChecked || isSelected,
354
- hasError,
355
- onChange: handleChange,
356
- disabled: isDisabled || isReadonly
357
- }
358
- ), children != null && /* @__PURE__ */ React6.createElement(RadioLabel, null, children));
359
- }
368
+ return /* @__PURE__ */ jsxs2(RadioRoot, { "aria-disabled": isDisabled || isReadonly, className, children: [
369
+ /* @__PURE__ */ jsx6(
370
+ RadioInput,
371
+ {
372
+ name,
373
+ value,
374
+ checked: isSelected,
375
+ invalid,
376
+ onChange: handleChange,
377
+ disabled: isDisabled || isReadonly,
378
+ ref
379
+ }
380
+ ),
381
+ children != null && /* @__PURE__ */ jsx6(RadioLabel, { children })
382
+ ] });
383
+ });
384
+ var Radio_default = memo(Radio);
360
385
  var RadioRoot = styled5.label`
361
386
  display: grid;
362
387
  grid-template-columns: auto 1fr;
363
- grid-gap: ${({ theme: theme4 }) => px(theme4.spacing[4])};
388
+ grid-gap: ${({ theme: theme3 }) => px(theme3.spacing[4])};
364
389
  align-items: center;
365
390
  cursor: pointer;
366
391
 
@@ -378,19 +403,18 @@ var RadioInput = styled5.input.attrs({ type: "radio" })`
378
403
 
379
404
  width: 20px;
380
405
  height: 20px;
381
-
382
406
  cursor: pointer;
383
407
 
384
- ${({ hasError = false }) => theme((o) => [
408
+ ${({ invalid = false }) => theme((o) => [
385
409
  o.borderRadius("oval"),
386
410
  o.bg.surface1.hover.press,
387
- hasError && o.outline.assertive
411
+ invalid && o.outline.assertive
388
412
  ])};
389
413
 
390
414
  &:not(:checked) {
391
415
  border-width: 2px;
392
416
  border-style: solid;
393
- border-color: ${({ theme: theme4 }) => theme4.color.text3};
417
+ border-color: ${({ theme: theme3 }) => theme3.color.text3};
394
418
  }
395
419
 
396
420
  &:checked {
@@ -419,14 +443,14 @@ var RadioLabel = styled5.div`
419
443
  var StyledRadioGroup = styled5.div`
420
444
  display: grid;
421
445
  grid-template-columns: 1fr;
422
- grid-gap: ${({ theme: theme4 }) => px(theme4.spacing[8])};
446
+ grid-gap: ${({ theme: theme3 }) => px(theme3.spacing[8])};
423
447
  `;
424
- var RadioGroupContext = React6.createContext({
448
+ var RadioGroupContext = React3.createContext({
425
449
  name: void 0,
426
450
  selected: void 0,
427
451
  disabled: false,
428
452
  readonly: false,
429
- hasError: false,
453
+ invalid: false,
430
454
  onChange() {
431
455
  throw new Error(
432
456
  "Cannot find onChange() handler. Perhaps you forgot to wrap with <RadioGroup> ?"
@@ -441,7 +465,7 @@ function RadioGroup({
441
465
  onChange,
442
466
  disabled,
443
467
  readonly,
444
- hasError,
468
+ invalid,
445
469
  children
446
470
  }) {
447
471
  const handleChange = useCallback(
@@ -450,7 +474,7 @@ function RadioGroup({
450
474
  },
451
475
  [onChange]
452
476
  );
453
- return /* @__PURE__ */ React6.createElement(
477
+ return /* @__PURE__ */ jsx6(
454
478
  RadioGroupContext.Provider,
455
479
  {
456
480
  value: {
@@ -458,38 +482,38 @@ function RadioGroup({
458
482
  selected: value,
459
483
  disabled: disabled ?? false,
460
484
  readonly: readonly ?? false,
461
- hasError: hasError ?? false,
485
+ invalid: invalid ?? false,
462
486
  onChange: handleChange
463
- }
464
- },
465
- /* @__PURE__ */ React6.createElement(
466
- StyledRadioGroup,
467
- {
468
- role: "radiogroup",
469
- "aria-orientation": "vertical",
470
- "aria-label": label,
471
- "aria-invalid": hasError,
472
- className
473
487
  },
474
- children
475
- )
488
+ children: /* @__PURE__ */ jsx6(
489
+ StyledRadioGroup,
490
+ {
491
+ role: "radiogroup",
492
+ "aria-orientation": "vertical",
493
+ "aria-label": label,
494
+ "aria-invalid": invalid,
495
+ className,
496
+ children
497
+ }
498
+ )
499
+ }
476
500
  );
477
501
  }
478
502
 
479
503
  // src/components/MultiSelect/index.tsx
480
- import React7, { useCallback as useCallback2, useContext as useContext3 } from "react";
504
+ import { useCallback as useCallback2, useContext as useContext3, forwardRef as forwardRef6, memo as memo2 } from "react";
481
505
  import styled6, { css as css2 } from "styled-components";
482
506
  import warning2 from "warning";
483
507
  import { disabledSelector as disabledSelector2, px as px2 } from "@charcoal-ui/utils";
484
508
 
485
509
  // src/components/MultiSelect/context.ts
486
- import { createContext } from "react";
487
- var MultiSelectGroupContext = createContext({
510
+ import { createContext as createContext3 } from "react";
511
+ var MultiSelectGroupContext = createContext3({
488
512
  name: void 0,
489
513
  selected: [],
490
514
  disabled: false,
491
515
  readonly: false,
492
- hasError: false,
516
+ invalid: false,
493
517
  onChange() {
494
518
  throw new Error(
495
519
  "Cannot find `onChange()` handler. Perhaps you forgot to wrap it with `<MultiSelectGroup />` ?"
@@ -498,63 +522,72 @@ var MultiSelectGroupContext = createContext({
498
522
  });
499
523
 
500
524
  // src/components/MultiSelect/index.tsx
501
- function MultiSelect({
502
- value,
503
- forceChecked = false,
504
- disabled = false,
505
- onChange,
506
- variant = "default",
507
- children
508
- }) {
509
- const {
510
- name,
511
- selected,
512
- disabled: parentDisabled,
513
- readonly,
514
- hasError,
515
- onChange: parentOnChange
516
- } = useContext3(MultiSelectGroupContext);
517
- warning2(
518
- name !== void 0,
519
- `"name" is not Provided for <MultiSelect>. Perhaps you forgot to wrap with <MultiSelectGroup> ?`
520
- );
521
- const isSelected = selected.includes(value) || forceChecked;
522
- const isDisabled = disabled || parentDisabled || readonly;
523
- const handleChange = useCallback2(
524
- (event) => {
525
- if (!(event.currentTarget instanceof HTMLInputElement)) {
526
- return;
527
- }
528
- if (onChange)
529
- onChange({ value, selected: event.currentTarget.checked });
530
- parentOnChange({ value, selected: event.currentTarget.checked });
531
- },
532
- [onChange, parentOnChange, value]
533
- );
534
- return /* @__PURE__ */ React7.createElement(MultiSelectRoot, { "aria-disabled": isDisabled }, /* @__PURE__ */ React7.createElement(
535
- MultiSelectInput,
536
- {
537
- ...{
538
- name,
539
- value,
540
- hasError
525
+ import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
526
+ var MultiSelect = forwardRef6(
527
+ function MultiSelectInner({
528
+ value,
529
+ disabled = false,
530
+ onChange,
531
+ variant = "default",
532
+ className,
533
+ children
534
+ }, ref) {
535
+ const {
536
+ name,
537
+ selected,
538
+ disabled: parentDisabled,
539
+ readonly,
540
+ invalid,
541
+ onChange: parentOnChange
542
+ } = useContext3(MultiSelectGroupContext);
543
+ warning2(
544
+ name !== void 0,
545
+ `"name" is not Provided for <MultiSelect>. Perhaps you forgot to wrap with <MultiSelectGroup> ?`
546
+ );
547
+ const isSelected = selected.includes(value);
548
+ const isDisabled = disabled || parentDisabled || readonly;
549
+ const handleChange = useCallback2(
550
+ (event) => {
551
+ if (!(event.currentTarget instanceof HTMLInputElement)) {
552
+ return;
553
+ }
554
+ if (onChange)
555
+ onChange({ value, selected: event.currentTarget.checked });
556
+ parentOnChange({ value, selected: event.currentTarget.checked });
541
557
  },
542
- checked: isSelected,
543
- disabled: isDisabled,
544
- onChange: handleChange,
545
- overlay: variant === "overlay",
546
- "aria-invalid": hasError
547
- }
548
- ), /* @__PURE__ */ React7.createElement(
549
- MultiSelectInputOverlay,
550
- {
551
- overlay: variant === "overlay",
552
- hasError,
553
- "aria-hidden": true
554
- },
555
- /* @__PURE__ */ React7.createElement("pixiv-icon", { name: "24/Check", "unsafe-non-guideline-scale": 16 / 24 })
556
- ), Boolean(children) && /* @__PURE__ */ React7.createElement(MultiSelectLabel, null, children));
557
- }
558
+ [onChange, parentOnChange, value]
559
+ );
560
+ return /* @__PURE__ */ jsxs3(MultiSelectRoot, { "aria-disabled": isDisabled, className, children: [
561
+ /* @__PURE__ */ jsx7(
562
+ MultiSelectInput,
563
+ {
564
+ ...{
565
+ name,
566
+ value,
567
+ invalid
568
+ },
569
+ checked: isSelected,
570
+ disabled: isDisabled,
571
+ onChange: handleChange,
572
+ overlay: variant === "overlay",
573
+ "aria-invalid": invalid,
574
+ ref
575
+ }
576
+ ),
577
+ /* @__PURE__ */ jsx7(
578
+ MultiSelectInputOverlay,
579
+ {
580
+ overlay: variant === "overlay",
581
+ invalid,
582
+ "aria-hidden": true,
583
+ children: /* @__PURE__ */ jsx7("pixiv-icon", { name: "24/Check", "unsafe-non-guideline-scale": 16 / 24 })
584
+ }
585
+ ),
586
+ Boolean(children) && /* @__PURE__ */ jsx7(MultiSelectLabel, { children })
587
+ ] });
588
+ }
589
+ );
590
+ var MultiSelect_default = memo2(MultiSelect);
558
591
  var MultiSelectRoot = styled6.label`
559
592
  display: grid;
560
593
  grid-template-columns: auto 1fr;
@@ -564,7 +597,7 @@ var MultiSelectRoot = styled6.label`
564
597
  ${disabledSelector2} {
565
598
  cursor: default;
566
599
  }
567
- gap: ${({ theme: theme4 }) => px2(theme4.spacing[4])};
600
+ gap: ${({ theme: theme3 }) => px2(theme3.spacing[4])};
568
601
  ${theme((o) => o.disabled)}
569
602
  `;
570
603
  var MultiSelectLabel = styled6.div`
@@ -584,10 +617,10 @@ var MultiSelectInput = styled6.input.attrs({ type: "checkbox" })`
584
617
  ${theme((o) => o.bg.brand.hover.press)}
585
618
  }
586
619
 
587
- ${({ hasError, overlay }) => theme((o) => [
620
+ ${({ invalid, overlay }) => theme((o) => [
588
621
  o.bg.text3.hover.press,
589
622
  o.borderRadius("oval"),
590
- hasError && !overlay && o.outline.assertive,
623
+ invalid && !overlay && o.outline.assertive,
591
624
  overlay && o.bg.surface4
592
625
  ])};
593
626
  }
@@ -601,16 +634,16 @@ var MultiSelectInputOverlay = styled6.div`
601
634
  align-items: center;
602
635
  justify-content: center;
603
636
 
604
- ${({ hasError, overlay }) => theme((o) => [
637
+ ${({ invalid, overlay }) => theme((o) => [
605
638
  o.width.px(24),
606
639
  o.height.px(24),
607
640
  o.borderRadius("oval"),
608
641
  o.font.text5,
609
- hasError && overlay && o.outline.assertive
642
+ invalid && overlay && o.outline.assertive
610
643
  ])}
611
644
 
612
645
  ${({ overlay }) => overlay && css2`
613
- border-color: ${({ theme: theme4 }) => theme4.color.text5};
646
+ border-color: ${({ theme: theme3 }) => theme3.color.text5};
614
647
  border-width: 2px;
615
648
  border-style: solid;
616
649
  `}
@@ -618,12 +651,12 @@ var MultiSelectInputOverlay = styled6.div`
618
651
  function MultiSelectGroup({
619
652
  className,
620
653
  name,
621
- ariaLabel,
654
+ label,
622
655
  selected,
623
656
  onChange,
624
657
  disabled = false,
625
658
  readonly = false,
626
- hasError = false,
659
+ invalid = false,
627
660
  children
628
661
  }) {
629
662
  const handleChange = useCallback2(
@@ -641,7 +674,7 @@ function MultiSelectGroup({
641
674
  },
642
675
  [onChange, selected]
643
676
  );
644
- return /* @__PURE__ */ React7.createElement(
677
+ return /* @__PURE__ */ jsx7(
645
678
  MultiSelectGroupContext.Provider,
646
679
  {
647
680
  value: {
@@ -649,46 +682,46 @@ function MultiSelectGroup({
649
682
  selected: Array.from(new Set(selected)),
650
683
  disabled,
651
684
  readonly,
652
- hasError,
685
+ invalid,
653
686
  onChange: handleChange
654
- }
655
- },
656
- /* @__PURE__ */ React7.createElement(
657
- "div",
658
- {
659
- className,
660
- "aria-label": ariaLabel,
661
- "data-testid": "SelectGroup"
662
687
  },
663
- children
664
- )
688
+ children: /* @__PURE__ */ jsx7("div", { className, "aria-label": label, "data-testid": "SelectGroup", children })
689
+ }
665
690
  );
666
691
  }
667
692
 
668
693
  // src/components/Switch/index.tsx
669
694
  import { useSwitch } from "@react-aria/switch";
670
- import React8, { useRef, useMemo } from "react";
695
+ import { useMemo, memo as memo3, forwardRef as forwardRef7 } from "react";
671
696
  import { useToggleState } from "react-stately";
672
697
  import styled7 from "styled-components";
673
698
  import { disabledSelector as disabledSelector3 } from "@charcoal-ui/utils";
674
- function SwitchCheckbox(props) {
675
- const { disabled, className } = props;
676
- const ariaSwitchProps = useMemo(
677
- () => ({
678
- ...props,
679
- "aria-label": "children" in props ? void 0 : props.label,
680
- isDisabled: props.disabled,
681
- isSelected: props.checked
682
- }),
683
- [props]
684
- );
685
- const state = useToggleState(ariaSwitchProps);
686
- const ref = useRef(null);
687
- const {
688
- inputProps: { className: _className, type: _type, ...rest }
689
- } = useSwitch(ariaSwitchProps, state, ref);
690
- return /* @__PURE__ */ React8.createElement(Label, { className, "aria-disabled": disabled }, /* @__PURE__ */ React8.createElement(SwitchInput, { ...rest, ref }), "children" in props ? /* @__PURE__ */ React8.createElement(LabelInner, null, props.children) : void 0);
691
- }
699
+ import { useObjectRef } from "@react-aria/utils";
700
+ import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
701
+ var SwitchCheckbox = forwardRef7(
702
+ function SwitchCheckboxInner(props, external) {
703
+ const { disabled, className } = props;
704
+ const ariaSwitchProps = useMemo(
705
+ () => ({
706
+ ...props,
707
+ "aria-label": "children" in props ? void 0 : props.label,
708
+ isDisabled: props.disabled,
709
+ isSelected: props.checked
710
+ }),
711
+ [props]
712
+ );
713
+ const state = useToggleState(ariaSwitchProps);
714
+ const ref = useObjectRef(external);
715
+ const {
716
+ inputProps: { className: _className, type: _type, ...rest }
717
+ } = useSwitch(ariaSwitchProps, state, ref);
718
+ return /* @__PURE__ */ jsxs4(Label, { className, "aria-disabled": disabled, children: [
719
+ /* @__PURE__ */ jsx8(SwitchInput, { ...rest, ref }),
720
+ "children" in props ? /* @__PURE__ */ jsx8(LabelInner, { children: props.children }) : void 0
721
+ ] });
722
+ }
723
+ );
724
+ var Switch_default = memo3(SwitchCheckbox);
692
725
  var Label = styled7.label`
693
726
  display: inline-grid;
694
727
  grid-template-columns: auto 1fr;
@@ -780,19 +813,16 @@ var SwitchInput = styled7.input.attrs({
780
813
  // src/components/TextField/index.tsx
781
814
  import { useTextField } from "@react-aria/textfield";
782
815
  import { useVisuallyHidden } from "@react-aria/visually-hidden";
783
- import React10, {
784
- useCallback as useCallback3,
785
- useEffect,
786
- useRef as useRef2,
787
- useState
788
- } from "react";
789
- import styled9, { css as css3 } from "styled-components";
816
+ import { useCallback as useCallback3, useEffect, useRef, useState } from "react";
817
+ import * as React5 from "react";
818
+ import styled9 from "styled-components";
790
819
 
791
820
  // src/components/FieldLabel/index.tsx
792
- import React9 from "react";
821
+ import * as React4 from "react";
793
822
  import styled8 from "styled-components";
794
823
  import { createTheme as createTheme2 } from "@charcoal-ui/styled";
795
- var FieldLabel = React9.forwardRef(
824
+ import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
825
+ var FieldLabel = React4.forwardRef(
796
826
  function FieldLabel2({
797
827
  style,
798
828
  className,
@@ -802,7 +832,11 @@ var FieldLabel = React9.forwardRef(
802
832
  subLabel,
803
833
  ...labelProps
804
834
  }, ref) {
805
- return /* @__PURE__ */ React9.createElement(FieldLabelWrapper, { style, className }, /* @__PURE__ */ React9.createElement(Label2, { ref, ...labelProps }, label), required && /* @__PURE__ */ React9.createElement(RequiredText, null, requiredText), /* @__PURE__ */ React9.createElement(SubLabelClickable, null, /* @__PURE__ */ React9.createElement("span", null, subLabel)));
835
+ return /* @__PURE__ */ jsxs5(FieldLabelWrapper, { style, className, children: [
836
+ /* @__PURE__ */ jsx9(Label2, { ref, ...labelProps, children: label }),
837
+ required && /* @__PURE__ */ jsx9(RequiredText, { children: requiredText }),
838
+ /* @__PURE__ */ jsx9(SubLabelClickable, { children: /* @__PURE__ */ jsx9("span", { children: subLabel }) })
839
+ ] });
806
840
  }
807
841
  );
808
842
  var FieldLabel_default = FieldLabel;
@@ -834,230 +868,122 @@ var FieldLabelWrapper = styled8.div`
834
868
  `;
835
869
 
836
870
  // src/components/TextField/index.tsx
837
- import { createTheme as createTheme3 } from "@charcoal-ui/styled";
838
- var theme3 = createTheme3(styled9);
839
- function mergeRefs(...refs) {
840
- return (value) => {
841
- for (const ref of refs) {
842
- if (typeof ref === "function") {
843
- ref(value);
844
- } else if (ref !== null) {
845
- ;
846
- ref.current = value;
847
- }
848
- }
849
- };
850
- }
851
- function countCodePointsInString(string) {
852
- return Array.from(string).length;
853
- }
854
- var TextField = React10.forwardRef(
855
- function TextField2(props, ref) {
856
- return props.multiline !== void 0 && props.multiline ? /* @__PURE__ */ React10.createElement(MultiLineTextField, { ref, ...props }) : /* @__PURE__ */ React10.createElement(SingleLineTextField, { ref, ...props });
857
- }
858
- );
859
- var TextField_default = TextField;
860
- var SingleLineTextField = React10.forwardRef(function SingleLineTextFieldInner({ onChange, ...props }, forwardRef4) {
861
- const {
862
- className,
863
- showLabel = false,
864
- showCount = false,
865
- label,
866
- requiredText,
867
- subLabel,
868
- disabled = false,
869
- required,
870
- invalid = false,
871
- assistiveText,
872
- maxLength,
873
- prefix = null,
874
- suffix = null
875
- } = props;
876
- const { visuallyHiddenProps } = useVisuallyHidden();
877
- const ariaRef = useRef2(null);
878
- const prefixRef = useRef2(null);
879
- const suffixRef = useRef2(null);
880
- const [count, setCount] = useState(countCodePointsInString(props.value ?? ""));
881
- const [prefixWidth, setPrefixWidth] = useState(0);
882
- const [suffixWidth, setSuffixWidth] = useState(0);
883
- const nonControlled = props.value === void 0;
884
- const handleChange = useCallback3(
885
- (value) => {
886
- const count2 = countCodePointsInString(value);
887
- if (maxLength !== void 0 && count2 > maxLength) {
888
- return;
889
- }
890
- if (nonControlled) {
891
- setCount(count2);
892
- }
893
- onChange?.(value);
894
- },
895
- [maxLength, nonControlled, onChange]
896
- );
897
- useEffect(() => {
898
- setCount(countCodePointsInString(props.value ?? ""));
899
- }, [props.value]);
900
- const { inputProps, labelProps, descriptionProps, errorMessageProps } = useTextField(
901
- {
902
- inputElementType: "input",
903
- isDisabled: disabled,
904
- isRequired: required,
905
- validationState: invalid ? "invalid" : "valid",
906
- description: !invalid && assistiveText,
907
- errorMessage: invalid && assistiveText,
908
- onChange: handleChange,
909
- ...props
910
- },
911
- ariaRef
912
- );
913
- useEffect(() => {
914
- const prefixObserver = new ResizeObserver((entries) => {
915
- setPrefixWidth(entries[0].contentRect.width);
916
- });
917
- const suffixObserver = new ResizeObserver((entries) => {
918
- setSuffixWidth(entries[0].contentRect.width);
919
- });
920
- if (prefixRef.current !== null) {
921
- prefixObserver.observe(prefixRef.current);
922
- }
923
- if (suffixRef.current !== null) {
924
- suffixObserver.observe(suffixRef.current);
925
- }
926
- return () => {
927
- suffixObserver.disconnect();
928
- prefixObserver.disconnect();
929
- };
930
- }, []);
931
- return /* @__PURE__ */ React10.createElement(TextFieldRoot, { className, isDisabled: disabled }, /* @__PURE__ */ React10.createElement(
932
- TextFieldLabel,
933
- {
871
+ import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
872
+ var TextField = React5.forwardRef(
873
+ function SingleLineTextFieldInner({ onChange, ...props }, forwardRef16) {
874
+ const {
875
+ className,
876
+ showLabel = false,
877
+ showCount = false,
934
878
  label,
935
879
  requiredText,
936
- required,
937
880
  subLabel,
938
- ...labelProps,
939
- ...!showLabel ? visuallyHiddenProps : {}
940
- }
941
- ), /* @__PURE__ */ React10.createElement(StyledInputContainer, null, /* @__PURE__ */ React10.createElement(PrefixContainer, { ref: prefixRef }, /* @__PURE__ */ React10.createElement(Affix, null, prefix)), /* @__PURE__ */ React10.createElement(
942
- StyledInput,
943
- {
944
- ref: mergeRefs(forwardRef4, ariaRef),
945
- invalid,
946
- extraLeftPadding: prefixWidth,
947
- extraRightPadding: suffixWidth,
948
- ...inputProps
949
- }
950
- ), /* @__PURE__ */ React10.createElement(SuffixContainer, { ref: suffixRef }, /* @__PURE__ */ React10.createElement(Affix, null, suffix), showCount && /* @__PURE__ */ React10.createElement(SingleLineCounter, null, maxLength !== void 0 ? `${count}/${maxLength}` : count))), assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ React10.createElement(
951
- AssistiveText,
952
- {
953
- invalid,
954
- ...invalid ? errorMessageProps : descriptionProps
955
- },
956
- assistiveText
957
- ));
958
- });
959
- var MultiLineTextField = React10.forwardRef(function MultiLineTextFieldInner({ onChange, ...props }, forwardRef4) {
960
- const {
961
- className,
962
- showCount = false,
963
- showLabel = false,
964
- label,
965
- requiredText,
966
- subLabel,
967
- disabled = false,
968
- required,
969
- invalid = false,
970
- assistiveText,
971
- maxLength,
972
- autoHeight = false,
973
- rows: initialRows = 4
974
- } = props;
975
- const { visuallyHiddenProps } = useVisuallyHidden();
976
- const textareaRef = useRef2(null);
977
- const ariaRef = useRef2(null);
978
- const [count, setCount] = useState(countCodePointsInString(props.value ?? ""));
979
- const [rows, setRows] = useState(initialRows);
980
- const syncHeight = useCallback3(
981
- (textarea) => {
982
- const rows2 = (`${textarea.value}
983
- `.match(/\n/gu)?.length ?? 0) || 1;
984
- setRows(initialRows <= rows2 ? rows2 : initialRows);
985
- },
986
- [initialRows]
987
- );
988
- const nonControlled = props.value === void 0;
989
- const handleChange = useCallback3(
990
- (value) => {
991
- const count2 = countCodePointsInString(value);
992
- if (maxLength !== void 0 && count2 > maxLength) {
993
- return;
994
- }
995
- if (nonControlled) {
996
- setCount(count2);
997
- }
998
- if (autoHeight && textareaRef.current !== null) {
999
- syncHeight(textareaRef.current);
1000
- }
1001
- onChange?.(value);
1002
- },
1003
- [autoHeight, maxLength, nonControlled, onChange, syncHeight]
1004
- );
1005
- useEffect(() => {
1006
- setCount(countCodePointsInString(props.value ?? ""));
1007
- }, [props.value]);
1008
- const { inputProps, labelProps, descriptionProps, errorMessageProps } = useTextField(
1009
- {
1010
- inputElementType: "textarea",
1011
- isDisabled: disabled,
1012
- isRequired: required,
1013
- validationState: invalid ? "invalid" : "valid",
1014
- description: !invalid && assistiveText,
1015
- errorMessage: invalid && assistiveText,
1016
- onChange: handleChange,
1017
- ...props
1018
- },
1019
- ariaRef
1020
- );
1021
- useEffect(() => {
1022
- if (autoHeight && textareaRef.current !== null) {
1023
- syncHeight(textareaRef.current);
1024
- }
1025
- }, [autoHeight, syncHeight]);
1026
- return /* @__PURE__ */ React10.createElement(TextFieldRoot, { className, isDisabled: disabled }, /* @__PURE__ */ React10.createElement(
1027
- TextFieldLabel,
1028
- {
1029
- label,
1030
- requiredText,
881
+ disabled = false,
1031
882
  required,
1032
- subLabel,
1033
- ...labelProps,
1034
- ...!showLabel ? visuallyHiddenProps : {}
1035
- }
1036
- ), /* @__PURE__ */ React10.createElement(
1037
- StyledTextareaContainer,
1038
- {
1039
- invalid,
1040
- rows: showCount ? rows + 1 : rows
1041
- },
1042
- /* @__PURE__ */ React10.createElement(
1043
- StyledTextarea,
883
+ invalid = false,
884
+ assistiveText,
885
+ maxLength,
886
+ prefix = null,
887
+ suffix = null
888
+ } = props;
889
+ const { visuallyHiddenProps } = useVisuallyHidden();
890
+ const ariaRef = useRef(null);
891
+ const prefixRef = useRef(null);
892
+ const suffixRef = useRef(null);
893
+ const [count, setCount] = useState(
894
+ countCodePointsInString(props.value ?? "")
895
+ );
896
+ const [prefixWidth, setPrefixWidth] = useState(0);
897
+ const [suffixWidth, setSuffixWidth] = useState(0);
898
+ const nonControlled = props.value === void 0;
899
+ const handleChange = useCallback3(
900
+ (value) => {
901
+ const count2 = countCodePointsInString(value);
902
+ if (maxLength !== void 0 && count2 > maxLength) {
903
+ return;
904
+ }
905
+ if (nonControlled) {
906
+ setCount(count2);
907
+ }
908
+ onChange?.(value);
909
+ },
910
+ [maxLength, nonControlled, onChange]
911
+ );
912
+ useEffect(() => {
913
+ setCount(countCodePointsInString(props.value ?? ""));
914
+ }, [props.value]);
915
+ const { inputProps, labelProps, descriptionProps, errorMessageProps } = useTextField(
1044
916
  {
1045
- ref: mergeRefs(textareaRef, forwardRef4, ariaRef),
1046
- rows,
1047
- noBottomPadding: showCount,
1048
- ...inputProps
917
+ inputElementType: "input",
918
+ isDisabled: disabled,
919
+ isRequired: required,
920
+ validationState: invalid ? "invalid" : "valid",
921
+ description: !invalid && assistiveText,
922
+ errorMessage: invalid && assistiveText,
923
+ onChange: handleChange,
924
+ ...props
925
+ },
926
+ ariaRef
927
+ );
928
+ useEffect(() => {
929
+ const prefixObserver = new ResizeObserver((entries) => {
930
+ setPrefixWidth(entries[0].contentRect.width);
931
+ });
932
+ const suffixObserver = new ResizeObserver((entries) => {
933
+ setSuffixWidth(entries[0].contentRect.width);
934
+ });
935
+ if (prefixRef.current !== null) {
936
+ prefixObserver.observe(prefixRef.current);
1049
937
  }
1050
- ),
1051
- showCount && /* @__PURE__ */ React10.createElement(MultiLineCounter, null, maxLength !== void 0 ? `${count}/${maxLength}` : count)
1052
- ), assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ React10.createElement(
1053
- AssistiveText,
1054
- {
1055
- invalid,
1056
- ...invalid ? errorMessageProps : descriptionProps
1057
- },
1058
- assistiveText
1059
- ));
1060
- });
938
+ if (suffixRef.current !== null) {
939
+ suffixObserver.observe(suffixRef.current);
940
+ }
941
+ return () => {
942
+ suffixObserver.disconnect();
943
+ prefixObserver.disconnect();
944
+ };
945
+ }, []);
946
+ return /* @__PURE__ */ jsxs6(TextFieldRoot, { className, isDisabled: disabled, children: [
947
+ /* @__PURE__ */ jsx10(
948
+ TextFieldLabel,
949
+ {
950
+ label,
951
+ requiredText,
952
+ required,
953
+ subLabel,
954
+ ...labelProps,
955
+ ...!showLabel ? visuallyHiddenProps : {}
956
+ }
957
+ ),
958
+ /* @__PURE__ */ jsxs6(StyledInputContainer, { children: [
959
+ /* @__PURE__ */ jsx10(PrefixContainer, { ref: prefixRef, children: /* @__PURE__ */ jsx10(Affix, { children: prefix }) }),
960
+ /* @__PURE__ */ jsx10(
961
+ StyledInput,
962
+ {
963
+ ref: mergeRefs(forwardRef16, ariaRef),
964
+ invalid,
965
+ extraLeftPadding: prefixWidth,
966
+ extraRightPadding: suffixWidth,
967
+ ...inputProps
968
+ }
969
+ ),
970
+ /* @__PURE__ */ jsxs6(SuffixContainer, { ref: suffixRef, children: [
971
+ /* @__PURE__ */ jsx10(Affix, { children: suffix }),
972
+ showCount && /* @__PURE__ */ jsx10(SingleLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
973
+ ] })
974
+ ] }),
975
+ assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ jsx10(
976
+ AssistiveText,
977
+ {
978
+ invalid,
979
+ ...invalid ? errorMessageProps : descriptionProps,
980
+ children: assistiveText
981
+ }
982
+ )
983
+ ] });
984
+ }
985
+ );
986
+ var TextField_default = TextField;
1061
987
  var TextFieldRoot = styled9.div`
1062
988
  display: flex;
1063
989
  flex-direction: column;
@@ -1065,7 +991,7 @@ var TextFieldRoot = styled9.div`
1065
991
  ${(p) => p.isDisabled && { opacity: p.theme.elementEffect.disabled.opacity }}
1066
992
  `;
1067
993
  var TextFieldLabel = styled9(FieldLabel_default)`
1068
- ${theme3((o) => o.margin.bottom(8))}
994
+ ${theme((o) => o.margin.bottom(8))}
1069
995
  `;
1070
996
  var StyledInputContainer = styled9.div`
1071
997
  height: 40px;
@@ -1091,7 +1017,7 @@ var SuffixContainer = styled9.span`
1091
1017
  var Affix = styled9.span`
1092
1018
  user-select: none;
1093
1019
 
1094
- ${theme3((o) => [o.typography(14).preserveHalfLeading, o.font.text2])}
1020
+ ${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text2])}
1095
1021
  `;
1096
1022
  var StyledInput = styled9.input`
1097
1023
  border: none;
@@ -1113,7 +1039,7 @@ var StyledInput = styled9.input`
1113
1039
  /* Display box-shadow for iOS Safari */
1114
1040
  appearance: none;
1115
1041
 
1116
- ${(p) => theme3((o) => [
1042
+ ${(p) => theme((o) => [
1117
1043
  o.bg.surface3.hover,
1118
1044
  o.outline.default.focus,
1119
1045
  p.invalid && o.outline.assertive,
@@ -1121,37 +1047,170 @@ var StyledInput = styled9.input`
1121
1047
  ])}
1122
1048
 
1123
1049
  &::placeholder {
1124
- ${theme3((o) => o.font.text3)}
1050
+ ${theme((o) => o.font.text3)}
1125
1051
  }
1126
1052
  `;
1127
- var StyledTextareaContainer = styled9.div`
1053
+ var SingleLineCounter = styled9.span`
1054
+ ${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text3])}
1055
+ `;
1056
+ var AssistiveText = styled9.p`
1057
+ ${(p) => theme((o) => [
1058
+ o.typography(14),
1059
+ o.margin.top(8),
1060
+ o.margin.bottom(0),
1061
+ o.font[p.invalid ? "assertive" : "text1"]
1062
+ ])}
1063
+ `;
1064
+
1065
+ // src/components/TextArea/index.tsx
1066
+ import { useTextField as useTextField2 } from "@react-aria/textfield";
1067
+ import { useVisuallyHidden as useVisuallyHidden2 } from "@react-aria/visually-hidden";
1068
+ import React6, { useCallback as useCallback4, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
1069
+ import styled10, { css as css3 } from "styled-components";
1070
+ import { jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
1071
+ var TextArea = React6.forwardRef(
1072
+ function TextAreaInner({ onChange, ...props }, forwardRef16) {
1073
+ const {
1074
+ className,
1075
+ showCount = false,
1076
+ showLabel = false,
1077
+ label,
1078
+ requiredText,
1079
+ subLabel,
1080
+ disabled = false,
1081
+ required,
1082
+ invalid = false,
1083
+ assistiveText,
1084
+ maxLength,
1085
+ autoHeight = false,
1086
+ rows: initialRows = 4
1087
+ } = props;
1088
+ const { visuallyHiddenProps } = useVisuallyHidden2();
1089
+ const textareaRef = useRef2(null);
1090
+ const ariaRef = useRef2(null);
1091
+ const [count, setCount] = useState2(
1092
+ countCodePointsInString(props.value ?? "")
1093
+ );
1094
+ const [rows, setRows] = useState2(initialRows);
1095
+ const syncHeight = useCallback4(
1096
+ (textarea) => {
1097
+ const rows2 = (`${textarea.value}
1098
+ `.match(/\n/gu)?.length ?? 0) || 1;
1099
+ setRows(initialRows <= rows2 ? rows2 : initialRows);
1100
+ },
1101
+ [initialRows]
1102
+ );
1103
+ const nonControlled = props.value === void 0;
1104
+ const handleChange = useCallback4(
1105
+ (value) => {
1106
+ const count2 = countCodePointsInString(value);
1107
+ if (maxLength !== void 0 && count2 > maxLength) {
1108
+ return;
1109
+ }
1110
+ if (nonControlled) {
1111
+ setCount(count2);
1112
+ }
1113
+ if (autoHeight && textareaRef.current !== null) {
1114
+ syncHeight(textareaRef.current);
1115
+ }
1116
+ onChange?.(value);
1117
+ },
1118
+ [autoHeight, maxLength, nonControlled, onChange, syncHeight]
1119
+ );
1120
+ useEffect2(() => {
1121
+ setCount(countCodePointsInString(props.value ?? ""));
1122
+ }, [props.value]);
1123
+ const { inputProps, labelProps, descriptionProps, errorMessageProps } = useTextField2(
1124
+ {
1125
+ inputElementType: "textarea",
1126
+ isDisabled: disabled,
1127
+ isRequired: required,
1128
+ validationState: invalid ? "invalid" : "valid",
1129
+ description: !invalid && assistiveText,
1130
+ errorMessage: invalid && assistiveText,
1131
+ onChange: handleChange,
1132
+ ...props
1133
+ },
1134
+ ariaRef
1135
+ );
1136
+ useEffect2(() => {
1137
+ if (autoHeight && textareaRef.current !== null) {
1138
+ syncHeight(textareaRef.current);
1139
+ }
1140
+ }, [autoHeight, syncHeight]);
1141
+ return /* @__PURE__ */ jsxs7(TextFieldRoot2, { className, isDisabled: disabled, children: [
1142
+ /* @__PURE__ */ jsx11(
1143
+ TextFieldLabel2,
1144
+ {
1145
+ label,
1146
+ requiredText,
1147
+ required,
1148
+ subLabel,
1149
+ ...labelProps,
1150
+ ...!showLabel ? visuallyHiddenProps : {}
1151
+ }
1152
+ ),
1153
+ /* @__PURE__ */ jsxs7(
1154
+ StyledTextareaContainer,
1155
+ {
1156
+ invalid,
1157
+ rows: showCount ? rows + 1 : rows,
1158
+ children: [
1159
+ /* @__PURE__ */ jsx11(
1160
+ StyledTextarea,
1161
+ {
1162
+ ref: mergeRefs(textareaRef, forwardRef16, ariaRef),
1163
+ rows,
1164
+ noBottomPadding: showCount,
1165
+ ...inputProps
1166
+ }
1167
+ ),
1168
+ showCount && /* @__PURE__ */ jsx11(MultiLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
1169
+ ]
1170
+ }
1171
+ ),
1172
+ assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ jsx11(
1173
+ AssistiveText2,
1174
+ {
1175
+ invalid,
1176
+ ...invalid ? errorMessageProps : descriptionProps,
1177
+ children: assistiveText
1178
+ }
1179
+ )
1180
+ ] });
1181
+ }
1182
+ );
1183
+ var TextArea_default = TextArea;
1184
+ var TextFieldRoot2 = styled10.div`
1185
+ display: flex;
1186
+ flex-direction: column;
1187
+
1188
+ ${(p) => p.isDisabled && { opacity: p.theme.elementEffect.disabled.opacity }}
1189
+ `;
1190
+ var TextFieldLabel2 = styled10(FieldLabel_default)`
1191
+ ${theme((o) => o.margin.bottom(8))}
1192
+ `;
1193
+ var StyledTextareaContainer = styled10.div`
1128
1194
  position: relative;
1129
1195
  overflow: hidden;
1130
1196
  padding: 0 8px;
1131
1197
 
1132
- ${(p) => theme3((o) => [
1198
+ ${(p) => theme((o) => [
1133
1199
  o.bg.surface3.hover,
1134
1200
  p.invalid && o.outline.assertive,
1135
1201
  o.font.text2,
1136
1202
  o.borderRadius(4)
1137
1203
  ])}
1138
1204
 
1139
- /**
1140
- * FIXME: o.outline.default を &:focus-within 内に書いてると、外れるときに transition が効かない
1141
- * 本来 o.outline.default.focus と書けば足してくれるような transition の内容を一旦明示している
1142
- * o.outline.default.focusWithin のようなものがあればこの行は不要になるはず
1143
- */
1144
- transition: box-shadow 0.2s;
1145
-
1146
1205
  &:focus-within {
1147
- ${(p) => theme3((o) => p.invalid ? o.outline.assertive : o.outline.default)}
1206
+ ${(p) => theme((o) => p.invalid ? o.outline.assertive : o.outline.default)}
1148
1207
  }
1149
1208
 
1150
1209
  ${({ rows }) => css3`
1151
1210
  height: calc(22px * ${rows} + 18px);
1152
1211
  `};
1153
1212
  `;
1154
- var StyledTextarea = styled9.textarea`
1213
+ var StyledTextarea = styled10.textarea`
1155
1214
  border: none;
1156
1215
  outline: none;
1157
1216
  resize: none;
@@ -1176,7 +1235,7 @@ var StyledTextarea = styled9.textarea`
1176
1235
  background: none;
1177
1236
 
1178
1237
  &::placeholder {
1179
- ${theme3((o) => o.font.text3)}
1238
+ ${theme((o) => o.font.text3)}
1180
1239
  }
1181
1240
 
1182
1241
  /* Hide scrollbar for Chrome, Safari and Opera */
@@ -1187,18 +1246,15 @@ var StyledTextarea = styled9.textarea`
1187
1246
  -ms-overflow-style: none; /* IE and Edge */
1188
1247
  scrollbar-width: none; /* Firefox */
1189
1248
  `;
1190
- var SingleLineCounter = styled9.span`
1191
- ${theme3((o) => [o.typography(14).preserveHalfLeading, o.font.text3])}
1192
- `;
1193
- var MultiLineCounter = styled9.span`
1249
+ var MultiLineCounter = styled10.span`
1194
1250
  position: absolute;
1195
1251
  bottom: 9px;
1196
1252
  right: 8px;
1197
1253
 
1198
- ${theme3((o) => [o.typography(14).preserveHalfLeading, o.font.text3])}
1254
+ ${theme((o) => [o.typography(14).preserveHalfLeading, o.font.text3])}
1199
1255
  `;
1200
- var AssistiveText = styled9.p`
1201
- ${(p) => theme3((o) => [
1256
+ var AssistiveText2 = styled10.p`
1257
+ ${(p) => theme((o) => [
1202
1258
  o.typography(14),
1203
1259
  o.margin.top(8),
1204
1260
  o.margin.bottom(0),
@@ -1207,10 +1263,11 @@ var AssistiveText = styled9.p`
1207
1263
  `;
1208
1264
 
1209
1265
  // src/components/Icon/index.tsx
1210
- import React11 from "react";
1266
+ import * as React7 from "react";
1211
1267
  import "@charcoal-ui/icons";
1212
- var Icon = React11.forwardRef(function IconInner({ name, scale, unsafeNonGuidelineScale, className, ...rest }, ref) {
1213
- return /* @__PURE__ */ React11.createElement(
1268
+ import { jsx as jsx12 } from "react/jsx-runtime";
1269
+ var Icon = React7.forwardRef(function IconInner({ name, scale, unsafeNonGuidelineScale, className, ...rest }, ref) {
1270
+ return /* @__PURE__ */ jsx12(
1214
1271
  "pixiv-icon",
1215
1272
  {
1216
1273
  ref,
@@ -1225,13 +1282,14 @@ var Icon = React11.forwardRef(function IconInner({ name, scale, unsafeNonGuideli
1225
1282
  var Icon_default = Icon;
1226
1283
 
1227
1284
  // src/components/Modal/index.tsx
1228
- import React12, { useContext as useContext4, useRef as useRef3 } from "react";
1285
+ import { useContext as useContext4, forwardRef as forwardRef11, memo as memo4 } from "react";
1286
+ import * as React8 from "react";
1229
1287
  import {
1230
1288
  Overlay,
1231
1289
  useModalOverlay,
1232
1290
  useOverlay
1233
1291
  } from "@react-aria/overlays";
1234
- import styled10, { css as css4, useTheme } from "styled-components";
1292
+ import styled11, { css as css4, useTheme } from "styled-components";
1235
1293
  import { FocusScope } from "@react-aria/focus";
1236
1294
  import { useDialog } from "@react-aria/dialog";
1237
1295
 
@@ -1246,22 +1304,20 @@ function columnSystem(span, column, gutter) {
1246
1304
  import { maxWidth } from "@charcoal-ui/utils";
1247
1305
  import { useMedia } from "@charcoal-ui/styled";
1248
1306
  import { animated, useTransition, easings } from "react-spring";
1307
+ import { useObjectRef as useObjectRef2 } from "@react-aria/utils";
1308
+ import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
1249
1309
  var DEFAULT_Z_INDEX = 10;
1250
- function Modal({
1251
- children,
1252
- zIndex = DEFAULT_Z_INDEX,
1253
- portalContainer,
1254
- ...props
1255
- }) {
1310
+ var Modal = forwardRef11(function ModalInner({ children, zIndex = DEFAULT_Z_INDEX, portalContainer, ...props }, external) {
1256
1311
  const {
1257
1312
  title,
1258
1313
  size = "M",
1259
1314
  bottomSheet = false,
1260
1315
  isDismissable,
1261
1316
  onClose,
1317
+ className,
1262
1318
  isOpen = false
1263
1319
  } = props;
1264
- const ref = useRef3(null);
1320
+ const ref = useObjectRef2(external);
1265
1321
  const { overlayProps, underlayProps } = useOverlay(props, ref);
1266
1322
  const { modalProps } = useModalOverlay(
1267
1323
  props,
@@ -1278,8 +1334,8 @@ function Modal({
1278
1334
  ref
1279
1335
  );
1280
1336
  const { dialogProps, titleProps } = useDialog(props, ref);
1281
- const theme4 = useTheme();
1282
- const isMobile = useMedia(maxWidth(theme4.breakpoint.screen1)) ?? false;
1337
+ const theme3 = useTheme();
1338
+ const isMobile = useMedia(maxWidth(theme3.breakpoint.screen1)) ?? false;
1283
1339
  const transitionEnabled = isMobile && bottomSheet !== false;
1284
1340
  const transition = useTransition(isOpen, {
1285
1341
  from: {
@@ -1298,50 +1354,54 @@ function Modal({
1298
1354
  });
1299
1355
  const showDismiss = !isMobile || bottomSheet !== true;
1300
1356
  return transition(
1301
- ({ backgroundColor, transform }, item) => item && /* @__PURE__ */ React12.createElement(Overlay, { portalContainer }, /* @__PURE__ */ React12.createElement(
1357
+ ({ backgroundColor, transform }, item) => item && /* @__PURE__ */ jsx13(Overlay, { portalContainer, children: /* @__PURE__ */ jsx13(
1302
1358
  ModalBackground,
1303
1359
  {
1304
1360
  zIndex,
1305
1361
  ...underlayProps,
1306
- style: transitionEnabled ? { backgroundColor } : {}
1307
- },
1308
- /* @__PURE__ */ React12.createElement(FocusScope, { contain: true, restoreFocus: true, autoFocus: true }, /* @__PURE__ */ React12.createElement(DialogContainer, { bottomSheet, size }, /* @__PURE__ */ React12.createElement(
1309
- ModalDialog,
1310
- {
1311
- ref,
1312
- ...overlayProps,
1313
- ...modalProps,
1314
- ...dialogProps,
1315
- style: transitionEnabled ? { transform } : {},
1316
- size,
1317
- bottomSheet
1318
- },
1319
- /* @__PURE__ */ React12.createElement(
1320
- ModalContext.Provider,
1362
+ style: transitionEnabled ? { backgroundColor } : {},
1363
+ children: /* @__PURE__ */ jsx13(FocusScope, { contain: true, restoreFocus: true, autoFocus: true, children: /* @__PURE__ */ jsx13(DialogContainer, { bottomSheet, size, children: /* @__PURE__ */ jsx13(
1364
+ ModalDialog,
1321
1365
  {
1322
- value: { titleProps, title, close: onClose, showDismiss }
1323
- },
1324
- children,
1325
- isDismissable === true && /* @__PURE__ */ React12.createElement(
1326
- ModalCrossButton,
1327
- {
1328
- size: "S",
1329
- icon: "24/Close",
1330
- onClick: onClose
1331
- }
1332
- )
1333
- )
1334
- )))
1335
- ))
1366
+ ref,
1367
+ ...overlayProps,
1368
+ ...modalProps,
1369
+ ...dialogProps,
1370
+ style: transitionEnabled ? { transform } : {},
1371
+ size,
1372
+ bottomSheet,
1373
+ className,
1374
+ children: /* @__PURE__ */ jsxs8(
1375
+ ModalContext.Provider,
1376
+ {
1377
+ value: { titleProps, title, close: onClose, showDismiss },
1378
+ children: [
1379
+ children,
1380
+ isDismissable === true && /* @__PURE__ */ jsx13(
1381
+ ModalCrossButton,
1382
+ {
1383
+ size: "S",
1384
+ icon: "24/Close",
1385
+ onClick: onClose
1386
+ }
1387
+ )
1388
+ ]
1389
+ }
1390
+ )
1391
+ }
1392
+ ) }) })
1393
+ }
1394
+ ) })
1336
1395
  );
1337
- }
1338
- var ModalContext = React12.createContext({
1396
+ });
1397
+ var Modal_default = memo4(Modal);
1398
+ var ModalContext = React8.createContext({
1339
1399
  titleProps: {},
1340
1400
  title: "",
1341
1401
  close: void 0,
1342
1402
  showDismiss: true
1343
1403
  });
1344
- var ModalBackground = animated(styled10.div`
1404
+ var ModalBackground = animated(styled11.div`
1345
1405
  z-index: ${({ zIndex }) => zIndex};
1346
1406
  overflow: scroll;
1347
1407
  display: flex;
@@ -1353,7 +1413,7 @@ var ModalBackground = animated(styled10.div`
1353
1413
 
1354
1414
  ${theme((o) => [o.bg.surface4])}
1355
1415
  `);
1356
- var DialogContainer = styled10.div`
1416
+ var DialogContainer = styled11.div`
1357
1417
  position: relative;
1358
1418
  margin: auto;
1359
1419
  padding: 24px 0;
@@ -1374,7 +1434,7 @@ var DialogContainer = styled10.div`
1374
1434
  }
1375
1435
  }}px;
1376
1436
 
1377
- @media ${({ theme: theme4 }) => maxWidth(theme4.breakpoint.screen1)} {
1437
+ @media ${({ theme: theme3 }) => maxWidth(theme3.breakpoint.screen1)} {
1378
1438
  width: calc(100% - 48px);
1379
1439
  ${(p) => p.bottomSheet !== false && css4`
1380
1440
  margin: 0;
@@ -1386,13 +1446,13 @@ var DialogContainer = styled10.div`
1386
1446
  `}
1387
1447
  }
1388
1448
  `;
1389
- var ModalDialog = animated(styled10.div`
1449
+ var ModalDialog = animated(styled11.div`
1390
1450
  position: relative;
1391
1451
  margin: auto;
1392
1452
  padding: 24px 0;
1393
1453
 
1394
1454
  ${theme((o) => [o.bg.background1, o.borderRadius(24)])}
1395
- @media ${({ theme: theme4 }) => maxWidth(theme4.breakpoint.screen1)} {
1455
+ @media ${({ theme: theme3 }) => maxWidth(theme3.breakpoint.screen1)} {
1396
1456
  ${(p) => p.bottomSheet !== false && css4`
1397
1457
  border-radius: 0;
1398
1458
  ${p.bottomSheet === "full" && css4`
@@ -1401,7 +1461,7 @@ var ModalDialog = animated(styled10.div`
1401
1461
  `}
1402
1462
  }
1403
1463
  `);
1404
- var ModalCrossButton = styled10(IconButton_default)`
1464
+ var ModalCrossButton = styled11(IconButton_default)`
1405
1465
  position: absolute;
1406
1466
  top: 8px;
1407
1467
  right: 8px;
@@ -1410,36 +1470,36 @@ var ModalCrossButton = styled10(IconButton_default)`
1410
1470
  `;
1411
1471
  function ModalTitle(props) {
1412
1472
  const { titleProps, title } = useContext4(ModalContext);
1413
- return /* @__PURE__ */ React12.createElement(ModalHeading, { ...titleProps, ...props }, title);
1473
+ return /* @__PURE__ */ jsx13(ModalHeading, { ...titleProps, ...props, children: title });
1414
1474
  }
1415
- var ModalHeading = styled10.h3`
1475
+ var ModalHeading = styled11.h3`
1416
1476
  margin: 0;
1417
1477
  font-weight: inherit;
1418
1478
  font-size: inherit;
1419
1479
  `;
1420
1480
 
1421
1481
  // src/components/Modal/ModalPlumbing.tsx
1422
- import React13 from "react";
1423
- import styled11 from "styled-components";
1482
+ import styled12 from "styled-components";
1483
+ import { jsx as jsx14 } from "react/jsx-runtime";
1424
1484
  function ModalHeader() {
1425
- return /* @__PURE__ */ React13.createElement(ModalHeaderRoot, null, /* @__PURE__ */ React13.createElement(StyledModalTitle, null));
1485
+ return /* @__PURE__ */ jsx14(ModalHeaderRoot, { children: /* @__PURE__ */ jsx14(StyledModalTitle, {}) });
1426
1486
  }
1427
- var ModalHeaderRoot = styled11.div`
1487
+ var ModalHeaderRoot = styled12.div`
1428
1488
  height: 64px;
1429
1489
  display: grid;
1430
1490
  align-content: center;
1431
1491
  justify-content: center;
1432
1492
  `;
1433
- var StyledModalTitle = styled11(ModalTitle)`
1493
+ var StyledModalTitle = styled12(ModalTitle)`
1434
1494
  ${theme((o) => [o.font.text1, o.typography(16).bold])}
1435
1495
  `;
1436
- var ModalAlign = styled11.div`
1496
+ var ModalAlign = styled12.div`
1437
1497
  ${theme((o) => [o.padding.horizontal(16)])}
1438
1498
  `;
1439
- var ModalBody = styled11.div`
1499
+ var ModalBody = styled12.div`
1440
1500
  ${theme((o) => [o.padding.bottom(40)])}
1441
1501
  `;
1442
- var ModalButtons = styled11.div`
1502
+ var ModalButtons = styled12.div`
1443
1503
  display: grid;
1444
1504
  grid-auto-flow: row;
1445
1505
  grid-row-gap: 8px;
@@ -1448,16 +1508,26 @@ var ModalButtons = styled11.div`
1448
1508
  `;
1449
1509
 
1450
1510
  // src/components/LoadingSpinner/index.tsx
1451
- import React14, { useImperativeHandle, useRef as useRef4 } from "react";
1452
- import styled12, { keyframes } from "styled-components";
1453
- function LoadingSpinner({
1454
- size = 48,
1455
- padding = 16,
1456
- transparent = false
1457
- }) {
1458
- return /* @__PURE__ */ React14.createElement(LoadingSpinnerRoot, { size, padding, transparent }, /* @__PURE__ */ React14.createElement(LoadingSpinnerIcon, null));
1459
- }
1460
- var LoadingSpinnerRoot = styled12.div.attrs({ role: "progressbar" })`
1511
+ import { forwardRef as forwardRef12, useImperativeHandle, useRef as useRef3, memo as memo5 } from "react";
1512
+ import styled13, { keyframes } from "styled-components";
1513
+ import { jsx as jsx15 } from "react/jsx-runtime";
1514
+ var LoadingSpinner = forwardRef12(
1515
+ function LoadingSpinnerInner({ size = 48, padding = 16, transparent = false, className }, ref) {
1516
+ return /* @__PURE__ */ jsx15(
1517
+ LoadingSpinnerRoot,
1518
+ {
1519
+ size,
1520
+ padding,
1521
+ transparent,
1522
+ className,
1523
+ ref,
1524
+ children: /* @__PURE__ */ jsx15(LoadingSpinnerIcon, {})
1525
+ }
1526
+ );
1527
+ }
1528
+ );
1529
+ var LoadingSpinner_default = memo5(LoadingSpinner);
1530
+ var LoadingSpinnerRoot = styled13.div.attrs({ role: "progressbar" })`
1461
1531
  box-sizing: content-box;
1462
1532
  margin: auto;
1463
1533
  padding: ${(props) => props.padding}px;
@@ -1482,7 +1552,7 @@ var scaleout = keyframes`
1482
1552
  opacity: 0;
1483
1553
  }
1484
1554
  `;
1485
- var Icon2 = styled12.div.attrs({ role: "presentation" })`
1555
+ var Icon2 = styled13.div.attrs({ role: "presentation" })`
1486
1556
  width: 1em;
1487
1557
  height: 1em;
1488
1558
  border-radius: 1em;
@@ -1494,56 +1564,90 @@ var Icon2 = styled12.div.attrs({ role: "presentation" })`
1494
1564
  animation: none;
1495
1565
  }
1496
1566
  `;
1497
- var LoadingSpinnerIcon = React14.forwardRef(function LoadingSpinnerIcon2({ once = false }, ref) {
1498
- const iconRef = useRef4(null);
1499
- useImperativeHandle(ref, () => ({
1500
- restart: () => {
1501
- if (!iconRef.current) {
1502
- return;
1567
+ var LoadingSpinnerIcon = forwardRef12(
1568
+ function LoadingSpinnerIcon2({ once = false }, ref) {
1569
+ const iconRef = useRef3(null);
1570
+ useImperativeHandle(ref, () => ({
1571
+ restart: () => {
1572
+ if (!iconRef.current) {
1573
+ return;
1574
+ }
1575
+ iconRef.current.dataset.resetAnimation = "true";
1576
+ void iconRef.current.offsetWidth;
1577
+ delete iconRef.current.dataset.resetAnimation;
1503
1578
  }
1504
- iconRef.current.dataset.resetAnimation = "true";
1505
- void iconRef.current.offsetWidth;
1506
- delete iconRef.current.dataset.resetAnimation;
1507
- }
1508
- }));
1509
- return /* @__PURE__ */ React14.createElement(Icon2, { ref: iconRef, once });
1510
- });
1579
+ }));
1580
+ return /* @__PURE__ */ jsx15(Icon2, { ref: iconRef, once });
1581
+ }
1582
+ );
1511
1583
 
1512
1584
  // src/components/DropdownSelector/index.tsx
1513
- import React16, { createContext as createContext2, useRef as useRef6 } from "react";
1514
- import styled14 from "styled-components";
1515
- import { useOverlayTriggerState } from "react-stately";
1585
+ import { useState as useState3, useRef as useRef7 } from "react";
1586
+ import styled16 from "styled-components";
1516
1587
  import { disabledSelector as disabledSelector4 } from "@charcoal-ui/utils";
1517
1588
 
1518
1589
  // src/components/DropdownSelector/DropdownPopover.tsx
1519
- import React15, { useEffect as useEffect2, useRef as useRef5 } from "react";
1520
- import {
1521
- DismissButton,
1522
- Overlay as Overlay2,
1523
- usePopover
1524
- } from "@react-aria/overlays";
1525
- import styled13 from "styled-components";
1526
- var DropdownPopoverDiv = styled13.div`
1527
- width: 100%;
1528
- ${theme((o) => o.margin.top(4).bottom(4))}
1529
- `;
1530
- function DropdownPopover({ children, state, ...props }) {
1531
- const ref = useRef5(null);
1590
+ import { useEffect as useEffect3, useRef as useRef5 } from "react";
1591
+
1592
+ // src/components/DropdownSelector/Popover/index.tsx
1593
+ import { useRef as useRef4 } from "react";
1594
+ import { DismissButton, Overlay as Overlay2, usePopover } from "@react-aria/overlays";
1595
+ import styled14 from "styled-components";
1596
+ import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
1597
+ var _empty = () => null;
1598
+ function Popover(props) {
1599
+ const defaultPopoverRef = useRef4(null);
1600
+ const finalPopoverRef = props.popoverRef === void 0 ? defaultPopoverRef : props.popoverRef;
1532
1601
  const { popoverProps, underlayProps } = usePopover(
1533
1602
  {
1534
- ...props,
1535
- popoverRef: ref,
1536
- containerPadding: 0
1603
+ triggerRef: props.triggerRef,
1604
+ popoverRef: finalPopoverRef,
1605
+ containerPadding: 16
1537
1606
  },
1538
- state
1607
+ {
1608
+ close: props.onClose,
1609
+ isOpen: props.isOpen,
1610
+ open: _empty,
1611
+ setOpen: _empty,
1612
+ toggle: _empty
1613
+ }
1539
1614
  );
1540
- useEffect2(() => {
1541
- if (ref.current && props.triggerRef.current) {
1615
+ if (!props.isOpen)
1616
+ return null;
1617
+ return /* @__PURE__ */ jsxs9(Overlay2, { portalContainer: document.body, children: [
1618
+ /* @__PURE__ */ jsx16("div", { ...underlayProps, style: { position: "fixed", inset: 0 } }),
1619
+ /* @__PURE__ */ jsxs9(DropdownPopoverDiv, { ...popoverProps, ref: finalPopoverRef, children: [
1620
+ /* @__PURE__ */ jsx16(DismissButton, { onDismiss: () => props.onClose() }),
1621
+ props.children,
1622
+ /* @__PURE__ */ jsx16(DismissButton, { onDismiss: () => props.onClose() })
1623
+ ] })
1624
+ ] });
1625
+ }
1626
+ var DropdownPopoverDiv = styled14.div`
1627
+ margin: 4px 0;
1628
+ list-style: none;
1629
+ overflow: auto;
1630
+ max-height: inherit;
1631
+
1632
+ ${theme((o) => [
1633
+ o.bg.background1,
1634
+ o.border.default,
1635
+ o.borderRadius(8),
1636
+ o.padding.vertical(8)
1637
+ ])}
1638
+ `;
1639
+
1640
+ // src/components/DropdownSelector/DropdownPopover.tsx
1641
+ import { jsx as jsx17 } from "react/jsx-runtime";
1642
+ function DropdownPopover({ children, ...props }) {
1643
+ const ref = useRef5(null);
1644
+ useEffect3(() => {
1645
+ if (props.isOpen && ref.current && props.triggerRef.current) {
1542
1646
  ref.current.style.width = `${props.triggerRef.current.clientWidth}px`;
1543
1647
  }
1544
- }, [props.triggerRef]);
1545
- useEffect2(() => {
1546
- if (state.isOpen && props.value !== void 0) {
1648
+ }, [props.triggerRef, props.isOpen]);
1649
+ useEffect3(() => {
1650
+ if (props.isOpen && props.value !== void 0) {
1547
1651
  const windowScrollY = window.scrollY;
1548
1652
  const windowScrollX = window.scrollX;
1549
1653
  const selectedElement = document.querySelector(
@@ -1553,92 +1657,163 @@ function DropdownPopover({ children, state, ...props }) {
1553
1657
  selectedElement?.focus();
1554
1658
  window.scrollTo(windowScrollX, windowScrollY);
1555
1659
  }
1556
- }, [props.value, state.isOpen]);
1557
- return /* @__PURE__ */ React15.createElement(Overlay2, { portalContainer: document.body }, /* @__PURE__ */ React15.createElement("div", { ...underlayProps, style: { position: "fixed", inset: 0 } }), /* @__PURE__ */ React15.createElement(DropdownPopoverDiv, { ...popoverProps, ref }, /* @__PURE__ */ React15.createElement(DismissButton, { onDismiss: () => state.close() }), children, /* @__PURE__ */ React15.createElement(DismissButton, { onDismiss: () => state.close() })));
1660
+ }, [props.value, props.isOpen]);
1661
+ return /* @__PURE__ */ jsx17(
1662
+ Popover,
1663
+ {
1664
+ isOpen: props.isOpen,
1665
+ onClose: props.onClose,
1666
+ popoverRef: ref,
1667
+ triggerRef: props.triggerRef,
1668
+ children
1669
+ }
1670
+ );
1558
1671
  }
1559
1672
 
1560
- // src/components/DropdownSelector/index.tsx
1561
- var DropdownSelectorContext = createContext2({
1673
+ // src/components/DropdownSelector/utils/findPreviewRecursive.tsx
1674
+ import React10 from "react";
1675
+ function findPreviewRecursive(children, value) {
1676
+ const childArray = React10.Children.toArray(children);
1677
+ for (let i = 0; i < childArray.length; i++) {
1678
+ const child = childArray[i];
1679
+ if (React10.isValidElement(child)) {
1680
+ if ("value" in child.props) {
1681
+ const childValue = child.props.value;
1682
+ if (childValue === value && "children" in child.props) {
1683
+ const children2 = child.props.children;
1684
+ return children2;
1685
+ }
1686
+ }
1687
+ if ("children" in child.props) {
1688
+ const children2 = findPreviewRecursive(
1689
+ child.props.children,
1690
+ value
1691
+ );
1692
+ if (children2 !== void 0) {
1693
+ return children2;
1694
+ }
1695
+ }
1696
+ }
1697
+ }
1698
+ }
1699
+
1700
+ // src/components/DropdownSelector/MenuList/index.tsx
1701
+ import { useRef as useRef6 } from "react";
1702
+ import styled15 from "styled-components";
1703
+
1704
+ // src/components/DropdownSelector/MenuList/MenuListContext.ts
1705
+ import { createContext as createContext5 } from "react";
1706
+ var MenuListContext = createContext5({
1707
+ root: void 0,
1562
1708
  value: "",
1709
+ values: [],
1563
1710
  setValue: (_v) => {
1564
1711
  }
1565
1712
  });
1566
- var defaultRequiredText = "*\u5FC5\u9808";
1567
- function DropdownSelector(props) {
1568
- const triggerRef = useRef6(null);
1569
- const state = useOverlayTriggerState({});
1570
- let preview;
1571
- const childArray = React16.Children.toArray(props.children);
1713
+
1714
+ // src/components/DropdownSelector/MenuList/internals/getValuesRecursive.tsx
1715
+ import React11 from "react";
1716
+ function getValuesRecursive(children, values = []) {
1717
+ const childArray = React11.Children.toArray(children);
1572
1718
  for (let i = 0; i < childArray.length; i++) {
1573
1719
  const child = childArray[i];
1574
- if (React16.isValidElement(child) && "value" in child.props) {
1575
- const find = child.props.value === props.value;
1576
- if (find && "children" in child.props) {
1577
- preview = child.props.children;
1578
- break;
1720
+ if (React11.isValidElement(child)) {
1721
+ const props = child.props;
1722
+ if ("value" in props && typeof props.value === "string") {
1723
+ const childValue = props.value;
1724
+ values.push(childValue);
1725
+ }
1726
+ if ("children" in props && props.children) {
1727
+ getValuesRecursive(props.children, values);
1579
1728
  }
1580
1729
  }
1581
1730
  }
1582
- return /* @__PURE__ */ React16.createElement(DropdownSelectorRoot, { "aria-disabled": props.disabled }, props.showLabel === true && /* @__PURE__ */ React16.createElement(
1583
- DropdownFieldLabel,
1584
- {
1585
- label: props.label,
1586
- required: props.required,
1587
- requiredText: props.requiredText ?? defaultRequiredText,
1588
- subLabel: props.subLabel
1589
- }
1590
- ), /* @__PURE__ */ React16.createElement(
1591
- DropdownButton,
1592
- {
1593
- invalid: props.invalid,
1594
- disabled: props.disabled,
1595
- onClick: () => {
1596
- if (props.disabled === true)
1597
- return;
1598
- state.open();
1599
- },
1600
- ref: triggerRef
1601
- },
1602
- /* @__PURE__ */ React16.createElement(DropdownButtonText, null, props.placeholder !== void 0 && preview === void 0 ? props.placeholder : preview),
1603
- /* @__PURE__ */ React16.createElement(DropdownButtonIcon, { name: "16/Menu" })
1604
- ), state.isOpen && /* @__PURE__ */ React16.createElement(
1605
- DropdownPopover,
1731
+ }
1732
+
1733
+ // src/components/DropdownSelector/MenuList/index.tsx
1734
+ import { jsx as jsx18 } from "react/jsx-runtime";
1735
+ function MenuList(props) {
1736
+ const root = useRef6(null);
1737
+ const values = [];
1738
+ getValuesRecursive(props.children, values);
1739
+ return /* @__PURE__ */ jsx18(StyledUl, { ref: root, children: /* @__PURE__ */ jsx18(
1740
+ MenuListContext.Provider,
1606
1741
  {
1607
- state,
1608
- triggerRef,
1609
- value: props.value
1610
- },
1611
- /* @__PURE__ */ React16.createElement(ListboxRoot, null, /* @__PURE__ */ React16.createElement(
1612
- DropdownSelectorContext.Provider,
1613
- {
1614
- value: {
1615
- value: props.value,
1616
- setValue: (v) => {
1617
- props.onChange(v);
1618
- state.close();
1619
- }
1742
+ value: {
1743
+ value: props.value ?? "",
1744
+ root,
1745
+ values,
1746
+ setValue: (v) => {
1747
+ props.onChange?.(v);
1620
1748
  }
1621
1749
  },
1622
- props.children
1623
- ))
1624
- ), props.assistiveText !== void 0 && /* @__PURE__ */ React16.createElement(AssertiveText, { invalid: props.invalid }, props.assistiveText));
1750
+ children: props.children
1751
+ }
1752
+ ) });
1625
1753
  }
1626
- var ListboxRoot = styled14.ul`
1627
- padding-left: 0;
1754
+ var StyledUl = styled15.ul`
1755
+ padding: 0;
1628
1756
  margin: 0;
1629
- box-sizing: border-box;
1630
- list-style: none;
1631
- overflow: auto;
1632
- max-height: inherit;
1633
-
1634
- ${theme((o) => [
1635
- o.bg.background1,
1636
- o.border.default,
1637
- o.borderRadius(8),
1638
- o.padding.vertical(8)
1639
- ])}
1640
1757
  `;
1641
- var DropdownSelectorRoot = styled14.div`
1758
+
1759
+ // src/components/DropdownSelector/index.tsx
1760
+ import { jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
1761
+ var defaultRequiredText = "*\u5FC5\u9808";
1762
+ function DropdownSelector(props) {
1763
+ const triggerRef = useRef7(null);
1764
+ const [isOpen, setIsOpen] = useState3(false);
1765
+ const preview = findPreviewRecursive(props.children, props.value);
1766
+ return /* @__PURE__ */ jsxs10(DropdownSelectorRoot, { "aria-disabled": props.disabled, children: [
1767
+ props.showLabel === true && /* @__PURE__ */ jsx19(
1768
+ DropdownFieldLabel,
1769
+ {
1770
+ label: props.label,
1771
+ required: props.required,
1772
+ requiredText: props.requiredText ?? defaultRequiredText,
1773
+ subLabel: props.subLabel
1774
+ }
1775
+ ),
1776
+ /* @__PURE__ */ jsxs10(
1777
+ DropdownButton,
1778
+ {
1779
+ invalid: props.invalid,
1780
+ disabled: props.disabled,
1781
+ onClick: () => {
1782
+ if (props.disabled === true)
1783
+ return;
1784
+ setIsOpen(true);
1785
+ },
1786
+ ref: triggerRef,
1787
+ children: [
1788
+ /* @__PURE__ */ jsx19(DropdownButtonText, { children: props.placeholder !== void 0 && preview === void 0 ? props.placeholder : preview }),
1789
+ /* @__PURE__ */ jsx19(DropdownButtonIcon, { name: "16/Menu" })
1790
+ ]
1791
+ }
1792
+ ),
1793
+ isOpen && /* @__PURE__ */ jsx19(
1794
+ DropdownPopover,
1795
+ {
1796
+ isOpen,
1797
+ onClose: () => setIsOpen(false),
1798
+ triggerRef,
1799
+ value: props.value,
1800
+ children: /* @__PURE__ */ jsx19(
1801
+ MenuList,
1802
+ {
1803
+ value: props.value,
1804
+ onChange: (v) => {
1805
+ props.onChange(v);
1806
+ setIsOpen(false);
1807
+ },
1808
+ children: props.children
1809
+ }
1810
+ )
1811
+ }
1812
+ ),
1813
+ props.assistiveText !== void 0 && /* @__PURE__ */ jsx19(AssertiveText, { invalid: props.invalid, children: props.assistiveText })
1814
+ ] });
1815
+ }
1816
+ var DropdownSelectorRoot = styled16.div`
1642
1817
  display: inline-block;
1643
1818
  width: 100%;
1644
1819
 
@@ -1647,12 +1822,12 @@ var DropdownSelectorRoot = styled14.div`
1647
1822
  ${theme((o) => o.disabled)}
1648
1823
  }
1649
1824
  `;
1650
- var DropdownFieldLabel = styled14(FieldLabel_default)`
1825
+ var DropdownFieldLabel = styled16(FieldLabel_default)`
1651
1826
  width: 100%;
1652
1827
 
1653
1828
  ${theme((o) => o.margin.bottom(8))}
1654
1829
  `;
1655
- var DropdownButton = styled14.button`
1830
+ var DropdownButton = styled16.button`
1656
1831
  display: flex;
1657
1832
  justify-content: space-between;
1658
1833
  align-items: center;
@@ -1675,15 +1850,15 @@ var DropdownButton = styled14.button`
1675
1850
  invalid === true && o.outline.assertive
1676
1851
  ])}
1677
1852
  `;
1678
- var DropdownButtonText = styled14.span`
1853
+ var DropdownButtonText = styled16.span`
1679
1854
  text-align: left;
1680
1855
 
1681
1856
  ${theme((o) => [o.typography(14), o.font.text2])}
1682
1857
  `;
1683
- var DropdownButtonIcon = styled14(Icon_default)`
1858
+ var DropdownButtonIcon = styled16(Icon_default)`
1684
1859
  ${theme((o) => [o.font.text2])}
1685
1860
  `;
1686
- var AssertiveText = styled14.div`
1861
+ var AssertiveText = styled16.div`
1687
1862
  ${({ invalid }) => theme((o) => [
1688
1863
  o.typography(14),
1689
1864
  o.margin.top(8),
@@ -1691,130 +1866,205 @@ var AssertiveText = styled14.div`
1691
1866
  ])}
1692
1867
  `;
1693
1868
 
1694
- // src/components/DropdownSelector/OptionItem.tsx
1695
- import React17, { useContext as useContext5 } from "react";
1696
- import styled15 from "styled-components";
1697
- import { px as px3 } from "@charcoal-ui/utils";
1698
-
1699
- // src/components/DropdownSelector/utils/handleFocusByKeyBoard.tsx
1700
- function handleFocusByKeyBoard(element) {
1701
- const parent = element.parentElement;
1702
- if (!parent)
1703
- return;
1704
- const rect = element.getBoundingClientRect();
1705
- const parentRect = parent.getBoundingClientRect();
1706
- if (rect.bottom > parentRect.bottom) {
1707
- parent.scrollTo({
1708
- top: parent.scrollTop + rect.bottom - parentRect.bottom
1709
- });
1710
- } else if (rect.top < parentRect.top) {
1711
- parent.scrollTo({
1712
- top: parent.scrollTop - (parentRect.top - rect.top)
1713
- });
1714
- }
1869
+ // src/components/DropdownSelector/DropdownMenuItem.tsx
1870
+ import styled18 from "styled-components";
1871
+
1872
+ // src/components/DropdownSelector/ListItem/index.tsx
1873
+ import styled17 from "styled-components";
1874
+ import { jsx as jsx20 } from "react/jsx-runtime";
1875
+ function ListItem(props) {
1876
+ const { children, ...rest } = props;
1877
+ return /* @__PURE__ */ jsx20(StyledLi, { role: "option", children: /* @__PURE__ */ jsx20(ItemDiv, { ...rest, children: props.children }) });
1715
1878
  }
1879
+ var StyledLi = styled17.li`
1880
+ list-style: none;
1881
+ `;
1882
+ var ItemDiv = styled17.div`
1883
+ display: flex;
1884
+ align-items: center;
1885
+ min-height: 40px;
1886
+ cursor: pointer;
1887
+ outline: none;
1888
+
1889
+ ${theme((o) => [o.padding.horizontal(16), o.disabled])}
1890
+
1891
+ &[aria-disabled="true"] {
1892
+ cursor: default;
1893
+ }
1894
+
1895
+ :hover,
1896
+ :focus,
1897
+ :focus-within {
1898
+ ${theme((o) => [o.bg.surface3])}
1899
+ }
1900
+ `;
1716
1901
 
1717
- // src/components/DropdownSelector/utils/focusIfHTMLLIElement.tsx
1718
- function focusIfHTMLLIElement(element) {
1719
- if (element instanceof HTMLLIElement) {
1720
- element.focus({ preventScroll: true });
1721
- handleFocusByKeyBoard(element);
1902
+ // src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx
1903
+ import { useCallback as useCallback5, useContext as useContext5 } from "react";
1904
+
1905
+ // src/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.tsx
1906
+ function handleFocusByKeyBoard(element, parent) {
1907
+ const isScrollable = parent.scrollHeight > parent.clientHeight;
1908
+ if (isScrollable) {
1909
+ const rect = element.getBoundingClientRect();
1910
+ const parentRect = parent.getBoundingClientRect();
1911
+ if (rect.bottom > parentRect.bottom) {
1912
+ parent.scrollTo({
1913
+ top: parent.scrollTop + rect.bottom - parentRect.bottom
1914
+ });
1915
+ } else if (rect.top < parentRect.top) {
1916
+ parent.scrollTo({
1917
+ top: parent.scrollTop - (parentRect.top - rect.top)
1918
+ });
1919
+ }
1920
+ } else {
1921
+ scrollIfNeeded(element);
1922
+ }
1923
+ }
1924
+ function scrollIfNeeded(element) {
1925
+ const elementRect = element.getBoundingClientRect();
1926
+ const isVisible = elementRect.top >= 0 && elementRect.bottom <= (window.innerHeight || document.documentElement.clientHeight);
1927
+ if (!isVisible) {
1928
+ element.scrollIntoView({
1929
+ block: "nearest"
1930
+ });
1722
1931
  }
1723
1932
  }
1724
1933
 
1725
- // src/components/DropdownSelector/OptionItem.tsx
1726
- function OptionItem(props) {
1727
- const { value, setValue } = useContext5(DropdownSelectorContext);
1728
- const isSelected = props.value === value;
1729
- const onSelect = () => {
1730
- setValue(props.value);
1731
- };
1732
- return /* @__PURE__ */ React17.createElement(
1733
- OptionRoot,
1734
- {
1735
- "data-key": props.value,
1736
- onMouseMove: (e) => {
1737
- e.currentTarget.focus({ preventScroll: true });
1738
- },
1739
- onKeyDown: (e) => {
1740
- if (e.key === "Enter") {
1741
- onSelect();
1742
- } else if (e.key === "ArrowUp") {
1743
- e.preventDefault();
1744
- const prev = e.currentTarget.previousElementSibling;
1745
- if (prev === null) {
1746
- focusIfHTMLLIElement(e.currentTarget.parentElement?.lastChild);
1747
- }
1748
- focusIfHTMLLIElement(prev);
1749
- } else if (e.key === "ArrowDown") {
1750
- e.preventDefault();
1751
- const next = e.currentTarget.nextElementSibling;
1752
- if (next === null) {
1753
- focusIfHTMLLIElement(e.currentTarget.parentElement?.firstChild);
1934
+ // src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx
1935
+ function useMenuItemHandleKeyDown(value) {
1936
+ const { setValue, root, values } = useContext5(MenuListContext);
1937
+ const setContextValue = useCallback5(() => {
1938
+ if (value !== void 0)
1939
+ setValue(value);
1940
+ }, [value, setValue]);
1941
+ const handleKeyDown = useCallback5(
1942
+ (e) => {
1943
+ if (e.key === "Enter") {
1944
+ setContextValue();
1945
+ } else if (e.key === "ArrowUp" || e.key === "ArrowDown") {
1946
+ e.preventDefault();
1947
+ if (!values || value === void 0)
1948
+ return;
1949
+ const index = values.indexOf(value);
1950
+ if (index === -1)
1951
+ return;
1952
+ const focusValue = e.key === "ArrowUp" ? index - 1 < 0 ? values[values.length - 1] : values[index - 1] : index + 1 >= values.length ? values[0] : values[index + 1];
1953
+ const next = root?.current?.querySelector(`[data-key='${focusValue}']`);
1954
+ if (next instanceof HTMLElement) {
1955
+ next.focus({ preventScroll: true });
1956
+ if (root?.current?.parentElement) {
1957
+ handleFocusByKeyBoard(next, root.current.parentElement);
1754
1958
  }
1755
- focusIfHTMLLIElement(next);
1756
- } else if (e.key === " ") {
1757
- e.preventDefault();
1758
1959
  }
1759
- },
1760
- onClick: onSelect,
1761
- tabIndex: -1
1960
+ }
1762
1961
  },
1763
- isSelected && /* @__PURE__ */ React17.createElement(OptionCheckIcon, { name: "16/Check" }),
1764
- /* @__PURE__ */ React17.createElement(OptionText, { isSelected }, props.children)
1962
+ [setContextValue, value, root, values]
1765
1963
  );
1964
+ return [handleKeyDown, setContextValue];
1766
1965
  }
1767
- var OptionRoot = styled15.li`
1768
- display: flex;
1769
- align-items: center;
1770
- gap: ${({ theme: theme4 }) => px3(theme4.spacing[4])};
1771
- height: 40px;
1772
- cursor: pointer;
1773
- outline: none;
1774
1966
 
1775
- ${theme((o) => [o.padding.horizontal(8)])}
1967
+ // src/components/DropdownSelector/MenuItem/index.tsx
1968
+ import { jsx as jsx21 } from "react/jsx-runtime";
1969
+ function MenuItem(props) {
1970
+ const { children, as, ...rest } = props;
1971
+ const [handleKeyDown, setContextValue] = useMenuItemHandleKeyDown(props.value);
1972
+ return /* @__PURE__ */ jsx21(
1973
+ ListItem,
1974
+ {
1975
+ ...rest,
1976
+ as,
1977
+ "data-key": props.value,
1978
+ onKeyDown: handleKeyDown,
1979
+ onClick: props.disabled === true ? void 0 : setContextValue,
1980
+ tabIndex: -1,
1981
+ "aria-disabled": props.disabled,
1982
+ children: props.children
1983
+ }
1984
+ );
1985
+ }
1776
1986
 
1777
- :focus {
1778
- ${theme((o) => [o.bg.surface3])}
1779
- }
1987
+ // src/components/DropdownSelector/DropdownMenuItem.tsx
1988
+ import { useContext as useContext6 } from "react";
1989
+ import { jsx as jsx22, jsxs as jsxs11 } from "react/jsx-runtime";
1990
+ function DropdownMenuItem(props) {
1991
+ const { value: ctxValue } = useContext6(MenuListContext);
1992
+ const isSelected = props.value === ctxValue;
1993
+ const { children, ...rest } = props;
1994
+ return /* @__PURE__ */ jsxs11(MenuItem, { ...rest, children: [
1995
+ isSelected && /* @__PURE__ */ jsx22(Text2ColorIcon, { name: "16/Check" }),
1996
+ /* @__PURE__ */ jsx22(StyledSpan, { isSelected, children: props.children })
1997
+ ] });
1998
+ }
1999
+ var StyledSpan = styled18.span`
2000
+ ${theme((o) => [o.typography(14), o.font.text2])};
2001
+ display: flex;
2002
+ align-items: center;
2003
+ width: 100%;
2004
+ margin-left: ${({ isSelected }) => isSelected === true ? 0 : 20}px;
1780
2005
  `;
1781
- var OptionCheckIcon = styled15(Icon_default)`
2006
+ var Text2ColorIcon = styled18(Icon_default)`
1782
2007
  ${theme((o) => [o.font.text2])}
2008
+ padding-right: 4px;
1783
2009
  `;
1784
- var OptionText = styled15.span`
2010
+
2011
+ // src/components/DropdownSelector/MenuItemGroup/index.tsx
2012
+ import styled19 from "styled-components";
2013
+ import { jsx as jsx23, jsxs as jsxs12 } from "react/jsx-runtime";
2014
+ function MenuItemGroup(props) {
2015
+ return /* @__PURE__ */ jsxs12(StyledLi2, { role: "presentation", children: [
2016
+ /* @__PURE__ */ jsx23(TextSpan, { children: props.text }),
2017
+ /* @__PURE__ */ jsx23(StyledUl2, { role: "group", children: props.children })
2018
+ ] });
2019
+ }
2020
+ var TextSpan = styled19.span`
2021
+ display: block;
2022
+ color: ${({ theme: theme3 }) => theme3.color.text3};
2023
+ font-size: 12px;
2024
+ font-weight: bold;
2025
+ padding: 12px 0 8px 16px;
2026
+ `;
2027
+ var StyledUl2 = styled19.ul`
2028
+ padding-left: 0;
2029
+ margin: 0;
2030
+ box-sizing: border-box;
2031
+ list-style: none;
2032
+ overflow: hidden;
2033
+ `;
2034
+ var StyledLi2 = styled19.li`
1785
2035
  display: block;
1786
- ${theme((o) => [o.typography(14), o.font.text2])}
1787
- margin-left: ${({ isSelected }) => isSelected === true ? 0 : 20}px;
1788
2036
  `;
1789
2037
 
1790
2038
  // src/components/SegmentedControl/index.tsx
1791
- import React19, { forwardRef, memo, useMemo as useMemo2, useRef as useRef7 } from "react";
2039
+ import { forwardRef as forwardRef13, memo as memo6, useMemo as useMemo2, useRef as useRef8 } from "react";
1792
2040
  import { useRadioGroupState } from "react-stately";
1793
2041
  import {
1794
2042
  useRadio,
1795
2043
  useRadioGroup
1796
2044
  } from "@react-aria/radio";
1797
- import styled16 from "styled-components";
2045
+ import styled20 from "styled-components";
1798
2046
  import { disabledSelector as disabledSelector5 } from "@charcoal-ui/utils";
1799
2047
 
1800
2048
  // src/components/SegmentedControl/RadioGroupContext.tsx
1801
- import React18, { createContext as createContext3, useContext as useContext6 } from "react";
1802
- var RadioContext = createContext3(null);
2049
+ import { createContext as createContext6, useContext as useContext7 } from "react";
2050
+ import { jsx as jsx24 } from "react/jsx-runtime";
2051
+ var RadioContext = createContext6(null);
1803
2052
  var RadioProvider = ({
1804
2053
  value,
1805
2054
  children
1806
2055
  }) => {
1807
- return /* @__PURE__ */ React18.createElement(RadioContext.Provider, { value }, children);
2056
+ return /* @__PURE__ */ jsx24(RadioContext.Provider, { value, children });
1808
2057
  };
1809
2058
  var useRadioContext = () => {
1810
- const state = useContext6(RadioContext);
2059
+ const state = useContext7(RadioContext);
1811
2060
  if (state === null)
1812
2061
  throw new Error("`<RadioProvider>` is not likely mounted.");
1813
2062
  return state;
1814
2063
  };
1815
2064
 
1816
2065
  // src/components/SegmentedControl/index.tsx
1817
- var SegmentedControl = forwardRef(
2066
+ import { jsx as jsx25, jsxs as jsxs13 } from "react/jsx-runtime";
2067
+ var SegmentedControl = forwardRef13(
1818
2068
  function SegmentedControlInner(props, ref) {
1819
2069
  const ariaRadioGroupProps = useMemo2(
1820
2070
  () => ({
@@ -1833,23 +2083,35 @@ var SegmentedControl = forwardRef(
1833
2083
  (d) => typeof d === "string" ? { value: d, label: d } : d
1834
2084
  );
1835
2085
  }, [props.data]);
1836
- return /* @__PURE__ */ React19.createElement(SegmentedControlRoot, { ref, ...radioGroupProps }, /* @__PURE__ */ React19.createElement(RadioProvider, { value: state }, segmentedControlItems.map((item) => /* @__PURE__ */ React19.createElement(
1837
- Segmented,
2086
+ return /* @__PURE__ */ jsx25(
2087
+ SegmentedControlRoot,
1838
2088
  {
1839
- key: item.value,
1840
- value: item.value,
1841
- disabled: item.disabled
1842
- },
1843
- item.label
1844
- ))));
2089
+ ref,
2090
+ ...radioGroupProps,
2091
+ className: props.className,
2092
+ children: /* @__PURE__ */ jsx25(RadioProvider, { value: state, children: segmentedControlItems.map((item) => /* @__PURE__ */ jsx25(
2093
+ Segmented,
2094
+ {
2095
+ value: item.value,
2096
+ disabled: item.disabled,
2097
+ children: item.label
2098
+ },
2099
+ item.value
2100
+ )) })
2101
+ }
2102
+ );
1845
2103
  }
1846
2104
  );
1847
- var SegmentedControl_default = memo(SegmentedControl);
1848
- var Segmented = ({ children, ...props }) => {
2105
+ var SegmentedControl_default = memo6(SegmentedControl);
2106
+ var Segmented = (props) => {
1849
2107
  const state = useRadioContext();
1850
- const ref = useRef7(null);
2108
+ const ref = useRef8(null);
1851
2109
  const ariaRadioProps = useMemo2(
1852
- () => ({ ...props, isDisabled: props.disabled }),
2110
+ () => ({
2111
+ value: props.value,
2112
+ isDisabled: props.disabled,
2113
+ children: props.children
2114
+ }),
1853
2115
  [props]
1854
2116
  );
1855
2117
  const { inputProps, isDisabled, isSelected } = useRadio(
@@ -1857,23 +2119,25 @@ var Segmented = ({ children, ...props }) => {
1857
2119
  state,
1858
2120
  ref
1859
2121
  );
1860
- return /* @__PURE__ */ React19.createElement(
2122
+ return /* @__PURE__ */ jsxs13(
1861
2123
  SegmentedRoot,
1862
2124
  {
1863
2125
  "aria-disabled": isDisabled || state.isReadOnly,
1864
- checked: isSelected
1865
- },
1866
- /* @__PURE__ */ React19.createElement(SegmentedInput, { ...inputProps, ref }),
1867
- /* @__PURE__ */ React19.createElement(RadioLabel2, null, /* @__PURE__ */ React19.createElement(SegmentedLabelInner, null, children))
2126
+ checked: isSelected,
2127
+ children: [
2128
+ /* @__PURE__ */ jsx25(SegmentedInput, { ...inputProps, ref }),
2129
+ /* @__PURE__ */ jsx25(RadioLabel2, { children: /* @__PURE__ */ jsx25(SegmentedLabelInner, { children: props.children }) })
2130
+ ]
2131
+ }
1868
2132
  );
1869
2133
  };
1870
- var SegmentedControlRoot = styled16.div`
2134
+ var SegmentedControlRoot = styled20.div`
1871
2135
  display: inline-flex;
1872
2136
  align-items: center;
1873
2137
 
1874
2138
  ${theme((o) => [o.bg.surface3, o.borderRadius(16)])}
1875
2139
  `;
1876
- var SegmentedRoot = styled16.label`
2140
+ var SegmentedRoot = styled20.label`
1877
2141
  position: relative;
1878
2142
  display: flex;
1879
2143
  align-items: center;
@@ -1892,7 +2156,7 @@ var SegmentedRoot = styled16.label`
1892
2156
  checked === true ? o.font.text5 : o.font.text2
1893
2157
  ])}
1894
2158
  `;
1895
- var SegmentedInput = styled16.input`
2159
+ var SegmentedInput = styled20.input`
1896
2160
  position: absolute;
1897
2161
 
1898
2162
  height: 0px;
@@ -1906,24 +2170,25 @@ var SegmentedInput = styled16.input`
1906
2170
  white-space: nowrap;
1907
2171
  opacity: 0;
1908
2172
  `;
1909
- var RadioLabel2 = styled16.div`
2173
+ var RadioLabel2 = styled20.div`
1910
2174
  background: transparent;
1911
2175
  display: flex;
1912
2176
  align-items: center;
1913
2177
  height: 22px;
1914
2178
  `;
1915
- var SegmentedLabelInner = styled16.div`
2179
+ var SegmentedLabelInner = styled20.div`
1916
2180
  ${theme((o) => [o.typography(14)])}
1917
2181
  `;
1918
2182
 
1919
2183
  // src/components/Checkbox/index.tsx
1920
- import React20, { forwardRef as forwardRef2, memo as memo2, useMemo as useMemo3 } from "react";
1921
- import styled17, { css as css5 } from "styled-components";
2184
+ import { forwardRef as forwardRef14, memo as memo7, useMemo as useMemo3 } from "react";
2185
+ import styled21, { css as css5 } from "styled-components";
1922
2186
  import { useCheckbox } from "@react-aria/checkbox";
1923
- import { useObjectRef } from "@react-aria/utils";
2187
+ import { useObjectRef as useObjectRef3 } from "@react-aria/utils";
1924
2188
  import { useToggleState as useToggleState2 } from "react-stately";
1925
- import { disabledSelector as disabledSelector6, px as px4 } from "@charcoal-ui/utils";
1926
- var Checkbox = forwardRef2(
2189
+ import { disabledSelector as disabledSelector6, px as px3 } from "@charcoal-ui/utils";
2190
+ import { jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
2191
+ var Checkbox = forwardRef14(
1927
2192
  function CheckboxInner(props, ref) {
1928
2193
  const ariaCheckboxProps = useMemo3(
1929
2194
  () => ({
@@ -1936,17 +2201,23 @@ var Checkbox = forwardRef2(
1936
2201
  [props]
1937
2202
  );
1938
2203
  const state = useToggleState2(ariaCheckboxProps);
1939
- const objectRef = useObjectRef(ref);
2204
+ const objectRef = useObjectRef3(ref);
1940
2205
  const { inputProps } = useCheckbox(ariaCheckboxProps, state, objectRef);
1941
2206
  const isDisabled = (props.disabled ?? false) || (props.readonly ?? false);
1942
- return /* @__PURE__ */ React20.createElement(InputRoot, { "aria-disabled": isDisabled }, /* @__PURE__ */ React20.createElement(CheckboxRoot, null, /* @__PURE__ */ React20.createElement(CheckboxInput, { type: "checkbox", ...inputProps }), /* @__PURE__ */ React20.createElement(CheckboxInputOverlay, { "aria-hidden": true, checked: inputProps.checked }, /* @__PURE__ */ React20.createElement(Icon_default, { name: "24/Check", unsafeNonGuidelineScale: 2 / 3 }))), "children" in props && /* @__PURE__ */ React20.createElement(InputLabel, null, props.children));
2207
+ return /* @__PURE__ */ jsxs14(InputRoot, { "aria-disabled": isDisabled, className: props.className, children: [
2208
+ /* @__PURE__ */ jsxs14(CheckboxRoot, { children: [
2209
+ /* @__PURE__ */ jsx26(CheckboxInput, { type: "checkbox", ...inputProps }),
2210
+ /* @__PURE__ */ jsx26(CheckboxInputOverlay, { "aria-hidden": true, checked: inputProps.checked, children: /* @__PURE__ */ jsx26(Icon_default, { name: "24/Check", unsafeNonGuidelineScale: 2 / 3 }) })
2211
+ ] }),
2212
+ "children" in props && /* @__PURE__ */ jsx26(InputLabel, { children: props.children })
2213
+ ] });
1943
2214
  }
1944
2215
  );
1945
- var Checkbox_default = memo2(Checkbox);
2216
+ var Checkbox_default = memo7(Checkbox);
1946
2217
  var hiddenCss = css5`
1947
2218
  visibility: hidden;
1948
2219
  `;
1949
- var InputRoot = styled17.label`
2220
+ var InputRoot = styled21.label`
1950
2221
  position: relative;
1951
2222
  display: flex;
1952
2223
 
@@ -1955,13 +2226,13 @@ var InputRoot = styled17.label`
1955
2226
  cursor: default;
1956
2227
  }
1957
2228
 
1958
- gap: ${({ theme: theme4 }) => px4(theme4.spacing[4])};
2229
+ gap: ${({ theme: theme3 }) => px3(theme3.spacing[4])};
1959
2230
  ${theme((o) => [o.disabled])}
1960
2231
  `;
1961
- var CheckboxRoot = styled17.div`
2232
+ var CheckboxRoot = styled21.div`
1962
2233
  position: relative;
1963
2234
  `;
1964
- var CheckboxInput = styled17.input`
2235
+ var CheckboxInput = styled21.input`
1965
2236
  &[type='checkbox'] {
1966
2237
  appearance: none;
1967
2238
  display: block;
@@ -1976,7 +2247,7 @@ var CheckboxInput = styled17.input`
1976
2247
  &:not(:checked) {
1977
2248
  border-width: 2px;
1978
2249
  border-style: solid;
1979
- border-color: ${({ theme: theme4 }) => theme4.color.text4};
2250
+ border-color: ${({ theme: theme3 }) => theme3.color.text4};
1980
2251
  }
1981
2252
  ${theme((o) => [o.outline.default.focus, o.borderRadius(4)])}
1982
2253
 
@@ -1984,7 +2255,7 @@ var CheckboxInput = styled17.input`
1984
2255
  transition: all 0.2s !important;
1985
2256
  }
1986
2257
  `;
1987
- var CheckboxInputOverlay = styled17.div`
2258
+ var CheckboxInputOverlay = styled21.div`
1988
2259
  position: absolute;
1989
2260
  top: -2px;
1990
2261
  left: -2px;
@@ -1997,7 +2268,7 @@ var CheckboxInputOverlay = styled17.div`
1997
2268
 
1998
2269
  ${({ checked }) => checked !== true && hiddenCss};
1999
2270
  `;
2000
- var InputLabel = styled17.div`
2271
+ var InputLabel = styled21.div`
2001
2272
  ${theme((o) => [o.font.text2])}
2002
2273
 
2003
2274
  font-size: 14px;
@@ -2006,20 +2277,17 @@ var InputLabel = styled17.div`
2006
2277
  `;
2007
2278
 
2008
2279
  // src/components/TagItem/index.tsx
2009
- import React21, {
2010
- forwardRef as forwardRef3,
2011
- memo as memo3,
2012
- useMemo as useMemo4
2013
- } from "react";
2014
- import { useObjectRef as useObjectRef2 } from "@react-aria/utils";
2015
- import styled18, { css as css6 } from "styled-components";
2016
- import { disabledSelector as disabledSelector7, px as px5 } from "@charcoal-ui/utils";
2280
+ import { forwardRef as forwardRef15, memo as memo8, useMemo as useMemo4 } from "react";
2281
+ import { useObjectRef as useObjectRef4 } from "@react-aria/utils";
2282
+ import styled22, { css as css6 } from "styled-components";
2283
+ import { disabledSelector as disabledSelector7, px as px4 } from "@charcoal-ui/utils";
2017
2284
  import { useButton } from "@react-aria/button";
2285
+ import { jsx as jsx27, jsxs as jsxs15 } from "react/jsx-runtime";
2018
2286
  var sizeMap = {
2019
2287
  S: 32,
2020
2288
  M: 40
2021
2289
  };
2022
- var TagItem = forwardRef3(
2290
+ var TagItem = forwardRef15(
2023
2291
  function TagItemInner({
2024
2292
  label,
2025
2293
  translatedLabel,
@@ -2031,7 +2299,7 @@ var TagItem = forwardRef3(
2031
2299
  className,
2032
2300
  ...props
2033
2301
  }, _ref) {
2034
- const ref = useObjectRef2(_ref);
2302
+ const ref = useObjectRef4(_ref);
2035
2303
  const ariaButtonProps = useMemo4(
2036
2304
  () => ({
2037
2305
  elementType: "a",
@@ -2042,22 +2310,30 @@ var TagItem = forwardRef3(
2042
2310
  );
2043
2311
  const { buttonProps } = useButton(ariaButtonProps, ref);
2044
2312
  const hasTranslatedLabel = translatedLabel !== void 0 && translatedLabel.length > 0;
2045
- return /* @__PURE__ */ React21.createElement(
2313
+ return /* @__PURE__ */ jsxs15(
2046
2314
  TagItemRoot,
2047
2315
  {
2048
2316
  ref,
2049
2317
  size: hasTranslatedLabel ? "M" : size,
2050
2318
  status,
2051
2319
  ...buttonProps,
2052
- className
2053
- },
2054
- /* @__PURE__ */ React21.createElement(Background, { bgColor, bgImage, status }),
2055
- /* @__PURE__ */ React21.createElement(Inner, null, /* @__PURE__ */ React21.createElement(LabelWrapper, { isTranslate: hasTranslatedLabel }, hasTranslatedLabel && /* @__PURE__ */ React21.createElement(TranslatedLabel, null, /* @__PURE__ */ React21.createElement(Label3, null, translatedLabel)), /* @__PURE__ */ React21.createElement(Label3, null, label)), status === "active" && /* @__PURE__ */ React21.createElement(Icon_default, { name: "16/Remove" }))
2320
+ className,
2321
+ children: [
2322
+ /* @__PURE__ */ jsx27(Background, { bgColor, bgImage, status }),
2323
+ /* @__PURE__ */ jsxs15(Inner, { children: [
2324
+ /* @__PURE__ */ jsxs15(LabelWrapper, { isTranslate: hasTranslatedLabel, children: [
2325
+ hasTranslatedLabel && /* @__PURE__ */ jsx27(TranslatedLabel, { children: /* @__PURE__ */ jsx27(Label3, { children: translatedLabel }) }),
2326
+ /* @__PURE__ */ jsx27(Label3, { children: label })
2327
+ ] }),
2328
+ status === "active" && /* @__PURE__ */ jsx27(Icon_default, { name: "16/Remove" })
2329
+ ] })
2330
+ ]
2331
+ }
2056
2332
  );
2057
2333
  }
2058
2334
  );
2059
- var TagItem_default = memo3(TagItem);
2060
- var TagItemRoot = styled18.a`
2335
+ var TagItem_default = memo8(TagItem);
2336
+ var TagItemRoot = styled22.a`
2061
2337
  isolation: isolate;
2062
2338
  position: relative;
2063
2339
  height: ${({ size }) => sizeMap[size]}px;
@@ -2082,7 +2358,7 @@ var TagItemRoot = styled18.a`
2082
2358
  cursor: default;
2083
2359
  }
2084
2360
  `;
2085
- var Background = styled18.div`
2361
+ var Background = styled22.div`
2086
2362
  position: absolute;
2087
2363
  z-index: 1;
2088
2364
  top: 0;
@@ -2109,9 +2385,9 @@ var Background = styled18.div`
2109
2385
  }
2110
2386
  `}
2111
2387
  `;
2112
- var Inner = styled18.div`
2388
+ var Inner = styled22.div`
2113
2389
  display: inline-flex;
2114
- gap: ${({ theme: theme4 }) => px5(theme4.spacing[8])};
2390
+ gap: ${({ theme: theme3 }) => px4(theme3.spacing[8])};
2115
2391
  align-items: center;
2116
2392
  z-index: 2;
2117
2393
  `;
@@ -2124,10 +2400,10 @@ var translateLabelCSS = css6`
2124
2400
  flex-direction: column;
2125
2401
  font-size: 10px;
2126
2402
  `;
2127
- var LabelWrapper = styled18.div`
2403
+ var LabelWrapper = styled22.div`
2128
2404
  ${({ isTranslate }) => isTranslate ?? false ? translateLabelCSS : labelCSS}
2129
2405
  `;
2130
- var Label3 = styled18.span`
2406
+ var Label3 = styled22.span`
2131
2407
  max-width: 152px;
2132
2408
  overflow: hidden;
2133
2409
  text-overflow: ellipsis;
@@ -2136,7 +2412,7 @@ var Label3 = styled18.span`
2136
2412
  color: inherit;
2137
2413
  line-height: inherit;
2138
2414
  `;
2139
- var TranslatedLabel = styled18.div`
2415
+ var TranslatedLabel = styled22.div`
2140
2416
  ${theme((o) => [o.typography(12).bold])}
2141
2417
  `;
2142
2418
  export {
@@ -2145,26 +2421,28 @@ export {
2145
2421
  Checkbox_default as Checkbox,
2146
2422
  Clickable_default as Clickable,
2147
2423
  ComponentAbstraction,
2424
+ DropdownMenuItem,
2148
2425
  DropdownSelector,
2149
2426
  Icon_default as Icon,
2150
2427
  IconButton_default as IconButton,
2151
- LoadingSpinner,
2428
+ LoadingSpinner_default as LoadingSpinner,
2152
2429
  LoadingSpinnerIcon,
2153
- Modal,
2430
+ MenuItemGroup,
2431
+ Modal_default as Modal,
2154
2432
  ModalAlign,
2155
2433
  ModalBody,
2156
2434
  ModalButtons,
2157
2435
  ModalHeader,
2158
- MultiSelect,
2436
+ MultiSelect_default as MultiSelect,
2159
2437
  MultiSelectGroup,
2160
- OptionItem,
2161
2438
  OverlayProvider,
2162
- Radio,
2439
+ Radio_default as Radio,
2163
2440
  RadioGroup,
2164
2441
  SSRProvider,
2165
2442
  SegmentedControl_default as SegmentedControl,
2166
- SwitchCheckbox as Switch,
2443
+ Switch_default as Switch,
2167
2444
  TagItem_default as TagItem,
2445
+ TextArea_default as TextArea,
2168
2446
  TextField_default as TextField,
2169
2447
  useComponentAbstraction
2170
2448
  };