@nivaro/react 0.2.54 → 0.2.55

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 (150) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +99 -98
  3. package/dist/index.d.ts +339 -2
  4. package/dist/index.js +644 -618
  5. package/dist/layout-editor.d.ts +4 -0
  6. package/dist/shared/components/BackgroundRunOffer.js +117 -0
  7. package/dist/shared/components/BroadcastView.js +214 -213
  8. package/dist/shared/components/CollectionBrowserView.js +2592 -2695
  9. package/dist/shared/components/ItemEditForm.js +4066 -3832
  10. package/dist/shared/components/JobsTray.js +100 -55
  11. package/dist/shared/components/MyWorkView.js +91 -89
  12. package/dist/shared/components/NotificationBell.js +80 -79
  13. package/dist/shared/components/ProfileView.js +568 -520
  14. package/dist/shared/components/RecordCompare.js +254 -0
  15. package/dist/shared/components/RecordReadView.js +599 -552
  16. package/dist/shared/components/ReportView.js +578 -543
  17. package/dist/shared/components/RowPresence.js +91 -0
  18. package/dist/shared/components/WidgetSlot.js +474 -458
  19. package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
  20. package/dist/shared/components/ai/AskPanel.js +139 -119
  21. package/dist/shared/components/ai/FirstWeekCard.js +126 -0
  22. package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
  23. package/dist/shared/components/bulk/bulk-field-options.js +45 -0
  24. package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
  25. package/dist/shared/components/chat/ChannelArchive.js +326 -0
  26. package/dist/shared/components/chat/ChannelExtras.js +141 -121
  27. package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
  28. package/dist/shared/components/chat/ChatPanel.js +1695 -1733
  29. package/dist/shared/components/chat/Composer.js +357 -303
  30. package/dist/shared/components/chat/MessageActions.js +92 -0
  31. package/dist/shared/components/chat/MessageFormat.js +290 -264
  32. package/dist/shared/components/chat/OutboxBubbles.js +146 -0
  33. package/dist/shared/components/chat/RequestIdCard.js +135 -0
  34. package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
  35. package/dist/shared/components/chat/RoomParts.js +213 -274
  36. package/dist/shared/components/chat/ScreenClip.js +184 -0
  37. package/dist/shared/components/chat/chat-core.js +402 -483
  38. package/dist/shared/components/chat/chat-drafts.js +59 -0
  39. package/dist/shared/components/chat/chat-emoji.js +348 -0
  40. package/dist/shared/components/chat/chat-local-time.js +41 -0
  41. package/dist/shared/components/chat/chat-outbox.js +303 -0
  42. package/dist/shared/components/chat/chat-window.js +163 -0
  43. package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
  44. package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
  45. package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
  46. package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
  47. package/dist/shared/components/help-videos/api.js +76 -73
  48. package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
  49. package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
  50. package/dist/shared/components/item-edit/FieldAffordances.js +2 -2
  51. package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
  52. package/dist/shared/components/item-edit/FieldRow.js +292 -279
  53. package/dist/shared/components/item-edit/GroupSection.js +698 -574
  54. package/dist/shared/components/item-edit/InlineTableField.js +3 -1
  55. package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
  56. package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
  57. package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
  58. package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
  59. package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
  60. package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
  61. package/dist/shared/components/item-edit/lazy-sections.js +36 -0
  62. package/dist/shared/components/item-edit/lock-why.js +39 -32
  63. package/dist/shared/components/item-edit/picker-miss.js +26 -0
  64. package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
  65. package/dist/shared/components/item-edit/useFormUsageBeacon.js +51 -45
  66. package/dist/shared/components/layout-editor/AddPanel.js +134 -117
  67. package/dist/shared/components/layout-editor/ChangeNote.js +25 -24
  68. package/dist/shared/components/layout-editor/CollabParts.js +80 -75
  69. package/dist/shared/components/layout-editor/DesignNode.js +126 -120
  70. package/dist/shared/components/layout-editor/EditorCanvas.js +30 -27
  71. package/dist/shared/components/layout-editor/EditorTopBar.js +203 -192
  72. package/dist/shared/components/layout-editor/HistoryPanel.js +120 -104
  73. package/dist/shared/components/layout-editor/LayoutEditor.js +768 -671
  74. package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
  75. package/dist/shared/components/layout-editor/StagedChip.js +22 -0
  76. package/dist/shared/components/layout-editor/StructureMenu.js +237 -186
  77. package/dist/shared/components/layout-editor/collab/FormFollowShare.js +149 -103
  78. package/dist/shared/components/layout-editor/collab/collab-api.js +29 -26
  79. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +81 -80
  80. package/dist/shared/components/layout-editor/dnd/node.js +69 -57
  81. package/dist/shared/components/layout-editor/draft-recovery.js +113 -43
  82. package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
  83. package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
  84. package/dist/shared/components/layout-editor/entry/presets.js +71 -0
  85. package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
  86. package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
  87. package/dist/shared/components/layout-editor/grid-guides.js +142 -0
  88. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
  89. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +61 -57
  90. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +247 -151
  91. package/dist/shared/components/layout-editor/inspector/Inspector.js +176 -155
  92. package/dist/shared/components/layout-editor/inspector/LookTab.js +167 -116
  93. package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
  94. package/dist/shared/components/layout-editor/inspector/PickerTab.js +84 -82
  95. package/dist/shared/components/layout-editor/inspector/RulesTab.js +66 -62
  96. package/dist/shared/components/layout-editor/inspector/kit.js +69 -68
  97. package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
  98. package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
  99. package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
  100. package/dist/shared/components/layout-editor/overview/describe-conditions.js +6 -0
  101. package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
  102. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  103. package/dist/shared/components/layout-editor/restore-piece.js +192 -0
  104. package/dist/shared/components/layout-editor/section-structure.js +241 -0
  105. package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
  106. package/dist/shared/components/layout-editor/settings/FormSettings.js +41 -39
  107. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
  108. package/dist/shared/components/layout-editor/settings/ToolsSection.js +147 -111
  109. package/dist/shared/components/layout-editor/settings/WhoSection.js +29 -26
  110. package/dist/shared/components/layout-editor/settings/settings-registry.js +114 -17
  111. package/dist/shared/components/layout-editor/staged-api.js +64 -0
  112. package/dist/shared/components/layout-editor/structure-ops.js +81 -77
  113. package/dist/shared/components/layout-editor/testing/TestingPanels.js +65 -60
  114. package/dist/shared/components/layout-editor/testing/testing-model.js +198 -185
  115. package/dist/shared/components/layout-editor/toolbar-kit.js +11 -11
  116. package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
  117. package/dist/shared/components/layout-editor/usage/UsagePanel.js +144 -70
  118. package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
  119. package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
  120. package/dist/shared/components/layout-editor/useLayoutDraft.js +25 -24
  121. package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
  122. package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
  123. package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
  124. package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
  125. package/dist/shared/components/profile/AgentsPanel.js +479 -0
  126. package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
  127. package/dist/shared/components/support/SupportAnalytics.js +171 -0
  128. package/dist/shared/components/support/SupportView.js +75 -73
  129. package/dist/shared/lib/background-runs.js +150 -0
  130. package/dist/shared/lib/delivery-ack.js +9 -0
  131. package/dist/shared/lib/entry-badge-style.js +13 -0
  132. package/dist/shared/lib/entry-config.js +71 -0
  133. package/dist/shared/lib/form-sections.js +64 -0
  134. package/dist/shared/lib/form-structure.js +99 -0
  135. package/dist/shared/lib/form-usage-beacon.js +101 -52
  136. package/dist/shared/lib/jobs-tray.js +25 -23
  137. package/dist/shared/lib/keyset-pager.js +37 -0
  138. package/dist/shared/lib/layout-ops.js +84 -82
  139. package/dist/shared/lib/layout-resolve.js +113 -0
  140. package/dist/shared/lib/placement-behaviour.js +144 -0
  141. package/dist/shared/lib/prefetch.js +149 -0
  142. package/dist/shared/lib/presence-hooks.js +199 -0
  143. package/dist/shared/lib/record-outbox.js +82 -81
  144. package/dist/shared/lib/replay-socket.js +93 -0
  145. package/dist/shared/lib/request-gate.js +51 -50
  146. package/dist/shared/lib/room-gaps.js +96 -0
  147. package/dist/shared/lib/search-log.js +27 -0
  148. package/dist/shared/lib/socket-realtime.js +101 -80
  149. package/dist/shared/lib/worker-socket.js +200 -0
  150. package/package.json +1 -1
@@ -1,207 +1,212 @@
1
- import { jsxs as m, jsx as l } from "react/jsx-runtime";
2
- import { InlineDisplaySection as V } from "../editors/inline-display.js";
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 = [
1
+ import { jsxs as b, jsx as t, Fragment as V } from "react/jsx-runtime";
2
+ import { rowOf as K, readGroupStructure as X, isFolded as _ } from "../../../lib/form-structure.js";
3
+ import { InlineDisplaySection as z } from "../editors/inline-display.js";
4
+ import { foldPlan as J, rowUpdatePlan as Q } from "../section-structure.js";
5
+ import { AiFillSetting as Y } from "./AiFillSetting.js";
6
+ import { showsNumbers as Z, showsDateMode as ee, showsInputMask as te } from "./applies.js";
7
+ import { TextRulesSetting as le, CounterSetting as oe } from "./BehaviourSettings.js";
8
+ import { ColumnFit as ae } from "./ColumnFit.js";
9
+ import { useFieldCtx as H } from "./field-context.js";
10
+ import { interfaceOptions as ie, interfaceLabel as ne, currentInterface as re } from "./interfaces.js";
11
+ import { useGlobalValue as m, Setting as n, TextInput as v, Toggle as k, Choice as N, Segmented as w, Section as G, Buffered as de, DraftInput as y } from "./kit.js";
12
+ import { inlineDisplayOf as se, withInlineDisplay as ce } from "./model.js";
13
+ import { FieldTranslations as ue } from "./Translations.js";
14
+ const F = [
12
15
  { value: "12", label: "Full" },
13
16
  { value: "6", label: "½" },
14
17
  { value: "4", label: "⅓" },
15
18
  { value: "3", label: "¼" }
16
- ], _ = [
19
+ ], A = [
17
20
  { value: "", label: "Default" },
18
21
  { value: "int", label: "Integer" },
19
22
  { value: "decimal", label: "Decimal" },
20
23
  { value: "currency", label: "Currency" }
21
- ], oe = [
24
+ ], fe = [
22
25
  { value: "", label: "None" },
23
26
  { value: "SUM", label: "Sum" },
24
27
  { value: "COUNT", label: "Count" },
25
28
  { value: "AVG", label: "Average" },
26
29
  { value: "MIN", label: "Smallest" },
27
30
  { value: "MAX", label: "Largest" }
28
- ], r = (t) => typeof t == "string" ? t : "";
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) },
33
- `Change what shows under ${a}`,
31
+ ], f = (o) => typeof o == "string" ? o : "";
32
+ function Te() {
33
+ var T, I, L, D;
34
+ const o = H(), { info: a, ov: s, opts: c, env: g, row: u, globalOptions: i } = o, l = a.label, p = ((T = a.global) == null ? void 0 : T.label) || l, r = s.label === "", M = Z(a), U = ee(a), C = te(a), R = ie(a.abstractType), S = ne(a.abstractType, ((I = a.global) == null ? void 0 : I.interface) ?? null) ?? ((L = a.global) != null && L.interface ? "custom input" : null), $ = f(s.interface), P = re(a.abstractType, $) ?? $, x = m("field.format", f(i.format)), q = m("field.currency", f(i.currency)), E = m("field.aggregate", f(i.aggregate)), W = m("field.unit", f(i.unit)), j = m("field.input_mask", f(i.input_mask)), B = se(u), O = (e) => o.setPlacement(
35
+ { input_bindings: ce(u, e) },
36
+ `Change what shows under ${l}`,
34
37
  !0
35
38
  );
36
- return /* @__PURE__ */ m("div", { className: "space-y-5", children: [
37
- /* @__PURE__ */ l(
39
+ return /* @__PURE__ */ b("div", { className: "space-y-5", children: [
40
+ /* @__PURE__ */ t(
38
41
  n,
39
42
  {
40
43
  k: "field.label",
41
44
  label: "Label",
42
- effect: `What this form calls the field. Empty uses the field's own label (${v}).`,
43
- children: /* @__PURE__ */ l(
44
- h,
45
+ effect: `What this form calls the field. Empty uses the field's own label (${p}).`,
46
+ children: /* @__PURE__ */ t(
47
+ v,
45
48
  {
46
49
  ariaLabel: "Label",
47
- value: w ? "" : r(d.label),
48
- placeholder: v,
49
- onChange: (e) => t.setOverride("label", e === "" ? void 0 : e, `Rename ${a}`, !0)
50
+ value: r ? "" : f(s.label),
51
+ placeholder: p,
52
+ onChange: (e) => o.setOverride("label", e === "" ? void 0 : e, `Rename ${l}`, !0)
50
53
  }
51
54
  )
52
55
  }
53
56
  ),
54
- /* @__PURE__ */ l(
55
- I,
57
+ /* @__PURE__ */ t(
58
+ k,
56
59
  {
57
60
  k: "field.label_hidden",
58
61
  label: "Hide the label",
59
62
  effect: "Shows the value without its label on this form.",
60
- checked: w,
61
- onChange: (e) => t.setOverride(
63
+ checked: r,
64
+ onChange: (e) => o.setOverride(
62
65
  "label",
63
66
  e ? "" : void 0,
64
- e ? `Hide the label of ${a}` : `Show the label of ${a}`
67
+ e ? `Hide the label of ${l}` : `Show the label of ${l}`
65
68
  )
66
69
  }
67
70
  ),
68
- /* @__PURE__ */ l(n, { k: "field.interface", label: "Input", effect: "How the field is edited on this form.", children: /* @__PURE__ */ l(
69
- T,
71
+ /* @__PURE__ */ t(n, { k: "field.interface", label: "Input", effect: "How the field is edited on this form.", children: /* @__PURE__ */ t(
72
+ N,
70
73
  {
71
74
  ariaLabel: "Input",
72
- value: U,
75
+ value: P,
73
76
  unknownLabel: (e) => `Custom input (${e})`,
74
77
  options: [
75
- { value: "", label: y ? `Field's own (${y})` : "Field's own" },
76
- ...F
78
+ { value: "", label: S ? `Field's own (${S})` : "Field's own" },
79
+ ...R
77
80
  ],
78
- onChange: (e) => t.setOverride("interface", e || void 0, `Change how ${a} is edited`)
81
+ onChange: (e) => o.setOverride("interface", e || void 0, `Change how ${l} is edited`)
79
82
  }
80
83
  ) }),
81
- /* @__PURE__ */ l(n, { k: "field.placeholder", label: "Placeholder", effect: "Grey hint inside the empty input.", children: /* @__PURE__ */ l(
82
- h,
84
+ /* @__PURE__ */ t(n, { k: "field.placeholder", label: "Placeholder", effect: "Grey hint inside the empty input.", children: /* @__PURE__ */ t(
85
+ v,
83
86
  {
84
87
  ariaLabel: "Placeholder",
85
- value: r(d.placeholder),
86
- onChange: (e) => t.setOverride(
88
+ value: f(s.placeholder),
89
+ onChange: (e) => o.setOverride(
87
90
  "placeholder",
88
91
  e || void 0,
89
- `Change the placeholder of ${a}`,
92
+ `Change the placeholder of ${l}`,
90
93
  !0
91
94
  )
92
95
  }
93
96
  ) }),
94
- /* @__PURE__ */ l(n, { k: "field.note", label: "Help text", effect: "A line of help under the field.", children: /* @__PURE__ */ l(
95
- h,
97
+ /* @__PURE__ */ t(n, { k: "field.note", label: "Help text", effect: "A line of help under the field.", children: /* @__PURE__ */ t(
98
+ v,
96
99
  {
97
100
  ariaLabel: "Help text",
98
- value: r(d.note),
99
- placeholder: ((D = o.global) == null ? void 0 : D.note) ?? "",
100
- onChange: (e) => t.setOverride("note", e || void 0, `Change the help text of ${a}`, !0)
101
+ value: f(s.note),
102
+ placeholder: ((D = a.global) == null ? void 0 : D.note) ?? "",
103
+ onChange: (e) => o.setOverride("note", e || void 0, `Change the help text of ${l}`, !0)
101
104
  }
102
105
  ) }),
103
- /* @__PURE__ */ l(
104
- I,
106
+ /* @__PURE__ */ t(le, {}),
107
+ /* @__PURE__ */ t(
108
+ k,
105
109
  {
106
110
  k: "field.hidden",
107
111
  label: "Hidden",
108
112
  effect: "Leaves the field off this form; its value is kept.",
109
- checked: d.hidden === !0,
110
- onChange: (e) => t.setOverride("hidden", e ? !0 : void 0, e ? `Hide ${a}` : `Show ${a}`)
113
+ checked: s.hidden === !0,
114
+ onChange: (e) => o.setOverride("hidden", e ? !0 : void 0, e ? `Hide ${l}` : `Show ${l}`)
111
115
  }
112
116
  ),
113
- A.layoutType !== "table" && /* @__PURE__ */ l(n, { k: "field.col_span", label: "Width", effect: "Share of the row the field takes.", children: /* @__PURE__ */ l(
114
- b,
117
+ g.layoutType !== "table" && /* @__PURE__ */ t(n, { k: "field.col_span", label: "Width", effect: "Share of the row the field takes.", children: /* @__PURE__ */ t(
118
+ w,
115
119
  {
116
- value: String(p.col_span ?? 12),
117
- options: G,
120
+ value: String(u.col_span ?? 12),
121
+ options: F,
118
122
  onChange: (e) => {
119
- var i;
120
- return t.setPlacement(
123
+ var d;
124
+ return o.setPlacement(
121
125
  { col_span: e === "12" ? null : Number(e) },
122
- `Set the width of ${a} to ${(i = G.find((s) => s.value === e)) == null ? void 0 : i.label}`
126
+ `Set the width of ${l} to ${(d = F.find((h) => h.value === e)) == null ? void 0 : d.label}`
123
127
  );
124
128
  }
125
129
  }
126
130
  ) }),
127
- /* @__PURE__ */ l(z, {}),
128
- o.relKind === "M2O" && o.relatedCollection && /* @__PURE__ */ m(N, { title: "Show under the value", children: [
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." }),
130
- /* @__PURE__ */ l(ee, { value: j, children: (e, i) => /* @__PURE__ */ l(
131
- V,
131
+ /* @__PURE__ */ t(ae, {}),
132
+ g.layoutType !== "table" && u.group_key !== null && /* @__PURE__ */ t(he, {}),
133
+ a.relKind === "M2O" && a.relatedCollection && /* @__PURE__ */ b(G, { title: "Show under the value", children: [
134
+ /* @__PURE__ */ t("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." }),
135
+ /* @__PURE__ */ t(de, { value: B, children: (e, d) => /* @__PURE__ */ t(
136
+ z,
132
137
  {
133
- relatedCollection: o.relatedCollection,
138
+ relatedCollection: a.relatedCollection,
134
139
  entries: e.entries,
135
140
  separator: e.separator,
136
- onChange: (s) => $(i({ ...e, entries: s })),
137
- onSeparatorChange: (s) => $(i({ ...e, separator: s }))
141
+ onChange: (h) => O(d({ ...e, entries: h })),
142
+ onSeparatorChange: (h) => O(d({ ...e, separator: h }))
138
143
  }
139
144
  ) })
140
145
  ] }),
141
- M && /* @__PURE__ */ l(
146
+ U && /* @__PURE__ */ t(
142
147
  n,
143
148
  {
144
149
  k: "field.date_mode",
145
150
  label: "Show",
146
151
  effect: "Date only hides the time in the picker and wherever this form shows the value.",
147
- children: /* @__PURE__ */ l(
148
- b,
152
+ children: /* @__PURE__ */ t(
153
+ w,
149
154
  {
150
- value: u.date_mode === "date" ? "date" : "datetime",
155
+ value: c.date_mode === "date" ? "date" : "datetime",
151
156
  options: [
152
157
  { value: "datetime", label: "Date & time" },
153
158
  { value: "date", label: "Date only" }
154
159
  ],
155
- onChange: (e) => t.setOption(
160
+ onChange: (e) => o.setOption(
156
161
  "date_mode",
157
162
  e === "date" ? "date" : void 0,
158
- e === "date" ? `Show ${a} as a date only` : `Show ${a} with its time`
163
+ e === "date" ? `Show ${l} as a date only` : `Show ${l} with its time`
159
164
  )
160
165
  }
161
166
  )
162
167
  }
163
168
  ),
164
- H && /* @__PURE__ */ m(N, { title: "Numbers", children: [
165
- /* @__PURE__ */ l(
169
+ M && /* @__PURE__ */ b(G, { title: "Numbers", children: [
170
+ /* @__PURE__ */ t(
166
171
  n,
167
172
  {
168
173
  k: "field.precision",
169
174
  label: "Decimal places",
170
175
  effect: "Rounds entry and display on this form.",
171
- children: /* @__PURE__ */ l(
172
- h,
176
+ children: /* @__PURE__ */ t(
177
+ v,
173
178
  {
174
179
  type: "number",
175
180
  ariaLabel: "Decimal places",
176
- value: u.precision == null ? "" : String(u.precision),
181
+ value: c.precision == null ? "" : String(c.precision),
177
182
  placeholder: "2",
178
183
  onChange: (e) => {
179
- const i = e === "" ? void 0 : Math.max(0, Math.min(10, Math.round(Number(e))));
180
- i !== void 0 && Number.isNaN(i) || t.setOption("precision", i, `Set the decimal places of ${a}`, !0);
184
+ const d = e === "" ? void 0 : Math.max(0, Math.min(10, Math.round(Number(e))));
185
+ d !== void 0 && Number.isNaN(d) || o.setOption("precision", d, `Set the decimal places of ${l}`, !0);
181
186
  }
182
187
  }
183
188
  )
184
189
  }
185
190
  ),
186
- /* @__PURE__ */ l(
191
+ /* @__PURE__ */ t(
187
192
  n,
188
193
  {
189
194
  k: "field.format",
190
195
  label: "Number format",
191
196
  scope: "field",
192
197
  effect: "How the value is written everywhere it shows.",
193
- children: /* @__PURE__ */ l(
194
- b,
198
+ children: /* @__PURE__ */ t(
199
+ w,
195
200
  {
196
- value: S,
197
- options: _,
201
+ value: x,
202
+ options: A,
198
203
  onChange: (e) => {
199
- var i;
200
- return t.proposeGlobalOption(
204
+ var d;
205
+ return o.proposeGlobalOption(
201
206
  "field.format",
202
207
  "format",
203
208
  e || void 0,
204
- `Show ${a} as ${(i = _.find((s) => s.value === e)) == null ? void 0 : i.label.toLowerCase()}`,
209
+ `Show ${l} as ${(d = A.find((h) => h.value === e)) == null ? void 0 : d.label.toLowerCase()}`,
205
210
  e
206
211
  );
207
212
  }
@@ -209,72 +214,72 @@ function me() {
209
214
  )
210
215
  }
211
216
  ),
212
- S === "currency" && /* @__PURE__ */ l(
217
+ x === "currency" && /* @__PURE__ */ t(
213
218
  n,
214
219
  {
215
220
  k: "field.currency",
216
221
  label: "Currency",
217
222
  scope: "field",
218
223
  effect: "Three-letter code, for example USD.",
219
- children: /* @__PURE__ */ l(
220
- g,
224
+ children: /* @__PURE__ */ t(
225
+ y,
221
226
  {
222
227
  ariaLabel: "Currency",
223
- value: P,
228
+ value: q,
224
229
  placeholder: "USD",
225
230
  mono: !0,
226
- onCommit: (e) => t.proposeGlobalOption(
231
+ onCommit: (e) => o.proposeGlobalOption(
227
232
  "field.currency",
228
233
  "currency",
229
234
  e.trim().toUpperCase() || void 0,
230
- `Show ${a} in ${e.trim().toUpperCase() || "USD"}`,
235
+ `Show ${l} in ${e.trim().toUpperCase() || "USD"}`,
231
236
  e
232
237
  )
233
238
  }
234
239
  )
235
240
  }
236
241
  ),
237
- /* @__PURE__ */ l(
242
+ /* @__PURE__ */ t(
238
243
  n,
239
244
  {
240
245
  k: "field.aggregate",
241
246
  label: "Grid footer",
242
247
  scope: "field",
243
248
  effect: "The figure under this column wherever it shows in a grid.",
244
- children: /* @__PURE__ */ l(
245
- T,
249
+ children: /* @__PURE__ */ t(
250
+ N,
246
251
  {
247
252
  ariaLabel: "Grid footer",
248
- value: R,
249
- options: oe,
250
- onChange: (e) => t.proposeGlobalOption(
253
+ value: E,
254
+ options: fe,
255
+ onChange: (e) => o.proposeGlobalOption(
251
256
  "field.aggregate",
252
257
  "aggregate",
253
258
  e || void 0,
254
- `Change the grid footer of ${a}`,
259
+ `Change the grid footer of ${l}`,
255
260
  e
256
261
  )
257
262
  }
258
263
  )
259
264
  }
260
265
  ),
261
- /* @__PURE__ */ l(
266
+ /* @__PURE__ */ t(
262
267
  n,
263
268
  {
264
269
  k: "field.unit",
265
270
  label: "Unit",
266
271
  scope: "field",
267
272
  effect: '"$" shows currency, "%" a percent; other text follows the number. A number format wins.',
268
- children: /* @__PURE__ */ l(
269
- g,
273
+ children: /* @__PURE__ */ t(
274
+ y,
270
275
  {
271
276
  ariaLabel: "Unit",
272
- value: E,
273
- onCommit: (e) => t.proposeGlobalOption(
277
+ value: W,
278
+ onCommit: (e) => o.proposeGlobalOption(
274
279
  "field.unit",
275
280
  "unit",
276
281
  e || void 0,
277
- `Set the unit of ${a}`,
282
+ `Set the unit of ${l}`,
278
283
  e
279
284
  )
280
285
  }
@@ -282,35 +287,81 @@ function me() {
282
287
  }
283
288
  )
284
289
  ] }),
285
- C && /* @__PURE__ */ l(
290
+ C && /* @__PURE__ */ t(
286
291
  n,
287
292
  {
288
293
  k: "field.input_mask",
289
294
  label: "Input mask",
290
295
  scope: "field",
291
296
  effect: "# a digit, A a letter, * anything. The value is stored without the mask.",
292
- children: /* @__PURE__ */ l(
293
- g,
297
+ children: /* @__PURE__ */ t(
298
+ y,
294
299
  {
295
300
  ariaLabel: "Input mask",
296
- value: W,
301
+ value: j,
297
302
  mono: !0,
298
303
  placeholder: "(###) ###-####",
299
- onCommit: (e) => t.proposeGlobalOption(
304
+ onCommit: (e) => o.proposeGlobalOption(
300
305
  "field.input_mask",
301
306
  "input_mask",
302
307
  e || void 0,
303
- `Set the input mask of ${a}`,
308
+ `Set the input mask of ${l}`,
304
309
  e
305
310
  )
306
311
  }
307
312
  )
308
313
  }
309
314
  ),
310
- C && !o.isPath && !o.computedType && /* @__PURE__ */ l(B, {}),
311
- /* @__PURE__ */ l(ae, {})
315
+ /* @__PURE__ */ t(oe, {}),
316
+ C && !a.isPath && !a.computedType && /* @__PURE__ */ t(Y, {}),
317
+ /* @__PURE__ */ t(ue, {})
318
+ ] });
319
+ }
320
+ function he() {
321
+ const { info: o, ov: a, env: s, row: c } = H(), g = o.label, u = s.bundle.groups.find((r) => r.key === c.group_key) ?? null;
322
+ if (!u || !["section", "tab"].includes(u.type)) return null;
323
+ const i = K(X(u.swap_config).rows, c.field), l = a.required === !0, p = (r) => {
324
+ r.ok && s.apply(r.ops, { label: r.label });
325
+ };
326
+ return /* @__PURE__ */ b(V, { children: [
327
+ /* @__PURE__ */ t(
328
+ k,
329
+ {
330
+ k: "field.fold",
331
+ label: "Behind “Show more”",
332
+ effect: i ? "Fields side by side in a row always show." : l ? "Required fields always show." : "Tucked under “Show N more” at the end of the section while empty. It opens on its own once one of them has a value.",
333
+ checked: _(c.overrides) && !i,
334
+ disabled: !!i || l && !_(c.overrides),
335
+ onChange: (r) => p(J(s.bundle, [c], r))
336
+ }
337
+ ),
338
+ i && /* @__PURE__ */ t(
339
+ n,
340
+ {
341
+ k: "field.row_group",
342
+ label: "Shares a row",
343
+ effect: `Side by side under “${i.label || "one label"}”. Rename the row in the section's settings.`,
344
+ children: /* @__PURE__ */ b(
345
+ "button",
346
+ {
347
+ type: "button",
348
+ onClick: () => p(
349
+ Q(s.bundle, u.key, i.key, {
350
+ fields: i.fields.filter((r) => r !== c.field)
351
+ })
352
+ ),
353
+ className: "rounded-md border border-slate-200 px-2.5 py-1 text-[12px] font-medium text-slate-700 hover:bg-muted dark:border-border dark:text-foreground",
354
+ children: [
355
+ "Take ",
356
+ g,
357
+ " out of the row"
358
+ ]
359
+ }
360
+ )
361
+ }
362
+ )
312
363
  ] });
313
364
  }
314
365
  export {
315
- me as LookTab
366
+ Te as LookTab
316
367
  };
@@ -0,0 +1,129 @@
1
+ import { jsx as t, jsxs as s, Fragment as x } from "react/jsx-runtime";
2
+ import { useQueryClient as $, useQuery as q } from "@tanstack/react-query";
3
+ import { useState as y } from "react";
4
+ import { useNivaroClient as A } from "../../../context.js";
5
+ import { get as T, del as D } from "../../../lib/commands.js";
6
+ import { Skeleton as d } from "../../ui/skeleton.js";
7
+ import { Section as K } from "./kit.js";
8
+ const Q = (n) => {
9
+ const r = Math.round(
10
+ (Date.parse(`${j()}T00:00:00Z`) - Date.parse(`${n}T00:00:00Z`)) / 864e5
11
+ );
12
+ return r <= 0 ? "today" : r === 1 ? "yesterday" : `${r} days ago`;
13
+ }, j = () => (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
14
+ function P({ layoutId: n, field: r }) {
15
+ const l = A(), b = $(), c = ["layout-editor", "picker-misses", n, r], { data: o, isLoading: v, isError: N, refetch: k } = q({
16
+ queryKey: c,
17
+ queryFn: () => l.request(T(`/layout-usage/${n}/picker-misses`, { field: r })).then((e) => {
18
+ var p, f, g;
19
+ return {
20
+ available: ((p = e == null ? void 0 : e.data) == null ? void 0 : p.available) !== !1,
21
+ target: ((f = e == null ? void 0 : e.data) == null ? void 0 : f.target) ?? null,
22
+ fields: Array.isArray((g = e == null ? void 0 : e.data) == null ? void 0 : g.fields) ? e.data.fields : []
23
+ };
24
+ }),
25
+ enabled: n > 0,
26
+ staleTime: 6e4,
27
+ retry: !1
28
+ }), [C, i] = y(!1), [w, u] = y(!1), a = o == null ? void 0 : o.fields.find((e) => e.field === r), m = Array.isArray(a == null ? void 0 : a.misses) ? a.misses : [], h = (a == null ? void 0 : a.total) ?? 0, S = async () => {
29
+ u(!0);
30
+ try {
31
+ await l.request(
32
+ D(`/layout-usage/${n}/picker-misses?field=${encodeURIComponent(r)}`)
33
+ ), await b.invalidateQueries({ queryKey: c });
34
+ } finally {
35
+ u(!1), i(!1);
36
+ }
37
+ };
38
+ return /* @__PURE__ */ t(K, { title: "Searches that found nothing", children: /* @__PURE__ */ s("div", { className: "space-y-3", "data-picker-misses": r, children: [
39
+ /* @__PURE__ */ t("p", { className: "text-[12px] leading-5 text-muted-foreground", children: "What people typed into this picker on this form in the last 14 days that matched no record. Counts only, never who typed it." }),
40
+ v ? /* @__PURE__ */ s("div", { className: "space-y-2", "aria-busy": "true", children: [
41
+ /* @__PURE__ */ t(d, { className: "h-4 w-3/4" }),
42
+ /* @__PURE__ */ t(d, { className: "h-3 w-full" }),
43
+ /* @__PURE__ */ t(d, { className: "h-4 w-1/2" })
44
+ ] }) : N ? /* @__PURE__ */ s("p", { className: "text-[12px] text-muted-foreground", children: [
45
+ "Could not load the searches.",
46
+ " ",
47
+ /* @__PURE__ */ t(
48
+ "button",
49
+ {
50
+ type: "button",
51
+ onClick: () => void k(),
52
+ className: "font-medium text-foreground underline-offset-2 hover:underline",
53
+ children: "Try again"
54
+ }
55
+ )
56
+ ] }) : o && !o.available ? /* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: "Searches are not being recorded on this server right now." }) : m.length === 0 ? /* @__PURE__ */ t("p", { className: "rounded-md border border-dashed border-border px-3 py-2.5 text-[12px] leading-5 text-muted-foreground", children: "None in the last 14 days. Words that find nothing show here with a suggested fix." }) : /* @__PURE__ */ s(x, { children: [
57
+ /* @__PURE__ */ t("ol", { className: "divide-y divide-border overflow-hidden rounded-md border border-border", children: m.map((e) => /* @__PURE__ */ s("li", { className: "space-y-1 bg-card px-3 py-2", "data-picker-miss": e.term, children: [
58
+ /* @__PURE__ */ s("div", { className: "flex items-baseline gap-2", children: [
59
+ /* @__PURE__ */ s("span", { className: "min-w-0 flex-1 truncate text-[12.5px] font-medium text-foreground", children: [
60
+ "“",
61
+ e.term,
62
+ "”"
63
+ ] }),
64
+ /* @__PURE__ */ s(
65
+ "span",
66
+ {
67
+ className: "shrink-0 text-[11.5px] tabular-nums text-muted-foreground",
68
+ "data-tip": `Last searched ${Q(e.last)}`,
69
+ children: [
70
+ e.count,
71
+ " ",
72
+ e.count === 1 ? "time" : "times"
73
+ ]
74
+ }
75
+ )
76
+ ] }),
77
+ e.suggestion && /* @__PURE__ */ t(
78
+ "p",
79
+ {
80
+ className: "text-[11.5px] leading-4 text-muted-foreground",
81
+ "data-picker-miss-fix": e.suggestion.kind,
82
+ children: e.suggestion.text
83
+ }
84
+ )
85
+ ] }, e.term)) }),
86
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-2 text-[11.5px] text-muted-foreground", children: [
87
+ /* @__PURE__ */ s("span", { className: "flex-1", children: [
88
+ h,
89
+ " missed ",
90
+ h === 1 ? "search" : "searches",
91
+ " in 14 days"
92
+ ] }),
93
+ C ? /* @__PURE__ */ s(x, { children: [
94
+ /* @__PURE__ */ t("span", { children: "Clear the list?" }),
95
+ /* @__PURE__ */ t(
96
+ "button",
97
+ {
98
+ type: "button",
99
+ disabled: w,
100
+ onClick: () => void S(),
101
+ className: "rounded px-1.5 py-0.5 font-medium text-red-600 hover:bg-red-50 disabled:opacity-50 dark:text-red-400 dark:hover:bg-red-500/10",
102
+ children: "Clear"
103
+ }
104
+ ),
105
+ /* @__PURE__ */ t(
106
+ "button",
107
+ {
108
+ type: "button",
109
+ onClick: () => i(!1),
110
+ className: "rounded px-1.5 py-0.5 hover:bg-muted hover:text-foreground",
111
+ children: "Keep"
112
+ }
113
+ )
114
+ ] }) : /* @__PURE__ */ t(
115
+ "button",
116
+ {
117
+ type: "button",
118
+ onClick: () => i(!0),
119
+ className: "rounded px-1.5 py-0.5 hover:bg-muted hover:text-foreground",
120
+ children: "Clear list"
121
+ }
122
+ )
123
+ ] })
124
+ ] })
125
+ ] }) });
126
+ }
127
+ export {
128
+ P as PickerMisses
129
+ };