@orangecheck/ui 0.7.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +115 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +116 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -58,6 +58,8 @@ interface OcAccountMenuProps {
|
|
|
58
58
|
signInUrl?: string;
|
|
59
59
|
signInLabel?: string;
|
|
60
60
|
menuItems?: ReadonlyArray<OcAccountMenuItem>;
|
|
61
|
+
primaryNavLinks?: ReadonlyArray<OcAccountMenuItem>;
|
|
62
|
+
secondaryNavLinks?: ReadonlyArray<OcAccountMenuItem>;
|
|
61
63
|
showFamilyDashboard?: boolean;
|
|
62
64
|
build?: OcAccountMenuBuildInfo;
|
|
63
65
|
siteState?: SiteState;
|
|
@@ -69,7 +71,7 @@ declare function OcAccountMenu(props: OcAccountMenuProps): react_jsx_runtime.JSX
|
|
|
69
71
|
interface OcAccountMenuViewProps extends OcAccountMenuProps {
|
|
70
72
|
session: OcAccountMenuSession;
|
|
71
73
|
}
|
|
72
|
-
declare function OcAccountMenuView({ current, signInUrl, signInLabel, menuItems, showFamilyDashboard, build, siteState, className, triggerClassName, popoverClassName, session, }: OcAccountMenuViewProps): react_jsx_runtime.JSX.Element;
|
|
74
|
+
declare function OcAccountMenuView({ current, signInUrl, signInLabel, menuItems, primaryNavLinks, secondaryNavLinks, showFamilyDashboard, build, siteState, className, triggerClassName, popoverClassName, session, }: OcAccountMenuViewProps): react_jsx_runtime.JSX.Element;
|
|
73
75
|
|
|
74
76
|
interface OcPrimaryNavLink {
|
|
75
77
|
href: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -58,6 +58,8 @@ interface OcAccountMenuProps {
|
|
|
58
58
|
signInUrl?: string;
|
|
59
59
|
signInLabel?: string;
|
|
60
60
|
menuItems?: ReadonlyArray<OcAccountMenuItem>;
|
|
61
|
+
primaryNavLinks?: ReadonlyArray<OcAccountMenuItem>;
|
|
62
|
+
secondaryNavLinks?: ReadonlyArray<OcAccountMenuItem>;
|
|
61
63
|
showFamilyDashboard?: boolean;
|
|
62
64
|
build?: OcAccountMenuBuildInfo;
|
|
63
65
|
siteState?: SiteState;
|
|
@@ -69,7 +71,7 @@ declare function OcAccountMenu(props: OcAccountMenuProps): react_jsx_runtime.JSX
|
|
|
69
71
|
interface OcAccountMenuViewProps extends OcAccountMenuProps {
|
|
70
72
|
session: OcAccountMenuSession;
|
|
71
73
|
}
|
|
72
|
-
declare function OcAccountMenuView({ current, signInUrl, signInLabel, menuItems, showFamilyDashboard, build, siteState, className, triggerClassName, popoverClassName, session, }: OcAccountMenuViewProps): react_jsx_runtime.JSX.Element;
|
|
74
|
+
declare function OcAccountMenuView({ current, signInUrl, signInLabel, menuItems, primaryNavLinks, secondaryNavLinks, showFamilyDashboard, build, siteState, className, triggerClassName, popoverClassName, session, }: OcAccountMenuViewProps): react_jsx_runtime.JSX.Element;
|
|
73
75
|
|
|
74
76
|
interface OcPrimaryNavLink {
|
|
75
77
|
href: string;
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ var lucideReact = require('lucide-react');
|
|
|
4
4
|
var Link5 = require('next/link');
|
|
5
5
|
var react = require('react');
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var router = require('next/router');
|
|
7
8
|
var authClient = require('@orangecheck/auth-client');
|
|
8
9
|
|
|
9
10
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -343,7 +344,17 @@ function OcLogoDropdown({
|
|
|
343
344
|
const [open, setOpen] = react.useState(false);
|
|
344
345
|
const containerRef = react.useRef(null);
|
|
345
346
|
const menuId = react.useId();
|
|
347
|
+
const router$1 = router.useRouter();
|
|
346
348
|
const currentCategory = findFamilyProperty(current)?.category ?? "hub";
|
|
349
|
+
function handleTriggerClick(e) {
|
|
350
|
+
if (e.detail >= 2) {
|
|
351
|
+
e.preventDefault();
|
|
352
|
+
setOpen(false);
|
|
353
|
+
void router$1.push(homeHref);
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
setOpen((v) => !v);
|
|
357
|
+
}
|
|
347
358
|
react.useEffect(() => {
|
|
348
359
|
if (!open) return;
|
|
349
360
|
function onDoc(e) {
|
|
@@ -376,11 +387,12 @@ function OcLogoDropdown({
|
|
|
376
387
|
"aria-haspopup": "menu",
|
|
377
388
|
"aria-expanded": open,
|
|
378
389
|
"aria-controls": menuId,
|
|
379
|
-
"aria-label": "OrangeCheck family \xB7 open property menu",
|
|
380
|
-
title: "
|
|
381
|
-
onClick:
|
|
382
|
-
className: triggerClassName ?? "group hover:bg-accent/30 -mx-1.5 -my-1 flex min-h-[40px] items-center gap-2 rounded-sm px-1.5 py-1 transition-colors",
|
|
390
|
+
"aria-label": "OrangeCheck family \xB7 click to open property menu, double-click to go home",
|
|
391
|
+
title: "single-click \xB7 family menu \xB7 double-click \xB7 go home",
|
|
392
|
+
onClick: handleTriggerClick,
|
|
393
|
+
className: triggerClassName ?? "group hover:bg-accent/30 -mx-1.5 -my-1 flex min-h-[40px] items-center gap-2 rounded-sm px-1.5 py-1 transition-colors " + (open ? "bg-accent/20" : ""),
|
|
383
394
|
"data-oc-logo-dropdown-trigger": "",
|
|
395
|
+
"data-oc-logo-dropdown-open": open ? "true" : "false",
|
|
384
396
|
children: [
|
|
385
397
|
children,
|
|
386
398
|
/* @__PURE__ */ jsxRuntime.jsx(CategoryChip, { category: currentCategory }),
|
|
@@ -389,7 +401,24 @@ function OcLogoDropdown({
|
|
|
389
401
|
lucideReact.ChevronDown,
|
|
390
402
|
{
|
|
391
403
|
"aria-hidden": true,
|
|
392
|
-
className: "text-muted-foreground/70 group-hover:text-foreground/80 h-3.5 w-3.5 shrink-0 transition-transform " + (open ? "rotate-180" : "")
|
|
404
|
+
className: "text-muted-foreground/70 group-hover:text-foreground/80 h-3.5 w-3.5 shrink-0 transition-transform duration-200 " + (open ? "rotate-180" : "")
|
|
405
|
+
}
|
|
406
|
+
),
|
|
407
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
408
|
+
"span",
|
|
409
|
+
{
|
|
410
|
+
"aria-hidden": true,
|
|
411
|
+
className: "pointer-events-none ml-0.5 hidden items-center gap-1 font-mono text-[9px] tracking-widest uppercase transition-all duration-200 sm:inline-flex " + (open ? "text-muted-foreground/70 translate-x-0 opacity-100" : "-translate-x-1 opacity-0"),
|
|
412
|
+
"data-oc-logo-dropdown-home-hint": "",
|
|
413
|
+
children: [
|
|
414
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
415
|
+
lucideReact.CornerDownLeft,
|
|
416
|
+
{
|
|
417
|
+
className: "h-3 w-3 " + (open ? "motion-safe:animate-pulse" : "")
|
|
418
|
+
}
|
|
419
|
+
),
|
|
420
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-primary/70", children: "home" })
|
|
421
|
+
]
|
|
393
422
|
}
|
|
394
423
|
)
|
|
395
424
|
]
|
|
@@ -498,6 +527,8 @@ function OcAccountMenuView({
|
|
|
498
527
|
signInUrl = "/signin",
|
|
499
528
|
signInLabel = "sign in",
|
|
500
529
|
menuItems,
|
|
530
|
+
primaryNavLinks,
|
|
531
|
+
secondaryNavLinks,
|
|
501
532
|
showFamilyDashboard,
|
|
502
533
|
build,
|
|
503
534
|
siteState,
|
|
@@ -619,7 +650,16 @@ function OcAccountMenuView({
|
|
|
619
650
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-foreground/90 font-mono text-[11px] leading-tight break-all", children: account.didOc }),
|
|
620
651
|
displayName ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground/80 mt-1 font-mono text-[10px] tracking-wide", children: displayName }) : null
|
|
621
652
|
] }),
|
|
622
|
-
/* @__PURE__ */ jsxRuntime.
|
|
653
|
+
primaryNavLinks && primaryNavLinks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
654
|
+
PopoverSection,
|
|
655
|
+
{
|
|
656
|
+
label: "navigate",
|
|
657
|
+
items: primaryNavLinks,
|
|
658
|
+
onItemClick: () => setOpen(false)
|
|
659
|
+
}
|
|
660
|
+
) : null,
|
|
661
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "p-1", "data-oc-account-menu-section": "account", children: [
|
|
662
|
+
primaryNavLinks && primaryNavLinks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground/60 px-3 pb-1 pt-2 font-mono text-[10px] tracking-widest uppercase", children: "\xA7 account" }) : null,
|
|
623
663
|
menuItems?.map((item) => {
|
|
624
664
|
const onClick = () => setOpen(false);
|
|
625
665
|
const cls = "hover:bg-accent flex items-center gap-2 px-3 py-2 font-mono text-[11px] tracking-wide transition-colors";
|
|
@@ -705,6 +745,15 @@ function OcAccountMenuView({
|
|
|
705
745
|
}
|
|
706
746
|
)
|
|
707
747
|
] }),
|
|
748
|
+
secondaryNavLinks && secondaryNavLinks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
749
|
+
PopoverSection,
|
|
750
|
+
{
|
|
751
|
+
label: "more",
|
|
752
|
+
items: secondaryNavLinks,
|
|
753
|
+
onItemClick: () => setOpen(false),
|
|
754
|
+
bordered: true
|
|
755
|
+
}
|
|
756
|
+
) : null,
|
|
708
757
|
build ? /* @__PURE__ */ jsxRuntime.jsx(BuildFooter, { hostname, build, state: siteState }) : null
|
|
709
758
|
]
|
|
710
759
|
}
|
|
@@ -713,6 +762,66 @@ function OcAccountMenuView({
|
|
|
713
762
|
}
|
|
714
763
|
);
|
|
715
764
|
}
|
|
765
|
+
function PopoverSection({
|
|
766
|
+
label,
|
|
767
|
+
items,
|
|
768
|
+
onItemClick,
|
|
769
|
+
bordered
|
|
770
|
+
}) {
|
|
771
|
+
const cls = "hover:bg-accent flex items-center gap-2 px-3 py-2 font-mono text-[11px] tracking-wide transition-colors";
|
|
772
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
773
|
+
"div",
|
|
774
|
+
{
|
|
775
|
+
className: "p-1 " + (bordered ? "border-border border-t" : ""),
|
|
776
|
+
"data-oc-account-menu-section": label,
|
|
777
|
+
children: [
|
|
778
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-muted-foreground/60 px-3 pt-2 pb-1 font-mono text-[10px] tracking-widest uppercase", children: [
|
|
779
|
+
"\xA7 ",
|
|
780
|
+
label
|
|
781
|
+
] }),
|
|
782
|
+
items.map((item) => {
|
|
783
|
+
const inner = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
784
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", "aria-hidden": true, children: "\u2192" }),
|
|
785
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1", children: item.label }),
|
|
786
|
+
item.external ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
787
|
+
"span",
|
|
788
|
+
{
|
|
789
|
+
className: "text-muted-foreground/70 text-[10px]",
|
|
790
|
+
"aria-hidden": true,
|
|
791
|
+
children: "\u2197"
|
|
792
|
+
}
|
|
793
|
+
) : null
|
|
794
|
+
] });
|
|
795
|
+
return item.external ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
796
|
+
"a",
|
|
797
|
+
{
|
|
798
|
+
href: item.href,
|
|
799
|
+
target: "_blank",
|
|
800
|
+
rel: "noreferrer",
|
|
801
|
+
onClick: onItemClick,
|
|
802
|
+
role: "menuitem",
|
|
803
|
+
className: cls,
|
|
804
|
+
"data-oc-account-menu-item": "",
|
|
805
|
+
children: inner
|
|
806
|
+
},
|
|
807
|
+
item.href
|
|
808
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
809
|
+
Link5__default.default,
|
|
810
|
+
{
|
|
811
|
+
href: item.href,
|
|
812
|
+
onClick: onItemClick,
|
|
813
|
+
role: "menuitem",
|
|
814
|
+
className: cls,
|
|
815
|
+
"data-oc-account-menu-item": "",
|
|
816
|
+
children: inner
|
|
817
|
+
},
|
|
818
|
+
item.href
|
|
819
|
+
);
|
|
820
|
+
})
|
|
821
|
+
]
|
|
822
|
+
}
|
|
823
|
+
);
|
|
824
|
+
}
|
|
716
825
|
function BuildFooter({
|
|
717
826
|
hostname,
|
|
718
827
|
build,
|