@strapi/design-system 2.0.0-rc.23 → 2.0.0-rc.25
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/CarouselInput/CarouselSlide.d.ts.map +1 -1
- package/dist/components/Combobox/Combobox.d.ts +1 -0
- package/dist/components/Combobox/Combobox.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.d.ts +1 -0
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.d.ts.map +1 -1
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/components/Searchbar/Searchbar.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 +295 -257
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +77 -41
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { DateFormatter, getLocalTimeZone, today, minDate, maxDate, startOfMonth,
|
|
|
5
5
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
6
6
|
import * as Tooltip from "@radix-ui/react-tooltip";
|
|
7
7
|
import { Provider as Provider$1 } from "@radix-ui/react-tooltip";
|
|
8
|
-
import { styled, css, keyframes, useTheme, createGlobalStyle, ThemeProvider } from "styled-components";
|
|
8
|
+
import styled$1, { styled, css, keyframes, useTheme, createGlobalStyle, ThemeProvider } from "styled-components";
|
|
9
9
|
import * as DismissibleLayerPrimitive from "@radix-ui/react-dismissable-layer";
|
|
10
10
|
import { useCallbackRef as useCallbackRef$1, Combobox as Combobox$1, Select, composeEventHandlers, usePrev } from "@strapi/ui-primitives";
|
|
11
11
|
import { composeEventHandlers as composeEventHandlers2, useCallbackRef as useCallbackRef2, useCollator, useFilter } from "@strapi/ui-primitives";
|
|
@@ -2714,8 +2714,8 @@ const InputElement = styled.input`
|
|
|
2714
2714
|
width: 100%;
|
|
2715
2715
|
background: inherit;
|
|
2716
2716
|
|
|
2717
|
-
|
|
2718
|
-
color: ${({ theme }) => theme.colors.
|
|
2717
|
+
&::placeholder {
|
|
2718
|
+
color: ${({ theme }) => theme.colors.neutral600};
|
|
2719
2719
|
opacity: 1;
|
|
2720
2720
|
}
|
|
2721
2721
|
|
|
@@ -2875,11 +2875,14 @@ const CarouselImage = (props) => {
|
|
|
2875
2875
|
}
|
|
2876
2876
|
return /* @__PURE__ */ jsx(StyledImage, { tag: "img", height: "100%", maxWidth: "100%", ...props, onError: handleImageError });
|
|
2877
2877
|
};
|
|
2878
|
+
const CarouselSlideFlex = styled(Flex)`
|
|
2879
|
+
display: ${({ $selected }) => $selected ? "flex" : "none"};
|
|
2880
|
+
`;
|
|
2878
2881
|
const CarouselSlide = ({ label, children, selected = false, ...props }) => /* @__PURE__ */ jsx(
|
|
2879
|
-
|
|
2882
|
+
CarouselSlideFlex,
|
|
2880
2883
|
{
|
|
2884
|
+
$selected: selected,
|
|
2881
2885
|
alignItems: "center",
|
|
2882
|
-
display: selected ? "flex" : "none",
|
|
2883
2886
|
role: "group",
|
|
2884
2887
|
"aria-roledescription": "slide",
|
|
2885
2888
|
"aria-label": label,
|
|
@@ -2973,6 +2976,7 @@ const Combobox = React.forwardRef(
|
|
|
2973
2976
|
className,
|
|
2974
2977
|
clearLabel = "Clear",
|
|
2975
2978
|
creatable = false,
|
|
2979
|
+
creatableDisabled = false,
|
|
2976
2980
|
creatableStartIcon,
|
|
2977
2981
|
createMessage = (value2) => `Create "${value2}"`,
|
|
2978
2982
|
defaultFilterValue,
|
|
@@ -3144,10 +3148,19 @@ const Combobox = React.forwardRef(
|
|
|
3144
3148
|
loading ? /* @__PURE__ */ jsx(Flex, { justifyContent: "center", alignItems: "center", paddingTop: 2, paddingBottom: 2, children: /* @__PURE__ */ jsx(Loader, { small: true, children: loadingMessage }) }) : null,
|
|
3145
3149
|
/* @__PURE__ */ jsx(Box, { id: intersectionId, width: "100%", height: "1px" })
|
|
3146
3150
|
] }),
|
|
3147
|
-
creatable ? /* @__PURE__ */ jsx(
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
+
creatable ? /* @__PURE__ */ jsx(
|
|
3152
|
+
ComboboxCreateItem,
|
|
3153
|
+
{
|
|
3154
|
+
onPointerUp: handleCreateItemClick,
|
|
3155
|
+
onClick: handleCreateItemClick,
|
|
3156
|
+
disabled: creatableDisabled,
|
|
3157
|
+
asChild: true,
|
|
3158
|
+
children: /* @__PURE__ */ jsx(OptionBox, { children: /* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
|
3159
|
+
creatableStartIcon && /* @__PURE__ */ jsx(Box, { tag: "span", "aria-hidden": true, display: "inline-flex", children: creatableStartIcon }),
|
|
3160
|
+
/* @__PURE__ */ jsx(Typography, { children: createMessage(internalTextValue ?? "") })
|
|
3161
|
+
] }) })
|
|
3162
|
+
}
|
|
3163
|
+
) : null
|
|
3151
3164
|
] }) }) })
|
|
3152
3165
|
]
|
|
3153
3166
|
}
|
|
@@ -3208,6 +3221,11 @@ const TextInput$1 = styled(Combobox$1.TextInput)`
|
|
|
3208
3221
|
outline: none;
|
|
3209
3222
|
}
|
|
3210
3223
|
|
|
3224
|
+
&::placeholder {
|
|
3225
|
+
color: ${({ theme }) => theme.colors.neutral600};
|
|
3226
|
+
opacity: 1;
|
|
3227
|
+
}
|
|
3228
|
+
|
|
3211
3229
|
&[aria-disabled='true'] {
|
|
3212
3230
|
cursor: inherit;
|
|
3213
3231
|
}
|
|
@@ -3267,7 +3285,18 @@ const ComboboxCreateItem = styled(Combobox$1.CreateItem)`
|
|
|
3267
3285
|
}
|
|
3268
3286
|
&&:hover,
|
|
3269
3287
|
&&[data-highlighted] {
|
|
3270
|
-
background
|
|
3288
|
+
background: ${({ theme }) => theme.colors.neutral0};
|
|
3289
|
+
}
|
|
3290
|
+
&&[data-disabled] {
|
|
3291
|
+
color: ${({ theme }) => theme.colors.neutral600};
|
|
3292
|
+
background: ${({ theme }) => theme.colors.neutral150};
|
|
3293
|
+
cursor: not-allowed;
|
|
3294
|
+
border-bottom-left-radius: 0;
|
|
3295
|
+
border-bottom-right-radius: 0;
|
|
3296
|
+
}
|
|
3297
|
+
&&[data-disabled]:hover {
|
|
3298
|
+
background: ${({ theme }) => theme.colors.neutral150};
|
|
3299
|
+
color: ${({ theme }) => theme.colors.neutral600};
|
|
3271
3300
|
}
|
|
3272
3301
|
&& > div {
|
|
3273
3302
|
padding: ${({ theme }) => theme.spaces[2]} ${({ theme }) => theme.spaces[4]};
|
|
@@ -3276,6 +3305,9 @@ const ComboboxCreateItem = styled(Combobox$1.CreateItem)`
|
|
|
3276
3305
|
&&[data-highlighted] > div {
|
|
3277
3306
|
background-color: ${({ theme }) => theme.colors.primary100};
|
|
3278
3307
|
}
|
|
3308
|
+
&&[data-disabled] > div:hover {
|
|
3309
|
+
background: ${({ theme }) => theme.colors.neutral150};
|
|
3310
|
+
}
|
|
3279
3311
|
`;
|
|
3280
3312
|
const ScrollAreaCombobox = styled(ScrollAreaImpl$1)`
|
|
3281
3313
|
padding: ${({ theme }) => theme.spaces[1]};
|
|
@@ -3953,7 +3985,7 @@ const SingleSelectOption = React.forwardRef(
|
|
|
3953
3985
|
const DEFAULT_PAST_RANGE = 200;
|
|
3954
3986
|
const DEFAULT_FUTURE_RANGE = 15;
|
|
3955
3987
|
const [DatePickerProvider, useDatePickerContext] = createContext("DatePicker");
|
|
3956
|
-
const DatePicker
|
|
3988
|
+
const DatePicker = React.forwardRef(
|
|
3957
3989
|
({
|
|
3958
3990
|
/**
|
|
3959
3991
|
* DatePickerCalendar props
|
|
@@ -4082,6 +4114,7 @@ const DatePicker$1 = React.forwardRef(
|
|
|
4082
4114
|
onTextValueChange: setTextValue,
|
|
4083
4115
|
onTriggerChange: setTrigger,
|
|
4084
4116
|
onValueChange: setValue,
|
|
4117
|
+
onClear,
|
|
4085
4118
|
required,
|
|
4086
4119
|
textInput,
|
|
4087
4120
|
textValue,
|
|
@@ -4159,6 +4192,7 @@ const DatePickerTrigger = React.forwardRef(
|
|
|
4159
4192
|
ref: composedRefs,
|
|
4160
4193
|
$hasError: hasError,
|
|
4161
4194
|
$size: size,
|
|
4195
|
+
$hasOnClear: Boolean(context.onClear),
|
|
4162
4196
|
...restProps,
|
|
4163
4197
|
hasRadius: true,
|
|
4164
4198
|
gap: 3,
|
|
@@ -4188,6 +4222,7 @@ const DatePickerTrigger = React.forwardRef(
|
|
|
4188
4222
|
}
|
|
4189
4223
|
);
|
|
4190
4224
|
const TriggerElement = styled(Flex)`
|
|
4225
|
+
min-width: ${({ $hasOnClear }) => $hasOnClear ? "160px" : "130px"};
|
|
4191
4226
|
border: 1px solid ${({ theme, $hasError }) => $hasError ? theme.colors.danger600 : theme.colors.neutral200};
|
|
4192
4227
|
${(props) => {
|
|
4193
4228
|
switch (props.$size) {
|
|
@@ -4412,6 +4447,11 @@ const Input$1 = styled.input`
|
|
|
4412
4447
|
outline: none;
|
|
4413
4448
|
}
|
|
4414
4449
|
|
|
4450
|
+
&::placeholder {
|
|
4451
|
+
color: ${({ theme }) => theme.colors.neutral600};
|
|
4452
|
+
opacity: 1;
|
|
4453
|
+
}
|
|
4454
|
+
|
|
4415
4455
|
&[aria-disabled='true'] {
|
|
4416
4456
|
cursor: inherit;
|
|
4417
4457
|
}
|
|
@@ -4727,7 +4767,10 @@ const isNotAlphabeticalCharacter = (str) => {
|
|
|
4727
4767
|
function escapeForRegex(str = "") {
|
|
4728
4768
|
return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4729
4769
|
}
|
|
4730
|
-
const
|
|
4770
|
+
const TimePickerCombobox = styled$1(Combobox)`
|
|
4771
|
+
min-width: ${({ onClear }) => onClear ? "160px" : "130px"};
|
|
4772
|
+
`;
|
|
4773
|
+
const TimePicker = React.forwardRef(
|
|
4731
4774
|
({ step = 15, value: valueProp, defaultValue, onChange, ...restProps }, forwardedRef) => {
|
|
4732
4775
|
const context = useDesignSystem("TimePicker");
|
|
4733
4776
|
const [textValue, setTextValue] = React.useState("");
|
|
@@ -4793,7 +4836,7 @@ const TimePicker$1 = React.forwardRef(
|
|
|
4793
4836
|
const escapedSeparator = escapeForRegex(separator);
|
|
4794
4837
|
const pattern = `\\d{2}${escapedSeparator}\\d{2}`;
|
|
4795
4838
|
return /* @__PURE__ */ jsx(
|
|
4796
|
-
|
|
4839
|
+
TimePickerCombobox,
|
|
4797
4840
|
{
|
|
4798
4841
|
...restProps,
|
|
4799
4842
|
ref: forwardedRef,
|
|
@@ -4814,14 +4857,6 @@ const TimePicker$1 = React.forwardRef(
|
|
|
4814
4857
|
);
|
|
4815
4858
|
}
|
|
4816
4859
|
);
|
|
4817
|
-
const DatePicker = styled(DatePicker$1)`
|
|
4818
|
-
flex: 1 1 70%;
|
|
4819
|
-
min-width: 120px;
|
|
4820
|
-
`;
|
|
4821
|
-
const TimePicker = styled(TimePicker$1)`
|
|
4822
|
-
flex: 1 1 30%;
|
|
4823
|
-
min-width: 140px;
|
|
4824
|
-
`;
|
|
4825
4860
|
const DateTimePicker = React.forwardRef(
|
|
4826
4861
|
({
|
|
4827
4862
|
clearLabel = "clear",
|
|
@@ -4890,8 +4925,8 @@ const DateTimePicker = React.forwardRef(
|
|
|
4890
4925
|
const composedRefs = useComposedRefs(DatePickerElement2, forwardedRef);
|
|
4891
4926
|
const { error, id, labelNode } = useField("DateTimePicker");
|
|
4892
4927
|
const hasError = Boolean(error) || hasErrorProp;
|
|
4893
|
-
return /* @__PURE__ */ jsxs(Flex, { "aria-labelledby": labelNode ? `${id}-label` : void 0, role: "group", flex: "1", gap: 1, children: [
|
|
4894
|
-
/* @__PURE__ */ jsx(Root$6, { children: /* @__PURE__ */ jsx(
|
|
4928
|
+
return /* @__PURE__ */ jsxs(Flex, { "aria-labelledby": labelNode ? `${id}-label` : void 0, role: "group", flex: "1", gap: 1, wrap: "wrap", children: [
|
|
4929
|
+
/* @__PURE__ */ jsx(Root$6, { flex: "1", children: /* @__PURE__ */ jsx(
|
|
4895
4930
|
DatePicker,
|
|
4896
4931
|
{
|
|
4897
4932
|
...props,
|
|
@@ -4906,7 +4941,7 @@ const DateTimePicker = React.forwardRef(
|
|
|
4906
4941
|
"aria-label": dateLabel
|
|
4907
4942
|
}
|
|
4908
4943
|
) }),
|
|
4909
|
-
/* @__PURE__ */ jsx(Root$6, { children: /* @__PURE__ */ jsx(
|
|
4944
|
+
/* @__PURE__ */ jsx(Root$6, { flex: "1", children: /* @__PURE__ */ jsx(
|
|
4910
4945
|
TimePicker,
|
|
4911
4946
|
{
|
|
4912
4947
|
size,
|
|
@@ -5204,22 +5239,19 @@ const SkipToContent = ({ children }) => {
|
|
|
5204
5239
|
}
|
|
5205
5240
|
);
|
|
5206
5241
|
};
|
|
5242
|
+
const setOpacity = (hex, alpha) => `${hex}${Math.floor(alpha * 255).toString(16).padStart(2, "0")}`;
|
|
5207
5243
|
const Root$3 = Dialog$1.Root;
|
|
5208
5244
|
const Trigger$2 = React.forwardRef((props, forwardedRef) => {
|
|
5209
5245
|
return /* @__PURE__ */ jsx(Dialog$1.Trigger, { ...props, asChild: true, ref: forwardedRef });
|
|
5210
5246
|
});
|
|
5211
5247
|
const Content$2 = React.forwardRef((props, forwardedRef) => {
|
|
5212
|
-
return /* @__PURE__ */
|
|
5213
|
-
/* @__PURE__ */ jsx(Overlay, {}),
|
|
5214
|
-
/* @__PURE__ */ jsx(ContentImpl, { ref: forwardedRef, ...props })
|
|
5215
|
-
] });
|
|
5248
|
+
return /* @__PURE__ */ jsx(Dialog$1.Portal, { children: /* @__PURE__ */ jsx(Overlay, { children: /* @__PURE__ */ jsx(ContentImpl, { ref: forwardedRef, ...props }) }) });
|
|
5216
5249
|
});
|
|
5217
5250
|
const Overlay = styled(Dialog$1.Overlay)`
|
|
5218
|
-
background
|
|
5251
|
+
background: ${(props) => setOpacity(props.theme.colors.neutral800, 0.2)};
|
|
5219
5252
|
position: fixed;
|
|
5220
5253
|
inset: 0;
|
|
5221
5254
|
z-index: ${(props) => props.theme.zIndices.overlay};
|
|
5222
|
-
opacity: 0.2;
|
|
5223
5255
|
will-change: opacity;
|
|
5224
5256
|
|
|
5225
5257
|
@media (prefers-reduced-motion: no-preference) {
|
|
@@ -5247,6 +5279,11 @@ const ContentImpl = styled(Dialog$1.Content)`
|
|
|
5247
5279
|
box-shadow: ${(props) => props.theme.shadows.popupShadow};
|
|
5248
5280
|
z-index: ${(props) => props.theme.zIndices.modal};
|
|
5249
5281
|
|
|
5282
|
+
> form {
|
|
5283
|
+
display: flex;
|
|
5284
|
+
flex-direction: column;
|
|
5285
|
+
overflow: hidden;
|
|
5286
|
+
}
|
|
5250
5287
|
@media (prefers-reduced-motion: no-preference) {
|
|
5251
5288
|
&[data-state='open'] {
|
|
5252
5289
|
animation-duration: ${(props) => props.theme.motion.timings["200"]};
|
|
@@ -5295,10 +5332,14 @@ const Body = React.forwardRef(({ children, ...restProps }, forwardedRef) => {
|
|
|
5295
5332
|
return /* @__PURE__ */ jsx(BodyScroll, { ref: forwardedRef, ...restProps, children });
|
|
5296
5333
|
});
|
|
5297
5334
|
const BodyScroll = styled(ScrollAreaImpl$1)`
|
|
5298
|
-
padding-inline: ${(props) => props.theme.spaces[
|
|
5335
|
+
padding-inline: ${(props) => props.theme.spaces[7]};
|
|
5299
5336
|
|
|
5300
5337
|
& > div {
|
|
5301
5338
|
padding-block: ${(props) => props.theme.spaces[8]};
|
|
5339
|
+
/* Add negative margin and padding to avoid cropping the box shadow when the inputs are focused */
|
|
5340
|
+
margin: 0 -2px 0 -2px;
|
|
5341
|
+
padding-left: 2px;
|
|
5342
|
+
padding-right: 2px;
|
|
5302
5343
|
|
|
5303
5344
|
& > div {
|
|
5304
5345
|
// the scroll area component applies a display: table to the child, which we don't want.
|
|
@@ -6014,11 +6055,7 @@ const SearchbarInput = styled(Input$2)`
|
|
|
6014
6055
|
height: 16px;
|
|
6015
6056
|
padding: 0 0 0 8px;
|
|
6016
6057
|
color: ${({ theme }) => theme.colors.neutral800};
|
|
6017
|
-
|
|
6018
|
-
&::placeholder {
|
|
6019
|
-
color: ${({ theme }) => theme.colors.neutral500};
|
|
6020
|
-
}
|
|
6021
|
-
|
|
6058
|
+
|
|
6022
6059
|
&:hover {
|
|
6023
6060
|
button {
|
|
6024
6061
|
cursor: pointer;
|
|
@@ -7050,10 +7087,9 @@ const TextareaElement = styled(Box)`
|
|
|
7050
7087
|
border: none;
|
|
7051
7088
|
resize: none;
|
|
7052
7089
|
|
|
7053
|
-
|
|
7054
|
-
color: ${({ theme }) => theme.colors.
|
|
7090
|
+
&::placeholder {
|
|
7091
|
+
color: ${({ theme }) => theme.colors.neutral600};
|
|
7055
7092
|
font-size: ${({ theme }) => theme.fontSizes[2]};
|
|
7056
|
-
color: ${({ theme }) => theme.colors.neutral500};
|
|
7057
7093
|
opacity: 1;
|
|
7058
7094
|
}
|
|
7059
7095
|
|
|
@@ -7404,7 +7440,7 @@ export {
|
|
|
7404
7440
|
Crumb,
|
|
7405
7441
|
CrumbLink,
|
|
7406
7442
|
CrumbSimpleMenu,
|
|
7407
|
-
DatePicker
|
|
7443
|
+
DatePicker,
|
|
7408
7444
|
DateTimePicker,
|
|
7409
7445
|
DesignSystemProvider,
|
|
7410
7446
|
Dialog,
|
|
@@ -7473,7 +7509,7 @@ export {
|
|
|
7473
7509
|
Textarea,
|
|
7474
7510
|
Th,
|
|
7475
7511
|
Thead,
|
|
7476
|
-
TimePicker
|
|
7512
|
+
TimePicker,
|
|
7477
7513
|
Toggle,
|
|
7478
7514
|
TooltipImpl as Tooltip,
|
|
7479
7515
|
Tr,
|