@soyfri/shared-library 2.0.0-beta.0 → 2.0.0-beta.2

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.
Files changed (181) hide show
  1. package/dist/components/Icon/Icon.js +1 -1
  2. package/dist/components/Table/Table.js +1 -1
  3. package/package.json +32 -4
  4. package/.dockerignore +0 -8
  5. package/.github/workflows/publish.yml +0 -107
  6. package/.prettierrc +0 -3
  7. package/.storybook/main.ts +0 -19
  8. package/.storybook/preview.ts +0 -14
  9. package/.storybook/vitest.setup.ts +0 -9
  10. package/Dockerfile +0 -37
  11. package/build.js +0 -102
  12. package/chromatic.config.json +0 -5
  13. package/cleanDirectories.js +0 -40
  14. package/rollup.config.cjs +0 -87
  15. package/src/components/ActionMenu/ActionMenu.stories.tsx +0 -230
  16. package/src/components/ActionMenu/ActionMenu.tsx +0 -174
  17. package/src/components/ActionMenu/index.ts +0 -2
  18. package/src/components/AppBar/AppBar.stories.tsx +0 -272
  19. package/src/components/AppBar/AppBar.sx.ts +0 -32
  20. package/src/components/AppBar/AppBar.tsx +0 -123
  21. package/src/components/AppBar/AppBarBrand.tsx +0 -120
  22. package/src/components/AppBar/AppBarContext.ts +0 -25
  23. package/src/components/AppBar/AppBarMenuToggle.tsx +0 -90
  24. package/src/components/AppBar/AppBarUserMenu.tsx +0 -217
  25. package/src/components/AppBar/index.ts +0 -25
  26. package/src/components/Autocomplete/Autocomplete.definitions.ts +0 -477
  27. package/src/components/Autocomplete/Autocomplete.helpers.ts +0 -60
  28. package/src/components/Autocomplete/Autocomplete.stories.tsx +0 -748
  29. package/src/components/Autocomplete/Autocomplete.sx.ts +0 -30
  30. package/src/components/Autocomplete/Autocomplete.tsx +0 -361
  31. package/src/components/Autocomplete/Autocomplete.types.ts +0 -13
  32. package/src/components/Autocomplete/_parts/AutocompleteChips.tsx +0 -55
  33. package/src/components/Autocomplete/_parts/AutocompleteLoader.tsx +0 -17
  34. package/src/components/Autocomplete/_parts/AutocompleteOption.tsx +0 -31
  35. package/src/components/Autocomplete/index.ts +0 -12
  36. package/src/components/Avatar/Avatar.definitions.ts +0 -162
  37. package/src/components/Avatar/Avatar.stories.tsx +0 -258
  38. package/src/components/Avatar/Avatar.tsx +0 -206
  39. package/src/components/Avatar/index.ts +0 -1
  40. package/src/components/Button/Button.definition.ts +0 -97
  41. package/src/components/Button/Button.stories.tsx +0 -285
  42. package/src/components/Button/Button.tsx +0 -67
  43. package/src/components/Button/index.ts +0 -1
  44. package/src/components/Card/Card.definition.ts +0 -5
  45. package/src/components/Card/Card.stories.tsx +0 -221
  46. package/src/components/Card/Card.sx.ts +0 -104
  47. package/src/components/Card/Card.tsx +0 -200
  48. package/src/components/Card/index.ts +0 -9
  49. package/src/components/Chip/Chip.definitions.ts +0 -167
  50. package/src/components/Chip/Chip.stories.tsx +0 -265
  51. package/src/components/Chip/Chip.tsx +0 -61
  52. package/src/components/Chip/index.ts +0 -1
  53. package/src/components/Column/Column.tsx +0 -29
  54. package/src/components/Column/index.ts +0 -1
  55. package/src/components/DatePicker/DatePicker.definitions.ts +0 -228
  56. package/src/components/DatePicker/DatePicker.helpers.ts +0 -24
  57. package/src/components/DatePicker/DatePicker.stories.tsx +0 -309
  58. package/src/components/DatePicker/DatePicker.sx.ts +0 -33
  59. package/src/components/DatePicker/DatePicker.tsx +0 -189
  60. package/src/components/DatePicker/DatePicker.types.ts +0 -10
  61. package/src/components/DatePicker/index.ts +0 -9
  62. package/src/components/DateRangePicker/DateRangePicker.definitions.ts +0 -191
  63. package/src/components/DateRangePicker/DateRangePicker.stories.tsx +0 -252
  64. package/src/components/DateRangePicker/DateRangePicker.tsx +0 -56
  65. package/src/components/DateRangePicker/index.ts +0 -1
  66. package/src/components/DateTimePicker/DateTimePicker.definitions.ts +0 -256
  67. package/src/components/DateTimePicker/DateTimePicker.helpers.ts +0 -38
  68. package/src/components/DateTimePicker/DateTimePicker.stories.tsx +0 -418
  69. package/src/components/DateTimePicker/DateTimePicker.sx.ts +0 -30
  70. package/src/components/DateTimePicker/DateTimePicker.tsx +0 -225
  71. package/src/components/DateTimePicker/DateTimePicker.types.ts +0 -10
  72. package/src/components/DateTimePicker/index.ts +0 -9
  73. package/src/components/Drawer/Drawer.stories.tsx +0 -270
  74. package/src/components/Drawer/Drawer.sx.ts +0 -106
  75. package/src/components/Drawer/Drawer.tsx +0 -214
  76. package/src/components/Drawer/DrawerContext.ts +0 -26
  77. package/src/components/Drawer/DrawerItem.tsx +0 -110
  78. package/src/components/Drawer/index.ts +0 -10
  79. package/src/components/Flyout/Flyout.stories.tsx +0 -282
  80. package/src/components/Flyout/Flyout.tsx +0 -122
  81. package/src/components/Flyout/index.ts +0 -1
  82. package/src/components/Gallery/Gallery.definition.tsx +0 -37
  83. package/src/components/Gallery/Gallery.stories.tsx +0 -82
  84. package/src/components/Gallery/Gallery.tsx +0 -118
  85. package/src/components/Gallery/GalleryLightbox.tsx +0 -170
  86. package/src/components/Gallery/GalleryMain.tsx +0 -84
  87. package/src/components/Gallery/GalleryThumbnails.tsx +0 -106
  88. package/src/components/Gallery/index.ts +0 -1
  89. package/src/components/Icon/Icon.stories.tsx +0 -121
  90. package/src/components/Icon/Icon.tsx +0 -175
  91. package/src/components/Icon/index.ts +0 -2
  92. package/src/components/Input/Input.definitions.ts +0 -324
  93. package/src/components/Input/Input.helpers.ts +0 -49
  94. package/src/components/Input/Input.stories.tsx +0 -499
  95. package/src/components/Input/Input.sx.ts +0 -42
  96. package/src/components/Input/Input.tsx +0 -141
  97. package/src/components/Input/Input.types.ts +0 -10
  98. package/src/components/Input/index.ts +0 -9
  99. package/src/components/InputGroup/InputGroup.definitions.ts +0 -158
  100. package/src/components/InputGroup/InputGroup.stories.tsx +0 -267
  101. package/src/components/InputGroup/InputGroup.tsx +0 -179
  102. package/src/components/InputGroup/index.ts +0 -1
  103. package/src/components/MenuButton/MenuButton.stories.tsx +0 -197
  104. package/src/components/MenuButton/MenuButton.tsx +0 -100
  105. package/src/components/MenuButton/index.ts +0 -1
  106. package/src/components/Modal/Modal.stories.tsx +0 -721
  107. package/src/components/Modal/Modal.tsx +0 -355
  108. package/src/components/Modal/ModalBody.tsx +0 -16
  109. package/src/components/Modal/ModalFooter.tsx +0 -71
  110. package/src/components/Modal/ModalHeader.tsx +0 -18
  111. package/src/components/Modal/index.ts +0 -6
  112. package/src/components/PageLoader/PageLoader.stories.tsx +0 -217
  113. package/src/components/PageLoader/PageLoader.tsx +0 -96
  114. package/src/components/PageLoader/index.ts +0 -2
  115. package/src/components/ScrollTopButton/ScrollTopButton.stories.tsx +0 -158
  116. package/src/components/ScrollTopButton/ScrollTopButton.tsx +0 -135
  117. package/src/components/ScrollTopButton/index.ts +0 -8
  118. package/src/components/ScrollTopButton/scrollToTop.ts +0 -37
  119. package/src/components/Select/Select.definitions.ts +0 -602
  120. package/src/components/Select/Select.helpers.ts +0 -71
  121. package/src/components/Select/Select.stories.tsx +0 -687
  122. package/src/components/Select/Select.sx.ts +0 -14
  123. package/src/components/Select/Select.tsx +0 -429
  124. package/src/components/Select/Select.types.ts +0 -15
  125. package/src/components/Select/_parts/SelectMenuItem.tsx +0 -40
  126. package/src/components/Select/_parts/SelectSearchHeader.tsx +0 -51
  127. package/src/components/Select/_parts/SelectValue.tsx +0 -96
  128. package/src/components/Select/index.ts +0 -14
  129. package/src/components/Stat/Stat.stories.tsx +0 -85
  130. package/src/components/Stat/Stat.tsx +0 -117
  131. package/src/components/Stat/index.ts +0 -2
  132. package/src/components/StatusMessage/StatusMessage.stories.tsx +0 -130
  133. package/src/components/StatusMessage/StatusMessage.tsx +0 -162
  134. package/src/components/StatusMessage/index.ts +0 -2
  135. package/src/components/Stepper/Step.tsx +0 -21
  136. package/src/components/Stepper/Stepper.definition.ts +0 -75
  137. package/src/components/Stepper/Stepper.stories.tsx +0 -122
  138. package/src/components/Stepper/Stepper.tsx +0 -75
  139. package/src/components/Stepper/index.ts +0 -2
  140. package/src/components/Table/EmptyTable.png +0 -0
  141. package/src/components/Table/Table.definition.ts +0 -580
  142. package/src/components/Table/Table.stories.tsx +0 -853
  143. package/src/components/Table/Table.tsx +0 -495
  144. package/src/components/Table/data.ts +0 -134
  145. package/src/components/Table/exportsUtils.ts +0 -195
  146. package/src/components/Table/index.ts +0 -3
  147. package/src/components/Table/types.ts +0 -34
  148. package/src/components/Tabs/Tab.definition.ts +0 -53
  149. package/src/components/Tabs/Tab.tsx +0 -19
  150. package/src/components/Tabs/Tabs.stories.tsx +0 -118
  151. package/src/components/Tabs/Tabs.tsx +0 -99
  152. package/src/components/Tabs/_tabUtils.tsx +0 -4
  153. package/src/components/Tabs/index.ts +0 -2
  154. package/src/components/Timeline/Timeline.definition.ts +0 -43
  155. package/src/components/Timeline/Timeline.stories.tsx +0 -108
  156. package/src/components/Timeline/Timeline.tsx +0 -49
  157. package/src/components/Timeline/TimelineItem.tsx +0 -31
  158. package/src/components/Timeline/index.ts +0 -2
  159. package/src/components/Tooltip/Tooltip.stories.tsx +0 -129
  160. package/src/components/Tooltip/Tooltip.tsx +0 -58
  161. package/src/components/Tooltip/index.ts +0 -1
  162. package/src/components/_shared/formField.sx.ts +0 -118
  163. package/src/components/_shared/resolvePreset.ts +0 -35
  164. package/src/hooks/ClipBoard/ClipBoard.stories.tsx +0 -168
  165. package/src/hooks/ClipBoard/ClipBoard.tsx +0 -131
  166. package/src/hooks/ClipBoard/ClipboardUnifiedDemo.tsx +0 -111
  167. package/src/hooks/ClipBoard/index.ts +0 -1
  168. package/src/hooks/Wizard/Wizard.stories.tsx +0 -301
  169. package/src/hooks/Wizard/WizardContext.tsx +0 -166
  170. package/src/hooks/Wizard/index.ts +0 -6
  171. package/src/hooks/Wizard/useWizard.ts +0 -13
  172. package/src/index.ts +0 -17
  173. package/src/mui.ts +0 -44
  174. package/src/styles.css +0 -3
  175. package/src/theme/componentStyles.ts +0 -47
  176. package/src/theme/tokens.ts +0 -43
  177. package/tailwind.config.js +0 -10
  178. package/tsconfig.json +0 -48
  179. package/tsup.config.js +0 -41
  180. package/vite.config.js +0 -132
  181. package/vitest.config.ts +0 -35
@@ -1,197 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
- import { MenuButton, MenuOption } from './MenuButton';
3
- import AccountCircleIcon from '@mui/icons-material/AccountCircle';
4
- import SettingsIcon from '@mui/icons-material/Settings';
5
- import LogoutIcon from '@mui/icons-material/Logout';
6
- import MoreVertIcon from '@mui/icons-material/MoreVert';
7
- import PersonIcon from '@mui/icons-material/Person';
8
- import VpnKeyIcon from '@mui/icons-material/VpnKey';
9
- import NotificationsIcon from '@mui/icons-material/Notifications';
10
- import WarningIcon from '@mui/icons-material/Warning'; // Asegúrate de importar este ícono si lo usas
11
- import { fn } from '@storybook/test';
12
-
13
- const meta: Meta<typeof MenuButton> = {
14
- title: 'Components/MenuButton',
15
- component: MenuButton,
16
- tags: ['autodocs'],
17
- argTypes: {
18
- buttonText: {
19
- control: 'text',
20
- description: 'Texto a mostrar en el botón.',
21
- },
22
- buttonIcon: {
23
- control: false,
24
- description: 'Ícono a mostrar en el botón.',
25
- },
26
- options: {
27
- control: 'object',
28
- description: 'Arreglo de opciones del menú, cada una con `label`, `action` y opcionalmente `icon`.',
29
- },
30
- variant: {
31
- control: 'select',
32
- options: ['text', 'outlined', 'contained'],
33
- description: 'Variante de estilo del botón de Material-UI.',
34
- },
35
- },
36
- parameters: {
37
- docs: {
38
- description: {
39
- component: 'Un botón que despliega un menú de opciones. El ancho del menú se ajusta automáticamente al ancho del botón. Cada ítem del menú puede incluir un ícono.',
40
- },
41
- },
42
- },
43
- };
44
-
45
- export default meta;
46
- type Story = StoryObj<typeof MenuButton>;
47
-
48
- // --- Historias ---
49
-
50
- // Historia por defecto: Botón con texto y menú básico con íconos en los ítems
51
- export const Default: Story = {
52
- args: {
53
- buttonText: 'Opciones de Usuario',
54
- options: [
55
- { label: 'Ver Perfil', action: fn(), icon: <PersonIcon /> },
56
- { label: 'Cambiar Contraseña', action: fn()},
57
- { label: 'Cerrar Sesión', action: fn(), icon: <LogoutIcon /> },
58
- ],
59
- variant: 'contained',
60
- },
61
- parameters: {
62
- docs: {
63
- description: {
64
- story: 'Muestra un botón con texto y un menú con ítems que incluyen íconos.',
65
- },
66
- },
67
- },
68
- };
69
-
70
- // Historia: Botón con solo un ícono, menú con íconos
71
- export const IconButton: Story = {
72
- args: {
73
- buttonIcon: <AccountCircleIcon />,
74
- options: [
75
- { label: 'Mi Perfil', action: fn(), icon: <PersonIcon /> },
76
- { label: 'Ajustes de Cuenta', action: fn(), icon: <SettingsIcon /> },
77
- ],
78
- variant: 'text',
79
- },
80
- parameters: {
81
- docs: {
82
- description: {
83
- story: 'Muestra un botón que solo contiene un ícono, con un menú de opciones también con íconos.',
84
- },
85
- },
86
- },
87
- };
88
-
89
- // Historia: Botón con texto e ícono, menú con íconos
90
- export const TextAndIconButton: Story = {
91
- args: {
92
- buttonText: 'Configuración',
93
- buttonIcon: <SettingsIcon />,
94
- options: [
95
- { label: 'General', action: fn(), icon: <SettingsIcon /> },
96
- { label: 'Privacidad', action: fn(), icon: <VpnKeyIcon /> },
97
- { label: 'Notificaciones', action: fn(), icon: <NotificationsIcon /> },
98
- ],
99
- variant: 'outlined',
100
- },
101
- parameters: {
102
- docs: {
103
- description: {
104
- story: 'Muestra un botón con texto e ícono, y un menú con ítems que también tienen íconos.',
105
- },
106
- },
107
- },
108
- };
109
-
110
- // Historia: Botón con un menú largo (para probar el scroll y el ancho dinámico)
111
- export const LongMenu: Story = {
112
- args: {
113
- buttonText: 'Más Opciones de Gestión de Datos',
114
- buttonIcon: <MoreVertIcon />,
115
- options: Array.from({ length: 15 }, (_, i) => ({
116
- label: `Opción de Datos ${i + 1}`,
117
- action: fn(),
118
- icon: i % 3 === 0 ? <PersonIcon /> : i % 3 === 1 ? <SettingsIcon /> : <LogoutIcon />,
119
- })),
120
- variant: 'contained',
121
- },
122
- parameters: {
123
- docs: {
124
- description: {
125
- story: 'Demuestra un menú con muchas opciones para probar el scroll y cómo el ancho del menú se ajusta al botón, incluso si el texto del ítem es más corto.',
126
- },
127
- },
128
- },
129
- };
130
-
131
- // Historia: Botón con acciones de ejemplo (usando alert para demostrar)
132
- export const WithAlertActions: Story = {
133
- args: {
134
- buttonText: 'Acciones con Alerta',
135
- options: [
136
- { label: 'Mostrar Alerta Crítica', action: () => alert('¡Alerta Crítica!'), icon: <WarningIcon /> },
137
- { label: 'Mostrar Alerta Informativa', action: () => alert('¡Alerta Informativa!'), icon: <NotificationsIcon /> },
138
- ],
139
- variant: 'contained',
140
- },
141
- parameters: {
142
- docs: {
143
- description: {
144
- story: 'Muestra un botón con ítems de menú que ejecutan funciones de alerta al ser clickeados.',
145
- },
146
- },
147
- },
148
- };
149
-
150
- // Historia: Diferentes variantes de botón (con íconos en el menú)
151
- export const Variants: Story = {
152
- render: () => (
153
- <div style={{ display: 'flex', gap: '20px' }}>
154
- <MenuButton
155
- buttonText="Contained"
156
- options={[{ label: 'Item Contenido', action: fn(), icon: <PersonIcon /> }]}
157
- variant="contained"
158
- />
159
- <MenuButton
160
- buttonText="Outlined"
161
- options={[{ label: 'Item Delineado', action: fn(), icon: <SettingsIcon /> }]}
162
- variant="outlined"
163
- />
164
- <MenuButton
165
- buttonText="Text"
166
- options={[{ label: 'Item de Texto', action: fn(), icon: <LogoutIcon /> }]}
167
- variant="text"
168
- />
169
- </div>
170
- ),
171
- parameters: {
172
- docs: {
173
- description: {
174
- story: 'Muestra el componente con diferentes variantes de botón de Material-UI.',
175
- },
176
- },
177
- },
178
- };
179
-
180
- // Historia: Botón con texto largo para probar el ajuste de ancho
181
- export const WideButton: Story = {
182
- args: {
183
- buttonText: 'Este es un botón con un texto muy largo para probar el ancho del menú',
184
- options: [
185
- { label: 'Opción corta', action: fn(), icon: <PersonIcon /> },
186
- { label: 'Opción con texto más largo para el ítem', action: fn(), icon: <SettingsIcon /> },
187
- ],
188
- variant: 'contained',
189
- },
190
- parameters: {
191
- docs: {
192
- description: {
193
- story: 'Demuestra cómo el menú ajusta su ancho para coincidir con un botón que tiene un texto considerablemente largo.',
194
- },
195
- },
196
- },
197
- };
@@ -1,100 +0,0 @@
1
- import React, { useState, MouseEvent, ReactNode, useId, useRef } from 'react'; // 👈 Importa useRef
2
- import { Button, Menu, MenuItem, ListItemIcon, Typography } from '@mui/material';
3
- import { ButtonProps } from '@mui/material/Button';
4
-
5
- // Define la interfaz para cada opción del menú
6
- export interface MenuOption {
7
- label: string;
8
- action: () => void;
9
- icon?: ReactNode;
10
- }
11
-
12
- // Define las props para el componente reutilizable
13
- interface MenuButtonProps {
14
- buttonText?: string;
15
- buttonIcon?: ReactNode;
16
- options: MenuOption[];
17
- variant?: ButtonProps['variant'];
18
- }
19
-
20
- export const MenuButton: React.FC<MenuButtonProps> = ({
21
- buttonText,
22
- buttonIcon,
23
- options,
24
- variant = 'contained',
25
- }) => {
26
- const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
27
- const [menuWidth, setMenuWidth] = useState<number>(0);
28
- const open = Boolean(anchorEl);
29
-
30
- const buttonRef = useRef<HTMLButtonElement>(null);
31
-
32
- const uniqueId = useId();
33
- const buttonId = `menu-button-${uniqueId}`;
34
- const menuId = `menu-content-${uniqueId}`;
35
-
36
- const handleClick = (event: MouseEvent<HTMLButtonElement>) => {
37
- setAnchorEl(event.currentTarget);
38
- if (buttonRef.current) {
39
- setMenuWidth(buttonRef.current.offsetWidth);
40
- }
41
- };
42
-
43
- const handleClose = () => {
44
- setAnchorEl(null);
45
- };
46
-
47
- const handleMenuItemClick = (action: () => void) => {
48
- handleClose();
49
- action();
50
- };
51
-
52
- return (
53
- <>
54
- <Button
55
- ref={buttonRef}
56
- variant={variant}
57
- id={buttonId}
58
- aria-controls={open ? menuId : undefined}
59
- aria-haspopup="true"
60
- aria-expanded={open ? 'true' : undefined}
61
- onClick={handleClick}
62
- startIcon={buttonIcon}
63
- >
64
- {buttonText}
65
- </Button>
66
- <Menu
67
- id={menuId}
68
- anchorEl={anchorEl}
69
- open={open}
70
- onClose={handleClose}
71
- MenuListProps={{
72
- 'aria-labelledby': buttonId,
73
- }}
74
- PaperProps={{
75
- style: {
76
- minWidth: menuWidth,
77
- },
78
- }}
79
- >
80
- {options.map((option, index) => (
81
- <MenuItem
82
- key={index}
83
- onClick={() => handleMenuItemClick(option.action)}
84
- >
85
- {option.icon && (
86
- <ListItemIcon>
87
- {option.icon}
88
- </ListItemIcon>
89
- )}
90
- <Typography variant="inherit" noWrap>
91
- {option.label}
92
- </Typography>
93
- </MenuItem>
94
- ))}
95
- </Menu>
96
- </>
97
- );
98
- };
99
-
100
- export default MenuButton;
@@ -1 +0,0 @@
1
- export { default as MenuButton } from './MenuButton'