@appcorp/app-corp-vista 0.1.36 → 0.1.38
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.
|
@@ -33,12 +33,18 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
return result;
|
|
34
34
|
};
|
|
35
35
|
})();
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
36
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
40
|
exports.VistaUploadV1 = void 0;
|
|
38
41
|
var react_1 = __importStar(require("react"));
|
|
42
|
+
var image_1 = __importDefault(require("next/image"));
|
|
39
43
|
var outline_1 = require("@heroicons/react/24/outline");
|
|
44
|
+
var vista_button_v1_1 = require("../vista-button-v1/vista-button-v1");
|
|
45
|
+
var vista_button_type_1 = require("../../type/vista-button-type");
|
|
40
46
|
var VistaUploadV1 = function (_a) {
|
|
41
|
-
var _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, error = _a.error, fileInfo = _a.fileInfo, handleOnChange = _a.handleOnChange, id = _a.id, info = _a.info, label = _a.label, _d = _a.required, required = _d === void 0 ? false : _d, _e = _a.type, type = _e === void 0 ? 'file' : _e;
|
|
47
|
+
var _b = _a.className, className = _b === void 0 ? '' : _b, _c = _a.disabled, disabled = _c === void 0 ? false : _c, error = _a.error, fileInfo = _a.fileInfo, handleIconClick = _a.handleIconClick, handleOnChange = _a.handleOnChange, id = _a.id, imageUrl = _a.imageUrl, info = _a.info, label = _a.label, _d = _a.required, required = _d === void 0 ? false : _d, _e = _a.type, type = _e === void 0 ? 'file' : _e;
|
|
42
48
|
var inputRef = (0, react_1.useRef)(null);
|
|
43
49
|
var handleClick = function (e) {
|
|
44
50
|
var _a;
|
|
@@ -50,8 +56,8 @@ var VistaUploadV1 = function (_a) {
|
|
|
50
56
|
label,
|
|
51
57
|
" ",
|
|
52
58
|
required && react_1.default.createElement("sup", { className: "text-red-500" }, "*")),
|
|
53
|
-
react_1.default.createElement("div", { className: "mt-2 flex justify-center rounded-lg border border-dashed border-gray-500 px-6 py-10", onClick: handleClick },
|
|
54
|
-
react_1.default.createElement("div", { className: "text-center" },
|
|
59
|
+
react_1.default.createElement("div", { className: "relative mt-2 flex justify-center rounded-lg border border-dashed border-gray-500 px-6 py-10 min-h-52", onClick: handleClick },
|
|
60
|
+
!imageUrl && (react_1.default.createElement("div", { className: "text-center" },
|
|
55
61
|
react_1.default.createElement(outline_1.PhotoIcon, { "aria-hidden": "true", className: "mx-auto size-16 text-gray-500" }),
|
|
56
62
|
react_1.default.createElement("div", { className: "mt-4 flex justify-center text-sm/6 text-gray-500" },
|
|
57
63
|
react_1.default.createElement("label", { htmlFor: "file-upload", className: "relative cursor-pointer rounded-md font-semibold text-primary focus-within:ring-2 focus-within:ring-primary focus-within:ring-offset-2 focus-within:outline-hidden hover:text-primary/50" },
|
|
@@ -59,6 +65,9 @@ var VistaUploadV1 = function (_a) {
|
|
|
59
65
|
react_1.default.createElement("input", { className: "sr-only", disabled: disabled, id: id, name: id, onChange: handleOnChange, ref: inputRef, required: required, type: type })),
|
|
60
66
|
react_1.default.createElement("p", { className: "pl-1" }, "or drag and drop")),
|
|
61
67
|
fileInfo && (react_1.default.createElement("p", { className: "text-xs/5 text-gray-500" }, fileInfo)))),
|
|
68
|
+
imageUrl && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
69
|
+
react_1.default.createElement(vista_button_v1_1.VistaButtonV1, { className: 'absolute top-3 right-3', handleOnClick: handleIconClick, icon: react_1.default.createElement(outline_1.XMarkIcon, { className: 'size-6' }), variant: vista_button_type_1.VISTA_BUTTON_VARIANT.ICON }),
|
|
70
|
+
react_1.default.createElement(image_1.default, { alt: 'upload', className: 'object-contain', fill: true, sizes: '50vw', height: 0, src: imageUrl, width: 0 })))),
|
|
62
71
|
info && !error && (react_1.default.createElement("p", { id: "".concat(id, "-info"), className: "mt-2 text-sm text-primary" }, info)),
|
|
63
72
|
error && !info && (react_1.default.createElement("p", { id: "".concat(id, "-error"), className: "mt-2 text-sm text-red-500 dark:text-red-500" }, error))));
|
|
64
73
|
};
|
package/package.json
CHANGED
|
@@ -4,8 +4,10 @@ export interface VistaUploadV1Props {
|
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
error?: string;
|
|
6
6
|
fileInfo?: string;
|
|
7
|
+
handleIconClick: () => void;
|
|
7
8
|
handleOnChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
8
9
|
id: string;
|
|
10
|
+
imageUrl?: string;
|
|
9
11
|
info?: string;
|
|
10
12
|
label?: string;
|
|
11
13
|
required?: boolean;
|