@dxc-technology/halstack-react 0.0.0-e33af28 → 0.0.0-e360842
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BackgroundColorContext.d.ts +1 -10
- package/BackgroundColorContext.js +5 -22
- package/HalstackContext.d.ts +1243 -0
- package/HalstackContext.js +310 -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 +101 -159
- package/accordion/Accordion.stories.tsx +83 -149
- package/accordion/Accordion.test.d.ts +1 -0
- package/accordion/Accordion.test.js +24 -40
- package/accordion/types.d.ts +6 -17
- package/accordion-group/AccordionGroup.accessibility.test.d.ts +1 -0
- package/accordion-group/AccordionGroup.accessibility.test.js +82 -0
- package/accordion-group/AccordionGroup.d.ts +2 -2
- package/accordion-group/AccordionGroup.js +31 -98
- package/accordion-group/AccordionGroup.stories.tsx +94 -67
- package/accordion-group/AccordionGroup.test.d.ts +1 -0
- package/accordion-group/AccordionGroup.test.js +49 -106
- 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 +12 -17
- 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 +40 -127
- package/alert/Alert.stories.tsx +28 -0
- package/alert/Alert.test.d.ts +1 -0
- package/alert/Alert.test.js +28 -45
- package/alert/types.d.ts +5 -5
- package/badge/Badge.accessibility.test.d.ts +1 -0
- package/badge/Badge.accessibility.test.js +129 -0
- package/badge/Badge.d.ts +1 -1
- package/badge/Badge.js +142 -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 +52 -2
- package/bleed/Bleed.js +14 -55
- package/bleed/Bleed.stories.tsx +95 -95
- package/bleed/types.d.ts +2 -2
- package/box/Box.accessibility.test.d.ts +1 -0
- package/box/Box.accessibility.test.js +33 -0
- package/box/Box.d.ts +1 -1
- package/box/Box.js +30 -81
- package/box/Box.stories.tsx +38 -51
- package/box/Box.test.d.ts +1 -0
- package/box/Box.test.js +1 -6
- package/box/types.d.ts +3 -14
- package/breadcrumbs/Breadcrumbs.accessibility.test.d.ts +1 -0
- package/breadcrumbs/Breadcrumbs.accessibility.test.js +96 -0
- package/breadcrumbs/Breadcrumbs.d.ts +4 -0
- package/breadcrumbs/Breadcrumbs.js +79 -0
- package/breadcrumbs/Breadcrumbs.stories.tsx +194 -0
- package/breadcrumbs/Breadcrumbs.test.d.ts +1 -0
- package/breadcrumbs/Breadcrumbs.test.js +169 -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 +16 -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/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 +63 -113
- package/button/Button.stories.tsx +151 -100
- package/button/Button.test.d.ts +1 -0
- package/button/Button.test.js +19 -16
- package/button/types.d.ts +12 -8
- 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 +59 -102
- package/card/Card.stories.tsx +12 -42
- package/card/Card.test.d.ts +1 -0
- package/card/Card.test.js +10 -21
- package/card/types.d.ts +6 -11
- package/checkbox/Checkbox.accessibility.test.d.ts +1 -0
- package/checkbox/Checkbox.accessibility.test.js +87 -0
- package/checkbox/Checkbox.d.ts +2 -2
- package/checkbox/Checkbox.js +137 -172
- package/checkbox/Checkbox.stories.tsx +166 -136
- package/checkbox/Checkbox.test.d.ts +1 -0
- package/checkbox/Checkbox.test.js +159 -38
- package/checkbox/types.d.ts +14 -6
- package/chip/Chip.accessibility.test.d.ts +1 -0
- package/chip/Chip.accessibility.test.js +69 -0
- package/chip/Chip.js +43 -89
- package/chip/Chip.stories.tsx +140 -28
- package/chip/Chip.test.d.ts +1 -0
- package/chip/Chip.test.js +17 -32
- package/chip/types.d.ts +38 -15
- package/common/coreTokens.d.ts +237 -0
- package/common/coreTokens.js +184 -0
- package/common/utils.d.ts +1 -0
- package/common/utils.js +6 -12
- package/common/variables.d.ts +1389 -0
- package/common/variables.js +1073 -1184
- 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 +74 -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 +88 -0
- package/contextual-menu/ContextualMenu.stories.tsx +232 -0
- package/contextual-menu/ContextualMenu.test.d.ts +1 -0
- package/contextual-menu/ContextualMenu.test.js +205 -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 +51 -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 +58 -0
- package/date-input/Calendar.d.ts +4 -0
- package/date-input/Calendar.js +214 -0
- package/date-input/DateInput.accessibility.test.d.ts +1 -0
- package/date-input/DateInput.accessibility.test.js +230 -0
- package/date-input/DateInput.js +152 -299
- package/date-input/DateInput.stories.tsx +210 -56
- package/date-input/DateInput.test.d.ts +1 -0
- package/date-input/DateInput.test.js +700 -370
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +121 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +100 -0
- package/date-input/types.d.ts +72 -15
- package/dialog/Dialog.accessibility.test.d.ts +1 -0
- package/dialog/Dialog.accessibility.test.js +69 -0
- package/dialog/Dialog.d.ts +1 -1
- package/dialog/Dialog.js +61 -106
- package/dialog/Dialog.stories.tsx +325 -167
- package/dialog/Dialog.test.d.ts +1 -0
- package/dialog/Dialog.test.js +350 -19
- 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 +223 -0
- package/divider/Divider.test.d.ts +1 -0
- package/divider/Divider.test.js +38 -0
- package/divider/types.d.ts +21 -0
- package/dropdown/Dropdown.accessibility.test.d.ts +1 -0
- package/dropdown/Dropdown.accessibility.test.js +184 -0
- package/dropdown/Dropdown.d.ts +1 -1
- package/dropdown/Dropdown.js +232 -307
- package/dropdown/Dropdown.stories.tsx +235 -57
- package/dropdown/Dropdown.test.d.ts +1 -0
- package/dropdown/Dropdown.test.js +604 -164
- 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 +35 -19
- 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 +245 -395
- package/file-input/FileInput.stories.tsx +123 -12
- package/file-input/FileInput.test.d.ts +1 -0
- package/file-input/FileInput.test.js +314 -367
- package/file-input/FileItem.d.ts +4 -14
- package/file-input/FileItem.js +61 -120
- package/file-input/types.d.ts +25 -8
- 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 +75 -118
- package/footer/Footer.stories.tsx +99 -21
- package/footer/Footer.test.d.ts +1 -0
- package/footer/Footer.test.js +32 -56
- package/footer/Icons.d.ts +3 -2
- package/footer/Icons.js +54 -23
- package/footer/types.d.ts +26 -27
- package/grid/Grid.d.ts +7 -0
- package/grid/Grid.js +76 -0
- package/grid/Grid.stories.tsx +219 -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 +95 -185
- package/header/Header.stories.tsx +133 -38
- package/header/Header.test.d.ts +1 -0
- package/header/Header.test.js +12 -25
- package/header/Icons.d.ts +2 -2
- package/header/Icons.js +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 +10 -32
- package/heading/Heading.test.d.ts +1 -0
- package/heading/Heading.test.js +64 -94
- package/heading/types.d.ts +7 -7
- package/icon/Icon.accessibility.test.d.ts +1 -0
- package/icon/Icon.accessibility.test.js +30 -0
- package/icon/Icon.d.ts +4 -0
- package/icon/Icon.js +33 -0
- package/icon/Icon.stories.tsx +28 -0
- package/icon/types.d.ts +4 -0
- package/icon/types.js +5 -0
- package/image/Image.accessibility.test.d.ts +1 -0
- package/image/Image.accessibility.test.js +56 -0
- package/image/Image.d.ts +4 -0
- package/image/Image.js +70 -0
- package/image/Image.stories.tsx +129 -0
- package/image/types.d.ts +72 -0
- package/image/types.js +5 -0
- package/inset/Inset.js +14 -55
- package/inset/Inset.stories.tsx +37 -36
- package/inset/types.d.ts +2 -2
- package/layout/ApplicationLayout.d.ts +16 -6
- package/layout/ApplicationLayout.js +86 -167
- package/layout/ApplicationLayout.stories.tsx +85 -94
- 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 -101
- package/link/Link.stories.tsx +157 -55
- package/link/Link.test.d.ts +1 -0
- package/link/Link.test.js +24 -52
- package/link/types.d.ts +15 -31
- package/main.d.ts +16 -13
- package/main.js +83 -106
- 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 +228 -0
- package/number-input/NumberInput.js +46 -36
- package/number-input/NumberInput.stories.tsx +42 -26
- package/number-input/NumberInput.test.d.ts +1 -0
- package/number-input/NumberInput.test.js +859 -376
- package/number-input/NumberInputContext.d.ts +3 -4
- package/number-input/NumberInputContext.js +3 -14
- package/number-input/types.d.ts +18 -6
- package/package.json +52 -54
- package/paginator/Paginator.accessibility.test.d.ts +1 -0
- package/paginator/Paginator.accessibility.test.js +79 -0
- package/paginator/Paginator.js +46 -100
- package/paginator/Paginator.stories.tsx +24 -0
- package/paginator/Paginator.test.d.ts +1 -0
- package/paginator/Paginator.test.js +279 -210
- 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 +153 -0
- package/password-input/PasswordInput.js +58 -124
- package/password-input/PasswordInput.stories.tsx +1 -33
- package/password-input/PasswordInput.test.d.ts +1 -0
- package/password-input/PasswordInput.test.js +159 -142
- package/password-input/types.d.ts +9 -8
- package/progress-bar/ProgressBar.accessibility.test.d.ts +1 -0
- package/progress-bar/ProgressBar.accessibility.test.js +35 -0
- package/progress-bar/ProgressBar.js +68 -92
- package/progress-bar/ProgressBar.stories.tsx +93 -0
- package/progress-bar/ProgressBar.test.d.ts +1 -0
- package/progress-bar/ProgressBar.test.js +71 -43
- 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.js +71 -43
- package/quick-nav/QuickNav.stories.tsx +146 -27
- package/quick-nav/types.d.ts +10 -10
- package/radio-group/Radio.d.ts +1 -1
- package/radio-group/Radio.js +59 -79
- package/radio-group/RadioGroup.accessibility.test.d.ts +1 -0
- package/radio-group/RadioGroup.accessibility.test.js +97 -0
- package/radio-group/RadioGroup.js +74 -121
- package/radio-group/RadioGroup.stories.tsx +132 -18
- package/radio-group/RadioGroup.test.d.ts +1 -0
- package/radio-group/RadioGroup.test.js +518 -459
- package/radio-group/types.d.ts +10 -10
- package/resultset-table/Icons.d.ts +7 -0
- package/resultset-table/Icons.js +47 -0
- package/resultset-table/ResultsetTable.accessibility.test.d.ts +1 -0
- package/resultset-table/ResultsetTable.accessibility.test.js +285 -0
- package/resultset-table/ResultsetTable.d.ts +7 -0
- package/resultset-table/ResultsetTable.js +171 -0
- package/{resultsetTable → resultset-table}/ResultsetTable.stories.tsx +168 -30
- package/resultset-table/ResultsetTable.test.d.ts +1 -0
- package/resultset-table/ResultsetTable.test.js +380 -0
- package/{resultsetTable → resultset-table}/types.d.ts +44 -11
- package/resultset-table/types.js +5 -0
- package/select/Listbox.d.ts +4 -0
- package/select/Listbox.js +151 -0
- package/select/Option.js +35 -56
- package/select/Select.accessibility.test.d.ts +1 -0
- package/select/Select.accessibility.test.js +228 -0
- package/select/Select.js +210 -342
- package/select/Select.stories.tsx +524 -187
- package/select/Select.test.d.ts +1 -0
- package/select/Select.test.js +1955 -1744
- package/select/types.d.ts +33 -18
- 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 +136 -71
- package/sidenav/Sidenav.stories.tsx +246 -151
- package/sidenav/Sidenav.test.d.ts +1 -0
- package/sidenav/Sidenav.test.js +25 -44
- 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 +104 -0
- package/slider/Slider.d.ts +2 -2
- package/slider/Slider.js +146 -181
- package/slider/Slider.stories.tsx +64 -61
- package/slider/Slider.test.d.ts +1 -0
- package/slider/Slider.test.js +195 -88
- package/slider/types.d.ts +7 -3
- package/spinner/Spinner.accessibility.test.d.ts +1 -0
- package/spinner/Spinner.accessibility.test.js +96 -0
- package/spinner/Spinner.js +34 -74
- package/spinner/{Spinner.stories.jsx → Spinner.stories.tsx} +53 -27
- package/spinner/Spinner.test.d.ts +1 -0
- package/spinner/Spinner.test.js +25 -34
- package/spinner/types.d.ts +3 -3
- package/status-light/StatusLight.accessibility.test.d.ts +1 -0
- package/status-light/StatusLight.accessibility.test.js +157 -0
- package/status-light/StatusLight.d.ts +4 -0
- package/status-light/StatusLight.js +51 -0
- package/status-light/StatusLight.stories.tsx +74 -0
- package/status-light/StatusLight.test.d.ts +1 -0
- package/status-light/StatusLight.test.js +25 -0
- package/status-light/types.d.ts +17 -0
- package/status-light/types.js +5 -0
- package/switch/Switch.accessibility.test.d.ts +1 -0
- package/switch/Switch.accessibility.test.js +98 -0
- package/switch/Switch.d.ts +2 -2
- package/switch/Switch.js +143 -124
- package/switch/Switch.stories.tsx +53 -64
- package/switch/Switch.test.d.ts +1 -0
- package/switch/Switch.test.js +137 -55
- package/switch/types.d.ts +9 -5
- package/table/DropdownTheme.js +62 -0
- package/table/Table.accessibility.test.d.ts +1 -0
- package/table/Table.accessibility.test.js +93 -0
- package/table/Table.d.ts +6 -2
- package/table/Table.js +78 -35
- package/table/Table.stories.tsx +663 -0
- package/table/Table.test.d.ts +1 -0
- package/table/Table.test.js +93 -7
- 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.js +303 -141
- package/tabs/Tabs.stories.tsx +124 -12
- package/tabs/Tabs.test.d.ts +1 -0
- package/tabs/Tabs.test.js +212 -76
- package/tabs/types.d.ts +30 -20
- package/tag/Tag.accessibility.test.d.ts +1 -0
- package/tag/Tag.accessibility.test.js +69 -0
- package/tag/Tag.js +38 -73
- package/tag/Tag.stories.tsx +18 -8
- package/tag/Tag.test.d.ts +1 -0
- package/tag/Tag.test.js +17 -36
- package/tag/types.d.ts +9 -9
- package/text-input/Suggestion.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 +321 -0
- package/text-input/TextInput.js +326 -553
- package/text-input/TextInput.stories.tsx +276 -276
- package/text-input/TextInput.test.d.ts +1 -0
- package/text-input/TextInput.test.js +1419 -1375
- package/text-input/types.d.ts +53 -14
- package/textarea/Textarea.accessibility.test.d.ts +1 -0
- package/textarea/Textarea.accessibility.test.js +155 -0
- package/textarea/Textarea.js +79 -133
- package/textarea/Textarea.stories.tsx +174 -0
- package/textarea/Textarea.test.d.ts +1 -0
- package/textarea/Textarea.test.js +151 -182
- package/textarea/types.d.ts +10 -6
- package/toggle-group/ToggleGroup.accessibility.test.d.ts +1 -0
- package/toggle-group/ToggleGroup.accessibility.test.js +107 -0
- package/toggle-group/ToggleGroup.d.ts +2 -2
- package/toggle-group/ToggleGroup.js +92 -108
- package/toggle-group/ToggleGroup.stories.tsx +52 -7
- package/toggle-group/ToggleGroup.test.d.ts +1 -0
- package/toggle-group/ToggleGroup.test.js +68 -87
- package/toggle-group/types.d.ts +28 -19
- package/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 +198 -0
- package/typography/types.d.ts +18 -0
- package/typography/types.js +5 -0
- package/useTheme.d.ts +1141 -1
- package/useTheme.js +4 -11
- package/useTranslatedLabels.d.ts +85 -0
- package/useTranslatedLabels.js +14 -0
- package/utils/BaseTypography.d.ts +21 -0
- package/utils/BaseTypography.js +94 -0
- package/utils/FocusLock.d.ts +13 -0
- package/utils/FocusLock.js +124 -0
- package/wizard/Wizard.accessibility.test.d.ts +1 -0
- package/wizard/Wizard.accessibility.test.js +55 -0
- package/wizard/Wizard.js +66 -113
- package/wizard/Wizard.stories.tsx +59 -1
- package/wizard/Wizard.test.d.ts +1 -0
- package/wizard/Wizard.test.js +53 -80
- package/wizard/types.d.ts +9 -9
- package/ThemeContext.d.ts +0 -10
- package/ThemeContext.js +0 -243
- 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/list/List.d.ts +0 -4
- package/list/List.js +0 -47
- package/list/List.stories.tsx +0 -95
- package/list/types.d.ts +0 -7
- 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/Radio.test.js +0 -71
- package/radio/types.d.ts +0 -54
- package/resultsetTable/ResultsetTable.d.ts +0 -4
- package/resultsetTable/ResultsetTable.js +0 -254
- package/resultsetTable/ResultsetTable.test.js +0 -306
- package/row/Row.d.ts +0 -3
- package/row/Row.js +0 -127
- package/row/Row.stories.tsx +0 -237
- package/row/types.d.ts +0 -28
- package/select/Icons.d.ts +0 -10
- package/select/Icons.js +0 -93
- package/stack/Stack.d.ts +0 -3
- package/stack/Stack.js +0 -97
- package/stack/Stack.stories.tsx +0 -164
- package/stack/types.d.ts +0 -24
- package/table/Table.stories.jsx +0 -277
- package/text/Text.d.ts +0 -7
- package/text/Text.js +0 -30
- package/text/Text.stories.tsx +0 -19
- package/textarea/Textarea.stories.jsx +0 -157
- /package/{list → action-icon}/types.js +0 -0
- /package/{radio → breadcrumbs}/types.js +0 -0
- /package/{resultsetTable → bulleted-list}/types.js +0 -0
- /package/{row → container}/types.js +0 -0
- /package/{stack → contextual-menu}/types.js +0 -0
- /package/{number-input/numberInputContextTypes.js → divider/types.js} +0 -0
|
@@ -1,457 +1,404 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
6
|
-
|
|
7
5
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
8
|
-
|
|
9
6
|
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
|
|
11
7
|
var _react2 = require("@testing-library/react");
|
|
12
|
-
|
|
13
8
|
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
14
|
-
|
|
15
9
|
var _FileInput = _interopRequireDefault(require("./FileInput"));
|
|
16
|
-
|
|
10
|
+
var file1 = new File(["file1"], "file1.png", {
|
|
11
|
+
type: "image/png"
|
|
12
|
+
});
|
|
13
|
+
var file2 = new File(["file2"], "file2.txt", {
|
|
14
|
+
type: "text/plain"
|
|
15
|
+
});
|
|
16
|
+
var allFiles = [{
|
|
17
|
+
file: file1
|
|
18
|
+
}, {
|
|
19
|
+
error: "Error message",
|
|
20
|
+
file: file2
|
|
21
|
+
}];
|
|
17
22
|
describe("FileInput component tests", function () {
|
|
18
|
-
var file1 = new File(["file1"], "file1.png", {
|
|
19
|
-
type: "image/png"
|
|
20
|
-
});
|
|
21
|
-
var file2 = new File(["file2"], "file2.txt", {
|
|
22
|
-
type: "text/plain"
|
|
23
|
-
});
|
|
24
|
-
var allFiles = [{
|
|
25
|
-
file: file1
|
|
26
|
-
}, {
|
|
27
|
-
error: "Error message",
|
|
28
|
-
file: file2
|
|
29
|
-
}];
|
|
30
23
|
test("Renders with correct labels and helper text in file mode", function () {
|
|
24
|
+
var callbackFile = jest.fn();
|
|
31
25
|
var _render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_FileInput["default"], {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
26
|
+
label: "File input label",
|
|
27
|
+
helperText: "File input helper text",
|
|
28
|
+
value: allFiles,
|
|
29
|
+
buttonLabel: "Choose files",
|
|
30
|
+
callbackFile: callbackFile
|
|
31
|
+
})),
|
|
32
|
+
getByText = _render.getByText;
|
|
38
33
|
expect(getByText("File input label")).toBeTruthy();
|
|
39
34
|
expect(getByText("File input helper text")).toBeTruthy();
|
|
40
35
|
expect(getByText("Choose files")).toBeTruthy();
|
|
41
36
|
});
|
|
42
37
|
test("Renders with correct button label in file mode", function () {
|
|
38
|
+
var callbackFile = jest.fn();
|
|
43
39
|
var _render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_FileInput["default"], {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
40
|
+
label: "File input label",
|
|
41
|
+
helperText: "File input helper text",
|
|
42
|
+
value: allFiles,
|
|
43
|
+
callbackFile: callbackFile
|
|
44
|
+
})),
|
|
45
|
+
getByText = _render2.getByText;
|
|
49
46
|
expect(getByText("Select files")).toBeTruthy();
|
|
50
47
|
});
|
|
51
48
|
test("Renders with correct button label in file mode and single file selection", function () {
|
|
49
|
+
var callbackFile = jest.fn();
|
|
52
50
|
var _render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_FileInput["default"], {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
label: "File input label",
|
|
52
|
+
helperText: "File input helper text",
|
|
53
|
+
value: allFiles,
|
|
54
|
+
multiple: false,
|
|
55
|
+
callbackFile: callbackFile
|
|
56
|
+
})),
|
|
57
|
+
getByText = _render3.getByText;
|
|
59
58
|
expect(getByText("Select file")).toBeTruthy();
|
|
60
59
|
});
|
|
61
60
|
test("Renders with correct labels in filedrop mode", function () {
|
|
61
|
+
var callbackFile = jest.fn();
|
|
62
62
|
var _render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_FileInput["default"], {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
label: "File input label",
|
|
64
|
+
helperText: "File input helper text",
|
|
65
|
+
value: allFiles,
|
|
66
|
+
mode: "filedrop",
|
|
67
|
+
callbackFile: callbackFile
|
|
68
|
+
})),
|
|
69
|
+
getByText = _render4.getByText;
|
|
69
70
|
expect(getByText("Select")).toBeTruthy();
|
|
70
71
|
expect(getByText("or drop files")).toBeTruthy();
|
|
71
72
|
});
|
|
72
73
|
test("Renders with correct labels in filedrop mode and single file selection", function () {
|
|
74
|
+
var callbackFile = jest.fn();
|
|
73
75
|
var _render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_FileInput["default"], {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
label: "File input label",
|
|
77
|
+
helperText: "File input helper text",
|
|
78
|
+
value: allFiles,
|
|
79
|
+
mode: "filedrop",
|
|
80
|
+
multiple: false,
|
|
81
|
+
callbackFile: callbackFile
|
|
82
|
+
})),
|
|
83
|
+
getByText = _render5.getByText;
|
|
81
84
|
expect(getByText("Select")).toBeTruthy();
|
|
82
85
|
expect(getByText("or drop a file")).toBeTruthy();
|
|
83
86
|
});
|
|
84
87
|
test("Renders with correct custom labels in filedrop mode", function () {
|
|
88
|
+
var callbackFile = jest.fn();
|
|
85
89
|
var _render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_FileInput["default"], {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
label: "File input label",
|
|
91
|
+
helperText: "File input helper text",
|
|
92
|
+
value: allFiles,
|
|
93
|
+
mode: "filedrop",
|
|
94
|
+
buttonLabel: "Choose",
|
|
95
|
+
dropAreaLabel: "(or drop the files)",
|
|
96
|
+
callbackFile: callbackFile
|
|
97
|
+
})),
|
|
98
|
+
getByText = _render6.getByText;
|
|
94
99
|
expect(getByText("Choose")).toBeTruthy();
|
|
95
100
|
expect(getByText("(or drop the files)")).toBeTruthy();
|
|
96
101
|
});
|
|
97
102
|
test("Renders with correct labels in dropzone mode", function () {
|
|
103
|
+
var callbackFile = jest.fn();
|
|
98
104
|
var _render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_FileInput["default"], {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
+
label: "File input label",
|
|
106
|
+
helperText: "File input helper text",
|
|
107
|
+
value: allFiles,
|
|
108
|
+
mode: "dropzone",
|
|
109
|
+
callbackFile: callbackFile
|
|
110
|
+
})),
|
|
111
|
+
getByText = _render7.getByText;
|
|
105
112
|
expect(getByText("Select")).toBeTruthy();
|
|
106
113
|
expect(getByText("or drop files")).toBeTruthy();
|
|
107
114
|
});
|
|
108
115
|
test("Renders with correct labels in dropzone mode and single file selection", function () {
|
|
116
|
+
var callbackFile = jest.fn();
|
|
109
117
|
var _render8 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_FileInput["default"], {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
118
|
+
label: "File input label",
|
|
119
|
+
helperText: "File input helper text",
|
|
120
|
+
value: allFiles,
|
|
121
|
+
mode: "dropzone",
|
|
122
|
+
multiple: false,
|
|
123
|
+
callbackFile: callbackFile
|
|
124
|
+
})),
|
|
125
|
+
getByText = _render8.getByText;
|
|
117
126
|
expect(getByText("Select")).toBeTruthy();
|
|
118
127
|
expect(getByText("or drop a file")).toBeTruthy();
|
|
119
128
|
});
|
|
120
129
|
test("Renders with correct custom labels in dropzone mode", function () {
|
|
130
|
+
var callbackFile = jest.fn();
|
|
121
131
|
var _render9 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_FileInput["default"], {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
132
|
+
label: "File input label",
|
|
133
|
+
helperText: "File input helper text",
|
|
134
|
+
value: allFiles,
|
|
135
|
+
mode: "dropzone",
|
|
136
|
+
buttonLabel: "Choose",
|
|
137
|
+
dropAreaLabel: "(or drop the files)",
|
|
138
|
+
callbackFile: callbackFile
|
|
139
|
+
})),
|
|
140
|
+
getByText = _render9.getByText;
|
|
130
141
|
expect(getByText("Choose")).toBeTruthy();
|
|
131
142
|
expect(getByText("(or drop the files)")).toBeTruthy();
|
|
132
143
|
});
|
|
133
144
|
test("Disabled file input", function () {
|
|
145
|
+
var callbackFile = jest.fn();
|
|
134
146
|
var _render10 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_FileInput["default"], {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
147
|
+
label: "File input label",
|
|
148
|
+
helperText: "File input helper text",
|
|
149
|
+
value: allFiles,
|
|
150
|
+
callbackFile: callbackFile,
|
|
151
|
+
disabled: true
|
|
152
|
+
})),
|
|
153
|
+
getByText = _render10.getByText,
|
|
154
|
+
getByRole = _render10.getByRole;
|
|
142
155
|
expect(getByText("Select files")).toBeTruthy();
|
|
143
156
|
var button = getByRole("button");
|
|
144
157
|
expect(button.disabled).toBeTruthy();
|
|
145
158
|
});
|
|
146
159
|
test("Renders file items passed in value when multiple file input", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
147
160
|
var callbackFile, _render11, getByText;
|
|
148
|
-
|
|
149
161
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
150
|
-
while (1) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
case "end":
|
|
169
|
-
return _context.stop();
|
|
170
|
-
}
|
|
162
|
+
while (1) switch (_context.prev = _context.next) {
|
|
163
|
+
case 0:
|
|
164
|
+
callbackFile = jest.fn();
|
|
165
|
+
_render11 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_FileInput["default"], {
|
|
166
|
+
label: "File input label",
|
|
167
|
+
helperText: "File input helper text",
|
|
168
|
+
value: allFiles,
|
|
169
|
+
callbackFile: callbackFile
|
|
170
|
+
})), getByText = _render11.getByText;
|
|
171
|
+
_context.next = 4;
|
|
172
|
+
return (0, _react2.waitFor)(function () {
|
|
173
|
+
expect(getByText("file1.png")).toBeTruthy();
|
|
174
|
+
expect(getByText("file2.txt")).toBeTruthy();
|
|
175
|
+
expect(getByText("Error message")).toBeTruthy();
|
|
176
|
+
});
|
|
177
|
+
case 4:
|
|
178
|
+
case "end":
|
|
179
|
+
return _context.stop();
|
|
171
180
|
}
|
|
172
181
|
}, _callee);
|
|
173
182
|
})));
|
|
174
|
-
test("Renders
|
|
175
|
-
var callbackFile, _render12, getByText;
|
|
176
|
-
|
|
183
|
+
test("Renders non-duplicated items passed in value when multiple file input", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
184
|
+
var callbackFile, _render12, getByLabelText, getByText;
|
|
177
185
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
178
|
-
while (1) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
186
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
187
|
+
case 0:
|
|
188
|
+
callbackFile = jest.fn();
|
|
189
|
+
_render12 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_FileInput["default"], {
|
|
190
|
+
label: "File input label",
|
|
191
|
+
helperText: "File input helper text",
|
|
192
|
+
value: allFiles,
|
|
193
|
+
callbackFile: callbackFile
|
|
194
|
+
})), getByLabelText = _render12.getByLabelText, getByText = _render12.getByText;
|
|
195
|
+
_context2.next = 4;
|
|
196
|
+
return (0, _react2.waitFor)(function () {
|
|
197
|
+
expect(getByText("file1.png")).toBeTruthy();
|
|
198
|
+
expect(getByText("file2.txt")).toBeTruthy();
|
|
199
|
+
expect(getByText("Error message")).toBeTruthy();
|
|
200
|
+
var inputFile = getByLabelText("File input label");
|
|
201
|
+
_react2.fireEvent.change(inputFile, {
|
|
202
|
+
target: {
|
|
203
|
+
files: [file1]
|
|
204
|
+
}
|
|
194
205
|
});
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
206
|
+
expect(callbackFile).toHaveBeenCalledWith([{
|
|
207
|
+
file: file1,
|
|
208
|
+
preview: "data:image/png;base64,ZmlsZTE="
|
|
209
|
+
}, {
|
|
210
|
+
error: "Error message",
|
|
211
|
+
file: file2,
|
|
212
|
+
preview: "draft"
|
|
213
|
+
}]);
|
|
214
|
+
});
|
|
215
|
+
case 4:
|
|
216
|
+
case "end":
|
|
217
|
+
return _context2.stop();
|
|
200
218
|
}
|
|
201
219
|
}, _callee2);
|
|
202
220
|
})));
|
|
203
|
-
test("
|
|
204
|
-
var
|
|
205
|
-
|
|
221
|
+
test("Renders file items when single file input", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
222
|
+
var callbackFile, _render13, getByText;
|
|
206
223
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
207
|
-
while (1) {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
var inputFile = getByLabelText("File input label", {
|
|
227
|
-
hidden: true
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
_react2.fireEvent.change(inputFile, {
|
|
231
|
-
target: {
|
|
232
|
-
files: [newFile]
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
expect(callbackFile).toHaveBeenCalledWith([{
|
|
237
|
-
file: newFile,
|
|
238
|
-
preview: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
239
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
240
|
-
width: "24",
|
|
241
|
-
height: "24",
|
|
242
|
-
viewBox: "0 0 24 24",
|
|
243
|
-
fill: "currentColor"
|
|
244
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
245
|
-
fill: "none",
|
|
246
|
-
d: "M0 0h24v24H0V0z"
|
|
247
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
248
|
-
d: "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6z"
|
|
249
|
-
}))
|
|
250
|
-
}]);
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
case 5:
|
|
254
|
-
case "end":
|
|
255
|
-
return _context3.stop();
|
|
256
|
-
}
|
|
224
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
225
|
+
case 0:
|
|
226
|
+
callbackFile = jest.fn();
|
|
227
|
+
_render13 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_FileInput["default"], {
|
|
228
|
+
label: "File input label",
|
|
229
|
+
helperText: "File input helper text",
|
|
230
|
+
multiple: false,
|
|
231
|
+
value: allFiles,
|
|
232
|
+
callbackFile: callbackFile
|
|
233
|
+
})), getByText = _render13.getByText;
|
|
234
|
+
_context3.next = 4;
|
|
235
|
+
return (0, _react2.waitFor)(function () {
|
|
236
|
+
expect(getByText("file1.png")).toBeTruthy();
|
|
237
|
+
expect(getByText("file2.txt")).toBeTruthy();
|
|
238
|
+
expect(getByText("Error message")).toBeTruthy();
|
|
239
|
+
});
|
|
240
|
+
case 4:
|
|
241
|
+
case "end":
|
|
242
|
+
return _context3.stop();
|
|
257
243
|
}
|
|
258
244
|
}, _callee3);
|
|
259
245
|
})));
|
|
260
|
-
test("
|
|
261
|
-
var callbackFile, _render14, getByText,
|
|
262
|
-
|
|
246
|
+
test("Add file item when single file input", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
247
|
+
var newFile, callbackFile, _render14, getByText, getByLabelText;
|
|
263
248
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
264
|
-
while (1) {
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
288
|
-
width: "24",
|
|
289
|
-
height: "24",
|
|
290
|
-
viewBox: "0 0 24 24",
|
|
291
|
-
fill: "currentColor"
|
|
292
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
293
|
-
fill: "none",
|
|
294
|
-
d: "M0 0h24v24H0V0z"
|
|
295
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
296
|
-
d: "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6z"
|
|
297
|
-
}))
|
|
298
|
-
}]);
|
|
249
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
250
|
+
case 0:
|
|
251
|
+
newFile = new File(["newFile"], "newFile.pdf", {
|
|
252
|
+
type: "pdf"
|
|
253
|
+
});
|
|
254
|
+
callbackFile = jest.fn();
|
|
255
|
+
_render14 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_FileInput["default"], {
|
|
256
|
+
label: "File input label",
|
|
257
|
+
helperText: "File input helper text",
|
|
258
|
+
value: allFiles,
|
|
259
|
+
callbackFile: callbackFile,
|
|
260
|
+
multiple: false
|
|
261
|
+
})), getByText = _render14.getByText, getByLabelText = _render14.getByLabelText;
|
|
262
|
+
_context4.next = 5;
|
|
263
|
+
return (0, _react2.waitFor)(function () {
|
|
264
|
+
expect(getByText("file1.png")).toBeTruthy();
|
|
265
|
+
expect(getByText("file2.txt")).toBeTruthy();
|
|
266
|
+
expect(getByText("Error message")).toBeTruthy();
|
|
267
|
+
var inputFile = getByLabelText("File input label");
|
|
268
|
+
_react2.fireEvent.change(inputFile, {
|
|
269
|
+
target: {
|
|
270
|
+
files: [newFile]
|
|
271
|
+
}
|
|
299
272
|
});
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
273
|
+
expect(callbackFile).toHaveBeenCalledWith([{
|
|
274
|
+
file: newFile,
|
|
275
|
+
preview: "draft"
|
|
276
|
+
}]);
|
|
277
|
+
});
|
|
278
|
+
case 5:
|
|
279
|
+
case "end":
|
|
280
|
+
return _context4.stop();
|
|
305
281
|
}
|
|
306
282
|
}, _callee4);
|
|
307
283
|
})));
|
|
308
|
-
test("
|
|
309
|
-
var
|
|
310
|
-
|
|
284
|
+
test("Renders file items and delete one file", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
285
|
+
var callbackFile, _render15, getByText, getAllByRole;
|
|
311
286
|
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
312
|
-
while (1) {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
expect(callbackFile).toHaveBeenCalledWith([{
|
|
338
|
-
file: file1,
|
|
339
|
-
preview: "data:image/png;base64,ZmlsZTE="
|
|
340
|
-
}, {
|
|
341
|
-
error: "Error message",
|
|
342
|
-
file: file2,
|
|
343
|
-
preview: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
344
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
345
|
-
width: "24",
|
|
346
|
-
height: "24",
|
|
347
|
-
viewBox: "0 0 24 24",
|
|
348
|
-
fill: "currentColor"
|
|
349
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
350
|
-
fill: "none",
|
|
351
|
-
d: "M0 0h24v24H0V0z"
|
|
352
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
353
|
-
d: "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6z"
|
|
354
|
-
}))
|
|
355
|
-
}, {
|
|
356
|
-
error: undefined,
|
|
357
|
-
file: newFile,
|
|
358
|
-
preview: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
359
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
360
|
-
width: "24",
|
|
361
|
-
height: "24",
|
|
362
|
-
viewBox: "0 0 24 24",
|
|
363
|
-
fill: "currentColor"
|
|
364
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
365
|
-
fill: "none",
|
|
366
|
-
d: "M0 0h24v24H0V0z"
|
|
367
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
368
|
-
d: "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6z"
|
|
369
|
-
}))
|
|
370
|
-
}]);
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
case 5:
|
|
374
|
-
case "end":
|
|
375
|
-
return _context5.stop();
|
|
376
|
-
}
|
|
287
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
288
|
+
case 0:
|
|
289
|
+
callbackFile = jest.fn();
|
|
290
|
+
_render15 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_FileInput["default"], {
|
|
291
|
+
label: "File input label",
|
|
292
|
+
helperText: "File input helper text",
|
|
293
|
+
value: allFiles,
|
|
294
|
+
callbackFile: callbackFile
|
|
295
|
+
})), getByText = _render15.getByText, getAllByRole = _render15.getAllByRole;
|
|
296
|
+
_context5.next = 4;
|
|
297
|
+
return (0, _react2.waitFor)(function () {
|
|
298
|
+
expect(getByText("file1.png")).toBeTruthy();
|
|
299
|
+
expect(getByText("file2.txt")).toBeTruthy();
|
|
300
|
+
expect(getByText("Error message")).toBeTruthy();
|
|
301
|
+
var removeBtn = getAllByRole("button")[1];
|
|
302
|
+
_userEvent["default"].click(removeBtn);
|
|
303
|
+
expect(callbackFile).toHaveBeenCalledWith([{
|
|
304
|
+
error: "Error message",
|
|
305
|
+
file: file2,
|
|
306
|
+
preview: "draft"
|
|
307
|
+
}]);
|
|
308
|
+
});
|
|
309
|
+
case 4:
|
|
310
|
+
case "end":
|
|
311
|
+
return _context5.stop();
|
|
377
312
|
}
|
|
378
313
|
}, _callee5);
|
|
379
314
|
})));
|
|
380
|
-
test("
|
|
381
|
-
var newFile, callbackFile, _render16,
|
|
382
|
-
|
|
315
|
+
test("CallbackFile is correctly called", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
316
|
+
var newFile, callbackFile, _render16, getByLabelText;
|
|
383
317
|
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
384
|
-
while (1) {
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
expect(getByText("Error message")).toBeTruthy();
|
|
404
|
-
var inputFile = getByLabelText("File input label", {
|
|
405
|
-
hidden: true
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
_react2.fireEvent.change(inputFile, {
|
|
409
|
-
target: {
|
|
410
|
-
files: [newFile]
|
|
411
|
-
}
|
|
412
|
-
});
|
|
413
|
-
|
|
414
|
-
expect(callbackFile).toHaveBeenCalledWith([{
|
|
415
|
-
file: file1,
|
|
416
|
-
preview: "data:image/png;base64,ZmlsZTE="
|
|
417
|
-
}, {
|
|
418
|
-
error: "Error message",
|
|
419
|
-
file: file2,
|
|
420
|
-
preview: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
421
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
422
|
-
width: "24",
|
|
423
|
-
height: "24",
|
|
424
|
-
viewBox: "0 0 24 24",
|
|
425
|
-
fill: "currentColor"
|
|
426
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
427
|
-
fill: "none",
|
|
428
|
-
d: "M0 0h24v24H0V0z"
|
|
429
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
430
|
-
d: "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6z"
|
|
431
|
-
}))
|
|
432
|
-
}, {
|
|
433
|
-
error: "File size must be greater than min size.",
|
|
434
|
-
file: newFile,
|
|
435
|
-
preview: /*#__PURE__*/_react["default"].createElement("svg", {
|
|
436
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
437
|
-
width: "24",
|
|
438
|
-
height: "24",
|
|
439
|
-
viewBox: "0 0 24 24",
|
|
440
|
-
fill: "currentColor"
|
|
441
|
-
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
442
|
-
fill: "none",
|
|
443
|
-
d: "M0 0h24v24H0V0z"
|
|
444
|
-
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
445
|
-
d: "M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zM6 20V4h7v5h5v11H6z"
|
|
446
|
-
}))
|
|
447
|
-
}]);
|
|
318
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
319
|
+
case 0:
|
|
320
|
+
newFile = new File(["newFile"], "newFile.pdf", {
|
|
321
|
+
type: "pdf"
|
|
322
|
+
});
|
|
323
|
+
callbackFile = jest.fn();
|
|
324
|
+
_render16 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_FileInput["default"], {
|
|
325
|
+
label: "File input label",
|
|
326
|
+
helperText: "File input helper text",
|
|
327
|
+
value: allFiles,
|
|
328
|
+
callbackFile: callbackFile
|
|
329
|
+
})), getByLabelText = _render16.getByLabelText;
|
|
330
|
+
_context6.next = 5;
|
|
331
|
+
return (0, _react2.waitFor)(function () {
|
|
332
|
+
var inputFile = getByLabelText("File input label");
|
|
333
|
+
_react2.fireEvent.change(inputFile, {
|
|
334
|
+
target: {
|
|
335
|
+
files: [newFile]
|
|
336
|
+
}
|
|
448
337
|
});
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
338
|
+
expect(callbackFile).toHaveBeenCalledWith([{
|
|
339
|
+
file: file1,
|
|
340
|
+
preview: "data:image/png;base64,ZmlsZTE="
|
|
341
|
+
}, {
|
|
342
|
+
error: "Error message",
|
|
343
|
+
file: file2,
|
|
344
|
+
preview: "draft"
|
|
345
|
+
}, {
|
|
346
|
+
error: undefined,
|
|
347
|
+
file: newFile,
|
|
348
|
+
preview: "draft"
|
|
349
|
+
}]);
|
|
350
|
+
});
|
|
351
|
+
case 5:
|
|
352
|
+
case "end":
|
|
353
|
+
return _context6.stop();
|
|
454
354
|
}
|
|
455
355
|
}, _callee6);
|
|
456
356
|
})));
|
|
357
|
+
test("Callback called correctly when a file size does not comply minSize or maxSize", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
358
|
+
var newFile, callbackFile, _render17, getByText, getByLabelText;
|
|
359
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
360
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
361
|
+
case 0:
|
|
362
|
+
newFile = new File(["newFile"], "newFile.pdf", {
|
|
363
|
+
type: "pdf"
|
|
364
|
+
});
|
|
365
|
+
callbackFile = jest.fn();
|
|
366
|
+
_render17 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_FileInput["default"], {
|
|
367
|
+
label: "File input label",
|
|
368
|
+
helperText: "File input helper text",
|
|
369
|
+
minSize: 1000,
|
|
370
|
+
maxSize: 20000,
|
|
371
|
+
value: allFiles,
|
|
372
|
+
callbackFile: callbackFile
|
|
373
|
+
})), getByText = _render17.getByText, getByLabelText = _render17.getByLabelText;
|
|
374
|
+
_context7.next = 5;
|
|
375
|
+
return (0, _react2.waitFor)(function () {
|
|
376
|
+
expect(getByText("file1.png")).toBeTruthy();
|
|
377
|
+
expect(getByText("file2.txt")).toBeTruthy();
|
|
378
|
+
expect(getByText("Error message")).toBeTruthy();
|
|
379
|
+
var inputFile = getByLabelText("File input label");
|
|
380
|
+
_react2.fireEvent.change(inputFile, {
|
|
381
|
+
target: {
|
|
382
|
+
files: [newFile]
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
expect(callbackFile).toHaveBeenCalledWith([{
|
|
386
|
+
file: file1,
|
|
387
|
+
preview: "data:image/png;base64,ZmlsZTE="
|
|
388
|
+
}, {
|
|
389
|
+
error: "Error message",
|
|
390
|
+
file: file2,
|
|
391
|
+
preview: "draft"
|
|
392
|
+
}, {
|
|
393
|
+
error: "File size must be greater than min size.",
|
|
394
|
+
file: newFile,
|
|
395
|
+
preview: "draft"
|
|
396
|
+
}]);
|
|
397
|
+
});
|
|
398
|
+
case 5:
|
|
399
|
+
case "end":
|
|
400
|
+
return _context7.stop();
|
|
401
|
+
}
|
|
402
|
+
}, _callee7);
|
|
403
|
+
})));
|
|
457
404
|
});
|