@strapi/design-system 1.7.0-alpha.4 → 1.7.0

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/README.md CHANGED
@@ -18,7 +18,7 @@ plugins more efficiently.
18
18
 
19
19
  ## Installation
20
20
 
21
- Install Strapi Design System and itdesign-system dependencies:
21
+ Install Strapi Design System and its peer dependencies:
22
22
 
23
23
  ```sh
24
24
  $ yarn add react react-dom @strapi/design-system @strapi/icons styled-components react-router-dom
@@ -80,6 +80,7 @@
80
80
  padding: ${({theme:e})=>e.spaces[2]} ${({theme:e})=>e.spaces[4]};
81
81
  background-color: ${({theme:e})=>e.colors.neutral0};
82
82
  border-radius: ${({theme:e})=>e.borderRadius};
83
+ user-select: none;
83
84
 
84
85
  &[data-selected] {
85
86
  background-color: ${({theme:e})=>e.colors.primary100};
@@ -320,6 +320,7 @@ const he = ({
320
320
  border-radius: ${({
321
321
  theme: e
322
322
  }) => e.borderRadius};
323
+ user-select: none;
323
324
 
324
325
  &[data-selected] {
325
326
  background-color: ${({
@@ -1,3 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react"),E=require("prop-types"),v=require("styled-components"),d=require("../Box/Box.cjs"),i=require("../Flex/Flex.cjs"),B=require("../hooks/useElementOnScreen.cjs"),b=require("../hooks/useResizeObserver.cjs"),s=require("../Typography/Typography.cjs"),p=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},e=p(c),a=p(E),R=p(v),T=()=>{const t=c.useRef(null),[l,r]=c.useState(null),[n,o]=B.useElementOnScreen({root:null,rootMargin:"0px",threshold:0});return b.useResizeObserver(n,()=>{n.current&&r(n.current.getBoundingClientRect())}),c.useEffect(()=>{t.current&&r(t.current.getBoundingClientRect())},[t]),{containerRef:n,isVisible:o,baseHeaderLayoutRef:t,headerSize:l}},f=t=>{const{containerRef:l,isVisible:r,baseHeaderLayoutRef:n,headerSize:o}=T();return e.default.createElement(e.default.Fragment,null,e.default.createElement("div",{style:{height:o?.height},ref:l},r&&e.default.createElement(u,{ref:n,...t})),!r&&e.default.createElement(u,{...t,sticky:!0,width:o?.width}))};f.displayName="HeaderLayout";const L=R.default(d.Box)`
2
- width: ${t=>t.width}px;
3
- `,u=e.default.forwardRef(({navigationAction:t,primaryAction:l,secondaryAction:r,subtitle:n,title:o,sticky:m,width:h,...y},x)=>{const g=typeof n=="string";return m?e.default.createElement(L,{paddingLeft:6,paddingRight:6,paddingTop:3,paddingBottom:3,position:"fixed",top:0,right:0,background:"neutral0",shadow:"tableShadow",width:h,zIndex:4,"data-strapi-header-sticky":!0},e.default.createElement(i.Flex,{justifyContent:"space-between"},e.default.createElement(i.Flex,null,t&&e.default.createElement(d.Box,{paddingRight:3},t),e.default.createElement(d.Box,null,e.default.createElement(s.Typography,{variant:"beta",as:"h1",...y},o),g?e.default.createElement(s.Typography,{variant:"pi",textColor:"neutral600"},n):n),r?e.default.createElement(d.Box,{paddingLeft:4},r):null),e.default.createElement(i.Flex,null,l?e.default.createElement(d.Box,{paddingLeft:2},l):void 0))):e.default.createElement(d.Box,{ref:x,paddingLeft:10,paddingRight:10,paddingBottom:8,paddingTop:t?6:8,background:"neutral100","data-strapi-header":!0},t?e.default.createElement(d.Box,{paddingBottom:2},t):null,e.default.createElement(i.Flex,{justifyContent:"space-between"},e.default.createElement(i.Flex,{minWidth:0},e.default.createElement(s.Typography,{as:"h1",variant:"alpha",...y},o),r?e.default.createElement(d.Box,{paddingLeft:4},r):null),l),g?e.default.createElement(s.Typography,{variant:"epsilon",textColor:"neutral600",as:"p"},n):n)});u.displayName="BaseHeaderLayout";u.defaultProps={navigationAction:void 0,primaryAction:void 0,secondaryAction:void 0,subtitle:void 0,sticky:!1,width:void 0};u.propTypes={navigationAction:a.default.node,primaryAction:a.default.node,secondaryAction:a.default.node,sticky:a.default.bool,subtitle:a.default.oneOfType([a.default.string,a.default.node]),title:a.default.string.isRequired,width:a.default.number};f.defaultProps={navigationAction:void 0,primaryAction:void 0,secondaryAction:void 0,subtitle:void 0};f.propTypes={navigationAction:a.default.node,primaryAction:a.default.node,secondaryAction:a.default.node,subtitle:a.default.oneOfType([a.default.string,a.default.node]),title:a.default.string.isRequired};exports.BaseHeaderLayout=u;exports.HeaderLayout=f;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react"),E=require("prop-types"),v=require("styled-components"),d=require("../Box/Box.cjs"),u=require("../Flex/Flex.cjs"),B=require("../hooks/useElementOnScreen.cjs"),b=require("../hooks/useResizeObserver.cjs"),s=require("../Typography/Typography.cjs"),p=e=>e&&typeof e=="object"&&"default"in e?e:{default:e},t=p(c),a=p(E),R=p(v),T=()=>{const e=c.useRef(null),[l,r]=c.useState(null),[n,o]=B.useElementOnScreen({root:null,rootMargin:"0px",threshold:0});return b.useResizeObserver(n,()=>{n.current&&r(n.current.getBoundingClientRect())}),c.useEffect(()=>{e.current&&r(e.current.getBoundingClientRect())},[e]),{containerRef:n,isVisible:o,baseHeaderLayoutRef:e,headerSize:l}},f=e=>{const{containerRef:l,isVisible:r,baseHeaderLayoutRef:n,headerSize:o}=T();return t.default.createElement(t.default.Fragment,null,t.default.createElement("div",{style:{height:o?.height},ref:l},r&&t.default.createElement(i,{ref:n,...e})),!r&&t.default.createElement(i,{...e,sticky:!0,width:o?.width}))};f.displayName="HeaderLayout";const L=R.default(d.Box)`
2
+ width: ${e=>e.width}px;
3
+ z-index: ${({theme:e})=>e.zIndices[1]};
4
+ `,i=t.default.forwardRef(({navigationAction:e,primaryAction:l,secondaryAction:r,subtitle:n,title:o,sticky:m,width:h,...y},x)=>{const g=typeof n=="string";return m?t.default.createElement(L,{paddingLeft:6,paddingRight:6,paddingTop:3,paddingBottom:3,position:"fixed",top:0,right:0,background:"neutral0",shadow:"tableShadow",width:h,"data-strapi-header-sticky":!0},t.default.createElement(u.Flex,{justifyContent:"space-between"},t.default.createElement(u.Flex,null,e&&t.default.createElement(d.Box,{paddingRight:3},e),t.default.createElement(d.Box,null,t.default.createElement(s.Typography,{variant:"beta",as:"h1",...y},o),g?t.default.createElement(s.Typography,{variant:"pi",textColor:"neutral600"},n):n),r?t.default.createElement(d.Box,{paddingLeft:4},r):null),t.default.createElement(u.Flex,null,l?t.default.createElement(d.Box,{paddingLeft:2},l):void 0))):t.default.createElement(d.Box,{ref:x,paddingLeft:10,paddingRight:10,paddingBottom:8,paddingTop:e?6:8,background:"neutral100","data-strapi-header":!0},e?t.default.createElement(d.Box,{paddingBottom:2},e):null,t.default.createElement(u.Flex,{justifyContent:"space-between"},t.default.createElement(u.Flex,{minWidth:0},t.default.createElement(s.Typography,{as:"h1",variant:"alpha",...y},o),r?t.default.createElement(d.Box,{paddingLeft:4},r):null),l),g?t.default.createElement(s.Typography,{variant:"epsilon",textColor:"neutral600",as:"p"},n):n)});i.displayName="BaseHeaderLayout";i.defaultProps={navigationAction:void 0,primaryAction:void 0,secondaryAction:void 0,subtitle:void 0,sticky:!1,width:void 0};i.propTypes={navigationAction:a.default.node,primaryAction:a.default.node,secondaryAction:a.default.node,sticky:a.default.bool,subtitle:a.default.oneOfType([a.default.string,a.default.node]),title:a.default.string.isRequired,width:a.default.number};f.defaultProps={navigationAction:void 0,primaryAction:void 0,secondaryAction:void 0,subtitle:void 0};f.propTypes={navigationAction:a.default.node,primaryAction:a.default.node,secondaryAction:a.default.node,subtitle:a.default.oneOfType([a.default.string,a.default.node]),title:a.default.string.isRequired};exports.BaseHeaderLayout=i;exports.HeaderLayout=f;
@@ -1,36 +1,37 @@
1
1
  import e, { useRef as h, useState as E, useEffect as v } from "react";
2
- import t from "prop-types";
2
+ import n from "prop-types";
3
3
  import R from "styled-components";
4
- import { Box as i } from "../Box/Box.js";
4
+ import { Box as a } from "../Box/Box.js";
5
5
  import { Flex as l } from "../Flex/Flex.js";
6
6
  import { useElementOnScreen as b } from "../hooks/useElementOnScreen.js";
7
7
  import { useResizeObserver as w } from "../hooks/useResizeObserver.js";
8
8
  import { Typography as c } from "../Typography/Typography.js";
9
9
  const L = () => {
10
- const n = h(null), [o, a] = E(null), [r, d] = b({
10
+ const t = h(null), [o, i] = E(null), [r, d] = b({
11
11
  root: null,
12
12
  rootMargin: "0px",
13
13
  threshold: 0
14
14
  });
15
15
  return w(r, () => {
16
- r.current && a(r.current.getBoundingClientRect());
16
+ r.current && i(r.current.getBoundingClientRect());
17
17
  }), v(() => {
18
- n.current && a(n.current.getBoundingClientRect());
19
- }, [n]), {
18
+ t.current && i(t.current.getBoundingClientRect());
19
+ }, [t]), {
20
20
  containerRef: r,
21
21
  isVisible: d,
22
- baseHeaderLayoutRef: n,
22
+ baseHeaderLayoutRef: t,
23
23
  headerSize: o
24
24
  };
25
- }, p = (n) => {
26
- const { containerRef: o, isVisible: a, baseHeaderLayoutRef: r, headerSize: d } = L();
27
- return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { style: { height: d?.height }, ref: o }, a && /* @__PURE__ */ e.createElement(s, { ref: r, ...n })), !a && /* @__PURE__ */ e.createElement(s, { ...n, sticky: !0, width: d?.width }));
25
+ }, p = (t) => {
26
+ const { containerRef: o, isVisible: i, baseHeaderLayoutRef: r, headerSize: d } = L();
27
+ return /* @__PURE__ */ e.createElement(e.Fragment, null, /* @__PURE__ */ e.createElement("div", { style: { height: d?.height }, ref: o }, i && /* @__PURE__ */ e.createElement(s, { ref: r, ...t })), !i && /* @__PURE__ */ e.createElement(s, { ...t, sticky: !0, width: d?.width }));
28
28
  };
29
29
  p.displayName = "HeaderLayout";
30
- const x = R(i)`
31
- width: ${(n) => n.width}px;
30
+ const x = R(a)`
31
+ width: ${(t) => t.width}px;
32
+ z-index: ${({ theme: t }) => t.zIndices[1]};
32
33
  `, s = e.forwardRef(
33
- ({ navigationAction: n, primaryAction: o, secondaryAction: a, subtitle: r, title: d, sticky: f, width: g, ...u }, y) => {
34
+ ({ navigationAction: t, primaryAction: o, secondaryAction: i, subtitle: r, title: d, sticky: f, width: g, ...u }, y) => {
34
35
  const m = typeof r == "string";
35
36
  return f ? /* @__PURE__ */ e.createElement(
36
37
  x,
@@ -45,23 +46,22 @@ const x = R(i)`
45
46
  background: "neutral0",
46
47
  shadow: "tableShadow",
47
48
  width: g,
48
- zIndex: 4,
49
49
  "data-strapi-header-sticky": !0
50
50
  },
51
- /* @__PURE__ */ e.createElement(l, { justifyContent: "space-between" }, /* @__PURE__ */ e.createElement(l, null, n && /* @__PURE__ */ e.createElement(i, { paddingRight: 3 }, n), /* @__PURE__ */ e.createElement(i, null, /* @__PURE__ */ e.createElement(c, { variant: "beta", as: "h1", ...u }, d), m ? /* @__PURE__ */ e.createElement(c, { variant: "pi", textColor: "neutral600" }, r) : r), a ? /* @__PURE__ */ e.createElement(i, { paddingLeft: 4 }, a) : null), /* @__PURE__ */ e.createElement(l, null, o ? /* @__PURE__ */ e.createElement(i, { paddingLeft: 2 }, o) : void 0))
51
+ /* @__PURE__ */ e.createElement(l, { justifyContent: "space-between" }, /* @__PURE__ */ e.createElement(l, null, t && /* @__PURE__ */ e.createElement(a, { paddingRight: 3 }, t), /* @__PURE__ */ e.createElement(a, null, /* @__PURE__ */ e.createElement(c, { variant: "beta", as: "h1", ...u }, d), m ? /* @__PURE__ */ e.createElement(c, { variant: "pi", textColor: "neutral600" }, r) : r), i ? /* @__PURE__ */ e.createElement(a, { paddingLeft: 4 }, i) : null), /* @__PURE__ */ e.createElement(l, null, o ? /* @__PURE__ */ e.createElement(a, { paddingLeft: 2 }, o) : void 0))
52
52
  ) : /* @__PURE__ */ e.createElement(
53
- i,
53
+ a,
54
54
  {
55
55
  ref: y,
56
56
  paddingLeft: 10,
57
57
  paddingRight: 10,
58
58
  paddingBottom: 8,
59
- paddingTop: n ? 6 : 8,
59
+ paddingTop: t ? 6 : 8,
60
60
  background: "neutral100",
61
61
  "data-strapi-header": !0
62
62
  },
63
- n ? /* @__PURE__ */ e.createElement(i, { paddingBottom: 2 }, n) : null,
64
- /* @__PURE__ */ e.createElement(l, { justifyContent: "space-between" }, /* @__PURE__ */ e.createElement(l, { minWidth: 0 }, /* @__PURE__ */ e.createElement(c, { as: "h1", variant: "alpha", ...u }, d), a ? /* @__PURE__ */ e.createElement(i, { paddingLeft: 4 }, a) : null), o),
63
+ t ? /* @__PURE__ */ e.createElement(a, { paddingBottom: 2 }, t) : null,
64
+ /* @__PURE__ */ e.createElement(l, { justifyContent: "space-between" }, /* @__PURE__ */ e.createElement(l, { minWidth: 0 }, /* @__PURE__ */ e.createElement(c, { as: "h1", variant: "alpha", ...u }, d), i ? /* @__PURE__ */ e.createElement(a, { paddingLeft: 4 }, i) : null), o),
65
65
  m ? /* @__PURE__ */ e.createElement(c, { variant: "epsilon", textColor: "neutral600", as: "p" }, r) : r
66
66
  );
67
67
  }
@@ -76,13 +76,13 @@ s.defaultProps = {
76
76
  width: void 0
77
77
  };
78
78
  s.propTypes = {
79
- navigationAction: t.node,
80
- primaryAction: t.node,
81
- secondaryAction: t.node,
82
- sticky: t.bool,
83
- subtitle: t.oneOfType([t.string, t.node]),
84
- title: t.string.isRequired,
85
- width: t.number
79
+ navigationAction: n.node,
80
+ primaryAction: n.node,
81
+ secondaryAction: n.node,
82
+ sticky: n.bool,
83
+ subtitle: n.oneOfType([n.string, n.node]),
84
+ title: n.string.isRequired,
85
+ width: n.number
86
86
  };
87
87
  p.defaultProps = {
88
88
  navigationAction: void 0,
@@ -91,11 +91,11 @@ p.defaultProps = {
91
91
  subtitle: void 0
92
92
  };
93
93
  p.propTypes = {
94
- navigationAction: t.node,
95
- primaryAction: t.node,
96
- secondaryAction: t.node,
97
- subtitle: t.oneOfType([t.string, t.node]),
98
- title: t.string.isRequired
94
+ navigationAction: n.node,
95
+ primaryAction: n.node,
96
+ secondaryAction: n.node,
97
+ subtitle: n.oneOfType([n.string, n.node]),
98
+ title: n.string.isRequired
99
99
  };
100
100
  export {
101
101
  s as BaseHeaderLayout,
@@ -1,9 +1,9 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),w=require("react"),a=require("@floating-ui/react-dom"),y=require("styled-components"),u=require("../Box/Box.cjs"),k=require("../hooks/useIntersection.cjs"),_=require("../Portal/Portal.cjs"),v=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function S(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const l=S(w),f=v(y),O=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"],$=f.default(u.Box)`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("react/jsx-runtime"),w=require("react"),a=require("@floating-ui/react-dom"),y=require("styled-components"),u=require("../Box/Box.cjs"),k=require("../hooks/useIntersection.cjs"),_=require("../Portal/Portal.cjs"),v=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function S(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const i=S(w),f=v(y),O=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"],$=f.default(u.Box)`
2
2
  box-shadow: ${({theme:e})=>e.shadows.filterShadow};
3
- z-index: 4;
3
+ z-index: ${({theme:e})=>e.zIndices[0]};
4
4
  border: 1px solid ${({theme:e})=>e.colors.neutral150};
5
5
  background: ${({theme:e})=>e.colors.neutral0};
6
- `,p=({source:e,children:t,spacing:o=0,fullWidth:r=!1,placement:s="bottom-start",centered:i=!1,...c})=>{const[h,g]=l.useState(void 0),{x:m,y:x,reference:d,floating:j,strategy:P}=a.useFloating({strategy:"fixed",placement:i?"bottom":s,middleware:[a.offset({mainAxis:o}),a.shift(),a.flip()],whileElementsMounted:a.autoUpdate});return l.useLayoutEffect(()=>{d(e.current)},[e,d]),l.useLayoutEffect(()=>{r&&g(e.current.offsetWidth)},[r,e]),n.jsx($,{ref:j,style:{left:m,top:x,position:P,width:h||void 0},hasRadius:!0,background:"neutral0",padding:1,...c,children:t})},b=({children:e,intersectionId:t,onReachEnd:o,...r})=>{const s=l.useRef(null);return k.useIntersection(s,o??(()=>{}),{selectorToWatch:`#${t}`,skipWhen:!t||!o}),n.jsxs(q,{ref:s,...r,children:[e,t&&o&&n.jsx(u.Box,{id:t,width:"100%",height:"1px"})]})},q=f.default(u.Box)`
6
+ `,p=({source:e,children:t,spacing:o=0,fullWidth:r=!1,placement:s="bottom-start",centered:l=!1,...c})=>{const[h,g]=i.useState(void 0),{x:m,y:x,reference:d,floating:j,strategy:P}=a.useFloating({strategy:"fixed",placement:l?"bottom":s,middleware:[a.offset({mainAxis:o}),a.shift(),a.flip()],whileElementsMounted:a.autoUpdate});return i.useLayoutEffect(()=>{d(e.current)},[e,d]),i.useLayoutEffect(()=>{r&&g(e.current.offsetWidth)},[r,e]),n.jsx($,{ref:j,style:{left:m,top:x,position:P,width:h||void 0},hasRadius:!0,background:"neutral0",padding:1,...c,children:t})},b=({children:e,intersectionId:t,onReachEnd:o,...r})=>{const s=i.useRef(null);return k.useIntersection(s,o??(()=>{}),{selectorToWatch:`#${t}`,skipWhen:!t||!o}),n.jsxs(q,{ref:s,...r,children:[e,t&&o&&n.jsx(u.Box,{id:t,width:"100%",height:"1px"})]})},q=f.default(u.Box)`
7
7
  // 16 is base base size, 3 is the factor to get closer to 40px and 5 is the number of elements visible in the list
8
8
  max-height: ${3*5}rem;
9
9
  overflow-y: auto;
@@ -23,4 +23,4 @@
23
23
  border-radius: ${({theme:e})=>e.borderRadius};
24
24
  margin-right: 10px;
25
25
  }
26
- `,E=({children:e,source:t,spacing:o,fullWidth:r,placement:s,centered:i,...c})=>n.jsx(_.Portal,{children:n.jsx(p,{source:t,spacing:o,fullWidth:r,placement:s,centered:i,children:n.jsx(b,{...c,children:e})})});exports.Content=p;exports.POPOVER_PLACEMENTS=O;exports.Popover=E;exports.Scrolling=b;
26
+ `,E=({children:e,source:t,spacing:o,fullWidth:r,placement:s,centered:l,...c})=>n.jsx(_.Portal,{children:n.jsx(p,{source:t,spacing:o,fullWidth:r,placement:s,centered:l,children:n.jsx(b,{...c,children:e})})});exports.Content=p;exports.POPOVER_PLACEMENTS=O;exports.Popover=E;exports.Scrolling=b;
@@ -1,15 +1,17 @@
1
1
  import { jsx as i, jsxs as x } from "react/jsx-runtime";
2
2
  import * as a from "react";
3
- import { useFloating as w, offset as k, shift as y, flip as $, autoUpdate as v } from "@floating-ui/react-dom";
4
- import c from "styled-components";
3
+ import { useFloating as w, offset as k, shift as $, flip as y, autoUpdate as v } from "@floating-ui/react-dom";
4
+ import f from "styled-components";
5
5
  import { Box as d } from "../Box/Box.js";
6
6
  import { useIntersection as P } from "../hooks/useIntersection.js";
7
7
  import { Portal as S } from "../Portal/Portal.js";
8
- const T = ["top", "top-start", "top-end", "right", "right-start", "right-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end"], W = c(d)`
8
+ const T = ["top", "top-start", "top-end", "right", "right-start", "right-end", "bottom", "bottom-start", "bottom-end", "left", "left-start", "left-end"], W = f(d)`
9
9
  box-shadow: ${({
10
10
  theme: t
11
11
  }) => t.shadows.filterShadow};
12
- z-index: 4;
12
+ z-index: ${({
13
+ theme: t
14
+ }) => t.zIndices[0]};
13
15
  border: 1px solid ${({
14
16
  theme: t
15
17
  }) => t.colors.neutral150};
@@ -28,7 +30,7 @@ const T = ["top", "top-start", "top-end", "right", "right-start", "right-end", "
28
30
  const [p, u] = a.useState(void 0), {
29
31
  x: h,
30
32
  y: m,
31
- reference: f,
33
+ reference: c,
32
34
  floating: b,
33
35
  strategy: g
34
36
  } = w({
@@ -36,12 +38,12 @@ const T = ["top", "top-start", "top-end", "right", "right-start", "right-end", "
36
38
  placement: n ? "bottom" : s,
37
39
  middleware: [k({
38
40
  mainAxis: o
39
- }), y(), $()],
41
+ }), $(), y()],
40
42
  whileElementsMounted: v
41
43
  });
42
44
  return a.useLayoutEffect(() => {
43
- f(t.current);
44
- }, [t, f]), a.useLayoutEffect(() => {
45
+ c(t.current);
46
+ }, [t, c]), a.useLayoutEffect(() => {
45
47
  r && u(t.current.offsetWidth);
46
48
  }, [r, t]), i(W, {
47
49
  ref: b,
@@ -68,7 +70,7 @@ const T = ["top", "top-start", "top-end", "right", "right-start", "right-end", "
68
70
  }), {
69
71
  selectorToWatch: `#${e}`,
70
72
  skipWhen: !e || !o
71
- }), x(L, {
73
+ }), x(z, {
72
74
  ref: s,
73
75
  ...r,
74
76
  children: [t, e && o && i(d, {
@@ -77,7 +79,7 @@ const T = ["top", "top-start", "top-end", "right", "right-start", "right-end", "
77
79
  height: "1px"
78
80
  })]
79
81
  });
80
- }, L = c(d)`
82
+ }, z = f(d)`
81
83
  // 16 is base base size, 3 is the factor to get closer to 40px and 5 is the number of elements visible in the list
82
84
  max-height: ${3 * 5}rem;
83
85
  overflow-y: auto;
@@ -1,9 +1,9 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),N=require("react"),X=require("@strapi/icons"),I=require("styled-components"),i=require("./SelectParts.cjs"),Y=require("../BaseCheckbox/assets/checkmark.cjs"),F=require("../Box/Box.cjs"),J=require("../Field/Field.cjs"),K=require("../Field/FieldLabel.cjs");require("../Field/FieldInput.cjs");const Q=require("../Field/FieldHint.cjs"),U=require("../Field/FieldError.cjs");require("../Field/FieldContext.cjs");require("../Field/FieldAction.cjs");const Z=require("../Flex/Flex.cjs"),ee=require("../hooks/useId.cjs"),te=require("../hooks/useIntersection.cjs"),re=require("../Tag/Tag.cjs"),C=require("../Typography/Typography.cjs"),ne=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function ie(e){if(e&&e.__esModule)return e;const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:()=>e[r]})}}return n.default=e,Object.freeze(n)}const a=ie(N),oe=ne(I),se=({children:e,clearLabel:n="Clear",customizeContent:r=f=>f?.join(",")??"",disabled:s,error:l,hint:d,id:u,label:p,labelAction:O,onChange:x,onClear:M,onReachEnd:b,placeholder:R,required:m,selectButtonTitle:ae,startIcon:v,size:B="M",value:j,withTags:q,..._})=>{const f=a.useRef(null),[k,T]=a.useState(),[L,P]=a.useState(!1),h=ee.useId(u),z=`${h}-hint`,E=`${h}-error`,V=o=>{x?x(o):T(o)},A=o=>()=>{const g=Array.isArray(j)?j.filter(y=>y!==o):(k??[]).filter(y=>y!==o);x?x(g):T(g)},G=o=>{P(o)},S=a.useRef(null),H=()=>{S.current.focus()},$=`intersection-${h}`,D=o=>{b&&b(o)};te.useIntersection(f,D,{selectorToWatch:`#${$}`,skipWhen:!L});const c=typeof j<"u"?j:k,W=({value:o,textValue:g})=>t.jsx(re.Tag,{tabIndex:-1,disabled:s,icon:t.jsx(X.Cross,{}),onClick:A(o),children:g},o);return t.jsx(J.Field,{hint:d,error:l,id:h,required:m,children:t.jsxs(Z.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[t.jsx(K.FieldLabel,{onClick:H,action:O,children:p}),t.jsxs(i.Root,{onOpenChange:G,disabled:s,required:m,onValueChange:V,value:c,..._,multi:!0,children:[t.jsx(i.Trigger,{ref:S,"aria-label":p,"aria-describedby":`${z} ${E}`,id:h,startIcon:v,size:B,hasError:Boolean(l),disabled:s,clearLabel:n,onClear:c?.length?M:void 0,paddingLeft:q&&c?.length?1:3,children:t.jsx(i.Value,{placeholder:R,textColor:c?.length?"neutral800":"neutral600",children:c?.length?q?W:r(c):null})}),t.jsx(i.Portal,{children:t.jsx(i.Content,{position:"popper",sideOffset:4,children:t.jsxs(i.Viewport,{ref:f,children:[e,t.jsx(F.Box,{id:$,width:"100%",height:"1px"})]})})})]}),t.jsx(Q.FieldHint,{}),t.jsx(U.FieldError,{})]})})},le=a.forwardRef(({value:e,children:n,startIcon:r,...s},l)=>t.jsxs(i.Item,{ref:l,value:e.toString(),...s,children:[r&&t.jsx(F.Box,{as:"span","aria-hidden":!0,children:r}),t.jsx(i.ItemIndicator,{children:({isSelected:d,isIntermediate:u})=>t.jsx(w,{hasRadius:!0,overflow:"hidden",position:"relative",$indeterminate:u,$selected:d,zIndex:1,height:"18px",width:"18px"})}),t.jsx(C.Typography,{textColor:"neutral800",children:t.jsx(i.ItemText,{children:n})})]})),w=oe.default(F.Box)`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),N=require("react"),X=require("@strapi/icons"),y=require("styled-components"),s=require("./SelectParts.cjs"),Y=require("../BaseCheckbox/assets/checkmark.cjs"),g=require("../Box/Box.cjs"),J=require("../Field/Field.cjs"),K=require("../Field/FieldLabel.cjs");require("../Field/FieldInput.cjs");const Q=require("../Field/FieldHint.cjs"),U=require("../Field/FieldError.cjs");require("../Field/FieldContext.cjs");require("../Field/FieldAction.cjs");const Z=require("../Flex/Flex.cjs"),ee=require("../hooks/useId.cjs"),te=require("../hooks/useIntersection.cjs"),re=require("../Tag/Tag.cjs"),C=require("../Typography/Typography.cjs"),ne=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function ie(e){if(e&&e.__esModule)return e;const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return n.default=e,Object.freeze(n)}const a=ie(N),se=ne(y),oe=({children:e,clearLabel:n="Clear",customizeContent:r,disabled:o,error:l,hint:d,id:u,label:p,labelAction:O,onChange:x,onClear:M,onReachEnd:b,placeholder:R,required:I,selectButtonTitle:ae,startIcon:v,size:B="M",value:f,withTags:m,..._})=>{const q=a.useRef(null),[k,T]=a.useState(),[L,P]=a.useState(!1),h=ee.useId(u),E=`${h}-hint`,V=`${h}-error`,z=i=>{x?x(i):T(i)},A=i=>()=>{const j=Array.isArray(f)?f.filter(F=>F!==i):(k??[]).filter(F=>F!==i);x?x(j):T(j)},G=i=>{P(i)},S=a.useRef(null),H=()=>{S.current.focus()},$=`intersection-${h}`,D=i=>{b&&b(i)};te.useIntersection(q,D,{selectorToWatch:`#${$}`,skipWhen:!L});const c=typeof f<"u"?f:k,W=({value:i,textValue:j})=>t.jsx(re.Tag,{tabIndex:-1,disabled:o,icon:t.jsx(X.Cross,{}),onClick:A(i),children:j},i);return t.jsx(J.Field,{hint:d,error:l,id:h,required:I,children:t.jsxs(Z.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[t.jsx(K.FieldLabel,{onClick:H,action:O,children:p}),t.jsxs(s.Root,{onOpenChange:G,disabled:o,required:I,onValueChange:z,value:c,..._,multi:!0,children:[t.jsx(s.Trigger,{ref:S,"aria-label":p,"aria-describedby":`${E} ${V}`,id:h,startIcon:v,size:B,hasError:Boolean(l),disabled:o,clearLabel:n,onClear:c?.length?M:void 0,paddingLeft:m&&c?.length?1:3,children:t.jsx(s.Value,{placeholder:R,textColor:c?.length?"neutral800":"neutral600",children:c?.length?m?W:r?r(c):void 0:void 0})}),t.jsx(s.Portal,{children:t.jsx(s.Content,{position:"popper",sideOffset:4,children:t.jsxs(s.Viewport,{ref:q,children:[e,t.jsx(g.Box,{id:$,width:"100%",height:"1px"})]})})})]}),t.jsx(Q.FieldHint,{}),t.jsx(U.FieldError,{})]})})},le=a.forwardRef(({value:e,children:n,startIcon:r,...o},l)=>t.jsxs(s.Item,{ref:l,value:e.toString(),...o,children:[r&&t.jsx(g.Box,{as:"span","aria-hidden":!0,children:r}),t.jsx(s.ItemIndicator,{children:({isSelected:d,isIntermediate:u})=>t.jsx(w,{hasRadius:!0,overflow:"hidden",position:"relative",$indeterminate:u,$selected:d,zIndex:1,height:"18px",width:"18px"})}),t.jsx(C.Typography,{textColor:"neutral800",children:t.jsx(s.ItemText,{children:n})})]})),w=se.default(g.Box)`
2
2
  border: 1px solid
3
3
  ${({theme:e,$selected:n,$indeterminate:r})=>n||r?e.colors.primary600:e.colors.neutral300};
4
4
  background-color: ${({theme:e,$selected:n,$indeterminate:r})=>n||r?e.colors.primary600:e.colors.neutral0};
5
5
 
6
- ${({theme:e,$indeterminate:n})=>n&&I.css`
6
+ ${({theme:e,$indeterminate:n})=>n&&y.css`
7
7
  &::after {
8
8
  content: '';
9
9
  display: block;
@@ -18,7 +18,7 @@
18
18
  }
19
19
  `}
20
20
 
21
- ${({$selected:e})=>e&&I.css`
21
+ ${({$selected:e})=>e&&y.css`
22
22
  &::after {
23
23
  content: '';
24
24
  background: url(${Y}) no-repeat no-repeat center center;
@@ -27,4 +27,4 @@
27
27
  position: absolute;
28
28
  }
29
29
  `}
30
- `,ce=a.forwardRef(({children:e,label:n,startIcon:r,values:s=[],...l},d)=>t.jsxs(i.Group,{ref:d,children:[t.jsxs(i.Item,{value:s,...l,children:[r&&t.jsx(F.Box,{as:"span","aria-hidden":!0,children:r}),t.jsx(i.ItemIndicator,{children:({isSelected:u,isIntermediate:p})=>t.jsx(w,{hasRadius:!0,overflow:"hidden",position:"relative",$indeterminate:p,$selected:u,zIndex:1,height:"18px",width:"18px"})}),t.jsx(C.Typography,{textColor:"neutral800",children:t.jsx(i.ItemText,{children:n})})]}),e]}));exports.MultiSelect=se;exports.MultiSelectGroup=ce;exports.MultiSelectOption=le;
30
+ `,ce=a.forwardRef(({children:e,label:n,startIcon:r,values:o=[],...l},d)=>t.jsxs(s.Group,{ref:d,children:[t.jsxs(s.Item,{value:o,...l,children:[r&&t.jsx(g.Box,{as:"span","aria-hidden":!0,children:r}),t.jsx(s.ItemIndicator,{children:({isSelected:u,isIntermediate:p})=>t.jsx(w,{hasRadius:!0,overflow:"hidden",position:"relative",$indeterminate:p,$selected:u,zIndex:1,height:"18px",width:"18px"})}),t.jsx(C.Typography,{textColor:"neutral800",children:n})]}),e]}));exports.MultiSelect=oe;exports.MultiSelectGroup=ce;exports.MultiSelectOption=le;
@@ -1,10 +1,10 @@
1
- import { jsxs as d, jsx as e } from "react/jsx-runtime";
2
- import * as c from "react";
3
- import { Cross as J } from "@strapi/icons";
4
- import K, { css as T } from "styled-components";
5
- import { Item as S, ItemIndicator as F, ItemText as O, Group as N, Root as Q, Trigger as U, Value as Z, Portal as ee, Content as re, Viewport as te } from "./SelectParts.js";
1
+ import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
+ import * as d from "react";
3
+ import { Cross as D } from "@strapi/icons";
4
+ import J, { css as T } from "styled-components";
5
+ import { Item as S, ItemIndicator as F, ItemText as K, Group as N, Root as Q, Trigger as U, Value as Z, Portal as ee, Content as re, Viewport as te } from "./SelectParts.js";
6
6
  import ne from "../BaseCheckbox/assets/checkmark.js";
7
- import { Box as I } from "../Box/Box.js";
7
+ import { Box as x } from "../Box/Box.js";
8
8
  import { Field as oe } from "../Field/Field.js";
9
9
  import { FieldLabel as ie } from "../Field/FieldLabel.js";
10
10
  import "../Field/FieldInput.js";
@@ -12,104 +12,104 @@ import { FieldHint as le } from "../Field/FieldHint.js";
12
12
  import { FieldError as ae } from "../Field/FieldError.js";
13
13
  import "../Field/FieldContext.js";
14
14
  import "../Field/FieldAction.js";
15
- import { Flex as ce } from "../Flex/Flex.js";
16
- import { useId as de } from "../hooks/useId.js";
15
+ import { Flex as de } from "../Flex/Flex.js";
16
+ import { useId as ce } from "../hooks/useId.js";
17
17
  import { useIntersection as se } from "../hooks/useIntersection.js";
18
18
  import { Tag as he } from "../Tag/Tag.js";
19
- import { Typography as M } from "../Typography/Typography.js";
19
+ import { Typography as O } from "../Typography/Typography.js";
20
20
  const Be = ({
21
21
  children: r,
22
- clearLabel: n = "Clear",
23
- customizeContent: o = (g) => g?.join(",") ?? "",
22
+ clearLabel: o = "Clear",
23
+ customizeContent: t,
24
24
  disabled: i,
25
25
  error: l,
26
26
  hint: s,
27
27
  id: h,
28
28
  label: u,
29
- labelAction: L,
29
+ labelAction: B,
30
30
  onChange: f,
31
- onClear: V,
32
- onReachEnd: b,
33
- placeholder: j,
34
- required: k,
31
+ onClear: L,
32
+ onReachEnd: $,
33
+ placeholder: V,
34
+ required: b,
35
35
  selectButtonTitle: pe,
36
- startIcon: z,
37
- size: E = "M",
36
+ startIcon: E,
37
+ size: j = "M",
38
38
  value: m,
39
- withTags: C,
40
- ...A
39
+ withTags: k,
40
+ ...z
41
41
  }) => {
42
- const g = c.useRef(null), [w, R] = c.useState(), [G, W] = c.useState(!1), p = de(h), q = `${p}-hint`, H = `${p}-error`, P = (t) => {
43
- f ? f(t) : R(t);
44
- }, X = (t) => () => {
45
- const x = Array.isArray(m) ? m.filter(($) => $ !== t) : (w ?? []).filter(($) => $ !== t);
46
- f ? f(x) : R(x);
47
- }, Y = (t) => {
48
- W(t);
49
- }, y = c.useRef(null), _ = () => {
42
+ const w = d.useRef(null), [C, R] = d.useState(), [A, G] = d.useState(!1), p = ce(h), W = `${p}-hint`, q = `${p}-error`, H = (n) => {
43
+ f ? f(n) : R(n);
44
+ }, P = (n) => () => {
45
+ const g = Array.isArray(m) ? m.filter((I) => I !== n) : (C ?? []).filter((I) => I !== n);
46
+ f ? f(g) : R(g);
47
+ }, X = (n) => {
48
+ G(n);
49
+ }, y = d.useRef(null), Y = () => {
50
50
  y.current.focus();
51
51
  }, v = `intersection-${p}`;
52
- se(g, (t) => {
53
- b && b(t);
52
+ se(w, (n) => {
53
+ $ && $(n);
54
54
  }, {
55
55
  selectorToWatch: `#${v}`,
56
- skipWhen: !G
56
+ skipWhen: !A
57
57
  });
58
- const a = typeof m < "u" ? m : w, D = ({
59
- value: t,
60
- textValue: x
58
+ const a = typeof m < "u" ? m : C, _ = ({
59
+ value: n,
60
+ textValue: g
61
61
  }) => e(he, {
62
62
  tabIndex: -1,
63
63
  disabled: i,
64
- icon: e(J, {}),
65
- onClick: X(t),
66
- children: x
67
- }, t);
64
+ icon: e(D, {}),
65
+ onClick: P(n),
66
+ children: g
67
+ }, n);
68
68
  return e(oe, {
69
69
  hint: s,
70
70
  error: l,
71
71
  id: p,
72
- required: k,
73
- children: d(ce, {
72
+ required: b,
73
+ children: c(de, {
74
74
  direction: "column",
75
75
  alignItems: "stretch",
76
76
  gap: 1,
77
77
  children: [e(ie, {
78
- onClick: _,
79
- action: L,
78
+ onClick: Y,
79
+ action: B,
80
80
  children: u
81
- }), d(Q, {
82
- onOpenChange: Y,
81
+ }), c(Q, {
82
+ onOpenChange: X,
83
83
  disabled: i,
84
- required: k,
85
- onValueChange: P,
84
+ required: b,
85
+ onValueChange: H,
86
86
  value: a,
87
- ...A,
87
+ ...z,
88
88
  multi: !0,
89
89
  children: [e(U, {
90
90
  ref: y,
91
91
  "aria-label": u,
92
- "aria-describedby": `${q} ${H}`,
92
+ "aria-describedby": `${W} ${q}`,
93
93
  id: p,
94
- startIcon: z,
95
- size: E,
94
+ startIcon: E,
95
+ size: j,
96
96
  hasError: Boolean(l),
97
97
  disabled: i,
98
- clearLabel: n,
99
- onClear: a?.length ? V : void 0,
100
- paddingLeft: C && a?.length ? 1 : 3,
98
+ clearLabel: o,
99
+ onClear: a?.length ? L : void 0,
100
+ paddingLeft: k && a?.length ? 1 : 3,
101
101
  children: e(Z, {
102
- placeholder: j,
102
+ placeholder: V,
103
103
  textColor: a?.length ? "neutral800" : "neutral600",
104
- children: a?.length ? C ? D : o(a) : null
104
+ children: a?.length ? k ? _ : t ? t(a) : void 0 : void 0
105
105
  })
106
106
  }), e(ee, {
107
107
  children: e(re, {
108
108
  position: "popper",
109
109
  sideOffset: 4,
110
- children: d(te, {
111
- ref: g,
112
- children: [r, e(I, {
110
+ children: c(te, {
111
+ ref: w,
112
+ children: [r, e(x, {
113
113
  id: v,
114
114
  width: "100%",
115
115
  height: "1px"
@@ -120,24 +120,24 @@ const Be = ({
120
120
  }), e(le, {}), e(ae, {})]
121
121
  })
122
122
  });
123
- }, Le = c.forwardRef(({
123
+ }, Le = d.forwardRef(({
124
124
  value: r,
125
- children: n,
126
- startIcon: o,
125
+ children: o,
126
+ startIcon: t,
127
127
  ...i
128
- }, l) => d(S, {
128
+ }, l) => c(S, {
129
129
  ref: l,
130
130
  value: r.toString(),
131
131
  ...i,
132
- children: [o && e(I, {
132
+ children: [t && e(x, {
133
133
  as: "span",
134
134
  "aria-hidden": !0,
135
- children: o
135
+ children: t
136
136
  }), e(F, {
137
137
  children: ({
138
138
  isSelected: s,
139
139
  isIntermediate: h
140
- }) => e(B, {
140
+ }) => e(M, {
141
141
  hasRadius: !0,
142
142
  overflow: "hidden",
143
143
  position: "relative",
@@ -147,29 +147,29 @@ const Be = ({
147
147
  height: "18px",
148
148
  width: "18px"
149
149
  })
150
- }), e(M, {
150
+ }), e(O, {
151
151
  textColor: "neutral800",
152
- children: e(O, {
153
- children: n
152
+ children: e(K, {
153
+ children: o
154
154
  })
155
155
  })]
156
- })), B = K(I)`
156
+ })), M = J(x)`
157
157
  border: 1px solid
158
158
  ${({
159
159
  theme: r,
160
- $selected: n,
161
- $indeterminate: o
162
- }) => n || o ? r.colors.primary600 : r.colors.neutral300};
160
+ $selected: o,
161
+ $indeterminate: t
162
+ }) => o || t ? r.colors.primary600 : r.colors.neutral300};
163
163
  background-color: ${({
164
164
  theme: r,
165
- $selected: n,
166
- $indeterminate: o
167
- }) => n || o ? r.colors.primary600 : r.colors.neutral0};
165
+ $selected: o,
166
+ $indeterminate: t
167
+ }) => o || t ? r.colors.primary600 : r.colors.neutral0};
168
168
 
169
169
  ${({
170
170
  theme: r,
171
- $indeterminate: n
172
- }) => n && T`
171
+ $indeterminate: o
172
+ }) => o && T`
173
173
  &::after {
174
174
  content: '';
175
175
  display: block;
@@ -195,26 +195,26 @@ const Be = ({
195
195
  position: absolute;
196
196
  }
197
197
  `}
198
- `, Ve = c.forwardRef(({
198
+ `, Ve = d.forwardRef(({
199
199
  children: r,
200
- label: n,
201
- startIcon: o,
200
+ label: o,
201
+ startIcon: t,
202
202
  values: i = [],
203
203
  ...l
204
- }, s) => d(N, {
204
+ }, s) => c(N, {
205
205
  ref: s,
206
- children: [d(S, {
206
+ children: [c(S, {
207
207
  value: i,
208
208
  ...l,
209
- children: [o && e(I, {
209
+ children: [t && e(x, {
210
210
  as: "span",
211
211
  "aria-hidden": !0,
212
- children: o
212
+ children: t
213
213
  }), e(F, {
214
214
  children: ({
215
215
  isSelected: h,
216
216
  isIntermediate: u
217
- }) => e(B, {
217
+ }) => e(M, {
218
218
  hasRadius: !0,
219
219
  overflow: "hidden",
220
220
  position: "relative",
@@ -224,11 +224,9 @@ const Be = ({
224
224
  height: "18px",
225
225
  width: "18px"
226
226
  })
227
- }), e(M, {
227
+ }), e(O, {
228
228
  textColor: "neutral800",
229
- children: e(O, {
230
- children: n
231
- })
229
+ children: o
232
230
  })]
233
231
  }), r]
234
232
  }));
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),w=require("react"),d=require("@strapi/icons"),o=require("@strapi/ui-primitives"),p=require("styled-components"),h=require("../Box/Box.cjs"),l=require("../Flex/Flex.cjs"),R=require("../hooks/useComposeRefs.cjs");require("../themes/lightTheme/index.cjs");require("../themes/darkTheme/index.cjs");require("lodash");const u=require("../themes/utils.cjs"),g=require("../Typography/Typography.cjs"),I=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function T(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const c=T(w),i=I(p),q=c.forwardRef(({onClear:e,clearLabel:t="Clear",startIcon:s,disabled:n,hasError:f,size:m="M",children:x,...b},y)=>{const a=c.useRef(null),$=j=>{e&&!n&&(e(j),a.current.focus())},S=R.useComposedRefs(a,y);return r.jsx(o.Select.Trigger,{asChild:!0,children:r.jsxs(C,{"aria-disabled":n,$hasError:f,$size:m,ref:S,alignItems:"center",justifyContent:"space-between",position:"relative",overflow:"hidden",hasRadius:!0,background:n?"neutral150":"neutral0",paddingLeft:3,paddingRight:3,gap:4,...b,children:[r.jsxs(l.Flex,{as:"span",gap:4,children:[s&&r.jsx(h.Box,{as:"span","aria-hidden":!0,children:s}),x]}),r.jsxs(l.Flex,{as:"span",gap:3,children:[e?r.jsx(v,{as:"button",hasRadius:!0,background:"transparent",role:"button",tabIndex:0,onClick:$,"aria-disabled":n,"aria-label":t,title:t,cursor:"pointer",children:r.jsx(d.Cross,{})}):null,r.jsx(k,{children:r.jsx(d.CarretDown,{})})]})]})})}),v=i.default(h.Box)`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),w=require("react"),u=require("@strapi/icons"),o=require("@strapi/ui-primitives"),p=require("styled-components"),h=require("../Box/Box.cjs"),l=require("../Flex/Flex.cjs"),R=require("../hooks/useComposeRefs.cjs");require("../themes/lightTheme/index.cjs");require("../themes/darkTheme/index.cjs");require("lodash");const d=require("../themes/utils.cjs"),f=require("../Typography/Typography.cjs"),I=e=>e&&typeof e=="object"&&"default"in e?e:{default:e};function T(e){if(e&&e.__esModule)return e;const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,n.get?n:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const c=T(w),i=I(p),q=c.forwardRef(({onClear:e,clearLabel:t="Clear",startIcon:s,disabled:n,hasError:g,size:m="M",children:x,...b},y)=>{const a=c.useRef(null),$=j=>{e&&!n&&(e(j),a.current.focus())},S=R.useComposedRefs(a,y);return r.jsx(o.Select.Trigger,{asChild:!0,children:r.jsxs(C,{"aria-disabled":n,$hasError:g,$size:m,ref:S,alignItems:"center",justifyContent:"space-between",position:"relative",overflow:"hidden",hasRadius:!0,background:n?"neutral150":"neutral0",paddingLeft:3,paddingRight:3,gap:4,cursor:"default",...b,children:[r.jsxs(l.Flex,{as:"span",gap:4,children:[s&&r.jsx(h.Box,{as:"span","aria-hidden":!0,children:s}),x]}),r.jsxs(l.Flex,{as:"span",gap:3,children:[e?r.jsx(v,{as:"button",hasRadius:!0,background:"transparent",role:"button",tabIndex:0,onClick:$,"aria-disabled":n,"aria-label":t,title:t,cursor:"pointer",children:r.jsx(u.Cross,{})}):null,r.jsx(k,{children:r.jsx(u.CarretDown,{})})]})]})})}),v=i.default(h.Box)`
2
2
  border: none;
3
3
 
4
4
  svg {
@@ -11,7 +11,7 @@
11
11
  }
12
12
  `,C=i.default(l.Flex)`
13
13
  border: 1px solid ${({theme:e,$hasError:t})=>t?e.colors.danger600:e.colors.neutral200};
14
- min-height: ${({theme:e,$size:t})=>u.getThemeSize("input")({theme:e,size:t})};
14
+ min-height: ${({theme:e,$size:t})=>d.getThemeSize("input")({theme:e,size:t})};
15
15
 
16
16
  &[aria-disabled='true'] {
17
17
  color: ${e=>e.theme.colors.neutral600};
@@ -22,7 +22,7 @@
22
22
  outline: none;
23
23
  }
24
24
 
25
- ${({theme:e,$hasError:t})=>u.inputFocusStyle()({theme:e,hasError:t})};
25
+ ${({theme:e,$hasError:t})=>d.inputFocusStyle()({theme:e,hasError:t})};
26
26
  `,k=i.default(o.Select.Icon)`
27
27
  & > svg {
28
28
  width: ${6/16}rem;
@@ -31,7 +31,7 @@
31
31
  fill: ${({theme:e})=>e.colors.neutral600};
32
32
  }
33
33
  }
34
- `,_=c.forwardRef(({children:e,placeholder:t,...s},n)=>r.jsx(g.Typography,{ref:n,ellipsis:!0,...s,children:r.jsx(V,{placeholder:t,children:e})})),V=i.default(o.Select.Value)`
34
+ `,_=c.forwardRef(({children:e,placeholder:t,...s},n)=>r.jsx(f.Typography,{ref:n,ellipsis:!0,...s,children:r.jsx(V,{placeholder:t,children:e})})),V=i.default(o.Select.Value)`
35
35
  display: flex;
36
36
  gap: ${({theme:e})=>e.spaces[1]};
37
37
  flex-wrap: wrap;
@@ -59,6 +59,7 @@
59
59
  align-items: center;
60
60
  gap: ${({theme:e})=>e.spaces[2]};
61
61
  white-space: nowrap;
62
+ user-select: none;
62
63
 
63
64
  &:focus-visible {
64
65
  outline: none;
@@ -72,7 +73,7 @@
72
73
  }
73
74
 
74
75
  &[data-state='checked'] {
75
- ${g.Typography} {
76
+ ${f.Typography} {
76
77
  font-weight: bold;
77
78
  color: ${({theme:e})=>e.colors.primary600};
78
79
  }
@@ -14,20 +14,20 @@ import { Typography as u } from "../Typography/Typography.js";
14
14
  const v = a.forwardRef(({
15
15
  onClear: e,
16
16
  clearLabel: r = "Clear",
17
- startIcon: n,
18
- disabled: i,
17
+ startIcon: i,
18
+ disabled: n,
19
19
  hasError: m,
20
20
  size: h = "M",
21
21
  children: f,
22
22
  ...g
23
23
  }, $) => {
24
24
  const d = a.useRef(null), w = (x) => {
25
- e && !i && (e(x), d.current.focus());
25
+ e && !n && (e(x), d.current.focus());
26
26
  }, b = S(d, $);
27
27
  return t(o.Trigger, {
28
28
  asChild: !0,
29
29
  children: l(V, {
30
- "aria-disabled": i,
30
+ "aria-disabled": n,
31
31
  $hasError: m,
32
32
  $size: h,
33
33
  ref: b,
@@ -36,18 +36,19 @@ const v = a.forwardRef(({
36
36
  position: "relative",
37
37
  overflow: "hidden",
38
38
  hasRadius: !0,
39
- background: i ? "neutral150" : "neutral0",
39
+ background: n ? "neutral150" : "neutral0",
40
40
  paddingLeft: 3,
41
41
  paddingRight: 3,
42
42
  gap: 4,
43
+ cursor: "default",
43
44
  ...g,
44
45
  children: [l(c, {
45
46
  as: "span",
46
47
  gap: 4,
47
- children: [n && t(p, {
48
+ children: [i && t(p, {
48
49
  as: "span",
49
50
  "aria-hidden": !0,
50
- children: n
51
+ children: i
51
52
  }), f]
52
53
  }), l(c, {
53
54
  as: "span",
@@ -59,7 +60,7 @@ const v = a.forwardRef(({
59
60
  role: "button",
60
61
  tabIndex: 0,
61
62
  onClick: w,
62
- "aria-disabled": i,
63
+ "aria-disabled": n,
63
64
  "aria-label": r,
64
65
  title: r,
65
66
  cursor: "pointer",
@@ -125,11 +126,11 @@ const v = a.forwardRef(({
125
126
  `, j = a.forwardRef(({
126
127
  children: e,
127
128
  placeholder: r,
128
- ...n
129
- }, i) => t(u, {
130
- ref: i,
129
+ ...i
130
+ }, n) => t(u, {
131
+ ref: n,
131
132
  ellipsis: !0,
132
- ...n,
133
+ ...i,
133
134
  children: t(F, {
134
135
  placeholder: r,
135
136
  children: e
@@ -185,6 +186,7 @@ const v = a.forwardRef(({
185
186
  theme: e
186
187
  }) => e.spaces[2]};
187
188
  white-space: nowrap;
189
+ user-select: none;
188
190
 
189
191
  &:focus-visible {
190
192
  outline: none;
@@ -209,10 +211,10 @@ const v = a.forwardRef(({
209
211
  }) => e.colors.primary600};
210
212
  }
211
213
  }
212
- `, X = o.Root, Y = v, Z = j, _ = o.Portal, ee = B, re = D, oe = E, te = o.ItemIndicator, se = o.ItemText, ie = o.Group;
214
+ `, X = o.Root, Y = v, Z = j, _ = o.Portal, ee = B, re = D, oe = E, te = o.ItemIndicator, se = o.ItemText, ne = o.Group;
213
215
  export {
214
216
  ee as Content,
215
- ie as Group,
217
+ ne as Group,
216
218
  oe as Item,
217
219
  te as ItemIndicator,
218
220
  se as ItemText,
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),N=require("react"),l=require("./SelectParts.cjs"),q=require("../Box/Box.cjs"),V=require("../Field/Field.cjs"),H=require("../Field/FieldLabel.cjs");require("../Field/FieldInput.cjs");const z=require("../Field/FieldHint.cjs"),W=require("../Field/FieldError.cjs");require("../Field/FieldContext.cjs");require("../Field/FieldAction.cjs");const A=require("../Flex/Flex.cjs"),D=require("../hooks/useId.cjs"),G=require("../hooks/useIntersection.cjs"),J=require("../Typography/Typography.cjs");function K(t){if(t&&t.__esModule)return t;const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(n,i,s.get?s:{enumerable:!0,get:()=>t[i]})}}return n.default=t,Object.freeze(n)}const d=K(N),Q=({children:t,clearLabel:n="Clear",customizeContent:i=p=>p?.toString()??"",disabled:s,error:u,hint:m,id:y,label:x,labelAction:O,onChange:a,onClear:h,onReachEnd:f,placeholder:T,required:g,selectButtonTitle:X,startIcon:B,size:C="M",value:j,...R})=>{const[p,F]=d.useState(),[_,k]=d.useState(!1),o=D.useId(y),v=`${o}-hint`,P=`${o}-error`,$=r=>{a?a(typeof j=="number"?Number(r):r):F(r)},w=r=>{k(r)},L=r=>{h&&h(r),a||F("")},b=d.useRef(null),M=()=>{b.current.focus()},S=d.useRef(null),I=`intersection-${o}`,E=r=>{f&&f(r)};G.useIntersection(S,E,{selectorToWatch:`#${I}`,skipWhen:!_});const c=(typeof j<"u"?j.toString():p)??"";return e.jsx(V.Field,{hint:m,error:u,id:o,required:g,children:e.jsxs(A.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[e.jsx(H.FieldLabel,{onClick:M,action:O,children:x}),e.jsxs(l.Root,{onOpenChange:w,disabled:s,required:g,onValueChange:$,value:c,...R,children:[e.jsx(l.Trigger,{ref:b,"aria-label":x,"aria-describedby":`${v} ${P}`,id:o,startIcon:B,size:C,hasError:Boolean(u),disabled:s,clearLabel:n,onClear:c&&h?L:void 0,children:e.jsx(l.Value,{placeholder:T,textColor:c?"neutral800":"neutral600",children:c?i(c):null})}),e.jsx(l.Portal,{children:e.jsx(l.Content,{position:"popper",sideOffset:4,children:e.jsxs(l.Viewport,{ref:S,children:[t,e.jsx(q.Box,{id:I,width:"100%",height:"1px"})]})})})]}),e.jsx(z.FieldHint,{}),e.jsx(W.FieldError,{})]})})},U=d.forwardRef(({value:t,startIcon:n,children:i,...s},u)=>e.jsxs(l.Item,{ref:u,value:t.toString(),...s,children:[n&&e.jsx(q.Box,{as:"span","aria-hidden":!0,children:n}),e.jsx(J.Typography,{textColor:"neutral800",children:e.jsx(l.ItemText,{children:i})})]}));exports.SingleSelect=Q;exports.SingleSelectOption=U;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),N=require("react"),s=require("./SelectParts.cjs"),I=require("../Box/Box.cjs"),V=require("../Field/Field.cjs"),H=require("../Field/FieldLabel.cjs");require("../Field/FieldInput.cjs");const W=require("../Field/FieldHint.cjs"),z=require("../Field/FieldError.cjs");require("../Field/FieldContext.cjs");require("../Field/FieldAction.cjs");const A=require("../Flex/Flex.cjs"),D=require("../hooks/useId.cjs"),G=require("../hooks/useIntersection.cjs"),J=require("../Typography/Typography.cjs");function K(t){if(t&&t.__esModule)return t;const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const l=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(i,r,l.get?l:{enumerable:!0,get:()=>t[r]})}}return i.default=t,Object.freeze(i)}const d=K(N),Q=({children:t,clearLabel:i="Clear",customizeContent:r,disabled:l,error:u,hint:q,id:y,label:p,labelAction:m,onChange:a,onClear:h,onReachEnd:f,placeholder:O,required:x,selectButtonTitle:X,startIcon:T,size:B="M",value:j,...R})=>{const[C,g]=d.useState(),[_,k]=d.useState(!1),o=D.useId(y),v=`${o}-hint`,P=`${o}-error`,$=n=>{a?a(typeof j=="number"?Number(n):n):g(n)},w=n=>{k(n)},L=n=>{h&&h(n),a||g("")},F=d.useRef(null),M=()=>{F.current.focus()},b=d.useRef(null),S=`intersection-${o}`,E=n=>{f&&f(n)};G.useIntersection(b,E,{selectorToWatch:`#${S}`,skipWhen:!_});const c=(typeof j<"u"?j.toString():C)??"";return e.jsx(V.Field,{hint:q,error:u,id:o,required:x,children:e.jsxs(A.Flex,{direction:"column",alignItems:"stretch",gap:1,children:[e.jsx(H.FieldLabel,{onClick:M,action:m,children:p}),e.jsxs(s.Root,{onOpenChange:w,disabled:l,required:x,onValueChange:$,value:c,...R,children:[e.jsx(s.Trigger,{ref:F,"aria-label":p,"aria-describedby":`${v} ${P}`,id:o,startIcon:T,size:B,hasError:Boolean(u),disabled:l,clearLabel:i,onClear:c&&h?L:void 0,children:e.jsx(s.Value,{placeholder:O,textColor:c?"neutral800":"neutral600",children:c&&r?r(c):void 0})}),e.jsx(s.Portal,{children:e.jsx(s.Content,{position:"popper",sideOffset:4,children:e.jsxs(s.Viewport,{ref:b,children:[t,e.jsx(I.Box,{id:S,width:"100%",height:"1px"})]})})})]}),e.jsx(W.FieldHint,{}),e.jsx(z.FieldError,{})]})})},U=d.forwardRef(({value:t,startIcon:i,children:r,...l},u)=>e.jsxs(s.Item,{ref:u,value:t.toString(),...l,children:[i&&e.jsx(I.Box,{as:"span","aria-hidden":!0,children:i}),e.jsx(J.Typography,{textColor:"neutral800",children:e.jsx(s.ItemText,{children:r})})]}));exports.SingleSelect=Q;exports.SingleSelectOption=U;
@@ -1,6 +1,6 @@
1
- import { jsxs as d, jsx as e } from "react/jsx-runtime";
2
- import * as o from "react";
3
- import { Item as q, ItemText as z, Root as H, Trigger as M, Value as P, Portal as _, Content as A, Viewport as D } from "./SelectParts.js";
1
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
+ import * as i from "react";
3
+ import { Item as q, ItemText as H, Root as M, Trigger as P, Value as _, Portal as z, Content as A, Viewport as D } from "./SelectParts.js";
4
4
  import { Box as R } from "../Box/Box.js";
5
5
  import { Field as G } from "../Field/Field.js";
6
6
  import { FieldLabel as J } from "../Field/FieldLabel.js";
@@ -14,86 +14,86 @@ import { useId as X } from "../hooks/useId.js";
14
14
  import { useIntersection as Y } from "../hooks/useIntersection.js";
15
15
  import { Typography as Z } from "../Typography/Typography.js";
16
16
  const Ie = ({
17
- children: a,
18
- clearLabel: i = "Clear",
19
- customizeContent: s = (u) => u?.toString() ?? "",
20
- disabled: l,
17
+ children: s,
18
+ clearLabel: o = "Clear",
19
+ customizeContent: l,
20
+ disabled: d,
21
21
  error: c,
22
- hint: O,
23
- id: B,
24
- label: f,
25
- labelAction: F,
22
+ hint: C,
23
+ id: O,
24
+ label: m,
25
+ labelAction: B,
26
26
  onChange: h,
27
- onClear: m,
28
- onReachEnd: g,
29
- placeholder: T,
30
- required: I,
27
+ onClear: p,
28
+ onReachEnd: u,
29
+ placeholder: F,
30
+ required: g,
31
31
  selectButtonTitle: ee,
32
- startIcon: $,
33
- size: y = "M",
34
- value: p,
35
- ...w
32
+ startIcon: T,
33
+ size: $ = "M",
34
+ value: f,
35
+ ...y
36
36
  }) => {
37
- const [u, b] = o.useState(), [V, k] = o.useState(!1), t = X(B), v = `${t}-hint`, E = `${t}-error`, L = (r) => {
38
- h ? h(typeof p == "number" ? Number(r) : r) : b(r);
37
+ const [w, I] = i.useState(), [V, k] = i.useState(!1), t = X(O), v = `${t}-hint`, E = `${t}-error`, L = (r) => {
38
+ h ? h(typeof f == "number" ? Number(r) : r) : I(r);
39
39
  }, N = (r) => {
40
40
  k(r);
41
41
  }, j = (r) => {
42
- m && m(r), h || b("");
43
- }, S = o.useRef(null), W = () => {
44
- S.current.focus();
45
- }, x = o.useRef(null), C = `intersection-${t}`;
42
+ p && p(r), h || I("");
43
+ }, b = i.useRef(null), W = () => {
44
+ b.current.focus();
45
+ }, x = i.useRef(null), S = `intersection-${t}`;
46
46
  Y(x, (r) => {
47
- g && g(r);
47
+ u && u(r);
48
48
  }, {
49
- selectorToWatch: `#${C}`,
49
+ selectorToWatch: `#${S}`,
50
50
  skipWhen: !V
51
51
  });
52
- const n = (typeof p < "u" ? p.toString() : u) ?? "";
52
+ const n = (typeof f < "u" ? f.toString() : w) ?? "";
53
53
  return e(G, {
54
- hint: O,
54
+ hint: C,
55
55
  error: c,
56
56
  id: t,
57
- required: I,
58
- children: d(U, {
57
+ required: g,
58
+ children: a(U, {
59
59
  direction: "column",
60
60
  alignItems: "stretch",
61
61
  gap: 1,
62
62
  children: [e(J, {
63
63
  onClick: W,
64
- action: F,
65
- children: f
66
- }), d(H, {
64
+ action: B,
65
+ children: m
66
+ }), a(M, {
67
67
  onOpenChange: N,
68
- disabled: l,
69
- required: I,
68
+ disabled: d,
69
+ required: g,
70
70
  onValueChange: L,
71
71
  value: n,
72
- ...w,
73
- children: [e(M, {
74
- ref: S,
75
- "aria-label": f,
72
+ ...y,
73
+ children: [e(P, {
74
+ ref: b,
75
+ "aria-label": m,
76
76
  "aria-describedby": `${v} ${E}`,
77
77
  id: t,
78
- startIcon: $,
79
- size: y,
78
+ startIcon: T,
79
+ size: $,
80
80
  hasError: Boolean(c),
81
- disabled: l,
82
- clearLabel: i,
83
- onClear: n && m ? j : void 0,
84
- children: e(P, {
85
- placeholder: T,
81
+ disabled: d,
82
+ clearLabel: o,
83
+ onClear: n && p ? j : void 0,
84
+ children: e(_, {
85
+ placeholder: F,
86
86
  textColor: n ? "neutral800" : "neutral600",
87
- children: n ? s(n) : null
87
+ children: n && l ? l(n) : void 0
88
88
  })
89
- }), e(_, {
89
+ }), e(z, {
90
90
  children: e(A, {
91
91
  position: "popper",
92
92
  sideOffset: 4,
93
- children: d(D, {
93
+ children: a(D, {
94
94
  ref: x,
95
- children: [a, e(R, {
96
- id: C,
95
+ children: [s, e(R, {
96
+ id: S,
97
97
  width: "100%",
98
98
  height: "1px"
99
99
  })]
@@ -103,23 +103,23 @@ const Ie = ({
103
103
  }), e(K, {}), e(Q, {})]
104
104
  })
105
105
  });
106
- }, be = o.forwardRef(({
107
- value: a,
108
- startIcon: i,
109
- children: s,
110
- ...l
111
- }, c) => d(q, {
106
+ }, be = i.forwardRef(({
107
+ value: s,
108
+ startIcon: o,
109
+ children: l,
110
+ ...d
111
+ }, c) => a(q, {
112
112
  ref: c,
113
- value: a.toString(),
114
- ...l,
115
- children: [i && e(R, {
113
+ value: s.toString(),
114
+ ...d,
115
+ children: [o && e(R, {
116
116
  as: "span",
117
117
  "aria-hidden": !0,
118
- children: i
118
+ children: o
119
119
  }), e(Z, {
120
120
  textColor: "neutral800",
121
- children: e(z, {
122
- children: s
121
+ children: e(H, {
122
+ children: l
123
123
  })
124
124
  })]
125
125
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/design-system",
3
- "version": "1.7.0-alpha.4",
3
+ "version": "1.7.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -23,14 +23,14 @@
23
23
  "@internationalized/number": "^3.2.0",
24
24
  "@radix-ui/react-dropdown-menu": "^2.0.4",
25
25
  "@radix-ui/react-use-callback-ref": "^1.0.0",
26
- "@strapi/ui-primitives": "^1.7.0-alpha.4",
26
+ "@strapi/ui-primitives": "^1.7.0",
27
27
  "@uiw/react-codemirror": "^4.19.7",
28
28
  "compute-scroll-into-view": "^1.0.17",
29
29
  "prop-types": "^15.7.2"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@playwright/test": "1.27.1",
33
- "@strapi/icons": "^1.7.0-alpha.4",
33
+ "@strapi/icons": "^1.7.0",
34
34
  "@types/react-router-dom": "^5.3.3",
35
35
  "@types/styled-components": "^5.1.26",
36
36
  "axe-playwright": "^1.1.11",
@@ -65,5 +65,5 @@
65
65
  "@types/react": "17.0.2",
66
66
  "@types/react-dom": "17.0.2"
67
67
  },
68
- "gitHead": "1b57b2310cec4cc64f7a92a2e73eac6dfe1ab352"
68
+ "gitHead": "396ee39dddaa1a56571251403f0e87d03e08fd27"
69
69
  }