@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.
Files changed (139) hide show
  1. package/dist/cjs/components/Card/Card.stories.d.ts +1 -0
  2. package/dist/cjs/components/Card/CardAccordion/CardAccordion.d.ts +4 -0
  3. package/dist/cjs/components/Checkbox/Checkbox.stories.d.ts +1 -0
  4. package/dist/cjs/components/Checkbox/CheckboxGroup.d.ts +1 -1
  5. package/dist/cjs/components/Checkbox/CheckboxGroup.stories.d.ts +1 -1
  6. package/dist/cjs/components/Checkbox/CheckboxGroup.tokens.d.ts +7 -13
  7. package/dist/cjs/components/Datepicker/Datepicker.stories.d.ts +1 -0
  8. package/dist/cjs/components/Datepicker/Datepicker.tokens.d.ts +21 -3
  9. package/dist/cjs/components/InputMessage/InputMessage.tokens.d.ts +12 -9
  10. package/dist/cjs/components/List/List.tokens.d.ts +0 -4
  11. package/dist/cjs/components/RadioButton/RadioButtonGroup.d.ts +5 -5
  12. package/dist/cjs/components/ScrollableContainer/scrollbarStyling.d.ts +1 -1
  13. package/dist/cjs/components/Search/Search.tokens.d.ts +51 -21
  14. package/dist/cjs/components/Select/CustomSelect.stories.d.ts +2 -2
  15. package/dist/cjs/components/Select/MultiSelect.stories.d.ts +2 -1
  16. package/dist/cjs/components/Select/Select.d.ts +9 -3
  17. package/dist/cjs/components/Select/Select.stories.d.ts +3 -1
  18. package/dist/cjs/components/Select/Select.styles.d.ts +6 -5
  19. package/dist/cjs/components/Select/Select.tokens.d.ts +211 -91
  20. package/dist/cjs/components/TextInput/TextInput.d.ts +5 -1
  21. package/dist/cjs/components/TextInput/TextInput.stories.d.ts +3 -0
  22. package/dist/cjs/components/TextInput/TextInput.styles.d.ts +14 -6
  23. package/dist/cjs/components/TextInput/TextInput.tokens.d.ts +25 -44
  24. package/dist/cjs/components/TextInput/TextInput.types.d.ts +3 -0
  25. package/dist/cjs/components/Typography/Link/Link.d.ts +1 -1
  26. package/dist/cjs/components/Typography/Link/Link.stories.d.ts +1 -1
  27. package/dist/cjs/components/Typography/Paragraph/Paragraph.d.ts +1 -1
  28. package/dist/cjs/components/Typography/Paragraph/Paragraph.stories.d.ts +1 -1
  29. package/dist/cjs/components/Typography/Typography/Typography.types.d.ts +2 -3
  30. package/dist/cjs/components/Typography/Typography.tokens.d.ts +3 -89
  31. package/dist/cjs/helpers/Input/Input.styles.d.ts +3 -5
  32. package/dist/cjs/helpers/Input/Input.tokens.d.ts +52 -29
  33. package/dist/cjs/helpers/Input/Input.types.d.ts +4 -6
  34. package/dist/cjs/helpers/Input/Input.utils.d.ts +3 -0
  35. package/dist/cjs/helpers/Input/index.d.ts +1 -0
  36. package/dist/cjs/helpers/SelectionControl/SelectionControl.styles.d.ts +15 -0
  37. package/dist/cjs/helpers/SelectionControl/SelectionControl.tokens.d.ts +83 -0
  38. package/dist/cjs/helpers/SelectionControl/SelectionControl.utils.d.ts +2 -0
  39. package/dist/cjs/helpers/SelectionControl/index.d.ts +3 -0
  40. package/dist/cjs/helpers/styling/hover.d.ts +0 -2
  41. package/dist/cjs/hooks/useFloatPosition.d.ts +22 -1
  42. package/dist/cjs/hooks/useIsMounted.d.ts +2 -0
  43. package/dist/cjs/index.js +1401 -1529
  44. package/dist/cjs/test/mocks/ResizeObserver.d.ts +6 -0
  45. package/dist/components/Card/Card.stories.d.ts +1 -0
  46. package/dist/components/Card/CardAccordion/CardAccordion.d.ts +4 -0
  47. package/dist/components/Card/CardAccordion/CardAccordion.js +10 -6
  48. package/dist/components/Card/CardAccordion/CardAccordionBody.js +41 -15
  49. package/dist/components/Checkbox/Checkbox.js +13 -6
  50. package/dist/components/Checkbox/Checkbox.stories.d.ts +1 -0
  51. package/dist/components/Checkbox/CheckboxGroup.d.ts +1 -1
  52. package/dist/components/Checkbox/CheckboxGroup.js +26 -23
  53. package/dist/components/Checkbox/CheckboxGroup.stories.d.ts +1 -1
  54. package/dist/components/Checkbox/CheckboxGroup.tokens.d.ts +7 -13
  55. package/dist/components/Checkbox/CheckboxGroup.tokens.js +12 -24
  56. package/dist/components/Datepicker/Datepicker.js +37 -29
  57. package/dist/components/Datepicker/Datepicker.stories.d.ts +1 -0
  58. package/dist/components/Datepicker/Datepicker.tokens.d.ts +21 -3
  59. package/dist/components/Datepicker/Datepicker.tokens.js +28 -18
  60. package/dist/components/InputMessage/InputMessage.js +4 -4
  61. package/dist/components/InputMessage/InputMessage.tokens.d.ts +12 -9
  62. package/dist/components/InputMessage/InputMessage.tokens.js +16 -21
  63. package/dist/components/List/List.tokens.d.ts +0 -4
  64. package/dist/components/List/List.tokens.js +0 -8
  65. package/dist/components/OverflowMenu/OverflowMenu.js +4 -1
  66. package/dist/components/Popover/Popover.js +4 -1
  67. package/dist/components/RadioButton/RadioButton.js +12 -4
  68. package/dist/components/RadioButton/RadioButtonGroup.d.ts +5 -5
  69. package/dist/components/RadioButton/RadioButtonGroup.js +11 -9
  70. package/dist/components/ScrollableContainer/scrollbarStyling.d.ts +1 -1
  71. package/dist/components/ScrollableContainer/scrollbarStyling.js +2 -1
  72. package/dist/components/Search/Search.js +32 -11
  73. package/dist/components/Search/Search.tokens.d.ts +51 -21
  74. package/dist/components/Search/Search.tokens.js +41 -49
  75. package/dist/components/Select/CustomSelect.stories.d.ts +2 -2
  76. package/dist/components/Select/MultiSelect.stories.d.ts +2 -1
  77. package/dist/components/Select/Select.d.ts +9 -3
  78. package/dist/components/Select/Select.js +88 -62
  79. package/dist/components/Select/Select.stories.d.ts +3 -1
  80. package/dist/components/Select/Select.styles.d.ts +6 -5
  81. package/dist/components/Select/Select.styles.js +145 -72
  82. package/dist/components/Select/Select.tokens.d.ts +211 -91
  83. package/dist/components/Select/Select.tokens.js +167 -279
  84. package/dist/components/Tabs/Tabs.js +3 -4
  85. package/dist/components/TextInput/TextInput.d.ts +5 -1
  86. package/dist/components/TextInput/TextInput.js +53 -32
  87. package/dist/components/TextInput/TextInput.stories.d.ts +3 -0
  88. package/dist/components/TextInput/TextInput.styles.d.ts +14 -6
  89. package/dist/components/TextInput/TextInput.styles.js +22 -19
  90. package/dist/components/TextInput/TextInput.tokens.d.ts +25 -44
  91. package/dist/components/TextInput/TextInput.tokens.js +35 -41
  92. package/dist/components/TextInput/TextInput.types.d.ts +3 -0
  93. package/dist/components/ToggleButton/ToggleButton.tokens.js +5 -4
  94. package/dist/components/Tooltip/Tooltip.js +3 -1
  95. package/dist/components/Typography/Link/Link.d.ts +1 -1
  96. package/dist/components/Typography/Link/Link.stories.d.ts +1 -1
  97. package/dist/components/Typography/Paragraph/Paragraph.d.ts +1 -1
  98. package/dist/components/Typography/Paragraph/Paragraph.stories.d.ts +1 -1
  99. package/dist/components/Typography/Typography/Typography.types.d.ts +2 -3
  100. package/dist/components/Typography/Typography.tokens.d.ts +3 -89
  101. package/dist/components/Typography/Typography.tokens.js +16 -72
  102. package/dist/components/Typography/Typography.utils.js +2 -7
  103. package/dist/helpers/Input/Input.styles.d.ts +3 -5
  104. package/dist/helpers/Input/Input.styles.js +20 -28
  105. package/dist/helpers/Input/Input.tokens.d.ts +52 -29
  106. package/dist/helpers/Input/Input.tokens.js +36 -54
  107. package/dist/helpers/Input/Input.types.d.ts +4 -6
  108. package/dist/helpers/Input/Input.utils.d.ts +3 -0
  109. package/dist/helpers/Input/Input.utils.js +14 -0
  110. package/dist/helpers/Input/index.d.ts +1 -0
  111. package/dist/helpers/SelectionControl/SelectionControl.styles.d.ts +15 -0
  112. package/dist/helpers/SelectionControl/SelectionControl.styles.js +36 -0
  113. package/dist/helpers/SelectionControl/SelectionControl.tokens.d.ts +83 -0
  114. package/dist/helpers/SelectionControl/SelectionControl.tokens.js +100 -0
  115. package/dist/helpers/SelectionControl/SelectionControl.utils.d.ts +2 -0
  116. package/dist/helpers/SelectionControl/SelectionControl.utils.js +4 -0
  117. package/dist/helpers/SelectionControl/index.d.ts +3 -0
  118. package/dist/helpers/styling/danger.js +1 -1
  119. package/dist/helpers/styling/focus.js +5 -6
  120. package/dist/helpers/styling/hover.d.ts +0 -2
  121. package/dist/helpers/styling/hover.js +2 -4
  122. package/dist/hooks/useFloatPosition.d.ts +22 -1
  123. package/dist/hooks/useFloatPosition.js +13 -13
  124. package/dist/hooks/useIsMounted.d.ts +2 -0
  125. package/dist/hooks/useIsMounted.js +16 -0
  126. package/dist/test/mocks/ResizeObserver.d.ts +6 -0
  127. package/package.json +2 -2
  128. package/dist/cjs/components/Checkbox/Checkbox.styles.d.ts +0 -5
  129. package/dist/cjs/components/Checkbox/Checkbox.tokens.d.ts +0 -65
  130. package/dist/cjs/components/RadioButton/RadioButton.styles.d.ts +0 -5
  131. package/dist/cjs/components/RadioButton/RadioButton.tokens.d.ts +0 -43
  132. package/dist/components/Checkbox/Checkbox.styles.d.ts +0 -5
  133. package/dist/components/Checkbox/Checkbox.styles.js +0 -38
  134. package/dist/components/Checkbox/Checkbox.tokens.d.ts +0 -65
  135. package/dist/components/Checkbox/Checkbox.tokens.js +0 -132
  136. package/dist/components/RadioButton/RadioButton.styles.d.ts +0 -5
  137. package/dist/components/RadioButton/RadioButton.styles.js +0 -27
  138. package/dist/components/RadioButton/RadioButton.tokens.d.ts +0 -43
  139. 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,13 +1,59 @@
1
1
  import { CSSObject } from 'styled-components';
2
2
  export declare const inputTokens: {
3
- baseInput: {
4
- base: CSSObject;
5
- focus: {
6
- base: CSSObject;
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
- hover: {
9
- base: CSSObject;
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,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 LabelPresence = 'hasLabel' | 'noLabel';
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,3 @@
1
+ import { IconSize } from '../../components/Icon';
2
+ import { InputSize } from './Input.types';
3
+ export declare const getFormInputIconSize: (componentSize: InputSize) => IconSize;
@@ -1,3 +1,4 @@
1
1
  export * from './Input.styles';
2
2
  export * from './Input.types';
3
3
  export * from './Input.tokens';
4
+ export * from './Input.utils';
@@ -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,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,2 @@
1
+ export declare const selectionControlSizeNumberPx = 18;
2
+ export declare const selectionControlSize: string;
@@ -0,0 +1,3 @@
1
+ export * from './SelectionControl.styles';
2
+ export * from './SelectionControl.tokens';
3
+ export * from './SelectionControl.utils';
@@ -5,10 +5,8 @@ export declare const hoverWithBorder: {
5
5
  export declare const hoverInputfield: {
6
6
  borderColor: string;
7
7
  boxShadow: string;
8
- backgroundColor: string;
9
8
  };
10
9
  export declare const hoverDangerInputfield: {
11
10
  borderColor: string;
12
11
  boxShadow: string;
13
- backgroundColor: string;
14
12
  };
@@ -1,6 +1,26 @@
1
1
  import { Strategy } from '@floating-ui/react-dom';
2
2
  export declare type Placement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'right' | 'right-start' | 'right-end' | 'left' | 'left-start' | 'left-end';
3
- export declare const useFloatPosition: (arrowRef: HTMLElement | null, placement?: Placement, offset?: number) => {
3
+ interface UseFloatPositionOptions {
4
+ /**
5
+ * Whether to update the position of the floating element on every animation frame if required.
6
+ * This is optimized for performance but can still be costly.
7
+ * @default true
8
+ */
9
+ animationFrame?: boolean;
10
+ /**
11
+ * `offset` is used to displace the floating element from its core placement.
12
+ * The value passed is logical, meaning its effect on the
13
+ * physical result is dependent on the writing direction (e.g. RTL).
14
+ * @default 8
15
+ */
16
+ offset?: number;
17
+ /**
18
+ * Where to place the floating element relative to its reference element.
19
+ * @default 'bottom'
20
+ */
21
+ placement?: Placement;
22
+ }
23
+ export declare const useFloatPosition: (arrowRef: HTMLElement | null, options?: UseFloatPositionOptions) => {
4
24
  reference: (node: import("@floating-ui/react-dom").ReferenceType | null) => void;
5
25
  floating: (node: HTMLElement | null) => void;
6
26
  refs: {
@@ -22,3 +42,4 @@ export declare const useFloatPosition: (arrowRef: HTMLElement | null, placement?
22
42
  } | undefined;
23
43
  };
24
44
  };
45
+ export {};
@@ -0,0 +1,2 @@
1
+ declare const useIsMounted: () => () => boolean;
2
+ export default useIsMounted;