@seamapi/react 1.17.0 → 1.18.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 +2 -4
- package/dist/elements.js +3220 -3200
- package/dist/elements.js.map +1 -1
- package/lib/seam/components/AccessCodeDetails/AccessCodeDevice.js +11 -7
- package/lib/seam/components/AccessCodeDetails/AccessCodeDevice.js.map +1 -1
- package/lib/seam/components/AccessCodeTable/AccessCodeTable.js +2 -2
- package/lib/seam/components/AccessCodeTable/AccessCodeTable.js.map +1 -1
- package/lib/seam/components/DeviceDetails/DeviceDetails.js +6 -69
- package/lib/seam/components/DeviceDetails/DeviceDetails.js.map +1 -1
- package/lib/seam/components/DeviceDetails/DeviceModel.d.ts +2 -3
- package/lib/seam/components/DeviceDetails/DeviceModel.js +1 -11
- package/lib/seam/components/DeviceDetails/DeviceModel.js.map +1 -1
- package/lib/seam/components/DeviceDetails/LockDeviceDetails.d.ts +7 -0
- package/lib/seam/components/DeviceDetails/LockDeviceDetails.js +68 -0
- package/lib/seam/components/DeviceDetails/LockDeviceDetails.js.map +1 -0
- package/lib/seam/components/DeviceTable/DeviceRow.js +1 -12
- package/lib/seam/components/DeviceTable/DeviceRow.js.map +1 -1
- package/lib/seam/components/DeviceTable/DeviceTable.js +4 -3
- package/lib/seam/components/DeviceTable/DeviceTable.js.map +1 -1
- package/lib/seam/devices/use-device.d.ts +2 -2
- package/lib/seam/devices/use-device.js.map +1 -1
- package/lib/seam/devices/use-devices.d.ts +2 -2
- package/lib/seam/devices/use-devices.js.map +1 -1
- package/lib/seam/devices/use-toggle-lock.d.ts +1 -1
- package/lib/seam/devices/use-toggle-lock.js +1 -1
- package/lib/seam/devices/use-toggle-lock.js.map +1 -1
- package/lib/ui/device/BatteryStatus.d.ts +2 -2
- package/lib/ui/device/BatteryStatus.js +9 -15
- package/lib/ui/device/BatteryStatus.js.map +1 -1
- package/lib/ui/device/DeviceImage.d.ts +2 -2
- package/lib/ui/device/DeviceImage.js.map +1 -1
- package/lib/ui/device/LockStatus.d.ts +3 -3
- package/lib/ui/device/LockStatus.js +4 -0
- package/lib/ui/device/LockStatus.js.map +1 -1
- package/lib/ui/device/OnlineStatus.d.ts +2 -2
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +3 -3
- package/src/lib/seam/components/AccessCodeDetails/AccessCodeDevice.tsx +13 -8
- package/src/lib/seam/components/AccessCodeTable/AccessCodeTable.tsx +2 -2
- package/src/lib/seam/components/DeviceDetails/DeviceDetails.tsx +7 -153
- package/src/lib/seam/components/DeviceDetails/DeviceModel.tsx +5 -19
- package/src/lib/seam/components/DeviceDetails/LockDeviceDetails.tsx +158 -0
- package/src/lib/seam/components/DeviceTable/DeviceRow.tsx +3 -15
- package/src/lib/seam/components/DeviceTable/DeviceTable.tsx +4 -3
- package/src/lib/seam/devices/use-device.ts +2 -3
- package/src/lib/seam/devices/use-devices.ts +2 -3
- package/src/lib/seam/devices/use-toggle-lock.ts +7 -8
- package/src/lib/ui/device/BatteryStatus.tsx +19 -29
- package/src/lib/ui/device/DeviceImage.tsx +4 -2
- package/src/lib/ui/device/LockStatus.tsx +7 -3
- package/src/lib/ui/device/OnlineStatus.tsx +2 -2
- package/src/lib/version.ts +1 -1
- package/lib/seam/devices/types.d.ts +0 -2
- package/lib/seam/devices/types.js +0 -2
- package/lib/seam/devices/types.js.map +0 -1
- package/src/lib/seam/devices/types.ts +0 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BatteryStatus as SeamBatteryStatus, CommonDevice } from 'seamapi'
|
|
2
2
|
|
|
3
3
|
import { BatteryLevelCriticalIcon } from 'lib/icons/BatteryLevelCritical.js'
|
|
4
4
|
import { BatteryLevelFullIcon } from 'lib/icons/BatteryLevelFull.js'
|
|
@@ -6,31 +6,23 @@ import { BatteryLevelHighIcon } from 'lib/icons/BatteryLevelHigh.js'
|
|
|
6
6
|
import { BatteryLevelLowIcon } from 'lib/icons/BatteryLevelLow.js'
|
|
7
7
|
|
|
8
8
|
interface BatteryStatusProps {
|
|
9
|
-
device:
|
|
9
|
+
device: CommonDevice
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export function BatteryStatus(props: BatteryStatusProps): JSX.Element {
|
|
13
|
-
const {
|
|
14
|
-
device: {
|
|
15
|
-
properties: { battery_level: batteryLevel },
|
|
16
|
-
},
|
|
17
|
-
} = props
|
|
18
|
-
|
|
19
13
|
return (
|
|
20
14
|
<div className='seam-battery-status'>
|
|
21
|
-
<Content
|
|
15
|
+
<Content status={props.device.properties.battery?.status} />
|
|
22
16
|
</div>
|
|
23
17
|
)
|
|
24
18
|
}
|
|
25
19
|
|
|
26
|
-
function Content(props: {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return null
|
|
31
|
-
}
|
|
20
|
+
function Content(props: {
|
|
21
|
+
status: SeamBatteryStatus | null | undefined
|
|
22
|
+
}): JSX.Element | null {
|
|
23
|
+
const { status } = props
|
|
32
24
|
|
|
33
|
-
if (
|
|
25
|
+
if (status === 'full') {
|
|
34
26
|
return (
|
|
35
27
|
<>
|
|
36
28
|
<BatteryLevelFullIcon />
|
|
@@ -39,7 +31,7 @@ function Content(props: { batteryLevel?: number }): JSX.Element | null {
|
|
|
39
31
|
)
|
|
40
32
|
}
|
|
41
33
|
|
|
42
|
-
if (
|
|
34
|
+
if (status === 'good') {
|
|
43
35
|
return (
|
|
44
36
|
<>
|
|
45
37
|
<BatteryLevelHighIcon />
|
|
@@ -48,7 +40,7 @@ function Content(props: { batteryLevel?: number }): JSX.Element | null {
|
|
|
48
40
|
)
|
|
49
41
|
}
|
|
50
42
|
|
|
51
|
-
if (
|
|
43
|
+
if (status === 'low') {
|
|
52
44
|
return (
|
|
53
45
|
<>
|
|
54
46
|
<BatteryLevelLowIcon />
|
|
@@ -57,18 +49,16 @@ function Content(props: { batteryLevel?: number }): JSX.Element | null {
|
|
|
57
49
|
)
|
|
58
50
|
}
|
|
59
51
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
52
|
+
if (status === 'critical') {
|
|
53
|
+
return (
|
|
54
|
+
<>
|
|
55
|
+
<BatteryLevelCriticalIcon />
|
|
56
|
+
<span className='seam-text-danger'>{t.critical}</span>
|
|
57
|
+
</>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
full: 0.85,
|
|
70
|
-
high: 0.6,
|
|
71
|
-
low: 0.3,
|
|
61
|
+
return null
|
|
72
62
|
}
|
|
73
63
|
|
|
74
64
|
const t = {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'react'
|
|
2
|
-
import type {
|
|
2
|
+
import type { CommonDevice } from 'seamapi'
|
|
3
3
|
|
|
4
4
|
export function DeviceImage(
|
|
5
|
-
props: {
|
|
5
|
+
props: {
|
|
6
|
+
device: CommonDevice
|
|
7
|
+
} & HTMLAttributes<HTMLImageElement>
|
|
6
8
|
): JSX.Element {
|
|
7
9
|
const { device, ...imageProps } = props
|
|
8
10
|
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type CommonDevice, isLockDevice } from 'seamapi'
|
|
2
2
|
|
|
3
3
|
import { LockLockedIcon } from 'lib/icons/LockLocked.js'
|
|
4
4
|
import { LockUnlockedIcon } from 'lib/icons/LockUnlocked.js'
|
|
5
5
|
|
|
6
6
|
interface LockStatusProps {
|
|
7
|
-
device:
|
|
7
|
+
device: CommonDevice
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
export function LockStatus(props: LockStatusProps): JSX.Element {
|
|
10
|
+
export function LockStatus(props: LockStatusProps): JSX.Element | null {
|
|
11
|
+
if (!isLockDevice(props.device)) {
|
|
12
|
+
return null
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
const {
|
|
12
16
|
device: {
|
|
13
17
|
properties: { locked },
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CommonDevice } from 'seamapi'
|
|
2
2
|
|
|
3
3
|
import { OnlineStatusDeviceOfflineIcon } from 'lib/icons/OnlineStatusDeviceOffline.js'
|
|
4
4
|
import { OnlineStatusOnlineIcon } from 'lib/icons/OnlineStatusOnline.js'
|
|
5
5
|
|
|
6
6
|
interface OnlineStatusProps {
|
|
7
|
-
device:
|
|
7
|
+
device: CommonDevice
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export function OnlineStatus(props: OnlineStatusProps): JSX.Element {
|
package/src/lib/version.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/seam/devices/types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,MAA2D,EACrC,EAAE,CAAC,QAAQ,IAAI,MAAM,CAAC,UAAU,CAAA"}
|