@altinn/altinn-components 0.60.2 → 0.61.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,27 +1,27 @@
1
- import { jsx as i, jsxs as h } from "react/jsx-runtime";
2
- import { Button as r } from "../Button/Button.js";
1
+ import { jsx as i, jsxs as p } from "react/jsx-runtime";
2
+ import { Button as e } from "../Button/Button.js";
3
3
  import "../../index-p1eeF8LQ.js";
4
4
  import "react";
5
5
  import "../../ToolbarSearch-56Sm2j7P.js";
6
6
  import "../Typography/Link.js";
7
7
  import "react-dom";
8
8
  import "../Snackbar/useSnackbar.js";
9
- import '../../assets/Pagination.css';const m = "_pagination_jpqmb_1", g = "_list_jpqmb_5", o = {
10
- pagination: m,
11
- list: g
12
- }, x = ({
9
+ import '../../assets/Pagination.css';const b = "_pagination_jpqmb_1", m = "_list_jpqmb_5", t = {
10
+ pagination: b,
11
+ list: m
12
+ }, y = ({
13
13
  size: a,
14
- variant: t = "tinted",
14
+ variant: o = "tinted",
15
15
  selectedVariant: d = "solid",
16
- prev: e,
16
+ prev: r,
17
17
  next: n,
18
18
  items: s = [],
19
19
  "aria-label": c = "Velg side"
20
- }) => /* @__PURE__ */ i("nav", { className: o.pagination, "data-size": a, "aria-label": c, children: /* @__PURE__ */ h("ul", { className: o.list, children: [
21
- e && /* @__PURE__ */ i("li", { children: /* @__PURE__ */ i(r, { size: a, "aria-label": e["aria-label"] || "Forrige side", variant: t, children: e.title || "Forrige" }) }),
22
- s?.map((l, p) => /* @__PURE__ */ i("li", { "aria-hidden": l.hidden, children: l.hidden ? /* @__PURE__ */ i(r, { as: "div", size: a, variant: "ghost", children: "…" }) : /* @__PURE__ */ i(r, { ...l, size: a, variant: l?.selected ? d : t, children: l.title }) }, p)),
23
- n && /* @__PURE__ */ i("li", { children: /* @__PURE__ */ i(r, { size: a, "aria-label": n["aria-label"] || "Forrige side", variant: t, children: n.title || "Neste" }) })
20
+ }) => /* @__PURE__ */ i("nav", { className: t.pagination, "data-size": a, "aria-label": c, children: /* @__PURE__ */ p("ul", { className: t.list, children: [
21
+ r && /* @__PURE__ */ i("li", { children: /* @__PURE__ */ i(e, { ...r, size: a, "aria-label": r["aria-label"] || "Forrige side", variant: o, children: r.label || "Forrige" }) }),
22
+ s?.map((l, h) => /* @__PURE__ */ i("li", { "aria-hidden": l.hidden, children: l.hidden ? /* @__PURE__ */ i(e, { as: "div", size: a, variant: "ghost", children: "…" }) : /* @__PURE__ */ i(e, { ...l, size: a, variant: l?.selected ? d : o, children: l.label }) }, h)),
23
+ n && /* @__PURE__ */ i("li", { children: /* @__PURE__ */ i(e, { ...n, size: a, "aria-label": n["aria-label"] || "Forrige side", variant: o, children: n.label || "Neste" }) })
24
24
  ] }) });
25
25
  export {
26
- x as Pagination
26
+ y as Pagination
27
27
  };
@@ -1,89 +1,90 @@
1
- import { jsxs as l, Fragment as I, jsx as s } from "react/jsx-runtime";
2
- import { useMemo as L, useState as N, createElement as O } from "react";
3
- import { Button as w } from "../Button/Button.js";
1
+ import { jsxs as l, Fragment as L, jsx as i } from "react/jsx-runtime";
2
+ import { useMemo as N, useState as O, createElement as y } from "react";
3
+ import { Button as E } from "../Button/Button.js";
4
4
  import "../../index-p1eeF8LQ.js";
5
- import { s as y } from "../../ToolbarSearch-56Sm2j7P.js";
5
+ import { s as X } from "../../ToolbarSearch-56Sm2j7P.js";
6
6
  import "../Typography/Link.js";
7
7
  import "react-dom";
8
8
  import "../Snackbar/useSnackbar.js";
9
- import { ToolbarFilterMenu as E } from "./ToolbarFilterMenu.js";
10
- import { useFilter as X } from "./useFilter.js";
11
- import { ToolbarControls as q } from "./ToolbarControls.js";
12
- import { ToolbarFilterAddMenu as z } from "./ToolbarFilterAddMenu.js";
13
- const _ = ({
9
+ import { ToolbarFilterMenu as q } from "./ToolbarFilterMenu.js";
10
+ import { useFilter as w } from "./useFilter.js";
11
+ import { ToolbarControls as z } from "./ToolbarControls.js";
12
+ import { ToolbarFilterAddMenu as D } from "./ToolbarFilterAddMenu.js";
13
+ const $ = ({
14
14
  disabled: n,
15
15
  filters: r,
16
16
  filterState: e = {},
17
17
  onFilterStateChange: t,
18
- addLabel: v = "Legg til filter",
19
- addNextLabel: F = "Legg til",
20
- resetLabel: b = "Nullstill",
21
- removeLabel: T = "Fjern filter",
22
- submitLabel: j,
23
- getFilterLabel: M,
24
- virtualized: R,
25
- controls: k
18
+ addLabel: b = "Legg til filter",
19
+ addNextLabel: T = "Legg til",
20
+ resetLabel: j = "Nullstill",
21
+ removeLabel: M = "Fjern filter",
22
+ submitLabel: k,
23
+ getFilterLabel: x,
24
+ virtualized: A,
25
+ showResetButton: R = !0,
26
+ controls: s
26
27
  }) => {
27
- const { visibleFilters: i, hiddenFilters: a, onFilterAdd: x, onFilterChange: A, onFilterRemove: d } = X({
28
+ const { visibleFilters: a, hiddenFilters: d, onFilterAdd: f, onFilterChange: B, onFilterRemove: p } = w({
28
29
  filters: r,
29
30
  filterState: e,
30
31
  onFilterStateChange: t
31
- }), p = L(
32
+ }), c = N(
32
33
  () => r?.filter((o) => o.removable)?.map((o) => o.name) ?? [],
33
34
  [r]
34
- ), f = p.length > 0 && Object.values(e)?.some((o) => o && o?.length > 0), [c, g] = N(void 0), h = (o) => {
35
- g((m) => m === o ? void 0 : o);
36
- }, u = () => {
37
- g(void 0);
38
- }, B = () => {
39
- for (const o of p)
40
- d(o);
35
+ ), g = R && c.length > 0 && Object.values(e)?.some((o) => o && o?.length > 0), [u, h] = O(void 0), v = (o) => {
36
+ h((m) => m === o ? void 0 : o);
37
+ }, F = () => {
38
+ h(void 0);
39
+ }, C = () => {
40
+ for (const o of c)
41
+ p(o);
41
42
  t?.({});
42
43
  };
43
- return /* @__PURE__ */ l(I, { children: [
44
- i?.map((o, m) => {
45
- const C = M?.(o?.name, e?.[o?.id]) ?? o?.label;
46
- return /* @__PURE__ */ O(
47
- E,
44
+ return /* @__PURE__ */ l(L, { children: [
45
+ a?.map((o, m) => {
46
+ const I = x?.(o?.name, e?.[o?.id]) ?? o?.label;
47
+ return /* @__PURE__ */ y(
48
+ q,
48
49
  {
49
50
  ...o,
50
51
  disabled: n,
51
- submitLabel: j,
52
+ submitLabel: k,
52
53
  key: m,
53
- onToggle: () => h(o.name),
54
- onClose: u,
55
- open: c === o.name,
56
- label: C,
57
- onRemove: () => d(o.name),
58
- removeLabel: T,
59
- onFilterChange: A,
54
+ onToggle: () => v(o.name),
55
+ onClose: F,
56
+ open: u === o.name,
57
+ label: I,
58
+ onRemove: () => p(o.name),
59
+ removeLabel: M,
60
+ onFilterChange: B,
60
61
  onFilterStateChange: t,
61
62
  filterState: e
62
63
  }
63
64
  );
64
65
  }),
65
- !n && a?.length > 0 && /* @__PURE__ */ s(
66
- z,
66
+ !n && d?.length > 0 && /* @__PURE__ */ i(
67
+ D,
67
68
  {
68
69
  name: "add",
69
- onToggle: () => h("add"),
70
- onClose: u,
71
- open: c === "add",
72
- items: a,
73
- onAdd: x,
74
- label: i?.length > 0 ? F : v,
75
- virtualized: R
70
+ onToggle: () => v("add"),
71
+ onClose: F,
72
+ open: u === "add",
73
+ items: d,
74
+ onAdd: f,
75
+ label: a?.length > 0 ? T : b,
76
+ virtualized: A
76
77
  }
77
78
  ),
78
- /* @__PURE__ */ l(q, { children: [
79
- !n && f && /* @__PURE__ */ l(w, { onClick: B, variant: "ghost", children: [
80
- /* @__PURE__ */ s(y, { "aria-hidden": "true" }),
81
- /* @__PURE__ */ s("span", { children: b })
79
+ (g || s) && /* @__PURE__ */ l(z, { children: [
80
+ !n && g && /* @__PURE__ */ l(E, { onClick: C, variant: "ghost", children: [
81
+ /* @__PURE__ */ i(X, { "aria-hidden": "true" }),
82
+ /* @__PURE__ */ i("span", { children: j })
82
83
  ] }),
83
- k
84
+ s
84
85
  ] })
85
86
  ] });
86
87
  };
87
88
  export {
88
- _ as ToolbarFilter
89
+ $ as ToolbarFilter
89
90
  };
@@ -1,13 +1,14 @@
1
1
  import { ButtonProps } from '../Button';
2
2
  export interface PaginationButtonProps extends ButtonProps {
3
+ label?: string;
3
4
  selected?: boolean;
4
5
  }
5
6
  export interface PaginationProps {
6
7
  size?: ButtonProps['size'];
7
8
  variant?: ButtonProps['variant'];
8
9
  selectedVariant?: ButtonProps['variant'];
9
- prev?: ButtonProps;
10
- next?: ButtonProps;
10
+ prev?: PaginationButtonProps;
11
+ next?: PaginationButtonProps;
11
12
  items?: PaginationButtonProps[];
12
13
  'aria-label': string;
13
14
  }
@@ -6,29 +6,29 @@ declare const meta: {
6
6
  args: {
7
7
  'aria-label': string;
8
8
  prev: {
9
- title: string;
9
+ label: string;
10
10
  'aria-label': string;
11
11
  };
12
12
  next: {
13
- title: string;
13
+ label: string;
14
14
  'aria-label': string;
15
15
  };
16
16
  items: ({
17
17
  id: string;
18
- title: string;
18
+ label: string;
19
19
  'aria-label': string;
20
20
  selected?: undefined;
21
21
  hidden?: undefined;
22
22
  } | {
23
23
  id: string;
24
- title: string;
24
+ label: string;
25
25
  'aria-label': string;
26
26
  selected: true;
27
27
  hidden?: undefined;
28
28
  } | {
29
29
  hidden: true;
30
30
  id?: undefined;
31
- title?: undefined;
31
+ label?: undefined;
32
32
  'aria-label'?: undefined;
33
33
  selected?: undefined;
34
34
  })[];
@@ -13,5 +13,6 @@ export interface ToolbarFilterProps {
13
13
  onFilterStateChange?: (state: FilterState) => void;
14
14
  virtualized?: boolean;
15
15
  controls?: ReactNode;
16
+ showResetButton?: boolean;
16
17
  }
17
- export declare const ToolbarFilter: ({ disabled, filters, filterState, onFilterStateChange, addLabel, addNextLabel, resetLabel, removeLabel, submitLabel, getFilterLabel, virtualized, controls, }: ToolbarFilterProps) => import("react/jsx-runtime").JSX.Element;
18
+ export declare const ToolbarFilter: ({ disabled, filters, filterState, onFilterStateChange, addLabel, addNextLabel, resetLabel, removeLabel, submitLabel, getFilterLabel, virtualized, showResetButton, controls, }: ToolbarFilterProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { ToolbarFilterProps } from './ToolbarFilter';
2
2
  declare const meta: {
3
3
  title: string;
4
- component: ({ disabled, filters, filterState, onFilterStateChange, addLabel, addNextLabel, resetLabel, removeLabel, submitLabel, getFilterLabel, virtualized, controls, }: ToolbarFilterProps) => import("react/jsx-runtime").JSX.Element;
4
+ component: ({ disabled, filters, filterState, onFilterStateChange, addLabel, addNextLabel, resetLabel, removeLabel, submitLabel, getFilterLabel, virtualized, showResetButton, controls, }: ToolbarFilterProps) => import("react/jsx-runtime").JSX.Element;
5
5
  parameters: {};
6
6
  args: {};
7
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.60.2",
3
+ "version": "0.61.1",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",