@parallelworks/tandem-web 0.160.1 → 0.161.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.
@@ -0,0 +1,72 @@
1
+ import { groupItems as e, headingOf as t } from "../lib/groupList.js";
2
+ import { IssueGroupHeader as n } from "./IssueSection.js";
3
+ import { useCallback as r, useEffect as i, useMemo as a, useRef as o, useState as s } from "react";
4
+ import { jsx as c } from "react/jsx-runtime";
5
+ import { defaultRangeExtractor as l, useVirtualizer as u } from "@tanstack/react-virtual";
6
+ // src/components/IssueGroupList.tsx
7
+ var d = 41, f = 33;
8
+ function p({ groups: p, count: m, scrollRef: h, keepInView: g, renderRow: _ }) {
9
+ let [v, y] = s(() => /* @__PURE__ */ new Set()), b = a(() => e(p, v), [p, v]), x = a(() => b.flatMap((e, t) => e.kind === "group" ? [t] : []), [b]), S = a(() => new Map(b.flatMap((e, t) => e.kind === "row" ? [[e.issue.id, t]] : [])), [b]), C = o(null), w = o(0), T = r((e) => (w.current = t(x, e.startIndex), [.../* @__PURE__ */ new Set([w.current, ...l(e)])].sort((e, t) => e - t)), [x]), E = u({
10
+ count: b.length,
11
+ getScrollElement: () => h.current,
12
+ estimateSize: (e) => b[e]?.kind === "group" ? f : d,
13
+ getItemKey: (e) => {
14
+ let t = b[e];
15
+ return t?.kind === "group" ? `group:${t.group.key}` : t?.issue.id ?? e;
16
+ },
17
+ overscan: 12,
18
+ rangeExtractor: T,
19
+ scrollMargin: C.current?.offsetTop ?? 0
20
+ });
21
+ i(() => {
22
+ let e = g === void 0 ? void 0 : S.get(g);
23
+ e !== void 0 && E.scrollToIndex(e, { align: "auto" });
24
+ }, [
25
+ g,
26
+ S,
27
+ E
28
+ ]);
29
+ let D = (e) => y((t) => {
30
+ let n = new Set(t);
31
+ return n.delete(e) || n.add(e), n;
32
+ });
33
+ return /* @__PURE__ */ c("ul", {
34
+ ref: C,
35
+ className: "relative w-full",
36
+ style: { height: E.getTotalSize() },
37
+ children: E.getVirtualItems().map((e) => {
38
+ let t = b[e.index];
39
+ if (!t) return null;
40
+ let r = {
41
+ position: "absolute",
42
+ top: 0,
43
+ left: 0,
44
+ width: "100%",
45
+ transform: `translateY(${e.start - E.options.scrollMargin}px)`
46
+ };
47
+ if (t.kind === "row") return _(t.issue, {
48
+ ref: E.measureElement,
49
+ style: r,
50
+ index: e.index
51
+ });
52
+ let i = e.index === w.current;
53
+ return /* @__PURE__ */ c("li", {
54
+ ref: E.measureElement,
55
+ "data-index": e.index,
56
+ style: i ? {
57
+ position: "sticky",
58
+ top: 0
59
+ } : r,
60
+ className: "z-10 border-b border-border bg-background/95 text-xs font-medium backdrop-blur",
61
+ children: /* @__PURE__ */ c("h2", { children: /* @__PURE__ */ c(n, {
62
+ label: t.group.label,
63
+ icon: t.group.icon,
64
+ count: m(t.group),
65
+ open: !v.has(t.group.key),
66
+ onToggle: () => D(t.group.key)
67
+ }) })
68
+ }, e.key);
69
+ })
70
+ });
71
+ }
72
+ export { p as IssueGroupList };
@@ -9,27 +9,31 @@ import { actorAvatar as f } from "../lib/avatar.js";
9
9
  import { useFieldText as p } from "./CustomFields.js";
10
10
  import { PersonHoverCard as m } from "./PersonHoverCard.js";
11
11
  import { Avatar as h, AvatarGroup as g, Checkbox as _, Tooltip as v, useRelativeTime as y } from "@parallelworks/ui";
12
- import { useFormatter as b, useTranslations as x } from "use-intl";
13
- import { jsx as S, jsxs as C } from "react/jsx-runtime";
12
+ import { memo as b } from "react";
13
+ import { useFormatter as x, useTranslations as S } from "use-intl";
14
+ import { jsx as C, jsxs as w } from "react/jsx-runtime";
14
15
  // src/components/IssueRow.tsx
15
- function w({ issue: w, team: T, workspace: E, selected: D = !1, picked: O = !1, viewers: k = [], onPick: A, onHover: j, onClick: M, onContextMenu: N, fields: P = [] }) {
16
- let F = x("issues"), I = b(), L = o(), R = y(w.updatedAt, "compact"), { person: z, nameOf: B, avatarOf: V } = a(E), H = p(E);
17
- return /* @__PURE__ */ C("li", {
18
- id: `row-${w.id}`,
16
+ var T = b(function({ issue: b, team: T, workspace: E, selected: D = !1, picked: O = !1, viewers: k = [], onPick: A, onHover: j, onClick: M, onContextMenu: N, fields: P = [], ref: F, style: I, index: L }) {
17
+ let R = S("issues"), z = x(), B = o(), V = y(b.updatedAt, "compact"), { person: H, nameOf: U, avatarOf: W } = a(E), G = p(E);
18
+ return /* @__PURE__ */ w("li", {
19
+ ref: F,
20
+ style: I,
21
+ "data-index": L,
22
+ id: `row-${b.id}`,
19
23
  onMouseEnter: j,
20
24
  className: `group/row relative flex items-center border-b border-border/60 ${O ? "bg-human-soft" : D ? "bg-muted/70" : ""}`,
21
25
  children: [
22
- O && /* @__PURE__ */ S("span", {
26
+ O && /* @__PURE__ */ C("span", {
23
27
  className: "absolute inset-y-0 left-0 w-0.5 bg-human",
24
28
  "aria-hidden": "true"
25
29
  }),
26
- A && /* @__PURE__ */ S("span", {
30
+ A && /* @__PURE__ */ C("span", {
27
31
  className: `flex shrink-0 pl-4 transition-opacity duration-150 md:pl-5 ${O ? "" : "opacity-0 group-hover/row:opacity-100 has-[:focus-visible]:opacity-100 max-md:opacity-100"}`,
28
- children: /* @__PURE__ */ S(v, {
29
- content: F("selectIssue"),
32
+ children: /* @__PURE__ */ C(v, {
33
+ content: R("selectIssue"),
30
34
  shortcut: "X",
31
- children: /* @__PURE__ */ S(_, {
32
- "aria-label": F("select", { identifier: w.identifier }),
35
+ children: /* @__PURE__ */ C(_, {
36
+ "aria-label": R("select", { identifier: b.identifier }),
33
37
  checked: O,
34
38
  onClick: (e) => {
35
39
  e.preventDefault(), A(e.shiftKey);
@@ -37,121 +41,121 @@ function w({ issue: w, team: T, workspace: E, selected: D = !1, picked: O = !1,
37
41
  })
38
42
  })
39
43
  }),
40
- /* @__PURE__ */ C(e, {
44
+ /* @__PURE__ */ w(e, {
41
45
  to: "/$workspace/issues/$identifier",
42
46
  params: {
43
47
  workspace: E,
44
- identifier: w.identifier
48
+ identifier: b.identifier
45
49
  },
46
50
  onClick: M,
47
51
  onContextMenu: N,
48
52
  className: `flex h-10 min-w-0 flex-1 items-center gap-3 pr-5 text-sm ${A ? "pl-3" : "pl-5"}`,
49
53
  children: [
50
- /* @__PURE__ */ S(t, { priority: w.priority }),
51
- /* @__PURE__ */ C("span", {
52
- className: `flex shrink-0 items-center gap-1 text-xs text-muted-foreground ${w.type ? "w-20" : "w-16"}`,
53
- children: [w.type && /* @__PURE__ */ S(v, {
54
- content: w.type.name,
54
+ /* @__PURE__ */ C(t, { priority: b.priority }),
55
+ /* @__PURE__ */ w("span", {
56
+ className: `flex shrink-0 items-center gap-1 text-xs text-muted-foreground ${b.type ? "w-20" : "w-16"}`,
57
+ children: [b.type && /* @__PURE__ */ C(v, {
58
+ content: b.type.name,
55
59
  describesAnchor: !0,
56
- children: /* @__PURE__ */ S(d, {
57
- type: w.type,
60
+ children: /* @__PURE__ */ C(d, {
61
+ type: b.type,
58
62
  className: "size-3.5"
59
63
  })
60
- }), w.identifier]
64
+ }), b.identifier]
61
65
  }),
62
- /* @__PURE__ */ S(r, { category: w.status.category }),
63
- /* @__PURE__ */ S("span", {
66
+ /* @__PURE__ */ C(r, { category: b.status.category }),
67
+ /* @__PURE__ */ C("span", {
64
68
  className: "min-w-0 flex-1 truncate",
65
- children: w.title
69
+ children: b.title
66
70
  }),
67
- !!w.requests && /* @__PURE__ */ S(v, {
68
- content: F("requestCount", { count: w.requests }),
69
- children: /* @__PURE__ */ C("span", {
71
+ !!b.requests && /* @__PURE__ */ C(v, {
72
+ content: R("requestCount", { count: b.requests }),
73
+ children: /* @__PURE__ */ w("span", {
70
74
  className: "inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground tabular-nums",
71
- children: [/* @__PURE__ */ S(i, { className: "size-3" }), w.requests]
75
+ children: [/* @__PURE__ */ C(i, { className: "size-3" }), b.requests]
72
76
  })
73
77
  }),
74
- w.project && /* @__PURE__ */ C("span", {
78
+ b.project && /* @__PURE__ */ w("span", {
75
79
  className: "hidden max-w-40 shrink-0 items-center gap-1 truncate text-xs text-muted-foreground lg:inline-flex",
76
- children: [/* @__PURE__ */ S(n, { className: "size-3 shrink-0" }), /* @__PURE__ */ S("span", {
80
+ children: [/* @__PURE__ */ C(n, { className: "size-3 shrink-0" }), /* @__PURE__ */ C("span", {
77
81
  className: "truncate",
78
- children: w.project.name
82
+ children: b.project.name
79
83
  })]
80
84
  }),
81
- w.dueDate && /* @__PURE__ */ S(s, {
82
- date: w.dueDate,
83
- closed: w.status.category === "completed" || w.status.category === "canceled"
85
+ b.dueDate && /* @__PURE__ */ C(s, {
86
+ date: b.dueDate,
87
+ closed: b.status.category === "completed" || b.status.category === "canceled"
84
88
  }),
85
- /* @__PURE__ */ S(c, {
86
- issue: w,
89
+ /* @__PURE__ */ C(c, {
90
+ issue: b,
87
91
  team: T
88
92
  }),
89
- !!w.estimate && /* @__PURE__ */ S(v, {
90
- content: F("estimate", { points: w.estimate }),
93
+ !!b.estimate && /* @__PURE__ */ C(v, {
94
+ content: R("estimate", { points: b.estimate }),
91
95
  describesAnchor: !0,
92
- children: /* @__PURE__ */ S("span", {
96
+ children: /* @__PURE__ */ C("span", {
93
97
  className: "hidden h-5 min-w-5 shrink-0 items-center justify-center rounded border border-border px-1 text-[11px] text-muted-foreground tabular-nums sm:inline-flex",
94
- children: l(w.estimate, T?.estimateScale)
98
+ children: l(b.estimate, T?.estimateScale)
95
99
  })
96
100
  }),
97
- /* @__PURE__ */ C("span", {
101
+ /* @__PURE__ */ w("span", {
98
102
  className: "hidden shrink-0 gap-1 md:flex",
99
- children: [P.filter((e) => u(w.fields[e.id])).map((e) => /* @__PURE__ */ S(v, {
103
+ children: [P.filter((e) => u(b.fields[e.id])).map((e) => /* @__PURE__ */ C(v, {
100
104
  content: e.name,
101
105
  describesAnchor: !0,
102
- children: /* @__PURE__ */ S("span", {
106
+ children: /* @__PURE__ */ C("span", {
103
107
  className: "inline-flex max-w-40 items-center truncate rounded-full border border-border px-2 py-0.5 text-[11px] text-muted-foreground",
104
- children: H(e, w.fields[e.id])
108
+ children: G(e, b.fields[e.id])
105
109
  })
106
- }, e.id)), w.labels.map((e) => /* @__PURE__ */ C("span", {
110
+ }, e.id)), b.labels.map((e) => /* @__PURE__ */ w("span", {
107
111
  className: "inline-flex items-center gap-1 rounded-full border border-border px-2 py-0.5 text-[11px]",
108
- children: [/* @__PURE__ */ S("span", {
112
+ children: [/* @__PURE__ */ C("span", {
109
113
  className: "size-2 rounded-full",
110
114
  style: { background: e.color }
111
115
  }), e.name]
112
116
  }, e.id))]
113
117
  }),
114
- k.length > 0 && /* @__PURE__ */ S(v, {
115
- content: F("viewing", { names: I.list(k.map((e) => z(e).name)) }),
116
- children: /* @__PURE__ */ S(g, {
118
+ k.length > 0 && /* @__PURE__ */ C(v, {
119
+ content: R("viewing", { names: z.list(k.map((e) => H(e).name)) }),
120
+ children: /* @__PURE__ */ C(g, {
117
121
  size: "xs",
118
122
  ringColor: "var(--avatar-person-text)",
119
123
  className: "shrink-0",
120
- children: k.map((e) => /* @__PURE__ */ S(m, {
124
+ children: k.map((e) => /* @__PURE__ */ C(m, {
121
125
  workspace: E,
122
126
  handle: e,
123
- children: /* @__PURE__ */ S(h, {
124
- name: z(e).name,
125
- src: z(e).avatarUrl
127
+ children: /* @__PURE__ */ C(h, {
128
+ name: H(e).name,
129
+ src: H(e).avatarUrl
126
130
  })
127
131
  }, e))
128
132
  })
129
133
  }),
130
- /* @__PURE__ */ S(g, {
134
+ /* @__PURE__ */ C(g, {
131
135
  size: "sm",
132
- children: w.assignees.map((e) => /* @__PURE__ */ S(m, {
136
+ children: b.assignees.map((e) => /* @__PURE__ */ C(m, {
133
137
  workspace: E,
134
138
  kind: e.kind,
135
139
  handle: e.handle,
136
- children: /* @__PURE__ */ S(h, {
140
+ children: /* @__PURE__ */ C(h, {
137
141
  ...f(e.kind),
138
- name: B(e.kind, e.handle),
139
- src: V(e.kind, e.handle),
142
+ name: U(e.kind, e.handle),
143
+ src: W(e.kind, e.handle),
140
144
  tooltip: e.kind !== "user"
141
145
  })
142
146
  }, `${e.kind}:${e.handle}`))
143
147
  }),
144
- /* @__PURE__ */ S(v, {
145
- content: F("updated", { time: L.full(w.updatedAt) }),
146
- children: /* @__PURE__ */ S("time", {
147
- dateTime: w.updatedAt,
148
+ /* @__PURE__ */ C(v, {
149
+ content: R("updated", { time: B.full(b.updatedAt) }),
150
+ children: /* @__PURE__ */ C("time", {
151
+ dateTime: b.updatedAt,
148
152
  className: "min-w-10 shrink-0 whitespace-nowrap text-right text-xs text-muted-foreground",
149
- children: R
153
+ children: V
150
154
  })
151
155
  })
152
156
  ]
153
157
  })
154
158
  ]
155
159
  });
156
- }
157
- export { w as IssueRow };
160
+ });
161
+ export { T as IssueRow };
@@ -3,29 +3,39 @@ import { useState as t } from "react";
3
3
  import { useTranslations as n } from "use-intl";
4
4
  import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
5
  // src/components/IssueSection.tsx
6
- function a({ label: a, icon: o, count: s, defaultOpen: c = !0, children: l }) {
7
- let u = n("issues"), [d, f] = t(c);
6
+ function a({ label: e, icon: n, count: a, defaultOpen: s = !0, children: c }) {
7
+ let [l, u] = t(s);
8
8
  return /* @__PURE__ */ i("section", {
9
- "aria-label": a,
9
+ "aria-label": e,
10
10
  children: [/* @__PURE__ */ r("h2", {
11
11
  className: "sticky top-0 z-10 border-b border-border bg-background/95 text-xs font-medium backdrop-blur",
12
- children: /* @__PURE__ */ i("button", {
13
- type: "button",
14
- "aria-expanded": d,
15
- onClick: () => f((e) => !e),
16
- "aria-label": u(d ? "foldGroup" : "unfoldGroup", { group: a }),
17
- className: "flex h-8 w-full items-center gap-2 px-5 text-left hover:bg-muted/50",
18
- children: [
19
- /* @__PURE__ */ r(e, { className: `size-3 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none ${d ? "rotate-90" : ""}` }),
20
- o,
21
- a,
22
- /* @__PURE__ */ r("span", {
23
- className: "text-muted-foreground tabular-nums",
24
- children: s
25
- })
26
- ]
12
+ children: /* @__PURE__ */ r(o, {
13
+ label: e,
14
+ icon: n,
15
+ count: a,
16
+ open: l,
17
+ onToggle: () => u((e) => !e)
27
18
  })
28
- }), d && /* @__PURE__ */ r("ul", { children: l })]
19
+ }), l && /* @__PURE__ */ r("ul", { children: c })]
29
20
  });
30
21
  }
31
- export { a as IssueSection };
22
+ function o({ label: t, icon: a, count: o, open: s, onToggle: c }) {
23
+ let l = n("issues");
24
+ return /* @__PURE__ */ i("button", {
25
+ type: "button",
26
+ "aria-expanded": s,
27
+ onClick: c,
28
+ "aria-label": l(s ? "foldGroup" : "unfoldGroup", { group: t }),
29
+ className: "flex h-8 w-full items-center gap-2 px-5 text-left hover:bg-muted/50",
30
+ children: [
31
+ /* @__PURE__ */ r(e, { className: `size-3 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none ${s ? "rotate-90" : ""}` }),
32
+ a,
33
+ t,
34
+ /* @__PURE__ */ r("span", {
35
+ className: "text-muted-foreground tabular-nums",
36
+ children: o
37
+ })
38
+ ]
39
+ });
40
+ }
41
+ export { o as IssueGroupHeader, a as IssueSection };