@zauru-sdk/components 1.0.51 → 1.0.52
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/CHANGELOG.md +8 -0
- package/package.json +10 -17
- package/tsconfig.cjs.json +8 -0
- package/tsconfig.esm.json +11 -0
- package/tsconfig.json +6 -15
- package/dist/Alerts/ErrorBoundaryAlert/ErrorBoundaryAlert.d.ts +0 -6
- package/dist/Alerts/ErrorBoundaryAlert/ErrorBoundaryAlert.js +0 -5
- package/dist/Alerts/StaticAlert.d.ts +0 -11
- package/dist/Alerts/StaticAlert.js +0 -28
- package/dist/Alerts/index.d.ts +0 -2
- package/dist/Alerts/index.js +0 -2
- package/dist/BlockUI/BlockUI.d.ts +0 -8
- package/dist/BlockUI/BlockUI.js +0 -8
- package/dist/BlockUI/index.d.ts +0 -1
- package/dist/BlockUI/index.js +0 -1
- package/dist/Buttons/Button.d.ts +0 -15
- package/dist/Buttons/Button.js +0 -43
- package/dist/Buttons/index.d.ts +0 -1
- package/dist/Buttons/index.js +0 -1
- package/dist/Card/Card.d.ts +0 -8
- package/dist/Card/Card.js +0 -5
- package/dist/Card/index.d.ts +0 -1
- package/dist/Card/index.js +0 -1
- package/dist/Chat/ChatLayout.d.ts +0 -17
- package/dist/Chat/ChatLayout.js +0 -27
- package/dist/Chat/ChatMessageHistory.d.ts +0 -12
- package/dist/Chat/ChatMessageHistory.js +0 -53
- package/dist/Chat/index.d.ts +0 -2
- package/dist/Chat/index.js +0 -2
- package/dist/ConnectionState/ConnectionState.d.ts +0 -1
- package/dist/ConnectionState/ConnectionState.js +0 -21
- package/dist/ConnectionState/index.d.ts +0 -1
- package/dist/ConnectionState/index.js +0 -1
- package/dist/Containers/BodyContainer.d.ts +0 -6
- package/dist/Containers/BodyContainer.js +0 -5
- package/dist/Containers/ButtonSectionContainer.d.ts +0 -8
- package/dist/Containers/ButtonSectionContainer.js +0 -5
- package/dist/Containers/Container.d.ts +0 -10
- package/dist/Containers/Container.js +0 -6
- package/dist/Containers/DoubleContainer.d.ts +0 -9
- package/dist/Containers/DoubleContainer.js +0 -14
- package/dist/Containers/MainContainer.d.ts +0 -6
- package/dist/Containers/MainContainer.js +0 -5
- package/dist/Containers/OutletContainer.d.ts +0 -6
- package/dist/Containers/OutletContainer.js +0 -5
- package/dist/Containers/SubContainer.d.ts +0 -10
- package/dist/Containers/SubContainer.js +0 -6
- package/dist/Containers/index.d.ts +0 -7
- package/dist/Containers/index.js +0 -7
- package/dist/DynamicTable/BasicPrintDynamicTable.d.ts +0 -10
- package/dist/DynamicTable/BasicPrintDynamicTable.js +0 -27
- package/dist/DynamicTable/DynamicPrintTable.d.ts +0 -23
- package/dist/DynamicTable/DynamicPrintTable.js +0 -131
- package/dist/DynamicTable/DynamicTable.d.ts +0 -24
- package/dist/DynamicTable/DynamicTable.js +0 -192
- package/dist/DynamicTable/GenericDynamicTable.d.ts +0 -21
- package/dist/DynamicTable/GenericDynamicTable.js +0 -196
- package/dist/DynamicTable/index.d.ts +0 -4
- package/dist/DynamicTable/index.js +0 -4
- package/dist/Footer/Footer.d.ts +0 -7
- package/dist/Footer/Footer.js +0 -16
- package/dist/Footer/index.d.ts +0 -1
- package/dist/Footer/index.js +0 -1
- package/dist/Form/Checkbox/index.d.ts +0 -17
- package/dist/Form/Checkbox/index.js +0 -34
- package/dist/Form/Checklist/index.d.ts +0 -14
- package/dist/Form/Checklist/index.js +0 -10
- package/dist/Form/DatePicker/index.d.ts +0 -18
- package/dist/Form/DatePicker/index.js +0 -31
- package/dist/Form/DynamicBaculoForm/index.d.ts +0 -18
- package/dist/Form/DynamicBaculoForm/index.js +0 -140
- package/dist/Form/FieldContainer/DoubleFieldContainer.d.ts +0 -8
- package/dist/Form/FieldContainer/DoubleFieldContainer.js +0 -14
- package/dist/Form/FieldContainer/QuadrupleFieldContainer.d.ts +0 -7
- package/dist/Form/FieldContainer/QuadrupleFieldContainer.js +0 -14
- package/dist/Form/FieldContainer/TripleFieldContainer.d.ts +0 -7
- package/dist/Form/FieldContainer/TripleFieldContainer.js +0 -14
- package/dist/Form/FieldContainer/index.d.ts +0 -3
- package/dist/Form/FieldContainer/index.js +0 -3
- package/dist/Form/FileUpload/index.d.ts +0 -21
- package/dist/Form/FileUpload/index.js +0 -54
- package/dist/Form/FormButtons/index.d.ts +0 -16
- package/dist/Form/FormButtons/index.js +0 -5
- package/dist/Form/FormLayout/index.d.ts +0 -11
- package/dist/Form/FormLayout/index.js +0 -7
- package/dist/Form/SelectField/index.d.ts +0 -27
- package/dist/Form/SelectField/index.js +0 -74
- package/dist/Form/TextArea/index.d.ts +0 -23
- package/dist/Form/TextArea/index.js +0 -36
- package/dist/Form/TextField/index.d.ts +0 -25
- package/dist/Form/TextField/index.js +0 -70
- package/dist/Form/TimePicker/index.d.ts +0 -16
- package/dist/Form/TimePicker/index.js +0 -31
- package/dist/Form/YesNo/index.d.ts +0 -12
- package/dist/Form/YesNo/index.js +0 -18
- package/dist/Form/index.d.ts +0 -13
- package/dist/Form/index.js +0 -13
- package/dist/Labels/InfoLabel/index.d.ts +0 -7
- package/dist/Labels/InfoLabel/index.js +0 -5
- package/dist/Labels/index.d.ts +0 -1
- package/dist/Labels/index.js +0 -1
- package/dist/Layouts/homeLayout/index.d.ts +0 -6
- package/dist/Layouts/homeLayout/index.js +0 -10
- package/dist/Layouts/index.d.ts +0 -1
- package/dist/Layouts/index.js +0 -1
- package/dist/LineSeparator/LineSeparator.d.ts +0 -1
- package/dist/LineSeparator/LineSeparator.js +0 -4
- package/dist/LineSeparator/index.d.ts +0 -1
- package/dist/LineSeparator/index.js +0 -1
- package/dist/Modal/Modal.d.ts +0 -10
- package/dist/Modal/Modal.js +0 -32
- package/dist/Modal/index.d.ts +0 -1
- package/dist/Modal/index.js +0 -1
- package/dist/NavBar/NavBar.d.ts +0 -2
- package/dist/NavBar/NavBar.js +0 -32
- package/dist/NavBar/NavBar.types.d.ts +0 -50
- package/dist/NavBar/NavBar.types.js +0 -1
- package/dist/NavBar/NavBar.utils.d.ts +0 -58
- package/dist/NavBar/NavBar.utils.js +0 -58
- package/dist/NavBar/index.d.ts +0 -3
- package/dist/NavBar/index.js +0 -3
- package/dist/ProgressBar/ProgressBar.d.ts +0 -6
- package/dist/ProgressBar/ProgressBar.js +0 -5
- package/dist/ProgressBar/ProgressCircle.d.ts +0 -6
- package/dist/ProgressBar/ProgressCircle.js +0 -22
- package/dist/ProgressBar/index.d.ts +0 -2
- package/dist/ProgressBar/index.js +0 -2
- package/dist/Skeletons/LoadingInputSkeleton.d.ts +0 -1
- package/dist/Skeletons/LoadingInputSkeleton.js +0 -8
- package/dist/Skeletons/index.d.ts +0 -1
- package/dist/Skeletons/index.js +0 -1
- package/dist/Tab/Tab.d.ts +0 -9
- package/dist/Tab/Tab.js +0 -19
- package/dist/Tab/index.d.ts +0 -1
- package/dist/Tab/index.js +0 -1
- package/dist/Table/ZauruTable.d.ts +0 -25
- package/dist/Table/ZauruTable.js +0 -148
- package/dist/Table/index.d.ts +0 -1
- package/dist/Table/index.js +0 -1
- package/dist/TaskList/TaskList.d.ts +0 -14
- package/dist/TaskList/TaskList.js +0 -35
- package/dist/TaskList/index.d.ts +0 -1
- package/dist/TaskList/index.js +0 -1
- package/dist/Titles/LabelArray.d.ts +0 -4
- package/dist/Titles/LabelArray.js +0 -7
- package/dist/Titles/TableColumnTitle.d.ts +0 -4
- package/dist/Titles/TableColumnTitle.js +0 -5
- package/dist/Titles/TitleH1.d.ts +0 -1
- package/dist/Titles/TitleH1.js +0 -5
- package/dist/Titles/TitleH2.d.ts +0 -1
- package/dist/Titles/TitleH2.js +0 -5
- package/dist/Titles/TitleH3.d.ts +0 -1
- package/dist/Titles/TitleH3.js +0 -5
- package/dist/Titles/index.d.ts +0 -5
- package/dist/Titles/index.js +0 -5
- package/dist/Tooltip/Tooltip.d.ts +0 -7
- package/dist/Tooltip/Tooltip.js +0 -14
- package/dist/Tooltip/index.d.ts +0 -1
- package/dist/Tooltip/index.js +0 -1
- package/dist/WithTooltip/WithTooltip.d.ts +0 -7
- package/dist/WithTooltip/WithTooltip.js +0 -5
- package/dist/WithTooltip/index.d.ts +0 -1
- package/dist/WithTooltip/index.js +0 -1
- package/dist/Wizards/StepWizard.d.ts +0 -14
- package/dist/Wizards/StepWizard.js +0 -14
- package/dist/Wizards/index.d.ts +0 -1
- package/dist/Wizards/index.js +0 -1
- package/dist/Zendesk/Chat.d.ts +0 -14
- package/dist/Zendesk/Chat.js +0 -63
- package/dist/Zendesk/index.d.ts +0 -2
- package/dist/Zendesk/index.js +0 -2
- package/dist/Zendesk/zendesk.config.d.ts +0 -9
- package/dist/Zendesk/zendesk.config.js +0 -24
- package/dist/index.d.ts +0 -24
- package/dist/index.js +0 -24
- package/dist/tailwind.config.d.ts +0 -1
- package/dist/tailwind.config.js +0 -8
package/dist/Footer/Footer.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
type FooterProps = {
|
|
2
|
-
href: string;
|
|
3
|
-
showConnection?: boolean;
|
|
4
|
-
selectedColor: "purple" | "pink" | "indigo" | "cyan" | "slate" | "green" | "red" | "sky";
|
|
5
|
-
};
|
|
6
|
-
export declare const Footer: ({ href, selectedColor, showConnection, }: FooterProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export {};
|
package/dist/Footer/Footer.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ConnectionState } from "./../ConnectionState/index.js";
|
|
3
|
-
const COLORS = {
|
|
4
|
-
purple: "bg-purple-500",
|
|
5
|
-
pink: "bg-pink-500",
|
|
6
|
-
indigo: "bg-indigo-500",
|
|
7
|
-
cyan: "bg-cyan-500",
|
|
8
|
-
slate: "bg-slate-500",
|
|
9
|
-
green: "bg-green-500",
|
|
10
|
-
red: "bg-red-500",
|
|
11
|
-
sky: "bg-sky-500",
|
|
12
|
-
};
|
|
13
|
-
export const Footer = ({ href, selectedColor, showConnection = false, }) => {
|
|
14
|
-
const color = COLORS[selectedColor];
|
|
15
|
-
return (_jsx("footer", { className: `inset-x-0 bottom-0 px-2 py-[20px] ${color}`, children: _jsxs("div", { className: "px-4 mx-auto flex flex-wrap items-center justify-center", children: [_jsxs("p", { className: "text-white text-[1.2rem]", children: [`Creado en `, " ", _jsx("a", { href: href, children: "Zauru" }), " ", `con ❤️ ${new Date().getFullYear()} v.3.2`] }), showConnection && (_jsx("div", { className: "ml-5", children: _jsx(ConnectionState, {}) }))] }) }));
|
|
16
|
-
};
|
package/dist/Footer/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Footer.js";
|
package/dist/Footer/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Footer.js";
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
type Props = {
|
|
3
|
-
id?: string;
|
|
4
|
-
name?: string;
|
|
5
|
-
formName?: string;
|
|
6
|
-
label?: string;
|
|
7
|
-
defaultValue?: boolean;
|
|
8
|
-
onChange?: (value: boolean, event: React.ChangeEvent<HTMLInputElement>) => {
|
|
9
|
-
stopUIChange: boolean;
|
|
10
|
-
} | void;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
error?: string | undefined;
|
|
13
|
-
borderColor?: string;
|
|
14
|
-
};
|
|
15
|
-
export declare const CheckboxWithoutValidation: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
export declare const CheckBox: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
export {};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useAppSelector } from "@zauru-sdk/redux";
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
4
|
-
export const CheckboxWithoutValidation = (props) => {
|
|
5
|
-
const { id, name, defaultValue = false, onChange, disabled = false, error, label, } = props;
|
|
6
|
-
const [checked, setChecked] = useState(defaultValue);
|
|
7
|
-
useEffect(() => {
|
|
8
|
-
setChecked(defaultValue);
|
|
9
|
-
}, [defaultValue]);
|
|
10
|
-
const handleInputChange = (event) => {
|
|
11
|
-
const isChecked = event.target.checked;
|
|
12
|
-
if (onChange) {
|
|
13
|
-
const result = onChange(isChecked, event);
|
|
14
|
-
if (result?.stopUIChange) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
setChecked(isChecked);
|
|
19
|
-
};
|
|
20
|
-
const color = error ? "red" : "gray";
|
|
21
|
-
const borderColor = disabled ? "border-gray-300" : `border-${color}-500`;
|
|
22
|
-
const inputComponent = (_jsx("input", { type: "checkbox", id: id ?? name, name: name, checked: checked, onChange: handleInputChange, className: `form-checkbox h-4 w-4 text-indigo-600 ${borderColor} focus:border-indigo-500 focus:ring-indigo-500`, disabled: disabled }));
|
|
23
|
-
if (!error && !label) {
|
|
24
|
-
return inputComponent;
|
|
25
|
-
}
|
|
26
|
-
return (_jsxs("div", { className: "col-span-6 sm:col-span-3", children: [_jsxs("div", { className: `flex items-center ${borderColor}`, children: [inputComponent, label && (_jsx("label", { htmlFor: id ?? name, className: `ml-2 block text-sm font-medium text-${color}-700 dark:text-${color}-500`, children: label }))] }), error && (_jsxs("p", { className: `mt-2 text-sm text-${color}-600 dark:text-${color}-500`, children: [_jsx("span", { className: "font-medium", children: "Oops!" }), " ", error] }))] }));
|
|
27
|
-
};
|
|
28
|
-
//<reference> https://tailwindui.com/components/application-ui/forms/form-layouts
|
|
29
|
-
export const CheckBox = (props) => {
|
|
30
|
-
const { formValidations } = useAppSelector((state) => state.formValidation);
|
|
31
|
-
const error = formValidations[props.formName ?? "-1"]?.[props.name ?? "-1"];
|
|
32
|
-
props = { ...props, error };
|
|
33
|
-
return _jsx(CheckboxWithoutValidation, { ...props });
|
|
34
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export type ChecklistItem = {
|
|
3
|
-
id: string;
|
|
4
|
-
name: string;
|
|
5
|
-
label: string;
|
|
6
|
-
defaultValue?: boolean;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
};
|
|
9
|
-
type ChecklistProps = {
|
|
10
|
-
items: ChecklistItem[];
|
|
11
|
-
onChange?: (name: string, value: boolean) => void;
|
|
12
|
-
};
|
|
13
|
-
export declare const Checklist: React.FC<ChecklistProps>;
|
|
14
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { CheckboxWithoutValidation } from "../Checkbox/index.js";
|
|
3
|
-
export const Checklist = ({ items, onChange }) => {
|
|
4
|
-
const handleCheckboxChange = (name, value) => {
|
|
5
|
-
if (onChange) {
|
|
6
|
-
onChange(name, value);
|
|
7
|
-
}
|
|
8
|
-
};
|
|
9
|
-
return (_jsx("div", { children: items.map((item) => (_jsx(CheckboxWithoutValidation, { ...item, onChange: (value) => handleCheckboxChange(item.name, value) }, item.id))) }));
|
|
10
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
type Props = {
|
|
2
|
-
id?: string;
|
|
3
|
-
name: string;
|
|
4
|
-
formName?: string;
|
|
5
|
-
title?: string;
|
|
6
|
-
hint?: string;
|
|
7
|
-
helpText?: string;
|
|
8
|
-
defaultValue?: string;
|
|
9
|
-
onChange?: (value: string) => void;
|
|
10
|
-
isClearable?: boolean;
|
|
11
|
-
tabIndex?: number;
|
|
12
|
-
error?: string;
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
className?: string;
|
|
15
|
-
};
|
|
16
|
-
export declare const FormDatePickerWithoutValidation: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
export declare const FormDatePicker: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
import { CalendarIconSVG, CloseSvgIcon, IdeaIconSVG } from "@zauru-sdk/icons";
|
|
4
|
-
import { useAppSelector } from "@zauru-sdk/redux";
|
|
5
|
-
export const FormDatePickerWithoutValidation = (props) => {
|
|
6
|
-
const { id, name, title, defaultValue = "", hint, helpText, onChange, tabIndex, error, disabled = false, className = "", isClearable = false, } = props;
|
|
7
|
-
const [value, setValue] = useState(defaultValue);
|
|
8
|
-
const [showTooltip, setShowTooltip] = useState(false);
|
|
9
|
-
const color = error ? "red" : "gray";
|
|
10
|
-
const isReadOnly = disabled;
|
|
11
|
-
const bgColor = isReadOnly ? "bg-gray-200" : `bg-${color}-50`;
|
|
12
|
-
const textColor = isReadOnly ? "text-gray-500" : `text-${color}-500`;
|
|
13
|
-
const borderColor = isReadOnly ? "border-gray-300" : `border-${color}-200`;
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
setValue(defaultValue);
|
|
16
|
-
}, [defaultValue]);
|
|
17
|
-
const clearValue = () => {
|
|
18
|
-
setValue("");
|
|
19
|
-
onChange && onChange("");
|
|
20
|
-
};
|
|
21
|
-
return (_jsxs(_Fragment, { children: [title && (_jsx("label", { htmlFor: error ? `${name}-error` : `${name}-success`, className: `block text-sm font-medium ${textColor} ${className}`, children: title })), _jsxs("div", { className: "flex relative items-center", children: [_jsx("div", { className: "absolute left-0 flex items-center pl-3 pointer-events-none", children: _jsx(CalendarIconSVG, {}) }), _jsx("input", { id: id, name: name, tabIndex: tabIndex, type: "date", onChange: (e) => {
|
|
22
|
-
setValue(e.target.value);
|
|
23
|
-
onChange && onChange(e.target.value);
|
|
24
|
-
}, value: value ?? "", pattern: "\\d{4}-\\d{2}-\\d{2}", className: `${bgColor} ${borderColor} ${textColor} text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full pl-10 p-2.5` }), value && isClearable && (_jsx("button", { type: "button", onClick: clearValue, className: "absolute right-0 mr-10", children: _jsx(CloseSvgIcon, {}) })), helpText && (_jsx("div", { className: "flex items-center relative ml-3", children: _jsxs("div", { className: "relative cursor-pointer", onMouseEnter: () => setShowTooltip(true), onMouseLeave: () => setShowTooltip(false), children: [_jsx(IdeaIconSVG, {}), showTooltip && (_jsx("div", { className: "absolute -left-48 top-0 mt-8 p-2 bg-white border rounded shadow text-black", children: helpText }))] }) }))] }), error && (_jsxs("p", { className: `mt-2 text-sm text-${color}-600 dark:text-${color}-500`, children: [_jsx("span", { className: "font-medium", children: "Oops!" }), " ", error] })), !error && hint && (_jsx("p", { className: `mt-2 italic text-sm text-${color}-500 dark:text-${color}-400`, children: hint }))] }));
|
|
25
|
-
};
|
|
26
|
-
export const FormDatePicker = (props) => {
|
|
27
|
-
const { formValidations } = useAppSelector((state) => state.formValidation);
|
|
28
|
-
const error = formValidations[props.formName ?? "-1"]?.[props.name ?? "-1"];
|
|
29
|
-
props = { ...props, error };
|
|
30
|
-
return _jsx(FormDatePickerWithoutValidation, { ...props });
|
|
31
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { FormGraphQL, FormSubmissionValueGraphQL } from "@zauru-sdk/types";
|
|
2
|
-
type Props = {
|
|
3
|
-
formName?: string;
|
|
4
|
-
form?: FormGraphQL;
|
|
5
|
-
options?: {
|
|
6
|
-
showTitle: boolean;
|
|
7
|
-
showDescription: boolean;
|
|
8
|
-
};
|
|
9
|
-
defaultValues?: FormSubmissionValueGraphQL[];
|
|
10
|
-
namesStr?: string;
|
|
11
|
-
showingRules?: {
|
|
12
|
-
name: string;
|
|
13
|
-
show: boolean;
|
|
14
|
-
}[];
|
|
15
|
-
readOnly?: boolean;
|
|
16
|
-
};
|
|
17
|
-
export declare function DynamicBaculoForm(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
18
|
-
export {};
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { TextField, TextFieldWithoutValidation } from "../TextField/index.js";
|
|
3
|
-
import { TripleFieldContainer } from "../FieldContainer/index.js";
|
|
4
|
-
import { DoubleFieldContainer } from "../FieldContainer/index.js";
|
|
5
|
-
import { YesNo } from "../YesNo/index.js";
|
|
6
|
-
import { TextArea } from "../TextArea/index.js";
|
|
7
|
-
import { SelectField } from "../SelectField/index.js";
|
|
8
|
-
import { FileUploadField } from "../FileUpload/index.js";
|
|
9
|
-
import { FormDatePicker } from "../DatePicker/index.js";
|
|
10
|
-
import { FormTimePicker } from "../TimePicker/index.js";
|
|
11
|
-
import { GenericDynamicTable } from "../../DynamicTable/GenericDynamicTable.js";
|
|
12
|
-
import { getDepSelectOptions, getMunSelectOptions } from "@zauru-sdk/common";
|
|
13
|
-
import { StaticAlert } from "../../Alerts/index.js";
|
|
14
|
-
import { SubContainer } from "../../Containers/index.js";
|
|
15
|
-
import { LineSeparator } from "../../LineSeparator/index.js";
|
|
16
|
-
export function DynamicBaculoForm(props) {
|
|
17
|
-
const { form, options = { showDescription: false, showTitle: false }, formName = "", namesStr = "", defaultValues = [], showingRules = [], readOnly = false, } = props;
|
|
18
|
-
if (!form) {
|
|
19
|
-
return (_jsx(StaticAlert, { title: "No se encontr\u00F3 el formulario din\u00E1mico", description: `Ocurrió un error encontrando el formulario para ${formName}, contacte al administrador con este mensaje de error.`, type: "info" }));
|
|
20
|
-
}
|
|
21
|
-
const renderFieldComponent = (field) => {
|
|
22
|
-
const defaultValue = defaultValues?.find((x) => x.settings_form_field.print_var_name === field.print_var_name);
|
|
23
|
-
switch (field.field_type) {
|
|
24
|
-
case "fixed_rows_table":
|
|
25
|
-
case "fixed_columns_table": {
|
|
26
|
-
const columns = field.settings_form_field_table_headers?.map((x) => {
|
|
27
|
-
return {
|
|
28
|
-
label: x.name,
|
|
29
|
-
name: `${namesStr}${x.id}_${field.id}`,
|
|
30
|
-
type: x.cell_type === "yes_no" ? "checkbox" : "textField",
|
|
31
|
-
};
|
|
32
|
-
}) ?? [];
|
|
33
|
-
return (_jsx(SubContainer, { title: field.name, children: _jsx(GenericDynamicTable, { name: "fixed_columns_table", columns: columns }) }, field.id));
|
|
34
|
-
}
|
|
35
|
-
case "zauru_data":
|
|
36
|
-
return (_jsx(TextFieldWithoutValidation, { title: `${field.required ? "*" : ""}${field.name}`, hint: field.hint, defaultValue: defaultValue?.value ?? field.default_value, disabled: true }, field.id));
|
|
37
|
-
case "hour":
|
|
38
|
-
return (_jsx(FormTimePicker, { title: `${field.required ? "*" : ""}${field.name}`, name: `${namesStr}${field.form_id}_${field.id}`, hint: field.hint, disabled: readOnly, defaultValue: defaultValue?.value }, field.id));
|
|
39
|
-
case "date":
|
|
40
|
-
return (_jsx(FormDatePicker, { title: `${field.required ? "*" : ""}${field.name}`, name: `${namesStr}${field.form_id}_${field.id}`, hint: field.hint, disabled: readOnly, defaultValue: defaultValue?.value }, field.id));
|
|
41
|
-
case "file":
|
|
42
|
-
return (_jsx(FileUploadField, { title: `${field.required ? "*" : ""}${field.name}`, name: `${namesStr}${field.form_id}_${field.id}`, hint: field.hint, disabled: readOnly, defaultValue: defaultValue?.value, download: true }, field.id));
|
|
43
|
-
case "image":
|
|
44
|
-
return (_jsx(FileUploadField, { title: `${field.required ? "*" : ""}${field.name}`, name: `${namesStr}${field.form_id}_${field.id}`, hint: field.hint, showAvailableTypes: true, fileTypes: ["png", "jpg", "jpeg"], disabled: readOnly, defaultValue: defaultValue?.value }, field.id));
|
|
45
|
-
case "pdf":
|
|
46
|
-
return (_jsx(FileUploadField, { title: `${field.required ? "*" : ""}${field.name}`, name: `${namesStr}${field.form_id}_${field.id}`, hint: field.hint, showAvailableTypes: true, fileTypes: ["pdf"], disabled: readOnly, defaultValue: defaultValue?.value, download: true }, field.id));
|
|
47
|
-
case "email":
|
|
48
|
-
case "url":
|
|
49
|
-
case "text":
|
|
50
|
-
case "currency":
|
|
51
|
-
case "country":
|
|
52
|
-
return (_jsx(TextField, { title: `${field.required ? "*" : ""}${field.name}`, name: `${namesStr}${field.form_id}_${field.id}`, hint: field.hint, defaultValue: defaultValue?.value ?? field.default_value, disabled: readOnly }, field.id));
|
|
53
|
-
case "percentage":
|
|
54
|
-
case "number":
|
|
55
|
-
return (_jsx(TextField, { title: `${field.required ? "*" : ""}${field.name}`, name: `${namesStr}${field.form_id}_${field.id}`, hint: field.hint, defaultValue: defaultValue?.value ?? field.default_value, type: "number", disabled: readOnly }, field.id));
|
|
56
|
-
case "yes_no":
|
|
57
|
-
return (_jsx(YesNo, { title: `${field.required ? "*" : ""}${field.name}`, name: `${namesStr}${field.form_id}_${field.id}`, disabled: readOnly, defaultValue: field.default_value === "true" || defaultValue?.value === "true" }, field.id));
|
|
58
|
-
case "section":
|
|
59
|
-
return (_jsxs("div", { children: [_jsx(LineSeparator, {}), _jsx("h3", { className: "mb-10 text-3xl font-bold leading-8 text-gray-900", children: field.name })] }, field.id));
|
|
60
|
-
case "multi_line_text":
|
|
61
|
-
return (_jsx(TextArea, { title: `${field.required ? "*" : ""}${field.name}`, name: `${namesStr}${field.form_id}_${field.id}`, defaultValue: defaultValue?.value ?? field.default_value, hint: field.hint, disabled: readOnly }, field.id));
|
|
62
|
-
case "gt_departamentos": {
|
|
63
|
-
const optionsDep = getDepSelectOptions();
|
|
64
|
-
return (_jsx(SelectField, { title: `${field.required ? "*" : ""}${field.name}`, name: `${namesStr}${field.form_id}_${field.id}`, hint: field.hint, isClearable: !field.required, options: optionsDep, disabled: readOnly, defaultValue: optionsDep.find((x) => x.value === defaultValue?.value) }, field.id));
|
|
65
|
-
}
|
|
66
|
-
case "gt_municipios": {
|
|
67
|
-
const options = getMunSelectOptions();
|
|
68
|
-
return (_jsx(SelectField, { title: `${field.required ? "*" : ""}${field.name}`, name: `${namesStr}${field.form_id}_${field.id}`, hint: field.hint, isClearable: !field.required, options: options, disabled: readOnly, defaultValue: options.find((x) => x.value === defaultValue?.value) }, field.id));
|
|
69
|
-
}
|
|
70
|
-
case "single_select_options": {
|
|
71
|
-
const formFieldOptions = field.settings_form_field_options?.map((x) => {
|
|
72
|
-
return { label: x.label, value: x.value };
|
|
73
|
-
}) ?? [];
|
|
74
|
-
return (_jsx(SelectField, { title: `${field.required ? "*" : ""}${field.name}`, name: `${namesStr}${field.form_id}_${field.id}`, hint: field.hint, isClearable: !field.required, options: formFieldOptions, disabled: readOnly, defaultValue: formFieldOptions.find((x) => x.value === defaultValue?.value) }, field.id));
|
|
75
|
-
}
|
|
76
|
-
case "multi_select_options": {
|
|
77
|
-
const formFieldOptions2 = field.settings_form_field_options?.map((x) => {
|
|
78
|
-
return { label: x.label, value: x.value };
|
|
79
|
-
}) ?? [];
|
|
80
|
-
const defaultValuesMulti = (() => {
|
|
81
|
-
const values = defaultValue?.value?.split(",").map((str) => str.trim()) ?? [];
|
|
82
|
-
return formFieldOptions2.filter((x) => values.includes(x.value));
|
|
83
|
-
})();
|
|
84
|
-
return (_jsx(SelectField, { title: `${field.required ? "*" : ""}${field.name}`, name: `${namesStr}${field.form_id}_${field.id}`, hint: field.hint, isClearable: !field.required, isMulti: true, options: formFieldOptions2, defaultValueMulti: defaultValuesMulti, disabled: readOnly }, field.id));
|
|
85
|
-
}
|
|
86
|
-
default:
|
|
87
|
-
return (_jsxs("div", { children: ["Componente no encontrado para: ", field.field_type] }, field.id)); // o algún componente por defecto si lo prefieres
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
const renderFields = () => {
|
|
91
|
-
const fields = form.settings_form_fields;
|
|
92
|
-
const fieldGroups = [];
|
|
93
|
-
let tempGroup = [];
|
|
94
|
-
fields.forEach((field, i) => {
|
|
95
|
-
const rule = showingRules.find((x) => x.name === field.name);
|
|
96
|
-
if (!(rule && !rule.show)) {
|
|
97
|
-
const renderedField = renderFieldComponent(field);
|
|
98
|
-
if (renderedField === null) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
tempGroup.push(renderedField);
|
|
102
|
-
const isLastField = i === fields.length - 1;
|
|
103
|
-
const isSectionField = field.field_type === "section";
|
|
104
|
-
if (isSectionField) {
|
|
105
|
-
tempGroup.pop();
|
|
106
|
-
if (tempGroup.length === 1) {
|
|
107
|
-
fieldGroups.push(tempGroup[0]);
|
|
108
|
-
}
|
|
109
|
-
else if (tempGroup.length === 2) {
|
|
110
|
-
fieldGroups.push(_jsx(DoubleFieldContainer, { children: tempGroup }, i));
|
|
111
|
-
}
|
|
112
|
-
else if (tempGroup.length === 3) {
|
|
113
|
-
fieldGroups.push(_jsx(TripleFieldContainer, { children: tempGroup }, i));
|
|
114
|
-
}
|
|
115
|
-
fieldGroups.push(renderedField);
|
|
116
|
-
tempGroup = [];
|
|
117
|
-
}
|
|
118
|
-
else if (isLastField) {
|
|
119
|
-
if (tempGroup.length === 1) {
|
|
120
|
-
fieldGroups.push(tempGroup[0]);
|
|
121
|
-
}
|
|
122
|
-
else if (tempGroup.length === 2) {
|
|
123
|
-
fieldGroups.push(_jsx(DoubleFieldContainer, { children: tempGroup }, i));
|
|
124
|
-
}
|
|
125
|
-
else if (tempGroup.length === 3) {
|
|
126
|
-
fieldGroups.push(_jsx(TripleFieldContainer, { children: tempGroup }, i));
|
|
127
|
-
}
|
|
128
|
-
tempGroup = [];
|
|
129
|
-
}
|
|
130
|
-
else if (tempGroup.length === 3) {
|
|
131
|
-
// Si hay 3 elementos en el grupo temporal y el siguiente campo no es 'section', se agrega a fieldGroups
|
|
132
|
-
fieldGroups.push(_jsx(TripleFieldContainer, { children: tempGroup }, i));
|
|
133
|
-
tempGroup = [];
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
return fieldGroups;
|
|
138
|
-
};
|
|
139
|
-
return (_jsx(SubContainer, { title: options?.showTitle ? form.name : undefined, description: options?.showDescription ? form.description : undefined, children: renderFields() }));
|
|
140
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
export const DoubleFieldContainer = (props) => {
|
|
3
|
-
const { children, className, alignCenter = true } = props;
|
|
4
|
-
const getChildren = (index) => {
|
|
5
|
-
if (children && Array.isArray(children) && children[index]) {
|
|
6
|
-
return children[index];
|
|
7
|
-
}
|
|
8
|
-
if (children && index === 0) {
|
|
9
|
-
return children;
|
|
10
|
-
}
|
|
11
|
-
return _jsx(_Fragment, {});
|
|
12
|
-
};
|
|
13
|
-
return (_jsx(_Fragment, { children: _jsxs("div", { className: `grid md:grid-cols-2 sm:grid-cols-1 gap-4 ${className}`, style: alignCenter ? { alignItems: "center" } : {}, children: [_jsx("div", { className: "col-span-1", children: getChildren(0) }), _jsx("div", { className: "col-span-1", children: getChildren(1) })] }) }));
|
|
14
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
export const QuadrupleFieldContainer = (props) => {
|
|
3
|
-
const { children, className } = props;
|
|
4
|
-
const getChildren = (index) => {
|
|
5
|
-
if (children && Array.isArray(children) && children[index]) {
|
|
6
|
-
return children[index];
|
|
7
|
-
}
|
|
8
|
-
if (children && index === 0) {
|
|
9
|
-
return children;
|
|
10
|
-
}
|
|
11
|
-
return _jsx(_Fragment, {});
|
|
12
|
-
};
|
|
13
|
-
return (_jsx(_Fragment, { children: _jsxs("div", { className: `grid lg:grid-cols-4 sm:grid-cols-2 xs:grid-cols-1 gap-4 ${className}`, style: { alignItems: "center" }, children: [_jsx("div", { className: "col-span-1", children: getChildren(0) }), _jsx("div", { className: "col-span-1", children: getChildren(1) }), _jsx("div", { className: "col-span-1", children: getChildren(2) }), _jsx("div", { className: "col-span-1", children: getChildren(3) })] }) }));
|
|
14
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
export const TripleFieldContainer = (props) => {
|
|
3
|
-
const { children, className } = props;
|
|
4
|
-
const getChildren = (index) => {
|
|
5
|
-
if (children && Array.isArray(children) && children[index]) {
|
|
6
|
-
return children[index];
|
|
7
|
-
}
|
|
8
|
-
if (children && index === 0) {
|
|
9
|
-
return children;
|
|
10
|
-
}
|
|
11
|
-
return _jsx(_Fragment, {});
|
|
12
|
-
};
|
|
13
|
-
return (_jsx(_Fragment, { children: _jsxs("div", { className: `grid sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4 ${className}`, style: { alignItems: "center" }, children: [_jsx("div", { className: "col-span-1", children: getChildren(0) }), _jsx("div", { className: "col-span-1", children: getChildren(1) }), _jsx("div", { className: "col-span-1", children: getChildren(2) })] }) }));
|
|
14
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
type Props = {
|
|
3
|
-
id?: string;
|
|
4
|
-
name: string;
|
|
5
|
-
formName?: string;
|
|
6
|
-
title?: string;
|
|
7
|
-
helpText?: string;
|
|
8
|
-
hint?: string;
|
|
9
|
-
onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
10
|
-
disabled?: boolean;
|
|
11
|
-
readOnly?: boolean;
|
|
12
|
-
error?: string | undefined;
|
|
13
|
-
fileTypes?: string[];
|
|
14
|
-
showAvailableTypes?: boolean;
|
|
15
|
-
className?: string;
|
|
16
|
-
defaultValue?: string | File;
|
|
17
|
-
download?: boolean;
|
|
18
|
-
};
|
|
19
|
-
export declare const FileUploadFieldWithoutValidation: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
-
export declare const FileUploadField: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
-
export {};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { DownloadIconSVG, IdeaIconSVG } from "@zauru-sdk/icons";
|
|
3
|
-
import { useAppSelector } from "@zauru-sdk/redux";
|
|
4
|
-
import { useState } from "react";
|
|
5
|
-
export const FileUploadFieldWithoutValidation = (props) => {
|
|
6
|
-
const { id, name, title, helpText, hint, onChange, disabled = false, readOnly = false, error, fileTypes = [], showAvailableTypes = false, className, defaultValue = undefined, download = false, } = props;
|
|
7
|
-
const [showTooltip, setShowTooltip] = useState(false);
|
|
8
|
-
if (typeof defaultValue == "string") {
|
|
9
|
-
if (download) {
|
|
10
|
-
return (_jsxs("div", { role: "button", tabIndex: 0, onClick: () => {
|
|
11
|
-
window.open(defaultValue, "_blank");
|
|
12
|
-
}, onKeyDown: (event) => {
|
|
13
|
-
// Permite que el evento se active con la tecla Enter
|
|
14
|
-
if (event.key === "Enter") {
|
|
15
|
-
window.open(defaultValue, "_blank");
|
|
16
|
-
}
|
|
17
|
-
}, children: [title && (_jsx("label", { htmlFor: name, className: "block mb-1 text-sm font-medium text-gray-700", children: title })), " ", _jsx(DownloadIconSVG, {})] }));
|
|
18
|
-
}
|
|
19
|
-
return (_jsxs("div", { className: `col-span-6 sm:col-span-3 ${className}`, children: [title && (_jsx("label", { htmlFor: name, className: `block mb-1 text-sm font-medium text-gray-700`, children: title })), " ", _jsx("div", { role: "button", tabIndex: 0, onClick: () => {
|
|
20
|
-
window.open(defaultValue, "_blank");
|
|
21
|
-
}, onKeyDown: (event) => {
|
|
22
|
-
// Permite que el evento se active con la tecla Enter
|
|
23
|
-
if (event.key === "Enter") {
|
|
24
|
-
window.open(defaultValue, "_blank");
|
|
25
|
-
}
|
|
26
|
-
}, children: _jsx("img", { src: defaultValue, alt: name, className: `h-48 w-48 inline mr-1 pb-1`, style: {
|
|
27
|
-
stroke: "currentColor",
|
|
28
|
-
strokeWidth: 2,
|
|
29
|
-
strokeLinecap: "round",
|
|
30
|
-
strokeLinejoin: "round",
|
|
31
|
-
fill: "none",
|
|
32
|
-
backgroundColor: "transparent",
|
|
33
|
-
} }) })] }));
|
|
34
|
-
}
|
|
35
|
-
const handleInputChange = (event) => {
|
|
36
|
-
onChange && onChange(event);
|
|
37
|
-
};
|
|
38
|
-
let hintMessage = hint;
|
|
39
|
-
if (showAvailableTypes && fileTypes.length > 0) {
|
|
40
|
-
hintMessage = `${hint} Archivos permitidos: ${fileTypes.join(", ")}`;
|
|
41
|
-
}
|
|
42
|
-
const color = error ? "red" : "gray";
|
|
43
|
-
const isReadOnly = disabled || readOnly;
|
|
44
|
-
const bgColor = isReadOnly ? "bg-gray-200" : `bg-${color}-50`;
|
|
45
|
-
const textColor = isReadOnly ? "text-gray-500" : `text-${color}-900`;
|
|
46
|
-
const borderColor = isReadOnly ? "border-gray-300" : `border-${color}-500`;
|
|
47
|
-
return (_jsxs("div", { className: `col-span-6 sm:col-span-3 ${className}`, children: [title && (_jsx("label", { htmlFor: name, className: `block mb-1 text-sm font-medium text-${color}-700`, children: title })), _jsxs("div", { className: "flex relative items-center", children: [_jsx("input", { type: "file", name: name, id: id ?? name, disabled: disabled, readOnly: readOnly, accept: fileTypes.map((ft) => `.${ft}`).join(", "), onChange: handleInputChange, className: `block w-full rounded-md ${bgColor} ${borderColor} ${textColor} shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm` }), helpText && (_jsx("div", { className: "flex items-center relative ml-3", children: _jsxs("div", { className: "relative cursor-pointer", onMouseEnter: () => setShowTooltip(true), onMouseLeave: () => setShowTooltip(false), children: [_jsx(IdeaIconSVG, {}), showTooltip && (_jsx("div", { className: "absolute -left-48 top-0 mt-8 p-2 bg-white border rounded shadow text-black z-50", children: helpText }))] }) }))] }), error && (_jsxs("p", { className: `mt-2 text-sm text-${color}-600`, children: [_jsx("span", { className: "font-medium", children: "Oops!" }), " ", error] })), !error && hintMessage && (_jsx("p", { className: `mt-2 italic text-sm text-${color}-500`, children: hintMessage }))] }));
|
|
48
|
-
};
|
|
49
|
-
export const FileUploadField = (props) => {
|
|
50
|
-
const { formValidations } = useAppSelector((state) => state.formValidation);
|
|
51
|
-
const error = formValidations[props.formName ?? "-1"]?.[props.name ?? "-1"];
|
|
52
|
-
props = { ...props, error };
|
|
53
|
-
return _jsx(FileUploadFieldWithoutValidation, { ...props });
|
|
54
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
type Props = {
|
|
3
|
-
saveTitle?: string;
|
|
4
|
-
saveName?: string;
|
|
5
|
-
onClickSave?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
|
|
6
|
-
showCancel?: boolean;
|
|
7
|
-
cancelTitle?: string;
|
|
8
|
-
cancelName?: string;
|
|
9
|
-
showClear?: boolean;
|
|
10
|
-
clearTitle?: string;
|
|
11
|
-
clearName?: string;
|
|
12
|
-
loading?: boolean;
|
|
13
|
-
loadingSaveText?: string;
|
|
14
|
-
};
|
|
15
|
-
export declare const FormButtons: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
export {};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
export const FormButtons = (props) => {
|
|
3
|
-
const { saveTitle = "Guardar", saveName = "save", cancelTitle = "Cancelar", cancelName = "cancel", showCancel = true, showClear = false, clearName = "clear", clearTitle = "Limpiar", loading = false, onClickSave, loadingSaveText = "Guardando...", } = props;
|
|
4
|
-
return (_jsxs(_Fragment, { children: [showClear && (_jsx("button", { type: "reset", name: "action", disabled: loading, value: clearName, className: `ml-5 ${loading ? " bg-opacity-25 cursor-progress" : ""} rounded-md border border-gray-300 bg-white py-2 px-3 text-sm font-medium leading-4 text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2`, children: clearTitle })), showCancel && (_jsx("button", { type: "button", name: "action", disabled: loading, value: cancelName, className: `${showClear ? "ml-2" : "ml-5"} ${loading ? " bg-opacity-25 cursor-progress" : ""} rounded-md border border-gray-300 bg-white py-2 px-3 text-sm font-medium leading-4 text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2`, children: cancelTitle })), _jsx("button", { type: "submit", name: "action", disabled: loading, value: saveName, onClick: onClickSave, className: `ml-2 ${loading ? " bg-opacity-25 cursor-progress" : "hover:bg-indigo-700"} inline-flex justify-center rounded-md border border-transparent bg-indigo-600 py-2 px-4 text-sm font-medium text-white shadow-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2`, children: loading ? loadingSaveText : saveTitle })] }));
|
|
5
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type FormMethod } from "@remix-run/react";
|
|
2
|
-
import { type ReactNode } from "react";
|
|
3
|
-
type Props = {
|
|
4
|
-
formId: string;
|
|
5
|
-
title?: string;
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
buttons?: ReactNode;
|
|
8
|
-
method?: FormMethod;
|
|
9
|
-
};
|
|
10
|
-
export declare const FormLayout: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Form } from "@remix-run/react";
|
|
3
|
-
import { ButtonSectionContainer } from "../../Containers/index.js";
|
|
4
|
-
export const FormLayout = (props) => {
|
|
5
|
-
const { title, children, buttons, method, formId } = props;
|
|
6
|
-
return (_jsxs(Form, { id: formId, name: formId, method: method ?? "post", children: [title && (_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-3", children: title })), _jsxs("div", { className: "shadow sm:overflow-hidden sm:rounded-md", children: [_jsx("div", { className: "space-y-6 bg-white px-4 py-5 sm:p-6", children: children }), buttons && (_jsx(ButtonSectionContainer, { children: buttons }))] })] }, formId));
|
|
7
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { SelectFieldOption } from "@zauru-sdk/types";
|
|
2
|
-
import type { SingleValue, InputActionMeta } from "react-select";
|
|
3
|
-
type Props = {
|
|
4
|
-
id?: string;
|
|
5
|
-
formName?: string;
|
|
6
|
-
name?: string;
|
|
7
|
-
title?: string;
|
|
8
|
-
defaultValue?: SingleValue<SelectFieldOption>;
|
|
9
|
-
defaultValueMulti?: SingleValue<SelectFieldOption>[];
|
|
10
|
-
helpText?: string;
|
|
11
|
-
options: Array<SelectFieldOption>;
|
|
12
|
-
onChange?: (value: SingleValue<SelectFieldOption>) => void;
|
|
13
|
-
onChangeMulti?: (value: Array<SingleValue<SelectFieldOption>>) => void;
|
|
14
|
-
onInputChange?: (newValue: string, actionMeta: InputActionMeta) => void;
|
|
15
|
-
isClearable?: boolean;
|
|
16
|
-
error?: string | undefined;
|
|
17
|
-
disabled?: boolean;
|
|
18
|
-
menuIsOpen?: boolean;
|
|
19
|
-
readOnly?: boolean;
|
|
20
|
-
isMulti?: boolean;
|
|
21
|
-
loading?: boolean;
|
|
22
|
-
hint?: string;
|
|
23
|
-
className?: string;
|
|
24
|
-
};
|
|
25
|
-
export declare const SelectFieldWithoutValidation: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
-
export declare const SelectField: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
-
export {};
|