@webority/ui-react 0.36.0 → 0.37.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.
@@ -235,34 +235,35 @@ function C({ tab: e, linkComponent: t }) {
235
235
  children: i
236
236
  });
237
237
  }
238
- function w({ item: e, linkComponent: t, onNavigate: r, sub: i = !1 }) {
239
- let a = Array.isArray(e.children) && e.children.length > 0, o = a && e.children.some((e) => e.active), [c, l] = d(o);
238
+ function w({ item: e, linkComponent: t, onNavigate: r, depth: i = 0 }) {
239
+ let a = i > 0, o = i > 1 ? { "--wui-nav-depth": i } : void 0, c = Array.isArray(e.children) && e.children.length > 0, l = c && e.children.some((e) => e.active), [u, h] = d(l);
240
240
  s(() => {
241
- o && !c && l(!0);
242
- }, [o, c]);
243
- let u = typeof e.label == "string" ? e.label : void 0, h = !i && e.icon && /* @__PURE__ */ p("span", {
241
+ l && !u && h(!0);
242
+ }, [l, u]);
243
+ let g = typeof e.label == "string" ? e.label : void 0, _ = !a && e.icon && /* @__PURE__ */ p("span", {
244
244
  className: "app-nav-icon",
245
245
  children: typeof e.icon == "string" ? /* @__PURE__ */ p(n, {
246
246
  name: e.icon,
247
247
  size: 22
248
248
  }) : e.icon
249
- }), g = e.badge != null && /* @__PURE__ */ p("span", {
249
+ }), v = e.badge != null && /* @__PURE__ */ p("span", {
250
250
  className: `app-nav-badge${e.badgeTone ? ` tone-${e.badgeTone}` : ""}`,
251
251
  children: e.badge
252
252
  });
253
- if (a) return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ m("button", {
253
+ if (c) return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ m("button", {
254
254
  type: "button",
255
- className: `app-nav-item has-children${o ? " active" : ""}`,
256
- "aria-expanded": c,
257
- "data-label": u,
258
- onClick: () => l((e) => !e),
255
+ className: `app-nav-item${a ? " app-nav-subitem" : ""} has-children${l ? " active" : ""}`,
256
+ style: o,
257
+ "aria-expanded": u,
258
+ "data-label": g,
259
+ onClick: () => h((e) => !e),
259
260
  children: [
260
- h,
261
+ _,
261
262
  /* @__PURE__ */ p("span", {
262
263
  className: "app-nav-text",
263
264
  children: e.label
264
265
  }),
265
- g,
266
+ v,
266
267
  /* @__PURE__ */ p("span", {
267
268
  className: "app-nav-caret",
268
269
  children: /* @__PURE__ */ p(n, {
@@ -272,26 +273,26 @@ function w({ item: e, linkComponent: t, onNavigate: r, sub: i = !1 }) {
272
273
  })
273
274
  ]
274
275
  }), /* @__PURE__ */ p("div", {
275
- className: `app-nav-sub${c ? " expanded" : ""}`,
276
- inert: !c,
277
- "aria-hidden": !c || void 0,
276
+ className: `app-nav-sub${u ? " expanded" : ""}`,
277
+ inert: !u,
278
+ "aria-hidden": !u || void 0,
278
279
  children: /* @__PURE__ */ p("div", {
279
280
  className: "app-nav-sub-inner",
280
281
  children: e.children.map((e) => /* @__PURE__ */ p(w, {
281
282
  item: e,
282
283
  linkComponent: t,
283
284
  onNavigate: r,
284
- sub: !0
285
+ depth: i + 1
285
286
  }, e.key ?? e.href))
286
287
  })
287
288
  })] });
288
- let _ = `app-nav-item${i ? " app-nav-subitem" : ""}${e.active ? " active" : ""}`, v = /* @__PURE__ */ m(f, { children: [
289
- h,
289
+ let y = `app-nav-item${a ? " app-nav-subitem" : ""}${e.active ? " active" : ""}`, b = /* @__PURE__ */ m(f, { children: [
290
+ _,
290
291
  /* @__PURE__ */ p("span", {
291
292
  className: "app-nav-text",
292
293
  children: e.label
293
294
  }),
294
- g,
295
+ v,
295
296
  e.trailingIcon && /* @__PURE__ */ p("span", {
296
297
  className: "app-nav-trailing",
297
298
  children: typeof e.trailingIcon == "string" ? /* @__PURE__ */ p(n, {
@@ -299,21 +300,23 @@ function w({ item: e, linkComponent: t, onNavigate: r, sub: i = !1 }) {
299
300
  size: 16
300
301
  }) : e.trailingIcon
301
302
  })
302
- ] }), y = e.active ? "page" : void 0;
303
+ ] }), x = e.active ? "page" : void 0;
303
304
  return t ? /* @__PURE__ */ p(t, {
304
- className: _,
305
+ className: y,
306
+ style: o,
305
307
  to: e.href,
306
- "aria-current": y,
307
- "data-label": u,
308
+ "aria-current": x,
309
+ "data-label": g,
308
310
  onClick: r,
309
- children: v
311
+ children: b
310
312
  }) : /* @__PURE__ */ p("a", {
311
- className: _,
313
+ className: y,
314
+ style: o,
312
315
  href: e.href,
313
- "aria-current": y,
314
- "data-label": u,
316
+ "aria-current": x,
317
+ "data-label": g,
315
318
  onClick: r,
316
- children: v
319
+ children: b
317
320
  });
318
321
  }
319
322
  function T() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webority/ui-react",
3
- "version": "0.36.0",
3
+ "version": "0.37.0",
4
4
  "description": "Webority shared React component library — App* primitives on react-bootstrap + the @webority/theme design system.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -29,8 +29,8 @@
29
29
  },
30
30
  "sideEffects": false,
31
31
  "dependencies": {
32
- "@webority/ui-elements": "0.36.0",
33
- "@webority/theme": "0.36.0"
32
+ "@webority/theme": "0.37.0",
33
+ "@webority/ui-elements": "0.37.0"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@webority/analytics": "^0.6.0 || ^0.7.0 || ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0",