@dipusevilla/componentes-iu 1.0.29 → 1.0.32
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/index.cjs.js +13 -13
- package/dist/index.css +1 -1
- package/dist/index.es.js +4288 -3836
- package/dist/index.umd.js +14 -14
- package/dist/types/components/Checkbox.d.ts +11 -4
- package/dist/types/components/ChoiceGroup.d.ts +32 -0
- package/dist/types/components/CollapsibleList.d.ts +22 -0
- package/dist/types/components/CollapsibleSection.d.ts +8 -1
- package/dist/types/components/CompactAccordion.d.ts +19 -0
- package/dist/types/components/FormRenderer.d.ts +3 -1
- package/dist/types/components/Input.d.ts +15 -3
- package/dist/types/components/PageLayout.d.ts +3 -2
- package/dist/types/components/Select.d.ts +10 -5
- package/dist/types/components/TextArea.d.ts +3 -2
- package/dist/types/hooks/useAsyncSelectOptions.d.ts +6 -3
- package/dist/types/hooks/useDisabledMap.d.ts +2 -7
- package/dist/types/hooks/useDynamicYupSchema.d.ts +5 -11
- package/dist/types/hooks/useFieldsMap.d.ts +2 -2
- package/dist/types/index.d.ts +2 -0
- package/dist/types/rules/RuleDSL.d.ts +34 -0
- package/dist/types/rules/evalRules.d.ts +2 -0
- package/dist/types/types/FormTypes.d.ts +14 -14
- package/dist/types/utils/buildYupSchema.d.ts +3 -0
- package/dist/types/utils/generateYupCode.d.ts +2 -0
- package/package.json +5 -2
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { Control } from 'react-hook-form';
|
|
2
2
|
export interface CheckboxProps {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/** --- Modo RHF (controlado) --- */
|
|
4
|
+
control?: Control<any> | null;
|
|
5
|
+
name?: string;
|
|
5
6
|
rules?: any;
|
|
6
7
|
defaultValue?: boolean;
|
|
8
|
+
/** --- Props comunes --- */
|
|
7
9
|
label?: string;
|
|
8
10
|
labelHidden?: boolean;
|
|
9
11
|
disabled?: boolean;
|
|
@@ -11,8 +13,13 @@ export interface CheckboxProps {
|
|
|
11
13
|
className?: string;
|
|
12
14
|
hasError?: boolean;
|
|
13
15
|
errorMessage?: string;
|
|
16
|
+
/** --- Modo no-RHF (headless) --- */
|
|
17
|
+
checked?: boolean;
|
|
18
|
+
onChange?: (checked: boolean) => void;
|
|
14
19
|
}
|
|
15
20
|
/**
|
|
16
|
-
* Checkbox
|
|
21
|
+
* Checkbox que soporta 2 modos:
|
|
22
|
+
* - Controlado por React Hook Form (si se pasa `control`)
|
|
23
|
+
* - Headless (sin RHF) usando `checked`/`onChange`
|
|
17
24
|
*/
|
|
18
|
-
export declare function Checkbox({ control, name, rules, defaultValue, label, labelHidden, disabled, size, className, hasError, errorMessage, }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare function Checkbox({ control, name, rules, defaultValue, label, labelHidden, disabled, size, className, hasError, errorMessage, checked, onChange, }: CheckboxProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
type Size = "sm" | "md" | "lg";
|
|
2
|
+
export type ChoiceOption = {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export interface ChoiceGroupProps {
|
|
8
|
+
/** Opciones a elegir (selección única) */
|
|
9
|
+
options: ChoiceOption[];
|
|
10
|
+
/** Valor controlado */
|
|
11
|
+
value?: string;
|
|
12
|
+
/** Valor inicial en modo no controlado */
|
|
13
|
+
defaultValue?: string;
|
|
14
|
+
/** Callback al cambiar */
|
|
15
|
+
onChange?: (value: string) => void;
|
|
16
|
+
/** Nº de columnas en la malla */
|
|
17
|
+
columns?: 2 | 3 | 4;
|
|
18
|
+
/** Tamaño visual */
|
|
19
|
+
size?: Size;
|
|
20
|
+
/** Deshabilitar todo el grupo */
|
|
21
|
+
disabled?: boolean;
|
|
22
|
+
/** Accesibilidad */
|
|
23
|
+
ariaLabel?: string;
|
|
24
|
+
/** Si prefieres etiquetar con id externo (p.e. un <label>) */
|
|
25
|
+
ariaLabelledBy?: string;
|
|
26
|
+
/** Orientación lógica para accesibilidad */
|
|
27
|
+
orientation?: "horizontal" | "vertical";
|
|
28
|
+
/** Estilos extra */
|
|
29
|
+
className?: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function ChoiceGroup({ options, value, defaultValue, onChange, columns, size, disabled, ariaLabel, ariaLabelledBy, orientation, className, }: ChoiceGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export default ChoiceGroup;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type CollapsibleItem = {
|
|
3
|
+
id: string;
|
|
4
|
+
title: React.ReactNode;
|
|
5
|
+
subtitle?: React.ReactNode;
|
|
6
|
+
content: React.ReactNode;
|
|
7
|
+
actions?: React.ReactNode;
|
|
8
|
+
defaultOpen?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
};
|
|
11
|
+
export type CollapsibleListProps = {
|
|
12
|
+
items: CollapsibleItem[];
|
|
13
|
+
singleOpen?: boolean;
|
|
14
|
+
openIds?: string[];
|
|
15
|
+
onChangeOpenIds?: (ids: string[]) => void;
|
|
16
|
+
dense?: boolean;
|
|
17
|
+
className?: string;
|
|
18
|
+
headerClassName?: string;
|
|
19
|
+
contentClassName?: string;
|
|
20
|
+
};
|
|
21
|
+
export declare function CollapsibleList({ items, singleOpen, openIds, onChangeOpenIds, dense, className, headerClassName, contentClassName, }: CollapsibleListProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export default CollapsibleList;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
export type CollapsibleSectionType = 'default' | 'plain' | 'soft' | 'ghost';
|
|
2
3
|
export interface CollapsibleSectionProps {
|
|
3
4
|
title: string;
|
|
4
5
|
children: ReactNode;
|
|
5
6
|
defaultOpen?: boolean;
|
|
6
7
|
className?: string;
|
|
8
|
+
/** Variante visual del contenedor (default = actual) */
|
|
9
|
+
type?: CollapsibleSectionType;
|
|
10
|
+
/** Clases extra para el contenedor del contenido (dentro del área colapsable) */
|
|
11
|
+
contentClassName?: string;
|
|
12
|
+
/** Clases extra para el header (el botón) */
|
|
13
|
+
headerClassName?: string;
|
|
7
14
|
}
|
|
8
|
-
export declare function CollapsibleSection({ title, children, defaultOpen, className, }: CollapsibleSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function CollapsibleSection({ title, children, defaultOpen, className, type, contentClassName, headerClassName, }: CollapsibleSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type CompactAccordionItem = {
|
|
2
|
+
id: string;
|
|
3
|
+
title: string;
|
|
4
|
+
content: React.ReactNode;
|
|
5
|
+
defaultOpen?: boolean;
|
|
6
|
+
leftAdornment?: React.ReactNode;
|
|
7
|
+
actions?: React.ReactNode;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type CompactAccordionProps = {
|
|
11
|
+
items: CompactAccordionItem[];
|
|
12
|
+
value?: string[];
|
|
13
|
+
onValueChange?: (openIds: string[]) => void;
|
|
14
|
+
multiple?: boolean;
|
|
15
|
+
dense?: boolean;
|
|
16
|
+
className?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function CompactAccordion({ items, value, onValueChange, multiple, dense, className, }: CompactAccordionProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export default CompactAccordion;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { type Resolver } from "react-hook-form";
|
|
1
2
|
import type { FieldSchema, FormSchema } from "../types/FormTypes";
|
|
2
|
-
export declare function FormRenderer({ schema }: {
|
|
3
|
+
export declare function FormRenderer({ schema, resolver: externalResolver, }: {
|
|
3
4
|
schema: FormSchema;
|
|
5
|
+
resolver?: Resolver<any>;
|
|
4
6
|
}): import("react/jsx-runtime").JSX.Element;
|
|
5
7
|
export { FieldSchema };
|
|
@@ -15,12 +15,24 @@ export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>,
|
|
|
15
15
|
separator?: React.ReactNode;
|
|
16
16
|
suffixButton?: React.ReactNode;
|
|
17
17
|
disabled?: boolean;
|
|
18
|
+
/** Si se proporciona `control`, el input es controlado por RHF */
|
|
18
19
|
control?: Control<any>;
|
|
19
20
|
name?: FieldPath<FieldValues>;
|
|
20
21
|
rules?: RegisterOptions<FieldValues, FieldPath<FieldValues>>;
|
|
21
22
|
defaultValue?: unknown;
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* Si reservar un espacio fijo debajo para el mensaje de error.
|
|
25
|
+
* Por defecto: true si es controlado (con `control`), false si es no controlado.
|
|
26
|
+
*/
|
|
27
|
+
reserveErrorSpace?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Alias (deprecado) para desactivar la reserva de espacio de error.
|
|
30
|
+
* Si lo usas: effectiveReserveErrorSpace = !disableErrorPlaceholder
|
|
31
|
+
*/
|
|
32
|
+
disableErrorPlaceholder?: boolean;
|
|
33
|
+
/** Estado de carga con skeleton */
|
|
24
34
|
loading?: boolean;
|
|
25
|
-
}
|
|
35
|
+
}
|
|
36
|
+
export declare function Input({ id, type, size, width, label, labelHidden, hasError, errorMessage, prefixIcon, suffixIcon, separator, suffixButton, disabled, control, name, rules, defaultValue, reserveErrorSpace, disableErrorPlaceholder, // <- alias deprecado
|
|
37
|
+
loading, className: inputClassName, ...props }: InputProps): import("react/jsx-runtime").JSX.Element;
|
|
26
38
|
export {};
|
|
@@ -2,12 +2,13 @@ import React from 'react';
|
|
|
2
2
|
import { type SidebarProps } from './Sidebar';
|
|
3
3
|
import { type HeaderProps } from './Header';
|
|
4
4
|
export interface PageLayoutProps {
|
|
5
|
-
|
|
5
|
+
hideSidebar?: boolean;
|
|
6
|
+
/** Props para el Sidebar (se ignoran si hideSidebar = true) */
|
|
6
7
|
sidebar: Pick<SidebarProps, 'appName' | 'orgName' | 'username' | 'footerText' | 'navItems' | 'selectedNav' | 'onSelectNav' | 'width'>;
|
|
7
8
|
/** Props para el Header */
|
|
8
9
|
header: Pick<HeaderProps, 'pinnedPages' | 'onRemovePinned' | 'onBack' | 'dark' | 'locale' | 'languageOptions' | 'onChangeLocale' | 'profile' | 'profileOptions' | 'onChangeProfile'>;
|
|
9
10
|
/** Contenido principal (renderizado por tu router o componentes hijos) */
|
|
10
11
|
children: React.ReactNode;
|
|
11
12
|
}
|
|
12
|
-
export declare function PageLayout({ sidebar, header, children }: PageLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function PageLayout({ hideSidebar, sidebar, header, children }: PageLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
export default PageLayout;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { type Control } from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type Control } from "react-hook-form";
|
|
3
3
|
import { Option } from "../types/FormTypes";
|
|
4
|
-
type Size =
|
|
4
|
+
type Size = "sm" | "md" | "lg";
|
|
5
5
|
export interface SelectProps {
|
|
6
6
|
control?: Control<any>;
|
|
7
7
|
name?: string;
|
|
@@ -11,9 +11,8 @@ export interface SelectProps {
|
|
|
11
11
|
options?: Option[];
|
|
12
12
|
/** Función asíncrona para cargar opciones */
|
|
13
13
|
loadOptions?: () => Promise<Option[]>;
|
|
14
|
-
/** Lista de
|
|
14
|
+
/** Lista de deps que re-disparan loadOptions */
|
|
15
15
|
reloadDeps?: any[];
|
|
16
|
-
/** Para uso “no-RHF” */
|
|
17
16
|
value?: string | number;
|
|
18
17
|
onChange?: (value: any) => void;
|
|
19
18
|
size?: Size;
|
|
@@ -22,10 +21,16 @@ export interface SelectProps {
|
|
|
22
21
|
labelHidden?: boolean;
|
|
23
22
|
hasError?: boolean;
|
|
24
23
|
errorMessage?: string;
|
|
24
|
+
/** Reservar espacio para errores (default: true si RHF, false si unctrl) */
|
|
25
|
+
reserveErrorSpace?: boolean;
|
|
25
26
|
disableErrorPlaceholder?: boolean;
|
|
26
27
|
disabled?: boolean;
|
|
27
28
|
className?: string;
|
|
28
29
|
suffixButton?: React.ReactNode;
|
|
30
|
+
/** Skeleton state */
|
|
31
|
+
loading?: boolean;
|
|
32
|
+
/** Evita que el Select fuerce la primera opción si el value es vacío o no está en lista. */
|
|
33
|
+
coerceFirstValid?: boolean;
|
|
29
34
|
}
|
|
30
35
|
export declare function Select(props: SelectProps): import("react/jsx-runtime").JSX.Element;
|
|
31
36
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type TextareaHTMLAttributes } from 'react';
|
|
1
|
+
import React, { type TextareaHTMLAttributes } from 'react';
|
|
2
2
|
import type { Control } from 'react-hook-form';
|
|
3
3
|
type Size = 'sm' | 'md' | 'lg';
|
|
4
4
|
export interface TextAreaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'size' | 'name' | 'defaultValue'> {
|
|
@@ -15,6 +15,7 @@ export interface TextAreaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaE
|
|
|
15
15
|
maxLength?: number;
|
|
16
16
|
showCounter?: boolean;
|
|
17
17
|
className?: string;
|
|
18
|
+
suffixButton?: React.ReactNode;
|
|
18
19
|
}
|
|
19
|
-
export declare function TextArea({ control, name, rules, defaultValue, size, width, label, labelHidden, hasError, errorMessage, maxLength, showCounter, className, ...
|
|
20
|
+
export declare function TextArea({ control, name, rules, defaultValue, size, width, label, labelHidden, hasError, errorMessage, maxLength, showCounter, className, suffixButton, ...textareaProps }: TextAreaProps): import("react/jsx-runtime").JSX.Element;
|
|
20
21
|
export {};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type { FieldSchema } from "../
|
|
2
|
-
|
|
1
|
+
import type { FieldSchema } from "../types/FormTypes";
|
|
2
|
+
export type Option = {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string | number;
|
|
5
|
+
};
|
|
3
6
|
export declare function useAsyncSelectOptions(fields: FieldSchema[]): {
|
|
4
|
-
loadingCount: number;
|
|
5
7
|
optionsMap: Record<string, Option[]>;
|
|
8
|
+
loadingCount: number;
|
|
6
9
|
};
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { type Control, type FieldValues } from "react-hook-form";
|
|
2
|
-
import type {
|
|
2
|
+
import type { FieldEntry } from "../types/FormTypes";
|
|
3
3
|
type DisabledMap = Record<string, boolean>;
|
|
4
|
-
|
|
5
|
-
* Para cada FieldSchema que tenga `disabledWhen`, comprueba con useWatch
|
|
6
|
-
* el valor actual del campo `watchField`, y si coincide con `watchValue`,
|
|
7
|
-
* marca ese campo como deshabilitado (true). Devuelve un map { [fieldName]: boolean }.
|
|
8
|
-
*/
|
|
9
|
-
export declare function useDisabledMap(fields: FieldSchema[], control: Control<FieldValues>): DisabledMap;
|
|
4
|
+
export declare function useDisabledMap(fields?: FieldEntry[], control?: Control<FieldValues>): DisabledMap;
|
|
10
5
|
export {};
|
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
import type { ObjectSchema } from "yup";
|
|
2
|
-
import type {
|
|
2
|
+
import type { FieldEntry } from "../types/FormTypes";
|
|
3
3
|
interface UseDynamicParams {
|
|
4
|
-
fields
|
|
4
|
+
fields?: FieldEntry[];
|
|
5
5
|
explicitSchema?: ObjectSchema<any>;
|
|
6
6
|
}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*/
|
|
11
|
-
export declare function useDynamicYupSchema({ fields, explicitSchema, }: UseDynamicParams): import("react-hook-form").Resolver<any, unknown, any> | import("react-hook-form").Resolver<{
|
|
12
|
-
[x: string]: any;
|
|
13
|
-
}, unknown, {
|
|
14
|
-
[x: string]: any;
|
|
15
|
-
}>;
|
|
7
|
+
export declare function useDynamicYupSchema({ fields, explicitSchema }: UseDynamicParams): import("react-hook-form").Resolver<any, unknown, any> | import("react-hook-form").Resolver<{
|
|
8
|
+
[x: string]: never;
|
|
9
|
+
}, unknown, {}>;
|
|
16
10
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { FieldSchema } from "../
|
|
2
|
-
export declare function useFieldsMap(fields
|
|
1
|
+
import type { FieldSchema, FieldEntry } from "../types/FormTypes";
|
|
2
|
+
export declare function useFieldsMap(fields?: FieldEntry[]): Record<string, FieldSchema>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -60,4 +60,6 @@ export { Checkbox } from './components/Checkbox';
|
|
|
60
60
|
export type { CheckboxProps } from './components/Checkbox';
|
|
61
61
|
export { SearchField } from './components/SearchField';
|
|
62
62
|
export type { SearchFieldProps } from './components/SearchField';
|
|
63
|
+
export { CompactAccordion } from "./components/CompactAccordion";
|
|
64
|
+
export type { CompactAccordionItem, CompactAccordionProps } from "./components/CompactAccordion";
|
|
63
65
|
import './styles/index.css';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type RuleExpr = {
|
|
2
|
+
op: "eq";
|
|
3
|
+
field: string;
|
|
4
|
+
value: unknown;
|
|
5
|
+
} | {
|
|
6
|
+
op: "neq";
|
|
7
|
+
field: string;
|
|
8
|
+
value: unknown;
|
|
9
|
+
} | {
|
|
10
|
+
op: "in";
|
|
11
|
+
field: string;
|
|
12
|
+
values: unknown[];
|
|
13
|
+
} | {
|
|
14
|
+
op: "notIn";
|
|
15
|
+
field: string;
|
|
16
|
+
values: unknown[];
|
|
17
|
+
} | {
|
|
18
|
+
op: "gt" | "gte" | "lt" | "lte";
|
|
19
|
+
field: string;
|
|
20
|
+
value: number | string | Date;
|
|
21
|
+
} | {
|
|
22
|
+
op: "and";
|
|
23
|
+
rules: RuleExpr[];
|
|
24
|
+
} | {
|
|
25
|
+
op: "or";
|
|
26
|
+
rules: RuleExpr[];
|
|
27
|
+
};
|
|
28
|
+
export type VisibilityRule = {
|
|
29
|
+
rule: RuleExpr;
|
|
30
|
+
};
|
|
31
|
+
export type ClearWhenRule = {
|
|
32
|
+
rule: RuleExpr;
|
|
33
|
+
clearTo?: unknown;
|
|
34
|
+
};
|
|
@@ -3,6 +3,7 @@ import { Size } from "../components/InputGroup";
|
|
|
3
3
|
import { InputProps } from "../components/Input";
|
|
4
4
|
import { SelectProps } from "../components/Select";
|
|
5
5
|
import { UseFormGetValues, UseFormWatch } from "react-hook-form";
|
|
6
|
+
import type { VisibilityRule, ClearWhenRule } from "../rules/RuleDSL";
|
|
6
7
|
export type Condition = {
|
|
7
8
|
watchField: string;
|
|
8
9
|
watchValue: unknown | ((vals: Record<string, unknown>) => boolean);
|
|
@@ -15,6 +16,7 @@ type FormCtx = {
|
|
|
15
16
|
getValues: UseFormGetValues<any>;
|
|
16
17
|
watch: UseFormWatch<any>;
|
|
17
18
|
};
|
|
19
|
+
export type FieldEntry = FieldSchema | ButtonField | InputGroupField;
|
|
18
20
|
/**
|
|
19
21
|
* Esquema que describe un campo atómico del formulario.
|
|
20
22
|
*/
|
|
@@ -75,23 +77,14 @@ export interface FieldSchema {
|
|
|
75
77
|
/** Etiqueta accesible. */
|
|
76
78
|
ariaLabel?: string;
|
|
77
79
|
/** Condición de habilitación basada en otro campo. */
|
|
78
|
-
disabledWhen?:
|
|
79
|
-
|
|
80
|
-
watchValue: unknown | ((allValues: Record<string, unknown>) => boolean);
|
|
81
|
-
};
|
|
82
|
-
clearWhen?: Condition & {
|
|
83
|
-
/** valor al que limpiar; por defecto '' */
|
|
84
|
-
clearTo?: unknown;
|
|
85
|
-
};
|
|
80
|
+
disabledWhen?: ConditionalProp;
|
|
81
|
+
clearWhen?: ClearProp;
|
|
86
82
|
/** Deshabilitar manualmente. */
|
|
87
83
|
disabled?: boolean;
|
|
88
84
|
/** Para date: mostrar hora. */
|
|
89
85
|
showTime?: boolean;
|
|
90
86
|
/** Condición de visibilidad basada en otro campo. */
|
|
91
|
-
visibleWhen?:
|
|
92
|
-
watchField: string;
|
|
93
|
-
watchValue: unknown | ((allValues: Record<string, unknown>) => boolean);
|
|
94
|
-
};
|
|
87
|
+
visibleWhen?: ConditionalProp;
|
|
95
88
|
/** Atributo para saber si hay carga en curso */
|
|
96
89
|
loading?: boolean;
|
|
97
90
|
inputs?: Array<InputProps & SelectProps & {
|
|
@@ -143,7 +136,7 @@ export interface SectionColumn {
|
|
|
143
136
|
/** Ancho CSS/Tailwind. */
|
|
144
137
|
width?: string;
|
|
145
138
|
/** Campos en esta columna. */
|
|
146
|
-
fields?: Array<string |
|
|
139
|
+
fields?: Array<string | FieldEntry>;
|
|
147
140
|
/** Sub-columnas anidadas. */
|
|
148
141
|
cols?: SectionColumn[];
|
|
149
142
|
/** Sub-filas anidadas. */
|
|
@@ -198,7 +191,7 @@ export interface FormSchema {
|
|
|
198
191
|
/** Layout principal: array de LayoutNode. */
|
|
199
192
|
layout: LayoutNode[];
|
|
200
193
|
/** Definición global de todos los campos. */
|
|
201
|
-
fields:
|
|
194
|
+
fields: FieldEntry[];
|
|
202
195
|
/** Función a llamar al hacer submit. */
|
|
203
196
|
onSubmit: (data: unknown) => void | Promise<void>;
|
|
204
197
|
/** Mensaje de éxito a mostrar. */
|
|
@@ -216,4 +209,11 @@ export type Option = {
|
|
|
216
209
|
label?: string;
|
|
217
210
|
value: string | number;
|
|
218
211
|
};
|
|
212
|
+
export type ConditionalProp = VisibilityRule | {
|
|
213
|
+
watchField: string;
|
|
214
|
+
watchValue: unknown | ((vals: Record<string, unknown>) => boolean);
|
|
215
|
+
};
|
|
216
|
+
export type ClearProp = ClearWhenRule | (Condition & {
|
|
217
|
+
clearTo?: unknown;
|
|
218
|
+
});
|
|
219
219
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dipusevilla/componentes-iu",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.32",
|
|
4
4
|
"description": "Librería de componentes React de Dipusevilla",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -35,10 +35,13 @@
|
|
|
35
35
|
"@hookform/resolvers": "^5.0.1",
|
|
36
36
|
"clsx": "^2.1.1",
|
|
37
37
|
"i18next": "^25.2.1",
|
|
38
|
+
"immer": "^10.1.3",
|
|
38
39
|
"react-hook-form": "^7.56.4",
|
|
39
40
|
"react-i18next": "^15.5.2",
|
|
41
|
+
"react-router-dom": "^7.9.4",
|
|
40
42
|
"tailwind-merge": "^3.3.1",
|
|
41
|
-
"yup": "^1.6.1"
|
|
43
|
+
"yup": "^1.6.1",
|
|
44
|
+
"zustand": "^5.0.8"
|
|
42
45
|
},
|
|
43
46
|
"devDependencies": {
|
|
44
47
|
"@chromatic-com/storybook": "^3.2.6",
|