@midas-ds/components 16.2.2 → 16.2.3

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,13 @@
1
+ ## 16.2.3 (2026-01-09)
2
+
3
+ ### 🩹 Fixes
4
+
5
+ - **components, layout:** show active menu item on sub pages ([#994](https://github.com/migrationsverket/midas/pull/994))
6
+
7
+ ### 🧱 Updated Dependencies
8
+
9
+ - Updated theme to 3.9.3
10
+
1
11
  ## 16.2.2 (2026-01-09)
2
12
 
3
13
  ### 🧱 Updated Dependencies
@@ -72,13 +72,13 @@ const F = [
72
72
  user: r,
73
73
  app: t,
74
74
  children: o,
75
- clientSideRouter: c,
76
- clientSideHref: l,
75
+ clientSideRouter: m,
76
+ clientSideHref: d,
77
77
  headerChildren: _,
78
78
  isCollapsed: h,
79
- setIsCollapsed: m,
79
+ setIsCollapsed: p,
80
80
  isOpened: k,
81
- setIsOpened: p,
81
+ setIsOpened: l,
82
82
  variant: b,
83
83
  id: N
84
84
  }) => /* @__PURE__ */ e(
@@ -91,11 +91,11 @@ const F = [
91
91
  app: t,
92
92
  headerChildren: _,
93
93
  isCollapsed: h,
94
- setIsCollapsed: m,
94
+ setIsCollapsed: p,
95
95
  isOpened: k,
96
- setIsOpened: p,
97
- clientSideRouter: c,
98
- clientSideHref: l,
96
+ setIsOpened: l,
97
+ clientSideRouter: m,
98
+ clientSideHref: d,
99
99
  variant: b,
100
100
  id: N
101
101
  },
@@ -113,10 +113,13 @@ const F = [
113
113
  active: t,
114
114
  hasBadge: o
115
115
  }) => {
116
- const { isCollapsed: c, setIsOpened: l, clientSideHref: _ } = f(), h = _ ? _(s) : s, [m, k] = v.useState(!1);
116
+ const { isCollapsed: m, setIsOpened: d, clientSideHref: _ } = f(), h = _ ? _(s) : s, [p, k] = v.useState(!1);
117
117
  return v.useEffect(() => {
118
- typeof window < "u" && k(t ?? window.location.pathname === h);
119
- }, [t, h]), c ? /* @__PURE__ */ i(H, { children: [
118
+ if (typeof window < "u") {
119
+ const l = window.location.pathname === h || window.location.pathname.startsWith(h + "/");
120
+ k(t ?? l);
121
+ }
122
+ }, [t, h]), m ? /* @__PURE__ */ i(H, { children: [
120
123
  /* @__PURE__ */ e(
121
124
  q,
122
125
  {
@@ -125,9 +128,9 @@ const F = [
125
128
  className: u(
126
129
  a.listLink,
127
130
  a.listLinkCollapsed,
128
- m && a.active
131
+ p && a.active
129
132
  ),
130
- onPress: () => l?.(!1),
133
+ onPress: () => d?.(!1),
131
134
  children: /* @__PURE__ */ i(L, { children: [
132
135
  /* @__PURE__ */ e(
133
136
  r,
@@ -146,8 +149,8 @@ const F = [
146
149
  {
147
150
  href: s,
148
151
  "aria-label": n,
149
- className: u(a.listLink, m && a.active),
150
- onPress: () => l?.(!1),
152
+ className: u(a.listLink, p && a.active),
153
+ onPress: () => d?.(!1),
151
154
  children: [
152
155
  /* @__PURE__ */ i(L, { children: [
153
156
  /* @__PURE__ */ e(r, { size: 20 }),
@@ -167,11 +170,11 @@ const F = [
167
170
  isOpened: r,
168
171
  isCollapsed: t,
169
172
  setIsCollapsed: o,
170
- setIsOpened: c,
171
- clientSideRouter: l,
173
+ setIsOpened: m,
174
+ clientSideRouter: d,
172
175
  clientSideHref: _,
173
176
  id: h
174
- } = f(), m = C(x), k = ({ group: p }) => /* @__PURE__ */ e("ul", { className: a.list, children: p.items.map((b, N) => /* @__PURE__ */ e(
177
+ } = f(), p = C(x), k = ({ group: l }) => /* @__PURE__ */ e("ul", { className: a.list, children: l.items.map((b, N) => /* @__PURE__ */ e(
175
178
  "li",
176
179
  {
177
180
  className: u(
@@ -183,13 +186,13 @@ const F = [
183
186
  "link_" + N
184
187
  )) });
185
188
  return v.useEffect(() => {
186
- const p = (b) => {
187
- b.key === "Escape" && c !== void 0 && c(!1);
189
+ const l = (b) => {
190
+ b.key === "Escape" && m !== void 0 && m(!1);
188
191
  };
189
- return window.addEventListener("keydown", p), () => {
190
- window.removeEventListener("keydown", p);
192
+ return window.addEventListener("keydown", l), () => {
193
+ window.removeEventListener("keydown", l);
191
194
  };
192
- }, [c]), /* @__PURE__ */ i(
195
+ }, [m]), /* @__PURE__ */ i(
193
196
  "aside",
194
197
  {
195
198
  id: h,
@@ -205,7 +208,7 @@ const F = [
205
208
  I,
206
209
  {
207
210
  variant: "icon",
208
- "aria-label": t ? m.format("maximizeMenu") : m.format("minimizeMenu"),
211
+ "aria-label": t ? p.format("maximizeMenu") : p.format("minimizeMenu"),
209
212
  onPress: () => o(!t),
210
213
  className: a.collapseButton,
211
214
  children: t ? /* @__PURE__ */ e(X, { size: 20 }) : /* @__PURE__ */ e($, { size: 20 })
@@ -216,17 +219,17 @@ const F = [
216
219
  "nav",
217
220
  {
218
221
  className: a.sidebarNav,
219
- "aria-label": m.format("sidebarMenu"),
220
- children: /* @__PURE__ */ e("ul", { className: a.list, children: n.map((p, b) => /* @__PURE__ */ i("li", { children: [
221
- p.title && !t && /* @__PURE__ */ e("p", { className: a.listGroupTitle, children: p.title }),
222
- l ? /* @__PURE__ */ e(
222
+ "aria-label": p.format("sidebarMenu"),
223
+ children: /* @__PURE__ */ e("ul", { className: a.list, children: n.map((l, b) => /* @__PURE__ */ i("li", { children: [
224
+ l.title && !t && /* @__PURE__ */ e("p", { className: a.listGroupTitle, children: l.title }),
225
+ d ? /* @__PURE__ */ e(
223
226
  B,
224
227
  {
225
- navigate: l,
228
+ navigate: d,
226
229
  useHref: _,
227
- children: /* @__PURE__ */ e(k, { group: p })
230
+ children: /* @__PURE__ */ e(k, { group: l })
228
231
  }
229
- ) : /* @__PURE__ */ e(k, { group: p })
232
+ ) : /* @__PURE__ */ e(k, { group: l })
230
233
  ] }, "list_" + b)) })
231
234
  }
232
235
  )
@@ -240,11 +243,11 @@ const F = [
240
243
  app: r,
241
244
  isOpened: t,
242
245
  setIsOpened: o,
243
- setIsCollapsed: c,
244
- headerChildren: l,
246
+ setIsCollapsed: m,
247
+ headerChildren: d,
245
248
  variant: _,
246
249
  id: h
247
- } = f(), m = C(x);
250
+ } = f(), p = C(x);
248
251
  return _ === "external" ? /* @__PURE__ */ e("header", { className: u(a.header, a.headerExternal), children: /* @__PURE__ */ i("div", { className: a.headerContentExternal, children: [
249
252
  /* @__PURE__ */ i("div", { className: a.logoExternalContainer, children: [
250
253
  /* @__PURE__ */ e(
@@ -268,7 +271,7 @@ const F = [
268
271
  /* @__PURE__ */ e("p", { className: a.userTitle, children: s.title })
269
272
  ] })
270
273
  ] }),
271
- /* @__PURE__ */ e("div", { className: a.headerItems, children: l })
274
+ /* @__PURE__ */ e("div", { className: a.headerItems, children: d })
272
275
  ] }) }) : /* @__PURE__ */ i(
273
276
  "header",
274
277
  {
@@ -290,10 +293,10 @@ const F = [
290
293
  {
291
294
  variant: "icon",
292
295
  className: a.toggleButton,
293
- "aria-label": t ? m.format("closeMenu") : m.format("openMenu"),
296
+ "aria-label": t ? p.format("closeMenu") : p.format("openMenu"),
294
297
  "aria-controls": h,
295
298
  onPressStart: () => {
296
- c(!1), o?.(!0);
299
+ m(!1), o?.(!0);
297
300
  },
298
301
  children: t ? /* @__PURE__ */ e(
299
302
  j,
@@ -316,7 +319,7 @@ const F = [
316
319
  /* @__PURE__ */ e("p", { className: a.title, children: n })
317
320
  ] })
318
321
  ] }),
319
- /* @__PURE__ */ e("div", { className: a.headerItems, children: l })
322
+ /* @__PURE__ */ e("div", { className: a.headerItems, children: d })
320
323
  ]
321
324
  }
322
325
  );
@@ -366,7 +369,7 @@ const F = [
366
369
  );
367
370
  }, z = ({
368
371
  items: n
369
- }) => /* @__PURE__ */ e(P, { children: n.map(({ href: s, active: r, icon: t, title: o, hasBadge: c }, l) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
372
+ }) => /* @__PURE__ */ e(P, { children: n.map(({ href: s, active: r, icon: t, title: o, hasBadge: m }, d) => /* @__PURE__ */ e("li", { children: /* @__PURE__ */ i(
370
373
  q,
371
374
  {
372
375
  href: s,
@@ -376,86 +379,86 @@ const F = [
376
379
  children: [
377
380
  /* @__PURE__ */ i(L, { children: [
378
381
  /* @__PURE__ */ e(t, { size: 20 }),
379
- c && /* @__PURE__ */ e(y, {})
382
+ m && /* @__PURE__ */ e(y, {})
380
383
  ] }),
381
384
  o
382
385
  ]
383
386
  }
384
- ) }, l)) }), d = ({
387
+ ) }, d)) }), c = ({
385
388
  items: n,
386
389
  title: s,
387
390
  user: r,
388
391
  app: t,
389
392
  children: o,
390
- headerChildren: c,
391
- clientSideRouter: l,
393
+ headerChildren: m,
394
+ clientSideRouter: d,
392
395
  clientSideHref: _,
393
396
  variant: h,
394
- className: m
397
+ className: p
395
398
  }) => {
396
- const [k, p] = v.useState(!1), [b, N] = v.useState(!1), E = v.useId();
399
+ const [k, l] = v.useState(!1), [b, N] = v.useState(!1), E = v.useId();
397
400
  return h === "external" ? /* @__PURE__ */ e(
398
- d.Provider,
401
+ c.Provider,
399
402
  {
400
403
  items: n,
401
404
  title: s,
402
405
  user: r,
403
406
  app: t,
404
- clientSideRouter: l,
407
+ clientSideRouter: d,
405
408
  clientSideHref: _,
406
- headerChildren: c,
409
+ headerChildren: m,
407
410
  isCollapsed: k,
408
- setIsCollapsed: p,
411
+ setIsCollapsed: l,
409
412
  variant: h,
410
413
  id: E,
411
- children: /* @__PURE__ */ i("div", { className: u(a.baseLayout, m), children: [
414
+ children: /* @__PURE__ */ i("div", { className: u(a.baseLayout, p), children: [
412
415
  /* @__PURE__ */ e(S, {}),
413
- /* @__PURE__ */ e(d.Header, {}),
416
+ /* @__PURE__ */ e(c.Header, {}),
414
417
  /* @__PURE__ */ i("div", { className: a.mainContent, children: [
415
- /* @__PURE__ */ e(d.Sidebar, {}),
418
+ /* @__PURE__ */ e(c.Sidebar, {}),
416
419
  /* @__PURE__ */ e(T, { children: /* @__PURE__ */ e("main", { className: a.main, children: /* @__PURE__ */ e("div", { className: a.app, children: o }) }) }),
417
- /* @__PURE__ */ e(d.Backdrop, {})
420
+ /* @__PURE__ */ e(c.Backdrop, {})
418
421
  ] }),
419
- /* @__PURE__ */ e("div", { className: a.navbarWrapper, children: /* @__PURE__ */ e(d.Navbar, {}) })
422
+ /* @__PURE__ */ e("div", { className: a.navbarWrapper, children: /* @__PURE__ */ e(c.Navbar, {}) })
420
423
  ] })
421
424
  }
422
425
  ) : /* @__PURE__ */ e(
423
- d.Provider,
426
+ c.Provider,
424
427
  {
425
428
  items: n,
426
429
  title: s,
427
430
  user: r,
428
431
  app: t,
429
- clientSideRouter: l,
432
+ clientSideRouter: d,
430
433
  clientSideHref: _,
431
- headerChildren: c,
434
+ headerChildren: m,
432
435
  isCollapsed: k,
433
- setIsCollapsed: p,
436
+ setIsCollapsed: l,
434
437
  isOpened: b,
435
438
  setIsOpened: N,
436
439
  variant: h,
437
440
  id: E,
438
- children: /* @__PURE__ */ i("div", { className: u(a.baseLayout, m), children: [
441
+ children: /* @__PURE__ */ i("div", { className: u(a.baseLayout, p), children: [
439
442
  /* @__PURE__ */ e(S, {}),
440
- /* @__PURE__ */ e(d.Header, {}),
443
+ /* @__PURE__ */ e(c.Header, {}),
441
444
  /* @__PURE__ */ i("div", { className: a.mainContent, children: [
442
- /* @__PURE__ */ e(d.Sidebar, {}),
445
+ /* @__PURE__ */ e(c.Sidebar, {}),
443
446
  /* @__PURE__ */ e(T, { children: /* @__PURE__ */ e("main", { className: a.main, children: /* @__PURE__ */ e("div", { className: a.app, children: o }) }) }),
444
- /* @__PURE__ */ e(d.Backdrop, {})
447
+ /* @__PURE__ */ e(c.Backdrop, {})
445
448
  ] })
446
449
  ] })
447
450
  }
448
451
  );
449
452
  };
450
- d.Provider = Se;
451
- d.Header = we;
452
- d.Sidebar = Oe;
453
- d.SidebarLink = w;
454
- d.Navbar = He;
455
- d.Backdrop = Pe;
453
+ c.Provider = Se;
454
+ c.Header = we;
455
+ c.Sidebar = Oe;
456
+ c.SidebarLink = w;
457
+ c.Navbar = He;
458
+ c.Backdrop = Pe;
456
459
  export {
457
460
  we as H,
458
- d as L,
461
+ c as L,
459
462
  He as N,
460
463
  Oe as S,
461
464
  w as a
package/index.js CHANGED
@@ -20,7 +20,7 @@ import { G as $ } from "./chunks/GridItem-5t1Z14sM.js";
20
20
  import { H as ao } from "./chunks/Heading-D8tNNJkt.js";
21
21
  import { I as eo } from "./chunks/InfoBanner-DLiVpNON.js";
22
22
  import { L as so } from "./chunks/Label-Dup4lWaR.js";
23
- import { H as xo, L as mo, N as fo, S as io, a as no } from "./chunks/Layout-BFZSROTl.js";
23
+ import { H as xo, L as mo, N as fo, S as io, a as no } from "./chunks/Layout-LjCfmVhQ.js";
24
24
  import { L as lo } from "./chunks/Link-yTNUNv3C.js";
25
25
  import { L as bo } from "./chunks/LinkButton-3nAekUJ4.js";
26
26
  import { L as uo } from "./chunks/Logo-InDSslpO.js";
package/layout/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { H as e, L as s, N as b, S as d, a as i } from "../chunks/Layout-BFZSROTl.js";
1
+ import { H as e, L as s, N as b, S as d, a as i } from "../chunks/Layout-LjCfmVhQ.js";
2
2
  export {
3
3
  e as Header,
4
4
  s as Layout,
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "description": "Midas Components",
15
15
  "homepage": "https://designsystem.migrationsverket.se/",
16
16
  "license": "CC0-1.0",
17
- "version": "16.2.2",
17
+ "version": "16.2.3",
18
18
  "module": "./index.js",
19
19
  "type": "module",
20
20
  "main": "./index.js",
@@ -41,7 +41,7 @@
41
41
  "./*": "./*/index.js"
42
42
  },
43
43
  "dependencies": {
44
- "@midas-ds/theme": "3.9.2",
44
+ "@midas-ds/theme": "3.9.3",
45
45
  "react-aria-components": "1.14.0"
46
46
  }
47
47
  }