@seamapi/react 1.49.0 → 1.51.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 (69) hide show
  1. package/README.md +1 -1
  2. package/dist/elements.js +9778 -8689
  3. package/dist/elements.js.map +1 -1
  4. package/dist/index.css +170 -0
  5. package/dist/index.css.map +1 -1
  6. package/dist/index.min.css +1 -1
  7. package/dist/index.min.css.map +1 -1
  8. package/lib/icons/Bee.d.ts +2 -0
  9. package/lib/icons/Bee.js +5 -0
  10. package/lib/icons/Bee.js.map +1 -0
  11. package/lib/icons/Fan.d.ts +2 -0
  12. package/lib/icons/Fan.js +7 -0
  13. package/lib/icons/Fan.js.map +1 -0
  14. package/lib/icons/Off.d.ts +2 -0
  15. package/lib/icons/Off.js +7 -0
  16. package/lib/icons/Off.js.map +1 -0
  17. package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleCard.d.ts +2 -1
  18. package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleCard.js +4 -4
  19. package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleCard.js.map +1 -1
  20. package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.js +9 -1
  21. package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.js.map +1 -1
  22. package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDeviceBar.d.ts +2 -1
  23. package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDeviceBar.js +6 -4
  24. package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDeviceBar.js.map +1 -1
  25. package/lib/seam/components/DeviceDetails/DeviceDetails.js +5 -1
  26. package/lib/seam/components/DeviceDetails/DeviceDetails.js.map +1 -1
  27. package/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.d.ts +7 -0
  28. package/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.js +66 -0
  29. package/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.js.map +1 -0
  30. package/lib/seam/connected-accounts/use-connected-account.d.ts +5 -0
  31. package/lib/seam/connected-accounts/use-connected-account.js +17 -0
  32. package/lib/seam/connected-accounts/use-connected-account.js.map +1 -0
  33. package/lib/seam/index.d.ts +2 -0
  34. package/lib/seam/index.js +2 -0
  35. package/lib/seam/index.js.map +1 -1
  36. package/lib/ui/layout/DetailRow.d.ts +3 -1
  37. package/lib/ui/layout/DetailRow.js +5 -2
  38. package/lib/ui/layout/DetailRow.js.map +1 -1
  39. package/lib/ui/thermostat/ClimateSettingStatus.d.ts +1 -1
  40. package/lib/ui/thermostat/ClimateSettingStatus.js +20 -24
  41. package/lib/ui/thermostat/ClimateSettingStatus.js.map +1 -1
  42. package/lib/ui/thermostat/Temperature.d.ts +8 -0
  43. package/lib/ui/thermostat/Temperature.js +11 -0
  44. package/lib/ui/thermostat/Temperature.js.map +1 -0
  45. package/lib/ui/thermostat/ThermostatCard.d.ts +7 -0
  46. package/lib/ui/thermostat/ThermostatCard.js +46 -0
  47. package/lib/ui/thermostat/ThermostatCard.js.map +1 -0
  48. package/lib/version.d.ts +1 -1
  49. package/lib/version.js +1 -1
  50. package/package.json +3 -3
  51. package/src/lib/icons/Bee.tsx +21 -0
  52. package/src/lib/icons/Fan.tsx +36 -0
  53. package/src/lib/icons/Off.tsx +36 -0
  54. package/src/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleCard.tsx +9 -2
  55. package/src/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.tsx +18 -0
  56. package/src/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDeviceBar.tsx +14 -4
  57. package/src/lib/seam/components/DeviceDetails/DeviceDetails.tsx +6 -1
  58. package/src/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.tsx +175 -0
  59. package/src/lib/seam/connected-accounts/use-connected-account.ts +35 -0
  60. package/src/lib/seam/index.ts +2 -0
  61. package/src/lib/ui/layout/DetailRow.tsx +15 -2
  62. package/src/lib/ui/thermostat/ClimateSettingStatus.tsx +34 -30
  63. package/src/lib/ui/thermostat/Temperature.tsx +26 -0
  64. package/src/lib/ui/thermostat/ThermostatCard.tsx +160 -0
  65. package/src/lib/version.ts +1 -1
  66. package/src/styles/_device-details.scss +4 -0
  67. package/src/styles/_layout.scss +36 -0
  68. package/src/styles/_thermostat.scss +160 -0
  69. package/src/styles/_tooltip.scss +1 -0
@@ -0,0 +1,160 @@
1
+ import classNames from 'classnames'
2
+ import { useState } from 'react'
3
+ import type { ThermostatDevice, ThermostatDeviceProperties } from 'seamapi'
4
+
5
+ import { FanIcon } from 'lib/icons/Fan.js'
6
+ import { OffIcon } from 'lib/icons/Off.js'
7
+ import { DeviceImage } from 'lib/ui/device/DeviceImage.js'
8
+ import { ClimateSettingStatus } from 'lib/ui/thermostat/ClimateSettingStatus.js'
9
+ import { Temperature } from 'lib/ui/thermostat/Temperature.js'
10
+
11
+ interface ThermostatCardProps {
12
+ device: ThermostatDevice
13
+ }
14
+
15
+ export function ThermostatCard({ device }: ThermostatCardProps): JSX.Element {
16
+ return (
17
+ <div className='seam-thermostat-card'>
18
+ <Content device={device} />
19
+ </div>
20
+ )
21
+ }
22
+
23
+ function Content(props: { device: ThermostatDevice }): JSX.Element | null {
24
+ const { device } = props
25
+
26
+ const [temperatureUnit, setTemperatureUnit] = useState<
27
+ 'fahrenheit' | 'celsius'
28
+ >('fahrenheit')
29
+
30
+ const toggleTemperatureUnit = (): void => {
31
+ setTemperatureUnit(
32
+ temperatureUnit === 'fahrenheit' ? 'celsius' : 'fahrenheit'
33
+ )
34
+ }
35
+
36
+ const {
37
+ temperature_fahrenheit: temperatureFahrenheit,
38
+ temperature_celsius: temperatureCelsius,
39
+ current_climate_setting: currentClimateSetting,
40
+ is_fan_running: isFanRunning,
41
+ relative_humidity: relativeHumidity,
42
+ } = device.properties
43
+
44
+ const systemStatus = getSystemStatus(device.properties)
45
+
46
+ return (
47
+ <div className='seam-thermostat-card-content'>
48
+ <div className='seam-thermostat-card-image-wrap'>
49
+ <DeviceImage device={device} />
50
+ </div>
51
+ <div className='seam-thermostat-card-details'>
52
+ <div className='seam-thermostat-heading-wrap'>
53
+ <h4 className='seam-thermostat-card-heading'>
54
+ {device.properties.name}
55
+ </h4>
56
+ <button
57
+ onClick={toggleTemperatureUnit}
58
+ className='seam-thermostat-temperature-toggle'
59
+ >
60
+ <span className='seam-thermostat-temperature-toggle-label'>
61
+ {temperatureUnit === 'fahrenheit' ? t.fahrenheit : t.celsius}
62
+ </span>
63
+ </button>
64
+ </div>
65
+
66
+ <div className='seam-thermostat-properties-wrap'>
67
+ <div className='seam-thermostat-properties'>
68
+ <div className='seam-thermostat-property-block'>
69
+ <p className='seam-thermostat-property-label'>{t.temperature}:</p>
70
+ </div>
71
+ <div className='seam-thermostat-property-block'>
72
+ <p className='seam-thermostat-property-value'>
73
+ <Temperature
74
+ fahrenheit={temperatureFahrenheit}
75
+ celsius={temperatureCelsius}
76
+ unit={temperatureUnit}
77
+ />
78
+ </p>
79
+
80
+ <p className='seam-thermostat-property-value'>|</p>
81
+ <p className='seam-thermostat-property-label'>{t.humidity}:</p>
82
+ <p className='seam-thermostat-property-value'>
83
+ {relativeHumidity * 100}%
84
+ </p>
85
+ </div>
86
+
87
+ <div className='seam-thermostat-property-block'>
88
+ <p className='seam-thermostat-property-label'>{t.setting}:</p>
89
+ </div>
90
+ <div className='seam-thermostat-property-block'>
91
+ <ClimateSettingStatus
92
+ climateSetting={currentClimateSetting}
93
+ temperatureUnit={temperatureUnit}
94
+ />
95
+ </div>
96
+
97
+ <div className='seam-thermostat-property-block'>
98
+ <p className='seam-thermostat-property-label'>{t.fanMode}:</p>
99
+ </div>
100
+ <div className='seam-thermostat-property-block seam-thermostat-property-icon-block'>
101
+ <div className='seam-thermostat-property-icon'>
102
+ {isFanRunning ? <FanIcon /> : <OffIcon />}
103
+ </div>
104
+ <p className='seam-thermostat-property-value'>
105
+ {isFanRunning ? t.auto : t.off}
106
+ </p>
107
+ </div>
108
+
109
+ <div className='seam-thermostat-property-block'>
110
+ <p className='seam-thermostat-property-label'>
111
+ {t.systemStatus}:
112
+ </p>
113
+ </div>
114
+ <div className='seam-thermostat-property-block'>
115
+ <div
116
+ className={classNames(
117
+ 'seam-thermostat-property-tag',
118
+ `seam-thermostat-property-tag-${systemStatus}`
119
+ )}
120
+ >
121
+ <p className='seam-thermostat-property-tag-label'>
122
+ {systemStatus === 'off' ? '--' : t[systemStatus]}
123
+ </p>
124
+ </div>
125
+ </div>
126
+ </div>
127
+ </div>
128
+ </div>
129
+ </div>
130
+ )
131
+ }
132
+
133
+ function getSystemStatus(
134
+ properties: ThermostatDeviceProperties
135
+ ): 'heating' | 'cooling' | 'fan' | 'off' {
136
+ const {
137
+ is_heating: isHeating,
138
+ is_cooling: isCooling,
139
+ is_fan_running: isFanRunning,
140
+ } = properties
141
+ if (isHeating) return 'heating'
142
+ if (isCooling) return 'cooling'
143
+ if (isFanRunning) return 'fan'
144
+ return 'off'
145
+ }
146
+
147
+ const t = {
148
+ fahrenheit: '˚F',
149
+ celsius: '˚C',
150
+ auto: 'Auto',
151
+ off: 'Off',
152
+ temperature: 'Temperature',
153
+ humidity: 'Humidity',
154
+ setting: 'Setting',
155
+ fanMode: 'Fan mode',
156
+ systemStatus: 'System status',
157
+ cooling: 'Cooling',
158
+ heating: 'Heating',
159
+ fan: 'Fan only',
160
+ }
@@ -1,3 +1,3 @@
1
- const seamapiReactVersion = '1.49.0'
1
+ const seamapiReactVersion = '1.51.0'
2
2
 
3
3
  export default seamapiReactVersion
@@ -151,5 +151,9 @@
151
151
  justify-content: center;
152
152
  }
153
153
  }
154
+
155
+ .seam-thermostat-device-details {
156
+ margin-top: 8px;
157
+ }
154
158
  }
155
159
  }
@@ -76,6 +76,15 @@
76
76
  &:not(:last-of-type) {
77
77
  border-bottom: 1px solid colors.$divider-stroke-light;
78
78
  }
79
+
80
+ &.seam-detail-row-clickable {
81
+ cursor: pointer;
82
+ transition: 0.2s ease;
83
+
84
+ &:hover {
85
+ background-color: colors.$bg-a;
86
+ }
87
+ }
79
88
  }
80
89
 
81
90
  .seam-detail-row,
@@ -88,11 +97,38 @@
88
97
  padding: 8px 16px;
89
98
  }
90
99
 
100
+ .seam-detail-row-label-wrap {
101
+ display: flex;
102
+ justify-content: center;
103
+ align-items: flex-start;
104
+ flex-direction: column;
105
+ gap: 4px;
106
+ }
107
+
91
108
  .seam-row-label {
92
109
  font-size: 16px;
93
110
  font-weight: 600;
94
111
  line-height: 118%;
95
112
  }
113
+
114
+ .seam-row-sublabel {
115
+ color: colors.$text-gray-1;
116
+ font-size: 14px;
117
+ font-weight: 400;
118
+ line-height: 118%;
119
+ }
120
+
121
+ .seam-detail-row-hstack {
122
+ display: flex;
123
+ justify-content: flex-start;
124
+ align-items: center;
125
+ flex-direction: row;
126
+ gap: 8px;
127
+ }
128
+
129
+ .seam-detail-row-rotated-icon {
130
+ transform: rotate(-90deg);
131
+ }
96
132
  }
97
133
 
98
134
  @mixin detail-row {
@@ -400,7 +400,167 @@
400
400
  }
401
401
  }
402
402
 
403
+ @mixin thermostat-card {
404
+ .seam-thermostat-card {
405
+ width: 100%;
406
+ background-color: colors.$bg-a;
407
+ border-radius: 16px;
408
+ display: flex;
409
+ padding: 16px;
410
+ flex-direction: column;
411
+ align-items: center;
412
+ gap: 8px;
413
+ align-self: stretch;
414
+
415
+ .seam-thermostat-card-content {
416
+ display: flex;
417
+ align-items: flex-start;
418
+ flex-direction: row;
419
+ gap: 8px;
420
+ align-self: stretch;
421
+ }
422
+
423
+ .seam-thermostat-card-image-wrap {
424
+ padding: 24px;
425
+
426
+ img {
427
+ width: 80px;
428
+ height: 80px;
429
+ object-fit: contain;
430
+ }
431
+ }
432
+
433
+ .seam-thermostat-heading-wrap {
434
+ width: 100%;
435
+ display: flex;
436
+ justify-content: space-between;
437
+ align-items: center;
438
+ flex-direction: row;
439
+ gap: 16px;
440
+ }
441
+
442
+ .seam-thermostat-card-heading {
443
+ font-size: 21px;
444
+ font-weight: 600;
445
+ line-height: 132%;
446
+ white-space: nowrap;
447
+ }
448
+
449
+ .seam-thermostat-temperature-toggle {
450
+ appearance: none;
451
+ width: 32px;
452
+ height: 22px;
453
+ box-shadow: none;
454
+ border-radius: 5px;
455
+ border: 1px solid colors.$text-gray-3;
456
+ background-color: transparent;
457
+ display: flex;
458
+ justify-content: center;
459
+ align-items: center;
460
+ flex-direction: column;
461
+ color: colors.$text-gray-1;
462
+ font-size: 12px;
463
+ font-weight: 600;
464
+ line-height: 1;
465
+ cursor: pointer;
466
+ }
467
+
468
+ .seam-thermostat-card-details {
469
+ width: 100%;
470
+ display: flex;
471
+ justify-content: flex-start;
472
+ flex-direction: column;
473
+ gap: 8px;
474
+ }
475
+
476
+ .seam-thermostat-properties-wrap {
477
+ display: flex;
478
+ }
479
+
480
+ .seam-thermostat-properties {
481
+ width: auto;
482
+ display: grid;
483
+ grid-template-columns: auto auto;
484
+ column-gap: 16px;
485
+ row-gap: 8px;
486
+ }
487
+
488
+ .seam-thermostat-property-block {
489
+ display: flex;
490
+ flex-direction: row;
491
+ gap: 8px;
492
+
493
+ &.seam-thermostat-property-icon-block {
494
+ gap: 4px;
495
+ }
496
+ }
497
+
498
+ .seam-thermostat-property-label {
499
+ color: colors.$text-gray-2;
500
+ font-size: 14px;
501
+ font-weight: 400;
502
+ line-height: 118%;
503
+ white-space: nowrap;
504
+ }
505
+
506
+ .seam-thermostat-property-value {
507
+ color: colors.$text-gray-1;
508
+ font-size: 14px;
509
+ font-weight: 400;
510
+ line-height: 118%;
511
+ white-space: nowrap;
512
+ }
513
+
514
+ .seam-thermostat-property-icon {
515
+ width: 18px;
516
+ height: 18px;
517
+ }
518
+
519
+ .seam-thermostat-property-tag {
520
+ height: 18px;
521
+ padding: 0 8px;
522
+ border-radius: 4px;
523
+ display: flex;
524
+ justify-content: center;
525
+ align-items: center;
526
+
527
+ &.seam-thermostat-property-tag-cooling {
528
+ background-color: colors.$thermo-blue;
529
+ }
530
+
531
+ &.seam-thermostat-property-tag-heating {
532
+ background-color: colors.$thermo-orange;
533
+ }
534
+
535
+ &.seam-thermostat-property-tag-fan {
536
+ border: 1px solid colors.$text-gray-2-5;
537
+ background-color: transparent;
538
+
539
+ .seam-thermostat-property-tag-label {
540
+ color: colors.$text-gray-1;
541
+ }
542
+ }
543
+
544
+ &.seam-thermostat-property-tag-off {
545
+ background-color: transparent;
546
+
547
+ .seam-thermostat-property-tag-label {
548
+ color: colors.$text-gray-1;
549
+ }
550
+ }
551
+
552
+ .seam-thermostat-property-tag-label {
553
+ color: colors.$white;
554
+ font-size: 12px;
555
+ font-weight: 400;
556
+ line-height: 1;
557
+ }
558
+ }
559
+ }
560
+ }
561
+
403
562
  @mixin all {
404
563
  @include temperature-control;
405
564
  @include climate-setting-status;
565
+ @include thermostat-card;
406
566
  }
@@ -60,6 +60,7 @@
60
60
  box-shadow:
61
61
  0 2px 16px 2px rgb(15 22 28 / 15%),
62
62
  0 0 1px 0 rgb(0 0 0 / 30%);
63
+ will-change: transform, opacity, visibility;
63
64
  transform-origin: bottom left;
64
65
  transition: 0.1s ease-in-out;
65
66
  opacity: 0;