@seamapi/react 2.17.1 → 2.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 -2
- package/dist/elements.js +3805 -3735
- package/dist/elements.js.map +1 -1
- package/lib/seam/components/DeviceDetails/NoiseSensorDeviceDetails.js +2 -1
- package/lib/seam/components/DeviceDetails/NoiseSensorDeviceDetails.js.map +1 -1
- package/lib/ui/device/NoiseLevelStatus.d.ts +7 -0
- package/lib/ui/device/NoiseLevelStatus.js +32 -0
- package/lib/ui/device/NoiseLevelStatus.js.map +1 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
- package/src/lib/seam/components/DeviceDetails/NoiseSensorDeviceDetails.tsx +2 -0
- package/src/lib/ui/device/NoiseLevelStatus.tsx +58 -0
- package/src/lib/version.ts +1 -1
|
@@ -3,11 +3,12 @@ import classNames from 'classnames';
|
|
|
3
3
|
import { DeviceInfo } from '../../../../lib/seam/components/DeviceDetails/DeviceInfo.js';
|
|
4
4
|
import { DeviceModel } from '../../../../lib/seam/components/DeviceDetails/DeviceModel.js';
|
|
5
5
|
import { DeviceImage } from '../../../../lib/ui/device/DeviceImage.js';
|
|
6
|
+
import { NoiseLevelStatus } from '../../../../lib/ui/device/NoiseLevelStatus.js';
|
|
6
7
|
import { OnlineStatus } from '../../../../lib/ui/device/OnlineStatus.js';
|
|
7
8
|
import { ContentHeader } from '../../../../lib/ui/layout/ContentHeader.js';
|
|
8
9
|
import { NoiseThresholdsList } from '../../../../lib/ui/noise-sensor/NoiseThresholdsList.js';
|
|
9
10
|
export function NoiseSensorDeviceDetails({ device, disableConnectedAccountInformation, disableResourceIds, onBack, className, }) {
|
|
10
|
-
return (_jsxs("div", { className: classNames('seam-device-details', className), children: [_jsx(ContentHeader, { title: t.noiseSensor, onBack: onBack }), _jsxs("div", { className: 'seam-body', children: [_jsx("div", { className: 'seam-summary', children: _jsxs("div", { className: 'seam-content', children: [_jsx("div", { className: 'seam-image', children: _jsx(DeviceImage, { device: device }) }), _jsxs("div", { className: 'seam-info', children: [_jsx("span", { className: 'seam-label', children: t.noiseSensor }), _jsx("h4", { className: 'seam-device-name', children: device.properties.name }), _jsxs("div", { className: 'seam-properties', children: [_jsxs("span", { className: 'seam-label', children: [t.status, ":"] }), ' ', _jsx(OnlineStatus, { device: device }), _jsx(DeviceModel, { device: device })] })] })] }) }), _jsx(NoiseThresholdsList, { device: device }), _jsx(DeviceInfo, { device: device, disableConnectedAccountInformation: disableConnectedAccountInformation, disableResourceIds: disableResourceIds })] })] }));
|
|
11
|
+
return (_jsxs("div", { className: classNames('seam-device-details', className), children: [_jsx(ContentHeader, { title: t.noiseSensor, onBack: onBack }), _jsxs("div", { className: 'seam-body', children: [_jsx("div", { className: 'seam-summary', children: _jsxs("div", { className: 'seam-content', children: [_jsx("div", { className: 'seam-image', children: _jsx(DeviceImage, { device: device }) }), _jsxs("div", { className: 'seam-info', children: [_jsx("span", { className: 'seam-label', children: t.noiseSensor }), _jsx("h4", { className: 'seam-device-name', children: device.properties.name }), _jsxs("div", { className: 'seam-properties', children: [_jsxs("span", { className: 'seam-label', children: [t.status, ":"] }), ' ', _jsx(OnlineStatus, { device: device }), _jsx(NoiseLevelStatus, { device: device }), _jsx(DeviceModel, { device: device })] })] })] }) }), _jsx(NoiseThresholdsList, { device: device }), _jsx(DeviceInfo, { device: device, disableConnectedAccountInformation: disableConnectedAccountInformation, disableResourceIds: disableResourceIds })] })] }));
|
|
11
12
|
}
|
|
12
13
|
const t = {
|
|
13
14
|
noiseSensor: 'Noise Sensor',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoiseSensorDeviceDetails.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/DeviceDetails/NoiseSensorDeviceDetails.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AAInC,OAAO,EAAE,UAAU,EAAE,MAAM,iDAAiD,CAAA;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AE,kBAAkB,GACtC,IACE,IACF,CACP,CAAA;AACH,CAAC;AAED,MAAM,CAAC,GAAG;IACR,WAAW,EAAE,cAAc;IAC3B,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,aAAa;CAC1B,CAAA"}
|
|
1
|
+
{"version":3,"file":"NoiseSensorDeviceDetails.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/DeviceDetails/NoiseSensorDeviceDetails.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AAInC,OAAO,EAAE,UAAU,EAAE,MAAM,iDAAiD,CAAA;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAA;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAA;AAOhF,MAAM,UAAU,wBAAwB,CAAC,EACvC,MAAM,EACN,kCAAkC,EAClC,kBAAkB,EAClB,MAAM,EACN,SAAS,GACqB;IAC9B,OAAO,CACL,eAAK,SAAS,EAAE,UAAU,CAAC,qBAAqB,EAAE,SAAS,CAAC,aAC1D,KAAC,aAAa,IAAC,KAAK,EAAE,CAAC,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,GAAI,EAEvD,eAAK,SAAS,EAAC,WAAW,aACxB,cAAK,SAAS,EAAC,cAAc,YAC3B,eAAK,SAAS,EAAC,cAAc,aAC3B,cAAK,SAAS,EAAC,YAAY,YACzB,KAAC,WAAW,IAAC,MAAM,EAAE,MAAM,GAAI,GAC3B,EACN,eAAK,SAAS,EAAC,WAAW,aACxB,eAAM,SAAS,EAAC,YAAY,YAAE,CAAC,CAAC,WAAW,GAAQ,EACnD,aAAI,SAAS,EAAC,kBAAkB,YAAE,MAAM,CAAC,UAAU,CAAC,IAAI,GAAM,EAC9D,eAAK,SAAS,EAAC,iBAAiB,aAC9B,gBAAM,SAAS,EAAC,YAAY,aAAE,CAAC,CAAC,MAAM,SAAS,EAAC,GAAG,EACnD,KAAC,YAAY,IAAC,MAAM,EAAE,MAAM,GAAI,EAChC,KAAC,gBAAgB,IAAC,MAAM,EAAE,MAAM,GAAI,EACpC,KAAC,WAAW,IAAC,MAAM,EAAE,MAAM,GAAI,IAC3B,IACF,IACF,GACF,EAEN,KAAC,mBAAmB,IAAC,MAAM,EAAE,MAAM,GAAI,EAEvC,KAAC,UAAU,IACT,MAAM,EAAE,MAAM,EACd,kCAAkC,EAChC,kCAAkC,EAEpC,kBAAkB,EAAE,kBAAkB,GACtC,IACE,IACF,CACP,CAAA;AACH,CAAC;AAED,MAAM,CAAC,GAAG;IACR,WAAW,EAAE,cAAc;IAC3B,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,aAAa;CAC1B,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" resolution-mode="require"/>
|
|
2
|
+
import type { NoiseSensorDevice } from 'seamapi';
|
|
3
|
+
interface NoiseLevelStatusProps {
|
|
4
|
+
device: NoiseSensorDevice;
|
|
5
|
+
}
|
|
6
|
+
export declare function NoiseLevelStatus({ device, }: NoiseLevelStatusProps): JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { NoiseLevelsIcon } from '../../../lib/icons/NoiseLevels.js';
|
|
3
|
+
export function NoiseLevelStatus({ device, }) {
|
|
4
|
+
return (_jsxs(_Fragment, { children: [_jsxs("span", { className: 'seam-label', children: [t.noiseLevel, ":"] }), _jsxs("div", { className: 'seam-device-status', children: [_jsx(NoiseLevelsIcon, {}), _jsx("span", { className: 'seam-text', children: getNoiseLevel(device) })] })] }));
|
|
5
|
+
}
|
|
6
|
+
function toNoiseString(value) {
|
|
7
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
8
|
+
return `${Number(value).toFixed(0)} ${t.decibel}`;
|
|
9
|
+
}
|
|
10
|
+
return t.unknown;
|
|
11
|
+
}
|
|
12
|
+
function getNoiseLevel(device) {
|
|
13
|
+
const isMinut = device.device_type === 'minut_sensor';
|
|
14
|
+
const isNoiseAware = device.device_type === 'noiseaware_activity_zone';
|
|
15
|
+
if (isMinut) {
|
|
16
|
+
return toNoiseString(device?.properties?.minut_metadata?.latest_sensor_values?.sound?.value);
|
|
17
|
+
}
|
|
18
|
+
if (isNoiseAware) {
|
|
19
|
+
if (device?.properties?.noiseaware_metadata?.noise_level_nrs === -1) {
|
|
20
|
+
return t.noiseAwareDefault;
|
|
21
|
+
}
|
|
22
|
+
return toNoiseString(device?.properties?.noiseaware_metadata?.noise_level_decibel);
|
|
23
|
+
}
|
|
24
|
+
return toNoiseString(undefined);
|
|
25
|
+
}
|
|
26
|
+
const t = {
|
|
27
|
+
noiseLevel: 'Noise level',
|
|
28
|
+
unknown: 'Unknown',
|
|
29
|
+
decibel: 'dB',
|
|
30
|
+
noiseAwareDefault: '0-40 dB',
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=NoiseLevelStatus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NoiseLevelStatus.js","sourceRoot":"","sources":["../../../src/lib/ui/device/NoiseLevelStatus.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAM1D,MAAM,UAAU,gBAAgB,CAAC,EAC/B,MAAM,GACgB;IACtB,OAAO,CACL,8BACE,gBAAM,SAAS,EAAC,YAAY,aAAE,CAAC,CAAC,UAAU,SAAS,EAEnD,eAAK,SAAS,EAAC,oBAAoB,aACjC,KAAC,eAAe,KAAG,EACnB,eAAM,SAAS,EAAC,WAAW,Y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amapiReactVersion;
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seamapi/react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.18.0",
|
|
4
4
|
"description": "Seam Components.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"luxon": "^3.3.0",
|
|
133
133
|
"queue": "^7.0.0",
|
|
134
134
|
"react-hook-form": "^7.46.1",
|
|
135
|
-
"seamapi": "^8.22.
|
|
135
|
+
"seamapi": "^8.22.1",
|
|
136
136
|
"uuid": "^9.0.0",
|
|
137
137
|
"zoned-time": "^1.1.2"
|
|
138
138
|
},
|
|
@@ -5,6 +5,7 @@ import type { NestedSpecificDeviceDetailsProps } from 'lib/seam/components/Devic
|
|
|
5
5
|
import { DeviceInfo } from 'lib/seam/components/DeviceDetails/DeviceInfo.js'
|
|
6
6
|
import { DeviceModel } from 'lib/seam/components/DeviceDetails/DeviceModel.js'
|
|
7
7
|
import { DeviceImage } from 'lib/ui/device/DeviceImage.js'
|
|
8
|
+
import { NoiseLevelStatus } from 'lib/ui/device/NoiseLevelStatus.js'
|
|
8
9
|
import { OnlineStatus } from 'lib/ui/device/OnlineStatus.js'
|
|
9
10
|
import { ContentHeader } from 'lib/ui/layout/ContentHeader.js'
|
|
10
11
|
import { NoiseThresholdsList } from 'lib/ui/noise-sensor/NoiseThresholdsList.js'
|
|
@@ -37,6 +38,7 @@ export function NoiseSensorDeviceDetails({
|
|
|
37
38
|
<div className='seam-properties'>
|
|
38
39
|
<span className='seam-label'>{t.status}:</span>{' '}
|
|
39
40
|
<OnlineStatus device={device} />
|
|
41
|
+
<NoiseLevelStatus device={device} />
|
|
40
42
|
<DeviceModel device={device} />
|
|
41
43
|
</div>
|
|
42
44
|
</div>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { NoiseSensorDevice } from 'seamapi'
|
|
2
|
+
|
|
3
|
+
import { NoiseLevelsIcon } from 'lib/icons/NoiseLevels.js'
|
|
4
|
+
|
|
5
|
+
interface NoiseLevelStatusProps {
|
|
6
|
+
device: NoiseSensorDevice
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function NoiseLevelStatus({
|
|
10
|
+
device,
|
|
11
|
+
}: NoiseLevelStatusProps): JSX.Element {
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<span className='seam-label'>{t.noiseLevel}:</span>
|
|
15
|
+
|
|
16
|
+
<div className='seam-device-status'>
|
|
17
|
+
<NoiseLevelsIcon />
|
|
18
|
+
<span className='seam-text'>{getNoiseLevel(device)}</span>
|
|
19
|
+
</div>
|
|
20
|
+
</>
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function toNoiseString(value: number | string | undefined): string {
|
|
25
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
26
|
+
return `${Number(value).toFixed(0)} ${t.decibel}`
|
|
27
|
+
}
|
|
28
|
+
return t.unknown
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function getNoiseLevel(device: NoiseSensorDevice): string {
|
|
32
|
+
const isMinut = device.device_type === 'minut_sensor'
|
|
33
|
+
const isNoiseAware = device.device_type === 'noiseaware_activity_zone'
|
|
34
|
+
|
|
35
|
+
if (isMinut) {
|
|
36
|
+
return toNoiseString(
|
|
37
|
+
device?.properties?.minut_metadata?.latest_sensor_values?.sound?.value
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (isNoiseAware) {
|
|
42
|
+
if (device?.properties?.noiseaware_metadata?.noise_level_nrs === -1) {
|
|
43
|
+
return t.noiseAwareDefault
|
|
44
|
+
}
|
|
45
|
+
return toNoiseString(
|
|
46
|
+
device?.properties?.noiseaware_metadata?.noise_level_decibel
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return toNoiseString(undefined)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const t = {
|
|
54
|
+
noiseLevel: 'Noise level',
|
|
55
|
+
unknown: 'Unknown',
|
|
56
|
+
decibel: 'dB',
|
|
57
|
+
noiseAwareDefault: '0-40 dB',
|
|
58
|
+
}
|
package/src/lib/version.ts
CHANGED