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