@altinn/altinn-components 0.41.7 → 0.42.1
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/FloatingDropdown.css +1 -0
- package/dist/components/Dropdown/FloatingDropdown.js +61 -0
- package/dist/components/Dropdown/index.js +7 -5
- package/dist/components/Settings/UsedByLog.js +27 -18
- package/dist/components/Settings/UsedByLogItem.js +11 -10
- package/dist/components/index.js +360 -358
- package/dist/index.js +356 -354
- package/dist/types/lib/components/Dropdown/FloatingDropdown.d.ts +20 -0
- package/dist/types/lib/components/Dropdown/FloatingDropdown.stories.d.ts +11 -0
- package/dist/types/lib/components/Dropdown/index.d.ts +1 -0
- package/dist/types/lib/components/Settings/UsedByLogItem.d.ts +2 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
._container_1t2id_1{position:fixed;bottom:0;right:0;margin:1rem;z-index:1000;display:flex;flex-direction:column;align-items:flex-end;gap:.5rem}._button_1t2id_13{--dsc-button-size: var(--ds-size-14);width:var(--ds-button-size);height:var(--ds-button-size);border-radius:50%;flex-shrink:0}._dropdown_1t2id_21{display:flex;flex-direction:column;gap:0;border-radius:.5rem;padding:.5rem;box-shadow:var(--ds-shadow-md);min-width:16rem;overflow:hidden;color:#fff}._dropdown_1t2id_21[data-color=company]{background-color:var(--ds-color-company-base-default)}._dropdown_1t2id_21[data-color=person]{background-color:var(--ds-color-person-base-default)}._dropdown_1t2id_21[data-color=neutral]{background-color:var(--ds-color-neutral-base-default)}._dropdownItem_1t2id_45{display:flex;align-items:center;gap:.75rem;padding:.75rem 1rem;background:transparent;border:none;cursor:pointer;text-align:left;color:inherit;border-radius:.25rem;transition:background-color .2s ease;font-size:1rem;font-weight:400;line-height:1.5}._dropdownItem_1t2id_45:hover{background-color:#ffffff1a}._dropdownItem_1t2id_45:focus-visible{outline:2px solid currentColor;outline-offset:-2px}._itemTitle_1t2id_71{flex:1;white-space:nowrap}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as m, jsx as o } from "react/jsx-runtime";
|
|
3
|
+
import { useState as k, useRef as N } from "react";
|
|
4
|
+
import { useClickOutside as T } from "../../hooks/useClickOutside.js";
|
|
5
|
+
import { useEscapeKey as g } from "../../hooks/useEscapeKey.js";
|
|
6
|
+
import { ButtonBase as x } from "../Button/ButtonBase.js";
|
|
7
|
+
import "../../index-L8X2o7IH.js";
|
|
8
|
+
import { ButtonIcon as y } from "../Button/ButtonIcon.js";
|
|
9
|
+
import { Icon as v } from "../Icon/Icon.js";
|
|
10
|
+
import "../RootProvider/RootProvider.js";
|
|
11
|
+
import "../Snackbar/useSnackbar.js";
|
|
12
|
+
import '../../assets/FloatingDropdown.css';const B = "_container_1t2id_1", j = "_button_1t2id_13", z = "_dropdown_1t2id_21", E = "_dropdownItem_1t2id_45", O = "_itemTitle_1t2id_71", n = {
|
|
13
|
+
container: B,
|
|
14
|
+
button: j,
|
|
15
|
+
dropdown: z,
|
|
16
|
+
dropdownItem: E,
|
|
17
|
+
itemTitle: O
|
|
18
|
+
}, L = ({
|
|
19
|
+
variant: p = "solid",
|
|
20
|
+
size: u,
|
|
21
|
+
icon: _,
|
|
22
|
+
iconOpen: s,
|
|
23
|
+
iconSize: f,
|
|
24
|
+
iconAltText: w,
|
|
25
|
+
color: d = "company",
|
|
26
|
+
items: h,
|
|
27
|
+
dataTestId: I
|
|
28
|
+
}) => {
|
|
29
|
+
const [e, c] = k(!1), l = N(null), b = () => {
|
|
30
|
+
c((t) => !t);
|
|
31
|
+
}, i = () => {
|
|
32
|
+
c(!1);
|
|
33
|
+
}, C = (t) => (r) => {
|
|
34
|
+
t(r), i();
|
|
35
|
+
};
|
|
36
|
+
T(l, i), g(i);
|
|
37
|
+
const a = e && s ? s : _;
|
|
38
|
+
return /* @__PURE__ */ m("div", { className: n.container, ref: l, children: [
|
|
39
|
+
e && /* @__PURE__ */ o("div", { className: n.dropdown, "data-color": d, children: h.map((t, r) => /* @__PURE__ */ m("button", { className: n.dropdownItem, onClick: C(t.onClick), type: "button", children: [
|
|
40
|
+
/* @__PURE__ */ o(v, { svgElement: t.icon, size: "md", color: "inherit" }),
|
|
41
|
+
/* @__PURE__ */ o("span", { className: n.itemTitle, children: t.title })
|
|
42
|
+
] }, r)) }),
|
|
43
|
+
/* @__PURE__ */ o(
|
|
44
|
+
x,
|
|
45
|
+
{
|
|
46
|
+
className: n.button,
|
|
47
|
+
variant: p,
|
|
48
|
+
color: d,
|
|
49
|
+
size: u,
|
|
50
|
+
onClick: b,
|
|
51
|
+
"data-testid": I,
|
|
52
|
+
"aria-label": w,
|
|
53
|
+
"aria-expanded": e,
|
|
54
|
+
children: a && /* @__PURE__ */ o(y, { icon: a, size: f })
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
] });
|
|
58
|
+
};
|
|
59
|
+
export {
|
|
60
|
+
L as FloatingDropdown
|
|
61
|
+
};
|
|
@@ -3,16 +3,18 @@ import { Backdrop as t } from "./Backdrop.js";
|
|
|
3
3
|
import { DrawerBase as f } from "./DrawerBase.js";
|
|
4
4
|
import { DrawerHeader as w } from "./DrawerHeader.js";
|
|
5
5
|
import { DrawerFooter as D } from "./DrawerFooter.js";
|
|
6
|
-
import { DrawerButton as
|
|
6
|
+
import { DrawerButton as n } from "./DrawerButton.js";
|
|
7
7
|
import { DrawerBody as s } from "./DrawerBody.js";
|
|
8
|
-
import { DrawerOrDropdown as
|
|
8
|
+
import { DrawerOrDropdown as c } from "./DrawerOrDropdown.js";
|
|
9
|
+
import { FloatingDropdown as i } from "./FloatingDropdown.js";
|
|
9
10
|
export {
|
|
10
11
|
t as Backdrop,
|
|
11
12
|
f as DrawerBase,
|
|
12
13
|
s as DrawerBody,
|
|
13
|
-
|
|
14
|
+
n as DrawerButton,
|
|
14
15
|
D as DrawerFooter,
|
|
15
16
|
w as DrawerHeader,
|
|
16
|
-
|
|
17
|
-
e as DropdownBase
|
|
17
|
+
c as DrawerOrDropdown,
|
|
18
|
+
e as DropdownBase,
|
|
19
|
+
i as FloatingDropdown
|
|
18
20
|
};
|
|
@@ -1,35 +1,44 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useState as B, createElement as L,
|
|
2
|
+
import { jsx as n, jsxs as u } from "react/jsx-runtime";
|
|
3
|
+
import { useState as B, createElement as L, useMemo as S, Fragment as j } from "react";
|
|
4
4
|
import "../../index-L8X2o7IH.js";
|
|
5
5
|
import "../RootProvider/RootProvider.js";
|
|
6
|
-
import { SeenByLogButton as
|
|
7
|
-
import { Divider as
|
|
8
|
-
import { List as
|
|
6
|
+
import { SeenByLogButton as g } from "../Dialog/SeenByLogButton.js";
|
|
7
|
+
import { Divider as i } from "../Divider/Divider.js";
|
|
8
|
+
import { List as m } from "../List/List.js";
|
|
9
9
|
import "../Snackbar/useSnackbar.js";
|
|
10
|
-
import { Flex as
|
|
10
|
+
import { Flex as k } from "../Page/Flex.js";
|
|
11
11
|
import { Section as f } from "../Page/Section.js";
|
|
12
12
|
import { UsedByLogItem as h } from "./UsedByLogItem.js";
|
|
13
|
-
const
|
|
14
|
-
collapsible:
|
|
13
|
+
const q = ({
|
|
14
|
+
collapsible: a = !0,
|
|
15
15
|
expanded: l,
|
|
16
16
|
title: c,
|
|
17
17
|
items: r,
|
|
18
18
|
size: p = "sm",
|
|
19
19
|
endUserLabel: t
|
|
20
20
|
}) => {
|
|
21
|
-
const [
|
|
22
|
-
|
|
21
|
+
const [d, v] = B(l || !a && !0), x = () => {
|
|
22
|
+
v((o) => !o);
|
|
23
23
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
if ((r == null ? void 0 : r.length) === 1)
|
|
25
|
+
return /* @__PURE__ */ n(f, { spacing: 1, children: /* @__PURE__ */ n(m, { size: p, spacing: 1, children: r == null ? void 0 : r.map((o) => /* @__PURE__ */ L(h, { ...o, key: o.id, size: p, endUserLabel: t })) }) });
|
|
26
|
+
const e = S(
|
|
27
|
+
() => r.map((o) => ({
|
|
28
|
+
...o,
|
|
29
|
+
...o.avatar
|
|
30
|
+
})),
|
|
31
|
+
[r]
|
|
32
|
+
);
|
|
33
|
+
return /* @__PURE__ */ u(f, { spacing: 1, children: [
|
|
34
|
+
c && /* @__PURE__ */ n(k, { children: a ? /* @__PURE__ */ n(g, { icon: { items: e }, as: "button", onClick: x, children: c }) : /* @__PURE__ */ n(g, { icon: { items: e }, as: "div", children: c }) }),
|
|
35
|
+
c && d && /* @__PURE__ */ n(i, {}),
|
|
36
|
+
d && /* @__PURE__ */ n(m, { size: p, spacing: 1, children: r == null ? void 0 : r.map((o, y) => /* @__PURE__ */ u(j, { children: [
|
|
37
|
+
y > 0 && /* @__PURE__ */ n(i, {}),
|
|
38
|
+
/* @__PURE__ */ n(h, { ...o, size: p, endUserLabel: t })
|
|
39
|
+
] }, o.id)) })
|
|
31
40
|
] });
|
|
32
41
|
};
|
|
33
42
|
export {
|
|
34
|
-
|
|
43
|
+
q as UsedByLog
|
|
35
44
|
};
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { jsxs as r, jsx as
|
|
1
|
+
import { jsxs as r, jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import "../../index-L8X2o7IH.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import { Badge as
|
|
5
|
-
import { Byline as
|
|
4
|
+
import { Badge as p } from "../Badge/Badge.js";
|
|
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 g } from "../Page/Flex.js";
|
|
9
|
+
const v = ({
|
|
10
10
|
type: e,
|
|
11
11
|
name: t,
|
|
12
12
|
description: o,
|
|
13
13
|
isEndUser: m,
|
|
14
14
|
endUserLabel: a,
|
|
15
|
-
|
|
15
|
+
avatar: l,
|
|
16
|
+
size: n = "sm"
|
|
16
17
|
}) => {
|
|
17
18
|
const i = m && { label: a };
|
|
18
|
-
return /* @__PURE__ */ r(
|
|
19
|
-
/* @__PURE__ */ r(
|
|
19
|
+
return /* @__PURE__ */ r(g, { align: "center", spacing: 2, as: "li", children: [
|
|
20
|
+
/* @__PURE__ */ r(c, { size: n, avatar: { name: t, type: e, ...l }, children: [
|
|
20
21
|
/* @__PURE__ */ r("strong", { children: [
|
|
21
22
|
t,
|
|
22
23
|
o && NaN
|
|
@@ -24,9 +25,9 @@ const u = ({
|
|
|
24
25
|
" ",
|
|
25
26
|
o
|
|
26
27
|
] }),
|
|
27
|
-
i && /* @__PURE__ */
|
|
28
|
+
i && /* @__PURE__ */ s(p, { variant: "subtle", ...i })
|
|
28
29
|
] });
|
|
29
30
|
};
|
|
30
31
|
export {
|
|
31
|
-
|
|
32
|
+
v as UsedByLogItem
|
|
32
33
|
};
|