@zauru-sdk/components 2.0.219 → 2.0.221

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 CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.0.221](https://github.com/intuitiva/zauru-typescript-sdk/compare/v2.0.220...v2.0.221) (2025-06-02)
7
+
8
+ **Note:** Version bump only for package @zauru-sdk/components
9
+
10
+
11
+
12
+
13
+
14
+ ## [2.0.220](https://github.com/intuitiva/zauru-typescript-sdk/compare/v2.0.219...v2.0.220) (2025-05-30)
15
+
16
+ **Note:** Version bump only for package @zauru-sdk/components
17
+
18
+
19
+
20
+
21
+
6
22
  ## [2.0.219](https://github.com/intuitiva/zauru-typescript-sdk/compare/v2.0.218...v2.0.219) (2025-05-07)
7
23
 
8
24
  **Note:** Version bump only for package @zauru-sdk/components
@@ -7,6 +7,7 @@ export type NavBarItem = {
7
7
  color?: ColorInterface;
8
8
  childrens?: Exclude<NavBarItem, "loggedIn">[];
9
9
  reduxNotificationBadge?: (state: any) => string | number;
10
+ hide?: boolean;
10
11
  };
11
12
  export type NavBarProps = {
12
13
  title: string;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import React, { useState, useEffect } from "react";
2
+ import React, { useState, useEffect, useMemo } from "react";
3
3
  import { DropDownArrowSvgIcon, LogoutDropDownSvgIcon, MenuAlt4Svg, OpcionButtonSvgIcon, } from "@zauru-sdk/icons";
4
4
  import { COLORS } from "./NavBar.utils.js";
5
5
  import { Link, useNavigate, useLocation } from "@remix-run/react";
@@ -48,8 +48,13 @@ export const NavBar = ({ title, loggedIn, items, selectedColor, version, }) => {
48
48
  return { ...x };
49
49
  }) }, index));
50
50
  }) }));
51
- const options = (_jsxs(_Fragment, { children: [_jsx("ul", { className: "w-full lg:flex lg:items-center", children: renderNavItems(items.filter((item) => item.loggedIn === loggedIn)) }), _jsx("ul", { className: "sm:flex sm:flex-col lg:flex-row ml-auto", children: loggedIn && (_jsx(OptionsDropDownButton, { color: color, options: [
52
- _jsx(Link, { className: `block px-4 py-3 text-sm text-gray-600 capitalize transition-colors duration-200 transform dark:text-gray-300 hover:bg-red-100 dark:hover:bg-gray-700 dark:hover:text-white`, to: "/logout", children: _jsxs("div", { className: "mx-auto pt-2", children: [_jsx(LogoutDropDownSvgIcon, {}), _jsx("span", { children: "Cerrar sesi\u00F3n" })] }) }, "cerrar-sesion"),
53
- ] })) })] }));
51
+ const hiddenItemsChange = useMemo(() => items.filter((item) => item.hide === true), [items]);
52
+ const options = useMemo(() => {
53
+ return (_jsxs(_Fragment, { children: [_jsx("ul", { className: "w-full lg:flex lg:items-center", children: renderNavItems(items
54
+ .filter((item) => item.loggedIn === loggedIn)
55
+ .filter((item) => item.hide !== true)) }), _jsx("ul", { className: "sm:flex sm:flex-col lg:flex-row ml-auto", children: loggedIn && (_jsx(OptionsDropDownButton, { color: color, options: [
56
+ _jsx(Link, { className: `block px-4 py-3 text-sm text-gray-600 capitalize transition-colors duration-200 transform dark:text-gray-300 hover:bg-red-100 dark:hover:bg-gray-700 dark:hover:text-white`, to: "/logout", children: _jsxs("div", { className: "mx-auto pt-2", children: [_jsx(LogoutDropDownSvgIcon, {}), _jsx("span", { children: "Cerrar sesi\u00F3n" })] }) }, "cerrar-sesion"),
57
+ ] })) })] }));
58
+ }, [items, loggedIn, hiddenItemsChange]);
54
59
  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 items-center w-full lg:w-auto", children: [_jsxs(Link, { className: "text-sm font-bold leading-relaxed inline-block mr-4 py-2 whitespace-nowrap uppercase text-white", to: "/home", 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] }), version !== currentVersion && (_jsx("button", { className: `ml-2 px-2 py-1 text-xs text-white ${color.bg700} rounded-full hover:${color.bg900} transition-colors duration-200`, onClick: refreshPage, children: "\uD83D\uDD04 Actualizar versi\u00F3n" })), _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 fixed top-0 left-0 z-50 w-64 h-full ${color.bg700} dark:bg-gray-900 shadow-lg transform ${NavBarOpen ? "translate-x-0" : "-translate-x-full"} transition-transform duration-300 ease-in-out overflow-y-auto`, children: _jsx("div", { className: "p-4", children: options }) }), _jsx("div", { className: "hidden lg:flex lg:items-center w-full lg:w-auto", children: options })] }) }));
55
60
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/components",
3
- "version": "2.0.219",
3
+ "version": "2.0.221",
4
4
  "description": "Componentes reutilizables en las WebApps de Zauru.",
5
5
  "main": "./dist/esm/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -35,11 +35,11 @@
35
35
  "@rails/activestorage": "^8.0.200",
36
36
  "@reduxjs/toolkit": "^2.2.1",
37
37
  "@remix-run/react": "^2.8.1",
38
- "@zauru-sdk/common": "^2.0.218",
39
- "@zauru-sdk/hooks": "^2.0.218",
38
+ "@zauru-sdk/common": "^2.0.221",
39
+ "@zauru-sdk/hooks": "^2.0.221",
40
40
  "@zauru-sdk/icons": "^2.0.188",
41
- "@zauru-sdk/types": "^2.0.218",
42
- "@zauru-sdk/utils": "^2.0.219",
41
+ "@zauru-sdk/types": "^2.0.221",
42
+ "@zauru-sdk/utils": "^2.0.221",
43
43
  "browser-image-compression": "^2.0.2",
44
44
  "framer-motion": "^11.7.0",
45
45
  "jsonwebtoken": "^9.0.2",
@@ -52,5 +52,5 @@
52
52
  "styled-components": "^5.3.5",
53
53
  "zod": "^3.23.8"
54
54
  },
55
- "gitHead": "c17d4fe2185c5db7a4da797db6fe57b67cce3b29"
55
+ "gitHead": "42b1656295669218c46e5082d76d608acc7231e3"
56
56
  }
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect } from "react";
1
+ import React, { useState, useEffect, useMemo } from "react";
2
2
  import {
3
3
  DropDownArrowSvgIcon,
4
4
  LogoutDropDownSvgIcon,
@@ -165,33 +165,44 @@ export const NavBar = ({
165
165
  </div>
166
166
  );
167
167
 
168
- const options = (
169
- <>
170
- <ul className="w-full lg:flex lg:items-center">
171
- {renderNavItems(items.filter((item) => item.loggedIn === loggedIn))}
172
- </ul>
173
- <ul className="sm:flex sm:flex-col lg:flex-row ml-auto">
174
- {loggedIn && (
175
- <OptionsDropDownButton
176
- color={color}
177
- options={[
178
- <Link
179
- key="cerrar-sesion"
180
- className={`block px-4 py-3 text-sm text-gray-600 capitalize transition-colors duration-200 transform dark:text-gray-300 hover:bg-red-100 dark:hover:bg-gray-700 dark:hover:text-white`}
181
- to="/logout"
182
- >
183
- <div className="mx-auto pt-2">
184
- {<LogoutDropDownSvgIcon />}
185
- <span>Cerrar sesión</span>
186
- </div>
187
- </Link>,
188
- ]}
189
- />
190
- )}
191
- </ul>
192
- </>
168
+ const hiddenItemsChange = useMemo(
169
+ () => items.filter((item) => item.hide === true),
170
+ [items]
193
171
  );
194
172
 
173
+ const options = useMemo(() => {
174
+ return (
175
+ <>
176
+ <ul className="w-full lg:flex lg:items-center">
177
+ {renderNavItems(
178
+ items
179
+ .filter((item) => item.loggedIn === loggedIn)
180
+ .filter((item) => item.hide !== true)
181
+ )}
182
+ </ul>
183
+ <ul className="sm:flex sm:flex-col lg:flex-row ml-auto">
184
+ {loggedIn && (
185
+ <OptionsDropDownButton
186
+ color={color}
187
+ options={[
188
+ <Link
189
+ key="cerrar-sesion"
190
+ className={`block px-4 py-3 text-sm text-gray-600 capitalize transition-colors duration-200 transform dark:text-gray-300 hover:bg-red-100 dark:hover:bg-gray-700 dark:hover:text-white`}
191
+ to="/logout"
192
+ >
193
+ <div className="mx-auto pt-2">
194
+ {<LogoutDropDownSvgIcon />}
195
+ <span>Cerrar sesión</span>
196
+ </div>
197
+ </Link>,
198
+ ]}
199
+ />
200
+ )}
201
+ </ul>
202
+ </>
203
+ );
204
+ }, [items, loggedIn, hiddenItemsChange]);
205
+
195
206
  return (
196
207
  <nav className={`py-3 ${color.bg600}`}>
197
208
  <div className="flex items-center justify-between ml-5 mr-5">
@@ -14,6 +14,7 @@ export type NavBarItem = {
14
14
  color?: ColorInterface;
15
15
  childrens?: Exclude<NavBarItem, "loggedIn">[];
16
16
  reduxNotificationBadge?: (state: any) => string | number;
17
+ hide?: boolean;
17
18
  };
18
19
 
19
20
  export type NavBarProps = {