@innovaccer/design-system 2.5.0-4 → 2.6.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 (264) hide show
  1. package/.all-contributorsrc +1 -1
  2. package/.eslintrc.json +53 -0
  3. package/.github/workflows/jira.yml +1 -2
  4. package/.github/workflows/main.yml +2 -2
  5. package/.github/workflows/pull_request.yml +1 -1
  6. package/.github/workflows/test.yml +1 -1
  7. package/.husky/commit-msg +4 -0
  8. package/.prettierrc +2 -2
  9. package/CHANGELOG.md +38 -88
  10. package/CONTRIBUTING.md +173 -97
  11. package/README.md +1 -1
  12. package/commitlint.config.js +1 -0
  13. package/core/accessibility/utils/index.ts +5 -0
  14. package/core/accessibility/utils/isEnterKey.ts +5 -0
  15. package/core/accessibility/utils/isSpaceKey.ts +5 -0
  16. package/core/accessibility/utils/useAccessibilityProps.ts +31 -0
  17. package/core/components/atoms/_chip/__tests__/__snapshots__/_chip.test.tsx.snap +8 -0
  18. package/core/components/atoms/_chip/index.tsx +2 -0
  19. package/core/components/atoms/button/__stories__/Alert.story.tsx +8 -1
  20. package/core/components/atoms/button/__stories__/Cancel.story.tsx +4 -1
  21. package/core/components/atoms/button/__stories__/IconButtonGroup.story.tsx +12 -3
  22. package/core/components/atoms/button/__stories__/IconButtonSecondary.story.tsx +6 -1
  23. package/core/components/atoms/button/__stories__/IconLeftSecondary.story.tsx +4 -1
  24. package/core/components/atoms/button/__stories__/IconRightSecondary.story.tsx +4 -1
  25. package/core/components/atoms/button/__stories__/IconTransparent.story.tsx +4 -1
  26. package/core/components/atoms/button/__stories__/LabelButtonGroup.story.tsx +14 -3
  27. package/core/components/atoms/button/__stories__/LargeIconExpanded.story.tsx +4 -1
  28. package/core/components/atoms/button/__stories__/LoadingPrimary.story.tsx +4 -1
  29. package/core/components/atoms/button/__stories__/Primary.story.tsx +5 -2
  30. package/core/components/atoms/button/__stories__/SplitButton.story.tsx +6 -1
  31. package/core/components/atoms/button/__stories__/Transparent.story.tsx +8 -1
  32. package/core/components/atoms/button/__stories__/index.story.tsx +11 -1
  33. package/core/components/atoms/button/__stories__/variants/Appearance.story.tsx +4 -0
  34. package/core/components/atoms/button/__stories__/variants/Expanded.story.tsx +4 -0
  35. package/core/components/atoms/button/__stories__/variants/Size.story.tsx +4 -0
  36. package/core/components/atoms/button/__stories__/variants/icon/Icon.story.tsx +15 -0
  37. package/core/components/atoms/button/__stories__/variants/icon/IconLeft.story.tsx +4 -0
  38. package/core/components/atoms/button/__stories__/variants/icon/IconRight.story.tsx +4 -0
  39. package/core/components/atoms/button/__stories__/variants/state/Alert.story.tsx +7 -17
  40. package/core/components/atoms/button/__stories__/variants/state/Basic.story.tsx +9 -17
  41. package/core/components/atoms/button/__stories__/variants/state/Primary.story.tsx +7 -17
  42. package/core/components/atoms/button/__stories__/variants/state/Success.story.tsx +7 -17
  43. package/core/components/atoms/button/__stories__/variants/state/Transparent.story.tsx +13 -17
  44. package/core/components/atoms/chipGroup/__tests__/__snapshots__/chipGroup.test.tsx.snap +6 -0
  45. package/core/components/atoms/collapsible/__stories__/index.story.tsx +2 -2
  46. package/core/components/atoms/collapsible/__tests__/__snapshots__/Collapsible.test.tsx.snap +8 -0
  47. package/core/components/atoms/divider/Divider.tsx +44 -0
  48. package/core/components/atoms/divider/__stories__/BasicDividerInCard.story.tsx +74 -0
  49. package/core/components/atoms/divider/__stories__/HeaderDividerInCard.story.tsx +35 -0
  50. package/core/components/atoms/divider/__stories__/IndentedDivider.story.tsx +49 -0
  51. package/core/components/atoms/divider/__stories__/Vertical.story.tsx +51 -0
  52. package/core/components/atoms/divider/__stories__/index.story.tsx +91 -0
  53. package/core/components/atoms/divider/__stories__/variants/HorizontalDivider.story.tsx +27 -0
  54. package/core/components/atoms/divider/__tests__/Divider.test.tsx +50 -0
  55. package/core/components/atoms/divider/__tests__/__snapshots__/Divider.test.tsx.snap +53 -0
  56. package/core/components/atoms/divider/index.tsx +2 -0
  57. package/core/components/atoms/dropdown/DropdownList.tsx +8 -2
  58. package/core/components/atoms/dropdown/__stories__/variants/controlledDropdown/MultiSelect.story.tsx +27 -17
  59. package/core/components/atoms/dropdown/option/DefaultOption.tsx +3 -0
  60. package/core/components/atoms/dropdown/option/IconOption.tsx +3 -0
  61. package/core/components/atoms/dropdown/option/IconWithMetaOption.tsx +3 -0
  62. package/core/components/atoms/dropdown/option/MetaOption.tsx +3 -0
  63. package/core/components/atoms/editable/Editable.tsx +3 -0
  64. package/core/components/atoms/icon/Icon.tsx +14 -3
  65. package/core/components/atoms/icon/__stories__/variants/Image.story.tsx +6 -1
  66. package/core/components/atoms/icon/__tests__/__snapshots__/Icon.test.tsx.snap +74 -0
  67. package/core/components/atoms/input/Input.tsx +14 -4
  68. package/core/components/atoms/input/__stories__/BasicInput.story.tsx +2 -1
  69. package/core/components/atoms/input/__stories__/InputWithCaption.story.tsx +29 -9
  70. package/core/components/atoms/input/__stories__/InputWithLabel.story.tsx +11 -3
  71. package/core/components/atoms/input/__stories__/LabelPosition.story.tsx +8 -4
  72. package/core/components/atoms/input/__stories__/RequiredVsOptional.story.tsx +12 -8
  73. package/core/components/atoms/input/__tests__/__snapshots__/Input.test.tsx.snap +19 -0
  74. package/core/components/atoms/legend/Legend.tsx +3 -0
  75. package/core/components/atoms/message/__stories__/CustomDescription.tsx +25 -0
  76. package/core/components/atoms/metricInput/MetricInput.tsx +12 -2
  77. package/core/components/atoms/metricInput/__stories__/DefaultMetric.story.tsx +8 -2
  78. package/core/components/atoms/metricInput/__stories__/WithPrefix.story.tsx +6 -2
  79. package/core/components/atoms/metricInput/__stories__/index.story.tsx +1 -0
  80. package/core/components/atoms/metricInput/__stories__/variants/Controlled.story.tsx +2 -0
  81. package/core/components/atoms/metricInput/__stories__/variants/Size.story.tsx +2 -2
  82. package/core/components/atoms/metricInput/__stories__/withSuffix.story.tsx +6 -2
  83. package/core/components/atoms/metricInput/__tests__/__snapshots__/MetricInput.test.tsx.snap +20 -4
  84. package/core/components/atoms/multiSlider/Handle.tsx +3 -0
  85. package/core/components/atoms/multiSlider/index.tsx +6 -0
  86. package/core/components/atoms/outsideClick/__stories__/index.story.tsx +1 -1
  87. package/core/components/atoms/statusHint/StatusHint.tsx +3 -0
  88. package/core/components/atoms/switchInput/Switch.tsx +10 -4
  89. package/core/components/atoms/switchInput/__stories__/DefaultSwitch.story.tsx +4 -1
  90. package/core/components/atoms/switchInput/__stories__/OffState.story.tsx +4 -1
  91. package/core/components/atoms/switchInput/__stories__/index.story.tsx +26 -3
  92. package/core/components/atoms/switchInput/__stories__/variants/Size.story.tsx +10 -1
  93. package/core/components/atoms/switchInput/__stories__/variants/State.story.tsx +9 -2
  94. package/core/components/atoms/textarea/__stories__/TextareaWithCaption.story.tsx +9 -3
  95. package/core/components/atoms/textarea/__stories__/defaultTextarea.story.tsx +10 -2
  96. package/core/components/atoms/textarea/__stories__/index.story.tsx +1 -0
  97. package/core/components/atoms/textarea/__stories__/variants/Disable.story.tsx +1 -0
  98. package/core/components/atoms/toast/__tests__/__snapshots__/Toast.test.tsx.snap +30 -0
  99. package/core/components/css-utilities/Align/Align.story.tsx +1 -1
  100. package/core/components/css-utilities/Background/Background.story.tsx +1 -1
  101. package/core/components/css-utilities/Border/Border.story.tsx +1 -1
  102. package/core/components/css-utilities/Display/Display.story.tsx +1 -1
  103. package/core/components/css-utilities/Flex/Flex.story.tsx +1 -1
  104. package/core/components/css-utilities/Miscellaneous/Miscellaneous.story.tsx +1 -1
  105. package/core/components/css-utilities/Overflow/Overflow.story.tsx +1 -1
  106. package/core/components/css-utilities/Position/Position.story.tsx +1 -1
  107. package/core/components/css-utilities/Sizing/Sizing.story.tsx +1 -1
  108. package/core/components/css-utilities/Spacing/Spacing.story.tsx +1 -1
  109. package/core/components/molecules/chatMessage/Box.tsx +3 -0
  110. package/core/components/molecules/chipInput/ChipInput.tsx +3 -0
  111. package/core/components/molecules/chipInput/__tests__/__snapshots__/ChipInput.test.tsx.snap +12 -0
  112. package/core/components/molecules/dropzone/Dropzone.tsx +3 -0
  113. package/core/components/molecules/dropzone/FileSelectorUtils.tsx +1 -1
  114. package/core/components/molecules/editableChipInput/EditableChipInput.tsx +9 -5
  115. package/core/components/molecules/editableChipInput/__stories__/Uncontrolled.story.tsx +1 -1
  116. package/core/components/molecules/editableChipInput/__tests__/__snapshots__/EditableChipInput.test.tsx.snap +8 -0
  117. package/core/components/molecules/editableDropdown/EditableDropdown.tsx +2 -2
  118. package/core/components/molecules/editableInput/EditableInput.tsx +13 -4
  119. package/core/components/molecules/emptyState/EmptyState.tsx +5 -1
  120. package/core/components/molecules/fileList/FileListItem.tsx +2 -0
  121. package/core/components/molecules/fileUploader/FileUploaderItem.tsx +2 -0
  122. package/core/components/molecules/fileUploader/__stories__/index.story.tsx +156 -21
  123. package/core/components/molecules/inputMask/InputMask.tsx +1 -1
  124. package/core/components/molecules/inputMask/__tests__/__snapshots__/InputMask.test.tsx.snap +1 -0
  125. package/core/components/molecules/pagination/__tests__/__snapshots__/Pagination.test.tsx.snap +5 -1
  126. package/core/components/molecules/stepper/Step.tsx +2 -0
  127. package/core/components/molecules/tabs/Tabs.tsx +2 -0
  128. package/core/components/molecules/tabs/TabsWrapper.tsx +2 -0
  129. package/core/components/molecules/tabs/__stories__/CustomLabels.story.tsx +1 -1
  130. package/core/components/molecules/verificationCodeInput/VerificationCodeInput.tsx +8 -4
  131. package/core/components/molecules/verificationCodeInput/__stories__/index.story.tsx +3 -1
  132. package/core/components/molecules/verificationCodeInput/__tests__/__snapshots__/VerificationCodeInput.test.tsx.snap +1 -0
  133. package/core/components/organisms/calendar/Calendar.tsx +130 -8
  134. package/core/components/organisms/calendar/__tests__/Calendar.test.tsx +27 -0
  135. package/core/components/organisms/choiceList/ChoiceList.tsx +1 -1
  136. package/core/components/organisms/datePicker/DatePicker.tsx +30 -15
  137. package/core/components/organisms/datePicker/__tests__/DatePicker.test.tsx +136 -46
  138. package/core/components/organisms/datePicker/__tests__/__snapshots__/DatePicker.test.tsx.snap +4388 -1857
  139. package/core/components/organisms/dateRangePicker/__tests__/__snapshots__/DateRangePicker.test.tsx.snap +112 -40
  140. package/core/components/organisms/grid/Cell.tsx +4 -0
  141. package/core/components/organisms/grid/GridRow.tsx +4 -0
  142. package/core/components/organisms/grid/__stories__/_common_/fetchData.ts +2 -2
  143. package/core/components/organisms/horizontalNav/HorizontalNav.tsx +2 -0
  144. package/core/components/organisms/inlineMessage/InlineMessage.tsx +3 -5
  145. package/core/components/organisms/inlineMessage/__tests__/__snapshots__/InlineMessage.test.tsx.snap +30 -40
  146. package/core/components/organisms/navigation/VerticalNavigation.tsx +4 -0
  147. package/core/components/organisms/table/Table.tsx +1 -0
  148. package/core/components/organisms/table/__stories__/NestedTableWithNestedCard.story.tsx +4 -1
  149. package/core/components/organisms/table/__stories__/ResourceTable.story.tsx +3 -2
  150. package/core/components/organisms/table/__stories__/Selection.story.tsx +2 -2
  151. package/core/components/organisms/table/__stories__/TableAsDescriptionList.story.tsx +1 -1
  152. package/core/components/organisms/table/__stories__/TableAsOptionList.story.tsx +1 -1
  153. package/core/components/organisms/table/__stories__/syncTable.story.tsx +14 -6
  154. package/core/components/organisms/table/__stories__/variants/nestedRows.story.tsx +5 -2
  155. package/core/components/organisms/table/__stories__/variants/withHeader.story.tsx +0 -2
  156. package/core/components/organisms/timePicker/TimePicker.tsx +1 -1
  157. package/core/components/organisms/timePicker/__tests__/__snapshots__/TimePicker.test.tsx.snap +14 -2
  158. package/core/components/organisms/verticalNav/MenuItem.tsx +2 -0
  159. package/core/components/patterns/datePicker/datePickerWithPresets.story.tsx +126 -0
  160. package/core/components/patterns/dateRangePicker/withCustomPopover.story.tsx +8 -8
  161. package/core/components/patterns/forms/CreatePassword.story.tsx +1 -1
  162. package/core/components/patterns/forms/VerificationCodeInput.story.tsx +2 -2
  163. package/core/components/patterns/table/Table with Header/tableWithHeader.story.jsx +7 -7
  164. package/core/index.tsx +1 -0
  165. package/core/index.type.tsx +1 -0
  166. package/core/utils/Keys.ts +4 -0
  167. package/core/utils/__tests__/__snapshots__/TS.test.tsx.snap +544 -536
  168. package/core/utils/docPage/index.tsx +22 -17
  169. package/core/utils/testHelper.ts +1 -1
  170. package/core/utils/validators.ts +37 -34
  171. package/css/dist/index.css +1523 -1402
  172. package/css/dist/index.css.map +1 -1
  173. package/css/src/components/Legend.css +7 -7
  174. package/css/src/components/ProgressBar.css +1 -1
  175. package/css/src/components/avatarGroup.css +1 -1
  176. package/css/src/components/backdrop.css +12 -6
  177. package/css/src/components/badge.css +52 -52
  178. package/css/src/components/button.css +99 -94
  179. package/css/src/components/calendar.css +137 -126
  180. package/css/src/components/card.css +0 -1
  181. package/css/src/components/cardSubdued.css +3 -5
  182. package/css/src/components/chat.css +1 -1
  183. package/css/src/components/checkbox.css +71 -70
  184. package/css/src/components/chip.css +14 -13
  185. package/css/src/components/chipGroup.css +5 -5
  186. package/css/src/components/chipInput.css +1 -1
  187. package/css/src/components/choiceList.css +4 -4
  188. package/css/src/components/dateRangePicker.css +13 -13
  189. package/css/src/components/divider.css +20 -0
  190. package/css/src/components/dropdown.css +61 -61
  191. package/css/src/components/dropdownButton.css +36 -36
  192. package/css/src/components/dropzone.css +16 -20
  193. package/css/src/components/editableChipInput.css +10 -9
  194. package/css/src/components/editableDropdown.css +1 -1
  195. package/css/src/components/editableInput.css +1 -1
  196. package/css/src/components/emptyState.css +15 -15
  197. package/css/src/components/fileList.css +44 -45
  198. package/css/src/components/grid.css +217 -199
  199. package/css/src/components/horizontalNav.css +0 -1
  200. package/css/src/components/icon.css +1 -7
  201. package/css/src/components/inlineMessage.css +2 -1
  202. package/css/src/components/input.css +62 -62
  203. package/css/src/components/link.css +1 -1
  204. package/css/src/components/list.css +10 -10
  205. package/css/src/components/message.css +69 -70
  206. package/css/src/components/metaList.css +26 -26
  207. package/css/src/components/metricInput.css +3 -4
  208. package/css/src/components/modal.css +1 -1
  209. package/css/src/components/navigation.css +3 -3
  210. package/css/src/components/pageHeader.css +1 -2
  211. package/css/src/components/pagination.css +36 -36
  212. package/css/src/components/pills.css +19 -19
  213. package/css/src/components/placeholder.css +10 -5
  214. package/css/src/components/popover.css +2 -2
  215. package/css/src/components/progressRing.css +1 -1
  216. package/css/src/components/radio.css +74 -74
  217. package/css/src/components/slider.css +5 -5
  218. package/css/src/components/statusHints.css +15 -15
  219. package/css/src/components/switch.css +45 -41
  220. package/css/src/components/table.css +15 -15
  221. package/css/src/components/tabs.css +53 -53
  222. package/css/src/components/textarea.css +1 -1
  223. package/css/src/components/toast.css +53 -53
  224. package/css/src/components/verificationCodeInput.css +5 -6
  225. package/css/src/components/verticalNav.css +1 -2
  226. package/css/src/core/base.css +3 -0
  227. package/css/src/core/typography.css +1 -1
  228. package/css/src/core/utilities.css +1 -1
  229. package/css/src/tokens/index.css +63 -63
  230. package/css/src/utils/align.css +1 -1
  231. package/css/src/utils/background.css +1 -1
  232. package/css/src/utils/cursor.css +1 -1
  233. package/css/src/utils/display.css +1 -1
  234. package/css/src/utils/flex.css +1 -1
  235. package/css/src/utils/grid.css +1 -1
  236. package/css/src/utils/overflow.css +1 -1
  237. package/css/src/utils/position.css +1 -1
  238. package/css/src/utils/spacing.css +1 -1
  239. package/css/src/utils/utility.css +13 -13
  240. package/css/src/variables/index.css +1 -1
  241. package/dist/core/accessibility/utils/index.d.ts +4 -0
  242. package/dist/core/accessibility/utils/isEnterKey.d.ts +3 -0
  243. package/dist/core/accessibility/utils/isSpaceKey.d.ts +3 -0
  244. package/dist/core/accessibility/utils/useAccessibilityProps.d.ts +15 -0
  245. package/dist/core/components/atoms/divider/Divider.d.ts +15 -0
  246. package/dist/core/components/atoms/divider/index.d.ts +2 -0
  247. package/dist/core/components/atoms/icon/Icon.d.ts +3 -1
  248. package/dist/core/components/atoms/input/Input.d.ts +1 -1
  249. package/dist/core/components/atoms/popperWrapper/PopperWrapper.d.ts +50 -49
  250. package/dist/core/components/atoms/switchInput/Switch.d.ts +2 -1
  251. package/dist/core/components/organisms/calendar/Calendar.d.ts +31 -0
  252. package/dist/core/components/organisms/datePicker/DatePicker.d.ts +2 -0
  253. package/dist/core/components/patterns/datePicker/datePickerWithPresets.story.d.ts +15 -0
  254. package/dist/core/index.d.ts +1 -0
  255. package/dist/core/index.type.d.ts +1 -0
  256. package/dist/index.esm.js +829 -495
  257. package/dist/index.js +313 -144
  258. package/dist/index.js.map +1 -1
  259. package/dist/index.umd.js +1 -1
  260. package/dist/index.umd.js.br +0 -0
  261. package/dist/index.umd.js.gz +0 -0
  262. package/package.json +17 -14
  263. package/.husky/prepare-commit-msg +0 -6
  264. package/tslint.json +0 -30
@@ -8,6 +8,7 @@ exports[`Input component
8
8
  <div
9
9
  class="Input Input--regular"
10
10
  data-test="DesignSystem-InputWrapper"
11
+ role="presentation"
11
12
  style="min-width: 256px;"
12
13
  >
13
14
  <input
@@ -31,6 +32,7 @@ exports[`Input component
31
32
  <div
32
33
  class="Input Input--regular"
33
34
  data-test="DesignSystem-InputWrapper"
35
+ role="presentation"
34
36
  style="min-width: 256px;"
35
37
  >
36
38
  <div
@@ -64,6 +66,7 @@ exports[`Input component
64
66
  <div
65
67
  class="Input Input--regular"
66
68
  data-test="DesignSystem-InputWrapper"
69
+ role="presentation"
67
70
  style="min-width: 256px;"
68
71
  >
69
72
  <input
@@ -87,6 +90,7 @@ exports[`Input component
87
90
  <div
88
91
  class="Input Input--regular"
89
92
  data-test="DesignSystem-InputWrapper"
93
+ role="presentation"
90
94
  style="min-width: 256px;"
91
95
  >
92
96
  <div
@@ -120,6 +124,7 @@ exports[`Input component
120
124
  <div
121
125
  class="Input Input--large"
122
126
  data-test="DesignSystem-InputWrapper"
127
+ role="presentation"
123
128
  style="min-width: 256px;"
124
129
  >
125
130
  <input
@@ -142,6 +147,7 @@ exports[`Input component
142
147
  <div
143
148
  class="Input Input--large"
144
149
  data-test="DesignSystem-InputWrapper"
150
+ role="presentation"
145
151
  >
146
152
  <div
147
153
  class="Input-inlineLabel"
@@ -173,6 +179,7 @@ exports[`Input component
173
179
  <div
174
180
  class="Input Input--regular"
175
181
  data-test="DesignSystem-InputWrapper"
182
+ role="presentation"
176
183
  style="min-width: 256px;"
177
184
  >
178
185
  <input
@@ -195,6 +202,7 @@ exports[`Input component
195
202
  <div
196
203
  class="Input Input--regular"
197
204
  data-test="DesignSystem-InputWrapper"
205
+ role="presentation"
198
206
  >
199
207
  <div
200
208
  class="Input-inlineLabel"
@@ -226,6 +234,7 @@ exports[`Input component
226
234
  <div
227
235
  class="Input Input--tiny"
228
236
  data-test="DesignSystem-InputWrapper"
237
+ role="presentation"
229
238
  style="min-width: 256px;"
230
239
  >
231
240
  <input
@@ -248,6 +257,7 @@ exports[`Input component
248
257
  <div
249
258
  class="Input Input--tiny"
250
259
  data-test="DesignSystem-InputWrapper"
260
+ role="presentation"
251
261
  >
252
262
  <div
253
263
  class="Input-inlineLabel"
@@ -279,6 +289,7 @@ exports[`Input component
279
289
  <div
280
290
  class="Input Input--regular"
281
291
  data-test="DesignSystem-InputWrapper"
292
+ role="presentation"
282
293
  >
283
294
  <input
284
295
  class="Input-input Input-input--regular"
@@ -300,6 +311,7 @@ exports[`Input component
300
311
  <div
301
312
  class="Input Input--regular"
302
313
  data-test="DesignSystem-InputWrapper"
314
+ role="presentation"
303
315
  style="min-width: 256px;"
304
316
  >
305
317
  <input
@@ -322,6 +334,7 @@ exports[`Input component
322
334
  <div
323
335
  class="Input Input--regular"
324
336
  data-test="DesignSystem-InputWrapper"
337
+ role="presentation"
325
338
  style="min-width: 256px;"
326
339
  >
327
340
  <input
@@ -344,6 +357,7 @@ exports[`Input component
344
357
  <div
345
358
  class="Input Input--regular Input--disabled"
346
359
  data-test="DesignSystem-InputWrapper"
360
+ role="presentation"
347
361
  style="min-width: 256px;"
348
362
  >
349
363
  <input
@@ -368,6 +382,7 @@ exports[`Input component
368
382
  <div
369
383
  class="Input Input--regular Input--disabled"
370
384
  data-test="DesignSystem-InputWrapper"
385
+ role="presentation"
371
386
  style="min-width: 256px;"
372
387
  >
373
388
  <div
@@ -402,6 +417,7 @@ exports[`Input component
402
417
  <div
403
418
  class="Input Input--regular Input--disabled"
404
419
  data-test="DesignSystem-InputWrapper"
420
+ role="presentation"
405
421
  style="min-width: 256px;"
406
422
  >
407
423
  <input
@@ -426,6 +442,7 @@ exports[`Input component
426
442
  <div
427
443
  class="Input Input--regular Input--disabled"
428
444
  data-test="DesignSystem-InputWrapper"
445
+ role="presentation"
429
446
  style="min-width: 256px;"
430
447
  >
431
448
  <div
@@ -460,6 +477,7 @@ exports[`Input component
460
477
  <div
461
478
  class="Input Input--regular Input--error"
462
479
  data-test="DesignSystem-InputWrapper"
480
+ role="presentation"
463
481
  style="min-width: 256px;"
464
482
  >
465
483
  <input
@@ -482,6 +500,7 @@ exports[`Input component
482
500
  <div
483
501
  class="Input Input--regular Input--error"
484
502
  data-test="DesignSystem-InputWrapper"
503
+ role="presentation"
485
504
  style="min-width: 256px;"
486
505
  >
487
506
  <div
@@ -66,6 +66,8 @@ export const Legend = (props: LegendProps) => {
66
66
  width: `${iconSize}px`,
67
67
  };
68
68
 
69
+ // TODO(a11y): fix accessibility
70
+ /* eslint-disable */
69
71
  return (
70
72
  <div
71
73
  {...baseProps}
@@ -74,6 +76,7 @@ export const Legend = (props: LegendProps) => {
74
76
  onMouseEnter={(e) => onMouseEnter && onMouseEnter(e)}
75
77
  onMouseLeave={(e) => onMouseLeave && onMouseLeave(e)}
76
78
  >
79
+ {/* eslint-enable */}
77
80
  <span className="Legend-icon" style={styles} />
78
81
  <Text appearance={labelAppearance} weight={labelWeight}>
79
82
  {children}
@@ -0,0 +1,25 @@
1
+ import * as React from 'react';
2
+ import { Message, Row, Column, Text } from '@/index';
3
+
4
+ export const CustomDescription = () => (
5
+ <Row>
6
+ <Column size="4">
7
+ <Message
8
+ actions={
9
+ <>
10
+ <Text className="cursor-pointer" appearance="link">
11
+ Try again
12
+ </Text>
13
+ </>
14
+ }
15
+ >
16
+ <Text appearance="default">Sorry we couldn't subscribe you. Please try again.</Text>
17
+ </Message>
18
+ </Column>
19
+ </Row>
20
+ );
21
+
22
+ export default {
23
+ title: 'Components/Message/Custom Description',
24
+ component: Message,
25
+ };
@@ -229,7 +229,14 @@ export const MetricInput = React.forwardRef<HTMLInputElement, MetricInputProps>(
229
229
  const iconSize = size === 'regular' ? 12 : 16;
230
230
 
231
231
  return (
232
- <div data-test="DesignSystem-MetricInputWrapper" className={classes} onClick={() => ref.current?.focus()}>
232
+ <div
233
+ data-test="DesignSystem-MetricInputWrapper"
234
+ className={classes}
235
+ onClick={() => ref.current?.focus()}
236
+ onFocus={() => ref.current?.focus()}
237
+ onKeyDown={() => {}}
238
+ role="presentation"
239
+ >
233
240
  {icon && (
234
241
  <Icon
235
242
  data-test="DesignSystem-MetricInput--icon"
@@ -278,8 +285,10 @@ export const MetricInput = React.forwardRef<HTMLInputElement, MetricInputProps>(
278
285
  {suffix}
279
286
  </Text>
280
287
  )}
281
- <div className="MetricInput-arrowIcons" tabIndex={0}>
288
+
289
+ <div className="MetricInput-arrowIcons">
282
290
  <Icon
291
+ tabIndex={-1}
283
292
  className={getArrowClass('up')}
284
293
  size={iconSize}
285
294
  name="keyboard_arrow_up"
@@ -287,6 +296,7 @@ export const MetricInput = React.forwardRef<HTMLInputElement, MetricInputProps>(
287
296
  data-test="DesignSystem-MetricInput--upIcon"
288
297
  />
289
298
  <Icon
299
+ tabIndex={-1}
290
300
  className={getArrowClass('down')}
291
301
  size={iconSize}
292
302
  name="keyboard_arrow_down"
@@ -7,9 +7,13 @@ export const defaultMetric = () => {
7
7
 
8
8
  return (
9
9
  <div className="d-flex align-items-center">
10
- <Label className="mr-5">No. of Days</Label>
10
+ <Label htmlFor="metric-input" className="mr-5">
11
+ No. of Days
12
+ </Label>
11
13
  <div style={{ width: 'var(--spacing-6)' }}>
12
14
  <MetricInput
15
+ id="metric-input"
16
+ name="metric-input"
13
17
  size="regular"
14
18
  value={value}
15
19
  onChange={(e) => {
@@ -26,9 +30,11 @@ const customCode = `() => {
26
30
 
27
31
  return (
28
32
  <div className="d-flex align-items-center">
29
- <Label className="mr-5">No. of Days</Label>
33
+ <Label htmlFor="metric-input" className="mr-5">
30
34
  <div style={{ width: 'var(--spacing-6)' }}>
31
35
  <MetricInput
36
+ id="metric-input"
37
+ name="metric-input"
32
38
  size="regular"
33
39
  value={value}
34
40
  onChange={e => { setValue(e.target.value); }}
@@ -7,9 +7,12 @@ export const withPrefix = () => {
7
7
 
8
8
  return (
9
9
  <div className="d-flex align-items-center">
10
- <Label className="mr-5">Cost</Label>
10
+ <Label htmlFor="metric-input" className="mr-5">
11
+ Cost
12
+ </Label>
11
13
  <div style={{ width: 'var(--spacing-7)' }}>
12
14
  <MetricInput
15
+ id="metric-input"
13
16
  prefix="USD"
14
17
  value={value}
15
18
  onChange={(e) => {
@@ -26,9 +29,10 @@ const customCode = `() => {
26
29
 
27
30
  return (
28
31
  <div className="d-flex align-items-center">
29
- <Label className="mr-5">Cost</Label>
32
+ <Label htmlFor="metric-input" className="mr-5">Cost</Label>
30
33
  <div style={{ width: 'var(--spacing-7)' }}>
31
34
  <MetricInput
35
+ id="metric-input"
32
36
  prefix="USD"
33
37
  value={value}
34
38
  onChange={e => { setValue(e.target.value); }}
@@ -30,6 +30,7 @@ export const all = () => {
30
30
  onChange={action('on-change')}
31
31
  onClick={action('on-click')}
32
32
  placeholder={placeholder}
33
+ aria-label="Metric input example"
33
34
  prefix={prefix}
34
35
  suffix={suffix}
35
36
  size={size}
@@ -8,6 +8,7 @@ export const controlledMetricInput = () => {
8
8
  return (
9
9
  <div style={{ width: 'var(--spacing-6)' }}>
10
10
  <MetricInput
11
+ aria-label="Metric Input Label"
11
12
  value={value}
12
13
  onChange={(e) => {
13
14
  setValue(e.target.value);
@@ -23,6 +24,7 @@ const customCode = `() => {
23
24
  return (
24
25
  <div style={{ width: 'var(--spacing-6)' }}>
25
26
  <MetricInput
27
+ aria-label="Metric Input Label"
26
28
  value={value}
27
29
  onChange={(e) => { setValue(e.target.value) }}
28
30
  />
@@ -5,11 +5,11 @@ import { MetricInput, Text } from '@/index';
5
5
  export const size = () => (
6
6
  <div className="d-flex" style={{ width: 'var(--spacing-8)' }}>
7
7
  <div className="d-flex flex-column align-items-center mr-8">
8
- <MetricInput size="regular" className="mb-3" />
8
+ <MetricInput aria-label="Metric input regular size" size="regular" className="mb-3" />
9
9
  <Text>Regular</Text>
10
10
  </div>
11
11
  <div className="d-flex flex-column align-items-center">
12
- <MetricInput size="large" className="mb-3" />
12
+ <MetricInput aria-label="Metric input large size" size="large" className="mb-3" />
13
13
  <Text>Large</Text>
14
14
  </div>
15
15
  </div>
@@ -7,9 +7,12 @@ export const withSuffix = () => {
7
7
 
8
8
  return (
9
9
  <div className="d-flex align-items-center">
10
- <Label className="mr-5">Body Height</Label>
10
+ <Label htmlFor="metric-input" className="mr-5">
11
+ Body Height
12
+ </Label>
11
13
  <div style={{ width: 'var(--spacing-6)' }}>
12
14
  <MetricInput
15
+ id="metric-input"
13
16
  suffix="in"
14
17
  value={value}
15
18
  onChange={(e) => {
@@ -26,9 +29,10 @@ const customCode = `() => {
26
29
 
27
30
  return (
28
31
  <div className="d-flex align-items-center">
29
- <Label className="mr-5">Body Height</Label>
32
+ <Label htmlFor="metric-input" className="mr-5">Body Height</Label>
30
33
  <div style={{ width: 'var(--spacing-6)' }}>
31
34
  <MetricInput
35
+ id="metric-input"
32
36
  suffix="in"
33
37
  value={value}
34
38
  onChange={e => { setValue(e.target.value); }}
@@ -8,6 +8,7 @@ exports[`MetricInput component
8
8
  <div
9
9
  class="MetricInput MetricInput--regular"
10
10
  data-test="DesignSystem-MetricInputWrapper"
11
+ role="presentation"
11
12
  >
12
13
  <i
13
14
  class="material-icons material-icons-round Icon Icon--subtle MetricInput-icon MetricInput-icon--regular"
@@ -24,19 +25,22 @@ exports[`MetricInput component
24
25
  />
25
26
  <div
26
27
  class="MetricInput-arrowIcons"
27
- tabindex="0"
28
28
  >
29
29
  <i
30
30
  class="material-icons material-icons-round Icon MetricInput-arrowIcon MetricInput-arrowIcon--regular MetricInput-arrowIcon--up"
31
31
  data-test="DesignSystem-MetricInput--upIcon"
32
+ role="button"
32
33
  style="font-size: 12px; width: 12px;"
34
+ tabindex="0"
33
35
  >
34
36
  keyboard_arrow_up_round
35
37
  </i>
36
38
  <i
37
39
  class="material-icons material-icons-round Icon MetricInput-arrowIcon MetricInput-arrowIcon--regular MetricInput-arrowIcon--down"
38
40
  data-test="DesignSystem-MetricInput--downIcon"
41
+ role="button"
39
42
  style="font-size: 12px; width: 12px;"
43
+ tabindex="0"
40
44
  >
41
45
  keyboard_arrow_down_round
42
46
  </i>
@@ -54,6 +58,7 @@ exports[`MetricInput component
54
58
  <div
55
59
  class="MetricInput MetricInput--regular MetricInput--error"
56
60
  data-test="DesignSystem-MetricInputWrapper"
61
+ role="presentation"
57
62
  >
58
63
  <i
59
64
  class="material-icons material-icons-round Icon Icon--subtle MetricInput-icon MetricInput-icon--regular"
@@ -70,19 +75,22 @@ exports[`MetricInput component
70
75
  />
71
76
  <div
72
77
  class="MetricInput-arrowIcons"
73
- tabindex="0"
74
78
  >
75
79
  <i
76
80
  class="material-icons material-icons-round Icon MetricInput-arrowIcon MetricInput-arrowIcon--regular MetricInput-arrowIcon--up"
77
81
  data-test="DesignSystem-MetricInput--upIcon"
82
+ role="button"
78
83
  style="font-size: 12px; width: 12px;"
84
+ tabindex="0"
79
85
  >
80
86
  keyboard_arrow_up_round
81
87
  </i>
82
88
  <i
83
89
  class="material-icons material-icons-round Icon MetricInput-arrowIcon MetricInput-arrowIcon--regular MetricInput-arrowIcon--down"
84
90
  data-test="DesignSystem-MetricInput--downIcon"
91
+ role="button"
85
92
  style="font-size: 12px; width: 12px;"
93
+ tabindex="0"
86
94
  >
87
95
  keyboard_arrow_down_round
88
96
  </i>
@@ -100,6 +108,7 @@ exports[`MetricInput component
100
108
  <div
101
109
  class="MetricInput MetricInput--large"
102
110
  data-test="DesignSystem-MetricInputWrapper"
111
+ role="presentation"
103
112
  >
104
113
  <span
105
114
  class="Text Text--subtle Text--large mr-5"
@@ -122,19 +131,22 @@ exports[`MetricInput component
122
131
  </span>
123
132
  <div
124
133
  class="MetricInput-arrowIcons"
125
- tabindex="0"
126
134
  >
127
135
  <i
128
136
  class="material-icons material-icons-round Icon MetricInput-arrowIcon MetricInput-arrowIcon--large MetricInput-arrowIcon--up"
129
137
  data-test="DesignSystem-MetricInput--upIcon"
138
+ role="button"
130
139
  style="font-size: 16px; width: 16px;"
140
+ tabindex="0"
131
141
  >
132
142
  keyboard_arrow_up_round
133
143
  </i>
134
144
  <i
135
145
  class="material-icons material-icons-round Icon MetricInput-arrowIcon MetricInput-arrowIcon--large MetricInput-arrowIcon--down"
136
146
  data-test="DesignSystem-MetricInput--downIcon"
147
+ role="button"
137
148
  style="font-size: 16px; width: 16px;"
149
+ tabindex="0"
138
150
  >
139
151
  keyboard_arrow_down_round
140
152
  </i>
@@ -152,6 +164,7 @@ exports[`MetricInput component
152
164
  <div
153
165
  class="MetricInput MetricInput--regular"
154
166
  data-test="DesignSystem-MetricInputWrapper"
167
+ role="presentation"
155
168
  >
156
169
  <span
157
170
  class="Text Text--subtle Text--regular mr-4"
@@ -174,19 +187,22 @@ exports[`MetricInput component
174
187
  </span>
175
188
  <div
176
189
  class="MetricInput-arrowIcons"
177
- tabindex="0"
178
190
  >
179
191
  <i
180
192
  class="material-icons material-icons-round Icon MetricInput-arrowIcon MetricInput-arrowIcon--regular MetricInput-arrowIcon--up"
181
193
  data-test="DesignSystem-MetricInput--upIcon"
194
+ role="button"
182
195
  style="font-size: 12px; width: 12px;"
196
+ tabindex="0"
183
197
  >
184
198
  keyboard_arrow_up_round
185
199
  </i>
186
200
  <i
187
201
  class="material-icons material-icons-round Icon MetricInput-arrowIcon MetricInput-arrowIcon--regular MetricInput-arrowIcon--down"
188
202
  data-test="DesignSystem-MetricInput--downIcon"
203
+ role="button"
189
204
  style="font-size: 12px; width: 12px;"
205
+ tabindex="0"
190
206
  >
191
207
  keyboard_arrow_down_round
192
208
  </i>
@@ -182,6 +182,8 @@ export class Handle extends React.Component<InternalHandleProps, HandleState> {
182
182
  });
183
183
 
184
184
  return (
185
+ // TODO(a11y): fix accessibility
186
+ /* eslint-disable */
185
187
  <>
186
188
  <div
187
189
  className={className}
@@ -195,6 +197,7 @@ export class Handle extends React.Component<InternalHandleProps, HandleState> {
195
197
  tabIndex={1}
196
198
  data-test="DesignSystem-MultiSlider-Handle"
197
199
  />
200
+ {/* eslint-enable */}
198
201
  <div className={TooltipClass} style={style}>
199
202
  {label}
200
203
  </div>
@@ -322,6 +322,8 @@ export class MultiSlider extends React.Component<InternalMultiSliderProps, Multi
322
322
  }
323
323
  };
324
324
 
325
+ // TODO(a11y): fix accessibility
326
+ /* eslint-disable */
325
327
  labels.push(
326
328
  <div
327
329
  onClick={onClickHandler}
@@ -332,6 +334,7 @@ export class MultiSlider extends React.Component<InternalMultiSliderProps, Multi
332
334
  onMouseLeave={this.handleLabelMouseLeave}
333
335
  data-test="DesignSystem-MultiSlider-Label"
334
336
  >
337
+ {/* eslint-enable */}
335
338
  <span className={'Slider-ticks'} />
336
339
  {labelRenderer !== false && (
337
340
  <Text size="small" appearance={active ? 'default' : 'disabled'}>
@@ -414,12 +417,15 @@ export class MultiSlider extends React.Component<InternalMultiSliderProps, Multi
414
417
  <div {...baseProps} className={SliderClass} data-test="DesignSystem-MultiSlider">
415
418
  {label && <Label withInput={true}>{label}</Label>}
416
419
  <div className={WrapperClass}>
420
+ {/* TODO(a11y): fix accessibility */}
421
+ {/* eslint-disable */}
417
422
  <div
418
423
  className="Slider-track"
419
424
  ref={(ref) => (this.trackElement = ref)}
420
425
  onMouseDown={this.maybeHandleTrackClick}
421
426
  data-test="DesignSystem-MultiSlider-Slider-Track"
422
427
  >
428
+ {/* eslint-enable */}
423
429
  {this.renderTracks()}
424
430
  </div>
425
431
  <div className="Slider-axis">{this.renderLabels()}</div>
@@ -35,7 +35,7 @@ const customCode = `() => {
35
35
  }`;
36
36
 
37
37
  export default {
38
- title: 'Components/OutsideClick/All',
38
+ title: 'Others/Utilities/OutsideClick/All',
39
39
  component: OutsideClick,
40
40
  parameters: {
41
41
  docs: {
@@ -46,6 +46,8 @@ export const StatusHint = (props: StatusHintProps) => {
46
46
  });
47
47
 
48
48
  return (
49
+ // TODO(a11y): fix accessibility
50
+ /* eslint-disable */
49
51
  <div
50
52
  data-test="DesignSystem-StatusHint"
51
53
  {...baseProps}
@@ -54,6 +56,7 @@ export const StatusHint = (props: StatusHintProps) => {
54
56
  onMouseEnter={(e) => onMouseEnter && onMouseEnter(e)}
55
57
  onMouseLeave={(e) => onMouseLeave && onMouseLeave(e)}
56
58
  >
59
+ {/* eslint-enable */}
57
60
  <span data-test="DesignSystem-StatusHint--Icon" className={StatusHintIconClass} />
58
61
  <Text data-test="DesignSystem-StatusHint--Text" weight={'medium'}>
59
62
  {children}
@@ -1,12 +1,15 @@
1
1
  import * as React from 'react';
2
2
  import classNames from 'classnames';
3
3
  import { OmitNativeProps, BaseProps } from '@/utils/types';
4
+ import { isSpaceKey } from '@/accessibility/utils';
4
5
 
5
6
  export type Size = 'regular' | 'tiny' | 'large';
6
7
  export type Appearance = 'primary' | 'alert' | 'success' | 'warning';
7
8
 
8
9
  type MouseEvent = React.ChangeEvent<HTMLInputElement>;
9
10
 
11
+ type KeyboardEvent = React.KeyboardEvent<HTMLInputElement>;
12
+
10
13
  export interface SwitchProps extends BaseProps, OmitNativeProps<HTMLInputElement, 'onChange'> {
11
14
  /**
12
15
  * Size of `Switch`
@@ -42,7 +45,7 @@ export interface SwitchProps extends BaseProps, OmitNativeProps<HTMLInputElement
42
45
  /**
43
46
  * Callback function called when `Switch` is toggled
44
47
  */
45
- onChange?: (event: MouseEvent, selected: boolean) => void;
48
+ onChange?: (event: MouseEvent | KeyboardEvent, selected: boolean) => void;
46
49
  }
47
50
 
48
51
  /**
@@ -87,9 +90,11 @@ export const Switch = React.forwardRef<HTMLInputElement, SwitchProps>((props, re
87
90
  ['Switch-wrapper--checkedDisabled']: checked && disabled,
88
91
  });
89
92
 
90
- const onChangeHandler = (event: MouseEvent) => {
91
- if (checkedProp === undefined) setChecked(!checked);
92
- if (onChange) onChange(event, !checked);
93
+ const onChangeHandler = (event: MouseEvent | KeyboardEvent) => {
94
+ if (event.type == 'change' || isSpaceKey(event as React.KeyboardEvent<HTMLElement>)) {
95
+ if (checkedProp === undefined) setChecked(!checked);
96
+ if (onChange) onChange(event, !checked);
97
+ }
93
98
  };
94
99
 
95
100
  return (
@@ -105,6 +110,7 @@ export const Switch = React.forwardRef<HTMLInputElement, SwitchProps>((props, re
105
110
  name={name}
106
111
  value={value}
107
112
  className="Switch-input"
113
+ onKeyUp={onChangeHandler}
108
114
  />
109
115
  <span className={SwitchWrapper} />
110
116
  </div>
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import Switch from '../index';
3
3
 
4
4
  // CSF format story
5
- export const defaultSwitch = () => <Switch defaultChecked={true} size="regular" />;
5
+ export const defaultSwitch = () => <Switch aria-label="Default Checked Switch" defaultChecked={true} size="regular" />;
6
6
 
7
7
  export default {
8
8
  title: 'Components/Switch/Default Switch',
@@ -11,6 +11,9 @@ export default {
11
11
  docs: {
12
12
  docPage: {
13
13
  title: 'Switch',
14
+ a11yProps: `
15
+ **aria-label:** Add \`aria-label='Default Checked Switch'\` to describe the action of switch.
16
+ `,
14
17
  },
15
18
  },
16
19
  },
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import Switch from '../index';
3
3
 
4
4
  // CSF format story
5
- export const offState = () => <Switch defaultChecked={false} size="regular" />;
5
+ export const offState = () => <Switch aria-label="Off State Switch" defaultChecked={false} size="regular" />;
6
6
 
7
7
  export default {
8
8
  title: 'Components/Switch/Off State',
@@ -11,6 +11,9 @@ export default {
11
11
  docs: {
12
12
  docPage: {
13
13
  title: 'Switch',
14
+ a11yProps: `
15
+ **aria-label:** Add \`aria-label='Off State Switch'\` to describe the action of switch.
16
+ `,
14
17
  },
15
18
  },
16
19
  },