@orangecheck/ui 0.8.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.js +34 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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
|
]
|