@veeqo/ui 12.5.0 → 13.0.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/Alerts/Alert/Alert.cjs +2 -2
- package/dist/components/Alerts/Alert/Alert.cjs.map +1 -1
- package/dist/components/Alerts/Alert/Alert.js +2 -2
- package/dist/components/Alerts/Alert/Alert.js.map +1 -1
- package/dist/components/Flex/FlexCol/FlexCol.d.ts +3 -3
- package/dist/components/Flex/FlexRow/FlexRow.d.ts +3 -3
- package/dist/components/Flex/types.d.ts +13 -4
- package/dist/components/Pagination/styled.d.ts +3 -3
- 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/ViewsContainer/ViewsContainer.cjs +4 -3
- package/dist/components/ViewsContainer/ViewsContainer.cjs.map +1 -1
- package/dist/components/ViewsContainer/ViewsContainer.js +4 -3
- package/dist/components/ViewsContainer/ViewsContainer.js.map +1 -1
- package/dist/components/ViewsContainer/ViewsContainer.module.scss.cjs +2 -2
- package/dist/components/ViewsContainer/ViewsContainer.module.scss.cjs.map +1 -1
- package/dist/components/ViewsContainer/ViewsContainer.module.scss.js +2 -2
- package/dist/components/ViewsContainer/ViewsContainer.module.scss.js.map +1 -1
- package/dist/components/index.d.ts +3 -1
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -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,72 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { theme } from '../../theme/index.js';
|
|
3
|
+
import { Button } from '../Button/Button.js';
|
|
4
|
+
import { ReactComponent as CriticalIcon } from '../../icons/design-system/components/CriticalIcon.js';
|
|
5
|
+
import { ReactComponent as CrossIcon } from '../../icons/design-system/components/CrossIcon.js';
|
|
6
|
+
import { Text } from '../Text/Text.js';
|
|
7
|
+
import { Image } from '../Image/Image.js';
|
|
8
|
+
import { FlexCol } from '../Flex/FlexCol/FlexCol.js';
|
|
9
|
+
import { FlexRow } from '../Flex/FlexRow/FlexRow.js';
|
|
10
|
+
import { Error } from '../../hoc/withLabels/styled.js';
|
|
11
|
+
import { usePreviewImage } from './hooks/usePreviewImage/usePreviewImage.js';
|
|
12
|
+
import uploadedFileStyles from './UploadedFile.module.scss.js';
|
|
13
|
+
import { useFileErrorMessages } from './hooks/useFileErrorMessages/useFileErrorMessages.js';
|
|
14
|
+
import { getFileSizeString } from '../UploadFile/utils/getFileSizeString/getFileSizeString.js';
|
|
15
|
+
import { Skeleton } from '../Skeleton/Skeleton.js';
|
|
16
|
+
|
|
17
|
+
const UploadedFile = ({ file, onRemoveFile, disabled, format, maxBytes, fileTypes, isLoading, }) => {
|
|
18
|
+
const { previewSrc, shouldShowPreview } = usePreviewImage({ file });
|
|
19
|
+
const { errorMessages, hasCriticalErrors } = useFileErrorMessages({
|
|
20
|
+
file,
|
|
21
|
+
maxBytes,
|
|
22
|
+
fileTypes,
|
|
23
|
+
});
|
|
24
|
+
const fileSizeCopy = getFileSizeString({ maxBytes: (file === null || file === undefined ? undefined : file.size) || 0, format, baseString: '' });
|
|
25
|
+
if (isLoading) {
|
|
26
|
+
return React__default.createElement(Skeleton, { height: "40px", "aria-label": "Loading file" });
|
|
27
|
+
}
|
|
28
|
+
if (!file)
|
|
29
|
+
return null;
|
|
30
|
+
const RemoveButton = (React__default.createElement(Button, { size: "sm", variant: "flat", onClick: () => onRemoveFile && onRemoveFile(file), iconSlot: React__default.createElement(CrossIcon, null), "aria-label": `Remove file ${file.name}`, disabled: disabled }));
|
|
31
|
+
const ErrorMessages = hasCriticalErrors && (React__default.createElement(FlexRow, { alignItems: "flex-start" },
|
|
32
|
+
React__default.createElement(CriticalIcon, { width: theme.sizes.base, height: theme.sizes.base, color: theme.colors.secondary.red.base }),
|
|
33
|
+
React__default.createElement("div", { className: uploadedFileStyles.singleLineWrapper },
|
|
34
|
+
React__default.createElement(Error, { className: uploadedFileStyles.singleLineTextWithoutFlex }, errorMessages.criticalErrors.map((error, index, array) => {
|
|
35
|
+
const isNotLast = !!(array.length > index + 1);
|
|
36
|
+
return `${error.errorMessage}${isNotLast ? ', ' : ''}`;
|
|
37
|
+
})))));
|
|
38
|
+
if (!shouldShowPreview) {
|
|
39
|
+
return (React__default.createElement("div", { className: hasCriticalErrors
|
|
40
|
+
? uploadedFileStyles.uploadedFileContainerCriticalError
|
|
41
|
+
: uploadedFileStyles.uploadedFileContainer },
|
|
42
|
+
React__default.createElement(FlexRow, { justifyContent: "space-between", alignItems: "center" },
|
|
43
|
+
React__default.createElement(FlexCol, { style: { flex: 1, minWidth: 0 } },
|
|
44
|
+
React__default.createElement("div", { className: uploadedFileStyles.standardFileTextWrapper },
|
|
45
|
+
React__default.createElement(Text, { className: uploadedFileStyles.singleLineText, variant: "body", style: {
|
|
46
|
+
minWidth: 0,
|
|
47
|
+
overflow: 'hidden',
|
|
48
|
+
textOverflow: 'ellipsis',
|
|
49
|
+
whiteSpace: 'nowrap',
|
|
50
|
+
} }, file.name),
|
|
51
|
+
React__default.createElement(Text, { variant: "body", className: uploadedFileStyles.fileSizeText, style: { color: theme.colors.neutral.ink.light } }, fileSizeCopy)),
|
|
52
|
+
ErrorMessages),
|
|
53
|
+
onRemoveFile && (React__default.createElement("div", { style: { display: 'flex', alignItems: 'center', marginLeft: 12 } }, RemoveButton)))));
|
|
54
|
+
}
|
|
55
|
+
return (React__default.createElement("div", { className: hasCriticalErrors
|
|
56
|
+
? uploadedFileStyles.uploadedFileContainerCriticalError
|
|
57
|
+
: uploadedFileStyles.uploadedFileContainer },
|
|
58
|
+
React__default.createElement(FlexRow, { style: { flexWrap: 'nowrap' }, justifyContent: "space-between" },
|
|
59
|
+
React__default.createElement(FlexCol, null,
|
|
60
|
+
React__default.createElement(FlexRow, { alignItems: "center", style: { flex: 1, minWidth: 0, gap: theme.sizes.base }, flexWrap: "nowrap" },
|
|
61
|
+
React__default.createElement(Image, { className: uploadedFileStyles.previewImage, height: "44", width: "44", src: previewSrc }),
|
|
62
|
+
React__default.createElement("div", { className: uploadedFileStyles.singleLineWrapper },
|
|
63
|
+
React__default.createElement(Text, { className: uploadedFileStyles.singleLineTextWithoutFlex, variant: "body" }, file === null || file === undefined ? undefined : file.name),
|
|
64
|
+
React__default.createElement(Text, { variant: "body", className: uploadedFileStyles.singleLineTextWithoutFlex, style: {
|
|
65
|
+
color: theme.colors.neutral.ink.light,
|
|
66
|
+
} }, fileSizeCopy))),
|
|
67
|
+
ErrorMessages),
|
|
68
|
+
onRemoveFile && RemoveButton)));
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export { UploadedFile };
|
|
72
|
+
//# sourceMappingURL=UploadedFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UploadedFile.js","sources":["../../../src/components/UploadedFile/UploadedFile.tsx"],"sourcesContent":["import React from 'react';\nimport { theme } from 'Theme';\nimport { Button } from '../Button';\nimport { CriticalIcon, CrossIcon } from '../../icons';\nimport { Text } from '../Text';\nimport { Image } from '../Image';\nimport { FlexCol } from '../Flex/FlexCol';\nimport { FlexRow } from '../Flex/FlexRow';\nimport { Error } from '../../hoc/withLabels/styled';\nimport { usePreviewImage } from './hooks/usePreviewImage';\nimport uploadedFileStyles from './UploadedFile.module.scss';\nimport { useFileErrorMessages } from './hooks/useFileErrorMessages';\nimport { AcceptedFileTypes, FileSizeUnit } from '../UploadFile/constants';\nimport { getFileSizeString } from '../UploadFile/utils';\nimport { Skeleton } from '../Skeleton';\n\nexport type UploadedFileProps = {\n file?: File | null;\n onRemoveFile?: (file: File) => void;\n disabled?: boolean;\n format: FileSizeUnit;\n maxBytes: number;\n fileTypes: Array<AcceptedFileTypes>;\n isLoading?: boolean;\n};\n\nexport const UploadedFile = ({\n file,\n onRemoveFile,\n disabled,\n format,\n maxBytes,\n fileTypes,\n isLoading,\n}: UploadedFileProps) => {\n const { previewSrc, shouldShowPreview } = usePreviewImage({ file });\n\n const { errorMessages, hasCriticalErrors } = useFileErrorMessages({\n file,\n maxBytes,\n fileTypes,\n });\n\n const fileSizeCopy = getFileSizeString({ maxBytes: file?.size || 0, format, baseString: '' });\n\n if (isLoading) {\n return <Skeleton height=\"40px\" aria-label=\"Loading file\" />;\n }\n\n if (!file) return null;\n\n const RemoveButton = (\n <Button\n size=\"sm\"\n variant=\"flat\"\n onClick={() => onRemoveFile && onRemoveFile(file)}\n iconSlot={<CrossIcon />}\n aria-label={`Remove file ${file.name}`}\n disabled={disabled}\n />\n );\n\n const ErrorMessages = hasCriticalErrors && (\n <FlexRow alignItems=\"flex-start\">\n <CriticalIcon\n width={theme.sizes.base}\n height={theme.sizes.base}\n color={theme.colors.secondary.red.base}\n />\n <div className={uploadedFileStyles.singleLineWrapper}>\n <Error className={uploadedFileStyles.singleLineTextWithoutFlex}>\n {errorMessages.criticalErrors.map((error, index, array) => {\n const isNotLast = !!(array.length > index + 1);\n return `${error.errorMessage}${isNotLast ? ', ' : ''}`;\n })}\n </Error>\n </div>\n </FlexRow>\n );\n\n if (!shouldShowPreview) {\n return (\n <div\n className={\n hasCriticalErrors\n ? uploadedFileStyles.uploadedFileContainerCriticalError\n : uploadedFileStyles.uploadedFileContainer\n }\n >\n <FlexRow justifyContent=\"space-between\" alignItems=\"center\">\n <FlexCol style={{ flex: 1, minWidth: 0 }}>\n <div className={uploadedFileStyles.standardFileTextWrapper}>\n <Text\n className={uploadedFileStyles.singleLineText}\n variant=\"body\"\n style={{\n minWidth: 0,\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n }}\n >\n {file.name}\n </Text>\n <Text\n variant=\"body\"\n className={uploadedFileStyles.fileSizeText}\n style={{ color: theme.colors.neutral.ink.light }}\n >\n {fileSizeCopy}\n </Text>\n </div>\n {ErrorMessages}\n </FlexCol>\n {onRemoveFile && (\n <div style={{ display: 'flex', alignItems: 'center', marginLeft: 12 }}>\n {RemoveButton}\n </div>\n )}\n </FlexRow>\n </div>\n );\n }\n\n return (\n <div\n className={\n hasCriticalErrors\n ? uploadedFileStyles.uploadedFileContainerCriticalError\n : uploadedFileStyles.uploadedFileContainer\n }\n >\n <FlexRow style={{ flexWrap: 'nowrap' }} justifyContent=\"space-between\">\n <FlexCol>\n <FlexRow\n alignItems=\"center\"\n style={{ flex: 1, minWidth: 0, gap: theme.sizes.base }}\n flexWrap=\"nowrap\"\n >\n <Image\n className={uploadedFileStyles.previewImage}\n height=\"44\"\n width=\"44\"\n src={previewSrc}\n />\n <div className={uploadedFileStyles.singleLineWrapper}>\n <Text className={uploadedFileStyles.singleLineTextWithoutFlex} variant=\"body\">\n {file?.name}\n </Text>\n <Text\n variant=\"body\"\n className={uploadedFileStyles.singleLineTextWithoutFlex}\n style={{\n color: theme.colors.neutral.ink.light,\n }}\n >\n {fileSizeCopy}\n </Text>\n </div>\n </FlexRow>\n {ErrorMessages}\n </FlexCol>\n {onRemoveFile && RemoveButton}\n </FlexRow>\n </div>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;MA0Ba,YAAY,GAAG,CAAC,EAC3B,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,GACS,KAAI;AACtB,IAAA,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE,GAAG,eAAe,CAAC,EAAE,IAAI,EAAE,CAAC;AAEnE,IAAA,MAAM,EAAE,aAAa,EAAE,iBAAiB,EAAE,GAAG,oBA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CAAC,yBAAyB,EAAE,OAAO,EAAC,MAAM,EAAA,EAC1E,IAAI,KAAJ,IAAA,IAAA,IAAI,6BAAJ,IAAI,CAAE,IAAI,CACN;AACP,wBAAAA,cAAA,CAAA,aAAA,CAAC,IAAI,EAAA,EACH,OAAO,EAAC,MAAM,EACd,SAAS,EAAE,kBAAkB,CAAC,yBAAyB,EACvD,KAAK,EAAE;gCACL,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK;6BACtC,EAEA,EAAA,YAAY,CACR,CACH,CACE;AACT,gBAAA,aAAa,CACN;AACT,YAAA,YAAY,IAAI,YAAY,CACrB,CACN;AAEV;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ___$insertStyle = require('../../_virtual/____insertStyle.cjs');
|
|
4
|
+
|
|
5
|
+
___$insertStyle("._uploadedFileContainer_17uzv_1 {\n border: 1px solid var(--colors-neutral-ink-lightest);\n border-radius: var(--radius-base);\n padding: var(--sizes-3);\n}\n\n._uploadedFileContainerCriticalError_17uzv_7 {\n border: 1px solid var(--colors-secondary-red-base);\n border-radius: var(--radius-base);\n padding: var(--sizes-3);\n}\n\n._singleLineText_17uzv_13 {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex: 0 1 80%;\n min-width: 0;\n}\n\n._singleLineTextWithoutFlex_17uzv_21 {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex: none;\n min-width: 0;\n}\n\n._fileSizeText_17uzv_29 {\n white-space: nowrap;\n flex: 0 0 20%;\n text-align: right;\n}\n\n._previewImage_17uzv_35 img {\n border: 1px solid var(--colors-neutral-ink-lightest);\n border-radius: var(--sizes-xs);\n}\n\n._singleLineWrapper_17uzv_40 {\n display: grid;\n min-width: 0;\n flex: 1;\n}\n\n._standardFileTextWrapper_17uzv_46 {\n display: grid;\n grid-template-columns: 1fr auto;\n gap: var(--sizes-xs);\n}");
|
|
6
|
+
var uploadedFileStyles = {"uploadedFileContainer":"_uploadedFileContainer_17uzv_1","uploadedFileContainerCriticalError":"_uploadedFileContainerCriticalError_17uzv_7","singleLineText":"_singleLineText_17uzv_13","singleLineTextWithoutFlex":"_singleLineTextWithoutFlex_17uzv_21","fileSizeText":"_fileSizeText_17uzv_29","previewImage":"_previewImage_17uzv_35","singleLineWrapper":"_singleLineWrapper_17uzv_40","standardFileTextWrapper":"_standardFileTextWrapper_17uzv_46"};
|
|
7
|
+
|
|
8
|
+
module.exports = uploadedFileStyles;
|
|
9
|
+
//# sourceMappingURL=UploadedFile.module.scss.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UploadedFile.module.scss.cjs","sources":["../../../src/components/UploadedFile/UploadedFile.module.scss"],"sourcesContent":[".uploadedFileContainer {\n border: 1px solid var(--colors-neutral-ink-lightest);\n border-radius: var(--radius-base);\n padding: var(--sizes-3);\n}\n\n.uploadedFileContainerCriticalError {\n border: 1px solid var(--colors-secondary-red-base);\n border-radius: var(--radius-base);\n padding: var(--sizes-3);\n}\n\n.singleLineText {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex: 0 1 80%;\n min-width: 0;\n}\n\n.singleLineTextWithoutFlex {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex: none;\n min-width: 0;\n}\n\n.fileSizeText {\n white-space: nowrap;\n flex: 0 0 20%;\n text-align: right;\n}\n\n.previewImage {\n img {\n border: 1px solid var(--colors-neutral-ink-lightest);\n border-radius: var(--sizes-xs);\n }\n}\n\n.singleLineWrapper {\n display: grid;\n min-width: 0;\n flex: 1;\n}\n\n.standardFileTextWrapper {\n display: grid;\n grid-template-columns: 1fr auto;\n gap: var(--sizes-xs);\n}\n"],"names":[],"mappings":";;;;AACE,eAAA,CAAA,iiCAAA;AACA,yBAAA,CAAA,uBAAA,CAAA,gCAAA,CAAA,oCAAA,CAAA,6CAAA,CAAA,gBAAA,CAAA,0BAAA,CAAA,2BAAA,CAAA,qCAAA,CAAA,cAAA,CAAA,wBAAA,CAAA,cAAA,CAAA,wBAAA,CAAA,mBAAA,CAAA,6BAAA,CAAA,yBAAA,CAAA,mCAAA;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import insertStyle from '../../_virtual/____insertStyle.js';
|
|
2
|
+
|
|
3
|
+
insertStyle("._uploadedFileContainer_17uzv_1 {\n border: 1px solid var(--colors-neutral-ink-lightest);\n border-radius: var(--radius-base);\n padding: var(--sizes-3);\n}\n\n._uploadedFileContainerCriticalError_17uzv_7 {\n border: 1px solid var(--colors-secondary-red-base);\n border-radius: var(--radius-base);\n padding: var(--sizes-3);\n}\n\n._singleLineText_17uzv_13 {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex: 0 1 80%;\n min-width: 0;\n}\n\n._singleLineTextWithoutFlex_17uzv_21 {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex: none;\n min-width: 0;\n}\n\n._fileSizeText_17uzv_29 {\n white-space: nowrap;\n flex: 0 0 20%;\n text-align: right;\n}\n\n._previewImage_17uzv_35 img {\n border: 1px solid var(--colors-neutral-ink-lightest);\n border-radius: var(--sizes-xs);\n}\n\n._singleLineWrapper_17uzv_40 {\n display: grid;\n min-width: 0;\n flex: 1;\n}\n\n._standardFileTextWrapper_17uzv_46 {\n display: grid;\n grid-template-columns: 1fr auto;\n gap: var(--sizes-xs);\n}");
|
|
4
|
+
var uploadedFileStyles = {"uploadedFileContainer":"_uploadedFileContainer_17uzv_1","uploadedFileContainerCriticalError":"_uploadedFileContainerCriticalError_17uzv_7","singleLineText":"_singleLineText_17uzv_13","singleLineTextWithoutFlex":"_singleLineTextWithoutFlex_17uzv_21","fileSizeText":"_fileSizeText_17uzv_29","previewImage":"_previewImage_17uzv_35","singleLineWrapper":"_singleLineWrapper_17uzv_40","standardFileTextWrapper":"_standardFileTextWrapper_17uzv_46"};
|
|
5
|
+
|
|
6
|
+
export { uploadedFileStyles as default };
|
|
7
|
+
//# sourceMappingURL=UploadedFile.module.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UploadedFile.module.scss.js","sources":["../../../src/components/UploadedFile/UploadedFile.module.scss"],"sourcesContent":[".uploadedFileContainer {\n border: 1px solid var(--colors-neutral-ink-lightest);\n border-radius: var(--radius-base);\n padding: var(--sizes-3);\n}\n\n.uploadedFileContainerCriticalError {\n border: 1px solid var(--colors-secondary-red-base);\n border-radius: var(--radius-base);\n padding: var(--sizes-3);\n}\n\n.singleLineText {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex: 0 1 80%;\n min-width: 0;\n}\n\n.singleLineTextWithoutFlex {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n flex: none;\n min-width: 0;\n}\n\n.fileSizeText {\n white-space: nowrap;\n flex: 0 0 20%;\n text-align: right;\n}\n\n.previewImage {\n img {\n border: 1px solid var(--colors-neutral-ink-lightest);\n border-radius: var(--sizes-xs);\n }\n}\n\n.singleLineWrapper {\n display: grid;\n min-width: 0;\n flex: 1;\n}\n\n.standardFileTextWrapper {\n display: grid;\n grid-template-columns: 1fr auto;\n gap: var(--sizes-xs);\n}\n"],"names":["___$insertStyle"],"mappings":";;AACEA,WAAA,CAAA,iiCAAA;AACA,yBAAA,CAAA,uBAAA,CAAA,gCAAA,CAAA,oCAAA,CAAA,6CAAA,CAAA,gBAAA,CAAA,0BAAA,CAAA,2BAAA,CAAA,qCAAA,CAAA,cAAA,CAAA,wBAAA,CAAA,cAAA,CAAA,wBAAA,CAAA,mBAAA,CAAA,6BAAA,CAAA,yBAAA,CAAA,mCAAA;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useFileErrorMessages } from './useFileErrorMessages';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var convertFileTypeToAcceptedFileType = require('../../utils/convertFileTypeToAcceptedFileType/convertFileTypeToAcceptedFileType.cjs');
|
|
5
|
+
var constants = require('../../../UploadFile/constants.cjs');
|
|
6
|
+
|
|
7
|
+
const useFileErrorMessages = ({ maxBytes, fileTypes, file }) => {
|
|
8
|
+
const errorMessages = React.useMemo(() => {
|
|
9
|
+
if (!file)
|
|
10
|
+
return { criticalErrors: [] };
|
|
11
|
+
const extension = convertFileTypeToAcceptedFileType.convertFileTypeToAcceptedFileType(file.type);
|
|
12
|
+
const isTypeValid = fileTypes.includes(extension);
|
|
13
|
+
const hasInvalidFormat = !isTypeValid;
|
|
14
|
+
const hasExceededMaxSize = file.size > maxBytes;
|
|
15
|
+
const errors = { criticalErrors: [] };
|
|
16
|
+
if (hasExceededMaxSize) {
|
|
17
|
+
errors.criticalErrors.push({
|
|
18
|
+
errorType: constants.ErrorType.critical,
|
|
19
|
+
errorMessage: constants.CriticalErrorMessages.FILE_IS_TOO_BIG,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
if (hasInvalidFormat) {
|
|
23
|
+
errors.criticalErrors.push({
|
|
24
|
+
errorType: constants.ErrorType.critical,
|
|
25
|
+
errorMessage: constants.CriticalErrorMessages.INVALID_FORMAT,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return errors;
|
|
29
|
+
}, [file, fileTypes, maxBytes]);
|
|
30
|
+
const hasCriticalErrors = !!errorMessages.criticalErrors.length;
|
|
31
|
+
return {
|
|
32
|
+
hasCriticalErrors,
|
|
33
|
+
errorMessages,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
exports.useFileErrorMessages = useFileErrorMessages;
|
|
38
|
+
//# sourceMappingURL=useFileErrorMessages.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFileErrorMessages.cjs","sources":["../../../../../src/components/UploadedFile/hooks/useFileErrorMessages/useFileErrorMessages.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { convertFileTypeToAcceptedFileType } from '../../utils/convertFileTypeToAcceptedFileType';\nimport { AcceptedFileTypes, CriticalErrorMessages, ErrorType } from '../../../UploadFile/constants';\n\ntype UploadFileErrors = {\n criticalErrors: Array<UploadFileError>;\n};\n\ntype UploadFileError = {\n errorType: ErrorType;\n errorMessage: string;\n};\n\ntype UseFileErrorMessagesProps = {\n file?: File | null;\n maxBytes: number;\n fileTypes: Array<AcceptedFileTypes>;\n};\n\nexport const useFileErrorMessages = ({ maxBytes, fileTypes, file }: UseFileErrorMessagesProps) => {\n const errorMessages = useMemo(() => {\n if (!file) return { criticalErrors: [] };\n\n const extension = convertFileTypeToAcceptedFileType(file.type);\n const isTypeValid = (fileTypes as string[]).includes(extension);\n const hasInvalidFormat = !isTypeValid;\n\n const hasExceededMaxSize = file.size > maxBytes;\n\n const errors: UploadFileErrors = { criticalErrors: [] };\n if (hasExceededMaxSize) {\n errors.criticalErrors.push({\n errorType: ErrorType.critical,\n errorMessage: CriticalErrorMessages.FILE_IS_TOO_BIG,\n });\n }\n if (hasInvalidFormat) {\n errors.criticalErrors.push({\n errorType: ErrorType.critical,\n errorMessage: CriticalErrorMessages.INVALID_FORMAT,\n });\n }\n return errors;\n }, [file, fileTypes, maxBytes]);\n\n const hasCriticalErrors = !!errorMessages.criticalErrors.length;\n\n return {\n hasCriticalErrors,\n errorMessages,\n };\n};\n"],"names":["useMemo","convertFileTypeToAcceptedFileType","ErrorType","CriticalErrorMessages"],"mappings":";;;;;;AAmBO,MAAM,oBAAoB,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAA6B,KAAI;AAC/F,IAAA,MAAM,aAAa,GAAGA,aAAO,CAAC,MAAK;AACjC,QAAA,IAAI,CAAC,IAAI;AAAE,YAAA,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE;QAExC,MAAM,SAAS,GAAGC,mEAAiC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC9D,MAAM,WAAW,GAAI,SAAsB,CAAC,QAAQ,CAAC,SAAS,CAAC;AAC/D,QAAA,MAAM,gBAAgB,GAAG,CAAC,WAAW;AAErC,QAAA,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,GAAG,QAAQ;AAE/C,QAAA,MAAM,MAAM,GAAqB,EAAE,cAAc,EAAE,EAAE,EAAE;AACvD,QAAA,IAAI,kBAAkB,EAAE;AACtB,YAAA,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC;gBACzB,SAAS,EAAEC,mBAAS,CAAC,QAAQ;gBAC7B,YAAY,EAAEC,+BAAqB,CAAC,eAAe;AACpD,aAAA,CAAC;AACH;AACD,QAAA,IAAI,gBAAgB,EAAE;AACpB,YAAA,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC;gBACzB,SAAS,EAAED,mBAAS,CAAC,QAAQ;gBAC7B,YAAY,EAAEC,+BAAqB,CAAC,cAAc;AACnD,aAAA,CAAC;AACH;AACD,QAAA,OAAO,MAAM;KACd,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IAE/B,MAAM,iBAAiB,GAAG,CAAC,CAAC,aAAa,CAAC,cAAc,CAAC,MAAM;IAE/D,OAAO;QACL,iBAAiB;QACjB,aAAa;KACd;AACH;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AcceptedFileTypes, ErrorType } from '../../../UploadFile/constants';
|
|
2
|
+
type UploadFileErrors = {
|
|
3
|
+
criticalErrors: Array<UploadFileError>;
|
|
4
|
+
};
|
|
5
|
+
type UploadFileError = {
|
|
6
|
+
errorType: ErrorType;
|
|
7
|
+
errorMessage: string;
|
|
8
|
+
};
|
|
9
|
+
type UseFileErrorMessagesProps = {
|
|
10
|
+
file?: File | null;
|
|
11
|
+
maxBytes: number;
|
|
12
|
+
fileTypes: Array<AcceptedFileTypes>;
|
|
13
|
+
};
|
|
14
|
+
export declare const useFileErrorMessages: ({ maxBytes, fileTypes, file }: UseFileErrorMessagesProps) => {
|
|
15
|
+
hasCriticalErrors: boolean;
|
|
16
|
+
errorMessages: UploadFileErrors;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { convertFileTypeToAcceptedFileType } from '../../utils/convertFileTypeToAcceptedFileType/convertFileTypeToAcceptedFileType.js';
|
|
3
|
+
import { ErrorType, CriticalErrorMessages } from '../../../UploadFile/constants.js';
|
|
4
|
+
|
|
5
|
+
const useFileErrorMessages = ({ maxBytes, fileTypes, file }) => {
|
|
6
|
+
const errorMessages = useMemo(() => {
|
|
7
|
+
if (!file)
|
|
8
|
+
return { criticalErrors: [] };
|
|
9
|
+
const extension = convertFileTypeToAcceptedFileType(file.type);
|
|
10
|
+
const isTypeValid = fileTypes.includes(extension);
|
|
11
|
+
const hasInvalidFormat = !isTypeValid;
|
|
12
|
+
const hasExceededMaxSize = file.size > maxBytes;
|
|
13
|
+
const errors = { criticalErrors: [] };
|
|
14
|
+
if (hasExceededMaxSize) {
|
|
15
|
+
errors.criticalErrors.push({
|
|
16
|
+
errorType: ErrorType.critical,
|
|
17
|
+
errorMessage: CriticalErrorMessages.FILE_IS_TOO_BIG,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
if (hasInvalidFormat) {
|
|
21
|
+
errors.criticalErrors.push({
|
|
22
|
+
errorType: ErrorType.critical,
|
|
23
|
+
errorMessage: CriticalErrorMessages.INVALID_FORMAT,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return errors;
|
|
27
|
+
}, [file, fileTypes, maxBytes]);
|
|
28
|
+
const hasCriticalErrors = !!errorMessages.criticalErrors.length;
|
|
29
|
+
return {
|
|
30
|
+
hasCriticalErrors,
|
|
31
|
+
errorMessages,
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export { useFileErrorMessages };
|
|
36
|
+
//# sourceMappingURL=useFileErrorMessages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFileErrorMessages.js","sources":["../../../../../src/components/UploadedFile/hooks/useFileErrorMessages/useFileErrorMessages.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { convertFileTypeToAcceptedFileType } from '../../utils/convertFileTypeToAcceptedFileType';\nimport { AcceptedFileTypes, CriticalErrorMessages, ErrorType } from '../../../UploadFile/constants';\n\ntype UploadFileErrors = {\n criticalErrors: Array<UploadFileError>;\n};\n\ntype UploadFileError = {\n errorType: ErrorType;\n errorMessage: string;\n};\n\ntype UseFileErrorMessagesProps = {\n file?: File | null;\n maxBytes: number;\n fileTypes: Array<AcceptedFileTypes>;\n};\n\nexport const useFileErrorMessages = ({ maxBytes, fileTypes, file }: UseFileErrorMessagesProps) => {\n const errorMessages = useMemo(() => {\n if (!file) return { criticalErrors: [] };\n\n const extension = convertFileTypeToAcceptedFileType(file.type);\n const isTypeValid = (fileTypes as string[]).includes(extension);\n const hasInvalidFormat = !isTypeValid;\n\n const hasExceededMaxSize = file.size > maxBytes;\n\n const errors: UploadFileErrors = { criticalErrors: [] };\n if (hasExceededMaxSize) {\n errors.criticalErrors.push({\n errorType: ErrorType.critical,\n errorMessage: CriticalErrorMessages.FILE_IS_TOO_BIG,\n });\n }\n if (hasInvalidFormat) {\n errors.criticalErrors.push({\n errorType: ErrorType.critical,\n errorMessage: CriticalErrorMessages.INVALID_FORMAT,\n });\n }\n return errors;\n }, [file, fileTypes, maxBytes]);\n\n const hasCriticalErrors = !!errorMessages.criticalErrors.length;\n\n return {\n hasCriticalErrors,\n errorMessages,\n };\n};\n"],"names":[],"mappings":";;;;AAmBO,MAAM,oBAAoB,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAA6B,KAAI;AAC/F,IAAA,MAAM,aAAa,GAAG,OAAO,CAAC,MAAK;AACjC,QAAA,IAAI,CAAC,IAAI;AAAE,YAAA,OAAO,EAAE,cAAc,EAAE,EAAE,EAAE;QAExC,MAAM,SAAS,GAAG,iCAAiC,CAAC,IAAI,CAAC,IAAI,CAAC;QAC9D,MAAM,WAAW,GAAI,SAAsB,CAAC,QAAQ,CAAC,SAAS,CAAC;AAC/D,QAAA,MAAM,gBAAgB,GAAG,CAAC,WAAW;AAErC,QAAA,MAAM,kBAAkB,GAAG,IAAI,CAAC,IAAI,GAAG,QAAQ;AAE/C,QAAA,MAAM,MAAM,GAAqB,EAAE,cAAc,EAAE,EAAE,EAAE;AACvD,QAAA,IAAI,kBAAkB,EAAE;AACtB,YAAA,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC;gBACzB,SAAS,EAAE,SAAS,CAAC,QAAQ;gBAC7B,YAAY,EAAE,qBAAqB,CAAC,eAAe;AACpD,aAAA,CAAC;AACH;AACD,QAAA,IAAI,gBAAgB,EAAE;AACpB,YAAA,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC;gBACzB,SAAS,EAAE,SAAS,CAAC,QAAQ;gBAC7B,YAAY,EAAE,qBAAqB,CAAC,cAAc;AACnD,aAAA,CAAC;AACH;AACD,QAAA,OAAO,MAAM;KACd,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IAE/B,MAAM,iBAAiB,GAAG,CAAC,CAAC,aAAa,CAAC,cAAc,CAAC,MAAM;IAE/D,OAAO;QACL,iBAAiB;QACjB,aAAa;KACd;AACH;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { usePreviewImage } from './usePreviewImage';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var isImageType = require('../../utils/isImageType/isImageType.cjs');
|
|
5
|
+
|
|
6
|
+
const usePreviewImage = ({ file }) => {
|
|
7
|
+
const [previewSrc, setPreviewSrc] = React.useState('');
|
|
8
|
+
React.useEffect(() => {
|
|
9
|
+
if (!file) {
|
|
10
|
+
setPreviewSrc('');
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
if (!isImageType.isImageType(file)) {
|
|
14
|
+
setPreviewSrc('');
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
const fileReader = new FileReader();
|
|
18
|
+
fileReader.onload = (event) => {
|
|
19
|
+
var _a;
|
|
20
|
+
const imageUrl = (_a = event.target) === null || _a === undefined ? undefined : _a.result;
|
|
21
|
+
setPreviewSrc(String(imageUrl));
|
|
22
|
+
};
|
|
23
|
+
fileReader.readAsDataURL(file);
|
|
24
|
+
return () => {
|
|
25
|
+
fileReader.abort();
|
|
26
|
+
};
|
|
27
|
+
}, [file]);
|
|
28
|
+
const shouldShowPreview = file ? isImageType.isImageType(file) : false;
|
|
29
|
+
return {
|
|
30
|
+
previewSrc,
|
|
31
|
+
shouldShowPreview,
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
exports.usePreviewImage = usePreviewImage;
|
|
36
|
+
//# sourceMappingURL=usePreviewImage.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePreviewImage.cjs","sources":["../../../../../src/components/UploadedFile/hooks/usePreviewImage/usePreviewImage.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { isImageType } from '../../utils/isImageType';\n\ntype UsePreviewImageProps = {\n file?: File | null;\n};\n\nexport const usePreviewImage = ({ file }: UsePreviewImageProps) => {\n const [previewSrc, setPreviewSrc] = useState('');\n\n useEffect(() => {\n if (!file) {\n setPreviewSrc('');\n return undefined;\n }\n\n if (!isImageType(file)) {\n setPreviewSrc('');\n return undefined;\n }\n\n const fileReader = new FileReader();\n\n fileReader.onload = (event) => {\n const imageUrl = event.target?.result;\n setPreviewSrc(String(imageUrl));\n };\n\n fileReader.readAsDataURL(file);\n\n return () => {\n fileReader.abort();\n };\n }, [file]);\n\n const shouldShowPreview = file ? isImageType(file) : false;\n\n return {\n previewSrc,\n shouldShowPreview,\n };\n};\n"],"names":["useState","useEffect","isImageType"],"mappings":";;;;;MAOa,eAAe,GAAG,CAAC,EAAE,IAAI,EAAwB,KAAI;IAChE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAGA,cAAQ,CAAC,EAAE,CAAC;IAEhDC,eAAS,CAAC,MAAK;QACb,IAAI,CAAC,IAAI,EAAE;YACT,aAAa,CAAC,EAAE,CAAC;AACjB,YAAA,OAAO,SAAS;AACjB;AAED,QAAA,IAAI,CAACC,uBAAW,CAAC,IAAI,CAAC,EAAE;YACtB,aAAa,CAAC,EAAE,CAAC;AACjB,YAAA,OAAO,SAAS;AACjB;AAED,QAAA,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE;AAEnC,QAAA,UAAU,CAAC,MAAM,GAAG,CAAC,KAAK,KAAI;;YAC5B,MAAM,QAAQ,GAAG,CAAA,EAAA,GAAA,KAAK,CAAC,MAAM,MAAA,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAE,MAAM;AACrC,YAAA,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACjC,SAAC;AAED,QAAA,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC;AAE9B,QAAA,OAAO,MAAK;YACV,UAAU,CAAC,KAAK,EAAE;AACpB,SAAC;AACH,KAAC,EAAE,CAAC,IAAI,CAAC,CAAC;AAEV,IAAA,MAAM,iBAAiB,GAAG,IAAI,GAAGA,uBAAW,CAAC,IAAI,CAAC,GAAG,KAAK;IAE1D,OAAO;QACL,UAAU;QACV,iBAAiB;KAClB;AACH;;;;"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { isImageType } from '../../utils/isImageType/isImageType.js';
|
|
3
|
+
|
|
4
|
+
const usePreviewImage = ({ file }) => {
|
|
5
|
+
const [previewSrc, setPreviewSrc] = useState('');
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (!file) {
|
|
8
|
+
setPreviewSrc('');
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
if (!isImageType(file)) {
|
|
12
|
+
setPreviewSrc('');
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
const fileReader = new FileReader();
|
|
16
|
+
fileReader.onload = (event) => {
|
|
17
|
+
var _a;
|
|
18
|
+
const imageUrl = (_a = event.target) === null || _a === undefined ? undefined : _a.result;
|
|
19
|
+
setPreviewSrc(String(imageUrl));
|
|
20
|
+
};
|
|
21
|
+
fileReader.readAsDataURL(file);
|
|
22
|
+
return () => {
|
|
23
|
+
fileReader.abort();
|
|
24
|
+
};
|
|
25
|
+
}, [file]);
|
|
26
|
+
const shouldShowPreview = file ? isImageType(file) : false;
|
|
27
|
+
return {
|
|
28
|
+
previewSrc,
|
|
29
|
+
shouldShowPreview,
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { usePreviewImage };
|
|
34
|
+
//# sourceMappingURL=usePreviewImage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePreviewImage.js","sources":["../../../../../src/components/UploadedFile/hooks/usePreviewImage/usePreviewImage.ts"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { isImageType } from '../../utils/isImageType';\n\ntype UsePreviewImageProps = {\n file?: File | null;\n};\n\nexport const usePreviewImage = ({ file }: UsePreviewImageProps) => {\n const [previewSrc, setPreviewSrc] = useState('');\n\n useEffect(() => {\n if (!file) {\n setPreviewSrc('');\n return undefined;\n }\n\n if (!isImageType(file)) {\n setPreviewSrc('');\n return undefined;\n }\n\n const fileReader = new FileReader();\n\n fileReader.onload = (event) => {\n const imageUrl = event.target?.result;\n setPreviewSrc(String(imageUrl));\n };\n\n fileReader.readAsDataURL(file);\n\n return () => {\n fileReader.abort();\n };\n }, [file]);\n\n const shouldShowPreview = file ? isImageType(file) : false;\n\n return {\n previewSrc,\n shouldShowPreview,\n };\n};\n"],"names":[],"mappings":";;;MAOa,eAAe,GAAG,CAAC,EAAE,IAAI,EAAwB,KAAI;IAChE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC;IAEhD,SAAS,CAAC,MAAK;QACb,IAAI,CAAC,IAAI,EAAE;YACT,aAAa,CAAC,EAAE,CAAC;AACjB,YAAA,OAAO,SAAS;AACjB;AAED,QAAA,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE;YACtB,aAAa,CAAC,EAAE,CAAC;AACjB,YAAA,OAAO,SAAS;AACjB;AAED,QAAA,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE;AAEnC,QAAA,UAAU,CAAC,MAAM,GAAG,CAAC,KAAK,KAAI;;YAC5B,MAAM,QAAQ,GAAG,CAAA,EAAA,GAAA,KAAK,CAAC,MAAM,MAAA,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAE,MAAM;AACrC,YAAA,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AACjC,SAAC;AAED,QAAA,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC;AAE9B,QAAA,OAAO,MAAK;YACV,UAAU,CAAC,KAAK,EAAE;AACpB,SAAC;AACH,KAAC,EAAE,CAAC,IAAI,CAAC,CAAC;AAEV,IAAA,MAAM,iBAAiB,GAAG,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,KAAK;IAE1D,OAAO;QACL,UAAU;QACV,iBAAiB;KAClB;AACH;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UploadedFile } from './UploadedFile';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const convertFileTypeToAcceptedFileType = (fileType) => {
|
|
4
|
+
if (typeof fileType !== 'string' || !fileType.includes('/')) {
|
|
5
|
+
throw new Error('Invalid MIME type');
|
|
6
|
+
}
|
|
7
|
+
// Remove any MIME parameter (e.g., ";charset=UTF-8")
|
|
8
|
+
const [typePart] = fileType.split(';');
|
|
9
|
+
const [group, type] = typePart.trim().split('/');
|
|
10
|
+
if (!group || !type) {
|
|
11
|
+
throw new Error('Invalid MIME type');
|
|
12
|
+
}
|
|
13
|
+
return `.${type}`;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
exports.convertFileTypeToAcceptedFileType = convertFileTypeToAcceptedFileType;
|
|
17
|
+
//# sourceMappingURL=convertFileTypeToAcceptedFileType.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertFileTypeToAcceptedFileType.cjs","sources":["../../../../../src/components/UploadedFile/utils/convertFileTypeToAcceptedFileType/convertFileTypeToAcceptedFileType.ts"],"sourcesContent":["export const convertFileTypeToAcceptedFileType = (fileType: string) => {\n if (typeof fileType !== 'string' || !fileType.includes('/')) {\n throw new Error('Invalid MIME type');\n }\n // Remove any MIME parameter (e.g., \";charset=UTF-8\")\n const [typePart] = fileType.split(';');\n const [group, type] = typePart.trim().split('/');\n if (!group || !type) {\n throw new Error('Invalid MIME type');\n }\n return `.${type}`;\n};\n"],"names":[],"mappings":";;AAAa,MAAA,iCAAiC,GAAG,CAAC,QAAgB,KAAI;AACpE,IAAA,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AAC3D,QAAA,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC;AACrC;;IAED,MAAM,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC;AACtC,IAAA,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC;AAChD,IAAA,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE;AACnB,QAAA,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC;AACrC;IACD,OAAO,CAAA,CAAA,EAAI,IAAI,CAAA,CAAE;AACnB;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const convertFileTypeToAcceptedFileType: (fileType: string) => string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const convertFileTypeToAcceptedFileType = (fileType) => {
|
|
2
|
+
if (typeof fileType !== 'string' || !fileType.includes('/')) {
|
|
3
|
+
throw new Error('Invalid MIME type');
|
|
4
|
+
}
|
|
5
|
+
// Remove any MIME parameter (e.g., ";charset=UTF-8")
|
|
6
|
+
const [typePart] = fileType.split(';');
|
|
7
|
+
const [group, type] = typePart.trim().split('/');
|
|
8
|
+
if (!group || !type) {
|
|
9
|
+
throw new Error('Invalid MIME type');
|
|
10
|
+
}
|
|
11
|
+
return `.${type}`;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { convertFileTypeToAcceptedFileType };
|
|
15
|
+
//# sourceMappingURL=convertFileTypeToAcceptedFileType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertFileTypeToAcceptedFileType.js","sources":["../../../../../src/components/UploadedFile/utils/convertFileTypeToAcceptedFileType/convertFileTypeToAcceptedFileType.ts"],"sourcesContent":["export const convertFileTypeToAcceptedFileType = (fileType: string) => {\n if (typeof fileType !== 'string' || !fileType.includes('/')) {\n throw new Error('Invalid MIME type');\n }\n // Remove any MIME parameter (e.g., \";charset=UTF-8\")\n const [typePart] = fileType.split(';');\n const [group, type] = typePart.trim().split('/');\n if (!group || !type) {\n throw new Error('Invalid MIME type');\n }\n return `.${type}`;\n};\n"],"names":[],"mappings":"AAAa,MAAA,iCAAiC,GAAG,CAAC,QAAgB,KAAI;AACpE,IAAA,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AAC3D,QAAA,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC;AACrC;;IAED,MAAM,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC;AACtC,IAAA,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC;AAChD,IAAA,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,EAAE;AACnB,QAAA,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC;AACrC;IACD,OAAO,CAAA,CAAA,EAAI,IAAI,CAAA,CAAE;AACnB;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { convertFileTypeToAcceptedFileType } from './convertFileTypeToAcceptedFileType';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { isImageType } from './isImageType';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const isImageType = (file) => {
|
|
4
|
+
if (!file)
|
|
5
|
+
return false;
|
|
6
|
+
const fileType = file.type.split('/');
|
|
7
|
+
if (fileType[0] === 'image') {
|
|
8
|
+
return true;
|
|
9
|
+
}
|
|
10
|
+
return false;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
exports.isImageType = isImageType;
|
|
14
|
+
//# sourceMappingURL=isImageType.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isImageType.cjs","sources":["../../../../../src/components/UploadedFile/utils/isImageType/isImageType.ts"],"sourcesContent":["export const isImageType = (file?: File | null) => {\n if (!file) return false;\n\n const fileType = file.type.split('/');\n\n if (fileType[0] === 'image') {\n return true;\n }\n\n return false;\n};\n"],"names":[],"mappings":";;AAAa,MAAA,WAAW,GAAG,CAAC,IAAkB,KAAI;AAChD,IAAA,IAAI,CAAC,IAAI;AAAE,QAAA,OAAO,KAAK;IAEvB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;AAErC,IAAA,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;AAC3B,QAAA,OAAO,IAAI;AACZ;AAED,IAAA,OAAO,KAAK;AACd;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isImageType: (file?: File | null) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isImageType.js","sources":["../../../../../src/components/UploadedFile/utils/isImageType/isImageType.ts"],"sourcesContent":["export const isImageType = (file?: File | null) => {\n if (!file) return false;\n\n const fileType = file.type.split('/');\n\n if (fileType[0] === 'image') {\n return true;\n }\n\n return false;\n};\n"],"names":[],"mappings":"AAAa,MAAA,WAAW,GAAG,CAAC,IAAkB,KAAI;AAChD,IAAA,IAAI,CAAC,IAAI;AAAE,QAAA,OAAO,KAAK;IAEvB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;AAErC,IAAA,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;AAC3B,QAAA,OAAO,IAAI;AACZ;AAED,IAAA,OAAO,KAAK;AACd;;;;"}
|
|
@@ -28,7 +28,8 @@ const ViewsContainer = React__default.default.forwardRef(({ children, className,
|
|
|
28
28
|
isLoadingMoreViews,
|
|
29
29
|
});
|
|
30
30
|
const showCustomMenuButton = !onClickMenu && !!menuButtonSlot;
|
|
31
|
-
|
|
31
|
+
const shouldShowNavigationArrows = !leftDisabled || !rightDisabled;
|
|
32
|
+
return (React__default.default.createElement(FlexRow.FlexRow, { className: buildClassnames.buildClassnames([ViewsContainer_module[`appearance-${appearance}`], className]), justifyContent: "space-between", flexWrap: "nowrap", style: style },
|
|
32
33
|
React__default.default.createElement(FlexRow.FlexRow, { className: buildClassnames.buildClassnames([ViewsContainer_module.viewsWrapper, compact && ViewsContainer_module.compact]), ref: viewsRef, id: "views", role: "tablist", gap: "sm", flexWrap: "nowrap" },
|
|
33
34
|
children,
|
|
34
35
|
isLoadingMoreViews && (React__default.default.createElement(React__default.default.Fragment, null,
|
|
@@ -39,8 +40,8 @@ const ViewsContainer = React__default.default.forwardRef(({ children, className,
|
|
|
39
40
|
ViewsContainer_module.buttonGroup,
|
|
40
41
|
showCustomMenuButton && ViewsContainer_module.customMenuButton,
|
|
41
42
|
]) },
|
|
42
|
-
React__default.default.createElement("div", { className: form_module.inputGroup },
|
|
43
|
-
|
|
43
|
+
React__default.default.createElement("div", { className: shouldShowNavigationArrows ? form_module.inputGroup : undefined },
|
|
44
|
+
shouldShowNavigationArrows && (React__default.default.createElement(React__default.default.Fragment, null,
|
|
44
45
|
React__default.default.createElement(Button.Button, { id: "left-arrow", className: ViewsContainer_module.scrollButton, iconSlot: React__default.default.createElement(LeftArrowIcon.ReactComponent, { color: index.theme.colors.neutral.ink.base }), disabled: leftDisabled, onClick: toPrevScrollPosition, variant: "flat", "aria-label": "move views to the left" }),
|
|
45
46
|
React__default.default.createElement(Button.Button, { id: "right-arrow", className: ViewsContainer_module.scrollButton, iconSlot: React__default.default.createElement(RightArrowIcon.ReactComponent, { color: index.theme.colors.neutral.ink.base }), disabled: rightDisabled, onClick: toNextScrollPosition, variant: "flat", "aria-label": "move views to the right" }))),
|
|
46
47
|
!menuButtonSlot && !!onClickMenu && (React__default.default.createElement(Button.Button, { className: ViewsContainer_module.menuButton, iconSlot: React__default.default.createElement(ThreeDotsIcon.ThreeDotsIcon, { color: index.theme.colors.neutral.ink.base }), variant: "flat", onClick: onClickMenu, "aria-label": "open menu", "aria-controls": ariaMenuControls, "aria-expanded": ariaMenuExpanded, "aria-haspopup": ariaMenuControls ? 'dialog' : undefined, ref: menuRef }))),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewsContainer.cjs","sources":["../../../src/components/ViewsContainer/ViewsContainer.tsx"],"sourcesContent":["import React, { useRef, MutableRefObject, Ref, Fragment } from 'react';\n\nimport { theme } from 'Theme';\nimport { ViewContainerProps } from './types';\nimport { useSetScrollPosition } from './hooks/useSetScrollPosition';\nimport { FlexRow } from '../Flex/FlexRow';\nimport { Button } from '../Button';\nimport { Skeleton } from '../Skeleton';\nimport { LeftArrowIcon, RightArrowIcon, ThreeDotsIcon } from '../../icons';\nimport { buildClassnames } from '../../utils';\n\nimport styles from './ViewsContainer.module.scss';\nimport formStyles from '../../utils/forms/form.module.scss';\n\nexport const ViewsContainer = React.forwardRef<HTMLButtonElement, ViewContainerProps>(\n (\n {\n children,\n className,\n style,\n onClickMenu,\n ariaMenuControls,\n ariaMenuExpanded,\n hasMoreViews,\n onFetchMoreViews,\n isLoadingMoreViews,\n compact = false,\n appearance = 'primary',\n menuButtonSlot,\n }: ViewContainerProps,\n menuRef: Ref<HTMLButtonElement>,\n ) => {\n const viewsRef = useRef<HTMLDivElement>(null) as MutableRefObject<HTMLDivElement>;\n const { rightDisabled, leftDisabled, toNextScrollPosition, toPrevScrollPosition } =\n useSetScrollPosition({\n containerRef: viewsRef,\n children,\n hasMoreViews,\n onFetchMoreViews,\n isLoadingMoreViews,\n });\n\n const showCustomMenuButton = !onClickMenu && !!menuButtonSlot;\n\n return (\n <FlexRow\n className={buildClassnames([styles[`appearance-${appearance}`], className])}\n justifyContent=\"between\"\n flexWrap=\"nowrap\"\n style={style}\n >\n <FlexRow\n className={buildClassnames([styles.viewsWrapper, compact && styles.compact])}\n ref={viewsRef}\n id=\"views\"\n role=\"tablist\"\n gap=\"sm\"\n flexWrap=\"nowrap\"\n >\n {children}\n {isLoadingMoreViews && (\n <>\n <Skeleton width=\"80px\" height=\"40px\" />\n <Skeleton width=\"80px\" height=\"40px\" />\n <Skeleton width=\"80px\" height=\"40px\" />\n </>\n )}\n </FlexRow>\n\n <FlexRow\n flexWrap=\"nowrap\"\n className={buildClassnames([\n styles.buttonGroup,\n showCustomMenuButton && styles.customMenuButton,\n ])}\n >\n <div className={formStyles.inputGroup}>\n {
|
|
1
|
+
{"version":3,"file":"ViewsContainer.cjs","sources":["../../../src/components/ViewsContainer/ViewsContainer.tsx"],"sourcesContent":["import React, { useRef, MutableRefObject, Ref, Fragment } from 'react';\n\nimport { theme } from 'Theme';\nimport { ViewContainerProps } from './types';\nimport { useSetScrollPosition } from './hooks/useSetScrollPosition';\nimport { FlexRow } from '../Flex/FlexRow';\nimport { Button } from '../Button';\nimport { Skeleton } from '../Skeleton';\nimport { LeftArrowIcon, RightArrowIcon, ThreeDotsIcon } from '../../icons';\nimport { buildClassnames } from '../../utils';\n\nimport styles from './ViewsContainer.module.scss';\nimport formStyles from '../../utils/forms/form.module.scss';\n\nexport const ViewsContainer = React.forwardRef<HTMLButtonElement, ViewContainerProps>(\n (\n {\n children,\n className,\n style,\n onClickMenu,\n ariaMenuControls,\n ariaMenuExpanded,\n hasMoreViews,\n onFetchMoreViews,\n isLoadingMoreViews,\n compact = false,\n appearance = 'primary',\n menuButtonSlot,\n }: ViewContainerProps,\n menuRef: Ref<HTMLButtonElement>,\n ) => {\n const viewsRef = useRef<HTMLDivElement>(null) as MutableRefObject<HTMLDivElement>;\n const { rightDisabled, leftDisabled, toNextScrollPosition, toPrevScrollPosition } =\n useSetScrollPosition({\n containerRef: viewsRef,\n children,\n hasMoreViews,\n onFetchMoreViews,\n isLoadingMoreViews,\n });\n\n const showCustomMenuButton = !onClickMenu && !!menuButtonSlot;\n const shouldShowNavigationArrows = !leftDisabled || !rightDisabled;\n\n return (\n <FlexRow\n className={buildClassnames([styles[`appearance-${appearance}`], className])}\n justifyContent=\"space-between\"\n flexWrap=\"nowrap\"\n style={style}\n >\n <FlexRow\n className={buildClassnames([styles.viewsWrapper, compact && styles.compact])}\n ref={viewsRef}\n id=\"views\"\n role=\"tablist\"\n gap=\"sm\"\n flexWrap=\"nowrap\"\n >\n {children}\n {isLoadingMoreViews && (\n <>\n <Skeleton width=\"80px\" height=\"40px\" />\n <Skeleton width=\"80px\" height=\"40px\" />\n <Skeleton width=\"80px\" height=\"40px\" />\n </>\n )}\n </FlexRow>\n\n <FlexRow\n flexWrap=\"nowrap\"\n className={buildClassnames([\n styles.buttonGroup,\n showCustomMenuButton && styles.customMenuButton,\n ])}\n >\n <div className={shouldShowNavigationArrows ? formStyles.inputGroup : undefined}>\n {shouldShowNavigationArrows && (\n <>\n <Button\n id=\"left-arrow\"\n className={styles.scrollButton}\n iconSlot={<LeftArrowIcon color={theme.colors.neutral.ink.base} />}\n disabled={leftDisabled}\n onClick={toPrevScrollPosition}\n variant=\"flat\"\n aria-label=\"move views to the left\"\n />\n <Button\n id=\"right-arrow\"\n className={styles.scrollButton}\n iconSlot={<RightArrowIcon color={theme.colors.neutral.ink.base} />}\n disabled={rightDisabled}\n onClick={toNextScrollPosition}\n variant=\"flat\"\n aria-label=\"move views to the right\"\n />\n </>\n )}\n {!menuButtonSlot && !!onClickMenu && (\n <Button\n className={styles.menuButton}\n iconSlot={<ThreeDotsIcon color={theme.colors.neutral.ink.base} />}\n variant=\"flat\"\n onClick={onClickMenu}\n aria-label=\"open menu\"\n aria-controls={ariaMenuControls}\n aria-expanded={ariaMenuExpanded}\n aria-haspopup={ariaMenuControls ? 'dialog' : undefined}\n ref={menuRef}\n />\n )}\n </div>\n {menuButtonSlot}\n </FlexRow>\n </FlexRow>\n );\n },\n);\n"],"names":["React","useRef","useSetScrollPosition","FlexRow","buildClassnames","styles","Skeleton","formStyles","Button","LeftArrowIcon","theme","RightArrowIcon","ThreeDotsIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;AAca,MAAA,cAAc,GAAGA,sBAAK,CAAC,UAAU,CAC5C,CACE,EACE,QAAQ,EACR,SAAS,EACT,KAAK,EACL,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,OAAO,GAAG,KAAK,EACf,UAAU,GAAG,SAAS,EACtB,cAAc,GACK,EACrB,OAA+B,KAC7B;AACF,IAAA,MAAM,QAAQ,GAAGC,YAAM,CAAiB,IAAI,CAAqC;IACjF,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,GAC/EC,yCAAoB,CAAC;AACnB,QAAA,YAAY,EAAE,QAA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L,sBAAC,CAAA,aAAA,CAAAY,2BAAa,EAAC,EAAA,KAAK,EAAEF,WAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAA,CAAI,EACjE,OAAO,EAAC,MAAM,EACd,OAAO,EAAE,WAAW,EACT,YAAA,EAAA,WAAW,EACP,eAAA,EAAA,gBAAgB,mBAChB,gBAAgB,EAAA,eAAA,EAChB,gBAAgB,GAAG,QAAQ,GAAG,SAAS,EACtD,GAAG,EAAE,OAAO,EAAA,CACZ,CACH,CACG;YACL,cAAc,CACP,CACF;AAEd,CAAC;;;;"}
|
|
@@ -22,7 +22,8 @@ const ViewsContainer = React__default.forwardRef(({ children, className, style,
|
|
|
22
22
|
isLoadingMoreViews,
|
|
23
23
|
});
|
|
24
24
|
const showCustomMenuButton = !onClickMenu && !!menuButtonSlot;
|
|
25
|
-
|
|
25
|
+
const shouldShowNavigationArrows = !leftDisabled || !rightDisabled;
|
|
26
|
+
return (React__default.createElement(FlexRow, { className: buildClassnames([styles[`appearance-${appearance}`], className]), justifyContent: "space-between", flexWrap: "nowrap", style: style },
|
|
26
27
|
React__default.createElement(FlexRow, { className: buildClassnames([styles.viewsWrapper, compact && styles.compact]), ref: viewsRef, id: "views", role: "tablist", gap: "sm", flexWrap: "nowrap" },
|
|
27
28
|
children,
|
|
28
29
|
isLoadingMoreViews && (React__default.createElement(React__default.Fragment, null,
|
|
@@ -33,8 +34,8 @@ const ViewsContainer = React__default.forwardRef(({ children, className, style,
|
|
|
33
34
|
styles.buttonGroup,
|
|
34
35
|
showCustomMenuButton && styles.customMenuButton,
|
|
35
36
|
]) },
|
|
36
|
-
React__default.createElement("div", { className: formStyles.inputGroup },
|
|
37
|
-
|
|
37
|
+
React__default.createElement("div", { className: shouldShowNavigationArrows ? formStyles.inputGroup : undefined },
|
|
38
|
+
shouldShowNavigationArrows && (React__default.createElement(React__default.Fragment, null,
|
|
38
39
|
React__default.createElement(Button, { id: "left-arrow", className: styles.scrollButton, iconSlot: React__default.createElement(LeftArrowIcon, { color: theme.colors.neutral.ink.base }), disabled: leftDisabled, onClick: toPrevScrollPosition, variant: "flat", "aria-label": "move views to the left" }),
|
|
39
40
|
React__default.createElement(Button, { id: "right-arrow", className: styles.scrollButton, iconSlot: React__default.createElement(RightArrowIcon, { color: theme.colors.neutral.ink.base }), disabled: rightDisabled, onClick: toNextScrollPosition, variant: "flat", "aria-label": "move views to the right" }))),
|
|
40
41
|
!menuButtonSlot && !!onClickMenu && (React__default.createElement(Button, { className: styles.menuButton, iconSlot: React__default.createElement(ThreeDotsIcon, { color: theme.colors.neutral.ink.base }), variant: "flat", onClick: onClickMenu, "aria-label": "open menu", "aria-controls": ariaMenuControls, "aria-expanded": ariaMenuExpanded, "aria-haspopup": ariaMenuControls ? 'dialog' : undefined, ref: menuRef }))),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewsContainer.js","sources":["../../../src/components/ViewsContainer/ViewsContainer.tsx"],"sourcesContent":["import React, { useRef, MutableRefObject, Ref, Fragment } from 'react';\n\nimport { theme } from 'Theme';\nimport { ViewContainerProps } from './types';\nimport { useSetScrollPosition } from './hooks/useSetScrollPosition';\nimport { FlexRow } from '../Flex/FlexRow';\nimport { Button } from '../Button';\nimport { Skeleton } from '../Skeleton';\nimport { LeftArrowIcon, RightArrowIcon, ThreeDotsIcon } from '../../icons';\nimport { buildClassnames } from '../../utils';\n\nimport styles from './ViewsContainer.module.scss';\nimport formStyles from '../../utils/forms/form.module.scss';\n\nexport const ViewsContainer = React.forwardRef<HTMLButtonElement, ViewContainerProps>(\n (\n {\n children,\n className,\n style,\n onClickMenu,\n ariaMenuControls,\n ariaMenuExpanded,\n hasMoreViews,\n onFetchMoreViews,\n isLoadingMoreViews,\n compact = false,\n appearance = 'primary',\n menuButtonSlot,\n }: ViewContainerProps,\n menuRef: Ref<HTMLButtonElement>,\n ) => {\n const viewsRef = useRef<HTMLDivElement>(null) as MutableRefObject<HTMLDivElement>;\n const { rightDisabled, leftDisabled, toNextScrollPosition, toPrevScrollPosition } =\n useSetScrollPosition({\n containerRef: viewsRef,\n children,\n hasMoreViews,\n onFetchMoreViews,\n isLoadingMoreViews,\n });\n\n const showCustomMenuButton = !onClickMenu && !!menuButtonSlot;\n\n return (\n <FlexRow\n className={buildClassnames([styles[`appearance-${appearance}`], className])}\n justifyContent=\"between\"\n flexWrap=\"nowrap\"\n style={style}\n >\n <FlexRow\n className={buildClassnames([styles.viewsWrapper, compact && styles.compact])}\n ref={viewsRef}\n id=\"views\"\n role=\"tablist\"\n gap=\"sm\"\n flexWrap=\"nowrap\"\n >\n {children}\n {isLoadingMoreViews && (\n <>\n <Skeleton width=\"80px\" height=\"40px\" />\n <Skeleton width=\"80px\" height=\"40px\" />\n <Skeleton width=\"80px\" height=\"40px\" />\n </>\n )}\n </FlexRow>\n\n <FlexRow\n flexWrap=\"nowrap\"\n className={buildClassnames([\n styles.buttonGroup,\n showCustomMenuButton && styles.customMenuButton,\n ])}\n >\n <div className={formStyles.inputGroup}>\n {
|
|
1
|
+
{"version":3,"file":"ViewsContainer.js","sources":["../../../src/components/ViewsContainer/ViewsContainer.tsx"],"sourcesContent":["import React, { useRef, MutableRefObject, Ref, Fragment } from 'react';\n\nimport { theme } from 'Theme';\nimport { ViewContainerProps } from './types';\nimport { useSetScrollPosition } from './hooks/useSetScrollPosition';\nimport { FlexRow } from '../Flex/FlexRow';\nimport { Button } from '../Button';\nimport { Skeleton } from '../Skeleton';\nimport { LeftArrowIcon, RightArrowIcon, ThreeDotsIcon } from '../../icons';\nimport { buildClassnames } from '../../utils';\n\nimport styles from './ViewsContainer.module.scss';\nimport formStyles from '../../utils/forms/form.module.scss';\n\nexport const ViewsContainer = React.forwardRef<HTMLButtonElement, ViewContainerProps>(\n (\n {\n children,\n className,\n style,\n onClickMenu,\n ariaMenuControls,\n ariaMenuExpanded,\n hasMoreViews,\n onFetchMoreViews,\n isLoadingMoreViews,\n compact = false,\n appearance = 'primary',\n menuButtonSlot,\n }: ViewContainerProps,\n menuRef: Ref<HTMLButtonElement>,\n ) => {\n const viewsRef = useRef<HTMLDivElement>(null) as MutableRefObject<HTMLDivElement>;\n const { rightDisabled, leftDisabled, toNextScrollPosition, toPrevScrollPosition } =\n useSetScrollPosition({\n containerRef: viewsRef,\n children,\n hasMoreViews,\n onFetchMoreViews,\n isLoadingMoreViews,\n });\n\n const showCustomMenuButton = !onClickMenu && !!menuButtonSlot;\n const shouldShowNavigationArrows = !leftDisabled || !rightDisabled;\n\n return (\n <FlexRow\n className={buildClassnames([styles[`appearance-${appearance}`], className])}\n justifyContent=\"space-between\"\n flexWrap=\"nowrap\"\n style={style}\n >\n <FlexRow\n className={buildClassnames([styles.viewsWrapper, compact && styles.compact])}\n ref={viewsRef}\n id=\"views\"\n role=\"tablist\"\n gap=\"sm\"\n flexWrap=\"nowrap\"\n >\n {children}\n {isLoadingMoreViews && (\n <>\n <Skeleton width=\"80px\" height=\"40px\" />\n <Skeleton width=\"80px\" height=\"40px\" />\n <Skeleton width=\"80px\" height=\"40px\" />\n </>\n )}\n </FlexRow>\n\n <FlexRow\n flexWrap=\"nowrap\"\n className={buildClassnames([\n styles.buttonGroup,\n showCustomMenuButton && styles.customMenuButton,\n ])}\n >\n <div className={shouldShowNavigationArrows ? formStyles.inputGroup : undefined}>\n {shouldShowNavigationArrows && (\n <>\n <Button\n id=\"left-arrow\"\n className={styles.scrollButton}\n iconSlot={<LeftArrowIcon color={theme.colors.neutral.ink.base} />}\n disabled={leftDisabled}\n onClick={toPrevScrollPosition}\n variant=\"flat\"\n aria-label=\"move views to the left\"\n />\n <Button\n id=\"right-arrow\"\n className={styles.scrollButton}\n iconSlot={<RightArrowIcon color={theme.colors.neutral.ink.base} />}\n disabled={rightDisabled}\n onClick={toNextScrollPosition}\n variant=\"flat\"\n aria-label=\"move views to the right\"\n />\n </>\n )}\n {!menuButtonSlot && !!onClickMenu && (\n <Button\n className={styles.menuButton}\n iconSlot={<ThreeDotsIcon color={theme.colors.neutral.ink.base} />}\n variant=\"flat\"\n onClick={onClickMenu}\n aria-label=\"open menu\"\n aria-controls={ariaMenuControls}\n aria-expanded={ariaMenuExpanded}\n aria-haspopup={ariaMenuControls ? 'dialog' : undefined}\n ref={menuRef}\n />\n )}\n </div>\n {menuButtonSlot}\n </FlexRow>\n </FlexRow>\n );\n },\n);\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;AAca,MAAA,cAAc,GAAGA,cAAK,CAAC,UAAU,CAC5C,CACE,EACE,QAAQ,EACR,SAAS,EACT,KAAK,EACL,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,kBAAkB,EAClB,OAAO,GAAG,KAAK,EACf,UAAU,GAAG,SAAS,EACtB,cAAc,GACK,EACrB,OAA+B,KAC7B;AACF,IAAA,MAAM,QAAQ,GAAG,MAAM,CAAiB,IAAI,CAAqC;IACjF,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,GAC/E,oBAAoB,CAAC;AACnB,QAAA,YAAY,EAAE,QAAQ;QACtB,QAAQ;QACR,YAAY;QACZ,gBAAgB;QAChB,kBAAkB;AACnB,KAAA,CAAC;IAEJ,MAAM,oBAAoB,GAAG,CAAC,WAAW,IAAI,CAAC,CAAC,cAAc;AAC7D,IAAA,MAAM,0BAA0B,GAAG,CAAC,YAAY,IAAI,CAAC,aAAa;AAElE,IAAA,QACEA,cAAA,CAAA,aAAA,CAAC,OAAO,EAAA,EACN,SAAS,EAAE,eAAe,CAAC,CAAC,MAAM,CAAC,CAAA,WAAA,EAAc,UAAU,CAAE,CAAA,CAAC,EAAE,SAAS,CAAC,CAAC,EAC3E,cAAc,EAAC,eAAe,EAC9B,QAAQ,EAAC,QAAQ,EACjB,KAAK,EAAE,KAAK,EAAA;AAEZ,QAAAA,cAAA,CAAA,aAAA,CAAC,OAAO,EACN,EAAA,SAAS,EAAE,eAAe,CAAC,CAAC,MAAM,CAAC,Y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,CAAA,EACjE,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAC,MAAM,EAAA,YAAA,EACH,wBAAwB,EACnC,CAAA;oBACFA,cAAC,CAAA,aAAA,CAAA,MAAM,IACL,EAAE,EAAC,aAAa,EAChB,SAAS,EAAE,MAAM,CAAC,YAAY,EAC9B,QAAQ,EAAEA,cAAC,CAAA,aAAA,CAAA,cAAc,IAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAI,EAClE,QAAQ,EAAE,aAAa,EACvB,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAC,MAAM,EACH,YAAA,EAAA,yBAAyB,EACpC,CAAA,CACD,CACJ;AACA,gBAAA,CAAC,cAAc,IAAI,CAAC,CAAC,WAAW,KAC/BA,cAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EACL,SAAS,EAAE,MAAM,CAAC,UAAU,EAC5B,QAAQ,EAAEA,cAAC,CAAA,aAAA,CAAA,aAAa,EAAC,EAAA,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAA,CAAI,EACjE,OAAO,EAAC,MAAM,EACd,OAAO,EAAE,WAAW,EACT,YAAA,EAAA,WAAW,EACP,eAAA,EAAA,gBAAgB,mBAChB,gBAAgB,EAAA,eAAA,EAChB,gBAAgB,GAAG,QAAQ,GAAG,SAAS,EACtD,GAAG,EAAE,OAAO,EAAA,CACZ,CACH,CACG;YACL,cAAc,CACP,CACF;AAEd,CAAC;;;;"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var ___$insertStyle = require('../../_virtual/____insertStyle.cjs');
|
|
4
4
|
|
|
5
|
-
___$insertStyle(".
|
|
6
|
-
var styles = {"viewsWrapper":"
|
|
5
|
+
___$insertStyle("._viewsWrapper_1ht5y_1 {\n overflow-x: scroll;\n -ms-overflow-style: none; /* for Internet Explorer, Edge */\n scrollbar-width: none; /* for Firefox */\n height: inherit;\n padding: var(--sizes-sm) 6px var(--sizes-sm) var(--sizes-3);\n margin-left: 0;\n}\n._viewsWrapper_1ht5y_1 ::-webkit-scrollbar {\n display: none; /* for Chrome, Safari, and Opera */\n}\n._viewsWrapper_1ht5y_1._compact_1ht5y_12 {\n padding: var(--sizes-xs);\n}\n\n._appearance-primary_1ht5y_16 {\n background-color: var(--colors-neutral-grey-lightest);\n}\n\n._menuButton_1ht5y_20 {\n background-color: white !important;\n border-radius: var(--sizes-sm);\n}\n._menuButton_1ht5y_20:hover {\n background-color: var(--colors-neutral-grey-lightest);\n}\n\n._scrollButton_1ht5y_28 {\n background-color: white !important;\n}\n._scrollButton_1ht5y_28:disabled {\n background-color: white !important;\n}\n._scrollButton_1ht5y_28:disabled svg {\n color: var(--colors-neutral-ink-lightest);\n}\n._scrollButton_1ht5y_28:hover {\n background-color: var(--colors-neutral-grey-lightest);\n}\n\n._buttonGroup_1ht5y_41 {\n padding-right: var(--sizes-sm);\n}");
|
|
6
|
+
var styles = {"viewsWrapper":"_viewsWrapper_1ht5y_1","compact":"_compact_1ht5y_12","appearance-primary":"_appearance-primary_1ht5y_16","menuButton":"_menuButton_1ht5y_20","scrollButton":"_scrollButton_1ht5y_28","buttonGroup":"_buttonGroup_1ht5y_41"};
|
|
7
7
|
|
|
8
8
|
module.exports = styles;
|
|
9
9
|
//# sourceMappingURL=ViewsContainer.module.scss.cjs.map
|