@seamapi/react 1.24.0 → 1.25.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/dist/elements.js +3985 -3819
- package/dist/elements.js.map +1 -1
- package/dist/index.css +157 -45
- package/dist/index.css.map +1 -1
- package/dist/index.min.css +1 -1
- package/dist/index.min.css.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/HiddenDevicesOverlay.d.ts +5 -0
- package/lib/seam/components/SupportedDeviceTable/HiddenDevicesOverlay.js +8 -0
- package/lib/seam/components/SupportedDeviceTable/HiddenDevicesOverlay.js.map +1 -0
- package/lib/seam/components/SupportedDeviceTable/ShowAllDevicesButton.d.ts +8 -0
- package/lib/seam/components/SupportedDeviceTable/ShowAllDevicesButton.js +14 -0
- package/lib/seam/components/SupportedDeviceTable/ShowAllDevicesButton.js.map +1 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceBrandSection.d.ts +7 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceBrandSection.js +45 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceBrandSection.js.map +1 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.d.ts +2 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.js +36 -11
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.d.ts +7 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.js +12 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.js.map +1 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.d.ts +2 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.js +12 -4
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterResultRowProps.d.ts +7 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterResultRowProps.js +12 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterResultRowProps.js.map +1 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.d.ts +4 -0
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.js +19 -5
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.d.ts +2 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.js +3 -3
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/use-device-provider.d.ts +2 -0
- package/lib/seam/components/SupportedDeviceTable/use-device-provider.js +15 -0
- package/lib/seam/components/SupportedDeviceTable/use-device-provider.js.map +1 -0
- package/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.d.ts +5 -1
- package/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.js +9 -2
- package/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.js.map +1 -1
- package/lib/seam/devices/use-device-providers.d.ts +5 -0
- package/lib/seam/devices/use-device-providers.js +17 -0
- package/lib/seam/devices/use-device-providers.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/SupportedDeviceTable/HiddenDevicesOverlay.tsx +11 -0
- package/src/lib/seam/components/SupportedDeviceTable/ShowAllDevicesButton.tsx +32 -0
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceBrandSection.tsx +96 -0
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.tsx +62 -16
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.tsx +27 -0
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.tsx +22 -3
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterResultRowProps.tsx +49 -0
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.tsx +52 -20
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.element.ts +1 -0
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.tsx +4 -0
- package/src/lib/seam/components/SupportedDeviceTable/use-device-provider.ts +22 -0
- package/src/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.ts +21 -4
- package/src/lib/seam/devices/use-device-providers.ts +25 -0
- package/src/lib/version.ts +1 -1
- package/src/styles/_access-code-details.scss +1 -1
- package/src/styles/_buttons.scss +3 -3
- package/src/styles/_colors.scss +6 -2
- package/src/styles/_menus.scss +1 -1
- package/src/styles/_supported-device-table.scss +192 -52
- package/src/styles/_tables.scss +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceHeader.d.ts +0 -2
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceHeader.js +0 -12
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceHeader.js.map +0 -1
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceHeader.tsx +0 -22
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { UseDeviceModelsData } from '../../../../lib/seam/device-models/use-device-models.js';
|
|
3
|
+
interface SupportedDeviceContentRowsProps {
|
|
4
|
+
deviceModels: UseDeviceModelsData;
|
|
5
|
+
}
|
|
6
|
+
export declare function SupportedDeviceContentRows({ deviceModels, }: SupportedDeviceContentRowsProps): JSX.Element | null;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { SupportedDeviceRow } from '../../../../lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.js';
|
|
3
|
+
export function SupportedDeviceContentRows({ deviceModels, }) {
|
|
4
|
+
return (_jsx("div", { className: 'seam-supported-device-table-content', children: deviceModels.map((deviceModel, index) => (_jsx(SupportedDeviceRow, { deviceModel: deviceModel }, [
|
|
5
|
+
deviceModel.main_category,
|
|
6
|
+
deviceModel.brand,
|
|
7
|
+
deviceModel.model_name,
|
|
8
|
+
deviceModel.manufacturer_model_id,
|
|
9
|
+
index,
|
|
10
|
+
].join(':')))) }));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=SupportedDeviceContentRows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SupportedDeviceContentRows.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceContentRows.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gEAAgE,CAAA;AAOnG,MAAM,UAAU,0BAA0B,CAAC,EACzC,YAAY,GACoB;IAChC,OAAO,CACL,cAAK,SAAS,EAAC,qCAAqC,YACjD,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE,CAAC,CACxC,KAAC,kBAAkB,IAQjB,WAAW,EAAE,WAAW,IAPnB;YACH,WAAW,CAAC,aAAa;YACzB,WAAW,CAAC,KAAK;YACjB,WAAW,CAAC,UAAU;YACtB,WAAW,CAAC,qBAAqB;YACjC,KAAK;SACN,CAAC,IAAI,CAAC,GAAG,CAAC,CAEX,CACH,CAAC,GACE,CACP,CAAA;AACH,CAAC"}
|
|
@@ -5,5 +5,6 @@ export interface SupportedDeviceFilterAreaProps {
|
|
|
5
5
|
setFilterValue: (filter: string) => void;
|
|
6
6
|
filters: DeviceModelFilters;
|
|
7
7
|
setFilters: Dispatch<SetStateAction<DeviceModelFilters>>;
|
|
8
|
+
brands: string[];
|
|
8
9
|
}
|
|
9
|
-
export declare function SupportedDeviceFilterArea({ filterValue, setFilterValue, filters, setFilters, }: SupportedDeviceFilterAreaProps): JSX.Element;
|
|
10
|
+
export declare function SupportedDeviceFilterArea({ filterValue, setFilterValue, filters, setFilters, brands, }: SupportedDeviceFilterAreaProps): JSX.Element;
|
|
@@ -5,10 +5,10 @@ import { capitalize } from '../../../../lib/strings.js';
|
|
|
5
5
|
import { Button } from '../../../../lib/ui/Button.js';
|
|
6
6
|
import { Menu } from '../../../../lib/ui/Menu/Menu.js';
|
|
7
7
|
import { SearchTextField } from '../../../../lib/ui/TextField/SearchTextField.js';
|
|
8
|
-
export function SupportedDeviceFilterArea({ filterValue, setFilterValue, filters, setFilters, }) {
|
|
8
|
+
export function SupportedDeviceFilterArea({ filterValue, setFilterValue, filters, setFilters, brands, }) {
|
|
9
9
|
const appliedFiltersCount = Object.values(filters).filter((v) => v != null && v !== false).length;
|
|
10
10
|
const filterProperty = 'brand';
|
|
11
|
-
const availableProperties = useAvailableProperties(filterProperty);
|
|
11
|
+
const availableProperties = useAvailableProperties(filterProperty, { brands });
|
|
12
12
|
const resetFilter = (filterType) => {
|
|
13
13
|
setFilters((filters) => ({
|
|
14
14
|
...filters,
|
|
@@ -35,13 +35,21 @@ export function SupportedDeviceFilterArea({ filterValue, setFilterValue, filters
|
|
|
35
35
|
setFilterValue(value);
|
|
36
36
|
}, className: 'seam-supported-device-table-filter-area-search-bar' }) })] })] }));
|
|
37
37
|
}
|
|
38
|
-
const useAvailableProperties = (property) => {
|
|
38
|
+
const useAvailableProperties = (property, options) => {
|
|
39
39
|
const { deviceModels } = useDeviceModels();
|
|
40
40
|
if (deviceModels == null)
|
|
41
41
|
return [];
|
|
42
42
|
const properties = new Set();
|
|
43
43
|
for (const deviceModel of deviceModels) {
|
|
44
|
-
|
|
44
|
+
const value = deviceModel[property];
|
|
45
|
+
// If we're only looking at a subset of brands, such as ["yale", "august"], then we
|
|
46
|
+
// don't want to show other brands in the filter.
|
|
47
|
+
if (property === 'brand' &&
|
|
48
|
+
options.brands.length > 0 &&
|
|
49
|
+
!options.brands.includes(value)) {
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
properties.add(capitalize(value));
|
|
45
53
|
}
|
|
46
54
|
return Array.from(properties);
|
|
47
55
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupportedDeviceFilterArea.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gEAAgE,CAAA;AAEnG,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAA;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;
|
|
1
|
+
{"version":3,"file":"SupportedDeviceFilterArea.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gEAAgE,CAAA;AAEnG,OAAO,EAAE,eAAe,EAAE,MAAM,6CAA6C,CAAA;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAUrE,MAAM,UAAU,yBAAyB,CAAC,EACxC,WAAW,EACX,cAAc,EACd,OAAO,EACP,UAAU,EACV,MAAM,GACyB;IAC/B,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CACvD,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,CAChC,CAAC,MAAM,CAAA;IAER,MAAM,cAAc,GAAG,OAAO,CAAA;IAC9B,MAAM,mBAAmB,GAAG,sB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,MAAM,CAAC,MAAM,GAAG,CAAC;YACzB,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAC/B;YACA,SAAQ;SACT;QAED,UAAU,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAA;KAClC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;AAC/B,CAAC,CAAA;AAED,MAAM,CAAC,GAAG;IACR,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;CACnB,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { DeviceModel } from 'seamapi';
|
|
3
|
+
export interface SupportedDeviceFilterResultRowProps {
|
|
4
|
+
deviceModel: DeviceModel;
|
|
5
|
+
}
|
|
6
|
+
export declare function SupportedDeviceFilterResultRow({ deviceModel, }: SupportedDeviceFilterResultRowProps): JSX.Element;
|
|
7
|
+
export declare function ModelColumn({ deviceModel, }: SupportedDeviceFilterResultRowProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { connectionTypeNames, ImageColumn, StatusColumn, } from '../../../../lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.js';
|
|
3
|
+
import { useDeviceProvider } from '../../../../lib/seam/components/SupportedDeviceTable/use-device-provider.js';
|
|
4
|
+
import { DotDivider } from '../../../../lib/ui/layout/DotDivider.js';
|
|
5
|
+
export function SupportedDeviceFilterResultRow({ deviceModel, }) {
|
|
6
|
+
return (_jsxs("div", { className: 'seam-row filter-result-row', children: [_jsx(ImageColumn, { deviceModel: deviceModel }), _jsx(ModelColumn, { deviceModel: deviceModel }), _jsx(StatusColumn, { deviceModel: deviceModel })] }));
|
|
7
|
+
}
|
|
8
|
+
export function ModelColumn({ deviceModel, }) {
|
|
9
|
+
const deviceProvider = useDeviceProvider(deviceModel.brand);
|
|
10
|
+
return (_jsxs("div", { className: 'seam-col seam-model-col', children: [_jsxs("div", { className: 'seam-model-name', children: [_jsx("img", { src: deviceProvider.image_url, alt: deviceModel.brand, className: 'seam-brand-image' }), ' ', deviceModel.model_name] }), _jsxs("div", { className: 'seam-model-id', children: [deviceModel.manufacturer_model_id, _jsx(DotDivider, {}), connectionTypeNames[deviceModel.connection_type]] })] }));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=SupportedDeviceFilterResultRowProps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SupportedDeviceFilterResultRowProps.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterResultRowProps.tsx"],"names":[],"mappings":";AAEA,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,YAAY,GACb,MAAM,gEAAgE,CAAA;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iEAAiE,CAAA;AACnG,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAMxD,MAAM,UAAU,8BAA8B,CAAC,EAC7C,WAAW,GACyB;IACpC,OAAO,CACL,eAAK,SAAS,EAAC,4BAA4B,aACzC,KAAC,WAAW,IAAC,WAAW,EAAE,WAAW,GAAI,EACzC,KAAC,WAAW,IAAC,WAAW,EAAE,WAAW,GAAI,EACzC,KAAC,YAAY,IAAC,WAAW,EAAE,WAAW,GAAI,IACtC,CACP,CAAA;AACH,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,EAC1B,WAAW,GACyB;IACpC,MAAM,cAAc,GAAG,iBAAiB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;IAE3D,OAAO,CACL,eAAK,SAAS,EAAC,yBAAyB,aACtC,eAAK,SAAS,EAAC,iBAAiB,aAC9B,cACE,GAAG,EAAE,cAAc,CAAC,SAAS,EAC7B,GAAG,EAAE,WAAW,CAAC,KAAK,EACtB,SAAS,EAAC,kBAAkB,GAC5B,EAAC,GAAG,EACL,WAAW,CAAC,UAAU,IACnB,EACN,eAAK,SAAS,EAAC,eAAe,aAC3B,WAAW,CAAC,qBAAqB,EAClC,KAAC,UAAU,KAAG,EACb,mBAAmB,CAAC,WAAW,CAAC,eAAe,CAAC,IAC7C,IACF,CACP,CAAA;AACH,CAAC"}
|
|
@@ -4,3 +4,7 @@ export interface SupportedDeviceRowProps {
|
|
|
4
4
|
deviceModel: DeviceModel;
|
|
5
5
|
}
|
|
6
6
|
export declare function SupportedDeviceRow({ deviceModel, }: SupportedDeviceRowProps): JSX.Element;
|
|
7
|
+
export declare function ImageColumn({ deviceModel }: SupportedDeviceRowProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function ModelColumn({ deviceModel }: SupportedDeviceRowProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function StatusColumn({ deviceModel }: SupportedDeviceRowProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const connectionTypeNames: Record<DeviceModel['connection_type'], string>;
|
|
@@ -1,16 +1,30 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import {
|
|
3
|
+
import { DotDivider } from '../../../../lib/ui/layout/DotDivider.js';
|
|
4
4
|
export function SupportedDeviceRow({ deviceModel, }) {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
return (_jsxs("div", { className: 'seam-row', children: [_jsx(ImageColumn, { deviceModel: deviceModel }), _jsx(ModelColumn, { deviceModel: deviceModel }), _jsx(StatusColumn, { deviceModel: deviceModel })] }));
|
|
6
|
+
}
|
|
7
|
+
export function ImageColumn({ deviceModel }) {
|
|
8
|
+
return (_jsx("div", { className: 'seam-col seam-device-image-col', children: _jsx("div", { className: 'seam-image-box', children: _jsx("img", { width: 40, src: deviceModel.icon_url }) }) }));
|
|
9
|
+
}
|
|
10
|
+
export function ModelColumn({ deviceModel }) {
|
|
11
|
+
return (_jsxs("div", { className: 'seam-col seam-model-col', children: [_jsx("div", { className: 'seam-model-name', children: deviceModel.model_name }), _jsxs("div", { className: 'seam-model-id', children: [deviceModel.manufacturer_model_id, _jsx(DotDivider, {}), connectionTypeNames[deviceModel.connection_type]] })] }));
|
|
12
|
+
}
|
|
13
|
+
export function StatusColumn({ deviceModel }) {
|
|
14
|
+
const statusColor = supportLevelColors[deviceModel.support_level] ?? 'unknown';
|
|
15
|
+
return (_jsx("div", { className: 'seam-col seam-status-col', children: _jsx("div", { className: classNames('seam-status-pill', `status-${statusColor}`), children: _jsx("span", { children: status[deviceModel.support_level] }) }) }));
|
|
7
16
|
}
|
|
8
17
|
const supportLevelColors = {
|
|
9
18
|
live: 'green',
|
|
10
19
|
beta: 'blue',
|
|
11
|
-
unsupported: '
|
|
20
|
+
unsupported: 'unknown',
|
|
21
|
+
};
|
|
22
|
+
const status = {
|
|
23
|
+
live: 'LIVE',
|
|
24
|
+
beta: 'BETA',
|
|
25
|
+
unsupported: 'Inquire',
|
|
12
26
|
};
|
|
13
|
-
const connectionTypeNames = {
|
|
27
|
+
export const connectionTypeNames = {
|
|
14
28
|
wifi: 'Wifi',
|
|
15
29
|
zwave: 'Z-Wave',
|
|
16
30
|
zigbee: 'Zigbee',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupportedDeviceRow.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AAGnC,OAAO,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"SupportedDeviceRow.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AAGnC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AAE,OAAO;IACb,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,SAAS;CACvB,CAAA;AAED,MAAM,MAAM,GAAiD;IAC3D,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,SAAS;CACvB,CAAA;AAED,MAAM,CAAC,MAAM,mBAAmB,GAG5B;IACF,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,QAAQ;IACf,MAAM,EAAE,QAAQ;IAChB,OAAO,EAAE,SAAS;CACnB,CAAA"}
|
|
@@ -5,6 +5,7 @@ export interface SupportedDeviceTableProps {
|
|
|
5
5
|
* @deprecated Use disableFilter.
|
|
6
6
|
*/
|
|
7
7
|
cannotFilter?: boolean;
|
|
8
|
+
brands?: string[];
|
|
8
9
|
className?: string;
|
|
9
10
|
}
|
|
10
|
-
export declare function SupportedDeviceTable({ disableFilter, cannotFilter, className, }?: SupportedDeviceTableProps): JSX.Element;
|
|
11
|
+
export declare function SupportedDeviceTable({ disableFilter, cannotFilter, brands, className, }?: SupportedDeviceTableProps): JSX.Element;
|
|
@@ -3,7 +3,7 @@ import classNames from 'classnames';
|
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { SupportedDeviceContent } from '../../../../lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.js';
|
|
5
5
|
import { SupportedDeviceFilterArea } from '../../../../lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.js';
|
|
6
|
-
export function SupportedDeviceTable({ disableFilter = false, cannotFilter, className, } = {}) {
|
|
6
|
+
export function SupportedDeviceTable({ disableFilter = false, cannotFilter, brands = [], className, } = {}) {
|
|
7
7
|
const [filterValue, setFilterValue] = useState('');
|
|
8
8
|
const [filters, setFilters] = useState({
|
|
9
9
|
supportedOnly: false,
|
|
@@ -11,8 +11,8 @@ export function SupportedDeviceTable({ disableFilter = false, cannotFilter, clas
|
|
|
11
11
|
brand: null,
|
|
12
12
|
});
|
|
13
13
|
const hideFilter = cannotFilter ?? disableFilter;
|
|
14
|
-
return (_jsxs("div", { className: classNames('seam-supported-device-table-content-wrap', className), children: [!hideFilter && (_jsx(SupportedDeviceFilterArea, { filterValue: filterValue, setFilterValue: setFilterValue, filters: filters, setFilters: setFilters })), _jsx(SupportedDeviceContent, { resetFilterValue: () => {
|
|
14
|
+
return (_jsxs("div", { className: classNames('seam-supported-device-table-content-wrap', className), children: [!hideFilter && (_jsx(SupportedDeviceFilterArea, { filterValue: filterValue, setFilterValue: setFilterValue, filters: filters, setFilters: setFilters, brands: brands })), _jsx(SupportedDeviceContent, { resetFilterValue: () => {
|
|
15
15
|
setFilterValue('');
|
|
16
|
-
}, filterValue: filterValue, filters: filters })] }));
|
|
16
|
+
}, filterValue: filterValue, filters: filters, brands: brands })] }));
|
|
17
17
|
}
|
|
18
18
|
//# sourceMappingURL=SupportedDeviceTable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupportedDeviceTable.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,oEAAoE,CAAA;AAC3G,OAAO,EAAE,yBAAyB,EAAE,MAAM,uEAAuE,CAAA;
|
|
1
|
+
{"version":3,"file":"SupportedDeviceTable.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,oEAAoE,CAAA;AAC3G,OAAO,EAAE,yBAAyB,EAAE,MAAM,uEAAuE,CAAA;AAajH,MAAM,UAAU,oBAAoB,CAAC,EACnC,aAAa,GAAG,KAAK,EACrB,YAAY,EACZ,MAAM,GAAG,EAAE,EACX,SAAS,MACoB,EAAE;IAC/B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAA;IAClD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAqB;QACzD,aAAa,EAAE,KAAK;QACpB,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,IAAI;KACZ,CAAC,CAAA;IAEF,MAAM,UAAU,GAAG,YAAY,IAAI,aAAa,CAAA;IAEhD,OAAO,CACL,eACE,SAAS,EAAE,UAAU,CACnB,0CAA0C,EAC1C,SAAS,CACV,aAEA,CAAC,UAAU,IAAI,CACd,KAAC,yBAAyB,IACxB,WAAW,EAAE,WAAW,EACxB,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,GACd,CACH,EACD,KAAC,sBAAsB,IACrB,gBAAgB,EAAE,GAAG,EAAE;oBACrB,cAAc,CAAC,EAAE,CAAC,CAAA;gBACpB,CAAC,EACD,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,GACd,IACE,CACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useDeviceProviders } from '../../../../lib/seam/devices/use-device-providers.js';
|
|
2
|
+
export function useDeviceProvider(brand) {
|
|
3
|
+
const { deviceProviders } = useDeviceProviders();
|
|
4
|
+
const definedProvider = deviceProviders?.find((provider) => provider.device_provider_name === brand);
|
|
5
|
+
if (definedProvider != null) {
|
|
6
|
+
return definedProvider;
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
device_provider_name: 'unknown',
|
|
10
|
+
display_name: 'Unknown',
|
|
11
|
+
image_url: `https://connect.getseam.com/assets/images/logos/seam.png`,
|
|
12
|
+
provider_categories: [],
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=use-device-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-device-provider.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/use-device-provider.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAA;AAE7E,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,MAAM,EAAE,eAAe,EAAE,GAAG,kBAAkB,EAAE,CAAA;IAEhD,MAAM,eAAe,GAAG,eAAe,EAAE,IAAI,CAC3C,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,oBAAoB,KAAK,KAAK,CACtD,CAAA;IAED,IAAI,eAAe,IAAI,IAAI,EAAE;QAC3B,OAAO,eAAe,CAAA;KACvB;IAED,OAAO;QACL,oBAAoB,EAAE,SAAS;QAC/B,YAAY,EAAE,SAAS;QACvB,SAAS,EAAE,0DAA0D;QACrE,mBAAmB,EAAE,EAAE;KACxB,CAAA;AACH,CAAC"}
|
|
@@ -4,4 +4,8 @@ export interface DeviceModelFilters {
|
|
|
4
4
|
category: string | null;
|
|
5
5
|
brand: string | null;
|
|
6
6
|
}
|
|
7
|
-
export declare const useFilteredDeviceModels: (filterValue
|
|
7
|
+
export declare const useFilteredDeviceModels: ({ filterValue, filters, brands, }: {
|
|
8
|
+
filterValue: string;
|
|
9
|
+
filters: DeviceModelFilters;
|
|
10
|
+
brands: string[];
|
|
11
|
+
}) => ReturnType<typeof useDeviceModels>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useDeviceModels, } from '../../../../lib/seam/device-models/use-device-models.js';
|
|
2
|
-
export const useFilteredDeviceModels = (filterValue, filters) => {
|
|
2
|
+
export const useFilteredDeviceModels = ({ filterValue, filters, brands, }) => {
|
|
3
3
|
const params = {};
|
|
4
4
|
if (filterValue.trim() !== '') {
|
|
5
5
|
params.text_search = filterValue.trim();
|
|
@@ -13,6 +13,13 @@ export const useFilteredDeviceModels = (filterValue, filters) => {
|
|
|
13
13
|
if (filters.brand !== null) {
|
|
14
14
|
params.brand = filters.brand;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
const query = useDeviceModels(params);
|
|
17
|
+
if (brands.length === 0) {
|
|
18
|
+
return query;
|
|
19
|
+
}
|
|
20
|
+
// If the user only wants models for a collection of brands, such as ["yale", "august"], then
|
|
21
|
+
// we'll filter everything else out here.
|
|
22
|
+
const onlySpecificBrands = query.deviceModels?.filter((deviceModel) => brands.includes(deviceModel.brand));
|
|
23
|
+
return { ...query, deviceModels: onlySpecificBrands };
|
|
17
24
|
};
|
|
18
25
|
//# sourceMappingURL=use-filtered-device-models.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-filtered-device-models.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,GAEhB,MAAM,6CAA6C,CAAA;AAQpD,MAAM,CAAC,MAAM,uBAAuB,GAAG,
|
|
1
|
+
{"version":3,"file":"use-filtered-device-models.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,GAEhB,MAAM,6CAA6C,CAAA;AAQpD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EACtC,WAAW,EACX,OAAO,EACP,MAAM,GAKP,EAAsC,EAAE;IACvC,MAAM,MAAM,GAA0B,EAAE,CAAA;IAExC,IAAI,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QAC7B,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC,IAAI,EAAE,CAAA;KACxC;IAED,IAAI,OAAO,CAAC,aAAa,EAAE;QACzB,MAAM,CAAC,aAAa,GAAG,MAAM,CAAA;KAC9B;IAED,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI,EAAE;QAC7B,MAAM,CAAC,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAA;KACxC;IAED,IAAI,OAAO,CAAC,KAAK,KAAK,IAAI,EAAE;QAC1B,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;KAC7B;IAED,MAAM,KAAK,GAAG,eAAe,CAAC,MAAM,CAAC,CAAA;IAErC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;QACvB,OAAO,KAAK,CAAA;KACb;IAED,6FAA6F;IAC7F,yCAAyC;IACzC,MAAM,kBAAkB,GAAG,KAAK,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CACpE,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CACnC,CAAA;IAED,OAAO,EAAE,GAAG,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,CAAA;AACvD,CAAC,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useQuery } from '@tanstack/react-query';
|
|
2
|
+
import { useSeamClient } from '../../../lib/seam/use-seam-client.js';
|
|
3
|
+
export function useDeviceProviders() {
|
|
4
|
+
const { client } = useSeamClient();
|
|
5
|
+
const { data, isLoading } = useQuery({
|
|
6
|
+
queryFn: async () => {
|
|
7
|
+
if (client == null) {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
return await client?.devices.listDeviceProviders({});
|
|
11
|
+
},
|
|
12
|
+
queryKey: ['devices', 'list_device_providers'],
|
|
13
|
+
enabled: client != null,
|
|
14
|
+
});
|
|
15
|
+
return { deviceProviders: data, isLoading };
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=use-device-providers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-device-providers.js","sourceRoot":"","sources":["../../../src/lib/seam/devices/use-device-providers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAGhD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAE3D,MAAM,UAAU,kBAAkB;IAIhC,MAAM,EAAE,MAAM,EAAE,GAAG,aAAa,EAAE,CAAA;IAElC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,QAAQ,CAAC;QACnC,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,IAAI,MAAM,IAAI,IAAI,EAAE;gBAClB,OAAO,EAAE,CAAA;aACV;YAED,OAAO,MAAM,MAAM,EAAE,OAAO,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAA;QACtD,CAAC;QACD,QAAQ,EAAE,CAAC,SAAS,EAAE,uBAAuB,CAAC;QAC9C,OAAO,EAAE,MAAM,IAAI,IAAI;KACxB,CAAC,CAAA;IAEF,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,CAAA;AAC7C,CAAC"}
|
package/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const seamapiReactVersion = "1.
|
|
1
|
+
declare const seamapiReactVersion = "1.25.0";
|
|
2
2
|
export default seamapiReactVersion;
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seamapi/react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.25.0",
|
|
4
4
|
"description": "Seam Components.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"@mui/icons-material": "^5.11.16",
|
|
122
122
|
"@mui/material": "^5.12.2",
|
|
123
123
|
"@r2wc/react-to-web-component": "^2.0.2",
|
|
124
|
-
"@seamapi/fake-seam-connect": "^0.
|
|
124
|
+
"@seamapi/fake-seam-connect": "^0.10.0",
|
|
125
125
|
"@storybook/addon-essentials": "^7.0.2",
|
|
126
126
|
"@storybook/addon-interactions": "^7.0.2",
|
|
127
127
|
"@storybook/addon-links": "^7.0.2",
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ChevronRightIcon } from 'lib/icons/ChevronRight.js'
|
|
2
|
+
|
|
3
|
+
interface ShowAllDevicesButtonProps {
|
|
4
|
+
onClick: () => void
|
|
5
|
+
visible: boolean
|
|
6
|
+
expanded: boolean
|
|
7
|
+
totalDeviceCount: number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function ShowAllDevicesButton({
|
|
11
|
+
onClick,
|
|
12
|
+
visible,
|
|
13
|
+
expanded,
|
|
14
|
+
totalDeviceCount,
|
|
15
|
+
}: ShowAllDevicesButtonProps) {
|
|
16
|
+
if (!visible) {
|
|
17
|
+
return null
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const label = expanded ? t.showLess : t.showAll(totalDeviceCount)
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<button className='show-all-devices-button' onClick={onClick}>
|
|
24
|
+
<ChevronRightIcon /> {label}
|
|
25
|
+
</button>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const t = {
|
|
30
|
+
showLess: 'Show less',
|
|
31
|
+
showAll: (count: number) => `See all ${count} devices`,
|
|
32
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import classNames from 'classnames'
|
|
2
|
+
import type { DeviceModel } from 'seamapi'
|
|
3
|
+
|
|
4
|
+
import { ChevronRightIcon } from 'lib/icons/ChevronRight.js'
|
|
5
|
+
import { HiddenDevicesOverlay } from 'lib/seam/components/SupportedDeviceTable/HiddenDevicesOverlay.js'
|
|
6
|
+
import { ShowAllDevicesButton } from 'lib/seam/components/SupportedDeviceTable/ShowAllDevicesButton.js'
|
|
7
|
+
import { SupportedDeviceRow } from 'lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.js'
|
|
8
|
+
import { useDeviceProvider } from 'lib/seam/components/SupportedDeviceTable/use-device-provider.js'
|
|
9
|
+
import { useToggle } from 'lib/ui/use-toggle.js'
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* How many device models required before we collapse
|
|
13
|
+
* the list, and require the user to click to
|
|
14
|
+
* view all.
|
|
15
|
+
*/
|
|
16
|
+
const maxDevicesBeforeCollapsing = 3
|
|
17
|
+
|
|
18
|
+
export interface SupportedDeviceBrandSectionProps {
|
|
19
|
+
brand: string
|
|
20
|
+
deviceModels: DeviceModel[]
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function SupportedDeviceBrandSection({
|
|
24
|
+
brand,
|
|
25
|
+
deviceModels,
|
|
26
|
+
}: SupportedDeviceBrandSectionProps): JSX.Element | null {
|
|
27
|
+
const deviceProvider = useDeviceProvider(brand)
|
|
28
|
+
|
|
29
|
+
const [expanded, toggleExpand] = useToggle()
|
|
30
|
+
|
|
31
|
+
const canExpand = deviceModels.length > maxDevicesBeforeCollapsing
|
|
32
|
+
|
|
33
|
+
const visibleDevices = () => {
|
|
34
|
+
if (!canExpand || expanded) {
|
|
35
|
+
return deviceModels
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return deviceModels.filter(
|
|
39
|
+
(_deviceModel, index) => index < maxDevicesBeforeCollapsing
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const handleHeaderClick = () => {
|
|
44
|
+
if (!canExpand) {
|
|
45
|
+
return
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
toggleExpand()
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<div
|
|
53
|
+
className={classNames('seam-brand-section', {
|
|
54
|
+
'can-expand': canExpand,
|
|
55
|
+
expanded,
|
|
56
|
+
})}
|
|
57
|
+
>
|
|
58
|
+
<div className='seam-header' onClick={handleHeaderClick}>
|
|
59
|
+
<img
|
|
60
|
+
src={deviceProvider.image_url}
|
|
61
|
+
alt={brand}
|
|
62
|
+
className='seam-brand-image'
|
|
63
|
+
/>
|
|
64
|
+
<h5 className='seam-brand-name'>
|
|
65
|
+
{deviceProvider.display_name} {t.devices}
|
|
66
|
+
</h5>
|
|
67
|
+
{canExpand && <ChevronRightIcon className='chevron' />}
|
|
68
|
+
</div>
|
|
69
|
+
<div className='seam-supported-device-table-content'>
|
|
70
|
+
{visibleDevices().map((deviceModel, index) => (
|
|
71
|
+
<SupportedDeviceRow
|
|
72
|
+
key={[
|
|
73
|
+
deviceModel.main_category,
|
|
74
|
+
deviceModel.brand,
|
|
75
|
+
deviceModel.model_name,
|
|
76
|
+
deviceModel.manufacturer_model_id,
|
|
77
|
+
index,
|
|
78
|
+
].join(':')}
|
|
79
|
+
deviceModel={deviceModel}
|
|
80
|
+
/>
|
|
81
|
+
))}
|
|
82
|
+
</div>
|
|
83
|
+
<ShowAllDevicesButton
|
|
84
|
+
visible={canExpand}
|
|
85
|
+
onClick={toggleExpand}
|
|
86
|
+
expanded={expanded}
|
|
87
|
+
totalDeviceCount={deviceModels.length}
|
|
88
|
+
/>
|
|
89
|
+
<HiddenDevicesOverlay visible={canExpand && !expanded} />
|
|
90
|
+
</div>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const t = {
|
|
95
|
+
devices: 'Devices',
|
|
96
|
+
}
|
|
@@ -1,25 +1,33 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import type { DeviceModel } from 'seamapi'
|
|
2
|
+
|
|
3
|
+
import { SupportedDeviceBrandSection } from 'lib/seam/components/SupportedDeviceTable/SupportedDeviceBrandSection.js'
|
|
4
|
+
import { SupportedDeviceFilterResultRow } from 'lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterResultRowProps.js'
|
|
3
5
|
import {
|
|
4
6
|
type DeviceModelFilters,
|
|
5
7
|
useFilteredDeviceModels,
|
|
6
8
|
} from 'lib/seam/components/SupportedDeviceTable/use-filtered-device-models.js'
|
|
9
|
+
import type { UseDeviceModelsData } from 'lib/seam/device-models/use-device-models.js'
|
|
7
10
|
import { Button } from 'lib/ui/Button.js'
|
|
8
11
|
|
|
9
12
|
interface SupportedDeviceContentProps {
|
|
10
13
|
filterValue: string
|
|
11
14
|
resetFilterValue: () => void
|
|
12
15
|
filters: DeviceModelFilters
|
|
16
|
+
brands: string[]
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
export function SupportedDeviceContent({
|
|
16
20
|
resetFilterValue,
|
|
17
21
|
filterValue,
|
|
18
22
|
filters,
|
|
23
|
+
brands,
|
|
19
24
|
}: SupportedDeviceContentProps): JSX.Element | null {
|
|
20
25
|
const { deviceModels, isLoading, isError, refetch } = useFilteredDeviceModels(
|
|
21
|
-
|
|
22
|
-
|
|
26
|
+
{
|
|
27
|
+
filterValue,
|
|
28
|
+
filters,
|
|
29
|
+
brands,
|
|
30
|
+
}
|
|
23
31
|
)
|
|
24
32
|
|
|
25
33
|
if (isLoading) {
|
|
@@ -51,12 +59,29 @@ export function SupportedDeviceContent({
|
|
|
51
59
|
return null
|
|
52
60
|
}
|
|
53
61
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<
|
|
62
|
+
const isEmpty = deviceModels.length === 0
|
|
63
|
+
if (isEmpty) {
|
|
64
|
+
return (
|
|
65
|
+
<div className='seam-supported-device-table-content'>
|
|
66
|
+
<EmptyResult
|
|
67
|
+
filterValue={filterValue}
|
|
68
|
+
resetFilterValue={resetFilterValue}
|
|
69
|
+
/>
|
|
70
|
+
</div>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// If there are no active filters or search, show all the rows without any brand sections.
|
|
75
|
+
const hasFilters =
|
|
76
|
+
filterValue.trim() !== '' ||
|
|
77
|
+
filters.supportedOnly ||
|
|
78
|
+
filters.category !== null ||
|
|
79
|
+
filters.brand !== null
|
|
80
|
+
if (hasFilters) {
|
|
81
|
+
return (
|
|
82
|
+
<div className='seam-supported-device-table-content'>
|
|
58
83
|
{deviceModels.map((deviceModel, index) => (
|
|
59
|
-
<
|
|
84
|
+
<SupportedDeviceFilterResultRow
|
|
60
85
|
key={[
|
|
61
86
|
deviceModel.main_category,
|
|
62
87
|
deviceModel.brand,
|
|
@@ -67,14 +92,22 @@ export function SupportedDeviceContent({
|
|
|
67
92
|
deviceModel={deviceModel}
|
|
68
93
|
/>
|
|
69
94
|
))}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
95
|
+
</div>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<>
|
|
101
|
+
{Object.entries(groupDeviceModelsByBrand(deviceModels)).map(
|
|
102
|
+
([brand, models]) => (
|
|
103
|
+
<SupportedDeviceBrandSection
|
|
104
|
+
key={brand}
|
|
105
|
+
brand={brand}
|
|
106
|
+
deviceModels={models}
|
|
74
107
|
/>
|
|
75
|
-
)
|
|
76
|
-
|
|
77
|
-
|
|
108
|
+
)
|
|
109
|
+
)}
|
|
110
|
+
</>
|
|
78
111
|
)
|
|
79
112
|
}
|
|
80
113
|
|
|
@@ -110,6 +143,19 @@ function EmptyResult({
|
|
|
110
143
|
)
|
|
111
144
|
}
|
|
112
145
|
|
|
146
|
+
function groupDeviceModelsByBrand(
|
|
147
|
+
deviceModels: UseDeviceModelsData
|
|
148
|
+
): Record<string, DeviceModel[]> {
|
|
149
|
+
const result: Record<string, DeviceModel[]> = {}
|
|
150
|
+
|
|
151
|
+
for (const model of deviceModels) {
|
|
152
|
+
const { brand } = model
|
|
153
|
+
const list = result[brand] ?? []
|
|
154
|
+
result[brand] = [...list, model]
|
|
155
|
+
}
|
|
156
|
+
return result
|
|
157
|
+
}
|
|
158
|
+
|
|
113
159
|
const t = {
|
|
114
160
|
loading: 'Loading device models...',
|
|
115
161
|
retry: 'Retry',
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { SupportedDeviceRow } from 'lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.js'
|
|
2
|
+
import type { UseDeviceModelsData } from 'lib/seam/device-models/use-device-models.js'
|
|
3
|
+
|
|
4
|
+
interface SupportedDeviceContentRowsProps {
|
|
5
|
+
deviceModels: UseDeviceModelsData
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function SupportedDeviceContentRows({
|
|
9
|
+
deviceModels,
|
|
10
|
+
}: SupportedDeviceContentRowsProps): JSX.Element | null {
|
|
11
|
+
return (
|
|
12
|
+
<div className='seam-supported-device-table-content'>
|
|
13
|
+
{deviceModels.map((deviceModel, index) => (
|
|
14
|
+
<SupportedDeviceRow
|
|
15
|
+
key={[
|
|
16
|
+
deviceModel.main_category,
|
|
17
|
+
deviceModel.brand,
|
|
18
|
+
deviceModel.model_name,
|
|
19
|
+
deviceModel.manufacturer_model_id,
|
|
20
|
+
index,
|
|
21
|
+
].join(':')}
|
|
22
|
+
deviceModel={deviceModel}
|
|
23
|
+
/>
|
|
24
|
+
))}
|
|
25
|
+
</div>
|
|
26
|
+
)
|
|
27
|
+
}
|