@tedi-design-system/react 18.0.0-rc.6 → 18.0.0-rc.8

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 (93) hide show
  1. package/_virtual/index.cjs10.js +1 -1
  2. package/_virtual/index.cjs11.js +1 -1
  3. package/_virtual/index.cjs12.js +1 -1
  4. package/_virtual/index.cjs13.js +1 -1
  5. package/_virtual/index.cjs5.js +1 -1
  6. package/_virtual/index.cjs6.js +1 -1
  7. package/_virtual/index.cjs7.js +1 -1
  8. package/_virtual/index.cjs8.js +1 -1
  9. package/_virtual/index.cjs9.js +1 -1
  10. package/_virtual/index.es10.js +1 -1
  11. package/_virtual/index.es11.js +1 -1
  12. package/_virtual/index.es12.js +1 -1
  13. package/_virtual/index.es13.js +4 -2
  14. package/_virtual/index.es14.js +2 -2
  15. package/_virtual/index.es5.js +2 -4
  16. package/_virtual/index.es6.js +1 -1
  17. package/_virtual/index.es7.js +1 -1
  18. package/_virtual/index.es8.js +1 -1
  19. package/_virtual/index.es9.js +1 -1
  20. package/bundle-stats.html +1 -1
  21. package/external/@mui/system/colorManipulator.cjs.js +1 -1
  22. package/external/@mui/system/colorManipulator.es.js +2 -2
  23. package/external/@mui/system/createStyled.cjs.js +1 -1
  24. package/external/@mui/system/createStyled.es.js +6 -6
  25. package/external/@mui/system/useThemeWithoutDefault.cjs.js +1 -1
  26. package/external/@mui/system/useThemeWithoutDefault.es.js +1 -1
  27. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.cjs.js +1 -1
  28. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.development.es.js +1 -1
  29. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
  30. package/external/hoist-non-react-statics/external/react-is/cjs/react-is.production.min.es.js +1 -1
  31. package/external/hoist-non-react-statics/external/react-is/index.cjs.js +1 -1
  32. package/external/hoist-non-react-statics/external/react-is/index.es.js +1 -1
  33. package/external/prop-types/external/react-is/cjs/react-is.development.cjs.js +1 -1
  34. package/external/prop-types/external/react-is/cjs/react-is.development.es.js +1 -1
  35. package/external/prop-types/external/react-is/cjs/react-is.production.min.cjs.js +1 -1
  36. package/external/prop-types/external/react-is/cjs/react-is.production.min.es.js +1 -1
  37. package/external/prop-types/external/react-is/index.cjs.js +1 -1
  38. package/external/prop-types/external/react-is/index.es.js +1 -1
  39. package/external/react-is/index.cjs.js +1 -1
  40. package/external/react-is/index.es.js +1 -1
  41. package/external/toposort/index.cjs.js +1 -1
  42. package/external/toposort/index.es.js +1 -1
  43. package/index.css +1 -1
  44. package/package.json +1 -1
  45. package/src/tedi/components/layout/mobile-nav/components/mobile-nav-toggle/mobile-nav-toggle.cjs.js +1 -0
  46. package/src/tedi/components/layout/mobile-nav/components/mobile-nav-toggle/mobile-nav-toggle.d.ts +52 -0
  47. package/src/tedi/components/layout/mobile-nav/components/mobile-nav-toggle/mobile-nav-toggle.es.js +68 -0
  48. package/src/tedi/components/layout/mobile-nav/components/mobile-nav-toggle/mobile-nav-toggle.module.scss.cjs.js +1 -0
  49. package/src/tedi/components/layout/mobile-nav/components/mobile-nav-toggle/mobile-nav-toggle.module.scss.es.js +9 -0
  50. package/src/tedi/components/layout/mobile-nav/index.d.ts +2 -0
  51. package/src/tedi/components/layout/mobile-nav/mobile-nav.cjs.js +1 -0
  52. package/src/tedi/components/layout/mobile-nav/mobile-nav.d.ts +20 -0
  53. package/src/tedi/components/layout/{sidenav/components/sidenav-mobile/sidenav-mobile.es.js → mobile-nav/mobile-nav.es.js} +21 -20
  54. package/src/tedi/components/layout/sidenav/index.d.ts +2 -2
  55. package/src/tedi/components/layout/sidenav/sidenav.cjs.js +1 -1
  56. package/src/tedi/components/layout/sidenav/sidenav.d.ts +2 -11
  57. package/src/tedi/components/layout/sidenav/sidenav.es.js +27 -27
  58. package/src/tedi/components/layout/top-nav/components/top-nav-group/top-nav-group.cjs.js +1 -0
  59. package/src/tedi/components/layout/top-nav/components/top-nav-group/top-nav-group.d.ts +34 -0
  60. package/src/tedi/components/layout/top-nav/components/top-nav-group/top-nav-group.es.js +33 -0
  61. package/src/tedi/components/layout/top-nav/components/top-nav-item/top-nav-item.cjs.js +1 -0
  62. package/src/tedi/components/layout/top-nav/components/top-nav-item/top-nav-item.d.ts +66 -0
  63. package/src/tedi/components/layout/top-nav/components/top-nav-item/top-nav-item.es.js +101 -0
  64. package/src/tedi/components/layout/top-nav/components/top-nav-separator/top-nav-separator.cjs.js +1 -0
  65. package/src/tedi/components/layout/top-nav/components/top-nav-separator/top-nav-separator.d.ts +11 -0
  66. package/src/tedi/components/layout/top-nav/components/top-nav-separator/top-nav-separator.es.js +9 -0
  67. package/src/tedi/components/layout/top-nav/components/top-nav-subitem/top-nav-subitem.cjs.js +1 -0
  68. package/src/tedi/components/layout/top-nav/components/top-nav-subitem/top-nav-subitem.d.ts +28 -0
  69. package/src/tedi/components/layout/top-nav/components/top-nav-subitem/top-nav-subitem.es.js +30 -0
  70. package/src/tedi/components/layout/top-nav/index.d.ts +5 -0
  71. package/src/tedi/components/layout/top-nav/top-nav-context.cjs.js +1 -0
  72. package/src/tedi/components/layout/top-nav/top-nav-context.d.ts +11 -0
  73. package/src/tedi/components/layout/top-nav/top-nav-context.es.js +6 -0
  74. package/src/tedi/components/layout/top-nav/top-nav.cjs.js +1 -0
  75. package/src/tedi/components/layout/top-nav/top-nav.d.ts +91 -0
  76. package/src/tedi/components/layout/top-nav/top-nav.es.js +171 -0
  77. package/src/tedi/components/layout/top-nav/top-nav.module.scss.cjs.js +1 -0
  78. package/src/tedi/components/layout/top-nav/top-nav.module.scss.es.js +28 -0
  79. package/src/tedi/components/overlays/overlay/overlay-content.cjs.js +1 -1
  80. package/src/tedi/components/overlays/overlay/overlay-content.es.js +35 -32
  81. package/src/tedi/helpers/hooks/use-breakpoint.cjs.js +1 -1
  82. package/src/tedi/helpers/hooks/use-breakpoint.d.ts +7 -0
  83. package/src/tedi/helpers/hooks/use-breakpoint.es.js +22 -14
  84. package/src/tedi/index.d.ts +2 -0
  85. package/tedi.cjs.js +1 -1
  86. package/tedi.es.js +213 -200
  87. package/src/tedi/components/layout/sidenav/components/sidenav-mobile/sidenav-mobile.cjs.js +0 -1
  88. package/src/tedi/components/layout/sidenav/components/sidenav-mobile/sidenav-mobile.d.ts +0 -14
  89. package/src/tedi/components/layout/sidenav/components/sidenav-toggle/sidenav-toggle.cjs.js +0 -1
  90. package/src/tedi/components/layout/sidenav/components/sidenav-toggle/sidenav-toggle.d.ts +0 -31
  91. package/src/tedi/components/layout/sidenav/components/sidenav-toggle/sidenav-toggle.es.js +0 -48
  92. package/src/tedi/components/layout/sidenav/components/sidenav-toggle/sidenav-toggle.module.scss.cjs.js +0 -1
  93. package/src/tedi/components/layout/sidenav/components/sidenav-toggle/sidenav-toggle.module.scss.es.js +0 -8
@@ -0,0 +1,101 @@
1
+ import { jsxs as _, jsx as i } from "react/jsx-runtime";
2
+ import t from "../../../../../../../external/classnames/index.es.js";
3
+ import { forwardRef as P } from "react";
4
+ import { Icon as v } from "../../../../base/icon/icon.es.js";
5
+ import e from "../../top-nav.module.scss.es.js";
6
+ const f = P(
7
+ (b, h) => {
8
+ const {
9
+ children: N,
10
+ href: p,
11
+ icon: n,
12
+ isActive: s = !1,
13
+ hasSubmenu: r = !1,
14
+ disabled: a = !1,
15
+ onClick: m,
16
+ as: I,
17
+ className: y,
18
+ submenu: g,
19
+ renderSubmenuInline: k = !1,
20
+ isSubmenuOpen: w,
21
+ panelId: l,
22
+ ...x
23
+ } = b, c = !p && r, C = I ?? (c ? "button" : "a"), o = w ?? s, d = k && o && r, S = (u) => {
24
+ if (a) {
25
+ u.preventDefault();
26
+ return;
27
+ }
28
+ m == null || m(u);
29
+ }, T = t(
30
+ e["tedi-top-nav__link"],
31
+ {
32
+ [e["tedi-top-nav__link--active"]]: s || o
33
+ },
34
+ y
35
+ ), z = {
36
+ ...x,
37
+ ref: h,
38
+ className: T,
39
+ onClick: S,
40
+ ...c ? {
41
+ type: "button",
42
+ disabled: a,
43
+ "aria-haspopup": !0,
44
+ "aria-expanded": o,
45
+ "aria-controls": l
46
+ } : {
47
+ href: a ? void 0 : p,
48
+ "aria-current": s ? "page" : void 0,
49
+ "aria-disabled": a || void 0
50
+ }
51
+ };
52
+ return /* @__PURE__ */ _(
53
+ "li",
54
+ {
55
+ className: t(e["tedi-top-nav__item"], {
56
+ [e["tedi-top-nav__item--has-inline-submenu"]]: d
57
+ }),
58
+ children: [
59
+ /* @__PURE__ */ _(C, { ...z, children: [
60
+ n && /* @__PURE__ */ i(
61
+ v,
62
+ {
63
+ className: e["tedi-top-nav__icon"],
64
+ ...typeof n == "string" ? { name: n } : n,
65
+ size: typeof n == "string" ? 18 : n.size ?? 18,
66
+ color: "inherit"
67
+ }
68
+ ),
69
+ N,
70
+ r && /* @__PURE__ */ i(
71
+ v,
72
+ {
73
+ className: t(e["tedi-top-nav__icon"], e["tedi-top-nav__chevron"], {
74
+ [e["tedi-top-nav__chevron--open"]]: o
75
+ }),
76
+ name: "keyboard_arrow_down",
77
+ size: 18,
78
+ color: "inherit"
79
+ }
80
+ )
81
+ ] }),
82
+ d && /* @__PURE__ */ i(
83
+ "div",
84
+ {
85
+ id: l,
86
+ className: t(e["tedi-top-nav__submenu"], e["tedi-top-nav__submenu--inline"]),
87
+ "data-name": "top-nav-submenu",
88
+ children: /* @__PURE__ */ i("div", { className: t(e["tedi-top-nav__submenu-inner"], e["tedi-top-nav__submenu-inner--inline"]), children: g })
89
+ }
90
+ )
91
+ ]
92
+ }
93
+ );
94
+ }
95
+ );
96
+ f.displayName = "TopNav.Item";
97
+ const B = f;
98
+ export {
99
+ B as TopNavItem,
100
+ B as default
101
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),o=require("../../../../../../../external/classnames/index.cjs.js"),t=require("../../top-nav.module.scss.cjs.js"),e=({className:r})=>a.jsx("li",{role:"separator","aria-orientation":"vertical",className:o.default(t.default["tedi-top-nav__separator"],r),children:a.jsx("span",{className:t.default["tedi-top-nav__separator-line"],"aria-hidden":"true"})});e.displayName="TopNav.Separator";exports.TopNavSeparator=e;exports.default=e;
@@ -0,0 +1,11 @@
1
+ export interface TopNavSeparatorProps {
2
+ /**
3
+ * Additional class name applied to the separator list item.
4
+ */
5
+ className?: string;
6
+ }
7
+ export declare const TopNavSeparator: {
8
+ ({ className }: TopNavSeparatorProps): JSX.Element;
9
+ displayName: string;
10
+ };
11
+ export default TopNavSeparator;
@@ -0,0 +1,9 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import o from "../../../../../../../external/classnames/index.es.js";
3
+ import r from "../../top-nav.module.scss.es.js";
4
+ const t = ({ className: e }) => /* @__PURE__ */ a("li", { role: "separator", "aria-orientation": "vertical", className: o(r["tedi-top-nav__separator"], e), children: /* @__PURE__ */ a("span", { className: r["tedi-top-nav__separator-line"], "aria-hidden": "true" }) });
5
+ t.displayName = "TopNav.Separator";
6
+ export {
7
+ t as TopNavSeparator,
8
+ t as default
9
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),_=require("../../../../../../../external/classnames/index.cjs.js"),S=require("react"),o=require("../../top-nav.module.scss.cjs.js"),x=require("../../top-nav-context.cjs.js"),n=S.forwardRef((i,r)=>{const{children:c,href:l,isActive:s=!1,onClick:e,as:d,className:m,...p}=i,v=d||"a",t=x.useTopNavContext(),b=N=>{e==null||e(N),t==null||t.closeSubmenu()},f={...p,ref:r,className:_.default(o.default["tedi-top-nav__subitem-link"],{[o.default["tedi-top-nav__subitem-link--active"]]:s},m),href:l,"aria-current":s?"page":void 0,onClick:b};return a.jsx("li",{className:o.default["tedi-top-nav__subitem"],children:a.jsx(v,{...f,children:c})})});n.displayName="TopNav.SubItem";const u=n;exports.TopNavSubItem=u;exports.default=u;
@@ -0,0 +1,28 @@
1
+ import { default as React } from 'react';
2
+ import { PolymorphicComponentPropWithRef } from '../../../../../helpers/polymorphic/types';
3
+ type TopNavSubItemBaseProps = {
4
+ /**
5
+ * Link label.
6
+ */
7
+ children: React.ReactNode;
8
+ /**
9
+ * Destination URL.
10
+ */
11
+ href?: string;
12
+ /**
13
+ * Marks this submenu item as the current page.
14
+ * @default false
15
+ */
16
+ isActive?: boolean;
17
+ /**
18
+ * Click handler. Receives the original mouse / keyboard event.
19
+ */
20
+ onClick?: (event: React.MouseEvent | React.KeyboardEvent) => void;
21
+ /**
22
+ * Additional class name applied to the link element.
23
+ */
24
+ className?: string;
25
+ };
26
+ export type TopNavSubItemProps<C extends React.ElementType = 'a'> = PolymorphicComponentPropWithRef<C, TopNavSubItemBaseProps>;
27
+ export declare const TopNavSubItem: <C extends React.ElementType = "a">(props: TopNavSubItemProps<C>) => React.ReactElement | null;
28
+ export default TopNavSubItem;
@@ -0,0 +1,30 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import b from "../../../../../../../external/classnames/index.es.js";
3
+ import { forwardRef as _ } from "react";
4
+ import o from "../../top-nav.module.scss.es.js";
5
+ import { useTopNavContext as h } from "../../top-nav-context.es.js";
6
+ const m = _(
7
+ (n, i) => {
8
+ const { children: r, href: c, isActive: s = !1, onClick: e, as: p, className: l, ...u } = n, d = p || "a", t = h(), f = (N) => {
9
+ e == null || e(N), t == null || t.closeSubmenu();
10
+ }, v = {
11
+ ...u,
12
+ ref: i,
13
+ className: b(
14
+ o["tedi-top-nav__subitem-link"],
15
+ { [o["tedi-top-nav__subitem-link--active"]]: s },
16
+ l
17
+ ),
18
+ href: c,
19
+ "aria-current": s ? "page" : void 0,
20
+ onClick: f
21
+ };
22
+ return /* @__PURE__ */ a("li", { className: o["tedi-top-nav__subitem"], children: /* @__PURE__ */ a(d, { ...v, children: r }) });
23
+ }
24
+ );
25
+ m.displayName = "TopNav.SubItem";
26
+ const I = m;
27
+ export {
28
+ I as TopNavSubItem,
29
+ I as default
30
+ };
@@ -0,0 +1,5 @@
1
+ export * from './components/top-nav-group/top-nav-group';
2
+ export * from './components/top-nav-item/top-nav-item';
3
+ export * from './components/top-nav-separator/top-nav-separator';
4
+ export * from './components/top-nav-subitem/top-nav-subitem';
5
+ export * from './top-nav';
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),e=t.createContext(null),o=()=>t.useContext(e);exports.TopNavContext=e;exports.useTopNavContext=o;
@@ -0,0 +1,11 @@
1
+ export interface TopNavContextValue {
2
+ /**
3
+ * Closes the open desktop submenu (mega-menu) panel. Called by `TopNav.SubItem`
4
+ * when a submenu link is activated so the panel dismisses on navigation
5
+ * (important for SPA / client-side routing where the nav stays mounted).
6
+ * No-op when there is no open panel.
7
+ */
8
+ closeSubmenu: () => void;
9
+ }
10
+ export declare const TopNavContext: import('react').Context<TopNavContextValue | null>;
11
+ export declare const useTopNavContext: () => TopNavContextValue | null;
@@ -0,0 +1,6 @@
1
+ import { useContext as t, createContext as o } from "react";
2
+ const e = o(null), x = () => t(e);
3
+ export {
4
+ e as TopNavContext,
5
+ x as useTopNavContext
6
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),ne=require("../../../../../external/classnames/index.cjs.js"),t=require("react"),oe=require("../mobile-nav/mobile-nav.cjs.js"),W=require("./components/top-nav-group/top-nav-group.cjs.js"),g=require("./components/top-nav-item/top-nav-item.cjs.js"),G=require("./components/top-nav-separator/top-nav-separator.cjs.js"),R=require("./components/top-nav-subitem/top-nav-subitem.cjs.js"),v=require("./top-nav.module.scss.cjs.js"),se=require("./top-nav-context.cjs.js"),C=require("../../../helpers/hooks/use-breakpoint.cjs.js"),re=n=>{if(!(n===void 0||n==="none"||n===0))return typeof n=="string"&&n!=="xs"&&n in C.BREAKPOINT_WIDTHS?C.BREAKPOINT_WIDTHS[n]:n},L=n=>{const r=[];return t.Children.forEach(n,o=>{if(t.isValidElement(o)){if(o.type===t.Fragment){r.push(...L(o.props.children));return}(o.type===g.TopNavItem||o.type===G.TopNavSeparator)&&r.push(o)}}),r},A=n=>n.type===g.TopNavItem,ie=n=>({children:n.props.children,href:n.props.href,isActive:n.props.isActive,onClick:n.props.onClick}),P=n=>{if(!n)return;const r=[];return t.Children.forEach(n,o=>{if(!t.isValidElement(o))return;if(o.type===t.Fragment){const i=P(o.props.children);i&&r.push(...i);return}if(o.type!==W.TopNavGroup)return;const f=o.props,c=[];t.Children.forEach(f.children,i=>{t.isValidElement(i)&&i.type===R.TopNavSubItem&&c.push(ie(i))}),c.length>0&&r.push({subHeading:f.title,subItems:c})}),r.length>0?r:void 0},p=n=>{const{children:r,ariaLabel:o,mobileBreakpoint:f="md",isMobileOpen:c,onMenuToggle:i,showMobileOverlay:V=!0,className:O,id:D,submenuFit:F="full",maxWidth:H="xxl"}=n,K=C.useBreakpoint(),T=C.isBreakpointBelow(K,f),b=c!==void 0,[$,_]=t.useState(!1),z=b?c:$;t.useEffect(()=>{!b&&!T&&_(!1)},[T,b]);const J=e=>{b||_(e),i==null||i(e)},E=t.useMemo(()=>L(r),[r]),l=t.useMemo(()=>E.filter(A),[E]),k=e=>!e.props.href&&t.Children.count(e.props.submenu)>0,M=t.useMemo(()=>{const e=l.findIndex(s=>k(s)&&s.props.isActive);return e===-1?null:e},[l]),[N,d]=t.useState(M);t.useEffect(()=>{d(M)},[M]);const q=t.useCallback(()=>d(null),[]),Q=t.useMemo(()=>({closeSubmenu:q}),[q]),I=t.useRef(null),h=t.useId();t.useEffect(()=>{if(N===null)return;const e=u=>{I.current&&!I.current.contains(u.target)&&d(null)},s=u=>{var S;if(u.key!=="Escape")return;const m=(S=I.current)==null?void 0:S.querySelector(`[aria-controls="${CSS.escape(h)}"][aria-expanded="true"]`);m==null||m.focus(),d(null)};return document.addEventListener("mousedown",e),document.addEventListener("keydown",s),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",s)}},[N,h]);const w=(e,s)=>k(e)?N===s:!!e.props.isActive,B=t.useMemo(()=>l.find((e,s)=>w(e,s)&&t.Children.count(e.props.submenu)>0),[l,N]),U=t.useMemo(()=>l.map(e=>({children:e.props.children,disabled:e.props.disabled,href:e.props.href,icon:e.props.icon,isActive:e.props.isActive,onClick:e.props.onClick,subItemGroups:P(e.props.submenu)})),[l]);if(T)return a.jsx(oe.MobileNav,{navItems:U,ariaLabel:o,isOpen:z,onClose:()=>J(!1),showOverlay:V,className:O});const j=F==="content",x=re(H);let X=0;return a.jsx(se.TopNavContext.Provider,{value:Q,children:a.jsxs("nav",{ref:I,id:D,className:ne.default(v.default["tedi-top-nav"],O),"aria-label":o,"data-name":"top-nav",children:[a.jsx("div",{className:v.default["tedi-top-nav__bar"],children:a.jsx("ul",{className:v.default["tedi-top-nav__list"],style:x!==void 0?{maxWidth:x}:void 0,children:E.map((e,s)=>{if(A(e)){const u=X++,m=t.Children.count(e.props.submenu)>0,S=k(e),Y=w(e,u),y=e.props.onClick,Z=S?ee=>{y==null||y(ee),d(te=>te===u?null:u)}:y;return t.cloneElement(e,{key:s,hasSubmenu:m,renderSubmenuInline:j,isSubmenuOpen:Y,panelId:h,onClick:Z})}return t.cloneElement(e,{key:s})})})}),!j&&B&&a.jsx("div",{id:h,className:v.default["tedi-top-nav__submenu"],"data-name":"top-nav-submenu",children:a.jsx("div",{className:v.default["tedi-top-nav__submenu-inner"],style:x!==void 0?{maxWidth:x}:void 0,children:B.props.submenu})})]})})};p.displayName="TopNav";p.Item=g.TopNavItem;p.Group=W.TopNavGroup;p.SubItem=R.TopNavSubItem;p.Separator=G.TopNavSeparator;exports.TopNav=p;exports.default=p;
@@ -0,0 +1,91 @@
1
+ import { default as React, ReactNode } from 'react';
2
+ import { Breakpoint } from '../../../helpers';
3
+ import { TopNavGroupProps } from './components/top-nav-group/top-nav-group';
4
+ import { TopNavItemProps } from './components/top-nav-item/top-nav-item';
5
+ import { TopNavSubItemProps } from './components/top-nav-subitem/top-nav-subitem';
6
+ type BreakpointWidthName = Exclude<Breakpoint, 'xs'>;
7
+ export type TopNavMaxWidth = number | BreakpointWidthName | (string & {});
8
+ export interface TopNavProps {
9
+ /**
10
+ * `TopNav.Item` and `TopNav.Separator` children. Any other
11
+ * React node is ignored. Fragments are flattened, so `<>…</>` wrappers work
12
+ * transparently.
13
+ */
14
+ children: ReactNode;
15
+ /**
16
+ * Accessible name for the wrapping `<nav>` landmark.
17
+ */
18
+ ariaLabel: string;
19
+ /**
20
+ * Breakpoint below which the bar collapses into the shared Sidenav mobile
21
+ * drawer. Pass any TEDI breakpoint name (`xs`/`sm`/`md`/`lg`/`xl`/`xxl`).
22
+ * @default md
23
+ */
24
+ mobileBreakpoint?: Breakpoint;
25
+ /**
26
+ * Controlled open state for the mobile drawer. Pair with `onMenuToggle`
27
+ * to wire it to an external toggle button.
28
+ */
29
+ isMobileOpen?: boolean;
30
+ /**
31
+ * Fires whenever the mobile drawer opens or closes.
32
+ */
33
+ onMenuToggle?: (open: boolean) => void;
34
+ /**
35
+ * Dim the rest of the viewport when the mobile drawer is open.
36
+ * @default true
37
+ */
38
+ showMobileOverlay?: boolean;
39
+ /**
40
+ * Additional class name applied to the desktop `<nav>`.
41
+ */
42
+ className?: string;
43
+ /**
44
+ * Element id forwarded to the desktop `<nav>`.
45
+ */
46
+ id?: string;
47
+ /**
48
+ * Controls how the submenu (mega-menu) panel sizes and positions itself
49
+ * when the active item has submenu content. Both options use the same
50
+ * padding — this only affects the panel's width and horizontal position,
51
+ * not its density.
52
+ *
53
+ * - `'full'` (default) — the panel stretches to the full nav width and is
54
+ * centered, suitable for wide multi-column mega-menus.
55
+ * - `'content'` — the panel is only as wide as its content and sits
56
+ * left-aligned directly under the active item (it is *not* a smaller /
57
+ * tighter variant — just not stretched). Good for single- or few-column
58
+ * menus.
59
+ * @default full
60
+ */
61
+ submenuFit?: 'full' | 'content';
62
+ /**
63
+ * Constrains the inner content (item bar and full-width submenu inner) to a
64
+ * maximum width and centers it inside the blue `<nav>` background. Pass any
65
+ * valid CSS length (e.g. `1440`, `'1440px'`, `'90rem'`), or a TEDI breakpoint
66
+ * name (`'sm' | 'md' | 'lg' | 'xl' | 'xxl'`) — these resolve to the
67
+ * breakpoint's `min-width` (36rem / 48rem / 62rem / 75rem / 87.5rem
68
+ * respectively), useful for aligning the nav inner with a breakpoint-driven
69
+ * content container. The `<nav>` itself still spans 100% of its container.
70
+ *
71
+ * Pass `'none'` (or `0`) to disable the constraint and let the bar fill the
72
+ * full width of the nav.
73
+ * @default xxl
74
+ */
75
+ maxWidth?: TopNavMaxWidth | 'none';
76
+ }
77
+ export declare const TopNav: {
78
+ (props: TopNavProps): React.ReactElement | null;
79
+ displayName: string;
80
+ Item: <C extends React.ElementType = "a">(props: TopNavItemProps<C>) => React.ReactElement | null;
81
+ Group: {
82
+ ({ title, children, icon, headingLevel, className, }: TopNavGroupProps): JSX.Element;
83
+ displayName: string;
84
+ };
85
+ SubItem: <C extends React.ElementType = "a">(props: TopNavSubItemProps<C>) => React.ReactElement | null;
86
+ Separator: {
87
+ ({ className }: import('./components/top-nav-separator/top-nav-separator').TopNavSeparatorProps): JSX.Element;
88
+ displayName: string;
89
+ };
90
+ };
91
+ export default TopNav;
@@ -0,0 +1,171 @@
1
+ import { jsx as u, jsxs as ae } from "react/jsx-runtime";
2
+ import ue from "../../../../../external/classnames/index.es.js";
3
+ import R, { useState as P, useEffect as g, useMemo as c, useCallback as ce, useRef as le, useId as me, Children as l, isValidElement as w, Fragment as D } from "react";
4
+ import { MobileNav as de } from "../mobile-nav/mobile-nav.es.js";
5
+ import { TopNavGroup as F } from "./components/top-nav-group/top-nav-group.es.js";
6
+ import { TopNavItem as M } from "./components/top-nav-item/top-nav-item.es.js";
7
+ import { TopNavSeparator as H } from "./components/top-nav-separator/top-nav-separator.es.js";
8
+ import { TopNavSubItem as K } from "./components/top-nav-subitem/top-nav-subitem.es.js";
9
+ import f from "./top-nav.module.scss.es.js";
10
+ import { TopNavContext as fe } from "./top-nav-context.es.js";
11
+ import { useBreakpoint as ve, isBreakpointBelow as be, BREAKPOINT_WIDTHS as V } from "../../../helpers/hooks/use-breakpoint.es.js";
12
+ const he = (n) => {
13
+ if (!(n === void 0 || n === "none" || n === 0))
14
+ return typeof n == "string" && n !== "xs" && n in V ? V[n] : n;
15
+ }, q = (n) => {
16
+ const r = [];
17
+ return l.forEach(n, (t) => {
18
+ if (w(t)) {
19
+ if (t.type === D) {
20
+ r.push(...q(t.props.children));
21
+ return;
22
+ }
23
+ (t.type === M || t.type === H) && r.push(t);
24
+ }
25
+ }), r;
26
+ }, j = (n) => n.type === M, Ie = (n) => ({
27
+ children: n.props.children,
28
+ href: n.props.href,
29
+ isActive: n.props.isActive,
30
+ onClick: n.props.onClick
31
+ }), $ = (n) => {
32
+ if (!n) return;
33
+ const r = [];
34
+ return l.forEach(n, (t) => {
35
+ if (!w(t)) return;
36
+ if (t.type === D) {
37
+ const s = $(t.props.children);
38
+ s && r.push(...s);
39
+ return;
40
+ }
41
+ if (t.type !== F) return;
42
+ const b = t.props, p = [];
43
+ l.forEach(b.children, (s) => {
44
+ w(s) && s.type === K && p.push(Ie(s));
45
+ }), p.length > 0 && r.push({ subHeading: b.title, subItems: p });
46
+ }), r.length > 0 ? r : void 0;
47
+ }, v = (n) => {
48
+ const {
49
+ children: r,
50
+ ariaLabel: t,
51
+ mobileBreakpoint: b = "md",
52
+ isMobileOpen: p,
53
+ onMenuToggle: s,
54
+ showMobileOverlay: z = !0,
55
+ className: T,
56
+ id: J,
57
+ submenuFit: Q = "full",
58
+ maxWidth: U = "xxl"
59
+ } = n, X = ve(), C = be(X, b), h = p !== void 0, [Y, B] = P(!1), Z = h ? p : Y;
60
+ g(() => {
61
+ !h && !C && B(!1);
62
+ }, [C, h]);
63
+ const ee = (e) => {
64
+ h || B(e), s == null || s(e);
65
+ }, E = c(() => q(r), [r]), a = c(() => E.filter(j), [E]), O = (e) => !e.props.href && l.count(e.props.submenu) > 0, _ = c(() => {
66
+ const e = a.findIndex((o) => O(o) && o.props.isActive);
67
+ return e === -1 ? null : e;
68
+ }, [a]), [I, m] = P(_);
69
+ g(() => {
70
+ m(_);
71
+ }, [_]);
72
+ const A = ce(() => m(null), []), ne = c(() => ({ closeSubmenu: A }), [A]), x = le(null), y = me();
73
+ g(() => {
74
+ if (I === null) return;
75
+ const e = (i) => {
76
+ x.current && !x.current.contains(i.target) && m(null);
77
+ }, o = (i) => {
78
+ var S;
79
+ if (i.key !== "Escape") return;
80
+ const d = (S = x.current) == null ? void 0 : S.querySelector(
81
+ `[aria-controls="${CSS.escape(y)}"][aria-expanded="true"]`
82
+ );
83
+ d == null || d.focus(), m(null);
84
+ };
85
+ return document.addEventListener("mousedown", e), document.addEventListener("keydown", o), () => {
86
+ document.removeEventListener("mousedown", e), document.removeEventListener("keydown", o);
87
+ };
88
+ }, [I, y]);
89
+ const W = (e, o) => O(e) ? I === o : !!e.props.isActive, L = c(
90
+ () => a.find((e, o) => W(e, o) && l.count(e.props.submenu) > 0),
91
+ // eslint-disable-next-line react-hooks/exhaustive-deps
92
+ [a, I]
93
+ ), te = c(
94
+ () => a.map((e) => ({
95
+ children: e.props.children,
96
+ disabled: e.props.disabled,
97
+ href: e.props.href,
98
+ icon: e.props.icon,
99
+ isActive: e.props.isActive,
100
+ onClick: e.props.onClick,
101
+ subItemGroups: $(e.props.submenu)
102
+ })),
103
+ [a]
104
+ );
105
+ if (C)
106
+ return /* @__PURE__ */ u(
107
+ de,
108
+ {
109
+ navItems: te,
110
+ ariaLabel: t,
111
+ isOpen: Z,
112
+ onClose: () => ee(!1),
113
+ showOverlay: z,
114
+ className: T
115
+ }
116
+ );
117
+ const G = Q === "content", N = he(U);
118
+ let oe = 0;
119
+ return /* @__PURE__ */ u(fe.Provider, { value: ne, children: /* @__PURE__ */ ae(
120
+ "nav",
121
+ {
122
+ ref: x,
123
+ id: J,
124
+ className: ue(f["tedi-top-nav"], T),
125
+ "aria-label": t,
126
+ "data-name": "top-nav",
127
+ children: [
128
+ /* @__PURE__ */ u("div", { className: f["tedi-top-nav__bar"], children: /* @__PURE__ */ u(
129
+ "ul",
130
+ {
131
+ className: f["tedi-top-nav__list"],
132
+ style: N !== void 0 ? { maxWidth: N } : void 0,
133
+ children: E.map((e, o) => {
134
+ if (j(e)) {
135
+ const i = oe++, d = l.count(e.props.submenu) > 0, S = O(e), re = W(e, i), k = e.props.onClick, se = S ? (ie) => {
136
+ k == null || k(ie), m((pe) => pe === i ? null : i);
137
+ } : k;
138
+ return R.cloneElement(e, {
139
+ key: o,
140
+ hasSubmenu: d,
141
+ renderSubmenuInline: G,
142
+ isSubmenuOpen: re,
143
+ panelId: y,
144
+ onClick: se
145
+ });
146
+ }
147
+ return R.cloneElement(e, { key: o });
148
+ })
149
+ }
150
+ ) }),
151
+ !G && L && /* @__PURE__ */ u("div", { id: y, className: f["tedi-top-nav__submenu"], "data-name": "top-nav-submenu", children: /* @__PURE__ */ u(
152
+ "div",
153
+ {
154
+ className: f["tedi-top-nav__submenu-inner"],
155
+ style: N !== void 0 ? { maxWidth: N } : void 0,
156
+ children: L.props.submenu
157
+ }
158
+ ) })
159
+ ]
160
+ }
161
+ ) });
162
+ };
163
+ v.displayName = "TopNav";
164
+ v.Item = M;
165
+ v.Group = F;
166
+ v.SubItem = K;
167
+ v.Separator = H;
168
+ export {
169
+ v as TopNav,
170
+ v as default
171
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t={"tedi-top-nav":"tedi-top-nav-7985280d","tedi-top-nav__bar":"tedi-top-nav__bar-d7be6587","tedi-top-nav__list":"tedi-top-nav__list-1cdecbe8","tedi-top-nav__item":"tedi-top-nav__item-aa7109b8","tedi-top-nav__item--has-inline-submenu":"tedi-top-nav__item--has-inline-submenu-4d48fa95","tedi-top-nav__link":"tedi-top-nav__link-724c1ebc","tedi-top-nav__link--active":"tedi-top-nav__link--active-34580ede","tedi-top-nav__icon":"tedi-top-nav__icon-1ab6c34d","tedi-top-nav__chevron":"tedi-top-nav__chevron-e05880f8","tedi-top-nav__chevron--open":"tedi-top-nav__chevron--open-ef97d87b","tedi-top-nav__separator":"tedi-top-nav__separator-d1e8646d","tedi-top-nav__separator-line":"tedi-top-nav__separator-line-4777819a","tedi-top-nav__submenu":"tedi-top-nav__submenu-9b591c05","tedi-top-nav__submenu-inner":"tedi-top-nav__submenu-inner-7a7895b2","tedi-top-nav__submenu--inline":"tedi-top-nav__submenu--inline-b4debcfa","tedi-top-nav__submenu-inner--inline":"tedi-top-nav__submenu-inner--inline-c5cd3a64","tedi-top-nav__group":"tedi-top-nav__group-691df203","tedi-top-nav__group-title":"tedi-top-nav__group-title-70faf48a","tedi-top-nav__group-icon":"tedi-top-nav__group-icon-792cee8c","tedi-top-nav__group-list":"tedi-top-nav__group-list-88ee40bb","tedi-top-nav__subitem":"tedi-top-nav__subitem-d8c89fc6","tedi-top-nav__subitem-link":"tedi-top-nav__subitem-link-382e3910","tedi-top-nav__subitem-link--active":"tedi-top-nav__subitem-link--active-d0f16d73"};exports.default=t;
@@ -0,0 +1,28 @@
1
+ const t = {
2
+ "tedi-top-nav": "tedi-top-nav-7985280d",
3
+ "tedi-top-nav__bar": "tedi-top-nav__bar-d7be6587",
4
+ "tedi-top-nav__list": "tedi-top-nav__list-1cdecbe8",
5
+ "tedi-top-nav__item": "tedi-top-nav__item-aa7109b8",
6
+ "tedi-top-nav__item--has-inline-submenu": "tedi-top-nav__item--has-inline-submenu-4d48fa95",
7
+ "tedi-top-nav__link": "tedi-top-nav__link-724c1ebc",
8
+ "tedi-top-nav__link--active": "tedi-top-nav__link--active-34580ede",
9
+ "tedi-top-nav__icon": "tedi-top-nav__icon-1ab6c34d",
10
+ "tedi-top-nav__chevron": "tedi-top-nav__chevron-e05880f8",
11
+ "tedi-top-nav__chevron--open": "tedi-top-nav__chevron--open-ef97d87b",
12
+ "tedi-top-nav__separator": "tedi-top-nav__separator-d1e8646d",
13
+ "tedi-top-nav__separator-line": "tedi-top-nav__separator-line-4777819a",
14
+ "tedi-top-nav__submenu": "tedi-top-nav__submenu-9b591c05",
15
+ "tedi-top-nav__submenu-inner": "tedi-top-nav__submenu-inner-7a7895b2",
16
+ "tedi-top-nav__submenu--inline": "tedi-top-nav__submenu--inline-b4debcfa",
17
+ "tedi-top-nav__submenu-inner--inline": "tedi-top-nav__submenu-inner--inline-c5cd3a64",
18
+ "tedi-top-nav__group": "tedi-top-nav__group-691df203",
19
+ "tedi-top-nav__group-title": "tedi-top-nav__group-title-70faf48a",
20
+ "tedi-top-nav__group-icon": "tedi-top-nav__group-icon-792cee8c",
21
+ "tedi-top-nav__group-list": "tedi-top-nav__group-list-88ee40bb",
22
+ "tedi-top-nav__subitem": "tedi-top-nav__subitem-d8c89fc6",
23
+ "tedi-top-nav__subitem-link": "tedi-top-nav__subitem-link-382e3910",
24
+ "tedi-top-nav__subitem-link--active": "tedi-top-nav__subitem-link--active-d0f16d73"
25
+ };
26
+ export {
27
+ t as default
28
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),r=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),d=require("react"),j=require("./overlay.cjs.js"),F=s=>{const{children:u,classNames:e,labelledBy:y,describedBy:f}=s,{open:l,x:m,y:h,strategy:g,focusManager:o,floating:b,arrowRef:v,getFloatingProps:x,placement:w,context:i,arrow:t,scrollLock:c,contentId:p}=d.useContext(j.OverlayContext);return d.useEffect(()=>{c&&(l?(document.documentElement.style.overflow="hidden",document.documentElement.scrollHeight>window.innerHeight&&(document.body.style.overflow="scroll")):(document.documentElement.style.overflow="",document.body.style.overflow=""))},[l,c]),l?n.jsx(r.FloatingPortal,{children:n.jsx(r.FloatingFocusManager,{modal:(o==null?void 0:o.modal)||!1,...o,context:i,children:n.jsxs("div",{...x({ref:b,tabIndex:-1,id:p,"aria-labelledby":y,"aria-describedby":f,style:{position:g,left:m,top:h},className:e==null?void 0:e.content}),"data-placement":w,"data-testid":"overlay-content",children:[n.jsx(r.FloatingArrow,{ref:a=>v.current=a,context:i,className:e==null?void 0:e.arrow,height:t==null?void 0:t.height,width:t==null?void 0:t.width,"data-testid":"overlay-arrow"}),u]})})}):null};exports.OverlayContent=F;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),r=require("../../../../../external/@floating-ui/react/dist/floating-ui.react.cjs.js"),s=require("react"),q=require("./overlay.cjs.js"),C=u=>{const{children:y,classNames:e,labelledBy:f,describedBy:m}=u,{open:l,x:g,y:h,strategy:b,focusManager:o,floating:v,arrowRef:x,getFloatingProps:w,placement:p,context:i,arrow:t,scrollLock:c,contentId:j,role:F}=s.useContext(q.OverlayContext);if(s.useEffect(()=>{c&&(l?(document.documentElement.style.overflow="hidden",document.documentElement.scrollHeight>window.innerHeight&&(document.body.style.overflow="scroll")):(document.documentElement.style.overflow="",document.body.style.overflow=""))},[l,c]),!l)return null;const a=n.jsxs("div",{...w({ref:v,tabIndex:-1,id:j,"aria-labelledby":f,"aria-describedby":m,style:{position:b,left:g,top:h},className:e==null?void 0:e.content}),"data-placement":p,"data-testid":"overlay-content",children:[n.jsx(r.FloatingArrow,{ref:d=>x.current=d,context:i,className:e==null?void 0:e.arrow,height:t==null?void 0:t.height,width:t==null?void 0:t.width,"data-testid":"overlay-arrow"}),y]});return n.jsx(r.FloatingPortal,{children:F==="tooltip"?a:n.jsx(r.FloatingFocusManager,{modal:(o==null?void 0:o.modal)||!1,...o,context:i,children:a})})};exports.OverlayContent=C;
@@ -1,48 +1,50 @@
1
- import { jsx as n, jsxs as w } from "react/jsx-runtime";
2
- import { FloatingPortal as x, FloatingFocusManager as F, FloatingArrow as E } from "../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
3
- import { useContext as C, useEffect as j } from "react";
4
- import { OverlayContext as B } from "./overlay.es.js";
5
- const S = (a) => {
6
- const { children: c, classNames: e, labelledBy: s, describedBy: m } = a, {
1
+ import { jsxs as F, jsx as n } from "react/jsx-runtime";
2
+ import { FloatingArrow as E, FloatingPortal as C, FloatingFocusManager as j } from "../../../../../external/@floating-ui/react/dist/floating-ui.react.es.js";
3
+ import { useContext as B, useEffect as H } from "react";
4
+ import { OverlayContext as I } from "./overlay.es.js";
5
+ const A = (c) => {
6
+ const { children: s, classNames: e, labelledBy: m, describedBy: f } = c, {
7
7
  open: l,
8
- x: f,
9
- y,
10
- strategy: h,
8
+ x: y,
9
+ y: h,
10
+ strategy: u,
11
11
  focusManager: o,
12
- floating: u,
13
- arrowRef: b,
14
- getFloatingProps: g,
15
- placement: p,
12
+ floating: g,
13
+ arrowRef: p,
14
+ getFloatingProps: b,
15
+ placement: v,
16
16
  context: r,
17
17
  arrow: t,
18
- scrollLock: d,
19
- contentId: v
20
- } = C(B);
21
- return j(() => {
22
- d && (l ? (document.documentElement.style.overflow = "hidden", document.documentElement.scrollHeight > window.innerHeight && (document.body.style.overflow = "scroll")) : (document.documentElement.style.overflow = "", document.body.style.overflow = ""));
23
- }, [l, d]), l ? /* @__PURE__ */ n(x, { children: /* @__PURE__ */ n(F, { modal: (o == null ? void 0 : o.modal) || !1, ...o, context: r, children: /* @__PURE__ */ w(
18
+ scrollLock: i,
19
+ contentId: w,
20
+ role: x
21
+ } = B(I);
22
+ if (H(() => {
23
+ i && (l ? (document.documentElement.style.overflow = "hidden", document.documentElement.scrollHeight > window.innerHeight && (document.body.style.overflow = "scroll")) : (document.documentElement.style.overflow = "", document.body.style.overflow = ""));
24
+ }, [l, i]), !l) return null;
25
+ const d = /* @__PURE__ */ F(
24
26
  "div",
25
27
  {
26
- ...g({
27
- ref: u,
28
+ ...b({
29
+ ref: g,
28
30
  tabIndex: -1,
29
- id: v,
30
- "aria-labelledby": s,
31
- "aria-describedby": m,
31
+ id: w,
32
+ "aria-labelledby": m,
33
+ "aria-describedby": f,
32
34
  style: {
33
- position: h,
34
- left: f,
35
- top: y
35
+ position: u,
36
+ left: y,
37
+ top: h
36
38
  },
37
39
  className: e == null ? void 0 : e.content
38
40
  }),
39
- "data-placement": p,
41
+ "data-placement": v,
40
42
  "data-testid": "overlay-content",
41
43
  children: [
42
44
  /* @__PURE__ */ n(
43
45
  E,
44
46
  {
45
- ref: (i) => b.current = i,
47
+ ref: (a) => p.current = a,
46
48
  context: r,
47
49
  className: e == null ? void 0 : e.arrow,
48
50
  height: t == null ? void 0 : t.height,
@@ -50,11 +52,12 @@ const S = (a) => {
50
52
  "data-testid": "overlay-arrow"
51
53
  }
52
54
  ),
53
- c
55
+ s
54
56
  ]
55
57
  }
56
- ) }) }) : null;
58
+ );
59
+ return /* @__PURE__ */ n(C, { children: x === "tooltip" ? d : /* @__PURE__ */ n(j, { modal: (o == null ? void 0 : o.modal) || !1, ...o, context: r, children: d }) });
57
60
  };
58
61
  export {
59
- S as OverlayContent
62
+ A as OverlayContent
60
63
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react"),d=require("../../../../external/lodash-es/debounce.cjs.js"),n=["xs","sm","md","lg","xl","xxl"],o=(e="xs")=>{const[t,r]=a.useState(e);return a.useLayoutEffect(()=>{const s=()=>window.matchMedia("(min-width: 87.5rem)").matches?"xxl":window.matchMedia("(min-width: 75rem)").matches?"xl":window.matchMedia("(min-width: 62rem)").matches?"lg":window.matchMedia("(min-width: 48rem)").matches?"md":window.matchMedia("(min-width: 36rem)").matches?"sm":"xs",i=d.default(()=>{r(s())},20);return r(s()),window.addEventListener("resize",i),()=>{i.cancel(),window.removeEventListener("resize",i)}},[]),t},m=(e,t)=>e?n.indexOf(e)<n.indexOf(t):!1;exports.breakpoints=n;exports.default=o;exports.isBreakpointBelow=m;exports.useBreakpoint=o;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react"),m=require("../../../../external/lodash-es/debounce.cjs.js"),r=["xs","sm","md","lg","xl","xxl"],e={xs:"0",sm:"36rem",md:"48rem",lg:"62rem",xl:"75rem",xxl:"87.5rem"},d=(t="xs")=>{const[i,s]=o.useState(t);return o.useLayoutEffect(()=>{const a=()=>window.matchMedia(`(min-width: ${e.xxl})`).matches?"xxl":window.matchMedia(`(min-width: ${e.xl})`).matches?"xl":window.matchMedia(`(min-width: ${e.lg})`).matches?"lg":window.matchMedia(`(min-width: ${e.md})`).matches?"md":window.matchMedia(`(min-width: ${e.sm})`).matches?"sm":"xs",n=m.default(()=>{s(a())},20);return s(a()),window.addEventListener("resize",n),()=>{n.cancel(),window.removeEventListener("resize",n)}},[]),i},l=(t,i)=>t?r.indexOf(t)<r.indexOf(i):!1;exports.BREAKPOINT_WIDTHS=e;exports.breakpoints=r;exports.default=d;exports.isBreakpointBelow=l;exports.useBreakpoint=d;