@parallelworks/tandem-web 0.183.0 → 0.185.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.
@@ -1,217 +1,217 @@
1
1
  import { teamsQuery as e, workspaceQuery as t } from "../../../api/queries.js";
2
- import { DocTable as n, groupable as r } from "../../../components/DocTable.js";
3
- import { AddIcon as i, BoardIcon as a, ListViewIcon as o } from "../../../components/icons.js";
4
- import { docPropertiesQuery as s, docViewsQuery as c, readConfig as l, useDocPropertyActions as u } from "../../../lib/docProperties.js";
5
- import { useDocActions as d } from "../../../lib/docs.js";
6
- import { usePageTitle as f } from "../../../lib/pageTitle.js";
7
- import { usePeople as p } from "../../../lib/people.js";
8
- import { Route as m } from "./space._space.js";
9
- import { Breadcrumbs as ee, Button as h, ErrorText as g, Input as _, Popover as v, SegmentedControl as y, Select as b, useClosePopover as x } from "@parallelworks/ui";
10
- import { useNavigate as S } from "@tanstack/react-router";
11
- import { useEffect as C, useState as w } from "react";
12
- import { useErrorMessage as T } from "@parallelworks/problem/react";
13
- import { useTranslations as E } from "use-intl";
14
- import { jsx as D, jsxs as O } from "react/jsx-runtime";
15
- import { useQuery as k, useSuspenseQuery as A } from "@tanstack/react-query";
2
+ import { DocTable as n, groupable as r, listsTop as i, useSpaceDocs as a } from "../../../components/DocTable.js";
3
+ import { AddIcon as o, BoardIcon as s, ListViewIcon as ee } from "../../../components/icons.js";
4
+ import { docPropertiesQuery as c, docViewsQuery as l, readConfig as u, useDocPropertyActions as d } from "../../../lib/docProperties.js";
5
+ import { useDocActions as f } from "../../../lib/docs.js";
6
+ import { usePageTitle as p } from "../../../lib/pageTitle.js";
7
+ import { usePeople as m } from "../../../lib/people.js";
8
+ import { Route as h } from "./space._space.js";
9
+ import { Breadcrumbs as g, Button as _, ErrorText as v, Input as y, Popover as b, SegmentedControl as x, Select as S, useClosePopover as C } from "@parallelworks/ui";
10
+ import { useNavigate as te } from "@tanstack/react-router";
11
+ import { useEffect as w, useState as T } from "react";
12
+ import { useErrorMessage as E } from "@parallelworks/problem/react";
13
+ import { useTranslations as D } from "use-intl";
14
+ import { jsx as O, jsxs as k } from "react/jsx-runtime";
15
+ import { useQuery as A, useSuspenseQuery as j } from "@tanstack/react-query";
16
16
  // src/routes/$workspace/docs/space.$space.tsx?tsr-split=component
17
- function j() {
18
- let p = E("docViews"), v = T(), { workspace: x, space: j } = m.useParams(), { view: P } = m.useSearch(), F = S(), I = (e) => F({
17
+ function M() {
18
+ let m = D("docViews"), b = E(), { workspace: C, space: M } = h.useParams(), { view: N } = h.useSearch(), ie = te(), P = (e) => ie({
19
19
  to: "/$workspace/docs/space/$space",
20
20
  params: {
21
- workspace: x,
22
- space: j
21
+ workspace: C,
22
+ space: M
23
23
  },
24
24
  search: e ? { view: e } : {}
25
- }), { data: L } = A(e(x)), { data: R } = A(t(x)), z = j === "workspace" ? R.name : L.find((e) => e.key === j)?.name ?? j;
26
- f(p("title"), z);
27
- let { data: B = [] } = k(s(x, j)), { data: V = [] } = k(c(x, j)), H = u(x), U = V.find((e) => e.id === P), [W, G] = w("table"), [K, q] = w({}), [J, Y] = w(""), X = E("docs"), Z = d(x);
28
- C(() => {
29
- U && (G(U.layout === "board" ? "board" : "table"), q(l(U.config)));
30
- }, [U]);
31
- let Q = (e) => q(e), te = [
25
+ }), { data: F } = j(e(C)), { data: I } = j(t(C)), L = M === "workspace" ? I.name : F.find((e) => e.key === M)?.name ?? M;
26
+ p(m("title"), L);
27
+ let { data: R = [] } = A(c(C, M)), { data: z = [] } = A(l(C, M)), B = d(C), V = z.find((e) => e.id === N), [H, U] = T("table"), [W, G] = T({}), [K, q] = T(""), J = D("docs"), Y = f(C);
28
+ w(() => {
29
+ V && (U(V.layout === "board" ? "board" : "table"), G(u(V.config)));
30
+ }, [V]);
31
+ let X = (e) => G(e), { used: Z } = a(C, M, W, i(H, K, W)), Q = R.filter((e) => Z.includes(e) || e.id === W.sort || W.columns?.includes(e.id)), ae = [
32
32
  {
33
33
  value: "title",
34
- label: p("docTitle")
34
+ label: m("docTitle")
35
35
  },
36
36
  {
37
37
  value: "updated",
38
- label: p("updated")
38
+ label: m("updated")
39
39
  },
40
- ...B.map((e) => ({
40
+ ...Q.map((e) => ({
41
41
  value: e.id,
42
42
  label: e.name
43
43
  }))
44
- ], $ = H.saveView.error ?? H.updateView.error;
45
- return /* @__PURE__ */ O("div", {
44
+ ], $ = B.saveView.error ?? B.updateView.error;
45
+ return /* @__PURE__ */ k("div", {
46
46
  className: "flex h-full flex-col",
47
47
  children: [
48
- /* @__PURE__ */ O("header", {
48
+ /* @__PURE__ */ k("header", {
49
49
  className: "flex min-h-12 shrink-0 flex-wrap items-center gap-2 border-b border-border px-4 py-2 md:px-5",
50
50
  children: [
51
- /* @__PURE__ */ D(ee, {
51
+ /* @__PURE__ */ O(g, {
52
52
  crumbs: [{
53
- label: p("docs"),
54
- href: `/${x}/docs`
55
- }, { label: z }],
53
+ label: m("docs"),
54
+ href: `/${C}/docs`
55
+ }, { label: L }],
56
56
  className: "min-w-0 flex-1"
57
57
  }),
58
- /* @__PURE__ */ D(b, {
59
- value: P ?? "",
58
+ /* @__PURE__ */ O(S, {
59
+ value: N ?? "",
60
60
  items: [{
61
61
  value: "",
62
- label: p("unsaved")
63
- }, ...V.map((e) => ({
62
+ label: m("unsaved")
63
+ }, ...z.map((e) => ({
64
64
  value: e.id,
65
65
  label: e.name
66
66
  }))],
67
- onValueChange: (e) => I(e || void 0),
68
- "aria-label": p("savedViews"),
67
+ onValueChange: (e) => P(e || void 0),
68
+ "aria-label": m("savedViews"),
69
69
  size: "sm",
70
70
  width: "content"
71
71
  }),
72
- U ? /* @__PURE__ */ D(h, {
72
+ V ? /* @__PURE__ */ O(_, {
73
73
  size: "sm",
74
- loading: H.updateView.isPending,
75
- onClick: () => H.updateView.mutate({
76
- id: U.id,
77
- layout: W,
78
- config: { ...K }
74
+ loading: B.updateView.isPending,
75
+ onClick: () => B.updateView.mutate({
76
+ id: V.id,
77
+ layout: H,
78
+ config: { ...W }
79
79
  }),
80
- children: p("update")
81
- }) : /* @__PURE__ */ D(N, {
80
+ children: m("update")
81
+ }) : /* @__PURE__ */ O(re, {
82
82
  onSave: async (e) => {
83
- let t = await H.saveView.mutateAsync({
84
- space: j,
83
+ let t = await B.saveView.mutateAsync({
84
+ space: M,
85
85
  name: e,
86
- layout: W,
87
- config: { ...K }
86
+ layout: H,
87
+ config: { ...W }
88
88
  });
89
- I(t.id);
89
+ P(t.id);
90
90
  },
91
- pending: H.saveView.isPending
91
+ pending: B.saveView.isPending
92
92
  }),
93
- /* @__PURE__ */ D(h, {
93
+ /* @__PURE__ */ O(_, {
94
94
  variant: "primary",
95
95
  size: "sm",
96
- icon: /* @__PURE__ */ D(i, {}),
97
- loading: Z.create.isPending,
98
- onClick: () => Z.create.mutate(j === "workspace" ? {} : { team: j }),
99
- children: X("new")
96
+ icon: /* @__PURE__ */ O(o, {}),
97
+ loading: Y.create.isPending,
98
+ onClick: () => Y.create.mutate(M === "workspace" ? {} : { team: M }),
99
+ children: J("new")
100
100
  }),
101
- /* @__PURE__ */ D(y, {
102
- label: p("layout"),
101
+ /* @__PURE__ */ O(x, {
102
+ label: m("layout"),
103
103
  size: "sm",
104
- value: W,
105
- onValueChange: G,
104
+ value: H,
105
+ onValueChange: U,
106
106
  options: [{
107
107
  value: "table",
108
- label: p("table"),
109
- icon: /* @__PURE__ */ D(o, {})
108
+ label: m("table"),
109
+ icon: /* @__PURE__ */ O(ee, {})
110
110
  }, {
111
111
  value: "board",
112
- label: p("board"),
113
- icon: /* @__PURE__ */ D(a, {})
112
+ label: m("board"),
113
+ icon: /* @__PURE__ */ O(s, {})
114
114
  }]
115
115
  })
116
116
  ]
117
117
  }),
118
- /* @__PURE__ */ O("div", {
118
+ /* @__PURE__ */ k("div", {
119
119
  className: "flex flex-wrap items-center gap-2 border-b border-border px-4 py-2 text-xs md:px-5",
120
120
  children: [
121
- /* @__PURE__ */ D(_, {
121
+ /* @__PURE__ */ O(y, {
122
122
  type: "search",
123
123
  size: "sm",
124
- value: J,
125
- onChange: (e) => Y(e.target.value),
126
- placeholder: X("search"),
127
- "aria-label": X("search"),
124
+ value: K,
125
+ onChange: (e) => q(e.target.value),
126
+ placeholder: J("search"),
127
+ "aria-label": J("search"),
128
128
  className: "w-48"
129
129
  }),
130
- W === "board" ? /* @__PURE__ */ D(b, {
131
- value: K.groupBy ?? "",
130
+ H === "board" ? /* @__PURE__ */ O(S, {
131
+ value: W.groupBy ?? "",
132
132
  items: [{
133
133
  value: "",
134
- label: p("groupBy")
135
- }, ...B.filter(r).map((e) => ({
134
+ label: m("groupBy")
135
+ }, ...R.filter(r).map((e) => ({
136
136
  value: e.id,
137
137
  label: e.name
138
138
  }))],
139
- onValueChange: (e) => Q({
140
- ...K,
139
+ onValueChange: (e) => X({
140
+ ...W,
141
141
  ...e ? { groupBy: e } : { groupBy: void 0 }
142
142
  }),
143
- "aria-label": p("groupBy"),
143
+ "aria-label": m("groupBy"),
144
144
  size: "sm",
145
145
  width: "content"
146
- }) : B.length > 0 && /* @__PURE__ */ D(b, {
146
+ }) : Q.length > 0 && /* @__PURE__ */ O(S, {
147
147
  multiple: !0,
148
- value: K.columns ?? B.map((e) => e.id),
149
- items: B.map((e) => ({
148
+ value: W.columns ?? Z.map((e) => e.id),
149
+ items: Q.map((e) => ({
150
150
  value: e.id,
151
151
  label: e.name
152
152
  })),
153
- onValueChange: (e) => Q({
154
- ...K,
153
+ onValueChange: (e) => X({
154
+ ...W,
155
155
  columns: e
156
156
  }),
157
- "aria-label": p("columns"),
158
- placeholder: p("columns"),
157
+ "aria-label": m("columns"),
158
+ placeholder: m("columns"),
159
159
  size: "sm",
160
160
  width: "content"
161
161
  }),
162
- /* @__PURE__ */ D(b, {
163
- value: K.sort ?? "title",
164
- items: te,
165
- onValueChange: (e) => Q({
166
- ...K,
162
+ /* @__PURE__ */ O(S, {
163
+ value: W.sort ?? "title",
164
+ items: ae,
165
+ onValueChange: (e) => X({
166
+ ...W,
167
167
  sort: e
168
168
  }),
169
- "aria-label": p("sortBy"),
169
+ "aria-label": m("sortBy"),
170
170
  size: "sm",
171
171
  width: "content"
172
172
  }),
173
- /* @__PURE__ */ D(h, {
173
+ /* @__PURE__ */ O(_, {
174
174
  size: "xs",
175
175
  variant: "ghost",
176
- onClick: () => Q({
177
- ...K,
178
- desc: !K.desc
176
+ onClick: () => X({
177
+ ...W,
178
+ desc: !W.desc
179
179
  }),
180
- children: K.desc ? p("descending") : p("ascending")
180
+ children: W.desc ? m("descending") : m("ascending")
181
181
  }),
182
- B.map((e) => /* @__PURE__ */ D(M, {
183
- workspace: x,
182
+ R.map((e) => /* @__PURE__ */ O(ne, {
183
+ workspace: C,
184
184
  property: e,
185
- value: K.filters?.[e.id] ?? "",
185
+ value: W.filters?.[e.id] ?? "",
186
186
  onChange: (t) => {
187
- let n = { ...K.filters };
188
- t ? n[e.id] = t : delete n[e.id], Q({
189
- ...K,
187
+ let n = { ...W.filters };
188
+ t ? n[e.id] = t : delete n[e.id], X({
189
+ ...W,
190
190
  filters: n
191
191
  });
192
192
  }
193
193
  }, e.id)),
194
- $ && /* @__PURE__ */ D(g, {
194
+ $ && /* @__PURE__ */ O(v, {
195
195
  inline: !0,
196
- children: v($)
196
+ children: b($)
197
197
  })
198
198
  ]
199
199
  }),
200
- /* @__PURE__ */ D("div", {
200
+ /* @__PURE__ */ O("div", {
201
201
  className: "min-h-0 flex-1 overflow-y-auto",
202
- children: /* @__PURE__ */ D(n, {
203
- workspace: x,
204
- space: j,
205
- layout: W,
206
- config: K,
207
- query: J
202
+ children: /* @__PURE__ */ O(n, {
203
+ workspace: C,
204
+ space: M,
205
+ layout: H,
206
+ config: W,
207
+ query: K
208
208
  })
209
209
  })
210
210
  ]
211
211
  });
212
212
  }
213
- function M({ workspace: e, property: t, value: n, onChange: r }) {
214
- let i = E("docViews"), { members: a } = p(e), o = t.kind === "select" || t.kind === "multi_select" ? t.options.map((e) => ({
213
+ function ne({ workspace: e, property: t, value: n, onChange: r }) {
214
+ let i = D("docViews"), { members: a } = m(e), o = t.kind === "select" || t.kind === "multi_select" ? t.options.map((e) => ({
215
215
  value: e.id ?? "",
216
216
  label: e.name
217
217
  })) : t.kind === "person" ? a.map((e) => ({
@@ -221,7 +221,7 @@ function M({ workspace: e, property: t, value: n, onChange: r }) {
221
221
  value: "true",
222
222
  label: i("checked")
223
223
  }] : null;
224
- return o ? /* @__PURE__ */ D(b, {
224
+ return o ? /* @__PURE__ */ O(S, {
225
225
  value: n,
226
226
  items: [{
227
227
  value: "",
@@ -233,10 +233,10 @@ function M({ workspace: e, property: t, value: n, onChange: r }) {
233
233
  width: "content"
234
234
  }) : null;
235
235
  }
236
- function N({ onSave: e, pending: t }) {
237
- let n = E("docViews");
238
- return /* @__PURE__ */ D(v, {
239
- trigger: /* @__PURE__ */ D(h, {
236
+ function re({ onSave: e, pending: t }) {
237
+ let n = D("docViews");
238
+ return /* @__PURE__ */ O(b, {
239
+ trigger: /* @__PURE__ */ O(_, {
240
240
  size: "sm",
241
241
  children: n("save")
242
242
  }),
@@ -244,25 +244,25 @@ function N({ onSave: e, pending: t }) {
244
244
  className: "w-64",
245
245
  initialFocus: "first-control",
246
246
  "aria-label": n("save"),
247
- children: /* @__PURE__ */ D(P, {
247
+ children: /* @__PURE__ */ O(N, {
248
248
  onSave: e,
249
249
  pending: t
250
250
  })
251
251
  });
252
252
  }
253
- function P({ onSave: e, pending: t }) {
254
- let n = E("docViews"), r = x(), [i, a] = w("");
255
- return /* @__PURE__ */ O("form", {
253
+ function N({ onSave: e, pending: t }) {
254
+ let n = D("docViews"), r = C(), [i, a] = T("");
255
+ return /* @__PURE__ */ k("form", {
256
256
  className: "space-y-2",
257
257
  onSubmit: (t) => {
258
258
  t.preventDefault(), i.trim() && (e(i.trim()), r());
259
259
  },
260
- children: [/* @__PURE__ */ D(_, {
260
+ children: [/* @__PURE__ */ O(y, {
261
261
  value: i,
262
262
  onChange: (e) => a(e.target.value),
263
263
  placeholder: n("viewName"),
264
264
  "aria-label": n("viewName")
265
- }), /* @__PURE__ */ D(h, {
265
+ }), /* @__PURE__ */ O(_, {
266
266
  type: "submit",
267
267
  size: "sm",
268
268
  variant: "primary",
@@ -272,4 +272,4 @@ function P({ onSave: e, pending: t }) {
272
272
  })]
273
273
  });
274
274
  }
275
- export { j as component };
275
+ export { M as component };