@seamapi/react 1.41.0 → 1.41.1
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 +58 -60
- package/dist/elements.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/FilterCategoryMenu.js +1 -1
- package/lib/seam/components/SupportedDeviceTable/FilterCategoryMenu.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.d.ts +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.js +1 -5
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.d.ts +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.js +25 -16
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.d.ts +1 -1
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.js +2 -3
- package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.js.map +1 -1
- package/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.d.ts +1 -2
- package/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.js +7 -8
- package/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.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/seam/components/SupportedDeviceTable/FilterCategoryMenu.tsx +1 -1
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.tsx +3 -7
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.tsx +29 -30
- package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.tsx +3 -4
- package/src/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.ts +10 -14
- package/src/lib/version.ts +1 -1
|
@@ -3,7 +3,7 @@ import { ChevronDownIcon } from '../../../../lib/icons/ChevronDown.js';
|
|
|
3
3
|
import { Menu } from '../../../../lib/ui/Menu/Menu.js';
|
|
4
4
|
import { MenuItem } from '../../../../lib/ui/Menu/MenuItem.js';
|
|
5
5
|
export function FilterCategoryMenu({ label = t.filter, allLabel, options, hideAllOption = false, onSelect, onAllOptionSelect, buttonLabel, }) {
|
|
6
|
-
const usableOptions = hideAllOption ? options : [
|
|
6
|
+
const usableOptions = hideAllOption ? options : [allLabel, ...options];
|
|
7
7
|
return (_jsxs("div", { className: 'seam-supported-device-table-filter-menu-wrap', children: [_jsx("p", { children: label }), _jsx(Menu, { renderButton: ({ onOpen }) => (_jsxs("button", { onClick: onOpen, children: [_jsx("span", { children: buttonLabel }), _jsx(ChevronDownIcon, {})] })), children: usableOptions.map((option, index) => (_jsx(MenuItem, { onClick: () => {
|
|
8
8
|
if (option === allLabel) {
|
|
9
9
|
onAllOptionSelect?.();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterCategoryMenu.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/FilterCategoryMenu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AA2BlD,MAAM,UAAU,kBAAkB,CAAC,EACjC,KAAK,GAAG,CAAC,CAAC,MAAM,EAChB,QAAQ,EACR,OAAO,EACP,aAAa,GAAG,KAAK,EACrB,QAAQ,EACR,iBAAiB,EACjB,WAAW,GACa;IACxB,MAAM,aAAa,GAAG,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"FilterCategoryMenu.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/FilterCategoryMenu.tsx"],"names":[],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eviceModelFilters;
|
|
7
|
-
brands: string[];
|
|
7
|
+
brands: string[] | null;
|
|
8
8
|
}
|
|
9
9
|
export declare function SupportedDeviceContent({ resetFilterValue, filterValue, filters, brands, }: SupportedDeviceContentProps): JSX.Element | null;
|
|
10
10
|
export {};
|
|
@@ -24,11 +24,7 @@ export function SupportedDeviceContent({ resetFilterValue, filterValue, filters,
|
|
|
24
24
|
if (isEmpty) {
|
|
25
25
|
return (_jsx("div", { className: 'seam-supported-device-table-content', children: _jsx(EmptyResult, { filterValue: filterValue, resetFilterValue: resetFilterValue }) }));
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
const hasFilters = filterValue.trim() !== '' ||
|
|
29
|
-
filters.supportedOnly ||
|
|
30
|
-
filters.category !== null ||
|
|
31
|
-
filters.brand !== null;
|
|
27
|
+
const hasFilters = filterValue.trim() !== '' || filters.brand !== null;
|
|
32
28
|
if (hasFilters) {
|
|
33
29
|
return (_jsx("div", { className: 'seam-supported-device-table-content', children: deviceModels.map((deviceModel, index) => (_jsx(SupportedDeviceFilterResultRow, { deviceModel: deviceModel }, [
|
|
34
30
|
deviceModel.main_category,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupportedDeviceContent.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,2BAA2B,EAAE,MAAM,yEAAyE,CAAA;AACrH,OAAO,EAAE,8BAA8B,EAAE,MAAM,4EAA4E,CAAA;AAC3H,OAAO,EAEL,uBAAuB,GACxB,MAAM,wEAAwE,CAAA;AAE/E,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AASzC,MAAM,UAAU,sBAAsB,CAAC,EACrC,gBAAgB,EAChB,WAAW,EACX,OAAO,EACP,MAAM,GACsB;IAC5B,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,uBAAuB,CAC3E;QACE,WAAW;QACX,OAAO;QACP,MAAM;KACP,CACF,CAAA;IAED,IAAI,SAAS,EAAE;QACb,OAAO,CACL,cAAK,SAAS,EAAC,iDAAiD,YAC9D,sBAAI,CAAC,CAAC,OAAO,GAAK,GACd,CACP,CAAA;KACF;IAED,IAAI,OAAO,EAAE;QACX,OAAO,CACL,eAAK,SAAS,EAAC,iDAAiD,aAC9D,sBAAI,CAAC,CAAC,KAAK,GAAK,EAChB,KAAC,MAAM,IACL,OAAO,EAAC,OAAO,EACf,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,GAAG,EAAE;wBACZ,KAAK,OAAO,EAAE,CAAA;oBAChB,CAAC,YAEA,CAAC,CAAC,KAAK,GACD,IACL,CACP,CAAA;KACF;IAED,IAAI,YAAY,IAAI,IAAI,EAAE;QACxB,OAAO,IAAI,CAAA;KACZ;IAED,MAAM,OAAO,GAAG,YAAY,CAAC,MAAM,KAAK,CAAC,CAAA;IACzC,IAAI,OAAO,EAAE;QACX,OAAO,CACL,cAAK,SAAS,EAAC,qCAAqC,YAClD,KAAC,WAAW,IACV,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,GAClC,GACE,CACP,CAAA;KACF;IAED,
|
|
1
|
+
{"version":3,"file":"SupportedDeviceContent.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,2BAA2B,EAAE,MAAM,yEAAyE,CAAA;AACrH,OAAO,EAAE,8BAA8B,EAAE,MAAM,4EAA4E,CAAA;AAC3H,OAAO,EAEL,uBAAuB,GACxB,MAAM,wEAAwE,CAAA;AAE/E,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AASzC,MAAM,UAAU,sBAAsB,CAAC,EACrC,gBAAgB,EAChB,WAAW,EACX,OAAO,EACP,MAAM,GACsB;IAC5B,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,OAA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,0BAA0B;IACnC,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,4CAA4C;IACnD,SAAS,EAAE,yBAAyB;IACpC,OAAO,EAAE,uCAAuC;IAChD,KAAK,EAAE,oBAAoB;CAC5B,CAAA"}
|
|
@@ -5,7 +5,7 @@ interface SupportedDeviceFilterAreaProps {
|
|
|
5
5
|
setFilterValue: (filter: string) => void;
|
|
6
6
|
filters: DeviceModelFilters;
|
|
7
7
|
setFilters: Dispatch<SetStateAction<DeviceModelFilters>>;
|
|
8
|
-
brands: string[];
|
|
8
|
+
brands: string[] | null;
|
|
9
9
|
}
|
|
10
10
|
export declare function SupportedDeviceFilterArea({ filterValue, setFilterValue, filters, setFilters, brands, }: SupportedDeviceFilterAreaProps): JSX.Element;
|
|
11
11
|
export {};
|
|
@@ -6,9 +6,8 @@ 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
8
|
export function SupportedDeviceFilterArea({ filterValue, setFilterValue, filters, setFilters, brands, }) {
|
|
9
|
-
const appliedFiltersCount =
|
|
10
|
-
const
|
|
11
|
-
const availableProperties = useAvailableProperties(filterProperty, { brands });
|
|
9
|
+
const appliedFiltersCount = getAppliedFilterCount(filters);
|
|
10
|
+
const availableBrands = useAvailableBrands(brands);
|
|
12
11
|
const resetFilter = (filterType) => {
|
|
13
12
|
setFilters((filters) => ({
|
|
14
13
|
...filters,
|
|
@@ -19,13 +18,13 @@ export function SupportedDeviceFilterArea({ filterValue, setFilterValue, filters
|
|
|
19
18
|
const allLabel = t.all;
|
|
20
19
|
return (_jsxs("div", { className: 'seam-supported-device-table-filter-area', children: [_jsx("div", { className: 'seam-deliberate-block' }), _jsxs("div", { className: 'seam-filters-wrap', children: [_jsx(Menu, { renderButton: ({ onOpen }) => (_jsx(Button, { variant: 'outline', className: 'seam-filters-button', onClick: onOpen, children: filterButtonLabel })), children: _jsxs("div", { className: 'seam-supported-device-table-filter-menu', onClick: (event) => {
|
|
21
20
|
event.stopPropagation();
|
|
22
|
-
}, children: [_jsx("div", { className: 'seam-filter-menu-row', children: _jsx(FilterCategoryMenu, { label: t.brand, allLabel: allLabel, options:
|
|
21
|
+
}, children: [_jsx("div", { className: 'seam-filter-menu-row', children: _jsx(FilterCategoryMenu, { label: t.brand, allLabel: allLabel, options: availableBrands, onSelect: (brand) => {
|
|
23
22
|
setFilters((filters) => ({
|
|
24
23
|
...filters,
|
|
25
24
|
brand,
|
|
26
25
|
}));
|
|
27
26
|
}, buttonLabel: filters.brand ?? allLabel, onAllOptionSelect: () => {
|
|
28
|
-
resetFilter(
|
|
27
|
+
resetFilter('brand');
|
|
29
28
|
} }) }), _jsx("div", { className: 'seam-filter-menu-row', children: _jsxs("label", { htmlFor: 'supportedOnly', className: 'seam-filter-checkbox-label', children: [_jsx("p", { children: t.supported }), _jsx("input", { id: 'supportedOnly', name: 'supportedOnly', type: 'checkbox', className: 'seam-filter-checkbox', checked: filters.supportedOnly, onChange: (event) => {
|
|
30
29
|
setFilters((filters) => ({
|
|
31
30
|
...filters,
|
|
@@ -35,23 +34,33 @@ export function SupportedDeviceFilterArea({ filterValue, setFilterValue, filters
|
|
|
35
34
|
setFilterValue(value);
|
|
36
35
|
}, className: 'seam-supported-device-table-filter-area-search-bar' }) })] })] }));
|
|
37
36
|
}
|
|
38
|
-
const
|
|
37
|
+
const getAppliedFilterCount = (filters) => {
|
|
38
|
+
let count = 0;
|
|
39
|
+
if (filters.brand !== null)
|
|
40
|
+
count++;
|
|
41
|
+
if (!filters.supportedOnly)
|
|
42
|
+
count++;
|
|
43
|
+
return count;
|
|
44
|
+
};
|
|
45
|
+
const useAvailableBrands = (brands) => {
|
|
39
46
|
const { deviceModels } = useDeviceModels();
|
|
40
47
|
if (deviceModels == null)
|
|
41
48
|
return [];
|
|
42
|
-
const
|
|
49
|
+
const uniqueBrands = new Set();
|
|
43
50
|
for (const deviceModel of deviceModels) {
|
|
44
|
-
const value = deviceModel
|
|
45
|
-
//
|
|
46
|
-
|
|
47
|
-
if (property === 'brand' &&
|
|
48
|
-
options.brands.length > 0 &&
|
|
49
|
-
!options.brands.includes(value)) {
|
|
51
|
+
const value = deviceModel.brand;
|
|
52
|
+
// UPSTREAM: API can return an empty value for brand.
|
|
53
|
+
if (value.trim() === '')
|
|
50
54
|
continue;
|
|
51
|
-
|
|
52
|
-
properties.add(capitalize(value));
|
|
55
|
+
uniqueBrands.add(deviceModel.brand);
|
|
53
56
|
}
|
|
54
|
-
return Array.from(
|
|
57
|
+
return Array.from(uniqueBrands)
|
|
58
|
+
.filter((brand) => {
|
|
59
|
+
if (brands === null)
|
|
60
|
+
return true;
|
|
61
|
+
return brands.includes(brand);
|
|
62
|
+
})
|
|
63
|
+
.map((brand) => capitalize(brand));
|
|
55
64
|
};
|
|
56
65
|
const t = {
|
|
57
66
|
all: 'All',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SupportedDeviceFilterArea.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"SupportedDeviceFilterArea.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.tsx"],"names":[],"mappings":";AAEA,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,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AC/D,MAAM,EAAE,YAAY,EAAE,GAAG,eAAe,EAAE,CAAA;IAE1C,IAAI,YAAY,IAAI,IAAI;QAAE,OAAO,EAAE,CAAA;IAEnC,MAAM,YAAY,GAAG,IAAI,GAAG,EAAU,CAAA;IACtC,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE;QACtC,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAA;QAE/B,qDAAqD;QACrD,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE;YAAE,SAAQ;QAEjC,YAAY,CAAC,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;KACpC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC;SAC5B,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;QAChB,IAAI,MAAM,KAAK,IAAI;YAAE,OAAO,IAAI,CAAA;QAChC,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC/B,CAAC,CAAC;SACD,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAA;AACtC,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"}
|
|
@@ -5,7 +5,7 @@ export interface SupportedDeviceTableProps {
|
|
|
5
5
|
* @deprecated Use disableFilter.
|
|
6
6
|
*/
|
|
7
7
|
cannotFilter?: boolean;
|
|
8
|
-
brands?: string[];
|
|
8
|
+
brands?: string[] | null;
|
|
9
9
|
className?: string;
|
|
10
10
|
}
|
|
11
11
|
export declare function SupportedDeviceTable({ disableFilter, cannotFilter, brands, className, }?: SupportedDeviceTableProps): JSX.Element;
|
|
@@ -3,11 +3,10 @@ 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, brands =
|
|
6
|
+
export function SupportedDeviceTable({ disableFilter = false, cannotFilter, brands = null, className, } = {}) {
|
|
7
7
|
const [filterValue, setFilterValue] = useState('');
|
|
8
8
|
const [filters, setFilters] = useState({
|
|
9
|
-
supportedOnly:
|
|
10
|
-
category: null,
|
|
9
|
+
supportedOnly: true,
|
|
11
10
|
brand: null,
|
|
12
11
|
});
|
|
13
12
|
const hideFilter = cannotFilter ?? disableFilter;
|
|
@@ -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;AAajH,MAAM,UAAU,oBAAoB,CAAC,EACnC,aAAa,GAAG,KAAK,EACrB,YAAY,EACZ,MAAM,GAAG,
|
|
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,IAAI,EACb,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,IAAI;QACnB,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"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useDeviceModels } from '../../../../lib/seam/device-models/use-device-models.js';
|
|
2
2
|
export interface DeviceModelFilters {
|
|
3
3
|
supportedOnly: boolean;
|
|
4
|
-
category: string | null;
|
|
5
4
|
brand: string | null;
|
|
6
5
|
}
|
|
7
6
|
export declare const useFilteredDeviceModels: ({ filterValue, filters, brands, }: {
|
|
8
7
|
filterValue: string;
|
|
9
8
|
filters: DeviceModelFilters;
|
|
10
|
-
brands: string[];
|
|
9
|
+
brands: string[] | null;
|
|
11
10
|
}) => ReturnType<typeof useDeviceModels>;
|
|
@@ -7,19 +7,18 @@ export const useFilteredDeviceModels = ({ filterValue, filters, brands, }) => {
|
|
|
7
7
|
if (filters.supportedOnly) {
|
|
8
8
|
params.support_level = 'live';
|
|
9
9
|
}
|
|
10
|
-
if (filters.category !== null) {
|
|
11
|
-
params.main_category = filters.category;
|
|
12
|
-
}
|
|
13
10
|
if (filters.brand !== null) {
|
|
14
11
|
params.brand = filters.brand;
|
|
15
12
|
}
|
|
16
13
|
const query = useDeviceModels(params);
|
|
17
|
-
if (brands
|
|
14
|
+
if (brands === null) {
|
|
18
15
|
return query;
|
|
19
16
|
}
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
// UPSTREAM: The API does not have a brands query parameter,
|
|
18
|
+
// so selected brands are filtered here.
|
|
19
|
+
return {
|
|
20
|
+
...query,
|
|
21
|
+
deviceModels: query.deviceModels?.filter((deviceModel) => brands.includes(deviceModel.brand)),
|
|
22
|
+
};
|
|
24
23
|
};
|
|
25
24
|
//# 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;
|
|
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;AAOpD,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,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,KAAK,IAAI,EAAE;QACnB,OAAO,KAAK,CAAA;KACb;IAED,4DAA4D;IAC5D,wCAAwC;IACxC,OAAO;QACL,GAAG,KAAK;QACR,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CACvD,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CACnC;KACF,CAAA;AACH,CAAC,CAAA"}
|
package/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const seamapiReactVersion = "1.41.
|
|
1
|
+
declare const seamapiReactVersion = "1.41.1";
|
|
2
2
|
export default seamapiReactVersion;
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -36,7 +36,7 @@ export function FilterCategoryMenu({
|
|
|
36
36
|
onAllOptionSelect,
|
|
37
37
|
buttonLabel,
|
|
38
38
|
}: FilterCategoryMenuProps): JSX.Element {
|
|
39
|
-
const usableOptions = hideAllOption ? options : [
|
|
39
|
+
const usableOptions = hideAllOption ? options : [allLabel, ...options]
|
|
40
40
|
|
|
41
41
|
return (
|
|
42
42
|
<div className='seam-supported-device-table-filter-menu-wrap'>
|
|
@@ -13,7 +13,7 @@ interface SupportedDeviceContentProps {
|
|
|
13
13
|
filterValue: string
|
|
14
14
|
resetFilterValue: () => void
|
|
15
15
|
filters: DeviceModelFilters
|
|
16
|
-
brands: string[]
|
|
16
|
+
brands: string[] | null
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
export function SupportedDeviceContent({
|
|
@@ -71,12 +71,8 @@ export function SupportedDeviceContent({
|
|
|
71
71
|
)
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
filterValue.trim() !== '' ||
|
|
77
|
-
filters.supportedOnly ||
|
|
78
|
-
filters.category !== null ||
|
|
79
|
-
filters.brand !== null
|
|
74
|
+
const hasFilters = filterValue.trim() !== '' || filters.brand !== null
|
|
75
|
+
|
|
80
76
|
if (hasFilters) {
|
|
81
77
|
return (
|
|
82
78
|
<div className='seam-supported-device-table-content'>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Dispatch, SetStateAction } from 'react'
|
|
2
|
-
import type { DeviceModel } from 'seamapi'
|
|
3
2
|
|
|
4
3
|
import { FilterCategoryMenu } from 'lib/seam/components/SupportedDeviceTable/FilterCategoryMenu.js'
|
|
5
4
|
import type { DeviceModelFilters } from 'lib/seam/components/SupportedDeviceTable/use-filtered-device-models.js'
|
|
@@ -14,7 +13,7 @@ interface SupportedDeviceFilterAreaProps {
|
|
|
14
13
|
setFilterValue: (filter: string) => void
|
|
15
14
|
filters: DeviceModelFilters
|
|
16
15
|
setFilters: Dispatch<SetStateAction<DeviceModelFilters>>
|
|
17
|
-
brands: string[]
|
|
16
|
+
brands: string[] | null
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
export function SupportedDeviceFilterArea({
|
|
@@ -24,12 +23,9 @@ export function SupportedDeviceFilterArea({
|
|
|
24
23
|
setFilters,
|
|
25
24
|
brands,
|
|
26
25
|
}: SupportedDeviceFilterAreaProps): JSX.Element {
|
|
27
|
-
const appliedFiltersCount =
|
|
28
|
-
(v) => v != null && v !== false
|
|
29
|
-
).length
|
|
26
|
+
const appliedFiltersCount = getAppliedFilterCount(filters)
|
|
30
27
|
|
|
31
|
-
const
|
|
32
|
-
const availableProperties = useAvailableProperties(filterProperty, { brands })
|
|
28
|
+
const availableBrands = useAvailableBrands(brands)
|
|
33
29
|
|
|
34
30
|
const resetFilter = (filterType: keyof DeviceModelFilters): void => {
|
|
35
31
|
setFilters((filters) => ({
|
|
@@ -68,7 +64,7 @@ export function SupportedDeviceFilterArea({
|
|
|
68
64
|
<FilterCategoryMenu
|
|
69
65
|
label={t.brand}
|
|
70
66
|
allLabel={allLabel}
|
|
71
|
-
options={
|
|
67
|
+
options={availableBrands}
|
|
72
68
|
onSelect={(brand: string) => {
|
|
73
69
|
setFilters((filters) => ({
|
|
74
70
|
...filters,
|
|
@@ -77,7 +73,7 @@ export function SupportedDeviceFilterArea({
|
|
|
77
73
|
}}
|
|
78
74
|
buttonLabel={filters.brand ?? allLabel}
|
|
79
75
|
onAllOptionSelect={() => {
|
|
80
|
-
resetFilter(
|
|
76
|
+
resetFilter('brand')
|
|
81
77
|
}}
|
|
82
78
|
/>
|
|
83
79
|
</div>
|
|
@@ -118,31 +114,34 @@ export function SupportedDeviceFilterArea({
|
|
|
118
114
|
)
|
|
119
115
|
}
|
|
120
116
|
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
117
|
+
const getAppliedFilterCount = (filters: DeviceModelFilters): number => {
|
|
118
|
+
let count = 0
|
|
119
|
+
if (filters.brand !== null) count++
|
|
120
|
+
if (!filters.supportedOnly) count++
|
|
121
|
+
return count
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const useAvailableBrands = (brands: string[] | null): string[] => {
|
|
127
125
|
const { deviceModels } = useDeviceModels()
|
|
126
|
+
|
|
128
127
|
if (deviceModels == null) return []
|
|
129
|
-
|
|
128
|
+
|
|
129
|
+
const uniqueBrands = new Set<string>()
|
|
130
130
|
for (const deviceModel of deviceModels) {
|
|
131
|
-
const value = deviceModel
|
|
132
|
-
|
|
133
|
-
//
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
options.brands.length > 0 &&
|
|
138
|
-
!options.brands.includes(value)
|
|
139
|
-
) {
|
|
140
|
-
continue
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
properties.add(capitalize(value))
|
|
131
|
+
const value = deviceModel.brand
|
|
132
|
+
|
|
133
|
+
// UPSTREAM: API can return an empty value for brand.
|
|
134
|
+
if (value.trim() === '') continue
|
|
135
|
+
|
|
136
|
+
uniqueBrands.add(deviceModel.brand)
|
|
144
137
|
}
|
|
145
|
-
|
|
138
|
+
|
|
139
|
+
return Array.from(uniqueBrands)
|
|
140
|
+
.filter((brand) => {
|
|
141
|
+
if (brands === null) return true
|
|
142
|
+
return brands.includes(brand)
|
|
143
|
+
})
|
|
144
|
+
.map((brand) => capitalize(brand))
|
|
146
145
|
}
|
|
147
146
|
|
|
148
147
|
const t = {
|
|
@@ -11,20 +11,19 @@ export interface SupportedDeviceTableProps {
|
|
|
11
11
|
* @deprecated Use disableFilter.
|
|
12
12
|
*/
|
|
13
13
|
cannotFilter?: boolean
|
|
14
|
-
brands?: string[]
|
|
14
|
+
brands?: string[] | null
|
|
15
15
|
className?: string
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export function SupportedDeviceTable({
|
|
19
19
|
disableFilter = false,
|
|
20
20
|
cannotFilter,
|
|
21
|
-
brands =
|
|
21
|
+
brands = null,
|
|
22
22
|
className,
|
|
23
23
|
}: SupportedDeviceTableProps = {}): JSX.Element {
|
|
24
24
|
const [filterValue, setFilterValue] = useState('')
|
|
25
25
|
const [filters, setFilters] = useState<DeviceModelFilters>({
|
|
26
|
-
supportedOnly:
|
|
27
|
-
category: null,
|
|
26
|
+
supportedOnly: true,
|
|
28
27
|
brand: null,
|
|
29
28
|
})
|
|
30
29
|
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
|
|
6
6
|
export interface DeviceModelFilters {
|
|
7
7
|
supportedOnly: boolean
|
|
8
|
-
category: string | null
|
|
9
8
|
brand: string | null
|
|
10
9
|
}
|
|
11
10
|
|
|
@@ -16,7 +15,7 @@ export const useFilteredDeviceModels = ({
|
|
|
16
15
|
}: {
|
|
17
16
|
filterValue: string
|
|
18
17
|
filters: DeviceModelFilters
|
|
19
|
-
brands: string[]
|
|
18
|
+
brands: string[] | null
|
|
20
19
|
}): ReturnType<typeof useDeviceModels> => {
|
|
21
20
|
const params: UseDeviceModelsParams = {}
|
|
22
21
|
|
|
@@ -28,25 +27,22 @@ export const useFilteredDeviceModels = ({
|
|
|
28
27
|
params.support_level = 'live'
|
|
29
28
|
}
|
|
30
29
|
|
|
31
|
-
if (filters.category !== null) {
|
|
32
|
-
params.main_category = filters.category
|
|
33
|
-
}
|
|
34
|
-
|
|
35
30
|
if (filters.brand !== null) {
|
|
36
31
|
params.brand = filters.brand
|
|
37
32
|
}
|
|
38
33
|
|
|
39
34
|
const query = useDeviceModels(params)
|
|
40
35
|
|
|
41
|
-
if (brands
|
|
36
|
+
if (brands === null) {
|
|
42
37
|
return query
|
|
43
38
|
}
|
|
44
39
|
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
40
|
+
// UPSTREAM: The API does not have a brands query parameter,
|
|
41
|
+
// so selected brands are filtered here.
|
|
42
|
+
return {
|
|
43
|
+
...query,
|
|
44
|
+
deviceModels: query.deviceModels?.filter((deviceModel) =>
|
|
45
|
+
brands.includes(deviceModel.brand)
|
|
46
|
+
),
|
|
47
|
+
}
|
|
52
48
|
}
|
package/src/lib/version.ts
CHANGED