@soyfri/shared-library 4.0.1 → 4.0.4

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 (88) hide show
  1. package/{ActionMenu-wNWkDZWh.cjs → ActionMenu-D81Xb35f.cjs} +3 -3
  2. package/ActionMenu-D81Xb35f.cjs.map +1 -0
  3. package/{ActionMenu-BXRVKopM.js → ActionMenu-DYPA_tYk.js} +3 -3
  4. package/ActionMenu-DYPA_tYk.js.map +1 -0
  5. package/{Autocomplete-Bd3bN4Cw.cjs → Autocomplete-Baqwboth.cjs} +59 -38
  6. package/Autocomplete-Baqwboth.cjs.map +1 -0
  7. package/{Autocomplete-E5aSUGVK.js → Autocomplete-Cvf16lFk.js} +59 -38
  8. package/Autocomplete-Cvf16lFk.js.map +1 -0
  9. package/{DatePicker-D__RSgs-.js → DatePicker-D5BH4v1p.js} +3 -2
  10. package/{DatePicker-D__RSgs-.js.map → DatePicker-D5BH4v1p.js.map} +1 -1
  11. package/{DatePicker-CMcQddi1.cjs → DatePicker-mz7CYtVw.cjs} +3 -2
  12. package/{DatePicker-CMcQddi1.cjs.map → DatePicker-mz7CYtVw.cjs.map} +1 -1
  13. package/{DateTimePicker-LeaE716a.js → DateTimePicker-ZCf0Wh4r.js} +6 -2
  14. package/DateTimePicker-ZCf0Wh4r.js.map +1 -0
  15. package/{DateTimePicker-BVJGq1A0.cjs → DateTimePicker-ejQDpjgX.cjs} +6 -2
  16. package/DateTimePicker-ejQDpjgX.cjs.map +1 -0
  17. package/{Input-BibHlnGN.js → Input-CmvuMwXZ.js} +3 -2
  18. package/{Input-BibHlnGN.js.map → Input-CmvuMwXZ.js.map} +1 -1
  19. package/{Input-Bpjw7qwq.cjs → Input-hnQ7g6b7.cjs} +3 -2
  20. package/{Input-Bpjw7qwq.cjs.map → Input-hnQ7g6b7.cjs.map} +1 -1
  21. package/{Select-BaY3zJhq.js → Select-CZ0BiKVN.js} +10 -4
  22. package/Select-CZ0BiKVN.js.map +1 -0
  23. package/{Select-WpHNCHHz.cjs → Select-ZhFf4SBp.cjs} +10 -4
  24. package/Select-ZhFf4SBp.cjs.map +1 -0
  25. package/{StatusMessage-B3nXpuRl.cjs → StatusMessageContext-BMsbLKRq.cjs} +19 -1
  26. package/StatusMessageContext-BMsbLKRq.cjs.map +1 -0
  27. package/{StatusMessage-D0WgSBx7.js → StatusMessageContext-DgYiObYE.js} +21 -3
  28. package/StatusMessageContext-DgYiObYE.js.map +1 -0
  29. package/components/ActionMenu/ActionMenu.cjs +1 -1
  30. package/components/ActionMenu/ActionMenu.js +1 -1
  31. package/components/Autocomplete/Autocomplete.cjs +1 -1
  32. package/components/Autocomplete/Autocomplete.d.ts +30 -13
  33. package/components/Autocomplete/Autocomplete.helpers.d.ts +4 -4
  34. package/components/Autocomplete/Autocomplete.js +1 -1
  35. package/components/Autocomplete/_parts/AutocompleteChips.d.ts +7 -6
  36. package/components/Autocomplete/_parts/AutocompleteOption.d.ts +5 -5
  37. package/components/Autocomplete/index.d.ts +1 -1
  38. package/components/DatePicker/DatePicker.cjs +1 -1
  39. package/components/DatePicker/DatePicker.js +1 -1
  40. package/components/DateTimePicker/DateTimePicker.cjs +1 -1
  41. package/components/DateTimePicker/DateTimePicker.d.ts +9 -0
  42. package/components/DateTimePicker/DateTimePicker.js +1 -1
  43. package/components/Input/Input.cjs +1 -1
  44. package/components/Input/Input.js +1 -1
  45. package/components/Select/Select.cjs +1 -1
  46. package/components/Select/Select.js +1 -1
  47. package/components/StatusMessage/StatusMessage.cjs +5 -3
  48. package/components/StatusMessage/StatusMessage.cjs.map +1 -1
  49. package/components/StatusMessage/StatusMessage.js +4 -2
  50. package/components/StatusMessage/StatusMessageContext.d.ts +16 -0
  51. package/components/StatusMessage/index.d.ts +2 -0
  52. package/components/_shared/resolvePreset.d.ts +9 -5
  53. package/hooks/ClipBoard/ClipBoard.cjs +43 -24
  54. package/hooks/ClipBoard/ClipBoard.cjs.map +1 -1
  55. package/hooks/ClipBoard/ClipBoard.d.ts +1 -1
  56. package/hooks/ClipBoard/ClipBoard.js +43 -24
  57. package/hooks/ClipBoard/ClipBoard.js.map +1 -1
  58. package/index.cjs +58 -10
  59. package/index.cjs.map +1 -1
  60. package/index.d.ts +4 -4
  61. package/index.js +22 -10
  62. package/mui.d.ts +2 -1
  63. package/package.json +2 -3
  64. package/resolvePreset-CxTI6_Ln.cjs.map +1 -1
  65. package/resolvePreset-K6_BfWHD.js.map +1 -1
  66. package/ActionMenu-BXRVKopM.js.map +0 -1
  67. package/ActionMenu-wNWkDZWh.cjs.map +0 -1
  68. package/Autocomplete-Bd3bN4Cw.cjs.map +0 -1
  69. package/Autocomplete-E5aSUGVK.js.map +0 -1
  70. package/DateTimePicker-BVJGq1A0.cjs.map +0 -1
  71. package/DateTimePicker-LeaE716a.js.map +0 -1
  72. package/README.md +0 -251
  73. package/Select-BaY3zJhq.js.map +0 -1
  74. package/Select-WpHNCHHz.cjs.map +0 -1
  75. package/StatusMessage-B3nXpuRl.cjs.map +0 -1
  76. package/StatusMessage-D0WgSBx7.js.map +0 -1
  77. package/local/affiliations/affiliations.dev.soyfri.com-key.pem +0 -28
  78. package/local/affiliations/affiliations.dev.soyfri.com.pem +0 -27
  79. package/local/aficiliaciones/afiliaciones.dev.soyfri.com-key.pem +0 -28
  80. package/local/aficiliaciones/afiliaciones.dev.soyfri.com.pem +0 -27
  81. package/local/afiliaciones/afiliaciones.dev.soyfri.com-key.pem +0 -28
  82. package/local/afiliaciones/afiliaciones.dev.soyfri.com.pem +0 -27
  83. package/local/root/rootCA-key.pem +0 -40
  84. package/local/root/rootCA.pem +0 -30
  85. package/local/soporte/supportweb.dev.soyfri.com-key.pem +0 -28
  86. package/local/soporte/supportweb.dev.soyfri.com.pem +0 -27
  87. package/local/support/supportweb.dev.soyfri.com-key.pem +0 -28
  88. package/local/support/supportweb.dev.soyfri.com.pem +0 -27
@@ -58,34 +58,40 @@ const buildAutocompleteSx = (borderRadius, labelPosition) => buildFormFieldSx({
58
58
  }
59
59
  }
60
60
  });
61
- const resolveSingleValue = (options, value) => {
61
+ const resolveSingleValue = (options, value, getKey) => {
62
62
  var _a;
63
- return (_a = options.find((o) => o.value === value)) != null ? _a : null;
63
+ if (value === null || value === void 0) return null;
64
+ const key = getKey(value);
65
+ return (_a = options.find((o) => getKey(o.value) === key)) != null ? _a : null;
64
66
  };
65
- const resolveMultipleValue = (options, value) => {
67
+ const resolveMultipleValue = (options, value, getKey) => {
66
68
  if (!Array.isArray(value)) return [];
67
- return options.filter((o) => value.includes(o.value));
69
+ const keys = new Set(value.map(getKey));
70
+ return options.filter((o) => keys.has(getKey(o.value)));
68
71
  };
69
- const areOptionsShallowEqual = (a, b) => {
72
+ const areOptionsShallowEqual = (a, b, getKey) => {
70
73
  const keysA = Object.keys(a);
71
74
  const keysB = Object.keys(b);
72
75
  if (keysA.length !== keysB.length) return false;
73
- return keysA.every((k) => a[k] === b[k]);
76
+ return keysA.every((k) => {
77
+ if (k === "value") return getKey(a.value) === getKey(b.value);
78
+ return a[k] === b[k];
79
+ });
74
80
  };
75
- const areResolvedValuesEqual = (prev, next, multiple) => {
81
+ const areResolvedValuesEqual = (prev, next, multiple, getKey) => {
76
82
  if (multiple) {
77
83
  if (!Array.isArray(prev) || !Array.isArray(next)) return false;
78
84
  if (prev.length !== next.length) return false;
79
85
  return prev.every((o, i) => {
80
86
  const n2 = next[i];
81
- return !!n2 && areOptionsShallowEqual(o, n2);
87
+ return !!n2 && areOptionsShallowEqual(o, n2, getKey);
82
88
  });
83
89
  }
84
90
  const p = prev;
85
91
  const n = next;
86
92
  if (p === n) return true;
87
93
  if (!p || !n) return false;
88
- return areOptionsShallowEqual(p, n);
94
+ return areOptionsShallowEqual(p, n, getKey);
89
95
  };
90
96
  const isResolvedValueEmpty = (resolvedValue, multiple) => {
91
97
  if (multiple) {
@@ -105,7 +111,8 @@ const AutocompleteChips = ({
105
111
  getTagProps,
106
112
  size,
107
113
  maxChipsToShow,
108
- renderChipLabel
114
+ renderChipLabel,
115
+ getKey
109
116
  }) => {
110
117
  const displayed = value.slice(0, maxChipsToShow);
111
118
  const hidden = value.length - maxChipsToShow;
@@ -120,7 +127,7 @@ const AutocompleteChips = ({
120
127
  avatar: option.img ? /* @__PURE__ */ jsx(Avatar, { src: option.img }) : void 0,
121
128
  deleteIcon: /* @__PURE__ */ jsx(ClearIcon, {})
122
129
  }),
123
- option.value
130
+ getKey(option.value)
124
131
  );
125
132
  }),
126
133
  hidden > 0 && /* @__PURE__ */ jsx(Chip, { size, label: `+${hidden} más` })
@@ -146,6 +153,8 @@ function Autocomplete(props) {
146
153
  maxChipsToShow = 3,
147
154
  renderOptionItem,
148
155
  renderChipLabel,
156
+ renderSingleValue,
157
+ getOptionKey,
149
158
  borderRadius = FIELD_BORDER_RADIUS,
150
159
  labelPosition = "outside",
151
160
  size = "small",
@@ -162,23 +171,20 @@ function Autocomplete(props) {
162
171
  onOpen,
163
172
  onClose
164
173
  } = props;
174
+ const getKey = getOptionKey != null ? getOptionKey : ((v) => v);
165
175
  const [isFocused, setIsFocused] = useState(false);
166
- const seenOptionsRef = useRef(
167
- /* @__PURE__ */ new Map()
168
- );
176
+ const seenOptionsRef = useRef(/* @__PURE__ */ new Map());
169
177
  for (const opt of options) {
170
- seenOptionsRef.current.set(opt.value, opt);
178
+ seenOptionsRef.current.set(getKey(opt.value), opt);
171
179
  }
172
180
  const resolvePool = useMemo(() => {
173
181
  const merged = new Map(seenOptionsRef.current);
174
- for (const opt of options) merged.set(opt.value, opt);
182
+ for (const opt of options) merged.set(getKey(opt.value), opt);
175
183
  return Array.from(merged.values());
176
184
  }, [options]);
177
- const prevResolvedRef = useRef(
178
- multiple ? [] : null
179
- );
185
+ const prevResolvedRef = useRef(multiple ? [] : null);
180
186
  const stabilizeResolved = (newVal) => {
181
- if (areResolvedValuesEqual(prevResolvedRef.current, newVal, multiple)) {
187
+ if (areResolvedValuesEqual(prevResolvedRef.current, newVal, multiple, getKey)) {
182
188
  return prevResolvedRef.current;
183
189
  }
184
190
  prevResolvedRef.current = newVal;
@@ -187,7 +193,8 @@ function Autocomplete(props) {
187
193
  const theme = useTheme();
188
194
  const presetSx = resolvePreset("Autocomplete", preset, theme);
189
195
  const mergedSx = [
190
- ...presetSx ? [presetSx] : [buildAutocompleteSx(borderRadius, labelPosition)],
196
+ buildAutocompleteSx(borderRadius, labelPosition),
197
+ ...presetSx ? [presetSx] : [],
191
198
  ...Array.isArray(sx) ? sx : sx ? [sx] : []
192
199
  ];
193
200
  const renderAutocomplete = (resolvedValue2, handleChange, onBlur, inputRef, rhfError, rhfHelperText) => {
@@ -195,6 +202,7 @@ function Autocomplete(props) {
195
202
  const finalHelperText = rhfHelperText || helperText;
196
203
  const isEmpty = isResolvedValueEmpty(resolvedValue2, multiple);
197
204
  const showPlaceholder = isEmpty && isFocused && !!placeholder;
205
+ const singleAdornment = !multiple && resolvedValue2 && renderSingleValue ? renderSingleValue(resolvedValue2) : null;
198
206
  return /* @__PURE__ */ jsx(
199
207
  Autocomplete$1,
200
208
  {
@@ -218,7 +226,8 @@ function Autocomplete(props) {
218
226
  },
219
227
  isOptionEqualToValue: (a, b) => {
220
228
  if (typeof a === "string" || typeof b === "string") return a === b;
221
- return (a == null ? void 0 : a.value) === (b == null ? void 0 : b.value);
229
+ if (!a || !b) return a === b;
230
+ return getKey(a.value) === getKey(b.value);
222
231
  },
223
232
  getOptionDisabled: (opt) => typeof opt === "string" ? false : !!(opt == null ? void 0 : opt.disabled),
224
233
  onChange: handleChange,
@@ -228,7 +237,7 @@ function Autocomplete(props) {
228
237
  onBlur == null ? void 0 : onBlur();
229
238
  },
230
239
  renderOption: (liProps, option) => {
231
- const _a = liProps, { key } = _a, liRest = __objRest(_a, ["key"]);
240
+ const _a = liProps, { key: _muiKey } = _a, liRest = __objRest(_a, ["key"]);
232
241
  return /* @__PURE__ */ jsx(
233
242
  AutocompleteOption,
234
243
  {
@@ -236,7 +245,7 @@ function Autocomplete(props) {
236
245
  option,
237
246
  customRender: renderOptionItem
238
247
  },
239
- key
248
+ getKey(option.value)
240
249
  );
241
250
  },
242
251
  renderValue: multiple ? (value, getItemProps) => /* @__PURE__ */ jsx(
@@ -246,13 +255,25 @@ function Autocomplete(props) {
246
255
  getTagProps: getItemProps,
247
256
  size,
248
257
  maxChipsToShow,
249
- renderChipLabel
258
+ renderChipLabel,
259
+ getKey
250
260
  }
251
261
  ) : void 0,
252
262
  noOptionsText,
253
263
  loadingText: loadingText != null ? loadingText : /* @__PURE__ */ jsx(AutocompleteLoader, {}),
254
264
  renderInput: (params) => {
255
- var _a;
265
+ var _a, _b, _c, _d;
266
+ const paramsInputLabel = params.InputLabelProps;
267
+ const consumerInputLabel = (_b = (_a = textFieldProps == null ? void 0 : textFieldProps.slotProps) == null ? void 0 : _a.inputLabel) != null ? _b : textFieldProps == null ? void 0 : textFieldProps.InputLabelProps;
268
+ const muiInputProps = params.InputProps;
269
+ const consumerInputProps = (_d = (_c = textFieldProps == null ? void 0 : textFieldProps.slotProps) == null ? void 0 : _c.input) != null ? _d : textFieldProps == null ? void 0 : textFieldProps.InputProps;
270
+ const inputSlot = singleAdornment ? __spreadProps(__spreadValues(__spreadValues({}, muiInputProps), consumerInputProps), {
271
+ startAdornment: /* @__PURE__ */ jsxs(Fragment, { children: [
272
+ singleAdornment,
273
+ consumerInputProps == null ? void 0 : consumerInputProps.startAdornment,
274
+ muiInputProps == null ? void 0 : muiInputProps.startAdornment
275
+ ] })
276
+ }) : void 0;
256
277
  return (
257
278
  // @ts-ignore — Ref<any> type mismatch between @types/react versions in monorepo
258
279
  /* @__PURE__ */ jsx(
@@ -266,8 +287,10 @@ function Autocomplete(props) {
266
287
  helperText: finalHelperText,
267
288
  inputRef
268
289
  }), textFieldProps), {
269
- InputLabelProps: __spreadProps(__spreadValues(__spreadValues({}, params.InputLabelProps), textFieldProps == null ? void 0 : textFieldProps.InputLabelProps), {
270
- shrink: labelPosition === "outside" ? !isEmpty || isFocused : (_a = params.InputLabelProps) == null ? void 0 : _a.shrink
290
+ slotProps: __spreadProps(__spreadValues(__spreadValues({}, textFieldProps == null ? void 0 : textFieldProps.slotProps), inputSlot ? { input: inputSlot } : {}), {
291
+ inputLabel: __spreadProps(__spreadValues(__spreadValues({}, paramsInputLabel), consumerInputLabel), {
292
+ shrink: labelPosition === "outside" ? !isEmpty || isFocused : paramsInputLabel == null ? void 0 : paramsInputLabel.shrink
293
+ })
271
294
  })
272
295
  })
273
296
  )
@@ -278,14 +301,14 @@ function Autocomplete(props) {
278
301
  };
279
302
  const extractValue = (opt) => {
280
303
  var _a;
281
- return typeof opt === "string" ? opt : (_a = opt == null ? void 0 : opt.value) != null ? _a : null;
304
+ if (opt === null || opt === void 0) return null;
305
+ if (typeof opt === "string") return opt;
306
+ return (_a = opt == null ? void 0 : opt.value) != null ? _a : null;
282
307
  };
283
308
  const handleControlledChange = (_event, newValue) => {
284
309
  const onChange = props.onChange;
285
310
  if (multiple) {
286
- const values = (newValue != null ? newValue : []).map(
287
- (opt) => extractValue(opt)
288
- );
311
+ const values = (newValue != null ? newValue : []).map((opt) => extractValue(opt)).filter((v) => v !== null);
289
312
  onChange(values);
290
313
  } else {
291
314
  onChange(extractValue(newValue));
@@ -301,13 +324,11 @@ function Autocomplete(props) {
301
324
  rules: validation,
302
325
  render: ({ field, fieldState: { error: fieldError } }) => {
303
326
  const resolvedValue2 = stabilizeResolved(
304
- multiple ? resolveMultipleValue(resolvePool, field.value) : resolveSingleValue(resolvePool, field.value)
327
+ multiple ? resolveMultipleValue(resolvePool, field.value, getKey) : resolveSingleValue(resolvePool, field.value, getKey)
305
328
  );
306
329
  const handleChange = (_event, newValue) => {
307
330
  if (multiple) {
308
- const next = (newValue != null ? newValue : []).map(
309
- (opt) => extractValue(opt)
310
- );
331
+ const next = (newValue != null ? newValue : []).map((opt) => extractValue(opt)).filter((v) => v !== null);
311
332
  field.onChange(next);
312
333
  onValueChange == null ? void 0 : onValueChange(next);
313
334
  } else {
@@ -330,7 +351,7 @@ function Autocomplete(props) {
330
351
  }
331
352
  const controlledValue = props.value;
332
353
  const resolvedValue = stabilizeResolved(
333
- multiple ? resolveMultipleValue(resolvePool, controlledValue) : resolveSingleValue(resolvePool, controlledValue)
354
+ multiple ? resolveMultipleValue(resolvePool, controlledValue, getKey) : resolveSingleValue(resolvePool, controlledValue, getKey)
334
355
  );
335
356
  return renderAutocomplete(resolvedValue, handleControlledChange);
336
357
  }
@@ -339,4 +360,4 @@ export {
339
360
  Autocomplete as A,
340
361
  AutocompleteSelect as a
341
362
  };
342
- //# sourceMappingURL=Autocomplete-E5aSUGVK.js.map
363
+ //# sourceMappingURL=Autocomplete-Cvf16lFk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Autocomplete-Cvf16lFk.js","sources":["../src/components/Autocomplete/Autocomplete.sx.ts","../src/components/Autocomplete/Autocomplete.helpers.ts","../src/components/Autocomplete/_parts/AutocompleteOption.tsx","../src/components/Autocomplete/_parts/AutocompleteChips.tsx","../src/components/Autocomplete/_parts/AutocompleteLoader.tsx","../src/components/Autocomplete/Autocomplete.tsx"],"sourcesContent":["import type { SxProps, Theme } from '@mui/material/styles';\n\nimport { buildFormFieldSx } from '../_shared/formField.sx';\nimport { FIELD_INPUT_PADDING_Y } from '../../theme/tokens';\nimport type { LabelPosition } from './Autocomplete';\n\n/**\n * Builder del sx del Autocomplete. Reutiliza `buildFormFieldSx` y añade\n * los paddings propios del Autocomplete (chips + input interno).\n */\nexport const buildAutocompleteSx = (\n borderRadius: number | string,\n labelPosition: LabelPosition,\n): SxProps<Theme> =>\n buildFormFieldSx({\n borderRadius,\n labelPosition,\n extraOutsideSx: {\n // El Autocomplete es el único campo cuyo padding lo pinta MUI con\n // selectores calificados por tamaño (`.MuiOutlinedInput-root.MuiInputBase-sizeSmall`\n // y su descendiente `.MuiAutocomplete-input`). Un selector de menos clases\n // pierde por especificidad — por eso hay que repetir el calificador acá, o\n // el Autocomplete queda ~5px más bajo que Input/Select/pickers.\n '& .MuiOutlinedInput-root, & .MuiOutlinedInput-root.MuiInputBase-sizeSmall': {\n paddingTop: 0,\n paddingBottom: 0,\n },\n\n // La altura la fija el input interno, con el mismo token que el resto.\n '& .MuiOutlinedInput-root .MuiAutocomplete-input, & .MuiOutlinedInput-root.MuiInputBase-sizeSmall .MuiAutocomplete-input':\n {\n paddingTop: FIELD_INPUT_PADDING_Y,\n paddingBottom: FIELD_INPUT_PADDING_Y,\n },\n },\n });\n","import type { SxProps, Theme } from '@mui/material/styles';\nimport type { AutocompleteValueKey, SelectOption } from './Autocomplete';\n\n/** Resuelve un value único a su SelectOption dentro del pool. */\nexport const resolveSingleValue = <TValue,>(\n options: SelectOption<TValue>[],\n value: TValue | null | undefined,\n getKey: (v: TValue) => AutocompleteValueKey,\n): SelectOption<TValue> | null => {\n if (value === null || value === undefined) return null;\n const key = getKey(value);\n return options.find((o) => getKey(o.value) === key) ?? null;\n};\n\n/** Resuelve un array de values a sus SelectOption dentro del pool. */\nexport const resolveMultipleValue = <TValue,>(\n options: SelectOption<TValue>[],\n value: TValue[] | null | undefined,\n getKey: (v: TValue) => AutocompleteValueKey,\n): SelectOption<TValue>[] => {\n if (!Array.isArray(value)) return [];\n const keys = new Set(value.map(getKey));\n return options.filter((o) => keys.has(getKey(o.value)));\n};\n\n/** Merge de sx base + extra del consumer, respetando el contrato de MUI. */\nexport const mergeSx = (\n base: SxProps<Theme>,\n extra?: SxProps<Theme>,\n): SxProps<Theme> => {\n if (!extra) return base;\n return [base, ...(Array.isArray(extra) ? extra : [extra])] as SxProps<Theme>;\n};\n\n/**\n * Compara dos SelectOption por todas sus props (shallow). Se usa para detectar\n * cambios de metadata (p.ej. `label`, `img`) cuando `value` no cambió, para\n * que la estabilización no tape datos frescos del server. Para `value` se\n * compara vía `getKey` (no por `===`), de modo que values objeto con misma\n * identidad lógica pero referencia distinta no rompan la estabilización.\n */\nconst areOptionsShallowEqual = <TValue,>(\n a: SelectOption<TValue>,\n b: SelectOption<TValue>,\n getKey: (v: TValue) => AutocompleteValueKey,\n): boolean => {\n const keysA = Object.keys(a);\n const keysB = Object.keys(b);\n if (keysA.length !== keysB.length) return false;\n return keysA.every((k) => {\n if (k === 'value') return getKey(a.value) === getKey(b.value);\n return a[k] === b[k];\n });\n};\n\n/**\n * Compara dos valores resueltos (single o multiple) estructuralmente para\n * decidir si se puede reusar la referencia previa. Se usa para estabilizar la\n * referencia que se pasa a MUI Autocomplete (MUI compara value por referencia\n * con `!==`, y una nueva referencia — aunque el contenido sea igual — dispara\n * `resetInputValue` y borra el texto mientras el usuario tipea).\n *\n * Comparamos todas las props del SelectOption, no solo `value`, para que un\n * refresh de metadata (label/img/etc.) invalide la referencia estabilizada\n * y la UI muestre los datos actualizados.\n */\nexport const areResolvedValuesEqual = <TValue,>(\n prev: SelectOption<TValue> | SelectOption<TValue>[] | null,\n next: SelectOption<TValue> | SelectOption<TValue>[] | null,\n multiple: boolean,\n getKey: (v: TValue) => AutocompleteValueKey,\n): boolean => {\n if (multiple) {\n if (!Array.isArray(prev) || !Array.isArray(next)) return false;\n if (prev.length !== next.length) return false;\n return prev.every((o, i) => {\n const n = next[i];\n return !!n && areOptionsShallowEqual(o, n, getKey);\n });\n }\n const p = prev as SelectOption<TValue> | null;\n const n = next as SelectOption<TValue> | null;\n if (p === n) return true;\n if (!p || !n) return false;\n return areOptionsShallowEqual(p, n, getKey);\n};\n\n/** Determina si un valor resuelto está vacío (para placeholder/shrink). */\nexport const isResolvedValueEmpty = (\n resolvedValue: unknown,\n multiple: boolean,\n): boolean => {\n if (multiple) {\n return !Array.isArray(resolvedValue) || resolvedValue.length === 0;\n }\n return !resolvedValue;\n};\n","import React from 'react';\nimport type {\n AutocompleteValueKey,\n SelectOption,\n RenderOptionItem,\n} from '../Autocomplete';\n\ninterface AutocompleteOptionProps<TValue = AutocompleteValueKey> {\n liProps: React.HTMLAttributes<HTMLLIElement>;\n option: SelectOption<TValue>;\n customRender?: RenderOptionItem<TValue>;\n}\n\n/**\n * Render por defecto de un `<li>` del dropdown del Autocomplete.\n * MUI lo invoca desde `renderOption={(props, option) => ...}` en el padre.\n *\n * La `key` la maneja el padre (`renderOption` en Autocomplete.tsx). Este\n * componente solo recibe los props restantes del `<li>` para spread.\n */\nexport const AutocompleteOption = <TValue,>({\n liProps,\n option,\n customRender,\n}: AutocompleteOptionProps<TValue>) => {\n return (\n <li {...liProps}>\n {customRender ? customRender(option) : option.label}\n </li>\n );\n};\n\nexport default AutocompleteOption;\n","import { Avatar, Chip } from '@mui/material';\nimport ClearIcon from '@mui/icons-material/Clear';\n\nimport type {\n AutocompleteValueKey,\n SelectOption,\n RenderChipLabel,\n AutocompleteSize,\n} from '../Autocomplete';\n\ninterface AutocompleteChipsProps<TValue = AutocompleteValueKey> {\n value: SelectOption<TValue>[];\n getTagProps: (args: { index: number }) => Record<string, any>;\n size: AutocompleteSize;\n maxChipsToShow: number;\n renderChipLabel?: RenderChipLabel<TValue>;\n /** Key estable del value: React key del chip. Ver `getOptionKey`. */\n getKey: (value: TValue) => AutocompleteValueKey;\n}\n\n/**\n * Render de los chips del Autocomplete en modo multiple.\n * Trunca después de `maxChipsToShow` con un chip \"+N más\".\n * El `getTagProps({ index })` viene de MUI y contiene el handler de delete,\n * la key, etc. — se spreadea tal cual al Chip.\n */\nexport const AutocompleteChips = <TValue,>({\n value,\n getTagProps,\n size,\n maxChipsToShow,\n renderChipLabel,\n getKey,\n}: AutocompleteChipsProps<TValue>) => {\n const displayed = value.slice(0, maxChipsToShow);\n const hidden = value.length - maxChipsToShow;\n\n return (\n <>\n {displayed.map((option, index) => {\n const { key: _ignored, ...tagProps } = getTagProps({ index });\n return (\n <Chip\n key={getKey(option.value)}\n {...tagProps}\n size={size}\n label={renderChipLabel ? renderChipLabel(option) : option.label}\n avatar={option.img ? <Avatar src={option.img} /> : undefined}\n deleteIcon={<ClearIcon />}\n />\n );\n })}\n {hidden > 0 && <Chip size={size} label={`+${hidden} más`} />}\n </>\n );\n};\n\nexport default AutocompleteChips;\n","import React from 'react';\nimport { Box, CircularProgress, Typography } from '@mui/material';\n\n/**\n * Loader por defecto para el `loadingText` del Autocomplete.\n * El consumer puede sobrescribirlo pasando `loadingText` al componente padre.\n */\nexport const AutocompleteLoader: React.FC<{ text?: string }> = ({\n text = 'Cargando...',\n}) => (\n <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>\n <CircularProgress size={16} />\n <Typography variant=\"body2\">{text}</Typography>\n </Box>\n);\n\nexport default AutocompleteLoader;\n","import React, {\n useMemo,\n useRef,\n useState,\n type ReactNode,\n type SyntheticEvent,\n} from 'react';\nimport {\n Autocomplete as MuiAutocomplete,\n TextField,\n type TextFieldProps,\n} from '@mui/material';\nimport { useTheme, type SxProps, type Theme } from '@mui/material/styles';\nimport { Controller, type RegisterOptions } from 'react-hook-form';\n\nimport { buildAutocompleteSx } from './Autocomplete.sx';\nimport { FIELD_BORDER_RADIUS } from '../../theme/tokens';\nimport {\n areResolvedValuesEqual,\n isResolvedValueEmpty,\n resolveMultipleValue,\n resolveSingleValue,\n} from './Autocomplete.helpers';\nimport { resolvePreset } from '../_shared/resolvePreset';\nimport { AutocompleteOption } from './_parts/AutocompleteOption';\nimport { AutocompleteChips } from './_parts/AutocompleteChips';\nimport { AutocompleteLoader } from './_parts/AutocompleteLoader';\n\n// ── Tipos de dominio ─────────────────────────────────────────────────────\n/** Key estable usada para comparar values, indexar caches y como React key. */\nexport type AutocompleteValueKey = string | number;\n\nexport interface SelectOption<TValue = AutocompleteValueKey> {\n value: TValue;\n label: string;\n img?: string;\n disabled?: boolean;\n group?: string;\n [key: string]: any; //campos extras que puede tener la opcion\n}\n\nexport type LabelPosition = 'outside' | 'floating';\nexport type AutocompleteSize = 'small' | 'medium';\n\n// ── Render slots ─────────────────────────────────────────────────────────\nexport type RenderOptionItem<TValue = AutocompleteValueKey> = (\n item: SelectOption<TValue>,\n) => ReactNode;\nexport type RenderChipLabel<TValue = AutocompleteValueKey> = (\n item: SelectOption<TValue>,\n) => ReactNode;\nexport type RenderSingleValue<TValue = AutocompleteValueKey> = (\n item: SelectOption<TValue>,\n) => ReactNode;\n\n// ── Props base ───────────────────────────────────────────────────────────\nexport type BaseAutocompleteProps<TValue = AutocompleteValueKey> = {\n label?: string;\n options: SelectOption<TValue>[];\n placeholder?: string;\n multiple?: boolean;\n disabled?: boolean;\n readOnly?: boolean;\n loading?: boolean;\n error?: boolean;\n helperText?: string;\n maxChipsToShow?: number;\n renderOptionItem?: RenderOptionItem<TValue>;\n renderChipLabel?: RenderChipLabel<TValue>;\n /**\n * Renderiza JSX custom como `startAdornment` del input en single mode.\n * Recibe la `SelectOption` seleccionada. Útil para mostrar avatars, iconos,\n * etc. junto al texto del label. En `multiple` no aplica (se usa `renderChipLabel`).\n */\n renderSingleValue?: RenderSingleValue<TValue>;\n /**\n * Extrae una key estable (string | number) desde el `value`. Obligatorio\n * cuando `TValue` es un objeto: se usa para comparar values (`isOptionEqualToValue`,\n * resolución desde el value del form), indexar el cache interno de opciones\n * vistas y como React key en chips/options del dropdown. Para primitivos se\n * puede omitir (default: identidad, o sea `===`).\n */\n getOptionKey?: (value: TValue) => AutocompleteValueKey;\n /** Border radius del input. Default: 10. */\n borderRadius?: number | string;\n /** \"outside\" (default) = label arriba del input; \"floating\" = comportamiento nativo MUI. */\n labelPosition?: LabelPosition;\n /** Tamaño del TextField. Default: 'small'. */\n size?: AutocompleteSize;\n /** Texto cuando no hay coincidencias. */\n noOptionsText?: ReactNode;\n /** Texto cuando está cargando. */\n loadingText?: ReactNode;\n sx?: SxProps<Theme>;\n /**\n * Nombre del preset de estilo registrado en `theme.styles.Autocomplete`.\n * - `\"default\"` (o ausente) = estilo built-in del paquete.\n * - Cualquier otro string = mergea el preset encima del estilo built-in.\n */\n preset?: string;\n /** Props para el TextField subyacente. */\n textFieldProps?: Partial<TextFieldProps>;\n\n // ── Búsqueda asíncrona / remota ──────────────────────────────────────\n /** Se dispara cada vez que el usuario escribe. Útil para llamadas a servicios\n * (debounce recomendado en el consumer). */\n onInputChange?: (\n event: SyntheticEvent,\n value: string,\n reason: 'input' | 'reset' | 'clear' | 'blur' | 'selectOption' | 'removeOption',\n ) => void;\n /** Valor controlado del texto de búsqueda. */\n inputValue?: string;\n /** Filtro custom. Para búsqueda remota pasar `(x) => x` y confiar sólo en el servicio. */\n filterOptions?: (\n options: SelectOption<TValue>[],\n state: any,\n ) => SelectOption<TValue>[];\n /** Permite valores arbitrarios (no solo de la lista). */\n freeSolo?: boolean;\n open?: boolean;\n onOpen?: (event: SyntheticEvent) => void;\n onClose?: (event: SyntheticEvent, reason: string) => void;\n};\n\n// ── Variantes discriminadas (RHF vs controlado) ──────────────────────────\nexport interface ControlledAutocompleteProps<TValue = AutocompleteValueKey>\n extends BaseAutocompleteProps<TValue> {\n value: TValue | TValue[] | null;\n onChange: (val: TValue | TValue[] | null) => void;\n name?: string;\n control?: never;\n validation?: never;\n}\n\nexport interface RHFAutocompleteProps<TValue = AutocompleteValueKey>\n extends BaseAutocompleteProps<TValue> {\n name: string;\n // `any` plano (no `Control<any>`): RHF tipa `Control<T>` con generics en\n // posiciones tanto contravariantes como covariantes (ej. `_subjects.state`).\n // Cuando el componente o su uso involucra generics adicionales, TS se\n // confunde narroweando el discriminated union y `Control<any>` no logra\n // absorber `Control<MyForm>` en la comparación estructural profunda. El\n // `any` plano elimina ese ruido. RHF adentro sigue teniendo sus tipos\n // fuertes — solo degradamos la superficie del prop del componente.\n control: any;\n validation?: RegisterOptions;\n /**\n * Side-effect que corre después de que RHF actualiza el form state.\n * Útil para cascadas entre campos. NO reemplaza al handler de RHF.\n */\n onValueChange?: (val: TValue | TValue[] | null) => void;\n value?: never;\n onChange?: never;\n}\n\n// ── API pública final ────────────────────────────────────────────────────\nexport type AutocompleteProps<TValue = AutocompleteValueKey> =\n | ControlledAutocompleteProps<TValue>\n | RHFAutocompleteProps<TValue>;\n\nexport function Autocomplete<TValue = AutocompleteValueKey>(\n props: AutocompleteProps<TValue>,\n) {\n const {\n label,\n options,\n placeholder,\n multiple = false,\n disabled = false,\n readOnly = false,\n loading = false,\n error: errorProp = false,\n helperText,\n maxChipsToShow = 3,\n renderOptionItem,\n renderChipLabel,\n renderSingleValue,\n getOptionKey,\n borderRadius = FIELD_BORDER_RADIUS,\n labelPosition = 'outside',\n size = 'small',\n noOptionsText = 'No hay opciones',\n loadingText,\n sx,\n preset,\n textFieldProps,\n onInputChange,\n inputValue,\n filterOptions,\n freeSolo,\n open,\n onOpen,\n onClose,\n } = props as BaseAutocompleteProps<TValue>;\n\n // Default identidad: para primitivos (string|number) funciona como `===`.\n // Para values objeto, el consumer DEBE pasar `getOptionKey` o la igualdad\n // caerá a referencia (Map/Set agruparían por identidad).\n const getKey = (getOptionKey ??\n ((v: TValue) => v as unknown as AutocompleteValueKey)) as (\n v: TValue,\n ) => AutocompleteValueKey;\n\n // Focus tracking para mostrar placeholder solo cuando el label sube.\n const [isFocused, setIsFocused] = useState(false);\n\n // Cache interno de opciones vistas (indexado por key estable). Crítico para\n // async multiple: cuando `options` cambian por un nuevo search, los items\n // ya seleccionados no desaparecen de los chips porque los recordamos acá.\n const seenOptionsRef = useRef<\n Map<AutocompleteValueKey, SelectOption<TValue>>\n >(new Map());\n for (const opt of options) {\n seenOptionsRef.current.set(getKey(opt.value), opt);\n }\n\n // Pool de opciones para resolver values (merge de options + vistas).\n const resolvePool = useMemo<SelectOption<TValue>[]>(() => {\n const merged = new Map(seenOptionsRef.current);\n for (const opt of options) merged.set(getKey(opt.value), opt);\n return Array.from(merged.values());\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [options]);\n\n // Estabiliza la referencia del resolvedValue que pasamos a MUI Autocomplete.\n // MUI compara value con `!==`: una referencia nueva con mismo contenido\n // dispara resetInputValue() y borra el texto que el usuario está escribiendo.\n const prevResolvedRef = useRef<\n SelectOption<TValue>[] | SelectOption<TValue> | null\n >(multiple ? [] : null);\n\n const stabilizeResolved = (\n newVal: SelectOption<TValue>[] | SelectOption<TValue> | null,\n ): SelectOption<TValue>[] | SelectOption<TValue> | null => {\n if (\n areResolvedValuesEqual(prevResolvedRef.current, newVal, multiple, getKey)\n ) {\n return prevResolvedRef.current;\n }\n prevResolvedRef.current = newVal;\n return newVal;\n };\n\n const theme = useTheme();\n const presetSx = resolvePreset('Autocomplete', preset, theme);\n\n // Built-in primero, preset encima (ver Input).\n const mergedSx = [\n buildAutocompleteSx(borderRadius, labelPosition),\n ...(presetSx ? [presetSx] : []),\n ...(Array.isArray(sx) ? sx : sx ? [sx] : []),\n ];\n\n const renderAutocomplete = (\n resolvedValue: any,\n handleChange: (event: any, newValue: any) => void,\n onBlur?: () => void,\n inputRef?: React.Ref<any>,\n rhfError?: boolean,\n rhfHelperText?: string,\n ) => {\n const finalError = !!rhfError || !!errorProp;\n const finalHelperText = rhfHelperText || helperText;\n\n const isEmpty = isResolvedValueEmpty(resolvedValue, multiple);\n const showPlaceholder = isEmpty && isFocused && !!placeholder;\n const singleAdornment =\n !multiple && resolvedValue && renderSingleValue\n ? renderSingleValue(resolvedValue as SelectOption<TValue>)\n : null;\n\n return (\n <MuiAutocomplete\n multiple={multiple}\n options={options}\n value={resolvedValue}\n disabled={disabled}\n readOnly={readOnly}\n loading={loading}\n sx={mergedSx}\n freeSolo={freeSolo as any}\n open={open}\n onOpen={onOpen}\n onClose={onClose}\n inputValue={inputValue}\n onInputChange={onInputChange}\n filterOptions={filterOptions as any}\n getOptionLabel={(opt) =>\n typeof opt === 'string' ? opt : (opt?.label ?? '')\n }\n isOptionEqualToValue={(a, b) => {\n if (typeof a === 'string' || typeof b === 'string') return a === b;\n if (!a || !b) return a === b;\n return getKey(a.value) === getKey(b.value);\n }}\n getOptionDisabled={(opt) =>\n typeof opt === 'string' ? false : !!opt?.disabled\n }\n onChange={handleChange}\n onFocus={() => setIsFocused(true)}\n onBlur={() => {\n setIsFocused(false);\n onBlur?.();\n }}\n renderOption={(liProps, option) => {\n // MUI inyecta la `key` dentro de `liProps`. React necesita la key\n // en el elemento más externo que devuelve `renderOption` (acá el\n // wrapper), no en el `<li>` interno. El resto de `liProps` viaja\n // al `<li>`. La key auto-generada por MUI cae a `getOptionLabel`,\n // que colisiona si hay opciones con label duplicado. Usamos la key\n // estable del value para garantizar uniqueness aunque haya labels\n // repetidos.\n const { key: _muiKey, ...liRest } = liProps as React.HTMLAttributes<HTMLLIElement> & {\n key?: React.Key;\n };\n return (\n <AutocompleteOption<TValue>\n key={getKey(option.value)}\n liProps={liRest}\n option={option}\n customRender={renderOptionItem}\n />\n );\n }}\n renderValue={\n multiple\n ? (value, getItemProps) => (\n <AutocompleteChips<TValue>\n value={value as SelectOption<TValue>[]}\n getTagProps={getItemProps}\n size={size}\n maxChipsToShow={maxChipsToShow}\n renderChipLabel={renderChipLabel}\n getKey={getKey}\n />\n )\n : undefined\n }\n noOptionsText={noOptionsText}\n loadingText={loadingText ?? <AutocompleteLoader />}\n renderInput={(params) => {\n const paramsInputLabel = (params as any).InputLabelProps as\n | Record<string, any>\n | undefined;\n const consumerInputLabel =\n (textFieldProps?.slotProps as any)?.inputLabel ??\n (textFieldProps as any)?.InputLabelProps;\n // Para inyectar `singleAdornment` necesitamos pasar `slotProps.input`\n // a TextField, pero `slotProps.input` gana sobre `params.InputProps`\n // (que trae endAdornment con chevron + clear). Por eso, cuando hay\n // adornment custom, mergeamos params.InputProps + lo que el consumer\n // haya pasado por textFieldProps + nuestro startAdornment. Si no hay\n // adornment, no tocamos `slotProps.input` y se preserva el flujo legacy.\n const muiInputProps = (params as any).InputProps as\n | Record<string, any>\n | undefined;\n const consumerInputProps =\n (textFieldProps?.slotProps as any)?.input ??\n (textFieldProps as any)?.InputProps;\n const inputSlot = singleAdornment\n ? {\n ...muiInputProps,\n ...consumerInputProps,\n startAdornment: (\n <>\n {singleAdornment}\n {consumerInputProps?.startAdornment}\n {muiInputProps?.startAdornment}\n </>\n ),\n }\n : undefined;\n\n return (\n // @ts-ignore — Ref<any> type mismatch between @types/react versions in monorepo\n <TextField\n {...params}\n label={label}\n size={size}\n variant=\"outlined\"\n placeholder={showPlaceholder ? placeholder : undefined}\n error={finalError}\n helperText={finalHelperText}\n inputRef={inputRef}\n {...textFieldProps}\n slotProps={{\n ...textFieldProps?.slotProps,\n ...(inputSlot ? { input: inputSlot } : {}),\n inputLabel: {\n ...paramsInputLabel,\n ...consumerInputLabel,\n shrink:\n labelPosition === 'outside'\n ? !isEmpty || isFocused\n : paramsInputLabel?.shrink,\n },\n }}\n />\n );\n }}\n />\n );\n };\n\n //obtiene el primitivo (o el objeto) value desde la opción seleccionada\n const extractValue = (opt: any): TValue | null => {\n if (opt === null || opt === undefined) return null;\n if (typeof opt === 'string') return opt as unknown as TValue;\n return (opt?.value ?? null) as TValue | null;\n };\n\n const handleControlledChange = (_event: any, newValue: any) => {\n const onChange = (props as ControlledAutocompleteProps<TValue>).onChange;\n if (multiple) {\n const values = (newValue ?? [])\n .map((opt: SelectOption<TValue> | string) => extractValue(opt))\n .filter((v: TValue | null): v is TValue => v !== null);\n onChange(values);\n } else {\n onChange(extractValue(newValue));\n }\n };\n\n // --- RHF mode ---\n if ('control' in props && props.control) {\n const { name, control, validation, onValueChange } =\n props as RHFAutocompleteProps<TValue>;\n return (\n <Controller\n name={name}\n control={control}\n rules={validation}\n render={({ field, fieldState: { error: fieldError } }) => {\n const resolvedValue = stabilizeResolved(\n multiple\n ? resolveMultipleValue(resolvePool, field.value, getKey)\n : resolveSingleValue(resolvePool, field.value, getKey),\n );\n\n const handleChange = (_event: any, newValue: any) => {\n if (multiple) {\n const next = (newValue ?? [])\n .map((opt: SelectOption<TValue> | string) => extractValue(opt))\n .filter((v: TValue | null): v is TValue => v !== null);\n field.onChange(next);\n onValueChange?.(next);\n } else {\n const next = extractValue(newValue);\n field.onChange(next);\n onValueChange?.(next);\n }\n };\n\n return renderAutocomplete(\n resolvedValue,\n handleChange,\n field.onBlur,\n field.ref,\n !!fieldError,\n fieldError?.message,\n );\n }}\n />\n );\n }\n\n // --- Controlled mode ---\n const controlledValue = (props as ControlledAutocompleteProps<TValue>).value;\n const resolvedValue = stabilizeResolved(\n multiple\n ? resolveMultipleValue(resolvePool, controlledValue as TValue[], getKey)\n : resolveSingleValue(resolvePool, controlledValue as TValue, getKey),\n );\n\n return renderAutocomplete(resolvedValue, handleControlledChange);\n}\n\n/** Alias de `Autocomplete`. Ambos nombres son equivalentes. */\nexport const AutocompleteSelect = Autocomplete;\n\nexport default Autocomplete;\n"],"names":["n","resolvedValue","MuiAutocomplete"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUO,MAAM,sBAAsB,CACjC,cACA,kBAEA,iBAAiB;AAAA,EACf;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMd,6EAA6E;AAAA,MAC3E,YAAY;AAAA,MACZ,eAAe;AAAA,IAAA;AAAA;AAAA,IAIjB,2HACE;AAAA,MACE,YAAY;AAAA,MACZ,eAAe;AAAA,IAAA;AAAA,EACjB;AAEN,CAAC;AC/BI,MAAM,qBAAqB,CAChC,SACA,OACA,WACgC;;AAChC,MAAI,UAAU,QAAQ,UAAU,OAAW,QAAO;AAClD,QAAM,MAAM,OAAO,KAAK;AACxB,UAAO,aAAQ,KAAK,CAAC,MAAM,OAAO,EAAE,KAAK,MAAM,GAAG,MAA3C,YAAgD;AACzD;AAGO,MAAM,uBAAuB,CAClC,SACA,OACA,WAC2B;AAC3B,MAAI,CAAC,MAAM,QAAQ,KAAK,UAAU,CAAA;AAClC,QAAM,OAAO,IAAI,IAAI,MAAM,IAAI,MAAM,CAAC;AACtC,SAAO,QAAQ,OAAO,CAAC,MAAM,KAAK,IAAI,OAAO,EAAE,KAAK,CAAC,CAAC;AACxD;AAkBA,MAAM,yBAAyB,CAC7B,GACA,GACA,WACY;AACZ,QAAM,QAAQ,OAAO,KAAK,CAAC;AAC3B,QAAM,QAAQ,OAAO,KAAK,CAAC;AAC3B,MAAI,MAAM,WAAW,MAAM,OAAQ,QAAO;AAC1C,SAA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SAAS;AACvC,UAAM,EAAE,MAAM,SAAS,YAAY,kBACjC;AACF,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,OAAO;AAAA,QACP,QAAQ,CAAC,EAAE,OAAO,YAAY,EAAE,OAAO,WAAA,QAAmB;AACxD,gBAAMA,iBAAgB;AAAA,YACpB,WACI,qBAAqB,aAAa,MAAM,OAAO,MAAM,IACrD,mBAAmB,aAAa,MAAM,OAAO,MAAM;AAAA,UAAA;AAGzD,gBAAM,eAAe,CAAC,QAAa,aAAkB;AACnD,gBAAI,UAAU;AACZ,oBAAM,QAAQ,8BAAY,CAAA,GACvB,IAAI,CAAC,QAAuC,aAAa,GAAG,CAAC,EAC7D,OAAO,CAAC,MAAkC,MAAM,IAAI;AACvD,oBAAM,SAAS,IAAI;AACnB,6DAAgB;AAAA,YAClB,OAAO;AACL,oBAAM,OAAO,aAAa,QAAQ;AAClC,oBAAM,SAAS,IAAI;AACnB,6DAAgB;AAAA,YAClB;AAAA,UACF;AAEA,iBAAO;AAAA,YACLA;AAAAA,YACA;AAAA,YACA,MAAM;AAAA,YACN,MAAM;AAAA,YACN,CAAC,CAAC;AAAA,YACF,yCAAY;AAAA,UAAA;AAAA,QAEhB;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AAGA,QAAM,kBAAmB,MAA8C;AACvE,QAAM,gBAAgB;AAAA,IACpB,WACI,qBAAqB,aAAa,iBAA6B,MAAM,IACrE,mBAAmB,aAAa,iBAA2B,MAAM;AAAA,EAAA;AAGvE,SAAO,mBAAmB,eAAe,sBAAsB;AACjE;AAGO,MAAM,qBAAqB;"}
@@ -136,7 +136,8 @@ const DatePicker = (_a) => {
136
136
  const theme = useTheme();
137
137
  const presetSx = resolvePreset("DatePicker", preset, theme);
138
138
  const mergedSx = [
139
- ...presetSx ? [presetSx] : [buildDatePickerSx(borderRadius, labelPosition)],
139
+ buildDatePickerSx(borderRadius, labelPosition),
140
+ ...presetSx ? [presetSx] : [],
140
141
  ...Array.isArray(sx) ? sx : sx ? [sx] : []
141
142
  ];
142
143
  const finalError = !!validationErrorMessage || !!errorProp;
@@ -178,4 +179,4 @@ const DatePicker = (_a) => {
178
179
  export {
179
180
  DatePicker as D
180
181
  };
181
- //# sourceMappingURL=DatePicker-D__RSgs-.js.map
182
+ //# sourceMappingURL=DatePicker-D5BH4v1p.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker-D__RSgs-.js","sources":["../node_modules/dayjs/locale/en-gb.js","../src/components/DatePicker/DatePicker.sx.ts","../src/components/DatePicker/DatePicker.helpers.ts","../src/components/DatePicker/DatePicker.tsx"],"sourcesContent":["!function(e,a){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=a(require(\"dayjs\")):\"function\"==typeof define&&define.amd?define([\"dayjs\"],a):(e=\"undefined\"!=typeof globalThis?globalThis:e||self).dayjs_locale_en_gb=a(e.dayjs)}(this,(function(e){\"use strict\";function a(e){return e&&\"object\"==typeof e&&\"default\"in e?e:{default:e}}var t=a(e),_={name:\"en-gb\",weekdays:\"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday\".split(\"_\"),weekdaysShort:\"Sun_Mon_Tue_Wed_Thu_Fri_Sat\".split(\"_\"),weekdaysMin:\"Su_Mo_Tu_We_Th_Fr_Sa\".split(\"_\"),months:\"January_February_March_April_May_June_July_August_September_October_November_December\".split(\"_\"),monthsShort:\"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec\".split(\"_\"),weekStart:1,yearStart:4,relativeTime:{future:\"in %s\",past:\"%s ago\",s:\"a few seconds\",m:\"a minute\",mm:\"%d minutes\",h:\"an hour\",hh:\"%d hours\",d:\"a day\",dd:\"%d days\",M:\"a month\",MM:\"%d months\",y:\"a year\",yy:\"%d years\"},formats:{LT:\"HH:mm\",LTS:\"HH:mm:ss\",L:\"DD/MM/YYYY\",LL:\"D MMMM YYYY\",LLL:\"D MMMM YYYY HH:mm\",LLLL:\"dddd, D MMMM YYYY HH:mm\"},ordinal:function(e){var a=[\"th\",\"st\",\"nd\",\"rd\"],t=e%100;return\"[\"+e+(a[(t-20)%10]||a[t]||a[0])+\"]\"}};return t.default.locale(_,null,!0),_}));","import type { SxProps, Theme } from '@mui/material';\n\nimport { buildFormFieldSx } from '../_shared/formField.sx';\nimport type { LabelPosition } from './DatePicker';\n\n/**\n * Builder de sx para el DatePicker. Reutiliza `buildFormFieldSx` con\n * `includePickersApi: true` para cubrir tanto la API clásica (MuiInputBase /\n * MuiOutlinedInput) como la nueva (MuiPickersInputBase / MuiPickersOutlinedInput)\n * del DatePicker de MUI X v8.\n */\nexport const buildDatePickerSx = (\n borderRadius: number | string,\n labelPosition: LabelPosition,\n): SxProps<Theme> =>\n buildFormFieldSx({\n borderRadius,\n labelPosition,\n includePickersApi: true,\n });\n","import type { DateValidationError } from '@mui/x-date-pickers/models';\n\n/**\n * Traduce el código de error del DatePicker de MUI X a un mensaje en español.\n * Se usa internamente para poblar `helperText` cuando hay error de validación\n * y el consumer no pasó un mensaje propio.\n */\nexport const getDateValidationMessage = (\n error: DateValidationError | null,\n): string => {\n switch (error) {\n case 'minDate':\n case 'maxDate':\n return 'Fecha fuera del rango permitido';\n case 'invalidDate':\n return 'Formato de fecha inválido';\n case 'disableFuture':\n return 'No se permiten fechas futuras';\n case 'disablePast':\n return 'No se permiten fechas pasadas';\n default:\n return '';\n }\n};\n","import React, { useMemo } from 'react';\nimport type { SxProps, Theme } from '@mui/material';\nimport { useTheme } from '@mui/material/styles';\nimport { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';\nimport { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';\nimport {\n DatePicker as MuiDatePicker,\n type DatePickerProps as MuiDatePickerProps,\n} from '@mui/x-date-pickers/DatePicker';\nimport { DateValidationError } from '@mui/x-date-pickers/models';\nimport { esES } from '@mui/x-date-pickers/locales';\nimport dayjs, { Dayjs } from 'dayjs';\nimport enGbLocale from 'dayjs/locale/en-gb';\n\nimport { buildDatePickerSx } from './DatePicker.sx';\nimport { getDateValidationMessage } from './DatePicker.helpers';\nimport { resolvePreset } from '../_shared/resolvePreset';\nimport { FIELD_BORDER_RADIUS } from '../../theme/tokens';\n\n// Registrar el locale por defecto sin activarlo globalmente. El binding usado\n// (no un side-effect import pelado) evita que el tree-shaking del build de la\n// librería elimine el locale — con solo `import 'dayjs/locale/en-gb'` el chunk\n// publicado lo perdía y los pickers caían al formato 'en' (MM/DD/YYYY).\ndayjs.locale(enGbLocale, undefined, true);\n\n// ── Tipos de dominio ─────────────────────────────────────────────────────\nexport type LabelPosition = 'outside' | 'floating';\nexport type DatePickerSize = 'small' | 'medium';\n\n// ── Props base ───────────────────────────────────────────────────────────\nexport interface BaseDatePickerProps\n extends Omit<MuiDatePickerProps, 'value' | 'onChange' | 'slotProps'> {\n label?: string;\n minDate?: Dayjs;\n maxDate?: Dayjs;\n disabled?: boolean;\n readOnly?: boolean;\n /** Border radius del input. Default: 10 */\n borderRadius?: number | string;\n /** \"outside\" = label arriba del campo (default). \"floating\" = label clásico MUI dentro del borde */\n labelPosition?: LabelPosition;\n /** Tamaño del TextField renderizado. Default: 'small' */\n size?: DatePickerSize;\n /** helperText pasado al TextField (se sobrescribe por el error de validación si hay). */\n helperText?: string;\n /** Error external override. */\n error?: boolean;\n /** sx que se mergea al TextField interno del picker. */\n sx?: SxProps<Theme>;\n className?: string;\n /**\n * Nombre del preset de estilo registrado en `theme.styles.DatePicker`.\n * - `\"default\"` (o ausente) = estilo built-in del paquete.\n * - Cualquier otro string = mergea el preset encima del estilo built-in.\n */\n preset?: string;\n /** Locale para el adaptador dayjs. Default: 'en-gb'. */\n adapterLocale?: string;\n /** Passthrough a slotProps.textField. */\n textFieldProps?: Record<string, any>;\n /** Passthrough completo a slotProps del MuiDatePicker. */\n slotProps?: MuiDatePickerProps['slotProps'];\n}\n\n// ── API pública ──────────────────────────────────────────────────────────\nexport interface DatePickerProps extends BaseDatePickerProps {\n selectedDate: Dayjs | null;\n onDateChange: (date: Dayjs | null) => void;\n}\n\nexport const DatePicker: React.FC<DatePickerProps> = ({\n label,\n selectedDate,\n onDateChange,\n minDate,\n maxDate,\n disabled,\n readOnly,\n borderRadius = FIELD_BORDER_RADIUS,\n labelPosition = 'outside',\n size = 'small',\n helperText,\n error: errorProp,\n sx,\n className,\n preset,\n adapterLocale = 'en-gb',\n textFieldProps,\n slotProps: slotPropsProp,\n ...rest\n}) => {\n const [validationError, setValidationError] = React.useState<DateValidationError | null>(null);\n\n const validationErrorMessage = useMemo(\n () => getDateValidationMessage(validationError),\n [validationError],\n );\n\n const theme = useTheme();\n const presetSx = resolvePreset('DatePicker', preset, theme);\n\n const mergedSx = [\n ...(presetSx ? [presetSx] : [buildDatePickerSx(borderRadius, labelPosition)]),\n ...(Array.isArray(sx) ? sx : sx ? [sx] : []),\n ];\n\n const finalError = !!validationErrorMessage || !!errorProp;\n const finalHelperText = validationErrorMessage || helperText;\n\n return (\n <LocalizationProvider\n dateAdapter={AdapterDayjs}\n adapterLocale={adapterLocale}\n localeText={esES.components.MuiLocalizationProvider.defaultProps.localeText}\n >\n <MuiDatePicker\n label={label}\n value={selectedDate}\n onChange={onDateChange}\n minDate={minDate}\n maxDate={maxDate}\n onError={setValidationError}\n disabled={disabled}\n readOnly={readOnly}\n className={className}\n sx={mergedSx}\n slotProps={{\n ...slotPropsProp,\n textField: {\n fullWidth: true,\n size,\n variant: 'outlined',\n ...(slotPropsProp?.textField as Record<string, any> | undefined),\n ...textFieldProps,\n error: !!finalError,\n helperText: finalHelperText,\n } as any,\n }}\n {...rest}\n />\n </LocalizationProvider>\n );\n};\n\nexport default DatePicker;\n"],"names":["this","e","a","t","dayjs","React","MuiDatePicker"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAC,SAAS,GAAE,GAAE;AAAsD,aAAA,UAAe,EAAE,UAAgB;AAAA,IAA+I,GAAEA,OA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C;AAAA,UACA,OAAO;AAAA,UACP,UAAU;AAAA,UACV;AAAA,UACA;AAAA,UACA,SAAS;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,UACA,IAAI;AAAA,UACJ,WAAW,iCACN,gBADM;AAAA,YAET,WAAW;AAAA,cACT,WAAW;AAAA,cACX;AAAA,cACA,SAAS;AAAA,eACL,+CAAe,YAChB,iBALM;AAAA,cAMT,OAAO,CAAC,CAAC;AAAA,cACT,YAAY;AAAA,YAAA;AAAA,UACd;AAAA,WAEE;AAAA,MAAA;AAAA,IACN;AAAA,EAAA;AAGN;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"DatePicker-D5BH4v1p.js","sources":["../node_modules/dayjs/locale/en-gb.js","../src/components/DatePicker/DatePicker.sx.ts","../src/components/DatePicker/DatePicker.helpers.ts","../src/components/DatePicker/DatePicker.tsx"],"sourcesContent":["!function(e,a){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=a(require(\"dayjs\")):\"function\"==typeof define&&define.amd?define([\"dayjs\"],a):(e=\"undefined\"!=typeof globalThis?globalThis:e||self).dayjs_locale_en_gb=a(e.dayjs)}(this,(function(e){\"use strict\";function a(e){return e&&\"object\"==typeof e&&\"default\"in e?e:{default:e}}var t=a(e),_={name:\"en-gb\",weekdays:\"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday\".split(\"_\"),weekdaysShort:\"Sun_Mon_Tue_Wed_Thu_Fri_Sat\".split(\"_\"),weekdaysMin:\"Su_Mo_Tu_We_Th_Fr_Sa\".split(\"_\"),months:\"January_February_March_April_May_June_July_August_September_October_November_December\".split(\"_\"),monthsShort:\"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec\".split(\"_\"),weekStart:1,yearStart:4,relativeTime:{future:\"in %s\",past:\"%s ago\",s:\"a few seconds\",m:\"a minute\",mm:\"%d minutes\",h:\"an hour\",hh:\"%d hours\",d:\"a day\",dd:\"%d days\",M:\"a month\",MM:\"%d months\",y:\"a year\",yy:\"%d years\"},formats:{LT:\"HH:mm\",LTS:\"HH:mm:ss\",L:\"DD/MM/YYYY\",LL:\"D MMMM YYYY\",LLL:\"D MMMM YYYY HH:mm\",LLLL:\"dddd, D MMMM YYYY HH:mm\"},ordinal:function(e){var a=[\"th\",\"st\",\"nd\",\"rd\"],t=e%100;return\"[\"+e+(a[(t-20)%10]||a[t]||a[0])+\"]\"}};return t.default.locale(_,null,!0),_}));","import type { SxProps, Theme } from '@mui/material';\n\nimport { buildFormFieldSx } from '../_shared/formField.sx';\nimport type { LabelPosition } from './DatePicker';\n\n/**\n * Builder de sx para el DatePicker. Reutiliza `buildFormFieldSx` con\n * `includePickersApi: true` para cubrir tanto la API clásica (MuiInputBase /\n * MuiOutlinedInput) como la nueva (MuiPickersInputBase / MuiPickersOutlinedInput)\n * del DatePicker de MUI X v8.\n */\nexport const buildDatePickerSx = (\n borderRadius: number | string,\n labelPosition: LabelPosition,\n): SxProps<Theme> =>\n buildFormFieldSx({\n borderRadius,\n labelPosition,\n includePickersApi: true,\n });\n","import type { DateValidationError } from '@mui/x-date-pickers/models';\n\n/**\n * Traduce el código de error del DatePicker de MUI X a un mensaje en español.\n * Se usa internamente para poblar `helperText` cuando hay error de validación\n * y el consumer no pasó un mensaje propio.\n */\nexport const getDateValidationMessage = (\n error: DateValidationError | null,\n): string => {\n switch (error) {\n case 'minDate':\n case 'maxDate':\n return 'Fecha fuera del rango permitido';\n case 'invalidDate':\n return 'Formato de fecha inválido';\n case 'disableFuture':\n return 'No se permiten fechas futuras';\n case 'disablePast':\n return 'No se permiten fechas pasadas';\n default:\n return '';\n }\n};\n","import React, { useMemo } from 'react';\nimport type { SxProps, Theme } from '@mui/material';\nimport { useTheme } from '@mui/material/styles';\nimport { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';\nimport { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';\nimport {\n DatePicker as MuiDatePicker,\n type DatePickerProps as MuiDatePickerProps,\n} from '@mui/x-date-pickers/DatePicker';\nimport { DateValidationError } from '@mui/x-date-pickers/models';\nimport { esES } from '@mui/x-date-pickers/locales';\nimport dayjs, { Dayjs } from 'dayjs';\nimport enGbLocale from 'dayjs/locale/en-gb';\n\nimport { buildDatePickerSx } from './DatePicker.sx';\nimport { getDateValidationMessage } from './DatePicker.helpers';\nimport { resolvePreset } from '../_shared/resolvePreset';\nimport { FIELD_BORDER_RADIUS } from '../../theme/tokens';\n\n// Registrar el locale por defecto sin activarlo globalmente. El binding usado\n// (no un side-effect import pelado) evita que el tree-shaking del build de la\n// librería elimine el locale — con solo `import 'dayjs/locale/en-gb'` el chunk\n// publicado lo perdía y los pickers caían al formato 'en' (MM/DD/YYYY).\ndayjs.locale(enGbLocale, undefined, true);\n\n// ── Tipos de dominio ─────────────────────────────────────────────────────\nexport type LabelPosition = 'outside' | 'floating';\nexport type DatePickerSize = 'small' | 'medium';\n\n// ── Props base ───────────────────────────────────────────────────────────\nexport interface BaseDatePickerProps\n extends Omit<MuiDatePickerProps, 'value' | 'onChange' | 'slotProps'> {\n label?: string;\n minDate?: Dayjs;\n maxDate?: Dayjs;\n disabled?: boolean;\n readOnly?: boolean;\n /** Border radius del input. Default: 10 */\n borderRadius?: number | string;\n /** \"outside\" = label arriba del campo (default). \"floating\" = label clásico MUI dentro del borde */\n labelPosition?: LabelPosition;\n /** Tamaño del TextField renderizado. Default: 'small' */\n size?: DatePickerSize;\n /** helperText pasado al TextField (se sobrescribe por el error de validación si hay). */\n helperText?: string;\n /** Error external override. */\n error?: boolean;\n /** sx que se mergea al TextField interno del picker. */\n sx?: SxProps<Theme>;\n className?: string;\n /**\n * Nombre del preset de estilo registrado en `theme.styles.DatePicker`.\n * - `\"default\"` (o ausente) = estilo built-in del paquete.\n * - Cualquier otro string = mergea el preset encima del estilo built-in.\n */\n preset?: string;\n /** Locale para el adaptador dayjs. Default: 'en-gb'. */\n adapterLocale?: string;\n /** Passthrough a slotProps.textField. */\n textFieldProps?: Record<string, any>;\n /** Passthrough completo a slotProps del MuiDatePicker. */\n slotProps?: MuiDatePickerProps['slotProps'];\n}\n\n// ── API pública ──────────────────────────────────────────────────────────\nexport interface DatePickerProps extends BaseDatePickerProps {\n selectedDate: Dayjs | null;\n onDateChange: (date: Dayjs | null) => void;\n}\n\nexport const DatePicker: React.FC<DatePickerProps> = ({\n label,\n selectedDate,\n onDateChange,\n minDate,\n maxDate,\n disabled,\n readOnly,\n borderRadius = FIELD_BORDER_RADIUS,\n labelPosition = 'outside',\n size = 'small',\n helperText,\n error: errorProp,\n sx,\n className,\n preset,\n adapterLocale = 'en-gb',\n textFieldProps,\n slotProps: slotPropsProp,\n ...rest\n}) => {\n const [validationError, setValidationError] = React.useState<DateValidationError | null>(null);\n\n const validationErrorMessage = useMemo(\n () => getDateValidationMessage(validationError),\n [validationError],\n );\n\n const theme = useTheme();\n const presetSx = resolvePreset('DatePicker', preset, theme);\n\n // Built-in primero, preset encima (ver Input): el preset complementa el estilo\n // base del paquete, nunca lo sustituye.\n const mergedSx = [\n buildDatePickerSx(borderRadius, labelPosition),\n ...(presetSx ? [presetSx] : []),\n ...(Array.isArray(sx) ? sx : sx ? [sx] : []),\n ];\n\n const finalError = !!validationErrorMessage || !!errorProp;\n const finalHelperText = validationErrorMessage || helperText;\n\n return (\n <LocalizationProvider\n dateAdapter={AdapterDayjs}\n adapterLocale={adapterLocale}\n localeText={esES.components.MuiLocalizationProvider.defaultProps.localeText}\n >\n <MuiDatePicker\n label={label}\n value={selectedDate}\n onChange={onDateChange}\n minDate={minDate}\n maxDate={maxDate}\n onError={setValidationError}\n disabled={disabled}\n readOnly={readOnly}\n className={className}\n sx={mergedSx}\n slotProps={{\n ...slotPropsProp,\n textField: {\n fullWidth: true,\n size,\n variant: 'outlined',\n ...(slotPropsProp?.textField as Record<string, any> | undefined),\n ...textFieldProps,\n error: !!finalError,\n helperText: finalHelperText,\n } as any,\n }}\n {...rest}\n />\n </LocalizationProvider>\n );\n};\n\nexport default DateP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A0B,CAAC,CAAC;AACjD,QAAM,kBAAkB,0BAA0B;AAElD,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,aAAa;AAAA,MACb;AAAA,MACA,YAAY,KAAK,WAAW,wBAAwB,aAAa;AAAA,MAEjE,UAAA;AAAA,QAACC;AAAAA,QAAA;AAAA,UACC;AAAA,UACA,OAAO;AAAA,UACP,UAAU;AAAA,UACV;AAAA,UACA;AAAA,UACA,SAAS;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,UACA,IAAI;AAAA,UACJ,WAAW,iCACN,gBADM;AAAA,YAET,WAAW;AAAA,cACT,WAAW;AAAA,cACX;AAAA,cACA,SAAS;AAAA,eACL,+CAAe,YAChB,iBALM;AAAA,cAMT,OAAO,CAAC,CAAC;AAAA,cACT,YAAY;AAAA,YAAA;AAAA,UACd;AAAA,WAEE;AAAA,MAAA;AAAA,IACN;AAAA,EAAA;AAGN;","x_google_ignoreList":[0]}
@@ -137,7 +137,8 @@ const DatePicker = (_a) => {
137
137
  const theme = styles.useTheme();
138
138
  const presetSx = resolvePreset.resolvePreset("DatePicker", preset, theme);
139
139
  const mergedSx = [
140
- ...presetSx ? [presetSx] : [buildDatePickerSx(borderRadius, labelPosition)],
140
+ buildDatePickerSx(borderRadius, labelPosition),
141
+ ...presetSx ? [presetSx] : [],
141
142
  ...Array.isArray(sx) ? sx : sx ? [sx] : []
142
143
  ];
143
144
  const finalError = !!validationErrorMessage || !!errorProp;
@@ -177,4 +178,4 @@ const DatePicker = (_a) => {
177
178
  );
178
179
  };
179
180
  exports.DatePicker = DatePicker;
180
- //# sourceMappingURL=DatePicker-CMcQddi1.cjs.map
181
+ //# sourceMappingURL=DatePicker-mz7CYtVw.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker-CMcQddi1.cjs","sources":["../node_modules/dayjs/locale/en-gb.js","../src/components/DatePicker/DatePicker.sx.ts","../src/components/DatePicker/DatePicker.helpers.ts","../src/components/DatePicker/DatePicker.tsx"],"sourcesContent":["!function(e,a){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=a(require(\"dayjs\")):\"function\"==typeof define&&define.amd?define([\"dayjs\"],a):(e=\"undefined\"!=typeof globalThis?globalThis:e||self).dayjs_locale_en_gb=a(e.dayjs)}(this,(function(e){\"use strict\";function a(e){return e&&\"object\"==typeof e&&\"default\"in e?e:{default:e}}var t=a(e),_={name:\"en-gb\",weekdays:\"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday\".split(\"_\"),weekdaysShort:\"Sun_Mon_Tue_Wed_Thu_Fri_Sat\".split(\"_\"),weekdaysMin:\"Su_Mo_Tu_We_Th_Fr_Sa\".split(\"_\"),months:\"January_February_March_April_May_June_July_August_September_October_November_December\".split(\"_\"),monthsShort:\"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec\".split(\"_\"),weekStart:1,yearStart:4,relativeTime:{future:\"in %s\",past:\"%s ago\",s:\"a few seconds\",m:\"a minute\",mm:\"%d minutes\",h:\"an hour\",hh:\"%d hours\",d:\"a day\",dd:\"%d days\",M:\"a month\",MM:\"%d months\",y:\"a year\",yy:\"%d years\"},formats:{LT:\"HH:mm\",LTS:\"HH:mm:ss\",L:\"DD/MM/YYYY\",LL:\"D MMMM YYYY\",LLL:\"D MMMM YYYY HH:mm\",LLLL:\"dddd, D MMMM YYYY HH:mm\"},ordinal:function(e){var a=[\"th\",\"st\",\"nd\",\"rd\"],t=e%100;return\"[\"+e+(a[(t-20)%10]||a[t]||a[0])+\"]\"}};return t.default.locale(_,null,!0),_}));","import type { SxProps, Theme } from '@mui/material';\n\nimport { buildFormFieldSx } from '../_shared/formField.sx';\nimport type { LabelPosition } from './DatePicker';\n\n/**\n * Builder de sx para el DatePicker. Reutiliza `buildFormFieldSx` con\n * `includePickersApi: true` para cubrir tanto la API clásica (MuiInputBase /\n * MuiOutlinedInput) como la nueva (MuiPickersInputBase / MuiPickersOutlinedInput)\n * del DatePicker de MUI X v8.\n */\nexport const buildDatePickerSx = (\n borderRadius: number | string,\n labelPosition: LabelPosition,\n): SxProps<Theme> =>\n buildFormFieldSx({\n borderRadius,\n labelPosition,\n includePickersApi: true,\n });\n","import type { DateValidationError } from '@mui/x-date-pickers/models';\n\n/**\n * Traduce el código de error del DatePicker de MUI X a un mensaje en español.\n * Se usa internamente para poblar `helperText` cuando hay error de validación\n * y el consumer no pasó un mensaje propio.\n */\nexport const getDateValidationMessage = (\n error: DateValidationError | null,\n): string => {\n switch (error) {\n case 'minDate':\n case 'maxDate':\n return 'Fecha fuera del rango permitido';\n case 'invalidDate':\n return 'Formato de fecha inválido';\n case 'disableFuture':\n return 'No se permiten fechas futuras';\n case 'disablePast':\n return 'No se permiten fechas pasadas';\n default:\n return '';\n }\n};\n","import React, { useMemo } from 'react';\nimport type { SxProps, Theme } from '@mui/material';\nimport { useTheme } from '@mui/material/styles';\nimport { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';\nimport { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';\nimport {\n DatePicker as MuiDatePicker,\n type DatePickerProps as MuiDatePickerProps,\n} from '@mui/x-date-pickers/DatePicker';\nimport { DateValidationError } from '@mui/x-date-pickers/models';\nimport { esES } from '@mui/x-date-pickers/locales';\nimport dayjs, { Dayjs } from 'dayjs';\nimport enGbLocale from 'dayjs/locale/en-gb';\n\nimport { buildDatePickerSx } from './DatePicker.sx';\nimport { getDateValidationMessage } from './DatePicker.helpers';\nimport { resolvePreset } from '../_shared/resolvePreset';\nimport { FIELD_BORDER_RADIUS } from '../../theme/tokens';\n\n// Registrar el locale por defecto sin activarlo globalmente. El binding usado\n// (no un side-effect import pelado) evita que el tree-shaking del build de la\n// librería elimine el locale — con solo `import 'dayjs/locale/en-gb'` el chunk\n// publicado lo perdía y los pickers caían al formato 'en' (MM/DD/YYYY).\ndayjs.locale(enGbLocale, undefined, true);\n\n// ── Tipos de dominio ─────────────────────────────────────────────────────\nexport type LabelPosition = 'outside' | 'floating';\nexport type DatePickerSize = 'small' | 'medium';\n\n// ── Props base ───────────────────────────────────────────────────────────\nexport interface BaseDatePickerProps\n extends Omit<MuiDatePickerProps, 'value' | 'onChange' | 'slotProps'> {\n label?: string;\n minDate?: Dayjs;\n maxDate?: Dayjs;\n disabled?: boolean;\n readOnly?: boolean;\n /** Border radius del input. Default: 10 */\n borderRadius?: number | string;\n /** \"outside\" = label arriba del campo (default). \"floating\" = label clásico MUI dentro del borde */\n labelPosition?: LabelPosition;\n /** Tamaño del TextField renderizado. Default: 'small' */\n size?: DatePickerSize;\n /** helperText pasado al TextField (se sobrescribe por el error de validación si hay). */\n helperText?: string;\n /** Error external override. */\n error?: boolean;\n /** sx que se mergea al TextField interno del picker. */\n sx?: SxProps<Theme>;\n className?: string;\n /**\n * Nombre del preset de estilo registrado en `theme.styles.DatePicker`.\n * - `\"default\"` (o ausente) = estilo built-in del paquete.\n * - Cualquier otro string = mergea el preset encima del estilo built-in.\n */\n preset?: string;\n /** Locale para el adaptador dayjs. Default: 'en-gb'. */\n adapterLocale?: string;\n /** Passthrough a slotProps.textField. */\n textFieldProps?: Record<string, any>;\n /** Passthrough completo a slotProps del MuiDatePicker. */\n slotProps?: MuiDatePickerProps['slotProps'];\n}\n\n// ── API pública ──────────────────────────────────────────────────────────\nexport interface DatePickerProps extends BaseDatePickerProps {\n selectedDate: Dayjs | null;\n onDateChange: (date: Dayjs | null) => void;\n}\n\nexport const DatePicker: React.FC<DatePickerProps> = ({\n label,\n selectedDate,\n onDateChange,\n minDate,\n maxDate,\n disabled,\n readOnly,\n borderRadius = FIELD_BORDER_RADIUS,\n labelPosition = 'outside',\n size = 'small',\n helperText,\n error: errorProp,\n sx,\n className,\n preset,\n adapterLocale = 'en-gb',\n textFieldProps,\n slotProps: slotPropsProp,\n ...rest\n}) => {\n const [validationError, setValidationError] = React.useState<DateValidationError | null>(null);\n\n const validationErrorMessage = useMemo(\n () => getDateValidationMessage(validationError),\n [validationError],\n );\n\n const theme = useTheme();\n const presetSx = resolvePreset('DatePicker', preset, theme);\n\n const mergedSx = [\n ...(presetSx ? [presetSx] : [buildDatePickerSx(borderRadius, labelPosition)]),\n ...(Array.isArray(sx) ? sx : sx ? [sx] : []),\n ];\n\n const finalError = !!validationErrorMessage || !!errorProp;\n const finalHelperText = validationErrorMessage || helperText;\n\n return (\n <LocalizationProvider\n dateAdapter={AdapterDayjs}\n adapterLocale={adapterLocale}\n localeText={esES.components.MuiLocalizationProvider.defaultProps.localeText}\n >\n <MuiDatePicker\n label={label}\n value={selectedDate}\n onChange={onDateChange}\n minDate={minDate}\n maxDate={maxDate}\n onError={setValidationError}\n disabled={disabled}\n readOnly={readOnly}\n className={className}\n sx={mergedSx}\n slotProps={{\n ...slotPropsProp,\n textField: {\n fullWidth: true,\n size,\n variant: 'outlined',\n ...(slotPropsProp?.textField as Record<string, any> | undefined),\n ...textFieldProps,\n error: !!finalError,\n helperText: finalHelperText,\n } as any,\n }}\n {...rest}\n />\n </LocalizationProvider>\n );\n};\n\nexport default DatePicker;\n"],"names":["module","this","e","a","t","buildFormFieldSx","dayjs","FIELD_BORDER_RADIUS","useMemo","useTheme","resolvePreset","jsx","LocalizationProvider","AdapterDayjs","esES","MuiDatePicker"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAC,SAAS,GAAE,GAAE;AAAsD,MAAAA,QAAA,UAAe,EAAE,UAAgB;AAAA,IAA+I,GAAEC,OAAM,SAAS,GAAE;AAAc,eAAS,EAAEC,IAAE;AAAC,eAAOA,MAAG,YAAU,OAAOA,MAAG,aAAYA,KAAEA,KAAE,EAAC,SAAQA,GAAC;AAAA,MAAC;AAAC,UAAI,IAAE,EAAE,CAAC,GAAE,IAAE,EAAC,MAAK,SAAQ,UAAS,2DAA2D,MAAM,GAAG,GAAE,eAAc,8BAA8B,MAAM,GAAG,GAAE,aAAY,uBAAuB,MAAM,GAAG,GAAE,QAAO,wFAAwF,MAA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AAA,eACL,+CAAe,YAChB,iBALM;AAAA,cAMT,OAAO,CAAC,CAAC;AAAA,cACT,YAAY;AAAA,YAAA;AAAA,UACd;AAAA,WAEE;AAAA,MAAA;AAAA,IACN;AAAA,EAAA;AAGN;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"DatePicker-mz7CYtVw.cjs","sources":["../node_modules/dayjs/locale/en-gb.js","../src/components/DatePicker/DatePicker.sx.ts","../src/components/DatePicker/DatePicker.helpers.ts","../src/components/DatePicker/DatePicker.tsx"],"sourcesContent":["!function(e,a){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=a(require(\"dayjs\")):\"function\"==typeof define&&define.amd?define([\"dayjs\"],a):(e=\"undefined\"!=typeof globalThis?globalThis:e||self).dayjs_locale_en_gb=a(e.dayjs)}(this,(function(e){\"use strict\";function a(e){return e&&\"object\"==typeof e&&\"default\"in e?e:{default:e}}var t=a(e),_={name:\"en-gb\",weekdays:\"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday\".split(\"_\"),weekdaysShort:\"Sun_Mon_Tue_Wed_Thu_Fri_Sat\".split(\"_\"),weekdaysMin:\"Su_Mo_Tu_We_Th_Fr_Sa\".split(\"_\"),months:\"January_February_March_April_May_June_July_August_September_October_November_December\".split(\"_\"),monthsShort:\"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec\".split(\"_\"),weekStart:1,yearStart:4,relativeTime:{future:\"in %s\",past:\"%s ago\",s:\"a few seconds\",m:\"a minute\",mm:\"%d minutes\",h:\"an hour\",hh:\"%d hours\",d:\"a day\",dd:\"%d days\",M:\"a month\",MM:\"%d months\",y:\"a year\",yy:\"%d years\"},formats:{LT:\"HH:mm\",LTS:\"HH:mm:ss\",L:\"DD/MM/YYYY\",LL:\"D MMMM YYYY\",LLL:\"D MMMM YYYY HH:mm\",LLLL:\"dddd, D MMMM YYYY HH:mm\"},ordinal:function(e){var a=[\"th\",\"st\",\"nd\",\"rd\"],t=e%100;return\"[\"+e+(a[(t-20)%10]||a[t]||a[0])+\"]\"}};return t.default.locale(_,null,!0),_}));","import type { SxProps, Theme } from '@mui/material';\n\nimport { buildFormFieldSx } from '../_shared/formField.sx';\nimport type { LabelPosition } from './DatePicker';\n\n/**\n * Builder de sx para el DatePicker. Reutiliza `buildFormFieldSx` con\n * `includePickersApi: true` para cubrir tanto la API clásica (MuiInputBase /\n * MuiOutlinedInput) como la nueva (MuiPickersInputBase / MuiPickersOutlinedInput)\n * del DatePicker de MUI X v8.\n */\nexport const buildDatePickerSx = (\n borderRadius: number | string,\n labelPosition: LabelPosition,\n): SxProps<Theme> =>\n buildFormFieldSx({\n borderRadius,\n labelPosition,\n includePickersApi: true,\n });\n","import type { DateValidationError } from '@mui/x-date-pickers/models';\n\n/**\n * Traduce el código de error del DatePicker de MUI X a un mensaje en español.\n * Se usa internamente para poblar `helperText` cuando hay error de validación\n * y el consumer no pasó un mensaje propio.\n */\nexport const getDateValidationMessage = (\n error: DateValidationError | null,\n): string => {\n switch (error) {\n case 'minDate':\n case 'maxDate':\n return 'Fecha fuera del rango permitido';\n case 'invalidDate':\n return 'Formato de fecha inválido';\n case 'disableFuture':\n return 'No se permiten fechas futuras';\n case 'disablePast':\n return 'No se permiten fechas pasadas';\n default:\n return '';\n }\n};\n","import React, { useMemo } from 'react';\nimport type { SxProps, Theme } from '@mui/material';\nimport { useTheme } from '@mui/material/styles';\nimport { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';\nimport { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';\nimport {\n DatePicker as MuiDatePicker,\n type DatePickerProps as MuiDatePickerProps,\n} from '@mui/x-date-pickers/DatePicker';\nimport { DateValidationError } from '@mui/x-date-pickers/models';\nimport { esES } from '@mui/x-date-pickers/locales';\nimport dayjs, { Dayjs } from 'dayjs';\nimport enGbLocale from 'dayjs/locale/en-gb';\n\nimport { buildDatePickerSx } from './DatePicker.sx';\nimport { getDateValidationMessage } from './DatePicker.helpers';\nimport { resolvePreset } from '../_shared/resolvePreset';\nimport { FIELD_BORDER_RADIUS } from '../../theme/tokens';\n\n// Registrar el locale por defecto sin activarlo globalmente. El binding usado\n// (no un side-effect import pelado) evita que el tree-shaking del build de la\n// librería elimine el locale — con solo `import 'dayjs/locale/en-gb'` el chunk\n// publicado lo perdía y los pickers caían al formato 'en' (MM/DD/YYYY).\ndayjs.locale(enGbLocale, undefined, true);\n\n// ── Tipos de dominio ─────────────────────────────────────────────────────\nexport type LabelPosition = 'outside' | 'floating';\nexport type DatePickerSize = 'small' | 'medium';\n\n// ── Props base ───────────────────────────────────────────────────────────\nexport interface BaseDatePickerProps\n extends Omit<MuiDatePickerProps, 'value' | 'onChange' | 'slotProps'> {\n label?: string;\n minDate?: Dayjs;\n maxDate?: Dayjs;\n disabled?: boolean;\n readOnly?: boolean;\n /** Border radius del input. Default: 10 */\n borderRadius?: number | string;\n /** \"outside\" = label arriba del campo (default). \"floating\" = label clásico MUI dentro del borde */\n labelPosition?: LabelPosition;\n /** Tamaño del TextField renderizado. Default: 'small' */\n size?: DatePickerSize;\n /** helperText pasado al TextField (se sobrescribe por el error de validación si hay). */\n helperText?: string;\n /** Error external override. */\n error?: boolean;\n /** sx que se mergea al TextField interno del picker. */\n sx?: SxProps<Theme>;\n className?: string;\n /**\n * Nombre del preset de estilo registrado en `theme.styles.DatePicker`.\n * - `\"default\"` (o ausente) = estilo built-in del paquete.\n * - Cualquier otro string = mergea el preset encima del estilo built-in.\n */\n preset?: string;\n /** Locale para el adaptador dayjs. Default: 'en-gb'. */\n adapterLocale?: string;\n /** Passthrough a slotProps.textField. */\n textFieldProps?: Record<string, any>;\n /** Passthrough completo a slotProps del MuiDatePicker. */\n slotProps?: MuiDatePickerProps['slotProps'];\n}\n\n// ── API pública ──────────────────────────────────────────────────────────\nexport interface DatePickerProps extends BaseDatePickerProps {\n selectedDate: Dayjs | null;\n onDateChange: (date: Dayjs | null) => void;\n}\n\nexport const DatePicker: React.FC<DatePickerProps> = ({\n label,\n selectedDate,\n onDateChange,\n minDate,\n maxDate,\n disabled,\n readOnly,\n borderRadius = FIELD_BORDER_RADIUS,\n labelPosition = 'outside',\n size = 'small',\n helperText,\n error: errorProp,\n sx,\n className,\n preset,\n adapterLocale = 'en-gb',\n textFieldProps,\n slotProps: slotPropsProp,\n ...rest\n}) => {\n const [validationError, setValidationError] = React.useState<DateValidationError | null>(null);\n\n const validationErrorMessage = useMemo(\n () => getDateValidationMessage(validationError),\n [validationError],\n );\n\n const theme = useTheme();\n const presetSx = resolvePreset('DatePicker', preset, theme);\n\n // Built-in primero, preset encima (ver Input): el preset complementa el estilo\n // base del paquete, nunca lo sustituye.\n const mergedSx = [\n buildDatePickerSx(borderRadius, labelPosition),\n ...(presetSx ? [presetSx] : []),\n ...(Array.isArray(sx) ? sx : sx ? [sx] : []),\n ];\n\n const finalError = !!validationErrorMessage || !!errorProp;\n const finalHelperText = validationErrorMessage || helperText;\n\n return (\n <LocalizationProvider\n dateAdapter={AdapterDayjs}\n adapterLocale={adapterLocale}\n localeText={esES.components.MuiLocalizationProvider.defaultProps.localeText}\n >\n <MuiDatePicker\n label={label}\n value={selectedDate}\n onChange={onDateChange}\n minDate={minDate}\n maxDate={maxDate}\n onError={setValidationError}\n disabled={disabled}\n readOnly={readOnly}\n className={className}\n sx={mergedSx}\n slotProps={{\n ...slotPropsProp,\n textField: {\n fullWidth: true,\n size,\n variant: 'outlined',\n ...(slotPropsProp?.textField as Record<string, any> | undefined),\n ...textFieldProps,\n error: !!finalError,\n helperText: finalHelperText,\n } as any,\n }}\n {...rest}\n />\n </LocalizationProvider>\n );\n};\n\nexport default DatePicker;\n"],"names":["module","this","e","a","t","buildFormFieldSx","dayjs","FIELD_BORDER_RADIUS","useMemo","useTheme","resolvePreset","jsx","LocalizationProvider","AdapterDayjs","esES","MuiDatePicker"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAC,SAAS,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AAAAA,IAAA;AAAA,MACC,aAAaC,aAAAA;AAAAA,MACb;AAAA,MACA,YAAYC,QAAAA,KAAK,WAAW,wBAAwB,aAAa;AAAA,MAEjE,UAAAH,2BAAAA;AAAAA,QAACI,aAAAA;AAAAA,QAAA;AAAA,UACC;AAAA,UACA,OAAO;AAAA,UACP,UAAU;AAAA,UACV;AAAA,UACA;AAAA,UACA,SAAS;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,UACA,IAAI;AAAA,UACJ,WAAW,iCACN,gBADM;AAAA,YAET,WAAW;AAAA,cACT,WAAW;AAAA,cACX;AAAA,cACA,SAAS;AAAA,eACL,+CAAe,YAChB,iBALM;AAAA,cAMT,OAAO,CAAC,CAAC;AAAA,cACT,YAAY;AAAA,YAAA;AAAA,UACd;AAAA,WAEE;AAAA,MAAA;AAAA,IACN;AAAA,EAAA;AAGN;;","x_google_ignoreList":[0]}
@@ -96,6 +96,7 @@ const DateTimePicker = (props) => {
96
96
  ampm = false,
97
97
  viewRenderers,
98
98
  timeSteps,
99
+ views,
99
100
  textFieldProps,
100
101
  slotProps: slotPropsProp
101
102
  } = _a, rest = __objRest(_a, [
@@ -122,6 +123,7 @@ const DateTimePicker = (props) => {
122
123
  "ampm",
123
124
  "viewRenderers",
124
125
  "timeSteps",
126
+ "views",
125
127
  "textFieldProps",
126
128
  "slotProps"
127
129
  ]);
@@ -137,7 +139,8 @@ const DateTimePicker = (props) => {
137
139
  const theme = useTheme();
138
140
  const presetSx = resolvePreset("DateTimePicker", preset, theme);
139
141
  const mergedSx = [
140
- ...presetSx ? [presetSx] : [buildDateTimePickerSx(borderRadius, labelPosition)],
142
+ buildDateTimePickerSx(borderRadius, labelPosition),
143
+ ...presetSx ? [presetSx] : [],
141
144
  ...Array.isArray(sx) ? sx : sx ? [sx] : []
142
145
  ];
143
146
  const renderPicker = (value, onChange, onBlur, inputRef, rhfError, rhfHelperText) => {
@@ -167,6 +170,7 @@ const DateTimePicker = (props) => {
167
170
  ampm,
168
171
  viewRenderers,
169
172
  timeSteps,
173
+ views,
170
174
  sx: mergedSx,
171
175
  slotProps: __spreadProps(__spreadValues({}, slotPropsProp), {
172
176
  textField: __spreadProps(__spreadValues(__spreadValues({
@@ -219,4 +223,4 @@ const DateTimePicker = (props) => {
219
223
  export {
220
224
  DateTimePicker as D
221
225
  };
222
- //# sourceMappingURL=DateTimePicker-LeaE716a.js.map
226
+ //# sourceMappingURL=DateTimePicker-ZCf0Wh4r.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DateTimePicker-ZCf0Wh4r.js","sources":["../src/components/DateTimePicker/DateTimePicker.sx.ts","../src/components/DateTimePicker/DateTimePicker.helpers.ts","../src/components/DateTimePicker/DateTimePicker.tsx"],"sourcesContent":["import type { SxProps, Theme } from '@mui/material';\n\nimport { buildFormFieldSx } from '../_shared/formField.sx';\nimport type { LabelPosition } from './DateTimePicker';\n\n/**\n * Builder de sx para el DateTimePicker. Mismo patrón que DatePicker.\n * Usa `includePickersApi: true` para soportar la API nueva de MUI X v8.\n */\nexport const buildDateTimePickerSx = (\n borderRadius: number | string,\n labelPosition: LabelPosition,\n): SxProps<Theme> =>\n buildFormFieldSx({\n borderRadius,\n labelPosition,\n includePickersApi: true,\n });\n","import type { DateTimeValidationError } from '@mui/x-date-pickers/models';\n\n/**\n * Traduce el error del DateTimePicker a un mensaje en español. Se usa\n * internamente para poblar `helperText` cuando hay error de validación.\n * Cubre tanto errores de fecha (`minDate`, `maxDate`, etc.) como de hora\n * (`minTime`, `maxTime`, `minutesStep`, etc.).\n */\nexport const getDateTimeValidationMessage = (\n error: DateTimeValidationError | null,\n): string => {\n switch (error) {\n case 'minDate':\n case 'maxDate':\n case 'minTime':\n case 'maxTime':\n return 'Fecha/hora fuera del rango permitido';\n case 'invalidDate':\n return 'Formato de fecha/hora inválido';\n case 'disableFuture':\n return 'No se permiten fechas/horas futuras';\n case 'disablePast':\n return 'No se permiten fechas/horas pasadas';\n case 'minutesStep':\n return 'Minutos no válidos para el paso configurado';\n default:\n return '';\n }\n};\n\n/**\n * Construye el `localeText` que MUI acepta para overridear los labels de los\n * botones del popover (Cancel / OK / Clear).\n */\nexport const buildLocaleText = (\n clearButtonText?: string,\n cancelButtonText?: string,\n acceptButtonText?: string,\n): Record<string, string> => {\n const text: Record<string, string> = {};\n if (clearButtonText) text.clearButtonLabel = clearButtonText;\n if (cancelButtonText) text.cancelButtonLabel = cancelButtonText;\n if (acceptButtonText) text.okButtonLabel = acceptButtonText;\n return text;\n};\n","import React, { useMemo } from 'react';\nimport type { SxProps, Theme } from '@mui/material';\nimport { useTheme } from '@mui/material/styles';\nimport { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs';\nimport { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider';\nimport {\n DateTimePicker as MuiDateTimePicker,\n type DateTimePickerProps as MuiDateTimePickerProps,\n} from '@mui/x-date-pickers/DateTimePicker';\nimport type { DateTimeValidationError } from '@mui/x-date-pickers/models';\nimport { esES } from '@mui/x-date-pickers/locales';\nimport { Dayjs } from 'dayjs';\nimport { Controller, type Control, type RegisterOptions } from 'react-hook-form';\n\nimport { buildDateTimePickerSx } from './DateTimePicker.sx';\nimport {\n buildLocaleText,\n getDateTimeValidationMessage,\n} from './DateTimePicker.helpers';\nimport { resolvePreset } from '../_shared/resolvePreset';\nimport { FIELD_BORDER_RADIUS } from '../../theme/tokens';\n\n// ── Tipos de dominio ─────────────────────────────────────────────────────\nexport type LabelPosition = 'outside' | 'floating';\nexport type DateTimePickerSize = 'small' | 'medium';\n\n// ── Props base ───────────────────────────────────────────────────────────\nexport interface BaseDateTimePickerProps\n extends Omit<MuiDateTimePickerProps, 'value' | 'onChange' | 'slotProps' | 'format'> {\n label?: string;\n minDateTime?: Dayjs;\n maxDateTime?: Dayjs;\n disabled?: boolean;\n readOnly?: boolean;\n /** Formato de la fecha/hora. Default: 'DD/MM/YYYY HH:mm'. */\n inputFormat?: string;\n /** Border radius del input. Default: 10. */\n borderRadius?: number | string;\n /** \"outside\" (default) o \"floating\". */\n labelPosition?: LabelPosition;\n /** Tamaño del TextField. Default: 'small'. */\n size?: DateTimePickerSize;\n helperText?: string;\n error?: boolean;\n sx?: SxProps<Theme>;\n className?: string;\n /**\n * Nombre del preset de estilo registrado en `theme.styles.DateTimePicker`.\n * - `\"default\"` (o ausente) = estilo built-in del paquete.\n * - Cualquier otro string = mergea el preset encima del estilo built-in.\n */\n preset?: string;\n /** Locale del adaptador dayjs. */\n adapterLocale?: string;\n /** Textos de los botones del popover. */\n clearButtonText?: string;\n cancelButtonText?: string;\n acceptButtonText?: string;\n minutesStep?: number;\n minTime?: Dayjs;\n /** Si es true usa formato 12h (AM/PM), false = 24h. Default: false. */\n ampm?: boolean;\n viewRenderers?: MuiDateTimePickerProps['viewRenderers'];\n timeSteps?: MuiDateTimePickerProps['timeSteps'];\n /**\n * Vistas a mostrar en el popover. Default: todas (year, month, day, hours, minutes).\n * Ej: `['hours']` solo permite elegir la hora. `['hours','minutes']` oculta el calendar.\n *\n * Va declarado explícito (y no se hereda del `Omit<MuiDateTimePickerProps>`)\n * porque se desestructura del `props` y se pasa a mano al picker: si sólo\n * viviera en el tipo base caería en el `...rest` y quedaría duplicado.\n */\n views?: MuiDateTimePickerProps['views'];\n textFieldProps?: Record<string, any>;\n /** Passthrough completo a slotProps del MuiDateTimePicker. */\n slotProps?: MuiDateTimePickerProps['slotProps'];\n}\n\n// ── Variantes discriminadas (RHF vs controlado) ──────────────────────────\nexport interface RHFDateTimePickerProps extends BaseDateTimePickerProps {\n name: string;\n // `any` plano (no `Control<any>`): RHF tipa `Control<T>` con generics en\n // posiciones tanto contravariantes como covariantes (ej. `_subjects.state`).\n // Cuando el componente o su uso involucra generics adicionales, TS se\n // confunde narroweando el discriminated union y `Control<any>` no logra\n // absorber `Control<MyForm>` en la comparación estructural profunda. El\n // `any` plano elimina ese ruido. RHF adentro sigue teniendo sus tipos\n // fuertes — solo degradamos la superficie del prop del componente.\n control: any;\n validation?: RegisterOptions;\n /**\n * Side-effect que corre después de que RHF actualiza el form state.\n * Útil para cascadas entre campos. NO reemplaza al handler de RHF.\n */\n onValueChange?: (dateTime: Dayjs | null) => void;\n selectedDateTime?: never;\n onDateTimeChange?: never;\n}\n\nexport interface ControlledDateTimePickerProps extends BaseDateTimePickerProps {\n name?: string;\n control?: never;\n validation?: never;\n selectedDateTime: Dayjs | null;\n onDateTimeChange: (dateTime: Dayjs | null) => void;\n}\n\n// ── API pública final ────────────────────────────────────────────────────\nexport type DateTimePickerProps =\n | RHFDateTimePickerProps\n | ControlledDateTimePickerProps;\n\nexport const DateTimePicker: React.FC<DateTimePickerProps> = (props) => {\n const {\n label,\n minDateTime,\n maxDateTime,\n disabled,\n readOnly,\n inputFormat,\n borderRadius = FIELD_BORDER_RADIUS,\n labelPosition = 'outside',\n size = 'small',\n helperText,\n error: errorProp,\n sx,\n className,\n preset,\n adapterLocale,\n clearButtonText,\n cancelButtonText,\n acceptButtonText,\n minutesStep,\n minTime,\n ampm = false,\n viewRenderers,\n timeSteps,\n views,\n textFieldProps,\n slotProps: slotPropsProp,\n ...rest\n } = props as ControlledDateTimePickerProps & {\n control?: Control<any>;\n validation?: RegisterOptions;\n };\n\n const [validationError, setValidationError] = React.useState<DateTimeValidationError | null>(null);\n\n const validationErrorMessage = useMemo(\n () => getDateTimeValidationMessage(validationError),\n [validationError],\n );\n\n const customLocaleText = useMemo(\n () => buildLocaleText(clearButtonText, cancelButtonText, acceptButtonText),\n [clearButtonText, cancelButtonText, acceptButtonText],\n );\n\n const theme = useTheme();\n const presetSx = resolvePreset('DateTimePicker', preset, theme);\n\n // Built-in primero, preset encima (ver Input).\n const mergedSx = [\n buildDateTimePickerSx(borderRadius, labelPosition),\n ...(presetSx ? [presetSx] : []),\n ...(Array.isArray(sx) ? sx : sx ? [sx] : []),\n ];\n\n const renderPicker = (\n value: Dayjs | null,\n onChange: (date: Dayjs | null) => void,\n onBlur?: () => void,\n inputRef?: React.Ref<any>,\n rhfError?: boolean,\n rhfHelperText?: string,\n ) => {\n const finalError = rhfError || !!validationErrorMessage || !!errorProp;\n const finalHelperText = rhfHelperText || validationErrorMessage || helperText;\n\n return (\n <LocalizationProvider\n dateAdapter={AdapterDayjs}\n adapterLocale={adapterLocale}\n localeText={esES.components.MuiLocalizationProvider.defaultProps.localeText}\n >\n <MuiDateTimePicker\n className={className}\n label={label}\n value={value}\n onChange={onChange}\n onError={setValidationError}\n minDateTime={minDateTime}\n maxDateTime={maxDateTime}\n minutesStep={minutesStep}\n disabled={disabled}\n readOnly={readOnly}\n minTime={minTime}\n format={inputFormat ?? 'DD/MM/YYYY HH:mm'}\n ampm={ampm}\n viewRenderers={viewRenderers}\n timeSteps={timeSteps}\n views={views}\n sx={mergedSx}\n slotProps={{\n ...slotPropsProp,\n textField: {\n fullWidth: true,\n size,\n variant: 'outlined',\n // Consumer overrides visuales / de comportamiento opcionales.\n ...(slotPropsProp?.textField as Record<string, any> | undefined),\n ...textFieldProps,\n // Props críticas al final: ganan al consumer para no romper la\n // integración con RHF ni desactivar el visual de error.\n onBlur,\n inputRef,\n error: !!finalError,\n helperText: finalHelperText,\n } as any,\n }}\n localeText={customLocaleText}\n {...rest}\n />\n </LocalizationProvider>\n );\n };\n\n if ('control' in props && props.control) {\n const { name, control, validation, onValueChange } = props as RHFDateTimePickerProps;\n return (\n <Controller\n name={name}\n control={control}\n rules={validation}\n render={({ field, fieldState: { error: fieldError } }) =>\n renderPicker(\n field.value ?? null,\n (next) => {\n field.onChange(next);\n onValueChange?.(next);\n },\n field.onBlur,\n field.ref,\n !!fieldError,\n fieldError?.message,\n )\n }\n />\n );\n }\n\n const { selectedDateTime, onDateTimeChange } = props as ControlledDateTimePickerProps;\n return renderPicker(selectedDateTime, onDateTimeChange);\n};\n\nexport default DateTimePicker;\n"],"names":["React","MuiDateTimePicker","_a"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASO,MAAM,wBAAwB,CACnC,cACA,kBA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AAAA,gBACT,YAAY;AAAA,cAAA;AAAA,YACd;AAAA,YAEF,YAAY;AAAA,aACR;AAAA,QAAA;AAAA,MACN;AAAA,IAAA;AAAA,EAGN;AAEA,MAAI,aAAa,SAAS,MAAM,SAAS;AACvC,UAAM,EAAE,MAAM,SAAS,YAAY,kBAAkB;AACrD,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA,OAAO;AAAA,QACP,QAAQ,CAAC,EAAE,OAAO,YAAY,EAAE,OAAO,WAAA,EAAW;;AAChD;AAAA,aACEC,MAAA,MAAM,UAAN,OAAAA,MAAe;AAAA,YACf,CAAC,SAAS;AACR,oBAAM,SAAS,IAAI;AACnB,6DAAgB;AAAA,YAClB;AAAA,YACA,MAAM;AAAA,YACN,MAAM;AAAA,YACN,CAAC,CAAC;AAAA,YACF,yCAAY;AAAA,UAAA;AAAA;AAAA,MACd;AAAA,IAAA;AAAA,EAIR;AAEA,QAAM,EAAE,kBAAkB,iBAAA,IAAqB;AAC/C,SAAO,aAAa,kBAAkB,gBAAgB;AACxD;"}
@@ -97,6 +97,7 @@ const DateTimePicker = (props) => {
97
97
  ampm = false,
98
98
  viewRenderers,
99
99
  timeSteps,
100
+ views,
100
101
  textFieldProps,
101
102
  slotProps: slotPropsProp
102
103
  } = _a, rest = __objRest(_a, [
@@ -123,6 +124,7 @@ const DateTimePicker = (props) => {
123
124
  "ampm",
124
125
  "viewRenderers",
125
126
  "timeSteps",
127
+ "views",
126
128
  "textFieldProps",
127
129
  "slotProps"
128
130
  ]);
@@ -138,7 +140,8 @@ const DateTimePicker = (props) => {
138
140
  const theme = styles.useTheme();
139
141
  const presetSx = resolvePreset.resolvePreset("DateTimePicker", preset, theme);
140
142
  const mergedSx = [
141
- ...presetSx ? [presetSx] : [buildDateTimePickerSx(borderRadius, labelPosition)],
143
+ buildDateTimePickerSx(borderRadius, labelPosition),
144
+ ...presetSx ? [presetSx] : [],
142
145
  ...Array.isArray(sx) ? sx : sx ? [sx] : []
143
146
  ];
144
147
  const renderPicker = (value, onChange, onBlur, inputRef, rhfError, rhfHelperText) => {
@@ -168,6 +171,7 @@ const DateTimePicker = (props) => {
168
171
  ampm,
169
172
  viewRenderers,
170
173
  timeSteps,
174
+ views,
171
175
  sx: mergedSx,
172
176
  slotProps: __spreadProps(__spreadValues({}, slotPropsProp), {
173
177
  textField: __spreadProps(__spreadValues(__spreadValues({
@@ -218,4 +222,4 @@ const DateTimePicker = (props) => {
218
222
  return renderPicker(selectedDateTime, onDateTimeChange);
219
223
  };
220
224
  exports.DateTimePicker = DateTimePicker;
221
- //# sourceMappingURL=DateTimePicker-BVJGq1A0.cjs.map
225
+ //# sourceMappingURL=DateTimePicker-ejQDpjgX.cjs.map