@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.
Files changed (137) hide show
  1. package/dist/components/Alerts/Alert/Alert.cjs +2 -2
  2. package/dist/components/Alerts/Alert/Alert.cjs.map +1 -1
  3. package/dist/components/Alerts/Alert/Alert.js +2 -2
  4. package/dist/components/Alerts/Alert/Alert.js.map +1 -1
  5. package/dist/components/Flex/FlexCol/FlexCol.d.ts +3 -3
  6. package/dist/components/Flex/FlexRow/FlexRow.d.ts +3 -3
  7. package/dist/components/Flex/types.d.ts +13 -4
  8. package/dist/components/Pagination/styled.d.ts +3 -3
  9. package/dist/components/UploadFile/UploadFile.cjs +64 -83
  10. package/dist/components/UploadFile/UploadFile.cjs.map +1 -1
  11. package/dist/components/UploadFile/UploadFile.js +67 -86
  12. package/dist/components/UploadFile/UploadFile.js.map +1 -1
  13. package/dist/components/UploadFile/components/DropCopy/DropCopy.cjs +28 -0
  14. package/dist/components/UploadFile/components/DropCopy/DropCopy.cjs.map +1 -0
  15. package/dist/components/UploadFile/components/DropCopy/DropCopy.d.ts +2 -0
  16. package/dist/components/UploadFile/components/DropCopy/DropCopy.js +22 -0
  17. package/dist/components/UploadFile/components/DropCopy/DropCopy.js.map +1 -0
  18. package/dist/components/UploadFile/components/UploadCopy/UploadCopy.cjs +6 -6
  19. package/dist/components/UploadFile/components/UploadCopy/UploadCopy.cjs.map +1 -1
  20. package/dist/components/UploadFile/components/UploadCopy/UploadCopy.js +6 -6
  21. package/dist/components/UploadFile/components/UploadCopy/UploadCopy.js.map +1 -1
  22. package/dist/components/UploadFile/constants.cjs +71 -8
  23. package/dist/components/UploadFile/constants.cjs.map +1 -1
  24. package/dist/components/UploadFile/constants.d.ts +57 -5
  25. package/dist/components/UploadFile/constants.js +69 -9
  26. package/dist/components/UploadFile/constants.js.map +1 -1
  27. package/dist/components/UploadFile/hooks/useUploadFile/index.d.ts +1 -0
  28. package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.cjs +65 -0
  29. package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.cjs.map +1 -0
  30. package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.d.ts +9 -0
  31. package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.js +63 -0
  32. package/dist/components/UploadFile/hooks/useUploadFile/useUploadFile.js.map +1 -0
  33. package/dist/components/UploadFile/hooks/useValidateInput/index.d.ts +1 -0
  34. package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.cjs +48 -0
  35. package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.cjs.map +1 -0
  36. package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.d.ts +11 -0
  37. package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.js +46 -0
  38. package/dist/components/UploadFile/hooks/useValidateInput/useValidateInput.js.map +1 -0
  39. package/dist/components/UploadFile/index.d.ts +0 -1
  40. package/dist/components/UploadFile/mocks/files.d.ts +2 -0
  41. package/dist/components/UploadFile/mocks/mockUseUploadFile.d.ts +14 -0
  42. package/dist/components/UploadFile/mocks/utils.d.ts +1 -2
  43. package/dist/components/UploadFile/styled.cjs +40 -1
  44. package/dist/components/UploadFile/styled.cjs.map +1 -1
  45. package/dist/components/UploadFile/styled.d.ts +4 -1
  46. package/dist/components/UploadFile/styled.js +40 -1
  47. package/dist/components/UploadFile/styled.js.map +1 -1
  48. package/dist/components/UploadFile/types.d.ts +15 -1
  49. package/dist/components/UploadFile/utils/getErrorMessage/getErrorMessage.cjs +27 -0
  50. package/dist/components/UploadFile/utils/getErrorMessage/getErrorMessage.cjs.map +1 -0
  51. package/dist/components/UploadFile/utils/getErrorMessage/getErrorMessage.d.ts +8 -0
  52. package/dist/components/UploadFile/utils/getErrorMessage/getErrorMessage.js +25 -0
  53. package/dist/components/UploadFile/utils/getErrorMessage/getErrorMessage.js.map +1 -0
  54. package/dist/components/UploadFile/utils/getErrorMessage/index.d.ts +1 -0
  55. package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.cjs +14 -11
  56. package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.cjs.map +1 -1
  57. package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.d.ts +10 -7
  58. package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.js +14 -11
  59. package/dist/components/UploadFile/utils/getFileSizeString/getFileSizeString.js.map +1 -1
  60. package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.cjs +16 -30
  61. package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.cjs.map +1 -1
  62. package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.js +16 -30
  63. package/dist/components/UploadFile/utils/getValidTypesString/getValidTypesString.js.map +1 -1
  64. package/dist/components/UploadFile/utils/index.d.ts +0 -1
  65. package/dist/components/UploadedFile/UploadedFile.cjs +78 -0
  66. package/dist/components/UploadedFile/UploadedFile.cjs.map +1 -0
  67. package/dist/components/UploadedFile/UploadedFile.d.ts +12 -0
  68. package/dist/components/UploadedFile/UploadedFile.js +72 -0
  69. package/dist/components/UploadedFile/UploadedFile.js.map +1 -0
  70. package/dist/components/UploadedFile/UploadedFile.module.scss.cjs +9 -0
  71. package/dist/components/UploadedFile/UploadedFile.module.scss.cjs.map +1 -0
  72. package/dist/components/UploadedFile/UploadedFile.module.scss.js +7 -0
  73. package/dist/components/UploadedFile/UploadedFile.module.scss.js.map +1 -0
  74. package/dist/components/UploadedFile/hooks/useFileErrorMessages/index.d.ts +1 -0
  75. package/dist/components/UploadedFile/hooks/useFileErrorMessages/useFileErrorMessages.cjs +38 -0
  76. package/dist/components/UploadedFile/hooks/useFileErrorMessages/useFileErrorMessages.cjs.map +1 -0
  77. package/dist/components/UploadedFile/hooks/useFileErrorMessages/useFileErrorMessages.d.ts +18 -0
  78. package/dist/components/UploadedFile/hooks/useFileErrorMessages/useFileErrorMessages.js +36 -0
  79. package/dist/components/UploadedFile/hooks/useFileErrorMessages/useFileErrorMessages.js.map +1 -0
  80. package/dist/components/UploadedFile/hooks/usePreviewImage/index.d.ts +1 -0
  81. package/dist/components/UploadedFile/hooks/usePreviewImage/usePreviewImage.cjs +36 -0
  82. package/dist/components/UploadedFile/hooks/usePreviewImage/usePreviewImage.cjs.map +1 -0
  83. package/dist/components/UploadedFile/hooks/usePreviewImage/usePreviewImage.d.ts +8 -0
  84. package/dist/components/UploadedFile/hooks/usePreviewImage/usePreviewImage.js +34 -0
  85. package/dist/components/UploadedFile/hooks/usePreviewImage/usePreviewImage.js.map +1 -0
  86. package/dist/components/UploadedFile/index.d.ts +1 -0
  87. package/dist/components/UploadedFile/utils/convertFileTypeToAcceptedFileType/convertFileTypeToAcceptedFileType.cjs +17 -0
  88. package/dist/components/UploadedFile/utils/convertFileTypeToAcceptedFileType/convertFileTypeToAcceptedFileType.cjs.map +1 -0
  89. package/dist/components/UploadedFile/utils/convertFileTypeToAcceptedFileType/convertFileTypeToAcceptedFileType.d.ts +1 -0
  90. package/dist/components/UploadedFile/utils/convertFileTypeToAcceptedFileType/convertFileTypeToAcceptedFileType.js +15 -0
  91. package/dist/components/UploadedFile/utils/convertFileTypeToAcceptedFileType/convertFileTypeToAcceptedFileType.js.map +1 -0
  92. package/dist/components/UploadedFile/utils/convertFileTypeToAcceptedFileType/index.d.ts +1 -0
  93. package/dist/components/UploadedFile/utils/isImageType/index.d.ts +1 -0
  94. package/dist/components/UploadedFile/utils/isImageType/isImageType.cjs +14 -0
  95. package/dist/components/UploadedFile/utils/isImageType/isImageType.cjs.map +1 -0
  96. package/dist/components/UploadedFile/utils/isImageType/isImageType.d.ts +1 -0
  97. package/dist/components/UploadedFile/utils/isImageType/isImageType.js +12 -0
  98. package/dist/components/UploadedFile/utils/isImageType/isImageType.js.map +1 -0
  99. package/dist/components/ViewsContainer/ViewsContainer.cjs +4 -3
  100. package/dist/components/ViewsContainer/ViewsContainer.cjs.map +1 -1
  101. package/dist/components/ViewsContainer/ViewsContainer.js +4 -3
  102. package/dist/components/ViewsContainer/ViewsContainer.js.map +1 -1
  103. package/dist/components/ViewsContainer/ViewsContainer.module.scss.cjs +2 -2
  104. package/dist/components/ViewsContainer/ViewsContainer.module.scss.cjs.map +1 -1
  105. package/dist/components/ViewsContainer/ViewsContainer.module.scss.js +2 -2
  106. package/dist/components/ViewsContainer/ViewsContainer.module.scss.js.map +1 -1
  107. package/dist/components/index.d.ts +3 -1
  108. package/dist/index.cjs +2 -0
  109. package/dist/index.cjs.map +1 -1
  110. package/dist/index.js +1 -0
  111. package/dist/index.js.map +1 -1
  112. package/package.json +1 -1
  113. package/dist/components/UploadFile/UploadGraphic.cjs +0 -14
  114. package/dist/components/UploadFile/UploadGraphic.cjs.map +0 -1
  115. package/dist/components/UploadFile/UploadGraphic.d.ts +0 -2
  116. package/dist/components/UploadFile/UploadGraphic.js +0 -8
  117. package/dist/components/UploadFile/UploadGraphic.js.map +0 -1
  118. package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.cjs +0 -31
  119. package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.cjs.map +0 -1
  120. package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.d.ts +0 -7
  121. package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.js +0 -25
  122. package/dist/components/UploadFile/components/UploadFileErrors/UploadFileErrors.js.map +0 -1
  123. package/dist/components/UploadFile/components/UploadedFile/UploadedFile.cjs +0 -21
  124. package/dist/components/UploadFile/components/UploadedFile/UploadedFile.cjs.map +0 -1
  125. package/dist/components/UploadFile/components/UploadedFile/UploadedFile.d.ts +0 -8
  126. package/dist/components/UploadFile/components/UploadedFile/UploadedFile.js +0 -15
  127. package/dist/components/UploadFile/components/UploadedFile/UploadedFile.js.map +0 -1
  128. package/dist/components/UploadFile/components/UploadedFile/styled.cjs +0 -20
  129. package/dist/components/UploadFile/components/UploadedFile/styled.cjs.map +0 -1
  130. package/dist/components/UploadFile/components/UploadedFile/styled.d.ts +0 -2
  131. package/dist/components/UploadFile/components/UploadedFile/styled.js +0 -13
  132. package/dist/components/UploadFile/components/UploadedFile/styled.js.map +0 -1
  133. package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.cjs +0 -18
  134. package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.cjs.map +0 -1
  135. package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.d.ts +0 -13
  136. package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.js +0 -16
  137. package/dist/components/UploadFile/utils/setInputElFile/setInputElFile.js.map +0 -1
@@ -26,8 +26,8 @@ const Alert = ({ size = 'base', variant = 'default', colours: passedColours, rig
26
26
  Alerts_module[`${variant}-alert-variant`],
27
27
  className,
28
28
  ]), flexWrap: "nowrap", ...divProps },
29
- React__default.default.createElement(FlexRow.FlexRow, { alignItems: isXsSize ? 'center' : 'start', flexWrap: "nowrap", className: Alert_module.iconTextContainer },
30
- React__default.default.createElement(FlexRow.FlexRow, { style: assignCssVars.assignCssVars({ iconColor: passedColours === null || passedColours === undefined ? undefined : passedColours.primary }), className: Alerts_module.icon, alignItems: "start" }, iconSlot || React__default.default.createElement(DefaultIcon, { role: "presentation" })),
29
+ React__default.default.createElement(FlexRow.FlexRow, { alignItems: isXsSize ? 'center' : 'flex-start', flexWrap: "nowrap", className: Alert_module.iconTextContainer },
30
+ React__default.default.createElement(FlexRow.FlexRow, { style: assignCssVars.assignCssVars({ iconColor: passedColours === null || passedColours === undefined ? undefined : passedColours.primary }), className: Alerts_module.icon, alignItems: "flex-start" }, iconSlot || React__default.default.createElement(DefaultIcon, { role: "presentation" })),
31
31
  children || (React__default.default.createElement(FlexCol.FlexCol, { gap: isXsSize ? 'xs' : 'sm' },
32
32
  titleSlot || (React__default.default.createElement(Text.Text, { variant: "bodyBold", style: size === 'base' ? { lineHeight: '24px' } : {} }, title)),
33
33
  messageSlot || React__default.default.createElement(Text.Text, { variant: "body" }, message)))),
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.cjs","sources":["../../../../src/components/Alerts/Alert/Alert.tsx"],"sourcesContent":["import React from 'react';\n\nimport { Text } from '../../Text';\nimport { Button } from '../../Button';\nimport { CrossIcon } from '../../../icons';\nimport { IconMap } from '../constants';\nimport { AlertProps } from './types';\nimport { FlexRow } from '../../Flex/FlexRow';\nimport { FlexCol } from '../../Flex/FlexCol';\nimport { assignCssVars, buildClassnames } from '../../../utils';\n\nimport alertStyles from '../Alerts.module.scss';\nimport styles from './Alert.module.scss';\n\nexport const Alert = ({\n size = 'base',\n variant = 'default',\n colours: passedColours,\n rightActions,\n rightActionsSlot,\n title,\n titleSlot,\n messageSlot,\n message,\n children,\n iconSlot,\n onClickClose,\n className,\n ...divProps\n}: AlertProps) => {\n const DefaultIcon = IconMap[variant];\n\n const isXsSize = size === 'xs';\n\n return (\n <FlexRow\n justifyContent=\"space-between\"\n className={buildClassnames([\n styles.alertContainer,\n styles[`${size}-size`],\n alertStyles[`${variant}-alert-variant`],\n className,\n ])}\n flexWrap=\"nowrap\"\n {...divProps}\n >\n <FlexRow\n alignItems={isXsSize ? 'center' : 'start'}\n flexWrap=\"nowrap\"\n className={styles.iconTextContainer}\n >\n <FlexRow\n style={assignCssVars({ iconColor: passedColours?.primary })}\n className={alertStyles.icon}\n alignItems=\"start\"\n >\n {iconSlot || <DefaultIcon role=\"presentation\" />}\n </FlexRow>\n\n {children || (\n <FlexCol gap={isXsSize ? 'xs' : 'sm'}>\n {titleSlot || (\n <Text variant=\"bodyBold\" style={size === 'base' ? { lineHeight: '24px' } : {}}>\n {title}\n </Text>\n )}\n {messageSlot || <Text variant=\"body\">{message}</Text>}\n </FlexCol>\n )}\n </FlexRow>\n\n <FlexRow justifyContent=\"flex-end\" flexWrap=\"nowrap\" className={styles.rightActionsContainer}>\n {rightActionsSlot}\n\n {rightActions && (\n <FlexCol justifyContent=\"center\" className={styles.rightActions}>\n {rightActions.map(({ label, ...actionProps }) => (\n <Button key={label} type=\"button\" size=\"sm\" {...actionProps}>\n {label}\n </Button>\n ))}\n </FlexCol>\n )}\n\n {onClickClose && (\n <FlexCol className={styles.closeContainer}>\n <Button\n variant=\"flat\"\n iconSlot={<CrossIcon />}\n onClick={onClickClose}\n aria-label=\"Close\"\n size=\"sm\"\n />\n </FlexCol>\n )}\n </FlexRow>\n </FlexRow>\n );\n};\n"],"names":["IconMap","React","FlexRow","buildClassnames","styles","alertStyles","assignCssVars","FlexCol","Text","Button","CrossIcon"],"mappings":";;;;;;;;;;;;;;;;;;;AAca,MAAA,KAAK,GAAG,CAAC,EACpB,IAAI,GAAG,MAAM,EACb,OAAO,GAAG,SAAS,EACnB,OAAO,EAAE,aAAa,EACtB,YAAY,EACZ,gBAAgB,EAChB,KAAK,EACL,SAAS,EACT,WAAW,EACX,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,GAAG,QAAQ,EACA,KAAI;AACf,IAAA,MAAM,WAAW,GAAGA,iBAAO,CAAC,OAAO,CAAC;AAEpC,IAAA,MAAM,QAAQ,GAAG,IAAI,KAAK,IAAI;IAE9B,QACEC,sBAAC,CAAA,aAAA,CAAAC,eAAO,EACN,EAAA,cAAc,EAAC,eAAe,EAC9B,SAAS,EAAEC,+BAAe,CAAC;AACzB,YAAAC,YAAM,CAAC,cAAc;AACrB,YAAAA,YAAM,CAAC,CAAA,EAAG,IAAI,CAAA,KAAA,CAAO,CAAC;AACtB,YAAAC,aAAW,CAAC,CAAA,EAAG,OAAO,CAAA,cAAA,CAAgB,CAAC;YACvC,SAAS;AACV,SAAA,CAAC,EACF,QAAQ,EAAC,QAAQ,KACb,QAAQ,EAAA;QAEZJ,sBAAC,CAAA,aAAA,CAAAC,eAAO,IACN,UAAU,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,EACzC,QAAQ,EAAC,QAAQ,EACjB,SAAS,EAAEE,YAAM,CAAC,iBAAiB,EAAA;AAEnC,YAAAH,sBAAA,CAAA,aAAA,CAACC,eAAO,EACN,EAAA,KAAK,EAAEI,2BAAa,C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AEA,YAAY,KACXR,sBAAC,CAAA,aAAA,CAAAM,eAAO,IAAC,SAAS,EAAEH,YAAM,CAAC,cAAc,EAAA;gBACvCH,sBAAC,CAAA,aAAA,CAAAQ,aAAM,EACL,EAAA,OAAO,EAAC,MAAM,EACd,QAAQ,EAAER,sBAAA,CAAA,aAAA,CAACS,wBAAS,EAAA,IAAA,CAAG,EACvB,OAAO,EAAE,YAAY,EACV,YAAA,EAAA,OAAO,EAClB,IAAI,EAAC,IAAI,EACT,CAAA,CACM,CACX,CACO,CACF;AAEd;;;;"}
1
+ {"version":3,"file":"Alert.cjs","sources":["../../../../src/components/Alerts/Alert/Alert.tsx"],"sourcesContent":["import React from 'react';\n\nimport { Text } from '../../Text';\nimport { Button } from '../../Button';\nimport { CrossIcon } from '../../../icons';\nimport { IconMap } from '../constants';\nimport { AlertProps } from './types';\nimport { FlexRow } from '../../Flex/FlexRow';\nimport { FlexCol } from '../../Flex/FlexCol';\nimport { assignCssVars, buildClassnames } from '../../../utils';\n\nimport alertStyles from '../Alerts.module.scss';\nimport styles from './Alert.module.scss';\n\nexport const Alert = ({\n size = 'base',\n variant = 'default',\n colours: passedColours,\n rightActions,\n rightActionsSlot,\n title,\n titleSlot,\n messageSlot,\n message,\n children,\n iconSlot,\n onClickClose,\n className,\n ...divProps\n}: AlertProps) => {\n const DefaultIcon = IconMap[variant];\n\n const isXsSize = size === 'xs';\n\n return (\n <FlexRow\n justifyContent=\"space-between\"\n className={buildClassnames([\n styles.alertContainer,\n styles[`${size}-size`],\n alertStyles[`${variant}-alert-variant`],\n className,\n ])}\n flexWrap=\"nowrap\"\n {...divProps}\n >\n <FlexRow\n alignItems={isXsSize ? 'center' : 'flex-start'}\n flexWrap=\"nowrap\"\n className={styles.iconTextContainer}\n >\n <FlexRow\n style={assignCssVars({ iconColor: passedColours?.primary })}\n className={alertStyles.icon}\n alignItems=\"flex-start\"\n >\n {iconSlot || <DefaultIcon role=\"presentation\" />}\n </FlexRow>\n\n {children || (\n <FlexCol gap={isXsSize ? 'xs' : 'sm'}>\n {titleSlot || (\n <Text variant=\"bodyBold\" style={size === 'base' ? { lineHeight: '24px' } : {}}>\n {title}\n </Text>\n )}\n {messageSlot || <Text variant=\"body\">{message}</Text>}\n </FlexCol>\n )}\n </FlexRow>\n\n <FlexRow justifyContent=\"flex-end\" flexWrap=\"nowrap\" className={styles.rightActionsContainer}>\n {rightActionsSlot}\n\n {rightActions && (\n <FlexCol justifyContent=\"center\" className={styles.rightActions}>\n {rightActions.map(({ label, ...actionProps }) => (\n <Button key={label} type=\"button\" size=\"sm\" {...actionProps}>\n {label}\n </Button>\n ))}\n </FlexCol>\n )}\n\n {onClickClose && (\n <FlexCol className={styles.closeContainer}>\n <Button\n variant=\"flat\"\n iconSlot={<CrossIcon />}\n onClick={onClickClose}\n aria-label=\"Close\"\n size=\"sm\"\n />\n </FlexCol>\n )}\n </FlexRow>\n </FlexRow>\n );\n};\n"],"names":["IconMap","React","FlexRow","buildClassnames","styles","alertStyles","assignCssVars","FlexCol","Text","Button","CrossIcon"],"mappings":";;;;;;;;;;;;;;;;;;;AAca,MAAA,KAAK,GAAG,CAAC,EACpB,IAAI,GAAG,MAAM,EACb,OAAO,GAAG,SAAS,EACnB,OAAO,EAAE,aAAa,EACtB,YAAY,EACZ,gBAAgB,EAChB,KAAK,EACL,SAAS,EACT,WAAW,EACX,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,GAAG,QAAQ,EACA,KAAI;AACf,IAAA,MAAM,WAAW,GAAGA,iBAAO,CAAC,OAAO,CAAC;AAEpC,IAAA,MAAM,QAAQ,GAAG,IAAI,KAAK,IAAI;IAE9B,QACEC,sBAAC,CAAA,aAAA,CAAAC,eAAO,EACN,EAAA,cAAc,EAAC,eAAe,EAC9B,SAAS,EAAEC,+BAAe,CAAC;AACzB,YAAAC,YAAM,CAAC,cAAc;AACrB,YAAAA,YAAM,CAAC,CAAA,EAAG,IAAI,CAAA,KAAA,CAAO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gBAAgB;YAEhB,YAAY,KACXH,sBAAA,CAAA,aAAA,CAACM,eAAO,EAAA,EAAC,cAAc,EAAC,QAAQ,EAAC,SAAS,EAAEH,YAAM,CAAC,YAAY,EAAA,EAC5D,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,WAAW,EAAE,MAC1CH,sBAAA,CAAA,aAAA,CAACQ,aAAM,EAAA,EAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAC,IAAI,EAAA,GAAK,WAAW,EAAA,EACxD,KAAK,CACC,CACV,CAAC,CACM,CACX;YAEA,YAAY,KACXR,sBAAC,CAAA,aAAA,CAAAM,eAAO,IAAC,SAAS,EAAEH,YAAM,CAAC,cAAc,EAAA;gBACvCH,sBAAC,CAAA,aAAA,CAAAQ,aAAM,EACL,EAAA,OAAO,EAAC,MAAM,EACd,QAAQ,EAAER,sBAAA,CAAA,aAAA,CAACS,wBAAS,EAAA,IAAA,CAAG,EACvB,OAAO,EAAE,YAAY,EACV,YAAA,EAAA,OAAO,EAClB,IAAI,EAAC,IAAI,EACT,CAAA,CACM,CACX,CACO,CACF;AAEd;;;;"}
@@ -20,8 +20,8 @@ const Alert = ({ size = 'base', variant = 'default', colours: passedColours, rig
20
20
  alertStyles[`${variant}-alert-variant`],
21
21
  className,
22
22
  ]), flexWrap: "nowrap", ...divProps },
23
- React__default.createElement(FlexRow, { alignItems: isXsSize ? 'center' : 'start', flexWrap: "nowrap", className: styles.iconTextContainer },
24
- React__default.createElement(FlexRow, { style: assignCssVars({ iconColor: passedColours === null || passedColours === undefined ? undefined : passedColours.primary }), className: alertStyles.icon, alignItems: "start" }, iconSlot || React__default.createElement(DefaultIcon, { role: "presentation" })),
23
+ React__default.createElement(FlexRow, { alignItems: isXsSize ? 'center' : 'flex-start', flexWrap: "nowrap", className: styles.iconTextContainer },
24
+ React__default.createElement(FlexRow, { style: assignCssVars({ iconColor: passedColours === null || passedColours === undefined ? undefined : passedColours.primary }), className: alertStyles.icon, alignItems: "flex-start" }, iconSlot || React__default.createElement(DefaultIcon, { role: "presentation" })),
25
25
  children || (React__default.createElement(FlexCol, { gap: isXsSize ? 'xs' : 'sm' },
26
26
  titleSlot || (React__default.createElement(Text, { variant: "bodyBold", style: size === 'base' ? { lineHeight: '24px' } : {} }, title)),
27
27
  messageSlot || React__default.createElement(Text, { variant: "body" }, message)))),
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.js","sources":["../../../../src/components/Alerts/Alert/Alert.tsx"],"sourcesContent":["import React from 'react';\n\nimport { Text } from '../../Text';\nimport { Button } from '../../Button';\nimport { CrossIcon } from '../../../icons';\nimport { IconMap } from '../constants';\nimport { AlertProps } from './types';\nimport { FlexRow } from '../../Flex/FlexRow';\nimport { FlexCol } from '../../Flex/FlexCol';\nimport { assignCssVars, buildClassnames } from '../../../utils';\n\nimport alertStyles from '../Alerts.module.scss';\nimport styles from './Alert.module.scss';\n\nexport const Alert = ({\n size = 'base',\n variant = 'default',\n colours: passedColours,\n rightActions,\n rightActionsSlot,\n title,\n titleSlot,\n messageSlot,\n message,\n children,\n iconSlot,\n onClickClose,\n className,\n ...divProps\n}: AlertProps) => {\n const DefaultIcon = IconMap[variant];\n\n const isXsSize = size === 'xs';\n\n return (\n <FlexRow\n justifyContent=\"space-between\"\n className={buildClassnames([\n styles.alertContainer,\n styles[`${size}-size`],\n alertStyles[`${variant}-alert-variant`],\n className,\n ])}\n flexWrap=\"nowrap\"\n {...divProps}\n >\n <FlexRow\n alignItems={isXsSize ? 'center' : 'start'}\n flexWrap=\"nowrap\"\n className={styles.iconTextContainer}\n >\n <FlexRow\n style={assignCssVars({ iconColor: passedColours?.primary })}\n className={alertStyles.icon}\n alignItems=\"start\"\n >\n {iconSlot || <DefaultIcon role=\"presentation\" />}\n </FlexRow>\n\n {children || (\n <FlexCol gap={isXsSize ? 'xs' : 'sm'}>\n {titleSlot || (\n <Text variant=\"bodyBold\" style={size === 'base' ? { lineHeight: '24px' } : {}}>\n {title}\n </Text>\n )}\n {messageSlot || <Text variant=\"body\">{message}</Text>}\n </FlexCol>\n )}\n </FlexRow>\n\n <FlexRow justifyContent=\"flex-end\" flexWrap=\"nowrap\" className={styles.rightActionsContainer}>\n {rightActionsSlot}\n\n {rightActions && (\n <FlexCol justifyContent=\"center\" className={styles.rightActions}>\n {rightActions.map(({ label, ...actionProps }) => (\n <Button key={label} type=\"button\" size=\"sm\" {...actionProps}>\n {label}\n </Button>\n ))}\n </FlexCol>\n )}\n\n {onClickClose && (\n <FlexCol className={styles.closeContainer}>\n <Button\n variant=\"flat\"\n iconSlot={<CrossIcon />}\n onClick={onClickClose}\n aria-label=\"Close\"\n size=\"sm\"\n />\n </FlexCol>\n )}\n </FlexRow>\n </FlexRow>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;AAca,MAAA,KAAK,GAAG,CAAC,EACpB,IAAI,GAAG,MAAM,EACb,OAAO,GAAG,SAAS,EACnB,OAAO,EAAE,aAAa,EACtB,YAAY,EACZ,gBAAgB,EAChB,KAAK,EACL,SAAS,EACT,WAAW,EACX,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,GAAG,QAAQ,EACA,KAAI;AACf,IAAA,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;AAEpC,IAAA,MAAM,QAAQ,GAAG,IAAI,KAAK,IAAI;IAE9B,QACEA,cAAC,CAAA,aAAA,CAAA,OAAO,EACN,EAAA,cAAc,EAAC,eAAe,EAC9B,SAAS,EAAE,eAAe,CAAC;AACzB,YAAA,MAAM,CAAC,cAAc;AACrB,YAAA,MAAM,CAAC,CAAA,EAAG,IAAI,CAAA,KAAA,CAAO,CAAC;AACtB,YAAA,WAAW,CAAC,CAAA,EAAG,OAAO,CAAA,cAAA,CAAgB,CAAC;YACvC,SAAS;AACV,SAAA,CAAC,EACF,QAAQ,EAAC,QAAQ,KACb,QAAQ,EAAA;QAEZA,cAAC,CAAA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,GAAG,WAAW,EAAE,MAC1CA,cAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAC,IAAI,EAAA,GAAK,WAAW,EAAA,EACxD,KAAK,CACC,CACV,CAAC,CACM,CACX;YAEA,YAAY,KACXA,cAAC,CAAA,aAAA,CAAA,OAAO,IAAC,SAAS,EAAE,MAAM,CAAC,cAAc,EAAA;gBACvCA,cAAC,CAAA,aAAA,CAAA,MAAM,EACL,EAAA,OAAO,EAAC,MAAM,EACd,QAAQ,EAAEA,cAAA,CAAA,aAAA,CAAC,SAAS,EAAA,IAAA,CAAG,EACvB,OAAO,EAAE,YAAY,EACV,YAAA,EAAA,OAAO,EAClB,IAAI,EAAC,IAAI,EACT,CAAA,CACM,CACX,CACO,CACF;AAEd;;;;"}
1
+ {"version":3,"file":"Alert.js","sources":["../../../../src/components/Alerts/Alert/Alert.tsx"],"sourcesContent":["import React from 'react';\n\nimport { Text } from '../../Text';\nimport { Button } from '../../Button';\nimport { CrossIcon } from '../../../icons';\nimport { IconMap } from '../constants';\nimport { AlertProps } from './types';\nimport { FlexRow } from '../../Flex/FlexRow';\nimport { FlexCol } from '../../Flex/FlexCol';\nimport { assignCssVars, buildClassnames } from '../../../utils';\n\nimport alertStyles from '../Alerts.module.scss';\nimport styles from './Alert.module.scss';\n\nexport const Alert = ({\n size = 'base',\n variant = 'default',\n colours: passedColours,\n rightActions,\n rightActionsSlot,\n title,\n titleSlot,\n messageSlot,\n message,\n children,\n iconSlot,\n onClickClose,\n className,\n ...divProps\n}: AlertProps) => {\n const DefaultIcon = IconMap[variant];\n\n const isXsSize = size === 'xs';\n\n return (\n <FlexRow\n justifyContent=\"space-between\"\n className={buildClassnames([\n styles.alertContainer,\n styles[`${size}-size`],\n alertStyles[`${variant}-alert-variant`],\n className,\n ])}\n flexWrap=\"nowrap\"\n {...divProps}\n >\n <FlexRow\n alignItems={isXsSize ? 'center' : 'flex-start'}\n flexWrap=\"nowrap\"\n className={styles.iconTextContainer}\n >\n <FlexRow\n style={assignCssVars({ iconColor: passedColours?.primary })}\n className={alertStyles.icon}\n alignItems=\"flex-start\"\n >\n {iconSlot || <DefaultIcon role=\"presentation\" />}\n </FlexRow>\n\n {children || (\n <FlexCol gap={isXsSize ? 'xs' : 'sm'}>\n {titleSlot || (\n <Text variant=\"bodyBold\" style={size === 'base' ? { lineHeight: '24px' } : {}}>\n {title}\n </Text>\n )}\n {messageSlot || <Text variant=\"body\">{message}</Text>}\n </FlexCol>\n )}\n </FlexRow>\n\n <FlexRow justifyContent=\"flex-end\" flexWrap=\"nowrap\" className={styles.rightActionsContainer}>\n {rightActionsSlot}\n\n {rightActions && (\n <FlexCol justifyContent=\"center\" className={styles.rightActions}>\n {rightActions.map(({ label, ...actionProps }) => (\n <Button key={label} type=\"button\" size=\"sm\" {...actionProps}>\n {label}\n </Button>\n ))}\n </FlexCol>\n )}\n\n {onClickClose && (\n <FlexCol className={styles.closeContainer}>\n <Button\n variant=\"flat\"\n iconSlot={<CrossIcon />}\n onClick={onClickClose}\n aria-label=\"Close\"\n size=\"sm\"\n />\n </FlexCol>\n )}\n </FlexRow>\n </FlexRow>\n );\n};\n"],"names":["React"],"mappings":";;;;;;;;;;;;;AAca,MAAA,KAAK,GAAG,CAAC,EACpB,IAAI,GAAG,MAAM,EACb,OAAO,GAAG,SAAS,EACnB,OAAO,EAAE,aAAa,EACtB,YAAY,EACZ,gBAAgB,EAChB,KAAK,EACL,SAAS,EACT,WAAW,EACX,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,GAAG,QAAQ,EACA,KAAI;AACf,IAAA,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;AAEpC,IAAA,MAAM,QAAQ,GAAG,IAAI,KAAK,IAAI;IAE9B,QACEA,cAAC,CAAA,aAAA,CAAA,OAAO,EACN,EAAA,cAAc,EAAC,eAAe,EAC9B,SAAS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EAAC,UAAU,EAAC,QAAQ,EAAC,QAAQ,EAAC,SAAS,EAAE,MAAM,CAAC,qBAAqB,EAAA;YACzF,gBAAgB;YAEhB,YAAY,KACXA,cAAA,CAAA,aAAA,CAAC,OAAO,EAAA,EAAC,cAAc,EAAC,QAAQ,EAAC,SAAS,EAAE,MAAM,CAAC,YAAY,EAAA,EAC5D,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,WAAW,EAAE,MAC1CA,cAAA,CAAA,aAAA,CAAC,MAAM,EAAA,EAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAC,IAAI,EAAA,GAAK,WAAW,EAAA,EACxD,KAAK,CACC,CACV,CAAC,CACM,CACX;YAEA,YAAY,KACXA,cAAC,CAAA,aAAA,CAAA,OAAO,IAAC,SAAS,EAAE,MAAM,CAAC,cAAc,EAAA;gBACvCA,cAAC,CAAA,aAAA,CAAA,MAAM,EACL,EAAA,OAAO,EAAC,MAAM,EACd,QAAQ,EAAEA,cAAA,CAAA,aAAA,CAAC,SAAS,EAAA,IAAA,CAAG,EACvB,OAAO,EAAE,YAAY,EACV,YAAA,EAAA,OAAO,EAClB,IAAI,EAAC,IAAI,EACT,CAAA,CACM,CACX,CACO,CACF;AAEd;;;;"}
@@ -2,9 +2,9 @@ import React from 'react';
2
2
  import { FlexDefaultProps } from '../types';
3
3
  export declare const FLEX_COL_DEFAULT_PROPS: FlexDefaultProps;
4
4
  export declare const FlexCol: React.ForwardRefExoticComponent<{
5
- alignItems?: import("csstype").Property.AlignItems | undefined;
6
- justifyContent?: import("csstype").Property.JustifyContent | undefined;
5
+ alignItems?: ("baseline" | "center" | "stretch" | "flex-end" | "flex-start") | undefined;
6
+ justifyContent?: ("center" | "space-around" | "space-between" | "space-evenly" | "flex-end" | "flex-start") | undefined;
7
7
  gap?: keyof import("../../../theme/modules/sizes").SizeScale | undefined;
8
- flexWrap?: import("csstype").Property.FlexWrap | undefined;
8
+ flexWrap?: ("wrap" | "nowrap" | "wrap-reverse") | undefined;
9
9
  flexGrow?: import("csstype").Property.FlexGrow | undefined;
10
10
  } & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
@@ -2,9 +2,9 @@ import React from 'react';
2
2
  import { FlexDefaultProps } from '../types';
3
3
  export declare const FLEX_ROW_DEFAULT_PROPS: FlexDefaultProps;
4
4
  export declare const FlexRow: React.ForwardRefExoticComponent<{
5
- alignItems?: import("csstype").Property.AlignItems | undefined;
6
- justifyContent?: import("csstype").Property.JustifyContent | undefined;
5
+ alignItems?: ("baseline" | "center" | "stretch" | "flex-end" | "flex-start") | undefined;
6
+ justifyContent?: ("center" | "space-around" | "space-between" | "space-evenly" | "flex-end" | "flex-start") | undefined;
7
7
  gap?: keyof import("../../../theme/modules/sizes").SizeScale | undefined;
8
- flexWrap?: import("csstype").Property.FlexWrap | undefined;
8
+ flexWrap?: ("wrap" | "nowrap" | "wrap-reverse") | undefined;
9
9
  flexGrow?: import("csstype").Property.FlexGrow | undefined;
10
10
  } & React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
@@ -1,11 +1,20 @@
1
1
  import { CSSProperties, HTMLAttributes } from 'react';
2
2
  declare const sizes: import("../../theme/modules/sizes").SizeScale;
3
+ type JustifyContentValues = 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around' | 'space-evenly';
4
+ type AlignItemsValues = 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline';
5
+ type FlexWrapValues = 'nowrap' | 'wrap' | 'wrap-reverse';
3
6
  export type FlexProps = {
4
- alignItems?: CSSProperties['alignItems'];
5
- justifyContent?: CSSProperties['justifyContent'];
7
+ alignItems?: AlignItemsValues;
8
+ justifyContent?: JustifyContentValues;
6
9
  gap?: keyof typeof sizes;
7
- flexWrap?: CSSProperties['flexWrap'];
10
+ flexWrap?: FlexWrapValues;
8
11
  flexGrow?: CSSProperties['flexGrow'];
9
12
  } & HTMLAttributes<HTMLDivElement>;
10
- export type FlexDefaultProps = Pick<CSSProperties, 'alignItems' | 'justifyContent' | 'gap' | 'flexWrap' | 'flexGrow'>;
13
+ export type FlexDefaultProps = {
14
+ alignItems: AlignItemsValues;
15
+ justifyContent: JustifyContentValues;
16
+ gap: keyof typeof sizes;
17
+ flexWrap: FlexWrapValues;
18
+ flexGrow: CSSProperties['flexGrow'];
19
+ };
11
20
  export {};
@@ -1,9 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  export declare const PageLimitContainer: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<{
3
- alignItems?: import("csstype").Property.AlignItems | undefined;
4
- justifyContent?: import("csstype").Property.JustifyContent | undefined;
3
+ alignItems?: ("baseline" | "center" | "stretch" | "flex-end" | "flex-start") | undefined;
4
+ justifyContent?: ("center" | "space-around" | "space-between" | "space-evenly" | "flex-end" | "flex-start") | undefined;
5
5
  gap?: keyof import("../../theme/modules/sizes").SizeScale | undefined;
6
- flexWrap?: import("csstype").Property.FlexWrap | undefined;
6
+ flexWrap?: ("wrap" | "nowrap" | "wrap-reverse") | undefined;
7
7
  flexGrow?: import("csstype").Property.FlexGrow | undefined;
8
8
  } & import("react").HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>, any, {}, never>;
9
9
  export declare const PaginationButton: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
@@ -1,143 +1,124 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
+ var index = require('../../theme/index.cjs');
5
+ var CriticalIcon = require('../../icons/design-system/components/CriticalIcon.cjs');
6
+ var LockIcon = require('../../icons/design-system/components/LockIcon.cjs');
4
7
  var styled$1 = require('./styled.cjs');
5
8
  var constants = require('./constants.cjs');
6
9
  var UploadCopy = require('./components/UploadCopy/UploadCopy.cjs');
7
- var setInputElFile = require('./utils/setInputElFile/setInputElFile.cjs');
10
+ var DropCopy = require('./components/DropCopy/DropCopy.cjs');
8
11
  var getValidTypesString = require('./utils/getValidTypesString/getValidTypesString.cjs');
9
12
  var getFileSizeString = require('./utils/getFileSizeString/getFileSizeString.cjs');
10
13
  var getTypePropForInputEl = require('./utils/getTypePropForInputEl/getTypePropForInputEl.cjs');
11
14
  var styled = require('../../hoc/withLabels/styled.cjs');
12
- var UploadFileErrors = require('./components/UploadFileErrors/UploadFileErrors.cjs');
13
- var UploadedFile = require('./components/UploadedFile/UploadedFile.cjs');
15
+ var UploadedFile = require('../UploadedFile/UploadedFile.cjs');
14
16
  var FlexCol = require('../Flex/FlexCol/FlexCol.cjs');
17
+ var FlexRow = require('../Flex/FlexRow/FlexRow.cjs');
18
+ var useUploadFile = require('./hooks/useUploadFile/useUploadFile.cjs');
19
+ var useValidateInput = require('./hooks/useValidateInput/useValidateInput.cjs');
15
20
 
16
21
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
17
22
 
18
23
  var React__default = /*#__PURE__*/_interopDefaultCompat(React);
19
24
 
20
- const UploadFile = React.forwardRef(({ id, name, maxBytes = 1000000, format = constants.FileSizeUnit.MB, fileTypes, label = 'Upload file', required, disabled, ...otherProps }, outerRef) => {
21
- const inputRef = React.useRef(null);
22
- React.useImperativeHandle(outerRef, () => inputRef.current, []);
23
- const [file, setFile] = React.useState();
24
- const [errorState, setErrorState] = React.useState(constants.InputState.VALID);
25
- const isInvalidFormat = errorState === constants.InputState.INVALID_FORMAT || errorState === constants.InputState.INVALID_FORMAT_AND_SIZE;
26
- const isOverMaxSize = errorState === constants.InputState.INVALID_SIZE || errorState === constants.InputState.INVALID_FORMAT_AND_SIZE;
25
+ const UploadFile = React.forwardRef(({ id, name, maxBytes = constants.DEFAULT_MAXIMUM_FILE_BYTES, format = constants.FileSizeUnit.MB, fileTypes, disabled, multiple, label = multiple ? 'Upload files' : 'Upload file', hideUploadedFiles = false, onMaxFilesExceeded, maxFiles = constants.DEFAULT_MAXIMUM_MULTIPLE_FILES, disabledMessage, isDirty, errorMessage = '', ...otherProps }, outerRef) => {
26
+ var _a, _b;
27
+ const { inputRef, fileList, setFileList, onCancel, removeFileFromList, clearFileSelection } = useUploadFile.useUploadFile();
28
+ useValidateInput.useValidateInput({ inputRef, fileList, fileTypes, maxBytes, errorMessage });
29
+ React.useImperativeHandle(outerRef, () => inputRef.current, [inputRef]);
30
+ const [isDragOver, setIsDragOver] = React.useState(false);
27
31
  // Computed properties based on params
28
32
  const maxSizeCopy = getFileSizeString.getFileSizeString({ maxBytes, format });
29
33
  const acceptedTypesCopy = getValidTypesString.getValidTypesString({ fileTypes });
30
34
  const acceptedTypesForInputEl = getTypePropForInputEl.getTypePropForInputEl({ fileTypes });
31
- const clearFileSelection = () => {
32
- var _a;
33
- if ((_a = inputRef.current) === null || _a === undefined ? undefined : _a.value)
34
- inputRef.current.value = '';
35
- };
36
- // Tracks error states within the input element itself, using preset
37
- // error messages and assigns these to the input component based on the file
38
- const setInputValidation = ({ overMaxSize, invalidFormat, }) => {
39
- var _a;
40
- let error = constants.InputState.VALID;
41
- if (invalidFormat && !overMaxSize) {
42
- error = constants.InputState.INVALID_FORMAT;
43
- }
44
- else if (!invalidFormat && overMaxSize) {
45
- error = constants.InputState.INVALID_SIZE;
46
- }
47
- else if (invalidFormat && overMaxSize) {
48
- error = constants.InputState.INVALID_FORMAT_AND_SIZE;
35
+ const validateMaximumFiles = React.useCallback((files) => {
36
+ if ((files === null || files === undefined ? undefined : files.length) && (files === null || files === undefined ? undefined : files.length) > maxFiles) {
37
+ clearFileSelection();
38
+ onMaxFilesExceeded === null || onMaxFilesExceeded === undefined ? undefined : onMaxFilesExceeded();
39
+ return false;
49
40
  }
50
- (_a = inputRef.current) === null || _a === undefined ? undefined : _a.setCustomValidity(error);
51
- setErrorState(error);
52
- };
41
+ return true;
42
+ }, [clearFileSelection, maxFiles, onMaxFilesExceeded]);
53
43
  // Processes file and updates the UI appropriately:
54
44
  const updateFiles = React.useCallback((files) => {
55
45
  if (!files.length) {
56
- setInputValidation({ invalidFormat: true });
57
46
  return;
58
47
  }
59
- const [newFile] = files;
60
- const hasExceededMaxSize = newFile.size > maxBytes;
61
- const [, extension] = newFile.type.split('/');
62
- const isTypeValid = fileTypes.find((validType) => validType.substring(1) === extension);
63
- const hasInvalidFormat = !isTypeValid;
64
- if (hasExceededMaxSize || hasInvalidFormat) {
65
- // Empty the inputRef's read-only fileList by clearing the value attribute,
66
- // since we have an invalid input.
67
- clearFileSelection();
68
- }
69
- else {
70
- // Update the files attribute of the input el, with the new file(s)
71
- setInputElFile.setInputElFile({ fileList: files, elementId: id });
72
- }
73
- setInputValidation({
74
- invalidFormat: hasInvalidFormat,
75
- overMaxSize: hasExceededMaxSize,
76
- });
77
- setFile(newFile);
78
- }, [fileTypes, id, maxBytes]);
48
+ setFileList(files);
49
+ }, [setFileList]);
79
50
  // For focussing of input el and updating drop UI
80
51
  const onDragEnter = (event) => {
81
52
  var _a;
82
53
  event.preventDefault();
54
+ setIsDragOver(true);
83
55
  (_a = inputRef.current) === null || _a === undefined ? undefined : _a.focus();
84
56
  };
85
57
  // For unfocussing of input el and updating drop UI
86
58
  const onDragLeave = (event) => {
87
- var _a;
88
59
  event.preventDefault();
89
- (_a = inputRef.current) === null || _a === undefined ? undefined : _a.blur();
60
+ setIsDragOver(false);
90
61
  };
91
62
  // Prevents default browser behaviour
92
63
  const onDragOver = (event) => event.preventDefault();
93
64
  // Process file when dropped into eligible area
94
65
  const onDrop = (event) => {
95
66
  event.preventDefault();
67
+ setIsDragOver(false);
96
68
  // Prevent reactions on dragging events that do not contain files
97
69
  if (!event.dataTransfer.files.length)
98
70
  return;
99
- updateFiles(event.dataTransfer.files);
71
+ const canUpdateFiles = validateMaximumFiles(event.dataTransfer.files);
72
+ if (canUpdateFiles) {
73
+ updateFiles(event.dataTransfer.files);
74
+ }
100
75
  };
101
- // Removes input el's files, clears errors and removes file from react component
102
- const resetSelection = React.useCallback(() => {
103
- clearFileSelection();
104
- setFile(undefined);
105
- setInputValidation({
106
- invalidFormat: false,
107
- overMaxSize: false,
108
- });
109
- }, []);
110
76
  // Updates UI based on a native file input change. Attached via useEffect below
111
- const onInputChange = React.useCallback(() => {
112
- var _a;
113
- const files = (_a = inputRef === null || inputRef === undefined ? undefined : inputRef.current) === null || _a === undefined ? undefined : _a.files;
114
- if ((files === null || files === undefined ? undefined : files.length) && (files === null || files === undefined ? undefined : files.length) > 0)
77
+ const onChange = React.useCallback(() => {
78
+ var _a, _b;
79
+ const canUpdateFiles = validateMaximumFiles((_a = inputRef === null || inputRef === undefined ? undefined : inputRef.current) === null || _a === undefined ? undefined : _a.files);
80
+ const files = (_b = inputRef === null || inputRef === undefined ? undefined : inputRef.current) === null || _b === undefined ? undefined : _b.files;
81
+ if (canUpdateFiles && files) {
115
82
  updateFiles(files);
116
- else
117
- resetSelection();
118
- }, [resetSelection, updateFiles]);
83
+ }
84
+ else if (fileList) {
85
+ updateFiles(fileList);
86
+ }
87
+ }, [validateMaximumFiles, inputRef, fileList, updateFiles]);
119
88
  React.useEffect(() => {
120
89
  const ref = inputRef === null || inputRef === undefined ? undefined : inputRef.current;
121
- ref === null || ref === undefined ? undefined : ref.addEventListener('change', onInputChange);
122
- ref === null || ref === undefined ? undefined : ref.addEventListener('cancel', resetSelection);
90
+ ref === null || ref === undefined ? undefined : ref.addEventListener('change', onChange);
91
+ ref === null || ref === undefined ? undefined : ref.addEventListener('cancel', onCancel);
123
92
  return () => {
124
- ref === null || ref === undefined ? undefined : ref.removeEventListener('change', onInputChange);
125
- ref === null || ref === undefined ? undefined : ref.removeEventListener('cancel', resetSelection);
93
+ ref === null || ref === undefined ? undefined : ref.removeEventListener('change', onChange);
94
+ ref === null || ref === undefined ? undefined : ref.removeEventListener('cancel', onCancel);
126
95
  };
127
- }, [onInputChange, resetSelection]);
96
+ }, [onChange, onCancel, inputRef]);
97
+ const hasError = !!((errorMessage || ((_a = inputRef.current) === null || _a === undefined ? undefined : _a.validationMessage)) && !(fileList === null || fileList === undefined ? undefined : fileList.length));
128
98
  return (React__default.default.createElement(styled.RootStack, { spacing: "xs", alignX: "stretch" },
129
99
  React__default.default.createElement(styled.Label, { htmlFor: id },
130
100
  label,
131
101
  React__default.default.createElement(FlexCol.FlexCol, null,
132
102
  React__default.default.createElement(styled.Hint, null,
133
- React__default.default.createElement("div", null, acceptedTypesCopy),
134
- React__default.default.createElement("div", null, maxSizeCopy)),
135
- React__default.default.createElement(styled$1.DropZoneContainer, { "data-testid": "drop-zone-container", onDrop: onDrop, onDragEnter: onDragEnter, onDragOver: onDragOver, onDragLeave: onDragLeave },
136
- React__default.default.createElement(UploadCopy.UploadCopy, null),
137
- React__default.default.createElement("input", { ref: inputRef, id: id, type: "file", accept: acceptedTypesForInputEl, name: name, required: required, disabled: disabled, ...otherProps })))),
103
+ maxSizeCopy,
104
+ React__default.default.createElement("br", null),
105
+ acceptedTypesCopy),
106
+ React__default.default.createElement(styled$1.DropZoneContainer, { hasError: hasError, isDragOver: isDragOver, "data-testid": "drop-zone-container", onDrop: onDrop, onDragEnter: onDragEnter, onDragOver: onDragOver, onDragLeave: onDragLeave },
107
+ isDragOver ? React__default.default.createElement(DropCopy.DropCopy, null) : React__default.default.createElement(UploadCopy.UploadCopy, null),
108
+ React__default.default.createElement("input", { ref: inputRef, id: id, type: "file", accept: acceptedTypesForInputEl, name: name, disabled: disabled, multiple: multiple, ...otherProps })))),
138
109
  React__default.default.createElement(FlexCol.FlexCol, null,
139
- React__default.default.createElement(UploadedFile.UploadedFile, { file: file, resetSelection: resetSelection, disabled: disabled }),
140
- React__default.default.createElement(UploadFileErrors.UploadFileErrors, { acceptedTypesCopy: isInvalidFormat ? acceptedTypesCopy : undefined, maxSizeCopy: isOverMaxSize ? maxSizeCopy : undefined }))));
110
+ hasError && (React__default.default.createElement(FlexRow.FlexRow, null,
111
+ React__default.default.createElement(CriticalIcon.ReactComponent, { width: index.theme.sizes.base, height: index.theme.sizes.base, color: index.theme.colors.secondary.red.base }),
112
+ React__default.default.createElement(styled.Error, null, errorMessage || ((_b = inputRef.current) === null || _b === undefined ? undefined : _b.validationMessage)))),
113
+ disabledMessage && (React__default.default.createElement(FlexRow.FlexRow, { id: `${id}-disabled` },
114
+ React__default.default.createElement(LockIcon.ReactComponent, { width: index.theme.sizes.base, height: index.theme.sizes.base, color: index.theme.colors.neutral.ink.light }),
115
+ React__default.default.createElement(styled.Disabled, null, disabledMessage))),
116
+ !hideUploadedFiles &&
117
+ fileList && [
118
+ Array.from(fileList).map((file) => {
119
+ return (React__default.default.createElement(UploadedFile.UploadedFile, { key: `${file.name}`, file: file, onRemoveFile: removeFileFromList, disabled: disabled, format: format, maxBytes: maxBytes, fileTypes: fileTypes }));
120
+ }),
121
+ ])));
141
122
  });
142
123
 
143
124
  exports.UploadFile = UploadFile;
@@ -1 +1 @@
1
- {"version":3,"file":"UploadFile.cjs","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":["forwardRef","FileSizeUnit","useRef","useImperativeHandle","useState","InputState","getFileSizeString","getValidTypesString","getTypePropForInputEl","useCallback","setInputElFile","useEffect","React","RootStack","Label","FlexCol","Hint","DropZoneContainer","UploadCopy","UploadedFile","UploadFileErrors"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBa,MAAA,UAAU,GAAGA,gBAAU,CAClC,CACE,EACE,EAAE,EACF,IAAI,EACJ,QAAQ,GAAG,OAAO,EAClB,MAAM,GAAGC,sBAAY,CAAC,EAAE,EACxB,SAAS,EACT,KAAK,GAAG,aAAa,EACrB,QAAQ,EACR,QAAQ,EACR,GAAG,UAAU,EACG,EAClB,QAAQ,KACN;AACF,IAAA,MAAM,QAAQ,GAAGC,YAAM,CAA0B,IAAI,CAAC;AACtD,IAAAC,yBAAmB,CAAC,QAAQ,EAAE,MAAM,QAAQ,CAAC,OAAQ,EAAE,EAAE,CAAC;IAE1D,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAGC,cAAQ,EAAQ;AACxC,IAAA,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAGA,cAAQ,CAACC,oBAAU,CAAC,KAAK,CAAC;AAE9D,IAAA,MAAM,eAAe,GACnB,UAAU,KAAKA,oBAAU,CAAC,cAAc,IAAI,UAAU,KAAKA,oBAAU,CAAC,uBAAuB;AAC/F,IAAA,MAAM,aAAa,GACjB,UAAU,KAAKA,oBAAU,CAAC,YAAY,IAAI,UAAU,KAAKA,oBAAU,CAAC,uBAAuB;;IAG7F,MAAM,WAAW,GAAGC,mCAAiB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAC3D,MAAM,iBAAiB,GAAGC,uCAAmB,CAAC,EAAE,SAAS,EAAE,CAAC;IAC5D,MAAM,uBAAu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A,CACgB,CACZ,CACJ;AACR,QAAAA,sBAAA,CAAA,aAAA,CAACG,eAAO,EAAA,IAAA;AACN,YAAAH,sBAAA,CAAA,aAAA,CAACO,yBAAY,EAAA,EAAC,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAI,CAAA;AAChF,YAAAP,sBAAA,CAAA,aAAA,CAACQ,iCAAgB,EAAA,EACf,iBAAiB,EAAE,eAAe,GAAG,iBAAiB,GAAG,SAAS,EAClE,WAAW,EAAE,aAAa,GAAG,WAAW,GAAG,SAAS,EAAA,CACpD,CACM,CACA;AAEhB,CAAC;;;;"}
1
+ {"version":3,"file":"UploadFile.cjs","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 {\n FileSizeUnit,\n DEFAULT_MAXIMUM_MULTIPLE_FILES,\n DEFAULT_MAXIMUM_FILE_BYTES,\n} 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 '../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 = DEFAULT_MAXIMUM_FILE_BYTES,\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 isDirty,\n errorMessage = '',\n ...otherProps\n }: UploadFileProps,\n outerRef,\n ) => {\n const { inputRef, fileList, setFileList, onCancel, removeFileFromList, clearFileSelection } =\n useUploadFile();\n\n useValidateInput({ inputRef, fileList, fileTypes, maxBytes, errorMessage });\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 hasError = !!((errorMessage || inputRef.current?.validationMessage) && !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 hasError={hasError}\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 {hasError && (\n <FlexRow>\n <CriticalIcon\n width={theme.sizes.base}\n height={theme.sizes.base}\n color={theme.colors.secondary.red.base}\n />\n <Error>{errorMessage || inputRef.current?.validationMessage}</Error>\n </FlexRow>\n )}\n {disabledMessage && (\n <FlexRow id={`${id}-disabled`}>\n <LockIcon\n width={theme.sizes.base}\n height={theme.sizes.base}\n color={theme.colors.neutral.ink.light}\n />\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 onRemoveFile={removeFileFromList}\n disabled={disabled}\n format={format}\n maxBytes={maxBytes}\n fileTypes={fileTypes}\n />\n );\n }),\n ]}\n </FlexCol>\n </RootStack>\n );\n },\n);\n"],"names":["forwardRef","DEFAULT_MAXIMUM_FILE_BYTES","FileSizeUnit","DEFAULT_MAXIMUM_MULTIPLE_FILES","useUploadFile","useValidateInput","useImperativeHandle","useState","getFileSizeString","getValidTypesString","getTypePropForInputEl","useCallback","useEffect","React","RootStack","Label","FlexCol","Hint","DropZoneContainer","DropCopy","UploadCopy","FlexRow","CriticalIcon","theme","Error","LockIcon","Disabled","UploadedFile"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA2BO,MAAM,UAAU,GAAGA,gBAAU,CAClC,CACE,EACE,EAAE,EACF,IAAI,EACJ,QAAQ,GAAGC,oCAA0B,EACrC,MAAM,GAAGC,sBAAY,CAAC,EAAE,EACxB,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,KAAK,GAAG,QAAQ,GAAG,cAAc,GAAG,aAAa,EACjD,iBAAiB,GAAG,KAAK,EACzB,kBAAkB,EAClB,QAAQ,GAAGC,wCAA8B,EACzC,eAAe,EACf,OAAO,EACP,YAAY,GAAG,EAAE,EACjB,GAAG,UAAU,EACG,EAClB,QAAQ,KACN;;AACF,IAAA,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,GACzFC,2BAAa,EAAE;AAEjB,IAAAC,iCAAgB,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;AAE3E,IAAAC,yBAAmB,CAAC,QAAQ,EAAE,MAAM,QAAQ,CAAC,OAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC;IAElE,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAGC,cAAQ,CAAC,KAAK,CAAC;;IAGnD,MAAM,WAAW,GAAGC,mCAAiB,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC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