@m4l/gclick 0.0.2 → 0.0.3-BE010925-beta.1
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 +8 -0
- package/components/gauges/Gauge/index.d.ts +1 -1
- package/components/gauges/Gauge/slots/GaugeSlots.d.ts +1 -1
- package/components/gauges/Gauge/slots/GaugeSlots.js +2 -2
- package/components/gauges/MiGauge/MiGauge.d.ts +8 -0
- package/components/gauges/MiGauge/MiGauge.js +28 -0
- package/components/gauges/MiGauge/MiGauge.styles.d.ts +2 -0
- package/components/gauges/MiGauge/MiGauge.styles.js +51 -0
- package/components/gauges/MiGauge/constants.d.ts +2 -0
- package/components/gauges/MiGauge/constants.js +8 -0
- package/components/gauges/MiGauge/index.d.ts +1 -0
- package/components/gauges/MiGauge/index.js +1 -0
- package/components/gauges/MiGauge/slots/MiGaugeEnum.d.ts +5 -0
- package/components/gauges/MiGauge/slots/MiGaugeEnum.js +9 -0
- package/components/gauges/MiGauge/slots/MiGaugeSlots.d.ts +3 -0
- package/components/gauges/MiGauge/slots/MiGaugeSlots.js +21 -0
- package/components/gauges/MiGauge/subcomponents/CircularProgress/CircularProgress.d.ts +8 -0
- package/components/gauges/MiGauge/subcomponents/CircularProgress/CircularProgress.js +42 -0
- package/components/gauges/MiGauge/subcomponents/CircularProgress/constants.d.ts +2 -0
- package/components/gauges/MiGauge/subcomponents/CircularProgress/constants.js +6 -0
- package/components/gauges/MiGauge/subcomponents/CircularProgress/index.d.ts +1 -0
- package/components/gauges/MiGauge/subcomponents/CircularProgress/index.js +1 -0
- package/components/gauges/MiGauge/test/MiGauge.test.d.ts +1 -0
- package/components/gauges/MiGauge/types.d.ts +25 -0
- package/components/gauges/index.d.ts +1 -0
- package/components/index.d.ts +1 -0
- package/components/indicators/IndicatorBattery/IndicatorBattery.d.ts +7 -0
- package/components/indicators/IndicatorBattery/IndicatorBattery.js +85 -0
- package/components/indicators/IndicatorBattery/IndicatorBattery.styles.d.ts +2 -0
- package/components/indicators/IndicatorBattery/IndicatorBattery.styles.js +66 -0
- package/components/indicators/IndicatorBattery/constants.d.ts +2 -0
- package/components/indicators/IndicatorBattery/constants.js +8 -0
- package/components/indicators/IndicatorBattery/dictionary.d.ts +14 -0
- package/components/indicators/IndicatorBattery/dictionary.js +16 -0
- package/components/indicators/IndicatorBattery/hooks/useBatteryStatus/constants.d.ts +9 -0
- package/components/indicators/IndicatorBattery/hooks/useBatteryStatus/constants.js +35 -0
- package/components/indicators/IndicatorBattery/hooks/useBatteryStatus/test/useBattery.test.d.ts +1 -0
- package/components/indicators/IndicatorBattery/hooks/useBatteryStatus/types.d.ts +38 -0
- package/components/indicators/IndicatorBattery/hooks/useBatteryStatus/useBatteryStatus.d.ts +7 -0
- package/components/indicators/IndicatorBattery/hooks/useBatteryStatus/useBatteryStatus.js +68 -0
- package/components/indicators/IndicatorBattery/icons.d.ts +3 -0
- package/components/indicators/IndicatorBattery/icons.js +6 -0
- package/components/indicators/IndicatorBattery/index.d.ts +1 -0
- package/components/indicators/IndicatorBattery/index.js +1 -0
- package/components/indicators/IndicatorBattery/slots/IndicatorBaterySlots.d.ts +18 -0
- package/components/indicators/IndicatorBattery/slots/IndicatorBaterySlots.js +37 -0
- package/components/indicators/IndicatorBattery/slots/IndicatorBatteryEnum.d.ts +8 -0
- package/components/indicators/IndicatorBattery/slots/IndicatorBatteryEnum.js +12 -0
- package/components/indicators/IndicatorBattery/test/IndicatorBattery.test.d.ts +1 -0
- package/components/indicators/IndicatorBattery/types.d.ts +65 -0
- package/components/indicators/IndicatorCSQ/IndicatorCSQ.js +21 -0
- package/components/indicators/IndicatorCSQ/IndicatorCSQ.styles.js +70 -0
- package/components/indicators/IndicatorCSQ/constants.js +7 -0
- package/components/indicators/IndicatorCSQ/dictionary.js +16 -0
- package/components/indicators/IndicatorCSQ/helpers/getQualityLabel/getQualityLabel.js +43 -0
- package/components/indicators/IndicatorCSQ/index.js +1 -0
- package/components/indicators/IndicatorCSQ/slots/IndicatorCSQEnum.js +11 -0
- package/components/indicators/IndicatorCSQ/slots/IndicatorCSQSlots.js +32 -0
- package/components/indicators/IndicatorCSQ/subcomponents/SignalIcon/SignalIcon.js +19 -0
- package/components/indicators/IndicatorCSQ/subcomponents/SignalIcon/index.js +1 -0
- package/components/indicators/index.d.ts +2 -0
- package/components/indicators/index.js +1 -0
- package/contexts/RealTimeProducerContext/sourceDataMechanisms/athmospherejs/index.js +1 -1
- package/index.js +19 -11
- package/package.json +29 -24
- package/.storybook/constants.d.ts +0 -30
- package/.storybook/decorators/StorybookWithMapProvider/constants.d.ts +0 -2
- package/.storybook/decorators/StorybookWithMapProvider/index.d.ts +0 -1
- package/.storybook/decorators/WithContexts/constants.d.ts +0 -10
- package/.storybook/decorators/WithContexts/index.d.ts +0 -1
- package/.storybook/decorators/WithContexts/types.d.ts +0 -7
- package/.storybook/decorators/WithWindowsContainer/index.d.ts +0 -2
- package/.storybook/decorators/WithWindowsContainer/subcomponents/WindowsContainer/index.d.ts +0 -1
- package/.storybook/decorators/WithWindowsContainer/subcomponents/WindowsContainer/types.d.ts +0 -4
- package/.storybook/main.d.ts +0 -3
- package/.storybook/mocks/config-msw.d.ts +0 -21
- package/.storybook/mocks/index.d.ts +0 -2
- package/.storybook/mocks/network-mocks.d.ts +0 -1
- package/.storybook/storybook.vite.d.ts +0 -2
- package/not_recognized/index.js +0 -406
package/@types/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { MapPopupDeviceGpsOwnerState, MapPopupDeviceGpsSlotsType } from '../comp
|
|
|
3
3
|
import { CourseFormatterOwnerState, CourseFormatterSlotsType } from '../formatters/CourseFormatter/types';
|
|
4
4
|
import { IndicatorCSQOwnerState, IndicatorCSQSlotsType } from '../components/indicators/IndicatorCSQ/types';
|
|
5
5
|
import { GaugeSlotsType } from '../components/gauges/Gauge/types';
|
|
6
|
+
import { IndicatorBatteryOwnerState, IndicatorBatterySlotsType } from '../components/indicators/IndicatorBattery/types';
|
|
6
7
|
declare module '@mui/material/styles' {
|
|
7
8
|
// Define the slots in the theme
|
|
8
9
|
interface ComponentNameToClassKey {
|
|
@@ -10,6 +11,7 @@ declare module '@mui/material/styles' {
|
|
|
10
11
|
M4LCourseFormatter: CourseFormatterSlotsType;
|
|
11
12
|
M4LCSQSignal: IndicatorCSQSlotsType;
|
|
12
13
|
M4LGauge: GaugeSlotsType;
|
|
14
|
+
M4LIndicatorBattery: IndicatorBatterySlotsType;
|
|
13
15
|
}
|
|
14
16
|
interface ComponentsPropsList {
|
|
15
17
|
// Extend ComponentsProps or ComponentsOwnerState(this extend ComponentProps)
|
|
@@ -17,6 +19,7 @@ declare module '@mui/material/styles' {
|
|
|
17
19
|
M4LCourseFormatter: Partial<CourseFormatterOwnerState>;
|
|
18
20
|
M4LCSQSignal: Partial<IndicatorCSQOwnerState>;
|
|
19
21
|
M4LGauge: Partial<GaugeOwnerState>;
|
|
22
|
+
M4LIndicatorBattery: Partial<IndicatorBatteryOwnerState>;
|
|
20
23
|
}
|
|
21
24
|
interface Components {
|
|
22
25
|
M4LMapPopupDevice?: {
|
|
@@ -39,5 +42,10 @@ declare module '@mui/material/styles' {
|
|
|
39
42
|
styleOverrides?: ComponentsOverrides<Theme>['M4LGauge'];
|
|
40
43
|
variants?: ComponentsVariants['M4LGauge'];
|
|
41
44
|
};
|
|
45
|
+
M4LIndicatorBattery?: {
|
|
46
|
+
defaultProps?: ComponentsPropsList['M4LIndicatorBattery'];
|
|
47
|
+
styleOverrides?: ComponentsOverrides<Theme>['M4LIndicatorBattery'];
|
|
48
|
+
variants?: ComponentsVariants['M4LIndicatorBattery'];
|
|
49
|
+
};
|
|
42
50
|
}
|
|
43
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Gauge
|
|
1
|
+
export { Gauge } from './Gauge';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const GaugeRootStyled: import('@emotion/styled').StyledComponent<Pick<Omit<import('@mui/x-charts
|
|
1
|
+
export declare const GaugeRootStyled: import('@emotion/styled').StyledComponent<Pick<Omit<import('@mui/x-charts').GaugeProps, "ref"> & import('react').RefAttributes<SVGSVGElement>, "string" | "value" | "filter" | "fill" | "values" | "children" | "text" | "title" | "x" | "y" | "name" | "method" | "id" | "type" | "clipPath" | "color" | "cursor" | "direction" | "display" | "fontFamily" | "fontSize" | "fontSizeAdjust" | "fontStretch" | "fontStyle" | "fontVariant" | "fontWeight" | "height" | "imageRendering" | "letterSpacing" | "opacity" | "order" | "paintOrder" | "pointerEvents" | "rotate" | "scale" | "textRendering" | "transform" | "transformOrigin" | "unicodeBidi" | "visibility" | "width" | "wordSpacing" | "writingMode" | "margin" | "mask" | "offset" | "overflow" | "textDecoration" | "azimuth" | "clip" | "alignmentBaseline" | "baselineShift" | "clipRule" | "colorInterpolation" | "colorRendering" | "dominantBaseline" | "fillOpacity" | "fillRule" | "floodColor" | "floodOpacity" | "glyphOrientationVertical" | "lightingColor" | "markerEnd" | "markerMid" | "markerStart" | "shapeRendering" | "stopColor" | "stopOpacity" | "stroke" | "strokeDasharray" | "strokeDashoffset" | "strokeLinecap" | "strokeLinejoin" | "strokeMiterlimit" | "strokeOpacity" | "strokeWidth" | "textAnchor" | "vectorEffect" | "end" | "version" | "mode" | "spacing" | "accumulate" | "local" | "style" | "unicode" | "alphabetic" | "hanging" | "ideographic" | "mathematical" | "className" | "classes" | "sx" | "desc" | "path" | "suppressHydrationWarning" | "lang" | "tabIndex" | "role" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "in" | "max" | "href" | "media" | "target" | "elevation" | "min" | "crossOrigin" | "accentHeight" | "additive" | "allowReorder" | "amplitude" | "arabicForm" | "ascent" | "attributeName" | "attributeType" | "autoReverse" | "baseFrequency" | "baseProfile" | "bbox" | "begin" | "bias" | "by" | "calcMode" | "capHeight" | "clipPathUnits" | "colorInterpolationFilters" | "colorProfile" | "contentScriptType" | "contentStyleType" | "cx" | "cy" | "d" | "decelerate" | "descent" | "diffuseConstant" | "divisor" | "dur" | "dx" | "dy" | "edgeMode" | "enableBackground" | "exponent" | "externalResourcesRequired" | "filterRes" | "filterUnits" | "focusable" | "format" | "fr" | "from" | "fx" | "fy" | "g1" | "g2" | "glyphName" | "glyphOrientationHorizontal" | "glyphRef" | "gradientTransform" | "gradientUnits" | "horizAdvX" | "horizOriginX" | "in2" | "intercept" | "k1" | "k2" | "k3" | "k4" | "k" | "kernelMatrix" | "kernelUnitLength" | "kerning" | "keyPoints" | "keySplines" | "keyTimes" | "lengthAdjust" | "limitingConeAngle" | "markerHeight" | "markerUnits" | "markerWidth" | "maskContentUnits" | "maskUnits" | "numOctaves" | "operator" | "orient" | "orientation" | "origin" | "overlinePosition" | "overlineThickness" | "panose1" | "pathLength" | "patternContentUnits" | "patternTransform" | "patternUnits" | "points" | "pointsAtX" | "pointsAtY" | "pointsAtZ" | "preserveAlpha" | "preserveAspectRatio" | "primitiveUnits" | "r" | "radius" | "refX" | "refY" | "renderingIntent" | "repeatCount" | "repeatDur" | "requiredExtensions" | "requiredFeatures" | "restart" | "result" | "rx" | "ry" | "seed" | "slope" | "specularConstant" | "specularExponent" | "speed" | "spreadMethod" | "startOffset" | "stdDeviation" | "stemh" | "stemv" | "stitchTiles" | "strikethroughPosition" | "strikethroughThickness" | "surfaceScale" | "systemLanguage" | "tableValues" | "targetX" | "targetY" | "textLength" | "to" | "u1" | "u2" | "underlinePosition" | "underlineThickness" | "unicodeRange" | "unitsPerEm" | "vAlphabetic" | "vertAdvY" | "vertOriginX" | "vertOriginY" | "vHanging" | "vIdeographic" | "viewBox" | "viewTarget" | "vMathematical" | "widths" | "x1" | "x2" | "xChannelSelector" | "xHeight" | "xlinkActuate" | "xlinkArcrole" | "xlinkHref" | "xlinkRole" | "xlinkShow" | "xlinkTitle" | "xlinkType" | "xmlBase" | "xmlLang" | "xmlns" | "xmlnsXlink" | "xmlSpace" | "y1" | "y2" | "yChannelSelector" | "z" | "zoomAndPan" | "skipAnimation" | "valueMin" | "valueMax" | "startAngle" | "endAngle" | "innerRadius" | "outerRadius" | "cornerRadius" | keyof import('react').RefAttributes<SVGSVGElement>> & import('@mui/system').MUIStyledCommonProps<import('@mui/material/styles').Theme> & Record<string, unknown> & {
|
|
2
2
|
ownerState?: any;
|
|
3
3
|
}, {}, {}>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { styled } from "@mui/material";
|
|
1
|
+
import { styled } from "@mui/material/styles";
|
|
2
2
|
import { G as GaugeSlots } from "./GaugeEnum.js";
|
|
3
3
|
import { a as GAUGE_KEY_COMPONENT } from "../constants.js";
|
|
4
4
|
import { g as gaugeStyles } from "../Gauge.styles.js";
|
|
5
|
-
import { Gauge } from "@mui/x-charts
|
|
5
|
+
import { Gauge } from "@mui/x-charts";
|
|
6
6
|
const GaugeRootStyled = styled(Gauge, {
|
|
7
7
|
name: GAUGE_KEY_COMPONENT,
|
|
8
8
|
slot: GaugeSlots.root
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MiGaugeProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Renderiza un gauge circular que representa un valor porcentual.
|
|
4
|
+
* @description MiGauge component
|
|
5
|
+
* @param props - MiGaugeProps
|
|
6
|
+
* @returns MiGaugeRootStyled
|
|
7
|
+
*/
|
|
8
|
+
export declare const MiGauge: (props: MiGaugeProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { M as MIGAUGE_CLASSES } from "./constants.js";
|
|
3
|
+
import { M as MiGaugeRootStyled, a as MiGaugeCircularBgStyled, b as MiGaugeInnerStyled } from "./slots/MiGaugeSlots.js";
|
|
4
|
+
import clsx from "clsx";
|
|
5
|
+
import { C as CircularProgress } from "./subcomponents/CircularProgress/CircularProgress.js";
|
|
6
|
+
const MiGauge = (props) => {
|
|
7
|
+
const { value, children, className } = props;
|
|
8
|
+
const normalizedValue = Math.max(0, Math.min(100, value));
|
|
9
|
+
return /* @__PURE__ */ jsxs(
|
|
10
|
+
MiGaugeRootStyled,
|
|
11
|
+
{
|
|
12
|
+
role: "progressbar",
|
|
13
|
+
"aria-label": "MiGauge",
|
|
14
|
+
"aria-valuenow": normalizedValue,
|
|
15
|
+
"aria-valuemin": 0,
|
|
16
|
+
"aria-valuemax": 100,
|
|
17
|
+
className: clsx(MIGAUGE_CLASSES.root, className),
|
|
18
|
+
children: [
|
|
19
|
+
/* @__PURE__ */ jsx(MiGaugeCircularBgStyled, {}),
|
|
20
|
+
/* @__PURE__ */ jsx(CircularProgress, { value: normalizedValue }),
|
|
21
|
+
/* @__PURE__ */ jsx(MiGaugeInnerStyled, { children })
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
MiGauge as M
|
|
28
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const miGaugeStyles = {
|
|
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
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}),
|
|
21
|
+
/**
|
|
22
|
+
* Estilos para el fondo del gauge
|
|
23
|
+
*/
|
|
24
|
+
circularBg: ({ theme }) => ({
|
|
25
|
+
opacity: 0.5,
|
|
26
|
+
width: "inherit",
|
|
27
|
+
height: "inherit",
|
|
28
|
+
borderRadius: "inherit",
|
|
29
|
+
position: "absolute",
|
|
30
|
+
background: theme.vars.palette.background.surface
|
|
31
|
+
}),
|
|
32
|
+
/**
|
|
33
|
+
* Estilos para el contenedor interno del gauge
|
|
34
|
+
*/
|
|
35
|
+
inner: ({ theme }) => ({
|
|
36
|
+
width: "60px",
|
|
37
|
+
height: "60px",
|
|
38
|
+
borderRadius: "50%",
|
|
39
|
+
background: theme.vars.palette.background.default,
|
|
40
|
+
position: "absolute",
|
|
41
|
+
display: "flex",
|
|
42
|
+
flexDirection: "column",
|
|
43
|
+
gap: theme.vars.size.baseSpacings.sp1,
|
|
44
|
+
justifyContent: "center",
|
|
45
|
+
alignItems: "center",
|
|
46
|
+
boxShadow: `0 4px 4px 0 ${theme.vars.palette.background.surface}`
|
|
47
|
+
})
|
|
48
|
+
};
|
|
49
|
+
export {
|
|
50
|
+
miGaugeStyles as m
|
|
51
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { getComponentClasses } from "@m4l/components";
|
|
2
|
+
import { M as MiGaugeSlots } from "./slots/MiGaugeEnum.js";
|
|
3
|
+
const MIGAUGE_KEY_COMPONENT = "M4LMiGauge";
|
|
4
|
+
const MIGAUGE_CLASSES = getComponentClasses(MIGAUGE_KEY_COMPONENT, MiGaugeSlots);
|
|
5
|
+
export {
|
|
6
|
+
MIGAUGE_CLASSES as M,
|
|
7
|
+
MIGAUGE_KEY_COMPONENT as a
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MiGauge } from './MiGauge';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const MiGaugeRootStyled: 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 MiGaugeInnerStyled: 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 MiGaugeCircularBgStyled: 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 MIGAUGE_KEY_COMPONENT } from "../constants.js";
|
|
3
|
+
import { M as MiGaugeSlots } from "./MiGaugeEnum.js";
|
|
4
|
+
import { m as miGaugeStyles } from "../MiGauge.styles.js";
|
|
5
|
+
const MiGaugeRootStyled = styled("div", {
|
|
6
|
+
name: MIGAUGE_KEY_COMPONENT,
|
|
7
|
+
slot: MiGaugeSlots.root
|
|
8
|
+
})(miGaugeStyles?.root);
|
|
9
|
+
const MiGaugeInnerStyled = styled("div", {
|
|
10
|
+
name: MIGAUGE_KEY_COMPONENT,
|
|
11
|
+
slot: MiGaugeSlots.inner
|
|
12
|
+
})(miGaugeStyles?.inner);
|
|
13
|
+
const MiGaugeCircularBgStyled = styled("div", {
|
|
14
|
+
name: MIGAUGE_KEY_COMPONENT,
|
|
15
|
+
slot: MiGaugeSlots.circularBg
|
|
16
|
+
})(miGaugeStyles?.circularBg);
|
|
17
|
+
export {
|
|
18
|
+
MiGaugeRootStyled as M,
|
|
19
|
+
MiGaugeCircularBgStyled as a,
|
|
20
|
+
MiGaugeInnerStyled as b
|
|
21
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
),
|
|
23
|
+
/* @__PURE__ */ jsx(
|
|
24
|
+
"circle",
|
|
25
|
+
{
|
|
26
|
+
className: "circular-progress-circle",
|
|
27
|
+
cx: CIRCULAR_PROGRESS_SIZE / 2,
|
|
28
|
+
cy: CIRCULAR_PROGRESS_SIZE / 2,
|
|
29
|
+
r: radius,
|
|
30
|
+
strokeWidth: CIRCULAR_PROGRESS_STROKE_WIDTH,
|
|
31
|
+
fill: "none",
|
|
32
|
+
strokeDasharray: circumference,
|
|
33
|
+
strokeDashoffset: offset,
|
|
34
|
+
strokeLinecap: "round",
|
|
35
|
+
transform: `rotate(-90 ${CIRCULAR_PROGRESS_SIZE / 2} ${CIRCULAR_PROGRESS_SIZE / 2})`
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
] });
|
|
39
|
+
};
|
|
40
|
+
export {
|
|
41
|
+
CircularProgress as C
|
|
42
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CircularProgress } from './CircularProgress';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { M4LOverridesStyleRules } from '@m4l/components';
|
|
2
|
+
import { MiGaugeSlots } from './slots/MiGaugeEnum';
|
|
3
|
+
import { MIGAUGE_KEY_COMPONENT } from './constants';
|
|
4
|
+
import { Theme } from '@mui/material';
|
|
5
|
+
export interface MiGaugeProps {
|
|
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 MiGaugeOwnerState = {};
|
|
24
|
+
export type MiGaugeSlotsType = keyof typeof MiGaugeSlots;
|
|
25
|
+
export type MiGaugeStyles = M4LOverridesStyleRules<MiGaugeSlotsType, typeof MIGAUGE_KEY_COMPONENT, Theme>;
|
package/components/index.d.ts
CHANGED
|
@@ -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,85 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { I as IndicatorBatteryRootStyled, T as TitleStyled, C as ContentStyled, S as StatusVoltageContainerStyled, a as StatusContainerStyled, V as VoltageContainerStyled } 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_KEY_COMPONENT, a as INDICATOR_BATTERY_CLASSES } 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 { M as MiGauge } from "../../gauges/MiGauge/MiGauge.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 = "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.min(Math.ceil(percentage));
|
|
41
|
+
}
|
|
42
|
+
return Math.min(Math.ceil(value));
|
|
43
|
+
}, [value, hookMaxVoltage]);
|
|
44
|
+
return /* @__PURE__ */ jsxs(
|
|
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
|
+
gap: "standard",
|
|
57
|
+
...getPropDataTestId(INDICATOR_BATTERY_KEY_COMPONENT, IndicatorBatterySlots.root, dataTestId),
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ jsx(TitleStyled, { variant: "captionDens", skeletonWidth: "80px", children: getLabel(variant === "main" ? INDICATOR_BATTERY_DICTIONARY.titleMain : INDICATOR_BATTERY_DICTIONARY.titleBackup) }),
|
|
60
|
+
/* @__PURE__ */ jsxs(ContentStyled, { ownerState, children: [
|
|
61
|
+
/* @__PURE__ */ jsxs(MiGauge, { value: gaugeValue, children: [
|
|
62
|
+
/* @__PURE__ */ jsx(Icon, { src: `${host_static_assets}/${environment_assets}/${INDICATOR_BATTERY_ICONS.battery}` }),
|
|
63
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "flex-end", justifyContent: "center", gap: "2px" }, children: [
|
|
64
|
+
/* @__PURE__ */ jsx(Typography, { variant: "subtitle", fontFamily: "jura", color: "text.primary", skeletonWidth: "20px", children: `${gaugeValue ?? 0}` }),
|
|
65
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", fontFamily: "jura", color: "text.primary", skeletonWidth: "10px", children: "%" })
|
|
66
|
+
] })
|
|
67
|
+
] }),
|
|
68
|
+
/* @__PURE__ */ jsxs(StatusVoltageContainerStyled, { children: [
|
|
69
|
+
/* @__PURE__ */ jsxs(StatusContainerStyled, { children: [
|
|
70
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", color: "text.secondary", skeletonWidth: "70px", children: getLabel(INDICATOR_BATTERY_DICTIONARY.status) }),
|
|
71
|
+
/* @__PURE__ */ jsx(Chip, { label, color, variant: "contained", skeletonWidth: "70px" })
|
|
72
|
+
] }),
|
|
73
|
+
/* @__PURE__ */ jsxs(VoltageContainerStyled, { children: [
|
|
74
|
+
/* @__PURE__ */ jsx(Typography, { variant: "body", color: "text.secondary", skeletonWidth: "70px", children: getLabel(INDICATOR_BATTERY_DICTIONARY.voltage) }),
|
|
75
|
+
/* @__PURE__ */ jsx(Typography, { variant: "bodyDens", color: "text.primary", skeletonWidth: "20px", children: value })
|
|
76
|
+
] })
|
|
77
|
+
] })
|
|
78
|
+
] })
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
export {
|
|
84
|
+
IndicatorBattery as I
|
|
85
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
const indicatorBatteryStyles = {
|
|
2
|
+
/**
|
|
3
|
+
* Contenedor del indicador de batería
|
|
4
|
+
*/
|
|
5
|
+
root: ({ theme }) => ({
|
|
6
|
+
width: "fit-content",
|
|
7
|
+
display: "flex",
|
|
8
|
+
flexDirection: "column",
|
|
9
|
+
gap: theme.vars.size.baseSpacings["sp3-5"],
|
|
10
|
+
backgroundColor: theme.vars.palette.background.base
|
|
11
|
+
}),
|
|
12
|
+
/**
|
|
13
|
+
* Título del indicador de batería
|
|
14
|
+
*/
|
|
15
|
+
title: () => ({
|
|
16
|
+
textTransform: "uppercase",
|
|
17
|
+
justifyContent: "center",
|
|
18
|
+
display: "flex"
|
|
19
|
+
}),
|
|
20
|
+
/**
|
|
21
|
+
* Contenedor del gauge y los datos de la batería
|
|
22
|
+
*/
|
|
23
|
+
content: ({ theme, ownerState }) => ({
|
|
24
|
+
display: "flex",
|
|
25
|
+
gap: theme.vars.size.baseSpacings.sp5,
|
|
26
|
+
"& .M4LIcon-icon": {
|
|
27
|
+
backgroundColor: theme.vars.palette.chips[ownerState?.color ?? "default"].outlined.colorTone
|
|
28
|
+
},
|
|
29
|
+
"&&& .circular-progress-circle": {
|
|
30
|
+
stroke: `${theme.vars.palette.chips[ownerState?.color ?? "default"].outlined.colorTone}!important`
|
|
31
|
+
}
|
|
32
|
+
}),
|
|
33
|
+
/**
|
|
34
|
+
* Contenedor del estado de la batería y el voltaje
|
|
35
|
+
*/
|
|
36
|
+
voltageStatusContainer: ({ theme }) => ({
|
|
37
|
+
display: "flex",
|
|
38
|
+
flexDirection: "column",
|
|
39
|
+
alignItems: "flex-start",
|
|
40
|
+
justifyContent: "center",
|
|
41
|
+
gap: theme.vars.size.baseSpacings.sp4
|
|
42
|
+
}),
|
|
43
|
+
/**
|
|
44
|
+
* Contenedor del estado de la batería
|
|
45
|
+
*/
|
|
46
|
+
statusContainer: ({ theme }) => ({
|
|
47
|
+
width: "100%",
|
|
48
|
+
display: "flex",
|
|
49
|
+
justifyContent: "space-between",
|
|
50
|
+
alignItems: "center",
|
|
51
|
+
gap: theme.vars.size.baseSpacings.sp4
|
|
52
|
+
}),
|
|
53
|
+
/**
|
|
54
|
+
* Contenedor del voltaje
|
|
55
|
+
*/
|
|
56
|
+
voltageContainer: ({ theme }) => ({
|
|
57
|
+
width: "100%",
|
|
58
|
+
display: "flex",
|
|
59
|
+
justifyContent: "space-between",
|
|
60
|
+
alignItems: "center",
|
|
61
|
+
gap: theme.vars.size.baseSpacings.sp4
|
|
62
|
+
})
|
|
63
|
+
};
|
|
64
|
+
export {
|
|
65
|
+
indicatorBatteryStyles as i
|
|
66
|
+
};
|
|
@@ -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_KEY_COMPONENT as I,
|
|
7
|
+
INDICATOR_BATTERY_CLASSES 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 { IndicatorBatteryType } from '../../types';
|
|
2
|
+
import { BatteryThreshold } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Umbrales de la batería optimizados para evitar duplicación de maxVoltage
|
|
5
|
+
*/
|
|
6
|
+
export declare const BATTERY_THRESHOLDS: Record<IndicatorBatteryType, {
|
|
7
|
+
maxVoltage: number;
|
|
8
|
+
thresholds: Omit<BatteryThreshold, 'maxVoltage'>[];
|
|
9
|
+
}>;
|