@nivaro/react 0.3.139 → 0.3.141

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 (100) hide show
  1. package/dist/components/InlineGridField.js +95 -92
  2. package/dist/full.css +1 -1
  3. package/dist/hooks/useSessionRecorder.js +1 -1
  4. package/dist/index.d.ts +39 -2
  5. package/dist/shared/components/AudienceConfirmPanel.js +19 -19
  6. package/dist/shared/components/BroadcastView.js +213 -211
  7. package/dist/shared/components/CollectionBrowserView.js +2702 -2671
  8. package/dist/shared/components/ConfigHistory.js +45 -45
  9. package/dist/shared/components/ConformanceView.js +110 -110
  10. package/dist/shared/components/DataTable.js +51 -51
  11. package/dist/shared/components/FilePreviewLightbox.js +26 -25
  12. package/dist/shared/components/ItemEditForm.js +3475 -3458
  13. package/dist/shared/components/LiveCount.js +27 -23
  14. package/dist/shared/components/LiveTraceView.js +62 -61
  15. package/dist/shared/components/PageRenderer.js +422 -410
  16. package/dist/shared/components/ProfileView.js +199 -199
  17. package/dist/shared/components/QualityRulesView.js +70 -70
  18. package/dist/shared/components/QueryTable.js +131 -130
  19. package/dist/shared/components/RecordGraph.js +98 -98
  20. package/dist/shared/components/RecordReadView.js +287 -288
  21. package/dist/shared/components/ReportView.js +1279 -1259
  22. package/dist/shared/components/RowPresence.js +83 -76
  23. package/dist/shared/components/SlaRulesView.js +73 -74
  24. package/dist/shared/components/UnseenDot.js +183 -22
  25. package/dist/shared/components/WidgetSlot.js +73 -73
  26. package/dist/shared/components/ai/AiChart.js +36 -32
  27. package/dist/shared/components/ai/AiMarkdown.js +136 -129
  28. package/dist/shared/components/ai/TaskDo.js +87 -87
  29. package/dist/shared/components/ai/answer-formats.js +37 -30
  30. package/dist/shared/components/ai/call-log/format.js +17 -16
  31. package/dist/shared/components/bulk/BulkActionButtons.js +66 -66
  32. package/dist/shared/components/bulk/BulkFieldUpdate.js +59 -59
  33. package/dist/shared/components/bulk/BulkSelectionNotices.js +34 -34
  34. package/dist/shared/components/bulk/MessageStakeholders.js +31 -29
  35. package/dist/shared/components/bulk/PushBulkButtons.js +83 -82
  36. package/dist/shared/components/bulk/bulk-field-options.js +10 -10
  37. package/dist/shared/components/cbv/column-totals.js +53 -51
  38. package/dist/shared/components/chat/ChatAnalyticsView.js +87 -87
  39. package/dist/shared/components/collections-directory/CollectionsToolbar.js +18 -18
  40. package/dist/shared/components/command-center/announce.js +7 -6
  41. package/dist/shared/components/command-center/panels/AttentionPanel.js +32 -31
  42. package/dist/shared/components/command-center/panels/FlowPanel.js +29 -28
  43. package/dist/shared/components/command-center/panels/PeoplePanel.js +39 -39
  44. package/dist/shared/components/delegation/DelegationConsoleView.js +27 -27
  45. package/dist/shared/components/delivery-analytics/drill.js +32 -32
  46. package/dist/shared/components/imports/RunDetailSheet.js +1 -1
  47. package/dist/shared/components/integrations/IntegrationObligationsView.js +119 -119
  48. package/dist/shared/components/integrations/console/EventsView.js +35 -35
  49. package/dist/shared/components/integrations/console/FirefightView.js +15 -14
  50. package/dist/shared/components/integrations/console/PartnerDetail.js +78 -78
  51. package/dist/shared/components/integrations/console/ReadyToSendView.js +103 -103
  52. package/dist/shared/components/integrations/console/SignalCard.js +67 -67
  53. package/dist/shared/components/item-edit/CatalogPickerField.js +536 -527
  54. package/dist/shared/components/item-edit/ChangesTray.js +88 -74
  55. package/dist/shared/components/item-edit/FilePickerField.js +123 -123
  56. package/dist/shared/components/item-edit/GroupSection.js +301 -292
  57. package/dist/shared/components/item-edit/HeaderSummaryChip.js +54 -54
  58. package/dist/shared/components/item-edit/InlineGridField.js +45 -36
  59. package/dist/shared/components/item-edit/InlineTableField.js +1390 -1376
  60. package/dist/shared/components/item-edit/NestedRelationEditor.js +106 -99
  61. package/dist/shared/components/item-edit/RecordChatMentionsChip.js +11 -11
  62. package/dist/shared/components/item-edit/RecordRecapChanges.js +116 -74
  63. package/dist/shared/components/item-edit/RecordRecapStrip.js +148 -160
  64. package/dist/shared/components/item-edit/summary-layout-request.js +15 -0
  65. package/dist/shared/components/layout-editor/ai-forms/SlimPanel.js +43 -44
  66. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  67. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +226 -157
  68. package/dist/shared/components/layout-editor/settings/WhoSection.js +53 -52
  69. package/dist/shared/components/layout-editor/settings/controls.js +98 -90
  70. package/dist/shared/components/layout-editor/settings/settings-registry.js +8 -0
  71. package/dist/shared/components/monitoring/ApiRequestLog.js +35 -35
  72. package/dist/shared/components/notifications/NotificationCenterView.js +268 -268
  73. package/dist/shared/components/ops-report/format.js +37 -36
  74. package/dist/shared/components/panels/ReferencedByPanel.js +21 -20
  75. package/dist/shared/components/panels/RevisionsPanel.js +306 -305
  76. package/dist/shared/components/pipeline/OwnerMatrixVersionsCard.js +12 -12
  77. package/dist/shared/components/pipeline/PipelineEditorView.js +483 -482
  78. package/dist/shared/components/pipeline/PipelineHealthCards.js +33 -32
  79. package/dist/shared/components/pipeline/TeamsView.js +189 -130
  80. package/dist/shared/components/profile/AgentsPanel.js +6 -6
  81. package/dist/shared/components/profile/DelegationCard.js +13 -12
  82. package/dist/shared/components/profile/PersonActivity.js +48 -48
  83. package/dist/shared/components/profile/PersonExtras.js +107 -107
  84. package/dist/shared/components/profile/PersonWeek.js +9 -9
  85. package/dist/shared/components/queue/QueueBulkBar.js +19 -18
  86. package/dist/shared/components/queue/QueueBulkMove.js +21 -20
  87. package/dist/shared/components/queue/QueueItemSheet.js +136 -131
  88. package/dist/shared/components/queue/QueueWorklist.js +884 -872
  89. package/dist/shared/components/queue/worklist-helpers.js +36 -21
  90. package/dist/shared/components/support/RequestList.js +123 -123
  91. package/dist/shared/components/support/SupportAnalytics.js +29 -29
  92. package/dist/shared/lib/activity-sentence.js +251 -229
  93. package/dist/shared/lib/format-value.js +5 -4
  94. package/dist/shared/lib/layout-resolve.js +64 -48
  95. package/dist/shared/lib/number-format.js +87 -0
  96. package/dist/shared/lib/number-kind.js +133 -0
  97. package/dist/shared/lib/utils.js +24 -20
  98. package/dist/shared/lib/watch-list.js +1 -1
  99. package/dist/shared/lib/widget-value-format.js +26 -12
  100. package/package.json +1 -1
@@ -1,11 +1,11 @@
1
- import { formatDateTime as s, toLocalDateString as a, formatRelative as m } from "./utils.js";
1
+ import { formatDateTime as s, toLocalDateString as m, formatRelative as a } from "./utils.js";
2
2
  const c = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], l = /* @__PURE__ */ new Set(["true", "1", "yes", "y"]), h = /* @__PURE__ */ new Set(["false", "0", "no", "n"]);
3
3
  function u(t) {
4
4
  return String(t).padStart(2, "0");
5
5
  }
6
6
  function f(t, e) {
7
7
  const n = t.match(/^(\d{4})-(\d{2})-(\d{2})(?:T00:00:00(?:\.000)?Z)?$/), r = n ? new Date(Number(n[1]), Number(n[2]) - 1, Number(n[3])) : new Date(t);
8
- return Number.isNaN(r.getTime()) ? t : e === "relative" ? m(r) : e.replace(/YYYY|MMM|YY|MM|DD|HH|hh|mm|ss|h|A|a/g, (i) => {
8
+ return Number.isNaN(r.getTime()) ? t : e === "relative" ? a(r) : e.replace(/YYYY|MMM|YY|MM|DD|HH|hh|mm|ss|h|A|a/g, (i) => {
9
9
  switch (i) {
10
10
  case "YYYY":
11
11
  return String(r.getFullYear());
@@ -39,14 +39,15 @@ function f(t, e) {
39
39
  function p(t, e) {
40
40
  if (e.type === "count") return t;
41
41
  if (e.type === "datetime")
42
- return e.template !== "relative" && /h|H/.test(e.template) ? s(t) || t : e.template !== "relative" && /D/.test(e.template) && /M/.test(e.template) && /Y/.test(e.template) ? a(t) || t : f(t, e.template);
42
+ return e.template !== "relative" && /h|H/.test(e.template) ? s(t) || t : e.template !== "relative" && /D/.test(e.template) && /M/.test(e.template) && /Y/.test(e.template) ? m(t) || t : f(t, e.template);
43
43
  if (e.type === "number") {
44
44
  const r = Number(t);
45
45
  if (Number.isNaN(r) || t.trim() === "") return t;
46
46
  const i = new Intl.NumberFormat("en-US", {
47
47
  minimumFractionDigits: e.decimals ?? 0,
48
48
  maximumFractionDigits: e.decimals ?? 0,
49
- useGrouping: e.thousands ?? !1
49
+ // Grouped unless the column says otherwise (thousands: false keeps ids / PO numbers as stored).
50
+ useGrouping: e.thousands ?? !0
50
51
  }).format(r);
51
52
  return `${e.prefix ?? ""}${i}${e.suffix ?? ""}`;
52
53
  }
@@ -1,5 +1,5 @@
1
- const a = /^\d{4}-\d{2}-\d{2}$/, f = (t) => typeof t == "string" && a.test(t);
2
- function o(t) {
1
+ const s = /^\d{4}-\d{2}-\d{2}$/, f = (t) => typeof t == "string" && s.test(t);
2
+ function i(t) {
3
3
  let n = t;
4
4
  if (typeof n == "string")
5
5
  try {
@@ -9,17 +9,17 @@ function o(t) {
9
9
  }
10
10
  return n && typeof n == "object" && !Array.isArray(n) ? n : null;
11
11
  }
12
- function u(t, n, e) {
13
- const r = { ...o(t) ?? {} };
12
+ function c(t, n, e) {
13
+ const r = { ...i(t) ?? {} };
14
14
  return e == null ? delete r[n] : r[n] = e, Object.keys(r).length > 0 ? r : null;
15
15
  }
16
- function s(t = /* @__PURE__ */ new Date()) {
16
+ function a(t = /* @__PURE__ */ new Date()) {
17
17
  const n = (e) => String(e).padStart(2, "0");
18
18
  return `${t.getFullYear()}-${n(t.getMonth() + 1)}-${n(t.getDate())}`;
19
19
  }
20
20
  function w(t) {
21
- var i;
22
- const n = o((i = o(t)) == null ? void 0 : i.active_window);
21
+ var o;
22
+ const n = i((o = i(t)) == null ? void 0 : o.active_window);
23
23
  if (!n) return null;
24
24
  const e = f(n.from) ? n.from : null, r = f(n.until) ? n.until : null;
25
25
  return e || r ? { from: e, until: r } : null;
@@ -27,7 +27,7 @@ function w(t) {
27
27
  function _(t, n) {
28
28
  return t ? t.from && n < t.from ? "before" : t.until && n > t.until ? "after" : "open" : null;
29
29
  }
30
- function c(t) {
30
+ function l(t) {
31
31
  return (/* @__PURE__ */ new Date(`${t}T00:00:00Z`)).toLocaleDateString(void 0, {
32
32
  day: "numeric",
33
33
  month: "short",
@@ -36,12 +36,12 @@ function c(t) {
36
36
  });
37
37
  }
38
38
  function O(t) {
39
- return t.from && t.until ? `${c(t.from)} – ${c(t.until)}` : t.from ? `from ${c(t.from)}` : `until ${c(t.until)}`;
39
+ return t.from && t.until ? `${l(t.from)} – ${l(t.until)}` : t.from ? `from ${l(t.from)}` : `until ${l(t.until)}`;
40
40
  }
41
41
  function x(t, n) {
42
42
  const e = n.from || null, r = n.until || null;
43
43
  return {
44
- conditions: u(
44
+ conditions: c(
45
45
  t,
46
46
  "active_window",
47
47
  e || r ? { ...e ? { from: e } : {}, ...r ? { until: r } : {} } : null
@@ -50,26 +50,40 @@ function x(t, n) {
50
50
  }
51
51
  function d(t) {
52
52
  var e;
53
- const n = Number((e = o(t)) == null ? void 0 : e.phone_of);
53
+ const n = Number((e = i(t)) == null ? void 0 : e.phone_of);
54
54
  return Number.isInteger(n) && n > 0 ? n : null;
55
55
  }
56
- function S(t, n) {
57
- return { conditions: u(t, "phone_of", n) };
56
+ function v(t, n) {
57
+ return { conditions: c(t, "phone_of", n) };
58
58
  }
59
- function h(t) {
59
+ function m(t) {
60
60
  var e;
61
- const n = Number((e = o(t)) == null ? void 0 : e.tablet_of);
61
+ const n = Number((e = i(t)) == null ? void 0 : e.tablet_of);
62
62
  return Number.isInteger(n) && n > 0 ? n : null;
63
63
  }
64
- function v(t, n) {
65
- return { conditions: u(t, "tablet_of", n) };
64
+ function S(t, n) {
65
+ return { conditions: c(t, "tablet_of", n) };
66
+ }
67
+ function A(t) {
68
+ var r;
69
+ const n = (r = i(t)) == null ? void 0 : r.summary_for;
70
+ if (!Array.isArray(n)) return [];
71
+ const e = [];
72
+ for (const o of n) {
73
+ const u = Number(o);
74
+ Number.isInteger(u) && u > 0 && !e.includes(u) && e.push(u);
75
+ }
76
+ return e;
66
77
  }
67
- function z(t) {
68
- return d(t) ?? h(t);
78
+ function z(t, n) {
79
+ return { conditions: c(t, "summary_for", n.length ? n : null) };
69
80
  }
70
- function m(t) {
81
+ function $(t) {
82
+ return d(t) ?? m(t);
83
+ }
84
+ function y(t) {
71
85
  var e;
72
- const n = o((e = o(t)) == null ? void 0 : e.freeze);
86
+ const n = i((e = i(t)) == null ? void 0 : e.freeze);
73
87
  return !n || !f(n.until) ? null : {
74
88
  until: n.until,
75
89
  reason: typeof n.reason == "string" ? n.reason : "",
@@ -78,35 +92,35 @@ function m(t) {
78
92
  at: typeof n.at == "string" ? n.at : null
79
93
  };
80
94
  }
81
- function $(t, n = s()) {
82
- const e = m(t);
95
+ function N(t, n = a()) {
96
+ const e = y(t);
83
97
  return e && n < e.until ? e : null;
84
98
  }
85
- function A(t, n) {
86
- return { conditions: u(t, "freeze", n) };
99
+ function P(t, n) {
100
+ return { conditions: c(t, "freeze", n) };
87
101
  }
88
- function y(t) {
102
+ function h(t) {
89
103
  var e;
90
- const n = (e = o(t)) == null ? void 0 : e.lazy_sections;
104
+ const n = (e = i(t)) == null ? void 0 : e.lazy_sections;
91
105
  return Array.isArray(n) ? [...new Set(n.filter((r) => typeof r == "string"))] : [];
92
106
  }
93
107
  function D(t, n, e) {
94
- const r = y(t).filter((l) => l !== n), i = e ? [...r, n] : r;
95
- return { conditions: u(t, "lazy_sections", i.length ? i : null) };
108
+ const r = h(t).filter((u) => u !== n), o = e ? [...r, n] : r;
109
+ return { conditions: c(t, "lazy_sections", o.length ? o : null) };
96
110
  }
97
111
  function p(t) {
98
112
  var e;
99
- const n = (e = o(t)) == null ? void 0 : e.quiet_hidden_sections;
113
+ const n = (e = i(t)) == null ? void 0 : e.quiet_hidden_sections;
100
114
  return Array.isArray(n) ? [...new Set(n.filter((r) => typeof r == "string"))] : [];
101
115
  }
102
- function P(t, n, e) {
103
- const r = p(t).filter((l) => l !== n), i = e ? r : [...r, n];
116
+ function W(t, n, e) {
117
+ const r = p(t).filter((u) => u !== n), o = e ? r : [...r, n];
104
118
  return {
105
- conditions: u(t, "quiet_hidden_sections", i.length ? i : null)
119
+ conditions: c(t, "quiet_hidden_sections", o.length ? o : null)
106
120
  };
107
121
  }
108
122
  const b = "(max-width: 639px)", g = "(min-width: 640px) and (max-width: 1023px), (min-width: 640px) and (max-width: 1366px) and (hover: none) and (pointer: coarse)";
109
- function N() {
123
+ function q() {
110
124
  try {
111
125
  return typeof window > "u" || !window.matchMedia ? null : window.matchMedia(b).matches ? "phone" : window.matchMedia(g).matches ? "tablet" : null;
112
126
  } catch {
@@ -116,25 +130,27 @@ function N() {
116
130
  export {
117
131
  b as PHONE_QUERY,
118
132
  g as TABLET_QUERY,
119
- $ as activeFreeze,
133
+ N as activeFreeze,
120
134
  w as activeWindowOf,
121
135
  x as activeWindowPatch,
122
- o as conditionsObject,
123
- u as conditionsWithKey,
124
- N as currentViewport,
125
- c as dayWords,
126
- m as freezeOf,
127
- A as freezePatch,
136
+ i as conditionsObject,
137
+ c as conditionsWithKey,
138
+ q as currentViewport,
139
+ l as dayWords,
140
+ y as freezeOf,
141
+ P as freezePatch,
128
142
  D as lazySectionPatch,
129
- y as lazySectionsOf,
130
- s as localDay,
143
+ h as lazySectionsOf,
144
+ a as localDay,
131
145
  d as phoneOf,
132
- S as phoneOfPatch,
133
- P as quietHiddenSectionPatch,
146
+ v as phoneOfPatch,
147
+ W as quietHiddenSectionPatch,
134
148
  p as quietHiddenSectionsOf,
135
- z as screenVersionOf,
136
- h as tabletOf,
137
- v as tabletOfPatch,
149
+ $ as screenVersionOf,
150
+ A as summaryForOf,
151
+ z as summaryForPatch,
152
+ m as tabletOf,
153
+ S as tabletOfPatch,
138
154
  _ as windowState,
139
155
  O as windowWords
140
156
  };
@@ -0,0 +1,87 @@
1
+ import { numberKindOf as y, isReferenceName as p, numberKindOfValue as g, numberDecimalsOf as a, numberCurrencyOf as N } from "./number-kind.js";
2
+ import { nameWords as I } from "./number-kind.js";
3
+ import { numberLocale as b } from "./utils.js";
4
+ function u(t) {
5
+ if (t == null || typeof t == "boolean") return null;
6
+ if (typeof t == "number") return Number.isFinite(t) ? t : null;
7
+ if (typeof t == "bigint") return Number(t);
8
+ if (typeof t != "string") return null;
9
+ const n = t.trim();
10
+ if (!n || !/^[-+]?(\d+\.?\d*|\.\d+)(e[-+]?\d+)?$/i.test(n)) return null;
11
+ const r = Number(n);
12
+ return Number.isFinite(r) ? r : null;
13
+ }
14
+ function m(t) {
15
+ if (t == null || typeof t == "number") return "";
16
+ const n = String(t);
17
+ return n.trim() ? n : "";
18
+ }
19
+ function l(t) {
20
+ const n = String(t ?? "USD").toUpperCase();
21
+ return /^[A-Z]{3}$/.test(n) ? n : "USD";
22
+ }
23
+ function F(t, n = {}) {
24
+ const r = u(t);
25
+ if (r == null) return m(t);
26
+ const e = l(n.currency), o = b(), i = n.decimals ?? 2, c = i === "auto" ? Number.isInteger(r) ? 0 : 2 : Math.min(Math.max(Math.trunc(Number(i) || 0), 0), 10), s = (f) => {
27
+ try {
28
+ return new Intl.NumberFormat(o, { style: "currency", currency: e, ...f }).format(r);
29
+ } catch {
30
+ return new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", ...f }).format(r);
31
+ }
32
+ };
33
+ return n.compact && Math.abs(r) >= 1e3 ? s({ notation: "compact", minimumFractionDigits: 0, maximumFractionDigits: 1 }) : s({ minimumFractionDigits: c, maximumFractionDigits: c });
34
+ }
35
+ function D(t, n = 2) {
36
+ const r = u(t);
37
+ return r == null ? m(t) : new Intl.NumberFormat(b(), {
38
+ maximumFractionDigits: Math.min(Math.max(Math.trunc(n), 0), 10)
39
+ }).format(r);
40
+ }
41
+ function O(t, n) {
42
+ if (t == null || t === "") return "";
43
+ const r = u(t);
44
+ if (r == null) return m(t);
45
+ const e = y(n) ?? (p(n == null ? void 0 : n.field) ? "plain" : g(t) ?? "plain");
46
+ return S(r, e, n, t);
47
+ }
48
+ function S(t, n, r, e) {
49
+ if (!Number.isFinite(t)) return "";
50
+ if (n === "money")
51
+ return F(t, {
52
+ currency: N(r) ?? "USD",
53
+ decimals: a(r, 2)
54
+ });
55
+ if (n === "plain")
56
+ return e != null && typeof e != "object" ? String(e).trim() : String(t);
57
+ const o = D(
58
+ t,
59
+ n === "count" && Number.isInteger(t) ? 0 : a(r, 2)
60
+ ), i = h(r);
61
+ return !i || i === "$" ? o : i === "%" ? `${o}%` : `${o} ${i}`;
62
+ }
63
+ function h(t) {
64
+ const n = t == null ? void 0 : t.options;
65
+ let r = {};
66
+ if (typeof n == "string")
67
+ try {
68
+ r = JSON.parse(n) ?? {};
69
+ } catch {
70
+ r = {};
71
+ }
72
+ else n && typeof n == "object" && (r = n);
73
+ return typeof r.unit == "string" ? r.unit.trim() : "";
74
+ }
75
+ export {
76
+ F as formatCurrency,
77
+ O as formatFieldNumber,
78
+ D as formatGrouped,
79
+ S as formatNumberAs,
80
+ p as isReferenceName,
81
+ I as nameWords,
82
+ N as numberCurrencyOf,
83
+ a as numberDecimalsOf,
84
+ y as numberKindOf,
85
+ g as numberKindOfValue,
86
+ u as toFiniteNumber
87
+ };
@@ -0,0 +1,133 @@
1
+ const a = /* @__PURE__ */ new Set(["money", "currency", "smallmoney"]), f = /* @__PURE__ */ new Set(["decimal", "float", "double", "numeric", "real", "number"]), l = /* @__PURE__ */ new Set([
2
+ "integer",
3
+ "int",
4
+ "biginteger",
5
+ "bigint",
6
+ "smallint",
7
+ "tinyint",
8
+ "bigincrements",
9
+ "increments"
10
+ ]), y = /* @__PURE__ */ new Set([
11
+ "string",
12
+ "text",
13
+ "uuid",
14
+ "char",
15
+ "varchar",
16
+ "nvarchar",
17
+ "csv",
18
+ "hash",
19
+ "json"
20
+ ]), p = /* @__PURE__ */ new Set([
21
+ "count",
22
+ "counts",
23
+ "qty",
24
+ "quantity",
25
+ "quantities",
26
+ "total",
27
+ "totals",
28
+ "units",
29
+ "sum",
30
+ "amount",
31
+ "balance",
32
+ "hours",
33
+ "minutes",
34
+ "days",
35
+ "size",
36
+ "bytes",
37
+ "weight",
38
+ "length",
39
+ "width",
40
+ "height",
41
+ "cost",
42
+ "price"
43
+ ]), m = /* @__PURE__ */ new Set([
44
+ "id",
45
+ "pk",
46
+ "number",
47
+ "num",
48
+ "no",
49
+ "nbr",
50
+ "nr",
51
+ "line",
52
+ "year",
53
+ "yr",
54
+ "fy",
55
+ "code",
56
+ "zip",
57
+ "zipcode",
58
+ "postal",
59
+ "phone",
60
+ "fax",
61
+ "ext",
62
+ "seq",
63
+ "sequence",
64
+ "version",
65
+ "ver",
66
+ "rev",
67
+ "revision",
68
+ "po",
69
+ "sku",
70
+ "ref",
71
+ "reference",
72
+ "key",
73
+ "acct",
74
+ "account"
75
+ ]);
76
+ function c(n) {
77
+ if (!n) return {};
78
+ if (typeof n == "string")
79
+ try {
80
+ const e = JSON.parse(n);
81
+ return e && typeof e == "object" && !Array.isArray(e) ? e : {};
82
+ } catch {
83
+ return {};
84
+ }
85
+ return typeof n == "object" && !Array.isArray(n) ? n : {};
86
+ }
87
+ function d(n) {
88
+ return String(n ?? "").replace(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean);
89
+ }
90
+ function S(n) {
91
+ if (!n) return null;
92
+ const e = c(n.options), r = c(n.display_options), t = String(e.format ?? r.format ?? "").toLowerCase(), i = typeof e.unit == "string" ? e.unit.trim() : "", s = String(n.type ?? "").toLowerCase(), o = String(n.interface ?? "").toLowerCase();
93
+ if (!(t === "currency" || !!e.currency || !!r.currency || !t && i === "$" || o === "currency" || a.has(s))) return null;
94
+ const u = String(e.currency ?? r.currency ?? "USD").toUpperCase();
95
+ return /^[A-Z]{3}$/.test(u) ? u : "USD";
96
+ }
97
+ function b(n) {
98
+ var o;
99
+ if (!n) return null;
100
+ const e = c(n.options), r = String(e.format ?? "").toLowerCase();
101
+ if (r === "currency") return "money";
102
+ if (r === "int" || r === "integer" || r === "number" || r === "count") return "count";
103
+ if (r === "decimal") return "decimal";
104
+ if (r === "plain" || r === "id" || r === "none") return "plain";
105
+ if (S(n)) return "money";
106
+ let t = String(n.type ?? "").toLowerCase();
107
+ if ((!t || t === "alias" || t === "unknown") && (t = String(n.computed_type ?? "").toLowerCase()), y.has(t)) return "plain";
108
+ const i = f.has(t);
109
+ return !i && !l.has(t) ? null : n.is_primary_key || (o = n.schema) != null && o.is_primary_key || g(n.field) ? "plain" : i ? "decimal" : "count";
110
+ }
111
+ function g(n) {
112
+ const e = String(n ?? ""), r = d(e);
113
+ return r.some((i) => p.has(i)) ? !1 : /[a-z]id$/i.test(e) && !/(paid|valid|void|grid|fluid|hybrid)$/i.test(e) || r.some((i) => m.has(i));
114
+ }
115
+ function w(n) {
116
+ if (typeof n == "number")
117
+ return Number.isFinite(n) ? Number.isInteger(n) ? "count" : "decimal" : null;
118
+ if (typeof n != "string") return null;
119
+ const e = n.trim();
120
+ return /^-?\d+(\.\d+)?$/.test(e) ? e.includes(".") ? "decimal" : "plain" : null;
121
+ }
122
+ function E(n, e = 2) {
123
+ const r = Number(c(n == null ? void 0 : n.options).precision);
124
+ return Number.isFinite(r) ? Math.min(Math.max(Math.trunc(r), 0), 10) : e;
125
+ }
126
+ export {
127
+ g as isReferenceName,
128
+ d as nameWords,
129
+ S as numberCurrencyOf,
130
+ E as numberDecimalsOf,
131
+ b as numberKindOf,
132
+ w as numberKindOfValue
133
+ };
@@ -15,7 +15,7 @@ function M(t) {
15
15
  }
16
16
  o = t;
17
17
  }
18
- function I() {
18
+ function b() {
19
19
  return o;
20
20
  }
21
21
  const _ = /* @__PURE__ */ new Set(["1899-12-30", "1900-01-01"]);
@@ -24,7 +24,7 @@ function f(t) {
24
24
  const n = t instanceof Date ? Number.isNaN(t.getTime()) ? "" : t.toISOString() : String(t);
25
25
  return _.has(n.slice(0, 10));
26
26
  }
27
- function b(t, n) {
27
+ function I(t, n) {
28
28
  if (f(t)) return "";
29
29
  const e = typeof t == "string" ? t.match(/^(\d{4})-(\d{2})-(\d{2})(?:T00:00:00(?:\.000)?Z)?$/) : null, r = e ? new Date(Number(e[1]), Number(e[2]) - 1, Number(e[3])) : new Date(t);
30
30
  return new Intl.DateTimeFormat("en-US", {
@@ -73,13 +73,16 @@ function y(t) {
73
73
  a = "en-US";
74
74
  l = (t == null ? void 0 : t.compact) === !0;
75
75
  }
76
- function U(t, n) {
76
+ function U() {
77
+ return a;
78
+ }
79
+ function E(t, n) {
77
80
  const e = n.trim().toLowerCase();
78
81
  if (!e) return !0;
79
82
  const r = t.toLowerCase();
80
83
  return e.split(/\s+/).every((i) => r.includes(i));
81
84
  }
82
- function E(t) {
85
+ function C(t) {
83
86
  if (t == null || Number.isNaN(t)) return "—";
84
87
  const n = Math.max(0, t);
85
88
  if (n < 1) return `${Math.max(1, Math.round(n * 60))}m`;
@@ -93,7 +96,7 @@ function E(t) {
93
96
  const r = Math.floor(e / 30), i = Math.round(e - r * 30);
94
97
  return i > 0 ? `${r}mo ${i}d` : `${r}mo`;
95
98
  }
96
- function C(t) {
99
+ function O(t) {
97
100
  if (s === "exact") return m(t);
98
101
  const n = new Date(t), e = g() - n.getTime(), r = Math.floor(e / 6e4);
99
102
  if (r < 1) return "just now";
@@ -114,23 +117,23 @@ const d = {
114
117
  }, S = {
115
118
  _and: [...d._and, { account_kind: { _null: !0 } }]
116
119
  };
117
- function O(t) {
120
+ function Z(t) {
118
121
  return t ? d : S;
119
122
  }
120
- function Z(t) {
123
+ function A(t) {
121
124
  const n = String(t ?? "");
122
125
  return n.startsWith("$t:") ? T(n.slice(3).replace(/-/g, "_")) : n;
123
126
  }
124
- function A(t) {
127
+ function R(t) {
125
128
  return t == null ? "—" : l && Math.abs(t) >= 1e4 ? new Intl.NumberFormat(a, {
126
129
  notation: "compact",
127
130
  maximumFractionDigits: 1
128
131
  }).format(t) : t.toLocaleString(a);
129
132
  }
130
- function R(t) {
133
+ function B(t) {
131
134
  return t == null ? "—" : t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(1)} KB` : t < 1024 * 1024 * 1024 ? `${(t / (1024 * 1024)).toFixed(1)} MB` : `${(t / (1024 * 1024 * 1024)).toFixed(2)} GB`;
132
135
  }
133
- function B(t) {
136
+ function P(t) {
134
137
  if (!t) return null;
135
138
  const n = t.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("");
136
139
  return N[n];
@@ -138,22 +141,23 @@ function B(t) {
138
141
  export {
139
142
  d as ACTIVE_USER_OPTION_FILTER,
140
143
  S as PEOPLE_USER_OPTION_FILTER,
141
- Z as choiceLabel,
144
+ A as choiceLabel,
142
145
  F as cn,
143
- b as formatDate,
146
+ I as formatDate,
144
147
  m as formatDateTime,
145
- R as formatFileSize,
146
- A as formatNumber,
147
- C as formatRelative,
148
- I as getDisplayTimezone,
149
- E as humanHours,
148
+ B as formatFileSize,
149
+ R as formatNumber,
150
+ O as formatRelative,
151
+ b as getDisplayTimezone,
152
+ C as humanHours,
150
153
  f as isNullDate,
151
- U as matchesAllTokens,
152
- B as resolveCollectionIcon,
154
+ E as matchesAllTokens,
155
+ U as numberLocale,
156
+ P as resolveCollectionIcon,
153
157
  M as setDisplayTimezone,
154
158
  y as setNumberFormat,
155
159
  x as setTimeDisplay,
156
160
  T as titleCase,
157
161
  L as toLocalDateString,
158
- O as userOptionFilter
162
+ Z as userOptionFilter
159
163
  };
@@ -4,7 +4,7 @@ import { useOptionalNivaroClient as z } from "../context.js";
4
4
  import { post as p, del as M, patch as D, put as ie, get as re } from "./commands.js";
5
5
  import { toastError as $ } from "./error-toast.js";
6
6
  const oe = {
7
- state: "open",
7
+ state: "closed",
8
8
  width: 320,
9
9
  tab: "watching",
10
10
  sort: "mine"
@@ -1,19 +1,33 @@
1
- function n(t, r) {
2
- return t == null ? "—" : typeof t == "number" ? r === "currency" ? new Intl.NumberFormat(void 0, {
3
- minimumFractionDigits: 2,
4
- maximumFractionDigits: 2
5
- }).format(t) : r === "integer" ? new Intl.NumberFormat().format(Math.round(t)) : r === "percent" ? `${new Intl.NumberFormat(void 0, {
6
- minimumFractionDigits: 1,
7
- maximumFractionDigits: 1
8
- }).format(t)}%` : new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }).format(t) : String(t);
1
+ import { toFiniteNumber as m, formatCurrency as o } from "./number-format.js";
2
+ function u(t) {
3
+ const r = String(t ?? "").trim();
4
+ return r === "$" || r === "US$" || r.toUpperCase() === "USD";
9
5
  }
10
- function i(t, r) {
6
+ function c(t, r, e) {
7
+ if (t == null) return "—";
8
+ const n = typeof t == "number" ? t : r ? m(t) : null;
9
+ if (n != null && Number.isFinite(n)) {
10
+ if (r === "currency") {
11
+ const i = String((e == null ? void 0 : e.prefix) ?? "").trim();
12
+ return i && !u(i) ? new Intl.NumberFormat(void 0, {
13
+ minimumFractionDigits: 2,
14
+ maximumFractionDigits: 2
15
+ }).format(n) : o(n);
16
+ }
17
+ return r === "integer" ? new Intl.NumberFormat().format(Math.round(n)) : r === "percent" ? `${new Intl.NumberFormat(void 0, {
18
+ minimumFractionDigits: 1,
19
+ maximumFractionDigits: 1
20
+ }).format(n)}%` : new Intl.NumberFormat(void 0, { maximumFractionDigits: 2 }).format(n);
21
+ }
22
+ return String(t);
23
+ }
24
+ function x(t, r) {
11
25
  return t == null ? { prefix: "", suffix: "" } : {
12
- prefix: String((r == null ? void 0 : r.prefix) ?? ""),
26
+ prefix: (r == null ? void 0 : r.format) === "currency" && u(r == null ? void 0 : r.prefix) ? "" : String((r == null ? void 0 : r.prefix) ?? ""),
13
27
  suffix: String((r == null ? void 0 : r.suffix) ?? "")
14
28
  };
15
29
  }
16
30
  export {
17
- i as affixesFor,
18
- n as formatWidgetValue
31
+ x as affixesFor,
32
+ c as formatWidgetValue
19
33
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nivaro/react",
3
- "version": "0.3.139",
3
+ "version": "0.3.141",
4
4
  "description": "React hooks and components for Nivaro CMS forms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",