@strapi/design-system 2.0.0-rc.10 → 2.0.0-rc.12

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.
package/dist/index.mjs CHANGED
@@ -533,38 +533,43 @@ const AccordionRoot = styled(RadixAccordion.Root)`
533
533
  `;
534
534
  const Item$5 = React.forwardRef((props, forwardedRef) => {
535
535
  const { size } = useAccordion("Item");
536
- return /* @__PURE__ */ jsx(AccordionItem, { $size: size, ref: forwardedRef, ...props });
536
+ return /* @__PURE__ */ jsx(AccordionItem, { $size: size, "data-size": size, ref: forwardedRef, ...props });
537
537
  });
538
538
  const AccordionItem = styled(RadixAccordion.Item)`
539
539
  overflow: hidden;
540
+ margin: 1px 0;
540
541
 
541
542
  &:first-child {
542
543
  border-top-left-radius: 0.3rem;
543
544
  border-top-right-radius: 0.3rem;
545
+ margin-top: 0;
544
546
  }
545
547
 
546
548
  &:last-child {
547
549
  border-bottom-left-radius: 0.3rem;
548
550
  border-bottom-right-radius: 0.3rem;
551
+ margin-bottom: 0;
549
552
  }
550
553
 
551
- & + & {
552
- border-top: ${(props) => props.$size === "S" ? `solid 1px ${props.theme.colors.neutral200}` : "unset"};
554
+ &[data-size='S'] {
555
+ & + & {
556
+ border-top: solid 1px ${(props) => props.theme.colors.neutral200};
557
+ }
553
558
  }
554
559
 
555
560
  &[data-state='open'] {
556
- box-shadow: 0 0 0 2px ${(props) => props.theme.colors.primary600};
561
+ box-shadow: 0 0 0 1px ${(props) => props.theme.colors.primary600};
557
562
  }
558
563
 
559
- &:hover {
560
- box-shadow: 0 0 0 2px ${(props) => props.theme.colors.primary600};
564
+ &:not([data-disabled]):hover {
565
+ box-shadow: 0 0 0 1px ${(props) => props.theme.colors.primary600};
561
566
  }
562
567
 
563
568
  /* This applies our desired focus effect correctly. */
564
569
  &:focus-within {
565
570
  position: relative;
566
571
  z-index: 1;
567
- box-shadow: 0 0 0 2px ${(props) => props.theme.colors.primary600};
572
+ box-shadow: 0 0 0 1px ${(props) => props.theme.colors.primary600};
568
573
  }
569
574
 
570
575
  @media (prefers-reduced-motion: no-preference) {
@@ -573,12 +578,12 @@ const AccordionItem = styled(RadixAccordion.Item)`
573
578
  }
574
579
  `;
575
580
  const Trigger$7 = React.forwardRef(
576
- ({ caretPosition = "left", description, icon: Icon, children, ...restProps }, forwardedRef) => {
581
+ ({ caretPosition = "left", description, icon: Icon, iconProps, children, ...restProps }, forwardedRef) => {
577
582
  const { size } = useAccordion("Trigger");
578
583
  return /* @__PURE__ */ jsxs(AccordionTrigger, { $caretPosition: caretPosition, $size: size, ref: forwardedRef, ...restProps, children: [
579
584
  caretPosition === "left" ? /* @__PURE__ */ jsx(TriggerIcon, { $size: size, children: /* @__PURE__ */ jsx(CaretDown, { width: size === "S" ? "1.2rem" : "1.6rem", height: size === "S" ? "1.2rem" : "1.6rem" }) }) : null,
580
585
  /* @__PURE__ */ jsxs(Flex, { tag: "span", gap: 2, children: [
581
- Icon ? /* @__PURE__ */ jsx(IconBox$4, { children: /* @__PURE__ */ jsx(Icon, {}) }) : null,
586
+ Icon && size === "S" ? /* @__PURE__ */ jsx(IconBox$4, { children: /* @__PURE__ */ jsx(Icon, { ...iconProps }) }) : null,
582
587
  /* @__PURE__ */ jsxs(Flex, { alignItems: "flex-start", direction: "column", tag: "span", ref: forwardedRef, children: [
583
588
  /* @__PURE__ */ jsx(
584
589
  Typography,
@@ -599,6 +604,7 @@ const Trigger$7 = React.forwardRef(
599
604
  );
600
605
  const IconBox$4 = styled(Box)`
601
606
  color: ${(props) => props.theme.colors.neutral500};
607
+ display: flex;
602
608
 
603
609
  @media (prefers-reduced-motion: no-preference) {
604
610
  transition: ${(props) => props.theme.transitions.color};
@@ -2110,7 +2116,7 @@ const CheckboxEl = React.forwardRef(
2110
2116
  onChange: onCheckedChange
2111
2117
  });
2112
2118
  const composedRefs = useComposedRefs(checkboxRef, forwardedRef);
2113
- return /* @__PURE__ */ jsx(CheckboxRoot, { ref: composedRefs, checked, onCheckedChange: setChecked, ...props, children: /* @__PURE__ */ jsxs(Checkbox.Indicator, { style: { display: "inline-flex" }, children: [
2119
+ return /* @__PURE__ */ jsx(CheckboxRoot, { ref: composedRefs, checked, onCheckedChange: setChecked, ...props, children: /* @__PURE__ */ jsxs(CheckboxIndicator, { style: { display: "inline-flex", pointerEvents: "auto" }, forceMount: true, children: [
2114
2120
  checked === true ? /* @__PURE__ */ jsx(CheckIcon, { width: "1.6rem", fill: "neutral0" }) : null,
2115
2121
  checked === "indeterminate" ? /* @__PURE__ */ jsx(Minus, { fill: "neutral0" }) : null
2116
2122
  ] }) });
@@ -2149,10 +2155,16 @@ const CheckboxRoot = styled(Checkbox.Root)`
2149
2155
  transform: translate(-50%, -50%);
2150
2156
  width: 100%;
2151
2157
  height: 100%;
2158
+ z-index: -1;
2152
2159
  min-width: 44px;
2153
2160
  min-height: 44px;
2154
2161
  }
2155
2162
  `;
2163
+ const CheckboxIndicator = styled(Checkbox.Indicator)`
2164
+ width: 100%;
2165
+ height: 100%;
2166
+ cursor: pointer;
2167
+ `;
2156
2168
  const CheckboxImpl = React.forwardRef(({ children, ...restProps }, forwardedRef) => {
2157
2169
  const labelId = useId(restProps.id);
2158
2170
  if (!children) {
@@ -2276,8 +2288,8 @@ const Carousel = React.forwardRef(
2276
2288
  position: "relative",
2277
2289
  children: [
2278
2290
  childrenArray && childrenArray.length > 1 && /* @__PURE__ */ jsxs(Fragment, { children: [
2279
- /* @__PURE__ */ jsx(CarouselAction, { tag: "button", onClick: onPrevious, $area: "startAction", ref: prevActionRef, type: "button", children: /* @__PURE__ */ jsx(AccessibleIcon, { label: previousLabel, children: /* @__PURE__ */ jsx(ChevronLeft, { width: "6px", height: "10px", fill: "neutral600" }) }) }),
2280
- /* @__PURE__ */ jsx(CarouselAction, { tag: "button", onClick: onNext, $area: "endAction", ref: nextActionRef, type: "button", children: /* @__PURE__ */ jsx(AccessibleIcon, { label: nextLabel, children: /* @__PURE__ */ jsx(ChevronRight, { width: "6px", height: "10px", fill: "neutral600" }) }) })
2291
+ /* @__PURE__ */ jsx(CarouselAction, { tag: "button", onClick: onPrevious, $area: "startAction", ref: prevActionRef, type: "button", children: /* @__PURE__ */ jsx(AccessibleIcon, { label: previousLabel, children: /* @__PURE__ */ jsx(ChevronLeft, { width: "1.6rem", height: "1.6rem", fill: "neutral600" }) }) }),
2292
+ /* @__PURE__ */ jsx(CarouselAction, { tag: "button", onClick: onNext, $area: "endAction", ref: nextActionRef, type: "button", children: /* @__PURE__ */ jsx(AccessibleIcon, { label: nextLabel, children: /* @__PURE__ */ jsx(ChevronRight, { width: "1.6rem", height: "1.6rem", fill: "neutral600" }) }) })
2281
2293
  ] }),
2282
2294
  /* @__PURE__ */ jsx(CarouselSlides, { "aria-live": "polite", paddingLeft: 2, paddingRight: 2, width: "100%", overflow: "hidden", children: childrenArray }),
2283
2295
  actions
@@ -8279,6 +8291,7 @@ const CarouselActions = ({ horizontal = true, ...props }) => /* @__PURE__ */ jsx
8279
8291
  position: "absolute",
8280
8292
  width: "100%",
8281
8293
  bottom: 1,
8294
+ gap: 1,
8282
8295
  ...props
8283
8296
  }
8284
8297
  );
@@ -9089,6 +9102,7 @@ const StyledTrigger = styled(Flex)`
9089
9102
  `;
9090
9103
  }
9091
9104
  }}
9105
+ cursor: pointer;
9092
9106
 
9093
9107
  &[aria-disabled='true'] {
9094
9108
  color: ${(props) => props.theme.colors.neutral500};
@@ -9167,6 +9181,7 @@ const itemStyles = css`
9167
9181
  &:focus-visible {
9168
9182
  outline: none;
9169
9183
  background-color: ${({ theme }) => theme.colors.primary100};
9184
+ cursor: pointer;
9170
9185
  }
9171
9186
  `;
9172
9187
  const StyledSelectItem = styled(Select.Item)`
@@ -9300,8 +9315,8 @@ const SingleSelect = React.forwardRef(
9300
9315
  const SingleSelectOption = React.forwardRef(
9301
9316
  ({ value, startIcon, children, ...restProps }, ref) => {
9302
9317
  return /* @__PURE__ */ jsxs(Item$2, { ref, value: value.toString(), ...restProps, children: [
9303
- startIcon && /* @__PURE__ */ jsx(Box, { tag: "span", "aria-hidden": true, children: startIcon }),
9304
- /* @__PURE__ */ jsx(Typography, { lineHeight: "20px", children: /* @__PURE__ */ jsx(ItemText, { children }) })
9318
+ startIcon && /* @__PURE__ */ jsx(Flex, { tag: "span", "aria-hidden": true, children: startIcon }),
9319
+ /* @__PURE__ */ jsx(Typography, { lineHeight: "20px", width: "100%", children: /* @__PURE__ */ jsx(ItemText, { children }) })
9305
9320
  ] });
9306
9321
  }
9307
9322
  );
@@ -10768,6 +10783,13 @@ const NumberInput = React.forwardRef(
10768
10783
  formatNumberAndSetInput(value2);
10769
10784
  }
10770
10785
  };
10786
+ const getDecimalPlaces = (step2) => {
10787
+ const stepString = step2.toString();
10788
+ if (!stepString.includes("."))
10789
+ return 0;
10790
+ return stepString.split(".")[1].length;
10791
+ };
10792
+ const decimalPlaces = getDecimalPlaces(step);
10771
10793
  const increment = () => {
10772
10794
  if (!inputValue) {
10773
10795
  formatNumberAndSetInput(step);
@@ -10775,7 +10797,8 @@ const NumberInput = React.forwardRef(
10775
10797
  }
10776
10798
  const parsedValue = numberParserRef.current.parse(inputValue);
10777
10799
  const newValue = isNaN(parsedValue) ? step : parsedValue + step;
10778
- formatNumberAndSetInput(numberFormaterRef.current.format(newValue));
10800
+ const roundedValue = parseFloat(newValue.toFixed(decimalPlaces));
10801
+ formatNumberAndSetInput(numberFormaterRef.current.format(roundedValue));
10779
10802
  };
10780
10803
  const decrement = () => {
10781
10804
  if (!inputValue) {
@@ -10784,7 +10807,8 @@ const NumberInput = React.forwardRef(
10784
10807
  }
10785
10808
  const parsedValue = numberParserRef.current.parse(inputValue);
10786
10809
  const newValue = isNaN(parsedValue) ? -step : parsedValue - step;
10787
- formatNumberAndSetInput(numberFormaterRef.current.format(newValue));
10810
+ const roundedValue = parseFloat(newValue.toFixed(decimalPlaces));
10811
+ formatNumberAndSetInput(numberFormaterRef.current.format(roundedValue));
10788
10812
  };
10789
10813
  const handleKeyDown = (e) => {
10790
10814
  if (disabled)
@@ -11672,13 +11696,20 @@ const MultiSelectNested = ({ options, ...props }) => {
11672
11696
  const NestedOption = styled(MultiSelectOption)`
11673
11697
  padding-left: ${({ theme }) => theme.spaces[7]};
11674
11698
  `;
11675
- const Status = ({ variant: variant2 = "primary", showBullet = true, size = "M", children, ...props }) => {
11699
+ const getPadding = (size) => {
11700
+ if (size === "XS") {
11701
+ return { paddingX: "0.6rem", paddingY: "0.2rem" };
11702
+ }
11703
+ if (size === "S") {
11704
+ return { paddingX: 2, paddingY: 1 };
11705
+ }
11706
+ return { paddingX: 5, paddingY: 4 };
11707
+ };
11708
+ const Status = ({ variant: variant2 = "primary", size = "M", children, ...props }) => {
11676
11709
  const backgroundColor = `${variant2}100`;
11677
11710
  const borderColor = `${variant2}200`;
11678
- const bulletColor = `${variant2}600`;
11679
11711
  const textColor = `${variant2}600`;
11680
- const paddingX = size === "S" ? 2 : 5;
11681
- const paddingY = size === "S" ? 1 : 4;
11712
+ const { paddingX, paddingY } = getPadding(size);
11682
11713
  return /* @__PURE__ */ jsx(
11683
11714
  Box,
11684
11715
  {
@@ -11691,10 +11722,7 @@ const Status = ({ variant: variant2 = "primary", showBullet = true, size = "M",
11691
11722
  paddingLeft: paddingX,
11692
11723
  paddingRight: paddingX,
11693
11724
  ...props,
11694
- children: showBullet ? /* @__PURE__ */ jsxs(Flex, { gap: 3, children: [
11695
- /* @__PURE__ */ jsx(Box, { background: bulletColor, width: "0.6rem", height: "0.6rem", borderRadius: "50%" }),
11696
- children
11697
- ] }) : children
11725
+ children
11698
11726
  }
11699
11727
  );
11700
11728
  };