@alexandregme/zljs 3.18.0 → 3.19.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 +29 -1
- package/dist/{chunk-MC6RA4BA.js → chunk-4JXA6DG6.js} +244 -149
- package/dist/index.d.ts +57 -13
- package/dist/index.js +3 -1
- package/dist/next/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,33 @@ A change that needs action in an app has a **Migration** note. When updating, re
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [3.19.0] - 2026-11-20
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- `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
|
|
16
|
+
- `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
|
|
17
|
+
- `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
|
|
18
|
+
- `Icon` has the `Share2` icon
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
|
|
22
|
+
- `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
|
|
23
|
+
- 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
|
|
24
|
+
|
|
25
|
+
#### Migration
|
|
26
|
+
|
|
27
|
+
An app that renders `InstallAppButton` itself, outside `TopNav` and `Navigation`:
|
|
28
|
+
|
|
29
|
+
- Pass `label`, or `tsc` fails on the missing prop: `<InstallAppButton label="Install app" … />`. Find where with `grep -rn "<InstallAppButton" app src pages`
|
|
30
|
+
- The button now shows the text. Where only the icon fits, also pass `iconOnly`
|
|
31
|
+
|
|
32
|
+
An app that uses `Sidebar`, `TopNav` or `Navigation` gets the share button when it updates:
|
|
33
|
+
|
|
34
|
+
- 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`
|
|
35
|
+
- The toasts need a `Toaster` in the app, the same one the logout error already needs
|
|
36
|
+
- 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 }}`
|
|
37
|
+
|
|
11
38
|
## [3.18.0] - 2026-11-19
|
|
12
39
|
|
|
13
40
|
### Added
|
|
@@ -577,7 +604,8 @@ Replace the shade with the class of the `color` being tested, for example `/(^|\
|
|
|
577
604
|
|
|
578
605
|
The message of `Error` is `text-zl-danger`. `none` and `ghost` didn't change.
|
|
579
606
|
|
|
580
|
-
[Unreleased]: https://github.com/alexandregme/zljs/compare/v3.
|
|
607
|
+
[Unreleased]: https://github.com/alexandregme/zljs/compare/v3.19.0...HEAD
|
|
608
|
+
[3.19.0]: https://github.com/alexandregme/zljs/compare/v3.18.0...v3.19.0
|
|
581
609
|
[3.18.0]: https://github.com/alexandregme/zljs/compare/v3.17.0...v3.18.0
|
|
582
610
|
[3.17.0]: https://github.com/alexandregme/zljs/compare/v3.16.0...v3.17.0
|
|
583
611
|
[3.16.0]: https://github.com/alexandregme/zljs/compare/v3.15.0...v3.16.0
|
|
@@ -382,6 +382,101 @@ var Heading = ({ children, level = 1, color }) => {
|
|
|
382
382
|
return /* @__PURE__ */ jsx5(Tag, { className: heading({ level, color }), children });
|
|
383
383
|
};
|
|
384
384
|
|
|
385
|
+
// features/toaster/state/toast.store.ts
|
|
386
|
+
import { create } from "zustand";
|
|
387
|
+
import { devtools } from "zustand/middleware";
|
|
388
|
+
|
|
389
|
+
// features/toaster/state/toast.const.ts
|
|
390
|
+
var toastInitialState = {
|
|
391
|
+
toasts: []
|
|
392
|
+
};
|
|
393
|
+
var toastDevtools = { name: "zljs", store: "toast" };
|
|
394
|
+
|
|
395
|
+
// features/toaster/state/toast.store.ts
|
|
396
|
+
var toastId = 0;
|
|
397
|
+
var useToastStore = create()(
|
|
398
|
+
devtools(
|
|
399
|
+
(set, get) => ({
|
|
400
|
+
...toastInitialState,
|
|
401
|
+
addToast: (message, type = "error") => {
|
|
402
|
+
const id = ++toastId;
|
|
403
|
+
set(
|
|
404
|
+
(s) => ({ toasts: [...s.toasts, { id, message, type }] }),
|
|
405
|
+
false,
|
|
406
|
+
"addToast"
|
|
407
|
+
);
|
|
408
|
+
return id;
|
|
409
|
+
},
|
|
410
|
+
removeToast: (id) => set(
|
|
411
|
+
(s) => ({ toasts: s.toasts.filter((t) => t.id !== id) }),
|
|
412
|
+
false,
|
|
413
|
+
"removeToast"
|
|
414
|
+
),
|
|
415
|
+
success: (message) => get().addToast(message, "success"),
|
|
416
|
+
error: (message) => get().addToast(message, "error"),
|
|
417
|
+
info: (message) => get().addToast(message, "info"),
|
|
418
|
+
warning: (message) => get().addToast(message, "warning")
|
|
419
|
+
}),
|
|
420
|
+
toastDevtools
|
|
421
|
+
)
|
|
422
|
+
);
|
|
423
|
+
|
|
424
|
+
// features/app/components/share-app-button/share-app-button.const.ts
|
|
425
|
+
var SHARE_APP_CANCELLED = "AbortError";
|
|
426
|
+
|
|
427
|
+
// features/app/components/share-app-button/share-app-button.tsx
|
|
428
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
429
|
+
var ShareAppButton = ({
|
|
430
|
+
label,
|
|
431
|
+
iconOnly = false,
|
|
432
|
+
size = "md",
|
|
433
|
+
title: title2,
|
|
434
|
+
text: text2,
|
|
435
|
+
copiedMessage = "Link copied",
|
|
436
|
+
errorMessage = "Could not share the link"
|
|
437
|
+
}) => {
|
|
438
|
+
const copy = async (address) => {
|
|
439
|
+
try {
|
|
440
|
+
await navigator.clipboard.writeText(address);
|
|
441
|
+
useToastStore.getState().success(copiedMessage);
|
|
442
|
+
} catch {
|
|
443
|
+
useToastStore.getState().error(errorMessage);
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
const shareOrCopy = async () => {
|
|
447
|
+
const address = window.location.origin;
|
|
448
|
+
if (typeof navigator.share !== "function") {
|
|
449
|
+
await copy(address);
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
try {
|
|
453
|
+
await navigator.share({
|
|
454
|
+
title: title2 ?? document.title,
|
|
455
|
+
text: text2,
|
|
456
|
+
url: address
|
|
457
|
+
});
|
|
458
|
+
} catch (reason) {
|
|
459
|
+
if (reason.name !== SHARE_APP_CANCELLED) {
|
|
460
|
+
await copy(address);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
const share = () => {
|
|
465
|
+
void shareOrCopy();
|
|
466
|
+
};
|
|
467
|
+
return /* @__PURE__ */ jsx6(
|
|
468
|
+
Button,
|
|
469
|
+
{
|
|
470
|
+
color: "ghost",
|
|
471
|
+
size,
|
|
472
|
+
icon: "Share2",
|
|
473
|
+
"aria-label": iconOnly ? label : void 0,
|
|
474
|
+
onClick: share,
|
|
475
|
+
children: !iconOnly && label
|
|
476
|
+
}
|
|
477
|
+
);
|
|
478
|
+
};
|
|
479
|
+
|
|
385
480
|
// features/app/state/app.const.ts
|
|
386
481
|
var appInitialState = {
|
|
387
482
|
fetchingCalls: 0,
|
|
@@ -391,10 +486,10 @@ var appInitialState = {
|
|
|
391
486
|
var appDevtools = { name: "zljs", store: "app" };
|
|
392
487
|
|
|
393
488
|
// features/app/state/app.store.ts
|
|
394
|
-
import { create } from "zustand";
|
|
395
|
-
import { devtools } from "zustand/middleware";
|
|
396
|
-
var useAppStore =
|
|
397
|
-
|
|
489
|
+
import { create as create2 } from "zustand";
|
|
490
|
+
import { devtools as devtools2 } from "zustand/middleware";
|
|
491
|
+
var useAppStore = create2()(
|
|
492
|
+
devtools2(
|
|
398
493
|
(set, get) => ({
|
|
399
494
|
...appInitialState,
|
|
400
495
|
startFetching: () => set(
|
|
@@ -440,7 +535,7 @@ var useAppStore = create()(
|
|
|
440
535
|
);
|
|
441
536
|
|
|
442
537
|
// features/app/components/connected-modal/connected-modal.tsx
|
|
443
|
-
import { jsx as
|
|
538
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
444
539
|
var ConnectedModal = ({
|
|
445
540
|
modalId,
|
|
446
541
|
title: title2,
|
|
@@ -454,7 +549,7 @@ var ConnectedModal = ({
|
|
|
454
549
|
const close = () => {
|
|
455
550
|
closeModal(modalId);
|
|
456
551
|
};
|
|
457
|
-
return /* @__PURE__ */
|
|
552
|
+
return /* @__PURE__ */ jsx7(
|
|
458
553
|
Modal,
|
|
459
554
|
{
|
|
460
555
|
open,
|
|
@@ -468,45 +563,6 @@ var ConnectedModal = ({
|
|
|
468
563
|
);
|
|
469
564
|
};
|
|
470
565
|
|
|
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
566
|
// features/auth/state/auth.store.ts
|
|
511
567
|
import { create as create3 } from "zustand";
|
|
512
568
|
import { devtools as devtools3 } from "zustand/middleware";
|
|
@@ -579,7 +635,7 @@ var signOutModal = tv6({
|
|
|
579
635
|
});
|
|
580
636
|
|
|
581
637
|
// features/auth/components/sign-out/sign-out-modal.tsx
|
|
582
|
-
import { jsx as
|
|
638
|
+
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
583
639
|
var SignOutModal = ({
|
|
584
640
|
title: title2 = "Sign out?",
|
|
585
641
|
confirmLabel = "Sign out",
|
|
@@ -589,7 +645,7 @@ var SignOutModal = ({
|
|
|
589
645
|
}) => {
|
|
590
646
|
const { signOut } = useAuth();
|
|
591
647
|
const closeModal = useAppStore((s) => s.closeModal);
|
|
592
|
-
const { actions } = signOutModal();
|
|
648
|
+
const { actions: actions2 } = signOutModal();
|
|
593
649
|
const stay = () => {
|
|
594
650
|
closeModal(SIGN_OUT_MODAL_ID);
|
|
595
651
|
};
|
|
@@ -607,23 +663,23 @@ var SignOutModal = ({
|
|
|
607
663
|
closeModal(SIGN_OUT_MODAL_ID);
|
|
608
664
|
signOutOfApp().catch(showError);
|
|
609
665
|
};
|
|
610
|
-
return /* @__PURE__ */
|
|
666
|
+
return /* @__PURE__ */ jsx8(
|
|
611
667
|
ConnectedModal,
|
|
612
668
|
{
|
|
613
669
|
modalId: SIGN_OUT_MODAL_ID,
|
|
614
670
|
title: title2,
|
|
615
671
|
size: "xs",
|
|
616
672
|
color: "danger",
|
|
617
|
-
children: /* @__PURE__ */ jsxs3("div", { className:
|
|
618
|
-
/* @__PURE__ */
|
|
619
|
-
/* @__PURE__ */
|
|
673
|
+
children: /* @__PURE__ */ jsxs3("div", { className: actions2(), children: [
|
|
674
|
+
/* @__PURE__ */ jsx8(Button, { color: "ghost", onClick: stay, children: cancelLabel }),
|
|
675
|
+
/* @__PURE__ */ jsx8(Button, { color: "danger", onClick: leave, children: confirmLabel })
|
|
620
676
|
] })
|
|
621
677
|
}
|
|
622
678
|
);
|
|
623
679
|
};
|
|
624
680
|
|
|
625
681
|
// features/auth/components/sign-out/sign-out-button.tsx
|
|
626
|
-
import { Fragment as Fragment3, jsx as
|
|
682
|
+
import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
627
683
|
var SignOutButton = ({
|
|
628
684
|
label = "Sign out",
|
|
629
685
|
size = "md",
|
|
@@ -638,7 +694,7 @@ var SignOutButton = ({
|
|
|
638
694
|
openModal(SIGN_OUT_MODAL_ID);
|
|
639
695
|
};
|
|
640
696
|
return /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
641
|
-
/* @__PURE__ */
|
|
697
|
+
/* @__PURE__ */ jsx9(
|
|
642
698
|
Button,
|
|
643
699
|
{
|
|
644
700
|
color: "ghost",
|
|
@@ -648,7 +704,7 @@ var SignOutButton = ({
|
|
|
648
704
|
onClick: ask
|
|
649
705
|
}
|
|
650
706
|
),
|
|
651
|
-
/* @__PURE__ */
|
|
707
|
+
/* @__PURE__ */ jsx9(
|
|
652
708
|
SignOutModal,
|
|
653
709
|
{
|
|
654
710
|
title: confirmTitle,
|
|
@@ -702,7 +758,7 @@ var link = tv7({
|
|
|
702
758
|
});
|
|
703
759
|
|
|
704
760
|
// core/next/link/link.tsx
|
|
705
|
-
import { jsx as
|
|
761
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
706
762
|
var Link = ({
|
|
707
763
|
children,
|
|
708
764
|
href,
|
|
@@ -713,7 +769,7 @@ var Link = ({
|
|
|
713
769
|
"aria-label": ariaLabel,
|
|
714
770
|
onClick
|
|
715
771
|
}) => {
|
|
716
|
-
return /* @__PURE__ */
|
|
772
|
+
return /* @__PURE__ */ jsx10(
|
|
717
773
|
NextLink,
|
|
718
774
|
{
|
|
719
775
|
href,
|
|
@@ -750,6 +806,9 @@ var header2 = tv8({
|
|
|
750
806
|
var section = tv8({
|
|
751
807
|
base: "grid gap-1 p-2"
|
|
752
808
|
});
|
|
809
|
+
var actions = tv8({
|
|
810
|
+
base: "shrink-0 grid p-2 [&>button]:h-10 [&>button]:justify-start [&>button]:px-3 [&>button]:overflow-hidden [&>button]:whitespace-nowrap"
|
|
811
|
+
});
|
|
753
812
|
var footer = tv8({
|
|
754
813
|
base: "shrink-0 h-16 p-3 flex items-center gap-3",
|
|
755
814
|
variants: {
|
|
@@ -769,7 +828,7 @@ var toggleButton = tv8({
|
|
|
769
828
|
});
|
|
770
829
|
|
|
771
830
|
// core/sidebar/sidebar.tsx
|
|
772
|
-
import { Fragment as Fragment4, jsx as
|
|
831
|
+
import { Fragment as Fragment4, jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
773
832
|
var getInitials = (name) => {
|
|
774
833
|
const parts = name.trim().split(/\s+/);
|
|
775
834
|
if (parts.length >= 2) {
|
|
@@ -787,6 +846,7 @@ var Sidebar = ({
|
|
|
787
846
|
homeHref = "/",
|
|
788
847
|
homeLabel,
|
|
789
848
|
navLabel = "Main navigation",
|
|
849
|
+
share = {},
|
|
790
850
|
logout = {},
|
|
791
851
|
onLogout
|
|
792
852
|
}) => {
|
|
@@ -798,7 +858,7 @@ var Sidebar = ({
|
|
|
798
858
|
setCollapsed(!collapsed);
|
|
799
859
|
};
|
|
800
860
|
return /* @__PURE__ */ jsxs5("aside", { className: sidebar({ collapsed }), children: [
|
|
801
|
-
homeHref && /* @__PURE__ */
|
|
861
|
+
homeHref && /* @__PURE__ */ jsx11("div", { className: header2(), children: /* @__PURE__ */ jsxs5(
|
|
802
862
|
Link,
|
|
803
863
|
{
|
|
804
864
|
href: homeHref,
|
|
@@ -807,12 +867,12 @@ var Sidebar = ({
|
|
|
807
867
|
active: homeHref === activeHref,
|
|
808
868
|
"aria-label": homeLabel || "Home",
|
|
809
869
|
children: [
|
|
810
|
-
/* @__PURE__ */
|
|
811
|
-
homeLabel && !collapsed && /* @__PURE__ */
|
|
870
|
+
/* @__PURE__ */ jsx11(Icon, { name: "Home" }),
|
|
871
|
+
homeLabel && !collapsed && /* @__PURE__ */ jsx11(Text, { as: "span", variant: "caption", children: homeLabel })
|
|
812
872
|
]
|
|
813
873
|
}
|
|
814
874
|
) }),
|
|
815
|
-
/* @__PURE__ */
|
|
875
|
+
/* @__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
876
|
Link,
|
|
817
877
|
{
|
|
818
878
|
href: sidebarItem.href,
|
|
@@ -821,21 +881,32 @@ var Sidebar = ({
|
|
|
821
881
|
active: sidebarItem.href === activeHref,
|
|
822
882
|
"aria-label": sidebarItem.label,
|
|
823
883
|
children: [
|
|
824
|
-
/* @__PURE__ */
|
|
825
|
-
!collapsed && /* @__PURE__ */
|
|
884
|
+
/* @__PURE__ */ jsx11(Icon, { name: sidebarItem.icon }),
|
|
885
|
+
!collapsed && /* @__PURE__ */ jsx11(Text, { as: "span", variant: "caption", children: sidebarItem.label })
|
|
826
886
|
]
|
|
827
887
|
},
|
|
828
888
|
sidebarItem.href
|
|
829
889
|
)) }, i)) }),
|
|
890
|
+
/* @__PURE__ */ jsx11("div", { className: actions(), children: /* @__PURE__ */ jsx11(
|
|
891
|
+
ShareAppButton,
|
|
892
|
+
{
|
|
893
|
+
label: share.label ?? "Share app",
|
|
894
|
+
iconOnly: collapsed,
|
|
895
|
+
title: share.title,
|
|
896
|
+
text: share.text,
|
|
897
|
+
copiedMessage: share.copiedMessage,
|
|
898
|
+
errorMessage: share.errorMessage
|
|
899
|
+
}
|
|
900
|
+
) }),
|
|
830
901
|
/* @__PURE__ */ jsxs5("div", { className: footer({ collapsed }), children: [
|
|
831
902
|
!collapsed && /* @__PURE__ */ jsxs5(Fragment4, { children: [
|
|
832
|
-
/* @__PURE__ */
|
|
903
|
+
/* @__PURE__ */ jsx11("div", { "aria-hidden": "true", className: avatar(), children: initials }),
|
|
833
904
|
/* @__PURE__ */ jsxs5("div", { className: userInfo(), children: [
|
|
834
|
-
/* @__PURE__ */
|
|
835
|
-
/* @__PURE__ */
|
|
905
|
+
/* @__PURE__ */ jsx11(Text, { as: "span", variant: "caption", children: user.name }),
|
|
906
|
+
/* @__PURE__ */ jsx11(Text, { as: "span", variant: "caption", children: user.email })
|
|
836
907
|
] })
|
|
837
908
|
] }),
|
|
838
|
-
/* @__PURE__ */
|
|
909
|
+
/* @__PURE__ */ jsx11(
|
|
839
910
|
SignOutButton,
|
|
840
911
|
{
|
|
841
912
|
label: logout.label,
|
|
@@ -847,7 +918,7 @@ var Sidebar = ({
|
|
|
847
918
|
}
|
|
848
919
|
)
|
|
849
920
|
] }),
|
|
850
|
-
/* @__PURE__ */
|
|
921
|
+
/* @__PURE__ */ jsx11("div", { className: toggleButton(), children: /* @__PURE__ */ jsx11(
|
|
851
922
|
Button,
|
|
852
923
|
{
|
|
853
924
|
color: "ghost",
|
|
@@ -864,10 +935,11 @@ var Sidebar = ({
|
|
|
864
935
|
var INSTALL_APP_MODAL_ID = "zljs-install-app";
|
|
865
936
|
|
|
866
937
|
// features/app/components/install-app-button/install-app-button.tsx
|
|
867
|
-
import { Fragment as Fragment5, jsx as
|
|
938
|
+
import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
868
939
|
var InstallAppButton = ({
|
|
869
940
|
way,
|
|
870
|
-
label
|
|
941
|
+
label,
|
|
942
|
+
iconOnly = false,
|
|
871
943
|
size = "md",
|
|
872
944
|
instructionsTitle = "Install this app",
|
|
873
945
|
instructions = "Tap the Share button of the browser, then Add to Home Screen.",
|
|
@@ -882,17 +954,18 @@ var InstallAppButton = ({
|
|
|
882
954
|
}
|
|
883
955
|
};
|
|
884
956
|
return /* @__PURE__ */ jsxs6(Fragment5, { children: [
|
|
885
|
-
/* @__PURE__ */
|
|
957
|
+
/* @__PURE__ */ jsx12(
|
|
886
958
|
Button,
|
|
887
959
|
{
|
|
888
960
|
color: "ghost",
|
|
889
961
|
size,
|
|
890
962
|
icon: "Download",
|
|
891
|
-
"aria-label": label,
|
|
892
|
-
onClick: install
|
|
963
|
+
"aria-label": iconOnly ? label : void 0,
|
|
964
|
+
onClick: install,
|
|
965
|
+
children: !iconOnly && label
|
|
893
966
|
}
|
|
894
967
|
),
|
|
895
|
-
way === "instructions" && /* @__PURE__ */
|
|
968
|
+
way === "instructions" && /* @__PURE__ */ jsx12(
|
|
896
969
|
ConnectedModal,
|
|
897
970
|
{
|
|
898
971
|
modalId: INSTALL_APP_MODAL_ID,
|
|
@@ -992,14 +1065,18 @@ var topNav = tv9({
|
|
|
992
1065
|
// the page layers on itself (a filter over a map), and under a modal.
|
|
993
1066
|
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
1067
|
section: "grid gap-1 p-2",
|
|
995
|
-
|
|
1068
|
+
// Two rows: what the user can do with the app, then who is logged in.
|
|
1069
|
+
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",
|
|
1070
|
+
// One action per line, each as tall and as far from the edge as a link of the menu.
|
|
1071
|
+
actions: "grid gap-1 p-2 [&>button]:h-10 [&>button]:justify-start [&>button]:px-3",
|
|
1072
|
+
profile: "flex items-center gap-3 p-3",
|
|
996
1073
|
// Text takes no className, so the cut of a long name or email is set from here.
|
|
997
1074
|
user: "flex min-w-0 flex-1 flex-col text-white [&>*]:truncate"
|
|
998
1075
|
}
|
|
999
1076
|
});
|
|
1000
1077
|
|
|
1001
1078
|
// core/top-nav/top-nav.tsx
|
|
1002
|
-
import { jsx as
|
|
1079
|
+
import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1003
1080
|
var TopNav = ({
|
|
1004
1081
|
sections,
|
|
1005
1082
|
user,
|
|
@@ -1009,6 +1086,7 @@ var TopNav = ({
|
|
|
1009
1086
|
navLabel = "Main navigation",
|
|
1010
1087
|
menuLabel = "Menu",
|
|
1011
1088
|
accountLabel = "Account",
|
|
1089
|
+
share = {},
|
|
1012
1090
|
install = {},
|
|
1013
1091
|
logout = {},
|
|
1014
1092
|
onLogout
|
|
@@ -1051,7 +1129,7 @@ var TopNav = ({
|
|
|
1051
1129
|
};
|
|
1052
1130
|
return /* @__PURE__ */ jsxs7("header", { className: styles.base(), onPointerDown: markPressInside, children: [
|
|
1053
1131
|
/* @__PURE__ */ jsxs7("div", { className: styles.bar(), children: [
|
|
1054
|
-
hasLinks ? /* @__PURE__ */
|
|
1132
|
+
hasLinks ? /* @__PURE__ */ jsx13(
|
|
1055
1133
|
Button,
|
|
1056
1134
|
{
|
|
1057
1135
|
color: "ghost",
|
|
@@ -1061,8 +1139,8 @@ var TopNav = ({
|
|
|
1061
1139
|
"aria-expanded": menuOpen,
|
|
1062
1140
|
onClick: toggleMenu
|
|
1063
1141
|
}
|
|
1064
|
-
) : /* @__PURE__ */
|
|
1065
|
-
/* @__PURE__ */
|
|
1142
|
+
) : /* @__PURE__ */ jsx13("span", { "aria-hidden": "true", className: styles.spacer() }),
|
|
1143
|
+
/* @__PURE__ */ jsx13("div", { className: styles.home(), children: homeHref && /* @__PURE__ */ jsxs7(
|
|
1066
1144
|
Link,
|
|
1067
1145
|
{
|
|
1068
1146
|
href: homeHref,
|
|
@@ -1072,12 +1150,12 @@ var TopNav = ({
|
|
|
1072
1150
|
"aria-label": homeLabel || "Home",
|
|
1073
1151
|
onClick: close,
|
|
1074
1152
|
children: [
|
|
1075
|
-
/* @__PURE__ */
|
|
1076
|
-
homeLabel && /* @__PURE__ */
|
|
1153
|
+
/* @__PURE__ */ jsx13(Icon, { name: "Home" }),
|
|
1154
|
+
homeLabel && /* @__PURE__ */ jsx13(Text, { as: "span", variant: "caption", children: homeLabel })
|
|
1077
1155
|
]
|
|
1078
1156
|
}
|
|
1079
1157
|
) }),
|
|
1080
|
-
/* @__PURE__ */
|
|
1158
|
+
/* @__PURE__ */ jsx13(
|
|
1081
1159
|
Button,
|
|
1082
1160
|
{
|
|
1083
1161
|
color: "ghost",
|
|
@@ -1090,35 +1168,48 @@ var TopNav = ({
|
|
|
1090
1168
|
)
|
|
1091
1169
|
] }),
|
|
1092
1170
|
accountOpen && /* @__PURE__ */ jsxs7("div", { className: styles.account(), children: [
|
|
1093
|
-
/* @__PURE__ */ jsxs7("div", { className: styles.
|
|
1094
|
-
/* @__PURE__ */
|
|
1095
|
-
|
|
1171
|
+
/* @__PURE__ */ jsxs7("div", { className: styles.actions(), children: [
|
|
1172
|
+
/* @__PURE__ */ jsx13(
|
|
1173
|
+
ShareAppButton,
|
|
1174
|
+
{
|
|
1175
|
+
label: share.label ?? "Share app",
|
|
1176
|
+
title: share.title,
|
|
1177
|
+
text: share.text,
|
|
1178
|
+
copiedMessage: share.copiedMessage,
|
|
1179
|
+
errorMessage: share.errorMessage
|
|
1180
|
+
}
|
|
1181
|
+
),
|
|
1182
|
+
installApp.way && /* @__PURE__ */ jsx13(
|
|
1183
|
+
InstallAppButton,
|
|
1184
|
+
{
|
|
1185
|
+
way: installApp.way,
|
|
1186
|
+
label: install.label ?? "Install app",
|
|
1187
|
+
instructionsTitle: install.instructionsTitle,
|
|
1188
|
+
instructions: install.instructions,
|
|
1189
|
+
onPrompt: installApp.prompt
|
|
1190
|
+
}
|
|
1191
|
+
)
|
|
1096
1192
|
] }),
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
cancelLabel: logout.cancelLabel,
|
|
1116
|
-
errorMessage: logout.errorMessage,
|
|
1117
|
-
onSignOut: onLogout
|
|
1118
|
-
}
|
|
1119
|
-
)
|
|
1193
|
+
/* @__PURE__ */ jsxs7("div", { className: styles.profile(), children: [
|
|
1194
|
+
/* @__PURE__ */ jsxs7("div", { className: styles.user(), children: [
|
|
1195
|
+
/* @__PURE__ */ jsx13(Text, { as: "span", variant: "caption", children: user.name }),
|
|
1196
|
+
/* @__PURE__ */ jsx13(Text, { as: "span", variant: "caption", children: user.email })
|
|
1197
|
+
] }),
|
|
1198
|
+
/* @__PURE__ */ jsx13(
|
|
1199
|
+
SignOutButton,
|
|
1200
|
+
{
|
|
1201
|
+
size: "lg",
|
|
1202
|
+
label: logout.label,
|
|
1203
|
+
confirmTitle: logout.confirmTitle,
|
|
1204
|
+
confirmLabel: logout.confirmLabel,
|
|
1205
|
+
cancelLabel: logout.cancelLabel,
|
|
1206
|
+
errorMessage: logout.errorMessage,
|
|
1207
|
+
onSignOut: onLogout
|
|
1208
|
+
}
|
|
1209
|
+
)
|
|
1210
|
+
] })
|
|
1120
1211
|
] }),
|
|
1121
|
-
menuOpen && /* @__PURE__ */
|
|
1212
|
+
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
1213
|
Link,
|
|
1123
1214
|
{
|
|
1124
1215
|
href: item.href,
|
|
@@ -1128,8 +1219,8 @@ var TopNav = ({
|
|
|
1128
1219
|
"aria-label": item.label,
|
|
1129
1220
|
onClick: close,
|
|
1130
1221
|
children: [
|
|
1131
|
-
/* @__PURE__ */
|
|
1132
|
-
/* @__PURE__ */
|
|
1222
|
+
/* @__PURE__ */ jsx13(Icon, { name: item.icon }),
|
|
1223
|
+
/* @__PURE__ */ jsx13(Text, { as: "span", variant: "caption", children: item.label })
|
|
1133
1224
|
]
|
|
1134
1225
|
},
|
|
1135
1226
|
item.href
|
|
@@ -1174,7 +1265,7 @@ var toasterColors = {
|
|
|
1174
1265
|
};
|
|
1175
1266
|
|
|
1176
1267
|
// features/toaster/components/toaster/toaster-copy-button.tsx
|
|
1177
|
-
import { jsx as
|
|
1268
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
1178
1269
|
var ToasterCopyButton = ({ text: text2 }) => {
|
|
1179
1270
|
const [copied, setCopied] = useState4(false);
|
|
1180
1271
|
const { copyButton } = toaster();
|
|
@@ -1183,7 +1274,7 @@ var ToasterCopyButton = ({ text: text2 }) => {
|
|
|
1183
1274
|
// Without permission the browser refuses, and the button stays on Copy.
|
|
1184
1275
|
() => void 0
|
|
1185
1276
|
);
|
|
1186
|
-
return /* @__PURE__ */
|
|
1277
|
+
return /* @__PURE__ */ jsx14("span", { className: copyButton(), children: /* @__PURE__ */ jsx14(
|
|
1187
1278
|
Button,
|
|
1188
1279
|
{
|
|
1189
1280
|
color: "ghost",
|
|
@@ -1196,13 +1287,13 @@ var ToasterCopyButton = ({ text: text2 }) => {
|
|
|
1196
1287
|
};
|
|
1197
1288
|
|
|
1198
1289
|
// features/toaster/components/toaster/toast.tsx
|
|
1199
|
-
import { jsx as
|
|
1290
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1200
1291
|
var copyText = (message, description2) => typeof description2 === "string" ? `${message}
|
|
1201
1292
|
${description2}` : message;
|
|
1202
1293
|
var withCopy = (show) => (message, data) => show(
|
|
1203
1294
|
message,
|
|
1204
1295
|
typeof message === "string" ? {
|
|
1205
|
-
action: /* @__PURE__ */
|
|
1296
|
+
action: /* @__PURE__ */ jsx15(ToasterCopyButton, { text: copyText(message, data?.description) }),
|
|
1206
1297
|
...data
|
|
1207
1298
|
} : data
|
|
1208
1299
|
);
|
|
@@ -1218,7 +1309,7 @@ var toast = Object.assign(
|
|
|
1218
1309
|
// features/toaster/components/toaster/toaster.tsx
|
|
1219
1310
|
import { useEffect as useEffect3 } from "react";
|
|
1220
1311
|
import { Toaster as SonnerToaster } from "sonner";
|
|
1221
|
-
import { jsx as
|
|
1312
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1222
1313
|
var Toaster = () => {
|
|
1223
1314
|
const toasts = useToastStore((s) => s.toasts);
|
|
1224
1315
|
const removeToast = useToastStore((s) => s.removeToast);
|
|
@@ -1229,7 +1320,7 @@ var Toaster = () => {
|
|
|
1229
1320
|
removeToast(t.id);
|
|
1230
1321
|
});
|
|
1231
1322
|
}, [toasts, removeToast]);
|
|
1232
|
-
return /* @__PURE__ */
|
|
1323
|
+
return /* @__PURE__ */ jsx16(
|
|
1233
1324
|
SonnerToaster,
|
|
1234
1325
|
{
|
|
1235
1326
|
position: "bottom-right",
|
|
@@ -1260,19 +1351,19 @@ var spinner = tv11({
|
|
|
1260
1351
|
});
|
|
1261
1352
|
|
|
1262
1353
|
// core/spinner/spinner.tsx
|
|
1263
|
-
import { jsx as
|
|
1354
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1264
1355
|
var Spinner = ({
|
|
1265
1356
|
variant = "circle",
|
|
1266
1357
|
size = "md",
|
|
1267
1358
|
label = "Loading"
|
|
1268
|
-
}) => /* @__PURE__ */
|
|
1359
|
+
}) => /* @__PURE__ */ jsx17(
|
|
1269
1360
|
"span",
|
|
1270
1361
|
{
|
|
1271
1362
|
"data-testid": "spinner",
|
|
1272
1363
|
role: "status",
|
|
1273
1364
|
"aria-label": label,
|
|
1274
1365
|
className: spinner(),
|
|
1275
|
-
children: /* @__PURE__ */
|
|
1366
|
+
children: /* @__PURE__ */ jsx17(Icon, { name: spinnerIcons[variant], size })
|
|
1276
1367
|
}
|
|
1277
1368
|
);
|
|
1278
1369
|
|
|
@@ -1283,15 +1374,15 @@ var loader = tv12({
|
|
|
1283
1374
|
});
|
|
1284
1375
|
|
|
1285
1376
|
// features/app/components/loader/loader.tsx
|
|
1286
|
-
import { jsx as
|
|
1377
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1287
1378
|
var Loader = ({ label = "Loading" }) => {
|
|
1288
1379
|
const fetching = useAppStore((s) => s.fetching);
|
|
1289
1380
|
if (!fetching) return null;
|
|
1290
|
-
return /* @__PURE__ */
|
|
1381
|
+
return /* @__PURE__ */ jsx18("div", { className: loader(), children: /* @__PURE__ */ jsx18(Spinner, { size: "lg", label }) });
|
|
1291
1382
|
};
|
|
1292
1383
|
|
|
1293
1384
|
// features/app/components/navigation/navigation.tsx
|
|
1294
|
-
import { jsx as
|
|
1385
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1295
1386
|
var Navigation = ({
|
|
1296
1387
|
mode = "auto",
|
|
1297
1388
|
sections,
|
|
@@ -1305,6 +1396,7 @@ var Navigation = ({
|
|
|
1305
1396
|
navLabel,
|
|
1306
1397
|
menuLabel,
|
|
1307
1398
|
accountLabel,
|
|
1399
|
+
share,
|
|
1308
1400
|
install,
|
|
1309
1401
|
logout,
|
|
1310
1402
|
onLogout
|
|
@@ -1315,7 +1407,7 @@ var Navigation = ({
|
|
|
1315
1407
|
return null;
|
|
1316
1408
|
}
|
|
1317
1409
|
if (desktop) {
|
|
1318
|
-
return /* @__PURE__ */
|
|
1410
|
+
return /* @__PURE__ */ jsx19(
|
|
1319
1411
|
Sidebar,
|
|
1320
1412
|
{
|
|
1321
1413
|
sections,
|
|
@@ -1327,12 +1419,13 @@ var Navigation = ({
|
|
|
1327
1419
|
homeHref,
|
|
1328
1420
|
homeLabel,
|
|
1329
1421
|
navLabel,
|
|
1422
|
+
share,
|
|
1330
1423
|
logout,
|
|
1331
1424
|
onLogout
|
|
1332
1425
|
}
|
|
1333
1426
|
);
|
|
1334
1427
|
}
|
|
1335
|
-
return /* @__PURE__ */
|
|
1428
|
+
return /* @__PURE__ */ jsx19(
|
|
1336
1429
|
TopNav,
|
|
1337
1430
|
{
|
|
1338
1431
|
sections,
|
|
@@ -1343,6 +1436,7 @@ var Navigation = ({
|
|
|
1343
1436
|
navLabel,
|
|
1344
1437
|
menuLabel,
|
|
1345
1438
|
accountLabel,
|
|
1439
|
+
share,
|
|
1346
1440
|
install,
|
|
1347
1441
|
logout,
|
|
1348
1442
|
onLogout
|
|
@@ -1384,7 +1478,7 @@ var createReduxStore = ({
|
|
|
1384
1478
|
};
|
|
1385
1479
|
|
|
1386
1480
|
// core/state/redux/redux-provider/redux-provider.tsx
|
|
1387
|
-
import { jsx as
|
|
1481
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
1388
1482
|
var ReduxProvider = ({
|
|
1389
1483
|
children,
|
|
1390
1484
|
reducers = {},
|
|
@@ -1400,7 +1494,7 @@ var ReduxProvider = ({
|
|
|
1400
1494
|
coreReducers
|
|
1401
1495
|
})
|
|
1402
1496
|
);
|
|
1403
|
-
return /* @__PURE__ */
|
|
1497
|
+
return /* @__PURE__ */ jsx20(Provider, { store, children });
|
|
1404
1498
|
};
|
|
1405
1499
|
|
|
1406
1500
|
// core/state/zustand/router/router.utils.ts
|
|
@@ -1492,7 +1586,7 @@ var card = tv13({
|
|
|
1492
1586
|
});
|
|
1493
1587
|
|
|
1494
1588
|
// core/card/card.tsx
|
|
1495
|
-
import { jsx as
|
|
1589
|
+
import { jsx as jsx21, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1496
1590
|
var Card = ({
|
|
1497
1591
|
children,
|
|
1498
1592
|
title: title2,
|
|
@@ -1504,8 +1598,8 @@ var Card = ({
|
|
|
1504
1598
|
const messageColor = color === "none" ? "muted" : "none";
|
|
1505
1599
|
return /* @__PURE__ */ jsxs8("div", { "data-testid": "card", className: base(), children: [
|
|
1506
1600
|
(title2 || message) && /* @__PURE__ */ jsxs8("div", { className: header3(), children: [
|
|
1507
|
-
title2 && /* @__PURE__ */
|
|
1508
|
-
message && /* @__PURE__ */
|
|
1601
|
+
title2 && /* @__PURE__ */ jsx21(Heading, { level: titleLevel, children: title2 }),
|
|
1602
|
+
message && /* @__PURE__ */ jsx21(Text, { color: messageColor, children: message })
|
|
1509
1603
|
] }),
|
|
1510
1604
|
children
|
|
1511
1605
|
] });
|
|
@@ -1520,7 +1614,7 @@ var accessPending = tv14({
|
|
|
1520
1614
|
});
|
|
1521
1615
|
|
|
1522
1616
|
// features/auth/components/access-pending/access-pending.tsx
|
|
1523
|
-
import { jsx as
|
|
1617
|
+
import { jsx as jsx22, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1524
1618
|
var AccessPending = ({
|
|
1525
1619
|
title: title2 = "Waiting for approval",
|
|
1526
1620
|
message = "Your access to this app has not been approved yet.",
|
|
@@ -1535,9 +1629,9 @@ var AccessPending = ({
|
|
|
1535
1629
|
if (!user) {
|
|
1536
1630
|
return null;
|
|
1537
1631
|
}
|
|
1538
|
-
return /* @__PURE__ */
|
|
1539
|
-
/* @__PURE__ */
|
|
1540
|
-
/* @__PURE__ */
|
|
1632
|
+
return /* @__PURE__ */ jsx22(Card, { title: title2, titleLevel: 1, message, children: /* @__PURE__ */ jsxs9("div", { className: account(), children: [
|
|
1633
|
+
/* @__PURE__ */ jsx22(Text, { variant: "caption", color: "muted", children: user.email }),
|
|
1634
|
+
/* @__PURE__ */ jsx22(
|
|
1541
1635
|
SignOutButton,
|
|
1542
1636
|
{
|
|
1543
1637
|
label: signOutLabel,
|
|
@@ -1552,7 +1646,7 @@ var AccessPending = ({
|
|
|
1552
1646
|
|
|
1553
1647
|
// features/auth/components/auth-provider/auth-provider.tsx
|
|
1554
1648
|
import { useEffect as useEffect4 } from "react";
|
|
1555
|
-
import { Fragment as Fragment6, jsx as
|
|
1649
|
+
import { Fragment as Fragment6, jsx as jsx23 } from "react/jsx-runtime";
|
|
1556
1650
|
var AuthProvider = ({
|
|
1557
1651
|
adapter,
|
|
1558
1652
|
appId,
|
|
@@ -1569,7 +1663,7 @@ var AuthProvider = ({
|
|
|
1569
1663
|
reset();
|
|
1570
1664
|
};
|
|
1571
1665
|
}, [adapter, appId, configure, setSession, reset]);
|
|
1572
|
-
return /* @__PURE__ */
|
|
1666
|
+
return /* @__PURE__ */ jsx23(Fragment6, { children });
|
|
1573
1667
|
};
|
|
1574
1668
|
|
|
1575
1669
|
// features/auth/components/login/login.const.ts
|
|
@@ -1591,7 +1685,7 @@ var login = tv15({
|
|
|
1591
1685
|
});
|
|
1592
1686
|
|
|
1593
1687
|
// features/auth/components/login/login.tsx
|
|
1594
|
-
import { jsx as
|
|
1688
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
1595
1689
|
var LoginProviderButton = ({
|
|
1596
1690
|
id,
|
|
1597
1691
|
label,
|
|
@@ -1600,7 +1694,7 @@ var LoginProviderButton = ({
|
|
|
1600
1694
|
const signIn = () => {
|
|
1601
1695
|
onSignIn(id);
|
|
1602
1696
|
};
|
|
1603
|
-
return /* @__PURE__ */
|
|
1697
|
+
return /* @__PURE__ */ jsx24(Button, { size: "lg", fullWidth: true, onClick: signIn, children: label });
|
|
1604
1698
|
};
|
|
1605
1699
|
var Login = ({
|
|
1606
1700
|
vendor,
|
|
@@ -1618,9 +1712,9 @@ var Login = ({
|
|
|
1618
1712
|
useToastStore.getState().error(errorMessage);
|
|
1619
1713
|
});
|
|
1620
1714
|
};
|
|
1621
|
-
return /* @__PURE__ */
|
|
1715
|
+
return /* @__PURE__ */ jsx24(Card, { title: title2, titleLevel: 1, message, children: /* @__PURE__ */ jsx24("div", { className: options(), children: providers.map((provider) => {
|
|
1622
1716
|
const id = String(provider);
|
|
1623
|
-
return /* @__PURE__ */
|
|
1717
|
+
return /* @__PURE__ */ jsx24(
|
|
1624
1718
|
LoginProviderButton,
|
|
1625
1719
|
{
|
|
1626
1720
|
id,
|
|
@@ -1633,7 +1727,7 @@ var Login = ({
|
|
|
1633
1727
|
};
|
|
1634
1728
|
|
|
1635
1729
|
// features/auth/components/authorized/authorized.tsx
|
|
1636
|
-
import { Fragment as Fragment7, jsx as
|
|
1730
|
+
import { Fragment as Fragment7, jsx as jsx25 } from "react/jsx-runtime";
|
|
1637
1731
|
var Authorized = ({
|
|
1638
1732
|
children,
|
|
1639
1733
|
roles,
|
|
@@ -1642,18 +1736,18 @@ var Authorized = ({
|
|
|
1642
1736
|
}) => {
|
|
1643
1737
|
const { status, user, role } = useAuth();
|
|
1644
1738
|
if (status === "loading") return null;
|
|
1645
|
-
if (!user) return /* @__PURE__ */
|
|
1739
|
+
if (!user) return /* @__PURE__ */ jsx25(Login, { ...login2 });
|
|
1646
1740
|
const hasRole = !roles || role !== null && roles.includes(role);
|
|
1647
|
-
if (!user.hasAccess || !hasRole) return /* @__PURE__ */
|
|
1648
|
-
return /* @__PURE__ */
|
|
1741
|
+
if (!user.hasAccess || !hasRole) return /* @__PURE__ */ jsx25(AccessPending, { ...accessPending2 });
|
|
1742
|
+
return /* @__PURE__ */ jsx25(Fragment7, { children });
|
|
1649
1743
|
};
|
|
1650
1744
|
|
|
1651
1745
|
// features/providers/components/zustand-providers/zustand-providers.tsx
|
|
1652
|
-
import { Fragment as Fragment8, jsx as
|
|
1746
|
+
import { Fragment as Fragment8, jsx as jsx26, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1653
1747
|
var ZustandProviders = ({ children, auth }) => /* @__PURE__ */ jsxs10(Fragment8, { children: [
|
|
1654
|
-
/* @__PURE__ */
|
|
1655
|
-
/* @__PURE__ */
|
|
1656
|
-
auth ? /* @__PURE__ */
|
|
1748
|
+
/* @__PURE__ */ jsx26(Loader, {}),
|
|
1749
|
+
/* @__PURE__ */ jsx26(Toaster, {}),
|
|
1750
|
+
auth ? /* @__PURE__ */ jsx26(AuthProvider, { adapter: auth.adapter, appId: auth.appId, children }) : children
|
|
1657
1751
|
] });
|
|
1658
1752
|
|
|
1659
1753
|
export {
|
|
@@ -1662,10 +1756,11 @@ export {
|
|
|
1662
1756
|
Text,
|
|
1663
1757
|
Modal,
|
|
1664
1758
|
Heading,
|
|
1759
|
+
useToastStore,
|
|
1760
|
+
ShareAppButton,
|
|
1665
1761
|
appInitialState,
|
|
1666
1762
|
useAppStore,
|
|
1667
1763
|
ConnectedModal,
|
|
1668
|
-
useToastStore,
|
|
1669
1764
|
getAuthSession,
|
|
1670
1765
|
useAuth,
|
|
1671
1766
|
SignOutButton,
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ 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"];
|
|
16
16
|
|
|
17
17
|
type IconName = (typeof iconNames)[number];
|
|
18
18
|
interface IconProps {
|
|
@@ -243,6 +243,32 @@ interface TextProps {
|
|
|
243
243
|
|
|
244
244
|
declare const Text: ({ children, as: Tag, variant, color, }: TextProps) => react.JSX.Element;
|
|
245
245
|
|
|
246
|
+
interface ShareAppButtonProps {
|
|
247
|
+
/** The text of the button. With `iconOnly`, its accessible name. */
|
|
248
|
+
label: string;
|
|
249
|
+
/**
|
|
250
|
+
* Shows the icon alone, for a place with no room for the text, such as a
|
|
251
|
+
* collapsed sidebar.
|
|
252
|
+
*/
|
|
253
|
+
iconOnly?: boolean;
|
|
254
|
+
/** The size of the button. `lg` is for a touch screen. */
|
|
255
|
+
size?: Size;
|
|
256
|
+
/**
|
|
257
|
+
* The title of what is shared. By default the title of the page. The address
|
|
258
|
+
* is always the origin of the page: where the app starts, whatever page the
|
|
259
|
+
* user is on.
|
|
260
|
+
*/
|
|
261
|
+
title?: string;
|
|
262
|
+
/** A text that goes with the address, such as how to ask for access. */
|
|
263
|
+
text?: string;
|
|
264
|
+
/** The toast shown when the address is copied instead of shared. */
|
|
265
|
+
copiedMessage?: string;
|
|
266
|
+
/** The toast shown when the address could be neither shared nor copied. */
|
|
267
|
+
errorMessage?: string;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
declare const ShareAppButton: ({ label, iconOnly, size, title, text, copiedMessage, errorMessage, }: ShareAppButtonProps) => react.JSX.Element;
|
|
271
|
+
|
|
246
272
|
interface SignOutButtonProps {
|
|
247
273
|
/** The accessible name of the icon button. */
|
|
248
274
|
label?: string;
|
|
@@ -290,6 +316,12 @@ interface SidebarProps {
|
|
|
290
316
|
homeLabel?: string;
|
|
291
317
|
/** The accessible name of the navigation. */
|
|
292
318
|
navLabel?: string;
|
|
319
|
+
/**
|
|
320
|
+
* The share button, over the user: its texts (`label`, `copiedMessage` and
|
|
321
|
+
* `errorMessage`) and what goes with the address of the app (`title` and
|
|
322
|
+
* `text`).
|
|
323
|
+
*/
|
|
324
|
+
share?: Partial<Omit<ShareAppButtonProps, "iconOnly" | "size">>;
|
|
293
325
|
/**
|
|
294
326
|
* The texts of the logout button and of the modal it opens: `label`,
|
|
295
327
|
* `confirmTitle`, `confirmLabel`, `cancelLabel` and `errorMessage`.
|
|
@@ -302,7 +334,7 @@ interface SidebarProps {
|
|
|
302
334
|
onLogout: () => void | Promise<void>;
|
|
303
335
|
}
|
|
304
336
|
|
|
305
|
-
declare const Sidebar: ({ sections, user, activeHref, defaultCollapsed, collapseLabel, expandLabel, homeHref, homeLabel, navLabel, logout, onLogout, }: SidebarProps) => react.JSX.Element;
|
|
337
|
+
declare const Sidebar: ({ sections, user, activeHref, defaultCollapsed, collapseLabel, expandLabel, homeHref, homeLabel, navLabel, share, logout, onLogout, }: SidebarProps) => react.JSX.Element;
|
|
306
338
|
|
|
307
339
|
interface TabsItem {
|
|
308
340
|
/** Unique among the tabs. `defaultTab` and `onChange` use it. */
|
|
@@ -365,9 +397,14 @@ interface InstallAppButtonProps {
|
|
|
365
397
|
* `onPrompt` on a click, and `instructions` opens a modal with the steps.
|
|
366
398
|
*/
|
|
367
399
|
way: InstallAppWay;
|
|
368
|
-
/** The
|
|
369
|
-
label
|
|
370
|
-
/**
|
|
400
|
+
/** The text of the button. With `iconOnly`, its accessible name. */
|
|
401
|
+
label: string;
|
|
402
|
+
/**
|
|
403
|
+
* Shows the icon alone, for a place with no room for the text, such as a
|
|
404
|
+
* collapsed sidebar.
|
|
405
|
+
*/
|
|
406
|
+
iconOnly?: boolean;
|
|
407
|
+
/** The size of the button. `lg` is for a touch screen. */
|
|
371
408
|
size?: Size;
|
|
372
409
|
/** The title of the modal with the steps. */
|
|
373
410
|
instructionsTitle?: string;
|
|
@@ -380,7 +417,7 @@ interface InstallAppButtonProps {
|
|
|
380
417
|
onPrompt: () => void;
|
|
381
418
|
}
|
|
382
419
|
|
|
383
|
-
declare const InstallAppButton: ({ way, label, size, instructionsTitle, instructions, onPrompt, }: InstallAppButtonProps) => react.JSX.Element;
|
|
420
|
+
declare const InstallAppButton: ({ way, label, iconOnly, size, instructionsTitle, instructions, onPrompt, }: InstallAppButtonProps) => react.JSX.Element;
|
|
384
421
|
|
|
385
422
|
interface TopNavProps {
|
|
386
423
|
/**
|
|
@@ -399,12 +436,19 @@ interface TopNavProps {
|
|
|
399
436
|
menuLabel?: string;
|
|
400
437
|
/** The accessible name of the account button. */
|
|
401
438
|
accountLabel?: string;
|
|
439
|
+
/**
|
|
440
|
+
* The share button, the first line of the account panel: its texts (`label`,
|
|
441
|
+
* `copiedMessage` and `errorMessage`) and what goes with the address of the
|
|
442
|
+
* app (`title` and `text`).
|
|
443
|
+
*/
|
|
444
|
+
share?: Partial<Omit<ShareAppButtonProps, "iconOnly" | "size">>;
|
|
402
445
|
/**
|
|
403
446
|
* The texts of the install button and of the modal with its steps: `label`,
|
|
404
|
-
* `instructionsTitle` and `instructions`. The button
|
|
405
|
-
* button, only in a browser that can put the app on the
|
|
447
|
+
* `instructionsTitle` and `instructions`. The button has its own line over the
|
|
448
|
+
* user and the logout button, only in a browser that can put the app on the
|
|
449
|
+
* home screen.
|
|
406
450
|
*/
|
|
407
|
-
install?: Pick<InstallAppButtonProps, "label" | "instructionsTitle" | "instructions"
|
|
451
|
+
install?: Partial<Pick<InstallAppButtonProps, "label" | "instructionsTitle" | "instructions">>;
|
|
408
452
|
/**
|
|
409
453
|
* The texts of the logout button and of the modal it opens: `label`,
|
|
410
454
|
* `confirmTitle`, `confirmLabel`, `cancelLabel` and `errorMessage`.
|
|
@@ -417,7 +461,7 @@ interface TopNavProps {
|
|
|
417
461
|
onLogout: () => void | Promise<void>;
|
|
418
462
|
}
|
|
419
463
|
|
|
420
|
-
declare const TopNav: ({ sections, user, activeHref, homeHref, homeLabel, navLabel, menuLabel, accountLabel, install, logout, onLogout, }: TopNavProps) => react.JSX.Element;
|
|
464
|
+
declare const TopNav: ({ sections, user, activeHref, homeHref, homeLabel, navLabel, menuLabel, accountLabel, share, install, logout, onLogout, }: TopNavProps) => react.JSX.Element;
|
|
421
465
|
|
|
422
466
|
type TagColor = Exclude<SemanticColor, "none"> | AuxiliaryColor;
|
|
423
467
|
interface TagProps {
|
|
@@ -500,7 +544,7 @@ interface NavigationProps extends SidebarProps, Pick<TopNavProps, "menuLabel" |
|
|
|
500
544
|
mode?: NavigationMode;
|
|
501
545
|
}
|
|
502
546
|
|
|
503
|
-
declare const Navigation: ({ mode, sections, user, activeHref, defaultCollapsed, collapseLabel, expandLabel, homeHref, homeLabel, navLabel, menuLabel, accountLabel, install, logout, onLogout, }: NavigationProps) => react.JSX.Element | null;
|
|
547
|
+
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
548
|
|
|
505
549
|
interface AppState {
|
|
506
550
|
fetchingCalls: number;
|
|
@@ -729,5 +773,5 @@ declare const useAuth: () => UseAuthResult;
|
|
|
729
773
|
|
|
730
774
|
declare const ZustandProviders: ({ children, auth }: ZustandProvidersProps) => react.JSX.Element;
|
|
731
775
|
|
|
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 };
|
|
776
|
+
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 };
|
|
777
|
+
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, 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-
|
|
36
|
+
} from "./chunk-4JXA6DG6.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,
|
package/dist/next/index.js
CHANGED