@declarion/react 0.83.0 → 0.85.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.
@@ -5,126 +5,129 @@ import { useText as r } from "../../hooks/useText.js";
5
5
  import { useResponsiveMode as i } from "../../hooks/useResponsiveMode.js";
6
6
  import { DynamicIcon as a } from "../shared/DynamicIcon.js";
7
7
  import { useBrandingIdentity as o } from "../../hooks/useBranding.js";
8
- import { useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
9
- import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
8
+ import { screenOffersCreate as s } from "../../lib/actions.js";
9
+ import { useEffect as c, useMemo as l, useRef as u, useState as d } from "react";
10
+ import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
10
11
  //#region src/components/layout/CommandPalette.impl.tsx
11
- var m = "Esc";
12
- function h(t, n = 14) {
12
+ var h = "Esc";
13
+ function g(t, n = 14) {
13
14
  if (!t) return null;
14
15
  let r = e[t];
15
- return r ? /* @__PURE__ */ f(r, { size: n }) : /* @__PURE__ */ f(a, {
16
+ return r ? /* @__PURE__ */ p(r, { size: n }) : /* @__PURE__ */ p(a, {
16
17
  name: t,
17
18
  size: n
18
19
  });
19
20
  }
20
- function g(t, n, r, i) {
21
- if (!n || !r) return [];
22
- let a = [], o = (n) => {
21
+ function _(t, n, r) {
22
+ if (!n?.navigation || !n.screens) return [];
23
+ let { navigation: i, screens: a, entities: o, actions: c } = n, l = [], u = (n) => {
23
24
  if (n.screen) {
24
- let o = r[n.screen];
25
- if (o) {
26
- let r = t(n.name) || n.screen;
27
- a.push({
25
+ let i = a[n.screen];
26
+ if (i) {
27
+ let a = t(n.name) || n.screen;
28
+ l.push({
28
29
  group: t("shell.palette.group.navigate", "Navigate"),
29
- icon: h(n.icon || o.display?.icon || "folder"),
30
- label: t("shell.palette.go_to", "Go to {name}", { name: r }),
31
- act: () => i({
30
+ icon: g(n.icon || i.display?.icon || "folder"),
31
+ label: t("shell.palette.go_to", "Go to {name}", { name: a }),
32
+ act: () => r({
32
33
  type: "nav",
33
34
  id: n.screen,
34
- route: o.route
35
+ route: i.route
35
36
  }),
36
37
  actionType: "nav"
37
- }), o.type === "list" && o.entity && a.push({
38
+ });
39
+ let u = i.entity ? o?.[i.entity] : void 0;
40
+ s(i, u, c) && l.push({
38
41
  group: t("shell.palette.group.create", "Create"),
39
- icon: /* @__PURE__ */ f(e.plus, { size: 14 }),
40
- label: t("shell.palette.new_in_screen", "New {name}", { name: r }),
41
- act: () => i({
42
+ icon: /* @__PURE__ */ p(e.plus, { size: 14 }),
43
+ label: t("shell.palette.new_in_screen", "New {name}", { name: t(u?.display?.name) || a }),
44
+ act: () => r({
42
45
  type: "new",
43
46
  id: n.screen,
44
- route: o.route
47
+ route: i.route
45
48
  }),
46
49
  actionType: "new"
47
50
  });
48
51
  }
49
52
  }
50
- for (let e of n.items || []) o(e);
51
- for (let e of n.children || []) o(e);
53
+ for (let e of n.items || []) u(e);
54
+ for (let e of n.children || []) u(e);
52
55
  };
53
- for (let e of n) o(e);
54
- return a;
56
+ for (let e of i) u(e);
57
+ return l;
55
58
  }
56
- function _({ open: a, onClose: h, onAction: _, mode: v = "default", navigation: y, screens: b, includeAI: x = !0, aiName: S = "" }) {
57
- let C = r(), w = o()?.app_name?.trim(), [T, E] = u(""), [D, O] = u(0), k = l(null), A = i().category === "phone";
58
- s(() => {
59
- a && (setTimeout(() => k.current?.focus(), 50), E(v === "new" ? C("shell.palette.new_in_screen", "New {name}").split("{name}")[0] : ""), O(0));
59
+ function v({ open: a, onClose: s, onAction: g, mode: v = "default", schema: y, includeAI: b = !0, aiName: x = "" }) {
60
+ let S = r(), C = o()?.app_name?.trim(), [w, T] = d(""), [E, D] = d(0), O = u(null), k = i().category === "phone";
61
+ c(() => {
62
+ a && (setTimeout(() => O.current?.focus(), 50), T(v === "new" ? S("shell.palette.new_in_screen", "New {name}").split("{name}")[0] : ""), D(0));
60
63
  }, [
61
64
  a,
62
65
  v,
63
- C
66
+ S
64
67
  ]);
65
- let j = c(() => {
68
+ let A = l(() => {
66
69
  let t = [];
67
- if (t.push(...g(C, y, b, _)), x) {
68
- let n = C("shell.palette.group.ai", "AI");
70
+ if (t.push(..._(S, y, g)), b) {
71
+ let n = S("shell.palette.group.ai", "AI");
69
72
  t.push({
70
73
  group: n,
71
- icon: /* @__PURE__ */ f(e.sparkle, { size: 14 }),
72
- label: C("shell.palette.ai.draft_entity", "Draft YAML for new entity…"),
74
+ icon: /* @__PURE__ */ p(e.sparkle, { size: 14 }),
75
+ label: S("shell.palette.ai.draft_entity", "Draft YAML for new entity…"),
73
76
  hint: "✨",
74
- act: () => _({
77
+ act: () => g({
75
78
  type: "ai",
76
79
  q: "draft entity"
77
80
  }),
78
81
  actionType: "ai"
79
82
  }, {
80
83
  group: n,
81
- icon: /* @__PURE__ */ f(e.sparkle, { size: 14 }),
82
- label: C("shell.palette.ai.explain_record", "Explain this record with AI"),
84
+ icon: /* @__PURE__ */ p(e.sparkle, { size: 14 }),
85
+ label: S("shell.palette.ai.explain_record", "Explain this record with AI"),
83
86
  hint: "✨",
84
- act: () => _({ type: "ai-panel" }),
87
+ act: () => g({ type: "ai-panel" }),
85
88
  actionType: "ai-panel"
86
89
  }, {
87
90
  group: n,
88
- icon: /* @__PURE__ */ f(e.sparkle, { size: 14 }),
89
- label: C("shell.palette.ai.summarize_rows", "Summarize activity on selected rows"),
91
+ icon: /* @__PURE__ */ p(e.sparkle, { size: 14 }),
92
+ label: S("shell.palette.ai.summarize_rows", "Summarize activity on selected rows"),
90
93
  hint: "✨",
91
- act: () => _({ type: "ai-panel" }),
94
+ act: () => g({ type: "ai-panel" }),
92
95
  actionType: "ai-panel"
93
96
  });
94
97
  }
95
- let n = C("shell.palette.group.tabs", "Tabs"), r = C("shell.palette.group.settings", "Settings");
98
+ let n = S("shell.palette.group.tabs", "Tabs"), r = S("shell.palette.group.settings", "Settings");
96
99
  return t.push({
97
100
  group: n,
98
- icon: /* @__PURE__ */ f(e.x, { size: 14 }),
99
- label: C("shell.tabs.close_all", "Close all tabs"),
100
- act: () => _({
101
+ icon: /* @__PURE__ */ p(e.x, { size: 14 }),
102
+ label: S("shell.tabs.close_all", "Close all tabs"),
103
+ act: () => g({
101
104
  type: "tab-close",
102
105
  tabCloseScope: "all"
103
106
  }),
104
107
  actionType: "tab-close"
105
108
  }, {
106
109
  group: n,
107
- icon: /* @__PURE__ */ f(e.x, { size: 14 }),
108
- label: C("shell.tabs.close_other_tabs", "Close other tabs"),
109
- act: () => _({
110
+ icon: /* @__PURE__ */ p(e.x, { size: 14 }),
111
+ label: S("shell.tabs.close_other_tabs", "Close other tabs"),
112
+ act: () => g({
110
113
  type: "tab-close",
111
114
  tabCloseScope: "others"
112
115
  }),
113
116
  actionType: "tab-close"
114
117
  }, {
115
118
  group: n,
116
- icon: /* @__PURE__ */ f(e.x, { size: 14 }),
117
- label: C("shell.tabs.close_right", "Close tabs to the right"),
118
- act: () => _({
119
+ icon: /* @__PURE__ */ p(e.x, { size: 14 }),
120
+ label: S("shell.tabs.close_right", "Close tabs to the right"),
121
+ act: () => g({
119
122
  type: "tab-close",
120
123
  tabCloseScope: "right"
121
124
  }),
122
125
  actionType: "tab-close"
123
126
  }, {
124
127
  group: r,
125
- icon: /* @__PURE__ */ f(e.settings, { size: 14 }),
126
- label: C("shell.palette.open_preferences", "Open Preferences"),
127
- act: () => _({
128
+ icon: /* @__PURE__ */ p(e.settings, { size: 14 }),
129
+ label: S("shell.palette.open_preferences", "Open Preferences"),
130
+ act: () => g({
128
131
  type: "nav",
129
132
  id: "preferences",
130
133
  route: "/preferences"
@@ -132,26 +135,25 @@ function _({ open: a, onClose: h, onAction: _, mode: v = "default", navigation:
132
135
  actionType: "nav"
133
136
  }, {
134
137
  group: r,
135
- icon: /* @__PURE__ */ f(e.moon, { size: 14 }),
136
- label: C("shell.palette.toggle_dark_mode", "Toggle dark mode"),
137
- act: () => _({ type: "theme" }),
138
+ icon: /* @__PURE__ */ p(e.moon, { size: 14 }),
139
+ label: S("shell.palette.toggle_dark_mode", "Toggle dark mode"),
140
+ act: () => g({ type: "theme" }),
138
141
  actionType: "theme"
139
142
  }), v === "new" ? t.filter((e) => e.actionType === "new") : t;
140
143
  }, [
141
- C,
144
+ S,
142
145
  y,
143
146
  b,
144
- x,
145
- _,
147
+ g,
146
148
  v
147
- ]), M = T ? j.filter((e) => e.label.toLowerCase().includes(T.toLowerCase()) || e.group.toLowerCase().includes(T.toLowerCase())) : j, N = {};
148
- return M.forEach((e, t) => {
149
- N[e.group] = N[e.group] || [], N[e.group].push({
149
+ ]), j = w ? A.filter((e) => e.label.toLowerCase().includes(w.toLowerCase()) || e.group.toLowerCase().includes(w.toLowerCase())) : A, M = {};
150
+ return j.forEach((e, t) => {
151
+ M[e.group] = M[e.group] || [], M[e.group].push({
150
152
  ...e,
151
153
  _i: t
152
154
  });
153
- }), a ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("div", {
154
- onClick: h,
155
+ }), a ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", {
156
+ onClick: s,
155
157
  style: {
156
158
  position: "fixed",
157
159
  inset: 0,
@@ -159,9 +161,9 @@ function _({ open: a, onClose: h, onAction: _, mode: v = "default", navigation:
159
161
  zIndex: 70,
160
162
  backdropFilter: "blur(3px)"
161
163
  }
162
- }), /* @__PURE__ */ p("div", {
164
+ }), /* @__PURE__ */ m("div", {
163
165
  role: "dialog",
164
- "aria-label": C("shell.palette.label", "Command palette"),
166
+ "aria-label": S("shell.palette.label", "Command palette"),
165
167
  "data-testid": "command-palette",
166
168
  style: {
167
169
  position: "fixed",
@@ -182,13 +184,13 @@ function _({ open: a, onClose: h, onAction: _, mode: v = "default", navigation:
182
184
  minWidth: 0
183
185
  },
184
186
  onKeyDown: (e) => {
185
- e.key === "ArrowDown" ? (e.preventDefault(), O(Math.min(D + 1, M.length - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), O(Math.max(D - 1, 0))) : e.key === "Enter" && M[D] ? (M[D].act(), h()) : e.key === "Enter" && x && T.trim() ? (e.preventDefault(), _({
187
+ e.key === "ArrowDown" ? (e.preventDefault(), D(Math.min(E + 1, j.length - 1))) : e.key === "ArrowUp" ? (e.preventDefault(), D(Math.max(E - 1, 0))) : e.key === "Enter" && j[E] ? (j[E].act(), s()) : e.key === "Enter" && b && w.trim() ? (e.preventDefault(), g({
186
188
  type: "ai",
187
- q: T.trim()
188
- }), h()) : e.key === "Escape" && h();
189
+ q: w.trim()
190
+ }), s()) : e.key === "Escape" && s();
189
191
  },
190
192
  children: [
191
- /* @__PURE__ */ p("div", {
193
+ /* @__PURE__ */ m("div", {
192
194
  style: {
193
195
  display: "flex",
194
196
  alignItems: "center",
@@ -198,17 +200,17 @@ function _({ open: a, onClose: h, onAction: _, mode: v = "default", navigation:
198
200
  minWidth: 0
199
201
  },
200
202
  children: [
201
- /* @__PURE__ */ f(e.command, {
203
+ /* @__PURE__ */ p(e.command, {
202
204
  size: 15,
203
205
  style: { color: "var(--text-3)" }
204
206
  }),
205
- /* @__PURE__ */ f("input", {
206
- ref: k,
207
- value: T,
207
+ /* @__PURE__ */ p("input", {
208
+ ref: O,
209
+ value: w,
208
210
  onChange: (e) => {
209
- E(e.target.value), O(0);
211
+ T(e.target.value), D(0);
210
212
  },
211
- placeholder: x ? C("shell.palette.search_ai", "Search or run command — type / for AI") : C("shell.palette.search", "Search or run command"),
213
+ placeholder: b ? S("shell.palette.search_ai", "Search or run command — type / for AI") : S("shell.palette.search", "Search or run command"),
212
214
  style: {
213
215
  flex: 1,
214
216
  border: 0,
@@ -219,23 +221,23 @@ function _({ open: a, onClose: h, onAction: _, mode: v = "default", navigation:
219
221
  minWidth: 0
220
222
  }
221
223
  }),
222
- A && /* @__PURE__ */ f(t, {
223
- icon: /* @__PURE__ */ f(e.x, { size: 14 }),
224
- title: C("shell.palette.close", "Close command palette"),
225
- onClick: h
224
+ k && /* @__PURE__ */ p(t, {
225
+ icon: /* @__PURE__ */ p(e.x, { size: 14 }),
226
+ title: S("shell.palette.close", "Close command palette"),
227
+ onClick: s
226
228
  }),
227
- !A && /* @__PURE__ */ f(n, { children: m })
229
+ !k && /* @__PURE__ */ p(n, { children: h })
228
230
  ]
229
231
  }),
230
- /* @__PURE__ */ p("div", {
232
+ /* @__PURE__ */ m("div", {
231
233
  style: {
232
234
  flex: 1,
233
235
  overflowY: "auto",
234
236
  padding: 6
235
237
  },
236
- children: [Object.entries(N).map(([e, t]) => /* @__PURE__ */ p("div", {
238
+ children: [Object.entries(M).map(([e, t]) => /* @__PURE__ */ m("div", {
237
239
  style: { marginBottom: 6 },
238
- children: [/* @__PURE__ */ f("div", {
240
+ children: [/* @__PURE__ */ p("div", {
239
241
  style: {
240
242
  padding: "8px 10px 4px",
241
243
  fontSize: 10,
@@ -245,11 +247,11 @@ function _({ open: a, onClose: h, onAction: _, mode: v = "default", navigation:
245
247
  textTransform: "uppercase"
246
248
  },
247
249
  children: e
248
- }), t.map((e) => /* @__PURE__ */ p("div", {
250
+ }), t.map((e) => /* @__PURE__ */ m("div", {
249
251
  onClick: () => {
250
- e.act(), h();
252
+ e.act(), s();
251
253
  },
252
- onMouseEnter: () => O(e._i),
254
+ onMouseEnter: () => D(e._i),
253
255
  style: {
254
256
  display: "flex",
255
257
  alignItems: "center",
@@ -257,19 +259,19 @@ function _({ open: a, onClose: h, onAction: _, mode: v = "default", navigation:
257
259
  padding: "7px 10px",
258
260
  borderRadius: "var(--radius-md)",
259
261
  cursor: "pointer",
260
- background: e._i === D ? "var(--accent-soft)" : "transparent",
261
- color: e._i === D ? "var(--accent)" : "var(--text-2)",
262
+ background: e._i === E ? "var(--accent-soft)" : "transparent",
263
+ color: e._i === E ? "var(--accent)" : "var(--text-2)",
262
264
  minWidth: 0
263
265
  },
264
266
  children: [
265
- /* @__PURE__ */ f("span", {
267
+ /* @__PURE__ */ p("span", {
266
268
  style: {
267
- color: e._i === D ? "var(--accent)" : "var(--text-3)",
269
+ color: e._i === E ? "var(--accent)" : "var(--text-3)",
268
270
  display: "flex"
269
271
  },
270
272
  children: e.icon
271
273
  }),
272
- /* @__PURE__ */ f("span", {
274
+ /* @__PURE__ */ p("span", {
273
275
  style: {
274
276
  flex: 1,
275
277
  minWidth: 0,
@@ -280,7 +282,7 @@ function _({ open: a, onClose: h, onAction: _, mode: v = "default", navigation:
280
282
  },
281
283
  children: e.label
282
284
  }),
283
- e.hint && /* @__PURE__ */ f("span", {
285
+ e.hint && /* @__PURE__ */ p("span", {
284
286
  className: "mono",
285
287
  style: {
286
288
  fontSize: 10.5,
@@ -290,7 +292,7 @@ function _({ open: a, onClose: h, onAction: _, mode: v = "default", navigation:
290
292
  })
291
293
  ]
292
294
  }, `${e.group}:${e.label}`))]
293
- }, e)), M.length === 0 && /* @__PURE__ */ p("div", {
295
+ }, e)), j.length === 0 && /* @__PURE__ */ m("div", {
294
296
  style: {
295
297
  padding: "24px 16px",
296
298
  textAlign: "center",
@@ -298,26 +300,26 @@ function _({ open: a, onClose: h, onAction: _, mode: v = "default", navigation:
298
300
  fontSize: 12.5
299
301
  },
300
302
  children: [
301
- /* @__PURE__ */ f(e.sparkle, {
303
+ /* @__PURE__ */ p(e.sparkle, {
302
304
  size: 20,
303
305
  style: {
304
306
  color: "var(--accent)",
305
307
  marginBottom: 8
306
308
  }
307
309
  }),
308
- /* @__PURE__ */ f("div", { children: x ? C("shell.palette.ask_prompt", "Press Enter to ask {name}:", { name: S }) : C("shell.palette.no_matches", "No matches") }),
309
- x && /* @__PURE__ */ f("div", {
310
+ /* @__PURE__ */ p("div", { children: b ? S("shell.palette.ask_prompt", "Press Enter to ask {name}:", { name: x }) : S("shell.palette.no_matches", "No matches") }),
311
+ b && /* @__PURE__ */ p("div", {
310
312
  style: {
311
313
  fontWeight: 600,
312
314
  color: "var(--text)",
313
315
  marginTop: 4
314
316
  },
315
- children: C("shell.palette.ask_query", "“{query}”", { query: T })
317
+ children: S("shell.palette.ask_query", "“{query}”", { query: w })
316
318
  })
317
319
  ]
318
320
  })]
319
321
  }),
320
- /* @__PURE__ */ p("div", {
322
+ /* @__PURE__ */ m("div", {
321
323
  style: {
322
324
  padding: "8px 12px",
323
325
  borderTop: "1px solid var(--divider)",
@@ -331,7 +333,7 @@ function _({ open: a, onClose: h, onAction: _, mode: v = "default", navigation:
331
333
  minWidth: 0
332
334
  },
333
335
  children: [
334
- /* @__PURE__ */ p("span", {
336
+ /* @__PURE__ */ m("span", {
335
337
  style: {
336
338
  display: "flex",
337
339
  alignItems: "center",
@@ -339,12 +341,12 @@ function _({ open: a, onClose: h, onAction: _, mode: v = "default", navigation:
339
341
  minWidth: 0
340
342
  },
341
343
  children: [
342
- /* @__PURE__ */ f(n, { children: "↑↓" }),
344
+ /* @__PURE__ */ p(n, { children: "↑↓" }),
343
345
  " ",
344
- C("shell.palette.hint.navigate", "navigate")
346
+ S("shell.palette.hint.navigate", "navigate")
345
347
  ]
346
348
  }),
347
- /* @__PURE__ */ p("span", {
349
+ /* @__PURE__ */ m("span", {
348
350
  style: {
349
351
  display: "flex",
350
352
  alignItems: "center",
@@ -352,12 +354,12 @@ function _({ open: a, onClose: h, onAction: _, mode: v = "default", navigation:
352
354
  minWidth: 0
353
355
  },
354
356
  children: [
355
- /* @__PURE__ */ f(n, { children: "↵" }),
357
+ /* @__PURE__ */ p(n, { children: "↵" }),
356
358
  " ",
357
- C("shell.palette.hint.select", "select")
359
+ S("shell.palette.hint.select", "select")
358
360
  ]
359
361
  }),
360
- x && /* @__PURE__ */ p("span", {
362
+ b && /* @__PURE__ */ m("span", {
361
363
  style: {
362
364
  display: "flex",
363
365
  alignItems: "center",
@@ -365,15 +367,15 @@ function _({ open: a, onClose: h, onAction: _, mode: v = "default", navigation:
365
367
  minWidth: 0
366
368
  },
367
369
  children: [
368
- /* @__PURE__ */ f(n, { children: "/" }),
370
+ /* @__PURE__ */ p(n, { children: "/" }),
369
371
  " ",
370
- C("shell.palette.hint.ask_ai", "ask AI")
372
+ S("shell.palette.hint.ask_ai", "ask AI")
371
373
  ]
372
374
  }),
373
- /* @__PURE__ */ f("div", { style: { flex: 1 } }),
374
- w && /* @__PURE__ */ f("span", {
375
+ /* @__PURE__ */ p("div", { style: { flex: 1 } }),
376
+ C && /* @__PURE__ */ p("span", {
375
377
  className: "mono",
376
- children: w
378
+ children: C
377
379
  })
378
380
  ]
379
381
  })
@@ -381,4 +383,4 @@ function _({ open: a, onClose: h, onAction: _, mode: v = "default", navigation:
381
383
  })] }) : null;
382
384
  }
383
385
  //#endregion
384
- export { _ as CommandPalette };
386
+ export { v as CommandPalette };
@@ -250,8 +250,7 @@ function E() {
250
250
  mode: Ke,
251
251
  onClose: () => R(!1),
252
252
  onAction: (e) => _t(e),
253
- navigation: A?.navigation,
254
- screens: A?.screens,
253
+ schema: A,
255
254
  includeAI: $e,
256
255
  aiName: tt
257
256
  }),
@@ -10,61 +10,61 @@ import { toast as f } from "../../../lib/toast.js";
10
10
  import { useAuth as p } from "../../../hooks/useAuth.js";
11
11
  import { AuthShell as m } from "./AuthShell.js";
12
12
  import { BlankScreen as h } from "../../shared/BlankScreen.js";
13
- import { GoogleIcon as g, MicrosoftIcon as _ } from "./icons.js";
14
- import { accessibleRedirectPath as v } from "../../../lib/schema-routing.js";
15
- import { useEffect as y, useState as b } from "react";
16
- import { useQuery as x } from "@tanstack/react-query";
17
- import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
18
- import { Link as T, useNavigate as E, useSearchParams as D } from "react-router";
13
+ import { GitHubIcon as g, GoogleIcon as _, MicrosoftIcon as v } from "./icons.js";
14
+ import { accessibleRedirectPath as y } from "../../../lib/schema-routing.js";
15
+ import { useEffect as b, useState as x } from "react";
16
+ import { useQuery as S } from "@tanstack/react-query";
17
+ import { Fragment as C, jsx as w, jsxs as T } from "react/jsx-runtime";
18
+ import { Link as E, useNavigate as D, useSearchParams as O } from "react-router";
19
19
  //#region src/components/pages/auth/SignIn.tsx
20
- var O = "sso-failure", k = {
20
+ var k = "sso-failure", A = {
21
21
  google: {
22
22
  name: "Google",
23
- icon: /* @__PURE__ */ C(g, { size: 14 })
23
+ icon: /* @__PURE__ */ w(_, { size: 14 })
24
24
  },
25
25
  microsoft: {
26
26
  name: "Microsoft",
27
- icon: /* @__PURE__ */ C(_, { size: 14 })
27
+ icon: /* @__PURE__ */ w(v, { size: 14 })
28
28
  },
29
29
  azure: {
30
30
  name: "Microsoft",
31
- icon: /* @__PURE__ */ C(_, { size: 14 })
31
+ icon: /* @__PURE__ */ w(v, { size: 14 })
32
32
  },
33
33
  github: {
34
34
  name: "GitHub",
35
- icon: /* @__PURE__ */ C(a.shield, { size: 13 })
35
+ icon: /* @__PURE__ */ w(g, { size: 14 })
36
36
  },
37
37
  apple: {
38
38
  name: "Apple",
39
- icon: /* @__PURE__ */ C(a.shield, { size: 13 })
39
+ icon: /* @__PURE__ */ w(a.shield, { size: 13 })
40
40
  }
41
41
  };
42
- function A() {
43
- let g = E(), [_] = D(), { login: A, isLoginPending: M, isAuthenticated: N } = p(), { data: P } = i(), F = s(), [I, L] = b(""), [R, z] = b(""), [B, V] = b(!0), H = e(_.get("next") || _.get("redirect")), U = _.get("sso_error"), W = s("errors"), { data: G, isPending: K } = x({
42
+ function j() {
43
+ let g = D(), [_] = O(), { login: v, isLoginPending: j, isAuthenticated: N } = p(), { data: P } = i(), F = s(), [I, L] = x(""), [R, z] = x(""), [B, V] = x(!0), H = e(_.get("next") || _.get("redirect")), U = _.get("sso_error"), W = s("errors"), { data: G, isPending: K } = S({
44
44
  queryKey: ["check-setup"],
45
45
  queryFn: t
46
- }), { data: q } = x({
46
+ }), { data: q } = S({
47
47
  queryKey: ["identity-providers"],
48
48
  queryFn: () => n(),
49
49
  staleTime: 6e4
50
50
  });
51
- if (y(() => {
51
+ if (b(() => {
52
52
  G?.needs_setup && g("/signup", { replace: !0 });
53
- }, [G, g]), y(() => {
53
+ }, [G, g]), b(() => {
54
54
  if (!N || !P) return;
55
- let e = v(H, P);
56
- j(H, e) && f.warning(F("auth.inaccessible_redirect", "You do not have access to that page. We opened your default page instead.")), g(e, { replace: !0 });
55
+ let e = y(H, P);
56
+ M(H, e) && f.warning(F("auth.inaccessible_redirect", "You do not have access to that page. We opened your default page instead.")), g(e, { replace: !0 });
57
57
  }, [
58
58
  N,
59
59
  g,
60
60
  H,
61
61
  P,
62
62
  F
63
- ]), y(() => {
64
- U && f.error(W(U, "Sign-in failed."), void 0, { id: O });
65
- }, [W, U]), K || G?.needs_setup) return /* @__PURE__ */ C(h, {});
63
+ ]), b(() => {
64
+ U && f.error(W(U, "Sign-in failed."), void 0, { id: k });
65
+ }, [W, U]), K || G?.needs_setup) return /* @__PURE__ */ w(h, {});
66
66
  function J(e) {
67
- e.preventDefault(), A({
67
+ e.preventDefault(), v({
68
68
  email: I,
69
69
  password: R,
70
70
  remember: B
@@ -72,10 +72,10 @@ function A() {
72
72
  f.error(d(W, e));
73
73
  } });
74
74
  }
75
- return /* @__PURE__ */ C(m, { children: /* @__PURE__ */ w("form", {
75
+ return /* @__PURE__ */ w(m, { children: /* @__PURE__ */ T("form", {
76
76
  onSubmit: J,
77
77
  children: [
78
- /* @__PURE__ */ C("div", {
78
+ /* @__PURE__ */ w("div", {
79
79
  style: {
80
80
  fontSize: 10.5,
81
81
  fontWeight: 700,
@@ -85,7 +85,7 @@ function A() {
85
85
  },
86
86
  children: F("auth.signin.eyebrow", "Welcome back")
87
87
  }),
88
- /* @__PURE__ */ C("h2", {
88
+ /* @__PURE__ */ w("h2", {
89
89
  style: {
90
90
  margin: "6px 0 4px",
91
91
  fontSize: 24,
@@ -94,7 +94,7 @@ function A() {
94
94
  },
95
95
  children: F("auth.signin.title", "Sign in")
96
96
  }),
97
- /* @__PURE__ */ C("p", {
97
+ /* @__PURE__ */ w("p", {
98
98
  style: {
99
99
  margin: "0 0 20px",
100
100
  fontSize: 13,
@@ -102,7 +102,7 @@ function A() {
102
102
  },
103
103
  children: F("auth.signin.subtitle", "Use your corporate SSO or email & password.")
104
104
  }),
105
- q && q.length > 0 && /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C("div", {
105
+ q && q.length > 0 && /* @__PURE__ */ T(C, { children: [/* @__PURE__ */ w("div", {
106
106
  style: {
107
107
  display: "flex",
108
108
  flexDirection: "column",
@@ -110,11 +110,11 @@ function A() {
110
110
  marginBottom: 12
111
111
  },
112
112
  children: q.map((e) => {
113
- let t = k[e.slug.toLowerCase()] ?? {
113
+ let t = A[e.slug.toLowerCase()] ?? {
114
114
  name: e.name,
115
- icon: /* @__PURE__ */ C(a.shield, { size: 13 })
115
+ icon: /* @__PURE__ */ w(a.shield, { size: 13 })
116
116
  };
117
- return /* @__PURE__ */ C(o, {
117
+ return /* @__PURE__ */ w(o, {
118
118
  size: "md",
119
119
  style: {
120
120
  justifyContent: "center",
@@ -127,7 +127,7 @@ function A() {
127
127
  children: F("auth.signin.sso_continue", "Continue with {provider}", { provider: t.name })
128
128
  }, e.slug);
129
129
  })
130
- }), /* @__PURE__ */ w("div", {
130
+ }), /* @__PURE__ */ T("div", {
131
131
  style: {
132
132
  display: "flex",
133
133
  alignItems: "center",
@@ -135,12 +135,12 @@ function A() {
135
135
  margin: "16px 0"
136
136
  },
137
137
  children: [
138
- /* @__PURE__ */ C("span", { style: {
138
+ /* @__PURE__ */ w("span", { style: {
139
139
  flex: 1,
140
140
  height: 1,
141
141
  background: "var(--divider)"
142
142
  } }),
143
- /* @__PURE__ */ C("span", {
143
+ /* @__PURE__ */ w("span", {
144
144
  style: {
145
145
  fontSize: 10.5,
146
146
  color: "var(--text-4)",
@@ -149,37 +149,37 @@ function A() {
149
149
  },
150
150
  children: F("auth.signin.sso_divider", "or with email")
151
151
  }),
152
- /* @__PURE__ */ C("span", { style: {
152
+ /* @__PURE__ */ w("span", { style: {
153
153
  flex: 1,
154
154
  height: 1,
155
155
  background: "var(--divider)"
156
156
  } })
157
157
  ]
158
158
  })] }),
159
- /* @__PURE__ */ w("div", {
159
+ /* @__PURE__ */ T("div", {
160
160
  style: {
161
161
  display: "flex",
162
162
  flexDirection: "column",
163
163
  gap: 12
164
164
  },
165
165
  children: [
166
- /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C(c, { children: F("auth.field.email", "Email") }), /* @__PURE__ */ C(u, {
166
+ /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ w(c, { children: F("auth.field.email", "Email") }), /* @__PURE__ */ w(u, {
167
167
  value: I,
168
168
  onChange: L,
169
- prefix: /* @__PURE__ */ C(a.email, { size: 13 }),
169
+ prefix: /* @__PURE__ */ w(a.email, { size: 13 }),
170
170
  placeholder: F("auth.field.email_placeholder", "you@company.com"),
171
171
  autoFocus: !0,
172
172
  required: !0
173
173
  })] }),
174
- /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ w("div", {
174
+ /* @__PURE__ */ T("div", { children: [/* @__PURE__ */ T("div", {
175
175
  style: {
176
176
  display: "flex",
177
177
  alignItems: "center"
178
178
  },
179
179
  children: [
180
- /* @__PURE__ */ C(c, { children: F("auth.field.password", "Password") }),
181
- /* @__PURE__ */ C("div", { style: { flex: 1 } }),
182
- /* @__PURE__ */ C(T, {
180
+ /* @__PURE__ */ w(c, { children: F("auth.field.password", "Password") }),
181
+ /* @__PURE__ */ w("div", { style: { flex: 1 } }),
182
+ /* @__PURE__ */ w(E, {
183
183
  to: "/forgot",
184
184
  style: {
185
185
  fontSize: 11,
@@ -190,12 +190,12 @@ function A() {
190
190
  children: F("auth.signin.forgot_link", "Forgot?")
191
191
  })
192
192
  ]
193
- }), /* @__PURE__ */ C(l, {
193
+ }), /* @__PURE__ */ w(l, {
194
194
  value: R,
195
195
  onChange: z,
196
196
  placeholder: F("auth.signin.password_placeholder", "Your password")
197
197
  })] }),
198
- /* @__PURE__ */ w("label", {
198
+ /* @__PURE__ */ T("label", {
199
199
  style: {
200
200
  display: "flex",
201
201
  alignItems: "center",
@@ -204,7 +204,7 @@ function A() {
204
204
  color: "var(--text-2)"
205
205
  },
206
206
  children: [
207
- /* @__PURE__ */ C("input", {
207
+ /* @__PURE__ */ w("input", {
208
208
  type: "checkbox",
209
209
  name: "remember",
210
210
  checked: B,
@@ -214,7 +214,7 @@ function A() {
214
214
  F("auth.signin.remember", "Keep me signed in on this device")
215
215
  ]
216
216
  }),
217
- /* @__PURE__ */ C(o, {
217
+ /* @__PURE__ */ w(o, {
218
218
  type: "submit",
219
219
  size: "md",
220
220
  kind: "primary",
@@ -222,10 +222,10 @@ function A() {
222
222
  justifyContent: "center",
223
223
  width: "100%"
224
224
  },
225
- disabled: M,
226
- children: M ? F("auth.signin.submitting", "Signing in…") : F("auth.signin.submit", "Continue")
225
+ disabled: j,
226
+ children: j ? F("auth.signin.submitting", "Signing in…") : F("auth.signin.submit", "Continue")
227
227
  }),
228
- G?.signup_enabled && /* @__PURE__ */ w("div", {
228
+ G?.signup_enabled && /* @__PURE__ */ T("div", {
229
229
  style: {
230
230
  fontSize: 12,
231
231
  color: "var(--text-3)",
@@ -235,7 +235,7 @@ function A() {
235
235
  children: [
236
236
  F("auth.signin.new_here", "New here?"),
237
237
  " ",
238
- /* @__PURE__ */ C(T, {
238
+ /* @__PURE__ */ w(E, {
239
239
  to: "/signup",
240
240
  style: {
241
241
  color: "var(--accent-text)",
@@ -251,10 +251,10 @@ function A() {
251
251
  ]
252
252
  }) });
253
253
  }
254
- function j(e, t) {
254
+ function M(e, t) {
255
255
  if (e === t) return !1;
256
256
  let n = e.split(/[?#]/, 1)[0].replace(/\/+$/, "") || "/";
257
257
  return n !== "/" && n !== "/admin";
258
258
  }
259
259
  //#endregion
260
- export { A as SignIn };
260
+ export { j as SignIn };
@@ -52,5 +52,15 @@ function r({ size: n = 14 }) {
52
52
  ]
53
53
  });
54
54
  }
55
+ function i({ size: t = 14 }) {
56
+ return /* @__PURE__ */ e("svg", {
57
+ width: t,
58
+ height: t,
59
+ viewBox: "0 0 16 16",
60
+ fill: "currentColor",
61
+ "aria-hidden": !0,
62
+ children: /* @__PURE__ */ e("path", { d: "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z" })
63
+ });
64
+ }
55
65
  //#endregion
56
- export { n as GoogleIcon, r as MicrosoftIcon };
66
+ export { i as GitHubIcon, n as GoogleIcon, r as MicrosoftIcon };
@@ -2125,8 +2125,7 @@ interface CommandPaletteProps {
2125
2125
  onClose: () => void;
2126
2126
  onAction: (a: CommandAction) => void;
2127
2127
  mode?: "default" | "new";
2128
- navigation?: NavNode[];
2129
- screens?: Record<string, Screen>;
2128
+ schema?: Partial<Pick<Schema, "navigation" | "screens" | "entities" | "actions">>;
2130
2129
  includeAI?: boolean;
2131
2130
  aiName?: string;
2132
2131
  }
@@ -110,24 +110,27 @@ function x(e, n) {
110
110
  return !r || t(n, r);
111
111
  });
112
112
  }
113
- function S(e) {
113
+ function S(e, n, r) {
114
+ return e?.type !== "list" || !e.entity || !t(n, "create") ? !1 : x(y(n?.actions, e.actions, "list_toolbar", r), n).some(({ code: e }) => e === "__new" || e === "__create");
115
+ }
116
+ function C(e) {
114
117
  return !!e?.confirmation && Object.keys(e.confirmation).length > 0;
115
118
  }
116
- function C(e, t) {
117
- return S(t) ? e(t.confirmation) : t?.destructive ? e("action.confirm.destructive", "This action cannot be undone.") : null;
119
+ function w(e, t) {
120
+ return C(t) ? e(t.confirmation) : t?.destructive ? e("action.confirm.destructive", "This action cannot be undone.") : null;
118
121
  }
119
- function w(e) {
120
- return S(e) || !!e?.destructive;
122
+ function T(e) {
123
+ return C(e) || !!e?.destructive;
121
124
  }
122
- function T(e, t, n, r, i, a = !1) {
125
+ function E(e, t, n, r, i, a = !1) {
123
126
  if (r && i) return i;
124
127
  let o = e(t?.display?.description);
125
128
  return o ? a || t?.display?.icon_only === !0 ? `${n}\n${o}` : o : n;
126
129
  }
127
- function E(e) {
130
+ function D(e) {
128
131
  return !!e.association;
129
132
  }
130
- function D(e, t) {
133
+ function O(e, t) {
131
134
  if (e) {
132
135
  for (let n of Object.values(e.screens)) if (n.entity === t && n.type === "list") {
133
136
  let r = e.entities[t];
@@ -138,21 +141,21 @@ function D(e, t) {
138
141
  }
139
142
  }
140
143
  }
141
- function O(e, t, n, r, i, a, o, s) {
144
+ function k(e, t, n, r, i, a, o, s) {
142
145
  let c = [];
143
146
  for (let l of t) {
144
- let t = k(e, l, n, r, i, a, o, s);
147
+ let t = A(e, l, n, r, i, a, o, s);
145
148
  t !== null && c.push(t);
146
149
  }
147
150
  return c;
148
151
  }
149
- function k(e, t, n, r, i, a, o, s) {
150
- return t.kind === "group" ? A(e, t, n, r, i, a, o, s) : j(e, t, n, r, i, a, o, s);
151
- }
152
152
  function A(e, t, n, r, i, a, o, s) {
153
+ return t.kind === "group" ? j(e, t, n, r, i, a, o, s) : M(e, t, n, r, i, a, o, s);
154
+ }
155
+ function j(e, t, n, r, i, a, o, s) {
153
156
  let c = [];
154
157
  for (let l of t.items) {
155
- let t = k(e, l, n, r, i, a, o, s);
158
+ let t = A(e, l, n, r, i, a, o, s);
156
159
  t !== null && c.push(t);
157
160
  }
158
161
  return c.length === 0 ? null : {
@@ -160,29 +163,29 @@ function A(e, t, n, r, i, a, o, s) {
160
163
  items: c
161
164
  };
162
165
  }
163
- function j(e, t, n, r, i, a, o, s) {
166
+ function M(e, t, n, r, i, a, o, s) {
164
167
  if (s && !t.code.startsWith("__") && !s.has(t.code)) return null;
165
- let c = P(t.code, n, r);
168
+ let c = F(t.code, n, r);
166
169
  if (!c) return null;
167
170
  let l = b(t.code, o);
168
171
  if (a.length > 0) {
169
- let n = M(e, c, a, l);
172
+ let n = N(e, c, a, l);
170
173
  return n.visible ? {
171
174
  ...t,
172
175
  enabled: n.enabled,
173
176
  reason: n.reason
174
177
  } : null;
175
178
  }
176
- if (!l(i) || !d(c.conditions, i) || !d(F(c.visible_if), i)) return null;
177
- let { enabled: u, reason: f } = N(e, c, i);
179
+ if (!l(i) || !d(c.conditions, i) || !d(I(c.visible_if), i)) return null;
180
+ let { enabled: u, reason: f } = P(e, c, i);
178
181
  return {
179
182
  ...t,
180
183
  enabled: u,
181
184
  reason: f
182
185
  };
183
186
  }
184
- function M(e, t, n, r) {
185
- let i = F(t.visible_if), a = F(t.enabled_if), o = t.conditions, s = 0, c = 0, l = 0;
187
+ function N(e, t, n, r) {
188
+ let i = I(t.visible_if), a = I(t.enabled_if), o = t.conditions, s = 0, c = 0, l = 0;
186
189
  for (let e of n) {
187
190
  let t = r(e);
188
191
  t || l++;
@@ -223,8 +226,8 @@ function M(e, t, n, r) {
223
226
  }) : e("action.bulk.rows_fail", "({failing} of {total} rows fail)", f)
224
227
  };
225
228
  }
226
- function N(e, t, n) {
227
- let r = F(t.enabled_if);
229
+ function P(e, t, n) {
230
+ let r = I(t.enabled_if);
228
231
  return !r || r.length === 0 || d(r, n) ? {
229
232
  enabled: !0,
230
233
  reason: null
@@ -233,46 +236,46 @@ function N(e, t, n) {
233
236
  reason: e(t.enabled_if_reason) || null
234
237
  };
235
238
  }
236
- function P(e, t, n) {
239
+ function F(e, t, n) {
237
240
  if (t && e in t) return t[e];
238
241
  if (n && e in n) return n[e];
239
242
  }
240
- function F(e) {
243
+ function I(e) {
241
244
  return e;
242
245
  }
243
- function I(e, t, n, r, i) {
246
+ function L(e, t, n, r, i) {
244
247
  let a = [];
245
248
  for (let o of e) {
246
249
  if (o.kind === "group") {
247
- let e = I(o.items, t, n, r, i);
250
+ let e = L(o.items, t, n, r, i);
248
251
  e.length > 0 && a.push({
249
252
  ...o,
250
253
  items: e
251
254
  });
252
255
  continue;
253
256
  }
254
- let e = P(o.code, t, n);
257
+ let e = F(o.code, t, n);
255
258
  e && e.visibility?.includes(r) && (i?.bulkRequired === void 0 || (i.bulkRequiredPredicate ? i.bulkRequiredPredicate(e) : !1) === i.bulkRequired) && (i?.excludeIf && i.excludeIf(e) || a.push(o));
256
259
  }
257
260
  return a;
258
261
  }
259
- function L(e, t, n, r, i, a) {
262
+ function R(e, t, n, r, i, a) {
260
263
  let o = e ?? t;
261
- return o ? I(o, n, r, i, a) : V(n, i);
262
- }
263
- function R(e) {
264
- return e.requires_selection === void 0 ? z(e) : e.requires_selection;
264
+ return o ? L(o, n, r, i, a) : H(n, i);
265
265
  }
266
266
  function z(e) {
267
+ return e.requires_selection === void 0 ? B(e) : e.requires_selection;
268
+ }
269
+ function B(e) {
267
270
  return e.visibility?.includes("list_floatbar") ?? !1;
268
271
  }
269
- function B(e, t, n, r, i) {
272
+ function V(e, t, n, r, i) {
270
273
  return e.map((e) => {
271
274
  if (e.kind === "group") return {
272
275
  ...e,
273
- items: B(e.items, t, n, r, i)
276
+ items: V(e.items, t, n, r, i)
274
277
  };
275
- let a = P(e.code, t, n);
278
+ let a = F(e.code, t, n);
276
279
  return a && r(a) ? {
277
280
  ...e,
278
281
  enabled: !1,
@@ -280,7 +283,7 @@ function B(e, t, n, r, i) {
280
283
  } : e;
281
284
  });
282
285
  }
283
- function V(e, t) {
286
+ function H(e, t) {
284
287
  return e ? Object.entries(e).filter(([, e]) => e.visibility?.includes(t)).sort(([e, t], [n, r]) => {
285
288
  let i = t.position ?? 0, a = r.position ?? 0;
286
289
  return i === a ? e < n ? -1 : +(e > n) : i - a;
@@ -292,4 +295,4 @@ function V(e, t) {
292
295
  })) : [];
293
296
  }
294
297
  //#endregion
295
- export { c as EDIT_ACTION_CODE, s as OPEN_ACTION_CODE, o as PEEK_ACTION_CODE, m as actionConditionFieldValue, C as actionConfirmMessage, z as actionInFloatbarSlot, w as actionNeedsConfirm, R as actionRequiresSelection, T as actionTooltip, O as applyRowState, V as defaultFlatForSlot, B as disableLeavesWhere, d as evaluateConditions, I as filterLayoutForSlot, x as filterUnavailableMutationActions, D as findListScreenForEntity, v as getActionsByVisibility, y as getScreenActions, E as isAssociationAction, l as isNavDefaultCode, L as resolveActionLayoutForSlot, u as rowDetailId, h as withActionConditionFields };
298
+ export { c as EDIT_ACTION_CODE, s as OPEN_ACTION_CODE, o as PEEK_ACTION_CODE, m as actionConditionFieldValue, w as actionConfirmMessage, B as actionInFloatbarSlot, T as actionNeedsConfirm, z as actionRequiresSelection, E as actionTooltip, k as applyRowState, H as defaultFlatForSlot, V as disableLeavesWhere, d as evaluateConditions, L as filterLayoutForSlot, x as filterUnavailableMutationActions, O as findListScreenForEntity, v as getActionsByVisibility, y as getScreenActions, D as isAssociationAction, l as isNavDefaultCode, R as resolveActionLayoutForSlot, u as rowDetailId, S as screenOffersCreate, h as withActionConditionFields };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@declarion/react",
3
- "version": "0.83.0",
3
+ "version": "0.85.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "React SDK for Declarion, the schema-driven business apps platform.",