@axzydev/axzy_ui_system 1.2.16 → 1.3.1
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 +3349 -1457
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.cts +719 -54
- package/dist/index.d.ts +719 -54
- package/dist/index.js +3283 -1387
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/App.tsx +32 -0
- package/src/components/atoms/badget/badget.tsx +2 -4
- package/src/components/atoms/chip/chip.doc.mdx +47 -0
- package/src/components/atoms/chip/chip.props.ts +32 -0
- package/src/components/atoms/chip/chip.stories.tsx +64 -0
- package/src/components/atoms/chip/chip.tsx +112 -0
- package/src/components/atoms/grid/grid.tsx +1 -2
- package/src/components/molecules/accordion/accordion.doc.mdx +47 -0
- package/src/components/molecules/accordion/accordion.props.ts +35 -0
- package/src/components/molecules/accordion/accordion.stories.tsx +68 -0
- package/src/components/molecules/accordion/accordion.tsx +123 -0
- package/src/components/molecules/calendar/calendar.doc.mdx +2 -1
- package/src/components/molecules/calendar/calendar.tsx +102 -24
- package/src/components/molecules/chip-input/chip-input.doc.mdx +44 -0
- package/src/components/molecules/chip-input/chip-input.props.ts +42 -0
- package/src/components/molecules/chip-input/chip-input.stories.tsx +52 -0
- package/src/components/molecules/chip-input/chip-input.tsx +205 -0
- package/src/components/molecules/date-picker/datePicker.tsx +45 -56
- package/src/components/molecules/dropdown-menu/dropdown-menu.doc.mdx +46 -0
- package/src/components/molecules/dropdown-menu/dropdown-menu.props.ts +41 -0
- package/src/components/molecules/dropdown-menu/dropdown-menu.stories.tsx +41 -0
- package/src/components/molecules/dropdown-menu/dropdown-menu.tsx +219 -0
- package/src/components/molecules/field/field.doc.mdx +43 -0
- package/src/components/molecules/field/field.props.ts +23 -0
- package/src/components/molecules/field/field.stories.tsx +42 -0
- package/src/components/molecules/field/field.tsx +54 -0
- package/src/components/molecules/masked-input/masked-input.doc.mdx +78 -0
- package/src/components/molecules/masked-input/masked-input.props.ts +58 -0
- package/src/components/molecules/masked-input/masked-input.stories.tsx +126 -0
- package/src/components/molecules/masked-input/masked-input.tsx +244 -0
- package/src/components/molecules/multi-select/multi-select.doc.mdx +55 -0
- package/src/components/molecules/multi-select/multi-select.props.ts +65 -0
- package/src/components/molecules/multi-select/multi-select.stories.tsx +59 -0
- package/src/components/molecules/multi-select/multi-select.tsx +386 -0
- package/src/components/molecules/search-select/search-select.doc.mdx +5 -0
- package/src/components/molecules/search-select/search-select.props.ts +10 -1
- package/src/components/molecules/search-select/search-select.stories.tsx +18 -0
- package/src/components/molecules/search-select/search-select.tsx +102 -28
- package/src/components/molecules/time-picker/timePicker.tsx +14 -26
- package/src/components/molecules/wysiwyg/wysiwyg.props.ts +51 -0
- package/src/components/molecules/wysiwyg/wysiwyg.stories.tsx +95 -0
- package/src/components/molecules/wysiwyg/wysiwyg.tsx +609 -0
- package/src/components/organisms/form-builder/fieldRenderer.tsx +144 -27
- package/src/components/organisms/form-builder/formBuilder.context.tsx +77 -15
- package/src/components/organisms/form-builder/formBuilder.doc.mdx +213 -86
- package/src/components/organisms/form-builder/formBuilder.props.ts +118 -36
- package/src/components/organisms/form-builder/formBuilder.stories.tsx +694 -96
- package/src/components/organisms/form-builder/formBuilder.tsx +152 -69
- package/src/components/organisms/form-builder/useFormBuilder.ts +59 -21
- package/src/hooks/useFloatingPanel.ts +100 -0
- package/src/index.ts +26 -4
- package/src/showcases/DataShowcases.tsx +76 -0
- package/src/showcases/FormShowcases.tsx +574 -10
- package/src/showcases/HomeShowcase.tsx +6 -6
- package/src/showcases/NavigationShowcases.tsx +72 -2
- package/src/showcases/StructureShowcases.tsx +64 -0
- package/src/types/chip.types.ts +13 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Yup from 'yup';
|
|
2
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
2
|
import * as React$1 from 'react';
|
|
4
|
-
import React__default, {
|
|
3
|
+
import React__default, { RefObject, CSSProperties, ReactNode, ElementType, FocusEvent, HTMLAttributes } from 'react';
|
|
4
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
6
|
declare const useClickOutside: (ref: React.RefObject<HTMLElement>, callback: () => void) => void;
|
|
7
7
|
|
|
@@ -137,6 +137,39 @@ interface UseEditableRowResult<T> {
|
|
|
137
137
|
}
|
|
138
138
|
declare function useEditableRow<T>({ row, columns, getNestedValue, validationSchema, }: UseEditableRowOptions<T>): UseEditableRowResult<T>;
|
|
139
139
|
|
|
140
|
+
/** Options for {@link useFloatingPanel}. */
|
|
141
|
+
interface UseFloatingPanelOptions {
|
|
142
|
+
/** Fallback panel height in px, used before the panel is measured. */
|
|
143
|
+
estimatedHeight?: number;
|
|
144
|
+
/** Gap in px between the anchor and the panel. */
|
|
145
|
+
offset?: number;
|
|
146
|
+
/** When true, the panel width matches the anchor width. */
|
|
147
|
+
matchWidth?: boolean;
|
|
148
|
+
/** Horizontal alignment relative to the anchor. @default "start" */
|
|
149
|
+
align?: "start" | "end";
|
|
150
|
+
/** Panel z-index. */
|
|
151
|
+
zIndex?: number;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Computes a fixed position for a floating panel anchored to an element.
|
|
155
|
+
*
|
|
156
|
+
* Positions are relative to the viewport, so the panel must be rendered
|
|
157
|
+
* through a portal (e.g. into `document.body`) to escape ancestors with
|
|
158
|
+
* `overflow: hidden` or `transform`, which otherwise clip or re-anchor it.
|
|
159
|
+
* When there is not enough room below, the panel flips above and its bottom
|
|
160
|
+
* edge is pinned to the anchor's top, so it always stays adjacent regardless
|
|
161
|
+
* of its real height. Repositions on scroll, resize, and panel resize.
|
|
162
|
+
*
|
|
163
|
+
* @param anchorRef - Ref to the element the panel is anchored to.
|
|
164
|
+
* @param isOpen - Whether the panel is currently open.
|
|
165
|
+
* @param options - Sizing and placement options.
|
|
166
|
+
* @returns `panelRef` to attach to the portaled panel and the `style` to apply.
|
|
167
|
+
*/
|
|
168
|
+
declare function useFloatingPanel(anchorRef: RefObject<HTMLElement | null>, isOpen: boolean, { estimatedHeight, offset, matchWidth, align, zIndex, }?: UseFloatingPanelOptions): {
|
|
169
|
+
panelRef: RefObject<HTMLDivElement>;
|
|
170
|
+
style: CSSProperties;
|
|
171
|
+
};
|
|
172
|
+
|
|
140
173
|
interface SortConfig {
|
|
141
174
|
key: string;
|
|
142
175
|
direction: "asc" | "desc";
|
|
@@ -161,6 +194,57 @@ interface UseTableStateResult {
|
|
|
161
194
|
}
|
|
162
195
|
declare function useTableState({ defaultItemsPerPage, initialSort, }?: UseTableStateOptions): UseTableStateResult;
|
|
163
196
|
|
|
197
|
+
/** A single collapsible section inside {@link ITAccordionProps}. */
|
|
198
|
+
interface ITAccordionItem {
|
|
199
|
+
/** Unique identifier for the item. */
|
|
200
|
+
id: string;
|
|
201
|
+
/** Header content (usually text). */
|
|
202
|
+
title: ReactNode;
|
|
203
|
+
/** Body content revealed when the item is open. */
|
|
204
|
+
content: ReactNode;
|
|
205
|
+
/** Optional icon rendered before the title. */
|
|
206
|
+
icon?: ReactNode;
|
|
207
|
+
/** Disables toggling for this item. @default false */
|
|
208
|
+
disabled?: boolean;
|
|
209
|
+
}
|
|
210
|
+
/** Props for the ITAccordion component. */
|
|
211
|
+
interface ITAccordionProps {
|
|
212
|
+
/** Sections to render. */
|
|
213
|
+
items: ITAccordionItem[];
|
|
214
|
+
/** Allows more than one section open at the same time. @default false */
|
|
215
|
+
allowMultiple?: boolean;
|
|
216
|
+
/** Ids open on first render (uncontrolled mode). */
|
|
217
|
+
defaultOpenIds?: string[];
|
|
218
|
+
/** Controlled list of open ids. When provided, the component is controlled. */
|
|
219
|
+
openIds?: string[];
|
|
220
|
+
/** Fired with the next list of open ids whenever a section toggles. */
|
|
221
|
+
onChange?: (openIds: string[]) => void;
|
|
222
|
+
/** Visual style. Valid values: `"default"`, `"separated"`, `"bordered"`. @default "separated" */
|
|
223
|
+
variant?: "default" | "separated" | "bordered";
|
|
224
|
+
/** Additional CSS classes for the wrapper. */
|
|
225
|
+
className?: string;
|
|
226
|
+
/** Additional CSS classes applied to every item. */
|
|
227
|
+
itemClassName?: string;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Collapsible sections for FAQs, settings panels, and long content.
|
|
232
|
+
*
|
|
233
|
+
* Works uncontrolled (`defaultOpenIds`) or controlled (`openIds` + `onChange`).
|
|
234
|
+
* Supports single-open (default) or multiple-open mode, and animates the body
|
|
235
|
+
* with a CSS grid-rows transition (no JS height measurement).
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* <ITAccordion
|
|
239
|
+
* items={[
|
|
240
|
+
* { id: "a", title: "¿Qué es AXZY?", content: "Un sistema de componentes." },
|
|
241
|
+
* { id: "b", title: "¿Cómo instalo?", content: "pnpm add @axzydev/axzy_ui_system" },
|
|
242
|
+
* ]}
|
|
243
|
+
* defaultOpenIds={["a"]}
|
|
244
|
+
* />
|
|
245
|
+
*/
|
|
246
|
+
declare function ITAccordion({ items, allowMultiple, defaultOpenIds, openIds, onChange, variant, className, itemClassName, }: ITAccordionProps): react_jsx_runtime.JSX.Element;
|
|
247
|
+
|
|
164
248
|
type AlertVariant = "info" | "success" | "warning" | "error";
|
|
165
249
|
interface ITAlertProps {
|
|
166
250
|
/** Alert visual style. Valid values: `"info"`, `"success"`, `"warning"`, `"error"`. @default "info" */
|
|
@@ -599,6 +683,397 @@ interface ITCheckboxProps {
|
|
|
599
683
|
*/
|
|
600
684
|
declare function ITCheckbox({ checked, onChange, label, disabled, indeterminate, className, name, }: ITCheckboxProps): react_jsx_runtime.JSX.Element;
|
|
601
685
|
|
|
686
|
+
/** Visual styles available for {@link ITChip}. */
|
|
687
|
+
declare const chipVariants: {
|
|
688
|
+
readonly soft: "soft";
|
|
689
|
+
readonly filled: "filled";
|
|
690
|
+
readonly outlined: "outlined";
|
|
691
|
+
};
|
|
692
|
+
|
|
693
|
+
/** Props for the ITChip tag/pill component. */
|
|
694
|
+
interface ITChipProps {
|
|
695
|
+
/** Text label displayed inside the chip. Overridden if `children` is provided. */
|
|
696
|
+
label?: string;
|
|
697
|
+
/** Custom content rendered inside the chip. Takes precedence over `label`. */
|
|
698
|
+
children?: ReactNode;
|
|
699
|
+
/** Color theme key from the semantic palette (e.g. `"primary"`, `"success"`, `"danger"`). @default "secondary" */
|
|
700
|
+
color?: ColorsTypes;
|
|
701
|
+
/** Chip size. Valid values: `"sm"`, `"md"`, `"lg"`. @default "md" */
|
|
702
|
+
size?: SizesTypes;
|
|
703
|
+
/** Visual style. Valid values: `"soft"`, `"filled"`, `"outlined"`. @default "soft" */
|
|
704
|
+
variant?: keyof typeof chipVariants;
|
|
705
|
+
/** Icon rendered before the label. */
|
|
706
|
+
icon?: ReactNode;
|
|
707
|
+
/** Shows a remove (X) button at the end of the chip. @default false */
|
|
708
|
+
removable?: boolean;
|
|
709
|
+
/** Callback fired when the remove button is pressed. */
|
|
710
|
+
onRemove?: () => void;
|
|
711
|
+
/** Makes the chip clickable (filter/toggle usage). */
|
|
712
|
+
onClick?: () => void;
|
|
713
|
+
/** Highlights the chip as selected, using the `color` palette. @default false */
|
|
714
|
+
selected?: boolean;
|
|
715
|
+
/** Disables all chip interactions and reduces opacity. @default false */
|
|
716
|
+
disabled?: boolean;
|
|
717
|
+
/** Additional CSS classes for the chip element. */
|
|
718
|
+
className?: string;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
/**
|
|
722
|
+
* Compact tag / pill used for labels, active filters, and multi-value selections.
|
|
723
|
+
*
|
|
724
|
+
* Supports soft, filled, and outlined variants, an optional leading icon,
|
|
725
|
+
* a removable (X) affordance, and a selected state for filter toggles.
|
|
726
|
+
*
|
|
727
|
+
* @example
|
|
728
|
+
* <ITChip label="React" color="primary" />
|
|
729
|
+
*
|
|
730
|
+
* @example
|
|
731
|
+
* <ITChip label="México" color="success" variant="outlined" removable onRemove={() => remove("MX")} />
|
|
732
|
+
*
|
|
733
|
+
* @example
|
|
734
|
+
* <ITChip label="Activos" selected onClick={() => toggle()} />
|
|
735
|
+
*/
|
|
736
|
+
declare function ITChip({ label, children, color, size, variant, icon, removable, onRemove, onClick, selected, disabled, className, }: ITChipProps): react_jsx_runtime.JSX.Element;
|
|
737
|
+
|
|
738
|
+
/** Props for the ITChipInput component. */
|
|
739
|
+
interface ITChipInputProps {
|
|
740
|
+
/** Name attribute for form integrations. */
|
|
741
|
+
name?: string;
|
|
742
|
+
/** Label displayed above the control. */
|
|
743
|
+
label?: string;
|
|
744
|
+
/** Placeholder for the text input. @default "Escribe y presiona Enter" */
|
|
745
|
+
placeholder?: string;
|
|
746
|
+
/** Current list of tags (controlled). */
|
|
747
|
+
value: string[];
|
|
748
|
+
/** Fired with the next list of tags. */
|
|
749
|
+
onChange?: (values: string[]) => void;
|
|
750
|
+
/** Fired when the control loses focus. */
|
|
751
|
+
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
752
|
+
/** Keys that commit the current text as a tag. @default ["Enter", ","] */
|
|
753
|
+
delimiters?: string[];
|
|
754
|
+
/** Maximum number of tags allowed. */
|
|
755
|
+
maxTags?: number;
|
|
756
|
+
/** Allows duplicated tags. @default false */
|
|
757
|
+
allowDuplicates?: boolean;
|
|
758
|
+
/** Returns an error string to reject the tag, or undefined if valid. */
|
|
759
|
+
validate?: (value: string) => string | undefined;
|
|
760
|
+
/** Color applied to the tag chips. @default "primary" */
|
|
761
|
+
color?: ColorsTypes;
|
|
762
|
+
/** Control size. Valid values: `"sm"`, `"md"`, `"lg"`. @default "md" */
|
|
763
|
+
size?: SizesTypes;
|
|
764
|
+
/** Disables the control. @default false */
|
|
765
|
+
disabled?: boolean;
|
|
766
|
+
/** Marks the field as required (red asterisk). @default false */
|
|
767
|
+
required?: boolean;
|
|
768
|
+
/** Whether the field has been touched (form validation). */
|
|
769
|
+
touched?: boolean;
|
|
770
|
+
/** Error message or boolean indicating an error state. */
|
|
771
|
+
error?: string | boolean;
|
|
772
|
+
/** Helper text shown below the control when there is no error. */
|
|
773
|
+
helpText?: string;
|
|
774
|
+
/** Additional CSS classes for the container. */
|
|
775
|
+
className?: string;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* Free-text input that turns entered values into removable tags (chips).
|
|
780
|
+
*
|
|
781
|
+
* Commits a tag on `Enter`/`,` (configurable via `delimiters`), on blur, or on
|
|
782
|
+
* paste of delimited text. Supports `maxTags`, dedupe control, and per-tag
|
|
783
|
+
* validation.
|
|
784
|
+
*
|
|
785
|
+
* @example
|
|
786
|
+
* <ITChipInput
|
|
787
|
+
* label="Etiquetas"
|
|
788
|
+
* value={tags}
|
|
789
|
+
* onChange={setTags}
|
|
790
|
+
* placeholder="Agrega una etiqueta..."
|
|
791
|
+
* />
|
|
792
|
+
*/
|
|
793
|
+
declare function ITChipInput({ name, label, placeholder, value, onChange, onBlur, delimiters, maxTags, allowDuplicates, validate, color, size, disabled, required, touched, error, helpText, className, }: ITChipInputProps): react_jsx_runtime.JSX.Element;
|
|
794
|
+
|
|
795
|
+
/** A single action inside {@link ITDropdownMenuProps}. */
|
|
796
|
+
interface ITDropdownMenuItem {
|
|
797
|
+
/** Unique identifier for the item. */
|
|
798
|
+
id: string;
|
|
799
|
+
/** Item content (usually text). */
|
|
800
|
+
label: ReactNode;
|
|
801
|
+
/** Optional leading icon. */
|
|
802
|
+
icon?: ReactNode;
|
|
803
|
+
/** Optional shortcut hint rendered on the right (e.g. `"⌘K"`). */
|
|
804
|
+
shortcut?: string;
|
|
805
|
+
/** Click handler for the item. */
|
|
806
|
+
onClick?: () => void;
|
|
807
|
+
/** Disables the item. @default false */
|
|
808
|
+
disabled?: boolean;
|
|
809
|
+
/** Renders the item in the danger color (destructive actions). @default false */
|
|
810
|
+
danger?: boolean;
|
|
811
|
+
/** Draws a separator above this item. @default false */
|
|
812
|
+
divider?: boolean;
|
|
813
|
+
}
|
|
814
|
+
/** Props for the ITDropdownMenu component. */
|
|
815
|
+
interface ITDropdownMenuProps {
|
|
816
|
+
/** Menu actions. */
|
|
817
|
+
items: ITDropdownMenuItem[];
|
|
818
|
+
/** Custom trigger content. Defaults to a vertical ellipsis icon. */
|
|
819
|
+
trigger?: ReactNode;
|
|
820
|
+
/** Accessible label for the trigger button. @default "Abrir menú" */
|
|
821
|
+
triggerLabel?: string;
|
|
822
|
+
/** Placement of the menu relative to the trigger. Valid values: `"bottom-start"`, `"bottom-end"`, `"top-start"`, `"top-end"`. @default "bottom-end" */
|
|
823
|
+
placement?: "bottom-start" | "bottom-end" | "top-start" | "top-end";
|
|
824
|
+
/** Fired after an item is activated, with its id and definition. */
|
|
825
|
+
onSelect?: (id: string, item: ITDropdownMenuItem) => void;
|
|
826
|
+
/** Disables the trigger. @default false */
|
|
827
|
+
disabled?: boolean;
|
|
828
|
+
/** Additional CSS classes for the trigger button. */
|
|
829
|
+
className?: string;
|
|
830
|
+
/** Additional CSS classes for the menu panel. */
|
|
831
|
+
menuClassName?: string;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* Action menu with keyboard navigation and ARIA menu semantics.
|
|
836
|
+
*
|
|
837
|
+
* Renders the menu through a portal so it escapes `overflow: hidden` and
|
|
838
|
+
* transformed ancestors, and flips above the trigger when there is no room
|
|
839
|
+
* below.
|
|
840
|
+
*
|
|
841
|
+
* @example
|
|
842
|
+
* <ITDropdownMenu
|
|
843
|
+
* items={[
|
|
844
|
+
* { id: "edit", label: "Editar", icon: <FaEdit />, onClick: edit },
|
|
845
|
+
* { id: "delete", label: "Eliminar", icon: <FaTrash />, danger: true, divider: true, onClick: remove },
|
|
846
|
+
* ]}
|
|
847
|
+
* />
|
|
848
|
+
*/
|
|
849
|
+
declare function ITDropdownMenu({ items, trigger, triggerLabel, placement, onSelect, disabled, className, menuClassName, }: ITDropdownMenuProps): react_jsx_runtime.JSX.Element;
|
|
850
|
+
|
|
851
|
+
/** Props for the ITField form-field wrapper. */
|
|
852
|
+
interface ITFieldProps {
|
|
853
|
+
/** Label rendered above the control. */
|
|
854
|
+
label?: string;
|
|
855
|
+
/** `id` of the control the label points to (`htmlFor`). */
|
|
856
|
+
htmlFor?: string;
|
|
857
|
+
/** Shows a red asterisk next to the label. @default false */
|
|
858
|
+
required?: boolean;
|
|
859
|
+
/** Validation error. Pass `true` for the generic message or a string for a custom one. */
|
|
860
|
+
error?: string | boolean;
|
|
861
|
+
/** Helper text shown below the control when there is no error. */
|
|
862
|
+
helpText?: string;
|
|
863
|
+
/** The form control (ITInput, ITSelect, ITTextarea, …). */
|
|
864
|
+
children: ReactNode;
|
|
865
|
+
/** Additional CSS classes for the wrapper. */
|
|
866
|
+
className?: string;
|
|
867
|
+
/** Additional CSS classes for the label. */
|
|
868
|
+
labelClassName?: string;
|
|
869
|
+
/** Additional CSS classes for the control container. */
|
|
870
|
+
contentClassName?: string;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* Form-field wrapper that standardizes label, required marker, helper text,
|
|
875
|
+
* and error message around any control.
|
|
876
|
+
*
|
|
877
|
+
* Keeps spacing and error styling consistent across forms so each control
|
|
878
|
+
* does not re-implement label/error logic.
|
|
879
|
+
*
|
|
880
|
+
* @example
|
|
881
|
+
* <ITField label="Email" htmlFor="email" required error={errors.email} helpText="We never share it.">
|
|
882
|
+
* <ITInput name="email" value={email} onChange={onChange} />
|
|
883
|
+
* </ITField>
|
|
884
|
+
*/
|
|
885
|
+
declare function ITField({ label, htmlFor, required, error, helpText, children, className, labelClassName, contentClassName, }: ITFieldProps): react_jsx_runtime.JSX.Element;
|
|
886
|
+
|
|
887
|
+
interface ITMaskedInputProps {
|
|
888
|
+
/** Unique name attribute for the underlying input element. */
|
|
889
|
+
name: string;
|
|
890
|
+
/**
|
|
891
|
+
* Mask pattern. Tokens are filled by the user and everything else is an
|
|
892
|
+
* auto-inserted literal.
|
|
893
|
+
* - `9` — digit
|
|
894
|
+
* - `A` — letter (stored uppercase)
|
|
895
|
+
* - `a` — letter
|
|
896
|
+
* - `x` — alphanumeric
|
|
897
|
+
* - `*` — any character
|
|
898
|
+
* - any other character ( `-`, `/`, `(`, `)`, ` `, `.` ) is a literal separator
|
|
899
|
+
* @example "xxxx-xxxx-xxxx"
|
|
900
|
+
* @example "(999) 999-9999"
|
|
901
|
+
* @example "9999-9999-9999-9999"
|
|
902
|
+
*/
|
|
903
|
+
mask: string;
|
|
904
|
+
/** Clean value containing only the useful characters (no separators, no placeholders). */
|
|
905
|
+
value?: string;
|
|
906
|
+
/** Called when the masked value changes. `event.target.value` is the raw value without separators. */
|
|
907
|
+
onChange: (event: {
|
|
908
|
+
target: {
|
|
909
|
+
name: string;
|
|
910
|
+
value: string;
|
|
911
|
+
};
|
|
912
|
+
}) => void;
|
|
913
|
+
/** Called when the input loses focus. */
|
|
914
|
+
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
915
|
+
/** Fired when all token slots are filled with valid characters. */
|
|
916
|
+
onComplete?: (value: string) => void;
|
|
917
|
+
/** Optional regex full-matched against the raw value to validate the field (e.g. `/^\\d{16}$/`). */
|
|
918
|
+
pattern?: RegExp;
|
|
919
|
+
/** Character shown for empty token slots. @default "_" */
|
|
920
|
+
placeholderChar?: string;
|
|
921
|
+
/** Color variant matching the design system (ColorsTypes). @default "primary" */
|
|
922
|
+
variant?: ColorsTypes;
|
|
923
|
+
/** Size preset: "sm" | "md" | "lg". @default "md" */
|
|
924
|
+
size?: SizesTypes;
|
|
925
|
+
/** Label displayed above the input. */
|
|
926
|
+
label?: string;
|
|
927
|
+
/** Disables the input. @default false */
|
|
928
|
+
disabled?: boolean;
|
|
929
|
+
/** Marks the field as required. */
|
|
930
|
+
required?: boolean;
|
|
931
|
+
/** Visually indicates the field has been interacted with. */
|
|
932
|
+
touched?: boolean;
|
|
933
|
+
/** Error state — pass a string message or `true` for default styling. */
|
|
934
|
+
error?: string | boolean;
|
|
935
|
+
/** Additional CSS classes for the outer wrapper element. */
|
|
936
|
+
className?: string;
|
|
937
|
+
/** Additional CSS classes for the underlying input container. */
|
|
938
|
+
containerClassName?: string;
|
|
939
|
+
/** Icon element rendered on the left side of the input. */
|
|
940
|
+
iconLeft?: ReactNode;
|
|
941
|
+
/** Icon element rendered on the right side of the input. */
|
|
942
|
+
iconRight?: ReactNode;
|
|
943
|
+
/** Auto-focus the input on mount. @default false */
|
|
944
|
+
autoFocus?: boolean;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
/**
|
|
948
|
+
* Text input that applies a formatting mask while the user types, exposing only
|
|
949
|
+
* the clean (raw) value through `onChange`.
|
|
950
|
+
*
|
|
951
|
+
* The mask is defined by a pattern string. Tokens are filled by the user and
|
|
952
|
+
* any other character acts as an auto-inserted literal separator. Empty slots
|
|
953
|
+
* are painted with `placeholderChar`, so the mask is always visible.
|
|
954
|
+
*
|
|
955
|
+
* @example
|
|
956
|
+
* ```tsx
|
|
957
|
+
* <ITMaskedInput
|
|
958
|
+
* name="code"
|
|
959
|
+
* mask="xxxx-xxxx-xxxx"
|
|
960
|
+
* label="Código"
|
|
961
|
+
* onChange={(e) => setCode(e.target.value)}
|
|
962
|
+
* />
|
|
963
|
+
* ```
|
|
964
|
+
*
|
|
965
|
+
* @example
|
|
966
|
+
* ```tsx
|
|
967
|
+
* <ITMaskedInput
|
|
968
|
+
* name="phone"
|
|
969
|
+
* mask="(999) 999-9999"
|
|
970
|
+
* pattern={/^\d{10}$/}
|
|
971
|
+
* onChange={(e) => setPhone(e.target.value)}
|
|
972
|
+
* />
|
|
973
|
+
* ```
|
|
974
|
+
*
|
|
975
|
+
* @example
|
|
976
|
+
* ```tsx
|
|
977
|
+
* <ITMaskedInput
|
|
978
|
+
* name="card"
|
|
979
|
+
* mask="9999-9999-9999-9999"
|
|
980
|
+
* onComplete={(card) => validateCard(card)}
|
|
981
|
+
* />
|
|
982
|
+
* ```
|
|
983
|
+
*/
|
|
984
|
+
declare function ITMaskedInput({ name, mask, value, onChange, onBlur, onComplete, pattern, placeholderChar, variant, size, label, disabled, required, touched, error, className, containerClassName, iconLeft, iconRight, autoFocus, }: ITMaskedInputProps): react_jsx_runtime.JSX.Element;
|
|
985
|
+
|
|
986
|
+
/** Represents an option in the multi-select dropdown. */
|
|
987
|
+
interface ITMultiSelectOption {
|
|
988
|
+
/** Display label for the option. */
|
|
989
|
+
label: string;
|
|
990
|
+
/** Value associated with the option. */
|
|
991
|
+
value: string | number;
|
|
992
|
+
/** Additional custom fields can be attached. */
|
|
993
|
+
[key: string]: any;
|
|
994
|
+
}
|
|
995
|
+
/** Props for the ITMultiSelect component. */
|
|
996
|
+
interface ITMultiSelectProps {
|
|
997
|
+
/** Name attribute for form integrations. */
|
|
998
|
+
name?: string;
|
|
999
|
+
/** Label displayed above the control. */
|
|
1000
|
+
label?: string;
|
|
1001
|
+
/** Placeholder shown when no value is selected. @default "Selecciona opciones" */
|
|
1002
|
+
placeholder?: string;
|
|
1003
|
+
/** Available options. */
|
|
1004
|
+
options: ITMultiSelectOption[];
|
|
1005
|
+
/** Selected values (controlled). */
|
|
1006
|
+
value: (string | number)[];
|
|
1007
|
+
/** Fired with the next selected values and their option objects. */
|
|
1008
|
+
onChange?: (values: (string | number)[], options: ITMultiSelectOption[]) => void;
|
|
1009
|
+
/** Fired when the control loses focus. */
|
|
1010
|
+
onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
|
|
1011
|
+
/** Field used as the option value. @default "value" */
|
|
1012
|
+
valueField?: string;
|
|
1013
|
+
/** Field used as the option display label. @default "label" */
|
|
1014
|
+
labelField?: string;
|
|
1015
|
+
/** Disables the control. @default false */
|
|
1016
|
+
disabled?: boolean;
|
|
1017
|
+
/** Read-only mode: chips shown, no editing. @default false */
|
|
1018
|
+
readOnly?: boolean;
|
|
1019
|
+
/** Marks the field as required (red asterisk). @default false */
|
|
1020
|
+
required?: boolean;
|
|
1021
|
+
/** Whether the field has been touched (form validation). */
|
|
1022
|
+
touched?: boolean;
|
|
1023
|
+
/** Error message or boolean indicating an error state. */
|
|
1024
|
+
error?: string | boolean;
|
|
1025
|
+
/** Control size. Valid values: `"sm"`, `"md"`, `"lg"`. @default "md" */
|
|
1026
|
+
size?: SizesTypes;
|
|
1027
|
+
/** Maximum number of chips shown before collapsing into "+N". @default 3 */
|
|
1028
|
+
maxVisibleChips?: number;
|
|
1029
|
+
/** Shows a clear-all (X) button. @default true */
|
|
1030
|
+
clearable?: boolean;
|
|
1031
|
+
/** Enables the search input inside the control. @default true */
|
|
1032
|
+
searchable?: boolean;
|
|
1033
|
+
/** Callback for server-side search. Receives the query string. */
|
|
1034
|
+
onSearch?: (query: string) => void;
|
|
1035
|
+
/** Whether options are loading from an external source. @default false */
|
|
1036
|
+
isLoading?: boolean;
|
|
1037
|
+
/** Message shown when no options match. @default "No se encontraron resultados" */
|
|
1038
|
+
noResultsMessage?: string;
|
|
1039
|
+
/** Custom template for each dropdown option. */
|
|
1040
|
+
renderOption?: (option: ITMultiSelectOption, state: {
|
|
1041
|
+
isSelected: boolean;
|
|
1042
|
+
searchTerm: string;
|
|
1043
|
+
}) => ReactNode;
|
|
1044
|
+
/** Additional CSS classes for the container. */
|
|
1045
|
+
className?: string;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
/**
|
|
1049
|
+
* Multi-value select with searchable dropdown, removable chips, and keyboard navigation.
|
|
1050
|
+
*
|
|
1051
|
+
* Supports local filtering and remote search (`onSearch`), a collapsed chip
|
|
1052
|
+
* summary (`maxVisibleChips`), and custom option templates (`renderOption`).
|
|
1053
|
+
* The dropdown is portaled so it is never clipped by cards or overflow ancestors.
|
|
1054
|
+
*
|
|
1055
|
+
* @example
|
|
1056
|
+
* <ITMultiSelect
|
|
1057
|
+
* label="Skills"
|
|
1058
|
+
* options={skills}
|
|
1059
|
+
* value={selected}
|
|
1060
|
+
* onChange={(values) => setSelected(values)}
|
|
1061
|
+
* />
|
|
1062
|
+
*
|
|
1063
|
+
* @example
|
|
1064
|
+
* <ITMultiSelect
|
|
1065
|
+
* label="Etiquetas"
|
|
1066
|
+
* options={tags}
|
|
1067
|
+
* value={selected}
|
|
1068
|
+
* onChange={(values) => setSelected(values)}
|
|
1069
|
+
* maxVisibleChips={2}
|
|
1070
|
+
* renderOption={(option, { isSelected }) => (
|
|
1071
|
+
* <span className={isSelected ? "font-bold" : ""}>{option.label}</span>
|
|
1072
|
+
* )}
|
|
1073
|
+
* />
|
|
1074
|
+
*/
|
|
1075
|
+
declare function ITMultiSelect({ name, label, placeholder, options, value, onChange, onBlur, valueField, labelField, disabled, readOnly, required, touched, error, size, maxVisibleChips, clearable, searchable, onSearch, isLoading, noResultsMessage, renderOption, className, }: ITMultiSelectProps): react_jsx_runtime.JSX.Element;
|
|
1076
|
+
|
|
602
1077
|
interface ITConfirmDialogProps {
|
|
603
1078
|
/** Controls whether the confirmation dialog is visible. */
|
|
604
1079
|
isOpen: boolean;
|
|
@@ -1239,75 +1714,191 @@ interface FieldConfigV2 {
|
|
|
1239
1714
|
onChangeAction?: (val: any, context: FieldContextV2) => void | Promise<void>;
|
|
1240
1715
|
}
|
|
1241
1716
|
|
|
1717
|
+
/**
|
|
1718
|
+
* A single field change event, mirroring the Formik public API surface so any
|
|
1719
|
+
* standard Formik binding (`formik.handleChange`) can be passed through.
|
|
1720
|
+
*/
|
|
1721
|
+
type ITFormBuilderChangeEvent = React.ChangeEvent<HTMLInputElement> | React.FocusEvent<HTMLInputElement> | React.ChangeEvent<HTMLSelectElement> | {
|
|
1722
|
+
target: {
|
|
1723
|
+
name: string;
|
|
1724
|
+
value: any;
|
|
1725
|
+
};
|
|
1726
|
+
};
|
|
1727
|
+
/**
|
|
1728
|
+
* A single field blur event, mirroring the Formik public API surface so any
|
|
1729
|
+
* standard Formik binding (`formik.handleBlur`) can be passed through.
|
|
1730
|
+
*/
|
|
1731
|
+
type ITFormBuilderBlurEvent = React.FocusEvent<HTMLInputElement> | React.FocusEvent<HTMLSelectElement, Element> | React.FocusEvent<HTMLTextAreaElement, Element> | {
|
|
1732
|
+
target: {
|
|
1733
|
+
name: string;
|
|
1734
|
+
value: any;
|
|
1735
|
+
};
|
|
1736
|
+
};
|
|
1737
|
+
/**
|
|
1738
|
+
* Form-level values keyed by field `name`. Kept as `Record<string, unknown>` so
|
|
1739
|
+
* the builder does not impose a concrete domain shape on consumers.
|
|
1740
|
+
*/
|
|
1741
|
+
type ITFormBuilderValues = Record<string, unknown>;
|
|
1742
|
+
/**
|
|
1743
|
+
* Validation errors keyed by field `name`.
|
|
1744
|
+
*/
|
|
1745
|
+
type ITFormBuilderErrors = Record<string, string | undefined>;
|
|
1746
|
+
/**
|
|
1747
|
+
* Touch state keyed by field `name`.
|
|
1748
|
+
*/
|
|
1749
|
+
type ITFormBuilderTouched = Record<string, boolean>;
|
|
1750
|
+
/**
|
|
1751
|
+
* Props for {@link ITFormBuilder}. The component accepts either a legacy V1
|
|
1752
|
+
* `fields` array (kept for backward compatibility with projects that adopted
|
|
1753
|
+
* the original API) or the richer V2 `config` array. If both are supplied the
|
|
1754
|
+
* V2 `config` takes precedence; if neither is supplied the component renders
|
|
1755
|
+
* nothing.
|
|
1756
|
+
*/
|
|
1242
1757
|
interface ITFormBuilderProps {
|
|
1243
|
-
/**
|
|
1758
|
+
/**
|
|
1759
|
+
* Legacy V1 field definitions.
|
|
1760
|
+
*
|
|
1761
|
+
* @deprecated Prefer the `config` prop (V2). V1 is preserved for backward
|
|
1762
|
+
* compatibility and supports a reduced subset of features (no rules engine,
|
|
1763
|
+
* no `section`, no `custom`, no async options).
|
|
1764
|
+
*/
|
|
1244
1765
|
fields?: FieldConfig[];
|
|
1245
|
-
/**
|
|
1766
|
+
/**
|
|
1767
|
+
* V2 field configuration array. The recommended entry point. Supports the
|
|
1768
|
+
* rules engine (`renderWhen` / `dynamicProps` / `dependsOn`), nested
|
|
1769
|
+
* `sections`, custom renderers via `type: "custom"`, async option loaders, and
|
|
1770
|
+
* per-field `validation` / `asyncValidation`.
|
|
1771
|
+
*
|
|
1772
|
+
* When this prop is supplied it shadows any `fields` prop.
|
|
1773
|
+
*/
|
|
1246
1774
|
config?: FieldConfigV2[];
|
|
1247
|
-
/**
|
|
1775
|
+
/**
|
|
1776
|
+
* Number of grid columns used by the responsive layout. Allowed range is
|
|
1777
|
+
* 1..12; values outside the supported grid map fall back to a 12-column
|
|
1778
|
+
* layout. @default 12
|
|
1779
|
+
*/
|
|
1248
1780
|
columns?: number;
|
|
1249
|
-
/** Current form values keyed by field name */
|
|
1250
|
-
values:
|
|
1251
|
-
/**
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
/**
|
|
1266
|
-
|
|
1267
|
-
/**
|
|
1268
|
-
|
|
1269
|
-
|
|
1781
|
+
/** Current form values keyed by field `name`. */
|
|
1782
|
+
values: ITFormBuilderValues;
|
|
1783
|
+
/**
|
|
1784
|
+
* Change handler invoked by every rendered input/select/textarea. Designed
|
|
1785
|
+
* to receive the native `event` from a controlled child, so a Formik
|
|
1786
|
+
* `handleChange` can be passed directly.
|
|
1787
|
+
*/
|
|
1788
|
+
handleChange: (event: ITFormBuilderChangeEvent) => void;
|
|
1789
|
+
/**
|
|
1790
|
+
* Blur handler invoked by every rendered input/select/textarea. Designed
|
|
1791
|
+
* to receive the native `event` from a controlled child, so a Formik
|
|
1792
|
+
* `handleBlur` can be passed directly.
|
|
1793
|
+
*/
|
|
1794
|
+
handleBlur: (event: ITFormBuilderBlurEvent) => void;
|
|
1795
|
+
/** Touch state keyed by field `name`. */
|
|
1796
|
+
touched: ITFormBuilderTouched;
|
|
1797
|
+
/** Validation errors keyed by field `name`. */
|
|
1798
|
+
errors: ITFormBuilderErrors;
|
|
1799
|
+
/**
|
|
1800
|
+
* Programmatically sets a field value. Mirrors Formik's
|
|
1801
|
+
* `setFieldValue(field, value, shouldValidate?)` so it can be passed through.
|
|
1802
|
+
* Required to enable V2 features such as `onChangeAction` and
|
|
1803
|
+
* `dynamicProps` side effects. Defaults to a no-op.
|
|
1804
|
+
*/
|
|
1270
1805
|
setFieldValue?: (field: string, value: any, shouldValidate?: boolean) => Promise<void | any>;
|
|
1271
|
-
/**
|
|
1806
|
+
/**
|
|
1807
|
+
* Programmatically marks a field as touched. Mirrors Formik's
|
|
1808
|
+
* `setFieldTouched(field, touched?, shouldValidate?)`. Defaults to a no-op.
|
|
1809
|
+
*/
|
|
1272
1810
|
setFieldTouched?: (field: string, touched?: boolean, shouldValidate?: boolean) => Promise<void | any>;
|
|
1273
|
-
/**
|
|
1811
|
+
/**
|
|
1812
|
+
* Programmatically sets a field-level error message (Formik parity). Defaults
|
|
1813
|
+
* to a no-op.
|
|
1814
|
+
*/
|
|
1274
1815
|
setFieldError?: (field: string, message: string | undefined) => void;
|
|
1275
|
-
/**
|
|
1816
|
+
/** True while the parent form is submitting. Surfaced via the form context. */
|
|
1276
1817
|
isSubmitting?: boolean;
|
|
1818
|
+
/**
|
|
1819
|
+
* Optional children rendered **inside** the V2 `ITFormBuilderProvider`,
|
|
1820
|
+
* after the field grid. Useful for custom submit buttons or progress
|
|
1821
|
+
* badges that read live state via {@link useFormBuilder} /
|
|
1822
|
+
* `useITFormBuilderContext`. Ignored in the V1 (legacy) path because
|
|
1823
|
+
* no provider is mounted there.
|
|
1824
|
+
*/
|
|
1825
|
+
children?: React.ReactNode;
|
|
1277
1826
|
}
|
|
1278
1827
|
|
|
1279
1828
|
/**
|
|
1280
|
-
*
|
|
1281
|
-
*
|
|
1282
|
-
*
|
|
1283
|
-
*
|
|
1284
|
-
*
|
|
1285
|
-
*
|
|
1829
|
+
* `ITFormBuilder` is a declarative form generator. It renders a responsive
|
|
1830
|
+
* grid of inputs from either a legacy V1 `fields` array or the richer V2
|
|
1831
|
+
* `config` array and wires every rendered input/select/date to the supplied
|
|
1832
|
+
* Formik-style `handleChange`/`handleBlur`/`setFieldValue` callbacks.
|
|
1833
|
+
*
|
|
1834
|
+
* **V2 features (recommended):**
|
|
1835
|
+
* - Rules engine: `renderWhen`, `dynamicProps`, `dependsOn`.
|
|
1836
|
+
* - Section grouping with `type: "section"`.
|
|
1837
|
+
* - Custom renderers with `type: "custom"`.
|
|
1838
|
+
* - Async option loaders via `options: () => Promise<...>`.
|
|
1839
|
+
* - Per-field `onChangeAction` for derived fields and side effects.
|
|
1840
|
+
* - Nested sections and grids via `fields?: FieldConfigV2[]`.
|
|
1841
|
+
*
|
|
1842
|
+
* **V1 (legacy):**
|
|
1843
|
+
* The `fields` prop accepts a simpler shape (`text` / `number` / `password` /
|
|
1844
|
+
* `select` / `date`) without rules, sections, or async options. Kept for
|
|
1845
|
+
* backward compatibility.
|
|
1846
|
+
*
|
|
1847
|
+
* The component is fully controlled: it does not own form state. Wrap it in a
|
|
1848
|
+
* Formik `<Formik>` (or any state holder of your choice) and forward its
|
|
1849
|
+
* `values`, `handleChange`, `handleBlur`, `touched`, `errors`, and
|
|
1850
|
+
* `setFieldValue` props.
|
|
1851
|
+
*
|
|
1852
|
+
* @example Minimal login form (V1)
|
|
1853
|
+
* ```tsx
|
|
1286
1854
|
* <ITFormBuilder
|
|
1287
1855
|
* fields={[
|
|
1288
|
-
* { name: "email", label: "Email", type: "text", required: true, column:
|
|
1289
|
-
* { name: "
|
|
1856
|
+
* { name: "email", label: "Email", type: "text", required: true, column: 12 },
|
|
1857
|
+
* { name: "password", label: "Password", type: "password", required: true, column: 12 },
|
|
1290
1858
|
* ]}
|
|
1291
|
-
* values={
|
|
1292
|
-
* handleChange={handleChange}
|
|
1293
|
-
* handleBlur={handleBlur}
|
|
1294
|
-
* touched={touched}
|
|
1295
|
-
* errors={errors}
|
|
1296
|
-
* columns={12}
|
|
1859
|
+
* values={formik.values}
|
|
1860
|
+
* handleChange={formik.handleChange}
|
|
1861
|
+
* handleBlur={formik.handleBlur}
|
|
1862
|
+
* touched={formik.touched}
|
|
1863
|
+
* errors={formik.errors}
|
|
1297
1864
|
* />
|
|
1865
|
+
* ```
|
|
1866
|
+
*
|
|
1867
|
+
* @example Conditional RFC field with derived total (V2)
|
|
1868
|
+
* ```tsx
|
|
1869
|
+
* const config: FieldConfigV2[] = [
|
|
1870
|
+
* { name: "country", label: "País", type: "select", required: true,
|
|
1871
|
+
* options: [{ value: "MX", label: "México" }, { value: "US", label: "USA" }] },
|
|
1872
|
+
* { name: "rfc", label: "RFC", type: "text", required: true,
|
|
1873
|
+
* dependsOn: ["country"], renderWhen: (v) => v.country === "MX" },
|
|
1874
|
+
* { name: "subtotal", label: "Subtotal", type: "number", currencyFormat: true,
|
|
1875
|
+
* onChangeAction: (val, ctx) => ctx.setFieldValue("total", (Number(val) * 1.16).toFixed(2)) },
|
|
1876
|
+
* { name: "total", label: "Total", type: "number", currencyFormat: true, disabled: true },
|
|
1877
|
+
* ];
|
|
1298
1878
|
*
|
|
1299
|
-
* @example
|
|
1300
1879
|
* <ITFormBuilder
|
|
1301
|
-
* config={
|
|
1302
|
-
* values={
|
|
1303
|
-
* handleChange={handleChange}
|
|
1304
|
-
* handleBlur={handleBlur}
|
|
1305
|
-
* touched={touched}
|
|
1306
|
-
* errors={errors}
|
|
1307
|
-
*
|
|
1880
|
+
* config={config}
|
|
1881
|
+
* values={formik.values}
|
|
1882
|
+
* handleChange={formik.handleChange}
|
|
1883
|
+
* handleBlur={formik.handleBlur}
|
|
1884
|
+
* touched={formik.touched}
|
|
1885
|
+
* errors={formik.errors}
|
|
1886
|
+
* setFieldValue={formik.setFieldValue}
|
|
1308
1887
|
* />
|
|
1888
|
+
* ```
|
|
1889
|
+
*
|
|
1890
|
+
* @example Reading form progress from a custom submit button
|
|
1891
|
+
* ```tsx
|
|
1892
|
+
* const SubmitButton = () => {
|
|
1893
|
+
* const { progress } = useFormBuilder();
|
|
1894
|
+
* return <button disabled={progress < 100}>Submit ({progress}%)</button>;
|
|
1895
|
+
* };
|
|
1896
|
+
*
|
|
1897
|
+
* <ITFormBuilder config={config} values={...} ... />
|
|
1898
|
+
* <SubmitButton />
|
|
1899
|
+
* ```
|
|
1309
1900
|
*/
|
|
1310
|
-
declare function ITFormBuilder({ fields, config, columns, values, handleChange, handleBlur, touched, errors, setFieldValue, setFieldTouched, setFieldError, isSubmitting, }: ITFormBuilderProps): react_jsx_runtime.JSX.Element;
|
|
1901
|
+
declare function ITFormBuilder({ fields, config, columns, values, handleChange, handleBlur, touched, errors, setFieldValue, setFieldTouched, setFieldError, isSubmitting, children, }: ITFormBuilderProps): react_jsx_runtime.JSX.Element;
|
|
1311
1902
|
|
|
1312
1903
|
interface ITFormHeaderProps {
|
|
1313
1904
|
/** Header title text */
|
|
@@ -1912,6 +2503,15 @@ interface ITSearchSelectProps {
|
|
|
1912
2503
|
isLoading?: boolean;
|
|
1913
2504
|
/** Message displayed when no results are found. Default: "No se encontraron resultados". */
|
|
1914
2505
|
noResultsMessage?: string;
|
|
2506
|
+
/** Custom template for each option in the dropdown list. Receives the option and its state (`isSelected`, `searchTerm`). */
|
|
2507
|
+
renderOption?: (option: ITSearchSelectOption, state: {
|
|
2508
|
+
isSelected: boolean;
|
|
2509
|
+
searchTerm: string;
|
|
2510
|
+
}) => ReactNode;
|
|
2511
|
+
/** Shows a clear (X) button inside the input. Default: true. */
|
|
2512
|
+
clearable?: boolean;
|
|
2513
|
+
/** Callback fired when the clear button is pressed. */
|
|
2514
|
+
onClear?: () => void;
|
|
1915
2515
|
}
|
|
1916
2516
|
|
|
1917
2517
|
/**
|
|
@@ -1941,9 +2541,21 @@ interface ITSearchSelectProps {
|
|
|
1941
2541
|
* value={selectedUser}
|
|
1942
2542
|
* onChange={(value) => setSelectedUser(value)}
|
|
1943
2543
|
* />
|
|
2544
|
+
*
|
|
2545
|
+
* // Custom option template + clear button
|
|
2546
|
+
* <ITSearchSelect
|
|
2547
|
+
* label="User"
|
|
2548
|
+
* options={users}
|
|
2549
|
+
* value={selectedUser}
|
|
2550
|
+
* onChange={(value) => setSelectedUser(value)}
|
|
2551
|
+
* onClear={() => console.log("cleared")}
|
|
2552
|
+
* renderOption={(option, { isSelected }) => (
|
|
2553
|
+
* <span className={isSelected ? "font-bold" : ""}>{option.label}</span>
|
|
2554
|
+
* )}
|
|
2555
|
+
* />
|
|
1944
2556
|
* ```
|
|
1945
2557
|
*/
|
|
1946
|
-
declare function ITSearchSelect({ name, options, label, placeholder, valueField, labelField, value, onChange, onBlur, disabled, className, touched, required, error, readOnly, onSearch, isLoading, noResultsMessage, size, }: ITSearchSelectProps): react_jsx_runtime.JSX.Element;
|
|
2558
|
+
declare function ITSearchSelect({ name, options, label, placeholder, valueField, labelField, value, onChange, onBlur, disabled, className, touched, required, error, readOnly, onSearch, isLoading, noResultsMessage, size, renderOption, clearable, onClear, }: ITSearchSelectProps): react_jsx_runtime.JSX.Element;
|
|
1947
2559
|
|
|
1948
2560
|
/** A generic key-value option: e.g. { value: "mx", label: "Mexico" }. */
|
|
1949
2561
|
interface OptionType {
|
|
@@ -2564,6 +3176,59 @@ interface ITToastProps {
|
|
|
2564
3176
|
*/
|
|
2565
3177
|
declare function ITToast({ message, type, duration, position, onClose, }: ITToastProps): react_jsx_runtime.JSX.Element;
|
|
2566
3178
|
|
|
3179
|
+
/** Toolbar actions supported by ITWysiwyg. */
|
|
3180
|
+
type ToolbarAction = "bold" | "italic" | "underline" | "highlight" | "ul" | "ol" | "clear";
|
|
3181
|
+
interface ITWysiwygProps {
|
|
3182
|
+
/** Controlled HTML value rendered inside the editor. Overrides the visible content only while the editor is not focused (avoids caret jumps). */
|
|
3183
|
+
value?: string;
|
|
3184
|
+
/** Callback fired with the editor's HTML whenever the content changes. */
|
|
3185
|
+
onChange?: (html: string) => void;
|
|
3186
|
+
/** Label text rendered above the editor. */
|
|
3187
|
+
label?: string;
|
|
3188
|
+
/** Placeholder text shown when the editor is empty. */
|
|
3189
|
+
placeholder?: string;
|
|
3190
|
+
/** Validation error message displayed below the editor. */
|
|
3191
|
+
error?: string;
|
|
3192
|
+
/** Disables the editor and toolbar when true. @default false */
|
|
3193
|
+
disabled?: boolean;
|
|
3194
|
+
/** Renders content in read-only mode (not editable, toolbar disabled). @default false */
|
|
3195
|
+
readOnly?: boolean;
|
|
3196
|
+
/** Name attribute for form submission and label association via `htmlFor`. */
|
|
3197
|
+
name?: string;
|
|
3198
|
+
/** Editor size: controls padding and font size. Valid values: `"sm"`, `"md"`, `"lg"`. @default "md" */
|
|
3199
|
+
size?: SizesTypes;
|
|
3200
|
+
/** Minimum height in pixels of the editable area. @default 128 */
|
|
3201
|
+
minHeight?: number;
|
|
3202
|
+
/** Background color used by the marker tool (yellow highlight). @default "#fde68a" */
|
|
3203
|
+
highlightColor?: string;
|
|
3204
|
+
/** Subset of toolbar actions to render. @default all actions */
|
|
3205
|
+
toolbar?: ToolbarAction[];
|
|
3206
|
+
/** Additional CSS classes for the wrapper. */
|
|
3207
|
+
className?: string;
|
|
3208
|
+
}
|
|
3209
|
+
|
|
3210
|
+
/**
|
|
3211
|
+
* Lightweight WYSIWYG editor (no external rich-text dependency). Provides bold,
|
|
3212
|
+
* italic, underline, a yellow marker highlight and ordered/unordered lists.
|
|
3213
|
+
* Formatting is applied manually over the Selection/Range API (no deprecated
|
|
3214
|
+
* `document.execCommand`), toggling elements by wrapping/unwrapping text nodes.
|
|
3215
|
+
*
|
|
3216
|
+
* The component is uncontrolled at the DOM level: it renders `value` lazily and
|
|
3217
|
+
* only re-syncs it when the editor is not focused (`onChange` reports the HTML).
|
|
3218
|
+
*
|
|
3219
|
+
* @example
|
|
3220
|
+
* <ITWysiwyg
|
|
3221
|
+
* label="Descripción"
|
|
3222
|
+
* value={content}
|
|
3223
|
+
* onChange={setContent}
|
|
3224
|
+
* placeholder="Escribe aquí..."
|
|
3225
|
+
* />
|
|
3226
|
+
*
|
|
3227
|
+
* @example
|
|
3228
|
+
* <ITWysiwyg size="lg" highlightColor="#fef08a" toolbar={["bold", "ul"]} />
|
|
3229
|
+
*/
|
|
3230
|
+
declare function ITWysiwyg({ value, onChange, label, placeholder, error, disabled, readOnly, name, size, minHeight, highlightColor, toolbar, className, }: ITWysiwygProps): react_jsx_runtime.JSX.Element;
|
|
3231
|
+
|
|
2567
3232
|
/** Allowed file MIME types for the dropzone */
|
|
2568
3233
|
declare enum FileTypeEnum {
|
|
2569
3234
|
PDF = "application/pdf",
|
|
@@ -3129,4 +3794,4 @@ declare const resolveCssColor: (colorStr: string, palette?: ITThemePalette$1, is
|
|
|
3129
3794
|
*/
|
|
3130
3795
|
declare const getContrastTextColor: (bgColor: string, palette?: ITThemePalette$1, isDarkMode?: boolean) => "text-white" | "text-slate-800";
|
|
3131
3796
|
|
|
3132
|
-
export { type Column, type FieldConfig, type FieldConfigV2, FileTypeEnum, ITAlert, type ITAlertProps, ITAvatar, type ITAvatarProps, ITBadget, type ITBadgetProps, type ITBreadcrumbItem, ITBreadcrumbs, type ITBreadcrumbsProps, ITButton, type ITButtonProps, ITCalendar, type ITCalendarProps, ITCard, type ITCardProps, ITCheckbox, type ITCheckboxProps, ITConfirmDialog, type ITConfirmDialogProps, ITDataTable, type ITDataTableFetchParams, type ITDataTableProps, type ITDataTableResponse, ITDatePicker, type ITDatePickerProps, ITDialog, type ITDialogProps, ITDivider, type ITDividerProps, ITDrawer, type ITDrawerProps, ITDropfile, ITEmptyState, type ITEmptyStateProps, ITFlex, type ITFlexProps, ITFormBuilder, type ITFormBuilderProps, ITFormHeader, type ITFormHeaderProps, ITGrid, type ITGridProps, ITImage, type ITImageProps, ITInput, type ITInputProps, ITLayout, type ITLayoutProps, ITLoader, type LoaderProps as ITLoaderProps, ITNavbar, type ITNavbarProps, type ITNavigationItem, type ITNavigationSubItem, ITPage, ITPageHeader, type ITPageHeaderProps, type ITPageProps, ITPagination, type ITPaginationProps, ITPopover, type ITPopoverProps, ITProgress, type ITProgressProps, ITRadioGroup, type ITRadioGroupProps, type ITRadioOption, ITSearchSelect, type ITSearchSelectProps, ITSearchTable, type ITSearchTableProps, ITSegmentedControl, type ITSegmentedControlProps, ITSelect, type ITSelectProps, ITSidebar, type ITSidebarProps, ITSkeleton, type ITSkeletonProps, ITSlideToggle, type ITSlideToggleProps, ITSlider, type ITSliderProps, ITStack, type ITStackProps, ITStatCard, type ITStatCardProps, ITStepper, type ITStepperProps, type ITTabItem, ITTable, type ITTableProps, ITTabs, type ITTabsProps, ITText, type ITTextProps, ITTextarea, type ITTextareaProps, type ITThemeConfig, type ITThemePalette$1 as ITThemePalette, ITThemeProvider, type ITThemeProviderProps, ITTimePicker, type ITTimePickerProps, ITToast, type ITToastProps, ITTripleFilter, type ITTripleFilterOption, type ITTripleFilterProps, UploadStatus, type UseTableStateOptions, type UseTableStateResult, createValidationSchema, getContrastTextColor, isLightColor, resolveCssColor, useClickOutside, useDebouncedSearch, useEditableRow, useITTheme, useITThemeSafe, useTableState };
|
|
3797
|
+
export { type Column, type FieldConfig, type FieldConfigV2, FileTypeEnum, ITAccordion, type ITAccordionItem, type ITAccordionProps, ITAlert, type ITAlertProps, ITAvatar, type ITAvatarProps, ITBadget, type ITBadgetProps, type ITBreadcrumbItem, ITBreadcrumbs, type ITBreadcrumbsProps, ITButton, type ITButtonProps, ITCalendar, type ITCalendarProps, ITCard, type ITCardProps, ITCheckbox, type ITCheckboxProps, ITChip, ITChipInput, type ITChipInputProps, type ITChipProps, ITConfirmDialog, type ITConfirmDialogProps, ITDataTable, type ITDataTableFetchParams, type ITDataTableProps, type ITDataTableResponse, ITDatePicker, type ITDatePickerProps, ITDialog, type ITDialogProps, ITDivider, type ITDividerProps, ITDrawer, type ITDrawerProps, ITDropdownMenu, type ITDropdownMenuItem, type ITDropdownMenuProps, ITDropfile, ITEmptyState, type ITEmptyStateProps, ITField, type ITFieldProps, ITFlex, type ITFlexProps, ITFormBuilder, type ITFormBuilderProps, ITFormHeader, type ITFormHeaderProps, ITGrid, type ITGridProps, ITImage, type ITImageProps, ITInput, type ITInputProps, ITLayout, type ITLayoutProps, ITLoader, type LoaderProps as ITLoaderProps, ITMaskedInput, type ITMaskedInputProps, ITMultiSelect, type ITMultiSelectOption, type ITMultiSelectProps, ITNavbar, type ITNavbarProps, type ITNavigationItem, type ITNavigationSubItem, ITPage, ITPageHeader, type ITPageHeaderProps, type ITPageProps, ITPagination, type ITPaginationProps, ITPopover, type ITPopoverProps, ITProgress, type ITProgressProps, ITRadioGroup, type ITRadioGroupProps, type ITRadioOption, ITSearchSelect, type ITSearchSelectProps, ITSearchTable, type ITSearchTableProps, ITSegmentedControl, type ITSegmentedControlProps, ITSelect, type ITSelectProps, ITSidebar, type ITSidebarProps, ITSkeleton, type ITSkeletonProps, ITSlideToggle, type ITSlideToggleProps, ITSlider, type ITSliderProps, ITStack, type ITStackProps, ITStatCard, type ITStatCardProps, ITStepper, type ITStepperProps, type ITTabItem, ITTable, type ITTableProps, ITTabs, type ITTabsProps, ITText, type ITTextProps, ITTextarea, type ITTextareaProps, type ITThemeConfig, type ITThemePalette$1 as ITThemePalette, ITThemeProvider, type ITThemeProviderProps, ITTimePicker, type ITTimePickerProps, ITToast, type ITToastProps, ITTripleFilter, type ITTripleFilterOption, type ITTripleFilterProps, ITWysiwyg, type ITWysiwygProps, UploadStatus, type UseTableStateOptions, type UseTableStateResult, createValidationSchema, getContrastTextColor, isLightColor, resolveCssColor, useClickOutside, useDebouncedSearch, useEditableRow, useFloatingPanel, useITTheme, useITThemeSafe, useTableState };
|