@motech-development/breeze-ui 3.2.0 → 3.3.1

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.
package/lib/index.js CHANGED
@@ -510,9 +510,18 @@ function zn({ children: e, className: t, ref: n, targetId: r, ...i }) {
510
510
  }
511
511
  //#endregion
512
512
  //#region src/patterns/ApplicationShell/ApplicationShell.tsx
513
- function Bn({ account: e, brand: t, children: n, className: r, compactBrand: i, compactNavigationOpen: o, context: s, defaultCompactNavigationOpen: l, mainId: u = "main-content", navigation: d, navigationLabel: f, onCompactNavigationOpenChange: p, ref: m, skipLinkLabel: g, ..._ }) {
514
- let { messages: v } = F(), y = /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M(U.Trigger, {
515
- "aria-label": f,
513
+ function Bn({ account: e, brand: t, children: n, className: r, compactBrand: i, compactNavigationOpen: o, context: s, contentFocusKey: l, defaultCompactNavigationOpen: u, mainId: d = "main-content", navigation: f, navigationLabel: p, onCompactNavigationOpenChange: m, ref: g, skipLinkLabel: _, ...v }) {
514
+ let { messages: b } = F(), x = C(null), S = C(l);
515
+ y(() => {
516
+ let e = S.current;
517
+ if (S.current = l, l === void 0 || l === e) return;
518
+ let t = window.requestAnimationFrame(() => {
519
+ x.current?.focus();
520
+ });
521
+ return () => window.cancelAnimationFrame(t);
522
+ }, [l]);
523
+ let w = /* @__PURE__ */ N(j, { children: [/* @__PURE__ */ M(U.Trigger, {
524
+ "aria-label": p,
516
525
  appearance: "ghost",
517
526
  className: "size-11 border-0 p-0 text-[var(--breeze-ink-inverse)] data-[hovered]:bg-[var(--breeze-shell-soft)]",
518
527
  variant: "light",
@@ -528,10 +537,10 @@ function Bn({ account: e, brand: t, children: n, className: r, compactBrand: i,
528
537
  /* @__PURE__ */ M("div", { children: t }),
529
538
  /* @__PURE__ */ M(U.Title, {
530
539
  className: "sr-only",
531
- children: f
540
+ children: p
532
541
  }),
533
542
  /* @__PURE__ */ M(U.Close, {
534
- "aria-label": v.close,
543
+ "aria-label": b.close,
535
544
  appearance: "ghost",
536
545
  className: "size-11 border-0 p-0 text-[var(--breeze-ink-inverse)] data-[hovered]:bg-[var(--breeze-shell-soft)]",
537
546
  variant: "light",
@@ -541,34 +550,34 @@ function Bn({ account: e, brand: t, children: n, className: r, compactBrand: i,
541
550
  }),
542
551
  /* @__PURE__ */ M(U.Description, {
543
552
  className: "sr-only",
544
- children: f
553
+ children: p
545
554
  }),
546
555
  /* @__PURE__ */ M("div", {
547
556
  className: "min-h-0 flex-1 overflow-y-auto px-3 py-6 [&_a]:flex [&_a]:min-h-11 [&_a]:items-center [&_a]:gap-3 [&_a]:text-[var(--breeze-ink-inverse-muted)] [&_a]:no-underline [&_a[data-current]]:bg-[var(--breeze-primary-selected)] [&_a[data-current]]:text-white [&_a[data-current][data-hovered]]:bg-[var(--breeze-primary-selected)] [&_a[data-hovered]]:bg-[var(--breeze-shell-soft)] [&_a[data-hovered]]:text-white",
548
- children: d
557
+ children: f
549
558
  }),
550
- /* @__PURE__ */ N("footer", {
559
+ /* @__PURE__ */ M("footer", {
551
560
  className: "grid gap-2 border-t border-[var(--breeze-shell-soft)] p-3",
552
- children: [s, e]
561
+ children: s
553
562
  })
554
563
  ]
555
- })] }), b = o === void 0 ? /* @__PURE__ */ M(U.Root, {
556
- defaultOpen: l,
557
- onOpenChange: p,
558
- children: y
564
+ })] }), T = o === void 0 ? /* @__PURE__ */ M(U.Root, {
565
+ defaultOpen: u,
566
+ onOpenChange: m,
567
+ children: w
559
568
  }) : /* @__PURE__ */ M(U.Root, {
560
- onOpenChange: p,
569
+ onOpenChange: m,
561
570
  open: o,
562
- children: y
571
+ children: w
563
572
  });
564
573
  return h("div", {
565
- ..._,
574
+ ...v,
566
575
  className: `min-h-dvh bg-[var(--breeze-canvas)] text-[var(--breeze-ink)] ${r ?? ""}`,
567
- ref: P(m)
576
+ ref: P(g)
568
577
  }, /* @__PURE__ */ N(j, { children: [
569
578
  /* @__PURE__ */ M(zn, {
570
- targetId: u,
571
- children: g
579
+ targetId: d,
580
+ children: _
572
581
  }),
573
582
  /* @__PURE__ */ N("aside", {
574
583
  className: "fixed inset-y-0 start-0 z-20 hidden w-64 flex-col bg-[var(--breeze-shell)] text-[var(--breeze-ink-inverse)] md:flex",
@@ -579,7 +588,7 @@ function Bn({ account: e, brand: t, children: n, className: r, compactBrand: i,
579
588
  }),
580
589
  /* @__PURE__ */ M("div", {
581
590
  className: "min-h-0 flex-1 overflow-y-auto px-3 py-7 [&_a]:flex [&_a]:min-h-11 [&_a]:items-center [&_a]:gap-3 [&_a]:text-[var(--breeze-ink-inverse-muted)] [&_a]:no-underline [&_a[data-current]]:bg-[var(--breeze-primary-selected)] [&_a[data-current]]:text-white [&_a[data-current][data-hovered]]:bg-[var(--breeze-primary-selected)] [&_a[data-hovered]]:bg-[var(--breeze-shell-soft)] [&_a[data-hovered]]:text-white",
582
- children: d
591
+ children: f
583
592
  }),
584
593
  /* @__PURE__ */ N("footer", {
585
594
  className: "grid gap-2 border-t border-[var(--breeze-shell-soft)] p-3",
@@ -590,7 +599,7 @@ function Bn({ account: e, brand: t, children: n, className: r, compactBrand: i,
590
599
  /* @__PURE__ */ N("header", {
591
600
  className: "grid min-h-16 grid-cols-[2.75rem_minmax(0,1fr)_2.75rem] items-center gap-3 bg-[var(--breeze-shell)] px-3 text-[var(--breeze-ink-inverse)] md:hidden",
592
601
  children: [
593
- b,
602
+ T,
594
603
  /* @__PURE__ */ M("div", {
595
604
  className: "min-w-0 justify-self-center font-[family-name:var(--breeze-font-display)] text-xl font-semibold",
596
605
  children: i ?? t
@@ -603,7 +612,8 @@ function Bn({ account: e, brand: t, children: n, className: r, compactBrand: i,
603
612
  }),
604
613
  /* @__PURE__ */ M("main", {
605
614
  className: "min-h-dvh px-4 py-6 sm:px-8 sm:py-12 md:ms-64 lg:px-12",
606
- id: u,
615
+ id: d,
616
+ ref: x,
607
617
  tabIndex: -1,
608
618
  children: n
609
619
  })