@exegia/corpora-ui 0.9.0 → 0.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.
@@ -16,6 +16,12 @@ export interface LinkedAccountsBlockProps {
16
16
  providers?: SocialProvider[];
17
17
  /** Shows the loading row instead of the list. */
18
18
  loading?: boolean;
19
+ /**
20
+ * The account can also sign in through a method that has no row in this
21
+ * list — an email/password credential, say. Lifts the last-method guard,
22
+ * which otherwise refuses to disconnect the final listed identity.
23
+ */
24
+ hasOtherSignInMethods?: boolean;
19
25
  /** Reject (or throw) to show the inline error. */
20
26
  onLink?: (provider: SocialProvider) => Promise<void> | void;
21
27
  onUnlink?: (id: string) => Promise<void> | void;
@@ -27,4 +33,4 @@ export interface LinkedAccountsBlockProps {
27
33
  * remaining method from being disconnected — the guard is a disabled button
28
34
  * plus an explanation rather than an error after the fact.
29
35
  */
30
- export declare function LinkedAccountsBlock({ title, description, identities, providers, loading, onLink, onUnlink, className, }: LinkedAccountsBlockProps): React.JSX.Element;
36
+ export declare function LinkedAccountsBlock({ title, description, identities, providers, loading, hasOtherSignInMethods, onLink, onUnlink, className, }: LinkedAccountsBlockProps): React.JSX.Element;
package/dist-lib/index.js CHANGED
@@ -1546,36 +1546,36 @@ function rn({ title: e = "Connected accounts", description: t = "Manage the acco
1546
1546
  "google",
1547
1547
  "apple",
1548
1548
  "github"
1549
- ], loading: o = !1, onLink: s, onUnlink: c, className: l }) {
1550
- let u = D.useId(), [d, f] = D.useState(null), [p, m] = D.useState(null), [h, g] = D.useState(null), _ = new Set(n.map((e) => e.provider)), v = r.filter((e) => !_.has(e)), y = p !== null || h !== null, b = n.length <= 1;
1551
- async function x(e) {
1552
- if (!y) {
1553
- f(null), m(e);
1549
+ ], loading: o = !1, hasOtherSignInMethods: s = !1, onLink: c, onUnlink: l, className: u }) {
1550
+ let d = D.useId(), [f, p] = D.useState(null), [m, h] = D.useState(null), [g, _] = D.useState(null), v = new Set(n.map((e) => e.provider)), y = r.filter((e) => !v.has(e)), b = m !== null || g !== null, x = !s && n.length <= 1;
1551
+ async function S(e) {
1552
+ if (!b) {
1553
+ p(null), h(e);
1554
1554
  try {
1555
- await s?.(e);
1555
+ await c?.(e);
1556
1556
  } catch (e) {
1557
- f(e instanceof Error ? e.message : "Unable to connect account.");
1557
+ p(e instanceof Error ? e.message : "Unable to connect account.");
1558
1558
  } finally {
1559
- m(null);
1559
+ h(null);
1560
1560
  }
1561
1561
  }
1562
1562
  }
1563
- async function S(e) {
1564
- if (!(y || b)) {
1565
- f(null), g(e);
1563
+ async function C(e) {
1564
+ if (!(b || x)) {
1565
+ p(null), _(e);
1566
1566
  try {
1567
- await c?.(e);
1567
+ await l?.(e);
1568
1568
  } catch (e) {
1569
- f(e instanceof Error ? e.message : "Unable to disconnect account.");
1569
+ p(e instanceof Error ? e.message : "Unable to disconnect account.");
1570
1570
  } finally {
1571
- g(null);
1571
+ _(null);
1572
1572
  }
1573
1573
  }
1574
1574
  }
1575
1575
  return /* @__PURE__ */ i(ge, {
1576
1576
  reducedMotion: "user",
1577
1577
  children: /* @__PURE__ */ a(Ie, {
1578
- className: V("w-full", l),
1578
+ className: V("w-full", u),
1579
1579
  "data-slot": "auth-block",
1580
1580
  children: [/* @__PURE__ */ a(Ue, { children: [/* @__PURE__ */ i(We, { children: e }), /* @__PURE__ */ i(Ge, { children: t })] }), /* @__PURE__ */ i(qe, { children: o ? /* @__PURE__ */ a("div", {
1581
1581
  className: "flex items-center gap-2 text-sm text-muted-foreground",
@@ -1588,7 +1588,7 @@ function rn({ title: e = "Connected accounts", description: t = "Manage the acco
1588
1588
  },
1589
1589
  className: "flex flex-col gap-3",
1590
1590
  children: [
1591
- /* @__PURE__ */ i(X, { message: d }),
1591
+ /* @__PURE__ */ i(X, { message: f }),
1592
1592
  n.length > 0 ? /* @__PURE__ */ i("ul", {
1593
1593
  "aria-label": "Connected accounts",
1594
1594
  className: "flex flex-col gap-2",
@@ -1632,14 +1632,14 @@ function rn({ title: e = "Connected accounts", description: t = "Manage the acco
1632
1632
  })]
1633
1633
  })]
1634
1634
  }), /* @__PURE__ */ i(H, {
1635
- "aria-describedby": b ? u : void 0,
1635
+ "aria-describedby": x ? d : void 0,
1636
1636
  "aria-label": `Disconnect ${n}`,
1637
1637
  size: "sm",
1638
1638
  type: "button",
1639
1639
  variant: "destructive-outline",
1640
- disabled: y || b,
1641
- loading: h === e.id,
1642
- onClick: () => void S(e.id),
1640
+ disabled: b || x,
1641
+ loading: g === e.id,
1642
+ onClick: () => void C(e.id),
1643
1643
  children: "Disconnect"
1644
1644
  })]
1645
1645
  }, e.id);
@@ -1649,20 +1649,20 @@ function rn({ title: e = "Connected accounts", description: t = "Manage the acco
1649
1649
  className: "text-sm text-muted-foreground",
1650
1650
  children: "No sign-in methods connected yet."
1651
1651
  }),
1652
- b && n.length > 0 && /* @__PURE__ */ i("p", {
1652
+ x && n.length > 0 && /* @__PURE__ */ i("p", {
1653
1653
  className: "text-xs text-muted-foreground",
1654
- id: u,
1654
+ id: d,
1655
1655
  children: nn
1656
1656
  }),
1657
- v.map((e) => {
1657
+ y.map((e) => {
1658
1658
  let { label: t, Icon: n } = Gt[e];
1659
1659
  return /* @__PURE__ */ a(H, {
1660
1660
  className: "w-full",
1661
1661
  type: "button",
1662
1662
  variant: "outline",
1663
- disabled: y,
1664
- loading: p === e,
1665
- onClick: () => void x(e),
1663
+ disabled: b,
1664
+ loading: m === e,
1665
+ onClick: () => void S(e),
1666
1666
  children: [/* @__PURE__ */ i(n, { "aria-hidden": "true" }), /* @__PURE__ */ a("span", {
1667
1667
  className: "flex-1",
1668
1668
  children: ["Connect ", t]