@dxc-technology/halstack-react 0.0.0-75e96c6 → 0.0.0-75f9c22
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 +10 -0
- package/BackgroundColorContext.js +35 -0
- package/HalstackContext.d.ts +1353 -0
- package/HalstackContext.js +310 -0
- package/README.md +28 -47
- package/accordion/Accordion.d.ts +4 -0
- package/accordion/Accordion.js +185 -0
- package/accordion/Accordion.stories.tsx +283 -0
- package/accordion/Accordion.test.js +56 -0
- package/accordion/types.d.ts +57 -0
- package/accordion/types.js +5 -0
- package/accordion-group/AccordionGroup.d.ts +8 -0
- package/accordion-group/AccordionGroup.js +101 -0
- package/accordion-group/AccordionGroup.stories.tsx +252 -0
- package/accordion-group/AccordionGroup.test.js +98 -0
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +31 -0
- package/accordion-group/types.d.ts +67 -0
- package/accordion-group/types.js +5 -0
- package/alert/Alert.d.ts +4 -0
- package/alert/Alert.js +257 -0
- package/alert/Alert.stories.tsx +198 -0
- package/alert/Alert.test.js +75 -0
- package/alert/types.d.ts +49 -0
- package/alert/types.js +5 -0
- package/badge/Badge.d.ts +4 -0
- package/badge/Badge.js +48 -0
- package/badge/types.d.ts +5 -0
- package/badge/types.js +5 -0
- package/bleed/Bleed.d.ts +3 -0
- package/bleed/Bleed.js +43 -0
- package/bleed/Bleed.stories.tsx +342 -0
- package/bleed/types.d.ts +37 -0
- package/bleed/types.js +5 -0
- package/box/Box.d.ts +4 -0
- package/box/Box.js +78 -0
- package/box/Box.stories.tsx +119 -0
- package/box/Box.test.js +13 -0
- package/box/types.d.ts +32 -0
- package/box/types.js +5 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +99 -0
- package/bulleted-list/BulletedList.stories.tsx +116 -0
- package/bulleted-list/types.d.ts +38 -0
- package/bulleted-list/types.js +5 -0
- package/button/Button.d.ts +4 -0
- package/button/Button.js +121 -0
- package/button/Button.stories.tsx +344 -0
- package/button/Button.test.js +36 -0
- package/button/types.d.ts +57 -0
- package/button/types.js +5 -0
- package/card/Card.d.ts +4 -0
- package/card/Card.js +120 -0
- package/card/Card.stories.tsx +171 -0
- package/card/Card.test.js +39 -0
- package/card/types.d.ts +62 -0
- package/card/types.js +5 -0
- package/checkbox/Checkbox.d.ts +4 -0
- package/checkbox/Checkbox.js +220 -0
- package/checkbox/Checkbox.stories.tsx +222 -0
- package/checkbox/Checkbox.test.js +199 -0
- package/checkbox/types.d.ts +72 -0
- package/checkbox/types.js +5 -0
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +121 -0
- package/chip/Chip.stories.tsx +214 -0
- package/chip/Chip.test.js +41 -0
- package/chip/types.d.ts +45 -0
- package/chip/types.js +5 -0
- package/common/OpenSans.css +69 -0
- package/common/coreTokens.d.ts +237 -0
- package/common/coreTokens.js +184 -0
- package/common/utils.d.ts +1 -0
- package/{dist/common → common}/utils.js +6 -12
- package/common/variables.d.ts +1499 -0
- package/common/variables.js +1371 -0
- package/container/Container.d.ts +4 -0
- package/container/Container.js +198 -0
- package/container/Container.stories.tsx +229 -0
- package/container/types.d.ts +74 -0
- package/container/types.js +5 -0
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +214 -0
- package/date-input/DateInput.d.ts +4 -0
- package/date-input/DateInput.js +223 -0
- package/date-input/DateInput.stories.tsx +285 -0
- package/date-input/DateInput.test.js +808 -0
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +115 -0
- package/date-input/Icons.d.ts +6 -0
- package/date-input/Icons.js +58 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +100 -0
- package/date-input/types.d.ts +164 -0
- package/date-input/types.js +5 -0
- package/dialog/Dialog.d.ts +4 -0
- package/dialog/Dialog.js +107 -0
- package/dialog/Dialog.stories.tsx +195 -0
- package/dialog/Dialog.test.js +307 -0
- package/dialog/types.d.ts +36 -0
- package/dialog/types.js +5 -0
- package/dropdown/Dropdown.d.ts +4 -0
- package/dropdown/Dropdown.js +334 -0
- package/dropdown/Dropdown.stories.tsx +438 -0
- package/dropdown/Dropdown.test.js +599 -0
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +63 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +67 -0
- package/dropdown/types.d.ts +98 -0
- package/dropdown/types.js +5 -0
- package/file-input/FileInput.d.ts +4 -0
- package/file-input/FileInput.js +479 -0
- package/file-input/FileInput.stories.tsx +618 -0
- package/file-input/FileInput.test.js +459 -0
- package/file-input/FileItem.d.ts +4 -0
- package/file-input/FileItem.js +135 -0
- package/file-input/types.d.ts +129 -0
- package/file-input/types.js +5 -0
- package/flex/Flex.d.ts +4 -0
- package/flex/Flex.js +57 -0
- package/flex/Flex.stories.tsx +112 -0
- package/flex/types.d.ts +97 -0
- package/flex/types.js +5 -0
- package/footer/Footer.d.ts +4 -0
- package/footer/Footer.js +135 -0
- package/footer/Footer.stories.tsx +152 -0
- package/footer/Footer.test.js +85 -0
- package/footer/Icons.d.ts +2 -0
- package/footer/Icons.js +72 -0
- package/footer/types.d.ts +64 -0
- package/footer/types.js +5 -0
- package/grid/Grid.d.ts +7 -0
- package/grid/Grid.js +76 -0
- package/grid/Grid.stories.tsx +219 -0
- package/grid/types.d.ts +115 -0
- package/grid/types.js +5 -0
- package/header/Header.d.ts +8 -0
- package/header/Header.js +231 -0
- package/header/Header.stories.tsx +251 -0
- package/header/Header.test.js +66 -0
- package/header/Icons.d.ts +2 -0
- package/header/Icons.js +29 -0
- package/header/types.d.ts +32 -0
- package/header/types.js +5 -0
- package/heading/Heading.d.ts +4 -0
- package/{dist/heading → heading}/Heading.js +34 -119
- package/heading/Heading.stories.tsx +54 -0
- package/heading/Heading.test.js +169 -0
- package/heading/types.d.ts +33 -0
- package/heading/types.js +5 -0
- package/image/Image.d.ts +4 -0
- package/image/Image.js +70 -0
- package/image/Image.stories.tsx +127 -0
- package/image/types.d.ts +72 -0
- package/image/types.js +5 -0
- package/inset/Inset.d.ts +3 -0
- package/inset/Inset.js +43 -0
- package/inset/Inset.stories.tsx +230 -0
- package/inset/types.d.ts +37 -0
- package/inset/types.js +5 -0
- package/layout/ApplicationLayout.d.ts +20 -0
- package/layout/ApplicationLayout.js +134 -0
- package/layout/ApplicationLayout.stories.tsx +162 -0
- package/layout/Icons.d.ts +8 -0
- package/layout/Icons.js +58 -0
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +13 -0
- package/layout/types.d.ts +41 -0
- package/layout/types.js +5 -0
- package/link/Link.d.ts +4 -0
- package/link/Link.js +115 -0
- package/link/Link.stories.tsx +253 -0
- package/link/Link.test.js +63 -0
- package/link/types.d.ts +54 -0
- package/link/types.js +5 -0
- package/main.d.ts +47 -0
- package/{dist/main.js → main.js} +147 -115
- package/nav-tabs/NavTabs.d.ts +8 -0
- package/nav-tabs/NavTabs.js +90 -0
- package/nav-tabs/NavTabs.stories.tsx +274 -0
- package/nav-tabs/NavTabs.test.js +75 -0
- package/nav-tabs/Tab.d.ts +4 -0
- package/nav-tabs/Tab.js +117 -0
- package/nav-tabs/types.d.ts +52 -0
- package/nav-tabs/types.js +5 -0
- package/number-input/NumberInput.d.ts +11 -0
- package/number-input/NumberInput.js +67 -0
- package/number-input/NumberInput.stories.tsx +131 -0
- package/number-input/NumberInput.test.js +830 -0
- package/number-input/types.d.ts +130 -0
- package/number-input/types.js +5 -0
- package/package.json +59 -49
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +40 -0
- package/paginator/Paginator.d.ts +4 -0
- package/paginator/Paginator.js +138 -0
- package/paginator/Paginator.stories.tsx +87 -0
- package/paginator/Paginator.test.js +335 -0
- package/paginator/types.d.ts +38 -0
- package/paginator/types.js +5 -0
- package/paragraph/Paragraph.d.ts +5 -0
- package/paragraph/Paragraph.js +27 -0
- package/paragraph/Paragraph.stories.tsx +27 -0
- package/password-input/Icons.d.ts +6 -0
- package/password-input/Icons.js +35 -0
- package/password-input/PasswordInput.d.ts +4 -0
- package/password-input/PasswordInput.js +97 -0
- package/password-input/PasswordInput.stories.tsx +100 -0
- package/password-input/PasswordInput.test.js +198 -0
- package/password-input/types.d.ts +111 -0
- package/password-input/types.js +5 -0
- package/progress-bar/ProgressBar.d.ts +4 -0
- package/progress-bar/ProgressBar.js +150 -0
- package/progress-bar/ProgressBar.stories.tsx +93 -0
- package/progress-bar/ProgressBar.test.js +93 -0
- package/progress-bar/types.d.ts +37 -0
- package/progress-bar/types.js +5 -0
- package/quick-nav/QuickNav.d.ts +4 -0
- package/quick-nav/QuickNav.js +94 -0
- package/quick-nav/QuickNav.stories.tsx +356 -0
- package/quick-nav/types.d.ts +21 -0
- package/quick-nav/types.js +5 -0
- package/radio-group/Radio.d.ts +4 -0
- package/radio-group/Radio.js +124 -0
- package/radio-group/RadioGroup.d.ts +4 -0
- package/radio-group/RadioGroup.js +235 -0
- package/radio-group/RadioGroup.stories.tsx +214 -0
- package/radio-group/RadioGroup.test.js +756 -0
- package/radio-group/types.d.ts +114 -0
- package/radio-group/types.js +5 -0
- package/resultset-table/Icons.d.ts +7 -0
- package/resultset-table/Icons.js +47 -0
- package/resultset-table/ResultsetTable.d.ts +4 -0
- package/resultset-table/ResultsetTable.js +159 -0
- package/resultset-table/ResultsetTable.stories.tsx +300 -0
- package/resultset-table/ResultsetTable.test.js +305 -0
- package/resultset-table/types.d.ts +67 -0
- package/resultset-table/types.js +5 -0
- package/select/Icons.d.ts +10 -0
- package/select/Icons.js +89 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +143 -0
- package/select/Option.d.ts +4 -0
- package/select/Option.js +80 -0
- package/select/Select.d.ts +4 -0
- package/select/Select.js +582 -0
- package/select/Select.stories.tsx +971 -0
- package/select/Select.test.js +2334 -0
- package/select/types.d.ts +209 -0
- package/select/types.js +5 -0
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +47 -0
- package/sidenav/Sidenav.d.ts +10 -0
- package/sidenav/Sidenav.js +199 -0
- package/sidenav/Sidenav.stories.tsx +282 -0
- package/sidenav/Sidenav.test.js +37 -0
- package/sidenav/types.d.ts +76 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.d.ts +4 -0
- package/slider/Slider.js +294 -0
- package/slider/Slider.test.js +254 -0
- package/slider/types.d.ts +86 -0
- package/slider/types.js +5 -0
- package/spinner/Spinner.d.ts +4 -0
- package/spinner/Spinner.js +214 -0
- package/spinner/Spinner.stories.tsx +129 -0
- package/spinner/Spinner.test.js +55 -0
- package/spinner/types.d.ts +32 -0
- package/spinner/types.js +5 -0
- package/switch/Switch.d.ts +4 -0
- package/switch/Switch.js +219 -0
- package/switch/Switch.stories.tsx +137 -0
- package/switch/Switch.test.js +180 -0
- package/switch/types.d.ts +66 -0
- package/switch/types.js +5 -0
- package/table/Table.d.ts +4 -0
- package/{dist/table → table}/Table.js +17 -46
- package/table/Table.stories.tsx +356 -0
- package/table/Table.test.js +21 -0
- package/table/types.d.ts +21 -0
- package/table/types.js +5 -0
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +113 -0
- package/tabs/Tabs.d.ts +4 -0
- package/tabs/Tabs.js +385 -0
- package/tabs/Tabs.stories.tsx +226 -0
- package/tabs/Tabs.test.js +294 -0
- package/tabs/types.d.ts +92 -0
- package/tabs/types.js +5 -0
- package/tag/Tag.d.ts +4 -0
- package/tag/Tag.js +151 -0
- package/tag/Tag.stories.tsx +155 -0
- package/tag/Tag.test.js +49 -0
- package/tag/types.d.ts +69 -0
- package/tag/types.js +5 -0
- package/text-input/Icons.d.ts +8 -0
- package/text-input/Icons.js +56 -0
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +67 -0
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +89 -0
- package/text-input/TextInput.d.ts +4 -0
- package/text-input/TextInput.js +592 -0
- package/text-input/TextInput.stories.tsx +465 -0
- package/text-input/TextInput.test.js +1739 -0
- package/text-input/types.d.ts +205 -0
- package/text-input/types.js +5 -0
- package/textarea/Textarea.d.ts +4 -0
- package/textarea/Textarea.js +240 -0
- package/textarea/Textarea.stories.tsx +175 -0
- package/textarea/Textarea.test.js +406 -0
- package/textarea/types.d.ts +141 -0
- package/textarea/types.js +5 -0
- package/toggle-group/ToggleGroup.d.ts +4 -0
- package/toggle-group/ToggleGroup.js +204 -0
- package/toggle-group/ToggleGroup.stories.tsx +218 -0
- package/toggle-group/ToggleGroup.test.js +137 -0
- package/toggle-group/types.d.ts +114 -0
- package/toggle-group/types.js +5 -0
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +23 -0
- package/typography/Typography.stories.tsx +198 -0
- package/typography/types.d.ts +18 -0
- package/typography/types.js +5 -0
- package/useTheme.d.ts +1252 -0
- package/{dist/useTheme.js → useTheme.js} +4 -11
- package/useTranslatedLabels.d.ts +85 -0
- package/useTranslatedLabels.js +14 -0
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +94 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +114 -0
- package/wizard/Wizard.d.ts +4 -0
- package/wizard/Wizard.js +250 -0
- package/wizard/Wizard.stories.tsx +253 -0
- package/wizard/Wizard.test.js +114 -0
- package/wizard/types.d.ts +64 -0
- package/wizard/types.js +5 -0
- package/babel.config.js +0 -8
- package/dist/BackgroundColorContext.js +0 -46
- package/dist/ThemeContext.js +0 -216
- package/dist/accordion/Accordion.js +0 -340
- package/dist/accordion/Accordion.stories.js +0 -207
- package/dist/accordion/readme.md +0 -96
- package/dist/accordion-group/AccordionGroup.js +0 -188
- package/dist/accordion-group/AccordionGroup.stories.js +0 -207
- package/dist/accordion-group/readme.md +0 -70
- package/dist/alert/Alert.js +0 -388
- package/dist/alert/Alert.stories.js +0 -158
- package/dist/alert/close.svg +0 -4
- package/dist/alert/error.svg +0 -4
- package/dist/alert/info.svg +0 -4
- package/dist/alert/readme.md +0 -43
- package/dist/alert/success.svg +0 -4
- package/dist/alert/warning.svg +0 -4
- package/dist/badge/Badge.js +0 -63
- package/dist/box/Box.js +0 -164
- package/dist/button/Button.js +0 -228
- package/dist/button/Button.stories.js +0 -224
- package/dist/button/readme.md +0 -93
- package/dist/card/Card.js +0 -254
- package/dist/checkbox/Checkbox.js +0 -291
- package/dist/checkbox/Checkbox.stories.js +0 -144
- package/dist/checkbox/readme.md +0 -116
- package/dist/chip/Chip.js +0 -263
- package/dist/common/OpenSans.css +0 -81
- package/dist/common/RequiredComponent.js +0 -40
- package/dist/common/variables.js +0 -1160
- package/dist/date/Date.js +0 -391
- package/dist/date/Date.stories.js +0 -205
- package/dist/date/calendar.svg +0 -1
- package/dist/date/calendar_dark.svg +0 -1
- package/dist/date/readme.md +0 -73
- package/dist/dialog/Dialog.js +0 -236
- package/dist/dialog/Dialog.stories.js +0 -217
- package/dist/dialog/readme.md +0 -32
- package/dist/dropdown/Dropdown.js +0 -492
- package/dist/dropdown/Dropdown.stories.js +0 -249
- package/dist/dropdown/baseline-arrow_drop_down.svg +0 -1
- package/dist/dropdown/baseline-arrow_drop_down_wh.svg +0 -4
- package/dist/dropdown/baseline-arrow_drop_up.svg +0 -1
- package/dist/dropdown/baseline-arrow_drop_up_wh.svg +0 -4
- package/dist/dropdown/readme.md +0 -69
- package/dist/footer/Footer.js +0 -405
- package/dist/footer/Footer.stories.js +0 -94
- package/dist/footer/dxc_logo_wht.png +0 -0
- package/dist/footer/readme.md +0 -41
- package/dist/header/Header.js +0 -431
- package/dist/header/Header.stories.js +0 -176
- package/dist/header/close_icon.svg +0 -1
- package/dist/header/dxc_logo_black.png +0 -0
- package/dist/header/dxc_logo_blk_rgb.svg +0 -6
- package/dist/header/dxc_logo_white.png +0 -0
- package/dist/header/hamb_menu_black.svg +0 -1
- package/dist/header/hamb_menu_white.svg +0 -1
- package/dist/header/readme.md +0 -33
- package/dist/input-text/InputText.js +0 -669
- package/dist/input-text/InputText.stories.js +0 -209
- package/dist/input-text/error.svg +0 -1
- package/dist/input-text/readme.md +0 -91
- package/dist/layout/ApplicationLayout.js +0 -331
- package/dist/layout/facebook.svg +0 -45
- package/dist/layout/linkedin.svg +0 -50
- package/dist/layout/twitter.svg +0 -53
- package/dist/link/Link.js +0 -240
- package/dist/link/readme.md +0 -51
- package/dist/paginator/Paginator.js +0 -283
- package/dist/paginator/images/next.svg +0 -3
- package/dist/paginator/images/nextPage.svg +0 -3
- package/dist/paginator/images/previous.svg +0 -3
- package/dist/paginator/images/previousPage.svg +0 -3
- package/dist/paginator/readme.md +0 -50
- package/dist/progress-bar/ProgressBar.js +0 -206
- package/dist/progress-bar/ProgressBar.stories.js +0 -280
- package/dist/progress-bar/readme.md +0 -63
- package/dist/radio/Radio.js +0 -209
- package/dist/radio/Radio.stories.js +0 -166
- package/dist/radio/readme.md +0 -70
- package/dist/resultsetTable/ResultsetTable.js +0 -375
- package/dist/resultsetTable/arrow_downward-24px_wht.svg +0 -1
- package/dist/resultsetTable/arrow_upward-24px_wht.svg +0 -1
- package/dist/resultsetTable/unfold_more-24px_wht.svg +0 -1
- package/dist/select/Select.js +0 -545
- package/dist/select/Select.stories.js +0 -235
- package/dist/select/readme.md +0 -72
- package/dist/sidenav/Sidenav.js +0 -183
- package/dist/slider/Slider.js +0 -315
- package/dist/slider/Slider.stories.js +0 -241
- package/dist/slider/readme.md +0 -64
- package/dist/spinner/Spinner.js +0 -214
- package/dist/spinner/Spinner.stories.js +0 -183
- package/dist/spinner/readme.md +0 -65
- package/dist/switch/Switch.js +0 -222
- package/dist/switch/Switch.stories.js +0 -134
- package/dist/switch/readme.md +0 -133
- package/dist/tabs/Tabs.js +0 -343
- package/dist/tabs/Tabs.stories.js +0 -130
- package/dist/tabs/readme.md +0 -78
- package/dist/tabs-for-sections/TabsForSections.js +0 -92
- package/dist/tabs-for-sections/readme.md +0 -78
- package/dist/tag/Tag.js +0 -280
- package/dist/textarea/Textarea.js +0 -260
- package/dist/toggle/Toggle.js +0 -220
- package/dist/toggle/Toggle.stories.js +0 -297
- package/dist/toggle/readme.md +0 -80
- package/dist/toggle-group/ToggleGroup.js +0 -241
- package/dist/toggle-group/readme.md +0 -82
- package/dist/upload/Upload.js +0 -205
- package/dist/upload/Upload.stories.js +0 -72
- package/dist/upload/buttons-upload/ButtonsUpload.js +0 -135
- package/dist/upload/buttons-upload/drag-drop-icon.svg +0 -4
- package/dist/upload/buttons-upload/upload-button.svg +0 -1
- package/dist/upload/dragAndDropArea/DragAndDropArea.js +0 -325
- package/dist/upload/dragAndDropArea/upload_drop.svg +0 -4
- package/dist/upload/dragAndDropArea/upload_file.svg +0 -4
- package/dist/upload/file-upload/FileToUpload.js +0 -184
- package/dist/upload/file-upload/audio-icon.svg +0 -4
- package/dist/upload/file-upload/close.svg +0 -4
- package/dist/upload/file-upload/file-icon.svg +0 -4
- package/dist/upload/file-upload/video-icon.svg +0 -4
- package/dist/upload/files-upload/FilesToUpload.js +0 -123
- package/dist/upload/readme.md +0 -37
- package/dist/upload/transaction/Transaction.js +0 -171
- package/dist/upload/transaction/audio-icon-err.svg +0 -4
- package/dist/upload/transaction/audio-icon.svg +0 -4
- package/dist/upload/transaction/error-icon.svg +0 -4
- package/dist/upload/transaction/file-icon-err.svg +0 -4
- package/dist/upload/transaction/file-icon.svg +0 -4
- package/dist/upload/transaction/image-icon-err.svg +0 -4
- package/dist/upload/transaction/image-icon.svg +0 -4
- package/dist/upload/transaction/success-icon.svg +0 -4
- package/dist/upload/transaction/video-icon-err.svg +0 -4
- package/dist/upload/transaction/video-icon.svg +0 -4
- package/dist/upload/transactions/Transactions.js +0 -138
- package/dist/wizard/Wizard.js +0 -383
- package/dist/wizard/invalid_icon.svg +0 -6
- package/dist/wizard/valid_icon.svg +0 -6
- package/dist/wizard/validation-wrong.svg +0 -6
- package/test/Accordion.test.js +0 -33
- package/test/AccordionGroup.test.js +0 -125
- package/test/Alert.test.js +0 -53
- package/test/Box.test.js +0 -10
- package/test/Button.test.js +0 -18
- package/test/Card.test.js +0 -30
- package/test/Checkbox.test.js +0 -45
- package/test/Chip.test.js +0 -25
- package/test/Date.test.js +0 -393
- package/test/Dialog.test.js +0 -23
- package/test/Dropdown.test.js +0 -130
- package/test/Footer.test.js +0 -99
- package/test/Header.test.js +0 -39
- package/test/Heading.test.js +0 -35
- package/test/InputText.test.js +0 -240
- package/test/Link.test.js +0 -43
- package/test/Paginator.test.js +0 -177
- package/test/ProgressBar.test.js +0 -35
- package/test/Radio.test.js +0 -37
- package/test/ResultsetTable.test.js +0 -330
- package/test/Select.test.js +0 -192
- package/test/Sidenav.test.js +0 -45
- package/test/Slider.test.js +0 -82
- package/test/Spinner.test.js +0 -27
- package/test/Switch.test.js +0 -45
- package/test/Table.test.js +0 -36
- package/test/Tabs.test.js +0 -109
- package/test/TabsForSections.test.js +0 -34
- package/test/Tag.test.js +0 -32
- package/test/TextArea.test.js +0 -52
- package/test/ToggleGroup.test.js +0 -81
- package/test/Upload.test.js +0 -60
- package/test/Wizard.test.js +0 -130
- package/test/mocks/pngMock.js +0 -1
- package/test/mocks/svgMock.js +0 -1
- /package/{dist/common → common}/fonts/OpenSans-Bold.ttf +0 -0
- /package/{dist/common → common}/fonts/OpenSans-BoldItalic.ttf +0 -0
- /package/{dist/common → common}/fonts/OpenSans-ExtraBold.ttf +0 -0
- /package/{dist/common → common}/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- /package/{dist/common → common}/fonts/OpenSans-Italic.ttf +0 -0
- /package/{dist/common → common}/fonts/OpenSans-Light.ttf +0 -0
- /package/{dist/common → common}/fonts/OpenSans-LightItalic.ttf +0 -0
- /package/{dist/common → common}/fonts/OpenSans-Regular.ttf +0 -0
- /package/{dist/common → common}/fonts/OpenSans-SemiBold.ttf +0 -0
- /package/{dist/common → common}/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DxcDialog from "./Dialog";
|
|
3
|
+
import DxcTextInput from "../text-input/TextInput";
|
|
4
|
+
import DxcButton from "../button/Button";
|
|
5
|
+
import DxcFlex from "../flex/Flex";
|
|
6
|
+
import DxcInset from "../inset/Inset";
|
|
7
|
+
import Title from "../../.storybook/components/Title";
|
|
8
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
9
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
10
|
+
import DxcHeading from "../heading/Heading";
|
|
11
|
+
import DxcParagraph from "../paragraph/Paragraph";
|
|
12
|
+
import DxcAlert from "../alert/Alert";
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
title: "Dialog",
|
|
16
|
+
component: DxcDialog,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const opinionatedTheme = {
|
|
20
|
+
dialog: {
|
|
21
|
+
baseColor: "#ffffff",
|
|
22
|
+
closeIconColor: "#000000",
|
|
23
|
+
overlayColor: "#000000b3",
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const DefaultDialog = () => (
|
|
28
|
+
<ExampleContainer expanded={true}>
|
|
29
|
+
<Title title="Default dialog" theme="light" level={4} />
|
|
30
|
+
<DxcDialog>
|
|
31
|
+
<DxcInset space="1.5rem">
|
|
32
|
+
<DxcFlex direction="column" gap="1rem">
|
|
33
|
+
<DxcHeading level={4} text="Example title" />
|
|
34
|
+
<DxcParagraph>
|
|
35
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi egestas luctus porttitor. Donec massa magna,
|
|
36
|
+
placerat sit amet felis eget, venenatis fringilla ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing
|
|
37
|
+
elit. Donec congue laoreet orci, nec elementum dolor consequat quis. Curabitur rhoncus justo sed dapibus
|
|
38
|
+
tincidunt. Vestibulum cursus ut risus sit amet congue. Nunc luctus, urna ullamcorper facilisis Jia Le, risus
|
|
39
|
+
eros aliquam erat, ut efficitur ante neque id odio. Nam orci leo, dignissim sit amet dolor ut, congue
|
|
40
|
+
gravida enim. Donec rhoncus aliquam nisl, ac cursus enim bibendum vitae. Nunc sit amet elit ornare,
|
|
41
|
+
malesuada urna eu, fringilla mauris. Vivamus bibendum turpis est, id elementum purus euismod sit amet. Etiam
|
|
42
|
+
sit amet maximus augue. Vivamus erat sapien, ultricies fringilla tellus id, condimentum blandit justo.
|
|
43
|
+
Praesent quis nunc dignissim, pharetra neque molestie, molestie lectus.
|
|
44
|
+
</DxcParagraph>
|
|
45
|
+
</DxcFlex>
|
|
46
|
+
</DxcInset>
|
|
47
|
+
</DxcDialog>
|
|
48
|
+
</ExampleContainer>
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
export const DefaultDialogOpinionated = () => (
|
|
52
|
+
<ExampleContainer expanded={true}>
|
|
53
|
+
<Title title="Default dialog" theme="light" level={4} />
|
|
54
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
55
|
+
<DxcDialog>
|
|
56
|
+
<DxcInset space="1.5rem">
|
|
57
|
+
<DxcFlex direction="column" gap="1rem">
|
|
58
|
+
<DxcHeading level={4} text="Example title" />
|
|
59
|
+
<DxcParagraph>
|
|
60
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi egestas luctus porttitor. Donec massa
|
|
61
|
+
magna, placerat sit amet felis eget, venenatis fringilla ipsum. Lorem ipsum dolor sit amet, consectetur
|
|
62
|
+
adipiscing elit. Donec congue laoreet orci, nec elementum dolor consequat quis. Curabitur rhoncus justo
|
|
63
|
+
sed dapibus tincidunt. Vestibulum cursus ut risus sit amet congue. Nunc luctus, urna ullamcorper facilisis
|
|
64
|
+
Jia Le, risus eros aliquam erat, ut efficitur ante neque id odio. Nam orci leo, dignissim sit amet dolor
|
|
65
|
+
ut, congue gravida enim. Donec rhoncus aliquam nisl, ac cursus enim bibendum vitae. Nunc sit amet elit
|
|
66
|
+
ornare, malesuada urna eu, fringilla mauris. Vivamus bibendum turpis est, id elementum purus euismod sit
|
|
67
|
+
amet. Etiam sit amet maximus augue. Vivamus erat sapien, ultricies fringilla tellus id, condimentum
|
|
68
|
+
blandit justo. Praesent quis nunc dignissim, pharetra neque molestie, molestie lectus.
|
|
69
|
+
</DxcParagraph>
|
|
70
|
+
</DxcFlex>
|
|
71
|
+
</DxcInset>
|
|
72
|
+
</DxcDialog>
|
|
73
|
+
</HalstackProvider>
|
|
74
|
+
</ExampleContainer>
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
export const DialogWithInputs = () => (
|
|
78
|
+
<ExampleContainer expanded={true}>
|
|
79
|
+
<Title title="Dialog with inputs" theme="light" level={4} />
|
|
80
|
+
<DxcDialog>
|
|
81
|
+
<DxcInset space="1.5rem">
|
|
82
|
+
<DxcFlex gap="2rem" direction="column">
|
|
83
|
+
<DxcHeading level={4} text="Example form" />
|
|
84
|
+
<DxcFlex gap="1rem" direction="column">
|
|
85
|
+
<DxcTextInput size="fillParent" label="Name" />
|
|
86
|
+
<DxcTextInput size="fillParent" label="Surname" />
|
|
87
|
+
</DxcFlex>
|
|
88
|
+
<DxcAlert
|
|
89
|
+
type="error"
|
|
90
|
+
inlineText="User: arn:aws:xxx::xxxxxxxxxxxx:assumed-role/assure-sandbox-xxxx-xxxxxxxxxxxxxxxxxxxxxxxxxx/sandbox-xxxx-xxxxxxxxxxxxxxxxxx is not authorized to perform: lambda:xxxxxxxxxxxxxx on resource: arn:aws:lambda:us-east-1:xxxxxxxxxxxx:function:sandbox-xxxx-xx-xxxxxxx-xxxxxxx-lambda because no identity-based policy allows the lambda:xxxxxxxxxxxxxx action"
|
|
91
|
+
size="fillParent"
|
|
92
|
+
margin={{ bottom: "xsmall" }}
|
|
93
|
+
/>
|
|
94
|
+
<DxcFlex justifyContent="flex-end" gap="0.5rem">
|
|
95
|
+
<DxcButton label="Cancel" mode="text" />
|
|
96
|
+
<DxcButton label="Save" />
|
|
97
|
+
</DxcFlex>
|
|
98
|
+
</DxcFlex>
|
|
99
|
+
</DxcInset>
|
|
100
|
+
</DxcDialog>
|
|
101
|
+
</ExampleContainer>
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
const RespDialog = () => (
|
|
105
|
+
<ExampleContainer expanded={true}>
|
|
106
|
+
<Title title="Responsive dialog" theme="light" level={4} />
|
|
107
|
+
<DxcDialog>
|
|
108
|
+
<DxcInset space="1.5rem">
|
|
109
|
+
<DxcFlex gap="2rem" direction="column">
|
|
110
|
+
<DxcHeading level={4} text="Example form" />
|
|
111
|
+
<DxcFlex gap="1rem" direction="column">
|
|
112
|
+
<DxcTextInput size="fillParent" label="Name" />
|
|
113
|
+
<DxcTextInput size="fillParent" label="Surname" />
|
|
114
|
+
</DxcFlex>
|
|
115
|
+
<DxcFlex justifyContent="flex-end" gap="0.5rem">
|
|
116
|
+
<DxcButton label="Cancel" mode="text" />
|
|
117
|
+
<DxcButton label="Save" />
|
|
118
|
+
</DxcFlex>
|
|
119
|
+
</DxcFlex>
|
|
120
|
+
</DxcInset>
|
|
121
|
+
</DxcDialog>
|
|
122
|
+
</ExampleContainer>
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
export const DialogWithoutOverlay = () => (
|
|
126
|
+
<ExampleContainer expanded={true}>
|
|
127
|
+
<Title title="Dialog Without Overlay" theme="light" level={4} />
|
|
128
|
+
<DxcDialog overlay={false}>
|
|
129
|
+
<DxcInset space="1.5rem">
|
|
130
|
+
<DxcFlex direction="column" gap="1rem">
|
|
131
|
+
<DxcHeading level={4} text="Example title" />
|
|
132
|
+
<DxcParagraph>
|
|
133
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi egestas luctus porttitor. Donec massa magna,
|
|
134
|
+
placerat sit amet felis eget, venenatis fringilla ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing
|
|
135
|
+
elit. Donec congue laoreet orci, nec elementum dolor consequat quis. Curabitur rhoncus justo sed dapibus
|
|
136
|
+
tincidunt. Vestibulum cursus ut risus sit amet congue. Nunc luctus, urna ullamcorper facilisis Jia Le, risus
|
|
137
|
+
eros aliquam erat, ut efficitur ante neque id odio. Nam orci leo, dignissim sit amet dolor ut, congue
|
|
138
|
+
gravida enim. Donec rhoncus aliquam nisl, ac cursus enim bibendum vitae. Nunc sit amet elit ornare,
|
|
139
|
+
malesuada urna eu, fringilla mauris. Vivamus bibendum turpis est, id elementum purus euismod sit amet. Etiam
|
|
140
|
+
sit amet maximus augue. Vivamus erat sapien, ultricies fringilla tellus id, condimentum blandit justo.
|
|
141
|
+
Praesent quis nunc dignissim, pharetra neque molestie, molestie lectus.
|
|
142
|
+
</DxcParagraph>
|
|
143
|
+
</DxcFlex>
|
|
144
|
+
</DxcInset>
|
|
145
|
+
</DxcDialog>
|
|
146
|
+
</ExampleContainer>
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
export const DialogCloseVisibleFalse = () => (
|
|
150
|
+
<ExampleContainer expanded={true}>
|
|
151
|
+
<Title title="Dialog Close Visible" theme="dark" level={4} />
|
|
152
|
+
<DxcDialog isCloseVisible={false}>
|
|
153
|
+
<DxcInset space="1.5rem">
|
|
154
|
+
<DxcParagraph>
|
|
155
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi egestas luctus porttitor. Donec massa magna,
|
|
156
|
+
placerat sit amet felis eget, venenatis fringilla ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing
|
|
157
|
+
elit. Donec congue laoreet orci, nec elementum dolor consequat quis. Curabitur rhoncus justo sed dapibus
|
|
158
|
+
tincidunt. Vestibulum cursus ut risus sit amet congue. Nunc luctus, urna ullamcorper facilisis Jia Le, risus
|
|
159
|
+
eros aliquam erat, ut efficitur ante neque id odio. Nam orci leo, dignissim sit amet dolor ut, congue gravida
|
|
160
|
+
enim. Donec rhoncus aliquam nisl, ac cursus enim bibendum vitae. Nunc sit amet elit ornare, malesuada urna eu,
|
|
161
|
+
fringilla mauris. Vivamus bibendum turpis est, id elementum purus euismod sit amet. Etiam sit amet maximus
|
|
162
|
+
augue. Vivamus erat sapien, ultricies fringilla tellus id, condimentum blandit justo. Praesent quis nunc
|
|
163
|
+
dignissim, pharetra neque molestie, molestie lectus.
|
|
164
|
+
</DxcParagraph>
|
|
165
|
+
</DxcInset>
|
|
166
|
+
</DxcDialog>
|
|
167
|
+
</ExampleContainer>
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
const customViewports = {
|
|
171
|
+
resizedScreen: {
|
|
172
|
+
name: "Custom viewport",
|
|
173
|
+
styles: {
|
|
174
|
+
width: "720px",
|
|
175
|
+
height: "900px",
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
export const ResponsiveDialog = DefaultDialog.bind({});
|
|
181
|
+
ResponsiveDialog.parameters = {
|
|
182
|
+
viewport: {
|
|
183
|
+
viewports: customViewports,
|
|
184
|
+
defaultViewport: "resizedScreen",
|
|
185
|
+
},
|
|
186
|
+
chromatic: { viewports: [720] },
|
|
187
|
+
};
|
|
188
|
+
|
|
189
|
+
export const MobileResponsiveDialog = RespDialog.bind({});
|
|
190
|
+
MobileResponsiveDialog.parameters = {
|
|
191
|
+
viewport: {
|
|
192
|
+
defaultViewport: "iphonex",
|
|
193
|
+
},
|
|
194
|
+
chromatic: { viewports: [375] },
|
|
195
|
+
};
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _react = _interopRequireDefault(require("react"));
|
|
5
|
+
var _react2 = require("@testing-library/react");
|
|
6
|
+
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
7
|
+
var _Dialog = _interopRequireDefault(require("./Dialog.tsx"));
|
|
8
|
+
var _TextInput = _interopRequireDefault(require("../text-input/TextInput.tsx"));
|
|
9
|
+
var _Textarea = _interopRequireDefault(require("../textarea/Textarea.tsx"));
|
|
10
|
+
var _Checkbox = _interopRequireDefault(require("../checkbox/Checkbox.tsx"));
|
|
11
|
+
var _Select = _interopRequireDefault(require("../select/Select.tsx"));
|
|
12
|
+
var _Button = _interopRequireDefault(require("../button/Button.tsx"));
|
|
13
|
+
var _Link = _interopRequireDefault(require("../link/Link.tsx"));
|
|
14
|
+
var _Card = _interopRequireDefault(require("../card/Card.tsx"));
|
|
15
|
+
var _RadioGroup = _interopRequireDefault(require("../radio-group/RadioGroup.tsx"));
|
|
16
|
+
var _Slider = _interopRequireDefault(require("../slider/Slider.tsx"));
|
|
17
|
+
var _Switch = _interopRequireDefault(require("../switch/Switch.tsx"));
|
|
18
|
+
var options = [{
|
|
19
|
+
label: "Female",
|
|
20
|
+
value: "female"
|
|
21
|
+
}, {
|
|
22
|
+
label: "Male",
|
|
23
|
+
value: "male"
|
|
24
|
+
}, {
|
|
25
|
+
label: "Non-binary",
|
|
26
|
+
value: "non-binary"
|
|
27
|
+
}, {
|
|
28
|
+
label: "Other",
|
|
29
|
+
value: "other"
|
|
30
|
+
}];
|
|
31
|
+
describe("Dialog component tests", function () {
|
|
32
|
+
test("Dialog renders with correct text and accesibility attributes", function () {
|
|
33
|
+
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], null, "dialog-text")),
|
|
34
|
+
getByText = _render.getByText,
|
|
35
|
+
getByRole = _render.getByRole;
|
|
36
|
+
expect(getByRole("dialog")).toBeTruthy();
|
|
37
|
+
expect(getByRole("dialog").getAttribute("aria-modal")).toBe("true");
|
|
38
|
+
expect(getByText("dialog-text")).toBeTruthy();
|
|
39
|
+
});
|
|
40
|
+
test("Dialog renders without close button", function () {
|
|
41
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
|
|
42
|
+
isCloseVisible: false
|
|
43
|
+
}, "dialog-text")),
|
|
44
|
+
queryByRole = _render2.queryByRole;
|
|
45
|
+
expect(queryByRole("button")).toBeFalsy();
|
|
46
|
+
});
|
|
47
|
+
test("Dialog renders with aria-modal false when overlay is not used", function () {
|
|
48
|
+
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
|
|
49
|
+
isCloseVisible: false,
|
|
50
|
+
overlay: false
|
|
51
|
+
}, "dialog-text")),
|
|
52
|
+
getByRole = _render3.getByRole;
|
|
53
|
+
expect(getByRole("dialog")).toBeTruthy();
|
|
54
|
+
expect(getByRole("dialog").getAttribute("aria-modal")).toBe("false");
|
|
55
|
+
});
|
|
56
|
+
test("Calls correct function onCloseClick", function () {
|
|
57
|
+
var onCloseClick = jest.fn();
|
|
58
|
+
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
|
|
59
|
+
onCloseClick: onCloseClick
|
|
60
|
+
}, "dialog-text")),
|
|
61
|
+
getByRole = _render4.getByRole;
|
|
62
|
+
var closeButton = getByRole("button");
|
|
63
|
+
_react2.fireEvent.click(closeButton);
|
|
64
|
+
expect(onCloseClick).toHaveBeenCalled();
|
|
65
|
+
});
|
|
66
|
+
test("Calls correct function onCloseClick when 'Escape' key is pressed", function () {
|
|
67
|
+
var onCloseClick = jest.fn();
|
|
68
|
+
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
|
|
69
|
+
onCloseClick: onCloseClick
|
|
70
|
+
}, "dialog-text")),
|
|
71
|
+
getByRole = _render5.getByRole;
|
|
72
|
+
_react2.fireEvent.keyDown(getByRole("dialog"), {
|
|
73
|
+
key: "Escape",
|
|
74
|
+
code: "Escape",
|
|
75
|
+
keyCode: 27,
|
|
76
|
+
charCode: 27
|
|
77
|
+
});
|
|
78
|
+
expect(onCloseClick).toHaveBeenCalled();
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
describe("Dialog component: Focus lock tests", function () {
|
|
82
|
+
test("Close action: when there's no focusable content, the focus never leaves the close action (unless you click outside)", function () {
|
|
83
|
+
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], null, "example-dialog")),
|
|
84
|
+
getByRole = _render6.getByRole;
|
|
85
|
+
var button = getByRole("button");
|
|
86
|
+
var dialog = getByRole("dialog");
|
|
87
|
+
expect(document.activeElement).toEqual(button);
|
|
88
|
+
expect(button.getAttribute("aria-label")).toBe("Close dialog");
|
|
89
|
+
_userEvent["default"].tab();
|
|
90
|
+
expect(document.activeElement).toEqual(button);
|
|
91
|
+
_react2.fireEvent.keyDown(dialog, {
|
|
92
|
+
key: "Tab",
|
|
93
|
+
shiftKey: true
|
|
94
|
+
});
|
|
95
|
+
expect(document.activeElement).toEqual(button);
|
|
96
|
+
});
|
|
97
|
+
test("Autofocus with Button component", function () {
|
|
98
|
+
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
99
|
+
label: "Accept"
|
|
100
|
+
}))),
|
|
101
|
+
getAllByRole = _render7.getAllByRole;
|
|
102
|
+
var button = getAllByRole("button")[0];
|
|
103
|
+
expect(document.activeElement).toEqual(button);
|
|
104
|
+
expect(button.getAttribute("aria-label")).not.toBe("Close dialog");
|
|
105
|
+
});
|
|
106
|
+
test("Autofocus with Card component", function () {
|
|
107
|
+
var _render8 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], null, /*#__PURE__*/_react["default"].createElement(_Card["default"], {
|
|
108
|
+
linkHref: "https://developer.dxc.com/halstack/next/components/card/"
|
|
109
|
+
}, "example-card"))),
|
|
110
|
+
getByRole = _render8.getByRole;
|
|
111
|
+
var card = getByRole("link");
|
|
112
|
+
expect(document.activeElement).toEqual(card);
|
|
113
|
+
});
|
|
114
|
+
test("Autofocus with Checkbox component", function () {
|
|
115
|
+
var _render9 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], null, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
116
|
+
label: "Name"
|
|
117
|
+
}))),
|
|
118
|
+
getByRole = _render9.getByRole;
|
|
119
|
+
var checkbox = getByRole("checkbox");
|
|
120
|
+
expect(document.activeElement).toEqual(checkbox);
|
|
121
|
+
});
|
|
122
|
+
test("Autofocus with Link component", function () {
|
|
123
|
+
var _render10 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], null, "This is a text with a ", /*#__PURE__*/_react["default"].createElement(_Link["default"], {
|
|
124
|
+
href: "#"
|
|
125
|
+
}, "Link"), " to another page.")),
|
|
126
|
+
getByRole = _render10.getByRole;
|
|
127
|
+
var link = getByRole("link");
|
|
128
|
+
expect(document.activeElement).toEqual(link);
|
|
129
|
+
});
|
|
130
|
+
test("Autofocus with RadioGroup component", function () {
|
|
131
|
+
var _render11 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], null, /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
132
|
+
label: "Example",
|
|
133
|
+
options: options
|
|
134
|
+
}))),
|
|
135
|
+
getAllByRole = _render11.getAllByRole;
|
|
136
|
+
var checkedRadio = getAllByRole("radio")[0];
|
|
137
|
+
expect(document.activeElement).toEqual(checkedRadio);
|
|
138
|
+
});
|
|
139
|
+
test("Autofocus with Select component", function () {
|
|
140
|
+
var _render12 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], null, /*#__PURE__*/_react["default"].createElement(_Select["default"], {
|
|
141
|
+
label: "Country",
|
|
142
|
+
options: options
|
|
143
|
+
}))),
|
|
144
|
+
getByRole = _render12.getByRole;
|
|
145
|
+
var select = getByRole("combobox");
|
|
146
|
+
expect(document.activeElement).toEqual(select);
|
|
147
|
+
});
|
|
148
|
+
test("Autofocus with Slider component", function () {
|
|
149
|
+
var _render13 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], null, /*#__PURE__*/_react["default"].createElement(_Slider["default"], {
|
|
150
|
+
label: "label",
|
|
151
|
+
minValue: 0,
|
|
152
|
+
maxValue: 100,
|
|
153
|
+
showLimitsValues: true
|
|
154
|
+
}))),
|
|
155
|
+
getByRole = _render13.getByRole;
|
|
156
|
+
var slider = getByRole("slider");
|
|
157
|
+
expect(document.activeElement).toEqual(slider);
|
|
158
|
+
});
|
|
159
|
+
test("Autofocus with Switch component", function () {
|
|
160
|
+
var _render14 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], null, /*#__PURE__*/_react["default"].createElement(_Switch["default"], {
|
|
161
|
+
label: "Example"
|
|
162
|
+
}))),
|
|
163
|
+
getByRole = _render14.getByRole;
|
|
164
|
+
var switchButton = getByRole("switch");
|
|
165
|
+
expect(document.activeElement).toEqual(switchButton);
|
|
166
|
+
});
|
|
167
|
+
test("Autofocus with Text Input component", function () {
|
|
168
|
+
var _render15 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], null, /*#__PURE__*/_react["default"].createElement(_TextInput["default"], {
|
|
169
|
+
label: "Name"
|
|
170
|
+
}))),
|
|
171
|
+
getByRole = _render15.getByRole;
|
|
172
|
+
var input = getByRole("textbox");
|
|
173
|
+
expect(document.activeElement).toEqual(input);
|
|
174
|
+
});
|
|
175
|
+
test("Autofocus with Textarea component", function () {
|
|
176
|
+
var _render16 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], null, /*#__PURE__*/_react["default"].createElement(_Textarea["default"], {
|
|
177
|
+
label: "Name"
|
|
178
|
+
}))),
|
|
179
|
+
getByRole = _render16.getByRole;
|
|
180
|
+
var textarea = getByRole("textbox");
|
|
181
|
+
expect(document.activeElement).toEqual(textarea);
|
|
182
|
+
});
|
|
183
|
+
test("Negative tabindex elements are not automatically focused, even if it is enabled and a valid focusable item (programatically and by click)", function () {
|
|
184
|
+
var _render17 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], null, /*#__PURE__*/_react["default"].createElement("input", {
|
|
185
|
+
label: "Name",
|
|
186
|
+
tabIndex: -1
|
|
187
|
+
}), /*#__PURE__*/_react["default"].createElement("input", {
|
|
188
|
+
label: "Name"
|
|
189
|
+
}))),
|
|
190
|
+
getAllByRole = _render17.getAllByRole,
|
|
191
|
+
getByRole = _render17.getByRole;
|
|
192
|
+
var inputs = getAllByRole("textbox");
|
|
193
|
+
var button = getByRole("button");
|
|
194
|
+
expect(document.activeElement).toEqual(inputs[1]);
|
|
195
|
+
_userEvent["default"].tab();
|
|
196
|
+
expect(document.activeElement).toEqual(button);
|
|
197
|
+
_userEvent["default"].tab();
|
|
198
|
+
expect(document.activeElement).toEqual(inputs[1]);
|
|
199
|
+
});
|
|
200
|
+
test("Focus jumps disabled components and negative tabIndexes when autofocusing first item", function () {
|
|
201
|
+
var _render18 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
202
|
+
label: "Accept",
|
|
203
|
+
disabled: true
|
|
204
|
+
}), /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
205
|
+
label: "Older age",
|
|
206
|
+
disabled: true
|
|
207
|
+
}), /*#__PURE__*/_react["default"].createElement(_Select["default"], {
|
|
208
|
+
label: "Country",
|
|
209
|
+
options: options,
|
|
210
|
+
disabled: true
|
|
211
|
+
}), /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
212
|
+
label: "Country",
|
|
213
|
+
options: options,
|
|
214
|
+
disabled: true
|
|
215
|
+
}), /*#__PURE__*/_react["default"].createElement(_TextInput["default"], {
|
|
216
|
+
label: "Name",
|
|
217
|
+
disabled: true
|
|
218
|
+
}), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
219
|
+
label: "Accept",
|
|
220
|
+
tabIndex: -1
|
|
221
|
+
}), /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
222
|
+
label: "Older age",
|
|
223
|
+
tabIndex: -1
|
|
224
|
+
}), /*#__PURE__*/_react["default"].createElement(_Select["default"], {
|
|
225
|
+
label: "Country",
|
|
226
|
+
options: options,
|
|
227
|
+
tabIndex: -1
|
|
228
|
+
}), /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
229
|
+
label: "Country",
|
|
230
|
+
options: options,
|
|
231
|
+
tabIndex: -1
|
|
232
|
+
}), /*#__PURE__*/_react["default"].createElement(_TextInput["default"], {
|
|
233
|
+
label: "Name",
|
|
234
|
+
tabIndex: -1
|
|
235
|
+
}), /*#__PURE__*/_react["default"].createElement(_Textarea["default"], {
|
|
236
|
+
label: "Description"
|
|
237
|
+
}))),
|
|
238
|
+
getAllByRole = _render18.getAllByRole;
|
|
239
|
+
var textarea = getAllByRole("textbox")[2];
|
|
240
|
+
expect(document.activeElement).toEqual(textarea);
|
|
241
|
+
});
|
|
242
|
+
test("Focus jumps from last element to the first", function () {
|
|
243
|
+
var _render19 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], null, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
244
|
+
label: "Accept",
|
|
245
|
+
disabled: true
|
|
246
|
+
}), /*#__PURE__*/_react["default"].createElement(_Textarea["default"], {
|
|
247
|
+
label: "Name"
|
|
248
|
+
}), /*#__PURE__*/_react["default"].createElement(_RadioGroup["default"], {
|
|
249
|
+
label: "Name",
|
|
250
|
+
options: options
|
|
251
|
+
}))),
|
|
252
|
+
getByRole = _render19.getByRole;
|
|
253
|
+
var closeAction = getByRole("button");
|
|
254
|
+
var textarea = getByRole("textbox");
|
|
255
|
+
expect(document.activeElement).toEqual(textarea);
|
|
256
|
+
_userEvent["default"].tab();
|
|
257
|
+
_userEvent["default"].tab();
|
|
258
|
+
expect(document.activeElement).toEqual(closeAction);
|
|
259
|
+
_userEvent["default"].tab();
|
|
260
|
+
expect(document.activeElement).toEqual(textarea);
|
|
261
|
+
});
|
|
262
|
+
test("'display: none;', 'visibility: hidden;' and 'type = 'hidden'' elements are never autofocused", function () {
|
|
263
|
+
var _render20 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Dialog["default"], null, /*#__PURE__*/_react["default"].createElement("input", {
|
|
264
|
+
label: "Name",
|
|
265
|
+
style: {
|
|
266
|
+
display: "none"
|
|
267
|
+
}
|
|
268
|
+
}), /*#__PURE__*/_react["default"].createElement("input", {
|
|
269
|
+
label: "Name",
|
|
270
|
+
style: {
|
|
271
|
+
visibility: "hidden"
|
|
272
|
+
}
|
|
273
|
+
}), /*#__PURE__*/_react["default"].createElement("input", {
|
|
274
|
+
type: "hidden",
|
|
275
|
+
name: "example"
|
|
276
|
+
}))),
|
|
277
|
+
getByRole = _render20.getByRole;
|
|
278
|
+
var closeAction = getByRole("button");
|
|
279
|
+
expect(document.activeElement).toEqual(closeAction);
|
|
280
|
+
_userEvent["default"].tab();
|
|
281
|
+
expect(document.activeElement).toEqual(closeAction);
|
|
282
|
+
});
|
|
283
|
+
test("Focus gets trapped in the Dialog when there are not focusable elements inside until it is closed", function () {
|
|
284
|
+
var _render21 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_TextInput["default"], {
|
|
285
|
+
label: "Name"
|
|
286
|
+
}), /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
|
|
287
|
+
isCloseVisible: false
|
|
288
|
+
}, /*#__PURE__*/_react["default"].createElement("h2", null, "Policy agreement"), /*#__PURE__*/_react["default"].createElement("p", null, "Sample text.")), /*#__PURE__*/_react["default"].createElement(_TextInput["default"], {
|
|
289
|
+
label: "Surname"
|
|
290
|
+
}))),
|
|
291
|
+
getAllByRole = _render21.getAllByRole;
|
|
292
|
+
var inputs = getAllByRole("textbox");
|
|
293
|
+
var dialog = getAllByRole("dialog")[0];
|
|
294
|
+
_userEvent["default"].tab();
|
|
295
|
+
_userEvent["default"].tab();
|
|
296
|
+
expect(document.activeElement).not.toEqual(inputs[1]);
|
|
297
|
+
_react2.fireEvent.keyDown(dialog, {
|
|
298
|
+
key: "Tab",
|
|
299
|
+
shiftKey: true
|
|
300
|
+
});
|
|
301
|
+
_react2.fireEvent.keyDown(dialog, {
|
|
302
|
+
key: "Tab",
|
|
303
|
+
shiftKey: true
|
|
304
|
+
});
|
|
305
|
+
expect(document.activeElement).not.toEqual(inputs[0]);
|
|
306
|
+
});
|
|
307
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type Props = {
|
|
3
|
+
/**
|
|
4
|
+
* If true, the close button will be visible.
|
|
5
|
+
*/
|
|
6
|
+
isCloseVisible?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* This function will be called when the user clicks the close button.
|
|
9
|
+
* The responsibility of hiding the dialog lies with the user.
|
|
10
|
+
*/
|
|
11
|
+
onCloseClick?: () => void;
|
|
12
|
+
/**
|
|
13
|
+
* This function will be called when the user clicks on the background of the modal.
|
|
14
|
+
* The responsibility of hiding the dialog lies with the user.
|
|
15
|
+
*/
|
|
16
|
+
onBackgroundClick?: () => void;
|
|
17
|
+
/**
|
|
18
|
+
* If true, the dialog will be displayed over a darker background that covers the content behind.
|
|
19
|
+
*/
|
|
20
|
+
overlay?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Area within the dialog that can be used to render custom content.
|
|
23
|
+
* We strongly encourage users to not change the
|
|
24
|
+
* tabindex of the inner components or elements. This
|
|
25
|
+
* can lead to unpredictable behaviour for keyboard users, affecting
|
|
26
|
+
* the order of focus and focus locking within the dialog.
|
|
27
|
+
*/
|
|
28
|
+
children: React.ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Value of the tabindex applied to the close button.
|
|
31
|
+
* Note that values greater than 0 are strongly discouraged. It can
|
|
32
|
+
* lead to unexpected behaviours with the focus within the dialog.
|
|
33
|
+
*/
|
|
34
|
+
tabIndex?: number;
|
|
35
|
+
};
|
|
36
|
+
export default Props;
|
package/dialog/types.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import DropdownPropsType from "./types";
|
|
3
|
+
declare const DxcDropdown: ({ options, optionsIconPosition, icon, iconPosition, label, caretHidden, disabled, expandOnHover, onSelectOption, margin, size, tabIndex, }: DropdownPropsType) => JSX.Element;
|
|
4
|
+
export default DxcDropdown;
|