@soyfri/shared-library 2.0.0-beta.0 → 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.
- package/dist/README.md +243 -0
- package/dist/components/Drawer/Drawer.cjs +14 -17
- package/dist/components/Drawer/Drawer.cjs.map +1 -1
- package/dist/components/Drawer/Drawer.d.ts +8 -1
- package/dist/components/Drawer/Drawer.js +14 -17
- package/dist/components/Drawer/Drawer.js.map +1 -1
- package/dist/components/Input/Input.definitions.d.ts +1 -0
- package/dist/components/RadioGroup/RadioGroup.cjs +202 -0
- package/dist/components/RadioGroup/RadioGroup.cjs.map +1 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +53 -0
- package/dist/components/RadioGroup/RadioGroup.definitions.d.ts +6 -0
- package/dist/components/RadioGroup/RadioGroup.js +202 -0
- package/dist/components/RadioGroup/RadioGroup.js.map +1 -0
- package/dist/components/RadioGroup/RadioGroup.sx.d.ts +20 -0
- package/dist/components/RadioGroup/RadioGroup.types.d.ts +1 -0
- package/dist/components/RadioGroup/index.d.ts +2 -0
- package/dist/components/RadioGroup.d.ts +6 -0
- package/dist/components/Stepper/Stepper.cjs +136 -23
- package/dist/components/Stepper/Stepper.cjs.map +1 -1
- package/dist/components/Stepper/Stepper.js +137 -24
- package/dist/components/Stepper/Stepper.js.map +1 -1
- package/dist/components/Switch/Switch.cjs +181 -0
- package/dist/components/Switch/Switch.cjs.map +1 -0
- package/dist/components/Switch/Switch.d.ts +43 -0
- package/dist/components/Switch/Switch.definitions.d.ts +7 -0
- package/dist/components/Switch/Switch.js +181 -0
- package/dist/components/Switch/Switch.js.map +1 -0
- package/dist/components/Switch/Switch.sx.d.ts +22 -0
- package/dist/components/Switch/Switch.types.d.ts +1 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/Switch.d.ts +6 -0
- package/dist/index.cjs +24 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +7 -1
- package/dist/mui.d.ts +1 -0
- package/dist/package.json +207 -0
- package/dist/theme/componentStyles.d.ts +1 -1
- package/package.json +1 -1
- package/src/components/Drawer/Drawer.stories.tsx +168 -0
- package/src/components/Drawer/Drawer.tsx +26 -18
- package/src/components/Input/Input.definitions.ts +24 -0
- package/src/components/Input/Input.stories.tsx +29 -0
- package/src/components/RadioGroup/RadioGroup.definitions.ts +177 -0
- package/src/components/RadioGroup/RadioGroup.stories.tsx +231 -0
- package/src/components/RadioGroup/RadioGroup.sx.ts +75 -0
- package/src/components/RadioGroup/RadioGroup.tsx +196 -0
- package/src/components/RadioGroup/RadioGroup.types.ts +10 -0
- package/src/components/RadioGroup/index.ts +9 -0
- package/src/components/Stepper/Stepper.stories.tsx +72 -0
- package/src/components/Stepper/Stepper.tsx +139 -4
- package/src/components/Switch/Switch.definitions.ts +134 -0
- package/src/components/Switch/Switch.stories.tsx +213 -0
- package/src/components/Switch/Switch.sx.ts +81 -0
- package/src/components/Switch/Switch.tsx +172 -0
- package/src/components/Switch/Switch.types.ts +10 -0
- package/src/components/Switch/index.ts +9 -0
- package/src/mui.ts +10 -0
- package/src/theme/componentStyles.ts +3 -1
- package/storybook-static/addon-visual-tests-assets/visual-test-illustration.mp4 +0 -0
- package/storybook-static/assets/AccountCircle-BDZFsbTw.js +1 -0
- package/storybook-static/assets/ActionMenu-EynP8yU1.js +19 -0
- package/storybook-static/assets/ActionMenu.stories-DqSqRGix.js +185 -0
- package/storybook-static/assets/Alert-3zvTPc0p.js +1 -0
- package/storybook-static/assets/AppBar.stories-DcX3M5th.js +172 -0
- package/storybook-static/assets/Autocomplete.stories-CXJm8FOT.js +788 -0
- package/storybook-static/assets/Avatar-NbFfkZws.js +1 -0
- package/storybook-static/assets/Avatar.stories-CwOYCzqU.js +390 -0
- package/storybook-static/assets/Box-BnhEcfFm.js +1 -0
- package/storybook-static/assets/Button-D9h7OggD.js +1 -0
- package/storybook-static/assets/Button-DBpqmVB_.js +1 -0
- package/storybook-static/assets/Button.stories-F20dmnjq.js +320 -0
- package/storybook-static/assets/ButtonBase-qyaMEhe4.js +74 -0
- package/storybook-static/assets/Card.stories-B3NpAhO0.js +154 -0
- package/storybook-static/assets/CheckCircleOutline-CEj5mDsl.js +1 -0
- package/storybook-static/assets/Chip-C3vKPpzR.js +1 -0
- package/storybook-static/assets/Chip.stories-sxcfHVo9.js +333 -0
- package/storybook-static/assets/CircularProgress-DC7ZNWwl.js +28 -0
- package/storybook-static/assets/Clear-4kYcKvT3.js +1 -0
- package/storybook-static/assets/ClipBoard-DvLBdNHe.js +1 -0
- package/storybook-static/assets/ClipBoard.stories-BGUo47r6.js +108 -0
- package/storybook-static/assets/Close-CgHeRgmh.js +1 -0
- package/storybook-static/assets/Close-Cy8nELYU.js +1 -0
- package/storybook-static/assets/Color-AVL7NMMY-BJKvwERm.js +1 -0
- package/storybook-static/assets/ContentCopy-BfLTDb10.js +1 -0
- package/storybook-static/assets/DatePicker-Clkpr-Ku.js +1 -0
- package/storybook-static/assets/DatePicker.stories-EaUCMkh3.js +444 -0
- package/storybook-static/assets/DateRangePicker.stories-BMlkj-8K.js +390 -0
- package/storybook-static/assets/DateTimePicker.stories-B6gdzKq5.js +555 -0
- package/storybook-static/assets/DefaultPropsProvider-BGoQxtDa.js +16 -0
- package/storybook-static/assets/Delete-D2SMMmIA.js +1 -0
- package/storybook-static/assets/DialogContent-BeCDKgax.js +1 -0
- package/storybook-static/assets/Divider-BbCj9wT4.js +1 -0
- package/storybook-static/assets/DocsRenderer-PQXLIZUC-BebLK5Y_.js +1243 -0
- package/storybook-static/assets/Drawer-DcFwy73r.js +1 -0
- package/storybook-static/assets/Drawer.stories-C5AZkJBk.js +173 -0
- package/storybook-static/assets/EmptyTable-B-RKtgVs.png +0 -0
- package/storybook-static/assets/ErrorOutline-D9gM7ART.js +1 -0
- package/storybook-static/assets/Fade-Ll96CvH8.js +1 -0
- package/storybook-static/assets/Flyout.stories-Cf7z6MNw.js +163 -0
- package/storybook-static/assets/Gallery.stories-DdpWVTF6.js +127 -0
- package/storybook-static/assets/Grow-8y4FglGK.js +1 -0
- package/storybook-static/assets/Home-BRvJEp2L.js +1 -0
- package/storybook-static/assets/Icon.stories-D0mUiW_t.js +78 -0
- package/storybook-static/assets/IconButton-9OYSTH58.js +1 -0
- package/storybook-static/assets/Input-CjX0t4h-.js +1 -0
- package/storybook-static/assets/Input.stories-BRxekliy.js +650 -0
- package/storybook-static/assets/InputGroup.stories-DH6gUfmn.js +306 -0
- package/storybook-static/assets/KeyboardArrowRight-WO_attK2.js +1 -0
- package/storybook-static/assets/KeyboardArrowUp-DsyVef-i.js +1 -0
- package/storybook-static/assets/ListItem-D3O0103N.js +1 -0
- package/storybook-static/assets/ListItemIcon-hca6xN79.js +1 -0
- package/storybook-static/assets/ListItemText-BFLAwLdl.js +1 -0
- package/storybook-static/assets/Logout-gj-P3AfU.js +1 -0
- package/storybook-static/assets/Menu-ClzfjLc3.js +1 -0
- package/storybook-static/assets/MenuButton.stories-B-W_QVDt.js +162 -0
- package/storybook-static/assets/MenuItem-iU6tAqJI.js +1 -0
- package/storybook-static/assets/Modal-3okp9H2i.js +1 -0
- package/storybook-static/assets/Modal.stories-DIWzm4qR.js +468 -0
- package/storybook-static/assets/MoreVert-BoIVG4gh.js +1 -0
- package/storybook-static/assets/Notifications-DY_A-Sho.js +1 -0
- package/storybook-static/assets/PageLoader.stories-DmtO1mlm.js +158 -0
- package/storybook-static/assets/Paper-SwQBhqI7.js +1 -0
- package/storybook-static/assets/Person-CkQl-mpq.js +1 -0
- package/storybook-static/assets/PickersModalDialog-Tjnr_cu5.js +10 -0
- package/storybook-static/assets/PickersToolbarButton-Tt185-si.js +1 -0
- package/storybook-static/assets/Popper-CnCTYXxy.js +1 -0
- package/storybook-static/assets/Portal-Cj8XF9Lf.js +1 -0
- package/storybook-static/assets/ScrollTopButton.stories-BflQCwNP.js +90 -0
- package/storybook-static/assets/Select-CjcuMAY0.js +4 -0
- package/storybook-static/assets/Select-DJh2biEb.js +3 -0
- package/storybook-static/assets/Select.stories-DU1Gb3I2.js +1103 -0
- package/storybook-static/assets/Settings-BLKc1CnO.js +1 -0
- package/storybook-static/assets/Snackbar-BtVeKTw6.js +1 -0
- package/storybook-static/assets/Stack-D01OUIXi.js +1 -0
- package/storybook-static/assets/Stat.stories-Bn9-iuPT.js +60 -0
- package/storybook-static/assets/StatusMessage.stories-hnfX8FeU.js +73 -0
- package/storybook-static/assets/Stepper-BtKB5ykn.js +2 -0
- package/storybook-static/assets/Stepper.stories-CTEZbgPc.js +165 -0
- package/storybook-static/assets/Table.stories-CTn2Ktmn.js +1260 -0
- package/storybook-static/assets/TableContainer-CzLNaEU-.js +1 -0
- package/storybook-static/assets/TableRow-CS88-1HF.js +2 -0
- package/storybook-static/assets/Tabs-DLpDOu_n.js +1 -0
- package/storybook-static/assets/Tabs.stories-BFVuFy_5.js +159 -0
- package/storybook-static/assets/TextField-22T-xHBm.js +1 -0
- package/storybook-static/assets/Timeline.stories-DJU_U2Hv.js +97 -0
- package/storybook-static/assets/Tooltip-DbnHUxNj.js +1 -0
- package/storybook-static/assets/Tooltip.stories-B7tA3dnV.js +66 -0
- package/storybook-static/assets/Typography-BgntX2Ep.js +1 -0
- package/storybook-static/assets/Wizard.stories-CVrJLK_D.js +23 -0
- package/storybook-static/assets/createSimplePaletteValueFilter-bm0fmN_7.js +1 -0
- package/storybook-static/assets/createSvgIcon-D_Gca4vA.js +1 -0
- package/storybook-static/assets/debounce-Be36O1Ab.js +1 -0
- package/storybook-static/assets/emotion-react.browser.esm--g-C9cX9.js +8 -0
- package/storybook-static/assets/extendSxProp-CEpa30hT.js +1 -0
- package/storybook-static/assets/formField.sx-DMCmZIAa.js +1 -0
- package/storybook-static/assets/getReactElementRef-BQ3ANZdy.js +1 -0
- package/storybook-static/assets/iframe-BAJnc_4n.js +1079 -0
- package/storybook-static/assets/index-B1tlhOpe.js +240 -0
- package/storybook-static/assets/index-BF3FAXTk.js +9 -0
- package/storybook-static/assets/index-CIeucmOB.js +2 -0
- package/storybook-static/assets/index-CY7j4a7o.js +1 -0
- package/storybook-static/assets/index-CxkKctw5.js +1 -0
- package/storybook-static/assets/isFocusVisible-B8k4qzLc.js +1 -0
- package/storybook-static/assets/isMuiElement-CTZSFcY5.js +1 -0
- package/storybook-static/assets/jsx-runtime-D_zvdyIk.js +9 -0
- package/storybook-static/assets/listItemTextClasses-CC_rwJam.js +1 -0
- package/storybook-static/assets/mergeSlotProps-B0UBKBMe.js +1 -0
- package/storybook-static/assets/ownerDocument-DW-IO8s5.js +1 -0
- package/storybook-static/assets/ownerWindow-HkKU3E4x.js +1 -0
- package/storybook-static/assets/preload-helper-PPVm8Dsz.js +1 -0
- package/storybook-static/assets/react-18-BUJ64QCV.js +25 -0
- package/storybook-static/assets/resolvePreset-CN2aOJJr.js +1 -0
- package/storybook-static/assets/useControlled-DsVh1a5j.js +1 -0
- package/storybook-static/assets/useForkRef-0ANIrxcF.js +1 -0
- package/storybook-static/assets/useId-b4fZxjOL.js +1 -0
- package/storybook-static/assets/useMobilePicker-DK-c8xbD.js +1 -0
- package/storybook-static/assets/usePreviousProps-WR0rG4aR.js +1 -0
- package/storybook-static/assets/useSlot-b6pXgp5_.js +1 -0
- package/storybook-static/assets/useSlotProps-C0uMfuBt.js +1 -0
- package/storybook-static/assets/useTheme-BmOJK7ra.js +1 -0
- package/storybook-static/assets/useThemeProps-DYtxXiUU.js +1 -0
- package/storybook-static/assets/useThemeProps-U4yXiZ_5.js +1 -0
- package/storybook-static/assets/useTimeout-DNjRaOWc.js +1 -0
- package/storybook-static/assets/visuallyHidden-Dan1xhjv.js +1 -0
- package/storybook-static/favicon-wrapper.svg +46 -0
- package/storybook-static/favicon.svg +1 -0
- package/storybook-static/iframe.html +686 -0
- package/storybook-static/index.html +160 -0
- package/storybook-static/index.json +1 -0
- package/storybook-static/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/project.json +1 -0
- package/storybook-static/sb-addons/chromatic-com-storybook-2/manager-bundle.js +356 -0
- package/storybook-static/sb-addons/chromatic-com-storybook-2/manager-bundle.js.LEGAL.txt +40 -0
- package/storybook-static/sb-addons/docs-4/manager-bundle.js +151 -0
- package/storybook-static/sb-addons/onboarding-1/manager-bundle.js +127 -0
- package/storybook-static/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +971 -0
- package/storybook-static/sb-addons/vitest-3/manager-bundle.js +3 -0
- package/storybook-static/sb-common-assets/favicon-wrapper.svg +46 -0
- package/storybook-static/sb-common-assets/favicon.svg +1 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-bold.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-italic.woff2 +0 -0
- package/storybook-static/sb-common-assets/nunito-sans-regular.woff2 +0 -0
- package/storybook-static/sb-manager/globals-module-info.js +797 -0
- package/storybook-static/sb-manager/globals-runtime.js +69679 -0
- package/storybook-static/sb-manager/globals.js +34 -0
- package/storybook-static/sb-manager/runtime.js +13195 -0
- package/storybook-static/vite-inject-mocker-entry.js +18 -0
|
@@ -0,0 +1,650 @@
|
|
|
1
|
+
import{j as e}from"./jsx-runtime-D_zvdyIk.js";import{r as n}from"./iframe-BAJnc_4n.js";import{I as r}from"./Input-CjX0t4h-.js";import{B as s}from"./Box-BnhEcfFm.js";import{T as d}from"./Typography-BgntX2Ep.js";import"./preload-helper-PPVm8Dsz.js";import"./formField.sx-DMCmZIAa.js";import"./resolvePreset-CN2aOJJr.js";import"./useTheme-BmOJK7ra.js";import"./DefaultPropsProvider-BGoQxtDa.js";import"./extendSxProp-CEpa30hT.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"./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"./createSvgIcon-D_Gca4vA.js";import"./createSimplePaletteValueFilter-bm0fmN_7.js";import"./isMuiElement-CTZSFcY5.js";import"./emotion-react.browser.esm--g-C9cX9.js";const E=`
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { Input } from './Input'; // Ajusta la ruta si es necesario
|
|
4
|
+
import { Box, Typography } from '@mui/material';
|
|
5
|
+
|
|
6
|
+
export const BasicTextInputExample = () => {
|
|
7
|
+
const [value, setValue] = useState('Texto de ejemplo');
|
|
8
|
+
return (
|
|
9
|
+
<Box sx={{ width: 300 }}>
|
|
10
|
+
<Input
|
|
11
|
+
label="Nombre"
|
|
12
|
+
value={value}
|
|
13
|
+
onChange={setValue}
|
|
14
|
+
/>
|
|
15
|
+
<Typography sx={{ mt: 2 }}>Valor actual: {value}</Typography>
|
|
16
|
+
</Box>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
19
|
+
`,w=`
|
|
20
|
+
import React, { useState } from 'react';
|
|
21
|
+
import { Input } from './Input'; // Ajusta la ruta si es necesario
|
|
22
|
+
import { Box, Typography } from '@mui/material';
|
|
23
|
+
|
|
24
|
+
export const NumberInputExample = () => {
|
|
25
|
+
const [value, setValue] = useState(123);
|
|
26
|
+
return (
|
|
27
|
+
<Box sx={{ width: 300 }}>
|
|
28
|
+
<Input
|
|
29
|
+
label="Cantidad"
|
|
30
|
+
type="number"
|
|
31
|
+
value={value}
|
|
32
|
+
onChange={setValue}
|
|
33
|
+
/>
|
|
34
|
+
<Typography sx={{ mt: 2 }}>Valor actual: {value}</Typography>
|
|
35
|
+
</Box>
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
`,D=`
|
|
39
|
+
import React, { useState } from 'react';
|
|
40
|
+
import { Input } from './Input'; // Ajusta la ruta si es necesario
|
|
41
|
+
import { Box, Typography } from '@mui/material';
|
|
42
|
+
|
|
43
|
+
export const EmailInputExample = () => {
|
|
44
|
+
const [value, setValue] = useState('ejemplo@dominio.com');
|
|
45
|
+
return (
|
|
46
|
+
<Box sx={{ width: 300 }}>
|
|
47
|
+
<Input
|
|
48
|
+
label="Correo Electrónico"
|
|
49
|
+
type="email"
|
|
50
|
+
value={value}
|
|
51
|
+
onChange={setValue}
|
|
52
|
+
/>
|
|
53
|
+
<Typography sx={{ mt: 2 }}>Valor actual: {value}</Typography>
|
|
54
|
+
</Box>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
`,R=`
|
|
58
|
+
import React, { useState } from 'react';
|
|
59
|
+
import { Input } from './Input'; // Ajusta la ruta si es necesario
|
|
60
|
+
import { Box, Typography } from '@mui/material';
|
|
61
|
+
|
|
62
|
+
export const PasswordInputExample = () => {
|
|
63
|
+
const [value, setValue] = useState('micontraseña');
|
|
64
|
+
return (
|
|
65
|
+
<Box sx={{ width: 300 }}>
|
|
66
|
+
<Input
|
|
67
|
+
label="Contraseña"
|
|
68
|
+
type="password"
|
|
69
|
+
value={value}
|
|
70
|
+
onChange={setValue}
|
|
71
|
+
/>
|
|
72
|
+
<Typography sx={{ mt: 2 }}>Valor actual: {value}</Typography>
|
|
73
|
+
</Box>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
`,M=`
|
|
77
|
+
import React, { useState } from 'react';
|
|
78
|
+
import { Input } from './Input'; // Ajusta la ruta si es necesario
|
|
79
|
+
import { Box, Typography } from '@mui/material';
|
|
80
|
+
|
|
81
|
+
export const InputWithPlaceholderExample = () => {
|
|
82
|
+
const [value, setValue] = useState('');
|
|
83
|
+
return (
|
|
84
|
+
<Box sx={{ width: 300 }}>
|
|
85
|
+
<Input
|
|
86
|
+
label="Búsqueda"
|
|
87
|
+
placeholder="Escribe tu término de búsqueda..."
|
|
88
|
+
value={value}
|
|
89
|
+
onChange={setValue}
|
|
90
|
+
/>
|
|
91
|
+
<Typography sx={{ mt: 2 }}>Valor actual: {value || 'Vacío'}</Typography>
|
|
92
|
+
</Box>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
`,q=`
|
|
96
|
+
import React, { useState } from 'react';
|
|
97
|
+
import { Input } from './Input'; // Ajusta la ruta si es necesario
|
|
98
|
+
import { Box, Typography } from '@mui/material';
|
|
99
|
+
|
|
100
|
+
export const InputWithErrorExample = () => {
|
|
101
|
+
const [value, setValue] = useState('invalido');
|
|
102
|
+
const hasError = value.length < 5 && value.length > 0;
|
|
103
|
+
return (
|
|
104
|
+
<Box sx={{ width: 300 }}>
|
|
105
|
+
<Input
|
|
106
|
+
label="Nombre de usuario"
|
|
107
|
+
value={value}
|
|
108
|
+
onChange={setValue}
|
|
109
|
+
error={hasError}
|
|
110
|
+
helperText={hasError ? 'Mínimo 5 caracteres' : ''}
|
|
111
|
+
/>
|
|
112
|
+
<Typography sx={{ mt: 2 }}>Valor actual: {value}</Typography>
|
|
113
|
+
</Box>
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
`,F=`
|
|
117
|
+
import React, { useState } from 'react';
|
|
118
|
+
import { Input } from './Input'; // Ajusta la ruta si es necesario
|
|
119
|
+
import { Box, Typography } from '@mui/material';
|
|
120
|
+
|
|
121
|
+
export const DisabledInputExample = () => {
|
|
122
|
+
const [value, setValue] = useState('Campo deshabilitado');
|
|
123
|
+
return (
|
|
124
|
+
<Box sx={{ width: 300 }}>
|
|
125
|
+
<Input
|
|
126
|
+
label="Estado"
|
|
127
|
+
value={value}
|
|
128
|
+
onChange={setValue}
|
|
129
|
+
disabled
|
|
130
|
+
/>
|
|
131
|
+
<Typography sx={{ mt: 2 }}>Valor actual: {value}</Typography>
|
|
132
|
+
</Box>
|
|
133
|
+
);
|
|
134
|
+
};
|
|
135
|
+
`,P=`
|
|
136
|
+
import React, { useState } from 'react';
|
|
137
|
+
import { Input } from './Input'; // Ajusta la ruta si es necesario
|
|
138
|
+
import { Box, Typography } from '@mui/material';
|
|
139
|
+
|
|
140
|
+
export const ReadOnlyInputExample = () => {
|
|
141
|
+
const [value, setValue] = useState('Valor de solo lectura');
|
|
142
|
+
return (
|
|
143
|
+
<Box sx={{ width: 300 }}>
|
|
144
|
+
<Input
|
|
145
|
+
label="Información"
|
|
146
|
+
value={value}
|
|
147
|
+
onChange={setValue}
|
|
148
|
+
readOnly
|
|
149
|
+
/>
|
|
150
|
+
<Typography sx={{ mt: 2 }}>Valor actual: {value}</Typography>
|
|
151
|
+
</Box>
|
|
152
|
+
);
|
|
153
|
+
};
|
|
154
|
+
`,U=`
|
|
155
|
+
import React, { useState } from 'react';
|
|
156
|
+
import { Input } from './Input'; // Ajusta la ruta si es necesario
|
|
157
|
+
import { Box, Typography } from '@mui/material';
|
|
158
|
+
|
|
159
|
+
export const InputVariantsExample = () => {
|
|
160
|
+
const [valueOutlined, setValueOutlined] = useState('Outlined');
|
|
161
|
+
const [valueFilled, setValueFilled] = useState('Filled');
|
|
162
|
+
const [valueStandard, setValueStandard] = useState('Standard');
|
|
163
|
+
return (
|
|
164
|
+
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 3, width: 300 }}>
|
|
165
|
+
<Input
|
|
166
|
+
label="Esquema Outlined"
|
|
167
|
+
value={valueOutlined}
|
|
168
|
+
onChange={setValueOutlined}
|
|
169
|
+
variant="outlined"
|
|
170
|
+
/>
|
|
171
|
+
<Input
|
|
172
|
+
label="Esquema Filled"
|
|
173
|
+
value={valueFilled}
|
|
174
|
+
onChange={setValueFilled}
|
|
175
|
+
variant="filled"
|
|
176
|
+
/>
|
|
177
|
+
<Input
|
|
178
|
+
label="Esquema Standard"
|
|
179
|
+
value={valueStandard}
|
|
180
|
+
onChange={setValueStandard}
|
|
181
|
+
variant="standard"
|
|
182
|
+
/>
|
|
183
|
+
</Box>
|
|
184
|
+
);
|
|
185
|
+
};
|
|
186
|
+
`,W=`
|
|
187
|
+
import React, { useState } from 'react';
|
|
188
|
+
import { Input } from './Input'; // Ajusta la ruta si es necesario
|
|
189
|
+
import { Box, Typography } from '@mui/material';
|
|
190
|
+
|
|
191
|
+
export const InputSizesExample = () => {
|
|
192
|
+
const [valueMedium, setValueMedium] = useState('Tamaño Mediano');
|
|
193
|
+
const [valueSmall, setValueSmall] = useState('Tamaño Pequeño');
|
|
194
|
+
return (
|
|
195
|
+
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 3, width: 300 }}>
|
|
196
|
+
<Input
|
|
197
|
+
label="Input Mediano"
|
|
198
|
+
value={valueMedium}
|
|
199
|
+
onChange={setValueMedium}
|
|
200
|
+
size="medium"
|
|
201
|
+
/>
|
|
202
|
+
<Input
|
|
203
|
+
label="Input Pequeño"
|
|
204
|
+
value={valueSmall}
|
|
205
|
+
onChange={setValueSmall}
|
|
206
|
+
size="small"
|
|
207
|
+
/>
|
|
208
|
+
</Box>
|
|
209
|
+
);
|
|
210
|
+
};
|
|
211
|
+
`,A=`
|
|
212
|
+
import React, { useState } from 'react';
|
|
213
|
+
import { Input } from './Input'; // Ajusta la ruta si es necesario
|
|
214
|
+
import { Box, Typography } from '@mui/material';
|
|
215
|
+
|
|
216
|
+
export const FullWidthInputExample = () => {
|
|
217
|
+
const [value, setValue] = useState('Ocupa todo el ancho');
|
|
218
|
+
return (
|
|
219
|
+
<Box sx={{ width: '100%' }}>
|
|
220
|
+
<Input
|
|
221
|
+
label="Input de Ancho Completo"
|
|
222
|
+
value={value}
|
|
223
|
+
onChange={setValue}
|
|
224
|
+
fullWidth
|
|
225
|
+
/>
|
|
226
|
+
<Typography sx={{ mt: 2 }}>Valor actual: {value}</Typography>
|
|
227
|
+
</Box>
|
|
228
|
+
);
|
|
229
|
+
};
|
|
230
|
+
`,L=`
|
|
231
|
+
import React, { useState } from 'react';
|
|
232
|
+
import { Input } from './Input'; // Ajusta la ruta si es necesario
|
|
233
|
+
import { Box } from '@mui/material';
|
|
234
|
+
|
|
235
|
+
export const LabelPositionExample = () => {
|
|
236
|
+
const [outside, setOutside] = useState('Outside (default)');
|
|
237
|
+
const [floating, setFloating] = useState('Floating');
|
|
238
|
+
return (
|
|
239
|
+
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 3, width: 300 }}>
|
|
240
|
+
<Input
|
|
241
|
+
label="Label outside"
|
|
242
|
+
value={outside}
|
|
243
|
+
onChange={setOutside}
|
|
244
|
+
labelPosition="outside"
|
|
245
|
+
/>
|
|
246
|
+
<Input
|
|
247
|
+
label="Label floating (MUI clásico)"
|
|
248
|
+
value={floating}
|
|
249
|
+
onChange={setFloating}
|
|
250
|
+
labelPosition="floating"
|
|
251
|
+
/>
|
|
252
|
+
</Box>
|
|
253
|
+
);
|
|
254
|
+
};
|
|
255
|
+
`,z=`
|
|
256
|
+
import React, { useState } from 'react';
|
|
257
|
+
import { Input } from './Input'; // Ajusta la ruta si es necesario
|
|
258
|
+
import { Box } from '@mui/material';
|
|
259
|
+
|
|
260
|
+
export const CustomBorderRadiusExample = () => {
|
|
261
|
+
const [v, setV] = useState('Texto');
|
|
262
|
+
return (
|
|
263
|
+
<Box sx={{ display: 'flex', flexDirection: 'column', gap: 3, width: 300 }}>
|
|
264
|
+
<Input label="Sin radius" value={v} onChange={setV} borderRadius={0} />
|
|
265
|
+
<Input label="Radius 4px" value={v} onChange={setV} borderRadius={4} />
|
|
266
|
+
<Input label="Default (10px)" value={v} onChange={setV} />
|
|
267
|
+
<Input label="Pill (24px)" value={v} onChange={setV} borderRadius={24} />
|
|
268
|
+
</Box>
|
|
269
|
+
);
|
|
270
|
+
};
|
|
271
|
+
`,N=`
|
|
272
|
+
import React, { useState } from 'react';
|
|
273
|
+
import { Input } from './Input'; // Ajusta la ruta si es necesario
|
|
274
|
+
import { Box } from '@mui/material';
|
|
275
|
+
|
|
276
|
+
export const CustomStylingExample = () => {
|
|
277
|
+
const [v, setV] = useState('Custom completo');
|
|
278
|
+
return (
|
|
279
|
+
<Box sx={{ width: 300 }}>
|
|
280
|
+
<Input
|
|
281
|
+
label="Combinado: bg + borderColor + label color"
|
|
282
|
+
value={v}
|
|
283
|
+
onChange={setV}
|
|
284
|
+
sx={{
|
|
285
|
+
'& .MuiInputLabel-root': { color: 'primary.main' },
|
|
286
|
+
'& .MuiOutlinedInput-root': { bgcolor: '#fff7e6' },
|
|
287
|
+
'& .MuiOutlinedInput-notchedOutline': {
|
|
288
|
+
borderColor: 'warning.main',
|
|
289
|
+
borderWidth: 2,
|
|
290
|
+
},
|
|
291
|
+
}}
|
|
292
|
+
/>
|
|
293
|
+
</Box>
|
|
294
|
+
);
|
|
295
|
+
};
|
|
296
|
+
`,Be={title:"Components/Input",component:r,tags:["autodocs"],parameters:{layout:"centered",docs:{description:{component:"Un componente `Input` personalizado basado en `TextField` de Material UI, que soporta varios tipos de entrada HTML y propiedades de `TextField`."}}},argTypes:{label:{control:"text",description:"Etiqueta flotante para el campo de entrada."},value:{control:"text",description:"El valor actual del campo de entrada.",type:{name:"string",required:!0}},onChange:{action:"valueChanged",description:"Callback que se dispara cuando el valor del campo de entrada cambia."},type:{control:"select",options:["text","number","email","password","tel","url","search","date","datetime-local","month","week","time","color"],description:"El tipo HTML del campo de entrada (controla el teclado en móviles, etc.).",defaultValue:"text"},placeholder:{control:"text",description:"Texto de marcador de posición cuando el campo está vacío."},disabled:{control:"boolean",description:"Si es verdadero, el campo de entrada estará deshabilitado."},error:{control:"boolean",description:"Si es verdadero, el campo de entrada estará en estado de error."},helperText:{control:"text",description:"Texto auxiliar que se muestra debajo del campo de entrada."},variant:{control:"radio",options:["outlined","filled","standard"],description:"La variante de diseño del campo de entrada.",defaultValue:"outlined"},size:{control:"radio",options:["small","medium"],description:"El tamaño del campo de entrada.",defaultValue:"small"},labelPosition:{control:"radio",options:["outside","floating"],description:'"outside" (default): label arriba del input. "floating": label clásico de MUI dentro del notched outline.',defaultValue:"outside"},borderRadius:{control:{type:"number"},description:"Border radius del input en px (o string CSS). Default: 10.",defaultValue:10},fullWidth:{control:"boolean",description:"Si es verdadero, el campo de entrada ocupará todo el ancho disponible.",defaultValue:!1}}},m={render:()=>{const[t,o]=n.useState("Texto de ejemplo");return e.jsxs(s,{sx:{width:300},children:[e.jsx(r,{label:"Nombre",value:t,onChange:a=>o(a.toString())}),e.jsxs(d,{sx:{mt:2},children:["Valor actual: ",t]})]})},parameters:{docs:{description:{story:"Un campo de entrada de texto básico con una etiqueta."},source:{code:E.trim()}}}},x={render:()=>{const[t,o]=n.useState(123);return e.jsxs(s,{sx:{width:300},children:[e.jsx(r,{label:"Cantidad",type:"number",value:t.toString(),onChange:a=>o(Number(a))}),e.jsxs(d,{sx:{mt:2},children:["Valor actual: ",t]})]})},parameters:{docs:{description:{story:"Un campo de entrada numérico. Permite solo números y controla el teclado numérico en dispositivos móviles."},source:{code:w.trim()}}}},g={render:()=>{const[t,o]=n.useState("ejemplo@dominio.com");return e.jsxs(s,{sx:{width:300},children:[e.jsx(r,{label:"Correo Electrónico",type:"email",value:t.toString(),onChange:a=>o(a.toString())}),e.jsxs(d,{sx:{mt:2},children:["Valor actual: ",t]})]})},parameters:{docs:{description:{story:"Un campo de entrada para correo electrónico. Proporciona validación básica del navegador y sugiere correos electrónicos."},source:{code:D.trim()}}}},v={render:()=>{const[t,o]=n.useState("micontraseña");return e.jsxs(s,{sx:{width:300},children:[e.jsx(r,{label:"Contraseña",type:"password",value:t.toString(),onChange:a=>o(a.toString())}),e.jsxs(d,{sx:{mt:2},children:["Valor actual: ",t]})]})},parameters:{docs:{description:{story:"Un campo de entrada de contraseña. Oculta los caracteres a medida que se escriben."},source:{code:R.trim()}}}},h={render:()=>{const[t,o]=n.useState("");return e.jsxs(s,{sx:{width:300},children:[e.jsx(r,{label:"Búsqueda",placeholder:"Escribe tu término de búsqueda...",value:t.toString(),onChange:a=>o(a.toString())}),e.jsxs(d,{sx:{mt:2},children:["Valor actual: ",t||"Vacío"]})]})},parameters:{docs:{description:{story:"Un campo de entrada con un texto de marcador de posición visible cuando el campo está vacío."},source:{code:M.trim()}}}},b={render:()=>{const[t,o]=n.useState("invalido"),a=t.length<5&&t.length>0;return e.jsxs(s,{sx:{width:300},children:[e.jsx(r,{label:"Nombre de usuario",value:t.toString(),onChange:u=>o(u.toString()),error:a,helperText:a?"Mínimo 5 caracteres":""}),e.jsxs(d,{sx:{mt:2},children:["Valor actual: ",t]})]})},parameters:{docs:{description:{story:"Un campo de entrada que muestra un estado de error y un texto de ayuda cuando la validación falla."},source:{code:q.trim()}}}},S={render:()=>{const[t,o]=n.useState("Campo deshabilitado");return e.jsxs(s,{sx:{width:300},children:[e.jsx(r,{label:"Estado",value:t.toString(),onChange:a=>o(a.toString()),disabled:!0}),e.jsxs(d,{sx:{mt:2},children:["Valor actual: ",t]})]})},parameters:{docs:{story:"Un campo de entrada deshabilitado, lo que impide la interacción del usuario."},source:{code:F.trim()}}},y={render:()=>{const[t,o]=n.useState("Valor de solo lectura");return e.jsxs(s,{sx:{width:300},children:[e.jsx(r,{label:"Información",value:t.toString(),onChange:a=>o(a.toString()),readOnly:!0}),e.jsxs(d,{sx:{mt:2},children:["Valor actual: ",t]})]})},parameters:{docs:{story:"Un campo de entrada de solo lectura, el usuario puede ver el valor pero no modificarlo."},source:{code:P.trim()}}},f={render:()=>{const[t,o]=n.useState("Outlined"),[a,u]=n.useState("Filled"),[l,p]=n.useState("Standard");return e.jsxs(s,{sx:{display:"flex",flexDirection:"column",gap:3,width:300},children:[e.jsx(r,{label:"Esquema Outlined",value:t.toString(),onChange:i=>o(i.toString()),variant:"outlined"}),e.jsx(r,{label:"Esquema Filled",value:a.toString(),onChange:i=>u(i.toString()),variant:"filled"}),e.jsx(r,{label:"Esquema Standard",value:l.toString(),onChange:i=>p(i.toString()),variant:"standard"})]})},parameters:{docs:{story:"Demuestra las diferentes variantes de diseño: `outlined`, `filled` y `standard`."},source:{code:U.trim()}}},I={render:()=>{const[t,o]=n.useState("Tamaño Mediano"),[a,u]=n.useState("Tamaño Pequeño");return e.jsxs(s,{sx:{display:"flex",flexDirection:"column",gap:3,width:300},children:[e.jsx(r,{label:"Input Mediano",value:t.toString(),onChange:l=>o(l.toString()),size:"medium"}),e.jsx(r,{label:"Input Pequeño",value:a.toString(),onChange:l=>u(l.toString()),size:"small"})]})},parameters:{docs:{story:"Demuestra los diferentes tamaños del campo de entrada: `medium` (por defecto) y `small`."},source:{code:W.trim()}}},V={render:()=>{const[t,o]=n.useState("Ocupa todo el ancho");return e.jsxs(s,{sx:{width:"100%"},children:[e.jsx(r,{label:"Input de Ancho Completo",value:t.toString(),onChange:a=>o(a.toString()),fullWidth:!0}),e.jsxs(d,{sx:{mt:2},children:["Valor actual: ",t]})]})},parameters:{docs:{story:"Un campo de entrada que ocupa todo el ancho disponible de su contenedor."},source:{code:A.trim()}}},C={render:()=>{const[t,o]=n.useState("Ocupa todo el ancho");return e.jsxs(s,{sx:{width:"100%"},children:[e.jsx(r,{value:t.toString(),variant:"standard",onChange:a=>o(a.toString()),fullWidth:!0}),e.jsxs(d,{sx:{mt:2},children:["Valor actual: ",t]})]})},parameters:{docs:{story:"Un campo de entrada que ocupa todo el ancho disponible de su contenedor."}}},B={render:()=>{const[t,o]=n.useState("Outside (default)"),[a,u]=n.useState("Floating");return e.jsxs(s,{sx:{display:"flex",flexDirection:"column",gap:3,width:300},children:[e.jsx(r,{label:"Label outside",value:t.toString(),onChange:l=>o(l.toString()),labelPosition:"outside"}),e.jsx(r,{label:"Label floating (MUI clásico)",value:a.toString(),onChange:l=>u(l.toString()),labelPosition:"floating"})]})},parameters:{docs:{description:{story:"Compara `labelPosition='outside'` (default, label arriba del input) vs `labelPosition='floating'` (label flotante clásico de MUI dentro del notched outline)."},source:{code:L.trim()}}}},T={render:()=>{const[t,o]=n.useState("Sin radius"),[a,u]=n.useState("Radius 4px"),[l,p]=n.useState("Radius 10px (default)"),[i,O]=n.useState("Radius 24px (pill)");return e.jsxs(s,{sx:{display:"flex",flexDirection:"column",gap:3,width:300},children:[e.jsx(r,{label:"borderRadius={0}",value:t,onChange:c=>o(c.toString()),borderRadius:0}),e.jsx(r,{label:"borderRadius={4}",value:a,onChange:c=>u(c.toString()),borderRadius:4}),e.jsx(r,{label:"borderRadius={10} (default)",value:l,onChange:c=>p(c.toString())}),e.jsx(r,{label:"borderRadius={24}",value:i,onChange:c=>O(c.toString()),borderRadius:24})]})},parameters:{docs:{description:{story:"El prop `borderRadius` acepta un número (px) o un string CSS. Override directo del default `10`."},source:{code:z.trim()}}}},j={render:()=>{const[t,o]=n.useState("Fondo gris claro"),[a,u]=n.useState("Borde rojo"),[l,p]=n.useState("Custom completo");return e.jsxs(s,{sx:{display:"flex",flexDirection:"column",gap:3,width:300},children:[e.jsx(r,{label:"Override de background",value:t,onChange:i=>o(i.toString()),sx:{"& .MuiOutlinedInput-root":{bgcolor:"#f5f5f5"}}}),e.jsx(r,{label:"Override de borderColor",value:a,onChange:i=>u(i.toString()),sx:{"& .MuiOutlinedInput-notchedOutline":{borderColor:"red"}}}),e.jsx(r,{label:"Combinado: bg + borderColor + label color",value:l,onChange:i=>p(i.toString()),sx:{"& .MuiInputLabel-root":{color:"primary.main"},"& .MuiOutlinedInput-root":{bgcolor:"#fff7e6"},"& .MuiOutlinedInput-notchedOutline":{borderColor:"warning.main",borderWidth:2}}})]})},parameters:{docs:{description:{story:"Demuestra que el prop `sx` se mergea al final y siempre gana sobre los defaults internos. Antes esto no funcionaba por culpa del `styled()` interno."},source:{code:N.trim()}}}};m.parameters={...m.parameters,docs:{...m.parameters?.docs,source:{originalSource:`{
|
|
297
|
+
render: () => {
|
|
298
|
+
const [value, setValue] = useState('Texto de ejemplo');
|
|
299
|
+
return <Box sx={{
|
|
300
|
+
width: 300
|
|
301
|
+
}}>
|
|
302
|
+
<Input label="Nombre" value={value} onChange={value => setValue(value.toString())} />
|
|
303
|
+
<Typography sx={{
|
|
304
|
+
mt: 2
|
|
305
|
+
}}>Valor actual: {value}</Typography>
|
|
306
|
+
</Box>;
|
|
307
|
+
},
|
|
308
|
+
parameters: {
|
|
309
|
+
docs: {
|
|
310
|
+
description: {
|
|
311
|
+
story: "Un campo de entrada de texto básico con una etiqueta."
|
|
312
|
+
},
|
|
313
|
+
source: {
|
|
314
|
+
code: BasicTextInputDefinition.trim()
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}`,...m.parameters?.docs?.source}}};x.parameters={...x.parameters,docs:{...x.parameters?.docs,source:{originalSource:`{
|
|
319
|
+
render: () => {
|
|
320
|
+
const [value, setValue] = useState(123);
|
|
321
|
+
return <Box sx={{
|
|
322
|
+
width: 300
|
|
323
|
+
}}>
|
|
324
|
+
<Input label="Cantidad" type="number" value={value.toString()} onChange={value => setValue(Number(value))} />
|
|
325
|
+
<Typography sx={{
|
|
326
|
+
mt: 2
|
|
327
|
+
}}>Valor actual: {value}</Typography>
|
|
328
|
+
</Box>;
|
|
329
|
+
},
|
|
330
|
+
parameters: {
|
|
331
|
+
docs: {
|
|
332
|
+
description: {
|
|
333
|
+
story: "Un campo de entrada numérico. Permite solo números y controla el teclado numérico en dispositivos móviles."
|
|
334
|
+
},
|
|
335
|
+
source: {
|
|
336
|
+
code: NumberInputDefinition.trim()
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}`,...x.parameters?.docs?.source}}};g.parameters={...g.parameters,docs:{...g.parameters?.docs,source:{originalSource:`{
|
|
341
|
+
render: () => {
|
|
342
|
+
const [value, setValue] = useState('ejemplo@dominio.com');
|
|
343
|
+
return <Box sx={{
|
|
344
|
+
width: 300
|
|
345
|
+
}}>
|
|
346
|
+
<Input label="Correo Electrónico" type="email" value={value.toString()} onChange={value => setValue(value.toString())} />
|
|
347
|
+
<Typography sx={{
|
|
348
|
+
mt: 2
|
|
349
|
+
}}>Valor actual: {value}</Typography>
|
|
350
|
+
</Box>;
|
|
351
|
+
},
|
|
352
|
+
parameters: {
|
|
353
|
+
docs: {
|
|
354
|
+
description: {
|
|
355
|
+
story: "Un campo de entrada para correo electrónico. Proporciona validación básica del navegador y sugiere correos electrónicos."
|
|
356
|
+
},
|
|
357
|
+
source: {
|
|
358
|
+
code: EmailInputDefinition.trim()
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}`,...g.parameters?.docs?.source}}};v.parameters={...v.parameters,docs:{...v.parameters?.docs,source:{originalSource:`{
|
|
363
|
+
render: () => {
|
|
364
|
+
const [value, setValue] = useState('micontraseña');
|
|
365
|
+
return <Box sx={{
|
|
366
|
+
width: 300
|
|
367
|
+
}}>
|
|
368
|
+
<Input label="Contraseña" type="password" value={value.toString()} onChange={value => setValue(value.toString())} />
|
|
369
|
+
<Typography sx={{
|
|
370
|
+
mt: 2
|
|
371
|
+
}}>Valor actual: {value}</Typography>
|
|
372
|
+
</Box>;
|
|
373
|
+
},
|
|
374
|
+
parameters: {
|
|
375
|
+
docs: {
|
|
376
|
+
description: {
|
|
377
|
+
story: "Un campo de entrada de contraseña. Oculta los caracteres a medida que se escriben."
|
|
378
|
+
},
|
|
379
|
+
source: {
|
|
380
|
+
code: PasswordInputDefinition.trim()
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}`,...v.parameters?.docs?.source}}};h.parameters={...h.parameters,docs:{...h.parameters?.docs,source:{originalSource:`{
|
|
385
|
+
render: () => {
|
|
386
|
+
const [value, setValue] = useState('');
|
|
387
|
+
return <Box sx={{
|
|
388
|
+
width: 300
|
|
389
|
+
}}>
|
|
390
|
+
<Input label="Búsqueda" placeholder="Escribe tu término de búsqueda..." value={value.toString()} onChange={value => setValue(value.toString())} />
|
|
391
|
+
<Typography sx={{
|
|
392
|
+
mt: 2
|
|
393
|
+
}}>Valor actual: {value || 'Vacío'}</Typography>
|
|
394
|
+
</Box>;
|
|
395
|
+
},
|
|
396
|
+
parameters: {
|
|
397
|
+
docs: {
|
|
398
|
+
description: {
|
|
399
|
+
story: "Un campo de entrada con un texto de marcador de posición visible cuando el campo está vacío."
|
|
400
|
+
},
|
|
401
|
+
source: {
|
|
402
|
+
code: InputWithPlaceholderDefinition.trim()
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
}`,...h.parameters?.docs?.source}}};b.parameters={...b.parameters,docs:{...b.parameters?.docs,source:{originalSource:`{
|
|
407
|
+
render: () => {
|
|
408
|
+
const [value, setValue] = useState('invalido');
|
|
409
|
+
// Lógica simple de error para la demostración
|
|
410
|
+
const hasError = value.length < 5 && value.length > 0;
|
|
411
|
+
return <Box sx={{
|
|
412
|
+
width: 300
|
|
413
|
+
}}>
|
|
414
|
+
<Input label="Nombre de usuario" value={value.toString()} onChange={value => setValue(value.toString())} error={hasError} helperText={hasError ? 'Mínimo 5 caracteres' : ''} />
|
|
415
|
+
<Typography sx={{
|
|
416
|
+
mt: 2
|
|
417
|
+
}}>Valor actual: {value}</Typography>
|
|
418
|
+
</Box>;
|
|
419
|
+
},
|
|
420
|
+
parameters: {
|
|
421
|
+
docs: {
|
|
422
|
+
description: {
|
|
423
|
+
story: "Un campo de entrada que muestra un estado de error y un texto de ayuda cuando la validación falla."
|
|
424
|
+
},
|
|
425
|
+
source: {
|
|
426
|
+
code: InputWithErrorDefinition.trim()
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}`,...b.parameters?.docs?.source}}};S.parameters={...S.parameters,docs:{...S.parameters?.docs,source:{originalSource:`{
|
|
431
|
+
render: () => {
|
|
432
|
+
const [value, setValue] = useState('Campo deshabilitado');
|
|
433
|
+
return <Box sx={{
|
|
434
|
+
width: 300
|
|
435
|
+
}}>
|
|
436
|
+
<Input label="Estado" value={value.toString()} onChange={value => setValue(value.toString())} disabled />
|
|
437
|
+
<Typography sx={{
|
|
438
|
+
mt: 2
|
|
439
|
+
}}>Valor actual: {value}</Typography>
|
|
440
|
+
</Box>;
|
|
441
|
+
},
|
|
442
|
+
parameters: {
|
|
443
|
+
docs: {
|
|
444
|
+
story: "Un campo de entrada deshabilitado, lo que impide la interacción del usuario."
|
|
445
|
+
},
|
|
446
|
+
source: {
|
|
447
|
+
code: DisabledInputDefinition.trim()
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}`,...S.parameters?.docs?.source}}};y.parameters={...y.parameters,docs:{...y.parameters?.docs,source:{originalSource:`{
|
|
451
|
+
render: () => {
|
|
452
|
+
const [value, setValue] = useState('Valor de solo lectura');
|
|
453
|
+
return <Box sx={{
|
|
454
|
+
width: 300
|
|
455
|
+
}}>
|
|
456
|
+
<Input label="Información" value={value.toString()} onChange={value => setValue(value.toString())} readOnly />
|
|
457
|
+
<Typography sx={{
|
|
458
|
+
mt: 2
|
|
459
|
+
}}>Valor actual: {value}</Typography>
|
|
460
|
+
</Box>;
|
|
461
|
+
},
|
|
462
|
+
parameters: {
|
|
463
|
+
docs: {
|
|
464
|
+
story: "Un campo de entrada de solo lectura, el usuario puede ver el valor pero no modificarlo."
|
|
465
|
+
},
|
|
466
|
+
source: {
|
|
467
|
+
code: ReadOnlyInputDefinition.trim()
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
}`,...y.parameters?.docs?.source}}};f.parameters={...f.parameters,docs:{...f.parameters?.docs,source:{originalSource:`{
|
|
471
|
+
render: () => {
|
|
472
|
+
const [valueOutlined, setValueOutlined] = useState('Outlined');
|
|
473
|
+
const [valueFilled, setValueFilled] = useState('Filled');
|
|
474
|
+
const [valueStandard, setValueStandard] = useState('Standard');
|
|
475
|
+
return <Box sx={{
|
|
476
|
+
display: 'flex',
|
|
477
|
+
flexDirection: 'column',
|
|
478
|
+
gap: 3,
|
|
479
|
+
width: 300
|
|
480
|
+
}}>
|
|
481
|
+
<Input label="Esquema Outlined" value={valueOutlined.toString()} onChange={value => setValueOutlined(value.toString())} variant="outlined" />
|
|
482
|
+
<Input label="Esquema Filled" value={valueFilled.toString()} onChange={value => setValueFilled(value.toString())} variant="filled" />
|
|
483
|
+
<Input label="Esquema Standard" value={valueStandard.toString()} onChange={value => setValueStandard(value.toString())} variant="standard" />
|
|
484
|
+
</Box>;
|
|
485
|
+
},
|
|
486
|
+
parameters: {
|
|
487
|
+
docs: {
|
|
488
|
+
story: "Demuestra las diferentes variantes de diseño: \`outlined\`, \`filled\` y \`standard\`."
|
|
489
|
+
},
|
|
490
|
+
source: {
|
|
491
|
+
code: InputVariantsDefinition.trim()
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}`,...f.parameters?.docs?.source}}};I.parameters={...I.parameters,docs:{...I.parameters?.docs,source:{originalSource:`{
|
|
495
|
+
render: () => {
|
|
496
|
+
const [valueMedium, setValueMedium] = useState('Tamaño Mediano');
|
|
497
|
+
const [valueSmall, setValueSmall] = useState('Tamaño Pequeño');
|
|
498
|
+
return <Box sx={{
|
|
499
|
+
display: 'flex',
|
|
500
|
+
flexDirection: 'column',
|
|
501
|
+
gap: 3,
|
|
502
|
+
width: 300
|
|
503
|
+
}}>
|
|
504
|
+
<Input label="Input Mediano" value={valueMedium.toString()} onChange={value => setValueMedium(value.toString())} size="medium" />
|
|
505
|
+
<Input label="Input Pequeño" value={valueSmall.toString()} onChange={value => setValueSmall(value.toString())} size="small" />
|
|
506
|
+
</Box>;
|
|
507
|
+
},
|
|
508
|
+
parameters: {
|
|
509
|
+
docs: {
|
|
510
|
+
story: "Demuestra los diferentes tamaños del campo de entrada: \`medium\` (por defecto) y \`small\`."
|
|
511
|
+
},
|
|
512
|
+
source: {
|
|
513
|
+
code: InputSizesDefinition.trim()
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}`,...I.parameters?.docs?.source}}};V.parameters={...V.parameters,docs:{...V.parameters?.docs,source:{originalSource:`{
|
|
517
|
+
render: () => {
|
|
518
|
+
const [value, setValue] = useState('Ocupa todo el ancho');
|
|
519
|
+
return <Box sx={{
|
|
520
|
+
width: '100%'
|
|
521
|
+
}}>
|
|
522
|
+
<Input label="Input de Ancho Completo" value={value.toString()} onChange={value => setValue(value.toString())} fullWidth />
|
|
523
|
+
<Typography sx={{
|
|
524
|
+
mt: 2
|
|
525
|
+
}}>Valor actual: {value}</Typography>
|
|
526
|
+
</Box>;
|
|
527
|
+
},
|
|
528
|
+
parameters: {
|
|
529
|
+
docs: {
|
|
530
|
+
story: "Un campo de entrada que ocupa todo el ancho disponible de su contenedor."
|
|
531
|
+
},
|
|
532
|
+
source: {
|
|
533
|
+
code: FullWidthInputDefinition.trim()
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}`,...V.parameters?.docs?.source}}};C.parameters={...C.parameters,docs:{...C.parameters?.docs,source:{originalSource:`{
|
|
537
|
+
render: () => {
|
|
538
|
+
const [value, setValue] = useState('Ocupa todo el ancho');
|
|
539
|
+
return <Box sx={{
|
|
540
|
+
width: '100%'
|
|
541
|
+
}}>
|
|
542
|
+
<Input value={value.toString()} variant='standard' onChange={value => setValue(value.toString())} fullWidth />
|
|
543
|
+
<Typography sx={{
|
|
544
|
+
mt: 2
|
|
545
|
+
}}>Valor actual: {value}</Typography>
|
|
546
|
+
</Box>;
|
|
547
|
+
},
|
|
548
|
+
parameters: {
|
|
549
|
+
docs: {
|
|
550
|
+
story: "Un campo de entrada que ocupa todo el ancho disponible de su contenedor."
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}`,...C.parameters?.docs?.source}}};B.parameters={...B.parameters,docs:{...B.parameters?.docs,source:{originalSource:`{
|
|
554
|
+
render: () => {
|
|
555
|
+
const [valueOutside, setValueOutside] = useState('Outside (default)');
|
|
556
|
+
const [valueFloating, setValueFloating] = useState('Floating');
|
|
557
|
+
return <Box sx={{
|
|
558
|
+
display: 'flex',
|
|
559
|
+
flexDirection: 'column',
|
|
560
|
+
gap: 3,
|
|
561
|
+
width: 300
|
|
562
|
+
}}>
|
|
563
|
+
<Input label="Label outside" value={valueOutside.toString()} onChange={value => setValueOutside(value.toString())} labelPosition="outside" />
|
|
564
|
+
<Input label="Label floating (MUI clásico)" value={valueFloating.toString()} onChange={value => setValueFloating(value.toString())} labelPosition="floating" />
|
|
565
|
+
</Box>;
|
|
566
|
+
},
|
|
567
|
+
parameters: {
|
|
568
|
+
docs: {
|
|
569
|
+
description: {
|
|
570
|
+
story: "Compara \`labelPosition='outside'\` (default, label arriba del input) vs \`labelPosition='floating'\` (label flotante clásico de MUI dentro del notched outline)."
|
|
571
|
+
},
|
|
572
|
+
source: {
|
|
573
|
+
code: LabelPositionFloatingDefinition.trim()
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}`,...B.parameters?.docs?.source}}};T.parameters={...T.parameters,docs:{...T.parameters?.docs,source:{originalSource:`{
|
|
578
|
+
render: () => {
|
|
579
|
+
const [v0, setV0] = useState('Sin radius');
|
|
580
|
+
const [v4, setV4] = useState('Radius 4px');
|
|
581
|
+
const [v10, setV10] = useState('Radius 10px (default)');
|
|
582
|
+
const [v24, setV24] = useState('Radius 24px (pill)');
|
|
583
|
+
return <Box sx={{
|
|
584
|
+
display: 'flex',
|
|
585
|
+
flexDirection: 'column',
|
|
586
|
+
gap: 3,
|
|
587
|
+
width: 300
|
|
588
|
+
}}>
|
|
589
|
+
<Input label="borderRadius={0}" value={v0} onChange={v => setV0(v.toString())} borderRadius={0} />
|
|
590
|
+
<Input label="borderRadius={4}" value={v4} onChange={v => setV4(v.toString())} borderRadius={4} />
|
|
591
|
+
<Input label="borderRadius={10} (default)" value={v10} onChange={v => setV10(v.toString())} />
|
|
592
|
+
<Input label="borderRadius={24}" value={v24} onChange={v => setV24(v.toString())} borderRadius={24} />
|
|
593
|
+
</Box>;
|
|
594
|
+
},
|
|
595
|
+
parameters: {
|
|
596
|
+
docs: {
|
|
597
|
+
description: {
|
|
598
|
+
story: "El prop \`borderRadius\` acepta un número (px) o un string CSS. Override directo del default \`10\`."
|
|
599
|
+
},
|
|
600
|
+
source: {
|
|
601
|
+
code: CustomBorderRadiusDefinition.trim()
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}`,...T.parameters?.docs?.source}}};j.parameters={...j.parameters,docs:{...j.parameters?.docs,source:{originalSource:`{
|
|
606
|
+
render: () => {
|
|
607
|
+
const [bg, setBg] = useState('Fondo gris claro');
|
|
608
|
+
const [color, setColor] = useState('Borde rojo');
|
|
609
|
+
const [combined, setCombined] = useState('Custom completo');
|
|
610
|
+
return <Box sx={{
|
|
611
|
+
display: 'flex',
|
|
612
|
+
flexDirection: 'column',
|
|
613
|
+
gap: 3,
|
|
614
|
+
width: 300
|
|
615
|
+
}}>
|
|
616
|
+
<Input label="Override de background" value={bg} onChange={v => setBg(v.toString())} sx={{
|
|
617
|
+
'& .MuiOutlinedInput-root': {
|
|
618
|
+
bgcolor: '#f5f5f5'
|
|
619
|
+
}
|
|
620
|
+
}} />
|
|
621
|
+
<Input label="Override de borderColor" value={color} onChange={v => setColor(v.toString())} sx={{
|
|
622
|
+
'& .MuiOutlinedInput-notchedOutline': {
|
|
623
|
+
borderColor: 'red'
|
|
624
|
+
}
|
|
625
|
+
}} />
|
|
626
|
+
<Input label="Combinado: bg + borderColor + label color" value={combined} onChange={v => setCombined(v.toString())} sx={{
|
|
627
|
+
'& .MuiInputLabel-root': {
|
|
628
|
+
color: 'primary.main'
|
|
629
|
+
},
|
|
630
|
+
'& .MuiOutlinedInput-root': {
|
|
631
|
+
bgcolor: '#fff7e6'
|
|
632
|
+
},
|
|
633
|
+
'& .MuiOutlinedInput-notchedOutline': {
|
|
634
|
+
borderColor: 'warning.main',
|
|
635
|
+
borderWidth: 2
|
|
636
|
+
}
|
|
637
|
+
}} />
|
|
638
|
+
</Box>;
|
|
639
|
+
},
|
|
640
|
+
parameters: {
|
|
641
|
+
docs: {
|
|
642
|
+
description: {
|
|
643
|
+
story: "Demuestra que el prop \`sx\` se mergea al final y siempre gana sobre los defaults internos. Antes esto no funcionaba por culpa del \`styled()\` interno."
|
|
644
|
+
},
|
|
645
|
+
source: {
|
|
646
|
+
code: CustomStylingDefinition.trim()
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}`,...j.parameters?.docs?.source}}};const Te=["BasicTextInput","NumberInput","EmailInput","PasswordInput","InputWithPlaceholder","InputWithError","DisabledInput","ReadOnlyInput","InputVariants","InputSizes","FullWidthInput","StandardVariant","LabelPositionFloating","CustomBorderRadius","CustomStyling"];export{m as BasicTextInput,T as CustomBorderRadius,j as CustomStyling,S as DisabledInput,g as EmailInput,V as FullWidthInput,I as InputSizes,f as InputVariants,b as InputWithError,h as InputWithPlaceholder,B as LabelPositionFloating,x as NumberInput,v as PasswordInput,y as ReadOnlyInput,C as StandardVariant,Te as __namedExportsOrder,Be as default};
|