@dxc-technology/halstack-react 11.0.0 → 12.0.1
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 +3 -8
- package/HalstackContext.d.ts +32 -145
- package/HalstackContext.js +3 -7
- package/accordion/Accordion.accessibility.test.d.ts +1 -0
- package/accordion/Accordion.accessibility.test.js +71 -0
- package/accordion/Accordion.js +18 -35
- package/accordion/Accordion.stories.tsx +7 -49
- package/accordion/Accordion.test.d.ts +1 -0
- package/accordion/Accordion.test.js +3 -3
- package/accordion/types.d.ts +1 -1
- 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 -3
- package/accordion-group/AccordionGroup.js +4 -4
- package/accordion-group/AccordionGroup.stories.tsx +23 -23
- package/accordion-group/AccordionGroup.test.d.ts +1 -0
- package/accordion-group/AccordionGroup.test.js +5 -9
- package/accordion-group/AccordionGroupAccordion.js +3 -3
- package/accordion-group/AccordionGroupContext.d.ts +3 -0
- package/accordion-group/AccordionGroupContext.js +8 -0
- package/accordion-group/types.d.ts +1 -1
- 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/action-icon/types.js +5 -0
- package/alert/Alert.accessibility.test.d.ts +1 -0
- package/alert/Alert.accessibility.test.js +95 -0
- package/alert/Alert.js +21 -75
- package/alert/Alert.test.d.ts +1 -0
- package/alert/Alert.test.js +1 -1
- 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 +141 -28
- package/badge/Badge.stories.tsx +210 -0
- package/badge/Badge.test.d.ts +1 -0
- package/badge/Badge.test.js +30 -0
- package/badge/types.d.ts +52 -3
- package/box/Box.accessibility.test.d.ts +1 -0
- package/box/Box.accessibility.test.js +33 -0
- package/box/Box.js +2 -5
- package/box/Box.test.d.ts +1 -0
- package/box/Box.test.js +1 -1
- 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/breadcrumbs/types.js +5 -0
- package/bulleted-list/BulletedList.accessibility.test.d.ts +1 -0
- package/bulleted-list/BulletedList.accessibility.test.js +119 -0
- package/bulleted-list/BulletedList.js +16 -23
- package/bulleted-list/BulletedList.stories.tsx +1 -2
- package/button/Button.accessibility.test.d.ts +1 -0
- package/button/Button.accessibility.test.js +127 -0
- package/button/Button.js +16 -16
- package/button/Button.stories.tsx +34 -53
- package/button/Button.test.d.ts +1 -0
- package/button/Button.test.js +4 -2
- package/button/types.d.ts +1 -1
- package/card/Card.accessibility.test.d.ts +1 -0
- package/card/Card.accessibility.test.js +36 -0
- package/card/Card.js +3 -2
- package/card/Card.test.d.ts +1 -0
- package/card/Card.test.js +1 -1
- package/checkbox/Checkbox.accessibility.test.d.ts +1 -0
- package/checkbox/Checkbox.accessibility.test.js +87 -0
- package/checkbox/Checkbox.js +36 -44
- package/checkbox/Checkbox.test.d.ts +1 -0
- package/checkbox/Checkbox.test.js +1 -1
- package/chip/Chip.accessibility.test.d.ts +1 -0
- package/chip/Chip.accessibility.test.js +69 -0
- package/chip/Chip.js +20 -26
- package/chip/Chip.stories.tsx +67 -50
- package/chip/Chip.test.d.ts +1 -0
- package/chip/Chip.test.js +5 -5
- package/chip/types.d.ts +35 -12
- package/common/coreTokens.d.ts +105 -14
- package/common/coreTokens.js +40 -22
- package/common/fonts.css +2 -0
- package/common/variables.d.ts +31 -141
- package/common/variables.js +104 -214
- 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/container/types.js +5 -0
- package/contextual-menu/ContextualMenu.accessibility.test.d.ts +1 -0
- package/contextual-menu/ContextualMenu.accessibility.test.js +98 -0
- package/contextual-menu/ContextualMenu.d.ts +5 -0
- package/contextual-menu/ContextualMenu.js +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/contextual-menu/types.js +5 -0
- package/date-input/Calendar.js +1 -1
- package/date-input/DateInput.accessibility.test.d.ts +1 -0
- package/date-input/DateInput.accessibility.test.js +230 -0
- package/date-input/DateInput.js +19 -20
- package/date-input/DateInput.stories.tsx +15 -8
- package/date-input/DateInput.test.d.ts +1 -0
- package/date-input/DateInput.test.js +9 -8
- package/date-input/DatePicker.js +13 -7
- package/date-input/YearPicker.js +1 -1
- package/date-input/types.d.ts +2 -2
- package/dialog/Dialog.accessibility.test.d.ts +1 -0
- package/dialog/Dialog.accessibility.test.js +69 -0
- package/dialog/Dialog.js +11 -25
- package/dialog/Dialog.stories.tsx +175 -0
- package/dialog/Dialog.test.d.ts +1 -0
- package/dialog/Dialog.test.js +113 -49
- 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/divider/types.js +5 -0
- package/dropdown/Dropdown.accessibility.test.d.ts +1 -0
- package/dropdown/Dropdown.accessibility.test.js +184 -0
- package/dropdown/Dropdown.js +37 -51
- package/dropdown/Dropdown.stories.tsx +15 -26
- package/dropdown/Dropdown.test.d.ts +1 -0
- package/dropdown/Dropdown.test.js +100 -70
- package/dropdown/DropdownMenu.js +4 -4
- package/dropdown/DropdownMenuItem.js +8 -4
- package/dropdown/types.d.ts +3 -5
- package/file-input/FileInput.accessibility.test.d.ts +1 -0
- package/file-input/FileInput.accessibility.test.js +167 -0
- package/file-input/FileInput.js +127 -145
- package/file-input/FileInput.test.d.ts +1 -0
- package/file-input/FileInput.test.js +125 -129
- package/file-input/FileItem.js +18 -28
- package/file-input/types.d.ts +1 -1
- 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 +36 -31
- package/footer/Footer.stories.tsx +58 -2
- package/footer/Footer.test.d.ts +1 -0
- package/footer/Footer.test.js +1 -1
- package/footer/Icons.d.ts +1 -0
- package/footer/Icons.js +52 -16
- package/footer/types.d.ts +8 -8
- package/header/Header.accessibility.test.d.ts +1 -0
- package/header/Header.accessibility.test.js +94 -0
- package/header/Header.js +20 -41
- package/header/Header.stories.tsx +16 -0
- package/header/Header.test.d.ts +1 -0
- package/header/Header.test.js +1 -1
- package/header/Icons.js +1 -6
- package/header/types.d.ts +4 -3
- package/heading/Heading.accessibility.test.d.ts +1 -0
- package/heading/Heading.accessibility.test.js +33 -0
- package/heading/Heading.js +1 -1
- package/heading/Heading.test.d.ts +1 -0
- package/heading/Heading.test.js +1 -14
- 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.js +1 -1
- package/image/Image.stories.tsx +3 -1
- package/layout/ApplicationLayout.d.ts +1 -1
- package/layout/ApplicationLayout.js +10 -7
- package/layout/Icons.d.ts +0 -1
- package/layout/Icons.js +1 -11
- package/link/Link.accessibility.test.d.ts +1 -0
- package/link/Link.accessibility.test.js +108 -0
- package/link/Link.js +8 -6
- package/link/Link.stories.tsx +4 -4
- package/link/Link.test.d.ts +1 -0
- package/link/Link.test.js +1 -1
- package/link/types.d.ts +1 -1
- package/main.d.ts +8 -3
- package/main.js +38 -9
- 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 +1 -2
- package/nav-tabs/NavTabs.js +25 -7
- package/nav-tabs/NavTabs.stories.tsx +44 -24
- package/nav-tabs/NavTabs.test.d.ts +1 -0
- package/nav-tabs/NavTabs.test.js +12 -10
- package/nav-tabs/NavTabsContext.d.ts +3 -0
- package/nav-tabs/NavTabsContext.js +8 -0
- package/nav-tabs/Tab.js +23 -23
- package/nav-tabs/types.d.ts +1 -1
- package/number-input/NumberInput.accessibility.test.d.ts +1 -0
- package/number-input/NumberInput.accessibility.test.js +228 -0
- package/number-input/NumberInput.d.ts +0 -7
- package/number-input/NumberInput.js +24 -5
- package/number-input/NumberInput.test.d.ts +1 -0
- package/number-input/NumberInput.test.js +166 -7
- package/number-input/NumberInputContext.d.ts +3 -0
- package/number-input/NumberInputContext.js +8 -0
- package/number-input/types.d.ts +6 -0
- package/package.json +20 -18
- package/paginator/Paginator.accessibility.test.d.ts +1 -0
- package/paginator/Paginator.accessibility.test.js +79 -0
- package/paginator/Paginator.js +14 -14
- package/paginator/Paginator.test.d.ts +1 -0
- package/paginator/Paginator.test.js +1 -1
- package/paragraph/Paragraph.accessibility.test.d.ts +1 -0
- package/paragraph/Paragraph.accessibility.test.js +28 -0
- package/paragraph/Paragraph.js +2 -7
- package/password-input/PasswordInput.accessibility.test.d.ts +1 -0
- package/password-input/PasswordInput.accessibility.test.js +153 -0
- package/password-input/PasswordInput.js +7 -7
- package/password-input/PasswordInput.stories.tsx +0 -1
- package/password-input/PasswordInput.test.d.ts +1 -0
- package/password-input/PasswordInput.test.js +5 -5
- package/progress-bar/ProgressBar.accessibility.test.d.ts +1 -0
- package/progress-bar/ProgressBar.accessibility.test.js +35 -0
- package/progress-bar/ProgressBar.js +11 -15
- package/progress-bar/ProgressBar.test.d.ts +1 -0
- package/progress-bar/ProgressBar.test.js +1 -1
- package/quick-nav/QuickNav.accessibility.test.d.ts +1 -0
- package/quick-nav/QuickNav.accessibility.test.js +57 -0
- package/quick-nav/QuickNav.js +1 -1
- package/radio-group/Radio.js +6 -9
- package/radio-group/RadioGroup.accessibility.test.d.ts +1 -0
- package/radio-group/RadioGroup.accessibility.test.js +97 -0
- package/radio-group/RadioGroup.js +15 -17
- package/radio-group/RadioGroup.test.d.ts +1 -0
- package/radio-group/RadioGroup.test.js +3 -5
- 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 +4 -1
- package/resultset-table/ResultsetTable.js +25 -13
- package/resultset-table/ResultsetTable.stories.tsx +118 -5
- package/resultset-table/ResultsetTable.test.d.ts +1 -0
- package/resultset-table/ResultsetTable.test.js +76 -1
- package/resultset-table/types.d.ts +40 -7
- package/select/Listbox.js +24 -16
- package/select/Option.js +19 -10
- package/select/Select.accessibility.test.d.ts +1 -0
- package/select/Select.accessibility.test.js +228 -0
- package/select/Select.js +72 -54
- package/select/Select.stories.tsx +59 -111
- package/select/Select.test.d.ts +1 -0
- package/select/Select.test.js +393 -459
- package/select/types.d.ts +3 -3
- package/sidenav/Sidenav.accessibility.test.d.ts +1 -0
- package/sidenav/Sidenav.accessibility.test.js +59 -0
- package/sidenav/Sidenav.js +21 -19
- package/sidenav/Sidenav.stories.tsx +4 -9
- package/sidenav/Sidenav.test.d.ts +1 -0
- package/sidenav/Sidenav.test.js +1 -1
- package/sidenav/types.d.ts +2 -2
- package/slider/Slider.accessibility.test.d.ts +1 -0
- package/slider/Slider.accessibility.test.js +104 -0
- package/slider/Slider.js +31 -42
- package/slider/Slider.stories.tsx +180 -0
- package/slider/Slider.test.d.ts +1 -0
- package/slider/Slider.test.js +12 -9
- package/spinner/Spinner.accessibility.test.d.ts +1 -0
- package/spinner/Spinner.accessibility.test.js +96 -0
- package/spinner/Spinner.js +12 -16
- package/spinner/Spinner.test.d.ts +1 -0
- package/spinner/Spinner.test.js +1 -1
- 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.js +29 -37
- package/switch/Switch.stories.tsx +12 -0
- package/switch/Switch.test.d.ts +1 -0
- package/switch/Switch.test.js +1 -1
- 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 +74 -12
- package/table/Table.stories.tsx +309 -2
- package/table/Table.test.d.ts +1 -0
- package/table/Table.test.js +92 -1
- package/table/types.d.ts +28 -0
- package/tabs/Tab.js +13 -9
- package/tabs/Tabs.accessibility.test.d.ts +1 -0
- package/tabs/Tabs.accessibility.test.js +56 -0
- package/tabs/Tabs.js +12 -24
- package/tabs/Tabs.stories.tsx +8 -4
- package/tabs/Tabs.test.d.ts +1 -0
- package/tabs/Tabs.test.js +20 -38
- package/tabs/types.d.ts +2 -2
- package/tag/Tag.accessibility.test.d.ts +1 -0
- package/tag/Tag.accessibility.test.js +69 -0
- package/tag/Tag.js +7 -7
- package/tag/Tag.stories.tsx +4 -7
- package/tag/Tag.test.d.ts +1 -0
- package/tag/Tag.test.js +5 -13
- package/tag/types.d.ts +2 -2
- package/text-input/Suggestion.js +1 -1
- package/text-input/Suggestions.js +19 -14
- package/text-input/TextInput.accessibility.test.d.ts +1 -0
- package/text-input/TextInput.accessibility.test.js +321 -0
- package/text-input/TextInput.js +103 -126
- package/text-input/TextInput.stories.tsx +17 -8
- package/text-input/TextInput.test.d.ts +1 -0
- package/text-input/TextInput.test.js +97 -80
- package/textarea/Textarea.accessibility.test.d.ts +1 -0
- package/textarea/Textarea.accessibility.test.js +155 -0
- package/textarea/Textarea.js +13 -21
- package/textarea/Textarea.stories.tsx +0 -1
- package/textarea/Textarea.test.d.ts +1 -0
- package/textarea/Textarea.test.js +1 -1
- package/toggle-group/ToggleGroup.accessibility.test.d.ts +1 -0
- package/toggle-group/ToggleGroup.accessibility.test.js +107 -0
- package/toggle-group/ToggleGroup.js +11 -16
- package/toggle-group/ToggleGroup.stories.tsx +3 -3
- package/toggle-group/ToggleGroup.test.d.ts +1 -0
- package/toggle-group/ToggleGroup.test.js +1 -1
- package/toggle-group/types.d.ts +2 -2
- package/typography/Typography.accessibility.test.d.ts +1 -0
- package/typography/Typography.accessibility.test.js +339 -0
- package/useTheme.d.ts +31 -141
- package/utils/BaseTypography.js +1 -1
- package/utils/FocusLock.js +16 -6
- package/wizard/Wizard.accessibility.test.d.ts +1 -0
- package/wizard/Wizard.accessibility.test.js +55 -0
- package/wizard/Wizard.js +14 -25
- package/wizard/Wizard.stories.tsx +19 -0
- package/wizard/Wizard.test.d.ts +1 -0
- package/wizard/Wizard.test.js +1 -1
- package/wizard/types.d.ts +2 -2
- package/common/OpenSans.css +0 -69
- package/common/fonts/OpenSans-Bold.ttf +0 -0
- package/common/fonts/OpenSans-BoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBold.ttf +0 -0
- package/common/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- package/common/fonts/OpenSans-Italic.ttf +0 -0
- package/common/fonts/OpenSans-Light.ttf +0 -0
- package/common/fonts/OpenSans-LightItalic.ttf +0 -0
- package/common/fonts/OpenSans-Regular.ttf +0 -0
- package/common/fonts/OpenSans-SemiBold.ttf +0 -0
- package/common/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
- package/date-input/Icons.d.ts +0 -6
- package/date-input/Icons.js +0 -58
- package/paginator/Icons.d.ts +0 -5
- package/paginator/Icons.js +0 -40
- package/password-input/Icons.d.ts +0 -6
- package/password-input/Icons.js +0 -35
- package/select/Icons.d.ts +0 -10
- package/select/Icons.js +0 -89
- package/sidenav/Icons.d.ts +0 -7
- package/sidenav/Icons.js +0 -47
- package/text-input/Icons.d.ts +0 -8
- package/text-input/Icons.js +0 -56
- /package/{layout → sidenav}/SidenavContext.d.ts +0 -0
- /package/{layout → sidenav}/SidenavContext.js +0 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
5
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
var _react2 = require("@testing-library/react");
|
|
8
|
+
var _axeHelper = require("../../test/accessibility/axe-helper.js");
|
|
9
|
+
var _FileInput = _interopRequireDefault(require("./FileInput"));
|
|
10
|
+
var picPreview = "https://cdn.mos.cms.futurecdn.net/CAZ6JXi6huSuN4QGE627NR.jpg";
|
|
11
|
+
var file1 = new File(["file1"], "file.pdf", {
|
|
12
|
+
type: "text/plain"
|
|
13
|
+
});
|
|
14
|
+
var file2 = new File(["file2"], "file2.mp3", {
|
|
15
|
+
type: "audio"
|
|
16
|
+
});
|
|
17
|
+
var file3 = new File(["file3"], "file3.png", {
|
|
18
|
+
type: "image/png"
|
|
19
|
+
});
|
|
20
|
+
var file4 = new File(["file4"], "file4file4file4file4file4file4file4file4file4.mp4", {
|
|
21
|
+
type: "video"
|
|
22
|
+
});
|
|
23
|
+
var file5 = new File(["file5"], "file5file5file5file5file5file5file5file5file5.mp4", {
|
|
24
|
+
type: "video"
|
|
25
|
+
});
|
|
26
|
+
var filesExamples = [{
|
|
27
|
+
file: file1
|
|
28
|
+
}, {
|
|
29
|
+
file: file2
|
|
30
|
+
}, {
|
|
31
|
+
file: file3,
|
|
32
|
+
preview: picPreview
|
|
33
|
+
}, {
|
|
34
|
+
file: file4
|
|
35
|
+
}, {
|
|
36
|
+
error: "This error message is a multiline paragraph for testing.",
|
|
37
|
+
file: file5
|
|
38
|
+
}, {
|
|
39
|
+
error: "Error message",
|
|
40
|
+
file: file3,
|
|
41
|
+
preview: picPreview
|
|
42
|
+
}];
|
|
43
|
+
describe("FileInput component accessibility tests", function () {
|
|
44
|
+
it("Should not have basic accessibility issues for dropzone mode", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
45
|
+
var callbackFile, _render, container, results;
|
|
46
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
47
|
+
while (1) switch (_context.prev = _context.next) {
|
|
48
|
+
case 0:
|
|
49
|
+
callbackFile = jest.fn();
|
|
50
|
+
_render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_FileInput["default"], {
|
|
51
|
+
label: "File input",
|
|
52
|
+
helperText: "Helper Text",
|
|
53
|
+
value: filesExamples,
|
|
54
|
+
buttonLabel: "Button Label",
|
|
55
|
+
dropAreaLabel: "Drop Area",
|
|
56
|
+
margin: "medium",
|
|
57
|
+
mode: "dropzone",
|
|
58
|
+
multiple: true,
|
|
59
|
+
callbackFile: callbackFile,
|
|
60
|
+
minSize: 1000,
|
|
61
|
+
maxSize: 20000,
|
|
62
|
+
showPreview: true
|
|
63
|
+
})), container = _render.container;
|
|
64
|
+
_context.next = 4;
|
|
65
|
+
return (0, _axeHelper.axe)(container);
|
|
66
|
+
case 4:
|
|
67
|
+
results = _context.sent;
|
|
68
|
+
expect(results).toHaveNoViolations();
|
|
69
|
+
case 6:
|
|
70
|
+
case "end":
|
|
71
|
+
return _context.stop();
|
|
72
|
+
}
|
|
73
|
+
}, _callee);
|
|
74
|
+
})));
|
|
75
|
+
it("Should not have basic accessibility issues for disabled mode", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
76
|
+
var callbackFile, _render2, container, results;
|
|
77
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
78
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
79
|
+
case 0:
|
|
80
|
+
callbackFile = jest.fn();
|
|
81
|
+
_render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_FileInput["default"], {
|
|
82
|
+
label: "File input",
|
|
83
|
+
helperText: "Helper Text",
|
|
84
|
+
value: filesExamples,
|
|
85
|
+
buttonLabel: "Button Label",
|
|
86
|
+
dropAreaLabel: "Drop Area",
|
|
87
|
+
margin: "medium",
|
|
88
|
+
mode: "dropzone",
|
|
89
|
+
multiple: true,
|
|
90
|
+
callbackFile: callbackFile,
|
|
91
|
+
minSize: 1000,
|
|
92
|
+
maxSize: 20000,
|
|
93
|
+
disabled: true
|
|
94
|
+
})), container = _render2.container;
|
|
95
|
+
_context2.next = 4;
|
|
96
|
+
return (0, _axeHelper.axe)(container);
|
|
97
|
+
case 4:
|
|
98
|
+
results = _context2.sent;
|
|
99
|
+
expect(results).toHaveNoViolations();
|
|
100
|
+
case 6:
|
|
101
|
+
case "end":
|
|
102
|
+
return _context2.stop();
|
|
103
|
+
}
|
|
104
|
+
}, _callee2);
|
|
105
|
+
})));
|
|
106
|
+
it("Should not have basic accessibility issues for file mode", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
107
|
+
var callbackFile, _render3, container, results;
|
|
108
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
109
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
110
|
+
case 0:
|
|
111
|
+
callbackFile = jest.fn();
|
|
112
|
+
_render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_FileInput["default"], {
|
|
113
|
+
label: "File input",
|
|
114
|
+
helperText: "Helper Text",
|
|
115
|
+
value: filesExamples,
|
|
116
|
+
buttonLabel: "Button Label",
|
|
117
|
+
margin: "medium",
|
|
118
|
+
mode: "file",
|
|
119
|
+
multiple: true,
|
|
120
|
+
callbackFile: callbackFile,
|
|
121
|
+
minSize: 1000,
|
|
122
|
+
maxSize: 20000,
|
|
123
|
+
showPreview: true
|
|
124
|
+
})), container = _render3.container;
|
|
125
|
+
_context3.next = 4;
|
|
126
|
+
return (0, _axeHelper.axe)(container);
|
|
127
|
+
case 4:
|
|
128
|
+
results = _context3.sent;
|
|
129
|
+
expect(results).toHaveNoViolations();
|
|
130
|
+
case 6:
|
|
131
|
+
case "end":
|
|
132
|
+
return _context3.stop();
|
|
133
|
+
}
|
|
134
|
+
}, _callee3);
|
|
135
|
+
})));
|
|
136
|
+
it("Should not have basic accessibility issues for filedrop mode", /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
137
|
+
var callbackFile, _render4, container, results;
|
|
138
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
139
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
140
|
+
case 0:
|
|
141
|
+
callbackFile = jest.fn();
|
|
142
|
+
_render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_FileInput["default"], {
|
|
143
|
+
label: "File input",
|
|
144
|
+
helperText: "Helper Text",
|
|
145
|
+
value: filesExamples,
|
|
146
|
+
buttonLabel: "Button Label",
|
|
147
|
+
dropAreaLabel: "Drop Area",
|
|
148
|
+
margin: "medium",
|
|
149
|
+
mode: "filedrop",
|
|
150
|
+
multiple: true,
|
|
151
|
+
callbackFile: callbackFile,
|
|
152
|
+
minSize: 1000,
|
|
153
|
+
maxSize: 20000,
|
|
154
|
+
showPreview: true
|
|
155
|
+
})), container = _render4.container;
|
|
156
|
+
_context4.next = 4;
|
|
157
|
+
return (0, _axeHelper.axe)(container);
|
|
158
|
+
case 4:
|
|
159
|
+
results = _context4.sent;
|
|
160
|
+
expect(results).toHaveNoViolations();
|
|
161
|
+
case 6:
|
|
162
|
+
case "end":
|
|
163
|
+
return _context4.stop();
|
|
164
|
+
}
|
|
165
|
+
}, _callee4);
|
|
166
|
+
})));
|
|
167
|
+
});
|
package/file-input/FileInput.js
CHANGED
|
@@ -11,11 +11,10 @@ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/hel
|
|
|
11
11
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
12
12
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
13
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
14
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
16
16
|
var _react = _interopRequireWildcard(require("react"));
|
|
17
17
|
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
18
|
-
var _uuid = require("uuid");
|
|
19
18
|
var _variables = require("../common/variables");
|
|
20
19
|
var _useTheme = _interopRequireDefault(require("../useTheme"));
|
|
21
20
|
var _useTranslatedLabels = _interopRequireDefault(require("../useTranslatedLabels"));
|
|
@@ -23,79 +22,87 @@ var _Button = _interopRequireDefault(require("../button/Button"));
|
|
|
23
22
|
var _FileItem = _interopRequireDefault(require("./FileItem"));
|
|
24
23
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
|
|
25
24
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
26
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u &&
|
|
25
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
27
26
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
28
27
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
}));
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
});
|
|
28
|
+
var getFilePreview = /*#__PURE__*/function () {
|
|
29
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(file) {
|
|
30
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
31
|
+
while (1) switch (_context.prev = _context.next) {
|
|
32
|
+
case 0:
|
|
33
|
+
if (!file.type.includes("video")) {
|
|
34
|
+
_context.next = 4;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
return _context.abrupt("return", "filled_movie");
|
|
38
|
+
case 4:
|
|
39
|
+
if (!file.type.includes("audio")) {
|
|
40
|
+
_context.next = 8;
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
return _context.abrupt("return", "music_video");
|
|
44
|
+
case 8:
|
|
45
|
+
if (!file.type.includes("image")) {
|
|
46
|
+
_context.next = 12;
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
return _context.abrupt("return", new Promise(function (resolve) {
|
|
50
|
+
var reader = new FileReader();
|
|
51
|
+
reader.readAsDataURL(file);
|
|
52
|
+
reader.onload = function (e) {
|
|
53
|
+
resolve(e.target.result);
|
|
54
|
+
};
|
|
55
|
+
}));
|
|
56
|
+
case 12:
|
|
57
|
+
return _context.abrupt("return", "draft");
|
|
58
|
+
case 13:
|
|
59
|
+
case "end":
|
|
60
|
+
return _context.stop();
|
|
61
|
+
}
|
|
62
|
+
}, _callee);
|
|
63
|
+
}));
|
|
64
|
+
return function getFilePreview(_x) {
|
|
65
|
+
return _ref.apply(this, arguments);
|
|
66
|
+
};
|
|
67
|
+
}();
|
|
68
|
+
var isFileIncluded = function isFileIncluded(file, fileList) {
|
|
69
|
+
var fileListInfo = fileList.map(function (existingFile) {
|
|
70
|
+
return existingFile.file;
|
|
71
|
+
});
|
|
72
|
+
return fileListInfo.some(function (_ref2) {
|
|
73
|
+
var name = _ref2.name,
|
|
74
|
+
size = _ref2.size,
|
|
75
|
+
type = _ref2.type,
|
|
76
|
+
lastModified = _ref2.lastModified,
|
|
77
|
+
webkitRelativePath = _ref2.webkitRelativePath;
|
|
78
|
+
return name === file.file.name && size === file.file.size && type === file.file.type && lastModified === file.file.lastModified && webkitRelativePath === file.file.webkitRelativePath;
|
|
79
|
+
});
|
|
73
80
|
};
|
|
74
|
-
var DxcFileInput = /*#__PURE__*/_react["default"].forwardRef(function (
|
|
75
|
-
var
|
|
76
|
-
name =
|
|
77
|
-
|
|
78
|
-
mode =
|
|
79
|
-
|
|
80
|
-
label =
|
|
81
|
-
buttonLabel =
|
|
82
|
-
dropAreaLabel =
|
|
83
|
-
|
|
84
|
-
helperText =
|
|
85
|
-
accept =
|
|
86
|
-
minSize =
|
|
87
|
-
maxSize =
|
|
88
|
-
|
|
89
|
-
showPreview =
|
|
90
|
-
|
|
91
|
-
multiple =
|
|
92
|
-
|
|
93
|
-
disabled =
|
|
94
|
-
callbackFile =
|
|
95
|
-
value =
|
|
96
|
-
margin =
|
|
97
|
-
|
|
98
|
-
tabIndex =
|
|
81
|
+
var DxcFileInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref3, ref) {
|
|
82
|
+
var _ref3$name = _ref3.name,
|
|
83
|
+
name = _ref3$name === void 0 ? "" : _ref3$name,
|
|
84
|
+
_ref3$mode = _ref3.mode,
|
|
85
|
+
mode = _ref3$mode === void 0 ? "file" : _ref3$mode,
|
|
86
|
+
_ref3$label = _ref3.label,
|
|
87
|
+
label = _ref3$label === void 0 ? "" : _ref3$label,
|
|
88
|
+
buttonLabel = _ref3.buttonLabel,
|
|
89
|
+
dropAreaLabel = _ref3.dropAreaLabel,
|
|
90
|
+
_ref3$helperText = _ref3.helperText,
|
|
91
|
+
helperText = _ref3$helperText === void 0 ? "" : _ref3$helperText,
|
|
92
|
+
accept = _ref3.accept,
|
|
93
|
+
minSize = _ref3.minSize,
|
|
94
|
+
maxSize = _ref3.maxSize,
|
|
95
|
+
_ref3$showPreview = _ref3.showPreview,
|
|
96
|
+
showPreview = _ref3$showPreview === void 0 ? false : _ref3$showPreview,
|
|
97
|
+
_ref3$multiple = _ref3.multiple,
|
|
98
|
+
multiple = _ref3$multiple === void 0 ? true : _ref3$multiple,
|
|
99
|
+
_ref3$disabled = _ref3.disabled,
|
|
100
|
+
disabled = _ref3$disabled === void 0 ? false : _ref3$disabled,
|
|
101
|
+
callbackFile = _ref3.callbackFile,
|
|
102
|
+
value = _ref3.value,
|
|
103
|
+
margin = _ref3.margin,
|
|
104
|
+
_ref3$tabIndex = _ref3.tabIndex,
|
|
105
|
+
tabIndex = _ref3$tabIndex === void 0 ? 0 : _ref3$tabIndex;
|
|
99
106
|
var _useState = (0, _react.useState)(false),
|
|
100
107
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
101
108
|
isDragging = _useState2[0],
|
|
@@ -104,21 +111,19 @@ var DxcFileInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
104
111
|
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
105
112
|
files = _useState4[0],
|
|
106
113
|
setFiles = _useState4[1];
|
|
107
|
-
var
|
|
108
|
-
_useState6 = (0, _slicedToArray2["default"])(_useState5, 1),
|
|
109
|
-
fileInputId = _useState6[0];
|
|
114
|
+
var fileInputId = "file-input-".concat((0, _react.useId)());
|
|
110
115
|
var colorsTheme = (0, _useTheme["default"])();
|
|
111
116
|
var translatedLabels = (0, _useTranslatedLabels["default"])();
|
|
112
117
|
var checkFileSize = function checkFileSize(file) {
|
|
113
118
|
if (file.size < minSize) return translatedLabels.fileInput.fileSizeGreaterThanErrorMessage;else if (file.size > maxSize) return translatedLabels.fileInput.fileSizeLessThanErrorMessage;
|
|
114
119
|
};
|
|
115
120
|
var getFilesToAdd = /*#__PURE__*/function () {
|
|
116
|
-
var
|
|
121
|
+
var _ref4 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(selectedFiles) {
|
|
117
122
|
var filesToAdd;
|
|
118
|
-
return _regenerator["default"].wrap(function
|
|
119
|
-
while (1) switch (
|
|
123
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
124
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
120
125
|
case 0:
|
|
121
|
-
|
|
126
|
+
_context2.next = 2;
|
|
122
127
|
return Promise.all(selectedFiles.map(function (selectedFile) {
|
|
123
128
|
return getFilePreview(selectedFile);
|
|
124
129
|
})).then(function (previews) {
|
|
@@ -132,63 +137,40 @@ var DxcFileInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
132
137
|
});
|
|
133
138
|
});
|
|
134
139
|
case 2:
|
|
135
|
-
filesToAdd =
|
|
136
|
-
return
|
|
140
|
+
filesToAdd = _context2.sent;
|
|
141
|
+
return _context2.abrupt("return", filesToAdd.filter(function (file) {
|
|
142
|
+
return !isFileIncluded(file, files);
|
|
143
|
+
}));
|
|
137
144
|
case 4:
|
|
138
145
|
case "end":
|
|
139
|
-
return
|
|
146
|
+
return _context2.stop();
|
|
140
147
|
}
|
|
141
|
-
},
|
|
148
|
+
}, _callee2);
|
|
142
149
|
}));
|
|
143
|
-
return function getFilesToAdd(
|
|
144
|
-
return
|
|
150
|
+
return function getFilesToAdd(_x2) {
|
|
151
|
+
return _ref4.apply(this, arguments);
|
|
145
152
|
};
|
|
146
153
|
}();
|
|
147
154
|
var addFile = /*#__PURE__*/function () {
|
|
148
|
-
var
|
|
149
|
-
var filesToAdd, finalFiles
|
|
150
|
-
return _regenerator["default"].wrap(function
|
|
151
|
-
while (1) switch (
|
|
155
|
+
var _ref5 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(selectedFiles) {
|
|
156
|
+
var filesToAdd, finalFiles;
|
|
157
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
158
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
152
159
|
case 0:
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
return getFilesToAdd(selectedFiles);
|
|
159
|
-
case 3:
|
|
160
|
-
filesToAdd = _context2.sent;
|
|
161
|
-
finalFiles = [].concat((0, _toConsumableArray2["default"])(files), (0, _toConsumableArray2["default"])(filesToAdd));
|
|
160
|
+
_context3.next = 2;
|
|
161
|
+
return getFilesToAdd(multiple ? selectedFiles : selectedFiles.length === 1 ? selectedFiles : [selectedFiles[0]]);
|
|
162
|
+
case 2:
|
|
163
|
+
filesToAdd = _context3.sent;
|
|
164
|
+
finalFiles = multiple ? [].concat((0, _toConsumableArray2["default"])(files), (0, _toConsumableArray2["default"])(filesToAdd)) : filesToAdd;
|
|
162
165
|
callbackFile === null || callbackFile === void 0 ? void 0 : callbackFile(finalFiles);
|
|
163
|
-
|
|
164
|
-
break;
|
|
165
|
-
case 8:
|
|
166
|
-
if (!(selectedFiles.length === 1)) {
|
|
167
|
-
_context2.next = 14;
|
|
168
|
-
break;
|
|
169
|
-
}
|
|
170
|
-
_context2.next = 11;
|
|
171
|
-
return getFilesToAdd(selectedFiles);
|
|
172
|
-
case 11:
|
|
173
|
-
_context2.t0 = _context2.sent;
|
|
174
|
-
_context2.next = 17;
|
|
175
|
-
break;
|
|
176
|
-
case 14:
|
|
177
|
-
_context2.next = 16;
|
|
178
|
-
return getFilesToAdd([selectedFiles[0]]);
|
|
179
|
-
case 16:
|
|
180
|
-
_context2.t0 = _context2.sent;
|
|
181
|
-
case 17:
|
|
182
|
-
fileToAdd = _context2.t0;
|
|
183
|
-
callbackFile === null || callbackFile === void 0 ? void 0 : callbackFile(fileToAdd);
|
|
184
|
-
case 19:
|
|
166
|
+
case 5:
|
|
185
167
|
case "end":
|
|
186
|
-
return
|
|
168
|
+
return _context3.stop();
|
|
187
169
|
}
|
|
188
|
-
},
|
|
170
|
+
}, _callee3);
|
|
189
171
|
}));
|
|
190
|
-
return function addFile(
|
|
191
|
-
return
|
|
172
|
+
return function addFile(_x3) {
|
|
173
|
+
return _ref5.apply(this, arguments);
|
|
192
174
|
};
|
|
193
175
|
}();
|
|
194
176
|
var selectFiles = function selectFiles(e) {
|
|
@@ -237,56 +219,56 @@ var DxcFileInput = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref
|
|
|
237
219
|
};
|
|
238
220
|
(0, _react.useEffect)(function () {
|
|
239
221
|
var getFiles = /*#__PURE__*/function () {
|
|
240
|
-
var
|
|
222
|
+
var _ref6 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
241
223
|
var valueFiles;
|
|
242
|
-
return _regenerator["default"].wrap(function
|
|
243
|
-
while (1) switch (
|
|
224
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
225
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
244
226
|
case 0:
|
|
245
227
|
if (!value) {
|
|
246
|
-
|
|
228
|
+
_context5.next = 5;
|
|
247
229
|
break;
|
|
248
230
|
}
|
|
249
|
-
|
|
231
|
+
_context5.next = 3;
|
|
250
232
|
return Promise.all(value.map( /*#__PURE__*/function () {
|
|
251
|
-
var
|
|
233
|
+
var _ref7 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(file) {
|
|
252
234
|
var preview;
|
|
253
|
-
return _regenerator["default"].wrap(function
|
|
254
|
-
while (1) switch (
|
|
235
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
236
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
255
237
|
case 0:
|
|
256
238
|
if (!file.preview) {
|
|
257
|
-
|
|
239
|
+
_context4.next = 4;
|
|
258
240
|
break;
|
|
259
241
|
}
|
|
260
|
-
return
|
|
242
|
+
return _context4.abrupt("return", file);
|
|
261
243
|
case 4:
|
|
262
|
-
|
|
244
|
+
_context4.next = 6;
|
|
263
245
|
return getFilePreview(file.file);
|
|
264
246
|
case 6:
|
|
265
|
-
preview =
|
|
266
|
-
return
|
|
247
|
+
preview = _context4.sent;
|
|
248
|
+
return _context4.abrupt("return", _objectSpread(_objectSpread({}, file), {}, {
|
|
267
249
|
preview: preview
|
|
268
250
|
}));
|
|
269
251
|
case 8:
|
|
270
252
|
case "end":
|
|
271
|
-
return
|
|
253
|
+
return _context4.stop();
|
|
272
254
|
}
|
|
273
|
-
},
|
|
255
|
+
}, _callee4);
|
|
274
256
|
}));
|
|
275
|
-
return function (
|
|
276
|
-
return
|
|
257
|
+
return function (_x4) {
|
|
258
|
+
return _ref7.apply(this, arguments);
|
|
277
259
|
};
|
|
278
260
|
}()));
|
|
279
261
|
case 3:
|
|
280
|
-
valueFiles =
|
|
262
|
+
valueFiles = _context5.sent;
|
|
281
263
|
setFiles(valueFiles);
|
|
282
264
|
case 5:
|
|
283
265
|
case "end":
|
|
284
|
-
return
|
|
266
|
+
return _context5.stop();
|
|
285
267
|
}
|
|
286
|
-
},
|
|
268
|
+
}, _callee5);
|
|
287
269
|
}));
|
|
288
270
|
return function getFiles() {
|
|
289
|
-
return
|
|
271
|
+
return _ref6.apply(this, arguments);
|
|
290
272
|
};
|
|
291
273
|
}();
|
|
292
274
|
getFiles();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|