@midas-ds/layout 0.2.76 → 0.2.78

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/CHANGELOG.md CHANGED
@@ -1,3 +1,30 @@
1
+ ## 0.2.78 (2026-12-01)
2
+
3
+ ### 🚀 Features
4
+
5
+ - **layout,header:** keep vertical HeaderAction labels on small screens ([117595b02a2](https://github.com/migrationsverket/midas/commit/117595b02a2))
6
+ - **layout,header:** add vertical orientation to HeaderActions ([2f8117e785b](https://github.com/migrationsverket/midas/commit/2f8117e785b))
7
+
8
+ ### 🩹 Fixes
9
+
10
+ - **layout,header:** use regular font weight for header action labels ([76394d599c9](https://github.com/migrationsverket/midas/commit/76394d599c9))
11
+ - **layout,header:** give vertical header actions room above and below ([952dfd59044](https://github.com/migrationsverket/midas/commit/952dfd59044))
12
+ - **layout,header:** make icon-only HeaderAction 40 by 40 on every screen size ([47a50654ddb](https://github.com/migrationsverket/midas/commit/47a50654ddb))
13
+
14
+ ### 🏭 Refactoring
15
+
16
+ - **layout,header:** tighten HeaderAction prop types ([bdbd72e1a1e](https://github.com/migrationsverket/midas/commit/bdbd72e1a1e))
17
+
18
+ ### 📖 Documentation changes
19
+
20
+ - **layout,header:** generate the Header API tables from JSDoc ([9fc2aa3a378](https://github.com/migrationsverket/midas/commit/9fc2aa3a378))
21
+
22
+ ## 0.2.77 (2026-11-30)
23
+
24
+ ### 🧱 Updated Dependencies
25
+
26
+ - Updated components to 17.39.0
27
+
1
28
  ## 0.2.76 (2026-11-30)
2
29
 
3
30
  ### 🩹 Fixes
package/assets/header.css CHANGED
@@ -1 +1 @@
1
- ._headerActions_zpqnd_1{align-items:center;gap:0;margin-inline-start:auto;display:flex}._headerAction_15afi_1{color:var(--midas-text-primary);position:relative}@media (width<768px){._label_15afi_7{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}._headerAction_15afi_1{padding-inline:calc(var(--midas-space-50) - var(--border-width))}}._mobile_6rcng_4,._desktop_6rcng_5{display:contents}@media (width>=768px){._mobile_6rcng_4{display:none}}@media (width<768px){._desktop_6rcng_5{display:none}}._mobileLogo_6rcng_21{aspect-ratio:100/92;flex-shrink:0;height:2.25rem}._desktopLogo_6rcng_27{aspect-ratio:112/40;flex-shrink:0;height:2.5rem}._headerTitle_cw9hi_1{font-family:var(--midas-typography-font-family);font-size:var(--midas-typography-font-size-30);font-weight:var(--midas-typography-weight-semi-bold);line-height:var(--midas-typography-line-height-50);color:var(--midas-text-primary);white-space:nowrap;margin-inline-start:var(--midas-space-medium);padding-inline-end:var(--midas-space-medium)}._triggerButton_3t5en_1{margin-inline-start:calc(-1 * var(--midas-space-50))}._overlay_3t5en_5{display:block}._overlay_3t5en_5[data-entering]{animation:_drawer-blur_3t5en_1 var(--midas-transition-duration-quick)}._overlay_3t5en_5[data-exiting]{animation:_drawer-blur_3t5en_1 var(--midas-transition-duration-quick) reverse var(--midas-transition-timing-ease-in)}@media (prefers-reduced-motion){._overlay_3t5en_5[data-entering],._overlay_3t5en_5[data-exiting]{animation:none}}._drawer_3t5en_25{background-color:var(--midas-background-base);border-right:1px solid var(--midas-border-color-subtle);outline:none;width:clamp(10rem,15rem,90%);height:calc(100dvh + 200px);margin-right:auto;position:sticky;top:-100px;left:0;overflow-y:auto;box-shadow:-8px 0 20px #0000001a}._drawer_3t5en_25[data-entering]{animation:_drawer-slide_3t5en_1 var(--midas-transition-duration-quick)}._drawer_3t5en_25[data-exiting]{animation:_drawer-slide_3t5en_1 var(--midas-transition-duration-quick) reverse var(--midas-transition-timing-ease-in)}@media (prefers-reduced-motion){._drawer_3t5en_25[data-entering],._drawer_3t5en_25[data-exiting]{animation:none}}._dialog_3t5en_57:focus-visible{outline:none}._header_3t5en_63{background-color:var(--midas-background-base);margin-bottom:var(--midas-space-medium);padding:var(--midas-space-medium);display:block;position:sticky;top:0}@keyframes _drawer-blur_3t5en_1{0%{-webkit-backdrop-filter:blur();backdrop-filter:blur();background:0 0}to{background:var(--midas-overlay-background);-webkit-backdrop-filter:var(--midas-overlay-blur);backdrop-filter:var(--midas-overlay-blur)}}@keyframes _drawer-slide_3t5en_1{0%{transform:translate(-100%)}to{transform:translate(0)}}._header_s0sjn_1{background-color:var(--midas-background-base);border-bottom:1px solid var(--midas-border-color-subtle);min-height:4.5rem;padding-inline:var(--midas-space-medium);align-items:center;display:flex}
1
+ ._headerActions_zpqnd_1{align-items:center;gap:0;margin-inline-start:auto;display:flex}._headerAction_ngny7_1{color:var(--midas-text-primary);font-weight:var(--midas-typography-weight-regular);position:relative}._headerAction_ngny7_1[data-icon-only]{padding:calc(var(--midas-space-50) - var(--border-width))}._headerAction_ngny7_1[data-orientation=vertical]{flex-direction:column}@media (width<768px){._headerAction_ngny7_1:not([data-orientation=vertical]){padding-inline:calc(var(--midas-space-50) - var(--border-width))}._headerAction_ngny7_1:not([data-orientation=vertical]) ._label_ngny7_22{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}}._mobile_6rcng_4,._desktop_6rcng_5{display:contents}@media (width>=768px){._mobile_6rcng_4{display:none}}@media (width<768px){._desktop_6rcng_5{display:none}}._mobileLogo_6rcng_21{aspect-ratio:100/92;flex-shrink:0;height:2.25rem}._desktopLogo_6rcng_27{aspect-ratio:112/40;flex-shrink:0;height:2.5rem}._headerTitle_cw9hi_1{font-family:var(--midas-typography-font-family);font-size:var(--midas-typography-font-size-30);font-weight:var(--midas-typography-weight-semi-bold);line-height:var(--midas-typography-line-height-50);color:var(--midas-text-primary);white-space:nowrap;margin-inline-start:var(--midas-space-medium);padding-inline-end:var(--midas-space-medium)}._triggerButton_3t5en_1{margin-inline-start:calc(-1 * var(--midas-space-50))}._overlay_3t5en_5{display:block}._overlay_3t5en_5[data-entering]{animation:_drawer-blur_3t5en_1 var(--midas-transition-duration-quick)}._overlay_3t5en_5[data-exiting]{animation:_drawer-blur_3t5en_1 var(--midas-transition-duration-quick) reverse var(--midas-transition-timing-ease-in)}@media (prefers-reduced-motion){._overlay_3t5en_5[data-entering],._overlay_3t5en_5[data-exiting]{animation:none}}._drawer_3t5en_25{background-color:var(--midas-background-base);border-right:1px solid var(--midas-border-color-subtle);outline:none;width:clamp(10rem,15rem,90%);height:calc(100dvh + 200px);margin-right:auto;position:sticky;top:-100px;left:0;overflow-y:auto;box-shadow:-8px 0 20px #0000001a}._drawer_3t5en_25[data-entering]{animation:_drawer-slide_3t5en_1 var(--midas-transition-duration-quick)}._drawer_3t5en_25[data-exiting]{animation:_drawer-slide_3t5en_1 var(--midas-transition-duration-quick) reverse var(--midas-transition-timing-ease-in)}@media (prefers-reduced-motion){._drawer_3t5en_25[data-entering],._drawer_3t5en_25[data-exiting]{animation:none}}._dialog_3t5en_57:focus-visible{outline:none}._header_3t5en_63{background-color:var(--midas-background-base);margin-bottom:var(--midas-space-medium);padding:var(--midas-space-medium);display:block;position:sticky;top:0}@keyframes _drawer-blur_3t5en_1{0%{-webkit-backdrop-filter:blur();backdrop-filter:blur();background:0 0}to{background:var(--midas-overlay-background);-webkit-backdrop-filter:var(--midas-overlay-blur);backdrop-filter:var(--midas-overlay-blur)}}@keyframes _drawer-slide_3t5en_1{0%{transform:translate(-100%)}to{transform:translate(0)}}._header_1eyli_1{background-color:var(--midas-background-base);border-bottom:1px solid var(--midas-border-color-subtle);box-sizing:border-box;min-height:4.5rem;padding:var(--midas-space-medium);align-items:center;display:flex}
@@ -0,0 +1,107 @@
1
+ 'use client';
2
+ import { useIsMobileDevice as e } from "../utils/index.js";
3
+ import t from "clsx";
4
+ import { createContext as n, forwardRef as r, useContext as i } from "react";
5
+ import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
6
+ import { Dialog as c, Modal as l, composeRenderProps as u } from "react-aria-components";
7
+ import { Button as d, DialogTrigger as f, Logo as p, ModalOverlay as m, Text as h, clsx as g, useLocalizedStringFormatter as _ } from "@midas-ds/components";
8
+ import { Menu as v } from "lucide-react";
9
+ import '../assets/header.css';// src/header/header-actions/HeaderActionsContext.tsx
10
+ var y = n({ orientation: "horizontal" }), b = { headerActions: "_headerActions_zpqnd_1" }, x = ({ children: e, className: n, orientation: r = "horizontal" }) => /* @__PURE__ */ o("div", {
11
+ className: t(b.headerActions, n),
12
+ children: /* @__PURE__ */ o(y.Provider, {
13
+ value: { orientation: r },
14
+ children: e
15
+ })
16
+ }), S = {
17
+ headerAction: "_headerAction_ngny7_1",
18
+ label: "_label_ngny7_22"
19
+ }, C = r(({ children: e, icon: n, className: r, ...c }, l) => {
20
+ !e && !c["aria-label"] && process.env.NODE_ENV !== "production" && console.warn("Please provide an 'aria-label' for HeaderAction components that doesnt have a visible label (children)");
21
+ let { orientation: f } = i(y);
22
+ return /* @__PURE__ */ o(d, {
23
+ ref: l,
24
+ size: "medium",
25
+ variant: "tertiary",
26
+ className: t(S.headerAction, r),
27
+ "data-orientation": f,
28
+ "data-icon-only": !e || void 0,
29
+ ...c,
30
+ children: u(e, (e) => /* @__PURE__ */ s(a, { children: [n, e !== void 0 && /* @__PURE__ */ o("span", {
31
+ className: S.label,
32
+ children: e
33
+ })] }))
34
+ });
35
+ });
36
+ C.displayName = "HeaderAction";
37
+ var w = {
38
+ mobile: "_mobile_6rcng_4",
39
+ desktop: "_desktop_6rcng_5",
40
+ mobileLogo: "_mobileLogo_6rcng_21",
41
+ desktopLogo: "_desktopLogo_6rcng_27"
42
+ }, T = ({ primary: e }) => /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("div", {
43
+ className: w.mobile,
44
+ children: /* @__PURE__ */ o(p, {
45
+ size: "x-small",
46
+ primary: e,
47
+ padding: !1,
48
+ className: w.mobileLogo
49
+ })
50
+ }), /* @__PURE__ */ o("div", {
51
+ className: w.desktop,
52
+ children: /* @__PURE__ */ o(p, {
53
+ size: "small",
54
+ primary: e,
55
+ padding: !1,
56
+ className: w.desktopLogo
57
+ })
58
+ })] }), E = { headerTitle: "_headerTitle_cw9hi_1" }, D = ({ className: e, ...n }) => /* @__PURE__ */ o("span", {
59
+ className: t(E.headerTitle, e),
60
+ ...n
61
+ }), O = n(void 0), k = {
62
+ en: { openMenu: "Open menu" },
63
+ sv: { openMenu: "Öppna meny" }
64
+ }, A = {
65
+ triggerButton: "_triggerButton_3t5en_1",
66
+ overlay: "_overlay_3t5en_5",
67
+ "drawer-blur": "_drawer-blur_3t5en_1",
68
+ drawer: "_drawer_3t5en_25",
69
+ "drawer-slide": "_drawer-slide_3t5en_1",
70
+ dialog: "_dialog_3t5en_57",
71
+ header: "_header_3t5en_63"
72
+ }, j = ({ children: t, className: n, defaultOpen: r, isOpen: i, onOpenChange: a, title: p, ...y }) => {
73
+ let b = e(), x = _(k);
74
+ return b ? /* @__PURE__ */ o(O.Provider, {
75
+ value: {},
76
+ children: /* @__PURE__ */ s(f, {
77
+ isOpen: i,
78
+ onOpenChange: a,
79
+ defaultOpen: r,
80
+ children: [/* @__PURE__ */ o(d, {
81
+ "aria-label": x.format("openMenu"),
82
+ icon: v,
83
+ variant: "icon",
84
+ size: "medium",
85
+ className: A.triggerButton
86
+ }), /* @__PURE__ */ o(m, {
87
+ className: g(n, A.overlay),
88
+ isDismissable: !0,
89
+ ...y,
90
+ children: u(t, (e) => /* @__PURE__ */ o(l, {
91
+ className: A.drawer,
92
+ children: /* @__PURE__ */ s(c, {
93
+ className: A.dialog,
94
+ children: [p && /* @__PURE__ */ o(h, {
95
+ className: A.header,
96
+ children: p
97
+ }), e]
98
+ })
99
+ }))
100
+ })]
101
+ })
102
+ }) : null;
103
+ }, M = { header: "_header_1eyli_1" }, N = ({ className: e, ...n }) => /* @__PURE__ */ o("header", {
104
+ className: t(e, M.header),
105
+ ...n
106
+ });
107
+ export { T as a, D as i, j as n, C as o, O as r, x as s, N as t };
@@ -0,0 +1,14 @@
1
+ 'use client';
2
+ import e from "clsx";
3
+ import { createContext as t } from "react";
4
+ import { jsx as n } from "react/jsx-runtime";
5
+ import '../assets/navbar.css';// src/navbar/NavbarContext.tsx
6
+ var r = t(void 0), i = { navbar: "_navbar_1e334_1" }, a = ({ className: t, children: a, ...o }) => /* @__PURE__ */ n("footer", {
7
+ className: e(t, i.navbar),
8
+ ...o,
9
+ children: /* @__PURE__ */ n(r.Provider, {
10
+ value: {},
11
+ children: a
12
+ })
13
+ });
14
+ export { r as n, a as t };
@@ -1,22 +1,22 @@
1
1
  'use client';
2
- import { r as e } from "./header-e8cJQ2fn.js";
3
- import { n as t } from "./sidebar-BiisYVkz.js";
4
- import { n } from "./navbar-DvYhmO3P.js";
2
+ import { r as e } from "./header-TQ-M_-se.js";
3
+ import { n as t } from "./sidebar-BBkPQ_Zq.js";
4
+ import { n } from "./navbar-id41g596.js";
5
5
  import r from "clsx";
6
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
7
- import { useContext as o } from "react";
6
+ import { useContext as i } from "react";
7
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
8
8
  import { Link as s, OverlayTriggerStateContext as c } from "react-aria-components";
9
9
  import { Collection as l, Focusable as u, Text as d, Tooltip as f, TooltipTrigger as p, clsx as m } from "@midas-ds/components";
10
- import '../assets/navigation.css';var h = { rootList: "_rootList_l3v98_1" }, g = ({ className: e, items: t, children: n, dependencies: r, idScope: a, addIdAndValue: o, ...s }) => /* @__PURE__ */ i("nav", {
10
+ import '../assets/navigation.css';var h = { rootList: "_rootList_l3v98_1" }, g = ({ className: e, items: t, children: n, dependencies: r, idScope: i, addIdAndValue: o, ...s }) => /* @__PURE__ */ a("nav", {
11
11
  className: e,
12
12
  ...s,
13
- children: /* @__PURE__ */ i("ul", {
13
+ children: /* @__PURE__ */ a("ul", {
14
14
  className: h.rootList,
15
- children: /* @__PURE__ */ i(l, {
15
+ children: /* @__PURE__ */ a(l, {
16
16
  items: t,
17
17
  children: n,
18
18
  dependencies: r,
19
- idScope: a,
19
+ idScope: i,
20
20
  addIdAndValue: o
21
21
  })
22
22
  })
@@ -24,15 +24,15 @@ import '../assets/navigation.css';var h = { rootList: "_rootList_l3v98_1" }, g =
24
24
  navigationHeader: "_navigationHeader_18u5f_1",
25
25
  collapsed: "_collapsed_18u5f_7"
26
26
  }, v = ({ className: e, ...n }) => {
27
- let r = o(t);
28
- return /* @__PURE__ */ i(d, {
27
+ let r = i(t);
28
+ return /* @__PURE__ */ a(d, {
29
29
  className: m(e, _.navigationHeader, { [_.collapsed]: r?.isCollapsed }),
30
30
  ...n
31
31
  });
32
32
  }, y = { navigationItem: "_navigationItem_1jt2l_1" }, b = ({ className: e, ...n }) => {
33
- let a = o(t);
34
- return /* @__PURE__ */ i("li", {
35
- className: r(e, y.navigationItem, { [y.collapsed]: a?.isCollapsed }),
33
+ let o = i(t);
34
+ return /* @__PURE__ */ a("li", {
35
+ className: r(e, y.navigationItem, { [y.collapsed]: o?.isCollapsed }),
36
36
  ...n
37
37
  });
38
38
  }, x = {
@@ -42,12 +42,12 @@ import '../assets/navigation.css';var h = { rootList: "_rootList_l3v98_1" }, g =
42
42
  navbar: "_navbar_7oo3n_56",
43
43
  title: "_title_7oo3n_85"
44
44
  }, S = ({ as: r, children: l, className: d, isActive: h, isDisabled: g, icon: _, "aria-label": v, ...y }) => {
45
- let b = o(e), S = o(t), C = o(n), w = S?.isCollapsed, T = o(c), E = r || s, D = () => {
45
+ let b = i(e), S = i(t), C = i(n), w = S?.isCollapsed, T = i(c), E = r || s, D = () => {
46
46
  T?.isOpen && T?.setOpen(!1);
47
47
  }, O = typeof l == "string" ? l : void 0;
48
- return !O && !v && process.env.NODE_ENV !== "production" && console.warn("An 'aria-label' is required for <NavigationLink> elements with non plain text children"), /* @__PURE__ */ a(p, {
48
+ return !O && !v && process.env.NODE_ENV !== "production" && console.warn("An 'aria-label' is required for <NavigationLink> elements with non plain text children"), /* @__PURE__ */ o(p, {
49
49
  isDisabled: !w || !O && !v,
50
- children: [/* @__PURE__ */ i(u, { children: /* @__PURE__ */ a(E, {
50
+ children: [/* @__PURE__ */ a(u, { children: /* @__PURE__ */ o(E, {
51
51
  "aria-current": h && "page",
52
52
  "aria-label": v || (w ? O : void 0),
53
53
  className: m(d, x.navigationLink, {
@@ -70,11 +70,11 @@ import '../assets/navigation.css';var h = { rootList: "_rootList_l3v98_1" }, g =
70
70
  }
71
71
  },
72
72
  ...y,
73
- children: [_, /* @__PURE__ */ i("span", {
73
+ children: [_, /* @__PURE__ */ a("span", {
74
74
  className: x.title,
75
75
  children: l
76
76
  })]
77
- }) }), /* @__PURE__ */ i(f, {
77
+ }) }), /* @__PURE__ */ a(f, {
78
78
  placement: "right",
79
79
  children: O
80
80
  })]
@@ -83,20 +83,20 @@ import '../assets/navigation.css';var h = { rootList: "_rootList_l3v98_1" }, g =
83
83
  navigationSection: "_navigationSection_1ae77_1",
84
84
  collapsed: "_collapsed_1ae77_5"
85
85
  }, w = ({ className: e, title: n, ...s }) => {
86
- let c = o(t);
87
- return /* @__PURE__ */ a(b, { children: [n && /* @__PURE__ */ i(v, { children: n }), /* @__PURE__ */ i("ul", {
86
+ let c = i(t);
87
+ return /* @__PURE__ */ o(b, { children: [n && /* @__PURE__ */ a(v, { children: n }), /* @__PURE__ */ a("ul", {
88
88
  className: r(e, C.navigationSection, { [C.collapsed]: c?.isCollapsed }),
89
- children: /* @__PURE__ */ i(l, { ...s })
89
+ children: /* @__PURE__ */ a(l, { ...s })
90
90
  })] });
91
91
  }, T = {
92
92
  navigationSubMenu: "_navigationSubMenu_vfyl6_1",
93
93
  collapsed: "_collapsed_vfyl6_5"
94
- }, E = ({ className: e, children: n, items: a, ...s }) => {
95
- let c = o(t), { length: u } = Array.from(a || []);
96
- return typeof n == "function" && u === 0 ? null : /* @__PURE__ */ i("ul", {
94
+ }, E = ({ className: e, children: n, items: o, ...s }) => {
95
+ let c = i(t), { length: u } = Array.from(o || []);
96
+ return typeof n == "function" && u === 0 ? null : /* @__PURE__ */ a("ul", {
97
97
  className: r(e, T.navigationSubMenu, { [T.collapsed]: c?.isCollapsed }),
98
- children: /* @__PURE__ */ i(l, {
99
- items: a,
98
+ children: /* @__PURE__ */ a(l, {
99
+ items: o,
100
100
  ...s,
101
101
  children: n
102
102
  })
@@ -0,0 +1,158 @@
1
+ 'use client';
2
+ import e from "clsx";
3
+ import { createContext as t, forwardRef as n, useContext as r, useEffect as i, useRef as a, useState as o } from "react";
4
+ import { jsx as s, jsxs as c } from "react/jsx-runtime";
5
+ import { Button as l, Text as u, clsx as d, useLocalizedStringFormatter as f } from "@midas-ds/components";
6
+ import { X as p } from "lucide-react";
7
+ import { useControlledState as m } from "@react-stately/utils";
8
+ import { filterDOMProps as h, useEnterAnimation as g, useExitAnimation as _, useObjectRef as v } from "@react-aria/utils";
9
+ import '../assets/panel.css';var y = { panelBody: "_panelBody_1p0jk_1" }, b = n(({ className: t, ...n }, r) => /* @__PURE__ */ s("aside", {
10
+ ref: r,
11
+ className: e(t, y.panelBody),
12
+ ...n
13
+ })), x = { panelContent: "_panelContent_1gfrc_1" }, S = n(({ className: t, ...n }, r) => /* @__PURE__ */ s("div", {
14
+ ref: r,
15
+ tabIndex: 0,
16
+ className: e(t, x.panelContent),
17
+ ...n
18
+ })), C = { panelHeader: "_panelHeader_1g1ux_1" }, w = ({ className: t, ...n }) => /* @__PURE__ */ s("div", {
19
+ className: e(t, C.panelHeader),
20
+ ...n
21
+ }), T = { panelTitle: "_panelTitle_w7y4m_1" }, E = ({ className: e, title: t, ...n }) => /* @__PURE__ */ s(u, {
22
+ className: d(e, T.panelTitle),
23
+ ...n,
24
+ children: t
25
+ }), D = {
26
+ en: { closePanel: "Close panel" },
27
+ sv: { closePanel: "Stäng panel" }
28
+ }, O = {
29
+ panel: "_panel_1pcue_6",
30
+ promote: "_promote_1pcue_1",
31
+ "slide-horizontally": "_slide-horizontally_1pcue_1",
32
+ "slide-vertically": "_slide-vertically_1pcue_1",
33
+ panelActions: "_panelActions_1pcue_63",
34
+ panelTitle: "_panelTitle_1pcue_69"
35
+ }, k = (e) => {
36
+ let { onExited: t } = e, [n, r] = m(e.isOpen, e.defaultOpen || !1, e.onOpenChange), o = a(null), c = _(o, n);
37
+ return i(() => {
38
+ !n && !c && t?.();
39
+ }, [
40
+ n,
41
+ c,
42
+ t
43
+ ]), !n && !c ? null : /* @__PURE__ */ s(A, {
44
+ isExiting: c,
45
+ onPress: () => r((e) => !e),
46
+ ref: o,
47
+ ...e
48
+ });
49
+ }, A = n(({ className: t, title: n, actions: r, onPress: i, children: a, isExiting: o, defaultOpen: u, promoting: d, onPromotionEnd: m, "aria-hidden": _, ...y }, x) => {
50
+ let C = f(D), T = v(x), k = g(T, !u);
51
+ return /* @__PURE__ */ c(b, {
52
+ "aria-hidden": _ || void 0,
53
+ "aria-label": n,
54
+ className: e(t, O.panel),
55
+ ref: T,
56
+ "data-entering": k || void 0,
57
+ "data-exiting": o || void 0,
58
+ "data-promoting": d || void 0,
59
+ onAnimationEnd: (e) => {
60
+ e.target === e.currentTarget && d && m?.();
61
+ },
62
+ ...h(y),
63
+ children: [/* @__PURE__ */ c(w, { children: [/* @__PURE__ */ s(E, {
64
+ className: O.panelTitle,
65
+ title: n
66
+ }), /* @__PURE__ */ c("div", {
67
+ className: O.panelActions,
68
+ children: [r, /* @__PURE__ */ s(l, {
69
+ "aria-label": C.format("closePanel"),
70
+ onPress: i,
71
+ size: "medium",
72
+ variant: "icon",
73
+ children: /* @__PURE__ */ s(p, { size: 20 })
74
+ })]
75
+ })] }), /* @__PURE__ */ s(S, { children: a })]
76
+ });
77
+ }), j = (e) => null;
78
+ j.displayName = "usePanels";
79
+ var M = t({
80
+ panels: [],
81
+ panelVariant: "overlay",
82
+ addPanel: () => {},
83
+ closePanel: () => {},
84
+ removePanel: () => {},
85
+ resetPromoting: () => {}
86
+ }), N = ({ children: e, defaultPanels: t = [], panelBehavior: n = "replace", panelVariant: r = "overlay" }) => {
87
+ let [i, a] = o(t.map((e) => ({
88
+ ...e,
89
+ isOpen: !0,
90
+ defaultOpen: !0
91
+ })));
92
+ return /* @__PURE__ */ s(M.Provider, {
93
+ value: {
94
+ panels: i,
95
+ panelVariant: r,
96
+ addPanel: (e) => {
97
+ a((t) => {
98
+ if (n === "replace") return [{
99
+ ...e,
100
+ isOpen: !0
101
+ }];
102
+ let r = t.findIndex((t) => t.id === e.id);
103
+ if (r === -1) return [...t, {
104
+ ...e,
105
+ isOpen: !0
106
+ }];
107
+ if (n === "bring-to-front") {
108
+ if (r === t.length - 1) return t;
109
+ let n = t[r];
110
+ return [...t.filter((t) => t.id !== e.id), {
111
+ ...n,
112
+ isOpen: !0,
113
+ promoting: !0
114
+ }];
115
+ }
116
+ return n === "pop-to" ? t.map((e, t) => t > r ? {
117
+ ...e,
118
+ isOpen: !1
119
+ } : e) : t;
120
+ });
121
+ },
122
+ closePanel: (e) => {
123
+ a((t) => t.map((t) => t.id === e ? {
124
+ ...t,
125
+ isOpen: !1
126
+ } : t));
127
+ },
128
+ removePanel: (e) => {
129
+ a((t) => t.filter((t) => t.id !== e));
130
+ },
131
+ resetPromoting: (e) => {
132
+ a((t) => t.map((t) => t.id === e ? {
133
+ ...t,
134
+ promoting: !1
135
+ } : t));
136
+ }
137
+ },
138
+ children: e
139
+ });
140
+ }, P = () => r(M), F = { push: "_push_1cgpk_1" }, I = ({ children: t, className: n, ...r }) => {
141
+ let { panels: i, panelVariant: a, closePanel: o, removePanel: l, resetPromoting: u } = P(), d = i.length > 0;
142
+ return /* @__PURE__ */ c("div", {
143
+ className: e(n, a === "push" && F.push),
144
+ "data-open": a === "push" && d ? !0 : void 0,
145
+ ...r,
146
+ children: [i.map(({ id: e, ...t }, n, { length: r }) => /* @__PURE__ */ s(k, {
147
+ "aria-hidden": n < r - 1 || void 0,
148
+ id: e,
149
+ onOpenChange: (t) => {
150
+ t || o(e);
151
+ },
152
+ onExited: () => l(e),
153
+ onPromotionEnd: () => u(e),
154
+ ...t
155
+ }, e)), t]
156
+ });
157
+ };
158
+ export { j as a, w as c, M as i, S as l, P as n, k as o, N as r, E as s, I as t, b as u };
@@ -1,9 +1,9 @@
1
1
  'use client';
2
- import { c as e, l as t, s as n, u as r } from "./panel-BV_6hHfz.js";
2
+ import { c as e, l as t, s as n, u as r } from "./panel-CqbYAkzK.js";
3
3
  import { useIsMobileDevice as i } from "../utils/index.js";
4
4
  import a from "clsx";
5
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
6
- import c, { createContext as l } from "react";
5
+ import o, { createContext as s } from "react";
6
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
7
  import { Button as u, useLocalizedStringFormatter as d } from "@midas-ds/components";
8
8
  import { PanelLeftClose as f } from "lucide-react";
9
9
  import { useControlledState as p } from "@react-stately/utils";
@@ -17,44 +17,44 @@ import '../assets/sidebar.css';var h = {
17
17
  expandSidebar: "Expandera sidopanel",
18
18
  collapseSidebar: "Minimera sidopanel"
19
19
  }
20
- }, g = l(void 0), _ = {
20
+ }, g = s(void 0), _ = {
21
21
  sidebar: "_sidebar_ckap9_1",
22
22
  collapsed: "_collapsed_ckap9_8",
23
23
  sidebarHeader: "_sidebarHeader_ckap9_20",
24
24
  sidebarTitle: "_sidebarTitle_ckap9_29",
25
25
  collapseButton: "_collapseButton_ckap9_47",
26
26
  sidebarContent: "_sidebarContent_ckap9_55"
27
- }, v = ({ children: l, className: v, title: y, ...b }) => {
28
- let x = d(h), S = i(), [C, w] = p(b.isCollapsed, b.defaultCollapsed || !1, b.onCollapseChange), [T, E] = c.useState(!1), D = () => {
27
+ }, v = ({ children: s, className: v, title: y, ...b }) => {
28
+ let x = d(h), S = i(), [C, w] = p(b.isCollapsed, b.defaultCollapsed || !1, b.onCollapseChange), [T, E] = o.useState(!1), D = () => {
29
29
  E(!0), w((e) => !e);
30
30
  }, O = (e) => {
31
31
  e.propertyName === "width" && e.target === e.currentTarget && E(!1);
32
32
  };
33
- return S ? null : /* @__PURE__ */ o(g.Provider, {
33
+ return S ? null : /* @__PURE__ */ c(g.Provider, {
34
34
  value: { isCollapsed: C },
35
- children: /* @__PURE__ */ s(r, {
35
+ children: /* @__PURE__ */ l(r, {
36
36
  className: a(v, _.sidebar, { [_.collapsed]: C }),
37
37
  "data-transitioning": T || void 0,
38
38
  onTransitionEnd: O,
39
39
  ...m(b, { propNames: /* @__PURE__ */ new Set(["style"]) }),
40
- children: [/* @__PURE__ */ s(e, {
40
+ children: [/* @__PURE__ */ l(e, {
41
41
  className: a(_.sidebarHeader, { [_.collapsed]: C }),
42
- children: [/* @__PURE__ */ o(n, {
42
+ children: [/* @__PURE__ */ c(n, {
43
43
  className: a(_.sidebarTitle, { [_.collapsed]: C }),
44
44
  title: y
45
- }), /* @__PURE__ */ o(u, {
45
+ }), /* @__PURE__ */ c(u, {
46
46
  "aria-label": C ? x.format("expandSidebar") : x.format("collapseSidebar"),
47
47
  onPress: D,
48
48
  variant: "icon",
49
49
  size: "medium",
50
- children: /* @__PURE__ */ o("span", {
50
+ children: /* @__PURE__ */ c("span", {
51
51
  className: a(_.collapseButton, { [_.collapsed]: C }),
52
- children: /* @__PURE__ */ o(f, { size: 20 })
52
+ children: /* @__PURE__ */ c(f, { size: 20 })
53
53
  })
54
54
  })]
55
- }), /* @__PURE__ */ o(t, {
55
+ }), /* @__PURE__ */ c(t, {
56
56
  className: _.sidebarContent,
57
- children: l
57
+ children: s
58
58
  })]
59
59
  })
60
60
  });
@@ -1,6 +1,13 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { ButtonProps } from '@midas-ds/components';
3
- export interface HeaderActionProps extends Omit<ButtonProps, 'icon'> {
3
+ export interface HeaderActionProps extends Omit<ButtonProps, 'icon' | 'size' | 'variant'> {
4
+ /** The action's icon, 20px, e.g. `<Bell size={20} />` */
4
5
  icon?: ReactNode;
6
+ /**
7
+ * The label. In horizontal HeaderActions it's hidden on small screens,
8
+ * where only the icon shows, but screen readers still read it. Without a
9
+ * label, give the action an `aria-label`
10
+ */
11
+ children?: ButtonProps['children'];
5
12
  }
6
13
  export declare const HeaderAction: import('react').ForwardRefExoticComponent<HeaderActionProps & import('react').RefAttributes<HTMLButtonElement>>;
@@ -2,5 +2,13 @@ import { ReactNode } from 'react';
2
2
  export interface HeaderActionsProps {
3
3
  children?: ReactNode;
4
4
  className?: string;
5
+ /**
6
+ * Places each action's label next to its icon, or below it. On small
7
+ * screens horizontal actions show only their icons, while vertical actions
8
+ * keep their labels
9
+ *
10
+ * @default 'horizontal'
11
+ */
12
+ orientation?: 'horizontal' | 'vertical';
5
13
  }
6
- export declare const HeaderActions: ({ children, className }: HeaderActionsProps) => import('react').JSX.Element;
14
+ export declare const HeaderActions: ({ children, className, orientation, }: HeaderActionsProps) => import('react').JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { HeaderActionsProps } from './HeaderActions';
2
+ export interface HeaderActionsContextValue {
3
+ orientation: NonNullable<HeaderActionsProps['orientation']>;
4
+ }
5
+ export declare const HeaderActionsContext: import('react').Context<HeaderActionsContextValue>;
@@ -1,4 +1,10 @@
1
1
  export interface HeaderLogoProps {
2
+ /**
3
+ * Shows the logo in its primary colour, set to false for the monochrome
4
+ * version
5
+ *
6
+ * @default true
7
+ */
2
8
  primary?: boolean;
3
9
  }
4
10
  export declare const HeaderLogo: ({ primary }: HeaderLogoProps) => import('react').JSX.Element;
package/header/index.js CHANGED
@@ -1 +1 @@
1
- export { t as Header, o as HeaderAction, s as HeaderActions, a as HeaderLogo, i as HeaderTitle, n as MobileMenu, r as MobileMenuContext } from "../chunks/header-e8cJQ2fn.js";
1
+ export { t as Header, o as HeaderAction, s as HeaderActions, a as HeaderLogo, i as HeaderTitle, n as MobileMenu, r as MobileMenuContext } from "../chunks/header-TQ-M_-se.js";
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
- import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./chunks/header-e8cJQ2fn.js";
1
+ import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./chunks/header-TQ-M_-se.js";
2
2
  import { n as s, t as c } from "./chunks/layout-jiT-ZRLF.js";
3
3
  import { t as l } from "./chunks/main-_ZnOv-d9.js";
4
- import { a as u, i as d, n as f, o as p, r as m, t as h } from "./chunks/navigation-C1_HK8zc.js";
5
- import { a as g, c as _, i as v, l as y, n as b, o as x, r as S, s as C, t as w, u as T } from "./chunks/panel-BV_6hHfz.js";
6
- import { n as E, t as D } from "./chunks/sidebar-BiisYVkz.js";
7
- import { n as O, t as k } from "./chunks/navbar-DvYhmO3P.js";
4
+ import { a as u, i as d, n as f, o as p, r as m, t as h } from "./chunks/navigation-CR32NHYQ.js";
5
+ import { a as g, c as _, i as v, l as y, n as b, o as x, r as S, s as C, t as w, u as T } from "./chunks/panel-CqbYAkzK.js";
6
+ import { n as E, t as D } from "./chunks/sidebar-BBkPQ_Zq.js";
7
+ import { n as O, t as k } from "./chunks/navbar-id41g596.js";
8
8
  export { o as Header, r as HeaderAction, a as HeaderActions, e as HeaderLogo, t as HeaderTitle, s as Layout, c as LayoutContent, l as Main, n as MobileMenu, i as MobileMenuContext, k as Navbar, O as NavbarContext, p as Navigation, u as NavigationHeader, d as NavigationItem, m as NavigationLink, f as NavigationSection, h as NavigationSubMenu, x as Panel, T as PanelBody, y as PanelContent, v as PanelContext, _ as PanelHeader, S as PanelProvider, w as PanelRegion, C as PanelTitle, D as Sidebar, E as SidebarContext, g as UsePanels, b as usePanels };
package/navbar/index.js CHANGED
@@ -1 +1 @@
1
- export { t as Navbar, n as NavbarContext } from "../chunks/navbar-DvYhmO3P.js";
1
+ export { t as Navbar, n as NavbarContext } from "../chunks/navbar-id41g596.js";
@@ -1 +1 @@
1
- export { o as Navigation, a as NavigationHeader, i as NavigationItem, r as NavigationLink, n as NavigationSection, t as NavigationSubMenu } from "../chunks/navigation-C1_HK8zc.js";
1
+ export { o as Navigation, a as NavigationHeader, i as NavigationItem, r as NavigationLink, n as NavigationSection, t as NavigationSubMenu } from "../chunks/navigation-CR32NHYQ.js";
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "description": "Midas Layout components",
15
15
  "homepage": "https://designsystem.migrationsverket.se/",
16
16
  "license": "CC0-1.0",
17
- "version": "0.2.76",
17
+ "version": "0.2.78",
18
18
  "module": "./index.js",
19
19
  "type": "module",
20
20
  "main": "./index.js",
@@ -41,7 +41,7 @@
41
41
  "react-dom": "^18.3.1 || ^19.0.0"
42
42
  },
43
43
  "dependencies": {
44
- "@midas-ds/components": "17.38.3",
44
+ "@midas-ds/components": "17.39.0",
45
45
  "@react-aria/utils": "3.34.1",
46
46
  "@react-stately/utils": "3.12.1",
47
47
  "lucide-react": ">=0.563.0 <2.0.0",
package/panel/index.js CHANGED
@@ -1 +1 @@
1
- export { o as Panel, u as PanelBody, l as PanelContent, i as PanelContext, c as PanelHeader, r as PanelProvider, t as PanelRegion, s as PanelTitle, a as UsePanels, n as usePanels } from "../chunks/panel-BV_6hHfz.js";
1
+ export { o as Panel, u as PanelBody, l as PanelContent, i as PanelContext, c as PanelHeader, r as PanelProvider, t as PanelRegion, s as PanelTitle, a as UsePanels, n as usePanels } from "../chunks/panel-CqbYAkzK.js";
package/sidebar/index.js CHANGED
@@ -1 +1 @@
1
- export { t as Sidebar, n as SidebarContext } from "../chunks/sidebar-BiisYVkz.js";
1
+ export { t as Sidebar, n as SidebarContext } from "../chunks/sidebar-BBkPQ_Zq.js";
@@ -1,97 +0,0 @@
1
- 'use client';
2
- import { useIsMobileDevice as e } from "../utils/index.js";
3
- import t from "clsx";
4
- import { Fragment as n, jsx as r, jsxs as i } from "react/jsx-runtime";
5
- import { createContext as a, forwardRef as o } from "react";
6
- import { Dialog as s, Modal as c, composeRenderProps as l } from "react-aria-components";
7
- import { Button as u, DialogTrigger as d, Logo as f, ModalOverlay as p, Text as m, clsx as h, useLocalizedStringFormatter as g } from "@midas-ds/components";
8
- import { Menu as _ } from "lucide-react";
9
- import '../assets/header.css';var v = { headerActions: "_headerActions_zpqnd_1" }, y = ({ children: e, className: n }) => /* @__PURE__ */ r("div", {
10
- className: t(v.headerActions, n),
11
- children: e
12
- }), b = {
13
- headerAction: "_headerAction_15afi_1",
14
- label: "_label_15afi_7"
15
- }, x = o(({ children: e, icon: a, className: o, ...s }, c) => (!e && !s["aria-label"] && process.env.NODE_ENV !== "production" && console.warn("Please provide an 'aria-label' for HeaderAction components that doesnt have a visible label (children)"), /* @__PURE__ */ r(u, {
16
- ref: c,
17
- size: "medium",
18
- variant: "tertiary",
19
- className: t(b.headerAction, o),
20
- ...s,
21
- children: l(e, (e) => /* @__PURE__ */ i(n, { children: [a, e !== void 0 && /* @__PURE__ */ r("span", {
22
- className: b.label,
23
- children: e
24
- })] }))
25
- })));
26
- x.displayName = "HeaderAction";
27
- var S = {
28
- mobile: "_mobile_6rcng_4",
29
- desktop: "_desktop_6rcng_5",
30
- mobileLogo: "_mobileLogo_6rcng_21",
31
- desktopLogo: "_desktopLogo_6rcng_27"
32
- }, C = ({ primary: e }) => /* @__PURE__ */ i(n, { children: [/* @__PURE__ */ r("div", {
33
- className: S.mobile,
34
- children: /* @__PURE__ */ r(f, {
35
- size: "x-small",
36
- primary: e,
37
- padding: !1,
38
- className: S.mobileLogo
39
- })
40
- }), /* @__PURE__ */ r("div", {
41
- className: S.desktop,
42
- children: /* @__PURE__ */ r(f, {
43
- size: "small",
44
- primary: e,
45
- padding: !1,
46
- className: S.desktopLogo
47
- })
48
- })] }), w = { headerTitle: "_headerTitle_cw9hi_1" }, T = ({ className: e, ...n }) => /* @__PURE__ */ r("span", {
49
- className: t(w.headerTitle, e),
50
- ...n
51
- }), E = a(void 0), D = {
52
- en: { openMenu: "Open menu" },
53
- sv: { openMenu: "Öppna meny" }
54
- }, O = {
55
- triggerButton: "_triggerButton_3t5en_1",
56
- overlay: "_overlay_3t5en_5",
57
- "drawer-blur": "_drawer-blur_3t5en_1",
58
- drawer: "_drawer_3t5en_25",
59
- "drawer-slide": "_drawer-slide_3t5en_1",
60
- dialog: "_dialog_3t5en_57",
61
- header: "_header_3t5en_63"
62
- }, k = ({ children: t, className: n, defaultOpen: a, isOpen: o, onOpenChange: f, title: v, ...y }) => {
63
- let b = e(), x = g(D);
64
- return b ? /* @__PURE__ */ r(E.Provider, {
65
- value: {},
66
- children: /* @__PURE__ */ i(d, {
67
- isOpen: o,
68
- onOpenChange: f,
69
- defaultOpen: a,
70
- children: [/* @__PURE__ */ r(u, {
71
- "aria-label": x.format("openMenu"),
72
- icon: _,
73
- variant: "icon",
74
- size: "medium",
75
- className: O.triggerButton
76
- }), /* @__PURE__ */ r(p, {
77
- className: h(n, O.overlay),
78
- isDismissable: !0,
79
- ...y,
80
- children: l(t, (e) => /* @__PURE__ */ r(c, {
81
- className: O.drawer,
82
- children: /* @__PURE__ */ i(s, {
83
- className: O.dialog,
84
- children: [v && /* @__PURE__ */ r(m, {
85
- className: O.header,
86
- children: v
87
- }), e]
88
- })
89
- }))
90
- })]
91
- })
92
- }) : null;
93
- }, A = { header: "_header_s0sjn_1" }, j = ({ className: e, ...n }) => /* @__PURE__ */ r("header", {
94
- className: t(e, A.header),
95
- ...n
96
- });
97
- export { C as a, T as i, k as n, x as o, E as r, y as s, j as t };
@@ -1,14 +0,0 @@
1
- 'use client';
2
- import e from "clsx";
3
- import { jsx as t } from "react/jsx-runtime";
4
- import { createContext as n } from "react";
5
- import '../assets/navbar.css';// src/navbar/NavbarContext.tsx
6
- var r = n(void 0), i = { navbar: "_navbar_1e334_1" }, a = ({ className: n, children: a, ...o }) => /* @__PURE__ */ t("footer", {
7
- className: e(n, i.navbar),
8
- ...o,
9
- children: /* @__PURE__ */ t(r.Provider, {
10
- value: {},
11
- children: a
12
- })
13
- });
14
- export { r as n, a as t };
@@ -1,158 +0,0 @@
1
- 'use client';
2
- import e from "clsx";
3
- import { jsx as t, jsxs as n } from "react/jsx-runtime";
4
- import { createContext as r, forwardRef as i, useContext as a, useEffect as o, useRef as s, useState as c } from "react";
5
- import { Button as l, Text as u, clsx as d, useLocalizedStringFormatter as f } from "@midas-ds/components";
6
- import { X as p } from "lucide-react";
7
- import { useControlledState as m } from "@react-stately/utils";
8
- import { filterDOMProps as h, useEnterAnimation as g, useExitAnimation as _, useObjectRef as v } from "@react-aria/utils";
9
- import '../assets/panel.css';var y = { panelBody: "_panelBody_1p0jk_1" }, b = i(({ className: n, ...r }, i) => /* @__PURE__ */ t("aside", {
10
- ref: i,
11
- className: e(n, y.panelBody),
12
- ...r
13
- })), x = { panelContent: "_panelContent_1gfrc_1" }, S = i(({ className: n, ...r }, i) => /* @__PURE__ */ t("div", {
14
- ref: i,
15
- tabIndex: 0,
16
- className: e(n, x.panelContent),
17
- ...r
18
- })), C = { panelHeader: "_panelHeader_1g1ux_1" }, w = ({ className: n, ...r }) => /* @__PURE__ */ t("div", {
19
- className: e(n, C.panelHeader),
20
- ...r
21
- }), T = { panelTitle: "_panelTitle_w7y4m_1" }, E = ({ className: e, title: n, ...r }) => /* @__PURE__ */ t(u, {
22
- className: d(e, T.panelTitle),
23
- ...r,
24
- children: n
25
- }), D = {
26
- en: { closePanel: "Close panel" },
27
- sv: { closePanel: "Stäng panel" }
28
- }, O = {
29
- panel: "_panel_1pcue_6",
30
- promote: "_promote_1pcue_1",
31
- "slide-horizontally": "_slide-horizontally_1pcue_1",
32
- "slide-vertically": "_slide-vertically_1pcue_1",
33
- panelActions: "_panelActions_1pcue_63",
34
- panelTitle: "_panelTitle_1pcue_69"
35
- }, k = (e) => {
36
- let { onExited: n } = e, [r, i] = m(e.isOpen, e.defaultOpen || !1, e.onOpenChange), a = s(null), c = _(a, r);
37
- return o(() => {
38
- !r && !c && n?.();
39
- }, [
40
- r,
41
- c,
42
- n
43
- ]), !r && !c ? null : /* @__PURE__ */ t(A, {
44
- isExiting: c,
45
- onPress: () => i((e) => !e),
46
- ref: a,
47
- ...e
48
- });
49
- }, A = i(({ className: r, title: i, actions: a, onPress: o, children: s, isExiting: c, defaultOpen: u, promoting: d, onPromotionEnd: m, "aria-hidden": _, ...y }, x) => {
50
- let C = f(D), T = v(x), k = g(T, !u);
51
- return /* @__PURE__ */ n(b, {
52
- "aria-hidden": _ || void 0,
53
- "aria-label": i,
54
- className: e(r, O.panel),
55
- ref: T,
56
- "data-entering": k || void 0,
57
- "data-exiting": c || void 0,
58
- "data-promoting": d || void 0,
59
- onAnimationEnd: (e) => {
60
- e.target === e.currentTarget && d && m?.();
61
- },
62
- ...h(y),
63
- children: [/* @__PURE__ */ n(w, { children: [/* @__PURE__ */ t(E, {
64
- className: O.panelTitle,
65
- title: i
66
- }), /* @__PURE__ */ n("div", {
67
- className: O.panelActions,
68
- children: [a, /* @__PURE__ */ t(l, {
69
- "aria-label": C.format("closePanel"),
70
- onPress: o,
71
- size: "medium",
72
- variant: "icon",
73
- children: /* @__PURE__ */ t(p, { size: 20 })
74
- })]
75
- })] }), /* @__PURE__ */ t(S, { children: s })]
76
- });
77
- }), j = (e) => null;
78
- j.displayName = "usePanels";
79
- var M = r({
80
- panels: [],
81
- panelVariant: "overlay",
82
- addPanel: () => {},
83
- closePanel: () => {},
84
- removePanel: () => {},
85
- resetPromoting: () => {}
86
- }), N = ({ children: e, defaultPanels: n = [], panelBehavior: r = "replace", panelVariant: i = "overlay" }) => {
87
- let [a, o] = c(n.map((e) => ({
88
- ...e,
89
- isOpen: !0,
90
- defaultOpen: !0
91
- })));
92
- return /* @__PURE__ */ t(M.Provider, {
93
- value: {
94
- panels: a,
95
- panelVariant: i,
96
- addPanel: (e) => {
97
- o((t) => {
98
- if (r === "replace") return [{
99
- ...e,
100
- isOpen: !0
101
- }];
102
- let n = t.findIndex((t) => t.id === e.id);
103
- if (n === -1) return [...t, {
104
- ...e,
105
- isOpen: !0
106
- }];
107
- if (r === "bring-to-front") {
108
- if (n === t.length - 1) return t;
109
- let r = t[n];
110
- return [...t.filter((t) => t.id !== e.id), {
111
- ...r,
112
- isOpen: !0,
113
- promoting: !0
114
- }];
115
- }
116
- return r === "pop-to" ? t.map((e, t) => t > n ? {
117
- ...e,
118
- isOpen: !1
119
- } : e) : t;
120
- });
121
- },
122
- closePanel: (e) => {
123
- o((t) => t.map((t) => t.id === e ? {
124
- ...t,
125
- isOpen: !1
126
- } : t));
127
- },
128
- removePanel: (e) => {
129
- o((t) => t.filter((t) => t.id !== e));
130
- },
131
- resetPromoting: (e) => {
132
- o((t) => t.map((t) => t.id === e ? {
133
- ...t,
134
- promoting: !1
135
- } : t));
136
- }
137
- },
138
- children: e
139
- });
140
- }, P = () => a(M), F = { push: "_push_1cgpk_1" }, I = ({ children: r, className: i, ...a }) => {
141
- let { panels: o, panelVariant: s, closePanel: c, removePanel: l, resetPromoting: u } = P(), d = o.length > 0;
142
- return /* @__PURE__ */ n("div", {
143
- className: e(i, s === "push" && F.push),
144
- "data-open": s === "push" && d ? !0 : void 0,
145
- ...a,
146
- children: [o.map(({ id: e, ...n }, r, { length: i }) => /* @__PURE__ */ t(k, {
147
- "aria-hidden": r < i - 1 || void 0,
148
- id: e,
149
- onOpenChange: (t) => {
150
- t || c(e);
151
- },
152
- onExited: () => l(e),
153
- onPromotionEnd: () => u(e),
154
- ...n
155
- }, e)), r]
156
- });
157
- };
158
- export { j as a, w as c, M as i, S as l, P as n, k as o, N as r, E as s, I as t, b as u };