@dxc-technology/halstack-react 0.0.0-ebb089f → 0.0.0-ec06b53
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 +12 -0
- package/HalstackContext.js +294 -0
- package/accordion/Accordion.d.ts +4 -0
- package/accordion/Accordion.js +245 -0
- package/accordion/Accordion.stories.tsx +306 -0
- package/accordion/Accordion.test.js +71 -0
- package/accordion/types.d.ts +69 -0
- package/accordion/types.js +5 -0
- package/accordion-group/AccordionGroup.d.ts +7 -0
- package/accordion-group/AccordionGroup.js +149 -0
- package/accordion-group/AccordionGroup.stories.tsx +251 -0
- package/accordion-group/AccordionGroup.test.js +126 -0
- package/accordion-group/types.d.ts +79 -0
- package/accordion-group/types.js +5 -0
- package/alert/Alert.d.ts +4 -0
- package/{dist/alert → alert}/Alert.js +44 -154
- package/alert/Alert.stories.tsx +170 -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 +341 -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 +116 -0
- package/box/Box.stories.tsx +132 -0
- package/box/Box.test.js +18 -0
- package/box/types.d.ts +44 -0
- package/box/types.js +5 -0
- package/bulleted-list/BulletedList.d.ts +7 -0
- package/bulleted-list/BulletedList.js +123 -0
- package/bulleted-list/BulletedList.stories.tsx +200 -0
- package/bulleted-list/types.d.ts +11 -0
- package/bulleted-list/types.js +5 -0
- package/button/Button.d.ts +4 -0
- package/button/Button.js +156 -0
- package/button/Button.stories.tsx +283 -0
- package/button/Button.test.js +35 -0
- package/button/types.d.ts +53 -0
- package/button/types.js +5 -0
- package/card/Card.d.ts +4 -0
- package/card/Card.js +161 -0
- package/card/Card.stories.tsx +201 -0
- package/card/Card.test.js +50 -0
- package/card/ice-cream.jpg +0 -0
- package/card/types.d.ts +68 -0
- package/card/types.js +5 -0
- package/checkbox/Checkbox.d.ts +4 -0
- package/checkbox/Checkbox.js +250 -0
- package/checkbox/Checkbox.stories.tsx +208 -0
- package/checkbox/Checkbox.test.js +155 -0
- package/checkbox/types.d.ts +68 -0
- package/checkbox/types.js +5 -0
- package/chip/Chip.d.ts +4 -0
- package/chip/Chip.js +161 -0
- package/chip/Chip.stories.tsx +119 -0
- package/chip/Chip.test.js +56 -0
- package/chip/types.d.ts +45 -0
- package/chip/types.js +5 -0
- package/{dist/common → common}/OpenSans.css +0 -0
- package/{dist/common → common}/RequiredComponent.js +3 -11
- 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
- package/{dist/common → common}/utils.js +0 -0
- package/{dist/common → common}/variables.js +363 -425
- 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 +227 -0
- package/date-input/DateInput.stories.tsx +151 -0
- package/date-input/DateInput.test.js +752 -0
- package/date-input/DatePicker.d.ts +4 -0
- package/date-input/DatePicker.js +160 -0
- package/date-input/YearPicker.d.ts +4 -0
- package/date-input/YearPicker.js +115 -0
- package/date-input/types.d.ts +160 -0
- package/date-input/types.js +5 -0
- package/dialog/Dialog.d.ts +4 -0
- package/dialog/Dialog.js +162 -0
- package/dialog/Dialog.stories.tsx +267 -0
- package/dialog/Dialog.test.js +70 -0
- package/dialog/types.d.ts +44 -0
- package/dialog/types.js +5 -0
- package/dropdown/Dropdown.d.ts +4 -0
- package/dropdown/Dropdown.js +391 -0
- package/dropdown/Dropdown.stories.tsx +312 -0
- package/dropdown/Dropdown.test.js +585 -0
- package/dropdown/DropdownMenu.d.ts +4 -0
- package/dropdown/DropdownMenu.js +80 -0
- package/dropdown/DropdownMenuItem.d.ts +4 -0
- package/dropdown/DropdownMenuItem.js +92 -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 +551 -0
- package/file-input/FileInput.stories.tsx +535 -0
- package/file-input/FileInput.test.js +498 -0
- package/file-input/FileItem.d.ts +4 -0
- package/file-input/FileItem.js +161 -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 +69 -0
- package/flex/Flex.stories.tsx +103 -0
- package/flex/types.d.ts +32 -0
- package/flex/types.js +5 -0
- package/footer/Footer.d.ts +4 -0
- package/footer/Footer.js +185 -0
- package/footer/Footer.stories.tsx +137 -0
- package/footer/Footer.test.js +109 -0
- package/footer/Icons.d.ts +2 -0
- package/{dist/footer → footer}/Icons.js +16 -16
- package/footer/types.d.ts +66 -0
- package/footer/types.js +5 -0
- package/header/Header.d.ts +7 -0
- package/header/Header.js +305 -0
- package/header/Header.stories.tsx +172 -0
- package/header/Header.test.js +79 -0
- package/header/Icons.d.ts +2 -0
- package/{dist/header → header}/Icons.js +9 -34
- package/header/types.d.ts +48 -0
- package/header/types.js +5 -0
- package/heading/Heading.d.ts +4 -0
- package/{dist/heading → heading}/Heading.js +25 -96
- 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/inset/Inset.d.ts +3 -0
- package/inset/Inset.js +51 -0
- package/inset/Inset.stories.tsx +229 -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 +171 -0
- package/layout/ApplicationLayout.stories.tsx +162 -0
- package/layout/Icons.d.ts +5 -0
- package/{dist/layout → layout}/Icons.js +19 -8
- package/layout/SidenavContext.d.ts +5 -0
- package/layout/SidenavContext.js +19 -0
- package/layout/types.d.ts +42 -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 +193 -0
- package/link/Link.test.js +83 -0
- package/link/types.d.ts +54 -0
- package/link/types.js +5 -0
- package/main.d.ts +44 -0
- package/{dist/main.js → main.js} +114 -104
- package/number-input/NumberInput.d.ts +4 -0
- package/number-input/NumberInput.js +76 -0
- package/number-input/NumberInput.stories.tsx +115 -0
- package/number-input/NumberInput.test.js +542 -0
- package/number-input/NumberInputContext.d.ts +4 -0
- package/{dist/number-input → number-input}/NumberInputContext.js +5 -2
- package/number-input/numberInputContextTypes.d.ts +19 -0
- package/number-input/numberInputContextTypes.js +5 -0
- package/number-input/types.d.ts +124 -0
- package/number-input/types.js +5 -0
- package/package.json +36 -33
- package/{dist/paginator → paginator}/Icons.js +9 -9
- package/paginator/Paginator.d.ts +4 -0
- package/paginator/Paginator.js +171 -0
- package/paginator/Paginator.stories.tsx +63 -0
- package/paginator/Paginator.test.js +308 -0
- package/paginator/types.d.ts +38 -0
- package/paginator/types.js +5 -0
- package/paragraph/Paragraph.d.ts +6 -0
- package/paragraph/Paragraph.js +38 -0
- package/paragraph/Paragraph.stories.tsx +44 -0
- package/password-input/PasswordInput.d.ts +4 -0
- package/{dist/password-input → password-input}/PasswordInput.js +40 -77
- package/password-input/PasswordInput.stories.tsx +131 -0
- package/password-input/PasswordInput.test.js +181 -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 +60 -0
- package/progress-bar/ProgressBar.test.js +110 -0
- package/progress-bar/types.d.ts +36 -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 +342 -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 +283 -0
- package/radio-group/RadioGroup.stories.tsx +101 -0
- package/radio-group/RadioGroup.test.js +722 -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 +330 -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 +198 -0
- package/select/Option.d.ts +4 -0
- package/select/Option.js +110 -0
- package/select/Select.d.ts +4 -0
- package/select/Select.js +645 -0
- package/select/Select.stories.tsx +627 -0
- package/select/Select.test.js +2233 -0
- package/select/types.d.ts +210 -0
- package/select/types.js +5 -0
- package/sidenav/Sidenav.d.ts +10 -0
- package/sidenav/Sidenav.js +268 -0
- package/sidenav/Sidenav.stories.tsx +180 -0
- package/sidenav/Sidenav.test.js +44 -0
- package/sidenav/types.d.ts +73 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.d.ts +4 -0
- package/slider/Slider.js +343 -0
- package/slider/Slider.stories.tsx +183 -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 +250 -0
- package/spinner/Spinner.stories.jsx +103 -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 +138 -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 +12 -26
- package/table/Table.stories.jsx +277 -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 +135 -0
- package/tabs/Tabs.d.ts +4 -0
- package/tabs/Tabs.js +467 -0
- package/tabs/Tabs.stories.tsx +186 -0
- package/tabs/Tabs.test.js +351 -0
- package/tabs/types.d.ts +92 -0
- package/tabs/types.js +5 -0
- package/tabs-nav/NavTabs.d.ts +8 -0
- package/tabs-nav/NavTabs.js +125 -0
- package/tabs-nav/NavTabs.stories.tsx +170 -0
- package/tabs-nav/NavTabs.test.js +82 -0
- package/tabs-nav/Tab.d.ts +4 -0
- package/tabs-nav/Tab.js +130 -0
- package/tabs-nav/types.d.ts +53 -0
- package/tabs-nav/types.js +5 -0
- package/tag/Tag.d.ts +4 -0
- package/tag/Tag.js +183 -0
- package/tag/Tag.stories.tsx +142 -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 +57 -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 +677 -0
- package/text-input/TextInput.stories.tsx +481 -0
- package/text-input/TextInput.test.js +1624 -0
- package/text-input/types.d.ts +197 -0
- package/text-input/types.js +5 -0
- package/textarea/Textarea.d.ts +4 -0
- package/{dist/textarea → textarea}/Textarea.js +50 -142
- package/textarea/Textarea.stories.jsx +157 -0
- package/textarea/Textarea.test.js +437 -0
- package/textarea/types.d.ts +137 -0
- package/textarea/types.js +5 -0
- package/toggle-group/ToggleGroup.d.ts +4 -0
- package/{dist/toggle-group → toggle-group}/ToggleGroup.js +36 -148
- package/toggle-group/ToggleGroup.stories.tsx +173 -0
- package/toggle-group/ToggleGroup.test.js +156 -0
- package/toggle-group/types.d.ts +105 -0
- package/toggle-group/types.js +5 -0
- package/typography/Typography.d.ts +4 -0
- package/typography/Typography.js +131 -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 +2 -0
- package/{dist/useTheme.js → useTheme.js} +2 -2
- package/useTranslatedLabels.d.ts +2 -0
- package/useTranslatedLabels.js +20 -0
- package/wizard/Wizard.d.ts +4 -0
- package/wizard/Wizard.js +285 -0
- package/wizard/Wizard.stories.tsx +233 -0
- package/wizard/Wizard.test.js +141 -0
- package/wizard/types.d.ts +65 -0
- package/wizard/types.js +5 -0
- package/README.md +0 -66
- package/babel.config.js +0 -7
- package/dist/BackgroundColorContext.js +0 -46
- package/dist/ThemeContext.js +0 -250
- package/dist/V3Select/V3Select.js +0 -549
- package/dist/V3Select/index.d.ts +0 -27
- package/dist/V3Textarea/V3Textarea.js +0 -264
- package/dist/V3Textarea/index.d.ts +0 -27
- package/dist/accordion/Accordion.js +0 -353
- package/dist/accordion/index.d.ts +0 -28
- package/dist/accordion-group/AccordionGroup.js +0 -186
- package/dist/accordion-group/index.d.ts +0 -16
- package/dist/alert/index.d.ts +0 -51
- package/dist/badge/Badge.js +0 -63
- package/dist/box/Box.js +0 -156
- package/dist/box/index.d.ts +0 -25
- package/dist/button/Button.js +0 -238
- package/dist/button/Button.stories.js +0 -27
- package/dist/button/index.d.ts +0 -24
- package/dist/card/Card.js +0 -254
- package/dist/card/index.d.ts +0 -22
- package/dist/checkbox/Checkbox.js +0 -299
- package/dist/checkbox/index.d.ts +0 -24
- package/dist/chip/Chip.js +0 -265
- package/dist/chip/index.d.ts +0 -22
- package/dist/date/Date.js +0 -379
- package/dist/date/index.d.ts +0 -27
- package/dist/date-input/DateInput.js +0 -400
- package/dist/date-input/index.d.ts +0 -95
- package/dist/dialog/Dialog.js +0 -218
- package/dist/dialog/index.d.ts +0 -18
- package/dist/dropdown/Dropdown.js +0 -544
- package/dist/dropdown/index.d.ts +0 -26
- package/dist/file-input/FileInput.js +0 -644
- package/dist/file-input/FileItem.js +0 -287
- package/dist/file-input/index.d.ts +0 -81
- package/dist/footer/Footer.js +0 -421
- package/dist/footer/index.d.ts +0 -25
- package/dist/header/Header.js +0 -470
- package/dist/header/index.d.ts +0 -25
- package/dist/heading/index.d.ts +0 -17
- package/dist/input-text/Icons.js +0 -22
- package/dist/input-text/InputText.js +0 -705
- package/dist/input-text/index.d.ts +0 -36
- package/dist/layout/ApplicationLayout.js +0 -327
- package/dist/link/Link.js +0 -237
- package/dist/link/index.d.ts +0 -23
- package/dist/main.d.ts +0 -40
- package/dist/number-input/NumberInput.js +0 -136
- package/dist/number-input/index.d.ts +0 -113
- package/dist/paginator/Paginator.js +0 -305
- package/dist/paginator/index.d.ts +0 -20
- package/dist/password-input/index.d.ts +0 -94
- package/dist/progress-bar/ProgressBar.js +0 -242
- package/dist/progress-bar/index.d.ts +0 -18
- package/dist/radio/Radio.js +0 -209
- package/dist/radio/index.d.ts +0 -23
- package/dist/resultsetTable/ResultsetTable.js +0 -358
- package/dist/resultsetTable/index.d.ts +0 -19
- package/dist/select/Select.js +0 -1137
- package/dist/select/index.d.ts +0 -131
- package/dist/sidenav/Sidenav.js +0 -179
- package/dist/sidenav/index.d.ts +0 -13
- package/dist/slider/Slider.js +0 -404
- package/dist/slider/index.d.ts +0 -29
- package/dist/spinner/Spinner.js +0 -381
- package/dist/spinner/index.d.ts +0 -17
- package/dist/switch/Switch.js +0 -222
- package/dist/switch/index.d.ts +0 -24
- package/dist/table/index.d.ts +0 -13
- package/dist/tabs/Tabs.js +0 -343
- package/dist/tabs/index.d.ts +0 -19
- package/dist/tag/Tag.js +0 -282
- package/dist/tag/index.d.ts +0 -24
- package/dist/text-input/TextInput.js +0 -974
- package/dist/text-input/index.d.ts +0 -135
- package/dist/textarea/index.d.ts +0 -117
- package/dist/toggle/Toggle.js +0 -220
- package/dist/toggle/index.d.ts +0 -21
- package/dist/toggle-group/index.d.ts +0 -21
- package/dist/upload/Upload.js +0 -205
- package/dist/upload/buttons-upload/ButtonsUpload.js +0 -135
- package/dist/upload/buttons-upload/Icons.js +0 -40
- package/dist/upload/dragAndDropArea/DragAndDropArea.js +0 -329
- package/dist/upload/dragAndDropArea/Icons.js +0 -39
- package/dist/upload/file-upload/FileToUpload.js +0 -189
- package/dist/upload/file-upload/Icons.js +0 -66
- package/dist/upload/files-upload/FilesToUpload.js +0 -123
- package/dist/upload/index.d.ts +0 -15
- package/dist/upload/transaction/Icons.js +0 -160
- package/dist/upload/transaction/Transaction.js +0 -148
- package/dist/upload/transactions/Transactions.js +0 -138
- package/dist/wizard/Icons.js +0 -65
- package/dist/wizard/Wizard.js +0 -405
- package/dist/wizard/index.d.ts +0 -18
- 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 -395
- package/test/DateInput.test.js +0 -242
- 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 -94
- package/test/Header.test.js +0 -34
- package/test/Heading.test.js +0 -83
- package/test/InputText.test.js +0 -239
- package/test/Link.test.js +0 -43
- package/test/NumberInput.test.js +0 -259
- package/test/Paginator.test.js +0 -181
- 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 -330
- package/test/Select.test.js +0 -928
- package/test/Sidenav.test.js +0 -45
- package/test/Slider.test.js +0 -74
- 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/Tag.test.js +0 -32
- package/test/TextInput.test.js +0 -731
- package/test/Textarea.test.js +0 -193
- package/test/ToggleGroup.test.js +0 -85
- package/test/Upload.test.js +0 -60
- package/test/V3Select.test.js +0 -212
- package/test/V3TextArea.test.js +0 -51
- package/test/Wizard.test.js +0 -130
- package/test/mocks/pngMock.js +0 -1
- package/test/mocks/svgMock.js +0 -1
|
@@ -1,644 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
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 _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
17
|
-
|
|
18
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
19
|
-
|
|
20
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
21
|
-
|
|
22
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
23
|
-
|
|
24
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
25
|
-
|
|
26
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
27
|
-
|
|
28
|
-
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
29
|
-
|
|
30
|
-
var _uuid = require("uuid");
|
|
31
|
-
|
|
32
|
-
var _variables = require("../common/variables.js");
|
|
33
|
-
|
|
34
|
-
var _useTheme = _interopRequireDefault(require("../useTheme.js"));
|
|
35
|
-
|
|
36
|
-
var _Button = _interopRequireDefault(require("../button/Button"));
|
|
37
|
-
|
|
38
|
-
var _FileItem = _interopRequireDefault(require("./FileItem"));
|
|
39
|
-
|
|
40
|
-
function _templateObject11() {
|
|
41
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
|
|
42
|
-
|
|
43
|
-
_templateObject11 = function _templateObject11() {
|
|
44
|
-
return data;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
return data;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function _templateObject10() {
|
|
51
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n margin-top: ", ";\n margin-left: ", ";\n"]);
|
|
52
|
-
|
|
53
|
-
_templateObject10 = function _templateObject10() {
|
|
54
|
-
return data;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
return data;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function _templateObject9() {
|
|
61
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n margin-top: 0.25rem;\n"]);
|
|
62
|
-
|
|
63
|
-
_templateObject9 = function _templateObject9() {
|
|
64
|
-
return data;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
return data;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function _templateObject8() {
|
|
71
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n"]);
|
|
72
|
-
|
|
73
|
-
_templateObject8 = function _templateObject8() {
|
|
74
|
-
return data;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
return data;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
function _templateObject7() {
|
|
81
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n padding: ", ";\n input[type=\"file\"] {\n visibility: hidden;\n position: absolute;\n width: 0px;\n height: 0px;\n }\n"]);
|
|
82
|
-
|
|
83
|
-
_templateObject7 = function _templateObject7() {
|
|
84
|
-
return data;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
return data;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function _templateObject6() {
|
|
91
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n margin-top: 0.25rem;\n\n input[type=\"file\"] {\n visibility: hidden;\n position: absolute;\n width: 0px;\n height: 0px;\n }\n"]);
|
|
92
|
-
|
|
93
|
-
_templateObject6 = function _templateObject6() {
|
|
94
|
-
return data;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
return data;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function _templateObject5() {
|
|
101
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: ", ";\n"]);
|
|
102
|
-
|
|
103
|
-
_templateObject5 = function _templateObject5() {
|
|
104
|
-
return data;
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
return data;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function _templateObject4() {
|
|
111
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n height: ", ";\n width: calc(320px - 2px);\n display: flex;\n flex-direction: ", ";\n align-items: center;\n border-radius: ", ";\n border-width: ", ";\n border-style: ", ";\n background-color: ", ";\n border-color: ", ";\n cursor: ", ";\n"]);
|
|
112
|
-
|
|
113
|
-
_templateObject4 = function _templateObject4() {
|
|
114
|
-
return data;
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
return data;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
function _templateObject3() {
|
|
121
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
|
|
122
|
-
|
|
123
|
-
_templateObject3 = function _templateObject3() {
|
|
124
|
-
return data;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
return data;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function _templateObject2() {
|
|
131
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n color: ", ";\n font-family: ", ";\n font-size: ", ";\n font-weight: ", ";\n line-height: ", ";\n"]);
|
|
132
|
-
|
|
133
|
-
_templateObject2 = function _templateObject2() {
|
|
134
|
-
return data;
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
return data;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function _templateObject() {
|
|
141
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n margin: ", ";\n margin-top: ", ";\n margin-right: ", ";\n margin-bottom: ", ";\n margin-left: ", ";\n width: fit-content;\n"]);
|
|
142
|
-
|
|
143
|
-
_templateObject = function _templateObject() {
|
|
144
|
-
return data;
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
return data;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
var audioIcon = _react["default"].createElement("svg", {
|
|
151
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
152
|
-
width: "24",
|
|
153
|
-
height: "24",
|
|
154
|
-
viewBox: "0 0 24 24",
|
|
155
|
-
fill: "currentColor"
|
|
156
|
-
}, _react["default"].createElement("path", {
|
|
157
|
-
fill: "none",
|
|
158
|
-
d: "M0 0h24v24H0V0z"
|
|
159
|
-
}), _react["default"].createElement("path", {
|
|
160
|
-
d: "M21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H3V5h18v14zM8 15c0-1.66 1.34-3 3-3 .35 0 .69.07 1 .18V6h5v2h-3v7.03c-.02 1.64-1.35 2.97-3 2.97-1.66 0-3-1.34-3-3z"
|
|
161
|
-
}));
|
|
162
|
-
|
|
163
|
-
var videoIcon = _react["default"].createElement("svg", {
|
|
164
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
165
|
-
width: "24",
|
|
166
|
-
height: "24",
|
|
167
|
-
viewBox: "0 0 24 24",
|
|
168
|
-
fill: "currentColor"
|
|
169
|
-
}, _react["default"].createElement("path", {
|
|
170
|
-
d: "M18 4l2 4h-3l-2-4h-2l2 4h-3l-2-4H8l2 4H7L5 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4h-4z"
|
|
171
|
-
}), _react["default"].createElement("path", {
|
|
172
|
-
d: "M0 0h24v24H0z",
|
|
173
|
-
fill: "none"
|
|
174
|
-
}));
|
|
175
|
-
|
|
176
|
-
var fileIcon = _react["default"].createElement("svg", {
|
|
177
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
178
|
-
width: "24",
|
|
179
|
-
height: "24",
|
|
180
|
-
viewBox: "0 0 24 24",
|
|
181
|
-
fill: "currentColor"
|
|
182
|
-
}, _react["default"].createElement("path", {
|
|
183
|
-
fill: "none",
|
|
184
|
-
d: "M0 0h24v24H0V0z"
|
|
185
|
-
}), _react["default"].createElement("path", {
|
|
186
|
-
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"
|
|
187
|
-
}));
|
|
188
|
-
|
|
189
|
-
var DxcFileInput = function DxcFileInput(_ref) {
|
|
190
|
-
var _ref$name = _ref.name,
|
|
191
|
-
name = _ref$name === void 0 ? "" : _ref$name,
|
|
192
|
-
_ref$mode = _ref.mode,
|
|
193
|
-
mode = _ref$mode === void 0 ? "file" : _ref$mode,
|
|
194
|
-
_ref$label = _ref.label,
|
|
195
|
-
label = _ref$label === void 0 ? "" : _ref$label,
|
|
196
|
-
_ref$helperText = _ref.helperText,
|
|
197
|
-
helperText = _ref$helperText === void 0 ? "" : _ref$helperText,
|
|
198
|
-
accept = _ref.accept,
|
|
199
|
-
minSize = _ref.minSize,
|
|
200
|
-
maxSize = _ref.maxSize,
|
|
201
|
-
_ref$showPreview = _ref.showPreview,
|
|
202
|
-
showPreview = _ref$showPreview === void 0 ? false : _ref$showPreview,
|
|
203
|
-
_ref$multiple = _ref.multiple,
|
|
204
|
-
multiple = _ref$multiple === void 0 ? true : _ref$multiple,
|
|
205
|
-
_ref$disabled = _ref.disabled,
|
|
206
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
207
|
-
callbackFile = _ref.callbackFile,
|
|
208
|
-
value = _ref.value,
|
|
209
|
-
margin = _ref.margin,
|
|
210
|
-
tabIndex = _ref.tabIndex;
|
|
211
|
-
|
|
212
|
-
var _useState = (0, _react.useState)(false),
|
|
213
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
214
|
-
isDragging = _useState2[0],
|
|
215
|
-
setIsDragging = _useState2[1];
|
|
216
|
-
|
|
217
|
-
var _useState3 = (0, _react.useState)([]),
|
|
218
|
-
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
219
|
-
files = _useState4[0],
|
|
220
|
-
setFiles = _useState4[1];
|
|
221
|
-
|
|
222
|
-
var _useState5 = (0, _react.useState)("file-input-".concat((0, _uuid.v4)())),
|
|
223
|
-
_useState6 = (0, _slicedToArray2["default"])(_useState5, 1),
|
|
224
|
-
fileInputId = _useState6[0];
|
|
225
|
-
|
|
226
|
-
var colorsTheme = (0, _useTheme["default"])();
|
|
227
|
-
(0, _react.useEffect)(function () {
|
|
228
|
-
if (value) {
|
|
229
|
-
setFiles(value);
|
|
230
|
-
} else {
|
|
231
|
-
setFiles([]);
|
|
232
|
-
}
|
|
233
|
-
}, [value]);
|
|
234
|
-
|
|
235
|
-
var handleClick = function handleClick() {
|
|
236
|
-
document.getElementById(fileInputId).click();
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
var checkFileSize = function checkFileSize(file) {
|
|
240
|
-
if (file.size < minSize) {
|
|
241
|
-
return "File size must be greater than min size.";
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
if (file.size > maxSize) {
|
|
245
|
-
return "File size must be less than max size.";
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
var getFilePreview = function getFilePreview(file) {
|
|
250
|
-
if (file.type.includes("video")) {
|
|
251
|
-
return videoIcon;
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
if (file.type.includes("audio")) {
|
|
255
|
-
return audioIcon;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
if (file.type.includes("image")) {
|
|
259
|
-
return new Promise(function (resolve) {
|
|
260
|
-
var reader = new FileReader();
|
|
261
|
-
reader.readAsDataURL(file);
|
|
262
|
-
|
|
263
|
-
reader.onload = function (e) {
|
|
264
|
-
resolve(e.target.result);
|
|
265
|
-
};
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
return fileIcon;
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
var getFilesToAdd =
|
|
273
|
-
/*#__PURE__*/
|
|
274
|
-
function () {
|
|
275
|
-
var _ref2 = (0, _asyncToGenerator2["default"])(
|
|
276
|
-
/*#__PURE__*/
|
|
277
|
-
_regenerator["default"].mark(function _callee(selectedFiles) {
|
|
278
|
-
var filesToAdd;
|
|
279
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
280
|
-
while (1) {
|
|
281
|
-
switch (_context.prev = _context.next) {
|
|
282
|
-
case 0:
|
|
283
|
-
_context.next = 2;
|
|
284
|
-
return Promise.all(selectedFiles.map(function (selectedFile) {
|
|
285
|
-
return getFilePreview(selectedFile);
|
|
286
|
-
})).then(function (previews) {
|
|
287
|
-
return selectedFiles.map(function (selectedFile, index) {
|
|
288
|
-
var fileInfo = {
|
|
289
|
-
file: selectedFile,
|
|
290
|
-
error: checkFileSize(selectedFile),
|
|
291
|
-
preview: previews[index]
|
|
292
|
-
};
|
|
293
|
-
return fileInfo;
|
|
294
|
-
});
|
|
295
|
-
});
|
|
296
|
-
|
|
297
|
-
case 2:
|
|
298
|
-
filesToAdd = _context.sent;
|
|
299
|
-
return _context.abrupt("return", filesToAdd);
|
|
300
|
-
|
|
301
|
-
case 4:
|
|
302
|
-
case "end":
|
|
303
|
-
return _context.stop();
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
}, _callee);
|
|
307
|
-
}));
|
|
308
|
-
|
|
309
|
-
return function getFilesToAdd(_x) {
|
|
310
|
-
return _ref2.apply(this, arguments);
|
|
311
|
-
};
|
|
312
|
-
}();
|
|
313
|
-
|
|
314
|
-
var addFile =
|
|
315
|
-
/*#__PURE__*/
|
|
316
|
-
function () {
|
|
317
|
-
var _ref3 = (0, _asyncToGenerator2["default"])(
|
|
318
|
-
/*#__PURE__*/
|
|
319
|
-
_regenerator["default"].mark(function _callee2(selectedFiles) {
|
|
320
|
-
var filesToAdd, finalFiles, fileToAdd;
|
|
321
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
322
|
-
while (1) {
|
|
323
|
-
switch (_context2.prev = _context2.next) {
|
|
324
|
-
case 0:
|
|
325
|
-
if (!multiple) {
|
|
326
|
-
_context2.next = 8;
|
|
327
|
-
break;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
_context2.next = 3;
|
|
331
|
-
return getFilesToAdd(selectedFiles);
|
|
332
|
-
|
|
333
|
-
case 3:
|
|
334
|
-
filesToAdd = _context2.sent;
|
|
335
|
-
finalFiles = [].concat((0, _toConsumableArray2["default"])(files), (0, _toConsumableArray2["default"])(filesToAdd));
|
|
336
|
-
|
|
337
|
-
if (typeof callbackFile === "function") {
|
|
338
|
-
callbackFile(finalFiles);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
_context2.next = 19;
|
|
342
|
-
break;
|
|
343
|
-
|
|
344
|
-
case 8:
|
|
345
|
-
if (!(selectedFiles.length === 1)) {
|
|
346
|
-
_context2.next = 14;
|
|
347
|
-
break;
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
_context2.next = 11;
|
|
351
|
-
return getFilesToAdd(selectedFiles);
|
|
352
|
-
|
|
353
|
-
case 11:
|
|
354
|
-
_context2.t0 = _context2.sent;
|
|
355
|
-
_context2.next = 17;
|
|
356
|
-
break;
|
|
357
|
-
|
|
358
|
-
case 14:
|
|
359
|
-
_context2.next = 16;
|
|
360
|
-
return getFilesToAdd([selectedFiles[0]]);
|
|
361
|
-
|
|
362
|
-
case 16:
|
|
363
|
-
_context2.t0 = _context2.sent;
|
|
364
|
-
|
|
365
|
-
case 17:
|
|
366
|
-
fileToAdd = _context2.t0;
|
|
367
|
-
|
|
368
|
-
if (typeof callbackFile === "function") {
|
|
369
|
-
callbackFile(fileToAdd);
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
case 19:
|
|
373
|
-
case "end":
|
|
374
|
-
return _context2.stop();
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
}, _callee2);
|
|
378
|
-
}));
|
|
379
|
-
|
|
380
|
-
return function addFile(_x2) {
|
|
381
|
-
return _ref3.apply(this, arguments);
|
|
382
|
-
};
|
|
383
|
-
}();
|
|
384
|
-
|
|
385
|
-
var selectFiles = function selectFiles(e) {
|
|
386
|
-
var selectedFiles = e.target.files;
|
|
387
|
-
var filesArray = Object.keys(selectedFiles).map(function (key) {
|
|
388
|
-
return selectedFiles[key];
|
|
389
|
-
});
|
|
390
|
-
addFile(filesArray);
|
|
391
|
-
};
|
|
392
|
-
|
|
393
|
-
var onDelete = function onDelete(fileName) {
|
|
394
|
-
var filesCopy = (0, _toConsumableArray2["default"])(files);
|
|
395
|
-
var fileToRemove = filesCopy.find(function (file) {
|
|
396
|
-
return file.file.name === fileName;
|
|
397
|
-
});
|
|
398
|
-
var fileIndex = filesCopy.indexOf(fileToRemove);
|
|
399
|
-
filesCopy.splice(fileIndex, 1);
|
|
400
|
-
|
|
401
|
-
if (typeof callbackFile === "function") {
|
|
402
|
-
callbackFile(filesCopy);
|
|
403
|
-
}
|
|
404
|
-
};
|
|
405
|
-
|
|
406
|
-
var handleDrag = function handleDrag(e) {
|
|
407
|
-
e.preventDefault();
|
|
408
|
-
e.stopPropagation();
|
|
409
|
-
};
|
|
410
|
-
|
|
411
|
-
var handleDragIn = function handleDragIn(e) {
|
|
412
|
-
e.preventDefault();
|
|
413
|
-
e.stopPropagation();
|
|
414
|
-
|
|
415
|
-
if (e.dataTransfer.items && e.dataTransfer.items.length > 0) {
|
|
416
|
-
setIsDragging(true);
|
|
417
|
-
}
|
|
418
|
-
};
|
|
419
|
-
|
|
420
|
-
var handleDragOut = function handleDragOut(e) {
|
|
421
|
-
e.preventDefault();
|
|
422
|
-
e.stopPropagation();
|
|
423
|
-
setIsDragging(false);
|
|
424
|
-
};
|
|
425
|
-
|
|
426
|
-
var handleDrop = function handleDrop(e) {
|
|
427
|
-
e.preventDefault();
|
|
428
|
-
e.stopPropagation();
|
|
429
|
-
setIsDragging(false);
|
|
430
|
-
var filesObject = e.dataTransfer.files;
|
|
431
|
-
|
|
432
|
-
if (filesObject && filesObject.length > 0) {
|
|
433
|
-
var filesArray = Object.keys(filesObject).map(function (key) {
|
|
434
|
-
return filesObject[key];
|
|
435
|
-
});
|
|
436
|
-
addFile(filesArray);
|
|
437
|
-
}
|
|
438
|
-
};
|
|
439
|
-
|
|
440
|
-
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
441
|
-
theme: colorsTheme.fileInput
|
|
442
|
-
}, _react["default"].createElement(FileInputContainer, {
|
|
443
|
-
margin: margin,
|
|
444
|
-
name: name,
|
|
445
|
-
tabIndex: tabIndex
|
|
446
|
-
}, _react["default"].createElement(Label, {
|
|
447
|
-
htmlFor: fileInputId,
|
|
448
|
-
disabled: disabled
|
|
449
|
-
}, label), _react["default"].createElement(HelperText, {
|
|
450
|
-
disabled: disabled
|
|
451
|
-
}, helperText), mode === "file" ? _react["default"].createElement(FileContainer, {
|
|
452
|
-
multiple: multiple,
|
|
453
|
-
files: files
|
|
454
|
-
}, _react["default"].createElement(ButtonErrorContainer, null, _react["default"].createElement(_Button["default"], {
|
|
455
|
-
mode: "secondary",
|
|
456
|
-
label: "Select files",
|
|
457
|
-
onClick: handleClick,
|
|
458
|
-
disabled: disabled,
|
|
459
|
-
size: "medium",
|
|
460
|
-
tabIndex: tabIndex
|
|
461
|
-
}), _react["default"].createElement("input", {
|
|
462
|
-
id: fileInputId,
|
|
463
|
-
type: "file",
|
|
464
|
-
accept: accept,
|
|
465
|
-
multiple: multiple,
|
|
466
|
-
onChange: selectFiles
|
|
467
|
-
}), files.length === 1 && files.map(function (file) {
|
|
468
|
-
return file.error && mode === "file" && !multiple && _react["default"].createElement(ErrorMessage, null, file.error);
|
|
469
|
-
})), files.map(function (file) {
|
|
470
|
-
return _react["default"].createElement(_react["default"].Fragment, null, _react["default"].createElement(FileItemContainer, {
|
|
471
|
-
mode: mode,
|
|
472
|
-
multiple: multiple,
|
|
473
|
-
files: files
|
|
474
|
-
}, _react["default"].createElement(_FileItem["default"], {
|
|
475
|
-
mode: mode,
|
|
476
|
-
multiple: multiple,
|
|
477
|
-
name: file.file.name,
|
|
478
|
-
error: file.error,
|
|
479
|
-
showPreview: mode === "file" && !multiple ? false : showPreview,
|
|
480
|
-
numFiles: files.length,
|
|
481
|
-
preview: file.preview,
|
|
482
|
-
type: file.file.type,
|
|
483
|
-
onDelete: onDelete
|
|
484
|
-
})));
|
|
485
|
-
})) : _react["default"].createElement(Container, null, _react["default"].createElement(DragDropArea, {
|
|
486
|
-
isDragging: isDragging,
|
|
487
|
-
disabled: disabled,
|
|
488
|
-
mode: mode,
|
|
489
|
-
onDrop: handleDrop,
|
|
490
|
-
onDragEnter: handleDragIn,
|
|
491
|
-
onDragOver: handleDrag,
|
|
492
|
-
onDragLeave: handleDragOut
|
|
493
|
-
}, _react["default"].createElement(ButtonContainer, {
|
|
494
|
-
mode: mode
|
|
495
|
-
}, _react["default"].createElement(_Button["default"], {
|
|
496
|
-
mode: "secondary",
|
|
497
|
-
label: "Select",
|
|
498
|
-
onClick: handleClick,
|
|
499
|
-
disabled: disabled,
|
|
500
|
-
size: "fitContent"
|
|
501
|
-
}), _react["default"].createElement("input", {
|
|
502
|
-
id: fileInputId,
|
|
503
|
-
type: "file",
|
|
504
|
-
accept: accept,
|
|
505
|
-
multiple: multiple,
|
|
506
|
-
onChange: selectFiles
|
|
507
|
-
})), _react["default"].createElement(DropLabel, {
|
|
508
|
-
disabled: disabled
|
|
509
|
-
}, "or drop files")), files.map(function (file) {
|
|
510
|
-
return _react["default"].createElement(FileItemContainer, {
|
|
511
|
-
mode: mode,
|
|
512
|
-
multiple: multiple,
|
|
513
|
-
files: files
|
|
514
|
-
}, _react["default"].createElement(_FileItem["default"], {
|
|
515
|
-
mode: mode,
|
|
516
|
-
multiple: multiple,
|
|
517
|
-
name: file.file.name,
|
|
518
|
-
error: file.error,
|
|
519
|
-
showPreview: showPreview,
|
|
520
|
-
numFiles: files.length,
|
|
521
|
-
preview: file.preview,
|
|
522
|
-
type: file.file.type,
|
|
523
|
-
onDelete: onDelete
|
|
524
|
-
}));
|
|
525
|
-
}))));
|
|
526
|
-
};
|
|
527
|
-
|
|
528
|
-
var FileInputContainer = _styledComponents["default"].div(_templateObject(), function (props) {
|
|
529
|
-
return props.margin && (0, _typeof2["default"])(props.margin) !== "object" ? _variables.spaces[props.margin] : "0px";
|
|
530
|
-
}, function (props) {
|
|
531
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.top ? _variables.spaces[props.margin.top] : "";
|
|
532
|
-
}, function (props) {
|
|
533
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.right ? _variables.spaces[props.margin.right] : "";
|
|
534
|
-
}, function (props) {
|
|
535
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.bottom ? _variables.spaces[props.margin.bottom] : "";
|
|
536
|
-
}, function (props) {
|
|
537
|
-
return props.margin && (0, _typeof2["default"])(props.margin) === "object" && props.margin.left ? _variables.spaces[props.margin.left] : "";
|
|
538
|
-
});
|
|
539
|
-
|
|
540
|
-
var Label = _styledComponents["default"].label(_templateObject2(), function (props) {
|
|
541
|
-
return props.disabled ? props.theme.disabledLabelFontColor : props.theme.labelFontColor;
|
|
542
|
-
}, function (props) {
|
|
543
|
-
return props.theme.labelFontFamily;
|
|
544
|
-
}, function (props) {
|
|
545
|
-
return props.theme.labelFontSize;
|
|
546
|
-
}, function (props) {
|
|
547
|
-
return props.theme.labelFontWeight;
|
|
548
|
-
}, function (props) {
|
|
549
|
-
return props.theme.labelLineHeight;
|
|
550
|
-
});
|
|
551
|
-
|
|
552
|
-
var HelperText = _styledComponents["default"].span(_templateObject3(), function (props) {
|
|
553
|
-
return props.disabled ? props.theme.disabledHelperTextFontcolor : props.theme.helperTextFontColor;
|
|
554
|
-
}, function (props) {
|
|
555
|
-
return props.theme.helperTextFontFamily;
|
|
556
|
-
}, function (props) {
|
|
557
|
-
return props.theme.helperTextFontSize;
|
|
558
|
-
}, function (props) {
|
|
559
|
-
return props.theme.helperTextFontWeight;
|
|
560
|
-
}, function (props) {
|
|
561
|
-
return props.theme.helperTextLineHeight;
|
|
562
|
-
});
|
|
563
|
-
|
|
564
|
-
var DragDropArea = _styledComponents["default"].div(_templateObject4(), function (props) {
|
|
565
|
-
return props.mode === "filedrop" ? "calc(48px - 2px)" : "calc(160px - 2px)";
|
|
566
|
-
}, function (props) {
|
|
567
|
-
return props.mode === "filedrop" ? "row" : "column";
|
|
568
|
-
}, function (props) {
|
|
569
|
-
return props.theme.dropBorderRadius;
|
|
570
|
-
}, function (props) {
|
|
571
|
-
return !props.isDragging ? props.theme.dropBorderThickness : "2px";
|
|
572
|
-
}, function (props) {
|
|
573
|
-
return !props.isDragging ? props.theme.dropBorderStyle : "solid";
|
|
574
|
-
}, function (props) {
|
|
575
|
-
return props.isDragging && props.theme.focusDropBackgroundColor;
|
|
576
|
-
}, function (props) {
|
|
577
|
-
return props.disabled ? props.theme.disabledDropBorderColor : props.isDragging ? props.theme.focusDropBorderColor : props.theme.dropBorderColor;
|
|
578
|
-
}, function (props) {
|
|
579
|
-
return props.disabled && "not-allowed";
|
|
580
|
-
});
|
|
581
|
-
|
|
582
|
-
var FileContainer = _styledComponents["default"].div(_templateObject5(), function (props) {
|
|
583
|
-
return props.multiple || props.files.length > 1 ? "column" : "row";
|
|
584
|
-
});
|
|
585
|
-
|
|
586
|
-
var ButtonErrorContainer = _styledComponents["default"].div(_templateObject6());
|
|
587
|
-
|
|
588
|
-
var ButtonContainer = _styledComponents["default"].div(_templateObject7(), function (props) {
|
|
589
|
-
return props.mode === "filedrop" ? "2px 12px 2px 2px" : "47px 122px 8px 122px";
|
|
590
|
-
});
|
|
591
|
-
|
|
592
|
-
var DropLabel = _styledComponents["default"].span(_templateObject8(), function (props) {
|
|
593
|
-
return props.disabled ? props.theme.disabledDropLabelFontColor : props.theme.dropLabelFontColor;
|
|
594
|
-
}, function (props) {
|
|
595
|
-
return props.theme.dropLabelFontFamily;
|
|
596
|
-
}, function (props) {
|
|
597
|
-
return props.theme.dropLabelFontSize;
|
|
598
|
-
}, function (props) {
|
|
599
|
-
return props.theme.dropLabelFontWeight;
|
|
600
|
-
});
|
|
601
|
-
|
|
602
|
-
var Container = _styledComponents["default"].div(_templateObject9());
|
|
603
|
-
|
|
604
|
-
var FileItemContainer = _styledComponents["default"].div(_templateObject10(), function (props) {
|
|
605
|
-
return (props.multiple || props.files.length > 1 || props.mode !== "file") && "4px";
|
|
606
|
-
}, function (props) {
|
|
607
|
-
return props.mode === "file" && props.files.length === 1 && !props.multiple && "4px";
|
|
608
|
-
});
|
|
609
|
-
|
|
610
|
-
var ErrorMessage = _styledComponents["default"].div(_templateObject11(), function (props) {
|
|
611
|
-
return props.theme.errorMessageFontColor;
|
|
612
|
-
}, function (props) {
|
|
613
|
-
return props.theme.errorMessageFontFamily;
|
|
614
|
-
}, function (props) {
|
|
615
|
-
return props.theme.errorMessageFontSize;
|
|
616
|
-
}, function (props) {
|
|
617
|
-
return props.theme.errorMessageFontWeight;
|
|
618
|
-
}, function (props) {
|
|
619
|
-
return props.theme.errorMessageLineHeight;
|
|
620
|
-
});
|
|
621
|
-
|
|
622
|
-
DxcFileInput.propTypes = {
|
|
623
|
-
name: _propTypes["default"].string,
|
|
624
|
-
mode: _propTypes["default"].oneOf(["file", "filedrop", "dropzone"]),
|
|
625
|
-
label: _propTypes["default"].string,
|
|
626
|
-
helperText: _propTypes["default"].string,
|
|
627
|
-
accept: _propTypes["default"].array,
|
|
628
|
-
maxSize: _propTypes["default"].number,
|
|
629
|
-
minSize: _propTypes["default"].number,
|
|
630
|
-
multiple: _propTypes["default"].bool,
|
|
631
|
-
showPreview: _propTypes["default"].bool,
|
|
632
|
-
disabled: _propTypes["default"].bool,
|
|
633
|
-
callbackFile: _propTypes["default"].func,
|
|
634
|
-
value: _propTypes["default"].array,
|
|
635
|
-
tabIndex: _propTypes["default"].number,
|
|
636
|
-
margin: _propTypes["default"].oneOfType([_propTypes["default"].shape({
|
|
637
|
-
top: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
638
|
-
bottom: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
639
|
-
left: _propTypes["default"].oneOf(Object.keys(_variables.spaces)),
|
|
640
|
-
right: _propTypes["default"].oneOf(Object.keys(_variables.spaces))
|
|
641
|
-
}), _propTypes["default"].oneOf((0, _toConsumableArray2["default"])(Object.keys(_variables.spaces)))])
|
|
642
|
-
};
|
|
643
|
-
var _default = DxcFileInput;
|
|
644
|
-
exports["default"] = _default;
|