@appcorp/app-corp-vista 0.1.4 → 0.1.6

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.
@@ -39,13 +39,13 @@ var react_1 = __importStar(require("react"));
39
39
  var react_2 = require("@headlessui/react");
40
40
  var solid_1 = require("@heroicons/react/20/solid");
41
41
  var VistaComboboxV1 = function (_a) {
42
- var checkClassName = _a.checkClassName, comboboxButtonClassName = _a.comboboxButtonClassName, comboboxClassName = _a.comboboxClassName, comboboxInputClassName = _a.comboboxInputClassName, comboboxOptionClassName = _a.comboboxOptionClassName, comboboxOptionsClassName = _a.comboboxOptionsClassName, error = _a.error, handleInputOnChange = _a.handleInputOnChange, handleOnBlur = _a.handleOnBlur, handleOnChange = _a.handleOnChange, inputIconClassName = _a.inputIconClassName, label = _a.label, labelClassName = _a.labelClassName, listItems = _a.listItems, nodeQueryKey = _a.nodeQueryKey, nodeSelectKey = _a.nodeSelectKey, placeholder = _a.placeholder, query = _a.query, _b = _a.required, required = _b === void 0 ? false : _b, selectKey1 = _a.selectKey1, selectedItem = _a.selectedItem;
42
+ var checkClassName = _a.checkClassName, comboboxButtonClassName = _a.comboboxButtonClassName, comboboxClassName = _a.comboboxClassName, comboboxInputClassName = _a.comboboxInputClassName, comboboxOptionClassName = _a.comboboxOptionClassName, comboboxOptionsClassName = _a.comboboxOptionsClassName, _b = _a.disabled, disabled = _b === void 0 ? false : _b, error = _a.error, handleInputOnChange = _a.handleInputOnChange, handleOnBlur = _a.handleOnBlur, handleOnChange = _a.handleOnChange, inputIconClassName = _a.inputIconClassName, label = _a.label, labelClassName = _a.labelClassName, listItems = _a.listItems, nodeQueryKey = _a.nodeQueryKey, nodeSelectKey = _a.nodeSelectKey, placeholder = _a.placeholder, query = _a.query, _c = _a.required, required = _c === void 0 ? false : _c, selectKey1 = _a.selectKey1, selectedItem = _a.selectedItem;
43
43
  var filteredList = (0, react_1.useMemo)(function () {
44
44
  return query === ''
45
45
  ? listItems
46
46
  : listItems.filter(function (item) { var _a; return (_a = item[selectKey1]) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(query.toLowerCase()); });
47
47
  }, [listItems, query, selectKey1]);
48
- return (react_1.default.createElement(react_2.Combobox, { as: "div", className: "".concat(comboboxClassName), onChange: function (v) { return handleOnChange(nodeSelectKey, v); }, value: selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem[selectKey1] },
48
+ return (react_1.default.createElement(react_2.Combobox, { as: "div", className: "".concat(comboboxClassName), onChange: function (v) { return handleOnChange(nodeSelectKey, v); }, value: selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem[selectKey1], disabled: disabled },
49
49
  react_1.default.createElement(react_2.Label, { className: "block text-sm/6 font-medium text-gray-900 dark:text-white ".concat(labelClassName) },
50
50
  label,
51
51
  " ",
@@ -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), id: id, disabled: disabled, name: id, onChange: function (e) {
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, autoFocus: autoFocus }),
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,3 @@
1
+ import { FC } from 'react';
2
+ import { VistaUploadV1Props } from '../../type/vista-upload-type';
3
+ export declare const VistaUploadV1: FC<VistaUploadV1Props>;
@@ -0,0 +1,66 @@
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
+ handleOnChange(e);
47
+ (_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.click();
48
+ };
49
+ return (react_1.default.createElement("div", { className: className },
50
+ react_1.default.createElement("label", { htmlFor: id, className: "block text-sm/6 font-medium text-gray-900 dark:text-white" },
51
+ label,
52
+ " ",
53
+ required && react_1.default.createElement("sup", { className: "text-red-500" }, "*")),
54
+ 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 },
55
+ react_1.default.createElement("div", { className: "text-center" },
56
+ react_1.default.createElement(outline_1.PhotoIcon, { "aria-hidden": "true", className: "mx-auto size-16 text-gray-500" }),
57
+ react_1.default.createElement("div", { className: "mt-4 flex justify-center text-sm/6 text-gray-500" },
58
+ 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
+ react_1.default.createElement("span", null, "Upload a file"),
60
+ react_1.default.createElement("input", { className: "sr-only", disabled: disabled, id: id, name: id, ref: inputRef, required: required, type: type })),
61
+ react_1.default.createElement("p", { className: "pl-1" }, "or drag and drop")),
62
+ fileInfo && (react_1.default.createElement("p", { className: "text-xs/5 text-gray-500" }, fileInfo)))),
63
+ info && !error && (react_1.default.createElement("p", { id: "".concat(id, "-info"), className: "mt-2 text-sm text-primary" }, info)),
64
+ error && !info && (react_1.default.createElement("p", { id: "".concat(id, "-error"), className: "mt-2 text-sm text-red-500 dark:text-red-500" }, error))));
65
+ };
66
+ exports.VistaUploadV1 = VistaUploadV1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/app-corp-vista",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "scripts": {
5
5
  "build": "yarn clean && yarn build:ts && cp package.json lib && cp README.md lib",
6
6
  "build:next": "next build",
@@ -5,6 +5,7 @@ export interface VistaComboboxV1Props {
5
5
  comboboxInputClassName?: string;
6
6
  comboboxOptionClassName?: string;
7
7
  comboboxOptionsClassName?: string;
8
+ disabled?: boolean;
8
9
  error?: string;
9
10
  handleInputOnChange: (k: string, v: string) => void;
10
11
  handleOnBlur: (k: string, v: string) => void;
@@ -0,0 +1,13 @@
1
+ import { FormEvent, HTMLInputTypeAttribute } from "react";
2
+ export interface VistaUploadV1Props {
3
+ className?: string;
4
+ disabled?: boolean;
5
+ error?: string;
6
+ fileInfo?: string;
7
+ handleOnChange: (e: FormEvent<HTMLInputElement>) => void;
8
+ id: string;
9
+ info?: string;
10
+ label?: string;
11
+ required?: boolean;
12
+ type?: HTMLInputTypeAttribute;
13
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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
  };
@@ -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);