@danxbot/ui 20.4.1 → 20.4.3

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/index.js CHANGED
@@ -50983,50 +50983,53 @@ function e7({
50983
50983
  function t7({
50984
50984
  apiKey: e,
50985
50985
  busy: t,
50986
- onRevokeGrant: n
50986
+ onRevokeGrant: n,
50987
+ renderName: r,
50988
+ renderStatus: o
50987
50989
  }) {
50988
- const r = e.grants ?? [];
50990
+ const s = e.grants ?? [], i = o?.(e);
50989
50991
  return /* @__PURE__ */ R("div", { className: "flex min-w-0 flex-col gap-2", children: [
50990
- /* @__PURE__ */ u(tf, { primary: e.name, secondary: `Created ${xr(e.createdAt)}` }),
50991
- r.length > 0 && /* @__PURE__ */ u("ul", { "aria-label": `Permissions added to ${e.name}`, className: "flex min-w-0 flex-col gap-1.5", children: r.map((o) => /* @__PURE__ */ u(e7, { apiKey: e, grant: o, busy: t, onRevokeGrant: n }, o.id)) })
50992
+ /* @__PURE__ */ u(tf, { primary: r?.(e) ?? e.name, secondary: `Created ${xr(e.createdAt)}` }),
50993
+ i,
50994
+ s.length > 0 && /* @__PURE__ */ u("ul", { "aria-label": `Permissions added to ${e.name}`, className: "flex min-w-0 flex-col gap-1.5", children: s.map((a) => /* @__PURE__ */ u(e7, { apiKey: e, grant: a, busy: t, onRevokeGrant: n }, a.id)) })
50992
50995
  ] });
50993
50996
  }
50994
- function n7(e, t, n, r) {
50997
+ function n7(e, t, n, r, o, s) {
50995
50998
  return [
50996
50999
  {
50997
51000
  id: "key",
50998
51001
  header: "Key",
50999
- accessorFn: (o) => o.name,
51000
- cell: ({ row: o }) => /* @__PURE__ */ u(t7, { apiKey: o.original, busy: e === o.original.id, onRevokeGrant: r })
51002
+ accessorFn: (i) => i.name,
51003
+ cell: ({ row: i }) => /* @__PURE__ */ u(t7, { apiKey: i.original, busy: e === i.original.id, onRevokeGrant: r, renderName: o, renderStatus: s })
51001
51004
  },
51002
51005
  {
51003
51006
  id: "role",
51004
51007
  header: "Role",
51005
- accessorFn: (o) => o.roleLabel,
51006
- cell: ({ row: o }) => /* @__PURE__ */ u(Q9, { apiKey: o.original, busy: e === o.original.id, editor: n })
51008
+ accessorFn: (i) => i.roleLabel,
51009
+ cell: ({ row: i }) => /* @__PURE__ */ u(Q9, { apiKey: i.original, busy: e === i.original.id, editor: n })
51007
51010
  },
51008
51011
  {
51009
51012
  id: "lastUsed",
51010
51013
  header: "Last used",
51011
- accessorFn: (o) => o.lastUsedAt ?? "",
51012
- cell: ({ row: o }) => /* @__PURE__ */ u("span", { className: "text-secondary", children: o.original.lastUsedAt ? xr(o.original.lastUsedAt) : "Never" })
51014
+ accessorFn: (i) => i.lastUsedAt ?? "",
51015
+ cell: ({ row: i }) => /* @__PURE__ */ u("span", { className: "text-secondary", children: i.original.lastUsedAt ? xr(i.original.lastUsedAt) : "Never" })
51013
51016
  },
51014
51017
  {
51015
51018
  id: "expires",
51016
51019
  header: "Expires",
51017
- accessorFn: (o) => o.expiresAt ?? "",
51018
- cell: ({ row: o }) => /* @__PURE__ */ u("span", { className: "text-secondary", children: o.original.expiresAt ? di(o.original.expiresAt) : "Never" })
51020
+ accessorFn: (i) => i.expiresAt ?? "",
51021
+ cell: ({ row: i }) => /* @__PURE__ */ u("span", { className: "text-secondary", children: i.original.expiresAt ? di(i.original.expiresAt) : "Never" })
51019
51022
  },
51020
51023
  {
51021
51024
  id: "actions",
51022
51025
  header: "",
51023
51026
  enableSorting: !1,
51024
- cell: ({ row: o }) => /* @__PURE__ */ u("div", { className: "flex justify-end", children: /* @__PURE__ */ u(J9, { apiKey: o.original, busy: e === o.original.id, onRevoke: t }) })
51027
+ cell: ({ row: i }) => /* @__PURE__ */ u("div", { className: "flex justify-end", children: /* @__PURE__ */ u(J9, { apiKey: i.original, busy: e === i.original.id, onRevoke: t }) })
51025
51028
  }
51026
51029
  ];
51027
51030
  }
51028
- function AT({ keys: e, onRevoke: t, busyId: n, roleEditor: r, onRevokeGrant: o, className: s }) {
51029
- return /* @__PURE__ */ u(ef, { columns: n7(n, t, r, o), data: e, getRowId: (i) => String(i.id), className: s });
51031
+ function AT({ keys: e, onRevoke: t, busyId: n, roleEditor: r, onRevokeGrant: o, renderName: s, renderStatus: i, className: a }) {
51032
+ return /* @__PURE__ */ u(ef, { columns: n7(n, t, r, o, s, i), data: e, getRowId: (c) => String(c.id), className: a });
51030
51033
  }
51031
51034
  function UQ({
51032
51035
  keys: e,
@@ -51180,15 +51183,15 @@ function UQ({
51180
51183
  )
51181
51184
  ] });
51182
51185
  }
51183
- function jQ({ keys: e, onRevoke: t, busyId: n, roleEditor: r, onRevokeGrant: o, emptyState: s, className: i }) {
51184
- return e.length === 0 ? s ?? /* @__PURE__ */ u(
51186
+ function jQ({ keys: e, onRevoke: t, busyId: n, roleEditor: r, onRevokeGrant: o, renderName: s, renderStatus: i, emptyState: a, className: c }) {
51187
+ return e.length === 0 ? a ?? /* @__PURE__ */ u(
51185
51188
  Mi,
51186
51189
  {
51187
51190
  icon: /* @__PURE__ */ u(ae, { name: "bot", size: "lg", className: "text-tertiary" }),
51188
51191
  title: "No agent sessions",
51189
51192
  description: "Claude Code sessions, workers and dispatches that act as you appear here once you approve their access."
51190
51193
  }
51191
- ) : /* @__PURE__ */ u(AT, { keys: e, onRevoke: t, busyId: n, roleEditor: r, onRevokeGrant: o, className: i });
51194
+ ) : /* @__PURE__ */ u(AT, { keys: e, onRevoke: t, busyId: n, roleEditor: r, onRevokeGrant: o, renderName: s, renderStatus: i, className: c });
51192
51195
  }
51193
51196
  const r7 = {
51194
51197
  pending: { tone: "warning", label: "Pending" },
@@ -51305,38 +51308,38 @@ function GQ({
51305
51308
  onDeny: a,
51306
51309
  className: c
51307
51310
  }) {
51308
- const l = new Set(o), d = s !== void 0 && G0(s, n, l) ? s : Z9(n, l), [p, f] = re(""), h = G0(p, n, l) ? p : d, { busy: m, error: g, run: x } = $T(), b = t === "pending";
51311
+ const l = new Set(o), d = s !== void 0 && G0(s, n, l), p = d ? s : Z9(n, l), f = n.find((C) => C.id === p), [h, m] = re(""), g = G0(h, n, l) ? h : p, { busy: x, error: b, run: y } = $T(), v = t === "pending";
51309
51312
  return /* @__PURE__ */ R("div", { className: B("flex flex-col gap-5", c), children: [
51310
51313
  /* @__PURE__ */ u(DT, { title: "Access request", state: t }),
51311
- /* @__PURE__ */ u(cl, { entries: i7(e, b), className: "divide-y divide-border-subtle" }),
51312
- b ? /* @__PURE__ */ R(qe, { children: [
51314
+ /* @__PURE__ */ u(cl, { entries: i7(e, v), className: "divide-y divide-border-subtle" }),
51315
+ v ? /* @__PURE__ */ R(qe, { children: [
51313
51316
  /* @__PURE__ */ u(_T, { code: e.confirmCode }),
51314
51317
  /* @__PURE__ */ R(Ft, { tone: "warning", title: "Approve only if you started this", children: [
51315
51318
  "Approving lets ",
51316
51319
  e.kind === "worker" ? "this worker" : "this session",
51317
51320
  " act as you with the role you pick, for as long as it keeps being used. If the code does not match, or you did not ask for this, deny it."
51318
51321
  ] }),
51319
- /* @__PURE__ */ u(FT, { error: g }),
51320
- d === "" ? /* @__PURE__ */ u(Ft, { tone: "danger", title: "No role available", children: "Every role holds a permission you don't have, so you can't approve this request. You can still deny it." }) : /* @__PURE__ */ u(
51322
+ /* @__PURE__ */ u(FT, { error: b }),
51323
+ f === void 0 ? /* @__PURE__ */ u(Ft, { tone: "danger", title: "No role available", children: "Every role holds a permission you don't have, so you can't approve this request. You can still deny it." }) : /* @__PURE__ */ u(
51321
51324
  OT,
51322
51325
  {
51323
51326
  roles: n,
51324
51327
  permissions: r,
51325
51328
  ownPermissionKeys: o,
51326
- value: h,
51327
- onValueChange: f,
51328
- description: "The key can do what this role can, never more than you can. The narrowest allowed role is chosen for you.",
51329
- disabled: m !== null
51329
+ value: g,
51330
+ onValueChange: m,
51331
+ description: `The key can do what this role can, never more than you can. ${d ? `${f.label}, the default, is chosen for you.` : `The narrowest allowed role, ${f.label}, is chosen for you.`}`,
51332
+ disabled: x !== null
51330
51333
  }
51331
51334
  ),
51332
51335
  /* @__PURE__ */ u(
51333
51336
  VT,
51334
51337
  {
51335
- busy: m,
51336
- run: x,
51337
- onApprove: () => i(h),
51338
+ busy: x,
51339
+ run: y,
51340
+ onApprove: () => i(g),
51338
51341
  onDeny: a,
51339
- approveDisabled: h === ""
51342
+ approveDisabled: g === ""
51340
51343
  }
51341
51344
  )
51342
51345
  ] }) : /* @__PURE__ */ u(a7, { state: t, request: e })