@veeqo/ui 12.4.0-beta-9 → 12.5.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/SelectDropdown/SelectDropdown.cjs +27 -19
- package/dist/components/SelectDropdown/SelectDropdown.cjs.map +1 -1
- package/dist/components/SelectDropdown/SelectDropdown.d.ts +1 -1
- package/dist/components/SelectDropdown/SelectDropdown.js +27 -19
- package/dist/components/SelectDropdown/SelectDropdown.js.map +1 -1
- package/dist/components/SelectDropdown/SelectDropdown.module.scss.cjs +2 -2
- package/dist/components/SelectDropdown/SelectDropdown.module.scss.cjs.map +1 -1
- package/dist/components/SelectDropdown/SelectDropdown.module.scss.js +2 -2
- package/dist/components/SelectDropdown/SelectDropdown.module.scss.js.map +1 -1
- package/dist/components/SelectDropdown/components/GridItem/GridItem.cjs +37 -0
- package/dist/components/SelectDropdown/components/GridItem/GridItem.cjs.map +1 -0
- package/dist/components/SelectDropdown/components/GridItem/GridItem.js +31 -0
- package/dist/components/SelectDropdown/components/GridItem/GridItem.js.map +1 -0
- package/dist/components/SelectDropdown/components/GridItem/GridItem.module.scss.cjs +9 -0
- package/dist/components/SelectDropdown/components/GridItem/GridItem.module.scss.cjs.map +1 -0
- package/dist/components/SelectDropdown/components/GridItem/GridItem.module.scss.js +7 -0
- package/dist/components/SelectDropdown/components/GridItem/GridItem.module.scss.js.map +1 -0
- package/dist/components/SelectDropdown/components/ItemContent/ItemContent.cjs +4 -4
- 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 +4 -4
- package/dist/components/SelectDropdown/components/ItemContent/ItemContent.js.map +1 -1
- package/dist/components/SelectDropdown/components/ItemContent/ItemContent.module.scss.cjs +2 -2
- package/dist/components/SelectDropdown/components/ItemContent/ItemContent.module.scss.cjs.map +1 -1
- package/dist/components/SelectDropdown/components/ItemContent/ItemContent.module.scss.js +2 -2
- package/dist/components/SelectDropdown/components/ItemContent/ItemContent.module.scss.js.map +1 -1
- package/dist/components/SelectDropdown/components/ItemContent/types.d.ts +2 -0
- package/dist/components/SelectDropdown/components/ListItem/ListItem.cjs +1 -1
- package/dist/components/SelectDropdown/components/ListItem/ListItem.cjs.map +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/ListItemSection/ListItemSection.cjs +1 -1
- package/dist/components/SelectDropdown/components/ListItemSection/ListItemSection.cjs.map +1 -1
- package/dist/components/SelectDropdown/components/ListItemSection/ListItemSection.js +1 -1
- package/dist/components/SelectDropdown/components/ListItemSection/ListItemSection.js.map +1 -1
- package/dist/components/SelectDropdown/components/ListItemSection/ListItemSection.module.scss.cjs +2 -2
- package/dist/components/SelectDropdown/components/ListItemSection/ListItemSection.module.scss.cjs.map +1 -1
- package/dist/components/SelectDropdown/components/ListItemSection/ListItemSection.module.scss.js +2 -2
- package/dist/components/SelectDropdown/components/ListItemSection/ListItemSection.module.scss.js.map +1 -1
- package/dist/components/SelectDropdown/components/OptionsContainers/GridList.cjs +18 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/GridList.cjs.map +1 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/GridList.d.ts +3 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/GridList.js +12 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/GridList.js.map +1 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/ListBox.cjs +19 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/ListBox.cjs.map +1 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/ListBox.d.ts +3 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/ListBox.js +13 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/ListBox.js.map +1 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/OptionsContainer.module.scss.cjs +9 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/OptionsContainer.module.scss.cjs.map +1 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/OptionsContainer.module.scss.js +7 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/OptionsContainer.module.scss.js.map +1 -0
- package/dist/components/SelectDropdown/components/OptionsContainers/types.d.ts +25 -0
- package/dist/components/SelectDropdown/components/SelectDropdownState.cjs +11 -3
- package/dist/components/SelectDropdown/components/SelectDropdownState.cjs.map +1 -1
- package/dist/components/SelectDropdown/components/SelectDropdownState.js +11 -3
- package/dist/components/SelectDropdown/components/SelectDropdownState.js.map +1 -1
- package/dist/components/SelectDropdown/components/SelectedOption.cjs +2 -2
- package/dist/components/SelectDropdown/components/SelectedOption.cjs.map +1 -1
- package/dist/components/SelectDropdown/components/SelectedOption.js +2 -2
- package/dist/components/SelectDropdown/components/SelectedOption.js.map +1 -1
- package/dist/components/SelectDropdown/components/item.module.scss.cjs +3 -3
- package/dist/components/SelectDropdown/components/item.module.scss.cjs.map +1 -1
- package/dist/components/SelectDropdown/components/item.module.scss.js +3 -3
- package/dist/components/SelectDropdown/components/item.module.scss.js.map +1 -1
- package/dist/components/SelectDropdown/types.d.ts +4 -1
- package/dist/components/UploadFile/UploadFile.cjs +82 -71
- package/dist/components/UploadFile/UploadFile.cjs.map +1 -1
- package/dist/components/UploadFile/UploadFile.js +85 -74
- package/dist/components/UploadFile/UploadFile.js.map +1 -1
- package/dist/components/UploadFile/UploadGraphic.cjs +14 -0
- package/dist/components/UploadFile/UploadGraphic.cjs.map +1 -0
- package/dist/components/UploadFile/UploadGraphic.d.ts +2 -0
- package/dist/components/UploadFile/UploadGraphic.js +8 -0
- package/dist/components/UploadFile/UploadGraphic.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/components/UploadFileErrors/UploadFileErrors.cjs +31 -0
- package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.cjs.map +1 -0
- package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.d.ts +7 -0
- package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.js +25 -0
- package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.js.map +1 -0
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.cjs +5 -52
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.cjs.map +1 -1
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.d.ts +3 -7
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.js +5 -52
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.js.map +1 -1
- package/dist/components/UploadFile/components/UploadedFile/styled.cjs +20 -0
- package/dist/components/UploadFile/components/UploadedFile/styled.cjs.map +1 -0
- package/dist/components/UploadFile/components/UploadedFile/styled.d.ts +2 -0
- package/dist/components/UploadFile/components/UploadedFile/styled.js +13 -0
- package/dist/components/UploadFile/components/UploadedFile/styled.js.map +1 -0
- package/dist/components/UploadFile/constants.cjs +8 -64
- package/dist/components/UploadFile/constants.cjs.map +1 -1
- package/dist/components/UploadFile/constants.d.ts +5 -52
- package/dist/components/UploadFile/constants.js +9 -63
- package/dist/components/UploadFile/constants.js.map +1 -1
- package/dist/components/UploadFile/mocks/files.d.ts +0 -2
- package/dist/components/UploadFile/mocks/utils.d.ts +2 -1
- package/dist/components/UploadFile/styled.cjs +1 -16
- package/dist/components/UploadFile/styled.cjs.map +1 -1
- package/dist/components/UploadFile/styled.d.ts +1 -4
- package/dist/components/UploadFile/styled.js +1 -16
- package/dist/components/UploadFile/styled.js.map +1 -1
- package/dist/components/UploadFile/types.d.ts +1 -14
- package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.cjs +11 -14
- package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.cjs.map +1 -1
- package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.d.ts +7 -10
- package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.js +11 -14
- package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.js.map +1 -1
- package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.cjs +30 -16
- package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.cjs.map +1 -1
- package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.js +30 -16
- package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.js.map +1 -1
- package/dist/components/UploadFile/utils/index.d.ts +1 -0
- package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.cjs +18 -0
- package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.cjs.map +1 -0
- package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.d.ts +13 -0
- package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.js +16 -0
- package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.js.map +1 -0
- package/dist/components/ViewsContainer/ViewsContainer.cjs +37 -10
- package/dist/components/ViewsContainer/ViewsContainer.cjs.map +1 -1
- package/dist/components/ViewsContainer/ViewsContainer.js +37 -10
- package/dist/components/ViewsContainer/ViewsContainer.js.map +1 -1
- package/dist/components/ViewsContainer/ViewsContainer.module.scss.cjs +9 -0
- package/dist/components/ViewsContainer/ViewsContainer.module.scss.cjs.map +1 -0
- package/dist/components/ViewsContainer/ViewsContainer.module.scss.js +7 -0
- package/dist/components/ViewsContainer/ViewsContainer.module.scss.js.map +1 -0
- package/dist/components/ViewsContainer/hooks/useSetScrollPosition.cjs +73 -45
- package/dist/components/ViewsContainer/hooks/useSetScrollPosition.cjs.map +1 -1
- package/dist/components/ViewsContainer/hooks/useSetScrollPosition.d.ts +9 -1
- package/dist/components/ViewsContainer/hooks/useSetScrollPosition.js +74 -46
- package/dist/components/ViewsContainer/hooks/useSetScrollPosition.js.map +1 -1
- package/dist/components/ViewsContainer/types.d.ts +18 -0
- package/dist/utils/forms/form.module.scss.cjs +2 -2
- package/dist/utils/forms/form.module.scss.cjs.map +1 -1
- package/dist/utils/forms/form.module.scss.js +2 -2
- package/dist/utils/forms/form.module.scss.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/UploadFile/components/DropCopy/DropCopy.cjs +0 -28
- package/dist/components/UploadFile/components/DropCopy/DropCopy.cjs.map +0 -1
- package/dist/components/UploadFile/components/DropCopy/DropCopy.d.ts +0 -2
- package/dist/components/UploadFile/components/DropCopy/DropCopy.js +0 -22
- package/dist/components/UploadFile/components/DropCopy/DropCopy.js.map +0 -1
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.module.scss.cjs +0 -9
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.module.scss.cjs.map +0 -1
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.module.scss.js +0 -7
- package/dist/components/UploadFile/components/UploadedFile/UploadedFile.module.scss.js.map +0 -1
- package/dist/components/UploadFile/hooks/useFileErrorMessages/index.d.ts +0 -1
- package/dist/components/UploadFile/hooks/useFileErrorMessages/useFileErrorMessages.cjs +0 -39
- package/dist/components/UploadFile/hooks/useFileErrorMessages/useFileErrorMessages.cjs.map +0 -1
- package/dist/components/UploadFile/hooks/useFileErrorMessages/useFileErrorMessages.d.ts +0 -13
- package/dist/components/UploadFile/hooks/useFileErrorMessages/useFileErrorMessages.js +0 -37
- package/dist/components/UploadFile/hooks/useFileErrorMessages/useFileErrorMessages.js.map +0 -1
- package/dist/components/UploadFile/hooks/usePreviewImage/index.d.ts +0 -1
- package/dist/components/UploadFile/hooks/usePreviewImage/usePreviewImage.cjs +0 -36
- package/dist/components/UploadFile/hooks/usePreviewImage/usePreviewImage.cjs.map +0 -1
- package/dist/components/UploadFile/hooks/usePreviewImage/usePreviewImage.d.ts +0 -8
- package/dist/components/UploadFile/hooks/usePreviewImage/usePreviewImage.js +0 -34
- package/dist/components/UploadFile/hooks/usePreviewImage/usePreviewImage.js.map +0 -1
- package/dist/components/UploadFile/hooks/useUploadFile/index.d.ts +0 -1
- package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.cjs +0 -65
- package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.cjs.map +0 -1
- package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.d.ts +0 -9
- package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.js +0 -63
- package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.js.map +0 -1
- package/dist/components/UploadFile/hooks/useValidateInput/index.d.ts +0 -1
- package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.cjs +0 -85
- package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.cjs.map +0 -1
- package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.d.ts +0 -13
- package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.js +0 -83
- package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.js.map +0 -1
- package/dist/components/UploadFile/mocks/mockUseUploadFile.d.ts +0 -14
- package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileExtension.d.ts +0 -1
- package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileType.cjs +0 -17
- package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileType.cjs.map +0 -1
- package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileType.d.ts +0 -1
- package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileType.js +0 -15
- package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/convertFileTypeToAcceptedFileType.js.map +0 -1
- package/dist/components/UploadFile/utils/convertFileTypeToAcceptedFileExtension/index.d.ts +0 -1
- package/dist/components/UploadFile/utils/isImageType/index.d.ts +0 -1
- package/dist/components/UploadFile/utils/isImageType/isImageType.cjs +0 -14
- package/dist/components/UploadFile/utils/isImageType/isImageType.cjs.map +0 -1
- package/dist/components/UploadFile/utils/isImageType/isImageType.d.ts +0 -1
- package/dist/components/UploadFile/utils/isImageType/isImageType.js +0 -12
- package/dist/components/UploadFile/utils/isImageType/isImageType.js.map +0 -1
- package/dist/components/ViewsContainer/styled.cjs +0 -37
- package/dist/components/ViewsContainer/styled.cjs.map +0 -1
- package/dist/components/ViewsContainer/styled.d.ts +0 -34
- package/dist/components/ViewsContainer/styled.js +0 -23
- package/dist/components/ViewsContainer/styled.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadFile.js","sources":["../../../src/components/UploadFile/UploadFile.tsx"],"sourcesContent":["import React, {\n useCallback,\n useEffect,\n useState,\n DragEvent,\n forwardRef,\n useImperativeHandle,\n} from 'react';\nimport { theme } from 'Theme';\nimport { CriticalIcon, LockIcon } from '../../icons';\nimport { DropZoneContainer } from './styled';\nimport { FileSizeUnit, DEFAULT_MAXIMUM_MULTIPLE_FILES } from './constants';\nimport { UploadCopy } from './components/UploadCopy/UploadCopy';\nimport { DropCopy } from './components/DropCopy/DropCopy';\nimport { getFileSizeString, getTypePropForInputEl, getValidTypesString } from './utils';\nimport { UploadFileProps } from './types';\nimport { Disabled, Error, Hint, Label, RootStack } from '../../hoc/withLabels/styled';\nimport { UploadedFile } from './components/UploadedFile/UploadedFile';\nimport { FlexCol } from '../Flex/FlexCol';\nimport { FlexRow } from '../Flex/FlexRow';\nimport { useUploadFile } from './hooks/useUploadFile';\nimport { useValidateInput } from './hooks/useValidateInput';\n\nexport const UploadFile = forwardRef<HTMLInputElement, UploadFileProps>(\n (\n {\n id,\n name,\n maxBytes = 1000000,\n format = FileSizeUnit.MB,\n fileTypes,\n disabled,\n multiple,\n label = multiple ? 'Upload files' : 'Upload file',\n hideUploadedFiles = false,\n onMaxFilesExceeded,\n maxFiles = DEFAULT_MAXIMUM_MULTIPLE_FILES,\n disabledMessage,\n errorMessage,\n ...otherProps\n }: UploadFileProps,\n outerRef,\n ) => {\n const { inputRef, fileList, setFileList, onCancel, removeFileFromList, clearFileSelection } =\n useUploadFile();\n\n const { validationCount } = useValidateInput({\n customErrorMessage: errorMessage,\n inputRef,\n fileList,\n fileTypes,\n maxBytes,\n });\n\n useImperativeHandle(outerRef, () => inputRef.current!, [inputRef]);\n\n const [isDragOver, setIsDragOver] = useState(false);\n\n // Computed properties based on params\n const maxSizeCopy = getFileSizeString({ maxBytes, format });\n const acceptedTypesCopy = getValidTypesString({ fileTypes });\n const acceptedTypesForInputEl = getTypePropForInputEl({ fileTypes });\n\n const validateMaximumFiles = useCallback(\n (files: FileList | null | undefined) => {\n if (files?.length && files?.length > maxFiles) {\n clearFileSelection();\n onMaxFilesExceeded?.();\n return false;\n }\n return true;\n },\n [clearFileSelection, maxFiles, onMaxFilesExceeded],\n );\n\n // Processes file and updates the UI appropriately:\n const updateFiles = useCallback(\n (files: FileList) => {\n if (!files.length) {\n return;\n }\n\n setFileList(files);\n },\n [setFileList],\n );\n\n // For focussing of input el and updating drop UI\n const onDragEnter = (event: DragEvent<HTMLElement>) => {\n event.preventDefault();\n setIsDragOver(true);\n inputRef.current?.focus();\n };\n\n // For unfocussing of input el and updating drop UI\n const onDragLeave = (event: DragEvent<HTMLElement>) => {\n event.preventDefault();\n setIsDragOver(false);\n };\n\n // Prevents default browser behaviour\n const onDragOver = (event: DragEvent<HTMLElement>) => event.preventDefault();\n\n // Process file when dropped into eligible area\n const onDrop = (event: DragEvent<HTMLElement>) => {\n event.preventDefault();\n setIsDragOver(false);\n // Prevent reactions on dragging events that do not contain files\n if (!event.dataTransfer.files.length) return;\n\n const canUpdateFiles = validateMaximumFiles(event.dataTransfer.files);\n if (canUpdateFiles) {\n updateFiles(event.dataTransfer.files);\n }\n };\n\n // Updates UI based on a native file input change. Attached via useEffect below\n const onChange = useCallback(() => {\n const canUpdateFiles = validateMaximumFiles(inputRef?.current?.files);\n const files = inputRef?.current?.files;\n if (canUpdateFiles && files) {\n updateFiles(files);\n } else if (fileList) {\n updateFiles(fileList);\n }\n }, [validateMaximumFiles, inputRef, fileList, updateFiles]);\n\n useEffect(() => {\n const ref = inputRef?.current;\n ref?.addEventListener('change', onChange);\n ref?.addEventListener('cancel', onCancel);\n\n return () => {\n ref?.removeEventListener('change', onChange);\n ref?.removeEventListener('cancel', onCancel);\n };\n }, [onChange, onCancel, inputRef]);\n\n const hasUserProvidedNoFiles = !fileList?.length;\n\n return (\n <RootStack spacing=\"xs\" alignX=\"stretch\">\n <Label htmlFor={id}>\n {label}\n <FlexCol>\n <Hint>\n {maxSizeCopy}\n <br />\n {acceptedTypesCopy}\n </Hint>\n <DropZoneContainer\n hasUserProvidedNoFiles={hasUserProvidedNoFiles}\n isDragOver={isDragOver}\n data-testid=\"drop-zone-container\"\n onDrop={onDrop}\n onDragEnter={onDragEnter}\n onDragOver={onDragOver}\n onDragLeave={onDragLeave}\n >\n {isDragOver ? <DropCopy /> : <UploadCopy />}\n <input\n ref={inputRef}\n id={id}\n type=\"file\"\n accept={acceptedTypesForInputEl}\n name={name}\n disabled={disabled}\n multiple={multiple}\n {...otherProps}\n />\n </DropZoneContainer>\n </FlexCol>\n </Label>\n <FlexCol>\n {inputRef?.current?.validity.valid === false &&\n hasUserProvidedNoFiles &&\n !!validationCount && (\n <FlexRow>\n <CriticalIcon width={16} height={16} color={theme.colors.secondary.red.base} />\n <Error>{inputRef.current?.validationMessage}</Error>\n </FlexRow>\n )}\n {disabledMessage && (\n <FlexRow id={`${id}-disabled`}>\n <LockIcon width={16} height={16} color={theme.colors.neutral.ink.light} />\n <Disabled>{disabledMessage}</Disabled>\n </FlexRow>\n )}\n {!hideUploadedFiles &&\n fileList && [\n Array.from(fileList).map((file) => {\n return (\n <UploadedFile\n key={`${file.name}`}\n file={file}\n removeFileFromList={removeFileFromList}\n disabled={disabled}\n format={format}\n maxBytes={maxBytes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AAAA,cAAA,CAAA,aAAA,CAAC,QAAQ,EAAA,IAAA,EAAE,eAAe,CAAY,CAC9B,CACX;AACA,YAAA,CAAC,iBAAiB;AACjB,gBAAA,QAAQ,IAAI;gBACV,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,KAAI;AAChC,oBAAA,QACEA,cAAC,CAAA,aAAA,CAAA,YAAY,EACX,EAAA,GAAG,EAAE,CAAG,EAAA,IAAI,CAAC,IAAI,EAAE,EACnB,IAAI,EAAE,IAAI,EACV,kBAAkB,EAAE,kBAAkB,EACtC,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EAAA,CACpB;AAEN,iBAAC,CAAC;aACH,CACK,CACA;AAEhB,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"UploadFile.js","sources":["../../../src/components/UploadFile/UploadFile.tsx"],"sourcesContent":["import React, {\n useCallback,\n useEffect,\n useState,\n DragEvent,\n forwardRef,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport { DropZoneContainer } from './styled';\nimport { InputState, FileSizeUnit } from './constants';\nimport { UploadCopy } from './components/UploadCopy/UploadCopy';\nimport { setInputElFile } from './utils/setInputElFile/setInputElFile';\nimport { getFileSizeString, getTypePropForInputEl, getValidTypesString } from './utils';\nimport { UploadFileProps } from './types';\nimport { Hint, Label, RootStack } from '../../hoc/withLabels/styled';\nimport { UploadFileErrors } from './components/UploadFileErrors/UploadFileErrors';\nimport { UploadedFile } from './components/UploadedFile/UploadedFile';\nimport { FlexCol } from '../Flex/FlexCol';\n\nexport const UploadFile = forwardRef<HTMLInputElement, UploadFileProps>(\n (\n {\n id,\n name,\n maxBytes = 1000000,\n format = FileSizeUnit.MB,\n fileTypes,\n label = 'Upload file',\n required,\n disabled,\n ...otherProps\n }: UploadFileProps,\n outerRef,\n ) => {\n const inputRef = useRef<HTMLInputElement | null>(null);\n useImperativeHandle(outerRef, () => inputRef.current!, []);\n\n const [file, setFile] = useState<File>();\n const [errorState, setErrorState] = useState(InputState.VALID);\n\n const isInvalidFormat =\n errorState === InputState.INVALID_FORMAT || errorState === InputState.INVALID_FORMAT_AND_SIZE;\n const isOverMaxSize =\n errorState === InputState.INVALID_SIZE || errorState === InputState.INVALID_FORMAT_AND_SIZE;\n\n // Computed properties based on params\n const maxSizeCopy = getFileSizeString({ maxBytes, format });\n const acceptedTypesCopy = getValidTypesString({ fileTypes });\n const acceptedTypesForInputEl = getTypePropForInputEl({ fileTypes });\n\n const clearFileSelection = () => {\n if (inputRef.current?.value) inputRef.current.value = '';\n };\n\n // Tracks error states within the input element itself, using preset\n // error messages and assigns these to the input component based on the file\n const setInputValidation = ({\n overMaxSize,\n invalidFormat,\n }: {\n overMaxSize?: boolean;\n invalidFormat?: boolean;\n }) => {\n let error = InputState.VALID;\n if (invalidFormat && !overMaxSize) {\n error = InputState.INVALID_FORMAT;\n } else if (!invalidFormat && overMaxSize) {\n error = InputState.INVALID_SIZE;\n } else if (invalidFormat && overMaxSize) {\n error = InputState.INVALID_FORMAT_AND_SIZE;\n }\n inputRef.current?.setCustomValidity(error);\n setErrorState(error);\n };\n\n // Processes file and updates the UI appropriately:\n const updateFiles = useCallback(\n (files: FileList) => {\n if (!files.length) {\n setInputValidation({ invalidFormat: true });\n return;\n }\n\n const [newFile] = files;\n const hasExceededMaxSize = newFile.size > maxBytes;\n\n const [, extension] = newFile.type.split('/');\n const isTypeValid = fileTypes.find((validType) => validType.substring(1) === extension);\n const hasInvalidFormat = !isTypeValid;\n\n if (hasExceededMaxSize || hasInvalidFormat) {\n // Empty the inputRef's read-only fileList by clearing the value attribute,\n // since we have an invalid input.\n clearFileSelection();\n } else {\n // Update the files attribute of the input el, with the new file(s)\n setInputElFile({ fileList: files, elementId: id });\n }\n setInputValidation({\n invalidFormat: hasInvalidFormat,\n overMaxSize: hasExceededMaxSize,\n });\n setFile(newFile);\n },\n [fileTypes, id, maxBytes],\n );\n\n // For focussing of input el and updating drop UI\n const onDragEnter = (event: DragEvent<HTMLElement>) => {\n event.preventDefault();\n inputRef.current?.focus();\n };\n\n // For unfocussing of input el and updating drop UI\n const onDragLeave = (event: DragEvent<HTMLElement>) => {\n event.preventDefault();\n inputRef.current?.blur();\n };\n\n // Prevents default browser behaviour\n const onDragOver = (event: DragEvent<HTMLElement>) => event.preventDefault();\n\n // Process file when dropped into eligible area\n const onDrop = (event: DragEvent<HTMLElement>) => {\n event.preventDefault();\n // Prevent reactions on dragging events that do not contain files\n if (!event.dataTransfer.files.length) return;\n updateFiles(event.dataTransfer.files);\n };\n\n // Removes input el's files, clears errors and removes file from react component\n const resetSelection = useCallback(() => {\n clearFileSelection();\n setFile(undefined);\n setInputValidation({\n invalidFormat: false,\n overMaxSize: false,\n });\n }, []);\n\n // Updates UI based on a native file input change. Attached via useEffect below\n const onInputChange = useCallback(() => {\n const files = inputRef?.current?.files;\n if (files?.length && files?.length > 0) updateFiles(files);\n else resetSelection();\n }, [resetSelection, updateFiles]);\n\n useEffect(() => {\n const ref = inputRef?.current;\n ref?.addEventListener('change', onInputChange);\n ref?.addEventListener('cancel', resetSelection);\n\n return () => {\n ref?.removeEventListener('change', onInputChange);\n ref?.removeEventListener('cancel', resetSelection);\n };\n }, [onInputChange, resetSelection]);\n\n return (\n <RootStack spacing=\"xs\" alignX=\"stretch\">\n <Label htmlFor={id}>\n {label}\n <FlexCol>\n <Hint>\n <div>{acceptedTypesCopy}</div>\n <div>{maxSizeCopy}</div>\n </Hint>\n <DropZoneContainer\n data-testid=\"drop-zone-container\"\n onDrop={onDrop}\n onDragEnter={onDragEnter}\n onDragOver={onDragOver}\n onDragLeave={onDragLeave}\n >\n <UploadCopy />\n <input\n ref={inputRef}\n id={id}\n type=\"file\"\n accept={acceptedTypesForInputEl}\n name={name}\n required={required}\n disabled={disabled}\n {...otherProps}\n />\n </DropZoneContainer>\n </FlexCol>\n </Label>\n <FlexCol>\n <UploadedFile file={file} resetSelection={resetSelection} disabled={disabled} />\n <UploadFileErrors\n acceptedTypesCopy={isInvalidFormat ? acceptedTypesCopy : undefined}\n maxSizeCopy={isOverMaxSize ? maxSizeCopy : undefined}\n />\n </FlexCol>\n </RootStack>\n );\n },\n);\n"],"names":["React"],"mappings":";;;;;;;;;;;;;AAoBa,MAAA,UAAU,GAAG,UAAU,CAClC,CACE,EACE,EAAE,EACF,IAAI,EACJ,QAAQ,GAAG,OAAO,EAClB,MAAM,GAAG,YAAY,CAAC,EAAE,EACxB,SAAS,EACT,KAAK,GAAG,aAAa,EACrB,QAAQ,EACR,QAAQ,EACR,GAAG,UAAU,EACG,EAClB,QAAQ,KACN;AACF,IAAA,MAAM,QAAQ,GAAG,MAAM,CAA0B,IAAI,CAAC;AACtD,IAAA,mBAAmB,CAAC,QAAQ,EAAE,MAAM,QAAQ,CAAC,OAAQ,EAAE,EAAE,CAAC;IAE1D,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,EAAQ;AACxC,IAAA,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC;AAE9D,IAAA,MAAM,eAAe,GACnB,UAAU,KAAK,UAAU,CAAC,cAAc,IAAI,UAAU,KAAK,UAAU,CAAC,uBAAuB;AAC/F,IAAA,MAAM,aAAa,GACjB,UAAU,KAAK,UAAU,CAAC,YAAY,IAAI,UAAU,KAAK,UAAU,CAAC,uBAAuB;;IAG7F,MAAM,WAAW,GAAG,iBAAiB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAC3D,MAAM,iBAAiB,GAAG,mBAAmB,CAAC,EAAE,SAAS,EAAE,CAAC;IAC5D,MAAM,uBAAuB,GAAG,qBAAqB,CAAC,EAAE,SAAS,EAAE,CAAC;IAEpE,MAAM,kBAAkB,GAAG,MAAK;;AAC9B,QAAA,IAAI,CAAA,EAAA,GAAA,QAAQ,CAAC,OAAO,gDAAE,KA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EAAE,QAAQ,EAAI,CAAA;AAChF,YAAAA,cAAA,CAAA,aAAA,CAAC,gBAAgB,EAAA,EACf,iBAAiB,EAAE,eAAe,GAAG,iBAAiB,GAAG,SAAS,EAClE,WAAW,EAAE,aAAa,GAAG,WAAW,GAAG,SAAS,EAAA,CACpD,CACM,CACA;AAEhB,CAAC;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
6
|
+
|
|
7
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
8
|
+
|
|
9
|
+
const UploadGraphic = () => (React__default.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "56", height: "56", fill: "none", role: "presentation" },
|
|
10
|
+
React__default.default.createElement("path", { fill: "#fff", d: "M0 28C0 12.536 12.536 0 28 0s28 12.536 28 28-12.536 28-28 28S0 43.464 0 28" }),
|
|
11
|
+
React__default.default.createElement("path", { fill: "#37424D", d: "M22.5 36c-1.517 0-2.812-.525-3.887-1.575-1.075-1.05-1.613-2.333-1.613-3.85 0-1.3.392-2.458 1.175-3.475s1.808-1.667 3.075-1.95c.417-1.533 1.25-2.775 2.5-3.725C25 20.475 26.417 20 28 20c1.95 0 3.604.68 4.962 2.038C34.322 23.396 35 25.05 35 27c1.15.133 2.104.63 2.862 1.488A4.407 4.407 0 0 1 39 31.5c0 1.25-.437 2.313-1.312 3.188C36.812 35.562 35.75 36 34.5 36H29c-.55 0-1.02-.196-1.413-.587A1.926 1.926 0 0 1 27 34v-5.15l-1.6 1.55L24 29l4-4 4 4-1.4 1.4-1.6-1.55V34h5.5c.7 0 1.292-.242 1.775-.725.483-.483.725-1.075.725-1.775s-.242-1.292-.725-1.775C35.792 29.242 35.2 29 34.5 29H33v-2c0-1.383-.487-2.562-1.462-3.538C30.562 22.489 29.383 22 28 22s-2.562.488-3.538 1.462C23.489 24.438 23 25.618 23 27h-.5c-.967 0-1.792.342-2.475 1.025A3.372 3.372 0 0 0 19 30.5c0 .967.342 1.792 1.025 2.475A3.372 3.372 0 0 0 22.5 34H25v2z" })));
|
|
12
|
+
|
|
13
|
+
exports.UploadGraphic = UploadGraphic;
|
|
14
|
+
//# sourceMappingURL=UploadGraphic.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UploadGraphic.cjs","sources":["../../../src/components/UploadFile/UploadGraphic.tsx"],"sourcesContent":["import React from 'react';\n\nexport const UploadGraphic = () => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"56\" height=\"56\" fill=\"none\" role=\"presentation\">\n <path\n fill=\"#fff\"\n d=\"M0 28C0 12.536 12.536 0 28 0s28 12.536 28 28-12.536 28-28 28S0 43.464 0 28\"\n />\n <path\n fill=\"#37424D\"\n d=\"M22.5 36c-1.517 0-2.812-.525-3.887-1.575-1.075-1.05-1.613-2.333-1.613-3.85 0-1.3.392-2.458 1.175-3.475s1.808-1.667 3.075-1.95c.417-1.533 1.25-2.775 2.5-3.725C25 20.475 26.417 20 28 20c1.95 0 3.604.68 4.962 2.038C34.322 23.396 35 25.05 35 27c1.15.133 2.104.63 2.862 1.488A4.407 4.407 0 0 1 39 31.5c0 1.25-.437 2.313-1.312 3.188C36.812 35.562 35.75 36 34.5 36H29c-.55 0-1.02-.196-1.413-.587A1.926 1.926 0 0 1 27 34v-5.15l-1.6 1.55L24 29l4-4 4 4-1.4 1.4-1.6-1.55V34h5.5c.7 0 1.292-.242 1.775-.725.483-.483.725-1.075.725-1.775s-.242-1.292-.725-1.775C35.792 29.242 35.2 29 34.5 29H33v-2c0-1.383-.487-2.562-1.462-3.538C30.562 22.489 29.383 22 28 22s-2.562.488-3.538 1.462C23.489 24.438 23 25.618 23 27h-.5c-.967 0-1.792.342-2.475 1.025A3.372 3.372 0 0 0 19 30.5c0 .967.342 1.792 1.025 2.475A3.372 3.372 0 0 0 22.5 34H25v2z\"\n />\n </svg>\n);\n"],"names":["React"],"mappings":";;;;;;;;AAEa,MAAA,aAAa,GAAG,OAC3BA,sBAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,KAAK,EAAC,4BAA4B,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,cAAc,EAAA;AAC5F,IAAAA,sBAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EACE,IAAI,EAAC,MAAM,EACX,CAAC,EAAC,4EAA4E,EAC9E,CAAA;IACFA,sBACE,CAAA,aAAA,CAAA,MAAA,EAAA,EAAA,IAAI,EAAC,SAAS,EACd,CAAC,EAAC,kzBAAkzB,EAAA,CACpzB,CACE;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
const UploadGraphic = () => (React__default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "56", height: "56", fill: "none", role: "presentation" },
|
|
4
|
+
React__default.createElement("path", { fill: "#fff", d: "M0 28C0 12.536 12.536 0 28 0s28 12.536 28 28-12.536 28-28 28S0 43.464 0 28" }),
|
|
5
|
+
React__default.createElement("path", { fill: "#37424D", d: "M22.5 36c-1.517 0-2.812-.525-3.887-1.575-1.075-1.05-1.613-2.333-1.613-3.85 0-1.3.392-2.458 1.175-3.475s1.808-1.667 3.075-1.95c.417-1.533 1.25-2.775 2.5-3.725C25 20.475 26.417 20 28 20c1.95 0 3.604.68 4.962 2.038C34.322 23.396 35 25.05 35 27c1.15.133 2.104.63 2.862 1.488A4.407 4.407 0 0 1 39 31.5c0 1.25-.437 2.313-1.312 3.188C36.812 35.562 35.75 36 34.5 36H29c-.55 0-1.02-.196-1.413-.587A1.926 1.926 0 0 1 27 34v-5.15l-1.6 1.55L24 29l4-4 4 4-1.4 1.4-1.6-1.55V34h5.5c.7 0 1.292-.242 1.775-.725.483-.483.725-1.075.725-1.775s-.242-1.292-.725-1.775C35.792 29.242 35.2 29 34.5 29H33v-2c0-1.383-.487-2.562-1.462-3.538C30.562 22.489 29.383 22 28 22s-2.562.488-3.538 1.462C23.489 24.438 23 25.618 23 27h-.5c-.967 0-1.792.342-2.475 1.025A3.372 3.372 0 0 0 19 30.5c0 .967.342 1.792 1.025 2.475A3.372 3.372 0 0 0 22.5 34H25v2z" })));
|
|
6
|
+
|
|
7
|
+
export { UploadGraphic };
|
|
8
|
+
//# sourceMappingURL=UploadGraphic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UploadGraphic.js","sources":["../../../src/components/UploadFile/UploadGraphic.tsx"],"sourcesContent":["import React from 'react';\n\nexport const UploadGraphic = () => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"56\" height=\"56\" fill=\"none\" role=\"presentation\">\n <path\n fill=\"#fff\"\n d=\"M0 28C0 12.536 12.536 0 28 0s28 12.536 28 28-12.536 28-28 28S0 43.464 0 28\"\n />\n <path\n fill=\"#37424D\"\n d=\"M22.5 36c-1.517 0-2.812-.525-3.887-1.575-1.075-1.05-1.613-2.333-1.613-3.85 0-1.3.392-2.458 1.175-3.475s1.808-1.667 3.075-1.95c.417-1.533 1.25-2.775 2.5-3.725C25 20.475 26.417 20 28 20c1.95 0 3.604.68 4.962 2.038C34.322 23.396 35 25.05 35 27c1.15.133 2.104.63 2.862 1.488A4.407 4.407 0 0 1 39 31.5c0 1.25-.437 2.313-1.312 3.188C36.812 35.562 35.75 36 34.5 36H29c-.55 0-1.02-.196-1.413-.587A1.926 1.926 0 0 1 27 34v-5.15l-1.6 1.55L24 29l4-4 4 4-1.4 1.4-1.6-1.55V34h5.5c.7 0 1.292-.242 1.775-.725.483-.483.725-1.075.725-1.775s-.242-1.292-.725-1.775C35.792 29.242 35.2 29 34.5 29H33v-2c0-1.383-.487-2.562-1.462-3.538C30.562 22.489 29.383 22 28 22s-2.562.488-3.538 1.462C23.489 24.438 23 25.618 23 27h-.5c-.967 0-1.792.342-2.475 1.025A3.372 3.372 0 0 0 19 30.5c0 .967.342 1.792 1.025 2.475A3.372 3.372 0 0 0 22.5 34H25v2z\"\n />\n </svg>\n);\n"],"names":["React"],"mappings":";;AAEa,MAAA,aAAa,GAAG,OAC3BA,cAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,KAAK,EAAC,4BAA4B,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,cAAc,EAAA;AAC5F,IAAAA,cAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EACE,IAAI,EAAC,MAAM,EACX,CAAC,EAAC,4EAA4E,EAC9E,CAAA;IACFA,cACE,CAAA,aAAA,CAAA,MAAA,EAAA,EAAA,IAAI,EAAC,SAAS,EACd,CAAC,EAAC,kzBAAkzB,EAAA,CACpzB,CACE;;;;"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var
|
|
4
|
+
var UploadGraphic = require('../../UploadGraphic.cjs');
|
|
5
5
|
var sizes = require('../../../../theme/modules/sizes.cjs');
|
|
6
|
+
var Stack = require('../../../Stack/Stack.cjs');
|
|
7
|
+
require('../../../Stack/types.cjs');
|
|
6
8
|
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(Stack.Stack, { alignX: "center", alignY: "center", spacing: "sm", style: { pointerEvents: 'none' } },
|
|
15
|
+
React__default.default.createElement(UploadGraphic.UploadGraphic, null),
|
|
16
|
+
React__default.default.createElement(Text.Text, { variant: "subheadingSmall", style: { paddingTop: sizes.sizes.sm } }, "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 { UploadGraphic } from '../../UploadGraphic';\nimport { sizes } from '../../../../theme/modules/sizes';\nimport { Stack } from '../../../Stack';\nimport { Text } from '../../../Text';\n\nexport const UploadCopy = () => (\n <Stack alignX=\"center\" alignY=\"center\" spacing=\"sm\" style={{ pointerEvents: 'none' }}>\n <UploadGraphic />\n <Text variant=\"subheadingSmall\" style={{ paddingTop: sizes.sm }}>\n Browse files or drag them here\n </Text>\n </Stack>\n);\n"],"names":["React","Stack","UploadGraphic","Text","sizes"],"mappings":";;;;;;;;;;;;;AAMO,MAAM,UAAU,GAAG,OACxBA,sBAAC,CAAA,aAAA,CAAAC,WAAK,EAAC,EAAA,MAAM,EAAC,QAAQ,EAAC,MAAM,EAAC,QAAQ,EAAC,OAAO,EAAC,IAAI,EAAC,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,EAAA;AAClF,IAAAD,sBAAA,CAAA,aAAA,CAACE,2BAAa,EAAG,IAAA,CAAA;AACjB,IAAAF,sBAAA,CAAA,aAAA,CAACG,SAAI,EAAC,EAAA,OAAO,EAAC,iBAAiB,EAAC,KAAK,EAAE,EAAE,UAAU,EAAEC,WAAK,CAAC,EAAE,EAAE,EAExD,EAAA,gCAAA,CAAA,CACD;;;;"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { UploadGraphic } from '../../UploadGraphic.js';
|
|
3
3
|
import { sizes } from '../../../../theme/modules/sizes.js';
|
|
4
|
+
import { Stack } from '../../../Stack/Stack.js';
|
|
5
|
+
import '../../../Stack/types.js';
|
|
4
6
|
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(Stack, { alignX: "center", alignY: "center", spacing: "sm", style: { pointerEvents: 'none' } },
|
|
9
|
+
React__default.createElement(UploadGraphic, null),
|
|
10
|
+
React__default.createElement(Text, { variant: "subheadingSmall", style: { paddingTop: sizes.sm } }, "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 { UploadGraphic } from '../../UploadGraphic';\nimport { sizes } from '../../../../theme/modules/sizes';\nimport { Stack } from '../../../Stack';\nimport { Text } from '../../../Text';\n\nexport const UploadCopy = () => (\n <Stack alignX=\"center\" alignY=\"center\" spacing=\"sm\" style={{ pointerEvents: 'none' }}>\n <UploadGraphic />\n <Text variant=\"subheadingSmall\" style={{ paddingTop: sizes.sm }}>\n Browse files or drag them here\n </Text>\n </Stack>\n);\n"],"names":["React"],"mappings":";;;;;;;AAMO,MAAM,UAAU,GAAG,OACxBA,cAAC,CAAA,aAAA,CAAA,KAAK,EAAC,EAAA,MAAM,EAAC,QAAQ,EAAC,MAAM,EAAC,QAAQ,EAAC,OAAO,EAAC,IAAI,EAAC,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,EAAA;AAClF,IAAAA,cAAA,CAAA,aAAA,CAAC,aAAa,EAAG,IAAA,CAAA;AACjB,IAAAA,cAAA,CAAA,aAAA,CAAC,IAAI,EAAC,EAAA,OAAO,EAAC,iBAAiB,EAAC,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE,EAExD,EAAA,gCAAA,CAAA,CACD;;;;"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var styled = require('../../../../hoc/withLabels/styled.cjs');
|
|
5
|
+
var CriticalIcon = require('../../../../icons/design-system/components/CriticalIcon.cjs');
|
|
6
|
+
var index = require('../../../../theme/index.cjs');
|
|
7
|
+
var FlexRow = require('../../../Flex/FlexRow/FlexRow.cjs');
|
|
8
|
+
var FlexCol = require('../../../Flex/FlexCol/FlexCol.cjs');
|
|
9
|
+
|
|
10
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
11
|
+
|
|
12
|
+
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
13
|
+
|
|
14
|
+
const UploadFileErrors = ({ acceptedTypesCopy, maxSizeCopy }) => {
|
|
15
|
+
if (!acceptedTypesCopy && !maxSizeCopy)
|
|
16
|
+
return null;
|
|
17
|
+
return (React__default.default.createElement(FlexRow.FlexRow, { alignItems: "baseline" },
|
|
18
|
+
React__default.default.createElement(CriticalIcon.ReactComponent, { width: 16, height: 16, color: index.theme.colors.secondary.red.base }),
|
|
19
|
+
React__default.default.createElement(FlexCol.FlexCol, null,
|
|
20
|
+
acceptedTypesCopy && React__default.default.createElement(styled.Error, null,
|
|
21
|
+
"Invalid format (",
|
|
22
|
+
acceptedTypesCopy,
|
|
23
|
+
")"),
|
|
24
|
+
maxSizeCopy && React__default.default.createElement(styled.Error, null,
|
|
25
|
+
"File is too big (",
|
|
26
|
+
maxSizeCopy,
|
|
27
|
+
")"))));
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
exports.UploadFileErrors = UploadFileErrors;
|
|
31
|
+
//# sourceMappingURL=UploadFileErrors.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UploadFileErrors.cjs","sources":["../../../../../src/components/UploadFile/components/UploadFileErrors/UploadFileErrors.tsx"],"sourcesContent":["import React from 'react';\nimport { Error } from '../../../../hoc/withLabels/styled';\nimport { CriticalIcon } from '../../../../icons';\nimport { theme } from '../../../../theme';\nimport { FlexRow } from '../../../Flex/FlexRow';\nimport { FlexCol } from '../../../Flex/FlexCol';\n\ntype UploadFileErrorsProps = {\n acceptedTypesCopy?: string;\n maxSizeCopy?: string;\n};\n\nexport const UploadFileErrors = ({ acceptedTypesCopy, maxSizeCopy }: UploadFileErrorsProps) => {\n if (!acceptedTypesCopy && !maxSizeCopy) return null;\n\n return (\n <FlexRow alignItems=\"baseline\">\n <CriticalIcon width={16} height={16} color={theme.colors.secondary.red.base} />\n <FlexCol>\n {acceptedTypesCopy && <Error>Invalid format ({acceptedTypesCopy})</Error>}\n {maxSizeCopy && <Error>File is too big ({maxSizeCopy})</Error>}\n </FlexCol>\n </FlexRow>\n );\n};\n"],"names":["React","FlexRow","CriticalIcon","theme","FlexCol","Error"],"mappings":";;;;;;;;;;;;;AAYa,MAAA,gBAAgB,GAAG,CAAC,EAAE,iBAAiB,EAAE,WAAW,EAAyB,KAAI;AAC5F,IAAA,IAAI,CAAC,iBAAiB,IAAI,CAAC,WAAW;AAAE,QAAA,OAAO,IAAI;AAEnD,IAAA,QACEA,sBAAC,CAAA,aAAA,CAAAC,eAAO,EAAC,EAAA,UAAU,EAAC,UAAU,EAAA;QAC5BD,sBAAC,CAAA,aAAA,CAAAE,2BAAY,IAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAEC,WAAK,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAI,CAAA;AAC/E,QAAAH,sBAAA,CAAA,aAAA,CAACI,eAAO,EAAA,IAAA;YACL,iBAAiB,IAAIJ,qCAACK,YAAK,EAAA,IAAA;;gBAAkB,iBAAiB;AAAU,gBAAA,GAAA,CAAA;YACxE,WAAW,IAAIL,qCAACK,YAAK,EAAA,IAAA;;gBAAmB,WAAW;oBAAU,CACtD,CACF;AAEd;;;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { Error } from '../../../../hoc/withLabels/styled.js';
|
|
3
|
+
import { ReactComponent as CriticalIcon } from '../../../../icons/design-system/components/CriticalIcon.js';
|
|
4
|
+
import { theme } from '../../../../theme/index.js';
|
|
5
|
+
import { FlexRow } from '../../../Flex/FlexRow/FlexRow.js';
|
|
6
|
+
import { FlexCol } from '../../../Flex/FlexCol/FlexCol.js';
|
|
7
|
+
|
|
8
|
+
const UploadFileErrors = ({ acceptedTypesCopy, maxSizeCopy }) => {
|
|
9
|
+
if (!acceptedTypesCopy && !maxSizeCopy)
|
|
10
|
+
return null;
|
|
11
|
+
return (React__default.createElement(FlexRow, { alignItems: "baseline" },
|
|
12
|
+
React__default.createElement(CriticalIcon, { width: 16, height: 16, color: theme.colors.secondary.red.base }),
|
|
13
|
+
React__default.createElement(FlexCol, null,
|
|
14
|
+
acceptedTypesCopy && React__default.createElement(Error, null,
|
|
15
|
+
"Invalid format (",
|
|
16
|
+
acceptedTypesCopy,
|
|
17
|
+
")"),
|
|
18
|
+
maxSizeCopy && React__default.createElement(Error, null,
|
|
19
|
+
"File is too big (",
|
|
20
|
+
maxSizeCopy,
|
|
21
|
+
")"))));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { UploadFileErrors };
|
|
25
|
+
//# sourceMappingURL=UploadFileErrors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UploadFileErrors.js","sources":["../../../../../src/components/UploadFile/components/UploadFileErrors/UploadFileErrors.tsx"],"sourcesContent":["import React from 'react';\nimport { Error } from '../../../../hoc/withLabels/styled';\nimport { CriticalIcon } from '../../../../icons';\nimport { theme } from '../../../../theme';\nimport { FlexRow } from '../../../Flex/FlexRow';\nimport { FlexCol } from '../../../Flex/FlexCol';\n\ntype UploadFileErrorsProps = {\n acceptedTypesCopy?: string;\n maxSizeCopy?: string;\n};\n\nexport const UploadFileErrors = ({ acceptedTypesCopy, maxSizeCopy }: UploadFileErrorsProps) => {\n if (!acceptedTypesCopy && !maxSizeCopy) return null;\n\n return (\n <FlexRow alignItems=\"baseline\">\n <CriticalIcon width={16} height={16} color={theme.colors.secondary.red.base} />\n <FlexCol>\n {acceptedTypesCopy && <Error>Invalid format ({acceptedTypesCopy})</Error>}\n {maxSizeCopy && <Error>File is too big ({maxSizeCopy})</Error>}\n </FlexCol>\n </FlexRow>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;AAYa,MAAA,gBAAgB,GAAG,CAAC,EAAE,iBAAiB,EAAE,WAAW,EAAyB,KAAI;AAC5F,IAAA,IAAI,CAAC,iBAAiB,IAAI,CAAC,WAAW;AAAE,QAAA,OAAO,IAAI;AAEnD,IAAA,QACEA,cAAC,CAAA,aAAA,CAAA,OAAO,EAAC,EAAA,UAAU,EAAC,UAAU,EAAA;QAC5BA,cAAC,CAAA,aAAA,CAAA,YAAY,IAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,EAAI,CAAA;AAC/E,QAAAA,cAAA,CAAA,aAAA,CAAC,OAAO,EAAA,IAAA;YACL,iBAAiB,IAAIA,6BAAC,KAAK,EAAA,IAAA;;gBAAkB,iBAAiB;AAAU,gBAAA,GAAA,CAAA;YACxE,WAAW,IAAIA,6BAAC,KAAK,EAAA,IAAA;;gBAAmB,WAAW;oBAAU,CACtD,CACF;AAEd;;;;"}
|
|
@@ -1,67 +1,20 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
-
var index = require('../../../../theme/index.cjs');
|
|
5
4
|
var Button = require('../../../Button/Button.cjs');
|
|
6
|
-
var CriticalIcon = require('../../../../icons/design-system/components/CriticalIcon.cjs');
|
|
7
5
|
var CrossIcon = require('../../../../icons/design-system/components/CrossIcon.cjs');
|
|
8
|
-
var
|
|
9
|
-
var Image = require('../../../Image/Image.cjs');
|
|
10
|
-
var FlexCol = require('../../../Flex/FlexCol/FlexCol.cjs');
|
|
11
|
-
var getFileSizeString = require('../../utils/getFileSizeString/getFileSizeString.cjs');
|
|
12
|
-
var FlexRow = require('../../../Flex/FlexRow/FlexRow.cjs');
|
|
13
|
-
var styled = require('../../../../hoc/withLabels/styled.cjs');
|
|
14
|
-
var usePreviewImage = require('../../hooks/usePreviewImage/usePreviewImage.cjs');
|
|
15
|
-
var UploadedFile_module = require('./UploadedFile.module.scss.cjs');
|
|
16
|
-
var useFileErrorMessages = require('../../hooks/useFileErrorMessages/useFileErrorMessages.cjs');
|
|
6
|
+
var styled = require('./styled.cjs');
|
|
17
7
|
|
|
18
8
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
19
9
|
|
|
20
10
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
21
11
|
|
|
22
|
-
const UploadedFile = ({ file,
|
|
23
|
-
const { previewSrc, shouldShowPreview } = usePreviewImage.usePreviewImage({ file });
|
|
24
|
-
const { errorMessages, hasCriticalErrors } = useFileErrorMessages.useFileErrorMessages({
|
|
25
|
-
file,
|
|
26
|
-
maxBytes,
|
|
27
|
-
fileTypes,
|
|
28
|
-
format,
|
|
29
|
-
});
|
|
30
|
-
const fileSizeCopy = getFileSizeString.getFileSizeString({ maxBytes: (file === null || file === undefined ? undefined : file.size) || 0, format, baseString: '' });
|
|
12
|
+
const UploadedFile = ({ file, resetSelection, disabled }) => {
|
|
31
13
|
if (!file)
|
|
32
14
|
return null;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
React__default.default.createElement(
|
|
36
|
-
React__default.default.createElement(FlexCol.FlexCol, { style: { flex: 1, minWidth: 0 } },
|
|
37
|
-
React__default.default.createElement(styled.Error, { className: UploadedFile_module.singleLineTextWithoutFlex }, errorMessages.criticalErrors.map((error, index, array) => {
|
|
38
|
-
const isNotLast = !!(array.length > index + 1);
|
|
39
|
-
return `${error.errorMessage}${isNotLast ? ', ' : ''}`;
|
|
40
|
-
})))));
|
|
41
|
-
if (!shouldShowPreview) {
|
|
42
|
-
return (React__default.default.createElement("div", { className: hasCriticalErrors
|
|
43
|
-
? UploadedFile_module.uploadedFileContainerCriticalError
|
|
44
|
-
: UploadedFile_module.uploadedFileContainer },
|
|
45
|
-
React__default.default.createElement(FlexRow.FlexRow, { justifyContent: "space-between", alignItems: "flex-start" },
|
|
46
|
-
React__default.default.createElement(FlexRow.FlexRow, { alignItems: "flex-start", style: { flex: 1, minWidth: 0 }, justifyContent: "space-between", flexWrap: "nowrap" },
|
|
47
|
-
React__default.default.createElement(Text.Text, { className: UploadedFile_module.singleLineText, variant: "body" }, file.name),
|
|
48
|
-
React__default.default.createElement(Text.Text, { variant: "body", className: UploadedFile_module.fileSizeText, style: { color: index.theme.colors.neutral.ink.light } }, fileSizeCopy)),
|
|
49
|
-
RemoveButton),
|
|
50
|
-
ErrorMessages));
|
|
51
|
-
}
|
|
52
|
-
return (React__default.default.createElement("div", { className: hasCriticalErrors
|
|
53
|
-
? UploadedFile_module.uploadedFileContainerCriticalError
|
|
54
|
-
: UploadedFile_module.uploadedFileContainer },
|
|
55
|
-
React__default.default.createElement(FlexRow.FlexRow, { justifyContent: "space-between", alignItems: "flex-start" },
|
|
56
|
-
React__default.default.createElement(FlexRow.FlexRow, { alignItems: "center", style: { flex: 1, minWidth: 0 }, flexWrap: "nowrap" },
|
|
57
|
-
React__default.default.createElement(Image.Image, { className: UploadedFile_module.previewImage, height: "44", width: "44", src: previewSrc }),
|
|
58
|
-
React__default.default.createElement(FlexCol.FlexCol, { gap: "xs", style: { flex: 1, minWidth: 0, marginLeft: '8px' } },
|
|
59
|
-
React__default.default.createElement(Text.Text, { className: UploadedFile_module.singleLineTextWithoutFlex, variant: "body" }, file === null || file === undefined ? undefined : file.name),
|
|
60
|
-
React__default.default.createElement(Text.Text, { variant: "body", className: UploadedFile_module.singleLineTextWithoutFlex, style: {
|
|
61
|
-
color: index.theme.colors.neutral.ink.light,
|
|
62
|
-
} }, fileSizeCopy))),
|
|
63
|
-
RemoveButton),
|
|
64
|
-
ErrorMessages));
|
|
15
|
+
return (React__default.default.createElement(styled.UploadedFilesListStack, { alignX: "between", direction: "horizontal", alignY: "center" },
|
|
16
|
+
React__default.default.createElement(styled.SingleLineText, { variant: "body" }, file === null || file === undefined ? undefined : file.name),
|
|
17
|
+
React__default.default.createElement(Button.Button, { size: "sm", variant: "flat", onClick: resetSelection, iconSlot: React__default.default.createElement(CrossIcon.ReactComponent, null), "aria-label": "Remove file", disabled: disabled })));
|
|
65
18
|
};
|
|
66
19
|
|
|
67
20
|
exports.UploadedFile = UploadedFile;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadedFile.cjs","sources":["../../../../../src/components/UploadFile/components/UploadedFile/UploadedFile.tsx"],"sourcesContent":["import React from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"UploadedFile.cjs","sources":["../../../../../src/components/UploadFile/components/UploadedFile/UploadedFile.tsx"],"sourcesContent":["import React from 'react';\nimport { Button } from '../../../Button';\nimport { CrossIcon } from '../../../../icons';\nimport { SingleLineText, UploadedFilesListStack } from './styled';\n\ntype UploadedFileProps = {\n file?: File;\n resetSelection: () => void;\n disabled?: boolean;\n};\n\nexport const UploadedFile = ({ file, resetSelection, disabled }: UploadedFileProps) => {\n if (!file) return null;\n\n return (\n <UploadedFilesListStack alignX=\"between\" direction=\"horizontal\" alignY=\"center\">\n <SingleLineText variant=\"body\">{file?.name}</SingleLineText>\n <Button\n size=\"sm\"\n variant=\"flat\"\n onClick={resetSelection}\n iconSlot={<CrossIcon />}\n aria-label=\"Remove file\"\n disabled={disabled}\n />\n </UploadedFilesListStack>\n );\n};\n"],"names":["React","UploadedFilesListStack","SingleLineText","Button","CrossIcon"],"mappings":";;;;;;;;;;;AAWO,MAAM,YAAY,GAAG,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAqB,KAAI;AACpF,IAAA,IAAI,CAAC,IAAI;AAAE,QAAA,OAAO,IAAI;AAEtB,IAAA,QACEA,sBAAA,CAAA,aAAA,CAACC,6BAAsB,EAAA,EAAC,MAAM,EAAC,SAAS,EAAC,SAAS,EAAC,YAAY,EAAC,MAAM,EAAC,QAAQ,EAAA;AAC7E,QAAAD,sBAAA,CAAA,aAAA,CAACE,qBAAc,EAAA,EAAC,OAAO,EAAC,MAAM,EAAA,EAAE,IAAI,KAAA,IAAA,IAAJ,IAAI,KAAA,SAAA,GAAA,SAAA,GAAJ,IAAI,CAAE,IAAI,CAAkB;AAC5D,QAAAF,sBAAA,CAAA,aAAA,CAACG,aAAM,EAAA,EACL,IAAI,EAAC,IAAI,EACT,OAAO,EAAC,MAAM,EACd,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAEH,sBAAC,CAAA,aAAA,CAAAI,wBAAS,EAAG,IAAA,CAAA,EAAA,YAAA,EACZ,aAAa,EACxB,QAAQ,EAAE,QAAQ,EAAA,CAClB,CACqB;AAE7B;;;;"}
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { AcceptedFileTypes, FileSizeUnit } from '../../constants';
|
|
3
2
|
type UploadedFileProps = {
|
|
4
|
-
file?: File
|
|
5
|
-
|
|
3
|
+
file?: File;
|
|
4
|
+
resetSelection: () => void;
|
|
6
5
|
disabled?: boolean;
|
|
7
|
-
format: FileSizeUnit;
|
|
8
|
-
maxBytes: number;
|
|
9
|
-
fileTypes: Array<AcceptedFileTypes>;
|
|
10
6
|
};
|
|
11
|
-
export declare const UploadedFile: ({ file,
|
|
7
|
+
export declare const UploadedFile: ({ file, resetSelection, disabled }: UploadedFileProps) => React.JSX.Element | null;
|
|
12
8
|
export {};
|
|
@@ -1,61 +1,14 @@
|
|
|
1
1
|
import React__default from 'react';
|
|
2
|
-
import { theme } from '../../../../theme/index.js';
|
|
3
2
|
import { Button } from '../../../Button/Button.js';
|
|
4
|
-
import { ReactComponent as CriticalIcon } from '../../../../icons/design-system/components/CriticalIcon.js';
|
|
5
3
|
import { ReactComponent as CrossIcon } from '../../../../icons/design-system/components/CrossIcon.js';
|
|
6
|
-
import {
|
|
7
|
-
import { Image } from '../../../Image/Image.js';
|
|
8
|
-
import { FlexCol } from '../../../Flex/FlexCol/FlexCol.js';
|
|
9
|
-
import { getFileSizeString } from '../../utils/getFileSizeString/getFileSizeString.js';
|
|
10
|
-
import { FlexRow } from '../../../Flex/FlexRow/FlexRow.js';
|
|
11
|
-
import { Error } from '../../../../hoc/withLabels/styled.js';
|
|
12
|
-
import { usePreviewImage } from '../../hooks/usePreviewImage/usePreviewImage.js';
|
|
13
|
-
import uploadFileStyles from './UploadedFile.module.scss.js';
|
|
14
|
-
import { useFileErrorMessages } from '../../hooks/useFileErrorMessages/useFileErrorMessages.js';
|
|
4
|
+
import { UploadedFilesListStack, SingleLineText } from './styled.js';
|
|
15
5
|
|
|
16
|
-
const UploadedFile = ({ file,
|
|
17
|
-
const { previewSrc, shouldShowPreview } = usePreviewImage({ file });
|
|
18
|
-
const { errorMessages, hasCriticalErrors } = useFileErrorMessages({
|
|
19
|
-
file,
|
|
20
|
-
maxBytes,
|
|
21
|
-
fileTypes,
|
|
22
|
-
format,
|
|
23
|
-
});
|
|
24
|
-
const fileSizeCopy = getFileSizeString({ maxBytes: (file === null || file === undefined ? undefined : file.size) || 0, format, baseString: '' });
|
|
6
|
+
const UploadedFile = ({ file, resetSelection, disabled }) => {
|
|
25
7
|
if (!file)
|
|
26
8
|
return null;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
React__default.createElement(
|
|
30
|
-
React__default.createElement(FlexCol, { style: { flex: 1, minWidth: 0 } },
|
|
31
|
-
React__default.createElement(Error, { className: uploadFileStyles.singleLineTextWithoutFlex }, errorMessages.criticalErrors.map((error, index, array) => {
|
|
32
|
-
const isNotLast = !!(array.length > index + 1);
|
|
33
|
-
return `${error.errorMessage}${isNotLast ? ', ' : ''}`;
|
|
34
|
-
})))));
|
|
35
|
-
if (!shouldShowPreview) {
|
|
36
|
-
return (React__default.createElement("div", { className: hasCriticalErrors
|
|
37
|
-
? uploadFileStyles.uploadedFileContainerCriticalError
|
|
38
|
-
: uploadFileStyles.uploadedFileContainer },
|
|
39
|
-
React__default.createElement(FlexRow, { justifyContent: "space-between", alignItems: "flex-start" },
|
|
40
|
-
React__default.createElement(FlexRow, { alignItems: "flex-start", style: { flex: 1, minWidth: 0 }, justifyContent: "space-between", flexWrap: "nowrap" },
|
|
41
|
-
React__default.createElement(Text, { className: uploadFileStyles.singleLineText, variant: "body" }, file.name),
|
|
42
|
-
React__default.createElement(Text, { variant: "body", className: uploadFileStyles.fileSizeText, style: { color: theme.colors.neutral.ink.light } }, fileSizeCopy)),
|
|
43
|
-
RemoveButton),
|
|
44
|
-
ErrorMessages));
|
|
45
|
-
}
|
|
46
|
-
return (React__default.createElement("div", { className: hasCriticalErrors
|
|
47
|
-
? uploadFileStyles.uploadedFileContainerCriticalError
|
|
48
|
-
: uploadFileStyles.uploadedFileContainer },
|
|
49
|
-
React__default.createElement(FlexRow, { justifyContent: "space-between", alignItems: "flex-start" },
|
|
50
|
-
React__default.createElement(FlexRow, { alignItems: "center", style: { flex: 1, minWidth: 0 }, flexWrap: "nowrap" },
|
|
51
|
-
React__default.createElement(Image, { className: uploadFileStyles.previewImage, height: "44", width: "44", src: previewSrc }),
|
|
52
|
-
React__default.createElement(FlexCol, { gap: "xs", style: { flex: 1, minWidth: 0, marginLeft: '8px' } },
|
|
53
|
-
React__default.createElement(Text, { className: uploadFileStyles.singleLineTextWithoutFlex, variant: "body" }, file === null || file === undefined ? undefined : file.name),
|
|
54
|
-
React__default.createElement(Text, { variant: "body", className: uploadFileStyles.singleLineTextWithoutFlex, style: {
|
|
55
|
-
color: theme.colors.neutral.ink.light,
|
|
56
|
-
} }, fileSizeCopy))),
|
|
57
|
-
RemoveButton),
|
|
58
|
-
ErrorMessages));
|
|
9
|
+
return (React__default.createElement(UploadedFilesListStack, { alignX: "between", direction: "horizontal", alignY: "center" },
|
|
10
|
+
React__default.createElement(SingleLineText, { variant: "body" }, file === null || file === undefined ? undefined : file.name),
|
|
11
|
+
React__default.createElement(Button, { size: "sm", variant: "flat", onClick: resetSelection, iconSlot: React__default.createElement(CrossIcon, null), "aria-label": "Remove file", disabled: disabled })));
|
|
59
12
|
};
|
|
60
13
|
|
|
61
14
|
export { UploadedFile };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadedFile.js","sources":["../../../../../src/components/UploadFile/components/UploadedFile/UploadedFile.tsx"],"sourcesContent":["import React from 'react';\nimport {
|
|
1
|
+
{"version":3,"file":"UploadedFile.js","sources":["../../../../../src/components/UploadFile/components/UploadedFile/UploadedFile.tsx"],"sourcesContent":["import React from 'react';\nimport { Button } from '../../../Button';\nimport { CrossIcon } from '../../../../icons';\nimport { SingleLineText, UploadedFilesListStack } from './styled';\n\ntype UploadedFileProps = {\n file?: File;\n resetSelection: () => void;\n disabled?: boolean;\n};\n\nexport const UploadedFile = ({ file, resetSelection, disabled }: UploadedFileProps) => {\n if (!file) return null;\n\n return (\n <UploadedFilesListStack alignX=\"between\" direction=\"horizontal\" alignY=\"center\">\n <SingleLineText variant=\"body\">{file?.name}</SingleLineText>\n <Button\n size=\"sm\"\n variant=\"flat\"\n onClick={resetSelection}\n iconSlot={<CrossIcon />}\n aria-label=\"Remove file\"\n disabled={disabled}\n />\n </UploadedFilesListStack>\n );\n};\n"],"names":["React"],"mappings":";;;;;AAWO,MAAM,YAAY,GAAG,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,QAAQ,EAAqB,KAAI;AACpF,IAAA,IAAI,CAAC,IAAI;AAAE,QAAA,OAAO,IAAI;AAEtB,IAAA,QACEA,cAAA,CAAA,aAAA,CAAC,sBAAsB,EAAA,EAAC,MAAM,EAAC,SAAS,EAAC,SAAS,EAAC,YAAY,EAAC,MAAM,EAAC,QAAQ,EAAA;AAC7E,QAAAA,cAAA,CAAA,aAAA,CAAC,cAAc,EAAA,EAAC,OAAO,EAAC,MAAM,EAAA,EAAE,IAAI,KAAA,IAAA,IAAJ,IAAI,KAAA,SAAA,GAAA,SAAA,GAAJ,IAAI,CAAE,IAAI,CAAkB;AAC5D,QAAAA,cAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EACL,IAAI,EAAC,IAAI,EACT,OAAO,EAAC,MAAM,EACd,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAEA,cAAC,CAAA,aAAA,CAAA,SAAS,EAAG,IAAA,CAAA,EAAA,YAAA,EACZ,aAAa,EACxB,QAAQ,EAAE,QAAQ,EAAA,CAClB,CACqB;AAE7B;;;;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var styled = require('styled-components');
|
|
4
|
+
var Text = require('../../../Text/Text.cjs');
|
|
5
|
+
var colors = require('../../../../theme/modules/colors.cjs');
|
|
6
|
+
var radius = require('../../../../theme/modules/radius.cjs');
|
|
7
|
+
var sizes = require('../../../../theme/modules/sizes.cjs');
|
|
8
|
+
var Stack = require('../../../Stack/Stack.cjs');
|
|
9
|
+
require('../../../Stack/types.cjs');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
12
|
+
|
|
13
|
+
var styled__default = /*#__PURE__*/_interopDefaultCompat(styled);
|
|
14
|
+
|
|
15
|
+
const SingleLineText = styled__default.default(Text.Text).withConfig({ displayName: "vui--SingleLineText", componentId: "vui--1aguyhc" }) `display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;overflow:hidden;`;
|
|
16
|
+
const UploadedFilesListStack = styled__default.default(Stack.Stack).withConfig({ displayName: "vui--UploadedFilesListStack", componentId: "vui--1g0ca18" }) `border:1px solid ${colors.colors.neutral.ink.lightest};border-radius:${radius.radius.base};padding:${sizes.sizes.xs};${Text.Text}{padding-left:${sizes.sizes.xs};}`;
|
|
17
|
+
|
|
18
|
+
exports.SingleLineText = SingleLineText;
|
|
19
|
+
exports.UploadedFilesListStack = UploadedFilesListStack;
|
|
20
|
+
//# sourceMappingURL=styled.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styled.cjs","sources":["../../../../../src/components/UploadFile/components/UploadedFile/styled.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { Text } from '../../../Text';\nimport { colors } from '../../../../theme/modules/colors';\nimport { radius } from '../../../../theme/modules/radius';\nimport { sizes } from '../../../../theme/modules/sizes';\nimport { Stack } from '../../../Stack';\n\nexport const SingleLineText = styled(Text)`\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n overflow: hidden;\n`;\n\nexport const UploadedFilesListStack = styled(Stack)`\n border: 1px solid ${colors.neutral.ink.lightest};\n border-radius: ${radius.base};\n padding: ${sizes.xs};\n\n ${Text} {\n padding-left: ${sizes.xs};\n }\n`;\n"],"names":["styled","Text","Stack","colors","radius","sizes"],"mappings":";;;;;;;;;;;;;;MAOa,cAAc,GAAGA,uBAAM,CAACC,SAAI,CAAC,CAAA,UAAA,CAAA,EAAA,WAAA,EAAA,qBAAA,EAAA,WAAA,EAAA,cAAA,EAAA,CAAA,CAAA,CAAA,qFAAA;AAOnC,MAAM,sBAAsB,GAAGD,uBAAM,CAACE,WAAK,CAAC,CAC7B,UAAA,CAAA,EAAA,WAAA,EAAA,6BAAA,EAAA,WAAA,EAAA,cAAA,EAAA,CAAA,CAAA,CAAA,iBAAA,EAAAC,aAAM,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAA,eAAA,EAC9BC,aAAM,CAAC,IAAI,CAAA,SAAA,EACjBC,WAAK,CAAC,EAAE,CAEjB,CAAA,EAAAJ,SAAI,CACY,cAAA,EAAAI,WAAK,CAAC,EAAE;;;;;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const SingleLineText: import("styled-components").StyledComponent<"span", any, {} & import("../../../Text/types").TextProps, never>;
|
|
2
|
+
export declare const UploadedFilesListStack: import("styled-components").StyledComponent<"div", any, import("../../../Stack").StackProps, never>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Text } from '../../../Text/Text.js';
|
|
3
|
+
import { colors } from '../../../../theme/modules/colors.js';
|
|
4
|
+
import { radius } from '../../../../theme/modules/radius.js';
|
|
5
|
+
import { sizes } from '../../../../theme/modules/sizes.js';
|
|
6
|
+
import { Stack } from '../../../Stack/Stack.js';
|
|
7
|
+
import '../../../Stack/types.js';
|
|
8
|
+
|
|
9
|
+
const SingleLineText = styled(Text).withConfig({ displayName: "vui--SingleLineText", componentId: "vui--1aguyhc" }) `display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1;overflow:hidden;`;
|
|
10
|
+
const UploadedFilesListStack = styled(Stack).withConfig({ displayName: "vui--UploadedFilesListStack", componentId: "vui--1g0ca18" }) `border:1px solid ${colors.neutral.ink.lightest};border-radius:${radius.base};padding:${sizes.xs};${Text}{padding-left:${sizes.xs};}`;
|
|
11
|
+
|
|
12
|
+
export { SingleLineText, UploadedFilesListStack };
|
|
13
|
+
//# sourceMappingURL=styled.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styled.js","sources":["../../../../../src/components/UploadFile/components/UploadedFile/styled.ts"],"sourcesContent":["import styled from 'styled-components';\nimport { Text } from '../../../Text';\nimport { colors } from '../../../../theme/modules/colors';\nimport { radius } from '../../../../theme/modules/radius';\nimport { sizes } from '../../../../theme/modules/sizes';\nimport { Stack } from '../../../Stack';\n\nexport const SingleLineText = styled(Text)`\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 1;\n overflow: hidden;\n`;\n\nexport const UploadedFilesListStack = styled(Stack)`\n border: 1px solid ${colors.neutral.ink.lightest};\n border-radius: ${radius.base};\n padding: ${sizes.xs};\n\n ${Text} {\n padding-left: ${sizes.xs};\n }\n`;\n"],"names":[],"mappings":";;;;;;;;MAOa,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA,UAAA,CAAA,EAAA,WAAA,EAAA,qBAAA,EAAA,WAAA,EAAA,cAAA,EAAA,CAAA,CAAA,CAAA,qFAAA;AAOnC,MAAM,sBAAsB,GAAG,MAAM,CAAC,KAAK,CAAC,CAC7B,UAAA,CAAA,EAAA,WAAA,EAAA,6BAAA,EAAA,WAAA,EAAA,cAAA,EAAA,CAAA,CAAA,CAAA,iBAAA,EAAA,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAA,eAAA,EAC9B,MAAM,CAAC,IAAI,CAAA,SAAA,EACjB,KAAK,CAAC,EAAE,CAEjB,CAAA,EAAA,IAAI,CACY,cAAA,EAAA,KAAK,CAAC,EAAE;;;;"}
|