@altinn/altinn-components 0.42.4 → 0.42.6
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/components/Avatar/Avatar.js +57 -40
- 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 +10 -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_1en7r_1{position:relative;overflow:hidden;box-sizing:border-box}._avatar_1en7r_1[data-shape=circle]{border-radius:50%}._avatar_1en7r_1[data-shape=square]{border-radius:5%}._avatar_1en7r_1{outline:1px solid #ffffff;box-sizing:border-box}._shape_1en7r_20{display:block;font-size:1em;width:1em;height:1em}._shape_1en7r_20[data-variant=outline]{border:1px solid}._label_1en7r_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_1en7r_41{display:block;width:100%;height:100%}._deletedIcon_1en7r_47{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%}@supports (-webkit-hyphens: none){._avatar_1en7r_1[data-size=lg] ._label_1en7r_31{font-size:1.58rem}._avatar_1en7r_1[data-size=md] ._label_1en7r_31{font-size:1.15rem}._avatar_1en7r_1[data-size=sm] ._label_1en7r_31{font-size:.85rem}}
|
|
@@ -1,61 +1,78 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
2
|
+
import { jsx as a, jsxs as S } from "react/jsx-runtime";
|
|
3
3
|
import { c as j } from "../../index-L8X2o7IH.js";
|
|
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: H
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
import { useState as y } from "react";
|
|
5
|
+
import { Skeleton as A } from "../Skeleton/Skeleton.js";
|
|
6
|
+
import { fromStringToColor as E } from "./color.js";
|
|
7
|
+
import '../../assets/Avatar.css';const q = "_avatar_1en7r_1", z = "_shape_1en7r_20", B = "_label_1en7r_31", H = "_image_1en7r_41", L = "_deletedIcon_1en7r_47", r = {
|
|
8
|
+
avatar: q,
|
|
9
|
+
shape: z,
|
|
10
|
+
label: B,
|
|
11
|
+
image: H,
|
|
12
|
+
deletedIcon: L
|
|
13
|
+
}, G = (e) => typeof e == "object" && e !== null && "name" in e, J = ({
|
|
14
|
+
type: e = "person",
|
|
15
|
+
isParent: n,
|
|
16
|
+
isDeleted: m = !1,
|
|
17
|
+
size: h,
|
|
15
18
|
name: l = "Avatar",
|
|
16
|
-
shape:
|
|
17
|
-
color:
|
|
18
|
-
variant:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
style: c = {}
|
|
19
|
+
shape: u,
|
|
20
|
+
color: g,
|
|
21
|
+
variant: _,
|
|
22
|
+
imageUrl: t,
|
|
23
|
+
imageUrlAlt: f,
|
|
24
|
+
customLabel: v,
|
|
25
|
+
loading: c,
|
|
26
|
+
className: b,
|
|
27
|
+
style: i = {}
|
|
26
28
|
}) => {
|
|
27
|
-
const [
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
const [C, I] = y(!1), w = u || e === "person" ? "circle" : "square", x = g || e === "person" ? "light" : "dark";
|
|
30
|
+
let o = _;
|
|
31
|
+
e === "company" && typeof n == "boolean" && (o = n ? "solid" : "outline");
|
|
32
|
+
const { backgroundColor: p, foregroundColor: d } = E(l, x), N = (l[0] ?? "").toUpperCase(), s = t && !C, k = !c && !s ? {
|
|
33
|
+
...i,
|
|
34
|
+
backgroundColor: o === "outline" ? d : p,
|
|
35
|
+
color: o === "outline" ? p : d
|
|
36
|
+
} : i;
|
|
37
|
+
return /* @__PURE__ */ a(
|
|
33
38
|
"div",
|
|
34
39
|
{
|
|
35
|
-
className: j(r.avatar,
|
|
40
|
+
className: j(r.avatar, b),
|
|
36
41
|
style: k,
|
|
37
|
-
"data-shape":
|
|
38
|
-
"data-size":
|
|
39
|
-
"data-outline": h,
|
|
42
|
+
"data-shape": w,
|
|
43
|
+
"data-size": h,
|
|
40
44
|
"aria-hidden": !0,
|
|
41
|
-
children: /* @__PURE__ */
|
|
42
|
-
/* @__PURE__ */
|
|
45
|
+
children: /* @__PURE__ */ S(A, { loading: c, className: r.shape, variant: "circle", children: [
|
|
46
|
+
/* @__PURE__ */ a("div", { className: r.shape, "data-variant": o, children: s && /* @__PURE__ */ a(
|
|
43
47
|
"img",
|
|
44
48
|
{
|
|
45
|
-
src:
|
|
49
|
+
src: t,
|
|
46
50
|
className: r.image,
|
|
47
|
-
alt:
|
|
51
|
+
alt: f || t,
|
|
48
52
|
onError: () => {
|
|
49
|
-
|
|
53
|
+
I(!0);
|
|
50
54
|
}
|
|
51
55
|
}
|
|
52
56
|
) }),
|
|
53
|
-
!
|
|
57
|
+
!s && /* @__PURE__ */ a("span", { className: r.label, children: v || N }),
|
|
58
|
+
m && /* @__PURE__ */ a(
|
|
59
|
+
"svg",
|
|
60
|
+
{
|
|
61
|
+
"aria-hidden": "true",
|
|
62
|
+
className: r.deletedIcon,
|
|
63
|
+
width: "24",
|
|
64
|
+
height: "24",
|
|
65
|
+
viewBox: "0 0 24 24",
|
|
66
|
+
fill: "none",
|
|
67
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
68
|
+
children: /* @__PURE__ */ a("path", { d: "M0 24L24 -1.20156e-06", stroke: "currentColor" })
|
|
69
|
+
}
|
|
70
|
+
)
|
|
54
71
|
] })
|
|
55
72
|
}
|
|
56
73
|
);
|
|
57
74
|
};
|
|
58
75
|
export {
|
|
59
|
-
|
|
60
|
-
|
|
76
|
+
J as Avatar,
|
|
77
|
+
G as isAvatarProps
|
|
61
78
|
};
|
|
@@ -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,
|
|
48
|
+
export declare const Avatar: ({ type, isParent, isDeleted, size, name, shape, color, variant, 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,
|
|
5
|
+
component: ({ type, isParent, isDeleted, size, name, shape, color, variant, imageUrl, imageUrlAlt, customLabel, loading, className, style, }: AvatarProps) => React.ReactElement;
|
|
6
6
|
tags: string[];
|
|
7
7
|
parameters: {
|
|
8
8
|
layout: string;
|
|
@@ -10,12 +10,21 @@ 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 CompanyOutline: Story;
|
|
25
|
+
export declare const DeletedCompany: Story;
|
|
26
|
+
export declare const Subunit: Story;
|
|
27
|
+
export declare const DeletedSubunit: Story;
|
|
19
28
|
export declare const Logo: Story;
|
|
20
29
|
export declare const Loading: Story;
|
|
21
30
|
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;
|