@arquimedes.co/eureka-forms 3.0.45-mui9 → 3.0.45-next-fix

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 (54) hide show
  1. package/dist/@Types/FormStep.d.ts +2 -4
  2. package/dist/@Types/GenericFormSteps.d.ts +1 -1
  3. package/dist/App/AppHooks.js +13 -13
  4. package/dist/Form/ConfirmationDialog/ConfirmationDialog.js +5 -7
  5. package/dist/Form/Terms/Term/MaterialTerm/MaterialTerm.js +3 -5
  6. package/dist/FormSteps/@Construction/CBRPropertyStep/CBRPropertyStep.js +5 -7
  7. package/dist/FormSteps/AYFStepMapper.js +2 -2
  8. package/dist/FormSteps/DatePickerRangeStep/MaterialDatePickerRangeStep/MaterialDatePickerRangeStep.js +3 -3
  9. package/dist/FormSteps/EntityValueStep/MaterialEntityValuePickerStep/MaterialEntityValueDialog/MaterialEntityValueDialog.js +5 -7
  10. package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/FileComponent/FileComponent.js +1 -1
  11. package/dist/FormSteps/FileUploadStep/MaterialFileUploadStep/MaterialFileUploadStep.js +1 -1
  12. package/dist/FormSteps/SelectorStep/MaterialSelectorStep/MaterialSelectorStep.js +1 -1
  13. package/dist/FormSteps/StepFunctions.js +1 -1
  14. package/dist/Shared/ErkButton/ErkButton.stories.d.ts +16 -0
  15. package/dist/Shared/ErkButton/ErkButton.stories.js +28 -0
  16. package/dist/Shared/ErkCheckbox/ErkCheckBox.d.ts +0 -1
  17. package/dist/Shared/ErkCheckbox/ErkCheckBox.js +2 -2
  18. package/dist/Shared/ErkCheckbox/ErkCheckBox.stories.d.ts +13 -0
  19. package/dist/Shared/ErkCheckbox/ErkCheckBox.stories.js +34 -0
  20. package/dist/Shared/ErkDatePicker/ErkDatePicker.js +33 -44
  21. package/dist/Shared/ErkDatePicker/ErkDatePicker.stories.d.ts +23 -0
  22. package/dist/Shared/ErkDatePicker/ErkDatePicker.stories.js +98 -0
  23. package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.d.ts +1 -4
  24. package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.js +23 -40
  25. package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.stories.d.ts +36 -0
  26. package/dist/Shared/ErkDateRangePicker/ErkDateRangePicker.stories.js +274 -0
  27. package/dist/Shared/ErkMenuItem.d.ts +1 -1
  28. package/dist/Shared/ErkSelect/ErkSelect.d.ts +2 -2
  29. package/dist/Shared/ErkSelect/ErkSelect.stories.d.ts +21 -0
  30. package/dist/Shared/ErkSelect/ErkSelect.stories.js +87 -0
  31. package/dist/Shared/ErkSmartSelect/ErkSmartSelect.stories.d.ts +26 -0
  32. package/dist/Shared/ErkSmartSelect/ErkSmartSelect.stories.js +159 -0
  33. package/dist/Shared/ErkTextField/ErkTextField.d.ts +2 -17
  34. package/dist/Shared/ErkTextField/ErkTextField.js +3 -3
  35. package/dist/Shared/ErkTextField/ErkTextField.stories.d.ts +24 -0
  36. package/dist/Shared/ErkTextField/ErkTextField.stories.js +99 -0
  37. package/dist/Shared/ErkTimePicker/ErkTimePicker.js +1 -1
  38. package/dist/Shared/Navbar/Navbar.stories.d.ts +13 -0
  39. package/dist/Shared/Navbar/Navbar.stories.js +13 -0
  40. package/dist/Shared/Rating/Rating.stories.d.ts +15 -0
  41. package/dist/Shared/Rating/Rating.stories.js +47 -0
  42. package/dist/Shared/Rating/Ratings/ScaleRating.js +1 -1
  43. package/dist/States/GlobalSlice.d.ts +26 -8
  44. package/dist/States/GlobalSlice.js +2 -3
  45. package/dist/States/SiteSlice.d.ts +33 -8
  46. package/dist/States/SiteSlice.js +9 -11
  47. package/dist/States/WidthStatsSlice.d.ts +1 -5
  48. package/dist/Utils/DraftFunctions.js +1 -1
  49. package/dist/index.css +0 -7
  50. package/dist/main.d.ts +1 -1
  51. package/dist/main.js +1 -1
  52. package/package.json +33 -34
  53. package/dist/FormSteps/@StoryDecorators/FormStepDecorator.d.ts +0 -9
  54. package/dist/FormSteps/@StoryDecorators/FormStepDecorator.js +0 -86
@@ -1,9 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import React, { useMemo } from 'react';
3
- import { InputAdornment, styled, Dialog as MuiDialog } from '@mui/material';
2
+ import React from 'react';
3
+ import { styled, Dialog as MuiDialog } from '@mui/material';
4
4
  import { DatePickerToolbar as MuiDatePickerToolbar, usePickerContext, } from '@mui/x-date-pickers';
5
5
  import { MobileDateRangePicker as MuiDateRangePicker, } from '@mui/x-date-pickers-pro/MobileDateRangePicker';
6
6
  import { DateRangePickerDay as MuiDateRangePickerDay } from '@mui/x-date-pickers-pro';
7
+ import { SingleInputDateRangeField } from '@mui/x-date-pickers-pro/SingleInputDateRangeField';
7
8
  import { format, isValid } from 'date-fns';
8
9
  import { StyledTextField } from '../ErkTextField/ErkTextField';
9
10
  import CalendarIcon from '../../Icons/CalendarIcon';
@@ -84,47 +85,22 @@ const StyledDay = styled(MuiDateRangePickerDay)(({ theme }) => ({
84
85
  backgroundColor: theme.palette.primary.main + '1a',
85
86
  },
86
87
  }));
87
- const CustomRangePickerField = React.forwardRef(function CustomRangePickerField({ error, required, helperText, size = 'small', labelMargin = 5, fullWidth = true, inputRef, }, ref) {
88
- const { value, fieldFormat, setOpen, disabled, readOnly, label } = usePickerContext();
89
- const { displayValue, isInvalid } = useMemo(() => {
90
- const [startDate, endDate] = value ?? [null, null];
91
- if (!startDate)
92
- return { displayValue: '', isInvalid: false };
93
- if (!isValid(startDate))
94
- return { displayValue: '', isInvalid: true };
95
- if (endDate && !isValid(endDate))
96
- return { displayValue: '', isInvalid: true };
97
- try {
98
- const fmt = fieldFormat ?? 'P';
99
- const start = format(startDate, fmt);
100
- const end = endDate ? format(endDate, fmt) : '';
101
- return { displayValue: end ? `${start} – ${end}` : start, isInvalid: false };
102
- }
103
- catch {
104
- return { displayValue: '', isInvalid: true };
105
- }
106
- }, [value, fieldFormat]);
88
+ // eslint-disable-next-line react/display-name
89
+ const CustomTextField = React.forwardRef((props, ref) => {
90
+ const pickerContext = usePickerContext();
107
91
  const handleClick = () => {
108
- if (!disabled && !readOnly) {
109
- setOpen((prev) => !prev);
92
+ if (!props.disabled && !props.readOnly) {
93
+ pickerContext.setOpen((prev) => !prev);
110
94
  }
111
95
  };
112
- return (_jsx(StyledTextField, { ref: ref, value: displayValue, label: label, disabled: disabled, readOnly: readOnly, error: isInvalid || error, required: required, helperText: isInvalid ? 'Fecha inválida' : helperText, size: size, labelMargin: labelMargin, inputRef: inputRef, onClick: handleClick, fullWidth: fullWidth, placeholder: "", slotProps: {
113
- input: {
114
- endAdornment: (_jsx(InputAdornment, { position: "end", children: _jsx(CalendarIcon, { style: {
115
- fontSize: size === 'small' ? 18 : 20,
116
- opacity: disabled || readOnly ? 0.5 : 1,
117
- } }) })),
118
- readOnly: true,
119
- },
120
- } }));
96
+ return _jsx(StyledTextField, { ...props, inputRef: ref, onClick: handleClick });
121
97
  });
122
98
  const formatDate = (date, showYear) => {
123
99
  if (!date || !isValid(date))
124
100
  return '';
125
101
  return format(date, showYear ? 'PP' : 'dd MMM');
126
102
  };
127
- function CustomDatePickerRange({ error, disabled, readOnly, helperText, size = 'small', labelMargin = 5, value, onChange, inputRef, shortcuts, ...others }) {
103
+ function CustomDatePickerRange({ error, disabled, readOnly, helperText, size = 'small', labelMargin = 5, value, onChange, ...others }) {
128
104
  const [startDate, endDate] = value ?? [null, null];
129
105
  const hasCompleteRange = Boolean(startDate) && Boolean(endDate);
130
106
  const showYear = startDate &&
@@ -135,16 +111,19 @@ function CustomDatePickerRange({ error, disabled, readOnly, helperText, size = '
135
111
  const formattedStartDate = formatDate(startDate, Boolean(showYear));
136
112
  const formattedEndDate = formatDate(endDate, Boolean(showYear));
137
113
  const toolbarText = hasCompleteRange ? `${formattedStartDate} – ${formattedEndDate}` : '– –';
138
- return (_jsx(StyledDateRangePicker, { ...others, value: value, onChange: onChange, size: size, disabled: disabled, readOnly: readOnly, reduceAnimations: true, showDaysOutsideCurrentMonth: true, slots: {
139
- field: CustomRangePickerField,
114
+ return (_jsx(StyledDateRangePicker, { ...others, value: value, onChange: onChange, size: size, disabled: disabled, readOnly: readOnly, reduceAnimations: true, showDaysOutsideCurrentMonth: true, enableAccessibleFieldDOMStructure: false, slots: {
115
+ //TODO: create system for shortcuts customs or default (enums)
116
+ shortcuts: undefined,
117
+ field: SingleInputDateRangeField,
140
118
  day: StyledDay,
141
119
  dialog: StyledDialog,
142
120
  toolbar: StyledDateToolBar,
121
+ openPickerIcon: CalendarIcon,
122
+ textField: CustomTextField,
143
123
  }, slotProps: {
144
124
  actionBar: {
145
125
  actions: ['clear', 'accept'],
146
126
  },
147
- shortcuts: shortcuts ? { items: shortcuts } : undefined,
148
127
  layout: {
149
128
  sx: {
150
129
  backgroundColor: '#ffffff',
@@ -175,14 +154,18 @@ function CustomDatePickerRange({ error, disabled, readOnly, helperText, size = '
175
154
  hidden: false,
176
155
  toolbarPlaceholder: toolbarText,
177
156
  },
178
- field: {
157
+ textField: {
179
158
  size,
180
159
  error,
181
- required: others.required,
160
+ disabled,
161
+ readOnly: !disabled && readOnly,
182
162
  helperText,
183
163
  labelMargin,
184
164
  fullWidth: true,
185
- inputRef,
165
+ placeholder: '',
166
+ InputProps: {
167
+ readOnly: !disabled && readOnly,
168
+ },
186
169
  },
187
170
  } }));
188
171
  }
@@ -0,0 +1,36 @@
1
+ import type { StoryObj } from '@storybook/react-vite';
2
+ import ErkDateRangePicker from './ErkDateRangePicker';
3
+ declare const meta: {
4
+ component: typeof ErkDateRangePicker;
5
+ tags: string[];
6
+ args: {
7
+ readOnly: false;
8
+ };
9
+ parameters: {
10
+ dateRange: Date[];
11
+ };
12
+ };
13
+ export default meta;
14
+ type Story = StoryObj<typeof meta>;
15
+ export declare const Empty: Story;
16
+ export declare const Default: Story;
17
+ export declare const Interactive: Story;
18
+ export declare const ValueAndLabel: Story;
19
+ export declare const Full: Story;
20
+ export declare const Error: Story;
21
+ export declare const Menu: Story;
22
+ export declare const WithSelectedRange: Story;
23
+ export declare const Disabled: Story;
24
+ export declare const ReadOnly: Story;
25
+ export declare const WithError: Story;
26
+ export declare const Required: Story;
27
+ export declare const SmallSize: Story;
28
+ export declare const MediumSize: Story;
29
+ export declare const CurrentMonth: Story;
30
+ export declare const LastWeek: Story;
31
+ export declare const NextMonth: Story;
32
+ export declare const WithMinMaxDates: Story;
33
+ export declare const YearRange: Story;
34
+ export declare const QuarterRange: Story;
35
+ export declare const EventDuration: Story;
36
+ export declare const MultipleStates: Story;
@@ -0,0 +1,274 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import ErkDateRangePicker from './ErkDateRangePicker';
3
+ import { useArgs } from 'storybook/internal/preview-api';
4
+ import { useState } from 'react';
5
+ const meta = {
6
+ component: ErkDateRangePicker,
7
+ tags: ['autodocs'],
8
+ args: {
9
+ readOnly: false,
10
+ },
11
+ parameters: {
12
+ dateRange: [new Date('2021-07-01'), new Date('2021-07-21')],
13
+ },
14
+ };
15
+ export default meta;
16
+ export const Empty = {
17
+ args: {
18
+ label: 'Seleccionar Rango',
19
+ value: [null, null],
20
+ },
21
+ };
22
+ export const Default = {
23
+ args: {
24
+ label: 'Rango de Fechas',
25
+ value: [new Date('2021-07-01'), new Date('2021-07-21')],
26
+ },
27
+ render: function Component(args) {
28
+ const [value, setValue] = useState(args.value ?? [null, null]);
29
+ return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
30
+ },
31
+ };
32
+ export const Interactive = {
33
+ args: {
34
+ label: 'Rango Interactivo',
35
+ value: [null, null],
36
+ helperText: 'Seleccione un rango de fechas',
37
+ },
38
+ render: function Component(args) {
39
+ const [value, setValue] = useState(args.value ?? [null, null]);
40
+ const handleChange = (newValue) => {
41
+ setValue(newValue);
42
+ args.onChange?.(newValue);
43
+ };
44
+ return (_jsxs("div", { children: [_jsx(ErkDateRangePicker, { ...args, value: value, onChange: handleChange }), _jsxs("div", { style: { marginTop: '20px', fontSize: '14px' }, children: [_jsx("strong", { children: "Valor seleccionado:" }), _jsxs("div", { children: ["Inicio: ", value[0]?.toLocaleDateString('es-ES') ?? 'No seleccionado'] }), _jsxs("div", { children: ["Fin: ", value[1]?.toLocaleDateString('es-ES') ?? 'No seleccionado'] })] })] }));
45
+ },
46
+ };
47
+ export const ValueAndLabel = {
48
+ args: {
49
+ label: 'Rango de Fechas',
50
+ value: [null, null],
51
+ },
52
+ render: function Component(args) {
53
+ const [, setArgs] = useArgs();
54
+ const onValueChange = (value) => {
55
+ args.onChange?.(value);
56
+ setArgs({ value });
57
+ };
58
+ return _jsx(ErkDateRangePicker, { ...args, onChange: onValueChange });
59
+ },
60
+ };
61
+ export const Full = {
62
+ args: {
63
+ label: 'Rango de Fechas',
64
+ value: [null, null],
65
+ helperText: 'Seleccione un rango de fechas',
66
+ },
67
+ render: function Component(args) {
68
+ const [value, setValue] = useState(args.value ?? [null, null]);
69
+ return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
70
+ },
71
+ };
72
+ export const Error = {
73
+ args: {
74
+ label: 'Rango de Fechas',
75
+ value: [null, null],
76
+ helperText: 'Error: Rango de fechas inválido',
77
+ error: true,
78
+ },
79
+ render: function Component(args) {
80
+ const [value, setValue] = useState(args.value ?? [null, null]);
81
+ return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
82
+ },
83
+ };
84
+ export const Menu = {
85
+ args: {
86
+ label: 'Rango de Fechas',
87
+ value: [null, null],
88
+ },
89
+ render: function Component(args) {
90
+ const [value, setValue] = useState(args.value ?? [null, null]);
91
+ return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
92
+ },
93
+ play: async ({ canvas, userEvent }) => {
94
+ const selector = canvas.getByTestId('date-picker');
95
+ await userEvent.click(selector);
96
+ },
97
+ };
98
+ export const WithSelectedRange = {
99
+ args: {
100
+ label: 'Vacaciones',
101
+ value: [new Date('2024-12-20'), new Date('2025-01-05')],
102
+ helperText: 'Período de vacaciones',
103
+ },
104
+ render: function Component(args) {
105
+ const [, setArgs] = useArgs();
106
+ const onValueChange = (value) => {
107
+ args.onChange?.(value);
108
+ setArgs({ value });
109
+ };
110
+ return _jsx(ErkDateRangePicker, { ...args, onChange: onValueChange });
111
+ },
112
+ };
113
+ export const Disabled = {
114
+ args: {
115
+ label: 'Rango de Fechas',
116
+ value: [new Date('2021-07-01'), new Date('2021-07-21')],
117
+ disabled: true,
118
+ helperText: 'Campo deshabilitado',
119
+ },
120
+ render: function Component(args) {
121
+ const [value, setValue] = useState(args.value ?? [null, null]);
122
+ return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
123
+ },
124
+ };
125
+ export const ReadOnly = {
126
+ args: {
127
+ label: 'Rango de Fechas',
128
+ value: [new Date('2021-07-01'), new Date('2021-07-21')],
129
+ readOnly: true,
130
+ helperText: 'Campo de solo lectura',
131
+ },
132
+ render: function Component(args) {
133
+ const [value, setValue] = useState(args.value ?? [null, null]);
134
+ return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
135
+ },
136
+ };
137
+ export const WithError = {
138
+ args: {
139
+ label: 'Rango de Fechas',
140
+ value: [new Date('2021-07-21'), new Date('2021-07-01')],
141
+ helperText: 'La fecha de inicio debe ser anterior a la fecha de fin',
142
+ error: true,
143
+ },
144
+ render: function Component(args) {
145
+ const [value, setValue] = useState(args.value ?? [null, null]);
146
+ return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
147
+ },
148
+ };
149
+ export const Required = {
150
+ args: {
151
+ label: 'Rango de Fechas',
152
+ value: [null, null],
153
+ helperText: 'Este campo es obligatorio',
154
+ required: true,
155
+ },
156
+ render: function Component(args) {
157
+ const [value, setValue] = useState(args.value ?? [null, null]);
158
+ return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
159
+ },
160
+ };
161
+ export const SmallSize = {
162
+ args: {
163
+ label: 'Rango Pequeño',
164
+ value: [new Date('2021-07-01'), new Date('2021-07-21')],
165
+ size: 'small',
166
+ helperText: 'Tamaño pequeño',
167
+ },
168
+ render: function Component(args) {
169
+ const [value, setValue] = useState(args.value ?? [null, null]);
170
+ return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
171
+ },
172
+ };
173
+ export const MediumSize = {
174
+ args: {
175
+ label: 'Rango Mediano',
176
+ value: [new Date('2021-07-01'), new Date('2021-07-21')],
177
+ size: 'medium',
178
+ helperText: 'Tamaño mediano',
179
+ },
180
+ render: function Component(args) {
181
+ const [value, setValue] = useState(args.value ?? [null, null]);
182
+ return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
183
+ },
184
+ };
185
+ export const CurrentMonth = {
186
+ args: {
187
+ label: 'Mes Actual',
188
+ value: [new Date(2025, 10, 1), new Date(2025, 10, 30)],
189
+ helperText: 'Noviembre 2025',
190
+ },
191
+ render: function Component(args) {
192
+ const [value, setValue] = useState(args.value ?? [null, null]);
193
+ return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
194
+ },
195
+ };
196
+ export const LastWeek = {
197
+ args: {
198
+ label: 'Última Semana',
199
+ value: [new Date(new Date().setDate(new Date().getDate() - 7)), new Date()],
200
+ helperText: 'Últimos 7 días',
201
+ },
202
+ render: function Component(args) {
203
+ const [value, setValue] = useState(args.value ?? [null, null]);
204
+ return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
205
+ },
206
+ };
207
+ export const NextMonth = {
208
+ args: {
209
+ label: 'Próximo Mes',
210
+ value: [
211
+ new Date(new Date().getFullYear(), new Date().getMonth() + 1, 1),
212
+ new Date(new Date().getFullYear(), new Date().getMonth() + 2, 0),
213
+ ],
214
+ helperText: 'Planificación del próximo mes',
215
+ },
216
+ render: function Component(args) {
217
+ const [value, setValue] = useState(args.value ?? [null, null]);
218
+ return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
219
+ },
220
+ };
221
+ export const WithMinMaxDates = {
222
+ args: {
223
+ label: 'Reserva de Hotel',
224
+ value: [null, null],
225
+ helperText: 'Seleccione fechas entre hoy y 3 meses',
226
+ minDate: new Date(),
227
+ maxDate: new Date(new Date().setMonth(new Date().getMonth() + 3)),
228
+ },
229
+ render: function Component(args) {
230
+ const [value, setValue] = useState(args.value ?? [null, null]);
231
+ return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
232
+ },
233
+ };
234
+ export const YearRange = {
235
+ args: {
236
+ label: 'Período Fiscal',
237
+ value: [new Date('2025-01-01'), new Date('2025-12-31')],
238
+ helperText: 'Año fiscal 2025',
239
+ },
240
+ render: function Component(args) {
241
+ const [value, setValue] = useState(args.value ?? [null, null]);
242
+ return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
243
+ },
244
+ };
245
+ export const QuarterRange = {
246
+ args: {
247
+ label: 'Trimestre Q1 2025',
248
+ value: [new Date('2025-01-01'), new Date('2025-03-31')],
249
+ helperText: 'Primer trimestre del año',
250
+ },
251
+ render: function Component(args) {
252
+ const [value, setValue] = useState(args.value ?? [null, null]);
253
+ return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
254
+ },
255
+ };
256
+ export const EventDuration = {
257
+ args: {
258
+ label: 'Duración del Evento',
259
+ value: [new Date('2025-06-15'), new Date('2025-06-18')],
260
+ helperText: 'Conferencia anual (4 días)',
261
+ },
262
+ render: function Component(args) {
263
+ const [value, setValue] = useState(args.value ?? [null, null]);
264
+ return _jsx(ErkDateRangePicker, { ...args, value: value, onChange: setValue });
265
+ },
266
+ };
267
+ export const MultipleStates = {
268
+ render: function Component() {
269
+ const [range1, setRange1] = useState([null, null]);
270
+ const [range2, setRange2] = useState([new Date('2025-01-01'), new Date('2025-01-31')]);
271
+ const [range3, setRange3] = useState([null, null]);
272
+ return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '20px' }, children: [_jsx(ErkDateRangePicker, { label: "Fecha de Inicio del Proyecto", value: range1, onChange: setRange1, helperText: "Seleccione el per\u00EDodo del proyecto" }), _jsx(ErkDateRangePicker, { label: "Per\u00EDodo de Pruebas", value: range2, onChange: setRange2, helperText: "Enero 2025" }), _jsx(ErkDateRangePicker, { label: "Fecha de Entrega", value: range3, onChange: setRange3, error: range3[0] === null, helperText: range3[0] === null ? 'Este campo es obligatorio' : 'Fecha confirmada', required: true })] }));
273
+ },
274
+ };
@@ -1,2 +1,2 @@
1
- declare const Styled: import("@emotion/styled").StyledComponent<import("@mui/material").MenuItemOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, keyof import("@mui/material").MenuItemOwnProps> & Omit<import("@mui/material").ButtonBaseOwnProps, "type" | "children" | "tabIndex" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "nativeButton" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | keyof import("@mui/material").MenuItemOwnProps> & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "type" | "children" | "className" | "style" | "classes" | "autoFocus" | "tabIndex" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "nativeButton" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "dense" | "disableGutters" | "divider" | "selected"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
1
+ declare const Styled: import("@emotion/styled").StyledComponent<import("@mui/material").MenuItemOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "children" | "className" | "style" | "classes" | "autoFocus" | "tabIndex" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "dense" | "disableGutters" | "divider" | "selected"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
2
2
  export default Styled;
@@ -6,12 +6,12 @@ export interface SelectorStyleProps {
6
6
  }
7
7
  export declare const StyledSelect: import("@emotion/styled").StyledComponent<(import("@mui/material").FilledSelectProps & import("@mui/material").BaseSelectProps<unknown> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>) | (import("@mui/material").StandardSelectProps & import("@mui/material").BaseSelectProps<unknown> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>) | (import("@mui/material").OutlinedSelectProps & import("@mui/material").BaseSelectProps<unknown> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>), {}, {}>;
8
8
  export declare const StyledInputLabel: import("@emotion/styled").StyledComponent<import("@mui/material").InputLabelOwnProps & Pick<import("@mui/material").FormLabelOwnProps, "color" | "filled"> & import("@mui/material/OverridableComponent").CommonProps & Omit<React.DetailedHTMLProps<React.LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, "required" | "size" | "color" | "children" | "className" | "style" | "classes" | "disabled" | "sx" | "margin" | "error" | "filled" | "variant" | "focused" | "disableAnimation" | "shrink"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
9
- component?: React.ElementType | undefined;
9
+ component?: React.ElementType;
10
10
  } & {
11
11
  open: boolean;
12
12
  }, {}, {}>;
13
13
  export declare const StyledHelperText: import("@emotion/styled").StyledComponent<import("@mui/material").FormHelperTextOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "required" | "children" | "className" | "style" | "classes" | "disabled" | "sx" | "margin" | "error" | "filled" | "variant" | "focused"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
14
- component?: React.ElementType | undefined;
14
+ component?: React.ElementType;
15
15
  }, {}, {}>;
16
16
  export type ErkSelectValue<Type extends string | number, Multiple, Clearable> = Multiple extends true ? Type[] : Clearable extends true ? Type | undefined : Type;
17
17
  export interface ErkSelectProps<Type extends string | number = string, Multiple extends boolean | undefined = false, Clearable extends boolean | undefined = true> extends Omit<MuiSelectProps, 'color' | 'onChange' | 'ref'>, SelectorStyleProps {
@@ -0,0 +1,21 @@
1
+ import type { StoryObj } from '@storybook/react-vite';
2
+ import ErkSelect from './ErkSelect';
3
+ declare const meta: {
4
+ component: typeof ErkSelect;
5
+ tags: string[];
6
+ args: {
7
+ readOnly: false;
8
+ MenuProps: {
9
+ disablePortal: false;
10
+ };
11
+ };
12
+ };
13
+ export default meta;
14
+ type Story = StoryObj<typeof meta>;
15
+ export declare const Default: Story;
16
+ export declare const Empty: Story;
17
+ export declare const ValueAndLabel: Story;
18
+ export declare const Full: Story;
19
+ export declare const Error: Story;
20
+ export declare const ErrorColor: Story;
21
+ export declare const DifferentColors: Story;
@@ -0,0 +1,87 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import ErkSelect from './ErkSelect';
3
+ import { MenuItem } from '@mui/material';
4
+ import { useArgs } from 'storybook/internal/preview-api';
5
+ const meta = {
6
+ component: ErkSelect,
7
+ tags: ['autodocs'],
8
+ args: {
9
+ readOnly: false,
10
+ MenuProps: {
11
+ disablePortal: false,
12
+ },
13
+ },
14
+ };
15
+ export default meta;
16
+ export const Default = {
17
+ args: {
18
+ label: 'Label',
19
+ },
20
+ render: function Component(args) {
21
+ const [, setArgs] = useArgs();
22
+ const onValueChange = (value) => {
23
+ args.onChange?.(value);
24
+ setArgs({ value });
25
+ };
26
+ return (_jsxs(ErkSelect, { ...args, onChange: onValueChange, children: [_jsx(MenuItem, { value: 'option1', children: "Option 1" }), _jsx(MenuItem, { value: 'option2', children: "Option 2" }), _jsx(MenuItem, { value: 'option3', children: "Option 3" })] }));
27
+ },
28
+ };
29
+ export const Empty = {
30
+ args: {},
31
+ render: function Component(args) {
32
+ return _jsx(ErkSelect, { ...args });
33
+ },
34
+ };
35
+ export const ValueAndLabel = {
36
+ args: {
37
+ label: 'Label',
38
+ value: 'option',
39
+ },
40
+ render: function Component({ inputRef, ...args }) {
41
+ const [, setArgs] = useArgs();
42
+ const onValueChange = (value) => {
43
+ args.onChange?.(value);
44
+ setArgs({ value });
45
+ };
46
+ return (_jsx(ErkSelect, { ...args, onChange: onValueChange, inputRef: inputRef, children: _jsx(MenuItem, { value: 'option', style: { whiteSpace: 'normal' }, children: "Option" }) }));
47
+ },
48
+ };
49
+ export const Full = {
50
+ args: {
51
+ label: 'Label',
52
+ helperText: 'Helper text',
53
+ },
54
+ render: function Component(args) {
55
+ return (_jsxs(ErkSelect, { ...args, children: [_jsx(MenuItem, { value: 'option1', children: "Option 1" }), _jsx(MenuItem, { value: 'option2', children: "Option 2" }), _jsx(MenuItem, { value: 'option3', children: "Option 3" })] }));
56
+ },
57
+ };
58
+ export const Error = {
59
+ args: {
60
+ label: 'Label',
61
+ helperText: 'Helper text',
62
+ error: true,
63
+ },
64
+ render: function Component(args) {
65
+ return (_jsxs(ErkSelect, { ...args, children: [_jsx(MenuItem, { value: 'option1', children: "Option 1" }), _jsx(MenuItem, { value: 'option2', children: "Option 2" }), _jsx(MenuItem, { value: 'option3', children: "Option 3" })] }));
66
+ },
67
+ };
68
+ export const ErrorColor = {
69
+ args: {
70
+ label: 'Label',
71
+ helperText: 'Helper text',
72
+ error: true,
73
+ },
74
+ render: function Component(args) {
75
+ return (_jsxs(ErkSelect, { ...args, children: [_jsx(MenuItem, { value: 'option1', children: "Option 1" }), _jsx(MenuItem, { value: 'option2', children: "Option 2" }), _jsx(MenuItem, { value: 'option3', children: "Option 3" })] }));
76
+ },
77
+ };
78
+ export const DifferentColors = {
79
+ args: {
80
+ label: 'Label',
81
+ value: 'option',
82
+ helperText: 'Helper text',
83
+ },
84
+ render: function Component({ inputRef, ...args }) {
85
+ return (_jsx(ErkSelect, { ...args, inputRef: inputRef, children: _jsx(MenuItem, { value: 'option', style: { whiteSpace: 'normal' }, children: "Option" }) }));
86
+ },
87
+ };
@@ -0,0 +1,26 @@
1
+ import type { StoryObj } from '@storybook/react-vite';
2
+ import ErkSmartSelect from './ErkSmartSelect';
3
+ declare const meta: {
4
+ component: typeof ErkSmartSelect;
5
+ tags: string[];
6
+ args: {
7
+ searchable: false;
8
+ readOnly: false;
9
+ };
10
+ };
11
+ export default meta;
12
+ type Story = StoryObj<typeof meta>;
13
+ export declare const Empty: Story;
14
+ export declare const Default: Story;
15
+ export declare const Focused: Story;
16
+ export declare const FocusedSearchable: Story;
17
+ export declare const SearchableWithOptions: Story;
18
+ export declare const SearchableWithSearchAndOptions: Story;
19
+ export declare const Loading: Story;
20
+ export declare const LoadingOpened: Story;
21
+ export declare const SearchableLoadingOpened: Story;
22
+ export declare const WithValueandLabel: Story;
23
+ export declare const Full: Story;
24
+ export declare const Error: Story;
25
+ export declare const ErrorColor: Story;
26
+ export declare const DifferentColors: Story;