@dxc-technology/halstack-react 0.0.0-b0616f2 → 0.0.0-b063530
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.
- package/BackgroundColorContext.d.ts +1 -10
- package/BackgroundColorContext.js +5 -22
- package/HalstackContext.d.ts +1274 -6
- package/HalstackContext.js +135 -110
- package/README.md +47 -0
- package/accordion/Accordion.accessibility.test.d.ts +1 -0
- package/accordion/Accordion.accessibility.test.js +71 -0
- package/accordion/Accordion.d.ts +1 -1
- package/accordion/Accordion.js +44 -121
- package/accordion/Accordion.stories.tsx +82 -147
- package/accordion/Accordion.test.d.ts +1 -0
- package/accordion/Accordion.test.js +18 -33
- package/accordion/types.d.ts +6 -17
- package/accordion-group/AccordionGroup.accessibility.test.d.ts +1 -0
- package/accordion-group/AccordionGroup.accessibility.test.js +82 -0
- package/accordion-group/AccordionGroup.d.ts +2 -2
- package/accordion-group/AccordionGroup.js +29 -77
- package/accordion-group/AccordionGroup.stories.tsx +78 -77
- package/accordion-group/AccordionGroup.test.d.ts +1 -0
- package/accordion-group/AccordionGroup.test.js +41 -73
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +31 -0
- package/accordion-group/AccordionGroupContext.d.ts +3 -0
- package/accordion-group/AccordionGroupContext.js +8 -0
- package/accordion-group/types.d.ts +7 -18
- package/action-icon/ActionIcon.accessibility.test.d.ts +1 -0
- package/action-icon/ActionIcon.accessibility.test.js +63 -0
- package/action-icon/ActionIcon.d.ts +4 -0
- package/action-icon/ActionIcon.js +48 -0
- package/action-icon/ActionIcon.stories.tsx +41 -0
- package/action-icon/ActionIcon.test.d.ts +1 -0
- package/action-icon/ActionIcon.test.js +64 -0
- package/action-icon/types.d.ts +26 -0
- package/alert/Alert.accessibility.test.d.ts +1 -0
- package/alert/Alert.accessibility.test.js +95 -0
- package/alert/Alert.js +36 -126
- package/alert/Alert.stories.tsx +28 -0
- package/alert/Alert.test.d.ts +1 -0
- package/alert/Alert.test.js +28 -45
- package/alert/types.d.ts +5 -5
- package/badge/Badge.accessibility.test.d.ts +1 -0
- package/badge/Badge.accessibility.test.js +129 -0
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +142 -42
- package/badge/Badge.stories.tsx +210 -0
- package/badge/Badge.test.d.ts +1 -0
- package/badge/Badge.test.js +30 -0
- package/badge/types.d.ts +52 -3
- package/bar-chart/BarChart.d.ts +4 -0
- package/bar-chart/BarChart.js +152 -0
- package/bar-chart/BarChart.stories.tsx +281 -0
- package/bar-chart/BarChart.test.d.ts +1 -0
- package/bar-chart/BarChart.test.js +194 -0
- package/bar-chart/theme.d.ts +3 -0
- package/bar-chart/theme.js +31 -0
- package/bar-chart/types.d.ts +118 -0
- package/bleed/Bleed.js +13 -21
- package/bleed/Bleed.stories.tsx +1 -1
- package/bleed/types.d.ts +2 -2
- package/box/Box.accessibility.test.d.ts +1 -0
- package/box/Box.accessibility.test.js +33 -0
- package/box/Box.d.ts +1 -1
- package/box/Box.js +18 -59
- package/box/Box.stories.tsx +38 -51
- package/box/Box.test.d.ts +1 -0
- package/box/Box.test.js +1 -6
- package/box/types.d.ts +3 -14
- package/breadcrumbs/Breadcrumbs.accessibility.test.d.ts +1 -0
- package/breadcrumbs/Breadcrumbs.accessibility.test.js +96 -0
- package/breadcrumbs/Breadcrumbs.d.ts +4 -0
- package/breadcrumbs/Breadcrumbs.js +79 -0
- package/breadcrumbs/Breadcrumbs.stories.tsx +194 -0
- package/breadcrumbs/Breadcrumbs.test.d.ts +1 -0
- package/breadcrumbs/Breadcrumbs.test.js +168 -0
- package/breadcrumbs/Item.d.ts +4 -0
- package/breadcrumbs/Item.js +52 -0
- package/breadcrumbs/dropdownTheme.d.ts +53 -0
- package/breadcrumbs/dropdownTheme.js +62 -0
- package/breadcrumbs/types.d.ts +40 -0
- package/bulleted-list/BulletedList.accessibility.test.d.ts +1 -0
- package/bulleted-list/BulletedList.accessibility.test.js +119 -0
- package/bulleted-list/BulletedList.js +22 -53
- package/bulleted-list/BulletedList.stories.tsx +8 -93
- package/bulleted-list/types.d.ts +32 -5
- package/button/Button.accessibility.test.d.ts +1 -0
- package/button/Button.accessibility.test.js +127 -0
- package/button/Button.d.ts +1 -1
- package/button/Button.js +71 -106
- package/button/Button.stories.tsx +143 -101
- package/button/Button.test.d.ts +1 -0
- package/button/Button.test.js +19 -16
- package/button/types.d.ts +9 -5
- package/card/Card.accessibility.test.d.ts +1 -0
- package/card/Card.accessibility.test.js +36 -0
- package/card/Card.d.ts +1 -1
- package/card/Card.js +49 -89
- package/card/Card.stories.tsx +13 -43
- package/card/Card.test.d.ts +1 -0
- package/card/Card.test.js +10 -21
- package/card/types.d.ts +6 -11
- package/checkbox/Checkbox.accessibility.test.d.ts +1 -0
- package/checkbox/Checkbox.accessibility.test.js +87 -0
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +98 -134
- package/checkbox/Checkbox.stories.tsx +128 -94
- package/checkbox/Checkbox.test.d.ts +1 -0
- package/checkbox/Checkbox.test.js +107 -63
- package/checkbox/types.d.ts +11 -3
- package/chip/Chip.accessibility.test.d.ts +1 -0
- package/chip/Chip.accessibility.test.js +67 -0
- package/chip/Chip.js +45 -80
- package/chip/Chip.stories.tsx +103 -27
- package/chip/Chip.test.d.ts +1 -0
- package/chip/Chip.test.js +17 -32
- package/chip/types.d.ts +4 -4
- package/common/coreTokens.d.ts +236 -0
- package/common/coreTokens.js +183 -0
- package/common/utils.d.ts +1 -0
- package/common/utils.js +6 -12
- package/common/variables.d.ts +1432 -0
- package/common/variables.js +1010 -1220
- package/container/Container.d.ts +4 -0
- package/container/Container.js +194 -0
- package/container/Container.stories.tsx +214 -0
- package/container/types.d.ts +176 -0
- package/container/types.js +5 -0
- package/contextual-menu/ContextualMenu.accessibility.test.d.ts +1 -0
- package/contextual-menu/ContextualMenu.accessibility.test.js +98 -0
- package/contextual-menu/ContextualMenu.d.ts +5 -0
- package/contextual-menu/ContextualMenu.js +136 -0
- package/contextual-menu/ContextualMenu.stories.tsx +231 -0
- package/contextual-menu/ContextualMenu.test.d.ts +1 -0
- package/contextual-menu/ContextualMenu.test.js +247 -0
- package/contextual-menu/GroupItem.d.ts +4 -0
- package/contextual-menu/GroupItem.js +67 -0
- package/contextual-menu/ItemAction.d.ts +4 -0
- package/contextual-menu/ItemAction.js +88 -0
- package/contextual-menu/MenuItem.d.ts +4 -0
- package/contextual-menu/MenuItem.js +29 -0
- package/contextual-menu/SingleItem.d.ts +4 -0
- package/contextual-menu/SingleItem.js +38 -0
- package/contextual-menu/types.d.ts +65 -0
- package/contextual-menu/types.js +5 -0
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +230 -0
- package/date-input/DateInput.accessibility.test.d.ts +1 -0
- package/date-input/DateInput.accessibility.test.js +229 -0
- package/date-input/DateInput.js +156 -300
- package/date-input/DateInput.stories.tsx +210 -57
- package/date-input/DateInput.test.d.ts +1 -0
- package/date-input/DateInput.test.js +699 -370
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +121 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +105 -0
- package/date-input/types.d.ts +72 -15
- package/dialog/Dialog.accessibility.test.d.ts +1 -0
- package/dialog/Dialog.accessibility.test.js +69 -0
- package/dialog/Dialog.d.ts +1 -1
- package/dialog/Dialog.js +50 -119
- package/dialog/Dialog.stories.tsx +324 -166
- package/dialog/Dialog.test.d.ts +1 -0
- package/dialog/Dialog.test.js +332 -32
- package/dialog/types.d.ts +18 -25
- package/divider/Divider.accessibility.test.d.ts +1 -0
- package/divider/Divider.accessibility.test.js +33 -0
- package/divider/Divider.d.ts +4 -0
- package/divider/Divider.js +36 -0
- package/divider/Divider.stories.tsx +224 -0
- package/divider/Divider.test.d.ts +1 -0
- package/divider/Divider.test.js +38 -0
- package/divider/types.d.ts +21 -0
- package/divider/types.js +5 -0
- package/dropdown/Dropdown.accessibility.test.d.ts +1 -0
- package/dropdown/Dropdown.accessibility.test.js +183 -0
- package/dropdown/Dropdown.js +93 -160
- package/dropdown/Dropdown.stories.tsx +210 -95
- package/dropdown/Dropdown.test.d.ts +1 -0
- package/dropdown/Dropdown.test.js +450 -413
- package/dropdown/DropdownMenu.js +23 -40
- package/dropdown/DropdownMenuItem.js +18 -39
- package/dropdown/types.d.ts +20 -24
- package/file-input/FileInput.accessibility.test.d.ts +1 -0
- package/file-input/FileInput.accessibility.test.js +167 -0
- package/file-input/FileInput.d.ts +2 -2
- package/file-input/FileInput.js +238 -393
- package/file-input/FileInput.stories.tsx +123 -12
- package/file-input/FileInput.test.d.ts +1 -0
- package/file-input/FileInput.test.js +314 -367
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +56 -117
- package/file-input/types.d.ts +24 -11
- package/flex/Flex.d.ts +1 -1
- package/flex/Flex.js +40 -40
- package/flex/Flex.stories.tsx +35 -26
- package/flex/types.d.ts +84 -8
- package/footer/Footer.accessibility.test.d.ts +1 -0
- package/footer/Footer.accessibility.test.js +125 -0
- package/footer/Footer.d.ts +1 -1
- package/footer/Footer.js +73 -118
- package/footer/Footer.stories.tsx +94 -23
- package/footer/Footer.test.d.ts +1 -0
- package/footer/Footer.test.js +32 -56
- package/footer/Icons.d.ts +3 -2
- package/footer/Icons.js +53 -22
- package/footer/types.d.ts +26 -27
- package/grid/Grid.d.ts +7 -0
- package/grid/Grid.js +76 -0
- package/grid/Grid.stories.tsx +221 -0
- package/grid/types.d.ts +115 -0
- package/grid/types.js +5 -0
- package/header/Header.accessibility.test.d.ts +1 -0
- package/header/Header.accessibility.test.js +94 -0
- package/header/Header.d.ts +4 -3
- package/header/Header.js +55 -150
- package/header/Header.stories.tsx +131 -36
- package/header/Header.test.d.ts +1 -0
- package/header/Header.test.js +12 -25
- package/header/Icons.d.ts +2 -2
- package/header/Icons.js +3 -13
- package/header/types.d.ts +7 -21
- package/heading/Heading.accessibility.test.d.ts +1 -0
- package/heading/Heading.accessibility.test.js +33 -0
- package/heading/Heading.js +10 -32
- package/heading/Heading.test.d.ts +1 -0
- package/heading/Heading.test.js +64 -94
- package/heading/types.d.ts +7 -7
- package/icon/Icon.accessibility.test.d.ts +1 -0
- package/icon/Icon.accessibility.test.js +30 -0
- package/icon/Icon.d.ts +4 -0
- package/icon/Icon.js +33 -0
- package/icon/Icon.stories.tsx +28 -0
- package/icon/types.d.ts +4 -0
- package/icon/types.js +5 -0
- package/image/Image.accessibility.test.d.ts +1 -0
- package/image/Image.accessibility.test.js +56 -0
- package/image/Image.d.ts +4 -0
- package/image/Image.js +70 -0
- package/image/Image.stories.tsx +129 -0
- package/image/types.d.ts +72 -0
- package/image/types.js +5 -0
- package/inset/Inset.js +13 -21
- package/inset/Inset.stories.tsx +2 -1
- package/inset/types.d.ts +2 -2
- package/layout/ApplicationLayout.d.ts +5 -5
- package/layout/ApplicationLayout.js +36 -70
- package/layout/ApplicationLayout.stories.tsx +1 -1
- package/layout/Icons.d.ts +7 -5
- package/layout/Icons.js +41 -59
- package/layout/types.d.ts +5 -6
- package/link/Link.accessibility.test.d.ts +1 -0
- package/link/Link.accessibility.test.js +108 -0
- package/link/Link.js +32 -51
- package/link/Link.stories.tsx +64 -4
- package/link/Link.test.d.ts +1 -0
- package/link/Link.test.js +23 -43
- package/link/types.d.ts +14 -14
- package/main.d.ts +12 -5
- package/main.js +61 -59
- package/nav-tabs/NavTabs.accessibility.test.d.ts +1 -0
- package/nav-tabs/NavTabs.accessibility.test.js +44 -0
- package/nav-tabs/NavTabs.d.ts +7 -0
- package/nav-tabs/NavTabs.js +108 -0
- package/nav-tabs/NavTabs.stories.tsx +294 -0
- package/nav-tabs/NavTabs.test.d.ts +1 -0
- package/nav-tabs/NavTabs.test.js +77 -0
- package/nav-tabs/NavTabsContext.d.ts +3 -0
- package/nav-tabs/NavTabsContext.js +8 -0
- package/nav-tabs/Tab.js +117 -0
- package/{tabs-nav → nav-tabs}/types.d.ts +15 -16
- package/nav-tabs/types.js +5 -0
- package/number-input/NumberInput.accessibility.test.d.ts +1 -0
- package/number-input/NumberInput.accessibility.test.js +227 -0
- package/number-input/NumberInput.js +50 -37
- package/number-input/NumberInput.stories.tsx +37 -26
- package/number-input/NumberInput.test.d.ts +1 -0
- package/number-input/NumberInput.test.js +858 -376
- package/number-input/NumberInputContext.d.ts +3 -4
- package/number-input/NumberInputContext.js +3 -14
- package/number-input/types.d.ts +17 -5
- package/package.json +52 -49
- package/paginator/Paginator.accessibility.test.d.ts +1 -0
- package/paginator/Paginator.accessibility.test.js +78 -0
- package/paginator/Paginator.js +35 -68
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.d.ts +1 -0
- package/paginator/Paginator.test.js +253 -227
- package/paginator/types.d.ts +3 -3
- package/paragraph/Paragraph.accessibility.test.d.ts +1 -0
- package/paragraph/Paragraph.accessibility.test.js +28 -0
- package/paragraph/Paragraph.d.ts +3 -4
- package/paragraph/Paragraph.js +6 -22
- package/paragraph/Paragraph.stories.tsx +0 -17
- package/password-input/PasswordInput.accessibility.test.d.ts +1 -0
- package/password-input/PasswordInput.accessibility.test.js +152 -0
- package/password-input/PasswordInput.js +62 -128
- package/password-input/PasswordInput.stories.tsx +11 -34
- package/password-input/PasswordInput.test.d.ts +1 -0
- package/password-input/PasswordInput.test.js +158 -141
- package/password-input/types.d.ts +8 -7
- package/progress-bar/ProgressBar.accessibility.test.d.ts +1 -0
- package/progress-bar/ProgressBar.accessibility.test.js +35 -0
- package/progress-bar/ProgressBar.d.ts +2 -2
- package/progress-bar/ProgressBar.js +28 -58
- package/progress-bar/{ProgressBar.stories.jsx → ProgressBar.stories.tsx} +36 -3
- package/progress-bar/ProgressBar.test.d.ts +1 -0
- package/progress-bar/ProgressBar.test.js +35 -52
- package/progress-bar/types.d.ts +4 -3
- package/quick-nav/QuickNav.accessibility.test.d.ts +1 -0
- package/quick-nav/QuickNav.accessibility.test.js +57 -0
- package/quick-nav/QuickNav.js +15 -39
- package/quick-nav/QuickNav.stories.tsx +112 -20
- package/quick-nav/types.d.ts +10 -10
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +59 -79
- package/radio-group/RadioGroup.accessibility.test.d.ts +1 -0
- package/radio-group/RadioGroup.accessibility.test.js +97 -0
- package/radio-group/RadioGroup.js +62 -110
- package/radio-group/RadioGroup.stories.tsx +132 -18
- package/radio-group/RadioGroup.test.d.ts +1 -0
- package/radio-group/RadioGroup.test.js +518 -459
- package/radio-group/types.d.ts +10 -10
- package/resultset-table/Icons.d.ts +7 -0
- package/{text-input → resultset-table}/Icons.js +13 -26
- package/resultset-table/ResultsetTable.accessibility.test.d.ts +1 -0
- package/resultset-table/ResultsetTable.accessibility.test.js +284 -0
- package/resultset-table/ResultsetTable.d.ts +7 -0
- package/resultset-table/ResultsetTable.js +195 -0
- package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +169 -31
- package/resultset-table/ResultsetTable.test.d.ts +1 -0
- package/resultset-table/ResultsetTable.test.js +450 -0
- package/{resultsetTable → resultset-table}/types.d.ts +46 -12
- package/resultset-table/types.js +5 -0
- package/select/Listbox.d.ts +1 -1
- package/select/Listbox.js +40 -87
- package/select/Option.js +35 -56
- package/select/Select.accessibility.test.d.ts +1 -0
- package/select/Select.accessibility.test.js +227 -0
- package/select/Select.js +141 -182
- package/select/Select.stories.tsx +505 -204
- package/select/Select.test.d.ts +1 -0
- package/select/Select.test.js +1916 -1923
- package/select/types.d.ts +17 -18
- package/sidenav/Sidenav.accessibility.test.d.ts +1 -0
- package/sidenav/Sidenav.accessibility.test.js +59 -0
- package/sidenav/Sidenav.d.ts +2 -2
- package/sidenav/Sidenav.js +90 -157
- package/sidenav/Sidenav.stories.tsx +161 -64
- package/sidenav/Sidenav.test.d.ts +1 -0
- package/sidenav/Sidenav.test.js +4 -11
- package/{layout → sidenav}/SidenavContext.d.ts +1 -1
- package/{layout → sidenav}/SidenavContext.js +3 -9
- package/sidenav/types.d.ts +33 -30
- package/slider/Slider.accessibility.test.d.ts +1 -0
- package/slider/Slider.accessibility.test.js +103 -0
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +79 -135
- package/slider/Slider.stories.tsx +57 -60
- package/slider/Slider.test.d.ts +1 -0
- package/slider/Slider.test.js +117 -111
- package/slider/types.d.ts +7 -3
- package/spinner/Spinner.accessibility.test.d.ts +1 -0
- package/spinner/Spinner.accessibility.test.js +96 -0
- package/spinner/Spinner.d.ts +1 -1
- package/spinner/Spinner.js +50 -109
- package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +53 -27
- package/spinner/Spinner.test.d.ts +1 -0
- package/spinner/Spinner.test.js +25 -34
- package/spinner/types.d.ts +3 -3
- package/status-light/StatusLight.accessibility.test.d.ts +1 -0
- package/status-light/StatusLight.accessibility.test.js +157 -0
- package/status-light/StatusLight.d.ts +4 -0
- package/status-light/StatusLight.js +51 -0
- package/status-light/StatusLight.stories.tsx +74 -0
- package/status-light/StatusLight.test.d.ts +1 -0
- package/status-light/StatusLight.test.js +25 -0
- package/status-light/types.d.ts +17 -0
- package/status-light/types.js +5 -0
- package/switch/Switch.accessibility.test.d.ts +1 -0
- package/switch/Switch.accessibility.test.js +98 -0
- package/switch/Switch.d.ts +3 -3
- package/switch/Switch.js +112 -152
- package/switch/Switch.stories.tsx +45 -34
- package/switch/Switch.test.d.ts +1 -0
- package/switch/Switch.test.js +69 -101
- package/switch/types.d.ts +8 -3
- package/table/DropdownTheme.js +62 -0
- package/table/Table.accessibility.test.d.ts +1 -0
- package/table/Table.accessibility.test.js +92 -0
- package/table/Table.d.ts +6 -2
- package/table/Table.js +78 -35
- package/table/Table.stories.tsx +663 -0
- package/table/Table.test.d.ts +1 -0
- package/table/Table.test.js +92 -7
- package/table/types.d.ts +34 -6
- package/tabs/Tab.js +28 -46
- package/tabs/Tabs.accessibility.test.d.ts +1 -0
- package/tabs/Tabs.accessibility.test.js +56 -0
- package/tabs/Tabs.js +69 -163
- package/tabs/Tabs.stories.tsx +50 -6
- package/tabs/Tabs.test.d.ts +1 -0
- package/tabs/Tabs.test.js +60 -135
- package/tabs/types.d.ts +21 -21
- package/tag/Tag.accessibility.test.d.ts +1 -0
- package/tag/Tag.accessibility.test.js +69 -0
- package/tag/Tag.js +34 -66
- package/tag/Tag.stories.tsx +19 -9
- package/tag/Tag.test.d.ts +1 -0
- package/tag/Tag.test.js +17 -36
- package/tag/types.d.ts +9 -9
- package/text-input/Suggestion.js +35 -25
- package/text-input/Suggestions.d.ts +1 -1
- package/text-input/Suggestions.js +30 -70
- package/text-input/TextInput.accessibility.test.d.ts +1 -0
- package/text-input/TextInput.accessibility.test.js +320 -0
- package/text-input/TextInput.js +285 -377
- package/text-input/TextInput.stories.tsx +158 -162
- package/text-input/TextInput.test.d.ts +1 -0
- package/text-input/TextInput.test.js +1389 -1347
- package/text-input/types.d.ts +29 -16
- package/textarea/Textarea.accessibility.test.d.ts +1 -0
- package/textarea/Textarea.accessibility.test.js +155 -0
- package/textarea/Textarea.js +67 -109
- package/textarea/Textarea.stories.tsx +174 -0
- package/textarea/Textarea.test.d.ts +1 -0
- package/textarea/Textarea.test.js +151 -182
- package/textarea/types.d.ts +9 -5
- package/toggle-group/ToggleGroup.accessibility.test.d.ts +1 -0
- package/toggle-group/ToggleGroup.accessibility.test.js +107 -0
- package/toggle-group/ToggleGroup.d.ts +2 -2
- package/toggle-group/ToggleGroup.js +92 -108
- package/toggle-group/ToggleGroup.stories.tsx +53 -8
- package/toggle-group/ToggleGroup.test.d.ts +1 -0
- package/toggle-group/ToggleGroup.test.js +68 -87
- package/toggle-group/types.d.ts +28 -19
- package/tooltip/Tooltip.accessibility.test.d.ts +1 -0
- package/tooltip/Tooltip.accessibility.test.js +144 -0
- package/tooltip/Tooltip.d.ts +4 -0
- package/tooltip/Tooltip.js +50 -0
- package/tooltip/Tooltip.stories.tsx +111 -0
- package/tooltip/Tooltip.test.d.ts +1 -0
- package/tooltip/Tooltip.test.js +112 -0
- package/tooltip/types.d.ts +16 -0
- package/tooltip/types.js +5 -0
- package/typography/Typography.accessibility.test.d.ts +1 -0
- package/typography/Typography.accessibility.test.js +339 -0
- package/typography/Typography.d.ts +2 -2
- package/typography/Typography.js +15 -123
- package/typography/Typography.stories.tsx +1 -3
- package/typography/Typography.test.js +23 -0
- package/typography/types.d.ts +1 -1
- package/useTheme.d.ts +1167 -1
- package/useTheme.js +2 -9
- package/useTranslatedLabels.d.ts +95 -1
- package/useTranslatedLabels.js +1 -7
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +98 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +125 -0
- package/wizard/Wizard.accessibility.test.d.ts +1 -0
- package/wizard/Wizard.accessibility.test.js +55 -0
- package/wizard/Wizard.js +29 -75
- package/wizard/Wizard.stories.tsx +40 -1
- package/wizard/Wizard.test.d.ts +1 -0
- package/wizard/Wizard.test.js +53 -80
- package/wizard/types.d.ts +10 -11
- package/card/ice-cream.jpg +0 -0
- package/common/OpenSans.css +0 -81
- package/common/RequiredComponent.js +0 -32
- package/common/fonts/OpenSans-Bold.ttf +0 -0
- package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-Italic.ttf +0 -0
- package/common/fonts/OpenSans-Light.ttf +0 -0
- package/common/fonts/OpenSans-LightItalic.ttf +0 -0
- package/common/fonts/OpenSans-Regular.ttf +0 -0
- package/common/fonts/OpenSans-SemiBold.ttf +0 -0
- package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
- package/number-input/numberInputContextTypes.d.ts +0 -19
- package/paginator/Icons.js +0 -66
- package/resultsetTable/ResultsetTable.d.ts +0 -4
- package/resultsetTable/ResultsetTable.js +0 -254
- package/resultsetTable/ResultsetTable.test.js +0 -348
- package/select/Icons.d.ts +0 -10
- package/select/Icons.js +0 -93
- package/table/Table.stories.jsx +0 -277
- package/tabs-nav/NavTabs.d.ts +0 -8
- package/tabs-nav/NavTabs.js +0 -125
- package/tabs-nav/NavTabs.stories.tsx +0 -170
- package/tabs-nav/NavTabs.test.js +0 -82
- package/tabs-nav/Tab.js +0 -130
- package/text-input/Icons.d.ts +0 -8
- package/textarea/Textarea.stories.jsx +0 -157
- /package/{resultsetTable → action-icon}/types.js +0 -0
- /package/{tabs-nav → bar-chart}/types.js +0 -0
- /package/{number-input/numberInputContextTypes.js → breadcrumbs/types.js} +0 -0
- /package/{tabs-nav → nav-tabs}/Tab.d.ts +0 -0
package/tabs/Tabs.test.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _react = _interopRequireDefault(require("react"));
|
|
6
|
-
|
|
7
5
|
var _react2 = require("@testing-library/react");
|
|
8
|
-
|
|
9
6
|
var _Tabs = _interopRequireDefault(require("./Tabs"));
|
|
10
|
-
|
|
11
7
|
var sampleTabs = [{
|
|
12
8
|
label: "Tab-1"
|
|
13
9
|
}, {
|
|
@@ -17,13 +13,13 @@ var sampleTabs = [{
|
|
|
17
13
|
}];
|
|
18
14
|
var sampleTabsWithBadge = [{
|
|
19
15
|
label: "Tab-1",
|
|
20
|
-
notificationNumber:
|
|
16
|
+
notificationNumber: 10
|
|
21
17
|
}, {
|
|
22
18
|
label: "Tab-2",
|
|
23
|
-
notificationNumber:
|
|
19
|
+
notificationNumber: 20
|
|
24
20
|
}, {
|
|
25
21
|
label: "Tab-3",
|
|
26
|
-
notificationNumber:
|
|
22
|
+
notificationNumber: 101
|
|
27
23
|
}];
|
|
28
24
|
var sampleTabsMiddleDisabled = [{
|
|
29
25
|
label: "Tab-1"
|
|
@@ -45,11 +41,10 @@ var sampleTabsLastTabNonDisabled = [{
|
|
|
45
41
|
describe("Tabs component tests", function () {
|
|
46
42
|
test("Tabs render with correct labels", function () {
|
|
47
43
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
44
|
+
tabs: sampleTabs
|
|
45
|
+
})),
|
|
46
|
+
getByText = _render.getByText,
|
|
47
|
+
getAllByRole = _render.getAllByRole;
|
|
53
48
|
var tabs = getAllByRole("tab");
|
|
54
49
|
expect(getByText("Tab-1")).toBeTruthy();
|
|
55
50
|
expect(getByText("Tab-2")).toBeTruthy();
|
|
@@ -60,82 +55,54 @@ describe("Tabs component tests", function () {
|
|
|
60
55
|
});
|
|
61
56
|
test("Tabs render with correct labels and badges", function () {
|
|
62
57
|
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
tabs: sampleTabsWithBadge
|
|
59
|
+
})),
|
|
60
|
+
getByText = _render2.getByText;
|
|
67
61
|
expect(getByText("10")).toBeTruthy();
|
|
68
62
|
expect(getByText("20")).toBeTruthy();
|
|
69
63
|
expect(getByText("+99")).toBeTruthy();
|
|
70
64
|
});
|
|
71
65
|
test("Tabs render with an initially active tab", function () {
|
|
72
66
|
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
defaultActiveTabIndex: 2,
|
|
68
|
+
tabs: sampleTabsWithBadge
|
|
69
|
+
})),
|
|
70
|
+
getAllByRole = _render3.getAllByRole;
|
|
78
71
|
var tabs = getAllByRole("tab");
|
|
79
72
|
expect(tabs[0].getAttribute("aria-selected")).toBe("false");
|
|
80
73
|
expect(tabs[1].getAttribute("aria-selected")).toBe("false");
|
|
81
74
|
expect(tabs[2].getAttribute("aria-selected")).toBe("true");
|
|
82
75
|
});
|
|
83
|
-
test("Tabs render with correct icons", function () {
|
|
84
|
-
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
|
|
85
|
-
tabs: [{
|
|
86
|
-
label: "Tab-1",
|
|
87
|
-
icon: "/testIcon1.png"
|
|
88
|
-
}, {
|
|
89
|
-
label: "Tab-2",
|
|
90
|
-
icon: "/testIcon2.png"
|
|
91
|
-
}, {
|
|
92
|
-
label: "Tab-3",
|
|
93
|
-
icon: "/testIcon3.png"
|
|
94
|
-
}]
|
|
95
|
-
})),
|
|
96
|
-
getAllByRole = _render4.getAllByRole;
|
|
97
|
-
|
|
98
|
-
expect(getAllByRole("img")[0].getAttribute("src")).toBe("/testIcon1.png");
|
|
99
|
-
expect(getAllByRole("img")[1].getAttribute("src")).toBe("/testIcon2.png");
|
|
100
|
-
expect(getAllByRole("img")[2].getAttribute("src")).toBe("/testIcon3.png");
|
|
101
|
-
});
|
|
102
76
|
test("Tabs render with disabled tab", function () {
|
|
103
|
-
var
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
77
|
+
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
|
|
78
|
+
tabs: [{
|
|
79
|
+
label: "Tab-1",
|
|
80
|
+
isDisabled: true
|
|
81
|
+
}, {
|
|
82
|
+
label: "Tab-2"
|
|
83
|
+
}]
|
|
84
|
+
})),
|
|
85
|
+
getAllByRole = _render4.getAllByRole;
|
|
113
86
|
expect(getAllByRole("tab")[0].hasAttribute("disabled")).toBeTruthy();
|
|
114
87
|
expect(getAllByRole("tab")[1].hasAttribute("disabled")).toBeFalsy();
|
|
115
88
|
});
|
|
116
89
|
test("Uncontrolled tabs", function () {
|
|
117
90
|
var onTabClick = jest.fn();
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
getAllByRole = _render6.getAllByRole;
|
|
125
|
-
|
|
91
|
+
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
|
|
92
|
+
tabs: sampleTabs,
|
|
93
|
+
onTabClick: onTabClick
|
|
94
|
+
})),
|
|
95
|
+
getByText = _render5.getByText,
|
|
96
|
+
getAllByRole = _render5.getAllByRole;
|
|
126
97
|
var tabs = getAllByRole("tab");
|
|
127
98
|
var tab1 = getByText("Tab-1");
|
|
128
99
|
var tab2 = getByText("Tab-2");
|
|
129
|
-
|
|
130
100
|
_react2.fireEvent.click(tab2);
|
|
131
|
-
|
|
132
101
|
expect(onTabClick).toHaveBeenCalledWith(1);
|
|
133
102
|
expect(tabs[0].getAttribute("aria-selected")).toBe("false");
|
|
134
103
|
expect(tabs[1].getAttribute("aria-selected")).toBe("true");
|
|
135
104
|
expect(tabs[2].getAttribute("aria-selected")).toBe("false");
|
|
136
|
-
|
|
137
105
|
_react2.fireEvent.click(tab1);
|
|
138
|
-
|
|
139
106
|
expect(onTabClick).toHaveBeenCalledWith(0);
|
|
140
107
|
expect(tabs[0].getAttribute("aria-selected")).toBe("true");
|
|
141
108
|
expect(tabs[1].getAttribute("aria-selected")).toBe("false");
|
|
@@ -143,26 +110,19 @@ describe("Tabs component tests", function () {
|
|
|
143
110
|
});
|
|
144
111
|
test("Controlled tabs", function () {
|
|
145
112
|
var onTabClick = jest.fn();
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
getByText = _render7.getByText,
|
|
153
|
-
getAllByRole = _render7.getAllByRole;
|
|
154
|
-
|
|
113
|
+
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
|
|
114
|
+
tabs: sampleTabs,
|
|
115
|
+
onTabClick: onTabClick,
|
|
116
|
+
activeTabIndex: 0
|
|
117
|
+
})),
|
|
118
|
+
getAllByRole = _render6.getAllByRole;
|
|
155
119
|
var tabs = getAllByRole("tab");
|
|
156
|
-
|
|
157
120
|
_react2.fireEvent.click(tabs[1]);
|
|
158
|
-
|
|
159
121
|
expect(onTabClick).toHaveBeenCalledWith(1);
|
|
160
122
|
expect(tabs[0].getAttribute("aria-selected")).toBe("true");
|
|
161
123
|
expect(tabs[1].getAttribute("aria-selected")).toBe("false");
|
|
162
124
|
expect(tabs[2].getAttribute("aria-selected")).toBe("false");
|
|
163
|
-
|
|
164
125
|
_react2.fireEvent.click(tabs[2]);
|
|
165
|
-
|
|
166
126
|
expect(onTabClick).toHaveBeenCalledWith(2);
|
|
167
127
|
expect(tabs[0].getAttribute("aria-selected")).toBe("true");
|
|
168
128
|
expect(tabs[1].getAttribute("aria-selected")).toBe("false");
|
|
@@ -170,13 +130,11 @@ describe("Tabs component tests", function () {
|
|
|
170
130
|
});
|
|
171
131
|
test("Uncontrolled tabs should have focus in the first non-disabled tab", function () {
|
|
172
132
|
var onTabClick = jest.fn();
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
getAllByRole = _render8.getAllByRole;
|
|
179
|
-
|
|
133
|
+
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
|
|
134
|
+
tabs: sampleTabsLastTabNonDisabled,
|
|
135
|
+
onTabClick: onTabClick
|
|
136
|
+
})),
|
|
137
|
+
getAllByRole = _render7.getAllByRole;
|
|
180
138
|
var tabs = getAllByRole("tab");
|
|
181
139
|
expect(tabs[0].hasAttribute("disabled")).toBeTruthy();
|
|
182
140
|
expect(tabs[1].hasAttribute("disabled")).toBeTruthy();
|
|
@@ -187,14 +145,12 @@ describe("Tabs component tests", function () {
|
|
|
187
145
|
});
|
|
188
146
|
test("Controlled tabs with active index in disabled tab should not change focus to the first available tab", function () {
|
|
189
147
|
var onTabClick = jest.fn();
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
getAllByRole = _render9.getAllByRole;
|
|
197
|
-
|
|
148
|
+
var _render8 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
|
|
149
|
+
tabs: sampleTabsLastTabNonDisabled,
|
|
150
|
+
onTabClick: onTabClick,
|
|
151
|
+
activeTabIndex: 0
|
|
152
|
+
})),
|
|
153
|
+
getAllByRole = _render8.getAllByRole;
|
|
198
154
|
var tabs = getAllByRole("tab");
|
|
199
155
|
expect(tabs[0].getAttribute("aria-selected")).toBe("true");
|
|
200
156
|
expect(tabs[1].getAttribute("aria-selected")).toBe("false");
|
|
@@ -202,9 +158,7 @@ describe("Tabs component tests", function () {
|
|
|
202
158
|
expect(tabs[0].hasAttribute("disabled")).toBeTruthy();
|
|
203
159
|
expect(tabs[1].hasAttribute("disabled")).toBeTruthy();
|
|
204
160
|
expect(tabs[2].hasAttribute("disabled")).toBeFalsy();
|
|
205
|
-
|
|
206
161
|
_react2.fireEvent.click(tabs[2]);
|
|
207
|
-
|
|
208
162
|
expect(onTabClick).toHaveBeenCalledWith(2);
|
|
209
163
|
expect(tabs[0].getAttribute("aria-selected")).toBe("true");
|
|
210
164
|
expect(tabs[1].getAttribute("aria-selected")).toBe("false");
|
|
@@ -215,99 +169,77 @@ describe("Tabs component tests", function () {
|
|
|
215
169
|
});
|
|
216
170
|
test("Select tabs with keyboard event arrows", function () {
|
|
217
171
|
var onTabClick = jest.fn();
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
getAllByRole = _render10.getAllByRole;
|
|
226
|
-
|
|
172
|
+
var _render9 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
|
|
173
|
+
tabs: sampleTabs,
|
|
174
|
+
onTabClick: onTabClick
|
|
175
|
+
})),
|
|
176
|
+
getByText = _render9.getByText,
|
|
177
|
+
getByRole = _render9.getByRole,
|
|
178
|
+
getAllByRole = _render9.getAllByRole;
|
|
227
179
|
var tabList = getByRole("tablist");
|
|
228
180
|
var tab1 = getByText("Tab-1");
|
|
229
181
|
var tabs = getAllByRole("tab");
|
|
230
|
-
|
|
231
182
|
_react2.fireEvent.click(tab1);
|
|
232
|
-
|
|
233
183
|
expect(tabs[0].getAttribute("aria-selected")).toBe("true");
|
|
234
184
|
expect(tabs[1].getAttribute("aria-selected")).toBe("false");
|
|
235
185
|
expect(tabs[2].getAttribute("aria-selected")).toBe("false");
|
|
236
186
|
expect(onTabClick).toHaveBeenCalledWith(0);
|
|
237
|
-
|
|
238
187
|
_react2.fireEvent.keyDown(tabList, {
|
|
239
188
|
key: "ArrowRight"
|
|
240
189
|
});
|
|
241
|
-
|
|
242
190
|
_react2.fireEvent.keyDown(tabList, {
|
|
243
191
|
key: "Enter"
|
|
244
192
|
});
|
|
245
|
-
|
|
246
193
|
expect(tabs[0].getAttribute("aria-selected")).toBe("false");
|
|
247
194
|
expect(tabs[1].getAttribute("aria-selected")).toBe("true");
|
|
248
195
|
expect(tabs[2].getAttribute("aria-selected")).toBe("false");
|
|
249
196
|
expect(onTabClick).toHaveBeenCalledWith(1);
|
|
250
|
-
|
|
251
197
|
_react2.fireEvent.keyDown(tabList, {
|
|
252
198
|
key: "ArrowRight"
|
|
253
199
|
});
|
|
254
|
-
|
|
255
200
|
_react2.fireEvent.keyDown(tabList, {
|
|
256
201
|
key: "Enter"
|
|
257
202
|
});
|
|
258
|
-
|
|
259
203
|
expect(tabs[0].getAttribute("aria-selected")).toBe("false");
|
|
260
204
|
expect(tabs[1].getAttribute("aria-selected")).toBe("false");
|
|
261
205
|
expect(tabs[2].getAttribute("aria-selected")).toBe("true");
|
|
262
206
|
expect(onTabClick).toHaveBeenCalledWith(2);
|
|
263
|
-
|
|
264
207
|
_react2.fireEvent.keyDown(tabList, {
|
|
265
208
|
key: "ArrowLeft"
|
|
266
209
|
});
|
|
267
|
-
|
|
268
210
|
_react2.fireEvent.keyDown(tabList, {
|
|
269
211
|
key: "Enter"
|
|
270
212
|
});
|
|
271
|
-
|
|
272
213
|
expect(tabs[0].getAttribute("aria-selected")).toBe("false");
|
|
273
214
|
expect(tabs[1].getAttribute("aria-selected")).toBe("true");
|
|
274
215
|
expect(tabs[2].getAttribute("aria-selected")).toBe("false");
|
|
275
216
|
expect(onTabClick).toHaveBeenCalledWith(1);
|
|
276
|
-
|
|
277
217
|
_react2.fireEvent.keyDown(tabList, {
|
|
278
218
|
key: "ArrowLeft"
|
|
279
219
|
});
|
|
280
|
-
|
|
281
220
|
_react2.fireEvent.keyDown(tabList, {
|
|
282
221
|
key: "Enter"
|
|
283
222
|
});
|
|
284
|
-
|
|
285
223
|
expect(tabs[0].getAttribute("aria-selected")).toBe("true");
|
|
286
224
|
expect(tabs[1].getAttribute("aria-selected")).toBe("false");
|
|
287
225
|
expect(tabs[2].getAttribute("aria-selected")).toBe("false");
|
|
288
226
|
expect(onTabClick).toHaveBeenCalledWith(0);
|
|
289
|
-
|
|
290
227
|
_react2.fireEvent.keyDown(tabList, {
|
|
291
228
|
key: "ArrowLeft"
|
|
292
229
|
});
|
|
293
|
-
|
|
294
230
|
_react2.fireEvent.keyDown(tabList, {
|
|
295
231
|
key: "Enter"
|
|
296
232
|
});
|
|
297
|
-
|
|
298
233
|
expect(tabs[0].getAttribute("aria-selected")).toBe("false");
|
|
299
234
|
expect(tabs[1].getAttribute("aria-selected")).toBe("false");
|
|
300
235
|
expect(tabs[2].getAttribute("aria-selected")).toBe("true");
|
|
301
236
|
expect(onTabClick).toHaveBeenCalledWith(2);
|
|
302
|
-
|
|
303
237
|
_react2.fireEvent.keyDown(tabList, {
|
|
304
238
|
key: "ArrowRight"
|
|
305
239
|
});
|
|
306
|
-
|
|
307
240
|
_react2.fireEvent.keyDown(tabList, {
|
|
308
241
|
key: "Enter"
|
|
309
242
|
});
|
|
310
|
-
|
|
311
243
|
expect(tabs[0].getAttribute("aria-selected")).toBe("true");
|
|
312
244
|
expect(tabs[1].getAttribute("aria-selected")).toBe("false");
|
|
313
245
|
expect(tabs[2].getAttribute("aria-selected")).toBe("false");
|
|
@@ -315,34 +247,27 @@ describe("Tabs component tests", function () {
|
|
|
315
247
|
});
|
|
316
248
|
test("Skip disabled tab with keyboard event arrows", function () {
|
|
317
249
|
var onTabClick = jest.fn();
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
getAllByRole = _render11.getAllByRole;
|
|
326
|
-
|
|
250
|
+
var _render10 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tabs["default"], {
|
|
251
|
+
tabs: sampleTabsMiddleDisabled,
|
|
252
|
+
onTabClick: onTabClick
|
|
253
|
+
})),
|
|
254
|
+
getByText = _render10.getByText,
|
|
255
|
+
getByRole = _render10.getByRole,
|
|
256
|
+
getAllByRole = _render10.getAllByRole;
|
|
327
257
|
var tabList = getByRole("tablist");
|
|
328
258
|
var tab1 = getByText("Tab-1");
|
|
329
259
|
var tabs = getAllByRole("tab");
|
|
330
|
-
|
|
331
260
|
_react2.fireEvent.click(tab1);
|
|
332
|
-
|
|
333
261
|
expect(tabs[0].getAttribute("aria-selected")).toBe("true");
|
|
334
262
|
expect(tabs[1].getAttribute("aria-selected")).toBe("false");
|
|
335
263
|
expect(tabs[2].getAttribute("aria-selected")).toBe("false");
|
|
336
264
|
expect(onTabClick).toHaveBeenCalledWith(0);
|
|
337
|
-
|
|
338
265
|
_react2.fireEvent.keyDown(tabList, {
|
|
339
266
|
key: "ArrowRight"
|
|
340
267
|
});
|
|
341
|
-
|
|
342
268
|
_react2.fireEvent.keyDown(tabList, {
|
|
343
269
|
key: " "
|
|
344
270
|
});
|
|
345
|
-
|
|
346
271
|
expect(tabs[0].getAttribute("aria-selected")).toBe("false");
|
|
347
272
|
expect(tabs[1].getAttribute("aria-selected")).toBe("false");
|
|
348
273
|
expect(tabs[2].getAttribute("aria-selected")).toBe("true");
|
package/tabs/types.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
3
|
+
type Margin = {
|
|
4
4
|
top?: Space;
|
|
5
5
|
bottom?: Space;
|
|
6
6
|
left?: Space;
|
|
7
7
|
right?: Space;
|
|
8
8
|
};
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
type SVG = React.ReactNode & React.SVGProps<SVGSVGElement>;
|
|
10
|
+
type TabCommonProps = {
|
|
11
11
|
/**
|
|
12
12
|
* Whether the tab is disabled or not.
|
|
13
13
|
*/
|
|
@@ -21,27 +21,27 @@ declare type TabCommonProps = {
|
|
|
21
21
|
*/
|
|
22
22
|
notificationNumber?: boolean | number;
|
|
23
23
|
};
|
|
24
|
-
export
|
|
24
|
+
export type TabLabelProps = TabCommonProps & {
|
|
25
25
|
/**
|
|
26
26
|
* Tab label.
|
|
27
27
|
*/
|
|
28
28
|
label: string;
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* Material Symbol name or SVG element used as the icon that will be displayed in the tab.
|
|
31
31
|
*/
|
|
32
32
|
icon?: string | SVG;
|
|
33
33
|
};
|
|
34
|
-
export
|
|
34
|
+
export type TabIconProps = TabCommonProps & {
|
|
35
35
|
/**
|
|
36
36
|
* Tab label.
|
|
37
37
|
*/
|
|
38
38
|
label?: string;
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
40
|
+
* Material Symbol name or SVG element used as the icon that will be displayed in the tab.
|
|
41
41
|
*/
|
|
42
42
|
icon: string | SVG;
|
|
43
43
|
};
|
|
44
|
-
export
|
|
44
|
+
export type TabProps = {
|
|
45
45
|
tab: TabLabelProps | TabIconProps;
|
|
46
46
|
active: boolean;
|
|
47
47
|
tabIndex: number;
|
|
@@ -51,15 +51,7 @@ export declare type TabProps = {
|
|
|
51
51
|
onMouseEnter: () => void;
|
|
52
52
|
onMouseLeave: () => void;
|
|
53
53
|
};
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* An array of objects representing the tabs.
|
|
57
|
-
*/
|
|
58
|
-
tabs: (TabLabelProps | TabIconProps)[];
|
|
59
|
-
/**
|
|
60
|
-
* Whether the icon should appear above or to the left of the label.
|
|
61
|
-
*/
|
|
62
|
-
iconPosition?: "top" | "left";
|
|
54
|
+
type Props = {
|
|
63
55
|
/**
|
|
64
56
|
* Initially active tab, only when it is uncontrolled.
|
|
65
57
|
*/
|
|
@@ -69,23 +61,31 @@ declare type Props = {
|
|
|
69
61
|
* uncontrolled and the active tab will be managed internally by the component.
|
|
70
62
|
*/
|
|
71
63
|
activeTabIndex?: number;
|
|
64
|
+
/**
|
|
65
|
+
* An array of objects representing the tabs.
|
|
66
|
+
*/
|
|
67
|
+
tabs: (TabLabelProps | TabIconProps)[];
|
|
68
|
+
/**
|
|
69
|
+
* Whether the icon should appear above or to the left of the label.
|
|
70
|
+
*/
|
|
71
|
+
iconPosition?: "top" | "left";
|
|
72
72
|
/**
|
|
73
73
|
* This function will be called when the user clicks on a tab. The index of the
|
|
74
74
|
* clicked tab will be passed as a parameter.
|
|
75
75
|
*/
|
|
76
|
-
onTabClick?: (
|
|
76
|
+
onTabClick?: (index: number) => void;
|
|
77
77
|
/**
|
|
78
78
|
* This function will be called when the user hovers a tab.The index of the
|
|
79
79
|
* hovered tab will be passed as a parameter.
|
|
80
80
|
*/
|
|
81
|
-
onTabHover?: (
|
|
81
|
+
onTabHover?: (index: number) => void;
|
|
82
82
|
/**
|
|
83
83
|
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
84
84
|
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
85
85
|
*/
|
|
86
86
|
margin?: Space | Margin;
|
|
87
87
|
/**
|
|
88
|
-
* Value of the tabindex
|
|
88
|
+
* Value of the tabindex attribute applied to each tab.
|
|
89
89
|
*/
|
|
90
90
|
tabIndex?: number;
|
|
91
91
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
5
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
var _react2 = require("@testing-library/react");
|
|
8
|
+
var _axeHelper = require("../../test/accessibility/axe-helper.js");
|
|
9
|
+
var _Tag = _interopRequireDefault(require("./Tag"));
|
|
10
|
+
var icon = /*#__PURE__*/_react["default"].createElement("svg", {
|
|
11
|
+
viewBox: "0 0 24 24",
|
|
12
|
+
fill: "currentColor"
|
|
13
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
14
|
+
d: "M0 0h24v24H0z",
|
|
15
|
+
fill: "none"
|
|
16
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
17
|
+
d: "M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"
|
|
18
|
+
}));
|
|
19
|
+
describe("Tag component accessibility tests", function () {
|
|
20
|
+
it("Should not have basic accessibility issues", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
21
|
+
var _render, container, results;
|
|
22
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
23
|
+
while (1) switch (_context.prev = _context.next) {
|
|
24
|
+
case 0:
|
|
25
|
+
_render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tag["default"], {
|
|
26
|
+
label: "tag-test",
|
|
27
|
+
icon: icon,
|
|
28
|
+
iconBgColor: "#fabada",
|
|
29
|
+
margin: "medium",
|
|
30
|
+
size: "medium",
|
|
31
|
+
labelPosition: "before"
|
|
32
|
+
})), container = _render.container;
|
|
33
|
+
_context.next = 3;
|
|
34
|
+
return (0, _axeHelper.axe)(container);
|
|
35
|
+
case 3:
|
|
36
|
+
results = _context.sent;
|
|
37
|
+
expect(results).toHaveNoViolations();
|
|
38
|
+
case 5:
|
|
39
|
+
case "end":
|
|
40
|
+
return _context.stop();
|
|
41
|
+
}
|
|
42
|
+
}, _callee);
|
|
43
|
+
})));
|
|
44
|
+
it("Should not have basic accessibility issues for new-window mode", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
45
|
+
var _render2, container, results;
|
|
46
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
47
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
48
|
+
case 0:
|
|
49
|
+
_render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tag["default"], {
|
|
50
|
+
label: "tag-test",
|
|
51
|
+
icon: icon,
|
|
52
|
+
iconBgColor: "#fabada",
|
|
53
|
+
margin: "medium",
|
|
54
|
+
size: "medium",
|
|
55
|
+
labelPosition: "before",
|
|
56
|
+
newWindow: true
|
|
57
|
+
})), container = _render2.container;
|
|
58
|
+
_context2.next = 3;
|
|
59
|
+
return (0, _axeHelper.axe)(container);
|
|
60
|
+
case 3:
|
|
61
|
+
results = _context2.sent;
|
|
62
|
+
expect(results).toHaveNoViolations();
|
|
63
|
+
case 5:
|
|
64
|
+
case "end":
|
|
65
|
+
return _context2.stop();
|
|
66
|
+
}
|
|
67
|
+
}, _callee2);
|
|
68
|
+
})));
|
|
69
|
+
});
|