@veeqo/ui 12.5.1 → 13.1.0
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/dist/components/PhoneInput/PhoneInput.cjs +50 -0
- package/dist/components/PhoneInput/PhoneInput.cjs.map +1 -0
- package/dist/components/PhoneInput/PhoneInput.d.ts +3 -0
- package/dist/components/PhoneInput/PhoneInput.js +44 -0
- package/dist/components/PhoneInput/PhoneInput.js.map +1 -0
- package/dist/components/PhoneInput/PhoneInput.module.scss.cjs +9 -0
- package/dist/components/PhoneInput/PhoneInput.module.scss.cjs.map +1 -0
- package/dist/components/PhoneInput/PhoneInput.module.scss.js +7 -0
- package/dist/components/PhoneInput/PhoneInput.module.scss.js.map +1 -0
- package/dist/components/PhoneInput/components/SelectedCountry.cjs +18 -0
- package/dist/components/PhoneInput/components/SelectedCountry.cjs.map +1 -0
- package/dist/components/PhoneInput/components/SelectedCountry.d.ts +5 -0
- package/dist/components/PhoneInput/components/SelectedCountry.js +12 -0
- package/dist/components/PhoneInput/components/SelectedCountry.js.map +1 -0
- package/dist/components/PhoneInput/constants.cjs +1243 -0
- package/dist/components/PhoneInput/constants.cjs.map +1 -0
- package/dist/components/PhoneInput/constants.d.ts +4 -0
- package/dist/components/PhoneInput/constants.js +1239 -0
- package/dist/components/PhoneInput/constants.js.map +1 -0
- package/dist/components/PhoneInput/hooks/useApplyCountryCode.cjs +48 -0
- package/dist/components/PhoneInput/hooks/useApplyCountryCode.cjs.map +1 -0
- package/dist/components/PhoneInput/hooks/useApplyCountryCode.d.ts +11 -0
- package/dist/components/PhoneInput/hooks/useApplyCountryCode.js +46 -0
- package/dist/components/PhoneInput/hooks/useApplyCountryCode.js.map +1 -0
- package/dist/components/PhoneInput/index.cjs +11 -0
- package/dist/components/PhoneInput/index.cjs.map +1 -0
- package/dist/components/PhoneInput/index.d.ts +308 -0
- package/dist/components/PhoneInput/index.js +9 -0
- package/dist/components/PhoneInput/index.js.map +1 -0
- package/dist/components/PhoneInput/types.d.ts +25 -0
- package/dist/components/PhoneInput/utils/utils.cjs +69 -0
- package/dist/components/PhoneInput/utils/utils.cjs.map +1 -0
- package/dist/components/PhoneInput/utils/utils.d.ts +14 -0
- package/dist/components/PhoneInput/utils/utils.js +60 -0
- package/dist/components/PhoneInput/utils/utils.js.map +1 -0
- package/dist/components/SelectDropdown/SelectDropdown.cjs +2 -3
- package/dist/components/SelectDropdown/SelectDropdown.cjs.map +1 -1
- package/dist/components/SelectDropdown/SelectDropdown.d.ts +1 -1
- package/dist/components/SelectDropdown/SelectDropdown.js +2 -3
- package/dist/components/SelectDropdown/SelectDropdown.js.map +1 -1
- package/dist/components/SelectDropdown/components/ItemContent/ItemContent.cjs +2 -2
- package/dist/components/SelectDropdown/components/ItemContent/ItemContent.cjs.map +1 -1
- package/dist/components/SelectDropdown/components/ItemContent/ItemContent.d.ts +1 -1
- package/dist/components/SelectDropdown/components/ItemContent/ItemContent.js +2 -2
- package/dist/components/SelectDropdown/components/ItemContent/ItemContent.js.map +1 -1
- package/dist/components/SelectDropdown/components/ItemContent/SelectionType.cjs +5 -3
- package/dist/components/SelectDropdown/components/ItemContent/SelectionType.cjs.map +1 -1
- package/dist/components/SelectDropdown/components/ItemContent/SelectionType.d.ts +2 -1
- package/dist/components/SelectDropdown/components/ItemContent/SelectionType.js +5 -3
- package/dist/components/SelectDropdown/components/ItemContent/SelectionType.js.map +1 -1
- package/dist/components/SelectDropdown/components/ListItem/ListItem.cjs +2 -2
- package/dist/components/SelectDropdown/components/ListItem/ListItem.cjs.map +1 -1
- package/dist/components/SelectDropdown/components/ListItem/ListItem.d.ts +1 -1
- package/dist/components/SelectDropdown/components/ListItem/ListItem.js +2 -2
- package/dist/components/SelectDropdown/components/ListItem/ListItem.js.map +1 -1
- package/dist/components/SelectDropdown/components/types.d.ts +1 -0
- package/dist/components/SelectDropdown/types.d.ts +2 -1
- package/dist/components/UploadFile/UploadFile.cjs +64 -83
- package/dist/components/UploadFile/UploadFile.cjs.map +1 -1
- package/dist/components/UploadFile/UploadFile.js +67 -86
- package/dist/components/UploadFile/UploadFile.js.map +1 -1
- package/dist/components/UploadFile/components/DropCopy/DropCopy.cjs +28 -0
- package/dist/components/UploadFile/components/DropCopy/DropCopy.cjs.map +1 -0
- package/dist/components/UploadFile/components/DropCopy/DropCopy.d.ts +2 -0
- package/dist/components/UploadFile/components/DropCopy/DropCopy.js +22 -0
- package/dist/components/UploadFile/components/DropCopy/DropCopy.js.map +1 -0
- package/dist/components/UploadFile/components/UploadCopy/UploadCopy.cjs +6 -6
- package/dist/components/UploadFile/components/UploadCopy/UploadCopy.cjs.map +1 -1
- package/dist/components/UploadFile/components/UploadCopy/UploadCopy.js +6 -6
- package/dist/components/UploadFile/components/UploadCopy/UploadCopy.js.map +1 -1
- package/dist/components/UploadFile/constants.cjs +71 -8
- package/dist/components/UploadFile/constants.cjs.map +1 -1
- package/dist/components/UploadFile/constants.d.ts +57 -5
- package/dist/components/UploadFile/constants.js +69 -9
- package/dist/components/UploadFile/constants.js.map +1 -1
- package/dist/components/UploadFile/hooks/useUploadFile/index.d.ts +1 -0
- package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.cjs +65 -0
- package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.cjs.map +1 -0
- package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.d.ts +9 -0
- package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.js +63 -0
- package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.js.map +1 -0
- package/dist/components/UploadFile/hooks/useValidateInput/index.d.ts +1 -0
- package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.cjs +48 -0
- package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.cjs.map +1 -0
- package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.d.ts +11 -0
- package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.js +46 -0
- package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.js.map +1 -0
- package/dist/components/UploadFile/index.d.ts +0 -1
- package/dist/components/UploadFile/mocks/files.d.ts +2 -0
- package/dist/components/UploadFile/mocks/mockUseUploadFile.d.ts +14 -0
- package/dist/components/UploadFile/mocks/utils.d.ts +1 -2
- package/dist/components/UploadFile/styled.cjs +40 -1
- package/dist/components/UploadFile/styled.cjs.map +1 -1
- package/dist/components/UploadFile/styled.d.ts +4 -1
- package/dist/components/UploadFile/styled.js +40 -1
- package/dist/components/UploadFile/styled.js.map +1 -1
- package/dist/components/UploadFile/types.d.ts +15 -1
- package/dist/components/UploadFile/utils/getErrorMessage/getErrorMessage.cjs +27 -0
- package/dist/components/UploadFile/utils/getErrorMessage/getErrorMessage.cjs.map +1 -0
- package/dist/components/UploadFile/utils/getErrorMessage/getErrorMessage.d.ts +8 -0
- package/dist/components/UploadFile/utils/getErrorMessage/getErrorMessage.js +25 -0
- package/dist/components/UploadFile/utils/getErrorMessage/getErrorMessage.js.map +1 -0
- package/dist/components/UploadFile/utils/getErrorMessage/index.d.ts +1 -0
- package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.cjs +14 -11
- package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.cjs.map +1 -1
- package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.d.ts +10 -7
- package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.js +14 -11
- package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.js.map +1 -1
- package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.cjs +16 -30
- package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.cjs.map +1 -1
- package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.js +16 -30
- package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.js.map +1 -1
- package/dist/components/UploadFile/utils/index.d.ts +0 -1
- package/dist/components/UploadedFile/UploadedFile.cjs +78 -0
- package/dist/components/UploadedFile/UploadedFile.cjs.map +1 -0
- package/dist/components/UploadedFile/UploadedFile.d.ts +12 -0
- package/dist/components/UploadedFile/UploadedFile.js +72 -0
- package/dist/components/UploadedFile/UploadedFile.js.map +1 -0
- package/dist/components/UploadedFile/UploadedFile.module.scss.cjs +9 -0
- package/dist/components/UploadedFile/UploadedFile.module.scss.cjs.map +1 -0
- package/dist/components/UploadedFile/UploadedFile.module.scss.js +7 -0
- package/dist/components/UploadedFile/UploadedFile.module.scss.js.map +1 -0
- package/dist/components/UploadedFile/hooks/useFileErrorMessages/index.d.ts +1 -0
- package/dist/components/UploadedFile/hooks/useFileErrorMessages/useFileErrorMessages.cjs +38 -0
- package/dist/components/UploadedFile/hooks/useFileErrorMessages/useFileErrorMessages.cjs.map +1 -0
- package/dist/components/UploadedFile/hooks/useFileErrorMessages/useFileErrorMessages.d.ts +18 -0
- package/dist/components/UploadedFile/hooks/useFileErrorMessages/useFileErrorMessages.js +36 -0
- package/dist/components/UploadedFile/hooks/useFileErrorMessages/useFileErrorMessages.js.map +1 -0
- package/dist/components/UploadedFile/hooks/usePreviewImage/index.d.ts +1 -0
- package/dist/components/UploadedFile/hooks/usePreviewImage/usePreviewImage.cjs +36 -0
- package/dist/components/UploadedFile/hooks/usePreviewImage/usePreviewImage.cjs.map +1 -0
- package/dist/components/UploadedFile/hooks/usePreviewImage/usePreviewImage.d.ts +8 -0
- package/dist/components/UploadedFile/hooks/usePreviewImage/usePreviewImage.js +34 -0
- package/dist/components/UploadedFile/hooks/usePreviewImage/usePreviewImage.js.map +1 -0
- package/dist/components/UploadedFile/index.d.ts +1 -0
- package/dist/components/UploadedFile/utils/convertFileTypeToAcceptedFileType/convertFileTypeToAcceptedFileType.cjs +17 -0
- package/dist/components/UploadedFile/utils/convertFileTypeToAcceptedFileType/convertFileTypeToAcceptedFileType.cjs.map +1 -0
- package/dist/components/UploadedFile/utils/convertFileTypeToAcceptedFileType/convertFileTypeToAcceptedFileType.d.ts +1 -0
- package/dist/components/UploadedFile/utils/convertFileTypeToAcceptedFileType/convertFileTypeToAcceptedFileType.js +15 -0
- package/dist/components/UploadedFile/utils/convertFileTypeToAcceptedFileType/convertFileTypeToAcceptedFileType.js.map +1 -0
- package/dist/components/UploadedFile/utils/convertFileTypeToAcceptedFileType/index.d.ts +1 -0
- package/dist/components/UploadedFile/utils/isImageType/index.d.ts +1 -0
- package/dist/components/UploadedFile/utils/isImageType/isImageType.cjs +14 -0
- package/dist/components/UploadedFile/utils/isImageType/isImageType.cjs.map +1 -0
- package/dist/components/UploadedFile/utils/isImageType/isImageType.d.ts +1 -0
- package/dist/components/UploadedFile/utils/isImageType/isImageType.js +12 -0
- package/dist/components/UploadedFile/utils/isImageType/isImageType.js.map +1 -0
- package/dist/components/index.d.ts +4 -1
- package/dist/index.cjs +6 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/UploadFile/UploadGraphic.cjs +0 -14
- package/dist/components/UploadFile/UploadGraphic.cjs.map +0 -1
- package/dist/components/UploadFile/UploadGraphic.d.ts +0 -2
- package/dist/components/UploadFile/UploadGraphic.js +0 -8
- package/dist/components/UploadFile/UploadGraphic.js.map +0 -1
- package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.cjs +0 -31
- package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.cjs.map +0 -1
- package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.d.ts +0 -7
- package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.js +0 -25
- package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.js.map +0 -1
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.cjs +0 -21
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.cjs.map +0 -1
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.d.ts +0 -8
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.js +0 -15
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.js.map +0 -1
- package/dist/components/UploadFile/components/UploadedFile/styled.cjs +0 -20
- package/dist/components/UploadFile/components/UploadedFile/styled.cjs.map +0 -1
- package/dist/components/UploadFile/components/UploadedFile/styled.d.ts +0 -2
- package/dist/components/UploadFile/components/UploadedFile/styled.js +0 -13
- package/dist/components/UploadFile/components/UploadedFile/styled.js.map +0 -1
- package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.cjs +0 -18
- package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.cjs.map +0 -1
- package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.d.ts +0 -13
- package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.js +0 -16
- package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.js.map +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var framerMotion = require('framer-motion');
|
|
5
|
+
var index = require('../../../../theme/index.cjs');
|
|
6
|
+
var sizes = require('../../../../theme/modules/sizes.cjs');
|
|
7
|
+
var Text = require('../../../Text/Text.cjs');
|
|
8
|
+
var FlexCol = require('../../../Flex/FlexCol/FlexCol.cjs');
|
|
9
|
+
var ArrowDownIcon = require('../../../../icons/design-system/components/ArrowDownIcon.cjs');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
12
|
+
|
|
13
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
14
|
+
|
|
15
|
+
const DropCopy = () => (React__default.default.createElement(FlexCol.FlexCol, { alignItems: "center", gap: "sm", style: { pointerEvents: 'none' } },
|
|
16
|
+
React__default.default.createElement("div", { style: { height: 24, display: 'flex', alignItems: 'center', justifyContent: 'center' } },
|
|
17
|
+
React__default.default.createElement(framerMotion.motion.div, { animate: {
|
|
18
|
+
y: [0, 8, 0],
|
|
19
|
+
}, transition: {
|
|
20
|
+
duration: 1,
|
|
21
|
+
repeat: Infinity,
|
|
22
|
+
ease: 'easeInOut',
|
|
23
|
+
} },
|
|
24
|
+
React__default.default.createElement(ArrowDownIcon.ReactComponent, { height: 24, width: 24 }))),
|
|
25
|
+
React__default.default.createElement(Text.Text, { variant: "body", style: { paddingTop: sizes.sizes.sm, color: index.theme.colors.neutral.ink.base } }, "Drop to upload")));
|
|
26
|
+
|
|
27
|
+
exports.DropCopy = DropCopy;
|
|
28
|
+
//# sourceMappingURL=DropCopy.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropCopy.cjs","sources":["../../../../../src/components/UploadFile/components/DropCopy/DropCopy.tsx"],"sourcesContent":["import React from 'react';\nimport { motion } from 'framer-motion';\nimport { theme } from 'Theme';\nimport { sizes } from '../../../../theme/modules/sizes';\nimport { Text } from '../../../Text';\nimport { FlexCol } from '../../../Flex/FlexCol';\nimport { ArrowDownIcon } from '../../../../icons';\n\nexport const DropCopy = () => (\n <FlexCol alignItems=\"center\" gap=\"sm\" style={{ pointerEvents: 'none' }}>\n <div style={{ height: 24, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>\n <motion.div\n animate={{\n y: [0, 8, 0],\n }}\n transition={{\n duration: 1,\n repeat: Infinity,\n ease: 'easeInOut',\n }}\n >\n <ArrowDownIcon height={24} width={24} />\n </motion.div>\n </div>\n <Text variant=\"body\" style={{ paddingTop: sizes.sm, color: theme.colors.neutral.ink.base }}>\n Drop to upload\n </Text>\n </FlexCol>\n);\n"],"names":["React","FlexCol","motion","ArrowDownIcon","Text","sizes","theme"],"mappings":";;;;;;;;;;;;;;AAQa,MAAA,QAAQ,GAAG,OACtBA,sBAAC,CAAA,aAAA,CAAAC,eAAO,EAAC,EAAA,UAAU,EAAC,QAAQ,EAAC,GAAG,EAAC,IAAI,EAAC,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,EAAA;AACpE,IAAAD,sBAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAA;AACzF,QAAAA,sBAAA,CAAA,aAAA,CAACE,mBAAM,CAAC,GAAG,EAAA,EACT,OAAO,EAAE;AACP,gBAAA,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACb,aAAA,EACD,UAAU,EAAE;AACV,gBAAA,QAAQ,EAAE,CAAC;AACX,gBAAA,MAAM,EAAE,QAAQ;AAChB,gBAAA,IAAI,EAAE,WAAW;AAClB,aAAA,EAAA;YAEDF,sBAAC,CAAA,aAAA,CAAAG,4BAAa,EAAC,EAAA,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAI,CAAA,CAC7B,CACT;AACN,IAAAH,sBAAA,CAAA,aAAA,CAACI,SAAI,EAAA,EAAC,OAAO,EAAC,MAAM,EAAC,KAAK,EAAE,EAAE,UAAU,EAAEC,WAAK,CAAC,EAAE,EAAE,KAAK,EAAEC,WAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAEnF,EAAA,gBAAA,CAAA,CACC;;;;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { motion } from 'framer-motion';
|
|
3
|
+
import { theme } from '../../../../theme/index.js';
|
|
4
|
+
import { sizes } from '../../../../theme/modules/sizes.js';
|
|
5
|
+
import { Text } from '../../../Text/Text.js';
|
|
6
|
+
import { FlexCol } from '../../../Flex/FlexCol/FlexCol.js';
|
|
7
|
+
import { ReactComponent as ArrowDownIcon } from '../../../../icons/design-system/components/ArrowDownIcon.js';
|
|
8
|
+
|
|
9
|
+
const DropCopy = () => (React__default.createElement(FlexCol, { alignItems: "center", gap: "sm", style: { pointerEvents: 'none' } },
|
|
10
|
+
React__default.createElement("div", { style: { height: 24, display: 'flex', alignItems: 'center', justifyContent: 'center' } },
|
|
11
|
+
React__default.createElement(motion.div, { animate: {
|
|
12
|
+
y: [0, 8, 0],
|
|
13
|
+
}, transition: {
|
|
14
|
+
duration: 1,
|
|
15
|
+
repeat: Infinity,
|
|
16
|
+
ease: 'easeInOut',
|
|
17
|
+
} },
|
|
18
|
+
React__default.createElement(ArrowDownIcon, { height: 24, width: 24 }))),
|
|
19
|
+
React__default.createElement(Text, { variant: "body", style: { paddingTop: sizes.sm, color: theme.colors.neutral.ink.base } }, "Drop to upload")));
|
|
20
|
+
|
|
21
|
+
export { DropCopy };
|
|
22
|
+
//# sourceMappingURL=DropCopy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DropCopy.js","sources":["../../../../../src/components/UploadFile/components/DropCopy/DropCopy.tsx"],"sourcesContent":["import React from 'react';\nimport { motion } from 'framer-motion';\nimport { theme } from 'Theme';\nimport { sizes } from '../../../../theme/modules/sizes';\nimport { Text } from '../../../Text';\nimport { FlexCol } from '../../../Flex/FlexCol';\nimport { ArrowDownIcon } from '../../../../icons';\n\nexport const DropCopy = () => (\n <FlexCol alignItems=\"center\" gap=\"sm\" style={{ pointerEvents: 'none' }}>\n <div style={{ height: 24, display: 'flex', alignItems: 'center', justifyContent: 'center' }}>\n <motion.div\n animate={{\n y: [0, 8, 0],\n }}\n transition={{\n duration: 1,\n repeat: Infinity,\n ease: 'easeInOut',\n }}\n >\n <ArrowDownIcon height={24} width={24} />\n </motion.div>\n </div>\n <Text variant=\"body\" style={{ paddingTop: sizes.sm, color: theme.colors.neutral.ink.base }}>\n Drop to upload\n </Text>\n </FlexCol>\n);\n"],"names":["React"],"mappings":";;;;;;;;AAQa,MAAA,QAAQ,GAAG,OACtBA,cAAC,CAAA,aAAA,CAAA,OAAO,EAAC,EAAA,UAAU,EAAC,QAAQ,EAAC,GAAG,EAAC,IAAI,EAAC,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,EAAA;AACpE,IAAAA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAA;AACzF,QAAAA,cAAA,CAAA,aAAA,CAAC,MAAM,CAAC,GAAG,EAAA,EACT,OAAO,EAAE;AACP,gBAAA,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;AACb,aAAA,EACD,UAAU,EAAE;AACV,gBAAA,QAAQ,EAAE,CAAC;AACX,gBAAA,MAAM,EAAE,QAAQ;AAChB,gBAAA,IAAI,EAAE,WAAW;AAClB,aAAA,EAAA;YAEDA,cAAC,CAAA,aAAA,CAAA,aAAa,EAAC,EAAA,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAI,CAAA,CAC7B,CACT;AACN,IAAAA,cAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAC,OAAO,EAAC,MAAM,EAAC,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAEnF,EAAA,gBAAA,CAAA,CACC;;;;"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var
|
|
4
|
+
var index = require('../../../../theme/index.cjs');
|
|
5
5
|
var sizes = require('../../../../theme/modules/sizes.cjs');
|
|
6
|
-
var Stack = require('../../../Stack/Stack.cjs');
|
|
7
|
-
require('../../../Stack/types.cjs');
|
|
8
6
|
var Text = require('../../../Text/Text.cjs');
|
|
7
|
+
var FlexCol = require('../../../Flex/FlexCol/FlexCol.cjs');
|
|
8
|
+
var CloudUploadIcon = require('../../../../icons/design-system/components/CloudUploadIcon.cjs');
|
|
9
9
|
|
|
10
10
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
11
11
|
|
|
12
12
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
13
13
|
|
|
14
|
-
const UploadCopy = () => (React__default.default.createElement(
|
|
15
|
-
React__default.default.createElement(
|
|
16
|
-
React__default.default.createElement(Text.Text, { variant: "
|
|
14
|
+
const UploadCopy = () => (React__default.default.createElement(FlexCol.FlexCol, { alignItems: "center", gap: "sm", style: { pointerEvents: 'none' } },
|
|
15
|
+
React__default.default.createElement(CloudUploadIcon.ReactComponent, { width: 24, height: 24 }),
|
|
16
|
+
React__default.default.createElement(Text.Text, { variant: "body", style: { paddingTop: sizes.sizes.sm, color: index.theme.colors.neutral.ink.base } }, "Browse files or drag them here")));
|
|
17
17
|
|
|
18
18
|
exports.UploadCopy = UploadCopy;
|
|
19
19
|
//# sourceMappingURL=UploadCopy.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadCopy.cjs","sources":["../../../../../src/components/UploadFile/components/UploadCopy/UploadCopy.tsx"],"sourcesContent":["import React from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"UploadCopy.cjs","sources":["../../../../../src/components/UploadFile/components/UploadCopy/UploadCopy.tsx"],"sourcesContent":["import React from 'react';\nimport { theme } from 'Theme';\nimport { sizes } from '../../../../theme/modules/sizes';\nimport { Text } from '../../../Text';\nimport { FlexCol } from '../../../Flex/FlexCol';\nimport { CloudUploadIcon } from '../../../../icons';\n\nexport const UploadCopy = () => (\n <FlexCol alignItems=\"center\" gap=\"sm\" style={{ pointerEvents: 'none' }}>\n <CloudUploadIcon width={24} height={24} />\n <Text variant=\"body\" style={{ paddingTop: sizes.sm, color: theme.colors.neutral.ink.base }}>\n Browse files or drag them here\n </Text>\n </FlexCol>\n);\n"],"names":["React","FlexCol","CloudUploadIcon","Text","sizes","theme"],"mappings":";;;;;;;;;;;;;AAOa,MAAA,UAAU,GAAG,OACxBA,sBAAC,CAAA,aAAA,CAAAC,eAAO,EAAC,EAAA,UAAU,EAAC,QAAQ,EAAC,GAAG,EAAC,IAAI,EAAC,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,EAAA;IACpED,sBAAC,CAAA,aAAA,CAAAE,8BAAe,IAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAI,CAAA;AAC1C,IAAAF,sBAAA,CAAA,aAAA,CAACG,SAAI,EAAA,EAAC,OAAO,EAAC,MAAM,EAAC,KAAK,EAAE,EAAE,UAAU,EAAEC,WAAK,CAAC,EAAE,EAAE,KAAK,EAAEC,WAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAEnF,EAAA,gCAAA,CAAA,CACC;;;;"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { theme } from '../../../../theme/index.js';
|
|
3
3
|
import { sizes } from '../../../../theme/modules/sizes.js';
|
|
4
|
-
import { Stack } from '../../../Stack/Stack.js';
|
|
5
|
-
import '../../../Stack/types.js';
|
|
6
4
|
import { Text } from '../../../Text/Text.js';
|
|
5
|
+
import { FlexCol } from '../../../Flex/FlexCol/FlexCol.js';
|
|
6
|
+
import { ReactComponent as CloudUploadIcon } from '../../../../icons/design-system/components/CloudUploadIcon.js';
|
|
7
7
|
|
|
8
|
-
const UploadCopy = () => (React__default.createElement(
|
|
9
|
-
React__default.createElement(
|
|
10
|
-
React__default.createElement(Text, { variant: "
|
|
8
|
+
const UploadCopy = () => (React__default.createElement(FlexCol, { alignItems: "center", gap: "sm", style: { pointerEvents: 'none' } },
|
|
9
|
+
React__default.createElement(CloudUploadIcon, { width: 24, height: 24 }),
|
|
10
|
+
React__default.createElement(Text, { variant: "body", style: { paddingTop: sizes.sm, color: theme.colors.neutral.ink.base } }, "Browse files or drag them here")));
|
|
11
11
|
|
|
12
12
|
export { UploadCopy };
|
|
13
13
|
//# sourceMappingURL=UploadCopy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadCopy.js","sources":["../../../../../src/components/UploadFile/components/UploadCopy/UploadCopy.tsx"],"sourcesContent":["import React from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"UploadCopy.js","sources":["../../../../../src/components/UploadFile/components/UploadCopy/UploadCopy.tsx"],"sourcesContent":["import React from 'react';\nimport { theme } from 'Theme';\nimport { sizes } from '../../../../theme/modules/sizes';\nimport { Text } from '../../../Text';\nimport { FlexCol } from '../../../Flex/FlexCol';\nimport { CloudUploadIcon } from '../../../../icons';\n\nexport const UploadCopy = () => (\n <FlexCol alignItems=\"center\" gap=\"sm\" style={{ pointerEvents: 'none' }}>\n <CloudUploadIcon width={24} height={24} />\n <Text variant=\"body\" style={{ paddingTop: sizes.sm, color: theme.colors.neutral.ink.base }}>\n Browse files or drag them here\n </Text>\n </FlexCol>\n);\n"],"names":["React"],"mappings":";;;;;;;AAOa,MAAA,UAAU,GAAG,OACxBA,cAAC,CAAA,aAAA,CAAA,OAAO,EAAC,EAAA,UAAU,EAAC,QAAQ,EAAC,GAAG,EAAC,IAAI,EAAC,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,EAAA;IACpEA,cAAC,CAAA,aAAA,CAAA,eAAe,IAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAI,CAAA;AAC1C,IAAAA,cAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EAAC,OAAO,EAAC,MAAM,EAAC,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAEnF,EAAA,gCAAA,CAAA,CACC;;;;"}
|
|
@@ -2,22 +2,85 @@
|
|
|
2
2
|
|
|
3
3
|
exports.AcceptedFileTypes = void 0;
|
|
4
4
|
(function (AcceptedFileTypes) {
|
|
5
|
+
// DATA FILES
|
|
5
6
|
AcceptedFileTypes["CSV"] = ".csv";
|
|
7
|
+
AcceptedFileTypes["JSON"] = ".json";
|
|
8
|
+
AcceptedFileTypes["XML"] = ".xml";
|
|
9
|
+
AcceptedFileTypes["TXT"] = ".txt";
|
|
10
|
+
// DOCUMENTS
|
|
11
|
+
AcceptedFileTypes["PDF"] = ".pdf";
|
|
12
|
+
AcceptedFileTypes["DOC"] = ".doc";
|
|
13
|
+
AcceptedFileTypes["DOCX"] = ".docx";
|
|
14
|
+
AcceptedFileTypes["XLS"] = ".xls";
|
|
15
|
+
AcceptedFileTypes["XLSX"] = ".xlsx";
|
|
16
|
+
AcceptedFileTypes["PPT"] = ".ppt";
|
|
17
|
+
AcceptedFileTypes["PPTX"] = ".pptx";
|
|
18
|
+
AcceptedFileTypes["ODT"] = ".odt";
|
|
19
|
+
AcceptedFileTypes["ODS"] = ".ods";
|
|
20
|
+
AcceptedFileTypes["ODP"] = ".odp";
|
|
21
|
+
AcceptedFileTypes["RTF"] = ".rtf";
|
|
22
|
+
// IMAGES
|
|
6
23
|
AcceptedFileTypes["JPEG"] = ".jpeg";
|
|
7
24
|
AcceptedFileTypes["JPG"] = ".jpg";
|
|
8
|
-
AcceptedFileTypes["GIF"] = ".gif";
|
|
9
25
|
AcceptedFileTypes["PNG"] = ".png";
|
|
26
|
+
AcceptedFileTypes["GIF"] = ".gif";
|
|
27
|
+
AcceptedFileTypes["BMP"] = ".bmp";
|
|
28
|
+
AcceptedFileTypes["WEBP"] = ".webp";
|
|
29
|
+
AcceptedFileTypes["SVG"] = ".svg";
|
|
30
|
+
AcceptedFileTypes["ICO"] = ".ico";
|
|
31
|
+
AcceptedFileTypes["TIFF"] = ".tiff";
|
|
32
|
+
AcceptedFileTypes["TIF"] = ".tif";
|
|
33
|
+
// AUDIO
|
|
34
|
+
AcceptedFileTypes["MP3"] = ".mp3";
|
|
35
|
+
AcceptedFileTypes["WAV"] = ".wav";
|
|
36
|
+
AcceptedFileTypes["OGG"] = ".ogg";
|
|
37
|
+
AcceptedFileTypes["AAC"] = ".aac";
|
|
38
|
+
AcceptedFileTypes["FLAC"] = ".flac";
|
|
39
|
+
AcceptedFileTypes["M4A"] = ".m4a";
|
|
40
|
+
AcceptedFileTypes["WMA"] = ".wma";
|
|
41
|
+
// VIDEO
|
|
42
|
+
AcceptedFileTypes["MP4"] = ".mp4";
|
|
43
|
+
AcceptedFileTypes["AVI"] = ".avi";
|
|
44
|
+
AcceptedFileTypes["MOV"] = ".mov";
|
|
45
|
+
AcceptedFileTypes["WMV"] = ".wmv";
|
|
46
|
+
AcceptedFileTypes["FLV"] = ".flv";
|
|
47
|
+
AcceptedFileTypes["WEBM"] = ".webm";
|
|
48
|
+
AcceptedFileTypes["MKV"] = ".mkv";
|
|
49
|
+
AcceptedFileTypes["M4V"] = ".m4v";
|
|
50
|
+
// ARCHIVES
|
|
51
|
+
AcceptedFileTypes["ZIP"] = ".zip";
|
|
52
|
+
AcceptedFileTypes["RAR"] = ".rar";
|
|
53
|
+
AcceptedFileTypes["SEVEN_Z"] = ".7z";
|
|
54
|
+
AcceptedFileTypes["TAR"] = ".tar";
|
|
55
|
+
AcceptedFileTypes["GZ"] = ".gz";
|
|
10
56
|
})(exports.AcceptedFileTypes || (exports.AcceptedFileTypes = {}));
|
|
11
57
|
exports.FileSizeUnit = void 0;
|
|
12
58
|
(function (FileSizeUnit) {
|
|
13
59
|
FileSizeUnit["KB"] = "KB";
|
|
14
60
|
FileSizeUnit["MB"] = "MB";
|
|
15
61
|
})(exports.FileSizeUnit || (exports.FileSizeUnit = {}));
|
|
16
|
-
exports.
|
|
17
|
-
(function (
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
62
|
+
exports.ErrorType = void 0;
|
|
63
|
+
(function (ErrorType) {
|
|
64
|
+
ErrorType["critical"] = "CRITICAL";
|
|
65
|
+
ErrorType["warning"] = "WARNING";
|
|
66
|
+
})(exports.ErrorType || (exports.ErrorType = {}));
|
|
67
|
+
exports.CriticalErrorMessages = void 0;
|
|
68
|
+
(function (CriticalErrorMessages) {
|
|
69
|
+
CriticalErrorMessages["INVALID_FORMAT"] = "Invalid format";
|
|
70
|
+
CriticalErrorMessages["FILE_IS_TOO_BIG"] = "File is too big";
|
|
71
|
+
})(exports.CriticalErrorMessages || (exports.CriticalErrorMessages = {}));
|
|
72
|
+
const DEFAULT_MAXIMUM_MULTIPLE_FILES = 10;
|
|
73
|
+
const DEFAULT_MAXIMUM_FILE_BYTES = 1000000;
|
|
74
|
+
exports.InputErrorStateMessages = void 0;
|
|
75
|
+
(function (InputErrorStateMessages) {
|
|
76
|
+
InputErrorStateMessages["VALID"] = "";
|
|
77
|
+
InputErrorStateMessages["INVALID_FORMAT"] = "Please provide a file with a valid format.";
|
|
78
|
+
InputErrorStateMessages["INVALID_FORMATS"] = "Please provide files with a valid format.";
|
|
79
|
+
InputErrorStateMessages["INVALID_SIZE"] = "Please provide file with an acceptable size.";
|
|
80
|
+
InputErrorStateMessages["INVALID_SIZES"] = "Please provide files with an acceptable size.";
|
|
81
|
+
InputErrorStateMessages["INVALID_FORMAT_AND_SIZE"] = "Please provide files with an acceptable size and format.";
|
|
82
|
+
})(exports.InputErrorStateMessages || (exports.InputErrorStateMessages = {}));
|
|
83
|
+
|
|
84
|
+
exports.DEFAULT_MAXIMUM_FILE_BYTES = DEFAULT_MAXIMUM_FILE_BYTES;
|
|
85
|
+
exports.DEFAULT_MAXIMUM_MULTIPLE_FILES = DEFAULT_MAXIMUM_MULTIPLE_FILES;
|
|
23
86
|
//# sourceMappingURL=constants.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.cjs","sources":["../../../src/components/UploadFile/constants.ts"],"sourcesContent":["export enum AcceptedFileTypes {\n CSV = '.csv',\n JPEG = '.jpeg',\n JPG = '.jpg',\n GIF = '.gif',\n
|
|
1
|
+
{"version":3,"file":"constants.cjs","sources":["../../../src/components/UploadFile/constants.ts"],"sourcesContent":["export enum AcceptedFileTypes {\n // DATA FILES\n CSV = '.csv',\n JSON = '.json',\n XML = '.xml',\n TXT = '.txt',\n\n // DOCUMENTS\n PDF = '.pdf',\n DOC = '.doc',\n DOCX = '.docx',\n XLS = '.xls',\n XLSX = '.xlsx',\n PPT = '.ppt',\n PPTX = '.pptx',\n ODT = '.odt',\n ODS = '.ods',\n ODP = '.odp',\n RTF = '.rtf',\n\n // IMAGES\n JPEG = '.jpeg',\n JPG = '.jpg',\n PNG = '.png',\n GIF = '.gif',\n BMP = '.bmp',\n WEBP = '.webp',\n SVG = '.svg',\n ICO = '.ico',\n TIFF = '.tiff',\n TIF = '.tif',\n\n // AUDIO\n MP3 = '.mp3',\n WAV = '.wav',\n OGG = '.ogg',\n AAC = '.aac',\n FLAC = '.flac',\n M4A = '.m4a',\n WMA = '.wma',\n\n // VIDEO\n MP4 = '.mp4',\n AVI = '.avi',\n MOV = '.mov',\n WMV = '.wmv',\n FLV = '.flv',\n WEBM = '.webm',\n MKV = '.mkv',\n M4V = '.m4v',\n\n // ARCHIVES\n ZIP = '.zip',\n RAR = '.rar',\n SEVEN_Z = '.7z',\n TAR = '.tar',\n GZ = '.gz',\n}\n\nexport enum FileSizeUnit {\n KB = 'KB',\n MB = 'MB',\n}\n\nexport enum ErrorType {\n critical = 'CRITICAL',\n warning = 'WARNING',\n}\n\nexport enum CriticalErrorMessages {\n INVALID_FORMAT = 'Invalid format',\n FILE_IS_TOO_BIG = 'File is too big',\n}\n\nexport const DEFAULT_MAXIMUM_MULTIPLE_FILES = 10;\n\nexport const DEFAULT_MAXIMUM_FILE_BYTES = 1000000;\n\nexport enum InputErrorStateMessages {\n VALID = '',\n INVALID_FORMAT = 'Please provide a file with a valid format.',\n INVALID_FORMATS = 'Please provide files with a valid format.',\n INVALID_SIZE = 'Please provide file with an acceptable size.',\n INVALID_SIZES = 'Please provide files with an acceptable size.',\n INVALID_FORMAT_AND_SIZE = 'Please provide files with an acceptable size and format.',\n}\n"],"names":["AcceptedFileTypes","FileSizeUnit","ErrorType","CriticalError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
|
|
9
|
+
XLS = ".xls",
|
|
10
|
+
XLSX = ".xlsx",
|
|
11
|
+
PPT = ".ppt",
|
|
12
|
+
PPTX = ".pptx",
|
|
13
|
+
ODT = ".odt",
|
|
14
|
+
ODS = ".ods",
|
|
15
|
+
ODP = ".odp",
|
|
16
|
+
RTF = ".rtf",
|
|
3
17
|
JPEG = ".jpeg",
|
|
4
18
|
JPG = ".jpg",
|
|
19
|
+
PNG = ".png",
|
|
5
20
|
GIF = ".gif",
|
|
6
|
-
|
|
21
|
+
BMP = ".bmp",
|
|
22
|
+
WEBP = ".webp",
|
|
23
|
+
SVG = ".svg",
|
|
24
|
+
ICO = ".ico",
|
|
25
|
+
TIFF = ".tiff",
|
|
26
|
+
TIF = ".tif",
|
|
27
|
+
MP3 = ".mp3",
|
|
28
|
+
WAV = ".wav",
|
|
29
|
+
OGG = ".ogg",
|
|
30
|
+
AAC = ".aac",
|
|
31
|
+
FLAC = ".flac",
|
|
32
|
+
M4A = ".m4a",
|
|
33
|
+
WMA = ".wma",
|
|
34
|
+
MP4 = ".mp4",
|
|
35
|
+
AVI = ".avi",
|
|
36
|
+
MOV = ".mov",
|
|
37
|
+
WMV = ".wmv",
|
|
38
|
+
FLV = ".flv",
|
|
39
|
+
WEBM = ".webm",
|
|
40
|
+
MKV = ".mkv",
|
|
41
|
+
M4V = ".m4v",
|
|
42
|
+
ZIP = ".zip",
|
|
43
|
+
RAR = ".rar",
|
|
44
|
+
SEVEN_Z = ".7z",
|
|
45
|
+
TAR = ".tar",
|
|
46
|
+
GZ = ".gz"
|
|
7
47
|
}
|
|
8
48
|
export declare enum FileSizeUnit {
|
|
9
49
|
KB = "KB",
|
|
10
50
|
MB = "MB"
|
|
11
51
|
}
|
|
12
|
-
export declare enum
|
|
52
|
+
export declare enum ErrorType {
|
|
53
|
+
critical = "CRITICAL",
|
|
54
|
+
warning = "WARNING"
|
|
55
|
+
}
|
|
56
|
+
export declare enum CriticalErrorMessages {
|
|
57
|
+
INVALID_FORMAT = "Invalid format",
|
|
58
|
+
FILE_IS_TOO_BIG = "File is too big"
|
|
59
|
+
}
|
|
60
|
+
export declare const DEFAULT_MAXIMUM_MULTIPLE_FILES = 10;
|
|
61
|
+
export declare const DEFAULT_MAXIMUM_FILE_BYTES = 1000000;
|
|
62
|
+
export declare enum InputErrorStateMessages {
|
|
13
63
|
VALID = "",
|
|
14
|
-
INVALID_FORMAT = "
|
|
15
|
-
|
|
16
|
-
|
|
64
|
+
INVALID_FORMAT = "Please provide a file with a valid format.",
|
|
65
|
+
INVALID_FORMATS = "Please provide files with a valid format.",
|
|
66
|
+
INVALID_SIZE = "Please provide file with an acceptable size.",
|
|
67
|
+
INVALID_SIZES = "Please provide files with an acceptable size.",
|
|
68
|
+
INVALID_FORMAT_AND_SIZE = "Please provide files with an acceptable size and format."
|
|
17
69
|
}
|
|
@@ -1,23 +1,83 @@
|
|
|
1
1
|
var AcceptedFileTypes;
|
|
2
2
|
(function (AcceptedFileTypes) {
|
|
3
|
+
// DATA FILES
|
|
3
4
|
AcceptedFileTypes["CSV"] = ".csv";
|
|
5
|
+
AcceptedFileTypes["JSON"] = ".json";
|
|
6
|
+
AcceptedFileTypes["XML"] = ".xml";
|
|
7
|
+
AcceptedFileTypes["TXT"] = ".txt";
|
|
8
|
+
// DOCUMENTS
|
|
9
|
+
AcceptedFileTypes["PDF"] = ".pdf";
|
|
10
|
+
AcceptedFileTypes["DOC"] = ".doc";
|
|
11
|
+
AcceptedFileTypes["DOCX"] = ".docx";
|
|
12
|
+
AcceptedFileTypes["XLS"] = ".xls";
|
|
13
|
+
AcceptedFileTypes["XLSX"] = ".xlsx";
|
|
14
|
+
AcceptedFileTypes["PPT"] = ".ppt";
|
|
15
|
+
AcceptedFileTypes["PPTX"] = ".pptx";
|
|
16
|
+
AcceptedFileTypes["ODT"] = ".odt";
|
|
17
|
+
AcceptedFileTypes["ODS"] = ".ods";
|
|
18
|
+
AcceptedFileTypes["ODP"] = ".odp";
|
|
19
|
+
AcceptedFileTypes["RTF"] = ".rtf";
|
|
20
|
+
// IMAGES
|
|
4
21
|
AcceptedFileTypes["JPEG"] = ".jpeg";
|
|
5
22
|
AcceptedFileTypes["JPG"] = ".jpg";
|
|
6
|
-
AcceptedFileTypes["GIF"] = ".gif";
|
|
7
23
|
AcceptedFileTypes["PNG"] = ".png";
|
|
24
|
+
AcceptedFileTypes["GIF"] = ".gif";
|
|
25
|
+
AcceptedFileTypes["BMP"] = ".bmp";
|
|
26
|
+
AcceptedFileTypes["WEBP"] = ".webp";
|
|
27
|
+
AcceptedFileTypes["SVG"] = ".svg";
|
|
28
|
+
AcceptedFileTypes["ICO"] = ".ico";
|
|
29
|
+
AcceptedFileTypes["TIFF"] = ".tiff";
|
|
30
|
+
AcceptedFileTypes["TIF"] = ".tif";
|
|
31
|
+
// AUDIO
|
|
32
|
+
AcceptedFileTypes["MP3"] = ".mp3";
|
|
33
|
+
AcceptedFileTypes["WAV"] = ".wav";
|
|
34
|
+
AcceptedFileTypes["OGG"] = ".ogg";
|
|
35
|
+
AcceptedFileTypes["AAC"] = ".aac";
|
|
36
|
+
AcceptedFileTypes["FLAC"] = ".flac";
|
|
37
|
+
AcceptedFileTypes["M4A"] = ".m4a";
|
|
38
|
+
AcceptedFileTypes["WMA"] = ".wma";
|
|
39
|
+
// VIDEO
|
|
40
|
+
AcceptedFileTypes["MP4"] = ".mp4";
|
|
41
|
+
AcceptedFileTypes["AVI"] = ".avi";
|
|
42
|
+
AcceptedFileTypes["MOV"] = ".mov";
|
|
43
|
+
AcceptedFileTypes["WMV"] = ".wmv";
|
|
44
|
+
AcceptedFileTypes["FLV"] = ".flv";
|
|
45
|
+
AcceptedFileTypes["WEBM"] = ".webm";
|
|
46
|
+
AcceptedFileTypes["MKV"] = ".mkv";
|
|
47
|
+
AcceptedFileTypes["M4V"] = ".m4v";
|
|
48
|
+
// ARCHIVES
|
|
49
|
+
AcceptedFileTypes["ZIP"] = ".zip";
|
|
50
|
+
AcceptedFileTypes["RAR"] = ".rar";
|
|
51
|
+
AcceptedFileTypes["SEVEN_Z"] = ".7z";
|
|
52
|
+
AcceptedFileTypes["TAR"] = ".tar";
|
|
53
|
+
AcceptedFileTypes["GZ"] = ".gz";
|
|
8
54
|
})(AcceptedFileTypes || (AcceptedFileTypes = {}));
|
|
9
55
|
var FileSizeUnit;
|
|
10
56
|
(function (FileSizeUnit) {
|
|
11
57
|
FileSizeUnit["KB"] = "KB";
|
|
12
58
|
FileSizeUnit["MB"] = "MB";
|
|
13
59
|
})(FileSizeUnit || (FileSizeUnit = {}));
|
|
14
|
-
var
|
|
15
|
-
(function (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
60
|
+
var ErrorType;
|
|
61
|
+
(function (ErrorType) {
|
|
62
|
+
ErrorType["critical"] = "CRITICAL";
|
|
63
|
+
ErrorType["warning"] = "WARNING";
|
|
64
|
+
})(ErrorType || (ErrorType = {}));
|
|
65
|
+
var CriticalErrorMessages;
|
|
66
|
+
(function (CriticalErrorMessages) {
|
|
67
|
+
CriticalErrorMessages["INVALID_FORMAT"] = "Invalid format";
|
|
68
|
+
CriticalErrorMessages["FILE_IS_TOO_BIG"] = "File is too big";
|
|
69
|
+
})(CriticalErrorMessages || (CriticalErrorMessages = {}));
|
|
70
|
+
const DEFAULT_MAXIMUM_MULTIPLE_FILES = 10;
|
|
71
|
+
const DEFAULT_MAXIMUM_FILE_BYTES = 1000000;
|
|
72
|
+
var InputErrorStateMessages;
|
|
73
|
+
(function (InputErrorStateMessages) {
|
|
74
|
+
InputErrorStateMessages["VALID"] = "";
|
|
75
|
+
InputErrorStateMessages["INVALID_FORMAT"] = "Please provide a file with a valid format.";
|
|
76
|
+
InputErrorStateMessages["INVALID_FORMATS"] = "Please provide files with a valid format.";
|
|
77
|
+
InputErrorStateMessages["INVALID_SIZE"] = "Please provide file with an acceptable size.";
|
|
78
|
+
InputErrorStateMessages["INVALID_SIZES"] = "Please provide files with an acceptable size.";
|
|
79
|
+
InputErrorStateMessages["INVALID_FORMAT_AND_SIZE"] = "Please provide files with an acceptable size and format.";
|
|
80
|
+
})(InputErrorStateMessages || (InputErrorStateMessages = {}));
|
|
21
81
|
|
|
22
|
-
export { AcceptedFileTypes, FileSizeUnit,
|
|
82
|
+
export { AcceptedFileTypes, CriticalErrorMessages, DEFAULT_MAXIMUM_FILE_BYTES, DEFAULT_MAXIMUM_MULTIPLE_FILES, ErrorType, FileSizeUnit, InputErrorStateMessages };
|
|
23
83
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../../src/components/UploadFile/constants.ts"],"sourcesContent":["export enum AcceptedFileTypes {\n CSV = '.csv',\n JPEG = '.jpeg',\n JPG = '.jpg',\n GIF = '.gif',\n
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../src/components/UploadFile/constants.ts"],"sourcesContent":["export enum AcceptedFileTypes {\n // DATA FILES\n CSV = '.csv',\n JSON = '.json',\n XML = '.xml',\n TXT = '.txt',\n\n // DOCUMENTS\n PDF = '.pdf',\n DOC = '.doc',\n DOCX = '.docx',\n XLS = '.xls',\n XLSX = '.xlsx',\n PPT = '.ppt',\n PPTX = '.pptx',\n ODT = '.odt',\n ODS = '.ods',\n ODP = '.odp',\n RTF = '.rtf',\n\n // IMAGES\n JPEG = '.jpeg',\n JPG = '.jpg',\n PNG = '.png',\n GIF = '.gif',\n BMP = '.bmp',\n WEBP = '.webp',\n SVG = '.svg',\n ICO = '.ico',\n TIFF = '.tiff',\n TIF = '.tif',\n\n // AUDIO\n MP3 = '.mp3',\n WAV = '.wav',\n OGG = '.ogg',\n AAC = '.aac',\n FLAC = '.flac',\n M4A = '.m4a',\n WMA = '.wma',\n\n // VIDEO\n MP4 = '.mp4',\n AVI = '.avi',\n MOV = '.mov',\n WMV = '.wmv',\n FLV = '.flv',\n WEBM = '.webm',\n MKV = '.mkv',\n M4V = '.m4v',\n\n // ARCHIVES\n ZIP = '.zip',\n RAR = '.rar',\n SEVEN_Z = '.7z',\n TAR = '.tar',\n GZ = '.gz',\n}\n\nexport enum FileSizeUnit {\n KB = 'KB',\n MB = 'MB',\n}\n\nexport enum ErrorType {\n critical = 'CRITICAL',\n warning = 'WARNING',\n}\n\nexport enum CriticalErrorMessages {\n INVALID_FORMAT = 'Invalid format',\n FILE_IS_TOO_BIG = 'File is too big',\n}\n\nexport const DEFAULT_MAXIMUM_MULTIPLE_FILES = 10;\n\nexport const DEFAULT_MAXIMUM_FILE_BYTES = 1000000;\n\nexport enum InputErrorStateMessages {\n VALID = '',\n INVALID_FORMAT = 'Please provide a file with a valid format.',\n INVALID_FORMATS = 'Please provide files with a valid format.',\n INVALID_SIZE = 'Please provide file with an acceptable size.',\n INVALID_SIZES = 'Please provide files with an acceptable size.',\n INVALID_FORMAT_AND_SIZE = 'Please provide files with an acceptable size and format.',\n}\n"],"names":[],"mappings":"IAAY;AAAZ,CAAA,UAAY,iBAAiB,EAAA;;AAE3B,IAAA,iBAAA,CAAA,KAAA,CAAA,GAAA,MAAY;AACZ,IAAA,iBAAA,CAAA,MAAA,CAAA,GAAA,OAAc;AACd,IAAA,iBAAA,CAAA,KAAA,CAAA,GAAA,MAAY;AACZ,IAAA,iBAAA,CAAA,KAAA,CAAA,GAAA,MAAY;;AAGZ,IAAA,iBAAA,CAAA,KAAA,CAAA,GAAA,MAAY;AACZ,IAAA,iBAAA,CAAA,KAAA,CAAA,GAAA,MAAY;AACZ,IAAA,iBAAA,CAAA,MAAA,CAAA,GAAA,OAAc;AACd,IAAA,iBAAA,CAAA,KAAA,CAAA,GAAA,MAAY;AACZ,IAAA,iBAAA,CAAA,MAAA,CAAA,GAAA,OAAc;AACd,IAAA,iBAAA,CAAA,KAAA,CAAA,GAAA,MAAY;AACZ,IAAA,iBAAA,CAAA,MAAA,CAAA,GAAA,OAAc;AACd,IAAA,iBAAA,CAAA,KAAA,CAAA,GAAA,MAAY;AACZ,IAAA,iBAAA,CAAA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AA,4CAA6D;AAC7D,IAAA,uBAAA,CAAA,iBAAA,CAAA,GAAA,2CAA6D;AAC7D,IAAA,uBAAA,CAAA,cAAA,CAAA,GAAA,8CAA6D;AAC7D,IAAA,uBAAA,CAAA,eAAA,CAAA,GAAA,+CAA+D;AAC/D,IAAA,uBAAA,CAAA,yBAAA,CAAA,GAAA,0DAAoF;AACtF,CAAC,EAPW,uBAAuB,KAAvB,uBAAuB,GAOlC,EAAA,CAAA,CAAA;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useUploadFile } from './useUploadFile';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
const useUploadFile = () => {
|
|
6
|
+
const inputRef = React.useRef(null);
|
|
7
|
+
const [fileList, setFileList] = React.useState();
|
|
8
|
+
// Keep inputRef.current.files in sync with fileList
|
|
9
|
+
React.useEffect(() => {
|
|
10
|
+
if (inputRef.current && fileList) {
|
|
11
|
+
// Only update if not already the same (avoid unnecessary assignment)
|
|
12
|
+
if (inputRef.current.files !== fileList) {
|
|
13
|
+
const dt = new DataTransfer();
|
|
14
|
+
Array.from(fileList).forEach((file) => dt.items.add(file));
|
|
15
|
+
inputRef.current.files = dt.files;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
// If fileList is undefined, clear the input
|
|
19
|
+
if (inputRef.current && !fileList) {
|
|
20
|
+
inputRef.current.value = '';
|
|
21
|
+
}
|
|
22
|
+
}, [fileList, inputRef]);
|
|
23
|
+
// Restores the previous file selection when user cancels the file dialog
|
|
24
|
+
const onCancel = React.useCallback(() => {
|
|
25
|
+
// If there are no existing files to restore, just return
|
|
26
|
+
if (!fileList || fileList.length === 0)
|
|
27
|
+
return;
|
|
28
|
+
const newFileList = new DataTransfer();
|
|
29
|
+
Array.from(fileList).forEach((file) => newFileList.items.add(file));
|
|
30
|
+
if (inputRef === null || inputRef === undefined ? undefined : inputRef.current) {
|
|
31
|
+
inputRef.current.files = newFileList.files;
|
|
32
|
+
}
|
|
33
|
+
}, [fileList]);
|
|
34
|
+
const removeFileFromList = React.useCallback((fileToRemove) => {
|
|
35
|
+
if (!fileList)
|
|
36
|
+
return;
|
|
37
|
+
const newFileList = new DataTransfer();
|
|
38
|
+
Array.from(fileList).forEach((file) => {
|
|
39
|
+
if (file.name === fileToRemove.name)
|
|
40
|
+
return; // Skip this file (remove it)
|
|
41
|
+
newFileList.items.add(file);
|
|
42
|
+
});
|
|
43
|
+
if (inputRef === null || inputRef === undefined ? undefined : inputRef.current) {
|
|
44
|
+
inputRef.current.files = newFileList.files;
|
|
45
|
+
}
|
|
46
|
+
setFileList(newFileList.files);
|
|
47
|
+
}, [fileList]);
|
|
48
|
+
const clearFileSelection = React.useCallback(() => {
|
|
49
|
+
var _a;
|
|
50
|
+
if ((_a = inputRef.current) === null || _a === undefined ? undefined : _a.value)
|
|
51
|
+
inputRef.current.value = '';
|
|
52
|
+
setFileList(undefined);
|
|
53
|
+
}, []);
|
|
54
|
+
return {
|
|
55
|
+
clearFileSelection,
|
|
56
|
+
inputRef,
|
|
57
|
+
onCancel,
|
|
58
|
+
removeFileFromList,
|
|
59
|
+
setFileList,
|
|
60
|
+
fileList,
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
exports.useUploadFile = useUploadFile;
|
|
65
|
+
//# sourceMappingURL=useUploadFile.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUploadFile.cjs","sources":["../../../../../src/components/UploadFile/hooks/useUploadFile/useUploadFile.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nexport const useUploadFile = () => {\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n const [fileList, setFileList] = useState<FileList>();\n\n // Keep inputRef.current.files in sync with fileList\n useEffect(() => {\n if (inputRef.current && fileList) {\n // Only update if not already the same (avoid unnecessary assignment)\n if (inputRef.current.files !== fileList) {\n const dt = new DataTransfer();\n Array.from(fileList).forEach((file) => dt.items.add(file));\n inputRef.current.files = dt.files;\n }\n }\n // If fileList is undefined, clear the input\n if (inputRef.current && !fileList) {\n inputRef.current.value = '';\n }\n }, [fileList, inputRef]);\n\n // Restores the previous file selection when user cancels the file dialog\n const onCancel = useCallback(() => {\n // If there are no existing files to restore, just return\n if (!fileList || fileList.length === 0) return;\n\n const newFileList = new DataTransfer();\n Array.from(fileList).forEach((file) => newFileList.items.add(file));\n\n if (inputRef?.current) {\n inputRef.current.files = newFileList.files;\n }\n }, [fileList]);\n\n const removeFileFromList = useCallback(\n (fileToRemove: File) => {\n if (!fileList) return;\n\n const newFileList = new DataTransfer();\n Array.from(fileList).forEach((file) => {\n if (file.name === fileToRemove.name) return; // Skip this file (remove it)\n newFileList.items.add(file);\n });\n\n if (inputRef?.current) {\n inputRef.current.files = newFileList.files;\n }\n setFileList(newFileList.files);\n },\n [fileList],\n );\n\n const clearFileSelection = useCallback(() => {\n if (inputRef.current?.value) inputRef.current.value = '';\n setFileList(undefined);\n }, []);\n\n return {\n clearFileSelection,\n inputRef,\n onCancel,\n removeFileFromList,\n setFileList,\n fileList,\n };\n};\n"],"names":["useRef","useState","useEffect","useCallback"],"mappings":";;;;AAEO,MAAM,aAAa,GAAG,MAAK;AAChC,IAAA,MAAM,QAAQ,GAAGA,YAAM,CAA0B,IAAI,CAAC;IAEtD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAGC,cAAQ,EAAY;;IAGpDC,eAAS,CAAC,MAAK;AACb,QAAA,IAAI,QAAQ,CAAC,OAAO,IAAI,QAAQ,EAAE;;AAEhC,YAAA,IAAI,QAAQ,CAAC,OAAO,CAAC,KAAK,KAAK,QAAQ,EAAE;AACvC,gBAAA,MAAM,EAAE,GAAG,IAAI,YAAY,EAAE;gBAC7B,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC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A,IAAA,QAAQ,6BAAR,QAAQ,CAAE,OAAO,EAAE;YACrB,QAAQ,CAAC,OAAO,CAAC,KAAK,GAAG,WAAW,CAAC,KAAK;AAC3C;AACD,QAAA,WAAW,CAAC,WAAW,CAAC,KAAK,CAAC;AAChC,KAAC,EACD,CAAC,QAAQ,CAAC,CACX;AAED,IAAA,MAAM,kBAAkB,GAAGA,iBAAW,CAAC,MAAK;;AAC1C,QAAA,IAAI,CAAA,EAAA,GAAA,QAAQ,CAAC,OAAO,gDAAE,KAAK;AAAE,YAAA,QAAQ,CAAC,OAAO,CAAC,KAAK,GAAG,EAAE;QACxD,WAAW,CAAC,SAAS,CAAC;KACvB,EAAE,EAAE,CAAC;IAEN,OAAO;QACL,kBAAkB;QAClB,QAAQ;QACR,QAAQ;QACR,kBAAkB;QAClB,WAAW;QACX,QAAQ;KACT;AACH;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const useUploadFile: () => {
|
|
3
|
+
clearFileSelection: () => void;
|
|
4
|
+
inputRef: import("react").MutableRefObject<HTMLInputElement | null>;
|
|
5
|
+
onCancel: () => void;
|
|
6
|
+
removeFileFromList: (fileToRemove: File) => void;
|
|
7
|
+
setFileList: import("react").Dispatch<import("react").SetStateAction<FileList | undefined>>;
|
|
8
|
+
fileList: FileList | undefined;
|
|
9
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { useRef, useState, useEffect, useCallback } from 'react';
|
|
2
|
+
|
|
3
|
+
const useUploadFile = () => {
|
|
4
|
+
const inputRef = useRef(null);
|
|
5
|
+
const [fileList, setFileList] = useState();
|
|
6
|
+
// Keep inputRef.current.files in sync with fileList
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
if (inputRef.current && fileList) {
|
|
9
|
+
// Only update if not already the same (avoid unnecessary assignment)
|
|
10
|
+
if (inputRef.current.files !== fileList) {
|
|
11
|
+
const dt = new DataTransfer();
|
|
12
|
+
Array.from(fileList).forEach((file) => dt.items.add(file));
|
|
13
|
+
inputRef.current.files = dt.files;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
// If fileList is undefined, clear the input
|
|
17
|
+
if (inputRef.current && !fileList) {
|
|
18
|
+
inputRef.current.value = '';
|
|
19
|
+
}
|
|
20
|
+
}, [fileList, inputRef]);
|
|
21
|
+
// Restores the previous file selection when user cancels the file dialog
|
|
22
|
+
const onCancel = useCallback(() => {
|
|
23
|
+
// If there are no existing files to restore, just return
|
|
24
|
+
if (!fileList || fileList.length === 0)
|
|
25
|
+
return;
|
|
26
|
+
const newFileList = new DataTransfer();
|
|
27
|
+
Array.from(fileList).forEach((file) => newFileList.items.add(file));
|
|
28
|
+
if (inputRef === null || inputRef === undefined ? undefined : inputRef.current) {
|
|
29
|
+
inputRef.current.files = newFileList.files;
|
|
30
|
+
}
|
|
31
|
+
}, [fileList]);
|
|
32
|
+
const removeFileFromList = useCallback((fileToRemove) => {
|
|
33
|
+
if (!fileList)
|
|
34
|
+
return;
|
|
35
|
+
const newFileList = new DataTransfer();
|
|
36
|
+
Array.from(fileList).forEach((file) => {
|
|
37
|
+
if (file.name === fileToRemove.name)
|
|
38
|
+
return; // Skip this file (remove it)
|
|
39
|
+
newFileList.items.add(file);
|
|
40
|
+
});
|
|
41
|
+
if (inputRef === null || inputRef === undefined ? undefined : inputRef.current) {
|
|
42
|
+
inputRef.current.files = newFileList.files;
|
|
43
|
+
}
|
|
44
|
+
setFileList(newFileList.files);
|
|
45
|
+
}, [fileList]);
|
|
46
|
+
const clearFileSelection = useCallback(() => {
|
|
47
|
+
var _a;
|
|
48
|
+
if ((_a = inputRef.current) === null || _a === undefined ? undefined : _a.value)
|
|
49
|
+
inputRef.current.value = '';
|
|
50
|
+
setFileList(undefined);
|
|
51
|
+
}, []);
|
|
52
|
+
return {
|
|
53
|
+
clearFileSelection,
|
|
54
|
+
inputRef,
|
|
55
|
+
onCancel,
|
|
56
|
+
removeFileFromList,
|
|
57
|
+
setFileList,
|
|
58
|
+
fileList,
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export { useUploadFile };
|
|
63
|
+
//# sourceMappingURL=useUploadFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUploadFile.js","sources":["../../../../../src/components/UploadFile/hooks/useUploadFile/useUploadFile.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\n\nexport const useUploadFile = () => {\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n const [fileList, setFileList] = useState<FileList>();\n\n // Keep inputRef.current.files in sync with fileList\n useEffect(() => {\n if (inputRef.current && fileList) {\n // Only update if not already the same (avoid unnecessary assignment)\n if (inputRef.current.files !== fileList) {\n const dt = new DataTransfer();\n Array.from(fileList).forEach((file) => dt.items.add(file));\n inputRef.current.files = dt.files;\n }\n }\n // If fileList is undefined, clear the input\n if (inputRef.current && !fileList) {\n inputRef.current.value = '';\n }\n }, [fileList, inputRef]);\n\n // Restores the previous file selection when user cancels the file dialog\n const onCancel = useCallback(() => {\n // If there are no existing files to restore, just return\n if (!fileList || fileList.length === 0) return;\n\n const newFileList = new DataTransfer();\n Array.from(fileList).forEach((file) => newFileList.items.add(file));\n\n if (inputRef?.current) {\n inputRef.current.files = newFileList.files;\n }\n }, [fileList]);\n\n const removeFileFromList = useCallback(\n (fileToRemove: File) => {\n if (!fileList) return;\n\n const newFileList = new DataTransfer();\n Array.from(fileList).forEach((file) => {\n if (file.name === fileToRemove.name) return; // Skip this file (remove it)\n newFileList.items.add(file);\n });\n\n if (inputRef?.current) {\n inputRef.current.files = newFileList.files;\n }\n setFileList(newFileList.files);\n },\n [fileList],\n );\n\n const clearFileSelection = useCallback(() => {\n if (inputRef.current?.value) inputRef.current.value = '';\n setFileList(undefined);\n }, []);\n\n return {\n clearFileSelection,\n inputRef,\n onCancel,\n removeFileFromList,\n setFileList,\n fileList,\n };\n};\n"],"names":[],"mappings":";;AAEO,MAAM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