@altinn/altinn-components 0.42.3 → 0.42.5
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/dist/assets/Avatar.css +1 -1
- package/dist/assets/GlobalMenuButton.css +1 -1
- package/dist/components/Avatar/Avatar.js +53 -37
- package/dist/components/GlobalMenu/GlobalMenuButton.js +43 -34
- package/dist/components/Settings/SettingsItem.js +49 -24
- package/dist/types/lib/components/Account/AccountListItem.d.ts +1 -0
- package/dist/types/lib/components/Account/AccountListItem.stories.d.ts +1 -0
- package/dist/types/lib/components/Avatar/Avatar.d.ts +5 -1
- package/dist/types/lib/components/Avatar/Avatar.stories.d.ts +9 -1
- package/dist/types/lib/components/Dialog/SeenByLogItem.stories.d.ts +2 -0
- package/package.json +1 -1
package/dist/assets/Avatar.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._avatar_9mmgv_1{position:relative;overflow:hidden;box-sizing:border-box}._avatar_9mmgv_1[data-shape=circle]{border-radius:50%}._avatar_9mmgv_1[data-shape=square]{border-radius:5%}._avatar_9mmgv_1[data-outline=true]{outline:1px solid #ffffff;box-sizing:border-box}._shape_9mmgv_20{display:block;font-size:1em;width:1em;height:1em}._shape_9mmgv_20[data-variant=outline]{border:1px solid}._label_9mmgv_31{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;justify-content:center;align-items:center;overflow:hidden;font-size:.575em}._image_9mmgv_41{display:block;width:100%;height:100%}._deletedIcon_9mmgv_47{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%}@supports (-webkit-hyphens: none){._avatar_9mmgv_1[data-size=lg] ._label_9mmgv_31{font-size:1.58rem}._avatar_9mmgv_1[data-size=md] ._label_9mmgv_31{font-size:1.15rem}._avatar_9mmgv_1[data-size=sm] ._label_9mmgv_31{font-size:.85rem}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._button_1uh95_1{flex-shrink:0;position:relative;z-index:2;display:inline-flex;align-items:center;column-gap:.625rem;padding:.625rem;border:none;border-radius:4px}._label_1uh95_13{font-size:1.125rem;font-weight:500;padding:.25rem}._avatarIcon_1uh95_19,._loginIcon_1uh95_20,._closeIcon_1uh95_21{width:2.25rem;height:2.25rem;border-radius:2px;font-size:unset}._closeIcon_1uh95_21{outline:1px solid white}._loginIcon_1uh95_20{background-color:#fff;color:#000;outline:1px solid white}._avatar_1uh95_19{font-size:2.25rem;width:2.25rem;height:2.25rem}._icon_1uh95_44{font-size:1.5rem;width:1.5rem;height:1.5rem}._badge_1uh95_50{position:absolute;top:0;right:0;margin-top:-.75rem;margin-right:-.75rem}
|
|
@@ -1,61 +1,77 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { c as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { Skeleton as
|
|
6
|
-
import { fromStringToColor as
|
|
7
|
-
import '../../assets/Avatar.css';const
|
|
8
|
-
avatar:
|
|
9
|
-
shape:
|
|
10
|
-
label:
|
|
11
|
-
image:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
import { jsx as a, jsxs as j } from "react/jsx-runtime";
|
|
3
|
+
import { c as A } from "../../index-L8X2o7IH.js";
|
|
4
|
+
import { useState as E } from "react";
|
|
5
|
+
import { Skeleton as y } from "../Skeleton/Skeleton.js";
|
|
6
|
+
import { fromStringToColor as q } from "./color.js";
|
|
7
|
+
import '../../assets/Avatar.css';const z = "_avatar_9mmgv_1", B = "_shape_9mmgv_20", H = "_label_9mmgv_31", L = "_image_9mmgv_41", M = "_deletedIcon_9mmgv_47", r = {
|
|
8
|
+
avatar: z,
|
|
9
|
+
shape: B,
|
|
10
|
+
label: H,
|
|
11
|
+
image: L,
|
|
12
|
+
deletedIcon: M
|
|
13
|
+
}, G = (e) => typeof e == "object" && e !== null && "name" in e, J = ({
|
|
14
|
+
type: e = "person",
|
|
15
|
+
isParent: d = !0,
|
|
16
|
+
isDeleted: p = !1,
|
|
17
|
+
size: h,
|
|
15
18
|
name: l = "Avatar",
|
|
16
|
-
shape:
|
|
19
|
+
shape: g,
|
|
17
20
|
color: u,
|
|
18
|
-
variant:
|
|
19
|
-
outline:
|
|
20
|
-
imageUrl:
|
|
21
|
-
imageUrlAlt:
|
|
22
|
-
customLabel:
|
|
21
|
+
variant: v,
|
|
22
|
+
outline: _ = !0,
|
|
23
|
+
imageUrl: t,
|
|
24
|
+
imageUrlAlt: f,
|
|
25
|
+
customLabel: b,
|
|
23
26
|
loading: n,
|
|
24
|
-
className:
|
|
27
|
+
className: C,
|
|
25
28
|
style: c = {}
|
|
26
29
|
}) => {
|
|
27
|
-
const [
|
|
30
|
+
const [I, w] = E(!1), x = g || e === "person" ? "circle" : "square", N = u || e === "person" ? "light" : "dark", o = v || !d ? "outline" : "solid", { backgroundColor: i, foregroundColor: m } = q(l, N), k = (l[0] ?? "").toUpperCase(), s = t && !I, S = !n && !s ? {
|
|
28
31
|
...c,
|
|
29
|
-
backgroundColor: o === "outline" ?
|
|
30
|
-
color: o === "outline" ? i :
|
|
32
|
+
backgroundColor: o === "outline" ? m : i,
|
|
33
|
+
color: o === "outline" ? i : m
|
|
31
34
|
} : c;
|
|
32
|
-
return /* @__PURE__ */
|
|
35
|
+
return /* @__PURE__ */ a(
|
|
33
36
|
"div",
|
|
34
37
|
{
|
|
35
|
-
className:
|
|
36
|
-
style:
|
|
37
|
-
"data-shape":
|
|
38
|
-
"data-size":
|
|
39
|
-
"data-outline":
|
|
38
|
+
className: A(r.avatar, C),
|
|
39
|
+
style: S,
|
|
40
|
+
"data-shape": x,
|
|
41
|
+
"data-size": h,
|
|
42
|
+
"data-outline": _,
|
|
40
43
|
"aria-hidden": !0,
|
|
41
|
-
children: /* @__PURE__ */
|
|
42
|
-
/* @__PURE__ */
|
|
44
|
+
children: /* @__PURE__ */ j(y, { loading: n, className: r.shape, variant: "circle", children: [
|
|
45
|
+
/* @__PURE__ */ a("div", { className: r.shape, "data-variant": o, children: s && /* @__PURE__ */ a(
|
|
43
46
|
"img",
|
|
44
47
|
{
|
|
45
|
-
src:
|
|
48
|
+
src: t,
|
|
46
49
|
className: r.image,
|
|
47
|
-
alt:
|
|
50
|
+
alt: f || t,
|
|
48
51
|
onError: () => {
|
|
49
|
-
|
|
52
|
+
w(!0);
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
55
|
) }),
|
|
53
|
-
!
|
|
56
|
+
!s && /* @__PURE__ */ a("span", { className: r.label, children: b || k }),
|
|
57
|
+
p && /* @__PURE__ */ a(
|
|
58
|
+
"svg",
|
|
59
|
+
{
|
|
60
|
+
"aria-hidden": "true",
|
|
61
|
+
className: r.deletedIcon,
|
|
62
|
+
width: "24",
|
|
63
|
+
height: "24",
|
|
64
|
+
viewBox: "0 0 24 24",
|
|
65
|
+
fill: "none",
|
|
66
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
67
|
+
children: /* @__PURE__ */ a("path", { d: "M0 24L24 -1.20156e-06", stroke: "currentColor" })
|
|
68
|
+
}
|
|
69
|
+
)
|
|
54
70
|
] })
|
|
55
71
|
}
|
|
56
72
|
);
|
|
57
73
|
};
|
|
58
74
|
export {
|
|
59
|
-
|
|
60
|
-
|
|
75
|
+
J as Avatar,
|
|
76
|
+
G as isAvatarProps
|
|
61
77
|
};
|
|
@@ -1,49 +1,58 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as l, jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { c as _ } from "../../index-L8X2o7IH.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { Avatar as u } from "../Avatar/Avatar.js";
|
|
5
|
+
import { Badge as I } from "../Badge/Badge.js";
|
|
6
|
+
import { ButtonBase as h } from "../Button/ButtonBase.js";
|
|
7
|
+
import { ButtonLabel as d } from "../Button/ButtonLabel.js";
|
|
8
|
+
import { ButtonIcon as f } from "../Button/ButtonIcon.js";
|
|
8
9
|
import "../RootProvider/RootProvider.js";
|
|
9
10
|
import "../Snackbar/useSnackbar.js";
|
|
10
|
-
import { S as
|
|
11
|
-
import { S as
|
|
12
|
-
import '../../assets/GlobalMenuButton.css';const
|
|
13
|
-
button:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
import { S as N } from "../../XMark-tKk6aExO.js";
|
|
12
|
+
import { S as g } from "../../PadlockLocked-XL1IB5Ae.js";
|
|
13
|
+
import '../../assets/GlobalMenuButton.css';const v = "_button_1uh95_1", b = "_avatarIcon_1uh95_19", B = "_loginIcon_1uh95_20", x = "_closeIcon_1uh95_21", S = "_avatar_1uh95_19", k = "_icon_1uh95_44", L = "_badge_1uh95_50", a = {
|
|
14
|
+
button: v,
|
|
15
|
+
avatarIcon: b,
|
|
16
|
+
loginIcon: B,
|
|
17
|
+
closeIcon: x,
|
|
18
|
+
avatar: S,
|
|
19
|
+
icon: k,
|
|
20
|
+
badge: L
|
|
21
|
+
}, H = ({
|
|
19
22
|
className: t,
|
|
20
|
-
as:
|
|
23
|
+
as: s = "button",
|
|
21
24
|
color: i = "accent",
|
|
22
|
-
variant:
|
|
23
|
-
currentAccount:
|
|
24
|
-
expanded:
|
|
25
|
-
label:
|
|
25
|
+
variant: m = "solid",
|
|
26
|
+
currentAccount: c,
|
|
27
|
+
expanded: p,
|
|
28
|
+
label: r = "Menu",
|
|
26
29
|
badge: n,
|
|
27
|
-
...
|
|
28
|
-
}) =>
|
|
29
|
-
/* @__PURE__ */ o(
|
|
30
|
-
/* @__PURE__ */ o(
|
|
31
|
-
n && /* @__PURE__ */ o(
|
|
32
|
-
] }) :
|
|
33
|
-
/* @__PURE__ */ o(
|
|
34
|
-
/* @__PURE__ */ o(p, { className: a.avatar, icon: s == null ? void 0 : s.icon }),
|
|
35
|
-
n && /* @__PURE__ */ o(d, { ...n, className: a.badge })
|
|
36
|
-
] }) : /* @__PURE__ */ r(I, { ...m, as: c, variant: e, color: i, className: _(a.button, t), children: [
|
|
37
|
-
/* @__PURE__ */ o(f, { children: l }),
|
|
30
|
+
...e
|
|
31
|
+
}) => p ? /* @__PURE__ */ l(h, { ...e, as: s, variant: m, color: i, className: _(a.button, t), children: [
|
|
32
|
+
/* @__PURE__ */ o(d, { children: r }),
|
|
33
|
+
/* @__PURE__ */ o(f, { className: a.closeIcon, icon: /* @__PURE__ */ o(N, { className: a.icon, "aria-label": "Close Icon" }) }),
|
|
34
|
+
n && /* @__PURE__ */ o(I, { ...n, className: a.badge })
|
|
35
|
+
] }) : c ? /* @__PURE__ */ l(h, { ...e, as: s, variant: m, color: i, className: _(a.button, t), children: [
|
|
36
|
+
/* @__PURE__ */ o(d, { children: r }),
|
|
38
37
|
/* @__PURE__ */ o(
|
|
39
|
-
|
|
38
|
+
f,
|
|
39
|
+
{
|
|
40
|
+
className: a.avatarIcon,
|
|
41
|
+
icon: /* @__PURE__ */ o(u, { ...c == null ? void 0 : c.icon, className: a.avatar })
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
n && /* @__PURE__ */ o(I, { ...n, className: a.badge })
|
|
45
|
+
] }) : /* @__PURE__ */ l(h, { ...e, as: s, variant: m, color: i, className: _(a.button, t), children: [
|
|
46
|
+
/* @__PURE__ */ o(d, { children: r }),
|
|
47
|
+
/* @__PURE__ */ o(
|
|
48
|
+
f,
|
|
40
49
|
{
|
|
41
50
|
className: a.loginIcon,
|
|
42
|
-
icon: /* @__PURE__ */ o(
|
|
51
|
+
icon: /* @__PURE__ */ o(g, { className: a.icon, "aria-label": "Login Icon" })
|
|
43
52
|
}
|
|
44
53
|
),
|
|
45
|
-
n && /* @__PURE__ */ o(
|
|
54
|
+
n && /* @__PURE__ */ o(I, { ...n, className: a.badge })
|
|
46
55
|
] });
|
|
47
56
|
export {
|
|
48
|
-
|
|
57
|
+
H as GlobalMenuButton
|
|
49
58
|
};
|
|
@@ -3,22 +3,22 @@ import "../../index-L8X2o7IH.js";
|
|
|
3
3
|
import { useState as b } from "react";
|
|
4
4
|
import "../RootProvider/RootProvider.js";
|
|
5
5
|
import "../Snackbar/useSnackbar.js";
|
|
6
|
-
import { Input as
|
|
6
|
+
import { Input as w } from "../Forms/Input.js";
|
|
7
7
|
import { SettingsItemBase as n } from "./SettingsItemBase.js";
|
|
8
|
-
import { SettingsModal as
|
|
9
|
-
const
|
|
10
|
-
loading:
|
|
8
|
+
import { SettingsModal as x } from "./SettingsModal.js";
|
|
9
|
+
const M = ({
|
|
10
|
+
loading: u,
|
|
11
11
|
variant: f = "default",
|
|
12
12
|
id: c = "settings",
|
|
13
|
-
name:
|
|
14
|
-
checked:
|
|
15
|
-
onChange:
|
|
13
|
+
name: h,
|
|
14
|
+
checked: m,
|
|
15
|
+
onChange: g,
|
|
16
16
|
modalProps: e,
|
|
17
17
|
children: v,
|
|
18
18
|
...t
|
|
19
19
|
}) => {
|
|
20
|
-
const [l,
|
|
21
|
-
if (
|
|
20
|
+
const [l, a] = b(!1);
|
|
21
|
+
if (u)
|
|
22
22
|
return /* @__PURE__ */ i(n, { icon: t == null ? void 0 : t.icon, title: t == null ? void 0 : t.title, loading: !0 });
|
|
23
23
|
switch (f) {
|
|
24
24
|
case "switch":
|
|
@@ -34,36 +34,61 @@ const O = ({
|
|
|
34
34
|
value: void 0,
|
|
35
35
|
interactive: !1,
|
|
36
36
|
controls: /* @__PURE__ */ i(
|
|
37
|
-
|
|
37
|
+
w,
|
|
38
38
|
{
|
|
39
39
|
type: "checkbox",
|
|
40
40
|
role: "switch",
|
|
41
41
|
"aria-labelledby": c,
|
|
42
|
-
name:
|
|
42
|
+
name: h,
|
|
43
43
|
value: t == null ? void 0 : t.value,
|
|
44
|
-
checked:
|
|
45
|
-
onChange:
|
|
44
|
+
checked: m,
|
|
45
|
+
onChange: g,
|
|
46
46
|
style: { marginRight: "0.5em" }
|
|
47
47
|
}
|
|
48
48
|
)
|
|
49
49
|
}
|
|
50
50
|
);
|
|
51
51
|
case "modal":
|
|
52
|
-
return /* @__PURE__ */ i(
|
|
53
|
-
|
|
52
|
+
return /* @__PURE__ */ i(
|
|
53
|
+
n,
|
|
54
54
|
{
|
|
55
|
-
...
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
...t,
|
|
56
|
+
title: {
|
|
57
|
+
variant: "subtle",
|
|
58
|
+
weight: "normal",
|
|
59
|
+
children: t == null ? void 0 : t.title
|
|
60
|
+
},
|
|
61
|
+
as: "button",
|
|
62
|
+
linkIcon: !0,
|
|
63
|
+
onClick: () => a(!0),
|
|
64
|
+
expanded: l,
|
|
65
|
+
children: l && /* @__PURE__ */ i(
|
|
66
|
+
x,
|
|
67
|
+
{
|
|
68
|
+
...e,
|
|
69
|
+
icon: (e == null ? void 0 : e.icon) || (t == null ? void 0 : t.icon),
|
|
70
|
+
title: (e == null ? void 0 : e.title) || (t == null ? void 0 : t.title),
|
|
71
|
+
open: l,
|
|
72
|
+
onClose: () => a(!1),
|
|
73
|
+
children: v
|
|
74
|
+
}
|
|
75
|
+
)
|
|
61
76
|
}
|
|
62
|
-
)
|
|
77
|
+
);
|
|
63
78
|
default:
|
|
64
|
-
return /* @__PURE__ */ i(
|
|
79
|
+
return /* @__PURE__ */ i(
|
|
80
|
+
n,
|
|
81
|
+
{
|
|
82
|
+
...t,
|
|
83
|
+
title: {
|
|
84
|
+
variant: "subtle",
|
|
85
|
+
weight: "normal",
|
|
86
|
+
children: t == null ? void 0 : t.title
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
);
|
|
65
90
|
}
|
|
66
91
|
};
|
|
67
92
|
export {
|
|
68
|
-
|
|
93
|
+
M as SettingsItem
|
|
69
94
|
};
|
|
@@ -25,6 +25,7 @@ declare const meta: {
|
|
|
25
25
|
accountIds?: string[] | undefined;
|
|
26
26
|
isCurrentEndUser?: boolean | undefined;
|
|
27
27
|
isDeleted?: boolean | undefined;
|
|
28
|
+
isParent?: boolean | undefined;
|
|
28
29
|
contextMenu?: import('..').ContextMenuProps | undefined;
|
|
29
30
|
label?: string | undefined;
|
|
30
31
|
variant?: import('..').ListItemVariant | undefined;
|
|
@@ -14,6 +14,10 @@ export interface AvatarProps {
|
|
|
14
14
|
name: string;
|
|
15
15
|
/** The type of avatar. */
|
|
16
16
|
type?: AvatarType;
|
|
17
|
+
/** Company is a parent. */
|
|
18
|
+
isParent?: boolean;
|
|
19
|
+
/** Company is a deleted. */
|
|
20
|
+
isDeleted?: boolean;
|
|
17
21
|
/** Avatar shape. */
|
|
18
22
|
shape?: AvatarColor;
|
|
19
23
|
/** Avatar color. */
|
|
@@ -41,4 +45,4 @@ export declare const isAvatarProps: (icon: unknown) => icon is AvatarProps;
|
|
|
41
45
|
/**
|
|
42
46
|
* Avatar component to display user or company avatars with various customization options.
|
|
43
47
|
*/
|
|
44
|
-
export declare const Avatar: ({ type, size, name, shape, color, variant, outline, imageUrl, imageUrlAlt, customLabel, loading, className, style, }: AvatarProps) => ReactElement;
|
|
48
|
+
export declare const Avatar: ({ type, isParent, isDeleted, size, name, shape, color, variant, outline, imageUrl, imageUrlAlt, customLabel, loading, className, style, }: AvatarProps) => ReactElement;
|
|
@@ -2,7 +2,7 @@ import { StoryObj } from '@storybook/react-vite';
|
|
|
2
2
|
import { AvatarProps } from '..';
|
|
3
3
|
declare const meta: {
|
|
4
4
|
title: string;
|
|
5
|
-
component: ({ type, size, name, shape, color, variant, outline, imageUrl, imageUrlAlt, customLabel, loading, className, style, }: AvatarProps) => React.ReactElement;
|
|
5
|
+
component: ({ type, isParent, isDeleted, size, name, shape, color, variant, outline, imageUrl, imageUrlAlt, customLabel, loading, className, style, }: AvatarProps) => React.ReactElement;
|
|
6
6
|
tags: string[];
|
|
7
7
|
parameters: {
|
|
8
8
|
layout: string;
|
|
@@ -10,12 +10,20 @@ declare const meta: {
|
|
|
10
10
|
args: {
|
|
11
11
|
name: string;
|
|
12
12
|
type: "person";
|
|
13
|
+
style: {
|
|
14
|
+
fontSize: string;
|
|
15
|
+
width: string;
|
|
16
|
+
height: string;
|
|
17
|
+
};
|
|
13
18
|
};
|
|
14
19
|
};
|
|
15
20
|
export default meta;
|
|
16
21
|
type Story = StoryObj<typeof meta>;
|
|
17
22
|
export declare const Person: Story;
|
|
18
23
|
export declare const Company: Story;
|
|
24
|
+
export declare const DeletedCompany: Story;
|
|
25
|
+
export declare const Subunit: Story;
|
|
26
|
+
export declare const DeletedSubunit: Story;
|
|
19
27
|
export declare const Logo: Story;
|
|
20
28
|
export declare const Loading: Story;
|
|
21
29
|
export declare const Sizes: ({ type, name, imageUrl }: AvatarProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -21,6 +21,8 @@ declare const meta: {
|
|
|
21
21
|
size?: "sm" | "md" | undefined;
|
|
22
22
|
name: string;
|
|
23
23
|
type?: import('..').AvatarType | undefined;
|
|
24
|
+
isParent?: boolean | undefined;
|
|
25
|
+
isDeleted?: boolean | undefined;
|
|
24
26
|
shape?: import('..').AvatarColor | undefined;
|
|
25
27
|
color?: import('..').AvatarColor | undefined;
|
|
26
28
|
variant?: import('..').AvatarVariant | undefined;
|