siesa-ui-kit 1.0.2 → 1.0.4
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/README.md +115 -115
- package/bin/install.cjs +502 -502
- package/bin/prepare-publish.cjs +28 -28
- package/bin/restore-folders.cjs +28 -28
- package/claude/agents/siesa-ui-kit-specialist.md +2445 -0
- package/claude/prompts/component-template.md +121 -0
- package/claude/prompts/siesa-ui-kit.md +28 -0
- package/claude/settings.local.json +67 -2
- package/dist/components/Button/icons.d.ts +6 -5
- package/dist/components/Button/icons.d.ts.map +1 -1
- package/dist/components/DropdownItemCollapsible/DropdownItemCollapsible.d.ts.map +1 -1
- package/dist/components/DropdownItemCollapsible/DropdownItemCollapsible.types.d.ts +21 -0
- package/dist/components/DropdownItemCollapsible/DropdownItemCollapsible.types.d.ts.map +1 -1
- package/dist/components/NavigationRailCommercial/NavigationRailCommercial.d.ts +122 -0
- package/dist/components/NavigationRailCommercial/NavigationRailCommercial.d.ts.map +1 -0
- package/dist/components/NavigationRailCommercial/NavigationRailCommercial.types.d.ts +139 -0
- package/dist/components/NavigationRailCommercial/NavigationRailCommercial.types.d.ts.map +1 -0
- package/dist/components/NavigationRailCommercial/icons.d.ts +33 -0
- package/dist/components/NavigationRailCommercial/icons.d.ts.map +1 -0
- package/dist/components/NavigationRailCommercial/index.d.ts +4 -0
- package/dist/components/NavigationRailCommercial/index.d.ts.map +1 -0
- package/dist/components/NavigationRailItem/NavigationRailItem.d.ts.map +1 -1
- package/dist/components/NavigationRailItem/NavigationRailItem.types.d.ts +7 -0
- package/dist/components/NavigationRailItem/NavigationRailItem.types.d.ts.map +1 -1
- package/dist/components/NavigationRailTypes/NavigationRailTypes.d.ts.map +1 -1
- package/dist/components/NavigationRailTypes/NavigationRailTypes.types.d.ts +41 -0
- package/dist/components/NavigationRailTypes/NavigationRailTypes.types.d.ts.map +1 -1
- package/dist/components/NavigationRailTypes/icons.d.ts +15 -29
- package/dist/components/NavigationRailTypes/icons.d.ts.map +1 -1
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/icons.d.ts +6 -2
- package/dist/components/Select/icons.d.ts.map +1 -1
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/siesa-ui-kit.cjs +404 -190
- package/dist/siesa-ui-kit.cjs.map +1 -1
- package/dist/siesa-ui-kit.mjs +6590 -1506
- package/dist/siesa-ui-kit.mjs.map +1 -1
- package/dist/views/LayoutCommercial/LayoutCommercial.d.ts +48 -0
- package/dist/views/LayoutCommercial/LayoutCommercial.d.ts.map +1 -0
- package/dist/views/LayoutCommercial/LayoutCommercial.types.d.ts +49 -0
- package/dist/views/LayoutCommercial/LayoutCommercial.types.d.ts.map +1 -0
- package/dist/views/LayoutCommercial/index.d.ts +3 -0
- package/dist/views/LayoutCommercial/index.d.ts.map +1 -0
- package/docs/icons.md +12 -31
- package/package.json +111 -110
- package/src/components/Avatar/Avatar.stories.tsx +494 -494
- package/src/components/Button/Button.stories.tsx +950 -950
- package/src/components/Button/Button.tsx +337 -337
- package/src/components/Button/Button.types.ts +180 -180
- package/src/components/Button/icons.tsx +23 -62
- package/src/components/DescriptionList/DescriptionList.stories.tsx +250 -250
- package/src/components/Divider/Divider.stories.tsx +263 -263
- package/src/components/DropdownItemCollapsible/DropdownItemCollapsible.stories.tsx +317 -317
- package/src/components/DropdownItemCollapsible/DropdownItemCollapsible.tsx +307 -287
- package/src/components/DropdownItemCollapsible/DropdownItemCollapsible.types.ts +136 -111
- package/src/components/DropdownItemCollapsible/README.md +264 -264
- package/src/components/DropdownItemCollapsible/icons.tsx +57 -57
- package/src/components/DropdownItemCollapsible/index.ts +12 -12
- package/src/components/DropdownItemHeading/DropdownItemHeading.stories.tsx +386 -386
- package/src/components/DropdownItemHeading/DropdownItemHeading.tsx +216 -216
- package/src/components/DropdownItemHeading/DropdownItemHeading.types.ts +93 -93
- package/src/components/DropdownItemHeading/README.md +573 -573
- package/src/components/DropdownItemHeading/icons.tsx +125 -125
- package/src/components/DropdownItemHeading/index.ts +3 -3
- package/src/components/Input/Input.stories.tsx +583 -583
- package/src/components/LoginView/LoginView.stories.tsx +148 -148
- package/src/components/LoginView/LoginView.tsx +426 -426
- package/src/components/LoginView/LoginView.types.ts +52 -52
- package/src/components/LoginView/README.md +396 -396
- package/src/components/LoginView/icons.tsx +85 -85
- package/src/components/LoginView/index.ts +3 -3
- package/src/components/Navbar/Navbar.stories.tsx +810 -810
- package/src/components/Navbar/Navbar.tsx +755 -755
- package/src/components/Navbar/Navbar.types.ts +219 -219
- package/src/components/Navbar/README.md +279 -279
- package/src/components/Navbar/index.ts +8 -8
- package/src/components/NavigationRailCommercial/NavigationRailCommercial.stories.tsx +464 -0
- package/src/components/NavigationRailCommercial/NavigationRailCommercial.tsx +301 -0
- package/src/components/NavigationRailCommercial/NavigationRailCommercial.types.ts +162 -0
- package/src/components/NavigationRailCommercial/README.md +251 -0
- package/src/components/NavigationRailCommercial/icons.tsx +54 -0
- package/src/components/NavigationRailCommercial/index.ts +6 -0
- package/src/components/NavigationRailItem/NavigationRailItem.stories.tsx +667 -667
- package/src/components/NavigationRailItem/NavigationRailItem.tsx +314 -313
- package/src/components/NavigationRailItem/NavigationRailItem.types.ts +175 -167
- package/src/components/NavigationRailItem/README.md +476 -476
- package/src/components/NavigationRailItem/index.ts +2 -2
- package/src/components/NavigationRailPanel/NavigationRailPanel.stories.tsx +462 -462
- package/src/components/NavigationRailPanel/NavigationRailPanel.tsx +332 -332
- package/src/components/NavigationRailPanel/NavigationRailPanel.types.ts +178 -178
- package/src/components/NavigationRailPanel/README.md +461 -461
- package/src/components/NavigationRailPanel/index.ts +6 -6
- package/src/components/NavigationRailTypes/NavigationRailTypes.stories.tsx +682 -528
- package/src/components/NavigationRailTypes/NavigationRailTypes.tsx +363 -378
- package/src/components/NavigationRailTypes/NavigationRailTypes.types.ts +178 -130
- package/src/components/NavigationRailTypes/README.md +573 -573
- package/src/components/NavigationRailTypes/icons.tsx +76 -141
- package/src/components/NavigationRailTypes/index.ts +7 -7
- package/src/components/Notification/Notification.stories.tsx +513 -513
- package/src/components/Notification/Notification.tsx +145 -145
- package/src/components/Notification/Notification.types.ts +142 -142
- package/src/components/Notification/README.md +409 -409
- package/src/components/POSConvention/POSConvention.stories.tsx +235 -235
- package/src/components/POSConvention/POSConvention.tsx +129 -129
- package/src/components/POSConvention/POSConvention.types.ts +38 -38
- package/src/components/POSConvention/README.md +123 -123
- package/src/components/POSConvention/icons.tsx +45 -45
- package/src/components/POSConvention/index.ts +3 -3
- package/src/components/POSLocationButton/POSLocationButton.stories.tsx +531 -531
- package/src/components/POSLocationButton/POSLocationButton.tsx +247 -247
- package/src/components/POSLocationButton/POSLocationButton.types.ts +87 -87
- package/src/components/POSLocationButton/README.md +253 -253
- package/src/components/POSLocationButton/icons.tsx +120 -120
- package/src/components/POSLocationButton/index.ts +14 -14
- package/src/components/POSNumberButton/POSNumberButton.stories.tsx +415 -415
- package/src/components/POSNumberButton/POSNumberButton.tsx +179 -179
- package/src/components/POSNumberButton/POSNumberButton.types.ts +51 -51
- package/src/components/POSNumberButton/README.md +321 -321
- package/src/components/POSNumberButton/index.ts +3 -3
- package/src/components/POSProductButton/POSProductButton.stories.tsx +318 -318
- package/src/components/POSProductCard/POSProductCard.stories.tsx +642 -642
- package/src/components/POSProductCard/POSProductCard.tsx +208 -208
- package/src/components/POSProductCard/POSProductCard.types.ts +76 -76
- package/src/components/POSProductCard/README.md +179 -179
- package/src/components/POSProductCard/icons.tsx +26 -26
- package/src/components/POSProductCard/index.ts +2 -2
- package/src/components/POSProductSidebarItems/POSProductSidebarItems.stories.tsx +753 -753
- package/src/components/POSProductSidebarItems/POSProductSidebarItems.tsx +332 -332
- package/src/components/POSProductSidebarItems/POSProductSidebarItems.types.ts +119 -119
- package/src/components/POSProductSidebarItems/README.md +198 -198
- package/src/components/POSProductSidebarItems/icons.tsx +21 -21
- package/src/components/POSProductSidebarItems/index.ts +3 -3
- package/src/components/POSTable/POSTable.stories.tsx +737 -737
- package/src/components/POSTable/POSTable.tsx +401 -401
- package/src/components/POSTable/README.md +286 -286
- package/src/components/Quantity/Quantity.stories.tsx +457 -457
- package/src/components/Radio/Radio.stories.tsx +523 -523
- package/src/components/Radio/Radio.tsx +1 -1
- package/src/components/Select/Select.stories.tsx +32 -0
- package/src/components/Select/Select.tsx +457 -454
- package/src/components/Select/icons.tsx +16 -41
- package/src/components/SignUpView/SignUpView.stories.tsx +129 -129
- package/src/components/SignUpView/SignUpView.tsx +503 -503
- package/src/components/SignUpView/SignUpView.types.ts +58 -58
- package/src/components/SignUpView/icons.tsx +71 -71
- package/src/components/SignUpView/index.ts +3 -3
- package/src/components/Switch/README.md +112 -112
- package/src/components/Switch/Switch.stories.tsx +550 -550
- package/src/components/Switch/Switch.tsx +246 -246
- package/src/components/Switch/Switch.types.ts +67 -67
- package/src/components/Table/Table.stories.tsx +805 -805
- package/src/components/Tabs/README.md +201 -201
- package/src/components/Tabs/Tabs.stories.tsx +580 -580
- package/src/components/Tabs/Tabs.tsx +356 -356
- package/src/components/Tabs/Tabs.types.ts +127 -127
- package/src/components/Tabs/icons.tsx +129 -129
- package/src/components/Tabs/index.ts +11 -11
- package/src/components/Textarea/Textarea.stories.tsx +535 -535
- package/src/index.ts +133 -102
- package/src/views/LayoutCommercial/LayoutCommercial.stories.tsx +374 -0
- package/src/views/LayoutCommercial/LayoutCommercial.tsx +125 -0
- package/src/views/LayoutCommercial/LayoutCommercial.types.ts +54 -0
- package/src/views/LayoutCommercial/README.md +286 -0
- package/src/views/LayoutCommercial/index.ts +2 -0
- package/src/views/ListView/ListView.stories.tsx +329 -329
- package/src/views/ListView/ListView.tsx +570 -570
- package/src/views/ListView/ListView.types.ts +211 -211
- package/src/views/ListView/icons.tsx +282 -282
- package/src/views/ListView/index.ts +11 -11
- package/src/views/LoginView/LoginView.tsx +426 -426
- package/src/views/ProductsView/ProductsView.stories.tsx +344 -344
- package/src/views/ProductsView/ProductsView.tsx +480 -480
- package/src/views/ProductsView/ProductsView.types.ts +238 -238
- package/src/views/ProductsView/README.md +312 -312
- package/src/views/ProductsView/icons.tsx +38 -38
- package/src/views/ProductsView/index.ts +8 -8
- package/src/views/RecoverPasswordView/RecoverPasswordView.tsx +376 -376
- package/src/views/SignUpView/SignUpView.tsx +503 -503
- package/src/views/TableLayoutView/README.md +268 -268
- package/src/views/TableLayoutView/TableLayoutView.stories.tsx +235 -235
- package/src/views/TableLayoutView/TableLayoutView.tsx +461 -461
- package/src/views/TableLayoutView/TableLayoutView.types.ts +209 -209
- package/src/views/TableLayoutView/icons.tsx +113 -113
- package/src/views/TableLayoutView/index.ts +6 -6
- package/storybook/main.ts +19 -19
- package/storybook/preview.tsx +84 -84
- package/storybook/vitest.setup.ts +6 -6
- package/tailwind.config.js +128 -128
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Navbar } from '../../components/Navbar';
|
|
3
|
+
import { NavigationRailCommercial } from '../../components/NavigationRailCommercial';
|
|
4
|
+
import type { LayoutCommercialProps } from './LayoutCommercial.types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* LayoutCommercial - Layout general comercial del sistema Siesa
|
|
8
|
+
*
|
|
9
|
+
* Layout reutilizable que implementa la estructura base del sistema comercial
|
|
10
|
+
* con NavigationRail lateral, Navbar superior y área de contenido dinámico.
|
|
11
|
+
* Diseñado para ser usado como wrapper en diferentes vistas comerciales.
|
|
12
|
+
*
|
|
13
|
+
* **Composición:**
|
|
14
|
+
* - Navbar: Barra superior con logo Siesa, título del producto y dropdown de usuario
|
|
15
|
+
* - NavigationRailCommercial: Rail de navegación lateral con iconos y búsqueda
|
|
16
|
+
* - Área de contenido: Contenido dinámico pasado como children
|
|
17
|
+
*
|
|
18
|
+
* **Mejores prácticas implementadas:**
|
|
19
|
+
* - Orden de modificadores: {responsive}:{dark}:{state}:{utility}
|
|
20
|
+
* - Dark mode con estrategia 'class' (darkMode: 'class')
|
|
21
|
+
* - Tokens de color consistentes con la documentación
|
|
22
|
+
* - Responsive design mobile-first con breakpoints md:, lg:, xl:
|
|
23
|
+
* - Composición con componentes del sistema (NO reimplementación)
|
|
24
|
+
* - Type safety con TypeScript estricto
|
|
25
|
+
*
|
|
26
|
+
* @see docs/colors.md - Sistema de colores
|
|
27
|
+
* @see docs/typography.md - Sistema tipográfico
|
|
28
|
+
* @see docs/spacing.md - Sistema de espaciado
|
|
29
|
+
* @see src/components/Navbar - Componente Navbar reutilizado
|
|
30
|
+
* @see src/components/NavigationRailCommercial - Componente NavigationRail reutilizado
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```tsx
|
|
34
|
+
* <LayoutCommercial
|
|
35
|
+
* productName="SB Comercial"
|
|
36
|
+
* userDropdown={{
|
|
37
|
+
* avatar: '/avatar.jpg',
|
|
38
|
+
* name: 'Carlos',
|
|
39
|
+
* email: 'carlos@siesa.com',
|
|
40
|
+
* }}
|
|
41
|
+
* navigationItems={navigationItems}
|
|
42
|
+
* >
|
|
43
|
+
* <div>
|
|
44
|
+
* <h1>Mi contenido personalizado</h1>
|
|
45
|
+
* <p>Cualquier contenido puede ir aquí</p>
|
|
46
|
+
* </div>
|
|
47
|
+
* </LayoutCommercial>
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
export const LayoutCommercial: React.FC<LayoutCommercialProps> = ({
|
|
51
|
+
productName = 'SB Comercial',
|
|
52
|
+
userDropdown,
|
|
53
|
+
navigationItems,
|
|
54
|
+
children,
|
|
55
|
+
className = '',
|
|
56
|
+
contentClassName = '',
|
|
57
|
+
}) => {
|
|
58
|
+
// Estado local para el NavigationRail
|
|
59
|
+
const [navState, setNavState] = useState<'collapsed' | 'expanded' | 'hover' | 'searcher'>('collapsed');
|
|
60
|
+
|
|
61
|
+
// Handler para cambio de estado del NavigationRail
|
|
62
|
+
const handleNavStateChange = (state: 'collapsed' | 'expanded' | 'hover' | 'searcher' | undefined) => {
|
|
63
|
+
if (state) {
|
|
64
|
+
setNavState(state);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<div
|
|
70
|
+
className={[
|
|
71
|
+
// ===== BASE CONTAINER =====
|
|
72
|
+
'h-screen', // Altura fija de pantalla completa
|
|
73
|
+
'w-full',
|
|
74
|
+
'bg-white', // Fondo blanco para Navbar y NavigationRail
|
|
75
|
+
'dark:bg-dark-bg-primary',
|
|
76
|
+
'flex',
|
|
77
|
+
'flex-col',
|
|
78
|
+
'overflow-hidden', // Prevenir scroll en contenedor principal
|
|
79
|
+
className,
|
|
80
|
+
]
|
|
81
|
+
.join(' ')
|
|
82
|
+
.replace(/\s+/g, ' ')
|
|
83
|
+
.trim()}
|
|
84
|
+
>
|
|
85
|
+
{/* ===== NAVBAR ===== */}
|
|
86
|
+
<Navbar
|
|
87
|
+
productName={productName}
|
|
88
|
+
userDropdown={userDropdown}
|
|
89
|
+
hideActionButtons
|
|
90
|
+
showSiesaLogoLeading
|
|
91
|
+
showBusinessLogo={false}
|
|
92
|
+
className="bg-white dark:bg-dark-bg-primary"
|
|
93
|
+
/>
|
|
94
|
+
|
|
95
|
+
{/* ===== LAYOUT: NAVIGATION RAIL + CONTENT ===== */}
|
|
96
|
+
<div className="flex flex-1 overflow-hidden">
|
|
97
|
+
{/* ===== NAVIGATION RAIL ===== */}
|
|
98
|
+
<NavigationRailCommercial
|
|
99
|
+
state={navState}
|
|
100
|
+
items={navigationItems}
|
|
101
|
+
showSearchButton={false}
|
|
102
|
+
onStateChange={handleNavStateChange}
|
|
103
|
+
onItemClick={(item) => console.log('Item clicked:', item)}
|
|
104
|
+
onItemHover={(item) => console.log('Item hover:', item)}
|
|
105
|
+
/>
|
|
106
|
+
|
|
107
|
+
{/* ===== CONTENT AREA ===== */}
|
|
108
|
+
<div
|
|
109
|
+
className={[
|
|
110
|
+
'flex-1',
|
|
111
|
+
'overflow-y-auto',
|
|
112
|
+
'bg-gray-50',
|
|
113
|
+
'dark:bg-dark-bg-primary',
|
|
114
|
+
contentClassName,
|
|
115
|
+
]
|
|
116
|
+
.join(' ')
|
|
117
|
+
.replace(/\s+/g, ' ')
|
|
118
|
+
.trim()}
|
|
119
|
+
>
|
|
120
|
+
{children}
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
</div>
|
|
124
|
+
);
|
|
125
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { UserDropdownProps } from '../../components/Navbar/Navbar.types';
|
|
3
|
+
import type { NavigationRailCommercialMenuItem } from '../../components/NavigationRailCommercial/NavigationRailCommercial.types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Props del componente LayoutCommercial
|
|
7
|
+
*
|
|
8
|
+
* Layout general comercial con NavigationRail lateral, Navbar superior y área
|
|
9
|
+
* de contenido dinámico. Diseñado para ser reutilizado en diferentes vistas
|
|
10
|
+
* del sistema comercial.
|
|
11
|
+
*
|
|
12
|
+
* **Mejores prácticas implementadas:**
|
|
13
|
+
* - Orden de modificadores: {responsive}:{dark}:{state}:{utility}
|
|
14
|
+
* - Dark mode con estrategia 'class' (darkMode: 'class')
|
|
15
|
+
* - Tokens de color consistentes con la documentación
|
|
16
|
+
* - Responsive design mobile-first
|
|
17
|
+
* - Composición con componentes del sistema
|
|
18
|
+
*
|
|
19
|
+
* @see docs/colors.md - Sistema de colores
|
|
20
|
+
* @see docs/typography.md - Sistema tipográfico
|
|
21
|
+
* @see docs/spacing.md - Sistema de espaciado
|
|
22
|
+
*/
|
|
23
|
+
export interface LayoutCommercialProps {
|
|
24
|
+
/**
|
|
25
|
+
* Nombre del producto que aparece en el Navbar
|
|
26
|
+
* @default 'SB Comercial'
|
|
27
|
+
*/
|
|
28
|
+
productName?: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Configuración del dropdown de usuario en el Navbar
|
|
32
|
+
*/
|
|
33
|
+
userDropdown?: UserDropdownProps;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Items de navegación para el NavigationRail
|
|
37
|
+
*/
|
|
38
|
+
navigationItems?: NavigationRailCommercialMenuItem[];
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Contenido dinámico que se renderiza en el área principal
|
|
42
|
+
*/
|
|
43
|
+
children?: ReactNode;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Clases CSS adicionales para el contenedor principal
|
|
47
|
+
*/
|
|
48
|
+
className?: string;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Clases CSS adicionales para el área de contenido
|
|
52
|
+
*/
|
|
53
|
+
contentClassName?: string;
|
|
54
|
+
}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
# LayoutCommercial
|
|
2
|
+
|
|
3
|
+
Vista completa de layout comercial del sistema Siesa con NavigationRail lateral, Navbar superior y formulario de configuración de ítems.
|
|
4
|
+
|
|
5
|
+
## Captura del diseño
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
## Descripción
|
|
10
|
+
|
|
11
|
+
`LayoutCommercial` es una vista completa que implementa el layout comercial estándar de Siesa. Compone múltiples componentes del sistema para crear una interfaz cohesiva de gestión comercial con formulario de configuración de ítems.
|
|
12
|
+
|
|
13
|
+
### Composición
|
|
14
|
+
|
|
15
|
+
La vista está compuesta por los siguientes componentes del sistema:
|
|
16
|
+
|
|
17
|
+
| Componente | Ubicación | Descripción |
|
|
18
|
+
|------------|-----------|-------------|
|
|
19
|
+
| **Navbar** | Superior | Barra de navegación con logo Siesa, título "SB Comercial" y dropdown de usuario |
|
|
20
|
+
| **NavigationRailCommercial** | Lateral izquierdo | Rail de navegación con iconos (Configuración, Carrito, Productos, Documentos) |
|
|
21
|
+
| **Input** | Área de contenido | Campos de entrada para código, nombre y configuración |
|
|
22
|
+
| **Select** | Área de contenido | Selectores para extensiones, modelo de costo y lotes |
|
|
23
|
+
| **Radio** | Área de contenido | Selección entre "Inventario" y "Servicio" |
|
|
24
|
+
| **Checkbox** | Área de contenido | Opciones múltiples para permisos y características |
|
|
25
|
+
|
|
26
|
+
## Características
|
|
27
|
+
|
|
28
|
+
- **Dark mode completo**: Soporte para tema claro y oscuro en todos los componentes
|
|
29
|
+
- **Responsive design**: Adaptación automática a diferentes tamaños de pantalla
|
|
30
|
+
- **TypeScript estricto**: Type safety completo con interfaces bien definadas
|
|
31
|
+
- **Composición de componentes**: Reutiliza componentes del sistema (NO reimplementación)
|
|
32
|
+
- **State management**: Control de estado del formulario mediante callback
|
|
33
|
+
- **Tokens del sistema**: Colores, espaciado y tipografía consistentes
|
|
34
|
+
|
|
35
|
+
## Uso básico
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import { LayoutCommercial } from './views/LayoutCommercial';
|
|
39
|
+
import {
|
|
40
|
+
Cog6ToothIcon,
|
|
41
|
+
ShoppingCartIcon,
|
|
42
|
+
CubeIcon,
|
|
43
|
+
DocumentIcon,
|
|
44
|
+
} from './components/NavigationRailCommercial/icons';
|
|
45
|
+
|
|
46
|
+
const App = () => {
|
|
47
|
+
const [formData, setFormData] = useState({
|
|
48
|
+
codigoItem: '',
|
|
49
|
+
nombre: '',
|
|
50
|
+
tipoItem: 'inventario',
|
|
51
|
+
// ... más campos
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const navigationItems = [
|
|
55
|
+
{
|
|
56
|
+
id: 'config',
|
|
57
|
+
label: 'Configuración',
|
|
58
|
+
icon: <Cog6ToothIcon />,
|
|
59
|
+
active: true,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: 'cart',
|
|
63
|
+
label: 'Carrito',
|
|
64
|
+
icon: <ShoppingCartIcon />,
|
|
65
|
+
},
|
|
66
|
+
// ... más items
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<LayoutCommercial
|
|
71
|
+
productName="SB Comercial"
|
|
72
|
+
userDropdown={{
|
|
73
|
+
avatar: '/avatar.jpg',
|
|
74
|
+
name: 'Carlos',
|
|
75
|
+
email: 'carlos@siesa.com',
|
|
76
|
+
}}
|
|
77
|
+
navigationItems={navigationItems}
|
|
78
|
+
formData={formData}
|
|
79
|
+
onFormChange={setFormData}
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Props
|
|
86
|
+
|
|
87
|
+
### LayoutCommercialProps
|
|
88
|
+
|
|
89
|
+
| Prop | Tipo | Default | Descripción |
|
|
90
|
+
|------|------|---------|-------------|
|
|
91
|
+
| `productName` | `string` | `'SB Comercial'` | Nombre del producto en el Navbar |
|
|
92
|
+
| `userDropdown` | `UserDropdownProps` | `undefined` | Configuración del dropdown de usuario |
|
|
93
|
+
| `navigationItems` | `NavigationRailCommercialMenuItem[]` | `undefined` | Items del NavigationRail |
|
|
94
|
+
| `formData` | `FormData` | `undefined` | Datos del formulario |
|
|
95
|
+
| `onFormChange` | `(data: FormData) => void` | `undefined` | Callback cuando cambian los datos |
|
|
96
|
+
| `className` | `string` | `''` | Clases CSS adicionales |
|
|
97
|
+
|
|
98
|
+
### FormData
|
|
99
|
+
|
|
100
|
+
| Campo | Tipo | Descripción |
|
|
101
|
+
|-------|------|-------------|
|
|
102
|
+
| `codigoItem` | `string` | Código único del ítem |
|
|
103
|
+
| `nombre` | `string` | Nombre del ítem |
|
|
104
|
+
| `tipoItem` | `'inventario' \| 'servicio'` | Tipo de ítem |
|
|
105
|
+
| `extension1` | `string` | Extensión 1 (ej: Color) |
|
|
106
|
+
| `extension2` | `string` | Extensión 2 (ej: Talla) |
|
|
107
|
+
| `modeloCosto` | `string` | Modelo de costo (FIFO, LIFO, Promedio) |
|
|
108
|
+
| `configuracionSerial` | `string` | Configuración del serial |
|
|
109
|
+
| `manejaLotes` | `string` | Si maneja lotes |
|
|
110
|
+
| `manejaSeriales` | `boolean` | Si maneja seriales |
|
|
111
|
+
| `procesoManufactura` | `boolean` | Si tiene procesos de manufactura/MRP |
|
|
112
|
+
| `puedeComprarse` | `boolean` | Si puede comprarse |
|
|
113
|
+
| `puedeVenderse` | `boolean` | Si puede venderse |
|
|
114
|
+
| `permitir*` | `boolean` | Permisos de modificación para cada campo |
|
|
115
|
+
|
|
116
|
+
## Ejemplos
|
|
117
|
+
|
|
118
|
+
### Formulario vacío
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
<LayoutCommercial
|
|
122
|
+
productName="SB Comercial"
|
|
123
|
+
userDropdown={{
|
|
124
|
+
avatar: '/avatar.jpg',
|
|
125
|
+
name: 'Carlos',
|
|
126
|
+
email: 'carlos@siesa.com',
|
|
127
|
+
}}
|
|
128
|
+
navigationItems={navigationItems}
|
|
129
|
+
formData={{
|
|
130
|
+
codigoItem: '',
|
|
131
|
+
nombre: '',
|
|
132
|
+
tipoItem: 'inventario',
|
|
133
|
+
}}
|
|
134
|
+
onFormChange={(data) => console.log(data)}
|
|
135
|
+
/>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Formulario con datos
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
<LayoutCommercial
|
|
142
|
+
productName="SB Comercial"
|
|
143
|
+
userDropdown={{
|
|
144
|
+
avatar: '/avatar.jpg',
|
|
145
|
+
name: 'Carlos',
|
|
146
|
+
email: 'carlos@siesa.com',
|
|
147
|
+
}}
|
|
148
|
+
navigationItems={navigationItems}
|
|
149
|
+
formData={{
|
|
150
|
+
codigoItem: 'ITEM-001',
|
|
151
|
+
nombre: 'Producto de Ejemplo',
|
|
152
|
+
tipoItem: 'inventario',
|
|
153
|
+
extension1: 'azul',
|
|
154
|
+
extension2: 'm',
|
|
155
|
+
modeloCosto: 'fifo',
|
|
156
|
+
manejaLotes: 'si',
|
|
157
|
+
manejaSeriales: true,
|
|
158
|
+
puedeComprarse: true,
|
|
159
|
+
puedeVenderse: true,
|
|
160
|
+
}}
|
|
161
|
+
onFormChange={(data) => console.log(data)}
|
|
162
|
+
/>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Tipo servicio
|
|
166
|
+
|
|
167
|
+
```tsx
|
|
168
|
+
<LayoutCommercial
|
|
169
|
+
productName="SB Comercial"
|
|
170
|
+
userDropdown={{
|
|
171
|
+
avatar: '/avatar.jpg',
|
|
172
|
+
name: 'Carlos',
|
|
173
|
+
email: 'carlos@siesa.com',
|
|
174
|
+
}}
|
|
175
|
+
navigationItems={navigationItems}
|
|
176
|
+
formData={{
|
|
177
|
+
codigoItem: 'SERV-001',
|
|
178
|
+
nombre: 'Servicio de Consultoría',
|
|
179
|
+
tipoItem: 'servicio',
|
|
180
|
+
puedeVenderse: true,
|
|
181
|
+
}}
|
|
182
|
+
onFormChange={(data) => console.log(data)}
|
|
183
|
+
/>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Estructura del formulario
|
|
187
|
+
|
|
188
|
+
### Sección: Información básica
|
|
189
|
+
|
|
190
|
+
- **Código de ítem** (Input): Campo de texto para el código único
|
|
191
|
+
- **Nombre** (Input): Campo de texto para el nombre del ítem
|
|
192
|
+
- **Tipo** (Radio): Selección entre "Inventario" y "Servicio"
|
|
193
|
+
- **Extensión 1** (Select): Selector para primera extensión (ej: Color)
|
|
194
|
+
- **Extensión 2** (Select): Selector para segunda extensión (ej: Talla)
|
|
195
|
+
- **Modelo de costo** (Select): Selector para modelo de costo (FIFO, LIFO, Promedio)
|
|
196
|
+
- **Configuración del serial** (Input): Campo para configuración del serial
|
|
197
|
+
- **Maneja lotes** (Select): Selector Sí/No para manejo de lotes
|
|
198
|
+
- **Maneja seriales** (Checkbox): Checkbox para habilitar seriales
|
|
199
|
+
- **Procesos de manufactura/MRP** (Checkbox): Checkbox para procesos
|
|
200
|
+
- **Puede comprarse** (Checkbox): Checkbox para compras
|
|
201
|
+
- **Puede venderse** (Checkbox): Checkbox para ventas
|
|
202
|
+
|
|
203
|
+
### Sección: Permitir modificar ítem
|
|
204
|
+
|
|
205
|
+
Grid de checkboxes que controlan qué campos pueden modificarse:
|
|
206
|
+
|
|
207
|
+
- Extensión 1
|
|
208
|
+
- Extensión 2
|
|
209
|
+
- Modelo de costo
|
|
210
|
+
- Maneja lotes
|
|
211
|
+
- Maneja seriales
|
|
212
|
+
- Configuración del serial
|
|
213
|
+
- Proceso de manufactura
|
|
214
|
+
- Compras
|
|
215
|
+
- Ventas
|
|
216
|
+
|
|
217
|
+
## Tokens de diseño
|
|
218
|
+
|
|
219
|
+
### Colores
|
|
220
|
+
|
|
221
|
+
| Elemento | Light Mode | Dark Mode |
|
|
222
|
+
|----------|------------|-----------|
|
|
223
|
+
| Background principal | `bg-background-secondary` | `dark:bg-dark-bg-primary` |
|
|
224
|
+
| Cards/Formulario | `bg-white` | `dark:bg-dark-bg-primary` |
|
|
225
|
+
| Texto principal | `text-content-primary` | `dark:text-dark-content-primary` |
|
|
226
|
+
| Bordes | `border-border-primary` | `dark:border-dark-border-primary` |
|
|
227
|
+
|
|
228
|
+
### Espaciado
|
|
229
|
+
|
|
230
|
+
- **Padding contenedor**: `p-8` (32px)
|
|
231
|
+
- **Gap entre secciones**: `space-y-6` (24px)
|
|
232
|
+
- **Padding cards**: `p-6` (24px)
|
|
233
|
+
- **Gap entre campos**: `gap-4` (16px)
|
|
234
|
+
|
|
235
|
+
### Tipografía
|
|
236
|
+
|
|
237
|
+
- **Título página**: `text-2xl font-bold` (24px)
|
|
238
|
+
- **Título sección**: `text-lg font-semibold` (18px)
|
|
239
|
+
- **Labels**: `text-sm` (14px) - definido en componentes Input/Select/Checkbox
|
|
240
|
+
|
|
241
|
+
## Responsive Design
|
|
242
|
+
|
|
243
|
+
La vista se adapta automáticamente:
|
|
244
|
+
|
|
245
|
+
| Breakpoint | Comportamiento |
|
|
246
|
+
|------------|----------------|
|
|
247
|
+
| **Mobile** (`< 768px`) | Una columna para todos los campos |
|
|
248
|
+
| **Tablet** (`≥ 768px`) | Grid de 2 columnas para campos relacionados |
|
|
249
|
+
| **Desktop** (`≥ 1024px`) | Layout completo con NavigationRail, Navbar y contenido |
|
|
250
|
+
|
|
251
|
+
## Componentes reutilizados
|
|
252
|
+
|
|
253
|
+
Esta vista NO reimplementa componentes. Todos son importados del sistema:
|
|
254
|
+
|
|
255
|
+
```tsx
|
|
256
|
+
import { Navbar } from '../../components/Navbar';
|
|
257
|
+
import { NavigationRailCommercial } from '../../components/NavigationRailCommercial';
|
|
258
|
+
import { Input } from '../../components/Input';
|
|
259
|
+
import { Select } from '../../components/Select';
|
|
260
|
+
import { Radio } from '../../components/Radio/Radio';
|
|
261
|
+
import { Checkbox } from '../../components/Checkbox/Checkbox';
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## Mejores prácticas implementadas
|
|
265
|
+
|
|
266
|
+
- ✅ **Composición sobre reimplementación**: Usa componentes existentes
|
|
267
|
+
- ✅ **Dark mode completo**: Todos los elementos tienen variante dark
|
|
268
|
+
- ✅ **Tokens del sistema**: Colores, espaciado y tipografía consistentes
|
|
269
|
+
- ✅ **TypeScript estricto**: Type safety en props y estado
|
|
270
|
+
- ✅ **Responsive design**: Mobile-first con breakpoints
|
|
271
|
+
- ✅ **State management**: Control de estado mediante callback
|
|
272
|
+
- ✅ **Documentación completa**: JSDoc en código y README
|
|
273
|
+
- ✅ **Accesibilidad**: Labels y ARIA en componentes
|
|
274
|
+
|
|
275
|
+
## Relacionado
|
|
276
|
+
|
|
277
|
+
- [Navbar](../../components/Navbar/README.md)
|
|
278
|
+
- [NavigationRailCommercial](../../components/NavigationRailCommercial/README.md)
|
|
279
|
+
- [Input](../../components/Input/README.md)
|
|
280
|
+
- [Select](../../components/Select/README.md)
|
|
281
|
+
- [Checkbox](../../components/Checkbox/README.md)
|
|
282
|
+
- [Radio](../../components/Radio/README.md)
|
|
283
|
+
|
|
284
|
+
## Figma
|
|
285
|
+
|
|
286
|
+
Diseño original: [LayoutCommercial en Figma](https://www.figma.com/design/T675Nqfx0myJSt1GmRAYao/SB-Comercial?node-id=145-1383&m=dev)
|