@altinn/altinn-components 0.52.0 → 0.52.2
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 +26 -27
- package/dist/components/Dialog/SeenByLogItem.js +12 -11
- package/dist/types/lib/components/Dialog/SeenByLog.stories.d.ts +7 -0
- package/dist/types/lib/components/Dialog/SeenByLogItem.d.ts +2 -1
- package/dist/types/lib/components/Dialog/SeenByLogItem.stories.d.ts +2 -2
- package/dist/types/lib/functions/name/name.d.ts +3 -2
- package/package.json +1 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as n, jsxs as
|
|
3
|
-
import { c as
|
|
4
|
-
import m, { forwardRef as
|
|
5
|
-
import { Skeleton as
|
|
2
|
+
import { jsx as n, jsxs as v } from "react/jsx-runtime";
|
|
3
|
+
import { c as E } from "../../index-L8X2o7IH.js";
|
|
4
|
+
import m, { forwardRef as k, useState as A } from "react";
|
|
5
|
+
import { Skeleton as R } from "../Skeleton/Skeleton.js";
|
|
6
6
|
import { fromStringToColor as M } from "./color.js";
|
|
7
|
-
import { u as
|
|
8
|
-
import '../../assets/Avatar.css';var
|
|
7
|
+
import { u as P } from "../../useId-BVFxCjkq.js";
|
|
8
|
+
import '../../assets/Avatar.css';var B = function(e, o) {
|
|
9
9
|
var l = {};
|
|
10
10
|
for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && o.indexOf(t) < 0 && (l[t] = e[t]);
|
|
11
11
|
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
@@ -13,22 +13,21 @@ import '../../assets/Avatar.css';var z = function(e, o) {
|
|
|
13
13
|
o.indexOf(t[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[a]) && (l[t[a]] = e[t[a]]);
|
|
14
14
|
return l;
|
|
15
15
|
};
|
|
16
|
-
const
|
|
17
|
-
var { title: l, titleId: t } = e, a =
|
|
18
|
-
let s =
|
|
16
|
+
const L = k((e, o) => {
|
|
17
|
+
var { title: l, titleId: t } = e, a = B(e, ["title", "titleId"]);
|
|
18
|
+
let s = P();
|
|
19
19
|
return s = l ? t || "title-" + s : void 0, m.createElement(
|
|
20
20
|
"svg",
|
|
21
21
|
Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24", focusable: !1, role: "img", ref: o, "aria-labelledby": s }, a),
|
|
22
22
|
l ? m.createElement("title", { id: s }, l) : null,
|
|
23
|
-
m.createElement("path", { fill: "currentColor", d: "M8.
|
|
24
|
-
m.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M12 .5a1.5 1.5 0 0 1 .75 2.798V5h5.5a.75.75 0 0 1 .75.75v3.5h2.24a.75.75 0 0 1 .75.75v4a.75.75 0 0 1-.75.75H19v3.5a.75.75 0 0 1-.75.75H5.75a.75.75 0 0 1-.75-.75v-3.5H2.75A.75.75 0 0 1 2 14v-4a.75.75 0 0 1 .75-.75H5v-3.5A.75.75 0 0 1 5.75 5h5.5V3.298A1.498 1.498 0 0 1 12 .5m-5.5 17h11v-11h-11zm-3-4.25H5v-2.5H3.5zm15.5 0h1.49v-2.5H19z", clipRule: "evenodd" })
|
|
23
|
+
m.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M8.25 7a3.75 3.75 0 0 0 2.43 3.51l-3.692 4.923a2.75 2.75 0 1 0 1.2.9l3.062-4.083v3.104a2.751 2.751 0 1 0 1.5 0V12.25l3.063 4.083a2.75 2.75 0 1 0 1.2-.9L13.32 10.51A3.751 3.751 0 0 0 12 3.25 3.75 3.75 0 0 0 8.25 7M12 4.75a2.25 2.25 0 0 0-.008 4.5h.015A2.25 2.25 0 0 0 12 4.75m0 12a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5m-6 0a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5m12 0a1.25 1.25 0 1 0 0 2.5 1.25 1.25 0 0 0 0-2.5", clipRule: "evenodd" })
|
|
25
24
|
);
|
|
26
|
-
}),
|
|
27
|
-
avatar:
|
|
25
|
+
}), T = "_avatar_bmli3_1", V = "_shape_bmli3_20", q = "_label_bmli3_31", z = "_icon_bmli3_41", H = "_svg_bmli3_49", D = "_image_bmli3_54", F = "_deletedIcon_bmli3_60", r = {
|
|
26
|
+
avatar: T,
|
|
28
27
|
shape: V,
|
|
29
|
-
label:
|
|
30
|
-
icon:
|
|
31
|
-
svg:
|
|
28
|
+
label: q,
|
|
29
|
+
icon: z,
|
|
30
|
+
svg: H,
|
|
32
31
|
image: D,
|
|
33
32
|
deletedIcon: F
|
|
34
33
|
}, X = (e) => typeof e == "object" && e !== null && "name" in e, Y = ({
|
|
@@ -48,24 +47,24 @@ const q = N((e, o) => {
|
|
|
48
47
|
colorKey: I,
|
|
49
48
|
style: f = {}
|
|
50
49
|
}) => {
|
|
51
|
-
const [x, O] = A(!1),
|
|
50
|
+
const [x, O] = A(!1), j = s || e === "person" ? "circle" : "square", C = b || e === "person" ? "light" : "dark";
|
|
52
51
|
let i = g;
|
|
53
52
|
e === "company" && typeof o == "boolean" && (i = o ? "solid" : "outline");
|
|
54
|
-
const { backgroundColor:
|
|
53
|
+
const { backgroundColor: u, foregroundColor: h } = M(I ?? a, C), N = (a[0] ?? "").toUpperCase(), c = d && !x, S = !p && !c ? {
|
|
55
54
|
...f,
|
|
56
|
-
backgroundColor: i === "outline" ? h :
|
|
57
|
-
color: i === "outline" ?
|
|
55
|
+
backgroundColor: i === "outline" ? h : u,
|
|
56
|
+
color: i === "outline" ? u : h
|
|
58
57
|
} : f;
|
|
59
58
|
return /* @__PURE__ */ n(
|
|
60
59
|
"div",
|
|
61
60
|
{
|
|
62
|
-
className:
|
|
63
|
-
style:
|
|
64
|
-
"data-shape":
|
|
61
|
+
className: E(r.avatar, y),
|
|
62
|
+
style: S,
|
|
63
|
+
"data-shape": j,
|
|
65
64
|
"data-size": t,
|
|
66
65
|
"aria-hidden": !0,
|
|
67
|
-
children: /* @__PURE__ */
|
|
68
|
-
/* @__PURE__ */
|
|
66
|
+
children: /* @__PURE__ */ v(R, { loading: p, className: r.shape, variant: "circle", children: [
|
|
67
|
+
/* @__PURE__ */ v("div", { className: r.shape, "data-variant": i, children: [
|
|
69
68
|
e !== "system" && c && /* @__PURE__ */ n(
|
|
70
69
|
"img",
|
|
71
70
|
{
|
|
@@ -77,9 +76,9 @@ const q = N((e, o) => {
|
|
|
77
76
|
}
|
|
78
77
|
}
|
|
79
78
|
),
|
|
80
|
-
e === "system" && !c && /* @__PURE__ */ n("span", { className: r.icon, children: /* @__PURE__ */ n(
|
|
79
|
+
e === "system" && !c && /* @__PURE__ */ n("span", { className: r.icon, children: /* @__PURE__ */ n(L, { className: r.svg }) })
|
|
81
80
|
] }),
|
|
82
|
-
!c && e !== "system" && /* @__PURE__ */ n("span", { className: r.label, children: w ||
|
|
81
|
+
!c && e !== "system" && /* @__PURE__ */ n("span", { className: r.label, children: w || N }),
|
|
83
82
|
l && /* @__PURE__ */ n(
|
|
84
83
|
"svg",
|
|
85
84
|
{
|
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
import { jsxs as e, jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { Badge as
|
|
2
|
+
import { Badge as l } from "../Badge/Badge.js";
|
|
3
3
|
import "../../index-L8X2o7IH.js";
|
|
4
4
|
import "react";
|
|
5
|
-
import { Byline as
|
|
5
|
+
import { Byline as c } from "../Byline/Byline.js";
|
|
6
6
|
import "../RootProvider/RootProvider.js";
|
|
7
7
|
import "../Snackbar/useSnackbar.js";
|
|
8
|
-
import { Flex as
|
|
9
|
-
const
|
|
8
|
+
import { Flex as d } from "../Page/Flex.js";
|
|
9
|
+
const v = ({
|
|
10
10
|
name: r,
|
|
11
11
|
seenAt: i,
|
|
12
12
|
seenAtLabel: m,
|
|
13
13
|
isEndUser: n,
|
|
14
|
-
endUserLabel:
|
|
15
|
-
size:
|
|
14
|
+
endUserLabel: a,
|
|
15
|
+
size: p = "sm",
|
|
16
|
+
type: s = "person"
|
|
16
17
|
}) => {
|
|
17
|
-
const t = n && { label:
|
|
18
|
-
return /* @__PURE__ */ e(
|
|
19
|
-
/* @__PURE__ */ e(
|
|
18
|
+
const t = n && { label: a };
|
|
19
|
+
return /* @__PURE__ */ e(d, { align: "center", spacing: 2, as: "li", children: [
|
|
20
|
+
/* @__PURE__ */ e(c, { size: p, datetime: i, avatar: { name: r, type: s }, children: [
|
|
20
21
|
/* @__PURE__ */ o("strong", { children: r + "," }),
|
|
21
22
|
" ",
|
|
22
23
|
m
|
|
23
24
|
] }),
|
|
24
|
-
t && /* @__PURE__ */ o(
|
|
25
|
+
t && /* @__PURE__ */ o(l, { variant: "subtle", ...t })
|
|
25
26
|
] });
|
|
26
27
|
};
|
|
27
28
|
export {
|
|
28
|
-
|
|
29
|
+
v as SeenByLogItem
|
|
29
30
|
};
|
|
@@ -15,6 +15,13 @@ declare const meta: {
|
|
|
15
15
|
seenAt: string;
|
|
16
16
|
seenAtLabel: string;
|
|
17
17
|
isEndUser?: undefined;
|
|
18
|
+
} | {
|
|
19
|
+
id: string;
|
|
20
|
+
type: "system";
|
|
21
|
+
name: string;
|
|
22
|
+
seenAt: string;
|
|
23
|
+
seenAtLabel: string;
|
|
24
|
+
isEndUser?: undefined;
|
|
18
25
|
} | {
|
|
19
26
|
id: string;
|
|
20
27
|
type: "person";
|
|
@@ -7,8 +7,9 @@ export interface SeenByLogItemProps extends AvatarProps {
|
|
|
7
7
|
endUserLabel?: string;
|
|
8
8
|
badge?: BadgeProps;
|
|
9
9
|
size?: 'sm' | 'md';
|
|
10
|
+
type?: AvatarProps['type'];
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
* SeenByLog item
|
|
13
14
|
*/
|
|
14
|
-
export declare const SeenByLogItem: ({ name, seenAt, seenAtLabel, isEndUser, endUserLabel, size, }: SeenByLogItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const SeenByLogItem: ({ name, seenAt, seenAtLabel, isEndUser, endUserLabel, size, type, }: SeenByLogItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { StoryObj } from '@storybook/react-vite';
|
|
2
2
|
declare const meta: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: ({ name, seenAt, seenAtLabel, isEndUser, endUserLabel, size, }: import('./SeenByLogItem').SeenByLogItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
component: ({ name, seenAt, seenAtLabel, isEndUser, endUserLabel, size, type, }: import('./SeenByLogItem').SeenByLogItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
tags: string[];
|
|
6
6
|
parameters: {};
|
|
7
7
|
args: {
|
|
@@ -19,8 +19,8 @@ declare const meta: {
|
|
|
19
19
|
endUserLabel?: string | undefined;
|
|
20
20
|
badge?: import('..').BadgeProps | undefined;
|
|
21
21
|
size?: "sm" | "md" | undefined;
|
|
22
|
-
name: string;
|
|
23
22
|
type?: import('..').AvatarType | undefined;
|
|
23
|
+
name: string;
|
|
24
24
|
isParent?: boolean | undefined;
|
|
25
25
|
isDeleted?: boolean | undefined;
|
|
26
26
|
shape?: import('..').AvatarColor | undefined;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { AvatarType } from '../../components';
|
|
1
2
|
interface FormatDisplayNameInput {
|
|
2
3
|
/** Full name of person or company */
|
|
3
4
|
fullName: string;
|
|
4
|
-
/** Entity type: Whether this is a person or a company */
|
|
5
|
-
type:
|
|
5
|
+
/** Entity type: Whether this is a person, system user or a company */
|
|
6
|
+
type: AvatarType;
|
|
6
7
|
/** For persons: switch order of first/last name */
|
|
7
8
|
reverseNameOrder?: boolean;
|
|
8
9
|
}
|