@strapi/design-system 2.0.0-rc.21 → 2.0.0-rc.22
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/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/Combobox/Combobox.d.ts +3 -2
- package/dist/components/Combobox/Combobox.d.ts.map +1 -1
- package/dist/components/JSONInput/JSONInput.d.ts.map +1 -1
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/components/Radio/Radio.d.ts.map +1 -1
- package/dist/components/Textarea/Textarea.d.ts.map +1 -1
- package/dist/components/TimePicker/TimePicker.d.ts.map +1 -1
- package/dist/index.js +83 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +83 -26
- package/dist/index.mjs.map +1 -1
- package/dist/styles/global.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1808,7 +1808,7 @@ const MenuContent = React.forwardRef(
|
|
|
1808
1808
|
({ children, intersectionId, onCloseAutoFocus, popoverPlacement = "bottom-start", ...props }, ref) => {
|
|
1809
1809
|
const [side, align] = popoverPlacement.split("-");
|
|
1810
1810
|
return /* @__PURE__ */ jsx(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx(DropdownMenuContent, { align, side, loop: true, onCloseAutoFocus, asChild: true, children: /* @__PURE__ */ jsxs(
|
|
1811
|
-
Viewport$
|
|
1811
|
+
Viewport$1,
|
|
1812
1812
|
{
|
|
1813
1813
|
ref,
|
|
1814
1814
|
direction: "column",
|
|
@@ -1832,7 +1832,7 @@ const MenuContent = React.forwardRef(
|
|
|
1832
1832
|
) }) });
|
|
1833
1833
|
}
|
|
1834
1834
|
);
|
|
1835
|
-
const Viewport$
|
|
1835
|
+
const Viewport$1 = styled(Flex)`
|
|
1836
1836
|
scrollbar-width: none;
|
|
1837
1837
|
-ms-overflow-style: none;
|
|
1838
1838
|
-webkit-overflow-scrolling: touch;
|
|
@@ -1971,7 +1971,7 @@ const SubmenuTrigger = styled(OptionButton)`
|
|
|
1971
1971
|
`;
|
|
1972
1972
|
const MenuSubContent = React.forwardRef((props, ref) => {
|
|
1973
1973
|
return /* @__PURE__ */ jsx(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx(DropdownMenu.SubContent, { sideOffset: 8, asChild: true, children: /* @__PURE__ */ jsx(
|
|
1974
|
-
Viewport$
|
|
1974
|
+
Viewport$1,
|
|
1975
1975
|
{
|
|
1976
1976
|
ref,
|
|
1977
1977
|
direction: "column",
|
|
@@ -2210,6 +2210,10 @@ const CheckboxIndicator = styled(Checkbox.Indicator)`
|
|
|
2210
2210
|
cursor: pointer;
|
|
2211
2211
|
justify-content: center;
|
|
2212
2212
|
align-items: center;
|
|
2213
|
+
|
|
2214
|
+
&[data-disabled] {
|
|
2215
|
+
cursor: not-allowed;
|
|
2216
|
+
}
|
|
2213
2217
|
`;
|
|
2214
2218
|
const CheckboxImpl = React.forwardRef(({ children, ...restProps }, forwardedRef) => {
|
|
2215
2219
|
const labelId = useId(restProps.id);
|
|
@@ -2969,6 +2973,7 @@ const Combobox = React.forwardRef(
|
|
|
2969
2973
|
className,
|
|
2970
2974
|
clearLabel = "Clear",
|
|
2971
2975
|
creatable = false,
|
|
2976
|
+
creatableStartIcon,
|
|
2972
2977
|
createMessage = (value2) => `Create "${value2}"`,
|
|
2973
2978
|
defaultFilterValue,
|
|
2974
2979
|
defaultTextValue,
|
|
@@ -3052,8 +3057,10 @@ const Combobox = React.forwardRef(
|
|
|
3052
3057
|
}
|
|
3053
3058
|
};
|
|
3054
3059
|
const handleCreateItemClick = () => {
|
|
3055
|
-
if (onCreateOption && internalTextValue) {
|
|
3060
|
+
if (onCreateOption && internalTextValue && creatable !== "visible") {
|
|
3056
3061
|
onCreateOption(internalTextValue);
|
|
3062
|
+
} else if (onCreateOption && creatable === "visible") {
|
|
3063
|
+
onCreateOption();
|
|
3057
3064
|
}
|
|
3058
3065
|
};
|
|
3059
3066
|
const generatedIntersectionId = useId();
|
|
@@ -3080,12 +3087,12 @@ const Combobox = React.forwardRef(
|
|
|
3080
3087
|
return /* @__PURE__ */ jsxs(
|
|
3081
3088
|
Combobox$1.Root,
|
|
3082
3089
|
{
|
|
3083
|
-
autocomplete: autocomplete || (creatable ? "list" : "both"),
|
|
3090
|
+
autocomplete: autocomplete || (creatable === true ? "list" : "both"),
|
|
3084
3091
|
onOpenChange: handleOpenChange,
|
|
3085
3092
|
open: internalIsOpen,
|
|
3086
3093
|
onTextValueChange: handleTextValueChange,
|
|
3087
3094
|
textValue: internalTextValue,
|
|
3088
|
-
allowCustomValue: creatable || allowCustomValue,
|
|
3095
|
+
allowCustomValue: !!creatable || allowCustomValue,
|
|
3089
3096
|
disabled,
|
|
3090
3097
|
required,
|
|
3091
3098
|
value,
|
|
@@ -3093,6 +3100,7 @@ const Combobox = React.forwardRef(
|
|
|
3093
3100
|
filterValue: internalFilterValue,
|
|
3094
3101
|
onFilterValueChange: handleFilterValueChange,
|
|
3095
3102
|
isPrintableCharacter: isPrintableCharacter2,
|
|
3103
|
+
visible: creatable === "visible",
|
|
3096
3104
|
children: [
|
|
3097
3105
|
/* @__PURE__ */ jsxs(Trigger$5, { $hasError: hasError, $size: size, className, children: [
|
|
3098
3106
|
/* @__PURE__ */ jsxs(Flex, { flex: "1", tag: "span", gap: 3, children: [
|
|
@@ -3128,21 +3136,18 @@ const Combobox = React.forwardRef(
|
|
|
3128
3136
|
/* @__PURE__ */ jsx(DownIcon$1, { children: /* @__PURE__ */ jsx(CaretDown, { fill: "neutral500" }) })
|
|
3129
3137
|
] })
|
|
3130
3138
|
] }),
|
|
3131
|
-
/* @__PURE__ */ jsx(Combobox$1.Portal, { children: /* @__PURE__ */ jsx(Content$5, { sideOffset: 4, children: /* @__PURE__ */
|
|
3132
|
-
children
|
|
3133
|
-
|
|
3134
|
-
Combobox$1.
|
|
3135
|
-
{
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
}
|
|
3141
|
-
) : null
|
|
3142
|
-
|
|
3143
|
-
loading ? /* @__PURE__ */ jsx(Flex, { justifyContent: "center", alignItems: "center", paddingTop: 2, paddingBottom: 2, children: /* @__PURE__ */ jsx(Loader, { small: true, children: loadingMessage }) }) : null,
|
|
3144
|
-
/* @__PURE__ */ jsx(Box, { id: intersectionId, width: "100%", height: "1px" })
|
|
3145
|
-
] }) }) }) })
|
|
3139
|
+
/* @__PURE__ */ jsx(Combobox$1.Portal, { children: /* @__PURE__ */ jsx(Content$5, { sideOffset: 4, children: /* @__PURE__ */ jsxs(Combobox$1.Viewport, { ref: viewportRef, children: [
|
|
3140
|
+
/* @__PURE__ */ jsxs(ScrollAreaCombobox, { children: [
|
|
3141
|
+
children,
|
|
3142
|
+
creatable !== true && !loading ? /* @__PURE__ */ jsx(Combobox$1.NoValueFound, { asChild: true, children: /* @__PURE__ */ jsx(OptionBox, { $hasHover: false, children: /* @__PURE__ */ jsx(Typography, { children: noOptionsMessage(internalTextValue ?? "") }) }) }) : null,
|
|
3143
|
+
loading ? /* @__PURE__ */ jsx(Flex, { justifyContent: "center", alignItems: "center", paddingTop: 2, paddingBottom: 2, children: /* @__PURE__ */ jsx(Loader, { small: true, children: loadingMessage }) }) : null,
|
|
3144
|
+
/* @__PURE__ */ jsx(Box, { id: intersectionId, width: "100%", height: "1px" })
|
|
3145
|
+
] }),
|
|
3146
|
+
creatable ? /* @__PURE__ */ jsx(ComboboxCreateItem, { onPointerUp: handleCreateItemClick, asChild: true, children: /* @__PURE__ */ jsx(OptionBox, { children: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
3147
|
+
creatableStartIcon && /* @__PURE__ */ jsx(Box, { tag: "span", "aria-hidden": true, display: "inline-flex", children: creatableStartIcon }),
|
|
3148
|
+
/* @__PURE__ */ jsx(Typography, { children: createMessage(internalTextValue ?? "") })
|
|
3149
|
+
] }) }) }) : null
|
|
3150
|
+
] }) }) })
|
|
3146
3151
|
]
|
|
3147
3152
|
}
|
|
3148
3153
|
);
|
|
@@ -3227,6 +3232,11 @@ const Content$5 = styled(Combobox$1.Content)`
|
|
|
3227
3232
|
max-height: 15rem;
|
|
3228
3233
|
z-index: ${({ theme }) => theme.zIndices.popover};
|
|
3229
3234
|
|
|
3235
|
+
&:focus-visible {
|
|
3236
|
+
outline: ${({ theme }) => `2px solid ${theme.colors.primary600}`};
|
|
3237
|
+
outline-offset: 2px;
|
|
3238
|
+
}
|
|
3239
|
+
|
|
3230
3240
|
@media (prefers-reduced-motion: no-preference) {
|
|
3231
3241
|
animation-duration: ${(props) => props.theme.motion.timings["200"]};
|
|
3232
3242
|
|
|
@@ -3244,7 +3254,29 @@ const Content$5 = styled(Combobox$1.Content)`
|
|
|
3244
3254
|
}
|
|
3245
3255
|
}
|
|
3246
3256
|
`;
|
|
3247
|
-
const
|
|
3257
|
+
const ComboboxCreateItem = styled(Combobox$1.CreateItem)`
|
|
3258
|
+
&& {
|
|
3259
|
+
border-top: 1px solid ${({ theme }) => theme.colors.neutral150};
|
|
3260
|
+
background: ${({ theme }) => theme.colors.neutral0};
|
|
3261
|
+
cursor: pointer;
|
|
3262
|
+
padding: ${({ theme }) => theme.spaces[1]};
|
|
3263
|
+
position: sticky;
|
|
3264
|
+
bottom: 0;
|
|
3265
|
+
left: 0;
|
|
3266
|
+
}
|
|
3267
|
+
&&:hover,
|
|
3268
|
+
&&[data-highlighted] {
|
|
3269
|
+
background-color: transparent;
|
|
3270
|
+
}
|
|
3271
|
+
&& > div {
|
|
3272
|
+
padding: ${({ theme }) => theme.spaces[2]} ${({ theme }) => theme.spaces[4]};
|
|
3273
|
+
}
|
|
3274
|
+
&& > div:hover,
|
|
3275
|
+
&&[data-highlighted] > div {
|
|
3276
|
+
background-color: ${({ theme }) => theme.colors.primary100};
|
|
3277
|
+
}
|
|
3278
|
+
`;
|
|
3279
|
+
const ScrollAreaCombobox = styled(ScrollAreaImpl$1)`
|
|
3248
3280
|
padding: ${({ theme }) => theme.spaces[1]};
|
|
3249
3281
|
`;
|
|
3250
3282
|
const Option = React.forwardRef(
|
|
@@ -3537,6 +3569,14 @@ ${css`
|
|
|
3537
3569
|
outline-offset: 2px;
|
|
3538
3570
|
}
|
|
3539
3571
|
|
|
3572
|
+
*:has(> :disabled:not(button)) {
|
|
3573
|
+
cursor: not-allowed !important;
|
|
3574
|
+
}
|
|
3575
|
+
|
|
3576
|
+
[aria-disabled='true']:not(button) {
|
|
3577
|
+
cursor: not-allowed !important;
|
|
3578
|
+
}
|
|
3579
|
+
|
|
3540
3580
|
/* Focusing the button with a mouse, touch, or stylus will show a subtle drop shadow. */
|
|
3541
3581
|
*:focus:not(:focus-visible) {
|
|
3542
3582
|
outline: none;
|
|
@@ -4683,6 +4723,9 @@ const convertUTCDateToCalendarDate = (date) => {
|
|
|
4683
4723
|
const isNotAlphabeticalCharacter = (str) => {
|
|
4684
4724
|
return Boolean(str.match(/^[^a-zA-Z]*$/));
|
|
4685
4725
|
};
|
|
4726
|
+
function escapeForRegex(str = "") {
|
|
4727
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4728
|
+
}
|
|
4686
4729
|
const TimePicker$1 = React.forwardRef(
|
|
4687
4730
|
({ step = 15, value: valueProp, defaultValue, onChange, ...restProps }, forwardedRef) => {
|
|
4688
4731
|
const context = useDesignSystem("TimePicker");
|
|
@@ -4746,6 +4789,8 @@ const TimePicker$1 = React.forwardRef(
|
|
|
4746
4789
|
setTextValue(actualValue);
|
|
4747
4790
|
}
|
|
4748
4791
|
}, [valueProp, setTextValue]);
|
|
4792
|
+
const escapedSeparator = escapeForRegex(separator);
|
|
4793
|
+
const pattern = `\\d{2}${escapedSeparator}\\d{2}`;
|
|
4749
4794
|
return /* @__PURE__ */ jsx(
|
|
4750
4795
|
Combobox,
|
|
4751
4796
|
{
|
|
@@ -4759,7 +4804,7 @@ const TimePicker$1 = React.forwardRef(
|
|
|
4759
4804
|
autocomplete: "none",
|
|
4760
4805
|
startIcon: /* @__PURE__ */ jsx(Clock, { fill: "neutral500" }),
|
|
4761
4806
|
inputMode: "numeric",
|
|
4762
|
-
pattern
|
|
4807
|
+
pattern,
|
|
4763
4808
|
textValue,
|
|
4764
4809
|
onTextValueChange: handleTextValueChange,
|
|
4765
4810
|
onBlur: handleBlur,
|
|
@@ -5062,6 +5107,7 @@ const JSONInput = React.forwardRef(
|
|
|
5062
5107
|
JSONInputContainer,
|
|
5063
5108
|
{
|
|
5064
5109
|
ref: composedRefs,
|
|
5110
|
+
$disabled: disabled,
|
|
5065
5111
|
$hasError: hasError,
|
|
5066
5112
|
alignItems: "stretch",
|
|
5067
5113
|
fontSize: 2,
|
|
@@ -5085,6 +5131,7 @@ const JSONInputContainer = styled(Flex)`
|
|
|
5085
5131
|
background-color: #32324d;
|
|
5086
5132
|
width: 100%;
|
|
5087
5133
|
outline: none;
|
|
5134
|
+
cursor: ${({ $disabled }) => $disabled ? "not-allowed" : "text"};
|
|
5088
5135
|
}
|
|
5089
5136
|
|
|
5090
5137
|
.cm-scroller {
|
|
@@ -5156,19 +5203,23 @@ const SkipToContent = ({ children }) => {
|
|
|
5156
5203
|
}
|
|
5157
5204
|
);
|
|
5158
5205
|
};
|
|
5159
|
-
const setOpacity = (hex, alpha) => `${hex}${Math.floor(alpha * 255).toString(16).padStart(2, "0")}`;
|
|
5160
5206
|
const Root$3 = Dialog$1.Root;
|
|
5161
5207
|
const Trigger$2 = React.forwardRef((props, forwardedRef) => {
|
|
5162
5208
|
return /* @__PURE__ */ jsx(Dialog$1.Trigger, { ...props, asChild: true, ref: forwardedRef });
|
|
5163
5209
|
});
|
|
5164
5210
|
const Content$2 = React.forwardRef((props, forwardedRef) => {
|
|
5165
|
-
return /* @__PURE__ */
|
|
5211
|
+
return /* @__PURE__ */ jsxs(Dialog$1.Portal, { children: [
|
|
5212
|
+
/* @__PURE__ */ jsx(Overlay, {}),
|
|
5213
|
+
/* @__PURE__ */ jsx(ContentImpl, { ref: forwardedRef, ...props })
|
|
5214
|
+
] });
|
|
5166
5215
|
});
|
|
5167
5216
|
const Overlay = styled(Dialog$1.Overlay)`
|
|
5168
|
-
background: ${(props) =>
|
|
5217
|
+
background-color: ${(props) => props.theme.colors.neutral800};
|
|
5169
5218
|
position: fixed;
|
|
5170
5219
|
inset: 0;
|
|
5171
5220
|
z-index: ${(props) => props.theme.zIndices.overlay};
|
|
5221
|
+
opacity: 0.2;
|
|
5222
|
+
will-change: opacity;
|
|
5172
5223
|
|
|
5173
5224
|
@media (prefers-reduced-motion: no-preference) {
|
|
5174
5225
|
animation: ${ANIMATIONS.overlayFadeIn} ${(props) => props.theme.motion.timings["200"]}
|
|
@@ -5644,6 +5695,7 @@ const RadioGroupItem = styled(RadioGroup.Item)`
|
|
|
5644
5695
|
border-radius: 50%;
|
|
5645
5696
|
border: 1px solid ${(props) => props.theme.colors.neutral300};
|
|
5646
5697
|
position: relative;
|
|
5698
|
+
cursor: pointer;
|
|
5647
5699
|
z-index: 0;
|
|
5648
5700
|
|
|
5649
5701
|
@media (prefers-reduced-motion: no-preference) {
|
|
@@ -5656,6 +5708,7 @@ const RadioGroupItem = styled(RadioGroup.Item)`
|
|
|
5656
5708
|
}
|
|
5657
5709
|
|
|
5658
5710
|
&[data-disabled] {
|
|
5711
|
+
cursor: not-allowed;
|
|
5659
5712
|
background-color: ${(props) => props.theme.colors.neutral200};
|
|
5660
5713
|
}
|
|
5661
5714
|
|
|
@@ -7006,6 +7059,10 @@ const TextareaElement = styled(Box)`
|
|
|
7006
7059
|
&:focus-within {
|
|
7007
7060
|
outline: none;
|
|
7008
7061
|
}
|
|
7062
|
+
|
|
7063
|
+
&:disabled {
|
|
7064
|
+
cursor: not-allowed;
|
|
7065
|
+
}
|
|
7009
7066
|
`;
|
|
7010
7067
|
const Toggle = React.forwardRef(
|
|
7011
7068
|
({
|