@altinn/altinn-components 0.22.6 → 0.22.7

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,7 +1,7 @@
1
- import { jsxs as d, jsx as k } from "react/jsx-runtime";
2
- import { ListItemBase as q } from "./ListItemBase.js";
3
- import { ListItemHeader as v } from "./ListItemHeader.js";
4
- const C = ({
1
+ import { jsxs as k, jsx as q } from "react/jsx-runtime";
2
+ import { ListItemBase as v } from "./ListItemBase.js";
3
+ import { ListItemHeader as w } from "./ListItemHeader.js";
4
+ const D = ({
5
5
  className: f,
6
6
  variant: e = "solid",
7
7
  color: r,
@@ -15,57 +15,59 @@ const C = ({
15
15
  avatar: L,
16
16
  avatarGroup: l,
17
17
  title: o,
18
- description: I,
19
- badge: a,
20
- linkIcon: j = !1,
18
+ titleAs: I,
19
+ description: a,
20
+ badge: j,
21
+ linkIcon: x = !1,
21
22
  label: t,
22
- select: x,
23
- selected: h,
24
- controls: y,
25
- children: B,
26
- ...H
23
+ select: h,
24
+ selected: y,
25
+ controls: B,
26
+ children: H,
27
+ ...b
27
28
  }) => {
28
- const b = typeof t == "function" ? t() : t;
29
- return /* @__PURE__ */ d(
30
- q,
29
+ const d = typeof t == "function" ? t() : t;
30
+ return /* @__PURE__ */ k(
31
+ v,
31
32
  {
32
33
  variant: e,
33
34
  color: r,
34
35
  theme: i,
35
36
  shadow: c,
36
- selected: h,
37
+ selected: y,
37
38
  expanded: s,
38
39
  title: o,
39
40
  loading: m,
40
41
  children: [
41
- /* @__PURE__ */ k(
42
- v,
42
+ /* @__PURE__ */ q(
43
+ w,
43
44
  {
44
45
  className: f,
45
46
  color: r,
46
47
  theme: i,
47
48
  loading: m,
48
- linkIcon: j,
49
+ linkIcon: x,
49
50
  collapsible: n,
50
51
  expanded: s,
51
- select: x,
52
+ select: h,
52
53
  size: p,
53
54
  title: o,
54
- description: I,
55
+ description: a,
55
56
  icon: u,
56
57
  avatar: L,
57
58
  avatarGroup: l,
58
- badge: a,
59
- controls: y,
60
- ...H,
61
- children: b
59
+ badge: j,
60
+ controls: B,
61
+ titleAs: I,
62
+ ...b,
63
+ children: d
62
64
  }
63
65
  ),
64
- s ? B : null
66
+ s ? H : null
65
67
  ]
66
68
  }
67
69
  );
68
70
  };
69
71
  export {
70
- C as ListItem
72
+ D as ListItem
71
73
  };
@@ -1,26 +1,26 @@
1
- import { jsx as e, jsxs as n, Fragment as F } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as n, Fragment as H } from "react/jsx-runtime";
2
2
  import { c as f } from "../../index-L8X2o7IH.js";
3
- import { useId as H, isValidElement as M } from "react";
4
- import { Icon as R } from "../Icon/Icon.js";
5
- import { Badge as U } from "../Badge/Badge.js";
3
+ import { useId as M, isValidElement as R } from "react";
4
+ import { Icon as U } from "../Icon/Icon.js";
5
+ import { Badge as V } from "../Badge/Badge.js";
6
6
  import "../RootProvider/RootProvider.js";
7
- import { ListItemLink as V } from "./ListItemLink.js";
8
- import { ListItemLabel as q } from "./ListItemLabel.js";
9
- import { ListItemIcon as A } from "./ListItemIcon.js";
10
- import { ListItemControls as G } from "./ListItemControls.js";
11
- import { ListItemSelect as J } from "./ListItemSelect.js";
7
+ import { ListItemLink as q } from "./ListItemLink.js";
8
+ import { ListItemLabel as A } from "./ListItemLabel.js";
9
+ import { ListItemIcon as G } from "./ListItemIcon.js";
10
+ import { ListItemControls as J } from "./ListItemControls.js";
11
+ import { ListItemSelect as K } from "./ListItemSelect.js";
12
12
  import "../Search/AutocompleteBase.js";
13
13
  import "../Snackbar/useSnackbar.js";
14
- import { S as K } from "../../ChevronUp-H8Nuww4h.js";
15
- import { S as O } from "../../ChevronDown-CRAwzuD3.js";
16
- import { S as P } from "../../ChevronRight-DUaHaWi-.js";
17
- import '../../assets/ListItemHeader.css';const Q = "_wrapper_xtweu_1", W = "_link_xtweu_5", X = "_linkTitle_xtweu_10", Y = "_header_xtweu_16", Z = "_content_xtweu_54", t = {
18
- wrapper: Q,
19
- link: W,
20
- linkTitle: X,
21
- header: Y,
22
- content: Z
23
- }, _e = ({
14
+ import { S as O } from "../../ChevronUp-H8Nuww4h.js";
15
+ import { S as P } from "../../ChevronDown-CRAwzuD3.js";
16
+ import { S as Q } from "../../ChevronRight-DUaHaWi-.js";
17
+ import '../../assets/ListItemHeader.css';const W = "_wrapper_xtweu_1", X = "_link_xtweu_5", Y = "_linkTitle_xtweu_10", Z = "_header_xtweu_16", $ = "_content_xtweu_54", t = {
18
+ wrapper: W,
19
+ link: X,
20
+ linkTitle: Y,
21
+ header: Z,
22
+ content: $
23
+ }, ue = ({
24
24
  as: _,
25
25
  interactive: m = !0,
26
26
  color: u,
@@ -46,15 +46,16 @@ import '../../assets/ListItemHeader.css';const Q = "_wrapper_xtweu_1", W = "_lin
46
46
  controls: p,
47
47
  className: j,
48
48
  children: B,
49
- ariaLabel: E
49
+ ariaLabel: E,
50
+ titleAs: g
50
51
  }) => {
51
- const g = {
52
+ const D = {
52
53
  xs: "sm",
53
54
  sm: "md",
54
55
  md: "lg",
55
56
  lg: "lg",
56
57
  xl: "xl"
57
- }, d = v ? k ? K : O : w ? P : void 0, o = g[s], D = () => i && !r && typeof i == "object" && "label" in i ? /* @__PURE__ */ e(U, { ...i }) : M(i) ? i : null, h = H();
58
+ }, d = v ? k ? O : P : w ? Q : void 0, o = D[s], F = () => i && !r && typeof i == "object" && "label" in i ? /* @__PURE__ */ e(V, { ...i }) : R(i) ? i : null, h = M();
58
59
  return /* @__PURE__ */ e("div", { className: t.wrapper, children: /* @__PURE__ */ n(
59
60
  "header",
60
61
  {
@@ -66,7 +67,7 @@ import '../../assets/ListItemHeader.css';const Q = "_wrapper_xtweu_1", W = "_lin
66
67
  "data-has-active-child": c,
67
68
  children: [
68
69
  /* @__PURE__ */ e(
69
- V,
70
+ q,
70
71
  {
71
72
  interactive: m,
72
73
  className: f(t.link),
@@ -83,9 +84,9 @@ import '../../assets/ListItemHeader.css';const Q = "_wrapper_xtweu_1", W = "_lin
83
84
  }
84
85
  ),
85
86
  /* @__PURE__ */ n("div", { className: t.content, "data-size": s, children: [
86
- l && /* @__PURE__ */ e(J, { ...l, className: t.select, size: o }),
87
+ l && /* @__PURE__ */ e(K, { ...l, className: t.select, size: o }),
87
88
  /* @__PURE__ */ e(
88
- A,
89
+ G,
89
90
  {
90
91
  loading: r,
91
92
  size: o,
@@ -94,16 +95,27 @@ import '../../assets/ListItemHeader.css';const Q = "_wrapper_xtweu_1", W = "_lin
94
95
  avatarGroup: T
95
96
  }
96
97
  ),
97
- /* @__PURE__ */ e(q, { size: s, loading: r, title: a, description: y, id: h, children: B })
98
+ /* @__PURE__ */ e(
99
+ A,
100
+ {
101
+ size: s,
102
+ loading: r,
103
+ title: a,
104
+ description: y,
105
+ id: h,
106
+ titleAs: g,
107
+ children: B
108
+ }
109
+ )
98
110
  ] }),
99
- /* @__PURE__ */ e(G, { className: t.controls, children: p && !r ? /* @__PURE__ */ e("span", { style: { position: "relative" }, children: p }) : /* @__PURE__ */ n(F, { children: [
100
- D(),
101
- d && /* @__PURE__ */ e(R, { svgElement: d, size: o })
111
+ /* @__PURE__ */ e(J, { className: t.controls, children: p && !r ? /* @__PURE__ */ e("span", { style: { position: "relative" }, children: p }) : /* @__PURE__ */ n(H, { children: [
112
+ F(),
113
+ d && /* @__PURE__ */ e(U, { svgElement: d, size: o })
102
114
  ] }) })
103
115
  ]
104
116
  }
105
117
  ) });
106
118
  };
107
119
  export {
108
- _e as ListItemHeader
120
+ ue as ListItemHeader
109
121
  };
@@ -1,22 +1,26 @@
1
- import { jsx as e, jsxs as m, Fragment as d } from "react/jsx-runtime";
2
- import { Skeleton as c } from "../Skeleton/Skeleton.js";
3
- import '../../assets/ListItemLabel.css';const _ = "_label_fiqmy_3", p = "_title_fiqmy_43", h = "_description_fiqmy_58", l = {
4
- label: _,
5
- title: p,
6
- description: h
7
- }, y = ({
1
+ import { jsx as t, jsxs as p, Fragment as _ } from "react/jsx-runtime";
2
+ import { Skeleton as n } from "../Skeleton/Skeleton.js";
3
+ import '../../assets/ListItemLabel.css';const h = "_label_fiqmy_3", b = "_title_fiqmy_43", f = "_description_fiqmy_58", l = {
4
+ label: h,
5
+ title: b,
6
+ description: f
7
+ }, x = ({
8
8
  loading: s = !1,
9
- size: t = "sm",
10
- title: n,
9
+ size: e = "sm",
10
+ title: c,
11
+ titleAs: o = "h2",
11
12
  weight: r = "bold",
12
13
  description: i,
13
14
  children: a,
14
- id: o
15
- }) => /* @__PURE__ */ e("span", { className: l.label, "data-size": t, id: o, children: a || /* @__PURE__ */ m(d, { children: [
16
- /* @__PURE__ */ e(c, { loading: s, children: /* @__PURE__ */ e("h2", { className: l.title, "data-size": t, "data-weight": r, children: n }) }),
17
- " ",
18
- i && /* @__PURE__ */ e(c, { loading: s, children: /* @__PURE__ */ e("p", { className: l.description, "data-size": t, children: i }) })
19
- ] }) });
15
+ id: m
16
+ }) => {
17
+ const d = o;
18
+ return /* @__PURE__ */ t("span", { className: l.label, "data-size": e, id: m, children: a || /* @__PURE__ */ p(_, { children: [
19
+ /* @__PURE__ */ t(n, { loading: s, children: /* @__PURE__ */ t(d, { className: l.title, "data-size": e, "data-weight": r, children: c }) }),
20
+ " ",
21
+ i && /* @__PURE__ */ t(n, { loading: s, children: /* @__PURE__ */ t("p", { className: l.description, "data-size": e, children: i }) })
22
+ ] }) });
23
+ };
20
24
  export {
21
- y as ListItemLabel
25
+ x as ListItemLabel
22
26
  };
@@ -1,4 +1,4 @@
1
- import { ReactElement, ReactNode } from 'react';
1
+ import { ElementType, ReactElement, ReactNode } from 'react';
2
2
  import { AvatarGroupProps, AvatarProps } from '../Avatar';
3
3
  import { BadgeProps } from '../Badge';
4
4
  import { IconProps, SvgElement } from '../Icon';
@@ -13,6 +13,8 @@ export interface ListItemProps extends ListItemBaseProps, ListItemHeaderProps {
13
13
  loading?: boolean;
14
14
  /** Title */
15
15
  title?: string;
16
+ /** Element type of the list-item header label. Defaults to h2 */
17
+ titleAs?: ElementType;
16
18
  /** Optional description */
17
19
  description?: string;
18
20
  /** List item icon */
@@ -33,4 +35,4 @@ export interface ListItemInputProps extends ListItemProps {
33
35
  /** Child items */
34
36
  items?: ListItemProps[];
35
37
  }
36
- export declare const ListItem: ({ className, variant, color, theme, shadow, loading, collapsible, expanded, size, icon, avatar, avatarGroup, title, description, badge, linkIcon, label, select, selected, controls, children, ...rest }: ListItemProps) => import("react/jsx-runtime").JSX.Element;
38
+ export declare const ListItem: ({ className, variant, color, theme, shadow, loading, collapsible, expanded, size, icon, avatar, avatarGroup, title, titleAs, description, badge, linkIcon, label, select, selected, controls, children, ...rest }: ListItemProps) => import("react/jsx-runtime").JSX.Element;
@@ -2,12 +2,13 @@ import { StoryObj } from '@storybook/react';
2
2
  import { ListItemProps } from '../';
3
3
  declare const meta: {
4
4
  title: string;
5
- component: ({ className, variant, color, theme, shadow, loading, collapsible, expanded, size, icon, avatar, avatarGroup, title, description, badge, linkIcon, label, select, selected, controls, children, ...rest }: ListItemProps) => import("react/jsx-runtime").JSX.Element;
5
+ component: ({ className, variant, color, theme, shadow, loading, collapsible, expanded, size, icon, avatar, avatarGroup, title, titleAs, description, badge, linkIcon, label, select, selected, controls, children, ...rest }: ListItemProps) => import("react/jsx-runtime").JSX.Element;
6
6
  parameters: {};
7
7
  args: {
8
8
  id: string;
9
9
  as: "button";
10
10
  title: string;
11
+ titleAs: "h2";
11
12
  onClick: () => void;
12
13
  };
13
14
  };
@@ -28,3 +29,4 @@ export declare const OverridingIcon: (args: ListItemProps) => import("react/jsx-
28
29
  export declare const OverridingBadge: (args: ListItemProps) => import("react/jsx-runtime").JSX.Element;
29
30
  export declare const OverridingLabel: (args: ListItemProps) => import("react/jsx-runtime").JSX.Element;
30
31
  export declare const CustomControls: (args: ListItemProps) => import("react/jsx-runtime").JSX.Element;
32
+ export declare const OverrideTitleAs: (args: ListItemProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import { ReactNode } from 'react';
1
+ import { ElementType, ReactNode } from 'react';
2
2
  import { AvatarGroupProps, AvatarProps, BadgeProps, IconProps, ListItemColor, ListItemLinkProps, ListItemSelectProps, ListItemSize, ListItemTheme, SvgElement } from '..';
3
3
  export interface ListItemHeaderProps extends ListItemLinkProps {
4
4
  /** The color of the list item. */
@@ -23,6 +23,8 @@ export interface ListItemHeaderProps extends ListItemLinkProps {
23
23
  linkIcon?: boolean;
24
24
  /** Title */
25
25
  title?: string;
26
+ /** Element type of the list-item header label. Defaults to h2*/
27
+ titleAs?: ElementType;
26
28
  /** Description */
27
29
  description?: string;
28
30
  /** List item icon */
@@ -42,4 +44,4 @@ export interface ListItemHeaderProps extends ListItemLinkProps {
42
44
  /** Used as decerning text for the ListItem without title, defaults to title */
43
45
  ariaLabel?: string;
44
46
  }
45
- export declare const ListItemHeader: ({ as, interactive, color, theme, loading, disabled, collapsible, linkIcon, expanded, select, href, onClick, onKeyPress, tabIndex, size, title, description, icon, avatar, active, avatarGroup, badge, controls, className, children, ariaLabel, }: ListItemHeaderProps) => import("react/jsx-runtime").JSX.Element;
47
+ export declare const ListItemHeader: ({ as, interactive, color, theme, loading, disabled, collapsible, linkIcon, expanded, select, href, onClick, onKeyPress, tabIndex, size, title, description, icon, avatar, active, avatarGroup, badge, controls, className, children, ariaLabel, titleAs, }: ListItemHeaderProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,12 +1,13 @@
1
- import { ReactNode } from 'react';
1
+ import { ElementType, ReactNode } from 'react';
2
2
  import { ListItemSize } from './ListItemBase';
3
3
  export interface ListItemLabelProps {
4
4
  id?: string;
5
5
  loading?: boolean;
6
6
  size?: ListItemSize;
7
7
  title?: string;
8
+ titleAs?: ElementType;
8
9
  weight?: 'bold' | 'normal';
9
10
  description?: string;
10
11
  children?: ReactNode;
11
12
  }
12
- export declare const ListItemLabel: ({ loading, size, title, weight, description, children, id, }: ListItemLabelProps) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const ListItemLabel: ({ loading, size, title, titleAs, weight, description, children, id, }: ListItemLabelProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { ListItemProps } from '../';
2
2
  declare const meta: {
3
3
  title: string;
4
- component: ({ className, variant, color, theme, shadow, loading, collapsible, expanded, size, icon, avatar, avatarGroup, title, description, badge, linkIcon, label, select, selected, controls, children, ...rest }: ListItemProps) => import("react/jsx-runtime").JSX.Element;
4
+ component: ({ className, variant, color, theme, shadow, loading, collapsible, expanded, size, icon, avatar, avatarGroup, title, titleAs, description, badge, linkIcon, label, select, selected, controls, children, ...rest }: ListItemProps) => import("react/jsx-runtime").JSX.Element;
5
5
  parameters: {};
6
6
  args: {
7
7
  id: string;
@@ -35,6 +35,7 @@ declare const meta: {
35
35
  avatarGroup?: import('..').AvatarGroupProps | undefined;
36
36
  href?: string | undefined;
37
37
  ariaLabel?: string | undefined;
38
+ titleAs?: import('react').ElementType | undefined;
38
39
  description?: string | undefined;
39
40
  linkIcon?: boolean | undefined;
40
41
  interactive?: boolean | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@altinn/altinn-components",
3
- "version": "0.22.6",
3
+ "version": "0.22.7",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist/",