@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.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { Boxes, ChevronDown, Check } from 'lucide-react';
|
|
1
|
+
import { Boxes, ChevronDown, Check, CornerDownLeft } from 'lucide-react';
|
|
2
2
|
import Link5 from 'next/link';
|
|
3
3
|
import { useState, useRef, useEffect, useId } from 'react';
|
|
4
4
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
5
|
+
import { useRouter } from 'next/router';
|
|
5
6
|
import { useOcSession } from '@orangecheck/auth-client';
|
|
6
7
|
|
|
7
8
|
// src/ecosystem-switcher.tsx
|
|
@@ -337,7 +338,17 @@ function OcLogoDropdown({
|
|
|
337
338
|
const [open, setOpen] = useState(false);
|
|
338
339
|
const containerRef = useRef(null);
|
|
339
340
|
const menuId = useId();
|
|
341
|
+
const router = useRouter();
|
|
340
342
|
const currentCategory = findFamilyProperty(current)?.category ?? "hub";
|
|
343
|
+
function handleTriggerClick(e) {
|
|
344
|
+
if (e.detail >= 2) {
|
|
345
|
+
e.preventDefault();
|
|
346
|
+
setOpen(false);
|
|
347
|
+
void router.push(homeHref);
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
setOpen((v) => !v);
|
|
351
|
+
}
|
|
341
352
|
useEffect(() => {
|
|
342
353
|
if (!open) return;
|
|
343
354
|
function onDoc(e) {
|
|
@@ -370,11 +381,12 @@ function OcLogoDropdown({
|
|
|
370
381
|
"aria-haspopup": "menu",
|
|
371
382
|
"aria-expanded": open,
|
|
372
383
|
"aria-controls": menuId,
|
|
373
|
-
"aria-label": "OrangeCheck family \xB7 open property menu",
|
|
374
|
-
title: "
|
|
375
|
-
onClick:
|
|
376
|
-
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",
|
|
384
|
+
"aria-label": "OrangeCheck family \xB7 click to open property menu, double-click to go home",
|
|
385
|
+
title: "single-click \xB7 family menu \xB7 double-click \xB7 go home",
|
|
386
|
+
onClick: handleTriggerClick,
|
|
387
|
+
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" : ""),
|
|
377
388
|
"data-oc-logo-dropdown-trigger": "",
|
|
389
|
+
"data-oc-logo-dropdown-open": open ? "true" : "false",
|
|
378
390
|
children: [
|
|
379
391
|
children,
|
|
380
392
|
/* @__PURE__ */ jsx(CategoryChip, { category: currentCategory }),
|
|
@@ -383,7 +395,24 @@ function OcLogoDropdown({
|
|
|
383
395
|
ChevronDown,
|
|
384
396
|
{
|
|
385
397
|
"aria-hidden": true,
|
|
386
|
-
className: "text-muted-foreground/70 group-hover:text-foreground/80 h-3.5 w-3.5 shrink-0 transition-transform " + (open ? "rotate-180" : "")
|
|
398
|
+
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" : "")
|
|
399
|
+
}
|
|
400
|
+
),
|
|
401
|
+
/* @__PURE__ */ jsxs(
|
|
402
|
+
"span",
|
|
403
|
+
{
|
|
404
|
+
"aria-hidden": true,
|
|
405
|
+
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"),
|
|
406
|
+
"data-oc-logo-dropdown-home-hint": "",
|
|
407
|
+
children: [
|
|
408
|
+
/* @__PURE__ */ jsx(
|
|
409
|
+
CornerDownLeft,
|
|
410
|
+
{
|
|
411
|
+
className: "h-3 w-3 " + (open ? "motion-safe:animate-pulse" : "")
|
|
412
|
+
}
|
|
413
|
+
),
|
|
414
|
+
/* @__PURE__ */ jsx("span", { className: "text-primary/70", children: "home" })
|
|
415
|
+
]
|
|
387
416
|
}
|
|
388
417
|
)
|
|
389
418
|
]
|