@altinn/altinn-components 0.32.0 → 0.33.1

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.
Files changed (35) hide show
  1. package/dist/assets/Modal.css +1 -0
  2. package/dist/assets/ModalBase.css +1 -1
  3. package/dist/assets/ModalBody.css +1 -0
  4. package/dist/assets/ModalHeader.css +1 -0
  5. package/dist/components/Account/AccountNotificationSettings.js +26 -0
  6. package/dist/components/Account/index.js +5 -3
  7. package/dist/components/Button/ButtonGroup.js +11 -0
  8. package/dist/components/Button/index.js +6 -4
  9. package/dist/components/Modal/Modal.js +28 -0
  10. package/dist/components/Modal/ModalBase.js +63 -25
  11. package/dist/components/Modal/ModalBody.js +5 -3
  12. package/dist/components/Modal/ModalFooter.js +11 -0
  13. package/dist/components/Modal/ModalHeader.js +22 -22
  14. package/dist/components/Modal/index.js +2 -0
  15. package/dist/components/index.js +426 -420
  16. package/dist/index.js +434 -428
  17. package/dist/types/lib/components/Account/AccountList.stories.d.ts +4 -2
  18. package/dist/types/lib/components/Account/AccountNotificationSettings.d.ts +11 -0
  19. package/dist/types/lib/components/Account/AccountNotificationSettings.stories.d.ts +17 -0
  20. package/dist/types/lib/components/Account/index.d.ts +1 -0
  21. package/dist/types/lib/components/ActivityLog/ActivityLog.stories.d.ts +2 -1
  22. package/dist/types/lib/components/Button/ButtonGroup.d.ts +6 -0
  23. package/dist/types/lib/components/Button/index.d.ts +1 -0
  24. package/dist/types/lib/components/Dialog/DialogHistory.stories.d.ts +1 -0
  25. package/dist/types/lib/components/Modal/Modal.d.ts +8 -0
  26. package/dist/types/lib/components/Modal/Modal.stories.d.ts +14 -0
  27. package/dist/types/lib/components/Modal/ModalBase.d.ts +7 -4
  28. package/dist/types/lib/components/Modal/ModalFooter.d.ts +6 -0
  29. package/dist/types/lib/components/Modal/ModalHeader.d.ts +2 -2
  30. package/dist/types/lib/components/Modal/index.d.ts +1 -0
  31. package/dist/types/lib/stories/Error.stories.d.ts +13 -0
  32. package/package.json +1 -1
  33. package/dist/types/lib/components/Avatar/Examples.stories.d.ts +0 -18
  34. package/dist/types/lib/components/Modal/ModalBase.stories.d.ts +0 -9
  35. /package/dist/types/lib/components/Avatar/{avatar.stories.d.ts → Avatar.stories.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ ._dismiss_ps82p_1{position:absolute;top:0;right:0;margin:1rem}
@@ -1 +1 @@
1
- ._modal_1jt70_1{padding:0;min-width:450px;border-radius:.5rem;box-shadow:var(--ds-shadow-xs);border:none}._modal_1jt70_1[data-backdrop-color=inherit]::backdrop{background-color:#111d4640}._modal_1jt70_1[data-backdrop-color=transparent]::backdrop{background-color:transparent}._modal_1jt70_1[data-variant=full]{width:100%;height:100%;min-width:unset;min-height:unset}._modal_1jt70_1[data-variant=content]{width:1056px;margin:auto}
1
+ ._modal_zkvhc_1{padding:0;width:100%;max-width:450px;border:none;background-color:#fff;border-radius:.5rem;box-shadow:var(--ds-shadow-xs)}._modal_zkvhc_1[data-backdrop-color=inherit]::backdrop{background-color:#111d4640}._modal_zkvhc_1[data-backdrop-color=transparent]::backdrop{background-color:transparent}._modal_zkvhc_1[data-variant=full]{width:100%;max-width:none;height:100%;min-height:unset}._modal_zkvhc_1[data-variant=content]{max-width:1056px;margin:auto}._content_zkvhc_30{position:relative}
@@ -0,0 +1 @@
1
+ ._body_1cilr_1{position:relative}
@@ -0,0 +1 @@
1
+ ._header_7ty99_1{border-bottom:1px solid;border-color:var(--ds-color-border-subtle)}._sticky_7ty99_6{background-color:var(--ds-color-background-default);position:sticky;z-index:2;top:0}
@@ -0,0 +1,26 @@
1
+ import { jsxs as c, jsx as t } from "react/jsx-runtime";
2
+ import "../../index-L8X2o7IH.js";
3
+ import "react";
4
+ import "../RootProvider/RootProvider.js";
5
+ import "../Searchbar/AutocompleteBase.js";
6
+ import "../Snackbar/useSnackbar.js";
7
+ import { Fieldset as d } from "../Forms/Fieldset.js";
8
+ import { Switch as r } from "../Forms/Switch.js";
9
+ import { TextField as i } from "../Forms/TextField.js";
10
+ const j = ({
11
+ phone: m,
12
+ phoneLabel: p = "Varsle på SMS",
13
+ email: s,
14
+ emailLabel: a = "Varsle på e-post",
15
+ smsAlerts: o = !1,
16
+ emailAlerts: l = !1,
17
+ onChange: e
18
+ }) => /* @__PURE__ */ c(d, { size: "sm", children: [
19
+ /* @__PURE__ */ t(r, { label: p, name: "smsAlerts", value: "SMS", checked: !!o, onChange: e }),
20
+ o && /* @__PURE__ */ t(i, { name: "phone", placeholder: "Mobiltelefon", value: m, onChange: e }),
21
+ /* @__PURE__ */ t(r, { label: a, name: "emailAlerts", value: "E-post", checked: !!l, onChange: e }),
22
+ l && /* @__PURE__ */ t(i, { name: "email", placeholder: "E-postadresse", value: s, onChange: e })
23
+ ] });
24
+ export {
25
+ j as AccountNotificationSettings
26
+ };
@@ -1,8 +1,10 @@
1
1
  import { AccountMenu as c } from "./AccountMenu.js";
2
2
  import { AccountListItem as e } from "./AccountListItem.js";
3
- import { AccountList as n } from "./AccountList.js";
3
+ import { AccountList as i } from "./AccountList.js";
4
+ import { AccountNotificationSettings as m } from "./AccountNotificationSettings.js";
4
5
  export {
5
- n as AccountList,
6
+ i as AccountList,
6
7
  e as AccountListItem,
7
- c as AccountMenu
8
+ c as AccountMenu,
9
+ m as AccountNotificationSettings
8
10
  };
@@ -0,0 +1,11 @@
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import "../../index-L8X2o7IH.js";
3
+ import "react";
4
+ import "../RootProvider/RootProvider.js";
5
+ import "../Searchbar/AutocompleteBase.js";
6
+ import "../Snackbar/useSnackbar.js";
7
+ import { Flex as i } from "../Page/Flex.js";
8
+ const a = ({ color: o, size: r, children: t, ...p }) => /* @__PURE__ */ m(i, { spacing: 3, color: o, size: r, ...p, children: t });
9
+ export {
10
+ a as ButtonGroup
11
+ };
@@ -1,13 +1,15 @@
1
1
  import { ButtonBase as r } from "./ButtonBase.js";
2
2
  import { ButtonLabel as n } from "./ButtonLabel.js";
3
- import { ButtonIcon as B } from "./ButtonIcon.js";
4
- import { Button as p } from "./Button.js";
3
+ import { ButtonIcon as p } from "./ButtonIcon.js";
4
+ import { Button as B } from "./Button.js";
5
5
  import { ComboButton as x } from "./ComboButton.js";
6
6
  import { IconButton as b } from "./IconButton.js";
7
+ import { ButtonGroup as I } from "./ButtonGroup.js";
7
8
  export {
8
- p as Button,
9
+ B as Button,
9
10
  r as ButtonBase,
10
- B as ButtonIcon,
11
+ I as ButtonGroup,
12
+ p as ButtonIcon,
11
13
  n as ButtonLabel,
12
14
  x as ComboButton,
13
15
  b as IconButton
@@ -0,0 +1,28 @@
1
+ import { jsxs as p, jsx as n } from "react/jsx-runtime";
2
+ import "../../index-L8X2o7IH.js";
3
+ import "react";
4
+ import { IconButton as a } from "../Button/IconButton.js";
5
+ import "../RootProvider/RootProvider.js";
6
+ import "../Searchbar/AutocompleteBase.js";
7
+ import "../Snackbar/useSnackbar.js";
8
+ import { ModalBase as c } from "./ModalBase.js";
9
+ import { S as d } from "../../XMark-DIqxCTTQ.js";
10
+ import '../../assets/Modal.css';const e = "_dismiss_ps82p_1", l = {
11
+ dismiss: e
12
+ }, y = ({ open: s, onClose: i, dismissable: o, closeTitle: t, children: m, ...r }) => /* @__PURE__ */ p(c, { padding: 6, spacing: 6, ...r, open: s, onClose: i, children: [
13
+ typeof i == "function" && o && /* @__PURE__ */ n(
14
+ a,
15
+ {
16
+ className: l.dismiss,
17
+ icon: d,
18
+ variant: "outline",
19
+ onClick: i,
20
+ iconAltText: t ?? "Close",
21
+ size: "sm"
22
+ }
23
+ ),
24
+ m
25
+ ] });
26
+ export {
27
+ y as Modal
28
+ };
@@ -1,37 +1,75 @@
1
1
  "use client";
2
- import { jsx as o } from "react/jsx-runtime";
3
- import { useRef as f, useEffect as m } from "react";
4
- import '../../assets/ModalBase.css';const u = "_modal_1jt70_1", t = {
5
- modal: u
6
- }, g = ({
7
- open: e,
8
- onClose: n,
9
- children: r,
10
- backdropColor: c = "inherit",
11
- size: d,
12
- color: s,
13
- variant: i = "default"
2
+ import { jsx as f } from "react/jsx-runtime";
3
+ import { useRef as S, useEffect as u } from "react";
4
+ import "../../index-L8X2o7IH.js";
5
+ import "../RootProvider/RootProvider.js";
6
+ import "../Searchbar/AutocompleteBase.js";
7
+ import "../Snackbar/useSnackbar.js";
8
+ import { Section as x } from "../Page/Section.js";
9
+ import '../../assets/ModalBase.css';const R = "_modal_zkvhc_1", z = "_content_zkvhc_30", d = {
10
+ modal: R,
11
+ content: z
12
+ }, Y = ({
13
+ open: c,
14
+ onClose: a,
15
+ closedBy: n = "any",
16
+ children: p,
17
+ backdropColor: v = "inherit",
18
+ size: h,
19
+ color: E,
20
+ padding: k = 0,
21
+ spacing: y = 0,
22
+ variant: b = "default"
14
23
  }) => {
15
- const l = f(null);
16
- return m(() => {
17
- const a = l.current;
18
- a && (e ? a.open || a.showModal() : a.open && a.close());
19
- }, [e]), /* @__PURE__ */ o(
24
+ const r = S(null);
25
+ return u(() => {
26
+ const e = r.current, o = (t) => {
27
+ var m;
28
+ const { clientY: s, clientX: l, target: L } = t;
29
+ if (t instanceof KeyboardEvent)
30
+ return n === "none" && t.key === "Escape" && t.preventDefault();
31
+ if (!((m = window.getSelection()) != null && m.toString()) && e && L === e && n === "any") {
32
+ const { top: _, left: w, right: C, bottom: D } = e.getBoundingClientRect();
33
+ _ <= s && s <= D && w <= l && l <= C || e == null || e.close();
34
+ }
35
+ }, i = () => {
36
+ const t = e == null ? void 0 : e.querySelector("[autofocus]");
37
+ document.activeElement !== t && (t == null || t.focus());
38
+ };
39
+ return e == null || e.addEventListener("animationend", i), e == null || e.addEventListener("click", o), e == null || e.addEventListener("keydown", o), () => {
40
+ e == null || e.removeEventListener("animationend", i), e == null || e.removeEventListener("click", o), e == null || e.removeEventListener("keydown", o);
41
+ };
42
+ }, [n]), u(() => {
43
+ const e = r.current;
44
+ e && (c ? e.open || e.showModal() : e.open && e.close());
45
+ }, [c]), /* @__PURE__ */ f(
20
46
  "dialog",
21
47
  {
22
- ref: l,
48
+ ref: r,
23
49
  "aria-modal": "true",
24
50
  "aria-labelledby": "modal-title",
25
- onCancel: (a) => {
26
- a.preventDefault(), n();
51
+ onCancel: (e) => {
52
+ e.preventDefault(), n === "any" && a();
27
53
  },
28
- "data-backdrop-color": c,
29
- className: t.modal,
30
- "data-variant": i,
31
- children: /* @__PURE__ */ o("section", { className: t.content, "aria-label": "modal content", "data-size": d, "data-color": s, children: r })
54
+ "data-backdrop-color": v,
55
+ className: d.modal,
56
+ "data-variant": b,
57
+ onClose: n !== "none" ? a : void 0,
58
+ children: /* @__PURE__ */ f(
59
+ x,
60
+ {
61
+ className: d.content,
62
+ "aria-label": "modal content",
63
+ size: h,
64
+ color: E,
65
+ padding: k,
66
+ spacing: y,
67
+ children: p
68
+ }
69
+ )
32
70
  }
33
71
  );
34
72
  };
35
73
  export {
36
- g as ModalBase
74
+ Y as ModalBase
37
75
  };
@@ -1,11 +1,13 @@
1
- import { jsx as t } from "react/jsx-runtime";
1
+ import { jsx as r } from "react/jsx-runtime";
2
2
  import "../../index-L8X2o7IH.js";
3
3
  import "react";
4
4
  import "../RootProvider/RootProvider.js";
5
5
  import "../Searchbar/AutocompleteBase.js";
6
6
  import "../Snackbar/useSnackbar.js";
7
7
  import { Section as i } from "../Page/Section.js";
8
- const s = ({ children: o, ...r }) => /* @__PURE__ */ t(i, { spacing: 2, padding: 2, ...r, children: o });
8
+ import '../../assets/ModalBody.css';const m = "_body_1cilr_1", p = {
9
+ body: m
10
+ }, b = ({ children: o, ...t }) => /* @__PURE__ */ r(i, { spacing: 6, padding: 6, ...t, className: p.body, children: o });
9
11
  export {
10
- s as ModalBody
12
+ b as ModalBody
11
13
  };
@@ -0,0 +1,11 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import "../../index-L8X2o7IH.js";
3
+ import "react";
4
+ import "../RootProvider/RootProvider.js";
5
+ import "../Searchbar/AutocompleteBase.js";
6
+ import "../Snackbar/useSnackbar.js";
7
+ import { Flex as p } from "../Page/Flex.js";
8
+ const f = ({ children: o, ...r }) => /* @__PURE__ */ t(p, { as: "footer", spacing: 2, padding: 4, ...r, children: o });
9
+ export {
10
+ f as ModalFooter
11
+ };
@@ -1,30 +1,30 @@
1
- import { jsxs as o, jsx as r } from "react/jsx-runtime";
2
- import "../../index-L8X2o7IH.js";
1
+ import { jsx as r, jsxs as c } from "react/jsx-runtime";
2
+ import { c as a } from "../../index-L8X2o7IH.js";
3
3
  import "react";
4
4
  import { IconButton as m } from "../Button/IconButton.js";
5
5
  import "../RootProvider/RootProvider.js";
6
6
  import { Heading as p } from "../Typography/Heading.js";
7
7
  import "../Searchbar/AutocompleteBase.js";
8
8
  import "../Snackbar/useSnackbar.js";
9
- import { Flex as c } from "../Page/Flex.js";
10
- import { Section as a } from "../Page/Section.js";
11
- import { S as s } from "../../XMark-DIqxCTTQ.js";
12
- const w = ({ title: t, onClose: i, closeTitle: e, children: n }) => /* @__PURE__ */ o(a, { as: "header", spacing: 2, padding: 4, children: [
13
- /* @__PURE__ */ o(c, { direction: "row", justify: "between", align: "center", spacing: 8, children: [
14
- /* @__PURE__ */ r(p, { as: "h2", size: "lg", children: t }),
15
- typeof i == "function" && /* @__PURE__ */ r(
16
- m,
17
- {
18
- icon: s,
19
- variant: "outline",
20
- onClick: i,
21
- iconAltText: e ?? "close",
22
- size: "sm"
23
- }
24
- )
25
- ] }),
26
- n
27
- ] });
9
+ import { Flex as d } from "../Page/Flex.js";
10
+ import { Section as l } from "../Page/Section.js";
11
+ import { S as f } from "../../XMark-DIqxCTTQ.js";
12
+ import '../../assets/ModalHeader.css';const h = "_header_7ty99_1", y = "_sticky_7ty99_6", o = {
13
+ header: h,
14
+ sticky: y
15
+ }, M = ({ title: t, onClose: i, closeTitle: e, children: n, sticky: s = !0 }) => /* @__PURE__ */ r(l, { as: "header", spacing: 2, padding: 4, className: a(o.header, s && o.sticky), children: /* @__PURE__ */ c(d, { direction: "row", justify: "between", align: "center", spacing: 8, children: [
16
+ n || t && /* @__PURE__ */ r(p, { as: "h2", size: "lg", children: t }),
17
+ typeof i == "function" && /* @__PURE__ */ r(
18
+ m,
19
+ {
20
+ icon: f,
21
+ variant: "outline",
22
+ onClick: i,
23
+ iconAltText: e ?? "Close",
24
+ size: "sm"
25
+ }
26
+ )
27
+ ] }) });
28
28
  export {
29
- w as ModalHeader
29
+ M as ModalHeader
30
30
  };
@@ -1,7 +1,9 @@
1
1
  import { ModalBase as e } from "./ModalBase.js";
2
2
  import { ModalHeader as d } from "./ModalHeader.js";
3
3
  import { ModalBody as l } from "./ModalBody.js";
4
+ import { Modal as p } from "./Modal.js";
4
5
  export {
6
+ p as Modal,
5
7
  e as ModalBase,
6
8
  l as ModalBody,
7
9
  d as ModalHeader