@helsenorge/designsystem-react 14.10.0 → 14.11.1

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 (152) hide show
  1. package/lib/BabyMobileMedium.js +1 -1
  2. package/lib/CHANGELOG.md +16 -0
  3. package/lib/Checkbox.js +25 -48
  4. package/lib/Checkbox.js.map +1 -1
  5. package/lib/CheckboxMarker.js +60 -0
  6. package/lib/CheckboxMarker.js.map +1 -0
  7. package/lib/ChildMedium.js +1 -1
  8. package/lib/EyeContactMedium.js +79 -0
  9. package/lib/EyeContactMedium.js.map +1 -0
  10. package/lib/FacialRecognitionFingerprintMedium.js +1 -1
  11. package/lib/Filter.js +12 -12
  12. package/lib/Filter.js.map +1 -1
  13. package/lib/FormGroup.js +5 -5
  14. package/lib/FormGroup.js.map +1 -1
  15. package/lib/GiveBabyFoodMedium.js +1 -1
  16. package/lib/Illustration.js +1 -1
  17. package/lib/IllustrationNames.js +4 -0
  18. package/lib/IllustrationNames.js.map +1 -1
  19. package/lib/LazyIllustration.js +5 -1
  20. package/lib/LazyIllustration.js.map +1 -1
  21. package/lib/Radio.js +73 -0
  22. package/lib/Radio.js.map +1 -0
  23. package/lib/RadioButton.js +81 -3
  24. package/lib/RadioButton.js.map +1 -1
  25. package/lib/RadioButton2.js +3 -73
  26. package/lib/RadioButton2.js.map +1 -1
  27. package/lib/RadioMarker.js +31 -0
  28. package/lib/RadioMarker.js.map +1 -0
  29. package/lib/ReadLettersMedium.js +1 -1
  30. package/lib/Search.js +4 -4
  31. package/lib/Search.js.map +1 -1
  32. package/lib/SkinToSkinMedium.js +106 -0
  33. package/lib/SkinToSkinMedium.js.map +1 -0
  34. package/lib/StorkMedium.js +1 -1
  35. package/lib/StrollerMedium.js +1 -1
  36. package/lib/Support2Medium.js +1 -1
  37. package/lib/TableBody.js +1 -1
  38. package/lib/TableHead.js +1 -1
  39. package/lib/TableRow.js +1 -1
  40. package/lib/ThinkingMedium.js +1 -1
  41. package/lib/VisualCheckbox.js +77 -0
  42. package/lib/VisualCheckbox.js.map +1 -0
  43. package/lib/VisualRadio.js +62 -0
  44. package/lib/VisualRadio.js.map +1 -0
  45. package/lib/__mocks__/matchMedia.js +3 -2
  46. package/lib/__mocks__/matchMedia.js.map +1 -1
  47. package/lib/components/Checkbox/CheckboxMarker/CheckboxMarker.d.ts +20 -0
  48. package/lib/components/Checkbox/CheckboxMarker/styles.module.scss +309 -0
  49. package/lib/components/Checkbox/CheckboxMarker/styles.module.scss.d.ts +25 -0
  50. package/lib/components/Checkbox/styles.module.scss +9 -269
  51. package/lib/components/Checkbox/styles.module.scss.d.ts +1 -17
  52. package/lib/components/Icons/Sort.js +12 -12
  53. package/lib/components/Icons/Sort.js.map +1 -1
  54. package/lib/components/Illustration/index.js +1 -1
  55. package/lib/components/Illustrations/BabyMobile.js +1 -1
  56. package/lib/components/Illustrations/Child.js +1 -1
  57. package/lib/components/Illustrations/Doctor.js +1 -1
  58. package/lib/components/Illustrations/EyeContact.d.ts +8 -0
  59. package/lib/components/Illustrations/EyeContact.js +16 -0
  60. package/lib/components/Illustrations/EyeContact.js.map +1 -0
  61. package/lib/components/Illustrations/EyeContactMedium.d.ts +3 -0
  62. package/lib/components/Illustrations/EyeContactMedium.js +2 -0
  63. package/lib/components/Illustrations/FacialRecognitionFingerprint.js +1 -1
  64. package/lib/components/Illustrations/GiveBabyFood.js +1 -1
  65. package/lib/components/Illustrations/HealthcarePersonnel.js +1 -1
  66. package/lib/components/Illustrations/IllustrationNames.d.ts +1 -1
  67. package/lib/components/Illustrations/ReadLetters.js +1 -1
  68. package/lib/components/Illustrations/SkinToSkin.d.ts +8 -0
  69. package/lib/components/Illustrations/SkinToSkin.js +16 -0
  70. package/lib/components/Illustrations/SkinToSkin.js.map +1 -0
  71. package/lib/components/Illustrations/SkinToSkinMedium.d.ts +3 -0
  72. package/lib/components/Illustrations/SkinToSkinMedium.js +2 -0
  73. package/lib/components/Illustrations/Stork.js +1 -1
  74. package/lib/components/Illustrations/Stroller.js +1 -1
  75. package/lib/components/Illustrations/Support2.js +1 -1
  76. package/lib/components/Illustrations/Thinking.js +1 -1
  77. package/lib/components/Panel/index.js +1 -1
  78. package/lib/components/PanelList/index.js +1 -1
  79. package/lib/components/RadioButton/RadioMarker/RadioMarker.d.ts +20 -0
  80. package/lib/components/RadioButton/RadioMarker/styles.module.scss +288 -0
  81. package/lib/components/RadioButton/RadioMarker/styles.module.scss.d.ts +20 -0
  82. package/lib/components/RadioButton/index.d.ts +0 -1
  83. package/lib/components/RadioButton/index.js +3 -3
  84. package/lib/components/RadioButton/styles.module.scss +13 -275
  85. package/lib/components/RadioButton/styles.module.scss.d.ts +2 -12
  86. package/lib/components/Table/index.js +1 -1
  87. package/lib/components/Validation/index.js +1 -1
  88. package/lib/components/VisualCheckboxCloud/Checkbox/styles.module.scss +5 -128
  89. package/lib/components/VisualCheckboxCloud/styles.module.scss +2 -9
  90. package/lib/components/VisualCheckboxGroup/VisualCheckbox/VisualCheckbox.d.ts +26 -0
  91. package/lib/components/VisualCheckboxGroup/VisualCheckbox/VisualContent.d.ts +10 -0
  92. package/lib/components/VisualCheckboxGroup/VisualCheckbox/index.d.ts +3 -0
  93. package/lib/components/VisualCheckboxGroup/VisualCheckbox/index.js +5 -0
  94. package/lib/components/VisualCheckboxGroup/VisualCheckbox/index.js.map +1 -0
  95. package/lib/components/VisualCheckboxGroup/VisualCheckbox/styles.module.scss +7 -0
  96. package/lib/components/VisualCheckboxGroup/VisualCheckbox/styles.module.scss.d.ts +18 -0
  97. package/lib/components/VisualCheckboxGroup/VisualCheckboxGroup.d.ts +33 -0
  98. package/lib/components/VisualCheckboxGroup/index.d.ts +3 -0
  99. package/lib/components/VisualCheckboxGroup/index.js +43 -0
  100. package/lib/components/VisualCheckboxGroup/index.js.map +1 -0
  101. package/lib/components/VisualCheckboxGroup/styles.module.scss +6 -0
  102. package/lib/components/VisualCheckboxGroup/styles.module.scss.d.ts +10 -0
  103. package/lib/components/{VisualRadioButtonCloud/RadioButton/RadioButton.d.ts → VisualRadioCloud/Radio/Radio.d.ts} +3 -3
  104. package/lib/components/VisualRadioCloud/Radio/index.d.ts +3 -0
  105. package/lib/components/VisualRadioCloud/Radio/index.js +5 -0
  106. package/lib/components/VisualRadioCloud/Radio/index.js.map +1 -0
  107. package/lib/components/VisualRadioCloud/Radio/styles.module.scss +7 -0
  108. package/lib/components/VisualRadioCloud/Radio/styles.module.scss.d.ts +15 -0
  109. package/lib/components/{VisualRadioButtonCloud/VisualRadioButtonCloud.d.ts → VisualRadioCloud/VisualRadioCloud.d.ts} +8 -8
  110. package/lib/components/VisualRadioCloud/index.d.ts +3 -0
  111. package/lib/components/{VisualRadioButtonCloud → VisualRadioCloud}/index.js +7 -7
  112. package/lib/components/VisualRadioCloud/index.js.map +1 -0
  113. package/lib/components/VisualRadioCloud/styles.module.scss +6 -0
  114. package/lib/components/{VisualRadioButtonCloud → VisualRadioCloud}/styles.module.scss.d.ts +1 -1
  115. package/lib/components/VisualRadioGroup/VisualRadio/VisualContent.d.ts +10 -0
  116. package/lib/components/VisualRadioGroup/VisualRadio/VisualRadio.d.ts +26 -0
  117. package/lib/components/VisualRadioGroup/VisualRadio/index.d.ts +3 -0
  118. package/lib/components/VisualRadioGroup/VisualRadio/index.js +5 -0
  119. package/lib/components/VisualRadioGroup/VisualRadio/index.js.map +1 -0
  120. package/lib/components/VisualRadioGroup/VisualRadio/styles.module.scss +7 -0
  121. package/lib/components/VisualRadioGroup/VisualRadio/styles.module.scss.d.ts +18 -0
  122. package/lib/components/VisualRadioGroup/VisualRadioGroup.d.ts +39 -0
  123. package/lib/components/VisualRadioGroup/index.d.ts +3 -0
  124. package/lib/components/VisualRadioGroup/index.js +63 -0
  125. package/lib/components/VisualRadioGroup/index.js.map +1 -0
  126. package/lib/components/VisualRadioGroup/styles.module.scss +6 -0
  127. package/lib/components/VisualRadioGroup/styles.module.scss.d.ts +10 -0
  128. package/lib/resourceHelper.js +10 -6
  129. package/lib/resourceHelper.js.map +1 -1
  130. package/lib/resources/HN.Designsystem.Filter.en-GB.json.d.ts +5 -3
  131. package/lib/resources/HN.Designsystem.Filter.nb-NO.json.d.ts +5 -3
  132. package/lib/resources/Resources.d.ts +10 -2
  133. package/lib/scss/_visual-form.scss +357 -0
  134. package/lib/utils3.js +10 -98
  135. package/lib/utils3.js.map +1 -1
  136. package/lib/utils4.js +28 -11
  137. package/lib/utils4.js.map +1 -1
  138. package/lib/utils5.js +58 -28
  139. package/lib/utils5.js.map +1 -1
  140. package/package.json +115 -1
  141. package/scss/_visual-form.scss +357 -0
  142. package/lib/components/RadioButton/utils.d.ts +0 -2
  143. package/lib/components/VisualRadioButtonCloud/RadioButton/index.d.ts +0 -3
  144. package/lib/components/VisualRadioButtonCloud/RadioButton/index.js +0 -5
  145. package/lib/components/VisualRadioButtonCloud/RadioButton/index.js.map +0 -1
  146. package/lib/components/VisualRadioButtonCloud/RadioButton/styles.module.scss +0 -133
  147. package/lib/components/VisualRadioButtonCloud/RadioButton/styles.module.scss.d.ts +0 -15
  148. package/lib/components/VisualRadioButtonCloud/index.d.ts +0 -3
  149. package/lib/components/VisualRadioButtonCloud/index.js.map +0 -1
  150. package/lib/components/VisualRadioButtonCloud/styles.module.scss +0 -13
  151. package/lib/utils6.js +0 -60
  152. package/lib/utils6.js.map +0 -1
@@ -1,42 +1,13 @@
1
1
  @use 'sass:map';
2
- @use 'sass:meta';
3
- @use 'sass:string';
4
2
  @use '../../scss/spacers' as spacers;
5
3
  @use '../../scss/palette' as palette;
6
4
  @use '../../scss/font-settings' as font-settings;
7
5
  @use '../../scss/breakpoints' as breakpoints;
6
+ @use '../../scss/screen-reader' as *;
8
7
 
9
8
  $padding-clickable-area-top-bottom: 8px;
10
9
  $padding-clickable-area-left: 8px;
11
10
 
12
- @mixin dashed-border() {
13
- box-shadow: none;
14
- position: relative;
15
-
16
- &::after {
17
- position: absolute;
18
- content: '';
19
-
20
- $encoded-color: string.slice(meta.inspect(palette.$neutral600), 2);
21
-
22
- // Variabler for å lettere styre dashen i background-imaget under
23
- $stroke: 4;
24
- $dash: 0.2;
25
- $gap: 7;
26
- $scale: 1;
27
- $stroke-scaled: $stroke * $scale;
28
- $dash-scaled: $dash * $scale;
29
- $gap-scaled: $gap * $scale;
30
-
31
- border-radius: 100px;
32
- background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100%25' height='100%25'%3E%3Crect width='100%25' height='100%25' fill='none' rx='100' ry='100' stroke='%23#{$encoded-color}' stroke-width='#{$stroke-scaled}' stroke-dasharray='#{$dash-scaled},#{$gap-scaled}' stroke-linecap='square'/%3E%3C/svg%3E");
33
- background-repeat: no-repeat;
34
- width: 28px;
35
- height: 28px;
36
- inset: -2px;
37
- }
38
- }
39
-
40
11
  .radio-button-errors {
41
12
  font-size: font-settings.$font-size-sm;
42
13
  font-weight: 600;
@@ -50,20 +21,20 @@ $padding-clickable-area-left: 8px;
50
21
  &__large {
51
22
  margin: spacers.getSpacer(2xs) 0;
52
23
 
53
- &--focused {
24
+ &:has(input:focus-visible) {
54
25
  box-shadow: 0 0 0 spacers.getSpacer(3xs);
55
26
  color: palette.$neutral500;
56
27
  }
57
28
 
58
- &--focused#{&}--on-blueberry {
29
+ &--on-blueberry:has(input:focus-visible) {
59
30
  color: palette.$blueberry500;
60
31
  }
61
32
 
62
- &--focused#{&}--selected {
33
+ &:has(input:checked):has(input:focus-visible) {
63
34
  color: palette.$blueberry900;
64
35
  }
65
36
 
66
- &--focused#{&}--invalid {
37
+ &--invalid:has(input:focus-visible) {
67
38
  color: palette.$cherry400;
68
39
  }
69
40
  }
@@ -86,7 +57,7 @@ $padding-clickable-area-left: 8px;
86
57
  }
87
58
 
88
59
  &--disabled {
89
- cursor: default;
60
+ cursor: not-allowed;
90
61
  color: palette.$neutral700;
91
62
  }
92
63
 
@@ -99,7 +70,7 @@ $padding-clickable-area-left: 8px;
99
70
  background-color: palette.$neutral100;
100
71
  }
101
72
 
102
- &--focused {
73
+ &:has(input:focus-visible) {
103
74
  border: 1px solid var(--color-action-border-ondark-focus);
104
75
  }
105
76
 
@@ -140,7 +111,7 @@ $padding-clickable-area-left: 8px;
140
111
  }
141
112
  }
142
113
 
143
- &__large#{&}__large--selected-invalid {
114
+ &__large#{&}__large--invalid:has(input:checked) {
144
115
  background-color: palette.$cherry100;
145
116
  color: palette.$black;
146
117
 
@@ -173,7 +144,7 @@ $padding-clickable-area-left: 8px;
173
144
  }
174
145
  }
175
146
 
176
- &__large--selected {
147
+ &__large:has(input:checked) {
177
148
  background-color: palette.$blueberry500;
178
149
  color: palette.$white;
179
150
 
@@ -203,244 +174,11 @@ $padding-clickable-area-left: 8px;
203
174
  }
204
175
 
205
176
  .radio-button {
206
- appearance: none;
207
- cursor: pointer;
208
- display: flex;
209
- justify-content: center;
210
- align-items: center;
211
- border-radius: 10rem;
212
- margin: 0 spacers.getSpacer(s) 0 0;
213
- height: 1.5rem;
214
- width: 1.5rem;
215
- min-height: 1.5rem;
216
- min-width: 1.5rem;
217
- color: palette.$neutral700;
218
- box-shadow: 0 0 0 spacers.getSpacer(4xs);
219
- outline: none;
220
-
221
- &:focus {
222
- box-shadow: 0 0 0 spacers.getSpacer(3xs);
223
- color: palette.$black;
224
- }
225
-
226
- &:hover {
227
- box-shadow: 0 0 0 spacers.getSpacer(3xs);
228
- background-color: palette.$neutral100;
229
- }
230
-
231
- :active > & {
232
- box-shadow: 0 0 0 spacers.getSpacer(3xs);
233
- color: palette.$black;
234
- }
235
-
236
- &:checked {
237
- color: palette.$blueberry500;
238
-
239
- &:hover {
240
- box-shadow: 0 0 0 spacers.getSpacer(4xs);
241
- background-color: palette.$blueberry50;
242
- }
243
-
244
- &:focus {
245
- box-shadow: 0 0 0 spacers.getSpacer(3xs);
246
- color: palette.$black;
247
- }
248
- }
249
-
250
- &--on-blueberry {
251
- color: palette.$blueberry500;
252
-
253
- :hover > & {
254
- background-color: palette.$blueberry100;
255
- }
256
- }
257
-
258
- &--on-dark {
259
- color: palette.$neutral200;
260
-
261
- &:hover {
262
- background-color: palette.$inverted-hover-old;
263
- box-shadow: 0 0 0 spacers.getSpacer(3xs);
264
- }
265
-
266
- &:focus {
267
- color: palette.$white;
268
- }
269
-
270
- :active > & {
271
- box-shadow: 0 0 0 spacers.getSpacer(3xs);
272
- color: palette.$white;
273
- }
274
-
275
- &:checked {
276
- color: palette.$blueberry200;
277
-
278
- &:hover {
279
- background-color: palette.$inverted-hover-old;
280
- }
281
-
282
- &:focus {
283
- color: palette.$white;
284
- }
285
- }
286
- }
287
-
288
- &--invalid {
289
- color: palette.$cherry600;
290
-
291
- &:hover {
292
- background-color: palette.$cherry100;
293
- }
294
-
295
- &:active {
296
- color: palette.$black;
297
- }
298
-
299
- &:focus {
300
- color: palette.$black;
301
- }
302
-
303
- &:checked {
304
- color: palette.$cherry600;
305
-
306
- &:hover {
307
- background-color: palette.$cherry100;
308
- }
309
- }
310
- }
311
-
312
- &--disabled {
313
- cursor: default;
314
-
315
- @include dashed-border;
316
-
317
- background-color: transparent;
318
-
319
- &:hover {
320
- box-shadow: none;
321
- background-color: transparent;
322
- }
323
-
324
- :hover > & {
325
- background-color: transparent;
326
- }
327
-
328
- &:active {
329
- color: palette.$neutral600;
330
- }
331
-
332
- &:checked {
333
- color: palette.$neutral600;
334
-
335
- &:hover {
336
- box-shadow: none;
337
- background-color: transparent;
338
- }
339
- }
340
- }
341
-
342
- // :before er dot i RadioButton
343
- &:checked::before {
344
- content: '';
345
- display: flex;
346
- background-color: palette.$blueberry500;
347
- width: 0.875rem;
348
- height: 0.875rem;
349
- border-radius: 10rem;
350
-
351
- // Vi overstyrer farger satt ved high-contrast mode i nettleser/os
352
- @media (forced-colors: active) {
353
- forced-color-adjust: none;
354
- background-color: #fff !important;
355
- }
356
- }
357
-
358
- &--on-dark:checked::before {
359
- background-color: palette.$blueberry200;
360
- }
361
-
362
- &--invalid:checked::before {
363
- background-color: palette.$cherry600;
364
- }
365
-
366
- &--disabled:checked::before {
367
- background-color: palette.$neutral600;
368
- }
369
-
370
- &__large {
371
- &:checked {
372
- outline: none;
373
- color: palette.$blueberry100;
374
- }
375
-
376
- &:hover {
377
- box-shadow: 0 0 0 spacers.getSpacer(3xs);
378
- }
379
-
380
- &:focus {
381
- box-shadow: 0 0 0 spacers.getSpacer(3xs);
382
- color: palette.$black;
383
- }
384
-
385
- &:focus:checked {
386
- color: palette.$white;
387
- }
388
-
389
- &:checked::before {
390
- background-color: palette.$blueberry100;
391
- }
392
-
393
- &:checked:hover {
394
- box-shadow: 0 0 0 spacers.getSpacer(4xs);
395
- background-color: unset;
396
- }
397
-
398
- &:checked:hover:focus {
399
- box-shadow: 0 0 0 spacers.getSpacer(3xs);
400
- color: palette.$white;
401
- }
402
-
403
- &--invalid {
404
- &:checked {
405
- color: palette.$cherry500;
406
- }
407
-
408
- &:checked::before {
409
- background-color: palette.$cherry500;
410
- }
411
-
412
- &:checked:hover {
413
- background-color: transparent;
414
- }
415
-
416
- &:checked:focus {
417
- color: palette.$black;
418
- }
419
-
420
- &:checked:focus:hover {
421
- color: palette.$black;
422
- }
423
- }
424
-
425
- &--disabled {
426
- &:hover,
427
- &:focus,
428
- &:checked:hover {
429
- box-shadow: none;
430
- }
431
-
432
- &:checked::before {
433
- background-color: palette.$neutral600;
434
- }
435
- }
436
- }
177
+ @include sr-only;
178
+ }
437
179
 
438
- // Vi overstyrer farger satt ved high-contrast mode i nettleser/os
439
- @media (forced-colors: active) {
440
- forced-color-adjust: none;
441
- color: #fff !important;
442
- background-color: transparent !important;
443
- }
180
+ .radio-button__marker-wrapper {
181
+ margin-right: spacers.getSpacer(s);
444
182
  }
445
183
 
446
184
  .radiobutton-sublabel-wrapper {
@@ -1,30 +1,20 @@
1
1
  export type Styles = {
2
2
  'radio-button': string;
3
- 'radio-button__large': string;
4
- 'radio-button__large--disabled': string;
5
- 'radio-button__large--invalid': string;
6
- 'radio-button--disabled': string;
7
- 'radio-button--invalid': string;
8
- 'radio-button--on-blueberry': string;
9
- 'radio-button--on-dark': string;
3
+ 'radio-button__marker-wrapper': string;
10
4
  'radio-button-errors': string;
11
5
  'radio-button-label': string;
12
6
  'radio-button-label__large': string;
13
7
  'radio-button-label__large--disabled': string;
14
- 'radio-button-label__large--focused': string;
8
+ 'radio-button-label__large--invalid': string;
15
9
  'radio-button-label__large--on-blueberry': string;
16
10
  'radio-button-label__large--on-grey': string;
17
- 'radio-button-label__large--selected': string;
18
- 'radio-button-label__large--selected-invalid': string;
19
11
  'radio-button-label--disabled': string;
20
12
  'radio-button-label--invalid': string;
21
13
  'radio-button-label--on-dark': string;
22
14
  'radio-button-wrapper': string;
23
15
  'radio-button-wrapper__large': string;
24
- 'radio-button-wrapper__large--focused': string;
25
16
  'radio-button-wrapper__large--invalid': string;
26
17
  'radio-button-wrapper__large--on-blueberry': string;
27
- 'radio-button-wrapper__large--selected': string;
28
18
  'radiobutton-afterlabelchildren-wrapper': string;
29
19
  'radiobutton-sublabel-wrapper': string;
30
20
  };
@@ -5,7 +5,7 @@ import { t as useIsVisible } from "../../useIsVisible.js";
5
5
  import { t as useLayoutEvent } from "../../useLayoutEvent.js";
6
6
  import { t as HorizontalScroll_default } from "../../HorizontalScroll.js";
7
7
  import { a as TextAlign, i as SortDirection, n as ModeType, o as defaultConfig, r as ResponsiveTableVariant, s as simpleConfig, t as HeaderCategory } from "../../constants3.js";
8
- import { a as omitProps, i as mapChildrenWithMode, n as getCenteredOverflowTableStyle, r as getCurrentConfig, t as getBreakpointClass } from "../../utils6.js";
8
+ import { a as omitProps, i as mapChildrenWithMode, n as getCenteredOverflowTableStyle, r as getCurrentConfig, t as getBreakpointClass } from "../../utils5.js";
9
9
  import { n as TableBody } from "../../TableBody.js";
10
10
  import { n as TableCell } from "../../TableCell.js";
11
11
  import { n as TableExpandedRow } from "../../TableExpandedRow.js";
@@ -9,7 +9,7 @@ import { t as Textarea_default } from "../../Textarea.js";
9
9
  import { n as FormGroup_default } from "../../FormGroup.js";
10
10
  import { t as Input_default } from "../../Input2.js";
11
11
  import { t as List_default } from "../../List.js";
12
- import { t as RadioButton_default } from "../../RadioButton.js";
12
+ import { t as RadioButton_default } from "../../RadioButton2.js";
13
13
  import classNames from "classnames";
14
14
  import React, { useId } from "react";
15
15
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -1,133 +1,10 @@
1
- @use 'sass:map';
2
- @use '../../../scss/screen-reader' as *;
3
- @use '../../../scss/breakpoints' as breakpoints;
4
- @use '../../../scss/font-mixins' as fonts;
1
+ @use '../../../scss/visual-form' as visual-form;
5
2
  @import '../../../scss/supernova/styles/colors.css';
6
3
  @import '../../../scss/supernova/styles/spacers.css';
7
4
 
8
5
  .visual-checkbox {
9
- position: relative;
10
- display: inline-flex;
11
- align-items: stretch;
12
- min-height: 2.75rem;
13
- padding: 0.313rem 0;
14
- cursor: pointer;
15
-
16
- @media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
17
- padding: 0;
18
- }
19
-
20
- &__input {
21
- // Hides input while making sure screen reader outline wraps the entire component
22
- cursor: pointer;
23
- position: absolute;
24
- z-index: 0;
25
- inset: 0;
26
- width: 100%;
27
- height: 100%;
28
- outline: none;
29
- appearance: none;
30
- }
31
-
32
- &__pill {
33
- position: relative;
34
- z-index: 1;
35
- display: inline-flex;
36
- align-items: center;
37
- gap: var(--core-space-2xs);
38
- box-sizing: border-box;
39
- min-height: var(--core-space-l);
40
- padding: var(--core-space-3xs) 1.75rem;
41
- border-radius: 100px;
42
- background-color: var(--color-action-background-ondark);
43
- border: 1px solid var(--color-action-border-onlight);
44
- color: var(--color-base-text-onlight);
45
-
46
- @include fonts.title6;
47
-
48
- @media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
49
- min-height: var(--core-space-xl);
50
- padding: var(--core-space-3xs) var(--core-space-l);
51
- }
52
- }
53
-
54
- &:hover &__pill {
55
- background-color: var(--color-action-background-ondark-hover);
56
- border-color: var(--color-action-border-onlight-hover);
57
- }
58
-
59
- &:active &__pill {
60
- background-color: var(--color-action-background-ondark-selected);
61
- border-color: var(--color-action-border-onlight-hover);
62
- }
63
-
64
- &--checked &__pill {
65
- background-color: var(--color-action-background-onlight);
66
- color: var(--color-action-text-ondark);
67
- border-color: var(--color-action-background-onlight);
68
- padding: var(--core-space-3xs) var(--core-space-s);
69
-
70
- @media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
71
- padding: var(--core-space-3xs) 1.25rem;
72
- }
73
- }
74
-
75
- &--checked:hover &__pill {
76
- background-color: var(--color-action-graphics-onlight-hover);
77
- border-color: var(--color-action-graphics-onlight-hover);
78
- }
79
-
80
- &--checked:active &__pill {
81
- background-color: var(--color-action-background-onlight-active);
82
- border-color: var(--color-action-background-onlight-active);
83
- }
84
-
85
- &--invalid &__pill {
86
- background-color: var(--color-action-background-ondark);
87
- border-color: var(--color-destructive-border-normal);
88
- }
89
-
90
- &--invalid:hover &__pill {
91
- background-color: var(--color-destructive-background-normal);
92
- border-color: var(--color-destructive-border-normal);
93
- }
94
-
95
- &--invalid:active &__pill {
96
- background-color: var(--color-destructive-background-emphasized);
97
- border-color: var(--color-destructive-border-normal);
98
- }
99
-
100
- &--invalid#{&}--checked &__pill {
101
- background-color: var(--color-destructive-graphics-normal);
102
- border-color: var(--color-destructive-graphics-normal);
103
- }
104
-
105
- &--invalid#{&}--checked:hover &__pill {
106
- background-color: var(--color-destructive-graphics-hover);
107
- border-color: var(--color-destructive-graphics-hover);
108
- }
109
-
110
- &--invalid#{&}--checked:active &__pill {
111
- background-color: var(--color-destructive-graphics-emphasized-onlight);
112
- border-color: var(--color-destructive-graphics-emphasized-onlight);
113
- }
114
-
115
- &__input:focus-visible + &__pill {
116
- outline: 3px solid var(--color-action-border-onlight-focus);
117
- border-color: var(--color-action-border-ondark);
118
- }
119
-
120
- &__icon {
121
- display: inline-flex;
122
- align-items: center;
123
- justify-content: center;
124
-
125
- svg {
126
- fill: var(--color-action-graphics-ondark);
127
- }
128
- }
129
-
130
- &__label {
131
- text-box: trim-both cap alphabetic;
132
- }
6
+ @include visual-form.visual-form-pill(
7
+ $pill-padding-mobile: var(--core-space-3xs) 1.75rem,
8
+ $checked-pill-padding-md: var(--core-space-3xs) 1.25rem
9
+ );
133
10
  }
@@ -1,13 +1,6 @@
1
- @use 'sass:map';
2
- @use '../../scss/breakpoints' as breakpoints;
1
+ @use '../../scss/visual-form' as visual-form;
3
2
  @import '../../scss/supernova/styles/spacers.css';
4
3
 
5
4
  .visual-checkbox-cloud {
6
- display: flex;
7
- flex-flow: row wrap;
8
- gap: var(--core-space-4xs) var(--core-space-xs);
9
-
10
- @media (min-width: map.get(breakpoints.$grid-breakpoints, md)) {
11
- gap: var(--core-space-m) var(--core-space-s);
12
- }
5
+ @include visual-form.visual-form-cloud;
13
6
  }
@@ -0,0 +1,26 @@
1
+ import { ErrorWrapperClassNameProps } from '../../ErrorWrapper';
2
+ export type VisualCheckboxVariant = 'line' | 'rectangle';
3
+ export interface VisualCheckboxProps extends ErrorWrapperClassNameProps, Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'id' | 'className' | 'children' | 'size'> {
4
+ /** Adds custom classes to the root element. */
5
+ className?: string;
6
+ /** Label rendered inside the checkbox frame. */
7
+ children: string;
8
+ /** Content rendered inside the circular visual slot. */
9
+ visualContent: React.ReactNode;
10
+ /** Layout variant. `line` is a thin horizontal pill, `rectangle` is a vertical card. */
11
+ variant?: VisualCheckboxVariant;
12
+ /** input id of the underlying checkbox */
13
+ inputId?: string;
14
+ /** Activates error styling. Can be true while errorText is empty (e.g. when used in a FormGroup). */
15
+ error?: boolean;
16
+ /** Error text to show above the component. */
17
+ errorText?: string;
18
+ /** Error text id */
19
+ errorTextId?: string;
20
+ /** Sets the data-testid attribute. */
21
+ testId?: string;
22
+ /** Ref forwarded to the underlying input element. */
23
+ ref?: React.Ref<HTMLInputElement | null>;
24
+ }
25
+ declare const VisualCheckbox: React.FC<VisualCheckboxProps>;
26
+ export default VisualCheckbox;
@@ -0,0 +1,10 @@
1
+ export interface VisualContentProps {
2
+ /** Content rendered inside the circular area – typically an <img> or illustration component. */
3
+ children: React.ReactNode;
4
+ /** Adds custom classes to the root element. */
5
+ className?: string;
6
+ /** Sets the data-testid attribute. */
7
+ testId?: string;
8
+ }
9
+ export declare const VisualContent: React.FC<VisualContentProps>;
10
+ export default VisualContent;
@@ -0,0 +1,3 @@
1
+ import { default as VisualCheckbox } from './VisualCheckbox';
2
+ export * from './VisualCheckbox';
3
+ export default VisualCheckbox;
@@ -0,0 +1,5 @@
1
+ import { t as VisualCheckbox_default$1 } from "../../../VisualCheckbox.js";
2
+ var VisualCheckbox_default = VisualCheckbox_default$1;
3
+ export { VisualCheckbox_default as default };
4
+
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../../src/components/VisualCheckboxGroup/VisualCheckbox/index.ts"],"sourcesContent":["import VisualCheckbox from './VisualCheckbox';\nexport * from './VisualCheckbox';\nexport default VisualCheckbox;\n"],"mappings":";AAEA,IAAA,yBAAe"}
@@ -0,0 +1,7 @@
1
+ @use '../../../scss/visual-form' as visual-form;
2
+ @import '../../../scss/supernova/styles/colors.css';
3
+ @import '../../../scss/supernova/styles/spacers.css';
4
+
5
+ .visual-checkbox {
6
+ @include visual-form.visual-form-card;
7
+ }
@@ -0,0 +1,18 @@
1
+ export type Styles = {
2
+ 'visual-checkbox': string;
3
+ 'visual-checkbox__frame': string;
4
+ 'visual-checkbox__icon': string;
5
+ 'visual-checkbox__input': string;
6
+ 'visual-checkbox__label': string;
7
+ 'visual-checkbox__visual-content': string;
8
+ 'visual-checkbox--checked': string;
9
+ 'visual-checkbox--invalid': string;
10
+ 'visual-checkbox--variant-line': string;
11
+ 'visual-checkbox--variant-rectangle': string;
12
+ };
13
+
14
+ export type ClassNames = keyof Styles;
15
+
16
+ declare const styles: Styles;
17
+
18
+ export default styles;
@@ -0,0 +1,33 @@
1
+ import { default as React } from 'react';
2
+ import { VisualCheckboxVariant, default as VisualCheckbox } from './VisualCheckbox/VisualCheckbox';
3
+ export interface VisualCheckboxGroupProps {
4
+ /** Items in the group. Should be VisualCheckboxGroup.VisualCheckbox elements. */
5
+ children?: React.ReactNode;
6
+ /** Name shared by all child VisualCheckbox elements (overridable per child) */
7
+ name?: string;
8
+ /** Variant applied to all child VisualCheckbox elements (overridable per child). */
9
+ variant?: VisualCheckboxVariant;
10
+ /** When set and the number of VisualCheckbox children exceeds this limit on the mobile breakpoint, the variant is forced to `line`. */
11
+ mobileLineVariantLimit?: number;
12
+ /** Error message shown above the group */
13
+ error?: string;
14
+ /** Error text id (auto-generated if omitted) */
15
+ errorTextId?: string;
16
+ /** Renders the error component (Default: true) */
17
+ renderError?: boolean;
18
+ /** Ref passed to the error message element */
19
+ errorMessageRef?: React.Ref<HTMLDivElement | null>;
20
+ /** Adds custom classes to the root element. */
21
+ className?: string;
22
+ /** Adds custom classes to the errorWrapper */
23
+ errorWrapperClassName?: string;
24
+ /** Sets the data-testid attribute. */
25
+ testId?: string;
26
+ /** Sets the data-testid attribute for the error wrapper */
27
+ errorWrapperTestId?: string;
28
+ }
29
+ interface VisualCheckboxGroupComponent extends React.FC<VisualCheckboxGroupProps> {
30
+ VisualCheckbox: typeof VisualCheckbox;
31
+ }
32
+ export declare const VisualCheckboxGroup: VisualCheckboxGroupComponent;
33
+ export default VisualCheckboxGroup;
@@ -0,0 +1,3 @@
1
+ import { default as VisualCheckboxGroup } from './VisualCheckboxGroup';
2
+ export * from './VisualCheckboxGroup';
3
+ export default VisualCheckboxGroup;