@chtc/web-components 0.0.0-25 → 0.0.0-27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface DowntimeBarProps extends React.SVGProps<SVGSVGElement> {
|
|
3
|
+
data: (boolean | undefined)[];
|
|
4
|
+
grey?: string;
|
|
3
5
|
red?: string;
|
|
4
6
|
green?: string;
|
|
5
7
|
}
|
|
6
8
|
/**
|
|
7
9
|
* DowntimeBar consumes a boolean array of uptimes
|
|
8
10
|
* @param data
|
|
11
|
+
* @param grey
|
|
9
12
|
* @param red
|
|
10
13
|
* @param green
|
|
14
|
+
* @param svgProps
|
|
11
15
|
* @constructor
|
|
12
16
|
*/
|
|
13
|
-
declare const DowntimeBar: ({ data, red, green }: DowntimeBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
declare const DowntimeBar: ({ data, red, green, grey, ...svgProps }: DowntimeBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
18
|
export default DowntimeBar;
|
|
15
19
|
//# sourceMappingURL=DowntimeBar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DowntimeBar.d.ts","sourceRoot":"","sources":["../../src/DowntimeBar/DowntimeBar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DowntimeBar.d.ts","sourceRoot":"","sources":["../../src/DowntimeBar/DowntimeBar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAI3D,UAAU,gBAAiB,SAAQ,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC;IAC/D,IAAI,EAAE,CAAC,OAAO,GAAG,SAAS,CAAC,EAAE,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,QAAA,MAAM,WAAW,4CAAsE,gBAAgB,4CA8BtG,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,13 +1,28 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
13
|
import { useEffect, useRef, useState } from 'react';
|
|
14
|
+
import { grey as gry, red as r, green as grn } from '@mui/material/colors';
|
|
3
15
|
/**
|
|
4
16
|
* DowntimeBar consumes a boolean array of uptimes
|
|
5
17
|
* @param data
|
|
18
|
+
* @param grey
|
|
6
19
|
* @param red
|
|
7
20
|
* @param green
|
|
21
|
+
* @param svgProps
|
|
8
22
|
* @constructor
|
|
9
23
|
*/
|
|
10
|
-
const DowntimeBar = (
|
|
24
|
+
const DowntimeBar = (_a) => {
|
|
25
|
+
var { data, red = r[500], green = grn[500], grey = gry[300] } = _a, svgProps = __rest(_a, ["data", "red", "green", "grey"]);
|
|
11
26
|
const containerRef = useRef(null);
|
|
12
27
|
const [width, setWidth] = useState(0);
|
|
13
28
|
const [height, setHeight] = useState(0);
|
|
@@ -17,7 +32,7 @@ const DowntimeBar = ({ data, red = "red", green = "green" }) => {
|
|
|
17
32
|
setHeight(containerRef.current.clientHeight);
|
|
18
33
|
}
|
|
19
34
|
}, [containerRef.current]);
|
|
20
|
-
return (_jsx("svg", { ref: containerRef, children: data.map((v, i) => (_jsx("rect", { x: i * width, y: 0, width: width, height: height, fill: v ?
|
|
35
|
+
return (_jsx("svg", Object.assign({ ref: containerRef }, svgProps, { children: data.map((v, i) => (_jsx("rect", { x: i * width, y: 0, width: width, height: height, fill: v == undefined ? grey : v ? green : red }, i))) })));
|
|
21
36
|
};
|
|
22
37
|
export default DowntimeBar;
|
|
23
38
|
//# sourceMappingURL=DowntimeBar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DowntimeBar.js","sourceRoot":"","sources":["../../src/DowntimeBar/DowntimeBar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DowntimeBar.js","sourceRoot":"","sources":["../../src/DowntimeBar/DowntimeBar.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EAAC,IAAI,IAAI,GAAG,EAAE,GAAG,IAAI,CAAC,EAAE,KAAK,IAAI,GAAG,EAAC,MAAM,sBAAsB,CAAC;AAUzE;;;;;;;;GAQG;AACH,MAAM,WAAW,GAAG,CAAC,EAAkF,EAAE,EAAE;QAAtF,EAAE,IAAI,EAAE,GAAG,GAAC,CAAC,CAAC,GAAG,CAAC,EAAE,KAAK,GAAC,GAAG,CAAC,GAAG,CAAC,EAAE,IAAI,GAAC,GAAG,CAAC,GAAG,CAAC,OAAiC,EAA5B,QAAQ,cAA9D,gCAAgE,CAAF;IAElF,MAAM,YAAY,GAAG,MAAM,CAAgB,IAAI,CAAC,CAAC;IACjD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACtC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAExC,SAAS,CACR,GAAG,EAAE;QACJ,IAAI,YAAY,CAAC,OAAO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