@m4l/components 9.1.53 → 9.1.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@types/types.d.ts +10 -1
- package/components/Chip/Chip.js +108 -0
- package/components/Chip/ChipStyles.js +533 -0
- package/components/Chip/constants.d.ts +4 -0
- package/components/Chip/constants.js +8 -0
- package/components/Chip/slots/ChipEnum.d.ts +7 -7
- package/components/Chip/slots/ChipEnum.js +11 -0
- package/components/Chip/slots/ChipSlots.js +35 -0
- package/components/Chip/slots/index.js +1 -0
- package/components/Chip/types.d.ts +41 -11
- package/components/DynamicFilter/types.d.ts +2 -2
- package/components/Label/Label.styles.js +28 -8
- package/components/SideBar/subcomponents/ContentGroups/subcomponents/ContainerMenuItemsMain/styles.js +9 -21
- package/components/hook-form/RHFAutocomplete/RFHAutocompleteStyles.d.ts +2 -0
- package/components/hook-form/RHFAutocomplete/RFHAutocompleteStyles.js +24 -0
- package/components/hook-form/RHFAutocomplete/RHFAutocomplete.d.ts +3 -5
- package/components/hook-form/RHFAutocomplete/RHFAutocomplete.js +161 -4
- package/components/hook-form/RHFAutocomplete/RHFAutocomplete.test.d.ts +1 -0
- package/components/hook-form/RHFAutocomplete/constants.d.ts +9 -0
- package/components/hook-form/RHFAutocomplete/constants.js +4 -0
- package/components/hook-form/RHFAutocomplete/oldTypes.d.ts +43 -0
- package/components/hook-form/RHFAutocomplete/slots/RHFAutocompleteEnum.d.ts +4 -0
- package/components/hook-form/RHFAutocomplete/slots/RHFAutocompleteEnum.js +8 -0
- package/components/hook-form/RHFAutocomplete/slots/RHFAutocompleteSlots.d.ts +6 -0
- package/components/hook-form/RHFAutocomplete/slots/RHFAutocompleteSlots.js +17 -0
- package/components/hook-form/RHFAutocomplete/slots/index.d.ts +2 -0
- package/components/hook-form/RHFAutocomplete/slots/index.js +1 -0
- package/components/hook-form/RHFAutocomplete/types.d.ts +63 -25
- package/components/hook-form/RHFAutocompleteAsync/RHFAutocompleteAsync.d.ts +5 -8
- package/components/hook-form/RHFAutocompleteAsync/RHFAutocompleteAsync.js +105 -4
- package/components/hook-form/RHFAutocompleteAsync/RHFAutocompleteAsyncStyles.d.ts +2 -0
- package/components/hook-form/RHFAutocompleteAsync/RHFAutocompleteAsyncStyles.js +6 -0
- package/components/hook-form/RHFAutocompleteAsync/constants.d.ts +9 -0
- package/components/hook-form/RHFAutocompleteAsync/constants.js +4 -0
- package/components/hook-form/RHFAutocompleteAsync/slots/RHFAutocompleteEnumAsync.d.ts +3 -0
- package/components/hook-form/RHFAutocompleteAsync/slots/RHFAutocompleteEnumAsync.js +7 -0
- package/components/hook-form/RHFAutocompleteAsync/slots/RHFAutocompleteSlotsAsync.d.ts +1 -0
- package/components/hook-form/RHFAutocompleteAsync/slots/RHFAutocompleteSlotsAsync.js +12 -0
- package/components/hook-form/RHFAutocompleteAsync/slots/index.d.ts +2 -0
- package/components/hook-form/RHFAutocompleteAsync/slots/index.js +1 -0
- package/components/hook-form/RHFAutocompleteAsync/types.d.ts +19 -5
- package/components/mui_extended/Autocomplete/Autocomplete.d.ts +1 -1
- package/components/mui_extended/Autocomplete/Autocomplete.js +299 -0
- package/components/mui_extended/Autocomplete/AutocompleteStyles.js +136 -0
- package/components/mui_extended/Autocomplete/constants.js +4 -0
- package/components/mui_extended/Autocomplete/dictionary.d.ts +0 -2
- package/components/mui_extended/Autocomplete/index.js +1 -0
- package/components/mui_extended/Autocomplete/renderOptions/index.d.ts +3 -0
- package/components/mui_extended/Autocomplete/renderOptions/index.js +24 -0
- package/components/mui_extended/Autocomplete/slots /AutocompleteEnum.d.ts +2 -1
- package/components/mui_extended/Autocomplete/slots /AutocompleteEnum.js +19 -0
- package/components/mui_extended/Autocomplete/slots /AutocompleteSlots.d.ts +3 -0
- package/components/mui_extended/Autocomplete/slots /AutocompleteSlots.js +72 -0
- package/components/mui_extended/Autocomplete/slots /index.js +1 -0
- package/components/mui_extended/Autocomplete/types.d.ts +2 -2
- package/components/mui_extended/CircularProgress/CircularProgress.js +1 -1
- package/components/mui_extended/MenuItem/MenuItem.js +11 -12
- package/components/mui_extended/MenuItem/MenuItem.styles.js +56 -66
- package/components/mui_extended/MenuItem/constants.d.ts +4 -0
- package/components/mui_extended/MenuItem/constants.js +5 -1
- package/components/mui_extended/MenuItem/slots/MenuItemEnum.d.ts +1 -1
- package/components/mui_extended/MenuItem/slots/MenuItemEnum.js +1 -1
- package/components/mui_extended/MenuItem/slots/MenuItemSlots.js +3 -3
- package/components/mui_extended/MenuItem/types.d.ts +32 -11
- package/components/mui_extended/Pager/classes/index.d.ts +1 -1
- package/components/mui_extended/Popper/Popper.js +79 -0
- package/components/mui_extended/Popper/PopperStyles.js +265 -0
- package/components/mui_extended/Popper/constants.js +4 -0
- package/components/mui_extended/Popper/index.js +1 -0
- package/components/mui_extended/Popper/slots/PopperEnum.js +6 -0
- package/components/mui_extended/Popper/slots/PopperStlots.js +12 -0
- package/components/mui_extended/Popper/slots/index.js +1 -0
- package/components/mui_extended/Popper/types.js +1 -0
- package/components/mui_extended/Select/slots/SelectSlots.d.ts +1 -1
- package/components/mui_extended/Select/slots/SelectSlots.js +1 -1
- package/components/mui_extended/TextField/TextField.js +11 -11
- package/components/mui_extended/TextField/TextField.styles.js +108 -203
- package/components/mui_extended/TextField/constants.d.ts +10 -0
- package/components/mui_extended/TextField/constants.js +8 -3
- package/components/mui_extended/TextField/slots/TextFieldEnum.d.ts +4 -0
- package/components/mui_extended/TextField/slots/TextFieldEnum.js +7 -1
- package/components/mui_extended/TextField/slots/TextFieldSlots.js +1 -1
- package/components/mui_extended/TextField/types.d.ts +3 -4
- package/components/mui_extended/Typography/Typography.js +4 -3
- package/components/mui_extended/Typography/constants.d.ts +4 -0
- package/components/mui_extended/Typography/constants.js +5 -1
- package/components/mui_extended/Typography/slots/typographySlots.js +1 -1
- package/package.json +1 -1
- package/utils/getHeightSizeStyles.d.ts +12 -0
- package/utils/getHeightSizeStyles.js +13 -0
- package/components/hook-form/RHFAutocomplete/classes/constant.d.ts +0 -1
- package/components/hook-form/RHFAutocomplete/classes/constant.js +0 -4
- package/components/hook-form/RHFAutocomplete/classes/index.d.ts +0 -19
- package/components/hook-form/RHFAutocomplete/classes/index.js +0 -77
- package/components/hook-form/RHFAutocomplete/classes/types.d.ts +0 -26
- package/components/hook-form/RHFAutocomplete/styles.d.ts +0 -1
- package/components/hook-form/RHFAutocomplete/styles.js +0 -7
- package/components/hook-form/RHFAutocomplete/subcomponents/ComponentTypeImage/index.d.ts +0 -5
- package/components/hook-form/RHFAutocomplete/subcomponents/ComponentTypeImage/index.js +0 -293
- package/components/hook-form/RHFAutocomplete/subcomponents/ComponentTypeText/index.d.ts +0 -9
- package/components/hook-form/RHFAutocomplete/subcomponents/ComponentTypeText/index.js +0 -281
- package/components/hook-form/RHFAutocomplete/subcomponents/RenderOption/index.d.ts +0 -6
- package/components/hook-form/RHFAutocomplete/subcomponents/RenderOption/index.js +0 -25
- package/components/hook-form/RHFAutocomplete/subcomponents/RenderOption/styles.d.ts +0 -1
- package/components/hook-form/RHFAutocomplete/subcomponents/RenderOption/styles.js +0 -9
- package/components/hook-form/RHFAutocomplete/subcomponents/Skeleton/index.d.ts +0 -5
- package/components/hook-form/RHFAutocomplete/subcomponents/Skeleton/index.js +0 -28
- package/components/hook-form/RHFAutocomplete/subcomponents/Skeleton/types.d.ts +0 -6
- package/components/hook-form/RHFAutocomplete/test/constants.d.ts +0 -2
- package/components/hook-form/RHFAutocomplete/test/constants.js +0 -6
- package/components/hook-form/RHFAutocomplete/test/utils.d.ts +0 -2
- package/components/hook-form/RHFAutocomplete/test/utils.js +0 -7
- package/components/hook-form/RHFAutocompleteAsync/classes/constant.d.ts +0 -1
- package/components/hook-form/RHFAutocompleteAsync/classes/constant.js +0 -4
- package/components/hook-form/RHFAutocompleteAsync/classes/index.d.ts +0 -9
- package/components/hook-form/RHFAutocompleteAsync/classes/index.js +0 -26
- package/components/hook-form/RHFAutocompleteAsync/classes/types.d.ts +0 -4
- package/components/hook-form/RHFAutocompleteAsync/styles.d.ts +0 -4
- package/components/hook-form/RHFAutocompleteAsync/styles.js +0 -34
- package/components/hook-form/RHFAutocompleteAsync/subcomponents/ComponentTypeImage/index.d.ts +0 -10
- package/components/hook-form/RHFAutocompleteAsync/subcomponents/ComponentTypeImage/index.js +0 -103
- package/components/hook-form/RHFAutocompleteAsync/subcomponents/ComponentTypeText/index.d.ts +0 -9
- package/components/hook-form/RHFAutocompleteAsync/subcomponents/ComponentTypeText/index.js +0 -103
- package/components/hook-form/RHFAutocompleteAsync/tests/constants.d.ts +0 -1
- package/components/hook-form/RHFAutocompleteAsync/tests/constants.js +0 -4
- package/components/hook-form/RHFAutocompleteAsync/tests/utils.d.ts +0 -2
- package/components/hook-form/RHFAutocompleteAsync/tests/utils.js +0 -7
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { g as getComponentClasses } from "../../utils/getComponentSlotRoot.js";
|
|
2
|
+
import { C as ChipSlots } from "./slots/ChipEnum.js";
|
|
3
|
+
const CHIP_KEY_COMPONENT = "M4LChip";
|
|
4
|
+
const CHIP_CLASSES = getComponentClasses(CHIP_KEY_COMPONENT, ChipSlots);
|
|
5
|
+
export {
|
|
6
|
+
CHIP_CLASSES as C,
|
|
7
|
+
CHIP_KEY_COMPONENT as a
|
|
8
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export declare
|
|
2
|
-
|
|
3
|
-
skeletonChip
|
|
4
|
-
chipIcon
|
|
5
|
-
textChip
|
|
6
|
-
iconButton
|
|
7
|
-
}
|
|
1
|
+
export declare enum ChipSlots {
|
|
2
|
+
root = "root",
|
|
3
|
+
skeletonChip = "skeleton",
|
|
4
|
+
chipIcon = "icon",
|
|
5
|
+
textChip = "text",
|
|
6
|
+
iconButton = "iconButton"
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var ChipSlots = /* @__PURE__ */ ((ChipSlots2) => {
|
|
2
|
+
ChipSlots2["root"] = "root";
|
|
3
|
+
ChipSlots2["skeletonChip"] = "skeleton";
|
|
4
|
+
ChipSlots2["chipIcon"] = "icon";
|
|
5
|
+
ChipSlots2["textChip"] = "text";
|
|
6
|
+
ChipSlots2["iconButton"] = "iconButton";
|
|
7
|
+
return ChipSlots2;
|
|
8
|
+
})(ChipSlots || {});
|
|
9
|
+
export {
|
|
10
|
+
ChipSlots as C
|
|
11
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { styled } from "@mui/material/styles";
|
|
2
|
+
import { c as chipStyles } from "../ChipStyles.js";
|
|
3
|
+
import { a as CHIP_KEY_COMPONENT } from "../constants.js";
|
|
4
|
+
import { C as ChipSlots } from "./ChipEnum.js";
|
|
5
|
+
import { S as Skeleton } from "../../mui_extended/Skeleton/Skeleton.js";
|
|
6
|
+
import { T as Typography } from "../../mui_extended/Typography/Typography.js";
|
|
7
|
+
import { I as IconButton } from "../../mui_extended/IconButton/IconButton.js";
|
|
8
|
+
import { I as Icon } from "../../Icon/Icon.js";
|
|
9
|
+
const ChipRootStyled = styled("div", {
|
|
10
|
+
name: CHIP_KEY_COMPONENT,
|
|
11
|
+
slot: ChipSlots.root
|
|
12
|
+
})(chipStyles?.root);
|
|
13
|
+
const SkeletonChipStyled = styled(Skeleton, {
|
|
14
|
+
name: CHIP_KEY_COMPONENT,
|
|
15
|
+
slot: ChipSlots.skeletonChip
|
|
16
|
+
})(chipStyles?.skeletonChip);
|
|
17
|
+
const IconStyled = styled(Icon, {
|
|
18
|
+
name: CHIP_KEY_COMPONENT,
|
|
19
|
+
slot: ChipSlots.chipIcon
|
|
20
|
+
})(chipStyles?.chipIcon);
|
|
21
|
+
const TextChipStyled = styled(Typography, {
|
|
22
|
+
name: CHIP_KEY_COMPONENT,
|
|
23
|
+
slot: ChipSlots.textChip
|
|
24
|
+
})(chipStyles?.textChip);
|
|
25
|
+
const IconButtonStyled = styled(IconButton, {
|
|
26
|
+
name: CHIP_KEY_COMPONENT,
|
|
27
|
+
slot: ChipSlots.iconButton
|
|
28
|
+
})(chipStyles?.iconButton);
|
|
29
|
+
export {
|
|
30
|
+
ChipRootStyled as C,
|
|
31
|
+
IconButtonStyled as I,
|
|
32
|
+
SkeletonChipStyled as S,
|
|
33
|
+
TextChipStyled as T,
|
|
34
|
+
IconStyled as a
|
|
35
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -6,36 +6,66 @@ import { CHIP_KEY_COMPONENT } from './constants';
|
|
|
6
6
|
import { ChipSlots } from './slots';
|
|
7
7
|
type ChipVariants = 'contained' | 'outlined';
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* [startIcon] - Optional prop for the icon on the left in the `Chip`.
|
|
11
|
-
* [endIcon] - Optional prop for the icon on the right in the `Chip`.
|
|
12
|
-
* label - Text describing the `Chip`.
|
|
13
|
-
* [componentPaletteColor] - Customization of the component's palette color.
|
|
14
|
-
* [size] - Size of the `Chip` (default 'medium').
|
|
15
|
-
* [error] - Indicates if the `Chip` is in an error state.
|
|
16
|
-
* [variant] - Defines the variant of the `Chip` (default 'contained').
|
|
17
|
-
* [color] - Defines the color of the `Chip`.
|
|
9
|
+
* Propiedades del componente `Chip`.
|
|
18
10
|
* @createdAt 2024-12-06 11:17:21 - automatic
|
|
19
11
|
*/
|
|
20
12
|
export interface ChipProps {
|
|
13
|
+
/**
|
|
14
|
+
* Optional prop for the icon on the left in the `Chip`. Can accept a URL as a string to render an image icon, or a React component to render it directly.
|
|
15
|
+
*/
|
|
21
16
|
startIcon?: ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Optional prop for the icon on the right in the `Chip`. Can accept a URL as a string to render an image icon, or a React component to render it directly.
|
|
19
|
+
*/
|
|
22
20
|
endIcon?: ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* Size of the `Chip` (default 'medium').
|
|
23
|
+
*/
|
|
23
24
|
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
25
|
+
/**
|
|
26
|
+
* Text describing the `Chip`.
|
|
27
|
+
*/
|
|
24
28
|
label?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Defines the variant of the `Chip` (default 'contained').
|
|
31
|
+
*/
|
|
25
32
|
variant?: ChipVariants;
|
|
33
|
+
/**
|
|
34
|
+
* Defines the color of the `Chip`.
|
|
35
|
+
*/
|
|
26
36
|
color?: Exclude<ComponentPalletColor, 'primary'>;
|
|
37
|
+
/**
|
|
38
|
+
* Define el with of skeleton mode
|
|
39
|
+
*/
|
|
27
40
|
skeletonWidth?: string | number;
|
|
41
|
+
/**
|
|
42
|
+
* OPtion prop to render the close icon
|
|
43
|
+
*/
|
|
28
44
|
hasIconClose?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Opacity of the `Chip`.
|
|
47
|
+
*/
|
|
29
48
|
opacity?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Function to be executed when the `Chip` is clicked.
|
|
51
|
+
*/
|
|
30
52
|
onClick?: () => void;
|
|
53
|
+
/**
|
|
54
|
+
* Function to be executed when the `Chip` is deleted.
|
|
55
|
+
*/
|
|
31
56
|
onDeleted?: EventHandler<any>;
|
|
57
|
+
/**
|
|
58
|
+
* Class name for the `Chip`.
|
|
59
|
+
*/
|
|
60
|
+
className?: string;
|
|
32
61
|
}
|
|
33
62
|
/**
|
|
34
63
|
* Owner state of the `Chip` used to define internal style and behavior properties.
|
|
35
64
|
*/
|
|
36
|
-
export interface ChipOwnerState extends Pick<ChipProps, '
|
|
65
|
+
export interface ChipOwnerState extends Pick<ChipProps, 'variant' | 'color'> {
|
|
37
66
|
opacity?: boolean;
|
|
38
67
|
paletteColor: PaletteColor;
|
|
68
|
+
chipSize: ChipProps['size'];
|
|
39
69
|
}
|
|
40
70
|
/**
|
|
41
71
|
* Defines the types of Slots available for the `Chip`.
|
|
@@ -44,5 +74,5 @@ export type ChipSlotsType = keyof typeof ChipSlots;
|
|
|
44
74
|
/**
|
|
45
75
|
* Styles applicable to the `Chip` using themes and custom slots.
|
|
46
76
|
*/
|
|
47
|
-
export type ChipStyles =
|
|
77
|
+
export type ChipStyles = OverridesStyleRules<ChipSlotsType, typeof CHIP_KEY_COMPONENT, Theme>;
|
|
48
78
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Theme } from '@mui/material/styles';
|
|
2
2
|
import { OverridesStyleRules } from '@mui/material/styles/overrides';
|
|
3
3
|
import { Maybe } from '@m4l/core';
|
|
4
|
-
import {
|
|
4
|
+
import { RHFAutocompleteAsyncBaseProps } from '../hook-form/RHFAutocompleteAsync/types';
|
|
5
5
|
import { DynamicFilterSlots } from './slots';
|
|
6
6
|
export type FieldType = 'number' | 'string' | 'boolean' | 'datetime' | 'select';
|
|
7
7
|
export type OperandType = number | string | boolean | Date | [] | object;
|
|
@@ -21,7 +21,7 @@ export type FormOperandSelect = Record<string, any>;
|
|
|
21
21
|
export type OperandsArrayValues = Array<FormOperandSelect>;
|
|
22
22
|
export type FieldTypeOperator<T extends FieldType> = T extends 'boolean' ? BooleanOperator : T extends 'datetime' ? DateTimeOperator : T extends 'number' ? NumberOperator : T extends 'select' ? SelectOperator : T extends 'string' ? StringOperator : T;
|
|
23
23
|
export type FieldTypeOperand<T extends FieldType> = T extends 'boolean' ? boolean : T extends 'datetime' ? Date : T extends 'number' ? number : T extends 'string' ? string : T extends 'select' ? OperandsArrayValues : FieldType;
|
|
24
|
-
type SelectOptions = Pick<
|
|
24
|
+
type SelectOptions = Pick<RHFAutocompleteAsyncBaseProps<{
|
|
25
25
|
[key: string]: any;
|
|
26
26
|
}>, 'type' | 'endPoint' | 'getOptionLabel' | 'isOptionEqualToValue' | 'multiple' | 'autoComplete' | 'autoCapitalize' | 'parms' | 'timeout'> & {
|
|
27
27
|
getOptionId: (option: Record<string, any>) => string | number;
|
|
@@ -13,9 +13,10 @@ const labelStyles = {
|
|
|
13
13
|
flexWrap: "wrap",
|
|
14
14
|
width: "100%",
|
|
15
15
|
gap: theme.size.baseSpacings.sp1,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
"& .M4LLabelClassCss-root": {
|
|
17
|
+
...ownerState.disabled === true && {
|
|
18
|
+
color: theme.vars.palette.text.disabled + "!important"
|
|
19
|
+
}
|
|
19
20
|
},
|
|
20
21
|
flexDirection: "row",
|
|
21
22
|
[`& .${ownerState.label}`]: {
|
|
@@ -52,7 +53,8 @@ const labelStyles = {
|
|
|
52
53
|
},
|
|
53
54
|
"&.mandatoryAsterisk": {
|
|
54
55
|
color: theme.vars.palette.text.primary
|
|
55
|
-
}
|
|
56
|
+
},
|
|
57
|
+
"& span": {}
|
|
56
58
|
}),
|
|
57
59
|
/**
|
|
58
60
|
* Estilos para el mensaje obligatorio.
|
|
@@ -99,13 +101,31 @@ const labelStyles = {
|
|
|
99
101
|
* @updatedUser cesar - automatic
|
|
100
102
|
*/
|
|
101
103
|
skeletonStyled: ({ ownerState, theme }) => ({
|
|
102
|
-
|
|
104
|
+
width: "100%",
|
|
105
|
+
padding: theme.vars.size.baseSpacings.sp2,
|
|
106
|
+
borderRadius: theme.vars.size.borderRadius.r1,
|
|
107
|
+
display: "flex",
|
|
108
|
+
alignItems: "center",
|
|
109
|
+
background: theme.vars.palette.skeleton.transition,
|
|
110
|
+
// Estilos específicos para el tamaño small
|
|
103
111
|
...ownerState.size === "small" && {
|
|
104
|
-
...theme.generalSettings.isMobile ? {
|
|
112
|
+
...theme.generalSettings.isMobile ? {
|
|
113
|
+
height: theme.vars.size.mobile.small.action,
|
|
114
|
+
minHeight: theme.vars.size.mobile.small.action
|
|
115
|
+
} : {
|
|
116
|
+
height: theme.vars.size.desktop.small.action,
|
|
117
|
+
minHeight: theme.vars.size.desktop.small.action
|
|
118
|
+
}
|
|
105
119
|
},
|
|
106
|
-
//
|
|
120
|
+
// Estilos específicos para el tamaño medium
|
|
107
121
|
...ownerState.size === "medium" && {
|
|
108
|
-
...theme.generalSettings.isMobile ? {
|
|
122
|
+
...theme.generalSettings.isMobile ? {
|
|
123
|
+
height: theme.vars.size.mobile.medium.action,
|
|
124
|
+
minHeight: theme.vars.size.mobile.medium.action
|
|
125
|
+
} : {
|
|
126
|
+
height: theme.vars.size.desktop.medium.action,
|
|
127
|
+
minHeight: theme.vars.size.desktop.medium.action
|
|
128
|
+
}
|
|
109
129
|
},
|
|
110
130
|
...ownerState.type === "helperMessage" && {
|
|
111
131
|
borderRadius: theme.vars.size.borderRadius.r1
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { g as getHeightSizeStyles } from "../../../../../../utils/getHeightSizeStyles.js";
|
|
1
2
|
import { a as ITEM_IN_TREE_ACTIVE, I as ITEM_ACTIVE } from "../../../../constants.js";
|
|
2
3
|
const containerMenuItemsMainStyles = {
|
|
3
4
|
/**
|
|
@@ -12,34 +13,21 @@ const containerMenuItemsMainStyles = {
|
|
|
12
13
|
display: "flex",
|
|
13
14
|
flexDirection: "column",
|
|
14
15
|
gap: theme.vars.size.baseSpacings["sp0-5"],
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
minHeight: theme.vars.size.desktop.small.action
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
// Estilos específicos para el tamaño medium
|
|
25
|
-
...ownerState.sidebarSize === "medium" && {
|
|
26
|
-
...theme.generalSettings.isMobile ? {
|
|
27
|
-
minHeight: theme.vars.size.mobile.medium.action
|
|
28
|
-
} : {
|
|
29
|
-
minHeight: theme.vars.size.desktop.medium.action
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
[`&.M4LListMenuItem-root > .M4LMenuItemRoot[class*="${ITEM_IN_TREE_ACTIVE}"]`]: {
|
|
16
|
+
...getHeightSizeStyles(
|
|
17
|
+
theme.generalSettings.isMobile,
|
|
18
|
+
ownerState.size || "medium",
|
|
19
|
+
"container"
|
|
20
|
+
),
|
|
21
|
+
[`&.M4LListMenuItem-root > .M4LMenuItem-root[class*="${ITEM_IN_TREE_ACTIVE}"]`]: {
|
|
34
22
|
borderColor: theme.vars.palette.divider,
|
|
35
23
|
"& span": {
|
|
36
24
|
color: theme.vars.palette.text.primary
|
|
37
25
|
}
|
|
38
26
|
},
|
|
39
|
-
[`&.M4LListMenuItem-root > .
|
|
27
|
+
[`&.M4LListMenuItem-root > .M4LMenuItem-root[class*="${ITEM_IN_TREE_ACTIVE}"] .M4LIconClass-root`]: {
|
|
40
28
|
background: theme.vars.palette.text.primary
|
|
41
29
|
},
|
|
42
|
-
[`&.M4LListMenuItem-root > .
|
|
30
|
+
[`&.M4LListMenuItem-root > .M4LMenuItem-root[class*="${ITEM_ACTIVE}"]`]: {
|
|
43
31
|
borderColor: theme.vars.palette.primary.main,
|
|
44
32
|
"& span": {
|
|
45
33
|
color: theme.vars.palette.primary.main
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const rhfAutocompleteSyles = {
|
|
2
|
+
/**
|
|
3
|
+
* Styles for the root component.
|
|
4
|
+
*/
|
|
5
|
+
autocompleteRoot: ({ theme }) => ({
|
|
6
|
+
display: "flex",
|
|
7
|
+
flexDirection: "column",
|
|
8
|
+
gap: theme.vars.size.baseSpacings.sp1
|
|
9
|
+
}),
|
|
10
|
+
/**
|
|
11
|
+
* Styles for the label component.
|
|
12
|
+
* @param {object} theme - The theme object.
|
|
13
|
+
* @param {object} ownerState - The state of the owner component.
|
|
14
|
+
* @returns {object} The styles for the label.
|
|
15
|
+
*/
|
|
16
|
+
label: ({ theme, ownerState }) => ({
|
|
17
|
+
...ownerState.disabled === true && {
|
|
18
|
+
theme: theme.palette.text.disabled
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
rhfAutocompleteSyles as r
|
|
24
|
+
};
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { RHFAutocompleteProps } from './types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
* @
|
|
5
|
-
* @
|
|
6
|
-
* @updatedAt 2024-11-21 10:33:48 - automatic
|
|
7
|
-
* @updatedUser SebastianM - automatic
|
|
3
|
+
* RHFAutocomplete component renders an autocomplete input field with various customization options.
|
|
4
|
+
* @param props - The properties for the RHFAutocomplete component.
|
|
5
|
+
* @returns The RHFAutocomplete component.
|
|
8
6
|
*/
|
|
9
7
|
export declare function RHFAutocomplete<T>(props: RHFAutocompleteProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,8 +1,165 @@
|
|
|
1
|
-
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useModuleSkeleton, getPropertyByString } from "@m4l/core";
|
|
3
|
+
import { useResponsiveDesktop } from "@m4l/graphics";
|
|
4
|
+
import { useTheme } from "@mui/material";
|
|
5
|
+
import { useState, useEffect } from "react";
|
|
6
|
+
import { useFormContext, Controller } from "react-hook-form";
|
|
7
|
+
import { u as useFormFocus } from "../../../hooks/useFormFocus/index.js";
|
|
8
|
+
import { A as AutocompleteRootStyled, L as LabelStyled } from "./slots/RHFAutocompleteSlots.js";
|
|
9
|
+
import { A as Autocomplete } from "../../mui_extended/Autocomplete/Autocomplete.js";
|
|
10
|
+
import { H as HelperError } from "../../HelperError/HelperError.js";
|
|
4
11
|
function RHFAutocomplete(props) {
|
|
5
|
-
|
|
12
|
+
const {
|
|
13
|
+
name: nameRHF,
|
|
14
|
+
getOptionLabel,
|
|
15
|
+
isOptionEqualToValue,
|
|
16
|
+
label = "RHF Autocomplete",
|
|
17
|
+
color,
|
|
18
|
+
skeletonWidth = 100,
|
|
19
|
+
options,
|
|
20
|
+
disabled,
|
|
21
|
+
onOpen,
|
|
22
|
+
onClose,
|
|
23
|
+
loading,
|
|
24
|
+
variant,
|
|
25
|
+
helperMessage,
|
|
26
|
+
size = "small",
|
|
27
|
+
onChangeFilterParmsLocal,
|
|
28
|
+
mandatory,
|
|
29
|
+
mandatoryMessage,
|
|
30
|
+
multiple,
|
|
31
|
+
imageScale = true,
|
|
32
|
+
imageRepeat,
|
|
33
|
+
refresh
|
|
34
|
+
} = props;
|
|
35
|
+
const isSkeleton = useModuleSkeleton();
|
|
36
|
+
const {
|
|
37
|
+
isFocus,
|
|
38
|
+
isTabSelected,
|
|
39
|
+
handlerFocus,
|
|
40
|
+
handlerOnKeyUp,
|
|
41
|
+
handlerOnBlur
|
|
42
|
+
} = useFormFocus();
|
|
43
|
+
const theme = useTheme();
|
|
44
|
+
const [open, setOpen] = useState(false);
|
|
45
|
+
const isDesktop = useResponsiveDesktop();
|
|
46
|
+
const onCloseLocal = (event, reason) => {
|
|
47
|
+
setOpen(false);
|
|
48
|
+
if (onClose) {
|
|
49
|
+
onClose(event, reason);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const onOpenLocal = (event) => {
|
|
53
|
+
setOpen((currentState) => !currentState);
|
|
54
|
+
if (onOpen) {
|
|
55
|
+
onOpen(event);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const getOptionLabelLocal = (option) => {
|
|
59
|
+
if (option === void 0 || option === null) {
|
|
60
|
+
return "";
|
|
61
|
+
}
|
|
62
|
+
return getOptionLabel(option);
|
|
63
|
+
};
|
|
64
|
+
const paletteColor = getPropertyByString(
|
|
65
|
+
theme.vars.palette,
|
|
66
|
+
disabled ? "default" : color || "default",
|
|
67
|
+
theme.vars.palette.default
|
|
68
|
+
);
|
|
69
|
+
const {
|
|
70
|
+
control,
|
|
71
|
+
formState: { errors }
|
|
72
|
+
} = useFormContext();
|
|
73
|
+
const [currentVariant, setCurrentVariant] = useState(null);
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
const hasError = errors[nameRHF];
|
|
76
|
+
if (hasError) {
|
|
77
|
+
setCurrentVariant("error");
|
|
78
|
+
} else if (variant) {
|
|
79
|
+
setCurrentVariant(variant);
|
|
80
|
+
} else {
|
|
81
|
+
setCurrentVariant(null);
|
|
82
|
+
}
|
|
83
|
+
}, [errors, nameRHF, variant, control]);
|
|
84
|
+
const ownerState = {
|
|
85
|
+
size: !isDesktop ? "medium" : size,
|
|
86
|
+
isFocus: !isSkeleton ? isFocus : false,
|
|
87
|
+
isTabSelected: !isSkeleton ? isTabSelected : false,
|
|
88
|
+
semantics: currentVariant,
|
|
89
|
+
disabled,
|
|
90
|
+
multiple: Boolean(multiple),
|
|
91
|
+
imageScale: Boolean(imageScale),
|
|
92
|
+
imageRepeat: Boolean(imageRepeat),
|
|
93
|
+
autocompleteColor: color,
|
|
94
|
+
paletteColor
|
|
95
|
+
};
|
|
96
|
+
return /* @__PURE__ */ jsx(
|
|
97
|
+
AutocompleteRootStyled,
|
|
98
|
+
{
|
|
99
|
+
ownerState: { ...ownerState },
|
|
100
|
+
onFocus: handlerFocus,
|
|
101
|
+
onBlur: handlerOnBlur,
|
|
102
|
+
onKeyUp: handlerOnKeyUp,
|
|
103
|
+
size,
|
|
104
|
+
children: /* @__PURE__ */ jsx(
|
|
105
|
+
Controller,
|
|
106
|
+
{
|
|
107
|
+
name: nameRHF,
|
|
108
|
+
control,
|
|
109
|
+
render: ({ field: { onChange, value }, fieldState: { error } }) => {
|
|
110
|
+
const [inputValue, setInputValue] = useState(
|
|
111
|
+
getOptionLabelLocal(value)
|
|
112
|
+
);
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
if (!open && value === null && inputValue !== "") {
|
|
115
|
+
setInputValue("");
|
|
116
|
+
}
|
|
117
|
+
if (!open && value !== null && options.length === 0) {
|
|
118
|
+
onChangeFilterParmsLocal?.(getOptionLabelLocal(value), "reset");
|
|
119
|
+
}
|
|
120
|
+
}, [value, inputValue]);
|
|
121
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
122
|
+
label && /* @__PURE__ */ jsx(
|
|
123
|
+
LabelStyled,
|
|
124
|
+
{
|
|
125
|
+
ownerState: { ...ownerState },
|
|
126
|
+
label,
|
|
127
|
+
size,
|
|
128
|
+
mandatory,
|
|
129
|
+
mandatoryMessage,
|
|
130
|
+
helperMessage,
|
|
131
|
+
htmlFor: `autocomplete-${nameRHF}`,
|
|
132
|
+
disabled
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
/* @__PURE__ */ jsx(
|
|
136
|
+
Autocomplete,
|
|
137
|
+
{
|
|
138
|
+
...ownerState,
|
|
139
|
+
id: `autocomplete-${nameRHF}`,
|
|
140
|
+
options,
|
|
141
|
+
getOptionLabel,
|
|
142
|
+
isOptionEqualToValue,
|
|
143
|
+
multiple: multiple ? true : void 0,
|
|
144
|
+
onChange: (_e, newValue) => onChange(newValue),
|
|
145
|
+
refresh,
|
|
146
|
+
disabled,
|
|
147
|
+
loading,
|
|
148
|
+
onOpen: onOpenLocal,
|
|
149
|
+
onClose: onCloseLocal,
|
|
150
|
+
skeletonWidth,
|
|
151
|
+
open,
|
|
152
|
+
size,
|
|
153
|
+
value
|
|
154
|
+
}
|
|
155
|
+
),
|
|
156
|
+
currentVariant === "error" ? /* @__PURE__ */ jsx(HelperError, { message: error?.message }) : null
|
|
157
|
+
] });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
}
|
|
162
|
+
);
|
|
6
163
|
}
|
|
7
164
|
export {
|
|
8
165
|
RHFAutocomplete as R
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clave de identificación del componente Autocomplete dentro del sistema.
|
|
3
|
+
*
|
|
4
|
+
* Esta constante se utiliza como identificador único para asociar y personalizar estilos y configuraciones
|
|
5
|
+
* relacionadas con el componente `Autocomplete` dentro del sistema de temas y estilos.
|
|
6
|
+
* @default 'RHFM4LAutocomplete'
|
|
7
|
+
*/
|
|
8
|
+
export declare const RFHAUTOCOMPLETE_KEY_COMPONENT = "RHFM4LAutocomplete";
|
|
9
|
+
export declare const RFHAUTOCOMPLETE_CLASS_NAME_SPECIFY = "RHFM4LclasssAutocompleCssSpecificity";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { AutocompleteCloseReason, AutocompleteInputChangeReason, TextFieldProps } from '@mui/material';
|
|
2
|
+
import { LabelProps } from '../../Label/types';
|
|
3
|
+
export type GetOptionString<T> = (option: T | null) => string;
|
|
4
|
+
export type RHFAutocompleteVariants = 'info' | 'success' | 'warning';
|
|
5
|
+
export type ImageProps<T> = (RHFAutocompleteTypeImageProps<T> & {
|
|
6
|
+
imageScale?: boolean;
|
|
7
|
+
imageRepeat?: never;
|
|
8
|
+
}) | (RHFAutocompleteTypeImageProps<T> & {
|
|
9
|
+
imageRepeat: boolean;
|
|
10
|
+
imageScale?: never;
|
|
11
|
+
});
|
|
12
|
+
export interface RHFAutocompleteBaseProps<T> extends Omit<TextFieldProps, 'label' | 'variant'>, Omit<LabelProps, 'label'> {
|
|
13
|
+
name: string;
|
|
14
|
+
options: Array<T>;
|
|
15
|
+
getOptionLabel: (option: T) => string;
|
|
16
|
+
isOptionEqualToValue: (option: T, value: T) => boolean;
|
|
17
|
+
skeletonWidth?: string | number;
|
|
18
|
+
skeletonHeight?: string | number;
|
|
19
|
+
loading?: boolean;
|
|
20
|
+
refresh?: () => void;
|
|
21
|
+
label?: string;
|
|
22
|
+
variant?: RHFAutocompleteVariants;
|
|
23
|
+
helperMessage?: string;
|
|
24
|
+
onOpen?: (event: React.SyntheticEvent) => void;
|
|
25
|
+
onClose?: (event: React.SyntheticEvent, reason: AutocompleteCloseReason) => void;
|
|
26
|
+
onChangeFilterParmsLocal?: (newValue: string, reason: AutocompleteInputChangeReason) => void;
|
|
27
|
+
multiple?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface RHFAutocompleteTypeTextProps {
|
|
30
|
+
type: 'text';
|
|
31
|
+
}
|
|
32
|
+
export interface RHFAutocompleteTypeImageProps<T> {
|
|
33
|
+
type: 'image';
|
|
34
|
+
getOptionUrlImage: (option: T) => string;
|
|
35
|
+
}
|
|
36
|
+
export type RHFAutocompleteProps<T> = (RHFAutocompleteBaseProps<T> & ImageProps<T>) | (RHFAutocompleteBaseProps<T> & RHFAutocompleteTypeTextProps);
|
|
37
|
+
export interface OwnerState extends Pick<RHFAutocompleteProps<any>, 'size' | 'disabled'>, Pick<ImageProps<any>, 'imageScale' | 'imageRepeat'> {
|
|
38
|
+
isFocus: boolean;
|
|
39
|
+
isTabSelected: boolean;
|
|
40
|
+
semantics: RHFAutocompleteVariants | 'error' | null;
|
|
41
|
+
variant?: 'withImage';
|
|
42
|
+
multiple: boolean;
|
|
43
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
var RFHAutocompleteSlots = /* @__PURE__ */ ((RFHAutocompleteSlots2) => {
|
|
2
|
+
RFHAutocompleteSlots2["autocompleteRoot"] = "autocompleteRoot";
|
|
3
|
+
RFHAutocompleteSlots2["label"] = "label";
|
|
4
|
+
return RFHAutocompleteSlots2;
|
|
5
|
+
})(RFHAutocompleteSlots || {});
|
|
6
|
+
export {
|
|
7
|
+
RFHAutocompleteSlots as R
|
|
8
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const AutocompleteRootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('../types').RHFAutocompleteOwnerState> & Record<string, unknown> & {
|
|
2
|
+
ownerState: Partial<import('../types').RHFAutocompleteOwnerState> & Record<string, unknown>;
|
|
3
|
+
}, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').HTMLAttributes<HTMLDivElement> | keyof import('react').ClassAttributes<HTMLDivElement>>, {}>;
|
|
4
|
+
export declare const LabelStyled: import('@emotion/styled').StyledComponent<Pick<import('../../../Label').LabelProps, keyof import('../../../Label').LabelProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('../types').RHFAutocompleteOwnerState> & Record<string, unknown> & {
|
|
5
|
+
ownerState: Partial<import('../types').RHFAutocompleteOwnerState> & Record<string, unknown>;
|
|
6
|
+
}, {}, {}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { styled } from "@mui/material";
|
|
2
|
+
import { r as rhfAutocompleteSyles } from "../RFHAutocompleteStyles.js";
|
|
3
|
+
import { R as RFHAUTOCOMPLETE_KEY_COMPONENT } from "../constants.js";
|
|
4
|
+
import { R as RFHAutocompleteSlots } from "./RHFAutocompleteEnum.js";
|
|
5
|
+
import { L as Label } from "../../../Label/Label.js";
|
|
6
|
+
const AutocompleteRootStyled = styled("div", {
|
|
7
|
+
name: RFHAUTOCOMPLETE_KEY_COMPONENT,
|
|
8
|
+
slot: RFHAutocompleteSlots.autocompleteRoot
|
|
9
|
+
})(rhfAutocompleteSyles?.autocompleteRoot);
|
|
10
|
+
const LabelStyled = styled(Label, {
|
|
11
|
+
name: RFHAUTOCOMPLETE_KEY_COMPONENT,
|
|
12
|
+
slot: RFHAutocompleteSlots.label
|
|
13
|
+
})(rhfAutocompleteSyles?.label);
|
|
14
|
+
export {
|
|
15
|
+
AutocompleteRootStyled as A,
|
|
16
|
+
LabelStyled as L
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|