@norges-domstoler/dds-components 5.5.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 (191) hide show
  1. package/dist/_virtual/_rollupPluginBabelHelpers.js +58 -1
  2. package/dist/cjs/components/Card/Card.stories.d.ts +1 -0
  3. package/dist/cjs/components/Card/CardAccordion/CardAccordion.d.ts +4 -0
  4. package/dist/cjs/components/Checkbox/Checkbox.stories.d.ts +1 -0
  5. package/dist/cjs/components/Checkbox/CheckboxGroup.d.ts +1 -1
  6. package/dist/cjs/components/Checkbox/CheckboxGroup.stories.d.ts +1 -1
  7. package/dist/cjs/components/Checkbox/CheckboxGroup.tokens.d.ts +7 -13
  8. package/dist/cjs/components/Datepicker/Datepicker.stories.d.ts +1 -0
  9. package/dist/cjs/components/Datepicker/Datepicker.tokens.d.ts +21 -3
  10. package/dist/cjs/components/InputMessage/InputMessage.tokens.d.ts +12 -9
  11. package/dist/cjs/components/InternalHeader/InternalHeader.styles.d.ts +1 -1
  12. package/dist/cjs/components/List/List.tokens.d.ts +0 -4
  13. package/dist/cjs/components/OverflowMenu/OverflowMenu.stories.d.ts +1 -1
  14. package/dist/cjs/components/RadioButton/RadioButtonGroup.d.ts +31 -2
  15. package/dist/cjs/components/RadioButton/RadioButtonGroup.stories.d.ts +19 -1
  16. package/dist/cjs/components/ScrollableContainer/scrollbarStyling.d.ts +1 -1
  17. package/dist/cjs/components/Search/Search.tokens.d.ts +51 -21
  18. package/dist/cjs/components/Select/CustomSelect.stories.d.ts +2 -2
  19. package/dist/cjs/components/Select/MultiSelect.stories.d.ts +2 -1
  20. package/dist/cjs/components/Select/Select.d.ts +9 -3
  21. package/dist/cjs/components/Select/Select.stories.d.ts +3 -1
  22. package/dist/cjs/components/Select/Select.styles.d.ts +6 -5
  23. package/dist/cjs/components/Select/Select.tokens.d.ts +211 -91
  24. package/dist/cjs/components/Tabs/Tab.d.ts +0 -5
  25. package/dist/cjs/components/Tabs/Tabs.context.d.ts +0 -2
  26. package/dist/cjs/components/Tabs/Tabs.d.ts +4 -4
  27. package/dist/cjs/components/Tabs/Tabs.stories.d.ts +2 -1
  28. package/dist/cjs/components/Tabs/Tabs.tokens.d.ts +1 -6
  29. package/dist/cjs/components/TextInput/TextInput.d.ts +5 -1
  30. package/dist/cjs/components/TextInput/TextInput.stories.d.ts +3 -0
  31. package/dist/cjs/components/TextInput/TextInput.styles.d.ts +14 -6
  32. package/dist/cjs/components/TextInput/TextInput.tokens.d.ts +25 -44
  33. package/dist/cjs/components/TextInput/TextInput.types.d.ts +3 -0
  34. package/dist/cjs/components/Tooltip/Tooltip.stories.d.ts +1 -1
  35. package/dist/cjs/components/Typography/Link/Link.d.ts +1 -1
  36. package/dist/cjs/components/Typography/Link/Link.stories.d.ts +1 -1
  37. package/dist/cjs/components/Typography/Paragraph/Paragraph.d.ts +1 -1
  38. package/dist/cjs/components/Typography/Paragraph/Paragraph.stories.d.ts +1 -1
  39. package/dist/cjs/components/Typography/Typography/Typography.types.d.ts +2 -3
  40. package/dist/cjs/components/Typography/Typography.tokens.d.ts +3 -89
  41. package/dist/cjs/helpers/Input/Input.styles.d.ts +3 -5
  42. package/dist/cjs/helpers/Input/Input.tokens.d.ts +52 -29
  43. package/dist/cjs/helpers/Input/Input.types.d.ts +4 -6
  44. package/dist/cjs/helpers/Input/Input.utils.d.ts +3 -0
  45. package/dist/cjs/helpers/Input/index.d.ts +1 -0
  46. package/dist/cjs/helpers/SelectionControl/SelectionControl.styles.d.ts +15 -0
  47. package/dist/cjs/helpers/SelectionControl/SelectionControl.tokens.d.ts +83 -0
  48. package/dist/cjs/helpers/SelectionControl/SelectionControl.utils.d.ts +2 -0
  49. package/dist/cjs/helpers/SelectionControl/index.d.ts +3 -0
  50. package/dist/cjs/helpers/styling/hover.d.ts +0 -2
  51. package/dist/cjs/hooks/index.d.ts +0 -1
  52. package/dist/cjs/hooks/useCombinedRefs.d.ts +18 -0
  53. package/dist/cjs/hooks/useFloatPosition.d.ts +22 -1
  54. package/dist/cjs/hooks/useFocusTrap.d.ts +16 -1
  55. package/dist/cjs/hooks/useIsMounted.d.ts +2 -0
  56. package/dist/cjs/hooks/useMountTransition.d.ts +32 -0
  57. package/dist/cjs/hooks/useOnClickOutside.d.ts +13 -0
  58. package/dist/cjs/hooks/useOnKeyDown.d.ts +13 -0
  59. package/dist/cjs/hooks/useRoveFocus.d.ts +25 -1
  60. package/dist/cjs/hooks/useScreenSize.d.ts +12 -0
  61. package/dist/cjs/index.d.ts +1 -0
  62. package/dist/cjs/index.js +1683 -1595
  63. package/dist/cjs/test/mocks/ResizeObserver.d.ts +6 -0
  64. package/dist/components/Card/Card.stories.d.ts +1 -0
  65. package/dist/components/Card/CardAccordion/CardAccordion.d.ts +4 -0
  66. package/dist/components/Card/CardAccordion/CardAccordion.js +10 -6
  67. package/dist/components/Card/CardAccordion/CardAccordionBody.js +41 -15
  68. package/dist/components/Checkbox/Checkbox.js +13 -6
  69. package/dist/components/Checkbox/Checkbox.stories.d.ts +1 -0
  70. package/dist/components/Checkbox/CheckboxGroup.d.ts +1 -1
  71. package/dist/components/Checkbox/CheckboxGroup.js +26 -23
  72. package/dist/components/Checkbox/CheckboxGroup.stories.d.ts +1 -1
  73. package/dist/components/Checkbox/CheckboxGroup.tokens.d.ts +7 -13
  74. package/dist/components/Checkbox/CheckboxGroup.tokens.js +12 -24
  75. package/dist/components/Datepicker/Datepicker.js +37 -29
  76. package/dist/components/Datepicker/Datepicker.stories.d.ts +1 -0
  77. package/dist/components/Datepicker/Datepicker.tokens.d.ts +21 -3
  78. package/dist/components/Datepicker/Datepicker.tokens.js +28 -18
  79. package/dist/components/InputMessage/InputMessage.js +4 -4
  80. package/dist/components/InputMessage/InputMessage.tokens.d.ts +12 -9
  81. package/dist/components/InputMessage/InputMessage.tokens.js +16 -21
  82. package/dist/components/InternalHeader/InternalHeader.styles.d.ts +1 -1
  83. package/dist/components/List/List.tokens.d.ts +0 -4
  84. package/dist/components/List/List.tokens.js +0 -8
  85. package/dist/components/OverflowMenu/OverflowMenu.js +7 -4
  86. package/dist/components/OverflowMenu/OverflowMenu.stories.d.ts +1 -1
  87. package/dist/components/Popover/Popover.js +4 -1
  88. package/dist/components/RadioButton/RadioButton.js +12 -4
  89. package/dist/components/RadioButton/RadioButtonGroup.d.ts +31 -2
  90. package/dist/components/RadioButton/RadioButtonGroup.js +34 -27
  91. package/dist/components/RadioButton/RadioButtonGroup.stories.d.ts +19 -1
  92. package/dist/components/ScrollableContainer/scrollbarStyling.d.ts +1 -1
  93. package/dist/components/ScrollableContainer/scrollbarStyling.js +2 -1
  94. package/dist/components/Search/Search.js +32 -11
  95. package/dist/components/Search/Search.tokens.d.ts +51 -21
  96. package/dist/components/Search/Search.tokens.js +41 -49
  97. package/dist/components/Select/CustomSelect.stories.d.ts +2 -2
  98. package/dist/components/Select/MultiSelect.stories.d.ts +2 -1
  99. package/dist/components/Select/Select.d.ts +9 -3
  100. package/dist/components/Select/Select.js +88 -62
  101. package/dist/components/Select/Select.stories.d.ts +3 -1
  102. package/dist/components/Select/Select.styles.d.ts +6 -5
  103. package/dist/components/Select/Select.styles.js +145 -72
  104. package/dist/components/Select/Select.tokens.d.ts +211 -91
  105. package/dist/components/Select/Select.tokens.js +167 -279
  106. package/dist/components/Tabs/Tab.d.ts +0 -5
  107. package/dist/components/Tabs/Tab.js +6 -12
  108. package/dist/components/Tabs/TabList.js +7 -1
  109. package/dist/components/Tabs/Tabs.context.d.ts +0 -2
  110. package/dist/components/Tabs/Tabs.context.js +1 -2
  111. package/dist/components/Tabs/Tabs.d.ts +4 -4
  112. package/dist/components/Tabs/Tabs.js +13 -11
  113. package/dist/components/Tabs/Tabs.stories.d.ts +2 -1
  114. package/dist/components/Tabs/Tabs.tokens.d.ts +1 -6
  115. package/dist/components/Tabs/Tabs.tokens.js +4 -15
  116. package/dist/components/TextInput/TextInput.d.ts +5 -1
  117. package/dist/components/TextInput/TextInput.js +53 -32
  118. package/dist/components/TextInput/TextInput.stories.d.ts +3 -0
  119. package/dist/components/TextInput/TextInput.styles.d.ts +14 -6
  120. package/dist/components/TextInput/TextInput.styles.js +22 -19
  121. package/dist/components/TextInput/TextInput.tokens.d.ts +25 -44
  122. package/dist/components/TextInput/TextInput.tokens.js +35 -41
  123. package/dist/components/TextInput/TextInput.types.d.ts +3 -0
  124. package/dist/components/ToggleButton/ToggleButton.tokens.js +5 -4
  125. package/dist/components/Tooltip/Tooltip.js +3 -1
  126. package/dist/components/Tooltip/Tooltip.stories.d.ts +1 -1
  127. package/dist/components/Typography/Link/Link.d.ts +1 -1
  128. package/dist/components/Typography/Link/Link.stories.d.ts +1 -1
  129. package/dist/components/Typography/Paragraph/Paragraph.d.ts +1 -1
  130. package/dist/components/Typography/Paragraph/Paragraph.stories.d.ts +1 -1
  131. package/dist/components/Typography/Typography/Typography.types.d.ts +2 -3
  132. package/dist/components/Typography/Typography.tokens.d.ts +3 -89
  133. package/dist/components/Typography/Typography.tokens.js +16 -72
  134. package/dist/components/Typography/Typography.utils.js +2 -7
  135. package/dist/helpers/Input/Input.styles.d.ts +3 -5
  136. package/dist/helpers/Input/Input.styles.js +20 -28
  137. package/dist/helpers/Input/Input.tokens.d.ts +52 -29
  138. package/dist/helpers/Input/Input.tokens.js +36 -54
  139. package/dist/helpers/Input/Input.types.d.ts +4 -6
  140. package/dist/helpers/Input/Input.utils.d.ts +3 -0
  141. package/dist/helpers/Input/Input.utils.js +14 -0
  142. package/dist/helpers/Input/index.d.ts +1 -0
  143. package/dist/helpers/SelectionControl/SelectionControl.styles.d.ts +15 -0
  144. package/dist/helpers/SelectionControl/SelectionControl.styles.js +36 -0
  145. package/dist/helpers/SelectionControl/SelectionControl.tokens.d.ts +83 -0
  146. package/dist/helpers/SelectionControl/SelectionControl.tokens.js +100 -0
  147. package/dist/helpers/SelectionControl/SelectionControl.utils.d.ts +2 -0
  148. package/dist/helpers/SelectionControl/SelectionControl.utils.js +4 -0
  149. package/dist/helpers/SelectionControl/index.d.ts +3 -0
  150. package/dist/helpers/styling/danger.js +1 -1
  151. package/dist/helpers/styling/focus.js +5 -6
  152. package/dist/helpers/styling/hover.d.ts +0 -2
  153. package/dist/helpers/styling/hover.js +2 -4
  154. package/dist/hooks/index.d.ts +0 -1
  155. package/dist/hooks/useCombinedRefs.d.ts +18 -0
  156. package/dist/hooks/useCombinedRefs.js +19 -0
  157. package/dist/hooks/useFloatPosition.d.ts +22 -1
  158. package/dist/hooks/useFloatPosition.js +13 -13
  159. package/dist/hooks/useFocusTrap.d.ts +16 -1
  160. package/dist/hooks/useFocusTrap.js +15 -0
  161. package/dist/hooks/useIsMounted.d.ts +2 -0
  162. package/dist/hooks/useIsMounted.js +16 -0
  163. package/dist/hooks/useMountTransition.d.ts +32 -0
  164. package/dist/hooks/useMountTransition.js +33 -0
  165. package/dist/hooks/useOnClickOutside.d.ts +13 -0
  166. package/dist/hooks/useOnClickOutside.js +14 -0
  167. package/dist/hooks/useOnKeyDown.d.ts +13 -0
  168. package/dist/hooks/useOnKeyDown.js +14 -0
  169. package/dist/hooks/useRoveFocus.d.ts +25 -1
  170. package/dist/hooks/useRoveFocus.js +25 -0
  171. package/dist/hooks/useScreenSize.d.ts +12 -0
  172. package/dist/hooks/useScreenSize.js +53 -3
  173. package/dist/index.d.ts +1 -0
  174. package/dist/index.js +8 -0
  175. package/dist/test/mocks/ResizeObserver.d.ts +6 -0
  176. package/package.json +2 -2
  177. package/dist/cjs/components/Checkbox/Checkbox.styles.d.ts +0 -5
  178. package/dist/cjs/components/Checkbox/Checkbox.tokens.d.ts +0 -65
  179. package/dist/cjs/components/RadioButton/RadioButton.styles.d.ts +0 -5
  180. package/dist/cjs/components/RadioButton/RadioButton.tokens.d.ts +0 -43
  181. package/dist/cjs/hooks/useId.d.ts +0 -1
  182. package/dist/components/Checkbox/Checkbox.styles.d.ts +0 -5
  183. package/dist/components/Checkbox/Checkbox.styles.js +0 -38
  184. package/dist/components/Checkbox/Checkbox.tokens.d.ts +0 -65
  185. package/dist/components/Checkbox/Checkbox.tokens.js +0 -132
  186. package/dist/components/RadioButton/RadioButton.styles.d.ts +0 -5
  187. package/dist/components/RadioButton/RadioButton.styles.js +0 -27
  188. package/dist/components/RadioButton/RadioButton.tokens.d.ts +0 -43
  189. package/dist/components/RadioButton/RadioButton.tokens.js +0 -100
  190. package/dist/hooks/useId.d.ts +0 -1
  191. package/dist/hooks/useId.js +0 -15
@@ -6,7 +6,7 @@ export declare type ParagraphProps = BaseComponentPropsWithChildren<HTMLParagrap
6
6
  } & BaseTypographyProps>;
7
7
  export declare const Paragraph: import("react").ForwardRefExoticComponent<Pick<import("react").HTMLAttributes<HTMLParagraphElement>, "id" | "className"> & {
8
8
  /**Spesifiserer typografistil basert på utvalget for brødtekst og ingress. */
9
- typographyType?: TypographyBodyType | TypographyLeadType | undefined;
9
+ typographyType?: ("bodySans01" | "bodySans02" | "bodySans03" | "bodySans04") | TypographyLeadType | undefined;
10
10
  } & {
11
11
  withMargins?: boolean | undefined;
12
12
  } & {
@@ -5,7 +5,7 @@ declare type StoryTProps = {
5
5
  declare const _default: {
6
6
  title: string;
7
7
  component: import("react").ForwardRefExoticComponent<Pick<import("react").HTMLAttributes<HTMLParagraphElement>, "id" | "className"> & {
8
- typographyType?: import("..").TypographyBodyType | import("..").TypographyLeadType | undefined;
8
+ typographyType?: ("bodySans01" | "bodySans02" | "bodySans03" | "bodySans04") | import("..").TypographyLeadType | undefined;
9
9
  } & {
10
10
  withMargins?: boolean | undefined;
11
11
  } & {
@@ -1,11 +1,10 @@
1
1
  import { CSSProperties, ElementType, HTMLAttributes, PropsWithChildren } from 'react';
2
2
  import { TextColor } from '../../../utils';
3
3
  declare type TypographyBodySansType = 'bodySans01' | 'bodySans02' | 'bodySans03' | 'bodySans04';
4
- declare type TypographyBodySerifType = 'bodySerif01' | 'bodySerif02' | 'bodySerif03' | 'bodySerif04';
5
- export declare type TypographyBodyType = TypographyBodySansType | TypographyBodySerifType;
4
+ export declare type TypographyBodyType = TypographyBodySansType;
6
5
  export declare type TypographyHeadingType = 'headingSans01' | 'headingSans02' | 'headingSans03' | 'headingSans04' | 'headingSans05' | 'headingSans06' | 'headingSans07' | 'headingSans08';
7
6
  export declare type TypographyLeadType = 'leadSans01' | 'leadSans02' | 'leadSans03' | 'leadSans04' | 'leadSans05';
8
- declare type TypographySupportingType = 'supportingStyleInputText01' | 'supportingStyleInputText02' | 'supportingStyleInputText03' | 'supportingStyleHelperText01' | 'supportingStylePlaceholderText01' | 'supportingStyleTiny01' | 'supportingStyleTiny02';
7
+ declare type TypographySupportingType = 'supportingStyleHelperText01' | 'supportingStylePlaceholderText01' | 'supportingStylePlaceholderText02' | 'supportingStylePlaceholderText03' | 'supportingStyleTiny01' | 'supportingStyleTiny02';
9
8
  export declare type AnchorTypographyType = 'a';
10
9
  export declare type LabelTypographyType = 'supportingStyleLabel01';
11
10
  export declare type OtherTypographyType = TypographyHeadingType | TypographyBodyType | TypographyLeadType | TypographySupportingType;
@@ -225,74 +225,6 @@ export declare const typographyTokens: {
225
225
  marginBottom: string;
226
226
  };
227
227
  };
228
- bodySerif01: {
229
- base: {
230
- color: string;
231
- font: {
232
- lineHeight: any;
233
- fontSize: string;
234
- letterSpacing: any;
235
- fontFamily: any;
236
- fontWeight: any;
237
- fontStyle: any;
238
- };
239
- };
240
- margins: {
241
- marginTop: number;
242
- marginBottom: string;
243
- };
244
- };
245
- bodySerif02: {
246
- base: {
247
- color: string;
248
- font: {
249
- lineHeight: any;
250
- fontSize: string;
251
- letterSpacing: any;
252
- fontFamily: any;
253
- fontWeight: any;
254
- fontStyle: any;
255
- };
256
- };
257
- margins: {
258
- marginTop: number;
259
- marginBottom: string;
260
- };
261
- };
262
- bodySerif03: {
263
- base: {
264
- color: string;
265
- font: {
266
- lineHeight: any;
267
- fontSize: string;
268
- letterSpacing: any;
269
- fontFamily: any;
270
- fontWeight: any;
271
- fontStyle: any;
272
- };
273
- };
274
- margins: {
275
- marginTop: number;
276
- marginBottom: string;
277
- };
278
- };
279
- bodySerif04: {
280
- base: {
281
- color: string;
282
- font: {
283
- lineHeight: any;
284
- fontSize: string;
285
- letterSpacing: any;
286
- fontFamily: any;
287
- fontWeight: any;
288
- fontStyle: any;
289
- };
290
- };
291
- margins: {
292
- marginTop: number;
293
- marginBottom: string;
294
- };
295
- };
296
228
  leadSans01: {
297
229
  base: {
298
230
  color: string;
@@ -414,25 +346,7 @@ export declare const typographyTokens: {
414
346
  marginBottom: string;
415
347
  };
416
348
  };
417
- supportingStyleInputText01: {
418
- base: {
419
- color: string;
420
- font: {
421
- lineHeight: any;
422
- fontSize: string;
423
- letterSpacing: any;
424
- fontFamily: any;
425
- fontWeight: any;
426
- fontStyle: any;
427
- };
428
- margin: number;
429
- };
430
- margins: {
431
- marginTop: string;
432
- marginBottom: string;
433
- };
434
- };
435
- supportingStyleInputText02: {
349
+ supportingStylePlaceholderText01: {
436
350
  base: {
437
351
  color: string;
438
352
  font: {
@@ -450,7 +364,7 @@ export declare const typographyTokens: {
450
364
  marginBottom: string;
451
365
  };
452
366
  };
453
- supportingStyleInputText03: {
367
+ supportingStylePlaceholderText02: {
454
368
  base: {
455
369
  color: string;
456
370
  font: {
@@ -468,7 +382,7 @@ export declare const typographyTokens: {
468
382
  marginBottom: string;
469
383
  };
470
384
  };
471
- supportingStylePlaceholderText01: {
385
+ supportingStylePlaceholderText03: {
472
386
  base: {
473
387
  color: string;
474
388
  font: {
@@ -148,46 +148,6 @@ var bodySans04 = {
148
148
  marginBottom: fontPackages.body_sans_04.paragraph.paragraphSpacing
149
149
  }
150
150
  };
151
- var bodySerif01 = {
152
- base: {
153
- color: textDefault.textColor,
154
- font: fontPackages.body_serif_01.base
155
- },
156
- margins: {
157
- marginTop: 0,
158
- marginBottom: fontPackages.body_serif_01.paragraph.paragraphSpacing
159
- }
160
- };
161
- var bodySerif02 = {
162
- base: {
163
- color: textDefault.textColor,
164
- font: fontPackages.body_serif_02.base
165
- },
166
- margins: {
167
- marginTop: 0,
168
- marginBottom: fontPackages.body_serif_02.paragraph.paragraphSpacing
169
- }
170
- };
171
- var bodySerif03 = {
172
- base: {
173
- color: textDefault.textColor,
174
- font: fontPackages.body_serif_03.base
175
- },
176
- margins: {
177
- marginTop: 0,
178
- marginBottom: fontPackages.body_serif_03.paragraph.paragraphSpacing
179
- }
180
- };
181
- var bodySerif04 = {
182
- base: {
183
- color: textDefault.textColor,
184
- font: fontPackages.body_serif_04.base
185
- },
186
- margins: {
187
- marginTop: 0,
188
- marginBottom: fontPackages.body_serif_04.paragraph.paragraphSpacing
189
- }
190
- };
191
151
  var leadSans01 = {
192
152
  base: {
193
153
  color: textDefault.textColor,
@@ -260,48 +220,37 @@ var supportingStyleHelperText01 = {
260
220
  marginBottom: fontPackages.supportingStyle_helpertext_01.paragraph.paragraphSpacing
261
221
  }
262
222
  };
263
- var supportingStyleInputText01 = {
264
- base: {
265
- color: textDefault.textColor,
266
- font: fontPackages.supportingStyle_inputtext_01.base,
267
- margin: 0
268
- },
269
- margins: {
270
- marginTop: fontPackages.supportingStyle_inputtext_01.paragraph.paragraphSpacing,
271
- marginBottom: fontPackages.supportingStyle_inputtext_01.paragraph.paragraphSpacing
272
- }
273
- };
274
- var supportingStyleInputText02 = {
223
+ var supportingStylePlaceholderText01 = {
275
224
  base: {
276
- color: textDefault.textColor,
277
- font: fontPackages.supportingStyle_inputtext_02.base,
225
+ color: colors.DdsColorNeutralsGray6,
226
+ font: fontPackages.supportingStyle_placeholdertext_01.base,
278
227
  margin: 0
279
228
  },
280
229
  margins: {
281
- marginTop: fontPackages.supportingStyle_inputtext_02.paragraph.paragraphSpacing,
282
- marginBottom: fontPackages.supportingStyle_inputtext_02.paragraph.paragraphSpacing
230
+ marginTop: fontPackages.supportingStyle_placeholdertext_01.paragraph.paragraphSpacing,
231
+ marginBottom: fontPackages.supportingStyle_placeholdertext_01.paragraph.paragraphSpacing
283
232
  }
284
233
  };
285
- var supportingStyleInputText03 = {
234
+ var supportingStylePlaceholderText02 = {
286
235
  base: {
287
- color: textDefault.textColor,
288
- font: fontPackages.supportingStyle_inputtext_03.base,
236
+ color: colors.DdsColorNeutralsGray6,
237
+ font: fontPackages.supportingStyle_placeholdertext_02.base,
289
238
  margin: 0
290
239
  },
291
240
  margins: {
292
- marginTop: fontPackages.supportingStyle_inputtext_03.paragraph.paragraphSpacing,
293
- marginBottom: fontPackages.supportingStyle_inputtext_03.paragraph.paragraphSpacing
241
+ marginTop: fontPackages.supportingStyle_placeholdertext_02.paragraph.paragraphSpacing,
242
+ marginBottom: fontPackages.supportingStyle_placeholdertext_02.paragraph.paragraphSpacing
294
243
  }
295
244
  };
296
- var supportingStylePlaceholderText01 = {
245
+ var supportingStylePlaceholderText03 = {
297
246
  base: {
298
247
  color: colors.DdsColorNeutralsGray6,
299
- font: fontPackages.supportingStyle_placeholdertext_01.base,
248
+ font: fontPackages.supportingStyle_placeholdertext_03.base,
300
249
  margin: 0
301
250
  },
302
251
  margins: {
303
- marginTop: fontPackages.supportingStyle_placeholdertext_01.paragraph.paragraphSpacing,
304
- marginBottom: fontPackages.supportingStyle_placeholdertext_01.paragraph.paragraphSpacing
252
+ marginTop: fontPackages.supportingStyle_placeholdertext_03.paragraph.paragraphSpacing,
253
+ marginBottom: fontPackages.supportingStyle_placeholdertext_03.paragraph.paragraphSpacing
305
254
  }
306
255
  };
307
256
  var supportingStyleTiny01 = {
@@ -341,10 +290,6 @@ var typographyTokens = {
341
290
  bodySans02: bodySans02,
342
291
  bodySans03: bodySans03,
343
292
  bodySans04: bodySans04,
344
- bodySerif01: bodySerif01,
345
- bodySerif02: bodySerif02,
346
- bodySerif03: bodySerif03,
347
- bodySerif04: bodySerif04,
348
293
  leadSans01: leadSans01,
349
294
  leadSans02: leadSans02,
350
295
  leadSans03: leadSans03,
@@ -352,10 +297,9 @@ var typographyTokens = {
352
297
  leadSans05: leadSans05,
353
298
  supportingStyleLabel01: supportingStyleLabel01,
354
299
  supportingStyleHelperText01: supportingStyleHelperText01,
355
- supportingStyleInputText01: supportingStyleInputText01,
356
- supportingStyleInputText02: supportingStyleInputText02,
357
- supportingStyleInputText03: supportingStyleInputText03,
358
300
  supportingStylePlaceholderText01: supportingStylePlaceholderText01,
301
+ supportingStylePlaceholderText02: supportingStylePlaceholderText02,
302
+ supportingStylePlaceholderText03: supportingStylePlaceholderText03,
359
303
  supportingStyleTiny01: supportingStyleTiny01,
360
304
  supportingStyleTiny02: supportingStyleTiny02
361
305
  },
@@ -38,20 +38,15 @@ var getElementType = function getElementType(element) {
38
38
  case 'bodySans02':
39
39
  case 'bodySans03':
40
40
  case 'bodySans04':
41
- case 'bodySerif01':
42
- case 'bodySerif02':
43
- case 'bodySerif03':
44
- case 'bodySerif04':
45
41
  case 'leadSans01':
46
42
  case 'leadSans02':
47
43
  case 'leadSans03':
48
44
  case 'leadSans04':
49
45
  case 'leadSans05':
50
- case 'supportingStyleInputText01':
51
- case 'supportingStyleInputText02':
52
- case 'supportingStyleInputText03':
53
46
  case 'supportingStyleHelperText01':
54
47
  case 'supportingStylePlaceholderText01':
48
+ case 'supportingStylePlaceholderText02':
49
+ case 'supportingStylePlaceholderText03':
55
50
  case 'supportingStyleTiny01':
56
51
  case 'supportingStyleTiny02':
57
52
  default:
@@ -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
- })(["", " width:100%;top:0;left:0;margin:0;padding: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{", "}&:focus:enabled:read-write,&:active:enabled:read-write{", "}&:hover:enabled:read-write{", "}"], inputTokens.baseInput.base, selection, inputTokens.baseInput.focus.base, inputTokens.baseInput.hover.base);
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;", ";&:hover:enabled:read-write ~ label{", "}&:focus:enabled:read-write ~ label{", "}", " &:enabled:read-only{", "}&:disabled{", "}"], function (_ref) {
22
- var hasLabel = _ref.hasLabel;
23
- return css(["", ""], inputTokens[hasLabel].base);
24
- }, inputTokens.label.hover.base, inputTokens.label.focus.base, function (_ref2) {
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{", "}"], inputTokens.error.base, inputTokens.error.hover.base, inputTokens.error.focus.base);
27
- }, inputTokens.readOnly.base, inputTokens.disabled.base);
28
- var Label = styled(Typography).withConfig({
29
- displayName: "Inputstyles__Label",
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:absolute;top:0;left:0;@media (prefers-reduced-motion:no-preference){transition:color 0.2s,background-color 0.2s;}", " ", ""], inputTokens.label.base, function (_ref3) {
32
- var disabled = _ref3.disabled;
33
- return disabled && css(["", ""], inputTokens.label.disabled.base);
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, Label, OuterInputContainer, StatefulInput };
39
+ export { Input, InputContainer, OuterInputContainer, StatefulInput };
@@ -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,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 inputBase = Object.assign({
15
- color: TextInput.input.textColor,
16
- borderRadius: TextInput.input.borderRadius,
17
- border: "".concat(border.BordersDdsBorderStyleLightStrokeWeight, " solid ").concat(colors.DdsColorNeutralsGray5),
18
- borderColor: TextInput.input.borderColor,
19
- backgroundColor: colors.DdsColorNeutralsWhite
20
- }, TextInput.input.font);
21
- var inputFocusBase = Object.assign({}, focusInputfield);
22
- var inputHoverBase = Object.assign({}, hoverInputfield);
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
- baseInput: {
58
- base: inputBase,
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 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;