@nivaro/react 0.2.53 → 0.2.54

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.
Files changed (191) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +1 -1
  3. package/dist/index.d.ts +113 -2
  4. package/dist/layout-editor.d.ts +248 -2
  5. package/dist/shared/components/FormWhatsNew.js +60 -0
  6. package/dist/shared/components/ItemEditForm.js +4058 -3942
  7. package/dist/shared/components/RecordReadView.js +219 -211
  8. package/dist/shared/components/TipLayer.js +27 -27
  9. package/dist/shared/components/help-videos/api.js +51 -41
  10. package/dist/shared/components/help-videos/editor/DetailsTab.js +147 -130
  11. package/dist/shared/components/item-edit/FieldAffordances.js +7 -6
  12. package/dist/shared/components/item-edit/FieldRow.js +353 -304
  13. package/dist/shared/components/item-edit/FormHelpVideoButton.js +59 -0
  14. package/dist/shared/components/item-edit/GroupSection.js +419 -396
  15. package/dist/shared/components/item-edit/HeaderTools.js +59 -56
  16. package/dist/shared/components/item-edit/LayoutContentBlock.js +47 -24
  17. package/dist/shared/components/item-edit/lock-why.js +87 -0
  18. package/dist/shared/components/item-edit/useFormUsageBeacon.js +59 -0
  19. package/dist/shared/components/layout-editor/AddPanel.js +204 -146
  20. package/dist/shared/components/layout-editor/ArrangeButton.js +34 -0
  21. package/dist/shared/components/layout-editor/AutoArrange.js +86 -0
  22. package/dist/shared/components/layout-editor/CanvasCompare.js +79 -0
  23. package/dist/shared/components/layout-editor/ChangeNote.js +146 -0
  24. package/dist/shared/components/layout-editor/CollabParts.js +170 -0
  25. package/dist/shared/components/layout-editor/DesignNode.js +304 -115
  26. package/dist/shared/components/layout-editor/EditorCanvas.js +21 -20
  27. package/dist/shared/components/layout-editor/EditorTopBar.js +452 -175
  28. package/dist/shared/components/layout-editor/FindReplace.js +188 -0
  29. package/dist/shared/components/layout-editor/FormMapButton.js +141 -0
  30. package/dist/shared/components/layout-editor/HistoryPanel.js +234 -109
  31. package/dist/shared/components/layout-editor/LayoutEditor.js +1101 -307
  32. package/dist/shared/components/layout-editor/LayoutsRail.js +94 -67
  33. package/dist/shared/components/layout-editor/NoteMarker.js +38 -0
  34. package/dist/shared/components/layout-editor/PlacementsTable.js +187 -0
  35. package/dist/shared/components/layout-editor/ScheduleChange.js +106 -0
  36. package/dist/shared/components/layout-editor/SessionHistory.js +84 -0
  37. package/dist/shared/components/layout-editor/StructureMenu.js +413 -0
  38. package/dist/shared/components/layout-editor/UnsavedConfirm.js +103 -0
  39. package/dist/shared/components/layout-editor/ai/AiToolsButton.js +625 -0
  40. package/dist/shared/components/layout-editor/ai/ChangeCheck.js +153 -0
  41. package/dist/shared/components/layout-editor/ai/ai-tools-api.js +80 -0
  42. package/dist/shared/components/layout-editor/ai/assist-ops.js +38 -0
  43. package/dist/shared/components/layout-editor/ai/autofill-ops.js +73 -0
  44. package/dist/shared/components/layout-editor/ai/canvas-capture.js +41 -0
  45. package/dist/shared/components/layout-editor/ai-forms/AiComposer.js +271 -0
  46. package/dist/shared/components/layout-editor/ai-forms/AiFormsButton.js +182 -0
  47. package/dist/shared/components/layout-editor/ai-forms/MeaningSuggestions.js +109 -0
  48. package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +170 -0
  49. package/dist/shared/components/layout-editor/ai-forms/ai-forms-api.js +40 -0
  50. package/dist/shared/components/layout-editor/ai-forms/pending.js +25 -0
  51. package/dist/shared/components/layout-editor/ai-forms/plan.js +263 -0
  52. package/dist/shared/components/layout-editor/ai-rules/AiAskPopover.js +160 -0
  53. package/dist/shared/components/layout-editor/ai-rules/CascadeWriter.js +175 -0
  54. package/dist/shared/components/layout-editor/ai-rules/FieldRuleWriter.js +97 -0
  55. package/dist/shared/components/layout-editor/ai-rules/RuleWriter.js +94 -0
  56. package/dist/shared/components/layout-editor/ai-rules/ValidationSuggest.js +153 -0
  57. package/dist/shared/components/layout-editor/ai-rules/api.js +6 -0
  58. package/dist/shared/components/layout-editor/ai-text/AiTextTools.js +383 -0
  59. package/dist/shared/components/layout-editor/ai-text/text-ops.js +125 -0
  60. package/dist/shared/components/layout-editor/assist/AskPanel.js +278 -0
  61. package/dist/shared/components/layout-editor/assist/ExplainDiff.js +93 -0
  62. package/dist/shared/components/layout-editor/assist/ProposalsButton.js +150 -0
  63. package/dist/shared/components/layout-editor/assist/assist-api.js +63 -0
  64. package/dist/shared/components/layout-editor/assist/jump.js +142 -0
  65. package/dist/shared/components/layout-editor/assist/settings-index.js +118 -0
  66. package/dist/shared/components/layout-editor/auto-arrange.js +101 -0
  67. package/dist/shared/components/layout-editor/bulk/BulkChangesButton.js +221 -0
  68. package/dist/shared/components/layout-editor/bulk/BulkRun.js +237 -0
  69. package/dist/shared/components/layout-editor/bulk/MacrosPanel.js +230 -0
  70. package/dist/shared/components/layout-editor/bulk/bulk-api.js +65 -0
  71. package/dist/shared/components/layout-editor/bulk/field-labels.js +22 -0
  72. package/dist/shared/components/layout-editor/bulk/macro-record.js +142 -0
  73. package/dist/shared/components/layout-editor/bulk/useMacroRecorder.js +65 -0
  74. package/dist/shared/components/layout-editor/bundle-to-active.js +1 -0
  75. package/dist/shared/components/layout-editor/canvas-diff.js +157 -0
  76. package/dist/shared/components/layout-editor/collab/FormFollowShare.js +342 -0
  77. package/dist/shared/components/layout-editor/collab/collab-api.js +77 -0
  78. package/dist/shared/components/layout-editor/commands/CommandPalette.js +221 -0
  79. package/dist/shared/components/layout-editor/commands/intents.js +214 -0
  80. package/dist/shared/components/layout-editor/commands/parse.js +242 -0
  81. package/dist/shared/components/layout-editor/design-context.js +26 -6
  82. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +179 -163
  83. package/dist/shared/components/layout-editor/dnd/collision.js +25 -23
  84. package/dist/shared/components/layout-editor/dnd/rail-drop.js +56 -0
  85. package/dist/shared/components/layout-editor/draft-recovery.js +61 -0
  86. package/dist/shared/components/layout-editor/editor-notes.js +78 -0
  87. package/dist/shared/components/layout-editor/editors/swap-config.js +1 -0
  88. package/dist/shared/components/layout-editor/explain/CanvasRules.js +142 -0
  89. package/dist/shared/components/layout-editor/explain/default-ghosts.js +81 -0
  90. package/dist/shared/components/layout-editor/explain/driver-hover.js +62 -0
  91. package/dist/shared/components/layout-editor/explain/field-sources.js +246 -0
  92. package/dist/shared/components/layout-editor/explain/rule-graph.js +215 -0
  93. package/dist/shared/components/layout-editor/explain/use-explain.js +132 -0
  94. package/dist/shared/components/layout-editor/field-zones.js +116 -0
  95. package/dist/shared/components/layout-editor/form-map.js +138 -0
  96. package/dist/shared/components/layout-editor/history-api.js +87 -0
  97. package/dist/shared/components/layout-editor/inheritance.js +55 -0
  98. package/dist/shared/components/layout-editor/inspect/inspect-api.js +66 -0
  99. package/dist/shared/components/layout-editor/inspect/picker-preview.js +48 -0
  100. package/dist/shared/components/layout-editor/inspect/width-fit.js +87 -0
  101. package/dist/shared/components/layout-editor/inspector/AiFillSetting.js +85 -0
  102. package/dist/shared/components/layout-editor/inspector/Breadcrumb.js +36 -0
  103. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +175 -0
  104. package/dist/shared/components/layout-editor/inspector/ColumnFit.js +112 -0
  105. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +146 -92
  106. package/dist/shared/components/layout-editor/inspector/HelpTab.js +174 -0
  107. package/dist/shared/components/layout-editor/inspector/Inspector.js +256 -175
  108. package/dist/shared/components/layout-editor/inspector/LookTab.js +46 -40
  109. package/dist/shared/components/layout-editor/inspector/OverrideNotice.js +61 -0
  110. package/dist/shared/components/layout-editor/inspector/PickerPreview.js +134 -0
  111. package/dist/shared/components/layout-editor/inspector/PickerTab.js +167 -141
  112. package/dist/shared/components/layout-editor/inspector/RulesTab.js +175 -128
  113. package/dist/shared/components/layout-editor/inspector/Translations.js +156 -0
  114. package/dist/shared/components/layout-editor/inspector/kit.js +3 -3
  115. package/dist/shared/components/layout-editor/inspector/tab-request.js +21 -0
  116. package/dist/shared/components/layout-editor/is-typing.js +9 -0
  117. package/dist/shared/components/layout-editor/keyboard-move.js +66 -0
  118. package/dist/shared/components/layout-editor/lint/LintPanel.js +190 -0
  119. package/dist/shared/components/layout-editor/lint/lint-api.js +52 -0
  120. package/dist/shared/components/layout-editor/load-error.js +37 -0
  121. package/dist/shared/components/layout-editor/matrix/FieldStateMatrix.js +305 -0
  122. package/dist/shared/components/layout-editor/matrix/MatrixGrid.js +181 -0
  123. package/dist/shared/components/layout-editor/matrix/RoleSectionMatrix.js +147 -0
  124. package/dist/shared/components/layout-editor/matrix/matrix-api.js +48 -0
  125. package/dist/shared/components/layout-editor/matrix/role-matrix.js +36 -0
  126. package/dist/shared/components/layout-editor/matrix/state-matrix.js +145 -0
  127. package/dist/shared/components/layout-editor/nav/FindPanel.js +109 -0
  128. package/dist/shared/components/layout-editor/nav/NavTools.js +114 -0
  129. package/dist/shared/components/layout-editor/nav/OutlinePanel.js +228 -0
  130. package/dist/shared/components/layout-editor/nav/ShortcutSheet.js +31 -0
  131. package/dist/shared/components/layout-editor/nav/find.js +20 -0
  132. package/dist/shared/components/layout-editor/nav/tree.js +142 -0
  133. package/dist/shared/components/layout-editor/nav/useEditorNav.js +101 -0
  134. package/dist/shared/components/layout-editor/nav/view-prefs.js +34 -0
  135. package/dist/shared/components/layout-editor/ops/ChangeRequestsPanel.js +143 -0
  136. package/dist/shared/components/layout-editor/ops/DependencyDiagram.js +179 -0
  137. package/dist/shared/components/layout-editor/ops/LayoutOpsBlocks.js +92 -0
  138. package/dist/shared/components/layout-editor/ops/PromotePanel.js +287 -0
  139. package/dist/shared/components/layout-editor/ops/ops-api.js +122 -0
  140. package/dist/shared/components/layout-editor/overview/OverviewActions.js +15 -3
  141. package/dist/shared/components/layout-editor/overview/describe-conditions.js +18 -14
  142. package/dist/shared/components/layout-editor/overview/overview-api.js +105 -88
  143. package/dist/shared/components/layout-editor/panel-style.js +8 -7
  144. package/dist/shared/components/layout-editor/parity-keys.json.js +4 -0
  145. package/dist/shared/components/layout-editor/pin.js +25 -0
  146. package/dist/shared/components/layout-editor/presence.js +111 -0
  147. package/dist/shared/components/layout-editor/preview/PreviewModes.js +224 -0
  148. package/dist/shared/components/layout-editor/preview/PreviewPanes.js +262 -0
  149. package/dist/shared/components/layout-editor/preview/preview-api.js +57 -0
  150. package/dist/shared/components/layout-editor/preview/preview-model.js +157 -0
  151. package/dist/shared/components/layout-editor/reuse/FieldMapStep.js +70 -0
  152. package/dist/shared/components/layout-editor/reuse/FormMoreMenu.js +127 -0
  153. package/dist/shared/components/layout-editor/reuse/LibraryRows.js +150 -0
  154. package/dist/shared/components/layout-editor/reuse/NewFormStart.js +20 -0
  155. package/dist/shared/components/layout-editor/reuse/SectionReuseActions.js +291 -0
  156. package/dist/shared/components/layout-editor/reuse/field-match.js +77 -0
  157. package/dist/shared/components/layout-editor/reuse/reuse-api.js +73 -0
  158. package/dist/shared/components/layout-editor/reuse/seed.js +13 -0
  159. package/dist/shared/components/layout-editor/reuse/useFormFromRecord.js +43 -0
  160. package/dist/shared/components/layout-editor/reuse/useRailCopy.js +34 -0
  161. package/dist/shared/components/layout-editor/settings/FormSettings.js +123 -103
  162. package/dist/shared/components/layout-editor/settings/InheritanceSection.js +1 -1
  163. package/dist/shared/components/layout-editor/settings/ToolsSection.js +174 -100
  164. package/dist/shared/components/layout-editor/settings/WhoSection.js +136 -100
  165. package/dist/shared/components/layout-editor/settings/controls.js +8 -8
  166. package/dist/shared/components/layout-editor/settings/settings-registry.js +35 -11
  167. package/dist/shared/components/layout-editor/shortcuts.js +88 -0
  168. package/dist/shared/components/layout-editor/show-when.js +35 -0
  169. package/dist/shared/components/layout-editor/slot-names.js +4 -3
  170. package/dist/shared/components/layout-editor/structure-ops.js +399 -0
  171. package/dist/shared/components/layout-editor/testing/CostLimitSetting.js +42 -0
  172. package/dist/shared/components/layout-editor/testing/TestingPanels.js +551 -0
  173. package/dist/shared/components/layout-editor/testing/testing-api.js +67 -0
  174. package/dist/shared/components/layout-editor/testing/testing-model.js +393 -0
  175. package/dist/shared/components/layout-editor/testing/use-record-check.js +44 -0
  176. package/dist/shared/components/layout-editor/toolbar-kit.js +242 -0
  177. package/dist/shared/components/layout-editor/unsaved-marks.js +72 -0
  178. package/dist/shared/components/layout-editor/usage/FillChip.js +27 -0
  179. package/dist/shared/components/layout-editor/usage/UsagePanel.js +158 -0
  180. package/dist/shared/components/layout-editor/usage/suggest-sections.js +55 -0
  181. package/dist/shared/components/layout-editor/usage/usage-api.js +104 -0
  182. package/dist/shared/components/layout-editor/useLayoutDraft.js +573 -307
  183. package/dist/shared/components/support/SuggestFormChange.js +143 -0
  184. package/dist/shared/lib/ai-fill.js +37 -0
  185. package/dist/shared/lib/form-usage-beacon.js +84 -0
  186. package/dist/shared/lib/layout-i18n.js +66 -0
  187. package/dist/shared/lib/layout-lint.js +490 -0
  188. package/dist/shared/lib/layout-ops.js +110 -106
  189. package/dist/shared/lib/screenshot.js +54 -28
  190. package/dist/shared/lib/visible-when.js +34 -0
  191. package/package.json +1 -1
@@ -1,21 +1,24 @@
1
1
  import { jsxs as m, jsx as l } from "react/jsx-runtime";
2
2
  import { InlineDisplaySection as V } from "../editors/inline-display.js";
3
- import { showsNumbers as B, showsDateMode as K, showsInputMask as X } from "./applies.js";
4
- import { useFieldCtx as q } from "./field-context.js";
5
- import { interfaceOptions as z, interfaceLabel as J, currentInterface as Q } from "./interfaces.js";
6
- import { useGlobalValue as f, Setting as n, TextInput as h, Toggle as D, Choice as I, Segmented as b, Section as T, Buffered as Y, DraftInput as g } from "./kit.js";
7
- import { inlineDisplayOf as Z, withInlineDisplay as ee } from "./model.js";
8
- const N = [
3
+ import { AiFillSetting as B } from "./AiFillSetting.js";
4
+ import { showsNumbers as K, showsDateMode as X, showsInputMask as q } from "./applies.js";
5
+ import { ColumnFit as z } from "./ColumnFit.js";
6
+ import { useFieldCtx as J } from "./field-context.js";
7
+ import { interfaceOptions as Q, interfaceLabel as Y, currentInterface as Z } from "./interfaces.js";
8
+ import { useGlobalValue as f, Setting as n, TextInput as h, Toggle as I, Choice as T, Segmented as b, Section as N, Buffered as ee, DraftInput as g } from "./kit.js";
9
+ import { inlineDisplayOf as le, withInlineDisplay as te } from "./model.js";
10
+ import { FieldTranslations as ae } from "./Translations.js";
11
+ const G = [
9
12
  { value: "12", label: "Full" },
10
13
  { value: "6", label: "½" },
11
14
  { value: "4", label: "⅓" },
12
15
  { value: "3", label: "¼" }
13
- ], G = [
16
+ ], _ = [
14
17
  { value: "", label: "Default" },
15
18
  { value: "int", label: "Integer" },
16
19
  { value: "decimal", label: "Decimal" },
17
20
  { value: "currency", label: "Currency" }
18
- ], le = [
21
+ ], oe = [
19
22
  { value: "", label: "None" },
20
23
  { value: "SUM", label: "Sum" },
21
24
  { value: "COUNT", label: "Count" },
@@ -23,10 +26,10 @@ const N = [
23
26
  { value: "MIN", label: "Smallest" },
24
27
  { value: "MAX", label: "Largest" }
25
28
  ], r = (t) => typeof t == "string" ? t : "";
26
- function se() {
27
- var $, O, L, x;
28
- const t = q(), { info: o, ov: s, opts: u, env: _, row: p, globalOptions: c } = t, a = o.label, v = (($ = o.global) == null ? void 0 : $.label) || a, w = s.label === "", H = B(o), M = K(o), A = X(o), U = z(o.abstractType), C = J(o.abstractType, ((O = o.global) == null ? void 0 : O.interface) ?? null) ?? ((L = o.global) != null && L.interface ? "custom input" : null), k = r(s.interface), F = Q(o.abstractType, k) ?? k, y = f("field.format", r(c.format)), P = f("field.currency", r(c.currency)), R = f("field.aggregate", r(c.aggregate)), E = f("field.unit", r(c.unit)), W = f("field.input_mask", r(c.input_mask)), j = Z(p), S = (e) => t.setPlacement(
29
- { input_bindings: ee(p, e) },
29
+ function me() {
30
+ var O, L, x, D;
31
+ const t = J(), { info: o, ov: d, opts: u, env: A, row: p, globalOptions: c } = t, a = o.label, v = ((O = o.global) == null ? void 0 : O.label) || a, w = d.label === "", H = K(o), M = X(o), C = q(o), F = Q(o.abstractType), y = Y(o.abstractType, ((L = o.global) == null ? void 0 : L.interface) ?? null) ?? ((x = o.global) != null && x.interface ? "custom input" : null), k = r(d.interface), U = Z(o.abstractType, k) ?? k, S = f("field.format", r(c.format)), P = f("field.currency", r(c.currency)), R = f("field.aggregate", r(c.aggregate)), E = f("field.unit", r(c.unit)), W = f("field.input_mask", r(c.input_mask)), j = le(p), $ = (e) => t.setPlacement(
32
+ { input_bindings: te(p, e) },
30
33
  `Change what shows under ${a}`,
31
34
  !0
32
35
  );
@@ -41,7 +44,7 @@ function se() {
41
44
  h,
42
45
  {
43
46
  ariaLabel: "Label",
44
- value: w ? "" : r(s.label),
47
+ value: w ? "" : r(d.label),
45
48
  placeholder: v,
46
49
  onChange: (e) => t.setOverride("label", e === "" ? void 0 : e, `Rename ${a}`, !0)
47
50
  }
@@ -49,7 +52,7 @@ function se() {
49
52
  }
50
53
  ),
51
54
  /* @__PURE__ */ l(
52
- D,
55
+ I,
53
56
  {
54
57
  k: "field.label_hidden",
55
58
  label: "Hide the label",
@@ -63,14 +66,14 @@ function se() {
63
66
  }
64
67
  ),
65
68
  /* @__PURE__ */ l(n, { k: "field.interface", label: "Input", effect: "How the field is edited on this form.", children: /* @__PURE__ */ l(
66
- I,
69
+ T,
67
70
  {
68
71
  ariaLabel: "Input",
69
- value: F,
72
+ value: U,
70
73
  unknownLabel: (e) => `Custom input (${e})`,
71
74
  options: [
72
- { value: "", label: C ? `Field's own (${C})` : "Field's own" },
73
- ...U
75
+ { value: "", label: y ? `Field's own (${y})` : "Field's own" },
76
+ ...F
74
77
  ],
75
78
  onChange: (e) => t.setOverride("interface", e || void 0, `Change how ${a} is edited`)
76
79
  }
@@ -79,7 +82,7 @@ function se() {
79
82
  h,
80
83
  {
81
84
  ariaLabel: "Placeholder",
82
- value: r(s.placeholder),
85
+ value: r(d.placeholder),
83
86
  onChange: (e) => t.setOverride(
84
87
  "placeholder",
85
88
  e || void 0,
@@ -92,45 +95,46 @@ function se() {
92
95
  h,
93
96
  {
94
97
  ariaLabel: "Help text",
95
- value: r(s.note),
96
- placeholder: ((x = o.global) == null ? void 0 : x.note) ?? "",
98
+ value: r(d.note),
99
+ placeholder: ((D = o.global) == null ? void 0 : D.note) ?? "",
97
100
  onChange: (e) => t.setOverride("note", e || void 0, `Change the help text of ${a}`, !0)
98
101
  }
99
102
  ) }),
100
103
  /* @__PURE__ */ l(
101
- D,
104
+ I,
102
105
  {
103
106
  k: "field.hidden",
104
107
  label: "Hidden",
105
108
  effect: "Leaves the field off this form; its value is kept.",
106
- checked: s.hidden === !0,
109
+ checked: d.hidden === !0,
107
110
  onChange: (e) => t.setOverride("hidden", e ? !0 : void 0, e ? `Hide ${a}` : `Show ${a}`)
108
111
  }
109
112
  ),
110
- _.layoutType !== "table" && /* @__PURE__ */ l(n, { k: "field.col_span", label: "Width", effect: "Share of the row the field takes.", children: /* @__PURE__ */ l(
113
+ A.layoutType !== "table" && /* @__PURE__ */ l(n, { k: "field.col_span", label: "Width", effect: "Share of the row the field takes.", children: /* @__PURE__ */ l(
111
114
  b,
112
115
  {
113
116
  value: String(p.col_span ?? 12),
114
- options: N,
117
+ options: G,
115
118
  onChange: (e) => {
116
119
  var i;
117
120
  return t.setPlacement(
118
121
  { col_span: e === "12" ? null : Number(e) },
119
- `Set the width of ${a} to ${(i = N.find((d) => d.value === e)) == null ? void 0 : i.label}`
122
+ `Set the width of ${a} to ${(i = G.find((s) => s.value === e)) == null ? void 0 : i.label}`
120
123
  );
121
124
  }
122
125
  }
123
126
  ) }),
124
- o.relKind === "M2O" && o.relatedCollection && /* @__PURE__ */ m(T, { title: "Show under the value", children: [
127
+ /* @__PURE__ */ l(z, {}),
128
+ o.relKind === "M2O" && o.relatedCollection && /* @__PURE__ */ m(N, { title: "Show under the value", children: [
125
129
  /* @__PURE__ */ l("p", { className: "text-[12px] leading-snug text-slate-500 dark:text-muted-foreground", children: "Fields of the picked record shown with it on this form." }),
126
- /* @__PURE__ */ l(Y, { value: j, children: (e, i) => /* @__PURE__ */ l(
130
+ /* @__PURE__ */ l(ee, { value: j, children: (e, i) => /* @__PURE__ */ l(
127
131
  V,
128
132
  {
129
133
  relatedCollection: o.relatedCollection,
130
134
  entries: e.entries,
131
135
  separator: e.separator,
132
- onChange: (d) => S(i({ ...e, entries: d })),
133
- onSeparatorChange: (d) => S(i({ ...e, separator: d }))
136
+ onChange: (s) => $(i({ ...e, entries: s })),
137
+ onSeparatorChange: (s) => $(i({ ...e, separator: s }))
134
138
  }
135
139
  ) })
136
140
  ] }),
@@ -157,7 +161,7 @@ function se() {
157
161
  )
158
162
  }
159
163
  ),
160
- H && /* @__PURE__ */ m(T, { title: "Numbers", children: [
164
+ H && /* @__PURE__ */ m(N, { title: "Numbers", children: [
161
165
  /* @__PURE__ */ l(
162
166
  n,
163
167
  {
@@ -189,15 +193,15 @@ function se() {
189
193
  children: /* @__PURE__ */ l(
190
194
  b,
191
195
  {
192
- value: y,
193
- options: G,
196
+ value: S,
197
+ options: _,
194
198
  onChange: (e) => {
195
199
  var i;
196
200
  return t.proposeGlobalOption(
197
201
  "field.format",
198
202
  "format",
199
203
  e || void 0,
200
- `Show ${a} as ${(i = G.find((d) => d.value === e)) == null ? void 0 : i.label.toLowerCase()}`,
204
+ `Show ${a} as ${(i = _.find((s) => s.value === e)) == null ? void 0 : i.label.toLowerCase()}`,
201
205
  e
202
206
  );
203
207
  }
@@ -205,7 +209,7 @@ function se() {
205
209
  )
206
210
  }
207
211
  ),
208
- y === "currency" && /* @__PURE__ */ l(
212
+ S === "currency" && /* @__PURE__ */ l(
209
213
  n,
210
214
  {
211
215
  k: "field.currency",
@@ -238,11 +242,11 @@ function se() {
238
242
  scope: "field",
239
243
  effect: "The figure under this column wherever it shows in a grid.",
240
244
  children: /* @__PURE__ */ l(
241
- I,
245
+ T,
242
246
  {
243
247
  ariaLabel: "Grid footer",
244
248
  value: R,
245
- options: le,
249
+ options: oe,
246
250
  onChange: (e) => t.proposeGlobalOption(
247
251
  "field.aggregate",
248
252
  "aggregate",
@@ -278,7 +282,7 @@ function se() {
278
282
  }
279
283
  )
280
284
  ] }),
281
- A && /* @__PURE__ */ l(
285
+ C && /* @__PURE__ */ l(
282
286
  n,
283
287
  {
284
288
  k: "field.input_mask",
@@ -302,9 +306,11 @@ function se() {
302
306
  }
303
307
  )
304
308
  }
305
- )
309
+ ),
310
+ C && !o.isPath && !o.computedType && /* @__PURE__ */ l(B, {}),
311
+ /* @__PURE__ */ l(ae, {})
306
312
  ] });
307
313
  }
308
314
  export {
309
- se as LookTab
315
+ me as LookTab
310
316
  };
@@ -0,0 +1,61 @@
1
+ import { jsxs as i, jsx as u } from "react/jsx-runtime";
2
+ import { RotateCcw as h } from "lucide-react";
3
+ import { cn as m } from "../../../lib/utils.js";
4
+ import { resetGroupPlan as g, resetPlacementOps as k } from "../inheritance.js";
5
+ import { tintCard as x } from "../panel-style.js";
6
+ function $({
7
+ bundle: a,
8
+ parent: o,
9
+ target: r,
10
+ title: p,
11
+ apply: c
12
+ }) {
13
+ if (!o) return null;
14
+ const s = String(o.layout.name ?? "the parent layout");
15
+ let t = [], n = null, l = null;
16
+ if (r.kind === "group") {
17
+ if (!o.groups.some((f) => f.key === r.key)) return null;
18
+ const e = g(a, o, r.key);
19
+ e.ok ? (t = e.ops, e.ungrouped.length && (l = `${e.ungrouped.length} ${e.ungrouped.length === 1 ? "field" : "fields"} only this form places will move to Ungrouped.`)) : n = e.why;
20
+ } else {
21
+ if (!o.placements.some((e) => e.field === r.field) || (t = k(a, r.field), t.length === 0)) return null;
22
+ t.length > 1 && (l = `This form places it ${t.length} times; every one goes.`);
23
+ }
24
+ const d = r.kind === "group" ? "section" : "field";
25
+ return /* @__PURE__ */ i("div", { "data-setting": "inspector.override_reset", className: m(x, "mb-3 space-y-2 p-3"), children: [
26
+ /* @__PURE__ */ i("p", { className: "m-0 text-[12px] leading-snug text-slate-700 dark:text-foreground", children: [
27
+ "This ",
28
+ d,
29
+ " overrides ",
30
+ /* @__PURE__ */ u("span", { className: "font-medium", children: s }),
31
+ ": the changes here apply to this form only.",
32
+ l && /* @__PURE__ */ i("span", { className: "text-slate-500 dark:text-muted-foreground", children: [
33
+ " ",
34
+ l
35
+ ] })
36
+ ] }),
37
+ /* @__PURE__ */ i(
38
+ "button",
39
+ {
40
+ type: "button",
41
+ "data-reset-to-parent": "",
42
+ "aria-disabled": n ? !0 : void 0,
43
+ "data-tip": n ?? `Show ${s}'s ${d} here again`,
44
+ onClick: () => {
45
+ !n && t.length && c(t, { label: `Reset ${p} to ${s}` });
46
+ },
47
+ className: m(
48
+ "inline-flex h-7 items-center gap-1.5 rounded-md border border-slate-200 bg-white px-2.5 text-[12px] font-medium text-slate-700 transition-colors dark:border-border dark:bg-background dark:text-foreground",
49
+ n ? "cursor-not-allowed opacity-50" : "hover:bg-slate-50 dark:hover:bg-muted"
50
+ ),
51
+ children: [
52
+ /* @__PURE__ */ u(h, { "aria-hidden": !0, className: "h-3.5 w-3.5" }),
53
+ "Reset to parent"
54
+ ]
55
+ }
56
+ )
57
+ ] });
58
+ }
59
+ export {
60
+ $ as OverrideNotice
61
+ };
@@ -0,0 +1,134 @@
1
+ import { jsxs as i, jsx as r, Fragment as $ } from "react/jsx-runtime";
2
+ import { useQuery as A } from "@tanstack/react-query";
3
+ import { AlertTriangle as J } from "lucide-react";
4
+ import { useState as K } from "react";
5
+ import { useNivaroClient as L } from "../../../context.js";
6
+ import { get as F, post as R } from "../../../lib/commands.js";
7
+ import { cn as W } from "../../../lib/utils.js";
8
+ import { extractTemplateFields as B, renderDisplayTemplate as D } from "../../pipeline/relations.js";
9
+ import { useCollectionBody as E } from "../collection-meta.js";
10
+ import { m2mParents as Q, previewNarrowing as z } from "../inspect/picker-preview.js";
11
+ import { labelText as G, effectText as u, tintCard as H } from "../panel-style.js";
12
+ import { RelationPicker as U } from "../pickers/relation-picker.js";
13
+ import { useFieldCtx as V } from "./field-context.js";
14
+ import { asObject as X, describeField as j } from "./model.js";
15
+ const l = (c) => c.toLocaleString();
16
+ function pe({ rules: c }) {
17
+ const n = V(), { info: k, env: d, opts: p, globalOptions: T } = n, w = L(), a = k.relatedCollection, [s, S] = K(null), { data: h } = E(a), m = a === "nivaro_users" ? "{{first_name}} {{last_name}}" : (h == null ? void 0 : h.display_template) ?? null, y = X(p.option_filter ?? T.option_filter), b = typeof p.option_sort == "string" && p.option_sort && !/^-?label$/.test(p.option_sort) ? p.option_sort : void 0, C = JSON.stringify([c, y, b, m]), x = A({
18
+ queryKey: ["layout-editor", "picker-preview", d.collection, k.field, s, C],
19
+ enabled: !!s && !!a,
20
+ retry: !1,
21
+ staleTime: 3e4,
22
+ queryFn: async () => {
23
+ const t = (await w.request(
24
+ F(`/items/${d.collection}/${s}`, { fields: "*" })
25
+ )).data ?? {}, v = {};
26
+ for (const o of Q(c, d.collection, n.relations)) {
27
+ const g = (await w.request(
28
+ F(`/items/${o.junction}`, {
29
+ filter: JSON.stringify({ [o.parentFk]: { _eq: s } }),
30
+ fields: o.targetFk,
31
+ limit: 200
32
+ })
33
+ )).data ?? [];
34
+ v[o.parent] = g.map((f) => f[o.targetFk]).filter((f) => f != null && typeof f != "object");
35
+ }
36
+ const _ = z({
37
+ target: a,
38
+ rules: c,
39
+ optionFilter: y,
40
+ record: t,
41
+ itemId: String(s),
42
+ linked: v,
43
+ labelOf: (o) => j(
44
+ o,
45
+ n.globals,
46
+ n.relations,
47
+ d.bundle.placements.find((g) => g.field === o) ?? null
48
+ ).label
49
+ }), q = B(m).filter((o) => o !== "*" && o !== "id"), I = await w.request(
50
+ R("/layout-inspect/picker-preview", {
51
+ collection: a,
52
+ steps: _.steps,
53
+ fields: q,
54
+ sort: b
55
+ })
56
+ );
57
+ return { narrowing: _, answer: I.data };
58
+ }
59
+ });
60
+ if (!a) return null;
61
+ const e = x.data, N = x.error, O = (e == null ? void 0 : e.answer.steps) ?? [], P = (t) => (m ? D(m, t) : "") || String(t.id ?? "");
62
+ return /* @__PURE__ */ i("div", { "data-setting": "field.picker_preview", className: "space-y-2", children: [
63
+ /* @__PURE__ */ r("div", { className: "flex min-h-5 items-center justify-between gap-3", children: /* @__PURE__ */ r("span", { className: G, children: "Options for a record" }) }),
64
+ /* @__PURE__ */ r(
65
+ U,
66
+ {
67
+ relatedCollection: d.collection,
68
+ value: s,
69
+ onChange: (t) => S(t == null || t === "" ? null : String(t)),
70
+ placeholder: "Pick a saved record"
71
+ }
72
+ ),
73
+ /* @__PURE__ */ r("p", { "data-effect": "", className: u, children: "What this picker offers on the record you pick, after its cascade filters, option filter and picker exclusions." }),
74
+ s && /* @__PURE__ */ r("div", { "data-picker-preview": "", className: W(H, "space-y-2 p-2.5"), children: x.isLoading ? /* @__PURE__ */ r("p", { className: u, children: "Working out the options…" }) : N ? /* @__PURE__ */ r("p", { className: "text-[12px] text-red-700 dark:text-red-300", children: N.message || "The options could not be worked out." }) : e ? /* @__PURE__ */ i($, { children: [
75
+ /* @__PURE__ */ r(
76
+ "p",
77
+ {
78
+ "data-picker-offered": e.answer.offered,
79
+ className: "text-[13px] font-semibold text-slate-900 dark:text-foreground",
80
+ children: e.answer.offered === 1 ? "1 option" : `${l(e.answer.offered)} options`
81
+ }
82
+ ),
83
+ e.narrowing.waitsFor && /* @__PURE__ */ i("p", { className: "flex items-start gap-1.5 text-[12px] leading-snug text-amber-700 dark:text-amber-300", children: [
84
+ /* @__PURE__ */ r(J, { className: "mt-[2px] h-3 w-3 shrink-0" }),
85
+ "The picker stays disabled on this record until",
86
+ " ",
87
+ j(e.narrowing.waitsFor, n.globals, n.relations, null).label,
88
+ " ",
89
+ "has a value."
90
+ ] }),
91
+ /* @__PURE__ */ i("ol", { className: "space-y-0.5 text-[12px] text-slate-600 dark:text-muted-foreground", children: [
92
+ /* @__PURE__ */ i("li", { className: "flex justify-between gap-2", children: [
93
+ /* @__PURE__ */ r("span", { children: "Every record" }),
94
+ /* @__PURE__ */ r("span", { className: "font-mono", children: l(e.answer.total) })
95
+ ] }),
96
+ O.map((t) => /* @__PURE__ */ i("li", { className: "flex justify-between gap-2", children: [
97
+ /* @__PURE__ */ r("span", { className: "min-w-0 truncate", children: t.label }),
98
+ /* @__PURE__ */ r("span", { className: "shrink-0 font-mono", children: t.applies ? l(t.count) : "no effect" })
99
+ ] }, t.key)),
100
+ e.answer.excluded > 0 && /* @__PURE__ */ i("li", { className: "flex justify-between gap-2", children: [
101
+ /* @__PURE__ */ r("span", { children: "Picker exclusions" }),
102
+ /* @__PURE__ */ i("span", { className: "font-mono", children: [
103
+ "−",
104
+ l(e.answer.excluded)
105
+ ] })
106
+ ] })
107
+ ] }),
108
+ e.answer.picker_filter && e.answer.with_picker_filter != null && /* @__PURE__ */ i("p", { className: u, children: [
109
+ "The picker filter of this collection would leave",
110
+ " ",
111
+ l(e.answer.with_picker_filter),
112
+ ". The record form's picker does not apply it; enforced API writes do."
113
+ ] }),
114
+ e.answer.rows.length > 0 && /* @__PURE__ */ i(
115
+ "ul",
116
+ {
117
+ "data-picker-options": "",
118
+ className: "max-h-48 space-y-0.5 overflow-y-auto border-t border-slate-200/70 pt-1.5 text-[12px] text-slate-800 dark:border-white/[0.07] dark:text-foreground",
119
+ children: [
120
+ e.answer.rows.map((t) => /* @__PURE__ */ r("li", { className: "truncate", children: P(t) }, String(t.id))),
121
+ e.answer.offered > e.answer.rows.length && /* @__PURE__ */ i("li", { className: u, children: [
122
+ "and ",
123
+ l(e.answer.offered - e.answer.rows.length),
124
+ " more"
125
+ ] })
126
+ ]
127
+ }
128
+ )
129
+ ] }) : null })
130
+ ] });
131
+ }
132
+ export {
133
+ pe as PickerPreview
134
+ };