@sfperusacdev/sf-ui 0.1.21 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/sf-ui.css +1 -1
- package/dist/sf-ui.js +418 -382
- package/dist/sf-ui.js.map +1 -1
- package/dist/sf-ui.umd.cjs +7 -7
- package/dist/sf-ui.umd.cjs.map +1 -1
- package/dist/types/src/components/inputs/Input.d.ts +5 -1
- package/dist/types/src/components/range-inputs/DateRangeFields.d.ts +37 -0
- package/dist/types/src/components/range-inputs/index.d.ts +2 -0
- package/package.json +1 -1
|
@@ -11,11 +11,15 @@ type InputProps<TFormValues extends FieldValues> = {
|
|
|
11
11
|
className?: string;
|
|
12
12
|
placeholder?: string;
|
|
13
13
|
readOnly?: boolean;
|
|
14
|
+
/** límites nativos para type="number" (y step opcional) */
|
|
15
|
+
min?: number | string;
|
|
16
|
+
max?: number | string;
|
|
17
|
+
step?: number | string;
|
|
14
18
|
onChange?: (value: string) => void;
|
|
15
19
|
icon?: IconType;
|
|
16
20
|
small?: boolean;
|
|
17
21
|
onIconClick?: () => Promise<void> | void;
|
|
18
22
|
onRefresh?: () => Promise<void> | void;
|
|
19
23
|
};
|
|
20
|
-
export declare const Input: <TFormValues extends FieldValues>({ form, name, label, info, required, type, className, placeholder, readOnly, onChange, icon, small, onIconClick, onRefresh, }: InputProps<TFormValues>) => React.JSX.Element;
|
|
24
|
+
export declare const Input: <TFormValues extends FieldValues>({ form, name, label, info, required, type, className, placeholder, readOnly, min, max, step, onChange, icon, small, onIconClick, onRefresh, }: InputProps<TFormValues>) => React.JSX.Element;
|
|
21
25
|
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { FieldValues, Path, UseFormReturn } from 'react-hook-form';
|
|
2
|
+
export type DateRangeAdjustEnd = "start" | "month-end" | "none";
|
|
3
|
+
type DateRangeFieldsProps<TFormValues extends FieldValues> = {
|
|
4
|
+
form: UseFormReturn<TFormValues>;
|
|
5
|
+
startName: Path<TFormValues>;
|
|
6
|
+
endName: Path<TFormValues>;
|
|
7
|
+
startLabel?: string;
|
|
8
|
+
endLabel?: string;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
/** por defecto hereda `required`; útil para rangos con fin opcional */
|
|
11
|
+
endRequired?: boolean;
|
|
12
|
+
small?: boolean;
|
|
13
|
+
readOnlyEnd?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Qué hacer cuando el fin queda antes del inicio:
|
|
16
|
+
* - "start": el fin se iguala al inicio (default)
|
|
17
|
+
* - "month-end": el fin salta al último día del mes del inicio (contratos)
|
|
18
|
+
* - "none": no autocorrige (el `min` nativo igual limita el calendario)
|
|
19
|
+
*/
|
|
20
|
+
adjustEnd?: DateRangeAdjustEnd;
|
|
21
|
+
/** notifica la autocorrección (para que el consumidor muestre su toast) */
|
|
22
|
+
onEndAdjusted?: (nuevaFecha: string) => void;
|
|
23
|
+
className?: string;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Par de fechas Desde/Hasta ligado a DOS campos planos del formulario
|
|
27
|
+
* (p.ej. `fecha_inicio` / `fecha_fin` de un entity), cada uno con su label.
|
|
28
|
+
* El calendario del fin no permite fechas anteriores al inicio (min nativo)
|
|
29
|
+
* y, si igual queda un rango invertido (tipeo manual, cambio del inicio),
|
|
30
|
+
* el fin se autocorrige según `adjustEnd`.
|
|
31
|
+
*
|
|
32
|
+
* Diferencia con `DateRangeInput`: aquel es UN solo campo cuyo valor es un
|
|
33
|
+
* objeto `{start, end}` (con soporte UTC) — ideal para filtros; este mapea
|
|
34
|
+
* directo a columnas del entity, que es el caso de los mantenimientos.
|
|
35
|
+
*/
|
|
36
|
+
export declare const DateRangeFields: <TFormValues extends FieldValues>({ form, startName, endName, startLabel, endLabel, required, endRequired, small, readOnlyEnd, adjustEnd, onEndAdjusted, className, }: DateRangeFieldsProps<TFormValues>) => import("react").JSX.Element;
|
|
37
|
+
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { DateRangeInput } from './DateRangeInput';
|
|
2
2
|
export type { DateRangeInputProps } from './DateRangeInput';
|
|
3
|
+
export { DateRangeFields } from './DateRangeFields';
|
|
4
|
+
export type { DateRangeAdjustEnd } from './DateRangeFields';
|
|
3
5
|
export { DateRangeUtcInput } from './DateRangeUtcInput';
|
|
4
6
|
export { TimeRangeInput } from './TimeRangeInput';
|
|
5
7
|
export type { TimeRangeInputProps } from './TimeRangeInput';
|
package/package.json
CHANGED