@seamapi/react 0.26.1 → 0.28.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.
Files changed (84) hide show
  1. package/index.css +166 -3
  2. package/index.css.map +1 -1
  3. package/index.min.css +1 -1
  4. package/index.min.css.map +1 -1
  5. package/lib/capitalize.d.ts +1 -0
  6. package/lib/capitalize.js +4 -0
  7. package/lib/capitalize.js.map +1 -0
  8. package/lib/icons/ChevronDown.d.ts +2 -0
  9. package/lib/icons/ChevronDown.js +3 -0
  10. package/lib/icons/ChevronDown.js.map +1 -0
  11. package/lib/icons/Close.d.ts +2 -0
  12. package/lib/icons/Close.js +5 -0
  13. package/lib/icons/Close.js.map +1 -0
  14. package/lib/icons/Search.d.ts +2 -0
  15. package/lib/icons/Search.js +5 -0
  16. package/lib/icons/Search.js.map +1 -0
  17. package/lib/ui/Button.d.ts +4 -3
  18. package/lib/ui/Button.js +2 -2
  19. package/lib/ui/Button.js.map +1 -1
  20. package/lib/ui/DeviceTable/DeviceTable.js +9 -1
  21. package/lib/ui/DeviceTable/DeviceTable.js.map +1 -1
  22. package/lib/ui/SupportedDeviceTable/FilterCategoryMenu.d.ts +21 -0
  23. package/lib/ui/SupportedDeviceTable/FilterCategoryMenu.js +20 -0
  24. package/lib/ui/SupportedDeviceTable/FilterCategoryMenu.js.map +1 -0
  25. package/lib/ui/SupportedDeviceTable/SupportedDeviceContent.d.ts +4 -0
  26. package/lib/ui/SupportedDeviceTable/SupportedDeviceContent.js +53 -0
  27. package/lib/ui/SupportedDeviceTable/SupportedDeviceContent.js.map +1 -0
  28. package/lib/ui/SupportedDeviceTable/SupportedDeviceFilterArea.d.ts +11 -0
  29. package/lib/ui/SupportedDeviceTable/SupportedDeviceFilterArea.js +50 -0
  30. package/lib/ui/SupportedDeviceTable/SupportedDeviceFilterArea.js.map +1 -0
  31. package/lib/ui/SupportedDeviceTable/SupportedDeviceHeader.d.ts +1 -0
  32. package/lib/ui/{SupportedDevices/SupportedDevicesHeader.js → SupportedDeviceTable/SupportedDeviceHeader.js} +2 -2
  33. package/lib/ui/SupportedDeviceTable/SupportedDeviceHeader.js.map +1 -0
  34. package/lib/ui/{SupportedDevices → SupportedDeviceTable}/SupportedDeviceRow.d.ts +1 -1
  35. package/lib/ui/SupportedDeviceTable/SupportedDeviceRow.js.map +1 -0
  36. package/lib/ui/SupportedDeviceTable/SupportedDeviceTable.d.ts +3 -0
  37. package/lib/ui/SupportedDeviceTable/SupportedDeviceTable.js +8 -0
  38. package/lib/ui/SupportedDeviceTable/SupportedDeviceTable.js.map +1 -0
  39. package/lib/ui/{SupportedDevices → SupportedDeviceTable}/types.d.ts +5 -0
  40. package/lib/ui/SupportedDeviceTable/types.js.map +1 -0
  41. package/lib/ui/Table/TableHeader.js +1 -1
  42. package/lib/ui/Table/TableHeader.js.map +1 -1
  43. package/lib/ui/TextField/SearchTextField.d.ts +1 -1
  44. package/lib/ui/TextField/SearchTextField.js +52 -2
  45. package/lib/ui/TextField/SearchTextField.js.map +1 -1
  46. package/lib/ui/TextField/TextField.d.ts +11 -4
  47. package/lib/ui/TextField/TextField.js +5 -3
  48. package/lib/ui/TextField/TextField.js.map +1 -1
  49. package/lib/ui/index.d.ts +1 -1
  50. package/lib/ui/index.js +1 -1
  51. package/lib/ui/index.js.map +1 -1
  52. package/package.json +1 -1
  53. package/src/lib/capitalize.ts +3 -0
  54. package/src/lib/icons/ChevronDown.tsx +19 -0
  55. package/src/lib/icons/Close.tsx +30 -0
  56. package/src/lib/icons/Search.tsx +30 -0
  57. package/src/lib/ui/Button.tsx +12 -6
  58. package/src/lib/ui/DeviceTable/DeviceTable.tsx +16 -1
  59. package/src/lib/ui/SupportedDeviceTable/FilterCategoryMenu.tsx +65 -0
  60. package/src/lib/ui/SupportedDeviceTable/SupportedDeviceContent.tsx +147 -0
  61. package/src/lib/ui/SupportedDeviceTable/SupportedDeviceFilterArea.tsx +131 -0
  62. package/src/lib/ui/{SupportedDevices/SupportedDevicesHeader.tsx → SupportedDeviceTable/SupportedDeviceHeader.tsx} +1 -1
  63. package/src/lib/ui/{SupportedDevices → SupportedDeviceTable}/SupportedDeviceRow.tsx +1 -1
  64. package/src/lib/ui/SupportedDeviceTable/SupportedDeviceTable.tsx +16 -0
  65. package/src/lib/ui/{SupportedDevices → SupportedDeviceTable}/types.ts +6 -0
  66. package/src/lib/ui/Table/TableHeader.tsx +5 -1
  67. package/src/lib/ui/TextField/SearchTextField.tsx +79 -0
  68. package/src/lib/ui/TextField/TextField.tsx +43 -12
  69. package/src/lib/ui/index.ts +1 -1
  70. package/src/styles/_colors.scss +1 -0
  71. package/src/styles/_device-table.scss +4 -0
  72. package/src/styles/_inputs.scss +74 -2
  73. package/src/styles/_supported-devices.scss +114 -0
  74. package/src/styles/_tables.scss +8 -1
  75. package/lib/ui/SupportedDevices/SupportedDeviceRow.js.map +0 -1
  76. package/lib/ui/SupportedDevices/SupportedDevices.d.ts +0 -1
  77. package/lib/ui/SupportedDevices/SupportedDevices.js +0 -21
  78. package/lib/ui/SupportedDevices/SupportedDevices.js.map +0 -1
  79. package/lib/ui/SupportedDevices/SupportedDevicesHeader.d.ts +0 -1
  80. package/lib/ui/SupportedDevices/SupportedDevicesHeader.js.map +0 -1
  81. package/lib/ui/SupportedDevices/types.js.map +0 -1
  82. package/src/lib/ui/SupportedDevices/SupportedDevices.tsx +0 -65
  83. /package/lib/ui/{SupportedDevices → SupportedDeviceTable}/SupportedDeviceRow.js +0 -0
  84. /package/lib/ui/{SupportedDevices → SupportedDeviceTable}/types.js +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SupportedDeviceContent.js","sourceRoot":"","sources":["../../../src/lib/ui/SupportedDeviceTable/SupportedDeviceContent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,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AC,OAAO,EACZ,OAAO,EAAE,GAAG,EAAE;4BACZ,KAAK,OAAO,EAAE,CAAA;wBAChB,CAAC,sBAGM,IACL,CACP,EAEA,CAAC,SAAS,IAAI,CAAC,OAAO,IAAI,IAAI,EAAE,IAAI,EAAE,aAAa,KAAK,IAAI,IAAI,CAC/D,iBAAO,SAAS,EAAC,8BAA8B,aAC7C,KAAC,qBAAqB,KAAG,EACzB,4BACG,YAAY,CAAC,MAAM,KAAK,CAAC;gCACxB,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE,CAAC,CACvC,KAAC,kBAAkB,IAEjB,WAAW,EAAE,WAAW,IADnB,GAAG,KAAK,IAAI,WAAW,CAAC,qBAAqB,EAAE,CAEpD,CACH,CAAC,EAEH,YAAY,CAAC,MAAM,KAAK,CAAC,IAAI,CAC5B,aAAI,SAAS,EAAC,0CAA0C,YACtD,aAAI,OAAO,EAAE,CAAC,YACZ,cAAK,SAAS,EAAC,sCAAsC,YAClD,WAAW,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAC1B,kDAA8B,CAC/B,CAAC,CAAC,CAAC,CACF,8BACE,gEAA4C,EAC5C,KAAC,MAAM,IACL,OAAO,EAAC,SAAS,EACjB,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,GAAG,EAAE;wDACZ,cAAc,CAAC,EAAE,CAAC,CAAA;oDACpB,CAAC,EACD,SAAS,EAAC,mDAAmD,mCAGtD,IACR,CACJ,GACG,GACH,GACF,CACN,IACK,IACF,CACT,IACG,CACP,CAAA;AACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { Dispatch, SetStateAction } from 'react';
2
+ import type { DeviceModel, Filters } from '../../../lib/ui/SupportedDeviceTable/types.js';
3
+ interface SupportedDeviceFilterAreaProps {
4
+ deviceModels: DeviceModel[];
5
+ filterValue: string;
6
+ setFilterValue: (filter: string) => void;
7
+ filters: Filters;
8
+ setFilters: Dispatch<SetStateAction<Filters>>;
9
+ }
10
+ export declare function SupportedDeviceFilterArea({ deviceModels, filterValue, setFilterValue, filters, setFilters, }: SupportedDeviceFilterAreaProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,50 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { capitalize } from '../../../lib/capitalize.js';
3
+ import { Button } from '../../../lib/ui/Button.js';
4
+ import { Menu } from '../../../lib/ui/Menu/Menu.js';
5
+ import { FilterCategoryMenu } from '../../../lib/ui/SupportedDeviceTable/FilterCategoryMenu.js';
6
+ import { SearchTextField } from '../../../lib/ui/TextField/SearchTextField.js';
7
+ export function SupportedDeviceFilterArea({ deviceModels, filterValue, setFilterValue, filters, setFilters, }) {
8
+ const appliedFilters = Object.keys(filters).filter((key) => {
9
+ const filterProperty = filters[key];
10
+ return (filterProperty !== undefined &&
11
+ filterProperty !== null &&
12
+ filterProperty !== false);
13
+ });
14
+ const appliedFiltersCount = appliedFilters.length;
15
+ const getAvailablePropertiesFromDeviceModels = (property) => {
16
+ const properties = new Set();
17
+ deviceModels.forEach((deviceModel) => {
18
+ properties.add(capitalize(deviceModel[property]));
19
+ });
20
+ return Array.from(properties);
21
+ };
22
+ const resetFilter = (filterType) => {
23
+ setFilters((filters) => ({
24
+ ...filters,
25
+ [filterType]: null,
26
+ }));
27
+ };
28
+ const isPlural = appliedFiltersCount > 1;
29
+ const filterButtonLabel = isPlural
30
+ ? `Filters (${appliedFiltersCount})`
31
+ : 'Filter';
32
+ return (_jsxs("div", { className: 'seam-supported-devices-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-devices-filter-menu', onClick: (event) => {
33
+ event.stopPropagation();
34
+ }, children: [_jsx("div", { className: 'seam-filter-menu-row', children: _jsx(FilterCategoryMenu, { label: 'Brand', options: getAvailablePropertiesFromDeviceModels('brand'), onSelect: (brand) => {
35
+ setFilters((filters) => ({
36
+ ...filters,
37
+ brand,
38
+ }));
39
+ }, buttonLabel: filters.brand ?? 'All', onAllOptionSelect: () => {
40
+ resetFilter('brand');
41
+ } }) }), _jsx("div", { className: 'seam-filter-menu-row', children: _jsxs("label", { htmlFor: 'supportedOnly', className: 'seam-filter-checkbox-label', children: [_jsx("p", { children: "Supported" }), _jsx("input", { id: 'supportedOnly', name: 'supportedOnly', type: 'checkbox', className: 'seam-filter-checkbox', checked: filters.supportedOnly, onChange: (event) => {
42
+ setFilters((filters) => ({
43
+ ...filters,
44
+ supportedOnly: event.target.checked,
45
+ }));
46
+ } })] }) })] }) }), _jsx("div", { className: 'seam-supported-devices-filter-area-search-bar-wrap', children: _jsx(SearchTextField, { value: filterValue, onChange: (value) => {
47
+ setFilterValue(value);
48
+ }, className: 'seam-supported-devices-filter-area-search-bar' }) })] })] }));
49
+ }
50
+ //# sourceMappingURL=SupportedDeviceFilterArea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SupportedDeviceFilterArea.js","sourceRoot":"","sources":["../../../src/lib/ui/SupportedDeviceTable/SupportedDeviceFilterArea.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAA;AAEtF,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAUrE,MAAM,UAAU,yBAAyB,CAAC,EACxC,YAAY,EACZ,WAAW,EACX,cAAc,EACd,OAAO,EACP,UAAU,GACqB;IAC/B,MAAM,cAAc,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CA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C,GACzD,GACE,IACF,IACF,CACP,CAAA;AACH,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function SupportedDeviceHeader(): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- export function SupportedDevicesHeader() {
2
+ export function SupportedDeviceHeader() {
3
3
  return (_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", {}), _jsx("th", { children: "Category" }), _jsx("th", { children: "Model Name" }), _jsx("th", { children: "Manufacturer Model ID" }), _jsx("th", { children: "Connection Type" }), _jsx("th", { children: "Status" })] }) }));
4
4
  }
5
- //# sourceMappingURL=SupportedDevicesHeader.js.map
5
+ //# sourceMappingURL=SupportedDeviceHeader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SupportedDeviceHeader.js","sourceRoot":"","sources":["../../../src/lib/ui/SupportedDeviceTable/SupportedDeviceHeader.tsx"],"names":[],"mappings":";AAAA,MAAM,UAAU,qBAAqB;IACnC,OAAO,CACL,0BACE,yBACE,cAAM,EACN,oCAAiB,EACjB,sCAAmB,EACnB,iDAA8B,EAC9B,2CAAwB,EACxB,kCAAe,IACZ,GACC,CACT,CAAA;AACH,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { DeviceModel } from '../../../lib/ui/SupportedDevices/types.js';
1
+ import type { DeviceModel } from '../../../lib/ui/SupportedDeviceTable/types.js';
2
2
  export interface SupportedDeviceRowProps {
3
3
  deviceModel: DeviceModel;
4
4
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SupportedDeviceRow.js","sourceRoot":"","sources":["../../../src/lib/ui/SupportedDeviceTable/SupportedDeviceRow.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AAQnC,MAAM,UAAU,kBAAkB,CAAC,EAAE,WAAW,EAA2B;IACzE,MAAM,WAAW,GAAG,kBAAkB,CAAC,WAAW,CAAC,aAAa,CAAC,IAAI,MAAM,CAAA;IAC3E,OAAO,CACL,yBACE,uBACE,cAAK,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,WAAW,CAAC,QAAQ,GAAI,GACrD,EACL,uBAAK,WAAW,CAAC,aAAa,GAAM,EACpC,uBAAK,WAAW,CAAC,UAAU,GAAM,EACjC,uBAAK,WAAW,CAAC,qBAAqB,GAAM,EAC5C,uBAAK,WAAW,CAAC,eAAe,GAAM,EACtC,uBACE,cACE,SAAS,EAAE,UAAU,CAAC,kBAAkB,EAAE,UAAU,WAAW,EAAE,CAAC,YAElE,yBAAO,WAAW,CAAC,aAAa,GAAQ,GACpC,GACH,IACF,CACN,CAAA;AACH,CAAC;AAED,MAAM,kBAAkB,GAAG;IACzB,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,QAAQ;CACtB,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { SupportedDeviceContentProps } from '../../../lib/ui/SupportedDeviceTable/SupportedDeviceContent.js';
2
+ export type SupportedDeviceTableProps = SupportedDeviceContentProps;
3
+ export declare function SupportedDeviceTable(props: SupportedDeviceContentProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
3
+ import { SupportedDeviceContent } from '../../../lib/ui/SupportedDeviceTable/SupportedDeviceContent.js';
4
+ const client = new QueryClient();
5
+ export function SupportedDeviceTable(props) {
6
+ return (_jsx(QueryClientProvider, { client: client, children: _jsx(SupportedDeviceContent, { ...props }) }));
7
+ }
8
+ //# sourceMappingURL=SupportedDeviceTable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SupportedDeviceTable.js","sourceRoot":"","sources":["../../../src/lib/ui/SupportedDeviceTable/SupportedDeviceTable.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAGxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uDAAuD,CAAA;AAE9F,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAA;AAIhC,MAAM,UAAU,oBAAoB,CAAC,KAAkC;IACrE,OAAO,CACL,KAAC,mBAAmB,IAAC,MAAM,EAAE,MAAM,YACjC,KAAC,sBAAsB,OAAK,KAAK,GAAI,GACjB,CACvB,CAAA;AACH,CAAC"}
@@ -8,3 +8,8 @@ export interface DeviceModel {
8
8
  icon_url: string;
9
9
  seam_device_model_page_url: string;
10
10
  }
11
+ export interface Filters {
12
+ supportedOnly: boolean;
13
+ category: string | null;
14
+ brand: string | null;
15
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/ui/SupportedDeviceTable/types.ts"],"names":[],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  export function TableHeader({ children }) {
3
- return _jsx("div", { className: 'seam-table-header', children: children });
3
+ return (_jsx("div", { className: 'seam-table-header', children: _jsx("div", { className: 'seam-body', children: children }) }));
4
4
  }
5
5
  //# sourceMappingURL=TableHeader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TableHeader.js","sourceRoot":"","sources":["../../../src/lib/ui/Table/TableHeader.tsx"],"names":[],"mappings":";AAEA,MAAM,UAAU,WAAW,CAAC,EAAE,QAAQ,EAAqB;IACzD,OAAO,cAAK,SAAS,EAAC,mBAAmB,YAAE,QAAQ,GAAO,CAAA;AAC5D,CAAC"}
1
+ {"version":3,"file":"TableHeader.js","sourceRoot":"","sources":["../../../src/lib/ui/Table/TableHeader.tsx"],"names":[],"mappings":";AAEA,MAAM,UAAU,WAAW,CAAC,EAAE,QAAQ,EAAqB;IACzD,OAAO,CACL,cAAK,SAAS,EAAC,mBAAmB,YAChC,cAAK,SAAS,EAAC,WAAW,YAAE,QAAQ,GAAO,GACvC,CACP,CAAA;AACH,CAAC"}
@@ -1,2 +1,2 @@
1
1
  import { type TextFieldProps } from '../../../lib/ui/TextField/TextField.js';
2
- export declare function SearchTextField({ className, ...props }: TextFieldProps): JSX.Element;
2
+ export declare function SearchTextField({ className, value, onChange, ...props }: TextFieldProps): JSX.Element;
@@ -1,7 +1,57 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import classNames from 'classnames';
3
+ import { useEffect, useState } from 'react';
4
+ import { CloseIcon } from '../../../lib/icons/Close.js';
5
+ import { SearchIcon } from '../../../lib/icons/Search.js';
3
6
  import { TextField } from '../../../lib/ui/TextField/TextField.js';
4
- export function SearchTextField({ className, ...props }) {
5
- return (_jsx(TextField, { ...props, className: classNames(className, 'seam-search-text-field') }));
7
+ export function SearchTextField({ className, value, onChange, ...props }) {
8
+ const [inputEl, setInputEl] = useState(null);
9
+ const valueIsEmpty = useValueIsEmpty(value, inputEl);
10
+ const clearInput = () => {
11
+ if (onChange != null) {
12
+ onChange('');
13
+ return;
14
+ }
15
+ if (inputEl != null) {
16
+ inputEl.value = '';
17
+ }
18
+ };
19
+ return (_jsx(TextField, { value: value, onChange: onChange, ...props, className: classNames(className, 'seam-search-text-field'), startAdornment: _jsx(SearchIcon, {}), inputProps: {
20
+ ref: setInputEl,
21
+ placeholder: 'Search',
22
+ }, endAdornment: _jsx("button", { className: classNames({
23
+ 'seam-hidden': valueIsEmpty,
24
+ }), onClick: clearInput, children: _jsx(CloseIcon, {}) }) }));
25
+ }
26
+ function useValueIsEmpty(value, inputEl) {
27
+ const [valueIsEmpty, setValueIsEmpty] = useState(true);
28
+ // If this is a controlled element, we'll just look at `value`
29
+ useEffect(() => {
30
+ setValueIsEmpty(value == null || value === '');
31
+ }, [value]);
32
+ // If this is not a controlled element, we'll need to listen to `input`
33
+ // events.
34
+ useEffect(() => {
35
+ if (inputEl == null) {
36
+ return;
37
+ }
38
+ const handler = (event) => {
39
+ if (value !== undefined) {
40
+ return;
41
+ }
42
+ if (event.target == null || !('value' in event.target)) {
43
+ return;
44
+ }
45
+ const inputValue = event.target.value;
46
+ if (value === undefined) {
47
+ setValueIsEmpty(inputValue === '');
48
+ }
49
+ };
50
+ inputEl.addEventListener('input', handler);
51
+ return () => {
52
+ inputEl.removeEventListener('input', handler);
53
+ };
54
+ }, [inputEl, value]);
55
+ return valueIsEmpty;
6
56
  }
7
57
  //# sourceMappingURL=SearchTextField.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SearchTextField.js","sourceRoot":"","sources":["../../../src/lib/ui/TextField/SearchTextField.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AAEnC,OAAO,EAAE,SAAS,EAAuB,MAAM,+BAA+B,CAAA;AAE9E,MAAM,UAAU,eAAe,CAAC,EAC9B,SAAS,EACT,GAAG,KAAK,EACO;IACf,OAAO,CACL,KAAC,SAAS,OACJ,KAAK,EACT,SAAS,EAAE,UAAU,CAAC,SAAS,EAAE,wBAAwB,CAAC,GAC1D,CACH,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"SearchTextField.js","sourceRoot":"","sources":["../../../src/lib/ui/TextField/SearchTextField.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE3C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAChD,OAAO,EAAE,SAAS,EAAuB,MAAM,+BAA+B,CAAA;AAE9E,MAAM,UAAU,eAAe,CAAC,EAC9B,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACO;IACf,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAA0B,IAAI,CAAC,CAAA;IAErE,MAAM,YAAY,GAAG,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;IACpD,MAAM,UAAU,GAAG,GAAG,EAAE;QAC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AM,UAAU,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAA;YACrC,IAAI,KAAK,KAAK,SAAS,EAAE;gBACvB,eAAe,CAAC,UAAU,KAAK,EAAE,CAAC,CAAA;aACnC;QACH,CAAC,CAAA;QAED,OAAO,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAE1C,OAAO,GAAG,EAAE;YACV,OAAO,CAAC,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;QAC/C,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAA;IAEpB,OAAO,YAAY,CAAA;AACrB,CAAC"}
@@ -1,7 +1,14 @@
1
- import type { ChangeEvent, InputHTMLAttributes } from 'react';
2
- export type TextFieldProps = {
1
+ import type { ChangeEvent, InputHTMLAttributes, MutableRefObject } from 'react';
2
+ export interface TextFieldProps {
3
3
  value?: string;
4
- onChange: (value: string) => void;
5
- } & Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange'>;
4
+ onChange?: (value: string) => void;
5
+ startAdornment?: JSX.Element;
6
+ endAdornment?: JSX.Element;
7
+ disabled?: boolean;
8
+ className?: string;
9
+ inputProps?: {
10
+ ref?: MutableRefObject<HTMLInputElement | null> | ((inputEl: HTMLInputElement) => void);
11
+ } & Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange'>;
12
+ }
6
13
  export declare function TextField(props: TextFieldProps): JSX.Element;
7
14
  export declare const handleString: (setter: (v: string) => void) => (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
@@ -1,8 +1,10 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import classNames from 'classnames';
3
3
  export function TextField(props) {
4
- const { value, onChange, className, ...inputProps } = props;
5
- return (_jsx("input", { className: classNames('seam-text-field', className), value: value, onChange: handleString(onChange), type: 'text', ...inputProps }));
4
+ const { value, onChange, className, startAdornment, endAdornment, inputProps, disabled, } = props;
5
+ return (_jsxs("div", { className: classNames('seam-text-field', className, {
6
+ 'seam-disabled': disabled,
7
+ }), children: [startAdornment != null && (_jsx("div", { className: 'seam-adornment seam-start', children: startAdornment })), _jsx("input", { className: 'seam-text-field-input', value: value, onChange: onChange == null ? undefined : handleString(onChange), type: 'text', disabled: disabled, ...inputProps }), endAdornment != null && (_jsx("div", { className: 'seam-adornment seam-end', children: endAdornment }))] }));
6
8
  }
7
9
  export const handleString = (setter) => (event) => {
8
10
  setter(event.currentTarget.value);
@@ -1 +1 @@
1
- {"version":3,"file":"TextField.js","sourceRoot":"","sources":["../../../src/lib/ui/TextField/TextField.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AAQnC,MAAM,UAAU,SAAS,CAAC,KAAqB;IAC7C,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAA;IAC3D,OAAO,CACL,gBACE,SAAS,EAAE,UAAU,CAAC,iBAAiB,EAAE,SAAS,CAAC,EACnD,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,YAAY,CAAC,QAAQ,CAAC,EAChC,IAAI,EAAC,MAAM,KACP,UAAU,GACd,CACH,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GACvB,CAAC,MAA2B,EAAE,EAAE,CAChC,CAAC,KAA0D,EAAQ,EAAE;IACnE,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;AACnC,CAAC,CAAA"}
1
+ {"version":3,"file":"TextField.js","sourceRoot":"","sources":["../../../src/lib/ui/TextField/TextField.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AAiBnC,MAAM,UAAU,SAAS,CAAC,KAAqB;IAC7C,MAAM,EACJ,KAAK,EACL,QAAQ,EACR,SAAS,EACT,cAAc,EACd,YAAY,EACZ,UAAU,EACV,QAAQ,GACT,GAAG,KAAK,CAAA;IAET,OAAO,CACL,eACE,SAAS,EAAE,UAAU,CAAC,iBAAiB,EAAE,SAAS,EAAE;YAClD,eAAe,EAAE,QAAQ;SAC1B,CAAC,aAED,cAAc,IAAI,IAAI,IAAI,CACzB,cAAK,SAAS,EAAC,2BAA2B,YAAE,cAAc,GAAO,CAClE,EACD,gBACE,SAAS,EAAC,uBAAuB,EACjC,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,EAC/D,IAAI,EAAC,MAAM,EACX,QAAQ,EAAE,QAAQ,KACd,UAAU,GACd,EACD,YAAY,IAAI,IAAI,IAAI,CACvB,cAAK,SAAS,EAAC,yBAAyB,YAAE,YAAY,GAAO,CAC9D,IACG,CACP,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GACvB,CAAC,MAA2B,EAAE,EAAE,CAChC,CAAC,KAA0D,EAAQ,EAAE;IACnE,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;AACnC,CAAC,CAAA"}
package/lib/ui/index.d.ts CHANGED
@@ -2,4 +2,4 @@ export * from './AccessCodeDetails/AccessCodeDetails.js';
2
2
  export * from './AccessCodeTable/AccessCodeTable.js';
3
3
  export * from './DeviceDetails/DeviceDetails.js';
4
4
  export * from './DeviceTable/DeviceTable.js';
5
- export * from './SupportedDevices/SupportedDevices.js';
5
+ export * from './SupportedDeviceTable/SupportedDeviceTable.js';
package/lib/ui/index.js CHANGED
@@ -2,5 +2,5 @@ export * from './AccessCodeDetails/AccessCodeDetails.js';
2
2
  export * from './AccessCodeTable/AccessCodeTable.js';
3
3
  export * from './DeviceDetails/DeviceDetails.js';
4
4
  export * from './DeviceTable/DeviceTable.js';
5
- export * from './SupportedDevices/SupportedDevices.js';
5
+ export * from './SupportedDeviceTable/SupportedDeviceTable.js';
6
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAA;AACxD,cAAc,sCAAsC,CAAA;AACpD,cAAc,kCAAkC,CAAA;AAChD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wCAAwC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,0CAA0C,CAAA;AACxD,cAAc,sCAAsC,CAAA;AACpD,cAAc,kCAAkC,CAAA;AAChD,cAAc,8BAA8B,CAAA;AAC5C,cAAc,gDAAgD,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamapi/react",
3
- "version": "0.26.1",
3
+ "version": "0.28.0",
4
4
  "description": "Seam React component library.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -0,0 +1,3 @@
1
+ export function capitalize(str: string): string {
2
+ return str.charAt(0).toUpperCase() + str.slice(1)
3
+ }
@@ -0,0 +1,19 @@
1
+ import type { SVGProps } from 'react'
2
+ export const ChevronDownIcon = (
3
+ props: SVGProps<SVGSVGElement>
4
+ ): JSX.Element => (
5
+ <svg
6
+ xmlns='http://www.w3.org/2000/svg'
7
+ width={20}
8
+ height={20}
9
+ fill='none'
10
+ {...props}
11
+ >
12
+ <g mask='url(#chevron-down_svg__mask0_1045_100036)'>
13
+ <path
14
+ fill='#6E7179'
15
+ d='m10 12.813-5-5 1.167-1.167L10 10.479l3.833-3.833L15 7.813l-5 5Z'
16
+ />
17
+ </g>
18
+ </svg>
19
+ )
@@ -0,0 +1,30 @@
1
+ import type { SVGProps } from 'react'
2
+ export const CloseIcon = (props: SVGProps<SVGSVGElement>): JSX.Element => (
3
+ <svg
4
+ xmlns='http://www.w3.org/2000/svg'
5
+ width={24}
6
+ height={24}
7
+ fill='none'
8
+ {...props}
9
+ >
10
+ <mask
11
+ id='close_svg__a'
12
+ width={24}
13
+ height={24}
14
+ x={0}
15
+ y={0}
16
+ maskUnits='userSpaceOnUse'
17
+ style={{
18
+ maskType: 'alpha',
19
+ }}
20
+ >
21
+ <path fill='#D9D9D9' d='M0 0h24v24H0z' />
22
+ </mask>
23
+ <g mask='url(#close_svg__a)'>
24
+ <path
25
+ fill='#B9BEC5'
26
+ d='M6.4 19 5 17.6l5.6-5.6L5 6.4 6.4 5l5.6 5.6L17.6 5 19 6.4 13.4 12l5.6 5.6-1.4 1.4-5.6-5.6L6.4 19Z'
27
+ />
28
+ </g>
29
+ </svg>
30
+ )
@@ -0,0 +1,30 @@
1
+ import type { SVGProps } from 'react'
2
+ export const SearchIcon = (props: SVGProps<SVGSVGElement>): JSX.Element => (
3
+ <svg
4
+ xmlns='http://www.w3.org/2000/svg'
5
+ width={20}
6
+ height={20}
7
+ fill='none'
8
+ {...props}
9
+ >
10
+ <mask
11
+ id='search_svg__a'
12
+ width={20}
13
+ height={20}
14
+ x={0}
15
+ y={0}
16
+ maskUnits='userSpaceOnUse'
17
+ style={{
18
+ maskType: 'alpha',
19
+ }}
20
+ >
21
+ <path fill='#D9D9D9' d='M0 0h20v20H0z' />
22
+ </mask>
23
+ <g mask='url(#search_svg__a)'>
24
+ <path
25
+ fill='#6E7179'
26
+ d='m16.333 17.5-5.25-5.25a5.08 5.08 0 0 1-3.167 1.083c-1.513 0-2.794-.524-3.843-1.572C3.024 10.71 2.5 9.43 2.5 7.917c0-1.514.524-2.796 1.573-3.845C5.122 3.024 6.403 2.5 7.917 2.5c1.514 0 2.795.524 3.844 1.572 1.048 1.05 1.572 2.33 1.572 3.845a5.08 5.08 0 0 1-1.083 3.166l5.25 5.25-1.167 1.167Zm-8.416-5.833c1.041 0 1.927-.365 2.656-1.094.73-.73 1.094-1.615 1.094-2.656 0-1.042-.365-1.928-1.094-2.657-.73-.729-1.615-1.093-2.656-1.093-1.042 0-1.928.364-2.657 1.093-.729.73-1.093 1.615-1.093 2.657 0 1.041.364 1.927 1.093 2.656.73.73 1.615 1.094 2.657 1.094Z'
27
+ />
28
+ </g>
29
+ </svg>
30
+ )
@@ -1,11 +1,12 @@
1
1
  import classNames from 'classnames'
2
+ import type { MouseEventHandler, PropsWithChildren } from 'react'
2
3
 
3
4
  interface ButtonProps {
4
- children?: string
5
5
  variant?: 'solid' | 'outline' | 'neutral'
6
6
  size?: 'small' | 'medium' | 'large'
7
7
  disabled?: boolean
8
- onClick?: () => void
8
+ onClick?: MouseEventHandler<HTMLButtonElement>
9
+ className?: string
9
10
  }
10
11
 
11
12
  export function Button({
@@ -14,12 +15,17 @@ export function Button({
14
15
  size = 'medium',
15
16
  disabled,
16
17
  onClick,
17
- }: ButtonProps): JSX.Element {
18
+ className,
19
+ }: PropsWithChildren<ButtonProps>): JSX.Element {
18
20
  return (
19
21
  <button
20
- className={classNames(`seam-btn seam-btn-${variant} seam-btn-${size}`, {
21
- 'seam-btn-disabled': disabled,
22
- })}
22
+ className={classNames(
23
+ `seam-btn seam-btn-${variant} seam-btn-${size}`,
24
+ {
25
+ 'seam-btn-disabled': disabled,
26
+ },
27
+ className
28
+ )}
23
29
  disabled={disabled}
24
30
  onClick={onClick}
25
31
  >
@@ -16,6 +16,7 @@ import { EmptyPlaceholder } from 'lib/ui/Table/EmptyPlaceholder.js'
16
16
  import { TableBody } from 'lib/ui/Table/TableBody.js'
17
17
  import { TableHeader } from 'lib/ui/Table/TableHeader.js'
18
18
  import { TableTitle } from 'lib/ui/Table/TableTitle.js'
19
+ import { SearchTextField } from 'lib/ui/TextField/SearchTextField.js'
19
20
  import { Caption } from 'lib/ui/typography/Caption.js'
20
21
 
21
22
  export type DeviceTableProps = Props & UseDevicesParams
@@ -31,6 +32,7 @@ export function DeviceTable({
31
32
  const { devices, isLoading, isError, error } = useDevices(props)
32
33
 
33
34
  const [selectedDeviceId, selectDevice] = useState<string | null>(null)
35
+ const [searchTerm, setSearchTerm] = useState('')
34
36
 
35
37
  if (selectedDeviceId != null) {
36
38
  return (
@@ -57,6 +59,14 @@ export function DeviceTable({
57
59
 
58
60
  const deviceCount = devices.length
59
61
 
62
+ const filteredDevices = devices.filter((device) => {
63
+ if (searchTerm === '') {
64
+ return true
65
+ }
66
+
67
+ return new RegExp(searchTerm, 'i').test(device.properties.name)
68
+ })
69
+
60
70
  return (
61
71
  <div className='seam-device-table'>
62
72
  <ContentHeader onBack={onBack} />
@@ -64,9 +74,14 @@ export function DeviceTable({
64
74
  <TableTitle>
65
75
  {t.devices} <Caption>({deviceCount})</Caption>
66
76
  </TableTitle>
77
+ <SearchTextField
78
+ value={searchTerm}
79
+ onChange={setSearchTerm}
80
+ disabled={deviceCount === 0}
81
+ />
67
82
  </TableHeader>
68
83
  <TableBody>
69
- <Body devices={devices} selectDevice={selectDevice} />
84
+ <Body devices={filteredDevices} selectDevice={selectDevice} />
70
85
  </TableBody>
71
86
  </div>
72
87
  )
@@ -0,0 +1,65 @@
1
+ import { ChevronDownIcon } from 'lib/icons/ChevronDown.js'
2
+ import { Menu } from 'lib/ui/Menu/Menu.js'
3
+ import { MenuItem } from 'lib/ui/Menu/MenuItem.js'
4
+
5
+ interface FilterCategoryMenuBaseProps {
6
+ label: string
7
+ options: string[]
8
+ onSelect: (option: string) => void
9
+ buttonLabel?: string
10
+ }
11
+
12
+ export type FilterCategoryMenuProps =
13
+ | (FilterCategoryMenuBaseProps & {
14
+ addAllOption: true
15
+ onAllOptionSelect: () => void
16
+ })
17
+ | (FilterCategoryMenuBaseProps & {
18
+ addAllOption?: false
19
+ onAllOptionSelect?: never
20
+ })
21
+
22
+ export function FilterCategoryMenu({
23
+ label,
24
+ options,
25
+ addAllOption,
26
+ onSelect,
27
+ onAllOptionSelect,
28
+ buttonLabel,
29
+ }: FilterCategoryMenuProps) {
30
+ const usableOptions = addAllOption !== null ? ['All', ...options] : options
31
+
32
+ return (
33
+ <div className='seam-supported-devices-filter-menu-wrap'>
34
+ <p>{label}</p>
35
+ <Menu
36
+ renderButton={({ onOpen }) => (
37
+ <button onClick={onOpen}>
38
+ <span>{buttonLabel}</span>
39
+ <ChevronDownIcon />
40
+ </button>
41
+ )}
42
+ >
43
+ {usableOptions.map((option, index) => (
44
+ <MenuItem
45
+ key={`${index}:${option}`}
46
+ onClick={() => {
47
+ if (option === 'All') {
48
+ onAllOptionSelect?.()
49
+ } else {
50
+ onSelect(option)
51
+ }
52
+ }}
53
+ >
54
+ <span>{option}</span>
55
+ </MenuItem>
56
+ ))}
57
+ </Menu>
58
+ </div>
59
+ )
60
+ }
61
+
62
+ FilterCategoryMenu.defaultProps = {
63
+ addAllOption: true,
64
+ buttonLabel: 'Filter',
65
+ }