@declarion/react 0.215.0 → 0.216.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.
@@ -1,13 +1,13 @@
1
1
  import { useUiPreferences as e } from "../../hooks/useUiPreferences.js";
2
2
  import { Icon as t } from "../primitives/Icons.js";
3
- import { Kbd as n } from "../primitives/Kbd.js";
4
- import { DynamicIcon as r } from "../shared/DynamicIcon.js";
5
- import { BrandLogo as i } from "../primitives/BrandLogo.js";
6
- import { useSchema as a } from "../../hooks/useSchema.js";
7
- import { useBrandingIdentity as o } from "../../hooks/useBranding.js";
8
- import { useTabNavigate as s } from "../../hooks/useTabNavigate.js";
9
- import { usePreferencesStore as c } from "../../stores/preferences.js";
10
- import { isModifiedClick as l } from "../../lib/utils.js";
3
+ import { DynamicIcon as n } from "../shared/DynamicIcon.js";
4
+ import { BrandLogo as r } from "../primitives/BrandLogo.js";
5
+ import { useSchema as i } from "../../hooks/useSchema.js";
6
+ import { useBrandingIdentity as a } from "../../hooks/useBranding.js";
7
+ import { useTabNavigate as o } from "../../hooks/useTabNavigate.js";
8
+ import { usePreferencesStore as s } from "../../stores/preferences.js";
9
+ import { isModifiedClick as c } from "../../lib/utils.js";
10
+ import { safeExternalUrl as l } from "../../lib/safe-url.js";
11
11
  import { findNavMatch as u } from "../../lib/schema-routing.js";
12
12
  import { useText as d } from "../../hooks/useText.js";
13
13
  import { useIntentPrefetch as f } from "../../hooks/useIntentPrefetch.js";
@@ -16,18 +16,18 @@ import { useMemo as m, useState as h } from "react";
16
16
  import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
17
17
  import { useLocation as y } from "react-router";
18
18
  // src/components/layout/Sidebar.tsx
19
- function b({ activeArea: r }) {
20
- let l = d(), { data: f } = a(), b = y(), S = s(), w = c((e) => e.sidebar), { set: T } = e(), E = w === "collapsed", [D, O] = h({}), k = o(), A = k?.app_name ?? "", j = k?.app_logo, M = k?.version_label ?? "", N = m(() => x(l, f?.navigation ?? [], r), [
21
- l,
19
+ function b({ activeArea: n }) {
20
+ let c = d(), { data: f } = i(), b = y(), S = o(), w = s((e) => e.sidebar), { set: T } = e(), E = w === "collapsed", [D, O] = h({}), k = a(), A = k?.app_name ?? "", j = k?.app_logo, M = l(k?.legal_links?.docs_url), N = k?.version_label ?? "", P = m(() => x(c, f?.navigation ?? [], n), [
21
+ c,
22
22
  f?.navigation,
23
- r
24
- ]), P = m(() => {
23
+ n
24
+ ]), F = m(() => {
25
25
  if (f) return u(f.navigation, f.screens, b.pathname)?.chain.at(-1)?.screen;
26
- }, [f, b.pathname]), F = (e, t) => {
26
+ }, [f, b.pathname]), I = (e, t) => {
27
27
  if (!e.screen) return;
28
28
  let n = f?.screens[e.screen];
29
29
  n && S(n.route, {
30
- title: l(e.name),
30
+ title: c(e.name),
31
31
  icon: e.icon,
32
32
  topLevel: !0
33
33
  });
@@ -52,7 +52,7 @@ function b({ activeArea: r }) {
52
52
  borderBottom: "1px solid var(--divider)",
53
53
  gap: 8
54
54
  },
55
- children: E ? j ? /* @__PURE__ */ _(i, {
55
+ children: E ? j ? /* @__PURE__ */ _(r, {
56
56
  appLogo: j,
57
57
  size: 18
58
58
  }) : A ? /* @__PURE__ */ _("span", {
@@ -63,7 +63,7 @@ function b({ activeArea: r }) {
63
63
  },
64
64
  children: A.charAt(0)
65
65
  }) : null : /* @__PURE__ */ v(g, { children: [
66
- /* @__PURE__ */ _(i, {
66
+ /* @__PURE__ */ _(r, {
67
67
  appLogo: j,
68
68
  size: 20
69
69
  }),
@@ -81,8 +81,8 @@ function b({ activeArea: r }) {
81
81
  },
82
82
  children: A
83
83
  }),
84
- M && /* @__PURE__ */ _("span", {
85
- title: M,
84
+ N && /* @__PURE__ */ _("span", {
85
+ title: N,
86
86
  style: {
87
87
  padding: "1px 6px",
88
88
  background: "var(--accent-soft)",
@@ -97,7 +97,7 @@ function b({ activeArea: r }) {
97
97
  textOverflow: "ellipsis",
98
98
  whiteSpace: "nowrap"
99
99
  },
100
- children: M
100
+ children: N
101
101
  })
102
102
  ] })
103
103
  }),
@@ -107,7 +107,7 @@ function b({ activeArea: r }) {
107
107
  overflowY: "auto",
108
108
  padding: E ? "8px 4px" : "8px 6px"
109
109
  },
110
- children: N.map((e, t) => /* @__PURE__ */ v("div", {
110
+ children: P.map((e, t) => /* @__PURE__ */ v("div", {
111
111
  style: { marginBottom: 12 },
112
112
  children: [!E && e.title && /* @__PURE__ */ _("div", {
113
113
  style: {
@@ -120,7 +120,7 @@ function b({ activeArea: r }) {
120
120
  },
121
121
  children: e.title
122
122
  }), e.items.map((e, n) => {
123
- let r = `${t}-${n}-${e.screen || l(e.name)}`, i = e.screen ? f?.screens[e.screen] : void 0, a = !!e.screen && e.screen === P, o = !!(e.children && e.children.length > 0), s = !!D[r];
123
+ let r = `${t}-${n}-${e.screen || c(e.name)}`, i = e.screen ? f?.screens[e.screen] : void 0, a = !!e.screen && e.screen === F, o = !!(e.children && e.children.length > 0), s = !!D[r];
124
124
  return /* @__PURE__ */ _(C, {
125
125
  item: e,
126
126
  href: i?.route,
@@ -132,12 +132,12 @@ function b({ activeArea: r }) {
132
132
  ...e,
133
133
  [r]: !e[r]
134
134
  })),
135
- onPick: (t) => F(e, t),
135
+ onPick: (t) => I(e, t),
136
136
  resolveChild: (e) => e.screen ? f?.screens[e.screen] : void 0,
137
137
  onPickChild: (e) => {
138
138
  let t = e.screen ? f?.screens[e.screen] : void 0;
139
139
  t && S(t.route, {
140
- title: l(e.name),
140
+ title: c(e.name),
141
141
  icon: e.icon,
142
142
  topLevel: !0
143
143
  });
@@ -157,7 +157,7 @@ function b({ activeArea: r }) {
157
157
  },
158
158
  children: [/* @__PURE__ */ _("button", {
159
159
  onClick: () => void T("sidebar", E ? "wide" : "collapsed"),
160
- title: E ? l("shell.sidebar.expand", "Expand sidebar ({keys})", { keys: p("B") }) : l("shell.sidebar.collapse", "Collapse sidebar ({keys})", { keys: p("B") }),
160
+ title: E ? c("shell.sidebar.expand", "Expand sidebar ({keys})", { keys: p("B") }) : c("shell.sidebar.collapse", "Collapse sidebar ({keys})", { keys: p("B") }),
161
161
  style: {
162
162
  display: "flex",
163
163
  alignItems: "center",
@@ -171,14 +171,17 @@ function b({ activeArea: r }) {
171
171
  cursor: "pointer"
172
172
  },
173
173
  children: _(E ? t.right : t.left, { size: 14 })
174
- }), !E && /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _("span", {
174
+ }), !E && M && /* @__PURE__ */ _("a", {
175
+ href: M,
176
+ target: "_blank",
177
+ rel: "noopener noreferrer",
175
178
  style: {
176
179
  flex: 1,
177
180
  fontSize: 11,
178
181
  color: "var(--text-3)"
179
182
  },
180
- children: l("shell.sidebar.footer", "Docs · API · Help")
181
- }), /* @__PURE__ */ _(n, { children: "?" })] })]
183
+ children: c("shell.sidebar.docs", "Docs")
184
+ })]
182
185
  })
183
186
  ]
184
187
  });
@@ -203,8 +206,8 @@ function x(e, t, n) {
203
206
  function S(e, t) {
204
207
  return (e.area || "default") === t;
205
208
  }
206
- function C({ item: e, href: n, collapsed: i, active: a, hasKids: o, expanded: s, onToggleExpand: c, onPick: u, onPickChild: p, resolveChild: m }) {
207
- let y = d(), [b, x] = h(!1), S = f(n), C = !!e.icon, T = y(e.name) || e.screen || "";
209
+ function C({ item: e, href: r, collapsed: i, active: a, hasKids: o, expanded: s, onToggleExpand: l, onPick: u, onPickChild: p, resolveChild: m }) {
210
+ let y = d(), [b, x] = h(!1), S = f(r), C = !!e.icon, T = y(e.name) || e.screen || "";
208
211
  if (i) {
209
212
  let t = {
210
213
  width: 40,
@@ -220,18 +223,18 @@ function C({ item: e, href: n, collapsed: i, active: a, hasKids: o, expanded: s,
220
223
  color: a ? "var(--accent)" : "var(--text-3)",
221
224
  textDecoration: "none"
222
225
  };
223
- return n ? /* @__PURE__ */ _("a", {
224
- href: n,
226
+ return r ? /* @__PURE__ */ _("a", {
227
+ href: r,
225
228
  "data-declarion-native-link": "",
226
229
  ...S,
227
230
  onClick: (e) => {
228
- l(e) || (e.preventDefault(), u());
231
+ c(e) || (e.preventDefault(), u());
229
232
  },
230
233
  title: T,
231
234
  onMouseEnter: () => x(!0),
232
235
  onMouseLeave: () => x(!1),
233
236
  style: t,
234
- children: C && /* @__PURE__ */ _(r, {
237
+ children: C && /* @__PURE__ */ _(n, {
235
238
  name: e.icon,
236
239
  size: 14
237
240
  })
@@ -241,7 +244,7 @@ function C({ item: e, href: n, collapsed: i, active: a, hasKids: o, expanded: s,
241
244
  onMouseEnter: () => x(!0),
242
245
  onMouseLeave: () => x(!1),
243
246
  style: t,
244
- children: C && /* @__PURE__ */ _(r, {
247
+ children: C && /* @__PURE__ */ _(n, {
245
248
  name: e.icon,
246
249
  size: 14
247
250
  })
@@ -264,7 +267,7 @@ function C({ item: e, href: n, collapsed: i, active: a, hasKids: o, expanded: s,
264
267
  fontWeight: a ? 600 : 500,
265
268
  textDecoration: "none"
266
269
  }, D = /* @__PURE__ */ v(g, { children: [
267
- C && /* @__PURE__ */ _(r, {
270
+ C && /* @__PURE__ */ _(n, {
268
271
  name: e.icon,
269
272
  size: 14
270
273
  }),
@@ -287,7 +290,7 @@ function C({ item: e, href: n, collapsed: i, active: a, hasKids: o, expanded: s,
287
290
  role: "button",
288
291
  "aria-label": s ? y("shell.sidebar.collapse_item", "Collapse") : y("shell.sidebar.expand_item", "Expand"),
289
292
  onClick: (e) => {
290
- e.stopPropagation(), e.preventDefault(), c();
293
+ e.stopPropagation(), e.preventDefault(), l();
291
294
  },
292
295
  style: {
293
296
  display: "inline-flex",
@@ -304,12 +307,12 @@ function C({ item: e, href: n, collapsed: i, active: a, hasKids: o, expanded: s,
304
307
  })
305
308
  })
306
309
  ] });
307
- return /* @__PURE__ */ v("div", { children: [n ? /* @__PURE__ */ _("a", {
308
- href: n,
310
+ return /* @__PURE__ */ v("div", { children: [r ? /* @__PURE__ */ _("a", {
311
+ href: r,
309
312
  "data-declarion-native-link": "",
310
313
  ...S,
311
314
  onClick: (e) => {
312
- l(e) || (e.preventDefault(), u());
315
+ c(e) || (e.preventDefault(), u());
313
316
  },
314
317
  onMouseEnter: () => x(!0),
315
318
  onMouseLeave: () => x(!1),
@@ -317,7 +320,7 @@ function C({ item: e, href: n, collapsed: i, active: a, hasKids: o, expanded: s,
317
320
  children: D
318
321
  }) : /* @__PURE__ */ _("button", {
319
322
  onClick: () => {
320
- o && c();
323
+ o && l();
321
324
  },
322
325
  onMouseEnter: () => x(!0),
323
326
  onMouseLeave: () => x(!1),
@@ -359,7 +362,7 @@ function w({ label: e, href: t, enabled: n, onPick: r }) {
359
362
  "data-declarion-native-link": "",
360
363
  ...o,
361
364
  onClick: (e) => {
362
- l(e) || (e.preventDefault(), r());
365
+ c(e) || (e.preventDefault(), r());
363
366
  },
364
367
  onMouseEnter: () => a(!0),
365
368
  onMouseLeave: () => a(!1),
@@ -167,9 +167,9 @@ function ne() {
167
167
  }),
168
168
  /* @__PURE__ */ G(p, {
169
169
  label: w("profile.access.permissions", "Permissions"),
170
- children: z(w, "profile.access.permissions_explicit", c?.permissions?.length ?? 0, {
171
- one: "{count} explicit",
172
- other: "{count} explicit"
170
+ children: c?.permissions?.includes("*") ? w("profile.access.permissions_all", "All") : z(w, "profile.access.permissions_from_roles", c?.permissions?.length ?? 0, {
171
+ one: "{count} from roles",
172
+ other: "{count} from roles"
173
173
  })
174
174
  })
175
175
  ] })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@declarion/react",
3
- "version": "0.215.0",
3
+ "version": "0.216.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "React SDK for Declarion, the schema-driven business apps platform.",