@seamapi/react 5.2.1 → 5.2.2

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 (31) hide show
  1. package/README.md +13 -5
  2. package/dist/ecosystem.js +10 -11
  3. package/dist/ecosystem.js.map +1 -1
  4. package/dist/elements.js +5855 -5810
  5. package/dist/elements.js.map +1 -1
  6. package/dist/index.css +91 -22
  7. package/dist/index.css.map +1 -1
  8. package/dist/index.min.css +1 -1
  9. package/dist/index.min.css.map +1 -1
  10. package/lib/seam/components/SupportedDevices/DeviceModelRow.js +23 -31
  11. package/lib/seam/components/SupportedDevices/DeviceModelRow.js.map +1 -1
  12. package/lib/seam/components/SupportedDevices/ManufacturerSection.js +2 -7
  13. package/lib/seam/components/SupportedDevices/ManufacturerSection.js.map +1 -1
  14. package/lib/seam/components/SupportedDevices/RequirementIcon.d.ts +5 -0
  15. package/lib/seam/components/SupportedDevices/RequirementIcon.js +6 -0
  16. package/lib/seam/components/SupportedDevices/RequirementIcon.js.map +1 -0
  17. package/lib/seam/components/SupportedDevices/SupportedDevices.js +8 -3
  18. package/lib/seam/components/SupportedDevices/SupportedDevices.js.map +1 -1
  19. package/lib/seam/components/SupportedDevices/device-models.d.ts +2 -0
  20. package/lib/seam/components/SupportedDevices/device-models.js +25 -2
  21. package/lib/seam/components/SupportedDevices/device-models.js.map +1 -1
  22. package/lib/version.d.ts +1 -1
  23. package/lib/version.js +1 -1
  24. package/package.json +1 -1
  25. package/src/lib/seam/components/SupportedDevices/DeviceModelRow.tsx +82 -66
  26. package/src/lib/seam/components/SupportedDevices/ManufacturerSection.tsx +1 -25
  27. package/src/lib/seam/components/SupportedDevices/RequirementIcon.tsx +34 -0
  28. package/src/lib/seam/components/SupportedDevices/SupportedDevices.tsx +22 -2
  29. package/src/lib/seam/components/SupportedDevices/device-models.ts +33 -4
  30. package/src/lib/version.ts +1 -1
  31. package/src/styles/_supported-devices.scss +106 -21
@@ -1,11 +1,13 @@
1
- import classNames from 'classnames'
2
-
1
+ import { CheckIcon } from 'lib/icons/Check.js'
2
+ import { TriangleWarningOutlineIcon } from 'lib/icons/TriangleWarningOutline.js'
3
3
  import {
4
4
  getCapabilityLabel,
5
+ getCapabilityRequirementMessages,
5
6
  getDeviceModelImageUrl,
6
7
  getDeviceModelName,
7
8
  getSupportedCapabilities,
8
9
  } from 'lib/seam/components/SupportedDevices/device-models.js'
10
+ import { RequirementIcon } from 'lib/seam/components/SupportedDevices/RequirementIcon.js'
9
11
  import type {
10
12
  DeviceModelSummary,
11
13
  Manufacturer,
@@ -29,28 +31,19 @@ export function DeviceModelRow({
29
31
  .filter((id): id is string => id != null && id.length > 0)
30
32
  ),
31
33
  ]
32
- const providers = deviceModel.providers
33
- .map((p) => p.display_name ?? p.slug)
34
- .join(', ')
34
+ const providers = deviceModel.providers.map((p) => p.display_name ?? p.slug)
35
35
  const capabilities = getSupportedCapabilities(deviceModel).filter(
36
36
  (c) => c.name !== 'device_connectivity'
37
37
  )
38
- const requirements = [
39
- ...new Set(
40
- capabilities.flatMap((capability) => [
41
- ...capability.requirements,
42
- ...(capability.supported === 'conditionally' &&
43
- capability.details != null
44
- ? [capability.details]
45
- : []),
46
- ])
47
- ),
48
- ]
49
-
50
- const meta = [
51
- modelIds.length > 0 ? modelIds.slice(0, 2).join(', ') : null,
52
- providers.length > 0 ? t.via(providers) : null,
53
- ].filter((value): value is string => value != null)
38
+ const requirements = new Map<string, Set<string>>()
39
+ for (const capability of capabilities) {
40
+ const messages = getCapabilityRequirementMessages(capability)
41
+ for (const message of messages) {
42
+ const features = requirements.get(message) ?? new Set<string>()
43
+ features.add(getCapabilityLabel(capability.name))
44
+ requirements.set(message, features)
45
+ }
46
+ }
54
47
 
55
48
  return (
56
49
  <li className='seam-supported-devices-row'>
@@ -74,58 +67,78 @@ export function DeviceModelRow({
74
67
  {name}
75
68
  </a>
76
69
  )}
77
- {meta.length > 0 && (
70
+ {deviceModel.device_type != null && (
78
71
  <span className='seam-supported-devices-meta'>
79
- {meta.join(' · ')}
72
+ {deviceModel.device_type.display_name}
80
73
  </span>
81
74
  )}
82
75
  </div>
83
- <ul className='seam-supported-devices-badges' aria-label={t.badges}>
84
- {deviceModel.device_type != null && (
85
- <li className='seam-ecosystem-badge seam-ecosystem-badge-type'>
86
- {deviceModel.device_type.display_name}
87
- </li>
88
- )}
89
- {capabilities.map((capability) => (
90
- <li
91
- key={capability.name}
92
- className={classNames('seam-ecosystem-badge', {
93
- 'seam-ecosystem-badge-conditional':
94
- capability.supported === 'conditionally',
95
- })}
96
- title={
97
- capability.supported === 'conditionally'
98
- ? [
99
- ...capability.requirements,
100
- capability.details ?? t.conditional,
101
- ].join('\n')
102
- : undefined
103
- }
104
- >
105
- {getCapabilityLabel(capability.name)}
106
- {capability.integrationSupportLevel === 'beta' && ' (beta)'}
107
- {capability.supported === 'conditionally' && (
108
- <span className='seam-ecosystem-visually-hidden'>
109
- {` (${t.conditional})`}
76
+ {capabilities.length > 0 && (
77
+ <ul className='seam-supported-devices-features' aria-label={t.features}>
78
+ {capabilities.map((capability) => (
79
+ <li key={capability.name}>
80
+ {capability.supported === 'conditionally' ? (
81
+ <TriangleWarningOutlineIcon
82
+ aria-hidden
83
+ className='seam-supported-devices-conditional-icon'
84
+ />
85
+ ) : (
86
+ <CheckIcon aria-hidden />
87
+ )}
88
+ <span>
89
+ {getCapabilityLabel(capability.name)}
90
+ {capability.integrationSupportLevel === 'beta' && ' (beta)'}
91
+ {capability.supported === 'conditionally' && (
92
+ <span className='seam-ecosystem-visually-hidden'>
93
+ {` (${t.requirementsBelow})`}
94
+ </span>
95
+ )}
110
96
  </span>
111
- )}
112
- </li>
113
- ))}
114
- </ul>
97
+ </li>
98
+ ))}
99
+ </ul>
100
+ )}
115
101
  {deviceModel.capabilities_stale ? (
116
102
  <span className='seam-supported-devices-status'>{t.refreshing}</span>
117
103
  ) : capabilities.length === 0 &&
118
104
  deviceModel.device_type?.is_accessory !== true ? (
119
105
  <span className='seam-supported-devices-status'>{t.unconfirmed}</span>
120
106
  ) : null}
121
- {requirements.length > 0 && (
122
- <details className='seam-supported-devices-requirements'>
123
- <summary>{t.requirements}</summary>
124
- <ul>
125
- {requirements.map((requirement) => (
126
- <li key={requirement}>{requirement}</li>
127
- ))}
128
- </ul>
107
+ {requirements.size > 0 && (
108
+ <ul
109
+ className='seam-supported-devices-requirements'
110
+ aria-label={t.requirements}
111
+ >
112
+ {[...requirements].map(([message, features]) => (
113
+ <li key={message}>
114
+ <RequirementIcon message={message} />
115
+ <div>
116
+ <span>{message}</span>
117
+ <span className='seam-supported-devices-requirement-features'>
118
+ {t.requiredFor([...features].join(', '))}
119
+ </span>
120
+ </div>
121
+ </li>
122
+ ))}
123
+ </ul>
124
+ )}
125
+ {(modelIds.length > 0 || providers.length > 0) && (
126
+ <details className='seam-supported-devices-details'>
127
+ <summary>{t.modelDetails}</summary>
128
+ <dl>
129
+ {modelIds.length > 0 && (
130
+ <div>
131
+ <dt>{t.modelNumbers}</dt>
132
+ <dd>{modelIds.join(', ')}</dd>
133
+ </div>
134
+ )}
135
+ {providers.length > 0 && (
136
+ <div>
137
+ <dt>{t.integration}</dt>
138
+ <dd>{providers.join(', ')}</dd>
139
+ </div>
140
+ )}
141
+ </dl>
129
142
  </details>
130
143
  )}
131
144
  </li>
@@ -133,10 +146,13 @@ export function DeviceModelRow({
133
146
  }
134
147
 
135
148
  const t = {
136
- via: (providers: string) => `via ${providers}`,
137
- badges: 'Device type and capabilities',
138
- conditional: 'conditionally supported',
139
- requirements: 'Requirements and compatibility',
149
+ features: 'Supported features',
150
+ requirements: 'Requirements',
151
+ requirementsBelow: 'see requirements below',
152
+ requiredFor: (features: string) => `For ${features}`,
153
+ modelDetails: 'Model details',
154
+ modelNumbers: 'Model numbers',
155
+ integration: 'Integration',
140
156
  refreshing: 'Compatibility is being refreshed.',
141
157
  unconfirmed: 'Compatibility not confirmed for this integration.',
142
158
  }
@@ -1,4 +1,3 @@
1
- import classNames from 'classnames'
2
1
  import { useState } from 'react'
3
2
 
4
3
  import {
@@ -40,8 +39,6 @@ export function ManufacturerSection({
40
39
  : t.other
41
40
 
42
41
  const logoUrl = getManufacturerLogoUrl(manufacturer)
43
- const darkLogoUrl = getManufacturerLogoUrl(manufacturer, { mono: true })
44
- const hasDarkLogo = darkLogoUrl != null && darkLogoUrl !== logoUrl
45
42
 
46
43
  return (
47
44
  <section className='seam-supported-devices-section'>
@@ -50,28 +47,7 @@ export function ManufacturerSection({
50
47
  {logoUrl == null ? (
51
48
  <span aria-hidden>{name.slice(0, 1)}</span>
52
49
  ) : (
53
- <>
54
- <img
55
- loading='lazy'
56
- src={logoUrl}
57
- alt=''
58
- width={40}
59
- height={40}
60
- className={classNames({
61
- 'seam-ecosystem-light-only': hasDarkLogo,
62
- })}
63
- />
64
- {hasDarkLogo && (
65
- <img
66
- loading='lazy'
67
- src={darkLogoUrl}
68
- alt=''
69
- width={40}
70
- height={40}
71
- className='seam-ecosystem-dark-only'
72
- />
73
- )}
74
- </>
50
+ <img loading='lazy' src={logoUrl} alt='' width={40} height={40} />
75
51
  )}
76
52
  </div>
77
53
  <h3 className='seam-supported-devices-section-title'>{name}</h3>
@@ -0,0 +1,34 @@
1
+ /** The adjacent text carries the meaning of these contextual illustrations. */
2
+ export function RequirementIcon({ message }: { message: string }): JSX.Element {
3
+ return (
4
+ <svg
5
+ className='seam-supported-devices-requirement-icon'
6
+ aria-hidden
7
+ width='20'
8
+ height='20'
9
+ viewBox='0 0 24 24'
10
+ fill='none'
11
+ stroke='currentColor'
12
+ strokeWidth='1.5'
13
+ strokeLinecap='round'
14
+ strokeLinejoin='round'
15
+ >
16
+ {/keypad/i.test(message) ? (
17
+ <>
18
+ <rect x='5' y='2' width='14' height='20' rx='3' />
19
+ <path d='M9 6h6M9 10h.01M12 10h.01M15 10h.01M9 14h.01M12 14h.01M15 14h.01M12 18h.01' />
20
+ </>
21
+ ) : /bridge|hub/i.test(message) ? (
22
+ <>
23
+ <rect x='3' y='12' width='18' height='8' rx='2' />
24
+ <path d='M7 12V8m10 4V8M7 16h.01M11 16h.01M9 5a5 5 0 0 1 6 0M6 2a10 10 0 0 1 12 0' />
25
+ </>
26
+ ) : (
27
+ <>
28
+ <circle cx='12' cy='12' r='9' />
29
+ <path d='M12 11v6m0-10h.01' />
30
+ </>
31
+ )}
32
+ </svg>
33
+ )
34
+ }
@@ -1,6 +1,8 @@
1
1
  import classNames from 'classnames'
2
2
  import { useDeferredValue, useMemo, useState } from 'react'
3
3
 
4
+ import { CheckIcon } from 'lib/icons/Check.js'
5
+ import { TriangleWarningOutlineIcon } from 'lib/icons/TriangleWarningOutline.js'
4
6
  import {
5
7
  applyEmbedExclusions,
6
8
  capabilityLabels,
@@ -330,6 +332,21 @@ export function SupportedDevices({
330
332
  </div>
331
333
  </div>
332
334
  )}
335
+ {!isLoading && !isError && availableDeviceModels.length > 0 && (
336
+ <div
337
+ className='seam-supported-devices-legend'
338
+ aria-label={t.featureStatus}
339
+ >
340
+ <span>
341
+ <CheckIcon aria-hidden />
342
+ {t.supported}
343
+ </span>
344
+ <span>
345
+ <TriangleWarningOutlineIcon aria-hidden />
346
+ {t.requiresSetup}
347
+ </span>
348
+ </div>
349
+ )}
333
350
  {content}
334
351
  </div>
335
352
  )
@@ -382,8 +399,11 @@ const t = {
382
399
  allManufacturers: 'All manufacturers',
383
400
  deviceType: 'Device type',
384
401
  allDeviceTypes: 'All device types',
385
- capability: 'Capability',
386
- allCapabilities: 'All capabilities',
402
+ capability: 'Feature',
403
+ allCapabilities: 'All features',
404
+ featureStatus: 'Feature status',
405
+ supported: 'Supported',
406
+ requiresSetup: 'Requires setup · see requirements below',
387
407
  error: 'An error occurred while loading supported devices.',
388
408
  retry: 'Retry',
389
409
  noDevices: 'No supported devices found.',
@@ -184,6 +184,30 @@ const supportRank = (
184
184
  (level === 'stable' ? 4 : level === 'beta' ? 2 : 0) +
185
185
  (supported === 'yes' ? 1 : 0)
186
186
 
187
+ const genericSupportDetails = new Set([
188
+ 'This feature is supported by this system and can be used through Seam, but please check additional requirements are met.',
189
+ 'Device requires a compatible server bridge',
190
+ ])
191
+
192
+ const isGenericSupportDetail = (details: string): boolean =>
193
+ genericSupportDetails.has(details.trim())
194
+
195
+ /** Keep specific constraints; replace boilerplate with an actionable setup note. */
196
+ export const getCapabilityRequirementMessages = (
197
+ capability: SupportedCapability
198
+ ): string[] => {
199
+ const messages = new Set(capability.requirements)
200
+ if (capability.supported === 'conditionally') {
201
+ if (
202
+ capability.details != null &&
203
+ !isGenericSupportDetail(capability.details)
204
+ )
205
+ messages.add(capability.details)
206
+ if (messages.size === 0) messages.add('Additional setup is required.')
207
+ }
208
+ return [...messages]
209
+ }
210
+
187
211
  const getCapabilityRequirements = (
188
212
  capability: CapabilitySummary,
189
213
  capabilities: CapabilitySummary[],
@@ -195,14 +219,19 @@ const getCapabilityRequirements = (
195
219
  (requirement) => requirement.message
196
220
  )
197
221
  for (const name of capability.report?.dependencies ?? []) {
222
+ if (visited.has(name)) continue
198
223
  const dependency = capabilities.find((c) => c.name === name)
199
224
  if (dependency == null) continue
200
- if (dependency.supported !== 'yes' && dependency.report?.details != null) {
225
+ const nested = getCapabilityRequirements(dependency, capabilities, visited)
226
+ if (
227
+ dependency.supported !== 'yes' &&
228
+ dependency.report?.details != null &&
229
+ (nested.length === 0 ||
230
+ !isGenericSupportDetail(dependency.report.details))
231
+ ) {
201
232
  requirements.push(dependency.report.details)
202
233
  }
203
- requirements.push(
204
- ...getCapabilityRequirements(dependency, capabilities, visited)
205
- )
234
+ requirements.push(...nested)
206
235
  }
207
236
  return [...new Set(requirements)]
208
237
  }
@@ -1,3 +1,3 @@
1
- const seamapiReactVersion = '5.2.1'
1
+ const seamapiReactVersion = '5.2.2'
2
2
 
3
3
  export default seamapiReactVersion
@@ -2,6 +2,36 @@
2
2
  .seam-supported-devices {
3
3
  container-type: inline-size;
4
4
 
5
+ .seam-ecosystem-controls {
6
+ width: 100%;
7
+ margin-left: 0;
8
+ }
9
+
10
+ .seam-ecosystem-search {
11
+ flex: 1;
12
+ min-width: min(200px, 100%);
13
+ }
14
+
15
+ .seam-supported-devices-legend {
16
+ display: flex;
17
+ flex-wrap: wrap;
18
+ gap: 6px 16px;
19
+ margin-bottom: 12px;
20
+ color: var(--seam-ecosystem-fg-2);
21
+ font-size: 12px;
22
+
23
+ span {
24
+ display: inline-flex;
25
+ align-items: center;
26
+ gap: 4px;
27
+ }
28
+
29
+ svg {
30
+ width: 16px;
31
+ height: 16px;
32
+ }
33
+ }
34
+
5
35
  .seam-supported-devices-sections {
6
36
  display: flex;
7
37
  flex-direction: column;
@@ -32,8 +62,10 @@
32
62
  height: 40px;
33
63
  overflow: hidden;
34
64
  border-radius: 8px;
35
- background: var(--seam-ecosystem-surface-2);
36
- color: var(--seam-ecosystem-fg-2);
65
+
66
+ // Catalog monochrome logos are often black, not dark-mode variants.
67
+ background: #fff;
68
+ color: #434a54;
37
69
  font-weight: 600;
38
70
 
39
71
  img {
@@ -70,9 +102,9 @@
70
102
  .seam-supported-devices-row {
71
103
  display: grid;
72
104
  grid-template-columns: 48px minmax(0, 1fr);
73
- align-items: center;
105
+ align-items: start;
74
106
  gap: 8px 12px;
75
- padding: 12px 16px;
107
+ padding: 20px 16px;
76
108
 
77
109
  &:not(:last-child) {
78
110
  border-bottom: 1px solid var(--seam-ecosystem-line-1);
@@ -81,6 +113,7 @@
81
113
 
82
114
  .seam-supported-devices-image {
83
115
  display: flex;
116
+ grid-row: 1 / span 2;
84
117
  align-items: center;
85
118
  justify-content: center;
86
119
  width: 48px;
@@ -115,21 +148,35 @@
115
148
  }
116
149
 
117
150
  .seam-supported-devices-meta {
118
- overflow: hidden;
119
151
  color: var(--seam-ecosystem-fg-2);
120
152
  font-size: 13px;
121
- white-space: nowrap;
122
- text-overflow: ellipsis;
123
153
  }
124
154
 
125
- .seam-supported-devices-badges {
155
+ .seam-supported-devices-features {
126
156
  display: flex;
127
157
  flex-wrap: wrap;
128
158
  grid-column: 2;
129
- gap: 4px;
159
+ gap: 6px 16px;
130
160
  margin: 0;
131
161
  padding: 0;
132
162
  list-style: none;
163
+ font-size: 13px;
164
+
165
+ li {
166
+ display: flex;
167
+ align-items: center;
168
+ gap: 4px;
169
+ }
170
+
171
+ svg {
172
+ flex-shrink: 0;
173
+ width: 16px;
174
+ height: 16px;
175
+ }
176
+
177
+ .seam-supported-devices-conditional-icon path {
178
+ fill: #d48c23;
179
+ }
133
180
  }
134
181
 
135
182
  .seam-supported-devices-section-footer {
@@ -140,29 +187,67 @@
140
187
  }
141
188
 
142
189
  .seam-supported-devices-status,
143
- .seam-supported-devices-requirements {
190
+ .seam-supported-devices-requirements,
191
+ .seam-supported-devices-details {
144
192
  grid-column: 2 / -1;
145
193
  color: var(--seam-ecosystem-fg-2);
146
194
  font-size: 13px;
147
195
  }
148
196
 
149
- .seam-supported-devices-requirements summary {
150
- cursor: pointer;
197
+ .seam-supported-devices-requirements {
198
+ display: grid;
199
+ gap: 12px;
200
+ margin: 4px 0;
201
+ padding: 12px;
202
+ border-radius: 8px;
203
+ background: var(--seam-ecosystem-surface-2);
204
+ list-style: none;
205
+
206
+ li {
207
+ display: flex;
208
+ align-items: start;
209
+ gap: 10px;
210
+ }
211
+
212
+ .seam-supported-devices-requirement-icon {
213
+ flex-shrink: 0;
214
+ margin-top: 2px;
215
+ color: var(--seam-ecosystem-fg-1);
216
+ }
151
217
  }
152
218
 
153
- .seam-supported-devices-requirements ul {
154
- margin: 8px 0 0;
155
- padding-left: 20px;
219
+ .seam-supported-devices-requirement-features {
220
+ display: block;
221
+ margin-top: 2px;
222
+ color: var(--seam-ecosystem-fg-2);
223
+ font-size: 12px;
156
224
  }
157
225
 
158
- @container (width >= 720px) {
159
- .seam-supported-devices-row {
160
- grid-template-columns: 48px minmax(0, 1fr) minmax(0, 45%);
226
+ .seam-supported-devices-details {
227
+ overflow-wrap: anywhere;
228
+
229
+ summary {
230
+ width: fit-content;
231
+ cursor: pointer;
232
+
233
+ &:focus-visible {
234
+ outline: 2px solid var(--seam-ecosystem-accent);
235
+ outline-offset: 4px;
236
+ }
237
+ }
238
+
239
+ dl {
240
+ display: grid;
241
+ gap: 8px;
242
+ margin-top: 10px;
243
+ }
244
+
245
+ dt {
246
+ font-weight: 600;
161
247
  }
162
248
 
163
- .seam-supported-devices-badges {
164
- grid-column: 3;
165
- justify-content: flex-end;
249
+ dd {
250
+ margin: 2px 0 0;
166
251
  }
167
252
  }
168
253
  }