@zauru-sdk/components 1.0.11
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/.eslintrc.cjs +83 -0
- package/CHANGELOG.md +8 -0
- package/LICENCE.md +11 -0
- package/dist/Alerts/Alert.d.ts +9 -0
- package/dist/Alerts/Alert.js +97 -0
- package/dist/Alerts/ErrorBoundaryAlert/ErrorBoundaryAlert.d.ts +6 -0
- package/dist/Alerts/ErrorBoundaryAlert/ErrorBoundaryAlert.js +5 -0
- package/dist/Alerts/StaticAlert.d.ts +11 -0
- package/dist/Alerts/StaticAlert.js +28 -0
- package/dist/Icons/Icons.d.ts +47 -0
- package/dist/Icons/Icons.js +110 -0
- package/dist/Icons/StylesConstants.d.ts +26 -0
- package/dist/Icons/StylesConstants.js +34 -0
- package/dist/NavBar/NavBar.d.ts +2 -0
- package/dist/NavBar/NavBar.js +32 -0
- package/dist/NavBar/NavBar.types.d.ts +50 -0
- package/dist/NavBar/NavBar.types.js +1 -0
- package/dist/NavBar/NavBar.utils.d.ts +58 -0
- package/dist/NavBar/NavBar.utils.js +58 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.js +1 -0
- package/package.json +49 -0
- package/src/Alerts/Alert.tsx +149 -0
- package/src/Alerts/ErrorBoundaryAlert/ErrorBoundaryAlert.tsx +66 -0
- package/src/Alerts/StaticAlert.tsx +121 -0
- package/src/Icons/Icons.tsx +782 -0
- package/src/Icons/StylesConstants.tsx +66 -0
- package/src/NavBar/NavBar.tsx +223 -0
- package/src/NavBar/NavBar.types.ts +64 -0
- package/src/NavBar/NavBar.utils.ts +58 -0
- package/src/index.ts +0 -0
- package/tsconfig.json +26 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// ============================| Background colors |============================
|
|
2
|
+
|
|
3
|
+
export const styleGreenBackground = "bg-green-600";
|
|
4
|
+
|
|
5
|
+
export const styleActiveGreenBackground = "active:bg-green-800";
|
|
6
|
+
|
|
7
|
+
export const styleRedBackground = "bg-red-600";
|
|
8
|
+
|
|
9
|
+
export const styleActiveRedBackground = "active:bg-red-800";
|
|
10
|
+
|
|
11
|
+
export const styleInactiveButtonBackground = "bg-zinc-300";
|
|
12
|
+
|
|
13
|
+
export const styleActiveInactiveButtonBackground = "active:bg-zinc-200";
|
|
14
|
+
|
|
15
|
+
export const styleStandardBackgroundColor = "bg-slate-900";
|
|
16
|
+
|
|
17
|
+
export const styleStandardActiveBackgroundColor = "active:bg-slate-800";
|
|
18
|
+
|
|
19
|
+
// ==============================| Icons Colors |=================================
|
|
20
|
+
|
|
21
|
+
export const buttonIconTableColor = "text-slate-700";
|
|
22
|
+
|
|
23
|
+
export const greenColorIcon = "text-emerald-600";
|
|
24
|
+
|
|
25
|
+
export const redColorIcon = "text-red-600";
|
|
26
|
+
|
|
27
|
+
export const applicationDropDownIconColor = "text-slate-900";
|
|
28
|
+
|
|
29
|
+
export const inputIconColor = "text-zinc-400";
|
|
30
|
+
|
|
31
|
+
// ==============================| Table Utils Colors |============================
|
|
32
|
+
|
|
33
|
+
// CSS Color Nams, RGB, Hexadecimal
|
|
34
|
+
export const lastRowSelectedBackground = "lightgreen";
|
|
35
|
+
|
|
36
|
+
// ==============================| Dropdown Hover |=================================
|
|
37
|
+
|
|
38
|
+
export const greenDropdownHover = "hover:bg-red-100";
|
|
39
|
+
|
|
40
|
+
export const redDropdownHover = "hover:bg-green-100";
|
|
41
|
+
|
|
42
|
+
export const standardDropdownHover = "hover:bg-gray-100";
|
|
43
|
+
|
|
44
|
+
// ===============================| Border Colors | =================================
|
|
45
|
+
|
|
46
|
+
export const standarBorderColor = "border-slate-500";
|
|
47
|
+
|
|
48
|
+
export const alertBorderColor = "border-red-500";
|
|
49
|
+
|
|
50
|
+
// ===============================| Section Background Color | =================================
|
|
51
|
+
|
|
52
|
+
export const sectionNormalBackgroundColor = "bg-neutral-100";
|
|
53
|
+
|
|
54
|
+
export const inProgressProcessAlertBackgroundColor = "bg-yellow-900";
|
|
55
|
+
|
|
56
|
+
// ===============================| Progress Bar Styles | =================================
|
|
57
|
+
|
|
58
|
+
export const progressBarLightBackground = "bg-slate-200";
|
|
59
|
+
|
|
60
|
+
export const progressBarBackground = "bg-slate-600";
|
|
61
|
+
|
|
62
|
+
export const progressBarTextColor = "text-slate-800";
|
|
63
|
+
|
|
64
|
+
export const progressBarLightTextColor = "text-slate-300";
|
|
65
|
+
|
|
66
|
+
export const progressBarSpinnerFillColor = "fill-slate-800";
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import {
|
|
3
|
+
DropDownArrowSvgIcon,
|
|
4
|
+
LogoutDropDownSvgIcon,
|
|
5
|
+
MenuAlt4Svg,
|
|
6
|
+
OpcionButtonSvgIcon,
|
|
7
|
+
} from "../Icons/Icons";
|
|
8
|
+
import { COLORS } from "./NavBar.utils";
|
|
9
|
+
import type {
|
|
10
|
+
ColorInterface,
|
|
11
|
+
DropDownLinkButtonType,
|
|
12
|
+
EntityProps,
|
|
13
|
+
NavBarProps,
|
|
14
|
+
NavItemProps,
|
|
15
|
+
} from "./NavBar.types";
|
|
16
|
+
import { Link } from "@remix-run/react";
|
|
17
|
+
|
|
18
|
+
const DropDownLinkButton = ({
|
|
19
|
+
text,
|
|
20
|
+
path,
|
|
21
|
+
icon,
|
|
22
|
+
buttonHover,
|
|
23
|
+
}: DropDownLinkButtonType) => (
|
|
24
|
+
<Link
|
|
25
|
+
className={`block px-4 py-3 text-sm text-gray-600 capitalize transition-colors duration-200 transform dark:text-gray-300 ${
|
|
26
|
+
buttonHover ?? ""
|
|
27
|
+
} dark:hover:bg-gray-700 dark:hover:text-white`}
|
|
28
|
+
to={path}
|
|
29
|
+
prefetch="none"
|
|
30
|
+
>
|
|
31
|
+
<div className="mx-auto pt-2">
|
|
32
|
+
{icon}
|
|
33
|
+
<span>{text}</span>
|
|
34
|
+
</div>
|
|
35
|
+
</Link>
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
const OptionsDropDownButton = ({ color, options, name }: EntityProps) => {
|
|
39
|
+
const [showOptionsMenu, setShowOptionsMenu] = useState(true);
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<div className="nav-item ml-auto">
|
|
43
|
+
<div className="flex justify-center">
|
|
44
|
+
<div className="relative inline-block">
|
|
45
|
+
<button
|
|
46
|
+
onClick={() => setShowOptionsMenu(!showOptionsMenu)}
|
|
47
|
+
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`}
|
|
48
|
+
>
|
|
49
|
+
{name ?? <OpcionButtonSvgIcon />}
|
|
50
|
+
<DropDownArrowSvgIcon />
|
|
51
|
+
</button>
|
|
52
|
+
<div
|
|
53
|
+
className="absolute right-0 z-20 w-56 py-2 mt-2 overflow-hidden bg-white rounded-md shadow-xl dark:bg-gray-800"
|
|
54
|
+
hidden={showOptionsMenu}
|
|
55
|
+
onMouseLeave={() => setShowOptionsMenu(true)}
|
|
56
|
+
>
|
|
57
|
+
{options.map((option) => option)}
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const NavItem = ({
|
|
66
|
+
name,
|
|
67
|
+
link,
|
|
68
|
+
icon,
|
|
69
|
+
color,
|
|
70
|
+
specialColor,
|
|
71
|
+
childrens = [],
|
|
72
|
+
}: NavItemProps) => (
|
|
73
|
+
<li className="nav-item">
|
|
74
|
+
{childrens.length > 0 ? (
|
|
75
|
+
<OptionsDropDownButton
|
|
76
|
+
name={name}
|
|
77
|
+
color={color}
|
|
78
|
+
options={childrens.map((x, index) => (
|
|
79
|
+
<DropDownLinkButton
|
|
80
|
+
key={index}
|
|
81
|
+
text={x.name}
|
|
82
|
+
path={x.link}
|
|
83
|
+
buttonHover="hover:bg-red-100"
|
|
84
|
+
/>
|
|
85
|
+
))}
|
|
86
|
+
/>
|
|
87
|
+
) : (
|
|
88
|
+
<div
|
|
89
|
+
className={`${
|
|
90
|
+
specialColor ? specialColor.bg700 : color.bg700
|
|
91
|
+
} 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 `}
|
|
92
|
+
>
|
|
93
|
+
<Link
|
|
94
|
+
className="px-3 flex items-center text-xs leading-snug text-white uppercase hover:opacity-75"
|
|
95
|
+
to={link}
|
|
96
|
+
prefetch="none"
|
|
97
|
+
>
|
|
98
|
+
<div className="mx-auto pt-2">
|
|
99
|
+
{icon}
|
|
100
|
+
<span>{name}</span>
|
|
101
|
+
</div>
|
|
102
|
+
</Link>
|
|
103
|
+
</div>
|
|
104
|
+
)}
|
|
105
|
+
</li>
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
export const NavBar = ({
|
|
109
|
+
title,
|
|
110
|
+
loggedIn,
|
|
111
|
+
items,
|
|
112
|
+
selectedColor,
|
|
113
|
+
}: NavBarProps) => {
|
|
114
|
+
const color: ColorInterface = COLORS[selectedColor];
|
|
115
|
+
const [NavBarOpen, setNavBarOpen] = useState(false);
|
|
116
|
+
|
|
117
|
+
const options = (
|
|
118
|
+
<>
|
|
119
|
+
<ul>
|
|
120
|
+
{loggedIn && (
|
|
121
|
+
<div className="flex flex-col sm:flex-row ">
|
|
122
|
+
{items
|
|
123
|
+
.filter((item) => item.loggedIn)
|
|
124
|
+
.map((item, index) => {
|
|
125
|
+
const specialColor: ColorInterface | undefined = item.color
|
|
126
|
+
? COLORS[item.color]
|
|
127
|
+
: undefined;
|
|
128
|
+
return (
|
|
129
|
+
<NavItem
|
|
130
|
+
key={index}
|
|
131
|
+
name={item.name}
|
|
132
|
+
link={item.link}
|
|
133
|
+
icon={item.icon}
|
|
134
|
+
specialColor={specialColor}
|
|
135
|
+
color={color}
|
|
136
|
+
childrens={item.childrens?.map((x) => {
|
|
137
|
+
return { ...x } as any;
|
|
138
|
+
})}
|
|
139
|
+
/>
|
|
140
|
+
);
|
|
141
|
+
})}
|
|
142
|
+
</div>
|
|
143
|
+
)}
|
|
144
|
+
</ul>
|
|
145
|
+
<ul className="sm:flex sm:flex-col ml-auto lg:flex-row">
|
|
146
|
+
{loggedIn ? (
|
|
147
|
+
<OptionsDropDownButton
|
|
148
|
+
color={color}
|
|
149
|
+
options={[
|
|
150
|
+
<DropDownLinkButton
|
|
151
|
+
key={0}
|
|
152
|
+
text="Cerrar Sesión"
|
|
153
|
+
path="/logout"
|
|
154
|
+
icon={<LogoutDropDownSvgIcon />}
|
|
155
|
+
buttonHover="hover:bg-red-100"
|
|
156
|
+
/>,
|
|
157
|
+
]}
|
|
158
|
+
/>
|
|
159
|
+
) : (
|
|
160
|
+
items
|
|
161
|
+
.filter((item) => !item.loggedIn)
|
|
162
|
+
.map((item, index) => {
|
|
163
|
+
return (
|
|
164
|
+
<NavItem
|
|
165
|
+
key={index}
|
|
166
|
+
name={item.name}
|
|
167
|
+
link={item.link}
|
|
168
|
+
icon={item.icon}
|
|
169
|
+
color={color}
|
|
170
|
+
/>
|
|
171
|
+
);
|
|
172
|
+
})
|
|
173
|
+
)}
|
|
174
|
+
</ul>
|
|
175
|
+
</>
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
return (
|
|
179
|
+
<nav className={`py-3 ${color.bg600}`}>
|
|
180
|
+
<div className="flex items-center justify-between ml-5 mr-5">
|
|
181
|
+
<div className="flex justify-between w-full lg:w-auto">
|
|
182
|
+
<Link
|
|
183
|
+
className="text-sm font-bold leading-relaxed inline-block mr-4 py-2 whitespace-nowrap uppercase text-white"
|
|
184
|
+
to={"/home"}
|
|
185
|
+
prefetch="none"
|
|
186
|
+
children={
|
|
187
|
+
<>
|
|
188
|
+
<div className="inline-block mr-2 mb-2 align-middle">
|
|
189
|
+
<img
|
|
190
|
+
className="w-auto h-7"
|
|
191
|
+
src="/logo.png"
|
|
192
|
+
alt="logo-zauru"
|
|
193
|
+
/>
|
|
194
|
+
</div>
|
|
195
|
+
{title}
|
|
196
|
+
</>
|
|
197
|
+
}
|
|
198
|
+
/>
|
|
199
|
+
<button
|
|
200
|
+
className={`rounded lg:hidden focus:outline-none focus:ring focus:${color.ring600} focus:ring-opacity-50`}
|
|
201
|
+
aria-label="Toggle mobile menu"
|
|
202
|
+
type="button"
|
|
203
|
+
onClick={() => setNavBarOpen(!NavBarOpen)}
|
|
204
|
+
>
|
|
205
|
+
<MenuAlt4Svg NavBarOpen={NavBarOpen} setNavBarOpen={undefined} />
|
|
206
|
+
</button>
|
|
207
|
+
</div>
|
|
208
|
+
{/* Menú para dispositivos móviles */}
|
|
209
|
+
<div
|
|
210
|
+
className={`lg:hidden absolute top-0 left-0 z-50 w-64 h-full ${
|
|
211
|
+
color.bg700
|
|
212
|
+
} shadow-lg transform ${
|
|
213
|
+
NavBarOpen ? "translate-x-0" : "-translate-x-full"
|
|
214
|
+
} transition-transform duration-300 ease-in-out`}
|
|
215
|
+
>
|
|
216
|
+
{options}
|
|
217
|
+
</div>
|
|
218
|
+
{/* Menú para escritorio */}
|
|
219
|
+
<div className="hidden lg:flex w-full lg:w-auto">{options}</div>
|
|
220
|
+
</div>
|
|
221
|
+
</nav>
|
|
222
|
+
);
|
|
223
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
|
|
10
|
+
export type NavBarProps = {
|
|
11
|
+
title: string;
|
|
12
|
+
loggedIn: boolean;
|
|
13
|
+
items: Array<NavBarItemsSchema>;
|
|
14
|
+
selectedColor:
|
|
15
|
+
| "pink"
|
|
16
|
+
| "purple"
|
|
17
|
+
| "slate"
|
|
18
|
+
| "green"
|
|
19
|
+
| "yellow"
|
|
20
|
+
| "red"
|
|
21
|
+
| "sky";
|
|
22
|
+
LinkComponent?: any;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type NavBarStateProps = {
|
|
26
|
+
NavBarOpen: boolean;
|
|
27
|
+
setNavBarOpen?: any;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type ColorInterface = {
|
|
31
|
+
bg900: string;
|
|
32
|
+
bg700: string;
|
|
33
|
+
bg600: string;
|
|
34
|
+
bg500: string;
|
|
35
|
+
ring600: string;
|
|
36
|
+
ring500: string;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type NavItemProps = {
|
|
40
|
+
name: string;
|
|
41
|
+
link: string;
|
|
42
|
+
icon?: any;
|
|
43
|
+
color: ColorInterface;
|
|
44
|
+
specialColor?: ColorInterface;
|
|
45
|
+
childrens?: Exclude<NavItemProps, "index" | "color">[];
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type EntityNameType = {
|
|
49
|
+
entityName: string;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type EntityProps = {
|
|
53
|
+
name?: string;
|
|
54
|
+
color: ColorInterface;
|
|
55
|
+
options: any[];
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export type DropDownLinkButtonType = {
|
|
59
|
+
text: string;
|
|
60
|
+
path: string;
|
|
61
|
+
icon?: any;
|
|
62
|
+
buttonHover?: string;
|
|
63
|
+
LinkComponent?: any;
|
|
64
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export const COLORS = {
|
|
2
|
+
sky: {
|
|
3
|
+
bg900: "bg-sky-900",
|
|
4
|
+
bg700: "bg-sky-700",
|
|
5
|
+
bg600: "bg-sky-600",
|
|
6
|
+
bg500: "bg-sky-500",
|
|
7
|
+
ring600: "ring-sky-600",
|
|
8
|
+
ring500: "ring-sky-500",
|
|
9
|
+
},
|
|
10
|
+
purple: {
|
|
11
|
+
bg900: "bg-purple-900",
|
|
12
|
+
bg700: "bg-purple-700",
|
|
13
|
+
bg600: "bg-purple-600",
|
|
14
|
+
bg500: "bg-purple-500",
|
|
15
|
+
ring600: "ring-purple-600",
|
|
16
|
+
ring500: "ring-purple-500",
|
|
17
|
+
},
|
|
18
|
+
pink: {
|
|
19
|
+
bg900: "bg-pink-900",
|
|
20
|
+
bg700: "bg-pink-700",
|
|
21
|
+
bg600: "bg-pink-600",
|
|
22
|
+
bg500: "bg-pink-500",
|
|
23
|
+
ring600: "ring-pink-600",
|
|
24
|
+
ring500: "ring-pink-500",
|
|
25
|
+
},
|
|
26
|
+
slate: {
|
|
27
|
+
bg900: "bg-slate-900",
|
|
28
|
+
bg700: "bg-slate-700",
|
|
29
|
+
bg600: "bg-slate-600",
|
|
30
|
+
bg500: "bg-slate-500",
|
|
31
|
+
ring600: "ring-slate-600",
|
|
32
|
+
ring500: "ring-slate-500",
|
|
33
|
+
},
|
|
34
|
+
green: {
|
|
35
|
+
bg900: "bg-green-900",
|
|
36
|
+
bg700: "bg-green-700",
|
|
37
|
+
bg600: "bg-green-600",
|
|
38
|
+
bg500: "bg-green-500",
|
|
39
|
+
ring600: "ring-green-600",
|
|
40
|
+
ring500: "ring-green-500",
|
|
41
|
+
},
|
|
42
|
+
yellow: {
|
|
43
|
+
bg900: "bg-yellow-900",
|
|
44
|
+
bg700: "bg-yellow-700",
|
|
45
|
+
bg600: "bg-yellow-600",
|
|
46
|
+
bg500: "bg-yellow-500",
|
|
47
|
+
ring600: "ring-yellow-600",
|
|
48
|
+
ring500: "ring-yellow-500",
|
|
49
|
+
},
|
|
50
|
+
red: {
|
|
51
|
+
bg900: "bg-red-900",
|
|
52
|
+
bg700: "bg-red-700",
|
|
53
|
+
bg600: "bg-red-600",
|
|
54
|
+
bg500: "bg-red-500",
|
|
55
|
+
ring600: "ring-red-600",
|
|
56
|
+
ring500: "ring-red-500",
|
|
57
|
+
},
|
|
58
|
+
};
|
package/src/index.ts
ADDED
|
File without changes
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": ["env.d.ts", "**/*.ts", "**/*.tsx"],
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"allowSyntheticDefaultImports": true,
|
|
5
|
+
"lib": ["DOM", "DOM.Iterable", "ES2022"],
|
|
6
|
+
"isolatedModules": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"jsx": "react-jsx",
|
|
9
|
+
"module": "ESNext",
|
|
10
|
+
"moduleResolution": "Bundler",
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"target": "ES2022",
|
|
13
|
+
"strict": true,
|
|
14
|
+
"allowJs": true,
|
|
15
|
+
"skipLibCheck": true,
|
|
16
|
+
"forceConsistentCasingInFileNames": true,
|
|
17
|
+
"baseUrl": ".",
|
|
18
|
+
"outDir": "./dist",
|
|
19
|
+
"rootDir": "./src",
|
|
20
|
+
"declaration": true,
|
|
21
|
+
"declarationDir": "./dist",
|
|
22
|
+
"paths": {
|
|
23
|
+
"~/*": ["./app/*"]
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|