@strapi/design-system 2.0.0-rc.11 → 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/components/Accordion/Accordion.d.ts +2 -1
- package/dist/components/Accordion/Accordion.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/NumberInput/NumberInput.d.ts.map +1 -1
- package/dist/components/Select/SelectParts.d.ts.map +1 -1
- package/dist/components/Status/Status.d.ts +2 -7
- package/dist/components/Status/Status.d.ts.map +1 -1
- package/dist/index.js +34 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -578,12 +578,12 @@ const AccordionItem = styled(RadixAccordion.Item)`
|
|
|
578
578
|
}
|
|
579
579
|
`;
|
|
580
580
|
const Trigger$7 = React.forwardRef(
|
|
581
|
-
({ caretPosition = "left", description, icon: Icon, children, ...restProps }, forwardedRef) => {
|
|
581
|
+
({ caretPosition = "left", description, icon: Icon, iconProps, children, ...restProps }, forwardedRef) => {
|
|
582
582
|
const { size } = useAccordion("Trigger");
|
|
583
583
|
return /* @__PURE__ */ jsxs(AccordionTrigger, { $caretPosition: caretPosition, $size: size, ref: forwardedRef, ...restProps, children: [
|
|
584
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,
|
|
585
585
|
/* @__PURE__ */ jsxs(Flex, { tag: "span", gap: 2, children: [
|
|
586
|
-
Icon && size === "S" ? /* @__PURE__ */ jsx(IconBox$4, { children: /* @__PURE__ */ jsx(Icon, {}) }) : null,
|
|
586
|
+
Icon && size === "S" ? /* @__PURE__ */ jsx(IconBox$4, { children: /* @__PURE__ */ jsx(Icon, { ...iconProps }) }) : null,
|
|
587
587
|
/* @__PURE__ */ jsxs(Flex, { alignItems: "flex-start", direction: "column", tag: "span", ref: forwardedRef, children: [
|
|
588
588
|
/* @__PURE__ */ jsx(
|
|
589
589
|
Typography,
|
|
@@ -2116,7 +2116,7 @@ const CheckboxEl = React.forwardRef(
|
|
|
2116
2116
|
onChange: onCheckedChange
|
|
2117
2117
|
});
|
|
2118
2118
|
const composedRefs = useComposedRefs(checkboxRef, forwardedRef);
|
|
2119
|
-
return /* @__PURE__ */ jsx(CheckboxRoot, { ref: composedRefs, checked, onCheckedChange: setChecked, ...props, children: /* @__PURE__ */ jsxs(
|
|
2119
|
+
return /* @__PURE__ */ jsx(CheckboxRoot, { ref: composedRefs, checked, onCheckedChange: setChecked, ...props, children: /* @__PURE__ */ jsxs(CheckboxIndicator, { style: { display: "inline-flex", pointerEvents: "auto" }, forceMount: true, children: [
|
|
2120
2120
|
checked === true ? /* @__PURE__ */ jsx(CheckIcon, { width: "1.6rem", fill: "neutral0" }) : null,
|
|
2121
2121
|
checked === "indeterminate" ? /* @__PURE__ */ jsx(Minus, { fill: "neutral0" }) : null
|
|
2122
2122
|
] }) });
|
|
@@ -2155,10 +2155,16 @@ const CheckboxRoot = styled(Checkbox.Root)`
|
|
|
2155
2155
|
transform: translate(-50%, -50%);
|
|
2156
2156
|
width: 100%;
|
|
2157
2157
|
height: 100%;
|
|
2158
|
+
z-index: -1;
|
|
2158
2159
|
min-width: 44px;
|
|
2159
2160
|
min-height: 44px;
|
|
2160
2161
|
}
|
|
2161
2162
|
`;
|
|
2163
|
+
const CheckboxIndicator = styled(Checkbox.Indicator)`
|
|
2164
|
+
width: 100%;
|
|
2165
|
+
height: 100%;
|
|
2166
|
+
cursor: pointer;
|
|
2167
|
+
`;
|
|
2162
2168
|
const CheckboxImpl = React.forwardRef(({ children, ...restProps }, forwardedRef) => {
|
|
2163
2169
|
const labelId = useId(restProps.id);
|
|
2164
2170
|
if (!children) {
|
|
@@ -9096,6 +9102,7 @@ const StyledTrigger = styled(Flex)`
|
|
|
9096
9102
|
`;
|
|
9097
9103
|
}
|
|
9098
9104
|
}}
|
|
9105
|
+
cursor: pointer;
|
|
9099
9106
|
|
|
9100
9107
|
&[aria-disabled='true'] {
|
|
9101
9108
|
color: ${(props) => props.theme.colors.neutral500};
|
|
@@ -9174,6 +9181,7 @@ const itemStyles = css`
|
|
|
9174
9181
|
&:focus-visible {
|
|
9175
9182
|
outline: none;
|
|
9176
9183
|
background-color: ${({ theme }) => theme.colors.primary100};
|
|
9184
|
+
cursor: pointer;
|
|
9177
9185
|
}
|
|
9178
9186
|
`;
|
|
9179
9187
|
const StyledSelectItem = styled(Select.Item)`
|
|
@@ -10775,6 +10783,13 @@ const NumberInput = React.forwardRef(
|
|
|
10775
10783
|
formatNumberAndSetInput(value2);
|
|
10776
10784
|
}
|
|
10777
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);
|
|
10778
10793
|
const increment = () => {
|
|
10779
10794
|
if (!inputValue) {
|
|
10780
10795
|
formatNumberAndSetInput(step);
|
|
@@ -10782,7 +10797,8 @@ const NumberInput = React.forwardRef(
|
|
|
10782
10797
|
}
|
|
10783
10798
|
const parsedValue = numberParserRef.current.parse(inputValue);
|
|
10784
10799
|
const newValue = isNaN(parsedValue) ? step : parsedValue + step;
|
|
10785
|
-
|
|
10800
|
+
const roundedValue = parseFloat(newValue.toFixed(decimalPlaces));
|
|
10801
|
+
formatNumberAndSetInput(numberFormaterRef.current.format(roundedValue));
|
|
10786
10802
|
};
|
|
10787
10803
|
const decrement = () => {
|
|
10788
10804
|
if (!inputValue) {
|
|
@@ -10791,7 +10807,8 @@ const NumberInput = React.forwardRef(
|
|
|
10791
10807
|
}
|
|
10792
10808
|
const parsedValue = numberParserRef.current.parse(inputValue);
|
|
10793
10809
|
const newValue = isNaN(parsedValue) ? -step : parsedValue - step;
|
|
10794
|
-
|
|
10810
|
+
const roundedValue = parseFloat(newValue.toFixed(decimalPlaces));
|
|
10811
|
+
formatNumberAndSetInput(numberFormaterRef.current.format(roundedValue));
|
|
10795
10812
|
};
|
|
10796
10813
|
const handleKeyDown = (e) => {
|
|
10797
10814
|
if (disabled)
|
|
@@ -11679,13 +11696,20 @@ const MultiSelectNested = ({ options, ...props }) => {
|
|
|
11679
11696
|
const NestedOption = styled(MultiSelectOption)`
|
|
11680
11697
|
padding-left: ${({ theme }) => theme.spaces[7]};
|
|
11681
11698
|
`;
|
|
11682
|
-
const
|
|
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 }) => {
|
|
11683
11709
|
const backgroundColor = `${variant2}100`;
|
|
11684
11710
|
const borderColor = `${variant2}200`;
|
|
11685
|
-
const bulletColor = `${variant2}600`;
|
|
11686
11711
|
const textColor = `${variant2}600`;
|
|
11687
|
-
const paddingX = size
|
|
11688
|
-
const paddingY = size === "S" ? 1 : 4;
|
|
11712
|
+
const { paddingX, paddingY } = getPadding(size);
|
|
11689
11713
|
return /* @__PURE__ */ jsx(
|
|
11690
11714
|
Box,
|
|
11691
11715
|
{
|
|
@@ -11698,10 +11722,7 @@ const Status = ({ variant: variant2 = "primary", showBullet = true, size = "M",
|
|
|
11698
11722
|
paddingLeft: paddingX,
|
|
11699
11723
|
paddingRight: paddingX,
|
|
11700
11724
|
...props,
|
|
11701
|
-
children
|
|
11702
|
-
/* @__PURE__ */ jsx(Box, { background: bulletColor, width: "0.6rem", height: "0.6rem", borderRadius: "50%" }),
|
|
11703
|
-
children
|
|
11704
|
-
] }) : children
|
|
11725
|
+
children
|
|
11705
11726
|
}
|
|
11706
11727
|
);
|
|
11707
11728
|
};
|