@strapi/design-system 2.0.0-rc.16 → 2.0.0-rc.18

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
@@ -20,12 +20,12 @@ import { useFocusGuards } from "@radix-ui/react-focus-guards";
20
20
  import { FocusScope } from "@radix-ui/react-focus-scope";
21
21
  import { createPortal } from "react-dom";
22
22
  import { RemoveScroll } from "react-remove-scroll";
23
+ import * as ScrollArea from "@radix-ui/react-scroll-area";
23
24
  import { json, jsonParseLinter } from "@codemirror/lang-json";
24
25
  import { useCodeMirror } from "@uiw/react-codemirror";
25
26
  import { StateEffect, StateField } from "@codemirror/state";
26
27
  import { Decoration, EditorView } from "@codemirror/view";
27
28
  import * as Dialog$1 from "@radix-ui/react-dialog";
28
- import * as ScrollArea from "@radix-ui/react-scroll-area";
29
29
  import { NumberParser, NumberFormatter } from "@internationalized/number";
30
30
  import * as Popover$1 from "@radix-ui/react-popover";
31
31
  import * as Progress from "@radix-ui/react-progress";
@@ -1856,8 +1856,33 @@ const DropdownMenuContent = styled(DropdownMenu.Content)`
1856
1856
  }
1857
1857
  }
1858
1858
  `;
1859
- const MenuItem$1 = ({ onSelect, disabled = false, isLink, ...props }) => {
1860
- return /* @__PURE__ */ jsx(DropdownMenu.Item, { asChild: true, onSelect, disabled, children: isLink || props.isExternal ? /* @__PURE__ */ jsx(OptionLink, { color: "neutral800", ...props, isExternal: props.isExternal ?? false, children: /* @__PURE__ */ jsx(Typography, { children: props.children }) }) : /* @__PURE__ */ jsx(OptionButton, { cursor: "pointer", color: "neutral800", background: "transparent", borderStyle: "none", ...props, children: /* @__PURE__ */ jsx(Typography, { children: props.children }) }) });
1859
+ const MenuItem$1 = ({ onSelect, disabled = false, isLink, startIcon, endIcon, isExternal, ...props }) => {
1860
+ return /* @__PURE__ */ jsx(DropdownMenu.Item, { asChild: true, onSelect, disabled, children: isLink || isExternal ? /* @__PURE__ */ jsx(
1861
+ OptionLink,
1862
+ {
1863
+ color: "neutral800",
1864
+ startIcon,
1865
+ endIcon,
1866
+ ...props,
1867
+ isExternal: isExternal ?? false,
1868
+ children: /* @__PURE__ */ jsx(Typography, { children: props.children })
1869
+ }
1870
+ ) : /* @__PURE__ */ jsxs(
1871
+ OptionButton,
1872
+ {
1873
+ cursor: "pointer",
1874
+ color: "neutral800",
1875
+ background: "transparent",
1876
+ borderStyle: "none",
1877
+ gap: 2,
1878
+ ...props,
1879
+ children: [
1880
+ startIcon && /* @__PURE__ */ jsx(Flex, { tag: "span", "aria-hidden": true, children: startIcon }),
1881
+ /* @__PURE__ */ jsx(Typography, { grow: 1, children: props.children }),
1882
+ endIcon && /* @__PURE__ */ jsx(Flex, { tag: "span", "aria-hidden": true, children: endIcon })
1883
+ ]
1884
+ }
1885
+ ) });
1861
1886
  };
1862
1887
  const getOptionStyle = ({ theme }) => css`
1863
1888
  text-align: left;
@@ -3524,6 +3549,60 @@ const Portal$1 = React.forwardRef(
3524
3549
  }
3525
3550
  );
3526
3551
  Portal$1.displayName = "Portal";
3552
+ const ScrollAreaImpl$1 = React.forwardRef(
3553
+ ({ children, viewportRef, ...restProps }, forwardedRef) => {
3554
+ return /* @__PURE__ */ jsxs(ScrollAreaRoot, { ref: forwardedRef, ...restProps, children: [
3555
+ /* @__PURE__ */ jsx(ScrollAreaViewport, { ref: viewportRef, children }),
3556
+ /* @__PURE__ */ jsx(Scrollbar, { orientation: "vertical", children: /* @__PURE__ */ jsx(Thumb, {}) }),
3557
+ /* @__PURE__ */ jsx(Scrollbar, { orientation: "horizontal", children: /* @__PURE__ */ jsx(Thumb, {}) })
3558
+ ] });
3559
+ }
3560
+ );
3561
+ const ScrollAreaRoot = styled(ScrollArea.Root)`
3562
+ width: 100%;
3563
+ height: 100%;
3564
+ overflow: hidden;
3565
+ display: flex;
3566
+ `;
3567
+ const ScrollAreaViewport = styled(ScrollArea.Viewport)`
3568
+ min-width: 100%;
3569
+ padding-inline: 4px;
3570
+ `;
3571
+ const Scrollbar = styled(ScrollArea.Scrollbar)`
3572
+ display: flex;
3573
+ /* ensures no selection */
3574
+ user-select: none;
3575
+ /* disable browser handling of all panning and zooming gestures on touch devices */
3576
+ touch-action: none;
3577
+
3578
+ &[data-orientation='vertical'] {
3579
+ width: 0.4rem;
3580
+ }
3581
+
3582
+ &[data-orientation='horizontal'] {
3583
+ flex-direction: column;
3584
+ height: 0.4rem;
3585
+ }
3586
+ `;
3587
+ const Thumb = styled(ScrollArea.Thumb)`
3588
+ position: relative;
3589
+ flex: 1;
3590
+ background-color: ${(props) => props.theme.colors.neutral150};
3591
+ border-radius: var(--scrollbar-size);
3592
+
3593
+ /* increase target size for touch devices https://www.w3.org/WAI/WCAG21/Understanding/target-size.html */
3594
+ &::before {
3595
+ content: '';
3596
+ position: absolute;
3597
+ top: 50%;
3598
+ left: 50%;
3599
+ transform: translate(-50%, -50%);
3600
+ width: 100%;
3601
+ height: 100%;
3602
+ min-width: 44px;
3603
+ min-height: 44px;
3604
+ }
3605
+ `;
3527
3606
  const SelectTrigger = React.forwardRef(
3528
3607
  ({ onClear, clearLabel = "Clear", startIcon, disabled, hasError, children, id, size = "M", withTags, ...restProps }, ref) => {
3529
3608
  const triggerRef = React.useRef(null);
@@ -3643,7 +3722,10 @@ const StyledValue = styled(Select.Value)`
3643
3722
  gap: ${({ theme }) => theme.spaces[1]};
3644
3723
  flex-wrap: wrap;
3645
3724
  `;
3646
- const SelectContent = styled(Select.Content)`
3725
+ const SelectContent = React.forwardRef((props, ref) => {
3726
+ return /* @__PURE__ */ jsx(StyledContent, { ref, ...props, children: /* @__PURE__ */ jsx(ScrollAreaImpl$1, { children: props.children }) });
3727
+ });
3728
+ const StyledContent = styled(Select.Content)`
3647
3729
  background: ${({ theme }) => theme.colors.neutral0};
3648
3730
  box-shadow: ${({ theme }) => theme.shadows.filterShadow};
3649
3731
  border: 1px solid ${({ theme }) => theme.colors.neutral150};
@@ -5087,60 +5169,6 @@ const SkipToContent = ({ children }) => {
5087
5169
  );
5088
5170
  };
5089
5171
  const setOpacity = (hex, alpha) => `${hex}${Math.floor(alpha * 255).toString(16).padStart(2, "0")}`;
5090
- const ScrollAreaImpl$1 = React.forwardRef(
5091
- ({ children, viewportRef, ...restProps }, forwardedRef) => {
5092
- return /* @__PURE__ */ jsxs(ScrollAreaRoot, { ref: forwardedRef, ...restProps, children: [
5093
- /* @__PURE__ */ jsx(ScrollAreaViewport, { ref: viewportRef, children }),
5094
- /* @__PURE__ */ jsx(Scrollbar, { orientation: "vertical", children: /* @__PURE__ */ jsx(Thumb, {}) }),
5095
- /* @__PURE__ */ jsx(Scrollbar, { orientation: "horizontal", children: /* @__PURE__ */ jsx(Thumb, {}) })
5096
- ] });
5097
- }
5098
- );
5099
- const ScrollAreaRoot = styled(ScrollArea.Root)`
5100
- width: 100%;
5101
- height: 100%;
5102
- overflow: hidden;
5103
- display: flex;
5104
- `;
5105
- const ScrollAreaViewport = styled(ScrollArea.Viewport)`
5106
- min-width: 100%;
5107
- padding-inline: 4px;
5108
- `;
5109
- const Scrollbar = styled(ScrollArea.Scrollbar)`
5110
- display: flex;
5111
- /* ensures no selection */
5112
- user-select: none;
5113
- /* disable browser handling of all panning and zooming gestures on touch devices */
5114
- touch-action: none;
5115
-
5116
- &[data-orientation='vertical'] {
5117
- width: 0.4rem;
5118
- }
5119
-
5120
- &[data-orientation='horizontal'] {
5121
- flex-direction: column;
5122
- height: 0.4rem;
5123
- }
5124
- `;
5125
- const Thumb = styled(ScrollArea.Thumb)`
5126
- position: relative;
5127
- flex: 1;
5128
- background-color: ${(props) => props.theme.colors.neutral150};
5129
- border-radius: var(--scrollbar-size);
5130
-
5131
- /* increase target size for touch devices https://www.w3.org/WAI/WCAG21/Understanding/target-size.html */
5132
- &::before {
5133
- content: '';
5134
- position: absolute;
5135
- top: 50%;
5136
- left: 50%;
5137
- transform: translate(-50%, -50%);
5138
- width: 100%;
5139
- height: 100%;
5140
- min-width: 44px;
5141
- min-height: 44px;
5142
- }
5143
- `;
5144
5172
  const Root$3 = Dialog$1.Root;
5145
5173
  const Trigger$2 = React.forwardRef((props, forwardedRef) => {
5146
5174
  return /* @__PURE__ */ jsx(Dialog$1.Trigger, { ...props, asChild: true, ref: forwardedRef });