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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/dist/components/Icon/Icon.js +1 -1
  2. package/dist/components/Table/Table.js +1 -1
  3. package/package.json +32 -4
  4. package/.dockerignore +0 -8
  5. package/.github/workflows/publish.yml +0 -107
  6. package/.prettierrc +0 -3
  7. package/.storybook/main.ts +0 -19
  8. package/.storybook/preview.ts +0 -14
  9. package/.storybook/vitest.setup.ts +0 -9
  10. package/Dockerfile +0 -37
  11. package/build.js +0 -102
  12. package/chromatic.config.json +0 -5
  13. package/cleanDirectories.js +0 -40
  14. package/rollup.config.cjs +0 -87
  15. package/src/components/ActionMenu/ActionMenu.stories.tsx +0 -230
  16. package/src/components/ActionMenu/ActionMenu.tsx +0 -174
  17. package/src/components/ActionMenu/index.ts +0 -2
  18. package/src/components/AppBar/AppBar.stories.tsx +0 -272
  19. package/src/components/AppBar/AppBar.sx.ts +0 -32
  20. package/src/components/AppBar/AppBar.tsx +0 -123
  21. package/src/components/AppBar/AppBarBrand.tsx +0 -120
  22. package/src/components/AppBar/AppBarContext.ts +0 -25
  23. package/src/components/AppBar/AppBarMenuToggle.tsx +0 -90
  24. package/src/components/AppBar/AppBarUserMenu.tsx +0 -217
  25. package/src/components/AppBar/index.ts +0 -25
  26. package/src/components/Autocomplete/Autocomplete.definitions.ts +0 -477
  27. package/src/components/Autocomplete/Autocomplete.helpers.ts +0 -60
  28. package/src/components/Autocomplete/Autocomplete.stories.tsx +0 -748
  29. package/src/components/Autocomplete/Autocomplete.sx.ts +0 -30
  30. package/src/components/Autocomplete/Autocomplete.tsx +0 -361
  31. package/src/components/Autocomplete/Autocomplete.types.ts +0 -13
  32. package/src/components/Autocomplete/_parts/AutocompleteChips.tsx +0 -55
  33. package/src/components/Autocomplete/_parts/AutocompleteLoader.tsx +0 -17
  34. package/src/components/Autocomplete/_parts/AutocompleteOption.tsx +0 -31
  35. package/src/components/Autocomplete/index.ts +0 -12
  36. package/src/components/Avatar/Avatar.definitions.ts +0 -162
  37. package/src/components/Avatar/Avatar.stories.tsx +0 -258
  38. package/src/components/Avatar/Avatar.tsx +0 -206
  39. package/src/components/Avatar/index.ts +0 -1
  40. package/src/components/Button/Button.definition.ts +0 -97
  41. package/src/components/Button/Button.stories.tsx +0 -285
  42. package/src/components/Button/Button.tsx +0 -67
  43. package/src/components/Button/index.ts +0 -1
  44. package/src/components/Card/Card.definition.ts +0 -5
  45. package/src/components/Card/Card.stories.tsx +0 -221
  46. package/src/components/Card/Card.sx.ts +0 -104
  47. package/src/components/Card/Card.tsx +0 -200
  48. package/src/components/Card/index.ts +0 -9
  49. package/src/components/Chip/Chip.definitions.ts +0 -167
  50. package/src/components/Chip/Chip.stories.tsx +0 -265
  51. package/src/components/Chip/Chip.tsx +0 -61
  52. package/src/components/Chip/index.ts +0 -1
  53. package/src/components/Column/Column.tsx +0 -29
  54. package/src/components/Column/index.ts +0 -1
  55. package/src/components/DatePicker/DatePicker.definitions.ts +0 -228
  56. package/src/components/DatePicker/DatePicker.helpers.ts +0 -24
  57. package/src/components/DatePicker/DatePicker.stories.tsx +0 -309
  58. package/src/components/DatePicker/DatePicker.sx.ts +0 -33
  59. package/src/components/DatePicker/DatePicker.tsx +0 -189
  60. package/src/components/DatePicker/DatePicker.types.ts +0 -10
  61. package/src/components/DatePicker/index.ts +0 -9
  62. package/src/components/DateRangePicker/DateRangePicker.definitions.ts +0 -191
  63. package/src/components/DateRangePicker/DateRangePicker.stories.tsx +0 -252
  64. package/src/components/DateRangePicker/DateRangePicker.tsx +0 -56
  65. package/src/components/DateRangePicker/index.ts +0 -1
  66. package/src/components/DateTimePicker/DateTimePicker.definitions.ts +0 -256
  67. package/src/components/DateTimePicker/DateTimePicker.helpers.ts +0 -38
  68. package/src/components/DateTimePicker/DateTimePicker.stories.tsx +0 -418
  69. package/src/components/DateTimePicker/DateTimePicker.sx.ts +0 -30
  70. package/src/components/DateTimePicker/DateTimePicker.tsx +0 -225
  71. package/src/components/DateTimePicker/DateTimePicker.types.ts +0 -10
  72. package/src/components/DateTimePicker/index.ts +0 -9
  73. package/src/components/Drawer/Drawer.stories.tsx +0 -270
  74. package/src/components/Drawer/Drawer.sx.ts +0 -106
  75. package/src/components/Drawer/Drawer.tsx +0 -214
  76. package/src/components/Drawer/DrawerContext.ts +0 -26
  77. package/src/components/Drawer/DrawerItem.tsx +0 -110
  78. package/src/components/Drawer/index.ts +0 -10
  79. package/src/components/Flyout/Flyout.stories.tsx +0 -282
  80. package/src/components/Flyout/Flyout.tsx +0 -122
  81. package/src/components/Flyout/index.ts +0 -1
  82. package/src/components/Gallery/Gallery.definition.tsx +0 -37
  83. package/src/components/Gallery/Gallery.stories.tsx +0 -82
  84. package/src/components/Gallery/Gallery.tsx +0 -118
  85. package/src/components/Gallery/GalleryLightbox.tsx +0 -170
  86. package/src/components/Gallery/GalleryMain.tsx +0 -84
  87. package/src/components/Gallery/GalleryThumbnails.tsx +0 -106
  88. package/src/components/Gallery/index.ts +0 -1
  89. package/src/components/Icon/Icon.stories.tsx +0 -121
  90. package/src/components/Icon/Icon.tsx +0 -175
  91. package/src/components/Icon/index.ts +0 -2
  92. package/src/components/Input/Input.definitions.ts +0 -324
  93. package/src/components/Input/Input.helpers.ts +0 -49
  94. package/src/components/Input/Input.stories.tsx +0 -499
  95. package/src/components/Input/Input.sx.ts +0 -42
  96. package/src/components/Input/Input.tsx +0 -141
  97. package/src/components/Input/Input.types.ts +0 -10
  98. package/src/components/Input/index.ts +0 -9
  99. package/src/components/InputGroup/InputGroup.definitions.ts +0 -158
  100. package/src/components/InputGroup/InputGroup.stories.tsx +0 -267
  101. package/src/components/InputGroup/InputGroup.tsx +0 -179
  102. package/src/components/InputGroup/index.ts +0 -1
  103. package/src/components/MenuButton/MenuButton.stories.tsx +0 -197
  104. package/src/components/MenuButton/MenuButton.tsx +0 -100
  105. package/src/components/MenuButton/index.ts +0 -1
  106. package/src/components/Modal/Modal.stories.tsx +0 -721
  107. package/src/components/Modal/Modal.tsx +0 -355
  108. package/src/components/Modal/ModalBody.tsx +0 -16
  109. package/src/components/Modal/ModalFooter.tsx +0 -71
  110. package/src/components/Modal/ModalHeader.tsx +0 -18
  111. package/src/components/Modal/index.ts +0 -6
  112. package/src/components/PageLoader/PageLoader.stories.tsx +0 -217
  113. package/src/components/PageLoader/PageLoader.tsx +0 -96
  114. package/src/components/PageLoader/index.ts +0 -2
  115. package/src/components/ScrollTopButton/ScrollTopButton.stories.tsx +0 -158
  116. package/src/components/ScrollTopButton/ScrollTopButton.tsx +0 -135
  117. package/src/components/ScrollTopButton/index.ts +0 -8
  118. package/src/components/ScrollTopButton/scrollToTop.ts +0 -37
  119. package/src/components/Select/Select.definitions.ts +0 -602
  120. package/src/components/Select/Select.helpers.ts +0 -71
  121. package/src/components/Select/Select.stories.tsx +0 -687
  122. package/src/components/Select/Select.sx.ts +0 -14
  123. package/src/components/Select/Select.tsx +0 -429
  124. package/src/components/Select/Select.types.ts +0 -15
  125. package/src/components/Select/_parts/SelectMenuItem.tsx +0 -40
  126. package/src/components/Select/_parts/SelectSearchHeader.tsx +0 -51
  127. package/src/components/Select/_parts/SelectValue.tsx +0 -96
  128. package/src/components/Select/index.ts +0 -14
  129. package/src/components/Stat/Stat.stories.tsx +0 -85
  130. package/src/components/Stat/Stat.tsx +0 -117
  131. package/src/components/Stat/index.ts +0 -2
  132. package/src/components/StatusMessage/StatusMessage.stories.tsx +0 -130
  133. package/src/components/StatusMessage/StatusMessage.tsx +0 -162
  134. package/src/components/StatusMessage/index.ts +0 -2
  135. package/src/components/Stepper/Step.tsx +0 -21
  136. package/src/components/Stepper/Stepper.definition.ts +0 -75
  137. package/src/components/Stepper/Stepper.stories.tsx +0 -122
  138. package/src/components/Stepper/Stepper.tsx +0 -75
  139. package/src/components/Stepper/index.ts +0 -2
  140. package/src/components/Table/EmptyTable.png +0 -0
  141. package/src/components/Table/Table.definition.ts +0 -580
  142. package/src/components/Table/Table.stories.tsx +0 -853
  143. package/src/components/Table/Table.tsx +0 -495
  144. package/src/components/Table/data.ts +0 -134
  145. package/src/components/Table/exportsUtils.ts +0 -195
  146. package/src/components/Table/index.ts +0 -3
  147. package/src/components/Table/types.ts +0 -34
  148. package/src/components/Tabs/Tab.definition.ts +0 -53
  149. package/src/components/Tabs/Tab.tsx +0 -19
  150. package/src/components/Tabs/Tabs.stories.tsx +0 -118
  151. package/src/components/Tabs/Tabs.tsx +0 -99
  152. package/src/components/Tabs/_tabUtils.tsx +0 -4
  153. package/src/components/Tabs/index.ts +0 -2
  154. package/src/components/Timeline/Timeline.definition.ts +0 -43
  155. package/src/components/Timeline/Timeline.stories.tsx +0 -108
  156. package/src/components/Timeline/Timeline.tsx +0 -49
  157. package/src/components/Timeline/TimelineItem.tsx +0 -31
  158. package/src/components/Timeline/index.ts +0 -2
  159. package/src/components/Tooltip/Tooltip.stories.tsx +0 -129
  160. package/src/components/Tooltip/Tooltip.tsx +0 -58
  161. package/src/components/Tooltip/index.ts +0 -1
  162. package/src/components/_shared/formField.sx.ts +0 -118
  163. package/src/components/_shared/resolvePreset.ts +0 -35
  164. package/src/hooks/ClipBoard/ClipBoard.stories.tsx +0 -168
  165. package/src/hooks/ClipBoard/ClipBoard.tsx +0 -131
  166. package/src/hooks/ClipBoard/ClipboardUnifiedDemo.tsx +0 -111
  167. package/src/hooks/ClipBoard/index.ts +0 -1
  168. package/src/hooks/Wizard/Wizard.stories.tsx +0 -301
  169. package/src/hooks/Wizard/WizardContext.tsx +0 -166
  170. package/src/hooks/Wizard/index.ts +0 -6
  171. package/src/hooks/Wizard/useWizard.ts +0 -13
  172. package/src/index.ts +0 -17
  173. package/src/mui.ts +0 -44
  174. package/src/styles.css +0 -3
  175. package/src/theme/componentStyles.ts +0 -47
  176. package/src/theme/tokens.ts +0 -43
  177. package/tailwind.config.js +0 -10
  178. package/tsconfig.json +0 -48
  179. package/tsup.config.js +0 -41
  180. package/vite.config.js +0 -132
  181. package/vitest.config.ts +0 -35
@@ -1,56 +0,0 @@
1
- import React from 'react';
2
- import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';
3
- import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';
4
- import { DateRangePicker as MuiDateRangePicker } from '@mui/x-date-pickers-pro/DateRangePicker';
5
- import { TextField } from '@mui/material';
6
- import { Dayjs } from 'dayjs';
7
-
8
- // Define las props para el DateRangePicker
9
- export interface DateRangePickerProps {
10
- label?: string;
11
- startDate: Dayjs | null;
12
- endDate: Dayjs | null;
13
- onDateRangeChange: (start: Dayjs | null, end: Dayjs | null) => void;
14
- minDate?: Dayjs;
15
- maxDate?: Dayjs;
16
- disabled?: boolean;
17
- readOnly?: boolean;
18
- slotProps?: any; // Para pasar slotProps a MuiDateRangePicker
19
- }
20
-
21
- export const DateRangePicker: React.FC<DateRangePickerProps> = ({
22
- label,
23
- startDate,
24
- endDate,
25
- onDateRangeChange,
26
- minDate,
27
- maxDate,
28
- disabled,
29
- readOnly,
30
- slotProps,
31
- ...rest
32
- }) => {
33
- const value: [Dayjs | null, Dayjs | null] = [startDate, endDate];
34
-
35
- const handleChange = (newValue: [Dayjs | null, Dayjs | null]) => {
36
- onDateRangeChange(newValue[0], newValue[1]);
37
- };
38
-
39
- return (
40
- <LocalizationProvider dateAdapter={AdapterDayjs}>
41
- <MuiDateRangePicker
42
- localeText={{ start: 'Fecha de Inicio', end: 'Fecha de Fin' }}
43
- value={value}
44
- onChange={handleChange}
45
- minDate={minDate}
46
- maxDate={maxDate}
47
- disabled={disabled}
48
- readOnly={readOnly}
49
- slotProps={slotProps} // Pasa los slotProps directamente
50
- {...rest}
51
- />
52
- </LocalizationProvider>
53
- );
54
- };
55
-
56
- export default DateRangePicker
@@ -1 +0,0 @@
1
- export { default as DateRangePicker } from './DateRangePicker';
@@ -1,256 +0,0 @@
1
- // DateTimePicker.definitions.ts
2
-
3
- export const BasicDateTimePickerDefinition = `
4
- import React, { useState } from 'react';
5
- import { DateTimePicker } from './DateTimePicker'; // Ajusta la ruta si es necesario
6
- import dayjs from 'dayjs';
7
- import { Box, Typography } from '@mui/material';
8
-
9
- export const BasicDateTimePickerExample = () => {
10
- const [selectedDateTime, setSelectedDateTime] = useState(dayjs());
11
- return (
12
- <Box sx={{ width: 300 }}>
13
- <DateTimePicker
14
- label="Seleccionar Fecha y Hora"
15
- selectedDateTime={selectedDateTime}
16
- onDateTimeChange={setSelectedDateTime}
17
- />
18
- <Typography sx={{ mt: 2 }}>
19
- Seleccionado: \${selectedDateTime ? selectedDateTime.format('YYYY-MM-DD HH:mm') : 'Ninguna'}
20
- </Typography>
21
- </Box>
22
- );
23
- };
24
- `;
25
-
26
- export const DateTimePickerWithMinMaxDefinition = `
27
- import React, { useState } from 'react';
28
- import { DateTimePicker } from './DateTimePicker'; // Ajusta la ruta si es necesario
29
- import dayjs from 'dayjs';
30
- import { Box, Typography } from '@mui/material';
31
-
32
- export const DateTimePickerWithMinMaxExample = () => {
33
- const [selectedDateTime, setSelectedDateTime] = useState(dayjs('2023-06-15T10:00'));
34
- const minDateTime = dayjs('2023-06-01T09:00');
35
- const maxDateTime = dayjs('2023-06-30T17:00');
36
- return (
37
- <Box sx={{ width: 300 }}>
38
- <DateTimePicker
39
- label="Fecha y Hora en Junio"
40
- selectedDateTime={selectedDateTime}
41
- onDateTimeChange={setSelectedDateTime}
42
- minDateTime={minDateTime}
43
- maxDateTime={maxDateTime}
44
- />
45
- <Typography sx={{ mt: 2 }}>
46
- Seleccionado: \${selectedDateTime ? selectedDateTime.format('YYYY-MM-DD HH:mm') : 'Ninguna'}
47
- </Typography>
48
- <Typography variant="caption" color="text.secondary">
49
- (Rango: \${minDateTime.format('YYYY-MM-DD HH:mm')} a \${maxDateTime.format('YYYY-MM-DD HH:mm')})
50
- </Typography>
51
- </Box>
52
- );
53
- };
54
- `;
55
-
56
- export const DateTimePickerDisabledDefinition = `
57
- import React, { useState } => from 'react';
58
- import { DateTimePicker } from './DateTimePicker'; // Ajusta la ruta si es necesario
59
- import dayjs from 'dayjs';
60
- import { Box, Typography } from '@mui/material';
61
-
62
- export const DateTimePickerDisabledExample = () => {
63
- const [selectedDateTime, setSelectedDateTime] = useState(dayjs());
64
- return (
65
- <Box sx={{ width: 300 }}>
66
- <DateTimePicker
67
- label="Fecha y Hora (Deshabilitado)"
68
- selectedDateTime={selectedDateTime}
69
- onDateTimeChange={setSelectedDateTime}
70
- disabled
71
- />
72
- <Typography sx={{ mt: 2 }}>
73
- Seleccionado: \${selectedDateTime ? selectedDateTime.format('YYYY-MM-DD HH:mm') : 'Ninguna'}
74
- </Typography>
75
- </Box>
76
- );
77
- };
78
- `;
79
-
80
- export const DateTimePickerReadOnlyDefinition = `
81
- import React, { useState } from 'react';
82
- import { DateTimePicker } from './DateTimePicker'; // Ajusta la ruta si es necesario
83
- import dayjs from 'dayjs';
84
- import { Box, Typography } from '@mui/material';
85
-
86
- export const DateTimePickerReadOnlyExample = () => {
87
- const [selectedDateTime, setSelectedDateTime] = useState(dayjs('2024-07-24T14:30'));
88
- return (
89
- <Box sx={{ width: 300 }}>
90
- <DateTimePicker
91
- label="Fecha y Hora (Solo Lectura)"
92
- selectedDateTime={selectedDateTime}
93
- onDateTimeChange={() => {}} // No permite cambios
94
- readOnly
95
- />
96
- <Typography sx={{ mt: 2 }}>
97
- Seleccionado: \${selectedDateTime ? selectedDateTime.format('YYYY-MM-DD HH:mm') : 'Ninguna'}
98
- </Typography>
99
- </Box>
100
- );
101
- };
102
- `;
103
-
104
- export const DateTimePickerWithInitialNullDefinition = `
105
- import React, { useState } from 'react';
106
- import { DateTimePicker } from './DateTimePicker'; // Ajusta la ruta si es necesario
107
- import dayjs from 'dayjs';
108
- import { Box, Typography } from '@mui/material';
109
-
110
- export const DateTimePickerWithInitialNullExample = () => {
111
- const [selectedDateTime, setSelectedDateTime] = useState(null);
112
- return (
113
- <Box sx={{ width: 300 }}>
114
- <DateTimePicker
115
- label="Fecha y Hora (Sin Selección Inicial)"
116
- selectedDateTime={selectedDateTime}
117
- onDateTimeChange={setSelectedDateTime}
118
- />
119
- <Typography sx={{ mt: 2 }}>
120
- Seleccionado: \${selectedDateTime ? selectedDateTime.format('YYYY-MM-DD HH:mm') : 'Ninguna'}
121
- </Typography>
122
- </Box>
123
- );
124
- };
125
- `;
126
-
127
- export const DateTimePickerSmallSizeDefinition = `
128
- import React, { useState } from 'react';
129
- import { DateTimePicker } from './DateTimePicker'; // Ajusta la ruta si es necesario
130
- import dayjs from 'dayjs';
131
- import { Box, Typography } from '@mui/material';
132
-
133
- export const DateTimePickerSmallSizeExample = () => {
134
- const [selectedDateTime, setSelectedDateTime] = useState(dayjs());
135
- return (
136
- <Box sx={{ width: 250 }}>
137
- <DateTimePicker
138
- label="Fecha y Hora (Pequeño)"
139
- selectedDateTime={selectedDateTime}
140
- onDateTimeChange={setSelectedDateTime}
141
- slotProps={{ textField: { size: 'small' } }}
142
- />
143
- <Typography sx={{ mt: 2 }}>
144
- Seleccionado: \${selectedDateTime ? selectedDateTime.format('YYYY-MM-DD HH:mm') : 'Ninguna'}
145
- </Typography>
146
- </Box>
147
- );
148
- };
149
- `;
150
-
151
- export const DateTimePickerWithButtonsDefinition = `
152
- import React, { useState } => from 'react';
153
- import { DateTimePicker } from './DateTimePicker'; // Ajusta la ruta si es necesario
154
- import dayjs from 'dayjs';
155
- import { Box, Typography } from '@mui/material';
156
-
157
- export const DateTimePickerWithButtonsExample = () => {
158
- const [selectedDateTime, setSelectedDateTime] = useState(dayjs());
159
- return (
160
- <Box sx={{ width: 300 }}>
161
- <DateTimePicker
162
- label="Fecha y Hora (Con Botones por Defecto)"
163
- selectedDateTime={selectedDateTime}
164
- onDateTimeChange={setSelectedDateTime}
165
- slotProps={{
166
- actionBar: {
167
- actions: ['clear', 'cancel', 'accept'],
168
- },
169
- }}
170
- />
171
- <Typography sx={{ mt: 2 }}>
172
- Seleccionado: \${selectedDateTime ? selectedDateTime.format('YYYY-MM-DD HH:mm') : 'Ninguna'}
173
- </Typography>
174
- </Box>
175
- );
176
- };
177
- `;
178
-
179
- export const DateTimePickerWithCustomButtonTextDefinition = `
180
- import React, { useState } from 'react';
181
- import { DateTimePicker } from './DateTimePicker'; // Ajusta la ruta si es necesario
182
- import dayjs from 'dayjs';
183
- import { Box, Typography } from '@mui/material';
184
-
185
- export const DateTimePickerWithCustomButtonTextExample = () => {
186
- const [selectedDateTime, setSelectedDateTime] = useState(dayjs());
187
- return (
188
- <Box sx={{ width: 300 }}>
189
- <DateTimePicker
190
- label="Fecha y Hora (Botones Personalizados)"
191
- selectedDateTime={selectedDateTime}
192
- onDateTimeChange={setSelectedDateTime}
193
- clearButtonText="Limpiar Todo"
194
- cancelButtonText="Descartar"
195
- acceptButtonText="Confirmar Selección"
196
- slotProps={{
197
- actionBar: {
198
- actions: ['clear', 'cancel', 'accept'],
199
- },
200
- }}
201
- />
202
- <Typography sx={{ mt: 2 }}>
203
- Seleccionado: \${selectedDateTime ? selectedDateTime.format('YYYY-MM-DD HH:mm') : 'Ninguna'}
204
- </Typography>
205
- </Box>
206
- );
207
- };
208
- `;
209
-
210
- export const DateTimePickerEmptyWithMaskDefinition = `
211
- import React, { useState } from 'react';
212
- import { DateTimePicker } from './DateTimePicker'; // Ajusta la ruta si es necesario
213
- import { Dayjs } from 'dayjs';
214
- import { Box, Typography } from '@mui/material';
215
-
216
- export const DateTimePickerEmptyWithMaskExample = () => {
217
- const [selectedDateTime, setSelectedDateTime] = useState<Dayjs | null>(null);
218
- return (
219
- <Box sx={{ width: 300 }}>
220
- <DateTimePicker
221
- label="Fecha y Hora"
222
- selectedDateTime={selectedDateTime}
223
- onDateTimeChange={setSelectedDateTime}
224
- inputFormat="DD/MM/YY HH:mm"
225
- />
226
- <Typography sx={{ mt: 2 }} variant="caption" color="text.secondary">
227
- Al estar vacío, el campo muestra la máscara del formato (DD/MM/AA HH:MM).
228
- </Typography>
229
- </Box>
230
- );
231
- };
232
- `;
233
-
234
- export const DateTimePickerWithCustomInputFormatDefinition = `
235
- import React, { useState } from 'react';
236
- import { DateTimePicker } from './DateTimePicker'; // Ajusta la ruta si es necesario
237
- import dayjs from 'dayjs';
238
- import { Box, Typography } from '@mui/material';
239
-
240
- export const DateTimePickerWithCustomInputFormatExample = () => {
241
- const [selectedDateTime, setSelectedDateTime] = useState(dayjs());
242
- return (
243
- <Box sx={{ width: 300 }}>
244
- <DateTimePicker
245
- label="Fecha y Hora (Formato dd/MM/YYYY)"
246
- selectedDateTime={selectedDateTime}
247
- onDateTimeChange={setSelectedDateTime}
248
- inputFormat="DD/MM/YYYY HH:mm" // Formato de fecha personalizado
249
- />
250
- <Typography sx={{ mt: 2 }}>
251
- Seleccionado: \${selectedDateTime ? selectedDateTime.format('YYYY-MM-DD HH:mm') : 'Ninguna'}
252
- </Typography>
253
- </Box>
254
- );
255
- };
256
- `;
@@ -1,38 +0,0 @@
1
- import type { DateValidationError } from '@mui/x-date-pickers/models';
2
-
3
- /**
4
- * Traduce el error del DateTimePicker a un mensaje en español. Se usa
5
- * internamente para poblar `helperText` cuando hay error de validación.
6
- */
7
- export const getDateTimeValidationMessage = (
8
- error: DateValidationError | null,
9
- ): string => {
10
- switch (error) {
11
- case 'minDate':
12
- case 'maxDate':
13
- case 'invalidDate':
14
- return 'Formato de fecha/hora inválido';
15
- case 'disableFuture':
16
- return 'No se permiten fechas/horas futuras';
17
- case 'disablePast':
18
- return 'No se permiten fechas/horas pasadas';
19
- default:
20
- return '';
21
- }
22
- };
23
-
24
- /**
25
- * Construye el `localeText` que MUI acepta para overridear los labels de los
26
- * botones del popover (Cancel / OK / Clear).
27
- */
28
- export const buildLocaleText = (
29
- clearButtonText?: string,
30
- cancelButtonText?: string,
31
- acceptButtonText?: string,
32
- ): Record<string, string> => {
33
- const text: Record<string, string> = {};
34
- if (clearButtonText) text.clearButtonLabel = clearButtonText;
35
- if (cancelButtonText) text.cancelButtonLabel = cancelButtonText;
36
- if (acceptButtonText) text.okButtonLabel = acceptButtonText;
37
- return text;
38
- };