@danxbot/ui 20.4.0 → 20.4.2

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
@@ -31544,7 +31544,12 @@ function jB(e, t) {
31544
31544
  const a = i >= 1 - UB && s.length > 1;
31545
31545
  return { arcs: s.map((l, d) => d < s.length - 1 || a ? { ...l, length: Math.max(0, l.length - HB) } : l), used: n, overflow: r };
31546
31546
  }
31547
- const ec = (e, t) => t > 0 ? Math.round(e / t * 100) : 0;
31547
+ const ec = (e, t) => (
31548
+ // `part * 100` before the divide: `29 / 100 * 100` is 28.999999999999996 and
31549
+ // would floor to 28. Exact for whole-number inputs, and a part equal to the
31550
+ // total is exactly 100.
31551
+ t > 0 ? Math.floor(e * 100 / t) : 0
31552
+ );
31548
31553
  function GB(e) {
31549
31554
  return e.segments === void 0 ? /* @__PURE__ */ u(WB, { ...e }) : /* @__PURE__ */ u(KB, { ...e });
31550
31555
  }
@@ -51300,38 +51305,38 @@ function GQ({
51300
51305
  onDeny: a,
51301
51306
  className: c
51302
51307
  }) {
51303
- 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";
51308
+ 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";
51304
51309
  return /* @__PURE__ */ R("div", { className: B("flex flex-col gap-5", c), children: [
51305
51310
  /* @__PURE__ */ u(DT, { title: "Access request", state: t }),
51306
- /* @__PURE__ */ u(cl, { entries: i7(e, b), className: "divide-y divide-border-subtle" }),
51307
- b ? /* @__PURE__ */ R(qe, { children: [
51311
+ /* @__PURE__ */ u(cl, { entries: i7(e, v), className: "divide-y divide-border-subtle" }),
51312
+ v ? /* @__PURE__ */ R(qe, { children: [
51308
51313
  /* @__PURE__ */ u(_T, { code: e.confirmCode }),
51309
51314
  /* @__PURE__ */ R(Ft, { tone: "warning", title: "Approve only if you started this", children: [
51310
51315
  "Approving lets ",
51311
51316
  e.kind === "worker" ? "this worker" : "this session",
51312
51317
  " 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."
51313
51318
  ] }),
51314
- /* @__PURE__ */ u(FT, { error: g }),
51315
- 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(
51319
+ /* @__PURE__ */ u(FT, { error: b }),
51320
+ 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(
51316
51321
  OT,
51317
51322
  {
51318
51323
  roles: n,
51319
51324
  permissions: r,
51320
51325
  ownPermissionKeys: o,
51321
- value: h,
51322
- onValueChange: f,
51323
- description: "The key can do what this role can, never more than you can. The narrowest allowed role is chosen for you.",
51324
- disabled: m !== null
51326
+ value: g,
51327
+ onValueChange: m,
51328
+ 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.`}`,
51329
+ disabled: x !== null
51325
51330
  }
51326
51331
  ),
51327
51332
  /* @__PURE__ */ u(
51328
51333
  VT,
51329
51334
  {
51330
- busy: m,
51331
- run: x,
51332
- onApprove: () => i(h),
51335
+ busy: x,
51336
+ run: y,
51337
+ onApprove: () => i(g),
51333
51338
  onDeny: a,
51334
- approveDisabled: h === ""
51339
+ approveDisabled: g === ""
51335
51340
  }
51336
51341
  )
51337
51342
  ] }) : /* @__PURE__ */ u(a7, { state: t, request: e })