@altinn/altinn-components 0.41.7 → 0.42.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/FloatingDropdown.css +1 -0
- package/dist/components/Dropdown/FloatingDropdown.js +61 -0
- package/dist/components/Dropdown/index.js +7 -5
- 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/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
|
};
|