@altinn/altinn-components 0.33.5 → 0.33.7
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/components/Avatar/Avatar.js +27 -24
- package/dist/components/Byline/Byline.js +25 -16
- package/dist/components/Dialog/SeenByLogItem.js +6 -6
- package/dist/types/lib/components/Avatar/Avatar.d.ts +5 -1
- package/dist/types/lib/components/Avatar/Avatar.stories.d.ts +1 -1
- package/dist/types/lib/components/Dialog/SeenByLogItem.stories.d.ts +20 -0
- package/package.json +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as s, jsxs 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
|
-
},
|
|
2
|
+
import { jsx as s, jsxs as y } from "react/jsx-runtime";
|
|
3
|
+
import { c as C } from "../../index-L8X2o7IH.js";
|
|
4
|
+
import { useState as S } from "react";
|
|
5
|
+
import { Skeleton as j } from "../Skeleton/Skeleton.js";
|
|
6
|
+
import { fromStringToColor as A } from "./color.js";
|
|
7
|
+
import '../../assets/Avatar.css';const E = "_avatar_1k073_1", I = "_shape_1k073_20", q = "_label_1k073_27", z = "_image_1k073_37", r = {
|
|
8
|
+
avatar: E,
|
|
9
|
+
shape: I,
|
|
10
|
+
label: q,
|
|
11
|
+
image: z
|
|
12
|
+
}, D = (a) => typeof a == "object" && a !== null && "name" in a, F = ({
|
|
13
13
|
type: a = "person",
|
|
14
14
|
size: i,
|
|
15
15
|
name: o = "Avatar",
|
|
@@ -19,40 +19,43 @@ import '../../assets/Avatar.css';const A = "_avatar_1k073_1", E = "_shape_1k073_
|
|
|
19
19
|
customLabel: p,
|
|
20
20
|
loading: l,
|
|
21
21
|
className: d,
|
|
22
|
-
style: c = {}
|
|
22
|
+
style: c = {},
|
|
23
|
+
innerContainerStyle: h = {},
|
|
24
|
+
avatarImageStyle: u = {}
|
|
23
25
|
}) => {
|
|
24
|
-
const [
|
|
26
|
+
const [v, _] = S(!1), f = a === "person" ? "circle" : "square", g = a === "person" ? "light" : "dark", { backgroundColor: k, foregroundColor: b } = A(o, g), N = (o[0] ?? "").toUpperCase(), t = e && !v, x = !l && !t ? {
|
|
25
27
|
...c,
|
|
26
|
-
backgroundColor:
|
|
27
|
-
color:
|
|
28
|
+
backgroundColor: k,
|
|
29
|
+
color: b
|
|
28
30
|
} : c;
|
|
29
31
|
return /* @__PURE__ */ s(
|
|
30
32
|
"div",
|
|
31
33
|
{
|
|
32
|
-
className:
|
|
33
|
-
style:
|
|
34
|
-
"data-variant":
|
|
34
|
+
className: C(r.avatar, { [r.outline]: n }, d),
|
|
35
|
+
style: x,
|
|
36
|
+
"data-variant": f,
|
|
35
37
|
"data-size": i,
|
|
36
38
|
"data-outline": n,
|
|
37
39
|
"aria-hidden": !0,
|
|
38
|
-
children: /* @__PURE__ */
|
|
39
|
-
/* @__PURE__ */ s("div", { className: r.shape, children: t && /* @__PURE__ */ s(
|
|
40
|
+
children: /* @__PURE__ */ y(j, { loading: l, className: r.shape, variant: "circle", children: [
|
|
41
|
+
/* @__PURE__ */ s("div", { className: r.shape, style: h, children: t && /* @__PURE__ */ s(
|
|
40
42
|
"img",
|
|
41
43
|
{
|
|
42
44
|
src: e,
|
|
43
45
|
className: r.image,
|
|
44
46
|
alt: m || e,
|
|
47
|
+
style: u,
|
|
45
48
|
onError: () => {
|
|
46
|
-
|
|
49
|
+
_(!0);
|
|
47
50
|
}
|
|
48
51
|
}
|
|
49
52
|
) }),
|
|
50
|
-
!t && /* @__PURE__ */ s("span", { className: r.label, children: p ||
|
|
53
|
+
!t && /* @__PURE__ */ s("span", { className: r.label, children: p || N })
|
|
51
54
|
] })
|
|
52
55
|
}
|
|
53
56
|
);
|
|
54
57
|
};
|
|
55
58
|
export {
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
F as Avatar,
|
|
60
|
+
D as isAvatarProps
|
|
58
61
|
};
|
|
@@ -4,28 +4,37 @@ import "react";
|
|
|
4
4
|
import { Avatar as _ } from "../Avatar/Avatar.js";
|
|
5
5
|
import { AvatarGroup as v } from "../Avatar/AvatarGroup.js";
|
|
6
6
|
import "../RootProvider/RootProvider.js";
|
|
7
|
-
import { Skeleton as
|
|
7
|
+
import { Skeleton as l } from "../Skeleton/Skeleton.js";
|
|
8
8
|
import "../Searchbar/AutocompleteBase.js";
|
|
9
9
|
import "../Snackbar/useSnackbar.js";
|
|
10
|
-
import '../../assets/Byline.css';const d = "_byline_zacbk_1", y = "_avatar_zacbk_7",
|
|
10
|
+
import '../../assets/Byline.css';const d = "_byline_zacbk_1", y = "_avatar_zacbk_7", h = "_avatarGroup_zacbk_11", u = "_label_zacbk_19", t = {
|
|
11
11
|
byline: d,
|
|
12
12
|
avatar: y,
|
|
13
|
-
avatarGroup:
|
|
13
|
+
avatarGroup: h,
|
|
14
14
|
label: u
|
|
15
|
-
},
|
|
16
|
-
loading:
|
|
17
|
-
color:
|
|
18
|
-
size:
|
|
19
|
-
avatar:
|
|
20
|
-
avatarGroup:
|
|
21
|
-
datetime:
|
|
22
|
-
children:
|
|
23
|
-
as:
|
|
15
|
+
}, A = ({
|
|
16
|
+
loading: n,
|
|
17
|
+
color: i = "neutral",
|
|
18
|
+
size: e = "xs",
|
|
19
|
+
avatar: r,
|
|
20
|
+
avatarGroup: o,
|
|
21
|
+
datetime: m,
|
|
22
|
+
children: c,
|
|
23
|
+
as: s,
|
|
24
24
|
...p
|
|
25
|
-
}) => /* @__PURE__ */ b(
|
|
26
|
-
(
|
|
27
|
-
|
|
25
|
+
}) => /* @__PURE__ */ b(s || "div", { ...p, className: t.byline, "data-color": i, "data-size": e, children: [
|
|
26
|
+
(o || r) && /* @__PURE__ */ a(l, { variant: "circle", className: t.avatar, loading: n, children: o ? /* @__PURE__ */ a(v, { ...o, size: e, className: t.avatarGroup }) : r && /* @__PURE__ */ a(
|
|
27
|
+
_,
|
|
28
|
+
{
|
|
29
|
+
...r,
|
|
30
|
+
size: e,
|
|
31
|
+
className: t.avatar,
|
|
32
|
+
innerContainerStyle: { width: "fit-content" },
|
|
33
|
+
avatarImageStyle: { height: "1em", width: "auto" }
|
|
34
|
+
}
|
|
35
|
+
) }),
|
|
36
|
+
/* @__PURE__ */ a("time", { "data-size": e, dateTime: m, className: t.label, children: /* @__PURE__ */ a(l, { loading: n, children: c }) })
|
|
28
37
|
] });
|
|
29
38
|
export {
|
|
30
|
-
|
|
39
|
+
A as Byline
|
|
31
40
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsxs as e, jsx as
|
|
1
|
+
import { jsxs as e, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import "../../index-L8X2o7IH.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import { Badge as s } from "../Badge/Badge.js";
|
|
@@ -7,15 +7,15 @@ import "../RootProvider/RootProvider.js";
|
|
|
7
7
|
import "../Searchbar/AutocompleteBase.js";
|
|
8
8
|
import "../Snackbar/useSnackbar.js";
|
|
9
9
|
import { Flex as l } from "../Page/Flex.js";
|
|
10
|
-
const j = ({ name: r, seenAt:
|
|
10
|
+
const j = ({ name: r, seenAt: o, seenAtLabel: m, isEndUser: n, endUserLabel: p }) => {
|
|
11
11
|
const t = n && { label: p };
|
|
12
|
-
return /* @__PURE__ */ e(l, { align: "center", spacing: 2, children: [
|
|
13
|
-
/* @__PURE__ */ e(a, { size: "sm", datetime:
|
|
14
|
-
/* @__PURE__ */
|
|
12
|
+
return /* @__PURE__ */ e(l, { align: "center", spacing: 2, as: "li", children: [
|
|
13
|
+
/* @__PURE__ */ e(a, { size: "sm", datetime: o, avatar: { name: r, type: "person" }, children: [
|
|
14
|
+
/* @__PURE__ */ i("strong", { children: r + "," }),
|
|
15
15
|
" ",
|
|
16
16
|
m
|
|
17
17
|
] }),
|
|
18
|
-
t && /* @__PURE__ */
|
|
18
|
+
t && /* @__PURE__ */ i(s, { variant: "subtle", ...t })
|
|
19
19
|
] });
|
|
20
20
|
};
|
|
21
21
|
export {
|
|
@@ -25,9 +25,13 @@ export interface AvatarProps {
|
|
|
25
25
|
style?: CSSProperties;
|
|
26
26
|
/** Whether the avatar is loading. */
|
|
27
27
|
loading?: boolean;
|
|
28
|
+
/** Avatar image container styles */
|
|
29
|
+
innerContainerStyle?: CSSProperties;
|
|
30
|
+
/** Avatar image inner styles */
|
|
31
|
+
avatarImageStyle?: CSSProperties;
|
|
28
32
|
}
|
|
29
33
|
export declare const isAvatarProps: (icon: unknown) => icon is AvatarProps;
|
|
30
34
|
/**
|
|
31
35
|
* Avatar component to display user or company avatars with various customization options.
|
|
32
36
|
*/
|
|
33
|
-
export declare const Avatar: ({ type, size, name, outline, imageUrl, imageUrlAlt, customLabel, loading, className, style, }: AvatarProps) => ReactElement;
|
|
37
|
+
export declare const Avatar: ({ type, size, name, outline, imageUrl, imageUrlAlt, customLabel, loading, className, style, innerContainerStyle, avatarImageStyle, }: 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, outline, imageUrl, imageUrlAlt, customLabel, loading, className, style, }: AvatarProps) => React.ReactElement;
|
|
5
|
+
component: ({ type, size, name, outline, imageUrl, imageUrlAlt, customLabel, loading, className, style, innerContainerStyle, avatarImageStyle, }: AvatarProps) => React.ReactElement;
|
|
6
6
|
tags: string[];
|
|
7
7
|
parameters: {
|
|
8
8
|
layout: string;
|
|
@@ -11,6 +11,26 @@ declare const meta: {
|
|
|
11
11
|
seenAt: string;
|
|
12
12
|
seenAtLabel: string;
|
|
13
13
|
};
|
|
14
|
+
decorators: ((Story: import('storybook/internal/csf').PartialStoryFn<import('@storybook/react-vite').ReactRenderer, {
|
|
15
|
+
id: string;
|
|
16
|
+
seenAt: string;
|
|
17
|
+
seenAtLabel: string;
|
|
18
|
+
isEndUser?: boolean | undefined;
|
|
19
|
+
endUserLabel?: string | undefined;
|
|
20
|
+
badge?: import('..').BadgeProps | undefined;
|
|
21
|
+
name: string;
|
|
22
|
+
type?: import('..').AvatarType | undefined;
|
|
23
|
+
size?: import('..').AvatarSize | undefined;
|
|
24
|
+
className?: string | undefined;
|
|
25
|
+
imageUrl?: string | undefined;
|
|
26
|
+
imageUrlAlt?: string | undefined;
|
|
27
|
+
outline?: boolean | undefined;
|
|
28
|
+
customLabel?: string | undefined;
|
|
29
|
+
style?: React.CSSProperties | undefined;
|
|
30
|
+
loading?: boolean | undefined;
|
|
31
|
+
innerContainerStyle?: React.CSSProperties | undefined;
|
|
32
|
+
avatarImageStyle?: React.CSSProperties | undefined;
|
|
33
|
+
}>) => import("react/jsx-runtime").JSX.Element)[];
|
|
14
34
|
};
|
|
15
35
|
export default meta;
|
|
16
36
|
type Story = StoryObj<typeof meta>;
|