@next-degree/pickle-shared-js 0.3.19 → 0.3.20
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/README.md +47 -1
- package/dist/app/layout.cjs +70 -1
- package/dist/app/layout.cjs.map +1 -1
- package/dist/app/layout.css +1263 -1
- package/dist/app/layout.css.map +1 -1
- package/dist/app/layout.js +35 -1
- package/dist/app/layout.js.map +1 -1
- package/dist/app/page.cjs +774 -1
- package/dist/app/page.cjs.map +1 -1
- package/dist/app/page.js +743 -1
- package/dist/app/page.js.map +1 -1
- package/dist/assets/fonts/AmbitBold.cjs +2 -1
- package/dist/assets/fonts/AmbitBold.js +5 -1
- package/dist/assets/fonts/AmbitBoldItalic.cjs +2 -1
- package/dist/assets/fonts/AmbitBoldItalic.js +5 -1
- package/dist/assets/fonts/AmbitRegular.cjs +2 -1
- package/dist/assets/fonts/AmbitRegular.js +5 -1
- package/dist/components/demos/ComboboxDemo.cjs +759 -1
- package/dist/components/demos/ComboboxDemo.cjs.map +1 -1
- package/dist/components/demos/ComboboxDemo.js +731 -1
- package/dist/components/demos/ComboboxDemo.js.map +1 -1
- package/dist/components/demos/index.cjs +767 -1
- package/dist/components/demos/index.cjs.map +1 -1
- package/dist/components/demos/index.js +736 -1
- package/dist/components/demos/index.js.map +1 -1
- package/dist/components/primitives/command.cjs +223 -1
- package/dist/components/primitives/command.cjs.map +1 -1
- package/dist/components/primitives/command.js +181 -1
- package/dist/components/primitives/command.js.map +1 -1
- package/dist/components/primitives/dialog.cjs +137 -1
- package/dist/components/primitives/dialog.cjs.map +1 -1
- package/dist/components/primitives/dialog.js +92 -1
- package/dist/components/primitives/dialog.js.map +1 -1
- package/dist/components/primitives/popover.cjs +72 -1
- package/dist/components/primitives/popover.cjs.map +1 -1
- package/dist/components/primitives/popover.js +36 -1
- package/dist/components/primitives/popover.js.map +1 -1
- package/dist/components/primitives/separator.cjs +67 -1
- package/dist/components/primitives/separator.cjs.map +1 -1
- package/dist/components/primitives/separator.js +33 -1
- package/dist/components/primitives/separator.js.map +1 -1
- package/dist/components/ui/Badge.cjs +57 -1
- package/dist/components/ui/Badge.cjs.map +1 -1
- package/dist/components/ui/Badge.js +31 -1
- package/dist/components/ui/Badge.js.map +1 -1
- package/dist/components/ui/Button.cjs +145 -1
- package/dist/components/ui/Button.cjs.map +1 -1
- package/dist/components/ui/Button.js +118 -1
- package/dist/components/ui/Button.js.map +1 -1
- package/dist/components/ui/Checkbox.cjs +99 -1
- package/dist/components/ui/Checkbox.cjs.map +1 -1
- package/dist/components/ui/Checkbox.js +71 -1
- package/dist/components/ui/Checkbox.js.map +1 -1
- package/dist/components/ui/Chip.cjs +49 -1
- package/dist/components/ui/Chip.cjs.map +1 -1
- package/dist/components/ui/Chip.js +28 -1
- package/dist/components/ui/Chip.js.map +1 -1
- package/dist/components/ui/Combobox.cjs +564 -1
- package/dist/components/ui/Combobox.cjs.map +1 -1
- package/dist/components/ui/Combobox.js +532 -1
- package/dist/components/ui/Combobox.js.map +1 -1
- package/dist/components/ui/Label.cjs +50 -1
- package/dist/components/ui/Label.cjs.map +1 -1
- package/dist/components/ui/Label.js +27 -1
- package/dist/components/ui/Label.js.map +1 -1
- package/dist/components/ui/ListItem.cjs +151 -1
- package/dist/components/ui/ListItem.cjs.map +1 -1
- package/dist/components/ui/ListItem.js +120 -1
- package/dist/components/ui/ListItem.js.map +1 -1
- package/dist/components/ui/Select.cjs +246 -1
- package/dist/components/ui/Select.cjs.map +1 -1
- package/dist/components/ui/Select.js +221 -1
- package/dist/components/ui/Select.js.map +1 -1
- package/dist/index.cjs +855 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +817 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/utils.cjs +34 -1
- package/dist/lib/utils.cjs.map +1 -1
- package/dist/lib/utils.js +9 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/styles/globals.css +1263 -1
- package/dist/styles/globals.css.map +1 -1
- package/package.json +14 -17
|
@@ -1,2 +1,760 @@
|
|
|
1
|
-
"use strict";"use client";var Be=Object.create;var _=Object.defineProperty;var He=Object.getOwnPropertyDescriptor;var Ae=Object.getOwnPropertyNames;var Oe=Object.getPrototypeOf,Ge=Object.prototype.hasOwnProperty;var Fe=(e,t)=>{for(var o in t)_(e,o,{get:t[o],enumerable:!0})},ne=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ae(t))!Ge.call(e,i)&&i!==o&&_(e,i,{get:()=>t[i],enumerable:!(n=He(t,i))||n.enumerable});return e};var C=(e,t,o)=>(o=e!=null?Be(Oe(e)):{},ne(t||!e||!e.__esModule?_(o,"default",{value:e,enumerable:!0}):o,e)),Ye=e=>ne(_({},"__esModule",{value:!0}),e);var rt={};Fe(rt,{default:()=>it});module.exports=Ye(rt);var ee=require("react");var k=require("react"),w=require("lucide-react"),Se=require("cva");var le=require("clsx"),se=require("tailwind-merge");function a(...e){return(0,se.twMerge)((0,le.clsx)(e))}var m=require("cmdk"),ce=require("lucide-react"),P=C(require("react"),1);var l=C(require("@radix-ui/react-dialog"),1),me=require("lucide-react"),I=C(require("react"),1),d=require("react/jsx-runtime");var Je=l.Portal;var pe=I.forwardRef(({className:e,...t},o)=>(0,d.jsx)(l.Overlay,{ref:o,className:a("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));pe.displayName=l.Overlay.displayName;var de=I.forwardRef(({className:e,children:t,...o},n)=>(0,d.jsxs)(Je,{children:[(0,d.jsx)(pe,{}),(0,d.jsxs)(l.Content,{ref:n,className:a("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-neutral-200 bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg dark:border-neutral-800 dark:bg-neutral-950",e),...o,children:[t,(0,d.jsxs)(l.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-neutral-950 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-neutral-100 data-[state=open]:text-neutral-500 dark:ring-offset-neutral-950 dark:focus:ring-neutral-300 dark:data-[state=open]:bg-neutral-800 dark:data-[state=open]:text-neutral-400",children:[(0,d.jsx)(me.X,{className:"h-4 w-4"}),(0,d.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));de.displayName=l.Content.displayName;var Ke=({className:e,...t})=>(0,d.jsx)("div",{className:a("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Ke.displayName="DialogHeader";var Ue=({className:e,...t})=>(0,d.jsx)("div",{className:a("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Ue.displayName="DialogFooter";var Xe=I.forwardRef(({className:e,...t},o)=>(0,d.jsx)(l.Title,{ref:o,className:a("text-lg font-semibold leading-none tracking-tight",e),...t}));Xe.displayName=l.Title.displayName;var $e=I.forwardRef(({className:e,...t},o)=>(0,d.jsx)(l.Description,{ref:o,className:a("text-sm text-neutral-500 dark:text-neutral-400",e),...t}));$e.displayName=l.Description.displayName;var f=require("react/jsx-runtime"),G=P.forwardRef(({className:e,...t},o)=>(0,f.jsx)(m.Command,{ref:o,className:a("flex h-full w-full flex-col overflow-hidden rounded-xl bg-white text-neutral-950",e),...t}));G.displayName=m.Command.displayName;var F=P.forwardRef(({className:e,...t},o)=>(0,f.jsxs)("div",{className:"m-1 flex items-center rounded-xl border px-3","cmdk-input-wrapper":"",children:[(0,f.jsx)(ce.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),(0,f.jsx)(m.Command.Input,{ref:o,className:a("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-neutral-500 disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));F.displayName=m.Command.Input.displayName;var Y=P.forwardRef(({className:e,...t},o)=>(0,f.jsx)(m.Command.List,{ref:o,className:a("overflow-y-auto overflow-x-hidden",e),...t}));Y.displayName=m.Command.List.displayName;var J=P.forwardRef((e,t)=>(0,f.jsx)(m.Command.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));J.displayName=m.Command.Empty.displayName;var K=P.forwardRef(({className:e,...t},o)=>(0,f.jsx)(m.Command.Group,{ref:o,className:a("overflow-hidden p-1 text-neutral-950 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-neutral-500",e),...t}));K.displayName=m.Command.Group.displayName;var qe=P.forwardRef(({className:e,...t},o)=>(0,f.jsx)(m.Command.Separator,{ref:o,className:a("-mx-1 h-px bg-neutral-200",e),...t}));qe.displayName=m.Command.Separator.displayName;var U=P.forwardRef(({className:e,...t},o)=>(0,f.jsx)(m.Command.Item,{ref:o,className:a("relative flex cursor-pointer select-none items-center rounded-xl px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-neutral-100 data-[selected=true]:text-neutral-900 data-[disabled=true]:opacity-50",e),...t}));U.displayName=m.Command.Item.displayName;var Qe=({className:e,...t})=>(0,f.jsx)("span",{className:a("ml-auto text-xs tracking-widest text-neutral-500",e),...t});Qe.displayName="CommandShortcut";var fe=C(require("react"),1),x=C(require("@radix-ui/react-popover"),1);var X=require("react/jsx-runtime"),ue=x.Root,ge=x.Trigger,$=fe.forwardRef(({className:e,align:t="center",sideOffset:o=4,...n},i)=>(0,X.jsx)(x.Portal,{children:(0,X.jsx)(x.Content,{ref:i,align:t,sideOffset:o,className:a("z-50 rounded-2xl border bg-white p-4 text-black shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));$.displayName=x.Content.displayName;var q=C(require("@radix-ui/react-separator"),1),ve=C(require("react"),1);var he=require("react/jsx-runtime"),Q=ve.forwardRef(({className:e,orientation:t="horizontal",decorative:o=!0,...n},i)=>(0,he.jsx)(q.Root,{ref:i,decorative:o,orientation:t,className:a("shrink-0 bg-grey-10",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...n}));Q.displayName=q.Root.displayName;var Ce=require("lucide-react");var E=C(require("@radix-ui/react-checkbox"),1),M=require("lucide-react"),Z=require("react");var b=require("react/jsx-runtime"),ye=(0,Z.forwardRef)(({className:e,...t},o)=>(0,b.jsx)(E.Root,{ref:o,className:a("group","peer","h-5","w-5","shrink-0","rounded-md","border","border-grey-10","outline","outline-1","outline-offset-2","outline-transparent","hover:border-grey-20","focus:outline-purple-100","active:border-green-80","disabled:cursor-not-allowed","disabled:opacity-50","data-[state=checked]:bg-green-80","data-[state=indeterminate]:bg-green-80","data-[state=checked]:text-white","data-[state=indeterminate]:text-primary-foreground",t.disabled&&"data-[state=checked]:text-foreground bg-grey-20 data-[state=checked]:bg-grey-20",e),...t,children:(0,b.jsxs)(E.Indicator,{className:"flex items-center justify-center text-current",children:[(0,b.jsx)(M.Check,{className:"hidden h-4 w-4 group-data-[state=checked]:block"}),(0,b.jsx)(M.Minus,{className:"hidden h-4 w-4 group-data-[state=indeterminate]:block"})]})}));ye.displayName=E.Root.displayName;var xe=(0,Z.forwardRef)(({classNames:e,children:t,...o},n)=>{let{disabled:i}=o,c=o.id??`${o.name??o.value?.toString()}-checkbox`,p=i?"text-grey-40 pointer-events-none":"";return(0,b.jsxs)("div",{className:a("flex space-x-2",e?.wrapper),children:[(0,b.jsx)(ye,{id:c,disabled:i,ref:n,...o}),(0,b.jsx)("label",{htmlFor:c,className:a(p,e?.label),children:t})]})});xe.displayName="Checkbox";var be=xe;var j=require("lucide-react"),v=require("react/jsx-runtime");function Ze({icon:e,hasCheckbox:t,isSelected:o,className:n,title:i,value:c,description:p,...H}){let W=e?(R=>{if(R in j.icons){let A=j.icons[R];return(0,v.jsx)(A,{size:14})}return null})(e):void 0;return(0,v.jsxs)("li",{className:a("group relative flex w-72 cursor-pointer flex-row items-center text-left text-sm",n),...H,"data-state":o?"checked":"unchecked",children:[W&&(0,v.jsx)("span",{className:"mr-2",children:W}),t&&(0,v.jsx)(be,{id:c,checked:o,onClick:R=>R.preventDefault()}),(0,v.jsxs)("div",{children:[(0,v.jsx)("p",{children:i}),(0,v.jsx)("p",{className:"text-xs text-grey-80",children:p})]}),(0,v.jsx)(Ce.CheckIcon,{className:"absolute inset-y-0 right-0 my-auto hidden w-6 text-green-100 group-data-[state=checked]:block",size:16})]})}var Pe=Ze;var Re=require("cva");var ke=require("react/jsx-runtime"),je=(0,Re.cva)("rounded-full px-2 py-0.5 text-xs font-semibold",{variants:{variant:{green:"bg-green-90 text-white",pickle:"bg-pickle-100 text-black",purple:"bg-purple-100 text-white"}},defaultVariants:{variant:"green"}});function Ne({className:e,variant:t,...o}){return(0,ke.jsx)("div",{className:a(je({variant:t}),e),...o})}var De=require("react/jsx-runtime");function et({text:e,className:t,...o}){return e?(0,De.jsx)("label",{className:a("text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...o,children:e}):null}var we=et;var r=require("react/jsx-runtime"),T=(0,k.forwardRef)((e,t)=>{let{value:o,label:n,options:i,classNames:c,multiselect:p,placeholder:H,variant:L="default",size:W,icon:R,className:A,onChange:V,children:O}=e,[h,z]=(0,k.useState)([]),[te,oe]=(0,k.useState)(!1),ae=R&&w.icons[R],We=i?.length<=5,D=L==="default",Ve=L==="chip",ie=()=>oe(!1);(0,k.useEffect)(()=>{z((p?o??[]:o?[o]:[]).map(s=>i.find(y=>y.value===s)).filter(s=>s!==void 0))},[o]);let ze=N=>{let s=i.find(y=>y.value===N);if(s){if(p)return z(y=>{let re=y.some(S=>S.value===N)?y.filter(S=>S!==s):[...y,s];return V?.(re.map(S=>S.value)),re});z([s]),V?.(s.value),ie()}},_e=()=>{z([]),V?.(p?[]:"")},Me=()=>{let N=h.length>0?h.map(s=>s.title).join(", "):H;return D?N:n};return(0,r.jsxs)("div",{className:a("flex flex-col gap-2",A),children:[D&&n&&(0,r.jsx)(we,{text:n,className:c?.label}),(0,r.jsxs)("div",{className:"relative flex",children:[(0,r.jsxs)(ue,{open:te,onOpenChange:oe,children:[(0,r.jsx)(ge,{asChild:!0,disabled:i.length===0,children:(0,r.jsxs)("div",{ref:t,className:a(tt({variant:L,size:W}),h.length>0&&"pr-10",c?.trigger),"aria-expanded":te,children:[D&&ae&&(0,r.jsx)(ae,{className:"h-4 w-4 shrink-0"}),Ve&&h.length>0&&(0,r.jsx)(Ne,{variant:"purple",children:h.length}),(0,r.jsx)("span",{className:a("w-full truncate leading-normal",D&&h.length==0&&"text-grey-40"),children:Me()}),h.length==0&&(0,r.jsx)(w.ChevronDownIcon,{className:"shrink-0 transform group-data-[state=open]:rotate-180",size:"16"})]})}),(0,r.jsx)(G,{children:(0,r.jsxs)($,{className:a("flex w-full max-w-xs flex-col overflow-hidden p-0","max-h-[--radix-popover-content-available-height]",c?.content),collisionPadding:8,sideOffset:4,align:"start",children:[!We&&(0,r.jsx)(F,{placeholder:"Search..."}),(0,r.jsxs)(Y,{children:[(0,r.jsx)(J,{children:"No results"}),(0,r.jsx)(K,{children:i.map(({id:N,...s})=>(0,r.jsx)(U,{value:s.title,onSelect:ze,children:(0,r.jsx)(Pe,{className:a(c?.items,"truncate py-1"),isSelected:h.some(y=>y.value===s.value),hasCheckbox:p,...s})},N))})]}),!!O&&(0,r.jsx)(Q,{}),O&&O({close:ie})]})})]}),D&&h.length>0&&(0,r.jsx)("button",{type:"button",className:"absolute inset-y-0 right-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20",onClick:_e,children:(0,r.jsx)(w.CircleX,{className:"h-4 w-4 text-green-100"})})]})]})});T.displayName="Combobox";var tt=(0,Se.cva)("group relative cursor-pointer text-green-100 flex flex-row items-center justify-between gap-2 border border-grey-20 focus:outline-green-80 disabled:bg-grey-5",{variants:{variant:{default:["w-full","max-w-80","rounded-lg"],chip:["font-bold","rounded-3xl","data-[state=open]:bg-black","data-[state=open]:text-white"]},size:{small:["h-8","py-1","px-2","text-xs"],normal:["h-9","py-2","px-3","text-sm"],large:["h-10","py-3","px-4","text-base"]}},defaultVariants:{variant:"default",size:"normal"}});var Ie=require("@radix-ui/react-slot"),Ee=require("cva"),Te=require("react"),Le=require("react/jsx-runtime"),B=(0,Te.forwardRef)(({className:e,variant:t,size:o,asChild:n=!1,...i},c)=>(0,Le.jsx)(n?Ie.Slot:"button",{className:a(ot({variant:t,size:o,className:e})),ref:c,...i}));B.displayName="Button";var ot=(0,Ee.cva)(["flex","items-center","justify-center","gap-2","rounded-full","font-bold","outline-2","outline-offset-2","outline-dashed","outline-transparent"],{variants:{variant:{neutral:["bg-black","text-white","hover:bg-grey-90","active:bg-grey-80","focus:outline-purple-100","disabled:text-grey-40","disabled:bg-grey-10"],primary:["bg-pickle-100","text-black","hover:bg-pickle-80","active:bg-pickle-60","focus:outline-purple-100","disabled:text-grey-40","disabled:bg-grey-10"],secondary:["bg-green-80","text-white","hover:bg-green-90","active:bg-green-100","focus:outline-pickle-100","disabled:text-grey-40","disabled:bg-grey-10"],transparent:["text-white","hover:bg-green-80","active:bg-green-100","focus:outline-pickle-100","disabled:text-grey-40"],link:["leading-tight","text-black","underline","hover:text-purple-100","focus:text-black","focus:outline-purple-100","active:text-purple-80"]},size:{small:["h-10","text-sm","px-4","py-2"],medium:["h-12","text-base","px-6","py-3"],large:["h-14","text-lg","px-8","py-4"]}},defaultVariants:{variant:"neutral",size:"medium"},compoundVariants:[{variant:"link",size:"small",class:["h-3","text-xs","p-0"]},{variant:"link",size:"medium",class:["h-4","text-sm","p-0"]},{variant:"link",size:"large",class:["h-6","text-base","p-0"]}]});var g=require("react/jsx-runtime");function at(){let[e,t]=(0,ee.useState)([]),[o,n]=(0,ee.useState)(""),i=[{title:"Nirvana",value:"Nirvana",description:"Come As You Are",id:"1"},{title:"Pearl Jam",value:"Pearl Jam",description:"Jeremy",id:"2"},{title:"Soundgarden",value:"Soundgarden",description:"Rusty Cage",id:"3"},{title:"Alice in Chains",value:"Alice in Chains",description:"Would?",id:"4"},{title:"Stone Temple Pilots",value:"Stone Temple Pilots",id:"5"},{title:"Hole",value:"Hole",id:"6"},{title:"Mudhoney",value:"Mudhoney",id:"7"},{title:"Screaming Trees",value:"Screaming Trees",id:"8"},{title:"L7",value:"L7",id:"9"},{title:"Sonic Youth",value:"Sonic Youth",id:"10"},{title:"And You Will Know Us by the Trail of Dead",value:"And You Will Know Us by the Trail of Dead",id:"11"}];return(0,g.jsxs)("div",{className:"flex flex-row flex-wrap items-center gap-4 p-4",children:[(0,g.jsx)(T,{label:"US bands from the 90's",placeholder:"Select a band",icon:"Music",options:i,multiselect:!0,onChange:t,value:e}),(0,g.jsx)(T,{label:"US bands from the 90's",options:i,variant:"chip",multiselect:!0,onChange:t,value:e}),(0,g.jsx)(T,{label:"Fruit label",variant:"chip",options:[{title:"Cherry",value:"Cherry",id:"1",icon:"Cherry"},{title:"Grape",value:"Grape",id:"2",icon:"Grape"}],value:o,onChange:n,children:({close:p})=>(0,g.jsxs)("div",{className:"flex flex-row items-center justify-between bg-white p-2 pl-4",children:[(0,g.jsx)(B,{variant:"link",tabIndex:-1,onClick:p,children:"Clear"}),(0,g.jsx)(B,{variant:"primary",size:"small",tabIndex:-1,children:"Apply"})]})}),e.map(p=>(0,g.jsx)("span",{className:"text-green-80",children:p},p)),(0,g.jsx)("span",{className:"text-purple-100",children:o})]})}var it=at;
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/components/demos/ComboboxDemo.tsx
|
|
32
|
+
var ComboboxDemo_exports = {};
|
|
33
|
+
__export(ComboboxDemo_exports, {
|
|
34
|
+
default: () => ComboboxDemo_default
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(ComboboxDemo_exports);
|
|
37
|
+
var import_react4 = require("react");
|
|
38
|
+
|
|
39
|
+
// src/components/ui/Combobox.tsx
|
|
40
|
+
var import_react2 = require("react");
|
|
41
|
+
var import_lucide_react6 = require("lucide-react");
|
|
42
|
+
var import_cva2 = require("cva");
|
|
43
|
+
|
|
44
|
+
// src/lib/utils.ts
|
|
45
|
+
var import_clsx = require("clsx");
|
|
46
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
47
|
+
function cn(...inputs) {
|
|
48
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// src/components/primitives/command.tsx
|
|
52
|
+
var import_cmdk = require("cmdk");
|
|
53
|
+
var import_lucide_react2 = require("lucide-react");
|
|
54
|
+
var React2 = __toESM(require("react"), 1);
|
|
55
|
+
|
|
56
|
+
// src/components/primitives/dialog.tsx
|
|
57
|
+
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
58
|
+
var import_lucide_react = require("lucide-react");
|
|
59
|
+
var React = __toESM(require("react"), 1);
|
|
60
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
61
|
+
var DialogPortal = DialogPrimitive.Portal;
|
|
62
|
+
var DialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
63
|
+
DialogPrimitive.Overlay,
|
|
64
|
+
{
|
|
65
|
+
ref,
|
|
66
|
+
className: cn(
|
|
67
|
+
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
|
68
|
+
className
|
|
69
|
+
),
|
|
70
|
+
...props
|
|
71
|
+
}
|
|
72
|
+
));
|
|
73
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
74
|
+
var DialogContent = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogPortal, { children: [
|
|
75
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogOverlay, {}),
|
|
76
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
77
|
+
DialogPrimitive.Content,
|
|
78
|
+
{
|
|
79
|
+
ref,
|
|
80
|
+
className: cn(
|
|
81
|
+
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-neutral-200 bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg dark:border-neutral-800 dark:bg-neutral-950",
|
|
82
|
+
className
|
|
83
|
+
),
|
|
84
|
+
...props,
|
|
85
|
+
children: [
|
|
86
|
+
children,
|
|
87
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-neutral-950 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-neutral-100 data-[state=open]:text-neutral-500 dark:ring-offset-neutral-950 dark:focus:ring-neutral-300 dark:data-[state=open]:bg-neutral-800 dark:data-[state=open]:text-neutral-400", children: [
|
|
88
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.X, { className: "h-4 w-4" }),
|
|
89
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: "Close" })
|
|
90
|
+
] })
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
)
|
|
94
|
+
] }));
|
|
95
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
96
|
+
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
|
|
97
|
+
DialogHeader.displayName = "DialogHeader";
|
|
98
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
99
|
+
"div",
|
|
100
|
+
{
|
|
101
|
+
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
102
|
+
...props
|
|
103
|
+
}
|
|
104
|
+
);
|
|
105
|
+
DialogFooter.displayName = "DialogFooter";
|
|
106
|
+
var DialogTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
107
|
+
DialogPrimitive.Title,
|
|
108
|
+
{
|
|
109
|
+
ref,
|
|
110
|
+
className: cn("text-lg font-semibold leading-none tracking-tight", className),
|
|
111
|
+
...props
|
|
112
|
+
}
|
|
113
|
+
));
|
|
114
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
115
|
+
var DialogDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
116
|
+
DialogPrimitive.Description,
|
|
117
|
+
{
|
|
118
|
+
ref,
|
|
119
|
+
className: cn("text-sm text-neutral-500 dark:text-neutral-400", className),
|
|
120
|
+
...props
|
|
121
|
+
}
|
|
122
|
+
));
|
|
123
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
124
|
+
|
|
125
|
+
// src/components/primitives/command.tsx
|
|
126
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
127
|
+
var Command = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
128
|
+
import_cmdk.Command,
|
|
129
|
+
{
|
|
130
|
+
ref,
|
|
131
|
+
className: cn(
|
|
132
|
+
"flex h-full w-full flex-col overflow-hidden rounded-xl bg-white text-neutral-950",
|
|
133
|
+
className
|
|
134
|
+
),
|
|
135
|
+
...props
|
|
136
|
+
}
|
|
137
|
+
));
|
|
138
|
+
Command.displayName = import_cmdk.Command.displayName;
|
|
139
|
+
var CommandInput = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "m-1 flex items-center rounded-xl border px-3", "cmdk-input-wrapper": "", children: [
|
|
140
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react2.Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
141
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
142
|
+
import_cmdk.Command.Input,
|
|
143
|
+
{
|
|
144
|
+
ref,
|
|
145
|
+
className: cn(
|
|
146
|
+
"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-neutral-500 disabled:cursor-not-allowed disabled:opacity-50",
|
|
147
|
+
className
|
|
148
|
+
),
|
|
149
|
+
...props
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
] }));
|
|
153
|
+
CommandInput.displayName = import_cmdk.Command.Input.displayName;
|
|
154
|
+
var CommandList = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
155
|
+
import_cmdk.Command.List,
|
|
156
|
+
{
|
|
157
|
+
ref,
|
|
158
|
+
className: cn("overflow-y-auto overflow-x-hidden", className),
|
|
159
|
+
...props
|
|
160
|
+
}
|
|
161
|
+
));
|
|
162
|
+
CommandList.displayName = import_cmdk.Command.List.displayName;
|
|
163
|
+
var CommandEmpty = React2.forwardRef((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_cmdk.Command.Empty, { ref, className: "py-6 text-center text-sm", ...props }));
|
|
164
|
+
CommandEmpty.displayName = import_cmdk.Command.Empty.displayName;
|
|
165
|
+
var CommandGroup = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
166
|
+
import_cmdk.Command.Group,
|
|
167
|
+
{
|
|
168
|
+
ref,
|
|
169
|
+
className: cn(
|
|
170
|
+
"overflow-hidden p-1 text-neutral-950 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-neutral-500",
|
|
171
|
+
className
|
|
172
|
+
),
|
|
173
|
+
...props
|
|
174
|
+
}
|
|
175
|
+
));
|
|
176
|
+
CommandGroup.displayName = import_cmdk.Command.Group.displayName;
|
|
177
|
+
var CommandSeparator = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
178
|
+
import_cmdk.Command.Separator,
|
|
179
|
+
{
|
|
180
|
+
ref,
|
|
181
|
+
className: cn("-mx-1 h-px bg-neutral-200", className),
|
|
182
|
+
...props
|
|
183
|
+
}
|
|
184
|
+
));
|
|
185
|
+
CommandSeparator.displayName = import_cmdk.Command.Separator.displayName;
|
|
186
|
+
var CommandItem = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
187
|
+
import_cmdk.Command.Item,
|
|
188
|
+
{
|
|
189
|
+
ref,
|
|
190
|
+
className: cn(
|
|
191
|
+
"relative flex cursor-pointer select-none items-center rounded-xl px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-neutral-100 data-[selected=true]:text-neutral-900 data-[disabled=true]:opacity-50",
|
|
192
|
+
className
|
|
193
|
+
),
|
|
194
|
+
...props
|
|
195
|
+
}
|
|
196
|
+
));
|
|
197
|
+
CommandItem.displayName = import_cmdk.Command.Item.displayName;
|
|
198
|
+
var CommandShortcut = ({ className, ...props }) => {
|
|
199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
200
|
+
"span",
|
|
201
|
+
{
|
|
202
|
+
className: cn("ml-auto text-xs tracking-widest text-neutral-500", className),
|
|
203
|
+
...props
|
|
204
|
+
}
|
|
205
|
+
);
|
|
206
|
+
};
|
|
207
|
+
CommandShortcut.displayName = "CommandShortcut";
|
|
208
|
+
|
|
209
|
+
// src/components/primitives/popover.tsx
|
|
210
|
+
var React3 = __toESM(require("react"), 1);
|
|
211
|
+
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"), 1);
|
|
212
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
213
|
+
var Popover = PopoverPrimitive.Root;
|
|
214
|
+
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
215
|
+
var PopoverContent = React3.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PopoverPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
216
|
+
PopoverPrimitive.Content,
|
|
217
|
+
{
|
|
218
|
+
ref,
|
|
219
|
+
align,
|
|
220
|
+
sideOffset,
|
|
221
|
+
className: cn(
|
|
222
|
+
"z-50 rounded-2xl border bg-white p-4 text-black shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
|
|
223
|
+
className
|
|
224
|
+
),
|
|
225
|
+
...props
|
|
226
|
+
}
|
|
227
|
+
) }));
|
|
228
|
+
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
229
|
+
|
|
230
|
+
// src/components/primitives/separator.tsx
|
|
231
|
+
var SeparatorPrimitive = __toESM(require("@radix-ui/react-separator"), 1);
|
|
232
|
+
var React4 = __toESM(require("react"), 1);
|
|
233
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
234
|
+
var Separator = React4.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
235
|
+
SeparatorPrimitive.Root,
|
|
236
|
+
{
|
|
237
|
+
ref,
|
|
238
|
+
decorative,
|
|
239
|
+
orientation,
|
|
240
|
+
className: cn(
|
|
241
|
+
"shrink-0 bg-grey-10",
|
|
242
|
+
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
243
|
+
className
|
|
244
|
+
),
|
|
245
|
+
...props
|
|
246
|
+
}
|
|
247
|
+
));
|
|
248
|
+
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
249
|
+
|
|
250
|
+
// src/components/ui/ListItem.tsx
|
|
251
|
+
var import_lucide_react4 = require("lucide-react");
|
|
252
|
+
|
|
253
|
+
// src/components/ui/Checkbox.tsx
|
|
254
|
+
var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"), 1);
|
|
255
|
+
var import_lucide_react3 = require("lucide-react");
|
|
256
|
+
var import_react = require("react");
|
|
257
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
258
|
+
var CheckboxToggle = (0, import_react.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
259
|
+
CheckboxPrimitive.Root,
|
|
260
|
+
{
|
|
261
|
+
ref,
|
|
262
|
+
className: cn(
|
|
263
|
+
"group",
|
|
264
|
+
"peer",
|
|
265
|
+
"h-5",
|
|
266
|
+
"w-5",
|
|
267
|
+
"shrink-0",
|
|
268
|
+
"rounded-md",
|
|
269
|
+
"border",
|
|
270
|
+
"border-grey-10",
|
|
271
|
+
"outline",
|
|
272
|
+
"outline-1",
|
|
273
|
+
"outline-offset-2",
|
|
274
|
+
"outline-transparent",
|
|
275
|
+
"hover:border-grey-20",
|
|
276
|
+
"focus:outline-purple-100",
|
|
277
|
+
"active:border-green-80",
|
|
278
|
+
"disabled:cursor-not-allowed",
|
|
279
|
+
"disabled:opacity-50",
|
|
280
|
+
"data-[state=checked]:bg-green-80",
|
|
281
|
+
"data-[state=indeterminate]:bg-green-80",
|
|
282
|
+
"data-[state=checked]:text-white",
|
|
283
|
+
"data-[state=indeterminate]:text-primary-foreground",
|
|
284
|
+
props.disabled && "data-[state=checked]:text-foreground bg-grey-20 data-[state=checked]:bg-grey-20",
|
|
285
|
+
className
|
|
286
|
+
),
|
|
287
|
+
...props,
|
|
288
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(CheckboxPrimitive.Indicator, { className: "flex items-center justify-center text-current", children: [
|
|
289
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react3.Check, { className: "hidden h-4 w-4 group-data-[state=checked]:block" }),
|
|
290
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react3.Minus, { className: "hidden h-4 w-4 group-data-[state=indeterminate]:block" })
|
|
291
|
+
] })
|
|
292
|
+
}
|
|
293
|
+
));
|
|
294
|
+
CheckboxToggle.displayName = CheckboxPrimitive.Root.displayName;
|
|
295
|
+
var Checkbox = (0, import_react.forwardRef)(
|
|
296
|
+
({ classNames, children, ...props }, ref) => {
|
|
297
|
+
const { disabled } = props;
|
|
298
|
+
const id = props.id ?? `${props.name ?? props.value?.toString()}-checkbox`;
|
|
299
|
+
const labelClassName = disabled ? "text-grey-40 pointer-events-none" : "";
|
|
300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: cn("flex space-x-2", classNames?.wrapper), children: [
|
|
301
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CheckboxToggle, { id, disabled, ref, ...props }),
|
|
302
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { htmlFor: id, className: cn(labelClassName, classNames?.label), children })
|
|
303
|
+
] });
|
|
304
|
+
}
|
|
305
|
+
);
|
|
306
|
+
Checkbox.displayName = "Checkbox";
|
|
307
|
+
var Checkbox_default = Checkbox;
|
|
308
|
+
|
|
309
|
+
// src/components/ui/ListItem.tsx
|
|
310
|
+
var import_lucide_react5 = require("lucide-react");
|
|
311
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
312
|
+
function ListItem({
|
|
313
|
+
icon,
|
|
314
|
+
hasCheckbox,
|
|
315
|
+
isSelected,
|
|
316
|
+
className,
|
|
317
|
+
title,
|
|
318
|
+
value,
|
|
319
|
+
description,
|
|
320
|
+
...props
|
|
321
|
+
}) {
|
|
322
|
+
const getIconIfValid = (icon2) => {
|
|
323
|
+
if (icon2 in import_lucide_react5.icons) {
|
|
324
|
+
const IconComponent = import_lucide_react5.icons[icon2];
|
|
325
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconComponent, { size: 14 });
|
|
326
|
+
}
|
|
327
|
+
return null;
|
|
328
|
+
};
|
|
329
|
+
const optionIcon = icon ? getIconIfValid(icon) : void 0;
|
|
330
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
331
|
+
"li",
|
|
332
|
+
{
|
|
333
|
+
className: cn(
|
|
334
|
+
"group relative flex w-72 cursor-pointer flex-row items-center text-left text-sm",
|
|
335
|
+
className
|
|
336
|
+
),
|
|
337
|
+
...props,
|
|
338
|
+
"data-state": isSelected ? "checked" : "unchecked",
|
|
339
|
+
children: [
|
|
340
|
+
optionIcon && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "mr-2", children: optionIcon }),
|
|
341
|
+
hasCheckbox && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Checkbox_default, { id: value, checked: isSelected, onClick: (e) => e.preventDefault() }),
|
|
342
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
343
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: title }),
|
|
344
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-xs text-grey-80", children: description })
|
|
345
|
+
] }),
|
|
346
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
347
|
+
import_lucide_react4.CheckIcon,
|
|
348
|
+
{
|
|
349
|
+
className: "absolute inset-y-0 right-0 my-auto hidden w-6 text-green-100 group-data-[state=checked]:block",
|
|
350
|
+
size: 16
|
|
351
|
+
}
|
|
352
|
+
)
|
|
353
|
+
]
|
|
354
|
+
}
|
|
355
|
+
);
|
|
356
|
+
}
|
|
357
|
+
var ListItem_default = ListItem;
|
|
358
|
+
|
|
359
|
+
// src/components/ui/Badge.tsx
|
|
360
|
+
var import_cva = require("cva");
|
|
361
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
362
|
+
var badgeVariants = (0, import_cva.cva)("rounded-full px-2 py-0.5 text-xs font-semibold", {
|
|
363
|
+
variants: {
|
|
364
|
+
variant: {
|
|
365
|
+
green: "bg-green-90 text-white",
|
|
366
|
+
pickle: "bg-pickle-100 text-black",
|
|
367
|
+
purple: "bg-purple-100 text-white"
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
defaultVariants: {
|
|
371
|
+
variant: "green"
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
function Badge({ className, variant, ...props }) {
|
|
375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// src/components/ui/Label.tsx
|
|
379
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
380
|
+
function Label({ text, className, ...props }) {
|
|
381
|
+
if (!text) return null;
|
|
382
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
383
|
+
"label",
|
|
384
|
+
{
|
|
385
|
+
className: cn(
|
|
386
|
+
"text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
387
|
+
className
|
|
388
|
+
),
|
|
389
|
+
...props,
|
|
390
|
+
children: text
|
|
391
|
+
}
|
|
392
|
+
);
|
|
393
|
+
}
|
|
394
|
+
var Label_default = Label;
|
|
395
|
+
|
|
396
|
+
// src/components/ui/Combobox.tsx
|
|
397
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
398
|
+
var Combobox = (0, import_react2.forwardRef)((props, ref) => {
|
|
399
|
+
const {
|
|
400
|
+
value,
|
|
401
|
+
label,
|
|
402
|
+
options,
|
|
403
|
+
classNames,
|
|
404
|
+
multiselect,
|
|
405
|
+
placeholder,
|
|
406
|
+
variant = "default",
|
|
407
|
+
size,
|
|
408
|
+
icon,
|
|
409
|
+
className,
|
|
410
|
+
onChange: handleChange,
|
|
411
|
+
children: footer
|
|
412
|
+
} = props;
|
|
413
|
+
const [selected, setSelected] = (0, import_react2.useState)([]);
|
|
414
|
+
const [open, setOpen] = (0, import_react2.useState)(false);
|
|
415
|
+
const IconComponent = icon && import_lucide_react6.icons[icon];
|
|
416
|
+
const hideSearchBox = options?.length <= 5;
|
|
417
|
+
const isDefault = variant === "default";
|
|
418
|
+
const isChip = variant === "chip";
|
|
419
|
+
const isEmpty = selected.length == 0;
|
|
420
|
+
const showChevron = isDefault ? isEmpty : true;
|
|
421
|
+
const close = () => setOpen(false);
|
|
422
|
+
(0, import_react2.useEffect)(() => {
|
|
423
|
+
const valueArray = multiselect ? value ?? [] : value ? [value] : [];
|
|
424
|
+
setSelected(
|
|
425
|
+
valueArray.map((v) => options.find((o) => o.value === v)).filter((v) => v !== void 0)
|
|
426
|
+
);
|
|
427
|
+
}, [value]);
|
|
428
|
+
const handleSelect = (value2) => {
|
|
429
|
+
const option = options.find((o) => o.value === value2);
|
|
430
|
+
if (!option) return;
|
|
431
|
+
if (multiselect) {
|
|
432
|
+
return setSelected((prev) => {
|
|
433
|
+
const newSelected = prev.some((o) => o.value === value2) ? prev.filter((v) => v !== option) : [...prev, option];
|
|
434
|
+
handleChange?.(newSelected.map((o) => o.value));
|
|
435
|
+
return newSelected;
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
setSelected([option]);
|
|
439
|
+
handleChange?.(option.value);
|
|
440
|
+
close();
|
|
441
|
+
};
|
|
442
|
+
const handleClear = () => {
|
|
443
|
+
setSelected([]);
|
|
444
|
+
multiselect ? handleChange?.([]) : handleChange?.("");
|
|
445
|
+
};
|
|
446
|
+
const handleDisplayValue = () => {
|
|
447
|
+
const defaultLabel = !isEmpty ? selected.map((s) => s.title).join(", ") : placeholder;
|
|
448
|
+
return isDefault ? defaultLabel : label;
|
|
449
|
+
};
|
|
450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: cn("flex flex-col gap-2", className), children: [
|
|
451
|
+
isDefault && label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Label_default, { text: label, className: classNames?.label }),
|
|
452
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative flex", children: [
|
|
453
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Popover, { open, onOpenChange: setOpen, children: [
|
|
454
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
455
|
+
PopoverTrigger,
|
|
456
|
+
{
|
|
457
|
+
asChild: true,
|
|
458
|
+
disabled: options.length === 0,
|
|
459
|
+
"data-testid": `${props.id ?? props.name}-combobox-trigger`,
|
|
460
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
461
|
+
"div",
|
|
462
|
+
{
|
|
463
|
+
ref,
|
|
464
|
+
className: cn(
|
|
465
|
+
triggerVariants({ variant, size }),
|
|
466
|
+
isDefault && !isEmpty && "pr-10",
|
|
467
|
+
classNames?.trigger
|
|
468
|
+
),
|
|
469
|
+
"aria-expanded": open,
|
|
470
|
+
children: [
|
|
471
|
+
isDefault && IconComponent && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(IconComponent, { className: "h-4 w-4 shrink-0" }),
|
|
472
|
+
isChip && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Badge, { variant: "purple", children: selected.length }),
|
|
473
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
474
|
+
"span",
|
|
475
|
+
{
|
|
476
|
+
className: cn(
|
|
477
|
+
"w-full truncate leading-normal",
|
|
478
|
+
isDefault && isEmpty && "text-grey-40"
|
|
479
|
+
),
|
|
480
|
+
children: handleDisplayValue()
|
|
481
|
+
}
|
|
482
|
+
),
|
|
483
|
+
showChevron && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
484
|
+
import_lucide_react6.ChevronDownIcon,
|
|
485
|
+
{
|
|
486
|
+
className: "shrink-0 transform group-data-[state=open]:rotate-180",
|
|
487
|
+
size: "16"
|
|
488
|
+
}
|
|
489
|
+
)
|
|
490
|
+
]
|
|
491
|
+
}
|
|
492
|
+
)
|
|
493
|
+
}
|
|
494
|
+
),
|
|
495
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Command, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
496
|
+
PopoverContent,
|
|
497
|
+
{
|
|
498
|
+
className: cn(
|
|
499
|
+
"flex w-full max-w-xs flex-col overflow-hidden p-0",
|
|
500
|
+
"max-h-[--radix-popover-content-available-height]",
|
|
501
|
+
classNames?.content
|
|
502
|
+
),
|
|
503
|
+
collisionPadding: 8,
|
|
504
|
+
sideOffset: 4,
|
|
505
|
+
align: "start",
|
|
506
|
+
children: [
|
|
507
|
+
!hideSearchBox && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CommandInput, { placeholder: "Search..." }),
|
|
508
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(CommandList, { children: [
|
|
509
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CommandEmpty, { children: "No results" }),
|
|
510
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CommandGroup, { children: options.map(({ id, ...option }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CommandItem, { value: option.value, onSelect: handleSelect, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
511
|
+
ListItem_default,
|
|
512
|
+
{
|
|
513
|
+
className: cn(classNames?.items, "truncate py-1"),
|
|
514
|
+
isSelected: selected.some((s) => s.value === option.value),
|
|
515
|
+
hasCheckbox: multiselect,
|
|
516
|
+
...option
|
|
517
|
+
}
|
|
518
|
+
) }, id)) })
|
|
519
|
+
] }),
|
|
520
|
+
!!footer && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Separator, {}),
|
|
521
|
+
footer && footer({ close })
|
|
522
|
+
]
|
|
523
|
+
}
|
|
524
|
+
) })
|
|
525
|
+
] }),
|
|
526
|
+
isDefault && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
527
|
+
"button",
|
|
528
|
+
{
|
|
529
|
+
type: "button",
|
|
530
|
+
className: "absolute inset-y-0 right-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20",
|
|
531
|
+
onClick: handleClear,
|
|
532
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react6.CircleX, { className: "h-4 w-4 text-green-100" })
|
|
533
|
+
}
|
|
534
|
+
)
|
|
535
|
+
] })
|
|
536
|
+
] });
|
|
537
|
+
});
|
|
538
|
+
Combobox.displayName = "Combobox";
|
|
539
|
+
var triggerVariants = (0, import_cva2.cva)(
|
|
540
|
+
"group relative cursor-pointer text-green-100 flex flex-row items-center justify-between gap-2 border border-grey-20 focus:outline-green-80 disabled:bg-grey-5",
|
|
541
|
+
{
|
|
542
|
+
variants: {
|
|
543
|
+
variant: {
|
|
544
|
+
default: ["w-full", "max-w-80", "rounded-lg"],
|
|
545
|
+
chip: [
|
|
546
|
+
"font-bold",
|
|
547
|
+
"rounded-3xl",
|
|
548
|
+
"data-[state=open]:bg-black",
|
|
549
|
+
"data-[state=open]:text-white"
|
|
550
|
+
]
|
|
551
|
+
},
|
|
552
|
+
size: {
|
|
553
|
+
small: ["h-8", "py-1", "px-2", "text-xs"],
|
|
554
|
+
normal: ["h-9", "py-2", "px-3", "text-sm"],
|
|
555
|
+
large: ["h-10", "py-3", "px-4", "text-base"]
|
|
556
|
+
}
|
|
557
|
+
},
|
|
558
|
+
defaultVariants: {
|
|
559
|
+
variant: "default",
|
|
560
|
+
size: "normal"
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
);
|
|
564
|
+
|
|
565
|
+
// src/components/ui/Button.tsx
|
|
566
|
+
var import_react_slot = require("@radix-ui/react-slot");
|
|
567
|
+
var import_cva3 = require("cva");
|
|
568
|
+
var import_react3 = require("react");
|
|
569
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
570
|
+
var Button = (0, import_react3.forwardRef)(
|
|
571
|
+
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
572
|
+
const Component = asChild ? import_react_slot.Slot : "button";
|
|
573
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
574
|
+
Component,
|
|
575
|
+
{
|
|
576
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
577
|
+
ref,
|
|
578
|
+
...props
|
|
579
|
+
}
|
|
580
|
+
);
|
|
581
|
+
}
|
|
582
|
+
);
|
|
583
|
+
Button.displayName = "Button";
|
|
584
|
+
var buttonVariants = (0, import_cva3.cva)(
|
|
585
|
+
[
|
|
586
|
+
"flex",
|
|
587
|
+
"items-center",
|
|
588
|
+
"justify-center",
|
|
589
|
+
"gap-2",
|
|
590
|
+
"rounded-full",
|
|
591
|
+
"font-bold",
|
|
592
|
+
"outline-2",
|
|
593
|
+
"outline-offset-2",
|
|
594
|
+
"outline-dashed",
|
|
595
|
+
"outline-transparent"
|
|
596
|
+
],
|
|
597
|
+
{
|
|
598
|
+
variants: {
|
|
599
|
+
variant: {
|
|
600
|
+
neutral: [
|
|
601
|
+
"bg-black",
|
|
602
|
+
"text-white",
|
|
603
|
+
"hover:bg-grey-90",
|
|
604
|
+
"active:bg-grey-80",
|
|
605
|
+
"focus:outline-purple-100",
|
|
606
|
+
"disabled:text-grey-40",
|
|
607
|
+
"disabled:bg-grey-10"
|
|
608
|
+
],
|
|
609
|
+
primary: [
|
|
610
|
+
"bg-pickle-100",
|
|
611
|
+
"text-black",
|
|
612
|
+
"hover:bg-pickle-80",
|
|
613
|
+
"active:bg-pickle-60",
|
|
614
|
+
"focus:outline-purple-100",
|
|
615
|
+
"disabled:text-grey-40",
|
|
616
|
+
"disabled:bg-grey-10"
|
|
617
|
+
],
|
|
618
|
+
secondary: [
|
|
619
|
+
"bg-green-80",
|
|
620
|
+
"text-white",
|
|
621
|
+
"hover:bg-green-90",
|
|
622
|
+
"active:bg-green-100",
|
|
623
|
+
"focus:outline-pickle-100",
|
|
624
|
+
"disabled:text-grey-40",
|
|
625
|
+
"disabled:bg-grey-10"
|
|
626
|
+
],
|
|
627
|
+
transparent: [
|
|
628
|
+
"text-white",
|
|
629
|
+
"hover:bg-green-80",
|
|
630
|
+
"active:bg-green-100",
|
|
631
|
+
"focus:outline-pickle-100",
|
|
632
|
+
"disabled:text-grey-40"
|
|
633
|
+
],
|
|
634
|
+
link: [
|
|
635
|
+
"leading-tight",
|
|
636
|
+
"text-black",
|
|
637
|
+
"underline",
|
|
638
|
+
"hover:text-purple-100",
|
|
639
|
+
"focus:text-black",
|
|
640
|
+
"focus:outline-purple-100",
|
|
641
|
+
"active:text-purple-80"
|
|
642
|
+
]
|
|
643
|
+
},
|
|
644
|
+
size: {
|
|
645
|
+
small: ["h-10", "text-sm", "px-4", "py-2"],
|
|
646
|
+
medium: ["h-12", "text-base", "px-6", "py-3"],
|
|
647
|
+
large: ["h-14", "text-lg", "px-8", "py-4"]
|
|
648
|
+
}
|
|
649
|
+
},
|
|
650
|
+
defaultVariants: {
|
|
651
|
+
variant: "neutral",
|
|
652
|
+
size: "medium"
|
|
653
|
+
},
|
|
654
|
+
compoundVariants: [
|
|
655
|
+
{
|
|
656
|
+
variant: "link",
|
|
657
|
+
size: "small",
|
|
658
|
+
class: ["h-3", "text-xs", "p-0"]
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
variant: "link",
|
|
662
|
+
size: "medium",
|
|
663
|
+
class: ["h-4", "text-sm", "p-0"]
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
variant: "link",
|
|
667
|
+
size: "large",
|
|
668
|
+
class: ["h-6", "text-base", "p-0"]
|
|
669
|
+
}
|
|
670
|
+
]
|
|
671
|
+
}
|
|
672
|
+
);
|
|
673
|
+
|
|
674
|
+
// src/components/demos/ComboboxDemo.tsx
|
|
675
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
676
|
+
function ComboboxDemo() {
|
|
677
|
+
const [selectedBands, setSelectedBands] = (0, import_react4.useState)([]);
|
|
678
|
+
const [selectedFruit, setSelectedFruit] = (0, import_react4.useState)("");
|
|
679
|
+
const bands = [
|
|
680
|
+
{
|
|
681
|
+
title: "Nirvana",
|
|
682
|
+
value: "Nirvana",
|
|
683
|
+
description: "Come As You Are",
|
|
684
|
+
id: "1"
|
|
685
|
+
},
|
|
686
|
+
{ title: "Pearl Jam", value: "Pearl Jam", description: "Jeremy", id: "2" },
|
|
687
|
+
{
|
|
688
|
+
title: "Soundgarden",
|
|
689
|
+
value: "Soundgarden",
|
|
690
|
+
description: "Rusty Cage",
|
|
691
|
+
id: "3"
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
title: "Alice in Chains",
|
|
695
|
+
value: "Alice in Chains",
|
|
696
|
+
description: "Would?",
|
|
697
|
+
id: "4"
|
|
698
|
+
},
|
|
699
|
+
{ title: "Stone Temple Pilots", value: "Stone Temple Pilots", id: "5" },
|
|
700
|
+
{ title: "Hole", value: "Hole", id: "6" },
|
|
701
|
+
{ title: "Mudhoney", value: "Mudhoney", id: "7" },
|
|
702
|
+
{ title: "Screaming Trees", value: "Screaming Trees", id: "8" },
|
|
703
|
+
{ title: "L7", value: "L7", id: "9" },
|
|
704
|
+
{ title: "Sonic Youth", value: "Sonic Youth", id: "10" },
|
|
705
|
+
{
|
|
706
|
+
title: "And You Will Know Us by the Trail of Dead",
|
|
707
|
+
value: "And You Will Know Us by the Trail of Dead",
|
|
708
|
+
id: "11"
|
|
709
|
+
}
|
|
710
|
+
];
|
|
711
|
+
const fruits = [
|
|
712
|
+
{ title: "Cherry", value: "Cherry", id: "1", icon: "Cherry" },
|
|
713
|
+
{ title: "Grape", value: "Grape", id: "2", icon: "Grape" }
|
|
714
|
+
];
|
|
715
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-row flex-wrap items-center gap-4 p-4", children: [
|
|
716
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
717
|
+
Combobox,
|
|
718
|
+
{
|
|
719
|
+
label: "US bands from the 90's",
|
|
720
|
+
placeholder: "Select a band",
|
|
721
|
+
icon: "Music",
|
|
722
|
+
options: bands,
|
|
723
|
+
id: "bands",
|
|
724
|
+
multiselect: true,
|
|
725
|
+
onChange: setSelectedBands,
|
|
726
|
+
value: selectedBands
|
|
727
|
+
}
|
|
728
|
+
),
|
|
729
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
730
|
+
Combobox,
|
|
731
|
+
{
|
|
732
|
+
label: "US bands from the 90's",
|
|
733
|
+
options: bands,
|
|
734
|
+
variant: "chip",
|
|
735
|
+
multiselect: true,
|
|
736
|
+
name: "bands 2",
|
|
737
|
+
onChange: setSelectedBands,
|
|
738
|
+
value: selectedBands
|
|
739
|
+
}
|
|
740
|
+
),
|
|
741
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
742
|
+
Combobox,
|
|
743
|
+
{
|
|
744
|
+
label: "Fruit label",
|
|
745
|
+
variant: "chip",
|
|
746
|
+
options: fruits,
|
|
747
|
+
value: selectedFruit,
|
|
748
|
+
onChange: setSelectedFruit,
|
|
749
|
+
children: ({ close }) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "flex flex-row items-center justify-between bg-white p-2 pl-4", children: [
|
|
750
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Button, { variant: "link", tabIndex: -1, onClick: close, children: "Clear" }),
|
|
751
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Button, { variant: "primary", size: "small", tabIndex: -1, children: "Apply" })
|
|
752
|
+
] })
|
|
753
|
+
}
|
|
754
|
+
),
|
|
755
|
+
selectedBands.map((band) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-green-80", children: band }, band)),
|
|
756
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "text-purple-100", children: selectedFruit })
|
|
757
|
+
] });
|
|
758
|
+
}
|
|
759
|
+
var ComboboxDemo_default = ComboboxDemo;
|
|
2
760
|
//# sourceMappingURL=ComboboxDemo.cjs.map
|