@seamapi/react 2.0.2 → 2.1.1

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 (72) hide show
  1. package/README.md +3 -3
  2. package/dist/elements.js +2917 -2829
  3. package/dist/elements.js.map +1 -1
  4. package/dist/index.css +60 -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/seam/access-codes/use-access-codes.js +11 -1
  9. package/lib/seam/access-codes/use-access-codes.js.map +1 -1
  10. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTableManufacturerKeys.d.ts +6 -0
  11. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTableManufacturerKeys.js +21 -0
  12. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTableManufacturerKeys.js.map +1 -0
  13. package/lib/seam/components/SupportedDeviceTable/use-device-models.js +12 -1
  14. package/lib/seam/components/SupportedDeviceTable/use-device-models.js.map +1 -1
  15. package/lib/seam/components/SupportedDeviceTable/use-manufacturers.js +12 -1
  16. package/lib/seam/components/SupportedDeviceTable/use-manufacturers.js.map +1 -1
  17. package/lib/seam/components/index.d.ts +1 -0
  18. package/lib/seam/components/index.js +1 -0
  19. package/lib/seam/components/index.js.map +1 -1
  20. package/lib/seam/devices/use-devices.js +0 -1
  21. package/lib/seam/devices/use-devices.js.map +1 -1
  22. package/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedules.js +0 -1
  23. package/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedules.js.map +1 -1
  24. package/lib/seam/thermostats/use-update-fan-mode.d.ts +6 -0
  25. package/lib/seam/thermostats/use-update-fan-mode.js +42 -0
  26. package/lib/seam/thermostats/use-update-fan-mode.js.map +1 -0
  27. package/lib/seam/thermostats/use-update-thermostat.d.ts +6 -0
  28. package/lib/seam/thermostats/use-update-thermostat.js +50 -0
  29. package/lib/seam/thermostats/use-update-thermostat.js.map +1 -0
  30. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleForm.d.ts +6 -1
  31. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleForm.js +39 -6
  32. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleForm.js.map +1 -1
  33. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormClimateSetting.d.ts +13 -0
  34. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormClimateSetting.js +37 -0
  35. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormClimateSetting.js.map +1 -0
  36. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormDefaultClimateSetting.d.ts +10 -0
  37. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormDefaultClimateSetting.js +24 -0
  38. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormDefaultClimateSetting.js.map +1 -0
  39. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormDeviceSelect.d.ts +1 -2
  40. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormDeviceSelect.js +1 -2
  41. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormDeviceSelect.js.map +1 -1
  42. package/lib/ui/thermostat/ClimateSettingControlGroup.d.ts +9 -0
  43. package/lib/ui/thermostat/ClimateSettingControlGroup.js +8 -0
  44. package/lib/ui/thermostat/ClimateSettingControlGroup.js.map +1 -0
  45. package/lib/ui/thermostat/TemperatureControlGroup.d.ts +6 -7
  46. package/lib/ui/thermostat/TemperatureControlGroup.js +1 -1
  47. package/lib/ui/thermostat/TemperatureControlGroup.js.map +1 -1
  48. package/lib/version.d.ts +1 -1
  49. package/lib/version.js +1 -1
  50. package/package.json +2 -2
  51. package/src/lib/seam/access-codes/use-access-codes.ts +15 -1
  52. package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceTableManufacturerKeys.element.ts +9 -0
  53. package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceTableManufacturerKeys.tsx +65 -0
  54. package/src/lib/seam/components/SupportedDeviceTable/use-device-models.ts +15 -1
  55. package/src/lib/seam/components/SupportedDeviceTable/use-manufacturers.ts +15 -1
  56. package/src/lib/seam/components/elements.ts +1 -0
  57. package/src/lib/seam/components/index.ts +1 -0
  58. package/src/lib/seam/devices/use-devices.ts +0 -1
  59. package/src/lib/seam/thermostats/climate-setting-schedules/use-climate-setting-schedules.ts +0 -1
  60. package/src/lib/seam/thermostats/use-update-fan-mode.ts +81 -0
  61. package/src/lib/seam/thermostats/use-update-thermostat.ts +92 -0
  62. package/src/lib/ui/ClimateSettingForm/ClimateSettingScheduleForm.tsx +77 -15
  63. package/src/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormClimateSetting.tsx +103 -0
  64. package/src/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormDefaultClimateSetting.tsx +79 -0
  65. package/src/lib/ui/ClimateSettingForm/ClimateSettingScheduleFormDeviceSelect.tsx +0 -3
  66. package/src/lib/ui/thermostat/ClimateSettingControlGroup.tsx +32 -0
  67. package/src/lib/ui/thermostat/TemperatureControlGroup.tsx +11 -11
  68. package/src/lib/version.ts +1 -1
  69. package/src/styles/_climate-setting-schedule-form.scss +54 -0
  70. package/src/styles/_main.scss +2 -0
  71. package/src/styles/_supported-device-table-manufacturer-keys.scss +19 -0
  72. package/src/styles/_thermostat.scss +15 -0
@@ -0,0 +1,79 @@
1
+ import { useState } from 'react'
2
+ import type { HvacModeSetting } from 'seamapi'
3
+
4
+ import { useDevice } from 'lib/seam/devices/use-device.js'
5
+ import { Button } from 'lib/ui/Button.js'
6
+ import { InputLabel } from 'lib/ui/InputLabel.js'
7
+ import { ContentHeader } from 'lib/ui/layout/ContentHeader.js'
8
+ import { ClimateSettingControlGroup } from 'lib/ui/thermostat/ClimateSettingControlGroup.js'
9
+
10
+ interface ClimateSettingScheduleFormDefaultClimateSettingProps {
11
+ title: string
12
+ deviceId: string
13
+ onBack: () => void
14
+ onCancel: (() => void) | undefined
15
+ onSave: () => void
16
+ }
17
+
18
+ export function ClimateSettingScheduleFormDefaultClimateSetting({
19
+ title,
20
+ deviceId,
21
+ onBack,
22
+ onCancel,
23
+ onSave,
24
+ }: ClimateSettingScheduleFormDefaultClimateSettingProps): JSX.Element {
25
+ const { device } = useDevice({
26
+ device_id: deviceId,
27
+ })
28
+
29
+ const [mode, setMode] = useState<HvacModeSetting>('heat_cool')
30
+ const [heatValue, setHeatValue] = useState(70)
31
+ const [coolValue, setCoolValue] = useState(75)
32
+
33
+ return (
34
+ <>
35
+ <ContentHeader
36
+ title={title}
37
+ onBack={onBack}
38
+ subheading={device?.properties.name}
39
+ />
40
+ <div className='seam-main'>
41
+ <div className='seam-climate-setting-schedule-form-default-climate-setting'>
42
+ <div className='seam-content'>
43
+ <div className='seam-default-climate-setting-message'>
44
+ <p>{t.defaultClimateMessage}</p>
45
+ </div>
46
+ <div className='seam-control-group-title'>
47
+ <InputLabel>{t.defaultClimate}</InputLabel>
48
+ <span className='seam-label'>{t.defautClimateSubHeading}</span>
49
+ </div>
50
+ <ClimateSettingControlGroup
51
+ mode={mode}
52
+ onModeChange={setMode}
53
+ heatValue={heatValue}
54
+ onHeatValueChange={setHeatValue}
55
+ coolValue={coolValue}
56
+ onCoolValueChange={setCoolValue}
57
+ />
58
+ </div>
59
+ </div>
60
+ <div className='seam-actions'>
61
+ <Button onClick={onCancel}>{t.cancel}</Button>
62
+ <Button variant='solid' onClick={onSave}>
63
+ {t.save}
64
+ </Button>
65
+ </div>
66
+ </div>
67
+ </>
68
+ )
69
+ }
70
+
71
+ const t = {
72
+ defaultClimate: 'Default Climate',
73
+ defautClimateSubHeading:
74
+ 'Choose the default mode and climate for this device',
75
+ defaultClimateMessage:
76
+ 'This device doesn’t have a default climate set up yet. Choose the climate you’d like the device to fall back to after scheduled climates reach their ends.',
77
+ cancel: 'Cancel',
78
+ save: 'Save',
79
+ }
@@ -7,7 +7,6 @@ import { ThermostatSelect } from 'lib/ui/thermostat/ThermostatSelect.js'
7
7
  interface ClimateSettingScheduleFormDeviceSelectProps {
8
8
  title: string
9
9
  control: Control<ClimateSettingScheduleFormFields>
10
- onSelect: () => void
11
10
  onBack: (() => void) | undefined
12
11
  }
13
12
 
@@ -15,7 +14,6 @@ export function ClimateSettingScheduleFormDeviceSelect({
15
14
  title,
16
15
  control,
17
16
  onBack,
18
- onSelect,
19
17
  }: ClimateSettingScheduleFormDeviceSelectProps): JSX.Element {
20
18
  return (
21
19
  <>
@@ -28,7 +26,6 @@ export function ClimateSettingScheduleFormDeviceSelect({
28
26
  <ThermostatSelect
29
27
  onSelect={(deviceId) => {
30
28
  onChange(deviceId)
31
- onSelect()
32
29
  }}
33
30
  />
34
31
  )}
@@ -0,0 +1,32 @@
1
+ import type { HvacModeSetting } from 'seamapi'
2
+
3
+ import { ClimateModeMenu } from 'lib/ui/thermostat/ClimateModeMenu.js'
4
+ import {
5
+ TemperatureControlGroup,
6
+ type TemperatureControlGroupProps,
7
+ } from 'lib/ui/thermostat/TemperatureControlGroup.js'
8
+
9
+ type ClimateSettingControlGroupProps = Omit<
10
+ TemperatureControlGroupProps,
11
+ 'mode'
12
+ > & {
13
+ mode: HvacModeSetting
14
+ onModeChange: (mode: HvacModeSetting) => void
15
+ }
16
+
17
+ export function ClimateSettingControlGroup(
18
+ props: ClimateSettingControlGroupProps
19
+ ): JSX.Element {
20
+ const { mode, onModeChange, ...rest } = props
21
+ return (
22
+ <div className='seam-climate-setting-control-group'>
23
+ <ClimateModeMenu mode={mode} onChange={onModeChange} />
24
+
25
+ {mode !== 'off' && (
26
+ <div className='seam-climate-setting-slider-container'>
27
+ <TemperatureControlGroup mode={mode} {...rest} />
28
+ </div>
29
+ )}
30
+ </div>
31
+ )
32
+ }
@@ -10,17 +10,17 @@ import {
10
10
  } from 'lib/temperature-bounds.js'
11
11
  import { TemperatureControl } from 'lib/ui/thermostat/TemperatureControl.js'
12
12
 
13
- interface TemperatureControlGroupProps {
13
+ export interface TemperatureControlGroupProps {
14
14
  mode: Exclude<HvacModeSetting, 'off'>
15
15
  heatValue: number
16
16
  onHeatValueChange: (temperature: number) => void
17
17
  coolValue: number
18
18
  onCoolValueChange: (temperature: number) => void
19
- delta: number
20
- minHeat: number
21
- maxHeat: number
22
- minCool: number
23
- maxCool: number
19
+ delta?: number
20
+ minHeat?: number
21
+ maxHeat?: number
22
+ minCool?: number
23
+ maxCool?: number
24
24
  }
25
25
 
26
26
  export function TemperatureControlGroup({
@@ -29,11 +29,11 @@ export function TemperatureControlGroup({
29
29
  onHeatValueChange,
30
30
  coolValue,
31
31
  onCoolValueChange,
32
- delta,
33
- minHeat,
34
- maxHeat,
35
- minCool,
36
- maxCool,
32
+ delta = 5,
33
+ minHeat = 60,
34
+ maxHeat = 90,
35
+ minCool = 60,
36
+ maxCool = 90,
37
37
  }: TemperatureControlGroupProps): JSX.Element {
38
38
  const showHeat = mode === 'heat' || mode === 'heat_cool'
39
39
  const showCool = mode === 'cool' || mode === 'heat_cool'
@@ -1,3 +1,3 @@
1
- const seamapiReactVersion = '2.0.2'
1
+ const seamapiReactVersion = '2.1.1'
2
2
 
3
3
  export default seamapiReactVersion
@@ -4,6 +4,8 @@
4
4
  .seam-climate-setting-schedule-form {
5
5
  @include main;
6
6
  @include name-and-schedule;
7
+ @include default-climate-setting;
8
+ @include climate-setting;
7
9
  }
8
10
  }
9
11
 
@@ -55,3 +57,55 @@
55
57
  }
56
58
  }
57
59
  }
60
+
61
+ @mixin default-climate-setting {
62
+ .seam-climate-setting-schedule-form-default-climate-setting {
63
+ .seam-control-group-title {
64
+ margin-top: 16px;
65
+ margin-bottom: 16px;
66
+ }
67
+
68
+ .seam-label {
69
+ color: colors.$text-gray-1;
70
+ font-size: 14px;
71
+ }
72
+
73
+ .seam-default-climate-setting-message {
74
+ > p {
75
+ color: colors.$text-gray-1;
76
+ font-size: 14px;
77
+ margin-bottom: 16px;
78
+ }
79
+
80
+ margin-top: 4px;
81
+ border-bottom: 1px solid colors.$divider-stroke-light;
82
+ }
83
+
84
+ .seam-climate-setting-control-group {
85
+ margin-bottom: 32px;
86
+ }
87
+ }
88
+ }
89
+
90
+ @mixin climate-setting {
91
+ .seam-climate-setting-schedule-form-climate-setting {
92
+ .seam-content {
93
+ display: flex;
94
+ flex-direction: column;
95
+ gap: 16px;
96
+ width: 100%;
97
+ margin-top: 24px;
98
+ margin-bottom: 24px;
99
+
100
+ .seam-label {
101
+ color: colors.$text-gray-2;
102
+ font-size: 14px;
103
+ }
104
+
105
+ .seam-climate-setting-slider-container {
106
+ display: flex;
107
+ justify-content: center;
108
+ }
109
+ }
110
+ }
111
+ }
@@ -13,6 +13,7 @@
13
13
  @use './device-table';
14
14
  @use './access-code-details';
15
15
  @use './supported-device-table';
16
+ @use './supported-device-table-manufacturer-keys';
16
17
  @use './access-code-form';
17
18
  @use './input-label';
18
19
  @use './form-field';
@@ -59,6 +60,7 @@
59
60
  @include climate-setting-schedule-form.all;
60
61
  @include alert.all;
61
62
  @include supported-device-table.all;
63
+ @include supported-device-table-manufacturer-keys.all;
62
64
  @include thermostat.all;
63
65
  @include seam-table.all;
64
66
  @include climate-setting-schedule-details.all;
@@ -0,0 +1,19 @@
1
+ @mixin all {
2
+ .supported-device-table-manufacturer-keys {
3
+ font-size: 18px;
4
+
5
+ .seam-manufacturer-key {
6
+ display: table-row;
7
+ }
8
+
9
+ .seam-manufacturer-key-value {
10
+ display: table-cell;
11
+ }
12
+
13
+ .seam-copy-button {
14
+ display: table-cell;
15
+ cursor: pointer;
16
+ padding-left: 10px;
17
+ }
18
+ }
19
+ }
@@ -1,5 +1,19 @@
1
1
  @use './colors';
2
2
 
3
+ @mixin climate-setting-control-group {
4
+ .seam-climate-setting-control-group {
5
+ display: flex;
6
+ flex-direction: column;
7
+ gap: 16px;
8
+ width: 100%;
9
+
10
+ .seam-climate-setting-slider-container {
11
+ display: flex;
12
+ justify-content: center;
13
+ }
14
+ }
15
+ }
16
+
3
17
  @mixin temperature-control-group {
4
18
  .seam-temperature-control-group {
5
19
  display: flex;
@@ -690,6 +704,7 @@
690
704
  }
691
705
 
692
706
  @mixin all {
707
+ @include climate-setting-control-group;
693
708
  @include temperature-control-group;
694
709
  @include temperature-control;
695
710
  @include climate-setting-status;