@midas-ds/layout 0.0.12 → 0.0.14

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,18 @@
1
+ ## 0.0.14 (2026-03-16)
2
+
3
+ ### 🧱 Updated Dependencies
4
+
5
+ - Updated components to 17.8.2
6
+
7
+ ## 0.0.13 (2026-03-13)
8
+
9
+ ### 🩹 Fixes
10
+
11
+ - **layout,panel:** suppress animation for prefers-reduced-motion ([b761e5d4f7](https://github.com/migrationsverket/midas/commit/b761e5d4f7))
12
+ - **layout:** add overflow hidden to content to prevent scrollbar during animation ([7078674395](https://github.com/migrationsverket/midas/commit/7078674395))
13
+ - **layout,panel:** add forwardRef to PanelBody for React 18 compat ([a0b06528a6](https://github.com/migrationsverket/midas/commit/a0b06528a6))
14
+ - **layout, panel:** add animations to dismiss-panel ([b0e8733489](https://github.com/migrationsverket/midas/commit/b0e8733489))
15
+
1
16
  ## 0.0.12 (2026-03-13)
2
17
 
3
18
  ### 🧱 Updated Dependencies
package/assets/Layout.css CHANGED
@@ -1 +1 @@
1
- ._layout_1v9xd_1{display:flex;flex-direction:column;font-family:var(--midas-typography-font-family);width:100%;height:100dvh}._content_1v9xd_9{display:flex;position:relative;height:100%}
1
+ ._layout_13ndd_1{display:flex;flex-direction:column;font-family:var(--midas-typography-font-family);width:100%;height:100dvh}._content_13ndd_9{display:flex;position:relative;height:100%;overflow:hidden}
package/assets/Main.css CHANGED
@@ -1 +1 @@
1
- ._main_4xsf9_1{box-sizing:border-box;flex:1 1 auto;min-width:0;height:100%;overflow-y:auto;padding:1rem}
1
+ ._main_vtpiw_1{box-sizing:border-box;flex:1 1 auto;min-width:0;height:100%;overflow:hidden auto;padding:1rem}
package/assets/Panel.css CHANGED
@@ -1 +1 @@
1
- ._collapsePanel_1uy7t_1{width:15rem}._collapsePanel_1uy7t_1._collapsed_1uy7t_4{width:80px}@media(max-width:640px){._collapsePanel_1uy7t_1{display:none}}._panelHeader_1uy7t_13{gap:0}._panelTitle_1uy7t_17{font-size:var(--midas-typography-font-size-20);display:block}._panelBody_1rrgz_1{background-color:var(--midas-background-base);box-sizing:border-box;padding:1rem;transition:width var(--midas-transition-duration-fast) ease-out;width:100%}._panelHeader_11qv1_1{align-items:center;display:flex;justify-content:space-between}._panelTitle_w7y4m_1{display:block}._dismissPanel_dpjsv_1{position:absolute!important;top:0;right:0;width:320px;height:100%}@media not (min-width:800px){._dismissPanel_dpjsv_1{bottom:0;width:100%;height:25%;left:0;top:unset}}._panelTitle_dpjsv_18{font-size:var(--midas-typography-font-size-20);display:block}
1
+ ._collapsePanel_1uy7t_1{width:15rem}._collapsePanel_1uy7t_1._collapsed_1uy7t_4{width:80px}@media(max-width:640px){._collapsePanel_1uy7t_1{display:none}}._panelHeader_1uy7t_13{gap:0}._panelTitle_1uy7t_17{font-size:var(--midas-typography-font-size-20);display:block}._panelBody_1rrgz_1{background-color:var(--midas-background-base);box-sizing:border-box;padding:1rem;transition:width var(--midas-transition-duration-fast) ease-out;width:100%}._panelHeader_11qv1_1{align-items:center;display:flex;justify-content:space-between}._panelTitle_w7y4m_1{display:block}._dismissPanel_1vxt8_1{position:absolute!important;top:0;right:0;width:320px;height:100%;overflow:hidden}._dismissPanel_1vxt8_1[data-entering]{animation:_slide-horizontally_1vxt8_1 var(--midas-transition-duration-fast)}._dismissPanel_1vxt8_1[data-exiting]{animation:_slide-horizontally_1vxt8_1 var(--midas-transition-duration-fast) reverse ease-in}@media(prefers-reduced-motion:reduce){._dismissPanel_1vxt8_1[data-entering],._dismissPanel_1vxt8_1[data-exiting]{animation-duration:1ms}}@media not (min-width:800px){._dismissPanel_1vxt8_1{bottom:0;width:100%;height:25%;left:0;top:unset}._dismissPanel_1vxt8_1[data-entering]{animation:_slide-vertically_1vxt8_1 var(--midas-transition-duration-fast)}._dismissPanel_1vxt8_1[data-exiting]{animation:_slide-vertically_1vxt8_1 var(--midas-transition-duration-fast) reverse ease-in}}._panelTitle_1vxt8_44{font-size:var(--midas-typography-font-size-20);display:block}@keyframes _slide-horizontally_1vxt8_1{0%{transform:translate(100%)}to{transform:translate(0)}}@keyframes _slide-vertically_1vxt8_1{0%{transform:translateY(100%)}to{transform:translateY(0)}}
@@ -1,5 +1,5 @@
1
1
  import { jsx as s } from "react/jsx-runtime";
2
- import '../assets/Layout.css';const c = "_layout_1v9xd_1", e = "_content_1v9xd_9", a = {
2
+ import '../assets/Layout.css';const c = "_layout_13ndd_1", e = "_content_13ndd_9", a = {
3
3
  layout: c,
4
4
  content: e
5
5
  }, y = ({ className: t, children: o, ...n }) => /* @__PURE__ */ s(
@@ -9,7 +9,7 @@ import '../assets/Layout.css';const c = "_layout_1v9xd_1", e = "_content_1v9xd_9
9
9
  ...n,
10
10
  children: o
11
11
  }
12
- ), u = ({ className: t, children: o, ...n }) => /* @__PURE__ */ s(
12
+ ), d = ({ className: t, children: o, ...n }) => /* @__PURE__ */ s(
13
13
  "div",
14
14
  {
15
15
  className: `${t ?? ""} ${a.layout}`,
@@ -18,6 +18,6 @@ import '../assets/Layout.css';const c = "_layout_1v9xd_1", e = "_content_1v9xd_9
18
18
  }
19
19
  );
20
20
  export {
21
- u as L,
21
+ d as L,
22
22
  y as a
23
23
  };
@@ -0,0 +1,13 @@
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import '../assets/Main.css';const i = "_main_vtpiw_1", m = {
3
+ main: i
4
+ }, o = ({ className: a, ...n }) => /* @__PURE__ */ s(
5
+ "main",
6
+ {
7
+ className: `${a} ${m.main}`,
8
+ ...n
9
+ }
10
+ );
11
+ export {
12
+ o as M
13
+ };
@@ -0,0 +1,167 @@
1
+ 'use client';
2
+ import { jsx as a, jsxs as r } from "react/jsx-runtime";
3
+ import { C as S, P as O } from "./PanelContext-D6WQ7_yb.js";
4
+ import { c as d, T as $ } from "./Text-B18MZHuN.js";
5
+ import { useControlledState as _ } from "@react-stately/utils";
6
+ import { u as B } from "./useIsMobileDevice-D0iMVFPx.js";
7
+ import { forwardRef as y, useRef as M } from "react";
8
+ import { c as P, u, B as x } from "./Button-7IYEsEeT.js";
9
+ import { useExitAnimation as z, useObjectRef as D, useEnterAnimation as E, filterDOMProps as H } from "@react-aria/utils";
10
+ import '../assets/Panel.css';const I = [
11
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
12
+ ["path", { d: "M9 3v18", key: "fh3hqa" }],
13
+ ["path", { d: "m16 15-3-3 3-3", key: "14y99z" }]
14
+ ], j = P("panel-left-close", I);
15
+ const w = [
16
+ ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
17
+ ["path", { d: "M9 3v18", key: "fh3hqa" }],
18
+ ["path", { d: "m14 9 3 3-3 3", key: "8010ee" }]
19
+ ], L = P("panel-left-open", w);
20
+ const R = [
21
+ ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
22
+ ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
23
+ ], q = P("x", R), A = { expandSidebar: "Expand sidebar", collapseSidebar: "Collapse sidebar", closePanel: "Close panel" }, F = { expandSidebar: "Expandera sidopanel", collapseSidebar: "Minimera sidopanel", closePanel: "Stäng panel" }, v = {
24
+ en: A,
25
+ sv: F
26
+ }, X = "_collapsePanel_1uy7t_1", G = "_collapsed_1uy7t_4", J = "_panelTitle_1uy7t_17", f = {
27
+ collapsePanel: X,
28
+ collapsed: G,
29
+ panelTitle: J
30
+ }, K = ({
31
+ children: e,
32
+ className: s,
33
+ isCollapsed: l,
34
+ defaultCollapsed: t = !1,
35
+ onCollapseChange: o,
36
+ title: i,
37
+ ...c
38
+ }) => {
39
+ const p = u(v), m = B(), [n, g] = _(
40
+ l,
41
+ t,
42
+ o
43
+ ), N = () => g((k) => !k);
44
+ return m ? null : /* @__PURE__ */ a(S.Provider, { value: { isCollapsed: n }, children: /* @__PURE__ */ r(
45
+ b,
46
+ {
47
+ className: d(s, f.collapsePanel, {
48
+ [f.collapsed]: n
49
+ }),
50
+ ...c,
51
+ children: [
52
+ /* @__PURE__ */ r(T, { children: [
53
+ /* @__PURE__ */ a("div", { children: !n && i && /* @__PURE__ */ a(
54
+ C,
55
+ {
56
+ className: f.panelTitle,
57
+ title: i
58
+ }
59
+ ) }),
60
+ /* @__PURE__ */ a(
61
+ x,
62
+ {
63
+ variant: "icon",
64
+ "aria-label": n ? p.format("expandSidebar") : p.format("collapseSidebar"),
65
+ onPress: N,
66
+ children: n ? /* @__PURE__ */ a(L, { size: 20 }) : /* @__PURE__ */ a(j, { size: 20 })
67
+ }
68
+ )
69
+ ] }),
70
+ e
71
+ ]
72
+ }
73
+ ) });
74
+ }, Q = "_panelBody_1rrgz_1", U = {
75
+ panelBody: Q
76
+ }, b = y(
77
+ ({ className: e, ...s }, l) => /* @__PURE__ */ a(
78
+ "aside",
79
+ {
80
+ ref: l,
81
+ className: d(e, U.panelBody),
82
+ ...s
83
+ }
84
+ )
85
+ ), V = "_panelHeader_11qv1_1", W = {
86
+ panelHeader: V
87
+ }, T = ({ className: e, ...s }) => /* @__PURE__ */ a(
88
+ "div",
89
+ {
90
+ className: d(e, W.panelHeader),
91
+ ...s
92
+ }
93
+ ), Y = "_panelTitle_w7y4m_1", Z = {
94
+ panelTitle: Y
95
+ }, C = ({ className: e, title: s, ...l }) => /* @__PURE__ */ a(
96
+ $,
97
+ {
98
+ className: d(e, Z.panelTitle),
99
+ ...l,
100
+ children: s
101
+ }
102
+ ), ee = "_dismissPanel_1vxt8_1", se = "_panelTitle_1vxt8_44", h = {
103
+ dismissPanel: ee,
104
+ panelTitle: se
105
+ }, ae = (e) => {
106
+ const [s, l] = _(
107
+ e.isOpen,
108
+ e.defaultOpen || !1,
109
+ e.onOpenChange
110
+ ), t = M(null), o = z(t, s), i = () => l((c) => !c);
111
+ return !s && !o ? null : /* @__PURE__ */ a(
112
+ le,
113
+ {
114
+ isExiting: o,
115
+ onPress: i,
116
+ ref: t,
117
+ ...e
118
+ }
119
+ );
120
+ }, le = y(({ className: e, title: s, onPress: l, children: t, isExiting: o, ...i }, c) => {
121
+ const p = u(v), m = D(c), n = E(m);
122
+ return /* @__PURE__ */ r(
123
+ b,
124
+ {
125
+ className: d(e, h.dismissPanel),
126
+ ref: m,
127
+ "data-entering": n || void 0,
128
+ "data-exiting": o || void 0,
129
+ ...H(i),
130
+ children: [
131
+ /* @__PURE__ */ r(T, { children: [
132
+ /* @__PURE__ */ a("div", { children: s && /* @__PURE__ */ a(
133
+ C,
134
+ {
135
+ className: h.panelTitle,
136
+ title: s
137
+ }
138
+ ) }),
139
+ /* @__PURE__ */ a(
140
+ x,
141
+ {
142
+ variant: "icon",
143
+ "aria-label": p.format("closePanel"),
144
+ onPress: l,
145
+ children: /* @__PURE__ */ a(q, { size: 20 })
146
+ }
147
+ )
148
+ ] }),
149
+ t
150
+ ]
151
+ }
152
+ );
153
+ }), me = ({
154
+ variant: e = "collapse",
155
+ ...s
156
+ }) => /* @__PURE__ */ r(O.Provider, { value: { variant: e }, children: [
157
+ e === "collapse" && /* @__PURE__ */ a(K, { ...s }),
158
+ e === "dismiss" && /* @__PURE__ */ a(ae, { ...s })
159
+ ] });
160
+ export {
161
+ K as C,
162
+ ae as D,
163
+ me as P,
164
+ b as a,
165
+ T as b,
166
+ C as c
167
+ };
package/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { H as o, a as s, b as t, M as n } from "./chunks/Header-DjegZbd1.js";
2
- import { L as r, a as l } from "./chunks/Layout-16EqvEZN.js";
3
- import { M as m } from "./chunks/Main-QnNDtP6N.js";
2
+ import { L as r, a as l } from "./chunks/Layout-bfQkpzAm.js";
3
+ import { M as m } from "./chunks/Main-DcX_nPtP.js";
4
4
  import { N as P, a as M, b as N, c as f, d as C, e as b } from "./chunks/NavigationSubMenu-CpS-A3-h.js";
5
- import { C as v, D as g, P as u, a as H, b as c, c as L } from "./chunks/Panel-BsVbn7nx.js";
5
+ import { C as v, D as g, P as u, a as H, b as c, c as L } from "./chunks/Panel-FbEePT8O.js";
6
6
  import { C as A, P as D } from "./chunks/PanelContext-D6WQ7_yb.js";
7
7
  import { N as k } from "./chunks/Navbar-wOOCcsru.js";
8
8
  import { M as I } from "./chunks/MobileMenuContext-Coj0sJ0N.js";
package/layout/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { L as t, a as L } from "../chunks/Layout-16EqvEZN.js";
1
+ import { L as t, a as L } from "../chunks/Layout-bfQkpzAm.js";
2
2
  export {
3
3
  t as Layout,
4
4
  L as LayoutContent
package/main/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { M as r } from "../chunks/Main-QnNDtP6N.js";
1
+ import { M as r } from "../chunks/Main-DcX_nPtP.js";
2
2
  export {
3
3
  r as Main
4
4
  };
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.0.12",
17
+ "version": "0.0.14",
18
18
  "module": "./index.js",
19
19
  "type": "module",
20
20
  "main": "./index.js",
@@ -36,6 +36,6 @@
36
36
  "./*": "./*/index.js"
37
37
  },
38
38
  "dependencies": {
39
- "@midas-ds/components": "17.8.1"
39
+ "@midas-ds/components": "17.8.2"
40
40
  }
41
41
  }
@@ -4,4 +4,4 @@ export interface DismissTriggerProps {
4
4
  defaultOpen?: boolean;
5
5
  onOpenChange?: (isOpen: boolean) => void;
6
6
  }
7
- export declare const DismissPanel: ({ children, className, isOpen: isOpenProp, defaultOpen, onOpenChange, title, ...rest }: PanelBodyProps & DismissTriggerProps) => import("react/jsx-runtime").JSX.Element | null;
7
+ export declare const DismissPanel: (props: PanelBodyProps & DismissTriggerProps) => import("react/jsx-runtime").JSX.Element | null;
package/panel/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as l, D as s, P as n, a as P, b as o, c as t } from "../chunks/Panel-BsVbn7nx.js";
1
+ import { C as l, D as s, P as n, a as P, b as o, c as t } from "../chunks/Panel-FbEePT8O.js";
2
2
  import { C as r, P as p } from "../chunks/PanelContext-D6WQ7_yb.js";
3
3
  export {
4
4
  l as CollapsePanel,
@@ -1,3 +1,3 @@
1
1
  import { DetailedHTMLProps, HTMLAttributes } from 'react';
2
2
  export type PanelBodyProps = DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
3
- export declare const PanelBody: ({ className, ...rest }: PanelBodyProps) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const PanelBody: import('react').ForwardRefExoticComponent<Omit<PanelBodyProps, "ref"> & import('react').RefAttributes<HTMLElement>>;
@@ -1,13 +0,0 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import '../assets/Main.css';const m = "_main_4xsf9_1", i = {
3
- main: m
4
- }, t = ({ className: s, ...a }) => /* @__PURE__ */ n(
5
- "main",
6
- {
7
- className: `${s} ${i.main}`,
8
- ...a
9
- }
10
- );
11
- export {
12
- t as M
13
- };
@@ -1,156 +0,0 @@
1
- 'use client';
2
- import { jsx as e, jsxs as t } from "react/jsx-runtime";
3
- import { C as S, P as g } from "./PanelContext-D6WQ7_yb.js";
4
- import { c as i, T as $ } from "./Text-B18MZHuN.js";
5
- import { useControlledState as v } from "@react-stately/utils";
6
- import { u as B } from "./useIsMobileDevice-D0iMVFPx.js";
7
- import { c as y, u, B as x } from "./Button-7IYEsEeT.js";
8
- import '../assets/Panel.css';const z = [
9
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
10
- ["path", { d: "M9 3v18", key: "fh3hqa" }],
11
- ["path", { d: "m16 15-3-3 3-3", key: "14y99z" }]
12
- ], M = y("panel-left-close", z);
13
- const H = [
14
- ["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", key: "afitv7" }],
15
- ["path", { d: "M9 3v18", key: "fh3hqa" }],
16
- ["path", { d: "m14 9 3 3-3 3", key: "8010ee" }]
17
- ], j = y("panel-left-open", H);
18
- const D = [
19
- ["path", { d: "M18 6 6 18", key: "1bl5f8" }],
20
- ["path", { d: "m6 6 12 12", key: "d8bk6v" }]
21
- ], I = y("x", D), L = { expandSidebar: "Expand sidebar", collapseSidebar: "Collapse sidebar", closePanel: "Close panel" }, O = { expandSidebar: "Expandera sidopanel", collapseSidebar: "Minimera sidopanel", closePanel: "Stäng panel" }, b = {
22
- en: L,
23
- sv: O
24
- }, q = "_collapsePanel_1uy7t_1", w = "_collapsed_1uy7t_4", E = "_panelTitle_1uy7t_17", P = {
25
- collapsePanel: q,
26
- collapsed: w,
27
- panelTitle: E
28
- }, F = ({
29
- children: s,
30
- className: l,
31
- isCollapsed: n,
32
- defaultCollapsed: d = !1,
33
- onCollapseChange: p,
34
- title: o,
35
- ...r
36
- }) => {
37
- const c = u(b), m = B(), [a, _] = v(
38
- n,
39
- d,
40
- p
41
- ), h = () => _((k) => !k);
42
- return m ? null : /* @__PURE__ */ e(S.Provider, { value: { isCollapsed: a }, children: /* @__PURE__ */ t(
43
- T,
44
- {
45
- className: i(l, P.collapsePanel, {
46
- [P.collapsed]: a
47
- }),
48
- ...r,
49
- children: [
50
- /* @__PURE__ */ t(C, { children: [
51
- /* @__PURE__ */ e("div", { children: !a && o && /* @__PURE__ */ e(
52
- N,
53
- {
54
- className: P.panelTitle,
55
- title: o
56
- }
57
- ) }),
58
- /* @__PURE__ */ e(
59
- x,
60
- {
61
- variant: "icon",
62
- "aria-label": a ? c.format("expandSidebar") : c.format("collapseSidebar"),
63
- onPress: h,
64
- children: a ? /* @__PURE__ */ e(j, { size: 20 }) : /* @__PURE__ */ e(M, { size: 20 })
65
- }
66
- )
67
- ] }),
68
- s
69
- ]
70
- }
71
- ) });
72
- }, X = "_panelBody_1rrgz_1", A = {
73
- panelBody: X
74
- }, T = ({ className: s, ...l }) => /* @__PURE__ */ e(
75
- "aside",
76
- {
77
- className: i(s, A.panelBody),
78
- ...l
79
- }
80
- ), G = "_panelHeader_11qv1_1", J = {
81
- panelHeader: G
82
- }, C = ({ className: s, ...l }) => /* @__PURE__ */ e(
83
- "div",
84
- {
85
- className: i(s, J.panelHeader),
86
- ...l
87
- }
88
- ), K = "_panelTitle_w7y4m_1", Q = {
89
- panelTitle: K
90
- }, N = ({ className: s, title: l, ...n }) => /* @__PURE__ */ e(
91
- $,
92
- {
93
- className: i(s, Q.panelTitle),
94
- ...n,
95
- children: l
96
- }
97
- ), R = "_dismissPanel_dpjsv_1", U = "_panelTitle_dpjsv_18", f = {
98
- dismissPanel: R,
99
- panelTitle: U
100
- }, V = ({
101
- children: s,
102
- className: l,
103
- isOpen: n,
104
- defaultOpen: d = !1,
105
- onOpenChange: p,
106
- title: o,
107
- ...r
108
- }) => {
109
- const c = u(b), [m, a] = v(
110
- n,
111
- d,
112
- p
113
- ), _ = () => a((h) => !h);
114
- return m ? /* @__PURE__ */ t(
115
- T,
116
- {
117
- className: i(l, f.dismissPanel),
118
- ...r,
119
- children: [
120
- /* @__PURE__ */ t(C, { children: [
121
- /* @__PURE__ */ e("div", { children: o && /* @__PURE__ */ e(
122
- N,
123
- {
124
- className: f.panelTitle,
125
- title: o
126
- }
127
- ) }),
128
- /* @__PURE__ */ e(
129
- x,
130
- {
131
- variant: "icon",
132
- "aria-label": c.format("closePanel"),
133
- onPress: _,
134
- children: /* @__PURE__ */ e(I, { size: 20 })
135
- }
136
- )
137
- ] }),
138
- s
139
- ]
140
- }
141
- ) : null;
142
- }, ae = ({
143
- variant: s = "collapse",
144
- ...l
145
- }) => /* @__PURE__ */ t(g.Provider, { value: { variant: s }, children: [
146
- s === "collapse" && /* @__PURE__ */ e(F, { ...l }),
147
- s === "dismiss" && /* @__PURE__ */ e(V, { ...l })
148
- ] });
149
- export {
150
- F as C,
151
- V as D,
152
- ae as P,
153
- T as a,
154
- C as b,
155
- N as c
156
- };