@procore/core-react 12.17.0 → 12.17.2
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/AnchorNavigation/AnchorNavigation.styles.js +3 -3
- package/dist/Avatar/Avatar.styles.js +5 -5
- package/dist/AvatarStack/AvatarStack.styles.js +7 -7
- package/dist/Badge/Badge.styles.js +2 -2
- package/dist/Banner/Banner.styles.js +10 -10
- package/dist/Box/Box.styles.js +1 -1
- package/dist/Breadcrumbs/Breadcrumbs.styles.js +4 -4
- package/dist/Button/Button.styles.js +5 -5
- package/dist/Calendar/Calendar.styles.js +8 -8
- package/dist/Card/Card.js +8 -2
- package/dist/Card/Card.js.map +1 -1
- package/dist/Card/Card.styles.js +1 -1
- package/dist/Checkbox/Checkbox.js +0 -1
- package/dist/Checkbox/Checkbox.js.map +1 -1
- package/dist/Checkbox/Checkbox.styles.js +6 -6
- package/dist/Checkbox/CheckboxTooltip.js +1 -1
- package/dist/ContactItem/ContactItem.styles.js +5 -5
- package/dist/Content/Content.styles.js +2 -2
- package/dist/DateInput/DateInput.styles.js +6 -6
- package/dist/DetailPage/DetailPage.styles.js +7 -7
- package/dist/Dropdown/Dropdown.styles.js +3 -3
- package/dist/DropdownFlyout/DropdownFlyout.styles.js +4 -4
- package/dist/Dropzone/Dropzone.hooks.js +8 -6
- package/dist/Dropzone/Dropzone.hooks.js.map +1 -1
- package/dist/Dropzone/Dropzone.js +45 -45
- package/dist/Dropzone/Dropzone.js.map +1 -1
- package/dist/Dropzone/Dropzone.styles.js +9 -9
- package/dist/Dropzone/Dropzone.utils.d.ts +3 -0
- package/dist/Dropzone/Dropzone.utils.js +7 -0
- package/dist/Dropzone/Dropzone.utils.js.map +1 -0
- package/dist/EmptyState/EmptyState.styles.js +6 -6
- package/dist/Field/Field.styles.js +3 -3
- package/dist/FileList/FileList.styles.js +4 -4
- package/dist/FileSelect/FileExplorer/FileExplorer.styles.js +9 -9
- package/dist/FileSelect/FileExplorer/FileExplorerSidebar.styles.js +3 -3
- package/dist/FileSelect/FileSelect.styles.js +2 -2
- package/dist/FileSelect/FileSelectDropzone/FileSelectDropzone.styles.js +3 -3
- package/dist/FileSelect/FileTokenList/FileTokenList.styles.js +2 -2
- package/dist/FileSelect/GridSource/GridSource.styles.js +6 -6
- package/dist/FileSelect/LocalSource/LocalSource.styles.js +4 -4
- package/dist/FileSelect/SourceItem/SourceItem.styles.js +3 -3
- package/dist/FileSelect/ThumbnailList/ThumbnailList.styles.js +6 -6
- package/dist/FileSelect/TreeSource/TreeSource.styles.js +1 -1
- package/dist/FileToken/FileToken.styles.js +4 -4
- package/dist/FilterToken/FilterToken.styles.js +2 -2
- package/dist/FlexList/FlexList.styles.js +1 -1
- package/dist/Form/Form.styles.js +14 -14
- package/dist/Form/StyledFormikForm.styles.js +2 -2
- package/dist/GhostPlaceholder/GhostPlaceholder.styles.js +2 -2
- package/dist/Grid/Grid.styles.js +2 -2
- package/dist/GroupSelect/GroupSelect.styles.js +1 -1
- package/dist/Input/Input.styles.js +1 -1
- package/dist/Link/Link.styles.js +1 -1
- package/dist/ListPage/ListPage.styles.js +8 -8
- package/dist/Loader/Loader.styles.js +2 -2
- package/dist/MenuImperative/MenuImperative.js +4 -1
- package/dist/MenuImperative/MenuImperative.js.map +1 -1
- package/dist/MenuImperative/MenuImperative.styles.js +10 -10
- package/dist/Modal/Modal.styles.js +13 -13
- package/dist/MultiSelect/MultiSelect.js +7 -1
- package/dist/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/MultiSelect/MultiSelect.styles.js +6 -6
- package/dist/NextMenu/NextMenu.styles.js +3 -3
- package/dist/Notation/Notation.js +1 -1
- package/dist/NumberInput/NumberInput.styles.js +7 -7
- package/dist/Overlay/OverlayArrow.styles.js +1 -1
- package/dist/PageFooterTemplate/PageFooterTemplate.styles.js +1 -1
- package/dist/PageHeaderTemplate/PageHeaderTemplate.styles.js +3 -3
- package/dist/PageLayout/PageLayout.styles.js +16 -16
- package/dist/PagePaneTemplate/PagePaneTemplate.styles.js +2 -2
- package/dist/PageTemplate/PageTemplate.styles.js +3 -3
- package/dist/Pagination/Pagination.styles.js +5 -5
- package/dist/Panel/Panel.styles.js +11 -11
- package/dist/Pill/Pill.styles.js +2 -2
- package/dist/PillSelect/PillSelect.styles.js +4 -4
- package/dist/Popover/Popover.styles.js +2 -2
- package/dist/Portal/Portal.styles.js +1 -1
- package/dist/ProgressBar/ProgressBar.styles.js +2 -2
- package/dist/RadioButton/RadioButton.styles.js +3 -3
- package/dist/Required/Required.styles.js +3 -3
- package/dist/Search/Search.styles.js +5 -5
- package/dist/Search/Search.types.d.ts +12 -2
- package/dist/Search/Search.types.js.map +1 -1
- package/dist/Section/Section.styles.js +7 -7
- package/dist/SegmentedController/SegmentedController.styles.js +4 -4
- package/dist/Select/Select.js +1 -1
- package/dist/Select/Select.js.map +1 -1
- package/dist/Select/Select.styles.js +7 -7
- package/dist/Semantic/Semantic.styles.js +9 -9
- package/dist/Slider/Slider.styles.js +5 -5
- package/dist/Spinner/Spinner.styles.js +7 -7
- package/dist/SplitViewCard/SplitViewCard.styles.js +8 -8
- package/dist/SuperSelect/SuperSelect.presets.styles.js +1 -1
- package/dist/SuperSelect/SuperSelect.styles.js +37 -37
- package/dist/SuperSelect/SuperSelect.types.d.ts +1 -0
- package/dist/SuperSelect/SuperSelect.types.js.map +1 -1
- package/dist/SuperSelect/useSuperSelect.d.ts +1 -1
- package/dist/SuperSelect/useSuperSelect.js +9 -5
- package/dist/SuperSelect/useSuperSelect.js.map +1 -1
- package/dist/Switch/Switch.styles.js +4 -4
- package/dist/Table/Table.styles.js +28 -28
- package/dist/TableShelf/TableShelf.styles.js +5 -5
- package/dist/Tabs/Tabs.styles.js +15 -15
- package/dist/Tearsheet/Tearsheet.styles.js +5 -5
- package/dist/TextArea/TextArea.styles.js +1 -1
- package/dist/TextEditorOutput/TextEditorOutput.styles.js +1 -1
- package/dist/Thumbnail/Thumbnail.styles.js +17 -17
- package/dist/ThumbnailGrid/ThumbnailGrid.styles.js +7 -7
- package/dist/TieredSelect/TieredSelect.styles.js +9 -9
- package/dist/Tile/Tile.styles.js +8 -8
- package/dist/Title/Title.styles.js +7 -7
- package/dist/Toast/Toast.styles.js +3 -3
- package/dist/ToggleButton/ToggleButton.styles.js +1 -1
- package/dist/Token/Token.styles.js +3 -3
- package/dist/ToolHeader/ToolHeader.styles.js +6 -6
- package/dist/ToolLandingPage/ToolLandingPage.styles.js +3 -3
- package/dist/Tooltip/Tooltip.styles.js +2 -2
- package/dist/Tree/Tree.styles.js +9 -9
- package/dist/Typeahead/Typeahead.styles.js +3 -3
- package/dist/Typography/Typography.styles.js +1 -1
- package/dist/Typography/Typography.table.story.js +2 -2
- package/dist/_hooks/I18n.d.ts +42 -0
- package/dist/_locales/de-DE.json +11 -9
- package/dist/_locales/en-AU.json +11 -9
- package/dist/_locales/en-CA.json +11 -9
- package/dist/_locales/en-GB.json +11 -9
- package/dist/_locales/en.json +16 -9
- package/dist/_locales/es-ES.json +11 -9
- package/dist/_locales/es.json +11 -9
- package/dist/_locales/fr-CA.json +11 -9
- package/dist/_locales/fr-FR.json +11 -9
- package/dist/_locales/is-IS.json +11 -9
- package/dist/_locales/ja-JP.json +11 -9
- package/dist/_locales/pl-PL.json +15 -13
- package/dist/_locales/pseudo.json +16 -9
- package/dist/_locales/pt-BR.json +11 -9
- package/dist/_locales/th-TH.json +11 -9
- package/dist/_locales/zh-SG.json +11 -9
- package/dist/_typedoc/Avatar/Avatar.types.json +20 -20
- package/dist/_typedoc/AvatarStack/AvatarStack.types.json +24 -24
- package/dist/_typedoc/Badge/Badge.types.json +6 -6
- package/dist/_typedoc/Banner/Banner.types.json +13 -13
- package/dist/_typedoc/Box/Box.types.json +68 -68
- package/dist/_typedoc/Breadcrumbs/Breadcrumbs.types.json +10 -10
- package/dist/_typedoc/Button/Button.types.json +12 -12
- package/dist/_typedoc/Calendar/Calendar.types.json +80 -80
- package/dist/_typedoc/Card/Card.types.json +6 -6
- package/dist/_typedoc/Checkbox/Checkbox.types.json +9 -9
- package/dist/_typedoc/ContactItem/ContactItem.types.json +9 -9
- package/dist/_typedoc/DateInput/DateInput.types.json +35 -35
- package/dist/_typedoc/DateSelect/DateSelect.types.json +13 -13
- package/dist/_typedoc/DetailPage/DetailPage.types.json +5 -5
- package/dist/_typedoc/Dropdown/Dropdown.types.json +37 -37
- package/dist/_typedoc/DropdownFlyout/DropdownFlyout.types.json +29 -29
- package/dist/_typedoc/Dropzone/Dropzone.types.json +41 -41
- package/dist/_typedoc/EmptyState/EmptyState.types.json +14 -14
- package/dist/_typedoc/FileList/FileList.types.json +9 -9
- package/dist/_typedoc/FileSelect/FileSelect.types.json +26 -26
- package/dist/_typedoc/FileSelect/GridSource/GridSource.types.json +20 -20
- package/dist/_typedoc/FileSelect/LocalSource/LocalSource.types.json +14 -14
- package/dist/_typedoc/FileSelect/TreeSource/TreeSource.types.json +9 -9
- package/dist/_typedoc/Flex/Flex.types.json +27 -27
- package/dist/_typedoc/FlexList/FlexList.types.json +30 -30
- package/dist/_typedoc/Form/Form.types.json +741 -741
- package/dist/_typedoc/GhostPlaceholder/GhostPlaceholder.types.json +12 -12
- package/dist/_typedoc/Grid/Grid.types.json +8 -8
- package/dist/_typedoc/GroupSelect/GroupSelect.types.json +52 -52
- package/dist/_typedoc/Input/Input.types.json +2 -2
- package/dist/_typedoc/Link/Link.types.json +4 -4
- package/dist/_typedoc/ListPage/ListPage.types.json +13 -13
- package/dist/_typedoc/Menu/Menu.types.json +62 -62
- package/dist/_typedoc/MenuImperative/MenuImperative.types.json +74 -74
- package/dist/_typedoc/Modal/Modal.types.json +46 -46
- package/dist/_typedoc/MultiSelect/MultiSelect.types.json +31 -31
- package/dist/_typedoc/Notation/Notation.types.json +4 -4
- package/dist/_typedoc/NumberInput/NumberInput.types.json +37 -37
- package/dist/_typedoc/OverlayTrigger/OverlayTrigger.types.json +31 -31
- package/dist/_typedoc/PageLayout/PageLayout.types.json +29 -29
- package/dist/_typedoc/Pagination/Pagination.types.json +7 -7
- package/dist/_typedoc/Panel/Panel.types.json +28 -28
- package/dist/_typedoc/Pill/Pill.types.json +2 -2
- package/dist/_typedoc/PillSelect/PillSelect.types.json +49 -49
- package/dist/_typedoc/Popover/Popover.types.json +14 -14
- package/dist/_typedoc/ProgressBar/ProgressBar.types.json +6 -6
- package/dist/_typedoc/RadioButton/RadioButton.types.json +6 -6
- package/dist/_typedoc/Required/Required.types.json +5 -5
- package/dist/_typedoc/Search/Search.types.json +35 -21
- package/dist/_typedoc/Section/Section.types.json +15 -15
- package/dist/_typedoc/SegmentedController/SegmentedController.types.json +20 -20
- package/dist/_typedoc/Select/Select.types.json +60 -60
- package/dist/_typedoc/SettingsPage/SettingsPage.types.json +10 -10
- package/dist/_typedoc/Slider/Slider.types.json +6 -6
- package/dist/_typedoc/Spinner/Spinner.types.json +9 -9
- package/dist/_typedoc/SplitViewCard/SplitViewCard.types.json +12 -12
- package/dist/_typedoc/Switch/Switch.types.json +3 -3
- package/dist/_typedoc/Table/Table.types.json +101 -101
- package/dist/_typedoc/Tabs/Tabs.types.json +19 -19
- package/dist/_typedoc/Tearsheet/Tearsheet.types.json +16 -16
- package/dist/_typedoc/TextArea/TextArea.types.json +3 -3
- package/dist/_typedoc/TextEditor/TextEditor.types.json +9 -9
- package/dist/_typedoc/TextEditorOutput/TextEditorOutput.types.json +4 -4
- package/dist/_typedoc/Thumbnail/Thumbnail.types.json +19 -19
- package/dist/_typedoc/TieredDropdown/TieredDropdown.types.json +42 -42
- package/dist/_typedoc/TieredSelect/TieredSelect.types.json +28 -28
- package/dist/_typedoc/Tile/Tile.types.json +30 -30
- package/dist/_typedoc/Title/Title.types.json +1 -1
- package/dist/_typedoc/Toast/Toast.types.json +4 -4
- package/dist/_typedoc/ToggleButton/ToggleButton.types.json +4 -4
- package/dist/_typedoc/Token/Token.types.json +4 -4
- package/dist/_typedoc/ToolHeader/ToolHeader.types.json +10 -10
- package/dist/_typedoc/ToolLandingPage/ToolLandingPage.types.json +7 -7
- package/dist/_typedoc/Tooltip/Tooltip.types.json +13 -13
- package/dist/_typedoc/Tree/Tree.types.json +86 -86
- package/dist/_typedoc/Typeahead/Typeahead.types.json +2 -2
- package/dist/_typedoc/Typography/Typography.types.json +9 -9
- package/dist/_typedoc/_utils/types.json +3 -3
- package/dist/_typedoc/deprecations.json +1 -1
- package/package.json +2 -2
|
@@ -5,15 +5,15 @@ import { Card } from '../Card/Card';
|
|
|
5
5
|
import { Spinner } from '../Spinner/Spinner';
|
|
6
6
|
export var StyledDropdownMenu = /*#__PURE__*/styled(Card).withConfig({
|
|
7
7
|
displayName: "StyledDropdownMenu",
|
|
8
|
-
componentId: "core-
|
|
8
|
+
componentId: "core-12_17_2__sc-ufsy2q-0"
|
|
9
9
|
})(["display:flex;max-height:40vh;max-width:248px;min-width:inherit;"]);
|
|
10
10
|
export var StyledDropdownSpinner = /*#__PURE__*/styled(Spinner).withConfig({
|
|
11
11
|
displayName: "StyledDropdownSpinner",
|
|
12
|
-
componentId: "core-
|
|
12
|
+
componentId: "core-12_17_2__sc-ufsy2q-1"
|
|
13
13
|
})(["margin:0 6px;"]);
|
|
14
14
|
export var StyledDropdownButton = /*#__PURE__*/styled(Button).withConfig({
|
|
15
15
|
displayName: "StyledDropdownButton",
|
|
16
|
-
componentId: "core-
|
|
16
|
+
componentId: "core-12_17_2__sc-ufsy2q-2"
|
|
17
17
|
})(["pointer-events:", ";", ""], function (_ref) {
|
|
18
18
|
var disabled = _ref.disabled,
|
|
19
19
|
$loading = _ref.$loading;
|
|
@@ -6,18 +6,18 @@ import { getEllipsis } from '../_styles/mixins';
|
|
|
6
6
|
import { spacing } from '../_styles/spacing';
|
|
7
7
|
export var StyledDropdownFlyout = /*#__PURE__*/styled.div.withConfig({
|
|
8
8
|
displayName: "StyledDropdownFlyout",
|
|
9
|
-
componentId: "core-
|
|
9
|
+
componentId: "core-12_17_2__sc-1i79jsg-0"
|
|
10
10
|
})(["display:flex;flex-wrap:wrap;flex-direction:column;width:100%;max-height:855px;padding:", "px 0;"], spacing.sm);
|
|
11
11
|
export var StyledDropdownFlyoutItem = /*#__PURE__*/styled.div.withConfig({
|
|
12
12
|
displayName: "StyledDropdownFlyoutItem",
|
|
13
|
-
componentId: "core-
|
|
13
|
+
componentId: "core-12_17_2__sc-1i79jsg-1"
|
|
14
14
|
})(["display:flex;justify-content:space-between;cursor:pointer;width:100%;padding:", "px ", "px;color:", ";", " &[data-highlighted='true'],&:hover{background-color:", ";}"], spacing.xs, spacing.lg, colors.gray20, getTypographyIntent('body'), colors.gray96);
|
|
15
15
|
export var StyledDropdownFlyoutLabel = /*#__PURE__*/styled.span.withConfig({
|
|
16
16
|
displayName: "StyledDropdownFlyoutLabel",
|
|
17
|
-
componentId: "core-
|
|
17
|
+
componentId: "core-12_17_2__sc-1i79jsg-2"
|
|
18
18
|
})(["", ""], getEllipsis());
|
|
19
19
|
export var StyledDropdownFlyoutExpandIcon = /*#__PURE__*/styled.span.withConfig({
|
|
20
20
|
displayName: "StyledDropdownFlyoutExpandIcon",
|
|
21
|
-
componentId: "core-
|
|
21
|
+
componentId: "core-12_17_2__sc-1i79jsg-3"
|
|
22
22
|
})(["position:relative;display:inline-flex;align-self:center;flex-shrink:0;margin-left:", "px;white-space:nowrap;", ""], spacing.lg, arrowRight(4, 'black'));
|
|
23
23
|
//# sourceMappingURL=DropdownFlyout.styles.js.map
|
|
@@ -25,6 +25,7 @@ import { partition } from '../_utils/partition';
|
|
|
25
25
|
import { MultipleErrors } from './Dropzone';
|
|
26
26
|
import { StyledErrorBannerDetails } from './Dropzone.styles';
|
|
27
27
|
import { dropErrors, fileRejectionReason } from './Dropzone.types';
|
|
28
|
+
import { getFileDetail, isZeroSize } from './Dropzone.utils';
|
|
28
29
|
var oneDropAtATimeRejectionReason = 'one-drop-at-a-time';
|
|
29
30
|
var dropErrorsByReason = (_dropErrorsByReason = {}, _defineProperty(_dropErrorsByReason, fileRejectionReason.maxFiles, dropErrors.fileAmount), _defineProperty(_dropErrorsByReason, fileRejectionReason.maxFileSize, dropErrors.maxFileSize), _defineProperty(_dropErrorsByReason, fileRejectionReason.minFileSize, dropErrors.minFileSize), _defineProperty(_dropErrorsByReason, fileRejectionReason.fileType, dropErrors.fileType), _dropErrorsByReason);
|
|
30
31
|
var getSizeInMB = function getSizeInMB(maxSize) {
|
|
@@ -76,10 +77,10 @@ export var useDropzone = function useDropzone() {
|
|
|
76
77
|
};
|
|
77
78
|
var dropErrorReducer = function dropErrorReducer(state, action) {
|
|
78
79
|
var rejectedFiles = /*#__PURE__*/React.createElement(StyledErrorBannerDetails, null, fileRejections.map(function (_ref2) {
|
|
79
|
-
var
|
|
80
|
+
var file = _ref2.file;
|
|
80
81
|
return /*#__PURE__*/React.createElement("li", {
|
|
81
|
-
key: name
|
|
82
|
-
},
|
|
82
|
+
key: file.name
|
|
83
|
+
}, getFileDetail(file));
|
|
83
84
|
}));
|
|
84
85
|
var title = I18n.t('core.dropzone.errorTitle');
|
|
85
86
|
switch (action) {
|
|
@@ -115,12 +116,13 @@ export var useDropzone = function useDropzone() {
|
|
|
115
116
|
body: rejectedFiles
|
|
116
117
|
};
|
|
117
118
|
case dropErrors.minFileSize:
|
|
119
|
+
var message = isZeroSize(minSize) ? I18n.t('core.dropzone.standaloneZeroFileSizeError') : I18n.t('core.dropzone.standaloneMinFileSizeError', {
|
|
120
|
+
sizeInMegabytes: getSizeInMB(minSize)
|
|
121
|
+
});
|
|
118
122
|
return {
|
|
119
123
|
type: dropErrors.minFileSize,
|
|
120
124
|
title: title,
|
|
121
|
-
message:
|
|
122
|
-
sizeInMegabytes: getSizeInMB(minSize)
|
|
123
|
-
}),
|
|
125
|
+
message: message,
|
|
124
126
|
body: rejectedFiles
|
|
125
127
|
};
|
|
126
128
|
case dropErrors.multipleErrors:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropzone.hooks.js","names":["React","useDropzone","useDropzoneBase","useI18nContext","partition","MultipleErrors","StyledErrorBannerDetails","dropErrors","fileRejectionReason","oneDropAtATimeRejectionReason","dropErrorsByReason","_dropErrorsByReason","_defineProperty","maxFiles","fileAmount","maxFileSize","minFileSize","fileType","getSizeInMB","maxSize","_ref","arguments","length","undefined","_ref$value","value","_ref$disabled","disabled","_ref$multiple","multiple","_ref$noClick","noClick","_ref$noKeyboard","noKeyboard","onDragEnter","onDragOver","onDragLeave","onDropRejected","minSize","_ref$maxFileNumber","maxFileNumber","Infinity","_onDrop","onDrop","onDropAccepted","props","_objectWithoutProperties","_excluded","I18n","_React$useState","useState","_React$useState2","_slicedToArray","acceptedFiles","setAcceptedFiles","_React$useState3","_React$useState4","fileRejections","setFileRejections","maxFilesRemaining","defaultDropError","type","reset","title","message","dropErrorReducer","state","action","rejectedFiles","createElement","map","_ref2","name","file","key","t","oneFileAtATime","body","sizeInMegabytes","multipleErrors","_objectSpread","withOneDropAtATimeError","errors","code","_React$useReducer","useReducer","_React$useReducer2","dropError","dispatchDropError","useCallback","event","droppedFiles","concat","_toConsumableArray","rej","allFilesWithRejections","_ref3","i","_partition","_ref4","_partition2","actualAcceptedFiles_","actualRejectedFiles","actualAcceptedFiles","_ref5","errorCodes","flatMap","rejection","error","hasMultipleErrors","Set","size","_useDropzoneBase","getRootProps","getInputProps","isDragActive","isFileDialogActive","isDragReject","isFocused","isDragAccept","draggedFiles","open","rootRef","inputRef","dragError","useMemo","getFileTypeError","count","getFileAmountError","fileLimit","amountError"],"sources":["../../src/Dropzone/Dropzone.hooks.tsx"],"sourcesContent":["import React from 'react'\nimport type { DropEvent, DropzoneOptions } from 'react-dropzone'\nimport { useDropzone as useDropzoneBase } from 'react-dropzone'\nimport { useI18nContext } from '../_hooks/I18n'\nimport { partition } from '../_utils/partition'\nimport { MultipleErrors } from './Dropzone'\nimport { StyledErrorBannerDetails } from './Dropzone.styles'\nimport type {\n DropError,\n DropErrorType,\n DropzoneHookProps,\n DropzoneHookState,\n FileRejection,\n FileRejectionReason,\n} from './Dropzone.types'\nimport { dropErrors, fileRejectionReason } from './Dropzone.types'\n\nconst oneDropAtATimeRejectionReason = 'one-drop-at-a-time'\n\nconst dropErrorsByReason: Record<FileRejectionReason, DropErrorType> = {\n [fileRejectionReason.maxFiles]: dropErrors.fileAmount,\n [fileRejectionReason.maxFileSize]: dropErrors.maxFileSize,\n [fileRejectionReason.minFileSize]: dropErrors.minFileSize,\n [fileRejectionReason.fileType]: dropErrors.fileType,\n}\n\nconst getSizeInMB = (maxSize: number): number => maxSize / 10e5\n\n/**\n * WARNING:\n * Use ACCEPT prop carefully, because mime type determination is not reliable across platforms.\n * Details: https://github.com/react-dropzone/react-dropzone/tree/master/examples/accept#browser-limitations\n */\nexport const useDropzone = ({\n value = [],\n disabled = false,\n multiple = false,\n noClick = true,\n noKeyboard = true,\n onDragEnter,\n onDragOver,\n onDragLeave,\n onDropRejected,\n maxFileSize: maxSize,\n minFileSize: minSize,\n maxFileNumber = Infinity,\n onDrop: _onDrop,\n onDropAccepted,\n ...props\n}: DropzoneHookProps = {}): DropzoneHookState => {\n const I18n = useI18nContext()\n const [acceptedFiles, setAcceptedFiles] = React.useState<File[]>([])\n const [fileRejections, setFileRejections] = React.useState<FileRejection[]>(\n []\n )\n\n const maxFilesRemaining = maxFileNumber - value.length\n\n const defaultDropError = {\n type: dropErrors.reset,\n title: '',\n message: '',\n }\n const dropErrorReducer = (\n state: DropError,\n action: DropErrorType\n ): DropError => {\n const rejectedFiles = (\n <StyledErrorBannerDetails>\n {fileRejections.map(({ file: { name } }) => (\n <li key={name}>{name}</li>\n ))}\n </StyledErrorBannerDetails>\n )\n const title = I18n.t('core.dropzone.errorTitle')\n switch (action) {\n case dropErrors.oneFileAtATime:\n return {\n type: dropErrors.oneFileAtATime,\n title: '',\n message: I18n.t('core.dropzone.oneFileAtATimeError'),\n }\n case dropErrors.fileAmount:\n return {\n type: dropErrors.fileAmount,\n title,\n message: I18n.t('core.dropzone.standaloneMaxFileNumberError', {\n maxFiles: maxFileNumber,\n }),\n body: rejectedFiles,\n }\n case dropErrors.fileType:\n return {\n type: dropErrors.fileType,\n title,\n message: I18n.t('core.dropzone.standaloneUnsupportedFileTypeError'),\n body: rejectedFiles,\n }\n case dropErrors.maxFileSize:\n return {\n type: dropErrors.maxFileSize,\n title,\n message: I18n.t('core.dropzone.standaloneMaxFileSizeError', {\n sizeInMegabytes: getSizeInMB(maxSize as number),\n }),\n body: rejectedFiles,\n }\n case dropErrors.minFileSize:\n return {\n type: dropErrors.minFileSize,\n title,\n message: I18n.t('core.dropzone.standaloneMinFileSizeError', {\n sizeInMegabytes: getSizeInMB(minSize as number),\n }),\n body: rejectedFiles,\n }\n case dropErrors.multipleErrors:\n return {\n type: dropErrors.multipleErrors,\n title,\n message: I18n.t('core.dropzone.multipleErrorsMessage'),\n body: (\n <MultipleErrors\n fileRejections={fileRejections}\n maxFiles={maxFileNumber}\n maxSize={maxSize}\n minSize={minSize}\n />\n ),\n }\n case dropErrors.reset:\n return { ...defaultDropError }\n default:\n return state\n }\n }\n\n const withOneDropAtATimeError = (file: File) => ({\n file,\n errors: [\n {\n message: I18n.t('core.dropzone.oneDropAtATimeError'),\n code: oneDropAtATimeRejectionReason as FileRejectionReason,\n },\n ],\n })\n\n const [dropError, dispatchDropError] = React.useReducer<\n React.Reducer<DropError, DropErrorType>\n >(dropErrorReducer, { ...defaultDropError })\n\n const onDrop: DropzoneOptions['onDrop'] = React.useCallback(\n (\n acceptedFiles: File[],\n rejectedFiles: FileRejection[],\n event: DropEvent\n ) => {\n dispatchDropError(dropErrors.reset)\n\n const droppedFiles = [\n ...acceptedFiles,\n ...rejectedFiles.map((rej) => rej.file),\n ]\n if (!multiple && droppedFiles.length > 1) {\n dispatchDropError(dropErrors.oneFileAtATime)\n onDropRejected?.(droppedFiles.map(withOneDropAtATimeError), event)\n return\n }\n\n const allFilesWithRejections = [\n ...acceptedFiles.map((file) => ({ file, errors: [] })),\n ...rejectedFiles,\n ].map(({ file, errors }, i) => ({\n file,\n errors:\n i < maxFilesRemaining\n ? errors\n : [...errors, { message: '', code: fileRejectionReason.maxFiles }],\n }))\n\n const [actualAcceptedFiles_, actualRejectedFiles] =\n partition<FileRejection>(\n ({ errors }) => errors.length === 0,\n allFilesWithRejections\n )\n\n const actualAcceptedFiles = actualAcceptedFiles_.map(({ file }) => file)\n\n _onDrop?.(actualAcceptedFiles, actualRejectedFiles, event)\n\n setAcceptedFiles(actualAcceptedFiles)\n setFileRejections(actualRejectedFiles)\n\n if (actualAcceptedFiles.length) {\n onDropAccepted?.(actualAcceptedFiles, event)\n }\n\n if (actualRejectedFiles.length) {\n onDropRejected?.(actualRejectedFiles, event)\n }\n\n const errorCodes = actualRejectedFiles\n .flatMap((rejection) => rejection.errors)\n .map((error) => error.code)\n const hasMultipleErrors = new Set([...errorCodes]).size > 1\n\n if (hasMultipleErrors) {\n dispatchDropError(dropErrors.multipleErrors)\n } else {\n dispatchDropError(dropErrorsByReason[errorCodes[0]])\n }\n },\n [_onDrop, maxFilesRemaining, onDropRejected, onDropAccepted, multiple]\n )\n\n const {\n getRootProps,\n getInputProps,\n isDragActive,\n isFileDialogActive,\n isDragReject,\n isFocused,\n isDragAccept,\n draggedFiles,\n open,\n rootRef,\n inputRef,\n } = useDropzoneBase({\n ...props,\n disabled,\n minSize,\n maxSize,\n multiple,\n onDragEnter,\n onDragLeave,\n onDragOver,\n onDrop,\n noClick,\n noKeyboard,\n })\n\n const dragError = React.useMemo(() => {\n const getFileTypeError = () => {\n return isDragReject\n ? I18n.t('core.dropzone.incorrectFileTypeMessage', {\n count: draggedFiles.length,\n })\n : ''\n }\n\n const getFileAmountError = () => {\n const fileLimit = multiple ? maxFilesRemaining : 1\n\n const amountError = multiple\n ? I18n.t('core.dropzone.invalidAmountAttachments', {\n count: maxFileNumber,\n })\n : I18n.t('core.dropzone.incorrectFileNumber')\n\n return draggedFiles.length > fileLimit ? amountError : ''\n }\n\n return getFileAmountError() || getFileTypeError()\n }, [\n I18n,\n draggedFiles.length,\n maxFilesRemaining,\n isDragReject,\n maxFileNumber,\n multiple,\n ])\n\n return {\n getRootProps,\n getInputProps,\n\n isDragActive,\n isFileDialogActive,\n isDragReject,\n isFocused,\n isDragAccept,\n draggedFiles,\n acceptedFiles,\n fileRejections,\n\n open,\n rootRef,\n inputRef,\n\n multiple,\n dragError,\n dropError,\n dispatchDropError,\n disabled,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,WAAW,IAAIC,eAAe,QAAQ,gBAAgB;AAC/D,SAASC,cAAc,QAAQ,gBAAgB;AAC/C,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,SAASC,cAAc,QAAQ,YAAY;AAC3C,SAASC,wBAAwB,QAAQ,mBAAmB;AAS5D,SAASC,UAAU,EAAEC,mBAAmB,QAAQ,kBAAkB;AAElE,IAAMC,6BAA6B,GAAG,oBAAoB;AAE1D,IAAMC,kBAA8D,IAAAC,mBAAA,OAAAC,eAAA,CAAAD,mBAAA,EACjEH,mBAAmB,CAACK,QAAQ,EAAGN,UAAU,CAACO,UAAU,GAAAF,eAAA,CAAAD,mBAAA,EACpDH,mBAAmB,CAACO,WAAW,EAAGR,UAAU,CAACQ,WAAW,GAAAH,eAAA,CAAAD,mBAAA,EACxDH,mBAAmB,CAACQ,WAAW,EAAGT,UAAU,CAACS,WAAW,GAAAJ,eAAA,CAAAD,mBAAA,EACxDH,mBAAmB,CAACS,QAAQ,EAAGV,UAAU,CAACU,QAAQ,GAAAN,mBAAA,CACpD;AAED,IAAMO,WAAW,GAAG,SAAdA,WAAWA,CAAIC,OAAe;EAAA,OAAaA,OAAO,GAAG,IAAI;AAAA;;AAE/D;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMlB,WAAW,GAAG,SAAdA,WAAWA,CAAA,EAgByB;EAAA,IAAAmB,IAAA,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAA1B,CAAC,CAAC;E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IAER9F,QAAQ,EAARA,QAAQ;IACR+F,SAAS,EAATA,SAAS;IACTrC,SAAS,EAATA,SAAS;IACTC,iBAAiB,EAAjBA,iBAAiB;IACjB7D,QAAQ,EAARA;EACF,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"Dropzone.hooks.js","names":["React","useDropzone","useDropzoneBase","useI18nContext","partition","MultipleErrors","StyledErrorBannerDetails","dropErrors","fileRejectionReason","getFileDetail","isZeroSize","oneDropAtATimeRejectionReason","dropErrorsByReason","_dropErrorsByReason","_defineProperty","maxFiles","fileAmount","maxFileSize","minFileSize","fileType","getSizeInMB","maxSize","_ref","arguments","length","undefined","_ref$value","value","_ref$disabled","disabled","_ref$multiple","multiple","_ref$noClick","noClick","_ref$noKeyboard","noKeyboard","onDragEnter","onDragOver","onDragLeave","onDropRejected","minSize","_ref$maxFileNumber","maxFileNumber","Infinity","_onDrop","onDrop","onDropAccepted","props","_objectWithoutProperties","_excluded","I18n","_React$useState","useState","_React$useState2","_slicedToArray","acceptedFiles","setAcceptedFiles","_React$useState3","_React$useState4","fileRejections","setFileRejections","maxFilesRemaining","defaultDropError","type","reset","title","message","dropErrorReducer","state","action","rejectedFiles","createElement","map","_ref2","file","key","name","t","oneFileAtATime","body","sizeInMegabytes","multipleErrors","_objectSpread","withOneDropAtATimeError","errors","code","_React$useReducer","useReducer","_React$useReducer2","dropError","dispatchDropError","useCallback","event","droppedFiles","concat","_toConsumableArray","rej","allFilesWithRejections","_ref3","i","_partition","_ref4","_partition2","actualAcceptedFiles_","actualRejectedFiles","actualAcceptedFiles","_ref5","errorCodes","flatMap","rejection","error","hasMultipleErrors","Set","size","_useDropzoneBase","getRootProps","getInputProps","isDragActive","isFileDialogActive","isDragReject","isFocused","isDragAccept","draggedFiles","open","rootRef","inputRef","dragError","useMemo","getFileTypeError","count","getFileAmountError","fileLimit","amountError"],"sources":["../../src/Dropzone/Dropzone.hooks.tsx"],"sourcesContent":["import React from 'react'\nimport type { DropEvent, DropzoneOptions } from 'react-dropzone'\nimport { useDropzone as useDropzoneBase } from 'react-dropzone'\nimport { useI18nContext } from '../_hooks/I18n'\nimport { partition } from '../_utils/partition'\nimport { MultipleErrors } from './Dropzone'\nimport { StyledErrorBannerDetails } from './Dropzone.styles'\nimport type {\n DropError,\n DropErrorType,\n DropzoneHookProps,\n DropzoneHookState,\n FileRejection,\n FileRejectionReason,\n} from './Dropzone.types'\nimport { dropErrors, fileRejectionReason } from './Dropzone.types'\nimport { getFileDetail, isZeroSize } from './Dropzone.utils'\n\nconst oneDropAtATimeRejectionReason = 'one-drop-at-a-time'\n\nconst dropErrorsByReason: Record<FileRejectionReason, DropErrorType> = {\n [fileRejectionReason.maxFiles]: dropErrors.fileAmount,\n [fileRejectionReason.maxFileSize]: dropErrors.maxFileSize,\n [fileRejectionReason.minFileSize]: dropErrors.minFileSize,\n [fileRejectionReason.fileType]: dropErrors.fileType,\n}\n\nconst getSizeInMB = (maxSize: number): number => maxSize / 10e5\n\n/**\n * WARNING:\n * Use ACCEPT prop carefully, because mime type determination is not reliable across platforms.\n * Details: https://github.com/react-dropzone/react-dropzone/tree/master/examples/accept#browser-limitations\n */\nexport const useDropzone = ({\n value = [],\n disabled = false,\n multiple = false,\n noClick = true,\n noKeyboard = true,\n onDragEnter,\n onDragOver,\n onDragLeave,\n onDropRejected,\n maxFileSize: maxSize,\n minFileSize: minSize,\n maxFileNumber = Infinity,\n onDrop: _onDrop,\n onDropAccepted,\n ...props\n}: DropzoneHookProps = {}): DropzoneHookState => {\n const I18n = useI18nContext()\n const [acceptedFiles, setAcceptedFiles] = React.useState<File[]>([])\n const [fileRejections, setFileRejections] = React.useState<FileRejection[]>(\n []\n )\n\n const maxFilesRemaining = maxFileNumber - value.length\n\n const defaultDropError = {\n type: dropErrors.reset,\n title: '',\n message: '',\n }\n\n const dropErrorReducer = (\n state: DropError,\n action: DropErrorType\n ): DropError => {\n const rejectedFiles = (\n <StyledErrorBannerDetails>\n {fileRejections.map(({ file }) => {\n return <li key={file.name}>{getFileDetail(file)}</li>\n })}\n </StyledErrorBannerDetails>\n )\n const title = I18n.t('core.dropzone.errorTitle')\n\n switch (action) {\n case dropErrors.oneFileAtATime:\n return {\n type: dropErrors.oneFileAtATime,\n title: '',\n message: I18n.t('core.dropzone.oneFileAtATimeError'),\n }\n case dropErrors.fileAmount:\n return {\n type: dropErrors.fileAmount,\n title,\n message: I18n.t('core.dropzone.standaloneMaxFileNumberError', {\n maxFiles: maxFileNumber,\n }),\n body: rejectedFiles,\n }\n case dropErrors.fileType:\n return {\n type: dropErrors.fileType,\n title,\n message: I18n.t('core.dropzone.standaloneUnsupportedFileTypeError'),\n body: rejectedFiles,\n }\n case dropErrors.maxFileSize:\n return {\n type: dropErrors.maxFileSize,\n title,\n message: I18n.t('core.dropzone.standaloneMaxFileSizeError', {\n sizeInMegabytes: getSizeInMB(maxSize as number),\n }),\n body: rejectedFiles,\n }\n case dropErrors.minFileSize:\n const message = isZeroSize(minSize)\n ? I18n.t('core.dropzone.standaloneZeroFileSizeError')\n : I18n.t('core.dropzone.standaloneMinFileSizeError', {\n sizeInMegabytes: getSizeInMB(minSize as number),\n })\n\n return {\n type: dropErrors.minFileSize,\n title,\n message,\n body: rejectedFiles,\n }\n case dropErrors.multipleErrors:\n return {\n type: dropErrors.multipleErrors,\n title,\n message: I18n.t('core.dropzone.multipleErrorsMessage'),\n body: (\n <MultipleErrors\n fileRejections={fileRejections}\n maxFiles={maxFileNumber}\n maxSize={maxSize}\n minSize={minSize}\n />\n ),\n }\n case dropErrors.reset:\n return { ...defaultDropError }\n default:\n return state\n }\n }\n\n const withOneDropAtATimeError = (file: File) => ({\n file,\n errors: [\n {\n message: I18n.t('core.dropzone.oneDropAtATimeError'),\n code: oneDropAtATimeRejectionReason as FileRejectionReason,\n },\n ],\n })\n\n const [dropError, dispatchDropError] = React.useReducer<\n React.Reducer<DropError, DropErrorType>\n >(dropErrorReducer, { ...defaultDropError })\n\n const onDrop: DropzoneOptions['onDrop'] = React.useCallback(\n (\n acceptedFiles: File[],\n rejectedFiles: FileRejection[],\n event: DropEvent\n ) => {\n dispatchDropError(dropErrors.reset)\n\n const droppedFiles = [\n ...acceptedFiles,\n ...rejectedFiles.map((rej) => rej.file),\n ]\n if (!multiple && droppedFiles.length > 1) {\n dispatchDropError(dropErrors.oneFileAtATime)\n onDropRejected?.(droppedFiles.map(withOneDropAtATimeError), event)\n return\n }\n\n const allFilesWithRejections = [\n ...acceptedFiles.map((file) => ({ file, errors: [] })),\n ...rejectedFiles,\n ].map(({ file, errors }, i) => ({\n file,\n errors:\n i < maxFilesRemaining\n ? errors\n : [...errors, { message: '', code: fileRejectionReason.maxFiles }],\n }))\n\n const [actualAcceptedFiles_, actualRejectedFiles] =\n partition<FileRejection>(\n ({ errors }) => errors.length === 0,\n allFilesWithRejections\n )\n\n const actualAcceptedFiles = actualAcceptedFiles_.map(({ file }) => file)\n\n _onDrop?.(actualAcceptedFiles, actualRejectedFiles, event)\n\n setAcceptedFiles(actualAcceptedFiles)\n setFileRejections(actualRejectedFiles)\n\n if (actualAcceptedFiles.length) {\n onDropAccepted?.(actualAcceptedFiles, event)\n }\n\n if (actualRejectedFiles.length) {\n onDropRejected?.(actualRejectedFiles, event)\n }\n\n const errorCodes = actualRejectedFiles\n .flatMap((rejection) => rejection.errors)\n .map((error) => error.code)\n const hasMultipleErrors = new Set([...errorCodes]).size > 1\n\n if (hasMultipleErrors) {\n dispatchDropError(dropErrors.multipleErrors)\n } else {\n dispatchDropError(dropErrorsByReason[errorCodes[0]])\n }\n },\n [_onDrop, maxFilesRemaining, onDropRejected, onDropAccepted, multiple]\n )\n\n const {\n getRootProps,\n getInputProps,\n isDragActive,\n isFileDialogActive,\n isDragReject,\n isFocused,\n isDragAccept,\n draggedFiles,\n open,\n rootRef,\n inputRef,\n } = useDropzoneBase({\n ...props,\n disabled,\n minSize,\n maxSize,\n multiple,\n onDragEnter,\n onDragLeave,\n onDragOver,\n onDrop,\n noClick,\n noKeyboard,\n })\n\n const dragError = React.useMemo(() => {\n const getFileTypeError = () => {\n return isDragReject\n ? I18n.t('core.dropzone.incorrectFileTypeMessage', {\n count: draggedFiles.length,\n })\n : ''\n }\n\n const getFileAmountError = () => {\n const fileLimit = multiple ? maxFilesRemaining : 1\n\n const amountError = multiple\n ? I18n.t('core.dropzone.invalidAmountAttachments', {\n count: maxFileNumber,\n })\n : I18n.t('core.dropzone.incorrectFileNumber')\n\n return draggedFiles.length > fileLimit ? amountError : ''\n }\n\n return getFileAmountError() || getFileTypeError()\n }, [\n I18n,\n draggedFiles.length,\n maxFilesRemaining,\n isDragReject,\n maxFileNumber,\n multiple,\n ])\n\n return {\n getRootProps,\n getInputProps,\n\n isDragActive,\n isFileDialogActive,\n isDragReject,\n isFocused,\n isDragAccept,\n draggedFiles,\n acceptedFiles,\n fileRejections,\n\n open,\n rootRef,\n inputRef,\n\n multiple,\n dragError,\n dropError,\n dispatchDropError,\n disabled,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,WAAW,IAAIC,eAAe,QAAQ,gBAAgB;AAC/D,SAASC,cAAc,QAAQ,gBAAgB;AAC/C,SAASC,SAAS,QAAQ,qBAAqB;AAC/C,SAASC,cAAc,QAAQ,YAAY;AAC3C,SAASC,wBAAwB,QAAQ,mBAAmB;AAS5D,SAASC,UAAU,EAAEC,mBAAmB,QAAQ,kBAAkB;AAClE,SAASC,aAAa,EAAEC,UAAU,QAAQ,kBAAkB;AAE5D,IAAMC,6BAA6B,GAAG,oBAAoB;AAE1D,IAAMC,kBAA8D,IAAAC,mBAAA,OAAAC,eAAA,CAAAD,mBAAA,EACjEL,mBAAmB,CAACO,QAAQ,EAAGR,UAAU,CAACS,UAAU,GAAAF,eAAA,CAAAD,mBAAA,EACpDL,mBAAmB,CAACS,WAAW,EAAGV,UAAU,CAACU,WAAW,GAAAH,eAAA,CAAAD,mBAAA,EACxDL,mBAAmB,CAACU,WAAW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D,CAAC;IAED,OAAOF,kBAAkB,CAAC,CAAC,IAAIF,gBAAgB,CAAC,CAAC;EACnD,CAAC,EAAE,CACD9E,IAAI,EACJwE,YAAY,CAAClG,MAAM,EACnBqC,iBAAiB,EACjB0D,YAAY,EACZ7E,aAAa,EACbX,QAAQ,CACT,CAAC;EAEF,OAAO;IACLoF,YAAY,EAAZA,YAAY;IACZC,aAAa,EAAbA,aAAa;IAEbC,YAAY,EAAZA,YAAY;IACZC,kBAAkB,EAAlBA,kBAAkB;IAClBC,YAAY,EAAZA,YAAY;IACZC,SAAS,EAATA,SAAS;IACTC,YAAY,EAAZA,YAAY;IACZC,YAAY,EAAZA,YAAY;IACZnE,aAAa,EAAbA,aAAa;IACbI,cAAc,EAAdA,cAAc;IAEdgE,IAAI,EAAJA,IAAI;IACJC,OAAO,EAAPA,OAAO;IACPC,QAAQ,EAARA,QAAQ;IAER9F,QAAQ,EAARA,QAAQ;IACR+F,SAAS,EAATA,SAAS;IACTrC,SAAS,EAATA,SAAS;IACTC,iBAAiB,EAAjBA,iBAAiB;IACjB7D,QAAQ,EAARA;EACF,CAAC;AACH,CAAC"}
|
|
@@ -26,6 +26,7 @@ import { useResizeObserver } from '../_hooks/ResizeObserver';
|
|
|
26
26
|
import { useFocusWithin } from '../_hooks/useFocusWithin';
|
|
27
27
|
import { StyledDropzoneCaption, StyledDropzoneContainer, StyledDropzoneFocusDetector, StyledDropzoneIcon, StyledDropzoneMessage, StyledDropzoneWrapper, StyledErrorBanner, StyledErrorBannerDetails, StyledUploadButton } from './Dropzone.styles';
|
|
28
28
|
import { dropErrors, fileRejectionReason } from './Dropzone.types';
|
|
29
|
+
import { getFileDetail, isZeroSize } from './Dropzone.utils';
|
|
29
30
|
var extendedViewHeightBreakpoint = 172;
|
|
30
31
|
var DropzoneErrorBannerBase = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
31
32
|
var error = _ref.error,
|
|
@@ -72,7 +73,7 @@ export function MultipleErrors(props) {
|
|
|
72
73
|
}, (_props$fileRejections = {}, _defineProperty(_props$fileRejections, dropErrors.fileAmount, []), _defineProperty(_props$fileRejections, dropErrors.minFileSize, []), _defineProperty(_props$fileRejections, dropErrors.maxFileSize, []), _defineProperty(_props$fileRejections, dropErrors.fileType, []), _defineProperty(_props$fileRejections, dropErrors.oneFileAtATime, []), _defineProperty(_props$fileRejections, dropErrors.reset, []), _defineProperty(_props$fileRejections, dropErrors.multipleErrors, []), _props$fileRejections));
|
|
73
74
|
var messages = (_messages = {}, _defineProperty(_messages, dropErrors.fileAmount, I18n.t('core.dropzone.maxFileNumberErrorGroup', {
|
|
74
75
|
count: props.maxFiles
|
|
75
|
-
})), _defineProperty(_messages, dropErrors.minFileSize, I18n.t('core.dropzone.minFileSizeErrorGroup', {
|
|
76
|
+
})), _defineProperty(_messages, dropErrors.minFileSize, isZeroSize(props.minSize) ? I18n.t('core.dropzone.zeroFileSizeErrorGroup') : I18n.t('core.dropzone.minFileSizeErrorGroup', {
|
|
76
77
|
sizeInMegabytes: getSizeInMB(props.minSize)
|
|
77
78
|
})), _defineProperty(_messages, dropErrors.maxFileSize, I18n.t('core.dropzone.maxFileSizeErrorGroup', {
|
|
78
79
|
sizeInMegabytes: getSizeInMB(props.maxSize)
|
|
@@ -83,11 +84,10 @@ export function MultipleErrors(props) {
|
|
|
83
84
|
key: errorType
|
|
84
85
|
}, /*#__PURE__*/React.createElement(Typography, {
|
|
85
86
|
weight: "bold"
|
|
86
|
-
}, messages[errorType]), /*#__PURE__*/React.createElement(StyledErrorBannerDetails, null, filesByErrorType[errorType].map(function (
|
|
87
|
-
var name = _ref2.name;
|
|
87
|
+
}, messages[errorType]), /*#__PURE__*/React.createElement(StyledErrorBannerDetails, null, filesByErrorType[errorType].map(function (file) {
|
|
88
88
|
return /*#__PURE__*/React.createElement("li", {
|
|
89
|
-
key: name
|
|
90
|
-
},
|
|
89
|
+
key: file.name
|
|
90
|
+
}, getFileDetail(file));
|
|
91
91
|
}))) : null;
|
|
92
92
|
}));
|
|
93
93
|
}
|
|
@@ -95,32 +95,32 @@ export function MultipleErrors(props) {
|
|
|
95
95
|
// make error banner accessible as a styled-components selector
|
|
96
96
|
export var DropzoneErrorBanner = /*#__PURE__*/styled(DropzoneErrorBannerBase).withConfig({
|
|
97
97
|
displayName: "DropzoneErrorBanner",
|
|
98
|
-
componentId: "core-
|
|
98
|
+
componentId: "core-12_17_2__sc-l4fojb-0"
|
|
99
99
|
})([""]);
|
|
100
|
-
function DropzoneContainer(
|
|
101
|
-
var active =
|
|
102
|
-
disabled =
|
|
103
|
-
getRootProps =
|
|
104
|
-
rootProps =
|
|
105
|
-
children =
|
|
100
|
+
function DropzoneContainer(_ref2) {
|
|
101
|
+
var active = _ref2.active,
|
|
102
|
+
disabled = _ref2.disabled,
|
|
103
|
+
getRootProps = _ref2.getRootProps,
|
|
104
|
+
rootProps = _ref2.rootProps,
|
|
105
|
+
children = _ref2.children;
|
|
106
106
|
return /*#__PURE__*/React.createElement(StyledDropzoneContainer, _extends({}, getRootProps(rootProps), {
|
|
107
107
|
active: active,
|
|
108
108
|
disabled: disabled
|
|
109
109
|
}), children);
|
|
110
110
|
}
|
|
111
|
-
function DropzoneContent(
|
|
112
|
-
var disabled =
|
|
113
|
-
isIconVisible =
|
|
114
|
-
contentMessage =
|
|
111
|
+
function DropzoneContent(_ref3) {
|
|
112
|
+
var disabled = _ref3.disabled,
|
|
113
|
+
isIconVisible = _ref3.isIconVisible,
|
|
114
|
+
contentMessage = _ref3.contentMessage;
|
|
115
115
|
return /*#__PURE__*/React.createElement(StyledDropzoneMessage, null, isIconVisible && /*#__PURE__*/React.createElement(StyledDropzoneIcon, {
|
|
116
116
|
disabled: disabled
|
|
117
117
|
}, disabled ? /*#__PURE__*/React.createElement(Ban, null) : /*#__PURE__*/React.createElement(Image, null)), contentMessage);
|
|
118
118
|
}
|
|
119
|
-
export function DropzoneDefaultMessage(
|
|
120
|
-
var open =
|
|
121
|
-
disabled =
|
|
122
|
-
multiple =
|
|
123
|
-
errorMessage =
|
|
119
|
+
export function DropzoneDefaultMessage(_ref4) {
|
|
120
|
+
var open = _ref4.open,
|
|
121
|
+
disabled = _ref4.disabled,
|
|
122
|
+
multiple = _ref4.multiple,
|
|
123
|
+
errorMessage = _ref4.errorMessage;
|
|
124
124
|
var I18n = useI18nContext();
|
|
125
125
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledUploadButton, {
|
|
126
126
|
variant: "secondary",
|
|
@@ -136,28 +136,28 @@ var dropErrorsByReason = (_dropErrorsByReason = {}, _defineProperty(_dropErrorsB
|
|
|
136
136
|
var getSizeInMB = function getSizeInMB(maxSize) {
|
|
137
137
|
return maxSize / 10e5;
|
|
138
138
|
};
|
|
139
|
-
var Dropzone_ = /*#__PURE__*/React.forwardRef(function Dropzone(
|
|
140
|
-
var forceIconVisibility =
|
|
141
|
-
contentRenderer =
|
|
142
|
-
disabled =
|
|
143
|
-
tooltip =
|
|
144
|
-
rootRef =
|
|
145
|
-
inputRef =
|
|
146
|
-
dragError =
|
|
147
|
-
dropError =
|
|
148
|
-
dispatchDropError =
|
|
149
|
-
getRootProps =
|
|
150
|
-
getInputProps =
|
|
151
|
-
isDragActive =
|
|
152
|
-
multiple =
|
|
153
|
-
fileRejections =
|
|
154
|
-
open =
|
|
155
|
-
|
|
156
|
-
rootProps =
|
|
157
|
-
|
|
158
|
-
inputProps =
|
|
159
|
-
className =
|
|
160
|
-
qa =
|
|
139
|
+
var Dropzone_ = /*#__PURE__*/React.forwardRef(function Dropzone(_ref5, ref) {
|
|
140
|
+
var forceIconVisibility = _ref5.isIconVisible,
|
|
141
|
+
contentRenderer = _ref5.contentRenderer,
|
|
142
|
+
disabled = _ref5.disabled,
|
|
143
|
+
tooltip = _ref5.tooltip,
|
|
144
|
+
rootRef = _ref5.rootRef,
|
|
145
|
+
inputRef = _ref5.inputRef,
|
|
146
|
+
dragError = _ref5.dragError,
|
|
147
|
+
dropError = _ref5.dropError,
|
|
148
|
+
dispatchDropError = _ref5.dispatchDropError,
|
|
149
|
+
getRootProps = _ref5.getRootProps,
|
|
150
|
+
getInputProps = _ref5.getInputProps,
|
|
151
|
+
isDragActive = _ref5.isDragActive,
|
|
152
|
+
multiple = _ref5.multiple,
|
|
153
|
+
fileRejections = _ref5.fileRejections,
|
|
154
|
+
open = _ref5.open,
|
|
155
|
+
_ref5$rootProps = _ref5.rootProps,
|
|
156
|
+
rootProps = _ref5$rootProps === void 0 ? {} : _ref5$rootProps,
|
|
157
|
+
_ref5$inputProps = _ref5.inputProps,
|
|
158
|
+
inputProps = _ref5$inputProps === void 0 ? {} : _ref5$inputProps,
|
|
159
|
+
className = _ref5.className,
|
|
160
|
+
qa = _ref5.qa;
|
|
161
161
|
var _React$useState3 = React.useState(false),
|
|
162
162
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
163
163
|
isIconVisible = _React$useState4[0],
|
|
@@ -166,8 +166,8 @@ var Dropzone_ = /*#__PURE__*/React.forwardRef(function Dropzone(_ref6, ref) {
|
|
|
166
166
|
isFocusWithin = _useFocusWithin.isFocusWithin,
|
|
167
167
|
containerProps = _useFocusWithin.containerProps;
|
|
168
168
|
var toggleIconVisibility = React.useCallback(function (entries) {
|
|
169
|
-
var
|
|
170
|
-
height =
|
|
169
|
+
var _ref6 = entries[0].target,
|
|
170
|
+
height = _ref6.offsetHeight;
|
|
171
171
|
setIsIconVisible(height >= extendedViewHeightBreakpoint);
|
|
172
172
|
}, [setIsIconVisible]);
|
|
173
173
|
var setResizeObserverTarget = useResizeObserver(toggleIconVisibility);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropzone.js","names":["Ban","Image","equals","omit","React","styled","Banner","Button","Tooltip","Typography","useI18nContext","useResizeObserver","useFocusWithin","StyledDropzoneCaption","StyledDropzoneContainer","StyledDropzoneFocusDetector","StyledDropzoneIcon","StyledDropzoneMessage","StyledDropzoneWrapper","StyledErrorBanner","StyledErrorBannerDetails","StyledUploadButton","dropErrors","fileRejectionReason","extendedViewHeightBreakpoint","DropzoneErrorBannerBase","forwardRef","_ref","ref","error","onDismiss","qa","fileRejections","props","_objectWithoutProperties","_excluded","I18n","_React$useState","useState","_React$useState2","_slicedToArray","isExpanded","setExpanded","useEffect","title","body","message","type","reset","createElement","_extends","Content","Title","Body","Action","showErrorDetails","onClick","prev","t","Dismiss","hideError","ExpandableContent","expanded","MultipleErrors","_props$fileRejections","_messages","filesByErrorType","reduce","acc","rejection","errors","forEach","dropErrorType","dropErrorsByReason","code","push","file","_defineProperty","fileAmount","minFileSize","maxFileSize","fileType","oneFileAtATime","multipleErrors","messages","count","maxFiles","sizeInMegabytes","getSizeInMB","minSize","maxSize","map","errorType","files","length","key","weight","_ref2","name","DropzoneErrorBanner","withConfig","displayName","componentId","DropzoneContainer","_ref3","active","disabled","getRootProps","rootProps","children","DropzoneContent","_ref4","isIconVisible","contentMessage","DropzoneDefaultMessage","_ref5","open","multiple","errorMessage","Fragment","variant","Infinity","_dropErrorsByReason","Dropzone_","Dropzone","_ref6","forceIconVisibility","contentRenderer","tooltip","rootRef","inputRef","dragError","dropError","dispatchDropError","getInputProps","isDragActive","_ref6$rootProps","_ref6$inputProps","inputProps","className","_React$useState3","_React$useState4","setIsIconVisible","_useFocusWithin","isFocusWithin","containerProps","toggleIconVisibility","useCallback","entries","_ref7","target","height","offsetHeight","setResizeObserverTarget","current","useImperativeHandle","isDropzoneDisabled","Boolean","useMemo","validRootProps","validInputProps","direction","alignItems","trigger","overlay","memo"],"sources":["../../src/Dropzone/Dropzone.tsx"],"sourcesContent":["import { Ban, Image } from '@procore/core-icons/dist'\nimport { equals, omit } from 'ramda'\nimport React from 'react'\nimport styled from 'styled-components'\nimport { Banner } from '../Banner/Banner'\nimport { Button } from '../Button/Button'\nimport { Tooltip } from '../Tooltip/Tooltip'\nimport { Typography } from '../Typography/Typography'\nimport { useI18nContext } from '../_hooks/I18n'\nimport { useResizeObserver } from '../_hooks/ResizeObserver'\nimport { useFocusWithin } from '../_hooks/useFocusWithin'\nimport type { DivAttributes, Props } from '../_utils/types'\nimport {\n StyledDropzoneCaption,\n StyledDropzoneContainer,\n StyledDropzoneFocusDetector,\n StyledDropzoneIcon,\n StyledDropzoneMessage,\n StyledDropzoneWrapper,\n StyledErrorBanner,\n StyledErrorBannerDetails,\n StyledUploadButton,\n} from './Dropzone.styles'\nimport type {\n ContainerProps,\n ContentProps,\n DropErrorType,\n DropzoneContentProps,\n DropzoneErrorBannerProps,\n DropzoneInputProps,\n DropzoneProps,\n DropzoneRef,\n DropzoneRootProps,\n FileRejectionReason,\n MultipleErrorsProps,\n} from './Dropzone.types'\nimport { dropErrors, fileRejectionReason } from './Dropzone.types'\n\nconst extendedViewHeightBreakpoint = 172\n\nconst DropzoneErrorBannerBase = React.forwardRef<\n HTMLDivElement,\n DropzoneErrorBannerProps & DivAttributes\n>(({ error, onDismiss, qa, fileRejections, ...props }, ref) => {\n const I18n = useI18nContext()\n const [isExpanded, setExpanded] = React.useState(false)\n\n React.useEffect(() => {\n setExpanded(false)\n }, [error.title, error.body, error.message])\n\n if (error.type === dropErrors.reset) {\n return null\n }\n\n return (\n <StyledErrorBanner {...props} ref={ref}>\n <Banner.Content>\n <Banner.Title>{error.title}</Banner.Title>\n <Banner.Body>{error.message}</Banner.Body>\n </Banner.Content>\n {error.body ? (\n <Banner.Action>\n <Button\n data-qa={qa?.showErrorDetails}\n onClick={() => setExpanded((prev) => !prev)}\n >\n {isExpanded\n ? I18n.t('core.dropzone.hideDetails')\n : I18n.t('core.dropzone.showDetails')}\n </Button>\n </Banner.Action>\n ) : null}\n <Banner.Dismiss onClick={onDismiss} data-qa={qa?.hideError} />\n {error.body ? (\n <Banner.ExpandableContent expanded={isExpanded}>\n {error.body}\n </Banner.ExpandableContent>\n ) : null}\n </StyledErrorBanner>\n )\n})\n\nexport function MultipleErrors(props: MultipleErrorsProps) {\n const I18n = useI18nContext()\n\n const filesByErrorType = props.fileRejections.reduce(\n (acc, rejection) => {\n rejection.errors.forEach((error) => {\n const dropErrorType = dropErrorsByReason[error.code]\n acc[dropErrorType].push(rejection.file)\n })\n\n return acc\n },\n {\n [dropErrors.fileAmount]: [],\n [dropErrors.minFileSize]: [],\n [dropErrors.maxFileSize]: [],\n [dropErrors.fileType]: [],\n [dropErrors.oneFileAtATime]: [],\n [dropErrors.reset]: [],\n [dropErrors.multipleErrors]: [],\n } as Record<DropErrorType, File[]>\n )\n\n const messages: Record<DropErrorType, string> = {\n [dropErrors.fileAmount]: I18n.t('core.dropzone.maxFileNumberErrorGroup', {\n count: props.maxFiles,\n }),\n [dropErrors.minFileSize]: I18n.t('core.dropzone.minFileSizeErrorGroup', {\n sizeInMegabytes: getSizeInMB(props.minSize as number),\n }),\n [dropErrors.maxFileSize]: I18n.t('core.dropzone.maxFileSizeErrorGroup', {\n sizeInMegabytes: getSizeInMB(props.maxSize as number),\n }),\n [dropErrors.fileType]: I18n.t('core.dropzone.wrongFileTypeErrorGroup'),\n [dropErrors.reset]: '',\n [dropErrors.multipleErrors]: '',\n [dropErrors.oneFileAtATime]: '',\n }\n\n return (\n <div>\n {[\n dropErrors.fileAmount,\n dropErrors.fileType,\n dropErrors.maxFileSize,\n dropErrors.minFileSize,\n ].map((errorType) => {\n const files = filesByErrorType[errorType]\n return files.length ? (\n <div key={errorType}>\n <Typography weight=\"bold\">{messages[errorType]}</Typography>\n <StyledErrorBannerDetails>\n {filesByErrorType[errorType].map(({ name }) => (\n <li key={name}>{name}</li>\n ))}\n </StyledErrorBannerDetails>\n </div>\n ) : null\n })}\n </div>\n )\n}\n\n// make error banner accessible as a styled-components selector\nexport const DropzoneErrorBanner = styled(DropzoneErrorBannerBase)``\n\nfunction DropzoneContainer({\n active,\n disabled,\n getRootProps,\n rootProps,\n children,\n}: ContainerProps & Props) {\n return (\n <StyledDropzoneContainer\n {...getRootProps(rootProps)}\n active={active}\n disabled={disabled}\n >\n {children}\n </StyledDropzoneContainer>\n )\n}\n\nfunction DropzoneContent({\n disabled,\n isIconVisible,\n contentMessage,\n}: ContentProps) {\n return (\n <StyledDropzoneMessage>\n {isIconVisible && (\n <StyledDropzoneIcon disabled={disabled}>\n {disabled ? <Ban /> : <Image />}\n </StyledDropzoneIcon>\n )}\n {contentMessage}\n </StyledDropzoneMessage>\n )\n}\n\nexport function DropzoneDefaultMessage({\n open,\n disabled,\n multiple,\n errorMessage,\n}: DropzoneContentProps & { multiple: boolean }) {\n const I18n = useI18nContext()\n\n return (\n <>\n <StyledUploadButton\n variant=\"secondary\"\n onClick={open}\n disabled={disabled}\n >\n {I18n.t('core.dropzone.uploadFiles', {\n count: multiple ? Infinity : 1,\n })}\n </StyledUploadButton>\n <StyledDropzoneCaption error={!!errorMessage}>\n {errorMessage || I18n.t('core.dropzone.dragAndDrop')}\n </StyledDropzoneCaption>\n </>\n )\n}\n\nconst dropErrorsByReason = {\n [fileRejectionReason.maxFiles]: dropErrors.fileAmount,\n [fileRejectionReason.maxFileSize]: dropErrors.maxFileSize,\n [fileRejectionReason.minFileSize]: dropErrors.minFileSize,\n [fileRejectionReason.fileType]: dropErrors.fileType,\n} as Record<FileRejectionReason, DropErrorType>\n\nconst getSizeInMB = (maxSize: number): number => maxSize / 10e5\n\nconst Dropzone_ = React.forwardRef<DropzoneRef, DropzoneProps>(\n function Dropzone(\n {\n isIconVisible: forceIconVisibility,\n contentRenderer,\n disabled,\n tooltip,\n rootRef,\n inputRef,\n dragError,\n dropError,\n dispatchDropError,\n getRootProps,\n getInputProps,\n isDragActive,\n multiple,\n fileRejections,\n open,\n rootProps = {} as DropzoneRootProps,\n inputProps = {} as DropzoneInputProps,\n className,\n qa,\n },\n ref\n ) {\n const [isIconVisible, setIsIconVisible] = React.useState(false)\n const { isFocusWithin, containerProps } = useFocusWithin()\n\n const toggleIconVisibility = React.useCallback(\n (entries: ResizeObserverEntry[]) => {\n const { offsetHeight: height } = entries[0].target as HTMLElement\n setIsIconVisible(height >= extendedViewHeightBreakpoint)\n },\n [setIsIconVisible]\n )\n\n const setResizeObserverTarget = useResizeObserver(toggleIconVisibility)\n\n React.useEffect(() => {\n setResizeObserverTarget(rootRef.current)\n }, [rootRef, setResizeObserverTarget])\n\n React.useImperativeHandle(ref, () => ({\n rootRef: rootRef as React.RefObject<HTMLElement>,\n inputRef: inputRef as React.RefObject<HTMLInputElement>,\n open,\n }))\n\n const isDropzoneDisabled = disabled || Boolean(dragError)\n\n const contentMessage = React.useMemo(\n () =>\n contentRenderer ? (\n contentRenderer({\n open,\n disabled: isDropzoneDisabled,\n errorMessage: dragError,\n })\n ) : (\n <DropzoneDefaultMessage\n open={open}\n disabled={isDropzoneDisabled}\n errorMessage={dragError}\n multiple={multiple}\n />\n ),\n [contentRenderer, open, isDropzoneDisabled, dragError, multiple]\n )\n\n const validRootProps = React.useMemo(\n () => omit(['disabled'], rootProps),\n [rootProps]\n )\n\n const validInputProps = React.useMemo(\n () => omit(['accept', 'multiple', 'type'], inputProps),\n [inputProps]\n )\n\n return (\n <StyledDropzoneWrapper\n direction=\"column\"\n alignItems=\"stretch\"\n className={className}\n >\n <Tooltip\n trigger={Boolean(tooltip) ? 'hover' : 'none'}\n overlay={tooltip || ''}\n >\n <StyledDropzoneFocusDetector {...containerProps}>\n <DropzoneContainer\n rootProps={validRootProps}\n active={isDragActive || isFocusWithin}\n disabled={isDropzoneDisabled}\n getRootProps={getRootProps}\n >\n <input type=\"file\" {...getInputProps(validInputProps)} />\n <DropzoneContent\n disabled={isDropzoneDisabled}\n isIconVisible={\n typeof forceIconVisibility === 'undefined'\n ? isIconVisible\n : forceIconVisibility\n }\n contentMessage={contentMessage}\n />\n </DropzoneContainer>\n </StyledDropzoneFocusDetector>\n </Tooltip>\n <DropzoneErrorBanner\n qa={qa}\n error={dropError}\n fileRejections={fileRejections}\n onDismiss={() => dispatchDropError(dropErrors.reset)}\n />\n </StyledDropzoneWrapper>\n )\n }\n)\n\nDropzoneContainer.displayName = 'DropzoneContainer'\n\nDropzoneContent.displayName = 'DropzoneContent'\n\nDropzone_.displayName = 'Dropzone'\n\n/**\n\n Dropzones allow users to quickly upload files from their computers, as well\n as optionally launch the file select component.\n\n @since 10.19.0\n\n @see [Storybook](https://stories.core.procore.com/?path=/story/core-react_demos-dropzone--demo)\n\n @see [Design Guidelines](https://design.procore.com/dropzone)\n\n*/\nexport const Dropzone = React.memo(Dropzone_, equals)\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAASA,GAAG,EAAEC,KAAK,QAAQ,0BAA0B;AACrD,SAASC,MAAM,EAAEC,IAAI,QAAQ,OAAO;AACpC,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,MAAM,MAAM,mBAAmB;AACtC,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,UAAU,QAAQ,0BAA0B;AACrD,SAASC,cAAc,QAAQ,gBAAgB;AAC/C,SAASC,iBAAiB,QAAQ,0BAA0B;AAC5D,SAASC,cAAc,QAAQ,0BAA0B;AAEzD,SACEC,qBAAqB,EACrBC,uBAAuB,EACvBC,2BAA2B,EAC3BC,kBAAkB,EAClBC,qBAAqB,EACrBC,qBAAqB,EACrBC,iBAAiB,EACjBC,wBAAwB,EACxBC,kBAAkB,QACb,mBAAmB;AAc1B,SAASC,UAAU,EAAEC,mBAAmB,QAAQ,kBAAkB;AAElE,IAAMC,4BAA4B,GAAG,GAAG;AAExC,IAAMC,uBAAuB,gBAAGrB,KAAK,CAACsB,UAAU,CAG9C,UAAAC,IAAA,EAAqDC,GAAG,EAAK;EAAA,IAA1DC,KAAK,GAAAF,IAAA,CAALE,KAAK;IAAEC,SAAS,GAAAH,IAAA,CAATG,SAAS;IAAEC,EAAE,GAAAJ,IAAA,CAAFI,EAAE;IAAEC,cAAc,GAAAL,IAAA,CAAdK,cAAc;IAAKC,KAAK,GAAAC,wBAAA,CAAAP,IAAA,EAAAQ,SAAA;EACjD,IAAMC,IAAI,GAAG1B,cA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Aa,gBAE3BvG,KAAA,CAAA6C,aAAA,UAAAC,QAAA;IAAOH,IAAI,EAAC;EAAM,GAAKuF,aAAa,CAAC0B,eAAe,CAAC,CAAG,CAAC,eACzD5J,KAAA,CAAA6C,aAAA,CAAC6D,eAAe;IACdJ,QAAQ,EAAEkD,kBAAmB;IAC7B5C,aAAa,EACX,OAAOc,mBAAmB,KAAK,WAAW,GACtCd,aAAa,GACbc,mBACL;IACDb,cAAc,EAAEA;EAAe,CAChC,CACgB,CACQ,CACtB,CAAC,eACV7G,KAAA,CAAA6C,aAAA,CAACkD,mBAAmB;IAClBpE,EAAE,EAAEA,EAAG;IACPF,KAAK,EAAEuG,SAAU;IACjBpG,cAAc,EAAEA,cAAe;IAC/BF,SAAS,EAAE,SAAAA,UAAA;MAAA,OAAMuG,iBAAiB,CAAC/G,UAAU,CAAC0B,KAAK,CAAC;IAAA;EAAC,CACtD,CACoB,CAAC;AAE5B,CACF,CAAC;AAEDuD,iBAAiB,CAACF,WAAW,GAAG,mBAAmB;AAEnDS,eAAe,CAACT,WAAW,GAAG,iBAAiB;AAE/CsB,SAAS,CAACtB,WAAW,GAAG,UAAU;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMuB,QAAQ,gBAAGxH,KAAK,CAACiK,IAAI,CAAC1C,SAAS,EAAEzH,MAAM,CAAC"}
|
|
1
|
+
{"version":3,"file":"Dropzone.js","names":["Ban","Image","equals","omit","React","styled","Banner","Button","Tooltip","Typography","useI18nContext","useResizeObserver","useFocusWithin","StyledDropzoneCaption","StyledDropzoneContainer","StyledDropzoneFocusDetector","StyledDropzoneIcon","StyledDropzoneMessage","StyledDropzoneWrapper","StyledErrorBanner","StyledErrorBannerDetails","StyledUploadButton","dropErrors","fileRejectionReason","getFileDetail","isZeroSize","extendedViewHeightBreakpoint","DropzoneErrorBannerBase","forwardRef","_ref","ref","error","onDismiss","qa","fileRejections","props","_objectWithoutProperties","_excluded","I18n","_React$useState","useState","_React$useState2","_slicedToArray","isExpanded","setExpanded","useEffect","title","body","message","type","reset","createElement","_extends","Content","Title","Body","Action","showErrorDetails","onClick","prev","t","Dismiss","hideError","ExpandableContent","expanded","MultipleErrors","_props$fileRejections","_messages","filesByErrorType","reduce","acc","rejection","errors","forEach","dropErrorType","dropErrorsByReason","code","push","file","_defineProperty","fileAmount","minFileSize","maxFileSize","fileType","oneFileAtATime","multipleErrors","messages","count","maxFiles","minSize","sizeInMegabytes","getSizeInMB","maxSize","map","errorType","files","length","key","weight","name","DropzoneErrorBanner","withConfig","displayName","componentId","DropzoneContainer","_ref2","active","disabled","getRootProps","rootProps","children","DropzoneContent","_ref3","isIconVisible","contentMessage","DropzoneDefaultMessage","_ref4","open","multiple","errorMessage","Fragment","variant","Infinity","_dropErrorsByReason","Dropzone_","Dropzone","_ref5","forceIconVisibility","contentRenderer","tooltip","rootRef","inputRef","dragError","dropError","dispatchDropError","getInputProps","isDragActive","_ref5$rootProps","_ref5$inputProps","inputProps","className","_React$useState3","_React$useState4","setIsIconVisible","_useFocusWithin","isFocusWithin","containerProps","toggleIconVisibility","useCallback","entries","_ref6","target","height","offsetHeight","setResizeObserverTarget","current","useImperativeHandle","isDropzoneDisabled","Boolean","useMemo","validRootProps","validInputProps","direction","alignItems","trigger","overlay","memo"],"sources":["../../src/Dropzone/Dropzone.tsx"],"sourcesContent":["import { Ban, Image } from '@procore/core-icons/dist'\nimport { equals, omit } from 'ramda'\nimport React from 'react'\nimport styled from 'styled-components'\nimport { Banner } from '../Banner/Banner'\nimport { Button } from '../Button/Button'\nimport { Tooltip } from '../Tooltip/Tooltip'\nimport { Typography } from '../Typography/Typography'\nimport { useI18nContext } from '../_hooks/I18n'\nimport { useResizeObserver } from '../_hooks/ResizeObserver'\nimport { useFocusWithin } from '../_hooks/useFocusWithin'\nimport type { DivAttributes, Props } from '../_utils/types'\nimport {\n StyledDropzoneCaption,\n StyledDropzoneContainer,\n StyledDropzoneFocusDetector,\n StyledDropzoneIcon,\n StyledDropzoneMessage,\n StyledDropzoneWrapper,\n StyledErrorBanner,\n StyledErrorBannerDetails,\n StyledUploadButton,\n} from './Dropzone.styles'\nimport type {\n ContainerProps,\n ContentProps,\n DropErrorType,\n DropzoneContentProps,\n DropzoneErrorBannerProps,\n DropzoneInputProps,\n DropzoneProps,\n DropzoneRef,\n DropzoneRootProps,\n FileRejectionReason,\n MultipleErrorsProps,\n} from './Dropzone.types'\nimport { dropErrors, fileRejectionReason } from './Dropzone.types'\nimport { getFileDetail, isZeroSize } from './Dropzone.utils'\n\nconst extendedViewHeightBreakpoint = 172\n\nconst DropzoneErrorBannerBase = React.forwardRef<\n HTMLDivElement,\n DropzoneErrorBannerProps & DivAttributes\n>(({ error, onDismiss, qa, fileRejections, ...props }, ref) => {\n const I18n = useI18nContext()\n const [isExpanded, setExpanded] = React.useState(false)\n\n React.useEffect(() => {\n setExpanded(false)\n }, [error.title, error.body, error.message])\n\n if (error.type === dropErrors.reset) {\n return null\n }\n\n return (\n <StyledErrorBanner {...props} ref={ref}>\n <Banner.Content>\n <Banner.Title>{error.title}</Banner.Title>\n <Banner.Body>{error.message}</Banner.Body>\n </Banner.Content>\n {error.body ? (\n <Banner.Action>\n <Button\n data-qa={qa?.showErrorDetails}\n onClick={() => setExpanded((prev) => !prev)}\n >\n {isExpanded\n ? I18n.t('core.dropzone.hideDetails')\n : I18n.t('core.dropzone.showDetails')}\n </Button>\n </Banner.Action>\n ) : null}\n <Banner.Dismiss onClick={onDismiss} data-qa={qa?.hideError} />\n {error.body ? (\n <Banner.ExpandableContent expanded={isExpanded}>\n {error.body}\n </Banner.ExpandableContent>\n ) : null}\n </StyledErrorBanner>\n )\n})\n\nexport function MultipleErrors(props: MultipleErrorsProps) {\n const I18n = useI18nContext()\n\n const filesByErrorType = props.fileRejections.reduce(\n (acc, rejection) => {\n rejection.errors.forEach((error) => {\n const dropErrorType = dropErrorsByReason[error.code]\n acc[dropErrorType].push(rejection.file)\n })\n\n return acc\n },\n {\n [dropErrors.fileAmount]: [],\n [dropErrors.minFileSize]: [],\n [dropErrors.maxFileSize]: [],\n [dropErrors.fileType]: [],\n [dropErrors.oneFileAtATime]: [],\n [dropErrors.reset]: [],\n [dropErrors.multipleErrors]: [],\n } as Record<DropErrorType, File[]>\n )\n\n const messages: Record<DropErrorType, string> = {\n [dropErrors.fileAmount]: I18n.t('core.dropzone.maxFileNumberErrorGroup', {\n count: props.maxFiles,\n }),\n [dropErrors.minFileSize]: isZeroSize(props.minSize)\n ? I18n.t('core.dropzone.zeroFileSizeErrorGroup')\n : I18n.t('core.dropzone.minFileSizeErrorGroup', {\n sizeInMegabytes: getSizeInMB(props.minSize as number),\n }),\n [dropErrors.maxFileSize]: I18n.t('core.dropzone.maxFileSizeErrorGroup', {\n sizeInMegabytes: getSizeInMB(props.maxSize as number),\n }),\n [dropErrors.fileType]: I18n.t('core.dropzone.wrongFileTypeErrorGroup'),\n [dropErrors.reset]: '',\n [dropErrors.multipleErrors]: '',\n [dropErrors.oneFileAtATime]: '',\n }\n\n return (\n <div>\n {[\n dropErrors.fileAmount,\n dropErrors.fileType,\n dropErrors.maxFileSize,\n dropErrors.minFileSize,\n ].map((errorType) => {\n const files = filesByErrorType[errorType]\n return files.length ? (\n <div key={errorType}>\n <Typography weight=\"bold\">{messages[errorType]}</Typography>\n <StyledErrorBannerDetails>\n {filesByErrorType[errorType].map((file) => (\n <li key={file.name}>{getFileDetail(file)}</li>\n ))}\n </StyledErrorBannerDetails>\n </div>\n ) : null\n })}\n </div>\n )\n}\n\n// make error banner accessible as a styled-components selector\nexport const DropzoneErrorBanner = styled(DropzoneErrorBannerBase)``\n\nfunction DropzoneContainer({\n active,\n disabled,\n getRootProps,\n rootProps,\n children,\n}: ContainerProps & Props) {\n return (\n <StyledDropzoneContainer\n {...getRootProps(rootProps)}\n active={active}\n disabled={disabled}\n >\n {children}\n </StyledDropzoneContainer>\n )\n}\n\nfunction DropzoneContent({\n disabled,\n isIconVisible,\n contentMessage,\n}: ContentProps) {\n return (\n <StyledDropzoneMessage>\n {isIconVisible && (\n <StyledDropzoneIcon disabled={disabled}>\n {disabled ? <Ban /> : <Image />}\n </StyledDropzoneIcon>\n )}\n {contentMessage}\n </StyledDropzoneMessage>\n )\n}\n\nexport function DropzoneDefaultMessage({\n open,\n disabled,\n multiple,\n errorMessage,\n}: DropzoneContentProps & { multiple: boolean }) {\n const I18n = useI18nContext()\n\n return (\n <>\n <StyledUploadButton\n variant=\"secondary\"\n onClick={open}\n disabled={disabled}\n >\n {I18n.t('core.dropzone.uploadFiles', {\n count: multiple ? Infinity : 1,\n })}\n </StyledUploadButton>\n <StyledDropzoneCaption error={!!errorMessage}>\n {errorMessage || I18n.t('core.dropzone.dragAndDrop')}\n </StyledDropzoneCaption>\n </>\n )\n}\n\nconst dropErrorsByReason = {\n [fileRejectionReason.maxFiles]: dropErrors.fileAmount,\n [fileRejectionReason.maxFileSize]: dropErrors.maxFileSize,\n [fileRejectionReason.minFileSize]: dropErrors.minFileSize,\n [fileRejectionReason.fileType]: dropErrors.fileType,\n} as Record<FileRejectionReason, DropErrorType>\n\nconst getSizeInMB = (maxSize: number): number => maxSize / 10e5\n\nconst Dropzone_ = React.forwardRef<DropzoneRef, DropzoneProps>(\n function Dropzone(\n {\n isIconVisible: forceIconVisibility,\n contentRenderer,\n disabled,\n tooltip,\n rootRef,\n inputRef,\n dragError,\n dropError,\n dispatchDropError,\n getRootProps,\n getInputProps,\n isDragActive,\n multiple,\n fileRejections,\n open,\n rootProps = {} as DropzoneRootProps,\n inputProps = {} as DropzoneInputProps,\n className,\n qa,\n },\n ref\n ) {\n const [isIconVisible, setIsIconVisible] = React.useState(false)\n const { isFocusWithin, containerProps } = useFocusWithin()\n\n const toggleIconVisibility = React.useCallback(\n (entries: ResizeObserverEntry[]) => {\n const { offsetHeight: height } = entries[0].target as HTMLElement\n setIsIconVisible(height >= extendedViewHeightBreakpoint)\n },\n [setIsIconVisible]\n )\n\n const setResizeObserverTarget = useResizeObserver(toggleIconVisibility)\n\n React.useEffect(() => {\n setResizeObserverTarget(rootRef.current)\n }, [rootRef, setResizeObserverTarget])\n\n React.useImperativeHandle(ref, () => ({\n rootRef: rootRef as React.RefObject<HTMLElement>,\n inputRef: inputRef as React.RefObject<HTMLInputElement>,\n open,\n }))\n\n const isDropzoneDisabled = disabled || Boolean(dragError)\n\n const contentMessage = React.useMemo(\n () =>\n contentRenderer ? (\n contentRenderer({\n open,\n disabled: isDropzoneDisabled,\n errorMessage: dragError,\n })\n ) : (\n <DropzoneDefaultMessage\n open={open}\n disabled={isDropzoneDisabled}\n errorMessage={dragError}\n multiple={multiple}\n />\n ),\n [contentRenderer, open, isDropzoneDisabled, dragError, multiple]\n )\n\n const validRootProps = React.useMemo(\n () => omit(['disabled'], rootProps),\n [rootProps]\n )\n\n const validInputProps = React.useMemo(\n () => omit(['accept', 'multiple', 'type'], inputProps),\n [inputProps]\n )\n\n return (\n <StyledDropzoneWrapper\n direction=\"column\"\n alignItems=\"stretch\"\n className={className}\n >\n <Tooltip\n trigger={Boolean(tooltip) ? 'hover' : 'none'}\n overlay={tooltip || ''}\n >\n <StyledDropzoneFocusDetector {...containerProps}>\n <DropzoneContainer\n rootProps={validRootProps}\n active={isDragActive || isFocusWithin}\n disabled={isDropzoneDisabled}\n getRootProps={getRootProps}\n >\n <input type=\"file\" {...getInputProps(validInputProps)} />\n <DropzoneContent\n disabled={isDropzoneDisabled}\n isIconVisible={\n typeof forceIconVisibility === 'undefined'\n ? isIconVisible\n : forceIconVisibility\n }\n contentMessage={contentMessage}\n />\n </DropzoneContainer>\n </StyledDropzoneFocusDetector>\n </Tooltip>\n <DropzoneErrorBanner\n qa={qa}\n error={dropError}\n fileRejections={fileRejections}\n onDismiss={() => dispatchDropError(dropErrors.reset)}\n />\n </StyledDropzoneWrapper>\n )\n }\n)\n\nDropzoneContainer.displayName = 'DropzoneContainer'\n\nDropzoneContent.displayName = 'DropzoneContent'\n\nDropzone_.displayName = 'Dropzone'\n\n/**\n\n Dropzones allow users to quickly upload files from their computers, as well\n as optionally launch the file select component.\n\n @since 10.19.0\n\n @see [Storybook](https://stories.core.procore.com/?path=/story/core-react_demos-dropzone--demo)\n\n @see [Design Guidelines](https://design.procore.com/dropzone)\n\n*/\nexport const Dropzone = React.memo(Dropzone_, equals)\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAASA,GAAG,EAAEC,KAAK,QAAQ,0BAA0B;AACrD,SAASC,MAAM,EAAEC,IAAI,QAAQ,OAAO;AACpC,OAAOC,KAAK,MAAM,OAAO;AACzB,OAAOC,MAAM,MAAM,mBAAmB;AACtC,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,UAAU,QAAQ,0BAA0B;AACrD,SAASC,cAAc,QAAQ,gBAAgB;AAC/C,SAASC,iBAAiB,QAAQ,0BAA0B;AAC5D,SAASC,cAAc,QAAQ,0BAA0B;AAEzD,SACEC,qBAAqB,EACrBC,uBAAuB,EACvBC,2BAA2B,EAC3BC,kBAAkB,EAClBC,qBAAqB,EACrBC,qBAAqB,EACrBC,iBAAiB,EACjBC,wBAAwB,EACxBC,kBAAkB,QACb,mBAAmB;AAc1B,SAASC,UAAU,EAAEC,mBAAmB,QAAQ,kBAAkB;AAClE,SAASC,aAAa,EAAEC,UAAU,QAAQ,kBAAkB;AAE5D,IAAMC,4BAA4B,GAAG,GAAG;AAExC,IAAMC,uBAAuB,gBAAGvB,KAAK,CAACwB,UAAU,CAG9C,UAAAC,IAAA,EAAqDC,GAAG,EAAK;EAAA,IAA1DC,KAAK,GAAAF,IAAA,CAALE,KAAK;IAAEC,SAAS,GAAAH,IAAA,CAATG,SAAS;IAAEC,EAAE,GAAAJ,IAAA,CAAFI,EAAE;IAAEC,cAAc,GAAAL,IAAA,CAAdK,cAAc;IAAKC,KAAK,GAAAC,wBAAA,CAAAP,IAAA,EAAAQ,SAAA;EACj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K,SAAS,EAAEmD,cAAe;IAC1BtD,MAAM,EAAE8B,YAAY,IAAIS,aAAc;IACtCtC,QAAQ,EAAEkD,kBAAmB;IAC7BjD,YAAY,EAAEA;EAAa,gBAE3BxG,KAAA,CAAA+C,aAAA,UAAAC,QAAA;IAAOH,IAAI,EAAC;EAAM,GAAKsF,aAAa,CAAC0B,eAAe,CAAC,CAAG,CAAC,eACzD7J,KAAA,CAAA+C,aAAA,CAAC4D,eAAe;IACdJ,QAAQ,EAAEkD,kBAAmB;IAC7B5C,aAAa,EACX,OAAOc,mBAAmB,KAAK,WAAW,GACtCd,aAAa,GACbc,mBACL;IACDb,cAAc,EAAEA;EAAe,CAChC,CACgB,CACQ,CACtB,CAAC,eACV9G,KAAA,CAAA+C,aAAA,CAACiD,mBAAmB;IAClBnE,EAAE,EAAEA,EAAG;IACPF,KAAK,EAAEsG,SAAU;IACjBnG,cAAc,EAAEA,cAAe;IAC/BF,SAAS,EAAE,SAAAA,UAAA;MAAA,OAAMsG,iBAAiB,CAAChH,UAAU,CAAC4B,KAAK,CAAC;IAAA;EAAC,CACtD,CACoB,CAAC;AAE5B,CACF,CAAC;AAEDsD,iBAAiB,CAACF,WAAW,GAAG,mBAAmB;AAEnDS,eAAe,CAACT,WAAW,GAAG,iBAAiB;AAE/CsB,SAAS,CAACtB,WAAW,GAAG,UAAU;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMuB,QAAQ,gBAAGzH,KAAK,CAACkK,IAAI,CAAC1C,SAAS,EAAE1H,MAAM,CAAC"}
|
|
@@ -9,15 +9,15 @@ import { colors } from '../_styles/colors';
|
|
|
9
9
|
import { spacing } from '../_styles/spacing';
|
|
10
10
|
export var StyledErrorBanner = /*#__PURE__*/styled(ErrorBannerBase).withConfig({
|
|
11
11
|
displayName: "StyledErrorBanner",
|
|
12
|
-
componentId: "core-
|
|
12
|
+
componentId: "core-12_17_2__sc-by95hy-0"
|
|
13
13
|
})(["margin-top:", "px;flex-shrink:0;"], spacing.lg);
|
|
14
14
|
export var StyledErrorBannerDetails = /*#__PURE__*/styled.ul.withConfig({
|
|
15
15
|
displayName: "StyledErrorBannerDetails",
|
|
16
|
-
componentId: "core-
|
|
16
|
+
componentId: "core-12_17_2__sc-by95hy-1"
|
|
17
17
|
})(["margin:", "px;padding:0;list-style-position:inside;list-style-type:disc;"], spacing.xs);
|
|
18
18
|
export var StyledDropzoneIcon = /*#__PURE__*/styled.div.withConfig({
|
|
19
19
|
displayName: "StyledDropzoneIcon",
|
|
20
|
-
componentId: "core-
|
|
20
|
+
componentId: "core-12_17_2__sc-by95hy-2"
|
|
21
21
|
})(["display:flex;justify-content:center;align-items:center;height:64px;color:", ";margin-bottom:", "px;transition:all 250ms ease-out;", " svg{width:auto;height:100%;}"], colors.gray45, spacing.lg, function (_ref) {
|
|
22
22
|
var disabled = _ref.disabled;
|
|
23
23
|
return disabled && css(["height:72px;margin-bottom:", "px;"], spacing.sm);
|
|
@@ -26,7 +26,7 @@ var activeDropzone = /*#__PURE__*/css(["outline:none;border:2px dashed ", ";back
|
|
|
26
26
|
var disabledDropzone = /*#__PURE__*/css(["color:", ";border:2px dashed ", ";background-color:", ";cursor:not-allowed;& ", "{color:", ";transform:none;}"], colors.gray70, colors.gray85, colors.gray98, StyledDropzoneIcon, colors.gray85);
|
|
27
27
|
export var StyledDropzoneContainer = /*#__PURE__*/styled.div.withConfig({
|
|
28
28
|
displayName: "StyledDropzoneContainer",
|
|
29
|
-
componentId: "core-
|
|
29
|
+
componentId: "core-12_17_2__sc-by95hy-3"
|
|
30
30
|
})(["", " display:inline-flex;justify-content:center;align-items:center;box-sizing:border-box;width:100%;height:100%;min-height:92px;padding:", "px;color:", ";border:2px dashed ", ";background-color:", ";border-radius:", "px;text-align:center;letter-spacing:0.25px;transition:all 250ms ease-out;cursor:grab;", " ", " ", " ", ""], getTypographyIntent('body'), spacing.lg, colors.gray40, colors.gray70, colors.gray96, borderRadius.md, function (_ref2) {
|
|
31
31
|
var disabled = _ref2.disabled;
|
|
32
32
|
return !disabled && css(["&:hover{", "}"], activeDropzone);
|
|
@@ -43,25 +43,25 @@ export var StyledDropzoneContainer = /*#__PURE__*/styled.div.withConfig({
|
|
|
43
43
|
});
|
|
44
44
|
export var StyledDropzoneMessage = /*#__PURE__*/styled.div.withConfig({
|
|
45
45
|
displayName: "StyledDropzoneMessage",
|
|
46
|
-
componentId: "core-
|
|
46
|
+
componentId: "core-12_17_2__sc-by95hy-4"
|
|
47
47
|
})(["user-select:none;"]);
|
|
48
48
|
export var StyledUploadButton = /*#__PURE__*/styled(Button).withConfig({
|
|
49
49
|
displayName: "StyledUploadButton",
|
|
50
|
-
componentId: "core-
|
|
50
|
+
componentId: "core-12_17_2__sc-by95hy-5"
|
|
51
51
|
})(["display:block;margin-left:auto;margin-right:auto;margin-bottom:", "px;"], spacing.sm);
|
|
52
52
|
export var StyledDropzoneCaption = /*#__PURE__*/styled.span.withConfig({
|
|
53
53
|
displayName: "StyledDropzoneCaption",
|
|
54
|
-
componentId: "core-
|
|
54
|
+
componentId: "core-12_17_2__sc-by95hy-6"
|
|
55
55
|
})(["color:", ";"], function (_ref6) {
|
|
56
56
|
var error = _ref6.error;
|
|
57
57
|
return error && colors.gray15;
|
|
58
58
|
});
|
|
59
59
|
export var StyledDropzoneWrapper = /*#__PURE__*/styled(Flex).withConfig({
|
|
60
60
|
displayName: "StyledDropzoneWrapper",
|
|
61
|
-
componentId: "core-
|
|
61
|
+
componentId: "core-12_17_2__sc-by95hy-7"
|
|
62
62
|
})(["height:100%;"]);
|
|
63
63
|
export var StyledDropzoneFocusDetector = /*#__PURE__*/styled(Box).withConfig({
|
|
64
64
|
displayName: "StyledDropzoneFocusDetector",
|
|
65
|
-
componentId: "core-
|
|
65
|
+
componentId: "core-12_17_2__sc-by95hy-8"
|
|
66
66
|
})(["height:100%;"]);
|
|
67
67
|
//# sourceMappingURL=Dropzone.styles.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export var isZeroSize = function isZeroSize(minFileSize) {
|
|
2
|
+
return typeof minFileSize === 'number' && minFileSize <= 1;
|
|
3
|
+
};
|
|
4
|
+
export var getFileDetail = function getFileDetail(file) {
|
|
5
|
+
return file.path || file.name;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=Dropzone.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dropzone.utils.js","names":["isZeroSize","minFileSize","getFileDetail","file","path","name"],"sources":["../../src/Dropzone/Dropzone.utils.ts"],"sourcesContent":["import type { FileWithPath } from 'react-dropzone'\n\nexport const isZeroSize = (minFileSize?: number) => {\n return typeof minFileSize === 'number' && minFileSize <= 1\n}\n\nexport const getFileDetail = (file: FileWithPath) => {\n return file.path || file.name\n}\n"],"mappings":"AAEA,OAAO,IAAMA,UAAU,GAAG,SAAbA,UAAUA,CAAIC,WAAoB,EAAK;EAClD,OAAO,OAAOA,WAAW,KAAK,QAAQ,IAAIA,WAAW,IAAI,CAAC;AAC5D,CAAC;AAED,OAAO,IAAMC,aAAa,GAAG,SAAhBA,aAAaA,CAAIC,IAAkB,EAAK;EACnD,OAAOA,IAAI,CAACC,IAAI,IAAID,IAAI,CAACE,IAAI;AAC/B,CAAC"}
|
|
@@ -6,27 +6,27 @@ var emptyStateWidth = 440;
|
|
|
6
6
|
var emptyStateWidthCompact = 352;
|
|
7
7
|
export var StyledSvg = /*#__PURE__*/styled.svg.withConfig({
|
|
8
8
|
displayName: "StyledSvg",
|
|
9
|
-
componentId: "core-
|
|
9
|
+
componentId: "core-12_17_2__sc-1xaoo8n-0"
|
|
10
10
|
})(["width:200px;height:200px;"]);
|
|
11
11
|
export var StyledImage = /*#__PURE__*/styled.div.withConfig({
|
|
12
12
|
displayName: "StyledImage",
|
|
13
|
-
componentId: "core-
|
|
13
|
+
componentId: "core-12_17_2__sc-1xaoo8n-1"
|
|
14
14
|
})([""]);
|
|
15
15
|
export var StyledTitle = /*#__PURE__*/styled.div.withConfig({
|
|
16
16
|
displayName: "StyledTitle",
|
|
17
|
-
componentId: "core-
|
|
17
|
+
componentId: "core-12_17_2__sc-1xaoo8n-2"
|
|
18
18
|
})(["margin-top:", "px;text-align:center;color:", ";width:", "px;", ""], spacing.xl, colors.gray15, emptyStateWidth, getTypographyIntent('h2'));
|
|
19
19
|
export var StyledDescription = /*#__PURE__*/styled.div.withConfig({
|
|
20
20
|
displayName: "StyledDescription",
|
|
21
|
-
componentId: "core-
|
|
21
|
+
componentId: "core-12_17_2__sc-1xaoo8n-3"
|
|
22
22
|
})(["margin-top:", "px;text-align:center;color:", ";width:", "px;", ""], spacing.lg, colors.gray45, emptyStateWidth, getTypographyIntent('body'));
|
|
23
23
|
export var StyledActions = /*#__PURE__*/styled.div.withConfig({
|
|
24
24
|
displayName: "StyledActions",
|
|
25
|
-
componentId: "core-
|
|
25
|
+
componentId: "core-12_17_2__sc-1xaoo8n-4"
|
|
26
26
|
})(["margin-top:", "px;"], spacing.xl);
|
|
27
27
|
export var StyledEmptyState = /*#__PURE__*/styled.div.withConfig({
|
|
28
28
|
displayName: "StyledEmptyState",
|
|
29
|
-
componentId: "core-
|
|
29
|
+
componentId: "core-12_17_2__sc-1xaoo8n-5"
|
|
30
30
|
})(["display:flex;justify-content:center;align-items:center;flex-direction:column;margin-top:", "px;margin-bottom:", "px;", "{> img{max-width:200px;}}", "}"], function (_ref) {
|
|
31
31
|
var $compact = _ref.$compact;
|
|
32
32
|
return $compact ? 0 : 96;
|
|
@@ -2,14 +2,14 @@ import styled from 'styled-components';
|
|
|
2
2
|
import { getSmallIconBodyTextRules, StyledP } from '../Semantic/Semantic.styles';
|
|
3
3
|
export var StyledField = /*#__PURE__*/styled.div.withConfig({
|
|
4
4
|
displayName: "StyledField",
|
|
5
|
-
componentId: "core-
|
|
5
|
+
componentId: "core-12_17_2__sc-1q3pe6s-0"
|
|
6
6
|
})(["> ", "{", "}"], StyledP, getSmallIconBodyTextRules);
|
|
7
7
|
export var StyledFieldHeader = /*#__PURE__*/styled.div.withConfig({
|
|
8
8
|
displayName: "StyledFieldHeader",
|
|
9
|
-
componentId: "core-
|
|
9
|
+
componentId: "core-12_17_2__sc-1q3pe6s-1"
|
|
10
10
|
})(["", " > ", "{", "}"], getSmallIconBodyTextRules, StyledP, getSmallIconBodyTextRules);
|
|
11
11
|
export var StyledFieldFooter = /*#__PURE__*/styled.div.withConfig({
|
|
12
12
|
displayName: "StyledFieldFooter",
|
|
13
|
-
componentId: "core-
|
|
13
|
+
componentId: "core-12_17_2__sc-1q3pe6s-2"
|
|
14
14
|
})(["> ", "{", "}"], StyledP, getSmallIconBodyTextRules);
|
|
15
15
|
//# sourceMappingURL=Field.styles.js.map
|
|
@@ -3,18 +3,18 @@ import { LinkButton } from '../Button/Button';
|
|
|
3
3
|
import { spacing } from '../_styles/spacing';
|
|
4
4
|
export var StyledFileListDownloadAll = /*#__PURE__*/styled(LinkButton).withConfig({
|
|
5
5
|
displayName: "StyledFileListDownloadAll",
|
|
6
|
-
componentId: "core-
|
|
6
|
+
componentId: "core-12_17_2__sc-7gltjc-0"
|
|
7
7
|
})(["margin-bottom:", "px;"], spacing.xs);
|
|
8
8
|
export var StyledFileListItem = /*#__PURE__*/styled.li.withConfig({
|
|
9
9
|
displayName: "StyledFileListItem",
|
|
10
|
-
componentId: "core-
|
|
10
|
+
componentId: "core-12_17_2__sc-7gltjc-1"
|
|
11
11
|
})(["display:flex;align-items:center;margin-bottom:", "px;word-break:break-word;&:last-child{margin-bottom:0;}"], spacing.xs);
|
|
12
12
|
export var StyledFileListItemTextInactive = /*#__PURE__*/styled.span.withConfig({
|
|
13
13
|
displayName: "StyledFileListItemTextInactive",
|
|
14
|
-
componentId: "core-
|
|
14
|
+
componentId: "core-12_17_2__sc-7gltjc-2"
|
|
15
15
|
})(["cursor:pointer;"]);
|
|
16
16
|
export var StyledFileListItemDownloadIcon = /*#__PURE__*/styled(LinkButton).withConfig({
|
|
17
17
|
displayName: "StyledFileListItemDownloadIcon",
|
|
18
|
-
componentId: "core-
|
|
18
|
+
componentId: "core-12_17_2__sc-7gltjc-3"
|
|
19
19
|
})(["margin-left:", "px;align-self:flex-start;"], spacing.sm);
|
|
20
20
|
//# sourceMappingURL=FileList.styles.js.map
|