@appcorp/app-corp-vista 0.1.5 → 0.1.7
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/molecules/vista-text-input-v1.js +2 -2
- package/molecules/vista-upload-v1/vista-upload-v1.d.ts +3 -0
- package/molecules/vista-upload-v1/vista-upload-v1.js +65 -0
- package/package.json +1 -1
- package/type/vista-upload-type.d.ts +13 -0
- package/type/vista-upload-type.js +2 -0
- package/utils/form-schema.d.ts +4 -1
- package/utils/form-schema.js +3 -0
|
@@ -19,9 +19,9 @@ var VistaTextInputV1 = function (_a) {
|
|
|
19
19
|
react_1.default.createElement("div", { className: "relative" },
|
|
20
20
|
prefix && (react_1.default.createElement("div", { className: "pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3" },
|
|
21
21
|
react_1.default.createElement("span", { className: "text-gray-500 sm:text-sm" }, prefix))),
|
|
22
|
-
react_1.default.createElement("input", { autoComplete: id, className: "block w-full rounded-md border-0 bg-white/5 dark:bg-white/5 py-1.5 text-gray-900 dark:text-white shadow-sm ring-1 ring-inset ring-gray-200 focus:ring-2 focus:ring-inset focus:ring-primary disabled:cursor-not-allowed disabled:bg-gray-50 disabled:text-gray-300 disabled:ring-gray-200 sm:text-sm/6 dark:disabled:bg-gray-800 dark:disabled:text-gray-400 dark:disabled:ring-gray-700 placeholder:text-gray-500 ".concat(prefix && 'pl-7', " ").concat(className),
|
|
22
|
+
react_1.default.createElement("input", { autoComplete: id, className: "block w-full rounded-md border-0 bg-white/5 dark:bg-white/5 py-1.5 text-gray-900 dark:text-white shadow-sm ring-1 ring-inset ring-gray-200 focus:ring-2 focus:ring-inset focus:ring-primary disabled:cursor-not-allowed disabled:bg-gray-50 disabled:text-gray-300 disabled:ring-gray-200 sm:text-sm/6 dark:disabled:bg-gray-800 dark:disabled:text-gray-400 dark:disabled:ring-gray-700 placeholder:text-gray-500 ".concat(prefix && 'pl-7', " ").concat(className), disabled: disabled, id: id, name: id, onChange: function (e) {
|
|
23
23
|
return handleOnChange(id, e.target.value);
|
|
24
|
-
}, placeholder: placeholder, readOnly: readOnly, type: type, value: value
|
|
24
|
+
}, autoFocus: autoFocus, placeholder: placeholder, readOnly: readOnly, required: required, type: type, value: value }),
|
|
25
25
|
suffix && (react_1.default.createElement("div", { className: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3" },
|
|
26
26
|
react_1.default.createElement("span", { id: "price-currency", className: "text-gray-500 sm:text-sm" }, suffix)))),
|
|
27
27
|
info && !error && (react_1.default.createElement("p", { id: "".concat(id, "-info"), className: "mt-2 text-sm text-primary" }, info)),
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.VistaUploadV1 = void 0;
|
|
38
|
+
var react_1 = __importStar(require("react"));
|
|
39
|
+
var outline_1 = require("@heroicons/react/24/outline");
|
|
40
|
+
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;
|
|
42
|
+
var inputRef = (0, react_1.useRef)(null);
|
|
43
|
+
var handleClick = function (e) {
|
|
44
|
+
var _a;
|
|
45
|
+
e.stopPropagation();
|
|
46
|
+
(_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.click();
|
|
47
|
+
};
|
|
48
|
+
return (react_1.default.createElement("div", { className: className },
|
|
49
|
+
react_1.default.createElement("label", { htmlFor: id, className: "block text-sm/6 font-medium text-gray-900 dark:text-white" },
|
|
50
|
+
label,
|
|
51
|
+
" ",
|
|
52
|
+
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" },
|
|
55
|
+
react_1.default.createElement(outline_1.PhotoIcon, { "aria-hidden": "true", className: "mx-auto size-16 text-gray-500" }),
|
|
56
|
+
react_1.default.createElement("div", { className: "mt-4 flex justify-center text-sm/6 text-gray-500" },
|
|
57
|
+
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" },
|
|
58
|
+
react_1.default.createElement("span", null, "Upload a file"),
|
|
59
|
+
react_1.default.createElement("input", { className: "sr-only", disabled: disabled, id: id, name: id, onChange: handleOnChange, ref: inputRef, required: required, type: type })),
|
|
60
|
+
react_1.default.createElement("p", { className: "pl-1" }, "or drag and drop")),
|
|
61
|
+
fileInfo && (react_1.default.createElement("p", { className: "text-xs/5 text-gray-500" }, fileInfo)))),
|
|
62
|
+
info && !error && (react_1.default.createElement("p", { id: "".concat(id, "-info"), className: "mt-2 text-sm text-primary" }, info)),
|
|
63
|
+
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
|
+
};
|
|
65
|
+
exports.VistaUploadV1 = VistaUploadV1;
|
package/package.json
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ChangeEvent, HTMLInputTypeAttribute } from "react";
|
|
2
|
+
export interface VistaUploadV1Props {
|
|
3
|
+
className?: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
error?: string;
|
|
6
|
+
fileInfo?: string;
|
|
7
|
+
handleOnChange: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
8
|
+
id: string;
|
|
9
|
+
info?: string;
|
|
10
|
+
label?: string;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
type?: HTMLInputTypeAttribute;
|
|
13
|
+
}
|
package/utils/form-schema.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { VistaVerticalDividerV4Props } from "../type/vista-vertical-divider-type
|
|
|
7
7
|
import { VistaCheckboxV1Props, VistaCheckboxV2Props, VistaCheckboxV3Props } from "../type/vista-checkbox-type";
|
|
8
8
|
import { VistaRadioV1Props } from "../type/vista-radio-type";
|
|
9
9
|
import { VistaButtonV1Props } from "../type/vista-button-type";
|
|
10
|
+
import { VistaUploadV1Props } from "../type/vista-upload-type";
|
|
10
11
|
export declare enum VISTA_FORM_ELEMENTS {
|
|
11
12
|
BUTTON_V1 = "BUTTON_V1",
|
|
12
13
|
CHECKBOX_V1 = "CHECKBOX_V1",
|
|
@@ -17,7 +18,8 @@ export declare enum VISTA_FORM_ELEMENTS {
|
|
|
17
18
|
RADIO_V1 = "RADIO_V1",
|
|
18
19
|
SELECT_V1 = "SELECT_V1",
|
|
19
20
|
TEXT_AREA_V1 = "TEXT_AREA_V1",
|
|
20
|
-
TEXT_INPUT_V1 = "TEXT_INPUT_V1"
|
|
21
|
+
TEXT_INPUT_V1 = "TEXT_INPUT_V1",
|
|
22
|
+
UPLOAD_V1 = "UPLOAD_V1"
|
|
21
23
|
}
|
|
22
24
|
export declare const formSchema: {
|
|
23
25
|
BUTTON_V1: (props: VistaButtonV1Props) => React.JSX.Element;
|
|
@@ -30,4 +32,5 @@ export declare const formSchema: {
|
|
|
30
32
|
SELECT_V1: (props: VistaSelectV1Props) => React.JSX.Element;
|
|
31
33
|
TEXT_AREA_V1: (props: VistaTextAreaV1Props) => React.JSX.Element;
|
|
32
34
|
TEXT_INPUT_V1: (props: VistaTextInputV1Props) => React.JSX.Element;
|
|
35
|
+
UPLOAD_V1: (props: VistaUploadV1Props) => React.JSX.Element;
|
|
33
36
|
};
|
package/utils/form-schema.js
CHANGED
|
@@ -27,6 +27,7 @@ var vista_checkbox_v2_1 = require("../molecules/vista-checkbox-v2/vista-checkbox
|
|
|
27
27
|
var vista_checkbox_v3_1 = require("../molecules/vista-checkbox-v3/vista-checkbox-v3");
|
|
28
28
|
var vista_radio_v1_1 = require("../molecules/vista-radio-v1/vista-radio-v1");
|
|
29
29
|
var vista_button_v1_1 = require("../molecules/vista-button-v1/vista-button-v1");
|
|
30
|
+
var vista_upload_v1_1 = require("../molecules/vista-upload-v1/vista-upload-v1");
|
|
30
31
|
var VISTA_FORM_ELEMENTS;
|
|
31
32
|
(function (VISTA_FORM_ELEMENTS) {
|
|
32
33
|
VISTA_FORM_ELEMENTS["BUTTON_V1"] = "BUTTON_V1";
|
|
@@ -39,6 +40,7 @@ var VISTA_FORM_ELEMENTS;
|
|
|
39
40
|
VISTA_FORM_ELEMENTS["SELECT_V1"] = "SELECT_V1";
|
|
40
41
|
VISTA_FORM_ELEMENTS["TEXT_AREA_V1"] = "TEXT_AREA_V1";
|
|
41
42
|
VISTA_FORM_ELEMENTS["TEXT_INPUT_V1"] = "TEXT_INPUT_V1";
|
|
43
|
+
VISTA_FORM_ELEMENTS["UPLOAD_V1"] = "UPLOAD_V1";
|
|
42
44
|
})(VISTA_FORM_ELEMENTS || (exports.VISTA_FORM_ELEMENTS = VISTA_FORM_ELEMENTS = {}));
|
|
43
45
|
exports.formSchema = (_a = {},
|
|
44
46
|
_a[VISTA_FORM_ELEMENTS.BUTTON_V1] = function (props) { return react_1.default.createElement(vista_button_v1_1.VistaButtonV1, __assign({}, props)); },
|
|
@@ -51,4 +53,5 @@ exports.formSchema = (_a = {},
|
|
|
51
53
|
_a[VISTA_FORM_ELEMENTS.SELECT_V1] = function (props) { return react_1.default.createElement(vista_select_v1_1.VistaSelectV1, __assign({}, props)); },
|
|
52
54
|
_a[VISTA_FORM_ELEMENTS.TEXT_AREA_V1] = function (props) { return react_1.default.createElement(vista_text_area_v1_1.VistaTextAreaV1, __assign({}, props)); },
|
|
53
55
|
_a[VISTA_FORM_ELEMENTS.TEXT_INPUT_V1] = function (props) { return react_1.default.createElement(vista_text_input_v1_1.VistaTextInputV1, __assign({}, props)); },
|
|
56
|
+
_a[VISTA_FORM_ELEMENTS.UPLOAD_V1] = function (props) { return react_1.default.createElement(vista_upload_v1_1.VistaUploadV1, __assign({}, props)); },
|
|
54
57
|
_a);
|