@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
@@ -0,0 +1,38 @@
1
+ import { ChipColorOptions } from '@m4l/styles';
2
+ import { INDICATOR_BATTERY_DICTIONARY } from '../../dictionary';
3
+ import { IndicatorBatteryProps } from '../../types';
4
+ export interface UseBatteryStatusProps {
5
+ value?: IndicatorBatteryProps['value'];
6
+ maxVoltage?: Extract<IndicatorBatteryProps, {
7
+ maxVoltage: number;
8
+ }>['maxVoltage'];
9
+ minVoltage?: Extract<IndicatorBatteryProps, {
10
+ minVoltage: number;
11
+ }>['minVoltage'];
12
+ valueWeak?: Extract<IndicatorBatteryProps, {
13
+ valueWeak: number;
14
+ }>['valueWeak'];
15
+ valueAcceptable?: Extract<IndicatorBatteryProps, {
16
+ valueAcceptable: number;
17
+ }>['valueAcceptable'];
18
+ valueGood?: Extract<IndicatorBatteryProps, {
19
+ valueGood: number;
20
+ }>['valueGood'];
21
+ valueExcellent?: Extract<IndicatorBatteryProps, {
22
+ valueExcellent: number;
23
+ }>['valueExcellent'];
24
+ type?: Extract<IndicatorBatteryProps, {
25
+ type: string;
26
+ }>['type'];
27
+ }
28
+ export interface BatteryThreshold {
29
+ min: number;
30
+ max: number;
31
+ label: keyof typeof INDICATOR_BATTERY_DICTIONARY;
32
+ color: ChipColorOptions;
33
+ }
34
+ export type UseBatteryStatusReturn = {
35
+ label: string;
36
+ color: ChipColorOptions;
37
+ maxVoltage: number;
38
+ };
@@ -0,0 +1,7 @@
1
+ import { UseBatteryStatusProps, UseBatteryStatusReturn } from './types';
2
+ /**
3
+ * Hook para obtener el estado de la batería
4
+ * @param props - UseBatteryStatusProps
5
+ * @returns UseBatteryStatusReturn
6
+ */
7
+ export declare const useBatteryStatus: (props: UseBatteryStatusProps) => UseBatteryStatusReturn;
@@ -0,0 +1,68 @@
1
+ import { useMemo } from "react";
2
+ import { I as INDICATOR_BATTERY_DICTIONARY } from "../../dictionary.js";
3
+ import { B as BATTERY_THRESHOLDS } from "./constants.js";
4
+ import { useModuleDictionary } from "@m4l/core";
5
+ const useBatteryStatus = (props) => {
6
+ const { getLabel } = useModuleDictionary();
7
+ const { value, maxVoltage, minVoltage, valueWeak, valueAcceptable, valueGood, valueExcellent, type } = props;
8
+ const status = useMemo(() => {
9
+ if (value === null || value === void 0 || value < 0) {
10
+ return {
11
+ label: getLabel(INDICATOR_BATTERY_DICTIONARY.statusNotDetectable),
12
+ color: "default",
13
+ maxVoltage: maxVoltage ?? 100
14
+ };
15
+ }
16
+ if (type && type in BATTERY_THRESHOLDS) {
17
+ const batteryConfig = BATTERY_THRESHOLDS[type];
18
+ const threshold = batteryConfig.thresholds.find(
19
+ ({ min, max }) => value >= min && value <= max
20
+ );
21
+ if (threshold) {
22
+ return {
23
+ label: getLabel(INDICATOR_BATTERY_DICTIONARY[threshold.label]),
24
+ color: threshold.color,
25
+ maxVoltage: batteryConfig.maxVoltage
26
+ };
27
+ }
28
+ } else {
29
+ if (maxVoltage !== void 0 && minVoltage !== void 0 && valueWeak !== void 0 && valueAcceptable !== void 0 && valueGood !== void 0 && valueExcellent !== void 0) {
30
+ const customBatteryConfig = {
31
+ maxVoltage,
32
+ thresholds: [
33
+ { min: 0, max: valueWeak, label: "statusWeak", color: "error" },
34
+ { min: valueWeak, max: valueAcceptable, label: "statusAcceptable", color: "warning" },
35
+ { min: valueAcceptable, max: valueGood, label: "statusGood", color: "info" },
36
+ { min: valueGood, max: valueExcellent, label: "statusExcellent", color: "success" },
37
+ { min: valueExcellent, max: 999, label: "statusExcellent", color: "success" }
38
+ /* { min: maxVoltage, max: 999, label: 'statusOverVoltage' as keyof typeof INDICATOR_BATTERY_DICTIONARY, color: 'candy' as ChipColorOptions }, */
39
+ ]
40
+ };
41
+ const threshold = customBatteryConfig.thresholds.find(
42
+ ({ min, max }) => {
43
+ if (min === 0) {
44
+ return value >= min && value <= max;
45
+ }
46
+ return value > min && value <= max;
47
+ }
48
+ );
49
+ if (threshold) {
50
+ return {
51
+ label: getLabel(INDICATOR_BATTERY_DICTIONARY[threshold.label]),
52
+ color: threshold.color,
53
+ maxVoltage: customBatteryConfig.maxVoltage
54
+ };
55
+ }
56
+ }
57
+ }
58
+ return {
59
+ label: getLabel(INDICATOR_BATTERY_DICTIONARY.statusNotDetectable),
60
+ color: "default",
61
+ maxVoltage: maxVoltage ?? 100
62
+ };
63
+ }, [value, type, maxVoltage, minVoltage, valueWeak, valueAcceptable, valueGood, valueExcellent, getLabel]);
64
+ return status;
65
+ };
66
+ export {
67
+ useBatteryStatus as u
68
+ };
@@ -0,0 +1,4 @@
1
+ export declare const INDICATOR_BATTERY_ICONS: {
2
+ batteryStandard: string;
3
+ batteryCompact: string;
4
+ };
@@ -0,0 +1,7 @@
1
+ const INDICATOR_BATTERY_ICONS = {
2
+ batteryStandard: "frontend/components/IndicatorBattery/assets/icons/BatteryChargingVertical.svg",
3
+ batteryCompact: "frontend/components/IndicatorBattery/assets/icons/batery.svg"
4
+ };
5
+ export {
6
+ INDICATOR_BATTERY_ICONS as I
7
+ };
@@ -0,0 +1 @@
1
+ export { IndicatorBattery } from './IndicatorBattery';
@@ -0,0 +1,27 @@
1
+ export declare const IndicatorBatteryRootStyled: import('@emotion/styled').StyledComponent<Pick<import('@m4l/components/src/components/Card/types').CardProps, keyof import('@m4l/components/src/components/Card/types').CardProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
2
+ ownerState?: (Partial<import('../types').IndicatorBatteryOwnerState> & Record<string, unknown>) | undefined;
3
+ }, {}, {}>;
4
+ export declare const TitleStyled: import('@emotion/styled').StyledComponent<Pick<import('@m4l/components/src/components/mui_extended/Typography/types').TypographyProps, keyof import('@m4l/components/src/components/mui_extended/Typography/types').TypographyProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
5
+ ownerState?: (Partial<import('../types').IndicatorBatteryOwnerState> & Record<string, unknown>) | undefined;
6
+ }, {}, {}>;
7
+ export declare const ContentStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
8
+ ownerState?: (Partial<import('../types').IndicatorBatteryOwnerState> & Record<string, unknown>) | undefined;
9
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
10
+ export declare const StatusVoltageContainerStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
11
+ ownerState?: (Partial<import('../types').IndicatorBatteryOwnerState> & Record<string, unknown>) | undefined;
12
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
13
+ export declare const StatusContainerStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
14
+ ownerState?: (Partial<import('../types').IndicatorBatteryOwnerState> & Record<string, unknown>) | undefined;
15
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
16
+ export declare const VoltageContainerStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
17
+ ownerState?: (Partial<import('../types').IndicatorBatteryOwnerState> & Record<string, unknown>) | undefined;
18
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
19
+ export declare const ContainerTitleBatteryPorcentageStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
20
+ ownerState?: (Partial<import('../types').IndicatorBatteryOwnerState> & Record<string, unknown>) | undefined;
21
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
22
+ export declare const ContainerStatusVoltageStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
23
+ ownerState?: (Partial<import('../types').IndicatorBatteryOwnerState> & Record<string, unknown>) | undefined;
24
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
25
+ export declare const ContainerIconPercentageStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
26
+ ownerState?: (Partial<import('../types').IndicatorBatteryOwnerState> & Record<string, unknown>) | undefined;
27
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
@@ -0,0 +1,52 @@
1
+ import { styled } from "@mui/material/styles";
2
+ import { Card, Typography } from "@m4l/components";
3
+ import { I as IndicatorBatterySlots } from "./IndicatorBatteryEnum.js";
4
+ import { a as INDICATOR_BATTERY_KEY_COMPONENT } from "../constants.js";
5
+ import { i as indicatorBatteryStyles } from "../IndicatorBattery.styles.js";
6
+ const IndicatorBatteryRootStyled = styled(Card, {
7
+ name: INDICATOR_BATTERY_KEY_COMPONENT,
8
+ slot: IndicatorBatterySlots.root
9
+ })(indicatorBatteryStyles?.root);
10
+ const TitleStyled = styled(Typography, {
11
+ name: INDICATOR_BATTERY_KEY_COMPONENT,
12
+ slot: IndicatorBatterySlots.title
13
+ })(indicatorBatteryStyles?.title);
14
+ const ContentStyled = styled("div", {
15
+ name: INDICATOR_BATTERY_KEY_COMPONENT,
16
+ slot: IndicatorBatterySlots.content
17
+ })(indicatorBatteryStyles?.content);
18
+ const StatusVoltageContainerStyled = styled("div", {
19
+ name: INDICATOR_BATTERY_KEY_COMPONENT,
20
+ slot: IndicatorBatterySlots.voltageStatusContainer
21
+ })(indicatorBatteryStyles?.voltageStatusContainer);
22
+ const StatusContainerStyled = styled("div", {
23
+ name: INDICATOR_BATTERY_KEY_COMPONENT,
24
+ slot: IndicatorBatterySlots.statusContainer
25
+ })(indicatorBatteryStyles?.statusContainer);
26
+ const VoltageContainerStyled = styled("div", {
27
+ name: INDICATOR_BATTERY_KEY_COMPONENT,
28
+ slot: IndicatorBatterySlots.voltageContainer
29
+ })(indicatorBatteryStyles?.voltageContainer);
30
+ const ContainerTitleBatteryPorcentageStyled = styled("div", {
31
+ name: INDICATOR_BATTERY_KEY_COMPONENT,
32
+ slot: IndicatorBatterySlots.containerTitleBatteryPorcentage
33
+ })(indicatorBatteryStyles?.containerTitleBatteryPorcentage);
34
+ const ContainerStatusVoltageStyled = styled("div", {
35
+ name: INDICATOR_BATTERY_KEY_COMPONENT,
36
+ slot: IndicatorBatterySlots.containerStatusVoltage
37
+ })(indicatorBatteryStyles?.containerStatusVoltage);
38
+ const ContainerIconPercentageStyled = styled("div", {
39
+ name: INDICATOR_BATTERY_KEY_COMPONENT,
40
+ slot: IndicatorBatterySlots.containerIconPercentage
41
+ })(indicatorBatteryStyles?.containerIconPercentage);
42
+ export {
43
+ ContentStyled as C,
44
+ IndicatorBatteryRootStyled as I,
45
+ StatusVoltageContainerStyled as S,
46
+ TitleStyled as T,
47
+ VoltageContainerStyled as V,
48
+ StatusContainerStyled as a,
49
+ ContainerTitleBatteryPorcentageStyled as b,
50
+ ContainerIconPercentageStyled as c,
51
+ ContainerStatusVoltageStyled as d
52
+ };
@@ -0,0 +1,11 @@
1
+ export declare enum IndicatorBatterySlots {
2
+ root = "root",
3
+ title = "title",
4
+ content = "content",
5
+ voltageStatusContainer = "voltageStatusContainer",
6
+ statusContainer = "statusContainer",
7
+ voltageContainer = "voltageContainer",
8
+ containerTitleBatteryPorcentage = "containerTitleBatteryPorcentage",
9
+ containerStatusVoltage = "containerStatusVoltage",
10
+ containerIconPercentage = "containerIconPercentage"
11
+ }
@@ -0,0 +1,15 @@
1
+ var IndicatorBatterySlots = /* @__PURE__ */ ((IndicatorBatterySlots2) => {
2
+ IndicatorBatterySlots2["root"] = "root";
3
+ IndicatorBatterySlots2["title"] = "title";
4
+ IndicatorBatterySlots2["content"] = "content";
5
+ IndicatorBatterySlots2["voltageStatusContainer"] = "voltageStatusContainer";
6
+ IndicatorBatterySlots2["statusContainer"] = "statusContainer";
7
+ IndicatorBatterySlots2["voltageContainer"] = "voltageContainer";
8
+ IndicatorBatterySlots2["containerTitleBatteryPorcentage"] = "containerTitleBatteryPorcentage";
9
+ IndicatorBatterySlots2["containerStatusVoltage"] = "containerStatusVoltage";
10
+ IndicatorBatterySlots2["containerIconPercentage"] = "containerIconPercentage";
11
+ return IndicatorBatterySlots2;
12
+ })(IndicatorBatterySlots || {});
13
+ export {
14
+ IndicatorBatterySlots as I
15
+ };
@@ -0,0 +1,69 @@
1
+ import { M4LOverridesStyleRules } from '@m4l/components';
2
+ import { IndicatorBatterySlots } from './slots/IndicatorBatteryEnum';
3
+ import { INDICATOR_BATTERY_KEY_COMPONENT } from './constants';
4
+ import { Theme } from '@mui/material';
5
+ import { ChipColorOptions } from '@m4l/styles';
6
+ export type IndicatorBatteryType = string;
7
+ export interface IndicatorBatteryBaseProps {
8
+ /**
9
+ * Valor actual de voltaje de la batería
10
+ */
11
+ value?: number | null;
12
+ /**
13
+ * Clase del componente
14
+ */
15
+ className?: string;
16
+ /**
17
+ * Variante del indicador
18
+ */
19
+ variant?: 'standard' | 'compact';
20
+ /**
21
+ * Tipo de batería, respaldo o principal
22
+ */
23
+ batteryType?: 'main' | 'backup';
24
+ /**
25
+ * Data test id
26
+ */
27
+ dataTestId?: string;
28
+ type?: IndicatorBatteryType;
29
+ }
30
+ export interface IndicatorBatteryWithTypeProps extends IndicatorBatteryBaseProps {
31
+ /**
32
+ * Tipo de batería (string flexible para cualquier voltaje)
33
+ * Ejemplos: '4.5', '12', '24', '48', etc.
34
+ * Los umbrales se definen en las constantes BATTERY_THRESHOLDS
35
+ */
36
+ type: IndicatorBatteryType;
37
+ }
38
+ export interface IndicatorBatteryPropsWithoutType extends IndicatorBatteryBaseProps {
39
+ /**
40
+ * Valor de estado para considerarlo como débil
41
+ */
42
+ valueWeak: number;
43
+ /**
44
+ * Valor de estado para considerarlo como aceptable
45
+ */
46
+ valueAcceptable: number;
47
+ /**
48
+ * Valor de estado para considerarlo como bueno
49
+ */
50
+ valueGood: number;
51
+ /**
52
+ * Valor de estado para considerarlo como excelente
53
+ */
54
+ valueExcellent: number;
55
+ /**
56
+ * Voltaje mínimo de la batería
57
+ */
58
+ minVoltage: number;
59
+ /**
60
+ * Voltaje máximo de la batería
61
+ */
62
+ maxVoltage: number;
63
+ }
64
+ export type IndicatorBatteryProps = IndicatorBatteryWithTypeProps | IndicatorBatteryPropsWithoutType;
65
+ export type IndicatorBatteryOwnerState = {
66
+ color: ChipColorOptions;
67
+ };
68
+ export type IndicatorBatterySlotsType = keyof typeof IndicatorBatterySlots;
69
+ export type IndicatorBatteryStyles = M4LOverridesStyleRules<IndicatorBatterySlotsType, typeof INDICATOR_BATTERY_KEY_COMPONENT, Theme>;
@@ -0,0 +1,21 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useModuleDictionary } from "@m4l/core";
3
+ import { g as getQualityLabel } from "./helpers/getQualityLabel/getQualityLabel.js";
4
+ import { I as IndicatorCSQRootStyled, C as ContainerTitleAndChipStyled, T as TitleStyled, a as ChipStyled } from "./slots/IndicatorCSQSlots.js";
5
+ import { C as CSQ_SIGNAL_DICTIONARY } from "./dictionary.js";
6
+ import { S as SignalIcon } from "./subcomponents/SignalIcon/SignalIcon.js";
7
+ const IndicatorCSQ = (props) => {
8
+ const { value, size } = props;
9
+ const { getLabel } = useModuleDictionary();
10
+ const { labelQuality, color, percentage } = getQualityLabel({ getLabel, quality: value });
11
+ return /* @__PURE__ */ jsxs(IndicatorCSQRootStyled, { role: "status", "aria-label": "CSQ Signal", children: [
12
+ /* @__PURE__ */ jsx(SignalIcon, { percentage, size }),
13
+ /* @__PURE__ */ jsxs(ContainerTitleAndChipStyled, { children: [
14
+ /* @__PURE__ */ jsx(TitleStyled, { variant: "paragraphDens", children: getLabel(CSQ_SIGNAL_DICTIONARY.LABEL_CSQ_TITLE) }),
15
+ /* @__PURE__ */ jsx(ChipStyled, { label: `${value} - ${labelQuality}`, variant: "contained", color })
16
+ ] })
17
+ ] });
18
+ };
19
+ export {
20
+ IndicatorCSQ as I
21
+ };
@@ -0,0 +1,70 @@
1
+ import { getSizeStyles } from "@m4l/components";
2
+ const getPathsByPercentage = (percentage, theme) => {
3
+ const rectangles = ["rectangle-1", "rectangle-2", "rectangle-3", "rectangle-4"];
4
+ const filledCount = Math.floor(percentage / 25);
5
+ return rectangles.reduce((acc, rectangle, index) => {
6
+ const isFilled = index < filledCount;
7
+ acc[`& .${rectangle}`] = {
8
+ fill: percentage === 0 ? theme.vars.palette.text.disabled : isFilled ? theme.vars.palette.primary.enabled : theme.vars.palette.primary.hoverOpacity
9
+ };
10
+ return acc;
11
+ }, {});
12
+ };
13
+ const indicatorCSQStyles = {
14
+ /**
15
+ * Root styles
16
+ */
17
+ root: ({ theme }) => ({
18
+ display: "flex",
19
+ flexDirection: "column",
20
+ alignItems: "center",
21
+ justifyContent: "center",
22
+ gap: theme.vars.size.baseSpacings.sp2,
23
+ borderRadius: theme.vars.size.borderRadius.r2,
24
+ backgroundColor: theme.vars.palette.background.base,
25
+ height: "fit-content",
26
+ width: "fit-content",
27
+ padding: theme.vars.size.baseSpacings.sp2
28
+ }),
29
+ /**
30
+ * Signal icon styles
31
+ */
32
+ signalIcon: ({ theme, ownerState }) => ({
33
+ ...getSizeStyles(
34
+ theme,
35
+ ownerState?.size ?? "medium",
36
+ "container",
37
+ (size) => ({
38
+ width: size,
39
+ height: size
40
+ })
41
+ ),
42
+ "& path": {
43
+ transition: "fill 0.3s ease-in-out"
44
+ },
45
+ ...getPathsByPercentage(ownerState?.percentage ?? 0, theme)
46
+ }),
47
+ /**
48
+ * Container title and chip styles
49
+ */
50
+ containerTitleAndChip: ({ theme }) => ({
51
+ display: "flex",
52
+ flexDirection: "column",
53
+ alignItems: "center",
54
+ justifyContent: "center",
55
+ gap: theme.vars.size.baseSpacings.sp1,
56
+ height: "auto",
57
+ width: "100%"
58
+ }),
59
+ /**
60
+ * Title styles
61
+ */
62
+ title: {},
63
+ /**
64
+ * Chip styles
65
+ */
66
+ chip: {}
67
+ };
68
+ export {
69
+ indicatorCSQStyles as i
70
+ };
@@ -0,0 +1,7 @@
1
+ import { getComponentClasses } from "@m4l/components";
2
+ import { I as IndicatorCSQSlots } from "./slots/IndicatorCSQEnum.js";
3
+ const CSQ_SIGNAL_KEY_COMPONENT = "M4LCSQSignal";
4
+ getComponentClasses(CSQ_SIGNAL_KEY_COMPONENT, IndicatorCSQSlots);
5
+ export {
6
+ CSQ_SIGNAL_KEY_COMPONENT as C
7
+ };
@@ -0,0 +1,16 @@
1
+ const CSQ_SIGNAL_KEY_DICTIONARY = "indicator_csq";
2
+ const getCSQSignalComponentsDictionary = () => {
3
+ return [CSQ_SIGNAL_KEY_DICTIONARY];
4
+ };
5
+ const CSQ_SIGNAL_DICTIONARY = {
6
+ LABEL_CSQ_TITLE: `${CSQ_SIGNAL_KEY_DICTIONARY}.label_csq_title`,
7
+ LABEL_QUALITY_NOT_DETECTABLE: `${CSQ_SIGNAL_KEY_DICTIONARY}.label_quality_not_detectable`,
8
+ LABEL_QUALITY_WEAK: `${CSQ_SIGNAL_KEY_DICTIONARY}.label_quality_weak`,
9
+ LABEL_QUALITY_ACCEPTABLE: `${CSQ_SIGNAL_KEY_DICTIONARY}.label_quality_acceptable`,
10
+ LABEL_QUALITY_GOOD: `${CSQ_SIGNAL_KEY_DICTIONARY}.label_quality_good`,
11
+ LABEL_QUALITY_EXCELLENT: `${CSQ_SIGNAL_KEY_DICTIONARY}.label_quality_excellent`
12
+ };
13
+ export {
14
+ CSQ_SIGNAL_DICTIONARY as C,
15
+ getCSQSignalComponentsDictionary as g
16
+ };
@@ -0,0 +1,43 @@
1
+ import { C as CSQ_SIGNAL_DICTIONARY } from "../../dictionary.js";
2
+ const SPECIAL_QUALITY_VALUES = [0, 1, 99];
3
+ const DEFAULT_QUALITY_LABEL = CSQ_SIGNAL_DICTIONARY.LABEL_QUALITY_NOT_DETECTABLE;
4
+ const QUALITY_RANGES = [
5
+ { min: 2, max: 9, value: CSQ_SIGNAL_DICTIONARY.LABEL_QUALITY_WEAK, color: "orange", percentage: 25 },
6
+ { min: 10, max: 14, value: CSQ_SIGNAL_DICTIONARY.LABEL_QUALITY_ACCEPTABLE, color: "warning", percentage: 50 },
7
+ { min: 15, max: 19, value: CSQ_SIGNAL_DICTIONARY.LABEL_QUALITY_GOOD, color: "info", percentage: 75 },
8
+ { min: 20, max: 32, value: CSQ_SIGNAL_DICTIONARY.LABEL_QUALITY_EXCELLENT, color: "persianGreen", percentage: 100 }
9
+ ];
10
+ const getQualityLabel = (props) => {
11
+ const { getLabel, quality } = props;
12
+ if (quality === null || quality === void 0) {
13
+ return {
14
+ labelQuality: getLabel(DEFAULT_QUALITY_LABEL),
15
+ color: "error",
16
+ percentage: 0
17
+ };
18
+ }
19
+ const key = Number(quality);
20
+ if (isNaN(key)) {
21
+ return {
22
+ labelQuality: getLabel(DEFAULT_QUALITY_LABEL),
23
+ color: "error",
24
+ percentage: 0
25
+ };
26
+ }
27
+ if (SPECIAL_QUALITY_VALUES.includes(key)) {
28
+ return {
29
+ labelQuality: getLabel(DEFAULT_QUALITY_LABEL),
30
+ color: "error",
31
+ percentage: 0
32
+ };
33
+ }
34
+ const qualityRange = QUALITY_RANGES.find((range) => key >= range.min && key <= range.max);
35
+ return {
36
+ labelQuality: getLabel(qualityRange?.value ?? DEFAULT_QUALITY_LABEL),
37
+ color: qualityRange?.color ?? "error",
38
+ percentage: qualityRange?.percentage ?? 0
39
+ };
40
+ };
41
+ export {
42
+ getQualityLabel as g
43
+ };
@@ -0,0 +1,11 @@
1
+ var IndicatorCSQSlots = /* @__PURE__ */ ((IndicatorCSQSlots2) => {
2
+ IndicatorCSQSlots2["root"] = "root";
3
+ IndicatorCSQSlots2["signalIcon"] = "signalIcon";
4
+ IndicatorCSQSlots2["containerTitleAndChip"] = "containerTitleAndChip";
5
+ IndicatorCSQSlots2["title"] = "title";
6
+ IndicatorCSQSlots2["chip"] = "chip";
7
+ return IndicatorCSQSlots2;
8
+ })(IndicatorCSQSlots || {});
9
+ export {
10
+ IndicatorCSQSlots as I
11
+ };
@@ -0,0 +1,32 @@
1
+ import { I as IndicatorCSQSlots } from "./IndicatorCSQEnum.js";
2
+ import { i as indicatorCSQStyles } from "../IndicatorCSQ.styles.js";
3
+ import { C as CSQ_SIGNAL_KEY_COMPONENT } from "../constants.js";
4
+ import { Typography, Chip } from "@m4l/components";
5
+ import { styled } from "@mui/material/styles";
6
+ const IndicatorCSQRootStyled = styled("div", {
7
+ name: CSQ_SIGNAL_KEY_COMPONENT,
8
+ slot: IndicatorCSQSlots.root
9
+ })(indicatorCSQStyles?.root);
10
+ const SignalIconStyled = styled("svg", {
11
+ name: CSQ_SIGNAL_KEY_COMPONENT,
12
+ slot: IndicatorCSQSlots.signalIcon
13
+ })(indicatorCSQStyles?.signalIcon);
14
+ const ContainerTitleAndChipStyled = styled("div", {
15
+ name: CSQ_SIGNAL_KEY_COMPONENT,
16
+ slot: IndicatorCSQSlots.containerTitleAndChip
17
+ })(indicatorCSQStyles?.containerTitleAndChip);
18
+ const TitleStyled = styled(Typography, {
19
+ name: CSQ_SIGNAL_KEY_COMPONENT,
20
+ slot: IndicatorCSQSlots.title
21
+ })(indicatorCSQStyles?.title);
22
+ const ChipStyled = styled(Chip, {
23
+ name: CSQ_SIGNAL_KEY_COMPONENT,
24
+ slot: IndicatorCSQSlots.chip
25
+ })(indicatorCSQStyles?.chip);
26
+ export {
27
+ ContainerTitleAndChipStyled as C,
28
+ IndicatorCSQRootStyled as I,
29
+ SignalIconStyled as S,
30
+ TitleStyled as T,
31
+ ChipStyled as a
32
+ };
@@ -0,0 +1,19 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useComponentSize } from "@m4l/components";
3
+ import { S as SignalIconStyled } from "../../slots/IndicatorCSQSlots.js";
4
+ const SignalIcon = (props) => {
5
+ const { percentage, size } = props;
6
+ const { currentSize } = useComponentSize(size);
7
+ return /* @__PURE__ */ jsxs(SignalIconStyled, { role: "img", "aria-label": "icono de señal de CSQ", ownerState: { percentage, size: currentSize }, viewBox: "0 0 33 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [
8
+ /* @__PURE__ */ jsxs("g", { "clip-path": "url(#clip0_2048_402)", children: [
9
+ /* @__PURE__ */ jsx("path", { className: "rectangle-1", "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M9.84 20.04C10.56 20.04 11.14 20.62 11.14 21.34V26.68C11.14 27.4 10.56 27.98 9.84 27.98C9.12 27.98 8.54 27.4 8.54 26.68V21.34C8.54 20.62 9.12 20.04 9.84 20.04Z", fill: "#fff" }),
10
+ /* @__PURE__ */ jsx("path", { className: "rectangle-2", "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M16.5 14.7C17.22 14.7 17.8 15.28 17.8 16V26.66C17.8 27.38 17.22 27.96 16.5 27.96C15.78 27.96 15.2 27.38 15.2 26.66V16C15.2 15.28 15.78 14.7 16.5 14.7Z", fill: "#fff" }),
11
+ /* @__PURE__ */ jsx("path", { className: "rectangle-3", "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M23.16 9.35999C23.88 9.35999 24.46 9.93999 24.46 10.66V26.66C24.46 27.38 23.88 27.96 23.16 27.96C22.44 27.96 21.86 27.38 21.86 26.66V10.66C21.86 9.93999 22.44 9.35999 23.16 9.35999Z", fill: "#fff" }),
12
+ /* @__PURE__ */ jsx("path", { className: "rectangle-4", "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M29.84 4.03998C30.56 4.03998 31.14 4.61998 31.14 5.33998V26.68C31.14 27.4 30.56 27.98 29.84 27.98C29.12 27.98 28.54 27.4 28.54 26.68V5.33998C28.54 4.61998 29.12 4.03998 29.84 4.03998Z", fill: "#fff" })
13
+ ] }),
14
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("clipPath", { id: "clip0_2048_402", children: /* @__PURE__ */ jsx("rect", { width: "32", height: "32", fill: "white", transform: "translate(0.5)" }) }) })
15
+ ] });
16
+ };
17
+ export {
18
+ SignalIcon as S
19
+ };
@@ -0,0 +1,7 @@
1
+ import { IndicatorValueStatusProps } from './types';
2
+ /**
3
+ * The indicator value status component
4
+ * @param props - The props of the indicator value status component
5
+ * @returns The indicator value status component
6
+ */
7
+ export declare const IndicatorValueStatus: (props: IndicatorValueStatusProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import { IndicatorValueStatusStyles } from './types';
2
+ export declare const indicatorValueStatusStyles: IndicatorValueStatusStyles;
@@ -0,0 +1,2 @@
1
+ export declare const INDICATOR_VALUE_STATUS_COMPONENT_KEY = "M4LIndicatorValueStatus";
2
+ export declare const INDICATOR_VALUE_STATUS_CLASSES: Record<string, string>;
@@ -0,0 +1 @@
1
+ export { IndicatorValueStatus } from './IndicatorValueStatus';
@@ -0,0 +1,7 @@
1
+ export declare enum IndicatorValueStatusSlots {
2
+ root = "root",
3
+ containerTitleIcon = "containerTitleIcon",
4
+ containerValue = "containerValue",
5
+ containerValueStatus = "containerValueStatus",
6
+ icon = "icon"
7
+ }
@@ -0,0 +1,15 @@
1
+ export declare const IndicatorValueStatusRootStyled: import('@emotion/styled').StyledComponent<Pick<import('@m4l/components/src/components/Card/types').CardProps, keyof import('@m4l/components/src/components/Card/types').CardProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
2
+ ownerState?: any;
3
+ }, {}, {}>;
4
+ export declare const ContainerTitleIconStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
5
+ ownerState?: any;
6
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
7
+ export declare const ContainerValueStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
8
+ ownerState?: any;
9
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
10
+ export declare const ContainerValueStatusStyled: import('@emotion/styled').StyledComponent<import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
11
+ ownerState?: any;
12
+ }, Pick<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import('react').ClassAttributes<HTMLDivElement> | keyof import('react').HTMLAttributes<HTMLDivElement>>, {}>;
13
+ export declare const IconStyled: import('@emotion/styled').StyledComponent<Pick<import('@m4l/components').IconProps, keyof import('@m4l/components').IconProps> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
14
+ ownerState?: any;
15
+ }, {}, {}>;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Formatter for the demo component
3
+ * @param {string} value - The value to display
4
+ * @param {string} magnitude - The magnitude of the value
5
+ * @returns {React.ReactNode} - The formatted value
6
+ */
7
+ export declare const DemoFormatter: ({ value, magnitude, size }: {
8
+ value: string;
9
+ magnitude?: string;
10
+ size?: any;
11
+ }) => import("react/jsx-runtime").JSX.Element;