@nivaro/react 0.3.118 → 0.3.120

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.
@@ -10,7 +10,7 @@ import { noteReplayIdle as Me, createReplayIdleState as Ne, REPLAY_IDLE_RESTART_
10
10
  import { noteReplayEvent as Ue, createReplayCheckoutState as We } from "../shared/lib/replay-checkout.js";
11
11
  import { instrumentConsole as He, instrumentRequests as Ke, redactSecrets as $e } from "../shared/lib/replay-context.js";
12
12
  import { instrumentSocket as Be } from "../shared/lib/replay-socket.js";
13
- const ze = "nivaro-react@0.3.118", V = 1e4, Ye = 150, xe = 3e3, je = 600, Ge = (o) => `nvr_replay_resume${o ? `:${o}` : ""}`, X = () => typeof navigator > "u" || navigator.onLine !== !1;
13
+ const ze = "nivaro-react@0.3.120", V = 1e4, Ye = 150, xe = 3e3, je = 600, Ge = (o) => `nvr_replay_resume${o ? `:${o}` : ""}`, X = () => typeof navigator > "u" || navigator.onLine !== !1;
14
14
  function Je(o) {
15
15
  return typeof o.url != "string" || typeof fetch != "function" ? null : (f, u) => {
16
16
  const l = typeof o.getToken == "function" ? o.getToken() : void 0, d = { "Content-Type": "application/json" };
@@ -0,0 +1,61 @@
1
+ import { jsxs as p, jsx as r } from "react/jsx-runtime";
2
+ import { Check as u, Copy as f } from "lucide-react";
3
+ import { useState as b, useRef as x, useEffect as h } from "react";
4
+ import { toast as y } from "sonner";
5
+ import { cn as i } from "../lib/utils.js";
6
+ function N({
7
+ value: d,
8
+ label: s = "Copy",
9
+ className: l,
10
+ testId: n
11
+ }) {
12
+ const [e, o] = b("idle"), t = x(null);
13
+ h(
14
+ () => () => {
15
+ t.current && clearTimeout(t.current);
16
+ },
17
+ []
18
+ );
19
+ const a = (m) => {
20
+ o(m), t.current && clearTimeout(t.current), t.current = setTimeout(() => o("idle"), 2e3);
21
+ }, c = async () => {
22
+ try {
23
+ await navigator.clipboard.writeText(d), a("copied");
24
+ } catch {
25
+ a("failed"), y.error("Could not copy — select the text and copy it instead");
26
+ }
27
+ };
28
+ return /* @__PURE__ */ p("span", { className: "inline-flex shrink-0 items-center gap-1.5", children: [
29
+ /* @__PURE__ */ r(
30
+ "button",
31
+ {
32
+ type: "button",
33
+ onClick: () => void c(),
34
+ "aria-label": s,
35
+ "data-copy-state": e,
36
+ "data-testid": n,
37
+ className: i(
38
+ "rounded-md border p-2 transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/50",
39
+ e === "copied" ? "border-emerald-300 bg-emerald-50 text-emerald-600 dark:border-emerald-500/40 dark:bg-emerald-500/10 dark:text-emerald-400" : "border-slate-200 text-slate-500 hover:bg-slate-50 dark:border-border dark:hover:bg-muted",
40
+ l
41
+ ),
42
+ children: e === "copied" ? /* @__PURE__ */ r(u, { className: "h-4 w-4" }) : /* @__PURE__ */ r(f, { className: "h-4 w-4" })
43
+ }
44
+ ),
45
+ /* @__PURE__ */ r(
46
+ "span",
47
+ {
48
+ role: "status",
49
+ "aria-live": "polite",
50
+ className: i(
51
+ "min-w-[3.25rem] text-[11.5px] font-medium",
52
+ e === "copied" ? "text-emerald-600 dark:text-emerald-400" : e === "failed" ? "text-red-600 dark:text-red-400" : "invisible"
53
+ ),
54
+ children: e === "failed" ? "Not copied" : "Copied"
55
+ }
56
+ )
57
+ ] });
58
+ }
59
+ export {
60
+ N as CopyValueButton
61
+ };
@@ -1,7 +1,8 @@
1
- import { jsx as n, jsxs as a, Fragment as x } from "react/jsx-runtime";
1
+ import { jsx as n, jsxs as r, Fragment as x } from "react/jsx-runtime";
2
2
  import { cn as g } from "../lib/utils.js";
3
- import { Popover as k, PopoverTrigger as N, PopoverContent as v } from "./ui/popover.js";
4
- function P({
3
+ import { UserChip as v } from "./item-edit/UserChip.js";
4
+ import { Popover as k, PopoverTrigger as N, PopoverContent as w } from "./ui/popover.js";
5
+ function I({
5
6
  editors: t,
6
7
  noun: i,
7
8
  rowLabel: m,
@@ -10,9 +11,9 @@ function P({
10
11
  }) {
11
12
  if (t.length === 0) return null;
12
13
  const l = (e) => {
13
- const r = m(e.item) || e.item, h = e.field ? s == null ? void 0 : s(e.field, e.item) : null;
14
- return h ? `${r} · ${h}` : r;
15
- }, d = t.slice(0, 3), p = t.length - d.length, c = t.every((e) => e.item === t[0].item), u = (e) => e.field ? s == null ? void 0 : s(e.field, e.item) : null;
14
+ const a = m(e.item) || e.item, h = e.field ? s == null ? void 0 : s(e.field, e.item) : null;
15
+ return h ? `${a} · ${h}` : a;
16
+ }, o = t.slice(0, 3), u = t.length - o.length, d = t.every((e) => e.item === t[0].item), p = (e) => e.field ? s == null ? void 0 : s(e.field, e.item) : null;
16
17
  return /* @__PURE__ */ n(
17
18
  "div",
18
19
  {
@@ -23,7 +24,7 @@ function P({
23
24
  "flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 text-[12px] text-slate-600 dark:text-slate-300",
24
25
  f
25
26
  ),
26
- children: t.length === 1 ? /* @__PURE__ */ a(o, { editor: t[0], children: [
27
+ children: t.length === 1 ? /* @__PURE__ */ r(c, { editor: t[0], children: [
27
28
  /* @__PURE__ */ n("span", { className: "font-medium text-slate-900 dark:text-slate-50", children: t[0].name }),
28
29
  " ",
29
30
  "is editing ",
@@ -31,11 +32,11 @@ function P({
31
32
  " for",
32
33
  " ",
33
34
  /* @__PURE__ */ n("span", { className: "font-medium text-slate-900 dark:text-slate-50", children: l(t[0]) })
34
- ] }) : /* @__PURE__ */ a(x, { children: [
35
- /* @__PURE__ */ a("span", { children: [
35
+ ] }) : /* @__PURE__ */ r(x, { children: [
36
+ /* @__PURE__ */ r("span", { children: [
36
37
  "Editing ",
37
38
  i,
38
- c && /* @__PURE__ */ a(x, { children: [
39
+ d && /* @__PURE__ */ r(x, { children: [
39
40
  " ",
40
41
  "for",
41
42
  " ",
@@ -43,18 +44,18 @@ function P({
43
44
  ] }),
44
45
  ":"
45
46
  ] }),
46
- d.map((e) => {
47
- const r = c ? u(e) : l(e);
48
- return /* @__PURE__ */ a(o, { editor: e, children: [
47
+ o.map((e) => {
48
+ const a = d ? p(e) : l(e);
49
+ return /* @__PURE__ */ r(c, { editor: e, children: [
49
50
  /* @__PURE__ */ n("span", { className: "font-medium text-slate-900 dark:text-slate-50", children: e.name }),
50
- r && /* @__PURE__ */ a("span", { className: "text-slate-500 dark:text-slate-400", children: [
51
+ a && /* @__PURE__ */ r("span", { className: "text-slate-500 dark:text-slate-400", children: [
51
52
  " · ",
52
- r
53
+ a
53
54
  ] })
54
55
  ] }, `${e.userId}|${e.page}`);
55
56
  }),
56
- p > 0 && /* @__PURE__ */ a(k, { children: [
57
- /* @__PURE__ */ n(N, { asChild: !0, children: /* @__PURE__ */ a(
57
+ u > 0 && /* @__PURE__ */ r(k, { children: [
58
+ /* @__PURE__ */ n(N, { asChild: !0, children: /* @__PURE__ */ r(
58
59
  "button",
59
60
  {
60
61
  type: "button",
@@ -62,18 +63,18 @@ function P({
62
63
  className: "rounded text-slate-600 underline decoration-slate-300 underline-offset-2 hover:text-slate-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/40 dark:text-slate-300 dark:decoration-slate-600 dark:hover:text-white",
63
64
  children: [
64
65
  "and ",
65
- p,
66
+ u,
66
67
  " more"
67
68
  ]
68
69
  }
69
70
  ) }),
70
- /* @__PURE__ */ n(v, { align: "end", className: "w-72 p-2", children: /* @__PURE__ */ n("ul", { className: "space-y-1.5 text-[12px] text-slate-600 dark:text-slate-300", children: t.slice(d.length).map((e) => {
71
- const r = c ? u(e) : l(e);
72
- return /* @__PURE__ */ n("li", { children: /* @__PURE__ */ a(o, { editor: e, children: [
71
+ /* @__PURE__ */ n(w, { align: "end", className: "w-72 p-2", children: /* @__PURE__ */ n("ul", { className: "space-y-1.5 text-[12px] text-slate-600 dark:text-slate-300", children: t.slice(o.length).map((e) => {
72
+ const a = d ? p(e) : l(e);
73
+ return /* @__PURE__ */ n("li", { children: /* @__PURE__ */ r(c, { editor: e, children: [
73
74
  /* @__PURE__ */ n("span", { className: "font-medium text-slate-900 dark:text-slate-50", children: e.name }),
74
- r && /* @__PURE__ */ a("span", { className: "text-slate-500 dark:text-slate-400", children: [
75
+ a && /* @__PURE__ */ r("span", { className: "text-slate-500 dark:text-slate-400", children: [
75
76
  " · ",
76
- r
77
+ a
77
78
  ] })
78
79
  ] }) }, `${e.userId}|${e.page}`);
79
80
  }) }) })
@@ -82,19 +83,28 @@ function P({
82
83
  }
83
84
  );
84
85
  }
85
- function o({ editor: t, children: i }) {
86
- return /* @__PURE__ */ a("span", { className: "inline-flex min-w-0 items-baseline gap-1.5", "data-grid-presence-person": !0, children: [
87
- /* @__PURE__ */ n(
88
- "span",
89
- {
90
- "aria-hidden": !0,
91
- className: "h-2 w-2 shrink-0 translate-y-[-1px] self-center rounded-full",
92
- style: { background: t.color }
93
- }
94
- ),
95
- /* @__PURE__ */ n("span", { className: "min-w-0 break-words", children: i })
96
- ] });
86
+ function c({ editor: t, children: i }) {
87
+ return /* @__PURE__ */ n(v, { userId: t.userId, children: /* @__PURE__ */ r(
88
+ "button",
89
+ {
90
+ type: "button",
91
+ "data-grid-presence-person": !0,
92
+ "aria-label": `Show ${t.name}`,
93
+ className: "inline-flex min-w-0 cursor-pointer items-baseline gap-1.5 rounded text-left decoration-slate-300 underline-offset-2 hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-nvr-cyan/40 dark:decoration-slate-600",
94
+ children: [
95
+ /* @__PURE__ */ n(
96
+ "span",
97
+ {
98
+ "aria-hidden": !0,
99
+ className: "h-2 w-2 shrink-0 translate-y-[-1px] self-center rounded-full",
100
+ style: { background: t.color }
101
+ }
102
+ ),
103
+ /* @__PURE__ */ n("span", { className: "min-w-0 break-words", children: i })
104
+ ]
105
+ }
106
+ ) });
97
107
  }
98
108
  export {
99
- P as GridPresenceLine
109
+ I as GridPresenceLine
100
110
  };