@strapi/design-system 2.0.0-rc.25 → 2.0.0-rc.27

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
@@ -586,7 +586,7 @@ const Trigger$7 = React.forwardRef(
586
586
  return /* @__PURE__ */ jsxs(AccordionTrigger, { $caretPosition: caretPosition, $size: size, ref: forwardedRef, ...restProps, children: [
587
587
  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,
588
588
  /* @__PURE__ */ jsxs(Flex, { tag: "span", gap: 2, overflow: "hidden", children: [
589
- Icon && size === "S" ? /* @__PURE__ */ jsx(IconBox$2, { children: /* @__PURE__ */ jsx(Icon, { ...iconProps }) }) : null,
589
+ Icon && size === "S" ? /* @__PURE__ */ jsx(IconBox$1, { children: /* @__PURE__ */ jsx(Icon, { ...iconProps }) }) : null,
590
590
  /* @__PURE__ */ jsxs(Flex, { alignItems: "flex-start", direction: "column", tag: "span", ref: forwardedRef, overflow: "hidden", children: [
591
591
  /* @__PURE__ */ jsx(
592
592
  Typography,
@@ -606,7 +606,7 @@ const Trigger$7 = React.forwardRef(
606
606
  ] });
607
607
  }
608
608
  );
609
- const IconBox$2 = styled(Box)`
609
+ const IconBox$1 = styled(Box)`
610
610
  color: ${(props) => props.theme.colors.neutral500};
611
611
  display: flex;
612
612
 
@@ -703,7 +703,7 @@ const AccordionHeader = styled(RadixAccordion.Header)`
703
703
  & > ${AccordionTrigger} {
704
704
  color: ${(props) => props.theme.colors.primary600};
705
705
 
706
- & ${IconBox$2} {
706
+ & ${IconBox$1} {
707
707
  color: ${(props) => props.theme.colors.primary600};
708
708
  }
709
709
 
@@ -1684,8 +1684,8 @@ const IconButtonWrapper = styled(Flex)`
1684
1684
  switch (props.$size) {
1685
1685
  case "XS": {
1686
1686
  return css`
1687
- padding-block: 0.25rem;
1688
- padding-inline: 0.25rem;
1687
+ padding-block: 0.2rem;
1688
+ padding-inline: 0.2rem;
1689
1689
  `;
1690
1690
  }
1691
1691
  case "S": {
@@ -1793,6 +1793,30 @@ const LinkWrapper$1 = styled(BaseLinkImpl)`
1793
1793
 
1794
1794
  ${focus};
1795
1795
  `;
1796
+ const getBackgroundColorHover = (variant2) => {
1797
+ switch (variant2) {
1798
+ case "danger":
1799
+ return "danger100";
1800
+ default:
1801
+ return "primary100";
1802
+ }
1803
+ };
1804
+ const getTextColor = (variant2, disabled) => {
1805
+ switch (variant2) {
1806
+ case "danger":
1807
+ return disabled ? "danger500" : "danger700";
1808
+ default:
1809
+ return disabled ? "neutral500" : "neutral800";
1810
+ }
1811
+ };
1812
+ const getIconColor = (variant2, disabled) => {
1813
+ switch (variant2) {
1814
+ case "danger":
1815
+ return disabled ? "danger500" : "danger700";
1816
+ default:
1817
+ return disabled ? "neutral300" : "neutral500";
1818
+ }
1819
+ };
1796
1820
  const MenuRoot = DropdownMenu.Root;
1797
1821
  const MenuTrigger = React.forwardRef(
1798
1822
  ({ label, endIcon = /* @__PURE__ */ jsx(CaretDown, { width: "1.2rem", height: "1.2rem", "aria-hidden": true }), tag = Button, icon, ...rest }, ref) => {
@@ -1859,35 +1883,46 @@ const DropdownMenuContent = styled(DropdownMenu.Content)`
1859
1883
  }
1860
1884
  }
1861
1885
  `;
1862
- const MenuItem$1 = ({ onSelect, disabled = false, isLink, startIcon, endIcon, isExternal, ...props }) => {
1886
+ const MenuItem$1 = ({
1887
+ onSelect,
1888
+ disabled = false,
1889
+ isLink,
1890
+ startIcon,
1891
+ endIcon,
1892
+ isExternal,
1893
+ variant: variant2 = "default",
1894
+ ...props
1895
+ }) => {
1863
1896
  return /* @__PURE__ */ jsx(DropdownMenu.Item, { asChild: true, onSelect, disabled, children: isLink || isExternal ? /* @__PURE__ */ jsx(
1864
1897
  OptionLink,
1865
1898
  {
1866
- color: "neutral800",
1899
+ color: getTextColor(variant2, disabled),
1867
1900
  startIcon,
1868
1901
  endIcon,
1869
1902
  ...props,
1870
1903
  isExternal: isExternal ?? false,
1871
- children: /* @__PURE__ */ jsx(Typography, { children: props.children })
1904
+ $variant: variant2,
1905
+ children: props.children
1872
1906
  }
1873
1907
  ) : /* @__PURE__ */ jsxs(
1874
1908
  OptionButton,
1875
1909
  {
1876
1910
  cursor: "pointer",
1877
- color: "neutral800",
1911
+ color: getTextColor(variant2, disabled),
1878
1912
  background: "transparent",
1879
1913
  borderStyle: "none",
1880
1914
  gap: 2,
1915
+ $variant: variant2,
1881
1916
  ...props,
1882
1917
  children: [
1883
- startIcon && /* @__PURE__ */ jsx(Flex, { tag: "span", "aria-hidden": true, children: startIcon }),
1918
+ startIcon && /* @__PURE__ */ jsx(Flex, { tag: "span", color: getIconColor(variant2, disabled), "aria-hidden": true, children: startIcon }),
1884
1919
  /* @__PURE__ */ jsx(Typography, { grow: 1, children: props.children }),
1885
- endIcon && /* @__PURE__ */ jsx(Flex, { tag: "span", "aria-hidden": true, children: endIcon })
1920
+ endIcon && /* @__PURE__ */ jsx(Flex, { tag: "span", color: getIconColor(variant2, disabled), "aria-hidden": true, children: endIcon })
1886
1921
  ]
1887
1922
  }
1888
1923
  ) });
1889
1924
  };
1890
- const getOptionStyle = ({ theme }) => css`
1925
+ const getOptionStyle = ({ theme, $variant }) => css`
1891
1926
  text-align: left;
1892
1927
  width: 100%;
1893
1928
  border-radius: ${theme.borderRadius};
@@ -1895,11 +1930,10 @@ const getOptionStyle = ({ theme }) => css`
1895
1930
 
1896
1931
  &[aria-disabled='true'] {
1897
1932
  cursor: not-allowed;
1898
- color: ${theme.colors.neutral500};
1899
1933
  }
1900
1934
 
1901
1935
  &[data-highlighted] {
1902
- background-color: ${theme.colors.primary100};
1936
+ background-color: ${theme.colors[getBackgroundColorHover($variant)]};
1903
1937
  }
1904
1938
 
1905
1939
  &:focus-visible {
@@ -1911,7 +1945,7 @@ const getOptionStyle = ({ theme }) => css`
1911
1945
  }
1912
1946
  `;
1913
1947
  const OptionButton = styled(Flex)`
1914
- ${getOptionStyle}
1948
+ ${({ theme, $variant }) => getOptionStyle({ theme, $variant })}
1915
1949
  `;
1916
1950
  const OptionLink = styled(Link)`
1917
1951
  /* We include this here again because typically when people use OptionLink they provide an as prop which cancels the Box props */
@@ -1928,7 +1962,7 @@ const OptionLink = styled(Link)`
1928
1962
  fill: currentColor;
1929
1963
  }
1930
1964
 
1931
- ${getOptionStyle}
1965
+ ${({ theme, $variant }) => getOptionStyle({ theme, $variant })}
1932
1966
  `;
1933
1967
  const StyledSeparator = styled(Box)`
1934
1968
  /* Negative horizontal margin to compensate Menu.Content's padding */
@@ -2178,8 +2212,8 @@ const CheckboxRoot = styled(Checkbox.Root)`
2178
2212
  // this ensures the checkbox is always a square even in flex-containers.
2179
2213
  flex: 0 0 2rem;
2180
2214
 
2181
- &[data-state='checked'],
2182
- &[data-state='indeterminate'] {
2215
+ &[data-state='checked']:not([data-disabled]),
2216
+ &[data-state='indeterminate']:not([data-disabled]) {
2183
2217
  border: 1px solid ${(props) => props.theme.colors.primary600};
2184
2218
  background-color: ${(props) => props.theme.colors.primary600};
2185
2219
  }
@@ -3276,6 +3310,8 @@ const Content$5 = styled(Combobox$1.Content)`
3276
3310
  const ComboboxCreateItem = styled(Combobox$1.CreateItem)`
3277
3311
  && {
3278
3312
  border-top: 1px solid ${({ theme }) => theme.colors.neutral150};
3313
+ border-top-left-radius: 0;
3314
+ border-top-right-radius: 0;
3279
3315
  background: ${({ theme }) => theme.colors.neutral0};
3280
3316
  cursor: pointer;
3281
3317
  padding: ${({ theme }) => theme.spaces[1]};
@@ -3289,14 +3325,10 @@ const ComboboxCreateItem = styled(Combobox$1.CreateItem)`
3289
3325
  }
3290
3326
  &&[data-disabled] {
3291
3327
  color: ${({ theme }) => theme.colors.neutral600};
3292
- background: ${({ theme }) => theme.colors.neutral150};
3293
3328
  cursor: not-allowed;
3294
- border-bottom-left-radius: 0;
3295
- border-bottom-right-radius: 0;
3296
3329
  }
3297
- &&[data-disabled]:hover {
3298
- background: ${({ theme }) => theme.colors.neutral150};
3299
- color: ${({ theme }) => theme.colors.neutral600};
3330
+ &&[data-disabled] svg {
3331
+ fill: ${({ theme }) => theme.colors.neutral300};
3300
3332
  }
3301
3333
  && > div {
3302
3334
  padding: ${({ theme }) => theme.spaces[2]} ${({ theme }) => theme.spaces[4]};
@@ -3304,9 +3336,10 @@ const ComboboxCreateItem = styled(Combobox$1.CreateItem)`
3304
3336
  && > div:hover,
3305
3337
  &&[data-highlighted] > div {
3306
3338
  background-color: ${({ theme }) => theme.colors.primary100};
3339
+ border-radius: ${({ theme }) => theme.borderRadius};
3307
3340
  }
3308
- &&[data-disabled] > div:hover {
3309
- background: ${({ theme }) => theme.colors.neutral150};
3341
+ &&[data-disabled] > div {
3342
+ background-color: inherit;
3310
3343
  }
3311
3344
  `;
3312
3345
  const ScrollAreaCombobox = styled(ScrollAreaImpl$1)`
@@ -3344,22 +3377,20 @@ const OptionBox = styled.div`
3344
3377
  font-weight: bold;
3345
3378
  }
3346
3379
  `;
3380
+ const setOpacity = (hex, alpha) => `${hex}${Math.floor(alpha * 255).toString(16).padStart(2, "0")}`;
3347
3381
  const Root$5 = AlertDialog.Root;
3348
3382
  const Trigger$4 = React.forwardRef((props, forwardedRef) => {
3349
3383
  return /* @__PURE__ */ jsx(AlertDialog.Trigger, { ...props, asChild: true, ref: forwardedRef });
3350
3384
  });
3351
3385
  const Content$4 = React.forwardRef((props, forwardedRef) => {
3352
- return /* @__PURE__ */ jsxs(AlertDialog.Portal, { children: [
3353
- /* @__PURE__ */ jsx(Overlay$1, {}),
3354
- /* @__PURE__ */ jsx(ContentImpl$1, { ref: forwardedRef, ...props })
3355
- ] });
3386
+ return /* @__PURE__ */ jsx(AlertDialog.Portal, { children: /* @__PURE__ */ jsx(Overlay$1, { children: /* @__PURE__ */ jsx(ContentImpl$1, { ref: forwardedRef, ...props }) }) });
3356
3387
  });
3357
3388
  const Overlay$1 = styled(AlertDialog.Overlay)`
3358
- background-color: ${(props) => props.theme.colors.neutral800};
3389
+ background: ${(props) => setOpacity(props.theme.colors.neutral800, 0.2)};
3359
3390
  position: fixed;
3360
3391
  inset: 0;
3361
3392
  z-index: ${(props) => props.theme.zIndices.overlay};
3362
- opacity: 0.2;
3393
+ will-change: opacity;
3363
3394
 
3364
3395
  @media (prefers-reduced-motion: no-preference) {
3365
3396
  animation: ${ANIMATIONS.overlayFadeIn} ${(props) => props.theme.motion.timings["200"]}
@@ -3708,18 +3739,14 @@ const SelectTrigger = React.forwardRef(
3708
3739
  ] }),
3709
3740
  /* @__PURE__ */ jsxs(Flex, { tag: "span", gap: 3, children: [
3710
3741
  onClear ? /* @__PURE__ */ jsx(
3711
- IconBox$1,
3742
+ IconButton,
3712
3743
  {
3713
- tag: "button",
3714
- hasRadius: true,
3715
- background: "transparent",
3716
- role: "button",
3717
- tabIndex: 0,
3744
+ size: "XS",
3745
+ variant: "ghost",
3718
3746
  onClick: handleClearClick,
3719
3747
  "aria-disabled": disabled,
3720
3748
  "aria-label": clearLabel,
3721
- title: clearLabel,
3722
- cursor: "pointer",
3749
+ label: clearLabel,
3723
3750
  children: /* @__PURE__ */ jsx(Cross, {})
3724
3751
  }
3725
3752
  ) : null,
@@ -3730,19 +3757,6 @@ const SelectTrigger = React.forwardRef(
3730
3757
  ) });
3731
3758
  }
3732
3759
  );
3733
- const IconBox$1 = styled(Box)`
3734
- border: none;
3735
- display: flex;
3736
-
3737
- svg {
3738
- height: 1.1rem;
3739
- width: 1.1rem;
3740
- }
3741
-
3742
- svg path {
3743
- fill: ${({ theme }) => theme.colors.neutral500};
3744
- }
3745
- `;
3746
3760
  const StyledTrigger = styled(Flex)`
3747
3761
  border: 1px solid ${({ theme, $hasError }) => $hasError ? theme.colors.danger600 : theme.colors.neutral200};
3748
3762
  ${(props) => {
@@ -3785,6 +3799,7 @@ const ValueType = styled(Typography)`
3785
3799
  flex: 1;
3786
3800
  font-size: 1.4rem;
3787
3801
  line-height: 2.2rem;
3802
+ min-height: 2.2rem;
3788
3803
  `;
3789
3804
  const StyledValue = styled(Select.Value)`
3790
3805
  display: flex;
@@ -3853,12 +3868,6 @@ const StyledSelectItem = styled(Select.Item)`
3853
3868
  background-color: ${({ theme }) => theme.colors.primary100};
3854
3869
  cursor: pointer;
3855
3870
  }
3856
-
3857
- &[data-state='checked'] {
3858
- font-weight: bold;
3859
- color: ${({ theme }) => theme.colors.primary600};
3860
- font-weight: bold;
3861
- }
3862
3871
  `;
3863
3872
  const Root$4 = Select.Root;
3864
3873
  const Trigger$3 = SelectTrigger;
@@ -5239,7 +5248,6 @@ const SkipToContent = ({ children }) => {
5239
5248
  }
5240
5249
  );
5241
5250
  };
5242
- const setOpacity = (hex, alpha) => `${hex}${Math.floor(alpha * 255).toString(16).padStart(2, "0")}`;
5243
5251
  const Root$3 = Dialog$1.Root;
5244
5252
  const Trigger$2 = React.forwardRef((props, forwardedRef) => {
5245
5253
  return /* @__PURE__ */ jsx(Dialog$1.Trigger, { ...props, asChild: true, ref: forwardedRef });
@@ -5619,6 +5627,7 @@ const Dots = ({ children, ...props }) => /* @__PURE__ */ jsxs(Box, { ...props, c
5619
5627
  /* @__PURE__ */ jsx(Typography, { "aria-hidden": true, lineHeight: "revert", textColor: "neutral800", variant: "pi", children: "…" })
5620
5628
  ] });
5621
5629
  const Root$2 = Popover$1.Root;
5630
+ const Anchor = Popover$1.Anchor;
5622
5631
  const Trigger$1 = React.forwardRef((props, forwardedRef) => {
5623
5632
  return /* @__PURE__ */ jsx(Popover$1.Trigger, { ...props, asChild: true, ref: forwardedRef });
5624
5633
  });
@@ -5681,6 +5690,7 @@ const PopoverScrollArea = styled(ScrollAreaImpl$1)`
5681
5690
  `;
5682
5691
  const Popover = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
5683
5692
  __proto__: null,
5693
+ Anchor,
5684
5694
  Content: Content$1,
5685
5695
  Root: Root$2,
5686
5696
  ScrollArea: ScrollAreaImpl,