@dxc-technology/halstack-react 0.0.0-ecc45e2 → 0.0.0-ede733c

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 (216) hide show
  1. package/BackgroundColorContext.d.ts +2 -2
  2. package/BackgroundColorContext.js +1 -1
  3. package/HalstackContext.d.ts +1329 -5
  4. package/HalstackContext.js +117 -77
  5. package/accordion/Accordion.js +118 -110
  6. package/accordion/Accordion.stories.tsx +103 -15
  7. package/accordion/Accordion.test.js +10 -11
  8. package/accordion/types.d.ts +1 -0
  9. package/accordion-group/AccordionGroup.d.ts +4 -3
  10. package/accordion-group/AccordionGroup.js +24 -65
  11. package/accordion-group/AccordionGroup.stories.tsx +27 -1
  12. package/accordion-group/AccordionGroup.test.js +21 -46
  13. package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
  14. package/accordion-group/AccordionGroupAccordion.js +43 -0
  15. package/accordion-group/types.d.ts +7 -0
  16. package/alert/Alert.js +5 -9
  17. package/alert/Alert.stories.tsx +28 -0
  18. package/alert/Alert.test.js +1 -1
  19. package/bleed/Bleed.stories.tsx +1 -0
  20. package/box/Box.js +4 -6
  21. package/box/Box.stories.tsx +15 -0
  22. package/box/Box.test.js +1 -1
  23. package/box/types.d.ts +1 -0
  24. package/bulleted-list/BulletedList.js +4 -2
  25. package/bulleted-list/BulletedList.stories.tsx +7 -1
  26. package/bulleted-list/types.d.ts +31 -4
  27. package/button/Button.js +13 -16
  28. package/button/Button.stories.tsx +151 -9
  29. package/button/Button.test.js +1 -1
  30. package/button/types.d.ts +3 -3
  31. package/card/Card.js +12 -13
  32. package/card/Card.stories.tsx +12 -13
  33. package/card/Card.test.js +1 -1
  34. package/card/types.d.ts +1 -0
  35. package/checkbox/Checkbox.d.ts +2 -2
  36. package/checkbox/Checkbox.js +94 -101
  37. package/checkbox/Checkbox.stories.tsx +131 -59
  38. package/checkbox/Checkbox.test.js +94 -17
  39. package/checkbox/types.d.ts +4 -0
  40. package/chip/Chip.js +28 -49
  41. package/chip/Chip.stories.tsx +121 -26
  42. package/chip/Chip.test.js +3 -5
  43. package/common/OpenSans.css +68 -80
  44. package/common/coreTokens.d.ts +146 -0
  45. package/common/coreTokens.js +167 -0
  46. package/common/utils.d.ts +1 -0
  47. package/common/utils.js +4 -4
  48. package/common/variables.d.ts +1482 -0
  49. package/common/variables.js +994 -1137
  50. package/date-input/Calendar.d.ts +4 -0
  51. package/date-input/Calendar.js +258 -0
  52. package/date-input/DateInput.js +134 -237
  53. package/date-input/DateInput.stories.tsx +199 -33
  54. package/date-input/DateInput.test.js +494 -138
  55. package/date-input/DatePicker.d.ts +4 -0
  56. package/date-input/DatePicker.js +146 -0
  57. package/date-input/Icons.d.ts +6 -0
  58. package/date-input/Icons.js +75 -0
  59. package/date-input/YearPicker.d.ts +4 -0
  60. package/date-input/YearPicker.js +126 -0
  61. package/date-input/types.d.ts +51 -0
  62. package/dialog/Dialog.js +60 -73
  63. package/dialog/Dialog.stories.tsx +229 -121
  64. package/dialog/Dialog.test.js +302 -3
  65. package/dialog/types.d.ts +3 -2
  66. package/dropdown/Dropdown.js +43 -42
  67. package/dropdown/Dropdown.stories.tsx +210 -84
  68. package/dropdown/Dropdown.test.js +22 -27
  69. package/dropdown/DropdownMenu.js +12 -18
  70. package/dropdown/DropdownMenuItem.js +5 -18
  71. package/dropdown/types.d.ts +3 -3
  72. package/file-input/FileInput.d.ts +2 -2
  73. package/file-input/FileInput.js +174 -220
  74. package/file-input/FileInput.stories.tsx +122 -11
  75. package/file-input/FileInput.test.js +14 -14
  76. package/file-input/FileItem.d.ts +4 -14
  77. package/file-input/FileItem.js +39 -63
  78. package/file-input/types.d.ts +17 -0
  79. package/flex/Flex.d.ts +1 -1
  80. package/flex/Flex.js +33 -19
  81. package/flex/Flex.stories.tsx +35 -26
  82. package/flex/types.d.ts +83 -7
  83. package/footer/Footer.js +6 -8
  84. package/footer/Footer.stories.tsx +99 -1
  85. package/footer/Footer.test.js +14 -26
  86. package/footer/types.d.ts +1 -0
  87. package/grid/Grid.d.ts +7 -0
  88. package/grid/Grid.js +91 -0
  89. package/grid/Grid.stories.tsx +219 -0
  90. package/grid/types.d.ts +115 -0
  91. package/header/Header.d.ts +3 -2
  92. package/header/Header.js +21 -23
  93. package/header/Header.stories.tsx +152 -9
  94. package/header/Header.test.js +2 -2
  95. package/header/types.d.ts +3 -2
  96. package/heading/Heading.js +1 -1
  97. package/heading/Heading.test.js +1 -1
  98. package/inset/Inset.stories.tsx +2 -1
  99. package/layout/ApplicationLayout.d.ts +3 -3
  100. package/layout/ApplicationLayout.js +1 -1
  101. package/layout/ApplicationLayout.stories.tsx +1 -0
  102. package/layout/types.d.ts +2 -3
  103. package/link/Link.js +4 -4
  104. package/link/Link.stories.tsx +60 -0
  105. package/link/Link.test.js +2 -4
  106. package/link/types.d.ts +2 -2
  107. package/main.d.ts +3 -2
  108. package/main.js +9 -1
  109. package/{tabs-nav → nav-tabs}/NavTabs.js +1 -1
  110. package/{tabs-nav → nav-tabs}/NavTabs.stories.tsx +96 -6
  111. package/{tabs-nav → nav-tabs}/NavTabs.test.js +1 -1
  112. package/{tabs-nav → nav-tabs}/Tab.js +38 -18
  113. package/nav-tabs/types.js +5 -0
  114. package/number-input/NumberInput.test.js +44 -8
  115. package/package.json +15 -20
  116. package/paginator/Icons.d.ts +5 -0
  117. package/paginator/Icons.js +16 -28
  118. package/paginator/Paginator.js +7 -15
  119. package/paginator/Paginator.stories.tsx +24 -0
  120. package/paginator/Paginator.test.js +45 -48
  121. package/paragraph/Paragraph.d.ts +3 -4
  122. package/paragraph/Paragraph.js +5 -5
  123. package/password-input/PasswordInput.test.js +14 -13
  124. package/progress-bar/ProgressBar.d.ts +2 -2
  125. package/progress-bar/ProgressBar.js +5 -5
  126. package/progress-bar/ProgressBar.stories.jsx +35 -2
  127. package/progress-bar/ProgressBar.test.js +1 -1
  128. package/progress-bar/types.d.ts +4 -3
  129. package/quick-nav/QuickNav.js +11 -12
  130. package/quick-nav/QuickNav.stories.tsx +111 -19
  131. package/radio-group/Radio.d.ts +1 -1
  132. package/radio-group/Radio.js +43 -28
  133. package/radio-group/RadioGroup.js +15 -13
  134. package/radio-group/RadioGroup.stories.tsx +132 -18
  135. package/radio-group/RadioGroup.test.js +124 -97
  136. package/radio-group/types.d.ts +2 -2
  137. package/resultsetTable/Icons.d.ts +7 -0
  138. package/resultsetTable/Icons.js +51 -0
  139. package/resultsetTable/ResultsetTable.js +49 -108
  140. package/resultsetTable/ResultsetTable.stories.tsx +50 -25
  141. package/resultsetTable/ResultsetTable.test.js +41 -64
  142. package/resultsetTable/types.d.ts +1 -1
  143. package/select/Listbox.d.ts +1 -1
  144. package/select/Listbox.js +5 -35
  145. package/select/Option.js +11 -24
  146. package/select/Select.js +59 -36
  147. package/select/Select.stories.tsx +494 -150
  148. package/select/Select.test.js +341 -288
  149. package/select/types.d.ts +2 -2
  150. package/sidenav/Icons.d.ts +7 -0
  151. package/sidenav/Icons.js +51 -0
  152. package/sidenav/Sidenav.d.ts +2 -2
  153. package/sidenav/Sidenav.js +66 -96
  154. package/sidenav/Sidenav.stories.tsx +165 -63
  155. package/sidenav/types.d.ts +21 -18
  156. package/slider/Slider.d.ts +2 -2
  157. package/slider/Slider.js +119 -95
  158. package/slider/Slider.stories.tsx +64 -1
  159. package/slider/Slider.test.js +88 -25
  160. package/slider/types.d.ts +4 -0
  161. package/spinner/Spinner.js +17 -23
  162. package/spinner/Spinner.stories.jsx +53 -27
  163. package/spinner/Spinner.test.js +1 -1
  164. package/switch/Switch.d.ts +3 -3
  165. package/switch/Switch.js +96 -85
  166. package/switch/Switch.stories.tsx +33 -0
  167. package/switch/Switch.test.js +27 -14
  168. package/switch/types.d.ts +8 -3
  169. package/table/Table.js +3 -3
  170. package/table/Table.stories.jsx +80 -1
  171. package/table/Table.test.js +2 -2
  172. package/tabs/Tab.d.ts +4 -0
  173. package/tabs/Tab.js +132 -0
  174. package/tabs/Tabs.js +358 -108
  175. package/tabs/Tabs.stories.tsx +119 -5
  176. package/tabs/Tabs.test.js +220 -10
  177. package/tabs/types.d.ts +12 -2
  178. package/tag/Tag.js +8 -10
  179. package/tag/Tag.stories.tsx +14 -1
  180. package/tag/Tag.test.js +1 -1
  181. package/text-input/Icons.d.ts +8 -0
  182. package/text-input/Icons.js +60 -0
  183. package/text-input/Suggestion.js +40 -11
  184. package/text-input/Suggestions.d.ts +4 -0
  185. package/text-input/Suggestions.js +134 -0
  186. package/text-input/TextInput.js +189 -277
  187. package/text-input/TextInput.stories.tsx +280 -184
  188. package/text-input/TextInput.test.js +736 -725
  189. package/text-input/types.d.ts +21 -2
  190. package/textarea/Textarea.js +3 -4
  191. package/textarea/Textarea.stories.jsx +60 -1
  192. package/textarea/Textarea.test.js +2 -4
  193. package/toggle-group/ToggleGroup.d.ts +2 -2
  194. package/toggle-group/ToggleGroup.js +7 -4
  195. package/toggle-group/ToggleGroup.stories.tsx +42 -0
  196. package/toggle-group/ToggleGroup.test.js +1 -1
  197. package/toggle-group/types.d.ts +1 -1
  198. package/typography/Typography.d.ts +2 -2
  199. package/typography/Typography.js +14 -113
  200. package/typography/Typography.stories.tsx +1 -1
  201. package/useTheme.d.ts +1234 -1
  202. package/useTheme.js +1 -1
  203. package/useTranslatedLabels.d.ts +84 -1
  204. package/utils/BaseTypography.d.ts +21 -0
  205. package/utils/BaseTypography.js +108 -0
  206. package/utils/FocusLock.d.ts +13 -0
  207. package/utils/FocusLock.js +138 -0
  208. package/wizard/Wizard.js +2 -2
  209. package/wizard/Wizard.stories.tsx +20 -0
  210. package/wizard/Wizard.test.js +1 -1
  211. package/wizard/types.d.ts +5 -6
  212. package/common/RequiredComponent.js +0 -32
  213. /package/{tabs-nav → grid}/types.js +0 -0
  214. /package/{tabs-nav → nav-tabs}/NavTabs.d.ts +0 -0
  215. /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
  216. /package/{tabs-nav → nav-tabs}/types.d.ts +0 -0
@@ -5,39 +5,74 @@ import DxcHeading from "../heading/Heading";
5
5
  import DxcParagraph from "../paragraph/Paragraph";
6
6
  import Title from "../../.storybook/components/Title";
7
7
  import ExampleContainer from "../../.storybook/components/ExampleContainer";
8
+ import { HalstackProvider } from "../HalstackContext";
8
9
 
9
10
  export default {
10
11
  title: "QuickNav",
11
12
  component: DxcQuickNav,
12
13
  };
13
14
 
15
+ const opinionatedTheme = {
16
+ quickNav: {
17
+ fontColor: "#666666",
18
+ accentColor: "#9a6bb2",
19
+ },
20
+ };
21
+
22
+ const defaultLinks = [
23
+ {
24
+ label: "Overview",
25
+ },
26
+ {
27
+ label: "Principles",
28
+ links: [{ label: "Color" }, { label: "Spacing" }, { label: "Typography" }],
29
+ },
30
+ {
31
+ label: "Components",
32
+ links: [
33
+ {
34
+ label: "Accordion",
35
+ },
36
+ {
37
+ label: "Button",
38
+ },
39
+ ],
40
+ },
41
+ ];
42
+
14
43
  const links = [
15
44
  {
16
45
  label: "Overview",
17
- id: "overview",
18
46
  links: [
19
47
  {
20
48
  label: "Introduction",
21
- id: "introduction",
49
+ },
50
+ ],
51
+ },
52
+ {
53
+ label: "Components",
54
+ links: [
55
+ {
56
+ label: "Introduction",
57
+ },
58
+ {
59
+ label: "Accordion",
22
60
  },
23
61
  ],
24
62
  },
25
63
  {
26
64
  label: "Principles very very very very very very very very long",
27
- id: "principles",
28
65
  links: [
29
- { label: "Color very very very very very very very very long", id: "color" },
30
- { label: "Spacingveryveryveryveryveryveryveryverylong", id: "spacing" },
31
- { label: "Typography", id: "typography" },
66
+ { label: "Color very very very very very very very very long" },
67
+ { label: "Spacingveryveryveryveryveryveryveryverylong" },
68
+ { label: "Typography" },
32
69
  ],
33
70
  },
34
71
  {
35
72
  label: "Componentsveryveryveryveryveryveryveryverylong",
36
- id: "components",
37
73
  links: [
38
74
  {
39
75
  label: "Accordion",
40
- id: "accordion",
41
76
  },
42
77
  ],
43
78
  },
@@ -48,19 +83,25 @@ export const Chromatic = () => (
48
83
  <ExampleContainer>
49
84
  <Title title="Default" level={4} />
50
85
  <QuickNavContainer>
51
- <DxcQuickNav links={links}></DxcQuickNav>
86
+ <DxcQuickNav links={defaultLinks} />
87
+ </QuickNavContainer>
88
+ </ExampleContainer>
89
+ <ExampleContainer>
90
+ <Title title="Text overflow" level={4} />
91
+ <QuickNavContainer>
92
+ <DxcQuickNav links={links} />
52
93
  </QuickNavContainer>
53
94
  </ExampleContainer>
54
95
  <ExampleContainer pseudoState="pseudo-hover">
55
96
  <Title title="Link hovered" level={4} />
56
97
  <QuickNavContainer>
57
- <DxcQuickNav links={links}></DxcQuickNav>
98
+ <DxcQuickNav links={links} />
58
99
  </QuickNavContainer>
59
100
  </ExampleContainer>
60
101
  <ExampleContainer pseudoState="pseudo-focus">
61
102
  <Title title="Link focus" level={4} />
62
103
  <QuickNavContainer>
63
- <DxcQuickNav links={links}></DxcQuickNav>
104
+ <DxcQuickNav links={links} />
64
105
  </QuickNavContainer>
65
106
  </ExampleContainer>
66
107
  <ExampleContainer>
@@ -87,7 +128,7 @@ export const Chromatic = () => (
87
128
  open source design system for insurance products and digital experiences. Our system provides all the
88
129
  tools and resources needed to create superior, beautiful but above all, functional user experiences.
89
130
  </DxcParagraph>
90
- <Content id="introduction">
131
+ <Content id="overview-introduction">
91
132
  <DxcHeading level={2} text="Introduction" margin={{ top: "xsmall", bottom: "xsmall" }} />
92
133
  <DxcParagraph>
93
134
  Design principles Halstack design principles are the fundamental part of DXC Technology's approach to
@@ -122,9 +163,54 @@ export const Chromatic = () => (
122
163
  </DxcParagraph>
123
164
  </Content>
124
165
  </Content>
125
- <Content id="principles">
166
+ <Content id="components">
167
+ <DxcHeading level={1} text="Components" margin={{ top: "small", bottom: "xsmall" }} />
168
+ <Content id="components-introduction">
169
+ <DxcHeading level={2} text="Introduction" margin={{ top: "xsmall", bottom: "xsmall" }} />
170
+ <DxcParagraph>
171
+ Design principles Halstack design principles are the fundamental part of DXC Technology's approach to
172
+ provide guidance for development teams in order to deliver delightful and consistent user experiences to
173
+ our customers: Balance Consistency Visual hierarchy All our components, design tokens, accessibility
174
+ guidelines, responsive design techniques, and layout proposals have been carefully curated by DXC design
175
+ and engineering teams with the objective of creating a unique visual language and ecosystem for our
176
+ applications. This is the DXC way of creating User Experiences. Open Source Halstack is an open source
177
+ design system, this means that we work towards DXC Technology bussines needs, but it is open for anyone
178
+ to use and contribute back to. We are charmed to receive external contributions to help us find bugs,
179
+ design new features, or help us improve the project documentation. If you're interested, definitely
180
+ check out our contribution guidelines.Design principles Halstack design principles are the fundamental
181
+ part of DXC Technology's approach to provide guidance for development teams in order to deliver
182
+ delightful and consistent user experiences to our customers: Balance Consistency Visual hierarchy All
183
+ our components, design tokens, accessibility guidelines, responsive design techniques, and layout
184
+ proposals have been carefully curated by DXC design and engineering teams with the objective of creating
185
+ a unique visual language and ecosystem for our applications. This is the DXC way of creating User
186
+ Experiences. Open Source Halstack is an open source design system, this means that we work towards DXC
187
+ Technology bussines needs, but it is open for anyone to use and contribute back to. We are charmed to
188
+ receive external contributions to help us find bugs, design new features, or help us improve the project
189
+ documentation. If you're interested, definitely check out our contribution guidelines.Design principles
190
+ Halstack design principles are the fundamental part of DXC Technology's approach to provide guidance for
191
+ development teams in order to deliver delightful and consistent user experiences to our customers:
192
+ Balance Consistency Visual hierarchy All our components, design tokens, accessibility guidelines,
193
+ responsive design techniques, and layout proposals have been carefully curated by DXC design and
194
+ engineering teams with the objective of creating a unique visual language and ecosystem for our
195
+ applications. This is the DXC way of creating User Experiences. Open Source Halstack is an open source
196
+ design system, this means that we work towards DXC Technology bussines needs, but it is open for anyone
197
+ to use and contribute back to. We are charmed to receive external contributions to help us find bugs,
198
+ design new features, or help us improve the project documentation. If you're interested, definitely
199
+ check out our contribution guidelines.
200
+ </DxcParagraph>
201
+ </Content>
202
+ <Content id="components-accordion">
203
+ <DxcHeading level={2} text="Accordion" margin={{ top: "xsmall", bottom: "xsmall" }} />
204
+ <DxcParagraph>
205
+ Accordions are used to group similar content and hide or show it depending on user needs or preferences.
206
+ Accordions give users more granular control over the interface and help digest content in stages, rather
207
+ than all at once.
208
+ </DxcParagraph>
209
+ </Content>
210
+ </Content>
211
+ <Content id="principles-very-very-very-very-very-very-very-very-long">
126
212
  <DxcHeading level={1} text="Principles" margin={{ top: "small", bottom: "xsmall" }} />
127
- <Content id="color">
213
+ <Content id="principles-very-very-very-very-very-very-very-very-long-color-very-very-very-very-very-very-very-very-long">
128
214
  <DxcHeading level={2} text="Color" margin={{ top: "xsmall", bottom: "xsmall" }} />
129
215
  <DxcParagraph>
130
216
  The color palette is an essential asset as a communication resource of our design system. Halstack color
@@ -161,7 +247,7 @@ export const Chromatic = () => (
161
247
  role-based color palettes and must not be used outside this context.
162
248
  </DxcParagraph>
163
249
  </Content>
164
- <Content id="spacing">
250
+ <Content id="principles-very-very-very-very-very-very-very-very-long-spacingveryveryveryveryveryveryveryverylong">
165
251
  <DxcHeading level={2} text="Spacing" margin={{ top: "xsmall", bottom: "xsmall" }} />
166
252
  <DxcParagraph>
167
253
  In the search of consistent alignment between the elements we provide a spacing scale based on a root
@@ -183,7 +269,7 @@ export const Chromatic = () => (
183
269
  easily multiplied, they provide flexible and consistent, yet distinct enough, steps between them.
184
270
  </DxcParagraph>
185
271
  </Content>
186
- <Content id="typography">
272
+ <Content id="principles-very-very-very-very-very-very-very-very-long-typography">
187
273
  <DxcHeading level={2} text="Typography" margin={{ top: "xsmall", bottom: "xsmall" }} />
188
274
  <DxcParagraph>
189
275
  Our selected typography helps in structuring our user's experience based on the visual impact that it
@@ -220,9 +306,9 @@ export const Chromatic = () => (
220
306
  </DxcParagraph>
221
307
  </Content>
222
308
  </Content>
223
- <Content id="components">
309
+ <Content id="componentsveryveryveryveryveryveryveryverylong">
224
310
  <DxcHeading level={1} text="Components" margin={{ top: "small", bottom: "xsmall" }} />
225
- <Content id="accordion">
311
+ <Content id="componentsveryveryveryveryveryveryveryverylong-accordion">
226
312
  <DxcHeading level={2} text="Accordion" margin={{ top: "xsmall", bottom: "xsmall" }} />
227
313
  <DxcParagraph>
228
314
  Accordions are used to group similar content and hide or show it depending on user needs or preferences.
@@ -233,10 +319,16 @@ export const Chromatic = () => (
233
319
  </Content>
234
320
  </ContentContainer>
235
321
  <QuickNavContainer>
236
- <DxcQuickNav title="Sections" links={links}></DxcQuickNav>
322
+ <DxcQuickNav title="Sections" links={links} />
237
323
  </QuickNavContainer>
238
324
  </Container>
239
325
  </ExampleContainer>
326
+ <Title title="Opinionated theme" level={2} />
327
+ <ExampleContainer>
328
+ <HalstackProvider theme={opinionatedTheme}>
329
+ <DxcQuickNav links={defaultLinks} />
330
+ </HalstackProvider>
331
+ </ExampleContainer>
240
332
  </>
241
333
  );
242
334
 
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { RadioProps } from "./types";
3
- declare const _default: React.MemoExoticComponent<({ option, currentValue, onClick, error, disabled, focused, readonly, tabIndex, }: RadioProps) => JSX.Element>;
3
+ declare const _default: React.MemoExoticComponent<({ label, checked, onClick, error, disabled, focused, readonly, tabIndex, }: RadioProps) => JSX.Element>;
4
4
  export default _default;
@@ -28,10 +28,8 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
28
28
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
29
29
 
30
30
  var DxcRadio = function DxcRadio(_ref) {
31
- var _option$disabled;
32
-
33
- var option = _ref.option,
34
- currentValue = _ref.currentValue,
31
+ var label = _ref.label,
32
+ checked = _ref.checked,
35
33
  onClick = _ref.onClick,
36
34
  error = _ref.error,
37
35
  disabled = _ref.disabled,
@@ -50,7 +48,7 @@ var DxcRadio = function DxcRadio(_ref) {
50
48
  var _ref$current;
51
49
 
52
50
  onClick();
53
- focused && document.activeElement !== (ref === null || ref === void 0 ? void 0 : ref.current) && (ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus());
51
+ document.activeElement !== (ref === null || ref === void 0 ? void 0 : ref.current) && (ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.focus());
54
52
  };
55
53
 
56
54
  var _useState3 = (0, _react.useState)(true),
@@ -75,52 +73,57 @@ var DxcRadio = function DxcRadio(_ref) {
75
73
  error: error,
76
74
  disabled: disabled,
77
75
  readonly: readonly,
78
- onMouseDown: function onMouseDown(event) {
79
- // Prevents div's onClick from stealing the radio input's focus
80
- event.preventDefault();
81
- },
82
- onClick: handleOnClick
76
+ onClick: disabled ? undefined : handleOnClick
83
77
  }, /*#__PURE__*/_react["default"].createElement(RadioInputContainer, null, /*#__PURE__*/_react["default"].createElement(RadioInput, {
84
78
  error: error,
85
79
  disabled: disabled,
86
80
  readonly: readonly,
87
81
  role: "radio",
88
- "aria-checked": option.value === currentValue,
89
- "aria-disabled": (_option$disabled = option.disabled) !== null && _option$disabled !== void 0 ? _option$disabled : false,
82
+ "aria-checked": checked,
83
+ "aria-disabled": disabled,
90
84
  "aria-labelledby": radioLabelId,
91
85
  tabIndex: disabled ? -1 : focused ? tabIndex : -1,
92
86
  ref: ref
93
- }, option.value === currentValue && /*#__PURE__*/_react["default"].createElement(Dot, {
87
+ }, checked && /*#__PURE__*/_react["default"].createElement(Dot, {
94
88
  disabled: disabled,
95
89
  readonly: readonly,
96
90
  error: error
97
91
  }))), /*#__PURE__*/_react["default"].createElement(Label, {
98
92
  id: radioLabelId,
99
93
  disabled: disabled
100
- }, option.label))));
94
+ }, label))));
101
95
  };
102
96
 
103
- var RadioMainContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n"])));
97
+ var getRadioInputStateColor = function getRadioInputStateColor(props, state) {
98
+ switch (state) {
99
+ case "enabled":
100
+ return props.disabled ? props.theme.disabledRadioInputColor : props.error ? props.theme.errorRadioInputColor : props.readonly ? props.theme.readonlyRadioInputColor : props.theme.radioInputColor;
104
101
 
105
- var RadioContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n align-items: center;\n cursor: ", ";\n\n ", "\n"])), function (props) {
106
- return props.disabled ? "not-allowed" : props.readonly ? "default" : "pointer";
107
- }, function (props) {
108
- return !props.disabled ? "\n &:hover {\n & > div > div { \n border-color: ".concat(props.error ? props.theme.hoverErrorRadioInputColor : props.readonly ? props.theme.hoverReadonlyRadioInputColor : props.theme.hoverRadioInputColor, ";\n & > span {\n background-color: ").concat(props.error ? props.theme.hoverErrorRadioInputColor : props.readonly ? props.theme.hoverReadonlyRadioInputColor : props.theme.hoverRadioInputColor, ";\n }\n };\n }\n &:active {\n & > div > div {\n border-color: ").concat(props.error ? props.theme.activeErrorRadioInputColor : props.readonly ? props.theme.activeReadonlyRadioInputColor : props.theme.activeRadioInputColor, ";\n & > span {\n background-color: ").concat(props.error ? props.theme.activeErrorRadioInputColor : props.readonly ? props.theme.activeReadonlyRadioInputColor : props.theme.activeRadioInputColor, ";\n }\n }\n }\n ") : "pointer-events: none;";
109
- });
102
+ case "hover":
103
+ return props.error ? props.theme.hoverErrorRadioInputColor : props.readonly ? props.theme.hoverReadonlyRadioInputColor : props.theme.hoverRadioInputColor;
110
104
 
111
- var RadioInputContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n height: 24px;\n width: 24px;\n"])));
105
+ case "active":
106
+ return props.error ? props.theme.activeErrorRadioInputColor : props.readonly ? props.theme.activeReadonlyRadioInputColor : props.theme.activeRadioInputColor;
107
+ }
108
+ };
112
109
 
113
- var RadioInput = _styledComponents["default"].div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n box-sizing: border-box;\n width: 18px;\n height: 18px;\n border: 2px solid\n ", ";\n border-radius: 50%;\n\n ", "\n"])), function (props) {
114
- if (props.disabled) return props.theme.disabledRadioInputColor;else if (props.error) return props.theme.errorRadioInputColor;else if (props.readonly) return props.theme.readonlyRadioInputColor;else return props.theme.radioInputColor;
110
+ var RadioMainContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n"])));
111
+
112
+ var RadioInputContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n align-items: center;\n justify-content: center;\n height: 24px;\n width: 24px;\n"])));
113
+
114
+ var RadioInput = _styledComponents["default"].span(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 18px;\n height: 18px;\n border: 2px solid ", ";\n border-radius: 50%;\n\n &:focus {\n outline: 2px solid ", ";\n outline-offset: 1px;\n }\n ", "\n"])), function (props) {
115
+ return getRadioInputStateColor(props, "enabled");
116
+ }, function (props) {
117
+ return props.theme.focusBorderColor;
115
118
  }, function (props) {
116
- return !props.disabled ? "&:focus {\n outline: 2px solid ".concat(props.theme.focusBorderColor, ";\n outline-offset: 1px;\n }\n &:focus-visible {\n outline: 2px solid ").concat(props.theme.focusBorderColor, ";\n outline-offset: 1px;\n }\n ") : "\n :focus-visible {\n outline: none;\n }\n ";
119
+ return props.disabled && "pointer-events: none;";
117
120
  });
118
121
 
119
- var Dot = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n height: 10px;\n width: 10px;\n border-radius: 50%;\n background-color: ", ";\n"])), function (props) {
120
- if (props.disabled) return props.theme.disabledRadioInputColor;else if (props.error) return props.theme.errorRadioInputColor;else if (props.readonly) return props.theme.readonlyRadioInputColor;else return props.theme.radioInputColor;
122
+ var Dot = _styledComponents["default"].span(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2["default"])(["\n height: 10px;\n width: 10px;\n border-radius: 50%;\n background-color: ", ";\n"])), function (props) {
123
+ return getRadioInputStateColor(props, "enabled");
121
124
  });
122
125
 
123
- var Label = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n ", "\n"])), function (props) {
126
+ var Label = _styledComponents["default"].span(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n margin-left: ", ";\n font-family: ", ";\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n line-height: ", ";\n ", "\n"])), function (props) {
124
127
  return props.theme.radioInputLabelMargin;
125
128
  }, function (props) {
126
129
  return props.theme.fontFamily;
@@ -133,7 +136,19 @@ var Label = _styledComponents["default"].span(_templateObject6 || (_templateObje
133
136
  }, function (props) {
134
137
  return props.theme.radioInputLabelLineHeight;
135
138
  }, function (props) {
136
- return props.disabled ? "color: ".concat(props.theme.disabledRadioInputLabelFontColor, "; pointer-events: none;") : "color: ".concat(props.theme.radioInputLabelFontColor);
139
+ return props.disabled ? "color: ".concat(props.theme.disabledRadioInputLabelFontColor, ";") : "color: ".concat(props.theme.radioInputLabelFontColor);
140
+ });
141
+
142
+ var RadioContainer = _styledComponents["default"].span(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n align-items: center;\n cursor: ", ";\n\n &:hover {\n ", " {\n border-color: ", ";\n }\n ", " {\n background-color: ", ";\n }\n }\n &:active {\n ", " {\n border-color: ", ";\n }\n ", " {\n background-color: ", ";\n }\n }\n"])), function (props) {
143
+ return props.disabled ? "not-allowed" : props.readonly ? "default" : "pointer";
144
+ }, RadioInput, function (props) {
145
+ return !props.disabled && getRadioInputStateColor(props, "hover");
146
+ }, Dot, function (props) {
147
+ return !props.disabled && getRadioInputStateColor(props, "hover");
148
+ }, RadioInput, function (props) {
149
+ return !props.disabled && getRadioInputStateColor(props, "active");
150
+ }, Dot, function (props) {
151
+ return !props.disabled && getRadioInputStateColor(props, "active");
137
152
  });
138
153
 
139
154
  var _default = /*#__PURE__*/_react["default"].memo(DxcRadio);
@@ -41,6 +41,8 @@ var getInitialFocusIndex = function getInitialFocusIndex(innerOptions, value) {
41
41
  };
42
42
 
43
43
  var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
44
+ var _ref2;
45
+
44
46
  var label = _ref.label,
45
47
  name = _ref.name,
46
48
  helperText = _ref.helperText,
@@ -102,11 +104,11 @@ var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, re
102
104
  value !== null && value !== void 0 ? value : setInnerValue(newValue);
103
105
  onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
104
106
  }
105
- }, [value, innerValue, setInnerValue, onChange]);
107
+ }, [value, innerValue, onChange]);
106
108
 
107
- var handleOnBlur = function handleOnBlur(e) {
109
+ var handleOnBlur = function handleOnBlur(event) {
108
110
  // If the radio group loses the focus to an element not contained inside it...
109
- if (!e.currentTarget.contains(e.relatedTarget)) {
111
+ if (!event.currentTarget.contains(event.relatedTarget)) {
110
112
  setFirstTimeFocus(true);
111
113
  var currentValue = value !== null && value !== void 0 ? value : innerValue;
112
114
  !optional && !Boolean(currentValue) ? onBlur === null || onBlur === void 0 ? void 0 : onBlur({
@@ -166,8 +168,7 @@ var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, re
166
168
  setNextRadioChecked();
167
169
  break;
168
170
 
169
- case "Enter":
170
- case "Space":
171
+ case " ":
171
172
  event.preventDefault();
172
173
  handleOnChange(innerOptions[currentFocusIndex].value);
173
174
  break;
@@ -182,7 +183,7 @@ var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, re
182
183
  id: radioGroupLabelId,
183
184
  helperText: helperText,
184
185
  disabled: disabled
185
- }, label, " ", optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, translatedLabels.formFields.optionalLabel)), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
186
+ }, label, optional && /*#__PURE__*/_react["default"].createElement(OptionalLabel, null, " ".concat(translatedLabels.formFields.optionalLabel))), helperText && /*#__PURE__*/_react["default"].createElement(HelperText, {
186
187
  disabled: disabled
187
188
  }, helperText), /*#__PURE__*/_react["default"].createElement(RadioGroup, {
188
189
  onBlur: handleOnBlur,
@@ -192,20 +193,22 @@ var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, re
192
193
  role: "radiogroup",
193
194
  "aria-disabled": disabled,
194
195
  "aria-labelledby": radioGroupLabelId,
195
- "aria-invalid": error ? "true" : "false",
196
+ "aria-invalid": error ? true : false,
196
197
  "aria-errormessage": error ? errorId : undefined,
197
198
  "aria-required": !disabled && !readonly && !optional,
198
199
  "aria-readonly": readonly,
199
200
  "aria-orientation": stacking === "column" ? "vertical" : "horizontal"
200
201
  }, /*#__PURE__*/_react["default"].createElement(ValueInput, {
201
202
  name: name,
202
- value: value !== null && value !== void 0 ? value : innerValue,
203
+ disabled: disabled,
204
+ value: (_ref2 = value !== null && value !== void 0 ? value : innerValue) !== null && _ref2 !== void 0 ? _ref2 : "",
203
205
  readOnly: true,
204
206
  "aria-hidden": "true"
205
207
  }), innerOptions.map(function (option, index) {
206
208
  return /*#__PURE__*/_react["default"].createElement(_Radio["default"], {
207
- option: option,
208
- currentValue: value !== null && value !== void 0 ? value : innerValue,
209
+ key: "radio-".concat(index),
210
+ label: option.label,
211
+ checked: (value !== null && value !== void 0 ? value : innerValue) === option.value,
209
212
  onClick: function onClick() {
210
213
  handleOnChange(option.value);
211
214
  setCurrentFocusIndex(index);
@@ -214,8 +217,7 @@ var DxcRadioGroup = /*#__PURE__*/_react["default"].forwardRef(function (_ref, re
214
217
  disabled: option.disabled || disabled,
215
218
  focused: currentFocusIndex === index,
216
219
  readonly: readonly,
217
- tabIndex: tabIndex,
218
- key: "radio-".concat(index)
220
+ tabIndex: tabIndex
219
221
  });
220
222
  })), !disabled && typeof error === "string" && /*#__PURE__*/_react["default"].createElement(Error, {
221
223
  id: errorId,
@@ -261,7 +263,7 @@ var HelperText = _styledComponents["default"].span(_templateObject4 || (_templat
261
263
  return props.theme.groupLabelMargin;
262
264
  });
263
265
 
264
- var RadioGroup = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n flex-direction: ", ";\n\n row-gap: ", ";\n column-gap: ", ";\n"])), function (props) {
266
+ var RadioGroup = _styledComponents["default"].div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-wrap: wrap;\n flex-direction: ", ";\n row-gap: ", ";\n column-gap: ", ";\n"])), function (props) {
265
267
  return props.stacking;
266
268
  }, function (props) {
267
269
  return props.theme.groupVerticalGutter;