@m4l/gclick 0.0.2 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/@types/types.d.ts +15 -7
  2. package/components/GaugeCircular/GaugeCircular.d.ts +8 -0
  3. package/components/GaugeCircular/GaugeCircular.js +30 -0
  4. package/components/GaugeCircular/GaugeCircular.styles.d.ts +2 -0
  5. package/components/GaugeCircular/GaugeCircular.styles.js +52 -0
  6. package/components/GaugeCircular/constants.d.ts +2 -0
  7. package/components/GaugeCircular/constants.js +8 -0
  8. package/components/GaugeCircular/index.d.ts +1 -0
  9. package/components/GaugeCircular/slots/GaugeCircularEnum.d.ts +5 -0
  10. package/components/GaugeCircular/slots/GaugeCircularEnum.js +9 -0
  11. package/components/GaugeCircular/slots/GaugeCircularSlots.d.ts +3 -0
  12. package/components/GaugeCircular/slots/GaugeCircularSlots.js +21 -0
  13. package/components/GaugeCircular/subcomponents/CircularProgress/CircularProgress.d.ts +8 -0
  14. package/components/GaugeCircular/subcomponents/CircularProgress/CircularProgress.js +44 -0
  15. package/components/GaugeCircular/subcomponents/CircularProgress/constants.d.ts +2 -0
  16. package/components/GaugeCircular/subcomponents/CircularProgress/constants.js +6 -0
  17. package/components/GaugeCircular/subcomponents/CircularProgress/index.d.ts +1 -0
  18. package/components/GaugeCircular/test/GaugeCircular.test.d.ts +1 -0
  19. package/components/GaugeCircular/types.d.ts +25 -0
  20. package/components/index.d.ts +1 -1
  21. package/components/indicators/IndicatorBattery/IndicatorBattery.d.ts +7 -0
  22. package/components/indicators/IndicatorBattery/IndicatorBattery.js +102 -0
  23. package/components/indicators/IndicatorBattery/IndicatorBattery.styles.d.ts +2 -0
  24. package/components/indicators/IndicatorBattery/IndicatorBattery.styles.js +110 -0
  25. package/components/indicators/IndicatorBattery/constants.d.ts +2 -0
  26. package/components/indicators/IndicatorBattery/constants.js +8 -0
  27. package/components/indicators/IndicatorBattery/dictionary.d.ts +14 -0
  28. package/components/indicators/IndicatorBattery/dictionary.js +16 -0
  29. package/components/indicators/IndicatorBattery/hooks/useBatteryStatus/constants.d.ts +9 -0
  30. package/components/indicators/IndicatorBattery/hooks/useBatteryStatus/constants.js +35 -0
  31. package/components/indicators/IndicatorBattery/hooks/useBatteryStatus/test/useBattery.test.d.ts +1 -0
  32. package/components/indicators/IndicatorBattery/hooks/useBatteryStatus/types.d.ts +38 -0
  33. package/components/indicators/IndicatorBattery/hooks/useBatteryStatus/useBatteryStatus.d.ts +7 -0
  34. package/components/indicators/IndicatorBattery/hooks/useBatteryStatus/useBatteryStatus.js +68 -0
  35. package/components/indicators/IndicatorBattery/icons.d.ts +4 -0
  36. package/components/indicators/IndicatorBattery/icons.js +7 -0
  37. package/components/indicators/IndicatorBattery/index.d.ts +1 -0
  38. package/components/indicators/IndicatorBattery/index.js +1 -0
  39. package/components/indicators/IndicatorBattery/slots/IndicatorBaterySlots.d.ts +27 -0
  40. package/components/indicators/IndicatorBattery/slots/IndicatorBaterySlots.js +52 -0
  41. package/components/indicators/IndicatorBattery/slots/IndicatorBatteryEnum.d.ts +11 -0
  42. package/components/indicators/IndicatorBattery/slots/IndicatorBatteryEnum.js +15 -0
  43. package/components/indicators/IndicatorBattery/test/IndicatorBattery.test.d.ts +1 -0
  44. package/components/indicators/IndicatorBattery/types.d.ts +69 -0
  45. package/components/indicators/IndicatorCSQ/IndicatorCSQ.js +21 -0
  46. package/components/indicators/IndicatorCSQ/IndicatorCSQ.styles.js +70 -0
  47. package/components/indicators/IndicatorCSQ/constants.js +7 -0
  48. package/components/indicators/IndicatorCSQ/dictionary.js +16 -0
  49. package/components/indicators/IndicatorCSQ/helpers/getQualityLabel/getQualityLabel.js +43 -0
  50. package/components/indicators/IndicatorCSQ/index.js +1 -0
  51. package/components/indicators/IndicatorCSQ/slots/IndicatorCSQEnum.js +11 -0
  52. package/components/indicators/IndicatorCSQ/slots/IndicatorCSQSlots.js +32 -0
  53. package/components/indicators/IndicatorCSQ/subcomponents/SignalIcon/SignalIcon.js +19 -0
  54. package/components/indicators/IndicatorCSQ/subcomponents/SignalIcon/index.js +1 -0
  55. package/components/indicators/IndicatorValueStatus/IndicatorValueStatus.d.ts +7 -0
  56. package/components/indicators/IndicatorValueStatus/IndicatorValueStatus.styles.d.ts +2 -0
  57. package/components/indicators/IndicatorValueStatus/constants.d.ts +2 -0
  58. package/components/indicators/IndicatorValueStatus/index.d.ts +1 -0
  59. package/components/indicators/IndicatorValueStatus/slots/IndicatorValueStatusEnum.d.ts +7 -0
  60. package/components/indicators/IndicatorValueStatus/slots/IndicatorValueStatusSlots.d.ts +15 -0
  61. package/components/indicators/IndicatorValueStatus/test/DemoFormatter.d.ts +11 -0
  62. package/components/indicators/IndicatorValueStatus/test/IndicatorValueStatus.test.d.ts +1 -0
  63. package/components/indicators/IndicatorValueStatus/types.d.ts +40 -0
  64. package/components/indicators/index.d.ts +2 -0
  65. package/components/indicators/index.js +1 -0
  66. package/contexts/RealTimeProducerContext/sourceDataMechanisms/athmospherejs/index.js +1 -1
  67. package/index.js +18 -14
  68. package/mockServiceWorker.js +1 -1
  69. package/package.json +29 -24
  70. package/.storybook/constants.d.ts +0 -30
  71. package/.storybook/decorators/StorybookWithMapProvider/constants.d.ts +0 -2
  72. package/.storybook/decorators/StorybookWithMapProvider/index.d.ts +0 -1
  73. package/.storybook/decorators/WithContexts/constants.d.ts +0 -10
  74. package/.storybook/decorators/WithContexts/index.d.ts +0 -1
  75. package/.storybook/decorators/WithContexts/types.d.ts +0 -7
  76. package/.storybook/decorators/WithWindowsContainer/index.d.ts +0 -2
  77. package/.storybook/decorators/WithWindowsContainer/subcomponents/WindowsContainer/index.d.ts +0 -1
  78. package/.storybook/decorators/WithWindowsContainer/subcomponents/WindowsContainer/types.d.ts +0 -4
  79. package/.storybook/main.d.ts +0 -3
  80. package/.storybook/mocks/config-msw.d.ts +0 -21
  81. package/.storybook/mocks/index.d.ts +0 -2
  82. package/.storybook/mocks/network-mocks.d.ts +0 -1
  83. package/.storybook/storybook.vite.d.ts +0 -2
  84. package/components/gauges/Gauge/Gauge.d.ts +0 -22
  85. package/components/gauges/Gauge/Gauge.js +0 -25
  86. package/components/gauges/Gauge/Gauge.styles.d.ts +0 -2
  87. package/components/gauges/Gauge/Gauge.styles.js +0 -9
  88. package/components/gauges/Gauge/constants.d.ts +0 -2
  89. package/components/gauges/Gauge/constants.js +0 -8
  90. package/components/gauges/Gauge/index.d.ts +0 -1
  91. package/components/gauges/Gauge/slots/GaugeEnum.d.ts +0 -3
  92. package/components/gauges/Gauge/slots/GaugeEnum.js +0 -7
  93. package/components/gauges/Gauge/slots/GaugeSlots.d.ts +0 -3
  94. package/components/gauges/Gauge/slots/GaugeSlots.js +0 -12
  95. package/components/gauges/Gauge/types.d.ts +0 -16
  96. package/components/gauges/index.d.ts +0 -1
  97. package/not_recognized/index.js +0 -406
  98. /package/components/{gauges/Gauge → GaugeCircular}/index.js +0 -0
  99. /package/components/{gauges → GaugeCircular/subcomponents/CircularProgress}/index.js +0 -0
package/@types/types.d.ts CHANGED
@@ -2,21 +2,24 @@ import { ComponentsOverrides, ComponentsVariants } from '@mui/material/styles';
2
2
  import { MapPopupDeviceGpsOwnerState, MapPopupDeviceGpsSlotsType } from '../components/maps/components/GpsMap/popups/MapPopupDevice/types';
3
3
  import { CourseFormatterOwnerState, CourseFormatterSlotsType } from '../formatters/CourseFormatter/types';
4
4
  import { IndicatorCSQOwnerState, IndicatorCSQSlotsType } from '../components/indicators/IndicatorCSQ/types';
5
- import { GaugeSlotsType } from '../components/gauges/Gauge/types';
5
+ import { IndicatorBatteryOwnerState, IndicatorBatterySlotsType } from '../components/indicators/IndicatorBattery/types';
6
+ import { IndicatorValueStatusSlotsType } from '../components/indicators/IndicatorValueStatus/types';
6
7
  declare module '@mui/material/styles' {
7
8
  // Define the slots in the theme
8
9
  interface ComponentNameToClassKey {
9
10
  M4LMapPopupDevice: MapPopupDeviceGpsSlotsType;
10
11
  M4LCourseFormatter: CourseFormatterSlotsType;
11
12
  M4LCSQSignal: IndicatorCSQSlotsType;
12
- M4LGauge: GaugeSlotsType;
13
+ M4LIndicatorBattery: IndicatorBatterySlotsType;
14
+ M4LIndicatorValueStatus: IndicatorValueStatusSlotsType;
13
15
  }
14
16
  interface ComponentsPropsList {
15
17
  // Extend ComponentsProps or ComponentsOwnerState(this extend ComponentProps)
16
18
  M4LMapPopupDevice: Partial<MapPopupDeviceGpsOwnerState>;
17
19
  M4LCourseFormatter: Partial<CourseFormatterOwnerState>;
18
20
  M4LCSQSignal: Partial<IndicatorCSQOwnerState>;
19
- M4LGauge: Partial<GaugeOwnerState>;
21
+ M4LIndicatorBattery: Partial<IndicatorBatteryOwnerState>;
22
+ M4LIndicatorValueStatus: Partial<IndicatorValueStatusOwnerState>;
20
23
  }
21
24
  interface Components {
22
25
  M4LMapPopupDevice?: {
@@ -34,10 +37,15 @@ declare module '@mui/material/styles' {
34
37
  styleOverrides?: ComponentsOverrides<Theme>['M4LCSQSignal'];
35
38
  variants?: ComponentsVariants['M4LCSQSignal'];
36
39
  };
37
- M4LGauge?: {
38
- defaultProps?: ComponentsPropsList['M4LGauge'];
39
- styleOverrides?: ComponentsOverrides<Theme>['M4LGauge'];
40
- variants?: ComponentsVariants['M4LGauge'];
40
+ M4LIndicatorBattery?: {
41
+ defaultProps?: ComponentsPropsList['M4LIndicatorBattery'];
42
+ styleOverrides?: ComponentsOverrides<Theme>['M4LIndicatorBattery'];
43
+ variants?: ComponentsVariants['M4LIndicatorBattery'];
44
+ };
45
+ M4LIndicatorValueStatus?: {
46
+ defaultProps?: ComponentsPropsList['M4LIndicatorValueStatus'];
47
+ styleOverrides?: ComponentsOverrides<Theme>['M4LIndicatorValueStatus'];
48
+ variants?: ComponentsVariants['M4LIndicatorValueStatus'];
41
49
  };
42
50
  }
43
51
  }
@@ -0,0 +1,8 @@
1
+ import { GaugeCircularProps } from './types';
2
+ /**
3
+ * Renderiza un gauge circular que representa un valor porcentual.
4
+ * @description GaugeFullCircle component
5
+ * @param props - GaugeFullCircleProps
6
+ * @returns GaugeFullCircleRootStyled
7
+ */
8
+ export declare const GaugeCircular: (props: GaugeCircularProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,30 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useModuleSkeleton } from "@m4l/core";
3
+ import { G as GAUGE_CIRCULAR_CLASSES } from "./constants.js";
4
+ import { G as GaugeFullCircleRootStyled, a as GaugeFullCircleCircularBgStyled, b as GaugeFullCircleInnerStyled } from "./slots/GaugeCircularSlots.js";
5
+ import clsx from "clsx";
6
+ import { C as CircularProgress } from "./subcomponents/CircularProgress/CircularProgress.js";
7
+ const GaugeCircular = (props) => {
8
+ const { value, children, className } = props;
9
+ const isSkeleton = useModuleSkeleton();
10
+ const normalizedValue = isSkeleton ? 0 : Math.max(0, Math.min(100, value));
11
+ return /* @__PURE__ */ jsxs(
12
+ GaugeFullCircleRootStyled,
13
+ {
14
+ role: "progressbar",
15
+ "aria-label": "GaugeCircular",
16
+ "aria-valuenow": normalizedValue,
17
+ "aria-valuemin": 0,
18
+ "aria-valuemax": 100,
19
+ className: clsx(GAUGE_CIRCULAR_CLASSES.root, className),
20
+ children: [
21
+ /* @__PURE__ */ jsx(GaugeFullCircleCircularBgStyled, {}),
22
+ /* @__PURE__ */ jsx(CircularProgress, { value: normalizedValue }),
23
+ /* @__PURE__ */ jsx(GaugeFullCircleInnerStyled, { children })
24
+ ]
25
+ }
26
+ );
27
+ };
28
+ export {
29
+ GaugeCircular as G
30
+ };
@@ -0,0 +1,2 @@
1
+ import { GaugeCircularStyles } from './types';
2
+ export declare const gaugeCircularStyles: GaugeCircularStyles;
@@ -0,0 +1,52 @@
1
+ const gaugeCircularStyles = {
2
+ /**
3
+ * Estilos para el contenedor principal del gauge
4
+ */
5
+ root: ({ theme }) => ({
6
+ position: "relative",
7
+ width: "76px",
8
+ height: "76px",
9
+ display: "flex",
10
+ justifyContent: "center",
11
+ alignItems: "center",
12
+ borderRadius: "50%",
13
+ boxShadow: `inset 0 4px 4px 0 ${theme.vars.palette.background.surface}`,
14
+ "& > svg": {
15
+ zIndex: 1,
16
+ "& .circular-progress-circle": {
17
+ stroke: `${theme.vars.palette.primary.enabled}!important`,
18
+ transition: "stroke-dashoffset 0.3s ease-in-out"
19
+ }
20
+ }
21
+ }),
22
+ /**
23
+ * Estilos para el fondo del gauge
24
+ */
25
+ circularBg: ({ theme }) => ({
26
+ opacity: 0.5,
27
+ width: "inherit",
28
+ height: "inherit",
29
+ borderRadius: "inherit",
30
+ position: "absolute",
31
+ background: theme.vars.palette.background.surface
32
+ }),
33
+ /**
34
+ * Estilos para el contenedor interno del gauge
35
+ */
36
+ inner: ({ theme }) => ({
37
+ width: "60px",
38
+ height: "60px",
39
+ borderRadius: "50%",
40
+ background: theme.vars.palette.background.default,
41
+ position: "absolute",
42
+ display: "flex",
43
+ flexDirection: "column",
44
+ gap: theme.vars.size.baseSpacings.sp1,
45
+ justifyContent: "center",
46
+ alignItems: "center",
47
+ boxShadow: `0 4px 4px 0 ${theme.vars.palette.background.surface}`
48
+ })
49
+ };
50
+ export {
51
+ gaugeCircularStyles as g
52
+ };
@@ -0,0 +1,2 @@
1
+ export declare const GAUGE_CIRCULAR_KEY_COMPONENT = "M4LGaugeCircular";
2
+ export declare const GAUGE_CIRCULAR_CLASSES: Record<string, string>;
@@ -0,0 +1,8 @@
1
+ import { getComponentClasses } from "@m4l/components";
2
+ import { G as GaugeCircularSlots } from "./slots/GaugeCircularEnum.js";
3
+ const GAUGE_CIRCULAR_KEY_COMPONENT = "M4LGaugeCircular";
4
+ const GAUGE_CIRCULAR_CLASSES = getComponentClasses(GAUGE_CIRCULAR_KEY_COMPONENT, GaugeCircularSlots);
5
+ export {
6
+ GAUGE_CIRCULAR_CLASSES as G,
7
+ GAUGE_CIRCULAR_KEY_COMPONENT as a
8
+ };
@@ -0,0 +1 @@
1
+ export { GaugeCircular } from './GaugeCircular';
@@ -0,0 +1,5 @@
1
+ export declare enum GaugeCircularSlots {
2
+ root = "root",
3
+ inner = "inner",
4
+ circularBg = "circularBg"
5
+ }
@@ -0,0 +1,9 @@
1
+ var GaugeCircularSlots = /* @__PURE__ */ ((GaugeCircularSlots2) => {
2
+ GaugeCircularSlots2["root"] = "root";
3
+ GaugeCircularSlots2["inner"] = "inner";
4
+ GaugeCircularSlots2["circularBg"] = "circularBg";
5
+ return GaugeCircularSlots2;
6
+ })(GaugeCircularSlots || {});
7
+ export {
8
+ GaugeCircularSlots as G
9
+ };
@@ -0,0 +1,3 @@
1
+ export declare const GaugeFullCircleRootStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
2
+ export declare const GaugeFullCircleInnerStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
3
+ export declare const GaugeFullCircleCircularBgStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown>, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
@@ -0,0 +1,21 @@
1
+ import { styled } from "@mui/material/styles";
2
+ import { a as GAUGE_CIRCULAR_KEY_COMPONENT } from "../constants.js";
3
+ import { G as GaugeCircularSlots } from "./GaugeCircularEnum.js";
4
+ import { g as gaugeCircularStyles } from "../GaugeCircular.styles.js";
5
+ const GaugeFullCircleRootStyled = styled("div", {
6
+ name: GAUGE_CIRCULAR_KEY_COMPONENT,
7
+ slot: GaugeCircularSlots.root
8
+ })(gaugeCircularStyles?.root);
9
+ const GaugeFullCircleInnerStyled = styled("div", {
10
+ name: GAUGE_CIRCULAR_KEY_COMPONENT,
11
+ slot: GaugeCircularSlots.inner
12
+ })(gaugeCircularStyles?.inner);
13
+ const GaugeFullCircleCircularBgStyled = styled("div", {
14
+ name: GAUGE_CIRCULAR_KEY_COMPONENT,
15
+ slot: GaugeCircularSlots.circularBg
16
+ })(gaugeCircularStyles?.circularBg);
17
+ export {
18
+ GaugeFullCircleRootStyled as G,
19
+ GaugeFullCircleCircularBgStyled as a,
20
+ GaugeFullCircleInnerStyled as b
21
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * CircularProgress component
3
+ * @param props - CircularProgressProps
4
+ * @returns SVG con el círculo de progreso
5
+ */
6
+ export declare const CircularProgress: ({ value }: {
7
+ value?: number | undefined;
8
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,44 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import { C as CIRCULAR_PROGRESS_SIZE, a as CIRCULAR_PROGRESS_STROKE_WIDTH } from "./constants.js";
4
+ const CircularProgress = ({ value = 30 }) => {
5
+ const { radius, circumference, offset } = useMemo(() => {
6
+ const radius2 = (CIRCULAR_PROGRESS_SIZE - CIRCULAR_PROGRESS_STROKE_WIDTH) / 2;
7
+ const circumference2 = 2 * Math.PI * radius2;
8
+ const offset2 = circumference2 - value / 100 * circumference2;
9
+ return { radius: radius2, circumference: circumference2, offset: offset2 };
10
+ }, [value]);
11
+ return /* @__PURE__ */ jsxs("svg", { width: CIRCULAR_PROGRESS_SIZE, height: CIRCULAR_PROGRESS_SIZE, style: { position: "absolute" }, children: [
12
+ /* @__PURE__ */ jsx(
13
+ "circle",
14
+ {
15
+ cx: CIRCULAR_PROGRESS_SIZE / 2,
16
+ cy: CIRCULAR_PROGRESS_SIZE / 2,
17
+ r: radius,
18
+ strokeWidth: CIRCULAR_PROGRESS_STROKE_WIDTH,
19
+ strokeLinecap: "butt",
20
+ fill: "none"
21
+ },
22
+ "background-circle"
23
+ ),
24
+ /* @__PURE__ */ jsx(
25
+ "circle",
26
+ {
27
+ className: "circular-progress-circle",
28
+ cx: CIRCULAR_PROGRESS_SIZE / 2,
29
+ cy: CIRCULAR_PROGRESS_SIZE / 2,
30
+ r: radius,
31
+ strokeWidth: CIRCULAR_PROGRESS_STROKE_WIDTH,
32
+ fill: "none",
33
+ strokeDasharray: circumference,
34
+ strokeDashoffset: offset,
35
+ strokeLinecap: "round",
36
+ transform: `rotate(-90 ${CIRCULAR_PROGRESS_SIZE / 2} ${CIRCULAR_PROGRESS_SIZE / 2})`
37
+ },
38
+ "progress-circle"
39
+ )
40
+ ] });
41
+ };
42
+ export {
43
+ CircularProgress as C
44
+ };
@@ -0,0 +1,2 @@
1
+ export declare const CIRCULAR_PROGRESS_SIZE = 72;
2
+ export declare const CIRCULAR_PROGRESS_STROKE_WIDTH = 4;
@@ -0,0 +1,6 @@
1
+ const CIRCULAR_PROGRESS_SIZE = 72;
2
+ const CIRCULAR_PROGRESS_STROKE_WIDTH = 4;
3
+ export {
4
+ CIRCULAR_PROGRESS_SIZE as C,
5
+ CIRCULAR_PROGRESS_STROKE_WIDTH as a
6
+ };
@@ -0,0 +1 @@
1
+ export { CircularProgress } from './CircularProgress';
@@ -0,0 +1,25 @@
1
+ import { M4LOverridesStyleRules } from '@m4l/components';
2
+ import { GaugeCircularSlots } from './slots/GaugeCircularEnum';
3
+ import { GAUGE_CIRCULAR_KEY_COMPONENT } from './constants';
4
+ import { Theme } from '@mui/material';
5
+ export interface GaugeCircularProps {
6
+ /**
7
+ * Porcentaje de la barra, debe ser un número entre 0 y 100
8
+ */
9
+ value: number;
10
+ /**
11
+ * Clase para el contenedor del gauge
12
+ */
13
+ className?: string;
14
+ /**
15
+ * Data test id para el gauge
16
+ */
17
+ dataTestId?: string;
18
+ /**
19
+ * Componente hijo para el gauge
20
+ */
21
+ children?: React.ReactNode;
22
+ }
23
+ export type GaugeCircularOwnerState = {};
24
+ export type GaugeCircularSlotsType = keyof typeof GaugeCircularSlots;
25
+ export type GaugeCircularStyles = M4LOverridesStyleRules<GaugeCircularSlotsType, typeof GAUGE_CIRCULAR_KEY_COMPONENT, Theme>;
@@ -1,4 +1,4 @@
1
1
  export * from './DeviceLabel';
2
2
  export * from './DeviceStatus';
3
3
  export * from './maps';
4
- export * from './gauges';
4
+ export * from './indicators';
@@ -0,0 +1,7 @@
1
+ import { IndicatorBatteryProps } from './types';
2
+ /**
3
+ * Renderiza un indicador de batería con un gauge circular.
4
+ * @description IndicatorBattery component
5
+ * @param props - IndicatorBatteryProps
6
+ */
7
+ export declare const IndicatorBattery: (props: IndicatorBatteryProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,102 @@
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { I as IndicatorBatteryRootStyled, T as TitleStyled, C as ContentStyled, S as StatusVoltageContainerStyled, a as StatusContainerStyled, V as VoltageContainerStyled, b as ContainerTitleBatteryPorcentageStyled, c as ContainerIconPercentageStyled, d as ContainerStatusVoltageStyled } from "./slots/IndicatorBaterySlots.js";
3
+ import { useModuleDictionary, useEnvironment } from "@m4l/core";
4
+ import { I as INDICATOR_BATTERY_DICTIONARY } from "./dictionary.js";
5
+ import { Icon, Typography, Chip } from "@m4l/components";
6
+ import { u as useBatteryStatus } from "./hooks/useBatteryStatus/useBatteryStatus.js";
7
+ import { I as INDICATOR_BATTERY_CLASSES, a as INDICATOR_BATTERY_KEY_COMPONENT } from "./constants.js";
8
+ import clsx from "clsx";
9
+ import { I as IndicatorBatterySlots } from "./slots/IndicatorBatteryEnum.js";
10
+ import { g as getPropDataTestId } from "../../../test/getNameDataTestId.js";
11
+ import { I as INDICATOR_BATTERY_ICONS } from "./icons.js";
12
+ import { useMemo } from "react";
13
+ import { G as GaugeCircular } from "../../GaugeCircular/GaugeCircular.js";
14
+ const IndicatorBattery = (props) => {
15
+ const { getLabel } = useModuleDictionary();
16
+ const { host_static_assets, environment_assets } = useEnvironment();
17
+ if (!props.value && props.value !== 0) {
18
+ console.warn("IndicatorBattery: value prop is required");
19
+ }
20
+ const batteryStatusParams = useMemo(() => {
21
+ return "type" in props ? { value: props.value, type: props.type } : {
22
+ value: props.value,
23
+ maxVoltage: props.maxVoltage,
24
+ minVoltage: props.minVoltage,
25
+ valueWeak: props.valueWeak,
26
+ valueAcceptable: props.valueAcceptable,
27
+ valueGood: props.valueGood,
28
+ valueExcellent: props.valueExcellent
29
+ };
30
+ }, [props]);
31
+ const { label, color, maxVoltage: hookMaxVoltage } = useBatteryStatus(batteryStatusParams);
32
+ const ownerState = { color };
33
+ const { value, className, variant = "standard", batteryType = "main", dataTestId } = props;
34
+ const gaugeValue = useMemo(() => {
35
+ if (!value || value < 0) {
36
+ return 0;
37
+ }
38
+ if (hookMaxVoltage && hookMaxVoltage > 0) {
39
+ const percentage = value * 100 / hookMaxVoltage;
40
+ return Math.ceil(percentage);
41
+ }
42
+ return Math.ceil(value);
43
+ }, [value, hookMaxVoltage]);
44
+ return /* @__PURE__ */ jsx(
45
+ IndicatorBatteryRootStyled,
46
+ {
47
+ className: clsx(INDICATOR_BATTERY_CLASSES.root, className),
48
+ variant: "text",
49
+ role: "progressbar",
50
+ "aria-label": "indicator-battery",
51
+ "aria-valuenow": gaugeValue,
52
+ "aria-valuemin": 0,
53
+ "aria-valuemax": 100,
54
+ direction: "column",
55
+ padding: "standard",
56
+ ...getPropDataTestId(INDICATOR_BATTERY_KEY_COMPONENT, IndicatorBatterySlots.root, dataTestId),
57
+ children: variant === "standard" ? /* @__PURE__ */ jsxs(Fragment, { children: [
58
+ /* @__PURE__ */ jsx(TitleStyled, { variant: "captionDens", skeletonWidth: "80px", children: getLabel(batteryType === "main" ? INDICATOR_BATTERY_DICTIONARY.titleMain : INDICATOR_BATTERY_DICTIONARY.titleBackup) }),
59
+ /* @__PURE__ */ jsxs(ContentStyled, { ownerState, children: [
60
+ /* @__PURE__ */ jsxs(GaugeCircular, { value: gaugeValue, children: [
61
+ /* @__PURE__ */ jsx(Icon, { src: `${host_static_assets}/${environment_assets}/${INDICATOR_BATTERY_ICONS.batteryStandard}` }),
62
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "flex-end", justifyContent: "center", gap: "2px" }, children: [
63
+ /* @__PURE__ */ jsx(Typography, { variant: "subtitle", fontFamily: "Jura", color: "text.primary", skeletonWidth: "20px", children: `${gaugeValue ?? 0}` }),
64
+ /* @__PURE__ */ jsx(Typography, { variant: "body", fontFamily: "Jura", color: "text.primary", skeletonWidth: "10px", children: "%" })
65
+ ] })
66
+ ] }),
67
+ /* @__PURE__ */ jsxs(StatusVoltageContainerStyled, { children: [
68
+ /* @__PURE__ */ jsxs(StatusContainerStyled, { direction: "row", children: [
69
+ /* @__PURE__ */ jsx(Typography, { variant: "body", color: "text.secondary", skeletonWidth: "70px", children: getLabel(INDICATOR_BATTERY_DICTIONARY.status) }),
70
+ /* @__PURE__ */ jsx(Chip, { label, color, variant: "contained", skeletonWidth: "70px" })
71
+ ] }),
72
+ /* @__PURE__ */ jsxs(VoltageContainerStyled, { direction: "row", children: [
73
+ /* @__PURE__ */ jsx(Typography, { variant: "body", color: "text.secondary", skeletonWidth: "70px", children: getLabel(INDICATOR_BATTERY_DICTIONARY.voltage) }),
74
+ /* @__PURE__ */ jsx(Typography, { variant: "bodyDens", fontFamily: "Inter", color: "text.primary", skeletonWidth: "20px", children: value })
75
+ ] })
76
+ ] })
77
+ ] })
78
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
79
+ /* @__PURE__ */ jsxs(ContainerTitleBatteryPorcentageStyled, { ownerState, children: [
80
+ /* @__PURE__ */ jsx(TitleStyled, { variant: "captionDens", skeletonWidth: "80px", children: getLabel(batteryType === "main" ? INDICATOR_BATTERY_DICTIONARY.titleMain : INDICATOR_BATTERY_DICTIONARY.titleBackup) }),
81
+ /* @__PURE__ */ jsxs(ContainerIconPercentageStyled, { children: [
82
+ /* @__PURE__ */ jsx(Icon, { src: `${host_static_assets}/${environment_assets}/${INDICATOR_BATTERY_ICONS.batteryCompact}` }),
83
+ /* @__PURE__ */ jsx(Typography, { variant: "subtitleDens", fontFamily: "Jura", color: "text.primary", skeletonWidth: "20px", children: `${gaugeValue ?? 0}%` })
84
+ ] })
85
+ ] }),
86
+ /* @__PURE__ */ jsxs(ContainerStatusVoltageStyled, { children: [
87
+ /* @__PURE__ */ jsxs(StatusContainerStyled, { className: INDICATOR_BATTERY_CLASSES.statusContainer, children: [
88
+ /* @__PURE__ */ jsx(Typography, { variant: "body", color: "text.secondary", skeletonWidth: "70px", children: getLabel(INDICATOR_BATTERY_DICTIONARY.status) }),
89
+ /* @__PURE__ */ jsx(Chip, { label, color, variant: "contained", skeletonWidth: "70px" })
90
+ ] }),
91
+ /* @__PURE__ */ jsxs(VoltageContainerStyled, { className: INDICATOR_BATTERY_CLASSES.voltageContainer, children: [
92
+ /* @__PURE__ */ jsx(Typography, { variant: "body", color: "text.secondary", skeletonWidth: "70px", children: getLabel(INDICATOR_BATTERY_DICTIONARY.voltage) }),
93
+ /* @__PURE__ */ jsx(Typography, { variant: "bodyDens", fontFamily: "Inter", color: "text.primary", skeletonWidth: "20px", children: value })
94
+ ] })
95
+ ] })
96
+ ] })
97
+ }
98
+ );
99
+ };
100
+ export {
101
+ IndicatorBattery as I
102
+ };
@@ -0,0 +1,2 @@
1
+ import { IndicatorBatteryStyles } from './types';
2
+ export declare const indicatorBatteryStyles: IndicatorBatteryStyles;
@@ -0,0 +1,110 @@
1
+ import { I as INDICATOR_BATTERY_CLASSES } from "./constants.js";
2
+ const indicatorBatteryStyles = {
3
+ /**
4
+ * Contenedor del indicador de batería
5
+ */
6
+ root: ({ theme }) => ({
7
+ width: "fit-content",
8
+ display: "flex",
9
+ flexDirection: "column",
10
+ gap: theme.vars.size.baseSpacings.sp2,
11
+ backgroundColor: theme.vars.palette.background.base
12
+ }),
13
+ /**
14
+ * Título del indicador de batería
15
+ */
16
+ title: () => ({
17
+ textTransform: "uppercase",
18
+ justifyContent: "center",
19
+ display: "flex"
20
+ }),
21
+ /**
22
+ * Contenedor del gauge y los datos de la batería
23
+ */
24
+ content: ({ theme, ownerState }) => ({
25
+ display: "flex",
26
+ gap: theme.vars.size.baseSpacings.sp5,
27
+ "& .M4LIcon-icon": {
28
+ backgroundColor: theme.vars.palette.chips[ownerState?.color ?? "default"].outlined.colorTone
29
+ },
30
+ "&&& .circular-progress-circle": {
31
+ stroke: `${theme.vars.palette.chips[ownerState?.color ?? "default"].outlined.colorTone}!important`
32
+ }
33
+ }),
34
+ /**
35
+ * Contenedor del estado de la batería y el voltaje
36
+ */
37
+ voltageStatusContainer: ({ theme }) => ({
38
+ display: "flex",
39
+ flexDirection: "column",
40
+ alignItems: "flex-start",
41
+ justifyContent: "center",
42
+ gap: theme.vars.size.baseSpacings.sp4
43
+ }),
44
+ /**
45
+ * Contenedor del estado de la batería
46
+ */
47
+ statusContainer: ({ theme }) => ({
48
+ width: "100%",
49
+ display: "flex",
50
+ justifyContent: "space-between",
51
+ alignItems: "center",
52
+ gap: theme.vars.size.baseSpacings.sp4
53
+ }),
54
+ /**
55
+ * Contenedor del voltaje
56
+ */
57
+ voltageContainer: ({ theme }) => ({
58
+ width: "100%",
59
+ display: "flex",
60
+ justifyContent: "space-between",
61
+ alignItems: "center",
62
+ gap: theme.vars.size.baseSpacings.sp4
63
+ }),
64
+ /**
65
+ * Contenedor del título de la batería y el porcentaje
66
+ */
67
+ containerTitleBatteryPorcentage: ({ theme, ownerState }) => ({
68
+ width: "100%",
69
+ display: "flex",
70
+ justifyContent: "space-between",
71
+ alignItems: "center",
72
+ gap: theme.vars.size.baseSpacings.sp4,
73
+ "& .M4LIcon-icon": {
74
+ backgroundColor: theme.vars.palette.chips[ownerState?.color ?? "default"].outlined.colorTone
75
+ }
76
+ }),
77
+ /**
78
+ * Contenedor del estado de la batería y el voltaje
79
+ */
80
+ containerStatusVoltage: ({ theme }) => ({
81
+ width: "100%",
82
+ display: "flex",
83
+ justifyContent: "space-between",
84
+ alignItems: "center",
85
+ gap: theme.vars.size.baseSpacings.sp5,
86
+ [`& .${INDICATOR_BATTERY_CLASSES.statusContainer}`]: {
87
+ flexDirection: "column",
88
+ alignItems: "flex-start",
89
+ gap: theme.vars.size.baseSpacings["sp0-5"]
90
+ },
91
+ [`& .${INDICATOR_BATTERY_CLASSES.voltageContainer}`]: {
92
+ flexDirection: "column",
93
+ alignItems: "flex-end",
94
+ gap: theme.vars.size.baseSpacings["sp0-5"]
95
+ }
96
+ }),
97
+ /**
98
+ * Contenedor del icono de la batería
99
+ */
100
+ containerIconPercentage: ({ theme }) => ({
101
+ width: "fit-content",
102
+ display: "flex",
103
+ justifyContent: "center",
104
+ alignItems: "center",
105
+ gap: theme.vars.size.baseSpacings.sp1
106
+ })
107
+ };
108
+ export {
109
+ indicatorBatteryStyles as i
110
+ };
@@ -0,0 +1,2 @@
1
+ export declare const INDICATOR_BATTERY_KEY_COMPONENT = "M4LIndicatorBattery";
2
+ export declare const INDICATOR_BATTERY_CLASSES: Record<string, string>;
@@ -0,0 +1,8 @@
1
+ import { getComponentClasses } from "@m4l/components";
2
+ import { I as IndicatorBatterySlots } from "./slots/IndicatorBatteryEnum.js";
3
+ const INDICATOR_BATTERY_KEY_COMPONENT = "M4LIndicatorBattery";
4
+ const INDICATOR_BATTERY_CLASSES = getComponentClasses(INDICATOR_BATTERY_KEY_COMPONENT, IndicatorBatterySlots);
5
+ export {
6
+ INDICATOR_BATTERY_CLASSES as I,
7
+ INDICATOR_BATTERY_KEY_COMPONENT as a
8
+ };
@@ -0,0 +1,14 @@
1
+ export declare const INDICATOR_BATTERY_DICTIONARY_KEY = "indicator_battery";
2
+ export declare const getIndicatorBatteryComponentsDictionary: () => string[];
3
+ export declare const INDICATOR_BATTERY_DICTIONARY: {
4
+ titleMain: string;
5
+ titleBackup: string;
6
+ status: string;
7
+ voltage: string;
8
+ statusWeak: string;
9
+ statusAcceptable: string;
10
+ statusGood: string;
11
+ statusExcellent: string;
12
+ statusNotDetectable: string;
13
+ statusOverVoltage: string;
14
+ };
@@ -0,0 +1,16 @@
1
+ const INDICATOR_BATTERY_DICTIONARY_KEY = "indicator_battery";
2
+ const INDICATOR_BATTERY_DICTIONARY = {
3
+ titleMain: `${INDICATOR_BATTERY_DICTIONARY_KEY}.title_main`,
4
+ titleBackup: `${INDICATOR_BATTERY_DICTIONARY_KEY}.title_backup`,
5
+ status: `${INDICATOR_BATTERY_DICTIONARY_KEY}.label_status`,
6
+ voltage: `${INDICATOR_BATTERY_DICTIONARY_KEY}.label_voltage`,
7
+ statusWeak: `${INDICATOR_BATTERY_DICTIONARY_KEY}.label_status_weak`,
8
+ statusAcceptable: `${INDICATOR_BATTERY_DICTIONARY_KEY}.label_status_acceptable`,
9
+ statusGood: `${INDICATOR_BATTERY_DICTIONARY_KEY}.label_status_good`,
10
+ statusExcellent: `${INDICATOR_BATTERY_DICTIONARY_KEY}.label_status_excellent`,
11
+ statusNotDetectable: `${INDICATOR_BATTERY_DICTIONARY_KEY}.label_status_not_detectable`,
12
+ statusOverVoltage: `${INDICATOR_BATTERY_DICTIONARY_KEY}.label_status_over_voltage`
13
+ };
14
+ export {
15
+ INDICATOR_BATTERY_DICTIONARY as I
16
+ };
@@ -0,0 +1,9 @@
1
+ import { BatteryThreshold } from './types';
2
+ /**
3
+ * Umbrales de la batería optimizados para evitar duplicación de maxVoltage
4
+ * Estructura flexible que permite agregar nuevos tipos de batería sin cambiar código
5
+ */
6
+ export declare const BATTERY_THRESHOLDS: Record<string, {
7
+ maxVoltage: number;
8
+ thresholds: Omit<BatteryThreshold, 'maxVoltage'>[];
9
+ }>;
@@ -0,0 +1,35 @@
1
+ const BATTERY_THRESHOLDS = {
2
+ "24": {
3
+ maxVoltage: 27.9,
4
+ thresholds: [
5
+ { min: 25.2, max: 27.9, label: "statusExcellent", color: "persianGreen" },
6
+ { min: 24.8, max: 25.1, label: "statusGood", color: "info" },
7
+ { min: 24.4, max: 24.7, label: "statusAcceptable", color: "warning" },
8
+ { min: 0, max: 24.3, label: "statusWeak", color: "error" }
9
+ /* { min: 28.0, max: 29.0, label: 'statusOverVoltage', color: 'candy' }, */
10
+ ]
11
+ },
12
+ "12": {
13
+ maxVoltage: 13.9,
14
+ thresholds: [
15
+ { min: 12.6, max: 13.9, label: "statusExcellent", color: "persianGreen" },
16
+ { min: 12.4, max: 12.5, label: "statusGood", color: "info" },
17
+ { min: 12.2, max: 12.3, label: "statusAcceptable", color: "warning" },
18
+ { min: 0, max: 12.1, label: "statusWeak", color: "error" }
19
+ /* { min: 14.0, max: 14.5, label: 'statusOverVoltage', color: 'candy' }, */
20
+ ]
21
+ },
22
+ "4.5": {
23
+ maxVoltage: 5.1,
24
+ thresholds: [
25
+ { min: 4.2, max: 5.1, label: "statusExcellent", color: "persianGreen" },
26
+ { min: 4.1, max: 4.1, label: "statusGood", color: "info" },
27
+ { min: 3.9, max: 4, label: "statusAcceptable", color: "warning" },
28
+ { min: 0, max: 3.8, label: "statusWeak", color: "error" }
29
+ /* { min: 5.2, max: 5.5, label: 'statusOverVoltage', color: 'candy' }, */
30
+ ]
31
+ }
32
+ };
33
+ export {
34
+ BATTERY_THRESHOLDS as B
35
+ };