@norges-domstoler/dds-components 8.0.1 → 9.0.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 +1 -0
- package/dist/cjs/components/Button/Button.stories.d.ts +3 -3
- package/dist/cjs/components/Checkbox/Checkbox.d.ts +1 -10
- package/dist/cjs/components/Checkbox/Checkbox.stories.d.ts +3 -12
- package/dist/cjs/components/Checkbox/Checkbox.types.d.ts +2 -3
- package/dist/cjs/components/RadioButton/RadioButton.stories.d.ts +3 -3
- package/dist/cjs/components/RadioButton/RadioButtonGroup.d.ts +1 -1
- package/dist/cjs/components/TextArea/TextArea.d.ts +7 -0
- package/dist/cjs/components/TextArea/TextArea.stories.d.ts +51 -0
- package/dist/cjs/components/TextArea/TextArea.tokens.d.ts +5 -0
- package/dist/cjs/components/TextArea/index.d.ts +1 -0
- package/dist/cjs/components/TextInput/TextInput.d.ts +4 -10
- package/dist/cjs/components/TextInput/TextInput.stories.d.ts +4 -17
- package/dist/cjs/components/TextInput/TextInput.styles.d.ts +2 -5
- package/dist/cjs/components/TextInput/TextInput.types.d.ts +3 -6
- package/dist/cjs/components/ToggleButton/ToggleButton.d.ts +4 -15
- package/dist/cjs/components/ToggleButton/ToggleButton.stories.d.ts +3 -3
- package/dist/cjs/components/ToggleButton/ToggleButton.types.d.ts +10 -0
- package/dist/cjs/components/ToggleButton/index.d.ts +1 -0
- package/dist/cjs/components/Tooltip/Tooltip.stories.d.ts +2 -2
- package/dist/cjs/helpers/Input/Input.styles.d.ts +2 -2
- package/dist/cjs/helpers/Input/Input.types.d.ts +8 -5
- package/dist/cjs/helpers/Input/Input.utils.d.ts +2 -0
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +502 -464
- package/dist/cjs/types/CheckboxPickedHTMLAttributes.d.ts +2 -0
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/components/Breadcrumbs/Breadcrumb.js +1 -0
- package/dist/components/Button/Button.stories.d.ts +3 -3
- package/dist/components/Card/CardAccordion/CardAccordionHeader.js +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +1 -10
- package/dist/components/Checkbox/Checkbox.js +1 -0
- package/dist/components/Checkbox/Checkbox.stories.d.ts +3 -12
- package/dist/components/Checkbox/Checkbox.types.d.ts +2 -3
- package/dist/components/Checkbox/CheckboxGroup.js +3 -11
- package/dist/components/Datepicker/Datepicker.js +2 -10
- package/dist/components/Drawer/Drawer.js +1 -0
- package/dist/components/GlobalMessage/GlobalMessage.js +1 -0
- package/dist/components/InternalHeader/InternalHeader.js +1 -0
- package/dist/components/LocalMessage/LocalMessage.js +1 -0
- package/dist/components/Modal/Modal.js +1 -0
- package/dist/components/Pagination/Pagination.js +1 -0
- package/dist/components/Popover/Popover.js +1 -0
- package/dist/components/RadioButton/RadioButton.js +1 -0
- package/dist/components/RadioButton/RadioButton.stories.d.ts +3 -3
- package/dist/components/RadioButton/RadioButtonGroup.d.ts +1 -1
- package/dist/components/RadioButton/RadioButtonGroup.js +3 -12
- package/dist/components/Search/Search.js +2 -7
- package/dist/components/Select/Select.js +2 -11
- package/dist/components/Tag/Tag.js +1 -0
- package/dist/components/TextArea/TextArea.d.ts +7 -0
- package/dist/components/TextArea/TextArea.js +105 -0
- package/dist/components/TextArea/TextArea.stories.d.ts +51 -0
- package/dist/components/TextArea/TextArea.tokens.d.ts +5 -0
- package/dist/components/TextArea/TextArea.tokens.js +11 -0
- package/dist/components/TextArea/index.d.ts +1 -0
- package/dist/components/TextInput/CharCounter.js +1 -0
- package/dist/components/TextInput/TextInput.d.ts +4 -10
- package/dist/components/TextInput/TextInput.js +6 -49
- package/dist/components/TextInput/TextInput.stories.d.ts +4 -17
- package/dist/components/TextInput/TextInput.styles.d.ts +2 -5
- package/dist/components/TextInput/TextInput.styles.js +6 -12
- package/dist/components/TextInput/TextInput.types.d.ts +3 -6
- package/dist/components/ToggleBar/ToggleBar.js +1 -0
- package/dist/components/ToggleBar/ToggleRadio.js +1 -0
- package/dist/components/ToggleBar/ToggleRadio.styles.js +1 -0
- package/dist/components/ToggleButton/ToggleButton.d.ts +4 -15
- package/dist/components/ToggleButton/ToggleButton.js +1 -0
- package/dist/components/ToggleButton/ToggleButton.stories.d.ts +3 -3
- package/dist/components/ToggleButton/ToggleButton.types.d.ts +10 -0
- package/dist/components/ToggleButton/ToggleButtonGroup.js +1 -0
- package/dist/components/ToggleButton/index.d.ts +1 -0
- package/dist/components/Tooltip/Tooltip.stories.d.ts +2 -2
- package/dist/components/Typography/Label/Label.js +1 -0
- package/dist/helpers/Backdrop/Backdrop.utils.js +7 -2
- package/dist/helpers/Input/Input.styles.d.ts +2 -2
- package/dist/helpers/Input/Input.types.d.ts +8 -5
- package/dist/helpers/Input/Input.utils.d.ts +2 -0
- package/dist/helpers/Input/Input.utils.js +28 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/types/CheckboxPickedHTMLAttributes.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ import '../../helpers/Chevron/AnimatedChevronUpDown.styles.js';
|
|
|
7
7
|
import '../../helpers/HiddenInput/HiddenInput.js';
|
|
8
8
|
import '../../helpers/Input/Input.styles.js';
|
|
9
9
|
import '../../helpers/Input/Input.tokens.js';
|
|
10
|
+
import '../InputMessage/InputMessage.js';
|
|
10
11
|
import '../../helpers/Paper/Paper.js';
|
|
11
12
|
import '../../helpers/RequiredMarker/RequiredMarker.js';
|
|
12
13
|
import '../Typography/Link/Link.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ButtonProps } from '.';
|
|
2
2
|
declare const _default: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: import("react").ForwardRefExoticComponent<Pick<Omit<import("react").ButtonHTMLAttributes<HTMLButtonElement>, "
|
|
4
|
+
component: import("react").ForwardRefExoticComponent<Pick<Omit<import("react").ButtonHTMLAttributes<HTMLButtonElement>, "onFocus" | "onBlur" | "onClick" | "type">, "id" | "className"> & {
|
|
5
5
|
size?: import("./Button.types").ButtonSize | undefined;
|
|
6
6
|
label?: string | undefined;
|
|
7
7
|
purpose?: import("./Button.types").ButtonPurpose | undefined;
|
|
@@ -13,12 +13,12 @@ declare const _default: {
|
|
|
13
13
|
href?: string | undefined;
|
|
14
14
|
target?: string | undefined;
|
|
15
15
|
} & {
|
|
16
|
-
type?: "button" | "submit" | "reset" | undefined;
|
|
17
16
|
onFocus?: import("react").FocusEventHandler<HTMLButtonElement> | undefined;
|
|
18
17
|
onBlur?: import("react").FocusEventHandler<HTMLButtonElement> | undefined;
|
|
19
18
|
onClick?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
|
|
19
|
+
type?: "button" | "submit" | "reset" | undefined;
|
|
20
20
|
} & {
|
|
21
|
-
htmlProps?: Omit<import("react").ButtonHTMLAttributes<HTMLButtonElement>, "
|
|
21
|
+
htmlProps?: Omit<import("react").ButtonHTMLAttributes<HTMLButtonElement>, "onFocus" | "onBlur" | "onClick" | "type"> | undefined;
|
|
22
22
|
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
23
23
|
argTypes: {
|
|
24
24
|
label: {
|
|
@@ -8,6 +8,7 @@ import { AnimatedChevronUpDown } from '../../../helpers/Chevron/AnimatedChevronU
|
|
|
8
8
|
import '../../../helpers/HiddenInput/HiddenInput.js';
|
|
9
9
|
import '../../../helpers/Input/Input.styles.js';
|
|
10
10
|
import '../../../helpers/Input/Input.tokens.js';
|
|
11
|
+
import '../../InputMessage/InputMessage.js';
|
|
11
12
|
import '../../../helpers/Paper/Paper.js';
|
|
12
13
|
import '../../../helpers/RequiredMarker/RequiredMarker.js';
|
|
13
14
|
import { removeButtonStyling } from '../../../helpers/styling/removeButtonStyling.js';
|
|
@@ -4,15 +4,6 @@ export declare const Checkbox: import("react").ForwardRefExoticComponent<Pick<Om
|
|
|
4
4
|
disabled?: boolean | undefined;
|
|
5
5
|
readOnly?: boolean | undefined;
|
|
6
6
|
indeterminate?: boolean | undefined;
|
|
7
|
-
} & {
|
|
8
|
-
'aria-describedby'?: string | undefined;
|
|
9
|
-
name?: string | undefined;
|
|
10
|
-
checked?: boolean | undefined;
|
|
11
|
-
defaultChecked?: boolean | undefined;
|
|
12
|
-
value?: string | number | readonly string[] | undefined;
|
|
13
|
-
defaultValue?: string | number | readonly string[] | undefined;
|
|
14
|
-
onChange?: import("react").ChangeEventHandler<HTMLInputElement> | undefined;
|
|
15
|
-
onBlur?: import("react").FocusEventHandler<HTMLInputElement> | undefined;
|
|
16
|
-
} & {
|
|
7
|
+
} & import("../../types").CheckboxPickedHTMLAttributes & {
|
|
17
8
|
htmlProps?: Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "aria-describedby" | "name" | "checked" | "defaultChecked" | "value" | "defaultValue" | "onChange" | "onBlur"> | undefined;
|
|
18
9
|
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -7,6 +7,7 @@ import '../../helpers/Chevron/AnimatedChevronUpDown.styles.js';
|
|
|
7
7
|
import { HiddenInput } from '../../helpers/HiddenInput/HiddenInput.js';
|
|
8
8
|
import '../../helpers/Input/Input.styles.js';
|
|
9
9
|
import '../../helpers/Input/Input.tokens.js';
|
|
10
|
+
import '../InputMessage/InputMessage.js';
|
|
10
11
|
import '../../helpers/Paper/Paper.js';
|
|
11
12
|
import '../../helpers/RequiredMarker/RequiredMarker.js';
|
|
12
13
|
import { joinClassNames, getBaseHTMLProps } from '../../types/BaseComponentProps.js';
|
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
import { CheckboxProps } from '.';
|
|
2
2
|
declare const _default: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: import("react").ForwardRefExoticComponent<Pick<Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "
|
|
4
|
+
component: import("react").ForwardRefExoticComponent<Pick<Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "defaultChecked" | "defaultValue" | "aria-describedby" | "onBlur" | "onChange" | "name" | "value" | "checked">, "id" | "className"> & {
|
|
5
5
|
label?: string | undefined;
|
|
6
6
|
error?: boolean | undefined;
|
|
7
7
|
disabled?: boolean | undefined;
|
|
8
8
|
readOnly?: boolean | undefined;
|
|
9
9
|
indeterminate?: boolean | undefined;
|
|
10
|
-
} & {
|
|
11
|
-
|
|
12
|
-
defaultChecked?: boolean | undefined;
|
|
13
|
-
defaultValue?: string | number | readonly string[] | undefined;
|
|
14
|
-
'aria-describedby'?: string | undefined;
|
|
15
|
-
onBlur?: import("react").FocusEventHandler<HTMLInputElement> | undefined;
|
|
16
|
-
onChange?: import("react").ChangeEventHandler<HTMLInputElement> | undefined;
|
|
17
|
-
value?: string | number | readonly string[] | undefined;
|
|
18
|
-
checked?: boolean | undefined;
|
|
19
|
-
} & {
|
|
20
|
-
htmlProps?: Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "name" | "defaultChecked" | "defaultValue" | "aria-describedby" | "onBlur" | "onChange" | "value" | "checked"> | undefined;
|
|
10
|
+
} & import("../../types").CheckboxPickedHTMLAttributes & {
|
|
11
|
+
htmlProps?: Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "defaultChecked" | "defaultValue" | "aria-describedby" | "onBlur" | "onChange" | "name" | "value" | "checked"> | undefined;
|
|
21
12
|
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
22
13
|
argTypes: {
|
|
23
14
|
label: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InputHTMLAttributes } from 'react';
|
|
2
2
|
import { BaseComponentProps } from '../../types';
|
|
3
|
-
|
|
3
|
+
import { CheckboxPickedHTMLAttributes } from '../../types/CheckboxPickedHTMLAttributes';
|
|
4
4
|
export declare type CheckboxProps = BaseComponentProps<HTMLInputElement, {
|
|
5
5
|
/** Ledetekst for inputelementet. */
|
|
6
6
|
label?: string;
|
|
@@ -12,5 +12,4 @@ export declare type CheckboxProps = BaseComponentProps<HTMLInputElement, {
|
|
|
12
12
|
readOnly?: boolean;
|
|
13
13
|
/**Brukes ved nøstet struktur der alle Checkbox som hører til en gruppe kan bli valgt ved å trykke på en forelder Checkbox. Hvis enkelte <Checkbox /> blir valgt men ikke alle skal forelder <Checkbox /> få tilstanden indeterminate - verken checked eller ikke. */
|
|
14
14
|
indeterminate?: boolean;
|
|
15
|
-
} &
|
|
16
|
-
export {};
|
|
15
|
+
} & CheckboxPickedHTMLAttributes, Omit<InputHTMLAttributes<HTMLInputElement>, keyof CheckboxPickedHTMLAttributes>>;
|
|
@@ -7,9 +7,9 @@ import '../../helpers/Chevron/AnimatedChevronUpDown.styles.js';
|
|
|
7
7
|
import '../../helpers/HiddenInput/HiddenInput.js';
|
|
8
8
|
import '../../helpers/Input/Input.styles.js';
|
|
9
9
|
import '../../helpers/Input/Input.tokens.js';
|
|
10
|
+
import { renderInputMessage } from '../../helpers/Input/Input.utils.js';
|
|
10
11
|
import '../../helpers/Paper/Paper.js';
|
|
11
12
|
import { RequiredMarker } from '../../helpers/RequiredMarker/RequiredMarker.js';
|
|
12
|
-
import { InputMessage } from '../InputMessage/InputMessage.js';
|
|
13
13
|
import { checkboxGroupTokens } from './CheckboxGroup.tokens.js';
|
|
14
14
|
import { CheckboxGroupContext } from './CheckboxGroupContext.js';
|
|
15
15
|
import { Typography } from '../Typography/Typography/Typography.js';
|
|
@@ -68,11 +68,7 @@ var CheckboxGroup = function CheckboxGroup(props) {
|
|
|
68
68
|
id: uniqueGroupId
|
|
69
69
|
}, {
|
|
70
70
|
children: [label, " ", showRequiredMarker && jsx(RequiredMarker, {})]
|
|
71
|
-
})), tip
|
|
72
|
-
messageType: "tip",
|
|
73
|
-
message: tip,
|
|
74
|
-
id: tipId
|
|
75
|
-
}), jsx(CheckboxGroupContext.Provider, Object.assign({
|
|
71
|
+
})), renderInputMessage(tip, tipId), jsx(CheckboxGroupContext.Provider, Object.assign({
|
|
76
72
|
value: Object.assign({}, contextProps)
|
|
77
73
|
}, {
|
|
78
74
|
children: jsx(GroupContainer, Object.assign({
|
|
@@ -83,11 +79,7 @@ var CheckboxGroup = function CheckboxGroup(props) {
|
|
|
83
79
|
}, {
|
|
84
80
|
children: children
|
|
85
81
|
}))
|
|
86
|
-
})),
|
|
87
|
-
messageType: "error",
|
|
88
|
-
message: errorMessage,
|
|
89
|
-
id: errorMessageId
|
|
90
|
-
})]
|
|
82
|
+
})), renderInputMessage(undefined, undefined, errorMessage, errorMessageId)]
|
|
91
83
|
}));
|
|
92
84
|
};
|
|
93
85
|
|
|
@@ -2,12 +2,12 @@ import { defineProperty as _defineProperty } from '../../_virtual/_rollupPluginB
|
|
|
2
2
|
import { __rest } from 'tslib';
|
|
3
3
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
4
|
import { forwardRef, useId } from 'react';
|
|
5
|
-
import { InputMessage } from '../InputMessage/InputMessage.js';
|
|
6
5
|
import '../../helpers/Backdrop/Backdrop.js';
|
|
7
6
|
import '../../helpers/Chevron/AnimatedChevronUpDown.styles.js';
|
|
8
7
|
import '../../helpers/HiddenInput/HiddenInput.js';
|
|
9
8
|
import { StatefulInput, OuterInputContainer } from '../../helpers/Input/Input.styles.js';
|
|
10
9
|
import '../../helpers/Input/Input.tokens.js';
|
|
10
|
+
import { renderInputMessage } from '../../helpers/Input/Input.utils.js';
|
|
11
11
|
import '../../helpers/Paper/Paper.js';
|
|
12
12
|
import '../../helpers/RequiredMarker/RequiredMarker.js';
|
|
13
13
|
import styled, { css } from 'styled-components';
|
|
@@ -85,15 +85,7 @@ var Datepicker = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
85
85
|
showRequiredStyling: showRequiredStyling
|
|
86
86
|
}, {
|
|
87
87
|
children: label
|
|
88
|
-
})), jsx(StyledInput, Object.assign({}, inputProps)),
|
|
89
|
-
message: errorMessage,
|
|
90
|
-
id: errorMessageId,
|
|
91
|
-
messageType: "error"
|
|
92
|
-
}), tip && !hasErrorMessage && jsx(InputMessage, {
|
|
93
|
-
message: tip,
|
|
94
|
-
id: tipId,
|
|
95
|
-
messageType: "tip"
|
|
96
|
-
})]
|
|
88
|
+
})), jsx(StyledInput, Object.assign({}, inputProps)), renderInputMessage(tip, tipId, errorMessage, errorMessageId)]
|
|
97
89
|
}));
|
|
98
90
|
});
|
|
99
91
|
|
|
@@ -10,6 +10,7 @@ import '../../helpers/Chevron/AnimatedChevronUpDown.styles.js';
|
|
|
10
10
|
import '../../helpers/HiddenInput/HiddenInput.js';
|
|
11
11
|
import '../../helpers/Input/Input.styles.js';
|
|
12
12
|
import '../../helpers/Input/Input.tokens.js';
|
|
13
|
+
import '../InputMessage/InputMessage.js';
|
|
13
14
|
import { Paper } from '../../helpers/Paper/Paper.js';
|
|
14
15
|
import '../../helpers/RequiredMarker/RequiredMarker.js';
|
|
15
16
|
import { getBaseHTMLProps } from '../../types/BaseComponentProps.js';
|
|
@@ -12,6 +12,7 @@ import '../../helpers/Chevron/AnimatedChevronUpDown.styles.js';
|
|
|
12
12
|
import '../../helpers/HiddenInput/HiddenInput.js';
|
|
13
13
|
import '../../helpers/Input/Input.styles.js';
|
|
14
14
|
import '../../helpers/Input/Input.tokens.js';
|
|
15
|
+
import '../InputMessage/InputMessage.js';
|
|
15
16
|
import '../../helpers/Paper/Paper.js';
|
|
16
17
|
import '../../helpers/RequiredMarker/RequiredMarker.js';
|
|
17
18
|
import { getBaseHTMLProps } from '../../types/BaseComponentProps.js';
|
|
@@ -8,6 +8,7 @@ import '../../helpers/Chevron/AnimatedChevronUpDown.styles.js';
|
|
|
8
8
|
import '../../helpers/HiddenInput/HiddenInput.js';
|
|
9
9
|
import '../../helpers/Input/Input.styles.js';
|
|
10
10
|
import '../../helpers/Input/Input.tokens.js';
|
|
11
|
+
import '../InputMessage/InputMessage.js';
|
|
11
12
|
import '../../helpers/Paper/Paper.js';
|
|
12
13
|
import '../../helpers/RequiredMarker/RequiredMarker.js';
|
|
13
14
|
import { getBaseHTMLProps } from '../../types/BaseComponentProps.js';
|
|
@@ -12,6 +12,7 @@ import '../../helpers/Chevron/AnimatedChevronUpDown.styles.js';
|
|
|
12
12
|
import '../../helpers/HiddenInput/HiddenInput.js';
|
|
13
13
|
import '../../helpers/Input/Input.styles.js';
|
|
14
14
|
import '../../helpers/Input/Input.tokens.js';
|
|
15
|
+
import '../InputMessage/InputMessage.js';
|
|
15
16
|
import '../../helpers/Paper/Paper.js';
|
|
16
17
|
import '../../helpers/RequiredMarker/RequiredMarker.js';
|
|
17
18
|
import { getBaseHTMLProps } from '../../types/BaseComponentProps.js';
|
|
@@ -20,6 +20,7 @@ import '../../helpers/Chevron/AnimatedChevronUpDown.styles.js';
|
|
|
20
20
|
import '../../helpers/HiddenInput/HiddenInput.js';
|
|
21
21
|
import '../../helpers/Input/Input.styles.js';
|
|
22
22
|
import '../../helpers/Input/Input.tokens.js';
|
|
23
|
+
import '../InputMessage/InputMessage.js';
|
|
23
24
|
import '../../helpers/Paper/Paper.js';
|
|
24
25
|
import '../../helpers/RequiredMarker/RequiredMarker.js';
|
|
25
26
|
import { getBaseHTMLProps } from '../../types/BaseComponentProps.js';
|
|
@@ -9,6 +9,7 @@ import '../../helpers/Chevron/AnimatedChevronUpDown.styles.js';
|
|
|
9
9
|
import '../../helpers/HiddenInput/HiddenInput.js';
|
|
10
10
|
import '../../helpers/Input/Input.styles.js';
|
|
11
11
|
import '../../helpers/Input/Input.tokens.js';
|
|
12
|
+
import '../InputMessage/InputMessage.js';
|
|
12
13
|
import '../../helpers/Paper/Paper.js';
|
|
13
14
|
import '../../helpers/RequiredMarker/RequiredMarker.js';
|
|
14
15
|
import { getBaseHTMLProps } from '../../types/BaseComponentProps.js';
|
|
@@ -24,6 +24,7 @@ import '../../helpers/Chevron/AnimatedChevronUpDown.styles.js';
|
|
|
24
24
|
import '../../helpers/HiddenInput/HiddenInput.js';
|
|
25
25
|
import '../../helpers/Input/Input.styles.js';
|
|
26
26
|
import '../../helpers/Input/Input.tokens.js';
|
|
27
|
+
import '../InputMessage/InputMessage.js';
|
|
27
28
|
import { Paper } from '../../helpers/Paper/Paper.js';
|
|
28
29
|
import '../../helpers/RequiredMarker/RequiredMarker.js';
|
|
29
30
|
import '../Typography/Link/Link.js';
|
|
@@ -7,6 +7,7 @@ import '../../helpers/Chevron/AnimatedChevronUpDown.styles.js';
|
|
|
7
7
|
import { HiddenInput } from '../../helpers/HiddenInput/HiddenInput.js';
|
|
8
8
|
import '../../helpers/Input/Input.styles.js';
|
|
9
9
|
import '../../helpers/Input/Input.tokens.js';
|
|
10
|
+
import '../InputMessage/InputMessage.js';
|
|
10
11
|
import '../../helpers/Paper/Paper.js';
|
|
11
12
|
import '../../helpers/RequiredMarker/RequiredMarker.js';
|
|
12
13
|
import { getBaseHTMLProps, joinClassNames } from '../../types/BaseComponentProps.js';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { RadioButtonProps } from '.';
|
|
2
2
|
declare const _default: {
|
|
3
3
|
title: string;
|
|
4
|
-
component: import("react").ForwardRefExoticComponent<Pick<Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "
|
|
4
|
+
component: import("react").ForwardRefExoticComponent<Pick<Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "aria-describedby" | "onChange" | "name" | "value" | "checked" | "readOnly" | "required">, "id" | "className"> & {
|
|
5
5
|
label?: string | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
error?: boolean | undefined;
|
|
8
8
|
} & {
|
|
9
|
-
name?: string | undefined;
|
|
10
9
|
'aria-describedby'?: string | undefined;
|
|
11
10
|
onChange?: import("react").ChangeEventHandler<HTMLInputElement> | undefined;
|
|
11
|
+
name?: string | undefined;
|
|
12
12
|
value?: string | number | readonly string[] | undefined;
|
|
13
13
|
checked?: boolean | undefined;
|
|
14
14
|
readOnly?: boolean | undefined;
|
|
@@ -16,7 +16,7 @@ declare const _default: {
|
|
|
16
16
|
} & {
|
|
17
17
|
children?: import("react").ReactNode;
|
|
18
18
|
} & {
|
|
19
|
-
htmlProps?: Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "
|
|
19
|
+
htmlProps?: Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "aria-describedby" | "onChange" | "name" | "value" | "checked" | "readOnly" | "required"> | undefined;
|
|
20
20
|
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
21
21
|
argTypes: {
|
|
22
22
|
label: {
|
|
@@ -51,7 +51,7 @@ export declare const RadioButtonGroup: <T extends string | number = string>(prop
|
|
|
51
51
|
} & {
|
|
52
52
|
children?: import("react").ReactNode;
|
|
53
53
|
} & {
|
|
54
|
-
htmlProps?: Omit<HTMLAttributes<HTMLDivElement>, "onChange"> | undefined;
|
|
54
|
+
htmlProps?: Omit<HTMLAttributes<HTMLDivElement>, "onChange"> | undefined; /**Funksjonen for onChange-event for barna. */
|
|
55
55
|
} & {
|
|
56
56
|
ref?: Ref<HTMLDivElement> | undefined;
|
|
57
57
|
}) => ReactElement;
|
|
@@ -8,9 +8,9 @@ import '../../helpers/Chevron/AnimatedChevronUpDown.styles.js';
|
|
|
8
8
|
import '../../helpers/HiddenInput/HiddenInput.js';
|
|
9
9
|
import '../../helpers/Input/Input.styles.js';
|
|
10
10
|
import '../../helpers/Input/Input.tokens.js';
|
|
11
|
+
import { renderInputMessage } from '../../helpers/Input/Input.utils.js';
|
|
11
12
|
import '../../helpers/Paper/Paper.js';
|
|
12
13
|
import { RequiredMarker } from '../../helpers/RequiredMarker/RequiredMarker.js';
|
|
13
|
-
import { InputMessage } from '../InputMessage/InputMessage.js';
|
|
14
14
|
import { radioButtonGroupTokens } from './RadioButtonGroup.tokens.js';
|
|
15
15
|
import { RadioButtonGroupContext } from './RadioButtonGroupContext.js';
|
|
16
16
|
import { Typography } from '../Typography/Typography/Typography.js';
|
|
@@ -66,7 +66,6 @@ var RadioButtonGroupInner = function RadioButtonGroupInner(props, ref) {
|
|
|
66
66
|
return onChange && onChange(e, e.target.value);
|
|
67
67
|
});
|
|
68
68
|
var hasErrorMessage = !!errorMessage;
|
|
69
|
-
var hasTip = !!tip;
|
|
70
69
|
var showRequiredMarker = required || ariaRequired;
|
|
71
70
|
var tipId = tip && "".concat(uniqueGroupId, "-tip");
|
|
72
71
|
var errorMessageId = errorMessage && "".concat(uniqueGroupId, "-errorMessage");
|
|
@@ -91,11 +90,7 @@ var RadioButtonGroupInner = function RadioButtonGroupInner(props, ref) {
|
|
|
91
90
|
id: uniqueGroupId
|
|
92
91
|
}, {
|
|
93
92
|
children: [label, " ", showRequiredMarker && jsx(RequiredMarker, {})]
|
|
94
|
-
})),
|
|
95
|
-
message: tip,
|
|
96
|
-
messageType: "tip",
|
|
97
|
-
id: tipId
|
|
98
|
-
}), jsx(RadioButtonGroupContext.Provider, Object.assign({
|
|
93
|
+
})), renderInputMessage(tip, tipId), jsx(RadioButtonGroupContext.Provider, Object.assign({
|
|
99
94
|
value: Object.assign({}, contextProps)
|
|
100
95
|
}, {
|
|
101
96
|
children: jsx(GroupContainer, Object.assign({
|
|
@@ -107,11 +102,7 @@ var RadioButtonGroupInner = function RadioButtonGroupInner(props, ref) {
|
|
|
107
102
|
}, {
|
|
108
103
|
children: children
|
|
109
104
|
}))
|
|
110
|
-
})),
|
|
111
|
-
message: errorMessage,
|
|
112
|
-
messageType: "error",
|
|
113
|
-
id: errorMessageId
|
|
114
|
-
})]
|
|
105
|
+
})), renderInputMessage(undefined, undefined, errorMessage, errorMessageId)]
|
|
115
106
|
}));
|
|
116
107
|
};
|
|
117
108
|
|
|
@@ -9,9 +9,9 @@ import '../../helpers/Chevron/AnimatedChevronUpDown.styles.js';
|
|
|
9
9
|
import '../../helpers/HiddenInput/HiddenInput.js';
|
|
10
10
|
import { Input as Input$1 } from '../../helpers/Input/Input.styles.js';
|
|
11
11
|
import '../../helpers/Input/Input.tokens.js';
|
|
12
|
+
import { renderInputMessage } from '../../helpers/Input/Input.utils.js';
|
|
12
13
|
import '../../helpers/Paper/Paper.js';
|
|
13
14
|
import '../../helpers/RequiredMarker/RequiredMarker.js';
|
|
14
|
-
import { InputMessage } from '../InputMessage/InputMessage.js';
|
|
15
15
|
import { spaceSeparatedIdListGenerator, derivativeIdGenerator } from '../../utils/idGenerator.js';
|
|
16
16
|
import '../../utils/color.js';
|
|
17
17
|
import { Icon } from '../Icon/Icon.js';
|
|
@@ -81,7 +81,6 @@ var Search = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
81
81
|
var generatedId = useId();
|
|
82
82
|
var uniqueId = id !== null && id !== void 0 ? id : "".concat(generatedId, "-searchInput");
|
|
83
83
|
var hasLabel = !!label;
|
|
84
|
-
var hasTip = !!tip;
|
|
85
84
|
var tipId = derivativeIdGenerator(uniqueId, 'tip', tip);
|
|
86
85
|
var containerProps = {
|
|
87
86
|
className: className,
|
|
@@ -120,11 +119,7 @@ var Search = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
120
119
|
label: buttonLabel || 'Søk',
|
|
121
120
|
onClick: onClick
|
|
122
121
|
}, otherButtonProps))]
|
|
123
|
-
})),
|
|
124
|
-
id: tipId,
|
|
125
|
-
messageType: "tip",
|
|
126
|
-
message: tip
|
|
127
|
-
})]
|
|
122
|
+
})), renderInputMessage(tip, tipId)]
|
|
128
123
|
})]
|
|
129
124
|
});
|
|
130
125
|
});
|
|
@@ -9,12 +9,11 @@ import { CloseSmallIcon } from '../../icons/tsx/closeSmall.js';
|
|
|
9
9
|
import { spaceSeparatedIdListGenerator, derivativeIdGenerator } from '../../utils/idGenerator.js';
|
|
10
10
|
import '../../utils/color.js';
|
|
11
11
|
import { Icon } from '../Icon/Icon.js';
|
|
12
|
-
import { InputMessage } from '../InputMessage/InputMessage.js';
|
|
13
12
|
import { prefix, getCustomStyles, Container, InnerSingleValue, StyledIcon } from './Select.styles.js';
|
|
14
13
|
import '../Typography/Typography/Typography.js';
|
|
15
14
|
import { Label } from '../Typography/Label/Label.js';
|
|
16
15
|
import '../Typography/Link/Link.js';
|
|
17
|
-
import { getFormInputIconSize } from '../../helpers/Input/Input.utils.js';
|
|
16
|
+
import { renderInputMessage, getFormInputIconSize } from '../../helpers/Input/Input.utils.js';
|
|
18
17
|
|
|
19
18
|
var Option = components.Option,
|
|
20
19
|
NoOptionsMessage = components.NoOptionsMessage,
|
|
@@ -224,15 +223,7 @@ var SelectInner = function SelectInner(props, ref) {
|
|
|
224
223
|
children: label
|
|
225
224
|
})), jsx(ReactSelect, Object.assign({}, reactSelectProps, {
|
|
226
225
|
ref: ref
|
|
227
|
-
})),
|
|
228
|
-
messageType: "error",
|
|
229
|
-
id: errorMessageId,
|
|
230
|
-
message: errorMessage
|
|
231
|
-
}), tip && !errorMessage && jsx(InputMessage, {
|
|
232
|
-
messageType: "tip",
|
|
233
|
-
id: tipId,
|
|
234
|
-
message: tip
|
|
235
|
-
})]
|
|
226
|
+
})), renderInputMessage(tip, tipId, errorMessage, errorMessageId)]
|
|
236
227
|
}));
|
|
237
228
|
};
|
|
238
229
|
|
|
@@ -9,6 +9,7 @@ import '../../helpers/Chevron/AnimatedChevronUpDown.styles.js';
|
|
|
9
9
|
import '../../helpers/HiddenInput/HiddenInput.js';
|
|
10
10
|
import '../../helpers/Input/Input.styles.js';
|
|
11
11
|
import '../../helpers/Input/Input.tokens.js';
|
|
12
|
+
import '../InputMessage/InputMessage.js';
|
|
12
13
|
import '../../helpers/Paper/Paper.js';
|
|
13
14
|
import '../../helpers/RequiredMarker/RequiredMarker.js';
|
|
14
15
|
import { getBaseHTMLProps } from '../../types/BaseComponentProps.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TextareaHTMLAttributes } from 'react';
|
|
2
|
+
import { CommonInputProps } from '../../helpers/Input';
|
|
3
|
+
export declare const StyledTextArea: import("styled-components").StyledComponent<"input", any, Pick<import("../../helpers/Input").InputProps, "disabled" | "readOnly"> & {
|
|
4
|
+
hasErrorMessage: boolean;
|
|
5
|
+
} & Pick<import("../../helpers/Input").InputProps, "componentSize">, never>;
|
|
6
|
+
export declare type TextAreaProps = CommonInputProps & TextareaHTMLAttributes<HTMLTextAreaElement>;
|
|
7
|
+
export declare const TextArea: import("react").ForwardRefExoticComponent<CommonInputProps & TextareaHTMLAttributes<HTMLTextAreaElement> & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { slicedToArray as _slicedToArray } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { __rest } from 'tslib';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
import { forwardRef, useId, useRef, useState, useEffect } from 'react';
|
|
5
|
+
import styled from 'styled-components';
|
|
6
|
+
import { StatefulInput, OuterInputContainer } from '../../helpers/Input/Input.styles.js';
|
|
7
|
+
import { inputTokens } from '../../helpers/Input/Input.tokens.js';
|
|
8
|
+
import { getDefaultText, renderInputMessage } from '../../helpers/Input/Input.utils.js';
|
|
9
|
+
import { useCombinedRef } from '../../hooks/useCombinedRefs.js';
|
|
10
|
+
import '../../hooks/useFloatPosition.js';
|
|
11
|
+
import { spaceSeparatedIdListGenerator, derivativeIdGenerator } from '../../utils/idGenerator.js';
|
|
12
|
+
import '../../utils/color.js';
|
|
13
|
+
import '../../hooks/useScreenSize.js';
|
|
14
|
+
import '../ScrollableContainer/Scrollbar.js';
|
|
15
|
+
import '../ScrollableContainer/ScrollableContainer.js';
|
|
16
|
+
import { scrollbarStyling } from '../ScrollableContainer/scrollbarStyling.js';
|
|
17
|
+
import '../Typography/Typography/Typography.js';
|
|
18
|
+
import { Label } from '../Typography/Label/Label.js';
|
|
19
|
+
import '../Typography/Link/Link.js';
|
|
20
|
+
import { textAreaTokens } from './TextArea.tokens.js';
|
|
21
|
+
|
|
22
|
+
var defaultWidth = '320px';
|
|
23
|
+
var textarea = textAreaTokens.textarea;
|
|
24
|
+
var StyledTextArea = styled(StatefulInput).withConfig({
|
|
25
|
+
displayName: "TextArea__StyledTextArea",
|
|
26
|
+
componentId: "sc-dg30pn-0"
|
|
27
|
+
})(["", " ", " height:auto;resize:vertical;vertical-align:bottom;padding-bottom:", ";", ""], scrollbarStyling.webkit, scrollbarStyling.firefox, textarea.paddingBottom, inputTokens.input.sizes.medium.font);
|
|
28
|
+
var TextArea = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
29
|
+
var id = props.id,
|
|
30
|
+
value = props.value,
|
|
31
|
+
defaultValue = props.defaultValue,
|
|
32
|
+
onChange = props.onChange,
|
|
33
|
+
errorMessage = props.errorMessage,
|
|
34
|
+
required = props.required,
|
|
35
|
+
disabled = props.disabled,
|
|
36
|
+
tip = props.tip,
|
|
37
|
+
label = props.label,
|
|
38
|
+
ariaRequired = props['aria-required'],
|
|
39
|
+
ariaDescribedby = props['aria-describedby'],
|
|
40
|
+
className = props.className,
|
|
41
|
+
style = props.style,
|
|
42
|
+
_props$width = props.width,
|
|
43
|
+
width = _props$width === void 0 ? defaultWidth : _props$width,
|
|
44
|
+
rest = __rest(props, ["id", "value", "defaultValue", "onChange", "errorMessage", "required", "disabled", "tip", "label", 'aria-required', 'aria-describedby', "className", "style", "width"]);
|
|
45
|
+
|
|
46
|
+
var generatedId = useId();
|
|
47
|
+
var uniqueId = id !== null && id !== void 0 ? id : "".concat(generatedId, "-textArea");
|
|
48
|
+
var textAreaRef = useRef(null);
|
|
49
|
+
var multiRef = useCombinedRef(ref, textAreaRef);
|
|
50
|
+
|
|
51
|
+
var _useState = useState(getDefaultText(value, defaultValue)),
|
|
52
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
53
|
+
text = _useState2[0],
|
|
54
|
+
setText = _useState2[1];
|
|
55
|
+
|
|
56
|
+
useEffect(function () {
|
|
57
|
+
if (textAreaRef && textAreaRef.current) {
|
|
58
|
+
textAreaRef.current.style.height = "".concat(textAreaRef.current.scrollHeight + 2, "px");
|
|
59
|
+
}
|
|
60
|
+
}, [text]);
|
|
61
|
+
|
|
62
|
+
var onChangeHandler = function onChangeHandler(event) {
|
|
63
|
+
setText(event.target.value);
|
|
64
|
+
|
|
65
|
+
if (onChange) {
|
|
66
|
+
onChange(event);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
var hasErrorMessage = !!errorMessage;
|
|
71
|
+
var hasLabel = !!label;
|
|
72
|
+
var tipId = derivativeIdGenerator(uniqueId, 'tip', tip);
|
|
73
|
+
var errorMessageId = derivativeIdGenerator(uniqueId, 'errorMessage', errorMessage);
|
|
74
|
+
var showRequiredStyling = required || !!ariaRequired;
|
|
75
|
+
var containerProps = {
|
|
76
|
+
width: width,
|
|
77
|
+
className: className,
|
|
78
|
+
style: style
|
|
79
|
+
};
|
|
80
|
+
var textAreaProps = Object.assign({
|
|
81
|
+
ref: multiRef,
|
|
82
|
+
onChange: onChangeHandler,
|
|
83
|
+
value: value,
|
|
84
|
+
defaultValue: defaultValue,
|
|
85
|
+
id: uniqueId,
|
|
86
|
+
disabled: disabled,
|
|
87
|
+
hasErrorMessage: hasErrorMessage,
|
|
88
|
+
required: required,
|
|
89
|
+
'aria-required': ariaRequired,
|
|
90
|
+
'aria-describedby': spaceSeparatedIdListGenerator([tipId, errorMessageId, ariaDescribedby]),
|
|
91
|
+
'aria-invalid': hasErrorMessage ? true : undefined
|
|
92
|
+
}, rest);
|
|
93
|
+
return jsxs(OuterInputContainer, Object.assign({}, containerProps, {
|
|
94
|
+
children: [hasLabel && jsx(Label, Object.assign({
|
|
95
|
+
showRequiredStyling: showRequiredStyling,
|
|
96
|
+
htmlFor: uniqueId
|
|
97
|
+
}, {
|
|
98
|
+
children: label
|
|
99
|
+
})), jsx(StyledTextArea, Object.assign({}, textAreaProps, {
|
|
100
|
+
as: "textarea"
|
|
101
|
+
})), renderInputMessage(tip, tipId, errorMessage, errorMessageId)]
|
|
102
|
+
}));
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
export { StyledTextArea, TextArea };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { TextAreaProps } from '.';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: import("react").ForwardRefExoticComponent<import("../../helpers").CommonInputProps & import("react").TextareaHTMLAttributes<HTMLTextAreaElement> & import("react").RefAttributes<HTMLTextAreaElement>>;
|
|
5
|
+
argTypes: {
|
|
6
|
+
label: {
|
|
7
|
+
control: {
|
|
8
|
+
type: string;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
tip: {
|
|
12
|
+
control: {
|
|
13
|
+
type: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
errorMessage: {
|
|
17
|
+
control: {
|
|
18
|
+
type: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
width: {
|
|
22
|
+
control: {
|
|
23
|
+
type: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
required: {
|
|
27
|
+
control: {
|
|
28
|
+
type: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
disabled: {
|
|
32
|
+
control: {
|
|
33
|
+
type: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
readOnly: {
|
|
37
|
+
control: {
|
|
38
|
+
type: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
parameters: {
|
|
43
|
+
controls: {
|
|
44
|
+
exclude: string[];
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
export default _default;
|
|
49
|
+
export declare const Overview: (args: TextAreaProps) => JSX.Element;
|
|
50
|
+
export declare const Default: (args: TextAreaProps) => JSX.Element;
|
|
51
|
+
export declare const WithLabel: (args: TextAreaProps) => JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ddsBaseTokens } from '@norges-domstoler/dds-design-tokens';
|
|
2
|
+
|
|
3
|
+
var spacing = ddsBaseTokens.spacing;
|
|
4
|
+
var textarea = {
|
|
5
|
+
paddingBottom: spacing.SizesDdsSpacingLocalX05
|
|
6
|
+
};
|
|
7
|
+
var textAreaTokens = {
|
|
8
|
+
textarea: textarea
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { textAreaTokens };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './TextArea';
|
|
@@ -9,6 +9,7 @@ import '../../helpers/Chevron/AnimatedChevronUpDown.styles.js';
|
|
|
9
9
|
import '../../helpers/HiddenInput/HiddenInput.js';
|
|
10
10
|
import '../../helpers/Input/Input.styles.js';
|
|
11
11
|
import '../../helpers/Input/Input.tokens.js';
|
|
12
|
+
import '../InputMessage/InputMessage.js';
|
|
12
13
|
import '../../helpers/Paper/Paper.js';
|
|
13
14
|
import '../../helpers/RequiredMarker/RequiredMarker.js';
|
|
14
15
|
import '../Typography/Link/Link.js';
|