@altinn/altinn-components 0.67.3 → 0.67.4

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.
@@ -1 +1 @@
1
- ._modal_3d5cx_1{padding:0;width:100%;max-width:450px;border:none;background-color:#fff;border-radius:.5rem;box-shadow:var(--ds-shadow-xs)}._modal_3d5cx_1[data-backdrop-color=inherit]::backdrop{background-color:#111d4640}._modal_3d5cx_1[data-backdrop-color=transparent]::backdrop{background-color:transparent}._modal_3d5cx_1[data-variant=default]{max-width:640px;margin:auto}._modal_3d5cx_1[data-variant=content]{max-width:988px;margin:auto}._modal_3d5cx_1[data-height=full]{min-height:unset;height:100%}._modal_3d5cx_1[data-variant=full]{width:100%;max-width:none;height:100%;min-height:unset}._content_3d5cx_41{position:relative}
1
+ ._modal_vs7j3_1{padding:0;width:100%;max-width:450px;border:none;background-color:#fff;border-radius:.5rem;box-shadow:var(--ds-shadow-xs)}._modal_vs7j3_1[data-backdrop-color=inherit]::backdrop{background-color:#111d4640}._modal_vs7j3_1[data-backdrop-color=transparent]::backdrop{background-color:transparent}._modal_vs7j3_1[data-variant=default]{max-width:640px;margin:auto}._modal_vs7j3_1[data-variant=content]{max-width:988px;margin:auto}._modal_vs7j3_1[data-height=full]{min-height:unset;height:100%}._modal_vs7j3_1[data-variant=full]{width:100%;max-width:none;height:100%;min-height:unset}._content_vs7j3_41{position:relative}._srOnly_vs7j3_45{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import { jsx as n, jsxs as i, Fragment as O } from "react/jsx-runtime";
3
- import { useState as v } from "react";
4
- import { useIsDesktop as F } from "../../hooks/useIsDesktop.js";
5
- import { AccountSelector as b } from "../AccountSelector/AccountSelector.js";
2
+ import { jsx as n, jsxs as p, Fragment as A } from "react/jsx-runtime";
3
+ import { useState as O } from "react";
4
+ import { useIsDesktop as v } from "../../hooks/useIsDesktop.js";
5
+ import { AccountSelector as F } from "../AccountSelector/AccountSelector.js";
6
6
  import { GlobalMenu as C } from "../GlobalMenu/GlobalMenu.js";
7
7
  import "../../index-p1eeF8LQ.js";
8
8
  import "../../tooltip-Ct39-719.js";
@@ -16,12 +16,12 @@ import "../Snackbar/useSnackbar.js";
16
16
  import { HeaderDrawer as N } from "./HeaderDrawer.js";
17
17
  import { HeaderDropdown as E } from "./HeaderDropdown.js";
18
18
  import { HeaderLogo as I } from "./HeaderLogo.js";
19
- import '../../assets/GlobalHeader.css';const T = "_header_17ppp_1", k = "_container_17ppp_7", B = "_nav_17ppp_53", G = "_logo_17ppp_62", t = {
19
+ import '../../assets/GlobalHeader.css';const T = "_header_17ppp_1", k = "_container_17ppp_7", y = "_nav_17ppp_53", B = "_logo_17ppp_62", a = {
20
20
  header: T,
21
21
  container: k,
22
- nav: B,
23
- logo: G
24
- }, H = 5, $ = ({
22
+ nav: y,
23
+ logo: B
24
+ }, G = 5, $ = ({
25
25
  globalMenu: r,
26
26
  desktopMenu: s,
27
27
  mobileMenu: d,
@@ -31,20 +31,20 @@ import '../../assets/GlobalHeader.css';const T = "_header_17ppp_1", k = "_contai
31
31
  badge: f,
32
32
  onLoginClick: g
33
33
  }) => {
34
- const { currentId: o, toggleId: l, closeAll: a } = w(), h = () => {
34
+ const { currentId: o, toggleId: l, closeAll: t } = w(), h = () => {
35
35
  o !== "account" && window.scrollTo({ top: 0, behavior: "instant" }), l("account");
36
36
  }, _ = () => {
37
37
  l("menu");
38
- }, p = o === "account" || e?.forceOpenFullScreen || !1, [c, x] = v(!1), A = F();
39
- return /* @__PURE__ */ n("header", { className: t.header, "data-current-id": o, children: /* @__PURE__ */ n("div", { className: t.container, children: /* @__PURE__ */ i("nav", { className: t.nav, "aria-label": "hovednavigasjon", children: [
40
- /* @__PURE__ */ n(I, { ...u, badge: f, className: t.logo }),
41
- e && /* @__PURE__ */ i(O, { children: [
38
+ }, c = o === "account" || e?.forceOpenFullScreen || !1, [i, b] = O(!1), x = v();
39
+ return /* @__PURE__ */ n("header", { className: a.header, "data-current-id": o, children: /* @__PURE__ */ n("div", { className: a.container, children: /* @__PURE__ */ p("nav", { className: a.nav, "aria-label": "hovednavigasjon", children: [
40
+ /* @__PURE__ */ n(I, { ...u, badge: f, className: a.logo }),
41
+ e && /* @__PURE__ */ p(A, { children: [
42
42
  /* @__PURE__ */ n(
43
43
  M,
44
44
  {
45
45
  currentAccount: e.accountMenu?.currentAccount,
46
46
  onClick: e.accountMenu?.currentAccount ? h : g,
47
- expanded: p,
47
+ expanded: c,
48
48
  loading: e.loading,
49
49
  disabled: e.forceOpenFullScreen
50
50
  }
@@ -53,13 +53,14 @@ import '../../assets/GlobalHeader.css';const T = "_header_17ppp_1", k = "_contai
53
53
  N,
54
54
  {
55
55
  id: "header-account",
56
- open: p,
57
- onClose: a,
56
+ open: c,
57
+ onClose: t,
58
58
  closedBy: e?.forceOpenFullScreen ? "none" : "any",
59
- expanded: e?.forceOpenFullScreen || c,
60
- onToggle: () => x(!c),
61
- expandable: (e.accountCount ?? e.accountMenu.items.length) > H,
62
- children: /* @__PURE__ */ n(b, { ...e, forceOpenFullScreen: e.forceOpenFullScreen })
59
+ ariaLabelledby: "account-selector-heading",
60
+ expanded: e?.forceOpenFullScreen || i,
61
+ onToggle: () => b(!i),
62
+ expandable: (e.accountCount ?? e.accountMenu.items.length) > G,
63
+ children: /* @__PURE__ */ n(F, { ...e, forceOpenFullScreen: e.forceOpenFullScreen })
63
64
  }
64
65
  )
65
66
  ] }),
@@ -68,7 +69,7 @@ import '../../assets/GlobalHeader.css';const T = "_header_17ppp_1", k = "_contai
68
69
  {
69
70
  id: "header-menu",
70
71
  open: o === "menu",
71
- onClose: a,
72
+ onClose: t,
72
73
  trigger: /* @__PURE__ */ n(
73
74
  D,
74
75
  {
@@ -82,8 +83,8 @@ import '../../assets/GlobalHeader.css';const T = "_header_17ppp_1", k = "_contai
82
83
  C,
83
84
  {
84
85
  ...r,
85
- menu: A ? s || r?.menu : d || r?.menu,
86
- onClose: a,
86
+ menu: x ? s || r?.menu : d || r?.menu,
87
+ onClose: t,
87
88
  localeSwitcher: m,
88
89
  isOpen: o === "menu"
89
90
  }
@@ -1,22 +1,22 @@
1
1
  import { jsxs as a, Fragment as l, jsx as t } from "react/jsx-runtime";
2
- import { useRef as E, useEffect as h } from "react";
3
- import { Button as D } from "../Button/Button.js";
2
+ import { useRef as D, useEffect as h } from "react";
3
+ import { Button as j } from "../Button/Button.js";
4
4
  import "../../index-p1eeF8LQ.js";
5
5
  import "../../tooltip-Ct39-719.js";
6
- import { w as j } from "../../ToolbarSearch-bv2opbAj.js";
6
+ import { w as I } from "../../ToolbarSearch-bv2opbAj.js";
7
7
  import "../Typography/Link.js";
8
8
  import "react-dom";
9
9
  import "../GlobalMenu/GlobalMenuBase.js";
10
10
  import "../Snackbar/useSnackbar.js";
11
- import { S as I } from "../../ChevronUp-hn05LboH.js";
12
- import { S as L } from "../../ChevronDown-D_a7nb-G.js";
13
- import '../../assets/HeaderDrawer.css';const M = "_backdrop_yn0zc_11", R = "_drawer_yn0zc_28", B = "_footer_yn0zc_60", F = "_body_yn0zc_64", V = "_toggleButton_yn0zc_104", n = {
14
- backdrop: M,
15
- drawer: R,
16
- footer: B,
17
- body: F,
18
- toggleButton: V
19
- }, Z = ({
11
+ import { S as L } from "../../ChevronUp-hn05LboH.js";
12
+ import { S as M } from "../../ChevronDown-D_a7nb-G.js";
13
+ import '../../assets/HeaderDrawer.css';const R = "_backdrop_yn0zc_11", B = "_drawer_yn0zc_28", F = "_footer_yn0zc_60", V = "_body_yn0zc_64", q = "_toggleButton_yn0zc_104", n = {
14
+ backdrop: R,
15
+ drawer: B,
16
+ footer: F,
17
+ body: V,
18
+ toggleButton: q
19
+ }, $ = ({
20
20
  id: c,
21
21
  open: r,
22
22
  onClose: v,
@@ -24,16 +24,17 @@ import '../../assets/HeaderDrawer.css';const M = "_backdrop_yn0zc_11", R = "_dra
24
24
  expanded: d,
25
25
  expandable: _ = !0,
26
26
  onToggle: b,
27
- children: w
27
+ children: w,
28
+ ariaLabelledby: k
28
29
  }) => {
29
- const { languageCode: k } = j(), m = q(k), s = E(null);
30
+ const { languageCode: y } = I(), m = A(y), s = D(null);
30
31
  h(() => {
31
32
  const e = s.current, u = (i) => {
32
33
  if (window.getSelection()?.toString()) return;
33
- const { clientY: g, clientX: p, target: z } = i;
34
- if (e && z === e && o === "any") {
35
- const { top: C, left: x, right: S, bottom: N } = e.getBoundingClientRect();
36
- C <= g && g <= N && x <= p && p <= S || e.close();
34
+ const { clientY: g, clientX: p, target: C } = i;
35
+ if (e && C === e && o === "any") {
36
+ const { top: x, left: S, right: N, bottom: E } = e.getBoundingClientRect();
37
+ x <= g && g <= E && S <= p && p <= N || e.close();
37
38
  }
38
39
  }, f = () => {
39
40
  const i = e?.querySelector("[autofocus]");
@@ -46,7 +47,7 @@ import '../../assets/HeaderDrawer.css';const M = "_backdrop_yn0zc_11", R = "_dra
46
47
  const e = s.current;
47
48
  e && (r ? e.open || e.showModal() : e.open && e.close());
48
49
  }, [r]);
49
- const y = (e) => {
50
+ const z = (e) => {
50
51
  o === "none" && e.preventDefault();
51
52
  };
52
53
  return /* @__PURE__ */ a(l, { children: [
@@ -57,26 +58,26 @@ import '../../assets/HeaderDrawer.css';const M = "_backdrop_yn0zc_11", R = "_dra
57
58
  id: c,
58
59
  ref: s,
59
60
  "aria-modal": "true",
60
- "aria-labelledby": "modal-title",
61
+ "aria-labelledby": k,
61
62
  "data-open": r,
62
63
  "data-expanded": d,
63
- onCancel: y,
64
+ onCancel: z,
64
65
  className: n.drawer,
65
66
  onClose: o !== "none" ? v : void 0,
66
67
  children: [
67
68
  /* @__PURE__ */ t("div", { className: n.body, children: w }),
68
- o !== "none" && _ && /* @__PURE__ */ t("footer", { className: n.footer, children: /* @__PURE__ */ t(D, { className: n.toggleButton, size: "xs", variant: "outline", onClick: b, children: d ? /* @__PURE__ */ a(l, { children: [
69
- /* @__PURE__ */ t(I, { className: n.btnIcon, "aria-hidden": "true" }),
69
+ o !== "none" && _ && /* @__PURE__ */ t("footer", { className: n.footer, children: /* @__PURE__ */ t(j, { className: n.toggleButton, size: "xs", variant: "outline", onClick: b, children: d ? /* @__PURE__ */ a(l, { children: [
70
+ /* @__PURE__ */ t(L, { className: n.btnIcon, "aria-hidden": "true" }),
70
71
  m.minimize
71
72
  ] }) : /* @__PURE__ */ a(l, { children: [
72
- /* @__PURE__ */ t(L, { className: n.btnIcon, "aria-hidden": "true" }),
73
+ /* @__PURE__ */ t(M, { className: n.btnIcon, "aria-hidden": "true" }),
73
74
  m.fullscreen
74
75
  ] }) }) })
75
76
  ]
76
77
  }
77
78
  )
78
79
  ] });
79
- }, q = (c) => {
80
+ }, A = (c) => {
80
81
  switch (c) {
81
82
  case "nn":
82
83
  return {
@@ -96,5 +97,5 @@ import '../../assets/HeaderDrawer.css';const M = "_backdrop_yn0zc_11", R = "_dra
96
97
  }
97
98
  };
98
99
  export {
99
- Z as HeaderDrawer
100
+ $ as HeaderDrawer
100
101
  };
@@ -1,12 +1,12 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
2
  import { forwardRef as s } from "react";
3
- import '../../assets/GlobalMenuBase.css';const l = "_nav_b7k4e_1", f = "_footer_b7k4e_6", a = {
3
+ import '../../assets/GlobalMenuBase.css';const l = "_nav_b7k4e_1", c = "_footer_b7k4e_6", r = {
4
4
  nav: l,
5
- footer: f
6
- }, c = s(({ color: o, children: r, ...t }, n) => /* @__PURE__ */ e("nav", { ref: n, className: a.nav, "data-color": o, ...t, children: r }));
7
- c.displayName = "GlobalMenuBase";
8
- const b = ({ children: o }) => /* @__PURE__ */ e("footer", { className: a.footer, children: o });
5
+ footer: c
6
+ }, f = s(({ color: o, children: a, ...t }, n) => /* @__PURE__ */ e("nav", { ref: n, className: r.nav, "data-color": o, ...t, children: /* @__PURE__ */ e("div", { role: "menu", children: a }) }));
7
+ f.displayName = "GlobalMenuBase";
8
+ const v = ({ children: o }) => /* @__PURE__ */ e("footer", { className: r.footer, children: o });
9
9
  export {
10
- c as GlobalMenuBase,
11
- b as GlobalMenuFooter
10
+ f as GlobalMenuBase,
11
+ v as GlobalMenuFooter
12
12
  };
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { jsx as s } from "react/jsx-runtime";
3
- import { useRef as w, useEffect as d } from "react";
2
+ import { jsxs as O, jsx as u } from "react/jsx-runtime";
3
+ import { useRef as S, useId as w, useEffect as f } from "react";
4
4
  import "../../index-p1eeF8LQ.js";
5
5
  import "../../tooltip-Ct39-719.js";
6
6
  import "../../ToolbarSearch-bv2opbAj.js";
@@ -9,71 +9,76 @@ import "../Button/Button.js";
9
9
  import "react-dom";
10
10
  import "../GlobalMenu/GlobalMenuBase.js";
11
11
  import "../Snackbar/useSnackbar.js";
12
- import { Section as y } from "../Page/Section.js";
13
- import '../../assets/ModalBase.css';const D = "_modal_3d5cx_1", R = "_content_3d5cx_41", m = {
14
- modal: D,
15
- content: R
16
- }, J = ({
17
- open: a,
18
- onClose: u,
19
- closedBy: e = "any",
20
- children: f,
21
- backdropColor: p = "inherit",
22
- size: g,
23
- color: h,
24
- padding: v = 0,
12
+ import { Section as D } from "../Page/Section.js";
13
+ import '../../assets/ModalBase.css';const N = "_modal_vs7j3_1", R = "_content_vs7j3_41", M = "_srOnly_vs7j3_45", i = {
14
+ modal: N,
15
+ content: R,
16
+ srOnly: M
17
+ }, T = ({
18
+ open: r,
19
+ onClose: p,
20
+ closedBy: n = "any",
21
+ children: v,
22
+ backdropColor: g = "inherit",
23
+ size: h,
24
+ color: _,
25
+ padding: y = 0,
25
26
  spacing: C = 0,
26
27
  height: E = "auto",
27
- variant: _ = "default"
28
+ variant: b = "default",
29
+ title: o
28
30
  }) => {
29
- const n = w(null);
30
- return d(() => {
31
- const t = n.current, i = (o) => {
31
+ const a = S(null), c = w();
32
+ return f(() => {
33
+ const t = a.current, l = (e) => {
32
34
  if (window.getSelection()?.toString()) return;
33
- const { clientY: r, clientX: l, target: b } = o;
34
- if (t && b === t && e === "any") {
35
- const { top: k, left: x, right: L, bottom: S } = t.getBoundingClientRect();
36
- k <= r && r <= S && x <= l && l <= L || t.close();
35
+ const { clientY: d, clientX: m, target: j } = e;
36
+ if (t && j === t && n === "any") {
37
+ const { top: k, left: x, right: I, bottom: L } = t.getBoundingClientRect();
38
+ k <= d && d <= L && x <= m && m <= I || t.close();
37
39
  }
38
- }, c = () => {
39
- const o = t?.querySelector("[autofocus]");
40
- document.activeElement !== o && o?.focus();
40
+ }, s = () => {
41
+ const e = t?.querySelector("[autofocus]");
42
+ document.activeElement !== e && e?.focus();
41
43
  };
42
- return t?.addEventListener("animationend", c), t?.addEventListener("click", i), () => {
43
- t?.removeEventListener("animationend", c), t?.removeEventListener("click", i);
44
+ return t?.addEventListener("animationend", s), t?.addEventListener("click", l), () => {
45
+ t?.removeEventListener("animationend", s), t?.removeEventListener("click", l);
44
46
  };
45
- }, [e]), d(() => {
46
- const t = n.current;
47
- t && (a ? t.open || t.showModal() : t.open && t.close());
48
- }, [a]), /* @__PURE__ */ s(
47
+ }, [n]), f(() => {
48
+ const t = a.current;
49
+ t && (r ? t.open || t.showModal() : t.open && t.close());
50
+ }, [r]), /* @__PURE__ */ O(
49
51
  "dialog",
50
52
  {
51
- ref: n,
53
+ ref: a,
52
54
  "aria-modal": "true",
53
- "aria-labelledby": "modal-title",
55
+ "aria-labelledby": o ? c : void 0,
54
56
  onCancel: (t) => {
55
- e === "none" && t.preventDefault();
57
+ n === "none" && t.preventDefault();
56
58
  },
57
- "data-backdrop-color": p,
58
- className: m.modal,
59
- "data-variant": _,
59
+ "data-backdrop-color": g,
60
+ className: i.modal,
61
+ "data-variant": b,
60
62
  "data-height": E,
61
- onClose: e !== "none" ? u : void 0,
62
- children: /* @__PURE__ */ s(
63
- y,
64
- {
65
- className: m.content,
66
- "aria-label": "modal content",
67
- size: g,
68
- color: h,
69
- padding: v,
70
- spacing: C,
71
- children: f
72
- }
73
- )
63
+ onClose: n !== "none" ? p : void 0,
64
+ children: [
65
+ o && /* @__PURE__ */ u("h2", { id: c, className: i.srOnly, children: o }),
66
+ /* @__PURE__ */ u(
67
+ D,
68
+ {
69
+ className: i.content,
70
+ "aria-label": "modal content",
71
+ size: h,
72
+ color: _,
73
+ padding: y,
74
+ spacing: C,
75
+ children: v
76
+ }
77
+ )
78
+ ]
74
79
  }
75
80
  );
76
81
  };
77
82
  export {
78
- J as ModalBase
83
+ T as ModalBase
79
84
  };
@@ -8,5 +8,6 @@ export interface HeaderDrawerProps {
8
8
  expandable?: boolean;
9
9
  onToggle?: () => void;
10
10
  children: ReactNode;
11
+ ariaLabelledby?: string;
11
12
  }
12
- export declare const HeaderDrawer: ({ id, open, onClose, closedBy, expanded, expandable, onToggle, children, }: HeaderDrawerProps) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const HeaderDrawer: ({ id, open, onClose, closedBy, expanded, expandable, onToggle, children, ariaLabelledby, }: HeaderDrawerProps) => import("react/jsx-runtime").JSX.Element;
@@ -11,5 +11,6 @@ export interface ModalBaseProps {
11
11
  color?: SectionProps['color'];
12
12
  padding?: SectionProps['padding'];
13
13
  spacing?: SectionProps['spacing'];
14
+ title?: string;
14
15
  }
15
- export declare const ModalBase: ({ open, onClose, closedBy, children, backdropColor, size, color, padding, spacing, height, variant, }: ModalBaseProps) => import("react/jsx-runtime").JSX.Element;
16
+ export declare const ModalBase: ({ open, onClose, closedBy, children, backdropColor, size, color, padding, spacing, height, variant, title, }: ModalBaseProps) => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.67.3",
3
+ "version": "0.67.4",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",