rk-designsystem 1.1.1 → 1.1.3
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/LICENSE +21 -21
- package/README.md +249 -249
- package/dist/componentlibrary.es.js +42 -42
- package/dist/componentlibrary.umd.js +2 -2
- package/dist/index.d.ts +5 -0
- package/dist/logo-red-cross.svg +11 -0
- package/dist/rk-designsystem.css +1 -1
- package/package.json +8 -7
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 danieltunetek
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 danieltunetek
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,249 +1,249 @@
|
|
|
1
|
-
# Røde Kors Design System Component Library (Norwegian Red Cross)
|
|
2
|
-
|
|
3
|
-
## Live Storybook URL
|
|
4
|
-
|
|
5
|
-
[https://norwegianredcross.github.io/DesignSystem/storybook/](https://norwegianredcross.github.io/DesignSystem/storybook/)
|
|
6
|
-
|
|
7
|
-
## Overview
|
|
8
|
-
|
|
9
|
-
Welcome to the Røde Kors Design System! This repository contains a library of reusable UI components built with React, specifically tailored for Norwegian Red Cross digital projects.
|
|
10
|
-
|
|
11
|
-
It's developed leveraging the foundational components from Digdir's Designsystemet. This approach ensures a unified and recognizable visual identity across all applications for the Norwegian Red Cross. The system is pre-configured with the official Røde Kors brand theme, which is provided via a dedicated design token package.
|
|
12
|
-
|
|
13
|
-
The primary goal is to ensure brand consistency, improve development efficiency, and maintain high accessibility standards across all Røde Kors applications.
|
|
14
|
-
|
|
15
|
-
Storybook serves as the interactive documentation and development environment for viewing and testing these components.
|
|
16
|
-
|
|
17
|
-
## Consuming This Library (For Application Developers)
|
|
18
|
-
|
|
19
|
-
To use the Røde Kors Design System in your Next.js (or any React) application:
|
|
20
|
-
|
|
21
|
-
### 1. Installation
|
|
22
|
-
|
|
23
|
-
Install the necessary npm packages for your project. You will need three packages: the component library itself (`rk-designsystem`), the base styles from Digdir, and the Røde Kors theme package (`rk-design-tokens`).
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
# npm
|
|
27
|
-
npm install rk-designsystem @digdir/designsystemet-css rk-design-tokens
|
|
28
|
-
|
|
29
|
-
# yarn
|
|
30
|
-
yarn add rk-designsystem @digdir/designsystemet-css rk-design-tokens
|
|
31
|
-
|
|
32
|
-
# pnpm
|
|
33
|
-
pnpm add rk-designsystem @digdir/designsystemet-css rk-design-tokens
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
**Note:** You do not need to install `@digdir/designsystemet-react` separately, as all required components are included within the `rk-designsystem` package.
|
|
37
|
-
|
|
38
|
-
### 2. Including Styles (CSS)
|
|
39
|
-
|
|
40
|
-
For the components to be styled correctly, you must import the stylesheets at the highest level of your application, for instance, in your `layout.tsx` (for Next.js App Router) or `_app.tsx` (for Next.js Pages Router).
|
|
41
|
-
|
|
42
|
-
**Crucial Order:** It's vital that the base stylesheet (`@digdir/designsystemet-css`) is loaded **before** the Røde Kors theme file (`rk-design-tokens`). This ensures our theme's tokens can correctly override the default values.
|
|
43
|
-
|
|
44
|
-
#### Example for Next.js (App Router - `src/app/layout.tsx`):
|
|
45
|
-
|
|
46
|
-
```tsx
|
|
47
|
-
import './globals.css'; // Your own global styles (if any)
|
|
48
|
-
import '@digdir/designsystemet-css/index.css'; // Base stylesheet for components
|
|
49
|
-
import 'rk-design-tokens/design-tokens-build/theme.css'; // Røde Kors theme
|
|
50
|
-
|
|
51
|
-
export default function RootLayout({
|
|
52
|
-
children,
|
|
53
|
-
}: {
|
|
54
|
-
children: React.ReactNode;
|
|
55
|
-
}) {
|
|
56
|
-
return (
|
|
57
|
-
<html lang="en">
|
|
58
|
-
<body>{children}</body>
|
|
59
|
-
</html>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
#### Example for Next.js (Pages Router - `pages/_app.tsx`):
|
|
65
|
-
|
|
66
|
-
```tsx
|
|
67
|
-
import '../styles/globals.css'; // Your own global styles (if any)
|
|
68
|
-
import '@digdir/designsystemet-css/index.css'; // Base stylesheet for components
|
|
69
|
-
import 'rk-design-tokens/design-tokens-build/theme.css'; // Røde Kors theme
|
|
70
|
-
import type { AppProps } from 'next/app';
|
|
71
|
-
|
|
72
|
-
function MyApp({ Component, pageProps }: AppProps) {
|
|
73
|
-
return <Component {...pageProps} />;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export default MyApp;
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### 3. Using Components
|
|
80
|
-
|
|
81
|
-
Once the stylesheets are included, you can start importing and using components in your project. All components you need are available directly from the `rk-designsystem` package.
|
|
82
|
-
|
|
83
|
-
#### 3.1 Import and Use Røde Kors Design System Components
|
|
84
|
-
|
|
85
|
-
Import components directly from the `rk-designsystem` package:
|
|
86
|
-
|
|
87
|
-
```tsx
|
|
88
|
-
import { Alert } from 'rk-designsystem'; // Import necessary components
|
|
89
|
-
|
|
90
|
-
function MyComponent() {
|
|
91
|
-
return (
|
|
92
|
-
<>
|
|
93
|
-
<Alert variant="info" onClose={() => console.log('Alert closed!')}>
|
|
94
|
-
This is an informational message from the Red Cross Design System.
|
|
95
|
-
</Alert>
|
|
96
|
-
</>
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
#### 3.2 Example Usage in a Next.js Page
|
|
102
|
-
|
|
103
|
-
Here's an example of how to use multiple Alert components from the Røde Kors Design System within a Next.js page/component:
|
|
104
|
-
|
|
105
|
-
```tsx
|
|
106
|
-
'use client'; // Remember 'use client' for interactive components in App Router
|
|
107
|
-
|
|
108
|
-
import React from 'react';
|
|
109
|
-
import { Alert } from 'rk-designsystem'; // Import the components you need
|
|
110
|
-
|
|
111
|
-
export default function Home() {
|
|
112
|
-
return (
|
|
113
|
-
<div className="container mx-auto p-8">
|
|
114
|
-
<h1 className="text-3xl font-bold mb-8">
|
|
115
|
-
Røde Kors Design System Example
|
|
116
|
-
</h1>
|
|
117
|
-
|
|
118
|
-
<section>
|
|
119
|
-
<h2 className="text-2xl font-semibold mb-4">Alerts</h2>
|
|
120
|
-
{/* Røde Kors Design System Alerts */}
|
|
121
|
-
<Alert variant="success">
|
|
122
|
-
<p>
|
|
123
|
-
Welcome! This message is styled with the official Røde Kors theme.
|
|
124
|
-
</p>
|
|
125
|
-
</Alert>
|
|
126
|
-
|
|
127
|
-
<Alert variant="warning" className="mt-4">
|
|
128
|
-
<p>
|
|
129
|
-
Important information using the official Røde Kors theme.
|
|
130
|
-
</p>
|
|
131
|
-
</Alert>
|
|
132
|
-
</section>
|
|
133
|
-
|
|
134
|
-
{/* More Røde Kors components can be added here as needed */}
|
|
135
|
-
</div>
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
The appearance of all components is fully controlled by the `rk-design-tokens` package. To receive any visual updates to the brand theme (like a new primary color), simply update the package to its latest version:
|
|
141
|
-
|
|
142
|
-
```bash
|
|
143
|
-
npm update rk-design-tokens
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
---
|
|
147
|
-
|
|
148
|
-
# Contributing to the Component Library
|
|
149
|
-
|
|
150
|
-
This guide provides a set of standards and best practices for creating new components. Following these guidelines ensures that our component library remains consistent, accessible, and easy to maintain.
|
|
151
|
-
|
|
152
|
-
## Getting Started (for Contributors)
|
|
153
|
-
|
|
154
|
-
Follow these steps to get the local development environment running. All commands should be run from the root of the project.
|
|
155
|
-
|
|
156
|
-
```bash
|
|
157
|
-
# 1. Install dependencies
|
|
158
|
-
pnpm i
|
|
159
|
-
|
|
160
|
-
# 2. Build all packages
|
|
161
|
-
pnpm build
|
|
162
|
-
|
|
163
|
-
# 3. Start the local Storybook server
|
|
164
|
-
pnpm storybook
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
## Core Principles
|
|
168
|
-
|
|
169
|
-
Every component we build should adhere to these core principles:
|
|
170
|
-
|
|
171
|
-
1. **Accessibility (A11y):** Components must be usable by everyone, including people with disabilities. This means proper ARIA attributes, keyboard navigation, and semantic HTML.
|
|
172
|
-
2. **Reusability:** Components should be generic enough to be used in multiple contexts without modification.
|
|
173
|
-
3. **Consistency:** Components should follow our established design tokens (colors, spacing, typography) and have a consistent API and structure.
|
|
174
|
-
4. **Documentation:** Every component must be documented in Storybook to make it discoverable and easy for other developers to use.
|
|
175
|
-
|
|
176
|
-
## When to Create a New Component
|
|
177
|
-
|
|
178
|
-
Before you start coding, determine what kind of component you need. Most of our needs fall into one of three categories:
|
|
179
|
-
|
|
180
|
-
1. **Wrapped Component (Simple):**
|
|
181
|
-
* **What it is:** A component that directly wraps and re-exports a component from `@digdir/designsystemet-react` with no modifications.
|
|
182
|
-
* **When to use:** When the base Digdir component meets our needs perfectly, but we want to include it in our own library for a consistent import source.
|
|
183
|
-
* **Example:** The `Buttons` component is a perfect example of this.
|
|
184
|
-
|
|
185
|
-
2. **Wrapped Component (with Style Overrides):**
|
|
186
|
-
* **What it is:** A wrapped Digdir component where we apply custom CSS to tweak its appearance to better match Røde Kors's specific design language.
|
|
187
|
-
* **When to use:** When a Digdir component is functionally correct but needs visual adjustments (e.g., different icons, border radius, padding).
|
|
188
|
-
* **Example:** The `Alert` component, which uses `composes` in its CSS to inherit base styles and then applies its own overrides.
|
|
189
|
-
|
|
190
|
-
3. **Custom Component (from Scratch):**
|
|
191
|
-
* **What it is:** A completely new component built when no existing Digdir component meets our requirements.
|
|
192
|
-
* **When to use:** For unique UI patterns or functionality not covered by the base library.
|
|
193
|
-
* **Example:** The `DateInput` component is a custom component with its own state, logic, and styling.
|
|
194
|
-
|
|
195
|
-
## Component File Structure
|
|
196
|
-
|
|
197
|
-
To maintain consistency, every new component should follow this file structure. Create a new folder under `src/components/` with the component's `PascalCase` name.
|
|
198
|
-
|
|
199
|
-
```text
|
|
200
|
-
src/
|
|
201
|
-
└── components/
|
|
202
|
-
└── MyNewComponent/
|
|
203
|
-
├── index.ts // Public API - exports the component and props
|
|
204
|
-
├── MyNewComponent.tsx // The React component logic and JSX
|
|
205
|
-
├── MyNewComponent.stories.tsx // Storybook stories for documentation
|
|
206
|
-
├── styles.module.css // Scoped CSS (only for custom components)
|
|
207
|
-
└── MyNewComponent.test.tsx // (Optional but Recommended) Unit tests
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
## Coding Guidelines
|
|
211
|
-
|
|
212
|
-
### 1. Component Logic (`MyNewComponent.tsx`)
|
|
213
|
-
|
|
214
|
-
* **TypeScript First:** All components must be written in TypeScript. Define a `Props` interface for your component, extending from the base HTML element or Digdir component props if applicable.
|
|
215
|
-
* **Forward Refs:** Always use `React.forwardRef` to allow parent components to get a `ref` to the underlying DOM element.
|
|
216
|
-
* **Accessibility is Mandatory:**
|
|
217
|
-
* Use semantic HTML (`<button>`, `<label>`, `<nav>`).
|
|
218
|
-
* Ensure all interactive elements are keyboard-focusable and operable.
|
|
219
|
-
* Provide `aria-label` for icon-only buttons or elements where the text label is not visible.
|
|
220
|
-
* Use `aria-invalid`, `aria-describedby`, etc., to communicate state to assistive technologies.
|
|
221
|
-
* **Controlled vs. Uncontrolled:** If your component has state (like an input), it should support both controlled (`value` + `onChange`) and uncontrolled (`defaultValue`) patterns.
|
|
222
|
-
* **Props Naming:** Use `data-*` attributes for styling variants (e.g., `data-size`, `data-color`) to align with the patterns in our existing components.
|
|
223
|
-
|
|
224
|
-
### 2. Styling (`styles.module.css`)
|
|
225
|
-
|
|
226
|
-
* **CSS Modules:** For **custom components**, all styles must be placed in a `styles.module.css` file. This scopes class names locally and prevents global style conflicts.
|
|
227
|
-
* **Design Tokens:** Always use our design system tokens (`var(--ds-...)`) for colors, spacing, fonts, etc. Do not use hardcoded values (e.g., `#FFF`, `16px`).
|
|
228
|
-
* **Overriding Wrapped Components:** For **wrapped components**, use a standard CSS file. Use the `@layer` and `composes` keywords to extend base Digdir styles without increasing CSS specificity unnecessarily.
|
|
229
|
-
|
|
230
|
-
### 3. Documentation (`MyNewComponent.stories.tsx`)
|
|
231
|
-
|
|
232
|
-
Your Storybook file is the official documentation. It must be clear and comprehensive.
|
|
233
|
-
|
|
234
|
-
* **`meta` Object:** Define the component's title, component reference, and `tags: ['autodocs']` to enable automatic documentation.
|
|
235
|
-
* **`argTypes`:** Document every single prop. Provide a `description`, `control` type (e.g., `select`, `boolean`, `text`), and `options` if applicable. This powers the interactive controls in Storybook.
|
|
236
|
-
* **Create Multiple Stories:** Create a separate story for each key state and variant of your component (e.g., `Default`, `Disabled`, `WithError`, `WithIcon`).
|
|
237
|
-
|
|
238
|
-
## Contribution Process
|
|
239
|
-
|
|
240
|
-
### 1. Create a Pull Request (PR)
|
|
241
|
-
|
|
242
|
-
1. **Create a Branch:** Pull the latest changes from the `main` branch and create a new feature branch: `git checkout -b feat/my-new-component`.
|
|
243
|
-
|
|
244
|
-
2. **Open a Draft PR:** As soon as you start, open a **draft** pull request on GitHub. This prevents duplicate work and allows others to see what you're working on.
|
|
245
|
-
|
|
246
|
-
3. **Commit Your Changes:** As you work, make small, logical commits.
|
|
247
|
-
|
|
248
|
-
4. **Ready for Review:** When development is complete and all automated checks are passing, mark the PR as "Ready for review" and request a review from the design system maintainers.
|
|
249
|
-
|
|
1
|
+
# Røde Kors Design System Component Library (Norwegian Red Cross)
|
|
2
|
+
|
|
3
|
+
## Live Storybook URL
|
|
4
|
+
|
|
5
|
+
[https://norwegianredcross.github.io/DesignSystem/storybook/](https://norwegianredcross.github.io/DesignSystem/storybook/)
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
Welcome to the Røde Kors Design System! This repository contains a library of reusable UI components built with React, specifically tailored for Norwegian Red Cross digital projects.
|
|
10
|
+
|
|
11
|
+
It's developed leveraging the foundational components from Digdir's Designsystemet. This approach ensures a unified and recognizable visual identity across all applications for the Norwegian Red Cross. The system is pre-configured with the official Røde Kors brand theme, which is provided via a dedicated design token package.
|
|
12
|
+
|
|
13
|
+
The primary goal is to ensure brand consistency, improve development efficiency, and maintain high accessibility standards across all Røde Kors applications.
|
|
14
|
+
|
|
15
|
+
Storybook serves as the interactive documentation and development environment for viewing and testing these components.
|
|
16
|
+
|
|
17
|
+
## Consuming This Library (For Application Developers)
|
|
18
|
+
|
|
19
|
+
To use the Røde Kors Design System in your Next.js (or any React) application:
|
|
20
|
+
|
|
21
|
+
### 1. Installation
|
|
22
|
+
|
|
23
|
+
Install the necessary npm packages for your project. You will need three packages: the component library itself (`rk-designsystem`), the base styles from Digdir, and the Røde Kors theme package (`rk-design-tokens`).
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# npm
|
|
27
|
+
npm install rk-designsystem @digdir/designsystemet-css rk-design-tokens
|
|
28
|
+
|
|
29
|
+
# yarn
|
|
30
|
+
yarn add rk-designsystem @digdir/designsystemet-css rk-design-tokens
|
|
31
|
+
|
|
32
|
+
# pnpm
|
|
33
|
+
pnpm add rk-designsystem @digdir/designsystemet-css rk-design-tokens
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Note:** You do not need to install `@digdir/designsystemet-react` separately, as all required components are included within the `rk-designsystem` package.
|
|
37
|
+
|
|
38
|
+
### 2. Including Styles (CSS)
|
|
39
|
+
|
|
40
|
+
For the components to be styled correctly, you must import the stylesheets at the highest level of your application, for instance, in your `layout.tsx` (for Next.js App Router) or `_app.tsx` (for Next.js Pages Router).
|
|
41
|
+
|
|
42
|
+
**Crucial Order:** It's vital that the base stylesheet (`@digdir/designsystemet-css`) is loaded **before** the Røde Kors theme file (`rk-design-tokens`). This ensures our theme's tokens can correctly override the default values.
|
|
43
|
+
|
|
44
|
+
#### Example for Next.js (App Router - `src/app/layout.tsx`):
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
import './globals.css'; // Your own global styles (if any)
|
|
48
|
+
import '@digdir/designsystemet-css/index.css'; // Base stylesheet for components
|
|
49
|
+
import 'rk-design-tokens/design-tokens-build/theme.css'; // Røde Kors theme
|
|
50
|
+
|
|
51
|
+
export default function RootLayout({
|
|
52
|
+
children,
|
|
53
|
+
}: {
|
|
54
|
+
children: React.ReactNode;
|
|
55
|
+
}) {
|
|
56
|
+
return (
|
|
57
|
+
<html lang="en">
|
|
58
|
+
<body>{children}</body>
|
|
59
|
+
</html>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
#### Example for Next.js (Pages Router - `pages/_app.tsx`):
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
import '../styles/globals.css'; // Your own global styles (if any)
|
|
68
|
+
import '@digdir/designsystemet-css/index.css'; // Base stylesheet for components
|
|
69
|
+
import 'rk-design-tokens/design-tokens-build/theme.css'; // Røde Kors theme
|
|
70
|
+
import type { AppProps } from 'next/app';
|
|
71
|
+
|
|
72
|
+
function MyApp({ Component, pageProps }: AppProps) {
|
|
73
|
+
return <Component {...pageProps} />;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export default MyApp;
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### 3. Using Components
|
|
80
|
+
|
|
81
|
+
Once the stylesheets are included, you can start importing and using components in your project. All components you need are available directly from the `rk-designsystem` package.
|
|
82
|
+
|
|
83
|
+
#### 3.1 Import and Use Røde Kors Design System Components
|
|
84
|
+
|
|
85
|
+
Import components directly from the `rk-designsystem` package:
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
import { Alert } from 'rk-designsystem'; // Import necessary components
|
|
89
|
+
|
|
90
|
+
function MyComponent() {
|
|
91
|
+
return (
|
|
92
|
+
<>
|
|
93
|
+
<Alert variant="info" onClose={() => console.log('Alert closed!')}>
|
|
94
|
+
This is an informational message from the Red Cross Design System.
|
|
95
|
+
</Alert>
|
|
96
|
+
</>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
#### 3.2 Example Usage in a Next.js Page
|
|
102
|
+
|
|
103
|
+
Here's an example of how to use multiple Alert components from the Røde Kors Design System within a Next.js page/component:
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
'use client'; // Remember 'use client' for interactive components in App Router
|
|
107
|
+
|
|
108
|
+
import React from 'react';
|
|
109
|
+
import { Alert } from 'rk-designsystem'; // Import the components you need
|
|
110
|
+
|
|
111
|
+
export default function Home() {
|
|
112
|
+
return (
|
|
113
|
+
<div className="container mx-auto p-8">
|
|
114
|
+
<h1 className="text-3xl font-bold mb-8">
|
|
115
|
+
Røde Kors Design System Example
|
|
116
|
+
</h1>
|
|
117
|
+
|
|
118
|
+
<section>
|
|
119
|
+
<h2 className="text-2xl font-semibold mb-4">Alerts</h2>
|
|
120
|
+
{/* Røde Kors Design System Alerts */}
|
|
121
|
+
<Alert variant="success">
|
|
122
|
+
<p>
|
|
123
|
+
Welcome! This message is styled with the official Røde Kors theme.
|
|
124
|
+
</p>
|
|
125
|
+
</Alert>
|
|
126
|
+
|
|
127
|
+
<Alert variant="warning" className="mt-4">
|
|
128
|
+
<p>
|
|
129
|
+
Important information using the official Røde Kors theme.
|
|
130
|
+
</p>
|
|
131
|
+
</Alert>
|
|
132
|
+
</section>
|
|
133
|
+
|
|
134
|
+
{/* More Røde Kors components can be added here as needed */}
|
|
135
|
+
</div>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
The appearance of all components is fully controlled by the `rk-design-tokens` package. To receive any visual updates to the brand theme (like a new primary color), simply update the package to its latest version:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
npm update rk-design-tokens
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
# Contributing to the Component Library
|
|
149
|
+
|
|
150
|
+
This guide provides a set of standards and best practices for creating new components. Following these guidelines ensures that our component library remains consistent, accessible, and easy to maintain.
|
|
151
|
+
|
|
152
|
+
## Getting Started (for Contributors)
|
|
153
|
+
|
|
154
|
+
Follow these steps to get the local development environment running. All commands should be run from the root of the project.
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
# 1. Install dependencies
|
|
158
|
+
pnpm i
|
|
159
|
+
|
|
160
|
+
# 2. Build all packages
|
|
161
|
+
pnpm build
|
|
162
|
+
|
|
163
|
+
# 3. Start the local Storybook server
|
|
164
|
+
pnpm storybook
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Core Principles
|
|
168
|
+
|
|
169
|
+
Every component we build should adhere to these core principles:
|
|
170
|
+
|
|
171
|
+
1. **Accessibility (A11y):** Components must be usable by everyone, including people with disabilities. This means proper ARIA attributes, keyboard navigation, and semantic HTML.
|
|
172
|
+
2. **Reusability:** Components should be generic enough to be used in multiple contexts without modification.
|
|
173
|
+
3. **Consistency:** Components should follow our established design tokens (colors, spacing, typography) and have a consistent API and structure.
|
|
174
|
+
4. **Documentation:** Every component must be documented in Storybook to make it discoverable and easy for other developers to use.
|
|
175
|
+
|
|
176
|
+
## When to Create a New Component
|
|
177
|
+
|
|
178
|
+
Before you start coding, determine what kind of component you need. Most of our needs fall into one of three categories:
|
|
179
|
+
|
|
180
|
+
1. **Wrapped Component (Simple):**
|
|
181
|
+
* **What it is:** A component that directly wraps and re-exports a component from `@digdir/designsystemet-react` with no modifications.
|
|
182
|
+
* **When to use:** When the base Digdir component meets our needs perfectly, but we want to include it in our own library for a consistent import source.
|
|
183
|
+
* **Example:** The `Buttons` component is a perfect example of this.
|
|
184
|
+
|
|
185
|
+
2. **Wrapped Component (with Style Overrides):**
|
|
186
|
+
* **What it is:** A wrapped Digdir component where we apply custom CSS to tweak its appearance to better match Røde Kors's specific design language.
|
|
187
|
+
* **When to use:** When a Digdir component is functionally correct but needs visual adjustments (e.g., different icons, border radius, padding).
|
|
188
|
+
* **Example:** The `Alert` component, which uses `composes` in its CSS to inherit base styles and then applies its own overrides.
|
|
189
|
+
|
|
190
|
+
3. **Custom Component (from Scratch):**
|
|
191
|
+
* **What it is:** A completely new component built when no existing Digdir component meets our requirements.
|
|
192
|
+
* **When to use:** For unique UI patterns or functionality not covered by the base library.
|
|
193
|
+
* **Example:** The `DateInput` component is a custom component with its own state, logic, and styling.
|
|
194
|
+
|
|
195
|
+
## Component File Structure
|
|
196
|
+
|
|
197
|
+
To maintain consistency, every new component should follow this file structure. Create a new folder under `src/components/` with the component's `PascalCase` name.
|
|
198
|
+
|
|
199
|
+
```text
|
|
200
|
+
src/
|
|
201
|
+
└── components/
|
|
202
|
+
└── MyNewComponent/
|
|
203
|
+
├── index.ts // Public API - exports the component and props
|
|
204
|
+
├── MyNewComponent.tsx // The React component logic and JSX
|
|
205
|
+
├── MyNewComponent.stories.tsx // Storybook stories for documentation
|
|
206
|
+
├── styles.module.css // Scoped CSS (only for custom components)
|
|
207
|
+
└── MyNewComponent.test.tsx // (Optional but Recommended) Unit tests
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Coding Guidelines
|
|
211
|
+
|
|
212
|
+
### 1. Component Logic (`MyNewComponent.tsx`)
|
|
213
|
+
|
|
214
|
+
* **TypeScript First:** All components must be written in TypeScript. Define a `Props` interface for your component, extending from the base HTML element or Digdir component props if applicable.
|
|
215
|
+
* **Forward Refs:** Always use `React.forwardRef` to allow parent components to get a `ref` to the underlying DOM element.
|
|
216
|
+
* **Accessibility is Mandatory:**
|
|
217
|
+
* Use semantic HTML (`<button>`, `<label>`, `<nav>`).
|
|
218
|
+
* Ensure all interactive elements are keyboard-focusable and operable.
|
|
219
|
+
* Provide `aria-label` for icon-only buttons or elements where the text label is not visible.
|
|
220
|
+
* Use `aria-invalid`, `aria-describedby`, etc., to communicate state to assistive technologies.
|
|
221
|
+
* **Controlled vs. Uncontrolled:** If your component has state (like an input), it should support both controlled (`value` + `onChange`) and uncontrolled (`defaultValue`) patterns.
|
|
222
|
+
* **Props Naming:** Use `data-*` attributes for styling variants (e.g., `data-size`, `data-color`) to align with the patterns in our existing components.
|
|
223
|
+
|
|
224
|
+
### 2. Styling (`styles.module.css`)
|
|
225
|
+
|
|
226
|
+
* **CSS Modules:** For **custom components**, all styles must be placed in a `styles.module.css` file. This scopes class names locally and prevents global style conflicts.
|
|
227
|
+
* **Design Tokens:** Always use our design system tokens (`var(--ds-...)`) for colors, spacing, fonts, etc. Do not use hardcoded values (e.g., `#FFF`, `16px`).
|
|
228
|
+
* **Overriding Wrapped Components:** For **wrapped components**, use a standard CSS file. Use the `@layer` and `composes` keywords to extend base Digdir styles without increasing CSS specificity unnecessarily.
|
|
229
|
+
|
|
230
|
+
### 3. Documentation (`MyNewComponent.stories.tsx`)
|
|
231
|
+
|
|
232
|
+
Your Storybook file is the official documentation. It must be clear and comprehensive.
|
|
233
|
+
|
|
234
|
+
* **`meta` Object:** Define the component's title, component reference, and `tags: ['autodocs']` to enable automatic documentation.
|
|
235
|
+
* **`argTypes`:** Document every single prop. Provide a `description`, `control` type (e.g., `select`, `boolean`, `text`), and `options` if applicable. This powers the interactive controls in Storybook.
|
|
236
|
+
* **Create Multiple Stories:** Create a separate story for each key state and variant of your component (e.g., `Default`, `Disabled`, `WithError`, `WithIcon`).
|
|
237
|
+
|
|
238
|
+
## Contribution Process
|
|
239
|
+
|
|
240
|
+
### 1. Create a Pull Request (PR)
|
|
241
|
+
|
|
242
|
+
1. **Create a Branch:** Pull the latest changes from the `main` branch and create a new feature branch: `git checkout -b feat/my-new-component`.
|
|
243
|
+
|
|
244
|
+
2. **Open a Draft PR:** As soon as you start, open a **draft** pull request on GitHub. This prevents duplicate work and allows others to see what you're working on.
|
|
245
|
+
|
|
246
|
+
3. **Commit Your Changes:** As you work, make small, logical commits.
|
|
247
|
+
|
|
248
|
+
4. **Ready for Review:** When development is complete and all automated checks are passing, mark the PR as "Ready for review" and request a review from the design system maintainers.
|
|
249
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import ye, { forwardRef as ie, useState as _e, useEffect as
|
|
2
|
-
import { Alert as Ne, Avatar as Se, Badge as $e, BadgePosition as De, Breadcrumbs as Me, BreadcrumbsList as Ae, BreadcrumbsItem as Oe, BreadcrumbsLink as We, Button as de, Card as Be, CardBlock as Ie, Checkbox as Fe, Fieldset as
|
|
3
|
-
import { startOfMonth as F, isValid as ce, isSameMonth as me, startOfWeek as
|
|
1
|
+
import ye, { forwardRef as ie, useState as _e, useEffect as we, useMemo as oe, useCallback as Y, useRef as Te } from "react";
|
|
2
|
+
import { Alert as Ne, Avatar as Se, Badge as $e, BadgePosition as De, Breadcrumbs as Me, BreadcrumbsList as Ae, BreadcrumbsItem as Oe, BreadcrumbsLink as We, Button as de, Card as Be, CardBlock as Ie, Checkbox as Fe, Fieldset as Ce, useCheckboxGroup as Le, Chip as Ye, Details as Ve, Dialog as He, Divider as ze, Dropdown as Ge, ErrorSummary as qe, FieldDescription as Ke, FieldCounter as Xe, Field as Je, Input as Ue, Link as Qe, List as Ze, Pagination as et, usePagination as tt, Popover as rt, Radio as at, useRadioGroup as nt, Search as ot, Select as st, Skeleton as it, SkipLink as lt, Spinner as ct, Switch as ut, Table as dt, Tabs as mt, Tag as ft, Textarea as ht, Textfield as pt, ToggleGroup as bt, Tooltip as vt } from "@digdir/designsystemet-react";
|
|
3
|
+
import { startOfMonth as F, isValid as ce, isSameMonth as me, startOfWeek as xe, format as K, addDays as Pe, subMonths as gt, addMonths as kt, isSameDay as yt, isToday as _t, eachDayOfInterval as wt } from "date-fns";
|
|
4
4
|
var se = { exports: {} }, X = {};
|
|
5
5
|
/**
|
|
6
6
|
* @license React
|
|
@@ -12,7 +12,7 @@ var se = { exports: {} }, X = {};
|
|
|
12
12
|
* LICENSE file in the root directory of this source tree.
|
|
13
13
|
*/
|
|
14
14
|
var fe;
|
|
15
|
-
function
|
|
15
|
+
function Ct() {
|
|
16
16
|
if (fe) return X;
|
|
17
17
|
fe = 1;
|
|
18
18
|
var e = Symbol.for("react.transitional.element"), a = Symbol.for("react.fragment");
|
|
@@ -44,7 +44,7 @@ var J = {};
|
|
|
44
44
|
* LICENSE file in the root directory of this source tree.
|
|
45
45
|
*/
|
|
46
46
|
var he;
|
|
47
|
-
function
|
|
47
|
+
function xt() {
|
|
48
48
|
return he || (he = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
49
49
|
function e(t) {
|
|
50
50
|
if (t == null) return null;
|
|
@@ -154,7 +154,7 @@ function wt() {
|
|
|
154
154
|
}
|
|
155
155
|
function _(t, n, c, f, h, b, A, G) {
|
|
156
156
|
return c = b.ref, t = {
|
|
157
|
-
$$typeof:
|
|
157
|
+
$$typeof: C,
|
|
158
158
|
type: t,
|
|
159
159
|
key: n,
|
|
160
160
|
props: b,
|
|
@@ -184,7 +184,7 @@ function wt() {
|
|
|
184
184
|
value: G
|
|
185
185
|
}), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
|
|
186
186
|
}
|
|
187
|
-
function
|
|
187
|
+
function w(t, n, c, f, h, b, A, G) {
|
|
188
188
|
var p = n.children;
|
|
189
189
|
if (p !== void 0)
|
|
190
190
|
if (f)
|
|
@@ -217,8 +217,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
217
217
|
}
|
|
218
218
|
if (p = null, c !== void 0 && (r(c), p = "" + c), u(n) && (r(n.key), p = "" + n.key), "key" in n) {
|
|
219
219
|
c = {};
|
|
220
|
-
for (var
|
|
221
|
-
|
|
220
|
+
for (var x in n)
|
|
221
|
+
x !== "key" && (c[x] = n[x]);
|
|
222
222
|
} else c = n;
|
|
223
223
|
return p && m(
|
|
224
224
|
c,
|
|
@@ -235,9 +235,9 @@ React keys must be passed directly to JSX without using spread:
|
|
|
235
235
|
);
|
|
236
236
|
}
|
|
237
237
|
function v(t) {
|
|
238
|
-
typeof t == "object" && t !== null && t.$$typeof ===
|
|
238
|
+
typeof t == "object" && t !== null && t.$$typeof === C && t._store && (t._store.validated = 1);
|
|
239
239
|
}
|
|
240
|
-
var j = ye,
|
|
240
|
+
var j = ye, C = Symbol.for("react.transitional.element"), V = Symbol.for("react.portal"), S = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), T = Symbol.for("react.profiler"), P = Symbol.for("react.consumer"), $ = Symbol.for("react.context"), H = Symbol.for("react.forward_ref"), W = Symbol.for("react.suspense"), Z = Symbol.for("react.suspense_list"), z = Symbol.for("react.memo"), N = Symbol.for("react.lazy"), le = Symbol.for("react.activity"), B = Symbol.for("react.client.reference"), g = j.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, D = Object.prototype.hasOwnProperty, M = Array.isArray, I = console.createTask ? console.createTask : function() {
|
|
241
241
|
return null;
|
|
242
242
|
};
|
|
243
243
|
j = {
|
|
@@ -251,7 +251,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
251
251
|
)(), ae = I(o(d)), ne = {};
|
|
252
252
|
J.Fragment = S, J.jsx = function(t, n, c, f, h) {
|
|
253
253
|
var b = 1e4 > g.recentlyCreatedOwnerStacks++;
|
|
254
|
-
return
|
|
254
|
+
return w(
|
|
255
255
|
t,
|
|
256
256
|
n,
|
|
257
257
|
c,
|
|
@@ -263,7 +263,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
263
263
|
);
|
|
264
264
|
}, J.jsxs = function(t, n, c, f, h) {
|
|
265
265
|
var b = 1e4 > g.recentlyCreatedOwnerStacks++;
|
|
266
|
-
return
|
|
266
|
+
return w(
|
|
267
267
|
t,
|
|
268
268
|
n,
|
|
269
269
|
c,
|
|
@@ -278,7 +278,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
278
278
|
}
|
|
279
279
|
var pe;
|
|
280
280
|
function Pt() {
|
|
281
|
-
return pe || (pe = 1, process.env.NODE_ENV === "production" ? se.exports =
|
|
281
|
+
return pe || (pe = 1, process.env.NODE_ENV === "production" ? se.exports = Ct() : se.exports = xt()), se.exports;
|
|
282
282
|
}
|
|
283
283
|
var l = Pt();
|
|
284
284
|
const Et = ie((e, a) => /* @__PURE__ */ l.jsx(Ne, { ref: a, ...e }));
|
|
@@ -291,7 +291,7 @@ const Ar = De, Or = Me, Wr = Ae, Br = Oe, Ir = We, Tt = de;
|
|
|
291
291
|
Tt.displayName = "Button";
|
|
292
292
|
const Nt = Be, Fr = Ie;
|
|
293
293
|
Nt.displayName = "Card";
|
|
294
|
-
const St = Fe, $t =
|
|
294
|
+
const St = Fe, $t = Ce, Lr = Le;
|
|
295
295
|
St.displayName = "Checkbox";
|
|
296
296
|
$t.displayName = "Fieldset";
|
|
297
297
|
const Yr = Ye;
|
|
@@ -330,8 +330,8 @@ function Q(e) {
|
|
|
330
330
|
// [TODO] -- I challenge you to fix the type
|
|
331
331
|
r.valueCallback(_)
|
|
332
332
|
) : _;
|
|
333
|
-
const
|
|
334
|
-
return { value: _, rest:
|
|
333
|
+
const w = a.slice(u.length);
|
|
334
|
+
return { value: _, rest: w };
|
|
335
335
|
};
|
|
336
336
|
}
|
|
337
337
|
function Dt(e, a) {
|
|
@@ -728,7 +728,7 @@ const Re = ({ title: e, ...a }) => /* @__PURE__ */ l.jsxs(
|
|
|
728
728
|
}
|
|
729
729
|
);
|
|
730
730
|
Re.displayName = "ChevronRightIcon";
|
|
731
|
-
const ur = "
|
|
731
|
+
const ur = "_calendarContainer_160wn_3", dr = "_calendarHeader_160wn_17", mr = "_monthYear_160wn_24", fr = "_navigationButtons_160wn_36", hr = "_grid_160wn_45", pr = "_dayNameCell_160wn_53", br = "_dateCell_160wn_72", vr = "_dateNumberContainer_160wn_107", gr = "_otherMonth_160wn_125", kr = "_selectedDate_160wn_157", k = {
|
|
732
732
|
calendarContainer: ur,
|
|
733
733
|
calendarHeader: dr,
|
|
734
734
|
monthYear: mr,
|
|
@@ -740,8 +740,8 @@ const ur = "_calendarContainer_mtooc_5", dr = "_calendarHeader_mtooc_33", mr = "
|
|
|
740
740
|
otherMonth: gr,
|
|
741
741
|
selectedDate: kr
|
|
742
742
|
}, yr = (e) => {
|
|
743
|
-
const a = F(e), r =
|
|
744
|
-
return
|
|
743
|
+
const a = F(e), r = xe(a, { locale: L }), o = Pe(r, 41);
|
|
744
|
+
return wt({ start: r, end: o });
|
|
745
745
|
}, be = (e) => e && e.charAt(0).toUpperCase() + e.slice(1), _r = ({
|
|
746
746
|
initialDate: e = /* @__PURE__ */ new Date(),
|
|
747
747
|
selectedDate: a = null,
|
|
@@ -752,7 +752,7 @@ const ur = "_calendarContainer_mtooc_5", dr = "_calendarHeader_mtooc_33", mr = "
|
|
|
752
752
|
// Initialize with selectedDate's month if valid, otherwise initialDate's month
|
|
753
753
|
F(a && ce(a) ? a : e)
|
|
754
754
|
);
|
|
755
|
-
|
|
755
|
+
we(() => {
|
|
756
756
|
if (a && ce(a)) {
|
|
757
757
|
const i = F(a);
|
|
758
758
|
me(i, o) || s(i);
|
|
@@ -762,14 +762,14 @@ const ur = "_calendarContainer_mtooc_5", dr = "_calendarHeader_mtooc_33", mr = "
|
|
|
762
762
|
() => yr(o),
|
|
763
763
|
[o]
|
|
764
764
|
), y = oe(() => {
|
|
765
|
-
const i =
|
|
765
|
+
const i = xe(/* @__PURE__ */ new Date(), { locale: L });
|
|
766
766
|
return Array.from({ length: 7 }).map((T, P) => {
|
|
767
767
|
const $ = K(Pe(i, P), "EEEEEE", { locale: L });
|
|
768
768
|
return be($);
|
|
769
769
|
});
|
|
770
770
|
}, []), _ = Y(() => {
|
|
771
771
|
u || s((i) => F(gt(i, 1)));
|
|
772
|
-
}, [u]),
|
|
772
|
+
}, [u]), w = Y(() => {
|
|
773
773
|
s((i) => F(kt(i, 1)));
|
|
774
774
|
}, []), v = Y(
|
|
775
775
|
(i) => {
|
|
@@ -781,7 +781,7 @@ const ur = "_calendarContainer_mtooc_5", dr = "_calendarHeader_mtooc_33", mr = "
|
|
|
781
781
|
(i.key === "Enter" || i.key === " ") && (i.preventDefault(), v(T));
|
|
782
782
|
},
|
|
783
783
|
[v]
|
|
784
|
-
),
|
|
784
|
+
), C = K(o, "MMMM", { locale: L }), V = K(o, "yyyy", { locale: L }), S = `${be(C)} ${V}`;
|
|
785
785
|
return /* @__PURE__ */ l.jsxs("div", { className: k.calendarContainer, children: [
|
|
786
786
|
/* @__PURE__ */ l.jsxs("div", { className: k.calendarHeader, children: [
|
|
787
787
|
/* @__PURE__ */ l.jsx("span", { className: k.monthYear, children: S }),
|
|
@@ -802,7 +802,7 @@ const ur = "_calendarContainer_mtooc_5", dr = "_calendarHeader_mtooc_33", mr = "
|
|
|
802
802
|
{
|
|
803
803
|
variant: "tertiary",
|
|
804
804
|
icon: !0,
|
|
805
|
-
onClick:
|
|
805
|
+
onClick: w,
|
|
806
806
|
"aria-label": "Neste måned",
|
|
807
807
|
children: /* @__PURE__ */ l.jsx(Re, {})
|
|
808
808
|
}
|
|
@@ -836,10 +836,10 @@ const ur = "_calendarContainer_mtooc_5", dr = "_calendarHeader_mtooc_33", mr = "
|
|
|
836
836
|
] });
|
|
837
837
|
};
|
|
838
838
|
_r.displayName = "DatePicker";
|
|
839
|
-
const
|
|
840
|
-
fieldset:
|
|
841
|
-
description:
|
|
842
|
-
error:
|
|
839
|
+
const wr = "_fieldset_17wt1_4", Cr = "_description_17wt1_15", xr = "_error_17wt1_22", Pr = "_inputWrapper_17wt1_30", Er = "_inputWrapperError_17wt1_42", Rr = "_suffixButton_17wt1_100", jr = "_suffixButtonInteractive_17wt1_120", O = {
|
|
840
|
+
fieldset: wr,
|
|
841
|
+
description: Cr,
|
|
842
|
+
error: xr,
|
|
843
843
|
inputWrapper: Pr,
|
|
844
844
|
inputWrapperError: Er,
|
|
845
845
|
suffixButton: Rr,
|
|
@@ -872,10 +872,10 @@ const Cr = "_fieldset_s5r8s_7", xr = "_description_s5r8s_29", wr = "_error_s5r8s
|
|
|
872
872
|
// For the actual input element
|
|
873
873
|
value: y,
|
|
874
874
|
defaultValue: _,
|
|
875
|
-
onChange:
|
|
875
|
+
onChange: w,
|
|
876
876
|
readOnly: v,
|
|
877
877
|
placeholder: j = "dd.mm.åååå",
|
|
878
|
-
id:
|
|
878
|
+
id: C,
|
|
879
879
|
name: V,
|
|
880
880
|
required: S,
|
|
881
881
|
disabled: i,
|
|
@@ -905,7 +905,7 @@ const Cr = "_fieldset_s5r8s_7", xr = "_description_s5r8s_29", wr = "_error_s5r8s
|
|
|
905
905
|
), [M, I] = _e(
|
|
906
906
|
() => D(y ?? _)
|
|
907
907
|
);
|
|
908
|
-
|
|
908
|
+
we(() => {
|
|
909
909
|
if (B) {
|
|
910
910
|
const h = D(y);
|
|
911
911
|
h !== M && (I(h), g.current && g.current.value !== h && (g.current.value = h));
|
|
@@ -913,20 +913,20 @@ const Cr = "_fieldset_s5r8s_7", xr = "_description_s5r8s_29", wr = "_error_s5r8s
|
|
|
913
913
|
}, [y, B, M, D]);
|
|
914
914
|
const ee = Y(
|
|
915
915
|
(h) => {
|
|
916
|
-
const b = h.target, A = b.value, G = M, p = ge(A).slice(0, 8), E = ke(p),
|
|
916
|
+
const b = h.target, A = b.value, G = M, p = ge(A).slice(0, 8), E = ke(p), x = ve(E);
|
|
917
917
|
let R = 0;
|
|
918
918
|
const q = E.length;
|
|
919
|
-
q <= 2 ? R = q : q <= 4 ? R = q + 1 : R = q + 2, R = Math.min(R,
|
|
920
|
-
if (g.current && (I(
|
|
919
|
+
q <= 2 ? R = q : q <= 4 ? R = q + 1 : R = q + 2, R = Math.min(R, x.length), requestAnimationFrame(() => {
|
|
920
|
+
if (g.current && (I(x), g.current.value = x, g.current.setSelectionRange(R, R), (x !== G || B) && w)) {
|
|
921
921
|
const je = {
|
|
922
922
|
...h,
|
|
923
|
-
target: { ...b, value:
|
|
923
|
+
target: { ...b, value: x }
|
|
924
924
|
};
|
|
925
|
-
|
|
925
|
+
w(je, x);
|
|
926
926
|
}
|
|
927
927
|
});
|
|
928
928
|
},
|
|
929
|
-
[M, B,
|
|
929
|
+
[M, B, w, D]
|
|
930
930
|
// Added isControlled and getFormattedValue
|
|
931
931
|
), te = [O.fieldset, d].filter(Boolean).join(" "), re = [
|
|
932
932
|
O.inputWrapper,
|
|
@@ -950,11 +950,11 @@ const Cr = "_fieldset_s5r8s_7", xr = "_description_s5r8s_29", wr = "_error_s5r8s
|
|
|
950
950
|
// disabled ? styles.suffixButtonDisabled : '',
|
|
951
951
|
].filter(Boolean).join(" ");
|
|
952
952
|
!r && !W && !Z && console.warn("Warning: DateInput component should have a label, aria-label, or aria-labelledby for accessibility.");
|
|
953
|
-
const t = r && typeof r == "string" ? Z || `${
|
|
953
|
+
const t = r && typeof r == "string" ? Z || `${C}-label` : void 0, n = z ? `${C}-desc` : void 0, c = N ? `${C}-err` : void 0, f = [n, c].filter(Boolean).join(" ") || void 0;
|
|
954
954
|
return (
|
|
955
955
|
// Use the fieldset structure and classes from InputField CSS
|
|
956
956
|
/* @__PURE__ */ l.jsxs("div", { className: te, children: [
|
|
957
|
-
r && typeof r == "string" ? /* @__PURE__ */ l.jsx("label", { id: t, htmlFor:
|
|
957
|
+
r && typeof r == "string" ? /* @__PURE__ */ l.jsx("label", { id: t, htmlFor: C, children: r }) : r,
|
|
958
958
|
z && /* @__PURE__ */ l.jsxs("p", { id: n, className: O.description, children: [
|
|
959
959
|
" ",
|
|
960
960
|
z
|
|
@@ -971,7 +971,7 @@ const Cr = "_fieldset_s5r8s_7", xr = "_description_s5r8s_29", wr = "_error_s5r8s
|
|
|
971
971
|
value: M,
|
|
972
972
|
readOnly: v,
|
|
973
973
|
placeholder: j,
|
|
974
|
-
id:
|
|
974
|
+
id: C,
|
|
975
975
|
name: V,
|
|
976
976
|
required: S,
|
|
977
977
|
disabled: i,
|
|
@@ -1011,7 +1011,7 @@ Tr.displayName = "DateInput";
|
|
|
1011
1011
|
const Vr = Ve, Hr = He, zr = ze, Gr = Ge, qr = qe, Kr = Je, Nr = Ke, Sr = Xe;
|
|
1012
1012
|
Nr.displayName = "Field.Description";
|
|
1013
1013
|
Sr.displayName = "Field.Counter";
|
|
1014
|
-
const Xr =
|
|
1014
|
+
const Xr = Ce, Jr = Ue, Ur = Qe, Qr = Ze, Zr = et, ea = tt, ta = rt, ra = at, aa = nt, na = ot, oa = st, sa = it, ia = lt, la = ct, ca = ut, ua = dt, da = mt, ma = ft, fa = ht, ha = pt, pa = bt, ba = vt;
|
|
1015
1015
|
export {
|
|
1016
1016
|
Et as Alert,
|
|
1017
1017
|
Rt as Avatar,
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var ue;function Se(){return ue||(ue=1,process.env.NODE_ENV!=="production"&&(function(){function e(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===H?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case B:return"Fragment";case O:return"Profiler";case c:return"StrictMode";case F:return"Suspense";case te:return"SuspenseList";case se:return"Activity"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case U:return"Portal";case I:return(t.displayName||"Context")+".Provider";case S:return(t._context.displayName||"Context")+".Consumer";case Q:var i=t.render;return t=t.displayName,t||(t=i.displayName||i.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Z:return i=t.displayName||null,i!==null?i:e(t.type)||"Memo";case W:i=t._payload,t=t._init;try{return e(t(i))}catch{}}return null}function n(t){return""+t}function r(t){try{n(t);var i=!1}catch{i=!0}if(i){i=console;var d=i.error,p=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return d.call(i,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",p),n(t)}}function l(t){if(t===B)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===W)return"<...>";try{var i=e(t);return i?"<"+i+">":"<...>"}catch{return"<...>"}}function s(){var t=P.A;return t===null?null:t.getOwner()}function b(){return Error("react-stack-top-frame")}function h(t){if(L.call(t,"key")){var i=Object.getOwnPropertyDescriptor(t,"key").get;if(i&&i.isReactWarning)return!1}return t.key!==void 0}function v(t,i){function d(){re||(re=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",i))}d.isReactWarning=!0,Object.defineProperty(t,"key",{get:d,configurable:!0})}function E(){var t=e(this.type);return ne[t]||(ne[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),t=this.props.ref,t!==void 0?t:null}function j(t,i,d,p,k,
|
|
17
|
+
*/var ue;function Se(){return ue||(ue=1,process.env.NODE_ENV!=="production"&&(function(){function e(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===H?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case B:return"Fragment";case O:return"Profiler";case c:return"StrictMode";case F:return"Suspense";case te:return"SuspenseList";case se:return"Activity"}if(typeof t=="object")switch(typeof t.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),t.$$typeof){case U:return"Portal";case I:return(t.displayName||"Context")+".Provider";case S:return(t._context.displayName||"Context")+".Consumer";case Q:var i=t.render;return t=t.displayName,t||(t=i.displayName||i.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Z:return i=t.displayName||null,i!==null?i:e(t.type)||"Memo";case W:i=t._payload,t=t._init;try{return e(t(i))}catch{}}return null}function n(t){return""+t}function r(t){try{n(t);var i=!1}catch{i=!0}if(i){i=console;var d=i.error,p=typeof Symbol=="function"&&Symbol.toStringTag&&t[Symbol.toStringTag]||t.constructor.name||"Object";return d.call(i,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",p),n(t)}}function l(t){if(t===B)return"<>";if(typeof t=="object"&&t!==null&&t.$$typeof===W)return"<...>";try{var i=e(t);return i?"<"+i+">":"<...>"}catch{return"<...>"}}function s(){var t=P.A;return t===null?null:t.getOwner()}function b(){return Error("react-stack-top-frame")}function h(t){if(L.call(t,"key")){var i=Object.getOwnPropertyDescriptor(t,"key").get;if(i&&i.isReactWarning)return!1}return t.key!==void 0}function v(t,i){function d(){re||(re=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",i))}d.isReactWarning=!0,Object.defineProperty(t,"key",{get:d,configurable:!0})}function E(){var t=e(this.type);return ne[t]||(ne[t]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),t=this.props.ref,t!==void 0?t:null}function j(t,i,d,p,k,C,Y,q){return d=C.ref,t={$$typeof:y,type:t,key:i,props:C,_owner:k},(d!==void 0?d:null)!==null?Object.defineProperty(t,"ref",{enumerable:!1,get:E}):Object.defineProperty(t,"ref",{enumerable:!1,value:null}),t._store={},Object.defineProperty(t._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(t,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(t,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:Y}),Object.defineProperty(t,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:q}),Object.freeze&&(Object.freeze(t.props),Object.freeze(t)),t}function T(t,i,d,p,k,C,Y,q){var w=i.children;if(w!==void 0)if(p)if(R(w)){for(p=0;p<w.length;p++)g(w[p]);Object.freeze&&Object.freeze(w)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else g(w);if(L.call(i,"key")){w=e(t);var M=Object.keys(i).filter(function(D){return D!=="key"});p=0<M.length?"{key: someKey, "+M.join(": ..., ")+": ...}":"{key: someKey}",ie[w+p]||(M=0<M.length?"{"+M.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
18
18
|
let props = %s;
|
|
19
19
|
<%s {...props} />
|
|
20
20
|
React keys must be passed directly to JSX without using spread:
|
|
21
21
|
let props = %s;
|
|
22
|
-
<%s key={someKey} {...props} />`,p,C,M,C),ie[C+p]=!0)}if(C=null,d!==void 0&&(r(d),C=""+d),h(i)&&(r(i.key),C=""+i.key),"key"in i){d={};for(var N in i)N!=="key"&&(d[N]=i[N])}else d=i;return C&&v(d,typeof t=="function"?t.displayName||t.name||"Unknown":t),j(t,C,_,k,s(),d,Y,q)}function w(t){typeof t=="object"&&t!==null&&t.$$typeof===y&&t._store&&(t._store.validated=1)}var x=f,y=Symbol.for("react.transitional.element"),U=Symbol.for("react.portal"),B=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),I=Symbol.for("react.context"),Q=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),te=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),se=Symbol.for("react.activity"),H=Symbol.for("react.client.reference"),P=x.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=Object.prototype.hasOwnProperty,R=Array.isArray,z=console.createTask?console.createTask:function(){return null};x={react_stack_bottom_frame:function(t){return t()}};var re,ne={},ae=x.react_stack_bottom_frame.bind(x,b)(),oe=z(l(b)),ie={};K.Fragment=B,K.jsx=function(t,i,d,p,k){var _=1e4>P.recentlyCreatedOwnerStacks++;return T(t,i,d,!1,p,k,_?Error("react-stack-top-frame"):ae,_?z(l(t)):oe)},K.jsxs=function(t,i,d,p,k){var _=1e4>P.recentlyCreatedOwnerStacks++;return T(t,i,d,!0,p,k,_?Error("react-stack-top-frame"):ae,_?z(l(t)):oe)}})()),K}var de;function Me(){return de||(de=1,process.env.NODE_ENV==="production"?ee.exports=Ne():ee.exports=Se()),ee.exports}var u=Me();const fe=f.forwardRef((e,n)=>u.jsx(o.Alert,{ref:n,...e}));fe.displayName="Alert";const me=f.forwardRef((e,n)=>u.jsx(o.Avatar,{ref:n,...e}));me.displayName="Avatar";const he=f.forwardRef((e,n)=>u.jsx(o.Badge,{ref:n,...e}));he.displayName="Badge";const De=o.BadgePosition,xe=o.Breadcrumbs,Oe=o.BreadcrumbsList,We=o.BreadcrumbsItem,Ae=o.BreadcrumbsLink,be=o.Button;be.displayName="Button";const ve=o.Card,Be=o.CardBlock;ve.displayName="Card";const pe=o.Checkbox,Ie=o.Fieldset,Le=o.useCheckboxGroup;pe.displayName="Checkbox",Ie.displayName="Fieldset";const Re=o.Chip;function le(e){return(n={})=>{const r=n.width?String(n.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}function X(e){return(n,r)=>{const l=r!=null&&r.context?String(r.context):"standalone";let s;if(l==="formatting"&&e.formattingValues){const h=e.defaultFormattingWidth||e.defaultWidth,v=r!=null&&r.width?String(r.width):h;s=e.formattingValues[v]||e.formattingValues[h]}else{const h=e.defaultWidth,v=r!=null&&r.width?String(r.width):e.defaultWidth;s=e.values[v]||e.values[h]}const b=e.argumentCallback?e.argumentCallback(n):n;return s[b]}}function J(e){return(n,r={})=>{const l=r.width,s=l&&e.matchPatterns[l]||e.matchPatterns[e.defaultMatchWidth],b=n.match(s);if(!b)return null;const h=b[0],v=l&&e.parsePatterns[l]||e.parsePatterns[e.defaultParseWidth],E=Array.isArray(v)?Ve(v,w=>w.test(h)):Ye(v,w=>w.test(h));let j;j=e.valueCallback?e.valueCallback(E):E,j=r.valueCallback?r.valueCallback(j):j;const T=n.slice(h.length);return{value:j,rest:T}}}function Ye(e,n){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&n(e[r]))return r}function Ve(e,n){for(let r=0;r<e.length;r++)if(n(e[r]))return r}function Fe(e){return(n,r={})=>{const l=n.match(e.matchPattern);if(!l)return null;const s=l[0],b=n.match(e.parsePattern);if(!b)return null;let h=e.valueCallback?e.valueCallback(b[0]):b[0];h=r.valueCallback?r.valueCallback(h):h;const v=n.slice(s.length);return{value:h,rest:v}}}const He={lessThanXSeconds:{one:"mindre enn ett sekund",other:"mindre enn {{count}} sekunder"},xSeconds:{one:"ett sekund",other:"{{count}} sekunder"},halfAMinute:"et halvt minutt",lessThanXMinutes:{one:"mindre enn ett minutt",other:"mindre enn {{count}} minutter"},xMinutes:{one:"ett minutt",other:"{{count}} minutter"},aboutXHours:{one:"omtrent en time",other:"omtrent {{count}} timer"},xHours:{one:"en time",other:"{{count}} timer"},xDays:{one:"en dag",other:"{{count}} dager"},aboutXWeeks:{one:"omtrent en uke",other:"omtrent {{count}} uker"},xWeeks:{one:"en uke",other:"{{count}} uker"},aboutXMonths:{one:"omtrent en måned",other:"omtrent {{count}} måneder"},xMonths:{one:"en måned",other:"{{count}} måneder"},aboutXYears:{one:"omtrent ett år",other:"omtrent {{count}} år"},xYears:{one:"ett år",other:"{{count}} år"},overXYears:{one:"over ett år",other:"over {{count}} år"},almostXYears:{one:"nesten ett år",other:"nesten {{count}} år"}},ze=(e,n,r)=>{let l;const s=He[e];return typeof s=="string"?l=s:n===1?l=s.one:l=s.other.replace("{{count}}",String(n)),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"om "+l:l+" siden":l},Ge={full:"EEEE d. MMMM y",long:"d. MMMM y",medium:"d. MMM y",short:"dd.MM.y"},Ke={full:"'kl'. HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Xe={full:"{{date}} 'kl.' {{time}}",long:"{{date}} 'kl.' {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Je={date:le({formats:Ge,defaultWidth:"full"}),time:le({formats:Ke,defaultWidth:"full"}),dateTime:le({formats:Xe,defaultWidth:"full"})},Ue={lastWeek:"'forrige' eeee 'kl.' p",yesterday:"'i går kl.' p",today:"'i dag kl.' p",tomorrow:"'i morgen kl.' p",nextWeek:"EEEE 'kl.' p",other:"P"},Qe=(e,n,r,l)=>Ue[e],Ze={narrow:["f.Kr.","e.Kr."],abbreviated:["f.Kr.","e.Kr."],wide:["før Kristus","etter Kristus"]},qe={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1. kvartal","2. kvartal","3. kvartal","4. kvartal"]},$e={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["jan.","feb.","mars","apr.","mai","juni","juli","aug.","sep.","okt.","nov.","des."],wide:["januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"]},et={narrow:["S","M","T","O","T","F","L"],short:["sø","ma","ti","on","to","fr","lø"],abbreviated:["søn","man","tir","ons","tor","fre","lør"],wide:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"]},tt={narrow:{am:"a",pm:"p",midnight:"midnatt",noon:"middag",morning:"på morg.",afternoon:"på etterm.",evening:"på kvelden",night:"på natten"},abbreviated:{am:"a.m.",pm:"p.m.",midnight:"midnatt",noon:"middag",morning:"på morg.",afternoon:"på etterm.",evening:"på kvelden",night:"på natten"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnatt",noon:"middag",morning:"på morgenen",afternoon:"på ettermiddagen",evening:"på kvelden",night:"på natten"}},rt={ordinalNumber:(e,n)=>Number(e)+".",era:X({values:Ze,defaultWidth:"wide"}),quarter:X({values:qe,defaultWidth:"wide",argumentCallback:e=>e-1}),month:X({values:$e,defaultWidth:"wide"}),day:X({values:et,defaultWidth:"wide"}),dayPeriod:X({values:tt,defaultWidth:"wide"})},nt=/^(\d+)\.?/i,at=/\d+/i,ot={narrow:/^(f\.? ?Kr\.?|fvt\.?|e\.? ?Kr\.?|evt\.?)/i,abbreviated:/^(f\.? ?Kr\.?|fvt\.?|e\.? ?Kr\.?|evt\.?)/i,wide:/^(før Kristus|før vår tid|etter Kristus|vår tid)/i},it={any:[/^f/i,/^e/i]},lt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](\.)? kvartal/i},st={any:[/1/i,/2/i,/3/i,/4/i]},ct={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mars?|apr|mai|juni?|juli?|aug|sep|okt|nov|des)\.?/i,wide:/^(januar|februar|mars|april|mai|juni|juli|august|september|oktober|november|desember)/i},ut={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^mai/i,/^jun/i,/^jul/i,/^aug/i,/^s/i,/^o/i,/^n/i,/^d/i]},dt={narrow:/^[smtofl]/i,short:/^(sø|ma|ti|on|to|fr|lø)/i,abbreviated:/^(søn|man|tir|ons|tor|fre|lør)/i,wide:/^(søndag|mandag|tirsdag|onsdag|torsdag|fredag|lørdag)/i},ft={any:[/^s/i,/^m/i,/^ti/i,/^o/i,/^to/i,/^f/i,/^l/i]},mt={narrow:/^(midnatt|middag|(på) (morgenen|ettermiddagen|kvelden|natten)|[ap])/i,any:/^([ap]\.?\s?m\.?|midnatt|middag|(på) (morgenen|ettermiddagen|kvelden|natten))/i},ht={any:{am:/^a(\.?\s?m\.?)?$/i,pm:/^p(\.?\s?m\.?)?$/i,midnight:/^midn/i,noon:/^midd/i,morning:/morgen/i,afternoon:/ettermiddag/i,evening:/kveld/i,night:/natt/i}},bt={ordinalNumber:Fe({matchPattern:nt,parsePattern:at,valueCallback:e=>parseInt(e,10)}),era:J({matchPatterns:ot,defaultMatchWidth:"wide",parsePatterns:it,defaultParseWidth:"any"}),quarter:J({matchPatterns:lt,defaultMatchWidth:"wide",parsePatterns:st,defaultParseWidth:"any",valueCallback:e=>e+1}),month:J({matchPatterns:ct,defaultMatchWidth:"wide",parsePatterns:ut,defaultParseWidth:"any"}),day:J({matchPatterns:dt,defaultMatchWidth:"wide",parsePatterns:ft,defaultParseWidth:"any"}),dayPeriod:J({matchPatterns:mt,defaultMatchWidth:"any",parsePatterns:ht,defaultParseWidth:"any"})},V={code:"nb",formatDistance:ze,formatLong:Je,formatRelative:Qe,localize:rt,match:bt,options:{weekStartsOn:1,firstWeekContainsDate:4}},ke=({title:e,...n})=>u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 28 28",fill:"none","aria-hidden":e?void 0:!0,focusable:"false",...n,children:[e&&u.jsx("title",{children:e}),u.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.952 6.96459C16.6103 6.62289 16.0563 6.62289 15.7146 6.96459L9.2979 13.3813C8.95621 13.723 8.95621 14.277 9.2979 14.6187L15.7146 21.0354C16.0563 21.3771 16.6103 21.3771 16.952 21.0354C17.2937 20.6937 17.2937 20.1396 16.952 19.7979L11.1541 14L16.952 8.20203C17.2937 7.86032 17.2937 7.3063 16.952 6.96459Z",fill:"currentColor"})]});ke.displayName="ChevronLeftIcon";const Ce=({title:e,...n})=>u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 28 28",fill:"none","aria-hidden":e?void 0:!0,focusable:"false",...n,children:[e&&u.jsx("title",{children:e}),u.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.048 6.96459C11.3897 6.62289 11.9437 6.62289 12.2854 6.96459L18.7021 13.3813C19.0438 13.723 19.0438 14.277 18.7021 14.6187L12.2854 21.0354C11.9437 21.3771 11.3897 21.3771 11.048 21.0354C10.7063 20.6937 10.7063 20.1396 11.048 19.7979L16.8459 14L11.048 8.20203C10.7063 7.86032 10.7063 7.3063 11.048 6.96459Z",fill:"currentColor"})]});Ce.displayName="ChevronRightIcon";const g={calendarContainer:"_calendarContainer_mtooc_5",calendarHeader:"_calendarHeader_mtooc_33",monthYear:"_monthYear_mtooc_47",navigationButtons:"_navigationButtons_mtooc_71",grid:"_grid_mtooc_89",dayNameCell:"_dayNameCell_mtooc_105",dateCell:"_dateCell_mtooc_143",dateNumberContainer:"_dateNumberContainer_mtooc_213",otherMonth:"_otherMonth_mtooc_249",selectedDate:"_selectedDate_mtooc_313"},vt=e=>{const n=m.startOfMonth(e),r=m.startOfWeek(n,{locale:V}),l=m.addDays(r,41);return m.eachDayOfInterval({start:r,end:l})},_e=e=>e&&e.charAt(0).toUpperCase()+e.slice(1),ge=({initialDate:e=new Date,selectedDate:n=null,onDateSelect:r})=>{const[l,s]=f.useState(m.startOfMonth(n&&m.isValid(n)?n:e));f.useEffect(()=>{if(n&&m.isValid(n)){const c=m.startOfMonth(n);m.isSameMonth(c,l)||s(c)}},[n]);const b=f.useMemo(()=>m.startOfMonth(new Date),[]),h=f.useMemo(()=>!1,[l,b]),v=f.useMemo(()=>vt(l),[l]),E=f.useMemo(()=>{const c=m.startOfWeek(new Date,{locale:V});return Array.from({length:7}).map((O,S)=>{const I=m.format(m.addDays(c,S),"EEEEEE",{locale:V});return _e(I)})},[]),j=f.useCallback(()=>{h||s(c=>m.startOfMonth(m.subMonths(c,1)))},[h]),T=f.useCallback(()=>{s(c=>m.startOfMonth(m.addMonths(c,1)))},[]),w=f.useCallback(c=>{r&&r(c)},[r]),x=f.useCallback((c,O)=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),w(O))},[w]),y=m.format(l,"MMMM",{locale:V}),U=m.format(l,"yyyy",{locale:V}),B=`${_e(y)} ${U}`;return u.jsxs("div",{className:g.calendarContainer,children:[u.jsxs("div",{className:g.calendarHeader,children:[u.jsx("span",{className:g.monthYear,children:B}),u.jsxs("div",{className:g.navigationButtons,children:[u.jsx(o.Button,{variant:"tertiary",icon:!0,onClick:j,"aria-label":"Forrige måned",disabled:h,children:u.jsx(ke,{})}),u.jsx(o.Button,{variant:"tertiary",icon:!0,onClick:T,"aria-label":"Neste måned",children:u.jsx(Ce,{})})]})]}),u.jsx("div",{className:g.grid,children:E.map(c=>u.jsx("div",{className:g.dayNameCell,children:c},c))}),u.jsx("div",{className:g.grid,children:v.map(c=>{const O=m.isSameMonth(c,l),S=n&&m.isValid(n)&&m.isSameDay(c,n),I=m.isToday(c),Q=[g.dateCell,O?"":g.otherMonth,S?g.selectedDate:"",I&&!S?g.todayDate:""].filter(Boolean).join(" ");return u.jsx("div",{className:Q,onClick:()=>w(c),onKeyDown:F=>x(F,c),role:"button",tabIndex:0,"aria-pressed":S??!1,"aria-label":m.format(c,"PPP",{locale:V}),children:u.jsx("span",{className:g.dateNumberContainer,children:m.format(c,"d")})},c.toISOString())})})]})};ge.displayName="DatePicker";const A={fieldset:"_fieldset_s5r8s_7",description:"_description_s5r8s_29",error:"_error_s5r8s_43",inputWrapper:"_inputWrapper_s5r8s_59",inputWrapperError:"_inputWrapperError_s5r8s_83",suffixButton:"_suffixButton_s5r8s_199",suffixButtonInteractive:"_suffixButtonInteractive_s5r8s_239"},we=e=>{const n=e.slice(0,2),r=e.slice(2,4),l=e.slice(4,8);return e.length>4?`${n}.${r}.${l}`:e.length>2?`${n}.${r}`:e.length>0?n:""},Pe=e=>(e||"").replace(/\D/g,""),Ee=e=>{let n=e;if(n.length>=2){const r=parseInt(n.substring(0,2),10);!isNaN(r)&&r>31&&(n="31"+n.substring(2))}if(n.length>=4){const r=parseInt(n.substring(2,4),10);!isNaN(r)&&r>12&&(n=n.substring(0,2)+"12"+n.substring(4))}return n.slice(0,8)},je=f.forwardRef((e,n)=>{const{label:r,suffixIcon:l,onSuffixClick:s,className:b,inputWrapperClassName:h,inputClassName:v,value:E,defaultValue:j,onChange:T,readOnly:w,placeholder:x="dd.mm.åååå",id:y,name:U,required:B,disabled:c,onClick:O,onFocus:S,onBlur:I,autoComplete:Q="off","aria-label":F,"aria-labelledby":te,description:Z,error:W,...se}=e,H=E!==void 0,P=f.useRef(null);f.useImperativeHandle(n,()=>P.current);const L=f.useCallback(k=>{const _=Pe(k),Y=Ee(_);return we(Y)},[]),[R,z]=f.useState(()=>L(E??j));f.useEffect(()=>{if(H){const k=L(E);k!==R&&(z(k),P.current&&P.current.value!==k&&(P.current.value=k))}},[E,H,R,L]);const re=f.useCallback(k=>{const _=k.target,Y=_.value,q=R,C=Pe(Y).slice(0,8),M=Ee(C),N=we(M);let D=0;const $=M.length;$<=2?D=$:$<=4?D=$+1:D=$+2,D=Math.min(D,N.length),requestAnimationFrame(()=>{if(P.current&&(z(N),P.current.value=N,P.current.setSelectionRange(D,D),(N!==q||H)&&T)){const Gt={...k,target:{..._,value:N}};T(Gt,N)}})},[R,H,T,L]),ne=[A.fieldset,b].filter(Boolean).join(" "),ae=[A.inputWrapper,h,W?A.inputWrapperError:""].filter(Boolean).join(" "),oe=[v].filter(Boolean).join(" "),ie=[A.suffixButton,s?A.suffixButtonInteractive:""].filter(Boolean).join(" ");!r&&!F&&!te&&console.warn("Warning: DateInput component should have a label, aria-label, or aria-labelledby for accessibility.");const t=r&&typeof r=="string"?te||`${y}-label`:void 0,i=Z?`${y}-desc`:void 0,d=W?`${y}-err`:void 0,p=[i,d].filter(Boolean).join(" ")||void 0;return u.jsxs("div",{className:ne,children:[r&&typeof r=="string"?u.jsx("label",{id:t,htmlFor:y,children:r}):r,Z&&u.jsxs("p",{id:i,className:A.description,children:[" ",Z]}),u.jsxs("div",{className:ae,children:[u.jsx("input",{ref:P,type:"text",inputMode:"numeric",pattern:"\\d{2}\\.\\d{2}\\.\\d{4}",maxLength:10,value:R,readOnly:w,placeholder:x,id:y,name:U,required:B,disabled:c,onClick:O,onChange:re,onFocus:S,onBlur:I,autoComplete:Q,"aria-label":F,"aria-labelledby":t,"aria-describedby":p,"aria-invalid":!!W,className:oe,...se}),l&&u.jsx("button",{type:"button",className:ie,onClick:c?void 0:s,tabIndex:s&&!c?0:-1,"aria-hidden":!s,disabled:c,"aria-label":s?"Åpne datovelger":void 0,children:l})]}),W&&u.jsx("p",{id:d,className:A.error,role:"alert",children:W})]})});je.displayName="DateInput";const pt=o.Details,kt=o.Dialog,Ct=o.Divider,_t=o.Dropdown,gt=o.ErrorSummary,wt=o.Field,Te=o.FieldDescription,ye=o.FieldCounter;Te.displayName="Field.Description",ye.displayName="Field.Counter";const Pt=o.Fieldset,Et=o.Input,jt=o.Link,Tt=o.List,yt=o.Pagination,Nt=o.usePagination,St=o.Popover,Mt=o.Radio,Dt=o.useRadioGroup,xt=o.Search,Ot=o.Select,Wt=o.Skeleton,At=o.SkipLink,Bt=o.Spinner,It=o.Switch,Lt=o.Table,Rt=o.Tabs,Yt=o.Tag,Vt=o.Textarea,Ft=o.Textfield,Ht=o.ToggleGroup,zt=o.Tooltip;a.Alert=fe,a.Avatar=me,a.Badge=he,a.BadgePosition=De,a.Breadcrumbs=xe,a.BreadcrumbsItem=We,a.BreadcrumbsLink=Ae,a.BreadcrumbsList=Oe,a.Button=be,a.Card=ve,a.CardBlock=Be,a.Checkbox=pe,a.Chip=Re,a.DateInput=je,a.DatePicker=ge,a.Details=pt,a.Dialog=kt,a.Divider=Ct,a.Dropdown=_t,a.ErrorSummary=gt,a.Field=wt,a.FieldCounter=ye,a.FieldDescription=Te,a.Fieldset=Pt,a.Input=Et,a.Link=jt,a.List=Tt,a.Pagination=yt,a.Popover=St,a.Radio=Mt,a.Search=xt,a.Select=Ot,a.SkeletonLoader=Wt,a.SkipLink=At,a.Spinner=Bt,a.Switch=It,a.Table=Lt,a.Tabs=Rt,a.Tag=Yt,a.Textarea=Vt,a.Textfield=Ft,a.ToggleGroup=Ht,a.Tooltip=zt,a.useCheckboxGroup=Le,a.usePagination=Nt,a.useRadioGroup=Dt,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}));
|
|
22
|
+
<%s key={someKey} {...props} />`,p,w,M,w),ie[w+p]=!0)}if(w=null,d!==void 0&&(r(d),w=""+d),h(i)&&(r(i.key),w=""+i.key),"key"in i){d={};for(var N in i)N!=="key"&&(d[N]=i[N])}else d=i;return w&&v(d,typeof t=="function"?t.displayName||t.name||"Unknown":t),j(t,w,C,k,s(),d,Y,q)}function g(t){typeof t=="object"&&t!==null&&t.$$typeof===y&&t._store&&(t._store.validated=1)}var x=f,y=Symbol.for("react.transitional.element"),U=Symbol.for("react.portal"),B=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),O=Symbol.for("react.profiler"),S=Symbol.for("react.consumer"),I=Symbol.for("react.context"),Q=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),te=Symbol.for("react.suspense_list"),Z=Symbol.for("react.memo"),W=Symbol.for("react.lazy"),se=Symbol.for("react.activity"),H=Symbol.for("react.client.reference"),P=x.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=Object.prototype.hasOwnProperty,R=Array.isArray,z=console.createTask?console.createTask:function(){return null};x={react_stack_bottom_frame:function(t){return t()}};var re,ne={},ae=x.react_stack_bottom_frame.bind(x,b)(),oe=z(l(b)),ie={};K.Fragment=B,K.jsx=function(t,i,d,p,k){var C=1e4>P.recentlyCreatedOwnerStacks++;return T(t,i,d,!1,p,k,C?Error("react-stack-top-frame"):ae,C?z(l(t)):oe)},K.jsxs=function(t,i,d,p,k){var C=1e4>P.recentlyCreatedOwnerStacks++;return T(t,i,d,!0,p,k,C?Error("react-stack-top-frame"):ae,C?z(l(t)):oe)}})()),K}var de;function Me(){return de||(de=1,process.env.NODE_ENV==="production"?ee.exports=Ne():ee.exports=Se()),ee.exports}var u=Me();const fe=f.forwardRef((e,n)=>u.jsx(o.Alert,{ref:n,...e}));fe.displayName="Alert";const me=f.forwardRef((e,n)=>u.jsx(o.Avatar,{ref:n,...e}));me.displayName="Avatar";const he=f.forwardRef((e,n)=>u.jsx(o.Badge,{ref:n,...e}));he.displayName="Badge";const De=o.BadgePosition,xe=o.Breadcrumbs,Oe=o.BreadcrumbsList,We=o.BreadcrumbsItem,Ae=o.BreadcrumbsLink,be=o.Button;be.displayName="Button";const ve=o.Card,Be=o.CardBlock;ve.displayName="Card";const pe=o.Checkbox,Ie=o.Fieldset,Le=o.useCheckboxGroup;pe.displayName="Checkbox",Ie.displayName="Fieldset";const Re=o.Chip;function le(e){return(n={})=>{const r=n.width?String(n.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}function X(e){return(n,r)=>{const l=r!=null&&r.context?String(r.context):"standalone";let s;if(l==="formatting"&&e.formattingValues){const h=e.defaultFormattingWidth||e.defaultWidth,v=r!=null&&r.width?String(r.width):h;s=e.formattingValues[v]||e.formattingValues[h]}else{const h=e.defaultWidth,v=r!=null&&r.width?String(r.width):e.defaultWidth;s=e.values[v]||e.values[h]}const b=e.argumentCallback?e.argumentCallback(n):n;return s[b]}}function J(e){return(n,r={})=>{const l=r.width,s=l&&e.matchPatterns[l]||e.matchPatterns[e.defaultMatchWidth],b=n.match(s);if(!b)return null;const h=b[0],v=l&&e.parsePatterns[l]||e.parsePatterns[e.defaultParseWidth],E=Array.isArray(v)?Ve(v,g=>g.test(h)):Ye(v,g=>g.test(h));let j;j=e.valueCallback?e.valueCallback(E):E,j=r.valueCallback?r.valueCallback(j):j;const T=n.slice(h.length);return{value:j,rest:T}}}function Ye(e,n){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&n(e[r]))return r}function Ve(e,n){for(let r=0;r<e.length;r++)if(n(e[r]))return r}function Fe(e){return(n,r={})=>{const l=n.match(e.matchPattern);if(!l)return null;const s=l[0],b=n.match(e.parsePattern);if(!b)return null;let h=e.valueCallback?e.valueCallback(b[0]):b[0];h=r.valueCallback?r.valueCallback(h):h;const v=n.slice(s.length);return{value:h,rest:v}}}const He={lessThanXSeconds:{one:"mindre enn ett sekund",other:"mindre enn {{count}} sekunder"},xSeconds:{one:"ett sekund",other:"{{count}} sekunder"},halfAMinute:"et halvt minutt",lessThanXMinutes:{one:"mindre enn ett minutt",other:"mindre enn {{count}} minutter"},xMinutes:{one:"ett minutt",other:"{{count}} minutter"},aboutXHours:{one:"omtrent en time",other:"omtrent {{count}} timer"},xHours:{one:"en time",other:"{{count}} timer"},xDays:{one:"en dag",other:"{{count}} dager"},aboutXWeeks:{one:"omtrent en uke",other:"omtrent {{count}} uker"},xWeeks:{one:"en uke",other:"{{count}} uker"},aboutXMonths:{one:"omtrent en måned",other:"omtrent {{count}} måneder"},xMonths:{one:"en måned",other:"{{count}} måneder"},aboutXYears:{one:"omtrent ett år",other:"omtrent {{count}} år"},xYears:{one:"ett år",other:"{{count}} år"},overXYears:{one:"over ett år",other:"over {{count}} år"},almostXYears:{one:"nesten ett år",other:"nesten {{count}} år"}},ze=(e,n,r)=>{let l;const s=He[e];return typeof s=="string"?l=s:n===1?l=s.one:l=s.other.replace("{{count}}",String(n)),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"om "+l:l+" siden":l},Ge={full:"EEEE d. MMMM y",long:"d. MMMM y",medium:"d. MMM y",short:"dd.MM.y"},Ke={full:"'kl'. HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Xe={full:"{{date}} 'kl.' {{time}}",long:"{{date}} 'kl.' {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Je={date:le({formats:Ge,defaultWidth:"full"}),time:le({formats:Ke,defaultWidth:"full"}),dateTime:le({formats:Xe,defaultWidth:"full"})},Ue={lastWeek:"'forrige' eeee 'kl.' p",yesterday:"'i går kl.' p",today:"'i dag kl.' p",tomorrow:"'i morgen kl.' p",nextWeek:"EEEE 'kl.' p",other:"P"},Qe=(e,n,r,l)=>Ue[e],Ze={narrow:["f.Kr.","e.Kr."],abbreviated:["f.Kr.","e.Kr."],wide:["før Kristus","etter Kristus"]},qe={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1. kvartal","2. kvartal","3. kvartal","4. kvartal"]},$e={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["jan.","feb.","mars","apr.","mai","juni","juli","aug.","sep.","okt.","nov.","des."],wide:["januar","februar","mars","april","mai","juni","juli","august","september","oktober","november","desember"]},et={narrow:["S","M","T","O","T","F","L"],short:["sø","ma","ti","on","to","fr","lø"],abbreviated:["søn","man","tir","ons","tor","fre","lør"],wide:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"]},tt={narrow:{am:"a",pm:"p",midnight:"midnatt",noon:"middag",morning:"på morg.",afternoon:"på etterm.",evening:"på kvelden",night:"på natten"},abbreviated:{am:"a.m.",pm:"p.m.",midnight:"midnatt",noon:"middag",morning:"på morg.",afternoon:"på etterm.",evening:"på kvelden",night:"på natten"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnatt",noon:"middag",morning:"på morgenen",afternoon:"på ettermiddagen",evening:"på kvelden",night:"på natten"}},rt={ordinalNumber:(e,n)=>Number(e)+".",era:X({values:Ze,defaultWidth:"wide"}),quarter:X({values:qe,defaultWidth:"wide",argumentCallback:e=>e-1}),month:X({values:$e,defaultWidth:"wide"}),day:X({values:et,defaultWidth:"wide"}),dayPeriod:X({values:tt,defaultWidth:"wide"})},nt=/^(\d+)\.?/i,at=/\d+/i,ot={narrow:/^(f\.? ?Kr\.?|fvt\.?|e\.? ?Kr\.?|evt\.?)/i,abbreviated:/^(f\.? ?Kr\.?|fvt\.?|e\.? ?Kr\.?|evt\.?)/i,wide:/^(før Kristus|før vår tid|etter Kristus|vår tid)/i},it={any:[/^f/i,/^e/i]},lt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](\.)? kvartal/i},st={any:[/1/i,/2/i,/3/i,/4/i]},ct={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mars?|apr|mai|juni?|juli?|aug|sep|okt|nov|des)\.?/i,wide:/^(januar|februar|mars|april|mai|juni|juli|august|september|oktober|november|desember)/i},ut={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^mai/i,/^jun/i,/^jul/i,/^aug/i,/^s/i,/^o/i,/^n/i,/^d/i]},dt={narrow:/^[smtofl]/i,short:/^(sø|ma|ti|on|to|fr|lø)/i,abbreviated:/^(søn|man|tir|ons|tor|fre|lør)/i,wide:/^(søndag|mandag|tirsdag|onsdag|torsdag|fredag|lørdag)/i},ft={any:[/^s/i,/^m/i,/^ti/i,/^o/i,/^to/i,/^f/i,/^l/i]},mt={narrow:/^(midnatt|middag|(på) (morgenen|ettermiddagen|kvelden|natten)|[ap])/i,any:/^([ap]\.?\s?m\.?|midnatt|middag|(på) (morgenen|ettermiddagen|kvelden|natten))/i},ht={any:{am:/^a(\.?\s?m\.?)?$/i,pm:/^p(\.?\s?m\.?)?$/i,midnight:/^midn/i,noon:/^midd/i,morning:/morgen/i,afternoon:/ettermiddag/i,evening:/kveld/i,night:/natt/i}},bt={ordinalNumber:Fe({matchPattern:nt,parsePattern:at,valueCallback:e=>parseInt(e,10)}),era:J({matchPatterns:ot,defaultMatchWidth:"wide",parsePatterns:it,defaultParseWidth:"any"}),quarter:J({matchPatterns:lt,defaultMatchWidth:"wide",parsePatterns:st,defaultParseWidth:"any",valueCallback:e=>e+1}),month:J({matchPatterns:ct,defaultMatchWidth:"wide",parsePatterns:ut,defaultParseWidth:"any"}),day:J({matchPatterns:dt,defaultMatchWidth:"wide",parsePatterns:ft,defaultParseWidth:"any"}),dayPeriod:J({matchPatterns:mt,defaultMatchWidth:"any",parsePatterns:ht,defaultParseWidth:"any"})},V={code:"nb",formatDistance:ze,formatLong:Je,formatRelative:Qe,localize:rt,match:bt,options:{weekStartsOn:1,firstWeekContainsDate:4}},ke=({title:e,...n})=>u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 28 28",fill:"none","aria-hidden":e?void 0:!0,focusable:"false",...n,children:[e&&u.jsx("title",{children:e}),u.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.952 6.96459C16.6103 6.62289 16.0563 6.62289 15.7146 6.96459L9.2979 13.3813C8.95621 13.723 8.95621 14.277 9.2979 14.6187L15.7146 21.0354C16.0563 21.3771 16.6103 21.3771 16.952 21.0354C17.2937 20.6937 17.2937 20.1396 16.952 19.7979L11.1541 14L16.952 8.20203C17.2937 7.86032 17.2937 7.3063 16.952 6.96459Z",fill:"currentColor"})]});ke.displayName="ChevronLeftIcon";const we=({title:e,...n})=>u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 28 28",fill:"none","aria-hidden":e?void 0:!0,focusable:"false",...n,children:[e&&u.jsx("title",{children:e}),u.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11.048 6.96459C11.3897 6.62289 11.9437 6.62289 12.2854 6.96459L18.7021 13.3813C19.0438 13.723 19.0438 14.277 18.7021 14.6187L12.2854 21.0354C11.9437 21.3771 11.3897 21.3771 11.048 21.0354C10.7063 20.6937 10.7063 20.1396 11.048 19.7979L16.8459 14L11.048 8.20203C10.7063 7.86032 10.7063 7.3063 11.048 6.96459Z",fill:"currentColor"})]});we.displayName="ChevronRightIcon";const _={calendarContainer:"_calendarContainer_160wn_3",calendarHeader:"_calendarHeader_160wn_17",monthYear:"_monthYear_160wn_24",navigationButtons:"_navigationButtons_160wn_36",grid:"_grid_160wn_45",dayNameCell:"_dayNameCell_160wn_53",dateCell:"_dateCell_160wn_72",dateNumberContainer:"_dateNumberContainer_160wn_107",otherMonth:"_otherMonth_160wn_125",selectedDate:"_selectedDate_160wn_157"},vt=e=>{const n=m.startOfMonth(e),r=m.startOfWeek(n,{locale:V}),l=m.addDays(r,41);return m.eachDayOfInterval({start:r,end:l})},Ce=e=>e&&e.charAt(0).toUpperCase()+e.slice(1),_e=({initialDate:e=new Date,selectedDate:n=null,onDateSelect:r})=>{const[l,s]=f.useState(m.startOfMonth(n&&m.isValid(n)?n:e));f.useEffect(()=>{if(n&&m.isValid(n)){const c=m.startOfMonth(n);m.isSameMonth(c,l)||s(c)}},[n]);const b=f.useMemo(()=>m.startOfMonth(new Date),[]),h=f.useMemo(()=>!1,[l,b]),v=f.useMemo(()=>vt(l),[l]),E=f.useMemo(()=>{const c=m.startOfWeek(new Date,{locale:V});return Array.from({length:7}).map((O,S)=>{const I=m.format(m.addDays(c,S),"EEEEEE",{locale:V});return Ce(I)})},[]),j=f.useCallback(()=>{h||s(c=>m.startOfMonth(m.subMonths(c,1)))},[h]),T=f.useCallback(()=>{s(c=>m.startOfMonth(m.addMonths(c,1)))},[]),g=f.useCallback(c=>{r&&r(c)},[r]),x=f.useCallback((c,O)=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),g(O))},[g]),y=m.format(l,"MMMM",{locale:V}),U=m.format(l,"yyyy",{locale:V}),B=`${Ce(y)} ${U}`;return u.jsxs("div",{className:_.calendarContainer,children:[u.jsxs("div",{className:_.calendarHeader,children:[u.jsx("span",{className:_.monthYear,children:B}),u.jsxs("div",{className:_.navigationButtons,children:[u.jsx(o.Button,{variant:"tertiary",icon:!0,onClick:j,"aria-label":"Forrige måned",disabled:h,children:u.jsx(ke,{})}),u.jsx(o.Button,{variant:"tertiary",icon:!0,onClick:T,"aria-label":"Neste måned",children:u.jsx(we,{})})]})]}),u.jsx("div",{className:_.grid,children:E.map(c=>u.jsx("div",{className:_.dayNameCell,children:c},c))}),u.jsx("div",{className:_.grid,children:v.map(c=>{const O=m.isSameMonth(c,l),S=n&&m.isValid(n)&&m.isSameDay(c,n),I=m.isToday(c),Q=[_.dateCell,O?"":_.otherMonth,S?_.selectedDate:"",I&&!S?_.todayDate:""].filter(Boolean).join(" ");return u.jsx("div",{className:Q,onClick:()=>g(c),onKeyDown:F=>x(F,c),role:"button",tabIndex:0,"aria-pressed":S??!1,"aria-label":m.format(c,"PPP",{locale:V}),children:u.jsx("span",{className:_.dateNumberContainer,children:m.format(c,"d")})},c.toISOString())})})]})};_e.displayName="DatePicker";const A={fieldset:"_fieldset_17wt1_4",description:"_description_17wt1_15",error:"_error_17wt1_22",inputWrapper:"_inputWrapper_17wt1_30",inputWrapperError:"_inputWrapperError_17wt1_42",suffixButton:"_suffixButton_17wt1_100",suffixButtonInteractive:"_suffixButtonInteractive_17wt1_120"},ge=e=>{const n=e.slice(0,2),r=e.slice(2,4),l=e.slice(4,8);return e.length>4?`${n}.${r}.${l}`:e.length>2?`${n}.${r}`:e.length>0?n:""},Pe=e=>(e||"").replace(/\D/g,""),Ee=e=>{let n=e;if(n.length>=2){const r=parseInt(n.substring(0,2),10);!isNaN(r)&&r>31&&(n="31"+n.substring(2))}if(n.length>=4){const r=parseInt(n.substring(2,4),10);!isNaN(r)&&r>12&&(n=n.substring(0,2)+"12"+n.substring(4))}return n.slice(0,8)},je=f.forwardRef((e,n)=>{const{label:r,suffixIcon:l,onSuffixClick:s,className:b,inputWrapperClassName:h,inputClassName:v,value:E,defaultValue:j,onChange:T,readOnly:g,placeholder:x="dd.mm.åååå",id:y,name:U,required:B,disabled:c,onClick:O,onFocus:S,onBlur:I,autoComplete:Q="off","aria-label":F,"aria-labelledby":te,description:Z,error:W,...se}=e,H=E!==void 0,P=f.useRef(null);f.useImperativeHandle(n,()=>P.current);const L=f.useCallback(k=>{const C=Pe(k),Y=Ee(C);return ge(Y)},[]),[R,z]=f.useState(()=>L(E??j));f.useEffect(()=>{if(H){const k=L(E);k!==R&&(z(k),P.current&&P.current.value!==k&&(P.current.value=k))}},[E,H,R,L]);const re=f.useCallback(k=>{const C=k.target,Y=C.value,q=R,w=Pe(Y).slice(0,8),M=Ee(w),N=ge(M);let D=0;const $=M.length;$<=2?D=$:$<=4?D=$+1:D=$+2,D=Math.min(D,N.length),requestAnimationFrame(()=>{if(P.current&&(z(N),P.current.value=N,P.current.setSelectionRange(D,D),(N!==q||H)&&T)){const Gt={...k,target:{...C,value:N}};T(Gt,N)}})},[R,H,T,L]),ne=[A.fieldset,b].filter(Boolean).join(" "),ae=[A.inputWrapper,h,W?A.inputWrapperError:""].filter(Boolean).join(" "),oe=[v].filter(Boolean).join(" "),ie=[A.suffixButton,s?A.suffixButtonInteractive:""].filter(Boolean).join(" ");!r&&!F&&!te&&console.warn("Warning: DateInput component should have a label, aria-label, or aria-labelledby for accessibility.");const t=r&&typeof r=="string"?te||`${y}-label`:void 0,i=Z?`${y}-desc`:void 0,d=W?`${y}-err`:void 0,p=[i,d].filter(Boolean).join(" ")||void 0;return u.jsxs("div",{className:ne,children:[r&&typeof r=="string"?u.jsx("label",{id:t,htmlFor:y,children:r}):r,Z&&u.jsxs("p",{id:i,className:A.description,children:[" ",Z]}),u.jsxs("div",{className:ae,children:[u.jsx("input",{ref:P,type:"text",inputMode:"numeric",pattern:"\\d{2}\\.\\d{2}\\.\\d{4}",maxLength:10,value:R,readOnly:g,placeholder:x,id:y,name:U,required:B,disabled:c,onClick:O,onChange:re,onFocus:S,onBlur:I,autoComplete:Q,"aria-label":F,"aria-labelledby":t,"aria-describedby":p,"aria-invalid":!!W,className:oe,...se}),l&&u.jsx("button",{type:"button",className:ie,onClick:c?void 0:s,tabIndex:s&&!c?0:-1,"aria-hidden":!s,disabled:c,"aria-label":s?"Åpne datovelger":void 0,children:l})]}),W&&u.jsx("p",{id:d,className:A.error,role:"alert",children:W})]})});je.displayName="DateInput";const pt=o.Details,kt=o.Dialog,wt=o.Divider,Ct=o.Dropdown,_t=o.ErrorSummary,gt=o.Field,Te=o.FieldDescription,ye=o.FieldCounter;Te.displayName="Field.Description",ye.displayName="Field.Counter";const Pt=o.Fieldset,Et=o.Input,jt=o.Link,Tt=o.List,yt=o.Pagination,Nt=o.usePagination,St=o.Popover,Mt=o.Radio,Dt=o.useRadioGroup,xt=o.Search,Ot=o.Select,Wt=o.Skeleton,At=o.SkipLink,Bt=o.Spinner,It=o.Switch,Lt=o.Table,Rt=o.Tabs,Yt=o.Tag,Vt=o.Textarea,Ft=o.Textfield,Ht=o.ToggleGroup,zt=o.Tooltip;a.Alert=fe,a.Avatar=me,a.Badge=he,a.BadgePosition=De,a.Breadcrumbs=xe,a.BreadcrumbsItem=We,a.BreadcrumbsLink=Ae,a.BreadcrumbsList=Oe,a.Button=be,a.Card=ve,a.CardBlock=Be,a.Checkbox=pe,a.Chip=Re,a.DateInput=je,a.DatePicker=_e,a.Details=pt,a.Dialog=kt,a.Divider=wt,a.Dropdown=Ct,a.ErrorSummary=_t,a.Field=gt,a.FieldCounter=ye,a.FieldDescription=Te,a.Fieldset=Pt,a.Input=Et,a.Link=jt,a.List=Tt,a.Pagination=yt,a.Popover=St,a.Radio=Mt,a.Search=xt,a.Select=Ot,a.SkeletonLoader=Wt,a.SkipLink=At,a.Spinner=Bt,a.Switch=It,a.Table=Lt,a.Tabs=Rt,a.Tag=Yt,a.Textarea=Vt,a.Textfield=Ft,a.ToggleGroup=Ht,a.Tooltip=zt,a.useCheckboxGroup=Le,a.usePagination=Nt,a.useRadioGroup=Dt,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/index.d.ts
CHANGED
|
@@ -57,6 +57,7 @@ import { Popover } from './components/Popover';
|
|
|
57
57
|
import { PopoverProps } from './components/Popover';
|
|
58
58
|
import { Radio } from './components/Radio';
|
|
59
59
|
import { RadioProps } from './components/Radio';
|
|
60
|
+
import { ReactNode } from 'react';
|
|
60
61
|
import { Search } from './components/Search';
|
|
61
62
|
import { SearchProps } from './components/Search';
|
|
62
63
|
import { Select } from './components/Select';
|
|
@@ -87,11 +88,15 @@ import { useRadioGroup } from './components/Radio';
|
|
|
87
88
|
export declare const Alert: React.ForwardRefExoticComponent<AlertProps & React.RefAttributes<HTMLDivElement>>;
|
|
88
89
|
|
|
89
90
|
export declare interface AlertProps extends AlertProps_2 {
|
|
91
|
+
children?: ReactNode;
|
|
90
92
|
}
|
|
91
93
|
|
|
92
94
|
export declare const Avatar: React.ForwardRefExoticComponent<AvatarProps & React.RefAttributes<HTMLDivElement>>;
|
|
93
95
|
|
|
94
96
|
export declare interface AvatarProps extends AvatarProps_2 {
|
|
97
|
+
children?: ReactNode;
|
|
98
|
+
initials?: string;
|
|
99
|
+
variant?: 'circle' | 'square';
|
|
95
100
|
}
|
|
96
101
|
|
|
97
102
|
export { Badge }
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 803.8 250.4">
|
|
3
|
+
<defs>
|
|
4
|
+
<style>.d{fill:#fff;}.e{fill:#d52b1e;}</style>
|
|
5
|
+
</defs>
|
|
6
|
+
<g id="a">
|
|
7
|
+
<rect class="d" x=".1" y=".1" width="803" height="250.2"/>
|
|
8
|
+
</g>
|
|
9
|
+
<g id="b">
|
|
10
|
+
<g>
|
|
11
|
+
<path d="m248.7,72.6c5.6-.9,14-1.6,23.3-1.6s19.5,1.7,25.1,6.1c4.6,3.7,7.1,9.1,7.1,16.2s-7,16.7-13.7,19.1v.3c5.4,2.2,8.4,7.4,10.3,14.5,2.4,8.7,4.8,18.8,6.3,21.8h-17.9c-1.3-2.2-3.1-8.5-5.4-18-2.1-9.7-5.4-12.3-12.5-12.4h-5.3v30.5h-17.4v-76.4Zm17.4,33.3h6.9c8.7,0,13.9-4.4,13.9-11.1s-4.8-10.7-12.9-10.8c-4.3,0-6.7.3-7.9.6v21.4Z"/><path d="m356,94.5l5.4-7.9,6.1,4.3-5.2,7.7c6,5.2,9.4,12.8,9.4,22.2,0,20-14.7,29.5-29.3,29.5s-9.4-.9-13.3-3l-5.6,8.2-5.7-4.6,5.1-7.5c-6.1-4.9-9.8-12.5-9.8-22.4,0-17.7,12-29.4,29.3-29.4s9.8.9,13.7,3Zm-7.5,11.5c-1.7-1.3-3.7-2.1-6.2-2.1-9.1,0-12.5,9.1-12.5,16.9s.6,6.4,2.1,9h.2c0,.1,16.4-23.8,16.4-23.8Zm-12.1,29.7c1.6,1.5,3.7,2.1,5.9,2.1,7.8,0,12.5-6.7,12.5-16.5s-.5-6.1-1.7-8.7h-.3c0-.1-16.3,23.2-16.3,23.2Z"/><path d="m437.4,67.4v64.8c0,6.3.2,13,.5,16.8h-15.5l-.8-8.3h-.2c-3.6,6.3-10.3,9.5-17.6,9.5-13.3,0-24-11.4-24-28.8-.1-19,11.7-29.9,25.2-29.9s12.3,2.4,14.8,6.3h.2v-30.5h17.5Zm-17.5,49.2c0-.9-.1-2.2-.2-3.1-1-4.7-4.8-8.6-10.2-8.6-7.9,0-12.1,7.1-12.1,16s4.7,15.5,12,15.5,9.1-3.4,10.1-8.4c.3-1.3.5-2.5.5-4v-7.4Z"/><path d="m464.8,126.5c.6,7.2,7.7,10.7,15.9,10.7s10.8-.8,15.5-2.3l2.3,11.8c-5.7,2.3-12.8,3.4-20.3,3.4-19.1,0-30-11-30-28.6s8.8-30,28.4-30,25.1,14.1,25.1,28-.3,5.6-.6,6.9h-36.2Zm20.6-12c0-4.3-1.8-11.4-9.9-11.4s-10.3,6.7-10.8,11.4h20.7Z"/><path d="m535.9,71.6h17.4v34.2h.3c1.7-3,3.6-5.7,5.3-8.5l17.6-25.7h21.5l-25.6,33,27,44.5h-20.5l-19-33.4-6.7,8.2v25.3h-17.4v-77.5Z"/><path d="m659.4,120.3c0,20.6-14.6,30-29.7,30s-29.1-10.8-29.1-29,12-29.8,30-29.8,28.7,11.8,28.7,28.7Zm-40.7.6c0,9.7,4,16.9,11.5,16.9s11.1-6.8,11.1-16.9-3.2-16.9-11.1-16.9-11.5,8.6-11.5,16.9Z"/><path d="m670.2,111.3c0-8.3-.2-13.7-.5-18.5h15.1l.6,10.3h.5c2.9-8.2,9.8-11.6,15.2-11.6s2.4,0,3.7.2v16.4c-1.3-.2-2.8-.5-4.7-.5-6.4,0-10.8,3.4-12,8.8-.2,1.1-.3,2.5-.3,3.9v28.5h-17.5v-37.7Z"/><path d="m713.8,133.7c3.2,2,9.9,4.3,15.1,4.3s7.5-1.8,7.5-4.7-1.7-4.3-8.3-6.4c-11.6-3.9-16.1-10.2-16-16.9,0-10.5,9-18.4,22.9-18.4s12.4,1.5,15.9,3.2l-3.1,12.1c-2.5-1.4-7.4-3.2-12.2-3.2s-6.7,1.7-6.7,4.6,2.2,4,9.1,6.4c10.7,3.7,15.2,9.1,15.3,17.4,0,10.5-8.3,18.2-24.4,18.2s-13.9-1.6-18.2-3.9l3.1-12.5Z"/></g></g><g id="c"><rect class="e" x="99.7" y="50.1" width="50" height="150"/><rect class="e" x="49.7" y="100.1" width="150" height="50"/></g></svg>
|
package/dist/rk-designsystem.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._calendarContainer_160wn_3{display:inline-flex;padding:var(--ds-size-8, 32px);flex-direction:column;align-items:flex-start;gap:var(--ds-size-3, 12px);border:1px solid var(--ds-color-neutral-border-subtle, #ccc);border-radius:var(--ds-border-radius-md, 4px);background-color:var(--ds-color-neutral-background-default, #fff);font-family:var(--ds-font-family, sans-serif);color:var(--ds-color-neutral-text-default)}._calendarHeader_160wn_17{display:flex;justify-content:space-between;align-items:center;align-self:stretch}._monthYear_160wn_24{color:var(--ds-color-neutral-text-default, #2b2b2b);font-family:var(--ds-font-family, "Myriad VF", sans-serif);font-size:var(--ds-heading-sm-font-size, 1.5rem);font-style:normal;font-weight:var(--ds-heading-sm-font-weight, 500);line-height:var(--ds-heading-sm-line-height, 1.3);letter-spacing:var(--ds-heading-sm-letter-spacing, 0%);margin:0}._navigationButtons_160wn_36{display:flex;gap:var(--ds-size-1, 4px)}._navigationButtons_160wn_36>button:disabled svg{opacity:var(--ds-opacity-disabled, .3)}._grid_160wn_45{display:grid;grid-template-columns:repeat(7,1fr);width:100%;text-align:center}._dayNameCell_160wn_53{display:flex;padding:var(--ds-size-2, 8px);flex-direction:column;justify-content:center;align-items:center;color:var(--ds-color-neutral-text-default, #2b2b2b);text-align:center;font-family:var(--ds-font-family, "Myriad VF", sans-serif);font-size:var(--ds-body-xs-font-size, 14px);font-style:normal;font-weight:var(--ds-font-weight-semibold, 600);line-height:var(--ds-body-short-xs-line-height, 1.3);letter-spacing:var(--ds-body-xs-letter-spacing, .021px);box-sizing:border-box}._dateCell_160wn_72{display:flex;padding:var(--ds-size-5, 22px);flex-direction:column;justify-content:center;align-items:center;border:var(--ds-border-width-default, 1px) solid var(--ds-color-neutral-border-subtle, #bcbcbc);box-sizing:border-box;margin:-.5px;font-family:var(--ds-font-family, "Myriad VF", sans-serif);color:var(--ds-color-neutral-text-default, #2b2b2b);text-align:center;font-size:var(--ds-body-xs-font-size, 14px);font-style:normal;font-weight:var(--ds-body-xs-font-weight, 400);line-height:var(--ds-body-short-xs-line-height, 1.3);letter-spacing:var(--ds-body-xs-letter-spacing, .021px);font-feature-settings:"tnum" 1;-webkit-font-feature-settings:"tnum" 1;-moz-font-feature-settings:"tnum" 1;cursor:pointer;transition:background-color .15s ease-in-out,border-color .15s ease-in-out;-webkit-user-select:none;user-select:none}._dateNumberContainer_160wn_107{display:flex;justify-content:center;align-items:center;width:24px;height:24px;border-radius:50%;transition:color .15s ease-in-out,font-weight .15s ease-in-out;line-height:1;box-sizing:border-box;background-color:transparent}._dateCell_160wn_72:hover:not(._otherMonth_160wn_125):not(._disabled_160wn_125){background-color:var(--ds-color-neutral-surface-hover, #eee);position:relative;z-index:1}._dateCell_160wn_72:hover:not(._otherMonth_160wn_125):not(._disabled_160wn_125) ._dateNumberContainer_160wn_107{background-color:transparent}._otherMonth_160wn_125{color:var(--ds-color-neutral-text-subtle, #aaa);cursor:default;pointer-events:none;background-color:var(--ds-color-neutral-surface-tinted, #e8e8e8);border:var(--ds-border-width-default, 1px) solid var(--ds-color-neutral-border-subtle, #bcbcbc);margin:-.5px}._otherMonth_160wn_125 ._dateNumberContainer_160wn_107{color:var(--ds-color-neutral-text-subtle, #aaa);background-color:transparent;box-shadow:none}._selectedDate_160wn_157{background-color:var(--ds-color-primary-brand-base-active, #8e1d14);border-color:var(--ds-color-primary-brand-base-active, #8e1d14);color:var(--ds-color-primary-brand-base-contrast-default, #fff);position:relative;z-index:1}._selectedDate_160wn_157 ._dateNumberContainer_160wn_107{color:var(--ds-color-primary-brand-base-contrast-default, #fff);font-weight:var(--ds-font-weight-semibold, 600);background-color:transparent;box-shadow:none}._fieldset_17wt1_4{margin-bottom:var(--ds-spacing-4, 16px)}._fieldset_17wt1_4 label{display:block;margin-bottom:var(--ds-spacing-1, 4px);font-weight:var(--ds-font-weight-medium, 500);color:var(--ds-color-neutral-text-default, #2b2b2b)}._description_17wt1_15{font-size:var(--ds-font-size-sm, 14px);color:var(--ds-color-neutral-text-subtle, #5d5d5d);margin-top:var(--ds-spacing-1, 4px);margin-bottom:var(--ds-spacing-2, 8px)}._error_17wt1_22{font-size:var(--ds-font-size-sm, 14px);color:var(--ds-color-danger-text-default, #c30000);margin-top:var(--ds-spacing-1, 4px)}._inputWrapper_17wt1_30{display:flex;align-items:stretch;width:100%;position:relative;border:var(--ds-border-width-default, 1px) solid var(--ds-color-neutral-border-default, #797979);border-radius:var(--ds-border-radius-md, 4px);overflow:hidden;transition:border-color .1s ease-out,outline .1s ease-out}._inputWrapperError_17wt1_42{border-color:var(--ds-color-danger-border-default, #c30000)}._inputWrapper_17wt1_30:focus-within{outline:var(--ds-border-width-focus, 3px) solid var(--ds-color-focus-outer, #2B2B2B);outline-offset:var(--ds-focus-outline-offset, 2px)}._inputWrapper_17wt1_30 input{box-sizing:border-box;flex-grow:1;width:auto;min-width:0;background-color:var(--ds-color-neutral-background-default, #fff);color:var(--ds-color-neutral-text-default, #2b2b2b);border:none;border-radius:0;outline:none;padding:var(--ds-size-2, 8px) var(--ds-size-3, 12px);font-family:inherit;font-size:inherit;-moz-appearance:none;appearance:none;-webkit-appearance:none}._inputWrapper_17wt1_30 input:disabled{opacity:var(--ds-opacity-disabled, .5);cursor:not-allowed;background-color:var(--ds-color-neutral-surface-subtle, #f0f0f0);color:var(--ds-color-neutral-text-subtle, #5d5d5d)}._suffixButton_17wt1_100{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;padding:0 var(--ds-size-3, 12px);margin:0;border:none;border-radius:0;border-left:var(--ds-border-width-default, 1px) solid var(--ds-color-neutral-border-default, #797979);background-color:var(--ds-color-neutral-surface-tinted, #e8e8e8);color:var(--ds-color-neutral-text-subtle, #5d5d5d);font-size:1.25rem;box-sizing:border-box;cursor:default;transition:background-color .15s ease-out,border-color .15s ease-out,color .15s ease-out;position:relative;z-index:0}._suffixButtonInteractive_17wt1_120{cursor:pointer}._suffixButtonInteractive_17wt1_120:hover:not(:disabled){color:var(--ds-color-neutral-text-default, #2b2b2b);background-color:var(--ds-color-neutral-surface-hover, #dadada)}._suffixButton_17wt1_100:disabled{opacity:var(--ds-opacity-disabled, .3);cursor:not-allowed;background-color:var(--ds-color-neutral-surface-tinted, #e8e8e8);border-left-color:var(--ds-color-neutral-border-default, #797979)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rk-designsystem",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "A React component library built on top of Digdir Design System",
|
|
5
5
|
"author": "daniel@tunetek.no",
|
|
6
6
|
"license": "MIT",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"scripts": {
|
|
52
52
|
"dev": "vite",
|
|
53
53
|
"build": "vite build",
|
|
54
|
-
"clean": "
|
|
54
|
+
"clean": "rimraf dist",
|
|
55
55
|
"changeset": "changeset",
|
|
56
56
|
"lint": "eslint .",
|
|
57
57
|
"preview": "vite preview",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"storybook": "storybook dev -p 6006",
|
|
63
63
|
"build-storybook": "storybook build --output-dir storybook-build",
|
|
64
64
|
"predeploy:storybook": "npm run build-storybook && npm run copy-metadata",
|
|
65
|
-
"copy-metadata": "
|
|
65
|
+
"copy-metadata": "cp metadata.json storybook-build/metadata.json",
|
|
66
66
|
"deploy:storybook": "gh-pages -d storybook-build -b gh-pages -r https://github.com/norwegianredcross/DesignSystem.git --dest storybook"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
"@storybook/addon-a11y": "^9.1.0",
|
|
77
77
|
"@storybook/addon-docs": "^9.1.0",
|
|
78
78
|
"@storybook/addon-links": "^9.1.0",
|
|
79
|
-
"@storybook/addon-onboarding": "^9.0
|
|
80
|
-
"@storybook/react-vite": "^9.0
|
|
79
|
+
"@storybook/addon-onboarding": "^9.1.0",
|
|
80
|
+
"@storybook/react-vite": "^9.1.0",
|
|
81
81
|
"@types/react": "^19.0.10",
|
|
82
82
|
"@types/react-dom": "^19.0.4",
|
|
83
83
|
"@vitejs/plugin-react": "^4.3.4",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"eslint": "^9.21.0",
|
|
88
88
|
"eslint-plugin-react-hooks": "^5.1.0",
|
|
89
89
|
"eslint-plugin-react-refresh": "^0.4.19",
|
|
90
|
-
"eslint-plugin-storybook": "^9.0
|
|
90
|
+
"eslint-plugin-storybook": "^9.1.0",
|
|
91
91
|
"gh-pages": "^6.3.0",
|
|
92
92
|
"glob": "^11.0.3",
|
|
93
93
|
"globals": "^15.15.0",
|
|
@@ -96,7 +96,8 @@
|
|
|
96
96
|
"react": "^19.0.0",
|
|
97
97
|
"react-docgen-typescript": "^2.4.0",
|
|
98
98
|
"react-dom": "^19.0.0",
|
|
99
|
-
"
|
|
99
|
+
"rimraf": "^6.0.1",
|
|
100
|
+
"storybook": "^9.1.0",
|
|
100
101
|
"typescript": "~5.7.2",
|
|
101
102
|
"typescript-eslint": "^8.24.1",
|
|
102
103
|
"vite": "^6.2.0",
|