@alexandregme/zljs 3.18.0 → 3.20.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.
package/CHANGELOG.md CHANGED
@@ -8,6 +8,40 @@ A change that needs action in an app has a **Migration** note. When updating, re
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [3.20.0] - 2026-11-21
12
+
13
+ ### Added
14
+
15
+ - `size="xl"` on `Icon`: 32px, for an icon that stands alone, such as a shortcut. The type `IconSize` is the sizes `Icon` takes: `Size` and `xl`
16
+ - `Icon` has the `SiVercel` icon
17
+
18
+ ## [3.19.0] - 2026-11-20
19
+
20
+ ### Added
21
+
22
+ - `Sidebar` and `TopNav`, and so `Navigation`, show a share button: it shares the address of the app, so the user can send it to someone who then logs in and asks for access. On a phone a tap opens the share dialog of the browser. In a browser with no share dialog a click copies the address and a success toast says so. In `Sidebar` it has its own line over the user, and collapsed it shows only its icon. In `TopNav` it is the first line of the account panel. `share` takes its texts (`label`, `copiedMessage` and `errorMessage`) and what goes with the address: `title`, by default the title of the page, and `text`. The address is always the origin of the page, the app itself
23
+ - `ShareAppButton`, the button `Sidebar` and `TopNav` use, for an app that puts the share somewhere else, and the type `ShareAppButtonProps`. `label` is its text and is required
24
+ - `iconOnly` on `InstallAppButton` and `ShareAppButton`: it shows the icon alone, with `label` as the accessible name, for a place with no room for the text, such as a collapsed sidebar
25
+ - `Icon` has the `Share2` icon
26
+
27
+ ### Changed
28
+
29
+ - `InstallAppButton` shows its `label` beside the icon, and `label` is now required: it had the default `Install app` and was only the accessible name of an icon button. `iconOnly` gives the icon alone back
30
+ - The account panel of `TopNav` has two rows. The install button left the row of the user and the logout button: it now has its own line over them, after the share button, and shows its `label` beside the icon
31
+
32
+ #### Migration
33
+
34
+ An app that renders `InstallAppButton` itself, outside `TopNav` and `Navigation`:
35
+
36
+ - Pass `label`, or `tsc` fails on the missing prop: `<InstallAppButton label="Install app" … />`. Find where with `grep -rn "<InstallAppButton" app src pages`
37
+ - The button now shows the text. Where only the icon fits, also pass `iconOnly`
38
+
39
+ An app that uses `Sidebar`, `TopNav` or `Navigation` gets the share button when it updates:
40
+
41
+ - An app in another language passes `share={{ label, copiedMessage, errorMessage }}`, or the button and its toasts are in English. Find where with `grep -rnE "<(Sidebar|TopNav|Navigation)" app src pages`
42
+ - The toasts need a `Toaster` in the app, the same one the logout error already needs
43
+ - The address shared is the origin of the page, the app itself. An app that wants a text to go with it, such as how to ask for access, passes `share={{ text }}`
44
+
11
45
  ## [3.18.0] - 2026-11-19
12
46
 
13
47
  ### Added
@@ -577,7 +611,9 @@ Replace the shade with the class of the `color` being tested, for example `/(^|\
577
611
 
578
612
  The message of `Error` is `text-zl-danger`. `none` and `ghost` didn't change.
579
613
 
580
- [Unreleased]: https://github.com/alexandregme/zljs/compare/v3.18.0...HEAD
614
+ [Unreleased]: https://github.com/alexandregme/zljs/compare/v3.20.0...HEAD
615
+ [3.20.0]: https://github.com/alexandregme/zljs/compare/v3.19.0...v3.20.0
616
+ [3.19.0]: https://github.com/alexandregme/zljs/compare/v3.18.0...v3.19.0
581
617
  [3.18.0]: https://github.com/alexandregme/zljs/compare/v3.17.0...v3.18.0
582
618
  [3.17.0]: https://github.com/alexandregme/zljs/compare/v3.16.0...v3.17.0
583
619
  [3.16.0]: https://github.com/alexandregme/zljs/compare/v3.15.0...v3.16.0
@@ -9,19 +9,22 @@ import {
9
9
  SiFacebook,
10
10
  SiInstagram,
11
11
  SiShopify,
12
- SiGithub
12
+ SiGithub,
13
+ SiVercel
13
14
  } from "react-icons/si";
14
15
  var iconBrands = {
15
16
  SiWhatsapp,
16
17
  SiFacebook,
17
18
  SiInstagram,
18
19
  SiShopify,
19
- SiGithub
20
+ SiGithub,
21
+ SiVercel
20
22
  };
21
23
  var iconSizes = {
22
24
  sm: 12,
23
25
  md: 16,
24
- lg: 24
26
+ lg: 24,
27
+ xl: 32
25
28
  };
26
29
 
27
30
  // core/icon/icon.styles.ts
@@ -382,6 +385,101 @@ var Heading = ({ children, level = 1, color }) => {
382
385
  return /* @__PURE__ */ jsx5(Tag, { className: heading({ level, color }), children });
383
386
  };
384
387
 
388
+ // features/toaster/state/toast.store.ts
389
+ import { create } from "zustand";
390
+ import { devtools } from "zustand/middleware";
391
+
392
+ // features/toaster/state/toast.const.ts
393
+ var toastInitialState = {
394
+ toasts: []
395
+ };
396
+ var toastDevtools = { name: "zljs", store: "toast" };
397
+
398
+ // features/toaster/state/toast.store.ts
399
+ var toastId = 0;
400
+ var useToastStore = create()(
401
+ devtools(
402
+ (set, get) => ({
403
+ ...toastInitialState,
404
+ addToast: (message, type = "error") => {
405
+ const id = ++toastId;
406
+ set(
407
+ (s) => ({ toasts: [...s.toasts, { id, message, type }] }),
408
+ false,
409
+ "addToast"
410
+ );
411
+ return id;
412
+ },
413
+ removeToast: (id) => set(
414
+ (s) => ({ toasts: s.toasts.filter((t) => t.id !== id) }),
415
+ false,
416
+ "removeToast"
417
+ ),
418
+ success: (message) => get().addToast(message, "success"),
419
+ error: (message) => get().addToast(message, "error"),
420
+ info: (message) => get().addToast(message, "info"),
421
+ warning: (message) => get().addToast(message, "warning")
422
+ }),
423
+ toastDevtools
424
+ )
425
+ );
426
+
427
+ // features/app/components/share-app-button/share-app-button.const.ts
428
+ var SHARE_APP_CANCELLED = "AbortError";
429
+
430
+ // features/app/components/share-app-button/share-app-button.tsx
431
+ import { jsx as jsx6 } from "react/jsx-runtime";
432
+ var ShareAppButton = ({
433
+ label,
434
+ iconOnly = false,
435
+ size = "md",
436
+ title: title2,
437
+ text: text2,
438
+ copiedMessage = "Link copied",
439
+ errorMessage = "Could not share the link"
440
+ }) => {
441
+ const copy = async (address) => {
442
+ try {
443
+ await navigator.clipboard.writeText(address);
444
+ useToastStore.getState().success(copiedMessage);
445
+ } catch {
446
+ useToastStore.getState().error(errorMessage);
447
+ }
448
+ };
449
+ const shareOrCopy = async () => {
450
+ const address = window.location.origin;
451
+ if (typeof navigator.share !== "function") {
452
+ await copy(address);
453
+ return;
454
+ }
455
+ try {
456
+ await navigator.share({
457
+ title: title2 ?? document.title,
458
+ text: text2,
459
+ url: address
460
+ });
461
+ } catch (reason) {
462
+ if (reason.name !== SHARE_APP_CANCELLED) {
463
+ await copy(address);
464
+ }
465
+ }
466
+ };
467
+ const share = () => {
468
+ void shareOrCopy();
469
+ };
470
+ return /* @__PURE__ */ jsx6(
471
+ Button,
472
+ {
473
+ color: "ghost",
474
+ size,
475
+ icon: "Share2",
476
+ "aria-label": iconOnly ? label : void 0,
477
+ onClick: share,
478
+ children: !iconOnly && label
479
+ }
480
+ );
481
+ };
482
+
385
483
  // features/app/state/app.const.ts
386
484
  var appInitialState = {
387
485
  fetchingCalls: 0,
@@ -391,10 +489,10 @@ var appInitialState = {
391
489
  var appDevtools = { name: "zljs", store: "app" };
392
490
 
393
491
  // features/app/state/app.store.ts
394
- import { create } from "zustand";
395
- import { devtools } from "zustand/middleware";
396
- var useAppStore = create()(
397
- devtools(
492
+ import { create as create2 } from "zustand";
493
+ import { devtools as devtools2 } from "zustand/middleware";
494
+ var useAppStore = create2()(
495
+ devtools2(
398
496
  (set, get) => ({
399
497
  ...appInitialState,
400
498
  startFetching: () => set(
@@ -440,7 +538,7 @@ var useAppStore = create()(
440
538
  );
441
539
 
442
540
  // features/app/components/connected-modal/connected-modal.tsx
443
- import { jsx as jsx6 } from "react/jsx-runtime";
541
+ import { jsx as jsx7 } from "react/jsx-runtime";
444
542
  var ConnectedModal = ({
445
543
  modalId,
446
544
  title: title2,
@@ -454,7 +552,7 @@ var ConnectedModal = ({
454
552
  const close = () => {
455
553
  closeModal(modalId);
456
554
  };
457
- return /* @__PURE__ */ jsx6(
555
+ return /* @__PURE__ */ jsx7(
458
556
  Modal,
459
557
  {
460
558
  open,
@@ -468,45 +566,6 @@ var ConnectedModal = ({
468
566
  );
469
567
  };
470
568
 
471
- // features/toaster/state/toast.store.ts
472
- import { create as create2 } from "zustand";
473
- import { devtools as devtools2 } from "zustand/middleware";
474
-
475
- // features/toaster/state/toast.const.ts
476
- var toastInitialState = {
477
- toasts: []
478
- };
479
- var toastDevtools = { name: "zljs", store: "toast" };
480
-
481
- // features/toaster/state/toast.store.ts
482
- var toastId = 0;
483
- var useToastStore = create2()(
484
- devtools2(
485
- (set, get) => ({
486
- ...toastInitialState,
487
- addToast: (message, type = "error") => {
488
- const id = ++toastId;
489
- set(
490
- (s) => ({ toasts: [...s.toasts, { id, message, type }] }),
491
- false,
492
- "addToast"
493
- );
494
- return id;
495
- },
496
- removeToast: (id) => set(
497
- (s) => ({ toasts: s.toasts.filter((t) => t.id !== id) }),
498
- false,
499
- "removeToast"
500
- ),
501
- success: (message) => get().addToast(message, "success"),
502
- error: (message) => get().addToast(message, "error"),
503
- info: (message) => get().addToast(message, "info"),
504
- warning: (message) => get().addToast(message, "warning")
505
- }),
506
- toastDevtools
507
- )
508
- );
509
-
510
569
  // features/auth/state/auth.store.ts
511
570
  import { create as create3 } from "zustand";
512
571
  import { devtools as devtools3 } from "zustand/middleware";
@@ -579,7 +638,7 @@ var signOutModal = tv6({
579
638
  });
580
639
 
581
640
  // features/auth/components/sign-out/sign-out-modal.tsx
582
- import { jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
641
+ import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
583
642
  var SignOutModal = ({
584
643
  title: title2 = "Sign out?",
585
644
  confirmLabel = "Sign out",
@@ -589,7 +648,7 @@ var SignOutModal = ({
589
648
  }) => {
590
649
  const { signOut } = useAuth();
591
650
  const closeModal = useAppStore((s) => s.closeModal);
592
- const { actions } = signOutModal();
651
+ const { actions: actions2 } = signOutModal();
593
652
  const stay = () => {
594
653
  closeModal(SIGN_OUT_MODAL_ID);
595
654
  };
@@ -607,23 +666,23 @@ var SignOutModal = ({
607
666
  closeModal(SIGN_OUT_MODAL_ID);
608
667
  signOutOfApp().catch(showError);
609
668
  };
610
- return /* @__PURE__ */ jsx7(
669
+ return /* @__PURE__ */ jsx8(
611
670
  ConnectedModal,
612
671
  {
613
672
  modalId: SIGN_OUT_MODAL_ID,
614
673
  title: title2,
615
674
  size: "xs",
616
675
  color: "danger",
617
- children: /* @__PURE__ */ jsxs3("div", { className: actions(), children: [
618
- /* @__PURE__ */ jsx7(Button, { color: "ghost", onClick: stay, children: cancelLabel }),
619
- /* @__PURE__ */ jsx7(Button, { color: "danger", onClick: leave, children: confirmLabel })
676
+ children: /* @__PURE__ */ jsxs3("div", { className: actions2(), children: [
677
+ /* @__PURE__ */ jsx8(Button, { color: "ghost", onClick: stay, children: cancelLabel }),
678
+ /* @__PURE__ */ jsx8(Button, { color: "danger", onClick: leave, children: confirmLabel })
620
679
  ] })
621
680
  }
622
681
  );
623
682
  };
624
683
 
625
684
  // features/auth/components/sign-out/sign-out-button.tsx
626
- import { Fragment as Fragment3, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
685
+ import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
627
686
  var SignOutButton = ({
628
687
  label = "Sign out",
629
688
  size = "md",
@@ -638,7 +697,7 @@ var SignOutButton = ({
638
697
  openModal(SIGN_OUT_MODAL_ID);
639
698
  };
640
699
  return /* @__PURE__ */ jsxs4(Fragment3, { children: [
641
- /* @__PURE__ */ jsx8(
700
+ /* @__PURE__ */ jsx9(
642
701
  Button,
643
702
  {
644
703
  color: "ghost",
@@ -648,7 +707,7 @@ var SignOutButton = ({
648
707
  onClick: ask
649
708
  }
650
709
  ),
651
- /* @__PURE__ */ jsx8(
710
+ /* @__PURE__ */ jsx9(
652
711
  SignOutModal,
653
712
  {
654
713
  title: confirmTitle,
@@ -702,7 +761,7 @@ var link = tv7({
702
761
  });
703
762
 
704
763
  // core/next/link/link.tsx
705
- import { jsx as jsx9 } from "react/jsx-runtime";
764
+ import { jsx as jsx10 } from "react/jsx-runtime";
706
765
  var Link = ({
707
766
  children,
708
767
  href,
@@ -713,7 +772,7 @@ var Link = ({
713
772
  "aria-label": ariaLabel,
714
773
  onClick
715
774
  }) => {
716
- return /* @__PURE__ */ jsx9(
775
+ return /* @__PURE__ */ jsx10(
717
776
  NextLink,
718
777
  {
719
778
  href,
@@ -750,6 +809,9 @@ var header2 = tv8({
750
809
  var section = tv8({
751
810
  base: "grid gap-1 p-2"
752
811
  });
812
+ var actions = tv8({
813
+ base: "shrink-0 grid p-2 [&>button]:h-10 [&>button]:justify-start [&>button]:px-3 [&>button]:overflow-hidden [&>button]:whitespace-nowrap"
814
+ });
753
815
  var footer = tv8({
754
816
  base: "shrink-0 h-16 p-3 flex items-center gap-3",
755
817
  variants: {
@@ -769,7 +831,7 @@ var toggleButton = tv8({
769
831
  });
770
832
 
771
833
  // core/sidebar/sidebar.tsx
772
- import { Fragment as Fragment4, jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
834
+ import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
773
835
  var getInitials = (name) => {
774
836
  const parts = name.trim().split(/\s+/);
775
837
  if (parts.length >= 2) {
@@ -787,6 +849,7 @@ var Sidebar = ({
787
849
  homeHref = "/",
788
850
  homeLabel,
789
851
  navLabel = "Main navigation",
852
+ share = {},
790
853
  logout = {},
791
854
  onLogout
792
855
  }) => {
@@ -798,7 +861,7 @@ var Sidebar = ({
798
861
  setCollapsed(!collapsed);
799
862
  };
800
863
  return /* @__PURE__ */ jsxs5("aside", { className: sidebar({ collapsed }), children: [
801
- homeHref && /* @__PURE__ */ jsx10("div", { className: header2(), children: /* @__PURE__ */ jsxs5(
864
+ homeHref && /* @__PURE__ */ jsx11("div", { className: header2(), children: /* @__PURE__ */ jsxs5(
802
865
  Link,
803
866
  {
804
867
  href: homeHref,
@@ -807,12 +870,12 @@ var Sidebar = ({
807
870
  active: homeHref === activeHref,
808
871
  "aria-label": homeLabel || "Home",
809
872
  children: [
810
- /* @__PURE__ */ jsx10(Icon, { name: "Home" }),
811
- homeLabel && !collapsed && /* @__PURE__ */ jsx10(Text, { as: "span", variant: "caption", children: homeLabel })
873
+ /* @__PURE__ */ jsx11(Icon, { name: "Home" }),
874
+ homeLabel && !collapsed && /* @__PURE__ */ jsx11(Text, { as: "span", variant: "caption", children: homeLabel })
812
875
  ]
813
876
  }
814
877
  ) }),
815
- /* @__PURE__ */ jsx10("nav", { "aria-label": navLabel, className: nav(), children: sections.map((sectionData, i) => /* @__PURE__ */ jsx10("div", { className: section(), children: sectionData.items.map((sidebarItem) => /* @__PURE__ */ jsxs5(
878
+ /* @__PURE__ */ jsx11("nav", { "aria-label": navLabel, className: nav(), children: sections.map((sectionData, i) => /* @__PURE__ */ jsx11("div", { className: section(), children: sectionData.items.map((sidebarItem) => /* @__PURE__ */ jsxs5(
816
879
  Link,
817
880
  {
818
881
  href: sidebarItem.href,
@@ -821,21 +884,32 @@ var Sidebar = ({
821
884
  active: sidebarItem.href === activeHref,
822
885
  "aria-label": sidebarItem.label,
823
886
  children: [
824
- /* @__PURE__ */ jsx10(Icon, { name: sidebarItem.icon }),
825
- !collapsed && /* @__PURE__ */ jsx10(Text, { as: "span", variant: "caption", children: sidebarItem.label })
887
+ /* @__PURE__ */ jsx11(Icon, { name: sidebarItem.icon }),
888
+ !collapsed && /* @__PURE__ */ jsx11(Text, { as: "span", variant: "caption", children: sidebarItem.label })
826
889
  ]
827
890
  },
828
891
  sidebarItem.href
829
892
  )) }, i)) }),
893
+ /* @__PURE__ */ jsx11("div", { className: actions(), children: /* @__PURE__ */ jsx11(
894
+ ShareAppButton,
895
+ {
896
+ label: share.label ?? "Share app",
897
+ iconOnly: collapsed,
898
+ title: share.title,
899
+ text: share.text,
900
+ copiedMessage: share.copiedMessage,
901
+ errorMessage: share.errorMessage
902
+ }
903
+ ) }),
830
904
  /* @__PURE__ */ jsxs5("div", { className: footer({ collapsed }), children: [
831
905
  !collapsed && /* @__PURE__ */ jsxs5(Fragment4, { children: [
832
- /* @__PURE__ */ jsx10("div", { "aria-hidden": "true", className: avatar(), children: initials }),
906
+ /* @__PURE__ */ jsx11("div", { "aria-hidden": "true", className: avatar(), children: initials }),
833
907
  /* @__PURE__ */ jsxs5("div", { className: userInfo(), children: [
834
- /* @__PURE__ */ jsx10(Text, { as: "span", variant: "caption", children: user.name }),
835
- /* @__PURE__ */ jsx10(Text, { as: "span", variant: "caption", children: user.email })
908
+ /* @__PURE__ */ jsx11(Text, { as: "span", variant: "caption", children: user.name }),
909
+ /* @__PURE__ */ jsx11(Text, { as: "span", variant: "caption", children: user.email })
836
910
  ] })
837
911
  ] }),
838
- /* @__PURE__ */ jsx10(
912
+ /* @__PURE__ */ jsx11(
839
913
  SignOutButton,
840
914
  {
841
915
  label: logout.label,
@@ -847,7 +921,7 @@ var Sidebar = ({
847
921
  }
848
922
  )
849
923
  ] }),
850
- /* @__PURE__ */ jsx10("div", { className: toggleButton(), children: /* @__PURE__ */ jsx10(
924
+ /* @__PURE__ */ jsx11("div", { className: toggleButton(), children: /* @__PURE__ */ jsx11(
851
925
  Button,
852
926
  {
853
927
  color: "ghost",
@@ -864,10 +938,11 @@ var Sidebar = ({
864
938
  var INSTALL_APP_MODAL_ID = "zljs-install-app";
865
939
 
866
940
  // features/app/components/install-app-button/install-app-button.tsx
867
- import { Fragment as Fragment5, jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
941
+ import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
868
942
  var InstallAppButton = ({
869
943
  way,
870
- label = "Install app",
944
+ label,
945
+ iconOnly = false,
871
946
  size = "md",
872
947
  instructionsTitle = "Install this app",
873
948
  instructions = "Tap the Share button of the browser, then Add to Home Screen.",
@@ -882,17 +957,18 @@ var InstallAppButton = ({
882
957
  }
883
958
  };
884
959
  return /* @__PURE__ */ jsxs6(Fragment5, { children: [
885
- /* @__PURE__ */ jsx11(
960
+ /* @__PURE__ */ jsx12(
886
961
  Button,
887
962
  {
888
963
  color: "ghost",
889
964
  size,
890
965
  icon: "Download",
891
- "aria-label": label,
892
- onClick: install
966
+ "aria-label": iconOnly ? label : void 0,
967
+ onClick: install,
968
+ children: !iconOnly && label
893
969
  }
894
970
  ),
895
- way === "instructions" && /* @__PURE__ */ jsx11(
971
+ way === "instructions" && /* @__PURE__ */ jsx12(
896
972
  ConnectedModal,
897
973
  {
898
974
  modalId: INSTALL_APP_MODAL_ID,
@@ -992,14 +1068,18 @@ var topNav = tv9({
992
1068
  // the page layers on itself (a filter over a map), and under a modal.
993
1069
  menu: "absolute inset-x-0 top-full z-40 max-h-[calc(100dvh-3.5rem)] divide-y divide-neutral-600/50 overflow-y-auto border-t border-neutral-600/50 bg-neutral-800 shadow-lg",
994
1070
  section: "grid gap-1 p-2",
995
- account: "absolute inset-x-0 top-full z-40 flex items-center gap-3 border-t border-neutral-600/50 bg-neutral-800 p-3 shadow-lg",
1071
+ // Two rows: what the user can do with the app, then who is logged in.
1072
+ account: "absolute inset-x-0 top-full z-40 divide-y divide-neutral-600/50 border-t border-neutral-600/50 bg-neutral-800 shadow-lg",
1073
+ // One action per line, each as tall and as far from the edge as a link of the menu.
1074
+ actions: "grid gap-1 p-2 [&>button]:h-10 [&>button]:justify-start [&>button]:px-3",
1075
+ profile: "flex items-center gap-3 p-3",
996
1076
  // Text takes no className, so the cut of a long name or email is set from here.
997
1077
  user: "flex min-w-0 flex-1 flex-col text-white [&>*]:truncate"
998
1078
  }
999
1079
  });
1000
1080
 
1001
1081
  // core/top-nav/top-nav.tsx
1002
- import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
1082
+ import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
1003
1083
  var TopNav = ({
1004
1084
  sections,
1005
1085
  user,
@@ -1009,6 +1089,7 @@ var TopNav = ({
1009
1089
  navLabel = "Main navigation",
1010
1090
  menuLabel = "Menu",
1011
1091
  accountLabel = "Account",
1092
+ share = {},
1012
1093
  install = {},
1013
1094
  logout = {},
1014
1095
  onLogout
@@ -1051,7 +1132,7 @@ var TopNav = ({
1051
1132
  };
1052
1133
  return /* @__PURE__ */ jsxs7("header", { className: styles.base(), onPointerDown: markPressInside, children: [
1053
1134
  /* @__PURE__ */ jsxs7("div", { className: styles.bar(), children: [
1054
- hasLinks ? /* @__PURE__ */ jsx12(
1135
+ hasLinks ? /* @__PURE__ */ jsx13(
1055
1136
  Button,
1056
1137
  {
1057
1138
  color: "ghost",
@@ -1061,8 +1142,8 @@ var TopNav = ({
1061
1142
  "aria-expanded": menuOpen,
1062
1143
  onClick: toggleMenu
1063
1144
  }
1064
- ) : /* @__PURE__ */ jsx12("span", { "aria-hidden": "true", className: styles.spacer() }),
1065
- /* @__PURE__ */ jsx12("div", { className: styles.home(), children: homeHref && /* @__PURE__ */ jsxs7(
1145
+ ) : /* @__PURE__ */ jsx13("span", { "aria-hidden": "true", className: styles.spacer() }),
1146
+ /* @__PURE__ */ jsx13("div", { className: styles.home(), children: homeHref && /* @__PURE__ */ jsxs7(
1066
1147
  Link,
1067
1148
  {
1068
1149
  href: homeHref,
@@ -1072,12 +1153,12 @@ var TopNav = ({
1072
1153
  "aria-label": homeLabel || "Home",
1073
1154
  onClick: close,
1074
1155
  children: [
1075
- /* @__PURE__ */ jsx12(Icon, { name: "Home" }),
1076
- homeLabel && /* @__PURE__ */ jsx12(Text, { as: "span", variant: "caption", children: homeLabel })
1156
+ /* @__PURE__ */ jsx13(Icon, { name: "Home" }),
1157
+ homeLabel && /* @__PURE__ */ jsx13(Text, { as: "span", variant: "caption", children: homeLabel })
1077
1158
  ]
1078
1159
  }
1079
1160
  ) }),
1080
- /* @__PURE__ */ jsx12(
1161
+ /* @__PURE__ */ jsx13(
1081
1162
  Button,
1082
1163
  {
1083
1164
  color: "ghost",
@@ -1090,35 +1171,48 @@ var TopNav = ({
1090
1171
  )
1091
1172
  ] }),
1092
1173
  accountOpen && /* @__PURE__ */ jsxs7("div", { className: styles.account(), children: [
1093
- /* @__PURE__ */ jsxs7("div", { className: styles.user(), children: [
1094
- /* @__PURE__ */ jsx12(Text, { as: "span", variant: "caption", children: user.name }),
1095
- /* @__PURE__ */ jsx12(Text, { as: "span", variant: "caption", children: user.email })
1174
+ /* @__PURE__ */ jsxs7("div", { className: styles.actions(), children: [
1175
+ /* @__PURE__ */ jsx13(
1176
+ ShareAppButton,
1177
+ {
1178
+ label: share.label ?? "Share app",
1179
+ title: share.title,
1180
+ text: share.text,
1181
+ copiedMessage: share.copiedMessage,
1182
+ errorMessage: share.errorMessage
1183
+ }
1184
+ ),
1185
+ installApp.way && /* @__PURE__ */ jsx13(
1186
+ InstallAppButton,
1187
+ {
1188
+ way: installApp.way,
1189
+ label: install.label ?? "Install app",
1190
+ instructionsTitle: install.instructionsTitle,
1191
+ instructions: install.instructions,
1192
+ onPrompt: installApp.prompt
1193
+ }
1194
+ )
1096
1195
  ] }),
1097
- installApp.way && /* @__PURE__ */ jsx12(
1098
- InstallAppButton,
1099
- {
1100
- way: installApp.way,
1101
- size: "lg",
1102
- label: install.label,
1103
- instructionsTitle: install.instructionsTitle,
1104
- instructions: install.instructions,
1105
- onPrompt: installApp.prompt
1106
- }
1107
- ),
1108
- /* @__PURE__ */ jsx12(
1109
- SignOutButton,
1110
- {
1111
- size: "lg",
1112
- label: logout.label,
1113
- confirmTitle: logout.confirmTitle,
1114
- confirmLabel: logout.confirmLabel,
1115
- cancelLabel: logout.cancelLabel,
1116
- errorMessage: logout.errorMessage,
1117
- onSignOut: onLogout
1118
- }
1119
- )
1196
+ /* @__PURE__ */ jsxs7("div", { className: styles.profile(), children: [
1197
+ /* @__PURE__ */ jsxs7("div", { className: styles.user(), children: [
1198
+ /* @__PURE__ */ jsx13(Text, { as: "span", variant: "caption", children: user.name }),
1199
+ /* @__PURE__ */ jsx13(Text, { as: "span", variant: "caption", children: user.email })
1200
+ ] }),
1201
+ /* @__PURE__ */ jsx13(
1202
+ SignOutButton,
1203
+ {
1204
+ size: "lg",
1205
+ label: logout.label,
1206
+ confirmTitle: logout.confirmTitle,
1207
+ confirmLabel: logout.confirmLabel,
1208
+ cancelLabel: logout.cancelLabel,
1209
+ errorMessage: logout.errorMessage,
1210
+ onSignOut: onLogout
1211
+ }
1212
+ )
1213
+ ] })
1120
1214
  ] }),
1121
- menuOpen && /* @__PURE__ */ jsx12("nav", { "aria-label": navLabel, className: styles.menu(), children: sections.map((section2, i) => /* @__PURE__ */ jsx12("div", { className: styles.section(), children: section2.items.map((item) => /* @__PURE__ */ jsxs7(
1215
+ menuOpen && /* @__PURE__ */ jsx13("nav", { "aria-label": navLabel, className: styles.menu(), children: sections.map((section2, i) => /* @__PURE__ */ jsx13("div", { className: styles.section(), children: section2.items.map((item) => /* @__PURE__ */ jsxs7(
1122
1216
  Link,
1123
1217
  {
1124
1218
  href: item.href,
@@ -1128,8 +1222,8 @@ var TopNav = ({
1128
1222
  "aria-label": item.label,
1129
1223
  onClick: close,
1130
1224
  children: [
1131
- /* @__PURE__ */ jsx12(Icon, { name: item.icon }),
1132
- /* @__PURE__ */ jsx12(Text, { as: "span", variant: "caption", children: item.label })
1225
+ /* @__PURE__ */ jsx13(Icon, { name: item.icon }),
1226
+ /* @__PURE__ */ jsx13(Text, { as: "span", variant: "caption", children: item.label })
1133
1227
  ]
1134
1228
  },
1135
1229
  item.href
@@ -1174,7 +1268,7 @@ var toasterColors = {
1174
1268
  };
1175
1269
 
1176
1270
  // features/toaster/components/toaster/toaster-copy-button.tsx
1177
- import { jsx as jsx13 } from "react/jsx-runtime";
1271
+ import { jsx as jsx14 } from "react/jsx-runtime";
1178
1272
  var ToasterCopyButton = ({ text: text2 }) => {
1179
1273
  const [copied, setCopied] = useState4(false);
1180
1274
  const { copyButton } = toaster();
@@ -1183,7 +1277,7 @@ var ToasterCopyButton = ({ text: text2 }) => {
1183
1277
  // Without permission the browser refuses, and the button stays on Copy.
1184
1278
  () => void 0
1185
1279
  );
1186
- return /* @__PURE__ */ jsx13("span", { className: copyButton(), children: /* @__PURE__ */ jsx13(
1280
+ return /* @__PURE__ */ jsx14("span", { className: copyButton(), children: /* @__PURE__ */ jsx14(
1187
1281
  Button,
1188
1282
  {
1189
1283
  color: "ghost",
@@ -1196,13 +1290,13 @@ var ToasterCopyButton = ({ text: text2 }) => {
1196
1290
  };
1197
1291
 
1198
1292
  // features/toaster/components/toaster/toast.tsx
1199
- import { jsx as jsx14 } from "react/jsx-runtime";
1293
+ import { jsx as jsx15 } from "react/jsx-runtime";
1200
1294
  var copyText = (message, description2) => typeof description2 === "string" ? `${message}
1201
1295
  ${description2}` : message;
1202
1296
  var withCopy = (show) => (message, data) => show(
1203
1297
  message,
1204
1298
  typeof message === "string" ? {
1205
- action: /* @__PURE__ */ jsx14(ToasterCopyButton, { text: copyText(message, data?.description) }),
1299
+ action: /* @__PURE__ */ jsx15(ToasterCopyButton, { text: copyText(message, data?.description) }),
1206
1300
  ...data
1207
1301
  } : data
1208
1302
  );
@@ -1218,7 +1312,7 @@ var toast = Object.assign(
1218
1312
  // features/toaster/components/toaster/toaster.tsx
1219
1313
  import { useEffect as useEffect3 } from "react";
1220
1314
  import { Toaster as SonnerToaster } from "sonner";
1221
- import { jsx as jsx15 } from "react/jsx-runtime";
1315
+ import { jsx as jsx16 } from "react/jsx-runtime";
1222
1316
  var Toaster = () => {
1223
1317
  const toasts = useToastStore((s) => s.toasts);
1224
1318
  const removeToast = useToastStore((s) => s.removeToast);
@@ -1229,7 +1323,7 @@ var Toaster = () => {
1229
1323
  removeToast(t.id);
1230
1324
  });
1231
1325
  }, [toasts, removeToast]);
1232
- return /* @__PURE__ */ jsx15(
1326
+ return /* @__PURE__ */ jsx16(
1233
1327
  SonnerToaster,
1234
1328
  {
1235
1329
  position: "bottom-right",
@@ -1260,19 +1354,19 @@ var spinner = tv11({
1260
1354
  });
1261
1355
 
1262
1356
  // core/spinner/spinner.tsx
1263
- import { jsx as jsx16 } from "react/jsx-runtime";
1357
+ import { jsx as jsx17 } from "react/jsx-runtime";
1264
1358
  var Spinner = ({
1265
1359
  variant = "circle",
1266
1360
  size = "md",
1267
1361
  label = "Loading"
1268
- }) => /* @__PURE__ */ jsx16(
1362
+ }) => /* @__PURE__ */ jsx17(
1269
1363
  "span",
1270
1364
  {
1271
1365
  "data-testid": "spinner",
1272
1366
  role: "status",
1273
1367
  "aria-label": label,
1274
1368
  className: spinner(),
1275
- children: /* @__PURE__ */ jsx16(Icon, { name: spinnerIcons[variant], size })
1369
+ children: /* @__PURE__ */ jsx17(Icon, { name: spinnerIcons[variant], size })
1276
1370
  }
1277
1371
  );
1278
1372
 
@@ -1283,15 +1377,15 @@ var loader = tv12({
1283
1377
  });
1284
1378
 
1285
1379
  // features/app/components/loader/loader.tsx
1286
- import { jsx as jsx17 } from "react/jsx-runtime";
1380
+ import { jsx as jsx18 } from "react/jsx-runtime";
1287
1381
  var Loader = ({ label = "Loading" }) => {
1288
1382
  const fetching = useAppStore((s) => s.fetching);
1289
1383
  if (!fetching) return null;
1290
- return /* @__PURE__ */ jsx17("div", { className: loader(), children: /* @__PURE__ */ jsx17(Spinner, { size: "lg", label }) });
1384
+ return /* @__PURE__ */ jsx18("div", { className: loader(), children: /* @__PURE__ */ jsx18(Spinner, { size: "lg", label }) });
1291
1385
  };
1292
1386
 
1293
1387
  // features/app/components/navigation/navigation.tsx
1294
- import { jsx as jsx18 } from "react/jsx-runtime";
1388
+ import { jsx as jsx19 } from "react/jsx-runtime";
1295
1389
  var Navigation = ({
1296
1390
  mode = "auto",
1297
1391
  sections,
@@ -1305,6 +1399,7 @@ var Navigation = ({
1305
1399
  navLabel,
1306
1400
  menuLabel,
1307
1401
  accountLabel,
1402
+ share,
1308
1403
  install,
1309
1404
  logout,
1310
1405
  onLogout
@@ -1315,7 +1410,7 @@ var Navigation = ({
1315
1410
  return null;
1316
1411
  }
1317
1412
  if (desktop) {
1318
- return /* @__PURE__ */ jsx18(
1413
+ return /* @__PURE__ */ jsx19(
1319
1414
  Sidebar,
1320
1415
  {
1321
1416
  sections,
@@ -1327,12 +1422,13 @@ var Navigation = ({
1327
1422
  homeHref,
1328
1423
  homeLabel,
1329
1424
  navLabel,
1425
+ share,
1330
1426
  logout,
1331
1427
  onLogout
1332
1428
  }
1333
1429
  );
1334
1430
  }
1335
- return /* @__PURE__ */ jsx18(
1431
+ return /* @__PURE__ */ jsx19(
1336
1432
  TopNav,
1337
1433
  {
1338
1434
  sections,
@@ -1343,6 +1439,7 @@ var Navigation = ({
1343
1439
  navLabel,
1344
1440
  menuLabel,
1345
1441
  accountLabel,
1442
+ share,
1346
1443
  install,
1347
1444
  logout,
1348
1445
  onLogout
@@ -1384,7 +1481,7 @@ var createReduxStore = ({
1384
1481
  };
1385
1482
 
1386
1483
  // core/state/redux/redux-provider/redux-provider.tsx
1387
- import { jsx as jsx19 } from "react/jsx-runtime";
1484
+ import { jsx as jsx20 } from "react/jsx-runtime";
1388
1485
  var ReduxProvider = ({
1389
1486
  children,
1390
1487
  reducers = {},
@@ -1400,7 +1497,7 @@ var ReduxProvider = ({
1400
1497
  coreReducers
1401
1498
  })
1402
1499
  );
1403
- return /* @__PURE__ */ jsx19(Provider, { store, children });
1500
+ return /* @__PURE__ */ jsx20(Provider, { store, children });
1404
1501
  };
1405
1502
 
1406
1503
  // core/state/zustand/router/router.utils.ts
@@ -1492,7 +1589,7 @@ var card = tv13({
1492
1589
  });
1493
1590
 
1494
1591
  // core/card/card.tsx
1495
- import { jsx as jsx20, jsxs as jsxs8 } from "react/jsx-runtime";
1592
+ import { jsx as jsx21, jsxs as jsxs8 } from "react/jsx-runtime";
1496
1593
  var Card = ({
1497
1594
  children,
1498
1595
  title: title2,
@@ -1504,8 +1601,8 @@ var Card = ({
1504
1601
  const messageColor = color === "none" ? "muted" : "none";
1505
1602
  return /* @__PURE__ */ jsxs8("div", { "data-testid": "card", className: base(), children: [
1506
1603
  (title2 || message) && /* @__PURE__ */ jsxs8("div", { className: header3(), children: [
1507
- title2 && /* @__PURE__ */ jsx20(Heading, { level: titleLevel, children: title2 }),
1508
- message && /* @__PURE__ */ jsx20(Text, { color: messageColor, children: message })
1604
+ title2 && /* @__PURE__ */ jsx21(Heading, { level: titleLevel, children: title2 }),
1605
+ message && /* @__PURE__ */ jsx21(Text, { color: messageColor, children: message })
1509
1606
  ] }),
1510
1607
  children
1511
1608
  ] });
@@ -1520,7 +1617,7 @@ var accessPending = tv14({
1520
1617
  });
1521
1618
 
1522
1619
  // features/auth/components/access-pending/access-pending.tsx
1523
- import { jsx as jsx21, jsxs as jsxs9 } from "react/jsx-runtime";
1620
+ import { jsx as jsx22, jsxs as jsxs9 } from "react/jsx-runtime";
1524
1621
  var AccessPending = ({
1525
1622
  title: title2 = "Waiting for approval",
1526
1623
  message = "Your access to this app has not been approved yet.",
@@ -1535,9 +1632,9 @@ var AccessPending = ({
1535
1632
  if (!user) {
1536
1633
  return null;
1537
1634
  }
1538
- return /* @__PURE__ */ jsx21(Card, { title: title2, titleLevel: 1, message, children: /* @__PURE__ */ jsxs9("div", { className: account(), children: [
1539
- /* @__PURE__ */ jsx21(Text, { variant: "caption", color: "muted", children: user.email }),
1540
- /* @__PURE__ */ jsx21(
1635
+ return /* @__PURE__ */ jsx22(Card, { title: title2, titleLevel: 1, message, children: /* @__PURE__ */ jsxs9("div", { className: account(), children: [
1636
+ /* @__PURE__ */ jsx22(Text, { variant: "caption", color: "muted", children: user.email }),
1637
+ /* @__PURE__ */ jsx22(
1541
1638
  SignOutButton,
1542
1639
  {
1543
1640
  label: signOutLabel,
@@ -1552,7 +1649,7 @@ var AccessPending = ({
1552
1649
 
1553
1650
  // features/auth/components/auth-provider/auth-provider.tsx
1554
1651
  import { useEffect as useEffect4 } from "react";
1555
- import { Fragment as Fragment6, jsx as jsx22 } from "react/jsx-runtime";
1652
+ import { Fragment as Fragment6, jsx as jsx23 } from "react/jsx-runtime";
1556
1653
  var AuthProvider = ({
1557
1654
  adapter,
1558
1655
  appId,
@@ -1569,7 +1666,7 @@ var AuthProvider = ({
1569
1666
  reset();
1570
1667
  };
1571
1668
  }, [adapter, appId, configure, setSession, reset]);
1572
- return /* @__PURE__ */ jsx22(Fragment6, { children });
1669
+ return /* @__PURE__ */ jsx23(Fragment6, { children });
1573
1670
  };
1574
1671
 
1575
1672
  // features/auth/components/login/login.const.ts
@@ -1591,7 +1688,7 @@ var login = tv15({
1591
1688
  });
1592
1689
 
1593
1690
  // features/auth/components/login/login.tsx
1594
- import { jsx as jsx23 } from "react/jsx-runtime";
1691
+ import { jsx as jsx24 } from "react/jsx-runtime";
1595
1692
  var LoginProviderButton = ({
1596
1693
  id,
1597
1694
  label,
@@ -1600,7 +1697,7 @@ var LoginProviderButton = ({
1600
1697
  const signIn = () => {
1601
1698
  onSignIn(id);
1602
1699
  };
1603
- return /* @__PURE__ */ jsx23(Button, { size: "lg", fullWidth: true, onClick: signIn, children: label });
1700
+ return /* @__PURE__ */ jsx24(Button, { size: "lg", fullWidth: true, onClick: signIn, children: label });
1604
1701
  };
1605
1702
  var Login = ({
1606
1703
  vendor,
@@ -1618,9 +1715,9 @@ var Login = ({
1618
1715
  useToastStore.getState().error(errorMessage);
1619
1716
  });
1620
1717
  };
1621
- return /* @__PURE__ */ jsx23(Card, { title: title2, titleLevel: 1, message, children: /* @__PURE__ */ jsx23("div", { className: options(), children: providers.map((provider) => {
1718
+ return /* @__PURE__ */ jsx24(Card, { title: title2, titleLevel: 1, message, children: /* @__PURE__ */ jsx24("div", { className: options(), children: providers.map((provider) => {
1622
1719
  const id = String(provider);
1623
- return /* @__PURE__ */ jsx23(
1720
+ return /* @__PURE__ */ jsx24(
1624
1721
  LoginProviderButton,
1625
1722
  {
1626
1723
  id,
@@ -1633,7 +1730,7 @@ var Login = ({
1633
1730
  };
1634
1731
 
1635
1732
  // features/auth/components/authorized/authorized.tsx
1636
- import { Fragment as Fragment7, jsx as jsx24 } from "react/jsx-runtime";
1733
+ import { Fragment as Fragment7, jsx as jsx25 } from "react/jsx-runtime";
1637
1734
  var Authorized = ({
1638
1735
  children,
1639
1736
  roles,
@@ -1642,18 +1739,18 @@ var Authorized = ({
1642
1739
  }) => {
1643
1740
  const { status, user, role } = useAuth();
1644
1741
  if (status === "loading") return null;
1645
- if (!user) return /* @__PURE__ */ jsx24(Login, { ...login2 });
1742
+ if (!user) return /* @__PURE__ */ jsx25(Login, { ...login2 });
1646
1743
  const hasRole = !roles || role !== null && roles.includes(role);
1647
- if (!user.hasAccess || !hasRole) return /* @__PURE__ */ jsx24(AccessPending, { ...accessPending2 });
1648
- return /* @__PURE__ */ jsx24(Fragment7, { children });
1744
+ if (!user.hasAccess || !hasRole) return /* @__PURE__ */ jsx25(AccessPending, { ...accessPending2 });
1745
+ return /* @__PURE__ */ jsx25(Fragment7, { children });
1649
1746
  };
1650
1747
 
1651
1748
  // features/providers/components/zustand-providers/zustand-providers.tsx
1652
- import { Fragment as Fragment8, jsx as jsx25, jsxs as jsxs10 } from "react/jsx-runtime";
1749
+ import { Fragment as Fragment8, jsx as jsx26, jsxs as jsxs10 } from "react/jsx-runtime";
1653
1750
  var ZustandProviders = ({ children, auth }) => /* @__PURE__ */ jsxs10(Fragment8, { children: [
1654
- /* @__PURE__ */ jsx25(Loader, {}),
1655
- /* @__PURE__ */ jsx25(Toaster, {}),
1656
- auth ? /* @__PURE__ */ jsx25(AuthProvider, { adapter: auth.adapter, appId: auth.appId, children }) : children
1751
+ /* @__PURE__ */ jsx26(Loader, {}),
1752
+ /* @__PURE__ */ jsx26(Toaster, {}),
1753
+ auth ? /* @__PURE__ */ jsx26(AuthProvider, { adapter: auth.adapter, appId: auth.appId, children }) : children
1657
1754
  ] });
1658
1755
 
1659
1756
  export {
@@ -1662,10 +1759,11 @@ export {
1662
1759
  Text,
1663
1760
  Modal,
1664
1761
  Heading,
1762
+ useToastStore,
1763
+ ShareAppButton,
1665
1764
  appInitialState,
1666
1765
  useAppStore,
1667
1766
  ConnectedModal,
1668
- useToastStore,
1669
1767
  getAuthSession,
1670
1768
  useAuth,
1671
1769
  SignOutButton,
package/dist/index.d.ts CHANGED
@@ -12,12 +12,14 @@ import 'react-hook-form';
12
12
  */
13
13
  type Size = "sm" | "md" | "lg";
14
14
 
15
- declare const iconNames: readonly ["Check", "X", "Plus", "Minus", "Search", "Menu", "ChevronDown", "ChevronUp", "ChevronLeft", "ChevronRight", "ChevronsUp", "ArrowUp", "Pencil", "Trash2", "Save", "RefreshCw", "Home", "MessageSquare", "Users", "Store", "ShoppingCart", "BarChart3", "Brain", "Send", "LogOut", "Download", "User", "Key", "Contact", "Package", "Warehouse", "HandCoins", "Stethoscope", "LogIn", "Megaphone", "LayoutDashboard", "Smile", "Frown", "Cat", "ArrowRight", "Loader", "LoaderCircle", "CheckCircle", "XCircle", "AlertTriangle", "Info", "Route", "Navigation", "ListChecks", "Map", "MapPinOff", "Settings", "SiWhatsapp", "SiFacebook", "SiInstagram", "SiShopify", "SiGithub"];
15
+ declare const iconNames: readonly ["Check", "X", "Plus", "Minus", "Search", "Menu", "ChevronDown", "ChevronUp", "ChevronLeft", "ChevronRight", "ChevronsUp", "ArrowUp", "Pencil", "Trash2", "Save", "RefreshCw", "Home", "MessageSquare", "Users", "Store", "ShoppingCart", "BarChart3", "Brain", "Send", "LogOut", "Download", "Share2", "User", "Key", "Contact", "Package", "Warehouse", "HandCoins", "Stethoscope", "LogIn", "Megaphone", "LayoutDashboard", "Smile", "Frown", "Cat", "ArrowRight", "Loader", "LoaderCircle", "CheckCircle", "XCircle", "AlertTriangle", "Info", "Route", "Navigation", "ListChecks", "Map", "MapPinOff", "Settings", "SiWhatsapp", "SiFacebook", "SiInstagram", "SiShopify", "SiGithub", "SiVercel"];
16
16
 
17
17
  type IconName = (typeof iconNames)[number];
18
+ /** The sizes every component has, and `xl` for an icon that stands alone. */
19
+ type IconSize = Size | "xl";
18
20
  interface IconProps {
19
21
  name: IconName;
20
- size?: Size;
22
+ size?: IconSize;
21
23
  color?: SemanticColor;
22
24
  "aria-label"?: string;
23
25
  }
@@ -243,6 +245,32 @@ interface TextProps {
243
245
 
244
246
  declare const Text: ({ children, as: Tag, variant, color, }: TextProps) => react.JSX.Element;
245
247
 
248
+ interface ShareAppButtonProps {
249
+ /** The text of the button. With `iconOnly`, its accessible name. */
250
+ label: string;
251
+ /**
252
+ * Shows the icon alone, for a place with no room for the text, such as a
253
+ * collapsed sidebar.
254
+ */
255
+ iconOnly?: boolean;
256
+ /** The size of the button. `lg` is for a touch screen. */
257
+ size?: Size;
258
+ /**
259
+ * The title of what is shared. By default the title of the page. The address
260
+ * is always the origin of the page: where the app starts, whatever page the
261
+ * user is on.
262
+ */
263
+ title?: string;
264
+ /** A text that goes with the address, such as how to ask for access. */
265
+ text?: string;
266
+ /** The toast shown when the address is copied instead of shared. */
267
+ copiedMessage?: string;
268
+ /** The toast shown when the address could be neither shared nor copied. */
269
+ errorMessage?: string;
270
+ }
271
+
272
+ declare const ShareAppButton: ({ label, iconOnly, size, title, text, copiedMessage, errorMessage, }: ShareAppButtonProps) => react.JSX.Element;
273
+
246
274
  interface SignOutButtonProps {
247
275
  /** The accessible name of the icon button. */
248
276
  label?: string;
@@ -290,6 +318,12 @@ interface SidebarProps {
290
318
  homeLabel?: string;
291
319
  /** The accessible name of the navigation. */
292
320
  navLabel?: string;
321
+ /**
322
+ * The share button, over the user: its texts (`label`, `copiedMessage` and
323
+ * `errorMessage`) and what goes with the address of the app (`title` and
324
+ * `text`).
325
+ */
326
+ share?: Partial<Omit<ShareAppButtonProps, "iconOnly" | "size">>;
293
327
  /**
294
328
  * The texts of the logout button and of the modal it opens: `label`,
295
329
  * `confirmTitle`, `confirmLabel`, `cancelLabel` and `errorMessage`.
@@ -302,7 +336,7 @@ interface SidebarProps {
302
336
  onLogout: () => void | Promise<void>;
303
337
  }
304
338
 
305
- declare const Sidebar: ({ sections, user, activeHref, defaultCollapsed, collapseLabel, expandLabel, homeHref, homeLabel, navLabel, logout, onLogout, }: SidebarProps) => react.JSX.Element;
339
+ declare const Sidebar: ({ sections, user, activeHref, defaultCollapsed, collapseLabel, expandLabel, homeHref, homeLabel, navLabel, share, logout, onLogout, }: SidebarProps) => react.JSX.Element;
306
340
 
307
341
  interface TabsItem {
308
342
  /** Unique among the tabs. `defaultTab` and `onChange` use it. */
@@ -365,9 +399,14 @@ interface InstallAppButtonProps {
365
399
  * `onPrompt` on a click, and `instructions` opens a modal with the steps.
366
400
  */
367
401
  way: InstallAppWay;
368
- /** The accessible name of the icon button. */
369
- label?: string;
370
- /** The size of the icon button. `lg` is for a touch screen. */
402
+ /** The text of the button. With `iconOnly`, its accessible name. */
403
+ label: string;
404
+ /**
405
+ * Shows the icon alone, for a place with no room for the text, such as a
406
+ * collapsed sidebar.
407
+ */
408
+ iconOnly?: boolean;
409
+ /** The size of the button. `lg` is for a touch screen. */
371
410
  size?: Size;
372
411
  /** The title of the modal with the steps. */
373
412
  instructionsTitle?: string;
@@ -380,7 +419,7 @@ interface InstallAppButtonProps {
380
419
  onPrompt: () => void;
381
420
  }
382
421
 
383
- declare const InstallAppButton: ({ way, label, size, instructionsTitle, instructions, onPrompt, }: InstallAppButtonProps) => react.JSX.Element;
422
+ declare const InstallAppButton: ({ way, label, iconOnly, size, instructionsTitle, instructions, onPrompt, }: InstallAppButtonProps) => react.JSX.Element;
384
423
 
385
424
  interface TopNavProps {
386
425
  /**
@@ -399,12 +438,19 @@ interface TopNavProps {
399
438
  menuLabel?: string;
400
439
  /** The accessible name of the account button. */
401
440
  accountLabel?: string;
441
+ /**
442
+ * The share button, the first line of the account panel: its texts (`label`,
443
+ * `copiedMessage` and `errorMessage`) and what goes with the address of the
444
+ * app (`title` and `text`).
445
+ */
446
+ share?: Partial<Omit<ShareAppButtonProps, "iconOnly" | "size">>;
402
447
  /**
403
448
  * The texts of the install button and of the modal with its steps: `label`,
404
- * `instructionsTitle` and `instructions`. The button shows before the logout
405
- * button, only in a browser that can put the app on the home screen.
449
+ * `instructionsTitle` and `instructions`. The button has its own line over the
450
+ * user and the logout button, only in a browser that can put the app on the
451
+ * home screen.
406
452
  */
407
- install?: Pick<InstallAppButtonProps, "label" | "instructionsTitle" | "instructions">;
453
+ install?: Partial<Pick<InstallAppButtonProps, "label" | "instructionsTitle" | "instructions">>;
408
454
  /**
409
455
  * The texts of the logout button and of the modal it opens: `label`,
410
456
  * `confirmTitle`, `confirmLabel`, `cancelLabel` and `errorMessage`.
@@ -417,7 +463,7 @@ interface TopNavProps {
417
463
  onLogout: () => void | Promise<void>;
418
464
  }
419
465
 
420
- declare const TopNav: ({ sections, user, activeHref, homeHref, homeLabel, navLabel, menuLabel, accountLabel, install, logout, onLogout, }: TopNavProps) => react.JSX.Element;
466
+ declare const TopNav: ({ sections, user, activeHref, homeHref, homeLabel, navLabel, menuLabel, accountLabel, share, install, logout, onLogout, }: TopNavProps) => react.JSX.Element;
421
467
 
422
468
  type TagColor = Exclude<SemanticColor, "none"> | AuxiliaryColor;
423
469
  interface TagProps {
@@ -500,7 +546,7 @@ interface NavigationProps extends SidebarProps, Pick<TopNavProps, "menuLabel" |
500
546
  mode?: NavigationMode;
501
547
  }
502
548
 
503
- declare const Navigation: ({ mode, sections, user, activeHref, defaultCollapsed, collapseLabel, expandLabel, homeHref, homeLabel, navLabel, menuLabel, accountLabel, install, logout, onLogout, }: NavigationProps) => react.JSX.Element | null;
549
+ declare const Navigation: ({ mode, sections, user, activeHref, defaultCollapsed, collapseLabel, expandLabel, homeHref, homeLabel, navLabel, menuLabel, accountLabel, share, install, logout, onLogout, }: NavigationProps) => react.JSX.Element | null;
504
550
 
505
551
  interface AppState {
506
552
  fetchingCalls: number;
@@ -729,5 +775,5 @@ declare const useAuth: () => UseAuthResult;
729
775
 
730
776
  declare const ZustandProviders: ({ children, auth }: ZustandProvidersProps) => react.JSX.Element;
731
777
 
732
- export { AccessPending, AuthAdapter, AuthProvider, AuthSession, Authorized, AuxiliaryColor, Button, Card, Checkbox, ConnectedModal, DataColor, DataGrid, Error, Form, HTTPClient, Heading, Icon, Input, InstallAppButton, Loader, Login, Modal, Navigation, Radio, ReduxProvider, ReduxProviderProps, Select, SemanticColor, Sidebar, SignOutButton, Spinner, StatsCard, Tabs, Tag, Text, TextArea, Toaster, TopNav, WhatsAppButton, ZustandProviders, ZustandProvidersProps, appInitialState, getAuthSession, splitURLasPath, toast, useAppStore, useAuth, useInstallApp, useIsDesktop, usePageStore, useRouterStore, useToastStore };
733
- export type { AppState, AuthorizedProps, ButtonColor, ButtonProps, ButtonVariant, CardProps, CheckboxProps, CheckboxVariant, ConnectedModalProps, DataGridColumn, DataGridProps, ErrorProps, FormProps, HeadingProps, HttpClientConfig, HttpRequestConfig, IconName, IconProps, InputProps, InstallApp, InstallAppButtonProps, InstallAppWay, LoaderProps, LoginProvider, LoginVendor, ModalProps, NavigationMode, NavigationProps, PageState, RadioProps, ReduxStore, RouterState, SelectOption, SelectProps, SidebarItem, SidebarProps, SidebarSection, SidebarUser, Size, SpinnerProps, SpinnerVariant, StatsCardProps, TabsItem, TabsProps, TagColor, TagProps, TextAreaProps, TextProps, TextVariant, Toast, ToastState, ToastType, TopNavProps, WhatsAppButtonProps };
778
+ export { AccessPending, AuthAdapter, AuthProvider, AuthSession, Authorized, AuxiliaryColor, Button, Card, Checkbox, ConnectedModal, DataColor, DataGrid, Error, Form, HTTPClient, Heading, Icon, Input, InstallAppButton, Loader, Login, Modal, Navigation, Radio, ReduxProvider, ReduxProviderProps, Select, SemanticColor, ShareAppButton, Sidebar, SignOutButton, Spinner, StatsCard, Tabs, Tag, Text, TextArea, Toaster, TopNav, WhatsAppButton, ZustandProviders, ZustandProvidersProps, appInitialState, getAuthSession, splitURLasPath, toast, useAppStore, useAuth, useInstallApp, useIsDesktop, usePageStore, useRouterStore, useToastStore };
779
+ export type { AppState, AuthorizedProps, ButtonColor, ButtonProps, ButtonVariant, CardProps, CheckboxProps, CheckboxVariant, ConnectedModalProps, DataGridColumn, DataGridProps, ErrorProps, FormProps, HeadingProps, HttpClientConfig, HttpRequestConfig, IconName, IconProps, IconSize, InputProps, InstallApp, InstallAppButtonProps, InstallAppWay, LoaderProps, LoginProvider, LoginVendor, ModalProps, NavigationMode, NavigationProps, PageState, RadioProps, ReduxStore, RouterState, SelectOption, SelectProps, ShareAppButtonProps, SidebarItem, SidebarProps, SidebarSection, SidebarUser, Size, SpinnerProps, SpinnerVariant, StatsCardProps, TabsItem, TabsProps, TagColor, TagProps, TextAreaProps, TextProps, TextVariant, Toast, ToastState, ToastType, TopNavProps, WhatsAppButtonProps };
package/dist/index.js CHANGED
@@ -14,6 +14,7 @@ import {
14
14
  Modal,
15
15
  Navigation,
16
16
  ReduxProvider,
17
+ ShareAppButton,
17
18
  Sidebar,
18
19
  SignOutButton,
19
20
  Spinner,
@@ -32,7 +33,7 @@ import {
32
33
  usePageStore,
33
34
  useRouterStore,
34
35
  useToastStore
35
- } from "./chunk-MC6RA4BA.js";
36
+ } from "./chunk-DM4EKQGH.js";
36
37
  import {
37
38
  Error,
38
39
  FormInput,
@@ -794,6 +795,7 @@ export {
794
795
  Radio,
795
796
  ReduxProvider,
796
797
  Select,
798
+ ShareAppButton,
797
799
  Sidebar,
798
800
  SignOutButton,
799
801
  Spinner,
@@ -7,7 +7,7 @@ import {
7
7
  ZustandProviders,
8
8
  usePageStore,
9
9
  useRouterStore
10
- } from "../chunk-MC6RA4BA.js";
10
+ } from "../chunk-DM4EKQGH.js";
11
11
 
12
12
  // core/next/root-layout/root-layout.tsx
13
13
  import { Analytics } from "@vercel/analytics/next";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexandregme/zljs",
3
- "version": "3.18.0",
3
+ "version": "3.20.0",
4
4
  "description": "Opinionated, accessible React component library for enterprise apps (Next.js, Tailwind CSS v4).",
5
5
  "keywords": [
6
6
  "react",