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