@grupor5/raya 0.2.10 → 0.2.12

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,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
2
+ import * as class_variance_authority_types from 'class-variance-authority/types';
3
3
  import React__default from 'react';
4
4
  import { VariantProps } from 'class-variance-authority';
5
5
 
@@ -8,7 +8,7 @@ declare const badgeVariants: (props?: ({
8
8
  shape?: "rounded" | "circular" | null | undefined;
9
9
  size?: "sm" | "md" | "lg" | null | undefined;
10
10
  visual?: "solid" | "dot" | null | undefined;
11
- } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
11
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
12
12
  interface BadgeProps extends React__default.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
13
13
  }
14
14
  declare function Badge({ className, variant, size, visual, shape, ...props }: BadgeProps): react_jsx_runtime.JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
2
+ import * as class_variance_authority_types from 'class-variance-authority/types';
3
3
  import React__default from 'react';
4
4
  import { VariantProps } from 'class-variance-authority';
5
5
 
@@ -8,7 +8,7 @@ declare const badgeVariants: (props?: ({
8
8
  shape?: "rounded" | "circular" | null | undefined;
9
9
  size?: "sm" | "md" | "lg" | null | undefined;
10
10
  visual?: "solid" | "dot" | null | undefined;
11
- } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
11
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
12
12
  interface BadgeProps extends React__default.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
13
13
  }
14
14
  declare function Badge({ className, variant, size, visual, shape, ...props }: BadgeProps): react_jsx_runtime.JSX.Element;
@@ -1,8 +1,8 @@
1
- import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
1
+ import * as class_variance_authority_types from 'class-variance-authority/types';
2
2
  import * as React from 'react';
3
3
  import * as LabelPrimitive from '@radix-ui/react-label';
4
4
  import { VariantProps } from 'class-variance-authority';
5
5
 
6
- declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: class_variance_authority_dist_types.ClassProp | undefined) => string> & React.RefAttributes<HTMLLabelElement>>;
6
+ declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: class_variance_authority_types.ClassProp | undefined) => string> & React.RefAttributes<HTMLLabelElement>>;
7
7
 
8
8
  export { Label };
@@ -1,8 +1,8 @@
1
- import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
1
+ import * as class_variance_authority_types from 'class-variance-authority/types';
2
2
  import * as React from 'react';
3
3
  import * as LabelPrimitive from '@radix-ui/react-label';
4
4
  import { VariantProps } from 'class-variance-authority';
5
5
 
6
- declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: class_variance_authority_dist_types.ClassProp | undefined) => string> & React.RefAttributes<HTMLLabelElement>>;
6
+ declare const Label: React.ForwardRefExoticComponent<Omit<LabelPrimitive.LabelProps & React.RefAttributes<HTMLLabelElement>, "ref"> & VariantProps<(props?: class_variance_authority_types.ClassProp | undefined) => string> & React.RefAttributes<HTMLLabelElement>>;
7
7
 
8
8
  export { Label };
@@ -1,10 +1,10 @@
1
- import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
1
+ import * as class_variance_authority_types from 'class-variance-authority/types';
2
2
  import React__default from 'react';
3
3
  import { VariantProps } from 'class-variance-authority';
4
4
 
5
5
  declare const tagVariants: (props?: ({
6
6
  variant?: "default" | "success" | "warning" | "danger" | null | undefined;
7
- } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
7
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
8
8
  interface TagProps extends React__default.HTMLAttributes<HTMLDivElement>, VariantProps<typeof tagVariants> {
9
9
  showBullet?: boolean;
10
10
  onClose?: () => void;
@@ -1,10 +1,10 @@
1
- import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
1
+ import * as class_variance_authority_types from 'class-variance-authority/types';
2
2
  import React__default from 'react';
3
3
  import { VariantProps } from 'class-variance-authority';
4
4
 
5
5
  declare const tagVariants: (props?: ({
6
6
  variant?: "default" | "success" | "warning" | "danger" | null | undefined;
7
- } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
7
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
8
8
  interface TagProps extends React__default.HTMLAttributes<HTMLDivElement>, VariantProps<typeof tagVariants> {
9
9
  showBullet?: boolean;
10
10
  onClose?: () => void;
@@ -1,10 +1,10 @@
1
- import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
1
+ import * as class_variance_authority_types from 'class-variance-authority/types';
2
2
  import * as React from 'react';
3
3
  import { VariantProps } from 'class-variance-authority';
4
4
 
5
5
  declare const typographyVariants: (props?: ({
6
6
  variant?: "display-l" | "heading-xl" | "heading-lg" | "heading-md" | "heading-sm" | "subheading-lg" | "subheading-md" | "subheading-sm" | "body-bold-lg" | "body-bold-md" | "body-bold-sm" | "body-bold-xs" | "body-lg" | "body-md" | "body-sm" | "body-xs" | "caption-c1" | null | undefined;
7
- } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
7
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
8
8
  interface TypographyProps extends React.HTMLAttributes<HTMLElement>, VariantProps<typeof typographyVariants> {
9
9
  as?: React.ElementType;
10
10
  }
@@ -1,10 +1,10 @@
1
- import * as class_variance_authority_dist_types from 'class-variance-authority/dist/types';
1
+ import * as class_variance_authority_types from 'class-variance-authority/types';
2
2
  import * as React from 'react';
3
3
  import { VariantProps } from 'class-variance-authority';
4
4
 
5
5
  declare const typographyVariants: (props?: ({
6
6
  variant?: "display-l" | "heading-xl" | "heading-lg" | "heading-md" | "heading-sm" | "subheading-lg" | "subheading-md" | "subheading-sm" | "body-bold-lg" | "body-bold-md" | "body-bold-sm" | "body-bold-xs" | "body-lg" | "body-md" | "body-sm" | "body-xs" | "caption-c1" | null | undefined;
7
- } & class_variance_authority_dist_types.ClassProp) | undefined) => string;
7
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
8
8
  interface TypographyProps extends React.HTMLAttributes<HTMLElement>, VariantProps<typeof typographyVariants> {
9
9
  as?: React.ElementType;
10
10
  }
package/dist/index.d.mts CHANGED
@@ -36,7 +36,7 @@ export { ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyl
36
36
  export { Grid, GridItem, GridItemProps, GridProps, ResponsiveValue } from './molecules/grid/index.mjs';
37
37
  export { useModal } from './hooks/useModal.mjs';
38
38
  import 'clsx';
39
- import 'class-variance-authority/dist/types';
39
+ import 'class-variance-authority/types';
40
40
  import 'class-variance-authority';
41
41
  import '@radix-ui/react-checkbox';
42
42
  import '@radix-ui/react-label';
@@ -73,16 +73,34 @@ interface ModalProps {
73
73
  declare function Modal({ open, onClose, children }: ModalProps): react_jsx_runtime.JSX.Element | null;
74
74
 
75
75
  /**
76
- * Navigation item interface
76
+ * Navigation item interface for main menu items
77
77
  */
78
- interface NavigationItem {
78
+ interface MainNavigationItem {
79
+ id: string;
80
+ label: string;
81
+ icon?: React__default.ReactNode;
82
+ path: string;
83
+ badge?: string | number;
84
+ subItems?: SubNavigationItem[];
85
+ }
86
+ /**
87
+ * Navigation item interface for submenu items
88
+ */
89
+ interface SubNavigationItem {
90
+ id: string;
91
+ label: string;
92
+ path: string;
93
+ badge?: string | number;
94
+ }
95
+ /**
96
+ * Footer menu item interface
97
+ */
98
+ interface FooterMenuItem {
79
99
  id: string;
80
100
  label: string;
81
101
  icon?: React__default.ReactNode;
82
102
  path: string;
83
103
  badge?: string | number;
84
- children?: NavigationItem[];
85
- isCollapsible?: boolean;
86
104
  }
87
105
  /**
88
106
  * Brand information interface
@@ -98,14 +116,18 @@ interface BrandInfo {
98
116
  interface SidebarProps {
99
117
  /** Brand information displayed at the top */
100
118
  brand: BrandInfo;
101
- /** Navigation items */
102
- navigation: NavigationItem[];
119
+ /** Main navigation items with optional submenus */
120
+ mainNavigation: MainNavigationItem[];
121
+ /** Footer menu items (optional) */
122
+ footerMenu?: FooterMenuItem[];
123
+ /** Whether to show footer menu */
124
+ showFooterMenu?: boolean;
103
125
  /** Current active path */
104
126
  currentPath?: string;
105
127
  /** Whether the sidebar is collapsed */
106
128
  collapsed?: boolean;
107
129
  /** Callback when navigation item is clicked */
108
- onNavigate?: (item: NavigationItem) => void;
130
+ onNavigate?: (path: string, item: MainNavigationItem | SubNavigationItem | FooterMenuItem) => void;
109
131
  /** Callback when collapse toggle is clicked */
110
132
  onToggleCollapse?: () => void;
111
133
  /** Custom className */
@@ -114,17 +136,24 @@ interface SidebarProps {
114
136
  'data-testid'?: string;
115
137
  }
116
138
  /**
117
- * # Sidebar - Navigation Organismo
139
+ * # Sidebar - Navigation Organism
118
140
  *
119
141
  * ## 🚨 GRID SYSTEM COMPLIANCE
120
142
  *
121
- * Este componente está diseñado para ocupar **2 columnas** en el grid system del Raya Design System.
143
+ * Este componente está diseñado para ocupar **exactamente 2 columnas** en el grid system del Raya Design System.
122
144
  * Debe usarse dentro de un Grid container para mantener la consistencia de layouts.
123
145
  *
124
146
  * ### Features
125
- * - **Grid Integration**: Ocupa exactamente 2 columnas del sistema de grid
126
- * - **Responsive Behavior**: Se adapta a diferentes breakpoints
127
- * - **Navigation System**: Soporte para navegación jerárquica y badges
147
+ * - **Fixed Width**: Ocupa exactamente 2 columnas del sistema de grid (max-width: 200px)
148
+ * - **Main Navigation**: Elementos principales con iconos opcionales (sin chevron, sin fondo cuando submenu activo)
149
+ * - **Submenus**: Subitems con RightIcon, ancho completo respetando posición
150
+ * - **Clean Active States**: Solo el item directamente seleccionado tiene fondo oscuro
151
+ * - **Footer Menu**: Menu inferior opcional (configurable)
152
+ * - **Dynamic Content**: Navegación completamente dinámica via props
153
+ * - **Real Icons**: Usa iconos de la librería @grupor5/raya-icons (NO emojis)
154
+ * - **Smart Spacing**: Spacing optimizado entre texto y badges
155
+ * - **Text Ellipsis**: Texto se trunca con ellipsis si excede el ancho disponible
156
+ * - **Overflow Control**: Sin desbordamiento horizontal, respeta límites del grid
128
157
  * - **Brand Display**: Logo y información de marca
129
158
  * - **Collapsible**: Opción de colapsar para ahorrar espacio
130
159
  * - **Accessibility**: ARIA labels y navegación por teclado
@@ -143,40 +172,176 @@ interface SidebarProps {
143
172
  *
144
173
  * @example
145
174
  * ```tsx
146
- * // Basic sidebar with navigation
175
+ * // Import icons from raya-icons library
176
+ * import { HomeIcon } from '@grupor5/raya-icons/icons/HomeIcon';
177
+ * import { CategoryIcon } from '@grupor5/raya-icons/icons/CategoryIcon';
178
+ * import { DocumentIcon } from '@grupor5/raya-icons/icons/DocumentIcon';
179
+ * import { SettingIcon } from '@grupor5/raya-icons/icons/SettingIcon';
180
+ *
181
+ * // Sidebar with main navigation and submenus
147
182
  * <Sidebar
148
183
  * brand={{ name: "Manta Seguros" }}
149
- * navigation={[
150
- * { id: "dashboard", label: "Dashboard", icon: <HomeIcon />, path: "/" },
151
- * { id: "products", label: "Productos", icon: <ProductIcon />, path: "/products" },
184
+ * mainNavigation={[
185
+ * {
186
+ * id: "dashboard",
187
+ * label: "Dashboard",
188
+ * icon: <HomeIcon className="w-5 h-5" />,
189
+ * path: "/dashboard"
190
+ * },
191
+ * {
192
+ * id: "products",
193
+ * label: "Productos",
194
+ * icon: <CategoryIcon className="w-5 h-5" />,
195
+ * path: "/products",
196
+ * subItems: [
197
+ * { id: "tables", label: "Table's name", path: "/products/tables" }
198
+ * ]
199
+ * },
200
+ * {
201
+ * id: "policies",
202
+ * label: "Pólizas",
203
+ * icon: <DocumentIcon className="w-5 h-5" />,
204
+ * path: "/policies",
205
+ * subItems: [
206
+ * { id: "quote", label: "Cotizar", path: "/policies/quote" },
207
+ * { id: "issue", label: "Emitir", path: "/policies/issue" },
208
+ * { id: "modify", label: "Modificar", path: "/policies/modify" }
209
+ * ]
210
+ * }
211
+ * ]}
212
+ * footerMenu={[
213
+ * { id: "settings", label: "Configuración", icon: <SettingIcon className="w-5 h-5" />, path: "/settings" }
152
214
  * ]}
153
- * currentPath="/dashboard"
154
- * onNavigate={(item) => navigate(item.path)}
215
+ * showFooterMenu={true}
216
+ * currentPath="/products/tables"
217
+ * onNavigate={(path, item) => navigate(path)}
155
218
  * />
156
219
  * ```
220
+ */
221
+ declare const Sidebar: React__default.ForwardRefExoticComponent<SidebarProps & React__default.RefAttributes<HTMLDivElement>>;
222
+
223
+ interface NotificationItem {
224
+ id: string;
225
+ icon?: React__default.ReactNode;
226
+ badge?: string | number;
227
+ onClick?: () => void;
228
+ }
229
+ interface UserMenuOption {
230
+ id: string;
231
+ label: string;
232
+ icon?: React__default.ReactNode;
233
+ onClick?: () => void;
234
+ separator?: boolean;
235
+ }
236
+ interface UserProfile {
237
+ name: string;
238
+ email?: string;
239
+ avatar?: string;
240
+ role?: string;
241
+ menuOptions?: UserMenuOption[];
242
+ }
243
+ interface TopNavbarProps {
244
+ /** Whether the sidebar is collapsed/hidden */
245
+ sidebarCollapsed?: boolean;
246
+ /** Callback when hamburger menu is clicked */
247
+ onToggleSidebar?: () => void;
248
+ /** Notification items array (extensible for future menus) */
249
+ notifications?: NotificationItem[];
250
+ /** User profile information */
251
+ userProfile: UserProfile;
252
+ /** Callback when user menu actions are triggered */
253
+ onUserMenuClick?: (action: string) => void;
254
+ /** Custom className */
255
+ className?: string;
256
+ /** Data test id for testing */
257
+ 'data-testid'?: string;
258
+ }
259
+ /**
260
+ * # TopNavbar - Application Header Organism
261
+ *
262
+ * ## 🚨 GRID SYSTEM INTEGRATION
263
+ *
264
+ * Este componente está diseñado para integrarse con el sistema de grid dinámico:
265
+ * - **Con Sidebar**: Ocupa 10 columnas del content area
266
+ * - **Sin Sidebar**: Ocupa 12 columnas completas
267
+ * - **Responsive**: Se adapta automáticamente al estado del sidebar
268
+ *
269
+ * ### Features
270
+ * - **Hamburger Menu**: Toggle para mostrar/ocultar sidebar completamente
271
+ * - **Notifications Area**: Extensible para múltiples iconos y menús futuros
272
+ * - **User Profile Dropdown**: Avatar con menú desplegable completo
273
+ * - **Custom Menu Options**: Opciones de menú personalizables con iconos
274
+ * - **User Info Display**: Nombre, email y rol en el header del menú
275
+ * - **Dynamic Layout**: Se adapta de 10 a 12 columnas según estado del sidebar
276
+ * - **Badge System**: Notificaciones con contadores visuales
277
+ * - **Accessibility**: ARIA labels y navegación por teclado
278
+ *
279
+ * ### Grid Usage
280
+ * ```tsx
281
+ * <Grid cols={12} margin>
282
+ * {!sidebarCollapsed && (
283
+ * <GridItem span={{ mobile: 12, desktop: 2 }}>
284
+ * <Sidebar />
285
+ * </GridItem>
286
+ * )}
287
+ * <GridItem span={{
288
+ * mobile: 12,
289
+ * desktop: sidebarCollapsed ? 12 : 10
290
+ * }}>
291
+ * <TopNavbar
292
+ * sidebarCollapsed={sidebarCollapsed}
293
+ * onToggleSidebar={toggleSidebar}
294
+ * userProfile={userProfile}
295
+ * notifications={notifications}
296
+ * />
297
+ * <MainContent />
298
+ * </GridItem>
299
+ * </Grid>
300
+ * ```
157
301
  *
158
302
  * @example
159
303
  * ```tsx
160
- * // Sidebar with hierarchical navigation
161
- * <Sidebar
162
- * brand={{ name: "Admin Panel", tagline: "Management System" }}
163
- * navigation={[
304
+ * // Basic usage with sidebar integration and custom menu
305
+ * <TopNavbar
306
+ * sidebarCollapsed={false}
307
+ * onToggleSidebar={() => setSidebarCollapsed(!sidebarCollapsed)}
308
+ * userProfile={{
309
+ * name: "Ana Rodríguez",
310
+ * email: "ana@mantaseguros.com",
311
+ * role: "Administrator",
312
+ * menuOptions: [
313
+ * {
314
+ * id: "profile",
315
+ * label: "Mi perfil",
316
+ * icon: <UserIcon className="w-4 h-4" />,
317
+ * onClick: () => navigate('/profile')
318
+ * },
319
+ * {
320
+ * id: "settings",
321
+ * label: "Configuración",
322
+ * icon: <SettingIcon className="w-4 h-4" />,
323
+ * onClick: () => navigate('/settings')
324
+ * },
325
+ * {
326
+ * id: "logout",
327
+ * label: "Cerrar sesión",
328
+ * separator: true,
329
+ * onClick: () => handleLogout()
330
+ * }
331
+ * ]
332
+ * }}
333
+ * notifications={[
164
334
  * {
165
- * id: "products",
166
- * label: "Productos",
167
- * icon: <ProductIcon />,
168
- * path: "/products",
169
- * isCollapsible: true,
170
- * children: [
171
- * { id: "all-products", label: "Todos", path: "/products" },
172
- * { id: "categories", label: "Categorías", path: "/products/categories" }
173
- * ]
335
+ * id: "notifications",
336
+ * badge: "3",
337
+ * onClick: () => showNotifications()
174
338
  * }
175
339
  * ]}
340
+ * onUserMenuClick={(action) => handleUserAction(action)}
176
341
  * />
177
342
  * ```
178
343
  */
179
- declare const Sidebar: React__default.ForwardRefExoticComponent<SidebarProps & React__default.RefAttributes<HTMLDivElement>>;
344
+ declare const TopNavbar: React__default.ForwardRefExoticComponent<TopNavbarProps & React__default.RefAttributes<HTMLDivElement>>;
180
345
 
181
346
  interface AuthLayoutProps {
182
347
  children: ReactNode;
@@ -189,4 +354,4 @@ interface IconProps extends React.SVGProps<SVGSVGElement> {
189
354
  color?: string;
190
355
  }
191
356
 
192
- export { AuthLayout, type BrandInfo, type IconProps, Modal, type NavigationItem, Sidebar, type SidebarProps, type Size, ThemeProvider, useTheme };
357
+ export { AuthLayout, type BrandInfo, type FooterMenuItem, type IconProps, type MainNavigationItem, Modal, type NotificationItem, Sidebar, type SidebarProps, type Size, type SubNavigationItem, ThemeProvider, TopNavbar, type TopNavbarProps, type UserMenuOption, type UserProfile, useTheme };