@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.
@@ -1 +1 @@
1
- ._list_qqtoj_1{display:flex;width:100%;row-gap:.5rem;flex-direction:column;list-style:none;padding:0;margin:0}@media (min-width: 1024px){._list_qqtoj_1{flex-direction:row;align-items:center;justify-content:start;column-gap:.5rem;width:auto}}._item_qqtoj_21{margin:0;border-top:2px solid;border-bottom:2px solid;border-color:transparent}._item_qqtoj_21[aria-selected=true]{background-color:transparent;border-bottom-color:var(--ds-color-base-default)}
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 m, jsx as t } from "react/jsx-runtime";
3
- import { useState as p, useMemo as d } from "react";
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 u } from "../Button/Button.js";
6
- import { ComboButton as f } from "../Button/ComboButton.js";
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 g } from "../Dropdown/DropdownBase.js";
9
- import { Menu as h } from "../Menu/Menu.js";
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 y } from "../../ChevronUp-H8Nuww4h.js";
13
- import { S as v } from "../../ChevronDown-CRAwzuD3.js";
14
- import '../../assets/DialogActions.css';const C = "_action_m3crc_1", B = "_comboButton_m3crc_7", l = {
15
- action: C,
16
- comboButton: B
17
- }, N = ({ items: e, maxItems: c = 2 }) => {
18
- const [i, a] = p(!1), n = d(() => (e || []).sort((r, o) => {
19
- const s = ["primary", "secondary", "tertiary"];
20
- return s.indexOf(r == null ? void 0 : r.priority) - s.indexOf(o == null ? void 0 : o.priority);
21
- }), [e]);
22
- if (!n.length || c <= 0)
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 (n.length > c) {
25
- const r = n.slice(1).map((o) => ({
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__ */ m("section", { className: l.comboButton, children: [
32
- /* @__PURE__ */ t(
33
- f,
31
+ return /* @__PURE__ */ a("section", { className: l.comboButton, children: [
32
+ /* @__PURE__ */ n(
33
+ h,
34
34
  {
35
35
  variant: "solid",
36
- icon: i ? y : v,
36
+ icon: e ? v : B,
37
37
  size: "lg",
38
- onIconClick: () => a((o) => !o),
39
- ariaLabel: i ? "chevron up icon" : "chevron down icon",
40
- children: n[0].label
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__ */ t(g, { open: i, children: /* @__PURE__ */ t(h, { items: r }) })
43
+ /* @__PURE__ */ n(y, { open: e, children: /* @__PURE__ */ n(g, { items: r }) })
44
44
  ] });
45
45
  }
46
- return /* @__PURE__ */ t("section", { className: l.action, children: n.map((r, o) => /* @__PURE__ */ t(
47
- u,
48
- {
49
- onClick: r.onClick,
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
- N as DialogActions
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 l } from "../Menu/MenuItem.js";
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 n } from "./Flex.js";
9
- import '../../assets/PageTabs.css';const p = "_list_qqtoj_1", a = "_item_qqtoj_21", i = {
10
- list: p,
11
- item: a
12
- }, x = ({ theme: m = "transparent", color: o, items: e = [], padding: s = 0 }) => /* @__PURE__ */ t(n, { theme: m, color: o, padding: s, children: /* @__PURE__ */ t("ul", { className: i.list, children: e.map((r) => /* @__PURE__ */ t("li", { children: /* @__PURE__ */ t(l, { ...r, className: i.item }) }, r.id)) }) });
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
- x as PageTabs
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?: PageTabsTheme;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.19.0",
3
+ "version": "0.19.2",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",