@altinn/altinn-components 0.19.0 → 0.19.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/assets/PageTabs.css +1 -1
- package/dist/components/Dialog/DialogActions.js +32 -39
- package/dist/components/Page/PageTabs.js +7 -7
- package/dist/types/lib/components/Dialog/DialogActions.d.ts +2 -3
- package/dist/types/lib/components/Page/PageTabs.d.ts +2 -3
- package/dist/types/lib/components/Page/PageTabs.stories.d.ts +23 -0
- package/package.json +1 -1
package/dist/assets/PageTabs.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._list_gp6cp_1{display:flex;width:100%;row-gap:.5rem;flex-direction:column;list-style:none;padding:0;margin:0}@media (min-width: 1024px){._list_gp6cp_1{flex-direction:row;align-items:center;justify-content:start;column-gap:.5rem;width:auto}}._item_gp6cp_21{margin:0;border-top:2px solid;border-bottom:2px solid;border-color:transparent}._item_gp6cp_21[data-selected=true]{background-color:transparent;border-bottom-color:var(--ds-color-base-default)}
|
|
@@ -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
|
};
|
|
@@ -2,14 +2,14 @@ import { jsx as t } from "react/jsx-runtime";
|
|
|
2
2
|
import "../../index-L8X2o7IH.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "../RootProvider/RootProvider.js";
|
|
5
|
-
import { MenuItem as
|
|
5
|
+
import { MenuItem as p } from "../Menu/MenuItem.js";
|
|
6
6
|
import "../Search/AutocompleteBase.js";
|
|
7
7
|
import "../Snackbar/useSnackbar.js";
|
|
8
|
-
import { Flex as
|
|
9
|
-
import '../../assets/PageTabs.css';const
|
|
10
|
-
list:
|
|
11
|
-
item:
|
|
12
|
-
},
|
|
8
|
+
import { Flex as l } from "./Flex.js";
|
|
9
|
+
import '../../assets/PageTabs.css';const n = "_list_gp6cp_1", c = "_item_gp6cp_21", i = {
|
|
10
|
+
list: n,
|
|
11
|
+
item: c
|
|
12
|
+
}, N = ({ theme: m = "transparent", color: e, items: s = [], padding: o = 0 }) => /* @__PURE__ */ t(l, { theme: m, color: e, padding: o, children: /* @__PURE__ */ t("ul", { className: i.list, children: s.map((r) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(p, { ...r, className: i.item }) }, r.id)) }) });
|
|
13
13
|
export {
|
|
14
|
-
|
|
14
|
+
N as PageTabs
|
|
15
15
|
};
|
|
@@ -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 */
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { MenuItemColor, MenuItemProps } from '..';
|
|
2
|
-
export type PageTabsTheme = 'transparent' | 'base';
|
|
1
|
+
import { MenuItemColor, MenuItemProps, MenuTheme } from '..';
|
|
3
2
|
export type PageTabsPadding = 0 | 2;
|
|
4
3
|
export type PageTabsVariant = 'card' | undefined;
|
|
5
4
|
export interface PageTabsProps {
|
|
6
|
-
theme?:
|
|
5
|
+
theme?: MenuTheme;
|
|
7
6
|
color?: MenuItemColor;
|
|
8
7
|
padding?: PageTabsPadding;
|
|
9
8
|
items?: MenuItemProps[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ theme, color, items, padding }: import('./PageTabs').PageTabsProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
tags: string[];
|
|
6
|
+
parameters: {};
|
|
7
|
+
args: {
|
|
8
|
+
items: ({
|
|
9
|
+
id: string;
|
|
10
|
+
href: string;
|
|
11
|
+
title: string;
|
|
12
|
+
selected: true;
|
|
13
|
+
} | {
|
|
14
|
+
id: string;
|
|
15
|
+
href: string;
|
|
16
|
+
title: string;
|
|
17
|
+
selected?: undefined;
|
|
18
|
+
})[];
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export default meta;
|
|
22
|
+
type Story = StoryObj<typeof meta>;
|
|
23
|
+
export declare const Default: Story;
|