flysoft-react-ui 1.1.14 → 1.2.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 (37) hide show
  1. package/dist/components/form-controls/CurrencyInput.d.ts +24 -0
  2. package/dist/components/form-controls/CurrencyInput.d.ts.map +1 -0
  3. package/dist/components/form-controls/CurrencyInput.js +106 -0
  4. package/dist/components/form-controls/Input.js +1 -1
  5. package/dist/components/form-controls/index.d.ts +2 -0
  6. package/dist/components/form-controls/index.d.ts.map +1 -1
  7. package/dist/components/form-controls/index.js +1 -0
  8. package/dist/components/layout/AppLayout.d.ts.map +1 -1
  9. package/dist/components/layout/AppLayout.js +0 -2
  10. package/dist/components/layout/DropdownMenu.d.ts.map +1 -1
  11. package/dist/components/layout/DropdownMenu.js +2 -2
  12. package/dist/components/layout/DropdownPanel.d.ts.map +1 -1
  13. package/dist/components/layout/DropdownPanel.js +1 -1
  14. package/dist/components/layout/Filter.js +7 -7
  15. package/dist/contexts/CrudContext.d.ts +1 -1
  16. package/dist/contexts/CrudContext.d.ts.map +1 -1
  17. package/dist/docs/CurrencyInputDocs.d.ts +4 -0
  18. package/dist/docs/CurrencyInputDocs.d.ts.map +1 -0
  19. package/dist/docs/CurrencyInputDocs.js +22 -0
  20. package/dist/docs/DocsMenu.d.ts.map +1 -1
  21. package/dist/docs/DocsMenu.js +1 -1
  22. package/dist/docs/DocsRouter.d.ts.map +1 -1
  23. package/dist/docs/DocsRouter.js +2 -1
  24. package/dist/docs/ExampleFormDocs.d.ts.map +1 -1
  25. package/dist/docs/ExampleFormDocs.js +7 -2
  26. package/dist/docs/ListCrudDocs.tsx/ListCrudDocs.d.ts.map +1 -1
  27. package/dist/docs/ListCrudDocs.tsx/ListCrudDocs.js +25 -19
  28. package/dist/docs/SnackbarDocs.d.ts.map +1 -1
  29. package/dist/docs/SnackbarDocs.js +8 -1
  30. package/dist/helpers/getErrorMessage.d.ts.map +1 -1
  31. package/dist/helpers/getErrorMessage.js +0 -1
  32. package/dist/hooks/useAsyncRequest.d.ts +1 -1
  33. package/dist/hooks/useAsyncRequest.d.ts.map +1 -1
  34. package/dist/hooks/useAsyncRequest.js +4 -21
  35. package/dist/index.css +1 -1
  36. package/dist/index.js.map +1 -1
  37. package/package.json +1 -1
@@ -0,0 +1,24 @@
1
+ import React from "react";
2
+ import type { InputProps } from "./Input";
3
+ /**
4
+ * Props para el componente CurrencyInput.
5
+ * Extiende todas las props de Input excepto value y onChange, que se manejan de forma numérica.
6
+ */
7
+ export interface CurrencyInputProps extends Omit<InputProps, "value" | "onChange" | "type"> {
8
+ /**
9
+ * Valor numérico del input.
10
+ */
11
+ value?: number | null;
12
+ /**
13
+ * Callback que se ejecuta al perder el foco, devolviendo el valor numérico actualizado.
14
+ * Si se usa con react-hook-form (register), este callback será el de register.
15
+ */
16
+ onChange?: (value: any) => void;
17
+ }
18
+ /**
19
+ * Componente de entrada para valores monetarios.
20
+ * Muestra el valor formateado con separadores de miles (puntos) y decimales (comas).
21
+ * Al recibir el foco, quita los puntos para facilitar la edición.
22
+ */
23
+ export declare const CurrencyInput: React.ForwardRefExoticComponent<CurrencyInputProps & React.RefAttributes<HTMLInputElement>>;
24
+ //# sourceMappingURL=CurrencyInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CurrencyInput.d.ts","sourceRoot":"","sources":["../../../src/components/form-controls/CurrencyInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAEzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAG1C;;;GAGG;AACH,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAC9C,UAAU,EACV,OAAO,GAAG,UAAU,GAAG,MAAM,CAC9B;IACC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC;CACjC;AAED;;;;GAIG;AACH,eAAO,MAAM,aAAa,6FA8HxB,CAAC"}
@@ -0,0 +1,106 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React, { useState, useEffect, useCallback, useMemo } from "react";
3
+ import { Input } from "./Input";
4
+ import { useFormContext } from "react-hook-form";
5
+ /**
6
+ * Componente de entrada para valores monetarios.
7
+ * Muestra el valor formateado con separadores de miles (puntos) y decimales (comas).
8
+ * Al recibir el foco, quita los puntos para facilitar la edición.
9
+ */
10
+ export const CurrencyInput = React.forwardRef(({ value, onChange, onFocus, onBlur, ...props }, ref) => {
11
+ const [isFocused, setIsFocused] = useState(false);
12
+ const [displayValue, setDisplayValue] = useState("");
13
+ // Detectar si estamos en modo register (si viene 'name')
14
+ const isRegisterMode = useMemo(() => {
15
+ return "name" in props && props.name !== undefined;
16
+ }, [props]);
17
+ const fieldName = props.name;
18
+ // Obtener el contexto de react-hook-form si existe
19
+ const formContext = useFormContext();
20
+ const setValue = formContext?.setValue;
21
+ // Formateador para mostrar el valor final (con puntos y comas)
22
+ const formatToCurrency = useCallback((val) => {
23
+ if (val === null || val === undefined || isNaN(val))
24
+ return "";
25
+ return new Intl.NumberFormat("es-AR", {
26
+ minimumFractionDigits: 2,
27
+ maximumFractionDigits: 2,
28
+ }).format(val);
29
+ }, []);
30
+ // Formateador para cuando tiene el foco (sin puntos de miles)
31
+ const formatToFocus = useCallback((val) => {
32
+ if (val === null || val === undefined || isNaN(val))
33
+ return "";
34
+ return new Intl.NumberFormat("es-AR", {
35
+ minimumFractionDigits: 2,
36
+ maximumFractionDigits: 2,
37
+ useGrouping: false,
38
+ }).format(val);
39
+ }, []);
40
+ // Función para parsear el string de vuelta a número
41
+ const parseToNumeric = useCallback((val) => {
42
+ if (!val || val.trim() === "")
43
+ return null;
44
+ // Reemplazamos la coma por punto para que parseFloat funcione correctamente
45
+ const cleanValue = val.replace(/\./g, "").replace(",", ".");
46
+ const numeric = parseFloat(cleanValue);
47
+ return isNaN(numeric) ? null : numeric;
48
+ }, []);
49
+ // Valor actual a usar (del prop value o del formulario)
50
+ const numericValue = useMemo(() => {
51
+ if (isRegisterMode && formContext && fieldName) {
52
+ return formContext.watch(fieldName);
53
+ }
54
+ return value;
55
+ }, [isRegisterMode, formContext, fieldName, value]);
56
+ // Sincronizar el valor externo con el estado interno cuando no hay foco
57
+ useEffect(() => {
58
+ if (!isFocused) {
59
+ setDisplayValue(formatToCurrency(numericValue));
60
+ }
61
+ }, [numericValue, isFocused, formatToCurrency]);
62
+ const handleFocus = (e) => {
63
+ setIsFocused(true);
64
+ // Al ganar foco, mostramos el valor sin separadores de miles
65
+ setDisplayValue(formatToFocus(numericValue));
66
+ if (onFocus)
67
+ onFocus(e);
68
+ };
69
+ const handleBlur = (e) => {
70
+ setIsFocused(false);
71
+ const numericVal = parseToNumeric(displayValue);
72
+ // Notificamos el cambio
73
+ if (isRegisterMode && setValue && fieldName) {
74
+ // Si estamos en modo register con FormProvider, usamos setValue para guardar el número
75
+ setValue(fieldName, numericVal, {
76
+ shouldValidate: true,
77
+ shouldDirty: true,
78
+ shouldTouch: true,
79
+ });
80
+ }
81
+ else if (onChange) {
82
+ // Si no, llamamos al onChange tradicional
83
+ onChange(numericVal);
84
+ }
85
+ // Formateamos el valor final para mostrarlo al perder el foco
86
+ setDisplayValue(formatToCurrency(numericVal));
87
+ if (onBlur)
88
+ onBlur(e);
89
+ };
90
+ const handleChange = (e) => {
91
+ let val = e.target.value;
92
+ // Solo permitimos números y una sola coma
93
+ // Si el usuario presiona punto, lo convertimos a coma para facilitar la entrada
94
+ val = val.replace(/\./g, ",");
95
+ // Limpiamos caracteres no permitidos
96
+ val = val.replace(/[^0-9,]/g, "");
97
+ // Aseguramos que solo haya una coma
98
+ const parts = val.split(",");
99
+ if (parts.length > 2) {
100
+ val = parts[0] + "," + parts.slice(1).join("");
101
+ }
102
+ setDisplayValue(val);
103
+ };
104
+ return (_jsx(Input, { ...props, ref: ref, type: "text", value: displayValue, onChange: handleChange, onFocus: handleFocus, onBlur: handleBlur }));
105
+ });
106
+ CurrencyInput.displayName = "CurrencyInput";
@@ -7,7 +7,7 @@ export const Input = React.forwardRef(({ label, error, icon, iconPosition = "lef
7
7
  w-full border rounded-lg transition-colors focus:outline-none
8
8
  disabled:opacity-50 disabled:cursor-not-allowed
9
9
  font-[var(--font-default)] text-[var(--color-text-primary)]
10
- flysoft-input-reset
10
+ flysoft-input-reset box-border
11
11
  `;
12
12
  const readOnlyClasses = readOnly
13
13
  ? `border-transparent bg-transparent focus:ring-0`
@@ -8,6 +8,7 @@ export { DateInput } from "./DateInput";
8
8
  export { Pagination } from "./Pagination";
9
9
  export { Checkbox } from "./Checkbox";
10
10
  export { RadioButtonGroup } from "./RadioButtonGroup";
11
+ export { CurrencyInput } from "./CurrencyInput";
11
12
  export type { ButtonProps } from "./Button";
12
13
  export type { LinkButtonProps } from "./LinkButton";
13
14
  export type { InputProps } from "./Input";
@@ -18,4 +19,5 @@ export type { DateInputProps, DateInputFormat } from "./DateInput";
18
19
  export type { PaginationProps } from "./Pagination";
19
20
  export type { CheckboxProps } from "./Checkbox";
20
21
  export type { RadioButtonGroupProps, RadioOption } from "./RadioButtonGroup";
22
+ export type { CurrencyInputProps } from "./CurrencyInput";
21
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/form-controls/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE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AM,YAAY,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,YAAY,EACV,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,sBAAsB,EACtB,kBAAkB,GACnB,MAAM,yBAAyB,CAAC;AACjC,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,YAAY,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnE,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,YAAY,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC7E,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -8,3 +8,4 @@ export { DateInput } from "./DateInput";
8
8
  export { Pagination } from "./Pagination";
9
9
  export { Checkbox } from "./Checkbox";
10
10
  export { RadioButtonGroup } from "./RadioButtonGroup";
11
+ export { CurrencyInput } from "./CurrencyInput";
@@ -1 +1 @@
1
- {"version":3,"file":"AppLayout.d.ts","sourceRoot":"","sources":["../../../src/components/layout/AppLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAIhD,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AAEzC,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAmf9C,CAAC"}
1
+ {"version":3,"file":"AppLayout.d.ts","sourceRoot":"","sources":["../../../src/components/layout/AppLayout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAIhD,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACpB,MAAM,iCAAiC,CAAC;AAEzC,MAAM,WAAW,cAAc;IAC7B,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,cAAc,CAif9C,CAAC"}
@@ -23,8 +23,6 @@ export const AppLayout = ({ navbar, leftDrawer, contentFooter, children, classNa
23
23
  const isNavbarVisibleRef = useRef(isNavbarVisible);
24
24
  const isTransitioningRef = useRef(false);
25
25
  const lastScrollYRef = useRef(0);
26
- console.log("navbar", navbar);
27
- console.log("leftDrawer", leftDrawer);
28
26
  // Determinar si hay algún contenido en el drawer izquierdo
29
27
  const hasLeftDrawerContent = leftDrawerHeader || leftDrawerContent || leftDrawerFooter;
30
28
  const shouldShowMobileDrawer = isMobile || isTablet;
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownMenu.d.ts","sourceRoot":"","sources":["../../../src/components/layout/DropdownMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AAIf,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE;IACtD,OAAO,EAA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MAAM,CAAA;CAAE,EAAG,8GAQlD,iBAAiB,CAAC,CAAC,CAAC,4CAyPtB,CAAC"}
@@ -115,8 +115,8 @@ export const DropdownMenu = ({ options, onOptionSelected, renderNode, getOptionL
115
115
  }, 150); // Pequeño delay para permitir mover el mouse al menú
116
116
  };
117
117
  const handleOptionClick = (item) => {
118
- onOptionSelected(item);
119
118
  setIsOpen(false);
119
+ onOptionSelected(item);
120
120
  };
121
121
  // Si replaceOnSingleOption es true y hay una sola opción, mostrar directamente la opción
122
122
  const shouldReplace = replaceOnSingleOption && options.length === 1;
@@ -164,7 +164,7 @@ export const DropdownMenu = ({ options, onOptionSelected, renderNode, getOptionL
164
164
  }
165
165
  return (_jsxs("div", { className: "relative inline-block", ref: triggerRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: [_jsx("div", { onClick: handleToggle, className: "cursor-pointer", children: renderNode ? (renderNode) : (_jsx(Button, { variant: "ghost", icon: "fa-ellipsis-h" })) }), isOpen &&
166
166
  (typeof document !== "undefined" && document.body
167
- ? createPortal(_jsx("div", { ref: menuRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, className: "fixed z-[2000] bg-[var(--color-bg-default)] border border-[var(--color-border-default)] rounded-md shadow-[var(--shadow-lg)] py-1 min-w-[160px] font-[var(--font-default)]", style: menuStyles, children: options.map((option, index) => {
167
+ ? createPortal(_jsx("div", { ref: menuRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onClick: (e) => e.stopPropagation(), className: "fixed z-[2000] bg-[var(--color-bg-default)] border border-[var(--color-border-default)] rounded-md shadow-[var(--shadow-lg)] py-1 min-w-[160px] font-[var(--font-default)]", style: menuStyles, children: options.map((option, index) => {
168
168
  const key = String(option?.id ??
169
169
  labelGetter(option) ??
170
170
  index);
@@ -1 +1 @@
1
- {"version":3,"file":"DropdownPanel.d.ts","sourceRoot":"","sources":["../../../src/components/layout/DropdownPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AAIf,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,aAAa,GAAI,wCAI3B,kBAAkB,4CAoNpB,CAAC"}
1
+ {"version":3,"file":"DropdownPanel.d.ts","sourceRoot":"","sources":["../../../src/components/layout/DropdownPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAMN,MAAM,OAAO,CAAC;AAIf,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,eAAO,MAAM,aAAa,GAAI,wCAI3B,kBAAkB,4CAqNpB,CAAC"}
@@ -157,6 +157,6 @@ export const DropdownPanel = ({ renderNode, children, openOnHover = false, }) =>
157
157
  }, [isOpen, menuPosition, scrollUpdate]);
158
158
  return (_jsxs("div", { className: "relative inline-block", ref: triggerRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: [_jsx("div", { onClick: handleToggle, className: "cursor-pointer", children: renderNode ? (renderNode) : (_jsx(Button, { variant: "ghost", icon: "fa-ellipsis-h" })) }), isOpen &&
159
159
  (typeof document !== "undefined" && document.body
160
- ? createPortal(_jsx("div", { ref: menuRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, className: "fixed z-[2000] bg-[var(--color-bg-default)] border border-[var(--color-border-default)] rounded-md shadow-[var(--shadow-lg)] py-1 min-w-[160px] font-[var(--font-default)]", style: menuStyles, children: children }), document.body)
160
+ ? createPortal(_jsx("div", { ref: menuRef, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onClick: (e) => e.stopPropagation(), className: "fixed z-[2000] bg-[var(--color-bg-default)] border border-[var(--color-border-default)] rounded-md shadow-[var(--shadow-lg)] py-1 min-w-[160px] font-[var(--font-default)]", style: menuStyles, children: children }), document.body)
161
161
  : null)] }));
162
162
  };
@@ -518,12 +518,12 @@ export const Filter = (props) => {
518
518
  createPortal(_jsx("div", { ref: panelRef, className: "fixed z-[2001] w-fit rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-default)] shadow-[var(--shadow-lg)] p-4", style: {
519
519
  top: `${panelPosition.top}px`,
520
520
  left: `${panelPosition.left}px`,
521
- }, children: _jsxs("div", { className: "space-y-3", children: [staticOptions && staticOptions.length > 0 && (_jsx("ul", { className: "py-1 max-h-60 overflow-auto", children: staticOptions.map((option) => (_jsx("li", { className: `px-3 py-2 cursor-pointer flex items-center gap-2 text-sm rounded transition-colors ${currentValue === option.value
521
+ }, children: _jsxs("div", { className: "space-y-3", children: [staticOptions && staticOptions.length > 0 && (_jsx("ul", { className: "py-1 max-h-60 overflow-auto list-none pl-0", children: staticOptions.map((option) => (_jsx("li", { className: `px-3 py-2 cursor-pointer flex items-center justify-start text-left gap-2 text-sm rounded transition-colors ${currentValue === option.value
522
522
  ? "bg-[var(--color-primary-soft)] text-[var(--color-primary)]"
523
523
  : "text-[var(--color-text-primary)] hover:bg-[var(--color-bg-secondary)]"}`, onMouseDown: (e) => {
524
524
  e.preventDefault();
525
525
  handleStaticOptionSelect(option);
526
- }, children: _jsx("span", { className: "font-[var(--font-default)]", children: option.text }) }, option.value))) })), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { style: { width: finalInputWidth }, children: _jsx(AutocompleteInput, { ref: autocompleteInputRef, options: props.options, value: isUserTyping ? undefined : autocompleteValue, onChange: handleAutocompleteChange, getOptionLabel: props.getOptionLabel, getOptionValue: props.getOptionValue, renderOption: props.renderOption, noResultsText: props.noResultsText, onSelectOption: handleAutocompleteOptionSelect, disabled: disabled }) }), _jsx(Button, { onClick: handleAutocompleteSelect, icon: "fa-arrow-right", variant: "ghost" })] })] }) }), document.body)] }));
526
+ }, children: _jsx("span", { className: "font-[var(--font-default)]", children: option.text }) }, option.value))) })), _jsxs("div", { className: "flex items-center justify-start gap-2", children: [_jsx("div", { style: { width: finalInputWidth }, children: _jsx(AutocompleteInput, { ref: autocompleteInputRef, options: props.options, value: isUserTyping ? undefined : autocompleteValue, onChange: handleAutocompleteChange, getOptionLabel: props.getOptionLabel, getOptionValue: props.getOptionValue, renderOption: props.renderOption, noResultsText: props.noResultsText, onSelectOption: handleAutocompleteOptionSelect, disabled: disabled }) }), _jsx(Button, { onClick: handleAutocompleteSelect, icon: "fa-arrow-right", variant: "ghost" })] })] }) }), document.body)] }));
527
527
  }
528
528
  if (filterType === "date") {
529
529
  return (_jsxs("div", { ref: containerRef, className: `relative inline-block ${disabled ? "opacity-50 pointer-events-none" : ""}`, children: [_jsx(DataField, { label: label, value: badgeContainer, className: "inline-block" }), isOpen &&
@@ -533,12 +533,12 @@ export const Filter = (props) => {
533
533
  createPortal(_jsx("div", { ref: panelRef, className: "fixed z-[2001] w-fit rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-default)] shadow-[var(--shadow-lg)] p-4", style: {
534
534
  top: `${panelPosition.top}px`,
535
535
  left: `${panelPosition.left}px`,
536
- }, children: _jsxs("div", { className: "space-y-3", children: [staticOptions && staticOptions.length > 0 && (_jsx("ul", { className: "py-1 max-h-60 overflow-auto", children: staticOptions.map((option) => (_jsx("li", { className: `px-3 py-2 cursor-pointer flex items-center gap-2 text-sm rounded transition-colors ${currentValue === option.value
536
+ }, children: _jsxs("div", { className: "space-y-3", children: [staticOptions && staticOptions.length > 0 && (_jsx("ul", { className: "py-1 max-h-60 overflow-auto list-none pl-0", children: staticOptions.map((option) => (_jsx("li", { className: `px-3 py-2 cursor-pointer flex items-center justify-start text-left gap-2 text-sm rounded transition-colors ${currentValue === option.value
537
537
  ? "bg-[var(--color-primary-soft)] text-[var(--color-primary)]"
538
538
  : "text-[var(--color-text-primary)] hover:bg-[var(--color-bg-secondary)]"}`, onMouseDown: (e) => {
539
539
  e.preventDefault();
540
540
  handleStaticOptionSelect(option);
541
- }, children: _jsx("span", { className: "font-[var(--font-default)]", children: option.text }) }, option.value))) })), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { style: { width: finalInputWidth }, children: _jsx(DateInput, { ref: dateInputRef, value: dateValue, onChange: handleDateChange, format: "dd/mm/yyyy" }) }), _jsx(Button, { onClick: handleSetDateFilter, icon: "fa-arrow-right", variant: "ghost" })] })] }) }), document.body)] }));
541
+ }, children: _jsx("span", { className: "font-[var(--font-default)]", children: option.text }) }, option.value))) })), _jsxs("div", { className: "flex items-center justify-start gap-2", children: [_jsx("div", { style: { width: finalInputWidth }, children: _jsx(DateInput, { ref: dateInputRef, value: dateValue, onChange: handleDateChange, format: "dd/mm/yyyy" }) }), _jsx(Button, { onClick: handleSetDateFilter, icon: "fa-arrow-right", variant: "ghost" })] })] }) }), document.body)] }));
542
542
  }
543
543
  // Para searchSelect
544
544
  if (filterType === "searchSelect") {
@@ -550,7 +550,7 @@ export const Filter = (props) => {
550
550
  createPortal(_jsx("div", { ref: panelRef, className: "fixed z-[2001] w-fit rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-default)] shadow-[var(--shadow-lg)] p-4", style: {
551
551
  top: `${panelPosition.top}px`,
552
552
  left: `${panelPosition.left}px`,
553
- }, children: _jsxs("div", { className: "space-y-3", children: [staticOptions && staticOptions.length > 0 && (_jsx("ul", { className: "py-1 max-h-60 overflow-auto", children: staticOptions.map((option) => (_jsx("li", { className: `px-3 py-2 cursor-pointer flex items-center gap-2 text-sm rounded transition-colors ${currentValue === option.value
553
+ }, children: _jsxs("div", { className: "space-y-3", children: [staticOptions && staticOptions.length > 0 && (_jsx("ul", { className: "py-1 max-h-60 overflow-auto list-none pl-0", children: staticOptions.map((option) => (_jsx("li", { className: `px-3 py-2 cursor-pointer flex items-center justify-start text-left gap-2 text-sm rounded transition-colors ${currentValue === option.value
554
554
  ? "bg-[var(--color-primary-soft)] text-[var(--color-primary)]"
555
555
  : "text-[var(--color-text-primary)] hover:bg-[var(--color-bg-secondary)]"}`, onMouseDown: (e) => {
556
556
  e.preventDefault();
@@ -572,12 +572,12 @@ export const Filter = (props) => {
572
572
  createPortal(_jsx("div", { ref: panelRef, className: "fixed z-[2001] w-fit rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-default)] shadow-[var(--shadow-lg)] p-4", style: {
573
573
  top: `${panelPosition.top}px`,
574
574
  left: `${panelPosition.left}px`,
575
- }, children: _jsxs("div", { className: "space-y-3", children: [staticOptions && staticOptions.length > 0 && (_jsx("ul", { className: "py-1 max-h-60 overflow-auto", children: staticOptions.map((option) => (_jsx("li", { className: `px-3 py-2 cursor-pointer flex items-center gap-2 text-sm rounded transition-colors ${urlValue === option.value
575
+ }, children: _jsxs("div", { className: "space-y-3", children: [staticOptions && staticOptions.length > 0 && (_jsx("ul", { className: "py-1 max-h-60 overflow-auto list-none pl-0", children: staticOptions.map((option) => (_jsx("li", { className: `px-3 py-2 cursor-pointer flex items-center justify-start text-left gap-2 text-sm rounded transition-colors ${urlValue === option.value
576
576
  ? "bg-[var(--color-primary-soft)] text-[var(--color-primary)]"
577
577
  : "text-[var(--color-text-primary)] hover:bg-[var(--color-bg-secondary)]"}`, onMouseDown: (e) => {
578
578
  e.preventDefault();
579
579
  handleStaticOptionSelect(option);
580
- }, children: _jsx("span", { className: "font-[var(--font-default)]", children: option.text }) }, option.value))) })), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { style: { width: finalInputWidth }, children: _jsx(Input, { ref: inputRef, type: filterType === "number" ? "number" : "text", value: inputValue, onChange: (e) => setInputValue(e.target.value), placeholder: "Ingresa un valor", min: filterType === "number"
580
+ }, children: _jsx("span", { className: "font-[var(--font-default)]", children: option.text }) }, option.value))) })), _jsxs("div", { className: "flex items-center justify-start gap-2", children: [_jsx("div", { style: { width: finalInputWidth }, children: _jsx(Input, { ref: inputRef, type: filterType === "number" ? "number" : "text", value: inputValue, onChange: (e) => setInputValue(e.target.value), placeholder: "Ingresa un valor", min: filterType === "number"
581
581
  ? props.min
582
582
  : undefined, max: filterType === "number"
583
583
  ? props.max
@@ -37,7 +37,7 @@ export declare const CrudContext: import("react").Context<CrudContextType<any> |
37
37
  export interface PromiseWithOptions<TResult, TParams extends any[] = []> {
38
38
  execute: (...params: TParams) => Promise<TResult>;
39
39
  successMessage?: string;
40
- errorMessage?: string;
40
+ errorMessage?: string | ((error: any) => string);
41
41
  }
42
42
  interface CrudProviderProps<T> {
43
43
  children: ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"CrudContext.d.ts","sourceRoot":"","sources":["../../src/contexts/CrudContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGzD,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAC3B,IAAI,EAAE,CAAC,GAAG,SAAS,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,SAAS,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChC,YAAY,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC;IACxE,UAAU,EAAE;QACV,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,MAA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IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACxC,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACjC;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,EAC9B,QAAQ,EACR,UAAU,EACV,cAAc,EACd,WAAW,EACX,UAAU,EACV,aAAa,EACb,KAAU,EACV,SAAoB,EACpB,SAAc,EACd,YAAY,EACZ,SAAS,EAAE,aAAa,GACzB,EAAE,iBAAiB,CAAC,CAAC,CAAC,2CAoZtB;AAID,wBAAgB,OAAO,CAAC,CAAC,KAAK,eAAe,CAAC,CAAC,CAAC,CAM/C"}
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ declare const CurrencyInputDocs: React.FC;
3
+ export default CurrencyInputDocs;
4
+ //# sourceMappingURL=CurrencyInputDocs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CurrencyInputDocs.d.ts","sourceRoot":"","sources":["../../src/docs/CurrencyInputDocs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAoDxC,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAqN9B,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { useState } from "react";
3
+ import { useForm, FormProvider } from "react-hook-form";
4
+ import { Card, CurrencyInput, Button } from "../index";
5
+ const HookFormExample = () => {
6
+ const methods = useForm({
7
+ defaultValues: { precio: 25000.75 },
8
+ });
9
+ const { register, watch, handleSubmit, formState: { errors }, } = methods;
10
+ const onSubmit = (data) => {
11
+ alert("Datos enviados: " + JSON.stringify(data));
12
+ };
13
+ return (_jsx(FormProvider, { ...methods, children: _jsxs("form", { onSubmit: handleSubmit(onSubmit), className: "space-y-4 p-4 border rounded-lg bg-gray-50", children: [_jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [_jsx(CurrencyInput, { label: "Precio con register", ...register("precio", {
14
+ required: "El precio es obligatorio",
15
+ min: { value: 10, message: "El mínimo es 10" },
16
+ }), error: errors.precio?.message, icon: "fa-shopping-cart" }), _jsxs("div", { className: "flex flex-col justify-center", children: [_jsx("p", { className: "text-sm font-semibold text-gray-700", children: "Estado del formulario:" }), _jsx("pre", { className: "text-xs bg-white p-2 border rounded mt-1", children: JSON.stringify(watch(), null, 2) })] })] }), _jsx(Button, { type: "submit", size: "sm", children: "Probar Submit" })] }) }));
17
+ };
18
+ const CurrencyInputDocs = () => {
19
+ const [value, setValue] = useState(1234.56);
20
+ return (_jsxs("div", { className: "max-w-5xl mx-auto space-y-8", children: [_jsx(Card, { title: "CurrencyInput - Variantes y Ejemplos", children: _jsxs("div", { className: "space-y-10", children: [_jsxs("section", { children: [_jsx("h3", { className: "text-lg font-semibold mb-4", style: { color: "var(--flysoft-text-primary)" }, children: "Uso b\u00E1sico" }), _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [_jsxs("div", { className: "space-y-3", children: [_jsx(CurrencyInput, { label: "Precio del producto", placeholder: "0,00", icon: "fa-tag", value: value, onChange: (val) => setValue(val) }), _jsxs("div", { className: "p-3 bg-gray-50 rounded-md border border-gray-200", children: [_jsx("p", { className: "text-sm font-semibold text-gray-700 mb-1", children: "Valor num\u00E9rico en el estado profesional (React):" }), _jsx("code", { className: "text-primary font-mono bg-white px-2 py-1 rounded border", children: value !== null ? value.toString() : "null" })] }), _jsx("p", { className: "text-sm", style: { color: "var(--flysoft-text-secondary)" }, children: "Este componente formatea autom\u00E1ticamente el valor con separadores de miles y decimales. Al recibir el foco, se eliminan los puntos para facilitar la edici\u00F3n." })] }), _jsxs("div", { className: "space-y-3", children: [_jsx(CurrencyInput, { label: "Entrada vac\u00EDa con placeholder", placeholder: "Ingrese monto...", icon: "fa-dollar-sign" }), _jsx("p", { className: "text-sm", style: { color: "var(--flysoft-text-secondary)" }, children: "Si no se proporciona un valor, se muestra el placeholder configurado." })] })] })] }), _jsxs("section", { children: [_jsx("h3", { className: "text-lg font-semibold mb-4", style: { color: "var(--flysoft-text-primary)" }, children: "Comportamiento del Foco" }), _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [_jsxs("div", { className: "space-y-3", children: [_jsx(CurrencyInput, { label: "Haz clic para ver el cambio", value: 10500.25, icon: "fa-mouse-pointer" }), _jsx("p", { className: "text-sm", style: { color: "var(--flysoft-text-secondary)" }, children: "Observa c\u00F3mo los puntos desaparecen al enfocar el campo y reaparecen al perder el foco." })] }), _jsxs("div", { className: "space-y-3", children: [_jsx(CurrencyInput, { label: "Conversi\u00F3n de punto a coma", placeholder: "Escribe 123.45", icon: "fa-keyboard" }), _jsx("p", { className: "text-sm", style: { color: "var(--flysoft-text-secondary)" }, children: "El componente ayuda al usuario convirtiendo autom\u00E1ticamente el punto del teclado num\u00E9rico en una coma decimal." })] })] })] }), _jsxs("section", { children: [_jsx("h3", { className: "text-lg font-semibold mb-4", style: { color: "var(--flysoft-text-primary)" }, children: "Estados y Tama\u00F1os" }), _jsxs("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-6", children: [_jsx(CurrencyInput, { size: "sm", label: "Peque\u00F1o con error", placeholder: "0,00", error: "Monto requerido" }), _jsx(CurrencyInput, { size: "md", label: "Mediano deshabilitado", value: 1234.56, disabled: true }), _jsx(CurrencyInput, { size: "lg", label: "Grande ReadOnly", value: 9999.99, readOnly: true })] })] }), _jsxs("section", { children: [_jsx("h3", { className: "text-lg font-semibold mb-4", style: { color: "var(--flysoft-text-primary)" }, children: "Integraci\u00F3n con react-hook-form" }), _jsxs("p", { className: "mb-4 text-sm", style: { color: "var(--flysoft-text-secondary)" }, children: ["El componente es compatible con ", _jsx("code", { children: "register" }), " de react-hook-form. Para que funcione correctamente devolviendo valores num\u00E9ricos, aseg\u00FArate de envolver el formulario en un", " ", _jsx("code", { children: "FormProvider" }), "."] }), _jsx(HookFormExample, {})] }), _jsxs("section", { children: [_jsx("h3", { className: "text-lg font-semibold mb-4", style: { color: "var(--flysoft-text-primary)" }, children: "Props espec\u00EDficas" }), _jsx("div", { className: "overflow-x-auto", children: _jsxs("table", { className: "w-full border-collapse", children: [_jsx("thead", { children: _jsxs("tr", { className: "border-b border-[var(--color-border-default)]", children: [_jsx("th", { className: "px-4 py-2 text-left text-sm font-semibold", children: "Prop" }), _jsx("th", { className: "px-4 py-2 text-left text-sm font-semibold", children: "Tipo" }), _jsx("th", { className: "px-4 py-2 text-left text-sm font-semibold", children: "Descripci\u00F3n" })] }) }), _jsxs("tbody", { children: [_jsxs("tr", { className: "border-b border-[var(--color-border-default)]", children: [_jsx("td", { className: "px-4 py-2 text-sm font-mono", children: "value" }), _jsx("td", { className: "px-4 py-2 text-sm", children: "number | null" }), _jsx("td", { className: "px-4 py-2 text-sm", children: "El valor num\u00E9rico de la entrada." })] }), _jsxs("tr", { className: "border-b border-[var(--color-border-default)]", children: [_jsx("td", { className: "px-4 py-2 text-sm font-mono", children: "onChange" }), _jsx("td", { className: "px-4 py-2 text-sm", children: "(value: number | null) => void" }), _jsx("td", { className: "px-4 py-2 text-sm", children: "Callback que se dispara al perder el foco, entregando el n\u00FAmero parseado." })] }), _jsxs("tr", { className: "border-b border-[var(--color-border-default)]", children: [_jsx("td", { className: "px-4 py-2 text-sm font-mono", children: "...InputProps" }), _jsx("td", { className: "px-4 py-2 text-sm", children: "Omit<InputProps, 'value' | 'onChange'>" }), _jsx("td", { className: "px-4 py-2 text-sm", children: "Soporta todas las props del componente Input est\u00E1ndar." })] })] })] }) })] })] }) }), _jsx("div", { className: "flex justify-start", children: _jsx(Button, { variant: "outline", icon: "fa-arrow-left", onClick: () => window.history.back(), children: "Volver" }) })] }));
21
+ };
22
+ export default CurrencyInputDocs;
@@ -1 +1 @@
1
- {"version":3,"file":"DocsMenu.d.ts","sourceRoot":"","sources":["../../src/docs/DocsMenu.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,+CAoTpB,CAAC"}
1
+ {"version":3,"file":"DocsMenu.d.ts","sourceRoot":"","sources":["../../src/docs/DocsMenu.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,+CA6TpB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Accordion, LinkButton } from "../index";
3
3
  export const DocsMenu = () => {
4
- return (_jsxs("div", { className: "space-y-2 p-4 bg-gray-100 h-full", children: [_jsx(Accordion, { title: "Form Controls", icon: "fa-edit", defaultOpen: true, children: _jsxs("div", { className: "space-y-2", children: [_jsx(LinkButton, { to: "/docs/button", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Button" }), _jsx(LinkButton, { to: "/docs/linkbutton", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "LinkButton" }), _jsx(LinkButton, { to: "/docs/input", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Input" }), _jsx(LinkButton, { to: "/docs/autocomplete-input", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "AutocompleteInput" }), _jsx(LinkButton, { to: "/docs/search-select-input", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "SearchSelectInput" }), _jsx(LinkButton, { to: "/docs/datepicker", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "DatePicker" }), _jsx(LinkButton, { to: "/docs/dateinput", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "DateInput" }), _jsx(LinkButton, { to: "/docs/checkbox", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Checkbox" }), _jsx(LinkButton, { to: "/docs/radiobuttongroup", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "RadioButtonGroup" }), _jsx(LinkButton, { to: "/docs/pagination", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Pagination" })] }) }), _jsx(Accordion, { title: "Layout", icon: "fa-th-large", children: _jsxs("div", { className: "space-y-2", children: [_jsx(LinkButton, { to: "/docs/card", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Card" }), _jsx(LinkButton, { to: "/docs/datafield", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "DataField" }), _jsx(LinkButton, { to: "/docs/tabsgroup", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "TabsGroup" }), _jsx(LinkButton, { to: "/docs/datatable", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "DataTable" }), _jsx(LinkButton, { to: "/docs/accordion", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Accordion" }), _jsx(LinkButton, { to: "/docs/menu", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Menu" }), _jsx(LinkButton, { to: "/docs/dropdownmenu", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "DropdownMenu" }), _jsx(LinkButton, { to: "/docs/dropdownpanel", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "DropdownPanel" }), _jsx(LinkButton, { to: "/docs/filter", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Filter" })] }) }), _jsx(Accordion, { title: "Utils", icon: "fa-tools", children: _jsxs("div", { className: "space-y-2", children: [_jsx(LinkButton, { to: "/docs/badge", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Badge" }), _jsx(LinkButton, { to: "/docs/avatar", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Avatar" }), _jsx(LinkButton, { to: "/docs/roadmap", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "RoadMap" }), _jsx(LinkButton, { to: "/docs/dialog", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Dialog" }), _jsx(LinkButton, { to: "/docs/loader", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Loader" }), _jsx(LinkButton, { to: "/docs/skeleton", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Skeleton" }), _jsx(LinkButton, { to: "/docs/snackbar", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Snackbar" }), _jsx(LinkButton, { to: "/docs/theme", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "ThemeSwitcher" })] }) }), _jsx(Accordion, { title: "Contexts", icon: "fa-database", children: _jsxs("div", { className: "space-y-2", children: [_jsx(LinkButton, { to: "/docs/auth", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "AuthContext" }), _jsx(LinkButton, { to: "/docs/listcrud", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "CrudContext" })] }) }), _jsx(Accordion, { title: "Otros", icon: "fa-folder", children: _jsxs("div", { className: "space-y-2", children: [_jsx(LinkButton, { to: "/docs/example-form", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Formulario de Ejemplo" }), _jsx(LinkButton, { to: "/docs/admin", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Admin (Mock Services)" })] }) })] }));
4
+ return (_jsxs("div", { className: "space-y-2 p-4 bg-gray-100 h-full", children: [_jsx(Accordion, { title: "Form Controls", icon: "fa-edit", defaultOpen: true, children: _jsxs("div", { className: "space-y-2", children: [_jsx(LinkButton, { to: "/docs/button", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Button" }), _jsx(LinkButton, { to: "/docs/linkbutton", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "LinkButton" }), _jsx(LinkButton, { to: "/docs/input", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Input" }), _jsx(LinkButton, { to: "/docs/autocomplete-input", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "AutocompleteInput" }), _jsx(LinkButton, { to: "/docs/currency-input", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "CurrencyInput" }), _jsx(LinkButton, { to: "/docs/search-select-input", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "SearchSelectInput" }), _jsx(LinkButton, { to: "/docs/datepicker", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "DatePicker" }), _jsx(LinkButton, { to: "/docs/dateinput", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "DateInput" }), _jsx(LinkButton, { to: "/docs/checkbox", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Checkbox" }), _jsx(LinkButton, { to: "/docs/radiobuttongroup", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "RadioButtonGroup" }), _jsx(LinkButton, { to: "/docs/pagination", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Pagination" })] }) }), _jsx(Accordion, { title: "Layout", icon: "fa-th-large", children: _jsxs("div", { className: "space-y-2", children: [_jsx(LinkButton, { to: "/docs/card", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Card" }), _jsx(LinkButton, { to: "/docs/datafield", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "DataField" }), _jsx(LinkButton, { to: "/docs/tabsgroup", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "TabsGroup" }), _jsx(LinkButton, { to: "/docs/datatable", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "DataTable" }), _jsx(LinkButton, { to: "/docs/accordion", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Accordion" }), _jsx(LinkButton, { to: "/docs/menu", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Menu" }), _jsx(LinkButton, { to: "/docs/dropdownmenu", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "DropdownMenu" }), _jsx(LinkButton, { to: "/docs/dropdownpanel", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "DropdownPanel" }), _jsx(LinkButton, { to: "/docs/filter", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Filter" })] }) }), _jsx(Accordion, { title: "Utils", icon: "fa-tools", children: _jsxs("div", { className: "space-y-2", children: [_jsx(LinkButton, { to: "/docs/badge", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Badge" }), _jsx(LinkButton, { to: "/docs/avatar", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Avatar" }), _jsx(LinkButton, { to: "/docs/roadmap", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "RoadMap" }), _jsx(LinkButton, { to: "/docs/dialog", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Dialog" }), _jsx(LinkButton, { to: "/docs/loader", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Loader" }), _jsx(LinkButton, { to: "/docs/skeleton", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Skeleton" }), _jsx(LinkButton, { to: "/docs/snackbar", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Snackbar" }), _jsx(LinkButton, { to: "/docs/theme", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "ThemeSwitcher" })] }) }), _jsx(Accordion, { title: "Contexts", icon: "fa-database", children: _jsxs("div", { className: "space-y-2", children: [_jsx(LinkButton, { to: "/docs/auth", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "AuthContext" }), _jsx(LinkButton, { to: "/docs/listcrud", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "CrudContext" })] }) }), _jsx(Accordion, { title: "Otros", icon: "fa-folder", children: _jsxs("div", { className: "space-y-2", children: [_jsx(LinkButton, { to: "/docs/example-form", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Formulario de Ejemplo" }), _jsx(LinkButton, { to: "/docs/admin", variant: "ghost", size: "sm", className: "w-full justify-start", color: "secondary", children: "Admin (Mock Services)" })] }) })] }));
5
5
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DocsRouter.d.ts","sourceRoot":"","sources":["../../src/docs/DocsRouter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAkC1B,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAsC9B,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"DocsRouter.d.ts","sourceRoot":"","sources":["../../src/docs/DocsRouter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAmC1B,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAuC9B,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -31,8 +31,9 @@ import MenuDocs from "./MenuDocs";
31
31
  import SnackbarDocs from "./SnackbarDocs";
32
32
  import AccordionDocs from "./AccordionDocs";
33
33
  import SkeletonDocs from "./SkeletonDocs";
34
+ import CurrencyInputDocs from "./CurrencyInputDocs";
34
35
  import DocAdmin from "./DocAdmin";
35
36
  export const DocsRouter = () => {
36
- return (_jsxs(Routes, { children: [_jsx(Route, { path: "", element: _jsx(Navigate, { to: "button", replace: true }) }), _jsx(Route, { path: "button", element: _jsx(ButtonDocs, {}) }), _jsx(Route, { path: "linkbutton", element: _jsx(LinkButtonDocs, {}) }), _jsx(Route, { path: "badge", element: _jsx(BadgeDocs, {}) }), _jsx(Route, { path: "avatar", element: _jsx(AvatarDocs, {}) }), _jsx(Route, { path: "roadmap", element: _jsx(RoadMapDocs, {}) }), _jsx(Route, { path: "card", element: _jsx(CardDocs, {}) }), _jsx(Route, { path: "input", element: _jsx(InputDocs, {}) }), _jsx(Route, { path: "autocomplete-input", element: _jsx(AutocompleteInputDocs, {}) }), _jsx(Route, { path: "search-select-input", element: _jsx(SearchSelectInputDocs, {}) }), _jsx(Route, { path: "datepicker", element: _jsx(DatePickerDocs, {}) }), _jsx(Route, { path: "dateinput", element: _jsx(DateInputDocs, {}) }), _jsx(Route, { path: "checkbox", element: _jsx(CheckboxDocs, {}) }), _jsx(Route, { path: "radiobuttongroup", element: _jsx(RadioButtonGroupDocs, {}) }), _jsx(Route, { path: "theme", element: _jsx(ThemeSwitcherDocs, {}) }), _jsx(Route, { path: "datafield", element: _jsx(DataFieldDocs, {}) }), _jsx(Route, { path: "tabsgroup", element: _jsx(TabsGroupDocs, {}) }), _jsx(Route, { path: "dialog", element: _jsx(DialogDocs, {}) }), _jsx(Route, { path: "pagination", element: _jsx(PaginationDocs, {}) }), _jsx(Route, { path: "loader", element: _jsx(LoaderDocs, {}) }), _jsx(Route, { path: "datatable", element: _jsx(DataTableDocs, {}) }), _jsx(Route, { path: "dropdownmenu", element: _jsx(DropdownMenuDocs, {}) }), _jsx(Route, { path: "dropdownpanel", element: _jsx(DropdownPanelDocs, {}) }), _jsx(Route, { path: "filter", element: _jsx(FilterDocs, {}) }), _jsx(Route, { path: "auth", element: _jsx(AuthDocs, {}) }), _jsx(Route, { path: "listcrud/empresa/:id", element: _jsx(ListCrudDocs, {}) }), _jsx(Route, { path: "listcrud", element: _jsx(ListCrudDocs, {}) }), _jsx(Route, { path: "example-form", element: _jsx(ExampleFormDocs, {}) }), _jsx(Route, { path: "menu", element: _jsx(MenuDocs, {}) }), _jsx(Route, { path: "snackbar", element: _jsx(SnackbarDocs, {}) }), _jsx(Route, { path: "accordion", element: _jsx(AccordionDocs, {}) }), _jsx(Route, { path: "skeleton", element: _jsx(SkeletonDocs, {}) }), _jsx(Route, { path: "admin", element: _jsx(DocAdmin, {}) })] }));
37
+ return (_jsxs(Routes, { children: [_jsx(Route, { path: "", element: _jsx(Navigate, { to: "button", replace: true }) }), _jsx(Route, { path: "button", element: _jsx(ButtonDocs, {}) }), _jsx(Route, { path: "linkbutton", element: _jsx(LinkButtonDocs, {}) }), _jsx(Route, { path: "badge", element: _jsx(BadgeDocs, {}) }), _jsx(Route, { path: "avatar", element: _jsx(AvatarDocs, {}) }), _jsx(Route, { path: "roadmap", element: _jsx(RoadMapDocs, {}) }), _jsx(Route, { path: "card", element: _jsx(CardDocs, {}) }), _jsx(Route, { path: "input", element: _jsx(InputDocs, {}) }), _jsx(Route, { path: "autocomplete-input", element: _jsx(AutocompleteInputDocs, {}) }), _jsx(Route, { path: "search-select-input", element: _jsx(SearchSelectInputDocs, {}) }), _jsx(Route, { path: "datepicker", element: _jsx(DatePickerDocs, {}) }), _jsx(Route, { path: "dateinput", element: _jsx(DateInputDocs, {}) }), _jsx(Route, { path: "checkbox", element: _jsx(CheckboxDocs, {}) }), _jsx(Route, { path: "radiobuttongroup", element: _jsx(RadioButtonGroupDocs, {}) }), _jsx(Route, { path: "currency-input", element: _jsx(CurrencyInputDocs, {}) }), _jsx(Route, { path: "theme", element: _jsx(ThemeSwitcherDocs, {}) }), _jsx(Route, { path: "datafield", element: _jsx(DataFieldDocs, {}) }), _jsx(Route, { path: "tabsgroup", element: _jsx(TabsGroupDocs, {}) }), _jsx(Route, { path: "dialog", element: _jsx(DialogDocs, {}) }), _jsx(Route, { path: "pagination", element: _jsx(PaginationDocs, {}) }), _jsx(Route, { path: "loader", element: _jsx(LoaderDocs, {}) }), _jsx(Route, { path: "datatable", element: _jsx(DataTableDocs, {}) }), _jsx(Route, { path: "dropdownmenu", element: _jsx(DropdownMenuDocs, {}) }), _jsx(Route, { path: "dropdownpanel", element: _jsx(DropdownPanelDocs, {}) }), _jsx(Route, { path: "filter", element: _jsx(FilterDocs, {}) }), _jsx(Route, { path: "auth", element: _jsx(AuthDocs, {}) }), _jsx(Route, { path: "listcrud/empresa/:id", element: _jsx(ListCrudDocs, {}) }), _jsx(Route, { path: "listcrud", element: _jsx(ListCrudDocs, {}) }), _jsx(Route, { path: "example-form", element: _jsx(ExampleFormDocs, {}) }), _jsx(Route, { path: "menu", element: _jsx(MenuDocs, {}) }), _jsx(Route, { path: "snackbar", element: _jsx(SnackbarDocs, {}) }), _jsx(Route, { path: "accordion", element: _jsx(AccordionDocs, {}) }), _jsx(Route, { path: "skeleton", element: _jsx(SkeletonDocs, {}) }), _jsx(Route, { path: "admin", element: _jsx(DocAdmin, {}) })] }));
37
38
  };
38
39
  export default DocsRouter;
@@ -1 +1 @@
1
- {"version":3,"file":"ExampleFormDocs.d.ts","sourceRoot":"","sources":["../../src/docs/ExampleFormDocs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAgE1B,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAoP5B,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"ExampleFormDocs.d.ts","sourceRoot":"","sources":["../../src/docs/ExampleFormDocs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAiE1B,QAAA,MAAM,eAAe,EAAE,KAAK,CAAC,EAoQ5B,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React from "react";
3
- import { Card, Input, AutocompleteInput, DateInput, SearchSelectInput, Button, Checkbox, RadioButtonGroup, } from "../index";
3
+ import { Card, Input, AutocompleteInput, DateInput, SearchSelectInput, Button, Checkbox, RadioButtonGroup, CurrencyInput, } from "../index";
4
4
  import { useForm, FormProvider } from "react-hook-form";
5
5
  import dayjs from "dayjs";
6
6
  const autocompleteOptions = [
@@ -52,6 +52,7 @@ const ExampleFormDocs = () => {
52
52
  aceptaTerminos: false,
53
53
  genero: "masculino",
54
54
  tipoUsuario: "user",
55
+ salario: 1500.5,
55
56
  },
56
57
  });
57
58
  const { handleSubmit, reset, watch, setFocus, register, formState: { errors, isSubmitted }, } = methods;
@@ -127,7 +128,10 @@ const ExampleFormDocs = () => {
127
128
  { label: "Otro", value: "otro" },
128
129
  ], readOnly: isReadOnly, ...register("genero", {
129
130
  required: "El género es obligatorio",
130
- }), error: errors.genero?.message })] }), _jsxs("div", { children: ["G\u00E9nero: ", watch("genero")] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm text-[var(--color-primary)] mb-1 font-[var(--font-default)]", children: "Tipo de Usuario" }), _jsx(RadioButtonGroup, { options: [
131
+ }), error: errors.genero?.message })] }), _jsxs("div", { children: ["G\u00E9nero: ", watch("genero")] }), _jsx(CurrencyInput, { label: "Salario mensual", placeholder: "0,00", icon: "fa-money-bill-wave", readOnly: isReadOnly, ...register("salario", {
132
+ required: "El salario es obligatorio",
133
+ min: { value: 1, message: "El salario debe ser mayor a 0" },
134
+ }), error: errors.salario?.message }), _jsxs("div", { children: ["Salario: ", watch("salario")] }), _jsxs("div", { children: [_jsx("label", { className: "block text-sm text-[var(--color-primary)] mb-1 font-[var(--font-default)]", children: "Tipo de Usuario" }), _jsx(RadioButtonGroup, { options: [
131
135
  { label: "Administrador", value: "admin" },
132
136
  { label: "Usuario", value: "user" },
133
137
  { label: "Invitado", value: "guest" },
@@ -142,6 +146,7 @@ const ExampleFormDocs = () => {
142
146
  aceptaTerminos: false,
143
147
  genero: "",
144
148
  tipoUsuario: "",
149
+ salario: null,
145
150
  });
146
151
  }, children: "Resetear" }), _jsx(Button, { variant: "primary", icon: "fa-check", type: "submit", children: "Enviar" })] })] })] }) }) }) }));
147
152
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ListCrudDocs.d.ts","sourceRoot":"","sources":["../../../src/docs/ListCrudDocs.tsx/ListCrudDocs.tsx"],"names":[],"mappings":"AAeA,eAAO,MAAM,YAAY,+CA6ExB,CAAC"}
1
+ {"version":3,"file":"ListCrudDocs.d.ts","sourceRoot":"","sources":["../../../src/docs/ListCrudDocs.tsx/ListCrudDocs.tsx"],"names":[],"mappings":"AAeA,eAAO,MAAM,YAAY,+CA8GxB,CAAC"}
@@ -19,23 +19,29 @@ export const ListCrudDocs = () => {
19
19
  };
20
20
  }, [setNavBarLeftNode]);
21
21
  const { id } = useParams();
22
- return (_jsx(Collection, { children: _jsxs(TabsGroup, { tabs: [
23
- { id: "personas", label: "Personas" },
24
- { id: "empresas", label: "Empresas" },
25
- ], paramName: "tab", children: [_jsx(TabPanel, { tabId: "personas", children: _jsx(CrudProvider, { getPromise: listarPaginados, postPromise: {
26
- execute: agregar,
27
- successMessage: "Persona agregada correctamente",
28
- }, putPromise: {
29
- execute: (persona) => editar(persona.id, persona),
30
- successMessage: "Cambios guardados",
31
- }, deletePromise: {
32
- execute: eliminar,
33
- successMessage: "Persona eliminada correctamente",
34
- }, urlParams: ["filtro", "idEmpresa"], children: _jsx(ListCrudDocsContentPersonas, {}) }) }), _jsx(TabPanel, { tabId: "empresas", children: _jsx(CrudProvider, { getPromise: listarPaginadosEmpresa, putPromise: {
35
- execute: (empresa) => editarEmpresa(empresa.id, empresa),
36
- successMessage: "Cambios guardados",
37
- }, deletePromise: {
38
- execute: eliminarEmpresa,
39
- successMessage: "Persona eliminada correctamente",
40
- }, getItemPromise: (params) => buscarPorId(params?.toString() || ""), pageParam: "paginaEmpresa", urlParams: ["filtroEmpresa", "idEmpresaEmpresa"], singleItemId: id, children: id ? (_jsx(ListCrudDocsContentEmpresaSingle, {})) : (_jsx(ListCrudDocsContentEmpresas, {})) }) })] }) }));
22
+ return (_jsxs(Collection, { children: [_jsxs(TabsGroup, { tabs: [
23
+ { id: "personas", label: "Personas" },
24
+ { id: "empresas", label: "Empresas" },
25
+ ], paramName: "tab", children: [_jsx(TabPanel, { tabId: "personas", children: _jsx(CrudProvider, { getPromise: listarPaginados, postPromise: {
26
+ execute: agregar,
27
+ successMessage: "Persona agregada correctamente",
28
+ }, putPromise: {
29
+ execute: (persona) => editar(persona.id, persona),
30
+ successMessage: "Cambios guardados",
31
+ }, deletePromise: {
32
+ execute: eliminar,
33
+ successMessage: "Persona eliminada correctamente",
34
+ }, urlParams: ["filtro", "idEmpresa"], children: _jsx(ListCrudDocsContentPersonas, {}) }) }), _jsx(TabPanel, { tabId: "empresas", children: _jsx(CrudProvider, { getPromise: listarPaginadosEmpresa, putPromise: {
35
+ execute: (empresa) => editarEmpresa(empresa.id, empresa),
36
+ successMessage: "Cambios guardados",
37
+ // Ejemplo de mensaje de error diferencial basado en el error
38
+ errorMessage: (error) => {
39
+ if (error?.status === 409)
40
+ return "El nombre de la empresa ya existe";
41
+ return "Error al actualizar la empresa";
42
+ },
43
+ }, deletePromise: {
44
+ execute: eliminarEmpresa,
45
+ successMessage: "Empresa eliminada correctamente",
46
+ }, getItemPromise: (params) => buscarPorId(params?.toString() || ""), pageParam: "paginaEmpresa", urlParams: ["filtroEmpresa", "idEmpresaEmpresa"], singleItemId: id, children: id ? (_jsx(ListCrudDocsContentEmpresaSingle, {})) : (_jsx(ListCrudDocsContentEmpresas, {})) }) })] }), _jsxs("section", { className: "mt-8 p-6 bg-gray-50 dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-800", children: [_jsxs("h3", { className: "text-lg font-bold mb-4", children: [_jsx("i", { className: "fa fa-info-circle mr-2 text-blue-500" }), "Configuraci\u00F3n de Feedback en Promesas"] }), _jsxs("p", { className: "text-sm mb-4", children: ["Las propiedades ", _jsx("code", { children: "postPromise" }), ", ", _jsx("code", { children: "putPromise" }), ",", " ", _jsx("code", { children: "deletePromise" }), " y ", _jsx("code", { children: "getItemPromise" }), "soportan configuraci\u00F3n avanzada de feedback:"] }), _jsxs("ul", { className: "list-disc list-inside space-y-2 text-sm text-gray-600 dark:text-gray-400", children: [_jsxs("li", { children: [_jsx("strong", { children: "M\u00FAltiplos Tipos:" }), " ", _jsx("code", { children: "errorMessage" }), " acepta", " ", _jsx("code", { children: "string" }), " o una funci\u00F3n ", _jsx("code", { children: "(error) => string" }), "."] }), _jsxs("li", { children: [_jsx("strong", { children: "Feedback Opcional:" }), " Si no se define", " ", _jsx("code", { children: "errorMessage" }), ", no se mostrar\u00E1 ning\u00FAn snackbar ante errores."] }), _jsxs("li", { children: [_jsx("strong", { children: "Simplificaci\u00F3n:" }), " Internamente utiliza", " ", _jsx("code", { children: "useAsyncRequest" }), " para unificar el comportamiento."] })] })] })] }));
41
47
  };
@@ -1 +1 @@
1
- {"version":3,"file":"SnackbarDocs.d.ts","sourceRoot":"","sources":["../../src/docs/SnackbarDocs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAgiB1B,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAWzB,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"SnackbarDocs.d.ts","sourceRoot":"","sources":["../../src/docs/SnackbarDocs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAslB1B,QAAA,MAAM,YAAY,EAAE,KAAK,CAAC,EAWzB,CAAC;AAEF,eAAe,YAAY,CAAC"}