@zauru-sdk/components 1.0.50 → 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 +16 -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
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { IdeaIconSVG } from "@zauru-sdk/icons";
|
|
3
|
-
import { useAppSelector } from "@zauru-sdk/redux";
|
|
4
|
-
import { useEffect, useState } from "react";
|
|
5
|
-
import Select, { components } from "react-select";
|
|
6
|
-
import { LoadingInputSkeleton } from "../../Skeletons/index.js";
|
|
7
|
-
const Input = (props) => (_jsx(components.Input, { ...props, readOnly: props.selectProps.isReadOnly }));
|
|
8
|
-
export const SelectFieldWithoutValidation = (props) => {
|
|
9
|
-
const { id, name, title, defaultValue, defaultValueMulti = [], helpText, hint, options, onChange, onChangeMulti, isClearable = false, error = false, disabled = false, readOnly = false, isMulti = false, loading = false, className = "", onInputChange, } = props;
|
|
10
|
-
const [value, setValue] = useState(defaultValue || null);
|
|
11
|
-
const [valueMulti, setValueMulti] = useState(defaultValueMulti);
|
|
12
|
-
const [inputValue, setInputValue] = useState("");
|
|
13
|
-
const [showTooltip, setShowTooltip] = useState(false);
|
|
14
|
-
const [isClient, setIsClient] = useState(typeof window !== "undefined");
|
|
15
|
-
const menuIsOpen = readOnly ? false : props?.menuIsOpen;
|
|
16
|
-
const color = error ? "red" : "gray";
|
|
17
|
-
let documentRef = null;
|
|
18
|
-
const isReadOnly = disabled || readOnly;
|
|
19
|
-
const bgColor = isReadOnly ? "bg-gray-200" : `bg-${color}-50`;
|
|
20
|
-
const textColor = isReadOnly ? "text-gray-500" : `text-${color}-900`;
|
|
21
|
-
const borderColor = isReadOnly ? "border-gray-300" : `border-${color}-500`;
|
|
22
|
-
if (typeof window !== "undefined") {
|
|
23
|
-
documentRef = document;
|
|
24
|
-
}
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
setValue(defaultValue || null);
|
|
27
|
-
}, [defaultValue]);
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
setIsClient(true);
|
|
30
|
-
}, []);
|
|
31
|
-
if (!isClient || loading || !documentRef) {
|
|
32
|
-
return (_jsxs(_Fragment, { children: [title && (_jsx("label", { htmlFor: error ? `${name}-error` : `${name}-success`, className: `block text-sm font-medium text-${color}-700 dark:text-${color}-500`, children: title })), _jsx(LoadingInputSkeleton, {}), helpText && (_jsx("p", { className: `mt-2 italic text-sm text-${color}-500 dark:text-${color}-400`, children: helpText }))] }));
|
|
33
|
-
}
|
|
34
|
-
const handleOnChange = (selection) => {
|
|
35
|
-
// Verificar si el valor de selección es un objeto con propiedades 'value' y 'label'
|
|
36
|
-
if (typeof selection === "object" &&
|
|
37
|
-
selection !== null &&
|
|
38
|
-
"value" in selection &&
|
|
39
|
-
"label" in selection) {
|
|
40
|
-
setValue(selection);
|
|
41
|
-
onChange && onChange(selection);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
setValue(null);
|
|
45
|
-
onChange && onChange(null);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
const handleOnChangeMulti = (selection) => {
|
|
49
|
-
if (Array.isArray(selection)) {
|
|
50
|
-
setValueMulti(selection);
|
|
51
|
-
onChangeMulti &&
|
|
52
|
-
onChangeMulti(selection);
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
setValueMulti([]);
|
|
56
|
-
onChangeMulti && onChangeMulti([]);
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
const selectComponent = (_jsxs(_Fragment, { children: [_jsx(Select, { className: `block w-full rounded-md ${bgColor} ${borderColor} ${textColor} shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm`, id: isMulti ? undefined : id, instanceId: isMulti ? undefined : id, isDisabled: disabled, name: isMulti ? undefined : name, options: options, onChange: isMulti ? handleOnChangeMulti : handleOnChange, defaultValue: isMulti ? valueMulti : value, onInputChange: (newValue, actionMeta) => {
|
|
60
|
-
setInputValue(newValue);
|
|
61
|
-
onInputChange && onInputChange(newValue, actionMeta);
|
|
62
|
-
}, inputValue: inputValue, onMenuOpen: () => { }, onMenuClose: () => { }, menuPortalTarget: documentRef?.body, styles: { menuPortal: (base) => ({ ...base, zIndex: 9999 }) }, isClearable: isClearable, isSearchable: true, components: { Input }, menuIsOpen: menuIsOpen,
|
|
63
|
-
//windowThreshold={50}
|
|
64
|
-
isMulti: isMulti }), isMulti && (_jsx("input", { hidden: true, readOnly: true, name: name, value: valueMulti.map((x) => x?.value).join(","), id: id }))] }));
|
|
65
|
-
return (_jsxs("div", { className: `col-span-6 sm:col-span-3 ${className}`, children: [title && (_jsx("label", { htmlFor: error ? `${name}-error` : `${name}-success`, className: `block text-sm font-medium ${color === "red"
|
|
66
|
-
? "text-red-700 dark:text-red-500"
|
|
67
|
-
: "text-gray-700 dark:text-gray-500"}`, children: title })), _jsxs("div", { className: "flex relative items-center", children: [selectComponent, 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 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 }))] }));
|
|
68
|
-
};
|
|
69
|
-
export const SelectField = (props) => {
|
|
70
|
-
const { formValidations } = useAppSelector((state) => state.formValidation);
|
|
71
|
-
const error = formValidations[props.formName ?? "-1"]?.[props.name ?? "-1"];
|
|
72
|
-
props = { ...props, error };
|
|
73
|
-
return _jsx(SelectFieldWithoutValidation, { ...props });
|
|
74
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
type Props = {
|
|
3
|
-
id?: string;
|
|
4
|
-
name: string;
|
|
5
|
-
formName?: string;
|
|
6
|
-
title?: string;
|
|
7
|
-
defaultValue?: string | number;
|
|
8
|
-
hidden?: boolean;
|
|
9
|
-
hint?: string;
|
|
10
|
-
helpText?: string;
|
|
11
|
-
onChange?: (value: string) => void;
|
|
12
|
-
onKeyDown?: (event: React.KeyboardEvent) => void;
|
|
13
|
-
disabled?: boolean;
|
|
14
|
-
readOnly?: boolean;
|
|
15
|
-
error?: string | undefined;
|
|
16
|
-
rows?: number;
|
|
17
|
-
cols?: number;
|
|
18
|
-
stopChangeEvents?: boolean;
|
|
19
|
-
className?: string;
|
|
20
|
-
};
|
|
21
|
-
export declare const TextAreaWithoutValidation: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
export declare const TextArea: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
export {};
|
|
@@ -1,36 +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 TextAreaWithoutValidation = (props) => {
|
|
5
|
-
const { id, name, title, defaultValue = "", hidden, hint, onChange, onKeyDown, disabled = false, error = false, readOnly = false, rows, cols, stopChangeEvents, className = "", } = props;
|
|
6
|
-
const [value, setValue] = useState(defaultValue);
|
|
7
|
-
const color = error ? "red" : "gray";
|
|
8
|
-
const isReadOnly = disabled || readOnly;
|
|
9
|
-
const bgColor = isReadOnly ? "bg-gray-200" : `bg-${color}-50`;
|
|
10
|
-
const textColor = isReadOnly ? "text-gray-500" : `text-${color}-900`;
|
|
11
|
-
const borderColor = isReadOnly ? "border-gray-300" : `border-${color}-500`;
|
|
12
|
-
useEffect(() => {
|
|
13
|
-
setValue(defaultValue);
|
|
14
|
-
}, [defaultValue]);
|
|
15
|
-
if (hidden) {
|
|
16
|
-
return (_jsx("textarea", { id: id ?? name, name: name, value: defaultValue, readOnly: true, hidden: true }));
|
|
17
|
-
}
|
|
18
|
-
const handleInputChange = (event) => {
|
|
19
|
-
if (stopChangeEvents) {
|
|
20
|
-
event.stopPropagation();
|
|
21
|
-
event.preventDefault();
|
|
22
|
-
}
|
|
23
|
-
setValue(event.target.value);
|
|
24
|
-
onChange && onChange(event.target.value);
|
|
25
|
-
};
|
|
26
|
-
return (_jsxs("div", { className: `col-span-6 sm:col-span-3 ${className}`, children: [title && (_jsx("label", { htmlFor: error ? `${name}-error` : `${name}-success`, className: `block text-sm font-medium text-${color}-700 dark:text-${color}-500`, children: title })), _jsx("textarea", { name: name, readOnly: readOnly, disabled: disabled, id: id ?? name, autoComplete: "given-name", value: value, rows: rows, cols: cols, onChange: handleInputChange, onKeyDown: (event) => {
|
|
27
|
-
onKeyDown && onKeyDown(event);
|
|
28
|
-
}, className: `mt-1 block w-full rounded-md ${bgColor} ${borderColor} ${textColor} shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm` }), 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 }))] }));
|
|
29
|
-
};
|
|
30
|
-
//<reference> https://tailwindui.com/components/application-ui/forms/form-layouts
|
|
31
|
-
export const TextArea = (props) => {
|
|
32
|
-
const { formValidations } = useAppSelector((state) => state.formValidation);
|
|
33
|
-
const error = formValidations[props.formName ?? "-1"]?.[props.name ?? "-1"];
|
|
34
|
-
props = { ...props, error };
|
|
35
|
-
return _jsx(TextAreaWithoutValidation, { ...props });
|
|
36
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
type Props = {
|
|
3
|
-
id?: string;
|
|
4
|
-
name?: string;
|
|
5
|
-
formName?: string;
|
|
6
|
-
title?: string;
|
|
7
|
-
defaultValue?: string | number;
|
|
8
|
-
hidden?: boolean;
|
|
9
|
-
type?: React.HTMLInputTypeAttribute;
|
|
10
|
-
helpText?: string;
|
|
11
|
-
hint?: string;
|
|
12
|
-
onChange?: (value: string, event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
13
|
-
onKeyDown?: (event: React.KeyboardEvent) => void;
|
|
14
|
-
disabled?: boolean;
|
|
15
|
-
readOnly?: boolean;
|
|
16
|
-
error?: string;
|
|
17
|
-
min?: string | number;
|
|
18
|
-
integer?: boolean;
|
|
19
|
-
stopChangeEvents?: boolean;
|
|
20
|
-
style?: React.CSSProperties;
|
|
21
|
-
className?: string;
|
|
22
|
-
};
|
|
23
|
-
export declare const TextFieldWithoutValidation: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
-
export declare const TextField: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
-
export {};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { IdeaIconSVG } from "@zauru-sdk/icons";
|
|
3
|
-
import { useAppSelector } from "@zauru-sdk/redux";
|
|
4
|
-
import { useEffect, useState } from "react";
|
|
5
|
-
export const TextFieldWithoutValidation = (props) => {
|
|
6
|
-
const { id, name, defaultValue = "", hidden, type = "text", onChange, onKeyDown, disabled = false, readOnly = false, min, integer = false, stopChangeEvents, style, error, title, helpText, className, hint, } = props;
|
|
7
|
-
const [showTooltip, setShowTooltip] = useState(false);
|
|
8
|
-
const [value, setValue] = useState(defaultValue);
|
|
9
|
-
const color = error ? "red" : "gray";
|
|
10
|
-
const isReadOnly = disabled || readOnly;
|
|
11
|
-
const bgColor = isReadOnly ? "bg-gray-200" : `bg-${color}-50`;
|
|
12
|
-
const textColor = isReadOnly ? "text-gray-500" : `text-${color}-900`;
|
|
13
|
-
const borderColor = isReadOnly ? "border-gray-300" : `border-${color}-500`;
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
setValue(defaultValue);
|
|
16
|
-
}, [defaultValue]);
|
|
17
|
-
if (hidden) {
|
|
18
|
-
return (_jsx("input", { type: type, id: id ?? name, name: name, value: defaultValue, readOnly: true, hidden: true }));
|
|
19
|
-
}
|
|
20
|
-
const handleInputChange = (event) => {
|
|
21
|
-
if (stopChangeEvents) {
|
|
22
|
-
event.stopPropagation();
|
|
23
|
-
event.preventDefault();
|
|
24
|
-
}
|
|
25
|
-
if (integer && type === "number") {
|
|
26
|
-
const value = event.target.value;
|
|
27
|
-
const isInteger = /^[0-9]*$/.test(value);
|
|
28
|
-
if (isInteger || value === "") {
|
|
29
|
-
setValue(value);
|
|
30
|
-
onChange && onChange(value, event);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
setValue(event.target.value);
|
|
35
|
-
onChange && onChange(event.target.value, event);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
const handleKeyDown = (event) => {
|
|
39
|
-
if (integer && type === "number") {
|
|
40
|
-
// Permitir solo números y teclas de control
|
|
41
|
-
const allowedKeys = [
|
|
42
|
-
"Backspace",
|
|
43
|
-
"ArrowLeft",
|
|
44
|
-
"ArrowRight",
|
|
45
|
-
"Delete",
|
|
46
|
-
"Enter",
|
|
47
|
-
"Tab",
|
|
48
|
-
];
|
|
49
|
-
if (!allowedKeys.includes(event.key) && !/^[0-9]$/.test(event.key)) {
|
|
50
|
-
event.preventDefault();
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
const inputComponent = (_jsx("input", { type: type, name: name, readOnly: readOnly, disabled: disabled, id: id ?? name, autoComplete: "given-name", value: value, onWheel: (e) => {
|
|
55
|
-
e.currentTarget.blur();
|
|
56
|
-
}, step: type === "number" ? 0.01 : undefined, onChange: handleInputChange, onKeyDown: (event) => {
|
|
57
|
-
handleKeyDown(event);
|
|
58
|
-
onKeyDown && onKeyDown(event);
|
|
59
|
-
}, min: min, style: style, className: `block w-full rounded-md ${bgColor} ${borderColor} ${textColor} shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm` }));
|
|
60
|
-
if (!error && !title) {
|
|
61
|
-
return _jsx("div", { className: `${className}`, children: inputComponent });
|
|
62
|
-
}
|
|
63
|
-
return (_jsxs("div", { className: `col-span-6 sm:col-span-3 ${className}`, children: [title && (_jsx("label", { htmlFor: error ? `${name}-error` : `${name}-success`, className: `block mb-1 text-sm font-medium text-${color}-700 dark:text-${color}-500`, children: title })), _jsxs("div", { className: "flex relative items-center", children: [inputComponent, 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 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 }))] }));
|
|
64
|
-
};
|
|
65
|
-
export const TextField = (props) => {
|
|
66
|
-
const { formValidations } = useAppSelector((state) => state.formValidation);
|
|
67
|
-
const error = formValidations[props.formName ?? "-1"]?.[props.name ?? "-1"];
|
|
68
|
-
props = { ...props, error };
|
|
69
|
-
return _jsx(TextFieldWithoutValidation, { ...props });
|
|
70
|
-
};
|
|
@@ -1,16 +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
|
-
tabIndex?: number;
|
|
11
|
-
error?: string;
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
};
|
|
14
|
-
export declare const FormTimePickerWithoutValidation: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
-
export declare const FormTimePicker: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { ClockIconSVG, CloseSvgIcon, IdeaIconSVG } from "@zauru-sdk/icons";
|
|
3
|
-
import { useAppSelector } from "@zauru-sdk/redux";
|
|
4
|
-
import { useEffect, useState } from "react";
|
|
5
|
-
export const FormTimePickerWithoutValidation = (props) => {
|
|
6
|
-
const { id, name, title, defaultValue = "", hint, helpText, onChange, tabIndex, error, disabled = 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}`, 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(ClockIconSVG, {}) }), _jsx("input", { id: id, name: name, tabIndex: tabIndex, type: "time", onChange: (e) => {
|
|
22
|
-
setValue(e.target.value);
|
|
23
|
-
onChange && onChange(e.target.value);
|
|
24
|
-
}, value: value, pattern: "\\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 && (_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 FormTimePicker = (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(FormTimePickerWithoutValidation, { ...props });
|
|
31
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
type Props = {
|
|
2
|
-
id?: string;
|
|
3
|
-
name: string;
|
|
4
|
-
formName?: string;
|
|
5
|
-
title?: string;
|
|
6
|
-
defaultValue?: boolean;
|
|
7
|
-
helpText?: string;
|
|
8
|
-
onChange?: (value: boolean) => void;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
};
|
|
11
|
-
export declare const YesNo: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export {};
|
package/dist/Form/YesNo/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useAppSelector } from "@zauru-sdk/redux";
|
|
3
|
-
import { useState } from "react";
|
|
4
|
-
export const YesNo = (props) => {
|
|
5
|
-
const { id, name, title, defaultValue = false, helpText, onChange, disabled, } = props;
|
|
6
|
-
const { formValidations } = useAppSelector((state) => state.formValidation);
|
|
7
|
-
const error = formValidations[props.formName ?? "-1"]?.[props.name ?? "-1"];
|
|
8
|
-
const [value, setValue] = useState(defaultValue);
|
|
9
|
-
const color = error ? "red" : "gray";
|
|
10
|
-
const handleOnChange = () => {
|
|
11
|
-
if (disabled)
|
|
12
|
-
return; // No hacer nada si está deshabilitado
|
|
13
|
-
const newValue = !value;
|
|
14
|
-
setValue(newValue);
|
|
15
|
-
onChange && onChange(newValue);
|
|
16
|
-
};
|
|
17
|
-
return (_jsxs(_Fragment, { children: [_jsxs("label", { className: `relative inline-flex items-center cursor-pointer ${disabled ? "opacity-50" : ""}`, children: [_jsx("input", { type: "checkbox", id: id ?? name, name: name, checked: value, value: value.toString(), className: "sr-only peer", onChange: handleOnChange, disabled: disabled }), value.toString() === "false" && (_jsx("input", { type: "hidden", name: name, value: "false" })), _jsx("div", { className: "w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-blue-600" }), _jsx("span", { className: "ml-3 text-sm font-medium text-gray-900", children: title })] }), 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 && helpText && (_jsx("p", { className: `mt-2 italic text-sm text-${color}-500 dark:text-${color}-400`, children: helpText }))] }));
|
|
18
|
-
};
|
package/dist/Form/index.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from "./Checkbox/index.js";
|
|
2
|
-
export * from "./Checklist/index.js";
|
|
3
|
-
export * from "./DatePicker/index.js";
|
|
4
|
-
export * from "./DynamicBaculoForm/index.js";
|
|
5
|
-
export * from "./FieldContainer/index.js";
|
|
6
|
-
export * from "./FileUpload/index.js";
|
|
7
|
-
export * from "./FormButtons/index.js";
|
|
8
|
-
export * from "./FormLayout/index.js";
|
|
9
|
-
export * from "./SelectField/index.js";
|
|
10
|
-
export * from "./TextArea/index.js";
|
|
11
|
-
export * from "./TextField/index.js";
|
|
12
|
-
export * from "./TimePicker/index.js";
|
|
13
|
-
export * from "./YesNo/index.js";
|
package/dist/Form/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export * from "./Checkbox/index.js";
|
|
2
|
-
export * from "./Checklist/index.js";
|
|
3
|
-
export * from "./DatePicker/index.js";
|
|
4
|
-
export * from "./DynamicBaculoForm/index.js";
|
|
5
|
-
export * from "./FieldContainer/index.js";
|
|
6
|
-
export * from "./FileUpload/index.js";
|
|
7
|
-
export * from "./FormButtons/index.js";
|
|
8
|
-
export * from "./FormLayout/index.js";
|
|
9
|
-
export * from "./SelectField/index.js";
|
|
10
|
-
export * from "./TextArea/index.js";
|
|
11
|
-
export * from "./TextField/index.js";
|
|
12
|
-
export * from "./TimePicker/index.js";
|
|
13
|
-
export * from "./YesNo/index.js";
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
export const InfoLabel = (props) => {
|
|
3
|
-
const { description, title, className } = props;
|
|
4
|
-
return (_jsxs("div", { className: `block ${className}`, children: [_jsx("label", { className: "inline text-sm font-medium text-gray-700", children: `${title.toUpperCase()} ` }), _jsx("label", { className: "inline text-sm font-medium text-gray-500", children: description })] }));
|
|
5
|
-
};
|
package/dist/Labels/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./InfoLabel/index.js";
|
package/dist/Labels/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./InfoLabel/index.js";
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
export const HomeLayout = ({ title, description }) => {
|
|
3
|
-
return (_jsx("div", { className: "bg-cover bg-center h-screen", style: { backgroundImage: 'url("/wallpaper.webp")' }, children: _jsxs("div", { className: "flex flex-col h-screen justify-center items-center", children: [_jsx("h1", { className: "text-6xl md:text-7xl lg:text-8xl text-white font-bold mb-6 text-center", style: {
|
|
4
|
-
textShadow: "0.5px 0.5px 1px #000000",
|
|
5
|
-
WebkitTextStroke: "2px #000000",
|
|
6
|
-
}, children: title ?? _jsx(_Fragment, { children: "Bienvenido, inicie sesi\u00F3n para continuar." }) }), _jsx("p", { className: "text-xl md:text-2xl lg:text-3xl text-white text-center max-w-md mb-12", style: {
|
|
7
|
-
textShadow: "0.5px 0.5px 1px #000000",
|
|
8
|
-
WebkitTextStroke: "1px #000000",
|
|
9
|
-
}, children: description ?? _jsx(_Fragment, { children: "Web app, realizada en Zauru." }) })] }) }));
|
|
10
|
-
};
|
package/dist/Layouts/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./homeLayout/index.js";
|
package/dist/Layouts/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./homeLayout/index.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const LineSeparator: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./LineSeparator.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./LineSeparator.js";
|
package/dist/Modal/Modal.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export type ModalOption = "OK" | "CANCEL" | null;
|
|
3
|
-
type ModalParams = {
|
|
4
|
-
title: string;
|
|
5
|
-
description: React.ReactNode;
|
|
6
|
-
okButtonText?: string;
|
|
7
|
-
showOptions?: boolean;
|
|
8
|
-
};
|
|
9
|
-
export declare const createModal: ({ title, description, okButtonText, showOptions, }: ModalParams) => Promise<ModalOption>;
|
|
10
|
-
export {};
|
package/dist/Modal/Modal.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { createRoot } from "react-dom/client";
|
|
3
|
-
export const createModal = ({ title, description, okButtonText, showOptions = true, }) => {
|
|
4
|
-
return new Promise((resolve) => {
|
|
5
|
-
const handleClose = () => {
|
|
6
|
-
resolve(null);
|
|
7
|
-
removeModal();
|
|
8
|
-
};
|
|
9
|
-
const handleOk = () => {
|
|
10
|
-
resolve("OK");
|
|
11
|
-
removeModal();
|
|
12
|
-
};
|
|
13
|
-
const handleCancel = () => {
|
|
14
|
-
resolve("CANCEL");
|
|
15
|
-
removeModal();
|
|
16
|
-
};
|
|
17
|
-
const removeModal = () => {
|
|
18
|
-
document.body.removeChild(modalWrapper);
|
|
19
|
-
document.body.removeChild(modalOverlay);
|
|
20
|
-
};
|
|
21
|
-
const modalWrapper = document.createElement("div");
|
|
22
|
-
modalWrapper.classList.add("justify-center", "items-center", "flex", "overflow-x-hidden", "overflow-y-auto", "fixed", "inset-0", "z-50", "outline-none", "focus:outline-none");
|
|
23
|
-
// Crear capa de fondo detrás del modal
|
|
24
|
-
const modalOverlay = document.createElement("div");
|
|
25
|
-
modalOverlay.classList.add("fixed", "inset-0", "bg-black", "opacity-50", "z-40");
|
|
26
|
-
document.body.appendChild(modalOverlay);
|
|
27
|
-
document.body.appendChild(modalWrapper);
|
|
28
|
-
const ModalContent = () => (_jsx("div", { className: "relative w-auto my-6 mx-auto max-w-3xl", children: _jsxs("div", { className: "border-0 rounded-lg shadow-lg relative flex flex-col w-full bg-white outline-none focus:outline-none", children: [_jsxs("div", { className: "flex items-start justify-between p-5 border-b border-solid border-slate-200 rounded-t", children: [_jsx("h3", { className: "text-3xl font-semibold", children: title }), _jsx("button", { className: "p-1 ml-auto bg-transparent border-0 text-black float-right text-3xl leading-none font-semibold outline-none focus:outline-none", children: _jsx("span", { className: "close-button", onClick: handleClose, children: "\u00D7" }) })] }), _jsx("div", { className: "relative p-6 flex-auto", children: description }), showOptions && (_jsxs("div", { className: "flex items-center justify-end p-6 border-t border-solid border-slate-200 rounded-b", children: [_jsx("button", { className: "cancel-button text-red-700 background-transparent font-bold uppercase px-6 py-2 text-sm outline-none focus:outline-none mr-1 mb-1 ease-linear transition-all duration-150", type: "button", onClick: handleCancel, children: "Cancelar" }), _jsx("button", { className: "ok-button bg-emerald-700 text-white active:bg-emerald-600 font-bold uppercase text-sm px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 ease-linear transition-all duration-150", type: "button", onClick: handleOk, children: okButtonText ?? "Aceptar" })] }))] }) }));
|
|
29
|
-
const root = createRoot(modalWrapper);
|
|
30
|
-
root.render(_jsx(ModalContent, {}));
|
|
31
|
-
});
|
|
32
|
-
};
|
package/dist/Modal/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Modal.js";
|
package/dist/Modal/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Modal.js";
|
package/dist/NavBar/NavBar.d.ts
DELETED
package/dist/NavBar/NavBar.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { DropDownArrowSvgIcon, LogoutDropDownSvgIcon, MenuAlt4Svg, OpcionButtonSvgIcon, } from "@zauru-sdk/icons";
|
|
4
|
-
import { COLORS } from "./NavBar.utils.js";
|
|
5
|
-
import { Link } from "@remix-run/react";
|
|
6
|
-
const DropDownLinkButton = ({ text, path, icon, buttonHover, }) => (_jsx(Link, { className: `block px-4 py-3 text-sm text-gray-600 capitalize transition-colors duration-200 transform dark:text-gray-300 ${buttonHover ?? ""} dark:hover:bg-gray-700 dark:hover:text-white`, to: path, prefetch: "none", children: _jsxs("div", { className: "mx-auto pt-2", children: [icon, _jsx("span", { children: text })] }) }));
|
|
7
|
-
const OptionsDropDownButton = ({ color, options, name }) => {
|
|
8
|
-
const [showOptionsMenu, setShowOptionsMenu] = useState(true);
|
|
9
|
-
return (_jsx("div", { className: "nav-item ml-auto", children: _jsx("div", { className: "flex justify-center", children: _jsxs("div", { className: "relative inline-block", children: [_jsxs("button", { onClick: () => setShowOptionsMenu(!showOptionsMenu), className: `relative flex items-center p-2 text-xs text-white ${color.bg700} active:${color.bg900} border border-transparent rounded-full uppercase focus:ring-opacity-40 focus:outline-none`, children: [name ?? _jsx(OpcionButtonSvgIcon, {}), _jsx(DropDownArrowSvgIcon, {})] }), _jsx("div", { className: "absolute right-0 z-20 w-56 py-2 mt-2 overflow-hidden bg-white rounded-md shadow-xl dark:bg-gray-800", hidden: showOptionsMenu, onMouseLeave: () => setShowOptionsMenu(true), children: options.map((option) => option) })] }) }) }));
|
|
10
|
-
};
|
|
11
|
-
const NavItem = ({ name, link, icon, color, specialColor, childrens = [], }) => (_jsx("li", { className: "nav-item", children: childrens.length > 0 ? (_jsx(OptionsDropDownButton, { name: name, color: color, options: childrens.map((x, index) => (_jsx(DropDownLinkButton, { text: x.name, path: x.link, buttonHover: "hover:bg-red-100" }, index))) })) : (_jsx("div", { className: `${specialColor ? specialColor.bg700 : color.bg700} container text-white w-56 sm:w-auto h-10 text-sm py-1 uppercase rounded shadow hover:shadow-lg outline-none rounded-full focus:outline-none my-auto sm:my-0 sm:mr-1 mb-1 ease-linear transition-all duration-150 `, children: _jsx(Link, { className: "px-3 flex items-center text-xs leading-snug text-white uppercase hover:opacity-75", to: link, prefetch: "none", children: _jsxs("div", { className: "mx-auto pt-2", children: [icon, _jsx("span", { children: name })] }) }) })) }));
|
|
12
|
-
export const NavBar = ({ title, loggedIn, items, selectedColor, }) => {
|
|
13
|
-
const color = COLORS[selectedColor];
|
|
14
|
-
const [NavBarOpen, setNavBarOpen] = useState(false);
|
|
15
|
-
const options = (_jsxs(_Fragment, { children: [_jsx("ul", { children: loggedIn && (_jsx("div", { className: "flex flex-col sm:flex-row ", children: items
|
|
16
|
-
.filter((item) => item.loggedIn)
|
|
17
|
-
.map((item, index) => {
|
|
18
|
-
const specialColor = item.color
|
|
19
|
-
? COLORS[item.color]
|
|
20
|
-
: undefined;
|
|
21
|
-
return (_jsx(NavItem, { name: item.name, link: item.link, icon: item.icon, specialColor: specialColor, color: color, childrens: item.childrens?.map((x) => {
|
|
22
|
-
return { ...x };
|
|
23
|
-
}) }, index));
|
|
24
|
-
}) })) }), _jsx("ul", { className: "sm:flex sm:flex-col ml-auto lg:flex-row", children: loggedIn ? (_jsx(OptionsDropDownButton, { color: color, options: [
|
|
25
|
-
_jsx(DropDownLinkButton, { text: "Cerrar Sesi\u00F3n", path: "/logout", icon: _jsx(LogoutDropDownSvgIcon, {}), buttonHover: "hover:bg-red-100" }, 0),
|
|
26
|
-
] })) : (items
|
|
27
|
-
.filter((item) => !item.loggedIn)
|
|
28
|
-
.map((item, index) => {
|
|
29
|
-
return (_jsx(NavItem, { name: item.name, link: item.link, icon: item.icon, color: color }, index));
|
|
30
|
-
})) })] }));
|
|
31
|
-
return (_jsx("nav", { className: `py-3 ${color.bg600}`, children: _jsxs("div", { className: "flex items-center justify-between ml-5 mr-5", children: [_jsxs("div", { className: "flex justify-between w-full lg:w-auto", children: [_jsx(Link, { className: "text-sm font-bold leading-relaxed inline-block mr-4 py-2 whitespace-nowrap uppercase text-white", to: "/home", prefetch: "none", children: _jsxs(_Fragment, { children: [_jsx("div", { className: "inline-block mr-2 mb-2 align-middle", children: _jsx("img", { className: "w-auto h-7", src: "/logo.png", alt: "logo-zauru" }) }), title] }) }), _jsx("button", { className: `rounded lg:hidden focus:outline-none focus:ring focus:${color.ring600} focus:ring-opacity-50`, "aria-label": "Toggle mobile menu", type: "button", onClick: () => setNavBarOpen(!NavBarOpen), children: _jsx(MenuAlt4Svg, { open: NavBarOpen }) })] }), _jsx("div", { className: `lg:hidden absolute top-0 left-0 z-50 w-64 h-full ${color.bg700} shadow-lg transform ${NavBarOpen ? "translate-x-0" : "-translate-x-full"} transition-transform duration-300 ease-in-out`, children: options }), _jsx("div", { className: "hidden lg:flex w-full lg:w-auto", children: options })] }) }));
|
|
32
|
-
};
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
export type NavBarItemsSchema = {
|
|
2
|
-
name: string;
|
|
3
|
-
link: string;
|
|
4
|
-
loggedIn: boolean;
|
|
5
|
-
icon?: any;
|
|
6
|
-
color?: "green";
|
|
7
|
-
childrens?: Exclude<NavBarItemsSchema, "loggedIn">[];
|
|
8
|
-
};
|
|
9
|
-
export type NavBarProps = {
|
|
10
|
-
title: string;
|
|
11
|
-
loggedIn: boolean;
|
|
12
|
-
items: Array<NavBarItemsSchema>;
|
|
13
|
-
selectedColor: "pink" | "purple" | "slate" | "green" | "yellow" | "red" | "sky";
|
|
14
|
-
LinkComponent?: any;
|
|
15
|
-
};
|
|
16
|
-
export type NavBarStateProps = {
|
|
17
|
-
NavBarOpen: boolean;
|
|
18
|
-
setNavBarOpen?: any;
|
|
19
|
-
};
|
|
20
|
-
export type ColorInterface = {
|
|
21
|
-
bg900: string;
|
|
22
|
-
bg700: string;
|
|
23
|
-
bg600: string;
|
|
24
|
-
bg500: string;
|
|
25
|
-
ring600: string;
|
|
26
|
-
ring500: string;
|
|
27
|
-
};
|
|
28
|
-
export type NavItemProps = {
|
|
29
|
-
name: string;
|
|
30
|
-
link: string;
|
|
31
|
-
icon?: any;
|
|
32
|
-
color: ColorInterface;
|
|
33
|
-
specialColor?: ColorInterface;
|
|
34
|
-
childrens?: Exclude<NavItemProps, "index" | "color">[];
|
|
35
|
-
};
|
|
36
|
-
export type EntityNameType = {
|
|
37
|
-
entityName: string;
|
|
38
|
-
};
|
|
39
|
-
export type EntityProps = {
|
|
40
|
-
name?: string;
|
|
41
|
-
color: ColorInterface;
|
|
42
|
-
options: any[];
|
|
43
|
-
};
|
|
44
|
-
export type DropDownLinkButtonType = {
|
|
45
|
-
text: string;
|
|
46
|
-
path: string;
|
|
47
|
-
icon?: any;
|
|
48
|
-
buttonHover?: string;
|
|
49
|
-
LinkComponent?: any;
|
|
50
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
export declare const COLORS: {
|
|
2
|
-
sky: {
|
|
3
|
-
bg900: string;
|
|
4
|
-
bg700: string;
|
|
5
|
-
bg600: string;
|
|
6
|
-
bg500: string;
|
|
7
|
-
ring600: string;
|
|
8
|
-
ring500: string;
|
|
9
|
-
};
|
|
10
|
-
purple: {
|
|
11
|
-
bg900: string;
|
|
12
|
-
bg700: string;
|
|
13
|
-
bg600: string;
|
|
14
|
-
bg500: string;
|
|
15
|
-
ring600: string;
|
|
16
|
-
ring500: string;
|
|
17
|
-
};
|
|
18
|
-
pink: {
|
|
19
|
-
bg900: string;
|
|
20
|
-
bg700: string;
|
|
21
|
-
bg600: string;
|
|
22
|
-
bg500: string;
|
|
23
|
-
ring600: string;
|
|
24
|
-
ring500: string;
|
|
25
|
-
};
|
|
26
|
-
slate: {
|
|
27
|
-
bg900: string;
|
|
28
|
-
bg700: string;
|
|
29
|
-
bg600: string;
|
|
30
|
-
bg500: string;
|
|
31
|
-
ring600: string;
|
|
32
|
-
ring500: string;
|
|
33
|
-
};
|
|
34
|
-
green: {
|
|
35
|
-
bg900: string;
|
|
36
|
-
bg700: string;
|
|
37
|
-
bg600: string;
|
|
38
|
-
bg500: string;
|
|
39
|
-
ring600: string;
|
|
40
|
-
ring500: string;
|
|
41
|
-
};
|
|
42
|
-
yellow: {
|
|
43
|
-
bg900: string;
|
|
44
|
-
bg700: string;
|
|
45
|
-
bg600: string;
|
|
46
|
-
bg500: string;
|
|
47
|
-
ring600: string;
|
|
48
|
-
ring500: string;
|
|
49
|
-
};
|
|
50
|
-
red: {
|
|
51
|
-
bg900: string;
|
|
52
|
-
bg700: string;
|
|
53
|
-
bg600: string;
|
|
54
|
-
bg500: string;
|
|
55
|
-
ring600: string;
|
|
56
|
-
ring500: string;
|
|
57
|
-
};
|
|
58
|
-
};
|