@helsenorge/designsystem-react 10.1.0 → 10.3.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 (239) hide show
  1. package/AnchorLink.js +2 -2
  2. package/AnchorLink.js.map +1 -1
  3. package/Avatar.js +2 -2
  4. package/Avatar.js.map +1 -1
  5. package/Badge.js +3 -3
  6. package/Badge.js.map +1 -1
  7. package/Button.js +4 -4
  8. package/Button.js.map +1 -1
  9. package/CHANGELOG.md +1392 -801
  10. package/Checkbox.js +2 -2
  11. package/Checkbox.js.map +1 -1
  12. package/Close.js +2 -2
  13. package/Close.js.map +1 -1
  14. package/ErrorBoundary.js +2 -2
  15. package/ErrorBoundary.js.map +1 -1
  16. package/FormGroup.js +12 -12
  17. package/FormGroup.js.map +1 -1
  18. package/FormLayout.js +3 -3
  19. package/FormLayout.js.map +1 -1
  20. package/HelpBubble.js +2 -2
  21. package/HelpBubble.js.map +1 -1
  22. package/HighlightPanel.js +2 -2
  23. package/HighlightPanel.js.map +1 -1
  24. package/Icon.js +3 -3
  25. package/Icon.js.map +1 -1
  26. package/Illustration.js +3 -3
  27. package/Illustration.js.map +1 -1
  28. package/Input.js +2 -2
  29. package/Input.js.map +1 -1
  30. package/Label.js +8 -8
  31. package/Label.js.map +1 -1
  32. package/LazyIcon.js +1 -1
  33. package/LazyIllustration.js +3 -3
  34. package/LazyIllustration.js.map +1 -1
  35. package/LinkList.js +6 -6
  36. package/LinkList.js.map +1 -1
  37. package/ListHeader.js +7 -7
  38. package/ListHeader.js.map +1 -1
  39. package/Panel.js +2 -2
  40. package/Panel.js.map +1 -1
  41. package/PopOver.js +2 -2
  42. package/PopOver.js.map +1 -1
  43. package/RadioButton.js +2 -2
  44. package/RadioButton.js.map +1 -1
  45. package/Select.js +2 -2
  46. package/Select.js.map +1 -1
  47. package/Slider.js +3 -3
  48. package/Slider.js.map +1 -1
  49. package/Spacer.js +2 -2
  50. package/Spacer.js.map +1 -1
  51. package/StatusDot.js +1 -1
  52. package/StepButtons.js +4 -4
  53. package/StepButtons.js.map +1 -1
  54. package/TabList.js +4 -4
  55. package/TabList.js.map +1 -1
  56. package/Table.js +2 -2
  57. package/Table.js.map +1 -1
  58. package/TableBody.js +2 -2
  59. package/TableBody.js.map +1 -1
  60. package/TableExpandedRow.js +2 -2
  61. package/TableExpandedRow.js.map +1 -1
  62. package/TableHead.js +2 -2
  63. package/TableHead.js.map +1 -1
  64. package/TableRow.js +2 -2
  65. package/TableRow.js.map +1 -1
  66. package/Textarea.js +2 -2
  67. package/Textarea.js.map +1 -1
  68. package/Title.js +2 -2
  69. package/Title.js.map +1 -1
  70. package/TooltipWord.js +2 -2
  71. package/TooltipWord.js.map +1 -1
  72. package/Trigger.js +3 -3
  73. package/Trigger.js.map +1 -1
  74. package/components/AnchorLink/styles.module.scss +8 -9
  75. package/components/Avatar/styles.module.scss +9 -9
  76. package/components/Badge/styles.module.scss +9 -9
  77. package/components/Button/styles.module.scss +68 -57
  78. package/components/Checkbox/styles.module.scss +103 -103
  79. package/components/Chip/styles.module.scss +22 -22
  80. package/components/Close/styles.module.scss +4 -4
  81. package/components/DictionaryTrigger/index.js +2 -2
  82. package/components/DictionaryTrigger/index.js.map +1 -1
  83. package/components/DictionaryTrigger/styles.module.scss +5 -5
  84. package/components/Drawer/Drawer.d.ts +41 -0
  85. package/components/Drawer/Drawer.test.d.ts +1 -0
  86. package/components/Drawer/index.d.ts +3 -0
  87. package/components/Drawer/index.js +350 -0
  88. package/components/Drawer/index.js.map +1 -0
  89. package/components/Drawer/styles.module.scss +127 -0
  90. package/components/Drawer/styles.module.scss.d.ts +16 -0
  91. package/components/Dropdown/index.js +3 -3
  92. package/components/Dropdown/index.js.map +1 -1
  93. package/components/Dropdown/styles.module.scss +51 -51
  94. package/components/Duolist/index.js +6 -5
  95. package/components/Duolist/index.js.map +1 -1
  96. package/components/Duolist/styles.module.scss +57 -35
  97. package/components/Duolist/styles.module.scss.d.ts +1 -0
  98. package/components/EmptyState/styles.module.scss +12 -12
  99. package/components/ErrorWrapper/styles.module.scss +11 -21
  100. package/components/ErrorWrapper/styles.module.scss.d.ts +0 -1
  101. package/components/Expander/styles.module.scss +46 -46
  102. package/components/ExpanderHierarchy/expander.module.scss +29 -29
  103. package/components/ExpanderHierarchy/index.js +5 -5
  104. package/components/ExpanderHierarchy/index.js.map +1 -1
  105. package/components/ExpanderHierarchy/styles.module.scss +4 -5
  106. package/components/ExpanderList/index.js +8 -8
  107. package/components/ExpanderList/index.js.map +1 -1
  108. package/components/ExpanderList/styles.module.scss +30 -30
  109. package/components/EyebrowHeader/styles.module.scss +0 -2
  110. package/components/FormGroup/styles.module.scss +9 -9
  111. package/components/FormLayout/styles.module.scss +4 -5
  112. package/components/HelpBubble/styles.module.scss +13 -13
  113. package/components/HelpPanel/styles.module.scss +2 -2
  114. package/components/HelpQuestion/index.js +2 -2
  115. package/components/HelpQuestion/index.js.map +1 -1
  116. package/components/HelpQuestion/styles.module.scss +19 -19
  117. package/components/HighlightPanel/styles.module.scss +22 -54
  118. package/components/HighlightPanel/styles.module.scss.d.ts +1 -2
  119. package/components/HorizontalScroll/styles.module.scss +4 -3
  120. package/components/Icons/EuropeanHealthCard.js +1 -1
  121. package/components/Icons/GroupTwins.js +1 -1
  122. package/components/Icons/Inbox.js +1 -1
  123. package/components/Icons/LawBook.js +1 -1
  124. package/components/Icons/PersonCancel.js +1 -1
  125. package/components/Icons/PersonWithBrain.js +1 -1
  126. package/components/Icons/Puzzle.js +1 -1
  127. package/components/Icons/Snapchat.js +1 -1
  128. package/components/Illustrations/IllustrationNames.d.ts +1 -1
  129. package/components/Illustrations/IllustrationNames.js +4 -2
  130. package/components/Illustrations/IllustrationNames.js.map +1 -1
  131. package/components/Illustrations/ReadLetters.d.ts +9 -0
  132. package/components/Illustrations/ReadLetters.js +11 -0
  133. package/components/Illustrations/ReadLetters.js.map +1 -0
  134. package/components/Illustrations/ReadLettersMedium.d.ts +4 -0
  135. package/components/Illustrations/ReadLettersMedium.js +110 -0
  136. package/components/Illustrations/ReadLettersMedium.js.map +1 -0
  137. package/components/Illustrations/Support2.d.ts +9 -0
  138. package/components/Illustrations/Support2.js +11 -0
  139. package/components/Illustrations/Support2.js.map +1 -0
  140. package/components/Illustrations/Support2Medium.d.ts +4 -0
  141. package/components/Illustrations/Support2Medium.js +232 -0
  142. package/components/Illustrations/Support2Medium.js.map +1 -0
  143. package/components/Input/styles.module.scss +12 -12
  144. package/components/Label/styles.module.scss +28 -24
  145. package/components/Label/styles.module.scss.d.ts +3 -1
  146. package/components/LinkList/styles.module.scss +33 -33
  147. package/components/List/styles.module.scss +7 -7
  148. package/components/ListHeader/styles.module.scss +8 -8
  149. package/components/Loader/styles.module.scss +14 -14
  150. package/components/MaxCharacters/styles.module.scss +11 -11
  151. package/components/Modal/index.js +71 -82
  152. package/components/Modal/index.js.map +1 -1
  153. package/components/Modal/styles.module.scss +45 -39
  154. package/components/NotificationPanel/index.js +3 -3
  155. package/components/NotificationPanel/index.js.map +1 -1
  156. package/components/NotificationPanel/styles.module.scss +33 -33
  157. package/components/Panel/styles.module.scss +45 -45
  158. package/components/PanelList/index.js +5 -5
  159. package/components/PanelList/index.js.map +1 -1
  160. package/components/PanelList/styles.module.scss +5 -5
  161. package/components/PopMenu/index.js +5 -5
  162. package/components/PopMenu/index.js.map +1 -1
  163. package/components/PopMenu/styles.module.scss +15 -15
  164. package/components/PopOver/styles.module.scss +13 -14
  165. package/components/PopOver/styles.module.scss.d.ts +0 -3
  166. package/components/Portal/index.js +3 -3
  167. package/components/Portal/index.js.map +1 -1
  168. package/components/Progressbar/styles.module.scss +4 -4
  169. package/components/PromoPanel/index.js +2 -2
  170. package/components/PromoPanel/index.js.map +1 -1
  171. package/components/PromoPanel/styles.module.scss +22 -22
  172. package/components/RadioButton/styles.module.scss +99 -99
  173. package/components/Select/styles.module.scss +21 -21
  174. package/components/ServiceMessage/styles.module.scss +49 -49
  175. package/components/SharingStatus/styles.module.scss +13 -13
  176. package/components/Slider/styles.module.scss +24 -24
  177. package/components/Spacer/styles.module.scss +14 -14
  178. package/components/StatusDot/styles.module.scss +22 -22
  179. package/components/Step/styles.module.scss +3 -3
  180. package/components/StepButtons/styles.module.scss +9 -9
  181. package/components/Stepper/styles.module.scss +23 -15
  182. package/components/StickyNote/styles.module.scss +3 -3
  183. package/components/Table/styles.module.scss +32 -32
  184. package/components/Tabs/TabList/styles.module.scss +1 -1
  185. package/components/Tabs/TabPanel/styles.module.scss +5 -5
  186. package/components/Tabs/index.js +3 -3
  187. package/components/Tabs/index.js.map +1 -1
  188. package/components/Tabs/styles.module.scss +1 -1
  189. package/components/Tag/styles.module.scss +16 -16
  190. package/components/TagList/index.js +2 -2
  191. package/components/TagList/index.js.map +1 -1
  192. package/components/TagList/styles.module.scss +4 -4
  193. package/components/Textarea/styles.module.scss +9 -9
  194. package/components/Tile/index.js +6 -6
  195. package/components/Tile/index.js.map +1 -1
  196. package/components/Tile/styles.module.scss +25 -25
  197. package/components/Title/styles.module.scss +8 -8
  198. package/components/Toggle/index.js +3 -3910
  199. package/components/Toggle/index.js.map +1 -1
  200. package/components/Toggle/styles.module.scss +14 -14
  201. package/components/Tooltip/TooltipWord/styles.module.scss +4 -4
  202. package/components/Tooltip/index.js +2 -2
  203. package/components/Tooltip/index.js.map +1 -1
  204. package/components/Trigger/styles.module.scss +21 -21
  205. package/components/Validation/index.js +6 -6
  206. package/components/Validation/index.js.map +1 -1
  207. package/components/Validation/styles.module.scss +10 -10
  208. package/constants.d.ts +1 -0
  209. package/constants.js +1 -0
  210. package/constants.js.map +1 -1
  211. package/hoc/withBreakpoint/withBreakpoint.js +2 -2
  212. package/hoc/withBreakpoint/withBreakpoint.js.map +1 -1
  213. package/hooks/useBreakpoint.d.ts +0 -4
  214. package/hooks/useBreakpoint.js +23 -18
  215. package/hooks/useBreakpoint.js.map +1 -1
  216. package/hooks/useEventListenerState.js +3 -3
  217. package/hooks/useEventListenerState.js.map +1 -1
  218. package/hooks/useReturnFocusOnUnmount.d.ts +5 -0
  219. package/hooks/useReturnFocusOnUnmount.js +20 -0
  220. package/hooks/useReturnFocusOnUnmount.js.map +1 -0
  221. package/package.json +1 -1
  222. package/scss/_body.scss +5 -6
  223. package/scss/_breakpoints.scss +8 -2
  224. package/scss/_font-mixins.scss +57 -2
  225. package/scss/_fonts.scss +0 -2
  226. package/scss/_input.scss +53 -50
  227. package/scss/_print.scss +2 -2
  228. package/scss/layout.module.scss +2 -2
  229. package/scss/typography.module.scss +62 -37
  230. package/scss/typography.module.scss.d.ts +6 -0
  231. package/scss/typography.stories.tsx +24 -0
  232. package/theme/index.js +2 -2
  233. package/use-animate.js +3952 -0
  234. package/use-animate.js.map +1 -0
  235. package/utils/accessibility.d.ts +1 -0
  236. package/utils/accessibility.js +6 -1
  237. package/utils/accessibility.js.map +1 -1
  238. package/utils/component.js +4 -4
  239. package/utils/component.js.map +1 -1
@@ -1,16 +1,16 @@
1
1
  @use 'sass:map';
2
- @import '../../scss/spacers';
3
- @import '../../scss/breakpoints';
4
- @import '../../scss/palette';
5
- @import '../../scss/font-settings';
6
- @import '../../scss/font-mixins';
2
+ @use '../../scss/spacers' as spacers;
3
+ @use '../../scss/palette' as palette;
4
+ @use '../../scss/font-settings' as font-settings;
5
+ @use '../../scss/font-mixins' as fonts;
6
+ @use '../../scss/breakpoints' as *;
7
7
 
8
8
  .label-wrapper {
9
- margin-bottom: getSpacer(2xs);
10
- line-height: $lineheight-size-xs;
9
+ margin-bottom: spacers.getSpacer(2xs);
10
+ line-height: font-settings.$lineheight-size-xs;
11
11
 
12
12
  @media (min-width: map.get($grid-breakpoints, sm)) {
13
- line-height: $lineheight-size-sm;
13
+ line-height: font-settings.$lineheight-size-sm;
14
14
  }
15
15
 
16
16
  &--no-bottom-margin {
@@ -29,26 +29,14 @@
29
29
  }
30
30
 
31
31
  .label {
32
- @include label;
32
+ @include fonts.label;
33
33
 
34
34
  &--subdued {
35
- @include label-subdued;
36
- }
37
-
38
- &--sublabel {
39
- display: block;
40
- font-size: $font-size-xs;
41
- line-height: 1.25rem;
42
- color: $neutral800;
43
-
44
- @media (min-width: map.get($grid-breakpoints, sm)) {
45
- font-size: $font-size-sm;
46
- line-height: $lineheight-size-xs;
47
- }
35
+ @include fonts.label-subdued;
48
36
  }
49
37
 
50
38
  &--on-dark {
51
- color: $white;
39
+ color: palette.$white;
52
40
  }
53
41
 
54
42
  &::after {
@@ -60,6 +48,22 @@
60
48
  }
61
49
  }
62
50
 
51
+ .sublabel {
52
+ @include fonts.sublabel;
53
+
54
+ &--subdued {
55
+ @include fonts.sublabel-subdued;
56
+ }
57
+
58
+ &--on-dark {
59
+ color: palette.$white;
60
+ }
61
+
62
+ &::after {
63
+ content: ' ';
64
+ }
65
+ }
66
+
63
67
  .after-label-children {
64
- padding-left: getSpacer(xs);
68
+ padding-left: spacers.getSpacer(xs);
65
69
  }
@@ -4,11 +4,13 @@ export type Styles = {
4
4
  label__texts: string;
5
5
  'label--on-dark': string;
6
6
  'label--subdued': string;
7
- 'label--sublabel': string;
8
7
  'label-content-wrapper': string;
9
8
  'label-wrapper': string;
10
9
  'label-wrapper--after-label-children': string;
11
10
  'label-wrapper--no-bottom-margin': string;
11
+ sublabel: string;
12
+ 'sublabel--on-dark': string;
13
+ 'sublabel--subdued': string;
12
14
  };
13
15
 
14
16
  export type ClassNames = keyof Styles;
@@ -1,8 +1,8 @@
1
1
  @use 'sass:map';
2
- @import '../../scss/spacers';
3
- @import '../../scss/breakpoints';
4
- @import '../../scss/font-settings';
5
- @import '../../scss/palette';
2
+ @use '../../scss/spacers' as spacers;
3
+ @use '../../scss/font-settings' as font-settings;
4
+ @use '../../scss/palette' as palette;
5
+ @use '../../scss/breakpoints' as *;
6
6
  @import '../../scss/supernova/styles/colors';
7
7
 
8
8
  .link-list {
@@ -22,42 +22,42 @@
22
22
 
23
23
  &--outline {
24
24
  &--white {
25
- border-top: getSpacer(2xs) var(--core-color-neutral-100) solid;
26
- border-left: getSpacer(2xs) var(--core-color-neutral-100) solid;
27
- border-right: getSpacer(2xs) var(--core-color-neutral-100) solid;
25
+ border-top: spacers.getSpacer(2xs) var(--core-color-neutral-100) solid;
26
+ border-left: spacers.getSpacer(2xs) var(--core-color-neutral-100) solid;
27
+ border-right: spacers.getSpacer(2xs) var(--core-color-neutral-100) solid;
28
28
 
29
29
  &:last-of-type {
30
- border-bottom: getSpacer(2xs) var(--core-color-neutral-100) solid;
30
+ border-bottom: spacers.getSpacer(2xs) var(--core-color-neutral-100) solid;
31
31
  }
32
32
  }
33
33
 
34
34
  &--blueberry {
35
- border-top: getSpacer(2xs) var(--core-color-blueberry-100) solid;
36
- border-left: getSpacer(2xs) var(--core-color-blueberry-100) solid;
37
- border-right: getSpacer(2xs) var(--core-color-blueberry-100) solid;
35
+ border-top: spacers.getSpacer(2xs) var(--core-color-blueberry-100) solid;
36
+ border-left: spacers.getSpacer(2xs) var(--core-color-blueberry-100) solid;
37
+ border-right: spacers.getSpacer(2xs) var(--core-color-blueberry-100) solid;
38
38
 
39
39
  &:last-of-type {
40
- border-bottom: getSpacer(2xs) var(--core-color-blueberry-100) solid;
40
+ border-bottom: spacers.getSpacer(2xs) var(--core-color-blueberry-100) solid;
41
41
  }
42
42
  }
43
43
 
44
44
  &--cherry {
45
- border-top: getSpacer(2xs) var(--core-color-cherry-100) solid;
46
- border-left: getSpacer(2xs) var(--core-color-cherry-100) solid;
47
- border-right: getSpacer(2xs) var(--core-color-cherry-100) solid;
45
+ border-top: spacers.getSpacer(2xs) var(--core-color-cherry-100) solid;
46
+ border-left: spacers.getSpacer(2xs) var(--core-color-cherry-100) solid;
47
+ border-right: spacers.getSpacer(2xs) var(--core-color-cherry-100) solid;
48
48
 
49
49
  &:last-of-type {
50
- border-bottom: getSpacer(2xs) var(--core-color-cherry-100) solid;
50
+ border-bottom: spacers.getSpacer(2xs) var(--core-color-cherry-100) solid;
51
51
  }
52
52
  }
53
53
 
54
54
  &--neutral {
55
- border-top: getSpacer(2xs) var(--core-color-neutral-100) solid;
56
- border-left: getSpacer(2xs) var(--core-color-neutral-100) solid;
57
- border-right: getSpacer(2xs) var(--core-color-neutral-100) solid;
55
+ border-top: spacers.getSpacer(2xs) var(--core-color-neutral-100) solid;
56
+ border-left: spacers.getSpacer(2xs) var(--core-color-neutral-100) solid;
57
+ border-right: spacers.getSpacer(2xs) var(--core-color-neutral-100) solid;
58
58
 
59
59
  &:last-of-type {
60
- border-bottom: getSpacer(2xs) var(--core-color-neutral-100) solid;
60
+ border-bottom: spacers.getSpacer(2xs) var(--core-color-neutral-100) solid;
61
61
  }
62
62
  }
63
63
  }
@@ -100,7 +100,7 @@
100
100
 
101
101
  &--fill,
102
102
  &--fill-negative {
103
- margin-top: getSpacer(s);
103
+ margin-top: spacers.getSpacer(s);
104
104
  }
105
105
 
106
106
  &--fill-negative {
@@ -108,34 +108,34 @@
108
108
  }
109
109
 
110
110
  &--small {
111
- font-size: $font-size-xs;
112
- line-height: $lineheight-size-xs;
111
+ font-size: font-settings.$font-size-xs;
112
+ line-height: font-settings.$lineheight-size-xs;
113
113
  }
114
114
 
115
115
  &--medium {
116
- font-size: $font-size-sm;
117
- line-height: $lineheight-size-sm;
116
+ font-size: font-settings.$font-size-sm;
117
+ line-height: font-settings.$lineheight-size-sm;
118
118
  }
119
119
 
120
120
  &--large {
121
- font-size: $font-size-md;
122
- line-height: $lineheight-size-md;
121
+ font-size: font-settings.$font-size-md;
122
+ line-height: font-settings.$lineheight-size-md;
123
123
  }
124
124
 
125
125
  @media (min-width: map.get($grid-breakpoints, md)) {
126
126
  &--small {
127
- font-size: $font-size-sm;
128
- line-height: $lineheight-size-sm;
127
+ font-size: font-settings.$font-size-sm;
128
+ line-height: font-settings.$lineheight-size-sm;
129
129
  }
130
130
 
131
131
  &--medium {
132
- font-size: $font-size-md;
133
- line-height: $lineheight-size-md;
132
+ font-size: font-settings.$font-size-md;
133
+ line-height: font-settings.$lineheight-size-md;
134
134
  }
135
135
 
136
136
  &--large {
137
- font-size: $font-size-lg;
138
- line-height: $lineheight-size-lg;
137
+ font-size: font-settings.$font-size-lg;
138
+ line-height: font-settings.$lineheight-size-lg;
139
139
  }
140
140
  }
141
141
 
@@ -1,14 +1,14 @@
1
- @import '../../scss/spacers';
1
+ @use '../../scss/spacers' as spacers;
2
+ @use '../../scss/font-mixins' as fonts;
2
3
 
3
4
  .list {
4
5
  $list: &;
5
6
 
6
- margin-top: 0;
7
- margin-bottom: 0;
7
+ @include fonts.text-list;
8
8
 
9
9
  &--margin {
10
- margin-top: getSpacer(s);
11
- margin-bottom: getSpacer(s);
10
+ margin-top: spacers.getSpacer(s);
11
+ margin-bottom: spacers.getSpacer(s);
12
12
  }
13
13
 
14
14
  &--bullet {
@@ -57,11 +57,11 @@
57
57
 
58
58
  &__item {
59
59
  > #{$list} {
60
- margin-top: getSpacer(2xs);
60
+ margin-top: spacers.getSpacer(2xs);
61
61
  }
62
62
  }
63
63
 
64
64
  &__item:not(:last-child) {
65
- margin-bottom: getSpacer(2xs);
65
+ margin-bottom: spacers.getSpacer(2xs);
66
66
  }
67
67
  }
@@ -1,16 +1,16 @@
1
1
  @use 'sass:map';
2
- @import '../../scss/spacers';
3
- @import '../../scss/breakpoints';
4
- @import '../../scss/palette';
2
+ @use '../../scss/spacers' as spacers;
3
+ @use '../../scss/palette' as palette;
4
+ @use '../../scss/breakpoints' as *;
5
5
 
6
6
  .list-header {
7
7
  display: grid;
8
8
  grid-template:
9
9
  'icon text badge chevron' 4rem
10
10
  '. text . .' auto / min-content auto min-content min-content;
11
- column-gap: getSpacer(2xs);
12
- margin-left: getSpacer(2xs);
13
- margin-right: getSpacer(2xs);
11
+ column-gap: spacers.getSpacer(2xs);
12
+ margin-left: spacers.getSpacer(2xs);
13
+ margin-right: spacers.getSpacer(2xs);
14
14
  width: 100%;
15
15
  height: 100%;
16
16
  text-align: left;
@@ -38,12 +38,12 @@
38
38
  }
39
39
 
40
40
  &--spacing {
41
- margin-left: getSpacer(2xs);
41
+ margin-left: spacers.getSpacer(2xs);
42
42
  }
43
43
 
44
44
  :focus > &,
45
45
  :focus-visible > & {
46
- border-color: $black;
46
+ border-color: palette.$black;
47
47
  }
48
48
  }
49
49
 
@@ -1,6 +1,6 @@
1
- @import '../../scss/spacers';
2
- @import '../../scss/palette';
3
- @import '../../scss/screen-reader';
1
+ @use '../../scss/spacers' as spacers;
2
+ @use '../../scss/palette' as palette;
3
+ @use '../../scss/screen-reader' as *;
4
4
 
5
5
  @mixin keyframes($name) {
6
6
  @keyframes #{$name} {
@@ -48,7 +48,7 @@
48
48
 
49
49
  &--inline {
50
50
  align-self: center;
51
- padding-left: getSpacer(2xs);
51
+ padding-left: spacers.getSpacer(2xs);
52
52
  }
53
53
 
54
54
  &--overlay {
@@ -58,7 +58,7 @@
58
58
  }
59
59
 
60
60
  &--overlay-screen {
61
- background: $transparent-grey;
61
+ background: palette.$transparent-grey;
62
62
  position: fixed;
63
63
  inset: 0;
64
64
  }
@@ -67,7 +67,7 @@
67
67
  position: absolute;
68
68
  top: 0;
69
69
  left: 0;
70
- background: $transparent-grey;
70
+ background: palette.$transparent-grey;
71
71
  height: 100%;
72
72
  width: 100%;
73
73
  }
@@ -102,7 +102,7 @@
102
102
  position: absolute;
103
103
  width: 8px;
104
104
  height: 8px;
105
- background-color: $blueberry500;
105
+ background-color: palette.$blueberry500;
106
106
  border-radius: 50%;
107
107
 
108
108
  // Sets a form of easing animation curve
@@ -124,31 +124,31 @@
124
124
  }
125
125
 
126
126
  &--banana {
127
- background-color: $banana500;
127
+ background-color: palette.$banana500;
128
128
  }
129
129
 
130
130
  &--cherry {
131
- background-color: $cherry500;
131
+ background-color: palette.$cherry500;
132
132
  }
133
133
 
134
134
  &--kiwi {
135
- background-color: $kiwi500;
135
+ background-color: palette.$kiwi500;
136
136
  }
137
137
 
138
138
  &--neutral {
139
- background-color: $neutral500;
139
+ background-color: palette.$neutral500;
140
140
  }
141
141
 
142
142
  &--plum {
143
- background-color: $plum500;
143
+ background-color: palette.$plum500;
144
144
  }
145
145
 
146
146
  &--black {
147
- background-color: $black;
147
+ background-color: palette.$black;
148
148
  }
149
149
 
150
150
  &--white {
151
- background-color: $white;
151
+ background-color: palette.$white;
152
152
  }
153
153
 
154
154
  // Scales up the first dot
@@ -1,28 +1,28 @@
1
1
  @use 'sass:map';
2
- @import '../../scss/spacers';
3
- @import '../../scss/breakpoints';
4
- @import '../../scss/palette';
5
- @import '../../scss/font-settings';
2
+ @use '../../scss/spacers' as spacers;
3
+ @use '../../scss/palette' as palette;
4
+ @use '../../scss/font-settings' as font-settings;
5
+ @use '../../scss/breakpoints' as *;
6
6
 
7
7
  .max-characters {
8
8
  display: flex;
9
9
  justify-content: flex-end;
10
- padding-top: getSpacer(2xs);
10
+ padding-top: spacers.getSpacer(2xs);
11
11
  padding-right: 2px;
12
- font-size: $font-size-sm;
13
- line-height: $lineheight-size-sm;
12
+ font-size: font-settings.$font-size-sm;
13
+ line-height: font-settings.$lineheight-size-sm;
14
14
 
15
15
  @media (min-width: map.get($grid-breakpoints, md)) {
16
- line-height: $lineheight-size-md;
17
- font-size: $font-size-md;
16
+ line-height: font-settings.$lineheight-size-md;
17
+ font-size: font-settings.$font-size-md;
18
18
  }
19
19
 
20
20
  &--on-dark {
21
- color: $white;
21
+ color: palette.$white;
22
22
  }
23
23
 
24
24
  &--invalid {
25
- color: $cherry600;
25
+ color: palette.$cherry600;
26
26
  font-weight: 600;
27
27
  }
28
28
  }
@@ -1,10 +1,12 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import React, { useEffect } from "react";
2
+ import React__default, { useEffect } from "react";
3
3
  import classNames from "classnames";
4
4
  import { ZIndex, AnalyticsId, IconSize } from "../../constants.js";
5
5
  import { useFocusTrap } from "../../hooks/useFocusTrap.js";
6
6
  import { useIsVisible } from "../../hooks/useIsVisible.js";
7
+ import { useReturnFocusOnUnmount } from "../../hooks/useReturnFocusOnUnmount.js";
7
8
  import { palette } from "../../theme/palette.js";
9
+ import { getAriaLabelAttributes } from "../../utils/accessibility.js";
8
10
  import { u as uuid } from "../../uuid.js";
9
11
  import { B as Button } from "../../Button.js";
10
12
  import { C as Close } from "../../Close.js";
@@ -44,7 +46,7 @@ const getIcon = (variant, icon) => {
44
46
  return /* @__PURE__ */ jsx("div", { className: styles.modal__iconWrapper, children: variantIcon });
45
47
  }
46
48
  if (icon) {
47
- return /* @__PURE__ */ jsx("div", { className: styles.modal__iconWrapper, children: React.cloneElement(icon, {
49
+ return /* @__PURE__ */ jsx("div", { className: styles.modal__iconWrapper, children: React__default.cloneElement(icon, {
48
50
  size: IconSize.Small
49
51
  }) });
50
52
  }
@@ -60,14 +62,15 @@ const Modal = (props) => {
60
62
  size = "large",
61
63
  zIndex = ZIndex.Modal
62
64
  } = props;
63
- const topContent = React.useRef(null);
64
- const modalContentRef = React.useRef(null);
65
- const dialogRef = React.useRef(null);
65
+ const topContent = React__default.useRef(null);
66
+ const modalContentRef = React__default.useRef(null);
67
+ const dialogRef = React__default.useRef(null);
66
68
  useFocusTrap(dialogRef, true);
67
69
  const topContentVisible = useIsVisible(topContent);
68
- const bottomContent = React.useRef(null);
70
+ const bottomContent = React__default.useRef(null);
69
71
  const bottomContentVisible = useIsVisible(bottomContent);
70
72
  const contentIsScrollable = modalContentRef.current && modalContentRef.current.scrollHeight > modalContentRef.current.clientHeight;
73
+ useReturnFocusOnUnmount(dialogRef);
71
74
  function handleKeyboardEvent(e) {
72
75
  if (e.key === "Escape" && props.onClose) {
73
76
  e.stopPropagation();
@@ -87,10 +90,9 @@ const Modal = (props) => {
87
90
  document.body.style.removeProperty("overflow");
88
91
  }
89
92
  const imageView = variant === "image";
90
- const overlayRef = React.useRef(null);
93
+ const overlayRef = React__default.useRef(null);
91
94
  const showActions = props.secondaryButtonText && ((_a = props.secondaryButtonText) == null ? void 0 : _a.length) > 0 || props.onSuccess;
92
- const ariaLabel = !props.ariaLabelledBy ? props.ariaLabel : void 0;
93
- const ariaLabelledBy = props.ariaLabelledBy ? props.ariaLabelledBy : !props.ariaLabel ? titleId : void 0;
95
+ const ariaLabelAttributes = getAriaLabelAttributes({ label: props.ariaLabel, id: props.ariaLabelledBy, fallbackId: titleId });
94
96
  useEffect(() => {
95
97
  const overlayElement = overlayRef.current;
96
98
  disableBodyScroll();
@@ -130,79 +132,66 @@ const Modal = (props) => {
130
132
  "data-testid": props.testId,
131
133
  "data-analyticsid": AnalyticsId.Modal,
132
134
  style: { zIndex },
133
- children: /* @__PURE__ */ jsx("div", { className: styles.align, children: /* @__PURE__ */ jsxs(
134
- "div",
135
- {
136
- className: dialogClasses,
137
- role: "dialog",
138
- "aria-modal": "true",
139
- tabIndex: -1,
140
- "aria-label": ariaLabel,
141
- "aria-labelledby": ariaLabelledBy,
142
- ref: dialogRef,
143
- children: [
144
- /* @__PURE__ */ jsx(
145
- "div",
146
- {
147
- className: classNames(styles["modal__shadow"], styles["modal__shadow--top"], {
148
- [styles["modal__shadow--show"]]: !topContentVisible && contentIsScrollable
149
- })
150
- }
151
- ),
152
- /* @__PURE__ */ jsxs(
153
- "div",
154
- {
155
- className: classNames(styles.modal__contentWrapper, {
156
- [styles["modal__contentWrapper--image"]]: imageView
157
- }),
158
- tabIndex: contentIsScrollable ? 0 : void 0,
159
- role: contentIsScrollable ? "region" : void 0,
160
- "aria-label": contentIsScrollable ? ariaLabel : void 0,
161
- "aria-labelledby": contentIsScrollable ? ariaLabelledBy : void 0,
162
- ref: modalContentRef,
163
- children: [
164
- !props.noCloseButton && /* @__PURE__ */ jsx("div", { className: styles.modal__closeWrapper, children: /* @__PURE__ */ jsx("div", { className: classNames(styles.modal__closeWrapper__close), children: /* @__PURE__ */ jsx(Close, { onClick: props.onClose, ariaLabel: props.ariaLabelCloseBtn }) }) }),
165
- /* @__PURE__ */ jsxs(
166
- "div",
167
- {
168
- className: classNames(size && styles[`modal__contentWrapper__scroll--${size}`], {
169
- [styles["modal__contentWrapper__scroll--image"]]: imageView
170
- }),
171
- children: [
172
- /* @__PURE__ */ jsx("div", { ref: topContent }),
173
- /* @__PURE__ */ jsxs("div", { className: styles.modal__contentWrapper__title, children: [
174
- getIcon(variant, props.icon),
175
- /* @__PURE__ */ jsx(Title, { id: ariaLabelledBy, htmlMarkup: "h3", appearance: "title3", className: titleClasses, children: props.title }),
176
- props.afterTitleChildren && /* @__PURE__ */ jsx("div", { className: styles["modal__afterTitleChildren"], children: props.afterTitleChildren })
177
- ] }),
178
- imageView && /* @__PURE__ */ jsxs("div", { children: [
179
- /* @__PURE__ */ jsx("div", { className: styles["modal__contentWrapper__imageWrapper"], children: props.children }),
180
- /* @__PURE__ */ jsx("span", { className: styles["modal__contentWrapper__imageDescription"], children: props.description })
181
- ] }),
182
- !imageView && props.children && /* @__PURE__ */ jsx("div", { children: props.children }),
183
- !imageView && !props.children && /* @__PURE__ */ jsx("p", { className: styles.modal__description, children: props.description }),
184
- /* @__PURE__ */ jsx("div", { ref: bottomContent })
185
- ]
186
- }
187
- )
188
- ]
189
- }
190
- ),
191
- /* @__PURE__ */ jsx(
192
- "div",
193
- {
194
- className: classNames(styles["modal__shadow"], styles["modal__shadow--bottom"], {
195
- [styles["modal__shadow--show"]]: !bottomContentVisible && contentIsScrollable
196
- })
197
- }
198
- ),
199
- showActions && /* @__PURE__ */ jsxs("div", { className: classNames(styles["modal__call-to-action"], size && styles[`modal__call-to-action--${size}`]), children: [
200
- props.onSuccess && /* @__PURE__ */ jsx(Button, { onClick: props.onSuccess, children: primaryButtonText }),
201
- props.secondaryButtonText && ((_b = props.secondaryButtonText) == null ? void 0 : _b.length) > 0 && /* @__PURE__ */ jsx(Button, { variant: "borderless", onClick: props.onClose, children: props.secondaryButtonText })
202
- ] })
203
- ]
204
- }
205
- ) })
135
+ children: /* @__PURE__ */ jsx("div", { className: styles.align, children: /* @__PURE__ */ jsxs("div", { className: dialogClasses, role: "dialog", "aria-modal": "true", tabIndex: -1, ...ariaLabelAttributes, ref: dialogRef, children: [
136
+ /* @__PURE__ */ jsx(
137
+ "div",
138
+ {
139
+ className: classNames(styles["modal__shadow"], styles["modal__shadow--top"], {
140
+ [styles["modal__shadow--show"]]: !topContentVisible && contentIsScrollable
141
+ })
142
+ }
143
+ ),
144
+ /* @__PURE__ */ jsxs(
145
+ "div",
146
+ {
147
+ className: classNames(styles.modal__contentWrapper, {
148
+ [styles["modal__contentWrapper--image"]]: imageView
149
+ }),
150
+ tabIndex: contentIsScrollable ? 0 : void 0,
151
+ role: contentIsScrollable ? "region" : void 0,
152
+ ...contentIsScrollable ? ariaLabelAttributes : {},
153
+ ref: modalContentRef,
154
+ children: [
155
+ !props.noCloseButton && /* @__PURE__ */ jsx("div", { className: styles.modal__closeWrapper, children: /* @__PURE__ */ jsx("div", { className: classNames(styles.modal__closeWrapper__close), children: /* @__PURE__ */ jsx(Close, { onClick: props.onClose, ariaLabel: props.ariaLabelCloseBtn }) }) }),
156
+ /* @__PURE__ */ jsxs(
157
+ "div",
158
+ {
159
+ className: classNames(size && styles[`modal__contentWrapper__scroll--${size}`], {
160
+ [styles["modal__contentWrapper__scroll--image"]]: imageView
161
+ }),
162
+ children: [
163
+ /* @__PURE__ */ jsx("div", { ref: topContent }),
164
+ /* @__PURE__ */ jsxs("div", { className: styles.modal__contentWrapper__title, children: [
165
+ getIcon(variant, props.icon),
166
+ /* @__PURE__ */ jsx(Title, { id: ariaLabelAttributes == null ? void 0 : ariaLabelAttributes["aria-labelledby"], htmlMarkup: "h3", appearance: "title3", className: titleClasses, children: props.title }),
167
+ props.afterTitleChildren && /* @__PURE__ */ jsx("div", { className: styles["modal__afterTitleChildren"], children: props.afterTitleChildren })
168
+ ] }),
169
+ imageView && /* @__PURE__ */ jsxs("div", { children: [
170
+ /* @__PURE__ */ jsx("div", { className: styles["modal__contentWrapper__imageWrapper"], children: props.children }),
171
+ /* @__PURE__ */ jsx("span", { className: styles["modal__contentWrapper__imageDescription"], children: props.description })
172
+ ] }),
173
+ !imageView && props.children && /* @__PURE__ */ jsx("div", { children: props.children }),
174
+ !imageView && !props.children && /* @__PURE__ */ jsx("p", { className: styles.modal__description, children: props.description }),
175
+ /* @__PURE__ */ jsx("div", { ref: bottomContent })
176
+ ]
177
+ }
178
+ )
179
+ ]
180
+ }
181
+ ),
182
+ /* @__PURE__ */ jsx(
183
+ "div",
184
+ {
185
+ className: classNames(styles["modal__shadow"], styles["modal__shadow--bottom"], {
186
+ [styles["modal__shadow--show"]]: !bottomContentVisible && contentIsScrollable
187
+ })
188
+ }
189
+ ),
190
+ showActions && /* @__PURE__ */ jsxs("div", { className: classNames(styles["modal__call-to-action"], size && styles[`modal__call-to-action--${size}`]), children: [
191
+ props.onSuccess && /* @__PURE__ */ jsx(Button, { onClick: props.onSuccess, children: primaryButtonText }),
192
+ props.secondaryButtonText && ((_b = props.secondaryButtonText) == null ? void 0 : _b.length) > 0 && /* @__PURE__ */ jsx(Button, { variant: "borderless", onClick: props.onClose, children: props.secondaryButtonText })
193
+ ] })
194
+ ] }) })
206
195
  }
207
196
  ) });
208
197
  if (props.printable) {