@arbeidstilsynet/design-react 0.6.0 → 0.7.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/index.cjs +214 -89
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +214 -89
- package/dist/index.js.map +1 -1
- package/dist/src/components/header/headerMenuRow.d.ts +17 -0
- package/dist/src/components/header/index.d.ts +48 -14
- package/dist/src/components/header/stories-helpers/headerStoriesIllustration.d.ts +4 -0
- package/dist/src/components/header/stories-helpers/headerStoriesTitle.d.ts +4 -0
- package/package.json +17 -17
- package/dist/src/components/header/stories-helpers/headeStoriesIllustation.d.ts +0 -6
- package/dist/src/components/header/stories-helpers/headerStoriesMenuItems.d.ts +0 -28
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { DefaultProps } from '../../types';
|
|
3
|
+
export interface HeaderMenuRowProps extends DefaultProps<HTMLElement>, HTMLAttributes<HTMLElement> {
|
|
4
|
+
padded?: boolean;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Menu row that serves as a wrapper around a link in the header menu.
|
|
8
|
+
* Supports an icon, badge and custom styling.
|
|
9
|
+
*/
|
|
10
|
+
export declare function HeaderMenuRow({ className, padded, ...rest }: Readonly<HeaderMenuRowProps>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export interface HeaderMenuIconProps extends DefaultProps<HTMLDivElement>, HTMLAttributes<HTMLDivElement> {
|
|
12
|
+
}
|
|
13
|
+
export declare function HeaderMenuIcon({ className, ...rest }: Readonly<HeaderMenuIconProps>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export interface HeaderMenuBadgeProps extends DefaultProps<HTMLDivElement>, HTMLAttributes<HTMLDivElement> {
|
|
15
|
+
color?: "info" | "warning" | "success" | "danger";
|
|
16
|
+
}
|
|
17
|
+
export declare function HeaderMenuBadge({ className, color, ...rest }: Readonly<HeaderMenuBadgeProps>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -2,6 +2,7 @@ import { Header as HeaderParent } from './header';
|
|
|
2
2
|
import { HeaderIllustration } from './headerIllustration';
|
|
3
3
|
import { HeaderLogo } from './headerLogo';
|
|
4
4
|
import { HeaderMenu } from './headerMenu';
|
|
5
|
+
import { HeaderMenuBadge, HeaderMenuIcon, HeaderMenuRow } from './headerMenuRow';
|
|
5
6
|
import { HeaderNavbar } from './headerNavbar';
|
|
6
7
|
import { HeaderTitle } from './headerTitle';
|
|
7
8
|
/**
|
|
@@ -18,6 +19,9 @@ import { HeaderTitle } from './headerTitle';
|
|
|
18
19
|
* - `Header.Logo` - Main logo/app name (always visible)
|
|
19
20
|
* - `Header.Navbar` - Navigation links (hidden on mobile, shown in desktop)
|
|
20
21
|
* - `Header.Menu` - Dropdown menu with custom controls
|
|
22
|
+
* - `Header.MenuRow` - Wrapper for individual menu items in the dropdown
|
|
23
|
+
* - `Header.MenuIcon` - Icon for menu items
|
|
24
|
+
* - `Header.MenuBadge` - Badge for menu items
|
|
21
25
|
*
|
|
22
26
|
* ## Links prop
|
|
23
27
|
*
|
|
@@ -33,22 +37,48 @@ import { HeaderTitle } from './headerTitle';
|
|
|
33
37
|
* ];
|
|
34
38
|
*
|
|
35
39
|
* <Header links={links}>
|
|
36
|
-
* <
|
|
37
|
-
* <Header.
|
|
38
|
-
* <
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
* <
|
|
42
|
-
*
|
|
43
|
-
* </
|
|
44
|
-
* </Header.
|
|
45
|
-
* </
|
|
40
|
+
* <Link href="/" aria-label="Link til hjem">
|
|
41
|
+
* <Header.Title>
|
|
42
|
+
* <Header.Illustration>
|
|
43
|
+
* <img src="/illustration.svg" alt="App Name" />
|
|
44
|
+
* </Header.Illustration>
|
|
45
|
+
* <Header.Logo style={{ fontFamily: "Literata" }}>
|
|
46
|
+
* Fagsystem
|
|
47
|
+
* </Header.Logo>
|
|
48
|
+
* </Header.Title>
|
|
49
|
+
* </Link>
|
|
46
50
|
* <Header.Navbar />
|
|
47
51
|
* <Header.Menu triggerContent="Ola Nordmann" closeButtonText="Lukk">
|
|
48
|
-
* <
|
|
49
|
-
*
|
|
52
|
+
* <Header.MenuRow>
|
|
53
|
+
* <Link href="#">
|
|
54
|
+
* <Header.MenuIcon>
|
|
55
|
+
* <PersonCircleIcon aria-label="Profil ikon" />
|
|
56
|
+
* </Header.MenuIcon>
|
|
57
|
+
* <span>Profil</span>
|
|
58
|
+
* </Link>
|
|
59
|
+
* </Header.MenuRow>
|
|
60
|
+
* <Header.MenuRow>
|
|
61
|
+
* <Link href="#">
|
|
62
|
+
* <Header.MenuIcon>
|
|
63
|
+
* <InboxIcon aria-label="Innboks ikon" />
|
|
64
|
+
* </Header.MenuIcon>
|
|
65
|
+
* <span>Innboks</span>
|
|
66
|
+
* <Header.MenuBadge color="warning">19</Header.MenuBadge>
|
|
67
|
+
* </Link>
|
|
68
|
+
* </Header.MenuRow>
|
|
69
|
+
* <Header.MenuRow>
|
|
70
|
+
* <Link href="#">
|
|
71
|
+
* <Header.MenuIcon>
|
|
72
|
+
* <TasklistIcon aria-label="Gjøremål ikon" />
|
|
73
|
+
* </Header.MenuIcon>
|
|
74
|
+
* <span>Gjøremål</span>
|
|
75
|
+
* <Header.MenuBadge color="info">19</Header.MenuBadge>
|
|
76
|
+
* </Link>
|
|
77
|
+
* </Header.MenuRow>
|
|
50
78
|
* <Divider />
|
|
51
|
-
* <
|
|
79
|
+
* <div style={{ padding: "var(--ds-size-2) var(--ds-size-4)" }}>
|
|
80
|
+
* <Switch label="Mørk modus" position="end" />
|
|
81
|
+
* </div>
|
|
52
82
|
* </Header.Menu>
|
|
53
83
|
* </Header>
|
|
54
84
|
* ```
|
|
@@ -59,12 +89,16 @@ declare const Header: typeof HeaderParent & {
|
|
|
59
89
|
Logo: typeof HeaderLogo;
|
|
60
90
|
Navbar: typeof HeaderNavbar;
|
|
61
91
|
Menu: typeof HeaderMenu;
|
|
92
|
+
MenuRow: typeof HeaderMenuRow;
|
|
93
|
+
MenuIcon: typeof HeaderMenuIcon;
|
|
94
|
+
MenuBadge: typeof HeaderMenuBadge;
|
|
62
95
|
};
|
|
63
96
|
export type { HeaderProps } from './header';
|
|
64
97
|
export { HeaderContext } from './headerContext';
|
|
65
98
|
export type { HeaderIllustrationProps } from './headerIllustration';
|
|
66
99
|
export type { HeaderLogoProps } from './headerLogo';
|
|
67
100
|
export type { HeaderMenuProps } from './headerMenu';
|
|
101
|
+
export type { HeaderMenuBadgeProps, HeaderMenuIconProps, HeaderMenuRowProps, } from './headerMenuRow';
|
|
68
102
|
export type { HeaderNavbarProps } from './headerNavbar';
|
|
69
103
|
export type { HeaderTitleProps } from './headerTitle';
|
|
70
|
-
export { Header, HeaderIllustration, HeaderLogo, HeaderMenu, HeaderNavbar, HeaderTitle, };
|
|
104
|
+
export { Header, HeaderIllustration, HeaderLogo, HeaderMenu, HeaderMenuBadge, HeaderMenuIcon, HeaderMenuRow, HeaderNavbar, HeaderTitle, };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arbeidstilsynet/design-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "React implementation of Designsystemet",
|
|
5
5
|
"author": "Arbeidstilsynet",
|
|
6
6
|
"repository": {
|
|
@@ -30,41 +30,41 @@
|
|
|
30
30
|
"react-dom": "^19.1.0"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@digdir/designsystemet-react": "1.11.
|
|
34
|
-
"@digdir/designsystemet-types": "1.11.
|
|
35
|
-
"@navikt/aksel-icons": "^
|
|
33
|
+
"@digdir/designsystemet-react": "1.11.1",
|
|
34
|
+
"@digdir/designsystemet-types": "1.11.1",
|
|
35
|
+
"@navikt/aksel-icons": "^8.3.0",
|
|
36
36
|
"@radix-ui/react-slot": "^1.2.4",
|
|
37
37
|
"clsx": "^2.1.1",
|
|
38
|
-
"react-dropzone": "^14.
|
|
38
|
+
"react-dropzone": "^14.4.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@eslint/js": "9.39.2",
|
|
42
|
-
"@storybook/addon-docs": "10.2.
|
|
43
|
-
"@storybook/addon-vitest": "10.2.
|
|
44
|
-
"@storybook/react-vite": "10.2.
|
|
42
|
+
"@storybook/addon-docs": "10.2.7",
|
|
43
|
+
"@storybook/addon-vitest": "10.2.7",
|
|
44
|
+
"@storybook/react-vite": "10.2.7",
|
|
45
45
|
"@testing-library/dom": "10.4.1",
|
|
46
46
|
"@testing-library/jest-dom": "6.9.1",
|
|
47
47
|
"@testing-library/react": "16.3.2",
|
|
48
48
|
"@testing-library/user-event": "14.6.1",
|
|
49
49
|
"@types/eslint-plugin-jsx-a11y": "6.10.1",
|
|
50
|
-
"@types/node": "24.10.
|
|
51
|
-
"@types/react": "19.2.
|
|
50
|
+
"@types/node": "24.10.12",
|
|
51
|
+
"@types/react": "19.2.13",
|
|
52
52
|
"@types/react-dom": "19.2.3",
|
|
53
|
-
"@vitejs/plugin-react": "5.1.
|
|
53
|
+
"@vitejs/plugin-react": "5.1.3",
|
|
54
54
|
"babel-plugin-react-compiler": "1.0.0",
|
|
55
55
|
"eslint": "9.39.2",
|
|
56
56
|
"eslint-config-prettier": "10.1.8",
|
|
57
57
|
"eslint-plugin-jsx-a11y": "6.10.2",
|
|
58
58
|
"eslint-plugin-react-hooks": "7.0.1",
|
|
59
|
-
"eslint-plugin-storybook": "10.2.
|
|
60
|
-
"jsdom": "
|
|
61
|
-
"react": "19.2.
|
|
62
|
-
"react-dom": "19.2.
|
|
59
|
+
"eslint-plugin-storybook": "10.2.7",
|
|
60
|
+
"jsdom": "28.0.0",
|
|
61
|
+
"react": "19.2.4",
|
|
62
|
+
"react-dom": "19.2.4",
|
|
63
63
|
"typescript": "5.9.3",
|
|
64
|
-
"typescript-eslint": "8.
|
|
64
|
+
"typescript-eslint": "8.54.0",
|
|
65
65
|
"vite": "7.3.1",
|
|
66
66
|
"vite-plugin-dts": "4.5.4",
|
|
67
|
-
"@arbeidstilsynet/design-css": "0.
|
|
67
|
+
"@arbeidstilsynet/design-css": "0.7.1"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
70
|
"build": "vite build",
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
interface HeaderStoriesIllustrationProps extends React.SVGProps<SVGSVGElement> {
|
|
2
|
-
width?: number;
|
|
3
|
-
height?: number;
|
|
4
|
-
}
|
|
5
|
-
export declare function HeaderStoriesIllustration({ width, height, }: Readonly<HeaderStoriesIllustrationProps>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
-
export {};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
interface MenuLinkItemProps {
|
|
3
|
-
icon: ReactNode;
|
|
4
|
-
href: string;
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
badge?: number;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Example menu item with icon and link.
|
|
10
|
-
* This is a story-only component to demonstrate how consumers
|
|
11
|
-
* can build their own custom menu items.
|
|
12
|
-
*
|
|
13
|
-
* @internal - Not exported to consumers
|
|
14
|
-
*/
|
|
15
|
-
export declare function MenuLinkItem({ icon, href, children, badge, }: Readonly<MenuLinkItemProps>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
/**
|
|
17
|
-
* Profile menu item example.
|
|
18
|
-
* @internal - Not exported to consumers
|
|
19
|
-
*/
|
|
20
|
-
export declare function ProfileMenuItem(): import("react/jsx-runtime").JSX.Element;
|
|
21
|
-
/**
|
|
22
|
-
* Inbox menu item example with badge.
|
|
23
|
-
* @internal - Not exported to consumers
|
|
24
|
-
*/
|
|
25
|
-
export declare function InboxMenuItem({ count }: Readonly<{
|
|
26
|
-
count?: number;
|
|
27
|
-
}>): import("react/jsx-runtime").JSX.Element;
|
|
28
|
-
export {};
|