@popsure/dirty-swan 0.38.0 → 0.38.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/cjs/index.js +22 -16
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/components/autocompleteAddress/index.js +1 -1
- package/dist/esm/components/autocompleteAddress/index.js.map +1 -1
- package/dist/esm/components/autocompleteAddress/index.test.js +6 -6
- package/dist/esm/components/autocompleteAddress/index.test.js.map +1 -1
- package/dist/esm/components/button/index.js +1 -1
- package/dist/esm/components/button/index.js.map +1 -1
- package/dist/esm/components/icon/IconWrapper/IconWrapper.js +5 -2
- package/dist/esm/components/icon/IconWrapper/IconWrapper.js.map +1 -1
- package/dist/esm/components/icon/icons.stories.js +1 -1
- package/dist/esm/components/icon/index.stories.js +1 -1
- package/dist/esm/components/multiDropzone/index.js +15 -12
- package/dist/esm/components/multiDropzone/index.js.map +1 -1
- package/dist/esm/components/multiDropzone/index.test.js +71 -51
- package/dist/esm/components/multiDropzone/index.test.js.map +1 -1
- package/dist/esm/{index-38cf6d96.js → index-35a77b9b.js} +1 -1
- package/dist/esm/{index-38cf6d96.js.map → index-35a77b9b.js.map} +1 -1
- package/package.json +1 -1
- package/src/lib/components/autocompleteAddress/index.test.tsx +6 -6
- package/src/lib/components/autocompleteAddress/index.tsx +9 -5
- package/src/lib/components/button/index.tsx +2 -3
- package/src/lib/components/icon/IconWrapper/IconWrapper.tsx +5 -1
- package/src/lib/components/icon/IconWrapper/styles.module.scss +1 -1
- package/src/lib/components/multiDropzone/index.test.tsx +101 -81
- package/src/lib/components/multiDropzone/index.tsx +52 -40
- package/src/lib/components/multiDropzone/style.module.scss +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -5387,7 +5387,7 @@ var AutocompleteAddress = function (_a) {
|
|
|
5387
5387
|
debouncedSetPlace(newAddress);
|
|
5388
5388
|
} }, "autocomplete-city")] }), void 0)] }, void 0)) }), void 0),
|
|
5389
5389
|
manualAddressEntry === false && (jsxRuntime.jsxs("div", __assign({ className: "p-p mt8" }, { children: [(manualAddressEntryTexts === null || manualAddressEntryTexts === void 0 ? void 0 : manualAddressEntryTexts.preText) || 'Or ',
|
|
5390
|
-
jsxRuntime.jsx("
|
|
5390
|
+
jsxRuntime.jsx("button", __assign({ className: 'p-a p-p fw-bold c-pointer bg-transparent', onClick: handleEnterAddressManually, type: "button" }, { children: (manualAddressEntryTexts === null || manualAddressEntryTexts === void 0 ? void 0 : manualAddressEntryTexts.cta) || 'enter address manually' }), void 0)] }), void 0))] }, void 0));
|
|
5391
5391
|
};
|
|
5392
5392
|
|
|
5393
5393
|
var propTypes$1 = {exports: {}};
|
|
@@ -8577,23 +8577,25 @@ var MultiDropzone = function (_a) {
|
|
|
8577
8577
|
var formattedAccept = getFormattedAcceptObject(accept);
|
|
8578
8578
|
var fileList = formatAcceptFileList(formattedAccept);
|
|
8579
8579
|
var maxSizePlaceholder = maxSize && maxSize > 0
|
|
8580
|
-
? ((textOverrides === null || textOverrides === void 0 ? void 0 : textOverrides.sizeUpToText) ||
|
|
8581
|
-
:
|
|
8582
|
-
var placeholder = ((textOverrides === null || textOverrides === void 0 ? void 0 : textOverrides.supportsTextShort) ||
|
|
8580
|
+
? ((textOverrides === null || textOverrides === void 0 ? void 0 : textOverrides.sizeUpToText) || 'up to') + " " + formatBytes(maxSize)
|
|
8581
|
+
: '';
|
|
8582
|
+
var placeholder = ((textOverrides === null || textOverrides === void 0 ? void 0 : textOverrides.supportsTextShort) || 'Supports') + " " + (fileList || 'JPEG, PNG, PDF') + " " + maxSizePlaceholder;
|
|
8583
8583
|
var isOverMaxFiles = maxFiles > 0 && uploadedFiles.length > maxFiles;
|
|
8584
|
-
var removeError = function (removeId) {
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8584
|
+
var removeError = function (removeId) {
|
|
8585
|
+
return setErrors(errors.filter(function (_a) {
|
|
8586
|
+
var id = _a.id;
|
|
8587
|
+
return id !== removeId;
|
|
8588
|
+
}));
|
|
8589
|
+
};
|
|
8588
8590
|
var onDrop = require$$0.useCallback(function (acceptedFiles, filesRejected) {
|
|
8589
8591
|
onFileSelect(acceptedFiles);
|
|
8590
|
-
setErrors(function (previousErrors) { return
|
|
8592
|
+
setErrors(function (previousErrors) { return __spreadArray$1(__spreadArray$1([], previousErrors), filesRejected.map(function (_a) {
|
|
8591
8593
|
var errors = _a.errors;
|
|
8592
8594
|
return ({
|
|
8593
8595
|
id: generateId(),
|
|
8594
8596
|
message: getErrorMessage(errors[0], { fileList: fileList, maxSize: maxSize }, textOverrides),
|
|
8595
8597
|
});
|
|
8596
|
-
}))
|
|
8598
|
+
})); });
|
|
8597
8599
|
}, [fileList, maxSize, onFileSelect, textOverrides]);
|
|
8598
8600
|
var _f = useDropzone({
|
|
8599
8601
|
accept: formattedAccept,
|
|
@@ -8601,11 +8603,12 @@ var MultiDropzone = function (_a) {
|
|
|
8601
8603
|
maxSize: maxSize,
|
|
8602
8604
|
onDrop: onDrop,
|
|
8603
8605
|
}), getRootProps = _f.getRootProps, getInputProps = _f.getInputProps;
|
|
8606
|
+
var uniqueId = require$$0.useRef(generateId());
|
|
8604
8607
|
return (jsxRuntime.jsxs("div", __assign({ className: styles$s.container }, { children: [jsxRuntime.jsxs("div", __assign({ className: classNames("w100 ta-center br8 c-pointer " + styles$s.dropzoneContainer, (_b = {},
|
|
8605
8608
|
_b[styles$s['dropzoneContainerDisabled']] = uploading,
|
|
8606
|
-
_b)) }, getRootProps(), { children: [jsxRuntime.jsx("input", __assign({ "data-testid": "ds-drop-input" }, getInputProps()), void 0),
|
|
8609
|
+
_b)) }, getRootProps(), { children: [jsxRuntime.jsx("input", __assign({ "data-testid": "ds-drop-input", id: uniqueId.current }, getInputProps()), void 0),
|
|
8607
8610
|
jsxRuntime.jsx("img", { className: isCondensed ? styles$s.img : '', src: isCondensed ? icons.uploadSmallIcon : icons.uploadIcon, alt: "purple cloud with an arrow" }, void 0),
|
|
8608
|
-
jsxRuntime.jsx("
|
|
8611
|
+
jsxRuntime.jsx("label", __assign({ htmlFor: uniqueId.current, className: "p-h4 mt8 d-block c-pointer " + (isCondensed ? styles$s.textInline : '') }, { children: uploading
|
|
8609
8612
|
? (textOverrides === null || textOverrides === void 0 ? void 0 : textOverrides.currentlyUploadingText) ||
|
|
8610
8613
|
'Please wait while uploading file...'
|
|
8611
8614
|
: (textOverrides === null || textOverrides === void 0 ? void 0 : textOverrides.instructionsText) || 'Choose file or drag & drop' }), void 0),
|
|
@@ -8620,7 +8623,7 @@ var MultiDropzone = function (_a) {
|
|
|
8620
8623
|
}, onRemoveFile: function () { return removeError(id); }, uploading: false }, id));
|
|
8621
8624
|
}),
|
|
8622
8625
|
uploadedFiles.length > 0 && (jsxRuntime.jsx("div", __assign({ className: "w100 mt16" }, { children: uploadedFiles.map(function (file) { return (jsxRuntime.jsx(UploadFileCell, { uploadStatus: getUploadStatus(file.progress, file.error), file: file, onRemoveFile: onRemoveFile, uploading: uploading }, file.id)); }) }), void 0)),
|
|
8623
|
-
jsxRuntime.jsx(AnimateHeight, __assign({ duration: 300, height: isOverMaxFiles ? 'auto' : 0 }, { children: jsxRuntime.jsx("p", __assign({ className: "tc-red-500 p-p--small" }, { children: (textOverrides === null || textOverrides === void 0 ? void 0 : textOverrides.tooManyFilesError) ||
|
|
8626
|
+
jsxRuntime.jsx(AnimateHeight, __assign({ duration: 300, height: isOverMaxFiles ? 'auto' : 0 }, { children: jsxRuntime.jsx("p", __assign({ className: "tc-red-500 p-p--small" }, { children: (textOverrides === null || textOverrides === void 0 ? void 0 : textOverrides.tooManyFilesError) || 'Too many files.' }), void 0) }), void 0)] }), void 0));
|
|
8624
8627
|
};
|
|
8625
8628
|
|
|
8626
8629
|
var css_248z$r = ".styles-module_content-container__4wuQ0 {\n display: flex;\n justify-content: center;\n align-items: center;\n}";
|
|
@@ -8635,7 +8638,7 @@ var buttonTypeClassNameMap = {
|
|
|
8635
8638
|
outlineGrey: 'p-btn--outline-grey',
|
|
8636
8639
|
};
|
|
8637
8640
|
var Button = require$$0__default['default'].forwardRef(function (_a, ref) {
|
|
8638
|
-
var className = _a.className, _b = _a.loading, loading = _b === void 0 ? false : _b, buttonTitle = _a.buttonTitle, _c = _a.buttonType, buttonType = _c === void 0 ? 'primary' : _c, leftIcon = _a.leftIcon
|
|
8641
|
+
var className = _a.className, _b = _a.loading, loading = _b === void 0 ? false : _b, buttonTitle = _a.buttonTitle, _c = _a.buttonType, buttonType = _c === void 0 ? 'primary' : _c, leftIcon = _a.leftIcon, props = __rest$1(_a, ["className", "loading", "buttonTitle", "buttonType", "leftIcon"]);
|
|
8639
8642
|
var buttonClassName = buttonTypeClassNameMap[buttonType];
|
|
8640
8643
|
var loadingClassName = loading ? 'p-btn--loading' : '';
|
|
8641
8644
|
return (jsxRuntime.jsx("button", __assign({ ref: ref, className: buttonClassName + " " + loadingClassName + " " + (className !== null && className !== void 0 ? className : '') }, props, { children: leftIcon ? (jsxRuntime.jsxs("div", __assign({ className: styles$q['content-container'] }, { children: [jsxRuntime.jsx("img", { width: "20px", height: "20px", className: "mr8", src: leftIcon.src, alt: leftIcon.alt }, void 0),
|
|
@@ -36380,7 +36383,7 @@ var Spinner = function (_a) {
|
|
|
36380
36383
|
return (jsxRuntime.jsx("div", { className: classNames('ds-spinner', "ds-spinner__" + size), "data-testid": "ds-spinner" }, void 0));
|
|
36381
36384
|
};
|
|
36382
36385
|
|
|
36383
|
-
var css_248z = ".styles-module_wrapper__1_lY0 {\n
|
|
36386
|
+
var css_248z = ".styles-module_wrapper__1_lY0 {\n padding: 4px;\n}";
|
|
36384
36387
|
var styles = {"wrapper":"styles-module_wrapper__1_lY0"};
|
|
36385
36388
|
styleInject(css_248z);
|
|
36386
36389
|
|
|
@@ -36389,7 +36392,10 @@ var IconWrapper = function (_a) {
|
|
|
36389
36392
|
var children = _a.children, _c = _a.size, size = _c === void 0 ? 16 : _c, color = _a.color, className = _a.className;
|
|
36390
36393
|
return (jsxRuntime.jsx("span", __assign({ className: classNames('d-inline-block', styles.wrapper, className !== null && className !== void 0 ? className : '', (_b = {},
|
|
36391
36394
|
_b["tc-" + color] = !!color,
|
|
36392
|
-
_b))
|
|
36395
|
+
_b)), style: {
|
|
36396
|
+
width: size + "px",
|
|
36397
|
+
height: size + "px"
|
|
36398
|
+
} }, { children: jsxRuntime.jsx("svg", __assign({ className: 'w100', viewBox: "0 0 24 24", fill: "none" }, { children: children }), void 0) }), void 0));
|
|
36393
36399
|
};
|
|
36394
36400
|
|
|
36395
36401
|
var _1 = (function (props) {
|