@altinn/altinn-components 0.67.2 → 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,90 +1,84 @@
1
- import { jsxs as c, Fragment as m, jsx as r } from "react/jsx-runtime";
2
- import { useRef as N, useEffect as v } from "react";
3
- import { Button as D } from "../Button/Button.js";
1
+ import { jsxs as a, Fragment as l, jsx as t } from "react/jsx-runtime";
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 L } 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 j } from "../../ChevronUp-hn05LboH.js";
12
- import { S as I } from "../../ChevronDown-D_a7nb-G.js";
13
- import '../../assets/HeaderDrawer.css';const M = "_backdrop_yn0zc_11", R = "_drawer_yn0zc_28", F = "_footer_yn0zc_60", V = "_body_yn0zc_64", q = "_toggleButton_yn0zc_104", t = {
14
- backdrop: M,
15
- drawer: R,
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
16
  footer: F,
17
17
  body: V,
18
18
  toggleButton: q
19
- }, Z = ({
20
- id: l,
21
- open: i,
22
- onClose: a,
19
+ }, $ = ({
20
+ id: c,
21
+ open: r,
22
+ onClose: v,
23
23
  closedBy: o = "any",
24
- expanded: u,
25
- expandable: y = !0,
24
+ expanded: d,
25
+ expandable: _ = !0,
26
26
  onToggle: b,
27
- children: _
27
+ children: w,
28
+ ariaLabelledby: k
28
29
  }) => {
29
- const { languageCode: w } = L(), f = A(w), d = N(null);
30
- v(() => {
31
- const e = d.current, s = (n) => {
32
- const { clientY: p, clientX: h, target: z } = n;
33
- if (n instanceof KeyboardEvent && n.key === "Escape") {
34
- if (o === "none") {
35
- n.preventDefault();
36
- return;
37
- }
38
- a();
39
- return;
30
+ const { languageCode: y } = I(), m = A(y), s = D(null);
31
+ h(() => {
32
+ const e = s.current, u = (i) => {
33
+ if (window.getSelection()?.toString()) return;
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();
40
38
  }
41
- if (!window.getSelection()?.toString() && e && z === e && o === "any") {
42
- const { top: E, left: x, right: S, bottom: C } = e.getBoundingClientRect();
43
- E <= p && p <= C && x <= h && h <= S || e?.close();
44
- }
45
- }, g = () => {
46
- const n = e?.querySelector("[autofocus]");
47
- document.activeElement !== n && n?.focus();
39
+ }, f = () => {
40
+ const i = e?.querySelector("[autofocus]");
41
+ document.activeElement !== i && i?.focus();
48
42
  };
49
- return e?.addEventListener("animationend", g), e?.addEventListener("click", s), e?.addEventListener("keydown", s), () => {
50
- e?.removeEventListener("animationend", g), e?.removeEventListener("click", s), e?.removeEventListener("keydown", s);
43
+ return e?.addEventListener("animationend", f), e?.addEventListener("click", u), () => {
44
+ e?.removeEventListener("animationend", f), e?.removeEventListener("click", u);
51
45
  };
52
- }, [o, a]), v(() => {
53
- const e = d.current;
54
- e && (i ? e.open || e.showModal() : e.open && e.close());
55
- }, [i]);
56
- const k = (e) => {
57
- e.preventDefault(), o === "any" && a();
46
+ }, [o]), h(() => {
47
+ const e = s.current;
48
+ e && (r ? e.open || e.showModal() : e.open && e.close());
49
+ }, [r]);
50
+ const z = (e) => {
51
+ o === "none" && e.preventDefault();
58
52
  };
59
- return /* @__PURE__ */ c(m, { children: [
60
- /* @__PURE__ */ r("div", { className: t.backdrop, "aria-hidden": !i }),
61
- /* @__PURE__ */ c(
53
+ return /* @__PURE__ */ a(l, { children: [
54
+ /* @__PURE__ */ t("div", { className: n.backdrop, "aria-hidden": !r }),
55
+ /* @__PURE__ */ a(
62
56
  "dialog",
63
57
  {
64
- id: l,
65
- ref: d,
58
+ id: c,
59
+ ref: s,
66
60
  "aria-modal": "true",
67
- "aria-labelledby": "modal-title",
68
- "data-open": i,
69
- "data-expanded": u,
70
- onCancel: k,
71
- className: t.drawer,
72
- onClose: o !== "none" ? a : void 0,
61
+ "aria-labelledby": k,
62
+ "data-open": r,
63
+ "data-expanded": d,
64
+ onCancel: z,
65
+ className: n.drawer,
66
+ onClose: o !== "none" ? v : void 0,
73
67
  children: [
74
- /* @__PURE__ */ r("div", { className: t.body, children: _ }),
75
- o !== "none" && y && /* @__PURE__ */ r("footer", { className: t.footer, children: /* @__PURE__ */ r(D, { className: t.toggleButton, size: "xs", variant: "outline", onClick: b, children: u ? /* @__PURE__ */ c(m, { children: [
76
- /* @__PURE__ */ r(j, { className: t.btnIcon, "aria-hidden": "true" }),
77
- f.minimize
78
- ] }) : /* @__PURE__ */ c(m, { children: [
79
- /* @__PURE__ */ r(I, { className: t.btnIcon, "aria-hidden": "true" }),
80
- f.fullscreen
68
+ /* @__PURE__ */ t("div", { className: n.body, children: w }),
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" }),
71
+ m.minimize
72
+ ] }) : /* @__PURE__ */ a(l, { children: [
73
+ /* @__PURE__ */ t(M, { className: n.btnIcon, "aria-hidden": "true" }),
74
+ m.fullscreen
81
75
  ] }) }) })
82
76
  ]
83
77
  }
84
78
  )
85
79
  ] });
86
- }, A = (l) => {
87
- switch (l) {
80
+ }, A = (c) => {
81
+ switch (c) {
88
82
  case "nn":
89
83
  return {
90
84
  minimize: "Minimer",
@@ -103,5 +97,5 @@ import '../../assets/HeaderDrawer.css';const M = "_backdrop_yn0zc_11", R = "_dra
103
97
  }
104
98
  };
105
99
  export {
106
- Z as HeaderDrawer
100
+ $ as HeaderDrawer
107
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 D, useEffect as m } 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,78 +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 S } from "../Page/Section.js";
13
- import '../../assets/ModalBase.css';const C = "_modal_3d5cx_1", R = "_content_3d5cx_41", f = {
14
- modal: C,
15
- content: R
16
- }, J = ({
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 = ({
17
18
  open: r,
18
- onClose: o,
19
+ onClose: p,
19
20
  closedBy: n = "any",
20
- children: u,
21
- backdropColor: p = "inherit",
22
- size: g,
23
- color: v,
24
- padding: h = 0,
25
- spacing: E = 0,
26
- height: y = "auto",
27
- variant: b = "default"
21
+ children: v,
22
+ backdropColor: g = "inherit",
23
+ size: h,
24
+ color: _,
25
+ padding: y = 0,
26
+ spacing: C = 0,
27
+ height: E = "auto",
28
+ variant: b = "default",
29
+ title: o
28
30
  }) => {
29
- const i = D(null);
30
- return m(() => {
31
- const t = i.current, a = (e) => {
32
- const { clientY: l, clientX: d, target: k } = e;
33
- if (e instanceof KeyboardEvent && e.key === "Escape") {
34
- if (n === "none") {
35
- e.preventDefault();
36
- return;
37
- }
38
- o();
39
- return;
31
+ const a = S(null), c = w();
32
+ return f(() => {
33
+ const t = a.current, l = (e) => {
34
+ if (window.getSelection()?.toString()) return;
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();
40
39
  }
41
- if (!window.getSelection()?.toString() && t && k === t && n === "any") {
42
- const { top: L, left: _, right: w, bottom: x } = t.getBoundingClientRect();
43
- L <= l && l <= x && _ <= d && d <= w || t?.close();
44
- }
45
- }, c = () => {
40
+ }, s = () => {
46
41
  const e = t?.querySelector("[autofocus]");
47
42
  document.activeElement !== e && e?.focus();
48
43
  };
49
- return t?.addEventListener("animationend", c), t?.addEventListener("click", a), t?.addEventListener("keydown", a), () => {
50
- t?.removeEventListener("animationend", c), t?.removeEventListener("click", a), t?.removeEventListener("keydown", a);
44
+ return t?.addEventListener("animationend", s), t?.addEventListener("click", l), () => {
45
+ t?.removeEventListener("animationend", s), t?.removeEventListener("click", l);
51
46
  };
52
- }, [n, o]), m(() => {
53
- const t = i.current;
47
+ }, [n]), f(() => {
48
+ const t = a.current;
54
49
  t && (r ? t.open || t.showModal() : t.open && t.close());
55
- }, [r]), /* @__PURE__ */ s(
50
+ }, [r]), /* @__PURE__ */ O(
56
51
  "dialog",
57
52
  {
58
- ref: i,
53
+ ref: a,
59
54
  "aria-modal": "true",
60
- "aria-labelledby": "modal-title",
55
+ "aria-labelledby": o ? c : void 0,
61
56
  onCancel: (t) => {
62
- t.preventDefault(), n === "any" && o();
57
+ n === "none" && t.preventDefault();
63
58
  },
64
- "data-backdrop-color": p,
65
- className: f.modal,
59
+ "data-backdrop-color": g,
60
+ className: i.modal,
66
61
  "data-variant": b,
67
- "data-height": y,
68
- onClose: n !== "none" ? o : void 0,
69
- children: /* @__PURE__ */ s(
70
- S,
71
- {
72
- className: f.content,
73
- "aria-label": "modal content",
74
- size: g,
75
- color: v,
76
- padding: h,
77
- spacing: E,
78
- children: u
79
- }
80
- )
62
+ "data-height": E,
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
+ ]
81
79
  }
82
80
  );
83
81
  };
84
82
  export {
85
- J as ModalBase
83
+ T as ModalBase
86
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.2",
3
+ "version": "0.67.4",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",