@elliemae/ds-uploader 3.0.0-next.0 → 3.0.0-next.4

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/package.json CHANGED
@@ -1,23 +1,26 @@
1
1
  {
2
2
  "name": "@elliemae/ds-uploader",
3
- "version": "3.0.0-next.0",
3
+ "version": "3.0.0-next.4",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Uploader",
6
- "module": "./esm/index.js",
7
- "main": "./cjs/index.js",
8
- "types": "./types/index.d.ts",
6
+ "files": [
7
+ "dist"
8
+ ],
9
+ "module": "./dist/esm/index.js",
10
+ "main": "./dist/cjs/index.js",
11
+ "types": "./dist/types/index.d.ts",
9
12
  "exports": {
10
13
  ".": {
11
- "import": "./esm/index.js",
12
- "require": "./cjs/index.js"
14
+ "import": "./dist/esm/index.js",
15
+ "require": "./dist/cjs/index.js"
13
16
  },
14
17
  "./propTypes": {
15
- "import": "./esm/propTypes.js",
16
- "require": "./cjs/propTypes.js"
18
+ "import": "./dist/esm/propTypes.js",
19
+ "require": "./dist/cjs/propTypes.js"
17
20
  },
18
21
  "./DSUploader": {
19
- "import": "./esm/DSUploader.js",
20
- "require": "./cjs/DSUploader.js"
22
+ "import": "./dist/esm/DSUploader.js",
23
+ "require": "./dist/cjs/DSUploader.js"
21
24
  }
22
25
  },
23
26
  "sideEffects": [
@@ -29,27 +32,27 @@
29
32
  "url": "https://git.elliemae.io/platform-ui/dimsum.git"
30
33
  },
31
34
  "engines": {
32
- "npm": ">=7",
33
- "node": ">=14"
35
+ "pnpm": ">=6",
36
+ "node": ">=16"
34
37
  },
35
38
  "author": "ICE MT",
36
- "scripts": {
37
- "dev": "cross-env NODE_ENV=development && node ../../scripts/build/build.js -w",
38
- "prebuild": "exit 0",
39
- "predev": "exit 0",
40
- "build": "node ../../scripts/build/build.js"
39
+ "jestSonar": {
40
+ "sonar56x": true,
41
+ "reportPath": "reports",
42
+ "reportFile": "tests.xml",
43
+ "indent": 4
41
44
  },
42
45
  "dependencies": {
43
- "@elliemae/ds-button": "3.0.0-next.0",
44
- "@elliemae/ds-classnames": "3.0.0-next.0",
45
- "@elliemae/ds-icons": "3.0.0-next.0",
46
- "@elliemae/ds-tooltip": "3.0.0-next.0",
47
- "@elliemae/ds-utilities": "3.0.0-next.0",
46
+ "@elliemae/ds-button": "3.0.0-next.4",
47
+ "@elliemae/ds-classnames": "3.0.0-next.4",
48
+ "@elliemae/ds-icons": "3.0.0-next.4",
49
+ "@elliemae/ds-tooltip": "3.0.0-next.4",
50
+ "@elliemae/ds-utilities": "3.0.0-next.4",
48
51
  "react-desc": "~4.1.3",
49
52
  "react-dropzone": "~10.2.2"
50
53
  },
51
54
  "devDependencies": {
52
- "@testing-library/jest-dom": "~5.15.0",
55
+ "@testing-library/jest-dom": "~5.15.1",
53
56
  "@testing-library/react": "~12.1.2"
54
57
  },
55
58
  "peerDependencies": {
@@ -59,7 +62,13 @@
59
62
  },
60
63
  "publishConfig": {
61
64
  "access": "public",
62
- "directory": "dist",
63
- "generateSubmodules": true
65
+ "typeSafety": false
66
+ },
67
+ "scripts": {
68
+ "dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
69
+ "test": "node ../../scripts/testing/test.mjs",
70
+ "lint": "node ../../scripts/lint.mjs",
71
+ "dts": "node ../../scripts/dts.mjs",
72
+ "build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs"
64
73
  }
65
74
  }
package/cjs/DSUploader.js DELETED
@@ -1,189 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _jsx2 = require('@babel/runtime/helpers/jsx');
6
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
7
- var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
8
- require('core-js/modules/web.dom-collections.iterator.js');
9
- require('core-js/modules/esnext.async-iterator.filter.js');
10
- require('core-js/modules/esnext.iterator.constructor.js');
11
- require('core-js/modules/esnext.iterator.filter.js');
12
- require('core-js/modules/esnext.async-iterator.for-each.js');
13
- require('core-js/modules/esnext.iterator.for-each.js');
14
- require('react');
15
- var reactDesc = require('react-desc');
16
- var dsClassnames = require('@elliemae/ds-classnames');
17
- var dsUtilities = require('@elliemae/ds-utilities');
18
- var dsIcons = require('@elliemae/ds-icons');
19
- var DSButton = require('@elliemae/ds-button');
20
- var reactDropzone = require('react-dropzone');
21
- var DSTooltip = require('@elliemae/ds-tooltip');
22
- var propTypes = require('./propTypes.js');
23
- var jsxRuntime = require('react/jsx-runtime');
24
-
25
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
26
-
27
- var _jsx2__default = /*#__PURE__*/_interopDefaultLegacy(_jsx2);
28
- var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
29
- var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
30
- var DSButton__default = /*#__PURE__*/_interopDefaultLegacy(DSButton);
31
- var DSTooltip__default = /*#__PURE__*/_interopDefaultLegacy(DSTooltip);
32
-
33
- var _DividerVertical, _DividerVertical2;
34
-
35
- const _excluded = ["labelText"],
36
- _excluded2 = ["containerProps", "label", "icon", "defaultActionLabel", "dragActiveInstructionalText", "dragActiveIcon", "altActionLabel", "acceptedTypesText", "disabledDefault", "disabledAlt", "onDefaultHandlerClick", "onAltHandlerClick", "actions", "showAltAction", "defaultActionTooltipText", "altActionTooltipText"],
37
- _excluded3 = ["onClick"];
38
-
39
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
40
-
41
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
42
- const blockName = 'uploader';
43
- const blockNameInfo = "".concat(blockName, "-info");
44
- const blockNameDragActive = "".concat(blockName, "-drag-active");
45
- const blockNameWrapper = "".concat(blockName, "-wrapper");
46
- const UploaderWrapper = dsClassnames.aggregatedClasses('div')(blockNameWrapper, null, _ref => {
47
- let {
48
- disabled
49
- } = _ref;
50
- return {
51
- disabled
52
- };
53
- });
54
- const Uploader = dsClassnames.aggregatedClasses('div')(blockName, null, _ref2 => {
55
- let {
56
- isDragActive
57
- } = _ref2;
58
- return {
59
- 'drag-active': isDragActive
60
- };
61
- });
62
- const UploaderDragActive = dsClassnames.aggregatedClasses('div')(blockNameDragActive);
63
- const UploaderIconArea = dsClassnames.aggregatedClasses('div')("".concat(blockName, "-icon-wrapper"));
64
- const UploaderInfo = dsClassnames.aggregatedClasses('div')(blockNameInfo);
65
- const InfoText = dsClassnames.aggregatedClasses('span')(blockNameInfo, 'text');
66
- const UploaderActions = dsClassnames.aggregatedClasses('div')(blockNameInfo, 'actions');
67
- const AcceptedTypes = dsClassnames.aggregatedClasses('div')(blockNameWrapper, 'accepted-types');
68
- const DividerVertical = dsClassnames.aggregatedClasses('div')('divider', null, _ref3 => {
69
- let {
70
- vertical
71
- } = _ref3;
72
- return {
73
- vertical
74
- };
75
- });
76
-
77
- function ActionButton(_ref4) {
78
- let {
79
- labelText
80
- } = _ref4,
81
- otherProps = _objectWithoutProperties__default["default"](_ref4, _excluded);
82
-
83
- return /*#__PURE__*/jsxRuntime.jsx(DSButton__default["default"], _objectSpread(_objectSpread({}, otherProps), {}, {
84
- buttonType: "text",
85
- labelText: labelText
86
- }));
87
- }
88
-
89
- const noop = () => null;
90
-
91
- const DSUploader = _ref5 => {
92
- let {
93
- containerProps = {},
94
- label = 'Browse',
95
- // todo: i18n
96
- icon: UploadFileIcon = dsIcons.UploadFile,
97
- defaultActionLabel = 'LOCAL DRIVE',
98
- // todo: i18n
99
- dragActiveInstructionalText = 'DROP FILES HERE',
100
- dragActiveIcon: DragActiveIcon = dsIcons.UploadFile,
101
- altActionLabel = 'DOCUMENTS',
102
- // todo: i18n
103
- acceptedTypesText = 'JPG, JPEG, PNG, PDF',
104
- disabledDefault = false,
105
- disabledAlt = false,
106
- onDefaultHandlerClick = noop,
107
- onAltHandlerClick = noop,
108
- actions = {
109
- defaultAction: 'LOCAL DRIVE',
110
- altAction: 'DOCUMENTS'
111
- },
112
- showAltAction = false,
113
- defaultActionTooltipText,
114
- altActionTooltipText
115
- } = _ref5,
116
- dropzoneProps = _objectWithoutProperties__default["default"](_ref5, _excluded2);
117
-
118
- const {
119
- getRootProps,
120
- getInputProps,
121
- isDragActive
122
- } = reactDropzone.useDropzone(dropzoneProps);
123
-
124
- const _getRootProps = getRootProps(),
125
- {
126
- onClick: onOpenFile
127
- } = _getRootProps,
128
- rootProps = _objectWithoutProperties__default["default"](_getRootProps, _excluded3);
129
-
130
- const disabledAll = disabledDefault && disabledAlt;
131
-
132
- const delfaultActionButton = /*#__PURE__*/_jsx2__default["default"](ActionButton, {
133
- variant: disabledDefault && DSButton.BUTTON_VARIANT.DISABLED,
134
- labelText: actions.defaultAction ? actions.defaultAction : defaultActionLabel,
135
- onClick: function () {
136
- if (!disabledDefault) dsUtilities.runAll(onDefaultHandlerClick, onOpenFile)(...arguments);
137
- }
138
- });
139
-
140
- const altActionButton = /*#__PURE__*/_jsx2__default["default"](ActionButton, {
141
- variant: disabledAlt && DSButton.BUTTON_VARIANT.DISABLED,
142
- labelText: actions.altAction ? actions.altAction : altActionLabel,
143
- onClick: function () {
144
- if (!disabledAlt) onAltHandlerClick(...arguments);
145
- }
146
- });
147
-
148
- const defaultAction = !defaultActionTooltipText ? delfaultActionButton : /*#__PURE__*/_jsx2__default["default"](DSTooltip__default["default"], {
149
- containerProps: {
150
- id: 'default-action-tooltip'
151
- },
152
- interactionType: "hover",
153
- title: defaultActionTooltipText,
154
- triggerComponent: delfaultActionButton
155
- });
156
- const altAction = !altActionTooltipText ? altActionButton : /*#__PURE__*/_jsx2__default["default"](DSTooltip__default["default"], {
157
- containerProps: {
158
- id: 'alt-action-tooltip'
159
- },
160
- interactionType: "hover",
161
- title: altActionTooltipText,
162
- triggerComponent: altActionButton
163
- });
164
- return /*#__PURE__*/jsxRuntime.jsxs(UploaderWrapper, _objectSpread(_objectSpread({}, containerProps), {}, {
165
- classProps: {
166
- disabled: disabledAll
167
- },
168
- children: [/*#__PURE__*/jsxRuntime.jsxs(Uploader, _objectSpread(_objectSpread({}, rootProps), {}, {
169
- classProps: {
170
- isDragActive
171
- },
172
- children: [/*#__PURE__*/_jsx2__default["default"](UploaderIconArea, {}, void 0, /*#__PURE__*/_jsx2__default["default"](UploadFileIcon, {
173
- size: "l"
174
- })), _DividerVertical || (_DividerVertical = /*#__PURE__*/_jsx2__default["default"](DividerVertical, {})), /*#__PURE__*/_jsx2__default["default"](UploaderInfo, {}, void 0, /*#__PURE__*/_jsx2__default["default"](InfoText, {}, void 0, label), /*#__PURE__*/_jsx2__default["default"](UploaderActions, {}, void 0, actions.defaultAction && defaultAction, (actions.altAction || showAltAction) && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
175
- children: [actions.defaultAction && (_DividerVertical2 || (_DividerVertical2 = /*#__PURE__*/_jsx2__default["default"](DividerVertical, {}))), altAction]
176
- }))), !disabledAll && /*#__PURE__*/_jsx2__default["default"](UploaderDragActive, {}, void 0, /*#__PURE__*/_jsx2__default["default"](DragActiveIcon, {}), dragActiveInstructionalText), !disabledAll && /*#__PURE__*/jsxRuntime.jsx("input", _objectSpread({}, getInputProps()))]
177
- })), typeof acceptedTypesText === 'string' && /*#__PURE__*/_jsx2__default["default"](AcceptedTypes, {}, void 0, acceptedTypesText.toUpperCase())]
178
- }));
179
- };
180
-
181
- DSUploader.actions = {
182
- defaultAction: 'LOCAL DRIVE',
183
- altAction: 'DOCUMENTS'
184
- };
185
- const UploaderWithSchema = reactDesc.describe(DSUploader);
186
- UploaderWithSchema.propTypes = propTypes.propTypes;
187
-
188
- exports.UploaderWithSchema = UploaderWithSchema;
189
- exports["default"] = DSUploader;
package/cjs/index.d.js DELETED
@@ -1,2 +0,0 @@
1
- 'use strict';
2
-
package/cjs/index.js DELETED
@@ -1,10 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var DSUploader = require('./DSUploader.js');
6
-
7
-
8
-
9
- exports.UploaderWithSchema = DSUploader.UploaderWithSchema;
10
- exports["default"] = DSUploader["default"];
package/cjs/propTypes.js DELETED
@@ -1,42 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var reactDesc = require('react-desc');
6
- var dsIcons = require('@elliemae/ds-icons');
7
-
8
- /** Inherits the props of react-dropzone https://react-dropzone.netlify.com/ */
9
-
10
- const propTypes = {
11
- containerProps: reactDesc.PropTypes.object.description('Set of Properties attached to the main container.'),
12
- validator: reactDesc.PropTypes.func.description("Custom validator. It must return null if it's valid or an object `{ code: string, message: string }` if it's not."),
13
- maxFiles: reactDesc.PropTypes.number.description('Number of files accepted.'),
14
- minSize: reactDesc.PropTypes.number.description('Minimun file size accepted in bytes.'),
15
- maxSize: reactDesc.PropTypes.number.description('Maximum file size accepted in bytes.'),
16
- onDropRejected: reactDesc.PropTypes.func.description('Cb called when files are rejected using maxFiles, minSize or maxSize properties.'),
17
- disabled: reactDesc.PropTypes.bool.description('Disables the DSUploader.'),
18
- multiple: reactDesc.PropTypes.bool.description('Set to false to restrict multiple files selection/upload.'),
19
- accept: reactDesc.PropTypes.string.description('String containing the accepted MIME type for the DSUploader'),
20
- label: reactDesc.PropTypes.string.description('Uploader label.').defaultValue('Browse'),
21
- icon: reactDesc.PropTypes.element.description('Uploader left icon.').defaultValue(dsIcons.UploadFile),
22
- actions: reactDesc.PropTypes.shape({
23
- defaultAction: reactDesc.PropTypes.string,
24
- altAction: reactDesc.PropTypes.string
25
- }).description('Uploader actions.').defaultValue({
26
- defaultAction: 'LOCAL DRIVE'
27
- }),
28
- defaultActionLabel: reactDesc.PropTypes.string.description('First action button label.'),
29
- showAltAction: reactDesc.PropTypes.bool.description('whether to show alternate action button or not.').defaultValue(true),
30
- altActionLabel: reactDesc.PropTypes.string.description('Second action button label.').defaultValue('LOCAL DRIVE'),
31
- dragActiveInstructionalText: reactDesc.PropTypes.string.description('informative text when user drags a file over the uploader zone.').defaultValue('DROP FILES HERE'),
32
- dragActiveIcon: reactDesc.PropTypes.string.description('Icon when user drags a file over the uploader zone.'),
33
- acceptedTypesText: reactDesc.PropTypes.string.description('Information text to show what types are supported.').defaultValue('JPG, JPEG, PNG, PDF'),
34
- disabledDefault: reactDesc.PropTypes.bool.description('Whether the default uploader is disabled or not.').defaultValue(false),
35
- disabledAlt: reactDesc.PropTypes.bool.description('Whether the alternative uploader is disabled or not.').defaultValue(false),
36
- onDefaultHandlerClick: reactDesc.PropTypes.func.description('First action button click handler.'),
37
- onAltHandlerClick: reactDesc.PropTypes.func.description('Second action button click handler.'),
38
- defaultActionTooltipText: reactDesc.PropTypes.string.description('shows tooltip in default action button.'),
39
- altActionTooltipText: reactDesc.PropTypes.string.description('Shows tooltip in alternate action button.')
40
- };
41
-
42
- exports.propTypes = propTypes;
package/esm/DSUploader.js DELETED
@@ -1,176 +0,0 @@
1
- import 'core-js/modules/esnext.async-iterator.filter.js';
2
- import 'core-js/modules/esnext.iterator.constructor.js';
3
- import 'core-js/modules/esnext.iterator.filter.js';
4
- import 'core-js/modules/esnext.async-iterator.for-each.js';
5
- import 'core-js/modules/esnext.iterator.for-each.js';
6
- import _jsx2 from '@babel/runtime/helpers/esm/jsx';
7
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
8
- import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
9
- import 'core-js/modules/web.dom-collections.iterator.js';
10
- import 'react';
11
- import { describe } from 'react-desc';
12
- import { aggregatedClasses } from '@elliemae/ds-classnames';
13
- import { runAll } from '@elliemae/ds-utilities';
14
- import { UploadFile } from '@elliemae/ds-icons';
15
- import DSButton, { BUTTON_VARIANT } from '@elliemae/ds-button';
16
- import { useDropzone } from 'react-dropzone';
17
- import DSTooltip from '@elliemae/ds-tooltip';
18
- import { propTypes } from './propTypes.js';
19
- import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
20
-
21
- var _DividerVertical, _DividerVertical2;
22
-
23
- const _excluded = ["labelText"],
24
- _excluded2 = ["containerProps", "label", "icon", "defaultActionLabel", "dragActiveInstructionalText", "dragActiveIcon", "altActionLabel", "acceptedTypesText", "disabledDefault", "disabledAlt", "onDefaultHandlerClick", "onAltHandlerClick", "actions", "showAltAction", "defaultActionTooltipText", "altActionTooltipText"],
25
- _excluded3 = ["onClick"];
26
-
27
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
28
-
29
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
30
- const blockName = 'uploader';
31
- const blockNameInfo = "".concat(blockName, "-info");
32
- const blockNameDragActive = "".concat(blockName, "-drag-active");
33
- const blockNameWrapper = "".concat(blockName, "-wrapper");
34
- const UploaderWrapper = aggregatedClasses('div')(blockNameWrapper, null, _ref => {
35
- let {
36
- disabled
37
- } = _ref;
38
- return {
39
- disabled
40
- };
41
- });
42
- const Uploader = aggregatedClasses('div')(blockName, null, _ref2 => {
43
- let {
44
- isDragActive
45
- } = _ref2;
46
- return {
47
- 'drag-active': isDragActive
48
- };
49
- });
50
- const UploaderDragActive = aggregatedClasses('div')(blockNameDragActive);
51
- const UploaderIconArea = aggregatedClasses('div')("".concat(blockName, "-icon-wrapper"));
52
- const UploaderInfo = aggregatedClasses('div')(blockNameInfo);
53
- const InfoText = aggregatedClasses('span')(blockNameInfo, 'text');
54
- const UploaderActions = aggregatedClasses('div')(blockNameInfo, 'actions');
55
- const AcceptedTypes = aggregatedClasses('div')(blockNameWrapper, 'accepted-types');
56
- const DividerVertical = aggregatedClasses('div')('divider', null, _ref3 => {
57
- let {
58
- vertical
59
- } = _ref3;
60
- return {
61
- vertical
62
- };
63
- });
64
-
65
- function ActionButton(_ref4) {
66
- let {
67
- labelText
68
- } = _ref4,
69
- otherProps = _objectWithoutProperties(_ref4, _excluded);
70
-
71
- return /*#__PURE__*/jsx(DSButton, _objectSpread(_objectSpread({}, otherProps), {}, {
72
- buttonType: "text",
73
- labelText: labelText
74
- }));
75
- }
76
-
77
- const noop = () => null;
78
-
79
- const DSUploader = _ref5 => {
80
- let {
81
- containerProps = {},
82
- label = 'Browse',
83
- // todo: i18n
84
- icon: UploadFileIcon = UploadFile,
85
- defaultActionLabel = 'LOCAL DRIVE',
86
- // todo: i18n
87
- dragActiveInstructionalText = 'DROP FILES HERE',
88
- dragActiveIcon: DragActiveIcon = UploadFile,
89
- altActionLabel = 'DOCUMENTS',
90
- // todo: i18n
91
- acceptedTypesText = 'JPG, JPEG, PNG, PDF',
92
- disabledDefault = false,
93
- disabledAlt = false,
94
- onDefaultHandlerClick = noop,
95
- onAltHandlerClick = noop,
96
- actions = {
97
- defaultAction: 'LOCAL DRIVE',
98
- altAction: 'DOCUMENTS'
99
- },
100
- showAltAction = false,
101
- defaultActionTooltipText,
102
- altActionTooltipText
103
- } = _ref5,
104
- dropzoneProps = _objectWithoutProperties(_ref5, _excluded2);
105
-
106
- const {
107
- getRootProps,
108
- getInputProps,
109
- isDragActive
110
- } = useDropzone(dropzoneProps);
111
-
112
- const _getRootProps = getRootProps(),
113
- {
114
- onClick: onOpenFile
115
- } = _getRootProps,
116
- rootProps = _objectWithoutProperties(_getRootProps, _excluded3);
117
-
118
- const disabledAll = disabledDefault && disabledAlt;
119
-
120
- const delfaultActionButton = /*#__PURE__*/_jsx2(ActionButton, {
121
- variant: disabledDefault && BUTTON_VARIANT.DISABLED,
122
- labelText: actions.defaultAction ? actions.defaultAction : defaultActionLabel,
123
- onClick: function () {
124
- if (!disabledDefault) runAll(onDefaultHandlerClick, onOpenFile)(...arguments);
125
- }
126
- });
127
-
128
- const altActionButton = /*#__PURE__*/_jsx2(ActionButton, {
129
- variant: disabledAlt && BUTTON_VARIANT.DISABLED,
130
- labelText: actions.altAction ? actions.altAction : altActionLabel,
131
- onClick: function () {
132
- if (!disabledAlt) onAltHandlerClick(...arguments);
133
- }
134
- });
135
-
136
- const defaultAction = !defaultActionTooltipText ? delfaultActionButton : /*#__PURE__*/_jsx2(DSTooltip, {
137
- containerProps: {
138
- id: 'default-action-tooltip'
139
- },
140
- interactionType: "hover",
141
- title: defaultActionTooltipText,
142
- triggerComponent: delfaultActionButton
143
- });
144
- const altAction = !altActionTooltipText ? altActionButton : /*#__PURE__*/_jsx2(DSTooltip, {
145
- containerProps: {
146
- id: 'alt-action-tooltip'
147
- },
148
- interactionType: "hover",
149
- title: altActionTooltipText,
150
- triggerComponent: altActionButton
151
- });
152
- return /*#__PURE__*/jsxs(UploaderWrapper, _objectSpread(_objectSpread({}, containerProps), {}, {
153
- classProps: {
154
- disabled: disabledAll
155
- },
156
- children: [/*#__PURE__*/jsxs(Uploader, _objectSpread(_objectSpread({}, rootProps), {}, {
157
- classProps: {
158
- isDragActive
159
- },
160
- children: [/*#__PURE__*/_jsx2(UploaderIconArea, {}, void 0, /*#__PURE__*/_jsx2(UploadFileIcon, {
161
- size: "l"
162
- })), _DividerVertical || (_DividerVertical = /*#__PURE__*/_jsx2(DividerVertical, {})), /*#__PURE__*/_jsx2(UploaderInfo, {}, void 0, /*#__PURE__*/_jsx2(InfoText, {}, void 0, label), /*#__PURE__*/_jsx2(UploaderActions, {}, void 0, actions.defaultAction && defaultAction, (actions.altAction || showAltAction) && /*#__PURE__*/jsxs(Fragment, {
163
- children: [actions.defaultAction && (_DividerVertical2 || (_DividerVertical2 = /*#__PURE__*/_jsx2(DividerVertical, {}))), altAction]
164
- }))), !disabledAll && /*#__PURE__*/_jsx2(UploaderDragActive, {}, void 0, /*#__PURE__*/_jsx2(DragActiveIcon, {}), dragActiveInstructionalText), !disabledAll && /*#__PURE__*/jsx("input", _objectSpread({}, getInputProps()))]
165
- })), typeof acceptedTypesText === 'string' && /*#__PURE__*/_jsx2(AcceptedTypes, {}, void 0, acceptedTypesText.toUpperCase())]
166
- }));
167
- };
168
-
169
- DSUploader.actions = {
170
- defaultAction: 'LOCAL DRIVE',
171
- altAction: 'DOCUMENTS'
172
- };
173
- const UploaderWithSchema = describe(DSUploader);
174
- UploaderWithSchema.propTypes = propTypes;
175
-
176
- export { UploaderWithSchema, DSUploader as default };
package/esm/index.d.js DELETED
@@ -1 +0,0 @@
1
-
package/esm/index.js DELETED
@@ -1 +0,0 @@
1
- export { UploaderWithSchema, default } from './DSUploader.js';
package/esm/propTypes.js DELETED
@@ -1,38 +0,0 @@
1
- import { PropTypes } from 'react-desc';
2
- import { UploadFile } from '@elliemae/ds-icons';
3
-
4
- /** Inherits the props of react-dropzone https://react-dropzone.netlify.com/ */
5
-
6
- const propTypes = {
7
- containerProps: PropTypes.object.description('Set of Properties attached to the main container.'),
8
- validator: PropTypes.func.description("Custom validator. It must return null if it's valid or an object `{ code: string, message: string }` if it's not."),
9
- maxFiles: PropTypes.number.description('Number of files accepted.'),
10
- minSize: PropTypes.number.description('Minimun file size accepted in bytes.'),
11
- maxSize: PropTypes.number.description('Maximum file size accepted in bytes.'),
12
- onDropRejected: PropTypes.func.description('Cb called when files are rejected using maxFiles, minSize or maxSize properties.'),
13
- disabled: PropTypes.bool.description('Disables the DSUploader.'),
14
- multiple: PropTypes.bool.description('Set to false to restrict multiple files selection/upload.'),
15
- accept: PropTypes.string.description('String containing the accepted MIME type for the DSUploader'),
16
- label: PropTypes.string.description('Uploader label.').defaultValue('Browse'),
17
- icon: PropTypes.element.description('Uploader left icon.').defaultValue(UploadFile),
18
- actions: PropTypes.shape({
19
- defaultAction: PropTypes.string,
20
- altAction: PropTypes.string
21
- }).description('Uploader actions.').defaultValue({
22
- defaultAction: 'LOCAL DRIVE'
23
- }),
24
- defaultActionLabel: PropTypes.string.description('First action button label.'),
25
- showAltAction: PropTypes.bool.description('whether to show alternate action button or not.').defaultValue(true),
26
- altActionLabel: PropTypes.string.description('Second action button label.').defaultValue('LOCAL DRIVE'),
27
- dragActiveInstructionalText: PropTypes.string.description('informative text when user drags a file over the uploader zone.').defaultValue('DROP FILES HERE'),
28
- dragActiveIcon: PropTypes.string.description('Icon when user drags a file over the uploader zone.'),
29
- acceptedTypesText: PropTypes.string.description('Information text to show what types are supported.').defaultValue('JPG, JPEG, PNG, PDF'),
30
- disabledDefault: PropTypes.bool.description('Whether the default uploader is disabled or not.').defaultValue(false),
31
- disabledAlt: PropTypes.bool.description('Whether the alternative uploader is disabled or not.').defaultValue(false),
32
- onDefaultHandlerClick: PropTypes.func.description('First action button click handler.'),
33
- onAltHandlerClick: PropTypes.func.description('Second action button click handler.'),
34
- defaultActionTooltipText: PropTypes.string.description('shows tooltip in default action button.'),
35
- altActionTooltipText: PropTypes.string.description('Shows tooltip in alternate action button.')
36
- };
37
-
38
- export { propTypes };