@appcorp/app-corp-vista 0.0.6 → 0.0.8
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-combobox-v1.d.ts +3 -0
- package/molecules/vista-combobox-v1.js +63 -0
- package/molecules/vista-select-v1.d.ts +3 -0
- package/molecules/vista-select-v1.js +28 -0
- package/molecules/vista-text-area-v1.d.ts +3 -0
- package/molecules/vista-text-area-v1.js +22 -0
- package/molecules/vista-text-input-v1.js +1 -1
- package/package.json +1 -1
- package/type/vista-combobox-type.d.ts +14 -0
- package/type/vista-combobox-type.js +2 -0
- package/type/vista-select-type.d.ts +8 -0
- package/type/vista-select-type.js +2 -0
- package/type/vista-text-area-type.d.ts +16 -0
- package/type/vista-text-area-type.js +2 -0
|
@@ -0,0 +1,63 @@
|
|
|
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.VistaComboboxV1 = void 0;
|
|
38
|
+
var react_1 = __importStar(require("react"));
|
|
39
|
+
var react_2 = require("@headlessui/react");
|
|
40
|
+
var solid_1 = require("@heroicons/react/20/solid");
|
|
41
|
+
var VistaComboboxV1 = function (_a) {
|
|
42
|
+
var handleInputOnChange = _a.handleInputOnChange, handleOnBlur = _a.handleOnBlur, handleOnChange = _a.handleOnChange, label = _a.label, listItems = _a.listItems, nodeQueryKey = _a.nodeQueryKey, nodeSelectKey = _a.nodeSelectKey, query = _a.query, selectKey1 = _a.selectKey1, error = _a.error, selectedItem = _a.selectedItem, _b = _a.required, required = _b === void 0 ? false : _b;
|
|
43
|
+
var filteredList = (0, react_1.useMemo)(function () {
|
|
44
|
+
return query === ''
|
|
45
|
+
? listItems
|
|
46
|
+
: listItems.filter(function (item) { var _a; return (_a = item[selectKey1]) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(query.toLowerCase()); });
|
|
47
|
+
}, [listItems, query]);
|
|
48
|
+
return (react_1.default.createElement(react_2.Combobox, { as: "div", value: selectedItem, onChange: function (v) { return handleOnChange(nodeSelectKey, v); } },
|
|
49
|
+
react_1.default.createElement(react_2.Label, { className: "flex items-center gap-2 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: "relative mt-2" },
|
|
54
|
+
react_1.default.createElement(react_2.ComboboxInput, { className: "w-full rounded-md border-0 bg-white/5 dark:bg-white/5 py-1.5 pl-3 pr-10 text-gray-900 dark:text-white shadow-sm ring-1 ring-inset ring-gray-500 focus:ring-2 focus:ring-inset focus:ring-primary sm:text-sm/6", onChange: function (e) { return handleInputOnChange(nodeQueryKey, e.target.value); }, onBlur: function (e) { return handleOnBlur(nodeQueryKey, e.target.value); } }),
|
|
55
|
+
react_1.default.createElement(react_2.ComboboxButton, { className: "absolute inset-y-0 right-0 flex items-center rounded-r-md px-2 focus:outline-none" },
|
|
56
|
+
react_1.default.createElement(solid_1.ChevronUpDownIcon, { className: "size-5 text-white", "aria-hidden": "true" })),
|
|
57
|
+
(filteredList === null || filteredList === void 0 ? void 0 : filteredList.length) > 0 && (react_1.default.createElement(react_2.ComboboxOptions, { className: "absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-md bg-gray-200 dark:bg-gray-700 py-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-none sm:text-sm" }, filteredList.map(function (item) { return (react_1.default.createElement(react_2.ComboboxOption, { className: "group relative cursor-default select-none py-2 pl-3 pr-9 text-gray-900 dark:text-white data-[focus]:bg-indigo-600 data-[focus]:text-white data-[focus]:outline-none", key: item[selectKey1] || item, value: item[selectKey1] || item },
|
|
58
|
+
react_1.default.createElement("span", { className: "block truncate group-data-[selected]:font-semibold" }, item[selectKey1] || item),
|
|
59
|
+
react_1.default.createElement("span", { className: "absolute inset-y-0 right-0 hidden items-center pr-4 text-indigo-600 group-data-[selected]:flex group-data-[focus]:text-white" },
|
|
60
|
+
react_1.default.createElement(solid_1.CheckIcon, { className: "size-5", "aria-hidden": "true" })))); })))),
|
|
61
|
+
error && (react_1.default.createElement("p", { id: "".concat(nodeQueryKey, "-error"), className: "mt-2 text-sm text-red-500" }, error))));
|
|
62
|
+
};
|
|
63
|
+
exports.VistaComboboxV1 = VistaComboboxV1;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.VistaSelectV1 = void 0;
|
|
8
|
+
var react_1 = __importDefault(require("react"));
|
|
9
|
+
var react_2 = require("@headlessui/react");
|
|
10
|
+
var solid_1 = require("@heroicons/react/20/solid");
|
|
11
|
+
var VistaSelectV1 = function (_a) {
|
|
12
|
+
var handleOnSelect = _a.handleOnSelect, label = _a.label, listItems = _a.listItems, selectKey1 = _a.selectKey1, selectKey2 = _a.selectKey2, selected = _a.selected;
|
|
13
|
+
return (react_1.default.createElement(react_2.Listbox, { value: selected, onChange: handleOnSelect },
|
|
14
|
+
label && (react_1.default.createElement(react_2.Label, { className: "block text-sm/6 font-medium text-gray-900 dark:text-white" }, label)),
|
|
15
|
+
react_1.default.createElement("div", { className: "relative ".concat(label ? 'mt-2' : '') },
|
|
16
|
+
react_1.default.createElement(react_2.ListboxButton, { className: "relative w-full cursor-default rounded-md bg-white/5 dark:bg-white/5 py-1.5 pl-3 pr-10 text-left text-gray-900 dark:text-white shadow-sm ring-1 ring-inset ring-gray-500 focus:ring-2 focus:ring-inset focus:ring-primary sm:text-sm/6" },
|
|
17
|
+
react_1.default.createElement("span", { className: "block truncate" }, selected[selectKey1]),
|
|
18
|
+
react_1.default.createElement("span", { className: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2" },
|
|
19
|
+
react_1.default.createElement(solid_1.ChevronUpDownIcon, { "aria-hidden": "true", className: "size-5 text-gray-900 dark:text-white" }))),
|
|
20
|
+
react_1.default.createElement(react_2.ListboxOptions, { className: "absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-md bg-gray-200 dark:bg-gray-700 py-1 text-base shadow-lg ring-1 ring-black/5 focus:outline-none data-[closed]:data-[leave]:opacity-0 data-[leave]:transition data-[leave]:duration-100 data-[leave]:ease-in sm:text-sm", transition: true }, listItems.map(function (item) { return (react_1.default.createElement(react_2.ListboxOption, { className: "group relative cursor-default select-none py-2 pl-3 pr-9 text-gray-900 dark:text-white data-[focus]:bg-indigo-600 data-[focus]:text-white", key: item[selectKey1], value: item[selectKey1] },
|
|
21
|
+
react_1.default.createElement("span", { className: "block truncate font-normal group-data-[selected]:font-semibold" },
|
|
22
|
+
item[selectKey1],
|
|
23
|
+
" ",
|
|
24
|
+
item[selectKey2]),
|
|
25
|
+
react_1.default.createElement("span", { className: "absolute inset-y-0 right-0 flex items-center pr-4 text-indigo-600 group-data-[focus]:text-white [.group:not([data-selected])_&]:hidden" },
|
|
26
|
+
react_1.default.createElement(solid_1.CheckIcon, { "aria-hidden": "true", className: "size-5" })))); })))));
|
|
27
|
+
};
|
|
28
|
+
exports.VistaSelectV1 = VistaSelectV1;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.VistaTextAreaV1 = void 0;
|
|
8
|
+
var react_1 = __importDefault(require("react"));
|
|
9
|
+
var VistaTextAreaV1 = function (_a) {
|
|
10
|
+
var _b = _a.autoFocus, autoFocus = _b === void 0 ? false : _b, _c = _a.className, className = _c === void 0 ? '' : _c, _d = _a.disabled, disabled = _d === void 0 ? false : _d, error = _a.error, handleOnChange = _a.handleOnChange, id = _a.id, info = _a.info, label = _a.label, optional = _a.optional, placeholder = _a.placeholder, _e = _a.readOnly, readOnly = _e === void 0 ? false : _e, _f = _a.required, required = _f === void 0 ? false : _f, _g = _a.rows, rows = _g === void 0 ? 4 : _g, value = _a.value;
|
|
11
|
+
return (react_1.default.createElement("div", null,
|
|
12
|
+
react_1.default.createElement("div", { className: "flex justify-between" },
|
|
13
|
+
react_1.default.createElement("label", { htmlFor: id, className: "block text-sm/6 font-medium text-gray-900 dark:text-white" }, label),
|
|
14
|
+
optional && (react_1.default.createElement("span", { id: "".concat(id, "-optional"), className: "text-sm/6 text-gray-500" }, optional))),
|
|
15
|
+
react_1.default.createElement("div", { className: "mt-2" },
|
|
16
|
+
react_1.default.createElement("textarea", { autoFocus: autoFocus, 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-500 focus:ring-2 focus:ring-inset focus:ring-primary disabled:cursor-not-allowed disabled:bg-gray-50 disabled:text-gray-500 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(className), cols: 200, disabled: disabled, id: id, name: id, onChange: function (e) {
|
|
17
|
+
return handleOnChange(id, e.target.value);
|
|
18
|
+
}, placeholder: placeholder, readOnly: readOnly, required: required, rows: rows, value: value })),
|
|
19
|
+
info && !error && (react_1.default.createElement("p", { id: "".concat(id, "-info"), className: "mt-2 text-sm text-indigo-500" }, info)),
|
|
20
|
+
error && !info && (react_1.default.createElement("p", { id: "".concat(id, "-error"), className: "mt-2 text-sm text-red-500" }, error))));
|
|
21
|
+
};
|
|
22
|
+
exports.VistaTextAreaV1 = VistaTextAreaV1;
|
|
@@ -17,7 +17,7 @@ var VistaTextInputV1 = function (_a) {
|
|
|
17
17
|
react_1.default.createElement("div", { className: "relative mt-2" },
|
|
18
18
|
prefix && (react_1.default.createElement("div", { className: "pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3" },
|
|
19
19
|
react_1.default.createElement("span", { className: "text-gray-500 sm:text-sm" }, prefix))),
|
|
20
|
-
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-
|
|
20
|
+
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-500 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), id: id, disabled: disabled, name: id, onChange: function (e) {
|
|
21
21
|
return handleOnChange(id, e.target.value);
|
|
22
22
|
}, placeholder: placeholder, readOnly: readOnly, type: type, value: value, autoFocus: autoFocus }),
|
|
23
23
|
suffix && (react_1.default.createElement("div", { className: "pointer-events-none absolute inset-y-0 right-0 flex items-center pr-3" },
|
package/package.json
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface VistaComboboxV1Props {
|
|
2
|
+
error?: string;
|
|
3
|
+
handleInputOnChange: (k: string, v: string) => void;
|
|
4
|
+
handleOnBlur: (k: string, v: string) => void;
|
|
5
|
+
handleOnChange: (k: string, v: string) => void;
|
|
6
|
+
label: string;
|
|
7
|
+
listItems: any[];
|
|
8
|
+
nodeQueryKey: string;
|
|
9
|
+
nodeSelectKey: string;
|
|
10
|
+
query: string;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
selectKey1: string;
|
|
13
|
+
selectedItem: any;
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface VistaTextAreaV1Props {
|
|
2
|
+
autoFocus?: boolean;
|
|
3
|
+
className?: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
error?: string;
|
|
6
|
+
handleOnChange: (k: string, v: string) => void;
|
|
7
|
+
id: string;
|
|
8
|
+
info?: string;
|
|
9
|
+
label: string;
|
|
10
|
+
optional?: string;
|
|
11
|
+
placeholder: string;
|
|
12
|
+
readOnly?: boolean;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
rows?: number;
|
|
15
|
+
value: string;
|
|
16
|
+
}
|