@seamapi/react 2.10.1 → 2.11.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 (60) hide show
  1. package/README.md +2 -2
  2. package/dist/elements.js +4876 -4867
  3. package/dist/elements.js.map +1 -1
  4. package/dist/index.css.map +1 -1
  5. package/dist/index.min.css.map +1 -1
  6. package/lib/seam/SeamProvider.js +1 -1
  7. package/lib/seam/SeamProvider.js.map +1 -1
  8. package/lib/seam/components/AccessCodeDetails/AccessCodeDetails.js +1 -1
  9. package/lib/seam/components/AccessCodeDetails/AccessCodeDetails.js.map +1 -1
  10. package/lib/seam/components/AccessCodeTable/AccessCodeTable.js +1 -1
  11. package/lib/seam/components/AccessCodeTable/AccessCodeTable.js.map +1 -1
  12. package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.js +1 -1
  13. package/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.js.map +1 -1
  14. package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.js +1 -1
  15. package/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.js.map +1 -1
  16. package/lib/seam/components/ConnectAccountButton/ConnectAccountButton.js +1 -1
  17. package/lib/seam/components/ConnectAccountButton/ConnectAccountButton.js.map +1 -1
  18. package/lib/seam/components/CreateAccessCodeForm/CreateAccessCodeForm.js +1 -1
  19. package/lib/seam/components/CreateAccessCodeForm/CreateAccessCodeForm.js.map +1 -1
  20. package/lib/seam/components/CreateClimateSettingScheduleForm/CreateClimateSettingScheduleForm.js +1 -1
  21. package/lib/seam/components/CreateClimateSettingScheduleForm/CreateClimateSettingScheduleForm.js.map +1 -1
  22. package/lib/seam/components/DeviceDetails/DeviceDetails.js +1 -1
  23. package/lib/seam/components/DeviceDetails/DeviceDetails.js.map +1 -1
  24. package/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.js +1 -1
  25. package/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.js.map +1 -1
  26. package/lib/seam/components/DeviceTable/DeviceTable.js +1 -1
  27. package/lib/seam/components/DeviceTable/DeviceTable.js.map +1 -1
  28. package/lib/seam/components/EditAccessCodeForm/EditAccessCodeForm.js +1 -1
  29. package/lib/seam/components/EditAccessCodeForm/EditAccessCodeForm.js.map +1 -1
  30. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.js +1 -1
  31. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.js.map +1 -1
  32. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTableManufacturerKeys.js +1 -1
  33. package/lib/seam/components/SupportedDeviceTable/SupportedDeviceTableManufacturerKeys.js.map +1 -1
  34. package/lib/ui/AccessCodeForm/AccessCodeForm.js +25 -24
  35. package/lib/ui/AccessCodeForm/AccessCodeForm.js.map +1 -1
  36. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleForm.js +1 -1
  37. package/lib/ui/ClimateSettingForm/ClimateSettingScheduleForm.js.map +1 -1
  38. package/lib/ui/FormField.js.map +1 -1
  39. package/lib/version.d.ts +1 -1
  40. package/lib/version.js +1 -1
  41. package/package.json +12 -11
  42. package/src/lib/seam/SeamProvider.tsx +2 -3
  43. package/src/lib/seam/components/AccessCodeDetails/AccessCodeDetails.tsx +1 -2
  44. package/src/lib/seam/components/AccessCodeTable/AccessCodeTable.tsx +1 -2
  45. package/src/lib/seam/components/ClimateSettingScheduleDetails/ClimateSettingScheduleDetails.tsx +1 -2
  46. package/src/lib/seam/components/ClimateSettingScheduleTable/ClimateSettingScheduleTable.tsx +1 -2
  47. package/src/lib/seam/components/ConnectAccountButton/ConnectAccountButton.tsx +1 -2
  48. package/src/lib/seam/components/CreateAccessCodeForm/CreateAccessCodeForm.tsx +1 -2
  49. package/src/lib/seam/components/CreateClimateSettingScheduleForm/CreateClimateSettingScheduleForm.tsx +1 -2
  50. package/src/lib/seam/components/DeviceDetails/DeviceDetails.tsx +1 -2
  51. package/src/lib/seam/components/DeviceDetails/ThermostatDeviceDetails.tsx +18 -16
  52. package/src/lib/seam/components/DeviceTable/DeviceTable.tsx +1 -2
  53. package/src/lib/seam/components/EditAccessCodeForm/EditAccessCodeForm.tsx +1 -2
  54. package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceTable.tsx +1 -2
  55. package/src/lib/seam/components/SupportedDeviceTable/SupportedDeviceTableManufacturerKeys.tsx +1 -2
  56. package/src/lib/ui/AccessCodeForm/AccessCodeForm.tsx +74 -67
  57. package/src/lib/ui/ClimateSettingForm/ClimateSettingScheduleForm.tsx +1 -2
  58. package/src/lib/ui/FormField.tsx +2 -2
  59. package/src/lib/version.ts +1 -1
  60. package/src/styles/_supported-device-table.scss +6 -1
@@ -176,6 +176,9 @@ function Content({
176
176
  ? t.codeLengthRequirement(codeLengthRequirement)
177
177
  : null
178
178
 
179
+ const hasCodeInputs =
180
+ accessCode?.type !== 'time_bound' || accessCode.is_offline_access_code
181
+
179
182
  return (
180
183
  <>
181
184
  <ContentHeader
@@ -207,77 +210,81 @@ function Content({
207
210
  }}
208
211
  />
209
212
  </FormField>
210
- <FormField className='seam-code-field'>
211
- <InputLabel>{t.codeInputLabel}</InputLabel>
212
- <TextField
213
- size='large'
214
- clearable
215
- hasError={hasCodeError}
216
- helperText={responseErrors?.code ?? errors.code?.message}
217
- inputProps={{
218
- ...register('code', {
219
- required: t.codeRequiredError,
220
- validate: (value: string) =>
221
- validateCodeLength(device, value),
222
- }),
223
- }}
224
- />
225
- <div
226
- className={classNames('seam-bottom', {
227
- 'has-hints': codeLengthRequirementMessage != null,
228
- })}
229
- >
230
- {codeLengthRequirementMessage != null && (
231
- <ul
232
- className={classNames('seam-requirements', {
233
- 'seam-error': hasCodeError,
234
- })}
235
- >
236
- <li>{codeLengthRequirementMessage}</li>
237
- <li>{t.codeNumbersOnlyRequirement}</li>
238
- </ul>
239
- )}
240
- <Button
241
- size='small'
242
- onMouseDown={(e) => {
243
- e.preventDefault() // Disable stealing input focus
244
- handleGenerateCode()
245
- }}
246
- disabled={isGeneratingCode}
247
- >
248
- {t.codeGenerateButton}
249
- </Button>
250
- </div>
251
- </FormField>
252
- <FormField>
253
- <InputLabel>{t.timingInputLabel}</InputLabel>
254
- <RadioField
255
- value={type}
256
- onChange={setType}
257
- name='type'
258
- options={[
259
- {
260
- label: t.typeOngoingLabel,
261
- value: 'ongoing',
262
- },
263
- {
264
- label: t.typeTimeBoundLabel,
265
- value: 'time_bound',
266
- },
267
- ]}
268
- />
213
+ {hasCodeInputs && (
269
214
  <>
270
- {type === 'time_bound' && (
271
- <AccessCodeFormTimes
272
- startDate={startDate}
273
- endDate={endDate}
274
- onEdit={() => {
275
- setDatePickerVisible(true)
215
+ <FormField className='seam-code-field'>
216
+ <InputLabel>{t.codeInputLabel}</InputLabel>
217
+ <TextField
218
+ size='large'
219
+ clearable
220
+ hasError={hasCodeError}
221
+ helperText={responseErrors?.code ?? errors.code?.message}
222
+ inputProps={{
223
+ ...register('code', {
224
+ required: t.codeRequiredError,
225
+ validate: (value: string) =>
226
+ validateCodeLength(device, value),
227
+ }),
276
228
  }}
277
229
  />
278
- )}
230
+ <div
231
+ className={classNames('seam-bottom', {
232
+ 'has-hints': codeLengthRequirementMessage != null,
233
+ })}
234
+ >
235
+ {codeLengthRequirementMessage != null && (
236
+ <ul
237
+ className={classNames('seam-requirements', {
238
+ 'seam-error': hasCodeError,
239
+ })}
240
+ >
241
+ <li>{codeLengthRequirementMessage}</li>
242
+ <li>{t.codeNumbersOnlyRequirement}</li>
243
+ </ul>
244
+ )}
245
+ <Button
246
+ size='small'
247
+ onMouseDown={(e) => {
248
+ e.preventDefault() // Disable stealing input focus
249
+ handleGenerateCode()
250
+ }}
251
+ disabled={isGeneratingCode}
252
+ >
253
+ {t.codeGenerateButton}
254
+ </Button>
255
+ </div>
256
+ </FormField>
257
+ <FormField>
258
+ <InputLabel>{t.timingInputLabel}</InputLabel>
259
+ <RadioField
260
+ value={type}
261
+ onChange={setType}
262
+ name='type'
263
+ options={[
264
+ {
265
+ label: t.typeOngoingLabel,
266
+ value: 'ongoing',
267
+ },
268
+ {
269
+ label: t.typeTimeBoundLabel,
270
+ value: 'time_bound',
271
+ },
272
+ ]}
273
+ />
274
+ <>
275
+ {type === 'time_bound' && (
276
+ <AccessCodeFormTimes
277
+ startDate={startDate}
278
+ endDate={endDate}
279
+ onEdit={() => {
280
+ setDatePickerVisible(true)
281
+ }}
282
+ />
283
+ )}
284
+ </>
285
+ </FormField>
279
286
  </>
280
- </FormField>
287
+ )}
281
288
  {responseErrors?.unknown != null && (
282
289
  <div className='seam-unknown-error'>{responseErrors?.unknown}</div>
283
290
  )}
@@ -7,9 +7,8 @@ import {
7
7
  isThermostatDevice,
8
8
  } from 'seamapi'
9
9
 
10
- import { useDevice } from 'lib/index.js'
11
-
12
10
  import { getSystemTimeZone } from 'lib/dates.js'
11
+ import { useDevice } from 'lib/index.js'
13
12
  import { ClimateSettingScheduleFormClimateSetting } from 'lib/ui/ClimateSettingForm/ClimateSettingScheduleFormClimateSetting.js'
14
13
  import { ClimateSettingScheduleFormDefaultClimateSetting } from 'lib/ui/ClimateSettingForm/ClimateSettingScheduleFormDefaultClimateSetting.js'
15
14
  import { ClimateSettingScheduleFormDeviceSelect } from 'lib/ui/ClimateSettingForm/ClimateSettingScheduleFormDeviceSelect.js'
@@ -1,5 +1,5 @@
1
1
  import classNames from 'classnames'
2
- import { cloneElement, useRef } from 'react'
2
+ import { type Attributes, cloneElement, useRef } from 'react'
3
3
 
4
4
  import { DateTimePicker } from 'lib/ui/DateTimePicker/DateTimePicker.js'
5
5
  import { InputLabel } from 'lib/ui/InputLabel.js'
@@ -27,7 +27,7 @@ export function FormField({
27
27
  // Map children to automatically focus on input when clicking
28
28
  // on an InputLabel.
29
29
  const clonedChildren = components.map((component, index) => {
30
- const baseProps = {
30
+ const baseProps: Attributes = {
31
31
  ...component.props,
32
32
  key: index,
33
33
  }
@@ -1,3 +1,3 @@
1
- const seamapiReactVersion = '2.10.1'
1
+ const seamapiReactVersion = '2.11.0'
2
2
 
3
3
  export default seamapiReactVersion
@@ -1,3 +1,4 @@
1
+ @use 'sass:math';
1
2
  @use './colors';
2
3
 
3
4
  $row-height: 64px;
@@ -175,7 +176,11 @@ $see-all-button-height: 30px;
175
176
  0 1px 1px 0 rgb(16 27 37 / 10%),
176
177
  0 1px 8px 0 rgb(46 69 82 / 12%);
177
178
  position: absolute;
178
- bottom: -($row-height - $see-all-button-height - $row-padding) / 2;
179
+ bottom: math.div(
180
+ -($row-height - $see-all-button-height - $row-padding),
181
+ 2
182
+ )
183
+ or calc(-1 * ($row-height - $see-all-button-height - $row-padding) / 2);
179
184
  left: 50%;
180
185
  transform: translate(-50%, -47px);
181
186
  z-index: 3;