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