@parallelworks/tandem-web 0.141.1 → 0.142.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.
@@ -1279,6 +1279,59 @@ var e = {
1279
1279
  title: "Create team",
1280
1280
  description: "A team has its own issues, workflow and members. Its key starts each issue ID, as in ENG-42."
1281
1281
  },
1282
+ docProperties: {
1283
+ issueExample: "An issue, such as ENG-42",
1284
+ title: "Properties",
1285
+ yes: "Yes",
1286
+ edit: "Change property",
1287
+ remove: "Remove property",
1288
+ empty: "Empty",
1289
+ add: "Add property",
1290
+ name: "Name",
1291
+ kind: "Kind",
1292
+ options: "Options, one per line",
1293
+ optionsHint: "Removing an option clears it from the docs that had it.",
1294
+ save: "Save",
1295
+ kinds: {
1296
+ text: "Text",
1297
+ number: "Number",
1298
+ select: "Select",
1299
+ multi_select: "Multi-select",
1300
+ person: "Person",
1301
+ date: "Date",
1302
+ checkbox: "Checkbox",
1303
+ issue: "Issue"
1304
+ }
1305
+ },
1306
+ docViews: {
1307
+ title: "Docs as a table",
1308
+ docs: "Docs",
1309
+ loading: "Loading…",
1310
+ pickGroup: "Pick a select or person property to group the board by.",
1311
+ none: "No docs match.",
1312
+ docTitle: "Title",
1313
+ updated: "Updated",
1314
+ board: "Board",
1315
+ table: "Table",
1316
+ layout: "Layout",
1317
+ noValue: "No {property}",
1318
+ unsaved: "Unsaved view",
1319
+ savedViews: "Saved views",
1320
+ update: "Update view",
1321
+ save: "Save view",
1322
+ viewName: "View name",
1323
+ groupBy: "Group by",
1324
+ columns: "Columns",
1325
+ sortBy: "Sort by",
1326
+ ascending: "Ascending",
1327
+ descending: "Descending",
1328
+ checked: "Checked",
1329
+ anyValue: "Any {property}",
1330
+ filterBy: "Filter by {property}",
1331
+ openTable: "Open as table",
1332
+ embedPick: "Pick a saved view to show",
1333
+ open: "Open"
1334
+ },
1282
1335
  docs: {
1283
1336
  spaceDefault: "Start new docs in this space from it",
1284
1337
  duplicate: "Duplicate",
@@ -2389,6 +2442,11 @@ var e = {
2389
2442
  hint: "Rows and columns",
2390
2443
  keywords: "grid columns rows"
2391
2444
  },
2445
+ docView: {
2446
+ label: "Docs view",
2447
+ hint: "A saved table or board of a space's docs",
2448
+ keywords: "table board view database docs properties"
2449
+ },
2392
2450
  button: {
2393
2451
  label: "Button",
2394
2452
  hint: "A button that inserts blocks or makes a doc from a template",
@@ -1279,6 +1279,59 @@ var e = {
1279
1279
  title: "Crear equipo",
1280
1280
  description: "Un equipo tiene sus propias incidencias, flujo de trabajo y miembros. Su clave inicia el ID de cada incidencia, como en ENG-42."
1281
1281
  },
1282
+ docProperties: {
1283
+ issueExample: "Una incidencia, como ENG-42",
1284
+ title: "Propiedades",
1285
+ yes: "Sí",
1286
+ edit: "Cambiar propiedad",
1287
+ remove: "Quitar propiedad",
1288
+ empty: "Vacío",
1289
+ add: "Añadir propiedad",
1290
+ name: "Nombre",
1291
+ kind: "Tipo",
1292
+ options: "Opciones, una por línea",
1293
+ optionsHint: "Quitar una opción la borra de los documentos que la tenían.",
1294
+ save: "Guardar",
1295
+ kinds: {
1296
+ text: "Texto",
1297
+ number: "Número",
1298
+ select: "Selección",
1299
+ multi_select: "Selección múltiple",
1300
+ person: "Persona",
1301
+ date: "Fecha",
1302
+ checkbox: "Casilla",
1303
+ issue: "Incidencia"
1304
+ }
1305
+ },
1306
+ docViews: {
1307
+ title: "Documentos como tabla",
1308
+ docs: "Documentos",
1309
+ loading: "Cargando…",
1310
+ pickGroup: "Elige una propiedad de selección o de persona para agrupar el tablero.",
1311
+ none: "Ningún documento coincide.",
1312
+ docTitle: "Título",
1313
+ updated: "Actualizado",
1314
+ board: "Tablero",
1315
+ table: "Tabla",
1316
+ layout: "Diseño",
1317
+ noValue: "Sin {property}",
1318
+ unsaved: "Vista sin guardar",
1319
+ savedViews: "Vistas guardadas",
1320
+ update: "Actualizar vista",
1321
+ save: "Guardar vista",
1322
+ viewName: "Nombre de la vista",
1323
+ groupBy: "Agrupar por",
1324
+ columns: "Columnas",
1325
+ sortBy: "Ordenar por",
1326
+ ascending: "Ascendente",
1327
+ descending: "Descendente",
1328
+ checked: "Marcado",
1329
+ anyValue: "Cualquier {property}",
1330
+ filterBy: "Filtrar por {property}",
1331
+ openTable: "Abrir como tabla",
1332
+ embedPick: "Elige una vista guardada para mostrar",
1333
+ open: "Abrir"
1334
+ },
1282
1335
  docs: {
1283
1336
  spaceDefault: "Empezar los documentos nuevos de este espacio con ella",
1284
1337
  duplicate: "Duplicar",
@@ -2389,6 +2442,11 @@ var e = {
2389
2442
  hint: "Filas y columnas",
2390
2443
  keywords: "cuadrícula columnas filas grid columns rows"
2391
2444
  },
2445
+ docView: {
2446
+ label: "Vista de documentos",
2447
+ hint: "Una tabla o tablero guardado de los documentos de un espacio",
2448
+ keywords: "tabla tablero vista base de datos documentos"
2449
+ },
2392
2450
  button: {
2393
2451
  label: "Botón",
2394
2452
  hint: "Un botón que inserta bloques o crea un documento desde una plantilla",
@@ -1279,6 +1279,59 @@ var e = {
1279
1279
  title: "チームを作成",
1280
1280
  description: "チームには独自の課題、ワークフロー、メンバーがあります。チームのキーは ENG-42 のように各課題 ID の先頭に付きます。"
1281
1281
  },
1282
+ docProperties: {
1283
+ issueExample: "課題(例: ENG-42)",
1284
+ title: "プロパティ",
1285
+ yes: "はい",
1286
+ edit: "プロパティを変更",
1287
+ remove: "プロパティを削除",
1288
+ empty: "空",
1289
+ add: "プロパティを追加",
1290
+ name: "名前",
1291
+ kind: "種類",
1292
+ options: "選択肢(1 行に 1 つ)",
1293
+ optionsHint: "選択肢を削除すると、それを持つドキュメントから消えます。",
1294
+ save: "保存",
1295
+ kinds: {
1296
+ text: "テキスト",
1297
+ number: "数値",
1298
+ select: "選択",
1299
+ multi_select: "複数選択",
1300
+ person: "人",
1301
+ date: "日付",
1302
+ checkbox: "チェックボックス",
1303
+ issue: "課題"
1304
+ }
1305
+ },
1306
+ docViews: {
1307
+ title: "ドキュメントの表",
1308
+ docs: "ドキュメント",
1309
+ loading: "読み込み中…",
1310
+ pickGroup: "ボードをグループ化する選択または人のプロパティを選んでください。",
1311
+ none: "一致するドキュメントはありません。",
1312
+ docTitle: "タイトル",
1313
+ updated: "更新",
1314
+ board: "ボード",
1315
+ table: "表",
1316
+ layout: "レイアウト",
1317
+ noValue: "{property} なし",
1318
+ unsaved: "未保存のビュー",
1319
+ savedViews: "保存したビュー",
1320
+ update: "ビューを更新",
1321
+ save: "ビューを保存",
1322
+ viewName: "ビュー名",
1323
+ groupBy: "グループ化",
1324
+ columns: "列",
1325
+ sortBy: "並べ替え",
1326
+ ascending: "昇順",
1327
+ descending: "降順",
1328
+ checked: "チェック済み",
1329
+ anyValue: "すべての {property}",
1330
+ filterBy: "{property} で絞り込み",
1331
+ openTable: "表で開く",
1332
+ embedPick: "表示する保存済みビューを選択",
1333
+ open: "開く"
1334
+ },
1282
1335
  docs: {
1283
1336
  spaceDefault: "このスペースの新しいドキュメントに使う",
1284
1337
  duplicate: "複製",
@@ -2389,6 +2442,11 @@ var e = {
2389
2442
  hint: "行と列",
2390
2443
  keywords: "grid columns rows 表 テーブル 行 列"
2391
2444
  },
2445
+ docView: {
2446
+ label: "ドキュメントビュー",
2447
+ hint: "スペースのドキュメントの保存した表やボード",
2448
+ keywords: "表 ボード ビュー データベース ドキュメント"
2449
+ },
2392
2450
  button: {
2393
2451
  label: "ボタン",
2394
2452
  hint: "ブロックを挿入したりテンプレートからドキュメントを作るボタン",
@@ -1279,6 +1279,59 @@ var e = {
1279
1279
  title: "팀 생성",
1280
1280
  description: "팀마다 고유한 이슈, 워크플로, 멤버가 있습니다. 팀 키는 ENG-42처럼 각 이슈 ID의 앞부분이 됩니다."
1281
1281
  },
1282
+ docProperties: {
1283
+ issueExample: "이슈(예: ENG-42)",
1284
+ title: "속성",
1285
+ yes: "예",
1286
+ edit: "속성 변경",
1287
+ remove: "속성 삭제",
1288
+ empty: "비어 있음",
1289
+ add: "속성 추가",
1290
+ name: "이름",
1291
+ kind: "종류",
1292
+ options: "옵션(한 줄에 하나)",
1293
+ optionsHint: "옵션을 지우면 그 옵션을 가진 문서에서도 지워집니다.",
1294
+ save: "저장",
1295
+ kinds: {
1296
+ text: "텍스트",
1297
+ number: "숫자",
1298
+ select: "선택",
1299
+ multi_select: "다중 선택",
1300
+ person: "사람",
1301
+ date: "날짜",
1302
+ checkbox: "체크박스",
1303
+ issue: "이슈"
1304
+ }
1305
+ },
1306
+ docViews: {
1307
+ title: "문서 표",
1308
+ docs: "문서",
1309
+ loading: "불러오는 중…",
1310
+ pickGroup: "보드를 묶을 선택 또는 사람 속성을 고르세요.",
1311
+ none: "일치하는 문서가 없습니다.",
1312
+ docTitle: "제목",
1313
+ updated: "수정됨",
1314
+ board: "보드",
1315
+ table: "표",
1316
+ layout: "레이아웃",
1317
+ noValue: "{property} 없음",
1318
+ unsaved: "저장하지 않은 보기",
1319
+ savedViews: "저장된 보기",
1320
+ update: "보기 업데이트",
1321
+ save: "보기 저장",
1322
+ viewName: "보기 이름",
1323
+ groupBy: "묶기",
1324
+ columns: "열",
1325
+ sortBy: "정렬",
1326
+ ascending: "오름차순",
1327
+ descending: "내림차순",
1328
+ checked: "체크됨",
1329
+ anyValue: "모든 {property}",
1330
+ filterBy: "{property}(으)로 필터",
1331
+ openTable: "표로 열기",
1332
+ embedPick: "보여 줄 저장된 보기를 고르세요",
1333
+ open: "열기"
1334
+ },
1282
1335
  docs: {
1283
1336
  spaceDefault: "이 스페이스의 새 문서에 사용",
1284
1337
  duplicate: "복제",
@@ -2389,6 +2442,11 @@ var e = {
2389
2442
  hint: "행과 열",
2390
2443
  keywords: "표 테이블 그리드 열 행 grid columns rows"
2391
2444
  },
2445
+ docView: {
2446
+ label: "문서 보기",
2447
+ hint: "스페이스 문서의 저장된 표나 보드",
2448
+ keywords: "표 보드 보기 데이터베이스 문서"
2449
+ },
2392
2450
  button: {
2393
2451
  label: "버튼",
2394
2452
  hint: "블록을 넣거나 템플릿으로 문서를 만드는 버튼",
@@ -1279,6 +1279,59 @@ var e = {
1279
1279
  title: "创建团队",
1280
1280
  description: "团队拥有自己的议题、工作流和成员。团队标识会作为每个议题 ID 的开头,例如 ENG-42。"
1281
1281
  },
1282
+ docProperties: {
1283
+ issueExample: "问题,例如 ENG-42",
1284
+ title: "属性",
1285
+ yes: "是",
1286
+ edit: "更改属性",
1287
+ remove: "移除属性",
1288
+ empty: "空",
1289
+ add: "添加属性",
1290
+ name: "名称",
1291
+ kind: "类型",
1292
+ options: "选项(每行一个)",
1293
+ optionsHint: "移除选项会从拥有它的文档中清除。",
1294
+ save: "保存",
1295
+ kinds: {
1296
+ text: "文本",
1297
+ number: "数字",
1298
+ select: "单选",
1299
+ multi_select: "多选",
1300
+ person: "人员",
1301
+ date: "日期",
1302
+ checkbox: "复选框",
1303
+ issue: "问题"
1304
+ }
1305
+ },
1306
+ docViews: {
1307
+ title: "文档表格",
1308
+ docs: "文档",
1309
+ loading: "加载中…",
1310
+ pickGroup: "请选择用于分组看板的单选或人员属性。",
1311
+ none: "没有匹配的文档。",
1312
+ docTitle: "标题",
1313
+ updated: "更新于",
1314
+ board: "看板",
1315
+ table: "表格",
1316
+ layout: "布局",
1317
+ noValue: "无{property}",
1318
+ unsaved: "未保存的视图",
1319
+ savedViews: "已保存视图",
1320
+ update: "更新视图",
1321
+ save: "保存视图",
1322
+ viewName: "视图名称",
1323
+ groupBy: "分组",
1324
+ columns: "列",
1325
+ sortBy: "排序",
1326
+ ascending: "升序",
1327
+ descending: "降序",
1328
+ checked: "已勾选",
1329
+ anyValue: "任意{property}",
1330
+ filterBy: "按{property}筛选",
1331
+ openTable: "以表格打开",
1332
+ embedPick: "选择要显示的已保存视图",
1333
+ open: "打开"
1334
+ },
1282
1335
  docs: {
1283
1336
  spaceDefault: "此空间的新文档从它开始",
1284
1337
  duplicate: "复制一份",
@@ -2389,6 +2442,11 @@ var e = {
2389
2442
  hint: "行和列",
2390
2443
  keywords: "表格 网格 列 行 grid columns rows"
2391
2444
  },
2445
+ docView: {
2446
+ label: "文档视图",
2447
+ hint: "空间文档的已保存表格或看板",
2448
+ keywords: "表格 看板 视图 数据库 文档"
2449
+ },
2392
2450
  button: {
2393
2451
  label: "按钮",
2394
2452
  hint: "插入块或从模板创建文档的按钮",
@@ -0,0 +1,314 @@
1
+ import { AddIcon as e } from "./icons.js";
2
+ import { usePeople as t } from "../lib/people.js";
3
+ import { useCan as n } from "../lib/roles.js";
4
+ import { docPropertiesQuery as r, propertyKinds as i, spaceScope as a, useDocPropertyActions as o } from "../lib/docProperties.js";
5
+ import { Button as s, Checkbox as c, ErrorText as l, IconButton as u, Input as d, Popover as f, Select as p, Textarea as m, menuDivider as h, useOpenMenu as g } from "@parallelworks/ui";
6
+ import { Link as _ } from "@tanstack/react-router";
7
+ import { useEffect as v, useState as y } from "react";
8
+ import { useErrorMessage as b } from "@parallelworks/problem/react";
9
+ import { useTranslations as x } from "use-intl";
10
+ import { jsx as S, jsxs as C } from "react/jsx-runtime";
11
+ import { useQuery as w } from "@tanstack/react-query";
12
+ // src/components/DocProperties.tsx
13
+ function T(e) {
14
+ let { nameOf: n } = t(e), r = x("docProperties");
15
+ return (e, t) => {
16
+ if (t == null) return "";
17
+ let i = (t) => e.options.find((e) => e.id === t)?.name ?? String(t);
18
+ switch (e.kind) {
19
+ case "select": return i(t);
20
+ case "multi_select": return Array.isArray(t) ? t.map(i).join(", ") : "";
21
+ case "person": return n("user", String(t));
22
+ case "checkbox": return t === !0 ? r("yes") : "";
23
+ default: return String(t);
24
+ }
25
+ };
26
+ }
27
+ function E({ workspace: e, doc: t, space: i, editable: s }) {
28
+ let c = x("docProperties"), u = b(), { data: d = [] } = w(r(e, i)), f = n(e, "manage_labels", a(i)), p = o(e), m = t.properties ?? {};
29
+ if (d.length === 0 && !(s && f)) return null;
30
+ let h = (e, n) => p.setValues.mutate({
31
+ doc: t.key,
32
+ values: { [e]: n }
33
+ });
34
+ return /* @__PURE__ */ C("section", {
35
+ "aria-label": c("title"),
36
+ className: "mt-3 space-y-0.5 text-sm",
37
+ children: [
38
+ d.map((t) => /* @__PURE__ */ C("div", {
39
+ className: "flex min-h-8 items-center gap-2",
40
+ children: [/* @__PURE__ */ S(D, {
41
+ workspace: e,
42
+ property: t,
43
+ admin: s && f
44
+ }), /* @__PURE__ */ S("div", {
45
+ className: "min-w-0 flex-1",
46
+ children: /* @__PURE__ */ S(O, {
47
+ workspace: e,
48
+ property: t,
49
+ value: m[t.id],
50
+ editable: s,
51
+ onChange: (e) => h(t.id, e)
52
+ })
53
+ })]
54
+ }, t.id)),
55
+ s && f && /* @__PURE__ */ S(A, {
56
+ workspace: e,
57
+ space: i
58
+ }),
59
+ p.setValues.error && /* @__PURE__ */ S(l, { children: u(p.setValues.error) })
60
+ ]
61
+ });
62
+ }
63
+ function D({ workspace: e, property: t, admin: n }) {
64
+ let r = x("docProperties"), i = g(), a = o(e), [s, c] = y(!1), l = /* @__PURE__ */ S("span", {
65
+ className: "truncate",
66
+ children: t.name
67
+ });
68
+ if (!n) return /* @__PURE__ */ S("span", {
69
+ className: "flex w-36 shrink-0 text-muted-foreground",
70
+ children: l
71
+ });
72
+ let u = () => [
73
+ {
74
+ label: r("edit"),
75
+ onClick: () => c(!0)
76
+ },
77
+ h,
78
+ {
79
+ label: r("remove"),
80
+ destructive: !0,
81
+ onClick: () => a.remove.mutate(t.id)
82
+ }
83
+ ];
84
+ return /* @__PURE__ */ S(f, {
85
+ open: s,
86
+ onOpenChange: c,
87
+ trigger: /* @__PURE__ */ S("button", {
88
+ type: "button",
89
+ onContextMenu: (e) => i(e, u()),
90
+ className: "flex h-7 w-36 shrink-0 items-center rounded-md px-1.5 text-left text-muted-foreground hover:bg-muted",
91
+ children: l
92
+ }),
93
+ align: "start",
94
+ className: "w-72",
95
+ initialFocus: "first-control",
96
+ "aria-label": r("edit"),
97
+ children: /* @__PURE__ */ S(j, {
98
+ workspace: e,
99
+ property: t,
100
+ onDone: () => c(!1),
101
+ onRemove: () => {
102
+ a.remove.mutate(t.id), c(!1);
103
+ }
104
+ })
105
+ });
106
+ }
107
+ function O({ workspace: e, property: n, value: r, editable: i, onChange: a }) {
108
+ let o = x("docProperties"), { members: s } = t(e), l = T(e), u = o("empty");
109
+ if (!i) {
110
+ let t = l(n, r);
111
+ return n.kind === "issue" && t ? /* @__PURE__ */ S(_, {
112
+ to: "/$workspace/issues/$identifier",
113
+ params: {
114
+ workspace: e,
115
+ identifier: t
116
+ },
117
+ className: "text-primary hover:underline",
118
+ children: t
119
+ }) : /* @__PURE__ */ S("span", {
120
+ className: t ? "" : "text-muted-foreground",
121
+ children: t || u
122
+ });
123
+ }
124
+ switch (n.kind) {
125
+ case "select": return /* @__PURE__ */ S(p, {
126
+ value: typeof r == "string" ? r : "",
127
+ items: [{
128
+ value: "",
129
+ label: u
130
+ }, ...n.options.map((e) => ({
131
+ value: e.id ?? "",
132
+ label: e.name
133
+ }))],
134
+ onValueChange: (e) => a(e || null),
135
+ "aria-label": n.name,
136
+ size: "sm",
137
+ width: "content"
138
+ });
139
+ case "multi_select": return /* @__PURE__ */ S(p, {
140
+ multiple: !0,
141
+ value: Array.isArray(r) ? r : [],
142
+ items: n.options.map((e) => ({
143
+ value: e.id ?? "",
144
+ label: e.name
145
+ })),
146
+ onValueChange: (e) => a(e),
147
+ placeholder: u,
148
+ "aria-label": n.name,
149
+ size: "sm",
150
+ width: "content"
151
+ });
152
+ case "person": return /* @__PURE__ */ S(p, {
153
+ value: typeof r == "string" ? r : "",
154
+ items: [{
155
+ value: "",
156
+ label: u
157
+ }, ...s.map((e) => ({
158
+ value: e.user.username,
159
+ label: e.user.name
160
+ }))],
161
+ onValueChange: (e) => a(e || null),
162
+ "aria-label": n.name,
163
+ size: "sm",
164
+ width: "content"
165
+ });
166
+ case "checkbox": return /* @__PURE__ */ S(c, {
167
+ checked: r === !0,
168
+ onCheckedChange: (e) => a(e === !0),
169
+ "aria-label": n.name
170
+ });
171
+ case "date": return /* @__PURE__ */ S(d, {
172
+ type: "date",
173
+ value: typeof r == "string" ? r : "",
174
+ onChange: (e) => a(e.target.value || null),
175
+ "aria-label": n.name,
176
+ className: "h-7 px-1.5 w-40"
177
+ });
178
+ default: return /* @__PURE__ */ S(k, {
179
+ property: n,
180
+ value: r,
181
+ onChange: a
182
+ });
183
+ }
184
+ }
185
+ function k({ property: e, value: t, onChange: n }) {
186
+ let r = x("docProperties"), i = t == null ? "" : String(t), [a, o] = y(i);
187
+ v(() => o(i), [i]);
188
+ let s = () => {
189
+ a !== i && (a.trim() ? n(e.kind === "number" ? Number(a) : a) : n(null));
190
+ };
191
+ return /* @__PURE__ */ S(d, {
192
+ type: e.kind === "number" ? "number" : "text",
193
+ value: a,
194
+ onChange: (e) => o(e.target.value),
195
+ onBlur: s,
196
+ onKeyDown: (e) => e.key === "Enter" && s(),
197
+ placeholder: r(e.kind === "issue" ? "issueExample" : "empty"),
198
+ "aria-label": e.name,
199
+ className: "h-7 border-transparent px-1.5 shadow-none hover:border-border"
200
+ });
201
+ }
202
+ function A({ workspace: t, space: n }) {
203
+ let r = x("docProperties"), [i, a] = y(!1);
204
+ return /* @__PURE__ */ S(f, {
205
+ open: i,
206
+ onOpenChange: a,
207
+ trigger: /* @__PURE__ */ S(s, {
208
+ size: "xs",
209
+ variant: "ghost",
210
+ icon: /* @__PURE__ */ S(e, {}),
211
+ className: "mt-1 text-muted-foreground",
212
+ children: r("add")
213
+ }),
214
+ align: "start",
215
+ className: "w-72",
216
+ initialFocus: "first-control",
217
+ "aria-label": r("add"),
218
+ children: /* @__PURE__ */ S(j, {
219
+ workspace: t,
220
+ space: n,
221
+ onDone: () => a(!1)
222
+ })
223
+ });
224
+ }
225
+ function j({ workspace: e, space: t, property: n, onDone: r, onRemove: a }) {
226
+ let c = x("docProperties"), f = b(), h = o(e), [g, _] = y(n?.name ?? ""), [v, w] = y(n?.kind ?? "text"), [T, E] = y((n?.options ?? []).map((e) => e.name).join("\n")), D = v === "select" || v === "multi_select", O = () => T.split("\n").map((e) => e.trim()).filter(Boolean).map((e) => {
227
+ let t = n?.options.find((t) => t.name === e)?.id;
228
+ return {
229
+ name: e,
230
+ ...t && { id: t }
231
+ };
232
+ }), k = n ? h.update : h.create;
233
+ return /* @__PURE__ */ C("form", {
234
+ onSubmit: (e) => {
235
+ e.preventDefault(), n ? h.update.mutate({
236
+ id: n.id,
237
+ name: g,
238
+ ...D && { options: O() }
239
+ }, { onSuccess: r }) : h.create.mutate({
240
+ ...t && { space: t },
241
+ name: g,
242
+ kind: v,
243
+ ...D && { options: O() }
244
+ }, { onSuccess: r });
245
+ },
246
+ className: "space-y-3 text-sm",
247
+ children: [
248
+ /* @__PURE__ */ C("label", {
249
+ className: "block text-xs font-medium text-muted-foreground",
250
+ children: [c("name"), /* @__PURE__ */ S(d, {
251
+ value: g,
252
+ onChange: (e) => _(e.target.value),
253
+ required: !0,
254
+ maxLength: 60,
255
+ className: "mt-1"
256
+ })]
257
+ }),
258
+ !n && /* @__PURE__ */ C("div", {
259
+ className: "text-xs font-medium text-muted-foreground",
260
+ children: [c("kind"), /* @__PURE__ */ S("div", {
261
+ className: "mt-1",
262
+ children: /* @__PURE__ */ S(p, {
263
+ value: v,
264
+ items: i.map((e) => ({
265
+ value: e,
266
+ label: c(`kinds.${e}`)
267
+ })),
268
+ onValueChange: w,
269
+ "aria-label": c("kind"),
270
+ width: "fill"
271
+ })
272
+ })]
273
+ }),
274
+ D && /* @__PURE__ */ C("label", {
275
+ className: "block text-xs font-medium text-muted-foreground",
276
+ children: [
277
+ c("options"),
278
+ /* @__PURE__ */ S(m, {
279
+ value: T,
280
+ onChange: (e) => E(e.target.value),
281
+ rows: 4,
282
+ className: "mt-1"
283
+ }),
284
+ /* @__PURE__ */ S("span", {
285
+ className: "mt-1 block font-normal",
286
+ children: c("optionsHint")
287
+ })
288
+ ]
289
+ }),
290
+ k.error && /* @__PURE__ */ S(l, { children: f(k.error) }),
291
+ /* @__PURE__ */ C("div", {
292
+ className: "flex justify-between gap-2",
293
+ children: [a ? /* @__PURE__ */ S(u, {
294
+ variant: "ghost",
295
+ size: "sm",
296
+ label: c("remove"),
297
+ icon: /* @__PURE__ */ S("span", {
298
+ "aria-hidden": !0,
299
+ children: "×"
300
+ }),
301
+ onClick: a
302
+ }) : /* @__PURE__ */ S("span", {}), /* @__PURE__ */ S(s, {
303
+ type: "submit",
304
+ size: "sm",
305
+ variant: "primary",
306
+ loading: k.isPending,
307
+ disabled: !g.trim(),
308
+ children: c(n ? "save" : "add")
309
+ })]
310
+ })
311
+ ]
312
+ });
313
+ }
314
+ export { E as DocProperties, O as PropertyField, T as usePropertyText };