@orangecheck/ui 0.8.0 → 0.8.2

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 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) {
@@ -364,7 +375,7 @@ function OcLogoDropdown({
364
375
  "div",
365
376
  {
366
377
  ref: containerRef,
367
- className: "relative " + (className ?? ""),
378
+ className: "relative inline-flex items-center " + (className ?? ""),
368
379
  "data-oc-logo-dropdown": "",
369
380
  "data-oc-current-category": currentCategory,
370
381
  "data-oc-site-state": siteState,
@@ -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: "Switch OrangeCheck product",
381
- onClick: () => setOpen((v) => !v),
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,12 +401,33 @@ 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" : "")
393
405
  }
394
406
  )
395
407
  ]
396
408
  }
397
409
  ),
410
+ /* @__PURE__ */ jsxRuntime.jsxs(
411
+ Link5__default.default,
412
+ {
413
+ href: homeHref,
414
+ "aria-label": "go to " + homeHref + " (this site's home)",
415
+ onClick: () => setOpen(false),
416
+ tabIndex: open ? 0 : -1,
417
+ className: "hover:text-primary group/home -ml-1 hidden items-center gap-1 rounded-sm px-1.5 py-1 font-mono text-[9px] tracking-widest uppercase transition-all duration-200 sm:inline-flex " + (open ? "pointer-events-auto translate-x-0 text-muted-foreground/70 opacity-100 hover:bg-accent/30" : "pointer-events-none -translate-x-1 opacity-0"),
418
+ "data-oc-logo-dropdown-home-hint": "",
419
+ children: [
420
+ /* @__PURE__ */ jsxRuntime.jsx(
421
+ lucideReact.CornerDownLeft,
422
+ {
423
+ "aria-hidden": true,
424
+ className: "h-3 w-3 group-hover/home:text-primary " + (open ? "motion-safe:animate-pulse" : "")
425
+ }
426
+ ),
427
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-primary/70 group-hover/home:text-primary", children: "home" })
428
+ ]
429
+ }
430
+ ),
398
431
  open && /* @__PURE__ */ jsxRuntime.jsxs(
399
432
  "div",
400
433
  {