@norges-domstoler/dds-components 6.0.0 → 7.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/dist/cjs/components/Card/Card.stories.d.ts +1 -0
- package/dist/cjs/components/Card/CardAccordion/CardAccordion.d.ts +4 -0
- package/dist/cjs/components/Checkbox/Checkbox.stories.d.ts +1 -0
- package/dist/cjs/components/Checkbox/CheckboxGroup.d.ts +1 -1
- package/dist/cjs/components/Checkbox/CheckboxGroup.stories.d.ts +1 -1
- package/dist/cjs/components/Checkbox/CheckboxGroup.tokens.d.ts +7 -13
- package/dist/cjs/components/Datepicker/Datepicker.stories.d.ts +1 -0
- package/dist/cjs/components/Datepicker/Datepicker.tokens.d.ts +21 -3
- package/dist/cjs/components/InputMessage/InputMessage.tokens.d.ts +12 -9
- package/dist/cjs/components/List/List.tokens.d.ts +0 -4
- package/dist/cjs/components/RadioButton/RadioButtonGroup.d.ts +5 -5
- package/dist/cjs/components/ScrollableContainer/scrollbarStyling.d.ts +1 -1
- package/dist/cjs/components/Search/Search.tokens.d.ts +51 -21
- package/dist/cjs/components/Select/CustomSelect.stories.d.ts +2 -2
- package/dist/cjs/components/Select/MultiSelect.stories.d.ts +2 -1
- package/dist/cjs/components/Select/Select.d.ts +9 -3
- package/dist/cjs/components/Select/Select.stories.d.ts +3 -1
- package/dist/cjs/components/Select/Select.styles.d.ts +6 -5
- package/dist/cjs/components/Select/Select.tokens.d.ts +211 -91
- package/dist/cjs/components/TextInput/TextInput.d.ts +5 -1
- package/dist/cjs/components/TextInput/TextInput.stories.d.ts +3 -0
- package/dist/cjs/components/TextInput/TextInput.styles.d.ts +14 -6
- package/dist/cjs/components/TextInput/TextInput.tokens.d.ts +25 -44
- package/dist/cjs/components/TextInput/TextInput.types.d.ts +3 -0
- package/dist/cjs/components/Typography/Link/Link.d.ts +1 -1
- package/dist/cjs/components/Typography/Link/Link.stories.d.ts +1 -1
- package/dist/cjs/components/Typography/Paragraph/Paragraph.d.ts +1 -1
- package/dist/cjs/components/Typography/Paragraph/Paragraph.stories.d.ts +1 -1
- package/dist/cjs/components/Typography/Typography/Typography.types.d.ts +2 -3
- package/dist/cjs/components/Typography/Typography.tokens.d.ts +3 -89
- package/dist/cjs/helpers/Input/Input.styles.d.ts +3 -5
- package/dist/cjs/helpers/Input/Input.tokens.d.ts +52 -29
- package/dist/cjs/helpers/Input/Input.types.d.ts +4 -6
- package/dist/cjs/helpers/Input/Input.utils.d.ts +3 -0
- package/dist/cjs/helpers/Input/index.d.ts +1 -0
- package/dist/cjs/helpers/SelectionControl/SelectionControl.styles.d.ts +15 -0
- package/dist/cjs/helpers/SelectionControl/SelectionControl.tokens.d.ts +83 -0
- package/dist/cjs/helpers/SelectionControl/SelectionControl.utils.d.ts +2 -0
- package/dist/cjs/helpers/SelectionControl/index.d.ts +3 -0
- package/dist/cjs/helpers/styling/hover.d.ts +0 -2
- package/dist/cjs/hooks/useFloatPosition.d.ts +22 -1
- package/dist/cjs/hooks/useIsMounted.d.ts +2 -0
- package/dist/cjs/index.js +1401 -1529
- package/dist/cjs/test/mocks/ResizeObserver.d.ts +6 -0
- package/dist/components/Card/Card.stories.d.ts +1 -0
- package/dist/components/Card/CardAccordion/CardAccordion.d.ts +4 -0
- package/dist/components/Card/CardAccordion/CardAccordion.js +10 -6
- package/dist/components/Card/CardAccordion/CardAccordionBody.js +41 -15
- package/dist/components/Checkbox/Checkbox.js +13 -6
- package/dist/components/Checkbox/Checkbox.stories.d.ts +1 -0
- package/dist/components/Checkbox/CheckboxGroup.d.ts +1 -1
- package/dist/components/Checkbox/CheckboxGroup.js +26 -23
- package/dist/components/Checkbox/CheckboxGroup.stories.d.ts +1 -1
- package/dist/components/Checkbox/CheckboxGroup.tokens.d.ts +7 -13
- package/dist/components/Checkbox/CheckboxGroup.tokens.js +12 -24
- package/dist/components/Datepicker/Datepicker.js +37 -29
- package/dist/components/Datepicker/Datepicker.stories.d.ts +1 -0
- package/dist/components/Datepicker/Datepicker.tokens.d.ts +21 -3
- package/dist/components/Datepicker/Datepicker.tokens.js +28 -18
- package/dist/components/InputMessage/InputMessage.js +4 -4
- package/dist/components/InputMessage/InputMessage.tokens.d.ts +12 -9
- package/dist/components/InputMessage/InputMessage.tokens.js +16 -21
- package/dist/components/List/List.tokens.d.ts +0 -4
- package/dist/components/List/List.tokens.js +0 -8
- package/dist/components/OverflowMenu/OverflowMenu.js +4 -1
- package/dist/components/Popover/Popover.js +4 -1
- package/dist/components/RadioButton/RadioButton.js +12 -4
- package/dist/components/RadioButton/RadioButtonGroup.d.ts +5 -5
- package/dist/components/RadioButton/RadioButtonGroup.js +11 -9
- package/dist/components/ScrollableContainer/scrollbarStyling.d.ts +1 -1
- package/dist/components/ScrollableContainer/scrollbarStyling.js +2 -1
- package/dist/components/Search/Search.js +32 -11
- package/dist/components/Search/Search.tokens.d.ts +51 -21
- package/dist/components/Search/Search.tokens.js +41 -49
- package/dist/components/Select/CustomSelect.stories.d.ts +2 -2
- package/dist/components/Select/MultiSelect.stories.d.ts +2 -1
- package/dist/components/Select/Select.d.ts +9 -3
- package/dist/components/Select/Select.js +88 -62
- package/dist/components/Select/Select.stories.d.ts +3 -1
- package/dist/components/Select/Select.styles.d.ts +6 -5
- package/dist/components/Select/Select.styles.js +145 -72
- package/dist/components/Select/Select.tokens.d.ts +211 -91
- package/dist/components/Select/Select.tokens.js +167 -279
- package/dist/components/Tabs/Tabs.js +3 -4
- package/dist/components/TextInput/TextInput.d.ts +5 -1
- package/dist/components/TextInput/TextInput.js +53 -32
- package/dist/components/TextInput/TextInput.stories.d.ts +3 -0
- package/dist/components/TextInput/TextInput.styles.d.ts +14 -6
- package/dist/components/TextInput/TextInput.styles.js +22 -19
- package/dist/components/TextInput/TextInput.tokens.d.ts +25 -44
- package/dist/components/TextInput/TextInput.tokens.js +35 -41
- package/dist/components/TextInput/TextInput.types.d.ts +3 -0
- package/dist/components/ToggleButton/ToggleButton.tokens.js +5 -4
- package/dist/components/Tooltip/Tooltip.js +3 -1
- package/dist/components/Typography/Link/Link.d.ts +1 -1
- package/dist/components/Typography/Link/Link.stories.d.ts +1 -1
- package/dist/components/Typography/Paragraph/Paragraph.d.ts +1 -1
- package/dist/components/Typography/Paragraph/Paragraph.stories.d.ts +1 -1
- package/dist/components/Typography/Typography/Typography.types.d.ts +2 -3
- package/dist/components/Typography/Typography.tokens.d.ts +3 -89
- package/dist/components/Typography/Typography.tokens.js +16 -72
- package/dist/components/Typography/Typography.utils.js +2 -7
- package/dist/helpers/Input/Input.styles.d.ts +3 -5
- package/dist/helpers/Input/Input.styles.js +20 -28
- package/dist/helpers/Input/Input.tokens.d.ts +52 -29
- package/dist/helpers/Input/Input.tokens.js +36 -54
- package/dist/helpers/Input/Input.types.d.ts +4 -6
- package/dist/helpers/Input/Input.utils.d.ts +3 -0
- package/dist/helpers/Input/Input.utils.js +14 -0
- package/dist/helpers/Input/index.d.ts +1 -0
- package/dist/helpers/SelectionControl/SelectionControl.styles.d.ts +15 -0
- package/dist/helpers/SelectionControl/SelectionControl.styles.js +36 -0
- package/dist/helpers/SelectionControl/SelectionControl.tokens.d.ts +83 -0
- package/dist/helpers/SelectionControl/SelectionControl.tokens.js +100 -0
- package/dist/helpers/SelectionControl/SelectionControl.utils.d.ts +2 -0
- package/dist/helpers/SelectionControl/SelectionControl.utils.js +4 -0
- package/dist/helpers/SelectionControl/index.d.ts +3 -0
- package/dist/helpers/styling/danger.js +1 -1
- package/dist/helpers/styling/focus.js +5 -6
- package/dist/helpers/styling/hover.d.ts +0 -2
- package/dist/helpers/styling/hover.js +2 -4
- package/dist/hooks/useFloatPosition.d.ts +22 -1
- package/dist/hooks/useFloatPosition.js +13 -13
- package/dist/hooks/useIsMounted.d.ts +2 -0
- package/dist/hooks/useIsMounted.js +16 -0
- package/dist/test/mocks/ResizeObserver.d.ts +6 -0
- package/package.json +2 -2
- package/dist/cjs/components/Checkbox/Checkbox.styles.d.ts +0 -5
- package/dist/cjs/components/Checkbox/Checkbox.tokens.d.ts +0 -65
- package/dist/cjs/components/RadioButton/RadioButton.styles.d.ts +0 -5
- package/dist/cjs/components/RadioButton/RadioButton.tokens.d.ts +0 -43
- package/dist/components/Checkbox/Checkbox.styles.d.ts +0 -5
- package/dist/components/Checkbox/Checkbox.styles.js +0 -38
- package/dist/components/Checkbox/Checkbox.tokens.d.ts +0 -65
- package/dist/components/Checkbox/Checkbox.tokens.js +0 -132
- package/dist/components/RadioButton/RadioButton.styles.d.ts +0 -5
- package/dist/components/RadioButton/RadioButton.styles.js +0 -27
- package/dist/components/RadioButton/RadioButton.tokens.d.ts +0 -43
- package/dist/components/RadioButton/RadioButton.tokens.js +0 -100
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { StyledLabelProps } from '.';
|
|
2
1
|
import { Property } from 'csstype';
|
|
3
2
|
export declare const Input: import("styled-components").StyledComponent<"input", any, {}, never>;
|
|
4
|
-
export declare const StatefulInput: import("styled-components").StyledComponent<"input", any, Pick<import("./Input.types").InputProps, "disabled" | "readOnly"> & {
|
|
3
|
+
export declare const StatefulInput: import("styled-components").StyledComponent<"input", any, Pick<import("./Input.types").InputProps, "disabled" | "readOnly" | "componentSize"> & {
|
|
5
4
|
hasErrorMessage: boolean;
|
|
6
|
-
hasLabel: import("./Input.types").LabelPresence;
|
|
7
5
|
}, never>;
|
|
8
|
-
export declare const Label: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../../components/Typography").TypographyProps & import("react").RefAttributes<HTMLElement>>, any, StyledLabelProps, never>;
|
|
9
|
-
export declare const InputContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
6
|
declare type OuterInputContainerProps = {
|
|
11
7
|
width?: Property.Width<string>;
|
|
12
8
|
};
|
|
13
9
|
export declare const OuterInputContainer: import("styled-components").StyledComponent<"div", any, OuterInputContainerProps, never>;
|
|
10
|
+
/**Brukes som container til input og ikon for posisjonering. */
|
|
11
|
+
export declare const InputContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
14
12
|
export {};
|
|
@@ -1,47 +1,39 @@
|
|
|
1
1
|
import styled, { css } from 'styled-components';
|
|
2
2
|
import { inputTokens } from './Input.tokens.js';
|
|
3
|
-
import { Typography } from '../../components/Typography/Typography/Typography.js';
|
|
4
|
-
import 'tslib';
|
|
5
|
-
import 'react/jsx-runtime';
|
|
6
|
-
import 'react';
|
|
7
|
-
import '../../components/Typography/Link/Link.js';
|
|
8
3
|
import '../styling/focusVisible.js';
|
|
9
|
-
import '../styling/hover.js';
|
|
10
|
-
import '../styling/focus.js';
|
|
11
|
-
import '../styling/danger.js';
|
|
4
|
+
import { hoverInputfield, hoverDangerInputfield } from '../styling/hover.js';
|
|
5
|
+
import { focusInputfield, focusDangerInputfield } from '../styling/focus.js';
|
|
6
|
+
import { dangerInputfield } from '../styling/danger.js';
|
|
12
7
|
import { selection } from '../styling/selection.js';
|
|
13
8
|
|
|
9
|
+
var input = inputTokens.input,
|
|
10
|
+
container = inputTokens.container;
|
|
14
11
|
var Input = styled.input.withConfig({
|
|
15
12
|
displayName: "Inputstyles__Input",
|
|
16
13
|
componentId: "sc-1oz9x8w-0"
|
|
17
|
-
})(["", "
|
|
14
|
+
})(["position:relative;color:", ";border-radius:", ";border:", ";border-color:", ";background-color:", ";padding:", ";width:100%;margin:0;box-sizing:border-box;box-shadow:none;@media (prefers-reduced-motion:no-preference){transition:box-shadow 0.2s,border-color 0.2s,background-color 0.2s;}&[type='text'],&[type='password'],&[type='number'],&[type='tel'],&[type='date'],&[type='url'],&[type='email'],&[type='search'],&[type='datetime-local']{-webkit-appearance:none;}&::selection{", "}&:hover:enabled:read-write{", "}&:focus:enabled:read-write,&:active:enabled:read-write{", "}"], input.base.color, input.base.borderRadius, input.base.border, input.base.borderColor, input.base.backgroundColor, input.base.padding, selection, hoverInputfield, focusInputfield);
|
|
18
15
|
var StatefulInput = styled(Input).withConfig({
|
|
19
16
|
displayName: "Inputstyles__StatefulInput",
|
|
20
17
|
componentId: "sc-1oz9x8w-1"
|
|
21
|
-
})(["-webkit-appearance:textfield;", "
|
|
22
|
-
var
|
|
23
|
-
return css(["", ""],
|
|
24
|
-
},
|
|
18
|
+
})(["-webkit-appearance:textfield;", " ", " &:enabled:read-only{border:none;outline:none;cursor:default;background-color:", ";padding-left:0;}&:disabled{cursor:not-allowed;color:", ";background-color:", ";}"], function (_ref) {
|
|
19
|
+
var componentSize = _ref.componentSize;
|
|
20
|
+
return componentSize && css(["padding:", ";", ""], input.sizes[componentSize].padding, input.sizes[componentSize].font);
|
|
21
|
+
}, function (_ref2) {
|
|
25
22
|
var hasErrorMessage = _ref2.hasErrorMessage;
|
|
26
|
-
return hasErrorMessage && css(["", " &:hover:enabled:read-write{", "}&:focus:enabled:read-write,&:active:enabled:read-write{", "}"],
|
|
27
|
-
},
|
|
28
|
-
var
|
|
29
|
-
displayName: "
|
|
23
|
+
return hasErrorMessage && css(["", " &:hover:enabled:read-write{", "}&:focus:enabled:read-write,&:active:enabled:read-write{", "}"], dangerInputfield, hoverDangerInputfield, focusDangerInputfield);
|
|
24
|
+
}, input.readOnly.backgroundColor, input.disabled.color, input.disabled.backgroundColor);
|
|
25
|
+
var OuterInputContainer = styled.div.withConfig({
|
|
26
|
+
displayName: "Inputstyles__OuterInputContainer",
|
|
30
27
|
componentId: "sc-1oz9x8w-2"
|
|
31
|
-
})(["position:
|
|
32
|
-
var
|
|
33
|
-
return
|
|
28
|
+
})(["position:relative;gap:", ";width:", ";"], container.gap, function (_ref3) {
|
|
29
|
+
var width = _ref3.width;
|
|
30
|
+
return width;
|
|
34
31
|
});
|
|
32
|
+
/**Brukes som container til input og ikon for posisjonering. */
|
|
33
|
+
|
|
35
34
|
var InputContainer = styled.div.withConfig({
|
|
36
35
|
displayName: "Inputstyles__InputContainer",
|
|
37
36
|
componentId: "sc-1oz9x8w-3"
|
|
38
37
|
})(["position:relative;"]);
|
|
39
|
-
var OuterInputContainer = styled.div.withConfig({
|
|
40
|
-
displayName: "Inputstyles__OuterInputContainer",
|
|
41
|
-
componentId: "sc-1oz9x8w-4"
|
|
42
|
-
})(["display:flex;flex-direction:column;", ";"], function (_ref4) {
|
|
43
|
-
var width = _ref4.width;
|
|
44
|
-
return width && css(["width:", ";"], width);
|
|
45
|
-
});
|
|
46
38
|
|
|
47
|
-
export { Input, InputContainer,
|
|
39
|
+
export { Input, InputContainer, OuterInputContainer, StatefulInput };
|
|
@@ -1,13 +1,59 @@
|
|
|
1
1
|
import { CSSObject } from 'styled-components';
|
|
2
2
|
export declare const inputTokens: {
|
|
3
|
-
|
|
4
|
-
base:
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
input: {
|
|
4
|
+
base: {
|
|
5
|
+
color: string;
|
|
6
|
+
borderRadius: string;
|
|
7
|
+
border: string;
|
|
8
|
+
borderColor: string;
|
|
9
|
+
backgroundColor: string;
|
|
10
|
+
padding: string;
|
|
7
11
|
};
|
|
8
|
-
|
|
9
|
-
|
|
12
|
+
disabled: {
|
|
13
|
+
color: string;
|
|
14
|
+
backgroundColor: string;
|
|
15
|
+
};
|
|
16
|
+
readOnly: {
|
|
17
|
+
backgroundColor: string;
|
|
10
18
|
};
|
|
19
|
+
sizes: {
|
|
20
|
+
medium: {
|
|
21
|
+
padding: string;
|
|
22
|
+
font: {
|
|
23
|
+
lineHeight: any;
|
|
24
|
+
fontSize: string;
|
|
25
|
+
letterSpacing: any;
|
|
26
|
+
fontFamily: any;
|
|
27
|
+
fontWeight: any;
|
|
28
|
+
fontStyle: any;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
small: {
|
|
32
|
+
padding: string;
|
|
33
|
+
font: {
|
|
34
|
+
lineHeight: any;
|
|
35
|
+
fontSize: string;
|
|
36
|
+
letterSpacing: any;
|
|
37
|
+
fontFamily: any;
|
|
38
|
+
fontWeight: any;
|
|
39
|
+
fontStyle: any;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
tiny: {
|
|
43
|
+
padding: string;
|
|
44
|
+
font: {
|
|
45
|
+
lineHeight: any;
|
|
46
|
+
fontSize: string;
|
|
47
|
+
letterSpacing: any;
|
|
48
|
+
fontFamily: any;
|
|
49
|
+
fontWeight: any;
|
|
50
|
+
fontStyle: any;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
container: {
|
|
56
|
+
gap: string;
|
|
11
57
|
};
|
|
12
58
|
general: {
|
|
13
59
|
input: {
|
|
@@ -15,14 +61,6 @@ export declare const inputTokens: {
|
|
|
15
61
|
borderWidth: string;
|
|
16
62
|
borderColor: string;
|
|
17
63
|
textColor: string;
|
|
18
|
-
font: {
|
|
19
|
-
lineHeight: any;
|
|
20
|
-
fontSize: string;
|
|
21
|
-
letterSpacing: any;
|
|
22
|
-
fontFamily: any;
|
|
23
|
-
fontWeight: any;
|
|
24
|
-
fontStyle: any;
|
|
25
|
-
};
|
|
26
64
|
hover: {
|
|
27
65
|
backgroundColor: string;
|
|
28
66
|
borderColor: string;
|
|
@@ -48,21 +86,6 @@ export declare const inputTokens: {
|
|
|
48
86
|
noLabel: {
|
|
49
87
|
base: CSSObject;
|
|
50
88
|
};
|
|
51
|
-
readOnly: {
|
|
52
|
-
base: CSSObject;
|
|
53
|
-
};
|
|
54
|
-
disabled: {
|
|
55
|
-
base: CSSObject;
|
|
56
|
-
};
|
|
57
|
-
error: {
|
|
58
|
-
base: CSSObject;
|
|
59
|
-
hover: {
|
|
60
|
-
base: CSSObject;
|
|
61
|
-
};
|
|
62
|
-
focus: {
|
|
63
|
-
base: CSSObject;
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
89
|
label: {
|
|
67
90
|
base: CSSObject;
|
|
68
91
|
hover: {
|
|
@@ -1,46 +1,47 @@
|
|
|
1
1
|
import { ddsBaseTokens, ddsReferenceTokens } from '@norges-domstoler/dds-design-tokens';
|
|
2
|
-
import 'styled-components';
|
|
3
|
-
import '../styling/focusVisible.js';
|
|
4
|
-
import { hoverInputfield, hoverDangerInputfield } from '../styling/hover.js';
|
|
5
|
-
import { focusInputfield, focusDangerInputfield } from '../styling/focus.js';
|
|
6
|
-
import { dangerInputfield } from '../styling/danger.js';
|
|
7
|
-
import '../styling/selection.js';
|
|
8
2
|
|
|
9
3
|
var colors = ddsBaseTokens.colors,
|
|
10
4
|
spacing = ddsBaseTokens.spacing,
|
|
11
5
|
fontPackages = ddsBaseTokens.fontPackages,
|
|
12
6
|
border = ddsBaseTokens.border;
|
|
13
7
|
var TextInput = ddsReferenceTokens.textInput;
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
8
|
+
var input = {
|
|
9
|
+
base: {
|
|
10
|
+
color: TextInput.input.textColor,
|
|
11
|
+
borderRadius: TextInput.input.borderRadius,
|
|
12
|
+
border: "".concat(border.BordersDdsBorderStyleLightStrokeWeight, " solid ").concat(colors.DdsColorNeutralsGray5),
|
|
13
|
+
borderColor: TextInput.input.borderColor,
|
|
14
|
+
backgroundColor: colors.DdsColorNeutralsWhite,
|
|
15
|
+
padding: "".concat(spacing.SizesDdsSpacingLocalX075, " ").concat(spacing.SizesDdsSpacingLocalX1, " ").concat(spacing.SizesDdsSpacingLocalX075, " ").concat(spacing.SizesDdsSpacingLocalX075)
|
|
16
|
+
},
|
|
17
|
+
disabled: {
|
|
18
|
+
color: colors.DdsColorNeutralsGray7,
|
|
19
|
+
backgroundColor: colors.DdsColorNeutralsGray1
|
|
20
|
+
},
|
|
21
|
+
readOnly: {
|
|
22
|
+
backgroundColor: 'transparent'
|
|
23
|
+
},
|
|
24
|
+
sizes: {
|
|
25
|
+
medium: {
|
|
26
|
+
padding: spacing.SizesDdsSpacingLocalX075,
|
|
27
|
+
font: fontPackages.body_sans_02.base
|
|
28
|
+
},
|
|
29
|
+
small: {
|
|
30
|
+
padding: "".concat(spacing.SizesDdsSpacingLocalX05, " ").concat(spacing.SizesDdsSpacingLocalX075, " ").concat(spacing.SizesDdsSpacingLocalX05, " ").concat(spacing.SizesDdsSpacingLocalX075),
|
|
31
|
+
font: fontPackages.body_sans_01.base
|
|
32
|
+
},
|
|
33
|
+
tiny: {
|
|
34
|
+
padding: "".concat(spacing.SizesDdsSpacingLocalX025, " ").concat(spacing.SizesDdsSpacingLocalX05, " ").concat(spacing.SizesDdsSpacingLocalX025, " ").concat(spacing.SizesDdsSpacingLocalX05),
|
|
35
|
+
font: fontPackages.supportingStyle_tiny_01.base
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
23
39
|
var inputHasLabelBase = {
|
|
24
40
|
padding: "".concat(spacing.SizesDdsSpacingLocalX075NumberPx + fontPackages.supportingStyle_label_01.numbers.lineHeightNumber * 0.01 * fontPackages.supportingStyle_label_01.numbers.fontSizeNumber, "px ").concat(spacing.SizesDdsSpacingLocalX1, " ").concat(spacing.SizesDdsSpacingLocalX075, " ").concat(spacing.SizesDdsSpacingLocalX1)
|
|
25
41
|
};
|
|
26
42
|
var inputNoLabelBase = {
|
|
27
43
|
padding: "".concat(spacing.SizesDdsSpacingLocalX075, " ").concat(spacing.SizesDdsSpacingLocalX1, " ").concat(spacing.SizesDdsSpacingLocalX075, " ").concat(spacing.SizesDdsSpacingLocalX1)
|
|
28
44
|
};
|
|
29
|
-
var inputDisabledBase = {
|
|
30
|
-
cursor: 'not-allowed',
|
|
31
|
-
color: colors.DdsColorNeutralsGray7,
|
|
32
|
-
backgroundColor: colors.DdsColorNeutralsGray1
|
|
33
|
-
};
|
|
34
|
-
var inputErrorBase = Object.assign({}, dangerInputfield);
|
|
35
|
-
var inputErrorHoverBase = Object.assign({}, hoverDangerInputfield);
|
|
36
|
-
var inputErrorFocusBase = Object.assign({}, focusDangerInputfield);
|
|
37
|
-
var inputReadOnlyBase = {
|
|
38
|
-
border: 'none',
|
|
39
|
-
outline: 'none',
|
|
40
|
-
cursor: 'default',
|
|
41
|
-
backgroundColor: 'transparent',
|
|
42
|
-
paddingLeft: spacing.SizesDdsSpacingLocalX1
|
|
43
|
-
};
|
|
44
45
|
var inputLabelBase = {
|
|
45
46
|
padding: "".concat(spacing.SizesDdsSpacingLocalX075, " ").concat(spacing.SizesDdsSpacingLocalX1)
|
|
46
47
|
};
|
|
@@ -53,16 +54,12 @@ var inputLabelFocusBase = {
|
|
|
53
54
|
var inputLabelDisabledBase = {
|
|
54
55
|
color: colors.DdsColorNeutralsGray6
|
|
55
56
|
};
|
|
57
|
+
var container = {
|
|
58
|
+
gap: spacing.SizesDdsSpacingLocalX0125
|
|
59
|
+
};
|
|
56
60
|
var inputTokens = {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
focus: {
|
|
60
|
-
base: inputFocusBase
|
|
61
|
-
},
|
|
62
|
-
hover: {
|
|
63
|
-
base: inputHoverBase
|
|
64
|
-
}
|
|
65
|
-
},
|
|
61
|
+
input: input,
|
|
62
|
+
container: container,
|
|
66
63
|
general: TextInput,
|
|
67
64
|
hasLabel: {
|
|
68
65
|
base: inputHasLabelBase
|
|
@@ -70,21 +67,6 @@ var inputTokens = {
|
|
|
70
67
|
noLabel: {
|
|
71
68
|
base: inputNoLabelBase
|
|
72
69
|
},
|
|
73
|
-
readOnly: {
|
|
74
|
-
base: inputReadOnlyBase
|
|
75
|
-
},
|
|
76
|
-
disabled: {
|
|
77
|
-
base: inputDisabledBase
|
|
78
|
-
},
|
|
79
|
-
error: {
|
|
80
|
-
base: inputErrorBase,
|
|
81
|
-
hover: {
|
|
82
|
-
base: inputErrorHoverBase
|
|
83
|
-
},
|
|
84
|
-
focus: {
|
|
85
|
-
base: inputErrorFocusBase
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
70
|
label: {
|
|
89
71
|
base: inputLabelBase,
|
|
90
72
|
hover: {
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { InputHTMLAttributes } from 'react';
|
|
2
2
|
import { Property } from 'csstype';
|
|
3
|
+
export declare type InputSize = 'medium' | 'small' | 'tiny';
|
|
3
4
|
export declare type InputProps = {
|
|
4
5
|
/**Ledetekst for input. */
|
|
5
6
|
label?: string;
|
|
7
|
+
/**Størrelse på inputfeltet. */
|
|
8
|
+
componentSize?: InputSize;
|
|
6
9
|
/**Bredde for inputfeltet. */
|
|
7
10
|
width?: Property.Width<string>;
|
|
8
11
|
/**Hjelpetekst. */
|
|
@@ -10,11 +13,6 @@ export declare type InputProps = {
|
|
|
10
13
|
/**Feilmelding. Setter også error state. */
|
|
11
14
|
errorMessage?: string;
|
|
12
15
|
} & InputHTMLAttributes<HTMLInputElement>;
|
|
13
|
-
export declare type
|
|
14
|
-
export declare type StyledInputProps = Pick<InputProps, 'readOnly' | 'disabled'> & {
|
|
16
|
+
export declare type StyledInputProps = Pick<InputProps, 'readOnly' | 'disabled' | 'componentSize'> & {
|
|
15
17
|
hasErrorMessage: boolean;
|
|
16
|
-
hasLabel: LabelPresence;
|
|
17
|
-
};
|
|
18
|
-
export declare type StyledLabelProps = {
|
|
19
|
-
disabled?: boolean;
|
|
20
18
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
var getFormInputIconSize = function getFormInputIconSize(componentSize) {
|
|
2
|
+
switch (componentSize) {
|
|
3
|
+
case 'medium':
|
|
4
|
+
return 'medium';
|
|
5
|
+
|
|
6
|
+
case 'small':
|
|
7
|
+
return 'small';
|
|
8
|
+
|
|
9
|
+
case 'tiny':
|
|
10
|
+
return 'small';
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { getFormInputIconSize };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare type SelectionControlType = 'radio' | 'checkbox';
|
|
2
|
+
declare type CustomSelectionControlProps = {
|
|
3
|
+
controlType?: SelectionControlType;
|
|
4
|
+
};
|
|
5
|
+
export declare const CustomSelectionControl: import("styled-components").StyledComponent<"span", any, CustomSelectionControlProps, never>;
|
|
6
|
+
declare type ContainerProps = {
|
|
7
|
+
hasLabel?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
error?: boolean;
|
|
11
|
+
indeterminate?: boolean;
|
|
12
|
+
controlType: SelectionControlType;
|
|
13
|
+
};
|
|
14
|
+
export declare const Container: import("styled-components").StyledComponent<"label", any, ContainerProps, never>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import { focusVisible, focusVisibleTransitionValue } from '../styling/focusVisible.js';
|
|
3
|
+
import '../styling/hover.js';
|
|
4
|
+
import '../styling/focus.js';
|
|
5
|
+
import '../styling/danger.js';
|
|
6
|
+
import '../styling/selection.js';
|
|
7
|
+
import { selectionControlTokens } from './SelectionControl.tokens.js';
|
|
8
|
+
|
|
9
|
+
var selectionControl = selectionControlTokens.selectionControl,
|
|
10
|
+
container = selectionControlTokens.container,
|
|
11
|
+
checkmark = selectionControlTokens.checkmark;
|
|
12
|
+
var CustomSelectionControl = styled.span.withConfig({
|
|
13
|
+
displayName: "SelectionControlstyles__CustomSelectionControl",
|
|
14
|
+
componentId: "sc-1wv80b7-0"
|
|
15
|
+
})(["position:absolute;left:0;box-sizing:border-box;border:", ";border-color:", ";background-color:", ";border-radius:", ";height:", ";width:", ";", " &:after{content:'';position:absolute;display:none;}"], selectionControl.base.border, selectionControl.base.borderColor, selectionControl.base.backgroundColor, selectionControl.base.borderRadius, selectionControl.base.height, selectionControl.base.width, function (_ref) {
|
|
16
|
+
var controlType = _ref.controlType;
|
|
17
|
+
return controlType === 'radio' && css(["border-radius:50%;"]);
|
|
18
|
+
});
|
|
19
|
+
var Container = styled.label.withConfig({
|
|
20
|
+
displayName: "SelectionControlstyles__Container",
|
|
21
|
+
componentId: "sc-1wv80b7-1"
|
|
22
|
+
})(["position:relative;display:flex;align-items:center;cursor:pointer;user-select:none;width:fit-content;color:", ";", " input ~ ", "{@media (prefers-reduced-motion:no-preference){transition:box-shadow 0.2s,background-color 0.2s,border 0.2s;}}&:focus-within{", " @media (prefers-reduced-motion:no-preference){transition:", ";}}&:hover input:enabled ~ ", "{background-color:", ";box-shadow:", ";border-color:", ";}input:checked:enabled ~ ", ",input[data-indeterminate='true'] ~ ", "{border-color:", ";background-color:", ";}&:hover input:checked:enabled ~ ", ",&:hover input:enabled[data-indeterminate='true'] ~ ", "{background-color:", ";box-shadow:", ";border-color:", ";}", " input:disabled ~ ", "{", "}input:checked:disabled ~ ", ",input:disabled[data-indeterminate='true'] ~ ", "{background-color:", ";border-color:", ";}input:checked ~ ", ":after,input[data-indeterminate='true'] ~ ", ":after{display:block;}", " ", ""], container.color, function (_ref2) {
|
|
23
|
+
var hasLabel = _ref2.hasLabel;
|
|
24
|
+
return hasLabel ? css(["padding-left:", ";"], container.withLabel.paddingLeft) : css(["padding:", ";"], container.noLabel.padding);
|
|
25
|
+
}, CustomSelectionControl, focusVisible, focusVisibleTransitionValue, CustomSelectionControl, selectionControl.hover.base.backgroundColor, selectionControl.hover.base.boxShadow, selectionControl.hover.base.borderColor, CustomSelectionControl, CustomSelectionControl, selectionControl.checked.base.borderColor, selectionControl.checked.base.backgroundColor, CustomSelectionControl, CustomSelectionControl, selectionControl.checked.hover.backgroundColor, selectionControl.checked.hover.boxShadow, selectionControl.checked.hover.borderColor, function (_ref3) {
|
|
26
|
+
var error = _ref3.error;
|
|
27
|
+
return error && css(["&:hover input:enabled ~ ", "{background-color:", ";box-shadow:", ";border-color:", ";}input ~ ", ",input:checked:enabled ~ ", ",&:hover input:checked:enabled ~ ", "{box-shadow:", ";border-color:", ";}"], CustomSelectionControl, selectionControl.hover.danger.backgroundColor, selectionControl.hover.danger.boxShadow, selectionControl.hover.danger.borderColor, CustomSelectionControl, CustomSelectionControl, CustomSelectionControl, selectionControl.danger.boxShadow, selectionControl.danger.borderColor);
|
|
28
|
+
}, CustomSelectionControl, selectionControl.disabled, CustomSelectionControl, CustomSelectionControl, selectionControl.checked.disabled.backgroundColor, selectionControl.checked.disabled.borderColor, CustomSelectionControl, CustomSelectionControl, function (_ref4) {
|
|
29
|
+
var disabled = _ref4.disabled;
|
|
30
|
+
return disabled && css(["cursor:not-allowed;color:", ";"], container.disabled.color);
|
|
31
|
+
}, function (_ref5) {
|
|
32
|
+
var controlType = _ref5.controlType;
|
|
33
|
+
return controlType === 'checkbox' ? css(["", ":after{border:solid ", ";border-width:0 1px 1px 0;left:35%;top:10%;width:30%;height:65%;transform:rotate(45deg);}input[data-indeterminate='true'] ~ ", ":after{border-width:1px 0 0 0;left:25%;top:50%;width:50%;height:1px;transform:none;}"], CustomSelectionControl, checkmark.checkbox.borderColor, CustomSelectionControl) : css(["", ":after{border-radius:50%;background-color:", ";width:", ";height:", ";left:", ";top:", ";}"], CustomSelectionControl, checkmark.radio.backgroundColor, checkmark.radio.width, checkmark.radio.height, checkmark.radio.left, checkmark.radio.top);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export { Container, CustomSelectionControl };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export declare const selectionControlTokens: {
|
|
2
|
+
selectionControl: {
|
|
3
|
+
base: {
|
|
4
|
+
border: string;
|
|
5
|
+
borderColor: string;
|
|
6
|
+
backgroundColor: string;
|
|
7
|
+
borderRadius: string;
|
|
8
|
+
height: string;
|
|
9
|
+
width: string;
|
|
10
|
+
};
|
|
11
|
+
hover: {
|
|
12
|
+
base: {
|
|
13
|
+
backgroundColor: string;
|
|
14
|
+
boxShadow: string;
|
|
15
|
+
borderColor: string;
|
|
16
|
+
};
|
|
17
|
+
danger: {
|
|
18
|
+
backgroundColor: string;
|
|
19
|
+
boxShadow: string;
|
|
20
|
+
borderColor: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
danger: {
|
|
24
|
+
boxShadow: string;
|
|
25
|
+
borderColor: string;
|
|
26
|
+
};
|
|
27
|
+
disabled: {
|
|
28
|
+
borderColor: string;
|
|
29
|
+
};
|
|
30
|
+
readOnly: {
|
|
31
|
+
backgroundColor: string;
|
|
32
|
+
};
|
|
33
|
+
checked: {
|
|
34
|
+
base: {
|
|
35
|
+
borderColor: string;
|
|
36
|
+
backgroundColor: string;
|
|
37
|
+
};
|
|
38
|
+
hover: {
|
|
39
|
+
backgroundColor: string;
|
|
40
|
+
boxShadow: string;
|
|
41
|
+
borderColor: string;
|
|
42
|
+
};
|
|
43
|
+
disabled: {
|
|
44
|
+
borderColor: string;
|
|
45
|
+
backgroundColor: string;
|
|
46
|
+
};
|
|
47
|
+
readOnly: {
|
|
48
|
+
borderColor: string;
|
|
49
|
+
backgroundColor: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
checkbox: {
|
|
53
|
+
indeterminate: {
|
|
54
|
+
borderColor: string;
|
|
55
|
+
backgroundColor: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
checkmark: {
|
|
60
|
+
checkbox: {
|
|
61
|
+
borderColor: string;
|
|
62
|
+
};
|
|
63
|
+
radio: {
|
|
64
|
+
backgroundColor: string;
|
|
65
|
+
height: string;
|
|
66
|
+
width: string;
|
|
67
|
+
left: string;
|
|
68
|
+
top: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
container: {
|
|
72
|
+
color: string;
|
|
73
|
+
disabled: {
|
|
74
|
+
color: string;
|
|
75
|
+
};
|
|
76
|
+
withLabel: {
|
|
77
|
+
paddingLeft: string;
|
|
78
|
+
};
|
|
79
|
+
noLabel: {
|
|
80
|
+
padding: string;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { ddsBaseTokens } from '@norges-domstoler/dds-design-tokens';
|
|
2
|
+
import { selectionControlSize, selectionControlSizeNumberPx } from './SelectionControl.utils.js';
|
|
3
|
+
import 'styled-components';
|
|
4
|
+
import '../styling/focusVisible.js';
|
|
5
|
+
import { hoverInputfield } from '../styling/hover.js';
|
|
6
|
+
import '../styling/focus.js';
|
|
7
|
+
import { dangerInputfield } from '../styling/danger.js';
|
|
8
|
+
import '../styling/selection.js';
|
|
9
|
+
|
|
10
|
+
var colors = ddsBaseTokens.colors,
|
|
11
|
+
spacing = ddsBaseTokens.spacing,
|
|
12
|
+
borderRadius = ddsBaseTokens.borderRadius;
|
|
13
|
+
var checkmark = {
|
|
14
|
+
checkbox: {
|
|
15
|
+
borderColor: colors.DdsColorNeutralsWhite
|
|
16
|
+
},
|
|
17
|
+
radio: {
|
|
18
|
+
backgroundColor: colors.DdsColorNeutralsWhite,
|
|
19
|
+
height: spacing.SizesDdsSpacingLocalX05,
|
|
20
|
+
width: spacing.SizesDdsSpacingLocalX05,
|
|
21
|
+
left: "calc(50% - ".concat(spacing.SizesDdsSpacingLocalX05NumberPx / 2, "px)"),
|
|
22
|
+
top: "calc(50% - ".concat(spacing.SizesDdsSpacingLocalX05NumberPx / 2, "px)")
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
var selectionControl = {
|
|
26
|
+
base: {
|
|
27
|
+
border: '1px solid',
|
|
28
|
+
borderColor: colors.DdsColorNeutralsGray5,
|
|
29
|
+
backgroundColor: colors.DdsColorNeutralsWhite,
|
|
30
|
+
borderRadius: borderRadius.RadiiDdsBorderRadius1Radius,
|
|
31
|
+
height: selectionControlSize,
|
|
32
|
+
width: selectionControlSize
|
|
33
|
+
},
|
|
34
|
+
hover: {
|
|
35
|
+
base: {
|
|
36
|
+
backgroundColor: colors.DdsColorInteractiveLightest,
|
|
37
|
+
boxShadow: "inset 0 0 0 1px ".concat(hoverInputfield.borderColor),
|
|
38
|
+
borderColor: hoverInputfield.borderColor
|
|
39
|
+
},
|
|
40
|
+
danger: {
|
|
41
|
+
backgroundColor: colors.DdsColorDangerLightest,
|
|
42
|
+
boxShadow: "inset 0 0 0 1px ".concat(dangerInputfield.borderColor),
|
|
43
|
+
borderColor: dangerInputfield.borderColor
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
danger: {
|
|
47
|
+
boxShadow: "inset 0 0 0 1px ".concat(dangerInputfield.borderColor),
|
|
48
|
+
borderColor: dangerInputfield.borderColor
|
|
49
|
+
},
|
|
50
|
+
disabled: {
|
|
51
|
+
borderColor: colors.DdsColorNeutralsGray5
|
|
52
|
+
},
|
|
53
|
+
readOnly: {
|
|
54
|
+
backgroundColor: 'transparent'
|
|
55
|
+
},
|
|
56
|
+
checked: {
|
|
57
|
+
base: {
|
|
58
|
+
borderColor: colors.DdsColorInteractiveBase,
|
|
59
|
+
backgroundColor: colors.DdsColorInteractiveBase
|
|
60
|
+
},
|
|
61
|
+
hover: {
|
|
62
|
+
backgroundColor: colors.DdsColorInteractiveDark,
|
|
63
|
+
boxShadow: "inset 0 0 0 1px ".concat(colors.DdsColorInteractiveDark),
|
|
64
|
+
borderColor: colors.DdsColorInteractiveDark
|
|
65
|
+
},
|
|
66
|
+
disabled: {
|
|
67
|
+
borderColor: colors.DdsColorNeutralsGray6,
|
|
68
|
+
backgroundColor: colors.DdsColorNeutralsGray6
|
|
69
|
+
},
|
|
70
|
+
readOnly: {
|
|
71
|
+
borderColor: colors.DdsColorNeutralsGray6,
|
|
72
|
+
backgroundColor: colors.DdsColorNeutralsGray6
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
checkbox: {
|
|
76
|
+
indeterminate: {
|
|
77
|
+
borderColor: colors.DdsColorInteractiveBase,
|
|
78
|
+
backgroundColor: colors.DdsColorInteractiveBase
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
var container = {
|
|
83
|
+
color: colors.DdsColorNeutralsGray9,
|
|
84
|
+
disabled: {
|
|
85
|
+
color: colors.DdsColorNeutralsGray6
|
|
86
|
+
},
|
|
87
|
+
withLabel: {
|
|
88
|
+
paddingLeft: "".concat(selectionControlSizeNumberPx + spacing.SizesDdsSpacingLocalX05NumberPx, "px")
|
|
89
|
+
},
|
|
90
|
+
noLabel: {
|
|
91
|
+
padding: "".concat(selectionControlSizeNumberPx / 2, "px")
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
var selectionControlTokens = {
|
|
95
|
+
selectionControl: selectionControl,
|
|
96
|
+
checkmark: checkmark,
|
|
97
|
+
container: container
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export { selectionControlTokens };
|
|
@@ -3,7 +3,7 @@ import { ddsBaseTokens } from '@norges-domstoler/dds-design-tokens';
|
|
|
3
3
|
var Colors = ddsBaseTokens.colors;
|
|
4
4
|
var dangerInputfield = {
|
|
5
5
|
borderColor: Colors.DdsColorDangerBase,
|
|
6
|
-
boxShadow: "
|
|
6
|
+
boxShadow: "0 0 0 1px ".concat(Colors.DdsColorDangerBase)
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
export { dangerInputfield };
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { ddsBaseTokens } from '@norges-domstoler/dds-design-tokens';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
Colors = ddsBaseTokens.colors;
|
|
3
|
+
var border = ddsBaseTokens.border;
|
|
5
4
|
var focusInputfield = {
|
|
6
5
|
outline: 'none',
|
|
7
|
-
borderColor:
|
|
8
|
-
boxShadow: "
|
|
6
|
+
borderColor: border.BordersDdsBorderFocusInputfieldStroke,
|
|
7
|
+
boxShadow: "0 0 0 2px ".concat(border.BordersDdsBorderFocusInputfieldStroke)
|
|
9
8
|
};
|
|
10
9
|
var focusDangerInputfield = {
|
|
11
|
-
borderColor:
|
|
12
|
-
boxShadow: "
|
|
10
|
+
borderColor: border.BordersDdsBorderFocusInputfieldStroke,
|
|
11
|
+
boxShadow: "0 0 0 2px ".concat(border.BordersDdsBorderFocusInputfieldStroke)
|
|
13
12
|
};
|
|
14
13
|
|
|
15
14
|
export { focusDangerInputfield, focusInputfield };
|