@m4l/components 9.3.19-BE021025-beta.2 → 9.3.19-BE061025-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/@types/types.d.ts +8 -0
  2. package/components/EditLabel/EditLabel.d.ts +7 -0
  3. package/components/EditLabel/EditLabel.styles.d.ts +2 -0
  4. package/components/EditLabel/constants.d.ts +2 -0
  5. package/components/EditLabel/hooks/useEditLabel.d.ts +23 -0
  6. package/components/EditLabel/icons.d.ts +5 -0
  7. package/components/EditLabel/index.d.ts +2 -0
  8. package/components/EditLabel/slots/EditLabelEnum.d.ts +7 -0
  9. package/components/EditLabel/slots/EditLabelSlots.d.ts +15 -0
  10. package/components/EditLabel/test/EditLabel.test.d.ts +1 -0
  11. package/components/EditLabel/types.d.ts +43 -0
  12. package/components/MFIsolationApp/MFIsolationApp.js +13 -5
  13. package/components/MFIsolationApp/icons.d.ts +3 -0
  14. package/components/MFIsolationApp/icons.js +6 -0
  15. package/components/MFIsolationApp/subcomponents/AppBarSettings/AppBarSettings.d.ts +4 -0
  16. package/components/MFIsolationApp/subcomponents/AppBarSettings/AppBarSettings.js +21 -0
  17. package/components/MFIsolationApp/subcomponents/AppBarSettings/index.d.ts +1 -0
  18. package/components/MFIsolationApp/subcomponents/AppBarSettings/index.js +1 -0
  19. package/components/MFIsolationApp/types.d.ts +1 -0
  20. package/components/ModalDialog/ModalDialog.js +1 -0
  21. package/components/formatters/EditLabelFormatter/EditLabelFormatter.d.ts +5 -0
  22. package/components/formatters/EditLabelFormatter/EditLabelFormatter.styles.d.ts +2 -0
  23. package/components/formatters/EditLabelFormatter/constants.d.ts +5 -0
  24. package/components/formatters/EditLabelFormatter/index.d.ts +2 -0
  25. package/components/formatters/EditLabelFormatter/slots/EditLabelFormatterEnum.d.ts +4 -0
  26. package/components/formatters/EditLabelFormatter/slots/EditLabelFormatterSlots.d.ts +4 -0
  27. package/components/formatters/EditLabelFormatter/test/EditLabelFormatter.test.d.ts +1 -0
  28. package/components/formatters/EditLabelFormatter/types.d.ts +23 -0
  29. package/components/hook-form/RHFAutocomplete/RHFAutocomplete.js +8 -2
  30. package/components/hook-form/RHFAutocomplete/types.d.ts +13 -0
  31. package/components/hook-form/RHFAutocompleteAsync/RHFAutocompleteAsync.js +8 -2
  32. package/components/hook-form/RHFormContext/index.d.ts +109 -9
  33. package/components/hook-form/RHFormContext/index.js +21 -6
  34. package/components/hook-form/RHFormContext/types.d.ts +64 -1
  35. package/components/mui_extended/Autocomplete/Autocomplete.js +6 -2
  36. package/components/mui_extended/Autocomplete/hooks/useStartAdornments.d.ts +2 -0
  37. package/components/mui_extended/Autocomplete/hooks/useStartAdornments.js +9 -3
  38. package/components/mui_extended/Autocomplete/types.d.ts +8 -0
  39. package/package.json +1 -1
package/@types/types.d.ts CHANGED
@@ -293,6 +293,7 @@ import {
293
293
  ImageTextSlotsType,
294
294
  } from '../components/ImageText/types';
295
295
  import { FormContainerOwnerState, FormContainerSlotsType } from '../components/FormContainer/types';
296
+ import { EditLabelOwnerState, EditLabelSlotsType } from '../components/EditLabel/types';
296
297
 
297
298
  declare module '@mui/material/styles' {
298
299
  // Define the slots in the theme
@@ -381,6 +382,7 @@ declare module '@mui/material/styles' {
381
382
  M4LStepper: StepperSlotsType;
382
383
  M4LImageText: ImageTextSlotsType;
383
384
  M4LFormContainer: FormContainerSlotsType;
385
+ M4LEditLabel: EditLabelSlotsType;
384
386
  }
385
387
  interface ComponentsPropsList {
386
388
  // Extend ComponentsProps or ComponentsOwnerState(this extend ComponentProps)
@@ -468,6 +470,7 @@ declare module '@mui/material/styles' {
468
470
  M4LStepper: Partial<StepperOwnerState>;
469
471
  M4LImageText: Partial<ImageTextOwnerState>;
470
472
  M4LFormContainer: Partial<FormContainerOwnerState>;
473
+ M4LEditLabel: Partial<EditLabelOwnerState>;
471
474
  }
472
475
  interface Components {
473
476
  M4LDynamicFilter?: {
@@ -900,5 +903,10 @@ declare module '@mui/material/styles' {
900
903
  styleOverrides?: ComponentsOverrides<Theme>['M4LFormContainer'];
901
904
  variants?: ComponentsVariants['M4LFormContainer'];
902
905
  };
906
+ M4LEditLabel?: {
907
+ defaultProps?: ComponentsPropsList['M4LEditLabel'];
908
+ styleOverrides?: ComponentsOverrides<Theme>['M4LEditLabel'];
909
+ variants?: ComponentsVariants['M4LEditLabel'];
910
+ };
903
911
  }
904
912
  }
@@ -0,0 +1,7 @@
1
+ import { EditLabelProps } from './types';
2
+ /**
3
+ * Componente de texto editable con funcionalidades avanzadas.
4
+ * @param props - Las propiedades del componente
5
+ * @returns El componente EditLabel renderizado
6
+ */
7
+ export declare const EditLabel: (props: EditLabelProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { EditLabelStyles } from './types';
2
+ export declare const editLabelStyles: EditLabelStyles;
@@ -0,0 +1,2 @@
1
+ export declare const EDIT_LABEL_KEY_COMPONENT = "M4LEditLabel";
2
+ export declare const EDIT_LABEL_CLASSES: Record<string, string>;
@@ -0,0 +1,23 @@
1
+ export interface UseEditLabelProps {
2
+ label: string;
3
+ onChange: (value: string) => void;
4
+ }
5
+ export interface UseEditLabelReturn {
6
+ inEdition: boolean;
7
+ value: string;
8
+ buttonSubmitRef: React.RefObject<HTMLButtonElement>;
9
+ buttonCancelRef: React.RefObject<HTMLButtonElement>;
10
+ handleChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
11
+ handleSubmit: (event: React.KeyboardEvent<HTMLInputElement> | React.MouseEvent<HTMLButtonElement>) => void;
12
+ handleCancel: (event: React.KeyboardEvent<HTMLInputElement> | React.FocusEvent<HTMLInputElement> | React.MouseEvent<HTMLButtonElement>) => void;
13
+ handleBlur: (event: React.FocusEvent<HTMLInputElement>) => void;
14
+ handleEditStart: () => void;
15
+ handleInputClick: () => void;
16
+ handleKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) => void;
17
+ }
18
+ /**
19
+ * Custom hook que maneja la lógica de estado y handlers para el componente EditLabel.
20
+ * @param props - Las propiedades del hook
21
+ * @returns El estado y handlers del EditLabel
22
+ */
23
+ export declare const useEditLabel: ({ label, onChange, }: UseEditLabelProps) => UseEditLabelReturn;
@@ -0,0 +1,5 @@
1
+ export declare const PATH_ICONS: {
2
+ EDIT: string;
3
+ ACCEPT: string;
4
+ CANCEL: string;
5
+ };
@@ -0,0 +1,2 @@
1
+ export { EditLabel } from './EditLabel';
2
+ export type { EditLabelProps, EditLabelOwnerState } from './types';
@@ -0,0 +1,7 @@
1
+ export declare enum EditLabelSlots {
2
+ root = "root",
3
+ textField = "textField",
4
+ icon = "icon",
5
+ containerActions = "containerActions",
6
+ iconButton = "iconButton"
7
+ }
@@ -0,0 +1,15 @@
1
+ export declare const EditLabelRootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
2
+ ownerState?: (Partial<import('..').EditLabelOwnerState> & Record<string, unknown>) | undefined;
3
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
4
+ export declare const TextFieldStyled: import('@emotion/styled').StyledComponent<Pick<Omit<import('../../mui_extended/TextField/types').TextFieldProps, "ref"> & import('react').RefAttributes<HTMLDivElement>, "value" | "size" | "children" | "title" | "component" | "name" | "error" | "select" | "rows" | "id" | "type" | "disabled" | "hidden" | "content" | "style" | "variant" | "margin" | "translate" | "className" | "classes" | "sx" | "label" | "slot" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "dataTestId" | "autoComplete" | "maxLength" | "placeholder" | "required" | keyof import('react').RefAttributes<HTMLDivElement> | "maxRows" | "fullWidth" | "inputProps" | "inputRef" | "multiline" | "minRows" | "hiddenLabel" | "focused" | "InputProps" | "FormHelperTextProps" | "helperText" | "InputLabelProps" | "SelectProps"> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
5
+ ownerState?: (Partial<import('..').EditLabelOwnerState> & Record<string, unknown>) | undefined;
6
+ }, {}, {}>;
7
+ export declare const IconStyled: import('@emotion/styled').StyledComponent<Pick<import('../../Icon').IconProps, keyof import('../../Icon').IconProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
8
+ ownerState?: (Partial<import('..').EditLabelOwnerState> & Record<string, unknown>) | undefined;
9
+ }, {}, {}>;
10
+ export declare const ContainerActionsStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
11
+ ownerState?: (Partial<import('..').EditLabelOwnerState> & Record<string, unknown>) | undefined;
12
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
13
+ export declare const IconButtonStyled: import('@emotion/styled').StyledComponent<Pick<Omit<import('../../mui_extended/IconButton/types').IconButtonProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>, "value" | "size" | "children" | "title" | "component" | "name" | "id" | "type" | "selected" | "disabled" | "action" | "hidden" | "color" | "content" | "style" | "icon" | "tooltip" | "variant" | "translate" | "className" | "classes" | "src" | "sx" | "form" | "slot" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "instaceDataTestId" | "placement" | "rotationAngle" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "edge" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "badgeProps" | keyof import('react').RefAttributes<HTMLButtonElement>> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
14
+ ownerState?: (Partial<import('..').EditLabelOwnerState> & Record<string, unknown>) | undefined;
15
+ }, {}, {}>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,43 @@
1
+ import { Sizes } from '@m4l/styles';
2
+ import { EditLabelSlots } from './slots/EditLabelEnum';
3
+ import { EDIT_LABEL_KEY_COMPONENT } from './constants';
4
+ import { Theme } from '@mui/material/styles';
5
+ import { M4LOverridesStyleRules } from '../../@types/augmentations';
6
+ export interface EditLabelProps {
7
+ /**
8
+ * The label to display
9
+ */
10
+ label: string;
11
+ /**
12
+ * The function to call when the label is changed
13
+ */
14
+ onChange: (value: string) => void;
15
+ /**
16
+ * The size of the label
17
+ */
18
+ size?: Extract<Sizes, 'small' | 'medium'>;
19
+ /**
20
+ * Custom class name
21
+ */
22
+ className?: string;
23
+ /**
24
+ * The width of the input
25
+ */
26
+ width?: string;
27
+ }
28
+ export interface EditLabelOwnerState {
29
+ /**
30
+ * The size of the label
31
+ */
32
+ size?: Extract<Sizes, 'small' | 'medium'>;
33
+ /**
34
+ * The state of the edition
35
+ */
36
+ inEdition?: boolean;
37
+ /**
38
+ * The width of the input
39
+ */
40
+ width?: string;
41
+ }
42
+ export type EditLabelSlotsType = keyof typeof EditLabelSlots;
43
+ export type EditLabelStyles = M4LOverridesStyleRules<EditLabelSlotsType, typeof EDIT_LABEL_KEY_COMPONENT, Theme>;
@@ -4,15 +4,18 @@ import { unstable_HistoryRouter } from "react-router-dom";
4
4
  import { createBrowserHistory } from "history";
5
5
  import EventEmitter from "eventemitter3";
6
6
  import NProgress from "nprogress";
7
- import { DeviceTypeProvider, LocalesProvider, getLocaleFromNetwork } from "@m4l/graphics";
7
+ import { DeviceTypeProvider, ThemeSettingsProvider, LocalesProvider, getLocaleFromNetwork } from "@m4l/graphics";
8
8
  import { EnvironmentProvider, HostToolsProvider, NetworkProvider, axiosOperation, AuthProvider } from "@m4l/core";
9
9
  import { A as AppearanceComponentProvider } from "../../contexts/AppearanceComponentContext/AppearanceComponentContext.js";
10
10
  import { c as createToaster } from "../ToastContainer/helpers/toaster.js";
11
11
  import { M as MFAuthApp } from "./subcomponents/MFAuthApp/MFAuthApp.js";
12
12
  import { B as BaseModule } from "../BaseModule/BaseModule.js";
13
+ import { S as SettingsLayout } from "../SettingsLayout/SettingsLayout.js";
13
14
  import { T as ToastContainer } from "../ToastContainer/ToastContainer.js";
14
15
  import { P as PopupsProvider } from "../popups/components/PopupsProvider/contexts/PopupsContext/PopupsContext.js";
15
16
  import { A as AreasProvider } from "../areas/contexts/AreasContext/index.js";
17
+ import { S as Stack } from "../mui_extended/Stack/Stack.js";
18
+ import { A as AppBarSettings } from "./subcomponents/AppBarSettings/AppBarSettings.js";
16
19
  const history = createBrowserHistory({ window });
17
20
  function MFIsolationApp(props) {
18
21
  const {
@@ -39,7 +42,8 @@ function MFIsolationApp(props) {
39
42
  moduleDictionaryLoaded,
40
43
  forcedDeviceType,
41
44
  areasStoreId,
42
- areasStoreDevtoolsEnabled
45
+ areasStoreDevtoolsEnabled,
46
+ appBarSettings = false
43
47
  } = props;
44
48
  const eventEmitter = useMemo(() => new EventEmitter(), []);
45
49
  const events_add_listener = useCallback(
@@ -103,7 +107,7 @@ function MFIsolationApp(props) {
103
107
  // eslint-disable-next-line react-hooks/exhaustive-deps
104
108
  []
105
109
  );
106
- return /* @__PURE__ */ jsx(EnvironmentProvider, { ...environment, children: /* @__PURE__ */ jsx(HostToolsProvider, { ...hostTools, children: /* @__PURE__ */ jsx(NetworkProvider, { axiosOperation, children: /* @__PURE__ */ jsx(unstable_HistoryRouter, { history, children: /* @__PURE__ */ jsx(DeviceTypeProvider, { forcedDeviceType, children: /* @__PURE__ */ jsx(AuthProvider, { children: /* @__PURE__ */ jsx(MFAuthApp, { user, pwd, children: /* @__PURE__ */ jsx(LocalesProvider, { isMicroFrontEnd: false, getLocaleFromNetwork, children: /* @__PURE__ */ jsx(
110
+ return /* @__PURE__ */ jsx(EnvironmentProvider, { ...environment, children: /* @__PURE__ */ jsx(HostToolsProvider, { ...hostTools, children: /* @__PURE__ */ jsx(NetworkProvider, { axiosOperation, children: /* @__PURE__ */ jsx(unstable_HistoryRouter, { history, children: /* @__PURE__ */ jsx(DeviceTypeProvider, { forcedDeviceType, children: /* @__PURE__ */ jsx(AuthProvider, { children: /* @__PURE__ */ jsx(MFAuthApp, { user, pwd, children: /* @__PURE__ */ jsx(ThemeSettingsProvider, { children: /* @__PURE__ */ jsx(LocalesProvider, { isMicroFrontEnd: false, getLocaleFromNetwork, children: /* @__PURE__ */ jsx(
107
111
  BaseModule,
108
112
  {
109
113
  moduleId,
@@ -113,6 +117,7 @@ function MFIsolationApp(props) {
113
117
  moduleNameField,
114
118
  moduleDictionaryLoaded,
115
119
  children: /* @__PURE__ */ jsxs(AppearanceComponentProvider, { children: [
120
+ /* @__PURE__ */ jsx(SettingsLayout, {}),
116
121
  /* @__PURE__ */ jsx(ToastContainer, { containerId: toastContainerId }),
117
122
  " ",
118
123
  /* @__PURE__ */ jsx(
@@ -132,14 +137,17 @@ function MFIsolationApp(props) {
132
137
  onSelectLayout: (modId) => {
133
138
  console.log("onSelectLayout", modId);
134
139
  },
135
- children
140
+ children: /* @__PURE__ */ jsxs(Stack, { width: "100%", height: "100%", flexDirection: "column", overflow: "hidden", position: "relative", children: [
141
+ appBarSettings && /* @__PURE__ */ jsx(AppBarSettings, {}),
142
+ /* @__PURE__ */ jsx(Stack, { width: "100%", flexGrow: 1, flexDirection: "column", overflow: "hidden", position: "relative", children })
143
+ ] })
136
144
  }
137
145
  )
138
146
  }
139
147
  )
140
148
  ] })
141
149
  }
142
- ) }) }) }) }) }) }) }) });
150
+ ) }) }) }) }) }) }) }) }) });
143
151
  }
144
152
  export {
145
153
  MFIsolationApp as M
@@ -0,0 +1,3 @@
1
+ export declare const PATH_ICONS: {
2
+ SETTINGS: string;
3
+ };
@@ -0,0 +1,6 @@
1
+ const PATH_ICONS = {
2
+ SETTINGS: "frontend/components/account_popover/assets/icons/configuration.svg"
3
+ };
4
+ export {
5
+ PATH_ICONS as P
6
+ };
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Componente base para la aplicación en modo de aislamiento
3
+ */
4
+ export declare function AppBarSettings(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useThemeSettingsStore } from "@m4l/graphics";
3
+ import { P as PATH_ICONS } from "../../icons.js";
4
+ import { useEnvironment } from "@m4l/core";
5
+ import { S as Stack } from "../../../mui_extended/Stack/Stack.js";
6
+ import { L as LanguagePopover } from "../../../LanguagePopover/LanguagePopover.js";
7
+ import { I as IconButton } from "../../../mui_extended/IconButton/IconButton.js";
8
+ function AppBarSettings() {
9
+ const handleOpen = useThemeSettingsStore((state) => state.settingsActions.handleOpen);
10
+ const { host_static_assets, environment_assets } = useEnvironment();
11
+ return /* @__PURE__ */ jsxs(Stack, { width: "100%", height: "40px", justifyContent: "space-between", flexDirection: "row", overflow: "hidden", position: "relative", padding: [0, 2], children: [
12
+ /* @__PURE__ */ jsx(Stack, { width: "100%", height: "100%" }),
13
+ /* @__PURE__ */ jsxs(Stack, { flexDirection: "row", gap: 2, height: "100%", width: "auto", alignItems: "center", children: [
14
+ /* @__PURE__ */ jsx(LanguagePopover, {}),
15
+ /* @__PURE__ */ jsx(IconButton, { src: `${host_static_assets}/${environment_assets}/${PATH_ICONS.SETTINGS}`, onClick: handleOpen })
16
+ ] })
17
+ ] });
18
+ }
19
+ export {
20
+ AppBarSettings as A
21
+ };
@@ -0,0 +1 @@
1
+ export { AppBarSettings } from './AppBarSettings';
@@ -13,6 +13,7 @@ export type MFIsolationAppProps = BaseModuleProps & {
13
13
  onLoad: () => void;
14
14
  activeAreasNetwork?: boolean;
15
15
  activeCookiesFromNetwork?: boolean;
16
+ appBarSettings?: boolean;
16
17
  /**
17
18
  * Diccionario de componentes, se puede proporcionar ya el diccionario cargado, para evitar que se llame al endpoint nuevamente.
18
19
  */
@@ -81,6 +81,7 @@ const ModalDialog = () => {
81
81
  "aria-labelledby": "child-modal-title",
82
82
  PaperComponent: SelectedPaperComponent,
83
83
  disableEnforceFocus: true,
84
+ disableRestoreFocus: true,
84
85
  children: contentComponent
85
86
  }
86
87
  );
@@ -0,0 +1,5 @@
1
+ import { EditLabelFormatterProps } from './types';
2
+ /**
3
+ * Formatter para mostrar un chip en función del estado determinado por el status
4
+ */
5
+ export declare const EditLabelFormatter: (props: EditLabelFormatterProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { EditLabelFormatterStyles } from './types';
2
+ export declare const editLabelFormatterStyles: EditLabelFormatterStyles;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Clave del componente ChipStatusFormatter
3
+ */
4
+ export declare const EDIT_LABEL_FORMATTER_KEY_COMPONENT = "M4LEditLabelFormatter";
5
+ export declare const EDIT_LABEL_FORMATTER_CLASSES: Record<string, string>;
@@ -0,0 +1,2 @@
1
+ export { EditLabelFormatter } from './EditLabelFormatter';
2
+ export type { EditLabelFormatterProps } from './types';
@@ -0,0 +1,4 @@
1
+ export declare enum EditLabelFormatterSlots {
2
+ root = "root",
3
+ columnWrapper = "columnWrapper"
4
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * componente root del ChipStatusFormatter
3
+ */
4
+ export declare const EditLabelFormatterRootStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../EditLabel').EditLabelProps, keyof import('../../../EditLabel').EditLabelProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Record<string, unknown>, {}, {}>;
@@ -0,0 +1,23 @@
1
+ import { M4LOverridesStyleRules } from '../../../@types/augmentations';
2
+ import { EDIT_LABEL_FORMATTER_KEY_COMPONENT } from './constants';
3
+ import { EditLabelFormatterSlots as Slots } from './slots/EditLabelFormatterEnum';
4
+ import { Theme } from '@mui/material';
5
+ import { EditLabelProps } from '../../EditLabel/types';
6
+ export type ChipStatusKey = string | number;
7
+ export interface EditLabelFormatterProps extends Pick<EditLabelProps, 'label' | 'onChange' | 'size' | 'width' | 'className'> {
8
+ /**
9
+ * Componente personalizado
10
+ */
11
+ Component?: React.ElementType;
12
+ /**
13
+ * Clase CSS del componente root
14
+ */
15
+ className?: string;
16
+ /**
17
+ * ID de prueba del componente
18
+ */
19
+ dataTestid?: string;
20
+ }
21
+ export type EditLabelFormatterOwnerState = {};
22
+ export type EditLabelFormatterSlotsType = keyof typeof Slots;
23
+ export type EditLabelFormatterStyles = M4LOverridesStyleRules<keyof typeof Slots, typeof EDIT_LABEL_FORMATTER_KEY_COMPONENT, Theme>;
@@ -21,7 +21,10 @@ function RHFAutocomplete(props) {
21
21
  mandatory,
22
22
  mandatoryMessage,
23
23
  multiple,
24
- refresh
24
+ refresh,
25
+ startAdornment,
26
+ getOptionalStartAdornment,
27
+ getOptionalEndAdornment
25
28
  // onChange: onChangeRHF,
26
29
  } = props;
27
30
  const htmlForId = useId();
@@ -112,7 +115,10 @@ function RHFAutocomplete(props) {
112
115
  onClose: onCloseLocal,
113
116
  size,
114
117
  value,
115
- htmlFor: htmlForId
118
+ htmlFor: htmlForId,
119
+ startAdornment,
120
+ getOptionalStartAdornment: getOptionalStartAdornment ? (option) => getOptionalStartAdornment(option) : () => null,
121
+ getOptionalEndAdornment: getOptionalEndAdornment ? (option) => getOptionalEndAdornment(option) : () => null
116
122
  }
117
123
  ),
118
124
  error?.message ? /* @__PURE__ */ jsx(HelperError, { message: error?.message }) : null
@@ -5,6 +5,7 @@ import { RFHAUTOCOMPLETE_KEY_COMPONENT } from './constants';
5
5
  import { OverridesStyleRules } from '@mui/material/styles/overrides';
6
6
  import { RFHAutocompleteSlots } from './slots';
7
7
  import { LabelProps } from '../../Label/types';
8
+ import { AutocompleteProps } from 'src/components/mui_extended/Autocomplete/types';
8
9
  export type GetOptionString<T> = (option: T | null) => string;
9
10
  export type RHFAutocompleteVariants = 'outlined' | 'text';
10
11
  export type RHFAutocompleteType = 'text' | 'image';
@@ -46,6 +47,18 @@ export interface RHFAutocompleteProps<T = any, Multiple extends boolean | undefi
46
47
  message: string;
47
48
  };
48
49
  renderInput?: MUIAutocompleteProps<T, Multiple, DisableClearable, FreeSolo>['renderInput'];
50
+ /**
51
+ * Icono o adorno que se muestra al inicio del autocomplete.
52
+ */
53
+ startAdornment?: AutocompleteProps<T, Multiple>['startAdornment'];
54
+ /**
55
+ * Icono o adorno inicial que se muestra en cada opción del autocomplete.
56
+ */
57
+ getOptionalEndAdornment?: AutocompleteProps<T, Multiple>['getOptionalEndAdornment'];
58
+ /**
59
+ * Icono o adorno final que se muestra en cada opción del autocomplete.
60
+ */
61
+ getOptionalStartAdornment?: AutocompleteProps<T, Multiple>['getOptionalStartAdornment'];
49
62
  }
50
63
  /**
51
64
  * Represents the owner state of the Autocomplete component for styling purposes.
@@ -22,7 +22,10 @@ function RHFAutocompleteAsync(props) {
22
22
  multiple,
23
23
  disabled,
24
24
  skeletonWidth,
25
- responseToCamelCase
25
+ responseToCamelCase,
26
+ startAdornment,
27
+ getOptionalStartAdornment,
28
+ getOptionalEndAdornment
26
29
  } = props;
27
30
  const [state, dispatch] = useReducer(
28
31
  RHFAutocompleteAsyncReducer(onChangeFilterParms),
@@ -87,7 +90,10 @@ function RHFAutocompleteAsync(props) {
87
90
  multiple,
88
91
  disabled,
89
92
  onClose: onCloseLocal,
90
- skeletonWidth
93
+ skeletonWidth,
94
+ startAdornment,
95
+ getOptionalStartAdornment,
96
+ getOptionalEndAdornment
91
97
  }
92
98
  );
93
99
  }
@@ -1,20 +1,120 @@
1
1
  import { FieldValues } from 'react-hook-form';
2
- import { CustomFormArguments, FormProviderCustomProps, FormProviderProps } from './types';
2
+ import { CustomFormArguments, FormProviderProps, RHFormProviderRef } from './types';
3
3
  /**
4
- * TODO: Documentar
4
+ * Hook personalizado que configura y gestiona un formulario usando React Hook Form con validación Yup.
5
+ *
6
+ * Este hook encapsula la lógica de inicialización del formulario, incluyendo la configuración del resolver de Yup,
7
+ * valores por defecto, y la gestión de estados de carga para actualizar valores del formulario.
8
+ * @param validationSchema - Esquema de validación de Yup que define las reglas de validación del formulario
9
+ * @param values - Valores iniciales del formulario
10
+ * @param statusLoad - Estado de carga que determina cuándo actualizar los valores del formulario
11
+ * @param mode - Modo de validación del formulario (ej: 'onChange', 'onBlur', 'onSubmit')
12
+ * @returns Objeto con todos los métodos y propiedades de React Hook Form
13
+ * @example
14
+ * ```tsx
15
+ * const formMethods = useCustomForm({
16
+ * validationSchema: myValidationSchema,
17
+ * values: { name: '', email: '' },
18
+ * statusLoad: 'ready',
19
+ * mode: 'onChange'
20
+ * });
21
+ * ```
5
22
  */
6
23
  export declare function useCustomForm({ validationSchema, values, statusLoad, mode }: CustomFormArguments): import('react-hook-form').UseFormReturn<FieldValues, any, FieldValues>;
7
24
  /**
8
- * TODO: Documentar
25
+ * Componente que proporciona el contexto de React Hook Form con funcionalidades adicionales.
26
+ *
27
+ * Este componente envuelve el `FormProvider` de React Hook Form y expone métodos del formulario
28
+ * a través de una ref usando `useImperativeHandle`. Permite acceso programático a métodos
29
+ * como submit, reset, setValue, etc.
30
+ * @param props - Propiedades del componente que incluyen los métodos de React Hook Form
31
+ * @param ref - Referencia que expone los métodos del formulario
32
+ * @returns JSX del FormProvider con el formulario envuelto
33
+ * @example
34
+ * ```tsx
35
+ * const formRef = useRef<RHFormProviderRef>(null);
36
+ *
37
+ * const handleReset = () => {
38
+ * formRef.current?.reset();
39
+ * };
40
+ *
41
+ * return (
42
+ * <FormProviderCustom
43
+ * ref={formRef}
44
+ * onSubmit={handleSubmit}
45
+ * {...formMethods}
46
+ * >
47
+ * <input {...register('name')} />
48
+ * </FormProviderCustom>
49
+ * );
50
+ * ```
9
51
  */
10
- export declare function FormProviderCustom(props: FormProviderCustomProps): import("react/jsx-runtime").JSX.Element;
52
+ export declare const FormProviderCustom: import('react').ForwardRefExoticComponent<{
53
+ children: React.ReactNode | React.ReactNode[];
54
+ } & import('react-hook-form').UseFormReturn<FieldValues, any, FieldValues> & FormProviderProps & import('react').RefAttributes<RHFormProviderRef>>;
11
55
  /**
12
- * Componente que gestiona el `Provider` de `react-hook-form` y encapsula el formulario para la creación de formularios personalizados.
56
+ * Componente principal que gestiona el `Provider` de `react-hook-form` y encapsula el formulario para la creación de formularios personalizados.
57
+ *
58
+ * Este componente utiliza internamente `useForm` para inicializar todos los métodos necesarios para la manipulación del formulario,
59
+ * incluyendo validación con Yup, gestión de estados de carga, y exposición de métodos a través de refs.
13
60
  *
14
- * Este componente utiliza internamente `useForm` para inicializar todos los métodos necesarios para la manipulación del formulario.
61
+ * **Características principales:**
62
+ * - Integración completa con React Hook Form
63
+ * - Validación automática usando esquemas de Yup
64
+ * - Gestión de estados de carga para actualización de valores
65
+ * - Exposición de métodos del formulario a través de refs
66
+ * - Soporte para diferentes modos de validación
15
67
  *
16
- * Si necesitas acceder directamente a los métodos de `useForm`, puedes utilizar el `Provider` y el hook por separado mediante
68
+ * Si necesitas acceso directo a los métodos de `useForm`, puedes utilizar el `Provider` y el hook por separado mediante
17
69
  * `FormProviderCustom` y `useCustomForm`, respectivamente.
18
- * @param props
70
+ * @param props - Propiedades del componente
71
+ * @param props.children - Elementos hijos del formulario
72
+ * @param props.onSubmit - Función que se ejecuta al enviar el formulario
73
+ * @param props.values - Valores iniciales del formulario
74
+ * @param props.validationSchema - Esquema de validación de Yup
75
+ * @param props.statusLoad - Estado de carga del formulario (opcional, por defecto 'ready')
76
+ * @param props.className - Clases CSS adicionales (opcional)
77
+ * @param props.mode - Modo de validación del formulario (opcional)
78
+ * @param ref - Referencia que expone los métodos del formulario
79
+ * @returns JSX del formulario con contexto de React Hook Form
80
+ * @example
81
+ * ```tsx
82
+ * import { useRef } from 'react';
83
+ * import { RHFormProvider, RHFormProviderRef } from './RHFormContext';
84
+ * import * as yup from 'yup';
85
+ *
86
+ * const schema = yup.object({
87
+ * name: yup.string().required('El nombre es requerido'),
88
+ * email: yup.string().email('Email inválido').required('El email es requerido')
89
+ * });
90
+ *
91
+ * const MyForm = () => {
92
+ * const formRef = useRef<RHFormProviderRef>(null);
93
+ *
94
+ * const handleSubmit = (data: any) => {
95
+ * console.log('Datos del formulario:', data);
96
+ * };
97
+ *
98
+ * const handleReset = () => {
99
+ * formRef.current?.reset();
100
+ * };
101
+ *
102
+ * return (
103
+ * <RHFormProvider
104
+ * ref={formRef}
105
+ * onSubmit={handleSubmit}
106
+ * values={{ name: '', email: '' }}
107
+ * validationSchema={schema}
108
+ * statusLoad="ready"
109
+ * mode="onChange"
110
+ * >
111
+ * <input {...register('name')} placeholder="Nombre" />
112
+ * <input {...register('email')} placeholder="Email" />
113
+ * <button type="submit">Enviar</button>
114
+ * <button type="button" onClick={handleReset}>Resetear</button>
115
+ * </RHFormProvider>
116
+ * );
117
+ * };
118
+ * ```
19
119
  */
20
- export declare function RHFormProvider(props: FormProviderProps): import("react/jsx-runtime").JSX.Element;
120
+ export declare const RHFormProvider: import('react').ForwardRefExoticComponent<FormProviderProps & import('react').RefAttributes<RHFormProviderRef>>;
@@ -1,5 +1,5 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { useEffect } from "react";
2
+ import { forwardRef, useImperativeHandle, useEffect } from "react";
3
3
  import clsx from "clsx";
4
4
  import { FormProvider, useForm } from "react-hook-form";
5
5
  import { yupResolver } from "@hookform/resolvers/yup";
@@ -37,16 +37,30 @@ function useCustomForm({ validationSchema, values, statusLoad, mode }) {
37
37
  }, [statusLoad]);
38
38
  return formMethods;
39
39
  }
40
- function FormProviderCustom(props) {
41
- const { children, onSubmit, className, handleSubmit } = props;
40
+ const FormProviderCustom = forwardRef((props, ref) => {
41
+ const { children, onSubmit, className, handleSubmit, ...formMethods } = props;
42
+ useImperativeHandle(ref, () => ({
43
+ formMethods: { ...formMethods, handleSubmit },
44
+ submit: () => handleSubmit(onSubmit)(),
45
+ reset: formMethods.reset,
46
+ clearErrors: formMethods.clearErrors,
47
+ setValue: formMethods.setValue,
48
+ getValues: formMethods.getValues,
49
+ trigger: formMethods.trigger,
50
+ watch: formMethods.watch,
51
+ setError: formMethods.setError,
52
+ unregister: formMethods.unregister
53
+ }), [formMethods, handleSubmit, onSubmit]);
42
54
  return /* @__PURE__ */ jsx(FormProvider, { ...props, children: /* @__PURE__ */ jsx(FormProviderRoot, { className: clsx(classes.root, className), onSubmit: handleSubmit(onSubmit), children }) });
43
- }
44
- function RHFormProvider(props) {
55
+ });
56
+ FormProviderCustom.displayName = "FormProviderCustom";
57
+ const RHFormProvider = forwardRef((props, ref) => {
45
58
  const { children, onSubmit, values, validationSchema, statusLoad = "ready", className, mode } = props;
46
59
  const formMethods = useCustomForm({ validationSchema, statusLoad, values, mode });
47
60
  return /* @__PURE__ */ jsx(
48
61
  FormProviderCustom,
49
62
  {
63
+ ref,
50
64
  className,
51
65
  values,
52
66
  validationSchema,
@@ -56,7 +70,8 @@ function RHFormProvider(props) {
56
70
  children
57
71
  }
58
72
  );
59
- }
73
+ });
74
+ RHFormProvider.displayName = "RHFormProvider";
60
75
  export {
61
76
  FormProviderCustom as F,
62
77
  RHFormProvider as R,
@@ -1,20 +1,83 @@
1
1
  import { ReactNode } from 'react';
2
- import { FieldValues, FormProviderProps as RHFormProviderProps, Mode } from 'react-hook-form';
2
+ import { FieldValues, FormProviderProps as RHFormProviderProps, Mode, UseFormReturn } from 'react-hook-form';
3
+ /**
4
+ * Estados de carga del formulario que determinan cuándo y cómo actualizar los valores.
5
+ *
6
+ * - `initial`: Estado inicial del formulario
7
+ * - `new`: Formulario para crear un nuevo elemento
8
+ * - `edit`: Formulario para editar un elemento existente
9
+ * - `reload_values_provider`: Estado que indica que se deben recargar los valores del proveedor
10
+ * - `ready`: Formulario listo para ser usado
11
+ * - `error`: Estado de error en el formulario
12
+ */
3
13
  export type FormStatusLoad = 'initial' | 'new' | 'edit' | 'reload_values_provider' | 'ready' | 'error';
14
+ /**
15
+ * Tipo que define los valores iniciales del formulario.
16
+ * Extiende FieldValues de React Hook Form para mayor flexibilidad.
17
+ */
4
18
  export type FormInitialValues = FieldValues;
19
+ /**
20
+ * Propiedades del componente principal RHFormProvider.
21
+ * Define la interfaz para crear formularios con React Hook Form y validación Yup.
22
+ */
5
23
  export interface FormProviderProps {
24
+ /** Elementos hijos del formulario */
6
25
  children: ReactNode;
26
+ /** Función que se ejecuta al enviar el formulario con los datos validados */
7
27
  onSubmit: (data: FieldValues) => void;
28
+ /** Valores iniciales del formulario */
8
29
  values: FormInitialValues;
30
+ /** Esquema de validación de Yup */
9
31
  validationSchema: any;
32
+ /** Estado de carga del formulario (opcional, por defecto 'ready') */
10
33
  statusLoad?: FormStatusLoad;
34
+ /** Clases CSS adicionales (opcional) */
11
35
  className?: string;
36
+ /** Modo de validación del formulario (opcional) */
12
37
  mode?: Mode;
13
38
  }
39
+ /**
40
+ * Propiedades del componente FormProviderCustom.
41
+ * Combina las propiedades de React Hook Form con las propiedades personalizadas del formulario.
42
+ */
14
43
  export type FormProviderCustomProps = RHFormProviderProps & FormProviderProps;
44
+ /**
45
+ * Argumentos para el hook useCustomForm.
46
+ * Define los parámetros necesarios para configurar un formulario personalizado.
47
+ */
15
48
  export interface CustomFormArguments {
49
+ /** Valores iniciales del formulario */
16
50
  values: FormInitialValues;
51
+ /** Esquema de validación de Yup */
17
52
  validationSchema: any;
53
+ /** Estado de carga del formulario (opcional) */
18
54
  statusLoad?: FormStatusLoad;
55
+ /** Modo de validación del formulario (opcional) */
19
56
  mode?: Mode;
20
57
  }
58
+ /**
59
+ * Interfaz que define los métodos expuestos a través de la ref del RHFormProvider.
60
+ * Permite acceso programático a los métodos de React Hook Form desde componentes padre.
61
+ */
62
+ export interface RHFormProviderRef {
63
+ /** Objeto completo con todos los métodos de React Hook Form */
64
+ formMethods: UseFormReturn<FieldValues>;
65
+ /** Ejecuta el submit del formulario */
66
+ submit: () => void;
67
+ /** Resetea el formulario a sus valores iniciales */
68
+ reset: () => void;
69
+ /** Limpia todos los errores del formulario */
70
+ clearErrors: () => void;
71
+ /** Establece un valor en un campo específico del formulario */
72
+ setValue: (name: string, value: any, options?: any) => void;
73
+ /** Obtiene los valores actuales del formulario o de campos específicos */
74
+ getValues: (payload?: string | string[]) => any;
75
+ /** Dispara la validación de campos específicos o de todo el formulario */
76
+ trigger: (name?: string | string[]) => Promise<boolean>;
77
+ /** Observa cambios en campos específicos o en todo el formulario */
78
+ watch: (name?: string | string[]) => any;
79
+ /** Establece un error en un campo específico */
80
+ setError: (name: string, error: any) => void;
81
+ /** Desregistra campos del formulario */
82
+ unregister: (name: string | string[]) => void;
83
+ }
@@ -24,7 +24,9 @@ const Autocomplete = forwardRef(function Autocomplete2(props, ref) {
24
24
  htmlFor,
25
25
  readOnly = false,
26
26
  placeholder,
27
- startAdornment
27
+ startAdornment,
28
+ getOptionalStartAdornment,
29
+ getOptionalEndAdornment
28
30
  } = props;
29
31
  const { getLabel } = useModuleDictionary();
30
32
  const isSkeleton = useModuleSkeleton();
@@ -62,7 +64,9 @@ const Autocomplete = forwardRef(function Autocomplete2(props, ref) {
62
64
  ownerState,
63
65
  handleDelete,
64
66
  disabled,
65
- startAdornment
67
+ startAdornment,
68
+ getOptionalStartAdornment,
69
+ getOptionalEndAdornment
66
70
  });
67
71
  const endAdornments = useEndAdornments({
68
72
  loading,
@@ -6,6 +6,8 @@ export type UseAdornmentsProps<T> = {
6
6
  loading?: boolean;
7
7
  adjustedSize: 'small' | 'medium';
8
8
  getOptionLabelLocal: (option: T) => string;
9
+ getOptionalStartAdornment: (option: T) => React.ReactNode;
10
+ getOptionalEndAdornment: (option: T) => React.ReactNode;
9
11
  ownerState: AutocompleteOwnerState;
10
12
  handleDelete: (option: T) => void;
11
13
  getOptionUrlImage?: (option: T) => string;
@@ -10,7 +10,9 @@ function useStartAdornments(props) {
10
10
  ownerState,
11
11
  handleDelete,
12
12
  disabled,
13
- startAdornment
13
+ startAdornment,
14
+ getOptionalStartAdornment,
15
+ getOptionalEndAdornment
14
16
  } = props;
15
17
  const startAdornmentClone = startAdornment ? React.cloneElement(startAdornment, {
16
18
  size: adjustedSize
@@ -27,7 +29,9 @@ function useStartAdornments(props) {
27
29
  opacity: true,
28
30
  onDeleted: () => handleDelete(option),
29
31
  disabledDeleteButton: disabled,
30
- ownerState: { ...ownerState }
32
+ ownerState: { ...ownerState },
33
+ startIcon: getOptionalStartAdornment(option),
34
+ endIcon: getOptionalEndAdornment(option)
31
35
  },
32
36
  `${option}-${index}`
33
37
  )) }) });
@@ -38,7 +42,9 @@ function useStartAdornments(props) {
38
42
  getOptionLabelLocal,
39
43
  handleDelete,
40
44
  disabled,
41
- ownerState
45
+ ownerState,
46
+ getOptionalStartAdornment,
47
+ getOptionalEndAdornment
42
48
  ]);
43
49
  if (startAdornmentClone && internalAdornments) {
44
50
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -50,6 +50,14 @@ export interface AutocompleteProps<T, Multiple extends boolean | undefined> exte
50
50
  * Function to get the label for a given option.
51
51
  */
52
52
  getOptionLabel: (option: T | AutocompleteFreeSoloValueMapping<false>) => string;
53
+ /**
54
+ * Function to get the start adornment for a given option.
55
+ */
56
+ getOptionalStartAdornment: (option: T) => React.ReactNode;
57
+ /**
58
+ * Function to get the end adornment for a given option.
59
+ */
60
+ getOptionalEndAdornment: (option: T) => React.ReactNode;
53
61
  /**
54
62
  * Function to compare if an option matches the selected value.
55
63
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/components",
3
- "version": "9.3.19-BE021025-beta.2",
3
+ "version": "9.3.19-BE061025-beta.1",
4
4
  "license": "UNLICENSED",
5
5
  "description": "M4L Components",
6
6
  "lint-staged": {