@altinn/altinn-components 0.17.0 → 0.18.0
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/README.md +18 -14
- package/dist/components/AccessAreaList/AccessAreaListItem.js +26 -21
- package/dist/components/AccessPackageList/AccessPackageListItem.js +8 -16
- package/dist/components/List/ListItemHeader.js +25 -25
- package/dist/types/lib/components/AccessAreaList/AccessAreaListItem.d.ts +11 -2
- package/dist/types/lib/components/AccessAreaList/AccessAreaListItem.stories.d.ts +11 -2
- package/dist/types/lib/components/AccessPackageList/AccessPackageList.stories.d.ts +11 -9
- package/dist/types/lib/components/AccessPackageList/AccessPackageListItem.d.ts +2 -3
- package/dist/types/lib/components/ResourceList/ResourceList.stories.d.ts +0 -7
- package/dist/types/lib/components/ResourceList/ResourceListItem.d.ts +9 -1
- package/dist/types/lib/components/ResourceList/ResourceListItem.stories.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,11 +23,11 @@ To install the package, run the following command:
|
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
25
|
# for npm users
|
|
26
|
-
npm install @altinn/components
|
|
26
|
+
npm install @altinn/altinn-components
|
|
27
27
|
# for yarn users
|
|
28
|
-
yarn add @altinn/components
|
|
28
|
+
yarn add @altinn/altinn-components
|
|
29
29
|
# for pnpm users
|
|
30
|
-
pnpm add @altinn/components
|
|
30
|
+
pnpm add @altinn/altinn-components
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
Tested with Node.js 20.x <
|
|
@@ -75,42 +75,46 @@ The tags are:
|
|
|
75
75
|
- `@experimental` - The component is experimental and is work in progress. Recommended not to use.
|
|
76
76
|
- `@deprecated` - The component is deprecated and should not be used.
|
|
77
77
|
|
|
78
|
-
The main motivation behind having tags is relieving the pressure of having to make everything stable before releasing it for use.
|
|
78
|
+
The main motivation behind having tags is relieving the pressure of having to make everything stable before releasing it for use.
|
|
79
79
|
It also allows us to get feedback on the components in an early stage.
|
|
80
80
|
|
|
81
81
|
## Storybook test runner (accessibility)
|
|
82
|
+
|
|
82
83
|
Config for the storybook test runner is placed under .storybook/test-runner.ts
|
|
83
84
|
|
|
85
|
+
First you will need to run the storybook:
|
|
84
86
|
|
|
85
|
-
First you will need to run the storybook:
|
|
86
87
|
```
|
|
87
88
|
pnpm storybook
|
|
88
89
|
```
|
|
90
|
+
|
|
89
91
|
-
|
|
90
92
|
|
|
91
93
|
When that is done, in another terminal run following command to test all the stories for accessibility
|
|
94
|
+
|
|
92
95
|
```
|
|
93
96
|
pnpm test-storybook
|
|
94
97
|
```
|
|
95
|
-
-
|
|
96
98
|
|
|
97
|
-
|
|
99
|
+
-
|
|
100
|
+
|
|
101
|
+
To test a specific file, run...
|
|
102
|
+
|
|
98
103
|
```
|
|
99
104
|
pnpm test-storybook --watch
|
|
100
105
|
```
|
|
101
|
-
...and press 'p' to choose filtering by file name. Then start typing the name of the storybook file f.ex. 'badge'. The helper will list all the files matching your input.
|
|
102
106
|
|
|
103
|
-
|
|
107
|
+
...and press 'p' to choose filtering by file name. Then start typing the name of the storybook file f.ex. 'badge'. The helper will list all the files matching your input.
|
|
108
|
+
|
|
109
|
+
Hit enter to test the file.
|
|
104
110
|
|
|
105
111
|
If there is more files matching your input, they will also be tested.
|
|
106
112
|
|
|
107
|
-
-
|
|
108
|
-
If the storybook cli runs all the tests even with --watch flag, alternatively you can simply run:
|
|
113
|
+
- If the storybook cli runs all the tests even with --watch flag, alternatively you can simply run:
|
|
109
114
|
|
|
110
115
|
```
|
|
111
116
|
pnpm test-storybook --watch 'MyComponent.stories.tsx'
|
|
112
117
|
```
|
|
113
118
|
|
|
114
|
-
-
|
|
115
|
-
|
|
116
|
-
Currently all the tests under stories/Demo and docs are excluded as the accessibility test is not needed there.
|
|
119
|
+
- To skip the test add 'skip-test' string into the tags array for the test you want to exclude. That option is defined in the test-runner.ts file.
|
|
120
|
+
Currently all the tests under stories/Demo and docs are excluded as the accessibility test is not needed there.
|
|
@@ -1,34 +1,39 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
2
|
import "../../index-L8X2o7IH.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "../RootProvider/RootProvider.js";
|
|
5
5
|
import "../Search/AutocompleteBase.js";
|
|
6
6
|
import "../Snackbar/useSnackbar.js";
|
|
7
|
-
import { ListItem as
|
|
8
|
-
import '../../assets/AccessAreaListItem.css';const
|
|
9
|
-
content:
|
|
10
|
-
},
|
|
11
|
-
name:
|
|
12
|
-
icon:
|
|
13
|
-
size:
|
|
14
|
-
children:
|
|
7
|
+
import { ListItem as a } from "../List/ListItem.js";
|
|
8
|
+
import '../../assets/AccessAreaListItem.css';const b = "_content_7hk0i_1", d = {
|
|
9
|
+
content: b
|
|
10
|
+
}, j = ({
|
|
11
|
+
name: c,
|
|
12
|
+
icon: m,
|
|
13
|
+
size: i = "md",
|
|
14
|
+
children: r,
|
|
15
15
|
expanded: t = !1,
|
|
16
|
-
onClick:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
onClick: l,
|
|
17
|
+
badgeText: o,
|
|
18
|
+
colorTheme: e,
|
|
19
|
+
loading: n,
|
|
20
|
+
...p
|
|
21
|
+
}) => /* @__PURE__ */ s(
|
|
22
|
+
a,
|
|
20
23
|
{
|
|
21
24
|
as: "button",
|
|
22
|
-
icon:
|
|
23
|
-
title:
|
|
24
|
-
size:
|
|
25
|
-
collapsible: !
|
|
25
|
+
icon: { svgElement: m, theme: "subtle", color: e },
|
|
26
|
+
title: c,
|
|
27
|
+
size: i,
|
|
28
|
+
collapsible: !n,
|
|
26
29
|
expanded: t,
|
|
27
|
-
onClick:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
onClick: l,
|
|
31
|
+
badge: o ? { label: o, color: e } : void 0,
|
|
32
|
+
loading: n,
|
|
33
|
+
...p,
|
|
34
|
+
children: t && /* @__PURE__ */ s("div", { className: d.content, children: r })
|
|
30
35
|
}
|
|
31
36
|
);
|
|
32
37
|
export {
|
|
33
|
-
|
|
38
|
+
j as AccessAreaListItem
|
|
34
39
|
};
|
|
@@ -5,21 +5,13 @@ import "../RootProvider/RootProvider.js";
|
|
|
5
5
|
import "../Search/AutocompleteBase.js";
|
|
6
6
|
import "../Snackbar/useSnackbar.js";
|
|
7
7
|
import { ListItem as i } from "../List/ListItem.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} : void 0,
|
|
16
|
-
as: r,
|
|
17
|
-
size: "sm",
|
|
18
|
-
color: "accent",
|
|
19
|
-
title: m,
|
|
20
|
-
...o
|
|
21
|
-
}
|
|
22
|
-
);
|
|
8
|
+
import { S as s } from "../../Package-ASRzCHA7.js";
|
|
9
|
+
const k = ({
|
|
10
|
+
as: t = "button",
|
|
11
|
+
title: m,
|
|
12
|
+
color: o = "neutral",
|
|
13
|
+
...r
|
|
14
|
+
}) => /* @__PURE__ */ e(i, { icon: s, as: t, size: "sm", title: m, color: o, theme: "subtle", ...r });
|
|
23
15
|
export {
|
|
24
|
-
|
|
16
|
+
k as AccessPackageListItem
|
|
25
17
|
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { jsxs as i, jsx as e, Fragment as p } from "react/jsx-runtime";
|
|
2
|
-
import { c as
|
|
3
|
-
import { isValidElement as
|
|
2
|
+
import { c as y } from "../../index-L8X2o7IH.js";
|
|
3
|
+
import { isValidElement as B } from "react";
|
|
4
4
|
import { Icon as d } from "../Icon/Icon.js";
|
|
5
|
-
import { Badge as
|
|
5
|
+
import { Badge as M } from "../Badge/Badge.js";
|
|
6
6
|
import "../RootProvider/RootProvider.js";
|
|
7
|
-
import { ListItemLink as
|
|
8
|
-
import { ListItemLabel as
|
|
9
|
-
import { ListItemIcon as
|
|
10
|
-
import { ListItemControls as
|
|
11
|
-
import { ListItemSelect as
|
|
7
|
+
import { ListItemLink as v } from "./ListItemLink.js";
|
|
8
|
+
import { ListItemLabel as C } from "./ListItemLabel.js";
|
|
9
|
+
import { ListItemIcon as F } from "./ListItemIcon.js";
|
|
10
|
+
import { ListItemControls as H } from "./ListItemControls.js";
|
|
11
|
+
import { ListItemSelect as V } from "./ListItemSelect.js";
|
|
12
12
|
import "../Search/AutocompleteBase.js";
|
|
13
13
|
import "../Snackbar/useSnackbar.js";
|
|
14
|
-
import '../../assets/ListItemHeader.css';const
|
|
15
|
-
header:
|
|
16
|
-
link:
|
|
14
|
+
import '../../assets/ListItemHeader.css';const b = "_header_13dzg_1", g = "_link_13dzg_39", m = {
|
|
15
|
+
header: b,
|
|
16
|
+
link: g
|
|
17
17
|
}, X = ({
|
|
18
18
|
as: f,
|
|
19
|
-
loading:
|
|
19
|
+
loading: t,
|
|
20
20
|
disabled: I,
|
|
21
21
|
select: c,
|
|
22
22
|
href: h,
|
|
@@ -30,7 +30,7 @@ import '../../assets/ListItemHeader.css';const V = "_header_13dzg_1", b = "_link
|
|
|
30
30
|
avatar: N,
|
|
31
31
|
avatarGroup: S,
|
|
32
32
|
chevron: l,
|
|
33
|
-
badge:
|
|
33
|
+
badge: r,
|
|
34
34
|
controls: o,
|
|
35
35
|
className: j,
|
|
36
36
|
children: E
|
|
@@ -41,35 +41,35 @@ import '../../assets/ListItemHeader.css';const V = "_header_13dzg_1", b = "_link
|
|
|
41
41
|
md: "lg",
|
|
42
42
|
lg: "lg",
|
|
43
43
|
xl: "xl"
|
|
44
|
-
}[s], a = () => t && typeof
|
|
45
|
-
return /* @__PURE__ */ i("header", { className:
|
|
46
|
-
/* @__PURE__ */ i("div", { className:
|
|
47
|
-
c && /* @__PURE__ */ e(
|
|
44
|
+
}[s], a = () => r && !t && typeof r == "object" && "label" in r ? /* @__PURE__ */ e(M, { ...r }) : B(r) ? r : null;
|
|
45
|
+
return /* @__PURE__ */ i("header", { className: m.header, "data-size": s, children: [
|
|
46
|
+
/* @__PURE__ */ i("div", { className: m.link, children: [
|
|
47
|
+
c && /* @__PURE__ */ e(V, { ...c, className: m.select, size: n }),
|
|
48
48
|
/* @__PURE__ */ i(
|
|
49
|
-
|
|
49
|
+
v,
|
|
50
50
|
{
|
|
51
51
|
interactive: !!o,
|
|
52
|
-
className:
|
|
52
|
+
className: y(m.link, j),
|
|
53
53
|
as: f,
|
|
54
54
|
href: h,
|
|
55
55
|
onClick: L,
|
|
56
56
|
onKeyPress: x,
|
|
57
57
|
tabIndex: z,
|
|
58
|
-
loading:
|
|
59
|
-
disabled: I ||
|
|
58
|
+
loading: t,
|
|
59
|
+
disabled: I || t,
|
|
60
60
|
size: s,
|
|
61
61
|
children: [
|
|
62
62
|
/* @__PURE__ */ e(
|
|
63
|
-
|
|
63
|
+
F,
|
|
64
64
|
{
|
|
65
|
-
loading:
|
|
65
|
+
loading: t,
|
|
66
66
|
size: n,
|
|
67
67
|
icon: u,
|
|
68
68
|
avatar: N,
|
|
69
69
|
avatarGroup: S
|
|
70
70
|
}
|
|
71
71
|
),
|
|
72
|
-
/* @__PURE__ */ e(
|
|
72
|
+
/* @__PURE__ */ e(C, { size: s, loading: t, title: k, description: _, children: E }),
|
|
73
73
|
o && /* @__PURE__ */ i(p, { children: [
|
|
74
74
|
a(),
|
|
75
75
|
l && /* @__PURE__ */ e(d, { svgElement: l, size: n })
|
|
@@ -78,7 +78,7 @@ import '../../assets/ListItemHeader.css';const V = "_header_13dzg_1", b = "_link
|
|
|
78
78
|
}
|
|
79
79
|
)
|
|
80
80
|
] }),
|
|
81
|
-
/* @__PURE__ */ e(
|
|
81
|
+
/* @__PURE__ */ e(H, { className: m.controls, children: o && !t ? o : /* @__PURE__ */ i(p, { children: [
|
|
82
82
|
a(),
|
|
83
83
|
l && /* @__PURE__ */ e(d, { svgElement: l, size: n })
|
|
84
84
|
] }) })
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
import { Color } from '../../types';
|
|
1
2
|
import { SvgElement } from '../Icon';
|
|
2
3
|
import { ListItemProps } from '../List';
|
|
3
|
-
export interface AccessAreaListItemProps extends Pick<ListItemProps, 'size' | 'onClick' | 'expanded'> {
|
|
4
|
+
export interface AccessAreaListItemProps extends Pick<ListItemProps, 'size' | 'onClick' | 'expanded' | 'loading'> {
|
|
5
|
+
/** Id of the item */
|
|
4
6
|
id: string;
|
|
7
|
+
/** Name of the Access Area */
|
|
5
8
|
name: string;
|
|
9
|
+
/** The icon associated with the Access Area */
|
|
6
10
|
icon: SvgElement;
|
|
11
|
+
/** Color theme of the Access Area */
|
|
12
|
+
colorTheme?: Color;
|
|
13
|
+
/** Optional Badge to display things like the number of packages a user has in the area */
|
|
14
|
+
badgeText?: string;
|
|
15
|
+
/** Children to render when the item is expanded */
|
|
7
16
|
children?: React.ReactNode;
|
|
8
17
|
}
|
|
9
|
-
export declare const AccessAreaListItem: ({ name, icon, size, children, expanded, onClick, ...props }: AccessAreaListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare const AccessAreaListItem: ({ name, icon, size, children, expanded, onClick, badgeText, colorTheme, loading, ...props }: AccessAreaListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,14 +3,16 @@ import { default as React } from 'react';
|
|
|
3
3
|
import { AccessAreaListItemProps } from './AccessAreaListItem';
|
|
4
4
|
declare const meta: {
|
|
5
5
|
title: string;
|
|
6
|
-
component: ({ name, icon, size, children, expanded, onClick, ...props }: AccessAreaListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
component: ({ name, icon, size, children, expanded, onClick, badgeText, colorTheme, loading, ...props }: AccessAreaListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
tags: string[];
|
|
8
8
|
args: {
|
|
9
9
|
id: string;
|
|
10
10
|
size: "md";
|
|
11
11
|
name: string;
|
|
12
12
|
icon: React.FC<React.SVGProps<SVGSVGElement>>;
|
|
13
|
-
|
|
13
|
+
badgeText: string;
|
|
14
|
+
colorTheme: "company";
|
|
15
|
+
loading: false;
|
|
14
16
|
};
|
|
15
17
|
argTypes: {
|
|
16
18
|
expanded: {
|
|
@@ -29,9 +31,16 @@ declare const meta: {
|
|
|
29
31
|
disable: true;
|
|
30
32
|
};
|
|
31
33
|
};
|
|
34
|
+
colorTheme: {
|
|
35
|
+
options: string[];
|
|
36
|
+
control: {
|
|
37
|
+
type: "select";
|
|
38
|
+
};
|
|
39
|
+
};
|
|
32
40
|
};
|
|
33
41
|
};
|
|
34
42
|
export default meta;
|
|
35
43
|
type Story = StoryObj<typeof meta>;
|
|
36
44
|
export declare const AreaListItemStory: Story;
|
|
45
|
+
export declare const AreaWithPackages: (args: AccessAreaListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
37
46
|
export declare const AllAreas: (args: AccessAreaListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AccessPackageListProps } from './AccessPackageList';
|
|
2
2
|
declare const meta: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: ({ items, spacing, ...props }:
|
|
4
|
+
component: ({ items, spacing, ...props }: AccessPackageListProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
tags: string[];
|
|
6
|
-
args: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
args: {};
|
|
7
|
+
argTypes: {
|
|
8
|
+
spacing: {
|
|
9
|
+
options: string[];
|
|
10
|
+
control: {
|
|
11
|
+
type: "inline-radio";
|
|
12
|
+
};
|
|
13
|
+
};
|
|
11
14
|
};
|
|
12
15
|
};
|
|
13
16
|
export default meta;
|
|
14
|
-
|
|
15
|
-
export declare const AccessPackageListStory: Story;
|
|
17
|
+
export declare const AccessPackageListStory: (args: AccessPackageListProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ListItemProps } from '../List';
|
|
2
|
-
export interface AccessPackageListItemProps extends Pick<ListItemProps, 'onClick' | 'as' | 'title' | 'description' | 'size' | 'controls'> {
|
|
2
|
+
export interface AccessPackageListItemProps extends Pick<ListItemProps, 'color' | 'onClick' | 'as' | 'title' | 'description' | 'size' | 'controls' | 'loading'> {
|
|
3
3
|
id: string;
|
|
4
|
-
icon?: string;
|
|
5
4
|
}
|
|
6
|
-
export declare const AccessPackageListItem: ({ as,
|
|
5
|
+
export declare const AccessPackageListItem: ({ as, title, color, ...props }: AccessPackageListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
+
import { BadgeProps } from '../Badge';
|
|
1
2
|
import { ListItemProps } from '../List';
|
|
2
|
-
export interface ResourceListItemProps extends Pick<ListItemProps, 'size' | 'controls' | 'as' | 'onClick'> {
|
|
3
|
+
export interface ResourceListItemProps extends Pick<ListItemProps, 'size' | 'controls' | 'as' | 'onClick' | 'loading'> {
|
|
4
|
+
/** Unique identifier for the resource item */
|
|
3
5
|
id: string;
|
|
6
|
+
/** Name of the owner of the resource */
|
|
4
7
|
ownerName: string;
|
|
8
|
+
/** Name of the resource */
|
|
5
9
|
resourceName: string;
|
|
10
|
+
/** URL of the owner's logo (optional) */
|
|
6
11
|
ownerLogoUrl?: string;
|
|
12
|
+
/** Alternative text for the owner's logo (optional) */
|
|
7
13
|
ownerLogoUrlAlt?: string;
|
|
14
|
+
/** Badge properties for the resource item (optional) */
|
|
15
|
+
badge?: BadgeProps;
|
|
8
16
|
}
|
|
9
17
|
export declare const ResourceListItem: ({ ownerName, resourceName, ownerLogoUrlAlt, ownerLogoUrl, ...props }: ResourceListItemProps) => import("react/jsx-runtime").JSX.Element;
|