@m4l/components 9.3.39 → 9.3.40
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.
|
@@ -1,9 +1,55 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { R as RootStyled } from "./slots/TabsSlots.js";
|
|
3
|
+
import { useEnvironment } from "@m4l/core";
|
|
4
|
+
import { T as TABS_ICONS } from "./icons.js";
|
|
5
|
+
import React, { useMemo } from "react";
|
|
6
|
+
import { u as useComponentSize } from "../../../hooks/useComponentSize/useComponentSize.js";
|
|
7
|
+
import { I as IconButton } from "../IconButton/IconButton.js";
|
|
8
|
+
const createScrollButtonIcon = (src, size) => {
|
|
9
|
+
const ScrollButtonIconComponent = React.forwardRef(
|
|
10
|
+
(props, _ref) => {
|
|
11
|
+
const { fontSize, ownerState, ...otherProps } = props;
|
|
12
|
+
const finalProps = {
|
|
13
|
+
src,
|
|
14
|
+
size,
|
|
15
|
+
...otherProps
|
|
16
|
+
};
|
|
17
|
+
return /* @__PURE__ */ jsx(IconButton, { ...finalProps });
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
ScrollButtonIconComponent.displayName = "ScrollButtonIcon";
|
|
21
|
+
return ScrollButtonIconComponent;
|
|
22
|
+
};
|
|
3
23
|
const Tabs = (props) => {
|
|
4
|
-
const { children, className, ...others } = props;
|
|
24
|
+
const { children, className, size, ...others } = props;
|
|
5
25
|
const ownerState = {};
|
|
6
|
-
|
|
26
|
+
const { currentSize } = useComponentSize(size);
|
|
27
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
28
|
+
const leftIconSrc = `${host_static_assets}/${environment_assets}/${TABS_ICONS.ARROW_LEFT}`;
|
|
29
|
+
const rightIconSrc = `${host_static_assets}/${environment_assets}/${TABS_ICONS.ARROW_RIGHT}`;
|
|
30
|
+
const StartScrollButtonIcon = useMemo(
|
|
31
|
+
() => createScrollButtonIcon(leftIconSrc, currentSize),
|
|
32
|
+
[leftIconSrc, currentSize]
|
|
33
|
+
);
|
|
34
|
+
const EndScrollButtonIcon = useMemo(
|
|
35
|
+
() => createScrollButtonIcon(rightIconSrc, currentSize),
|
|
36
|
+
[rightIconSrc, currentSize]
|
|
37
|
+
);
|
|
38
|
+
return /* @__PURE__ */ jsx(
|
|
39
|
+
RootStyled,
|
|
40
|
+
{
|
|
41
|
+
...others,
|
|
42
|
+
scrollButtons: "auto",
|
|
43
|
+
ownerState: { ownerState },
|
|
44
|
+
variant: "scrollable",
|
|
45
|
+
className,
|
|
46
|
+
slots: {
|
|
47
|
+
StartScrollButtonIcon,
|
|
48
|
+
EndScrollButtonIcon
|
|
49
|
+
},
|
|
50
|
+
children
|
|
51
|
+
}
|
|
52
|
+
);
|
|
7
53
|
};
|
|
8
54
|
export {
|
|
9
55
|
Tabs as T
|
|
@@ -3,33 +3,59 @@ const tabsStyles = {
|
|
|
3
3
|
* Elemento root referencia a `MuiTabs` de MUI
|
|
4
4
|
*/
|
|
5
5
|
root: ({ theme }) => ({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
overflow: "auto",
|
|
10
|
-
width: "100%",
|
|
11
|
-
height: "fit-content",
|
|
12
|
-
maxWidth: "fit-content",
|
|
13
|
-
minHeight: "fit-content",
|
|
14
|
-
background: theme.vars.palette.background.default,
|
|
15
|
-
paddingBottom: theme.vars.size.baseSpacings.sp0,
|
|
16
|
-
gap: theme.vars.size.baseSpacings.sp0,
|
|
17
|
-
borderRadius: theme.vars.size.borderRadius.r1,
|
|
18
|
-
borderBottomLeftRadius: theme.vars.size.borderRadius.r0,
|
|
19
|
-
borderBottomRightRadius: theme.vars.size.borderRadius.r0,
|
|
20
|
-
marginBottom: "1px",
|
|
21
|
-
"& .MuiTabs-flexContainer": {
|
|
22
|
-
background: "transparent"
|
|
23
|
-
},
|
|
24
|
-
"& .MuiTabs-scroller": {
|
|
25
|
-
overflow: "visible !important"
|
|
26
|
-
},
|
|
27
|
-
"& .MuiTabs-indicator": {
|
|
28
|
-
display: "none"
|
|
29
|
-
},
|
|
30
|
-
"& .simplebar-content": {
|
|
6
|
+
"&&&": {
|
|
7
|
+
position: "relative",
|
|
8
|
+
zIndex: 1,
|
|
31
9
|
display: "flex",
|
|
32
|
-
|
|
10
|
+
overflow: "auto",
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
width: "100%",
|
|
13
|
+
height: "fit-content",
|
|
14
|
+
maxWidth: "fit-content",
|
|
15
|
+
minHeight: "fit-content",
|
|
16
|
+
gap: theme.vars.size.baseSpacings.sp4,
|
|
17
|
+
background: theme.vars.palette.background.default,
|
|
18
|
+
paddingBottom: theme.vars.size.baseSpacings.sp0,
|
|
19
|
+
borderRadius: theme.vars.size.borderRadius.r1,
|
|
20
|
+
borderBottomLeftRadius: theme.vars.size.borderRadius.r0,
|
|
21
|
+
borderBottomRightRadius: theme.vars.size.borderRadius.r0,
|
|
22
|
+
marginBottom: "1px",
|
|
23
|
+
"& .MuiTabs-flexContainer": {
|
|
24
|
+
background: "transparent"
|
|
25
|
+
},
|
|
26
|
+
"& .MuiTabs-indicator": {
|
|
27
|
+
display: "none"
|
|
28
|
+
},
|
|
29
|
+
"& .simplebar-content": {
|
|
30
|
+
display: "flex",
|
|
31
|
+
gap: theme.vars.size.baseSpacings.sp0
|
|
32
|
+
},
|
|
33
|
+
"& .MuiTabScrollButton-root": {
|
|
34
|
+
width: "fit-content",
|
|
35
|
+
height: "fit-content",
|
|
36
|
+
padding: "0",
|
|
37
|
+
margin: "0",
|
|
38
|
+
border: "none",
|
|
39
|
+
borderRadius: "0",
|
|
40
|
+
"& .MuiTouchRipple-root": {
|
|
41
|
+
display: "none !important"
|
|
42
|
+
},
|
|
43
|
+
"& .MuiButtonBase-ripple": {
|
|
44
|
+
display: "none !important"
|
|
45
|
+
},
|
|
46
|
+
"& .MuiTouchRipple-ripple": {
|
|
47
|
+
display: "none !important"
|
|
48
|
+
},
|
|
49
|
+
"& .MuiTouchRipple-rippleVisible": {
|
|
50
|
+
display: "none !important"
|
|
51
|
+
},
|
|
52
|
+
"& .M4LIconButton-styledMUIIconButton, & .MuiSkeleton-root": {
|
|
53
|
+
width: theme.vars.size.baseSpacings.sp4,
|
|
54
|
+
"& .M4LIcon-icon": {
|
|
55
|
+
backgroundColor: theme.vars.palette.text.primary
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
33
59
|
}
|
|
34
60
|
})
|
|
35
61
|
};
|
|
@@ -3,10 +3,13 @@ import { TabsProps as MuiTabProps } from '@mui/material/Tabs';
|
|
|
3
3
|
import { TabsSlots } from './slots/TabsEnum';
|
|
4
4
|
import { TABS_KEY_COMPONENT } from './constants';
|
|
5
5
|
import { Theme } from '@mui/material';
|
|
6
|
+
import { Sizes } from '@m4l/styles';
|
|
6
7
|
/**
|
|
7
8
|
* Props for the tabs component.
|
|
8
9
|
*/
|
|
9
|
-
export type TabsProps = MuiTabProps
|
|
10
|
+
export type TabsProps = MuiTabProps & {
|
|
11
|
+
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
12
|
+
};
|
|
10
13
|
/**
|
|
11
14
|
* State for the tabs component.
|
|
12
15
|
*/
|