@superdoc-dev/template-builder 0.3.0 → 0.4.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.
package/dist/index.mjs CHANGED
@@ -1,26 +1,26 @@
1
1
  import { jsxs as o, jsx as r } from "react/jsx-runtime";
2
- import { useState as I, useEffect as se, useMemo as Ce, forwardRef as Re, useRef as U, useCallback as S, useImperativeHandle as Ne } from "react";
3
- const ze = ({
2
+ import { useState as I, useEffect as oe, useMemo as Fe, forwardRef as ze, useRef as J, useCallback as S, useImperativeHandle as Be } from "react";
3
+ const We = ({
4
4
  isVisible: n,
5
- position: l,
6
- availableFields: u,
7
- filteredFields: s,
8
- filterQuery: a,
9
- allowCreate: d,
10
- onSelect: B,
5
+ position: d,
6
+ availableFields: g,
7
+ filteredFields: l,
8
+ filterQuery: u,
9
+ allowCreate: a,
10
+ onSelect: N,
11
11
  onClose: P,
12
12
  onCreateField: G,
13
- existingFields: p = [],
13
+ existingFields: f = [],
14
14
  onSelectExisting: T
15
15
  }) => {
16
- const [x, y] = I(!1), [F, N] = I(""), [q, A] = I("inline"), [J, g] = I(!0), [z, W] = I(!0);
17
- se(() => {
18
- n || (y(!1), N(""), A("inline"));
16
+ const [m, y] = I(!1), [w, R] = I(""), [q, A] = I("inline"), [X, ie] = I(!0), [p, z] = I(!0);
17
+ oe(() => {
18
+ n || (y(!1), R(""), A("inline"));
19
19
  }, [n]);
20
- const Q = Ce(() => ({
20
+ const V = Fe(() => ({
21
21
  position: "absolute",
22
- left: l?.left,
23
- top: l?.top,
22
+ left: d?.left,
23
+ top: d?.top,
24
24
  zIndex: 1e3,
25
25
  background: "white",
26
26
  border: "1px solid #ddd",
@@ -28,30 +28,30 @@ const ze = ({
28
28
  boxShadow: "0 2px 8px rgba(0,0,0,0.1)",
29
29
  padding: "8px 0",
30
30
  width: "280px"
31
- }), [l]), V = s ?? u, M = !!a;
32
- if (se(() => {
33
- M && W(!0);
34
- }, [M]), !n) return null;
35
- const ee = async () => {
36
- const h = F.trim();
37
- if (!h) return;
38
- const j = {
31
+ }), [d]), O = l ?? g, j = !!u;
32
+ if (oe(() => {
33
+ j && z(!0);
34
+ }, [j]), !n) return null;
35
+ const D = async () => {
36
+ const x = w.trim();
37
+ if (!x) return;
38
+ const B = {
39
39
  id: `custom_${Date.now()}`,
40
- label: h,
40
+ label: x,
41
41
  metadata: { mode: q }
42
42
  };
43
43
  try {
44
44
  if (G) {
45
- const b = await G(j);
46
- B(b || j);
45
+ const h = await G(B);
46
+ N(h || B);
47
47
  } else
48
- B(j);
48
+ N(B);
49
49
  } finally {
50
- y(!1), N(""), A("inline");
50
+ y(!1), R(""), A("inline");
51
51
  }
52
52
  };
53
- return /* @__PURE__ */ o("div", { className: "superdoc-field-menu", style: Q, children: [
54
- M && /* @__PURE__ */ r(
53
+ return /* @__PURE__ */ o("div", { className: "superdoc-field-menu", style: V, children: [
54
+ j && /* @__PURE__ */ r(
55
55
  "div",
56
56
  {
57
57
  style: {
@@ -61,17 +61,11 @@ const ze = ({
61
61
  },
62
62
  children: /* @__PURE__ */ o("div", { style: { fontSize: "12px", color: "#6b7280" }, children: [
63
63
  "Filtering results for",
64
- /* @__PURE__ */ r(
65
- "span",
66
- {
67
- style: { fontWeight: 600, color: "#111827", marginLeft: "4px" },
68
- children: a
69
- }
70
- )
64
+ /* @__PURE__ */ r("span", { style: { fontWeight: 600, color: "#111827", marginLeft: "4px" }, children: u })
71
65
  ] })
72
66
  }
73
67
  ),
74
- d && !x && /* @__PURE__ */ r(
68
+ a && !m && /* @__PURE__ */ r(
75
69
  "div",
76
70
  {
77
71
  className: "field-menu-item",
@@ -85,16 +79,16 @@ const ze = ({
85
79
  children: "+ Create New Field"
86
80
  }
87
81
  ),
88
- d && x && /* @__PURE__ */ o("div", { style: { padding: "8px 16px" }, children: [
82
+ a && m && /* @__PURE__ */ o("div", { style: { padding: "8px 16px" }, children: [
89
83
  /* @__PURE__ */ r(
90
84
  "input",
91
85
  {
92
86
  type: "text",
93
- value: F,
87
+ value: w,
94
88
  placeholder: "Field name...",
95
- onChange: (h) => N(h.target.value),
96
- onKeyDown: (h) => {
97
- h.key === "Enter" && ee(), h.key === "Escape" && (y(!1), N(""), A("inline"));
89
+ onChange: (x) => R(x.target.value),
90
+ onKeyDown: (x) => {
91
+ x.key === "Enter" && D(), x.key === "Escape" && (y(!1), R(""), A("inline"));
98
92
  },
99
93
  autoFocus: !0,
100
94
  style: {
@@ -176,15 +170,15 @@ const ze = ({
176
170
  /* @__PURE__ */ r(
177
171
  "button",
178
172
  {
179
- onClick: ee,
180
- disabled: !F.trim(),
173
+ onClick: D,
174
+ disabled: !w.trim(),
181
175
  style: {
182
176
  padding: "4px 12px",
183
- background: F.trim() ? "#0066cc" : "#ccc",
177
+ background: w.trim() ? "#0066cc" : "#ccc",
184
178
  color: "white",
185
179
  border: "none",
186
180
  borderRadius: "3px",
187
- cursor: F.trim() ? "pointer" : "not-allowed"
181
+ cursor: w.trim() ? "pointer" : "not-allowed"
188
182
  },
189
183
  children: "Create"
190
184
  }
@@ -193,7 +187,7 @@ const ze = ({
193
187
  "button",
194
188
  {
195
189
  onClick: () => {
196
- y(!1), N(""), A("inline");
190
+ y(!1), R(""), A("inline");
197
191
  },
198
192
  style: {
199
193
  padding: "4px 12px",
@@ -209,7 +203,7 @@ const ze = ({
209
203
  }
210
204
  )
211
205
  ] }),
212
- d && u.length > 0 && /* @__PURE__ */ r(
206
+ a && g.length > 0 && /* @__PURE__ */ r(
213
207
  "div",
214
208
  {
215
209
  style: {
@@ -218,22 +212,22 @@ const ze = ({
218
212
  }
219
213
  }
220
214
  ),
221
- p.length > 0 && (() => {
222
- const h = /* @__PURE__ */ new Map();
223
- p.forEach((b) => {
224
- const X = b.group || `individual-${b.id}`, te = h.get(X) || [];
225
- te.push(b), h.set(X, te);
215
+ f.length > 0 && (() => {
216
+ const x = /* @__PURE__ */ new Map();
217
+ f.forEach((h) => {
218
+ const Y = h.group || `individual-${h.id}`, ee = x.get(Y) || [];
219
+ ee.push(h), x.set(Y, ee);
226
220
  });
227
- const j = Array.from(h.values()).map((b) => ({
228
- ...b[0],
229
- count: b.length
221
+ const B = Array.from(x.values()).map((h) => ({
222
+ ...h[0],
223
+ count: h.length
230
224
  }));
231
225
  return /* @__PURE__ */ o("div", { style: { borderBottom: "1px solid #f0f0f0" }, children: [
232
226
  /* @__PURE__ */ o(
233
227
  "button",
234
228
  {
235
229
  type: "button",
236
- onClick: () => g(!J),
230
+ onClick: () => ie(!X),
237
231
  style: {
238
232
  width: "100%",
239
233
  display: "flex",
@@ -251,7 +245,7 @@ const ze = ({
251
245
  children: [
252
246
  /* @__PURE__ */ o("span", { children: [
253
247
  "Existing Fields (",
254
- j.length,
248
+ B.length,
255
249
  ")"
256
250
  ] }),
257
251
  /* @__PURE__ */ r(
@@ -264,7 +258,7 @@ const ze = ({
264
258
  height: "8px",
265
259
  borderRight: "2px solid #666",
266
260
  borderBottom: "2px solid #666",
267
- transform: J ? "rotate(45deg)" : "rotate(-45deg)",
261
+ transform: X ? "rotate(45deg)" : "rotate(-45deg)",
268
262
  transition: "transform 0.2s ease"
269
263
  }
270
264
  }
@@ -272,11 +266,11 @@ const ze = ({
272
266
  ]
273
267
  }
274
268
  ),
275
- J && /* @__PURE__ */ r("div", { style: { maxHeight: "300px", overflowY: "auto" }, children: j.map((b) => /* @__PURE__ */ o(
269
+ X && /* @__PURE__ */ r("div", { style: { maxHeight: "300px", overflowY: "auto" }, children: B.map((h) => /* @__PURE__ */ o(
276
270
  "div",
277
271
  {
278
272
  className: "field-menu-item",
279
- onClick: () => T?.(b),
273
+ onClick: () => T?.(h),
280
274
  style: {
281
275
  padding: "8px 16px",
282
276
  cursor: "pointer",
@@ -287,7 +281,7 @@ const ze = ({
287
281
  },
288
282
  children: [
289
283
  /* @__PURE__ */ o("div", { style: { flex: 1, minWidth: 0 }, children: [
290
- /* @__PURE__ */ r("div", { style: { fontWeight: 500, fontSize: "13px" }, children: b.alias || b.id }),
284
+ /* @__PURE__ */ r("div", { style: { fontWeight: 500, fontSize: "13px" }, children: h.alias || h.id }),
291
285
  /* @__PURE__ */ r(
292
286
  "div",
293
287
  {
@@ -296,7 +290,7 @@ const ze = ({
296
290
  color: "#9ca3af",
297
291
  marginTop: "2px"
298
292
  },
299
- children: b.group ? `group (${b.count} fields)` : `ID: ${b.id}`
293
+ children: h.group ? `group (${h.count} fields)` : `ID: ${h.id}`
300
294
  }
301
295
  )
302
296
  ] }),
@@ -312,16 +306,16 @@ const ze = ({
312
306
  textTransform: "capitalize",
313
307
  flexShrink: 0
314
308
  },
315
- children: b.mode || "inline"
309
+ children: h.mode || "inline"
316
310
  }
317
311
  )
318
312
  ]
319
313
  },
320
- b.group || b.id
314
+ h.group || h.id
321
315
  )) })
322
316
  ] });
323
317
  })(),
324
- V.length === 0 ? /* @__PURE__ */ r(
318
+ O.length === 0 ? /* @__PURE__ */ r(
325
319
  "div",
326
320
  {
327
321
  style: {
@@ -337,7 +331,7 @@ const ze = ({
337
331
  "button",
338
332
  {
339
333
  type: "button",
340
- onClick: () => W(!z),
334
+ onClick: () => z(!p),
341
335
  style: {
342
336
  width: "100%",
343
337
  display: "flex",
@@ -355,7 +349,7 @@ const ze = ({
355
349
  children: [
356
350
  /* @__PURE__ */ o("span", { children: [
357
351
  "Available Fields (",
358
- V.length,
352
+ O.length,
359
353
  ")"
360
354
  ] }),
361
355
  /* @__PURE__ */ r(
@@ -368,7 +362,7 @@ const ze = ({
368
362
  height: "8px",
369
363
  borderRight: "2px solid #666",
370
364
  borderBottom: "2px solid #666",
371
- transform: z ? "rotate(45deg)" : "rotate(-45deg)",
365
+ transform: p ? "rotate(45deg)" : "rotate(-45deg)",
372
366
  transition: "transform 0.2s ease"
373
367
  }
374
368
  }
@@ -376,11 +370,11 @@ const ze = ({
376
370
  ]
377
371
  }
378
372
  ),
379
- z && /* @__PURE__ */ r("div", { style: { maxHeight: "300px", overflowY: "auto" }, children: V.map((h) => /* @__PURE__ */ o(
373
+ p && /* @__PURE__ */ r("div", { style: { maxHeight: "300px", overflowY: "auto" }, children: O.map((x) => /* @__PURE__ */ o(
380
374
  "div",
381
375
  {
382
376
  className: "field-menu-item",
383
- onClick: () => B(h),
377
+ onClick: () => N(x),
384
378
  style: {
385
379
  padding: "8px 16px",
386
380
  cursor: "pointer",
@@ -391,7 +385,7 @@ const ze = ({
391
385
  },
392
386
  children: [
393
387
  /* @__PURE__ */ o("div", { style: { flex: 1, minWidth: 0 }, children: [
394
- /* @__PURE__ */ r("div", { style: { fontWeight: 500, fontSize: "13px" }, children: h.label || h.id }),
388
+ /* @__PURE__ */ r("div", { style: { fontWeight: 500, fontSize: "13px" }, children: x.label || x.id }),
395
389
  /* @__PURE__ */ o(
396
390
  "div",
397
391
  {
@@ -402,7 +396,7 @@ const ze = ({
402
396
  },
403
397
  children: [
404
398
  "ID: ",
405
- h.id
399
+ x.id
406
400
  ]
407
401
  }
408
402
  )
@@ -419,12 +413,12 @@ const ze = ({
419
413
  textTransform: "capitalize",
420
414
  flexShrink: 0
421
415
  },
422
- children: h.metadata?.mode || "inline"
416
+ children: x.metadata?.mode || "inline"
423
417
  }
424
418
  )
425
419
  ]
426
420
  },
427
- h.id
421
+ x.id
428
422
  )) })
429
423
  ] }),
430
424
  /* @__PURE__ */ r(
@@ -452,36 +446,36 @@ const ze = ({
452
446
  }
453
447
  )
454
448
  ] });
455
- }, Be = (n) => {
456
- const l = n.split("-");
457
- return l.length > 2 ? l[l.length - 1].substring(0, 6) : n.substring(0, 6);
458
- }, be = ({ field: n, onSelect: l, onDelete: u, isSelected: s, isGrouped: a = !1 }) => /* @__PURE__ */ o(
449
+ }, He = (n) => {
450
+ const d = n.split("-");
451
+ return d.length > 2 ? d[d.length - 1].substring(0, 6) : n.substring(0, 6);
452
+ }, ye = ({ field: n, onSelect: d, onDelete: g, isSelected: l, isGrouped: u = !1 }) => /* @__PURE__ */ o(
459
453
  "div",
460
454
  {
461
- onClick: () => l(n),
455
+ onClick: () => d(n),
462
456
  style: {
463
457
  position: "relative",
464
458
  padding: "10px 12px",
465
- background: s ? "#eff6ff" : "#f9fafb",
466
- border: s ? "1px solid #3b82f6" : "1px solid #e5e7eb",
459
+ background: l ? "#eff6ff" : "#f9fafb",
460
+ border: l ? "1px solid #3b82f6" : "1px solid #e5e7eb",
467
461
  borderRadius: "6px",
468
462
  cursor: "pointer",
469
463
  transition: "all 0.2s",
470
- fontSize: a ? "13px" : "14px"
464
+ fontSize: u ? "13px" : "14px"
471
465
  },
472
- onMouseEnter: (d) => {
473
- s || (d.currentTarget.style.background = "#f3f4f6");
466
+ onMouseEnter: (a) => {
467
+ l || (a.currentTarget.style.background = "#f3f4f6");
474
468
  },
475
- onMouseLeave: (d) => {
476
- s || (d.currentTarget.style.background = "#f9fafb");
469
+ onMouseLeave: (a) => {
470
+ l || (a.currentTarget.style.background = "#f9fafb");
477
471
  },
478
472
  title: n.alias,
479
473
  children: [
480
474
  /* @__PURE__ */ r(
481
475
  "button",
482
476
  {
483
- onClick: (d) => {
484
- d.stopPropagation(), u(n.id);
477
+ onClick: (a) => {
478
+ a.stopPropagation(), g(n.id);
485
479
  },
486
480
  style: {
487
481
  position: "absolute",
@@ -497,11 +491,11 @@ const ze = ({
497
491
  alignItems: "center",
498
492
  justifyContent: "center"
499
493
  },
500
- onMouseEnter: (d) => {
501
- d.currentTarget.style.color = "#ef4444";
494
+ onMouseEnter: (a) => {
495
+ a.currentTarget.style.color = "#ef4444";
502
496
  },
503
- onMouseLeave: (d) => {
504
- d.currentTarget.style.color = "#9ca3af";
497
+ onMouseLeave: (a) => {
498
+ a.currentTarget.style.color = "#9ca3af";
505
499
  },
506
500
  title: "Delete field",
507
501
  children: /* @__PURE__ */ r(
@@ -532,8 +526,8 @@ const ze = ({
532
526
  {
533
527
  style: {
534
528
  fontWeight: "500",
535
- fontSize: a ? "12px" : "14px",
536
- color: a ? "#6b7280" : "#111827"
529
+ fontSize: u ? "12px" : "14px",
530
+ color: u ? "#6b7280" : "#111827"
537
531
  },
538
532
  children: n.alias || n.id
539
533
  }
@@ -574,21 +568,21 @@ const ze = ({
574
568
  ] })
575
569
  ]
576
570
  }
577
- ), We = ({
571
+ ), Le = ({
578
572
  fields: n,
579
- onSelect: l,
580
- onDelete: u,
581
- selectedFieldId: s
573
+ onSelect: d,
574
+ onDelete: g,
575
+ selectedFieldId: l
582
576
  }) => {
583
- const [a, d] = I(/* @__PURE__ */ new Set()), { groupedFields: B, ungroupedFields: P } = Ce(() => {
584
- const p = {}, T = [];
585
- return n.forEach((x) => {
586
- x.group ? (p[x.group] || (p[x.group] = []), p[x.group].push(x)) : T.push(x);
587
- }), { groupedFields: p, ungroupedFields: T };
588
- }, [n]), G = (p) => {
589
- d((T) => {
590
- const x = new Set(T);
591
- return x.has(p) ? x.delete(p) : x.add(p), x;
577
+ const [u, a] = I(/* @__PURE__ */ new Set()), { groupedFields: N, ungroupedFields: P } = Fe(() => {
578
+ const f = {}, T = [];
579
+ return n.forEach((m) => {
580
+ m.group ? (f[m.group] || (f[m.group] = []), f[m.group].push(m)) : T.push(m);
581
+ }), { groupedFields: f, ungroupedFields: T };
582
+ }, [n]), G = (f) => {
583
+ a((T) => {
584
+ const m = new Set(T);
585
+ return m.has(f) ? m.delete(f) : m.add(f), m;
592
586
  });
593
587
  };
594
588
  return /* @__PURE__ */ o(
@@ -624,18 +618,18 @@ const ze = ({
624
618
  ]
625
619
  }
626
620
  ) : /* @__PURE__ */ o("div", { style: { display: "flex", flexDirection: "column", gap: "8px" }, children: [
627
- P.map((p) => /* @__PURE__ */ r(
628
- be,
621
+ P.map((f) => /* @__PURE__ */ r(
622
+ ye,
629
623
  {
630
- field: p,
631
- onSelect: l,
632
- onDelete: u,
633
- isSelected: s === p.id
624
+ field: f,
625
+ onSelect: d,
626
+ onDelete: g,
627
+ isSelected: l === f.id
634
628
  },
635
- p.id
629
+ f.id
636
630
  )),
637
- Object.entries(B).map(([p, T]) => {
638
- const x = a.has(p), y = T[0];
631
+ Object.entries(N).map(([f, T]) => {
632
+ const m = u.has(f), y = T[0];
639
633
  return /* @__PURE__ */ o("div", { children: [
640
634
  /* @__PURE__ */ r(
641
635
  "div",
@@ -649,15 +643,15 @@ const ze = ({
649
643
  cursor: "pointer",
650
644
  transition: "all 0.2s"
651
645
  },
652
- onClick: () => G(p),
653
- onMouseEnter: (F) => {
654
- F.currentTarget.style.background = "#f3f4f6";
646
+ onClick: () => G(f),
647
+ onMouseEnter: (w) => {
648
+ w.currentTarget.style.background = "#f3f4f6";
655
649
  },
656
- onMouseLeave: (F) => {
657
- F.currentTarget.style.background = "#f9fafb";
650
+ onMouseLeave: (w) => {
651
+ w.currentTarget.style.background = "#f9fafb";
658
652
  },
659
653
  children: /* @__PURE__ */ o("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
660
- /* @__PURE__ */ r("span", { style: { fontSize: "12px", color: "#6b7280" }, children: x ? "▼" : "▶" }),
654
+ /* @__PURE__ */ r("span", { style: { fontSize: "12px", color: "#6b7280" }, children: m ? "▼" : "▶" }),
661
655
  /* @__PURE__ */ o("div", { style: { flex: 1 }, children: [
662
656
  /* @__PURE__ */ r("div", { style: { fontWeight: "500", fontSize: "14px" }, children: y.alias }),
663
657
  /* @__PURE__ */ o(
@@ -670,7 +664,7 @@ const ze = ({
670
664
  },
671
665
  children: [
672
666
  "group: ",
673
- Be(p),
667
+ He(f),
674
668
  " (",
675
669
  T.length,
676
670
  " fields)"
@@ -681,7 +675,7 @@ const ze = ({
681
675
  ] })
682
676
  }
683
677
  ),
684
- x && /* @__PURE__ */ r(
678
+ m && /* @__PURE__ */ r(
685
679
  "div",
686
680
  {
687
681
  style: {
@@ -691,47 +685,47 @@ const ze = ({
691
685
  flexDirection: "column",
692
686
  gap: "4px"
693
687
  },
694
- children: T.map((F) => /* @__PURE__ */ r(
695
- be,
688
+ children: T.map((w) => /* @__PURE__ */ r(
689
+ ye,
696
690
  {
697
- field: F,
698
- onSelect: l,
699
- onDelete: u,
700
- isSelected: s === F.id,
691
+ field: w,
692
+ onSelect: d,
693
+ onDelete: g,
694
+ isSelected: l === w.id,
701
695
  isGrouped: !0
702
696
  },
703
- F.id
697
+ w.id
704
698
  ))
705
699
  }
706
700
  )
707
- ] }, p);
701
+ ] }, f);
708
702
  })
709
703
  ] })
710
704
  ]
711
705
  }
712
706
  );
713
- }, Z = (n) => {
714
- const l = n.helpers?.structuredContentCommands;
715
- return l?.getStructuredContentTags ? (l.getStructuredContentTags(n.state) || []).map((s) => {
716
- const a = s?.node ?? s, d = a?.attrs ?? {}, P = (a?.type?.name || "").includes("Block") ? "block" : "inline";
707
+ }, Q = (n) => {
708
+ const d = n.helpers?.structuredContentCommands;
709
+ return d?.getStructuredContentTags ? (d.getStructuredContentTags(n.state) || []).map((l) => {
710
+ const u = l?.node ?? l, a = u?.attrs ?? {}, P = (u?.type?.name || "").includes("Block") ? "block" : "inline";
717
711
  return {
718
- id: d.id,
719
- alias: d.alias || d.label || "",
720
- tag: d.tag,
712
+ id: a.id,
713
+ alias: a.alias || a.label || "",
714
+ tag: a.tag,
721
715
  mode: P,
722
- group: l.getGroup?.(d.tag) ?? void 0
716
+ group: d.getGroup?.(a.tag) ?? void 0
723
717
  };
724
718
  }) : [];
725
- }, ye = (n, l) => {
726
- if (n === l) return !0;
727
- if (n.length !== l.length) return !1;
728
- for (let u = 0; u < n.length; u += 1) {
729
- const s = n[u], a = l[u];
730
- if (!a || s.id !== a.id || s.alias !== a.alias || s.tag !== a.tag || s.position !== a.position || s.mode !== a.mode || s.group !== a.group)
719
+ }, ve = (n, d) => {
720
+ if (n === d) return !0;
721
+ if (n.length !== d.length) return !1;
722
+ for (let g = 0; g < n.length; g += 1) {
723
+ const l = n[g], u = d[g];
724
+ if (!u || l.id !== u.id || l.alias !== u.alias || l.tag !== u.tag || l.position !== u.position || l.mode !== u.mode || l.group !== u.group)
731
725
  return !1;
732
726
  }
733
727
  return !0;
734
- }, He = (n) => {
728
+ }, Pe = (n) => {
735
729
  if (!n) return null;
736
730
  if (n === !0)
737
731
  return {
@@ -745,47 +739,48 @@ const ze = ({
745
739
  config: {},
746
740
  renderDefaultContainer: !1
747
741
  };
748
- const { selector: l, ...u } = n;
742
+ const { selector: d, ...g } = n;
749
743
  return {
750
- selector: l || "#superdoc-toolbar",
751
- config: u,
752
- renderDefaultContainer: l === void 0
744
+ selector: d || "#superdoc-toolbar",
745
+ config: g,
746
+ renderDefaultContainer: d === void 0
753
747
  };
754
- }, ie = 10, Le = 250, Pe = 300, ve = (n) => {
755
- const l = window.innerWidth - Le - ie, u = window.innerHeight - Pe - ie, s = Math.min(n.left, l), a = Math.min(n.top, u);
748
+ }, re = 10, Ae = 250, Ve = 300, Ce = (n) => {
749
+ const d = window.innerWidth - Ae - re, g = window.innerHeight - Ve - re, l = Math.min(n.left, d), u = Math.min(n.top, g);
756
750
  return new DOMRect(
757
- Math.max(s, ie),
758
- Math.max(a, ie),
751
+ Math.max(l, re),
752
+ Math.max(u, re),
759
753
  n.width,
760
754
  n.height
761
755
  );
762
- }, Ae = Re((n, l) => {
756
+ }, je = ze((n, d) => {
763
757
  const {
764
- document: u,
765
- fields: s = {},
766
- menu: a = {},
767
- list: d = {},
768
- toolbar: B,
758
+ document: g,
759
+ fields: l = {},
760
+ menu: u = {},
761
+ list: a = {},
762
+ toolbar: N,
769
763
  onReady: P,
770
764
  onTrigger: G,
771
- onFieldInsert: p,
765
+ onFieldInsert: f,
772
766
  onFieldUpdate: T,
773
- onFieldDelete: x,
767
+ onFieldDelete: m,
774
768
  onFieldsChange: y,
775
- onFieldSelect: F,
776
- onFieldCreate: N,
777
- className: q,
778
- style: A,
779
- documentHeight: J = "600px"
780
- } = n, [g, z] = I(
781
- s.initial || []
782
- ), [W, Q] = I(null), [V, M] = I(!1), [ee, h] = I(), [j, b] = I(""), [X, te] = I(() => s.available || []), ne = U(null), w = U(null), D = U(null), ue = U(s);
783
- ue.current = s;
784
- const H = U(null), pe = U(V);
785
- se(() => {
786
- pe.current = V;
787
- }, [V]);
788
- const re = a.trigger || "{{", le = ue.current.available || [], fe = S(
769
+ onFieldSelect: w,
770
+ onFieldCreate: R,
771
+ onExport: q,
772
+ className: A,
773
+ style: X,
774
+ documentHeight: ie = "600px"
775
+ } = n, [p, z] = I(l.initial || []), [V, O] = I(null), [j, D] = I(!1), [x, B] = I(), [h, Y] = I(""), [ee, we] = I(
776
+ () => l.available || []
777
+ ), se = J(null), F = J(null), M = J(null), pe = J(l);
778
+ pe.current = l;
779
+ const W = J(null), fe = J(j);
780
+ oe(() => {
781
+ fe.current = j;
782
+ }, [j]);
783
+ const te = u.trigger || "{{", le = pe.current.available || [], ge = S(
789
784
  (e) => {
790
785
  const t = e.trim().toLowerCase();
791
786
  return t ? le.filter((i) => i.label.toLowerCase().includes(t)) : le;
@@ -793,15 +788,15 @@ const ze = ({
793
788
  [le]
794
789
  ), de = S(
795
790
  (e) => {
796
- b(e), te(fe(e));
791
+ Y(e), we(ge(e));
797
792
  },
798
- [fe]
799
- ), L = S(() => {
793
+ [ge]
794
+ ), H = S(() => {
800
795
  de("");
801
- }, [de]), Y = S(
796
+ }, [de]), K = S(
802
797
  (e, t) => {
803
- if (!w.current?.activeEditor) return !1;
804
- const i = w.current.activeEditor, v = g, C = e === "inline" ? i.commands.insertStructuredContentInline?.({
798
+ if (!F.current?.activeEditor) return !1;
799
+ const i = F.current.activeEditor, v = p, b = e === "inline" ? i.commands.insertStructuredContentInline?.({
805
800
  attrs: {
806
801
  alias: t.alias,
807
802
  tag: t.metadata ? JSON.stringify(t.metadata) : void 0
@@ -814,335 +809,304 @@ const ze = ({
814
809
  },
815
810
  text: t.defaultValue || t.alias
816
811
  });
817
- if (C) {
818
- const m = Z(i);
819
- z(m), y?.(m);
820
- const E = m.find(
821
- (c) => !v.some((f) => f.id === c.id)
812
+ if (b) {
813
+ const c = Q(i);
814
+ z(c), y?.(c);
815
+ const E = c.find(
816
+ (C) => !v.some((s) => s.id === C.id)
822
817
  );
823
- E && p?.(E);
818
+ E && f?.(E);
824
819
  }
825
- return C;
820
+ return b;
826
821
  },
827
- [p, y, g]
828
- ), K = S(
822
+ [f, y, p]
823
+ ), Z = S(
829
824
  (e, t) => {
830
- if (!w.current?.activeEditor) return !1;
831
- const v = w.current.activeEditor.commands.updateStructuredContentById?.(e, {
825
+ if (!F.current?.activeEditor) return !1;
826
+ const v = F.current.activeEditor.commands.updateStructuredContentById?.(e, {
832
827
  attrs: t
833
828
  });
834
- return v && z((C) => {
835
- const m = C.map(
836
- (c) => c.id === e ? { ...c, ...t } : c
837
- );
838
- y?.(m);
839
- const E = m.find((c) => c.id === e);
840
- return E && T?.(E), m;
829
+ return v && z((b) => {
830
+ const c = b.map((C) => C.id === e ? { ...C, ...t } : C);
831
+ y?.(c);
832
+ const E = c.find((C) => C.id === e);
833
+ return E && T?.(E), c;
841
834
  }), v;
842
835
  },
843
836
  [T, y]
844
837
  ), ae = S(
845
838
  (e) => {
846
- const t = w.current?.activeEditor;
839
+ const t = F.current?.activeEditor;
847
840
  if (!t) {
848
- let f = !1;
841
+ let s = !1;
849
842
  return z((k) => {
850
- if (!k.some((R) => R.id === e)) return k;
851
- const $ = k.filter((R) => R.id !== e);
852
- return f = !0, y?.($), $;
853
- }), f && (x?.(e), Q((k) => k === e ? null : k)), f;
843
+ if (!k.some((L) => L.id === e)) return k;
844
+ const U = k.filter((L) => L.id !== e);
845
+ return s = !0, y?.(U), U;
846
+ }), s && (m?.(e), O((k) => k === e ? null : k)), s;
854
847
  }
855
- const v = g.find((f) => f.id === e)?.group;
856
- let C = !1;
848
+ const v = p.find((s) => s.id === e)?.group;
849
+ let b = !1;
857
850
  try {
858
- C = t.commands.deleteStructuredContentById?.(e) ?? !1;
851
+ b = t.commands.deleteStructuredContentById?.(e) ?? !1;
859
852
  } catch {
860
- C = !1;
853
+ b = !1;
861
854
  }
862
- let m = Z(t);
863
- const E = m.some((f) => f.id === e);
864
- if (!C && E && (m = m.filter((f) => f.id !== e)), v) {
865
- const f = m.filter(
866
- (k) => k.group === v
867
- );
868
- if (f.length === 1) {
869
- const k = f[0];
855
+ let c = Q(t);
856
+ const E = c.some((s) => s.id === e);
857
+ if (!b && E && (c = c.filter((s) => s.id !== e)), v) {
858
+ const s = c.filter((k) => k.group === v);
859
+ if (s.length === 1) {
860
+ const k = s[0];
870
861
  t.commands.updateStructuredContentById?.(k.id, {
871
862
  attrs: { tag: void 0 }
872
- }), m = Z(t);
863
+ }), c = Q(t);
873
864
  }
874
865
  }
875
- let c = !1;
876
- return z((f) => {
877
- if (ye(f, m))
878
- return f;
879
- const k = f.some((R) => R.id === e), $ = m.some((R) => R.id === e);
880
- return k && !$ && (c = !0), y?.(m), m;
881
- }), c && (x?.(e), Q((f) => f === e ? null : f)), C || c;
866
+ let C = !1;
867
+ return z((s) => {
868
+ if (ve(s, c))
869
+ return s;
870
+ const k = s.some((L) => L.id === e), U = c.some((L) => L.id === e);
871
+ return k && !U && (C = !0), y?.(c), c;
872
+ }), C && (m?.(e), O((s) => s === e ? null : s)), b || C;
882
873
  },
883
- [x, y, g]
884
- ), O = S(
874
+ [m, y, p]
875
+ ), _ = S(
885
876
  (e) => {
886
- if (!w.current?.activeEditor) return;
887
- w.current.activeEditor.commands.selectStructuredContentById?.(e), Q(e);
888
- const i = g.find((v) => v.id === e);
889
- i && F?.(i);
877
+ if (!F.current?.activeEditor) return;
878
+ F.current.activeEditor.commands.selectStructuredContentById?.(e), O(e);
879
+ const i = p.find((v) => v.id === e);
880
+ i && w?.(i);
890
881
  },
891
- [g, F]
882
+ [p, w]
892
883
  ), ce = S(
893
884
  (e) => {
894
885
  if (!e) return;
895
- const t = Z(e);
896
- z((i) => ye(i, t) ? i : (y?.(t), t));
886
+ const t = Q(e);
887
+ z((i) => ve(i, t) ? i : (y?.(t), t));
897
888
  },
898
889
  [y]
899
890
  );
900
- se(() => ne.current ? ((async () => {
891
+ oe(() => se.current ? ((async () => {
901
892
  const { SuperDoc: t } = await import("superdoc"), i = {
902
- selector: ne.current,
903
- document: u?.source,
904
- documentMode: u?.mode || "editing",
905
- onReady: () => {
906
- if (v.activeEditor) {
907
- const C = v.activeEditor;
908
- C.on("update", ({ editor: m }) => {
909
- const { state: E } = m, { from: c } = E.selection;
910
- if (c >= re.length) {
911
- const R = c - re.length;
912
- if (E.doc.textBetween(R, c) === re) {
913
- const me = m.view.coordsAtPos(c), xe = ve(
914
- new DOMRect(me.left, me.top, 0, 0)
915
- ), he = () => {
916
- const oe = w.current?.activeEditor;
917
- if (!oe) return;
918
- const Me = oe.state.selection.from, De = oe.state.tr.delete(R, Me);
919
- oe.view.dispatch(De);
920
- };
921
- D.current = he, H.current = c, h(xe), M(!0), L(), G?.({
922
- position: { from: R, to: c },
923
- bounds: xe,
924
- cleanup: he
925
- });
926
- return;
927
- }
928
- }
929
- if (!pe.current)
930
- return;
931
- if (H.current == null) {
932
- M(!1), L();
933
- return;
934
- }
935
- if (c < H.current) {
936
- M(!1), H.current = null, L();
937
- return;
938
- }
939
- const f = E.doc.textBetween(
940
- H.current,
941
- c
942
- );
943
- de(f);
944
- const k = m.view.coordsAtPos(c), $ = ve(
945
- new DOMRect(k.left, k.top, 0, 0)
946
- );
947
- h($);
948
- }), C.on("update", () => {
949
- ce(C);
950
- }), ce(C);
893
+ comments: !1,
894
+ ...$ && {
895
+ toolbar: {
896
+ selector: $.selector,
897
+ toolbarGroups: $.config.toolbarGroups || ["center"],
898
+ excludeItems: $.config.excludeItems || [],
899
+ ...$.config
951
900
  }
952
- P?.();
953
901
  }
954
- }, v = new t({
955
- selector: ne.current,
956
- documentMode: u?.mode || "editing",
957
- ...i,
958
- ..._ && {
959
- toolbar: _.selector,
960
- modules: {
961
- toolbar: {
962
- selector: _.selector,
963
- toolbarGroups: _.config.toolbarGroups || ["center"],
964
- excludeItems: _.config.excludeItems || [],
965
- ..._.config
902
+ }, v = () => {
903
+ if (b.activeEditor) {
904
+ const c = b.activeEditor;
905
+ c.on("update", ({ editor: E }) => {
906
+ const { state: C } = E, { from: s } = C.selection;
907
+ if (s >= te.length) {
908
+ const ue = s - te.length;
909
+ if (C.doc.textBetween(ue, s) === te) {
910
+ const xe = E.view.coordsAtPos(s), he = Ce(new DOMRect(xe.left, xe.top, 0, 0)), be = () => {
911
+ const ne = F.current?.activeEditor;
912
+ if (!ne) return;
913
+ const De = ne.state.selection.from, Ne = ne.state.tr.delete(ue, De);
914
+ ne.view.dispatch(Ne);
915
+ };
916
+ M.current = be, W.current = s, B(he), D(!0), H(), G?.({
917
+ position: { from: ue, to: s },
918
+ bounds: he,
919
+ cleanup: be
920
+ });
921
+ return;
922
+ }
966
923
  }
967
- }
924
+ if (!fe.current)
925
+ return;
926
+ if (W.current == null) {
927
+ D(!1), H();
928
+ return;
929
+ }
930
+ if (s < W.current) {
931
+ D(!1), W.current = null, H();
932
+ return;
933
+ }
934
+ const k = C.doc.textBetween(W.current, s);
935
+ de(k);
936
+ const U = E.view.coordsAtPos(s), L = Ce(new DOMRect(U.left, U.top, 0, 0));
937
+ B(L);
938
+ }), c.on("update", () => {
939
+ ce(c);
940
+ }), ce(c);
968
941
  }
942
+ P?.();
943
+ }, b = new t({
944
+ selector: se.current,
945
+ document: g?.source,
946
+ documentMode: g?.mode || "editing",
947
+ modules: i,
948
+ toolbar: $?.selector,
949
+ onReady: v
969
950
  });
970
- w.current = v;
951
+ F.current = b;
971
952
  })(), () => {
972
- D.current = null, H.current = null;
973
- const t = w.current;
974
- t && typeof t.destroy == "function" && t.destroy(), w.current = null;
975
- }) : void 0, [
976
- u?.source,
977
- u?.mode,
978
- re,
979
- ce,
980
- P,
981
- G,
982
- B
983
- ]);
984
- const Fe = S(
953
+ M.current = null, W.current = null;
954
+ const t = F.current;
955
+ t && typeof t.destroy == "function" && t.destroy(), F.current = null;
956
+ }) : void 0, [g?.source, g?.mode, te, ce, P, G, N]);
957
+ const ke = S(
985
958
  async (e) => {
986
- D.current && (D.current(), D.current = null), H.current = null, L();
959
+ M.current && (M.current(), M.current = null), W.current = null, H();
987
960
  const t = e.metadata?.mode || "inline";
988
- if (e.id.startsWith("custom_") && N) {
989
- const i = await N(e);
961
+ if (e.id.startsWith("custom_") && R) {
962
+ const i = await R(e);
990
963
  if (i) {
991
964
  const v = i.metadata?.mode || t;
992
- Y(v, {
965
+ K(v, {
993
966
  alias: i.label,
994
967
  metadata: i.metadata,
995
968
  defaultValue: i.defaultValue
996
- }), M(!1);
969
+ }), D(!1);
997
970
  return;
998
971
  }
999
972
  }
1000
- Y(t, {
973
+ K(t, {
1001
974
  alias: e.label,
1002
975
  metadata: e.metadata,
1003
976
  defaultValue: e.defaultValue
1004
- }), M(!1);
977
+ }), D(!1);
1005
978
  },
1006
- [Y, N, L]
1007
- ), we = S(
979
+ [K, R, H]
980
+ ), Se = S(
1008
981
  (e) => {
1009
- D.current && (D.current(), D.current = null), H.current = null, L();
1010
- const t = w.current?.activeEditor;
982
+ M.current && (M.current(), M.current = null), W.current = null, H();
983
+ const t = F.current?.activeEditor;
1011
984
  if (!t) return;
1012
985
  const i = t.helpers?.structuredContentCommands;
1013
986
  if (!i) return;
1014
- const v = e.group || `group-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`, C = i.createTagObject?.({
987
+ const v = e.group || `group-${Date.now()}-${Math.random().toString(36).substring(2, 11)}`, b = i.createTagObject?.({
1015
988
  group: v
1016
989
  });
1017
990
  if ((e.mode || "inline") === "inline" ? t.commands.insertStructuredContentInline?.({
1018
991
  attrs: {
1019
992
  alias: e.alias,
1020
- tag: C
993
+ tag: b
1021
994
  },
1022
995
  text: e.alias
1023
996
  }) : t.commands.insertStructuredContentBlock?.({
1024
997
  attrs: {
1025
998
  alias: e.alias,
1026
- tag: C
999
+ tag: b
1027
1000
  },
1028
1001
  text: e.alias
1029
1002
  })) {
1030
- e.group || K(e.id, { tag: C }), M(!1);
1031
- const c = Z(t);
1032
- z(c), y?.(c);
1003
+ e.group || Z(e.id, { tag: b }), D(!1);
1004
+ const C = Q(t);
1005
+ z(C), y?.(C);
1033
1006
  }
1034
1007
  },
1035
- [K, L, y]
1036
- ), ke = S(() => {
1037
- M(!1), H.current = null, L(), D.current && (D.current(), D.current = null);
1038
- }, [L]), Se = S(() => {
1039
- if (!w.current?.activeEditor || g.length === 0)
1040
- return;
1041
- const e = g.findIndex(
1042
- (i) => i.id === W
1043
- ), t = e >= 0 ? (e + 1) % g.length : 0;
1044
- O(g[t].id);
1045
- }, [g, W, O]), Te = S(() => {
1046
- if (!w.current?.activeEditor || g.length === 0)
1047
- return;
1048
- const e = g.findIndex(
1049
- (i) => i.id === W
1050
- ), t = e > 0 ? e - 1 : g.length - 1;
1051
- O(g[t].id);
1052
- }, [g, W, O]), Ee = S(
1008
+ [Z, H, y]
1009
+ ), Te = S(() => {
1010
+ D(!1), W.current = null, H(), M.current && (M.current(), M.current = null);
1011
+ }, [H]), Ee = S(() => {
1012
+ if (!F.current?.activeEditor || p.length === 0) return;
1013
+ const e = p.findIndex((i) => i.id === V), t = e >= 0 ? (e + 1) % p.length : 0;
1014
+ _(p[t].id);
1015
+ }, [p, V, _]), Ie = S(() => {
1016
+ if (!F.current?.activeEditor || p.length === 0) return;
1017
+ const e = p.findIndex((i) => i.id === V), t = e > 0 ? e - 1 : p.length - 1;
1018
+ _(p[t].id);
1019
+ }, [p, V, _]), Me = S(
1053
1020
  async (e) => {
1054
- const { fileName: t = "document", triggerDownload: i = !0 } = e || {};
1055
- return await w.current?.export({
1021
+ const { fileName: t = "document", triggerDownload: i = !0 } = e || {}, v = await F.current?.export({
1056
1022
  exportType: ["docx"],
1057
1023
  exportedName: t,
1058
1024
  triggerDownload: i
1059
- });
1025
+ }), b = F.current?.activeEditor;
1026
+ if (b) {
1027
+ const c = Q(b);
1028
+ q?.({ fields: c, blob: i ? void 0 : v, fileName: t });
1029
+ }
1030
+ return v;
1060
1031
  },
1061
- []
1032
+ [q]
1062
1033
  );
1063
- Ne(l, () => ({
1064
- insertField: (e) => Y("inline", e),
1065
- insertBlockField: (e) => Y("block", e),
1066
- updateField: K,
1034
+ Be(d, () => ({
1035
+ insertField: (e) => K("inline", e),
1036
+ insertBlockField: (e) => K("block", e),
1037
+ updateField: Z,
1067
1038
  deleteField: ae,
1068
- selectField: O,
1069
- nextField: Se,
1070
- previousField: Te,
1071
- getFields: () => g,
1072
- exportTemplate: Ee,
1073
- getSuperDoc: () => w.current
1039
+ selectField: _,
1040
+ nextField: Ee,
1041
+ previousField: Ie,
1042
+ getFields: () => p,
1043
+ exportTemplate: Me,
1044
+ getSuperDoc: () => F.current
1074
1045
  }));
1075
- const Ie = a.component || ze, ge = d.component || We, _ = He(B);
1076
- return /* @__PURE__ */ o(
1077
- "div",
1078
- {
1079
- className: `superdoc-template-builder ${q || ""}`,
1080
- style: A,
1081
- children: [
1082
- /* @__PURE__ */ o("div", { style: { display: "flex", gap: "20px" }, children: [
1083
- d.position === "left" && /* @__PURE__ */ r("div", { className: "superdoc-template-builder-sidebar", children: /* @__PURE__ */ r(
1084
- ge,
1085
- {
1086
- fields: g,
1087
- onSelect: (e) => O(e.id),
1088
- onDelete: ae,
1089
- onUpdate: (e) => K(e.id, e),
1090
- selectedFieldId: W || void 0
1091
- }
1092
- ) }),
1093
- /* @__PURE__ */ o("div", { className: "superdoc-template-builder-document", style: { flex: 1 }, children: [
1094
- _?.renderDefaultContainer && /* @__PURE__ */ r(
1095
- "div",
1096
- {
1097
- id: "superdoc-toolbar",
1098
- className: "superdoc-template-builder-toolbar",
1099
- "data-testid": "template-builder-toolbar"
1100
- }
1101
- ),
1102
- /* @__PURE__ */ r(
1103
- "div",
1104
- {
1105
- ref: ne,
1106
- className: "superdoc-template-builder-editor",
1107
- style: { height: J },
1108
- "data-testid": "template-builder-editor"
1109
- }
1110
- )
1111
- ] }),
1112
- d.position === "right" && /* @__PURE__ */ r("div", { className: "superdoc-template-builder-sidebar", children: /* @__PURE__ */ r(
1113
- ge,
1114
- {
1115
- fields: g,
1116
- onSelect: (e) => O(e.id),
1117
- onDelete: ae,
1118
- onUpdate: (e) => K(e.id, e),
1119
- selectedFieldId: W || void 0
1120
- }
1121
- ) })
1122
- ] }),
1046
+ const Re = u.component || We, me = a.component || Le, $ = Pe(N);
1047
+ return /* @__PURE__ */ o("div", { className: `superdoc-template-builder ${A || ""}`, style: X, children: [
1048
+ /* @__PURE__ */ o("div", { style: { display: "flex", gap: "20px" }, children: [
1049
+ a.position === "left" && /* @__PURE__ */ r("div", { className: "superdoc-template-builder-sidebar", children: /* @__PURE__ */ r(
1050
+ me,
1051
+ {
1052
+ fields: p,
1053
+ onSelect: (e) => _(e.id),
1054
+ onDelete: ae,
1055
+ onUpdate: (e) => Z(e.id, e),
1056
+ selectedFieldId: V || void 0
1057
+ }
1058
+ ) }),
1059
+ /* @__PURE__ */ o("div", { className: "superdoc-template-builder-document", style: { flex: 1 }, children: [
1060
+ $?.renderDefaultContainer && /* @__PURE__ */ r(
1061
+ "div",
1062
+ {
1063
+ id: "superdoc-toolbar",
1064
+ className: "superdoc-template-builder-toolbar",
1065
+ "data-testid": "template-builder-toolbar"
1066
+ }
1067
+ ),
1123
1068
  /* @__PURE__ */ r(
1124
- Ie,
1069
+ "div",
1125
1070
  {
1126
- isVisible: V,
1127
- position: ee,
1128
- availableFields: s.available || [],
1129
- filteredFields: X,
1130
- filterQuery: j,
1131
- allowCreate: s.allowCreate || !1,
1132
- onSelect: Fe,
1133
- onClose: ke,
1134
- onCreateField: N,
1135
- existingFields: g,
1136
- onSelectExisting: we
1071
+ ref: se,
1072
+ className: "superdoc-template-builder-editor",
1073
+ style: { height: ie },
1074
+ "data-testid": "template-builder-editor"
1137
1075
  }
1138
1076
  )
1139
- ]
1140
- }
1141
- );
1077
+ ] }),
1078
+ a.position === "right" && /* @__PURE__ */ r("div", { className: "superdoc-template-builder-sidebar", children: /* @__PURE__ */ r(
1079
+ me,
1080
+ {
1081
+ fields: p,
1082
+ onSelect: (e) => _(e.id),
1083
+ onDelete: ae,
1084
+ onUpdate: (e) => Z(e.id, e),
1085
+ selectedFieldId: V || void 0
1086
+ }
1087
+ ) })
1088
+ ] }),
1089
+ /* @__PURE__ */ r(
1090
+ Re,
1091
+ {
1092
+ isVisible: j,
1093
+ position: x,
1094
+ availableFields: l.available || [],
1095
+ filteredFields: ee,
1096
+ filterQuery: h,
1097
+ allowCreate: l.allowCreate || !1,
1098
+ onSelect: ke,
1099
+ onClose: Te,
1100
+ onCreateField: R,
1101
+ existingFields: p,
1102
+ onSelectExisting: Se
1103
+ }
1104
+ )
1105
+ ] });
1142
1106
  });
1143
- Ae.displayName = "SuperDocTemplateBuilder";
1107
+ je.displayName = "SuperDocTemplateBuilder";
1144
1108
  export {
1145
- We as FieldList,
1146
- ze as FieldMenu,
1147
- Ae as default
1109
+ Le as FieldList,
1110
+ We as FieldMenu,
1111
+ je as default
1148
1112
  };