@seamapi/react 1.12.0 → 1.14.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.
package/dist/elements.js CHANGED
@@ -8077,7 +8077,7 @@ const mm = "https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;60
8077
8077
  const n = globalThis.document.createElement("link");
8078
8078
  n.rel = "stylesheet", n.type = "text/css", n.href = mm, globalThis.document.head.appendChild(n);
8079
8079
  }, [t]);
8080
- }, NE = "1.12.0", HE = "https://react.seam.co", DE = ({
8080
+ }, NE = "1.14.0", HE = "https://react.seam.co", DE = ({
8081
8081
  disabled: t = !1,
8082
8082
  unminified: e = !1
8083
8083
  }) => {
@@ -24640,56 +24640,64 @@ function wT(t) {
24640
24640
  }
24641
24641
  function ET({
24642
24642
  deviceIds: t,
24643
- onBack: e,
24644
- className: n
24643
+ onDeviceClick: e = () => {
24644
+ },
24645
+ preventDefaultOnDeviceClick: n = !1,
24646
+ onBack: r,
24647
+ className: i
24645
24648
  } = {}) {
24646
- const { devices: r, isLoading: i, isError: o, error: s } = wT({
24649
+ const { devices: o, isLoading: s, isError: l, error: c } = wT({
24647
24650
  device_ids: t
24648
- }), [l, c] = k.useState(null), [a, u] = k.useState("");
24649
- if (l != null)
24651
+ }), [a, u] = k.useState(null), [p, d] = k.useState(""), f = k.useCallback(
24652
+ (b) => {
24653
+ e(b), !n && u(b);
24654
+ },
24655
+ [e, n, u]
24656
+ );
24657
+ if (a != null)
24650
24658
  return /* @__PURE__ */ v.jsx(
24651
24659
  Wf,
24652
24660
  {
24653
- className: n,
24654
- deviceId: l,
24661
+ className: i,
24662
+ deviceId: a,
24655
24663
  onBack: () => {
24656
- c(null);
24664
+ u(null);
24657
24665
  }
24658
24666
  }
24659
24667
  );
24660
- if (i)
24661
- return /* @__PURE__ */ v.jsx("p", { className: n, children: "..." });
24662
- if (o)
24663
- return /* @__PURE__ */ v.jsx("p", { className: n, children: s == null ? void 0 : s.message });
24664
- if (r == null)
24668
+ if (s)
24669
+ return /* @__PURE__ */ v.jsx("p", { className: i, children: "..." });
24670
+ if (l)
24671
+ return /* @__PURE__ */ v.jsx("p", { className: i, children: c == null ? void 0 : c.message });
24672
+ if (o == null)
24665
24673
  return null;
24666
- const p = r.length, d = r.filter((f) => a === "" ? !0 : new RegExp(a, "i").test(f.properties.name));
24667
- return /* @__PURE__ */ v.jsxs("div", { className: Re("seam-device-table", n), children: [
24668
- /* @__PURE__ */ v.jsx(nd, { onBack: e }),
24674
+ const h = o.length, g = o.filter((b) => p === "" ? !0 : new RegExp(p, "i").test(b.properties.name));
24675
+ return /* @__PURE__ */ v.jsxs("div", { className: Re("seam-device-table", i), children: [
24676
+ /* @__PURE__ */ v.jsx(nd, { onBack: r }),
24669
24677
  /* @__PURE__ */ v.jsxs(M1, { children: [
24670
24678
  /* @__PURE__ */ v.jsxs(j1, { children: [
24671
24679
  H1.devices,
24672
24680
  " ",
24673
24681
  /* @__PURE__ */ v.jsxs(z1, { children: [
24674
24682
  "(",
24675
- p,
24683
+ h,
24676
24684
  ")"
24677
24685
  ] })
24678
24686
  ] }),
24679
24687
  /* @__PURE__ */ v.jsx(
24680
24688
  Qf,
24681
24689
  {
24682
- value: a,
24683
- onChange: u,
24684
- disabled: p === 0
24690
+ value: p,
24691
+ onChange: d,
24692
+ disabled: h === 0
24685
24693
  }
24686
24694
  )
24687
24695
  ] }),
24688
- /* @__PURE__ */ v.jsx(x1, { children: /* @__PURE__ */ v.jsx(OT, { devices: d, selectDevice: c }) })
24696
+ /* @__PURE__ */ v.jsx(x1, { children: /* @__PURE__ */ v.jsx(OT, { devices: g, onDeviceClick: f }) })
24689
24697
  ] });
24690
24698
  }
24691
24699
  function OT(t) {
24692
- const { devices: e, selectDevice: n } = t, [r, i] = k.useState(null);
24700
+ const { devices: e, onDeviceClick: n } = t, [r, i] = k.useState(null);
24693
24701
  if (e.length === 0)
24694
24702
  return /* @__PURE__ */ v.jsx(C1, { children: H1.noDevicesMessage });
24695
24703
  const o = e.filter((s) => r === null ? !0 : r === "device_issues" ? s.errors.length > 0 : !0);
@@ -24719,6 +24727,9 @@ const H1 = {
24719
24727
  unknownLock: "Unknown Lock",
24720
24728
  noDevicesMessage: "Sorry, no devices were found"
24721
24729
  }, IT = "seam-device-table", CT = {
24730
+ deviceIds: "json",
24731
+ onDeviceClick: "function",
24732
+ preventDefaultOnDeviceClick: "boolean",
24722
24733
  onBack: "function",
24723
24734
  className: "string"
24724
24735
  }, xT = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({