@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,444 @@
|
|
|
1
|
+
import{j as a}from"./jsx-runtime-D_zvdyIk.js";import{r as i}from"./iframe-BAJnc_4n.js";import{D as s}from"./DatePicker-Clkpr-Ku.js";import{d as o}from"./PickersModalDialog-Tjnr_cu5.js";import{B as l}from"./Box-BnhEcfFm.js";import{T as c}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"./useTimeout-DNjRaOWc.js";import"./index-CIeucmOB.js";import"./useThemeProps-DYtxXiUU.js";import"./useThemeProps-U4yXiZ_5.js";import"./useMobilePicker-DK-c8xbD.js";import"./useSlotProps-C0uMfuBt.js";import"./useSlot-b6pXgp5_.js";import"./useForkRef-0ANIrxcF.js";import"./useId-b4fZxjOL.js";import"./useControlled-DsVh1a5j.js";import"./Fade-Ll96CvH8.js";import"./getReactElementRef-BQ3ANZdy.js";import"./index-CY7j4a7o.js";import"./index-BF3FAXTk.js";import"./Grow-8y4FglGK.js";import"./Modal-3okp9H2i.js";import"./ownerWindow-HkKU3E4x.js";import"./ownerDocument-DW-IO8s5.js";import"./Portal-Cj8XF9Lf.js";import"./Paper-SwQBhqI7.js";import"./Popper-CnCTYXxy.js";import"./Button-DBpqmVB_.js";import"./createSimplePaletteValueFilter-bm0fmN_7.js";import"./ButtonBase-qyaMEhe4.js";import"./emotion-react.browser.esm--g-C9cX9.js";import"./isFocusVisible-B8k4qzLc.js";import"./CircularProgress-DC7ZNWwl.js";import"./DialogContent-BeCDKgax.js";import"./ListItem-D3O0103N.js";import"./Menu-ClzfjLc3.js";import"./debounce-Be36O1Ab.js";import"./mergeSlotProps-B0UBKBMe.js";import"./isMuiElement-CTZSFcY5.js";import"./Chip-C3vKPpzR.js";import"./createSvgIcon-D_Gca4vA.js";import"./TextField-22T-xHBm.js";import"./Select-DJh2biEb.js";import"./visuallyHidden-Dan1xhjv.js";import"./IconButton-9OYSTH58.js";const M=`
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import { DatePicker } from '@soyfri/shared-library/DatePicker';
|
|
4
|
+
import dayjs from 'dayjs';
|
|
5
|
+
import { Box, Typography } from '@mui/material';
|
|
6
|
+
|
|
7
|
+
export const BasicDatePickerExample = () => {
|
|
8
|
+
const [selectedDate, setSelectedDate] = useState(dayjs());
|
|
9
|
+
return (
|
|
10
|
+
<Box sx={{ width: 300 }}>
|
|
11
|
+
<DatePicker
|
|
12
|
+
label="Seleccionar Fecha"
|
|
13
|
+
selectedDate={selectedDate}
|
|
14
|
+
onDateChange={setSelectedDate}
|
|
15
|
+
/>
|
|
16
|
+
<Typography sx={{ mt: 2 }}>
|
|
17
|
+
Fecha seleccionada: {selectedDate ? selectedDate.format('YYYY-MM-DD') : 'Ninguna'}
|
|
18
|
+
</Typography>
|
|
19
|
+
</Box>
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
`,S=`
|
|
23
|
+
import React, { useState } from 'react';
|
|
24
|
+
import { DatePicker } from '@soyfri/shared-library/DatePicker';
|
|
25
|
+
import dayjs from 'dayjs';
|
|
26
|
+
import { Box, Typography } from '@mui/material';
|
|
27
|
+
|
|
28
|
+
export const DatePickerWithMinMaxExample = () => {
|
|
29
|
+
const [selectedDate, setSelectedDate] = useState(dayjs('2023-06-15'));
|
|
30
|
+
const minDate = dayjs('2023-06-01');
|
|
31
|
+
const maxDate = dayjs('2023-06-30');
|
|
32
|
+
return (
|
|
33
|
+
<Box sx={{ width: 300 }}>
|
|
34
|
+
<DatePicker
|
|
35
|
+
label="Fecha en Junio"
|
|
36
|
+
selectedDate={selectedDate}
|
|
37
|
+
onDateChange={setSelectedDate}
|
|
38
|
+
minDate={minDate}
|
|
39
|
+
maxDate={maxDate}
|
|
40
|
+
/>
|
|
41
|
+
<Typography sx={{ mt: 2 }}>
|
|
42
|
+
Fecha seleccionada: {selectedDate ? selectedDate.format('YYYY-MM-DD') : 'Ninguna'}
|
|
43
|
+
</Typography>
|
|
44
|
+
<Typography variant="caption" color="text.secondary">
|
|
45
|
+
(Rango: \${minDate.format('YYYY-MM-DD')} a \${maxDate.format('YYYY-MM-DD')})
|
|
46
|
+
</Typography>
|
|
47
|
+
</Box>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
`,P=`
|
|
51
|
+
import React, { useState } from 'react';
|
|
52
|
+
import { DatePicker } from '@soyfri/shared-library/DatePicker';
|
|
53
|
+
import dayjs from 'dayjs';
|
|
54
|
+
import { Box, Typography } from '@mui/material';
|
|
55
|
+
|
|
56
|
+
export const DateRangePickerExample = () => {
|
|
57
|
+
const [startDate, setStartDate] = useState(dayjs('2023-01-01'));
|
|
58
|
+
const [endDate, setEndDate] = useState(dayjs('2023-01-31'));
|
|
59
|
+
|
|
60
|
+
const handleStartDateChange = (date) => {
|
|
61
|
+
setStartDate(date);
|
|
62
|
+
if (date && endDate && date.isAfter(endDate)) {
|
|
63
|
+
setEndDate(date);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const handleEndDateChange = (date) => {
|
|
68
|
+
setEndDate(date);
|
|
69
|
+
if (date && startDate && date.isBefore(startDate)) {
|
|
70
|
+
setStartDate(date);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<Box sx={{ display: 'flex', gap: 3, flexDirection: 'column' }}>
|
|
76
|
+
<DatePicker
|
|
77
|
+
label="Fecha de Inicio"
|
|
78
|
+
selectedDate={startDate}
|
|
79
|
+
onDateChange={handleStartDateChange}
|
|
80
|
+
maxDate={endDate || undefined}
|
|
81
|
+
/>
|
|
82
|
+
<DatePicker
|
|
83
|
+
label="Fecha de Fin"
|
|
84
|
+
selectedDate={endDate}
|
|
85
|
+
onDateChange={handleEndDateChange}
|
|
86
|
+
minDate={startDate || undefined}
|
|
87
|
+
/>
|
|
88
|
+
<Typography>
|
|
89
|
+
Inicio: {startDate ? startDate.format('YYYY-MM-DD') : 'N/A'} |
|
|
90
|
+
Fin: {endDate ? endDate.format('YYYY-MM-DD') : 'N/A'}
|
|
91
|
+
</Typography>
|
|
92
|
+
</Box>
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
`,k=`
|
|
96
|
+
import React, { useState } from 'react';
|
|
97
|
+
import { DatePicker } from '@soyfri/shared-library/DatePicker';
|
|
98
|
+
import dayjs from 'dayjs';
|
|
99
|
+
import { Box, Typography } from '@mui/material';
|
|
100
|
+
|
|
101
|
+
export const DatePickerWithErrorExample = () => {
|
|
102
|
+
const [selectedDate, setSelectedDate] = useState(dayjs('2023-01-01'));
|
|
103
|
+
// Intentamos establecer una fecha fuera de un rango muy restringido para forzar un error
|
|
104
|
+
const minDate = dayjs('2023-01-05');
|
|
105
|
+
const maxDate = dayjs('2023-01-10');
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<Box sx={{ width: 300 }}>
|
|
109
|
+
<DatePicker
|
|
110
|
+
label="Fecha (con error de rango)"
|
|
111
|
+
selectedDate={selectedDate}
|
|
112
|
+
onDateChange={setSelectedDate}
|
|
113
|
+
minDate={minDate}
|
|
114
|
+
maxDate={maxDate}
|
|
115
|
+
/>
|
|
116
|
+
<Typography sx={{ mt: 2 }}>
|
|
117
|
+
Fecha seleccionada: {selectedDate ? selectedDate.format('YYYY-MM-DD') : 'Ninguna'}
|
|
118
|
+
</Typography>
|
|
119
|
+
<Typography variant="caption" color="error">
|
|
120
|
+
(Intenta seleccionar una fecha fuera de \${minDate.format('YYYY-MM-DD')} - \${maxDate.format('YYYY-MM-DD')})
|
|
121
|
+
</Typography>
|
|
122
|
+
</Box>
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
`,j=`
|
|
126
|
+
import React, { useState } from 'react';
|
|
127
|
+
import { DatePicker } from '@soyfri/shared-library/DatePicker';
|
|
128
|
+
import dayjs from 'dayjs';
|
|
129
|
+
import { Box, Typography } from '@mui/material';
|
|
130
|
+
|
|
131
|
+
export const DatePickerSmallSizeExample = () => {
|
|
132
|
+
const [selectedDate, setSelectedDate] = useState(dayjs());
|
|
133
|
+
return (
|
|
134
|
+
<Box sx={{ width: 250 }}>
|
|
135
|
+
<DatePicker
|
|
136
|
+
label="Fecha (Pequeño)"
|
|
137
|
+
selectedDate={selectedDate}
|
|
138
|
+
onDateChange={setSelectedDate}
|
|
139
|
+
slotProps={{ textField: { size: 'small' } }} // Prop para hacer el TextField pequeño
|
|
140
|
+
/>
|
|
141
|
+
<Typography sx={{ mt: 2 }}>
|
|
142
|
+
Fecha seleccionada: {selectedDate ? selectedDate.format('YYYY-MM-DD') : 'Ninguna'}
|
|
143
|
+
</Typography>
|
|
144
|
+
</Box>
|
|
145
|
+
);
|
|
146
|
+
};
|
|
147
|
+
`,b=`
|
|
148
|
+
import React, { useState } from 'react';
|
|
149
|
+
import { DatePicker } from '@soyfri/shared-library/DatePicker';
|
|
150
|
+
import dayjs from 'dayjs';
|
|
151
|
+
import { Box, Typography } from '@mui/material';
|
|
152
|
+
|
|
153
|
+
export const DatePickerDisabledExample = () => {
|
|
154
|
+
const [selectedDate, setSelectedDate] = useState(dayjs());
|
|
155
|
+
return (
|
|
156
|
+
<Box sx={{ width: 300 }}>
|
|
157
|
+
<DatePicker
|
|
158
|
+
label="Fecha (Deshabilitado)"
|
|
159
|
+
selectedDate={selectedDate}
|
|
160
|
+
onDateChange={setSelectedDate}
|
|
161
|
+
disabled
|
|
162
|
+
/>
|
|
163
|
+
<Typography sx={{ mt: 2 }}>
|
|
164
|
+
Fecha seleccionada: {selectedDate ? selectedDate.format('YYYY-MM-DD') : 'Ninguna'}
|
|
165
|
+
</Typography>
|
|
166
|
+
</Box>
|
|
167
|
+
);
|
|
168
|
+
};
|
|
169
|
+
`,F=`
|
|
170
|
+
import React, { useState } from 'react';
|
|
171
|
+
import { DatePicker } from '@soyfri/shared-library/DatePicker';
|
|
172
|
+
import dayjs from 'dayjs';
|
|
173
|
+
import { Box, Typography } from '@mui/material';
|
|
174
|
+
|
|
175
|
+
export const DatePickerReadOnlyDefinition = () => {
|
|
176
|
+
const [selectedDate, setSelectedDate] = useState<Dayjs | null>(dayjs('2024-07-24'));
|
|
177
|
+
return (
|
|
178
|
+
<Box sx={{ width: 300 }}>
|
|
179
|
+
<DatePicker
|
|
180
|
+
label="Fecha (Solo Lectura)"
|
|
181
|
+
selectedDate={selectedDate}
|
|
182
|
+
onDateChange={() => {}} // No permite cambios
|
|
183
|
+
readOnly
|
|
184
|
+
/>
|
|
185
|
+
<Typography sx={{ mt: 2 }}>
|
|
186
|
+
Fecha seleccionada: {selectedDate ? selectedDate.format('YYYY-MM-DD') : 'Ninguna'}
|
|
187
|
+
</Typography>
|
|
188
|
+
</Box>
|
|
189
|
+
);
|
|
190
|
+
};
|
|
191
|
+
`,T=`
|
|
192
|
+
import React, { useState } from 'react';
|
|
193
|
+
import { DatePicker } from '@soyfri/shared-library/DatePicker';
|
|
194
|
+
import { Dayjs } from 'dayjs';
|
|
195
|
+
import { Box, Typography } from '@mui/material';
|
|
196
|
+
|
|
197
|
+
export const DatePickerEmptyWithMaskExample = () => {
|
|
198
|
+
const [selectedDate, setSelectedDate] = useState<Dayjs | null>(null);
|
|
199
|
+
return (
|
|
200
|
+
<Box sx={{ width: 300 }}>
|
|
201
|
+
<DatePicker
|
|
202
|
+
label="Fecha"
|
|
203
|
+
selectedDate={selectedDate}
|
|
204
|
+
onDateChange={setSelectedDate}
|
|
205
|
+
format="DD/MM/YY"
|
|
206
|
+
/>
|
|
207
|
+
<Typography sx={{ mt: 2 }} variant="caption" color="text.secondary">
|
|
208
|
+
Al estar vacío, el campo muestra la máscara del formato (DD/MM/AA).
|
|
209
|
+
</Typography>
|
|
210
|
+
</Box>
|
|
211
|
+
);
|
|
212
|
+
};
|
|
213
|
+
`,be={title:"Components/DatePicker",component:s,tags:["autodocs"],parameters:{layout:"centered",docs:{description:{component:"Un componente `DatePicker` personalizado de Material UI que gestiona el estado de fecha, rangos y validación de errores."}}},argTypes:{label:{control:"text",description:"Etiqueta para el selector de fecha."},selectedDate:{control:"object",description:"La fecha actualmente seleccionada.",type:{name:"object",required:!1,value:{}}},onDateChange:{action:"dateChanged",description:"Callback que se dispara cuando la fecha cambia."},minDate:{control:"object",description:"La fecha mínima permitida.",type:{name:"object",required:!1,value:{}}},maxDate:{control:"object",description:"La fecha máxima permitida.",type:{name:"object",required:!1,value:{}}},disabled:{control:"boolean",description:"Si es verdadero, el selector de fecha estará deshabilitado."},readOnly:{control:"boolean",description:"Si es verdadero, el selector de fecha estará en modo de solo lectura."},slotProps:{control:"object",description:"Props pasadas a los slots internos del DatePicker, como `textField`."}}},D={render:()=>{const[e,t]=i.useState(o());return a.jsxs(l,{sx:{width:300},children:[a.jsx(s,{label:"Seleccionar Fecha",selectedDate:e,onDateChange:t}),a.jsxs(c,{sx:{mt:2},children:["Fecha seleccionada: ",e?e.format("YYYY-MM-DD"):"Ninguna"]})]})},parameters:{docs:{description:{story:"Un `DatePicker` básico con selección de una única fecha."},source:{code:M.trim()}}}},m={render:()=>{const[e,t]=i.useState(null);return a.jsxs(l,{sx:{width:300},children:[a.jsx(s,{label:"Fecha",selectedDate:e,onDateChange:t,format:"DD/MM/YY"}),a.jsx(c,{sx:{mt:2},variant:"caption",color:"text.secondary",children:"Al estar vacío, el campo muestra la máscara del formato (DD/MM/AA)."})]})},parameters:{docs:{description:{story:"DatePicker vacío. Al no haber valor seleccionado, cada sección del campo muestra su placeholder según el `format` (por ejemplo `DD/MM/AA`), funcionando como máscara visual."},source:{code:T.trim()}}}},p={render:()=>{const[e,t]=i.useState(o("2023-06-15")),r=o("2023-06-01"),d=o("2023-06-30");return a.jsxs(l,{sx:{width:300},children:[a.jsx(s,{label:"Fecha en Junio (Rango)",selectedDate:e,onDateChange:t,minDate:r,maxDate:d}),a.jsxs(c,{sx:{mt:2},children:["Fecha seleccionada: ",e?e.format("YYYY-MM-DD"):"Ninguna"]}),a.jsxs(c,{variant:"caption",color:"text.secondary",children:["(Rango: $",r.format("YYYY-MM-DD")," a $",d.format("YYYY-MM-DD"),")"]})]})},parameters:{docs:{description:{story:"Muestra un `DatePicker` con fechas mínimas y máximas permitidas."},source:{code:S.trim()}}}},u={render:()=>{const[e,t]=i.useState(o("2023-01-01")),[r,d]=i.useState(o("2023-01-31")),Y=n=>{t(n),n&&r&&n.isAfter(r)&&d(n)},g=n=>{d(n),n&&e&&n.isBefore(e)&&t(n)};return a.jsxs(l,{sx:{display:"flex",gap:3,flexDirection:"column",width:300},children:[a.jsx(s,{label:"Fecha de Inicio",selectedDate:e,onDateChange:Y,maxDate:r||void 0}),a.jsx(s,{label:"Fecha de Fin",selectedDate:r,onDateChange:g,minDate:e||void 0}),a.jsxs(c,{children:["Inicio: ",e?e.format("YYYY-MM-DD"):"N/A"," | Fin: ",r?r.format("YYYY-MM-DD"):"N/A"]})]})},parameters:{docs:{description:{story:"Dos `DatePicker`s que funcionan como un selector de rango de fechas, donde la fecha de inicio y fin se restringen mutuamente."},source:{code:P.trim()}}}},h={render:()=>{const[e,t]=i.useState(o("2023-01-01")),r=o("2023-01-05"),d=o("2023-01-10");return a.jsxs(l,{sx:{width:300},children:[a.jsx(s,{label:"Fecha (con error de rango)",selectedDate:e,onDateChange:t,minDate:r,maxDate:d}),a.jsxs(c,{sx:{mt:2},children:["Fecha seleccionada: ",e?e.format("YYYY-MM-DD"):"Ninguna"]}),a.jsxs(c,{variant:"caption",color:"error",children:["(Intenta seleccionar una fecha fuera de $",r.format("YYYY-MM-DD")," - $",d.format("YYYY-MM-DD"),")"]})]})},parameters:{docs:{description:{story:"Demuestra cómo el `DatePicker` maneja los errores de validación, por ejemplo, al seleccionar una fecha fuera del rango permitido."},source:{code:k.trim()}}}},y={render:()=>{const[e,t]=i.useState(o());return a.jsxs(l,{sx:{width:250},children:[a.jsx(s,{label:"Fecha (Pequeño)",selectedDate:e,onDateChange:t,slotProps:{textField:{size:"small"}}}),a.jsxs(c,{sx:{mt:2},children:["Fecha seleccionada: ",e?e.format("YYYY-MM-DD"):"Ninguna"]})]})},parameters:{docs:{description:{story:"Muestra el `DatePicker` en un tamaño más pequeño utilizando `slotProps.textField.size`."},source:{code:j.trim()}}}},x={render:()=>{const[e,t]=i.useState(o());return a.jsxs(l,{sx:{width:300},children:[a.jsx(s,{label:"Fecha (Deshabilitado)",selectedDate:e,onDateChange:t,disabled:!0}),a.jsxs(c,{sx:{mt:2},children:["Fecha seleccionada: ",e?e.format("YYYY-MM-DD"):"Ninguna"]})]})},parameters:{docs:{description:{story:"Demuestra un `DatePicker` en estado deshabilitado, donde no se puede interactuar con él."},source:{code:b.trim()}}}},f={render:()=>{const[e,t]=i.useState(o("2024-07-24"));return a.jsxs(l,{sx:{width:300},children:[a.jsx(s,{label:"Fecha (Solo Lectura)",selectedDate:e,onDateChange:()=>{},readOnly:!0}),a.jsxs(c,{sx:{mt:2},children:["Fecha seleccionada: ",e?e.format("YYYY-MM-DD"):"Ninguna"]})]})},parameters:{docs:{description:{story:"Muestra el `DatePicker` en modo de solo lectura. El usuario puede ver la fecha pero no modificarla."},source:{code:F.trim()}}}};D.parameters={...D.parameters,docs:{...D.parameters?.docs,source:{originalSource:`{
|
|
214
|
+
render: () => {
|
|
215
|
+
const [selectedDate, setSelectedDate] = useState<Dayjs | null>(dayjs());
|
|
216
|
+
return <Box sx={{
|
|
217
|
+
width: 300
|
|
218
|
+
}}>
|
|
219
|
+
<DatePicker // Renombrado
|
|
220
|
+
label="Seleccionar Fecha" selectedDate={selectedDate} onDateChange={setSelectedDate} />
|
|
221
|
+
<Typography sx={{
|
|
222
|
+
mt: 2
|
|
223
|
+
}}>
|
|
224
|
+
Fecha seleccionada: {selectedDate ? selectedDate.format('YYYY-MM-DD') : 'Ninguna'}
|
|
225
|
+
</Typography>
|
|
226
|
+
</Box>;
|
|
227
|
+
},
|
|
228
|
+
parameters: {
|
|
229
|
+
docs: {
|
|
230
|
+
description: {
|
|
231
|
+
story: "Un \`DatePicker\` básico con selección de una única fecha."
|
|
232
|
+
},
|
|
233
|
+
source: {
|
|
234
|
+
code: BasicDatePickerDefinition.trim()
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}`,...D.parameters?.docs?.source}}};m.parameters={...m.parameters,docs:{...m.parameters?.docs,source:{originalSource:`{
|
|
239
|
+
render: () => {
|
|
240
|
+
const [selectedDate, setSelectedDate] = useState<Dayjs | null>(null);
|
|
241
|
+
return <Box sx={{
|
|
242
|
+
width: 300
|
|
243
|
+
}}>
|
|
244
|
+
<DatePicker label="Fecha" selectedDate={selectedDate} onDateChange={setSelectedDate} format="DD/MM/YY" />
|
|
245
|
+
<Typography sx={{
|
|
246
|
+
mt: 2
|
|
247
|
+
}} variant="caption" color="text.secondary">
|
|
248
|
+
Al estar vacío, el campo muestra la máscara del formato (DD/MM/AA).
|
|
249
|
+
</Typography>
|
|
250
|
+
</Box>;
|
|
251
|
+
},
|
|
252
|
+
parameters: {
|
|
253
|
+
docs: {
|
|
254
|
+
description: {
|
|
255
|
+
story: "DatePicker vacío. Al no haber valor seleccionado, cada sección del campo muestra su placeholder según el \`format\` (por ejemplo \`DD/MM/AA\`), funcionando como máscara visual."
|
|
256
|
+
},
|
|
257
|
+
source: {
|
|
258
|
+
code: DatePickerEmptyWithMaskDefinition.trim()
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}`,...m.parameters?.docs?.source}}};p.parameters={...p.parameters,docs:{...p.parameters?.docs,source:{originalSource:`{
|
|
263
|
+
render: () => {
|
|
264
|
+
const [selectedDate, setSelectedDate] = useState<Dayjs | null>(dayjs('2023-06-15'));
|
|
265
|
+
const minDate = dayjs('2023-06-01');
|
|
266
|
+
const maxDate = dayjs('2023-06-30');
|
|
267
|
+
return <Box sx={{
|
|
268
|
+
width: 300
|
|
269
|
+
}}>
|
|
270
|
+
<DatePicker // Renombrado
|
|
271
|
+
label="Fecha en Junio (Rango)" selectedDate={selectedDate} onDateChange={setSelectedDate} minDate={minDate} maxDate={maxDate} />
|
|
272
|
+
<Typography sx={{
|
|
273
|
+
mt: 2
|
|
274
|
+
}}>
|
|
275
|
+
Fecha seleccionada: {selectedDate ? selectedDate.format('YYYY-MM-DD') : 'Ninguna'}
|
|
276
|
+
</Typography>
|
|
277
|
+
<Typography variant="caption" color="text.secondary">
|
|
278
|
+
(Rango: \${minDate.format('YYYY-MM-DD')} a \${maxDate.format('YYYY-MM-DD')})
|
|
279
|
+
</Typography>
|
|
280
|
+
</Box>;
|
|
281
|
+
},
|
|
282
|
+
parameters: {
|
|
283
|
+
docs: {
|
|
284
|
+
description: {
|
|
285
|
+
story: "Muestra un \`DatePicker\` con fechas mínimas y máximas permitidas."
|
|
286
|
+
},
|
|
287
|
+
source: {
|
|
288
|
+
code: DatePickerWithMinMaxDefinition.trim()
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}`,...p.parameters?.docs?.source}}};u.parameters={...u.parameters,docs:{...u.parameters?.docs,source:{originalSource:`{
|
|
293
|
+
render: () => {
|
|
294
|
+
const [startDate, setStartDate] = useState<Dayjs | null>(dayjs('2023-01-01'));
|
|
295
|
+
const [endDate, setEndDate] = useState<Dayjs | null>(dayjs('2023-01-31'));
|
|
296
|
+
const handleStartDateChange = (date: Dayjs | null) => {
|
|
297
|
+
setStartDate(date);
|
|
298
|
+
if (date && endDate && date.isAfter(endDate)) {
|
|
299
|
+
setEndDate(date);
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
const handleEndDateChange = (date: Dayjs | null) => {
|
|
303
|
+
setEndDate(date);
|
|
304
|
+
if (date && startDate && date.isBefore(startDate)) {
|
|
305
|
+
setStartDate(date);
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
return <Box sx={{
|
|
309
|
+
display: 'flex',
|
|
310
|
+
gap: 3,
|
|
311
|
+
flexDirection: 'column',
|
|
312
|
+
width: 300
|
|
313
|
+
}}>
|
|
314
|
+
<DatePicker // Renombrado
|
|
315
|
+
label="Fecha de Inicio" selectedDate={startDate} onDateChange={handleStartDateChange} maxDate={endDate || undefined} />
|
|
316
|
+
<DatePicker // Renombrado
|
|
317
|
+
label="Fecha de Fin" selectedDate={endDate} onDateChange={handleEndDateChange} minDate={startDate || undefined} />
|
|
318
|
+
<Typography>
|
|
319
|
+
Inicio: {startDate ? startDate.format('YYYY-MM-DD') : 'N/A'} |
|
|
320
|
+
Fin: {endDate ? endDate.format('YYYY-MM-DD') : 'N/A'}
|
|
321
|
+
</Typography>
|
|
322
|
+
</Box>;
|
|
323
|
+
},
|
|
324
|
+
parameters: {
|
|
325
|
+
docs: {
|
|
326
|
+
description: {
|
|
327
|
+
story: "Dos \`DatePicker\`s que funcionan como un selector de rango de fechas, donde la fecha de inicio y fin se restringen mutuamente."
|
|
328
|
+
},
|
|
329
|
+
source: {
|
|
330
|
+
code: DateRangePickerDefinition.trim()
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}`,...u.parameters?.docs?.source}}};h.parameters={...h.parameters,docs:{...h.parameters?.docs,source:{originalSource:`{
|
|
335
|
+
render: () => {
|
|
336
|
+
const [selectedDate, setSelectedDate] = useState<Dayjs | null>(dayjs('2023-01-01'));
|
|
337
|
+
const minDate = dayjs('2023-01-05');
|
|
338
|
+
const maxDate = dayjs('2023-01-10');
|
|
339
|
+
return <Box sx={{
|
|
340
|
+
width: 300
|
|
341
|
+
}}>
|
|
342
|
+
<DatePicker // Renombrado
|
|
343
|
+
label="Fecha (con error de rango)" selectedDate={selectedDate} onDateChange={setSelectedDate} minDate={minDate} maxDate={maxDate} />
|
|
344
|
+
<Typography sx={{
|
|
345
|
+
mt: 2
|
|
346
|
+
}}>
|
|
347
|
+
Fecha seleccionada: {selectedDate ? selectedDate.format('YYYY-MM-DD') : 'Ninguna'}
|
|
348
|
+
</Typography>
|
|
349
|
+
<Typography variant="caption" color="error">
|
|
350
|
+
(Intenta seleccionar una fecha fuera de \${minDate.format('YYYY-MM-DD')} - \${maxDate.format('YYYY-MM-DD')})
|
|
351
|
+
</Typography>
|
|
352
|
+
</Box>;
|
|
353
|
+
},
|
|
354
|
+
parameters: {
|
|
355
|
+
docs: {
|
|
356
|
+
description: {
|
|
357
|
+
story: "Demuestra cómo el \`DatePicker\` maneja los errores de validación, por ejemplo, al seleccionar una fecha fuera del rango permitido."
|
|
358
|
+
},
|
|
359
|
+
source: {
|
|
360
|
+
code: DatePickerWithErrorDefinition.trim()
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}`,...h.parameters?.docs?.source}}};y.parameters={...y.parameters,docs:{...y.parameters?.docs,source:{originalSource:`{
|
|
365
|
+
render: () => {
|
|
366
|
+
const [selectedDate, setSelectedDate] = useState<Dayjs | null>(dayjs());
|
|
367
|
+
return <Box sx={{
|
|
368
|
+
width: 250
|
|
369
|
+
}}>
|
|
370
|
+
<DatePicker // Renombrado
|
|
371
|
+
label="Fecha (Pequeño)" selectedDate={selectedDate} onDateChange={setSelectedDate} slotProps={{
|
|
372
|
+
textField: {
|
|
373
|
+
size: 'small'
|
|
374
|
+
}
|
|
375
|
+
}} />
|
|
376
|
+
<Typography sx={{
|
|
377
|
+
mt: 2
|
|
378
|
+
}}>
|
|
379
|
+
Fecha seleccionada: {selectedDate ? selectedDate.format('YYYY-MM-DD') : 'Ninguna'}
|
|
380
|
+
</Typography>
|
|
381
|
+
</Box>;
|
|
382
|
+
},
|
|
383
|
+
parameters: {
|
|
384
|
+
docs: {
|
|
385
|
+
description: {
|
|
386
|
+
story: "Muestra el \`DatePicker\` en un tamaño más pequeño utilizando \`slotProps.textField.size\`."
|
|
387
|
+
},
|
|
388
|
+
source: {
|
|
389
|
+
code: DatePickerSmallSizeDefinition.trim()
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
}`,...y.parameters?.docs?.source}}};x.parameters={...x.parameters,docs:{...x.parameters?.docs,source:{originalSource:`{
|
|
394
|
+
render: () => {
|
|
395
|
+
const [selectedDate, setSelectedDate] = useState<Dayjs | null>(dayjs());
|
|
396
|
+
return <Box sx={{
|
|
397
|
+
width: 300
|
|
398
|
+
}}>
|
|
399
|
+
<DatePicker // Renombrado
|
|
400
|
+
label="Fecha (Deshabilitado)" selectedDate={selectedDate} onDateChange={setSelectedDate} disabled />
|
|
401
|
+
<Typography sx={{
|
|
402
|
+
mt: 2
|
|
403
|
+
}}>
|
|
404
|
+
Fecha seleccionada: {selectedDate ? selectedDate.format('YYYY-MM-DD') : 'Ninguna'}
|
|
405
|
+
</Typography>
|
|
406
|
+
</Box>;
|
|
407
|
+
},
|
|
408
|
+
parameters: {
|
|
409
|
+
docs: {
|
|
410
|
+
description: {
|
|
411
|
+
story: "Demuestra un \`DatePicker\` en estado deshabilitado, donde no se puede interactuar con él."
|
|
412
|
+
},
|
|
413
|
+
source: {
|
|
414
|
+
code: DatePickerDisabledDefinition.trim()
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}`,...x.parameters?.docs?.source}}};f.parameters={...f.parameters,docs:{...f.parameters?.docs,source:{originalSource:`{
|
|
419
|
+
render: () => {
|
|
420
|
+
const [selectedDate, setSelectedDate] = useState<Dayjs | null>(dayjs('2024-07-24'));
|
|
421
|
+
return <Box sx={{
|
|
422
|
+
width: 300
|
|
423
|
+
}}>
|
|
424
|
+
<DatePicker // Renombrado
|
|
425
|
+
label="Fecha (Solo Lectura)" selectedDate={selectedDate} onDateChange={() => {}} // No permite cambios
|
|
426
|
+
readOnly />
|
|
427
|
+
<Typography sx={{
|
|
428
|
+
mt: 2
|
|
429
|
+
}}>
|
|
430
|
+
Fecha seleccionada: {selectedDate ? selectedDate.format('YYYY-MM-DD') : 'Ninguna'}
|
|
431
|
+
</Typography>
|
|
432
|
+
</Box>;
|
|
433
|
+
},
|
|
434
|
+
parameters: {
|
|
435
|
+
docs: {
|
|
436
|
+
description: {
|
|
437
|
+
story: "Muestra el \`DatePicker\` en modo de solo lectura. El usuario puede ver la fecha pero no modificarla."
|
|
438
|
+
},
|
|
439
|
+
source: {
|
|
440
|
+
code: DatePickerReadOnlyDefinition.trim() // Usar la definición importada
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}`,...f.parameters?.docs?.source}}};const Fe=["BasicDatePicker","DatePickerEmptyWithMask","DatePickerWithMinMax","DateRangePicker","DatePickerWithError","DatePickerSmallSize","DatePickerDisabled","DatePickerReadOnly"];export{D as BasicDatePicker,x as DatePickerDisabled,m as DatePickerEmptyWithMask,f as DatePickerReadOnly,y as DatePickerSmallSize,h as DatePickerWithError,p as DatePickerWithMinMax,u as DateRangePicker,Fe as __namedExportsOrder,be as default};
|