@charcoal-ui/react 3.7.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 (100) hide show
  1. package/dist/components/Button/StyledButton.d.ts +1 -0
  2. package/dist/components/Button/StyledButton.d.ts.map +1 -1
  3. package/dist/components/Button/index.d.ts +1 -0
  4. package/dist/components/Button/index.d.ts.map +1 -1
  5. package/dist/components/Button/index.story.d.ts +16 -32
  6. package/dist/components/Button/index.story.d.ts.map +1 -1
  7. package/dist/components/Checkbox/index.d.ts.map +1 -1
  8. package/dist/components/DropdownSelector/ListItem/index.story.d.ts +7 -7
  9. package/dist/components/DropdownSelector/ListItem/index.story.d.ts.map +1 -1
  10. package/dist/components/DropdownSelector/MenuList/index.story.d.ts +6 -9
  11. package/dist/components/DropdownSelector/MenuList/index.story.d.ts.map +1 -1
  12. package/dist/components/DropdownSelector/Popover/index.story.d.ts +3 -7
  13. package/dist/components/DropdownSelector/Popover/index.story.d.ts.map +1 -1
  14. package/dist/components/DropdownSelector/index.d.ts.map +1 -1
  15. package/dist/components/DropdownSelector/index.story.d.ts +9 -12
  16. package/dist/components/DropdownSelector/index.story.d.ts.map +1 -1
  17. package/dist/components/Icon/index.story.d.ts +4 -26
  18. package/dist/components/Icon/index.story.d.ts.map +1 -1
  19. package/dist/components/IconButton/index.d.ts +1 -0
  20. package/dist/components/IconButton/index.d.ts.map +1 -1
  21. package/dist/components/IconButton/index.story.d.ts +6 -25
  22. package/dist/components/IconButton/index.story.d.ts.map +1 -1
  23. package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts +8 -0
  24. package/dist/components/LoadingSpinner/LoadingSpinnerIcon.story.d.ts.map +1 -0
  25. package/dist/components/LoadingSpinner/index.d.ts +2 -2
  26. package/dist/components/LoadingSpinner/index.d.ts.map +1 -1
  27. package/dist/components/LoadingSpinner/index.story.d.ts +4 -7
  28. package/dist/components/LoadingSpinner/index.story.d.ts.map +1 -1
  29. package/dist/components/Modal/index.story.d.ts +16 -41
  30. package/dist/components/Modal/index.story.d.ts.map +1 -1
  31. package/dist/components/MultiSelect/index.d.ts.map +1 -1
  32. package/dist/components/Radio/index.d.ts +0 -2
  33. package/dist/components/Radio/index.d.ts.map +1 -1
  34. package/dist/components/Radio/index.story.d.ts +12 -23
  35. package/dist/components/Radio/index.story.d.ts.map +1 -1
  36. package/dist/components/SegmentedControl/index.story.d.ts +5 -8
  37. package/dist/components/SegmentedControl/index.story.d.ts.map +1 -1
  38. package/dist/components/Switch/index.d.ts.map +1 -1
  39. package/dist/components/Switch/index.story.d.ts +7 -12
  40. package/dist/components/Switch/index.story.d.ts.map +1 -1
  41. package/dist/components/TagItem/index.d.ts.map +1 -1
  42. package/dist/components/TagItem/index.story.d.ts +14 -24
  43. package/dist/components/TagItem/index.story.d.ts.map +1 -1
  44. package/dist/components/TextArea/TextArea.story.d.ts +7 -25
  45. package/dist/components/TextArea/TextArea.story.d.ts.map +1 -1
  46. package/dist/components/TextField/TextField.story.d.ts +13 -20
  47. package/dist/components/TextField/TextField.story.d.ts.map +1 -1
  48. package/dist/components/TextField/index.d.ts.map +1 -1
  49. package/dist/index.cjs.js +80 -86
  50. package/dist/index.cjs.js.map +1 -1
  51. package/dist/index.esm.js +80 -86
  52. package/dist/index.esm.js.map +1 -1
  53. package/dist/styled.d.ts +4 -4
  54. package/package.json +6 -6
  55. package/src/components/Button/StyledButton.tsx +19 -14
  56. package/src/components/Button/__snapshots__/index.story.storyshot +314 -118
  57. package/src/components/Button/index.story.tsx +141 -138
  58. package/src/components/Button/index.tsx +3 -0
  59. package/src/components/Checkbox/__snapshots__/index.story.storyshot +12 -27
  60. package/src/components/Checkbox/index.tsx +2 -12
  61. package/src/components/Clickable/__snapshots__/index.story.storyshot +2 -2
  62. package/src/components/DropdownSelector/ListItem/__snapshots__/index.story.storyshot +42 -37
  63. package/src/components/DropdownSelector/ListItem/index.story.tsx +8 -4
  64. package/src/components/DropdownSelector/MenuList/__snapshots__/index.story.storyshot +38 -38
  65. package/src/components/DropdownSelector/MenuList/index.story.tsx +33 -27
  66. package/src/components/DropdownSelector/Popover/__snapshots__/index.story.storyshot +11 -5
  67. package/src/components/DropdownSelector/Popover/index.story.tsx +6 -6
  68. package/src/components/DropdownSelector/__snapshots__/index.story.storyshot +145 -47
  69. package/src/components/DropdownSelector/index.story.tsx +207 -204
  70. package/src/components/DropdownSelector/index.tsx +17 -10
  71. package/src/components/Icon/__snapshots__/index.story.storyshot +1 -1
  72. package/src/components/Icon/index.story.tsx +8 -12
  73. package/src/components/IconButton/__snapshots__/index.story.storyshot +130 -13
  74. package/src/components/IconButton/index.story.tsx +30 -23
  75. package/src/components/IconButton/index.tsx +32 -20
  76. package/src/components/LoadingSpinner/LoadingSpinnerIcon.story.tsx +12 -0
  77. package/src/components/LoadingSpinner/__snapshots__/LoadingSpinnerIcon.story.storyshot +28 -0
  78. package/src/components/LoadingSpinner/__snapshots__/index.story.storyshot +1 -35
  79. package/src/components/LoadingSpinner/index.story.tsx +11 -54
  80. package/src/components/LoadingSpinner/index.tsx +1 -1
  81. package/src/components/Modal/__snapshots__/index.story.storyshot +212 -171
  82. package/src/components/Modal/index.story.tsx +139 -133
  83. package/src/components/MultiSelect/__snapshots__/index.story.storyshot +56 -4
  84. package/src/components/MultiSelect/index.tsx +3 -0
  85. package/src/components/Radio/__snapshots__/index.story.storyshot +981 -121
  86. package/src/components/Radio/index.story.tsx +128 -63
  87. package/src/components/Radio/index.tsx +10 -16
  88. package/src/components/SegmentedControl/__snapshots__/index.story.storyshot +2 -2
  89. package/src/components/SegmentedControl/index.story.tsx +24 -29
  90. package/src/components/Switch/__snapshots__/index.story.storyshot +184 -26
  91. package/src/components/Switch/index.story.tsx +72 -48
  92. package/src/components/Switch/index.tsx +2 -7
  93. package/src/components/TagItem/__snapshots__/index.story.storyshot +72 -33
  94. package/src/components/TagItem/index.story.tsx +154 -159
  95. package/src/components/TagItem/index.tsx +2 -6
  96. package/src/components/TextArea/TextArea.story.tsx +29 -32
  97. package/src/components/TextArea/__snapshots__/TextArea.story.storyshot +127 -73
  98. package/src/components/TextField/TextField.story.tsx +67 -66
  99. package/src/components/TextField/__snapshots__/TextField.story.storyshot +182 -147
  100. package/src/components/TextField/index.tsx +0 -7
package/dist/index.esm.js CHANGED
@@ -183,6 +183,7 @@ var StyledClickableDiv = styled.div`
183
183
  `;
184
184
 
185
185
  // src/components/Button/StyledButton.tsx
186
+ import { focusVisibleFocusRingCss } from "@charcoal-ui/styled";
186
187
  var horizontalPaddingSmall = css`
187
188
  padding-right: 16px;
188
189
  padding-left: 16px;
@@ -211,21 +212,21 @@ var StyledButton = styled2(Clickable_default)`
211
212
 
212
213
  &:not(:disabled):not([aria-disabled]),
213
214
  &[aria-disabled='false'] {
214
- &:active,
215
- &:focus,
216
- &:focus-visible {
217
- outline: none;
218
- box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
219
- }
220
-
221
- &:hover {
222
- color: var(--charcoal-${(p) => p.$color}-hover);
223
- background-color: var(--charcoal-${(p) => p.$background}-hover);
224
- }
225
- &:active {
226
- color: var(--charcoal-${(p) => p.$color}-press);
227
- background-color: var(--charcoal-${(p) => p.$background}-press);
228
- }
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
+ `}
229
230
  }
230
231
 
231
232
  &:disabled,
@@ -243,6 +244,7 @@ var Button = forwardRef3(function Button2({
243
244
  size = "M",
244
245
  fullWidth: fixed = false,
245
246
  disabled = false,
247
+ isActive = false,
246
248
  ...rest
247
249
  }, ref) {
248
250
  return /* @__PURE__ */ jsx4(
@@ -254,6 +256,7 @@ var Button = forwardRef3(function Button2({
254
256
  $color: variantToFont(variant),
255
257
  $size: size,
256
258
  $fullWidth: fixed,
259
+ $isActive: isActive,
257
260
  ref,
258
261
  children
259
262
  }
@@ -263,12 +266,29 @@ var Button_default = Button;
263
266
 
264
267
  // src/components/IconButton/index.tsx
265
268
  import { forwardRef as forwardRef4 } from "react";
266
- import styled3 from "styled-components";
269
+ import styled3, { css as css2 } from "styled-components";
270
+ import { focusVisibleFocusRingCss as focusVisibleFocusRingCss2 } from "@charcoal-ui/styled";
267
271
  import { jsx as jsx5 } from "react/jsx-runtime";
268
272
  var IconButton = forwardRef4(
269
- 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) {
270
280
  validateIconSize(size, icon);
271
- 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
+ );
272
292
  }
273
293
  );
274
294
  var IconButton_default = IconButton;
@@ -287,22 +307,17 @@ var StyledIconButton = styled3(Clickable_default).attrs(styledProps)`
287
307
 
288
308
  &:not(:disabled):not([aria-disabled]),
289
309
  &[aria-disabled='false'] {
290
- &:hover {
291
- background-color: var(
292
- ${({ $background }) => `--charcoal-${$background}-hover`}
293
- );
294
- }
295
- &:active {
296
- background-color: var(
297
- ${({ $background }) => `--charcoal-${$background}-press`}
298
- );
299
- }
300
- &:focus,
301
- &:active,
302
- &:focus-visible {
303
- outline: none;
304
- box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
305
- }
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}
306
321
  }
307
322
 
308
323
  &:disabled,
@@ -369,8 +384,9 @@ function validateIconSize(size, icon) {
369
384
  // src/components/Radio/index.tsx
370
385
  import { memo, forwardRef as forwardRef5, useCallback, useContext as useContext2 } from "react";
371
386
  import * as React3 from "react";
372
- import styled4, { css as css2 } from "styled-components";
387
+ import styled4 from "styled-components";
373
388
  import warning from "warning";
389
+ import { focusVisibleFocusRingCss as focusVisibleFocusRingCss3 } from "@charcoal-ui/styled";
374
390
  import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
375
391
  var Radio = forwardRef5(function RadioInner({ value, disabled = false, children, className }, ref) {
376
392
  const {
@@ -401,7 +417,7 @@ var Radio = forwardRef5(function RadioInner({ value, disabled = false, children,
401
417
  name,
402
418
  value,
403
419
  checked: isSelected,
404
- invalid,
420
+ "aria-invalid": invalid,
405
421
  onChange: handleChange,
406
422
  disabled: isDisabled || isReadonly,
407
423
  ref
@@ -442,21 +458,18 @@ var RadioInput = styled4.input.attrs({ type: "radio" })`
442
458
 
443
459
  &:not(:disabled):not([aria-disabled]),
444
460
  &[aria-disabled='false'] {
445
- ${({ invalid = false }) => invalid && css2`
446
- box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
447
- `}
448
-
449
461
  &:hover {
450
462
  background-color: var(--charcoal-surface1-hover);
451
463
  }
452
464
  &:active {
453
465
  background-color: var(--charcoal-surface1-press);
454
466
  }
455
- &:focus,
456
- &:active,
457
- &:focus-visible {
458
- outline: none;
459
- 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
+ }
460
473
  }
461
474
  }
462
475
 
@@ -600,6 +613,7 @@ var MultiSelectGroupContext = createContext3({
600
613
  });
601
614
 
602
615
  // src/components/MultiSelect/index.tsx
616
+ import { focusVisibleFocusRingCss as focusVisibleFocusRingCss4 } from "@charcoal-ui/styled";
603
617
  import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
604
618
  var MultiSelect = forwardRef6(
605
619
  function MultiSelectInner({
@@ -744,6 +758,8 @@ var MultiSelectInput = styled5.input.attrs({ type: "checkbox" })`
744
758
  }
745
759
  }
746
760
 
761
+ ${focusVisibleFocusRingCss4}
762
+
747
763
  ${({ invalid, overlay }) => invalid && !overlay && css3`
748
764
  &:not(:disabled):not([aria-disabled]),
749
765
  &[aria-disabled='false'] {
@@ -829,6 +845,7 @@ import { useMemo, memo as memo3, forwardRef as forwardRef7 } from "react";
829
845
  import { useToggleState } from "react-stately";
830
846
  import styled6 from "styled-components";
831
847
  import { useObjectRef } from "@react-aria/utils";
848
+ import { focusVisibleFocusRingCss as focusVisibleFocusRingCss5 } from "@charcoal-ui/styled";
832
849
  import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
833
850
  var SwitchCheckbox = forwardRef7(
834
851
  function SwitchCheckboxInner(props, external) {
@@ -866,10 +883,6 @@ var Label = styled6.label`
866
883
  opacity: 0.32;
867
884
  cursor: default;
868
885
  }
869
-
870
- :active > input {
871
- box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
872
- }
873
886
  `;
874
887
  var LabelInner = styled6.div`
875
888
  font-size: 14px;
@@ -900,9 +913,7 @@ var SwitchInput = styled6.input.attrs({ type: "checkbox" })`
900
913
  :active {
901
914
  background-color: var(--charcoal-text4-press);
902
915
  }
903
- :focus {
904
- box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
905
- }
916
+ ${focusVisibleFocusRingCss5}
906
917
 
907
918
  &::after {
908
919
  content: '';
@@ -1213,13 +1224,6 @@ var StyledInputContainer = styled8.div`
1213
1224
  background-color: var(--charcoal-surface3-hover);
1214
1225
  }
1215
1226
 
1216
- :not(:disabled):not([aria-disabled]):active,
1217
- [aria-disabled='false']:active {
1218
- outline: none;
1219
- box-shadow: 0 0 0 4px
1220
- ${(p) => p.invalid ? `rgba(255,43,0,0.32)` : `rgba(0, 150, 250, 0.32);`};
1221
- }
1222
-
1223
1227
  :focus-within {
1224
1228
  outline: none;
1225
1229
  box-shadow: 0 0 0 4px
@@ -2104,6 +2108,7 @@ var StyledUl = styled15.ul`
2104
2108
  `;
2105
2109
 
2106
2110
  // src/components/DropdownSelector/index.tsx
2111
+ import { focusVisibleFocusRingCss as focusVisibleFocusRingCss6 } from "@charcoal-ui/styled";
2107
2112
  import { jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
2108
2113
  var defaultRequiredText = "*\u5FC5\u9808";
2109
2114
  function DropdownSelector(props) {
@@ -2132,6 +2137,7 @@ function DropdownSelector(props) {
2132
2137
  },
2133
2138
  ref: triggerRef,
2134
2139
  type: "button",
2140
+ $active: isOpen,
2135
2141
  children: [
2136
2142
  /* @__PURE__ */ jsx20(DropdownButtonText, { children: props.placeholder !== void 0 && preview === void 0 ? props.placeholder : preview }),
2137
2143
  /* @__PURE__ */ jsx20(DropdownButtonIcon, { name: "16/Menu" })
@@ -2199,15 +2205,17 @@ var DropdownButton = styled16.button`
2199
2205
 
2200
2206
  &:not(:disabled):not([aria-disabled]),
2201
2207
  &[aria-disabled='false'] {
2202
- &:focus,
2203
- &:active,
2204
- &:focus-visible {
2205
- outline: none;
2206
- box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
2207
- }
2208
- &:hover {
2209
- background-color: var(--charcoal-surface3-hover);
2210
- }
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
+ `}
2211
2219
  }
2212
2220
 
2213
2221
  ${({ invalid }) => invalid === true && css9`
@@ -2837,6 +2845,7 @@ import { useCheckbox } from "@react-aria/checkbox";
2837
2845
  import { useObjectRef as useObjectRef3 } from "@react-aria/utils";
2838
2846
  import { useToggleState as useToggleState2 } from "react-stately";
2839
2847
  import { disabledSelector as disabledSelector3 } from "@charcoal-ui/utils";
2848
+ import { focusVisibleFocusRingCss as focusVisibleFocusRingCss7 } from "@charcoal-ui/styled";
2840
2849
  import { jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
2841
2850
  var Checkbox = forwardRef16(
2842
2851
  function CheckboxInner({ invalid = false, ...props }, ref) {
@@ -2914,18 +2923,7 @@ var CheckboxInput = styled21.input`
2914
2923
 
2915
2924
  &:not(:disabled):not([aria-disabled]),
2916
2925
  &[aria-disabled='false'] {
2917
- &:focus,
2918
- &:active {
2919
- outline: none;
2920
- box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
2921
- &:not(:focus-visible) {
2922
- outline: none;
2923
- }
2924
- }
2925
- &:focus-visible {
2926
- outline: none;
2927
- box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
2928
- }
2926
+ ${focusVisibleFocusRingCss7}
2929
2927
  &[aria-invalid='true'] {
2930
2928
  box-shadow: 0 0 0 4px rgba(255, 43, 0, 0.32);
2931
2929
  }
@@ -2965,6 +2963,7 @@ import { useObjectRef as useObjectRef4 } from "@react-aria/utils";
2965
2963
  import styled22, { css as css12 } from "styled-components";
2966
2964
  import { px as px2 } from "@charcoal-ui/utils";
2967
2965
  import { useButton } from "@react-aria/button";
2966
+ import { focusVisibleFocusRingCss as focusVisibleFocusRingCss8 } from "@charcoal-ui/styled";
2968
2967
  import { jsx as jsx28, jsxs as jsxs15 } from "react/jsx-runtime";
2969
2968
  var sizeMap = {
2970
2969
  S: 32,
@@ -3048,12 +3047,7 @@ var TagItemRoot = styled22.a`
3048
3047
 
3049
3048
  &:not(:disabled):not([aria-disabled]),
3050
3049
  &[aria-disabled='false'] {
3051
- &:focus,
3052
- &:active,
3053
- &:focus-visible {
3054
- outline: none;
3055
- box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
3056
- }
3050
+ ${focusVisibleFocusRingCss8}
3057
3051
  }
3058
3052
 
3059
3053
  &:disabled,