@strapi/design-system 1.8.0 → 1.8.1

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.
Files changed (57) hide show
  1. package/dist/Button/Button.cjs +2 -2
  2. package/dist/Button/Button.js +4 -4
  3. package/dist/Combobox/Combobox.cjs +3 -3
  4. package/dist/Combobox/Combobox.js +12 -12
  5. package/dist/DatePicker/DatePicker.cjs +14 -14
  6. package/dist/DatePicker/DatePicker.js +257 -224
  7. package/dist/DateTimePicker/DateTimePicker.cjs +3 -3
  8. package/dist/DateTimePicker/DateTimePicker.js +69 -63
  9. package/dist/Grid/Grid.cjs +3 -3
  10. package/dist/Grid/Grid.js +6 -3
  11. package/dist/MainNav/MainNav.cjs +2 -2
  12. package/dist/MainNav/MainNav.js +9 -31
  13. package/dist/MainNav/MainNavContext.cjs +1 -1
  14. package/dist/MainNav/MainNavContext.js +1 -1
  15. package/dist/MainNav/NavBrand.cjs +3 -3
  16. package/dist/MainNav/NavBrand.js +12 -38
  17. package/dist/MainNav/NavCondense.cjs +2 -2
  18. package/dist/MainNav/NavCondense.js +15 -23
  19. package/dist/MainNav/NavFooter.cjs +1 -1
  20. package/dist/MainNav/NavFooter.js +4 -10
  21. package/dist/MainNav/NavLink.cjs +9 -9
  22. package/dist/MainNav/NavLink.js +13 -35
  23. package/dist/MainNav/NavSection.cjs +1 -1
  24. package/dist/MainNav/NavSection.js +9 -43
  25. package/dist/MainNav/NavSections.cjs +2 -2
  26. package/dist/MainNav/NavSections.js +7 -21
  27. package/dist/MainNav/NavUser.cjs +2 -2
  28. package/dist/MainNav/NavUser.js +13 -27
  29. package/dist/SimpleMenu/SimpleMenu.cjs +9 -9
  30. package/dist/SimpleMenu/SimpleMenu.js +62 -151
  31. package/dist/SubNav/SubNav.cjs +5 -5
  32. package/dist/SubNav/SubNav.js +8 -13
  33. package/dist/SubNav/SubNavHeader.cjs +3 -3
  34. package/dist/SubNav/SubNavHeader.js +29 -76
  35. package/dist/SubNav/SubNavLink.cjs +13 -13
  36. package/dist/SubNav/SubNavLink.js +20 -52
  37. package/dist/SubNav/SubNavLinkSection.cjs +4 -4
  38. package/dist/SubNav/SubNavLinkSection.js +19 -35
  39. package/dist/SubNav/SubNavSection.cjs +2 -2
  40. package/dist/SubNav/SubNavSection.js +15 -55
  41. package/dist/SubNav/SubNavSectionLabel.cjs +3 -3
  42. package/dist/SubNav/SubNavSectionLabel.js +10 -38
  43. package/dist/SubNav/SubNavSections.cjs +1 -1
  44. package/dist/SubNav/SubNavSections.js +4 -18
  45. package/dist/v2/Breadcrumbs/Breadcrumbs.cjs +2 -2
  46. package/dist/v2/Breadcrumbs/Breadcrumbs.js +15 -23
  47. package/dist/v2/Breadcrumbs/Crumb.cjs +1 -1
  48. package/dist/v2/Breadcrumbs/Crumb.js +6 -25
  49. package/dist/v2/Breadcrumbs/CrumbLink.cjs +2 -2
  50. package/dist/v2/Breadcrumbs/CrumbLink.js +6 -15
  51. package/dist/v2/Breadcrumbs/CrumbSimpleMenu.cjs +4 -3
  52. package/dist/v2/Breadcrumbs/CrumbSimpleMenu.js +8 -14
  53. package/dist/v2/Breadcrumbs/Divider.cjs +1 -1
  54. package/dist/v2/Breadcrumbs/Divider.js +3 -4
  55. package/dist/v2/SimpleMenu/Menu.cjs +10 -10
  56. package/dist/v2/SimpleMenu/Menu.js +11 -11
  57. package/package.json +10 -10
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("react"),x=require("prop-types"),g=require("./MainNavContext.cjs"),h=require("../Divider/Divider.cjs"),i=require("../Flex/Flex.cjs"),l=require("../Box/Box.cjs"),m=require("../VisuallyHidden/VisuallyHidden.cjs"),j=require("../Typography/Typography.cjs"),q=n=>n&&n.__esModule?n:{default:n},u=q(x),p=({label:n,children:d,spacing:a=2,horizontal:r=!1,...c})=>g.useMainNav()?e.jsxs(i.Flex,{direction:"column",alignItems:"stretch",gap:2,children:[e.jsxs(l.Box,{paddingTop:1,paddingBottom:1,background:"neutral0",hasRadius:!0,as:"span",children:[e.jsx(h.Divider,{}),e.jsx(m.VisuallyHidden,{children:e.jsx("span",{children:n})})]}),e.jsx(i.Flex,{as:"ul",gap:a,direction:r?"row":"column",alignItems:r?"center":"stretch",...c,children:o.Children.map(d,(t,s)=>e.jsx("li",{children:t},s))})]}):e.jsxs(i.Flex,{direction:"column",alignItems:"stretch",gap:2,children:[e.jsx(l.Box,{paddingTop:1,paddingBottom:1,background:"neutral0",paddingRight:3,paddingLeft:3,hasRadius:!0,as:"span",children:e.jsx(j.Typography,{variant:"sigma",textColor:"neutral600",children:n})}),e.jsx(i.Flex,{as:"ul",gap:a,direction:r?"row":"column",alignItems:r?"center":"stretch",...c,children:o.Children.map(d,(t,s)=>e.jsx("li",{children:t},s))})]});p.propTypes={children:u.default.node.isRequired,label:u.default.string.isRequired};exports.NavSection=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),u=require("react"),x=require("./MainNavContext.cjs"),g=require("../Divider/Divider.cjs"),r=require("../Flex/Flex.cjs"),l=require("../Box/Box.cjs"),p=require("../VisuallyHidden/VisuallyHidden.cjs"),h=require("../Typography/Typography.cjs"),m=n=>n&&n.__esModule?n:{default:n},o=m(u),j=({label:n,children:a,spacing:d=2,horizontal:t=!1,...c})=>x.useMainNav()?e.jsxs(r.Flex,{direction:"column",alignItems:"stretch",gap:2,children:[e.jsxs(l.Box,{paddingTop:1,paddingBottom:1,background:"neutral0",hasRadius:!0,as:"span",children:[e.jsx(g.Divider,{}),e.jsx(p.VisuallyHidden,{children:e.jsx("span",{children:n})})]}),e.jsx(r.Flex,{as:"ul",gap:d,direction:t?"row":"column",alignItems:t?"center":"stretch",...c,children:o.default.Children.map(a,(i,s)=>e.jsx("li",{children:i},s))})]}):e.jsxs(r.Flex,{direction:"column",alignItems:"stretch",gap:2,children:[e.jsx(l.Box,{paddingTop:1,paddingBottom:1,background:"neutral0",paddingRight:3,paddingLeft:3,hasRadius:!0,as:"span",children:e.jsx(h.Typography,{variant:"sigma",textColor:"neutral600",children:n})}),e.jsx(r.Flex,{as:"ul",gap:d,direction:t?"row":"column",alignItems:t?"center":"stretch",...c,children:o.default.Children.map(a,(i,s)=>e.jsx("li",{children:i},s))})]});exports.NavSection=j;
@@ -1,46 +1,12 @@
1
1
  import { jsxs as d, jsx as r } from "react/jsx-runtime";
2
- import { Children as m } from "react";
3
- import p from "prop-types";
4
- import { useMainNav as u } from "./MainNavContext.js";
5
- import { Divider as g } from "../Divider/Divider.js";
6
- import { Flex as i } from "../Flex/Flex.js";
7
- import { Box as l } from "../Box/Box.js";
8
- import { VisuallyHidden as h } from "../VisuallyHidden/VisuallyHidden.js";
9
- import { Typography as f } from "../Typography/Typography.js";
10
- const x = ({ label: o, children: a, spacing: s = 2, horizontal: e = !1, ...c }) => u() ? /* @__PURE__ */ d(i, { direction: "column", alignItems: "stretch", gap: 2, children: [
11
- /* @__PURE__ */ d(l, { paddingTop: 1, paddingBottom: 1, background: "neutral0", hasRadius: !0, as: "span", children: [
12
- /* @__PURE__ */ r(g, {}),
13
- /* @__PURE__ */ r(h, { children: /* @__PURE__ */ r("span", { children: o }) })
14
- ] }),
15
- /* @__PURE__ */ r(
16
- i,
17
- {
18
- as: "ul",
19
- gap: s,
20
- direction: e ? "row" : "column",
21
- alignItems: e ? "center" : "stretch",
22
- ...c,
23
- children: m.map(a, (n, t) => /* @__PURE__ */ r("li", { children: n }, t))
24
- }
25
- )
26
- ] }) : /* @__PURE__ */ d(i, { direction: "column", alignItems: "stretch", gap: 2, children: [
27
- /* @__PURE__ */ r(l, { paddingTop: 1, paddingBottom: 1, background: "neutral0", paddingRight: 3, paddingLeft: 3, hasRadius: !0, as: "span", children: /* @__PURE__ */ r(f, { variant: "sigma", textColor: "neutral600", children: o }) }),
28
- /* @__PURE__ */ r(
29
- i,
30
- {
31
- as: "ul",
32
- gap: s,
33
- direction: e ? "row" : "column",
34
- alignItems: e ? "center" : "stretch",
35
- ...c,
36
- children: m.map(a, (n, t) => /* @__PURE__ */ r("li", { children: n }, t))
37
- }
38
- )
39
- ] });
40
- x.propTypes = {
41
- children: p.node.isRequired,
42
- label: p.string.isRequired
43
- };
2
+ import l from "react";
3
+ import { useMainNav as p } from "./MainNavContext.js";
4
+ import { Divider as u } from "../Divider/Divider.js";
5
+ import { Flex as n } from "../Flex/Flex.js";
6
+ import { Box as s } from "../Box/Box.js";
7
+ import { VisuallyHidden as g } from "../VisuallyHidden/VisuallyHidden.js";
8
+ import { Typography as h } from "../Typography/Typography.js";
9
+ const j = ({ label: a, children: o, spacing: c = 2, horizontal: e = !1, ...m }) => p() ? d(n, { direction: "column", alignItems: "stretch", gap: 2, children: [d(s, { paddingTop: 1, paddingBottom: 1, background: "neutral0", hasRadius: !0, as: "span", children: [r(u, {}), r(g, { children: r("span", { children: a }) })] }), r(n, { as: "ul", gap: c, direction: e ? "row" : "column", alignItems: e ? "center" : "stretch", ...m, children: l.Children.map(o, (i, t) => r("li", { children: i }, t)) })] }) : d(n, { direction: "column", alignItems: "stretch", gap: 2, children: [r(s, { paddingTop: 1, paddingBottom: 1, background: "neutral0", paddingRight: 3, paddingLeft: 3, hasRadius: !0, as: "span", children: r(h, { variant: "sigma", textColor: "neutral600", children: a }) }), r(n, { as: "ul", gap: c, direction: e ? "row" : "column", alignItems: e ? "center" : "stretch", ...m, children: l.Children.map(o, (i, t) => r("li", { children: i }, t)) })] });
44
10
  export {
45
- x as NavSection
11
+ j as NavSection
46
12
  };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),c=require("react"),u=require("prop-types"),a=require("styled-components"),p=require("../Box/Box.cjs"),f=require("../Flex/Flex.cjs"),o=e=>e&&e.__esModule?e:{default:e},g=o(u),x=o(a),y=x.default(p.Box)`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),c=require("react"),d=require("styled-components"),a=require("../Box/Box.cjs"),u=require("../Flex/Flex.cjs"),n=e=>e&&e.__esModule?e:{default:e},f=n(c),g=n(d),x=g.default(a.Box)`
2
2
  flex-grow: 1;
3
3
  overflow-y: auto;
4
- `,n=({children:e,spacing:s=4,horizontal:r=!1,...i})=>t.jsx(y,{paddingLeft:3,paddingRight:2,paddingTop:3,paddingBottom:8,children:t.jsx(f.Flex,{as:"ul",gap:s,direction:r?"row":"column",alignItems:r?"center":"stretch",...i,children:c.Children.map(e,(d,l)=>t.jsx("li",{children:d},l))})});n.propTypes={children:g.default.node.isRequired};exports.NavSections=n;
4
+ `,p=({children:e,spacing:r=4,horizontal:o=!1,...s})=>t.jsx(x,{paddingLeft:3,paddingRight:2,paddingTop:3,paddingBottom:8,children:t.jsx(u.Flex,{as:"ul",gap:r,direction:o?"row":"column",alignItems:o?"center":"stretch",...s,children:f.default.Children.map(e,(i,l)=>t.jsx("li",{children:i},l))})});exports.NavSections=p;
@@ -1,26 +1,12 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import { Children as d } from "react";
3
- import m from "prop-types";
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import m from "react";
4
3
  import l from "styled-components";
5
- import { Box as s } from "../Box/Box.js";
6
- import { Flex as c } from "../Flex/Flex.js";
7
- const a = l(s)`
4
+ import { Box as p } from "../Box/Box.js";
5
+ import { Flex as a } from "../Flex/Flex.js";
6
+ const c = l(p)`
8
7
  flex-grow: 1;
9
8
  overflow-y: auto;
10
- `, f = ({ children: e, spacing: i = 4, horizontal: o = !1, ...t }) => /* @__PURE__ */ r(a, { paddingLeft: 3, paddingRight: 2, paddingTop: 3, paddingBottom: 8, children: /* @__PURE__ */ r(
11
- c,
12
- {
13
- as: "ul",
14
- gap: i,
15
- direction: o ? "row" : "column",
16
- alignItems: o ? "center" : "stretch",
17
- ...t,
18
- children: d.map(e, (p, n) => /* @__PURE__ */ r("li", { children: p }, n))
19
- }
20
- ) });
21
- f.propTypes = {
22
- children: m.node.isRequired
23
- };
9
+ `, h = ({ children: t, spacing: e = 4, horizontal: r = !1, ...i }) => o(c, { paddingLeft: 3, paddingRight: 2, paddingTop: 3, paddingBottom: 8, children: o(a, { as: "ul", gap: e, direction: r ? "row" : "column", alignItems: r ? "center" : "stretch", ...i, children: m.Children.map(t, (n, d) => o("li", { children: n }, d)) }) });
24
10
  export {
25
- f as NavSections
11
+ h as NavSections
26
12
  };
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),p=require("react"),x=require("prop-types"),f=require("styled-components"),y=require("./MainNavContext.cjs"),a=require("../Avatar/Avatar.cjs"),d=require("../Box/Box.cjs"),v=require("../Flex/Flex.cjs"),g=require("../VisuallyHidden/VisuallyHidden.cjs"),j=require("../Typography/Typography.cjs"),i=e=>e&&e.__esModule?e:{default:e},q=i(p),s=i(x),h=i(f),_=h.default(d.Box)`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),u=require("react"),c=require("styled-components"),x=require("./MainNavContext.cjs"),s=require("../Avatar/Avatar.cjs"),i=require("../Box/Box.cjs"),p=require("../Flex/Flex.cjs"),f=require("../VisuallyHidden/VisuallyHidden.cjs"),h=require("../Typography/Typography.cjs"),o=e=>e&&e.__esModule?e:{default:e},j=o(u),y=o(c),g=y.default(i.Box)`
2
2
  border-top: 1px solid ${({theme:e})=>e.colors.neutral150};
3
- `,r=q.default.forwardRef(({src:e,children:n,initials:l,...u},c)=>{const o=y.useMainNav();return t.jsx(_,{paddingTop:3,paddingBottom:3,paddingLeft:5,paddingRight:5,...u,children:t.jsxs(v.Flex,{as:"button",justifyContent:o?"center":void 0,ref:c,children:[e?t.jsx(a.Avatar,{src:e,alt:"","aria-hidden":!0}):t.jsx(a.Initials,{children:l}),o?t.jsx(g.VisuallyHidden,{children:t.jsx("span",{children:n})}):t.jsx(d.Box,{width:`${130/16}rem`,paddingLeft:2,as:"span",children:t.jsx(j.Typography,{ellipsis:!0,textColor:"neutral600",children:n})})]})})});r.displayName="NavUser";r.defaultProps={src:void 0,initials:void 0};r.propTypes={children:s.default.node.isRequired,initials:s.default.node,src:s.default.string};exports.NavUser=r;
3
+ `,q=j.default.forwardRef(({src:e,children:r,initials:a,...d},l)=>{const n=x.useMainNav();return t.jsx(g,{paddingTop:3,paddingBottom:3,paddingLeft:5,paddingRight:5,...d,children:t.jsxs(p.Flex,{as:"button",justifyContent:n?"center":void 0,ref:l,children:[e?t.jsx(s.Avatar,{src:e,alt:"","aria-hidden":!0}):t.jsx(s.Initials,{children:a}),n?t.jsx(f.VisuallyHidden,{children:t.jsx("span",{children:r})}):t.jsx(i.Box,{width:`${130/16}rem`,paddingLeft:2,as:"span",children:t.jsx(h.Typography,{ellipsis:!0,textColor:"neutral600",children:r})})]})})});exports.NavUser=q;
@@ -1,32 +1,18 @@
1
- import { jsx as r, jsxs as l } from "react/jsx-runtime";
2
- import m from "react";
3
- import i from "prop-types";
4
- import f from "styled-components";
5
- import { useMainNav as c } from "./MainNavContext.js";
6
- import { Avatar as u, Initials as h } from "../Avatar/Avatar.js";
7
- import { Box as n } from "../Box/Box.js";
8
- import { Flex as g } from "../Flex/Flex.js";
9
- import { VisuallyHidden as v } from "../VisuallyHidden/VisuallyHidden.js";
1
+ import { jsx as r, jsxs as p } from "react/jsx-runtime";
2
+ import s from "react";
3
+ import l from "styled-components";
4
+ import { useMainNav as m } from "./MainNavContext.js";
5
+ import { Avatar as f, Initials as c } from "../Avatar/Avatar.js";
6
+ import { Box as i } from "../Box/Box.js";
7
+ import { Flex as u } from "../Flex/Flex.js";
8
+ import { VisuallyHidden as h } from "../VisuallyHidden/VisuallyHidden.js";
10
9
  import { Typography as x } from "../Typography/Typography.js";
11
- const y = f(n)`
10
+ const g = l(i)`
12
11
  border-top: 1px solid ${({ theme: o }) => o.colors.neutral150};
13
- `, t = m.forwardRef(({ src: o, children: e, initials: a, ...s }, p) => {
14
- const d = c();
15
- return /* @__PURE__ */ r(y, { paddingTop: 3, paddingBottom: 3, paddingLeft: 5, paddingRight: 5, ...s, children: /* @__PURE__ */ l(g, { as: "button", justifyContent: d ? "center" : void 0, ref: p, children: [
16
- o ? /* @__PURE__ */ r(u, { src: o, alt: "", "aria-hidden": !0 }) : /* @__PURE__ */ r(h, { children: a }),
17
- d ? /* @__PURE__ */ r(v, { children: /* @__PURE__ */ r("span", { children: e }) }) : /* @__PURE__ */ r(n, { width: `${130 / 16}rem`, paddingLeft: 2, as: "span", children: /* @__PURE__ */ r(x, { ellipsis: !0, textColor: "neutral600", children: e }) })
18
- ] }) });
12
+ `, L = s.forwardRef(({ src: o, children: t, initials: n, ...d }, a) => {
13
+ const e = m();
14
+ return r(g, { paddingTop: 3, paddingBottom: 3, paddingLeft: 5, paddingRight: 5, ...d, children: p(u, { as: "button", justifyContent: e ? "center" : void 0, ref: a, children: [o ? r(f, { src: o, alt: "", "aria-hidden": !0 }) : r(c, { children: n }), e ? r(h, { children: r("span", { children: t }) }) : r(i, { width: `${130 / 16}rem`, paddingLeft: 2, as: "span", children: r(x, { ellipsis: !0, textColor: "neutral600", children: t }) })] }) });
19
15
  });
20
- t.displayName = "NavUser";
21
- t.defaultProps = {
22
- src: void 0,
23
- initials: void 0
24
- };
25
- t.propTypes = {
26
- children: i.node.isRequired,
27
- initials: i.node,
28
- src: i.string
29
- };
30
16
  export {
31
- t as NavUser
17
+ L as NavUser
32
18
  };
@@ -1,13 +1,13 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),r=require("react"),H=require("@strapi/icons"),M=require("@strapi/ui-primitives"),U=require("prop-types"),G=require("react-router-dom"),J=require("styled-components"),C=require("./utils.cjs"),i=require("../helpers/keyboardKeys.cjs"),Q=require("../hooks/useId.cjs"),X=require("../Link/Link.cjs"),w=require("../Button/Button.cjs"),_=require("../Popover/Popover.cjs"),b=require("../Box/Box.cjs"),q=require("../Typography/Typography.cjs"),Y=require("../Flex/Flex.cjs"),O=e=>e&&e.__esModule?e:{default:e},B=O(r),n=O(U),h=O(J),Z=h.default.button`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),r=require("react"),N=require("@strapi/icons"),C=require("@strapi/ui-primitives"),F=require("react-router-dom"),W=require("styled-components"),R=require("./utils.cjs"),s=require("../helpers/keyboardKeys.cjs"),H=require("../hooks/useId.cjs"),U=require("../Link/Link.cjs"),M=require("../Button/Button.cjs"),z=require("../Popover/Popover.cjs"),E=require("../Box/Box.cjs"),D=require("../Typography/Typography.cjs"),G=require("../Flex/Flex.cjs"),w=e=>e&&e.__esModule?e:{default:e},K=w(r),m=w(W),J=m.default.button`
2
2
  border: none;
3
3
  padding: 0;
4
4
  background: transparent;
5
5
  cursor: pointer;
6
- ${C.getOptionStyle}
7
- `,ee=h.default(G.NavLink)`
6
+ ${R.getOptionStyle}
7
+ `,Q=m.default(F.NavLink)`
8
8
  text-decoration: none;
9
- ${C.getOptionStyle}
10
- `,ne=h.default(X.Link)`
9
+ ${R.getOptionStyle}
10
+ `,X=m.default(U.Link)`
11
11
  /* Removing Link hover effect */
12
12
  &:hover {
13
13
  color: currentColor;
@@ -22,14 +22,14 @@
22
22
  }
23
23
  }
24
24
 
25
- ${C.getOptionStyle}
26
- `,te=h.default.span`
25
+ ${R.getOptionStyle}
26
+ `,Y=m.default.span`
27
27
  display: flex;
28
28
  align-items: center;
29
29
  svg {
30
30
  height: 4px;
31
31
  width: 6px;
32
32
  }
33
- `,oe=h.default(w.Button)`
33
+ `,Z=m.default(M.Button)`
34
34
  padding: ${({theme:e})=>`${e.spaces[1]} ${e.spaces[3]}`};
35
- `,S=({children:e,onClick:g,to:u,isFocused:a,href:d,...R})=>{const l=r.useRef();r.useEffect(()=>{a&&l.current&&l.current.focus()},[a]);const c={tabIndex:a?0:-1,ref:l,role:"menuitem",...R},f=v=>{(v.key===i.KeyboardKeys.SPACE||v.key===i.KeyboardKeys.ENTER)&&g()};return u&&!d?o.jsx(ee,{to:u,...c,children:o.jsx(b.Box,{padding:2,children:o.jsx(q.Typography,{children:e})})}):d&&!u?o.jsx(ne,{isExternal:!0,href:d,...c,children:o.jsx(b.Box,{padding:2,children:o.jsx(q.Typography,{children:e})})}):o.jsx(Z,{onKeyDown:f,onMouseDown:g,type:"button",...c,children:o.jsx(b.Box,{padding:2,children:o.jsx(q.Typography,{children:e})})})};S.defaultProps={as:void 0,href:void 0,isFocused:!1,onClick(){},to:void 0};S.propTypes={as:n.default.elementType,children:n.default.node.isRequired,href:n.default.string,isFocused:n.default.bool,onClick:n.default.func,to:n.default.string};const x=({label:e,children:g,id:u,as:a,onOpen:d=()=>{},onClose:R=()=>{},size:l,popoverPlacement:c,onReachEnd:f,...v})=>{const p=r.useRef(),k=Q.useId(u),K=r.useRef(!1),[y,m]=r.useState(!1),[P,j]=r.useState(0),E=r.Children.toArray(g),L=l==="S"?oe:w.Button,$=a||L,T=!!f&&typeof f=="function";r.useEffect(()=>{if(["string","number"].includes(typeof e)){const t=E.findIndex(s=>s.props.children===e);t!==-1&&j(t)}},[e]);const I=M.useCallbackRef(d),D=M.useCallbackRef(R);r.useEffect(()=>{K?.current?y?I():D():K.current=!0},[K,D,I,y]),r.useEffect(()=>{B.default.isValidElement(e)&&P===-1&&p.current.focus()},[e,P]);const A=t=>{y&&(t.key===i.KeyboardKeys.ESCAPE&&(t.stopPropagation(),m(!1),p.current.focus()),t.key===i.KeyboardKeys.DOWN&&j(s=>s===E.length-1?0:s+1),t.key===i.KeyboardKeys.UP&&j(s=>s===0?E.length-1:s-1))},N=t=>{(t.key===i.KeyboardKeys.ENTER||t.key===i.KeyboardKeys.SPACE)&&m(s=>!s)},F=t=>{t.preventDefault(),t.currentTarget.contains(t.relatedTarget)||m(!1)},V=t=>{t.preventDefault(),m(s=>!s)},W=()=>{T&&f()},z=E.map((t,s)=>o.jsx(Y.Flex,{as:"li",justifyContent:"center",role:"menuitem",children:r.cloneElement(t,{onClick(){t.props.onClick(),m(!1),p.current.focus()},isFocused:P===s})},s));return o.jsxs("div",{onKeyDown:A,children:[o.jsx($,{label:B.default.isValidElement(e)?null:e,"aria-haspopup":!0,"aria-expanded":y,"aria-controls":k,onKeyDown:N,onMouseDown:V,ref:p,type:"button",variant:"ghost",endIcon:o.jsx(te,{children:o.jsx(H.CarretDown,{"aria-hidden":!0})}),...v,children:e}),y&&o.jsx(_.Popover,{onBlur:F,placement:c,source:p,onReachEnd:W,intersectionId:T?`popover-${k}`:void 0,spacing:4,children:o.jsx(b.Box,{role:"menu",as:"ul",padding:1,id:k,children:z})})]})};x.defaultProps={as:void 0};x.displayName="SimpleMenu";x.defaultProps={id:void 0,onOpen:void 0,onClose:void 0,onReachEnd:void 0,popoverPlacement:"bottom-start",size:"M"};x.propTypes={as:n.default.any,children:n.default.oneOfType([n.default.arrayOf(n.default.node),n.default.node]).isRequired,id:n.default.string,label:n.default.oneOfType([n.default.string,n.default.number,n.default.element]).isRequired,onClose:n.default.func,onOpen:n.default.func,onReachEnd:n.default.func,popoverPlacement:n.default.oneOf(_.POPOVER_PLACEMENTS),size:n.default.oneOf(["S","M"])};exports.MenuItem=S;exports.SimpleMenu=x;
35
+ `,ee=({children:e,onClick:h=()=>{},to:i,isFocused:u=!1,href:c,...j})=>{const a=r.useRef();r.useEffect(()=>{u&&a.current&&a.current.focus()},[u]);const l={tabIndex:u?0:-1,ref:a,role:"menuitem",...j},d=x=>{(x.key===s.KeyboardKeys.SPACE||x.key===s.KeyboardKeys.ENTER)&&h()};return i&&!c?o.jsx(Q,{to:i,...l,children:o.jsx(E.Box,{padding:2,children:o.jsx(D.Typography,{children:e})})}):c&&!i?o.jsx(X,{isExternal:!0,href:c,...l,children:o.jsx(E.Box,{padding:2,children:o.jsx(D.Typography,{children:e})})}):o.jsx(J,{onKeyDown:d,onMouseDown:h,type:"button",...l,children:o.jsx(E.Box,{padding:2,children:o.jsx(D.Typography,{children:e})})})},ne=({label:e,children:h,id:i,as:u,onOpen:c=()=>{},onClose:j=()=>{},size:a="M",popoverPlacement:l="bottom-start",onReachEnd:d,...x})=>{const f=r.useRef(void 0),k=H.useId(i),b=r.useRef(!1),[p,y]=r.useState(!1),[I,v]=r.useState(0),g=r.Children.toArray(h),P=a==="S"?Z:M.Button,T=u||P,q=!!d&&typeof d=="function";r.useEffect(()=>{if(["string","number"].includes(typeof e)){const n=g.findIndex(t=>K.default.isValidElement(t)&&t.props.children===e||t===e);n!==-1&&v(n)}},[e]);const S=C.useCallbackRef(c),B=C.useCallbackRef(j);r.useEffect(()=>{b?.current?p?S():B():b.current=!0},[b,B,S,p]),r.useEffect(()=>{K.default.isValidElement(e)&&I===-1&&f.current.focus()},[e,I]);const O=n=>{p&&(n.key===s.KeyboardKeys.ESCAPE&&(n.stopPropagation(),y(!1),f.current.focus()),n.key===s.KeyboardKeys.DOWN&&v(t=>t===g.length-1?0:t+1),n.key===s.KeyboardKeys.UP&&v(t=>t===0?g.length-1:t-1))},$=n=>{(n.key===s.KeyboardKeys.ENTER||n.key===s.KeyboardKeys.SPACE)&&y(t=>!t)},L=n=>{n.preventDefault(),n.currentTarget.contains(n.relatedTarget)||y(!1)},_=n=>{n.preventDefault(),y(t=>!t)},A=()=>{q&&d()},V=g.map((n,t)=>o.jsx(G.Flex,{as:"li",justifyContent:"center",role:"menuitem",children:K.default.isValidElement(n)?r.cloneElement(n,{onClick(){n.props.onClick(),y(!1),f.current.focus()},isFocused:I===t}):n},t));return o.jsxs("div",{onKeyDown:O,children:[o.jsx(T,{label:K.default.isValidElement(e)?null:e,"aria-haspopup":!0,"aria-expanded":p,"aria-controls":k,onKeyDown:$,onMouseDown:_,ref:f,type:"button",variant:"ghost",endIcon:o.jsx(Y,{children:o.jsx(N.CarretDown,{"aria-hidden":!0})}),...x,children:e}),p&&o.jsx(z.Popover,{onBlur:L,placement:l,source:f,onReachEnd:A,intersectionId:q?`popover-${k}`:void 0,spacing:4,children:o.jsx(E.Box,{role:"menu",as:"ul",padding:1,id:k,children:V})})]})};exports.MenuItem=ee;exports.SimpleMenu=ne;
@@ -1,29 +1,28 @@
1
- import { jsx as t, jsxs as z } from "react/jsx-runtime";
2
- import B, { useRef as T, useEffect as E, useState as K, Children as H, cloneElement as U } from "react";
3
- import { CarretDown as G } from "@strapi/icons";
4
- import { useCallbackRef as $ } from "@strapi/ui-primitives";
5
- import e from "prop-types";
6
- import { NavLink as J } from "react-router-dom";
7
- import y from "styled-components";
1
+ import { jsx as t, jsxs as F } from "react/jsx-runtime";
2
+ import x, { useRef as S, useEffect as E, useState as $, Children as _, cloneElement as H } from "react";
3
+ import { CarretDown as U } from "@strapi/icons";
4
+ import { useCallbackRef as P } from "@strapi/ui-primitives";
5
+ import { NavLink as q } from "react-router-dom";
6
+ import m from "styled-components";
8
7
  import { getOptionStyle as b } from "./utils.js";
9
- import { KeyboardKeys as i } from "../helpers/keyboardKeys.js";
10
- import { useId as Q } from "../hooks/useId.js";
11
- import { Link as X } from "../Link/Link.js";
8
+ import { KeyboardKeys as r } from "../helpers/keyboardKeys.js";
9
+ import { useId as z } from "../hooks/useId.js";
10
+ import { Link as G } from "../Link/Link.js";
12
11
  import { Button as L } from "../Button/Button.js";
13
- import { POPOVER_PLACEMENTS as Y, Popover as Z } from "../Popover/Popover.js";
14
- import { Box as C } from "../Box/Box.js";
15
- import { Typography as O } from "../Typography/Typography.js";
16
- import { Flex as ee } from "../Flex/Flex.js";
17
- const ne = y.button`
12
+ import { Popover as J } from "../Popover/Popover.js";
13
+ import { Box as k } from "../Box/Box.js";
14
+ import { Typography as R } from "../Typography/Typography.js";
15
+ import { Flex as Q } from "../Flex/Flex.js";
16
+ const X = m.button`
18
17
  border: none;
19
18
  padding: 0;
20
19
  background: transparent;
21
20
  cursor: pointer;
22
21
  ${b}
23
- `, oe = y(J)`
22
+ `, Y = m(q)`
24
23
  text-decoration: none;
25
24
  ${b}
26
- `, te = y(X)`
25
+ `, Z = m(G)`
27
26
  /* Removing Link hover effect */
28
27
  &:hover {
29
28
  color: currentColor;
@@ -31,7 +30,7 @@ const ne = y.button`
31
30
 
32
31
  &:focus-visible {
33
32
  /* Removing Link focus-visible after properties and reset to global outline */
34
- outline: 2px solid ${({ theme: o }) => o.colors.primary600};
33
+ outline: 2px solid ${({ theme: n }) => n.colors.primary600};
35
34
  outline-offset: 2px;
36
35
  &:after {
37
36
  content: none;
@@ -39,160 +38,72 @@ const ne = y.button`
39
38
  }
40
39
 
41
40
  ${b}
42
- `, re = y.span`
41
+ `, ee = m.span`
43
42
  display: flex;
44
43
  align-items: center;
45
44
  svg {
46
45
  height: 4px;
47
46
  width: 6px;
48
47
  }
49
- `, ie = y(L)`
50
- padding: ${({ theme: o }) => `${o.spaces[1]} ${o.spaces[3]}`};
51
- `, A = ({ children: o, onClick: h, to: s, isFocused: c, href: a, ...x }) => {
52
- const d = T();
48
+ `, ne = m(L)`
49
+ padding: ${({ theme: n }) => `${n.spaces[1]} ${n.spaces[3]}`};
50
+ `, xe = ({ children: n, onClick: h = () => {
51
+ }, to: i, isFocused: s = !1, href: c, ...D }) => {
52
+ const a = S();
53
53
  E(() => {
54
- c && d.current && d.current.focus();
55
- }, [c]);
54
+ s && a.current && a.current.focus();
55
+ }, [s]);
56
56
  const l = {
57
- tabIndex: c ? 0 : -1,
58
- ref: d,
57
+ tabIndex: s ? 0 : -1,
58
+ ref: a,
59
59
  role: "menuitem",
60
- ...x
61
- }, p = (g) => {
62
- (g.key === i.SPACE || g.key === i.ENTER) && h();
60
+ ...D
61
+ }, u = (y) => {
62
+ (y.key === r.SPACE || y.key === r.ENTER) && h();
63
63
  };
64
- return s && !a ? /* @__PURE__ */ t(oe, { to: s, ...l, children: /* @__PURE__ */ t(C, { padding: 2, children: /* @__PURE__ */ t(O, { children: o }) }) }) : a && !s ? /* @__PURE__ */ t(te, { isExternal: !0, href: a, ...l, children: /* @__PURE__ */ t(C, { padding: 2, children: /* @__PURE__ */ t(O, { children: o }) }) }) : /* @__PURE__ */ t(ne, { onKeyDown: p, onMouseDown: h, type: "button", ...l, children: /* @__PURE__ */ t(C, { padding: 2, children: /* @__PURE__ */ t(O, { children: o }) }) });
65
- };
66
- A.defaultProps = {
67
- as: void 0,
68
- href: void 0,
69
- isFocused: !1,
70
- onClick() {
71
- },
72
- to: void 0
73
- };
74
- A.propTypes = {
75
- as: e.elementType,
76
- children: e.node.isRequired,
77
- href: e.string,
78
- isFocused: e.bool,
79
- onClick: e.func,
80
- to: e.string
81
- };
82
- const k = ({
83
- label: o,
84
- children: h,
85
- id: s,
86
- as: c,
87
- onOpen: a = () => {
88
- },
89
- onClose: x = () => {
90
- },
91
- size: d,
92
- popoverPlacement: l,
93
- onReachEnd: p,
94
- ...g
95
- }) => {
96
- const u = T(), P = Q(s), R = T(!1), [f, m] = K(!1), [D, I] = K(0), v = H.toArray(h), N = c || (d === "S" ? ie : L), S = !!p && typeof p == "function";
64
+ return i && !c ? t(Y, { to: i, ...l, children: t(k, { padding: 2, children: t(R, { children: n }) }) }) : c && !i ? t(Z, { isExternal: !0, href: c, ...l, children: t(k, { padding: 2, children: t(R, { children: n }) }) }) : t(X, { onKeyDown: u, onMouseDown: h, type: "button", ...l, children: t(k, { padding: 2, children: t(R, { children: n }) }) });
65
+ }, Ee = ({ label: n, children: h, id: i, as: s, onOpen: c = () => {
66
+ }, onClose: D = () => {
67
+ }, size: a = "M", popoverPlacement: l = "bottom-start", onReachEnd: u, ...y }) => {
68
+ const d = S(void 0), I = z(i), C = S(!1), [f, p] = $(!1), [v, w] = $(0), g = _.toArray(h), O = s || (a === "S" ? ne : L), B = !!u && typeof u == "function";
97
69
  E(() => {
98
- if (["string", "number"].includes(typeof o)) {
99
- const n = v.findIndex((r) => r.props.children === o);
100
- n !== -1 && I(n);
70
+ if (["string", "number"].includes(typeof n)) {
71
+ const e = g.findIndex((o) => x.isValidElement(o) && o.props.children === n || o === n);
72
+ e !== -1 && w(e);
101
73
  }
102
- }, [o]);
103
- const w = $(a), M = $(x);
74
+ }, [n]);
75
+ const K = P(c), M = P(D);
104
76
  E(() => {
105
- R?.current ? f ? w() : M() : R.current = !0;
106
- }, [R, M, w, f]), E(() => {
107
- B.isValidElement(o) && D === -1 && u.current.focus();
108
- }, [o, D]);
109
- const F = (n) => {
110
- f && (n.key === i.ESCAPE && (n.stopPropagation(), m(!1), u.current.focus()), n.key === i.DOWN && I((r) => r === v.length - 1 ? 0 : r + 1), n.key === i.UP && I((r) => r === 0 ? v.length - 1 : r - 1));
111
- }, V = (n) => {
112
- (n.key === i.ENTER || n.key === i.SPACE) && m((r) => !r);
113
- }, j = (n) => {
114
- n.preventDefault(), n.currentTarget.contains(n.relatedTarget) || m(!1);
115
- }, q = (n) => {
116
- n.preventDefault(), m((r) => !r);
117
- }, W = () => {
118
- S && p();
119
- }, _ = v.map((n, r) => (
77
+ C?.current ? f ? K() : M() : C.current = !0;
78
+ }, [C, M, K, f]), E(() => {
79
+ x.isValidElement(n) && v === -1 && d.current.focus();
80
+ }, [n, v]);
81
+ const T = (e) => {
82
+ f && (e.key === r.ESCAPE && (e.stopPropagation(), p(!1), d.current.focus()), e.key === r.DOWN && w((o) => o === g.length - 1 ? 0 : o + 1), e.key === r.UP && w((o) => o === 0 ? g.length - 1 : o - 1));
83
+ }, A = (e) => {
84
+ (e.key === r.ENTER || e.key === r.SPACE) && p((o) => !o);
85
+ }, V = (e) => {
86
+ e.preventDefault(), e.currentTarget.contains(e.relatedTarget) || p(!1);
87
+ }, N = (e) => {
88
+ e.preventDefault(), p((o) => !o);
89
+ }, j = () => {
90
+ B && u();
91
+ }, W = g.map((e, o) => (
120
92
  // eslint-disable-next-line react/no-array-index-key
121
- /* @__PURE__ */ t(ee, { as: "li", justifyContent: "center", role: "menuitem", children: U(n, {
93
+ t(Q, { as: "li", justifyContent: "center", role: "menuitem", children: x.isValidElement(e) ? H(e, {
122
94
  onClick() {
123
- n.props.onClick(), m(!1), u.current.focus();
95
+ e.props.onClick(), p(!1), d.current.focus();
124
96
  },
125
- isFocused: D === r
126
- }) }, r)
97
+ isFocused: v === o
98
+ }) : e }, o)
127
99
  ));
128
100
  return (
129
101
  // TODO: review why we need to eslint it and how to solve this issue.
130
102
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions
131
- /* @__PURE__ */ z("div", { onKeyDown: F, children: [
132
- /* @__PURE__ */ t(
133
- N,
134
- {
135
- label: B.isValidElement(o) ? null : o,
136
- "aria-haspopup": !0,
137
- "aria-expanded": f,
138
- "aria-controls": P,
139
- onKeyDown: V,
140
- onMouseDown: q,
141
- ref: u,
142
- type: "button",
143
- variant: "ghost",
144
- endIcon: /* @__PURE__ */ t(re, { children: /* @__PURE__ */ t(G, { "aria-hidden": !0 }) }),
145
- ...g,
146
- children: o
147
- }
148
- ),
149
- f && /* @__PURE__ */ t(
150
- Z,
151
- {
152
- onBlur: j,
153
- placement: l,
154
- source: u,
155
- onReachEnd: W,
156
- intersectionId: S ? `popover-${P}` : void 0,
157
- spacing: 4,
158
- children: /* @__PURE__ */ t(C, { role: "menu", as: "ul", padding: 1, id: P, children: _ })
159
- }
160
- )
161
- ] })
103
+ F("div", { onKeyDown: T, children: [t(O, { label: x.isValidElement(n) ? null : n, "aria-haspopup": !0, "aria-expanded": f, "aria-controls": I, onKeyDown: A, onMouseDown: N, ref: d, type: "button", variant: "ghost", endIcon: t(ee, { children: t(U, { "aria-hidden": !0 }) }), ...y, children: n }), f && t(J, { onBlur: V, placement: l, source: d, onReachEnd: j, intersectionId: B ? `popover-${I}` : void 0, spacing: 4, children: t(k, { role: "menu", as: "ul", padding: 1, id: I, children: W }) })] })
162
104
  );
163
105
  };
164
- k.defaultProps = {
165
- as: void 0
166
- };
167
- k.displayName = "SimpleMenu";
168
- k.defaultProps = {
169
- id: void 0,
170
- onOpen: void 0,
171
- onClose: void 0,
172
- onReachEnd: void 0,
173
- popoverPlacement: "bottom-start",
174
- size: "M"
175
- };
176
- k.propTypes = {
177
- as: e.any,
178
- children: e.oneOfType([e.arrayOf(e.node), e.node]).isRequired,
179
- id: e.string,
180
- label: e.oneOfType([e.string, e.number, e.element]).isRequired,
181
- onClose: e.func,
182
- onOpen: e.func,
183
- /**
184
- * Callback function to be called when the popover reaches the end of the scrollable content
185
- */
186
- onReachEnd: e.func,
187
- popoverPlacement: e.oneOf(Y),
188
- /**
189
- * Size of the trigger button.
190
- * Note: in case a custom component is passed through the "as"
191
- * prop, the size prop is passed along too, but needs to be handled there
192
- */
193
- size: e.oneOf(["S", "M"])
194
- };
195
106
  export {
196
- A as MenuItem,
197
- k as SimpleMenu
107
+ xe as MenuItem,
108
+ Ee as SimpleMenu
198
109
  };
@@ -1,10 +1,10 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime");require("react");const u=require("prop-types"),a=require("styled-components"),n=require("../Grid/Grid.cjs"),t=e=>e&&e.__esModule?e:{default:e},l=t(u),d=t(a),r=`${232/16}rem`,c=d.default(n.Grid)`
2
- width: ${r};
3
- background: ${({theme:e})=>e.colors.neutral100};
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),s=require("styled-components"),u=require("../Grid/Grid.cjs"),a=t=>t&&t.__esModule?t:{default:t},i=a(s),e=`${232/16}rem`,n=i.default(u.Grid)`
2
+ width: ${e};
3
+ background: ${({theme:t})=>t.colors.neutral100};
4
4
  position: sticky;
5
5
  top: 0;
6
6
  height: 100vh;
7
7
  overflow-y: auto;
8
- border-right: 1px solid ${({theme:e})=>e.colors.neutral200};
8
+ border-right: 1px solid ${({theme:t})=>t.colors.neutral200};
9
9
  z-index: 1;
10
- `,o=({ariaLabel:e,...s})=>i.jsx(c,{"aria-label":e,as:"nav",...s});o.propTypes={ariaLabel:l.default.string.isRequired};exports.SubNav=o;exports.subNavWidth=r;
10
+ `,l=({ariaLabel:t,...r})=>o.jsx(n,{"aria-label":t,as:"nav",...r});exports.SubNav=l;exports.subNavWidth=e;
@@ -1,22 +1,17 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
- import "react";
3
- import i from "prop-types";
4
- import e from "styled-components";
2
+ import i from "styled-components";
5
3
  import { Grid as a } from "../Grid/Grid.js";
6
- const p = `${232 / 16}rem`, s = e(a)`
7
- width: ${p};
8
- background: ${({ theme: r }) => r.colors.neutral100};
4
+ const e = `${232 / 16}rem`, s = i(a)`
5
+ width: ${e};
6
+ background: ${({ theme: o }) => o.colors.neutral100};
9
7
  position: sticky;
10
8
  top: 0;
11
9
  height: 100vh;
12
10
  overflow-y: auto;
13
- border-right: 1px solid ${({ theme: r }) => r.colors.neutral200};
11
+ border-right: 1px solid ${({ theme: o }) => o.colors.neutral200};
14
12
  z-index: 1;
15
- `, n = ({ ariaLabel: r, ...o }) => /* @__PURE__ */ t(s, { "aria-label": r, as: "nav", ...o });
16
- n.propTypes = {
17
- ariaLabel: i.string.isRequired
18
- };
13
+ `, d = ({ ariaLabel: o, ...r }) => t(s, { "aria-label": o, as: "nav", ...r });
19
14
  export {
20
- n as SubNav,
21
- p as subNavWidth
15
+ d as SubNav,
16
+ e as subNavWidth
22
17
  };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("react"),R=require("@strapi/icons"),P=require("prop-types"),_=require("styled-components"),D=require("../helpers/keyboardKeys.cjs"),I=require("../hooks/useId.cjs"),K=require("../hooks/usePrevious.cjs"),L=require("../Searchbar/SearchForm.cjs"),k=require("../Searchbar/Searchbar.cjs"),w=require("../Divider/Divider.cjs"),c=require("../Box/Box.cjs"),F=require("../Flex/Flex.cjs"),O=require("../Typography/Typography.cjs"),E=require("../IconButton/IconButton.cjs"),h=t=>t&&t.__esModule?t:{default:t},r=h(P),H=h(_),p=H.default(w.Divider)`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),v=require("@strapi/icons"),C=require("styled-components"),R=require("../helpers/keyboardKeys.cjs"),T=require("../hooks/useId.cjs"),D=require("../hooks/usePrevious.cjs"),I=require("../Searchbar/SearchForm.cjs"),K=require("../Searchbar/Searchbar.cjs"),_=require("../Divider/Divider.cjs"),c=require("../Box/Box.cjs"),k=require("../Flex/Flex.cjs"),w=require("../Typography/Typography.cjs"),F=require("../IconButton/IconButton.cjs"),O=r=>r&&r.__esModule?r:{default:r},P=O(C),l=P.default(_.Divider)`
2
2
  width: ${24/16}rem;
3
- background-color: ${({theme:t})=>t.colors.neutral200};
4
- `,d=({as:t,label:g,searchLabel:l,searchable:b,onChange:x,value:y,onClear:S,onSubmit:q,id:j})=>{const[s,i]=o.useState(!1),f=K.usePrevious(s),v=I.useId(j),a=o.useRef(),u=o.useRef();o.useEffect(()=>{s&&a.current&&a.current.focus(),f&&!s&&u.current&&u.current.focus()},[s,f]);const B=()=>{i(n=>!n)},m=n=>{S(n),a.current.focus()},C=n=>{n.relatedTarget?.id!==v&&i(!1)},T=n=>{n.key===D.KeyboardKeys.ESCAPE&&i(!1)};return s?e.jsxs(c.Box,{paddingLeft:4,paddingTop:5,paddingBottom:2,paddingRight:4,children:[e.jsx(L.SearchForm,{children:e.jsx(k.Searchbar,{name:"searchbar",value:y,onChange:x,placeholder:"e.g: strapi-plugin-abcd",onKeyDown:T,ref:a,onBlur:C,onClear:m,onSubmit:q,clearLabel:"Clear",size:"S",children:l})}),e.jsx(c.Box,{paddingLeft:2,paddingTop:4,children:e.jsx(p,{})})]}):e.jsxs(c.Box,{paddingLeft:6,paddingTop:6,paddingBottom:2,paddingRight:4,children:[e.jsxs(F.Flex,{justifyContent:"space-between",alignItems:"flex-start",children:[e.jsx(O.Typography,{variant:"beta",as:t,children:g}),b&&e.jsx(E.IconButton,{ref:u,onClick:B,label:l,icon:e.jsx(R.Search,{})})]}),e.jsx(c.Box,{paddingTop:4,children:e.jsx(p,{})})]})};d.defaultProps={as:"h2",searchable:!1,onChange(){},onClear(){},onSubmit(){},value:"",searchLabel:"",id:void 0};d.propTypes={as:r.default.string,id:r.default.string,label:r.default.string.isRequired,onChange:r.default.func,onClear:r.default.func,onSubmit:r.default.func,searchLabel:r.default.string,searchable:r.default.bool,value:r.default.string};exports.SubNavHeader=d;
3
+ background-color: ${({theme:r})=>r.colors.neutral200};
4
+ `,E=({as:r="h2",label:f,searchLabel:u="",searchable:h,onChange:p=()=>{},value:g="",onClear:x=()=>{},onSubmit:S=()=>{},id:y})=>{const[t,a]=s.useState(!1),d=D.usePrevious(t),b=T.useId(y),o=s.useRef(null),i=s.useRef(null);s.useEffect(()=>{t&&o.current&&o.current.focus(),d&&!t&&i.current&&i.current.focus()},[t,d]);const j=()=>{a(n=>!n)},q=n=>{x(n),o?.current&&o.current.focus()},B=n=>{n.relatedTarget?.id!==b&&a(!1)},m=n=>{n.key===R.KeyboardKeys.ESCAPE&&a(!1)};return t?e.jsxs(c.Box,{paddingLeft:4,paddingTop:5,paddingBottom:2,paddingRight:4,children:[e.jsx(I.SearchForm,{children:e.jsx(K.Searchbar,{name:"searchbar",value:g,onChange:p,placeholder:"e.g: strapi-plugin-abcd",onKeyDown:m,ref:o,onBlur:B,onClear:q,onSubmit:S,clearLabel:"Clear",size:"S",children:u})}),e.jsx(c.Box,{paddingLeft:2,paddingTop:4,children:e.jsx(l,{})})]}):e.jsxs(c.Box,{paddingLeft:6,paddingTop:6,paddingBottom:2,paddingRight:4,children:[e.jsxs(k.Flex,{justifyContent:"space-between",alignItems:"flex-start",children:[e.jsx(w.Typography,{variant:"beta",as:r,children:f}),h&&e.jsx(F.IconButton,{ref:i,onClick:j,label:u,icon:e.jsx(v.Search,{})})]}),e.jsx(c.Box,{paddingTop:4,children:e.jsx(l,{})})]})};exports.SubNavHeader=E;