@m4l/components 8.1.0-beta.devManuela.HelperError → 8.1.0-beta.devManuela.IconButton
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/components/HelperError/HelperError.js +2 -18
- package/components/HelperError/HelperError.stories.d.ts +1 -7
- package/components/HelperError/HelperError.styles.js +4 -23
- package/components/HelperError/constant.d.ts +0 -4
- package/components/HelperError/slots/HelperErrorEnum.d.ts +1 -5
- package/components/HelperError/slots/HelperErrorEnum.js +0 -1
- package/components/HelperError/slots/HelperErrorSlots.d.ts +2 -5
- package/components/HelperError/slots/HelperErrorSlots.js +0 -5
- package/components/HelperError/types.d.ts +2 -23
- package/components/mui_extended/IconButton/IconButton.d.ts +1 -5
- package/components/mui_extended/IconButton/IconButton.js +61 -26
- package/components/mui_extended/IconButton/IconButton.styles.js +4 -1
- package/components/mui_extended/IconButton/slots/IconButtonEnum.d.ts +2 -1
- package/components/mui_extended/IconButton/slots/IconButtonEnum.js +1 -0
- package/components/mui_extended/IconButton/slots/IconButtonSlots.d.ts +3 -0
- package/components/mui_extended/IconButton/slots/IconButtonSlots.js +7 -1
- package/components/mui_extended/IconButton/types.d.ts +46 -2
- package/package.json +1 -1
|
@@ -1,27 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { getPropertyByString } from "@m4l/core";
|
|
3
|
-
import { useTheme } from "@mui/material";
|
|
4
|
-
import { u as useComponentSize } from "../../hooks/useComponentSize/useComponentSize.js";
|
|
5
2
|
import { T as TypographyStyled } from "./slots/HelperErrorSlots.js";
|
|
6
3
|
const HelperError = (props) => {
|
|
7
|
-
const { message = "", skeletonWidth
|
|
8
|
-
const { currentSize } = useComponentSize(size);
|
|
9
|
-
const theme = useTheme();
|
|
10
|
-
const paletteColor = getPropertyByString(
|
|
11
|
-
theme.palette,
|
|
12
|
-
error ? "error" : "default",
|
|
13
|
-
theme.palette.default
|
|
14
|
-
);
|
|
15
|
-
const ownerState = {
|
|
16
|
-
helperErrorPaletteColor: paletteColor,
|
|
17
|
-
helperStateError: error,
|
|
18
|
-
helperErrorSizes: size
|
|
19
|
-
};
|
|
4
|
+
const { message = "", skeletonWidth } = props;
|
|
20
5
|
return /* @__PURE__ */ jsx(
|
|
21
6
|
TypographyStyled,
|
|
22
7
|
{
|
|
23
|
-
|
|
24
|
-
ownerState: { ...ownerState, size: currentSize },
|
|
8
|
+
ownerState: {},
|
|
25
9
|
variant: "body",
|
|
26
10
|
skeletonWidth,
|
|
27
11
|
children: message
|
|
@@ -4,10 +4,4 @@ declare const meta: Meta<typeof HelperError>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof HelperError>;
|
|
6
6
|
/** Base HelperError component */
|
|
7
|
-
export declare const
|
|
8
|
-
/** Small HelperError component */
|
|
9
|
-
export declare const small: Story;
|
|
10
|
-
/** Medium HelperError component */
|
|
11
|
-
export declare const medium: Story;
|
|
12
|
-
/** Skeleton HelperError component */
|
|
13
|
-
export declare const Skeleton: Story;
|
|
7
|
+
export declare const Base: Story;
|
|
@@ -1,30 +1,11 @@
|
|
|
1
1
|
const helperErrorStyles = {
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* TODO: Documentar
|
|
4
4
|
*/
|
|
5
|
-
root: ({ theme
|
|
6
|
-
"
|
|
7
|
-
color:
|
|
8
|
-
...ownerState.size === "small" && {
|
|
9
|
-
...theme.generalSettings.isMobile ? { height: theme.size.typography.mobile.small } : { height: theme.size.typography.desktop.small }
|
|
10
|
-
},
|
|
11
|
-
...ownerState.size === "medium" && {
|
|
12
|
-
...theme.generalSettings.isMobile ? { height: theme.size.typography.mobile.medium } : { height: theme.size.typography.desktop.medium }
|
|
13
|
-
}
|
|
5
|
+
root: ({ theme }) => ({
|
|
6
|
+
"& .MuiTypography-root": {
|
|
7
|
+
color: theme.vars.palette.error.main
|
|
14
8
|
}
|
|
15
|
-
}),
|
|
16
|
-
/**
|
|
17
|
-
* Estilos personalizados Skeleton
|
|
18
|
-
*/
|
|
19
|
-
skeletonStyled: ({ theme, ownerState }) => ({
|
|
20
|
-
...ownerState.size === "small" && {
|
|
21
|
-
...theme.generalSettings.isMobile ? { height: theme.size.typography.desktop.small } : { height: theme.vars.size.desktop.small.container }
|
|
22
|
-
},
|
|
23
|
-
// Condiciones de tamaño Medium en el root
|
|
24
|
-
...ownerState.size === "medium" && {
|
|
25
|
-
...theme.generalSettings.isMobile ? { height: theme.vars.size.mobile.medium.container } : { height: theme.vars.size.desktop.medium.container }
|
|
26
|
-
},
|
|
27
|
-
variants: []
|
|
28
9
|
})
|
|
29
10
|
};
|
|
30
11
|
export {
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export declare const TypographyStyled: import('@emotion/styled').StyledComponent<Pick<import('../../mui_extended/Typography/types').TypographyProps, keyof import('../../mui_extended/Typography/types').TypographyProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Partial<import('
|
|
2
|
-
ownerState: Partial<import('
|
|
3
|
-
}, {}, {}>;
|
|
4
|
-
export declare const SkeletonStyled: import('@emotion/styled').StyledComponent<Pick<import('../../mui_extended/Skeleton/types').SkeletonProps, keyof import('../../mui_extended/Skeleton/types').SkeletonProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Partial<import('../types').HelperErrorOwnerState> & Record<string, unknown> & {
|
|
5
|
-
ownerState: Partial<import('../types').HelperErrorOwnerState> & Record<string, unknown>;
|
|
1
|
+
export declare const TypographyStyled: import('@emotion/styled').StyledComponent<Pick<import('../../mui_extended/Typography/types').TypographyProps, keyof import('../../mui_extended/Typography/types').TypographyProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Partial<import('..').HelperErrorProps> & Record<string, unknown> & {
|
|
2
|
+
ownerState: Partial<import('..').HelperErrorProps> & Record<string, unknown>;
|
|
6
3
|
}, {}, {}>;
|
|
@@ -3,15 +3,10 @@ import { H as HelperErrorSlots } from "./HelperErrorEnum.js";
|
|
|
3
3
|
import { H as HELPER_ERROR_KEY_COMPONENT } from "../constant.js";
|
|
4
4
|
import { h as helperErrorStyles } from "../HelperError.styles.js";
|
|
5
5
|
import { T as Typography } from "../../mui_extended/Typography/Typography.js";
|
|
6
|
-
import { S as Skeleton } from "../../mui_extended/Skeleton/Skeleton.js";
|
|
7
6
|
const TypographyStyled = styled(Typography, {
|
|
8
7
|
name: HELPER_ERROR_KEY_COMPONENT,
|
|
9
8
|
slot: HelperErrorSlots.root
|
|
10
9
|
})(helperErrorStyles?.root);
|
|
11
|
-
styled(Skeleton, {
|
|
12
|
-
name: HELPER_ERROR_KEY_COMPONENT,
|
|
13
|
-
slot: HelperErrorSlots.skeletonStyled
|
|
14
|
-
})(helperErrorStyles?.skeletonStyled);
|
|
15
10
|
export {
|
|
16
11
|
TypographyStyled as T
|
|
17
12
|
};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
2
|
import { TypographyProps } from '../mui_extended/Typography/types';
|
|
3
3
|
import { HELPER_ERROR_KEY_COMPONENT } from './constant';
|
|
4
4
|
import { HelperErrorSlots } from './slots';
|
|
5
5
|
import { OverridesStyleRules } from '@mui/material/styles/overrides';
|
|
6
|
-
import { ComponentPalletColor, Sizes } from '@m4l/styles';
|
|
7
|
-
export type HelperErrorSize = 'small' | 'medium';
|
|
8
6
|
/**
|
|
9
7
|
* Extiende de TypographyProps para incluir propiedades de esqueleto y añade la propiedad `message`.
|
|
10
8
|
* `message` es el mensaje de error a mostrar.
|
|
@@ -14,31 +12,12 @@ export interface HelperErrorProps extends Pick<TypographyProps, 'skeletonWidth'>
|
|
|
14
12
|
* Mensaje que se visualiza en el componente HelperError.
|
|
15
13
|
*/
|
|
16
14
|
message: string | undefined;
|
|
17
|
-
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
18
|
-
error?: boolean;
|
|
19
15
|
}
|
|
20
16
|
/**
|
|
21
17
|
* Representa el estado del componente HelperError, incluyendo todas las propiedades de HelperErrorProps.
|
|
22
18
|
* Se utiliza para controlar el estilo del componente basado en su estado.
|
|
23
19
|
*/
|
|
24
|
-
export
|
|
25
|
-
/**
|
|
26
|
-
* Color de la paleta del campo de texto.
|
|
27
|
-
*/
|
|
28
|
-
helperErrorPaletteColor: PaletteColor;
|
|
29
|
-
/**
|
|
30
|
-
* Color de la paleta del componente del campo de texto.
|
|
31
|
-
*/
|
|
32
|
-
helperErrorComponentPaletteColor?: ComponentPalletColor;
|
|
33
|
-
/**
|
|
34
|
-
* Tamaño del campo de texto.
|
|
35
|
-
*/
|
|
36
|
-
helperErrorSizes: Extract<Sizes, 'small' | 'medium'>;
|
|
37
|
-
/**
|
|
38
|
-
* Indica si el campo de texto es error.
|
|
39
|
-
*/
|
|
40
|
-
helperStateError?: boolean;
|
|
41
|
-
}
|
|
20
|
+
export type HelperErrorOwnerState = HelperErrorProps;
|
|
42
21
|
/**
|
|
43
22
|
* Define los tipos de slots disponibles en HelperError utilizando las claves de HelperErrorSlots.
|
|
44
23
|
*/
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { IconButtonProps } from './types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
*Los Icon button son habitualmente ubicados en barras de aplicaciones y barras de herramientas. Además, resulta adecuado emplear iconos en botones de alternancia que posibilitan la selección o deselección de una única opción, como añadir o eliminar una estrella a un elemento.
|
|
4
4
|
* @param props
|
|
5
5
|
* @returns
|
|
6
|
-
* @author Juan Escobar - automatic
|
|
7
|
-
* @updatedAt 2024-10-15 17:33:28 - automatic
|
|
8
|
-
* @updatedUser Juan Escobar - automatic
|
|
9
|
-
* @createdAt 2024-10-15 17:33:28 - automatic
|
|
10
6
|
*/
|
|
11
7
|
export declare const IconButton: (props: IconButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo } from "react";
|
|
3
|
+
import { getPropertyByString } from "@m4l/core";
|
|
3
4
|
import { useTheme } from "@mui/material";
|
|
4
5
|
import { e as evalIconColor } from "./helpers/evalIconColor.js";
|
|
5
|
-
import { getPropertyByString, useModuleDictionary } from "@m4l/core";
|
|
6
6
|
import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
|
|
7
|
-
import { S as StyledMUIIconButton, B as BadgeStyled, I as IconStyled } from "./slots/IconButtonSlots.js";
|
|
7
|
+
import { T as TooltipStyled, S as StyledMUIIconButton, B as BadgeStyled, I as IconStyled } from "./slots/IconButtonSlots.js";
|
|
8
8
|
const IconButton = (props) => {
|
|
9
9
|
const {
|
|
10
10
|
src,
|
|
@@ -14,15 +14,20 @@ const IconButton = (props) => {
|
|
|
14
14
|
disabled,
|
|
15
15
|
onClick,
|
|
16
16
|
badgeContent,
|
|
17
|
-
withBadge = false,
|
|
18
17
|
dictionaryTooltipId,
|
|
18
|
+
tooltipContent,
|
|
19
|
+
placement = "bottom",
|
|
20
|
+
instaceDataTestId,
|
|
19
21
|
componentPaletteColor = "default",
|
|
20
|
-
rotationAngle,
|
|
21
22
|
...other
|
|
22
23
|
} = props;
|
|
23
24
|
const { currentSize } = useComponentSize(size);
|
|
24
25
|
const theme = useTheme();
|
|
25
|
-
const paletteColor = getPropertyByString(
|
|
26
|
+
const paletteColor = getPropertyByString(
|
|
27
|
+
theme.palette,
|
|
28
|
+
disabled ? "default" : componentPaletteColor,
|
|
29
|
+
theme.palette.default
|
|
30
|
+
);
|
|
26
31
|
const ownerState = {
|
|
27
32
|
variant,
|
|
28
33
|
size,
|
|
@@ -34,20 +39,53 @@ const IconButton = (props) => {
|
|
|
34
39
|
() => evalIconColor(componentPaletteColor, variant),
|
|
35
40
|
[componentPaletteColor, variant]
|
|
36
41
|
);
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
return /* @__PURE__ */ jsx(Fragment, { children: tooltipContent ? /* @__PURE__ */ jsx(
|
|
43
|
+
TooltipStyled,
|
|
44
|
+
{
|
|
45
|
+
title: tooltipContent.toString(),
|
|
46
|
+
ownerState: {},
|
|
47
|
+
placement,
|
|
48
|
+
children: /* @__PURE__ */ jsx(
|
|
49
|
+
StyledMUIIconButton,
|
|
50
|
+
{
|
|
51
|
+
ownerState: { ...ownerState },
|
|
52
|
+
onClick: !disabled ? onClick : void 0,
|
|
53
|
+
disableRipple: true,
|
|
54
|
+
disabled,
|
|
55
|
+
"data-testid": "IconButtonRoot",
|
|
56
|
+
tabIndex: 0,
|
|
57
|
+
...other,
|
|
58
|
+
children: badgeContent ? /* @__PURE__ */ jsx(
|
|
59
|
+
BadgeStyled,
|
|
60
|
+
{
|
|
61
|
+
ownerState: { ...ownerState },
|
|
62
|
+
badgeContent,
|
|
63
|
+
componentPaletteColor,
|
|
64
|
+
children: /* @__PURE__ */ jsx(
|
|
65
|
+
IconStyled,
|
|
66
|
+
{
|
|
67
|
+
ownerState: { ...ownerState },
|
|
68
|
+
src,
|
|
69
|
+
size: currentSize,
|
|
70
|
+
color: iconColor,
|
|
71
|
+
disabled
|
|
72
|
+
}
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
) : /* @__PURE__ */ jsx(
|
|
76
|
+
IconStyled,
|
|
77
|
+
{
|
|
78
|
+
ownerState: { ...ownerState },
|
|
79
|
+
src,
|
|
80
|
+
size: currentSize,
|
|
81
|
+
color: iconColor,
|
|
82
|
+
disabled
|
|
83
|
+
}
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
)
|
|
47
87
|
}
|
|
48
|
-
|
|
49
|
-
}, [tooltip, dictionaryTooltipId, getLabel, disabled]);
|
|
50
|
-
return /* @__PURE__ */ jsx(
|
|
88
|
+
) : /* @__PURE__ */ jsx(
|
|
51
89
|
StyledMUIIconButton,
|
|
52
90
|
{
|
|
53
91
|
ownerState: { ...ownerState },
|
|
@@ -57,7 +95,7 @@ const IconButton = (props) => {
|
|
|
57
95
|
"data-testid": "IconButtonRoot",
|
|
58
96
|
tabIndex: 0,
|
|
59
97
|
...other,
|
|
60
|
-
children:
|
|
98
|
+
children: badgeContent ? /* @__PURE__ */ jsx(
|
|
61
99
|
BadgeStyled,
|
|
62
100
|
{
|
|
63
101
|
ownerState: { ...ownerState },
|
|
@@ -70,9 +108,7 @@ const IconButton = (props) => {
|
|
|
70
108
|
src,
|
|
71
109
|
size: currentSize,
|
|
72
110
|
color: iconColor,
|
|
73
|
-
disabled
|
|
74
|
-
tooltipContent: finalTooltip,
|
|
75
|
-
rotationAngle
|
|
111
|
+
disabled
|
|
76
112
|
}
|
|
77
113
|
)
|
|
78
114
|
}
|
|
@@ -83,12 +119,11 @@ const IconButton = (props) => {
|
|
|
83
119
|
src,
|
|
84
120
|
size: currentSize,
|
|
85
121
|
color: iconColor,
|
|
86
|
-
disabled
|
|
87
|
-
tooltipContent: finalTooltip
|
|
122
|
+
disabled
|
|
88
123
|
}
|
|
89
124
|
)
|
|
90
125
|
}
|
|
91
|
-
);
|
|
126
|
+
) });
|
|
92
127
|
};
|
|
93
128
|
export {
|
|
94
129
|
IconButton as I
|
|
@@ -2,6 +2,7 @@ var IconButtonSlots = /* @__PURE__ */ ((IconButtonSlots2) => {
|
|
|
2
2
|
IconButtonSlots2["styledMUIIconButton"] = "styledMUIIconButton";
|
|
3
3
|
IconButtonSlots2["icon"] = "icon";
|
|
4
4
|
IconButtonSlots2["badgeIconButton"] = "badgeIconButton";
|
|
5
|
+
IconButtonSlots2["tooltip"] = "tooltip";
|
|
5
6
|
return IconButtonSlots2;
|
|
6
7
|
})(IconButtonSlots || {});
|
|
7
8
|
export {
|
|
@@ -11,3 +11,6 @@ export declare const BadgeStyled: import('@emotion/styled').StyledComponent<Pick
|
|
|
11
11
|
}, "color" | "sx" | "classes" | "className" | "style" | "children" | "components" | "componentsProps" | "slotProps" | "slots" | "badgeContent" | "variant" | "anchorOrigin" | "invisible" | "max" | "overlap" | "showZero">, "color" | "content" | "translate" | "sx" | "classes" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "hidden" | "id" | "lang" | "nonce" | "slot" | "spellCheck" | "style" | "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" | "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" | "children" | "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" | "onResize" | "onResizeCapture" | "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" | "components" | "componentsProps" | "slotProps" | "slots" | "ref" | "key" | "badgeContent" | "variant" | "anchorOrigin" | "invisible" | "max" | "overlap" | "showZero"> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('../types').IconButtonOwnerState> & Record<string, unknown> & {
|
|
12
12
|
ownerState: Partial<import('../types').IconButtonOwnerState> & Record<string, unknown>;
|
|
13
13
|
}, {}, {}>;
|
|
14
|
+
export declare const TooltipStyled: import('@emotion/styled').StyledComponent<Pick<import('../../Tooltip').TooltipProps, keyof import('../../Tooltip').TooltipProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material').Theme> & Partial<import('../types').IconButtonOwnerState> & Record<string, unknown> & {
|
|
15
|
+
ownerState: Partial<import('../types').IconButtonOwnerState> & Record<string, unknown>;
|
|
16
|
+
}, {}, {}>;
|
|
@@ -4,6 +4,7 @@ import { i as iconButtonStyles } from "../IconButton.styles.js";
|
|
|
4
4
|
import { I as IconButtonSlots } from "./IconButtonEnum.js";
|
|
5
5
|
import { IconButton, Badge } from "@mui/material";
|
|
6
6
|
import { I as Icon } from "../../../Icon/Icon.js";
|
|
7
|
+
import { T as Tooltip } from "../../Tooltip/Tooltip.js";
|
|
7
8
|
const StyledMUIIconButton = styled(IconButton, {
|
|
8
9
|
name: ICON_BUTTON_KEY_COMPONENT,
|
|
9
10
|
slot: IconButtonSlots.styledMUIIconButton
|
|
@@ -16,8 +17,13 @@ const BadgeStyled = styled(Badge, {
|
|
|
16
17
|
name: ICON_BUTTON_KEY_COMPONENT,
|
|
17
18
|
slot: IconButtonSlots.badgeIconButton
|
|
18
19
|
})(iconButtonStyles?.badgeIconButton);
|
|
20
|
+
const TooltipStyled = styled(Tooltip, {
|
|
21
|
+
name: ICON_BUTTON_KEY_COMPONENT,
|
|
22
|
+
slot: IconButtonSlots.tooltip
|
|
23
|
+
})(iconButtonStyles?.tooltip);
|
|
19
24
|
export {
|
|
20
25
|
BadgeStyled as B,
|
|
21
26
|
IconStyled as I,
|
|
22
|
-
StyledMUIIconButton as S
|
|
27
|
+
StyledMUIIconButton as S,
|
|
28
|
+
TooltipStyled as T
|
|
23
29
|
};
|
|
@@ -6,16 +6,60 @@ import { ComponentPalletColor, Sizes } from '@m4l/styles';
|
|
|
6
6
|
import { ICON_BUTTON_KEY_COMPONENT } from './constants';
|
|
7
7
|
import { IconButtonSlots } from './slots';
|
|
8
8
|
import { BadgeProps } from '../Badge';
|
|
9
|
+
import { TooltipProps } from '../../mui_extended';
|
|
10
|
+
import { ReactNode } from 'react';
|
|
9
11
|
export type IconButtonVariants = 'contained' | 'outline' | 'text';
|
|
10
12
|
export type IconButtonSize = 'small' | 'medium';
|
|
11
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Props for the IconButton component.
|
|
15
|
+
* Omit<IconProps, 'size' | 'color'>
|
|
16
|
+
* Omit<MUIIconButtonProps, 'size' | 'color' | 'disabled'>
|
|
17
|
+
* Pick<BadgeProps, 'badgeContent'>
|
|
18
|
+
* Pick<TooltipProps, 'placement'>
|
|
19
|
+
* [tooltip] - The text to display in the tooltip.
|
|
20
|
+
* [dictionaryTooltipId] - The ID for the dictionary tooltip.
|
|
21
|
+
* [variant] - The variant of the IconButton.
|
|
22
|
+
* [size] - The size of the IconButton.
|
|
23
|
+
* [withBadge] - Whether the IconButton includes a badge.
|
|
24
|
+
* [tooltipContent] - The content to display in the tooltip.
|
|
25
|
+
* [componentPaletteColor] - The color palette for the component.
|
|
26
|
+
* [disabled] - Whether the IconButton is disabled.
|
|
27
|
+
* [instaceDataTestId] - A unique identifier for the HTML element, useful for unit and integration testing.
|
|
28
|
+
*/
|
|
29
|
+
export interface IconButtonProps extends Omit<IconProps, 'size' | 'color'>, Omit<MUIIconButtonProps, 'size' | 'color' | 'disabled'>, Pick<BadgeProps, 'badgeContent'>, Pick<TooltipProps, 'placement'> {
|
|
30
|
+
/**
|
|
31
|
+
* Define el uso de tooltip en IconButton
|
|
32
|
+
*/
|
|
12
33
|
tooltip?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Representa la identificación del tooltip en el diccionario para que designe internamente el getLabel
|
|
36
|
+
*/
|
|
13
37
|
dictionaryTooltipId?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Variante del componente , modifica la aparencia grafica
|
|
40
|
+
*/
|
|
14
41
|
variant?: IconButtonVariants;
|
|
42
|
+
/**
|
|
43
|
+
* Define el tamaño del componente
|
|
44
|
+
*/
|
|
15
45
|
size?: Sizes;
|
|
16
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Define el mensaje interno del tooltip
|
|
48
|
+
*/
|
|
49
|
+
tooltipContent?: ReactNode;
|
|
50
|
+
/**
|
|
51
|
+
* Opciones de color del componente
|
|
52
|
+
*/
|
|
17
53
|
componentPaletteColor?: ComponentPalletColor;
|
|
54
|
+
/**
|
|
55
|
+
* Representa si el componente se encuentra deshabilitado
|
|
56
|
+
*/
|
|
18
57
|
disabled?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Propiedad que sirve para complementar el nombre del data-testid, aporta un identificador único del elemento html en toda aplicación.
|
|
60
|
+
* Es útil para realizar pruebas unitarias y de integración.
|
|
61
|
+
*/
|
|
62
|
+
instaceDataTestId?: string;
|
|
19
63
|
}
|
|
20
64
|
export type OwnerState = Pick<IconButtonProps, 'size' | 'variant' | 'componentPaletteColor'> & {
|
|
21
65
|
disabled?: boolean;
|