@appcorp/app-corp-vista 0.2.63 → 0.2.65

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.
@@ -1,3 +1,3 @@
1
1
  import { FC } from 'react';
2
- import { VistaToggleV1Props } from '../type/vista-toggle-type';
2
+ import { VistaToggleV1Props } from '../../type/vista-toggle-type';
3
3
  export declare const VistaToggleV1: FC<VistaToggleV1Props>;
@@ -0,0 +1,24 @@
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.VistaToggleV1 = void 0;
8
+ var react_1 = __importDefault(require("react"));
9
+ var react_2 = require("@headlessui/react");
10
+ var VistaToggleV1 = function (_a) {
11
+ var error = _a.error, handleOnChange = _a.handleOnChange, id = _a.id, info = _a.info, label = _a.label, required = _a.required, value = _a.value;
12
+ return (react_1.default.createElement("div", null,
13
+ react_1.default.createElement("div", { className: "flex justify-between" }, label && (react_1.default.createElement("div", { className: "mb-2" },
14
+ react_1.default.createElement("label", { htmlFor: id, className: "block text-sm/6 font-medium text-gray-900 dark:text-white" },
15
+ label,
16
+ " ",
17
+ required && react_1.default.createElement("sup", { className: "text-red-500" }, "*"))))),
18
+ react_1.default.createElement(react_2.Switch, { checked: value, className: "group relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent bg-gray-400 transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 data-[checked]:bg-primary", onChange: function (b) { return handleOnChange(id, b); } },
19
+ react_1.default.createElement("span", { className: "sr-only" }, "Use setting"),
20
+ react_1.default.createElement("span", { "aria-hidden": "true", className: "pointer-events-none inline-block size-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out group-data-[checked]:translate-x-5" })),
21
+ info && !error && (react_1.default.createElement("p", { id: "".concat(id, "-info"), className: "mt-2 text-sm text-blue-500" }, info)),
22
+ error && !info && (react_1.default.createElement("p", { id: "".concat(id, "-error"), className: "mt-2 text-sm text-red-500 dark:text-red-500" }, error))));
23
+ };
24
+ exports.VistaToggleV1 = VistaToggleV1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/app-corp-vista",
3
- "version": "0.2.63",
3
+ "version": "0.2.65",
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",
@@ -1,13 +1,14 @@
1
1
  import { VISTA_FORM_ELEMENTS } from "../utils/form-schema";
2
- import { VistaTextInputV1Props } from "./vista-text-input-type";
3
- import { VistaTextAreaV1Props } from "./vista-text-area-type";
4
2
  import { VistaButtonV1Props } from "./vista-button-type";
5
- import { VistaRadioV1Props } from "./vista-radio-type";
6
3
  import { VistaCheckboxV1Props } from "./vista-checkbox-type";
7
- import { VistaVerticalDividerV4Props } from "./vista-vertical-divider-type";
4
+ import { VistaComboboxV1Props } from "./vista-combobox-type";
5
+ import { VistaRadioV1Props } from "./vista-radio-type";
8
6
  import { VistaSelectV1Props } from "./vista-select-type";
7
+ import { VistaTextAreaV1Props } from "./vista-text-area-type";
8
+ import { VistaTextInputV1Props } from "./vista-text-input-type";
9
+ import { VistaToggleV1Props } from "./vista-toggle-type";
9
10
  import { VistaUploadV1Props } from "./vista-upload-type";
10
- import { VistaComboboxV1Props } from "./vista-combobox-type";
11
+ import { VistaVerticalDividerV4Props } from "./vista-vertical-divider-type";
11
12
  interface Base {
12
13
  enabled: boolean;
13
14
  order: number;
@@ -28,6 +29,8 @@ export interface TextAreaV1 extends VistaTextAreaV1Props, Base {
28
29
  }
29
30
  export interface TextInputV1 extends VistaTextInputV1Props, Base {
30
31
  }
32
+ export interface ToggleV1 extends VistaToggleV1Props, Base {
33
+ }
31
34
  export interface UploadV1 extends VistaUploadV1Props, Base {
32
35
  }
33
36
  export interface VistaFormElements {
@@ -39,6 +42,7 @@ export interface VistaFormElements {
39
42
  [VISTA_FORM_ELEMENTS.SELECT_V1]?: SelectV1[];
40
43
  [VISTA_FORM_ELEMENTS.TEXT_AREA_V1]?: TextAreaV1[];
41
44
  [VISTA_FORM_ELEMENTS.TEXT_INPUT_V1]?: TextInputV1[];
45
+ [VISTA_FORM_ELEMENTS.TOGGLE_V1]?: ToggleV1[];
42
46
  [VISTA_FORM_ELEMENTS.UPLOAD_V1]?: UploadV1[];
43
47
  }
44
48
  export {};
@@ -1,6 +1,11 @@
1
1
  export interface VistaToggleV1Props {
2
- enabled: boolean;
3
- setEnabled: () => void;
2
+ error?: string;
3
+ handleOnChange: (k: string, v: boolean) => void;
4
+ id: string;
5
+ info?: string;
6
+ label: string;
7
+ required: boolean;
8
+ value: boolean;
4
9
  }
5
10
  export interface VistaToggleV2Props {
6
11
  enabled: boolean;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { VistaComboboxV1Props } from "../type/vista-combobox-type";
3
3
  import { VistaCheckboxV2Props, VistaCheckboxV3Props } from "../type/vista-checkbox-type";
4
- import { ButtonV1, CheckboxV1, DividerV4, RadioV1, SelectV1, TextAreaV1, TextInputV1, UploadV1 } from "../type/vista-form-elements";
4
+ import { ButtonV1, CheckboxV1, DividerV4, RadioV1, SelectV1, TextAreaV1, TextInputV1, ToggleV1, UploadV1 } from "../type/vista-form-elements";
5
5
  export declare enum VISTA_FORM_ELEMENTS {
6
6
  AUDIO_V1 = "AUDIO_V1",
7
7
  BUTTON_V1 = "BUTTON_V1",
@@ -14,6 +14,7 @@ export declare enum VISTA_FORM_ELEMENTS {
14
14
  SELECT_V1 = "SELECT_V1",
15
15
  TEXT_AREA_V1 = "TEXT_AREA_V1",
16
16
  TEXT_INPUT_V1 = "TEXT_INPUT_V1",
17
+ TOGGLE_V1 = "TOGGLE_V1",
17
18
  UPLOAD_V1 = "UPLOAD_V1"
18
19
  }
19
20
  export declare const vistaFormSchema: {
@@ -28,5 +29,6 @@ export declare const vistaFormSchema: {
28
29
  SELECT_V1: (props: SelectV1) => React.JSX.Element;
29
30
  TEXT_AREA_V1: (props: TextAreaV1) => React.JSX.Element;
30
31
  TEXT_INPUT_V1: (props: TextInputV1) => React.JSX.Element;
32
+ TOGGLE_V1: (props: ToggleV1) => React.JSX.Element;
31
33
  UPLOAD_V1: (props: UploadV1) => React.JSX.Element;
32
34
  };
@@ -28,6 +28,7 @@ var vista_checkbox_v3_1 = require("../molecules/vista-checkbox-v3/vista-checkbox
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
30
  var vista_upload_v1_1 = require("../molecules/vista-upload-v1/vista-upload-v1");
31
+ var vista_toggle_v1_1 = require("../molecules/vista-toggle-v1/vista-toggle-v1");
31
32
  var VISTA_FORM_ELEMENTS;
32
33
  (function (VISTA_FORM_ELEMENTS) {
33
34
  VISTA_FORM_ELEMENTS["AUDIO_V1"] = "AUDIO_V1";
@@ -41,6 +42,7 @@ var VISTA_FORM_ELEMENTS;
41
42
  VISTA_FORM_ELEMENTS["SELECT_V1"] = "SELECT_V1";
42
43
  VISTA_FORM_ELEMENTS["TEXT_AREA_V1"] = "TEXT_AREA_V1";
43
44
  VISTA_FORM_ELEMENTS["TEXT_INPUT_V1"] = "TEXT_INPUT_V1";
45
+ VISTA_FORM_ELEMENTS["TOGGLE_V1"] = "TOGGLE_V1";
44
46
  VISTA_FORM_ELEMENTS["UPLOAD_V1"] = "UPLOAD_V1";
45
47
  })(VISTA_FORM_ELEMENTS || (exports.VISTA_FORM_ELEMENTS = VISTA_FORM_ELEMENTS = {}));
46
48
  exports.vistaFormSchema = (_a = {},
@@ -55,5 +57,6 @@ exports.vistaFormSchema = (_a = {},
55
57
  _a[VISTA_FORM_ELEMENTS.SELECT_V1] = function (props) { return react_1.default.createElement(vista_select_v1_1.VistaSelectV1, __assign({}, props)); },
56
58
  _a[VISTA_FORM_ELEMENTS.TEXT_AREA_V1] = function (props) { return react_1.default.createElement(vista_text_area_v1_1.VistaTextAreaV1, __assign({}, props)); },
57
59
  _a[VISTA_FORM_ELEMENTS.TEXT_INPUT_V1] = function (props) { return react_1.default.createElement(vista_text_input_v1_1.VistaTextInputV1, __assign({}, props)); },
60
+ _a[VISTA_FORM_ELEMENTS.TOGGLE_V1] = function (props) { return react_1.default.createElement(vista_toggle_v1_1.VistaToggleV1, __assign({}, props)); },
58
61
  _a[VISTA_FORM_ELEMENTS.UPLOAD_V1] = function (props) { return react_1.default.createElement(vista_upload_v1_1.VistaUploadV1, __assign({}, props)); },
59
62
  _a);
@@ -1,16 +0,0 @@
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.VistaToggleV1 = void 0;
8
- var react_1 = __importDefault(require("react"));
9
- var react_2 = require("@headlessui/react");
10
- var VistaToggleV1 = function (_a) {
11
- var enabled = _a.enabled, setEnabled = _a.setEnabled;
12
- return (react_1.default.createElement(react_2.Switch, { checked: enabled, onChange: setEnabled, className: "group relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent bg-gray-200 transition-colors duration-200 ease-in-out focus:outline-none focus:ring-2 focus:ring-indigo-600 focus:ring-offset-2 data-[checked]:bg-indigo-600" },
13
- react_1.default.createElement("span", { className: "sr-only" }, "Use setting"),
14
- react_1.default.createElement("span", { "aria-hidden": "true", className: "pointer-events-none inline-block size-5 transform rounded-full bg-white shadow ring-0 transition duration-200 ease-in-out group-data-[checked]:translate-x-5" })));
15
- };
16
- exports.VistaToggleV1 = VistaToggleV1;