@seamapi/react 1.6.0 → 1.8.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 (212) hide show
  1. package/README.md +18 -5
  2. package/dist/elements.js +25043 -0
  3. package/dist/elements.js.map +1 -0
  4. package/hooks.d.ts +1 -0
  5. package/hooks.js +2 -0
  6. package/hooks.js.map +1 -0
  7. package/index.css +6 -0
  8. package/index.css.map +1 -1
  9. package/index.min.css +1 -1
  10. package/index.min.css.map +1 -1
  11. package/lib/{sort-by.d.ts → dates.d.ts} +1 -1
  12. package/lib/{sort-by.js → dates.js} +2 -2
  13. package/lib/dates.js.map +1 -0
  14. package/lib/index.d.ts +2 -2
  15. package/lib/index.js +2 -2
  16. package/lib/index.js.map +1 -1
  17. package/lib/{SeamProvider.d.ts → seam/SeamProvider.d.ts} +9 -6
  18. package/lib/{SeamProvider.js → seam/SeamProvider.js} +29 -30
  19. package/lib/seam/SeamProvider.js.map +1 -0
  20. package/lib/seam/access-codes/use-access-codes.js +2 -2
  21. package/lib/seam/access-codes/use-access-codes.js.map +1 -1
  22. package/lib/{ui → seam/components}/AccessCodeDetails/AccessCodeDetails.d.ts +2 -1
  23. package/lib/{ui → seam/components}/AccessCodeDetails/AccessCodeDetails.js +9 -8
  24. package/lib/seam/components/AccessCodeDetails/AccessCodeDetails.js.map +1 -0
  25. package/lib/{ui → seam/components}/AccessCodeDetails/AccessCodeDevice.js +7 -7
  26. package/lib/seam/components/AccessCodeDetails/AccessCodeDevice.js.map +1 -0
  27. package/lib/seam/components/AccessCodeTable/AccessCodeTable.d.ts +7 -0
  28. package/lib/seam/components/AccessCodeTable/AccessCodeTable.js +77 -0
  29. package/lib/seam/components/AccessCodeTable/AccessCodeTable.js.map +1 -0
  30. package/lib/{ui → seam/components}/AccessCodeTable/CodeDetails.js +3 -3
  31. package/lib/seam/components/AccessCodeTable/CodeDetails.js.map +1 -0
  32. package/lib/seam/components/DeviceDetails/DeviceDetails.d.ts +7 -0
  33. package/lib/seam/components/DeviceDetails/DeviceDetails.js +80 -0
  34. package/lib/seam/components/DeviceDetails/DeviceDetails.js.map +1 -0
  35. package/lib/seam/components/DeviceDetails/DeviceModel.js.map +1 -0
  36. package/lib/{ui → seam/components}/DeviceTable/DeviceHealthBar.d.ts +3 -2
  37. package/lib/{ui → seam/components}/DeviceTable/DeviceHealthBar.js +4 -4
  38. package/lib/seam/components/DeviceTable/DeviceHealthBar.js.map +1 -0
  39. package/lib/{ui → seam/components}/DeviceTable/DeviceRow.d.ts +1 -1
  40. package/lib/{ui → seam/components}/DeviceTable/DeviceRow.js +9 -9
  41. package/lib/seam/components/DeviceTable/DeviceRow.js.map +1 -0
  42. package/lib/seam/components/DeviceTable/DeviceTable.d.ts +9 -0
  43. package/lib/seam/components/DeviceTable/DeviceTable.js +66 -0
  44. package/lib/seam/components/DeviceTable/DeviceTable.js.map +1 -0
  45. package/lib/seam/components/SupportedDeviceTable/FilterCategoryMenu.d.ts +20 -0
  46. package/lib/{ui → seam/components}/SupportedDeviceTable/FilterCategoryMenu.js +8 -5
  47. package/lib/seam/components/SupportedDeviceTable/FilterCategoryMenu.js.map +1 -0
  48. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.d.ts +9 -0
  49. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.js +39 -0
  50. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.js.map +1 -0
  51. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.d.ts +9 -0
  52. package/lib/{ui → seam/components}/SupportedDeviceTable/SupportedDeviceFilterArea.js +33 -28
  53. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterArea.js.map +1 -0
  54. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceHeader.d.ts +2 -0
  55. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceHeader.js +12 -0
  56. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceHeader.js.map +1 -0
  57. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.d.ts +6 -0
  58. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.js +19 -0
  59. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.js.map +1 -0
  60. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.d.ts +6 -0
  61. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.js +17 -0
  62. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.js.map +1 -0
  63. package/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.d.ts +7 -0
  64. package/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.js +18 -0
  65. package/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.js.map +1 -0
  66. package/lib/seam/components/index.js.map +1 -0
  67. package/lib/seam/device-models/use-device-models.d.ts +5 -0
  68. package/lib/seam/device-models/use-device-models.js +17 -0
  69. package/lib/seam/device-models/use-device-models.js.map +1 -0
  70. package/lib/seam/devices/use-devices.js +3 -3
  71. package/lib/seam/devices/use-devices.js.map +1 -1
  72. package/lib/seam/devices/use-toggle-lock.js +1 -1
  73. package/lib/seam/devices/use-toggle-lock.js.map +1 -1
  74. package/lib/seam/index.d.ts +1 -0
  75. package/lib/seam/index.js +1 -0
  76. package/lib/seam/index.js.map +1 -1
  77. package/lib/seam/use-seam-client.js +1 -1
  78. package/lib/seam/use-seam-client.js.map +1 -1
  79. package/lib/seam/use-seam-font.d.ts +1 -1
  80. package/lib/seam/use-seam-font.js +1 -1
  81. package/lib/seam/use-seam-font.js.map +1 -1
  82. package/lib/seam/use-seam-styles.js.map +1 -1
  83. package/lib/{capitalize.js → strings.js} +1 -1
  84. package/lib/strings.js.map +1 -0
  85. package/lib/ui/Menu/Menu.d.ts +1 -1
  86. package/lib/ui/Menu/Menu.js.map +1 -1
  87. package/lib/ui/Menu/MenuItem.d.ts +1 -1
  88. package/lib/ui/Menu/MoreActionsMenu.d.ts +1 -1
  89. package/lib/ui/Table/TableFilterBar/TableFilterBar.d.ts +2 -1
  90. package/lib/ui/Table/TableFilterBar/TableFilterItem.d.ts +2 -1
  91. package/lib/ui/TextField/SearchTextField.js.map +1 -1
  92. package/lib/{copy-to-clipboard.js → ui/clipboard.js} +1 -1
  93. package/lib/ui/clipboard.js.map +1 -0
  94. package/lib/ui/use-interval.js.map +1 -0
  95. package/lib/{use-is-date-in-past.js → ui/use-is-date-in-past.js} +1 -1
  96. package/lib/ui/use-is-date-in-past.js.map +1 -0
  97. package/lib/ui/use-toggle.js.map +1 -0
  98. package/lib/version.d.ts +2 -2
  99. package/lib/version.js +3 -1
  100. package/lib/version.js.map +1 -1
  101. package/package.json +21 -8
  102. package/src/elements.ts +27 -0
  103. package/src/hooks.ts +1 -0
  104. package/src/lib/{sort-by.ts → dates.ts} +1 -1
  105. package/src/lib/element.tsx +86 -0
  106. package/src/lib/index.ts +2 -2
  107. package/src/lib/{SeamProvider.tsx → seam/SeamProvider.tsx} +53 -46
  108. package/src/lib/seam/access-codes/use-access-codes.ts +2 -2
  109. package/src/lib/seam/components/AccessCodeDetails/AccessCodeDetails.element.ts +12 -0
  110. package/src/lib/{ui → seam/components}/AccessCodeDetails/AccessCodeDetails.tsx +9 -6
  111. package/src/lib/{ui → seam/components}/AccessCodeDetails/AccessCodeDevice.tsx +2 -2
  112. package/src/lib/seam/components/AccessCodeTable/AccessCodeTable.element.ts +12 -0
  113. package/src/lib/{ui → seam/components}/AccessCodeTable/AccessCodeTable.tsx +30 -11
  114. package/src/lib/{ui → seam/components}/AccessCodeTable/CodeDetails.tsx +2 -3
  115. package/src/lib/seam/components/DeviceDetails/DeviceDetails.element.ts +12 -0
  116. package/src/lib/{ui → seam/components}/DeviceDetails/DeviceDetails.tsx +22 -12
  117. package/src/lib/{ui → seam/components}/DeviceTable/DeviceHealthBar.tsx +1 -1
  118. package/src/lib/{ui → seam/components}/DeviceTable/DeviceRow.tsx +1 -1
  119. package/src/lib/seam/components/DeviceTable/DeviceTable.element.ts +11 -0
  120. package/src/lib/{ui → seam/components}/DeviceTable/DeviceTable.tsx +15 -12
  121. package/src/lib/{ui → seam/components}/SupportedDeviceTable/FilterCategoryMenu.tsx +26 -13
  122. package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.tsx +120 -0
  123. package/src/lib/{ui → seam/components}/SupportedDeviceTable/SupportedDeviceFilterArea.tsx +43 -39
  124. package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceHeader.tsx +22 -0
  125. package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceRow.tsx +48 -0
  126. package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.element.ts +11 -0
  127. package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.tsx +48 -0
  128. package/src/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.ts +35 -0
  129. package/src/lib/seam/components/elements.ts +5 -0
  130. package/src/lib/seam/device-models/use-device-models.ts +34 -0
  131. package/src/lib/seam/devices/use-devices.ts +3 -3
  132. package/src/lib/seam/devices/use-toggle-lock.ts +1 -2
  133. package/src/lib/seam/index.ts +1 -0
  134. package/src/lib/seam/use-seam-client.ts +1 -1
  135. package/src/lib/seam/use-seam-font.ts +5 -1
  136. package/src/lib/seam/use-seam-styles.ts +1 -1
  137. package/src/lib/ui/Menu/Menu.tsx +4 -4
  138. package/src/lib/ui/Menu/MenuItem.tsx +1 -1
  139. package/src/lib/ui/Menu/MoreActionsMenu.tsx +1 -1
  140. package/src/lib/ui/Table/TableFilterBar/TableFilterBar.tsx +2 -2
  141. package/src/lib/ui/Table/TableFilterBar/TableFilterItem.tsx +1 -1
  142. package/src/lib/ui/TextField/SearchTextField.tsx +3 -3
  143. package/src/lib/ui/clipboard.ts +3 -0
  144. package/src/lib/{use-interval.ts → ui/use-interval.ts} +1 -1
  145. package/src/lib/{use-is-date-in-past.ts → ui/use-is-date-in-past.ts} +1 -1
  146. package/src/lib/version.ts +3 -1
  147. package/src/styles/_access-code-table.scss +7 -0
  148. package/lib/SeamProvider.js.map +0 -1
  149. package/lib/capitalize.js.map +0 -1
  150. package/lib/copy-to-clipboard.js.map +0 -1
  151. package/lib/sort-by.js.map +0 -1
  152. package/lib/ui/AccessCodeDetails/AccessCodeDetails.js.map +0 -1
  153. package/lib/ui/AccessCodeDetails/AccessCodeDevice.js.map +0 -1
  154. package/lib/ui/AccessCodeTable/AccessCodeTable.d.ts +0 -6
  155. package/lib/ui/AccessCodeTable/AccessCodeTable.js +0 -69
  156. package/lib/ui/AccessCodeTable/AccessCodeTable.js.map +0 -1
  157. package/lib/ui/AccessCodeTable/CodeDetails.js.map +0 -1
  158. package/lib/ui/DeviceDetails/DeviceDetails.d.ts +0 -6
  159. package/lib/ui/DeviceDetails/DeviceDetails.js +0 -80
  160. package/lib/ui/DeviceDetails/DeviceDetails.js.map +0 -1
  161. package/lib/ui/DeviceDetails/DeviceModel.js.map +0 -1
  162. package/lib/ui/DeviceTable/DeviceHealthBar.js.map +0 -1
  163. package/lib/ui/DeviceTable/DeviceRow.js.map +0 -1
  164. package/lib/ui/DeviceTable/DeviceTable.d.ts +0 -8
  165. package/lib/ui/DeviceTable/DeviceTable.js +0 -65
  166. package/lib/ui/DeviceTable/DeviceTable.js.map +0 -1
  167. package/lib/ui/SupportedDeviceTable/FilterCategoryMenu.d.ts +0 -15
  168. package/lib/ui/SupportedDeviceTable/FilterCategoryMenu.js.map +0 -1
  169. package/lib/ui/SupportedDeviceTable/SupportedDeviceContent.d.ts +0 -4
  170. package/lib/ui/SupportedDeviceTable/SupportedDeviceContent.js +0 -46
  171. package/lib/ui/SupportedDeviceTable/SupportedDeviceContent.js.map +0 -1
  172. package/lib/ui/SupportedDeviceTable/SupportedDeviceFilterArea.d.ts +0 -11
  173. package/lib/ui/SupportedDeviceTable/SupportedDeviceFilterArea.js.map +0 -1
  174. package/lib/ui/SupportedDeviceTable/SupportedDeviceHeader.d.ts +0 -1
  175. package/lib/ui/SupportedDeviceTable/SupportedDeviceHeader.js +0 -5
  176. package/lib/ui/SupportedDeviceTable/SupportedDeviceHeader.js.map +0 -1
  177. package/lib/ui/SupportedDeviceTable/SupportedDeviceRow.d.ts +0 -5
  178. package/lib/ui/SupportedDeviceTable/SupportedDeviceRow.js +0 -12
  179. package/lib/ui/SupportedDeviceTable/SupportedDeviceRow.js.map +0 -1
  180. package/lib/ui/SupportedDeviceTable/SupportedDeviceTable.d.ts +0 -3
  181. package/lib/ui/SupportedDeviceTable/SupportedDeviceTable.js +0 -8
  182. package/lib/ui/SupportedDeviceTable/SupportedDeviceTable.js.map +0 -1
  183. package/lib/ui/SupportedDeviceTable/types.d.ts +0 -15
  184. package/lib/ui/SupportedDeviceTable/types.js +0 -2
  185. package/lib/ui/SupportedDeviceTable/types.js.map +0 -1
  186. package/lib/ui/index.js.map +0 -1
  187. package/lib/use-interval.js.map +0 -1
  188. package/lib/use-is-date-in-past.js.map +0 -1
  189. package/lib/use-toggle.js.map +0 -1
  190. package/src/lib/copy-to-clipboard.ts +0 -3
  191. package/src/lib/ui/SupportedDeviceTable/SupportedDeviceContent.tsx +0 -135
  192. package/src/lib/ui/SupportedDeviceTable/SupportedDeviceHeader.tsx +0 -14
  193. package/src/lib/ui/SupportedDeviceTable/SupportedDeviceRow.tsx +0 -35
  194. package/src/lib/ui/SupportedDeviceTable/SupportedDeviceTable.tsx +0 -16
  195. package/src/lib/ui/SupportedDeviceTable/types.ts +0 -16
  196. /package/lib/{ui → seam/components}/AccessCodeDetails/AccessCodeDevice.d.ts +0 -0
  197. /package/lib/{ui → seam/components}/AccessCodeTable/CodeDetails.d.ts +0 -0
  198. /package/lib/{ui → seam/components}/DeviceDetails/DeviceModel.d.ts +0 -0
  199. /package/lib/{ui → seam/components}/DeviceDetails/DeviceModel.js +0 -0
  200. /package/lib/{ui → seam/components}/index.d.ts +0 -0
  201. /package/lib/{ui → seam/components}/index.js +0 -0
  202. /package/lib/{capitalize.d.ts → strings.d.ts} +0 -0
  203. /package/lib/{copy-to-clipboard.d.ts → ui/clipboard.d.ts} +0 -0
  204. /package/lib/{use-interval.d.ts → ui/use-interval.d.ts} +0 -0
  205. /package/lib/{use-interval.js → ui/use-interval.js} +0 -0
  206. /package/lib/{use-is-date-in-past.d.ts → ui/use-is-date-in-past.d.ts} +0 -0
  207. /package/lib/{use-toggle.d.ts → ui/use-toggle.d.ts} +0 -0
  208. /package/lib/{use-toggle.js → ui/use-toggle.js} +0 -0
  209. /package/src/lib/{ui → seam/components}/DeviceDetails/DeviceModel.tsx +0 -0
  210. /package/src/lib/{ui → seam/components}/index.ts +0 -0
  211. /package/src/lib/{capitalize.ts → strings.ts} +0 -0
  212. /package/src/lib/{use-toggle.ts → ui/use-toggle.ts} +0 -0
@@ -1,15 +0,0 @@
1
- export interface DeviceModel {
2
- main_category: string;
3
- model_name: string;
4
- manufacturer_model_id: string;
5
- connection_type: string;
6
- support_level: 'Live' | 'Beta' | 'Unsupported';
7
- brand: string;
8
- icon_url: string;
9
- seam_device_model_page_url: string;
10
- }
11
- export interface Filters {
12
- supportedOnly: boolean;
13
- category: string | null;
14
- brand: string | null;
15
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/ui/SupportedDeviceTable/types.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-interval.js","sourceRoot":"","sources":["../src/lib/use-interval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAE9C,MAAM,YAAY,GAAG,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC,CAAA;AAE3E,MAAM,UAAU,WAAW,CACzB,QAAoB,EACpB,QAAgB,YAAY;IAE5B,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE;QAC9B,QAAQ,EAAE,CAAA;IACZ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAA;IAEd,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,KAAK,GAAG,UAAU,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QACnD,OAAO,GAAG,EAAE;YACV,UAAU,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;QACjC,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAA;AACrB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-is-date-in-past.js","sourceRoot":"","sources":["../src/lib/use-is-date-in-past.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAExD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE/C,MAAM,UAAU,eAAe,CAC7B,IAA+B;IAE/B,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAiB,IAAI,CAAC,CAAA;IAEtE,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE;QAC9B,IAAI,IAAI,IAAI,IAAI;YAAE,OAAM;QACxB,eAAe,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACnD,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAA;IAEV,SAAS,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC,CAAA;IAC3B,WAAW,CAAC,MAAM,CAAC,CAAA;IAEnB,OAAO,YAAY,CAAA;AACrB,CAAC;AAED,MAAM,QAAQ,GAAG,CAAC,EAAY,EAAkB,EAAE;IAChD,IAAI,CAAC,EAAE,CAAC,OAAO;QAAE,OAAO,IAAI,CAAA;IAC5B,OAAO,EAAE,CAAC,OAAO,EAAE,CAAC,YAAY,GAAG,CAAC,CAAA;AACtC,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-toggle.js","sourceRoot":"","sources":["../src/lib/use-toggle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,eAAwB,KAAK,EACN,EAAE;IACzB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAA;IAElD,uEAAuE;IAEvE,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE;QAC9B,SAAS,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA;IAChC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAA;IAEf,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AACzB,CAAC,CAAA"}
@@ -1,3 +0,0 @@
1
- export async function copyToClipboard(value: string) {
2
- await globalThis?.navigator?.clipboard?.writeText(value)
3
- }
@@ -1,135 +0,0 @@
1
- import { useQuery } from '@tanstack/react-query'
2
- import { useState } from 'react'
3
-
4
- import { Button } from 'lib/ui/Button.js'
5
- import { SupportedDeviceFilterArea } from 'lib/ui/SupportedDeviceTable/SupportedDeviceFilterArea.js'
6
- import type { DeviceModel, Filters } from 'lib/ui/SupportedDeviceTable/types.js'
7
-
8
- import { SupportedDeviceHeader } from './SupportedDeviceHeader.js'
9
- import { SupportedDeviceRow } from './SupportedDeviceRow.js'
10
-
11
- export interface SupportedDeviceContentProps {
12
- cannotFilter?: boolean
13
- }
14
-
15
- export function SupportedDeviceContent({
16
- cannotFilter = false,
17
- }: SupportedDeviceContentProps) {
18
- const [filterValue, setFilterValue] = useState('')
19
- const [filters, setFilters] = useState<Filters>({
20
- supportedOnly: false,
21
- category: null,
22
- brand: null,
23
- })
24
-
25
- const {
26
- data: deviceModels,
27
- isLoading,
28
- isError,
29
- refetch,
30
- } = useQuery<DeviceModel[]>({
31
- queryKey: ['supported_devices', filterValue, filters],
32
- queryFn: async () => {
33
- const url = new URL('https://devicedb.seam.co/api/device_models/list')
34
-
35
- if (filterValue.trim() !== '') {
36
- url.searchParams.set('text_search', filterValue.trim())
37
- }
38
-
39
- if (filters.supportedOnly) {
40
- url.searchParams.set('support_level', 'live')
41
- }
42
-
43
- if (filters.category !== null) {
44
- url.searchParams.set('main_category', filters.category)
45
- }
46
-
47
- if (filters.brand !== null) {
48
- url.searchParams.set('brand', filters.brand)
49
- }
50
-
51
- const res = await fetch(url)
52
- if (!res.ok) {
53
- throw new Error('Failed to load device models')
54
- }
55
- const data = await res.json()
56
- return data?.device_models ?? []
57
- },
58
- })
59
-
60
- return (
61
- <div className='seam-supported-device-table-content-wrap'>
62
- {!cannotFilter && (
63
- <SupportedDeviceFilterArea
64
- deviceModels={deviceModels ?? []}
65
- filterValue={filterValue}
66
- setFilterValue={setFilterValue}
67
- filters={filters}
68
- setFilters={setFilters}
69
- />
70
- )}
71
-
72
- {isLoading && (
73
- <div className='seam-supported-device-table-content-state-block'>
74
- <p>Loading device models...</p>
75
- </div>
76
- )}
77
-
78
- {isError && (
79
- <div className='seam-supported-device-table-content-state-block'>
80
- <p>There was an error fetching device models.</p>
81
- <Button
82
- variant='solid'
83
- size='small'
84
- onClick={() => {
85
- void refetch()
86
- }}
87
- >
88
- Retry
89
- </Button>
90
- </div>
91
- )}
92
-
93
- {!isLoading && !isError && deviceModels !== null && (
94
- <table className='seam-supported-device-table-content'>
95
- <SupportedDeviceHeader />
96
- <tbody>
97
- {deviceModels.length !== 0 &&
98
- deviceModels.map((deviceModel, index) => (
99
- <SupportedDeviceRow
100
- key={`${index}:${deviceModel.manufacturer_model_id}`}
101
- deviceModel={deviceModel}
102
- />
103
- ))}
104
-
105
- {deviceModels.length === 0 && (
106
- <tr className='seam-supported-device-table-content-message-row'>
107
- <td colSpan={6}>
108
- <div className='seam-supported-device-table-content-message'>
109
- {filterValue.length === 0 ? (
110
- <p>No device models found.</p>
111
- ) : (
112
- <>
113
- <p>No device models matched your search.</p>
114
- <Button
115
- variant='outline'
116
- size='small'
117
- onClick={() => {
118
- setFilterValue('')
119
- }}
120
- className='seam-supported-device-table-content-message-clear-search'
121
- >
122
- Clear search terms
123
- </Button>
124
- </>
125
- )}
126
- </div>
127
- </td>
128
- </tr>
129
- )}
130
- </tbody>
131
- </table>
132
- )}
133
- </div>
134
- )
135
- }
@@ -1,14 +0,0 @@
1
- export function SupportedDeviceHeader() {
2
- return (
3
- <thead>
4
- <tr>
5
- <th />
6
- <th>Category</th>
7
- <th>Model Name</th>
8
- <th>Manufacturer Model ID</th>
9
- <th>Connection Type</th>
10
- <th>Status</th>
11
- </tr>
12
- </thead>
13
- )
14
- }
@@ -1,35 +0,0 @@
1
- import classNames from 'classnames'
2
-
3
- import type { DeviceModel } from 'lib/ui/SupportedDeviceTable/types.js'
4
-
5
- export interface SupportedDeviceRowProps {
6
- deviceModel: DeviceModel
7
- }
8
-
9
- export function SupportedDeviceRow({ deviceModel }: SupportedDeviceRowProps) {
10
- const statusColor = supportLevelColors[deviceModel.support_level] ?? 'gray'
11
- return (
12
- <tr>
13
- <td>
14
- <img width={40} src={deviceModel.icon_url} />
15
- </td>
16
- <td>{deviceModel.main_category}</td>
17
- <td>{deviceModel.model_name}</td>
18
- <td>{deviceModel.manufacturer_model_id}</td>
19
- <td>{deviceModel.connection_type}</td>
20
- <td>
21
- <div
22
- className={classNames('seam-status-pill', `status-${statusColor}`)}
23
- >
24
- <span>{deviceModel.support_level}</span>
25
- </div>
26
- </td>
27
- </tr>
28
- )
29
- }
30
-
31
- const supportLevelColors = {
32
- Live: 'green',
33
- Beta: 'blue',
34
- Unsupported: 'orange',
35
- }
@@ -1,16 +0,0 @@
1
- import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
2
-
3
- import type { SupportedDeviceContentProps } from 'lib/ui/SupportedDeviceTable/SupportedDeviceContent.js'
4
- import { SupportedDeviceContent } from 'lib/ui/SupportedDeviceTable/SupportedDeviceContent.js'
5
-
6
- const client = new QueryClient()
7
-
8
- export type SupportedDeviceTableProps = SupportedDeviceContentProps
9
-
10
- export function SupportedDeviceTable(props: SupportedDeviceContentProps) {
11
- return (
12
- <QueryClientProvider client={client}>
13
- <SupportedDeviceContent {...props} />
14
- </QueryClientProvider>
15
- )
16
- }
@@ -1,16 +0,0 @@
1
- export interface DeviceModel {
2
- main_category: string
3
- model_name: string
4
- manufacturer_model_id: string
5
- connection_type: string
6
- support_level: 'Live' | 'Beta' | 'Unsupported'
7
- brand: string
8
- icon_url: string
9
- seam_device_model_page_url: string
10
- }
11
-
12
- export interface Filters {
13
- supportedOnly: boolean
14
- category: string | null
15
- brand: string | null
16
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes