@charcoal-ui/react 2.6.0 → 2.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 (35) hide show
  1. package/dist/components/DropdownSelector/index.story.d.ts.map +1 -1
  2. package/dist/components/LoadingSpinner/index.d.ts.map +1 -1
  3. package/dist/components/Modal/ModalPlumbing.d.ts.map +1 -1
  4. package/dist/components/Modal/index.d.ts +5 -2
  5. package/dist/components/Modal/index.d.ts.map +1 -1
  6. package/dist/components/Radio/index.d.ts.map +1 -1
  7. package/dist/components/SegmentedControl/index.d.ts.map +1 -1
  8. package/dist/components/SegmentedControl/index.story.d.ts.map +1 -1
  9. package/dist/components/Switch/index.story.d.ts +1 -0
  10. package/dist/components/Switch/index.story.d.ts.map +1 -1
  11. package/dist/components/TagItem/index.d.ts +2 -0
  12. package/dist/components/TagItem/index.d.ts.map +1 -1
  13. package/dist/components/TagItem/index.story.d.ts +1 -0
  14. package/dist/components/TagItem/index.story.d.ts.map +1 -1
  15. package/dist/index.cjs.js +144 -90
  16. package/dist/index.cjs.js.map +1 -1
  17. package/dist/index.d.ts +2 -2
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.esm.js +125 -71
  20. package/dist/index.esm.js.map +1 -1
  21. package/package.json +6 -6
  22. package/src/components/Checkbox/index.tsx +4 -0
  23. package/src/components/DropdownSelector/index.story.tsx +4 -1
  24. package/src/components/LoadingSpinner/index.tsx +1 -0
  25. package/src/components/Modal/ModalPlumbing.tsx +2 -10
  26. package/src/components/Modal/index.tsx +79 -61
  27. package/src/components/Radio/index.tsx +3 -0
  28. package/src/components/SegmentedControl/index.story.tsx +2 -0
  29. package/src/components/SegmentedControl/index.tsx +1 -0
  30. package/src/components/Switch/index.story.tsx +20 -1
  31. package/src/components/Switch/index.tsx +58 -33
  32. package/src/components/TagItem/index.story.tsx +1 -0
  33. package/src/components/TagItem/index.tsx +3 -0
  34. package/src/components/TextField/index.tsx +7 -0
  35. package/src/index.ts +2 -1
package/dist/index.d.ts CHANGED
@@ -13,8 +13,8 @@ export { default as Icon, type IconProps } from './components/Icon';
13
13
  export { default as Modal, type ModalProps } from './components/Modal';
14
14
  export { ModalHeader, ModalAlign, ModalBody, ModalButtons, } from './components/Modal/ModalPlumbing';
15
15
  export { default as LoadingSpinner, LoadingSpinnerIcon, } from './components/LoadingSpinner';
16
- export { default as DropdownSelector, DropdownSelectorItem, } from './components/DropdownSelector';
16
+ export { default as DropdownSelector, type DropdownSelectorProps, DropdownSelectorItem, } from './components/DropdownSelector';
17
17
  export { default as SegmentedControl, type SegmentedControlProps, } from './components/SegmentedControl';
18
- export { default as Checkbox } from './components/Checkbox';
18
+ export { default as Checkbox, type CheckboxProps } from './components/Checkbox';
19
19
  export { default as TagItem, type TagItemProps } from './components/TagItem';
20
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,IAAI,oBAAoB,EAC/B,uBAAuB,EACvB,KAAK,SAAS,GACf,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,GAC3B,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACzE,OAAO,EACL,OAAO,IAAI,SAAS,EACpB,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACtB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,OAAO,IAAI,UAAU,EACrB,KAAK,eAAe,GACrB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EACL,OAAO,IAAI,KAAK,EAChB,KAAK,UAAU,EACf,UAAU,EACV,KAAK,eAAe,GACrB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3B,KAAK,qBAAqB,GAC3B,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAC/E,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAA"}
package/dist/index.esm.js CHANGED
@@ -406,6 +406,9 @@ var RadioInput = styled5.input.attrs({ type: "radio" })`
406
406
  }
407
407
 
408
408
  ${theme((o) => o.outline.default.focus)}
409
+
410
+ /* FIXME: o.outline.default.focus の transition に o.bg.brand の transition が打ち消されてしまう */
411
+ transition: all 0.2s !important;
409
412
  }
410
413
  `;
411
414
  var RadioLabel = styled5.div`
@@ -693,6 +696,10 @@ var Label = styled7.label`
693
696
 
694
697
  ${theme((o) => o.disabled)}
695
698
 
699
+ :active > input {
700
+ box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
701
+ }
702
+
696
703
  ${disabledSelector3} {
697
704
  cursor: default;
698
705
  }
@@ -707,42 +714,63 @@ var LabelInner = styled7.div`
707
714
  var SwitchInput = styled7.input.attrs({
708
715
  type: "checkbox"
709
716
  })`
710
- &[type='checkbox'] {
711
- appearance: none;
712
- display: inline-flex;
713
- position: relative;
714
- box-sizing: border-box;
715
- width: 28px;
716
- border: 2px solid transparent;
717
- transition: box-shadow 0.2s, background-color 0.2s;
718
- cursor: inherit;
719
- ${theme((o) => [
720
- o.borderRadius(16),
721
- o.height.px(16),
722
- o.bg.text4.hover.press,
723
- o.outline.default.focus,
724
- o.margin.all(0)
725
- ])}
717
+ appearance: none;
718
+ display: inline-flex;
719
+ position: relative;
720
+ box-sizing: border-box;
721
+ width: 28px;
722
+ border: 2px solid transparent;
726
723
 
727
- &::after {
728
- content: '';
729
- position: absolute;
730
- display: block;
731
- top: 0;
732
- left: 0;
733
- width: 12px;
734
- height: 12px;
735
- transform: translateX(0);
736
- transition: transform 0.2s;
737
- ${theme((o) => [o.bg.text5.hover.press, o.borderRadius("oval")])}
738
- }
724
+ transition-property: background-color, box-shadow;
725
+ transition-duration: 0.2s;
726
+ cursor: inherit;
739
727
 
740
- &:checked {
741
- ${theme((o) => o.bg.brand.hover.press)}
728
+ outline: none;
729
+ border-radius: 16px;
730
+ height: 16px;
731
+ margin: 0;
732
+ background-color: var(--charcoal-text4);
733
+ :hover {
734
+ background-color: var(--charcoal-text4-hover);
735
+ }
736
+ :active {
737
+ background-color: var(--charcoal-text4-press);
738
+ }
739
+ :focus {
740
+ box-shadow: 0 0 0 4px rgba(0, 150, 250, 0.32);
741
+ }
742
742
 
743
- &::after {
744
- transform: translateX(12px);
745
- }
743
+ &::after {
744
+ content: '';
745
+ position: absolute;
746
+ display: block;
747
+ top: 0;
748
+ left: 0;
749
+ width: 12px;
750
+ height: 12px;
751
+ transform: translateX(0);
752
+ transition: transform 0.2s;
753
+ border-radius: 1024px;
754
+ background-color: var(--charcoal-text5);
755
+ :hover {
756
+ background-color: var(--charcoal-text5-hover);
757
+ }
758
+ :active {
759
+ background-color: var(--charcoal-text5-press);
760
+ }
761
+ }
762
+
763
+ &:checked {
764
+ background-color: var(--charcoal-brand);
765
+ :hover {
766
+ background-color: var(--charcoal-brand-hover);
767
+ }
768
+ :active {
769
+ background-color: var(--charcoal-brand-press);
770
+ }
771
+ &::after {
772
+ transform: translateX(12px);
773
+ transition: transform 0.2s;
746
774
  }
747
775
  }
748
776
  `;
@@ -1105,6 +1133,13 @@ var StyledTextareaContainer = styled9.div`
1105
1133
  o.borderRadius(4)
1106
1134
  ])}
1107
1135
 
1136
+ /**
1137
+ * FIXME: o.outline.default を &:focus-within 内に書いてると、外れるときに transition が効かない
1138
+ * 本来 o.outline.default.focus と書けば足してくれるような transition の内容を一旦明示している
1139
+ * o.outline.default.focusWithin のようなものがあればこの行は不要になるはず
1140
+ */
1141
+ transition: box-shadow 0.2s;
1142
+
1108
1143
  &:focus-within {
1109
1144
  ${(p) => theme3((o) => p.invalid ? o.outline.assertive : o.outline.default)}
1110
1145
  }
@@ -1267,7 +1302,7 @@ function Modal({
1267
1302
  ...underlayProps,
1268
1303
  style: transitionEnabled ? { backgroundColor } : {}
1269
1304
  },
1270
- /* @__PURE__ */ React12.createElement(FocusScope, { contain: true, restoreFocus: true, autoFocus: true }, /* @__PURE__ */ React12.createElement(
1305
+ /* @__PURE__ */ React12.createElement(FocusScope, { contain: true, restoreFocus: true, autoFocus: true }, /* @__PURE__ */ React12.createElement(DialogContainer, { bottomSheet, size }, /* @__PURE__ */ React12.createElement(
1271
1306
  ModalDialog,
1272
1307
  {
1273
1308
  ref,
@@ -1293,7 +1328,7 @@ function Modal({
1293
1328
  }
1294
1329
  )
1295
1330
  )
1296
- ))
1331
+ )))
1297
1332
  ))
1298
1333
  );
1299
1334
  }
@@ -1305,6 +1340,8 @@ var ModalContext = React12.createContext({
1305
1340
  });
1306
1341
  var ModalBackground = animated(styled10.div`
1307
1342
  z-index: ${({ zIndex }) => zIndex};
1343
+ overflow: scroll;
1344
+ display: flex;
1308
1345
  position: fixed;
1309
1346
  top: 0;
1310
1347
  left: 0;
@@ -1313,34 +1350,52 @@ var ModalBackground = animated(styled10.div`
1313
1350
 
1314
1351
  ${theme((o) => [o.bg.surface4])}
1315
1352
  `);
1353
+ var DialogContainer = styled10.div`
1354
+ position: relative;
1355
+ margin: auto;
1356
+ padding: 24px 0;
1357
+ width: ${(p) => {
1358
+ switch (p.size) {
1359
+ case "S": {
1360
+ return columnSystem(3, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2;
1361
+ }
1362
+ case "M": {
1363
+ return columnSystem(4, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2;
1364
+ }
1365
+ case "L": {
1366
+ return columnSystem(6, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2;
1367
+ }
1368
+ default: {
1369
+ return unreachable(p.size);
1370
+ }
1371
+ }
1372
+ }}px;
1373
+
1374
+ @media ${({ theme: theme4 }) => maxWidth(theme4.breakpoint.screen1)} {
1375
+ width: calc(100% - 48px);
1376
+ ${(p) => p.bottomSheet !== false && css4`
1377
+ margin: 0;
1378
+ padding: 0;
1379
+ bottom: 0;
1380
+ position: absolute;
1381
+ width: 100%;
1382
+ ${p.bottomSheet === "full" ? "height: 100%" : ""};
1383
+ `}
1384
+ }
1385
+ `;
1316
1386
  var ModalDialog = animated(styled10.div`
1317
- position: absolute;
1318
- top: 50%;
1319
- left: 50%;
1320
- transform: translate(-50%, -50%);
1321
- width: ${(p) => p.size === "S" ? columnSystem(3, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2 : p.size === "M" ? columnSystem(4, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2 : p.size === "L" ? columnSystem(6, COLUMN_UNIT, GUTTER_UNIT) + GUTTER_UNIT * 2 : unreachable(p.size)}px;
1387
+ position: relative;
1388
+ margin: auto;
1389
+ padding: 24px 0;
1322
1390
 
1323
1391
  ${theme((o) => [o.bg.background1, o.borderRadius(24)])}
1324
-
1325
1392
  @media ${({ theme: theme4 }) => maxWidth(theme4.breakpoint.screen1)} {
1326
- ${(p) => p.bottomSheet === "full" ? css4`
1327
- top: auto;
1328
- bottom: 0;
1329
- left: 0;
1330
- transform: none;
1331
- border-radius: 0;
1332
- width: 100%;
1333
- height: 100%;
1334
- ` : p.bottomSheet ? css4`
1335
- top: auto;
1336
- bottom: 0;
1337
- left: 0;
1338
- transform: none;
1339
- border-radius: 0;
1340
- width: 100%;
1341
- ` : css4`
1342
- width: calc(100% - 48px);
1343
- `}
1393
+ ${(p) => p.bottomSheet !== false && css4`
1394
+ border-radius: 0;
1395
+ ${p.bottomSheet === "full" && css4`
1396
+ height: 100%;
1397
+ `}
1398
+ `}
1344
1399
  }
1345
1400
  `);
1346
1401
  var ModalCrossButton = styled10(IconButton_default)`
@@ -1363,7 +1418,6 @@ var ModalHeading = styled10.h3`
1363
1418
  // src/components/Modal/ModalPlumbing.tsx
1364
1419
  import React13 from "react";
1365
1420
  import styled11 from "styled-components";
1366
- import { maxWidth as maxWidth2 } from "@charcoal-ui/utils";
1367
1421
  function ModalHeader() {
1368
1422
  return /* @__PURE__ */ React13.createElement(ModalHeaderRoot, null, /* @__PURE__ */ React13.createElement(StyledModalTitle, null));
1369
1423
  }
@@ -1377,11 +1431,7 @@ var StyledModalTitle = styled11(ModalTitle)`
1377
1431
  ${theme((o) => [o.font.text1, o.typography(16).bold])}
1378
1432
  `;
1379
1433
  var ModalAlign = styled11.div`
1380
- ${theme((o) => [o.padding.horizontal(24)])}
1381
-
1382
- @media ${({ theme: theme4 }) => maxWidth2(theme4.breakpoint.screen1)} {
1383
- ${theme((o) => [o.padding.horizontal(16)])}
1384
- }
1434
+ ${theme((o) => [o.padding.horizontal(16)])}
1385
1435
  `;
1386
1436
  var ModalBody = styled11.div`
1387
1437
  ${theme((o) => [o.padding.bottom(40)])}
@@ -1390,11 +1440,8 @@ var ModalButtons = styled11.div`
1390
1440
  display: grid;
1391
1441
  grid-auto-flow: row;
1392
1442
  grid-row-gap: 8px;
1393
- ${theme((o) => [o.padding.horizontal(24).top(16)])}
1394
1443
 
1395
- @media ${({ theme: theme4 }) => maxWidth2(theme4.breakpoint.screen1)} {
1396
- ${theme((o) => [o.padding.horizontal(16)])}
1397
- }
1444
+ ${theme((o) => [o.padding.horizontal(16).top(16)])}
1398
1445
  `;
1399
1446
 
1400
1447
  // src/components/LoadingSpinner/index.tsx
@@ -1408,6 +1455,7 @@ function LoadingSpinner({
1408
1455
  return /* @__PURE__ */ React14.createElement(LoadingSpinnerRoot, { size, padding, transparent }, /* @__PURE__ */ React14.createElement(LoadingSpinnerIcon, null));
1409
1456
  }
1410
1457
  var LoadingSpinnerRoot = styled12.div.attrs({ role: "progressbar" })`
1458
+ box-sizing: content-box;
1411
1459
  margin: auto;
1412
1460
  padding: ${(props) => props.padding}px;
1413
1461
  border-radius: 8px;
@@ -1818,7 +1866,8 @@ var SegmentedControl = forwardRef(
1818
1866
  ...props,
1819
1867
  isDisabled: props.disabled,
1820
1868
  isReadOnly: props.readonly,
1821
- isRequired: props.required
1869
+ isRequired: props.required,
1870
+ "aria-label": props.name
1822
1871
  }),
1823
1872
  [props]
1824
1873
  );
@@ -1975,6 +2024,9 @@ var CheckboxInput = styled20.input`
1975
2024
  border-color: ${({ theme: theme4 }) => theme4.color.text4};
1976
2025
  }
1977
2026
  ${theme((o) => [o.outline.default.focus, o.borderRadius(4)])}
2027
+
2028
+ /* FIXME: o.outline.default.focus の transition に o.bg.brand の transition が打ち消されてしまう */
2029
+ transition: all 0.2s !important;
1978
2030
  }
1979
2031
  `;
1980
2032
  var CheckboxInputOverlay = styled20.div`
@@ -2021,6 +2073,7 @@ var TagItem = forwardRef3(
2021
2073
  size = "M",
2022
2074
  disabled,
2023
2075
  status = "default",
2076
+ className,
2024
2077
  ...props
2025
2078
  }, _ref) {
2026
2079
  const ref = useObjectRef2(_ref);
@@ -2040,7 +2093,8 @@ var TagItem = forwardRef3(
2040
2093
  ref,
2041
2094
  size: hasTranslatedLabel ? "M" : size,
2042
2095
  status,
2043
- ...buttonProps
2096
+ ...buttonProps,
2097
+ className
2044
2098
  },
2045
2099
  /* @__PURE__ */ React23.createElement(Background, { bgColor, bgImage, status }),
2046
2100
  /* @__PURE__ */ React23.createElement(Inner, null, /* @__PURE__ */ React23.createElement(LabelWrapper, { isTranslate: hasTranslatedLabel }, hasTranslatedLabel && /* @__PURE__ */ React23.createElement(TranslatedLabel, null, /* @__PURE__ */ React23.createElement(Label3, null, translatedLabel)), /* @__PURE__ */ React23.createElement(Label3, null, label)), status === "active" && /* @__PURE__ */ React23.createElement(Icon_default, { name: "16/Remove" }))