@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
@@ -3,6 +3,7 @@ import { select, boolean } from '@storybook/addon-knobs';
3
3
  import { action } from '@storybook/addon-actions';
4
4
  import { updateKnob } from '@/utils/storybookEventEmitter';
5
5
  import Switch from '../index';
6
+ import { Label } from '@/index';
6
7
 
7
8
  // CSF format story
8
9
  export const all = () => {
@@ -18,13 +19,35 @@ export const all = () => {
18
19
  };
19
20
 
20
21
  return (
21
- <div>
22
- <Switch disabled={disabled} checked={checked} size={size} onChange={onChangeHandler} />
23
- </div>
22
+ <form>
23
+ <Label htmlFor="vaccination-status">Have you been vaccinated ?</Label>
24
+ <div>
25
+ <Switch id="vaccination-status" disabled={disabled} checked={checked} size={size} onChange={onChangeHandler} />
26
+ </div>
27
+ </form>
24
28
  );
25
29
  };
26
30
 
27
31
  export default {
28
32
  title: 'Components/Switch/All',
29
33
  component: Switch,
34
+ parameters: {
35
+ docs: {
36
+ docPage: {
37
+ a11yProps: `
38
+ **htmlFor:**
39
+ <br/>
40
+ -Add \`htmlFor='vaccination-status'\` to label to programmatically associated it with switch
41
+ which has \`id='vaccination-status'\`.
42
+ <br/>
43
+ -This means that,a screen reader will read out the label when the user is focused on the switch,
44
+ making it easier for an assistive technology user to understand
45
+ what data should be entered.
46
+ <br/>
47
+ -When a user clicks or touches/taps a label, the browser passes the focus to its associated switch. That increased hit
48
+ area for focusing the input provides an advantage to anyone trying to activate it.
49
+ `,
50
+ },
51
+ },
52
+ },
30
53
  };
@@ -12,7 +12,7 @@ export const size = () => {
12
12
  return (
13
13
  <div key={ind} className="mr-9">
14
14
  <div className="h-50">
15
- <Switch defaultChecked={true} size={SwitchSize} />
15
+ <Switch aria-label={`Switch ${SwitchSize}`} defaultChecked={true} size={SwitchSize} />
16
16
  </div>
17
17
  <br />
18
18
  <Text weight="strong">{SwitchSize.charAt(0).toUpperCase() + SwitchSize.slice(1)}</Text>
@@ -30,6 +30,15 @@ export default {
30
30
  docs: {
31
31
  docPage: {
32
32
  title: 'Switch',
33
+ a11yProps: `
34
+ **aria-label:**
35
+ <br/>
36
+ - Add \`aria-label='Switch tiny'\` on switch with *Tiny* text to describe the action of switch.
37
+ <br/>
38
+ - Add \`aria-label='Switch regular'\` on switch with *regular* text to describe the action of switch.
39
+ <br/>
40
+ - Add \`aria-label='Switch large'\` on switch with *Large* text to describe the action of switch.
41
+ `,
33
42
  },
34
43
  },
35
44
  },
@@ -7,12 +7,12 @@ export const state = () => {
7
7
  return (
8
8
  <div className="d-flex">
9
9
  <div className="mr-9">
10
- <Switch defaultChecked={true} disabled={false} />
10
+ <Switch aria-label="Switch enabled" defaultChecked={true} disabled={false} />
11
11
  <br />
12
12
  <Text weight="strong">Enabled</Text>
13
13
  </div>
14
14
  <div>
15
- <Switch disabled={true} defaultChecked={true} />
15
+ <Switch aria-label="Switch disabled" disabled={true} defaultChecked={true} />
16
16
  <br />
17
17
  <Text weight="strong">Disabled</Text>
18
18
  </div>
@@ -27,6 +27,13 @@ export default {
27
27
  docs: {
28
28
  docPage: {
29
29
  title: 'Switch',
30
+ a11yProps: `
31
+ **aria-label:**
32
+ <br/>
33
+ - Add \`aria-label='Switch enabled'\` on switch with *Enabled* text to describe the action of switch.
34
+ <br/>
35
+ - Add \`aria-label='Switch disabled'\` on switch with *Disabled* text to describe the action of switch.
36
+ `,
30
37
  },
31
38
  },
32
39
  },
@@ -6,15 +6,19 @@ export const textareaWithCaption = () => {
6
6
 
7
7
  return (
8
8
  <>
9
- <Label withInput={true}>Confirmation Notes</Label>
9
+ <Label withInput={true} htmlFor="notes">
10
+ Confirmation Notes
11
+ </Label>
10
12
  <Textarea
11
- name="Textarea"
13
+ name="notes"
12
14
  className="w-50"
13
15
  value={value}
14
16
  onChange={(e) => {
15
17
  setValue(e.target.value);
16
18
  }}
17
19
  placeholder="Enter your comments here"
20
+ aria-labelledby="Confirmation Notes"
21
+ id="notes"
18
22
  />
19
23
  <Caption withInput={true}>This note will be automatically pinned for export.</Caption>
20
24
  </>
@@ -26,13 +30,15 @@ const customCode = `() => {
26
30
 
27
31
  return (
28
32
  <>
29
- <Label withInput={true}>Confirmation Notes</Label>
33
+ <Label withInput={true} htmlFor="notes">Confirmation Notes</Label>
30
34
  <Textarea
31
35
  name="Textarea"
32
36
  className="w-50"
33
37
  value={value}
34
38
  onChange={e => { setValue(e.target.value); }}
35
39
  placeholder="Enter your comments here"
40
+ aria-labelledby="Confirmation Notes"
41
+ id="notes"
36
42
  />
37
43
  <Caption withInput={true}>This note will be automatically pinned for export.</Caption>
38
44
  </>
@@ -3,8 +3,16 @@ import { Textarea, Label } from '@/index';
3
3
 
4
4
  export const defaultTextarea = () => (
5
5
  <>
6
- <Label withInput={true}>Comments</Label>
7
- <Textarea name="Textarea" className="w-25" placeholder="Enter your comments here" />
6
+ <Label withInput={true} htmlFor="comments">
7
+ Comments
8
+ </Label>
9
+ <Textarea
10
+ name="comments"
11
+ id="comments"
12
+ aria-labelledby="Comments"
13
+ className="w-25"
14
+ placeholder="Enter your comments here"
15
+ />
8
16
  </>
9
17
  );
10
18
 
@@ -29,6 +29,7 @@ export const all = () => {
29
29
  error={error}
30
30
  resize={resize}
31
31
  rows={rows}
32
+ aria-labelledby="Textarea"
32
33
  />
33
34
  </div>
34
35
  );
@@ -24,6 +24,7 @@ export const Disable = () => {
24
24
  placeholder="Placeholder"
25
25
  disabled={value}
26
26
  rows={3}
27
+ aria-labelledby="Textarea"
27
28
  />
28
29
  </div>
29
30
  <Text weight="strong">{value ? 'Disabled' : 'Enabled'}</Text>
@@ -28,7 +28,9 @@ exports[`Toast component
28
28
  </h5>
29
29
  <i
30
30
  class="material-icons material-icons-round Icon Icon--white Toast-icon Toast-icon--right Toast-icon--alert"
31
+ role="button"
31
32
  style="font-size: 16px; width: 16px;"
33
+ tabindex="0"
32
34
  >
33
35
  close_round
34
36
  </i>
@@ -61,7 +63,9 @@ exports[`Toast component
61
63
  </h5>
62
64
  <i
63
65
  class="material-icons material-icons-round Icon Icon--white Toast-icon Toast-icon--right Toast-icon--default"
66
+ role="button"
64
67
  style="font-size: 16px; width: 16px;"
68
+ tabindex="0"
65
69
  >
66
70
  close_round
67
71
  </i>
@@ -100,7 +104,9 @@ exports[`Toast component
100
104
  </h5>
101
105
  <i
102
106
  class="material-icons material-icons-round Icon Icon--white Toast-icon Toast-icon--right Toast-icon--info"
107
+ role="button"
103
108
  style="font-size: 16px; width: 16px;"
109
+ tabindex="0"
104
110
  >
105
111
  close_round
106
112
  </i>
@@ -139,7 +145,9 @@ exports[`Toast component
139
145
  </h5>
140
146
  <i
141
147
  class="material-icons material-icons-round Icon Icon--white Toast-icon Toast-icon--right Toast-icon--success"
148
+ role="button"
142
149
  style="font-size: 16px; width: 16px;"
150
+ tabindex="0"
143
151
  >
144
152
  close_round
145
153
  </i>
@@ -178,7 +186,9 @@ exports[`Toast component
178
186
  </h5>
179
187
  <i
180
188
  class="material-icons material-icons-round Icon Icon--default Toast-icon Toast-icon--right Toast-icon--warning"
189
+ role="button"
181
190
  style="font-size: 16px; width: 16px;"
191
+ tabindex="0"
182
192
  >
183
193
  close_round
184
194
  </i>
@@ -217,7 +227,9 @@ exports[`Toast component
217
227
  </h5>
218
228
  <i
219
229
  class="material-icons material-icons-round Icon Icon--white Toast-icon Toast-icon--right Toast-icon--alert"
230
+ role="button"
220
231
  style="font-size: 16px; width: 16px;"
232
+ tabindex="0"
221
233
  >
222
234
  close_round
223
235
  </i>
@@ -262,7 +274,9 @@ exports[`Toast component
262
274
  </h5>
263
275
  <i
264
276
  class="material-icons material-icons-round Icon Icon--white Toast-icon Toast-icon--right Toast-icon--alert"
277
+ role="button"
265
278
  style="font-size: 16px; width: 16px;"
279
+ tabindex="0"
266
280
  >
267
281
  close_round
268
282
  </i>
@@ -315,7 +329,9 @@ exports[`Toast component
315
329
  </h5>
316
330
  <i
317
331
  class="material-icons material-icons-round Icon Icon--white Toast-icon Toast-icon--right Toast-icon--default"
332
+ role="button"
318
333
  style="font-size: 16px; width: 16px;"
334
+ tabindex="0"
319
335
  >
320
336
  close_round
321
337
  </i>
@@ -354,7 +370,9 @@ exports[`Toast component
354
370
  </h5>
355
371
  <i
356
372
  class="material-icons material-icons-round Icon Icon--white Toast-icon Toast-icon--right Toast-icon--default"
373
+ role="button"
357
374
  style="font-size: 16px; width: 16px;"
375
+ tabindex="0"
358
376
  >
359
377
  close_round
360
378
  </i>
@@ -413,7 +431,9 @@ exports[`Toast component
413
431
  </h5>
414
432
  <i
415
433
  class="material-icons material-icons-round Icon Icon--white Toast-icon Toast-icon--right Toast-icon--info"
434
+ role="button"
416
435
  style="font-size: 16px; width: 16px;"
436
+ tabindex="0"
417
437
  >
418
438
  close_round
419
439
  </i>
@@ -458,7 +478,9 @@ exports[`Toast component
458
478
  </h5>
459
479
  <i
460
480
  class="material-icons material-icons-round Icon Icon--white Toast-icon Toast-icon--right Toast-icon--info"
481
+ role="button"
461
482
  style="font-size: 16px; width: 16px;"
483
+ tabindex="0"
462
484
  >
463
485
  close_round
464
486
  </i>
@@ -517,7 +539,9 @@ exports[`Toast component
517
539
  </h5>
518
540
  <i
519
541
  class="material-icons material-icons-round Icon Icon--white Toast-icon Toast-icon--right Toast-icon--success"
542
+ role="button"
520
543
  style="font-size: 16px; width: 16px;"
544
+ tabindex="0"
521
545
  >
522
546
  close_round
523
547
  </i>
@@ -562,7 +586,9 @@ exports[`Toast component
562
586
  </h5>
563
587
  <i
564
588
  class="material-icons material-icons-round Icon Icon--white Toast-icon Toast-icon--right Toast-icon--success"
589
+ role="button"
565
590
  style="font-size: 16px; width: 16px;"
591
+ tabindex="0"
566
592
  >
567
593
  close_round
568
594
  </i>
@@ -621,7 +647,9 @@ exports[`Toast component
621
647
  </h5>
622
648
  <i
623
649
  class="material-icons material-icons-round Icon Icon--default Toast-icon Toast-icon--right Toast-icon--warning"
650
+ role="button"
624
651
  style="font-size: 16px; width: 16px;"
652
+ tabindex="0"
625
653
  >
626
654
  close_round
627
655
  </i>
@@ -666,7 +694,9 @@ exports[`Toast component
666
694
  </h5>
667
695
  <i
668
696
  class="material-icons material-icons-round Icon Icon--default Toast-icon Toast-icon--right Toast-icon--warning"
697
+ role="button"
669
698
  style="font-size: 16px; width: 16px;"
699
+ tabindex="0"
670
700
  >
671
701
  close_round
672
702
  </i>
@@ -86,7 +86,7 @@ export const align = () => {
86
86
  };
87
87
 
88
88
  export default {
89
- title: 'Others/Utilities/Align',
89
+ title: 'Others/Styles/Align',
90
90
  component: align,
91
91
  parameters: {
92
92
  viewMode: 'story',
@@ -111,7 +111,7 @@ export const background = () => {
111
111
  };
112
112
 
113
113
  export default {
114
- title: 'Others/Utilities/Background',
114
+ title: 'Others/Styles/Background',
115
115
  component: background,
116
116
  parameters: {
117
117
  viewMode: 'story',
@@ -116,7 +116,7 @@ export const border = () => {
116
116
  };
117
117
 
118
118
  export default {
119
- title: 'Others/Utilities/Border',
119
+ title: 'Others/Styles/Border',
120
120
  component: border,
121
121
  parameters: {
122
122
  viewMode: 'story',
@@ -103,7 +103,7 @@ export const display = () => {
103
103
  };
104
104
 
105
105
  export default {
106
- title: 'Others/Utilities/Display',
106
+ title: 'Others/Styles/Display',
107
107
  component: display,
108
108
  parameters: {
109
109
  viewMode: 'story',
@@ -294,7 +294,7 @@ export const flex = () => {
294
294
  };
295
295
 
296
296
  export default {
297
- title: 'Others/Utilities/Flex',
297
+ title: 'Others/Styles/Flex',
298
298
  component: flex,
299
299
  parameters: {
300
300
  viewMode: 'story',
@@ -43,7 +43,7 @@ export const miscellaneous = () => {
43
43
  };
44
44
 
45
45
  export default {
46
- title: 'Others/Utilities/Miscellaneous',
46
+ title: 'Others/Styles/Miscellaneous',
47
47
  component: miscellaneous,
48
48
  parameters: {
49
49
  viewMode: 'story',
@@ -74,7 +74,7 @@ export const overflow = () => {
74
74
  };
75
75
 
76
76
  export default {
77
- title: 'Others/Utilities/Overflow',
77
+ title: 'Others/Styles/Overflow',
78
78
  component: overflow,
79
79
  parameters: {
80
80
  viewMode: 'story',
@@ -66,7 +66,7 @@ export const position = () => {
66
66
  };
67
67
 
68
68
  export default {
69
- title: 'Others/Utilities/Position',
69
+ title: 'Others/Styles/Position',
70
70
  component: position,
71
71
  parameters: {
72
72
  viewMode: 'story',
@@ -150,7 +150,7 @@ export const sizing = () => {
150
150
  };
151
151
 
152
152
  export default {
153
- title: 'Others/Utilities/Sizing',
153
+ title: 'Others/Styles/Sizing',
154
154
  component: sizing,
155
155
  parameters: {
156
156
  viewMode: 'story',
@@ -105,7 +105,7 @@ export const spacing = () => {
105
105
  };
106
106
 
107
107
  export default {
108
- title: 'Others/Utilities/Spacing',
108
+ title: 'Others/Styles/Spacing',
109
109
  component: spacing,
110
110
  parameters: {
111
111
  viewMode: 'story',
@@ -33,11 +33,14 @@ export const Box = (props: InternalBoxProps) => {
33
33
  className
34
34
  );
35
35
 
36
+ /* TODO(a11y): fix accessibility */
37
+ /* eslint-disable */
36
38
  return (
37
39
  <div {...baseProps} className={MessageClass} onClick={onClick} data-test="DesignSystem-ChatMessage--Box">
38
40
  {children}
39
41
  </div>
40
42
  );
43
+ /* eslint-enable */
41
44
  };
42
45
 
43
46
  Box.displayName = 'Box';
@@ -190,6 +190,8 @@ export const ChipInput = (props: ChipInputProps) => {
190
190
  });
191
191
 
192
192
  return (
193
+ /* TODO(a11y): fix accessibility */
194
+ /* eslint-disable */
193
195
  <div data-test="DesignSystem-ChipInput" {...baseProps} className={ChipInputClass} onClick={onClickHandler}>
194
196
  <div className="ChipInput-wrapper">
195
197
  {chips && chips.length > 0 && chipComponents}
@@ -206,6 +208,7 @@ export const ChipInput = (props: ChipInputProps) => {
206
208
  onChange={onInputChangeHandler}
207
209
  onKeyDown={onKeyDownHandler}
208
210
  />
211
+ {/* eslint-enable */}
209
212
  </div>
210
213
  {chips.length > 0 && (
211
214
  <Icon
@@ -25,7 +25,9 @@ exports[`ChipInput component
25
25
  <i
26
26
  class="material-icons material-icons-round Icon Icon--subtle Chip-icon Chip-icon--right cursor-pointer"
27
27
  data-test="DesignSystem-GenericChip--clearButton"
28
+ role="button"
28
29
  style="font-size: 16px; width: 16px;"
30
+ tabindex="0"
29
31
  >
30
32
  clear_round
31
33
  </i>
@@ -43,7 +45,9 @@ exports[`ChipInput component
43
45
  <i
44
46
  class="material-icons material-icons-round Icon Icon--subtle Chip-icon Chip-icon--right cursor-pointer"
45
47
  data-test="DesignSystem-GenericChip--clearButton"
48
+ role="button"
46
49
  style="font-size: 16px; width: 16px;"
50
+ tabindex="0"
47
51
  >
48
52
  clear_round
49
53
  </i>
@@ -58,7 +62,9 @@ exports[`ChipInput component
58
62
  <i
59
63
  class="material-icons material-icons-round Icon Icon--subtle ChipInput-icon"
60
64
  data-test="DesignSystem-ChipInput--Icon"
65
+ role="button"
61
66
  style="font-size: 16px; width: 16px;"
67
+ tabindex="0"
62
68
  >
63
69
  close_round
64
70
  </i>
@@ -92,7 +98,9 @@ exports[`ChipInput component
92
98
  <i
93
99
  class="material-icons material-icons-round Icon Icon--disabled Chip-icon Chip-icon--right"
94
100
  data-test="DesignSystem-GenericChip--clearButton"
101
+ role="button"
95
102
  style="font-size: 16px; width: 16px;"
103
+ tabindex="0"
96
104
  >
97
105
  clear_round
98
106
  </i>
@@ -110,7 +118,9 @@ exports[`ChipInput component
110
118
  <i
111
119
  class="material-icons material-icons-round Icon Icon--disabled Chip-icon Chip-icon--right"
112
120
  data-test="DesignSystem-GenericChip--clearButton"
121
+ role="button"
113
122
  style="font-size: 16px; width: 16px;"
123
+ tabindex="0"
114
124
  >
115
125
  clear_round
116
126
  </i>
@@ -126,7 +136,9 @@ exports[`ChipInput component
126
136
  <i
127
137
  class="material-icons material-icons-round Icon Icon--subtle ChipInput-icon"
128
138
  data-test="DesignSystem-ChipInput--Icon"
139
+ role="button"
129
140
  style="font-size: 16px; width: 16px;"
141
+ tabindex="0"
130
142
  >
131
143
  close_round
132
144
  </i>
@@ -70,6 +70,8 @@ export const Dropzone = (props: DropzoneProps) => {
70
70
  <Text size="large" weight="strong" className="mr-2" appearance={disabled ? 'disabled' : 'default'}>
71
71
  Drag your files here or
72
72
  </Text>
73
+ {/* TODO(a11y): fix accessibility */}
74
+ {/* eslint-disable */}
73
75
  <span className="cursor-pointer" onClick={open}>
74
76
  <Text size="large" weight="strong" appearance={disabled ? 'disabled' : 'link'}>
75
77
  browse files
@@ -77,6 +79,7 @@ export const Dropzone = (props: DropzoneProps) => {
77
79
  </span>
78
80
  <input {...getInputProps()} />
79
81
  </span>
82
+ {/* eslint-enable */}
80
83
  {formatLabel && <Text appearance={disabled ? 'disabled' : 'subtle'}>{formatLabel}</Text>}
81
84
  {sizeLabel && <Text appearance={disabled ? 'disabled' : 'subtle'}>{sizeLabel}</Text>}
82
85
  {sampleFileLink && <div className="mt-5">{sampleFileLink}</div>}
@@ -16,7 +16,7 @@ export const COMMON_MIME_TYPES = new Map([
16
16
 
17
17
  const FILES_TO_IGNORE = ['.DS_Store', 'Thumbs.db'];
18
18
 
19
- interface FileArray extends Array<FileValue> {}
19
+ type FileArray = Array<FileValue>;
20
20
 
21
21
  type FileValue = FileWithPath | FileArray[];
22
22
 
@@ -87,13 +87,17 @@ export const EditableChipInput = (props: EditableChipInputProps) => {
87
87
 
88
88
  const onChangeHandler = (eventType: string) => {
89
89
  switch (eventType) {
90
- case 'edit':
90
+ case 'edit': {
91
91
  setShowComponent(true);
92
- case 'hover':
93
- return;
94
- case 'default':
92
+ break;
93
+ }
94
+ case 'hover': {
95
+ break;
96
+ }
97
+ case 'default': {
95
98
  setShowComponent(false);
96
- return;
99
+ break;
100
+ }
97
101
  }
98
102
  };
99
103
 
@@ -26,7 +26,7 @@ export const uncontrolled = () => {
26
26
  };
27
27
 
28
28
  const customCode = `() => {
29
- const onClick = (item) => console.log(\`\onClick: \${item}\`);
29
+ const onClick = (item) => console.log(\`onClick: \${item}\`);
30
30
  const chipOptions = { onClick, clearButton: true };
31
31
  const chipInputOptions = {
32
32
  chipOptions,
@@ -32,7 +32,9 @@ exports[`EditableChipInput component
32
32
  <i
33
33
  class="material-icons material-icons-round Icon Icon--subtle Chip-icon Chip-icon--right cursor-pointer"
34
34
  data-test="DesignSystem-GenericChip--clearButton"
35
+ role="button"
35
36
  style="font-size: 16px; width: 16px;"
37
+ tabindex="0"
36
38
  >
37
39
  clear_round
38
40
  </i>
@@ -50,7 +52,9 @@ exports[`EditableChipInput component
50
52
  <i
51
53
  class="material-icons material-icons-round Icon Icon--subtle Chip-icon Chip-icon--right cursor-pointer"
52
54
  data-test="DesignSystem-GenericChip--clearButton"
55
+ role="button"
53
56
  style="font-size: 16px; width: 16px;"
57
+ tabindex="0"
54
58
  >
55
59
  clear_round
56
60
  </i>
@@ -94,7 +98,9 @@ exports[`EditableChipInput component
94
98
  <i
95
99
  class="material-icons material-icons-round Icon Icon--subtle Chip-icon Chip-icon--right cursor-pointer"
96
100
  data-test="DesignSystem-GenericChip--clearButton"
101
+ role="button"
97
102
  style="font-size: 16px; width: 16px;"
103
+ tabindex="0"
98
104
  >
99
105
  clear_round
100
106
  </i>
@@ -112,7 +118,9 @@ exports[`EditableChipInput component
112
118
  <i
113
119
  class="material-icons material-icons-round Icon Icon--subtle Chip-icon Chip-icon--right cursor-pointer"
114
120
  data-test="DesignSystem-GenericChip--clearButton"
121
+ role="button"
115
122
  style="font-size: 16px; width: 16px;"
123
+ tabindex="0"
116
124
  >
117
125
  clear_round
118
126
  </i>
@@ -57,12 +57,12 @@ export const EditableDropdown = (props: EditableDropdownProps) => {
57
57
  switch (eventType) {
58
58
  case 'edit':
59
59
  setEditing(true);
60
+ break;
60
61
  case 'hover':
61
62
  setShowComponent(true);
62
- return;
63
+ break;
63
64
  case 'default':
64
65
  setShowComponent(false);
65
- return;
66
66
  }
67
67
  };
68
68