@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
@@ -0,0 +1,1103 @@
1
+ import{j as e}from"./jsx-runtime-D_zvdyIk.js";import{r as i}from"./iframe-BAJnc_4n.js";import{S as s,O as D}from"./Select-CjcuMAY0.js";import{B as l}from"./Box-BnhEcfFm.js";import{T as r}from"./Typography-BgntX2Ep.js";import{A as R}from"./Avatar-NbFfkZws.js";import{C as W}from"./Chip-C3vKPpzR.js";import"./preload-helper-PPVm8Dsz.js";import"./formField.sx-DMCmZIAa.js";import"./resolvePreset-CN2aOJJr.js";import"./Clear-4kYcKvT3.js";import"./DefaultPropsProvider-BGoQxtDa.js";import"./createSvgIcon-D_Gca4vA.js";import"./TextField-22T-xHBm.js";import"./useSlot-b6pXgp5_.js";import"./useForkRef-0ANIrxcF.js";import"./useId-b4fZxjOL.js";import"./Select-DJh2biEb.js";import"./Menu-ClzfjLc3.js";import"./useSlotProps-C0uMfuBt.js";import"./Paper-SwQBhqI7.js";import"./useTheme-BmOJK7ra.js";import"./extendSxProp-CEpa30hT.js";import"./ownerDocument-DW-IO8s5.js";import"./ownerWindow-HkKU3E4x.js";import"./debounce-Be36O1Ab.js";import"./Grow-8y4FglGK.js";import"./getReactElementRef-BQ3ANZdy.js";import"./useTimeout-DNjRaOWc.js";import"./index-CY7j4a7o.js";import"./index-BF3FAXTk.js";import"./mergeSlotProps-B0UBKBMe.js";import"./Modal-3okp9H2i.js";import"./Portal-Cj8XF9Lf.js";import"./Fade-Ll96CvH8.js";import"./useControlled-DsVh1a5j.js";import"./createSimplePaletteValueFilter-bm0fmN_7.js";import"./isMuiElement-CTZSFcY5.js";import"./MenuItem-iU6tAqJI.js";import"./ButtonBase-qyaMEhe4.js";import"./emotion-react.browser.esm--g-C9cX9.js";import"./isFocusVisible-B8k4qzLc.js";import"./listItemTextClasses-CC_rwJam.js";import"./ListItemIcon-hca6xN79.js";import"./CircularProgress-DC7ZNWwl.js";const L=`
2
+ import React, { useState } from 'react';
3
+ import { Select } from './Select'; // Asumiendo que Select.tsx está en el mismo directorio
4
+ import { Box, Typography } from '@mui/material';
5
+
6
+ const basicOptions = [
7
+ { value: '10', label: '10' },
8
+ { value: '25', label: '25' },
9
+ { value: '50', label: '50' },
10
+ { value: '100', label: '100' },
11
+ ];
12
+
13
+ export const SimpleSelectExample = () => {
14
+ const [value, setValue] = useState<string>('25');
15
+ return (
16
+ <Box sx={{ width: 200 }}>
17
+ <Select
18
+ label="Registros por página"
19
+ options={basicOptions}
20
+ value={value}
21
+ onChange={(val) => setValue(val as string)}
22
+ maxWidth={150}
23
+ />
24
+ <Typography sx={{ mt: 2 }}>Valor seleccionado: {value}</Typography>
25
+ </Box>
26
+ );
27
+ };
28
+ `,I=`
29
+ import React, { useState } from 'react';
30
+ import { Select } from './Select'; // Asumiendo que Select.tsx está en el mismo directorio
31
+ import { Box, Typography } from '@mui/material';
32
+
33
+ export const MultiSelectExample = () => {
34
+ const [value, setValue] = useState<string[]>([]);
35
+ return (
36
+ <Box sx={{ width: 400 }}>
37
+ <Select
38
+ label="Seleccionar estados"
39
+ multiple
40
+ maxChipsToShow={2}
41
+ options={[
42
+ { value: 'pending', label: 'Pendiente' },
43
+ { value: 'approved', label: 'Aprobado' },
44
+ { value: 'rejected', label: 'Rechazado' },
45
+ { value: 'canceled', label: 'Cancelado' },
46
+ { value: 'completed', label: 'Completado' },
47
+ { value: 'invoiced', label: 'Facturado' },
48
+ ]}
49
+ value={value}
50
+ onChange={(val) => setValue(val as string[])}
51
+ />
52
+ <Typography sx={{ mt: 2 }}>Valor seleccionado: {JSON.stringify(value)}</Typography>
53
+ </Box>
54
+ );
55
+ };
56
+ `,z=`
57
+ import React, { useState } from 'react';
58
+ import { Select } from './Select'; // Asumiendo que Select.tsx está en el mismo directorio
59
+ import { Box, Typography } from '@mui/material';
60
+
61
+ const basicOptions = [
62
+ { value: '10', label: '10' },
63
+ { value: '25', label: '25' },
64
+ { value: '50', label: '50' },
65
+ { value: '100', label: '100' },
66
+ ];
67
+
68
+ export const WithPlaceholderExample = () => {
69
+ const [value, setValue] = useState('');
70
+ return (
71
+ <Box sx={{ width: 300 }}>
72
+ <Select
73
+ label="Seleccione una opción"
74
+ options={basicOptions}
75
+ value={value}
76
+ onChange={(val) => setValue(val as string)}
77
+ placeholder="Ninguna opción seleccionada"
78
+ />
79
+ <Typography sx={{ mt: 2 }}>Valor seleccionado: {value || 'Ninguno'}</Typography>
80
+ </Box>
81
+ );
82
+ };
83
+ `,U=`
84
+ import React, { useState } from 'react';
85
+ import { Select } from './Select'; // Asumiendo que Select.tsx está en el mismo directorio
86
+ import { Box, Typography } from '@mui/material';
87
+
88
+ const groupedOptions = [
89
+ { value: 'gt', label: 'Guatemala', group: 'Centroamérica' },
90
+ { value: 'sv', label: 'El Salvador', group: 'Centroamérica' },
91
+ { value: 'mx', label: 'México', group: 'Norteamérica' },
92
+ { value: 'us', label: 'EE.UU.', group: 'Norteamérica' },
93
+ ];
94
+
95
+ export const WithFilterExample = () => {
96
+ const [value, setValue] = useState('');
97
+ return (
98
+ <Box sx={{ width: 300 }}>
99
+ <Select
100
+ label="Buscar país"
101
+ filterable
102
+ options={groupedOptions}
103
+ value={value}
104
+ onChange={(val) => setValue(val as string)}
105
+ />
106
+ <Typography sx={{ mt: 2 }}>Valor seleccionado: {value}</Typography>
107
+ </Box>
108
+ );
109
+ };
110
+ `,q=`
111
+ import React, { useState } from 'react';
112
+ import { Select } from './Select'; // Asumiendo que Select.tsx está en el mismo directorio
113
+ import { Box, Typography } from '@mui/material';
114
+
115
+ const groupedOptions = [
116
+ { value: 'gt', label: 'Guatemala', group: 'Centroamérica' },
117
+ { value: 'sv', label: 'El Salvador', group: 'Centroamérica' },
118
+ { value: 'mx', label: 'México', group: 'Norteamérica' },
119
+ { value: 'us', label: 'EE.UU.', group: 'Norteamérica' },
120
+ ];
121
+
122
+ export const WithGroupExample = () => {
123
+ const [value, setValue] = useState('');
124
+ return (
125
+ <Box sx={{ width: 300 }}>
126
+ <Select
127
+ label="País por región"
128
+ options={groupedOptions}
129
+ value={value}
130
+ onChange={(val) => setValue(val as string)}
131
+ />
132
+ <Typography sx={{ mt: 2 }}>Valor seleccionado: {value}</Typography>
133
+ </Box>
134
+ );
135
+ };
136
+ `,G=`
137
+ import React, { useState } from 'react';
138
+ import { Select, Option } from './Select'; // Asumiendo que Select.tsx está en el mismo directorio
139
+ import { Avatar, Box, Typography } from '@mui/material';
140
+
141
+ const userOptions = [
142
+ { value: 'admin', label: 'Administrador', img: 'https://placehold.co/40x40?text=A' },
143
+ { value: 'user', label: 'Usuario', img: 'https://placehold.co/40x40?text=U' },
144
+ ];
145
+
146
+ export const CustomRenderWithAvatarExample = () => {
147
+ const [value, setValue] = useState<string[]>([]);
148
+ return (
149
+ <Box sx={{ width: 300 }}>
150
+ <Select
151
+ options={userOptions}
152
+ multiple
153
+ value={value}
154
+ onChange={(val) => setValue(val as string[])}
155
+ label="Usuarios"
156
+ placeholder="Selecciona usuarios"
157
+ >
158
+ <Option>
159
+ {({ img, label }) => (
160
+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>
161
+ <Avatar src={img} sx={{ width: 24, height: 24 }} />
162
+ <Typography variant="body2">{label}</Typography>
163
+ </Box>
164
+ )}
165
+ </Option>
166
+ </Select>
167
+ <Typography sx={{ mt: 2 }}>Valor seleccionado: {JSON.stringify(value)}</Typography>
168
+ </Box>
169
+ );
170
+ };
171
+ `,F=`
172
+ import React, { useState } from 'react';
173
+ import { Select } from './Select'; // Asumiendo que Select.tsx está en el mismo directorio
174
+ import { Box, Typography, Chip } from '@mui/material';
175
+
176
+ const transactionStatuses = [
177
+ { value: 'PENDING', label: 'Pendiente' },
178
+ { value: 'REJECTED', label: 'Rechazado' },
179
+ { value: 'CANCELED', label: 'Cancelado' },
180
+ { value: 'REFUNDED', label: 'Reembolsado' },
181
+ { value: 'COMPLETED', label: 'Completado' },
182
+ { value: 'EXPIRED', label: 'Expirado' },
183
+ ];
184
+
185
+ export const MultiSelectCustomChipRenderExample = () => {
186
+ const [value, setValue] = useState<string[]>(['pending', 'approved', 'rejected', 'canceled']);
187
+ return (
188
+ <Box sx={{ width: 400 }}>
189
+ <Select
190
+ label="Estados de Transacción"
191
+ multiple
192
+ maxChipsToShow={3}
193
+ options={transactionStatuses}
194
+ value={value}
195
+ onChange={(val) => setValue(val as string[])}
196
+ placeholder="Selecciona estados"
197
+ renderChipLabel={(item) => (
198
+ <Typography variant="caption" sx={{ fontWeight: 'bold' }}>
199
+ {item.label.charAt(0).toUpperCase()}
200
+ </Typography>
201
+ )}
202
+ />
203
+ <Typography sx={{ mt: 2 }}>Valor seleccionado: {JSON.stringify(value)}</Typography>
204
+ </Box>
205
+ );
206
+ };
207
+ `,J=`
208
+ import React, { useState } from 'react';
209
+ import { Select } from './Select'; // Asumiendo que Select.tsx está en el mismo directorio
210
+ import { Avatar, Box, Typography } from '@mui/material';
211
+
212
+ const groupedOptions = [
213
+ { value: 'gt', label: 'Guatemala', group: 'Centroamérica' },
214
+ { value: 'sv', label: 'El Salvador', group: 'Centroamérica' },
215
+ { value: 'mx', label: 'México', group: 'Norteamérica' },
216
+ { value: 'us', label: 'EE.UU.', group: 'Norteamérica' },
217
+ { value: 'ca', label: 'Canadá', group: 'Norteamérica' },
218
+ { value: 'br', label: 'Brasil', group: 'Sudamérica' },
219
+ { value: 'ar', label: 'Argentina', group: 'Sudamérica' },
220
+ ];
221
+
222
+ export const MultiSelectCustomChipRenderFullLabelExample = () => {
223
+ const [value, setValue] = useState<string[]>(['gt', 'mx', 'us', 'ca', 'br']);
224
+ return (
225
+ <Box sx={{ width: 400 }}>
226
+ <Select
227
+ label="Países seleccionados"
228
+ multiple
229
+ maxChipsToShow={3}
230
+ options={groupedOptions}
231
+ value={value}
232
+ onChange={(val) => setValue(val as string[])}
233
+ placeholder="Selecciona países"
234
+ renderChipLabel={(item) => (
235
+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 0.5 }}>
236
+ {item.img && <Avatar src={item.img} sx={{ width: 18, height: 18 }} />}
237
+ <Typography variant="caption" sx={{ fontWeight: 'medium' }}>
238
+ {item.label}
239
+ </Typography>
240
+ </Box>
241
+ )}
242
+ />
243
+ <Typography sx={{ mt: 2 }}>Valor seleccionado: {JSON.stringify(value)}</Typography>
244
+ </Box>
245
+ );
246
+ };
247
+ `,k=`
248
+ import React, { useState } from 'react';
249
+ import { Select } from './Select'; // Asumiendo que Select.tsx está en el mismo directorio
250
+ import { Box, Typography } from '@mui/material';
251
+
252
+ const optionsWithManyItems = [
253
+ { value: 'gt', label: 'Guatemala' }, { value: 'sv', label: 'El Salvador' },
254
+ { value: 'mx', label: 'México' }, { value: 'us', label: 'EE.UU.' },
255
+ { value: 'ca', label: 'Canadá' }, { value: 'br', label: 'Brasil' },
256
+ { value: 'ar', label: 'Argentina' }, { value: 'cl', label: 'Chile' },
257
+ { value: 'co', label: 'Colombia' }, { value: 'pe', label: 'Perú' },
258
+ { value: 'ec', label: 'Ecuador' }, { value: 've', label: 'Venezuela' },
259
+ { value: 'py', label: 'Paraguay' }, { value: 'uy', label: 'Uruguay' },
260
+ { value: 'bo', label: 'Bolivia' }, { value: 'cr', label: 'Costa Rica' },
261
+ { value: 'pa', label: 'Panamá' }, { value: 'hn', label: 'Honduras' },
262
+ { value: 'ni', label: 'Nicaragua' }, { value: 'do', label: 'Rep. Dominicana' },
263
+ { value: 'cu', label: 'Cuba' }, { value: 'pr', label: 'Puerto Rico' },
264
+ { value: 'es', label: 'España' }, { value: 'fr', label: 'Francia' },
265
+ { value: 'de', label: 'Alemania' }, { value: 'it', label: 'Italia' },
266
+ ];
267
+
268
+ export const ConstrainedHeightExample = () => {
269
+ const [value, setValue] = useState('');
270
+ return (
271
+ <Box sx={{ width: 300 }}>
272
+ <Select
273
+ label="Opciones (Altura Limitada)"
274
+ options={optionsWithManyItems}
275
+ value={value}
276
+ onChange={(val) => setValue(val as string)}
277
+ maxHeight={150}
278
+ />
279
+ <Typography sx={{ mt: 2 }}>Valor seleccionado: {value}</Typography>
280
+ </Box>
281
+ );
282
+ };
283
+ `,H=`
284
+ import React, { useState } from 'react';
285
+ import { Select } from './Select'; // Asumiendo que Select.tsx está en el mismo directorio
286
+ import { Box, Typography } from '@mui/material';
287
+
288
+ const basicOptions = [
289
+ { value: '10', label: '10' },
290
+ { value: '25', label: '25' },
291
+ ];
292
+ const groupedOptions = [
293
+ { value: 'gt', label: 'Guatemala', group: 'Centroamérica' },
294
+ { value: 'sv', label: 'El Salvador', group: 'Centroamérica' },
295
+ ];
296
+
297
+ export const ConstrainedWidthExample = () => {
298
+ const [value, setValue] = useState('');
299
+ return (
300
+ <Box sx={{ width: 200 }}>
301
+ <Select
302
+ label="Opciones (Ancho Limitado)"
303
+ options={basicOptions.concat(groupedOptions)}
304
+ value={value}
305
+ onChange={(val) => setValue(val as string)}
306
+ maxWidth={100}
307
+ />
308
+ <Typography sx={{ mt: 2 }}>Valor seleccionado: {value}</Typography>
309
+ </Box>
310
+ );
311
+ };
312
+ `,$=`
313
+ import React, { useState } from 'react';
314
+ import { Select, Option } from './Select'; // Asumiendo que Select.tsx está en el mismo directorio
315
+ import { Avatar, Box, Typography, Chip } from '@mui/material';
316
+
317
+ const allOptions = [
318
+ { value: 'gt', label: 'Guatemala', group: 'Centroamérica' },
319
+ { value: 'admin', label: 'Administrador', img: 'https://placehold.co/40x40?text=A' },
320
+ { value: 'PENDING', label: 'Pendiente' },
321
+ { value: 'ca', label: 'Canadá', group: 'Norteamérica' },
322
+ { value: 'user', label: 'Usuario', img: 'https://placehold.co/40x40?text=U' },
323
+ { value: 'COMPLETED', label: 'Completado' },
324
+ ];
325
+
326
+ export const AllFeaturesCombinedExample = () => {
327
+ const [value, setValue] = useState<string[]>(['gt', 'admin', 'PENDING', 'ca', 'user', 'COMPLETED']);
328
+ return (
329
+ <Box sx={{ width: 500 }}>
330
+ <Select
331
+ label="Selección Completa"
332
+ multiple
333
+ filterable
334
+ maxChipsToShow={3}
335
+ maxHeight={250}
336
+ maxWidth="400px"
337
+ options={allOptions}
338
+ value={value}
339
+ onChange={(val) => setValue(val as string[])}
340
+ placeholder="Busca y selecciona todo tipo de elementos"
341
+ renderChipLabel={(item) => (
342
+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 0.5 }}>
343
+ {item.img && <Avatar src={item.img} sx={{ width: 16, height: 16 }} />}
344
+ <Typography variant="caption" sx={{ fontWeight: 'bold' }}>
345
+ {item.label.length > 10 ? item.label.substring(0, 7) + '...' : item.label}
346
+ </Typography>
347
+ </Box>
348
+ )}
349
+ >
350
+ <Option>
351
+ {(item) => (
352
+ <Box sx={{ display: 'flex', alignItems: 'center', gap: 1, my: 0.5 }}>
353
+ {item.img && <Avatar src={item.img} sx={{ width: 28, height: 28 }} />}
354
+ <Box>
355
+ <Typography variant="body2" fontWeight="medium">{item.label}</Typography>
356
+ {item.group && (
357
+ <Typography variant="caption" color="text.secondary">
358
+ Grupo: {item.group}
359
+ </Typography>
360
+ )}
361
+ {item.disabled && <Chip label="No disponible" size="small" color="warning" sx={{ ml: 1 }} />}
362
+ </Box>
363
+ </Box>
364
+ )}
365
+ </Option>
366
+ </Select>
367
+ <Typography sx={{ mt: 2 }}>Valor seleccionado: {JSON.stringify(value)}</Typography>
368
+ </Box>
369
+ );
370
+ };
371
+ `,_=`
372
+ import React, { useState } from 'react';
373
+ import { Select } from './Select'; // Asumiendo que Select.tsx está en el mismo directorio
374
+ import { Box, Typography } from '@mui/material';
375
+
376
+ export const EmptyOptionsExample = () => {
377
+ const [value, setValue] = useState(null);
378
+ return (
379
+ <Box sx={{ width: 300 }}>
380
+ <Select
381
+ label="Seleccionar (Vacío)"
382
+ options={[]}
383
+ value={value}
384
+ onChange={setValue}
385
+ placeholder="No hay opciones disponibles"
386
+ />
387
+ <Typography sx={{ mt: 2 }}>Valor seleccionado: {value || 'Ninguno'}</Typography>
388
+ </Box>
389
+ );
390
+ };
391
+ `,X=`
392
+ import React, { useState } from 'react';
393
+ import { Select } from './Select'; // Asumiendo que Select.tsx está en el mismo directorio
394
+ import { Box, Typography } from '@mui/material';
395
+
396
+ const manyOptions = Array.from({ length: 50 }, (_, i) => ({
397
+ value: \`option-\${i}\`,
398
+ label: \`Opción \${i + 1}\`,
399
+ group: i < 25 ? 'Grupo A' : 'Grupo B',
400
+ }));
401
+
402
+ export const SelectWithManyOptionsExample = () => {
403
+ const [value, setValue] = useState('');
404
+ return (
405
+ <Box sx={{ width: 300 }}>
406
+ <Select
407
+ label="Muchas Opciones"
408
+ options={manyOptions}
409
+ value={value}
410
+ onChange={(val) => setValue(val as string)}
411
+ filterable
412
+ maxHeight={200}
413
+ />
414
+ <Typography sx={{ mt: 2 }}>Valor seleccionado: {value}</Typography>
415
+ </Box>
416
+ );
417
+ };
418
+ `,K=`
419
+ import React, { useState } from 'react';
420
+ import { Select } from './Select';
421
+ import { Box, Typography } from '@mui/material';
422
+
423
+ const basicOptions = [
424
+ { value: '10', label: '10' },
425
+ { value: '25', label: '25' },
426
+ { value: '50', label: '50' },
427
+ { value: '100', label: '100' },
428
+ ];
429
+
430
+ export const LabelPositionFloatingExample = () => {
431
+ const [value, setValue] = useState('');
432
+ return (
433
+ <Box sx={{ width: 300 }}>
434
+ <Select
435
+ label="Label flotante (MUI nativo)"
436
+ options={basicOptions}
437
+ value={value}
438
+ onChange={(val) => setValue(val as string)}
439
+ labelPosition="floating"
440
+ />
441
+ <Typography sx={{ mt: 2 }}>Valor seleccionado: {value || 'Ninguno'}</Typography>
442
+ </Box>
443
+ );
444
+ };
445
+ `,Q=`
446
+ import React, { useState } from 'react';
447
+ import { Select } from './Select';
448
+ import { Box } from '@mui/material';
449
+
450
+ const basicOptions = [
451
+ { value: '10', label: '10' },
452
+ { value: '25', label: '25' },
453
+ { value: '50', label: '50' },
454
+ { value: '100', label: '100' },
455
+ ];
456
+
457
+ export const CustomBorderRadiusExample = () => {
458
+ const [valueA, setValueA] = useState('25');
459
+ const [valueB, setValueB] = useState('25');
460
+ const [valueC, setValueC] = useState('25');
461
+ return (
462
+ <Box sx={{ width: 300, display: 'flex', flexDirection: 'column', gap: 2 }}>
463
+ <Select
464
+ label="Sin border radius"
465
+ options={basicOptions}
466
+ value={valueA}
467
+ onChange={(val) => setValueA(val as string)}
468
+ borderRadius={0}
469
+ />
470
+ <Select
471
+ label="Border radius estándar"
472
+ options={basicOptions}
473
+ value={valueB}
474
+ onChange={(val) => setValueB(val as string)}
475
+ borderRadius={10}
476
+ />
477
+ <Select
478
+ label="Pill-shaped"
479
+ options={basicOptions}
480
+ value={valueC}
481
+ onChange={(val) => setValueC(val as string)}
482
+ borderRadius={999}
483
+ />
484
+ </Box>
485
+ );
486
+ };
487
+ `,Y=`
488
+ import React, { useState } from 'react';
489
+ import { Select } from './Select';
490
+ import { Box, Typography } from '@mui/material';
491
+
492
+ const userOptions = [
493
+ { value: 'admin', label: 'Administrador', img: 'https://placehold.co/40x40?text=A' },
494
+ { value: 'user', label: 'Usuario', img: 'https://placehold.co/40x40?text=U' },
495
+ { value: 'moderator', label: 'Moderador', img: 'https://placehold.co/40x40?text=M' },
496
+ ];
497
+
498
+ export const CustomStylingExample = () => {
499
+ const [value, setValue] = useState<string[]>(['admin']);
500
+ return (
501
+ <Box sx={{ width: 360 }}>
502
+ <Select
503
+ label="Select con estilos personalizados"
504
+ options={userOptions}
505
+ multiple
506
+ value={value}
507
+ onChange={(val) => setValue(val as string[])}
508
+ placeholder="Selecciona usuarios"
509
+ sx={{
510
+ '& .MuiInputBase-root': {
511
+ backgroundColor: 'action.hover',
512
+ },
513
+ '& .MuiOutlinedInput-notchedOutline': {
514
+ borderColor: 'primary.main',
515
+ borderWidth: '2px',
516
+ },
517
+ '&:hover .MuiOutlinedInput-notchedOutline': {
518
+ borderColor: 'primary.dark',
519
+ },
520
+ }}
521
+ />
522
+ <Typography sx={{ mt: 2 }}>Valor seleccionado: {JSON.stringify(value)}</Typography>
523
+ </Box>
524
+ );
525
+ };
526
+ `,Z=`
527
+ import React, { useState } from 'react';
528
+ import { Select } from './Select';
529
+ import { Box, Typography } from '@mui/material';
530
+
531
+ const mockAsyncOptions = [
532
+ { value: 'apple', label: 'Apple' },
533
+ { value: 'banana', label: 'Banana' },
534
+ { value: 'orange', label: 'Orange' },
535
+ { value: 'grape', label: 'Grape' },
536
+ { value: 'strawberry', label: 'Strawberry' },
537
+ { value: 'blueberry', label: 'Blueberry' },
538
+ { value: 'pineapple', label: 'Pineapple' },
539
+ ];
540
+
541
+ // Simulate an API call
542
+ const simulatedLoadOptions = (inputValue: string): Promise<any[]> => {
543
+ return new Promise((resolve) => {
544
+ setTimeout(() => {
545
+ const filtered = mockAsyncOptions.filter(option =>
546
+ option.label.toLowerCase().includes(inputValue.toLowerCase())
547
+ );
548
+ resolve(filtered);
549
+ }, 800); // Simulate network delay
550
+ });
551
+ };
552
+
553
+ export const AsyncSelectExample = () => {
554
+ const [value, setValue] = useState('');
555
+ return (
556
+ <Box sx={{ width: 300 }}>
557
+ <Select
558
+ label="Buscar Frutas"
559
+ loadOptions={simulatedLoadOptions}
560
+ value={value}
561
+ onChange={(val) => setValue(val as string)}
562
+ placeholder="Escribe para buscar..."
563
+ loadingMessage="Buscando frutas..."
564
+ noOptionsMessage="No se encontraron frutas."
565
+ />
566
+ <Typography sx={{ mt: 2 }}>Valor seleccionado: {value}</Typography>
567
+ </Box>
568
+ );
569
+ };
570
+ `,u=[{value:"10",label:"10"},{value:"25",label:"25"},{value:"50",label:"50"},{value:"100",label:"100"}],d=[{value:"gt",label:"Guatemala",group:"Centroamérica"},{value:"sv",label:"El Salvador",group:"Centroamérica"},{value:"mx",label:"México",group:"Norteamérica"},{value:"us",label:"EE.UU.",group:"Norteamérica"},{value:"ca",label:"Canadá",group:"Norteamérica"},{value:"br",label:"Brasil",group:"Sudamérica"},{value:"ar",label:"Argentina",group:"Sudamérica"}],j=[{value:"admin",label:"Administrador",img:"https://placehold.co/40x40?text=A"},{value:"user",label:"Usuario",img:"https://placehold.co/40x40?text=U"},{value:"moderator",label:"Moderador",img:"https://placehold.co/40x40?text=M"},{value:"guest",label:"Invitado",img:"https://placehold.co/40x40?text=G",disabled:!0}],M=[{value:"PENDING",label:"Pendiente"},{value:"REJECTED",label:"Rechazado"},{value:"CANCELED",label:"Cancelado"},{value:"REFUNDED",label:"Reembolsado"},{value:"COMPLETED",label:"Completado"},{value:"EXPIRED",label:"Expirado"}],ke={title:"Components/Select",component:s,tags:["autodocs"],parameters:{layout:"padded",docs:{description:{component:"Componente select personalizado con soporte para múltiples variantes como agrupación, chips, filtros, y renderizado personalizado."}}},argTypes:{label:{control:"text",description:"Etiqueta para el campo de selección."},options:{control:"object",description:"Array de objetos `SelectOption` para las opciones del menú."},value:{control:"object",description:"Valor(es) seleccionado(s) del select."},defaultValue:{control:"object",description:"Valor(es) por defecto del select."},onChange:{action:"changed",description:"Función de callback que se llama cuando el valor del select cambia."},size:{control:"radio",options:["small","medium"],description:"Define el tamaño del componente Select."},multiple:{control:"boolean",description:"Si es verdadero, permite la selección de múltiples opciones."},filterable:{control:"boolean",description:"Si es verdadero, añade un campo de búsqueda para filtrar las opciones."},placeholder:{control:"text",description:"Texto que se muestra cuando no hay nada seleccionado."},children:{control:!1,description:"Componente `Option` para un renderizado personalizado de las opciones del menú."},maxHeight:{control:"number",description:"Altura máxima del menú desplegable."},maxWidth:{control:"text",description:"Ancho máximo del menú desplegable."},maxChipsToShow:{control:"number",description:"Número máximo de chips a mostrar en selección múltiple antes de agrupar.",if:{arg:"multiple",eq:!0}},renderChipLabel:{control:!1,description:"Función para personalizar el contenido del label de cada chip seleccionado (para múltiple) o del valor mostrado (para individual)."},labelPosition:{control:"radio",options:["outside","floating"],description:"Posición del label. `outside` mantiene el label por encima del input con animación al enfocar. `floating` usa el comportamiento nativo de MUI (label flotando dentro del notched outline)."},borderRadius:{control:"number",description:"Radio del borde del select. Acepta un número (en px) o un string CSS."},sx:{control:!1,description:"Prop `sx` que se pasa al MUI Select para overrides personalizados. Se mergea con los estilos por defecto."}}},m={render:()=>{const[o,t]=i.useState("25");return e.jsxs(l,{sx:{width:200},children:[e.jsx(s,{label:"Registros por página",options:u,value:o,onChange:a=>t(a),maxWidth:150}),e.jsxs(r,{sx:{mt:2},children:["Valor seleccionado: ",o]})]})},parameters:{docs:{description:{story:"Select simple con opciones básicas y valor por defecto."},source:{code:L.trim()}}}},h={render:()=>{const[o,t]=i.useState([]);return e.jsxs(l,{sx:{width:400},children:[e.jsx(s,{label:"Seleccionar estados",multiple:!0,maxChipsToShow:2,options:[{value:"pending",label:"Pendiente"},{value:"approved",label:"Aprobado"},{value:"rejected",label:"Rechazado"},{value:"canceled",label:"Cancelado"},{value:"completed",label:"Completado"},{value:"invoiced",label:"Facturado"}],value:o,onChange:a=>t(a)}),e.jsxs(r,{sx:{mt:2},children:["Valor seleccionado: ",JSON.stringify(o)]})]})},parameters:{docs:{description:{story:"Select múltiple que permite seleccionar varias opciones, limitando a 2 chips."},source:{code:I.trim()}}}},g={render:()=>{const[o,t]=i.useState("");return e.jsxs(l,{sx:{width:300},children:[e.jsx(s,{label:"Seleccione una opción",options:u,value:o,onChange:a=>t(a),placeholder:"Ninguna opción seleccionada"}),e.jsxs(r,{sx:{mt:2},children:["Valor seleccionado: ",o||"Ninguno"]})]})},parameters:{docs:{description:{story:"Select con placeholder sin valor inicial seleccionado."},source:{code:z.trim()}}}},v={render:()=>{const[o,t]=i.useState("");return e.jsxs(l,{sx:{width:300},children:[e.jsx(s,{label:"Buscar país",filterable:!0,options:d,value:o,onChange:a=>t(a)}),e.jsxs(r,{sx:{mt:2},children:["Valor seleccionado: ",o]})]})},parameters:{docs:{description:{story:"Select con capacidad de filtrado de opciones."},source:{code:U.trim()}}}},x={render:()=>{const[o,t]=i.useState("");return e.jsxs(l,{sx:{width:300},children:[e.jsx(s,{label:"País por región",options:d,value:o,onChange:a=>t(a)}),e.jsxs(r,{sx:{mt:2},children:["Valor seleccionado: ",o]})]})},parameters:{docs:{description:{story:"Select con opciones agrupadas por categorías."},source:{code:q.trim()}}}},b={render:()=>{const[o,t]=i.useState([]);return e.jsxs(l,{sx:{width:300},children:[e.jsx(s,{options:j,multiple:!0,value:o,onChange:a=>t(a),label:"Usuarios",placeholder:"Selecciona usuarios",children:e.jsx(D,{children:({img:a,label:c})=>e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(R,{src:a,sx:{width:24,height:24}}),e.jsx(r,{variant:"body2",children:c})]})})}),e.jsxs(r,{sx:{mt:2},children:["Valor seleccionado: ",JSON.stringify(o)]})]})},parameters:{docs:{description:{story:"Select con renderizado personalizado de opciones usando avatares."},source:{code:G.trim()}}}},y={render:()=>{const[o,t]=i.useState(["pending","approved","rejected","canceled"]);return e.jsxs(l,{sx:{width:400},children:[e.jsx(s,{label:"Estados de Transacción",multiple:!0,maxChipsToShow:3,options:M,value:o,onChange:a=>t(a),placeholder:"Selecciona estados",renderChipLabel:a=>e.jsxs(r,{variant:"caption",sx:{fontWeight:"bold"},children:[a.label.charAt(0).toUpperCase()," "]})}),e.jsxs(r,{sx:{mt:2},children:["Valor seleccionado: ",JSON.stringify(o)]})]})},parameters:{docs:{description:{story:"Select múltiple con un número limitado de chips visibles y un renderizado personalizado para el label de cada chip (solo la inicial)."},source:{code:F.trim()}}}},S={render:()=>{const[o,t]=i.useState(["gt","mx","us","ca","br"]);return e.jsxs(l,{sx:{width:400},children:[e.jsx(s,{label:"Países seleccionados",multiple:!0,maxChipsToShow:3,options:d,value:o,onChange:a=>t(a),placeholder:"Selecciona países",renderChipLabel:a=>e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:.5},children:[a.img&&e.jsx(R,{src:a.img,sx:{width:18,height:18}})," ",e.jsx(r,{variant:"caption",sx:{fontWeight:"medium"},children:a.label})]})}),e.jsxs(r,{sx:{mt:2},children:["Valor seleccionado: ",JSON.stringify(o)]})]})},parameters:{docs:{story:"Select múltiple con renderizado personalizado completo de los chips, incluyendo avatar y texto completo, y limitando el número de chips visibles."},source:{code:J.trim()}}},f={render:()=>{const[o,t]=i.useState("");return e.jsxs(l,{sx:{width:300},children:[e.jsx(s,{label:"Opciones (Altura Limitada)",options:d.concat(j).concat(M),value:o,onChange:a=>t(a),maxHeight:150}),e.jsxs(r,{sx:{mt:2},children:["Valor seleccionado: ",o]})]})},parameters:{docs:{story:"Select con altura máxima limitada para el menú desplegable, mostrando scroll si es necesario."},source:{code:k.trim()}}},C={render:()=>{const[o,t]=i.useState("");return e.jsxs(l,{sx:{width:200},children:[" ",e.jsx(s,{label:"Opciones (Ancho Limitado)",options:u.concat(d),value:o,onChange:a=>t(a),maxWidth:100}),e.jsxs(r,{sx:{mt:2},children:["Valor seleccionado: ",o]})]})},parameters:{docs:{story:"Select con ancho máximo limitado para el menú desplegable."},source:{code:H.trim()}}},V={render:()=>{const[o,t]=i.useState(["gt","admin","PENDING","ca","user","COMPLETED"]);return e.jsxs(l,{sx:{width:500},children:[e.jsx(s,{label:"Selección Completa",multiple:!0,filterable:!0,maxChipsToShow:3,maxHeight:250,maxWidth:"400px",options:d.concat(j).concat(M),value:o,onChange:a=>t(a),placeholder:"Busca y selecciona todo tipo de elementos",renderChipLabel:a=>e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:.5},children:[a.img&&e.jsx(R,{src:a.img,sx:{width:16,height:16}}),e.jsx(r,{variant:"caption",sx:{fontWeight:"bold"},children:a.label.length>10?a.label.substring(0,7)+"...":a.label})]}),children:e.jsx(D,{children:a=>e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:1,my:.5},children:[a.img&&e.jsx(R,{src:a.img,sx:{width:28,height:28}}),e.jsxs(l,{children:[e.jsx(r,{variant:"body2",fontWeight:"medium",children:a.label}),a.group&&e.jsxs(r,{variant:"caption",color:"text.secondary",children:["Grupo: ",a.group]}),a.disabled&&e.jsx(W,{label:"No disponible",size:"small",color:"warning",sx:{ml:1}})]})]})})}),e.jsxs(r,{sx:{mt:2},children:["Valor seleccionado: ",JSON.stringify(o)]})]})},parameters:{docs:{description:{story:"Un `Select` que demuestra una combinación de todas las características: selección múltiple, filtrado, opciones agrupadas, renderizado personalizado de opciones y chips, y límites de altura/ancho."},source:{code:$.trim()}}}},B={args:{label:"Seleccionar (Vacío)",options:[],value:void 0,placeholder:"No hay opciones disponibles"},render:o=>{const[t,a]=i.useState(o.value);return e.jsxs(l,{sx:{width:300},children:[e.jsx(s,{...o,value:t??"",onChange:a}),e.jsxs(r,{sx:{mt:2},children:["Valor seleccionado: ",t||"Ninguno"]})]})},parameters:{docs:{story:"Select que se muestra cuando no hay opciones disponibles."},source:{code:_.trim()}}},O={render:()=>{const o=Array.from({length:50},(c,n)=>({value:`option-${n}`,label:`Opción ${n+1}`,group:n<25?"Grupo A":"Grupo B"})),[t,a]=i.useState("");return e.jsxs(l,{sx:{width:300},children:[e.jsx(s,{label:"Muchas Opciones",options:o,value:t,onChange:c=>a(c),filterable:!0,maxHeight:200}),e.jsxs(r,{sx:{mt:2},children:["Valor seleccionado: ",t]})]})},parameters:{docs:{story:"Select con un gran número de opciones para demostrar el scroll y el filtrado eficiente."},source:{code:X.trim()}}},T={render:()=>{const[o,t]=i.useState("");return e.jsxs(l,{sx:{width:300},children:[e.jsx(s,{label:"Label flotante (MUI nativo)",options:u,value:o,onChange:a=>t(a),labelPosition:"floating"}),e.jsxs(r,{sx:{mt:2},children:["Valor seleccionado: ",o||"Ninguno"]})]})},parameters:{docs:{description:{story:"Select con `labelPosition='floating'`, que usa el comportamiento nativo de MUI (label flotando dentro del notched outline al enfocar). Útil cuando se necesita el look estándar de Material UI."},source:{code:K.trim()}}}},w={render:()=>{const[o,t]=i.useState("25"),[a,c]=i.useState("25"),[n,N]=i.useState("25");return e.jsxs(l,{sx:{width:300,display:"flex",flexDirection:"column",gap:2},children:[e.jsx(s,{label:"Sin border radius",options:u,value:o,onChange:p=>t(p),borderRadius:0}),e.jsx(s,{label:"Border radius estándar",options:u,value:a,onChange:p=>c(p),borderRadius:10}),e.jsx(s,{label:"Pill-shaped",options:u,value:n,onChange:p=>N(p),borderRadius:999})]})},parameters:{docs:{description:{story:"Control del radio del borde mediante la prop `borderRadius`. Acepta un número (en px) o un string CSS como `'0.5rem'`."},source:{code:Q.trim()}}}},A={render:()=>{const[o,t]=i.useState(["admin"]);return e.jsxs(l,{sx:{width:360},children:[e.jsx(s,{label:"Select con estilos personalizados",options:j,multiple:!0,value:o,onChange:a=>t(a),placeholder:"Selecciona usuarios",sx:{"& .MuiInputBase-root":{backgroundColor:"action.hover"},"& .MuiOutlinedInput-notchedOutline":{borderColor:"primary.main",borderWidth:"2px"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"primary.dark"}}}),e.jsxs(r,{sx:{mt:2},children:["Valor seleccionado: ",JSON.stringify(o)]})]})},parameters:{docs:{description:{story:"Demuestra cómo el consumidor puede pasar un `sx` personalizado. El sx del consumidor se mergea sobre los defaults del componente, permitiendo overrides granulares (fondo, borde, hover, etc.) sin romper el comportamiento del label."},source:{code:Y.trim()}}}},E={render:()=>{const[o,t]=i.useState(""),a=[{value:"apple",label:"Apple"},{value:"banana",label:"Banana"},{value:"orange",label:"Orange"},{value:"grape",label:"Grape"},{value:"strawberry",label:"Strawberry"},{value:"blueberry",label:"Blueberry"},{value:"pineapple",label:"Pineapple"},{value:"watermelon",label:"Watermelon"},{value:"kiwi",label:"Kiwi"},{value:"lemon",label:"Lemon"}],c=n=>new Promise(N=>{setTimeout(()=>{const p=a.filter(P=>P.label.toLowerCase().includes(n.toLowerCase()));N(p)},800)});return e.jsxs(l,{sx:{width:300},children:[e.jsx(s,{loadOptions:c,value:o,onChange:n=>t(n),placeholder:"Escribe para buscar...",loadingMessage:"Buscando frutas...",noOptionsMessage:"No se encontraron frutas.",debounceTimeout:500}),e.jsxs(r,{sx:{mt:2},children:["Valor seleccionado: ",o]})]})},parameters:{docs:{description:{story:"Un `Select` que carga opciones de forma asíncrona a medida que el usuario escribe, con un retraso simulado."},source:{code:Z.trim()}}}};m.parameters={...m.parameters,docs:{...m.parameters?.docs,source:{originalSource:`{
571
+ render: () => {
572
+ const [value, setValue] = useState<string>('25');
573
+ return <Box sx={{
574
+ width: 200
575
+ }}>
576
+ <Select label="Registros por página" options={basicOptions} value={value} onChange={val => setValue(val as string)} maxWidth={150} />
577
+ <Typography sx={{
578
+ mt: 2
579
+ }}>Valor seleccionado: {value}</Typography>
580
+ </Box>;
581
+ },
582
+ parameters: {
583
+ docs: {
584
+ description: {
585
+ story: "Select simple con opciones básicas y valor por defecto."
586
+ },
587
+ source: {
588
+ code: SimpleSelectDefinition.trim()
589
+ } // Referencia a la definición
590
+ }
591
+ }
592
+ }`,...m.parameters?.docs?.source}}};h.parameters={...h.parameters,docs:{...h.parameters?.docs,source:{originalSource:`{
593
+ render: () => {
594
+ const [value, setValue] = useState<string[]>([]);
595
+ return <Box sx={{
596
+ width: 400
597
+ }}>
598
+ <Select label="Seleccionar estados" multiple maxChipsToShow={2} options={[{
599
+ value: 'pending',
600
+ label: 'Pendiente'
601
+ }, {
602
+ value: 'approved',
603
+ label: 'Aprobado'
604
+ }, {
605
+ value: 'rejected',
606
+ label: 'Rechazado'
607
+ }, {
608
+ value: 'canceled',
609
+ label: 'Cancelado'
610
+ }, {
611
+ value: 'completed',
612
+ label: 'Completado'
613
+ }, {
614
+ value: 'invoiced',
615
+ label: 'Facturado'
616
+ }]} value={value} onChange={val => setValue(val as string[])} />
617
+ <Typography sx={{
618
+ mt: 2
619
+ }}>Valor seleccionado: {JSON.stringify(value)}</Typography>
620
+ </Box>;
621
+ },
622
+ parameters: {
623
+ docs: {
624
+ description: {
625
+ story: "Select múltiple que permite seleccionar varias opciones, limitando a 2 chips."
626
+ },
627
+ source: {
628
+ code: MultiSelectDefinition.trim()
629
+ } // Referencia a la definición
630
+ }
631
+ }
632
+ }`,...h.parameters?.docs?.source}}};g.parameters={...g.parameters,docs:{...g.parameters?.docs,source:{originalSource:`{
633
+ render: () => {
634
+ const [value, setValue] = useState('');
635
+ return <Box sx={{
636
+ width: 300
637
+ }}>
638
+ <Select label="Seleccione una opción" options={basicOptions} value={value} onChange={val => setValue(val as string)} placeholder="Ninguna opción seleccionada" />
639
+ <Typography sx={{
640
+ mt: 2
641
+ }}>Valor seleccionado: {value || 'Ninguno'}</Typography>
642
+ </Box>;
643
+ },
644
+ parameters: {
645
+ docs: {
646
+ description: {
647
+ story: "Select con placeholder sin valor inicial seleccionado."
648
+ },
649
+ source: {
650
+ code: WithPlaceholderDefinition.trim()
651
+ } // Referencia a la definición
652
+ }
653
+ }
654
+ }`,...g.parameters?.docs?.source}}};v.parameters={...v.parameters,docs:{...v.parameters?.docs,source:{originalSource:`{
655
+ render: () => {
656
+ const [value, setValue] = useState('');
657
+ return <Box sx={{
658
+ width: 300
659
+ }}>
660
+ <Select label="Buscar país" filterable options={groupedOptions} value={value} onChange={val => setValue(val as string)} />
661
+ <Typography sx={{
662
+ mt: 2
663
+ }}>Valor seleccionado: {value}</Typography>
664
+ </Box>;
665
+ },
666
+ parameters: {
667
+ docs: {
668
+ description: {
669
+ story: "Select con capacidad de filtrado de opciones."
670
+ },
671
+ source: {
672
+ code: WithFilterDefinition.trim()
673
+ } // Referencia a la definición
674
+ }
675
+ }
676
+ }`,...v.parameters?.docs?.source}}};x.parameters={...x.parameters,docs:{...x.parameters?.docs,source:{originalSource:`{
677
+ render: () => {
678
+ const [value, setValue] = useState('');
679
+ return <Box sx={{
680
+ width: 300
681
+ }}>
682
+ <Select label="País por región" options={groupedOptions} value={value} onChange={val => setValue(val as string)} />
683
+ <Typography sx={{
684
+ mt: 2
685
+ }}>Valor seleccionado: {value}</Typography>
686
+ </Box>;
687
+ },
688
+ parameters: {
689
+ docs: {
690
+ description: {
691
+ story: "Select con opciones agrupadas por categorías."
692
+ },
693
+ source: {
694
+ code: WithGroupDefinition.trim()
695
+ } // Referencia a la definición
696
+ }
697
+ }
698
+ }`,...x.parameters?.docs?.source}}};b.parameters={...b.parameters,docs:{...b.parameters?.docs,source:{originalSource:`{
699
+ render: () => {
700
+ const [value, setValue] = useState<string[]>([]);
701
+ return <Box sx={{
702
+ width: 300
703
+ }}>
704
+ <Select options={userOptions} multiple value={value} onChange={val => setValue(val as string[])} label="Usuarios" placeholder="Selecciona usuarios">
705
+ <Option>
706
+ {({
707
+ img,
708
+ label
709
+ }) => <Box sx={{
710
+ display: 'flex',
711
+ alignItems: 'center',
712
+ gap: 1
713
+ }}>
714
+ <Avatar src={img} sx={{
715
+ width: 24,
716
+ height: 24
717
+ }} />
718
+ <Typography variant="body2">{label}</Typography>
719
+ </Box>}
720
+ </Option>
721
+ </Select>
722
+ <Typography sx={{
723
+ mt: 2
724
+ }}>Valor seleccionado: {JSON.stringify(value)}</Typography>
725
+ </Box>;
726
+ },
727
+ parameters: {
728
+ docs: {
729
+ description: {
730
+ story: "Select con renderizado personalizado de opciones usando avatares."
731
+ },
732
+ source: {
733
+ code: CustomRenderWithAvatarDefinition.trim()
734
+ } // Referencia a la definición
735
+ }
736
+ }
737
+ }`,...b.parameters?.docs?.source}}};y.parameters={...y.parameters,docs:{...y.parameters?.docs,source:{originalSource:`{
738
+ render: () => {
739
+ const [value, setValue] = useState<string[]>(['pending', 'approved', 'rejected', 'canceled']);
740
+ return <Box sx={{
741
+ width: 400
742
+ }}>
743
+ <Select label="Estados de Transacción" multiple maxChipsToShow={3} // Muestra 3 chips, luego (+X más)
744
+ options={transactionStatuses} value={value} onChange={val => setValue(val as string[])} placeholder="Selecciona estados" renderChipLabel={item =>
745
+ // Renderizado personalizado para el chip
746
+ <Typography variant="caption" sx={{
747
+ fontWeight: 'bold'
748
+ }}>
749
+ {item.label.charAt(0).toUpperCase()} {/* Solo la inicial */}
750
+ </Typography>} />
751
+ <Typography sx={{
752
+ mt: 2
753
+ }}>Valor seleccionado: {JSON.stringify(value)}</Typography>
754
+ </Box>;
755
+ },
756
+ parameters: {
757
+ docs: {
758
+ description: {
759
+ story: "Select múltiple con un número limitado de chips visibles y un renderizado personalizado para el label de cada chip (solo la inicial)."
760
+ },
761
+ source: {
762
+ code: MultiSelectCustomChipRenderDefinition.trim()
763
+ } // Referencia a la definición
764
+ }
765
+ }
766
+ }`,...y.parameters?.docs?.source}}};S.parameters={...S.parameters,docs:{...S.parameters?.docs,source:{originalSource:`{
767
+ render: () => {
768
+ const [value, setValue] = useState<string[]>(['gt', 'mx', 'us', 'ca', 'br']);
769
+ return <Box sx={{
770
+ width: 400
771
+ }}>
772
+ <Select label="Países seleccionados" multiple maxChipsToShow={3} // Muestra 3 chips, luego (+X más)
773
+ options={groupedOptions} value={value} onChange={val => setValue(val as string[])} placeholder="Selecciona países" renderChipLabel={item =>
774
+ // Renderizado personalizado para el chip
775
+ <Box sx={{
776
+ display: 'flex',
777
+ alignItems: 'center',
778
+ gap: 0.5
779
+ }}>
780
+ {item.img && <Avatar src={item.img} sx={{
781
+ width: 18,
782
+ height: 18
783
+ }} />} {/* Opcional: avatar en el chip */}
784
+ <Typography variant="caption" sx={{
785
+ fontWeight: 'medium'
786
+ }}>
787
+ {item.label}
788
+ </Typography>
789
+ </Box>} />
790
+ <Typography sx={{
791
+ mt: 2
792
+ }}>Valor seleccionado: {JSON.stringify(value)}</Typography>
793
+ </Box>;
794
+ },
795
+ parameters: {
796
+ docs: {
797
+ story: "Select múltiple con renderizado personalizado completo de los chips, incluyendo avatar y texto completo, y limitando el número de chips visibles."
798
+ },
799
+ source: {
800
+ code: MultiSelectCustomChipRenderFullLabelDefinition.trim()
801
+ } // Referencia a la definición
802
+ }
803
+ }`,...S.parameters?.docs?.source}}};f.parameters={...f.parameters,docs:{...f.parameters?.docs,source:{originalSource:`{
804
+ render: () => {
805
+ const [value, setValue] = useState('');
806
+ return <Box sx={{
807
+ width: 300
808
+ }}>
809
+ <Select label="Opciones (Altura Limitada)" options={groupedOptions.concat(userOptions).concat(transactionStatuses)} // Muchas opciones
810
+ value={value} onChange={val => setValue(val as string)} maxHeight={150} // Altura máxima del menú
811
+ />
812
+ <Typography sx={{
813
+ mt: 2
814
+ }}>Valor seleccionado: {value}</Typography>
815
+ </Box>;
816
+ },
817
+ parameters: {
818
+ docs: {
819
+ story: "Select con altura máxima limitada para el menú desplegable, mostrando scroll si es necesario."
820
+ },
821
+ source: {
822
+ code: ConstrainedHeightDefinition.trim()
823
+ } // Referencia a la definición
824
+ }
825
+ }`,...f.parameters?.docs?.source}}};C.parameters={...C.parameters,docs:{...C.parameters?.docs,source:{originalSource:`{
826
+ render: () => {
827
+ const [value, setValue] = useState('');
828
+ return <Box sx={{
829
+ width: 200
830
+ }}> {/* El Select en sí es más angosto */}
831
+ <Select label="Opciones (Ancho Limitado)" options={basicOptions.concat(groupedOptions)} value={value} onChange={val => setValue(val as string)} maxWidth={100} // Ancho máximo del menú
832
+ />
833
+ <Typography sx={{
834
+ mt: 2
835
+ }}>Valor seleccionado: {value}</Typography>
836
+ </Box>;
837
+ },
838
+ parameters: {
839
+ docs: {
840
+ story: "Select con ancho máximo limitado para el menú desplegable."
841
+ },
842
+ source: {
843
+ code: ConstrainedWidthDefinition.trim()
844
+ } // Referencia a la definición
845
+ }
846
+ }`,...C.parameters?.docs?.source}}};V.parameters={...V.parameters,docs:{...V.parameters?.docs,source:{originalSource:`{
847
+ render: () => {
848
+ const [value, setValue] = useState<string[]>(['gt', 'admin', 'PENDING', 'ca', 'user', 'COMPLETED']);
849
+ return <Box sx={{
850
+ width: 500
851
+ }}>
852
+ <Select label="Selección Completa" multiple filterable maxChipsToShow={3} maxHeight={250} maxWidth="400px" options={groupedOptions.concat(userOptions).concat(transactionStatuses)} value={value} onChange={val => setValue(val as string[])} placeholder="Busca y selecciona todo tipo de elementos" renderChipLabel={item => <Box sx={{
853
+ display: 'flex',
854
+ alignItems: 'center',
855
+ gap: 0.5
856
+ }}>
857
+ {item.img && <Avatar src={item.img} sx={{
858
+ width: 16,
859
+ height: 16
860
+ }} />}
861
+ <Typography variant="caption" sx={{
862
+ fontWeight: 'bold'
863
+ }}>
864
+ {item.label.length > 10 ? item.label.substring(0, 7) + '...' : item.label}
865
+ </Typography>
866
+ </Box>}>
867
+ <Option>
868
+ {item => <Box sx={{
869
+ display: 'flex',
870
+ alignItems: 'center',
871
+ gap: 1,
872
+ my: 0.5
873
+ }}>
874
+ {item.img && <Avatar src={item.img} sx={{
875
+ width: 28,
876
+ height: 28
877
+ }} />}
878
+ <Box>
879
+ <Typography variant="body2" fontWeight="medium">{item.label}</Typography>
880
+ {item.group && <Typography variant="caption" color="text.secondary">
881
+ Grupo: {item.group}
882
+ </Typography>}
883
+ {item.disabled && <Chip label="No disponible" size="small" color="warning" sx={{
884
+ ml: 1
885
+ }} />}
886
+ </Box>
887
+ </Box>}
888
+ </Option>
889
+ </Select>
890
+ <Typography sx={{
891
+ mt: 2
892
+ }}>Valor seleccionado: {JSON.stringify(value)}</Typography>
893
+ </Box>;
894
+ },
895
+ parameters: {
896
+ docs: {
897
+ description: {
898
+ story: "Un \`Select\` que demuestra una combinación de todas las características: selección múltiple, filtrado, opciones agrupadas, renderizado personalizado de opciones y chips, y límites de altura/ancho."
899
+ },
900
+ source: {
901
+ code: AllFeaturesCombinedDefinition.trim()
902
+ } // Referencia a la definición
903
+ }
904
+ }
905
+ }`,...V.parameters?.docs?.source}}};B.parameters={...B.parameters,docs:{...B.parameters?.docs,source:{originalSource:`{
906
+ args: {
907
+ label: 'Seleccionar (Vacío)',
908
+ options: [],
909
+ value: undefined,
910
+ placeholder: 'No hay opciones disponibles'
911
+ },
912
+ render: args => {
913
+ const [value, setValue] = useState(args.value);
914
+ return <Box sx={{
915
+ width: 300
916
+ }}>
917
+ <Select {...args} value={value ?? ''} onChange={setValue} />
918
+ <Typography sx={{
919
+ mt: 2
920
+ }}>Valor seleccionado: {value || 'Ninguno'}</Typography>
921
+ </Box>;
922
+ },
923
+ parameters: {
924
+ docs: {
925
+ story: "Select que se muestra cuando no hay opciones disponibles."
926
+ },
927
+ source: {
928
+ code: EmptyOptionsDefinition.trim()
929
+ } // Referencia a la definición
930
+ }
931
+ }`,...B.parameters?.docs?.source}}};O.parameters={...O.parameters,docs:{...O.parameters?.docs,source:{originalSource:`{
932
+ render: () => {
933
+ const manyOptions = Array.from({
934
+ length: 50
935
+ }, (_, i) => ({
936
+ value: \`option-\${i}\`,
937
+ label: \`Opción \${i + 1}\`,
938
+ group: i < 25 ? 'Grupo A' : 'Grupo B'
939
+ }));
940
+ const [value, setValue] = useState('');
941
+ return <Box sx={{
942
+ width: 300
943
+ }}>
944
+ <Select label="Muchas Opciones" options={manyOptions} value={value} onChange={val => setValue(val as string)} filterable maxHeight={200} />
945
+ <Typography sx={{
946
+ mt: 2
947
+ }}>Valor seleccionado: {value}</Typography>
948
+ </Box>;
949
+ },
950
+ parameters: {
951
+ docs: {
952
+ story: "Select con un gran número de opciones para demostrar el scroll y el filtrado eficiente."
953
+ },
954
+ source: {
955
+ code: SelectWithManyOptionsDefinition.trim()
956
+ } // Referencia a la definición
957
+ }
958
+ }`,...O.parameters?.docs?.source}}};T.parameters={...T.parameters,docs:{...T.parameters?.docs,source:{originalSource:`{
959
+ render: () => {
960
+ const [value, setValue] = useState('');
961
+ return <Box sx={{
962
+ width: 300
963
+ }}>
964
+ <Select label="Label flotante (MUI nativo)" options={basicOptions} value={value} onChange={val => setValue(val as string)} labelPosition="floating" />
965
+ <Typography sx={{
966
+ mt: 2
967
+ }}>Valor seleccionado: {value || 'Ninguno'}</Typography>
968
+ </Box>;
969
+ },
970
+ parameters: {
971
+ docs: {
972
+ description: {
973
+ story: "Select con \`labelPosition='floating'\`, que usa el comportamiento nativo de MUI (label flotando dentro del notched outline al enfocar). Útil cuando se necesita el look estándar de Material UI."
974
+ },
975
+ source: {
976
+ code: LabelPositionFloatingDefinition.trim()
977
+ }
978
+ }
979
+ }
980
+ }`,...T.parameters?.docs?.source}}};w.parameters={...w.parameters,docs:{...w.parameters?.docs,source:{originalSource:`{
981
+ render: () => {
982
+ const [valueA, setValueA] = useState('25');
983
+ const [valueB, setValueB] = useState('25');
984
+ const [valueC, setValueC] = useState('25');
985
+ return <Box sx={{
986
+ width: 300,
987
+ display: 'flex',
988
+ flexDirection: 'column',
989
+ gap: 2
990
+ }}>
991
+ <Select label="Sin border radius" options={basicOptions} value={valueA} onChange={val => setValueA(val as string)} borderRadius={0} />
992
+ <Select label="Border radius estándar" options={basicOptions} value={valueB} onChange={val => setValueB(val as string)} borderRadius={10} />
993
+ <Select label="Pill-shaped" options={basicOptions} value={valueC} onChange={val => setValueC(val as string)} borderRadius={999} />
994
+ </Box>;
995
+ },
996
+ parameters: {
997
+ docs: {
998
+ description: {
999
+ story: "Control del radio del borde mediante la prop \`borderRadius\`. Acepta un número (en px) o un string CSS como \`'0.5rem'\`."
1000
+ },
1001
+ source: {
1002
+ code: CustomBorderRadiusDefinition.trim()
1003
+ }
1004
+ }
1005
+ }
1006
+ }`,...w.parameters?.docs?.source}}};A.parameters={...A.parameters,docs:{...A.parameters?.docs,source:{originalSource:`{
1007
+ render: () => {
1008
+ const [value, setValue] = useState<string[]>(['admin']);
1009
+ return <Box sx={{
1010
+ width: 360
1011
+ }}>
1012
+ <Select label="Select con estilos personalizados" options={userOptions} multiple value={value} onChange={val => setValue(val as string[])} placeholder="Selecciona usuarios" sx={{
1013
+ '& .MuiInputBase-root': {
1014
+ backgroundColor: 'action.hover'
1015
+ },
1016
+ '& .MuiOutlinedInput-notchedOutline': {
1017
+ borderColor: 'primary.main',
1018
+ borderWidth: '2px'
1019
+ },
1020
+ '&:hover .MuiOutlinedInput-notchedOutline': {
1021
+ borderColor: 'primary.dark'
1022
+ }
1023
+ }} />
1024
+ <Typography sx={{
1025
+ mt: 2
1026
+ }}>Valor seleccionado: {JSON.stringify(value)}</Typography>
1027
+ </Box>;
1028
+ },
1029
+ parameters: {
1030
+ docs: {
1031
+ description: {
1032
+ story: "Demuestra cómo el consumidor puede pasar un \`sx\` personalizado. El sx del consumidor se mergea sobre los defaults del componente, permitiendo overrides granulares (fondo, borde, hover, etc.) sin romper el comportamiento del label."
1033
+ },
1034
+ source: {
1035
+ code: CustomStylingDefinition.trim()
1036
+ }
1037
+ }
1038
+ }
1039
+ }`,...A.parameters?.docs?.source}}};E.parameters={...E.parameters,docs:{...E.parameters?.docs,source:{originalSource:`{
1040
+ render: () => {
1041
+ const [value, setValue] = useState('');
1042
+ const mockAsyncOptions = [{
1043
+ value: 'apple',
1044
+ label: 'Apple'
1045
+ }, {
1046
+ value: 'banana',
1047
+ label: 'Banana'
1048
+ }, {
1049
+ value: 'orange',
1050
+ label: 'Orange'
1051
+ }, {
1052
+ value: 'grape',
1053
+ label: 'Grape'
1054
+ }, {
1055
+ value: 'strawberry',
1056
+ label: 'Strawberry'
1057
+ }, {
1058
+ value: 'blueberry',
1059
+ label: 'Blueberry'
1060
+ }, {
1061
+ value: 'pineapple',
1062
+ label: 'Pineapple'
1063
+ }, {
1064
+ value: 'watermelon',
1065
+ label: 'Watermelon'
1066
+ }, {
1067
+ value: 'kiwi',
1068
+ label: 'Kiwi'
1069
+ }, {
1070
+ value: 'lemon',
1071
+ label: 'Lemon'
1072
+ }];
1073
+
1074
+ // Simulate an API call
1075
+ const simulatedLoadOptions = (inputValue: string): Promise<SelectOption[]> => {
1076
+ return new Promise(resolve => {
1077
+ setTimeout(() => {
1078
+ const filtered = mockAsyncOptions.filter(option => option.label.toLowerCase().includes(inputValue.toLowerCase()));
1079
+ resolve(filtered);
1080
+ }, 800); // Simulate network delay
1081
+ });
1082
+ };
1083
+ return <Box sx={{
1084
+ width: 300
1085
+ }}>
1086
+ <Select loadOptions={simulatedLoadOptions} value={value} onChange={val => setValue(val as string)} placeholder="Escribe para buscar..." loadingMessage="Buscando frutas..." noOptionsMessage="No se encontraron frutas." debounceTimeout={500} // tiempo que tardara el input en buscar despues de haber escrito la ultima letra
1087
+ />
1088
+ <Typography sx={{
1089
+ mt: 2
1090
+ }}>Valor seleccionado: {value}</Typography>
1091
+ </Box>;
1092
+ },
1093
+ parameters: {
1094
+ docs: {
1095
+ description: {
1096
+ story: "Un \`Select\` que carga opciones de forma asíncrona a medida que el usuario escribe, con un retraso simulado."
1097
+ },
1098
+ source: {
1099
+ code: AsyncSelectDefinition.trim()
1100
+ }
1101
+ }
1102
+ }
1103
+ }`,...E.parameters?.docs?.source}}};const He=["SimpleSelect","MultiSelect","WithPlaceholder","WithFilter","WithGroup","CustomRenderWithAvatar","MultiSelectCustomChipRender","MultiSelectCustomChipRenderFullLabel","ConstrainedHeight","ConstrainedWidth","AllFeaturesCombined","EmptyOptions","SelectWithManyOptions","LabelPositionFloating","CustomBorderRadius","CustomStyling","AsyncSelect"];export{V as AllFeaturesCombined,E as AsyncSelect,f as ConstrainedHeight,C as ConstrainedWidth,w as CustomBorderRadius,b as CustomRenderWithAvatar,A as CustomStyling,B as EmptyOptions,T as LabelPositionFloating,h as MultiSelect,y as MultiSelectCustomChipRender,S as MultiSelectCustomChipRenderFullLabel,O as SelectWithManyOptions,m as SimpleSelect,v as WithFilter,x as WithGroup,g as WithPlaceholder,He as __namedExportsOrder,ke as default};