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

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 (174) hide show
  1. package/dist/_lib/compat.d.ts +1 -1
  2. package/dist/_lib/compat.d.ts.map +1 -1
  3. package/dist/components/Button/index.d.ts +1 -2
  4. package/dist/components/Button/index.d.ts.map +1 -1
  5. package/dist/components/Button/index.story.d.ts +1 -2
  6. package/dist/components/Button/index.story.d.ts.map +1 -1
  7. package/dist/components/Button/index.test.d.ts +4 -0
  8. package/dist/components/Button/index.test.d.ts.map +1 -0
  9. package/dist/components/Checkbox/index.d.ts +1 -1
  10. package/dist/components/Checkbox/index.d.ts.map +1 -1
  11. package/dist/components/Checkbox/index.story.d.ts +1 -2
  12. package/dist/components/Checkbox/index.story.d.ts.map +1 -1
  13. package/dist/components/Clickable/index.d.ts +1 -1
  14. package/dist/components/Clickable/index.d.ts.map +1 -1
  15. package/dist/components/Clickable/index.story.d.ts +1 -2
  16. package/dist/components/Clickable/index.story.d.ts.map +1 -1
  17. package/dist/components/DropdownSelector/Divider.d.ts +3 -0
  18. package/dist/components/DropdownSelector/Divider.d.ts.map +1 -1
  19. package/dist/components/DropdownSelector/DropdownMenuItem.d.ts +7 -0
  20. package/dist/components/DropdownSelector/DropdownMenuItem.d.ts.map +1 -0
  21. package/dist/components/DropdownSelector/DropdownPopover.d.ts +8 -8
  22. package/dist/components/DropdownSelector/DropdownPopover.d.ts.map +1 -1
  23. package/dist/components/DropdownSelector/ListItem/index.d.ts +18 -0
  24. package/dist/components/DropdownSelector/ListItem/index.d.ts.map +1 -0
  25. package/dist/components/DropdownSelector/ListItem/index.story.d.ts +9 -0
  26. package/dist/components/DropdownSelector/ListItem/index.story.d.ts.map +1 -0
  27. package/dist/components/DropdownSelector/MenuItem/index.d.ts +11 -0
  28. package/dist/components/DropdownSelector/MenuItem/index.d.ts.map +1 -0
  29. package/dist/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.d.ts +9 -0
  30. package/dist/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.d.ts.map +1 -0
  31. package/dist/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.d.ts +10 -0
  32. package/dist/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.d.ts.map +1 -0
  33. package/dist/components/DropdownSelector/MenuItemGroup/index.d.ts +14 -0
  34. package/dist/components/DropdownSelector/MenuItemGroup/index.d.ts.map +1 -0
  35. package/dist/components/DropdownSelector/MenuList/MenuListContext.d.ts +10 -0
  36. package/dist/components/DropdownSelector/MenuList/MenuListContext.d.ts.map +1 -0
  37. package/dist/components/DropdownSelector/MenuList/index.d.ts +18 -0
  38. package/dist/components/DropdownSelector/MenuList/index.d.ts.map +1 -0
  39. package/dist/components/DropdownSelector/MenuList/index.story.d.ts +11 -0
  40. package/dist/components/DropdownSelector/MenuList/index.story.d.ts.map +1 -0
  41. package/dist/components/DropdownSelector/MenuList/internals/getValuesRecursive.d.ts +11 -0
  42. package/dist/components/DropdownSelector/MenuList/internals/getValuesRecursive.d.ts.map +1 -0
  43. package/dist/components/DropdownSelector/Popover/index.d.ts +17 -0
  44. package/dist/components/DropdownSelector/Popover/index.d.ts.map +1 -0
  45. package/dist/components/DropdownSelector/Popover/index.story.d.ts +9 -0
  46. package/dist/components/DropdownSelector/Popover/index.story.d.ts.map +1 -0
  47. package/dist/components/DropdownSelector/index.d.ts +3 -10
  48. package/dist/components/DropdownSelector/index.d.ts.map +1 -1
  49. package/dist/components/DropdownSelector/index.story.d.ts +4 -4
  50. package/dist/components/DropdownSelector/index.story.d.ts.map +1 -1
  51. package/dist/components/DropdownSelector/utils/findPreviewRecursive.d.ts +12 -0
  52. package/dist/components/DropdownSelector/utils/findPreviewRecursive.d.ts.map +1 -0
  53. package/dist/components/FieldLabel/index.d.ts +1 -1
  54. package/dist/components/FieldLabel/index.d.ts.map +1 -1
  55. package/dist/components/Icon/index.d.ts +1 -1
  56. package/dist/components/Icon/index.d.ts.map +1 -1
  57. package/dist/components/Icon/index.story.d.ts +2 -3
  58. package/dist/components/Icon/index.story.d.ts.map +1 -1
  59. package/dist/components/IconButton/index.d.ts +1 -2
  60. package/dist/components/IconButton/index.d.ts.map +1 -1
  61. package/dist/components/IconButton/index.story.d.ts +1 -2
  62. package/dist/components/IconButton/index.story.d.ts.map +1 -1
  63. package/dist/components/LoadingSpinner/index.d.ts +1 -2
  64. package/dist/components/LoadingSpinner/index.d.ts.map +1 -1
  65. package/dist/components/Modal/ModalPlumbing.d.ts.map +1 -1
  66. package/dist/components/Modal/index.d.ts +1 -1
  67. package/dist/components/Modal/index.d.ts.map +1 -1
  68. package/dist/components/Modal/index.story.d.ts.map +1 -1
  69. package/dist/components/MultiSelect/context.d.ts +1 -1
  70. package/dist/components/MultiSelect/context.d.ts.map +1 -1
  71. package/dist/components/MultiSelect/index.d.ts +5 -6
  72. package/dist/components/MultiSelect/index.d.ts.map +1 -1
  73. package/dist/components/MultiSelect/index.story.d.ts +7 -14
  74. package/dist/components/MultiSelect/index.story.d.ts.map +1 -1
  75. package/dist/components/Radio/index.d.ts +1 -1
  76. package/dist/components/Radio/index.d.ts.map +1 -1
  77. package/dist/components/Radio/index.story.d.ts +1 -2
  78. package/dist/components/Radio/index.story.d.ts.map +1 -1
  79. package/dist/components/SegmentedControl/RadioGroupContext.d.ts +1 -1
  80. package/dist/components/SegmentedControl/RadioGroupContext.d.ts.map +1 -1
  81. package/dist/components/SegmentedControl/index.d.ts +1 -1
  82. package/dist/components/SegmentedControl/index.d.ts.map +1 -1
  83. package/dist/components/SegmentedControl/index.story.d.ts +1 -2
  84. package/dist/components/SegmentedControl/index.story.d.ts.map +1 -1
  85. package/dist/components/Switch/index.d.ts +1 -1
  86. package/dist/components/Switch/index.d.ts.map +1 -1
  87. package/dist/components/TagItem/index.d.ts +3 -3
  88. package/dist/components/TagItem/index.d.ts.map +1 -1
  89. package/dist/components/TagItem/index.story.d.ts +2 -3
  90. package/dist/components/TagItem/index.story.d.ts.map +1 -1
  91. package/dist/components/TextArea/TextArea.story.d.ts +28 -0
  92. package/dist/components/TextArea/TextArea.story.d.ts.map +1 -0
  93. package/dist/components/TextArea/index.d.ts +28 -0
  94. package/dist/components/TextArea/index.d.ts.map +1 -0
  95. package/dist/components/TextField/TextField.story.d.ts +29 -0
  96. package/dist/components/TextField/TextField.story.d.ts.map +1 -0
  97. package/dist/components/TextField/index.d.ts +2 -1
  98. package/dist/components/TextField/index.d.ts.map +1 -1
  99. package/dist/components/TextField/index.story.d.ts +4 -5
  100. package/dist/components/TextField/index.story.d.ts.map +1 -1
  101. package/dist/core/CharcoalProvider.d.ts +1 -1
  102. package/dist/core/CharcoalProvider.d.ts.map +1 -1
  103. package/dist/core/ComponentAbstraction.d.ts +1 -1
  104. package/dist/core/ComponentAbstraction.d.ts.map +1 -1
  105. package/dist/index.cjs.js +744 -493
  106. package/dist/index.cjs.js.map +1 -1
  107. package/dist/index.d.ts +3 -2
  108. package/dist/index.d.ts.map +1 -1
  109. package/dist/index.esm.js +689 -452
  110. package/dist/index.esm.js.map +1 -1
  111. package/dist/styled.d.ts +13 -13
  112. package/dist/types/CustomJSXElement.d.ts +3 -0
  113. package/dist/types/CustomJSXElement.d.ts.map +1 -0
  114. package/package.json +7 -7
  115. package/src/_lib/compat.ts +1 -1
  116. package/src/components/Button/__snapshots__/index.test.tsx.snap +385 -0
  117. package/src/components/Button/index.story.tsx +1 -1
  118. package/src/components/Button/index.test.tsx +24 -0
  119. package/src/components/Button/index.tsx +2 -2
  120. package/src/components/Checkbox/index.story.tsx +0 -1
  121. package/src/components/Checkbox/index.tsx +2 -1
  122. package/src/components/Clickable/index.story.tsx +0 -1
  123. package/src/components/Clickable/index.tsx +1 -1
  124. package/src/components/DropdownSelector/Divider.tsx +3 -0
  125. package/src/components/DropdownSelector/DropdownMenuItem.tsx +40 -0
  126. package/src/components/DropdownSelector/DropdownPopover.tsx +21 -42
  127. package/src/components/DropdownSelector/ListItem/index.story.tsx +51 -0
  128. package/src/components/DropdownSelector/ListItem/index.tsx +58 -0
  129. package/src/components/DropdownSelector/MenuItem/index.tsx +32 -0
  130. package/src/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.tsx +43 -0
  131. package/src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx +55 -0
  132. package/src/components/DropdownSelector/MenuItemGroup/index.tsx +43 -0
  133. package/src/components/DropdownSelector/MenuList/MenuListContext.ts +17 -0
  134. package/src/components/DropdownSelector/MenuList/index.story.tsx +52 -0
  135. package/src/components/DropdownSelector/MenuList/index.tsx +51 -0
  136. package/src/components/DropdownSelector/MenuList/internals/getValuesRecursive.tsx +35 -0
  137. package/src/components/DropdownSelector/Popover/index.story.tsx +65 -0
  138. package/src/components/DropdownSelector/Popover/index.tsx +69 -0
  139. package/src/components/DropdownSelector/index.story.tsx +56 -21
  140. package/src/components/DropdownSelector/index.tsx +21 -64
  141. package/src/components/DropdownSelector/utils/findPreviewRecursive.tsx +38 -0
  142. package/src/components/FieldLabel/index.tsx +1 -1
  143. package/src/components/Icon/index.story.tsx +0 -1
  144. package/src/components/Icon/index.tsx +1 -1
  145. package/src/components/IconButton/index.story.tsx +0 -1
  146. package/src/components/IconButton/index.tsx +2 -2
  147. package/src/components/LoadingSpinner/index.story.tsx +1 -1
  148. package/src/components/LoadingSpinner/index.tsx +18 -19
  149. package/src/components/Modal/ModalPlumbing.tsx +0 -1
  150. package/src/components/Modal/index.story.tsx +0 -1
  151. package/src/components/Modal/index.tsx +2 -1
  152. package/src/components/MultiSelect/context.ts +2 -2
  153. package/src/components/MultiSelect/index.story.tsx +16 -29
  154. package/src/components/MultiSelect/index.test.tsx +5 -23
  155. package/src/components/MultiSelect/index.tsx +19 -24
  156. package/src/components/Radio/index.story.tsx +0 -1
  157. package/src/components/Radio/index.test.tsx +0 -1
  158. package/src/components/Radio/index.tsx +2 -1
  159. package/src/components/SegmentedControl/RadioGroupContext.tsx +2 -1
  160. package/src/components/SegmentedControl/index.story.tsx +0 -1
  161. package/src/components/SegmentedControl/index.tsx +10 -4
  162. package/src/components/Switch/index.story.tsx +1 -1
  163. package/src/components/Switch/index.tsx +2 -1
  164. package/src/components/TagItem/index.story.tsx +0 -1
  165. package/src/components/TagItem/index.tsx +1 -6
  166. package/src/components/TextField/index.story.tsx +0 -1
  167. package/src/components/TextField/index.tsx +2 -7
  168. package/src/components/a11y.test.tsx +0 -1
  169. package/src/core/CharcoalProvider.tsx +1 -1
  170. package/src/core/ComponentAbstraction.tsx +2 -1
  171. package/src/index.ts +7 -4
  172. package/src/components/DropdownSelector/OptionItem.tsx +0 -85
  173. package/src/components/DropdownSelector/utils/focusIfHTMLLIElement.tsx +0 -12
  174. 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
@@ -59,15 +64,16 @@ import { createTheme } from "@charcoal-ui/styled";
59
64
  var theme = createTheme(styled);
60
65
 
61
66
  // src/components/Clickable/index.tsx
62
- import React3 from "react";
67
+ import * as React2 from "react";
63
68
  import styled2, { css } from "styled-components";
64
69
  import { disabledSelector } from "@charcoal-ui/utils";
65
- var Clickable = React3.forwardRef(
70
+ import { jsx as jsx3 } from "react/jsx-runtime";
71
+ var Clickable = React2.forwardRef(
66
72
  function Clickable2(props, ref) {
67
73
  const { Link } = useComponentAbstraction();
68
74
  if ("to" in props) {
69
75
  const { onClick, disabled = false, ...rest } = props;
70
- return /* @__PURE__ */ React3.createElement(
76
+ return /* @__PURE__ */ jsx3(
71
77
  A,
72
78
  {
73
79
  ...rest,
@@ -78,7 +84,7 @@ var Clickable = React3.forwardRef(
78
84
  }
79
85
  );
80
86
  } else {
81
- return /* @__PURE__ */ React3.createElement(Button, { ...props, ref });
87
+ return /* @__PURE__ */ jsx3(Button, { ...props, ref });
82
88
  }
83
89
  }
84
90
  );
@@ -143,7 +149,8 @@ var A = styled2.span`
143
149
  `;
144
150
 
145
151
  // src/components/Button/index.tsx
146
- var Button2 = React4.forwardRef(function Button3({
152
+ import { jsx as jsx4 } from "react/jsx-runtime";
153
+ var Button2 = forwardRef3(function Button3({
147
154
  children,
148
155
  variant = "Default",
149
156
  size = "M",
@@ -151,7 +158,7 @@ var Button2 = React4.forwardRef(function Button3({
151
158
  disabled = false,
152
159
  ...rest
153
160
  }, ref) {
154
- return /* @__PURE__ */ React4.createElement(
161
+ return /* @__PURE__ */ jsx4(
155
162
  StyledButton,
156
163
  {
157
164
  ...rest,
@@ -159,9 +166,9 @@ var Button2 = React4.forwardRef(function Button3({
159
166
  variant,
160
167
  size,
161
168
  fullWidth: fixed,
162
- ref
163
- },
164
- children
169
+ ref,
170
+ children
171
+ }
165
172
  );
166
173
  });
167
174
  var Button_default = Button2;
@@ -230,12 +237,13 @@ function sizeToProps(size) {
230
237
  }
231
238
 
232
239
  // src/components/IconButton/index.tsx
233
- import React5 from "react";
240
+ import { forwardRef as forwardRef4 } from "react";
234
241
  import styled4 from "styled-components";
235
- var IconButton = React5.forwardRef(
242
+ import { jsx as jsx5 } from "react/jsx-runtime";
243
+ var IconButton = forwardRef4(
236
244
  function IconButtonInner({ variant = "Default", size = "M", icon, ...rest }, ref) {
237
245
  validateIconSize(size, icon);
238
- return /* @__PURE__ */ React5.createElement(StyledIconButton, { ...rest, ref, variant, size }, /* @__PURE__ */ React5.createElement("pixiv-icon", { name: icon }));
246
+ return /* @__PURE__ */ jsx5(StyledIconButton, { ...rest, ref, variant, size, children: /* @__PURE__ */ jsx5("pixiv-icon", { name: icon }) });
239
247
  }
240
248
  );
241
249
  var IconButton_default = IconButton;
@@ -314,10 +322,12 @@ function validateIconSize(size, icon) {
314
322
  }
315
323
 
316
324
  // src/components/Radio/index.tsx
317
- import React6, { useCallback, useContext as useContext2 } from "react";
325
+ import { useCallback, useContext as useContext2 } from "react";
326
+ import * as React3 from "react";
318
327
  import styled5 from "styled-components";
319
328
  import warning from "warning";
320
329
  import { px } from "@charcoal-ui/utils";
330
+ import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
321
331
  function Radio({
322
332
  value,
323
333
  forceChecked = false,
@@ -345,17 +355,20 @@ function Radio({
345
355
  },
346
356
  [onChange]
347
357
  );
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));
358
+ return /* @__PURE__ */ jsxs2(RadioRoot, { "aria-disabled": isDisabled || isReadonly, children: [
359
+ /* @__PURE__ */ jsx6(
360
+ RadioInput,
361
+ {
362
+ name,
363
+ value,
364
+ checked: forceChecked || isSelected,
365
+ hasError,
366
+ onChange: handleChange,
367
+ disabled: isDisabled || isReadonly
368
+ }
369
+ ),
370
+ children != null && /* @__PURE__ */ jsx6(RadioLabel, { children })
371
+ ] });
359
372
  }
360
373
  var RadioRoot = styled5.label`
361
374
  display: grid;
@@ -421,7 +434,7 @@ var StyledRadioGroup = styled5.div`
421
434
  grid-template-columns: 1fr;
422
435
  grid-gap: ${({ theme: theme4 }) => px(theme4.spacing[8])};
423
436
  `;
424
- var RadioGroupContext = React6.createContext({
437
+ var RadioGroupContext = React3.createContext({
425
438
  name: void 0,
426
439
  selected: void 0,
427
440
  disabled: false,
@@ -450,7 +463,7 @@ function RadioGroup({
450
463
  },
451
464
  [onChange]
452
465
  );
453
- return /* @__PURE__ */ React6.createElement(
466
+ return /* @__PURE__ */ jsx6(
454
467
  RadioGroupContext.Provider,
455
468
  {
456
469
  value: {
@@ -460,36 +473,36 @@ function RadioGroup({
460
473
  readonly: readonly ?? false,
461
474
  hasError: hasError ?? false,
462
475
  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
476
  },
474
- children
475
- )
477
+ children: /* @__PURE__ */ jsx6(
478
+ StyledRadioGroup,
479
+ {
480
+ role: "radiogroup",
481
+ "aria-orientation": "vertical",
482
+ "aria-label": label,
483
+ "aria-invalid": hasError,
484
+ className,
485
+ children
486
+ }
487
+ )
488
+ }
476
489
  );
477
490
  }
478
491
 
479
492
  // src/components/MultiSelect/index.tsx
480
- import React7, { useCallback as useCallback2, useContext as useContext3 } from "react";
493
+ import { useCallback as useCallback2, useContext as useContext3 } from "react";
481
494
  import styled6, { css as css2 } from "styled-components";
482
495
  import warning2 from "warning";
483
496
  import { disabledSelector as disabledSelector2, px as px2 } from "@charcoal-ui/utils";
484
497
 
485
498
  // src/components/MultiSelect/context.ts
486
- import { createContext } from "react";
487
- var MultiSelectGroupContext = createContext({
499
+ import { createContext as createContext3 } from "react";
500
+ var MultiSelectGroupContext = createContext3({
488
501
  name: void 0,
489
502
  selected: [],
490
503
  disabled: false,
491
504
  readonly: false,
492
- hasError: false,
505
+ invalid: false,
493
506
  onChange() {
494
507
  throw new Error(
495
508
  "Cannot find `onChange()` handler. Perhaps you forgot to wrap it with `<MultiSelectGroup />` ?"
@@ -498,9 +511,9 @@ var MultiSelectGroupContext = createContext({
498
511
  });
499
512
 
500
513
  // src/components/MultiSelect/index.tsx
514
+ import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
501
515
  function MultiSelect({
502
516
  value,
503
- forceChecked = false,
504
517
  disabled = false,
505
518
  onChange,
506
519
  variant = "default",
@@ -511,14 +524,14 @@ function MultiSelect({
511
524
  selected,
512
525
  disabled: parentDisabled,
513
526
  readonly,
514
- hasError,
527
+ invalid,
515
528
  onChange: parentOnChange
516
529
  } = useContext3(MultiSelectGroupContext);
517
530
  warning2(
518
531
  name !== void 0,
519
532
  `"name" is not Provided for <MultiSelect>. Perhaps you forgot to wrap with <MultiSelectGroup> ?`
520
533
  );
521
- const isSelected = selected.includes(value) || forceChecked;
534
+ const isSelected = selected.includes(value);
522
535
  const isDisabled = disabled || parentDisabled || readonly;
523
536
  const handleChange = useCallback2(
524
537
  (event) => {
@@ -531,29 +544,33 @@ function MultiSelect({
531
544
  },
532
545
  [onChange, parentOnChange, value]
533
546
  );
534
- return /* @__PURE__ */ React7.createElement(MultiSelectRoot, { "aria-disabled": isDisabled }, /* @__PURE__ */ React7.createElement(
535
- MultiSelectInput,
536
- {
537
- ...{
538
- name,
539
- value,
540
- hasError
541
- },
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));
547
+ return /* @__PURE__ */ jsxs3(MultiSelectRoot, { "aria-disabled": isDisabled, children: [
548
+ /* @__PURE__ */ jsx7(
549
+ MultiSelectInput,
550
+ {
551
+ ...{
552
+ name,
553
+ value,
554
+ invalid
555
+ },
556
+ checked: isSelected,
557
+ disabled: isDisabled,
558
+ onChange: handleChange,
559
+ overlay: variant === "overlay",
560
+ "aria-invalid": invalid
561
+ }
562
+ ),
563
+ /* @__PURE__ */ jsx7(
564
+ MultiSelectInputOverlay,
565
+ {
566
+ overlay: variant === "overlay",
567
+ invalid,
568
+ "aria-hidden": true,
569
+ children: /* @__PURE__ */ jsx7("pixiv-icon", { name: "24/Check", "unsafe-non-guideline-scale": 16 / 24 })
570
+ }
571
+ ),
572
+ Boolean(children) && /* @__PURE__ */ jsx7(MultiSelectLabel, { children })
573
+ ] });
557
574
  }
558
575
  var MultiSelectRoot = styled6.label`
559
576
  display: grid;
@@ -584,10 +601,10 @@ var MultiSelectInput = styled6.input.attrs({ type: "checkbox" })`
584
601
  ${theme((o) => o.bg.brand.hover.press)}
585
602
  }
586
603
 
587
- ${({ hasError, overlay }) => theme((o) => [
604
+ ${({ invalid, overlay }) => theme((o) => [
588
605
  o.bg.text3.hover.press,
589
606
  o.borderRadius("oval"),
590
- hasError && !overlay && o.outline.assertive,
607
+ invalid && !overlay && o.outline.assertive,
591
608
  overlay && o.bg.surface4
592
609
  ])};
593
610
  }
@@ -601,12 +618,12 @@ var MultiSelectInputOverlay = styled6.div`
601
618
  align-items: center;
602
619
  justify-content: center;
603
620
 
604
- ${({ hasError, overlay }) => theme((o) => [
621
+ ${({ invalid, overlay }) => theme((o) => [
605
622
  o.width.px(24),
606
623
  o.height.px(24),
607
624
  o.borderRadius("oval"),
608
625
  o.font.text5,
609
- hasError && overlay && o.outline.assertive
626
+ invalid && overlay && o.outline.assertive
610
627
  ])}
611
628
 
612
629
  ${({ overlay }) => overlay && css2`
@@ -618,12 +635,12 @@ var MultiSelectInputOverlay = styled6.div`
618
635
  function MultiSelectGroup({
619
636
  className,
620
637
  name,
621
- ariaLabel,
638
+ label,
622
639
  selected,
623
640
  onChange,
624
641
  disabled = false,
625
642
  readonly = false,
626
- hasError = false,
643
+ invalid = false,
627
644
  children
628
645
  }) {
629
646
  const handleChange = useCallback2(
@@ -641,7 +658,7 @@ function MultiSelectGroup({
641
658
  },
642
659
  [onChange, selected]
643
660
  );
644
- return /* @__PURE__ */ React7.createElement(
661
+ return /* @__PURE__ */ jsx7(
645
662
  MultiSelectGroupContext.Provider,
646
663
  {
647
664
  value: {
@@ -649,28 +666,21 @@ function MultiSelectGroup({
649
666
  selected: Array.from(new Set(selected)),
650
667
  disabled,
651
668
  readonly,
652
- hasError,
669
+ invalid,
653
670
  onChange: handleChange
654
- }
655
- },
656
- /* @__PURE__ */ React7.createElement(
657
- "div",
658
- {
659
- className,
660
- "aria-label": ariaLabel,
661
- "data-testid": "SelectGroup"
662
671
  },
663
- children
664
- )
672
+ children: /* @__PURE__ */ jsx7("div", { className, "aria-label": label, "data-testid": "SelectGroup", children })
673
+ }
665
674
  );
666
675
  }
667
676
 
668
677
  // src/components/Switch/index.tsx
669
678
  import { useSwitch } from "@react-aria/switch";
670
- import React8, { useRef, useMemo } from "react";
679
+ import { useRef, useMemo } from "react";
671
680
  import { useToggleState } from "react-stately";
672
681
  import styled7 from "styled-components";
673
682
  import { disabledSelector as disabledSelector3 } from "@charcoal-ui/utils";
683
+ import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
674
684
  function SwitchCheckbox(props) {
675
685
  const { disabled, className } = props;
676
686
  const ariaSwitchProps = useMemo(
@@ -687,7 +697,10 @@ function SwitchCheckbox(props) {
687
697
  const {
688
698
  inputProps: { className: _className, type: _type, ...rest }
689
699
  } = 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);
700
+ return /* @__PURE__ */ jsxs4(Label, { className, "aria-disabled": disabled, children: [
701
+ /* @__PURE__ */ jsx8(SwitchInput, { ...rest, ref }),
702
+ "children" in props ? /* @__PURE__ */ jsx8(LabelInner, { children: props.children }) : void 0
703
+ ] });
691
704
  }
692
705
  var Label = styled7.label`
693
706
  display: inline-grid;
@@ -780,19 +793,16 @@ var SwitchInput = styled7.input.attrs({
780
793
  // src/components/TextField/index.tsx
781
794
  import { useTextField } from "@react-aria/textfield";
782
795
  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";
796
+ import { useCallback as useCallback3, useEffect, useRef as useRef2, useState } from "react";
797
+ import * as React5 from "react";
789
798
  import styled9, { css as css3 } from "styled-components";
790
799
 
791
800
  // src/components/FieldLabel/index.tsx
792
- import React9 from "react";
801
+ import * as React4 from "react";
793
802
  import styled8 from "styled-components";
794
803
  import { createTheme as createTheme2 } from "@charcoal-ui/styled";
795
- var FieldLabel = React9.forwardRef(
804
+ import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
805
+ var FieldLabel = React4.forwardRef(
796
806
  function FieldLabel2({
797
807
  style,
798
808
  className,
@@ -802,7 +812,11 @@ var FieldLabel = React9.forwardRef(
802
812
  subLabel,
803
813
  ...labelProps
804
814
  }, 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)));
815
+ return /* @__PURE__ */ jsxs5(FieldLabelWrapper, { style, className, children: [
816
+ /* @__PURE__ */ jsx9(Label2, { ref, ...labelProps, children: label }),
817
+ required && /* @__PURE__ */ jsx9(RequiredText, { children: requiredText }),
818
+ /* @__PURE__ */ jsx9(SubLabelClickable, { children: /* @__PURE__ */ jsx9("span", { children: subLabel }) })
819
+ ] });
806
820
  }
807
821
  );
808
822
  var FieldLabel_default = FieldLabel;
@@ -835,6 +849,7 @@ var FieldLabelWrapper = styled8.div`
835
849
 
836
850
  // src/components/TextField/index.tsx
837
851
  import { createTheme as createTheme3 } from "@charcoal-ui/styled";
852
+ import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
838
853
  var theme3 = createTheme3(styled9);
839
854
  function mergeRefs(...refs) {
840
855
  return (value) => {
@@ -851,13 +866,13 @@ function mergeRefs(...refs) {
851
866
  function countCodePointsInString(string) {
852
867
  return Array.from(string).length;
853
868
  }
854
- var TextField = React10.forwardRef(
869
+ var TextField = React5.forwardRef(
855
870
  function TextField2(props, ref) {
856
- return props.multiline !== void 0 && props.multiline ? /* @__PURE__ */ React10.createElement(MultiLineTextField, { ref, ...props }) : /* @__PURE__ */ React10.createElement(SingleLineTextField, { ref, ...props });
871
+ return props.multiline !== void 0 && props.multiline ? /* @__PURE__ */ jsx10(MultiLineTextField, { ref, ...props }) : /* @__PURE__ */ jsx10(SingleLineTextField, { ref, ...props });
857
872
  }
858
873
  );
859
874
  var TextField_default = TextField;
860
- var SingleLineTextField = React10.forwardRef(function SingleLineTextFieldInner({ onChange, ...props }, forwardRef4) {
875
+ var SingleLineTextField = React5.forwardRef(function SingleLineTextFieldInner({ onChange, ...props }, forwardRef12) {
861
876
  const {
862
877
  className,
863
878
  showLabel = false,
@@ -928,35 +943,46 @@ var SingleLineTextField = React10.forwardRef(function SingleLineTextFieldInner({
928
943
  prefixObserver.disconnect();
929
944
  };
930
945
  }, []);
931
- return /* @__PURE__ */ React10.createElement(TextFieldRoot, { className, isDisabled: disabled }, /* @__PURE__ */ React10.createElement(
932
- TextFieldLabel,
933
- {
934
- label,
935
- requiredText,
936
- required,
937
- 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
- ));
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(forwardRef12, 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
+ ] });
958
984
  });
959
- var MultiLineTextField = React10.forwardRef(function MultiLineTextFieldInner({ onChange, ...props }, forwardRef4) {
985
+ var MultiLineTextField = React5.forwardRef(function MultiLineTextFieldInner({ onChange, ...props }, forwardRef12) {
960
986
  const {
961
987
  className,
962
988
  showCount = false,
@@ -1023,40 +1049,46 @@ var MultiLineTextField = React10.forwardRef(function MultiLineTextFieldInner({ o
1023
1049
  syncHeight(textareaRef.current);
1024
1050
  }
1025
1051
  }, [autoHeight, syncHeight]);
1026
- return /* @__PURE__ */ React10.createElement(TextFieldRoot, { className, isDisabled: disabled }, /* @__PURE__ */ React10.createElement(
1027
- TextFieldLabel,
1028
- {
1029
- label,
1030
- requiredText,
1031
- 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,
1052
+ return /* @__PURE__ */ jsxs6(TextFieldRoot, { className, isDisabled: disabled, children: [
1053
+ /* @__PURE__ */ jsx10(
1054
+ TextFieldLabel,
1044
1055
  {
1045
- ref: mergeRefs(textareaRef, forwardRef4, ariaRef),
1046
- rows,
1047
- noBottomPadding: showCount,
1048
- ...inputProps
1056
+ label,
1057
+ requiredText,
1058
+ required,
1059
+ subLabel,
1060
+ ...labelProps,
1061
+ ...!showLabel ? visuallyHiddenProps : {}
1049
1062
  }
1050
1063
  ),
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
- ));
1064
+ /* @__PURE__ */ jsxs6(
1065
+ StyledTextareaContainer,
1066
+ {
1067
+ invalid,
1068
+ rows: showCount ? rows + 1 : rows,
1069
+ children: [
1070
+ /* @__PURE__ */ jsx10(
1071
+ StyledTextarea,
1072
+ {
1073
+ ref: mergeRefs(textareaRef, forwardRef12, ariaRef),
1074
+ rows,
1075
+ noBottomPadding: showCount,
1076
+ ...inputProps
1077
+ }
1078
+ ),
1079
+ showCount && /* @__PURE__ */ jsx10(MultiLineCounter, { children: maxLength !== void 0 ? `${count}/${maxLength}` : count })
1080
+ ]
1081
+ }
1082
+ ),
1083
+ assistiveText != null && assistiveText.length !== 0 && /* @__PURE__ */ jsx10(
1084
+ AssistiveText,
1085
+ {
1086
+ invalid,
1087
+ ...invalid ? errorMessageProps : descriptionProps,
1088
+ children: assistiveText
1089
+ }
1090
+ )
1091
+ ] });
1060
1092
  });
1061
1093
  var TextFieldRoot = styled9.div`
1062
1094
  display: flex;
@@ -1207,10 +1239,11 @@ var AssistiveText = styled9.p`
1207
1239
  `;
1208
1240
 
1209
1241
  // src/components/Icon/index.tsx
1210
- import React11 from "react";
1242
+ import * as React6 from "react";
1211
1243
  import "@charcoal-ui/icons";
1212
- var Icon = React11.forwardRef(function IconInner({ name, scale, unsafeNonGuidelineScale, className, ...rest }, ref) {
1213
- return /* @__PURE__ */ React11.createElement(
1244
+ import { jsx as jsx11 } from "react/jsx-runtime";
1245
+ var Icon = React6.forwardRef(function IconInner({ name, scale, unsafeNonGuidelineScale, className, ...rest }, ref) {
1246
+ return /* @__PURE__ */ jsx11(
1214
1247
  "pixiv-icon",
1215
1248
  {
1216
1249
  ref,
@@ -1225,7 +1258,8 @@ var Icon = React11.forwardRef(function IconInner({ name, scale, unsafeNonGuideli
1225
1258
  var Icon_default = Icon;
1226
1259
 
1227
1260
  // src/components/Modal/index.tsx
1228
- import React12, { useContext as useContext4, useRef as useRef3 } from "react";
1261
+ import { useContext as useContext4, useRef as useRef3 } from "react";
1262
+ import * as React7 from "react";
1229
1263
  import {
1230
1264
  Overlay,
1231
1265
  useModalOverlay,
@@ -1246,6 +1280,7 @@ function columnSystem(span, column, gutter) {
1246
1280
  import { maxWidth } from "@charcoal-ui/utils";
1247
1281
  import { useMedia } from "@charcoal-ui/styled";
1248
1282
  import { animated, useTransition, easings } from "react-spring";
1283
+ import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
1249
1284
  var DEFAULT_Z_INDEX = 10;
1250
1285
  function Modal({
1251
1286
  children,
@@ -1298,44 +1333,46 @@ function Modal({
1298
1333
  });
1299
1334
  const showDismiss = !isMobile || bottomSheet !== true;
1300
1335
  return transition(
1301
- ({ backgroundColor, transform }, item) => item && /* @__PURE__ */ React12.createElement(Overlay, { portalContainer }, /* @__PURE__ */ React12.createElement(
1336
+ ({ backgroundColor, transform }, item) => item && /* @__PURE__ */ jsx12(Overlay, { portalContainer, children: /* @__PURE__ */ jsx12(
1302
1337
  ModalBackground,
1303
1338
  {
1304
1339
  zIndex,
1305
1340
  ...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,
1341
+ style: transitionEnabled ? { backgroundColor } : {},
1342
+ children: /* @__PURE__ */ jsx12(FocusScope, { contain: true, restoreFocus: true, autoFocus: true, children: /* @__PURE__ */ jsx12(DialogContainer, { bottomSheet, size, children: /* @__PURE__ */ jsx12(
1343
+ ModalDialog,
1321
1344
  {
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
- ))
1345
+ ref,
1346
+ ...overlayProps,
1347
+ ...modalProps,
1348
+ ...dialogProps,
1349
+ style: transitionEnabled ? { transform } : {},
1350
+ size,
1351
+ bottomSheet,
1352
+ children: /* @__PURE__ */ jsxs7(
1353
+ ModalContext.Provider,
1354
+ {
1355
+ value: { titleProps, title, close: onClose, showDismiss },
1356
+ children: [
1357
+ children,
1358
+ isDismissable === true && /* @__PURE__ */ jsx12(
1359
+ ModalCrossButton,
1360
+ {
1361
+ size: "S",
1362
+ icon: "24/Close",
1363
+ onClick: onClose
1364
+ }
1365
+ )
1366
+ ]
1367
+ }
1368
+ )
1369
+ }
1370
+ ) }) })
1371
+ }
1372
+ ) })
1336
1373
  );
1337
1374
  }
1338
- var ModalContext = React12.createContext({
1375
+ var ModalContext = React7.createContext({
1339
1376
  titleProps: {},
1340
1377
  title: "",
1341
1378
  close: void 0,
@@ -1410,7 +1447,7 @@ var ModalCrossButton = styled10(IconButton_default)`
1410
1447
  `;
1411
1448
  function ModalTitle(props) {
1412
1449
  const { titleProps, title } = useContext4(ModalContext);
1413
- return /* @__PURE__ */ React12.createElement(ModalHeading, { ...titleProps, ...props }, title);
1450
+ return /* @__PURE__ */ jsx12(ModalHeading, { ...titleProps, ...props, children: title });
1414
1451
  }
1415
1452
  var ModalHeading = styled10.h3`
1416
1453
  margin: 0;
@@ -1419,10 +1456,10 @@ var ModalHeading = styled10.h3`
1419
1456
  `;
1420
1457
 
1421
1458
  // src/components/Modal/ModalPlumbing.tsx
1422
- import React13 from "react";
1423
1459
  import styled11 from "styled-components";
1460
+ import { jsx as jsx13 } from "react/jsx-runtime";
1424
1461
  function ModalHeader() {
1425
- return /* @__PURE__ */ React13.createElement(ModalHeaderRoot, null, /* @__PURE__ */ React13.createElement(StyledModalTitle, null));
1462
+ return /* @__PURE__ */ jsx13(ModalHeaderRoot, { children: /* @__PURE__ */ jsx13(StyledModalTitle, {}) });
1426
1463
  }
1427
1464
  var ModalHeaderRoot = styled11.div`
1428
1465
  height: 64px;
@@ -1448,14 +1485,15 @@ var ModalButtons = styled11.div`
1448
1485
  `;
1449
1486
 
1450
1487
  // src/components/LoadingSpinner/index.tsx
1451
- import React14, { useImperativeHandle, useRef as useRef4 } from "react";
1488
+ import { forwardRef as forwardRef8, useImperativeHandle, useRef as useRef4 } from "react";
1452
1489
  import styled12, { keyframes } from "styled-components";
1490
+ import { jsx as jsx14 } from "react/jsx-runtime";
1453
1491
  function LoadingSpinner({
1454
1492
  size = 48,
1455
1493
  padding = 16,
1456
1494
  transparent = false
1457
1495
  }) {
1458
- return /* @__PURE__ */ React14.createElement(LoadingSpinnerRoot, { size, padding, transparent }, /* @__PURE__ */ React14.createElement(LoadingSpinnerIcon, null));
1496
+ return /* @__PURE__ */ jsx14(LoadingSpinnerRoot, { size, padding, transparent, children: /* @__PURE__ */ jsx14(LoadingSpinnerIcon, {}) });
1459
1497
  }
1460
1498
  var LoadingSpinnerRoot = styled12.div.attrs({ role: "progressbar" })`
1461
1499
  box-sizing: content-box;
@@ -1494,56 +1532,90 @@ var Icon2 = styled12.div.attrs({ role: "presentation" })`
1494
1532
  animation: none;
1495
1533
  }
1496
1534
  `;
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;
1535
+ var LoadingSpinnerIcon = forwardRef8(
1536
+ function LoadingSpinnerIcon2({ once = false }, ref) {
1537
+ const iconRef = useRef4(null);
1538
+ useImperativeHandle(ref, () => ({
1539
+ restart: () => {
1540
+ if (!iconRef.current) {
1541
+ return;
1542
+ }
1543
+ iconRef.current.dataset.resetAnimation = "true";
1544
+ void iconRef.current.offsetWidth;
1545
+ delete iconRef.current.dataset.resetAnimation;
1503
1546
  }
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
- });
1547
+ }));
1548
+ return /* @__PURE__ */ jsx14(Icon2, { ref: iconRef, once });
1549
+ }
1550
+ );
1511
1551
 
1512
1552
  // 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";
1553
+ import { useState as useState2, useRef as useRef8 } from "react";
1554
+ import styled15 from "styled-components";
1516
1555
  import { disabledSelector as disabledSelector4 } from "@charcoal-ui/utils";
1517
1556
 
1518
1557
  // 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";
1558
+ import { useEffect as useEffect2, useRef as useRef6 } from "react";
1559
+
1560
+ // src/components/DropdownSelector/Popover/index.tsx
1561
+ import { useRef as useRef5 } from "react";
1562
+ import { DismissButton, Overlay as Overlay2, usePopover } from "@react-aria/overlays";
1525
1563
  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);
1564
+ import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
1565
+ var _empty = () => null;
1566
+ function Popover(props) {
1567
+ const defaultPopoverRef = useRef5(null);
1568
+ const finalPopoverRef = props.popoverRef === void 0 ? defaultPopoverRef : props.popoverRef;
1532
1569
  const { popoverProps, underlayProps } = usePopover(
1533
1570
  {
1534
- ...props,
1535
- popoverRef: ref,
1536
- containerPadding: 0
1571
+ triggerRef: props.triggerRef,
1572
+ popoverRef: finalPopoverRef,
1573
+ containerPadding: 16
1537
1574
  },
1538
- state
1575
+ {
1576
+ close: props.onClose,
1577
+ isOpen: props.isOpen,
1578
+ open: _empty,
1579
+ setOpen: _empty,
1580
+ toggle: _empty
1581
+ }
1539
1582
  );
1583
+ if (!props.isOpen)
1584
+ return null;
1585
+ return /* @__PURE__ */ jsxs8(Overlay2, { portalContainer: document.body, children: [
1586
+ /* @__PURE__ */ jsx15("div", { ...underlayProps, style: { position: "fixed", inset: 0 } }),
1587
+ /* @__PURE__ */ jsxs8(DropdownPopoverDiv, { ...popoverProps, ref: finalPopoverRef, children: [
1588
+ /* @__PURE__ */ jsx15(DismissButton, { onDismiss: () => props.onClose() }),
1589
+ props.children,
1590
+ /* @__PURE__ */ jsx15(DismissButton, { onDismiss: () => props.onClose() })
1591
+ ] })
1592
+ ] });
1593
+ }
1594
+ var DropdownPopoverDiv = styled13.div`
1595
+ margin: 4px 0;
1596
+ list-style: none;
1597
+ overflow: auto;
1598
+ max-height: inherit;
1599
+
1600
+ ${theme((o) => [
1601
+ o.bg.background1,
1602
+ o.border.default,
1603
+ o.borderRadius(8),
1604
+ o.padding.vertical(8)
1605
+ ])}
1606
+ `;
1607
+
1608
+ // src/components/DropdownSelector/DropdownPopover.tsx
1609
+ import { jsx as jsx16 } from "react/jsx-runtime";
1610
+ function DropdownPopover({ children, ...props }) {
1611
+ const ref = useRef6(null);
1540
1612
  useEffect2(() => {
1541
- if (ref.current && props.triggerRef.current) {
1613
+ if (props.isOpen && ref.current && props.triggerRef.current) {
1542
1614
  ref.current.style.width = `${props.triggerRef.current.clientWidth}px`;
1543
1615
  }
1544
- }, [props.triggerRef]);
1616
+ }, [props.triggerRef, props.isOpen]);
1545
1617
  useEffect2(() => {
1546
- if (state.isOpen && props.value !== void 0) {
1618
+ if (props.isOpen && props.value !== void 0) {
1547
1619
  const windowScrollY = window.scrollY;
1548
1620
  const windowScrollX = window.scrollX;
1549
1621
  const selectedElement = document.querySelector(
@@ -1553,92 +1625,163 @@ function DropdownPopover({ children, state, ...props }) {
1553
1625
  selectedElement?.focus();
1554
1626
  window.scrollTo(windowScrollX, windowScrollY);
1555
1627
  }
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() })));
1628
+ }, [props.value, props.isOpen]);
1629
+ return /* @__PURE__ */ jsx16(
1630
+ Popover,
1631
+ {
1632
+ isOpen: props.isOpen,
1633
+ onClose: props.onClose,
1634
+ popoverRef: ref,
1635
+ triggerRef: props.triggerRef,
1636
+ children
1637
+ }
1638
+ );
1558
1639
  }
1559
1640
 
1560
- // src/components/DropdownSelector/index.tsx
1561
- var DropdownSelectorContext = createContext2({
1641
+ // src/components/DropdownSelector/utils/findPreviewRecursive.tsx
1642
+ import React9 from "react";
1643
+ function findPreviewRecursive(children, value) {
1644
+ const childArray = React9.Children.toArray(children);
1645
+ for (let i = 0; i < childArray.length; i++) {
1646
+ const child = childArray[i];
1647
+ if (React9.isValidElement(child)) {
1648
+ if ("value" in child.props) {
1649
+ const childValue = child.props.value;
1650
+ if (childValue === value && "children" in child.props) {
1651
+ const children2 = child.props.children;
1652
+ return children2;
1653
+ }
1654
+ }
1655
+ if ("children" in child.props) {
1656
+ const children2 = findPreviewRecursive(
1657
+ child.props.children,
1658
+ value
1659
+ );
1660
+ if (children2 !== void 0) {
1661
+ return children2;
1662
+ }
1663
+ }
1664
+ }
1665
+ }
1666
+ }
1667
+
1668
+ // src/components/DropdownSelector/MenuList/index.tsx
1669
+ import { useRef as useRef7 } from "react";
1670
+ import styled14 from "styled-components";
1671
+
1672
+ // src/components/DropdownSelector/MenuList/MenuListContext.ts
1673
+ import { createContext as createContext5 } from "react";
1674
+ var MenuListContext = createContext5({
1675
+ root: void 0,
1562
1676
  value: "",
1677
+ values: [],
1563
1678
  setValue: (_v) => {
1564
1679
  }
1565
1680
  });
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);
1681
+
1682
+ // src/components/DropdownSelector/MenuList/internals/getValuesRecursive.tsx
1683
+ import React10 from "react";
1684
+ function getValuesRecursive(children, values = []) {
1685
+ const childArray = React10.Children.toArray(children);
1572
1686
  for (let i = 0; i < childArray.length; i++) {
1573
1687
  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;
1688
+ if (React10.isValidElement(child)) {
1689
+ const props = child.props;
1690
+ if ("value" in props && typeof props.value === "string") {
1691
+ const childValue = props.value;
1692
+ values.push(childValue);
1693
+ }
1694
+ if ("children" in props && props.children) {
1695
+ getValuesRecursive(props.children, values);
1579
1696
  }
1580
1697
  }
1581
1698
  }
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,
1699
+ }
1700
+
1701
+ // src/components/DropdownSelector/MenuList/index.tsx
1702
+ import { jsx as jsx17 } from "react/jsx-runtime";
1703
+ function MenuList(props) {
1704
+ const root = useRef7(null);
1705
+ const values = [];
1706
+ getValuesRecursive(props.children, values);
1707
+ return /* @__PURE__ */ jsx17(StyledUl, { ref: root, children: /* @__PURE__ */ jsx17(
1708
+ MenuListContext.Provider,
1606
1709
  {
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
- }
1710
+ value: {
1711
+ value: props.value ?? "",
1712
+ root,
1713
+ values,
1714
+ setValue: (v) => {
1715
+ props.onChange?.(v);
1620
1716
  }
1621
1717
  },
1622
- props.children
1623
- ))
1624
- ), props.assistiveText !== void 0 && /* @__PURE__ */ React16.createElement(AssertiveText, { invalid: props.invalid }, props.assistiveText));
1718
+ children: props.children
1719
+ }
1720
+ ) });
1625
1721
  }
1626
- var ListboxRoot = styled14.ul`
1627
- padding-left: 0;
1722
+ var StyledUl = styled14.ul`
1723
+ padding: 0;
1628
1724
  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
1725
  `;
1641
- var DropdownSelectorRoot = styled14.div`
1726
+
1727
+ // src/components/DropdownSelector/index.tsx
1728
+ import { jsx as jsx18, jsxs as jsxs9 } from "react/jsx-runtime";
1729
+ var defaultRequiredText = "*\u5FC5\u9808";
1730
+ function DropdownSelector(props) {
1731
+ const triggerRef = useRef8(null);
1732
+ const [isOpen, setIsOpen] = useState2(false);
1733
+ const preview = findPreviewRecursive(props.children, props.value);
1734
+ return /* @__PURE__ */ jsxs9(DropdownSelectorRoot, { "aria-disabled": props.disabled, children: [
1735
+ props.showLabel === true && /* @__PURE__ */ jsx18(
1736
+ DropdownFieldLabel,
1737
+ {
1738
+ label: props.label,
1739
+ required: props.required,
1740
+ requiredText: props.requiredText ?? defaultRequiredText,
1741
+ subLabel: props.subLabel
1742
+ }
1743
+ ),
1744
+ /* @__PURE__ */ jsxs9(
1745
+ DropdownButton,
1746
+ {
1747
+ invalid: props.invalid,
1748
+ disabled: props.disabled,
1749
+ onClick: () => {
1750
+ if (props.disabled === true)
1751
+ return;
1752
+ setIsOpen(true);
1753
+ },
1754
+ ref: triggerRef,
1755
+ children: [
1756
+ /* @__PURE__ */ jsx18(DropdownButtonText, { children: props.placeholder !== void 0 && preview === void 0 ? props.placeholder : preview }),
1757
+ /* @__PURE__ */ jsx18(DropdownButtonIcon, { name: "16/Menu" })
1758
+ ]
1759
+ }
1760
+ ),
1761
+ /* @__PURE__ */ jsx18(
1762
+ DropdownPopover,
1763
+ {
1764
+ isOpen,
1765
+ onClose: () => setIsOpen(false),
1766
+ triggerRef,
1767
+ value: props.value,
1768
+ children: /* @__PURE__ */ jsx18(
1769
+ MenuList,
1770
+ {
1771
+ value: props.value,
1772
+ onChange: (v) => {
1773
+ props.onChange(v);
1774
+ setIsOpen(false);
1775
+ },
1776
+ children: props.children
1777
+ }
1778
+ )
1779
+ }
1780
+ ),
1781
+ props.assistiveText !== void 0 && /* @__PURE__ */ jsx18(AssertiveText, { invalid: props.invalid, children: props.assistiveText })
1782
+ ] });
1783
+ }
1784
+ var DropdownSelectorRoot = styled15.div`
1642
1785
  display: inline-block;
1643
1786
  width: 100%;
1644
1787
 
@@ -1647,12 +1790,12 @@ var DropdownSelectorRoot = styled14.div`
1647
1790
  ${theme((o) => o.disabled)}
1648
1791
  }
1649
1792
  `;
1650
- var DropdownFieldLabel = styled14(FieldLabel_default)`
1793
+ var DropdownFieldLabel = styled15(FieldLabel_default)`
1651
1794
  width: 100%;
1652
1795
 
1653
1796
  ${theme((o) => o.margin.bottom(8))}
1654
1797
  `;
1655
- var DropdownButton = styled14.button`
1798
+ var DropdownButton = styled15.button`
1656
1799
  display: flex;
1657
1800
  justify-content: space-between;
1658
1801
  align-items: center;
@@ -1675,15 +1818,15 @@ var DropdownButton = styled14.button`
1675
1818
  invalid === true && o.outline.assertive
1676
1819
  ])}
1677
1820
  `;
1678
- var DropdownButtonText = styled14.span`
1821
+ var DropdownButtonText = styled15.span`
1679
1822
  text-align: left;
1680
1823
 
1681
1824
  ${theme((o) => [o.typography(14), o.font.text2])}
1682
1825
  `;
1683
- var DropdownButtonIcon = styled14(Icon_default)`
1826
+ var DropdownButtonIcon = styled15(Icon_default)`
1684
1827
  ${theme((o) => [o.font.text2])}
1685
1828
  `;
1686
- var AssertiveText = styled14.div`
1829
+ var AssertiveText = styled15.div`
1687
1830
  ${({ invalid }) => theme((o) => [
1688
1831
  o.typography(14),
1689
1832
  o.margin.top(8),
@@ -1691,130 +1834,205 @@ var AssertiveText = styled14.div`
1691
1834
  ])}
1692
1835
  `;
1693
1836
 
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
- }
1837
+ // src/components/DropdownSelector/DropdownMenuItem.tsx
1838
+ import styled17 from "styled-components";
1839
+
1840
+ // src/components/DropdownSelector/ListItem/index.tsx
1841
+ import styled16 from "styled-components";
1842
+ import { jsx as jsx19 } from "react/jsx-runtime";
1843
+ function ListItem(props) {
1844
+ const { children, ...rest } = props;
1845
+ return /* @__PURE__ */ jsx19(StyledLi, { role: "option", children: /* @__PURE__ */ jsx19(ItemDiv, { ...rest, children: props.children }) });
1715
1846
  }
1847
+ var StyledLi = styled16.li`
1848
+ list-style: none;
1849
+ `;
1850
+ var ItemDiv = styled16.div`
1851
+ display: flex;
1852
+ align-items: center;
1853
+ min-height: 40px;
1854
+ cursor: pointer;
1855
+ outline: none;
1856
+
1857
+ ${theme((o) => [o.padding.horizontal(16), o.disabled])}
1716
1858
 
1717
- // src/components/DropdownSelector/utils/focusIfHTMLLIElement.tsx
1718
- function focusIfHTMLLIElement(element) {
1719
- if (element instanceof HTMLLIElement) {
1720
- element.focus({ preventScroll: true });
1721
- handleFocusByKeyBoard(element);
1859
+ &[aria-disabled="true"] {
1860
+ cursor: default;
1861
+ }
1862
+
1863
+ :hover,
1864
+ :focus,
1865
+ :focus-within {
1866
+ ${theme((o) => [o.bg.surface3])}
1867
+ }
1868
+ `;
1869
+
1870
+ // src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx
1871
+ import { useCallback as useCallback4, useContext as useContext5 } from "react";
1872
+
1873
+ // src/components/DropdownSelector/MenuItem/internals/handleFocusByKeyBoard.tsx
1874
+ function handleFocusByKeyBoard(element, parent) {
1875
+ const isScrollable = parent.scrollHeight > parent.clientHeight;
1876
+ if (isScrollable) {
1877
+ const rect = element.getBoundingClientRect();
1878
+ const parentRect = parent.getBoundingClientRect();
1879
+ if (rect.bottom > parentRect.bottom) {
1880
+ parent.scrollTo({
1881
+ top: parent.scrollTop + rect.bottom - parentRect.bottom
1882
+ });
1883
+ } else if (rect.top < parentRect.top) {
1884
+ parent.scrollTo({
1885
+ top: parent.scrollTop - (parentRect.top - rect.top)
1886
+ });
1887
+ }
1888
+ } else {
1889
+ scrollIfNeeded(element);
1890
+ }
1891
+ }
1892
+ function scrollIfNeeded(element) {
1893
+ const elementRect = element.getBoundingClientRect();
1894
+ const isVisible = elementRect.top >= 0 && elementRect.bottom <= (window.innerHeight || document.documentElement.clientHeight);
1895
+ if (!isVisible) {
1896
+ element.scrollIntoView({
1897
+ block: "nearest"
1898
+ });
1722
1899
  }
1723
1900
  }
1724
1901
 
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);
1902
+ // src/components/DropdownSelector/MenuItem/internals/useMenuItemHandleKeyDown.tsx
1903
+ function useMenuItemHandleKeyDown(value) {
1904
+ const { setValue, root, values } = useContext5(MenuListContext);
1905
+ const setContextValue = useCallback4(() => {
1906
+ if (value !== void 0)
1907
+ setValue(value);
1908
+ }, [value, setValue]);
1909
+ const handleKeyDown = useCallback4(
1910
+ (e) => {
1911
+ if (e.key === "Enter") {
1912
+ setContextValue();
1913
+ } else if (e.key === "ArrowUp" || e.key === "ArrowDown") {
1914
+ e.preventDefault();
1915
+ if (!values || value === void 0)
1916
+ return;
1917
+ const index = values.indexOf(value);
1918
+ if (index === -1)
1919
+ return;
1920
+ const focusValue = e.key === "ArrowUp" ? index - 1 < 0 ? values[values.length - 1] : values[index - 1] : index + 1 >= values.length ? values[0] : values[index + 1];
1921
+ const next = root?.current?.querySelector(`[data-key='${focusValue}']`);
1922
+ if (next instanceof HTMLElement) {
1923
+ next.focus({ preventScroll: true });
1924
+ if (root?.current?.parentElement) {
1925
+ handleFocusByKeyBoard(next, root.current.parentElement);
1754
1926
  }
1755
- focusIfHTMLLIElement(next);
1756
- } else if (e.key === " ") {
1757
- e.preventDefault();
1758
1927
  }
1759
- },
1760
- onClick: onSelect,
1761
- tabIndex: -1
1928
+ }
1762
1929
  },
1763
- isSelected && /* @__PURE__ */ React17.createElement(OptionCheckIcon, { name: "16/Check" }),
1764
- /* @__PURE__ */ React17.createElement(OptionText, { isSelected }, props.children)
1930
+ [setContextValue, value, root, values]
1765
1931
  );
1932
+ return [handleKeyDown, setContextValue];
1766
1933
  }
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
1934
 
1775
- ${theme((o) => [o.padding.horizontal(8)])}
1935
+ // src/components/DropdownSelector/MenuItem/index.tsx
1936
+ import { jsx as jsx20 } from "react/jsx-runtime";
1937
+ function MenuItem(props) {
1938
+ const { children, as, ...rest } = props;
1939
+ const [handleKeyDown, setContextValue] = useMenuItemHandleKeyDown(props.value);
1940
+ return /* @__PURE__ */ jsx20(
1941
+ ListItem,
1942
+ {
1943
+ ...rest,
1944
+ as,
1945
+ "data-key": props.value,
1946
+ onKeyDown: handleKeyDown,
1947
+ onClick: props.disabled === true ? void 0 : setContextValue,
1948
+ tabIndex: -1,
1949
+ "aria-disabled": props.disabled,
1950
+ children: props.children
1951
+ }
1952
+ );
1953
+ }
1776
1954
 
1777
- :focus {
1778
- ${theme((o) => [o.bg.surface3])}
1779
- }
1955
+ // src/components/DropdownSelector/DropdownMenuItem.tsx
1956
+ import { useContext as useContext6 } from "react";
1957
+ import { jsx as jsx21, jsxs as jsxs10 } from "react/jsx-runtime";
1958
+ function DropdownMenuItem(props) {
1959
+ const { value: ctxValue } = useContext6(MenuListContext);
1960
+ const isSelected = props.value === ctxValue;
1961
+ const { children, ...rest } = props;
1962
+ return /* @__PURE__ */ jsxs10(MenuItem, { ...rest, children: [
1963
+ isSelected && /* @__PURE__ */ jsx21(Text2ColorIcon, { name: "16/Check" }),
1964
+ /* @__PURE__ */ jsx21(StyledSpan, { isSelected, children: props.children })
1965
+ ] });
1966
+ }
1967
+ var StyledSpan = styled17.span`
1968
+ ${theme((o) => [o.typography(14), o.font.text2])};
1969
+ display: flex;
1970
+ align-items: center;
1971
+ width: 100%;
1972
+ margin-left: ${({ isSelected }) => isSelected === true ? 0 : 20}px;
1780
1973
  `;
1781
- var OptionCheckIcon = styled15(Icon_default)`
1974
+ var Text2ColorIcon = styled17(Icon_default)`
1782
1975
  ${theme((o) => [o.font.text2])}
1976
+ padding-right: 4px;
1783
1977
  `;
1784
- var OptionText = styled15.span`
1978
+
1979
+ // src/components/DropdownSelector/MenuItemGroup/index.tsx
1980
+ import styled18 from "styled-components";
1981
+ import { jsx as jsx22, jsxs as jsxs11 } from "react/jsx-runtime";
1982
+ function MenuItemGroup(props) {
1983
+ return /* @__PURE__ */ jsxs11(StyledLi2, { role: "presentation", children: [
1984
+ /* @__PURE__ */ jsx22(TextSpan, { children: props.text }),
1985
+ /* @__PURE__ */ jsx22(StyledUl2, { role: "group", children: props.children })
1986
+ ] });
1987
+ }
1988
+ var TextSpan = styled18.span`
1989
+ display: block;
1990
+ color: ${({ theme: theme4 }) => theme4.color.text3};
1991
+ font-size: 12px;
1992
+ font-weight: bold;
1993
+ padding: 12px 0 8px 16px;
1994
+ `;
1995
+ var StyledUl2 = styled18.ul`
1996
+ padding-left: 0;
1997
+ margin: 0;
1998
+ box-sizing: border-box;
1999
+ list-style: none;
2000
+ overflow: hidden;
2001
+ `;
2002
+ var StyledLi2 = styled18.li`
1785
2003
  display: block;
1786
- ${theme((o) => [o.typography(14), o.font.text2])}
1787
- margin-left: ${({ isSelected }) => isSelected === true ? 0 : 20}px;
1788
2004
  `;
1789
2005
 
1790
2006
  // src/components/SegmentedControl/index.tsx
1791
- import React19, { forwardRef, memo, useMemo as useMemo2, useRef as useRef7 } from "react";
2007
+ import { forwardRef as forwardRef9, memo, useMemo as useMemo2, useRef as useRef9 } from "react";
1792
2008
  import { useRadioGroupState } from "react-stately";
1793
2009
  import {
1794
2010
  useRadio,
1795
2011
  useRadioGroup
1796
2012
  } from "@react-aria/radio";
1797
- import styled16 from "styled-components";
2013
+ import styled19 from "styled-components";
1798
2014
  import { disabledSelector as disabledSelector5 } from "@charcoal-ui/utils";
1799
2015
 
1800
2016
  // src/components/SegmentedControl/RadioGroupContext.tsx
1801
- import React18, { createContext as createContext3, useContext as useContext6 } from "react";
1802
- var RadioContext = createContext3(null);
2017
+ import { createContext as createContext6, useContext as useContext7 } from "react";
2018
+ import { jsx as jsx23 } from "react/jsx-runtime";
2019
+ var RadioContext = createContext6(null);
1803
2020
  var RadioProvider = ({
1804
2021
  value,
1805
2022
  children
1806
2023
  }) => {
1807
- return /* @__PURE__ */ React18.createElement(RadioContext.Provider, { value }, children);
2024
+ return /* @__PURE__ */ jsx23(RadioContext.Provider, { value, children });
1808
2025
  };
1809
2026
  var useRadioContext = () => {
1810
- const state = useContext6(RadioContext);
2027
+ const state = useContext7(RadioContext);
1811
2028
  if (state === null)
1812
2029
  throw new Error("`<RadioProvider>` is not likely mounted.");
1813
2030
  return state;
1814
2031
  };
1815
2032
 
1816
2033
  // src/components/SegmentedControl/index.tsx
1817
- var SegmentedControl = forwardRef(
2034
+ import { jsx as jsx24, jsxs as jsxs12 } from "react/jsx-runtime";
2035
+ var SegmentedControl = forwardRef9(
1818
2036
  function SegmentedControlInner(props, ref) {
1819
2037
  const ariaRadioGroupProps = useMemo2(
1820
2038
  () => ({
@@ -1833,23 +2051,27 @@ var SegmentedControl = forwardRef(
1833
2051
  (d) => typeof d === "string" ? { value: d, label: d } : d
1834
2052
  );
1835
2053
  }, [props.data]);
1836
- return /* @__PURE__ */ React19.createElement(SegmentedControlRoot, { ref, ...radioGroupProps }, /* @__PURE__ */ React19.createElement(RadioProvider, { value: state }, segmentedControlItems.map((item) => /* @__PURE__ */ React19.createElement(
2054
+ return /* @__PURE__ */ jsx24(SegmentedControlRoot, { ref, ...radioGroupProps, children: /* @__PURE__ */ jsx24(RadioProvider, { value: state, children: segmentedControlItems.map((item) => /* @__PURE__ */ jsx24(
1837
2055
  Segmented,
1838
2056
  {
1839
- key: item.value,
1840
2057
  value: item.value,
1841
- disabled: item.disabled
2058
+ disabled: item.disabled,
2059
+ children: item.label
1842
2060
  },
1843
- item.label
1844
- ))));
2061
+ item.value
2062
+ )) }) });
1845
2063
  }
1846
2064
  );
1847
2065
  var SegmentedControl_default = memo(SegmentedControl);
1848
- var Segmented = ({ children, ...props }) => {
2066
+ var Segmented = (props) => {
1849
2067
  const state = useRadioContext();
1850
- const ref = useRef7(null);
2068
+ const ref = useRef9(null);
1851
2069
  const ariaRadioProps = useMemo2(
1852
- () => ({ ...props, isDisabled: props.disabled }),
2070
+ () => ({
2071
+ value: props.value,
2072
+ isDisabled: props.disabled,
2073
+ children: props.children
2074
+ }),
1853
2075
  [props]
1854
2076
  );
1855
2077
  const { inputProps, isDisabled, isSelected } = useRadio(
@@ -1857,23 +2079,25 @@ var Segmented = ({ children, ...props }) => {
1857
2079
  state,
1858
2080
  ref
1859
2081
  );
1860
- return /* @__PURE__ */ React19.createElement(
2082
+ return /* @__PURE__ */ jsxs12(
1861
2083
  SegmentedRoot,
1862
2084
  {
1863
2085
  "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))
2086
+ checked: isSelected,
2087
+ children: [
2088
+ /* @__PURE__ */ jsx24(SegmentedInput, { ...inputProps, ref }),
2089
+ /* @__PURE__ */ jsx24(RadioLabel2, { children: /* @__PURE__ */ jsx24(SegmentedLabelInner, { children: props.children }) })
2090
+ ]
2091
+ }
1868
2092
  );
1869
2093
  };
1870
- var SegmentedControlRoot = styled16.div`
2094
+ var SegmentedControlRoot = styled19.div`
1871
2095
  display: inline-flex;
1872
2096
  align-items: center;
1873
2097
 
1874
2098
  ${theme((o) => [o.bg.surface3, o.borderRadius(16)])}
1875
2099
  `;
1876
- var SegmentedRoot = styled16.label`
2100
+ var SegmentedRoot = styled19.label`
1877
2101
  position: relative;
1878
2102
  display: flex;
1879
2103
  align-items: center;
@@ -1892,7 +2116,7 @@ var SegmentedRoot = styled16.label`
1892
2116
  checked === true ? o.font.text5 : o.font.text2
1893
2117
  ])}
1894
2118
  `;
1895
- var SegmentedInput = styled16.input`
2119
+ var SegmentedInput = styled19.input`
1896
2120
  position: absolute;
1897
2121
 
1898
2122
  height: 0px;
@@ -1906,24 +2130,25 @@ var SegmentedInput = styled16.input`
1906
2130
  white-space: nowrap;
1907
2131
  opacity: 0;
1908
2132
  `;
1909
- var RadioLabel2 = styled16.div`
2133
+ var RadioLabel2 = styled19.div`
1910
2134
  background: transparent;
1911
2135
  display: flex;
1912
2136
  align-items: center;
1913
2137
  height: 22px;
1914
2138
  `;
1915
- var SegmentedLabelInner = styled16.div`
2139
+ var SegmentedLabelInner = styled19.div`
1916
2140
  ${theme((o) => [o.typography(14)])}
1917
2141
  `;
1918
2142
 
1919
2143
  // 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";
2144
+ import { forwardRef as forwardRef10, memo as memo2, useMemo as useMemo3 } from "react";
2145
+ import styled20, { css as css5 } from "styled-components";
1922
2146
  import { useCheckbox } from "@react-aria/checkbox";
1923
2147
  import { useObjectRef } from "@react-aria/utils";
1924
2148
  import { useToggleState as useToggleState2 } from "react-stately";
1925
- import { disabledSelector as disabledSelector6, px as px4 } from "@charcoal-ui/utils";
1926
- var Checkbox = forwardRef2(
2149
+ import { disabledSelector as disabledSelector6, px as px3 } from "@charcoal-ui/utils";
2150
+ import { jsx as jsx25, jsxs as jsxs13 } from "react/jsx-runtime";
2151
+ var Checkbox = forwardRef10(
1927
2152
  function CheckboxInner(props, ref) {
1928
2153
  const ariaCheckboxProps = useMemo3(
1929
2154
  () => ({
@@ -1939,14 +2164,20 @@ var Checkbox = forwardRef2(
1939
2164
  const objectRef = useObjectRef(ref);
1940
2165
  const { inputProps } = useCheckbox(ariaCheckboxProps, state, objectRef);
1941
2166
  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));
2167
+ return /* @__PURE__ */ jsxs13(InputRoot, { "aria-disabled": isDisabled, children: [
2168
+ /* @__PURE__ */ jsxs13(CheckboxRoot, { children: [
2169
+ /* @__PURE__ */ jsx25(CheckboxInput, { type: "checkbox", ...inputProps }),
2170
+ /* @__PURE__ */ jsx25(CheckboxInputOverlay, { "aria-hidden": true, checked: inputProps.checked, children: /* @__PURE__ */ jsx25(Icon_default, { name: "24/Check", unsafeNonGuidelineScale: 2 / 3 }) })
2171
+ ] }),
2172
+ "children" in props && /* @__PURE__ */ jsx25(InputLabel, { children: props.children })
2173
+ ] });
1943
2174
  }
1944
2175
  );
1945
2176
  var Checkbox_default = memo2(Checkbox);
1946
2177
  var hiddenCss = css5`
1947
2178
  visibility: hidden;
1948
2179
  `;
1949
- var InputRoot = styled17.label`
2180
+ var InputRoot = styled20.label`
1950
2181
  position: relative;
1951
2182
  display: flex;
1952
2183
 
@@ -1955,13 +2186,13 @@ var InputRoot = styled17.label`
1955
2186
  cursor: default;
1956
2187
  }
1957
2188
 
1958
- gap: ${({ theme: theme4 }) => px4(theme4.spacing[4])};
2189
+ gap: ${({ theme: theme4 }) => px3(theme4.spacing[4])};
1959
2190
  ${theme((o) => [o.disabled])}
1960
2191
  `;
1961
- var CheckboxRoot = styled17.div`
2192
+ var CheckboxRoot = styled20.div`
1962
2193
  position: relative;
1963
2194
  `;
1964
- var CheckboxInput = styled17.input`
2195
+ var CheckboxInput = styled20.input`
1965
2196
  &[type='checkbox'] {
1966
2197
  appearance: none;
1967
2198
  display: block;
@@ -1984,7 +2215,7 @@ var CheckboxInput = styled17.input`
1984
2215
  transition: all 0.2s !important;
1985
2216
  }
1986
2217
  `;
1987
- var CheckboxInputOverlay = styled17.div`
2218
+ var CheckboxInputOverlay = styled20.div`
1988
2219
  position: absolute;
1989
2220
  top: -2px;
1990
2221
  left: -2px;
@@ -1997,7 +2228,7 @@ var CheckboxInputOverlay = styled17.div`
1997
2228
 
1998
2229
  ${({ checked }) => checked !== true && hiddenCss};
1999
2230
  `;
2000
- var InputLabel = styled17.div`
2231
+ var InputLabel = styled20.div`
2001
2232
  ${theme((o) => [o.font.text2])}
2002
2233
 
2003
2234
  font-size: 14px;
@@ -2006,20 +2237,17 @@ var InputLabel = styled17.div`
2006
2237
  `;
2007
2238
 
2008
2239
  // src/components/TagItem/index.tsx
2009
- import React21, {
2010
- forwardRef as forwardRef3,
2011
- memo as memo3,
2012
- useMemo as useMemo4
2013
- } from "react";
2240
+ import { forwardRef as forwardRef11, memo as memo3, useMemo as useMemo4 } from "react";
2014
2241
  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";
2242
+ import styled21, { css as css6 } from "styled-components";
2243
+ import { disabledSelector as disabledSelector7, px as px4 } from "@charcoal-ui/utils";
2017
2244
  import { useButton } from "@react-aria/button";
2245
+ import { jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
2018
2246
  var sizeMap = {
2019
2247
  S: 32,
2020
2248
  M: 40
2021
2249
  };
2022
- var TagItem = forwardRef3(
2250
+ var TagItem = forwardRef11(
2023
2251
  function TagItemInner({
2024
2252
  label,
2025
2253
  translatedLabel,
@@ -2042,22 +2270,30 @@ var TagItem = forwardRef3(
2042
2270
  );
2043
2271
  const { buttonProps } = useButton(ariaButtonProps, ref);
2044
2272
  const hasTranslatedLabel = translatedLabel !== void 0 && translatedLabel.length > 0;
2045
- return /* @__PURE__ */ React21.createElement(
2273
+ return /* @__PURE__ */ jsxs14(
2046
2274
  TagItemRoot,
2047
2275
  {
2048
2276
  ref,
2049
2277
  size: hasTranslatedLabel ? "M" : size,
2050
2278
  status,
2051
2279
  ...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" }))
2280
+ className,
2281
+ children: [
2282
+ /* @__PURE__ */ jsx26(Background, { bgColor, bgImage, status }),
2283
+ /* @__PURE__ */ jsxs14(Inner, { children: [
2284
+ /* @__PURE__ */ jsxs14(LabelWrapper, { isTranslate: hasTranslatedLabel, children: [
2285
+ hasTranslatedLabel && /* @__PURE__ */ jsx26(TranslatedLabel, { children: /* @__PURE__ */ jsx26(Label3, { children: translatedLabel }) }),
2286
+ /* @__PURE__ */ jsx26(Label3, { children: label })
2287
+ ] }),
2288
+ status === "active" && /* @__PURE__ */ jsx26(Icon_default, { name: "16/Remove" })
2289
+ ] })
2290
+ ]
2291
+ }
2056
2292
  );
2057
2293
  }
2058
2294
  );
2059
2295
  var TagItem_default = memo3(TagItem);
2060
- var TagItemRoot = styled18.a`
2296
+ var TagItemRoot = styled21.a`
2061
2297
  isolation: isolate;
2062
2298
  position: relative;
2063
2299
  height: ${({ size }) => sizeMap[size]}px;
@@ -2082,7 +2318,7 @@ var TagItemRoot = styled18.a`
2082
2318
  cursor: default;
2083
2319
  }
2084
2320
  `;
2085
- var Background = styled18.div`
2321
+ var Background = styled21.div`
2086
2322
  position: absolute;
2087
2323
  z-index: 1;
2088
2324
  top: 0;
@@ -2109,9 +2345,9 @@ var Background = styled18.div`
2109
2345
  }
2110
2346
  `}
2111
2347
  `;
2112
- var Inner = styled18.div`
2348
+ var Inner = styled21.div`
2113
2349
  display: inline-flex;
2114
- gap: ${({ theme: theme4 }) => px5(theme4.spacing[8])};
2350
+ gap: ${({ theme: theme4 }) => px4(theme4.spacing[8])};
2115
2351
  align-items: center;
2116
2352
  z-index: 2;
2117
2353
  `;
@@ -2124,10 +2360,10 @@ var translateLabelCSS = css6`
2124
2360
  flex-direction: column;
2125
2361
  font-size: 10px;
2126
2362
  `;
2127
- var LabelWrapper = styled18.div`
2363
+ var LabelWrapper = styled21.div`
2128
2364
  ${({ isTranslate }) => isTranslate ?? false ? translateLabelCSS : labelCSS}
2129
2365
  `;
2130
- var Label3 = styled18.span`
2366
+ var Label3 = styled21.span`
2131
2367
  max-width: 152px;
2132
2368
  overflow: hidden;
2133
2369
  text-overflow: ellipsis;
@@ -2136,7 +2372,7 @@ var Label3 = styled18.span`
2136
2372
  color: inherit;
2137
2373
  line-height: inherit;
2138
2374
  `;
2139
- var TranslatedLabel = styled18.div`
2375
+ var TranslatedLabel = styled21.div`
2140
2376
  ${theme((o) => [o.typography(12).bold])}
2141
2377
  `;
2142
2378
  export {
@@ -2145,11 +2381,13 @@ export {
2145
2381
  Checkbox_default as Checkbox,
2146
2382
  Clickable_default as Clickable,
2147
2383
  ComponentAbstraction,
2384
+ DropdownMenuItem,
2148
2385
  DropdownSelector,
2149
2386
  Icon_default as Icon,
2150
2387
  IconButton_default as IconButton,
2151
2388
  LoadingSpinner,
2152
2389
  LoadingSpinnerIcon,
2390
+ MenuItemGroup,
2153
2391
  Modal,
2154
2392
  ModalAlign,
2155
2393
  ModalBody,
@@ -2157,7 +2395,6 @@ export {
2157
2395
  ModalHeader,
2158
2396
  MultiSelect,
2159
2397
  MultiSelectGroup,
2160
- OptionItem,
2161
2398
  OverlayProvider,
2162
2399
  Radio,
2163
2400
  RadioGroup,