@strapi/design-system 2.0.0-rc.24 → 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/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
- ::placeholder {
2718
- color: ${({ theme }) => theme.colors.neutral500};
2717
+ &::placeholder {
2718
+ color: ${({ theme }) => theme.colors.neutral600};
2719
2719
  opacity: 1;
2720
2720
  }
2721
2721
 
@@ -3221,6 +3221,11 @@ const TextInput$1 = styled(Combobox$1.TextInput)`
3221
3221
  outline: none;
3222
3222
  }
3223
3223
 
3224
+ &::placeholder {
3225
+ color: ${({ theme }) => theme.colors.neutral600};
3226
+ opacity: 1;
3227
+ }
3228
+
3224
3229
  &[aria-disabled='true'] {
3225
3230
  cursor: inherit;
3226
3231
  }
@@ -3980,7 +3985,7 @@ const SingleSelectOption = React.forwardRef(
3980
3985
  const DEFAULT_PAST_RANGE = 200;
3981
3986
  const DEFAULT_FUTURE_RANGE = 15;
3982
3987
  const [DatePickerProvider, useDatePickerContext] = createContext("DatePicker");
3983
- const DatePicker$1 = React.forwardRef(
3988
+ const DatePicker = React.forwardRef(
3984
3989
  ({
3985
3990
  /**
3986
3991
  * DatePickerCalendar props
@@ -4109,6 +4114,7 @@ const DatePicker$1 = React.forwardRef(
4109
4114
  onTextValueChange: setTextValue,
4110
4115
  onTriggerChange: setTrigger,
4111
4116
  onValueChange: setValue,
4117
+ onClear,
4112
4118
  required,
4113
4119
  textInput,
4114
4120
  textValue,
@@ -4186,6 +4192,7 @@ const DatePickerTrigger = React.forwardRef(
4186
4192
  ref: composedRefs,
4187
4193
  $hasError: hasError,
4188
4194
  $size: size,
4195
+ $hasOnClear: Boolean(context.onClear),
4189
4196
  ...restProps,
4190
4197
  hasRadius: true,
4191
4198
  gap: 3,
@@ -4215,6 +4222,7 @@ const DatePickerTrigger = React.forwardRef(
4215
4222
  }
4216
4223
  );
4217
4224
  const TriggerElement = styled(Flex)`
4225
+ min-width: ${({ $hasOnClear }) => $hasOnClear ? "160px" : "130px"};
4218
4226
  border: 1px solid ${({ theme, $hasError }) => $hasError ? theme.colors.danger600 : theme.colors.neutral200};
4219
4227
  ${(props) => {
4220
4228
  switch (props.$size) {
@@ -4439,6 +4447,11 @@ const Input$1 = styled.input`
4439
4447
  outline: none;
4440
4448
  }
4441
4449
 
4450
+ &::placeholder {
4451
+ color: ${({ theme }) => theme.colors.neutral600};
4452
+ opacity: 1;
4453
+ }
4454
+
4442
4455
  &[aria-disabled='true'] {
4443
4456
  cursor: inherit;
4444
4457
  }
@@ -4754,7 +4767,10 @@ const isNotAlphabeticalCharacter = (str) => {
4754
4767
  function escapeForRegex(str = "") {
4755
4768
  return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
4756
4769
  }
4757
- const TimePicker$1 = React.forwardRef(
4770
+ const TimePickerCombobox = styled$1(Combobox)`
4771
+ min-width: ${({ onClear }) => onClear ? "160px" : "130px"};
4772
+ `;
4773
+ const TimePicker = React.forwardRef(
4758
4774
  ({ step = 15, value: valueProp, defaultValue, onChange, ...restProps }, forwardedRef) => {
4759
4775
  const context = useDesignSystem("TimePicker");
4760
4776
  const [textValue, setTextValue] = React.useState("");
@@ -4820,7 +4836,7 @@ const TimePicker$1 = React.forwardRef(
4820
4836
  const escapedSeparator = escapeForRegex(separator);
4821
4837
  const pattern = `\\d{2}${escapedSeparator}\\d{2}`;
4822
4838
  return /* @__PURE__ */ jsx(
4823
- Combobox,
4839
+ TimePickerCombobox,
4824
4840
  {
4825
4841
  ...restProps,
4826
4842
  ref: forwardedRef,
@@ -4841,14 +4857,6 @@ const TimePicker$1 = React.forwardRef(
4841
4857
  );
4842
4858
  }
4843
4859
  );
4844
- const DatePicker = styled(DatePicker$1)`
4845
- flex: 1 1 70%;
4846
- min-width: 120px;
4847
- `;
4848
- const TimePicker = styled(TimePicker$1)`
4849
- flex: 1 1 30%;
4850
- min-width: 140px;
4851
- `;
4852
4860
  const DateTimePicker = React.forwardRef(
4853
4861
  ({
4854
4862
  clearLabel = "clear",
@@ -4917,8 +4925,8 @@ const DateTimePicker = React.forwardRef(
4917
4925
  const composedRefs = useComposedRefs(DatePickerElement2, forwardedRef);
4918
4926
  const { error, id, labelNode } = useField("DateTimePicker");
4919
4927
  const hasError = Boolean(error) || hasErrorProp;
4920
- return /* @__PURE__ */ jsxs(Flex, { "aria-labelledby": labelNode ? `${id}-label` : void 0, role: "group", flex: "1", gap: 1, children: [
4921
- /* @__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(
4922
4930
  DatePicker,
4923
4931
  {
4924
4932
  ...props,
@@ -4933,7 +4941,7 @@ const DateTimePicker = React.forwardRef(
4933
4941
  "aria-label": dateLabel
4934
4942
  }
4935
4943
  ) }),
4936
- /* @__PURE__ */ jsx(Root$6, { children: /* @__PURE__ */ jsx(
4944
+ /* @__PURE__ */ jsx(Root$6, { flex: "1", children: /* @__PURE__ */ jsx(
4937
4945
  TimePicker,
4938
4946
  {
4939
4947
  size,
@@ -5231,22 +5239,19 @@ const SkipToContent = ({ children }) => {
5231
5239
  }
5232
5240
  );
5233
5241
  };
5242
+ const setOpacity = (hex, alpha) => `${hex}${Math.floor(alpha * 255).toString(16).padStart(2, "0")}`;
5234
5243
  const Root$3 = Dialog$1.Root;
5235
5244
  const Trigger$2 = React.forwardRef((props, forwardedRef) => {
5236
5245
  return /* @__PURE__ */ jsx(Dialog$1.Trigger, { ...props, asChild: true, ref: forwardedRef });
5237
5246
  });
5238
5247
  const Content$2 = React.forwardRef((props, forwardedRef) => {
5239
- return /* @__PURE__ */ jsxs(Dialog$1.Portal, { children: [
5240
- /* @__PURE__ */ jsx(Overlay, {}),
5241
- /* @__PURE__ */ jsx(ContentImpl, { ref: forwardedRef, ...props })
5242
- ] });
5248
+ return /* @__PURE__ */ jsx(Dialog$1.Portal, { children: /* @__PURE__ */ jsx(Overlay, { children: /* @__PURE__ */ jsx(ContentImpl, { ref: forwardedRef, ...props }) }) });
5243
5249
  });
5244
5250
  const Overlay = styled(Dialog$1.Overlay)`
5245
- background-color: ${(props) => props.theme.colors.neutral800};
5251
+ background: ${(props) => setOpacity(props.theme.colors.neutral800, 0.2)};
5246
5252
  position: fixed;
5247
5253
  inset: 0;
5248
5254
  z-index: ${(props) => props.theme.zIndices.overlay};
5249
- opacity: 0.2;
5250
5255
  will-change: opacity;
5251
5256
 
5252
5257
  @media (prefers-reduced-motion: no-preference) {
@@ -5274,6 +5279,11 @@ const ContentImpl = styled(Dialog$1.Content)`
5274
5279
  box-shadow: ${(props) => props.theme.shadows.popupShadow};
5275
5280
  z-index: ${(props) => props.theme.zIndices.modal};
5276
5281
 
5282
+ > form {
5283
+ display: flex;
5284
+ flex-direction: column;
5285
+ overflow: hidden;
5286
+ }
5277
5287
  @media (prefers-reduced-motion: no-preference) {
5278
5288
  &[data-state='open'] {
5279
5289
  animation-duration: ${(props) => props.theme.motion.timings["200"]};
@@ -5322,7 +5332,7 @@ const Body = React.forwardRef(({ children, ...restProps }, forwardedRef) => {
5322
5332
  return /* @__PURE__ */ jsx(BodyScroll, { ref: forwardedRef, ...restProps, children });
5323
5333
  });
5324
5334
  const BodyScroll = styled(ScrollAreaImpl$1)`
5325
- padding-inline: ${(props) => props.theme.spaces[8]};
5335
+ padding-inline: ${(props) => props.theme.spaces[7]};
5326
5336
 
5327
5337
  & > div {
5328
5338
  padding-block: ${(props) => props.theme.spaces[8]};
@@ -6045,11 +6055,7 @@ const SearchbarInput = styled(Input$2)`
6045
6055
  height: 16px;
6046
6056
  padding: 0 0 0 8px;
6047
6057
  color: ${({ theme }) => theme.colors.neutral800};
6048
-
6049
- &::placeholder {
6050
- color: ${({ theme }) => theme.colors.neutral500};
6051
- }
6052
-
6058
+
6053
6059
  &:hover {
6054
6060
  button {
6055
6061
  cursor: pointer;
@@ -7081,10 +7087,9 @@ const TextareaElement = styled(Box)`
7081
7087
  border: none;
7082
7088
  resize: none;
7083
7089
 
7084
- ::placeholder {
7085
- color: ${({ theme }) => theme.colors.neutral500};
7090
+ &::placeholder {
7091
+ color: ${({ theme }) => theme.colors.neutral600};
7086
7092
  font-size: ${({ theme }) => theme.fontSizes[2]};
7087
- color: ${({ theme }) => theme.colors.neutral500};
7088
7093
  opacity: 1;
7089
7094
  }
7090
7095
 
@@ -7435,7 +7440,7 @@ export {
7435
7440
  Crumb,
7436
7441
  CrumbLink,
7437
7442
  CrumbSimpleMenu,
7438
- DatePicker$1 as DatePicker,
7443
+ DatePicker,
7439
7444
  DateTimePicker,
7440
7445
  DesignSystemProvider,
7441
7446
  Dialog,
@@ -7504,7 +7509,7 @@ export {
7504
7509
  Textarea,
7505
7510
  Th,
7506
7511
  Thead,
7507
- TimePicker$1 as TimePicker,
7512
+ TimePicker,
7508
7513
  Toggle,
7509
7514
  TooltipImpl as Tooltip,
7510
7515
  Tr,