@altinn/altinn-components 0.19.0 → 0.19.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.
|
@@ -1,60 +1,53 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useState as
|
|
2
|
+
import { jsxs as a, jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { useState as d, useMemo as u } from "react";
|
|
4
4
|
import "../../index-L8X2o7IH.js";
|
|
5
|
-
import { Button as
|
|
6
|
-
import { ComboButton as
|
|
5
|
+
import { Button as f } from "../Button/Button.js";
|
|
6
|
+
import { ComboButton as h } from "../Button/ComboButton.js";
|
|
7
7
|
import "../RootProvider/RootProvider.js";
|
|
8
|
-
import { DropdownBase as
|
|
9
|
-
import { Menu as
|
|
8
|
+
import { DropdownBase as y } from "../Dropdown/DropdownBase.js";
|
|
9
|
+
import { Menu as g } from "../Menu/Menu.js";
|
|
10
10
|
import "../Search/AutocompleteBase.js";
|
|
11
11
|
import "../Snackbar/useSnackbar.js";
|
|
12
|
-
import { S as
|
|
13
|
-
import { S as
|
|
14
|
-
import '../../assets/DialogActions.css';const
|
|
15
|
-
action:
|
|
16
|
-
comboButton:
|
|
17
|
-
},
|
|
18
|
-
const [
|
|
19
|
-
const
|
|
20
|
-
return
|
|
21
|
-
}), [
|
|
22
|
-
if (!
|
|
12
|
+
import { S as v } from "../../ChevronUp-H8Nuww4h.js";
|
|
13
|
+
import { S as B } from "../../ChevronDown-CRAwzuD3.js";
|
|
14
|
+
import '../../assets/DialogActions.css';const _ = "_action_m3crc_1", b = "_comboButton_m3crc_7", l = {
|
|
15
|
+
action: _,
|
|
16
|
+
comboButton: b
|
|
17
|
+
}, E = ({ items: c, maxItems: s = 2 }) => {
|
|
18
|
+
const [e, m] = d(!1), t = u(() => (c || []).sort((r, o) => {
|
|
19
|
+
const i = ["primary", "secondary", "tertiary"];
|
|
20
|
+
return i.indexOf(r == null ? void 0 : r.priority) - i.indexOf(o == null ? void 0 : o.priority);
|
|
21
|
+
}), [c]);
|
|
22
|
+
if (!t.length || s <= 0)
|
|
23
23
|
return null;
|
|
24
|
-
if (
|
|
25
|
-
const r =
|
|
24
|
+
if (t.length > s) {
|
|
25
|
+
const r = t.slice(1).map((o) => ({
|
|
26
26
|
id: o.id,
|
|
27
27
|
title: o.label,
|
|
28
28
|
onClick: o.onClick,
|
|
29
29
|
group: o.priority
|
|
30
30
|
}));
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
|
|
31
|
+
return /* @__PURE__ */ a("section", { className: l.comboButton, children: [
|
|
32
|
+
/* @__PURE__ */ n(
|
|
33
|
+
h,
|
|
34
34
|
{
|
|
35
35
|
variant: "solid",
|
|
36
|
-
icon:
|
|
36
|
+
icon: e ? v : B,
|
|
37
37
|
size: "lg",
|
|
38
|
-
onIconClick: () =>
|
|
39
|
-
ariaLabel:
|
|
40
|
-
children:
|
|
38
|
+
onIconClick: () => m((o) => !o),
|
|
39
|
+
ariaLabel: e ? "chevron up icon" : "chevron down icon",
|
|
40
|
+
children: t[0].label
|
|
41
41
|
}
|
|
42
42
|
),
|
|
43
|
-
/* @__PURE__ */
|
|
43
|
+
/* @__PURE__ */ n(y, { open: e, children: /* @__PURE__ */ n(g, { items: r }) })
|
|
44
44
|
] });
|
|
45
45
|
}
|
|
46
|
-
return /* @__PURE__ */
|
|
47
|
-
|
|
48
|
-
{
|
|
49
|
-
|
|
50
|
-
variant: r.priority === "primary" ? "solid" : "outline",
|
|
51
|
-
size: "lg",
|
|
52
|
-
loading: r.loading,
|
|
53
|
-
children: r.label
|
|
54
|
-
},
|
|
55
|
-
"button-" + o
|
|
56
|
-
)) });
|
|
46
|
+
return /* @__PURE__ */ n("section", { className: l.action, children: t.map((r, o) => {
|
|
47
|
+
const { priority: i, id: x, ...p } = r;
|
|
48
|
+
return /* @__PURE__ */ n(f, { variant: i === "primary" ? "solid" : "outline", size: "lg", ...p, children: r.label }, "button-" + o);
|
|
49
|
+
}) });
|
|
57
50
|
};
|
|
58
51
|
export {
|
|
59
|
-
|
|
52
|
+
E as DialogActions
|
|
60
53
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import { ButtonProps } from '..';
|
|
1
2
|
export type DialogButtonPriority = 'primary' | 'secondary' | 'tertiary';
|
|
2
|
-
export interface DialogActionButtonProps {
|
|
3
|
+
export interface DialogActionButtonProps extends ButtonProps {
|
|
3
4
|
id: string;
|
|
4
5
|
priority: DialogButtonPriority;
|
|
5
|
-
label?: string;
|
|
6
6
|
onClick?: () => void;
|
|
7
|
-
loading?: boolean;
|
|
8
7
|
}
|
|
9
8
|
export interface DialogActionsProps {
|
|
10
9
|
/** List of actions */
|