@seamapi/react 1.37.0 → 1.38.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.
- package/README.md +1 -1
- package/dist/elements.js +14 -8
- package/dist/elements.js.map +1 -1
- package/lib/ui/device/BatteryStatus.js +7 -6
- package/lib/ui/device/BatteryStatus.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/lib/ui/device/BatteryStatus.tsx +20 -6
- package/src/lib/version.ts +1 -1
|
@@ -4,21 +4,22 @@ import { BatteryLevelFullIcon } from '../../../lib/icons/BatteryLevelFull.js';
|
|
|
4
4
|
import { BatteryLevelHighIcon } from '../../../lib/icons/BatteryLevelHigh.js';
|
|
5
5
|
import { BatteryLevelLowIcon } from '../../../lib/icons/BatteryLevelLow.js';
|
|
6
6
|
export function BatteryStatus(props) {
|
|
7
|
-
return (_jsx("div", { className: 'seam-battery-status', children: _jsx(Content, { status: props.device.properties.battery?.status }) }));
|
|
7
|
+
return (_jsx("div", { className: 'seam-battery-status', children: _jsx(Content, { status: props.device.properties.battery?.status, level: props.device.properties.battery?.level }) }));
|
|
8
8
|
}
|
|
9
9
|
function Content(props) {
|
|
10
|
-
const { status } = props;
|
|
10
|
+
const { status, level } = props;
|
|
11
|
+
const percentage = level != null ? ` (${Math.floor(level * 100)}%)` : null;
|
|
11
12
|
if (status === 'full') {
|
|
12
|
-
return (_jsxs(_Fragment, { children: [_jsx(BatteryLevelFullIcon, {}), _jsx("span", { className: 'seam-status-text', children: t.full })] }));
|
|
13
|
+
return (_jsxs(_Fragment, { children: [_jsx(BatteryLevelFullIcon, {}), _jsx("span", { className: 'seam-status-text', children: `${t.full}${percentage ?? ''}` })] }));
|
|
13
14
|
}
|
|
14
15
|
if (status === 'good') {
|
|
15
|
-
return (_jsxs(_Fragment, { children: [_jsx(BatteryLevelHighIcon, {}), _jsx("span", { className: 'seam-status-text', children: t.high })] }));
|
|
16
|
+
return (_jsxs(_Fragment, { children: [_jsx(BatteryLevelHighIcon, {}), _jsx("span", { className: 'seam-status-text', children: `${t.high}${percentage ?? ''}` })] }));
|
|
16
17
|
}
|
|
17
18
|
if (status === 'low') {
|
|
18
|
-
return (_jsxs(_Fragment, { children: [_jsx(BatteryLevelLowIcon, {}), _jsx("span", { className: 'seam-status-text', children: t.low })] }));
|
|
19
|
+
return (_jsxs(_Fragment, { children: [_jsx(BatteryLevelLowIcon, {}), _jsx("span", { className: 'seam-status-text', children: `${t.low}${percentage ?? ''}` })] }));
|
|
19
20
|
}
|
|
20
21
|
if (status === 'critical') {
|
|
21
|
-
return (_jsxs(_Fragment, { children: [_jsx(BatteryLevelCriticalIcon, {}), _jsx("span", { className: 'seam-text-danger', children: t.critical })] }));
|
|
22
|
+
return (_jsxs(_Fragment, { children: [_jsx(BatteryLevelCriticalIcon, {}), _jsx("span", { className: 'seam-text-danger', children: `${t.critical}${percentage ?? ''}` })] }));
|
|
22
23
|
}
|
|
23
24
|
return null;
|
|
24
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BatteryStatus.js","sourceRoot":"","sources":["../../../src/lib/ui/device/BatteryStatus.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAA;AAC5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAA;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAMlE,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,OAAO,CACL,cAAK,SAAS,EAAC,qBAAqB,YAClC,KAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"BatteryStatus.js","sourceRoot":"","sources":["../../../src/lib/ui/device/BatteryStatus.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mCAAmC,CAAA;AAC5E,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AI,EAChB,EAAE,GAAQ,IACT,CACJ,CAAA;KACF;IAED,IAAI,MAAM,KAAK,UAAU,EAAE;QACzB,OAAO,CACL,8BACE,KAAC,wBAAwB,KAAG,EAC5B,eAAM,SAAS,EAAC,kBAAkB,YAAE,GAAG,CAAC,CAAC,QAAQ,GAC/C,UAAU,IAAI,EAChB,EAAE,GAAQ,IACT,CACJ,CAAA;KACF;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAED,MAAM,CAAC,GAAG;IACR,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,QAAQ,EAAE,MAAM;CACjB,CAAA"}
|
package/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const seamapiReactVersion = "1.
|
|
1
|
+
declare const seamapiReactVersion = "1.38.0";
|
|
2
2
|
export default seamapiReactVersion;
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -12,21 +12,29 @@ interface BatteryStatusProps {
|
|
|
12
12
|
export function BatteryStatus(props: BatteryStatusProps): JSX.Element {
|
|
13
13
|
return (
|
|
14
14
|
<div className='seam-battery-status'>
|
|
15
|
-
<Content
|
|
15
|
+
<Content
|
|
16
|
+
status={props.device.properties.battery?.status}
|
|
17
|
+
level={props.device.properties.battery?.level}
|
|
18
|
+
/>
|
|
16
19
|
</div>
|
|
17
20
|
)
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
function Content(props: {
|
|
21
24
|
status: SeamBatteryStatus | null | undefined
|
|
25
|
+
level: number | null | undefined
|
|
22
26
|
}): JSX.Element | null {
|
|
23
|
-
const { status } = props
|
|
27
|
+
const { status, level } = props
|
|
28
|
+
|
|
29
|
+
const percentage = level != null ? ` (${Math.floor(level * 100)}%)` : null
|
|
24
30
|
|
|
25
31
|
if (status === 'full') {
|
|
26
32
|
return (
|
|
27
33
|
<>
|
|
28
34
|
<BatteryLevelFullIcon />
|
|
29
|
-
<span className='seam-status-text'>{t.full}
|
|
35
|
+
<span className='seam-status-text'>{`${t.full}${
|
|
36
|
+
percentage ?? ''
|
|
37
|
+
}`}</span>
|
|
30
38
|
</>
|
|
31
39
|
)
|
|
32
40
|
}
|
|
@@ -35,7 +43,9 @@ function Content(props: {
|
|
|
35
43
|
return (
|
|
36
44
|
<>
|
|
37
45
|
<BatteryLevelHighIcon />
|
|
38
|
-
<span className='seam-status-text'>{t.high}
|
|
46
|
+
<span className='seam-status-text'>{`${t.high}${
|
|
47
|
+
percentage ?? ''
|
|
48
|
+
}`}</span>
|
|
39
49
|
</>
|
|
40
50
|
)
|
|
41
51
|
}
|
|
@@ -44,7 +54,9 @@ function Content(props: {
|
|
|
44
54
|
return (
|
|
45
55
|
<>
|
|
46
56
|
<BatteryLevelLowIcon />
|
|
47
|
-
<span className='seam-status-text'>{t.low}
|
|
57
|
+
<span className='seam-status-text'>{`${t.low}${
|
|
58
|
+
percentage ?? ''
|
|
59
|
+
}`}</span>
|
|
48
60
|
</>
|
|
49
61
|
)
|
|
50
62
|
}
|
|
@@ -53,7 +65,9 @@ function Content(props: {
|
|
|
53
65
|
return (
|
|
54
66
|
<>
|
|
55
67
|
<BatteryLevelCriticalIcon />
|
|
56
|
-
<span className='seam-text-danger'>{t.critical}
|
|
68
|
+
<span className='seam-text-danger'>{`${t.critical}${
|
|
69
|
+
percentage ?? ''
|
|
70
|
+
}`}</span>
|
|
57
71
|
</>
|
|
58
72
|
)
|
|
59
73
|
}
|
package/src/lib/version.ts
CHANGED