@appcorp/app-corp-vista 0.2.62 → 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.
- package/molecules/vista-radio-v1/vista-radio-v1.js +5 -5
- package/molecules/{vista-toggle-v1.d.ts → vista-toggle-v1/vista-toggle-v1.d.ts} +1 -1
- package/molecules/vista-toggle-v1/vista-toggle-v1.js +24 -0
- package/package.json +1 -1
- package/type/vista-form-elements.d.ts +9 -5
- package/type/vista-radio-type.d.ts +2 -1
- package/type/vista-toggle-type.d.ts +7 -2
- package/utils/form-schema.d.ts +3 -1
- package/utils/form-schema.js +3 -0
- package/molecules/vista-toggle-v1.js +0 -16
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.VistaRadioV1 = void 0;
|
|
7
7
|
var react_1 = __importDefault(require("react"));
|
|
8
8
|
var VistaRadioV1 = function (_a) {
|
|
9
|
-
var description = _a.description, handleOnChange = _a.handleOnChange, list = _a.list, selectedValue = _a.selectedValue, title = _a.title;
|
|
9
|
+
var description = _a.description, handleOnChange = _a.handleOnChange, id = _a.id, list = _a.list, selectedValue = _a.selectedValue, title = _a.title;
|
|
10
10
|
return (react_1.default.createElement("fieldset", null,
|
|
11
11
|
react_1.default.createElement("legend", { className: "text-sm/6 font-semibold text-gray-900 dark:text-white" }, title),
|
|
12
12
|
react_1.default.createElement("p", { className: "mt-1 text-sm/6 text-gray-600 dark:text-gray-200" }, description),
|
|
@@ -17,12 +17,12 @@ var VistaRadioV1 = function (_a) {
|
|
|
17
17
|
})
|
|
18
18
|
.sort(function (a, b) { return a.order - b.order; })
|
|
19
19
|
.map(function (_a) {
|
|
20
|
-
var
|
|
21
|
-
return (react_1.default.createElement("div", { key:
|
|
22
|
-
react_1.default.createElement("input", { checked: selectedValue === value, className: "relative size-4 appearance-none rounded-full border border-gray-300 bg-white before:absolute before:inset-1 before:rounded-full before:bg-white not-checked:before:hidden checked:border-primary checked:bg-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary disabled:border-gray-300 disabled:bg-gray-100 disabled:before:bg-gray-400 forced-colors:appearance-auto forced-colors:before:hidden", id:
|
|
20
|
+
var _id = _a.id, label = _a.label, value = _a.value;
|
|
21
|
+
return (react_1.default.createElement("div", { key: _id, className: "flex items-center" },
|
|
22
|
+
react_1.default.createElement("input", { checked: selectedValue === value, className: "relative size-4 appearance-none rounded-full border border-gray-300 bg-white before:absolute before:inset-1 before:rounded-full before:bg-white not-checked:before:hidden checked:border-primary checked:bg-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary disabled:border-gray-300 disabled:bg-gray-100 disabled:before:bg-gray-400 forced-colors:appearance-auto forced-colors:before:hidden", id: _id, name: _id, onChange: function (e) {
|
|
23
23
|
return handleOnChange(id, e.target.value);
|
|
24
24
|
}, type: "radio", value: value }),
|
|
25
|
-
react_1.default.createElement("label", { htmlFor:
|
|
25
|
+
react_1.default.createElement("label", { htmlFor: _id, className: "ml-3 block text-sm/6 font-medium text-gray-900 dark:text-white" }, label)));
|
|
26
26
|
}))));
|
|
27
27
|
};
|
|
28
28
|
exports.VistaRadioV1 = VistaRadioV1;
|
|
@@ -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,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 {
|
|
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 {
|
|
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,5 +1,7 @@
|
|
|
1
1
|
export interface VistaRadioV1Props {
|
|
2
2
|
description: string;
|
|
3
|
+
handleOnChange: (k: string, v: string) => void;
|
|
4
|
+
id: string;
|
|
3
5
|
list: {
|
|
4
6
|
id: string;
|
|
5
7
|
label: string;
|
|
@@ -9,5 +11,4 @@ export interface VistaRadioV1Props {
|
|
|
9
11
|
}[];
|
|
10
12
|
selectedValue: string;
|
|
11
13
|
title: string;
|
|
12
|
-
handleOnChange: (k: string, v: string) => void;
|
|
13
14
|
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
export interface VistaToggleV1Props {
|
|
2
|
-
|
|
3
|
-
|
|
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;
|
package/utils/form-schema.d.ts
CHANGED
|
@@ -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
|
};
|
package/utils/form-schema.js
CHANGED
|
@@ -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;
|