@dxc-technology/halstack-react 0.0.0-c6243ef → 0.0.0-c67081d
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 +47 -0
- package/HalstackContext.d.ts +1356 -0
- package/HalstackContext.js +335 -0
- package/README.md +28 -47
- package/accordion/Accordion.d.ts +4 -0
- package/accordion/Accordion.js +222 -0
- package/accordion/Accordion.stories.tsx +297 -0
- package/accordion/Accordion.test.js +71 -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 +128 -0
- package/accordion-group/AccordionGroup.stories.tsx +252 -0
- package/accordion-group/AccordionGroup.test.js +116 -0
- package/accordion-group/AccordionGroupAccordion.d.ts +4 -0
- package/accordion-group/AccordionGroupAccordion.js +43 -0
- package/accordion-group/types.d.ts +67 -0
- package/accordion-group/types.js +5 -0
- package/alert/Alert.d.ts +4 -0
- package/{dist/alert → alert}/Alert.js +45 -159
- package/alert/Alert.stories.tsx +198 -0
- package/alert/Alert.test.js +92 -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 +61 -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 +51 -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 +97 -0
- package/box/Box.stories.tsx +119 -0
- package/box/Box.test.js +18 -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 +125 -0
- package/bulleted-list/BulletedList.stories.tsx +206 -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 +144 -0
- package/button/Button.stories.tsx +425 -0
- package/button/Button.test.js +46 -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 +143 -0
- package/card/Card.stories.tsx +171 -0
- package/card/Card.test.js +50 -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 +269 -0
- package/checkbox/Checkbox.stories.tsx +276 -0
- package/checkbox/Checkbox.test.js +228 -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 +140 -0
- package/chip/Chip.stories.tsx +214 -0
- package/chip/Chip.test.js +54 -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 +146 -0
- package/common/coreTokens.js +167 -0
- package/common/utils.d.ts +1 -0
- package/{dist/common → common}/utils.js +4 -4
- package/common/variables.d.ts +1499 -0
- package/common/variables.js +1378 -0
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +258 -0
- package/date-input/DateInput.d.ts +4 -0
- package/date-input/DateInput.js +271 -0
- package/date-input/DateInput.stories.tsx +314 -0
- package/date-input/DateInput.test.js +849 -0
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +146 -0
- package/date-input/Icons.d.ts +6 -0
- package/date-input/Icons.js +75 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +126 -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 +131 -0
- package/dialog/Dialog.stories.tsx +195 -0
- package/dialog/Dialog.test.js +369 -0
- package/dialog/types.d.ts +31 -0
- package/dialog/types.js +5 -0
- package/dropdown/Dropdown.d.ts +4 -0
- package/dropdown/Dropdown.js +388 -0
- package/dropdown/Dropdown.stories.tsx +438 -0
- package/dropdown/Dropdown.test.js +586 -0
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +74 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +79 -0
- package/dropdown/types.d.ts +100 -0
- package/dropdown/types.js +5 -0
- package/file-input/FileInput.d.ts +4 -0
- package/file-input/FileInput.js +547 -0
- package/file-input/FileInput.stories.tsx +618 -0
- package/file-input/FileInput.test.js +457 -0
- package/file-input/FileItem.d.ts +4 -0
- package/file-input/FileItem.js +162 -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 +71 -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 +165 -0
- package/footer/Footer.stories.tsx +152 -0
- package/footer/Footer.test.js +99 -0
- package/footer/Icons.d.ts +2 -0
- package/footer/Icons.js +77 -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 +91 -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 +276 -0
- package/header/Header.stories.tsx +251 -0
- package/header/Header.test.js +79 -0
- package/header/Icons.d.ts +2 -0
- package/header/Icons.js +34 -0
- package/header/types.d.ts +34 -0
- package/header/types.js +5 -0
- package/heading/Heading.d.ts +4 -0
- package/{dist/heading → heading}/Heading.js +32 -91
- package/heading/Heading.stories.tsx +54 -0
- package/heading/Heading.test.js +186 -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 +85 -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 +51 -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 +174 -0
- package/layout/ApplicationLayout.stories.tsx +162 -0
- package/layout/Icons.d.ts +8 -0
- package/layout/Icons.js +62 -0
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +19 -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 +136 -0
- package/link/Link.stories.tsx +253 -0
- package/link/Link.test.js +81 -0
- package/link/types.d.ts +54 -0
- package/link/types.js +5 -0
- package/main.d.ts +46 -0
- package/{dist/main.js → main.js} +130 -112
- package/nav-tabs/NavTabs.d.ts +8 -0
- package/nav-tabs/NavTabs.js +122 -0
- package/nav-tabs/NavTabs.stories.tsx +274 -0
- package/nav-tabs/NavTabs.test.js +82 -0
- package/nav-tabs/Tab.d.ts +4 -0
- package/nav-tabs/Tab.js +146 -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 +80 -0
- package/number-input/NumberInput.stories.tsx +160 -0
- package/number-input/NumberInput.test.js +768 -0
- package/number-input/types.d.ts +130 -0
- package/number-input/types.js +5 -0
- package/package.json +47 -41
- package/paginator/Icons.d.ts +5 -0
- package/paginator/Icons.js +54 -0
- package/paginator/Paginator.d.ts +4 -0
- package/paginator/Paginator.js +163 -0
- package/paginator/Paginator.stories.tsx +87 -0
- package/paginator/Paginator.test.js +318 -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 +38 -0
- package/paragraph/Paragraph.stories.tsx +44 -0
- package/password-input/Icons.d.ts +6 -0
- package/password-input/Icons.js +39 -0
- package/password-input/PasswordInput.d.ts +4 -0
- package/password-input/PasswordInput.js +119 -0
- package/password-input/PasswordInput.stories.tsx +132 -0
- package/password-input/PasswordInput.test.js +174 -0
- package/password-input/types.d.ts +110 -0
- package/password-input/types.js +5 -0
- package/progress-bar/ProgressBar.d.ts +4 -0
- package/progress-bar/ProgressBar.js +176 -0
- package/progress-bar/ProgressBar.stories.jsx +93 -0
- package/progress-bar/ProgressBar.test.js +110 -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 +117 -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 +156 -0
- package/radio-group/RadioGroup.d.ts +4 -0
- package/radio-group/RadioGroup.js +281 -0
- package/radio-group/RadioGroup.stories.tsx +214 -0
- package/radio-group/RadioGroup.test.js +749 -0
- package/radio-group/types.d.ts +114 -0
- package/radio-group/types.js +5 -0
- package/resultsetTable/Icons.d.ts +7 -0
- package/resultsetTable/Icons.js +51 -0
- package/resultsetTable/ResultsetTable.d.ts +4 -0
- package/resultsetTable/ResultsetTable.js +195 -0
- package/resultsetTable/ResultsetTable.stories.tsx +300 -0
- package/resultsetTable/ResultsetTable.test.js +325 -0
- package/resultsetTable/types.d.ts +67 -0
- package/resultsetTable/types.js +5 -0
- package/select/Icons.d.ts +10 -0
- package/select/Icons.js +93 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +169 -0
- package/select/Option.d.ts +4 -0
- package/select/Option.js +97 -0
- package/select/Select.d.ts +4 -0
- package/select/Select.js +666 -0
- package/select/Select.stories.tsx +971 -0
- package/select/Select.test.js +2228 -0
- package/select/types.d.ts +210 -0
- package/select/types.js +5 -0
- package/sidenav/Icons.d.ts +7 -0
- package/sidenav/Icons.js +51 -0
- package/sidenav/Sidenav.d.ts +10 -0
- package/sidenav/Sidenav.js +238 -0
- package/sidenav/Sidenav.stories.tsx +282 -0
- package/sidenav/Sidenav.test.js +44 -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 +342 -0
- package/slider/Slider.stories.tsx +240 -0
- package/slider/Slider.test.js +250 -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 +244 -0
- package/spinner/Spinner.stories.jsx +129 -0
- package/spinner/Spinner.test.js +64 -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 +262 -0
- package/switch/Switch.stories.tsx +171 -0
- package/switch/Switch.test.js +225 -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 +14 -28
- package/table/Table.stories.jsx +356 -0
- package/table/Table.test.js +26 -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 +132 -0
- package/tabs/Tabs.d.ts +4 -0
- package/tabs/Tabs.js +461 -0
- package/tabs/Tabs.stories.tsx +226 -0
- package/tabs/Tabs.test.js +350 -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 +181 -0
- package/tag/Tag.stories.tsx +155 -0
- package/tag/Tag.test.js +60 -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 +60 -0
- package/text-input/Suggestion.d.ts +4 -0
- package/text-input/Suggestion.js +84 -0
- package/text-input/Suggestions.d.ts +4 -0
- package/text-input/Suggestions.js +134 -0
- package/text-input/TextInput.d.ts +4 -0
- package/text-input/TextInput.js +651 -0
- package/text-input/TextInput.stories.tsx +608 -0
- package/text-input/TextInput.test.js +1834 -0
- package/text-input/types.d.ts +203 -0
- package/text-input/types.js +5 -0
- package/textarea/Textarea.d.ts +4 -0
- package/textarea/Textarea.js +278 -0
- package/textarea/Textarea.stories.jsx +224 -0
- package/textarea/Textarea.test.js +479 -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 +241 -0
- package/toggle-group/ToggleGroup.stories.tsx +218 -0
- package/toggle-group/ToggleGroup.test.js +170 -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 +32 -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} +3 -3
- package/useTranslatedLabels.d.ts +85 -0
- package/useTranslatedLabels.js +20 -0
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +108 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +138 -0
- package/wizard/Wizard.d.ts +4 -0
- package/wizard/Wizard.js +285 -0
- package/wizard/Wizard.stories.tsx +253 -0
- package/wizard/Wizard.test.js +141 -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 -248
- package/dist/accordion/Accordion.js +0 -353
- package/dist/accordion-group/AccordionGroup.js +0 -186
- package/dist/alert/index.d.ts +0 -51
- package/dist/badge/Badge.js +0 -63
- package/dist/box/Box.js +0 -156
- package/dist/button/Button.js +0 -238
- package/dist/card/Card.js +0 -254
- package/dist/checkbox/Checkbox.js +0 -300
- package/dist/checkbox/Checkbox.stories.js +0 -144
- package/dist/checkbox/readme.md +0 -116
- package/dist/chip/Chip.js +0 -265
- package/dist/common/OpenSans.css +0 -81
- package/dist/common/RequiredComponent.js +0 -40
- package/dist/common/variables.js +0 -1569
- package/dist/date/Date.js +0 -379
- package/dist/date/Date.stories.js +0 -205
- package/dist/date/readme.md +0 -73
- package/dist/dialog/Dialog.js +0 -218
- package/dist/dropdown/Dropdown.js +0 -544
- package/dist/file-input/FileInput.js +0 -644
- package/dist/file-input/FileItem.js +0 -280
- package/dist/file-input/index.d.ts +0 -81
- package/dist/footer/Footer.js +0 -395
- package/dist/footer/dxc_logo.svg +0 -15
- package/dist/footer/readme.md +0 -41
- package/dist/header/Header.js +0 -403
- package/dist/header/Header.stories.js +0 -176
- package/dist/header/close_icon.svg +0 -1
- package/dist/header/dxc_logo_black.svg +0 -8
- 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 -707
- 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 -237
- package/dist/link/readme.md +0 -51
- package/dist/main.d.ts +0 -8
- package/dist/new-date/NewDate.js +0 -400
- package/dist/new-date/index.d.ts +0 -95
- package/dist/new-select/NewSelect.js +0 -836
- package/dist/new-select/index.d.ts +0 -53
- package/dist/new-textarea/NewTextarea.js +0 -369
- package/dist/new-textarea/index.d.ts +0 -117
- package/dist/number/Number.js +0 -136
- package/dist/number/NumberContext.js +0 -16
- package/dist/number/index.d.ts +0 -113
- package/dist/paginator/Paginator.js +0 -289
- 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/password-input/PasswordInput.js +0 -198
- package/dist/password-input/index.d.ts +0 -94
- package/dist/progress-bar/ProgressBar.js +0 -242
- 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 -358
- 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 -549
- package/dist/sidenav/Sidenav.js +0 -179
- package/dist/slider/Slider.js +0 -394
- package/dist/slider/Slider.stories.js +0 -241
- package/dist/slider/readme.md +0 -64
- package/dist/spinner/Spinner.js +0 -381
- 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 -282
- package/dist/text-input/TextInput.js +0 -971
- package/dist/text-input/index.d.ts +0 -135
- package/dist/textarea/Textarea.js +0 -264
- 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 -327
- package/dist/upload/Upload.js +0 -205
- package/dist/upload/Upload.stories.js +0 -72
- package/dist/upload/buttons-upload/ButtonsUpload.js +0 -139
- 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 -329
- 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 -175
- 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 -411
- package/dist/wizard/invalid_icon.svg +0 -5
- package/dist/wizard/valid_icon.svg +0 -5
- 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 -145
- package/test/FileInput.test.js +0 -201
- 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/NewDate.test.js +0 -232
- package/test/NewTextarea.test.js +0 -195
- package/test/Number.test.js +0 -257
- package/test/Paginator.test.js +0 -177
- package/test/PasswordInput.test.js +0 -83
- package/test/ProgressBar.test.js +0 -35
- package/test/Radio.test.js +0 -37
- package/test/ResultsetTable.test.js +0 -329
- package/test/Select.test.js +0 -212
- package/test/Sidenav.test.js +0 -45
- package/test/Slider.test.js +0 -82
- package/test/Spinner.test.js +0 -32
- 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/TextInput.test.js +0 -732
- package/test/ToggleGroup.test.js +0 -85
- 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,228 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _react2 = require("@testing-library/react");
|
|
8
|
+
|
|
9
|
+
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
10
|
+
|
|
11
|
+
var _Checkbox = _interopRequireDefault(require("./Checkbox.tsx"));
|
|
12
|
+
|
|
13
|
+
describe("Checkbox component tests", function () {
|
|
14
|
+
test("Checkbox renders with correct aria-labelledby and aria-required", function () {
|
|
15
|
+
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
16
|
+
label: "Checkbox"
|
|
17
|
+
})),
|
|
18
|
+
getByText = _render.getByText,
|
|
19
|
+
getByRole = _render.getByRole;
|
|
20
|
+
|
|
21
|
+
var labelId = getByText("Checkbox").getAttribute("id");
|
|
22
|
+
expect(getByRole("checkbox").getAttribute("aria-labelledby")).toBe(labelId);
|
|
23
|
+
expect(getByRole("checkbox").getAttribute("aria-required")).toBe("true");
|
|
24
|
+
expect(getByRole("checkbox").getAttribute("aria-readonly")).toBe("false");
|
|
25
|
+
expect(getByRole("checkbox").getAttribute("aria-disabled")).toBe("false");
|
|
26
|
+
});
|
|
27
|
+
test("Optional checkbox renders with correct aria-required", function () {
|
|
28
|
+
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
29
|
+
label: "Checkbox",
|
|
30
|
+
optional: true
|
|
31
|
+
})),
|
|
32
|
+
getByRole = _render2.getByRole;
|
|
33
|
+
|
|
34
|
+
expect(getByRole("checkbox").getAttribute("aria-required")).toBe("false");
|
|
35
|
+
});
|
|
36
|
+
test("Calls correct function onChange", function () {
|
|
37
|
+
var onChange = jest.fn();
|
|
38
|
+
|
|
39
|
+
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
40
|
+
label: "Checkbox",
|
|
41
|
+
onChange: onChange
|
|
42
|
+
})),
|
|
43
|
+
getByText = _render3.getByText;
|
|
44
|
+
|
|
45
|
+
_react2.fireEvent.click(getByText("Checkbox"));
|
|
46
|
+
|
|
47
|
+
expect(onChange).toHaveBeenCalled();
|
|
48
|
+
});
|
|
49
|
+
test("Read-only checkbox does not trigger onChange function", function () {
|
|
50
|
+
var onChange = jest.fn();
|
|
51
|
+
|
|
52
|
+
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
53
|
+
label: "Checkbox",
|
|
54
|
+
onChange: onChange,
|
|
55
|
+
readOnly: true
|
|
56
|
+
})),
|
|
57
|
+
getByRole = _render4.getByRole;
|
|
58
|
+
|
|
59
|
+
var checkbox = getByRole("checkbox");
|
|
60
|
+
expect(checkbox.getAttribute("aria-readonly")).toBe("true");
|
|
61
|
+
|
|
62
|
+
_react2.fireEvent.click(checkbox);
|
|
63
|
+
|
|
64
|
+
expect(onChange).not.toHaveBeenCalled();
|
|
65
|
+
});
|
|
66
|
+
test("Read-only checkbox sends its value on submit", function () {
|
|
67
|
+
var handlerOnSubmit = jest.fn(function (e) {
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
var formData = new FormData(e.target);
|
|
70
|
+
var formProps = Object.fromEntries(formData);
|
|
71
|
+
expect(formProps).toStrictEqual({
|
|
72
|
+
data: "checked"
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement("form", {
|
|
77
|
+
onSubmit: handlerOnSubmit
|
|
78
|
+
}, /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
79
|
+
label: "Checkbox",
|
|
80
|
+
name: "data",
|
|
81
|
+
value: "checked",
|
|
82
|
+
readOnly: true,
|
|
83
|
+
defaultChecked: true
|
|
84
|
+
}), /*#__PURE__*/_react["default"].createElement("button", {
|
|
85
|
+
type: "submit"
|
|
86
|
+
}, "Submit"))),
|
|
87
|
+
getByText = _render5.getByText;
|
|
88
|
+
|
|
89
|
+
var submit = getByText("Submit");
|
|
90
|
+
|
|
91
|
+
_userEvent["default"].click(submit);
|
|
92
|
+
|
|
93
|
+
expect(handlerOnSubmit).toHaveBeenCalled();
|
|
94
|
+
});
|
|
95
|
+
test("Read-only checkbox doesn't change its value with Space key", function () {
|
|
96
|
+
var onChange = jest.fn();
|
|
97
|
+
|
|
98
|
+
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
99
|
+
label: "Checkbox",
|
|
100
|
+
onChange: onChange,
|
|
101
|
+
readOnly: true
|
|
102
|
+
})),
|
|
103
|
+
getByRole = _render6.getByRole;
|
|
104
|
+
|
|
105
|
+
var checkbox = getByRole("checkbox");
|
|
106
|
+
|
|
107
|
+
_userEvent["default"].tab();
|
|
108
|
+
|
|
109
|
+
expect(document.activeElement === checkbox).toBeTruthy();
|
|
110
|
+
|
|
111
|
+
_react2.fireEvent.keyDown(checkbox, {
|
|
112
|
+
key: " ",
|
|
113
|
+
code: "Space",
|
|
114
|
+
keyCode: 32,
|
|
115
|
+
charCode: 32
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
expect(onChange).not.toHaveBeenCalled();
|
|
119
|
+
});
|
|
120
|
+
test("Uncontrolled checkbox", function () {
|
|
121
|
+
var onChange = jest.fn();
|
|
122
|
+
var component = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
123
|
+
label: "Checkbox",
|
|
124
|
+
onChange: onChange,
|
|
125
|
+
name: "test"
|
|
126
|
+
}));
|
|
127
|
+
var visibleCheckbox = component.getByText("Checkbox");
|
|
128
|
+
var input = component.getByRole("checkbox");
|
|
129
|
+
var submitInput = component.container.querySelector("input[name=\"test\"]");
|
|
130
|
+
expect(input.getAttribute("aria-checked")).toBe("false");
|
|
131
|
+
expect(submitInput.checked).toBe(false);
|
|
132
|
+
|
|
133
|
+
_react2.fireEvent.click(visibleCheckbox);
|
|
134
|
+
|
|
135
|
+
expect(onChange).toHaveBeenCalled();
|
|
136
|
+
expect(onChange).toHaveBeenCalledWith(true);
|
|
137
|
+
expect(input.getAttribute("aria-checked")).toBe("true");
|
|
138
|
+
expect(submitInput.checked).toBe(true);
|
|
139
|
+
});
|
|
140
|
+
test("Controlled checkbox", function () {
|
|
141
|
+
var onChange = jest.fn();
|
|
142
|
+
var component = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
143
|
+
label: "Checkbox",
|
|
144
|
+
checked: false,
|
|
145
|
+
onChange: onChange,
|
|
146
|
+
name: "test"
|
|
147
|
+
}));
|
|
148
|
+
var input = component.getByRole("checkbox");
|
|
149
|
+
var visibleCheckbox = component.getByText("Checkbox");
|
|
150
|
+
var submitInput = component.container.querySelector("input[name=\"test\"]");
|
|
151
|
+
|
|
152
|
+
_react2.fireEvent.click(visibleCheckbox);
|
|
153
|
+
|
|
154
|
+
expect(onChange).toHaveBeenCalled();
|
|
155
|
+
expect(onChange).toHaveBeenCalledWith(true);
|
|
156
|
+
expect(input.getAttribute("aria-checked")).toBe("false");
|
|
157
|
+
expect(submitInput.checked).toBe(false);
|
|
158
|
+
});
|
|
159
|
+
test("Renders with correct initial value and initial state when it is uncontrolled", function () {
|
|
160
|
+
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
161
|
+
label: "Default label",
|
|
162
|
+
defaultChecked: true,
|
|
163
|
+
value: "test-defaultChecked",
|
|
164
|
+
name: "test"
|
|
165
|
+
})),
|
|
166
|
+
getByRole = _render7.getByRole,
|
|
167
|
+
container = _render7.container;
|
|
168
|
+
|
|
169
|
+
var checkbox = getByRole("checkbox");
|
|
170
|
+
var submitInput = container.querySelector("input[name=\"test\"]");
|
|
171
|
+
expect(submitInput.value).toBe("test-defaultChecked");
|
|
172
|
+
expect(checkbox.getAttribute("aria-checked")).toBe("true");
|
|
173
|
+
expect(submitInput.checked).toBe(true);
|
|
174
|
+
});
|
|
175
|
+
test("Test disable keyboard and mouse interactions", function () {
|
|
176
|
+
var onChange = jest.fn();
|
|
177
|
+
|
|
178
|
+
var _render8 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
179
|
+
label: "Checkbox",
|
|
180
|
+
onChange: onChange,
|
|
181
|
+
disabled: true,
|
|
182
|
+
name: "test"
|
|
183
|
+
})),
|
|
184
|
+
getByRole = _render8.getByRole,
|
|
185
|
+
getByText = _render8.getByText,
|
|
186
|
+
container = _render8.container;
|
|
187
|
+
|
|
188
|
+
var input = getByRole("checkbox");
|
|
189
|
+
var visibleCheckbox = getByText("Checkbox");
|
|
190
|
+
var submitInput = container.querySelector("input[name=\"test\"]");
|
|
191
|
+
|
|
192
|
+
_react2.fireEvent.click(visibleCheckbox);
|
|
193
|
+
|
|
194
|
+
expect(onChange).toHaveBeenCalledTimes(0);
|
|
195
|
+
expect(input.getAttribute("aria-checked")).toBe("false");
|
|
196
|
+
expect(input.getAttribute("aria-disabled")).toBe("true");
|
|
197
|
+
expect(submitInput.checked).toBe(false);
|
|
198
|
+
|
|
199
|
+
_userEvent["default"].tab();
|
|
200
|
+
|
|
201
|
+
expect(document.activeElement === input).toBeFalsy();
|
|
202
|
+
});
|
|
203
|
+
test("Test keyboard interactions", function () {
|
|
204
|
+
var onChange = jest.fn();
|
|
205
|
+
|
|
206
|
+
var _render9 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
207
|
+
label: "Checkbox",
|
|
208
|
+
name: "test",
|
|
209
|
+
onChange: onChange
|
|
210
|
+
})),
|
|
211
|
+
getByRole = _render9.getByRole;
|
|
212
|
+
|
|
213
|
+
var checkbox = getByRole("checkbox");
|
|
214
|
+
|
|
215
|
+
_userEvent["default"].tab();
|
|
216
|
+
|
|
217
|
+
expect(document.activeElement === checkbox).toBeTruthy();
|
|
218
|
+
|
|
219
|
+
_react2.fireEvent.keyDown(checkbox, {
|
|
220
|
+
key: " ",
|
|
221
|
+
code: "Space",
|
|
222
|
+
keyCode: 32,
|
|
223
|
+
charCode: 32
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
expect(onChange).toHaveBeenCalledWith(true);
|
|
227
|
+
});
|
|
228
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
declare type Space = "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
2
|
+
declare type Margin = {
|
|
3
|
+
top?: Space;
|
|
4
|
+
bottom?: Space;
|
|
5
|
+
left?: Space;
|
|
6
|
+
right?: Space;
|
|
7
|
+
};
|
|
8
|
+
declare type Props = {
|
|
9
|
+
/**
|
|
10
|
+
* Initial state of the checkbox, only when it is uncontrolled.
|
|
11
|
+
*/
|
|
12
|
+
defaultChecked?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* If true, the component is checked. If undefined the component will be
|
|
15
|
+
* uncontrolled and the value will be managed internally by the component.
|
|
16
|
+
*/
|
|
17
|
+
checked?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Will be passed to the value attribute of the html input element.
|
|
20
|
+
* When inside a form, this value will be only submitted if the checkbox is checked.
|
|
21
|
+
*/
|
|
22
|
+
value?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Text to be placed next to the checkbox.
|
|
25
|
+
*/
|
|
26
|
+
label?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Whether the label should appear after or before the checkbox.
|
|
29
|
+
*/
|
|
30
|
+
labelPosition?: "before" | "after";
|
|
31
|
+
/**
|
|
32
|
+
* Name attribute of the input element.
|
|
33
|
+
*/
|
|
34
|
+
name?: string;
|
|
35
|
+
/**
|
|
36
|
+
* If true, the component will be disabled.
|
|
37
|
+
*/
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* If true, the component will display '(Optional)' next to the label.
|
|
41
|
+
*/
|
|
42
|
+
optional?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* If true, the component will not be mutable, meaning the user can not edit the control.
|
|
45
|
+
*/
|
|
46
|
+
readOnly?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* This function will be called when the user clicks the checkbox.
|
|
49
|
+
* The new value will be passed as a parameter.
|
|
50
|
+
*/
|
|
51
|
+
onChange?: (value: boolean) => void;
|
|
52
|
+
/**
|
|
53
|
+
* Size of the margin to be applied to the component
|
|
54
|
+
* ('xxsmall' | 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge').
|
|
55
|
+
* You can pass an object with 'top', 'bottom', 'left' and 'right' properties
|
|
56
|
+
* in order to specify different margin sizes.
|
|
57
|
+
*/
|
|
58
|
+
margin?: Space | Margin;
|
|
59
|
+
/**
|
|
60
|
+
* Size of the component.
|
|
61
|
+
*/
|
|
62
|
+
size?: "small" | "medium" | "large" | "fillParent" | "fitContent";
|
|
63
|
+
/**
|
|
64
|
+
* Value of the tabindex.
|
|
65
|
+
*/
|
|
66
|
+
tabIndex?: number;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Reference to the component.
|
|
70
|
+
*/
|
|
71
|
+
export declare type RefType = HTMLDivElement;
|
|
72
|
+
export default Props;
|
package/chip/Chip.d.ts
ADDED
package/chip/Chip.js
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports["default"] = void 0;
|
|
11
|
+
|
|
12
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
13
|
+
|
|
14
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireDefault(require("react"));
|
|
17
|
+
|
|
18
|
+
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
|
+
|
|
20
|
+
var _variables = require("../common/variables");
|
|
21
|
+
|
|
22
|
+
var _utils = require("../common/utils");
|
|
23
|
+
|
|
24
|
+
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
25
|
+
|
|
26
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
27
|
+
|
|
28
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
29
|
+
|
|
30
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
31
|
+
|
|
32
|
+
var DxcChip = function DxcChip(_ref) {
|
|
33
|
+
var label = _ref.label,
|
|
34
|
+
suffixIcon = _ref.suffixIcon,
|
|
35
|
+
prefixIcon = _ref.prefixIcon,
|
|
36
|
+
onClickSuffix = _ref.onClickSuffix,
|
|
37
|
+
onClickPrefix = _ref.onClickPrefix,
|
|
38
|
+
disabled = _ref.disabled,
|
|
39
|
+
margin = _ref.margin,
|
|
40
|
+
_ref$tabIndex = _ref.tabIndex,
|
|
41
|
+
tabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex;
|
|
42
|
+
var colorsTheme = (0, _useTheme["default"])();
|
|
43
|
+
return /*#__PURE__*/_react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
44
|
+
theme: colorsTheme.chip
|
|
45
|
+
}, /*#__PURE__*/_react["default"].createElement(Chip, {
|
|
46
|
+
disabled: disabled,
|
|
47
|
+
margin: margin
|
|
48
|
+
}, prefixIcon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
|
|
49
|
+
role: typeof onClickPrefix === "function" ? "button" : undefined,
|
|
50
|
+
disabled: disabled,
|
|
51
|
+
interactuable: typeof onClickPrefix === "function" && !disabled,
|
|
52
|
+
tabIndex: typeof onClickPrefix === "function" && !disabled ? tabIndex : -1,
|
|
53
|
+
onClick: function onClick() {
|
|
54
|
+
return onClickPrefix && !disabled && onClickPrefix();
|
|
55
|
+
}
|
|
56
|
+
}, typeof prefixIcon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
57
|
+
src: prefixIcon
|
|
58
|
+
}) : prefixIcon), label && /*#__PURE__*/_react["default"].createElement(LabelContainer, {
|
|
59
|
+
disabled: disabled
|
|
60
|
+
}, label), suffixIcon && /*#__PURE__*/_react["default"].createElement(IconContainer, {
|
|
61
|
+
role: typeof onClickSuffix === "function" ? "button" : undefined,
|
|
62
|
+
disabled: disabled,
|
|
63
|
+
interactuable: typeof onClickSuffix === "function" && !disabled,
|
|
64
|
+
tabIndex: typeof onClickSuffix === "function" && !disabled ? tabIndex : -1,
|
|
65
|
+
onClick: function onClick() {
|
|
66
|
+
return !disabled && (onClickSuffix === null || onClickSuffix === void 0 ? void 0 : onClickSuffix());
|
|
67
|
+
}
|
|
68
|
+
}, typeof suffixIcon === "string" ? /*#__PURE__*/_react["default"].createElement("img", {
|
|
69
|
+
src: suffixIcon
|
|
70
|
+
}) : suffixIcon)));
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
var calculateWidth = function calculateWidth(margin) {
|
|
74
|
+
return "calc(100% - ".concat((0, _utils.getMargin)(margin, "left"), " - ").concat((0, _utils.getMargin)(margin, "right"), ")");
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
var Chip = _styledComponents["default"].div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2["default"])(["\n box-sizing: border-box;\n display: inline-flex;\n align-items: center;\n gap: ", ";\n min-height: 40px;\n max-width: ", ";\n background-color: ", ";\n border-radius: ", ";\n border-width: ", ";\n border-style: ", ";\n border-color: ", ";\n\n padding-top: ", ";\n padding-bottom: ", ";\n padding-left: ", ";\n padding-right: ", ";\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n cursor: ", ";\n"])), function (props) {
|
|
78
|
+
return props.theme.iconSpacing;
|
|
79
|
+
}, function (props) {
|
|
80
|
+
return calculateWidth(props.margin);
|
|
81
|
+
}, function (props) {
|
|
82
|
+
return props.disabled && props.theme.disabledBackgroundColor || props.theme.backgroundColor;
|
|
83
|
+
}, function (props) {
|
|
84
|
+
return props.theme.borderRadius;
|
|
85
|
+
}, function (props) {
|
|
86
|
+
return props.theme.borderThickness;
|
|
87
|
+
}, function (props) {
|
|
88
|
+
return props.theme.borderStyle;
|
|
89
|
+
}, function (props) {
|
|
90
|
+
return props.theme.borderColor;
|
|
91
|
+
}, function (props) {
|
|
92
|
+
return props.theme.contentPaddingTop;
|
|
93
|
+
}, function (props) {
|
|
94
|
+
return props.theme.contentPaddingBottom;
|
|
95
|
+
}, function (props) {
|
|
96
|
+
return props.theme.contentPaddingLeft;
|
|
97
|
+
}, function (props) {
|
|
98
|
+
return props.theme.contentPaddingRight;
|
|
99
|
+
}, function (props) {
|
|
100
|
+
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
101
|
+
}, function (props) {
|
|
102
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
|
103
|
+
}, function (props) {
|
|
104
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
|
|
105
|
+
}, function (props) {
|
|
106
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
|
|
107
|
+
}, function (props) {
|
|
108
|
+
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
109
|
+
}, function (_ref2) {
|
|
110
|
+
var disabled = _ref2.disabled;
|
|
111
|
+
return disabled && "not-allowed";
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
var LabelContainer = _styledComponents["default"].span(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n font-family: ", ";\n font-weight: ", ";\n font-style: ", ";\n color: ", ";\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n"])), function (props) {
|
|
115
|
+
return props.theme.fontSize;
|
|
116
|
+
}, function (props) {
|
|
117
|
+
return props.theme.fontFamily;
|
|
118
|
+
}, function (props) {
|
|
119
|
+
return props.theme.fontWeight;
|
|
120
|
+
}, function (props) {
|
|
121
|
+
return props.theme.fontStyle;
|
|
122
|
+
}, function (props) {
|
|
123
|
+
return props.disabled ? props.theme.disabledFontColor : props.theme.fontColor;
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
var IconContainer = _styledComponents["default"].div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n border-radius: 0.25rem;\n color: ", ";\n ", "\n\n ", "\n\n img,\n svg {\n width: ", ";\n height: ", ";\n }\n"])), function (props) {
|
|
127
|
+
return props.disabled ? props.theme.disabledIconColor : props.theme.iconColor;
|
|
128
|
+
}, function (_ref3) {
|
|
129
|
+
var interactuable = _ref3.interactuable;
|
|
130
|
+
return interactuable && "cursor: pointer;";
|
|
131
|
+
}, function (props) {
|
|
132
|
+
return props.interactuable && "\n &:hover {\n color: ".concat(props.theme.hoverIconColor, ";\n }\n &:focus,\n &:focus-visible {\n outline: ").concat(props.theme.focusBorderThickness, " solid ").concat(props.theme.focusColor, ";\n }\n &:active {\n color: ").concat(props.theme.activeIconColor, ";\n }\n ");
|
|
133
|
+
}, function (props) {
|
|
134
|
+
return props.theme.iconSize;
|
|
135
|
+
}, function (props) {
|
|
136
|
+
return props.theme.iconSize;
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
var _default = DxcChip;
|
|
140
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { userEvent, within } from "@storybook/testing-library";
|
|
3
|
+
import DxcChip from "./Chip";
|
|
4
|
+
import Title from "../../.storybook/components/Title";
|
|
5
|
+
import ExampleContainer from "../../.storybook/components/ExampleContainer";
|
|
6
|
+
import { HalstackProvider } from "../HalstackContext";
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
title: "Chip",
|
|
10
|
+
component: DxcChip,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const iconSVG = (
|
|
14
|
+
<svg
|
|
15
|
+
version="1.1"
|
|
16
|
+
id="Capa_1"
|
|
17
|
+
x="0px"
|
|
18
|
+
y="0px"
|
|
19
|
+
width="438.536px"
|
|
20
|
+
height="438.536px"
|
|
21
|
+
viewBox="0 0 438.536 438.536"
|
|
22
|
+
fill="currentColor"
|
|
23
|
+
>
|
|
24
|
+
<g>
|
|
25
|
+
<path
|
|
26
|
+
d="M414.41,24.123C398.333,8.042,378.963,0,356.315,0H82.228C59.58,0,40.21,8.042,24.126,24.123
|
|
27
|
+
C8.045,40.207,0.003,59.576,0.003,82.225v274.084c0,22.647,8.042,42.018,24.123,58.102c16.084,16.084,35.454,24.126,58.102,24.126
|
|
28
|
+
h274.084c22.648,0,42.018-8.042,58.095-24.126c16.084-16.084,24.126-35.454,24.126-58.102V82.225
|
|
29
|
+
C438.532,59.576,430.49,40.204,414.41,24.123z M373.155,225.548h-49.963V406.84h-74.802V225.548H210.99V163.02h37.401v-37.402
|
|
30
|
+
c0-26.838,6.283-47.107,18.843-60.813c12.559-13.706,33.304-20.555,62.242-20.555h49.963v62.526h-31.401
|
|
31
|
+
c-10.663,0-17.467,1.853-20.417,5.568c-2.949,3.711-4.428,10.23-4.428,19.558v31.119h56.534L373.155,225.548z"
|
|
32
|
+
/>
|
|
33
|
+
</g>
|
|
34
|
+
</svg>
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const smallIconSVG = (
|
|
38
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" height="20" width="20">
|
|
39
|
+
<path d="m10 17-1.042-.938q-2.083-1.854-3.437-3.177-1.354-1.323-2.136-2.354Q2.604 9.5 2.302 8.646 2 7.792 2 6.896q0-1.854 1.271-3.125T6.396 2.5q1.021 0 1.979.438.958.437 1.625 1.229.667-.792 1.625-1.229.958-.438 1.979-.438 1.854 0 3.125 1.271T18 6.896q0 .896-.292 1.729-.291.833-1.073 1.854-.781 1.021-2.145 2.365-1.365 1.344-3.49 3.26Zm0-2.021q1.938-1.729 3.188-2.948 1.25-1.219 1.989-2.125.74-.906 1.031-1.614.292-.709.292-1.396 0-1.229-.833-2.063Q14.833 4 13.604 4q-.729 0-1.364.302-.636.302-1.094.844L10.417 6h-.834l-.729-.854q-.458-.542-1.114-.844Q7.083 4 6.396 4q-1.229 0-2.063.833-.833.834-.833 2.063 0 .687.271 1.364.271.678.989 1.573.719.896 1.98 2.125Q8 13.188 10 14.979Zm0-5.5Z" />
|
|
40
|
+
</svg>
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
const opinionatedTheme = {
|
|
44
|
+
chip: {
|
|
45
|
+
baseColor: "#e6e6e6",
|
|
46
|
+
fontColor: "#000000",
|
|
47
|
+
iconColor: "#4d4d4d",
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const Chromatic = () => (
|
|
52
|
+
<>
|
|
53
|
+
<ExampleContainer>
|
|
54
|
+
<Title title="Basic chip" theme="light" level={4} />
|
|
55
|
+
<DxcChip label="Default Chip" />
|
|
56
|
+
</ExampleContainer>
|
|
57
|
+
<ExampleContainer>
|
|
58
|
+
<Title title="Chip with prefix SVG (small icon)" theme="light" level={4} />
|
|
59
|
+
<DxcChip label="Chip with prefix" prefixIcon={smallIconSVG} />
|
|
60
|
+
</ExampleContainer>
|
|
61
|
+
<ExampleContainer>
|
|
62
|
+
<Title title="Chip with suffix SVG (large icon)" theme="light" level={4} />
|
|
63
|
+
<DxcChip label="Chip with suffix" suffixIcon={iconSVG} />
|
|
64
|
+
</ExampleContainer>
|
|
65
|
+
<ExampleContainer>
|
|
66
|
+
<Title title="Chip with prefix (SVG) and suffix (URL)" theme="light" level={4} />
|
|
67
|
+
<DxcChip
|
|
68
|
+
label="Chip with prefix and suffix"
|
|
69
|
+
prefixIcon={iconSVG}
|
|
70
|
+
suffixIcon="https://upload.wikimedia.org/wikipedia/commons/e/e0/Check_green_icon.svg"
|
|
71
|
+
/>
|
|
72
|
+
</ExampleContainer>
|
|
73
|
+
<ExampleContainer>
|
|
74
|
+
<Title title="Disabled chip" theme="light" level={4} />
|
|
75
|
+
<DxcChip
|
|
76
|
+
label="Disabled"
|
|
77
|
+
disabled
|
|
78
|
+
prefixIcon={iconSVG}
|
|
79
|
+
suffixIcon="https://upload.wikimedia.org/wikipedia/commons/e/e0/Check_green_icon.svg"
|
|
80
|
+
/>
|
|
81
|
+
</ExampleContainer>
|
|
82
|
+
<ExampleContainer>
|
|
83
|
+
<Title title="Chip with ellipsis" theme="light" level={4} />
|
|
84
|
+
<div style={{ width: "200px" }}>
|
|
85
|
+
<DxcChip label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fg ssssssssssss ssss" />
|
|
86
|
+
</div>
|
|
87
|
+
</ExampleContainer>
|
|
88
|
+
<ExampleContainer>
|
|
89
|
+
<Title title="Chip with ellipsis and suffix" theme="light" level={4} />
|
|
90
|
+
<div style={{ width: "200px" }}>
|
|
91
|
+
<DxcChip
|
|
92
|
+
suffixIcon={iconSVG}
|
|
93
|
+
label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fgsss"
|
|
94
|
+
/>
|
|
95
|
+
</div>
|
|
96
|
+
</ExampleContainer>
|
|
97
|
+
<ExampleContainer>
|
|
98
|
+
<Title title="Chip with ellipsis and prefix" theme="light" level={4} />
|
|
99
|
+
<div style={{ width: "200px" }}>
|
|
100
|
+
<DxcChip
|
|
101
|
+
prefixIcon={iconSVG}
|
|
102
|
+
label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasd fgsss"
|
|
103
|
+
/>
|
|
104
|
+
</div>
|
|
105
|
+
</ExampleContainer>
|
|
106
|
+
<ExampleContainer>
|
|
107
|
+
<Title title="Chip with ellipsis, suffix and prefix" theme="light" level={4} />
|
|
108
|
+
<div style={{ width: "200px" }}>
|
|
109
|
+
<DxcChip
|
|
110
|
+
prefixIcon={iconSVG}
|
|
111
|
+
suffixIcon={iconSVG}
|
|
112
|
+
label="With ellipsis asdfasdf asdf asdfasdf asdf asdfasdf asdfasdf asdf asdf adfasrfasf afsdg afgasfg asdf asdf asdf asdf asdf asdf asdf afdg asfg asdfg asdf asdf asdf asdfasdf asd fas df asd asdf asdf asdfasdf"
|
|
113
|
+
/>
|
|
114
|
+
</div>
|
|
115
|
+
</ExampleContainer>
|
|
116
|
+
<Title title="Margins" theme="light" level={2} />
|
|
117
|
+
<ExampleContainer>
|
|
118
|
+
<Title title="Xxsmall margin" theme="light" level={4} />
|
|
119
|
+
<DxcChip label="xxsmall" margin="xxsmall" />
|
|
120
|
+
</ExampleContainer>
|
|
121
|
+
<ExampleContainer>
|
|
122
|
+
<Title title="Xsmall margin" theme="light" level={4} />
|
|
123
|
+
<DxcChip label="xsmall" margin="xsmall" />
|
|
124
|
+
</ExampleContainer>
|
|
125
|
+
<ExampleContainer>
|
|
126
|
+
<Title title="Small margin" theme="light" level={4} />
|
|
127
|
+
<DxcChip label="small" margin="small" />
|
|
128
|
+
</ExampleContainer>
|
|
129
|
+
<ExampleContainer>
|
|
130
|
+
<Title title="Medium margin" theme="light" level={4} />
|
|
131
|
+
<DxcChip label="medium" margin="medium" />
|
|
132
|
+
</ExampleContainer>
|
|
133
|
+
<ExampleContainer>
|
|
134
|
+
<Title title="Large margin" theme="light" level={4} />
|
|
135
|
+
<DxcChip label="large" margin="large" />
|
|
136
|
+
</ExampleContainer>
|
|
137
|
+
<ExampleContainer>
|
|
138
|
+
<Title title="Xlarge margin" theme="light" level={4} />
|
|
139
|
+
<DxcChip label="xlarge" margin="xlarge" />
|
|
140
|
+
</ExampleContainer>
|
|
141
|
+
<ExampleContainer>
|
|
142
|
+
<Title title="Xxlarge margin" theme="light" level={4} />
|
|
143
|
+
<DxcChip label="xxlarge" margin="xxlarge" />
|
|
144
|
+
</ExampleContainer>
|
|
145
|
+
<Title title="Opinionated theme" theme="light" level={2} />
|
|
146
|
+
<ExampleContainer>
|
|
147
|
+
<Title title="Chip with prefix and suffix" theme="light" level={4} />
|
|
148
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
149
|
+
<DxcChip
|
|
150
|
+
label="Chip"
|
|
151
|
+
prefixIcon={iconSVG}
|
|
152
|
+
suffixIcon="https://upload.wikimedia.org/wikipedia/commons/e/e0/Check_green_icon.svg"
|
|
153
|
+
/>
|
|
154
|
+
</HalstackProvider>
|
|
155
|
+
</ExampleContainer>
|
|
156
|
+
<ExampleContainer>
|
|
157
|
+
<Title title="Chip with prefix and suffix" theme="light" level={4} />
|
|
158
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
159
|
+
<DxcChip
|
|
160
|
+
label="Chip"
|
|
161
|
+
disabled
|
|
162
|
+
prefixIcon={iconSVG}
|
|
163
|
+
suffixIcon="https://upload.wikimedia.org/wikipedia/commons/e/e0/Check_green_icon.svg"
|
|
164
|
+
/>
|
|
165
|
+
</HalstackProvider>
|
|
166
|
+
</ExampleContainer>
|
|
167
|
+
<ExampleContainer pseudoState="pseudo-hover">
|
|
168
|
+
<Title title="Hovered" theme="light" level={4} />
|
|
169
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
170
|
+
<DxcChip
|
|
171
|
+
label="Chip"
|
|
172
|
+
prefixIcon={iconSVG}
|
|
173
|
+
suffixIcon={iconSVG}
|
|
174
|
+
onClickPrefix={() => {}}
|
|
175
|
+
onClickSuffix={() => {}}
|
|
176
|
+
/>
|
|
177
|
+
</HalstackProvider>
|
|
178
|
+
</ExampleContainer>
|
|
179
|
+
<ExampleContainer pseudoState="pseudo-active">
|
|
180
|
+
<Title title="Actived" theme="light" level={4} />
|
|
181
|
+
<HalstackProvider theme={opinionatedTheme}>
|
|
182
|
+
<DxcChip
|
|
183
|
+
label="Chip"
|
|
184
|
+
prefixIcon={iconSVG}
|
|
185
|
+
suffixIcon={iconSVG}
|
|
186
|
+
onClickPrefix={() => {}}
|
|
187
|
+
onClickSuffix={() => {}}
|
|
188
|
+
/>
|
|
189
|
+
</HalstackProvider>
|
|
190
|
+
</ExampleContainer>
|
|
191
|
+
</>
|
|
192
|
+
);
|
|
193
|
+
const ChipPrefixFocused = () => (
|
|
194
|
+
<ExampleContainer>
|
|
195
|
+
<Title title="Chip with prefix" theme="light" level={4} />
|
|
196
|
+
<DxcChip label="Chip with prefix" prefixIcon={iconSVG} onClickPrefix={() => {}} />
|
|
197
|
+
</ExampleContainer>
|
|
198
|
+
);
|
|
199
|
+
const ChipSuffixFocused = () => (
|
|
200
|
+
<ExampleContainer>
|
|
201
|
+
<Title title="Chip with suffix" theme="light" level={4} />
|
|
202
|
+
<DxcChip label="Chip with suffix" suffixIcon="https://icons-for-free.com/download-icon-close+icon-1320184117228553763_512.png" onClickSuffix={() => {}} />
|
|
203
|
+
</ExampleContainer>
|
|
204
|
+
);
|
|
205
|
+
|
|
206
|
+
export const PrefixFocused = ChipPrefixFocused.bind({});
|
|
207
|
+
PrefixFocused.play = async () => {
|
|
208
|
+
await userEvent.tab();
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
export const SuffixFocused = ChipSuffixFocused.bind({});
|
|
212
|
+
SuffixFocused.play = async () => {
|
|
213
|
+
await userEvent.tab();
|
|
214
|
+
};
|