anima-ds-nucleus 1.0.16 → 1.0.17

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.
@@ -1,6 +1,17 @@
1
1
  import { Icon } from '../../Atoms/Icon/Icon';
2
2
  import { Typography } from '../../Atoms/Typography/Typography';
3
3
 
4
+ // Constantes de diseño reutilizables
5
+ const ICON_SIZE = 24;
6
+ const ICON_COLOR_ACTIVE = '#FFFFFF';
7
+ const ICON_COLOR_INACTIVE = '#374151';
8
+ const BACKGROUND_COLOR_ACTIVE = '#2D5C63';
9
+ const TEXT_COLOR_ACTIVE = '#FFFFFF';
10
+ const TEXT_COLOR_INACTIVE = '#374151';
11
+ const NAV_HEIGHT = '80px'; // Altura fija para garantizar espacio para icono + label + padding
12
+ const BORDER_RADIUS_TOP = '16px';
13
+ const SHADOW_COLOR = 'rgba(0, 0, 0, 0.1)';
14
+
4
15
  const DEFAULT_ITEMS = [
5
16
  { id: 'inicio', label: 'Inicio', icon: 'Squares2X2Icon' },
6
17
  { id: 'docs', label: 'Docs', icon: 'DocumentTextIcon' },
@@ -15,91 +26,86 @@ export const NavPoint = ({
15
26
  className = '',
16
27
  ...props
17
28
  }) => {
18
- const shouldCompress = items.length >= 5;
19
-
29
+ const handleItemClick = (itemId) => {
30
+ if (onItemClick) {
31
+ onItemClick(itemId);
32
+ }
33
+ };
34
+
35
+ const getBorderRadius = (isActive, isFirst, isLast) => {
36
+ if (!isActive) return '0';
37
+ if (isFirst) return `${BORDER_RADIUS_TOP} 0 0 0`;
38
+ if (isLast) return `0 ${BORDER_RADIUS_TOP} 0 0`;
39
+ return '0';
40
+ };
41
+
20
42
  return (
21
43
  <nav
22
- className={`fixed bottom-0 left-0 right-0 z-50 md:hidden bg-white rounded-t-lg shadow-md nav-point ${shouldCompress ? 'compressed' : ''} ${className}`}
44
+ className={`fixed bottom-0 left-0 right-0 z-50 md:hidden bg-white rounded-t-lg shadow-md nav-point ${className}`}
23
45
  style={{
24
- boxShadow: '0 -2px 8px rgba(0, 0, 0, 0.1)',
25
- borderRadius: '16px 16px 0 0',
26
- overflow: 'hidden'
46
+ boxShadow: `0 -2px 8px ${SHADOW_COLOR}`,
47
+ borderRadius: `${BORDER_RADIUS_TOP} ${BORDER_RADIUS_TOP} 0 0`,
48
+ overflow: 'hidden',
49
+ minHeight: NAV_HEIGHT,
50
+ height: NAV_HEIGHT,
27
51
  }}
28
52
  {...props}
29
53
  >
30
54
  <style>{`
31
55
  .nav-point {
32
- border-radius: 16px 16px 0 0 !important;
56
+ border-radius: ${BORDER_RADIUS_TOP} ${BORDER_RADIUS_TOP} 0 0 !important;
33
57
  overflow: hidden !important;
58
+ min-height: ${NAV_HEIGHT} !important;
59
+ height: ${NAV_HEIGHT} !important;
34
60
  }
35
61
  .nav-point > div {
36
62
  overflow: hidden;
63
+ height: 100%;
64
+ }
65
+ .nav-point-item {
66
+ min-width: 0;
67
+ min-height: ${NAV_HEIGHT};
68
+ height: 100%;
37
69
  }
38
70
  .nav-point-text {
39
- display: block;
40
- transition: opacity 0.2s, max-height 0.2s;
71
+ display: block !important;
72
+ visibility: visible !important;
73
+ opacity: 1 !important;
74
+ max-height: none !important;
41
75
  overflow: hidden;
42
76
  white-space: nowrap !important;
43
77
  text-overflow: ellipsis;
44
78
  width: 100%;
45
79
  text-align: center;
46
80
  }
47
- .nav-point-item {
48
- min-width: 0;
49
- }
50
- /* Ocultar textos solo cuando hay muchos items (5+) y pantalla pequeña para evitar desorden */
51
- @media (max-width: 480px) {
52
- .nav-point.compressed .nav-point-text {
53
- display: none !important;
54
- max-height: 0;
55
- opacity: 0;
56
- }
57
- .nav-point.compressed .nav-point-item {
58
- padding-left: 0.5rem !important;
59
- padding-right: 0.5rem !important;
60
- }
61
- }
62
- /* Ocultar textos solo en pantallas muy pequeñas (< 320px) donde definitivamente no caben */
63
- @media (max-width: 320px) {
64
- .nav-point-text {
65
- display: none !important;
66
- max-height: 0;
67
- opacity: 0;
68
- }
69
- .nav-point-item {
70
- padding-left: 0.5rem !important;
71
- padding-right: 0.5rem !important;
72
- }
73
- }
74
81
  `}</style>
75
- <div className="flex items-stretch" style={{ overflow: 'hidden' }}>
82
+ <div className="flex items-stretch h-full" style={{ overflow: 'hidden' }}>
76
83
  {items.map((item, index) => {
77
84
  const isActive = activeItem === item.id;
78
85
  const isFirst = index === 0;
79
86
  const isLast = index === items.length - 1;
87
+
80
88
  return (
81
89
  <button
82
90
  key={item.id}
83
- onClick={() => onItemClick && onItemClick(item.id)}
84
- className="flex flex-col items-center justify-center px-4 py-3 transition-all duration-200 cursor-pointer flex-1 relative nav-point-item"
91
+ onClick={() => handleItemClick(item.id)}
92
+ className="flex flex-col items-center justify-center px-4 py-3 transition-colors duration-200 cursor-pointer flex-1 relative nav-point-item"
85
93
  style={{
86
- backgroundColor: isActive ? '#2D5C63' : 'transparent',
87
- borderRadius: isActive
88
- ? (isFirst ? '16px 0 0 0' : isLast ? '0 16px 0 0' : '0')
89
- : '0',
94
+ backgroundColor: isActive ? BACKGROUND_COLOR_ACTIVE : 'transparent',
95
+ borderRadius: getBorderRadius(isActive, isFirst, isLast),
90
96
  }}
91
97
  >
92
98
  <Icon
93
99
  name={item.icon}
94
100
  variant="24-outline"
95
- size={24}
96
- style={{ color: isActive ? '#FFFFFF' : '#374151' }}
101
+ size={ICON_SIZE}
102
+ style={{ color: isActive ? ICON_COLOR_ACTIVE : ICON_COLOR_INACTIVE }}
97
103
  />
98
104
  <Typography
99
105
  variant="body-sm"
100
106
  className="mt-1 font-medium nav-point-text"
101
107
  style={{
102
- color: isActive ? '#FFFFFF' : '#374151',
108
+ color: isActive ? TEXT_COLOR_ACTIVE : TEXT_COLOR_INACTIVE,
103
109
  whiteSpace: 'nowrap',
104
110
  overflow: 'hidden',
105
111
  textOverflow: 'ellipsis',
package/src/index.js CHANGED
@@ -32,6 +32,7 @@ export { HeaderConBuscador } from './components/Layout/Header/HeaderConBuscador'
32
32
  export { HeaderCore } from './components/Layout/Header/HeaderCore';
33
33
  export { HeaderPoint } from './components/Layout/Header/HeaderPoint';
34
34
  export { HeaderGeneral } from './components/Layout/Header/HeaderGeneral';
35
+ export { HeaderCompartido } from './components/Layout/Header/HeaderCompartido';
35
36
  export { SidebarCore, SidebarCoreMobile } from './components/Layout/Sidebar/SidebarCore';
36
37
  export { SidebarPoint, SidebarPointMobile } from './components/Layout/Sidebar/SidebarPoint';
37
38
  export { NavPoint } from './components/Layout/NavPoint/NavPoint';