@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.
- package/dist/components/Pagination/Pagination.js +13 -13
- package/dist/components/Toolbar/ToolbarFilter.js +55 -54
- package/dist/types/lib/components/Pagination/Pagination.d.ts +3 -2
- package/dist/types/lib/components/Pagination/Pagination.stories.d.ts +5 -5
- package/dist/types/lib/components/Toolbar/ToolbarFilter.d.ts +2 -1
- package/dist/types/lib/components/Toolbar/ToolbarFilter.stories.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { jsx as i, jsxs as
|
|
2
|
-
import { Button as
|
|
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
|
|
10
|
-
pagination:
|
|
11
|
-
list:
|
|
12
|
-
},
|
|
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:
|
|
14
|
+
variant: o = "tinted",
|
|
15
15
|
selectedVariant: d = "solid",
|
|
16
|
-
prev:
|
|
16
|
+
prev: r,
|
|
17
17
|
next: n,
|
|
18
18
|
items: s = [],
|
|
19
19
|
"aria-label": c = "Velg side"
|
|
20
|
-
}) => /* @__PURE__ */ i("nav", { className:
|
|
21
|
-
|
|
22
|
-
s?.map((l,
|
|
23
|
-
n && /* @__PURE__ */ i("li", { children: /* @__PURE__ */ i(
|
|
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
|
-
|
|
26
|
+
y as Pagination
|
|
27
27
|
};
|
|
@@ -1,89 +1,90 @@
|
|
|
1
|
-
import { jsxs as l, Fragment as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { Button as
|
|
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
|
|
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
|
|
10
|
-
import { useFilter as
|
|
11
|
-
import { ToolbarControls as
|
|
12
|
-
import { ToolbarFilterAddMenu as
|
|
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:
|
|
19
|
-
addNextLabel:
|
|
20
|
-
resetLabel:
|
|
21
|
-
removeLabel:
|
|
22
|
-
submitLabel:
|
|
23
|
-
getFilterLabel:
|
|
24
|
-
virtualized:
|
|
25
|
-
|
|
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:
|
|
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
|
-
}),
|
|
32
|
+
}), c = N(
|
|
32
33
|
() => r?.filter((o) => o.removable)?.map((o) => o.name) ?? [],
|
|
33
34
|
[r]
|
|
34
|
-
),
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
for (const o of
|
|
40
|
-
|
|
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(
|
|
44
|
-
|
|
45
|
-
const
|
|
46
|
-
return /* @__PURE__ */
|
|
47
|
-
|
|
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:
|
|
52
|
+
submitLabel: k,
|
|
52
53
|
key: m,
|
|
53
|
-
onToggle: () =>
|
|
54
|
-
onClose:
|
|
55
|
-
open:
|
|
56
|
-
label:
|
|
57
|
-
onRemove: () =>
|
|
58
|
-
removeLabel:
|
|
59
|
-
onFilterChange:
|
|
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 &&
|
|
66
|
-
|
|
66
|
+
!n && d?.length > 0 && /* @__PURE__ */ i(
|
|
67
|
+
D,
|
|
67
68
|
{
|
|
68
69
|
name: "add",
|
|
69
|
-
onToggle: () =>
|
|
70
|
-
onClose:
|
|
71
|
-
open:
|
|
72
|
-
items:
|
|
73
|
-
onAdd:
|
|
74
|
-
label:
|
|
75
|
-
virtualized:
|
|
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(
|
|
79
|
-
!n &&
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
84
|
+
s
|
|
84
85
|
] })
|
|
85
86
|
] });
|
|
86
87
|
};
|
|
87
88
|
export {
|
|
88
|
-
|
|
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?:
|
|
10
|
-
next?:
|
|
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
|
-
|
|
9
|
+
label: string;
|
|
10
10
|
'aria-label': string;
|
|
11
11
|
};
|
|
12
12
|
next: {
|
|
13
|
-
|
|
13
|
+
label: string;
|
|
14
14
|
'aria-label': string;
|
|
15
15
|
};
|
|
16
16
|
items: ({
|
|
17
17
|
id: string;
|
|
18
|
-
|
|
18
|
+
label: string;
|
|
19
19
|
'aria-label': string;
|
|
20
20
|
selected?: undefined;
|
|
21
21
|
hidden?: undefined;
|
|
22
22
|
} | {
|
|
23
23
|
id: string;
|
|
24
|
-
|
|
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
|
-
|
|
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
|
};
|