@m4l/components 9.3.4 → 9.3.5
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 +15 -0
- package/components/SettingsLayout/SettingsLayout.d.ts +5 -0
- package/components/SettingsLayout/SettingsLayout.js +34 -0
- package/components/SettingsLayout/SettingsLayout.styles.d.ts +2 -0
- package/components/SettingsLayout/SettingsLayout.styles.js +270 -0
- package/components/SettingsLayout/constants.d.ts +7 -0
- package/components/SettingsLayout/constants.js +10 -0
- package/components/SettingsLayout/dictionary.d.ts +8 -0
- package/components/SettingsLayout/dictionary.js +11 -0
- package/components/SettingsLayout/icons.d.ts +14 -0
- package/components/SettingsLayout/icons.js +17 -0
- package/components/SettingsLayout/index.d.ts +2 -0
- package/components/SettingsLayout/index.js +1 -0
- package/components/SettingsLayout/slots/SettingsLayoutEnum.d.ts +17 -0
- package/components/SettingsLayout/slots/SettingsLayoutEnum.js +21 -0
- package/components/SettingsLayout/slots/SettingsLayoutSlots.d.ts +47 -0
- package/components/SettingsLayout/slots/SettingsLayoutSlots.js +83 -0
- package/components/SettingsLayout/subcomponents/SettingColorPresets/SettingColorPresets.d.ts +5 -0
- package/components/SettingsLayout/subcomponents/SettingColorPresets/SettingColorPresets.js +37 -0
- package/components/SettingsLayout/subcomponents/SettingColorPresets/index.d.ts +1 -0
- package/components/SettingsLayout/subcomponents/SettingColorPresets/index.js +1 -0
- package/components/SettingsLayout/subcomponents/SettingColorPresets/types.d.ts +3 -0
- package/components/SettingsLayout/subcomponents/SettingDirection/SettingDirection.d.ts +5 -0
- package/components/SettingsLayout/subcomponents/SettingDirection/SettingDirection.js +37 -0
- package/components/SettingsLayout/subcomponents/SettingDirection/index.d.ts +1 -0
- package/components/SettingsLayout/subcomponents/SettingDirection/types.d.ts +3 -0
- package/components/SettingsLayout/subcomponents/SettingFullscreen/SettingFullscreen.d.ts +5 -0
- package/components/SettingsLayout/subcomponents/SettingFullscreen/SettingFullscreen.js +40 -0
- package/components/SettingsLayout/subcomponents/SettingFullscreen/index.d.ts +1 -0
- package/components/SettingsLayout/subcomponents/SettingFullscreen/index.js +1 -0
- package/components/SettingsLayout/subcomponents/SettingFullscreen/types.d.ts +3 -0
- package/components/SettingsLayout/subcomponents/SettingItem/SettingItem.d.ts +8 -0
- package/components/SettingsLayout/subcomponents/SettingItem/SettingItem.js +23 -0
- package/components/SettingsLayout/subcomponents/SettingItem/index.d.ts +1 -0
- package/components/SettingsLayout/subcomponents/SettingItem/index.js +1 -0
- package/components/SettingsLayout/subcomponents/SettingItem/types.d.ts +5 -0
- package/components/SettingsLayout/subcomponents/SettingItemColor/SettingItemColor.d.ts +8 -0
- package/components/SettingsLayout/subcomponents/SettingItemColor/SettingItemColor.js +24 -0
- package/components/SettingsLayout/subcomponents/SettingItemColor/index.d.ts +1 -0
- package/components/SettingsLayout/subcomponents/SettingItemColor/index.js +1 -0
- package/components/SettingsLayout/subcomponents/SettingItemColor/types.d.ts +6 -0
- package/components/SettingsLayout/subcomponents/SettingMode/SettingMode.d.ts +5 -0
- package/components/SettingsLayout/subcomponents/SettingMode/SettingMode.js +36 -0
- package/components/SettingsLayout/subcomponents/SettingMode/index.d.ts +1 -0
- package/components/SettingsLayout/subcomponents/SettingMode/index.js +1 -0
- package/components/SettingsLayout/subcomponents/SettingMode/types.d.ts +3 -0
- package/components/SettingsLayout/subcomponents/SettingsLayoutBase/SettingsLayoutBase.d.ts +5 -0
- package/components/SettingsLayout/subcomponents/SettingsLayoutBase/SettingsLayoutBase.js +76 -0
- package/components/SettingsLayout/subcomponents/SettingsLayoutBase/index.d.ts +1 -0
- package/components/SettingsLayout/subcomponents/SettingsLayoutBase/index.js +1 -0
- package/components/SettingsLayout/subcomponents/SettingsLayoutBase/types.d.ts +5 -0
- package/components/SettingsLayout/test/SettingsLayout.test.d.ts +18 -0
- package/components/SettingsLayout/types.d.ts +47 -0
- package/components/index.d.ts +1 -0
- package/index.js +4 -2
- package/package.json +1 -1
- package/storybook/components/SettingsLayout/SettingsLayout.stories.d.ts +6 -0
- package/storybook/components/SettingsLayout/subcomponents/SettingsLayoutRender/SettingsLayoutsRender.d.ts +5 -0
- package/storybook/components/SettingsLayout/subcomponents/SettingsLayoutRender/index.d.ts +1 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { styled } from "@mui/material/styles";
|
|
2
|
+
import { S as SettingsLayoutSlots } from "./SettingsLayoutEnum.js";
|
|
3
|
+
import { a as SETTINGS_LAYOUT_COMPONENT_KEY } from "../constants.js";
|
|
4
|
+
import { s as settingsLayoutStyles } from "../SettingsLayout.styles.js";
|
|
5
|
+
import { Backdrop } from "@mui/material";
|
|
6
|
+
import { I as Icon } from "../../Icon/Icon.js";
|
|
7
|
+
import { T as Typography } from "../../mui_extended/Typography/Typography.js";
|
|
8
|
+
import { B as Button } from "../../mui_extended/Button/Button.js";
|
|
9
|
+
const SettingsLayoutRootStyled = styled("div", {
|
|
10
|
+
name: SETTINGS_LAYOUT_COMPONENT_KEY,
|
|
11
|
+
slot: SettingsLayoutSlots.root
|
|
12
|
+
})(settingsLayoutStyles.root);
|
|
13
|
+
const BackdropStyled = styled(Backdrop, {
|
|
14
|
+
name: SETTINGS_LAYOUT_COMPONENT_KEY,
|
|
15
|
+
slot: SettingsLayoutSlots.backdrop
|
|
16
|
+
})(settingsLayoutStyles.backdrop);
|
|
17
|
+
styled(Icon, {
|
|
18
|
+
name: SETTINGS_LAYOUT_COMPONENT_KEY,
|
|
19
|
+
slot: SettingsLayoutSlots.icon
|
|
20
|
+
})(settingsLayoutStyles.icon);
|
|
21
|
+
const TypographyStyled = styled(Typography, {
|
|
22
|
+
name: SETTINGS_LAYOUT_COMPONENT_KEY,
|
|
23
|
+
slot: SettingsLayoutSlots.typography
|
|
24
|
+
})(settingsLayoutStyles.typography);
|
|
25
|
+
const HeaderContainerStyled = styled("div", {
|
|
26
|
+
name: SETTINGS_LAYOUT_COMPONENT_KEY,
|
|
27
|
+
slot: SettingsLayoutSlots.headerContainer
|
|
28
|
+
})(settingsLayoutStyles.headerContainer);
|
|
29
|
+
const HeaderActionsStyled = styled("div", {
|
|
30
|
+
name: SETTINGS_LAYOUT_COMPONENT_KEY,
|
|
31
|
+
slot: SettingsLayoutSlots.headerActions
|
|
32
|
+
})(settingsLayoutStyles.headerActions);
|
|
33
|
+
styled("div", {
|
|
34
|
+
name: SETTINGS_LAYOUT_COMPONENT_KEY,
|
|
35
|
+
slot: SettingsLayoutSlots.divider
|
|
36
|
+
})(settingsLayoutStyles.divider);
|
|
37
|
+
const BodyContentStyled = styled("div", {
|
|
38
|
+
name: SETTINGS_LAYOUT_COMPONENT_KEY,
|
|
39
|
+
slot: SettingsLayoutSlots.bodyContent
|
|
40
|
+
})(settingsLayoutStyles.bodyContent);
|
|
41
|
+
const SettingContainerStyled = styled("div", {
|
|
42
|
+
name: SETTINGS_LAYOUT_COMPONENT_KEY,
|
|
43
|
+
slot: SettingsLayoutSlots.settingContainer
|
|
44
|
+
})(settingsLayoutStyles.settingContainer);
|
|
45
|
+
const SettingIconTitleStyled = styled("div", {
|
|
46
|
+
name: SETTINGS_LAYOUT_COMPONENT_KEY,
|
|
47
|
+
slot: SettingsLayoutSlots.settingIconTitle
|
|
48
|
+
})(settingsLayoutStyles.settingIconTitle);
|
|
49
|
+
const SettingItemStyled = styled("div", {
|
|
50
|
+
name: SETTINGS_LAYOUT_COMPONENT_KEY,
|
|
51
|
+
slot: SettingsLayoutSlots.settingItem
|
|
52
|
+
})(settingsLayoutStyles.settingItem);
|
|
53
|
+
const SettingItemContentStyled = styled("div", {
|
|
54
|
+
name: SETTINGS_LAYOUT_COMPONENT_KEY,
|
|
55
|
+
slot: SettingsLayoutSlots.settingItemContent
|
|
56
|
+
})(settingsLayoutStyles.settingItemContent);
|
|
57
|
+
const SettingItemColorStyled = styled(Icon, {
|
|
58
|
+
name: SETTINGS_LAYOUT_COMPONENT_KEY,
|
|
59
|
+
slot: SettingsLayoutSlots.settingItemColor
|
|
60
|
+
})(settingsLayoutStyles.settingItemColor);
|
|
61
|
+
const SettingItemColorContainerStyled = styled("div", {
|
|
62
|
+
name: SETTINGS_LAYOUT_COMPONENT_KEY,
|
|
63
|
+
slot: SettingsLayoutSlots.settingItemColorContainer
|
|
64
|
+
})(settingsLayoutStyles.settingItemColorContainer);
|
|
65
|
+
const SettingFullscreenStyled = styled(Button, {
|
|
66
|
+
name: SETTINGS_LAYOUT_COMPONENT_KEY,
|
|
67
|
+
slot: SettingsLayoutSlots.settingFullscreen
|
|
68
|
+
})(settingsLayoutStyles.settingFullscreen);
|
|
69
|
+
export {
|
|
70
|
+
BackdropStyled as B,
|
|
71
|
+
HeaderContainerStyled as H,
|
|
72
|
+
SettingContainerStyled as S,
|
|
73
|
+
TypographyStyled as T,
|
|
74
|
+
SettingIconTitleStyled as a,
|
|
75
|
+
SettingItemContentStyled as b,
|
|
76
|
+
SettingFullscreenStyled as c,
|
|
77
|
+
SettingItemStyled as d,
|
|
78
|
+
SettingItemColorContainerStyled as e,
|
|
79
|
+
SettingItemColorStyled as f,
|
|
80
|
+
SettingsLayoutRootStyled as g,
|
|
81
|
+
HeaderActionsStyled as h,
|
|
82
|
+
BodyContentStyled as i
|
|
83
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Typography } from "@mui/material";
|
|
3
|
+
import { useModuleDictionary } from "@m4l/core";
|
|
4
|
+
import { S as SettingContainerStyled, a as SettingIconTitleStyled, b as SettingItemContentStyled } from "../../slots/SettingsLayoutSlots.js";
|
|
5
|
+
import { D as DICTIONARY } from "../../dictionary.js";
|
|
6
|
+
import { P as PATH_ICONS } from "../../icons.js";
|
|
7
|
+
import { useThemeSettingsStore } from "@m4l/graphics";
|
|
8
|
+
import { S as SettingItemColor } from "../SettingItemColor/SettingItemColor.js";
|
|
9
|
+
import { I as Icon } from "../../../Icon/Icon.js";
|
|
10
|
+
const SettingColorPresets = (props) => {
|
|
11
|
+
const { prefixPathIcon } = props;
|
|
12
|
+
const { themeUserSettings, settingsActions, presetsOptionsColorMain } = useThemeSettingsStore((state) => state);
|
|
13
|
+
const { themeColor: themeColorPresets } = themeUserSettings;
|
|
14
|
+
const { onChangeColor } = settingsActions;
|
|
15
|
+
const { getLabel } = useModuleDictionary();
|
|
16
|
+
return /* @__PURE__ */ jsxs(SettingContainerStyled, { children: [
|
|
17
|
+
/* @__PURE__ */ jsxs(SettingIconTitleStyled, { children: [
|
|
18
|
+
/* @__PURE__ */ jsx(Icon, { src: `${prefixPathIcon}/${PATH_ICONS.PALETTE}` }),
|
|
19
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", children: getLabel(DICTIONARY.PRESETS) })
|
|
20
|
+
] }),
|
|
21
|
+
/* @__PURE__ */ jsx(SettingItemContentStyled, { role: "group", "aria-label": "theme-preset-options", children: presetsOptionsColorMain.map((color, index) => {
|
|
22
|
+
const isSelected = themeColorPresets === color.name;
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
SettingItemColor,
|
|
25
|
+
{
|
|
26
|
+
color: color.name,
|
|
27
|
+
selected: isSelected,
|
|
28
|
+
onChange: () => onChangeColor(color.name)
|
|
29
|
+
},
|
|
30
|
+
`${color.name}-${index}`
|
|
31
|
+
);
|
|
32
|
+
}) })
|
|
33
|
+
] });
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
SettingColorPresets as S
|
|
37
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SettingColorPresets } from './SettingColorPresets';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useModuleDictionary } from "@m4l/core";
|
|
3
|
+
import { P as PATH_ICONS } from "../../icons.js";
|
|
4
|
+
import { S as SettingContainerStyled, a as SettingIconTitleStyled, b as SettingItemContentStyled } from "../../slots/SettingsLayoutSlots.js";
|
|
5
|
+
import { D as DICTIONARY } from "../../dictionary.js";
|
|
6
|
+
import { useThemeSettingsStore } from "@m4l/graphics";
|
|
7
|
+
import { T as Typography } from "../../../mui_extended/Typography/Typography.js";
|
|
8
|
+
import { S as SettingItem } from "../SettingItem/SettingItem.js";
|
|
9
|
+
import { I as Icon } from "../../../Icon/Icon.js";
|
|
10
|
+
function SettingDirection(props) {
|
|
11
|
+
const { prefixPathIcon } = props;
|
|
12
|
+
const { themeUserSettings, settingsActions } = useThemeSettingsStore((state) => state);
|
|
13
|
+
const { themeDirection } = themeUserSettings;
|
|
14
|
+
const { onChangeDirection } = settingsActions;
|
|
15
|
+
const { getLabel } = useModuleDictionary();
|
|
16
|
+
return /* @__PURE__ */ jsxs(SettingContainerStyled, { children: [
|
|
17
|
+
/* @__PURE__ */ jsxs(SettingIconTitleStyled, { children: [
|
|
18
|
+
/* @__PURE__ */ jsx(Icon, { src: `${prefixPathIcon}/${PATH_ICONS.DIRECTION}` }),
|
|
19
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", children: getLabel(DICTIONARY.DIRECTION) })
|
|
20
|
+
] }),
|
|
21
|
+
/* @__PURE__ */ jsx(SettingItemContentStyled, { role: "group", "aria-label": "theme-direction-options", children: ["ltr", "rtl"].map((direction, index) => {
|
|
22
|
+
const isSelected = themeDirection === direction;
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
SettingItem,
|
|
25
|
+
{
|
|
26
|
+
iconUrl: direction === "ltr" ? `${prefixPathIcon}/${PATH_ICONS.ALIGN_LEFT}` : `${prefixPathIcon}/${PATH_ICONS.ALIGN_RIGHT}`,
|
|
27
|
+
selected: isSelected,
|
|
28
|
+
onChange: () => onChangeDirection(direction)
|
|
29
|
+
},
|
|
30
|
+
`${direction}-${index}`
|
|
31
|
+
);
|
|
32
|
+
}) })
|
|
33
|
+
] });
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
SettingDirection as S
|
|
37
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './SettingDirection';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { I as Icon } from "../../../Icon/Icon.js";
|
|
4
|
+
import { useModuleDictionary } from "@m4l/core";
|
|
5
|
+
import { D as DICTIONARY } from "../../dictionary.js";
|
|
6
|
+
import { P as PATH_ICONS } from "../../icons.js";
|
|
7
|
+
import { c as SettingFullscreenStyled } from "../../slots/SettingsLayoutSlots.js";
|
|
8
|
+
const SettingFullscreen = (props) => {
|
|
9
|
+
const { prefixPathIcon } = props;
|
|
10
|
+
const [fullscreen, setFullscreen] = useState(false);
|
|
11
|
+
const { getLabel } = useModuleDictionary();
|
|
12
|
+
const toggleFullScreen = () => {
|
|
13
|
+
if (!document.fullscreenElement) {
|
|
14
|
+
document.documentElement.requestFullscreen();
|
|
15
|
+
setFullscreen(true);
|
|
16
|
+
} else if (document.exitFullscreen) {
|
|
17
|
+
document.exitFullscreen();
|
|
18
|
+
setFullscreen(false);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
SettingFullscreenStyled,
|
|
23
|
+
{
|
|
24
|
+
fullWidth: true,
|
|
25
|
+
variant: "contained",
|
|
26
|
+
color: "default",
|
|
27
|
+
startIcon: /* @__PURE__ */ jsx(
|
|
28
|
+
Icon,
|
|
29
|
+
{
|
|
30
|
+
src: fullscreen ? `${prefixPathIcon}/${PATH_ICONS.FULLSCREEN_EXIT}` : `${prefixPathIcon}/${PATH_ICONS.FULLSCREEN}`
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
onClick: toggleFullScreen,
|
|
34
|
+
label: getLabel(fullscreen ? DICTIONARY.EXIT_FULLSCREEN : DICTIONARY.FULLSCREEN)
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
SettingFullscreen as S
|
|
40
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SettingFullscreen } from './SettingFullscreen';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SettingItemProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Componente para el item de configuración.
|
|
4
|
+
* Este componente se utiliza para mostrar un item de configuración en el componente SettingsLayout.
|
|
5
|
+
* @param props - Propiedades del componente.
|
|
6
|
+
* @returns Componente SettingItem.
|
|
7
|
+
*/
|
|
8
|
+
export declare const SettingItem: (props: SettingItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { d as SettingItemStyled } from "../../slots/SettingsLayoutSlots.js";
|
|
3
|
+
import { I as Icon } from "../../../Icon/Icon.js";
|
|
4
|
+
const SettingItem = (props) => {
|
|
5
|
+
const { iconUrl, onChange, selected } = props;
|
|
6
|
+
return /* @__PURE__ */ jsx(
|
|
7
|
+
SettingItemStyled,
|
|
8
|
+
{
|
|
9
|
+
...onChange ? {
|
|
10
|
+
onClick: onChange,
|
|
11
|
+
tabIndex: 0,
|
|
12
|
+
role: "radio",
|
|
13
|
+
"aria-label": "theme-mode-options",
|
|
14
|
+
"aria-checked": true
|
|
15
|
+
} : {},
|
|
16
|
+
ownerState: { selected, onChange: !!onChange },
|
|
17
|
+
children: /* @__PURE__ */ jsx(Icon, { src: iconUrl, color: selected ? "primary.enabled" : "text.secondary" })
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
SettingItem as S
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SettingItem } from './SettingItem';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SettingItemColorProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Componente para el item de configuración.
|
|
4
|
+
* Este componente se utiliza para mostrar un item de configuración en el componente SettingsLayout.
|
|
5
|
+
* @param props - Propiedades del componente.
|
|
6
|
+
* @returns Componente SettingItem.
|
|
7
|
+
*/
|
|
8
|
+
export declare const SettingItemColor: (props: SettingItemColorProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { e as SettingItemColorContainerStyled, f as SettingItemColorStyled } from "../../slots/SettingsLayoutSlots.js";
|
|
3
|
+
import { P as PATH_ICONS } from "../../icons.js";
|
|
4
|
+
import { useEnvironment } from "@m4l/core";
|
|
5
|
+
const SettingItemColor = (props) => {
|
|
6
|
+
const { onChange, selected, color } = props;
|
|
7
|
+
const { host_static_assets, environment_assets } = useEnvironment();
|
|
8
|
+
return /* @__PURE__ */ jsx(SettingItemColorContainerStyled, { children: /* @__PURE__ */ jsx(
|
|
9
|
+
SettingItemColorStyled,
|
|
10
|
+
{
|
|
11
|
+
src: `${host_static_assets}/${environment_assets}/${PATH_ICONS.COLOR}`,
|
|
12
|
+
...onChange ? {
|
|
13
|
+
onClick: onChange,
|
|
14
|
+
tabIndex: 0,
|
|
15
|
+
role: "radio",
|
|
16
|
+
"aria-checked": true
|
|
17
|
+
} : {},
|
|
18
|
+
ownerState: { selected, onChange: !!onChange, color }
|
|
19
|
+
}
|
|
20
|
+
) });
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
SettingItemColor as S
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SettingItemColor } from './SettingItemColor';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { I as Icon } from "../../../Icon/Icon.js";
|
|
3
|
+
import { useModuleDictionary } from "@m4l/core";
|
|
4
|
+
import { P as PATH_ICONS } from "../../icons.js";
|
|
5
|
+
import { D as DICTIONARY } from "../../dictionary.js";
|
|
6
|
+
import { S as SettingContainerStyled, a as SettingIconTitleStyled, b as SettingItemContentStyled } from "../../slots/SettingsLayoutSlots.js";
|
|
7
|
+
import { useThemeSettingsStore } from "@m4l/graphics";
|
|
8
|
+
import { T as Typography } from "../../../mui_extended/Typography/Typography.js";
|
|
9
|
+
import { S as SettingItem } from "../SettingItem/SettingItem.js";
|
|
10
|
+
const SettingMode = (props) => {
|
|
11
|
+
const { prefixPathIcon } = props;
|
|
12
|
+
const { settingsActions, themeUserSettings } = useThemeSettingsStore((state) => state);
|
|
13
|
+
const { onChangeMode } = settingsActions;
|
|
14
|
+
const { getLabel } = useModuleDictionary();
|
|
15
|
+
return /* @__PURE__ */ jsxs(SettingContainerStyled, { role: "group", "aria-label": "theme-mode-options", children: [
|
|
16
|
+
/* @__PURE__ */ jsxs(SettingIconTitleStyled, { children: [
|
|
17
|
+
/* @__PURE__ */ jsx(Icon, { src: `${prefixPathIcon}/${PATH_ICONS.MODE}` }),
|
|
18
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", children: getLabel(DICTIONARY.MODE) })
|
|
19
|
+
] }),
|
|
20
|
+
/* @__PURE__ */ jsx(SettingItemContentStyled, { children: ["light", "dark"].map((mode, index) => {
|
|
21
|
+
const isSelected = themeUserSettings.themeMode === mode;
|
|
22
|
+
return /* @__PURE__ */ jsx(
|
|
23
|
+
SettingItem,
|
|
24
|
+
{
|
|
25
|
+
iconUrl: mode === "light" ? `${prefixPathIcon}/${PATH_ICONS.SUN}` : `${prefixPathIcon}/${PATH_ICONS.MOON}`,
|
|
26
|
+
selected: isSelected,
|
|
27
|
+
onChange: () => onChangeMode(mode)
|
|
28
|
+
},
|
|
29
|
+
`${mode}-${index}`
|
|
30
|
+
);
|
|
31
|
+
}) })
|
|
32
|
+
] });
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
SettingMode as S
|
|
36
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SettingMode } from './SettingMode';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { AnimatePresence } from "framer-motion";
|
|
3
|
+
import { useModuleDictionary } from "@m4l/core";
|
|
4
|
+
import { P as PATH_ICONS } from "../../icons.js";
|
|
5
|
+
import { B as BackdropStyled, g as SettingsLayoutRootStyled, H as HeaderContainerStyled, T as TypographyStyled, h as HeaderActionsStyled, i as BodyContentStyled } from "../../slots/SettingsLayoutSlots.js";
|
|
6
|
+
import { S as SettingDirection } from "../SettingDirection/SettingDirection.js";
|
|
7
|
+
import { D as DICTIONARY } from "../../dictionary.js";
|
|
8
|
+
import { useThemeSettingsStore } from "@m4l/graphics";
|
|
9
|
+
import { b as SETTINGS_LAYOUT_CLASSES } from "../../constants.js";
|
|
10
|
+
import { I as IconButton } from "../../../mui_extended/IconButton/IconButton.js";
|
|
11
|
+
import { S as SettingMode } from "../SettingMode/SettingMode.js";
|
|
12
|
+
import { S as SettingColorPresets } from "../SettingColorPresets/SettingColorPresets.js";
|
|
13
|
+
import { S as SettingFullscreen } from "../SettingFullscreen/SettingFullscreen.js";
|
|
14
|
+
const SettingsLayoutBase = (props) => {
|
|
15
|
+
const {
|
|
16
|
+
open,
|
|
17
|
+
themeUserSettings,
|
|
18
|
+
settingsActions
|
|
19
|
+
} = useThemeSettingsStore((state) => state);
|
|
20
|
+
const { prefixPathIcon, width } = props;
|
|
21
|
+
const { themeDirection } = themeUserSettings;
|
|
22
|
+
const { onResetSetting, handleOpen } = settingsActions;
|
|
23
|
+
const { getLabel } = useModuleDictionary();
|
|
24
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25
|
+
/* @__PURE__ */ jsx(
|
|
26
|
+
BackdropStyled,
|
|
27
|
+
{
|
|
28
|
+
ownerState: {},
|
|
29
|
+
open,
|
|
30
|
+
onClick: () => handleOpen()
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
/* @__PURE__ */ jsx(AnimatePresence, { children: open && /* @__PURE__ */ jsxs(SettingsLayoutRootStyled, { role: "form", "aria-label": "settings-layout", ownerState: { themeDirection, width }, className: SETTINGS_LAYOUT_CLASSES.root, children: [
|
|
34
|
+
/* @__PURE__ */ jsxs(HeaderContainerStyled, { ownerState: {}, className: SETTINGS_LAYOUT_CLASSES.headerContainer, children: [
|
|
35
|
+
/* @__PURE__ */ jsx(
|
|
36
|
+
TypographyStyled,
|
|
37
|
+
{
|
|
38
|
+
ownerState: {},
|
|
39
|
+
variant: "subtitleDens",
|
|
40
|
+
ellipsis: true,
|
|
41
|
+
children: getLabel(DICTIONARY.MODULE_NAME)
|
|
42
|
+
}
|
|
43
|
+
),
|
|
44
|
+
/* @__PURE__ */ jsxs(HeaderActionsStyled, { children: [
|
|
45
|
+
/* @__PURE__ */ jsx(
|
|
46
|
+
IconButton,
|
|
47
|
+
{
|
|
48
|
+
src: `${prefixPathIcon}/${PATH_ICONS.REFRESH}`,
|
|
49
|
+
onClick: onResetSetting,
|
|
50
|
+
role: "button",
|
|
51
|
+
"aria-label": "reset-setting"
|
|
52
|
+
}
|
|
53
|
+
),
|
|
54
|
+
/* @__PURE__ */ jsx(
|
|
55
|
+
IconButton,
|
|
56
|
+
{
|
|
57
|
+
src: `${prefixPathIcon}/${PATH_ICONS.CLOSE}`,
|
|
58
|
+
onClick: () => handleOpen(),
|
|
59
|
+
role: "button",
|
|
60
|
+
"aria-label": "close-settings"
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
] })
|
|
64
|
+
] }),
|
|
65
|
+
/* @__PURE__ */ jsxs(BodyContentStyled, { ownerState: {}, children: [
|
|
66
|
+
/* @__PURE__ */ jsx(SettingMode, { prefixPathIcon }),
|
|
67
|
+
/* @__PURE__ */ jsx(SettingDirection, { prefixPathIcon }),
|
|
68
|
+
/* @__PURE__ */ jsx(SettingColorPresets, { prefixPathIcon }),
|
|
69
|
+
/* @__PURE__ */ jsx(SettingFullscreen, { prefixPathIcon })
|
|
70
|
+
] })
|
|
71
|
+
] }) })
|
|
72
|
+
] });
|
|
73
|
+
};
|
|
74
|
+
export {
|
|
75
|
+
SettingsLayoutBase as S
|
|
76
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SettingsLayoutBase } from './SettingsLayoutBase';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const mockThemeUserSettings: {
|
|
2
|
+
themeMode: string;
|
|
3
|
+
themeColor: string;
|
|
4
|
+
themeDirection: string;
|
|
5
|
+
themeLayout: string;
|
|
6
|
+
themeStretch: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const mockSettingsActions: {
|
|
9
|
+
init: import('vitest').Mock<(...args: any[]) => any>;
|
|
10
|
+
onChangeMode: import('vitest').Mock<(...args: any[]) => any>;
|
|
11
|
+
onChangeColor: import('vitest').Mock<(...args: any[]) => any>;
|
|
12
|
+
onChangeDirection: import('vitest').Mock<(...args: any[]) => any>;
|
|
13
|
+
onChangeLayout: import('vitest').Mock<(...args: any[]) => any>;
|
|
14
|
+
onToggleStretch: import('vitest').Mock<(...args: any[]) => any>;
|
|
15
|
+
onResetSetting: import('vitest').Mock<(...args: any[]) => any>;
|
|
16
|
+
handleOpen: import('vitest').Mock<(...args: any[]) => any>;
|
|
17
|
+
setThemeSettings: import('vitest').Mock<(...args: any[]) => any>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { M4LOverridesStyleRules } from '../../@types/augmentations';
|
|
2
|
+
import { SettingsLayoutSlots } from './slots/SettingsLayoutEnum';
|
|
3
|
+
import { SETTINGS_LAYOUT_COMPONENT_KEY } from './constants';
|
|
4
|
+
import { Theme } from '@mui/material';
|
|
5
|
+
import { Sizes, ThemeUserColor } from '@m4l/styles';
|
|
6
|
+
import { ThemeSettingsStore } from '@m4l/graphics';
|
|
7
|
+
export interface SettingsLayoutProps {
|
|
8
|
+
/**
|
|
9
|
+
* Propiedad que define el ancho del componente.
|
|
10
|
+
*/
|
|
11
|
+
width?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Medida de tamaño para el componente.
|
|
14
|
+
*/
|
|
15
|
+
size?: Extract<Sizes, 'small' | 'medium'>;
|
|
16
|
+
/**
|
|
17
|
+
* Nombre de clase css.
|
|
18
|
+
*/
|
|
19
|
+
className?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Identificador usado para pruebas del componente.
|
|
22
|
+
*/
|
|
23
|
+
dataTestId?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Tipo para las ranuras del componente.
|
|
27
|
+
* Este tipo se refiere a las claves dentro de `SettingsLayoutSlots`, que determinan los diferentes elementos
|
|
28
|
+
* estilizados dentro del componente, como el `root`, `backdrop`, etc.
|
|
29
|
+
*/
|
|
30
|
+
export type SettingsLayoutSlotsType = keyof typeof SettingsLayoutSlots;
|
|
31
|
+
/**
|
|
32
|
+
* Combinación de las propiedades del componente y su estado propietario.
|
|
33
|
+
* Este tipo se utiliza para describir el estado completo del componente , incluyendo
|
|
34
|
+
* las propiedades pasadas al componente y el estado calculado.
|
|
35
|
+
*/
|
|
36
|
+
export interface SettingsLayoutOwnerState extends Pick<ThemeSettingsStore['themeUserSettings'], 'themeDirection'> {
|
|
37
|
+
width: SettingsLayoutProps['width'];
|
|
38
|
+
size: SettingsLayoutProps['size'];
|
|
39
|
+
color?: ThemeUserColor;
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Tipos de estilos para el componente.
|
|
44
|
+
* Esta interfaz extiende las reglas de estilo personalizadas para las ranuras del componente (`SettingsLayoutSlots`)
|
|
45
|
+
* y permite su sobrescritura.
|
|
46
|
+
*/
|
|
47
|
+
export type SettingsLayoutstyles = M4LOverridesStyleRules<SettingsLayoutSlots, typeof SETTINGS_LAYOUT_COMPONENT_KEY, Theme>;
|
package/components/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -186,6 +186,7 @@ import { D as D10, a as a13, M as M7 } from "./components/WindowBase/contexts/Dy
|
|
|
186
186
|
import { W as W3 } from "./components/WindowConfirm/WindowConfirm.js";
|
|
187
187
|
import { a as a14, g as g27 } from "./components/ModalDialog/dictionary.js";
|
|
188
188
|
import { M as M8 } from "./components/ModalDialog/ModalDialog.js";
|
|
189
|
+
import { S as S10 } from "./components/SettingsLayout/SettingsLayout.js";
|
|
189
190
|
import { P as P13 } from "./components/Pager/Pager.js";
|
|
190
191
|
import { F as F2, R as R22, u as u16 } from "./components/hook-form/RHFormContext/index.js";
|
|
191
192
|
import { g as g28 } from "./components/hook-form/RHFormContext/dictionary.js";
|
|
@@ -201,7 +202,7 @@ import { u as u22 } from "./hooks/useInterval/index.js";
|
|
|
201
202
|
import { u as u23 } from "./hooks/useComponentSize/useComponentSize.js";
|
|
202
203
|
import { u as u24 } from "./hooks/useFormReadyForUpdate/index.js";
|
|
203
204
|
import { u as u25 } from "./hooks/useStateRef/index.js";
|
|
204
|
-
import { S as
|
|
205
|
+
import { S as S11 } from "./hooks/useSvgColor/constants.js";
|
|
205
206
|
import { u as u26 } from "./hooks/useSvgColor/useSvgColor.js";
|
|
206
207
|
import { u as u27 } from "./hooks/useDynamicFilterAndSort/useDynamicFilterAndSort.js";
|
|
207
208
|
import { u as u28 } from "./hooks/useDataGridPersistence/useDataGridPersistence.js";
|
|
@@ -348,11 +349,12 @@ export {
|
|
|
348
349
|
R as Resizable,
|
|
349
350
|
R2 as ResizableBox,
|
|
350
351
|
R3 as Responsive,
|
|
351
|
-
|
|
352
|
+
S11 as SKELETON_SVG_ICON,
|
|
352
353
|
S8 as ScrollBar,
|
|
353
354
|
S as SectionCommercial,
|
|
354
355
|
S4 as Select,
|
|
355
356
|
S7 as SelectStyled,
|
|
357
|
+
S10 as SettingsLayout,
|
|
356
358
|
S9 as SideBar,
|
|
357
359
|
S5 as Skeleton,
|
|
358
360
|
S2 as SortCompareValues,
|
package/package.json
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { SettingsLayout } from '../../../src/components/SettingsLayout/SettingsLayout';
|
|
3
|
+
declare const meta: Meta<typeof SettingsLayout>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof SettingsLayout>;
|
|
6
|
+
export declare const Open: Story;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SettingsLayoutProps } from '../../../../../src/components/SettingsLayout/';
|
|
2
|
+
/**
|
|
3
|
+
* Wrapper para el componente SettingsLayout encargado de aplicar estilos y props por defecto
|
|
4
|
+
*/
|
|
5
|
+
export declare const SettingsLayoutRender: (props: Partial<SettingsLayoutProps>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SettingsLayoutRender } from './SettingsLayoutsRender';
|