UNPKG

@anoki/fse-ui

Version:

FSE UI components library

3 lines (2 loc) 1.99 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./components/ui/Dropdown/Dropdown.css');const e=require("./index.cjs244.js"),r=require("./index.cjs293.js"),x=require("./index.cjs246.js"),a=require("./index.cjs274.js");;/* empty css */const u=require("./index.cjs158.js"),c=require("./index.cjs9.js"),d=({text:t,leftIcon:n,options:o,asLinkItem:s,textColor:i="white"})=>{const l=a.createColorClasses({text:i});return e.jsxRuntimeExports.jsxs(r.Root,{children:[e.jsxRuntimeExports.jsx(r.Trigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{className:x.clsx("border-none bg-transparent base-row gap-x8 fw-regular fs-6 align-items-center",l,"ui-dropdown-trigger"),children:[n&&n,e.jsxRuntimeExports.jsxs(c.Row,{as:"span",gap:"x4",children:[t,e.jsxRuntimeExports.jsx(u.ArrowDown,{color:i,className:"ui-arrow"})]})]})}),e.jsxRuntimeExports.jsx(m,{options:o,asLinkItem:s})]})},m=({options:t,asLinkItem:n})=>{if(t.length===0)return null;const o=n??"a";return e.jsxRuntimeExports.jsx(r.Portal,{children:e.jsxRuntimeExports.jsx(r.Content,{className:"bg-white shadow ui-dropdown-menu-content",children:e.jsxRuntimeExports.jsx(r.Group,{className:"ui-dropdown-menu-group",children:t.map((s,i)=>e.jsxRuntimeExports.jsx(r.Item,{asChild:!0,className:"ui-dropdown-menu-item",children:s.href?e.jsxRuntimeExports.jsxs(o,{href:s.href,className:x.clsx("fs-6 text-decoration-none",s.active?"text-primary fw-semibold":"text-slate-28 fw-regular"),children:[s.label,s.active&&e.jsxRuntimeExports.jsx("span",{className:"visually-hidden",children:"Attivo"})]}):e.jsxRuntimeExports.jsxs("button",{onClick:s.onClick,className:x.clsx("fs-6 text-decoration-none bg-white outline-none border-none text-left",s.active?"text-primary fw-semibold":"text-slate-28 fw-regular"),children:[s.label,s.active&&e.jsxRuntimeExports.jsx("span",{className:"visually-hidden",children:"Attivo"})]})},i))})})})};exports.Dropdown=d; //# sourceMappingURL=index.cjs24.js.map