@charcoal-ui/react 3.6.0 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/dist/_lib/compat.d.ts +1 -0
  2. package/dist/_lib/compat.d.ts.map +1 -1
  3. package/dist/components/Button/StyledButton.d.ts +13 -0
  4. package/dist/components/Button/StyledButton.d.ts.map +1 -0
  5. package/dist/components/Button/index.d.ts +3 -2
  6. package/dist/components/Button/index.d.ts.map +1 -1
  7. package/dist/components/Button/index.story.d.ts +16 -32
  8. package/dist/components/Button/index.story.d.ts.map +1 -1
  9. package/dist/components/Button/lib/variantToBackground.d.ts +3 -0
  10. package/dist/components/Button/lib/variantToBackground.d.ts.map +1 -0
  11. package/dist/components/Button/lib/variantToFont.d.ts +3 -0
  12. package/dist/components/Button/lib/variantToFont.d.ts.map +1 -0
  13. package/dist/components/Checkbox/index.d.ts.map +1 -1
  14. package/dist/components/Checkbox/index.story.d.ts +6 -16
  15. package/dist/components/Checkbox/index.story.d.ts.map +1 -1
  16. package/dist/components/Clickable/index.story.d.ts +4 -6
  17. package/dist/components/Clickable/index.story.d.ts.map +1 -1
  18. package/dist/components/DropdownSelector/ListItem/index.story.d.ts +7 -7
  19. package/dist/components/DropdownSelector/ListItem/index.story.d.ts.map +1 -1
  20. package/dist/components/DropdownSelector/MenuList/index.story.d.ts +6 -9
  21. package/dist/components/DropdownSelector/MenuList/index.story.d.ts.map +1 -1
  22. package/dist/components/DropdownSelector/Popover/index.story.d.ts +3 -7
  23. package/dist/components/DropdownSelector/Popover/index.story.d.ts.map +1 -1
  24. package/dist/components/DropdownSelector/index.d.ts.map +1 -1
  25. package/dist/components/DropdownSelector/index.story.d.ts +9 -11
  26. package/dist/components/DropdownSelector/index.story.d.ts.map +1 -1
  27. package/dist/components/Icon/index.story.d.ts +4 -26
  28. package/dist/components/Icon/index.story.d.ts.map +1 -1
  29. package/dist/components/IconButton/index.d.ts +1 -0
  30. package/dist/components/IconButton/index.d.ts.map +1 -1
  31. package/dist/components/IconButton/index.story.d.ts +6 -25
  32. package/dist/components/IconButton/index.story.d.ts.map +1 -1
  33. package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts +8 -0
  34. package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts.map +1 -0
  35. package/dist/components/LoadingSpinner/index.d.ts +2 -2
  36. package/dist/components/LoadingSpinner/index.d.ts.map +1 -1
  37. package/dist/components/LoadingSpinner/index.story.d.ts +4 -7
  38. package/dist/components/LoadingSpinner/index.story.d.ts.map +1 -1
  39. package/dist/components/Modal/index.story.d.ts +16 -41
  40. package/dist/components/Modal/index.story.d.ts.map +1 -1
  41. package/dist/components/MultiSelect/index.d.ts.map +1 -1
  42. package/dist/components/Radio/index.d.ts +0 -2
  43. package/dist/components/Radio/index.d.ts.map +1 -1
  44. package/dist/components/Radio/index.story.d.ts +12 -23
  45. package/dist/components/Radio/index.story.d.ts.map +1 -1
  46. package/dist/components/SegmentedControl/RadioGroupContext.d.ts +1 -1
  47. package/dist/components/SegmentedControl/RadioGroupContext.d.ts.map +1 -1
  48. package/dist/components/SegmentedControl/index.story.d.ts +5 -8
  49. package/dist/components/SegmentedControl/index.story.d.ts.map +1 -1
  50. package/dist/components/Switch/index.d.ts.map +1 -1
  51. package/dist/components/Switch/index.story.d.ts +7 -12
  52. package/dist/components/Switch/index.story.d.ts.map +1 -1
  53. package/dist/components/TagItem/index.d.ts.map +1 -1
  54. package/dist/components/TagItem/index.story.d.ts +14 -24
  55. package/dist/components/TagItem/index.story.d.ts.map +1 -1
  56. package/dist/components/TextArea/TextArea.story.d.ts +7 -25
  57. package/dist/components/TextArea/TextArea.story.d.ts.map +1 -1
  58. package/dist/components/TextField/TextField.story.d.ts +13 -20
  59. package/dist/components/TextField/TextField.story.d.ts.map +1 -1
  60. package/dist/components/TextField/index.d.ts.map +1 -1
  61. package/dist/index.cjs.js +418 -206
  62. package/dist/index.cjs.js.map +1 -1
  63. package/dist/index.esm.js +387 -175
  64. package/dist/index.esm.js.map +1 -1
  65. package/dist/styled.d.ts +4 -4
  66. package/package.json +17 -20
  67. package/src/_lib/compat.ts +8 -0
  68. package/src/components/Button/StyledButton.tsx +71 -0
  69. package/src/components/Button/__snapshots__/index.story.storyshot +314 -118
  70. package/src/components/Button/index.story.tsx +141 -138
  71. package/src/components/Button/index.tsx +15 -104
  72. package/src/components/Button/lib/variantToBackground.tsx +19 -0
  73. package/src/components/Button/lib/variantToFont.tsx +19 -0
  74. package/src/components/Checkbox/__snapshots__/index.story.storyshot +12 -27
  75. package/src/components/Checkbox/index.story.tsx +82 -88
  76. package/src/components/Checkbox/index.tsx +2 -12
  77. package/src/components/Clickable/__snapshots__/index.story.storyshot +2 -2
  78. package/src/components/Clickable/index.story.tsx +12 -9
  79. package/src/components/DropdownSelector/DropdownMenuItem.tsx +1 -14
  80. package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +42 -37
  81. package/src/components/DropdownSelector/ListItem/index.story.tsx +8 -4
  82. package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +38 -38
  83. package/src/components/DropdownSelector/MenuList/index.story.tsx +33 -27
  84. package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +11 -5
  85. package/src/components/DropdownSelector/Popover/index.story.tsx +6 -6
  86. package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +313 -151
  87. package/src/components/DropdownSelector/index.story.tsx +207 -171
  88. package/src/components/DropdownSelector/index.tsx +22 -22
  89. package/src/components/Icon/__snapshots__/index.story.storyshot +1 -1
  90. package/src/components/Icon/index.story.tsx +8 -12
  91. package/src/components/IconButton/__snapshots__/index.story.storyshot +130 -13
  92. package/src/components/IconButton/index.story.tsx +30 -23
  93. package/src/components/IconButton/index.tsx +32 -20
  94. package/src/components/LoadingSpinner/LoadingSpinnerIcon.story.tsx +12 -0
  95. package/src/components/LoadingSpinner/__snapshots__/LoadingSpinnerIcon.story.storyshot +28 -0
  96. package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +1 -35
  97. package/src/components/LoadingSpinner/index.story.tsx +11 -54
  98. package/src/components/LoadingSpinner/index.tsx +1 -1
  99. package/src/components/Modal/__snapshots__/index.story.storyshot +231 -194
  100. package/src/components/Modal/index.story.tsx +139 -133
  101. package/src/components/MultiSelect/__snapshots__/index.story.storyshot +56 -4
  102. package/src/components/MultiSelect/index.tsx +3 -0
  103. package/src/components/Radio/__snapshots__/index.story.storyshot +981 -121
  104. package/src/components/Radio/index.story.tsx +128 -63
  105. package/src/components/Radio/index.tsx +10 -16
  106. package/src/components/SegmentedControl/RadioGroupContext.tsx +1 -1
  107. package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +11 -11
  108. package/src/components/SegmentedControl/index.story.tsx +24 -29
  109. package/src/components/SegmentedControl/index.tsx +1 -1
  110. package/src/components/Switch/__snapshots__/index.story.storyshot +184 -26
  111. package/src/components/Switch/index.story.tsx +72 -48
  112. package/src/components/Switch/index.tsx +2 -7
  113. package/src/components/TagItem/__snapshots__/index.story.storyshot +72 -33
  114. package/src/components/TagItem/index.story.tsx +154 -159
  115. package/src/components/TagItem/index.tsx +2 -6
  116. package/src/components/TextArea/TextArea.story.tsx +29 -32
  117. package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +139 -83
  118. package/src/components/TextField/TextField.story.tsx +67 -66
  119. package/src/components/TextField/__snapshots__/TextField.story.storyshot +198 -162
  120. package/src/components/TextField/index.tsx +0 -7
  121. package/dist/components/Checkbox/performance.test.d.ts +0 -4
  122. package/dist/components/Checkbox/performance.test.d.ts.map +0 -1
  123. package/dist/components/Checkbox/snapshot.test.d.ts +0 -2
  124. package/dist/components/Checkbox/snapshot.test.d.ts.map +0 -1
  125. package/src/components/Checkbox/__snapshots__/snapshot.test.tsx.snap +0 -1093
  126. package/src/components/Checkbox/performance.test.tsx +0 -30
  127. package/src/components/Checkbox/snapshot.test.tsx +0 -66
package/dist/index.esm.js CHANGED
@@ -50,7 +50,6 @@ function CharcoalProvider({
50
50
 
51
51
  // src/components/Button/index.tsx
52
52
  import { forwardRef as forwardRef3 } from "react";
53
- import styled2, { css } from "styled-components";
54
53
 
55
54
  // src/_lib/index.ts
56
55
  function unreachable(value) {
@@ -74,6 +73,45 @@ function countCodePointsInString(string) {
74
73
  return Array.from(string).length;
75
74
  }
76
75
 
76
+ // src/components/Button/lib/variantToFont.tsx
77
+ function variantToFont(variant) {
78
+ switch (variant) {
79
+ case "Overlay":
80
+ return "text5";
81
+ case "Default":
82
+ return "text2";
83
+ case "Primary":
84
+ return "text5";
85
+ case "Navigation":
86
+ return "text5";
87
+ case "Danger":
88
+ return "text5";
89
+ default:
90
+ return unreachable(variant);
91
+ }
92
+ }
93
+
94
+ // src/components/Button/lib/variantToBackground.tsx
95
+ function variantToBackground(variant) {
96
+ switch (variant) {
97
+ case "Overlay":
98
+ return "surface4";
99
+ case "Default":
100
+ return "surface3";
101
+ case "Primary":
102
+ return "brand";
103
+ case "Navigation":
104
+ return "surface6";
105
+ case "Danger":
106
+ return "assertive";
107
+ default:
108
+ return unreachable(variant);
109
+ }
110
+ }
111
+
112
+ // src/components/Button/StyledButton.tsx
113
+ import styled2, { css } from "styled-components";
114
+
77
115
  // src/components/Clickable/index.tsx
78
116
  import * as React2 from "react";
79
117
  import styled from "styled-components";
@@ -144,31 +182,8 @@ var StyledClickableDiv = styled.div`
144
182
  }
145
183
  `;
146
184
 
147
- // src/components/Button/index.tsx
148
- import { jsx as jsx4 } from "react/jsx-runtime";
149
- var Button = forwardRef3(function Button2({
150
- children,
151
- variant = "Default",
152
- size = "M",
153
- fullWidth: fixed = false,
154
- disabled = false,
155
- ...rest
156
- }, ref) {
157
- return /* @__PURE__ */ jsx4(
158
- StyledButton,
159
- {
160
- ...rest,
161
- disabled,
162
- $background: variantToBackground(variant),
163
- $color: variantToFont(variant),
164
- $size: size,
165
- $fullWidth: fixed,
166
- ref,
167
- children
168
- }
169
- );
170
- });
171
- var Button_default = Button;
185
+ // src/components/Button/StyledButton.tsx
186
+ import { focusVisibleFocusRingCss } from "@charcoal-ui/styled";
172
187
  var horizontalPaddingSmall = css`
173
188
  padding-right: 16px;
174
189
  padding-left: 16px;
@@ -191,79 +206,89 @@ var StyledButton = styled2(Clickable_default)`
191
206
  font-weight: bold;
192
207
 
193
208
  ${(p) => p.$size === "M" ? horizontalPaddingMedium : horizontalPaddingSmall}
194
-
195
209
  color: var(--charcoal-${(p) => p.$color});
196
210
  background-color: var(--charcoal-${(p) => p.$background});
197
211
  transition: 0.2s color, 0.2s background-color, 0.2s box-shadow;
198
212
 
199
213
  &:not(:disabled):not([aria-disabled]),
200
214
  &[aria-disabled='false'] {
201
- &:active,
202
- &:focus,
203
- &:focus-visible {
204
- outline: none;
205
- box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
206
- }
207
-
208
- &:hover {
209
- color: var(--charcoal-${(p) => p.$color}-hover);
210
- background-color: var(--charcoal-${(p) => p.$background}-hover);
211
- }
212
- &:active {
213
- color: var(--charcoal-${(p) => p.$color}-press);
214
- background-color: var(--charcoal-${(p) => p.$background}-press);
215
- }
215
+ ${focusVisibleFocusRingCss}
216
+
217
+ ${({ $isActive: $active, $color, $background }) => $active ? css`
218
+ color: var(--charcoal-${$color}-press);
219
+ background-color: var(--charcoal-${$background}-press);
220
+ ` : css`
221
+ &:hover {
222
+ color: var(--charcoal-${$color}-hover);
223
+ background-color: var(--charcoal-${$background}-hover);
224
+ }
225
+ &:active {
226
+ color: var(--charcoal-${$color}-press);
227
+ background-color: var(--charcoal-${$background}-press);
228
+ }
229
+ `}
216
230
  }
217
231
 
218
232
  &:disabled,
219
233
  &[aria-disabled]:not([aria-disabled='false']) {
220
234
  opacity: 0.32;
221
235
  }
222
-
223
- /* よく考えたらheight=32って定義が存在しないな... */
224
236
  height: ${(p) => p.$size === "M" ? 40 : 32}px;
225
237
  `;
226
- function variantToBackground(variant) {
227
- switch (variant) {
228
- case "Overlay":
229
- return "surface4";
230
- case "Default":
231
- return "surface3";
232
- case "Primary":
233
- return "brand";
234
- case "Navigation":
235
- return "surface6";
236
- case "Danger":
237
- return "assertive";
238
- default:
239
- return unreachable(variant);
240
- }
241
- }
242
- function variantToFont(variant) {
243
- switch (variant) {
244
- case "Overlay":
245
- return "text5";
246
- case "Default":
247
- return "text2";
248
- case "Primary":
249
- return "text5";
250
- case "Navigation":
251
- return "text5";
252
- case "Danger":
253
- return "text5";
254
- default:
255
- return unreachable(variant);
256
- }
257
- }
238
+
239
+ // src/components/Button/index.tsx
240
+ import { jsx as jsx4 } from "react/jsx-runtime";
241
+ var Button = forwardRef3(function Button2({
242
+ children,
243
+ variant = "Default",
244
+ size = "M",
245
+ fullWidth: fixed = false,
246
+ disabled = false,
247
+ isActive = false,
248
+ ...rest
249
+ }, ref) {
250
+ return /* @__PURE__ */ jsx4(
251
+ StyledButton,
252
+ {
253
+ ...rest,
254
+ disabled,
255
+ $background: variantToBackground(variant),
256
+ $color: variantToFont(variant),
257
+ $size: size,
258
+ $fullWidth: fixed,
259
+ $isActive: isActive,
260
+ ref,
261
+ children
262
+ }
263
+ );
264
+ });
265
+ var Button_default = Button;
258
266
 
259
267
  // src/components/IconButton/index.tsx
260
268
  import { forwardRef as forwardRef4 } from "react";
261
- import styled3 from "styled-components";
269
+ import styled3, { css as css2 } from "styled-components";
270
+ import { focusVisibleFocusRingCss as focusVisibleFocusRingCss2 } from "@charcoal-ui/styled";
262
271
  import { jsx as jsx5 } from "react/jsx-runtime";
263
272
  var IconButton = forwardRef4(
264
- function IconButtonInner({ variant = "Default", size = "M", icon, ...rest }, ref) {
273
+ function IconButtonInner({
274
+ variant = "Default",
275
+ size = "M",
276
+ icon,
277
+ isActive = false,
278
+ ...rest
279
+ }, ref) {
265
280
  validateIconSize(size, icon);
266
- return /* @__PURE__ */ jsx5(StyledIconButton, { ...rest, ref, $size: size, $variant: variant, children: /* @__PURE__ */ jsx5("pixiv-icon", { name: icon }) });
281
+ return /* @__PURE__ */ jsx5(
282
+ StyledIconButton,
283
+ {
284
+ ...rest,
285
+ ref,
286
+ $size: size,
287
+ $variant: variant,
288
+ $isActive: isActive,
289
+ children: /* @__PURE__ */ jsx5("pixiv-icon", { name: icon })
290
+ }
291
+ );
267
292
  }
268
293
  );
269
294
  var IconButton_default = IconButton;
@@ -282,22 +307,17 @@ var StyledIconButton = styled3(Clickable_default).attrs(styledProps)`
282
307
 
283
308
  &:not(:disabled):not([aria-disabled]),
284
309
  &[aria-disabled='false'] {
285
- &:hover {
286
- background-color: var(
287
- ${({ $background }) => `--charcoal-${$background}-hover`}
288
- );
289
- }
290
- &:active {
291
- background-color: var(
292
- ${({ $background }) => `--charcoal-${$background}-press`}
293
- );
294
- }
295
- &:focus,
296
- &:active,
297
- &:focus-visible {
298
- outline: none;
299
- box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
300
- }
310
+ ${({ $isActive, $background }) => $isActive ? css2`
311
+ background-color: var(--charcoal-${$background}-press);
312
+ ` : css2`
313
+ &:hover {
314
+ background-color: var(--charcoal-${$background}-hover);
315
+ }
316
+ &:active {
317
+ background-color: var(--charcoal-${$background}-press);
318
+ }
319
+ `}
320
+ ${focusVisibleFocusRingCss2}
301
321
  }
302
322
 
303
323
  &:disabled,
@@ -364,8 +384,9 @@ function validateIconSize(size, icon) {
364
384
  // src/components/Radio/index.tsx
365
385
  import { memo, forwardRef as forwardRef5, useCallback, useContext as useContext2 } from "react";
366
386
  import * as React3 from "react";
367
- import styled4, { css as css2 } from "styled-components";
387
+ import styled4 from "styled-components";
368
388
  import warning from "warning";
389
+ import { focusVisibleFocusRingCss as focusVisibleFocusRingCss3 } from "@charcoal-ui/styled";
369
390
  import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
370
391
  var Radio = forwardRef5(function RadioInner({ value, disabled = false, children, className }, ref) {
371
392
  const {
@@ -396,7 +417,7 @@ var Radio = forwardRef5(function RadioInner({ value, disabled = false, children,
396
417
  name,
397
418
  value,
398
419
  checked: isSelected,
399
- invalid,
420
+ "aria-invalid": invalid,
400
421
  onChange: handleChange,
401
422
  disabled: isDisabled || isReadonly,
402
423
  ref
@@ -437,21 +458,18 @@ var RadioInput = styled4.input.attrs({ type: "radio" })`
437
458
 
438
459
  &:not(:disabled):not([aria-disabled]),
439
460
  &[aria-disabled='false'] {
440
- ${({ invalid = false }) => invalid && css2`
441
- box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
442
- `}
443
-
444
461
  &:hover {
445
462
  background-color: var(--charcoal-surface1-hover);
446
463
  }
447
464
  &:active {
448
465
  background-color: var(--charcoal-surface1-press);
449
466
  }
450
- &:focus,
451
- &:active,
452
- &:focus-visible {
453
- outline: none;
454
- box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
467
+ ${focusVisibleFocusRingCss3}
468
+ &[aria-invalid='true'] {
469
+ box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
470
+ &:focus {
471
+ box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
472
+ }
455
473
  }
456
474
  }
457
475
 
@@ -595,6 +613,7 @@ var MultiSelectGroupContext = createContext3({
595
613
  });
596
614
 
597
615
  // src/components/MultiSelect/index.tsx
616
+ import { focusVisibleFocusRingCss as focusVisibleFocusRingCss4 } from "@charcoal-ui/styled";
598
617
  import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
599
618
  var MultiSelect = forwardRef6(
600
619
  function MultiSelectInner({
@@ -739,6 +758,8 @@ var MultiSelectInput = styled5.input.attrs({ type: "checkbox" })`
739
758
  }
740
759
  }
741
760
 
761
+ ${focusVisibleFocusRingCss4}
762
+
742
763
  ${({ invalid, overlay }) => invalid && !overlay && css3`
743
764
  &:not(:disabled):not([aria-disabled]),
744
765
  &[aria-disabled='false'] {
@@ -824,6 +845,7 @@ import { useMemo, memo as memo3, forwardRef as forwardRef7 } from "react";
824
845
  import { useToggleState } from "react-stately";
825
846
  import styled6 from "styled-components";
826
847
  import { useObjectRef } from "@react-aria/utils";
848
+ import { focusVisibleFocusRingCss as focusVisibleFocusRingCss5 } from "@charcoal-ui/styled";
827
849
  import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
828
850
  var SwitchCheckbox = forwardRef7(
829
851
  function SwitchCheckboxInner(props, external) {
@@ -861,10 +883,6 @@ var Label = styled6.label`
861
883
  opacity: 0.32;
862
884
  cursor: default;
863
885
  }
864
-
865
- :active > input {
866
- box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
867
- }
868
886
  `;
869
887
  var LabelInner = styled6.div`
870
888
  font-size: 14px;
@@ -895,9 +913,7 @@ var SwitchInput = styled6.input.attrs({ type: "checkbox" })`
895
913
  :active {
896
914
  background-color: var(--charcoal-text4-press);
897
915
  }
898
- :focus {
899
- box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
900
- }
916
+ ${focusVisibleFocusRingCss5}
901
917
 
902
918
  &::after {
903
919
  content: '';
@@ -1208,13 +1224,6 @@ var StyledInputContainer = styled8.div`
1208
1224
  background-color: var(--charcoal-surface3-hover);
1209
1225
  }
1210
1226
 
1211
- :not(:disabled):not([aria-disabled]):active,
1212
- [aria-disabled='false']:active {
1213
- outline: none;
1214
- box-shadow: 0 0 0 4px
1215
- ${(p) => p.invalid ? `rgba(255,43,0,0.32)` : `rgba(0, 150, 250, 0.32);`};
1216
- }
1217
-
1218
1227
  :focus-within {
1219
1228
  outline: none;
1220
1229
  box-shadow: 0 0 0 4px
@@ -2099,6 +2108,7 @@ var StyledUl = styled15.ul`
2099
2108
  `;
2100
2109
 
2101
2110
  // src/components/DropdownSelector/index.tsx
2111
+ import { focusVisibleFocusRingCss as focusVisibleFocusRingCss6 } from "@charcoal-ui/styled";
2102
2112
  import { jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
2103
2113
  var defaultRequiredText = "*\u5FC5\u9808";
2104
2114
  function DropdownSelector(props) {
@@ -2127,6 +2137,7 @@ function DropdownSelector(props) {
2127
2137
  },
2128
2138
  ref: triggerRef,
2129
2139
  type: "button",
2140
+ $active: isOpen,
2130
2141
  children: [
2131
2142
  /* @__PURE__ */ jsx20(DropdownButtonText, { children: props.placeholder !== void 0 && preview === void 0 ? props.placeholder : preview }),
2132
2143
  /* @__PURE__ */ jsx20(DropdownButtonIcon, { name: "16/Menu" })
@@ -2179,6 +2190,7 @@ var DropdownButton = styled16.button`
2179
2190
  box-sizing: border-box;
2180
2191
  border: none;
2181
2192
  cursor: pointer;
2193
+ gap: 4px;
2182
2194
 
2183
2195
  ${disabledSelector2} {
2184
2196
  cursor: default;
@@ -2189,16 +2201,21 @@ var DropdownButton = styled16.button`
2189
2201
  background-color: var(--charcoal-surface3);
2190
2202
  border-radius: 4px;
2191
2203
 
2192
- transition: 0.2s box-shadow;
2204
+ transition: 0.2s box-shadow, 0.2s background-color;
2193
2205
 
2194
2206
  &:not(:disabled):not([aria-disabled]),
2195
2207
  &[aria-disabled='false'] {
2196
- &:focus,
2197
- &:active,
2198
- &:focus-visible {
2199
- outline: none;
2200
- box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
2201
- }
2208
+ ${focusVisibleFocusRingCss6}
2209
+ ${({ $active }) => $active === true ? css9`
2210
+ background-color: var(--charcoal-surface3-press);
2211
+ ` : css9`
2212
+ &:hover {
2213
+ background-color: var(--charcoal-surface3-hover);
2214
+ }
2215
+ &:active {
2216
+ background-color: var(--charcoal-surface3-press);
2217
+ }
2218
+ `}
2202
2219
  }
2203
2220
 
2204
2221
  ${({ invalid }) => invalid === true && css9`
@@ -2214,20 +2231,9 @@ var DropdownButtonText = styled16.span`
2214
2231
  line-height: 22px;
2215
2232
  display: flow-root;
2216
2233
  color: var(--charcoal-text2);
2217
- &::before {
2218
- display: block;
2219
- width: 0;
2220
- height: 0;
2221
- content: '';
2222
- margin-top: -4px;
2223
- }
2224
- &::after {
2225
- display: block;
2226
- width: 0;
2227
- height: 0;
2228
- content: '';
2229
- margin-bottom: -4px;
2230
- }
2234
+ overflow: hidden;
2235
+ text-overflow: ellipsis;
2236
+ white-space: nowrap;
2231
2237
  `;
2232
2238
  var DropdownButtonIcon = styled16(Icon_default)`
2233
2239
  color: var(--charcoal-text2);
@@ -2395,20 +2401,7 @@ var StyledSpan = styled18.span`
2395
2401
  font-size: 14px;
2396
2402
  line-height: 22px;
2397
2403
  color: var(--charcoal-text2);
2398
- &::before {
2399
- display: block;
2400
- width: 0;
2401
- height: 0;
2402
- content: '';
2403
- margin-top: -4px;
2404
- }
2405
- &::after {
2406
- display: block;
2407
- width: 0;
2408
- height: 0;
2409
- content: '';
2410
- margin-bottom: -4px;
2411
- }
2404
+ padding: 9px 0;
2412
2405
 
2413
2406
  display: flex;
2414
2407
  align-items: center;
@@ -2449,7 +2442,240 @@ var StyledLi2 = styled19.li`
2449
2442
 
2450
2443
  // src/components/SegmentedControl/index.tsx
2451
2444
  import { forwardRef as forwardRef15, memo as memo6, useMemo as useMemo2, useRef as useRef10 } from "react";
2452
- import { useRadioGroupState } from "react-stately";
2445
+
2446
+ // ../../node_modules/@react-stately/form/dist/import.mjs
2447
+ import { createContext as $jcIOw$createContext, useMemo as $jcIOw$useMemo, useContext as $jcIOw$useContext, useState as $jcIOw$useState, useRef as $jcIOw$useRef, useEffect as $jcIOw$useEffect } from "react";
2448
+ var $e5be200c675c3b3a$export$aca958c65c314e6c = {
2449
+ badInput: false,
2450
+ customError: false,
2451
+ patternMismatch: false,
2452
+ rangeOverflow: false,
2453
+ rangeUnderflow: false,
2454
+ stepMismatch: false,
2455
+ tooLong: false,
2456
+ tooShort: false,
2457
+ typeMismatch: false,
2458
+ valueMissing: false,
2459
+ valid: true
2460
+ };
2461
+ var $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE = {
2462
+ ...$e5be200c675c3b3a$export$aca958c65c314e6c,
2463
+ customError: true,
2464
+ valid: false
2465
+ };
2466
+ var $e5be200c675c3b3a$export$dad6ae84456c676a = {
2467
+ isInvalid: false,
2468
+ validationDetails: $e5be200c675c3b3a$export$aca958c65c314e6c,
2469
+ validationErrors: []
2470
+ };
2471
+ var $e5be200c675c3b3a$export$571b5131b7e65c11 = (0, $jcIOw$createContext)({});
2472
+ var $e5be200c675c3b3a$export$a763b9476acd3eb = "__formValidationState" + Date.now();
2473
+ function $e5be200c675c3b3a$export$fc1a364ae1f3ff10(props) {
2474
+ if (props[$e5be200c675c3b3a$export$a763b9476acd3eb]) {
2475
+ let { realtimeValidation, displayValidation, updateValidation, resetValidation, commitValidation } = props[$e5be200c675c3b3a$export$a763b9476acd3eb];
2476
+ return {
2477
+ realtimeValidation,
2478
+ displayValidation,
2479
+ updateValidation,
2480
+ resetValidation,
2481
+ commitValidation
2482
+ };
2483
+ }
2484
+ return $e5be200c675c3b3a$var$useFormValidationStateImpl(props);
2485
+ }
2486
+ function $e5be200c675c3b3a$var$useFormValidationStateImpl(props) {
2487
+ let { isInvalid, validationState, name, value, builtinValidation, validate, validationBehavior = "aria" } = props;
2488
+ if (validationState)
2489
+ isInvalid || (isInvalid = validationState === "invalid");
2490
+ let controlledError = isInvalid ? {
2491
+ isInvalid: true,
2492
+ validationErrors: [],
2493
+ validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE
2494
+ } : null;
2495
+ let clientError = (0, $jcIOw$useMemo)(() => $e5be200c675c3b3a$var$getValidationResult($e5be200c675c3b3a$var$runValidate(validate, value)), [
2496
+ validate,
2497
+ value
2498
+ ]);
2499
+ if (builtinValidation === null || builtinValidation === void 0 ? void 0 : builtinValidation.validationDetails.valid)
2500
+ builtinValidation = null;
2501
+ let serverErrors = (0, $jcIOw$useContext)($e5be200c675c3b3a$export$571b5131b7e65c11);
2502
+ let serverErrorMessages = (0, $jcIOw$useMemo)(() => {
2503
+ if (name)
2504
+ return Array.isArray(name) ? name.flatMap((name2) => $e5be200c675c3b3a$var$asArray(serverErrors[name2])) : $e5be200c675c3b3a$var$asArray(serverErrors[name]);
2505
+ return [];
2506
+ }, [
2507
+ serverErrors,
2508
+ name
2509
+ ]);
2510
+ let [lastServerErrors, setLastServerErrors] = (0, $jcIOw$useState)(serverErrors);
2511
+ let [isServerErrorCleared, setServerErrorCleared] = (0, $jcIOw$useState)(false);
2512
+ if (serverErrors !== lastServerErrors) {
2513
+ setLastServerErrors(serverErrors);
2514
+ setServerErrorCleared(false);
2515
+ }
2516
+ let serverError = (0, $jcIOw$useMemo)(() => $e5be200c675c3b3a$var$getValidationResult(isServerErrorCleared ? [] : serverErrorMessages), [
2517
+ isServerErrorCleared,
2518
+ serverErrorMessages
2519
+ ]);
2520
+ let nextValidation = (0, $jcIOw$useRef)($e5be200c675c3b3a$export$dad6ae84456c676a);
2521
+ let [currentValidity, setCurrentValidity] = (0, $jcIOw$useState)($e5be200c675c3b3a$export$dad6ae84456c676a);
2522
+ let lastError = (0, $jcIOw$useRef)($e5be200c675c3b3a$export$dad6ae84456c676a);
2523
+ let commitValidation = () => {
2524
+ if (!commitQueued)
2525
+ return;
2526
+ setCommitQueued(false);
2527
+ let error = clientError || builtinValidation || nextValidation.current;
2528
+ if (!$e5be200c675c3b3a$var$isEqualValidation(error, lastError.current)) {
2529
+ lastError.current = error;
2530
+ setCurrentValidity(error);
2531
+ }
2532
+ };
2533
+ let [commitQueued, setCommitQueued] = (0, $jcIOw$useState)(false);
2534
+ (0, $jcIOw$useEffect)(commitValidation);
2535
+ let realtimeValidation = controlledError || serverError || clientError || builtinValidation || $e5be200c675c3b3a$export$dad6ae84456c676a;
2536
+ let displayValidation = validationBehavior === "native" ? controlledError || serverError || currentValidity : controlledError || serverError || clientError || builtinValidation || currentValidity;
2537
+ return {
2538
+ realtimeValidation,
2539
+ displayValidation,
2540
+ updateValidation(value2) {
2541
+ if (validationBehavior === "aria" && !$e5be200c675c3b3a$var$isEqualValidation(currentValidity, value2))
2542
+ setCurrentValidity(value2);
2543
+ else
2544
+ nextValidation.current = value2;
2545
+ },
2546
+ resetValidation() {
2547
+ let error = $e5be200c675c3b3a$export$dad6ae84456c676a;
2548
+ if (!$e5be200c675c3b3a$var$isEqualValidation(error, lastError.current)) {
2549
+ lastError.current = error;
2550
+ setCurrentValidity(error);
2551
+ }
2552
+ if (validationBehavior === "native")
2553
+ setCommitQueued(false);
2554
+ setServerErrorCleared(true);
2555
+ },
2556
+ commitValidation() {
2557
+ if (validationBehavior === "native")
2558
+ setCommitQueued(true);
2559
+ setServerErrorCleared(true);
2560
+ }
2561
+ };
2562
+ }
2563
+ function $e5be200c675c3b3a$var$asArray(v) {
2564
+ if (!v)
2565
+ return [];
2566
+ return Array.isArray(v) ? v : [
2567
+ v
2568
+ ];
2569
+ }
2570
+ function $e5be200c675c3b3a$var$runValidate(validate, value) {
2571
+ if (typeof validate === "function") {
2572
+ let e = validate(value);
2573
+ if (e && typeof e !== "boolean")
2574
+ return $e5be200c675c3b3a$var$asArray(e);
2575
+ }
2576
+ return [];
2577
+ }
2578
+ function $e5be200c675c3b3a$var$getValidationResult(errors) {
2579
+ return errors.length ? {
2580
+ isInvalid: true,
2581
+ validationErrors: errors,
2582
+ validationDetails: $e5be200c675c3b3a$var$CUSTOM_VALIDITY_STATE
2583
+ } : null;
2584
+ }
2585
+ function $e5be200c675c3b3a$var$isEqualValidation(a, b) {
2586
+ if (a === b)
2587
+ return true;
2588
+ return a && b && a.isInvalid === b.isInvalid && a.validationErrors.length === b.validationErrors.length && a.validationErrors.every((a2, i) => a2 === b.validationErrors[i]) && Object.entries(a.validationDetails).every(([k, v]) => b.validationDetails[k] === v);
2589
+ }
2590
+
2591
+ // ../../node_modules/@react-stately/utils/dist/import.mjs
2592
+ import { useState as $6imuh$useState, useRef as $6imuh$useRef, useEffect as $6imuh$useEffect, useCallback as $6imuh$useCallback } from "react";
2593
+ function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange) {
2594
+ let [stateValue, setStateValue] = (0, $6imuh$useState)(value || defaultValue);
2595
+ let isControlledRef = (0, $6imuh$useRef)(value !== void 0);
2596
+ let isControlled = value !== void 0;
2597
+ (0, $6imuh$useEffect)(() => {
2598
+ let wasControlled = isControlledRef.current;
2599
+ if (wasControlled !== isControlled)
2600
+ console.warn(`WARN: A component changed from ${wasControlled ? "controlled" : "uncontrolled"} to ${isControlled ? "controlled" : "uncontrolled"}.`);
2601
+ isControlledRef.current = isControlled;
2602
+ }, [
2603
+ isControlled
2604
+ ]);
2605
+ let currentValue = isControlled ? value : stateValue;
2606
+ let setValue = (0, $6imuh$useCallback)((value2, ...args) => {
2607
+ let onChangeCaller = (value3, ...onChangeArgs) => {
2608
+ if (onChange) {
2609
+ if (!Object.is(currentValue, value3))
2610
+ onChange(value3, ...onChangeArgs);
2611
+ }
2612
+ if (!isControlled)
2613
+ currentValue = value3;
2614
+ };
2615
+ if (typeof value2 === "function") {
2616
+ console.warn("We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320");
2617
+ let updateFunction = (oldValue, ...functionArgs) => {
2618
+ let interceptedValue = value2(isControlled ? currentValue : oldValue, ...functionArgs);
2619
+ onChangeCaller(interceptedValue, ...args);
2620
+ if (!isControlled)
2621
+ return interceptedValue;
2622
+ return oldValue;
2623
+ };
2624
+ setStateValue(updateFunction);
2625
+ } else {
2626
+ if (!isControlled)
2627
+ setStateValue(value2);
2628
+ onChangeCaller(value2, ...args);
2629
+ }
2630
+ }, [
2631
+ isControlled,
2632
+ currentValue,
2633
+ onChange
2634
+ ]);
2635
+ return [
2636
+ currentValue,
2637
+ setValue
2638
+ ];
2639
+ }
2640
+
2641
+ // ../../node_modules/@react-stately/radio/dist/import.mjs
2642
+ import { useMemo as $fQ2SF$useMemo, useState as $fQ2SF$useState } from "react";
2643
+ var $a54cdc5c1942b639$var$instance = Math.round(Math.random() * 1e10);
2644
+ var $a54cdc5c1942b639$var$i = 0;
2645
+ function $a54cdc5c1942b639$export$bca9d026f8e704eb(props) {
2646
+ let name = (0, $fQ2SF$useMemo)(() => props.name || `radio-group-${$a54cdc5c1942b639$var$instance}-${++$a54cdc5c1942b639$var$i}`, [
2647
+ props.name
2648
+ ]);
2649
+ var _props_defaultValue;
2650
+ let [selectedValue, setSelected] = (0, $458b0a5536c1a7cf$export$40bfa8c7b0832715)(props.value, (_props_defaultValue = props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : null, props.onChange);
2651
+ let [lastFocusedValue, setLastFocusedValue] = (0, $fQ2SF$useState)(null);
2652
+ let validation = (0, $e5be200c675c3b3a$export$fc1a364ae1f3ff10)({
2653
+ ...props,
2654
+ value: selectedValue
2655
+ });
2656
+ let setSelectedValue = (value) => {
2657
+ if (!props.isReadOnly && !props.isDisabled) {
2658
+ setSelected(value);
2659
+ validation.commitValidation();
2660
+ }
2661
+ };
2662
+ let isInvalid = validation.displayValidation.isInvalid;
2663
+ return {
2664
+ ...validation,
2665
+ name,
2666
+ selectedValue,
2667
+ setSelectedValue,
2668
+ lastFocusedValue,
2669
+ setLastFocusedValue,
2670
+ isDisabled: props.isDisabled || false,
2671
+ isReadOnly: props.isReadOnly || false,
2672
+ isRequired: props.isRequired || false,
2673
+ validationState: props.validationState || (isInvalid ? "invalid" : null),
2674
+ isInvalid
2675
+ };
2676
+ }
2677
+
2678
+ // src/components/SegmentedControl/index.tsx
2453
2679
  import {
2454
2680
  useRadio,
2455
2681
  useRadioGroup
@@ -2487,7 +2713,7 @@ var SegmentedControl = forwardRef15(
2487
2713
  }),
2488
2714
  [props]
2489
2715
  );
2490
- const state = useRadioGroupState(ariaRadioGroupProps);
2716
+ const state = $a54cdc5c1942b639$export$bca9d026f8e704eb(ariaRadioGroupProps);
2491
2717
  const { radioGroupProps } = useRadioGroup(ariaRadioGroupProps, state);
2492
2718
  const segmentedControlItems = useMemo2(() => {
2493
2719
  return props.data.map(
@@ -2619,6 +2845,7 @@ import { useCheckbox } from "@react-aria/checkbox";
2619
2845
  import { useObjectRef as useObjectRef3 } from "@react-aria/utils";
2620
2846
  import { useToggleState as useToggleState2 } from "react-stately";
2621
2847
  import { disabledSelector as disabledSelector3 } from "@charcoal-ui/utils";
2848
+ import { focusVisibleFocusRingCss as focusVisibleFocusRingCss7 } from "@charcoal-ui/styled";
2622
2849
  import { jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
2623
2850
  var Checkbox = forwardRef16(
2624
2851
  function CheckboxInner({ invalid = false, ...props }, ref) {
@@ -2696,18 +2923,7 @@ var CheckboxInput = styled21.input`
2696
2923
 
2697
2924
  &:not(:disabled):not([aria-disabled]),
2698
2925
  &[aria-disabled='false'] {
2699
- &:focus,
2700
- &:active {
2701
- outline: none;
2702
- box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
2703
- &:not(:focus-visible) {
2704
- outline: none;
2705
- }
2706
- }
2707
- &:focus-visible {
2708
- outline: none;
2709
- box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
2710
- }
2926
+ ${focusVisibleFocusRingCss7}
2711
2927
  &[aria-invalid='true'] {
2712
2928
  box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
2713
2929
  }
@@ -2747,6 +2963,7 @@ import { useObjectRef as useObjectRef4 } from "@react-aria/utils";
2747
2963
  import styled22, { css as css12 } from "styled-components";
2748
2964
  import { px as px2 } from "@charcoal-ui/utils";
2749
2965
  import { useButton } from "@react-aria/button";
2966
+ import { focusVisibleFocusRingCss as focusVisibleFocusRingCss8 } from "@charcoal-ui/styled";
2750
2967
  import { jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
2751
2968
  var sizeMap = {
2752
2969
  S: 32,
@@ -2830,12 +3047,7 @@ var TagItemRoot = styled22.a`
2830
3047
 
2831
3048
  &:not(:disabled):not([aria-disabled]),
2832
3049
  &[aria-disabled='false'] {
2833
- &:focus,
2834
- &:active,
2835
- &:focus-visible {
2836
- outline: none;
2837
- box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
2838
- }
3050
+ ${focusVisibleFocusRingCss8}
2839
3051
  }
2840
3052
 
2841
3053
  &:disabled,