@uxf/ui 11.1.0 → 11.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -28,6 +28,7 @@ const react_1 = require("@floating-ui/react");
|
|
|
28
28
|
const react_2 = require("@headlessui/react");
|
|
29
29
|
const useAnchorProps_1 = require("@uxf/core/hooks/useAnchorProps");
|
|
30
30
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
31
|
+
const is_empty_1 = require("@uxf/core/utils/is-empty");
|
|
31
32
|
const react_3 = __importStar(require("react"));
|
|
32
33
|
const button_1 = require("../button");
|
|
33
34
|
const use_dropdown_1 = require("../hooks/use-dropdown");
|
|
@@ -51,6 +52,9 @@ const ButtonList = (props) => {
|
|
|
51
52
|
const openButtonIcon = ((_a = props.openButton) === null || _a === void 0 ? void 0 : _a.icon) === null ? null : (_c = (_b = props.openButton) === null || _b === void 0 ? void 0 : _b.icon) !== null && _c !== void 0 ? _c : "ellipsis-vertical";
|
|
52
53
|
const openButtonLabel = (_e = (_d = props.openButton) === null || _d === void 0 ? void 0 : _d.label) !== null && _e !== void 0 ? _e : null;
|
|
53
54
|
const dropdown = (0, use_dropdown_1.useDropdown)((_f = props.menuPlacement) !== null && _f !== void 0 ? _f : "bottom-start", false, props.menuStrategy);
|
|
55
|
+
if ((0, is_empty_1.isEmpty)(props.buttons)) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
54
58
|
return (react_3.default.createElement("div", { className: (0, cx_1.cx)("uxf-button-list", props.className) },
|
|
55
59
|
buttonsToRender.map((button, index) => {
|
|
56
60
|
var _a, _b, _c;
|
|
@@ -30,6 +30,7 @@ const cx_1 = require("@uxf/core/utils/cx");
|
|
|
30
30
|
const react_1 = __importStar(require("react"));
|
|
31
31
|
const react_dropzone_1 = require("react-dropzone");
|
|
32
32
|
const icon_1 = require("../icon");
|
|
33
|
+
const validator_exceptions_1 = require("../utils/validator/validator-exceptions");
|
|
33
34
|
function fileToFileResponse(file) {
|
|
34
35
|
return {
|
|
35
36
|
id: -Math.round(Math.random() * 100000000),
|
|
@@ -67,6 +68,16 @@ exports.DropzoneInput = (0, react_1.forwardRef)((props, ref) => {
|
|
|
67
68
|
const refValue = (0, react_1.useRef)();
|
|
68
69
|
refValue.current = props.value;
|
|
69
70
|
const inputRef = (0, react_1.useRef)(null);
|
|
71
|
+
const handleFileRejected = async (fileRejections) => {
|
|
72
|
+
fileRejections.forEach((fileRejection) => {
|
|
73
|
+
if (props.maxFileSize && fileRejection.file.size > props.maxFileSize) {
|
|
74
|
+
if (props.onUploadError) {
|
|
75
|
+
props.onUploadError(validator_exceptions_1.ValidatorExceptions.MaxFileSize);
|
|
76
|
+
}
|
|
77
|
+
throw validator_exceptions_1.ValidatorExceptions.MaxFileSize;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
};
|
|
70
81
|
const handleFileDrop = async (acceptedFiles) => {
|
|
71
82
|
const files = acceptedFiles.map((file) => ({
|
|
72
83
|
...fileToFileResponse(file),
|
|
@@ -109,6 +120,7 @@ exports.DropzoneInput = (0, react_1.forwardRef)((props, ref) => {
|
|
|
109
120
|
noDrag: props.noDrag,
|
|
110
121
|
onDrop: handleFileDrop,
|
|
111
122
|
preventDropOnDocument: props.noDrag,
|
|
123
|
+
onDropRejected: handleFileRejected,
|
|
112
124
|
});
|
|
113
125
|
const labelOnCLick = (e) => {
|
|
114
126
|
e.stopPropagation();
|