@rubenpazch/date-input 2.0.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,41 @@
1
1
  # DateInput
2
2
 
3
3
  Generated component package.
4
+
5
+ <!-- catalogo:inicio (generado por pnpm catalogo, no editar) -->
6
+
7
+ Campo de fecha con formato local, mínimo/máximo, ayuda y error.
8
+
9
+ - **Usar cuando:** Ingresar una fecha escribiéndola (fecha de nacimiento, fecha de documento).
10
+ - **Evitar cuando:** Elegir en un calendario visual: usa DatePicker.
11
+
12
+ Se recomienda instalar el paquete completo `@rubenpazch/ui` (incluye este). Por separado:
13
+
14
+ ```bash
15
+ npm install @rubenpazch/date-input
16
+ ```
17
+
18
+ ## DateInput
19
+
20
+ Campo de fecha con calendario desplegable. Se escribe en el formato del idioma
21
+ (DD/MM/AAAA en español) y devuelve siempre ISO `AAAA-MM-DD`, en hora local.
22
+
23
+ | Prop | Tipo | Req. | Por defecto | Descripción |
24
+ | ------------- | -------------------------- | ---- | ----------- | ----------------------------------------------------------------------- |
25
+ | `onChange` | `(date: string) => void` | sí | | Recibe la fecha en ISO `AAAA-MM-DD` (o "" al limpiar). |
26
+ | `value` | `string` | sí | | Fecha en formato ISO `AAAA-MM-DD`, o cadena vacía. |
27
+ | `className` | `string` | | `` | Clase extra para el contenedor. |
28
+ | `disabled` | `boolean` | | `false` | Campo deshabilitado. |
29
+ | `error` | `string` | | | Mensaje de error; marca el campo como inválido. |
30
+ | `hint` | `string` | | | Texto de ayuda. |
31
+ | `id` | `string` | | | id del input; si no se pasa se genera uno (la etiqueta se asocia sola). |
32
+ | `label` | `string` | | | Etiqueta visible. |
33
+ | `labels` | `Partial<DateInputLabels>` | | | Textos del calendario; por defecto en el idioma de `locale`. |
34
+ | `locale` | `string` | | `es` | Idioma: `es` (por defecto, día/mes) o `en` (mes/día). |
35
+ | `maxDate` | `string` | | | Fecha máxima seleccionable (ISO). |
36
+ | `minDate` | `string` | | | Fecha mínima seleccionable (ISO). |
37
+ | `name` | `string` | | | name del input (formularios nativos, react-hook-form…). |
38
+ | `placeholder` | `string` | | | Por defecto el formato del idioma: "DD/MM/AAAA" en español. |
39
+ | `required` | `boolean` | | `false` | Campo obligatorio. |
40
+
41
+ <!-- catalogo:fin -->
@@ -1,18 +1,49 @@
1
1
  import React from "react";
2
+ /** Textos del calendario (accesibilidad y botones). */
3
+ export interface DateInputLabels {
4
+ openCalendar: string;
5
+ previousMonth: string;
6
+ nextMonth: string;
7
+ today: string;
8
+ clear: string;
9
+ calendar: string;
10
+ }
2
11
  export interface DateInputProps {
12
+ /** id del input; si no se pasa se genera uno (la etiqueta se asocia sola). */
13
+ id?: string;
14
+ /** name del input (formularios nativos, react-hook-form…). */
15
+ name?: string;
16
+ /** Etiqueta visible. */
3
17
  label?: string;
18
+ /** Fecha en formato ISO `AAAA-MM-DD`, o cadena vacía. */
4
19
  value: string;
20
+ /** Recibe la fecha en ISO `AAAA-MM-DD` (o "" al limpiar). */
5
21
  onChange: (date: string) => void;
22
+ /** Por defecto el formato del idioma: "DD/MM/AAAA" en español. */
6
23
  placeholder?: string;
24
+ /** Mensaje de error; marca el campo como inválido. */
7
25
  error?: string;
26
+ /** Campo obligatorio. */
8
27
  required?: boolean;
28
+ /** Campo deshabilitado. */
9
29
  disabled?: boolean;
30
+ /** Fecha mínima seleccionable (ISO). */
10
31
  minDate?: string;
32
+ /** Fecha máxima seleccionable (ISO). */
11
33
  maxDate?: string;
34
+ /** Clase extra para el contenedor. */
12
35
  className?: string;
36
+ /** Texto de ayuda. */
13
37
  hint?: string;
38
+ /** Idioma: `es` (por defecto, día/mes) o `en` (mes/día). */
14
39
  locale?: string;
40
+ /** Textos del calendario; por defecto en el idioma de `locale`. */
41
+ labels?: Partial<DateInputLabels>;
15
42
  }
16
- declare const DateInput: React.FC<DateInputProps>;
43
+ /**
44
+ * Campo de fecha con calendario desplegable. Se escribe en el formato del idioma
45
+ * (DD/MM/AAAA en español) y devuelve siempre ISO `AAAA-MM-DD`, en hora local.
46
+ */
47
+ declare const DateInput: React.ForwardRefExoticComponent<DateInputProps & React.RefAttributes<HTMLInputElement>>;
17
48
  export default DateInput;
18
49
  //# sourceMappingURL=DateInput.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../src/DateInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAM3D,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,QAAA,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAwXvC,CAAC;AAEF,eAAe,SAAS,CAAC"}
1
+ {"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../src/DateInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAkB3D,uDAAuD;AACvD,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;CAClB;AAuBD,M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