@strapi/design-system 2.0.0-rc.25 → 2.0.0-rc.26
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/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/components/Select/SelectParts.d.ts.map +1 -1
- package/dist/components/SimpleMenu/Menu.d.ts +3 -1
- package/dist/components/SimpleMenu/Menu.d.ts.map +1 -1
- package/dist/components/SimpleMenu/SimpleMenu.d.ts +3 -2
- package/dist/components/SimpleMenu/SimpleMenu.d.ts.map +1 -1
- package/dist/components/SimpleMenu/utils.d.ts +6 -0
- package/dist/components/SimpleMenu/utils.d.ts.map +1 -0
- package/dist/index.js +61 -52
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -52
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
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$
|
|
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$
|
|
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$
|
|
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.
|
|
1688
|
-
padding-inline: 0.
|
|
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 = ({
|
|
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:
|
|
1899
|
+
color: getTextColor(variant2, disabled),
|
|
1867
1900
|
startIcon,
|
|
1868
1901
|
endIcon,
|
|
1869
1902
|
...props,
|
|
1870
1903
|
isExternal: isExternal ?? false,
|
|
1871
|
-
|
|
1904
|
+
$variant: variant2,
|
|
1905
|
+
children: props.children
|
|
1872
1906
|
}
|
|
1873
1907
|
) : /* @__PURE__ */ jsxs(
|
|
1874
1908
|
OptionButton,
|
|
1875
1909
|
{
|
|
1876
1910
|
cursor: "pointer",
|
|
1877
|
-
color:
|
|
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
|
|
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
|
}
|
|
@@ -3344,22 +3378,20 @@ const OptionBox = styled.div`
|
|
|
3344
3378
|
font-weight: bold;
|
|
3345
3379
|
}
|
|
3346
3380
|
`;
|
|
3381
|
+
const setOpacity = (hex, alpha) => `${hex}${Math.floor(alpha * 255).toString(16).padStart(2, "0")}`;
|
|
3347
3382
|
const Root$5 = AlertDialog.Root;
|
|
3348
3383
|
const Trigger$4 = React.forwardRef((props, forwardedRef) => {
|
|
3349
3384
|
return /* @__PURE__ */ jsx(AlertDialog.Trigger, { ...props, asChild: true, ref: forwardedRef });
|
|
3350
3385
|
});
|
|
3351
3386
|
const Content$4 = React.forwardRef((props, forwardedRef) => {
|
|
3352
|
-
return /* @__PURE__ */
|
|
3353
|
-
/* @__PURE__ */ jsx(Overlay$1, {}),
|
|
3354
|
-
/* @__PURE__ */ jsx(ContentImpl$1, { ref: forwardedRef, ...props })
|
|
3355
|
-
] });
|
|
3387
|
+
return /* @__PURE__ */ jsx(AlertDialog.Portal, { children: /* @__PURE__ */ jsx(Overlay$1, { children: /* @__PURE__ */ jsx(ContentImpl$1, { ref: forwardedRef, ...props }) }) });
|
|
3356
3388
|
});
|
|
3357
3389
|
const Overlay$1 = styled(AlertDialog.Overlay)`
|
|
3358
|
-
background
|
|
3390
|
+
background: ${(props) => setOpacity(props.theme.colors.neutral800, 0.2)};
|
|
3359
3391
|
position: fixed;
|
|
3360
3392
|
inset: 0;
|
|
3361
3393
|
z-index: ${(props) => props.theme.zIndices.overlay};
|
|
3362
|
-
|
|
3394
|
+
will-change: opacity;
|
|
3363
3395
|
|
|
3364
3396
|
@media (prefers-reduced-motion: no-preference) {
|
|
3365
3397
|
animation: ${ANIMATIONS.overlayFadeIn} ${(props) => props.theme.motion.timings["200"]}
|
|
@@ -3708,18 +3740,14 @@ const SelectTrigger = React.forwardRef(
|
|
|
3708
3740
|
] }),
|
|
3709
3741
|
/* @__PURE__ */ jsxs(Flex, { tag: "span", gap: 3, children: [
|
|
3710
3742
|
onClear ? /* @__PURE__ */ jsx(
|
|
3711
|
-
|
|
3743
|
+
IconButton,
|
|
3712
3744
|
{
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
background: "transparent",
|
|
3716
|
-
role: "button",
|
|
3717
|
-
tabIndex: 0,
|
|
3745
|
+
size: "XS",
|
|
3746
|
+
variant: "ghost",
|
|
3718
3747
|
onClick: handleClearClick,
|
|
3719
3748
|
"aria-disabled": disabled,
|
|
3720
3749
|
"aria-label": clearLabel,
|
|
3721
|
-
|
|
3722
|
-
cursor: "pointer",
|
|
3750
|
+
label: clearLabel,
|
|
3723
3751
|
children: /* @__PURE__ */ jsx(Cross, {})
|
|
3724
3752
|
}
|
|
3725
3753
|
) : null,
|
|
@@ -3730,19 +3758,6 @@ const SelectTrigger = React.forwardRef(
|
|
|
3730
3758
|
) });
|
|
3731
3759
|
}
|
|
3732
3760
|
);
|
|
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
3761
|
const StyledTrigger = styled(Flex)`
|
|
3747
3762
|
border: 1px solid ${({ theme, $hasError }) => $hasError ? theme.colors.danger600 : theme.colors.neutral200};
|
|
3748
3763
|
${(props) => {
|
|
@@ -3785,6 +3800,7 @@ const ValueType = styled(Typography)`
|
|
|
3785
3800
|
flex: 1;
|
|
3786
3801
|
font-size: 1.4rem;
|
|
3787
3802
|
line-height: 2.2rem;
|
|
3803
|
+
min-height: 2.2rem;
|
|
3788
3804
|
`;
|
|
3789
3805
|
const StyledValue = styled(Select.Value)`
|
|
3790
3806
|
display: flex;
|
|
@@ -3853,12 +3869,6 @@ const StyledSelectItem = styled(Select.Item)`
|
|
|
3853
3869
|
background-color: ${({ theme }) => theme.colors.primary100};
|
|
3854
3870
|
cursor: pointer;
|
|
3855
3871
|
}
|
|
3856
|
-
|
|
3857
|
-
&[data-state='checked'] {
|
|
3858
|
-
font-weight: bold;
|
|
3859
|
-
color: ${({ theme }) => theme.colors.primary600};
|
|
3860
|
-
font-weight: bold;
|
|
3861
|
-
}
|
|
3862
3872
|
`;
|
|
3863
3873
|
const Root$4 = Select.Root;
|
|
3864
3874
|
const Trigger$3 = SelectTrigger;
|
|
@@ -5239,7 +5249,6 @@ const SkipToContent = ({ children }) => {
|
|
|
5239
5249
|
}
|
|
5240
5250
|
);
|
|
5241
5251
|
};
|
|
5242
|
-
const setOpacity = (hex, alpha) => `${hex}${Math.floor(alpha * 255).toString(16).padStart(2, "0")}`;
|
|
5243
5252
|
const Root$3 = Dialog$1.Root;
|
|
5244
5253
|
const Trigger$2 = React.forwardRef((props, forwardedRef) => {
|
|
5245
5254
|
return /* @__PURE__ */ jsx(Dialog$1.Trigger, { ...props, asChild: true, ref: forwardedRef });
|