@dxc-technology/halstack-react 0.0.0-b061aa1 → 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 -0
- package/BackgroundColorContext.js +6 -26
- package/HalstackContext.d.ts +1280 -0
- package/HalstackContext.js +320 -0
- 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 +103 -193
- package/accordion/Accordion.stories.tsx +241 -0
- package/accordion/Accordion.test.d.ts +1 -0
- package/accordion/Accordion.test.js +56 -0
- package/accordion/types.d.ts +12 -23
- 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 +3 -3
- package/accordion-group/AccordionGroup.js +39 -108
- package/accordion-group/AccordionGroup.stories.tsx +95 -68
- package/accordion-group/AccordionGroup.test.d.ts +1 -0
- package/accordion-group/AccordionGroup.test.js +94 -0
- 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 +18 -23
- 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 +41 -128
- package/alert/Alert.stories.tsx +28 -0
- package/alert/Alert.test.d.ts +1 -0
- package/alert/Alert.test.js +75 -0
- 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 +4 -0
- package/badge/Badge.js +142 -40
- 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 +54 -0
- 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.d.ts +3 -0
- package/bleed/Bleed.js +43 -0
- package/bleed/Bleed.stories.tsx +341 -0
- package/bleed/types.d.ts +37 -0
- package/bleed/types.js +5 -0
- 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 +31 -82
- package/box/Box.stories.tsx +38 -51
- package/box/Box.test.d.ts +1 -0
- package/box/Box.test.js +13 -0
- 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/breadcrumbs/types.js +5 -0
- package/bulleted-list/BulletedList.accessibility.test.d.ts +1 -0
- package/bulleted-list/BulletedList.accessibility.test.js +119 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +92 -0
- package/bulleted-list/BulletedList.stories.tsx +115 -0
- package/bulleted-list/types.d.ts +38 -0
- package/bulleted-list/types.js +5 -0
- 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 +65 -123
- package/button/Button.stories.tsx +155 -106
- package/button/Button.test.d.ts +1 -0
- package/button/Button.test.js +38 -0
- package/button/types.d.ts +12 -12
- 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 +60 -103
- package/card/Card.stories.tsx +14 -44
- package/card/Card.test.d.ts +1 -0
- package/card/Card.test.js +39 -0
- 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 +141 -182
- package/checkbox/Checkbox.stories.tsx +166 -136
- package/checkbox/Checkbox.test.d.ts +1 -0
- package/checkbox/Checkbox.test.js +199 -0
- package/checkbox/types.d.ts +19 -7
- package/chip/Chip.accessibility.test.d.ts +1 -0
- package/chip/Chip.accessibility.test.js +67 -0
- package/chip/Chip.d.ts +1 -1
- package/chip/Chip.js +51 -124
- package/chip/Chip.stories.tsx +105 -31
- package/chip/Chip.test.d.ts +1 -0
- package/chip/Chip.test.js +41 -0
- package/chip/types.d.ts +10 -18
- 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 +1117 -1397
- 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 +181 -314
- package/date-input/DateInput.stories.tsx +210 -57
- package/date-input/DateInput.test.d.ts +1 -0
- package/date-input/DateInput.test.js +808 -0
- 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 +86 -22
- 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 +57 -129
- package/dialog/Dialog.stories.tsx +324 -167
- package/dialog/Dialog.test.d.ts +1 -0
- package/dialog/Dialog.test.js +370 -0
- 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.d.ts +1 -1
- package/dropdown/Dropdown.js +233 -330
- package/dropdown/Dropdown.stories.tsx +427 -0
- package/dropdown/Dropdown.test.d.ts +1 -0
- package/dropdown/Dropdown.test.js +628 -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 +71 -0
- package/dropdown/types.d.ts +37 -30
- 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 +264 -337
- package/file-input/FileInput.stories.tsx +618 -0
- package/file-input/FileInput.test.d.ts +1 -0
- package/file-input/FileInput.test.js +404 -0
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +63 -122
- package/file-input/types.d.ts +52 -14
- 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.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 +74 -200
- package/footer/{Footer.stories.jsx → Footer.stories.tsx} +96 -39
- package/footer/Footer.test.d.ts +1 -0
- package/footer/Footer.test.js +85 -0
- package/footer/Icons.d.ts +3 -0
- package/footer/Icons.js +54 -23
- package/footer/types.d.ts +26 -31
- 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 +105 -219
- package/header/Header.stories.tsx +169 -64
- package/header/Header.test.d.ts +1 -0
- package/header/Header.test.js +66 -0
- package/header/Icons.d.ts +2 -0
- package/header/Icons.js +5 -15
- 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 +11 -33
- package/heading/Heading.stories.tsx +3 -2
- package/heading/Heading.test.d.ts +1 -0
- package/heading/Heading.test.js +156 -0
- 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.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 +16 -6
- package/layout/ApplicationLayout.js +88 -175
- package/layout/ApplicationLayout.stories.tsx +162 -0
- package/layout/Icons.d.ts +7 -0
- package/layout/Icons.js +41 -48
- package/layout/types.d.ts +19 -35
- package/link/Link.accessibility.test.d.ts +1 -0
- package/link/Link.accessibility.test.js +108 -0
- package/link/Link.d.ts +3 -2
- package/link/Link.js +65 -109
- package/link/Link.stories.tsx +161 -54
- package/link/Link.test.d.ts +1 -0
- package/link/Link.test.js +63 -0
- package/link/types.d.ts +15 -35
- package/main.d.ts +21 -14
- package/main.js +106 -98
- 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.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.accessibility.test.d.ts +1 -0
- package/number-input/NumberInput.accessibility.test.js +227 -0
- package/number-input/NumberInput.js +52 -49
- package/number-input/NumberInput.stories.tsx +39 -28
- package/number-input/NumberInput.test.d.ts +1 -0
- package/number-input/NumberInput.test.js +988 -0
- package/number-input/NumberInputContext.d.ts +3 -4
- package/number-input/NumberInputContext.js +3 -14
- package/number-input/types.d.ts +34 -15
- package/package.json +59 -52
- package/paginator/Paginator.accessibility.test.d.ts +1 -0
- package/paginator/Paginator.accessibility.test.js +78 -0
- package/paginator/Paginator.js +47 -107
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.d.ts +1 -0
- package/paginator/Paginator.test.js +334 -0
- 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 +5 -0
- package/paragraph/Paragraph.js +22 -0
- package/paragraph/Paragraph.stories.tsx +27 -0
- package/password-input/PasswordInput.accessibility.test.d.ts +1 -0
- package/password-input/PasswordInput.accessibility.test.js +152 -0
- package/password-input/PasswordInput.js +63 -127
- package/password-input/PasswordInput.stories.tsx +13 -36
- package/password-input/PasswordInput.test.d.ts +1 -0
- package/password-input/PasswordInput.test.js +197 -0
- package/password-input/types.d.ts +21 -17
- package/progress-bar/ProgressBar.accessibility.test.d.ts +1 -0
- package/progress-bar/ProgressBar.accessibility.test.js +35 -0
- package/progress-bar/ProgressBar.js +69 -93
- package/progress-bar/ProgressBar.stories.tsx +93 -0
- package/progress-bar/ProgressBar.test.d.ts +1 -0
- package/progress-bar/ProgressBar.test.js +93 -0
- package/progress-bar/types.d.ts +3 -3
- package/quick-nav/QuickNav.accessibility.test.d.ts +1 -0
- package/quick-nav/QuickNav.accessibility.test.js +57 -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 +121 -0
- package/radio-group/RadioGroup.accessibility.test.d.ts +1 -0
- package/radio-group/RadioGroup.accessibility.test.js +97 -0
- package/radio-group/RadioGroup.d.ts +4 -0
- package/radio-group/RadioGroup.js +233 -0
- package/radio-group/RadioGroup.stories.tsx +214 -0
- package/radio-group/RadioGroup.test.d.ts +1 -0
- package/radio-group/RadioGroup.test.js +754 -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.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/resultset-table/ResultsetTable.stories.tsx +413 -0
- package/resultset-table/ResultsetTable.test.d.ts +1 -0
- package/resultset-table/ResultsetTable.test.js +450 -0
- package/{resultsetTable → resultset-table}/types.d.ts +45 -11
- package/resultset-table/types.js +5 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +151 -0
- package/select/Option.d.ts +4 -0
- package/select/Option.js +89 -0
- package/select/Select.accessibility.test.d.ts +1 -0
- package/select/Select.accessibility.test.js +227 -0
- package/select/Select.d.ts +4 -0
- package/select/Select.js +251 -514
- package/select/Select.stories.tsx +611 -255
- package/select/Select.test.d.ts +1 -0
- package/select/Select.test.js +2168 -0
- package/select/types.d.ts +209 -0
- package/select/types.js +5 -0
- package/sidenav/Sidenav.accessibility.test.d.ts +1 -0
- package/sidenav/Sidenav.accessibility.test.js +59 -0
- package/sidenav/Sidenav.d.ts +6 -5
- package/sidenav/Sidenav.js +137 -72
- package/sidenav/Sidenav.stories.tsx +246 -134
- package/sidenav/Sidenav.test.d.ts +1 -0
- package/sidenav/Sidenav.test.js +37 -0
- package/sidenav/SidenavContext.d.ts +5 -0
- package/sidenav/SidenavContext.js +13 -0
- package/sidenav/types.d.ts +52 -26
- 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 +148 -182
- package/slider/Slider.stories.tsx +68 -65
- package/slider/Slider.test.d.ts +1 -0
- package/slider/Slider.test.js +256 -0
- package/slider/types.d.ts +11 -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 +51 -110
- package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +53 -26
- package/spinner/Spinner.test.d.ts +1 -0
- package/spinner/Spinner.test.js +55 -0
- 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 +2 -2
- package/switch/Switch.js +147 -115
- package/switch/Switch.stories.tsx +57 -68
- package/switch/Switch.test.d.ts +1 -0
- package/switch/Switch.test.js +180 -0
- package/switch/types.d.ts +13 -5
- 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 +79 -36
- package/table/Table.stories.tsx +663 -0
- package/table/Table.test.d.ts +1 -0
- package/table/Table.test.js +111 -0
- package/table/types.d.ts +34 -6
- package/tabs/Tab.d.ts +4 -0
- package/tabs/Tab.js +117 -0
- package/tabs/Tabs.accessibility.test.d.ts +1 -0
- package/tabs/Tabs.accessibility.test.js +56 -0
- package/tabs/Tabs.d.ts +1 -1
- package/tabs/Tabs.js +307 -147
- package/tabs/Tabs.stories.tsx +127 -18
- package/tabs/Tabs.test.d.ts +1 -0
- package/tabs/Tabs.test.js +276 -0
- package/tabs/types.d.ts +46 -24
- package/tag/Tag.accessibility.test.d.ts +1 -0
- package/tag/Tag.accessibility.test.js +69 -0
- package/tag/Tag.d.ts +1 -1
- package/tag/Tag.js +44 -86
- package/tag/Tag.stories.tsx +38 -31
- package/tag/Tag.test.d.ts +1 -0
- package/tag/Tag.test.js +41 -0
- package/tag/types.d.ts +25 -16
- 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 +94 -0
- package/text-input/TextInput.accessibility.test.d.ts +1 -0
- package/text-input/TextInput.accessibility.test.js +320 -0
- package/text-input/TextInput.js +335 -552
- package/text-input/TextInput.stories.tsx +292 -271
- package/text-input/TextInput.test.d.ts +1 -0
- package/text-input/TextInput.test.js +1755 -0
- package/text-input/types.d.ts +71 -25
- package/textarea/Textarea.accessibility.test.d.ts +1 -0
- package/textarea/Textarea.accessibility.test.js +155 -0
- package/textarea/Textarea.d.ts +4 -0
- package/textarea/Textarea.js +92 -173
- package/textarea/Textarea.stories.tsx +174 -0
- package/textarea/Textarea.test.d.ts +1 -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.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 +96 -114
- package/toggle-group/ToggleGroup.stories.tsx +80 -40
- package/toggle-group/ToggleGroup.test.d.ts +1 -0
- package/toggle-group/ToggleGroup.test.js +137 -0
- package/toggle-group/types.d.ts +67 -37
- 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 +4 -0
- package/typography/Typography.js +23 -0
- package/typography/Typography.stories.tsx +196 -0
- package/typography/Typography.test.js +23 -0
- package/typography/types.d.ts +18 -0
- package/typography/types.js +5 -0
- package/useTheme.d.ts +1168 -0
- package/useTheme.js +4 -11
- package/useTranslatedLabels.d.ts +96 -0
- package/useTranslatedLabels.js +14 -0
- 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.d.ts +1 -1
- package/wizard/Wizard.js +122 -114
- package/wizard/{Wizard.stories.jsx → Wizard.stories.tsx} +68 -20
- package/wizard/Wizard.test.d.ts +1 -0
- package/wizard/Wizard.test.js +114 -0
- package/wizard/types.d.ts +15 -15
- package/ThemeContext.js +0 -246
- package/V3Select/V3Select.js +0 -455
- package/V3Select/index.d.ts +0 -27
- package/V3Textarea/V3Textarea.js +0 -260
- package/V3Textarea/index.d.ts +0 -27
- 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/date/Date.js +0 -373
- package/date/index.d.ts +0 -27
- package/input-text/Icons.js +0 -22
- package/input-text/InputText.js +0 -611
- package/input-text/index.d.ts +0 -36
- package/number-input/numberInputContextTypes.d.ts +0 -19
- package/paginator/Icons.js +0 -66
- package/progress-bar/ProgressBar.stories.jsx +0 -58
- package/radio/Radio.d.ts +0 -4
- package/radio/Radio.js +0 -174
- package/radio/Radio.stories.tsx +0 -192
- package/radio/types.d.ts +0 -54
- package/resultsetTable/ResultsetTable.d.ts +0 -4
- package/resultsetTable/ResultsetTable.js +0 -251
- package/select/index.d.ts +0 -131
- package/table/Table.stories.jsx +0 -276
- package/textarea/Textarea.stories.jsx +0 -135
- package/textarea/index.d.ts +0 -127
- package/toggle/Toggle.js +0 -186
- package/toggle/index.d.ts +0 -21
- package/upload/Upload.js +0 -201
- package/upload/buttons-upload/ButtonsUpload.js +0 -111
- package/upload/buttons-upload/Icons.js +0 -40
- package/upload/dragAndDropArea/DragAndDropArea.js +0 -225
- package/upload/dragAndDropArea/Icons.js +0 -39
- package/upload/file-upload/FileToUpload.js +0 -115
- package/upload/file-upload/Icons.js +0 -66
- package/upload/files-upload/FilesToUpload.js +0 -109
- package/upload/index.d.ts +0 -15
- package/upload/transaction/Icons.js +0 -160
- package/upload/transaction/Transaction.js +0 -104
- package/upload/transactions/Transactions.js +0 -94
- package/wizard/Icons.js +0 -65
- /package/{radio → action-icon}/types.js +0 -0
- /package/{resultsetTable → badge}/types.js +0 -0
- /package/{number-input/numberInputContextTypes.js → bar-chart/types.js} +0 -0
|
@@ -0,0 +1,137 @@
|
|
|
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 _ToggleGroup = _interopRequireDefault(require("./ToggleGroup"));
|
|
7
|
+
var options = [{
|
|
8
|
+
value: 1,
|
|
9
|
+
label: "Amazon"
|
|
10
|
+
}, {
|
|
11
|
+
value: 2,
|
|
12
|
+
label: "Ebay"
|
|
13
|
+
}, {
|
|
14
|
+
value: 3,
|
|
15
|
+
label: "Apple"
|
|
16
|
+
}, {
|
|
17
|
+
value: 4,
|
|
18
|
+
label: "Google"
|
|
19
|
+
}];
|
|
20
|
+
describe("Toggle group component tests", function () {
|
|
21
|
+
test("Toggle group renders with correct labels", function () {
|
|
22
|
+
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ToggleGroup["default"], {
|
|
23
|
+
label: "Toggle group label",
|
|
24
|
+
helperText: "Toggle group helper text",
|
|
25
|
+
options: options
|
|
26
|
+
})),
|
|
27
|
+
getByText = _render.getByText;
|
|
28
|
+
expect(getByText("Toggle group label")).toBeTruthy();
|
|
29
|
+
expect(getByText("Toggle group helper text")).toBeTruthy();
|
|
30
|
+
expect(getByText("Amazon")).toBeTruthy();
|
|
31
|
+
expect(getByText("Ebay")).toBeTruthy();
|
|
32
|
+
expect(getByText("Apple")).toBeTruthy();
|
|
33
|
+
expect(getByText("Google")).toBeTruthy();
|
|
34
|
+
});
|
|
35
|
+
test("Toggle group renders with correct aria-label in only-icon scenario", function () {
|
|
36
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ToggleGroup["default"], {
|
|
37
|
+
label: "Toggle group label",
|
|
38
|
+
helperText: "Toggle group helper text",
|
|
39
|
+
options: [{
|
|
40
|
+
value: 1,
|
|
41
|
+
icon: "https://cdn.icon-icons.com/icons2/2645/PNG/512/mic_mute_icon_159965.png",
|
|
42
|
+
title: "Mute"
|
|
43
|
+
}]
|
|
44
|
+
})),
|
|
45
|
+
getByRole = _render2.getByRole;
|
|
46
|
+
expect(getByRole("button").getAttribute("aria-label")).toBe("Mute");
|
|
47
|
+
});
|
|
48
|
+
test("Uncontrolled toggle group calls correct function on change with value", function () {
|
|
49
|
+
var onChange = jest.fn();
|
|
50
|
+
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ToggleGroup["default"], {
|
|
51
|
+
options: options,
|
|
52
|
+
onChange: onChange
|
|
53
|
+
})),
|
|
54
|
+
getByText = _render3.getByText;
|
|
55
|
+
var option = getByText("Ebay");
|
|
56
|
+
_react2.fireEvent.click(option);
|
|
57
|
+
expect(onChange).toHaveBeenCalledWith(2);
|
|
58
|
+
});
|
|
59
|
+
test("Controlled toggle group calls correct function on change with value", function () {
|
|
60
|
+
var onChange = jest.fn();
|
|
61
|
+
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ToggleGroup["default"], {
|
|
62
|
+
options: options,
|
|
63
|
+
onChange: onChange,
|
|
64
|
+
value: 1
|
|
65
|
+
})),
|
|
66
|
+
getByText = _render4.getByText;
|
|
67
|
+
var option = getByText("Ebay");
|
|
68
|
+
_react2.fireEvent.click(option);
|
|
69
|
+
expect(onChange).toHaveBeenCalledWith(2);
|
|
70
|
+
});
|
|
71
|
+
test("Function on change is not called when disable", function () {
|
|
72
|
+
var onChange = jest.fn();
|
|
73
|
+
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ToggleGroup["default"], {
|
|
74
|
+
options: options,
|
|
75
|
+
onChange: onChange,
|
|
76
|
+
disabled: true
|
|
77
|
+
})),
|
|
78
|
+
getByText = _render5.getByText;
|
|
79
|
+
var option = getByText("Ebay");
|
|
80
|
+
_react2.fireEvent.click(option);
|
|
81
|
+
expect(onChange).toHaveBeenCalledTimes(0);
|
|
82
|
+
});
|
|
83
|
+
test("Uncontrolled multiple toggle group calls correct function on change with value when is multiple", function () {
|
|
84
|
+
var onChange = jest.fn();
|
|
85
|
+
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ToggleGroup["default"], {
|
|
86
|
+
options: options,
|
|
87
|
+
onChange: onChange,
|
|
88
|
+
multiple: true
|
|
89
|
+
})),
|
|
90
|
+
getAllByRole = _render6.getAllByRole;
|
|
91
|
+
var toggleOptions = getAllByRole("button");
|
|
92
|
+
_react2.fireEvent.click(toggleOptions[0]);
|
|
93
|
+
expect(onChange).toHaveBeenCalledWith([1]);
|
|
94
|
+
_react2.fireEvent.click(toggleOptions[1]);
|
|
95
|
+
_react2.fireEvent.click(toggleOptions[3]);
|
|
96
|
+
expect(onChange).toHaveBeenCalledWith([1, 2, 4]);
|
|
97
|
+
expect(toggleOptions[0].getAttribute("aria-pressed")).toBe("true");
|
|
98
|
+
expect(toggleOptions[1].getAttribute("aria-pressed")).toBe("true");
|
|
99
|
+
expect(toggleOptions[3].getAttribute("aria-pressed")).toBe("true");
|
|
100
|
+
});
|
|
101
|
+
test("Controlled multiple toggle returns always same values", function () {
|
|
102
|
+
var onChange = jest.fn();
|
|
103
|
+
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ToggleGroup["default"], {
|
|
104
|
+
options: options,
|
|
105
|
+
onChange: onChange,
|
|
106
|
+
value: [1],
|
|
107
|
+
multiple: true
|
|
108
|
+
})),
|
|
109
|
+
getByText = _render7.getByText;
|
|
110
|
+
var option = getByText("Ebay");
|
|
111
|
+
_react2.fireEvent.click(option);
|
|
112
|
+
expect(onChange).toHaveBeenCalledWith([1, 2]);
|
|
113
|
+
var option2 = getByText("Google");
|
|
114
|
+
_react2.fireEvent.click(option2);
|
|
115
|
+
expect(onChange).toHaveBeenNthCalledWith(2, [1, 4]);
|
|
116
|
+
});
|
|
117
|
+
test("Single selection: Renders with correct default value", function () {
|
|
118
|
+
var _render8 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ToggleGroup["default"], {
|
|
119
|
+
options: options,
|
|
120
|
+
defaultValue: 2
|
|
121
|
+
})),
|
|
122
|
+
getAllByRole = _render8.getAllByRole;
|
|
123
|
+
var toggleOptions = getAllByRole("button");
|
|
124
|
+
expect(toggleOptions[1].getAttribute("aria-pressed")).toBe("true");
|
|
125
|
+
});
|
|
126
|
+
test("Multiple selection: Renders with correct default value", function () {
|
|
127
|
+
var _render9 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_ToggleGroup["default"], {
|
|
128
|
+
options: options,
|
|
129
|
+
defaultValue: [2, 4],
|
|
130
|
+
multiple: true
|
|
131
|
+
})),
|
|
132
|
+
getAllByRole = _render9.getAllByRole;
|
|
133
|
+
var toggleOptions = getAllByRole("button");
|
|
134
|
+
expect(toggleOptions[1].getAttribute("aria-pressed")).toBe("true");
|
|
135
|
+
expect(toggleOptions[3].getAttribute("aria-pressed")).toBe("true");
|
|
136
|
+
});
|
|
137
|
+
});
|
package/toggle-group/types.d.ts
CHANGED
|
@@ -1,44 +1,49 @@
|
|
|
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 OptionIcon = {
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
*/
|
|
14
|
-
value: string;
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated URL of the icon that will be placed. IconSrc and label can't be used at same time.
|
|
12
|
+
* String with the option display value.
|
|
17
13
|
*/
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
declare type OptionIcon = OptionCommons & {
|
|
14
|
+
label?: never;
|
|
21
15
|
/**
|
|
22
|
-
*
|
|
16
|
+
* Material Symbols icon or SVG element. Icon and label can't be used at same time.
|
|
23
17
|
*/
|
|
24
|
-
|
|
18
|
+
icon: string | SVG;
|
|
25
19
|
/**
|
|
26
|
-
*
|
|
20
|
+
* Value for the HTML properties title and aria-label.
|
|
21
|
+
* When a label is defined, this prop can not be use.
|
|
27
22
|
*/
|
|
28
|
-
|
|
23
|
+
title: string;
|
|
29
24
|
};
|
|
30
|
-
|
|
25
|
+
export type OptionLabel = {
|
|
31
26
|
/**
|
|
32
27
|
* String with the option display value.
|
|
33
28
|
*/
|
|
34
29
|
label: string;
|
|
35
30
|
/**
|
|
36
|
-
*
|
|
31
|
+
* Material Symbols icon or SVG element. Icon and label can't be used at same time.
|
|
32
|
+
*/
|
|
33
|
+
icon?: string | SVG;
|
|
34
|
+
/**
|
|
35
|
+
* Value for the HTML properties title and aria-label.
|
|
36
|
+
* When a label is defined, this prop can not be use.
|
|
37
37
|
*/
|
|
38
|
-
|
|
38
|
+
title?: never;
|
|
39
39
|
};
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
type Option = {
|
|
41
|
+
/**
|
|
42
|
+
* Number with the option inner value.
|
|
43
|
+
*/
|
|
44
|
+
value: number;
|
|
45
|
+
} & (OptionIcon | OptionLabel);
|
|
46
|
+
type CommonProps = {
|
|
42
47
|
/**
|
|
43
48
|
* Text to be placed above the component.
|
|
44
49
|
*/
|
|
@@ -47,18 +52,6 @@ declare type Props = {
|
|
|
47
52
|
* Helper text to be placed above the component.
|
|
48
53
|
*/
|
|
49
54
|
helperText?: string;
|
|
50
|
-
/**
|
|
51
|
-
* The key(s) of the selected value(s). If the toggle group component doesn't allow multiple selection,
|
|
52
|
-
* it must be one unique value. If the component allows multiple selection, value must be an array.
|
|
53
|
-
* If undefined, the component will be uncontrolled and the value will be managed internally by the component.
|
|
54
|
-
*/
|
|
55
|
-
value?: string | string[];
|
|
56
|
-
/**
|
|
57
|
-
* This function will be called every time the selection changes. The number with the key of the selected
|
|
58
|
-
* value will be passed as a parameter to this function.
|
|
59
|
-
* If multiple selection is allowed, an array of keys will be passed.
|
|
60
|
-
*/
|
|
61
|
-
onChange?: (optionIndex: number | number[]) => void;
|
|
62
55
|
/**
|
|
63
56
|
* If true, the component will be disabled.
|
|
64
57
|
*/
|
|
@@ -67,10 +60,6 @@ declare type Props = {
|
|
|
67
60
|
* An array of objects representing the selectable options.
|
|
68
61
|
*/
|
|
69
62
|
options: Option[];
|
|
70
|
-
/**
|
|
71
|
-
* If true, the toggle group will support multiple selection. In that case, value must be an array of numbers with the keys of the selected values.
|
|
72
|
-
*/
|
|
73
|
-
multiple?: boolean;
|
|
74
63
|
/**
|
|
75
64
|
* Size of the margin to be applied to the component ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
76
65
|
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties in order to specify different margin sizes.
|
|
@@ -81,4 +70,45 @@ declare type Props = {
|
|
|
81
70
|
*/
|
|
82
71
|
tabIndex?: number;
|
|
83
72
|
};
|
|
73
|
+
type SingleSelectionToggleGroup = CommonProps & {
|
|
74
|
+
/**
|
|
75
|
+
* If true, the toggle group will support multiple selection. In that case, value must be an array of numbers with the keys of the selected values.
|
|
76
|
+
*/
|
|
77
|
+
multiple?: false;
|
|
78
|
+
/**
|
|
79
|
+
* The key of the initially selected value.
|
|
80
|
+
*/
|
|
81
|
+
defaultValue?: number;
|
|
82
|
+
/**
|
|
83
|
+
* The key of the selected value. If the component allows multiple selection, value must be an array.
|
|
84
|
+
* If undefined, the component will be uncontrolled and the value will be managed internally by the component.
|
|
85
|
+
*/
|
|
86
|
+
value?: number;
|
|
87
|
+
/**
|
|
88
|
+
* This function will be called every time the selection changes. The number with the key of the selected
|
|
89
|
+
* value will be passed as a parameter to this function.
|
|
90
|
+
*/
|
|
91
|
+
onChange?: (optionIndex: number) => void;
|
|
92
|
+
};
|
|
93
|
+
type MultipleSelectionToggleGroup = CommonProps & {
|
|
94
|
+
/**
|
|
95
|
+
* If true, the toggle group will support multiple selection. In that case, value must be an array of numbers with the keys of the selected values.
|
|
96
|
+
*/
|
|
97
|
+
multiple: true;
|
|
98
|
+
/**
|
|
99
|
+
* The array of keys with the initially selected values.
|
|
100
|
+
*/
|
|
101
|
+
defaultValue?: number[];
|
|
102
|
+
/**
|
|
103
|
+
* An array with the keys of the selected values.
|
|
104
|
+
* If undefined, the component will be uncontrolled and the value will be managed internally by the component.
|
|
105
|
+
*/
|
|
106
|
+
value?: number[];
|
|
107
|
+
/**
|
|
108
|
+
* This function will be called every time the selection changes. An array with the key of
|
|
109
|
+
* the selected values will be passed as a parameter to this function.
|
|
110
|
+
*/
|
|
111
|
+
onChange?: (optionIndex: number[]) => void;
|
|
112
|
+
};
|
|
113
|
+
type Props = SingleSelectionToggleGroup | MultipleSelectionToggleGroup;
|
|
84
114
|
export default Props;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,144 @@
|
|
|
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 _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
7
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _react2 = require("@testing-library/react");
|
|
10
|
+
var _axeHelper = require("../../test/accessibility/axe-helper.js");
|
|
11
|
+
var _Tooltip = _interopRequireDefault(require("./Tooltip"));
|
|
12
|
+
var _Button = _interopRequireDefault(require("../button/Button"));
|
|
13
|
+
global.globalThis = global;
|
|
14
|
+
global.DOMRect = {
|
|
15
|
+
fromRect: function fromRect() {
|
|
16
|
+
return {
|
|
17
|
+
top: 0,
|
|
18
|
+
left: 0,
|
|
19
|
+
bottom: 0,
|
|
20
|
+
right: 0,
|
|
21
|
+
width: 0,
|
|
22
|
+
height: 0,
|
|
23
|
+
x: 0,
|
|
24
|
+
y: 0
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
global.ResizeObserver = /*#__PURE__*/function () {
|
|
29
|
+
function ResizeObserver() {
|
|
30
|
+
(0, _classCallCheck2["default"])(this, ResizeObserver);
|
|
31
|
+
}
|
|
32
|
+
return (0, _createClass2["default"])(ResizeObserver, [{
|
|
33
|
+
key: "observe",
|
|
34
|
+
value: function observe() {}
|
|
35
|
+
}, {
|
|
36
|
+
key: "unobserve",
|
|
37
|
+
value: function unobserve() {}
|
|
38
|
+
}, {
|
|
39
|
+
key: "disconnect",
|
|
40
|
+
value: function disconnect() {}
|
|
41
|
+
}]);
|
|
42
|
+
}();
|
|
43
|
+
describe("Tooltip component accessibility tests", function () {
|
|
44
|
+
it("Should not have basic accessibility issues for bottom position", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
45
|
+
var _render, baseElement, getByText, triggerElement, results;
|
|
46
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
47
|
+
while (1) switch (_context.prev = _context.next) {
|
|
48
|
+
case 0:
|
|
49
|
+
// baseElement is needed when using React Portals
|
|
50
|
+
_render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
51
|
+
label: "Tooltip Test",
|
|
52
|
+
position: "bottom"
|
|
53
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
54
|
+
label: "Hoverable button"
|
|
55
|
+
}))), baseElement = _render.baseElement, getByText = _render.getByText;
|
|
56
|
+
triggerElement = getByText("Hoverable button");
|
|
57
|
+
_react2.fireEvent.mouseEnter(triggerElement);
|
|
58
|
+
_context.next = 5;
|
|
59
|
+
return (0, _axeHelper.axe)(baseElement);
|
|
60
|
+
case 5:
|
|
61
|
+
results = _context.sent;
|
|
62
|
+
expect(results).toHaveNoViolations();
|
|
63
|
+
case 7:
|
|
64
|
+
case "end":
|
|
65
|
+
return _context.stop();
|
|
66
|
+
}
|
|
67
|
+
}, _callee);
|
|
68
|
+
})));
|
|
69
|
+
it("Should not have basic accessibility issues for top position", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
70
|
+
var _render2, baseElement, getByText, triggerElement, results;
|
|
71
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
72
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
73
|
+
case 0:
|
|
74
|
+
// baseElement is needed when using React Portals
|
|
75
|
+
_render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
76
|
+
label: "Tooltip Test",
|
|
77
|
+
position: "top"
|
|
78
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
79
|
+
label: "Hoverable button"
|
|
80
|
+
}))), baseElement = _render2.baseElement, getByText = _render2.getByText;
|
|
81
|
+
triggerElement = getByText("Hoverable button");
|
|
82
|
+
_react2.fireEvent.mouseEnter(triggerElement);
|
|
83
|
+
_context2.next = 5;
|
|
84
|
+
return (0, _axeHelper.axe)(baseElement);
|
|
85
|
+
case 5:
|
|
86
|
+
results = _context2.sent;
|
|
87
|
+
expect(results).toHaveNoViolations();
|
|
88
|
+
case 7:
|
|
89
|
+
case "end":
|
|
90
|
+
return _context2.stop();
|
|
91
|
+
}
|
|
92
|
+
}, _callee2);
|
|
93
|
+
})));
|
|
94
|
+
it("Should not have basic accessibility issues for left position", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
95
|
+
var _render3, baseElement, getByText, triggerElement, results;
|
|
96
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
97
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
98
|
+
case 0:
|
|
99
|
+
// baseElement is needed when using React Portals
|
|
100
|
+
_render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
101
|
+
label: "Tooltip Test",
|
|
102
|
+
position: "left"
|
|
103
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
104
|
+
label: "Hoverable button"
|
|
105
|
+
}))), baseElement = _render3.baseElement, getByText = _render3.getByText;
|
|
106
|
+
triggerElement = getByText("Hoverable button");
|
|
107
|
+
_react2.fireEvent.mouseEnter(triggerElement);
|
|
108
|
+
_context3.next = 5;
|
|
109
|
+
return (0, _axeHelper.axe)(baseElement);
|
|
110
|
+
case 5:
|
|
111
|
+
results = _context3.sent;
|
|
112
|
+
expect(results).toHaveNoViolations();
|
|
113
|
+
case 7:
|
|
114
|
+
case "end":
|
|
115
|
+
return _context3.stop();
|
|
116
|
+
}
|
|
117
|
+
}, _callee3);
|
|
118
|
+
})));
|
|
119
|
+
it("Should not have basic accessibility issues for right position", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
120
|
+
var _render4, baseElement, getByText, triggerElement, results;
|
|
121
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
122
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
123
|
+
case 0:
|
|
124
|
+
// baseElement is needed when using React Portals
|
|
125
|
+
_render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
126
|
+
label: "Tooltip Test",
|
|
127
|
+
position: "right"
|
|
128
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
129
|
+
label: "Hoverable button"
|
|
130
|
+
}))), baseElement = _render4.baseElement, getByText = _render4.getByText;
|
|
131
|
+
triggerElement = getByText("Hoverable button");
|
|
132
|
+
_react2.fireEvent.mouseEnter(triggerElement);
|
|
133
|
+
_context4.next = 5;
|
|
134
|
+
return (0, _axeHelper.axe)(baseElement);
|
|
135
|
+
case 5:
|
|
136
|
+
results = _context4.sent;
|
|
137
|
+
expect(results).toHaveNoViolations();
|
|
138
|
+
case 7:
|
|
139
|
+
case "end":
|
|
140
|
+
return _context4.stop();
|
|
141
|
+
}
|
|
142
|
+
}, _callee4);
|
|
143
|
+
})));
|
|
144
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
12
|
+
var Tooltip = _interopRequireWildcard(require("@radix-ui/react-tooltip"));
|
|
13
|
+
var _coreTokens = _interopRequireDefault(require("../common/coreTokens"));
|
|
14
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
17
|
+
var Triangle = function Triangle() {
|
|
18
|
+
return /*#__PURE__*/_react["default"].createElement("svg", {
|
|
19
|
+
width: "12",
|
|
20
|
+
height: "6",
|
|
21
|
+
viewBox: "0 0 12 6",
|
|
22
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
23
|
+
preserveAspectRatio: "none",
|
|
24
|
+
display: "block"
|
|
25
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
26
|
+
d: "M0.351562 0L5.30131 4.94975C5.69184 5.34027 6.325 5.34027 6.71552 4.94975L11.6653 0H6.00842H0.351562Z",
|
|
27
|
+
fill: _coreTokens["default"].color_grey_800
|
|
28
|
+
}));
|
|
29
|
+
};
|
|
30
|
+
var DxcTooltip = function DxcTooltip(_ref) {
|
|
31
|
+
var _ref$position = _ref.position,
|
|
32
|
+
position = _ref$position === void 0 ? "bottom" : _ref$position,
|
|
33
|
+
label = _ref.label,
|
|
34
|
+
children = _ref.children;
|
|
35
|
+
return label ? /*#__PURE__*/_react["default"].createElement(Tooltip.Provider, {
|
|
36
|
+
delayDuration: 300
|
|
37
|
+
}, /*#__PURE__*/_react["default"].createElement(Tooltip.Root, null, /*#__PURE__*/_react["default"].createElement(Tooltip.Trigger, {
|
|
38
|
+
asChild: true
|
|
39
|
+
}, /*#__PURE__*/_react["default"].createElement(TooltipTriggerContainer, null, children)), /*#__PURE__*/_react["default"].createElement(Tooltip.Portal, null, /*#__PURE__*/_react["default"].createElement(StyledTooltipContent, {
|
|
40
|
+
side: position,
|
|
41
|
+
sideOffset: 8
|
|
42
|
+
}, /*#__PURE__*/_react["default"].createElement(TooltipContainer, null, label), /*#__PURE__*/_react["default"].createElement(Tooltip.Arrow, {
|
|
43
|
+
asChild: true,
|
|
44
|
+
"aria-hidden": true
|
|
45
|
+
}, /*#__PURE__*/_react["default"].createElement(Triangle, null)))))) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, children);
|
|
46
|
+
};
|
|
47
|
+
var TooltipTriggerContainer = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n display: inline-flex;\n position: relative;\n"])));
|
|
48
|
+
var StyledTooltipContent = (0, _styledComponents["default"])(Tooltip.Content)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n z-index: 2147483647;\n\n animation-duration: 0.2s;\n animation-timing-function: ease-out;\n\n /* Additional optimization to prevent blurry text in certain browsers */\n -webkit-font-smoothing: antialiased;\n transform: translateZ(0) scale(1, 1);\n\n &[data-side=\"top\"] {\n animation-name: slideUp;\n }\n &[data-side=\"bottom\"] {\n animation-name: slideDown;\n }\n &[data-side=\"left\"] {\n animation-name: slideLeft;\n }\n &[data-side=\"right\"] {\n animation-name: slideRight;\n }\n @keyframes slideDown {\n from {\n opacity: 0;\n transform: translateY(-10px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n @keyframes slideUp {\n from {\n opacity: 0;\n transform: translateY(10px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n }\n @keyframes slideLeft {\n from {\n opacity: 0;\n transform: translateX(10px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n }\n @keyframes slideRight {\n from {\n opacity: 0;\n transform: translateX(-10px);\n }\n to {\n opacity: 1;\n transform: translateX(0);\n }\n }\n"])));
|
|
49
|
+
var TooltipContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n padding: 8px 12px;\n border-radius: 4px;\n font-size: ", ";\n font-family: ", ";\n max-width: 242px;\n color: ", ";\n background-color: ", ";\n border-color: ", ";\n"])), _coreTokens["default"].type_scale_01, _coreTokens["default"].type_sans, _coreTokens["default"].color_white, _coreTokens["default"].color_grey_800, _coreTokens["default"].color_grey_800);
|
|
50
|
+
var _default = exports["default"] = DxcTooltip;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import DxcTooltip from "./Tooltip";
|
|
3
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
4
|
+
import DxcButton from "../button/Button";
|
|
5
|
+
import { userEvent, within } from "@storybook/test";
|
|
6
|
+
import DxcInset from "../inset/Inset";
|
|
7
|
+
import Title from "../../.storybook/components/Title";
|
|
8
|
+
import DxcFlex from "../flex/Flex";
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
title: "Tooltip",
|
|
12
|
+
component: DxcTooltip,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const Tooltip = () => (
|
|
16
|
+
<>
|
|
17
|
+
<Title title="Default tooltip" theme="light" level={4} />
|
|
18
|
+
<ExampleContainer>
|
|
19
|
+
<DxcInset bottom="3rem">
|
|
20
|
+
<DxcTooltip label="Tooltip Test">
|
|
21
|
+
<DxcButton label="Hoverable button" />
|
|
22
|
+
</DxcTooltip>
|
|
23
|
+
</DxcInset>
|
|
24
|
+
</ExampleContainer>
|
|
25
|
+
</>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const LargeTextWithinTooltip = () => (
|
|
29
|
+
<>
|
|
30
|
+
<Title title="Multiple line tooltip" theme="light" level={4} />
|
|
31
|
+
<ExampleContainer>
|
|
32
|
+
<DxcInset bottom="5rem" left="1rem">
|
|
33
|
+
<DxcTooltip label="Tooltip Test with a large text to display in the container while hovering the component">
|
|
34
|
+
<DxcButton label="Hoverable button" />
|
|
35
|
+
</DxcTooltip>
|
|
36
|
+
</DxcInset>
|
|
37
|
+
</ExampleContainer>
|
|
38
|
+
</>
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const TopTooltip = () => (
|
|
42
|
+
<>
|
|
43
|
+
<Title title="Top tooltip" theme="light" level={4} />
|
|
44
|
+
<ExampleContainer>
|
|
45
|
+
<DxcInset top="3rem">
|
|
46
|
+
<DxcTooltip label="Tooltip Test" position="top">
|
|
47
|
+
<DxcButton label="Hoverable button" />
|
|
48
|
+
</DxcTooltip>
|
|
49
|
+
</DxcInset>
|
|
50
|
+
</ExampleContainer>
|
|
51
|
+
</>
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
const LeftTooltip = () => (
|
|
55
|
+
<>
|
|
56
|
+
<Title title="Left tooltip" theme="light" level={4} />
|
|
57
|
+
<ExampleContainer>
|
|
58
|
+
<DxcFlex justifyContent="center">
|
|
59
|
+
<DxcTooltip label="Tooltip Test" position="left">
|
|
60
|
+
<DxcButton label="Hoverable button" />
|
|
61
|
+
</DxcTooltip>
|
|
62
|
+
</DxcFlex>
|
|
63
|
+
</ExampleContainer>
|
|
64
|
+
</>
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const RightTooltip = () => (
|
|
68
|
+
<>
|
|
69
|
+
<Title title="Right tooltip" theme="light" level={4} />
|
|
70
|
+
<ExampleContainer>
|
|
71
|
+
<DxcTooltip label="Tooltip Test" position="right">
|
|
72
|
+
<DxcButton label="Hoverable button" />
|
|
73
|
+
</DxcTooltip>
|
|
74
|
+
</ExampleContainer>
|
|
75
|
+
</>
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
export const Chromatic = Tooltip.bind({});
|
|
79
|
+
Chromatic.play = async ({ canvasElement }) => {
|
|
80
|
+
const canvas = within(canvasElement);
|
|
81
|
+
const buttonList = canvas.getByRole("button");
|
|
82
|
+
await userEvent.hover(buttonList);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const LargeTextTooltip = LargeTextWithinTooltip.bind({});
|
|
86
|
+
LargeTextTooltip.play = async ({ canvasElement }) => {
|
|
87
|
+
const canvas = within(canvasElement);
|
|
88
|
+
const buttonList = canvas.getByRole("button");
|
|
89
|
+
await userEvent.hover(buttonList);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export const TooltipPositionTop = TopTooltip.bind({});
|
|
93
|
+
TooltipPositionTop.play = async ({ canvasElement }) => {
|
|
94
|
+
const canvas = within(canvasElement);
|
|
95
|
+
const buttonList = canvas.getByRole("button");
|
|
96
|
+
await userEvent.hover(buttonList);
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export const TooltipPositionLeft = LeftTooltip.bind({});
|
|
100
|
+
TooltipPositionLeft.play = async ({ canvasElement }) => {
|
|
101
|
+
const canvas = within(canvasElement);
|
|
102
|
+
const buttonList = canvas.getByRole("button");
|
|
103
|
+
await userEvent.hover(buttonList);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export const TooltipPositionRight = RightTooltip.bind({});
|
|
107
|
+
TooltipPositionRight.play = async ({ canvasElement }) => {
|
|
108
|
+
const canvas = within(canvasElement);
|
|
109
|
+
const buttonList = canvas.getByRole("button");
|
|
110
|
+
await userEvent.hover(buttonList);
|
|
111
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@testing-library/jest-dom";
|