@altinn/altinn-components 0.51.5 → 0.52.0
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
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._avatar_bmli3_1{position:relative;overflow:hidden;box-sizing:border-box}._avatar_bmli3_1[data-shape=circle]{border-radius:50%}._avatar_bmli3_1[data-shape=square]{border-radius:5%}._avatar_bmli3_1{outline:1px solid #ffffff;box-sizing:border-box}._shape_bmli3_20{display:block;font-size:1em;width:1em;height:1em}._shape_bmli3_20[data-variant=outline]{border:1px solid}._label_bmli3_31{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;justify-content:center;align-items:center;overflow:hidden;font-size:.575em}._icon_bmli3_41{width:100%;height:100%;display:flex;justify-content:center;align-items:center}._svg_bmli3_49{width:75%;height:75%}._image_bmli3_54{display:block;width:100%;height:100%}._deletedIcon_bmli3_60{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%}@supports (-webkit-hyphens: none){._avatar_bmli3_1[data-size=lg] ._label_bmli3_31{font-size:1.58rem}._avatar_bmli3_1[data-size=md] ._label_bmli3_31{font-size:1.15rem}._avatar_bmli3_1[data-size=sm] ._label_bmli3_31{font-size:.85rem}}
|
|
@@ -1,62 +1,86 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { c as
|
|
4
|
-
import { useState as A } from "react";
|
|
5
|
-
import { Skeleton as
|
|
6
|
-
import { fromStringToColor as
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
import { jsx as n, jsxs as u } from "react/jsx-runtime";
|
|
3
|
+
import { c as H } from "../../index-L8X2o7IH.js";
|
|
4
|
+
import m, { forwardRef as N, useState as A } from "react";
|
|
5
|
+
import { Skeleton as k } from "../Skeleton/Skeleton.js";
|
|
6
|
+
import { fromStringToColor as M } from "./color.js";
|
|
7
|
+
import { u as R } from "../../useId-BVFxCjkq.js";
|
|
8
|
+
import '../../assets/Avatar.css';var z = function(e, o) {
|
|
9
|
+
var l = {};
|
|
10
|
+
for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && o.indexOf(t) < 0 && (l[t] = e[t]);
|
|
11
|
+
if (e != null && typeof Object.getOwnPropertySymbols == "function")
|
|
12
|
+
for (var a = 0, t = Object.getOwnPropertySymbols(e); a < t.length; a++)
|
|
13
|
+
o.indexOf(t[a]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[a]) && (l[t[a]] = e[t[a]]);
|
|
14
|
+
return l;
|
|
15
|
+
};
|
|
16
|
+
const q = N((e, o) => {
|
|
17
|
+
var { title: l, titleId: t } = e, a = z(e, ["title", "titleId"]);
|
|
18
|
+
let s = R();
|
|
19
|
+
return s = l ? t || "title-" + s : void 0, m.createElement(
|
|
20
|
+
"svg",
|
|
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
|
+
l ? m.createElement("title", { id: s }, l) : null,
|
|
23
|
+
m.createElement("path", { fill: "currentColor", d: "M8.22 13.72a.75.75 0 0 1 1.06 0l.029.025q.041.039.132.111c.122.097.308.23.548.364a4.14 4.14 0 0 0 2.011.53 4.14 4.14 0 0 0 2.01-.53 4 4 0 0 0 .681-.475l.028-.025.057-.052a.751.751 0 0 1 1.056 1.056l-.052.056-.01.011-.018.017-.059.054a5.647 5.647 0 0 1-.954.668c-.642.357-1.58.72-2.739.72a5.64 5.64 0 0 1-2.74-.72 5.7 5.7 0 0 1-.748-.496 4 4 0 0 1-.205-.172q-.037-.032-.059-.054l-.018-.017-.01-.01a.75.75 0 0 1 0-1.061M9.5 9a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3M14.5 9a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3" }),
|
|
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" })
|
|
25
|
+
);
|
|
26
|
+
}), P = "_avatar_bmli3_1", V = "_shape_bmli3_20", B = "_label_bmli3_31", L = "_icon_bmli3_41", T = "_svg_bmli3_49", D = "_image_bmli3_54", F = "_deletedIcon_bmli3_60", r = {
|
|
27
|
+
avatar: P,
|
|
28
|
+
shape: V,
|
|
29
|
+
label: B,
|
|
30
|
+
icon: L,
|
|
31
|
+
svg: T,
|
|
32
|
+
image: D,
|
|
33
|
+
deletedIcon: F
|
|
34
|
+
}, X = (e) => typeof e == "object" && e !== null && "name" in e, Y = ({
|
|
14
35
|
type: e = "person",
|
|
15
|
-
isParent:
|
|
16
|
-
isDeleted:
|
|
17
|
-
size:
|
|
18
|
-
name:
|
|
19
|
-
shape:
|
|
20
|
-
color:
|
|
21
|
-
variant:
|
|
22
|
-
imageUrl:
|
|
23
|
-
imageUrlAlt:
|
|
24
|
-
customLabel:
|
|
25
|
-
loading:
|
|
26
|
-
className:
|
|
27
|
-
colorKey:
|
|
28
|
-
style:
|
|
36
|
+
isParent: o,
|
|
37
|
+
isDeleted: l = !1,
|
|
38
|
+
size: t,
|
|
39
|
+
name: a = "Avatar",
|
|
40
|
+
shape: s,
|
|
41
|
+
color: b,
|
|
42
|
+
variant: g,
|
|
43
|
+
imageUrl: d,
|
|
44
|
+
imageUrlAlt: _,
|
|
45
|
+
customLabel: w,
|
|
46
|
+
loading: p,
|
|
47
|
+
className: y,
|
|
48
|
+
colorKey: I,
|
|
49
|
+
style: f = {}
|
|
29
50
|
}) => {
|
|
30
|
-
const [
|
|
31
|
-
let
|
|
32
|
-
e === "company" && typeof
|
|
33
|
-
const { backgroundColor:
|
|
34
|
-
...
|
|
35
|
-
backgroundColor:
|
|
36
|
-
color:
|
|
37
|
-
} :
|
|
38
|
-
return /* @__PURE__ */
|
|
51
|
+
const [x, O] = A(!1), C = s || e === "person" ? "circle" : "square", S = b || e === "person" ? "light" : "dark";
|
|
52
|
+
let i = g;
|
|
53
|
+
e === "company" && typeof o == "boolean" && (i = o ? "solid" : "outline");
|
|
54
|
+
const { backgroundColor: v, foregroundColor: h } = M(I ?? a, S), j = (a[0] ?? "").toUpperCase(), c = d && !x, E = !p && !c ? {
|
|
55
|
+
...f,
|
|
56
|
+
backgroundColor: i === "outline" ? h : v,
|
|
57
|
+
color: i === "outline" ? v : h
|
|
58
|
+
} : f;
|
|
59
|
+
return /* @__PURE__ */ n(
|
|
39
60
|
"div",
|
|
40
61
|
{
|
|
41
|
-
className:
|
|
42
|
-
style:
|
|
43
|
-
"data-shape":
|
|
44
|
-
"data-size":
|
|
62
|
+
className: H(r.avatar, y),
|
|
63
|
+
style: E,
|
|
64
|
+
"data-shape": C,
|
|
65
|
+
"data-size": t,
|
|
45
66
|
"aria-hidden": !0,
|
|
46
|
-
children: /* @__PURE__ */
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
67
|
+
children: /* @__PURE__ */ u(k, { loading: p, className: r.shape, variant: "circle", children: [
|
|
68
|
+
/* @__PURE__ */ u("div", { className: r.shape, "data-variant": i, children: [
|
|
69
|
+
e !== "system" && c && /* @__PURE__ */ n(
|
|
70
|
+
"img",
|
|
71
|
+
{
|
|
72
|
+
src: d,
|
|
73
|
+
className: r.image,
|
|
74
|
+
alt: _ || d,
|
|
75
|
+
onError: () => {
|
|
76
|
+
O(!0);
|
|
77
|
+
}
|
|
55
78
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
79
|
+
),
|
|
80
|
+
e === "system" && !c && /* @__PURE__ */ n("span", { className: r.icon, children: /* @__PURE__ */ n(q, { className: r.svg }) })
|
|
81
|
+
] }),
|
|
82
|
+
!c && e !== "system" && /* @__PURE__ */ n("span", { className: r.label, children: w || j }),
|
|
83
|
+
l && /* @__PURE__ */ n(
|
|
60
84
|
"svg",
|
|
61
85
|
{
|
|
62
86
|
"aria-hidden": "true",
|
|
@@ -66,7 +90,7 @@ import '../../assets/Avatar.css';const z = "_avatar_1en7r_1", B = "_shape_1en7r_
|
|
|
66
90
|
viewBox: "0 0 24 24",
|
|
67
91
|
fill: "none",
|
|
68
92
|
xmlns: "http://www.w3.org/2000/svg",
|
|
69
|
-
children: /* @__PURE__ */
|
|
93
|
+
children: /* @__PURE__ */ n("path", { d: "M0 24L24 -1.20156e-06", stroke: "currentColor" })
|
|
70
94
|
}
|
|
71
95
|
)
|
|
72
96
|
] })
|
|
@@ -74,6 +98,6 @@ import '../../assets/Avatar.css';const z = "_avatar_1en7r_1", B = "_shape_1en7r_
|
|
|
74
98
|
);
|
|
75
99
|
};
|
|
76
100
|
export {
|
|
77
|
-
|
|
78
|
-
|
|
101
|
+
Y as Avatar,
|
|
102
|
+
X as isAvatarProps
|
|
79
103
|
};
|
|
@@ -22,7 +22,7 @@ const h = d((e, n) => {
|
|
|
22
22
|
"svg",
|
|
23
23
|
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: n, "aria-labelledby": i }, l),
|
|
24
24
|
r ? c.createElement("title", { id: i }, r) : null,
|
|
25
|
-
c.createElement("path", { fill: "currentColor", d: "M14.
|
|
25
|
+
c.createElement("path", { fill: "currentColor", d: "M14.088 6.873a.75.75 0 0 1 .942.097l4.5 4.5a.75.75 0 0 1 0 1.06l-4.5 4.5a.75.75 0 0 1-1.06-1.06l3.22-3.22H5a.75.75 0 0 1-.75-.74V12a.75.75 0 0 1 .75-.75h12.19l-3.22-3.22a.75.75 0 0 1 .118-1.157" })
|
|
26
26
|
);
|
|
27
27
|
}), _ = "_list_tknjf_1", b = "_item_tknjf_12", g = "_icon_tknjf_18", a = {
|
|
28
28
|
list: _,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSProperties, ReactElement } from 'react';
|
|
2
|
-
export type AvatarType = 'company' | 'person' | 'custom';
|
|
2
|
+
export type AvatarType = 'company' | 'person' | 'system' | 'custom';
|
|
3
3
|
export type AvatarSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
4
4
|
export type AvatarShape = 'square' | 'circle';
|
|
5
5
|
export type AvatarColor = 'dark' | 'light';
|
|
@@ -44,5 +44,6 @@ export declare const Logo: Story;
|
|
|
44
44
|
export declare const Loading: Story;
|
|
45
45
|
export declare const Sizes: ({ type, name, imageUrl }: AvatarProps) => import("react/jsx-runtime").JSX.Element;
|
|
46
46
|
export declare const People: () => import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
export declare const SystemUsers: () => import("react/jsx-runtime").JSX.Element;
|
|
47
48
|
export declare const Companies: () => import("react/jsx-runtime").JSX.Element;
|
|
48
49
|
export declare const Logos: () => import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@altinn/altinn-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.52.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@digdir/designsystemet-css": "^1.0.6",
|
|
24
24
|
"@digdir/designsystemet-react": "^1.0.6",
|
|
25
25
|
"@digdir/designsystemet-theme": "^1.0.6",
|
|
26
|
-
"@navikt/aksel-icons": "^7.
|
|
26
|
+
"@navikt/aksel-icons": "^7.37.0",
|
|
27
27
|
"@tanstack/react-virtual": "^3.13.9",
|
|
28
28
|
"classnames": "^2.5.1",
|
|
29
29
|
"react": "^19.1.0",
|