@norges-domstoler/dds-components 5.3.1 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/dist/cjs/components/Breadcrumbs/Breadcrumb.tokens.d.ts +14 -5
- package/dist/cjs/components/Checkbox/Checkbox.styles.d.ts +0 -3
- package/dist/cjs/components/RadioButton/RadioButton.styles.d.ts +0 -3
- package/dist/cjs/components/ToggleBar/ToggleBar.context.d.ts +10 -0
- package/dist/cjs/components/ToggleBar/ToggleBar.d.ts +2 -0
- package/dist/cjs/components/ToggleBar/ToggleBar.stories.d.ts +20 -0
- package/dist/cjs/components/ToggleBar/ToggleBar.tokens.d.ts +111 -0
- package/dist/cjs/components/ToggleBar/ToggleBar.types.d.ts +19 -0
- package/dist/cjs/components/ToggleBar/ToggleRadio.d.ts +19 -0
- package/dist/cjs/components/ToggleBar/ToggleRadio.styles.d.ts +11 -0
- package/dist/cjs/components/ToggleBar/index.d.ts +3 -0
- package/dist/cjs/helpers/HiddenInput/HiddenInput.d.ts +1 -0
- package/dist/cjs/helpers/HiddenInput/index.d.ts +1 -0
- package/dist/cjs/helpers/index.d.ts +1 -0
- package/dist/cjs/helpers/styling/hideInput.d.ts +2 -2
- package/dist/cjs/helpers/styling/index.d.ts +1 -0
- package/dist/cjs/helpers/styling/selection.d.ts +4 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +671 -442
- package/dist/components/Breadcrumbs/Breadcrumb.tokens.d.ts +14 -5
- package/dist/components/Breadcrumbs/Breadcrumb.tokens.js +11 -12
- package/dist/components/Breadcrumbs/Breadcrumbs.js +10 -14
- package/dist/components/Checkbox/Checkbox.js +4 -2
- package/dist/components/Checkbox/Checkbox.styles.d.ts +0 -3
- package/dist/components/Checkbox/Checkbox.styles.js +15 -26
- package/dist/components/Pagination/Pagination.js +2 -2
- package/dist/components/RadioButton/RadioButton.js +5 -3
- package/dist/components/RadioButton/RadioButton.styles.d.ts +0 -3
- package/dist/components/RadioButton/RadioButton.styles.js +8 -19
- package/dist/components/RadioButton/RadioButtonGroup.js +2 -2
- package/dist/components/ToggleBar/ToggleBar.context.d.ts +10 -0
- package/dist/components/ToggleBar/ToggleBar.context.js +10 -0
- package/dist/components/ToggleBar/ToggleBar.d.ts +2 -0
- package/dist/components/ToggleBar/ToggleBar.js +77 -0
- package/dist/components/ToggleBar/ToggleBar.stories.d.ts +20 -0
- package/dist/components/ToggleBar/ToggleBar.tokens.d.ts +111 -0
- package/dist/components/ToggleBar/ToggleBar.tokens.js +100 -0
- package/dist/components/ToggleBar/ToggleBar.types.d.ts +19 -0
- package/dist/components/ToggleBar/ToggleRadio.d.ts +19 -0
- package/dist/components/ToggleBar/ToggleRadio.js +80 -0
- package/dist/components/ToggleBar/ToggleRadio.styles.d.ts +11 -0
- package/dist/components/ToggleBar/ToggleRadio.styles.js +21 -0
- package/dist/components/ToggleBar/index.d.ts +3 -0
- package/dist/components/ToggleButton/ToggleButton.js +5 -9
- package/dist/helpers/HiddenInput/HiddenInput.d.ts +1 -0
- package/dist/helpers/HiddenInput/HiddenInput.js +8 -0
- package/dist/helpers/HiddenInput/index.d.ts +1 -0
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/styling/hideInput.d.ts +2 -2
- package/dist/helpers/styling/index.d.ts +1 -0
- package/dist/helpers/styling/selection.d.ts +4 -0
- package/dist/helpers/styling/selection.js +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/package.json +1 -1
- package/dist/helpers/styling/hideInput.js +0 -9
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ npm install @norges-domstoler/dds-components
|
|
|
16
16
|
|
|
17
17
|
```js
|
|
18
18
|
import * as React from 'react';
|
|
19
|
-
import {
|
|
19
|
+
import { createRoot } from 'react-dom/client';
|
|
20
20
|
import { Button, TextInput } from '@norges-domstoler/dds-components';
|
|
21
21
|
|
|
22
22
|
const App = () => (
|
|
@@ -27,7 +27,9 @@ const App = () => (
|
|
|
27
27
|
</>
|
|
28
28
|
);
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
const root = createRoot(document.getElementById('root'));
|
|
31
|
+
|
|
32
|
+
root.render(<App />);
|
|
31
33
|
```
|
|
32
34
|
|
|
33
35
|
## 📃 Komponenter
|
|
@@ -65,6 +67,7 @@ Tilgjengelige komponenter:
|
|
|
65
67
|
- Tabs
|
|
66
68
|
- Tag
|
|
67
69
|
- TextInput
|
|
70
|
+
- ToggleBar
|
|
68
71
|
- ToggleButton
|
|
69
72
|
- Tooltip
|
|
70
73
|
- Typography
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import { CSSObject } from 'styled-components';
|
|
2
1
|
export declare const breadcrumbTokens: {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
list: {
|
|
3
|
+
gap: string;
|
|
4
|
+
};
|
|
5
|
+
listItem: {
|
|
6
|
+
font: {
|
|
7
|
+
lineHeight: any;
|
|
8
|
+
fontSize: string;
|
|
9
|
+
letterSpacing: any;
|
|
10
|
+
fontFamily: any;
|
|
11
|
+
fontWeight: any;
|
|
12
|
+
fontStyle: any;
|
|
13
|
+
};
|
|
14
|
+
gap: string;
|
|
5
15
|
};
|
|
6
16
|
icon: {
|
|
7
|
-
|
|
8
|
-
size: string;
|
|
17
|
+
color: string;
|
|
9
18
|
};
|
|
10
19
|
};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { CheckboxProps } from './Checkbox.types';
|
|
2
2
|
export declare const CustomCheckbox: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
3
|
-
export declare const Input: import("styled-components").StyledComponent<"input", any, {
|
|
4
|
-
type: import("react").HTMLInputTypeAttribute;
|
|
5
|
-
}, "type">;
|
|
6
3
|
declare type ContainerProps = Pick<CheckboxProps, 'disabled' | 'readOnly' | 'error' | 'indeterminate' | 'label'>;
|
|
7
4
|
export declare const Container: import("styled-components").StyledComponent<"label", any, ContainerProps, never>;
|
|
8
5
|
export {};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { RadioButtonProps } from './RadioButton.types';
|
|
2
2
|
export declare const CustomRadioButton: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
3
|
-
export declare const Input: import("styled-components").StyledComponent<"input", any, {
|
|
4
|
-
type: import("react").HTMLInputTypeAttribute;
|
|
5
|
-
}, "type">;
|
|
6
3
|
declare type ContainerProps = Pick<RadioButtonProps, 'error' | 'disabled' | 'readOnly'>;
|
|
7
4
|
export declare const Container: import("styled-components").StyledComponent<"label", any, ContainerProps, never>;
|
|
8
5
|
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ChangeEvent } from 'react';
|
|
2
|
+
import { ToggleBarSize, ToggleBarValue } from './ToggleBar.types';
|
|
3
|
+
export declare type ToggleBarContextType = {
|
|
4
|
+
size: ToggleBarSize;
|
|
5
|
+
name?: string;
|
|
6
|
+
value?: ToggleBarValue;
|
|
7
|
+
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const ToggleBarContext: import("react").Context<ToggleBarContextType>;
|
|
10
|
+
export declare const useToggleBarContext: () => ToggleBarContextType;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ToggleBarProps } from './ToggleBar.types';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: <T extends string | number = string>(props: ToggleBarProps<T>) => JSX.Element;
|
|
5
|
+
argTypes: {
|
|
6
|
+
label: {
|
|
7
|
+
control: {
|
|
8
|
+
type: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
14
|
+
export declare const Default: (args: ToggleBarProps<string>) => JSX.Element;
|
|
15
|
+
export declare const OverviewWithText: (args: ToggleBarProps<string>) => JSX.Element;
|
|
16
|
+
export declare const OverviewWithIcon: (args: ToggleBarProps<string>) => JSX.Element;
|
|
17
|
+
export declare const OverviewWithLabel: (args: ToggleBarProps<string>) => JSX.Element;
|
|
18
|
+
export declare const WithDefaultValue: (args: ToggleBarProps<string>) => JSX.Element;
|
|
19
|
+
export declare const WithLongWords: (args: ToggleBarProps<string>) => JSX.Element;
|
|
20
|
+
export declare const WithWidth: (args: ToggleBarProps<string>) => JSX.Element;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
export declare const toggleBarTokens: {
|
|
2
|
+
outerContainer: {
|
|
3
|
+
gap: string;
|
|
4
|
+
};
|
|
5
|
+
content: {
|
|
6
|
+
base: {
|
|
7
|
+
backgroundColor: string;
|
|
8
|
+
};
|
|
9
|
+
active: {
|
|
10
|
+
color: string;
|
|
11
|
+
borderColor: string;
|
|
12
|
+
backgroundColor: string;
|
|
13
|
+
boxShadow: string;
|
|
14
|
+
};
|
|
15
|
+
size: {
|
|
16
|
+
tiny: {
|
|
17
|
+
justIcon: {
|
|
18
|
+
padding: string;
|
|
19
|
+
fontSize: string;
|
|
20
|
+
};
|
|
21
|
+
withText: {
|
|
22
|
+
padding: string;
|
|
23
|
+
font: {
|
|
24
|
+
lineHeight: any;
|
|
25
|
+
fontSize: string;
|
|
26
|
+
letterSpacing: any;
|
|
27
|
+
fontFamily: any;
|
|
28
|
+
fontWeight: any;
|
|
29
|
+
fontStyle: any;
|
|
30
|
+
};
|
|
31
|
+
gap: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
small: {
|
|
35
|
+
justIcon: {
|
|
36
|
+
padding: string;
|
|
37
|
+
fontSize: string;
|
|
38
|
+
};
|
|
39
|
+
withText: {
|
|
40
|
+
padding: string;
|
|
41
|
+
font: {
|
|
42
|
+
lineHeight: any;
|
|
43
|
+
fontSize: string;
|
|
44
|
+
letterSpacing: any;
|
|
45
|
+
fontFamily: any;
|
|
46
|
+
fontWeight: any;
|
|
47
|
+
fontStyle: any;
|
|
48
|
+
};
|
|
49
|
+
gap: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
medium: {
|
|
53
|
+
justIcon: {
|
|
54
|
+
padding: string;
|
|
55
|
+
fontSize: string;
|
|
56
|
+
};
|
|
57
|
+
withText: {
|
|
58
|
+
padding: string;
|
|
59
|
+
font: {
|
|
60
|
+
lineHeight: any;
|
|
61
|
+
fontSize: string;
|
|
62
|
+
letterSpacing: any;
|
|
63
|
+
fontFamily: any;
|
|
64
|
+
fontWeight: any;
|
|
65
|
+
fontStyle: any;
|
|
66
|
+
};
|
|
67
|
+
gap: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
large: {
|
|
71
|
+
justIcon: {
|
|
72
|
+
padding: string;
|
|
73
|
+
fontSize: string;
|
|
74
|
+
};
|
|
75
|
+
withText: {
|
|
76
|
+
padding: string;
|
|
77
|
+
font: {
|
|
78
|
+
lineHeight: any;
|
|
79
|
+
fontSize: string;
|
|
80
|
+
letterSpacing: any;
|
|
81
|
+
fontFamily: any;
|
|
82
|
+
fontWeight: any;
|
|
83
|
+
fontStyle: any;
|
|
84
|
+
};
|
|
85
|
+
gap: string;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
label: {
|
|
91
|
+
base: {
|
|
92
|
+
borderColor: string;
|
|
93
|
+
borderRight: string;
|
|
94
|
+
borderTop: string;
|
|
95
|
+
borderBottom: string;
|
|
96
|
+
};
|
|
97
|
+
hover: {
|
|
98
|
+
color: string;
|
|
99
|
+
borderColor: string;
|
|
100
|
+
};
|
|
101
|
+
firstChild: {
|
|
102
|
+
borderLeft: string;
|
|
103
|
+
borderTopLeftRadius: string;
|
|
104
|
+
borderBottomLeftRadius: string;
|
|
105
|
+
};
|
|
106
|
+
lastChild: {
|
|
107
|
+
borderTopRightRadius: string;
|
|
108
|
+
borderBottomRightRadius: string;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ChangeEvent } from 'react';
|
|
2
|
+
import { BaseComponentPropsWithChildren } from '../../types';
|
|
3
|
+
import { Property } from 'csstype';
|
|
4
|
+
export declare type ToggleBarValue = string | number | null | undefined;
|
|
5
|
+
export declare type ToggleBarSize = 'tiny' | 'small' | 'medium' | 'large';
|
|
6
|
+
export declare type ToggleBarProps<T extends string | number> = BaseComponentPropsWithChildren<HTMLDivElement, {
|
|
7
|
+
/**Størrelse på komponenten. */
|
|
8
|
+
size?: ToggleBarSize;
|
|
9
|
+
/**Ledetekst for hele gruppen. */
|
|
10
|
+
label?: string;
|
|
11
|
+
/**Funksjonen for `onChange`-event for barna. */
|
|
12
|
+
onChange?: (event: ChangeEvent<HTMLInputElement>, value?: T) => void;
|
|
13
|
+
/**Den valgte verdien i gruppen. Hvis satt ved innlastning blir en `<ToggleRadio />` forhåndsvalgt. */
|
|
14
|
+
value?: T;
|
|
15
|
+
/** Gir alle barna samme `name` prop.*/
|
|
16
|
+
name?: string;
|
|
17
|
+
/**Bredden til komponenten. Bredden fordeles likt mellom barna. */
|
|
18
|
+
width?: Property.Width;
|
|
19
|
+
}>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { InputHTMLAttributes } from 'react';
|
|
2
|
+
import { SvgIcon } from '../../icons/utils';
|
|
3
|
+
import { BaseComponentProps } from '../../types';
|
|
4
|
+
declare type PickedInputHTMLAttributes = Pick<InputHTMLAttributes<HTMLInputElement>, 'name' | 'checked' | 'value' | 'onChange' | 'aria-label' | 'aria-labelledby'>;
|
|
5
|
+
export declare type ToggleRadioProps = BaseComponentProps<HTMLInputElement, {
|
|
6
|
+
/**Ledetekst som vises i komponenten. */
|
|
7
|
+
label?: string;
|
|
8
|
+
/**Ikonet som vises i komponenten. */
|
|
9
|
+
icon?: SvgIcon;
|
|
10
|
+
} & PickedInputHTMLAttributes, Omit<InputHTMLAttributes<HTMLInputElement>, keyof PickedInputHTMLAttributes>>;
|
|
11
|
+
export declare const ToggleRadio: import("react").ForwardRefExoticComponent<{
|
|
12
|
+
htmlProps?: Omit<InputHTMLAttributes<HTMLInputElement>, "name" | "checked" | "value" | "onChange" | "aria-label" | "aria-labelledby"> | undefined;
|
|
13
|
+
} & Pick<Omit<InputHTMLAttributes<HTMLInputElement>, "name" | "checked" | "value" | "onChange" | "aria-label" | "aria-labelledby">, "className" | "id"> & {
|
|
14
|
+
/**Ledetekst som vises i komponenten. */
|
|
15
|
+
label?: string | undefined;
|
|
16
|
+
/**Ikonet som vises i komponenten. */
|
|
17
|
+
icon?: SvgIcon | undefined;
|
|
18
|
+
} & PickedInputHTMLAttributes & import("react").RefAttributes<HTMLInputElement>>;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ToggleBarSize } from './ToggleBar.types';
|
|
2
|
+
declare type ContentProps = {
|
|
3
|
+
size: ToggleBarSize;
|
|
4
|
+
justIcon: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare const Content: import("styled-components").StyledComponent<"span", any, ContentProps, never>;
|
|
7
|
+
declare type LabelProps = {
|
|
8
|
+
size: ToggleBarSize;
|
|
9
|
+
};
|
|
10
|
+
export declare const Label: import("styled-components").StyledComponent<"label", any, LabelProps, never>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const HiddenInput: import("styled-components").StyledComponent<"input", any, {}, never>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './HiddenInput';
|
package/dist/cjs/index.d.ts
CHANGED