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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anima-ds-nucleus",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Anima Design System - A comprehensive React component library",
5
5
  "author": "Nucleus Labs <ipvasallo@nucleus.com.ar>",
6
6
  "license": "UNLICENSED",
@@ -1,113 +1,404 @@
1
- import { Typography } from '../../Atoms/Typography/Typography';
1
+ import { useState } from 'react';
2
2
  import { Icon } from '../../Atoms/Icon/Icon';
3
- import { LogoHexa } from '../../Atoms/LogoHexa/LogoHexa';
3
+ import { Avatar } from '../../Atoms/Avatar/Avatar';
4
+ import { Typography } from '../../Atoms/Typography/Typography';
4
5
 
5
6
  export const HeaderPoint = ({
6
- logo,
7
- companyName = 'Point',
8
- date,
9
- pointLabel = 'HEXA Core',
10
- onPointClick,
11
- backgroundColor,
12
- borderColor,
13
- verticalLineColor = '#9CA3AF',
14
- logoBackgroundColor = '#FFFFFF',
15
- logoIconColor,
16
- companyNameColor,
17
- dateColor = '#6B7280',
18
- buttonBackgroundColor = '#000000',
19
- buttonBorderColor = '#FFFFFF',
20
- buttonTextColor = '#FFFFFF',
7
+ searchPlaceholder = 'Buscar empleados, reportes, configuraciones...',
8
+ userName,
9
+ userAvatar,
10
+ notificationCount = 0,
11
+ onSearch,
12
+ onNotificationClick,
13
+ onUserClick,
21
14
  className = '',
22
15
  ...props
23
16
  }) => {
24
- // Formatear fecha si no se proporciona
25
- const formattedDate = date || new Date().toLocaleDateString('es-AR', {
26
- weekday: 'long',
27
- year: 'numeric',
28
- month: 'long',
29
- day: 'numeric',
30
- });
17
+ const [searchValue, setSearchValue] = useState('');
18
+
19
+ const handleSearchChange = (e) => {
20
+ const value = e.target.value;
21
+ setSearchValue(value);
22
+ if (onSearch) {
23
+ onSearch(value);
24
+ }
25
+ };
31
26
 
32
- // Capitalizar primera letra de la fecha
33
- const capitalizedDate = formattedDate.charAt(0).toUpperCase() + formattedDate.slice(1);
27
+ const handleSearchSubmit = (e) => {
28
+ e.preventDefault();
29
+ if (onSearch) {
30
+ onSearch(searchValue);
31
+ }
32
+ };
34
33
 
35
- // Determinar colores del logo
36
- const logoBgColor = logoBackgroundColor;
37
- const logoIconStrokeColor = logoIconColor || backgroundColor || '#2D5C63';
38
-
39
34
  return (
40
35
  <header
41
- className={`${className}`}
36
+ className={`bg-white header-point-mobile ${className}`}
42
37
  style={{
43
- backgroundColor: backgroundColor || '#FFFFFF',
44
- borderBottom: borderColor ? `1px solid ${borderColor}` : '1px solid #E5E7EB'
38
+ ...(props.style || {}),
45
39
  }}
46
40
  {...props}
47
41
  >
48
- <div className="w-full">
49
- <div className="flex items-center justify-between h-16 px-4 sm:px-6 lg:px-8">
50
- {/* Lado izquierdo: logo y nombre */}
51
- <div className="flex items-center space-x-2">
52
- {/* Logo hexagonal */}
53
- {logo ? (
54
- <img
55
- src={logo}
56
- alt={companyName}
57
- className="w-8 h-8"
42
+ <style>{`
43
+ .header-search-input {
44
+ border-color: #9ca3af;
45
+ }
46
+ .header-search-input::placeholder {
47
+ color: #9ca3af !important;
48
+ opacity: 1 !important;
49
+ }
50
+ .header-search-icon-container {
51
+ border-color: #9ca3af;
52
+ }
53
+ .header-search-form:focus-within .header-search-input {
54
+ border-color: #3b82f6 !important;
55
+ box-shadow: 0 0 0 1px #3b82f6;
56
+ }
57
+ .header-search-form:focus-within .header-search-icon-container {
58
+ border-color: #3b82f6 !important;
59
+ box-shadow: 0 0 0 1px #3b82f6;
60
+ }
61
+ @media (max-width: 768px) {
62
+ header.header-point-mobile,
63
+ .header-point-mobile,
64
+ header.bg-white.header-point-mobile {
65
+ background-color: transparent !important;
66
+ background: transparent !important;
67
+ border-bottom: none !important;
68
+ }
69
+ header.header-point-mobile[style*="background"],
70
+ .header-point-mobile[style*="background"],
71
+ header.header-point-mobile[style*="backgroundColor"] {
72
+ background-color: transparent !important;
73
+ background: transparent !important;
74
+ }
75
+ .header-mobile-layout {
76
+ display: block !important;
77
+ position: relative !important;
78
+ }
79
+ .header-mobile-top-row {
80
+ display: flex !important;
81
+ align-items: center !important;
82
+ justify-content: space-between !important;
83
+ padding: 24px 24px 12px 24px !important;
84
+ min-height: 64px !important;
85
+ height: 64px !important;
86
+ }
87
+ .header-mobile-menu-button,
88
+ .header-mobile-notification-button {
89
+ display: flex !important;
90
+ align-items: center !important;
91
+ justify-content: center !important;
92
+ }
93
+ .header-mobile-point-text {
94
+ display: flex !important;
95
+ align-items: center !important;
96
+ }
97
+ .header-mobile-layout::after {
98
+ content: '' !important;
99
+ position: absolute !important;
100
+ top: 0 !important;
101
+ left: 0 !important;
102
+ right: 0 !important;
103
+ width: 100% !important;
104
+ height: calc(64px + 12px + 20px) !important;
105
+ background-color: var(--color-main) !important;
106
+ background: var(--color-main) !important;
107
+ z-index: 0 !important;
108
+ border-bottom: 1px solid var(--color-main-800) !important;
109
+ pointer-events: none !important;
110
+ display: block !important;
111
+ visibility: visible !important;
112
+ opacity: 1 !important;
113
+ }
114
+ .header-mobile-top-row {
115
+ position: relative;
116
+ z-index: 2 !important;
117
+ }
118
+ .header-mobile-search-row {
119
+ position: relative;
120
+ z-index: 2 !important;
121
+ }
122
+ .header-mobile-search-row {
123
+ display: block;
124
+ padding: 12px 24px 0 24px;
125
+ margin-top: -8px;
126
+ }
127
+ .header-desktop-layout {
128
+ display: none !important;
129
+ }
130
+ .header-mobile-layout .header-search-input {
131
+ font-size: 12px !important;
132
+ padding-left: 8px !important;
133
+ padding-right: 8px !important;
134
+ }
135
+ .header-mobile-layout .header-search-icon-container {
136
+ width: 44px !important;
137
+ height: 44px !important;
138
+ }
139
+ .header-mobile-menu-icon {
140
+ color: var(--color-neutrals-white) !important;
141
+ }
142
+ .header-mobile-notification-icon {
143
+ color: var(--color-neutrals-white) !important;
144
+ }
145
+ .header-mobile-point-text {
146
+ color: var(--color-neutrals-white) !important;
147
+ }
148
+ }
149
+ @media (min-width: 769px) {
150
+ .header-mobile-layout {
151
+ display: none;
152
+ }
153
+ header.header-point-mobile {
154
+ border-bottom: none !important;
155
+ }
156
+ }
157
+ `}</style>
158
+
159
+ <div className="w-full" style={{ paddingLeft: '4px', paddingRight: '4px' }}>
160
+ {/* Layout Desktop (más de 768px) */}
161
+ <div className="header-desktop-layout flex items-center justify-between h-16">
162
+ {/* Barra de búsqueda con icono a la derecha */}
163
+ <div className="flex-1 mr-2 md:mr-4" style={{ maxWidth: 'none', minWidth: '0' }}>
164
+ <form onSubmit={handleSearchSubmit} className="header-search-form flex items-center w-full">
165
+ {/* Input de búsqueda */}
166
+ <input
167
+ type="text"
168
+ value={searchValue}
169
+ onChange={handleSearchChange}
170
+ placeholder={searchPlaceholder}
171
+ className="header-search-input flex-1 pl-2 md:pl-4 pr-2 md:pr-4 py-2 md:py-2.5 bg-white border border-gray-400 rounded-l-lg
172
+ focus:outline-none text-sm md:text-base"
173
+ style={{
174
+ height: '40px',
175
+ borderRight: 'none',
176
+ borderTopRightRadius: '0',
177
+ borderBottomRightRadius: '0',
178
+ color: '#374151',
179
+ fontFamily: 'IBM Plex Sans',
180
+ fontWeight: 400,
181
+ fontStyle: 'italic',
182
+ fontSize: '14px',
183
+ lineHeight: '20px',
184
+ letterSpacing: '0px'
185
+ }}
58
186
  />
59
- ) : (
60
- <LogoHexa
61
- width={36}
62
- height={40}
63
- />
64
- )}
65
-
66
- {/* Nombre de la empresa */}
67
- <Typography
68
- variant="body-md"
69
- className="font-bold"
70
- style={{ color: companyNameColor }}
71
- >
72
- {companyName}
73
- </Typography>
187
+
188
+ {/* Recuadro con icono de buscar a la derecha */}
189
+ <div
190
+ className="header-search-icon-container flex items-center justify-center border border-gray-400 rounded-r-lg bg-white"
191
+ style={{
192
+ width: '40px',
193
+ height: '40px',
194
+ borderTopLeftRadius: '0',
195
+ borderBottomLeftRadius: '0'
196
+ }}
197
+ >
198
+ <Icon
199
+ name="MagnifyingGlassIcon"
200
+ variant="24-outline"
201
+ size={20}
202
+ className="color-gray-600"
203
+ />
204
+ </div>
205
+ </form>
74
206
  </div>
75
207
 
76
- {/* Centro: Fecha */}
77
- <div className="flex-1 flex justify-center">
78
- <Typography
79
- variant="body-md"
80
- style={{ color: dateColor }}
81
- >
82
- {capitalizedDate}
83
- </Typography>
208
+ {/* Notificaciones y Perfil */}
209
+ <div className="flex items-center space-x-3 md:space-x-6 flex-shrink-0" style={{ marginLeft: 'auto', paddingRight: '0px' }}>
210
+ {/* Icono de notificaciones */}
211
+ {notificationCount !== undefined && (
212
+ <button
213
+ onClick={onNotificationClick}
214
+ className="relative p-2 hover:bg-gray-100 rounded-lg transition-colors"
215
+ aria-label="Notificaciones"
216
+ >
217
+ <Icon
218
+ name="BellIcon"
219
+ variant="24-outline"
220
+ size={24}
221
+ className="color-gray-600"
222
+ />
223
+ {notificationCount > 0 && (
224
+ <span
225
+ className="absolute -top-1 -right-1 px-1.5 py-0.5 min-w-[20px] h-5
226
+ text-white rounded-full flex items-center justify-center
227
+ text-body-sm font-medium"
228
+ style={{
229
+ backgroundColor: '#6D3856',
230
+ borderRadius: '12px'
231
+ }}
232
+ >
233
+ {notificationCount > 9 ? '9+' : notificationCount}
234
+ </span>
235
+ )}
236
+ </button>
237
+ )}
238
+
239
+ {/* Perfil de usuario */}
240
+ {userName && (
241
+ <button
242
+ onClick={onUserClick}
243
+ className="flex items-center space-x-3 hover:bg-gray-50
244
+ rounded-lg px-2 py-1.5 transition-colors"
245
+ aria-label="Perfil de usuario"
246
+ >
247
+ <Avatar
248
+ src={userAvatar}
249
+ name={userName}
250
+ size="medium"
251
+ variant="circle"
252
+ />
253
+ <Typography
254
+ variant="body-lg"
255
+ className="color-gray-700 hidden md:block"
256
+ style={{
257
+ fontFamily: 'IBM Plex Sans',
258
+ fontWeight: 400,
259
+ fontStyle: 'normal',
260
+ fontSize: '16px',
261
+ lineHeight: '24px',
262
+ letterSpacing: '0%',
263
+ verticalAlign: 'middle'
264
+ }}
265
+ >
266
+ {userName}
267
+ </Typography>
268
+ <Icon
269
+ name="ChevronDownIcon"
270
+ variant="24-outline"
271
+ size={20}
272
+ className="color-gray-500"
273
+ />
274
+ </button>
275
+ )}
84
276
  </div>
277
+ </div>
85
278
 
86
- {/* Lado derecho: Botón HEXA Core */}
87
- <div className="flex items-center">
88
- <button
89
- onClick={onPointClick}
90
- className="px-4 py-2 border rounded-lg
91
- transition-colors flex items-center space-x-2"
279
+ {/* Layout Mobile (768px o menos) */}
280
+ <div className="header-mobile-layout">
281
+ {/* Primera fila: Menú, Point (centrado), Notificaciones */}
282
+ <div className="header-mobile-top-row" style={{ position: 'relative' }}>
283
+ {/* Lado izquierdo: Menú hamburguesa */}
284
+ <div className="flex items-center">
285
+ <button
286
+ className="p-2 hover:bg-gray-100 rounded-lg transition-colors header-mobile-menu-button"
287
+ style={{ cursor: 'pointer', padding: '8px' }}
288
+ aria-label="Menú"
289
+ >
290
+ <Icon
291
+ name="Bars3Icon"
292
+ variant="24-outline"
293
+ size={24}
294
+ className="header-mobile-menu-icon"
295
+ />
296
+ </button>
297
+ </div>
298
+
299
+ {/* Centro: Texto "Point" */}
300
+ <div
92
301
  style={{
93
- borderColor: buttonBorderColor,
94
- backgroundColor: buttonBackgroundColor,
95
- color: buttonTextColor
302
+ position: 'absolute',
303
+ left: '50%',
304
+ top: '54%',
305
+ transform: 'translate(-50%, -50%)',
306
+ display: 'flex',
307
+ alignItems: 'center'
96
308
  }}
97
309
  >
98
310
  <Typography
99
- variant="body-md"
100
- style={{ color: buttonTextColor }}
311
+ variant="h6"
312
+ className="header-mobile-point-text"
313
+ style={{
314
+ fontSize: '20px',
315
+ fontFamily: 'IBM Plex Sans',
316
+ fontWeight: 600,
317
+ lineHeight: '1.2',
318
+ margin: 0
319
+ }}
101
320
  >
102
- {pointLabel}
321
+ Point
103
322
  </Typography>
104
- <Icon
105
- name="ArrowUpRightIcon"
106
- variant="24-outline"
107
- size={16}
108
- style={{ color: buttonTextColor }}
323
+ </div>
324
+
325
+ {/* Lado derecho: Notificaciones */}
326
+ <div className="flex items-center ml-auto">
327
+ {notificationCount !== undefined && (
328
+ <button
329
+ onClick={onNotificationClick}
330
+ className="relative p-2 hover:bg-gray-100 rounded-lg transition-colors header-mobile-notification-button"
331
+ style={{ cursor: 'pointer', padding: '8px' }}
332
+ aria-label="Notificaciones"
333
+ >
334
+ <Icon
335
+ name="BellIcon"
336
+ variant="24-outline"
337
+ size={24}
338
+ className="header-mobile-notification-icon"
339
+ />
340
+ {notificationCount > 0 && (
341
+ <span
342
+ className="absolute -top-1 -right-1 px-1.5 py-0.5 min-w-[20px] h-5
343
+ text-white rounded-full flex items-center justify-center
344
+ text-body-sm font-medium"
345
+ style={{
346
+ backgroundColor: '#6D3856',
347
+ borderRadius: '12px'
348
+ }}
349
+ >
350
+ {notificationCount > 9 ? '9+' : notificationCount}
351
+ </span>
352
+ )}
353
+ </button>
354
+ )}
355
+ </div>
356
+ </div>
357
+
358
+ {/* Segunda fila: Barra de búsqueda */}
359
+ <div className="header-mobile-search-row">
360
+ <form onSubmit={handleSearchSubmit} className="header-search-form flex items-center w-full">
361
+ {/* Input de búsqueda */}
362
+ <input
363
+ type="text"
364
+ value={searchValue}
365
+ onChange={handleSearchChange}
366
+ placeholder={searchPlaceholder}
367
+ className="header-search-input flex-1 pl-4 pr-4 py-2 bg-white border border-gray-400 rounded-l-lg
368
+ focus:outline-none text-sm"
369
+ style={{
370
+ height: '44px',
371
+ borderRight: 'none',
372
+ borderTopRightRadius: '0',
373
+ borderBottomRightRadius: '0',
374
+ color: '#374151',
375
+ fontFamily: 'IBM Plex Sans',
376
+ fontWeight: 400,
377
+ fontStyle: 'italic',
378
+ fontSize: '14px',
379
+ lineHeight: '20px',
380
+ letterSpacing: '0px'
381
+ }}
109
382
  />
110
- </button>
383
+
384
+ {/* Recuadro con icono de buscar a la derecha */}
385
+ <div
386
+ className="header-search-icon-container flex items-center justify-center border border-gray-400 rounded-r-lg bg-white"
387
+ style={{
388
+ width: '40px',
389
+ height: '40px',
390
+ borderTopLeftRadius: '0',
391
+ borderBottomLeftRadius: '0'
392
+ }}
393
+ >
394
+ <Icon
395
+ name="MagnifyingGlassIcon"
396
+ variant="24-outline"
397
+ size={20}
398
+ className="color-gray-600"
399
+ />
400
+ </div>
401
+ </form>
111
402
  </div>
112
403
  </div>
113
404
  </div>
@@ -116,5 +407,3 @@ export const HeaderPoint = ({
116
407
  };
117
408
 
118
409
  export default HeaderPoint;
119
-
120
-
@@ -9,102 +9,44 @@ export default {
9
9
  export const Default = {
10
10
  render: () => (
11
11
  <HeaderPoint
12
- backgroundColor="#2D5C63"
13
- borderColor="#1F4549"
14
- verticalLineColor="#4A8A92"
15
- logoIconColor="#2D5C63"
16
- companyNameColor="#FFFFFF"
17
- dateColor="#E5E7EB"
18
- buttonBackgroundColor="#2D5C63"
19
- buttonBorderColor="#FFFFFF"
20
- buttonTextColor="#FFFFFF"
21
- date="Martes, 20 de octubre de 2023"
22
- onPointClick={() => console.log('HEXA Core clickeado')}
12
+ searchPlaceholder="Buscar empleados, reportes, configuraciones..."
13
+ userName="Maria García Alonso"
14
+ userAvatar="https://i.pravatar.cc/150?img=12"
15
+ notificationCount={7}
16
+ onSearch={(value) => console.log('Búsqueda:', value)}
17
+ onNotificationClick={() => console.log('Notificaciones clickeadas')}
18
+ onUserClick={() => console.log('Usuario clickeado')}
23
19
  />
24
20
  ),
25
21
  };
26
22
 
27
- export const ConFechaAutomatica = {
23
+ export const SinNotificaciones = {
28
24
  render: () => (
29
25
  <HeaderPoint
30
- backgroundColor="#2D5C63"
31
- borderColor="#1F4549"
32
- verticalLineColor="#4A8A92"
33
- logoIconColor="#2D5C63"
34
- companyNameColor="#FFFFFF"
35
- dateColor="#E5E7EB"
36
- buttonBackgroundColor="#2D5C63"
37
- buttonBorderColor="#FFFFFF"
38
- buttonTextColor="#FFFFFF"
26
+ searchPlaceholder="Buscar empleados, reportes, configuraciones..."
27
+ userName="Juan Pérez"
28
+ userAvatar="https://i.pravatar.cc/150?img=33"
29
+ notificationCount={0}
39
30
  />
40
31
  ),
41
32
  };
42
33
 
43
- export const ConLogoPersonalizado = {
34
+ export const ConMuchasNotificaciones = {
44
35
  render: () => (
45
36
  <HeaderPoint
46
- companyName="Mi Empresa"
47
- logo="https://via.placeholder.com/32"
48
- date="Lunes, 15 de enero de 2024"
49
- pointLabel="Mi Punto"
37
+ searchPlaceholder="Buscar empleados, reportes, configuraciones..."
38
+ userName="Ana Martínez"
39
+ userAvatar="https://i.pravatar.cc/150?img=47"
40
+ notificationCount={15}
50
41
  />
51
42
  ),
52
43
  };
53
44
 
54
- export const ConLabelsPersonalizados = {
45
+ export const SinUsuario = {
55
46
  render: () => (
56
47
  <HeaderPoint
57
- companyName="ACME Corp"
58
- date="Viernes, 25 de diciembre de 2024"
59
- pointLabel="ACME Hub"
48
+ searchPlaceholder="Buscar empleados, reportes, configuraciones..."
49
+ notificationCount={3}
60
50
  />
61
51
  ),
62
52
  };
63
-
64
- export const ConFondoNegro = {
65
- render: () => (
66
- <HeaderPoint
67
- backgroundColor="#000000"
68
- borderColor="#333333"
69
- verticalLineColor="#666666"
70
- logoIconColor="#000000"
71
- companyNameColor="#FFFFFF"
72
- dateColor="#CCCCCC"
73
- date="Martes, 20 de octubre de 2023"
74
- onPointClick={() => console.log('HEXA Core clickeado')}
75
- />
76
- ),
77
- };
78
-
79
- export const ConBotonesPersonalizados = {
80
- render: () => (
81
- <HeaderPoint
82
- backgroundColor="#000000"
83
- buttonBackgroundColor="#FF5733"
84
- buttonBorderColor="#FFFFFF"
85
- buttonTextColor="#FFFFFF"
86
- date="Martes, 20 de octubre de 2023"
87
- onPointClick={() => console.log('HEXA Core clickeado')}
88
- />
89
- ),
90
- };
91
-
92
- export const ConTodosLosColoresPersonalizados = {
93
- render: () => (
94
- <HeaderPoint
95
- backgroundColor="#1A1A1A"
96
- borderColor="#333333"
97
- verticalLineColor="#666666"
98
- logoBackgroundColor="#FFFFFF"
99
- logoIconColor="#1A1A1A"
100
- companyNameColor="#FFFFFF"
101
- dateColor="#CCCCCC"
102
- buttonBackgroundColor="#FF5733"
103
- buttonBorderColor="#FFFFFF"
104
- buttonTextColor="#FFFFFF"
105
- date="Martes, 20 de octubre de 2023"
106
- onPointClick={() => console.log('HEXA Core clickeado')}
107
- />
108
- ),
109
- };
110
-