@obosbbl/grunnmuren-react 2.0.0-canary.2 → 2.0.0-canary.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +138 -0
- package/dist/index.d.mts +371 -14
- package/dist/index.mjs +459 -93
- package/package.json +4 -2
- package/dist/useClientLayoutEffect-client-2_5nawgR.js +0 -9
package/README.md
CHANGED
|
@@ -14,6 +14,144 @@ npm install @obosbbl/grunnmuren-react@canary
|
|
|
14
14
|
pnpm add @obosbbl/grunnmuren-react@canary
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
## Setup
|
|
18
|
+
|
|
19
|
+
### Internationalization
|
|
20
|
+
|
|
21
|
+
Grunnmuren uses [React Aria Components](https://react-spectrum.adobe.com/react-aria/) under the hood. RAC has built in translation strings for non visible content (for accessibility reasons). It also automatically detects the language based on the browser or system language.
|
|
22
|
+
|
|
23
|
+
To ensure that the language of the page content matches the accessibility strings you must wrap your application in a `GrunnmurenProvider` with a `locale` prop. This will override RAC's automatic locale selection.
|
|
24
|
+
|
|
25
|
+
In [Next.js](https://nextjs.org/) you can do this in the root [root layout](https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts#root-layout-required). In order to avoid making `RootLayout` a client component, you should import `GrunnmurenProvider` in a providers-file, that uses `"use client"`
|
|
26
|
+
|
|
27
|
+
Valid locales are `nb`, `sv` or `en`. The provider defaults to `nb` if unspecified.
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
// app/providers.tsx
|
|
31
|
+
'use client'
|
|
32
|
+
import { GrunnmurenProvider } from '@obosbbl/grunnmuren-react';
|
|
33
|
+
|
|
34
|
+
export function Providers({children, locale}: { children: React.ReactNode, locale: 'nb' | 'sv' | 'en'}) {
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<GrunnmurenProvider locale={locale}>
|
|
38
|
+
{children}
|
|
39
|
+
</GrunnmurenProvider>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
// app/layout.tsx
|
|
46
|
+
|
|
47
|
+
export default function RootLayout({
|
|
48
|
+
children,
|
|
49
|
+
}: {
|
|
50
|
+
children: React.ReactNode
|
|
51
|
+
}) {
|
|
52
|
+
|
|
53
|
+
// Either 'nb', 'sv' or 'en'
|
|
54
|
+
const locale = 'nb';
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<Providers locale={locale}>
|
|
58
|
+
<html lang={locale}>
|
|
59
|
+
<body>{children}</body>
|
|
60
|
+
</html>
|
|
61
|
+
</Providers>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
See the [RAC internationalization docs](https://react-spectrum.adobe.com/react-aria/internationalization.html) for more information.
|
|
67
|
+
|
|
68
|
+
### Routing
|
|
69
|
+
|
|
70
|
+
When using compontents that include links from RAC (For example `Breadcrumbs`), the links will always treat the hrefs as external.
|
|
71
|
+
|
|
72
|
+
In order to avoid hard refreshing, you need to prop your router navigation-function
|
|
73
|
+
through `GrunnmurenProvider`. See the [RAC routing docs](https://react-spectrum.adobe.com/react-aria/routing.html)
|
|
74
|
+
|
|
75
|
+
In [Next.js](https://nextjs.org/) this is also done in the root [root layout](https://nextjs.org/docs/app/building-your-application/routing/pages-and-layouts#root-layout-required). In order to avoid making `RootLayout` a client component, you should import `GrunnmurenProvider` in a providers-file, that uses `"use client"`
|
|
76
|
+
|
|
77
|
+
```js
|
|
78
|
+
// app/providers.tsx
|
|
79
|
+
'use client'
|
|
80
|
+
import { GrunnmurenProvider } from '@obosbbl/grunnmuren-react';
|
|
81
|
+
import { useRouter } from 'next/navigation';
|
|
82
|
+
|
|
83
|
+
export function Providers({children, locale}: { children: React.ReactNode, locale: string}) {
|
|
84
|
+
let router = useRouter();
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<GrunnmurenProvider locale={locale} navigate={router.push}>
|
|
88
|
+
{children}
|
|
89
|
+
</GrunnmurenProvider>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
The `RootLayout` file then looks exactly like it does in the previous step:
|
|
95
|
+
|
|
96
|
+
```js
|
|
97
|
+
// app/layout.tsx
|
|
98
|
+
import {Providers} from "./providers";
|
|
99
|
+
|
|
100
|
+
export default function RootLayout({
|
|
101
|
+
children,
|
|
102
|
+
}: {
|
|
103
|
+
children: React.ReactNode
|
|
104
|
+
}) {
|
|
105
|
+
|
|
106
|
+
// Either 'nb', 'sv' or 'en'
|
|
107
|
+
const locale = 'nb';
|
|
108
|
+
|
|
109
|
+
return (
|
|
110
|
+
<Providers locale={locale}>
|
|
111
|
+
<html lang={locale}>
|
|
112
|
+
<body>{children}</body>
|
|
113
|
+
</html>
|
|
114
|
+
</Providers>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Optimize bundle size by removing unused locales
|
|
120
|
+
|
|
121
|
+
React Aria Components has built in support for over 30 languages, most of which will be unused in your application. To optimize your applications bundle size, it is recommended to use React Aria's build plugin to remove all the unused locales. Here is a quick example for Next.js:
|
|
122
|
+
|
|
123
|
+
#### Install
|
|
124
|
+
|
|
125
|
+
```sh
|
|
126
|
+
# npm
|
|
127
|
+
npm install @react-aria/optimize-locales-plugin --save-dev
|
|
128
|
+
|
|
129
|
+
# pnpm
|
|
130
|
+
pnpm add -D @react-aria/optimize-locales-plugin
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
#### Configuration
|
|
134
|
+
|
|
135
|
+
```js
|
|
136
|
+
// next.config.js
|
|
137
|
+
const optimizeLocales = require('@react-aria/optimize-locales-plugin');
|
|
138
|
+
|
|
139
|
+
module.exports = {
|
|
140
|
+
webpack(config) {
|
|
141
|
+
config.plugins.push(
|
|
142
|
+
optimizeLocales.webpack({
|
|
143
|
+
// If you have a multitenant app, include both Norwegian and Swedish
|
|
144
|
+
// If your app only serves one language, adjust accordingly
|
|
145
|
+
locales: ['nb', 'sv'],
|
|
146
|
+
}),
|
|
147
|
+
);
|
|
148
|
+
return config;
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
The plugin works with several different bundlers. See [React Aria's bundle size optimization docs](https://react-spectrum.adobe.com/react-aria/internationalization.html#optimizing-bundle-size) for more information.
|
|
154
|
+
|
|
17
155
|
## Usage
|
|
18
156
|
|
|
19
157
|
Before you start using the components you need to configure the [Tailwind preset](../tailwind/). Remember to add this package to the content scan.
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,45 @@
|
|
|
1
|
-
import { CheckboxProps as CheckboxProps$1, CheckboxGroupProps as CheckboxGroupProps$1,
|
|
1
|
+
import { CheckboxProps as CheckboxProps$1, CheckboxGroupProps as CheckboxGroupProps$1, ListBoxItemProps, ComboBoxProps, RadioGroupProps as RadioGroupProps$1, RadioProps as RadioProps$1, SelectProps as SelectProps$1, TextFieldProps as TextFieldProps$1, NumberFieldProps as NumberFieldProps$1, ContextValue, BreadcrumbProps as BreadcrumbProps$1, BreadcrumbsProps as BreadcrumbsProps$1 } from 'react-aria-components';
|
|
2
2
|
export { ListBoxItemProps as ComboboxItemProps, Form, ListBoxItemProps as SelectItemProps } from 'react-aria-components';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import * as react from 'react';
|
|
5
|
+
import react__default, { HTMLProps, ForwardedRef } from 'react';
|
|
4
6
|
import { VariantProps } from 'cva';
|
|
5
7
|
|
|
8
|
+
type GrunnmurenProviderProps = {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* The locale to apply to the children.
|
|
12
|
+
* @default nb
|
|
13
|
+
*/
|
|
14
|
+
locale?: 'nb' | 'sv' | 'en';
|
|
15
|
+
/** The router to use for navigation */
|
|
16
|
+
navigate?: (path: string) => void;
|
|
17
|
+
};
|
|
18
|
+
declare function GrunnmurenProvider({ children, locale, navigate, }: GrunnmurenProviderProps): react_jsx_runtime.JSX.Element;
|
|
19
|
+
|
|
20
|
+
type AccordionProps = {
|
|
21
|
+
children: react__default.ReactNode;
|
|
22
|
+
/** Additional CSS className for the element. */
|
|
23
|
+
className?: string;
|
|
24
|
+
/** Additional style properties for the element. */
|
|
25
|
+
style?: react__default.CSSProperties;
|
|
26
|
+
};
|
|
27
|
+
type AccordionItemProps = {
|
|
28
|
+
children?: react__default.ReactNode;
|
|
29
|
+
/** Additional CSS className for the element. */
|
|
30
|
+
className?: string;
|
|
31
|
+
/** Additional style properties for the element. */
|
|
32
|
+
style?: react__default.CSSProperties;
|
|
33
|
+
/** Whether the accordion is open (controlled) */
|
|
34
|
+
isOpen?: boolean;
|
|
35
|
+
/** Whether the accordion is open by default (uncontrolled) */
|
|
36
|
+
defaultOpen?: boolean;
|
|
37
|
+
/** Handler that is called when the accordion's open state changes */
|
|
38
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
39
|
+
};
|
|
40
|
+
declare const _Accordion: react__default.ForwardRefExoticComponent<AccordionProps & react__default.RefAttributes<HTMLDivElement>>;
|
|
41
|
+
declare const _AccordionItem: react__default.ForwardRefExoticComponent<AccordionItemProps & react__default.RefAttributes<HTMLDivElement>>;
|
|
42
|
+
|
|
6
43
|
/**
|
|
7
44
|
* Figma: https://www.figma.com/file/9OvSg0ZXI5E1eQYi7AWiWn/Grunnmuren-2.0-%E2%94%82-Designsystem?node-id=30%3A2574&mode=dev
|
|
8
45
|
*/
|
|
@@ -77,10 +114,10 @@ type ButtonProps = VariantProps<typeof buttonVariants> & {
|
|
|
77
114
|
* Display the button in a loading state
|
|
78
115
|
* @default false
|
|
79
116
|
*/
|
|
80
|
-
|
|
117
|
+
isLoading?: boolean;
|
|
81
118
|
style?: React.CSSProperties;
|
|
82
119
|
} & ButtonOrLinkProps;
|
|
83
|
-
declare
|
|
120
|
+
declare const _Button: react.ForwardRefExoticComponent<ButtonProps & react.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
|
84
121
|
|
|
85
122
|
type CheckboxProps = {
|
|
86
123
|
children: React.ReactNode;
|
|
@@ -93,7 +130,17 @@ type CheckboxProps = {
|
|
|
93
130
|
/** Additional style properties for the element. */
|
|
94
131
|
style?: React.CSSProperties;
|
|
95
132
|
} & Omit<CheckboxProps$1, 'isDisabled' | 'style' | 'children' | 'isIndeterminate' | 'isReadOnly'>;
|
|
96
|
-
declare
|
|
133
|
+
declare const _Checkbox: react.ForwardRefExoticComponent<{
|
|
134
|
+
children: React.ReactNode;
|
|
135
|
+
/** Additional CSS className for the element. */
|
|
136
|
+
className?: string | undefined;
|
|
137
|
+
/** Help text for the form control. */
|
|
138
|
+
description?: React.ReactNode;
|
|
139
|
+
/** Error message for the form control. Automatically sets `isInvalid` to true */
|
|
140
|
+
errorMessage?: React.ReactNode;
|
|
141
|
+
/** Additional style properties for the element. */
|
|
142
|
+
style?: react.CSSProperties | undefined;
|
|
143
|
+
} & Omit<CheckboxProps$1, "children" | "style" | "isDisabled" | "isIndeterminate" | "isReadOnly"> & react.RefAttributes<HTMLLabelElement>>;
|
|
97
144
|
|
|
98
145
|
type CheckboxGroupProps = {
|
|
99
146
|
children: React.ReactNode;
|
|
@@ -108,7 +155,21 @@ type CheckboxGroupProps = {
|
|
|
108
155
|
/** Additional style properties for the element. */
|
|
109
156
|
style?: React.CSSProperties;
|
|
110
157
|
} & Omit<CheckboxGroupProps$1, 'className' | 'isReadOnly' | 'isDisabled' | 'children' | 'style' | 'orientation'>;
|
|
111
|
-
declare
|
|
158
|
+
declare const _CheckboxGroup: react.ForwardRefExoticComponent<{
|
|
159
|
+
children: React.ReactNode;
|
|
160
|
+
/** Additional CSS className for the element. */
|
|
161
|
+
className?: string | undefined;
|
|
162
|
+
/** Help text for the form control. */
|
|
163
|
+
description?: React.ReactNode;
|
|
164
|
+
/** Error message for the form control. Automatically sets `isInvalid` to true */
|
|
165
|
+
errorMessage?: React.ReactNode;
|
|
166
|
+
/** Label for the form control. */
|
|
167
|
+
label?: React.ReactNode;
|
|
168
|
+
/** Additional style properties for the element. */
|
|
169
|
+
style?: react.CSSProperties | undefined;
|
|
170
|
+
} & Omit<CheckboxGroupProps$1, "children" | "className" | "style" | "isDisabled" | "isReadOnly" | "orientation"> & react.RefAttributes<HTMLDivElement>>;
|
|
171
|
+
|
|
172
|
+
declare const ListBoxItem: (props: ListBoxItemProps) => react_jsx_runtime.JSX.Element;
|
|
112
173
|
|
|
113
174
|
type ComboboxProps<T extends object> = {
|
|
114
175
|
children: React.ReactNode;
|
|
@@ -130,8 +191,26 @@ type ComboboxProps<T extends object> = {
|
|
|
130
191
|
/** Additional style properties for the element. */
|
|
131
192
|
style?: React.CSSProperties;
|
|
132
193
|
} & Omit<ComboBoxProps<T>, 'className' | 'isReadOnly' | 'isDisabled' | 'children' | 'style'>;
|
|
133
|
-
declare
|
|
134
|
-
|
|
194
|
+
declare const _Combobox: react.ForwardRefExoticComponent<{
|
|
195
|
+
children: React.ReactNode;
|
|
196
|
+
/** Additional CSS className for the element. */
|
|
197
|
+
className?: string | undefined;
|
|
198
|
+
/** Help text for the form control. */
|
|
199
|
+
description?: React.ReactNode;
|
|
200
|
+
/** Error message for the form control. Automatically sets `isInvalid` to true */
|
|
201
|
+
errorMessage?: React.ReactNode;
|
|
202
|
+
/**
|
|
203
|
+
* Display the dropdown button trigger in a loading state
|
|
204
|
+
* @default false
|
|
205
|
+
*/
|
|
206
|
+
isLoading?: boolean | undefined;
|
|
207
|
+
/** Label for the form control. */
|
|
208
|
+
label?: React.ReactNode;
|
|
209
|
+
/** Placeholder text. Only visible when the input value is empty. */
|
|
210
|
+
placeholder?: string | undefined;
|
|
211
|
+
/** Additional style properties for the element. */
|
|
212
|
+
style?: react.CSSProperties | undefined;
|
|
213
|
+
} & Omit<ComboBoxProps<object>, "children" | "className" | "style" | "isDisabled" | "isReadOnly"> & react.RefAttributes<HTMLInputElement>>;
|
|
135
214
|
|
|
136
215
|
type RadioGroupProps = {
|
|
137
216
|
children: React.ReactNode;
|
|
@@ -146,7 +225,19 @@ type RadioGroupProps = {
|
|
|
146
225
|
/** Additional style properties for the element. */
|
|
147
226
|
style?: React.CSSProperties;
|
|
148
227
|
} & Omit<RadioGroupProps$1, 'className' | 'isReadOnly' | 'isDisabled' | 'children' | 'style' | 'orientation'>;
|
|
149
|
-
declare
|
|
228
|
+
declare const _RadioGroup: react.ForwardRefExoticComponent<{
|
|
229
|
+
children: React.ReactNode;
|
|
230
|
+
/** Additional CSS className for the element. */
|
|
231
|
+
className?: string | undefined;
|
|
232
|
+
/** Help text for the form control. */
|
|
233
|
+
description?: React.ReactNode;
|
|
234
|
+
/** Error message for the form control. Automatically sets `isInvalid` to true */
|
|
235
|
+
errorMessage?: React.ReactNode;
|
|
236
|
+
/** Label for the form control. */
|
|
237
|
+
label?: React.ReactNode;
|
|
238
|
+
/** Additional style properties for the element. */
|
|
239
|
+
style?: react.CSSProperties | undefined;
|
|
240
|
+
} & Omit<RadioGroupProps$1, "children" | "className" | "style" | "isDisabled" | "isReadOnly" | "orientation"> & react.RefAttributes<HTMLDivElement>>;
|
|
150
241
|
|
|
151
242
|
type RadioProps = {
|
|
152
243
|
children: React.ReactNode;
|
|
@@ -157,7 +248,15 @@ type RadioProps = {
|
|
|
157
248
|
/** Additional style properties for the element. */
|
|
158
249
|
style?: React.CSSProperties;
|
|
159
250
|
} & Omit<RadioProps$1, 'isDisabled' | 'children' | 'style'>;
|
|
160
|
-
declare
|
|
251
|
+
declare const _Radio: react.ForwardRefExoticComponent<{
|
|
252
|
+
children: React.ReactNode;
|
|
253
|
+
/** Additional CSS className for the element. */
|
|
254
|
+
className?: string | undefined;
|
|
255
|
+
/** Help text for the form control. */
|
|
256
|
+
description?: React.ReactNode;
|
|
257
|
+
/** Additional style properties for the element. */
|
|
258
|
+
style?: react.CSSProperties | undefined;
|
|
259
|
+
} & Omit<RadioProps$1, "children" | "style" | "isDisabled"> & react.RefAttributes<HTMLLabelElement>>;
|
|
161
260
|
|
|
162
261
|
type SelectProps<T extends object> = {
|
|
163
262
|
children: React.ReactNode;
|
|
@@ -174,8 +273,21 @@ type SelectProps<T extends object> = {
|
|
|
174
273
|
/** Additional style properties for the element. */
|
|
175
274
|
style?: React.CSSProperties;
|
|
176
275
|
} & Omit<SelectProps$1<T>, 'className' | 'isReadOnly' | 'isDisabled' | 'children' | 'style'>;
|
|
177
|
-
declare
|
|
178
|
-
|
|
276
|
+
declare const _Select: react.ForwardRefExoticComponent<{
|
|
277
|
+
children: React.ReactNode;
|
|
278
|
+
/** Additional CSS className for the element. */
|
|
279
|
+
className?: string | undefined;
|
|
280
|
+
/** Help text for the form control. */
|
|
281
|
+
description?: React.ReactNode;
|
|
282
|
+
/** Error message for the form control. Automatically sets `isInvalid` to true */
|
|
283
|
+
errorMessage?: React.ReactNode;
|
|
284
|
+
/** Label for the form control. */
|
|
285
|
+
label?: React.ReactNode;
|
|
286
|
+
/** Placeholder text. Only visible when the input value is empty. */
|
|
287
|
+
placeholder?: string | undefined;
|
|
288
|
+
/** Additional style properties for the element. */
|
|
289
|
+
style?: react.CSSProperties | undefined;
|
|
290
|
+
} & Omit<SelectProps$1<object>, "children" | "className" | "style" | "isDisabled" | "isReadOnly"> & react.RefAttributes<HTMLButtonElement>>;
|
|
179
291
|
|
|
180
292
|
type TextAreaProps = {
|
|
181
293
|
/** Additional CSS className for the element. */
|
|
@@ -196,7 +308,25 @@ type TextAreaProps = {
|
|
|
196
308
|
*/
|
|
197
309
|
rows?: number;
|
|
198
310
|
} & Omit<TextFieldProps$1, 'className' | 'isReadOnly' | 'isDisabled' | 'children' | 'style'>;
|
|
199
|
-
declare
|
|
311
|
+
declare const _TextArea: react.ForwardRefExoticComponent<{
|
|
312
|
+
/** Additional CSS className for the element. */
|
|
313
|
+
className?: string | undefined;
|
|
314
|
+
/** Help text for the form control. */
|
|
315
|
+
description?: React.ReactNode;
|
|
316
|
+
/** Error message for the form control. Automatically sets `isInvalid` to true */
|
|
317
|
+
errorMessage?: React.ReactNode;
|
|
318
|
+
/** Label for the form control. */
|
|
319
|
+
label?: React.ReactNode;
|
|
320
|
+
/** Placeholder text. Only visible when the input value is empty. */
|
|
321
|
+
placeholder?: string | undefined;
|
|
322
|
+
/** Additional style properties for the element. */
|
|
323
|
+
style?: react.CSSProperties | undefined;
|
|
324
|
+
/**
|
|
325
|
+
* The number of visible text lines for the control.
|
|
326
|
+
* @default 2
|
|
327
|
+
*/
|
|
328
|
+
rows?: number | undefined;
|
|
329
|
+
} & Omit<TextFieldProps$1, "children" | "className" | "style" | "isDisabled" | "isReadOnly"> & react.RefAttributes<HTMLTextAreaElement>>;
|
|
200
330
|
|
|
201
331
|
type TextFieldProps = {
|
|
202
332
|
/** Additional CSS className for the element. */
|
|
@@ -223,6 +353,233 @@ type TextFieldProps = {
|
|
|
223
353
|
/** Add a divider between the left/right addons and the input */
|
|
224
354
|
withAddonDivider?: boolean;
|
|
225
355
|
} & Omit<TextFieldProps$1, 'className' | 'isReadOnly' | 'isDisabled' | 'children' | 'style'>;
|
|
226
|
-
declare
|
|
356
|
+
declare const _TextField: react.ForwardRefExoticComponent<{
|
|
357
|
+
/** Additional CSS className for the element. */
|
|
358
|
+
className?: string | undefined;
|
|
359
|
+
/** Help text for the form control. */
|
|
360
|
+
description?: React.ReactNode;
|
|
361
|
+
/** Error message for the form control. Automatically sets `isInvalid` to true */
|
|
362
|
+
errorMessage?: React.ReactNode;
|
|
363
|
+
/** Element to be rendered in the left side of the input. */
|
|
364
|
+
leftAddon?: React.ReactNode;
|
|
365
|
+
/** Label for the form control. */
|
|
366
|
+
label?: React.ReactNode;
|
|
367
|
+
/** Element to be rendered in the right side of the input. */
|
|
368
|
+
rightAddon?: React.ReactNode;
|
|
369
|
+
/** Placeholder text. Only visible when the input value is empty. */
|
|
370
|
+
placeholder?: string | undefined;
|
|
371
|
+
/**
|
|
372
|
+
* Text alignment of the input
|
|
373
|
+
* @default left
|
|
374
|
+
*/
|
|
375
|
+
textAlign?: "left" | "right" | undefined;
|
|
376
|
+
/** Additional style properties for the element. */
|
|
377
|
+
style?: react.CSSProperties | undefined;
|
|
378
|
+
/** Add a divider between the left/right addons and the input */
|
|
379
|
+
withAddonDivider?: boolean | undefined;
|
|
380
|
+
} & Omit<TextFieldProps$1, "children" | "className" | "style" | "isDisabled" | "isReadOnly"> & react.RefAttributes<HTMLInputElement>>;
|
|
381
|
+
|
|
382
|
+
type NumberFieldProps = {
|
|
383
|
+
/** Additional CSS className for the element. */
|
|
384
|
+
className?: string;
|
|
385
|
+
/** Help text for the form control. */
|
|
386
|
+
description?: React.ReactNode;
|
|
387
|
+
/** Error message for the form control. Automatically sets `isInvalid` to true */
|
|
388
|
+
errorMessage?: React.ReactNode;
|
|
389
|
+
/** Element to be rendered in the left side of the input. */
|
|
390
|
+
leftAddon?: React.ReactNode;
|
|
391
|
+
/** Label for the form control. */
|
|
392
|
+
label?: React.ReactNode;
|
|
393
|
+
/** Element to be rendered in the right side of the input. */
|
|
394
|
+
rightAddon?: React.ReactNode;
|
|
395
|
+
/** Placeholder text. Only visible when the input value is empty. */
|
|
396
|
+
placeholder?: string;
|
|
397
|
+
/**
|
|
398
|
+
* Text alignment of the input
|
|
399
|
+
* @default left
|
|
400
|
+
*/
|
|
401
|
+
textAlign?: 'left' | 'right';
|
|
402
|
+
/** Additional style properties for the element. */
|
|
403
|
+
style?: React.CSSProperties;
|
|
404
|
+
/** Add a divider between the left/right addons and the input */
|
|
405
|
+
withAddonDivider?: boolean;
|
|
406
|
+
} & Omit<NumberFieldProps$1, 'className' | 'isReadOnly' | 'isDisabled' | 'children' | 'style' | 'hideStepper'>;
|
|
407
|
+
declare const _NumberField: react.ForwardRefExoticComponent<{
|
|
408
|
+
/** Additional CSS className for the element. */
|
|
409
|
+
className?: string | undefined;
|
|
410
|
+
/** Help text for the form control. */
|
|
411
|
+
description?: React.ReactNode;
|
|
412
|
+
/** Error message for the form control. Automatically sets `isInvalid` to true */
|
|
413
|
+
errorMessage?: React.ReactNode;
|
|
414
|
+
/** Element to be rendered in the left side of the input. */
|
|
415
|
+
leftAddon?: React.ReactNode;
|
|
416
|
+
/** Label for the form control. */
|
|
417
|
+
label?: React.ReactNode;
|
|
418
|
+
/** Element to be rendered in the right side of the input. */
|
|
419
|
+
rightAddon?: React.ReactNode;
|
|
420
|
+
/** Placeholder text. Only visible when the input value is empty. */
|
|
421
|
+
placeholder?: string | undefined;
|
|
422
|
+
/**
|
|
423
|
+
* Text alignment of the input
|
|
424
|
+
* @default left
|
|
425
|
+
*/
|
|
426
|
+
textAlign?: "left" | "right" | undefined;
|
|
427
|
+
/** Additional style properties for the element. */
|
|
428
|
+
style?: react.CSSProperties | undefined;
|
|
429
|
+
/** Add a divider between the left/right addons and the input */
|
|
430
|
+
withAddonDivider?: boolean | undefined;
|
|
431
|
+
} & Omit<NumberFieldProps$1, "children" | "className" | "style" | "isDisabled" | "isReadOnly" | "hideStepper"> & react.RefAttributes<HTMLInputElement>>;
|
|
432
|
+
|
|
433
|
+
declare const alertVariants: (props?: ({
|
|
434
|
+
variant?: "info" | "success" | "warning" | "danger" | undefined;
|
|
435
|
+
} & ({
|
|
436
|
+
class?: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
|
|
437
|
+
[x: string]: any;
|
|
438
|
+
} | null | undefined)[] | {
|
|
439
|
+
[x: string]: any;
|
|
440
|
+
} | null | undefined)[] | {
|
|
441
|
+
[x: string]: any;
|
|
442
|
+
} | null | undefined)[] | {
|
|
443
|
+
[x: string]: any;
|
|
444
|
+
} | null | undefined)[] | {
|
|
445
|
+
[x: string]: any;
|
|
446
|
+
} | null | undefined)[] | {
|
|
447
|
+
[x: string]: any;
|
|
448
|
+
} | null | undefined)[] | {
|
|
449
|
+
[x: string]: any;
|
|
450
|
+
} | null | undefined)[] | {
|
|
451
|
+
[x: string]: any;
|
|
452
|
+
} | null | undefined)[] | {
|
|
453
|
+
[x: string]: any;
|
|
454
|
+
} | null | undefined)[] | {
|
|
455
|
+
[x: string]: any;
|
|
456
|
+
} | null | undefined)[] | {
|
|
457
|
+
[x: string]: any;
|
|
458
|
+
} | null | undefined)[] | {
|
|
459
|
+
[x: string]: any;
|
|
460
|
+
} | null | undefined;
|
|
461
|
+
className?: undefined;
|
|
462
|
+
} | {
|
|
463
|
+
class?: undefined;
|
|
464
|
+
className?: string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
|
|
465
|
+
[x: string]: any;
|
|
466
|
+
} | null | undefined)[] | {
|
|
467
|
+
[x: string]: any;
|
|
468
|
+
} | null | undefined)[] | {
|
|
469
|
+
[x: string]: any;
|
|
470
|
+
} | null | undefined)[] | {
|
|
471
|
+
[x: string]: any;
|
|
472
|
+
} | null | undefined)[] | {
|
|
473
|
+
[x: string]: any;
|
|
474
|
+
} | null | undefined)[] | {
|
|
475
|
+
[x: string]: any;
|
|
476
|
+
} | null | undefined)[] | {
|
|
477
|
+
[x: string]: any;
|
|
478
|
+
} | null | undefined)[] | {
|
|
479
|
+
[x: string]: any;
|
|
480
|
+
} | null | undefined)[] | {
|
|
481
|
+
[x: string]: any;
|
|
482
|
+
} | null | undefined)[] | {
|
|
483
|
+
[x: string]: any;
|
|
484
|
+
} | null | undefined)[] | {
|
|
485
|
+
[x: string]: any;
|
|
486
|
+
} | null | undefined)[] | {
|
|
487
|
+
[x: string]: any;
|
|
488
|
+
} | null | undefined;
|
|
489
|
+
})) | undefined) => string;
|
|
490
|
+
type Props = VariantProps<typeof alertVariants> & {
|
|
491
|
+
children: React.ReactNode;
|
|
492
|
+
/**
|
|
493
|
+
* The ARIA role for the alertbox.
|
|
494
|
+
*/
|
|
495
|
+
role: 'alert' | 'status' | 'none';
|
|
496
|
+
/** Additional CSS className for the element. */
|
|
497
|
+
className?: string;
|
|
498
|
+
/**
|
|
499
|
+
* Controls if the alert is expandable or not
|
|
500
|
+
* @default false
|
|
501
|
+
*/
|
|
502
|
+
isExpandable?: boolean;
|
|
503
|
+
/**
|
|
504
|
+
* Controls if the alert can be dismissed with a close button.
|
|
505
|
+
* @default false
|
|
506
|
+
*/
|
|
507
|
+
isDismissable?: boolean;
|
|
508
|
+
/**
|
|
509
|
+
* Controls if the alert is rendered or not.
|
|
510
|
+
* This is used to control the open/closed state of the component; make the component "controlled".
|
|
511
|
+
* @default false
|
|
512
|
+
*/
|
|
513
|
+
isDismissed?: boolean;
|
|
514
|
+
/**
|
|
515
|
+
* Callback that should be triggered when a dismissable alert is closed.
|
|
516
|
+
* This is used to control the open/closed state of the component; make the component "controlled".
|
|
517
|
+
*/
|
|
518
|
+
onDismiss?: () => void;
|
|
519
|
+
};
|
|
520
|
+
declare const Alertbox: ({ children, role, className, variant, isDismissable, isDismissed, onDismiss, isExpandable, }: Props) => react_jsx_runtime.JSX.Element | undefined;
|
|
521
|
+
|
|
522
|
+
type HeadingProps = HTMLProps<HTMLHeadingElement> & {
|
|
523
|
+
children?: React.ReactNode;
|
|
524
|
+
/** The level of the heading */
|
|
525
|
+
level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
526
|
+
/** @private Used internally for slotted components */
|
|
527
|
+
_innerWrapper?: (children: React.ReactNode) => React.ReactNode;
|
|
528
|
+
};
|
|
529
|
+
declare const HeadingContext: react.Context<ContextValue<HeadingProps, HTMLHeadingElement>>;
|
|
530
|
+
declare const Heading: (props: HeadingProps, ref: ForwardedRef<HTMLHeadingElement>) => react_jsx_runtime.JSX.Element;
|
|
531
|
+
declare const ContentContext: react.Context<ContextValue<ContentProps, HTMLDivElement>>;
|
|
532
|
+
type ContentProps = HTMLProps<HTMLDivElement> & {
|
|
533
|
+
children: React.ReactNode;
|
|
534
|
+
/** @private Used internally for slotted components */
|
|
535
|
+
_outerWrapper?: (children: React.ReactNode) => React.ReactNode;
|
|
536
|
+
};
|
|
537
|
+
declare const Content: (props: ContentProps, ref: ForwardedRef<HTMLDivElement>) => string | number | boolean | Iterable<react.ReactNode> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
538
|
+
type FooterProps = HTMLProps<HTMLDivElement> & {
|
|
539
|
+
children: React.ReactNode;
|
|
540
|
+
};
|
|
541
|
+
declare const Footer: (props: FooterProps) => react_jsx_runtime.JSX.Element;
|
|
542
|
+
|
|
543
|
+
type BreadcrumbProps = {
|
|
544
|
+
/** Additional CSS className for the element. */
|
|
545
|
+
className?: string;
|
|
546
|
+
/** Additional style properties for the element. */
|
|
547
|
+
style?: React.CSSProperties;
|
|
548
|
+
/** The URL to navigate to when clicking the breadcrumb. */
|
|
549
|
+
href?: string;
|
|
550
|
+
} & Omit<BreadcrumbProps$1, 'className' | 'style'>;
|
|
551
|
+
declare const _Breadcrumb: react.ForwardRefExoticComponent<{
|
|
552
|
+
/** Additional CSS className for the element. */
|
|
553
|
+
className?: string | undefined;
|
|
554
|
+
/** Additional style properties for the element. */
|
|
555
|
+
style?: react.CSSProperties | undefined;
|
|
556
|
+
/** The URL to navigate to when clicking the breadcrumb. */
|
|
557
|
+
href?: string | undefined;
|
|
558
|
+
} & Omit<BreadcrumbProps$1, "className" | "style"> & react.RefAttributes<HTMLLIElement>>;
|
|
559
|
+
|
|
560
|
+
type BreadcrumbsProps = {
|
|
561
|
+
/** Additional CSS className for the element. */
|
|
562
|
+
className?: string;
|
|
563
|
+
/** Additional style properties for the element. */
|
|
564
|
+
style?: React.CSSProperties;
|
|
565
|
+
} & Omit<BreadcrumbsProps$1<BreadcrumbProps>, 'className' | 'style'>;
|
|
566
|
+
declare const _Breadcrumbs: react.ForwardRefExoticComponent<{
|
|
567
|
+
/** Additional CSS className for the element. */
|
|
568
|
+
className?: string | undefined;
|
|
569
|
+
/** Additional style properties for the element. */
|
|
570
|
+
style?: react.CSSProperties | undefined;
|
|
571
|
+
} & Omit<BreadcrumbsProps$1<BreadcrumbProps>, "className" | "style"> & react.RefAttributes<HTMLOListElement>>;
|
|
572
|
+
|
|
573
|
+
type BacklinkProps = {
|
|
574
|
+
/** Additional CSS className for the element. */
|
|
575
|
+
className?: string;
|
|
576
|
+
/** The URL to navigate to when clicking the backlink. */
|
|
577
|
+
href?: string;
|
|
578
|
+
/** To add a permanent underline on the link (not only on hover)
|
|
579
|
+
* @default false
|
|
580
|
+
*/
|
|
581
|
+
withUnderline?: boolean;
|
|
582
|
+
} & HTMLProps<HTMLAnchorElement>;
|
|
583
|
+
declare const _Backlink: react.ForwardRefExoticComponent<Omit<BacklinkProps, "ref"> & react.RefAttributes<HTMLAnchorElement>>;
|
|
227
584
|
|
|
228
|
-
export { Button, type ButtonProps, Checkbox, CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, Combobox, ComboboxItem, type ComboboxProps, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Select, SelectItem, type SelectProps, TextArea, type TextAreaProps, TextField, type TextFieldProps };
|
|
585
|
+
export { _Accordion as Accordion, _AccordionItem as AccordionItem, type AccordionItemProps, type AccordionProps, Alertbox, type Props as AlertboxProps, _Backlink as Backlink, type BacklinkProps, _Breadcrumb as Breadcrumb, type BreadcrumbProps, _Breadcrumbs as Breadcrumbs, type BreadcrumbsProps, _Button as Button, type ButtonProps, _Checkbox as Checkbox, _CheckboxGroup as CheckboxGroup, type CheckboxGroupProps, type CheckboxProps, _Combobox as Combobox, ListBoxItem as ComboboxItem, type ComboboxProps, Content, ContentContext, type ContentProps, Footer, type FooterProps, GrunnmurenProvider, type GrunnmurenProviderProps, Heading, HeadingContext, type HeadingProps, _NumberField as NumberField, type NumberFieldProps, _Radio as Radio, _RadioGroup as RadioGroup, type RadioGroupProps, type RadioProps, _Select as Select, ListBoxItem as SelectItem, type SelectProps, _TextArea as TextArea, type TextAreaProps, _TextField as TextField, type TextFieldProps };
|