@altinn/altinn-components 0.18.3 → 0.18.5

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,40 +1,40 @@
1
1
  "use client";
2
- import { jsxs as m, jsx as n } from "react/jsx-runtime";
2
+ import { jsxs as a, jsx as l } from "react/jsx-runtime";
3
3
  import "../../index-L8X2o7IH.js";
4
- import * as a from "react";
4
+ import * as m from "react";
5
5
  import { forwardRef as f } from "react";
6
- import { Button as c } from "../Button/Button.js";
6
+ import { Button as p } from "../Button/Button.js";
7
7
  import "../RootProvider/RootProvider.js";
8
- import { ListBase as p } from "../List/ListBase.js";
8
+ import { ListBase as c } from "../List/ListBase.js";
9
9
  import { Heading as d } from "../Typography/Heading.js";
10
10
  import "../Search/AutocompleteBase.js";
11
11
  import "../Snackbar/useSnackbar.js";
12
12
  import { Flex as s } from "../Page/Flex.js";
13
13
  import { Section as u } from "../Page/Section.js";
14
14
  import { u as g } from "../../useId-CsCRkvK3.js";
15
- var b = function(e, i) {
16
- var o = {};
17
- for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && i.indexOf(t) < 0 && (o[t] = e[t]);
15
+ var v = function(e, i) {
16
+ var r = {};
17
+ for (var t in e) Object.prototype.hasOwnProperty.call(e, t) && i.indexOf(t) < 0 && (r[t] = e[t]);
18
18
  if (e != null && typeof Object.getOwnPropertySymbols == "function")
19
- for (var r = 0, t = Object.getOwnPropertySymbols(e); r < t.length; r++)
20
- i.indexOf(t[r]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[r]) && (o[t[r]] = e[t[r]]);
21
- return o;
19
+ for (var o = 0, t = Object.getOwnPropertySymbols(e); o < t.length; o++)
20
+ i.indexOf(t[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, t[o]) && (r[t[o]] = e[t[o]]);
21
+ return r;
22
22
  };
23
- const h = f((e, i) => {
24
- var { title: o, titleId: t } = e, r = b(e, ["title", "titleId"]);
25
- let l = g();
26
- return l = o ? t || "title-" + l : void 0, a.createElement(
23
+ const w = f((e, i) => {
24
+ var { title: r, titleId: t } = e, o = v(e, ["title", "titleId"]);
25
+ let n = g();
26
+ return n = r ? t || "title-" + n : void 0, m.createElement(
27
27
  "svg",
28
- Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24", focusable: !1, role: "img", ref: i, "aria-labelledby": l }, r),
29
- o ? a.createElement("title", { id: l }, o) : null,
30
- a.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M18.998 6.94a.75.75 0 0 1 .063 1.058l-8 9a.75.75 0 0 1-1.091.032l-5-5a.75.75 0 1 1 1.06-1.06l4.438 4.437 7.471-8.405A.75.75 0 0 1 19 6.939", clipRule: "evenodd" })
28
+ Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", fill: "none", viewBox: "0 0 24 24", focusable: !1, role: "img", ref: i, "aria-labelledby": n }, o),
29
+ r ? m.createElement("title", { id: n }, r) : null,
30
+ m.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M18.998 6.94a.75.75 0 0 1 .063 1.058l-8 9a.75.75 0 0 1-1.091.032l-5-5a.75.75 0 1 1 1.06-1.06l4.438 4.437 7.471-8.405A.75.75 0 0 1 19 6.939", clipRule: "evenodd" })
31
31
  );
32
- }), P = ({ title: e, children: i }) => /* @__PURE__ */ m(u, { spacing: 3, children: [
33
- e && /* @__PURE__ */ m(s, { direction: "row", align: "center", justify: "between", children: [
34
- /* @__PURE__ */ n(d, { size: "lg", children: e }),
35
- /* @__PURE__ */ n(c, { variant: "text", icon: h, size: "sm", children: "Velg alle" })
32
+ }), P = ({ title: e, children: i, checkAllLabel: r }) => /* @__PURE__ */ a(u, { spacing: 3, children: [
33
+ e && /* @__PURE__ */ a(s, { direction: "row", align: "center", justify: "between", children: [
34
+ /* @__PURE__ */ l(d, { size: "lg", children: e }),
35
+ r && /* @__PURE__ */ l(p, { variant: "text", icon: w, size: "sm", children: r })
36
36
  ] }),
37
- /* @__PURE__ */ n(p, { spacing: 3, children: i })
37
+ /* @__PURE__ */ l(c, { spacing: 3, children: i })
38
38
  ] });
39
39
  export {
40
40
  P as DialogListGroup
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { jsxs as C, jsx as o } from "react/jsx-runtime";
2
+ import { jsxs as C, jsx as t } from "react/jsx-runtime";
3
3
  import { c as I } from "../../index-L8X2o7IH.js";
4
4
  import { useRef as N } from "react";
5
5
  import { Icon as v } from "../Icon/Icon.js";
@@ -19,31 +19,31 @@ import '../../assets/SearchField.css';const j = "_field_1y3oc_1", A = "_icon_1y3
19
19
  className: m,
20
20
  expanded: p,
21
21
  name: u = "q",
22
- value: i,
22
+ value: o,
23
23
  placeholder: d = "Search",
24
24
  closeButtonAltText: f = "Close search",
25
25
  clearButtonAltText: _ = "Clear search",
26
26
  onFocus: y,
27
27
  onBlur: h,
28
28
  onChange: x,
29
- onClear: S,
30
- onClose: b,
31
- onEnter: t,
29
+ onClear: b,
30
+ onClose: S,
31
+ onEnter: c,
32
32
  tabIndex: g
33
33
  }) => {
34
- const c = N(null), k = (e) => {
34
+ const i = N(null), k = (e) => {
35
35
  var a, r;
36
- e.key === "Escape" && ((a = c.current) == null || a.blur()), e.key === "Enter" && ((r = c.current) == null || r.blur(), t == null || t());
36
+ e.key === "Escape" && ((a = i.current) == null || a.blur()), e.key === "Enter" && ((r = i.current) == null || r.blur(), c == null || c());
37
37
  };
38
38
  return /* @__PURE__ */ C("div", { className: I(s.field, m), children: [
39
- /* @__PURE__ */ o(
39
+ /* @__PURE__ */ t(
40
40
  "input",
41
41
  {
42
- ref: c,
42
+ ref: i,
43
43
  onFocus: y,
44
44
  onBlur: h,
45
45
  name: u,
46
- value: i,
46
+ value: o,
47
47
  onChange: x,
48
48
  placeholder: d,
49
49
  className: s.input,
@@ -52,28 +52,29 @@ import '../../assets/SearchField.css';const j = "_field_1y3oc_1", A = "_icon_1y3
52
52
  "aria-haspopup": !0,
53
53
  autoComplete: "off",
54
54
  "aria-autocomplete": "list",
55
- tabIndex: g ?? 0
55
+ tabIndex: g ?? 0,
56
+ "data-testid": "searchbar-input"
56
57
  }
57
58
  ),
58
- /* @__PURE__ */ o(v, { svgElement: T, className: s.icon }),
59
- i && /* @__PURE__ */ o(
59
+ /* @__PURE__ */ t(v, { svgElement: T, className: s.icon }),
60
+ o && /* @__PURE__ */ t(
60
61
  n,
61
62
  {
62
63
  icon: l,
63
64
  variant: "solid",
64
65
  size: "custom",
65
66
  className: s.clear,
66
- onClick: S,
67
+ onClick: b,
67
68
  dataTestId: "search-button-clear",
68
69
  iconAltText: _
69
70
  }
70
- ) || p && /* @__PURE__ */ o(
71
+ ) || p && /* @__PURE__ */ t(
71
72
  n,
72
73
  {
73
74
  icon: l,
74
75
  variant: "text",
75
76
  className: s.dismiss,
76
- onClick: b,
77
+ onClick: S,
77
78
  dataTestId: "search-button-close",
78
79
  iconAltText: f
79
80
  }
@@ -1,13 +1,13 @@
1
1
  "use client";
2
- import { jsxs as v, jsx as i } from "react/jsx-runtime";
2
+ import { jsxs as B, jsx as i } from "react/jsx-runtime";
3
3
  import { useState as F, useMemo as T } from "react";
4
- import { useRootContext as B } from "../RootProvider/RootProvider.js";
5
- import { ToolbarAccountMenu as M } from "./ToolbarAccountMenu.js";
6
- import { ToolbarAdd as V } from "./ToolbarAdd.js";
7
- import { ToolbarBase as $ } from "./ToolbarBase.js";
8
- import { ToolbarFilter as q } from "./ToolbarFilter.js";
9
- import { ToolbarSearch as w } from "./ToolbarSearch.js";
10
- const g = (n, l) => l || `toolbar-filter-${n}`, P = ({
4
+ import { useRootContext as M } from "../RootProvider/RootProvider.js";
5
+ import { ToolbarAccountMenu as V } from "./ToolbarAccountMenu.js";
6
+ import { ToolbarAdd as $ } from "./ToolbarAdd.js";
7
+ import { ToolbarBase as q } from "./ToolbarBase.js";
8
+ import { ToolbarFilter as w } from "./ToolbarFilter.js";
9
+ import { ToolbarSearch as z } from "./ToolbarSearch.js";
10
+ const g = (n, l) => l || `toolbar-filter-${n}`, Q = ({
11
11
  filters: n = [],
12
12
  filterState: l,
13
13
  onFilterStateChange: s,
@@ -16,47 +16,48 @@ const g = (n, l) => l || `toolbar-filter-${n}`, P = ({
16
16
  getFilterLabel: y,
17
17
  children: x,
18
18
  showResultsLabel: A,
19
- removeButtonAltText: S
19
+ removeButtonAltText: S,
20
+ addFilterButtonLabel: h
20
21
  }) => {
21
- const { openId: h, closeAll: C } = B(), [I, N] = F(
22
+ const { openId: C, closeAll: I } = M(), [N, R] = F(
22
23
  l ?? {}
23
- ), c = typeof s == "function" ? s : N, t = l || I, [d, f] = F(
24
+ ), c = typeof s == "function" ? s : R, t = l || N, [d, f] = F(
24
25
  (n == null ? void 0 : n.filter((o) => !(o.removable && typeof t[o.name] > "u")).map((o) => o.name)) ?? []
25
- ), u = n == null ? void 0 : n.filter((o) => !d.includes(o.name)), R = T(
26
+ ), u = n == null ? void 0 : n.filter((o) => !d.includes(o.name)), j = T(
26
27
  () => d.map((o) => n.find((e) => e.name === o)).filter((o) => typeof o < "u"),
27
28
  [n, d]
28
29
  ), a = T(
29
30
  () => n.filter((o) => u.includes(o)),
30
31
  [n, u]
31
- ), j = (o, e, r) => {
32
- r === "radio" ? (C(), c({
32
+ ), L = (o, e, r) => {
33
+ r === "radio" ? (I(), c({
33
34
  ...t,
34
35
  [o]: e
35
36
  })) : c({
36
37
  ...t,
37
38
  [o]: t[o] ? t[o].some((p) => e == null ? void 0 : e.includes(p)) ? t[o].filter((p) => !e.includes(p)) : [...t[o], ...e] : e
38
39
  });
39
- }, L = (o) => {
40
+ }, k = (o) => {
40
41
  f((e) => e.filter((r) => r !== o)), c({
41
42
  ...t,
42
43
  [o]: void 0
43
44
  });
44
- }, k = (o, e) => {
45
- f((r) => [...r, o]), h(e);
45
+ }, v = (o, e) => {
46
+ f((r) => [...r, o]), C(e);
46
47
  };
47
- return /* @__PURE__ */ v($, { children: [
48
- b && /* @__PURE__ */ i(M, { ...b }),
49
- m && /* @__PURE__ */ i(w, { ...m }),
50
- R.map((o) => /* @__PURE__ */ i(
51
- q,
48
+ return /* @__PURE__ */ B(q, { children: [
49
+ b && /* @__PURE__ */ i(V, { ...b }),
50
+ m && /* @__PURE__ */ i(z, { ...m }),
51
+ j.map((o) => /* @__PURE__ */ i(
52
+ w,
52
53
  {
53
54
  id: g(o.name, o.id),
54
55
  showResultsLabel: A,
55
56
  onRemove: () => {
56
- L(o.name);
57
+ k(o.name);
57
58
  },
58
59
  onChange: (e) => {
59
- j(o.name, [e.target.value], o.optionType);
60
+ L(o.name, [e.target.value], o.optionType);
60
61
  },
61
62
  name: o.name,
62
63
  options: o.options,
@@ -70,9 +71,10 @@ const g = (n, l) => l || `toolbar-filter-${n}`, P = ({
70
71
  o.name
71
72
  )),
72
73
  (a == null ? void 0 : a.length) > 0 && /* @__PURE__ */ i(
73
- V,
74
+ $,
74
75
  {
75
76
  id: "toolbar-filter-add",
77
+ label: h,
76
78
  items: a.map((o) => {
77
79
  const e = g(o.name, o.id);
78
80
  return {
@@ -80,7 +82,7 @@ const g = (n, l) => l || `toolbar-filter-${n}`, P = ({
80
82
  title: o.label,
81
83
  name: o.name,
82
84
  onClick: () => {
83
- k(o.name, e);
85
+ v(o.name, e);
84
86
  }
85
87
  };
86
88
  })
@@ -90,5 +92,5 @@ const g = (n, l) => l || `toolbar-filter-${n}`, P = ({
90
92
  ] });
91
93
  };
92
94
  export {
93
- P as Toolbar
95
+ Q as Toolbar
94
96
  };
@@ -2,5 +2,6 @@ import { ReactNode } from 'react';
2
2
  export interface DialogListGroupProps {
3
3
  title?: string;
4
4
  children?: ReactNode;
5
+ checkAllLabel?: string;
5
6
  }
6
- export declare const DialogListGroup: ({ title, children }: DialogListGroupProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const DialogListGroup: ({ title, children, checkAllLabel }: DialogListGroupProps) => import("react/jsx-runtime").JSX.Element;
@@ -11,7 +11,8 @@ export interface ToolbarProps {
11
11
  getFilterLabel?: (name: string, value: ToolbarFilterProps['value']) => string;
12
12
  onFilterStateChange?: (state: FilterState) => void;
13
13
  showResultsLabel?: string;
14
+ addFilterButtonLabel?: string;
14
15
  removeButtonAltText?: string;
15
16
  children?: ReactNode;
16
17
  }
17
- export declare const Toolbar: ({ filters, filterState, onFilterStateChange, search, accountMenu, getFilterLabel, children, showResultsLabel, removeButtonAltText, }: ToolbarProps) => import("react/jsx-runtime").JSX.Element;
18
+ export declare const Toolbar: ({ filters, filterState, onFilterStateChange, search, accountMenu, getFilterLabel, children, showResultsLabel, removeButtonAltText, addFilterButtonLabel, }: ToolbarProps) => import("react/jsx-runtime").JSX.Element;
@@ -2,7 +2,7 @@ import { StoryObj } from '@storybook/react';
2
2
  import { Toolbar } from './Toolbar';
3
3
  declare const meta: {
4
4
  title: string;
5
- component: ({ filters, filterState, onFilterStateChange, search, accountMenu, getFilterLabel, children, showResultsLabel, removeButtonAltText, }: import('./Toolbar').ToolbarProps) => import("react/jsx-runtime").JSX.Element;
5
+ component: ({ filters, filterState, onFilterStateChange, search, accountMenu, getFilterLabel, children, showResultsLabel, removeButtonAltText, addFilterButtonLabel, }: import('./Toolbar').ToolbarProps) => import("react/jsx-runtime").JSX.Element;
6
6
  tags: string[];
7
7
  parameters: {};
8
8
  args: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.18.3",
3
+ "version": "0.18.5",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",