@soyfri/shared-library 2.0.0-beta.1 → 2.0.0-beta.10

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 (212) hide show
  1. package/build.js +38 -75
  2. package/dist/README.md +243 -0
  3. package/dist/components/Drawer/Drawer.cjs +14 -17
  4. package/dist/components/Drawer/Drawer.cjs.map +1 -1
  5. package/dist/components/Drawer/Drawer.d.ts +8 -1
  6. package/dist/components/Drawer/Drawer.js +14 -17
  7. package/dist/components/Drawer/Drawer.js.map +1 -1
  8. package/dist/components/Input/Input.definitions.d.ts +1 -0
  9. package/dist/components/RadioGroup/RadioGroup.cjs +202 -0
  10. package/dist/components/RadioGroup/RadioGroup.cjs.map +1 -0
  11. package/dist/components/RadioGroup/RadioGroup.d.ts +53 -0
  12. package/dist/components/RadioGroup/RadioGroup.definitions.d.ts +6 -0
  13. package/dist/components/RadioGroup/RadioGroup.js +202 -0
  14. package/dist/components/RadioGroup/RadioGroup.js.map +1 -0
  15. package/dist/components/RadioGroup/RadioGroup.sx.d.ts +20 -0
  16. package/dist/components/RadioGroup/RadioGroup.types.d.ts +1 -0
  17. package/dist/components/RadioGroup/index.d.ts +2 -0
  18. package/dist/components/RadioGroup.d.ts +6 -0
  19. package/dist/components/Stepper/Stepper.cjs +136 -23
  20. package/dist/components/Stepper/Stepper.cjs.map +1 -1
  21. package/dist/components/Stepper/Stepper.js +137 -24
  22. package/dist/components/Stepper/Stepper.js.map +1 -1
  23. package/dist/components/Switch/Switch.cjs +181 -0
  24. package/dist/components/Switch/Switch.cjs.map +1 -0
  25. package/dist/components/Switch/Switch.d.ts +43 -0
  26. package/dist/components/Switch/Switch.definitions.d.ts +7 -0
  27. package/dist/components/Switch/Switch.js +181 -0
  28. package/dist/components/Switch/Switch.js.map +1 -0
  29. package/dist/components/Switch/Switch.sx.d.ts +22 -0
  30. package/dist/components/Switch/Switch.types.d.ts +1 -0
  31. package/dist/components/Switch/index.d.ts +2 -0
  32. package/dist/components/Switch.d.ts +6 -0
  33. package/dist/index.cjs +24 -0
  34. package/dist/index.cjs.map +1 -1
  35. package/dist/index.js +7 -1
  36. package/dist/mui.d.ts +1 -0
  37. package/dist/package.json +207 -0
  38. package/dist/theme/componentStyles.d.ts +1 -1
  39. package/package.json +1 -1
  40. package/src/components/Drawer/Drawer.stories.tsx +168 -0
  41. package/src/components/Drawer/Drawer.tsx +26 -18
  42. package/src/components/Input/Input.definitions.ts +24 -0
  43. package/src/components/Input/Input.stories.tsx +29 -0
  44. package/src/components/RadioGroup/RadioGroup.definitions.ts +177 -0
  45. package/src/components/RadioGroup/RadioGroup.stories.tsx +231 -0
  46. package/src/components/RadioGroup/RadioGroup.sx.ts +75 -0
  47. package/src/components/RadioGroup/RadioGroup.tsx +196 -0
  48. package/src/components/RadioGroup/RadioGroup.types.ts +10 -0
  49. package/src/components/RadioGroup/index.ts +9 -0
  50. package/src/components/Stepper/Stepper.stories.tsx +72 -0
  51. package/src/components/Stepper/Stepper.tsx +139 -4
  52. package/src/components/Switch/Switch.definitions.ts +134 -0
  53. package/src/components/Switch/Switch.stories.tsx +213 -0
  54. package/src/components/Switch/Switch.sx.ts +81 -0
  55. package/src/components/Switch/Switch.tsx +172 -0
  56. package/src/components/Switch/Switch.types.ts +10 -0
  57. package/src/components/Switch/index.ts +9 -0
  58. package/src/mui.ts +10 -0
  59. package/src/theme/componentStyles.ts +3 -1
  60. package/storybook-static/addon-visual-tests-assets/visual-test-illustration.mp4 +0 -0
  61. package/storybook-static/assets/AccountCircle-BDZFsbTw.js +1 -0
  62. package/storybook-static/assets/ActionMenu-EynP8yU1.js +19 -0
  63. package/storybook-static/assets/ActionMenu.stories-DqSqRGix.js +185 -0
  64. package/storybook-static/assets/Alert-3zvTPc0p.js +1 -0
  65. package/storybook-static/assets/AppBar.stories-DcX3M5th.js +172 -0
  66. package/storybook-static/assets/Autocomplete.stories-CXJm8FOT.js +788 -0
  67. package/storybook-static/assets/Avatar-NbFfkZws.js +1 -0
  68. package/storybook-static/assets/Avatar.stories-CwOYCzqU.js +390 -0
  69. package/storybook-static/assets/Box-BnhEcfFm.js +1 -0
  70. package/storybook-static/assets/Button-D9h7OggD.js +1 -0
  71. package/storybook-static/assets/Button-DBpqmVB_.js +1 -0
  72. package/storybook-static/assets/Button.stories-F20dmnjq.js +320 -0
  73. package/storybook-static/assets/ButtonBase-qyaMEhe4.js +74 -0
  74. package/storybook-static/assets/Card.stories-B3NpAhO0.js +154 -0
  75. package/storybook-static/assets/CheckCircleOutline-CEj5mDsl.js +1 -0
  76. package/storybook-static/assets/Chip-C3vKPpzR.js +1 -0
  77. package/storybook-static/assets/Chip.stories-sxcfHVo9.js +333 -0
  78. package/storybook-static/assets/CircularProgress-DC7ZNWwl.js +28 -0
  79. package/storybook-static/assets/Clear-4kYcKvT3.js +1 -0
  80. package/storybook-static/assets/ClipBoard-DvLBdNHe.js +1 -0
  81. package/storybook-static/assets/ClipBoard.stories-BGUo47r6.js +108 -0
  82. package/storybook-static/assets/Close-CgHeRgmh.js +1 -0
  83. package/storybook-static/assets/Close-Cy8nELYU.js +1 -0
  84. package/storybook-static/assets/Color-AVL7NMMY-BJKvwERm.js +1 -0
  85. package/storybook-static/assets/ContentCopy-BfLTDb10.js +1 -0
  86. package/storybook-static/assets/DatePicker-Clkpr-Ku.js +1 -0
  87. package/storybook-static/assets/DatePicker.stories-EaUCMkh3.js +444 -0
  88. package/storybook-static/assets/DateRangePicker.stories-BMlkj-8K.js +390 -0
  89. package/storybook-static/assets/DateTimePicker.stories-B6gdzKq5.js +555 -0
  90. package/storybook-static/assets/DefaultPropsProvider-BGoQxtDa.js +16 -0
  91. package/storybook-static/assets/Delete-D2SMMmIA.js +1 -0
  92. package/storybook-static/assets/DialogContent-BeCDKgax.js +1 -0
  93. package/storybook-static/assets/Divider-BbCj9wT4.js +1 -0
  94. package/storybook-static/assets/DocsRenderer-PQXLIZUC-BebLK5Y_.js +1243 -0
  95. package/storybook-static/assets/Drawer-DcFwy73r.js +1 -0
  96. package/storybook-static/assets/Drawer.stories-C5AZkJBk.js +173 -0
  97. package/storybook-static/assets/EmptyTable-B-RKtgVs.png +0 -0
  98. package/storybook-static/assets/ErrorOutline-D9gM7ART.js +1 -0
  99. package/storybook-static/assets/Fade-Ll96CvH8.js +1 -0
  100. package/storybook-static/assets/Flyout.stories-Cf7z6MNw.js +163 -0
  101. package/storybook-static/assets/Gallery.stories-DdpWVTF6.js +127 -0
  102. package/storybook-static/assets/Grow-8y4FglGK.js +1 -0
  103. package/storybook-static/assets/Home-BRvJEp2L.js +1 -0
  104. package/storybook-static/assets/Icon.stories-D0mUiW_t.js +78 -0
  105. package/storybook-static/assets/IconButton-9OYSTH58.js +1 -0
  106. package/storybook-static/assets/Input-CjX0t4h-.js +1 -0
  107. package/storybook-static/assets/Input.stories-BRxekliy.js +650 -0
  108. package/storybook-static/assets/InputGroup.stories-DH6gUfmn.js +306 -0
  109. package/storybook-static/assets/KeyboardArrowRight-WO_attK2.js +1 -0
  110. package/storybook-static/assets/KeyboardArrowUp-DsyVef-i.js +1 -0
  111. package/storybook-static/assets/ListItem-D3O0103N.js +1 -0
  112. package/storybook-static/assets/ListItemIcon-hca6xN79.js +1 -0
  113. package/storybook-static/assets/ListItemText-BFLAwLdl.js +1 -0
  114. package/storybook-static/assets/Logout-gj-P3AfU.js +1 -0
  115. package/storybook-static/assets/Menu-ClzfjLc3.js +1 -0
  116. package/storybook-static/assets/MenuButton.stories-B-W_QVDt.js +162 -0
  117. package/storybook-static/assets/MenuItem-iU6tAqJI.js +1 -0
  118. package/storybook-static/assets/Modal-3okp9H2i.js +1 -0
  119. package/storybook-static/assets/Modal.stories-DIWzm4qR.js +468 -0
  120. package/storybook-static/assets/MoreVert-BoIVG4gh.js +1 -0
  121. package/storybook-static/assets/Notifications-DY_A-Sho.js +1 -0
  122. package/storybook-static/assets/PageLoader.stories-DmtO1mlm.js +158 -0
  123. package/storybook-static/assets/Paper-SwQBhqI7.js +1 -0
  124. package/storybook-static/assets/Person-CkQl-mpq.js +1 -0
  125. package/storybook-static/assets/PickersModalDialog-Tjnr_cu5.js +10 -0
  126. package/storybook-static/assets/PickersToolbarButton-Tt185-si.js +1 -0
  127. package/storybook-static/assets/Popper-CnCTYXxy.js +1 -0
  128. package/storybook-static/assets/Portal-Cj8XF9Lf.js +1 -0
  129. package/storybook-static/assets/ScrollTopButton.stories-BflQCwNP.js +90 -0
  130. package/storybook-static/assets/Select-CjcuMAY0.js +4 -0
  131. package/storybook-static/assets/Select-DJh2biEb.js +3 -0
  132. package/storybook-static/assets/Select.stories-DU1Gb3I2.js +1103 -0
  133. package/storybook-static/assets/Settings-BLKc1CnO.js +1 -0
  134. package/storybook-static/assets/Snackbar-BtVeKTw6.js +1 -0
  135. package/storybook-static/assets/Stack-D01OUIXi.js +1 -0
  136. package/storybook-static/assets/Stat.stories-Bn9-iuPT.js +60 -0
  137. package/storybook-static/assets/StatusMessage.stories-hnfX8FeU.js +73 -0
  138. package/storybook-static/assets/Stepper-BtKB5ykn.js +2 -0
  139. package/storybook-static/assets/Stepper.stories-CTEZbgPc.js +165 -0
  140. package/storybook-static/assets/Table.stories-CTn2Ktmn.js +1260 -0
  141. package/storybook-static/assets/TableContainer-CzLNaEU-.js +1 -0
  142. package/storybook-static/assets/TableRow-CS88-1HF.js +2 -0
  143. package/storybook-static/assets/Tabs-DLpDOu_n.js +1 -0
  144. package/storybook-static/assets/Tabs.stories-BFVuFy_5.js +159 -0
  145. package/storybook-static/assets/TextField-22T-xHBm.js +1 -0
  146. package/storybook-static/assets/Timeline.stories-DJU_U2Hv.js +97 -0
  147. package/storybook-static/assets/Tooltip-DbnHUxNj.js +1 -0
  148. package/storybook-static/assets/Tooltip.stories-B7tA3dnV.js +66 -0
  149. package/storybook-static/assets/Typography-BgntX2Ep.js +1 -0
  150. package/storybook-static/assets/Wizard.stories-CVrJLK_D.js +23 -0
  151. package/storybook-static/assets/createSimplePaletteValueFilter-bm0fmN_7.js +1 -0
  152. package/storybook-static/assets/createSvgIcon-D_Gca4vA.js +1 -0
  153. package/storybook-static/assets/debounce-Be36O1Ab.js +1 -0
  154. package/storybook-static/assets/emotion-react.browser.esm--g-C9cX9.js +8 -0
  155. package/storybook-static/assets/extendSxProp-CEpa30hT.js +1 -0
  156. package/storybook-static/assets/formField.sx-DMCmZIAa.js +1 -0
  157. package/storybook-static/assets/getReactElementRef-BQ3ANZdy.js +1 -0
  158. package/storybook-static/assets/iframe-BAJnc_4n.js +1079 -0
  159. package/storybook-static/assets/index-B1tlhOpe.js +240 -0
  160. package/storybook-static/assets/index-BF3FAXTk.js +9 -0
  161. package/storybook-static/assets/index-CIeucmOB.js +2 -0
  162. package/storybook-static/assets/index-CY7j4a7o.js +1 -0
  163. package/storybook-static/assets/index-CxkKctw5.js +1 -0
  164. package/storybook-static/assets/isFocusVisible-B8k4qzLc.js +1 -0
  165. package/storybook-static/assets/isMuiElement-CTZSFcY5.js +1 -0
  166. package/storybook-static/assets/jsx-runtime-D_zvdyIk.js +9 -0
  167. package/storybook-static/assets/listItemTextClasses-CC_rwJam.js +1 -0
  168. package/storybook-static/assets/mergeSlotProps-B0UBKBMe.js +1 -0
  169. package/storybook-static/assets/ownerDocument-DW-IO8s5.js +1 -0
  170. package/storybook-static/assets/ownerWindow-HkKU3E4x.js +1 -0
  171. package/storybook-static/assets/preload-helper-PPVm8Dsz.js +1 -0
  172. package/storybook-static/assets/react-18-BUJ64QCV.js +25 -0
  173. package/storybook-static/assets/resolvePreset-CN2aOJJr.js +1 -0
  174. package/storybook-static/assets/useControlled-DsVh1a5j.js +1 -0
  175. package/storybook-static/assets/useForkRef-0ANIrxcF.js +1 -0
  176. package/storybook-static/assets/useId-b4fZxjOL.js +1 -0
  177. package/storybook-static/assets/useMobilePicker-DK-c8xbD.js +1 -0
  178. package/storybook-static/assets/usePreviousProps-WR0rG4aR.js +1 -0
  179. package/storybook-static/assets/useSlot-b6pXgp5_.js +1 -0
  180. package/storybook-static/assets/useSlotProps-C0uMfuBt.js +1 -0
  181. package/storybook-static/assets/useTheme-BmOJK7ra.js +1 -0
  182. package/storybook-static/assets/useThemeProps-DYtxXiUU.js +1 -0
  183. package/storybook-static/assets/useThemeProps-U4yXiZ_5.js +1 -0
  184. package/storybook-static/assets/useTimeout-DNjRaOWc.js +1 -0
  185. package/storybook-static/assets/visuallyHidden-Dan1xhjv.js +1 -0
  186. package/storybook-static/favicon-wrapper.svg +46 -0
  187. package/storybook-static/favicon.svg +1 -0
  188. package/storybook-static/iframe.html +686 -0
  189. package/storybook-static/index.html +160 -0
  190. package/storybook-static/index.json +1 -0
  191. package/storybook-static/nunito-sans-bold-italic.woff2 +0 -0
  192. package/storybook-static/nunito-sans-bold.woff2 +0 -0
  193. package/storybook-static/nunito-sans-italic.woff2 +0 -0
  194. package/storybook-static/nunito-sans-regular.woff2 +0 -0
  195. package/storybook-static/project.json +1 -0
  196. package/storybook-static/sb-addons/chromatic-com-storybook-2/manager-bundle.js +356 -0
  197. package/storybook-static/sb-addons/chromatic-com-storybook-2/manager-bundle.js.LEGAL.txt +40 -0
  198. package/storybook-static/sb-addons/docs-4/manager-bundle.js +151 -0
  199. package/storybook-static/sb-addons/onboarding-1/manager-bundle.js +127 -0
  200. package/storybook-static/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +971 -0
  201. package/storybook-static/sb-addons/vitest-3/manager-bundle.js +3 -0
  202. package/storybook-static/sb-common-assets/favicon-wrapper.svg +46 -0
  203. package/storybook-static/sb-common-assets/favicon.svg +1 -0
  204. package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
  205. package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
  206. package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
  207. package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
  208. package/storybook-static/sb-manager/globals-module-info.js +797 -0
  209. package/storybook-static/sb-manager/globals-runtime.js +69679 -0
  210. package/storybook-static/sb-manager/globals.js +34 -0
  211. package/storybook-static/sb-manager/runtime.js +13195 -0
  212. package/storybook-static/vite-inject-mocker-entry.js +18 -0
@@ -10,6 +10,7 @@ import NotificationsIcon from '@mui/icons-material/Notifications';
10
10
 
11
11
  import { Drawer } from './Drawer';
12
12
  import { DrawerItem } from './DrawerItem';
13
+ import { useDrawerContext } from './DrawerContext';
13
14
 
14
15
  const meta: Meta<typeof Drawer> = {
15
16
  title: 'Components/Drawer',
@@ -55,6 +56,34 @@ const SampleLogo = () => (
55
56
  </Typography>
56
57
  );
57
58
 
59
+ // Logo "inteligente" que usa el context para adaptarse: texto completo cuando
60
+ // está expandido, inicial cuando está colapsado. Es el patrón esperado para el
61
+ // nuevo prop `logo` del Drawer.
62
+ const BrandLogo = () => {
63
+ const { collapsed } = useDrawerContext();
64
+ return collapsed ? (
65
+ <Box
66
+ sx={{
67
+ width: 32,
68
+ height: 32,
69
+ borderRadius: 1,
70
+ bgcolor: 'primary.main',
71
+ color: '#fff',
72
+ display: 'flex',
73
+ alignItems: 'center',
74
+ justifyContent: 'center',
75
+ fontWeight: 700,
76
+ }}
77
+ >
78
+ s
79
+ </Box>
80
+ ) : (
81
+ <Typography variant="h6" sx={{ fontWeight: 700, color: 'primary.main' }}>
82
+ soyfri
83
+ </Typography>
84
+ );
85
+ };
86
+
58
87
  const SampleFooter = ({ collapsed }: { collapsed: boolean }) => (
59
88
  <Box sx={{ display: 'flex', alignItems: 'center', gap: 1.5 }}>
60
89
  <Avatar sx={{ width: 36, height: 36 }}>AP</Avatar>
@@ -236,6 +265,145 @@ export const TemporaryDrawer: Story = {
236
265
  },
237
266
  };
238
267
 
268
+ // ── Nuevo prop `logo` (beta 6) ──────────────────────────────────────────
269
+
270
+ export const WithLogoExpanded: Story = {
271
+ args: {
272
+ variant: 'permanent',
273
+ collapsed: false,
274
+ expandedWidth: 260,
275
+ collapsedWidth: 72,
276
+ logo: <BrandLogo />,
277
+ },
278
+ render: (args) => (
279
+ <Box sx={{ display: 'flex', height: '100vh' }}>
280
+ <Drawer
281
+ {...args}
282
+ onToggleCollapse={() => {
283
+ /* noop para que aparezca el chevron */
284
+ }}
285
+ >
286
+ <DrawerItem icon={<HomeIcon />} label="Inicio" active />
287
+ <DrawerItem icon={<PersonIcon />} label="Perfil" />
288
+ <DrawerItem icon={<ReceiptIcon />} label="Facturación" />
289
+ <DrawerItem icon={<SettingsIcon />} label="Configuración" />
290
+ </Drawer>
291
+ <Box sx={{ flex: 1, p: 3 }}>
292
+ <Typography variant="h5">Prop `logo` expandido</Typography>
293
+ <Typography color="text.secondary">
294
+ Logo a la izquierda, chevron a la derecha en la misma fila.
295
+ </Typography>
296
+ </Box>
297
+ </Box>
298
+ ),
299
+ parameters: {
300
+ docs: {
301
+ description: {
302
+ story:
303
+ 'Nuevo prop `logo`: brand + toggle alineados horizontalmente cuando el drawer está expandido. El consumer solo pasa el nodo del logo y el Drawer se encarga del layout.',
304
+ },
305
+ },
306
+ },
307
+ };
308
+
309
+ export const WithLogoCollapsed: Story = {
310
+ ...WithLogoExpanded,
311
+ args: {
312
+ ...WithLogoExpanded.args,
313
+ collapsed: true,
314
+ },
315
+ parameters: {
316
+ docs: {
317
+ description: {
318
+ story:
319
+ 'Mismo drawer colapsado: el `logo` sigue visible (a diferencia del viejo `header` que se ocultaba). Layout vertical: logo-mini arriba centrado, chevron debajo centrado. El `BrandLogo` usa `useDrawerContext()` para mostrar la versión mini.',
320
+ },
321
+ },
322
+ },
323
+ };
324
+
325
+ export const WithLogoToggleable: Story = {
326
+ render: () => {
327
+ const [collapsed, setCollapsed] = useState(false);
328
+ return (
329
+ <Box sx={{ display: 'flex', height: '100vh' }}>
330
+ <Drawer
331
+ variant="permanent"
332
+ collapsed={collapsed}
333
+ onToggleCollapse={() => setCollapsed((v) => !v)}
334
+ logo={<BrandLogo />}
335
+ footer={<SampleFooter collapsed={collapsed} />}
336
+ >
337
+ <DrawerItem icon={<HomeIcon />} label="Inicio" active />
338
+ <DrawerItem icon={<PersonIcon />} label="Perfil" />
339
+ <DrawerItem icon={<ReceiptIcon />} label="Facturación" />
340
+ <DrawerItem icon={<SettingsIcon />} label="Configuración" />
341
+ <DrawerItem icon={<LogoutIcon />} label="Cerrar sesión" danger />
342
+ </Drawer>
343
+ <Box sx={{ flex: 1, p: 3 }}>
344
+ <Typography variant="h5">
345
+ Drawer con `logo`: {collapsed ? 'colapsado' : 'expandido'}
346
+ </Typography>
347
+ <Typography color="text.secondary">
348
+ Alterná con el chevron: logo y toggle quedan alineados en ambos
349
+ estados (fila horizontal expandido, stack vertical colapsado).
350
+ </Typography>
351
+ </Box>
352
+ </Box>
353
+ );
354
+ },
355
+ parameters: {
356
+ docs: {
357
+ description: {
358
+ story:
359
+ 'Caso interactivo: mismo patrón que `ToggleableDrawer` pero usando el nuevo prop `logo` en lugar de `header`. Comparar contra `ToggleableDrawer` para ver la diferencia de alineación al colapsar.',
360
+ },
361
+ },
362
+ },
363
+ };
364
+
365
+ export const WithLogoAndHeader: Story = {
366
+ args: {
367
+ variant: 'permanent',
368
+ collapsed: false,
369
+ logo: <BrandLogo />,
370
+ header: (
371
+ <Typography variant="caption" color="text.secondary">
372
+ Workspace: Afiliaciones · v2.1
373
+ </Typography>
374
+ ),
375
+ },
376
+ render: (args) => (
377
+ <Box sx={{ display: 'flex', height: '100vh' }}>
378
+ <Drawer
379
+ {...args}
380
+ onToggleCollapse={() => {
381
+ /* noop */
382
+ }}
383
+ >
384
+ <DrawerItem icon={<HomeIcon />} label="Inicio" active />
385
+ <DrawerItem icon={<PersonIcon />} label="Perfil" />
386
+ <DrawerItem icon={<SettingsIcon />} label="Configuración" />
387
+ </Drawer>
388
+ <Box sx={{ flex: 1, p: 3 }}>
389
+ <Typography variant="h5">`logo` + `header` combinados</Typography>
390
+ <Typography color="text.secondary">
391
+ El `logo` vive junto al toggle. El `header` queda debajo como fila
392
+ secundaria y se oculta al colapsar.
393
+ </Typography>
394
+ </Box>
395
+ </Box>
396
+ ),
397
+ parameters: {
398
+ docs: {
399
+ description: {
400
+ story:
401
+ 'Ambos props conviven: `logo` es la sección de brand siempre visible (junto al toggle), `header` sigue siendo una fila secundaria que se oculta al colapsar.',
402
+ },
403
+ },
404
+ },
405
+ };
406
+
239
407
  export const RightAnchored: Story = {
240
408
  args: {
241
409
  variant: 'permanent',
@@ -52,6 +52,13 @@ export interface DrawerProps {
52
52
  showCollapseButton?: boolean;
53
53
  /** Contenido del header (por encima de los items). Típicamente logo/brand. */
54
54
  header?: ReactNode;
55
+ /**
56
+ * Logo/brand que se muestra junto al botón de toggle.
57
+ * - Expandido: logo a la izquierda, toggle a la derecha en la misma fila.
58
+ * - Colapsado: logo arriba centrado, toggle debajo centrado (stack vertical).
59
+ * Siempre visible (a diferencia de `header`, que se oculta al colapsar).
60
+ */
61
+ logo?: ReactNode;
55
62
  /** Contenido del footer (por debajo de los items). Típicamente user profile. */
56
63
  footer?: ReactNode;
57
64
  /**
@@ -78,6 +85,7 @@ export function Drawer({
78
85
  collapsedWidth = 72,
79
86
  showCollapseButton,
80
87
  header,
88
+ logo,
81
89
  footer,
82
90
  preset,
83
91
  sx,
@@ -129,22 +137,28 @@ export function Drawer({
129
137
  sx: paperSx,
130
138
  }}
131
139
  >
132
- {header && (
140
+ {(logo || shouldShowToggle) && (
133
141
  <Box
134
142
  sx={{
135
143
  display: 'flex',
144
+ flexDirection: contextValue.collapsed ? 'column' : 'row',
136
145
  alignItems: 'center',
137
146
  justifyContent: contextValue.collapsed
138
147
  ? 'center'
139
- : 'space-between',
148
+ : logo
149
+ ? 'space-between'
150
+ : 'flex-end',
151
+ gap: contextValue.collapsed ? 0.5 : 0,
140
152
  px: contextValue.collapsed ? 1 : 2,
141
- py: 1.5,
153
+ py: 1,
142
154
  minHeight: 64,
143
155
  flexShrink: 0,
144
156
  }}
145
157
  >
146
- {!contextValue.collapsed && (
147
- <Box sx={{ flex: 1, minWidth: 0 }}>{header}</Box>
158
+ {logo && (
159
+ <Box sx={{ display: 'flex', alignItems: 'center', minWidth: 0 }}>
160
+ {logo}
161
+ </Box>
148
162
  )}
149
163
  {shouldShowToggle && (
150
164
  <IconButton
@@ -158,24 +172,18 @@ export function Drawer({
158
172
  </Box>
159
173
  )}
160
174
 
161
- {!header && shouldShowToggle && (
175
+ {header && !contextValue.collapsed && (
162
176
  <Box
163
177
  sx={{
164
178
  display: 'flex',
165
- justifyContent: contextValue.collapsed
166
- ? 'center'
167
- : 'flex-end',
168
- px: 1,
169
- py: 1,
179
+ alignItems: 'center',
180
+ px: 2,
181
+ py: 1.5,
182
+ minHeight: 56,
183
+ flexShrink: 0,
170
184
  }}
171
185
  >
172
- <IconButton
173
- size="small"
174
- onClick={onToggleCollapse}
175
- aria-label={collapsed ? 'Expandir menú' : 'Colapsar menú'}
176
- >
177
- {collapsed ? <ChevronRightIcon /> : <ChevronLeftIcon />}
178
- </IconButton>
186
+ <Box sx={{ flex: 1, minWidth: 0 }}>{header}</Box>
179
187
  </Box>
180
188
  )}
181
189
 
@@ -322,3 +322,27 @@ export const CustomStylingExample = () => {
322
322
  );
323
323
  };
324
324
  `;
325
+
326
+ export const MultilineInputDefinition = `
327
+ import React, { useState } from 'react';
328
+ import { Input } from './Input';
329
+ import { Box, Typography } from '@mui/material';
330
+
331
+ export const MultilineInputExample = () => {
332
+ const [value, setValue] = useState('Escribe un comentario en varias líneas...');
333
+ return (
334
+ <Box sx={{ width: 400 }}>
335
+ <Input
336
+ label="Comentario"
337
+ value={value}
338
+ onChange={(v) => setValue(v.toString())}
339
+ multiline
340
+ minRows={3}
341
+ maxRows={6}
342
+ fullWidth
343
+ />
344
+ <Typography sx={{ mt: 2 }}>Valor actual: {value}</Typography>
345
+ </Box>
346
+ );
347
+ };
348
+ `;
@@ -24,6 +24,7 @@ import {
24
24
  LabelPositionFloatingDefinition,
25
25
  CustomBorderRadiusDefinition,
26
26
  CustomStylingDefinition,
27
+ MultilineInputDefinition,
27
28
  } from './Input.definitions';
28
29
 
29
30
  // =============================================================================
@@ -456,6 +457,34 @@ export const CustomBorderRadius: Story = {
456
457
  }
457
458
  };
458
459
 
460
+ export const MultilineInput: Story = {
461
+ render: () => {
462
+ const [value, setValue] = useState('Escribe un comentario en varias líneas...');
463
+ return (
464
+ <Box sx={{ width: 400 }}>
465
+ <Input
466
+ label="Comentario"
467
+ value={value}
468
+ onChange={(v) => setValue(v.toString())}
469
+ multiline
470
+ minRows={3}
471
+ maxRows={6}
472
+ fullWidth
473
+ />
474
+ <Typography sx={{ mt: 2 }}>Valor actual: {value}</Typography>
475
+ </Box>
476
+ );
477
+ },
478
+ parameters: {
479
+ docs: {
480
+ description: {
481
+ story: "Un campo de entrada multilínea (`multiline`) usando `minRows` y `maxRows` para auto-expandirse dentro de un rango. Útil para comentarios, descripciones o textos largos."
482
+ },
483
+ source: { code: MultilineInputDefinition.trim() }
484
+ }
485
+ }
486
+ };
487
+
459
488
  export const CustomStyling: Story = {
460
489
  render: () => {
461
490
  const [bg, setBg] = useState('Fondo gris claro');
@@ -0,0 +1,177 @@
1
+ // RadioGroup.definitions.ts — código fuente para la pestaña Docs de Storybook.
2
+
3
+ export const BasicRadioGroupDefinition = `
4
+ import React, { useState } from 'react';
5
+ import { RadioGroup } from './RadioGroup';
6
+ import { Box, Typography } from '@mui/material';
7
+
8
+ const options = [
9
+ { value: 'a', label: 'Opción A' },
10
+ { value: 'b', label: 'Opción B' },
11
+ { value: 'c', label: 'Opción C' },
12
+ ];
13
+
14
+ export const BasicRadioGroupExample = () => {
15
+ const [value, setValue] = useState('a');
16
+ return (
17
+ <Box sx={{ width: 360 }}>
18
+ <RadioGroup
19
+ label="Selecciona una opción"
20
+ options={options}
21
+ value={value}
22
+ onChange={setValue}
23
+ />
24
+ <Typography sx={{ mt: 2 }}>Valor actual: {value}</Typography>
25
+ </Box>
26
+ );
27
+ };
28
+ `;
29
+
30
+ export const ColumnRadioGroupDefinition = `
31
+ import React, { useState } from 'react';
32
+ import { RadioGroup } from './RadioGroup';
33
+ import { Box } from '@mui/material';
34
+
35
+ const options = [
36
+ { value: 'sm', label: 'Pequeño' },
37
+ { value: 'md', label: 'Mediano' },
38
+ { value: 'lg', label: 'Grande' },
39
+ ];
40
+
41
+ export const ColumnRadioGroupExample = () => {
42
+ const [value, setValue] = useState('md');
43
+ return (
44
+ <Box sx={{ width: 360 }}>
45
+ <RadioGroup
46
+ label="Tamaño"
47
+ options={options}
48
+ value={value}
49
+ onChange={setValue}
50
+ row={false}
51
+ />
52
+ </Box>
53
+ );
54
+ };
55
+ `;
56
+
57
+ export const RadioGroupWithErrorDefinition = `
58
+ import React, { useState } from 'react';
59
+ import { RadioGroup } from './RadioGroup';
60
+ import { Box } from '@mui/material';
61
+
62
+ const options = [
63
+ { value: 'yes', label: 'Sí' },
64
+ { value: 'no', label: 'No' },
65
+ ];
66
+
67
+ export const RadioGroupWithErrorExample = () => {
68
+ const [value, setValue] = useState('');
69
+ const hasError = !value;
70
+ return (
71
+ <Box sx={{ width: 360 }}>
72
+ <RadioGroup
73
+ label="¿Aceptas los términos?"
74
+ options={options}
75
+ value={value}
76
+ onChange={setValue}
77
+ error={hasError}
78
+ helperText={hasError ? 'Este campo es obligatorio' : ''}
79
+ />
80
+ </Box>
81
+ );
82
+ };
83
+ `;
84
+
85
+ export const DisabledRadioGroupDefinition = `
86
+ import React, { useState } from 'react';
87
+ import { RadioGroup } from './RadioGroup';
88
+ import { Box } from '@mui/material';
89
+
90
+ const options = [
91
+ { value: 'a', label: 'Opción A' },
92
+ { value: 'b', label: 'Opción B', disabled: true },
93
+ { value: 'c', label: 'Opción C' },
94
+ ];
95
+
96
+ export const DisabledRadioGroupExample = () => {
97
+ const [value, setValue] = useState('a');
98
+ return (
99
+ <Box sx={{ width: 360 }}>
100
+ {/* Bloqueo total */}
101
+ <RadioGroup
102
+ label="Grupo deshabilitado"
103
+ options={options}
104
+ value={value}
105
+ onChange={setValue}
106
+ disabled
107
+ />
108
+ {/* Bloqueo por opción */}
109
+ <RadioGroup
110
+ label="Opción B deshabilitada"
111
+ options={options}
112
+ value={value}
113
+ onChange={setValue}
114
+ sx={{ mt: 3 }}
115
+ />
116
+ </Box>
117
+ );
118
+ };
119
+ `;
120
+
121
+ export const UnborderedRadioGroupDefinition = `
122
+ import React, { useState } from 'react';
123
+ import { RadioGroup } from './RadioGroup';
124
+ import { Box } from '@mui/material';
125
+
126
+ const options = [
127
+ { value: 'a', label: 'Opción A' },
128
+ { value: 'b', label: 'Opción B' },
129
+ ];
130
+
131
+ export const UnborderedRadioGroupExample = () => {
132
+ const [value, setValue] = useState('a');
133
+ return (
134
+ <Box sx={{ width: 360 }}>
135
+ <RadioGroup
136
+ options={options}
137
+ value={value}
138
+ onChange={setValue}
139
+ bordered={false}
140
+ />
141
+ </Box>
142
+ );
143
+ };
144
+ `;
145
+
146
+ export const RHFRadioGroupDefinition = `
147
+ import React from 'react';
148
+ import { useForm } from 'react-hook-form';
149
+ import { RadioGroup } from './RadioGroup';
150
+ import { Box, Button, Typography } from '@mui/material';
151
+
152
+ const options = [
153
+ { value: 'paypal', label: 'PayPal' },
154
+ { value: 'card', label: 'Tarjeta' },
155
+ { value: 'transfer', label: 'Transferencia' },
156
+ ];
157
+
158
+ export const RHFRadioGroupExample = () => {
159
+ const { control, handleSubmit, watch } = useForm({
160
+ defaultValues: { paymentMethod: 'card' },
161
+ });
162
+ const value = watch('paymentMethod');
163
+ return (
164
+ <Box sx={{ width: 360 }} component="form" onSubmit={handleSubmit(console.log)}>
165
+ <RadioGroup
166
+ label="Método de pago"
167
+ options={options}
168
+ name="paymentMethod"
169
+ control={control}
170
+ validation={{ required: 'Selecciona un método' }}
171
+ />
172
+ <Typography sx={{ mt: 2 }}>Valor en el form: {value}</Typography>
173
+ <Button type="submit" sx={{ mt: 1 }}>Enviar</Button>
174
+ </Box>
175
+ );
176
+ };
177
+ `;