@declarion/react 0.87.0 → 0.88.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist-lib/app.js +28 -28
  2. package/dist-lib/components/actions/ActionButton.js +86 -85
  3. package/dist-lib/components/actions/ActionResultDialog.impl.js +47 -47
  4. package/dist-lib/components/actions/ActionRunner.js +47 -47
  5. package/dist-lib/components/actions/ObjectActionBar.js +9 -9
  6. package/dist-lib/components/actions/RowActionsKebab.js +19 -19
  7. package/dist-lib/components/agents/AgentChatPanel.impl.js +53 -53
  8. package/dist-lib/components/chrome/AssociationTabs.js +21 -21
  9. package/dist-lib/components/chrome/RecordHeader.js +33 -40
  10. package/dist-lib/components/detail-layout/AssociatedBlock.js +387 -381
  11. package/dist-lib/components/detail-layout/ChildrenBlock.js +12 -13
  12. package/dist-lib/components/detail-layout/ChildrenTimeline.js +198 -198
  13. package/dist-lib/components/detail-layout/DraggableChildrenTable.js +114 -114
  14. package/dist-lib/components/detail-layout/EditableChildrenTable.js +160 -160
  15. package/dist-lib/components/detail-layout/EvidenceBlock.js +20 -21
  16. package/dist-lib/components/detail-layout/PropertiesBlock.js +45 -39
  17. package/dist-lib/components/detail-layout/QuickAddForm.js +9 -9
  18. package/dist-lib/components/detail-layout/TimelineComposer.js +87 -89
  19. package/dist-lib/components/detail-layout/widgets/EntityScorecardWidget.js +100 -99
  20. package/dist-lib/components/fields/FileReferenceField.js +9 -9
  21. package/dist-lib/components/fields/StructureField.js +57 -47
  22. package/dist-lib/components/fields/TimestampField.js +59 -54
  23. package/dist-lib/components/fields/cells/factories/money.js +14 -23
  24. package/dist-lib/components/fields/cells/factories/nextRun.js +1 -1
  25. package/dist-lib/components/fields/cells/factories/text.js +18 -3
  26. package/dist-lib/components/fields/cells/factories/timestamp.js +24 -12
  27. package/dist-lib/components/file-widgets/DocumentCard.js +108 -106
  28. package/dist-lib/components/layout/Layout.js +306 -361
  29. package/dist-lib/components/layout/Rail.js +42 -41
  30. package/dist-lib/components/layout/Sidebar.js +132 -117
  31. package/dist-lib/components/layout/TabStrip.js +116 -115
  32. package/dist-lib/components/layout/TenantChip.js +47 -54
  33. package/dist-lib/components/layout/TopBar.js +108 -105
  34. package/dist-lib/components/list/InlineEditCell.js +23 -23
  35. package/dist-lib/components/list/QuickPeek.js +65 -66
  36. package/dist-lib/components/pages/DocumentsMenu.js +42 -42
  37. package/dist-lib/components/pages/ExportMenu.js +25 -25
  38. package/dist-lib/components/pages/RecordDocumentsPanel.js +35 -35
  39. package/dist-lib/components/pages/RecordNotesPanel.js +94 -93
  40. package/dist-lib/components/pages/SmartDetailPage.impl.js +421 -417
  41. package/dist-lib/components/pages/SmartListPage.impl.js +293 -295
  42. package/dist-lib/components/pages/SmartRecordListPage.impl.js +310 -310
  43. package/dist-lib/components/pages/auth/AuthShell.js +73 -73
  44. package/dist-lib/components/pages/auth/SignIn.js +32 -32
  45. package/dist-lib/components/pages/auth/SignUp.impl.js +3 -3
  46. package/dist-lib/components/pages/auth/SignUpCode.js +9 -9
  47. package/dist-lib/components/pages/list/ListFloatbar.js +12 -12
  48. package/dist-lib/components/pages/list/ListHeader.js +19 -19
  49. package/dist-lib/components/pages/list/ListNoRows.js +15 -15
  50. package/dist-lib/components/pages/list/ListToolbar.js +145 -145
  51. package/dist-lib/components/pages/list/useActiveView.js +14 -5
  52. package/dist-lib/components/pages/list/useListQuery.js +121 -81
  53. package/dist-lib/components/pages/list/useListRowInteraction.js +70 -70
  54. package/dist-lib/components/pages/list/useRowMenu.js +7 -7
  55. package/dist-lib/components/pages/profile/Preferences.impl.js +81 -78
  56. package/dist-lib/components/pages/profile/Profile.impl.js +191 -189
  57. package/dist-lib/components/pages/tenant-params/TenantParamsPage.impl.js +166 -158
  58. package/dist-lib/components/shared/ChangePasswordDialog.impl.js +23 -23
  59. package/dist-lib/components/shared/MarkdownRenderer.js +9 -9
  60. package/dist-lib/hooks/useAuth.js +11 -11
  61. package/dist-lib/hooks/useBranding.js +4 -4
  62. package/dist-lib/hooks/useDisplayTimeZone.js +8 -0
  63. package/dist-lib/hooks/useFollowAgentOpen.js +24 -24
  64. package/dist-lib/hooks/useImpersonation.js +6 -6
  65. package/dist-lib/hooks/useMutations.js +23 -23
  66. package/dist-lib/hooks/useObjectStatus.js +5 -5
  67. package/dist-lib/hooks/useParams.js +59 -51
  68. package/dist-lib/hooks/useProperties.js +8 -8
  69. package/dist-lib/hooks/useRowTenant.js +18 -6
  70. package/dist-lib/hooks/useText.js +9 -7
  71. package/dist-lib/hooks/useUiPreferences.js +71 -0
  72. package/dist-lib/index.d.ts +22 -6
  73. package/dist-lib/index.js +127 -126
  74. package/dist-lib/lib/actions.js +116 -84
  75. package/dist-lib/lib/child-config.js +10 -1
  76. package/dist-lib/lib/format-count.js +16 -1
  77. package/dist-lib/lib/language.js +23 -21
  78. package/dist-lib/lib/money-text.js +29 -0
  79. package/dist-lib/lib/profile.js +4 -0
  80. package/dist-lib/lib/role-label.js +8 -0
  81. package/dist-lib/lib/schema-routing.js +34 -14
  82. package/dist-lib/lib/shortcut.js +10 -0
  83. package/dist-lib/lib/timestamp.js +93 -31
  84. package/dist-lib/stores/auth.js +9 -8
  85. package/dist-lib/stores/preferences.js +56 -17
  86. package/dist-lib/testing.d.ts +1 -1
  87. package/dist-lib/testing.js +25 -28
  88. package/dist-lib/types/schema.js +33 -27
  89. package/dist-lib/{useResponsiveMode-D3SKz5z4.d.ts → useResponsiveMode-9_eJT18k.d.ts} +5 -5
  90. package/package.json +1 -1
package/dist-lib/app.js CHANGED
@@ -4,22 +4,22 @@ import { SmartDetailPage as r } from "./components/pages/SmartDetailPage.js";
4
4
  import { SmartListPage as i } from "./components/pages/SmartListPage.js";
5
5
  import { SmartRecordListPage as a } from "./components/pages/SmartRecordListPage.js";
6
6
  import { useFirstScreenSettledOnInput as o } from "./lib/capabilityPrefetch.js";
7
- import { useAuthStore as s } from "./stores/auth.js";
8
- import { useSchema as c } from "./hooks/useSchema.js";
7
+ import { usePreferencesStore as s } from "./stores/preferences.js";
8
+ import { useAuthStore as c } from "./stores/auth.js";
9
+ import { useSchema as l } from "./hooks/useSchema.js";
9
10
  import { useLanguage as ee } from "./hooks/useLanguage.js";
10
- import { ResponsiveModeProvider as l } from "./hooks/useResponsiveMode.js";
11
- import { setIconRegistry as u } from "./stores/icon-registry.js";
12
- import { isValidLogoUrl as d } from "./lib/branding.js";
13
- import { usePublicParams as f } from "./hooks/useParams.js";
14
- import { useBranding as p } from "./hooks/useBranding.js";
15
- import { usePreferencesStore as m } from "./stores/preferences.js";
11
+ import { ResponsiveModeProvider as u } from "./hooks/useResponsiveMode.js";
12
+ import { usePublicParams as d } from "./hooks/useParams.js";
13
+ import { setIconRegistry as f } from "./stores/icon-registry.js";
14
+ import { isValidLogoUrl as p } from "./lib/branding.js";
15
+ import { useBranding as m } from "./hooks/useBranding.js";
16
16
  import { EmbedAuthBootstrap as h } from "./embed/EmbedAuthBootstrap.js";
17
- import { DEFAULT_PAGE_STATE_TTL_MS as g } from "./stores/page-state.js";
18
- import { applyRetainedReadGcTime as _ } from "./hooks/usePageStateRuntime.js";
19
- import { useBrandingBreakpoints as v, useBrandingViewport as y } from "./hooks/useBrandingChrome.js";
20
- import { Layout as b } from "./components/layout/Layout.js";
21
- import { BlankScreen as x } from "./components/shared/BlankScreen.js";
22
- import { schemaDefaultRoute as S } from "./lib/schema-routing.js";
17
+ import { schemaDefaultRoute as g } from "./lib/schema-routing.js";
18
+ import { DEFAULT_PAGE_STATE_TTL_MS as _ } from "./stores/page-state.js";
19
+ import { applyRetainedReadGcTime as v } from "./hooks/usePageStateRuntime.js";
20
+ import { useBrandingBreakpoints as y, useBrandingViewport as b } from "./hooks/useBrandingChrome.js";
21
+ import { Layout as x } from "./components/layout/Layout.js";
22
+ import { BlankScreen as S } from "./components/shared/BlankScreen.js";
23
23
  import { SignIn as C } from "./components/pages/auth/SignIn.js";
24
24
  import { SignUp as te } from "./components/pages/auth/SignUp.js";
25
25
  import { Forgot as w } from "./components/pages/auth/Forgot.js";
@@ -50,7 +50,7 @@ var Z = "declarion-managed-favicon", Q = new U({ defaultOptions: { queries: {
50
50
  retry: P,
51
51
  retryDelay: e
52
52
  } } });
53
- _(Q, g);
53
+ v(Q, _);
54
54
  function $(e) {
55
55
  if (typeof window > "u") return null;
56
56
  try {
@@ -64,7 +64,7 @@ function se({ component: e, screenCode: t }) {
64
64
  return o(), /* @__PURE__ */ K(e, { screenCode: t });
65
65
  }
66
66
  function ce() {
67
- let { data: e } = c();
67
+ let { data: e } = l();
68
68
  return {
69
69
  routes: H(() => {
70
70
  if (!e) return [];
@@ -108,25 +108,25 @@ function ce() {
108
108
  }
109
109
  return t;
110
110
  }, [e]),
111
- defaultRoute: H(() => S(e), [e])
111
+ defaultRoute: H(() => g(e), [e])
112
112
  };
113
113
  }
114
114
  function le() {
115
- let e = s((e) => e.initialize), t = s((e) => e.isLoading), r = s((e) => e.isAuthenticated), { data: i, isError: a } = c(), o = ee(), { data: l, isLoading: m } = f(), { branding: h, isLoading: g } = p(), { routes: _, defaultRoute: v } = ce(), y = n();
115
+ let e = c((e) => e.initialize), t = c((e) => e.isLoading), r = c((e) => e.isAuthenticated), { data: i, isError: a } = l(), o = ee(), { data: s, isLoading: u } = d(), { branding: h, isLoading: g } = m(), { routes: _, defaultRoute: v } = ce(), y = n();
116
116
  V(() => {
117
117
  document.documentElement.lang = o;
118
118
  }, [o]);
119
- let S = typeof window < "u" && window.self !== window.top && !y.enabled;
119
+ let b = typeof window < "u" && window.self !== window.top && !y.enabled;
120
120
  V(() => {
121
- y.enabled || S || e();
121
+ y.enabled || b || e();
122
122
  }, [
123
123
  y.enabled,
124
- S,
124
+ b,
125
125
  e
126
126
  ]);
127
127
  let k = i?.icons;
128
128
  V(() => {
129
- u(k ?? {});
129
+ f(k ?? {});
130
130
  }, [k]);
131
131
  let A = h?.identity, j = h?.theme;
132
132
  V(() => {
@@ -135,7 +135,7 @@ function le() {
135
135
  e && (document.title = e);
136
136
  }, [A?.app_name]), V(() => {
137
137
  if (typeof document > "u") return;
138
- let e = A?.app_logo, t = d(e) ? $(e.trim()) : null, n = document.getElementById(Z);
138
+ let e = A?.app_logo, t = p(e) ? $(e.trim()) : null, n = document.getElementById(Z);
139
139
  if (!t) n && n.remove();
140
140
  else if (n) n.href !== t && (n.href = t);
141
141
  else {
@@ -165,7 +165,7 @@ function le() {
165
165
  n.id = R, n.rel = "stylesheet", n.href = t, document.head.appendChild(n);
166
166
  }, [M]);
167
167
  let P = y.enabled && !r;
168
- return S || P || t || m && !l || g || !i && (r || !a) ? /* @__PURE__ */ K(x, {}) : /* @__PURE__ */ q(ae, { children: [
168
+ return b || P || t || u && !s || g || !i && (r || !a) ? /* @__PURE__ */ K(S, {}) : /* @__PURE__ */ q(ae, { children: [
169
169
  /* @__PURE__ */ K(X, {
170
170
  path: "/login",
171
171
  element: /* @__PURE__ */ K(C, {})
@@ -191,7 +191,7 @@ function le() {
191
191
  element: /* @__PURE__ */ K(E, {})
192
192
  }),
193
193
  /* @__PURE__ */ q(X, {
194
- element: /* @__PURE__ */ K(b, {}),
194
+ element: /* @__PURE__ */ K(x, {}),
195
195
  children: [
196
196
  i && !v && /* @__PURE__ */ K(X, {
197
197
  index: !0,
@@ -229,7 +229,7 @@ function le() {
229
229
  }
230
230
  function ue() {
231
231
  M();
232
- let e = m((e) => e.toastPosition);
232
+ let e = s((e) => e.toastPosition);
233
233
  return /* @__PURE__ */ q(J, { children: [
234
234
  /* @__PURE__ */ K(h, {}),
235
235
  /* @__PURE__ */ K(N, {}),
@@ -250,8 +250,8 @@ function ue() {
250
250
  ] });
251
251
  }
252
252
  function de({ children: e }) {
253
- let t = y(), n = v();
254
- return /* @__PURE__ */ K(l, {
253
+ let t = b(), n = y();
254
+ return /* @__PURE__ */ K(u, {
255
255
  viewport: t,
256
256
  breakpoints: n,
257
257
  children: e
@@ -1,116 +1,117 @@
1
1
  import { useSchema as e } from "../../hooks/useSchema.js";
2
- import { Icon as t } from "../primitives/Icons.js";
3
- import { Btn as n } from "../primitives/Btn.js";
4
- import { IconBtn as r } from "../primitives/IconBtn.js";
5
- import { useText as i } from "../../hooks/useText.js";
6
- import { DynamicIcon as a } from "../shared/DynamicIcon.js";
7
- import { buildActionBody as o, executeAction as s, resolveAssociation as c } from "../../api/data.js";
8
- import { failureTitle as l } from "../../lib/failure.js";
9
- import { useTabNavigate as u } from "../../hooks/useTabNavigate.js";
10
- import { toast as d } from "../../lib/toast.js";
2
+ import { buildActionBody as t, executeAction as n, resolveAssociation as r } from "../../api/data.js";
3
+ import { failureTitle as i } from "../../lib/failure.js";
4
+ import { Icon as a } from "../primitives/Icons.js";
5
+ import { Btn as o } from "../primitives/Btn.js";
6
+ import { IconBtn as s } from "../primitives/IconBtn.js";
7
+ import { useText as c } from "../../hooks/useText.js";
8
+ import { toast as l } from "../../lib/toast.js";
9
+ import { DynamicIcon as u } from "../shared/DynamicIcon.js";
10
+ import { useTabNavigate as d } from "../../hooks/useTabNavigate.js";
11
11
  import { evaluateConditions as f, findListScreenForEntity as p, isAssociationAction as m, rowDetailId as h } from "../../lib/actions.js";
12
12
  import { useActionRunner as g } from "./ActionRunner.js";
13
13
  import { executeUISteps as _, isUIAction as v } from "../../lib/ui-actions.js";
14
- import { useCallback as y, useState as b } from "react";
15
- import { jsx as x } from "react/jsx-runtime";
14
+ import { useConditionCaller as y } from "../../hooks/useRowTenant.js";
15
+ import { useCallback as b, useState as x } from "react";
16
+ import { jsx as S } from "react/jsx-runtime";
16
17
  //#region src/components/actions/ActionButton.tsx
17
- function S({ actionCode: S, action: C, entityCode: w, objectIds: T = [], row: E, variant: D = "outline", size: O = "default", onSuccess: k }) {
18
- let A = i(), j = i("errors"), [M, N] = b(!1), [P, F] = b(!1), { data: I } = e(), L = u(), { run: R } = g(), z = m(C), B = !E || f(C.conditions, E), V = y(async () => {
19
- if (C.association && T.length !== 0) {
20
- N(!0);
18
+ function C({ actionCode: C, action: w, entityCode: T, objectIds: E = [], row: D, variant: O = "outline", size: k = "default", onSuccess: A }) {
19
+ let j = c(), M = c("errors"), [N, P] = x(!1), [F, I] = x(!1), { data: L } = e(), R = d(), { run: z } = g(), B = m(w), V = y(), H = !D || f(w.conditions, D, V), U = b(async () => {
20
+ if (w.association && E.length !== 0) {
21
+ P(!0);
21
22
  try {
22
- let e = w ? `${w}.${C.association}` : C.association, t = await c(e, T), n = p(I, t.target_entity);
23
+ let e = T ? `${T}.${w.association}` : w.association, t = await r(e, E), n = p(L, t.target_entity);
23
24
  if (!n) {
24
- d.error(j("action.list_screen_missing", "No list screen is declared for this entity."), t.target_entity);
25
+ l.error(M("action.list_screen_missing", "No list screen is declared for this entity."), t.target_entity);
25
26
  return;
26
27
  }
27
- let r = I?.entities[t.target_entity], i = A(C.display?.name) || t.target_entity;
28
+ let i = L?.entities[t.target_entity], a = j(w.display?.name) || t.target_entity;
28
29
  if (t.ids.length === 0) {
29
- d.info(A("action.association.none_related", "No related {name} found", { name: i }));
30
+ l.info(j("action.association.none_related", "No related {name} found", { name: a }));
30
31
  return;
31
32
  }
32
- let a = r?.fields.names().find((e) => r.fields.get(e)?.primary) ?? "id", o = new URLSearchParams();
33
- o.set(`filter_${a}`, t.ids.join(",")), L(n.route, {
34
- title: i,
35
- icon: C.display?.icon || n.icon,
36
- search: o.toString()
37
- }), k?.();
33
+ let o = i?.fields.names().find((e) => i.fields.get(e)?.primary) ?? "id", s = new URLSearchParams();
34
+ s.set(`filter_${o}`, t.ids.join(",")), R(n.route, {
35
+ title: a,
36
+ icon: w.display?.icon || n.icon,
37
+ search: s.toString()
38
+ }), A?.();
38
39
  } catch (e) {
39
- d.error(l(j, e));
40
+ l.error(i(M, e));
40
41
  } finally {
41
- N(!1);
42
+ P(!1);
42
43
  }
43
44
  }
44
45
  }, [
45
- A,
46
46
  j,
47
- C,
47
+ M,
48
48
  w,
49
49
  T,
50
- I,
50
+ E,
51
51
  L,
52
- k
53
- ]), H = C.entity ? `${C.entity}.${S}` : S, U = T.length > 0 ? T : void 0, W = y(() => {
54
- F(!0), R({
55
- action: C,
56
- title: A(C.display?.name) || S,
57
- row: E,
58
- entity: w,
59
- execute: (e) => s(H, o(e, U)),
60
- onSuccess: () => k?.()
61
- }).finally(() => F(!1));
62
- }, [
63
- A,
64
52
  R,
65
- C,
66
- S,
67
- E,
68
- w,
69
- H,
70
- U,
71
- k
72
- ]), G = y(() => {
73
- if (v(C)) _(j, C.ui_steps, { row: E }).then(() => k?.());
74
- else if (z) V();
75
- else if (C.href && !C.handler && !C.association) {
76
- let e = w ? I?.entities[w] : void 0, t = h(E, e), n = C.href;
77
- w && (n = n.replaceAll("${entity}", w)), t && (n = n.replaceAll("${id}", encodeURIComponent(t))), L(n, {
78
- title: A(C.display?.name) || S,
79
- icon: C.display?.icon
80
- }), k?.();
81
- } else W();
53
+ A
54
+ ]), W = w.entity ? `${w.entity}.${C}` : C, G = E.length > 0 ? E : void 0, K = b(() => {
55
+ I(!0), z({
56
+ action: w,
57
+ title: j(w.display?.name) || C,
58
+ row: D,
59
+ entity: T,
60
+ execute: (e) => n(W, t(e, G)),
61
+ onSuccess: () => A?.()
62
+ }).finally(() => I(!1));
82
63
  }, [
83
- A,
84
64
  j,
85
- C,
86
- E,
87
- w,
88
- I?.entities,
89
- S,
90
- L,
91
65
  z,
92
- V,
66
+ w,
67
+ C,
68
+ D,
69
+ T,
93
70
  W,
94
- k
95
- ]), K = A(C.display?.name), q = C.display?.icon, J = q && t[q], Y = J ? /* @__PURE__ */ x(J, { size: 13 }) : q ? /* @__PURE__ */ x(a, {
96
- name: q,
71
+ G,
72
+ A
73
+ ]), q = b(() => {
74
+ if (v(w)) _(M, w.ui_steps, { row: D }).then(() => A?.());
75
+ else if (B) U();
76
+ else if (w.href && !w.handler && !w.association) {
77
+ let e = T ? L?.entities[T] : void 0, t = h(D, e), n = w.href;
78
+ T && (n = n.replaceAll("${entity}", T)), t && (n = n.replaceAll("${id}", encodeURIComponent(t))), R(n, {
79
+ title: j(w.display?.name) || C,
80
+ icon: w.display?.icon
81
+ }), A?.();
82
+ } else K();
83
+ }, [
84
+ j,
85
+ M,
86
+ w,
87
+ D,
88
+ T,
89
+ L?.entities,
90
+ C,
91
+ R,
92
+ B,
93
+ U,
94
+ K,
95
+ A
96
+ ]), J = j(w.display?.name), Y = w.display?.icon, X = Y && a[Y], Z = X ? /* @__PURE__ */ S(X, { size: 13 }) : Y ? /* @__PURE__ */ S(u, {
97
+ name: Y,
97
98
  size: 13
98
- }) : null, X = !B || P || M;
99
- return O === "icon" ? /* @__PURE__ */ x(r, {
100
- icon: Y ?? /* @__PURE__ */ x(t.bolt, { size: 13 }),
101
- onClick: G,
102
- title: K
103
- }) : /* @__PURE__ */ x(n, {
104
- kind: D === "default" ? "primary" : D === "ghost" ? "ghost" : "default",
99
+ }) : null, Q = !H || F || N;
100
+ return k === "icon" ? /* @__PURE__ */ S(s, {
101
+ icon: Z ?? /* @__PURE__ */ S(a.bolt, { size: 13 }),
102
+ onClick: q,
103
+ title: J
104
+ }) : /* @__PURE__ */ S(o, {
105
+ kind: O === "default" ? "primary" : O === "ghost" ? "ghost" : "default",
105
106
  size: "sm",
106
- icon: Y,
107
- danger: C.destructive,
108
- onClick: G,
109
- disabled: X,
110
- title: K,
111
- "aria-label": K,
112
- children: K
107
+ icon: Z,
108
+ danger: w.destructive,
109
+ onClick: q,
110
+ disabled: Q,
111
+ title: J,
112
+ "aria-label": J,
113
+ children: J
113
114
  });
114
115
  }
115
116
  //#endregion
116
- export { S as ActionButton };
117
+ export { C as ActionButton };
@@ -1,19 +1,19 @@
1
- import { Icon as e } from "../primitives/Icons.js";
2
- import { Btn as t } from "../primitives/Btn.js";
3
- import { IconBtn as n } from "../primitives/IconBtn.js";
4
- import { useText as r } from "../../hooks/useText.js";
5
- import { isExternalHref as i, safeExternalUrl as a } from "../../lib/safe-url.js";
6
- import { downloadFile as o } from "../../lib/download.js";
7
- import { failureTitle as s } from "../../lib/failure.js";
1
+ import { isExternalHref as e, safeExternalUrl as t } from "../../lib/safe-url.js";
2
+ import { downloadFile as n } from "../../lib/download.js";
3
+ import { failureTitle as r } from "../../lib/failure.js";
4
+ import { Icon as i } from "../primitives/Icons.js";
5
+ import { Btn as a } from "../primitives/Btn.js";
6
+ import { IconBtn as o } from "../primitives/IconBtn.js";
7
+ import { useText as s } from "../../hooks/useText.js";
8
8
  import { CopyButton as c } from "../shared/CopyButton.js";
9
9
  import { useEffect as l, useRef as u, useState as d } from "react";
10
10
  import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
11
11
  //#region src/components/actions/ActionResultDialog.impl.tsx
12
- function h({ open: i, onClose: a, display: o }) {
13
- let s = r(), c = u(null);
12
+ function h({ open: e, onClose: t, display: n }) {
13
+ let r = s(), c = u(null);
14
14
  return l(() => {
15
- i && c.current?.focus();
16
- }, [i]), i ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", { style: {
15
+ e && c.current?.focus();
16
+ }, [e]), e ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", { style: {
17
17
  position: "fixed",
18
18
  inset: 0,
19
19
  background: "var(--scrim)",
@@ -23,10 +23,10 @@ function h({ open: i, onClose: a, display: o }) {
23
23
  ref: c,
24
24
  role: "dialog",
25
25
  "aria-modal": "true",
26
- "aria-label": o.title ?? s("action.result.title", "Action Result"),
26
+ "aria-label": n.title ?? r("action.result.title", "Action Result"),
27
27
  tabIndex: -1,
28
28
  onKeyDown: (e) => {
29
- e.key === "Escape" && a();
29
+ e.key === "Escape" && t();
30
30
  },
31
31
  style: {
32
32
  position: "fixed",
@@ -67,7 +67,7 @@ function h({ open: i, onClose: a, display: o }) {
67
67
  justifyContent: "center",
68
68
  flexShrink: 0
69
69
  },
70
- children: /* @__PURE__ */ p(e.check, { size: 15 })
70
+ children: /* @__PURE__ */ p(i.check, { size: 15 })
71
71
  }),
72
72
  /* @__PURE__ */ m("div", {
73
73
  style: {
@@ -80,23 +80,23 @@ function h({ open: i, onClose: a, display: o }) {
80
80
  fontWeight: 600,
81
81
  color: "var(--text)"
82
82
  },
83
- children: o.title ?? s("action.result.title", "Action Result")
84
- }), o.message && /* @__PURE__ */ p("div", {
83
+ children: n.title ?? r("action.result.title", "Action Result")
84
+ }), n.message && /* @__PURE__ */ p("div", {
85
85
  style: {
86
86
  fontSize: 11.5,
87
87
  color: "var(--text-3)",
88
88
  marginTop: 2
89
89
  },
90
- children: o.message
90
+ children: n.message
91
91
  })]
92
92
  }),
93
- /* @__PURE__ */ p(n, {
94
- icon: /* @__PURE__ */ p(e.x, { size: 14 }),
95
- onClick: a
93
+ /* @__PURE__ */ p(o, {
94
+ icon: /* @__PURE__ */ p(i.x, { size: 14 }),
95
+ onClick: t
96
96
  })
97
97
  ]
98
98
  }),
99
- o.fields && o.fields.length > 0 && /* @__PURE__ */ p("div", {
99
+ n.fields && n.fields.length > 0 && /* @__PURE__ */ p("div", {
100
100
  style: {
101
101
  padding: "12px 18px 16px",
102
102
  display: "flex",
@@ -104,10 +104,10 @@ function h({ open: i, onClose: a, display: o }) {
104
104
  gap: 12,
105
105
  overflowY: "auto"
106
106
  },
107
- children: o.fields.map((e, t) => /* @__PURE__ */ p(g, {
107
+ children: n.fields.map((e, n) => /* @__PURE__ */ p(g, {
108
108
  field: e,
109
- onNavigate: a
110
- }, t))
109
+ onNavigate: t
110
+ }, n))
111
111
  }),
112
112
  /* @__PURE__ */ m("div", {
113
113
  style: {
@@ -121,24 +121,24 @@ function h({ open: i, onClose: a, display: o }) {
121
121
  background: "var(--surface-2)",
122
122
  flexShrink: 0
123
123
  },
124
- children: [/* @__PURE__ */ p("div", { style: { flex: 1 } }), /* @__PURE__ */ p(t, {
124
+ children: [/* @__PURE__ */ p("div", { style: { flex: 1 } }), /* @__PURE__ */ p(a, {
125
125
  kind: "primary",
126
- onClick: a,
127
- children: s("dialog.close", "Close")
126
+ onClick: t,
127
+ children: r("dialog.close", "Close")
128
128
  })]
129
129
  })
130
130
  ]
131
131
  })] }) : null;
132
132
  }
133
- function g({ field: t, onNavigate: n }) {
134
- let l = r(), u = r("errors"), f = t.href ?? t.download_url ?? t.value, h = t.type === "download", g = h || t.type === "link", _ = f ? a(f) : void 0, [v, y] = d(!1), [b, x] = d(null);
133
+ function g({ field: a, onNavigate: o }) {
134
+ let l = s(), u = s("errors"), f = a.href ?? a.download_url ?? a.value, h = a.type === "download", g = h || a.type === "link", _ = f ? t(f) : void 0, [v, y] = d(!1), [b, x] = d(null);
135
135
  async function S() {
136
136
  if (_) {
137
137
  y(!0), x(null);
138
138
  try {
139
- await o(u, _, t.filename);
139
+ await n(u, _, a.filename);
140
140
  } catch (e) {
141
- x(s(u, e));
141
+ x(r(u, e));
142
142
  } finally {
143
143
  y(!1);
144
144
  }
@@ -161,7 +161,7 @@ function g({ field: t, onNavigate: n }) {
161
161
  fontWeight: 500,
162
162
  textDecoration: "none",
163
163
  whiteSpace: "nowrap"
164
- }, w = g && !h, T = i(_), E = {
164
+ }, w = g && !h, T = e(_), E = {
165
165
  flex: 1,
166
166
  minWidth: 0,
167
167
  display: "inline-flex",
@@ -185,7 +185,7 @@ function g({ field: t, onNavigate: n }) {
185
185
  fontWeight: 500,
186
186
  color: "var(--text-3)"
187
187
  },
188
- children: t.label
188
+ children: a.label
189
189
  }),
190
190
  h && _ && /* @__PURE__ */ m("button", {
191
191
  type: "button",
@@ -195,7 +195,7 @@ function g({ field: t, onNavigate: n }) {
195
195
  ...C,
196
196
  cursor: v ? "default" : "pointer"
197
197
  },
198
- children: [p(v ? e.loader : e.download, { size: 14 }), /* @__PURE__ */ p("span", { children: v ? l("action.result.downloading", "Downloading…") : l("action.result.download", "Download") })]
198
+ children: [p(v ? i.loader : i.download, { size: 14 }), /* @__PURE__ */ p("span", { children: v ? l("action.result.downloading", "Downloading…") : l("action.result.download", "Download") })]
199
199
  }),
200
200
  b && /* @__PURE__ */ p("div", {
201
201
  style: {
@@ -216,8 +216,8 @@ function g({ field: t, onNavigate: n }) {
216
216
  target: "_blank",
217
217
  rel: "noopener noreferrer",
218
218
  style: E,
219
- title: t.value,
220
- children: [/* @__PURE__ */ p(e.link, {
219
+ title: a.value,
220
+ children: [/* @__PURE__ */ p(i.link, {
221
221
  size: 14,
222
222
  style: { flexShrink: 0 }
223
223
  }), /* @__PURE__ */ p("span", {
@@ -226,14 +226,14 @@ function g({ field: t, onNavigate: n }) {
226
226
  textOverflow: "ellipsis",
227
227
  whiteSpace: "nowrap"
228
228
  },
229
- children: t.value
229
+ children: a.value
230
230
  })]
231
231
  }) : /* @__PURE__ */ m("a", {
232
232
  href: _,
233
- onClick: n,
233
+ onClick: o,
234
234
  style: E,
235
- title: t.value,
236
- children: [/* @__PURE__ */ p(e.link, {
235
+ title: a.value,
236
+ children: [/* @__PURE__ */ p(i.link, {
237
237
  size: 14,
238
238
  style: { flexShrink: 0 }
239
239
  }), /* @__PURE__ */ p("span", {
@@ -242,33 +242,33 @@ function g({ field: t, onNavigate: n }) {
242
242
  textOverflow: "ellipsis",
243
243
  whiteSpace: "nowrap"
244
244
  },
245
- children: t.value
245
+ children: a.value
246
246
  })]
247
- }), t.copyable && /* @__PURE__ */ p(c, { value: t.value })]
247
+ }), a.copyable && /* @__PURE__ */ p(c, { value: a.value })]
248
248
  }) : /* @__PURE__ */ m("div", {
249
249
  style: {
250
250
  position: "relative",
251
251
  width: "100%"
252
252
  },
253
253
  children: [/* @__PURE__ */ p("div", {
254
- className: t.monospace ? "mono" : void 0,
254
+ className: a.monospace ? "mono" : void 0,
255
255
  style: {
256
256
  borderRadius: "var(--radius-md)",
257
257
  border: "1px solid var(--border)",
258
258
  background: "var(--surface-2)",
259
- padding: t.copyable ? "8px 40px 8px 10px" : "8px 10px",
259
+ padding: a.copyable ? "8px 40px 8px 10px" : "8px 10px",
260
260
  fontSize: 12.5,
261
261
  wordBreak: "break-all",
262
262
  color: "var(--text)"
263
263
  },
264
- children: t.value
265
- }), t.copyable && /* @__PURE__ */ p("div", {
264
+ children: a.value
265
+ }), a.copyable && /* @__PURE__ */ p("div", {
266
266
  style: {
267
267
  position: "absolute",
268
268
  top: 4,
269
269
  right: 4
270
270
  },
271
- children: /* @__PURE__ */ p(c, { value: t.value })
271
+ children: /* @__PURE__ */ p(c, { value: a.value })
272
272
  })]
273
273
  })
274
274
  ]