anima-ds-nucleus 1.0.6 → 1.0.8

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.
@@ -15,15 +15,64 @@ export const NavPoint = ({
15
15
  className = '',
16
16
  ...props
17
17
  }) => {
18
+ const shouldCompress = items.length >= 5;
19
+
18
20
  return (
19
21
  <nav
20
- className={`fixed bottom-0 left-0 right-0 z-50 md:hidden bg-white rounded-t-lg shadow-md overflow-hidden ${className}`}
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}`}
21
23
  style={{
22
- boxShadow: '0 -2px 8px rgba(0, 0, 0, 0.1)'
24
+ boxShadow: '0 -2px 8px rgba(0, 0, 0, 0.1)',
25
+ borderRadius: '16px 16px 0 0',
26
+ overflow: 'hidden'
23
27
  }}
24
28
  {...props}
25
29
  >
26
- <div className="flex items-stretch">
30
+ <style>{`
31
+ .nav-point {
32
+ border-radius: 16px 16px 0 0 !important;
33
+ overflow: hidden !important;
34
+ }
35
+ .nav-point > div {
36
+ overflow: hidden;
37
+ }
38
+ .nav-point-text {
39
+ display: block;
40
+ transition: opacity 0.2s, max-height 0.2s;
41
+ overflow: hidden;
42
+ white-space: nowrap !important;
43
+ text-overflow: ellipsis;
44
+ width: 100%;
45
+ text-align: center;
46
+ }
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
+ `}</style>
75
+ <div className="flex items-stretch" style={{ overflow: 'hidden' }}>
27
76
  {items.map((item, index) => {
28
77
  const isActive = activeItem === item.id;
29
78
  const isFirst = index === 0;
@@ -32,7 +81,7 @@ export const NavPoint = ({
32
81
  <button
33
82
  key={item.id}
34
83
  onClick={() => onItemClick && onItemClick(item.id)}
35
- className="flex flex-col items-center justify-center px-4 py-3 transition-all duration-200 cursor-pointer flex-1 relative"
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"
36
85
  style={{
37
86
  backgroundColor: isActive ? '#2D5C63' : 'transparent',
38
87
  borderRadius: isActive
@@ -48,8 +97,14 @@ export const NavPoint = ({
48
97
  />
49
98
  <Typography
50
99
  variant="body-sm"
51
- className="mt-1 font-medium"
52
- style={{ color: isActive ? '#FFFFFF' : '#374151' }}
100
+ className="mt-1 font-medium nav-point-text"
101
+ style={{
102
+ color: isActive ? '#FFFFFF' : '#374151',
103
+ whiteSpace: 'nowrap',
104
+ overflow: 'hidden',
105
+ textOverflow: 'ellipsis',
106
+ width: '100%'
107
+ }}
53
108
  >
54
109
  {item.label}
55
110
  </Typography>
@@ -50,55 +50,6 @@ export const SidebarPoint = ({
50
50
  {...props}
51
51
  >
52
52
  <nav className="h-full flex flex-col" style={{ overflow: 'hidden' }}>
53
- {/* Barra superior con HEXA Point */}
54
- {!isCollapsed && (
55
- <div className="p-4 border-b border-gray-200 flex-shrink-0">
56
- <button
57
- onClick={onCompanyClick}
58
- className="w-full bg-white rounded-lg px-3 py-2.5
59
- flex items-center justify-between hover:bg-gray-50 transition-colors"
60
- >
61
- <div className="flex items-center space-x-3">
62
- {/* Logo hexagonal */}
63
- {companyLogo ? (
64
- <img
65
- src={companyLogo}
66
- alt={companyName}
67
- className="w-8 h-8 rounded"
68
- />
69
- ) : (
70
- <LogoHexa width={36} height={40} />
71
- )}
72
- {/* Nombre de la empresa */}
73
- <Typography
74
- variant="body-md"
75
- className="color-gray-900 font-medium"
76
- >
77
- {companyName}
78
- </Typography>
79
- </div>
80
- </button>
81
- </div>
82
- )}
83
-
84
- {/* Botón de colapsar/expandir - Solo visible cuando está expandido */}
85
- {!isCollapsed && (
86
- <div className="px-4 pt-2 pb-2 flex justify-end flex-shrink-0">
87
- <button
88
- onClick={toggleCollapse}
89
- className="p-1.5 hover:bg-gray-100 rounded-lg transition-colors"
90
- aria-label="Colapsar sidebar"
91
- style={{ marginRight: '10px' }}
92
- >
93
- <Icon
94
- name="ChevronDoubleLeftIcon"
95
- variant="24-outline"
96
- size={20}
97
- className="color-teal"
98
- />
99
- </button>
100
- </div>
101
- )}
102
53
 
103
54
  {/* Header con logo de empresa cuando Client es true - entre botón colapsar y botón Inicio */}
104
55
  {Client && companyLogo && !isCollapsed && (
@@ -113,38 +64,7 @@ export const SidebarPoint = ({
113
64
  </div>
114
65
  )}
115
66
 
116
- {/* Logo cuando está colapsado */}
117
- {isCollapsed && (
118
- <div className="p-4 border-b border-gray-200 flex justify-center flex-shrink-0">
119
- {companyLogo ? (
120
- <img
121
- src={companyLogo}
122
- alt={companyName}
123
- className="w-8 h-8 rounded"
124
- />
125
- ) : (
126
- <LogoHexa width={36} height={40} />
127
- )}
128
- </div>
129
- )}
130
67
 
131
- {/* Botón para expandir - Solo visible cuando está colapsado */}
132
- {isCollapsed && (
133
- <div className="px-4 pt-2 pb-2 flex justify-center flex-shrink-0">
134
- <button
135
- onClick={toggleCollapse}
136
- className="p-1.5 hover:bg-gray-100 rounded-lg transition-colors"
137
- aria-label="Expandir sidebar"
138
- >
139
- <Icon
140
- name="ChevronDoubleRightIcon"
141
- variant="24-outline"
142
- size={20}
143
- className="color-teal"
144
- />
145
- </button>
146
- </div>
147
- )}
148
68
 
149
69
  {/* Contenido del sidebar - Wrapper para controlar el espacio */}
150
70
  <div className="flex-1 min-h-0 flex flex-col overflow-hidden">
@@ -166,31 +86,34 @@ export const SidebarPoint = ({
166
86
  : {}
167
87
  }
168
88
  >
169
- <Icon
170
- name="HomeIcon"
171
- variant="24-outline"
172
- size={20}
173
- className={`${isCollapsed ? '' : 'mr-3'} ${
174
- activeItem === 'inicio' ? 'color-white' : 'color-gray-700'
175
- }`}
176
- />
177
- {!isCollapsed && (
178
- <Typography
179
- variant="body-md"
180
- className={`font-medium ${
89
+ <div className="flex items-center">
90
+ <Icon
91
+ name="HomeIcon"
92
+ variant="24-outline"
93
+ size={20}
94
+ className={`${isCollapsed ? '' : 'mr-3'} ${
181
95
  activeItem === 'inicio' ? 'color-white' : 'color-gray-700'
182
96
  }`}
183
- >
184
- Inicio
185
- </Typography>
186
- )}
97
+ />
98
+ {!isCollapsed && (
99
+ <Typography
100
+ variant="body-md"
101
+ className={`font-medium ${
102
+ activeItem === 'inicio' ? 'color-white' : 'color-gray-700'
103
+ }`}
104
+ >
105
+ Inicio
106
+ </Typography>
107
+ )}
108
+ </div>
187
109
  {!isCollapsed && itemBadges['inicio'] !== undefined && itemBadges['inicio'] > 0 && (
188
110
  <span
189
111
  className="px-2 py-0.5 min-w-[20px] h-5
190
- text-white rounded-full flex items-center justify-center
112
+ rounded-full flex items-center justify-center
191
113
  text-body-sm font-medium"
192
114
  style={{
193
- backgroundColor: '#6D3856',
115
+ backgroundColor: activeItem === 'inicio' ? '#FFFFFF' : '#6D3856',
116
+ color: activeItem === 'inicio' ? '#6D3856' : '#FFFFFF',
194
117
  borderRadius: '12px'
195
118
  }}
196
119
  >
@@ -265,10 +188,11 @@ export const SidebarPoint = ({
265
188
  {!isCollapsed && ((itemBadges[item.id] !== undefined && itemBadges[item.id] > 0) || (item.id === 'empleados' && 2)) && (
266
189
  <span
267
190
  className="px-2 py-0.5 min-w-[20px] h-5
268
- text-white rounded-full flex items-center justify-center
191
+ rounded-full flex items-center justify-center
269
192
  text-body-sm font-medium"
270
193
  style={{
271
- backgroundColor: '#6D3856',
194
+ backgroundColor: activeItem === item.id ? '#FFFFFF' : '#6D3856',
195
+ color: activeItem === item.id ? '#6D3856' : '#FFFFFF',
272
196
  borderRadius: '12px'
273
197
  }}
274
198
  >
@@ -0,0 +1,92 @@
1
+ import { LogoHexa } from '../../Atoms/LogoHexa/LogoHexa';
2
+ import { Typography } from '../../Atoms/Typography/Typography';
3
+
4
+ export const TituloPoint = ({
5
+ backgroundColor = 'var(--color-main)',
6
+ textColor = '#FFFFFF',
7
+ borderBottomColor = 'var(--color-main-800)',
8
+ className = '',
9
+ ...props
10
+ }) => {
11
+ return (
12
+ <div
13
+ className={`titulo-point ${className}`}
14
+ style={{
15
+ backgroundColor: backgroundColor,
16
+ width: '100%',
17
+ display: 'none',
18
+ opacity: 1,
19
+ borderBottomColor: borderBottomColor
20
+ }}
21
+ {...props}
22
+ >
23
+ <style>{`
24
+ @media (min-width: 769px) {
25
+ .titulo-point {
26
+ display: flex !important;
27
+ align-items: center !important;
28
+ justify-content: center !important;
29
+ width: 100%;
30
+ height: calc(60px * (100vw / 1440px));
31
+ min-height: 40px;
32
+ max-height: 60px;
33
+ padding-top: 20px;
34
+ padding-right: 16px;
35
+ padding-left: 16px;
36
+ padding-bottom: 0;
37
+ border-bottom-width: 1px;
38
+ border-bottom-style: solid;
39
+ box-sizing: border-box;
40
+ position: relative;
41
+ }
42
+ .titulo-point-inner {
43
+ display: flex !important;
44
+ align-items: center !important;
45
+ justify-content: center !important;
46
+ gap: 12px;
47
+ width: 100%;
48
+ margin: 0 auto;
49
+ padding: 0;
50
+ flex-shrink: 0;
51
+ }
52
+ }
53
+ @media (min-width: 1440px) {
54
+ .titulo-point {
55
+ height: 60px;
56
+ }
57
+ }
58
+ @media (max-width: 768px) {
59
+ .titulo-point {
60
+ display: none !important;
61
+ }
62
+ }
63
+ `}</style>
64
+ <div className="titulo-point-inner" style={{ margin: 0, padding: 0 }}>
65
+ <LogoHexa
66
+ width={28}
67
+ height={32}
68
+ backgroundColor="#FFFFFF"
69
+ textColor="var(--color-main)"
70
+ />
71
+ <Typography
72
+ variant="h5"
73
+ style={{
74
+ color: textColor,
75
+ fontFamily: 'IBM Plex Sans',
76
+ fontWeight: 600,
77
+ fontSize: '18px',
78
+ lineHeight: '1.2',
79
+ margin: 0,
80
+ padding: 0,
81
+ display: 'flex',
82
+ alignItems: 'center'
83
+ }}
84
+ >
85
+ HEXA Point
86
+ </Typography>
87
+ </div>
88
+ </div>
89
+ );
90
+ };
91
+
92
+ export default TituloPoint;
@@ -0,0 +1,31 @@
1
+ import { TituloPoint } from './TituloPoint';
2
+
3
+ export default {
4
+ title: 'Layout/TituloPoint',
5
+ component: TituloPoint,
6
+ tags: ['autodocs'],
7
+ };
8
+
9
+ export const Default = {
10
+ render: () => (
11
+ <TituloPoint />
12
+ ),
13
+ };
14
+
15
+ export const ConColorPersonalizado = {
16
+ render: () => (
17
+ <TituloPoint
18
+ backgroundColor="#000000"
19
+ textColor="#FFFFFF"
20
+ />
21
+ ),
22
+ };
23
+
24
+ export const ConColorSecundario = {
25
+ render: () => (
26
+ <TituloPoint
27
+ backgroundColor="var(--color-secondary)"
28
+ textColor="#FFFFFF"
29
+ />
30
+ ),
31
+ };