@strapi/design-system 2.0.0-beta.5 → 2.0.0-beta.6

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.js CHANGED
@@ -25,7 +25,9 @@ const Dialog$1 = require("@radix-ui/react-dialog");
25
25
  const ScrollArea = require("@radix-ui/react-scroll-area");
26
26
  const number = require("@internationalized/number");
27
27
  const Popover$1 = require("@radix-ui/react-popover");
28
+ const Progress = require("@radix-ui/react-progress");
28
29
  const RadioGroup = require("@radix-ui/react-radio-group");
30
+ const Switch = require("@radix-ui/react-switch");
29
31
  const Tabs$1 = require("@radix-ui/react-tabs");
30
32
  function _interopNamespace(e) {
31
33
  if (e && e.__esModule)
@@ -56,7 +58,9 @@ const AlertDialog__namespace = /* @__PURE__ */ _interopNamespace(AlertDialog);
56
58
  const Dialog__namespace = /* @__PURE__ */ _interopNamespace(Dialog$1);
57
59
  const ScrollArea__namespace = /* @__PURE__ */ _interopNamespace(ScrollArea);
58
60
  const Popover__namespace = /* @__PURE__ */ _interopNamespace(Popover$1);
61
+ const Progress__namespace = /* @__PURE__ */ _interopNamespace(Progress);
59
62
  const RadioGroup__namespace = /* @__PURE__ */ _interopNamespace(RadioGroup);
63
+ const Switch__namespace = /* @__PURE__ */ _interopNamespace(Switch);
60
64
  const Tabs__namespace = /* @__PURE__ */ _interopNamespace(Tabs$1);
61
65
  const createContext = (rootComponentName, defaultContext) => {
62
66
  const Context = React__namespace.createContext(defaultContext);
@@ -1515,7 +1519,7 @@ const ButtonWrapper = styledComponents.styled(BaseButton)`
1515
1519
  }
1516
1520
  `;
1517
1521
  const Link = forwardRef(
1518
- ({ children, href, disabled = false, startIcon, endIcon, isExternal = true, ...props }, ref) => {
1522
+ ({ children, href, disabled = false, startIcon, endIcon, isExternal = false, ...props }, ref) => {
1519
1523
  return /* @__PURE__ */ jsxRuntime.jsxs(LinkWrapper$2, { ref, href, disabled, isExternal, ...props, children: [
1520
1524
  startIcon,
1521
1525
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { textColor: disabled ? "neutral600" : "primary600", children }),
@@ -7862,6 +7866,7 @@ const Input$2 = React__namespace.forwardRef(
7862
7866
  hasError: hasErrorProp,
7863
7867
  required: requiredProp,
7864
7868
  className,
7869
+ size = "M",
7865
7870
  ...props
7866
7871
  }, ref) => {
7867
7872
  const { id, error, hint, name, required } = useField("Input");
@@ -7880,10 +7885,6 @@ const Input$2 = React__namespace.forwardRef(
7880
7885
  return /* @__PURE__ */ jsxRuntime.jsxs(
7881
7886
  InputWrapper,
7882
7887
  {
7883
- paddingLeft: 3,
7884
- paddingRight: 3,
7885
- paddingTop: 2,
7886
- paddingBottom: 2,
7887
7888
  gap: 2,
7888
7889
  justifyContent: "space-between",
7889
7890
  $hasError: hasError || hasErrorProp,
@@ -7897,13 +7898,14 @@ const Input$2 = React__namespace.forwardRef(
7897
7898
  id,
7898
7899
  name,
7899
7900
  ref,
7901
+ $hasLeftAction: Boolean(startAction),
7902
+ $hasRightAction: Boolean(endAction),
7903
+ $size: size,
7900
7904
  "aria-describedby": ariaDescription,
7901
7905
  "aria-invalid": hasError || hasErrorProp,
7902
7906
  "aria-disabled": disabled,
7903
7907
  disabled,
7904
7908
  "data-disabled": disabled ? "" : void 0,
7905
- $hasLeftAction: Boolean(startAction),
7906
- $hasRightAction: Boolean(endAction),
7907
7909
  onChange: handleChange,
7908
7910
  "aria-required": required || requiredProp,
7909
7911
  ...props
@@ -7928,6 +7930,23 @@ const InputElement = styledComponents.styled.input`
7928
7930
  width: 100%;
7929
7931
  background: inherit;
7930
7932
 
7933
+ ${(props) => {
7934
+ switch (props.$size) {
7935
+ case "S":
7936
+ return styledComponents.css`
7937
+ padding-inline-start: ${props.$hasLeftAction ? props.theme.spaces[3] : props.theme.spaces[4]};
7938
+ padding-inline-end: ${props.$hasRightAction ? props.theme.spaces[3] : props.theme.spaces[4]};
7939
+ padding-block: ${props.theme.spaces[1]};
7940
+ `;
7941
+ default:
7942
+ return styledComponents.css`
7943
+ padding-inline-start: ${props.$hasLeftAction ? props.theme.spaces[3] : props.theme.spaces[4]};
7944
+ padding-inline-end: ${props.$hasRightAction ? props.theme.spaces[3] : props.theme.spaces[4]};
7945
+ padding-block: ${props.theme.spaces[2]};
7946
+ `;
7947
+ }
7948
+ }};
7949
+
7931
7950
  ::placeholder {
7932
7951
  color: ${({ theme }) => theme.colors.neutral500};
7933
7952
  opacity: 1;
@@ -8131,6 +8150,7 @@ const Combobox = React__namespace.forwardRef(
8131
8150
  onLoadMore,
8132
8151
  placeholder = "Select or enter a value",
8133
8152
  required: requiredProp = false,
8153
+ size = "M",
8134
8154
  startIcon,
8135
8155
  textValue,
8136
8156
  value,
@@ -8230,7 +8250,7 @@ const Combobox = React__namespace.forwardRef(
8230
8250
  onFilterValueChange: handleFilterValueChange,
8231
8251
  isPrintableCharacter: isPrintableCharacter2,
8232
8252
  children: [
8233
- /* @__PURE__ */ jsxRuntime.jsxs(Trigger$5, { $hasError: hasError, className, children: [
8253
+ /* @__PURE__ */ jsxRuntime.jsxs(Trigger$5, { $hasError: hasError, $size: size, className, children: [
8234
8254
  /* @__PURE__ */ jsxRuntime.jsxs(Flex, { flex: "1", tag: "span", gap: 3, children: [
8235
8255
  startIcon ? /* @__PURE__ */ jsxRuntime.jsx(Box, { flex: "0 0 1.6rem", tag: "span", "aria-hidden": true, children: startIcon }) : null,
8236
8256
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -8295,10 +8315,6 @@ const IconBox$3 = styledComponents.styled(Box)`
8295
8315
  const Trigger$5 = styledComponents.styled(uiPrimitives.Combobox.Trigger)`
8296
8316
  position: relative;
8297
8317
  border: 1px solid ${({ theme, $hasError }) => $hasError ? theme.colors.danger600 : theme.colors.neutral200};
8298
- padding-right: ${({ theme }) => theme.spaces[3]};
8299
- padding-left: ${({ theme }) => theme.spaces[3]};
8300
- padding-top: ${({ theme }) => theme.spaces[2]};
8301
- padding-bottom: ${({ theme }) => theme.spaces[2]};
8302
8318
  border-radius: ${({ theme }) => theme.borderRadius};
8303
8319
  background: ${({ theme }) => theme.colors.neutral0};
8304
8320
  overflow: hidden;
@@ -8307,6 +8323,23 @@ const Trigger$5 = styledComponents.styled(uiPrimitives.Combobox.Trigger)`
8307
8323
  justify-content: space-between;
8308
8324
  gap: ${({ theme }) => theme.spaces[4]};
8309
8325
 
8326
+ ${(props) => {
8327
+ switch (props.$size) {
8328
+ case "S":
8329
+ return styledComponents.css`
8330
+ padding-inline-start: ${({ theme }) => theme.spaces[4]};
8331
+ padding-inline-end: ${({ theme }) => theme.spaces[3]};
8332
+ padding-block: ${({ theme }) => theme.spaces[1]};
8333
+ `;
8334
+ default:
8335
+ return styledComponents.css`
8336
+ padding-inline-start: ${({ theme }) => theme.spaces[4]};
8337
+ padding-inline-end: ${({ theme }) => theme.spaces[3]};
8338
+ padding-block: ${({ theme }) => theme.spaces[2]};
8339
+ `;
8340
+ }
8341
+ }}
8342
+
8310
8343
  &[data-disabled] {
8311
8344
  color: ${({ theme }) => theme.colors.neutral600};
8312
8345
  background: ${({ theme }) => theme.colors.neutral150};
@@ -8767,7 +8800,7 @@ const Portal$1 = React__namespace.forwardRef(
8767
8800
  );
8768
8801
  Portal$1.displayName = "Portal";
8769
8802
  const SelectTrigger = React__namespace.forwardRef(
8770
- ({ onClear, clearLabel = "Clear", startIcon, disabled, hasError, children, id, ...restProps }, ref) => {
8803
+ ({ onClear, clearLabel = "Clear", startIcon, disabled, hasError, children, id, size = "M", withTags, ...restProps }, ref) => {
8771
8804
  const triggerRef = React__namespace.useRef(null);
8772
8805
  const handleClearClick = (e) => {
8773
8806
  if (onClear && !disabled) {
@@ -8789,13 +8822,11 @@ const SelectTrigger = React__namespace.forwardRef(
8789
8822
  overflow: "hidden",
8790
8823
  hasRadius: true,
8791
8824
  background: disabled ? "neutral150" : "neutral0",
8792
- paddingLeft: 3,
8793
- paddingRight: 3,
8794
- paddingTop: 2,
8795
- paddingBottom: 2,
8796
8825
  gap: 4,
8797
8826
  cursor: "default",
8798
8827
  "aria-labelledby": labelNode ? `${id}-label` : void 0,
8828
+ $size: size,
8829
+ $withTags: withTags,
8799
8830
  ...restProps,
8800
8831
  children: [
8801
8832
  /* @__PURE__ */ jsxRuntime.jsxs(Flex, { flex: "1", tag: "span", gap: 3, children: [
@@ -8840,6 +8871,22 @@ const IconBox$2 = styledComponents.styled(Box)`
8840
8871
  `;
8841
8872
  const StyledTrigger = styledComponents.styled(Flex)`
8842
8873
  border: 1px solid ${({ theme, $hasError }) => $hasError ? theme.colors.danger600 : theme.colors.neutral200};
8874
+ ${(props) => {
8875
+ switch (props.$size) {
8876
+ case "S":
8877
+ return styledComponents.css`
8878
+ padding-block: ${props.theme.spaces[1]};
8879
+ padding-inline-start: ${props.$withTags ? props.theme.spaces[1] : props.theme.spaces[4]};
8880
+ padding-inline-end: ${props.theme.spaces[3]};
8881
+ `;
8882
+ default:
8883
+ return styledComponents.css`
8884
+ padding-block: ${props.$withTags ? "0.3rem" : props.theme.spaces[2]};
8885
+ padding-inline-start: ${props.$withTags ? props.theme.spaces[1] : props.theme.spaces[4]};
8886
+ padding-inline-end: ${props.theme.spaces[3]};
8887
+ `;
8888
+ }
8889
+ }}
8843
8890
 
8844
8891
  &[aria-disabled='true'] {
8845
8892
  color: ${(props) => props.theme.colors.neutral600};
@@ -8959,6 +9006,7 @@ const SingleSelect = React__namespace.forwardRef(
8959
9006
  onReachEnd,
8960
9007
  placeholder,
8961
9008
  required: requiredProp,
9009
+ size,
8962
9010
  startIcon,
8963
9011
  value: passedValue,
8964
9012
  ...restProps
@@ -9034,6 +9082,7 @@ const SingleSelect = React__namespace.forwardRef(
9034
9082
  onClear: value && onClear ? handleOnClear : void 0,
9035
9083
  "aria-label": restProps["aria-label"],
9036
9084
  "aria-describedby": ariaDescription ?? restProps["aria-describedby"],
9085
+ size,
9037
9086
  children: /* @__PURE__ */ jsxRuntime.jsx(Value, { placeholder, textColor: value ? "neutral800" : "neutral600", children: value && customizeContent ? customizeContent(value) : void 0 })
9038
9087
  }
9039
9088
  ),
@@ -9082,6 +9131,7 @@ const DatePicker$1 = React__namespace.forwardRef(
9082
9131
  required: requiredProp = false,
9083
9132
  onClear,
9084
9133
  clearLabel = "Clear",
9134
+ size = "M",
9085
9135
  ...restProps
9086
9136
  }, ref) => {
9087
9137
  const timeZone = date.getLocalTimeZone();
@@ -9192,7 +9242,7 @@ const DatePicker$1 = React__namespace.forwardRef(
9192
9242
  trigger,
9193
9243
  value,
9194
9244
  children: [
9195
- /* @__PURE__ */ jsxRuntime.jsxs(DatePickerTrigger, { className, hasError, children: [
9245
+ /* @__PURE__ */ jsxRuntime.jsxs(DatePickerTrigger, { className, hasError, size, children: [
9196
9246
  /* @__PURE__ */ jsxRuntime.jsx(icons.Calendar, { fill: "neutral500", "aria-hidden": true }),
9197
9247
  /* @__PURE__ */ jsxRuntime.jsx(DatePickerTextInput, { ref, "aria-describedby": ariaDescription, id, name, ...restProps }),
9198
9248
  textValue && onClear ? /* @__PURE__ */ jsxRuntime.jsx(
@@ -9238,7 +9288,7 @@ const makeInitialCalendarDate = ({ currentValue, minDate, maxDate }) => {
9238
9288
  };
9239
9289
  const DATE_PICKER_TRIGGER_NAME = "DatePickerTrigger";
9240
9290
  const DatePickerTrigger = React__namespace.forwardRef(
9241
- ({ hasError, ...restProps }, forwardedRef) => {
9291
+ ({ hasError, size, ...restProps }, forwardedRef) => {
9242
9292
  const context = useDatePickerContext(DATE_PICKER_TRIGGER_NAME);
9243
9293
  const composedRefs = useComposedRefs(forwardedRef, (node) => context.onTriggerChange(node));
9244
9294
  const handleOpenChange = () => {
@@ -9263,9 +9313,8 @@ const DatePickerTrigger = React__namespace.forwardRef(
9263
9313
  {
9264
9314
  ref: composedRefs,
9265
9315
  $hasError: hasError,
9316
+ $size: size,
9266
9317
  ...restProps,
9267
- paddingLeft: 3,
9268
- paddingRight: 3,
9269
9318
  hasRadius: true,
9270
9319
  gap: 3,
9271
9320
  overflow: "hidden",
@@ -9295,7 +9344,20 @@ const DatePickerTrigger = React__namespace.forwardRef(
9295
9344
  );
9296
9345
  const TriggerElement = styledComponents.styled(Flex)`
9297
9346
  border: 1px solid ${({ theme, $hasError }) => $hasError ? theme.colors.danger600 : theme.colors.neutral200};
9298
- padding-block: ${({ theme }) => theme.spaces[2]};
9347
+ ${(props) => {
9348
+ switch (props.$size) {
9349
+ case "S":
9350
+ return styledComponents.css`
9351
+ padding-block: ${props.theme.spaces[1]};
9352
+ padding-inline: ${props.theme.spaces[3]};
9353
+ `;
9354
+ default:
9355
+ return styledComponents.css`
9356
+ padding-block: ${props.theme.spaces[2]};
9357
+ padding-inline: ${props.theme.spaces[3]};
9358
+ `;
9359
+ }
9360
+ }}
9299
9361
 
9300
9362
  & > svg {
9301
9363
  flex: 1 0 auto;
@@ -9912,6 +9974,7 @@ const DateTimePicker = React__namespace.forwardRef(
9912
9974
  step,
9913
9975
  value,
9914
9976
  initialDate,
9977
+ size,
9915
9978
  ...props
9916
9979
  }, forwardedRef) => {
9917
9980
  const DatePickerElement2 = React__namespace.useRef(null);
@@ -9971,6 +10034,7 @@ const DateTimePicker = React__namespace.forwardRef(
9971
10034
  DatePicker,
9972
10035
  {
9973
10036
  ...props,
10037
+ size,
9974
10038
  value: dateValue?.toDate("UTC"),
9975
10039
  onChange: handleDateChange,
9976
10040
  required,
@@ -9984,6 +10048,7 @@ const DateTimePicker = React__namespace.forwardRef(
9984
10048
  /* @__PURE__ */ jsxRuntime.jsx(Root$6, { children: /* @__PURE__ */ jsxRuntime.jsx(
9985
10049
  TimePicker,
9986
10050
  {
10051
+ size,
9987
10052
  hasError,
9988
10053
  value: timeValue,
9989
10054
  onChange: handleTimeChange,
@@ -10460,7 +10525,7 @@ const LinkButton = forwardRef(
10460
10525
  ...props,
10461
10526
  children: [
10462
10527
  startIcon && /* @__PURE__ */ jsxRuntime.jsx(Flex, { "aria-hidden": true, children: startIcon }),
10463
- /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: size === "S" ? "pi" : void 0, fontWeight: "bold", textColor: "buttonNeutral0", children }),
10528
+ /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: size === "S" ? "pi" : void 0, fontWeight: "bold", children }),
10464
10529
  endIcon && /* @__PURE__ */ jsxRuntime.jsx(Flex, { "aria-hidden": true, children: endIcon })
10465
10530
  ]
10466
10531
  }
@@ -10547,7 +10612,7 @@ const ScrollAreaRoot = styledComponents.styled(ScrollArea__namespace.Root)`
10547
10612
  `;
10548
10613
  const ScrollAreaViewport = styledComponents.styled(ScrollArea__namespace.Viewport)`
10549
10614
  min-width: 100%;
10550
- padding-inline-end: 4px;
10615
+ padding-inline: 4px;
10551
10616
  `;
10552
10617
  const Scrollbar = styledComponents.styled(ScrollArea__namespace.Scrollbar)`
10553
10618
  display: flex;
@@ -10794,7 +10859,7 @@ const NumberInput = React__namespace.forwardRef(
10794
10859
  onKeyDown: handleKeyDown,
10795
10860
  onBlur: handleBlur,
10796
10861
  value: inputValue,
10797
- endAction: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10862
+ endAction: /* @__PURE__ */ jsxRuntime.jsxs(Flex, { direction: "column", children: [
10798
10863
  /* @__PURE__ */ jsxRuntime.jsx(
10799
10864
  ArrowButton,
10800
10865
  {
@@ -10828,13 +10893,14 @@ const NumberInput = React__namespace.forwardRef(
10828
10893
  );
10829
10894
  const ArrowButton = styledComponents.styled.button`
10830
10895
  display: flex;
10831
- height: 1rem;
10832
- align-items: ${({ $reverse }) => $reverse ? "flex-end" : "flex-start"};
10896
+ justify-content: center;
10897
+ align-items: center;
10833
10898
  transform: translateY(${({ $reverse }) => $reverse ? `-2px` : `2px`});
10834
10899
  cursor: ${({ disabled }) => disabled ? "not-allowed" : void 0};
10900
+ height: 1.1rem;
10901
+
10835
10902
  svg {
10836
- display: block;
10837
- height: 0.4rem;
10903
+ width: 1.2rem;
10838
10904
  transform: ${({ $reverse }) => $reverse ? "rotateX(180deg)" : void 0};
10839
10905
  }
10840
10906
  `;
@@ -11010,36 +11076,34 @@ const Popover = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
11010
11076
  ScrollArea: ScrollAreaImpl,
11011
11077
  Trigger: Trigger$1
11012
11078
  }, Symbol.toStringTag, { value: "Module" }));
11013
- const ProgressbarBase = styledComponents.styled(Box)`
11014
- &:before {
11015
- background-color: ${({ theme }) => theme.colors.neutral0};
11016
- border-radius: ${({ theme }) => theme.borderRadius};
11017
- bottom: 0;
11018
- content: '';
11019
- position: absolute;
11020
- top: 0;
11021
- width: ${({ $value }) => `${$value}%`};
11079
+ const ProgressBar = React__namespace.forwardRef(
11080
+ ({ size = "M", value, ...restProps }, forwardedRef) => {
11081
+ return /* @__PURE__ */ jsxRuntime.jsx(ProgressRoot, { ref: forwardedRef, $size: size, ...restProps, children: /* @__PURE__ */ jsxRuntime.jsx(ProgressIndicator, { style: { transform: `translate3D(-${100 - (value ?? 0)}%, 0, 0)` } }) });
11082
+ }
11083
+ );
11084
+ const ProgressRoot = styledComponents.styled(Progress__namespace.Root)`
11085
+ position: relative;
11086
+ overflow: hidden;
11087
+ width: ${(props) => props.$size === "S" ? "7.8rem" : "10.2rem"};
11088
+ height: ${(props) => props.$size === "S" ? "0.4rem" : "0.8rem"};
11089
+ background-color: ${(props) => props.theme.colors.neutral600};
11090
+ border-radius: ${(props) => props.theme.borderRadius};
11091
+
11092
+ /* Fix overflow clipping in Safari */
11093
+ /* https://gist.github.com/domske/b66047671c780a238b51c51ffde8d3a0 */
11094
+ transform: translateZ(0);
11095
+ `;
11096
+ const ProgressIndicator = styledComponents.styled(Progress__namespace.Indicator)`
11097
+ background-color: ${({ theme }) => theme.colors.neutral0};
11098
+ border-radius: ${({ theme }) => theme.borderRadius};
11099
+ width: 100%;
11100
+ height: 100%;
11101
+
11102
+ @media (prefers-reduced-motion: no-preference) {
11103
+ transition: transform ${(props) => props.theme.motion.timings["320"]}
11104
+ ${(props) => props.theme.motion.easings.authenticMotion};
11022
11105
  }
11023
11106
  `;
11024
- const ProgressBar = ({ min = 0, max = 100, value = 0, children, size = "M", ...props }) => {
11025
- return /* @__PURE__ */ jsxRuntime.jsx(
11026
- ProgressbarBase,
11027
- {
11028
- background: "neutral600",
11029
- hasRadius: true,
11030
- "aria-label": children,
11031
- "aria-valuemax": max,
11032
- "aria-valuemin": min,
11033
- "aria-valuenow": value,
11034
- height: size === "S" ? 1 : 2,
11035
- position: "relative",
11036
- role: "progressbar",
11037
- $value: value,
11038
- width: size === "S" ? "78px" : "102px",
11039
- ...props
11040
- }
11041
- );
11042
- };
11043
11107
  const Group = React__namespace.forwardRef((props, forwardedRef) => {
11044
11108
  return /* @__PURE__ */ jsxRuntime.jsx(RadioGroupRoot, { ref: forwardedRef, ...props });
11045
11109
  });
@@ -11445,6 +11509,7 @@ const MultiSelect = React__namespace.forwardRef(
11445
11509
  onReachEnd,
11446
11510
  placeholder,
11447
11511
  required: requiredProp,
11512
+ size,
11448
11513
  startIcon,
11449
11514
  value: passedValue,
11450
11515
  withTags,
@@ -11528,7 +11593,8 @@ const MultiSelect = React__namespace.forwardRef(
11528
11593
  disabled,
11529
11594
  clearLabel,
11530
11595
  onClear: value?.length ? onClear : void 0,
11531
- paddingLeft: withTags && value?.length ? 1 : 3,
11596
+ withTags: Boolean(withTags && (value?.length ?? 0 > 0)),
11597
+ size,
11532
11598
  children: /* @__PURE__ */ jsxRuntime.jsx(Value, { placeholder, textColor: value?.length ? "neutral800" : "neutral600", children: value?.length ? withTags ? renderTags : customizeContent ? customizeContent(value) : void 0 : void 0 })
11533
11599
  }
11534
11600
  ),
@@ -11720,6 +11786,12 @@ const SubNavLink = forwardRef(
11720
11786
  );
11721
11787
  }
11722
11788
  );
11789
+ const CustomBullet = styledComponents.styled.span`
11790
+ width: 0.4rem;
11791
+ height: 0.4rem;
11792
+ background-color: ${({ theme, $active }) => $active ? theme.colors.primary600 : theme.colors.neutral600};
11793
+ border-radius: 50%;
11794
+ `;
11723
11795
  const SubNavLinkWrapper = styledComponents.styled(BaseLink)`
11724
11796
  display: flex;
11725
11797
  align-items: center;
@@ -11739,18 +11811,16 @@ const SubNavLinkWrapper = styledComponents.styled(BaseLink)`
11739
11811
  font-weight: 500;
11740
11812
  `;
11741
11813
  }}
11814
+
11815
+ ${CustomBullet} {
11816
+ background-color: ${({ theme }) => theme.colors.primary600};
11817
+ }
11742
11818
  }
11743
11819
 
11744
11820
  &:focus-visible {
11745
11821
  outline-offset: -2px;
11746
11822
  }
11747
11823
  `;
11748
- const CustomBullet = styledComponents.styled.span`
11749
- width: 0.4rem;
11750
- height: 0.4rem;
11751
- background-color: ${({ theme, $active }) => $active ? theme.colors.primary600 : theme.colors.neutral600};
11752
- border-radius: 50%;
11753
- `;
11754
11824
  const IconWrapper = styledComponents.styled.div`
11755
11825
  svg {
11756
11826
  height: 1.6rem;
@@ -11881,70 +11951,84 @@ const SubNavSections = ({ children, spacing = 2, horizontal = false, ...props })
11881
11951
  }
11882
11952
  ) });
11883
11953
  };
11884
- const Switch = React__namespace.forwardRef(
11885
- ({ label, onChange, onLabel = "On", offLabel = "Off", selected, visibleLabels = false, ...props }, ref) => {
11886
- return /* @__PURE__ */ jsxRuntime.jsx(
11887
- SwitchButton,
11888
- {
11889
- ref,
11890
- role: "switch",
11891
- "aria-checked": selected,
11892
- "aria-label": label,
11893
- onClick: onChange,
11894
- type: "button",
11895
- ...props,
11896
- children: /* @__PURE__ */ jsxRuntime.jsxs(Flex, { children: [
11897
- /* @__PURE__ */ jsxRuntime.jsxs(SwitchContent, { $visibleLabels: visibleLabels, children: [
11898
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: onLabel }),
11899
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: offLabel })
11900
- ] }),
11901
- visibleLabels && /* @__PURE__ */ jsxRuntime.jsx(Box, { tag: "span", "aria-hidden": true, paddingLeft: 2, color: selected ? "success600" : "danger600", children: selected ? onLabel : offLabel })
11902
- ] })
11903
- }
11904
- );
11954
+ const SwitchImpl = React__namespace.forwardRef(
11955
+ ({
11956
+ visibleLabels,
11957
+ onLabel = "On",
11958
+ offLabel = "Off",
11959
+ onCheckedChange: onCheckedChangeProp,
11960
+ checked: checkedProp,
11961
+ defaultChecked,
11962
+ disabled,
11963
+ ...restProps
11964
+ }, forwardedRef) => {
11965
+ const [internalChecked, setInternalChecked] = useControllableState$1({
11966
+ prop: checkedProp,
11967
+ defaultProp: defaultChecked
11968
+ });
11969
+ const handleCheckChange = (checked) => {
11970
+ setInternalChecked(checked);
11971
+ };
11972
+ return /* @__PURE__ */ jsxRuntime.jsxs(Flex, { gap: 3, children: [
11973
+ /* @__PURE__ */ jsxRuntime.jsx(
11974
+ SwitchRoot,
11975
+ {
11976
+ ref: forwardedRef,
11977
+ onCheckedChange: uiPrimitives.composeEventHandlers(onCheckedChangeProp, handleCheckChange),
11978
+ checked: internalChecked,
11979
+ disabled,
11980
+ ...restProps,
11981
+ children: /* @__PURE__ */ jsxRuntime.jsx(SwitchThumb, {})
11982
+ }
11983
+ ),
11984
+ visibleLabels ? /* @__PURE__ */ jsxRuntime.jsx(LabelTypography, { "aria-hidden": true, "data-disabled": disabled, "data-state": internalChecked ? "checked" : "unchecked", children: internalChecked ? onLabel : offLabel }) : null
11985
+ ] });
11905
11986
  }
11906
11987
  );
11907
- const SwitchContent = styledComponents.styled.div`
11908
- background: ${({ theme }) => theme.colors.danger500};
11909
- border: none;
11910
- border-radius: 16px;
11911
- position: relative;
11912
- height: 2.4rem;
11988
+ const SwitchRoot = styledComponents.styled(Switch__namespace.Root)`
11913
11989
  width: 4rem;
11990
+ height: 2.4rem;
11991
+ border-radius: 1.2rem;
11992
+ background-color: ${({ theme }) => theme.colors.danger500};
11914
11993
 
11915
- & > span {
11916
- font-size: ${({ $visibleLabels }) => $visibleLabels ? "1rem" : 0};
11994
+ &[data-state='checked'] {
11995
+ background-color: ${({ theme }) => theme.colors.success500};
11917
11996
  }
11918
11997
 
11919
- &:before {
11920
- content: '';
11921
- background: ${({ theme }) => theme.colors.neutral0};
11922
- width: 1rem;
11923
- height: 1rem;
11924
- border-radius: 50%;
11925
- position: absolute;
11926
- transition: all 0.5s;
11927
- left: ${({ theme }) => theme.spaces[1]};
11928
- top: ${({ theme }) => theme.spaces[1]};
11998
+ &[data-disabled] {
11999
+ background-color: ${({ theme }) => theme.colors.neutral300};
11929
12000
  }
11930
12001
 
11931
- @media (prefers-reduced-motion: reduce) {
11932
- &:before {
11933
- transition: none;
11934
- }
12002
+ @media (prefers-reduced-motion: no-preference) {
12003
+ transition: ${(props) => props.theme.transitions.backgroundColor};
11935
12004
  }
11936
12005
  `;
11937
- const SwitchButton = styledComponents.styled.button`
11938
- background: transparent;
11939
- padding: 0;
11940
- border: none;
12006
+ const SwitchThumb = styledComponents.styled(Switch__namespace.Thumb)`
12007
+ display: block;
12008
+ height: 1.6rem;
12009
+ width: 1.6rem;
12010
+ border-radius: 50%;
12011
+ background-color: ${({ theme }) => theme.colors.neutral0};
12012
+ transform: translateX(4px);
11941
12013
 
11942
- &[aria-checked='true'] ${SwitchContent} {
11943
- background: ${({ theme }) => theme.colors.success500};
12014
+ &[data-state='checked'] {
12015
+ transform: translateX(20px);
11944
12016
  }
11945
12017
 
11946
- &[aria-checked='true'] ${SwitchContent}:before {
11947
- transform: translateX(1rem);
12018
+ @media (prefers-reduced-motion: no-preference) {
12019
+ transition: transform ${(props) => props.theme.motion.timings["120"]}
12020
+ ${(props) => props.theme.motion.easings.authenticMotion};
12021
+ }
12022
+ `;
12023
+ const LabelTypography = styledComponents.styled(Typography)`
12024
+ color: ${(props) => props.theme.colors.danger600};
12025
+
12026
+ &[data-state='checked'] {
12027
+ color: ${(props) => props.theme.colors.success600};
12028
+ }
12029
+
12030
+ &[data-disabled='true'] {
12031
+ color: ${({ theme }) => theme.colors.neutral500};
11948
12032
  }
11949
12033
  `;
11950
12034
  const [TabsProvider, useTabs] = createContext("Tabs");
@@ -12673,7 +12757,7 @@ exports.SubNavLink = SubNavLink;
12673
12757
  exports.SubNavLinkSection = SubNavLinkSection;
12674
12758
  exports.SubNavSection = SubNavSection;
12675
12759
  exports.SubNavSections = SubNavSections;
12676
- exports.Switch = Switch;
12760
+ exports.Switch = SwitchImpl;
12677
12761
  exports.TFooter = TFooter;
12678
12762
  exports.Table = Table;
12679
12763
  exports.Tabs = Tabs;