@chtc/web-components 0.0.0-24 → 0.0.0-26
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,17 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface DowntimeBarProps extends React.SVGProps<SVGSVGElement> {
|
|
2
3
|
data: boolean[];
|
|
3
|
-
red
|
|
4
|
-
green
|
|
4
|
+
red?: string;
|
|
5
|
+
green?: string;
|
|
5
6
|
}
|
|
6
7
|
/**
|
|
7
8
|
* DowntimeBar consumes a boolean array of uptimes
|
|
8
9
|
* @param data
|
|
9
10
|
* @param red
|
|
10
11
|
* @param green
|
|
12
|
+
* @param svgProps
|
|
11
13
|
* @constructor
|
|
12
14
|
*/
|
|
13
|
-
declare const DowntimeBar: ({ data, red, green }: DowntimeBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
declare const DowntimeBar: ({ data, red, green, ...svgProps }: DowntimeBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
16
|
export default DowntimeBar;
|
|
15
17
|
//# 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;AAG3D,UAAU,gBAAiB,SAAQ,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC;IAC/D,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;GAOG;AACH,QAAA,MAAM,WAAW,sCAAqD,gBAAgB,4CA8BrF,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,3 +1,14 @@
|
|
|
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';
|
|
3
14
|
/**
|
|
@@ -5,9 +16,11 @@ import { useEffect, useRef, useState } from 'react';
|
|
|
5
16
|
* @param data
|
|
6
17
|
* @param red
|
|
7
18
|
* @param green
|
|
19
|
+
* @param svgProps
|
|
8
20
|
* @constructor
|
|
9
21
|
*/
|
|
10
|
-
const DowntimeBar = (
|
|
22
|
+
const DowntimeBar = (_a) => {
|
|
23
|
+
var { data, red = "red", green = "green" } = _a, svgProps = __rest(_a, ["data", "red", "green"]);
|
|
11
24
|
const containerRef = useRef(null);
|
|
12
25
|
const [width, setWidth] = useState(0);
|
|
13
26
|
const [height, setHeight] = useState(0);
|
|
@@ -17,7 +30,7 @@ const DowntimeBar = ({ data, red = "red", green = "green" }) => {
|
|
|
17
30
|
setHeight(containerRef.current.clientHeight);
|
|
18
31
|
}
|
|
19
32
|
}, [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 ? red : green }, i))) }));
|
|
33
|
+
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 ? red : green }, i))) })));
|
|
21
34
|
};
|
|
22
35
|
export default DowntimeBar;
|
|
23
36
|
//# 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;AAS3D;;;;;;;GAOG;AACH,MAAM,WAAW,GAAG,CAAC,EAAiE,EAAE,EAAE;QAArE,EAAE,IAAI,EAAE,GAAG,GAAC,KAAK,EAAE,KAAK,GAAC,OAAO,OAAiC,EAA5B,QAAQ,cAA7C,wBAA+C,CAAF;IAEjE,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,EAAE,CAAC;YAC1B,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;YACzD,SAAS,CAAC,YAAY,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QAC9C,CAAC;IACF,CAAC,EACD,CAAC,YAAY,CAAC,OAAO,CAAC,CACtB,CAAA;IAED,OAAO,CACL,4BAAK,GAAG,EAAE,YAAY,IAAM,QAAQ,cAClC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAClB,eAEE,CAAC,EAAE,CAAC,GAAG,KAAK,EACZ,CAAC,EAAE,CAAC,EACJ,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,IALhB,CAAC,CAMN,CACH,CAAC,IACG,CACP,CAAC;AACH,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|