@axzydev/axzy_ui_system 1.2.15 → 1.3.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.
Files changed (60) hide show
  1. package/dist/index.cjs +3067 -1409
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.css +1 -1
  4. package/dist/index.d.cts +620 -54
  5. package/dist/index.d.ts +620 -54
  6. package/dist/index.js +2983 -1320
  7. package/dist/index.js.map +1 -1
  8. package/package.json +1 -1
  9. package/src/App.tsx +28 -0
  10. package/src/components/atoms/badget/badget.tsx +2 -4
  11. package/src/components/atoms/chip/chip.doc.mdx +47 -0
  12. package/src/components/atoms/chip/chip.props.ts +32 -0
  13. package/src/components/atoms/chip/chip.stories.tsx +64 -0
  14. package/src/components/atoms/chip/chip.tsx +112 -0
  15. package/src/components/atoms/grid/grid.tsx +1 -2
  16. package/src/components/molecules/accordion/accordion.doc.mdx +47 -0
  17. package/src/components/molecules/accordion/accordion.props.ts +35 -0
  18. package/src/components/molecules/accordion/accordion.stories.tsx +68 -0
  19. package/src/components/molecules/accordion/accordion.tsx +123 -0
  20. package/src/components/molecules/chip-input/chip-input.doc.mdx +44 -0
  21. package/src/components/molecules/chip-input/chip-input.props.ts +42 -0
  22. package/src/components/molecules/chip-input/chip-input.stories.tsx +52 -0
  23. package/src/components/molecules/chip-input/chip-input.tsx +205 -0
  24. package/src/components/molecules/date-picker/datePicker.tsx +45 -56
  25. package/src/components/molecules/dropdown-menu/dropdown-menu.doc.mdx +46 -0
  26. package/src/components/molecules/dropdown-menu/dropdown-menu.props.ts +41 -0
  27. package/src/components/molecules/dropdown-menu/dropdown-menu.stories.tsx +41 -0
  28. package/src/components/molecules/dropdown-menu/dropdown-menu.tsx +219 -0
  29. package/src/components/molecules/field/field.doc.mdx +43 -0
  30. package/src/components/molecules/field/field.props.ts +23 -0
  31. package/src/components/molecules/field/field.stories.tsx +42 -0
  32. package/src/components/molecules/field/field.tsx +54 -0
  33. package/src/components/molecules/multi-select/multi-select.doc.mdx +55 -0
  34. package/src/components/molecules/multi-select/multi-select.props.ts +65 -0
  35. package/src/components/molecules/multi-select/multi-select.stories.tsx +59 -0
  36. package/src/components/molecules/multi-select/multi-select.tsx +386 -0
  37. package/src/components/molecules/search-select/search-select.doc.mdx +5 -0
  38. package/src/components/molecules/search-select/search-select.props.ts +10 -1
  39. package/src/components/molecules/search-select/search-select.stories.tsx +18 -0
  40. package/src/components/molecules/search-select/search-select.tsx +102 -28
  41. package/src/components/molecules/time-picker/timePicker.tsx +14 -26
  42. package/src/components/molecules/wysiwyg/wysiwyg.props.ts +51 -0
  43. package/src/components/molecules/wysiwyg/wysiwyg.stories.tsx +95 -0
  44. package/src/components/molecules/wysiwyg/wysiwyg.tsx +609 -0
  45. package/src/components/organisms/data-table/dataTable.tsx +16 -5
  46. package/src/components/organisms/form-builder/fieldRenderer.tsx +144 -27
  47. package/src/components/organisms/form-builder/formBuilder.context.tsx +77 -15
  48. package/src/components/organisms/form-builder/formBuilder.doc.mdx +213 -86
  49. package/src/components/organisms/form-builder/formBuilder.props.ts +118 -36
  50. package/src/components/organisms/form-builder/formBuilder.stories.tsx +694 -96
  51. package/src/components/organisms/form-builder/formBuilder.tsx +152 -69
  52. package/src/components/organisms/form-builder/useFormBuilder.ts +59 -21
  53. package/src/hooks/useFloatingPanel.ts +100 -0
  54. package/src/index.ts +24 -4
  55. package/src/showcases/DataShowcases.tsx +76 -0
  56. package/src/showcases/FormShowcases.tsx +396 -10
  57. package/src/showcases/HomeShowcase.tsx +6 -6
  58. package/src/showcases/NavigationShowcases.tsx +72 -2
  59. package/src/showcases/StructureShowcases.tsx +64 -0
  60. 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, { ReactNode, CSSProperties, ElementType, FocusEvent, HTMLAttributes } from 'react';
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,298 @@ 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
+ /** Represents an option in the multi-select dropdown. */
888
+ interface ITMultiSelectOption {
889
+ /** Display label for the option. */
890
+ label: string;
891
+ /** Value associated with the option. */
892
+ value: string | number;
893
+ /** Additional custom fields can be attached. */
894
+ [key: string]: any;
895
+ }
896
+ /** Props for the ITMultiSelect component. */
897
+ interface ITMultiSelectProps {
898
+ /** Name attribute for form integrations. */
899
+ name?: string;
900
+ /** Label displayed above the control. */
901
+ label?: string;
902
+ /** Placeholder shown when no value is selected. @default "Selecciona opciones" */
903
+ placeholder?: string;
904
+ /** Available options. */
905
+ options: ITMultiSelectOption[];
906
+ /** Selected values (controlled). */
907
+ value: (string | number)[];
908
+ /** Fired with the next selected values and their option objects. */
909
+ onChange?: (values: (string | number)[], options: ITMultiSelectOption[]) => void;
910
+ /** Fired when the control loses focus. */
911
+ onBlur?: (e: React.FocusEvent<HTMLInputElement>) => void;
912
+ /** Field used as the option value. @default "value" */
913
+ valueField?: string;
914
+ /** Field used as the option display label. @default "label" */
915
+ labelField?: string;
916
+ /** Disables the control. @default false */
917
+ disabled?: boolean;
918
+ /** Read-only mode: chips shown, no editing. @default false */
919
+ readOnly?: boolean;
920
+ /** Marks the field as required (red asterisk). @default false */
921
+ required?: boolean;
922
+ /** Whether the field has been touched (form validation). */
923
+ touched?: boolean;
924
+ /** Error message or boolean indicating an error state. */
925
+ error?: string | boolean;
926
+ /** Control size. Valid values: `"sm"`, `"md"`, `"lg"`. @default "md" */
927
+ size?: SizesTypes;
928
+ /** Maximum number of chips shown before collapsing into "+N". @default 3 */
929
+ maxVisibleChips?: number;
930
+ /** Shows a clear-all (X) button. @default true */
931
+ clearable?: boolean;
932
+ /** Enables the search input inside the control. @default true */
933
+ searchable?: boolean;
934
+ /** Callback for server-side search. Receives the query string. */
935
+ onSearch?: (query: string) => void;
936
+ /** Whether options are loading from an external source. @default false */
937
+ isLoading?: boolean;
938
+ /** Message shown when no options match. @default "No se encontraron resultados" */
939
+ noResultsMessage?: string;
940
+ /** Custom template for each dropdown option. */
941
+ renderOption?: (option: ITMultiSelectOption, state: {
942
+ isSelected: boolean;
943
+ searchTerm: string;
944
+ }) => ReactNode;
945
+ /** Additional CSS classes for the container. */
946
+ className?: string;
947
+ }
948
+
949
+ /**
950
+ * Multi-value select with searchable dropdown, removable chips, and keyboard navigation.
951
+ *
952
+ * Supports local filtering and remote search (`onSearch`), a collapsed chip
953
+ * summary (`maxVisibleChips`), and custom option templates (`renderOption`).
954
+ * The dropdown is portaled so it is never clipped by cards or overflow ancestors.
955
+ *
956
+ * @example
957
+ * <ITMultiSelect
958
+ * label="Skills"
959
+ * options={skills}
960
+ * value={selected}
961
+ * onChange={(values) => setSelected(values)}
962
+ * />
963
+ *
964
+ * @example
965
+ * <ITMultiSelect
966
+ * label="Etiquetas"
967
+ * options={tags}
968
+ * value={selected}
969
+ * onChange={(values) => setSelected(values)}
970
+ * maxVisibleChips={2}
971
+ * renderOption={(option, { isSelected }) => (
972
+ * <span className={isSelected ? "font-bold" : ""}>{option.label}</span>
973
+ * )}
974
+ * />
975
+ */
976
+ 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;
977
+
602
978
  interface ITConfirmDialogProps {
603
979
  /** Controls whether the confirmation dialog is visible. */
604
980
  isOpen: boolean;
@@ -1239,75 +1615,191 @@ interface FieldConfigV2 {
1239
1615
  onChangeAction?: (val: any, context: FieldContextV2) => void | Promise<void>;
1240
1616
  }
1241
1617
 
1618
+ /**
1619
+ * A single field change event, mirroring the Formik public API surface so any
1620
+ * standard Formik binding (`formik.handleChange`) can be passed through.
1621
+ */
1622
+ type ITFormBuilderChangeEvent = React.ChangeEvent<HTMLInputElement> | React.FocusEvent<HTMLInputElement> | React.ChangeEvent<HTMLSelectElement> | {
1623
+ target: {
1624
+ name: string;
1625
+ value: any;
1626
+ };
1627
+ };
1628
+ /**
1629
+ * A single field blur event, mirroring the Formik public API surface so any
1630
+ * standard Formik binding (`formik.handleBlur`) can be passed through.
1631
+ */
1632
+ type ITFormBuilderBlurEvent = React.FocusEvent<HTMLInputElement> | React.FocusEvent<HTMLSelectElement, Element> | React.FocusEvent<HTMLTextAreaElement, Element> | {
1633
+ target: {
1634
+ name: string;
1635
+ value: any;
1636
+ };
1637
+ };
1638
+ /**
1639
+ * Form-level values keyed by field `name`. Kept as `Record<string, unknown>` so
1640
+ * the builder does not impose a concrete domain shape on consumers.
1641
+ */
1642
+ type ITFormBuilderValues = Record<string, unknown>;
1643
+ /**
1644
+ * Validation errors keyed by field `name`.
1645
+ */
1646
+ type ITFormBuilderErrors = Record<string, string | undefined>;
1647
+ /**
1648
+ * Touch state keyed by field `name`.
1649
+ */
1650
+ type ITFormBuilderTouched = Record<string, boolean>;
1651
+ /**
1652
+ * Props for {@link ITFormBuilder}. The component accepts either a legacy V1
1653
+ * `fields` array (kept for backward compatibility with projects that adopted
1654
+ * the original API) or the richer V2 `config` array. If both are supplied the
1655
+ * V2 `config` takes precedence; if neither is supplied the component renders
1656
+ * nothing.
1657
+ */
1242
1658
  interface ITFormBuilderProps {
1243
- /** Legacy field definitions (V1). Use `config` for the V2 architecture instead */
1659
+ /**
1660
+ * Legacy V1 field definitions.
1661
+ *
1662
+ * @deprecated Prefer the `config` prop (V2). V1 is preserved for backward
1663
+ * compatibility and supports a reduced subset of features (no rules engine,
1664
+ * no `section`, no `custom`, no async options).
1665
+ */
1244
1666
  fields?: FieldConfig[];
1245
- /** V2 field configuration array. Preferred over the legacy `fields` prop */
1667
+ /**
1668
+ * V2 field configuration array. The recommended entry point. Supports the
1669
+ * rules engine (`renderWhen` / `dynamicProps` / `dependsOn`), nested
1670
+ * `sections`, custom renderers via `type: "custom"`, async option loaders, and
1671
+ * per-field `validation` / `asyncValidation`.
1672
+ *
1673
+ * When this prop is supplied it shadows any `fields` prop.
1674
+ */
1246
1675
  config?: FieldConfigV2[];
1247
- /** Number of grid columns (1-12) */
1676
+ /**
1677
+ * Number of grid columns used by the responsive layout. Allowed range is
1678
+ * 1..12; values outside the supported grid map fall back to a 12-column
1679
+ * layout. @default 12
1680
+ */
1248
1681
  columns?: number;
1249
- /** Current form values keyed by field name */
1250
- values: any;
1251
- /** Change handler for input, select, and textarea elements */
1252
- handleChange: (event: React.ChangeEvent<HTMLInputElement> | React.FocusEvent<HTMLInputElement> | React.ChangeEvent<HTMLSelectElement> | {
1253
- target: {
1254
- name: string;
1255
- value: any;
1256
- };
1257
- }) => void;
1258
- /** Blur handler for input, select, and textarea elements */
1259
- handleBlur: (event: React.FocusEvent<HTMLInputElement> | React.FocusEvent<HTMLSelectElement, Element> | React.FocusEvent<HTMLTextAreaElement, Element> | {
1260
- target: {
1261
- name: string;
1262
- value: any;
1263
- };
1264
- }) => void;
1265
- /** Touch state keyed by field name */
1266
- touched: any;
1267
- /** Validation errors keyed by field name */
1268
- errors: any;
1269
- /** Programmatically set a field value */
1682
+ /** Current form values keyed by field `name`. */
1683
+ values: ITFormBuilderValues;
1684
+ /**
1685
+ * Change handler invoked by every rendered input/select/textarea. Designed
1686
+ * to receive the native `event` from a controlled child, so a Formik
1687
+ * `handleChange` can be passed directly.
1688
+ */
1689
+ handleChange: (event: ITFormBuilderChangeEvent) => void;
1690
+ /**
1691
+ * Blur handler invoked by every rendered input/select/textarea. Designed
1692
+ * to receive the native `event` from a controlled child, so a Formik
1693
+ * `handleBlur` can be passed directly.
1694
+ */
1695
+ handleBlur: (event: ITFormBuilderBlurEvent) => void;
1696
+ /** Touch state keyed by field `name`. */
1697
+ touched: ITFormBuilderTouched;
1698
+ /** Validation errors keyed by field `name`. */
1699
+ errors: ITFormBuilderErrors;
1700
+ /**
1701
+ * Programmatically sets a field value. Mirrors Formik's
1702
+ * `setFieldValue(field, value, shouldValidate?)` so it can be passed through.
1703
+ * Required to enable V2 features such as `onChangeAction` and
1704
+ * `dynamicProps` side effects. Defaults to a no-op.
1705
+ */
1270
1706
  setFieldValue?: (field: string, value: any, shouldValidate?: boolean) => Promise<void | any>;
1271
- /** Programmatically mark a field as touched */
1707
+ /**
1708
+ * Programmatically marks a field as touched. Mirrors Formik's
1709
+ * `setFieldTouched(field, touched?, shouldValidate?)`. Defaults to a no-op.
1710
+ */
1272
1711
  setFieldTouched?: (field: string, touched?: boolean, shouldValidate?: boolean) => Promise<void | any>;
1273
- /** Programmatically set a field-level error message */
1712
+ /**
1713
+ * Programmatically sets a field-level error message (Formik parity). Defaults
1714
+ * to a no-op.
1715
+ */
1274
1716
  setFieldError?: (field: string, message: string | undefined) => void;
1275
- /** Whether the form is currently submitting */
1717
+ /** True while the parent form is submitting. Surfaced via the form context. */
1276
1718
  isSubmitting?: boolean;
1719
+ /**
1720
+ * Optional children rendered **inside** the V2 `ITFormBuilderProvider`,
1721
+ * after the field grid. Useful for custom submit buttons or progress
1722
+ * badges that read live state via {@link useFormBuilder} /
1723
+ * `useITFormBuilderContext`. Ignored in the V1 (legacy) path because
1724
+ * no provider is mounted there.
1725
+ */
1726
+ children?: React.ReactNode;
1277
1727
  }
1278
1728
 
1279
1729
  /**
1280
- * Dynamic form generator from field definitions with validation support.
1281
- * Renders a responsive grid of inputs, selects, and date pickers based on
1282
- * the provided field configuration. Supports both legacy (`fields`) and
1283
- * V2 (`config`) field definition formats.
1284
- *
1285
- * @example
1730
+ * `ITFormBuilder` is a declarative form generator. It renders a responsive
1731
+ * grid of inputs from either a legacy V1 `fields` array or the richer V2
1732
+ * `config` array and wires every rendered input/select/date to the supplied
1733
+ * Formik-style `handleChange`/`handleBlur`/`setFieldValue` callbacks.
1734
+ *
1735
+ * **V2 features (recommended):**
1736
+ * - Rules engine: `renderWhen`, `dynamicProps`, `dependsOn`.
1737
+ * - Section grouping with `type: "section"`.
1738
+ * - Custom renderers with `type: "custom"`.
1739
+ * - Async option loaders via `options: () => Promise<...>`.
1740
+ * - Per-field `onChangeAction` for derived fields and side effects.
1741
+ * - Nested sections and grids via `fields?: FieldConfigV2[]`.
1742
+ *
1743
+ * **V1 (legacy):**
1744
+ * The `fields` prop accepts a simpler shape (`text` / `number` / `password` /
1745
+ * `select` / `date`) without rules, sections, or async options. Kept for
1746
+ * backward compatibility.
1747
+ *
1748
+ * The component is fully controlled: it does not own form state. Wrap it in a
1749
+ * Formik `<Formik>` (or any state holder of your choice) and forward its
1750
+ * `values`, `handleChange`, `handleBlur`, `touched`, `errors`, and
1751
+ * `setFieldValue` props.
1752
+ *
1753
+ * @example Minimal login form (V1)
1754
+ * ```tsx
1286
1755
  * <ITFormBuilder
1287
1756
  * fields={[
1288
- * { name: "email", label: "Email", type: "text", required: true, column: 6 },
1289
- * { name: "role", label: "Role", type: "select", options: [{ id: 1, label: "Admin" }], column: 6 },
1757
+ * { name: "email", label: "Email", type: "text", required: true, column: 12 },
1758
+ * { name: "password", label: "Password", type: "password", required: true, column: 12 },
1290
1759
  * ]}
1291
- * values={formValues}
1292
- * handleChange={handleChange}
1293
- * handleBlur={handleBlur}
1294
- * touched={touched}
1295
- * errors={errors}
1296
- * columns={12}
1760
+ * values={formik.values}
1761
+ * handleChange={formik.handleChange}
1762
+ * handleBlur={formik.handleBlur}
1763
+ * touched={formik.touched}
1764
+ * errors={formik.errors}
1297
1765
  * />
1766
+ * ```
1767
+ *
1768
+ * @example Conditional RFC field with derived total (V2)
1769
+ * ```tsx
1770
+ * const config: FieldConfigV2[] = [
1771
+ * { name: "country", label: "País", type: "select", required: true,
1772
+ * options: [{ value: "MX", label: "México" }, { value: "US", label: "USA" }] },
1773
+ * { name: "rfc", label: "RFC", type: "text", required: true,
1774
+ * dependsOn: ["country"], renderWhen: (v) => v.country === "MX" },
1775
+ * { name: "subtotal", label: "Subtotal", type: "number", currencyFormat: true,
1776
+ * onChangeAction: (val, ctx) => ctx.setFieldValue("total", (Number(val) * 1.16).toFixed(2)) },
1777
+ * { name: "total", label: "Total", type: "number", currencyFormat: true, disabled: true },
1778
+ * ];
1298
1779
  *
1299
- * @example
1300
1780
  * <ITFormBuilder
1301
- * config={v2FieldConfigs}
1302
- * values={formValues}
1303
- * handleChange={handleChange}
1304
- * handleBlur={handleBlur}
1305
- * touched={touched}
1306
- * errors={errors}
1307
- * isSubmitting={loading}
1781
+ * config={config}
1782
+ * values={formik.values}
1783
+ * handleChange={formik.handleChange}
1784
+ * handleBlur={formik.handleBlur}
1785
+ * touched={formik.touched}
1786
+ * errors={formik.errors}
1787
+ * setFieldValue={formik.setFieldValue}
1308
1788
  * />
1789
+ * ```
1790
+ *
1791
+ * @example Reading form progress from a custom submit button
1792
+ * ```tsx
1793
+ * const SubmitButton = () => {
1794
+ * const { progress } = useFormBuilder();
1795
+ * return <button disabled={progress < 100}>Submit ({progress}%)</button>;
1796
+ * };
1797
+ *
1798
+ * <ITFormBuilder config={config} values={...} ... />
1799
+ * <SubmitButton />
1800
+ * ```
1309
1801
  */
1310
- declare function ITFormBuilder({ fields, config, columns, values, handleChange, handleBlur, touched, errors, setFieldValue, setFieldTouched, setFieldError, isSubmitting, }: ITFormBuilderProps): react_jsx_runtime.JSX.Element;
1802
+ declare function ITFormBuilder({ fields, config, columns, values, handleChange, handleBlur, touched, errors, setFieldValue, setFieldTouched, setFieldError, isSubmitting, children, }: ITFormBuilderProps): react_jsx_runtime.JSX.Element;
1311
1803
 
1312
1804
  interface ITFormHeaderProps {
1313
1805
  /** Header title text */
@@ -1912,6 +2404,15 @@ interface ITSearchSelectProps {
1912
2404
  isLoading?: boolean;
1913
2405
  /** Message displayed when no results are found. Default: "No se encontraron resultados". */
1914
2406
  noResultsMessage?: string;
2407
+ /** Custom template for each option in the dropdown list. Receives the option and its state (`isSelected`, `searchTerm`). */
2408
+ renderOption?: (option: ITSearchSelectOption, state: {
2409
+ isSelected: boolean;
2410
+ searchTerm: string;
2411
+ }) => ReactNode;
2412
+ /** Shows a clear (X) button inside the input. Default: true. */
2413
+ clearable?: boolean;
2414
+ /** Callback fired when the clear button is pressed. */
2415
+ onClear?: () => void;
1915
2416
  }
1916
2417
 
1917
2418
  /**
@@ -1941,9 +2442,21 @@ interface ITSearchSelectProps {
1941
2442
  * value={selectedUser}
1942
2443
  * onChange={(value) => setSelectedUser(value)}
1943
2444
  * />
2445
+ *
2446
+ * // Custom option template + clear button
2447
+ * <ITSearchSelect
2448
+ * label="User"
2449
+ * options={users}
2450
+ * value={selectedUser}
2451
+ * onChange={(value) => setSelectedUser(value)}
2452
+ * onClear={() => console.log("cleared")}
2453
+ * renderOption={(option, { isSelected }) => (
2454
+ * <span className={isSelected ? "font-bold" : ""}>{option.label}</span>
2455
+ * )}
2456
+ * />
1944
2457
  * ```
1945
2458
  */
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;
2459
+ 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
2460
 
1948
2461
  /** A generic key-value option: e.g. { value: "mx", label: "Mexico" }. */
1949
2462
  interface OptionType {
@@ -2564,6 +3077,59 @@ interface ITToastProps {
2564
3077
  */
2565
3078
  declare function ITToast({ message, type, duration, position, onClose, }: ITToastProps): react_jsx_runtime.JSX.Element;
2566
3079
 
3080
+ /** Toolbar actions supported by ITWysiwyg. */
3081
+ type ToolbarAction = "bold" | "italic" | "underline" | "highlight" | "ul" | "ol" | "clear";
3082
+ interface ITWysiwygProps {
3083
+ /** Controlled HTML value rendered inside the editor. Overrides the visible content only while the editor is not focused (avoids caret jumps). */
3084
+ value?: string;
3085
+ /** Callback fired with the editor's HTML whenever the content changes. */
3086
+ onChange?: (html: string) => void;
3087
+ /** Label text rendered above the editor. */
3088
+ label?: string;
3089
+ /** Placeholder text shown when the editor is empty. */
3090
+ placeholder?: string;
3091
+ /** Validation error message displayed below the editor. */
3092
+ error?: string;
3093
+ /** Disables the editor and toolbar when true. @default false */
3094
+ disabled?: boolean;
3095
+ /** Renders content in read-only mode (not editable, toolbar disabled). @default false */
3096
+ readOnly?: boolean;
3097
+ /** Name attribute for form submission and label association via `htmlFor`. */
3098
+ name?: string;
3099
+ /** Editor size: controls padding and font size. Valid values: `"sm"`, `"md"`, `"lg"`. @default "md" */
3100
+ size?: SizesTypes;
3101
+ /** Minimum height in pixels of the editable area. @default 128 */
3102
+ minHeight?: number;
3103
+ /** Background color used by the marker tool (yellow highlight). @default "#fde68a" */
3104
+ highlightColor?: string;
3105
+ /** Subset of toolbar actions to render. @default all actions */
3106
+ toolbar?: ToolbarAction[];
3107
+ /** Additional CSS classes for the wrapper. */
3108
+ className?: string;
3109
+ }
3110
+
3111
+ /**
3112
+ * Lightweight WYSIWYG editor (no external rich-text dependency). Provides bold,
3113
+ * italic, underline, a yellow marker highlight and ordered/unordered lists.
3114
+ * Formatting is applied manually over the Selection/Range API (no deprecated
3115
+ * `document.execCommand`), toggling elements by wrapping/unwrapping text nodes.
3116
+ *
3117
+ * The component is uncontrolled at the DOM level: it renders `value` lazily and
3118
+ * only re-syncs it when the editor is not focused (`onChange` reports the HTML).
3119
+ *
3120
+ * @example
3121
+ * <ITWysiwyg
3122
+ * label="Descripción"
3123
+ * value={content}
3124
+ * onChange={setContent}
3125
+ * placeholder="Escribe aquí..."
3126
+ * />
3127
+ *
3128
+ * @example
3129
+ * <ITWysiwyg size="lg" highlightColor="#fef08a" toolbar={["bold", "ul"]} />
3130
+ */
3131
+ declare function ITWysiwyg({ value, onChange, label, placeholder, error, disabled, readOnly, name, size, minHeight, highlightColor, toolbar, className, }: ITWysiwygProps): react_jsx_runtime.JSX.Element;
3132
+
2567
3133
  /** Allowed file MIME types for the dropzone */
2568
3134
  declare enum FileTypeEnum {
2569
3135
  PDF = "application/pdf",
@@ -3129,4 +3695,4 @@ declare const resolveCssColor: (colorStr: string, palette?: ITThemePalette$1, is
3129
3695
  */
3130
3696
  declare const getContrastTextColor: (bgColor: string, palette?: ITThemePalette$1, isDarkMode?: boolean) => "text-white" | "text-slate-800";
3131
3697
 
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 };
3698
+ 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, 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 };