UNPKG

laif-ds

Version:

Design System di Laif con componenti React basati su principi di Atomic Design

172 lines (171 loc) 6.24 kB
"use client"; import { jsxs as i, jsx as e } from "react/jsx-runtime"; import { Root as d, List as s, Item as u, Content as l, Trigger as g, Link as c, Indicator as m, Viewport as v } from "../../node_modules/@radix-ui/react-navigation-menu/dist/index.js"; import { cva as f } from "../../node_modules/class-variance-authority/dist/index.js"; import { cn as o } from "../../lib/utils.js"; import p from "../../node_modules/lucide-react/dist/esm/icons/chevron-down.js"; function M({ className: t, children: a, viewport: n = !0, ...r }) { return /* @__PURE__ */ i( d, { "data-slot": "navigation-menu", "data-viewport": n, className: o( "group/navigation-menu relative flex max-w-max flex-1 items-center justify-center", t ), ...r, children: [ a, n && /* @__PURE__ */ e(b, {}) ] } ); } function j({ className: t, ...a }) { return /* @__PURE__ */ e( s, { "data-slot": "navigation-menu-list", className: o( "group flex flex-1 list-none items-center justify-center gap-1", t ), ...a } ); } function k({ className: t, ...a }) { return /* @__PURE__ */ e( u, { "data-slot": "navigation-menu-item", className: o("relative", t), ...a } ); } const w = f( "group inline-flex h-9 w-max items-center justify-center rounded-md bg-d-background px-4 py-2 text-sm font-medium hover:bg-d-accent hover:text-d-accent-foreground focus:bg-d-accent focus:text-d-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=open]:hover:bg-d-accent data-[state=open]:text-d-accent-foreground data-[state=open]:focus:bg-d-accent data-[state=open]:bg-d-accent focus-visible:ring-d-ring/50 outline-none transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1" ); function I({ className: t, children: a, ...n }) { return /* @__PURE__ */ i( g, { "data-slot": "navigation-menu-trigger", className: o(w(), "group", t), ...n, children: [ a, " ", /* @__PURE__ */ e( p, { className: "relative top-[1px] ml-1 size-3 transition duration-300 group-data-[state=open]:rotate-180", "aria-hidden": "true" } ) ] } ); } function L({ className: t, ...a }) { return /* @__PURE__ */ e( l, { "data-slot": "navigation-menu-content", className: o( "data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 top-0 left-0 w-full p-2 pr-2.5 md:absolute md:w-auto", "group-data-[viewport=false]/navigation-menu:bg-d-popover group-data-[viewport=false]/navigation-menu:text-d-popover-foreground group-data-[viewport=false]/navigation-menu:data-[state=open]:animate-in group-data-[viewport=false]/navigation-menu:data-[state=closed]:animate-out group-data-[viewport=false]/navigation-menu:data-[state=closed]:zoom-out-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:zoom-in-95 group-data-[viewport=false]/navigation-menu:data-[state=open]:fade-in-0 group-data-[viewport=false]/navigation-menu:data-[state=closed]:fade-out-0 border-d-border group-data-[viewport=false]/navigation-menu:top-full group-data-[viewport=false]/navigation-menu:mt-1.5 group-data-[viewport=false]/navigation-menu:overflow-hidden group-data-[viewport=false]/navigation-menu:rounded-md group-data-[viewport=false]/navigation-menu:border group-data-[viewport=false]/navigation-menu:shadow group-data-[viewport=false]/navigation-menu:duration-200 **:data-[slot=navigation-menu-link]:focus:ring-0 **:data-[slot=navigation-menu-link]:focus:outline-none", t ), ...a } ); } function b({ className: t, ...a }) { return /* @__PURE__ */ e( "div", { className: o( "absolute top-full left-0 isolate z-50 flex justify-center" ), children: /* @__PURE__ */ e( v, { "data-slot": "navigation-menu-viewport", className: o( "origin-top-center bg-d-popover text-d-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 border-d-border relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border shadow md:w-[var(--radix-navigation-menu-viewport-width)]", t ), ...a } ) } ); } function C({ className: t, ...a }) { return /* @__PURE__ */ e( c, { "data-slot": "navigation-menu-link", className: o( "data-[active=true]:focus:bg-d-accent data-[active=true]:hover:bg-d-accent data-[active=true]:bg-d-accent data-[active=true]:text-d-accent-foreground hover:bg-d-accent hover:text-d-accent-foreground focus:bg-d-accent focus:text-d-accent-foreground focus-visible:ring-d-ring/50 [&_svg:not([class*='text-'])]:text-d-secondary-foreground flex flex-col gap-1 rounded-sm p-2 text-sm transition-all outline-none focus-visible:ring-[3px] focus-visible:outline-1 [&_svg:not([class*='size-'])]:size-4", t ), ...a } ); } function T({ className: t, ...a }) { return /* @__PURE__ */ e( m, { "data-slot": "navigation-menu-indicator", className: o( "data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden", t ), ...a, children: /* @__PURE__ */ e("div", { className: "bg-d-border relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm shadow-md" }) } ); } export { M as NavigationMenu, L as NavigationMenuContent, T as NavigationMenuIndicator, k as NavigationMenuItem, C as NavigationMenuLink, j as NavigationMenuList, I as NavigationMenuTrigger, b as NavigationMenuViewport, w as navigationMenuTriggerStyle };