@seamapi/react 2.8.7 → 2.10.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 (65) hide show
  1. package/README.md +2 -2
  2. package/dist/elements.js +7998 -7317
  3. package/dist/elements.js.map +1 -1
  4. package/dist/index.css +31 -2
  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/debounce.d.ts +6 -0
  9. package/lib/debounce.js +20 -0
  10. package/lib/debounce.js.map +1 -0
  11. package/lib/seam/components/AccessCodeDetails/AccessCodeDetails.d.ts +1 -1
  12. package/lib/seam/components/AccessCodeDetails/AccessCodeDetails.js +2 -2
  13. package/lib/seam/components/AccessCodeDetails/AccessCodeDetails.js.map +1 -1
  14. package/lib/seam/components/AccessCodeTable/AccessCodeTable.d.ts +1 -1
  15. package/lib/seam/components/AccessCodeTable/AccessCodeTable.js +4 -4
  16. package/lib/seam/components/AccessCodeTable/AccessCodeTable.js.map +1 -1
  17. package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.d.ts +1 -1
  18. package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.js +2 -2
  19. package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.js.map +1 -1
  20. package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.d.ts +1 -1
  21. package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.js +2 -2
  22. package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.js.map +1 -1
  23. package/lib/seam/components/DeviceDetails/DeviceDetails.d.ts +1 -1
  24. package/lib/seam/components/DeviceDetails/DeviceDetails.js +2 -1
  25. package/lib/seam/components/DeviceDetails/DeviceDetails.js.map +1 -1
  26. package/lib/seam/components/DeviceDetails/LockDeviceDetails.js +2 -2
  27. package/lib/seam/components/DeviceDetails/LockDeviceDetails.js.map +1 -1
  28. package/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.d.ts +1 -1
  29. package/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.js +99 -5
  30. package/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.js.map +1 -1
  31. package/lib/seam/components/DeviceTable/DeviceTable.d.ts +1 -1
  32. package/lib/seam/components/DeviceTable/DeviceTable.js +2 -2
  33. package/lib/seam/components/DeviceTable/DeviceTable.js.map +1 -1
  34. package/lib/seam/components/common-props.d.ts +1 -0
  35. package/lib/seam/components/common-props.js.map +1 -1
  36. package/lib/temperature-bounds.d.ts +2 -1
  37. package/lib/temperature-bounds.js +16 -0
  38. package/lib/temperature-bounds.js.map +1 -1
  39. package/lib/ui/layout/AccordionRow.d.ts +2 -1
  40. package/lib/ui/layout/AccordionRow.js +2 -2
  41. package/lib/ui/layout/AccordionRow.js.map +1 -1
  42. package/lib/ui/thermostat/ClimateModeMenu.d.ts +2 -1
  43. package/lib/ui/thermostat/ClimateModeMenu.js +2 -3
  44. package/lib/ui/thermostat/ClimateModeMenu.js.map +1 -1
  45. package/lib/version.d.ts +1 -1
  46. package/lib/version.js +1 -1
  47. package/lib/version.js.map +1 -1
  48. package/package.json +3 -3
  49. package/src/lib/debounce.ts +33 -0
  50. package/src/lib/element.tsx +1 -0
  51. package/src/lib/seam/components/AccessCodeDetails/AccessCodeDetails.tsx +2 -0
  52. package/src/lib/seam/components/AccessCodeTable/AccessCodeTable.tsx +4 -0
  53. package/src/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.tsx +2 -0
  54. package/src/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.tsx +2 -0
  55. package/src/lib/seam/components/DeviceDetails/DeviceDetails.tsx +3 -1
  56. package/src/lib/seam/components/DeviceDetails/LockDeviceDetails.tsx +2 -0
  57. package/src/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.tsx +222 -26
  58. package/src/lib/seam/components/DeviceTable/DeviceTable.tsx +2 -0
  59. package/src/lib/seam/components/common-props.tsx +1 -0
  60. package/src/lib/temperature-bounds.ts +23 -1
  61. package/src/lib/ui/layout/AccordionRow.tsx +6 -1
  62. package/src/lib/ui/thermostat/ClimateModeMenu.tsx +3 -3
  63. package/src/lib/version.ts +1 -1
  64. package/src/styles/_layout.scss +13 -2
  65. package/src/styles/_thermostat.scss +26 -0
@@ -1,4 +1,4 @@
1
- import type { HvacModeSetting } from 'seamapi'
1
+ import type { HvacModeSetting, ThermostatDevice } from 'seamapi'
2
2
 
3
3
  export interface ControlBounds {
4
4
  mode: Exclude<HvacModeSetting, 'off'>
@@ -51,3 +51,25 @@ export const getTemperatureBounds = (
51
51
  heat: getHeatBounds(controlBounds),
52
52
  cool: getCoolBounds(controlBounds),
53
53
  })
54
+
55
+ export const getSupportedThermostatModes = (
56
+ device: ThermostatDevice
57
+ ): HvacModeSetting[] => {
58
+ const allModes: HvacModeSetting[] = ['heat', 'cool', 'heat_cool', 'off']
59
+
60
+ return allModes.filter((mode) => {
61
+ switch (mode) {
62
+ case 'cool':
63
+ return device.properties.is_cooling_available
64
+ case 'heat':
65
+ return device.properties.is_heating_available
66
+ case 'heat_cool':
67
+ return (
68
+ device.properties.is_heating_available &&
69
+ device.properties.is_cooling_available
70
+ )
71
+ default:
72
+ return true
73
+ }
74
+ })
75
+ }
@@ -5,11 +5,13 @@ import { useToggle } from 'lib/ui/use-toggle.js'
5
5
 
6
6
  interface AccordionRowProps extends PropsWithChildren {
7
7
  label: string
8
+ leftContent?: JSX.Element
8
9
  rightCollapsedContent?: JSX.Element
9
10
  }
10
11
 
11
12
  export function AccordionRow({
12
13
  label,
14
+ leftContent,
13
15
  rightCollapsedContent,
14
16
  children,
15
17
  }: AccordionRowProps): JSX.Element {
@@ -18,7 +20,10 @@ export function AccordionRow({
18
20
  return (
19
21
  <div className='seam-accordion-row' aria-expanded={isExpanded}>
20
22
  <button className='seam-accordion-row-trigger' onClick={toggle}>
21
- <p className='seam-row-label'>{label}</p>
23
+ <div className='seam-row-inner-wrap'>
24
+ <p className='seam-row-label'>{label}</p>
25
+ <div className='seam-row-trigger-left-content'>{leftContent}</div>
26
+ </div>
22
27
  <div className='seam-row-inner-wrap'>
23
28
  <div className='seam-row-trigger-right-content'>
24
29
  {rightCollapsedContent}
@@ -8,16 +8,16 @@ import { ThermostatHeatCoolIcon } from 'lib/icons/ThermostatHeatCool.js'
8
8
  import { Menu } from 'lib/ui/Menu/Menu.js'
9
9
  import { ThermoModeMenuOption } from 'lib/ui/thermostat/ThermoModeMenuOption.js'
10
10
 
11
- const modes: HvacModeSetting[] = ['heat', 'cool', 'heat_cool', 'off']
12
-
13
11
  interface ClimateModeMenuProps {
14
12
  mode: HvacModeSetting
15
13
  onChange: (mode: HvacModeSetting) => void
14
+ supportedModes?: HvacModeSetting[]
16
15
  }
17
16
 
18
17
  export function ClimateModeMenu({
19
18
  mode,
20
19
  onChange,
20
+ supportedModes = ['heat', 'cool', 'heat_cool', 'off'],
21
21
  }: ClimateModeMenuProps): JSX.Element {
22
22
  return (
23
23
  <Menu
@@ -35,7 +35,7 @@ export function ClimateModeMenu({
35
35
  className: 'seam-thermo-mode-menu',
36
36
  }}
37
37
  >
38
- {modes.map((m) => (
38
+ {supportedModes.map((m) => (
39
39
  <ThermoModeMenuOption
40
40
  key={m}
41
41
  label={t[m]}
@@ -1,3 +1,3 @@
1
- const seamapiReactVersion = '2.8.7'
1
+ const seamapiReactVersion = '2.10.0'
2
2
 
3
3
  export default seamapiReactVersion
@@ -126,6 +126,16 @@
126
126
  gap: 8px;
127
127
  }
128
128
 
129
+ .seam-detail-row-end-alignment {
130
+ width: 100%;
131
+ display: flex;
132
+ justify-content: flex-end;
133
+ align-items: flex-start;
134
+ flex-direction: row;
135
+ gap: 24px;
136
+ padding-top: 12px;
137
+ }
138
+
129
139
  .seam-detail-row-rotated-icon {
130
140
  transform: rotate(-90deg);
131
141
  }
@@ -168,7 +178,7 @@
168
178
 
169
179
  &[aria-expanded='true'] {
170
180
  .seam-accordion-row-content {
171
- max-height: 64px;
181
+ max-height: 128px;
172
182
  opacity: 1;
173
183
  }
174
184
 
@@ -183,7 +193,8 @@
183
193
  }
184
194
 
185
195
  .seam-accordion-row-inner-content {
186
- height: 64px;
196
+ width: 100%;
197
+ height: 128px;
187
198
  padding: 0 16px;
188
199
  overflow: hidden;
189
200
  }
@@ -703,6 +703,31 @@
703
703
  }
704
704
  }
705
705
 
706
+ @mixin status {
707
+ .seam-thermostat-mutation-status {
708
+ display: flex;
709
+ justify-content: center;
710
+ align-items: center;
711
+ flex-direction: row;
712
+ gap: 4px;
713
+ opacity: 0;
714
+ transition: 0.2s ease-in-out;
715
+
716
+ &.is-visible {
717
+ opacity: 1;
718
+ }
719
+ }
720
+
721
+ .seam-thermostat-mutation-status-icon {
722
+ opacity: 0.25;
723
+ }
724
+
725
+ .seam-thermostat-mutation-status-label {
726
+ font-size: 14px;
727
+ color: colors.$text-gray-2-5;
728
+ }
729
+ }
730
+
706
731
  @mixin all {
707
732
  @include climate-setting-control-group;
708
733
  @include temperature-control-group;
@@ -712,4 +737,5 @@
712
737
  @include mode-menu-common;
713
738
  @include fan-mode-menu;
714
739
  @include climate-mode-menu;
740
+ @include status;
715
741
  }