@nice2dev/ui-forms 1.1.10 → 1.2.1

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,9 +1,9 @@
1
1
  import { jsx as e, jsxs as u } from "react/jsx-runtime";
2
2
  import { useNiceTranslation as ze } from "@nice2dev/i18n";
3
3
  import { useControllableState as le, NiceIcon as z, NiceDataGrid as fe, useNiceTranslation as Z, evaluateValidation as Ee, NiceTutorialButton as se, resolveTutorial as ce, NiceTooltip as X, NiceForm as Je, useNiceAI as Ue, useFormGeneration as He, NiceScriptRunner as we, NiceLifecycleHooksEditor as ke, NiceRevisionHistory as Se, NiceConsole as Te, NiceLogConsole as Fe, NiceBadge as ae, NiceValidationBuilder as Ge, NiceButton as te, NiceTabs as We, NiceCheckbox as Ye, NiceSelect as Qe, NiceTextInput as Xe, NiceAccessManager as Ze, NiceViewEditor as et, NiceWorkflowDesigner as tt, NiceDataSourceBuilder as it } from "@nice2dev/ui";
4
- import nt, { useState as K, forwardRef as ee, useMemo as P, useEffect as oe, useCallback as Q, useImperativeHandle as at } from "react";
4
+ import nt, { useState as M, forwardRef as ee, useMemo as q, useEffect as oe, useCallback as Q, useImperativeHandle as at } from "react";
5
5
  import { useNiceTranslation as ot, useControllableState as rt, NiceTutorialButton as lt, resolveTutorial as st, NiceIcon as be } from "@nice2dev/ui-core";
6
- function Bt(t) {
6
+ function Jt(t) {
7
7
  var l, o;
8
8
  const r = {
9
9
  text: "text",
@@ -85,7 +85,7 @@ function ve(t) {
85
85
  helpText: t.helpText
86
86
  };
87
87
  }
88
- function zt(t) {
88
+ function Ut(t) {
89
89
  const r = [];
90
90
  for (const a of t.sections)
91
91
  a.title ? r.push({
@@ -96,7 +96,7 @@ function zt(t) {
96
96
  }) : r.push(...a.fields.map(ve));
97
97
  return r;
98
98
  }
99
- function Jt(t) {
99
+ function Ht(t) {
100
100
  const r = [];
101
101
  t.version || r.push("Missing schema version"), t.id || r.push("Missing form ID"), (!t.sections || t.sections.length === 0) && r.push("Form must have at least one section");
102
102
  const a = /* @__PURE__ */ new Set();
@@ -106,13 +106,13 @@ function Jt(t) {
106
106
  return { valid: r.length === 0, errors: r };
107
107
  }
108
108
  function _e(t) {
109
- const { value: r, onChange: a, readOnly: l } = t, [o, i] = K(() => {
109
+ const { value: r, onChange: a, readOnly: l } = t, [o, i] = M(() => {
110
110
  try {
111
111
  return r === void 0 ? "" : JSON.stringify(r, null, 2);
112
112
  } catch {
113
113
  return "";
114
114
  }
115
- }), [n, c] = K(null);
115
+ }), [n, c] = M(null);
116
116
  return nt.useEffect(() => {
117
117
  try {
118
118
  i(r === void 0 ? "" : JSON.stringify(r, null, 2));
@@ -329,7 +329,7 @@ const ue = "__nafRid";
329
329
  function mt(t) {
330
330
  return Array.isArray(t) ? `[${t.length}]` : t && typeof t == "object" ? "{…}" : t == null ? "" : String(t);
331
331
  }
332
- const pt = ee(
332
+ const pt = /* @__PURE__ */ ee(
333
333
  function(r, a) {
334
334
  const {
335
335
  value: l,
@@ -348,14 +348,14 @@ const pt = ee(
348
348
  fallbackValue: [],
349
349
  onChange: i,
350
350
  componentName: "NiceArrayField"
351
- }), D = n.properties ?? {}, A = P(() => (p ?? Object.keys(D)).map((I) => {
352
- const v = D[I] ?? {}, k = { field: I, header: v.title ?? I };
351
+ }), K = n.properties ?? {}, A = q(() => (p ?? Object.keys(K)).map((I) => {
352
+ const v = K[I] ?? {}, k = { field: I, header: v.title ?? I };
353
353
  return v.type === "boolean" ? (k.render = (j) => j ? /* @__PURE__ */ e(z, { name: "check", size: 14, title: "true" }) : "", k.align = "center") : (v.type === "array" || v.type === "object") && (k.render = (j) => mt(j)), k;
354
- }), [n, p]), C = P(
354
+ }), [n, p]), C = q(
355
355
  () => xe(n),
356
356
  [n]
357
- ), w = P(() => F.map((M, I) => ({ ...M, [ue]: String(I) })), [F]), $ = (M) => {
358
- const { [ue]: I, ...v } = M;
357
+ ), w = q(() => F.map((D, I) => ({ ...D, [ue]: String(I) })), [F]), $ = (D) => {
358
+ const { [ue]: I, ...v } = D;
359
359
  return v;
360
360
  }, J = "nice-array-field" + (y ? ` ${y}` : "");
361
361
  return /* @__PURE__ */ e("div", { ref: a, className: J, style: s, "data-testid": h, children: /* @__PURE__ */ e(
@@ -369,17 +369,17 @@ const pt = ee(
369
369
  editFormTitle: c ? `${c} — item` : "Edit item",
370
370
  emptyText: `No items${c ? ` in ${c}` : ""}`,
371
371
  compact: !0,
372
- onRowAdd: f ? void 0 : (M) => O([...F, $(M)]),
373
- onRowEdit: f ? void 0 : (M, I) => {
374
- const v = Number(M);
372
+ onRowAdd: f ? void 0 : (D) => O([...F, $(D)]),
373
+ onRowEdit: f ? void 0 : (D, I) => {
374
+ const v = Number(D);
375
375
  O(
376
376
  F.map(
377
377
  (k, j) => j === v ? $(I) : k
378
378
  )
379
379
  );
380
380
  },
381
- onRowDelete: f ? void 0 : (M) => {
382
- const I = Number(M);
381
+ onRowDelete: f ? void 0 : (D) => {
382
+ const I = Number(D);
383
383
  O(F.filter((v, k) => k !== I));
384
384
  }
385
385
  }
@@ -434,7 +434,7 @@ function ft(t) {
434
434
  function yt(t, r) {
435
435
  return Ee(ft(t), r).filter((a) => a.severity === "error").map((a) => ({ field: a.field, message: a.message }));
436
436
  }
437
- const de = ee(
437
+ const de = /* @__PURE__ */ ee(
438
438
  function(r, a) {
439
439
  const {
440
440
  schema: l,
@@ -449,19 +449,19 @@ const de = ee(
449
449
  labelPosition: h = "top",
450
450
  readOnly: F = !1,
451
451
  liveValidation: O = !0,
452
- validationRules: D,
452
+ validationRules: K,
453
453
  tutorial: A,
454
454
  className: C,
455
455
  style: w,
456
456
  id: $,
457
457
  "data-testid": J
458
- } = r, { t: M } = Z(), [I, v] = le({
458
+ } = r, { t: D } = Z(), [I, v] = le({
459
459
  value: n,
460
460
  defaultValue: c,
461
461
  fallbackValue: {},
462
462
  onChange: f,
463
463
  componentName: "NiceSchemaForm"
464
- }), [k, j] = K(!1), [U, L] = K(""), [S, H] = K(null), N = P(() => l ? xe(l, {
464
+ }), [k, j] = M(!1), [U, L] = M(""), [S, H] = M(null), N = q(() => l ? xe(l, {
465
465
  uiSchema: i,
466
466
  // Inject the structured array editor (avoids an import cycle in the converter).
467
467
  renderArrayField: (E, g, x, R) => /* @__PURE__ */ e(
@@ -474,17 +474,17 @@ const de = ee(
474
474
  readOnly: F
475
475
  }
476
476
  )
477
- }) : o ? Ce(o, { uiSchema: i }) : [], [l, o, i, F]), q = P(() => {
477
+ }) : o ? Ce(o, { uiSchema: i }) : [], [l, o, i, F]), P = q(() => {
478
478
  const E = l ? Ie(I, l) : o ? yt(o, I) : [];
479
- if (D != null && D.length) {
480
- const g = Ee(D, I).filter((x) => x.severity === "error").map((x) => ({ field: x.field, message: x.message }));
479
+ if (K != null && K.length) {
480
+ const g = Ee(K, I).filter((x) => x.severity === "error").map((x) => ({ field: x.field, message: x.message }));
481
481
  return [...E, ...g];
482
482
  }
483
483
  return E;
484
- }, [l, o, I, D]);
484
+ }, [l, o, I, K]);
485
485
  oe(() => {
486
- p == null || p(q);
487
- }, [q, p]), oe(() => {
486
+ p == null || p(P);
487
+ }, [P, p]), oe(() => {
488
488
  if (k)
489
489
  try {
490
490
  L(JSON.stringify(I, null, 2)), H(null);
@@ -503,20 +503,20 @@ const de = ee(
503
503
  type: "button",
504
504
  className: "nice-schema-form__tab" + (k ? "" : " nice-schema-form__tab--active"),
505
505
  onClick: () => j(!1),
506
- children: M("schemaForm.tab.form", "Form")
506
+ children: D("schemaForm.tab.form", "Form")
507
507
  }
508
508
  ),
509
509
  /* @__PURE__ */ e(
510
510
  X,
511
511
  {
512
- content: M("schemaForm.tab.json.help", "Edit the raw JSON value directly"),
512
+ content: D("schemaForm.tab.json.help", "Edit the raw JSON value directly"),
513
513
  children: /* @__PURE__ */ e(
514
514
  "button",
515
515
  {
516
516
  type: "button",
517
517
  className: "nice-schema-form__tab" + (k ? " nice-schema-form__tab--active" : ""),
518
518
  onClick: () => j(!0),
519
- children: M("schemaForm.tab.json", "JSON")
519
+ children: D("schemaForm.tab.json", "JSON")
520
520
  }
521
521
  )
522
522
  }
@@ -540,7 +540,7 @@ const de = ee(
540
540
  H(null), v(x);
541
541
  } catch (x) {
542
542
  H(
543
- x instanceof Error ? x.message : M("schemaForm.invalidJson", "Invalid JSON")
543
+ x instanceof Error ? x.message : D("schemaForm.invalidJson", "Invalid JSON")
544
544
  );
545
545
  }
546
546
  }
@@ -558,7 +558,7 @@ const de = ee(
558
558
  readOnly: F
559
559
  }
560
560
  ),
561
- O && q.length > 0 && /* @__PURE__ */ e("ul", { className: "nice-schema-form__errors", role: "alert", children: q.map((E, g) => /* @__PURE__ */ e("li", { className: "nice-schema-form__error", children: E.message }, `${E.field}-${g}`)) })
561
+ O && P.length > 0 && /* @__PURE__ */ e("ul", { className: "nice-schema-form__errors", role: "alert", children: P.map((E, g) => /* @__PURE__ */ e("li", { className: "nice-schema-form__error", children: E.message }, `${E.field}-${g}`)) })
562
562
  ] });
563
563
  }
564
564
  ), gt = [
@@ -635,236 +635,230 @@ function vt(t) {
635
635
  };
636
636
  });
637
637
  }
638
- const Ut = ee(
639
- function(r, a) {
640
- const {
641
- enableAI: l = !0,
642
- aiModel: o,
643
- enableGenerate: i = !0,
644
- enableSuggestions: n = !0,
645
- onGenerate: c,
646
- showAIToolbar: f = !0,
647
- templates: p = gt,
648
- fields: y,
649
- onChange: s
650
- } = r, [h, F] = K(!1), [O, D] = K(""), [A, C] = K([]), [w, $] = K(y || []), [J, M] = K(!1), [I, v] = K({}), { t: k } = ze(), j = Ue(), { generateForm: U, isLoading: L } = He(), S = l && j.isConfigured, H = Q(
651
- async (g) => {
652
- if (!S || !i || !g.trim())
653
- return [];
654
- try {
655
- const x = await U(g);
656
- return C(x), c == null || c(g, x), x;
657
- } catch {
658
- return [];
659
- }
660
- },
661
- [S, i, U, c]
662
- ), N = Q(
663
- (g) => {
664
- const x = vt(g);
665
- $((R) => [...R, ...x]), s == null || s([...w, ...x]), F(!1), C([]), D("");
666
- },
667
- [s]
668
- ), q = Q(() => w, [w]), m = Q(() => {
669
- $([]), s == null || s([]);
670
- }, [s]), _ = (g) => {
671
- D(g.description), M(!1), H(g.description);
672
- };
673
- at(a, () => ({
674
- generateForm: H,
675
- getFields: q,
676
- applyFields: N,
677
- clearFields: m
678
- }));
679
- const E = (g) => ({
680
- text: "edit",
681
- textarea: "file",
682
- number: "hash",
683
- email: "mail",
684
- password: "lock",
685
- phone: "phone",
686
- date: "calendar",
687
- select: "list",
688
- checkbox: "check",
689
- toggle: "settings",
690
- radio: "circle",
691
- file: "paperclip",
692
- rating: "star"
693
- })[g] || "edit";
694
- return /* @__PURE__ */ u("div", { className: "nice-form-builder-ai", "data-testid": r["data-testid"], children: [
695
- f && S && /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__toolbar", children: [
696
- /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__toolbar-left", children: [
697
- /* @__PURE__ */ e("span", { className: "nice-form-builder-ai__badge", children: "AI" }),
698
- L && /* @__PURE__ */ e("span", { className: "nice-form-builder-ai__loading", children: k("formBuilderAI.generating", "Generating...") })
699
- ] }),
700
- /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__toolbar-right", children: [
701
- i && /* @__PURE__ */ u(
638
+ const Gt = /* @__PURE__ */ ee(function(r, a) {
639
+ const {
640
+ enableAI: l = !0,
641
+ aiModel: o,
642
+ enableGenerate: i = !0,
643
+ enableSuggestions: n = !0,
644
+ onGenerate: c,
645
+ showAIToolbar: f = !0,
646
+ templates: p = gt,
647
+ fields: y,
648
+ onChange: s
649
+ } = r, [h, F] = M(!1), [O, K] = M(""), [A, C] = M([]), [w, $] = M(y || []), [J, D] = M(!1), [I, v] = M({}), { t: k } = ze(), j = Ue(), { generateForm: U, isLoading: L } = He(), S = l && j.isConfigured, H = Q(
650
+ async (g) => {
651
+ if (!S || !i || !g.trim())
652
+ return [];
653
+ try {
654
+ const x = await U(g);
655
+ return C(x), c == null || c(g, x), x;
656
+ } catch {
657
+ return [];
658
+ }
659
+ },
660
+ [S, i, U, c]
661
+ ), N = Q(
662
+ (g) => {
663
+ const x = vt(g);
664
+ $((R) => [...R, ...x]), s == null || s([...w, ...x]), F(!1), C([]), K("");
665
+ },
666
+ [s]
667
+ ), P = Q(() => w, [w]), m = Q(() => {
668
+ $([]), s == null || s([]);
669
+ }, [s]), _ = (g) => {
670
+ K(g.description), D(!1), H(g.description);
671
+ };
672
+ at(a, () => ({
673
+ generateForm: H,
674
+ getFields: P,
675
+ applyFields: N,
676
+ clearFields: m
677
+ }));
678
+ const E = (g) => ({
679
+ text: "edit",
680
+ textarea: "file",
681
+ number: "hash",
682
+ email: "mail",
683
+ password: "lock",
684
+ phone: "phone",
685
+ date: "calendar",
686
+ select: "list",
687
+ checkbox: "check",
688
+ toggle: "settings",
689
+ radio: "circle",
690
+ file: "paperclip",
691
+ rating: "star"
692
+ })[g] || "edit";
693
+ return /* @__PURE__ */ u("div", { className: "nice-form-builder-ai", "data-testid": r["data-testid"], children: [
694
+ f && S && /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__toolbar", children: [
695
+ /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__toolbar-left", children: [
696
+ /* @__PURE__ */ e("span", { className: "nice-form-builder-ai__badge", children: "AI" }),
697
+ L && /* @__PURE__ */ e("span", { className: "nice-form-builder-ai__loading", children: k("formBuilderAI.generating", "Generating...") })
698
+ ] }),
699
+ /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__toolbar-right", children: [
700
+ i && /* @__PURE__ */ u(
701
+ "button",
702
+ {
703
+ type: "button",
704
+ className: "nice-form-builder-ai__btn",
705
+ onClick: () => F(!0),
706
+ disabled: L,
707
+ children: [
708
+ /* @__PURE__ */ e(z, { name: "zap", size: "sm" }),
709
+ " ",
710
+ k("formBuilderAI.generateForm", "Generate Form")
711
+ ]
712
+ }
713
+ ),
714
+ /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__templates-dropdown", children: [
715
+ /* @__PURE__ */ u(
702
716
  "button",
703
717
  {
704
718
  type: "button",
705
- className: "nice-form-builder-ai__btn",
706
- onClick: () => F(!0),
707
- disabled: L,
719
+ className: "nice-form-builder-ai__btn nice-form-builder-ai__btn--secondary",
720
+ onClick: () => D(!J),
708
721
  children: [
709
- /* @__PURE__ */ e(z, { name: "zap", size: "sm" }),
722
+ /* @__PURE__ */ e(z, { name: "list", size: "sm" }),
723
+ " ",
724
+ k("formBuilderAI.templates", "Templates"),
710
725
  " ",
711
- k("formBuilderAI.generateForm", "Generate Form")
726
+ /* @__PURE__ */ e(z, { name: "chevron-down", size: "sm" })
712
727
  ]
713
728
  }
714
729
  ),
715
- /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__templates-dropdown", children: [
716
- /* @__PURE__ */ u(
717
- "button",
718
- {
719
- type: "button",
720
- className: "nice-form-builder-ai__btn nice-form-builder-ai__btn--secondary",
721
- onClick: () => M(!J),
722
- children: [
723
- /* @__PURE__ */ e(z, { name: "list", size: "sm" }),
724
- " ",
725
- k("formBuilderAI.templates", "Templates"),
726
- " ",
727
- /* @__PURE__ */ e(z, { name: "chevron-down", size: "sm" })
728
- ]
729
- }
730
- ),
731
- J && /* @__PURE__ */ e("div", { className: "nice-form-builder-ai__templates-menu", children: p.map((g, x) => /* @__PURE__ */ u(
732
- "button",
733
- {
734
- type: "button",
735
- className: "nice-form-builder-ai__template-item",
736
- onClick: () => _(g),
737
- children: [
738
- /* @__PURE__ */ e("span", { className: "nice-form-builder-ai__template-name", children: g.name }),
739
- /* @__PURE__ */ e("span", { className: "nice-form-builder-ai__template-desc", children: g.description })
740
- ]
741
- },
742
- x
743
- )) })
744
- ] })
730
+ J && /* @__PURE__ */ e("div", { className: "nice-form-builder-ai__templates-menu", children: p.map((g, x) => /* @__PURE__ */ u(
731
+ "button",
732
+ {
733
+ type: "button",
734
+ className: "nice-form-builder-ai__template-item",
735
+ onClick: () => _(g),
736
+ children: [
737
+ /* @__PURE__ */ e("span", { className: "nice-form-builder-ai__template-name", children: g.name }),
738
+ /* @__PURE__ */ e("span", { className: "nice-form-builder-ai__template-desc", children: g.description })
739
+ ]
740
+ },
741
+ x
742
+ )) })
745
743
  ] })
746
- ] }),
747
- /* @__PURE__ */ e("div", { className: "nice-form-builder-ai__builder-wrapper", children: /* @__PURE__ */ e(
748
- de,
744
+ ] })
745
+ ] }),
746
+ /* @__PURE__ */ e("div", { className: "nice-form-builder-ai__builder-wrapper", children: /* @__PURE__ */ e(
747
+ de,
748
+ {
749
+ fields: w,
750
+ value: I,
751
+ onChange: v,
752
+ columns: 1
753
+ }
754
+ ) }),
755
+ h && /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel", children: [
756
+ /* @__PURE__ */ e(
757
+ "div",
749
758
  {
750
- fields: w,
751
- value: I,
752
- onChange: v,
753
- columns: 1
759
+ className: "nice-form-builder-ai__panel-overlay",
760
+ onClick: () => F(!1)
754
761
  }
755
- ) }),
756
- h && /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel", children: [
757
- /* @__PURE__ */ e(
758
- "div",
759
- {
760
- className: "nice-form-builder-ai__panel-overlay",
761
- onClick: () => F(!1)
762
- }
763
- ),
764
- /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel-content", children: [
765
- /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel-header", children: [
766
- /* @__PURE__ */ u("h4", { children: [
767
- /* @__PURE__ */ e(z, { name: "zap", size: "sm" }),
768
- " ",
769
- k("formBuilderAI.generateFormTitle", "Generate Form with AI")
770
- ] }),
771
- /* @__PURE__ */ e(
772
- "button",
773
- {
774
- type: "button",
775
- className: "nice-form-builder-ai__panel-close",
776
- onClick: () => {
777
- F(!1), C([]), D("");
778
- },
779
- "aria-label": "Close",
780
- children: /* @__PURE__ */ e(z, { name: "close", size: "sm" })
781
- }
782
- )
783
- ] }),
784
- /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel-body", children: [
785
- /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__prompt-section", children: [
786
- /* @__PURE__ */ e("label", { className: "nice-form-builder-ai__label", children: k("formBuilderAI.describeForm", "Describe the form you want to create:") }),
787
- /* @__PURE__ */ e(
788
- "textarea",
789
- {
790
- className: "nice-form-builder-ai__textarea",
791
- placeholder: k(
792
- "formBuilderAI.promptPlaceholder",
793
- 'e.g., "A contact form with name, email, phone, subject dropdown, and message textarea"'
794
- ),
795
- value: O,
796
- onChange: (g) => D(g.target.value),
797
- rows: 3
798
- }
799
- ),
800
- /* @__PURE__ */ e(
801
- "button",
802
- {
803
- type: "button",
804
- className: "nice-form-builder-ai__generate-btn",
805
- onClick: () => H(O),
806
- disabled: L || !O.trim(),
807
- children: L ? k("formBuilderAI.generating", "Generating...") : k("formBuilderAI.generate", "Generate")
808
- }
809
- )
810
- ] }),
811
- A.length > 0 && /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__preview-section", children: [
812
- /* @__PURE__ */ u("h5", { children: [
813
- k("formBuilderAI.preview", "Preview"),
814
- " (",
815
- A.length,
816
- " ",
817
- k("formBuilderAI.fields", "fields"),
818
- ")"
819
- ] }),
820
- /* @__PURE__ */ e("div", { className: "nice-form-builder-ai__fields-preview", children: A.map((g, x) => /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__field-preview", children: [
821
- /* @__PURE__ */ e("span", { className: "nice-form-builder-ai__field-icon", children: /* @__PURE__ */ e(z, { name: E(g.type), size: "sm" }) }),
822
- /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__field-info", children: [
823
- /* @__PURE__ */ u("span", { className: "nice-form-builder-ai__field-label", children: [
824
- g.label,
825
- g.required && /* @__PURE__ */ e("span", { className: "nice-form-builder-ai__required", children: "*" })
826
- ] }),
827
- /* @__PURE__ */ e("span", { className: "nice-form-builder-ai__field-type", children: g.type })
828
- ] }),
829
- g.options && /* @__PURE__ */ u("span", { className: "nice-form-builder-ai__field-options", children: [
830
- g.options.length,
831
- " options"
832
- ] })
833
- ] }, x)) })
834
- ] })
762
+ ),
763
+ /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel-content", children: [
764
+ /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel-header", children: [
765
+ /* @__PURE__ */ u("h4", { children: [
766
+ /* @__PURE__ */ e(z, { name: "zap", size: "sm" }),
767
+ " ",
768
+ k("formBuilderAI.generateFormTitle", "Generate Form with AI")
835
769
  ] }),
836
- /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel-footer", children: [
837
- /* @__PURE__ */ u(
838
- "button",
770
+ /* @__PURE__ */ e(
771
+ "button",
772
+ {
773
+ type: "button",
774
+ className: "nice-form-builder-ai__panel-close",
775
+ onClick: () => {
776
+ F(!1), C([]), K("");
777
+ },
778
+ "aria-label": k("formBuilderAI.close", "Close"),
779
+ children: /* @__PURE__ */ e(z, { name: "close", size: "sm" })
780
+ }
781
+ )
782
+ ] }),
783
+ /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel-body", children: [
784
+ /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__prompt-section", children: [
785
+ /* @__PURE__ */ e("label", { className: "nice-form-builder-ai__label", children: k("formBuilderAI.describeForm", "Describe the form you want to create:") }),
786
+ /* @__PURE__ */ e(
787
+ "textarea",
839
788
  {
840
- type: "button",
841
- className: "nice-form-builder-ai__apply-btn",
842
- onClick: () => N(A),
843
- disabled: A.length === 0 || L,
844
- children: [
845
- /* @__PURE__ */ e(z, { name: "check", size: "sm" }),
846
- " ",
847
- k("formBuilderAI.addToForm", "Add to Form")
848
- ]
789
+ className: "nice-form-builder-ai__textarea",
790
+ placeholder: k(
791
+ "formBuilderAI.promptPlaceholder",
792
+ 'e.g., "A contact form with name, email, phone, subject dropdown, and message textarea"'
793
+ ),
794
+ value: O,
795
+ onChange: (g) => K(g.target.value),
796
+ rows: 3
849
797
  }
850
798
  ),
851
799
  /* @__PURE__ */ e(
852
800
  "button",
853
801
  {
854
802
  type: "button",
855
- className: "nice-form-builder-ai__cancel-btn",
856
- onClick: () => {
857
- F(!1), C([]), D("");
858
- },
859
- children: k("formBuilderAI.cancel", "Cancel")
803
+ className: "nice-form-builder-ai__generate-btn",
804
+ onClick: () => H(O),
805
+ disabled: L || !O.trim(),
806
+ children: L ? k("formBuilderAI.generating", "Generating...") : k("formBuilderAI.generate", "Generate")
860
807
  }
861
808
  )
809
+ ] }),
810
+ A.length > 0 && /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__preview-section", children: [
811
+ /* @__PURE__ */ e("h5", { children: k("formBuilderAI.previewCount", "Preview ({count} fields)").replace(
812
+ "{count}",
813
+ String(A.length)
814
+ ) }),
815
+ /* @__PURE__ */ e("div", { className: "nice-form-builder-ai__fields-preview", children: A.map((g, x) => /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__field-preview", children: [
816
+ /* @__PURE__ */ e("span", { className: "nice-form-builder-ai__field-icon", children: /* @__PURE__ */ e(z, { name: E(g.type), size: "sm" }) }),
817
+ /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__field-info", children: [
818
+ /* @__PURE__ */ u("span", { className: "nice-form-builder-ai__field-label", children: [
819
+ g.label,
820
+ g.required && /* @__PURE__ */ e("span", { className: "nice-form-builder-ai__required", children: "*" })
821
+ ] }),
822
+ /* @__PURE__ */ e("span", { className: "nice-form-builder-ai__field-type", children: g.type })
823
+ ] }),
824
+ g.options && /* @__PURE__ */ u("span", { className: "nice-form-builder-ai__field-options", children: [
825
+ g.options.length,
826
+ " options"
827
+ ] })
828
+ ] }, x)) })
862
829
  ] })
830
+ ] }),
831
+ /* @__PURE__ */ u("div", { className: "nice-form-builder-ai__panel-footer", children: [
832
+ /* @__PURE__ */ u(
833
+ "button",
834
+ {
835
+ type: "button",
836
+ className: "nice-form-builder-ai__apply-btn",
837
+ onClick: () => N(A),
838
+ disabled: A.length === 0 || L,
839
+ children: [
840
+ /* @__PURE__ */ e(z, { name: "check", size: "sm" }),
841
+ " ",
842
+ k("formBuilderAI.addToForm", "Add to Form")
843
+ ]
844
+ }
845
+ ),
846
+ /* @__PURE__ */ e(
847
+ "button",
848
+ {
849
+ type: "button",
850
+ className: "nice-form-builder-ai__cancel-btn",
851
+ onClick: () => {
852
+ F(!1), C([]), K("");
853
+ },
854
+ children: k("formBuilderAI.cancel", "Cancel")
855
+ }
856
+ )
863
857
  ] })
864
858
  ] })
865
- ] });
866
- }
867
- ), _t = {
859
+ ] })
860
+ ] });
861
+ }), _t = {
868
862
  text: { type: "string" },
869
863
  textarea: { type: "string" },
870
864
  password: { type: "string", format: "password" },
@@ -929,7 +923,7 @@ function Et(t) {
929
923
  enum: t.options.map((l) => typeof l == "string" ? l : String(l.value))
930
924
  }), Nt(a, t.validations), a;
931
925
  }
932
- function Ht(t) {
926
+ function Wt(t) {
933
927
  const r = {}, a = [], l = (i) => {
934
928
  var n;
935
929
  for (const c of i) {
@@ -979,155 +973,153 @@ const wt = [
979
973
  content: "Each section can be edited as a visual form or as raw JSON — use the toggle inside the section.",
980
974
  placement: "auto"
981
975
  }
982
- ];
983
- function Gt(t) {
976
+ ], kt = [];
977
+ function Yt(t) {
984
978
  return t;
985
979
  }
986
- const Wt = ee(
987
- function(r, a) {
988
- var x;
989
- const {
990
- value: l,
991
- defaultValue: o,
992
- sections: i,
993
- onChange: n,
994
- jsonView: c = !0,
995
- scriptRunner: f,
996
- triggers: p,
997
- bindings: y = [],
998
- handlers: s,
999
- onBindingsChange: h,
1000
- revisions: F,
1001
- onRollback: O,
1002
- loadContent: D,
1003
- logs: A,
1004
- onClearLogs: C,
1005
- extraTabs: w,
1006
- validate: $,
1007
- theme: J = "light",
1008
- height: M = 560,
1009
- tutorial: I,
1010
- className: v,
1011
- style: k,
1012
- id: j,
1013
- "data-testid": U
1014
- } = r, { t: L } = Z(), [S, H] = le({
1015
- value: l,
1016
- defaultValue: o,
1017
- fallbackValue: {},
1018
- onChange: n,
1019
- componentName: "NiceManifestEditor"
1020
- }), N = P(() => {
1021
- const R = i.map((G) => ({
1022
- key: `section:${G.id}`,
1023
- label: G.title,
1024
- icon: G.icon,
1025
- content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(
1026
- de,
1027
- {
1028
- schema: G.schema,
1029
- fields: G.fields,
1030
- uiSchema: G.uiSchema,
1031
- value: S,
1032
- onChange: H,
1033
- showJsonView: c
1034
- }
1035
- ) })
1036
- }));
1037
- return f && R.push({
1038
- key: "scripts",
1039
- label: L("manifestEditor.tab.scripts", "Scripts"),
1040
- content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(we, { ...f }) })
1041
- }), p && p.length > 0 && R.push({
1042
- key: "lifecycle",
1043
- label: L("manifestEditor.tab.lifecycle", "Lifecycle"),
1044
- content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(
1045
- ke,
1046
- {
1047
- triggers: p,
1048
- bindings: y,
1049
- handlers: s,
1050
- onChange: (G) => h == null ? void 0 : h(G),
1051
- groupByTrigger: !0,
1052
- allowCondition: !0
1053
- }
1054
- ) })
1055
- }), F && F.length > 0 && R.push({
1056
- key: "history",
1057
- label: L("manifestEditor.tab.history", "History"),
1058
- content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(
1059
- Se,
1060
- {
1061
- revisions: F,
1062
- onRollback: O,
1063
- loadContent: D,
1064
- language: "json"
1065
- }
1066
- ) })
1067
- }), w && R.push(...w), R;
1068
- }, [
1069
- i,
1070
- S,
1071
- H,
1072
- c,
1073
- f,
1074
- p,
1075
- y,
1076
- s,
1077
- h,
1078
- F,
1079
- O,
1080
- D,
1081
- w,
1082
- L
1083
- ]), [q, m] = K(((x = N[0]) == null ? void 0 : x.key) ?? "");
1084
- oe(() => {
1085
- N.length > 0 && !N.some((R) => R.key === q) && m(N[0].key);
1086
- }, [N, q]);
1087
- const _ = P(() => $ ? $(S) : [], [$, S]), E = P(() => {
1088
- const R = [
980
+ const Qt = /* @__PURE__ */ ee(function(r, a) {
981
+ var x;
982
+ const {
983
+ value: l,
984
+ defaultValue: o,
985
+ sections: i = kt,
986
+ onChange: n,
987
+ jsonView: c = !0,
988
+ scriptRunner: f,
989
+ triggers: p,
990
+ bindings: y = [],
991
+ handlers: s,
992
+ onBindingsChange: h,
993
+ revisions: F,
994
+ onRollback: O,
995
+ loadContent: K,
996
+ logs: A,
997
+ onClearLogs: C,
998
+ extraTabs: w,
999
+ validate: $,
1000
+ theme: J = "light",
1001
+ height: D = 560,
1002
+ tutorial: I,
1003
+ className: v,
1004
+ style: k,
1005
+ id: j,
1006
+ "data-testid": U
1007
+ } = r, { t: L } = Z(), [S, H] = le({
1008
+ value: l,
1009
+ defaultValue: o,
1010
+ fallbackValue: {},
1011
+ onChange: n,
1012
+ componentName: "NiceManifestEditor"
1013
+ }), N = q(() => {
1014
+ const R = i.map((G) => ({
1015
+ key: `section:${G.id}`,
1016
+ label: G.title,
1017
+ icon: G.icon,
1018
+ content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(
1019
+ de,
1089
1020
  {
1090
- key: "sections",
1091
- label: `${i.length} ${L("manifestEditor.sections", "sections")}`,
1092
- position: "left"
1021
+ schema: G.schema,
1022
+ fields: G.fields,
1023
+ uiSchema: G.uiSchema,
1024
+ value: S,
1025
+ onChange: H,
1026
+ showJsonView: c
1093
1027
  }
1094
- ];
1095
- return $ && R.push({
1096
- key: "validation",
1097
- label: /* @__PURE__ */ u("span", { className: "nice-manifest-editor__status", children: [
1098
- /* @__PURE__ */ e(z, { name: _.length === 0 ? "check" : "warning", size: 12 }),
1099
- _.length === 0 ? L("manifestEditor.status.valid", "Valid") : `${_.length} ${L("manifestEditor.status.issues", "issues")}`
1100
- ] }),
1101
- position: "left"
1102
- }), R;
1103
- }, [i.length, $, _.length, L]), g = "nice-manifest-editor" + (v ? ` ${v}` : "");
1104
- return /* @__PURE__ */ e(
1105
- Te,
1028
+ ) })
1029
+ }));
1030
+ return f && R.push({
1031
+ key: "scripts",
1032
+ label: L("manifestEditor.tab.scripts", "Scripts"),
1033
+ content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(we, { ...f }) })
1034
+ }), p && p.length > 0 && R.push({
1035
+ key: "lifecycle",
1036
+ label: L("manifestEditor.tab.lifecycle", "Lifecycle"),
1037
+ content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(
1038
+ ke,
1039
+ {
1040
+ triggers: p,
1041
+ bindings: y,
1042
+ handlers: s,
1043
+ onChange: (G) => h == null ? void 0 : h(G),
1044
+ groupByTrigger: !0,
1045
+ allowCondition: !0
1046
+ }
1047
+ ) })
1048
+ }), F && F.length > 0 && R.push({
1049
+ key: "history",
1050
+ label: L("manifestEditor.tab.history", "History"),
1051
+ content: /* @__PURE__ */ e("div", { className: "nice-manifest-editor__pane", children: /* @__PURE__ */ e(
1052
+ Se,
1053
+ {
1054
+ revisions: F,
1055
+ onRollback: O,
1056
+ loadContent: K,
1057
+ language: "json"
1058
+ }
1059
+ ) })
1060
+ }), w && R.push(...w), R;
1061
+ }, [
1062
+ i,
1063
+ S,
1064
+ H,
1065
+ c,
1066
+ f,
1067
+ p,
1068
+ y,
1069
+ s,
1070
+ h,
1071
+ F,
1072
+ O,
1073
+ K,
1074
+ w,
1075
+ L
1076
+ ]), [P, m] = M(((x = N[0]) == null ? void 0 : x.key) ?? "");
1077
+ oe(() => {
1078
+ N.length > 0 && !N.some((R) => R.key === P) && m(N[0].key);
1079
+ }, [N, P]);
1080
+ const _ = q(() => $ ? $(S) : [], [$, S]), E = q(() => {
1081
+ const R = [
1106
1082
  {
1107
- ref: a,
1108
- id: j,
1109
- className: g,
1110
- style: { height: M, ...k },
1111
- "data-testid": U,
1112
- theme: J,
1113
- tabs: N,
1114
- activeTabKey: q,
1115
- onTabChange: m,
1116
- statusItems: E,
1117
- toolbar: I ? /* @__PURE__ */ e(se, { steps: ce(I, wt) }) : void 0,
1118
- bottomPanel: A !== void 0 ? /* @__PURE__ */ e(
1119
- Fe,
1120
- {
1121
- title: L("manifestEditor.output", "Output"),
1122
- entries: A,
1123
- onClear: C,
1124
- maxHeight: "100%"
1125
- }
1126
- ) : void 0
1083
+ key: "sections",
1084
+ label: `${i.length} ${L("manifestEditor.sections", "sections")}`,
1085
+ position: "left"
1127
1086
  }
1128
- );
1129
- }
1130
- ), me = "__eeRid", pe = "__eeFid", kt = [
1087
+ ];
1088
+ return $ && R.push({
1089
+ key: "validation",
1090
+ label: /* @__PURE__ */ u("span", { className: "nice-manifest-editor__status", children: [
1091
+ /* @__PURE__ */ e(z, { name: _.length === 0 ? "check" : "warning", size: 12 }),
1092
+ _.length === 0 ? L("manifestEditor.status.valid", "Valid") : `${_.length} ${L("manifestEditor.status.issues", "issues")}`
1093
+ ] }),
1094
+ position: "left"
1095
+ }), R;
1096
+ }, [i.length, $, _.length, L]), g = "nice-manifest-editor" + (v ? ` ${v}` : "");
1097
+ return /* @__PURE__ */ e(
1098
+ Te,
1099
+ {
1100
+ ref: a,
1101
+ id: j,
1102
+ className: g,
1103
+ style: { height: D, ...k },
1104
+ "data-testid": U,
1105
+ theme: J,
1106
+ tabs: N,
1107
+ activeTabKey: P,
1108
+ onTabChange: m,
1109
+ statusItems: E,
1110
+ toolbar: I ? /* @__PURE__ */ e(se, { steps: ce(I, wt) }) : void 0,
1111
+ bottomPanel: A !== void 0 ? /* @__PURE__ */ e(
1112
+ Fe,
1113
+ {
1114
+ title: L("manifestEditor.output", "Output"),
1115
+ entries: A,
1116
+ onClear: C,
1117
+ maxHeight: "100%"
1118
+ }
1119
+ ) : void 0
1120
+ }
1121
+ );
1122
+ }), me = "__eeRid", pe = "__eeFid", St = [
1131
1123
  {
1132
1124
  target: ".nice-entity-editor",
1133
1125
  titleKey: "tutorial.entityEditor.intro.title",
@@ -1136,7 +1128,7 @@ const Wt = ee(
1136
1128
  content: "Browse your entities in the list, then click one (or “New entity”) to edit its metadata, fields and validation on a dedicated screen.",
1137
1129
  placement: "auto"
1138
1130
  }
1139
- ], St = {
1131
+ ], Tt = {
1140
1132
  type: "object",
1141
1133
  properties: {
1142
1134
  name: {
@@ -1177,7 +1169,7 @@ const Wt = ee(
1177
1169
  }
1178
1170
  },
1179
1171
  required: ["name"]
1180
- }, Tt = {
1172
+ }, Ft = {
1181
1173
  type: "object",
1182
1174
  properties: {
1183
1175
  name: {
@@ -1273,7 +1265,7 @@ function he({ title: t, help: r }) {
1273
1265
  r ? /* @__PURE__ */ e(X, { content: r, children: /* @__PURE__ */ e("span", { className: "nice-entity-editor__help", role: "img", "aria-label": r, children: /* @__PURE__ */ e(z, { name: "info", size: 14 }) }) }) : null
1274
1266
  ] });
1275
1267
  }
1276
- function Ft({
1268
+ function xt({
1277
1269
  schema: t,
1278
1270
  value: r,
1279
1271
  onChange: a,
@@ -1327,13 +1319,13 @@ function Ft({
1327
1319
  ] }, i);
1328
1320
  }) });
1329
1321
  }
1330
- function xt({
1322
+ function Ct({
1331
1323
  fields: t,
1332
1324
  onChange: r,
1333
1325
  fieldSchema: a,
1334
1326
  readOnly: l
1335
1327
  }) {
1336
- const { t: o } = Z(), [i, n] = K(null), c = P(() => t.map((s, h) => ({ ...s, [pe]: String(h) })), [t]), f = P(
1328
+ const { t: o } = Z(), [i, n] = M(null), c = q(() => t.map((s, h) => ({ ...s, [pe]: String(h) })), [t]), f = q(
1337
1329
  () => [
1338
1330
  {
1339
1331
  field: "name",
@@ -1372,14 +1364,14 @@ function xt({
1372
1364
  "secondary"
1373
1365
  ]
1374
1366
  ];
1375
- return /* @__PURE__ */ e("span", { className: "nice-entity-editor__flags", children: F.filter(([O]) => O).map(([, O, D, A]) => /* @__PURE__ */ e(X, { content: D, children: /* @__PURE__ */ e(ae, { variant: A, size: "sm", children: O }) }, O)) });
1367
+ return /* @__PURE__ */ e("span", { className: "nice-entity-editor__flags", children: F.filter(([O]) => O).map(([, O, K, A]) => /* @__PURE__ */ e(X, { content: K, children: /* @__PURE__ */ e(ae, { variant: A, size: "sm", children: O }) }, O)) });
1376
1368
  }
1377
1369
  }
1378
1370
  ],
1379
1371
  // eslint-disable-next-line react-hooks/exhaustive-deps
1380
1372
  []
1381
1373
  ), p = (s, h, F) => {
1382
- r(t.map((O, D) => D === s ? { ...O, [h]: F } : O));
1374
+ r(t.map((O, K) => K === s ? { ...O, [h]: F } : O));
1383
1375
  }, y = () => {
1384
1376
  const s = [...t, { name: `field${t.length + 1}`, dataType: "string" }];
1385
1377
  r(s), n(s.length - 1);
@@ -1402,7 +1394,7 @@ function xt({
1402
1394
  /* @__PURE__ */ e("span", { className: "nice-entity-editor__edit-title", children: String(s.name ?? o("entityEditor.field.untitled", "New field")) })
1403
1395
  ] }),
1404
1396
  /* @__PURE__ */ e(
1405
- Ft,
1397
+ xt,
1406
1398
  {
1407
1399
  schema: a,
1408
1400
  value: s,
@@ -1439,14 +1431,14 @@ function xt({
1439
1431
  }
1440
1432
  );
1441
1433
  }
1442
- const Ct = ee(
1434
+ const It = /* @__PURE__ */ ee(
1443
1435
  function(r, a) {
1444
1436
  const {
1445
1437
  value: l,
1446
1438
  defaultValue: o,
1447
1439
  onChange: i,
1448
- entityMetaSchema: n = St,
1449
- fieldSchema: c = Tt,
1440
+ entityMetaSchema: n = Tt,
1441
+ fieldSchema: c = Ft,
1450
1442
  fieldsKey: f = "fields",
1451
1443
  validationsKey: p = "validations",
1452
1444
  nameKey: y = "name",
@@ -1454,7 +1446,7 @@ const Ct = ee(
1454
1446
  readOnly: h = !1,
1455
1447
  tutorial: F,
1456
1448
  className: O,
1457
- style: D,
1449
+ style: K,
1458
1450
  id: A,
1459
1451
  "data-testid": C
1460
1452
  } = r, { t: w } = Z(), [$, J] = le({
@@ -1463,10 +1455,10 @@ const Ct = ee(
1463
1455
  fallbackValue: [],
1464
1456
  onChange: i,
1465
1457
  componentName: "NiceEntityEditor"
1466
- }), [M, I] = K("list"), [v, k] = K(0), [j, U] = K("general"), L = Math.min(v, Math.max(0, $.length - 1)), S = $[L], H = M === "edit" && S != null, N = P(() => {
1458
+ }), [D, I] = M("list"), [v, k] = M(0), [j, U] = M("general"), L = Math.min(v, Math.max(0, $.length - 1)), S = $[L], H = D === "edit" && S != null, N = q(() => {
1467
1459
  const T = S == null ? void 0 : S[f];
1468
1460
  return Array.isArray(T) ? T : [];
1469
- }, [S, f]), q = P(() => {
1461
+ }, [S, f]), P = q(() => {
1470
1462
  const T = (B) => {
1471
1463
  const Y = B.toLowerCase();
1472
1464
  return /(int|long|decimal|double|float|number|money)/.test(Y) ? "number" : /bool/.test(Y) ? "boolean" : /date|time/.test(Y) ? "date" : "string";
@@ -1480,10 +1472,10 @@ const Ct = ee(
1480
1472
  });
1481
1473
  }
1482
1474
  return V;
1483
- }, [N]), m = P(() => {
1475
+ }, [N]), m = q(() => {
1484
1476
  const T = S == null ? void 0 : S[p];
1485
1477
  return Array.isArray(T) ? T : [];
1486
- }, [S, p]), _ = P(() => $.map((T, V) => ({ ...T, [me]: String(V) })), [$]), E = (T) => {
1478
+ }, [S, p]), _ = q(() => $.map((T, V) => ({ ...T, [me]: String(V) })), [$]), E = (T) => {
1487
1479
  J($.map((V, B) => B === L ? { ...V, ...T } : V));
1488
1480
  }, g = (T) => {
1489
1481
  E({ [f]: T });
@@ -1494,7 +1486,7 @@ const Ct = ee(
1494
1486
  J(T), k(T.length - 1), U("general"), I("edit");
1495
1487
  }, G = (T) => {
1496
1488
  J($.filter((V, B) => B !== T)), k((V) => V >= T ? Math.max(0, V - 1) : V);
1497
- }, re = P(
1489
+ }, re = q(
1498
1490
  () => [
1499
1491
  {
1500
1492
  field: y,
@@ -1553,7 +1545,7 @@ const Ct = ee(
1553
1545
  ],
1554
1546
  // eslint-disable-next-line react-hooks/exhaustive-deps
1555
1547
  [y, f]
1556
- ), W = P(() => {
1548
+ ), W = q(() => {
1557
1549
  const T = [
1558
1550
  {
1559
1551
  id: "general",
@@ -1575,7 +1567,7 @@ const Ct = ee(
1575
1567
  label: w("entityEditor.tab.fields", "Fields"),
1576
1568
  badge: N.length || void 0,
1577
1569
  content: /* @__PURE__ */ e(
1578
- xt,
1570
+ Ct,
1579
1571
  {
1580
1572
  fields: N,
1581
1573
  onChange: g,
@@ -1591,7 +1583,7 @@ const Ct = ee(
1591
1583
  content: /* @__PURE__ */ e(
1592
1584
  Ge,
1593
1585
  {
1594
- fields: q,
1586
+ fields: P,
1595
1587
  value: m,
1596
1588
  onChange: (V) => E({ [p]: V })
1597
1589
  }
@@ -1607,15 +1599,15 @@ const Ct = ee(
1607
1599
  S,
1608
1600
  N,
1609
1601
  m,
1610
- q,
1602
+ P,
1611
1603
  n,
1612
1604
  c,
1613
1605
  h,
1614
1606
  s,
1615
1607
  $
1616
1608
  ]), ie = "nice-entity-editor" + (O ? ` ${O}` : "");
1617
- return /* @__PURE__ */ u("div", { ref: a, id: A, className: ie, style: D, "data-testid": C, children: [
1618
- F && /* @__PURE__ */ e("div", { className: "nice-entity-editor__tutorial", children: /* @__PURE__ */ e(se, { steps: ce(F, kt) }) }),
1609
+ return /* @__PURE__ */ u("div", { ref: a, id: A, className: ie, style: K, "data-testid": C, children: [
1610
+ F && /* @__PURE__ */ e("div", { className: "nice-entity-editor__tutorial", children: /* @__PURE__ */ e(se, { steps: ce(F, St) }) }),
1619
1611
  H ? /* @__PURE__ */ u("div", { className: "nice-entity-editor__edit", children: [
1620
1612
  /* @__PURE__ */ u("header", { className: "nice-entity-editor__edit-header", children: [
1621
1613
  /* @__PURE__ */ e(X, { content: w("entityEditor.backHint", "Back to the entity list"), children: /* @__PURE__ */ e(
@@ -1679,7 +1671,7 @@ const Ct = ee(
1679
1671
  ) })
1680
1672
  ] });
1681
1673
  }
1682
- ), It = [
1674
+ ), At = [
1683
1675
  {
1684
1676
  target: ".nice-i18n-editor",
1685
1677
  titleKey: "tutorial.i18nEditor.intro.title",
@@ -1704,7 +1696,7 @@ const Ct = ee(
1704
1696
  content: "Add a new translation key or a new locale column here; new cells start empty and are flagged as missing.",
1705
1697
  placement: "top"
1706
1698
  }
1707
- ], At = ee(
1699
+ ], $t = /* @__PURE__ */ ee(
1708
1700
  function(r, a) {
1709
1701
  const {
1710
1702
  value: l,
@@ -1719,14 +1711,14 @@ const Ct = ee(
1719
1711
  className: h,
1720
1712
  style: F,
1721
1713
  id: O,
1722
- "data-testid": D
1714
+ "data-testid": K
1723
1715
  } = r, { t: A } = ot(), [C, w] = rt({
1724
1716
  value: l,
1725
1717
  defaultValue: o,
1726
1718
  fallbackValue: {},
1727
1719
  onChange: i,
1728
1720
  componentName: "NiceI18nEditor"
1729
- }), [$, J] = K(""), [M, I] = K(""), v = P(() => n ?? Object.keys(C), [n, C]), k = P(() => {
1721
+ }), [$, J] = M(""), [D, I] = M(""), v = q(() => n ?? Object.keys(C), [n, C]), k = q(() => {
1730
1722
  const m = /* @__PURE__ */ new Set();
1731
1723
  for (const _ of Object.keys(C))
1732
1724
  for (const E of Object.keys(C[_] ?? {}))
@@ -1761,7 +1753,7 @@ const Ct = ee(
1761
1753
  _[E] || (_[E] = C[E]);
1762
1754
  w(_), J("");
1763
1755
  }, H = () => {
1764
- const m = M.trim();
1756
+ const m = D.trim();
1765
1757
  if (!m || C[m])
1766
1758
  return;
1767
1759
  const _ = {};
@@ -1771,9 +1763,9 @@ const Ct = ee(
1771
1763
  }, N = (m) => {
1772
1764
  const _ = { ...C };
1773
1765
  delete _[m], w(_);
1774
- }, q = "nice-i18n-editor" + (h ? ` ${h}` : "");
1775
- return /* @__PURE__ */ u("div", { ref: a, id: O, className: q, style: F, "data-testid": D, children: [
1776
- s && /* @__PURE__ */ e("div", { className: "nice-i18n-editor__tutorial", children: /* @__PURE__ */ e(lt, { steps: st(s, It) }) }),
1766
+ }, P = "nice-i18n-editor" + (h ? ` ${h}` : "");
1767
+ return /* @__PURE__ */ u("div", { ref: a, id: O, className: P, style: F, "data-testid": K, children: [
1768
+ s && /* @__PURE__ */ e("div", { className: "nice-i18n-editor__tutorial", children: /* @__PURE__ */ e(lt, { steps: st(s, At) }) }),
1777
1769
  /* @__PURE__ */ e("div", { className: "nice-i18n-editor__scroll", "data-tour": "i18n-grid", children: /* @__PURE__ */ u("table", { className: "nice-i18n-editor__table", children: [
1778
1770
  /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ u("tr", { children: [
1779
1771
  /* @__PURE__ */ e("th", { className: "nice-i18n-editor__key-head", children: A("i18nEditor.keyHead", "Key") }),
@@ -1858,7 +1850,7 @@ const Ct = ee(
1858
1850
  {
1859
1851
  className: "nice-i18n-editor__add-input",
1860
1852
  placeholder: A("i18nEditor.newLocalePlaceholder", "locale (e.g. de)"),
1861
- value: M,
1853
+ value: D,
1862
1854
  onChange: (m) => I(m.target.value),
1863
1855
  onKeyDown: (m) => {
1864
1856
  m.key === "Enter" && H();
@@ -1874,7 +1866,7 @@ const Ct = ee(
1874
1866
  ] })
1875
1867
  ] });
1876
1868
  }
1877
- ), $t = [
1869
+ ), Mt = [
1878
1870
  {
1879
1871
  target: ".nice-module-editor",
1880
1872
  titleKey: "tutorial.moduleEditor.intro.title",
@@ -1923,12 +1915,12 @@ const Ct = ee(
1923
1915
  content: "Validation results and load/save activity are logged here.",
1924
1916
  placement: "top"
1925
1917
  }
1926
- ], Yt = ee(
1918
+ ], Ot = [], Xt = /* @__PURE__ */ ee(
1927
1919
  function(r, a) {
1928
1920
  var ge;
1929
1921
  const {
1930
1922
  dataProvider: l,
1931
- manifestSections: o,
1923
+ manifestSections: o = Ot,
1932
1924
  entityConfig: i,
1933
1925
  locales: n,
1934
1926
  validate: c,
@@ -1939,15 +1931,15 @@ const Ct = ee(
1939
1931
  onBindingsChange: h,
1940
1932
  revisions: F,
1941
1933
  onRollback: O,
1942
- loadContent: D,
1934
+ loadContent: K,
1943
1935
  theme: A = "light",
1944
1936
  height: C = 640,
1945
1937
  tutorial: w,
1946
1938
  className: $,
1947
1939
  style: J,
1948
- id: M,
1940
+ id: D,
1949
1941
  "data-testid": I
1950
- } = r, { t: v } = Z(), [k, j] = K([]), [U, L] = K(""), [S, H] = K(null), [N, q] = K(null), [m, _] = K(!1), [E, g] = K(!1), [x, R] = K([]), [G, re] = K(""), W = Q((d, b, je) => {
1942
+ } = r, { t: v } = Z(), [k, j] = M([]), [U, L] = M(""), [S, H] = M(null), [N, P] = M(null), [m, _] = M(!1), [E, g] = M(!1), [x, R] = M([]), [G, re] = M(""), W = Q((d, b, je) => {
1951
1943
  R((Be) => [...Be, { level: d, message: b, data: je, timestamp: Date.now() }].slice(-200));
1952
1944
  }, []), ie = Q(async () => {
1953
1945
  g(!0);
@@ -1967,7 +1959,7 @@ const Ct = ee(
1967
1959
  g(!0);
1968
1960
  try {
1969
1961
  const b = await l.loadModule(d);
1970
- q(b), H(d), _(!1), W("info", `Loaded module ${d}`);
1962
+ P(b), H(d), _(!1), W("info", `Loaded module ${d}`);
1971
1963
  } catch (b) {
1972
1964
  W("error", `Load failed: ${b instanceof Error ? b.message : String(b)}`);
1973
1965
  } finally {
@@ -1986,7 +1978,7 @@ const Ct = ee(
1986
1978
  g(!1);
1987
1979
  }
1988
1980
  }
1989
- }, [S, N, l, W]), B = P(() => {
1981
+ }, [S, N, l, W]), B = q(() => {
1990
1982
  if (!N)
1991
1983
  return [];
1992
1984
  const d = [];
@@ -2002,20 +1994,20 @@ const Ct = ee(
2002
1994
  W("error", `${d.field}: ${d.message}`);
2003
1995
  }
2004
1996
  }, [B, W]), Ae = (d) => {
2005
- q((b) => b && { ...b, manifest: d }), _(!0);
1997
+ P((b) => b && { ...b, manifest: d }), _(!0);
2006
1998
  }, $e = (d) => {
2007
- q((b) => b && { ...b, entities: d }), _(!0);
2008
- }, Ke = (d) => {
2009
- q((b) => b && { ...b, i18n: d }), _(!0);
1999
+ P((b) => b && { ...b, entities: d }), _(!0);
2000
+ }, Me = (d) => {
2001
+ P((b) => b && { ...b, i18n: d }), _(!0);
2010
2002
  }, Oe = (d) => {
2011
- q((b) => b && { ...b, views: d }), _(!0);
2003
+ P((b) => b && { ...b, views: d }), _(!0);
2004
+ }, Ke = (d) => {
2005
+ P((b) => b && { ...b, workflows: d }), _(!0);
2012
2006
  }, De = (d) => {
2013
- q((b) => b && { ...b, workflows: d }), _(!0);
2014
- }, Me = (d) => {
2015
- q((b) => b && { ...b, dataSources: d }), _(!0);
2007
+ P((b) => b && { ...b, dataSources: d }), _(!0);
2016
2008
  }, Le = (d) => {
2017
- q((b) => b && { ...b, rbac: d }), _(!0);
2018
- }, ne = P(() => {
2009
+ P((b) => b && { ...b, rbac: d }), _(!0);
2010
+ }, ne = q(() => {
2019
2011
  if (!N)
2020
2012
  return [];
2021
2013
  const d = o.map((b) => ({
@@ -2038,7 +2030,7 @@ const Ct = ee(
2038
2030
  key: "entities",
2039
2031
  label: v("moduleEditor.tab.entities", "Entities"),
2040
2032
  content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(
2041
- Ct,
2033
+ It,
2042
2034
  {
2043
2035
  value: N.entities ?? [],
2044
2036
  onChange: $e,
@@ -2052,7 +2044,7 @@ const Ct = ee(
2052
2044
  }), d.push({
2053
2045
  key: "i18n",
2054
2046
  label: v("moduleEditor.tab.i18n", "i18n"),
2055
- content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(At, { value: N.i18n ?? {}, onChange: Ke, locales: n }) })
2047
+ content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e($t, { value: N.i18n ?? {}, onChange: Me, locales: n }) })
2056
2048
  }), d.push({
2057
2049
  key: "views",
2058
2050
  label: v("moduleEditor.tab.views", "Views"),
@@ -2067,16 +2059,16 @@ const Ct = ee(
2067
2059
  }), d.push({
2068
2060
  key: "workflows",
2069
2061
  label: v("moduleEditor.tab.workflows", "Workflows"),
2070
- content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(Ot, { workflows: N.workflows ?? [], onChange: De }) })
2062
+ content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(Dt, { workflows: N.workflows ?? [], onChange: Ke }) })
2071
2063
  }), d.push({
2072
2064
  key: "data",
2073
2065
  label: v("moduleEditor.tab.data", "Data"),
2074
2066
  content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(
2075
- Lt,
2067
+ Pt,
2076
2068
  {
2077
2069
  dataSources: N.dataSources ?? [],
2078
- schemas: Dt(N.entities ?? []),
2079
- onChange: Me
2070
+ schemas: Lt(N.entities ?? []),
2071
+ onChange: De
2080
2072
  }
2081
2073
  ) })
2082
2074
  }), d.push({
@@ -2085,7 +2077,7 @@ const Ct = ee(
2085
2077
  content: /* @__PURE__ */ e("div", { className: "nice-module-editor__pane", children: /* @__PURE__ */ e(
2086
2078
  Ze,
2087
2079
  {
2088
- value: N.rbac ?? Mt(N),
2080
+ value: N.rbac ?? Vt(N),
2089
2081
  onChange: Le
2090
2082
  }
2091
2083
  ) })
@@ -2115,7 +2107,7 @@ const Ct = ee(
2115
2107
  {
2116
2108
  revisions: F,
2117
2109
  onRollback: O,
2118
- loadContent: D,
2110
+ loadContent: K,
2119
2111
  language: "json"
2120
2112
  }
2121
2113
  ) })
@@ -2139,12 +2131,12 @@ const Ct = ee(
2139
2131
  oe(() => {
2140
2132
  ne.length > 0 && !ne.some((d) => d.key === G) && re(ne[0].key);
2141
2133
  }, [ne, G]);
2142
- const ye = P(() => {
2134
+ const ye = q(() => {
2143
2135
  const d = U.trim().toLowerCase();
2144
2136
  return d ? k.filter(
2145
2137
  (b) => b.id.toLowerCase().includes(d) || (b.name ?? "").toLowerCase().includes(d) || (b.category ?? "").toLowerCase().includes(d)
2146
2138
  ) : k;
2147
- }, [k, U]), Ve = P(() => {
2139
+ }, [k, U]), Ve = q(() => {
2148
2140
  const d = [];
2149
2141
  return S && d.push({ key: "mod", label: S + (m ? " •" : ""), position: "left" }), d.push({
2150
2142
  key: "val",
@@ -2154,7 +2146,7 @@ const Ct = ee(
2154
2146
  ] }),
2155
2147
  position: "left"
2156
2148
  }), d;
2157
- }, [S, m, B.length, v]), qe = /* @__PURE__ */ u("div", { className: "nice-module-editor__browser", "data-tour": "nme-browser", children: [
2149
+ }, [S, m, B.length, v]), Pe = /* @__PURE__ */ u("div", { className: "nice-module-editor__browser", "data-tour": "nme-browser", children: [
2158
2150
  /* @__PURE__ */ e(
2159
2151
  "input",
2160
2152
  {
@@ -2182,9 +2174,9 @@ const Ct = ee(
2182
2174
  )),
2183
2175
  ye.length === 0 && /* @__PURE__ */ e("div", { className: "nice-module-editor__browser-empty", children: E ? v("moduleEditor.loading", "Loading…") : v("moduleEditor.noModules", "No modules. Open a source first.") })
2184
2176
  ] })
2185
- ] }), Pe = /* @__PURE__ */ u("div", { className: "nice-module-editor__toolbar", children: [
2177
+ ] }), qe = /* @__PURE__ */ u("div", { className: "nice-module-editor__toolbar", children: [
2186
2178
  /* @__PURE__ */ e("strong", { className: "nice-module-editor__title", "data-tour": "nme-tabs", children: S ? ((ge = N == null ? void 0 : N.manifest) == null ? void 0 : ge.packageName) ?? S : v("moduleEditor.title", "Module Editor") }),
2187
- w && /* @__PURE__ */ e(se, { steps: ce(w, $t) }),
2179
+ w && /* @__PURE__ */ e(se, { steps: ce(w, Mt) }),
2188
2180
  /* @__PURE__ */ e("span", { className: "nice-module-editor__spacer" }),
2189
2181
  /* @__PURE__ */ u("button", { type: "button", onClick: () => void ie(), disabled: E, children: [
2190
2182
  /* @__PURE__ */ e(z, { name: "refresh", size: 14 }),
@@ -2212,7 +2204,7 @@ const Ct = ee(
2212
2204
  Te,
2213
2205
  {
2214
2206
  ref: a,
2215
- id: M,
2207
+ id: D,
2216
2208
  className: Re,
2217
2209
  style: { height: C, ...J },
2218
2210
  "data-testid": I,
@@ -2220,8 +2212,8 @@ const Ct = ee(
2220
2212
  tabs: ne,
2221
2213
  activeTabKey: G,
2222
2214
  onTabChange: re,
2223
- toolbar: Pe,
2224
- sidePanel: qe,
2215
+ toolbar: qe,
2216
+ sidePanel: Pe,
2225
2217
  sidePanelWidth: 260,
2226
2218
  statusItems: Ve,
2227
2219
  bottomPanel: /* @__PURE__ */ e("div", { "data-tour": "nme-output", style: { height: "100%" }, children: /* @__PURE__ */ e(
@@ -2244,7 +2236,7 @@ function Kt({
2244
2236
  onChange: a
2245
2237
  }) {
2246
2238
  var y;
2247
- const { t: l } = Z(), [o, i] = K(((y = t[0]) == null ? void 0 : y.id) ?? null), n = t.find((s) => s.id === o) ?? null, c = (s) => {
2239
+ const { t: l } = Z(), [o, i] = M(((y = t[0]) == null ? void 0 : y.id) ?? null), n = t.find((s) => s.id === o) ?? null, c = (s) => {
2248
2240
  a(t.map((h) => h.id === o ? s : h)), s.id !== o && i(s.id);
2249
2241
  }, f = () => {
2250
2242
  const s = {
@@ -2286,12 +2278,12 @@ function Kt({
2286
2278
  ) })
2287
2279
  ] });
2288
2280
  }
2289
- function Ot({
2281
+ function Dt({
2290
2282
  workflows: t,
2291
2283
  onChange: r
2292
2284
  }) {
2293
2285
  var p;
2294
- const { t: a } = Z(), [l, o] = K(((p = t[0]) == null ? void 0 : p.id) ?? null), i = t.find((y) => y.id === l) ?? null, n = (y) => {
2286
+ const { t: a } = Z(), [l, o] = M(((p = t[0]) == null ? void 0 : p.id) ?? null), i = t.find((y) => y.id === l) ?? null, n = (y) => {
2295
2287
  r(t.map((s) => s.id === l ? y : s)), y.id !== l && o(y.id);
2296
2288
  }, c = () => {
2297
2289
  const y = {
@@ -2333,7 +2325,7 @@ function Ot({
2333
2325
  ) })
2334
2326
  ] });
2335
2327
  }
2336
- function Dt(t) {
2328
+ function Lt(t) {
2337
2329
  return t.map((r) => {
2338
2330
  const a = r;
2339
2331
  return {
@@ -2347,7 +2339,7 @@ function Dt(t) {
2347
2339
  };
2348
2340
  });
2349
2341
  }
2350
- function Mt(t) {
2342
+ function Vt(t) {
2351
2343
  const r = t.manifest ?? {}, a = String(r.displayName || r.packageName || "Module"), l = (t.views ?? []).map((i) => ({
2352
2344
  id: `view:${i.id}`,
2353
2345
  label: i.name,
@@ -2381,13 +2373,13 @@ function Mt(t) {
2381
2373
  grants: {}
2382
2374
  };
2383
2375
  }
2384
- function Lt({
2376
+ function Pt({
2385
2377
  dataSources: t,
2386
2378
  schemas: r,
2387
2379
  onChange: a
2388
2380
  }) {
2389
2381
  var y;
2390
- const { t: l } = Z(), [o, i] = K(((y = t[0]) == null ? void 0 : y.key) ?? null), n = t.find((s) => s.key === o) ?? null, c = (s) => {
2382
+ const { t: l } = Z(), [o, i] = M(((y = t[0]) == null ? void 0 : y.key) ?? null), n = t.find((s) => s.key === o) ?? null, c = (s) => {
2391
2383
  a(t.map((h) => h.key === o ? s : h)), s.key !== o && i(s.key);
2392
2384
  }, f = () => {
2393
2385
  const s = {
@@ -2429,18 +2421,18 @@ function Lt({
2429
2421
  }
2430
2422
  export {
2431
2423
  pt as NiceArrayField,
2432
- Ct as NiceEntityEditor,
2433
- Ut as NiceFormBuilderAI,
2434
- At as NiceI18nEditor,
2435
- Wt as NiceManifestEditor,
2436
- Yt as NiceModuleEditor,
2424
+ It as NiceEntityEditor,
2425
+ Gt as NiceFormBuilderAI,
2426
+ $t as NiceI18nEditor,
2427
+ Qt as NiceManifestEditor,
2428
+ Xt as NiceModuleEditor,
2437
2429
  de as NiceSchemaForm,
2438
- Gt as defineManifestSection,
2439
- Bt as formBuilderSchemaToNiceFormItems,
2430
+ Yt as defineManifestSection,
2431
+ Jt as formBuilderSchemaToNiceFormItems,
2440
2432
  Ce as formFieldsToFormItems,
2441
- Ht as formSchemaToJsonSchema,
2433
+ Wt as formSchemaToJsonSchema,
2442
2434
  xe as jsonSchemaToFormItems,
2443
- zt as schemaToFormItems,
2435
+ Ut as schemaToFormItems,
2444
2436
  Ie as validateAgainstJsonSchema,
2445
- Jt as validateFormSchema
2437
+ Ht as validateFormSchema
2446
2438
  };