@sfperusacdev/sf-ui 0.1.20 → 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.
@@ -0,0 +1,21 @@
1
+ import { ReactNode } from 'react';
2
+ export type TramoCardTipo = "ida" | "retorno";
3
+ type TramoCardProps = {
4
+ tipo: TramoCardTipo;
5
+ /** Hora del tramo (se muestra junto al título, tabular) */
6
+ hora?: string;
7
+ /** Cupos disponibles (capacidad de la unidad); se oculta si no hay dato */
8
+ cupos?: number | null;
9
+ /** Muestra el sello verde "Unidad apta" bajo el contenido */
10
+ apto?: boolean;
11
+ /** Texto del sello (default "Unidad apta") */
12
+ aptoLabel?: string;
13
+ children: ReactNode;
14
+ };
15
+ /**
16
+ * Tarjeta de tramo Ida/Retorno del wizard de programación (mockup transporte):
17
+ * header gris con icono direccional, título, hora y cupos; cuerpo libre.
18
+ * Estilos en sf-dashboard.css — sin clases arbitrarias de Tailwind.
19
+ */
20
+ export declare const TramoCard: ({ tipo, hora, cupos, apto, aptoLabel, children, }: TramoCardProps) => import("react").JSX.Element;
21
+ export {};
@@ -1,5 +1,7 @@
1
1
  export { Stepper } from './Stepper';
2
2
  export type { StepperVariant } from './Stepper';
3
+ export { TramoCard } from './TramoCard';
4
+ export type { TramoCardTipo } from './TramoCard';
3
5
  export { Calendar } from './Calendar';
4
6
  export { MONTH_NAMES, WEEKDAY_LABELS, toLocalYMD, parseYMD, buildMonthGrid } from './calendarUtils';
5
7
  export { DonutGauge, DonutGaugeRow } from './DonutGauge';
@@ -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,21 @@
1
+ import { ReactNode } from 'react';
2
+ type ToggleCardProps = {
3
+ checked: boolean;
4
+ onChange: (value: boolean) => void;
5
+ /** Icono opcional junto al título */
6
+ icon?: ReactNode;
7
+ title: ReactNode;
8
+ description?: ReactNode;
9
+ disabled?: boolean;
10
+ };
11
+ /**
12
+ * Toggle con tarjeta (mockup transporte: "Repetir de forma continua",
13
+ * "Duplicar para otra unidad"): switch + título bold + descripción; el borde
14
+ * y el fondo se acentúan al activarse. Estado controlado por el consumidor —
15
+ * para formularios react-hook-form usar `Toggle`.
16
+ *
17
+ * Reutiliza el riel de `.sf-toggle__track` (CSS compilado de sf-ui): nada de
18
+ * clases arbitrarias de Tailwind que dependan del escaneo del consumidor.
19
+ */
20
+ export declare const ToggleCard: ({ checked, onChange, icon, title, description, disabled, }: ToggleCardProps) => import("react").JSX.Element;
21
+ export {};
@@ -17,6 +17,7 @@ export { Checkbox } from './Checkbox';
17
17
  export { CheckboxGroup } from './CheckboxGroup';
18
18
  export { RadioGroup } from './RadioGroup';
19
19
  export { Toggle } from './Toggle';
20
+ export { ToggleCard } from './ToggleCard';
20
21
  export { BooleanCheckbox } from './BooleanCheckbox';
21
22
  export { YesNoSelect } from './YesNoSelect';
22
23
  export { SmartInput } from './SmartInput';
@@ -0,0 +1,14 @@
1
+ import { ReactNode } from 'react';
2
+ type SummaryItemProps = {
3
+ label: ReactNode;
4
+ value: ReactNode;
5
+ className?: string;
6
+ };
7
+ /**
8
+ * Item de resumen (mockup transporte, paso Confirmar del wizard):
9
+ * label en versalitas chicas + valor en bold. Pensado para grillas de
10
+ * 2 columnas dentro de una tarjeta de resumen.
11
+ * Estilos en sf-layout.css — sin clases arbitrarias de Tailwind.
12
+ */
13
+ export declare const SummaryItem: ({ label, value, className }: SummaryItemProps) => import("react").JSX.Element;
14
+ export {};
@@ -18,6 +18,7 @@ export { Accordion } from './Accordion';
18
18
  export type { AccordionItemDef, AccordionProps, AccordionType } from './Accordion';
19
19
  export { ScrollArea } from './ScrollArea';
20
20
  export type { ScrollAreaProps } from './ScrollArea';
21
+ export { SummaryItem } from './SummaryItem';
21
22
  export type { FormWizardFooterVariant, FormWizardProps, FormWizardShell, FormWizardStep, UseFormWizardOptions, } from './FormWizard';
22
23
  export { FormWizard, useFormWizard } from './FormWizard';
23
24
  export { MasterDetailLayout, MasterDetailListItem } from './MasterDetailLayout';
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sfperusacdev/sf-ui",
3
- "version": "0.1.20",
3
+ "version": "0.1.22",
4
4
  "description": "SF UI — librería de componentes React (inputs, tablas, hooks) para aplicaciones SF Perú.",
5
5
  "type": "module",
6
6
  "main": "./dist/sf-ui.umd.cjs",