@next-degree/pickle-shared-js 0.3.18 → 0.3.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -1
- package/dist/app/layout.cjs +70 -1
- package/dist/app/layout.cjs.map +1 -1
- package/dist/app/layout.css +1263 -1
- package/dist/app/layout.css.map +1 -1
- package/dist/app/layout.js +35 -1
- package/dist/app/layout.js.map +1 -1
- package/dist/app/page.cjs +774 -1
- package/dist/app/page.cjs.map +1 -1
- package/dist/app/page.js +743 -1
- package/dist/app/page.js.map +1 -1
- package/dist/assets/fonts/AmbitBold.cjs +2 -1
- package/dist/assets/fonts/AmbitBold.js +5 -1
- package/dist/assets/fonts/AmbitBoldItalic.cjs +2 -1
- package/dist/assets/fonts/AmbitBoldItalic.js +5 -1
- package/dist/assets/fonts/AmbitRegular.cjs +2 -1
- package/dist/assets/fonts/AmbitRegular.js +5 -1
- package/dist/components/demos/ComboboxDemo.cjs +759 -1
- package/dist/components/demos/ComboboxDemo.cjs.map +1 -1
- package/dist/components/demos/ComboboxDemo.js +731 -1
- package/dist/components/demos/ComboboxDemo.js.map +1 -1
- package/dist/components/demos/index.cjs +767 -1
- package/dist/components/demos/index.cjs.map +1 -1
- package/dist/components/demos/index.js +736 -1
- package/dist/components/demos/index.js.map +1 -1
- package/dist/components/primitives/command.cjs +223 -1
- package/dist/components/primitives/command.cjs.map +1 -1
- package/dist/components/primitives/command.js +181 -1
- package/dist/components/primitives/command.js.map +1 -1
- package/dist/components/primitives/dialog.cjs +137 -1
- package/dist/components/primitives/dialog.cjs.map +1 -1
- package/dist/components/primitives/dialog.js +92 -1
- package/dist/components/primitives/dialog.js.map +1 -1
- package/dist/components/primitives/popover.cjs +72 -1
- package/dist/components/primitives/popover.cjs.map +1 -1
- package/dist/components/primitives/popover.js +36 -1
- package/dist/components/primitives/popover.js.map +1 -1
- package/dist/components/primitives/separator.cjs +67 -1
- package/dist/components/primitives/separator.cjs.map +1 -1
- package/dist/components/primitives/separator.js +33 -1
- package/dist/components/primitives/separator.js.map +1 -1
- package/dist/components/ui/Badge.cjs +57 -1
- package/dist/components/ui/Badge.cjs.map +1 -1
- package/dist/components/ui/Badge.js +31 -1
- package/dist/components/ui/Badge.js.map +1 -1
- package/dist/components/ui/Button.cjs +145 -1
- package/dist/components/ui/Button.cjs.map +1 -1
- package/dist/components/ui/Button.js +118 -1
- package/dist/components/ui/Button.js.map +1 -1
- package/dist/components/ui/Checkbox.cjs +99 -1
- package/dist/components/ui/Checkbox.cjs.map +1 -1
- package/dist/components/ui/Checkbox.js +71 -1
- package/dist/components/ui/Checkbox.js.map +1 -1
- package/dist/components/ui/Chip.cjs +49 -1
- package/dist/components/ui/Chip.cjs.map +1 -1
- package/dist/components/ui/Chip.js +28 -1
- package/dist/components/ui/Chip.js.map +1 -1
- package/dist/components/ui/Combobox.cjs +564 -1
- package/dist/components/ui/Combobox.cjs.map +1 -1
- package/dist/components/ui/Combobox.js +532 -1
- package/dist/components/ui/Combobox.js.map +1 -1
- package/dist/components/ui/Label.cjs +50 -1
- package/dist/components/ui/Label.cjs.map +1 -1
- package/dist/components/ui/Label.js +27 -1
- package/dist/components/ui/Label.js.map +1 -1
- package/dist/components/ui/ListItem.cjs +151 -1
- package/dist/components/ui/ListItem.cjs.map +1 -1
- package/dist/components/ui/ListItem.js +120 -1
- package/dist/components/ui/ListItem.js.map +1 -1
- package/dist/components/ui/Select.cjs +246 -1
- package/dist/components/ui/Select.cjs.map +1 -1
- package/dist/components/ui/Select.js +221 -1
- package/dist/components/ui/Select.js.map +1 -1
- package/dist/index.cjs +855 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +817 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/utils.cjs +34 -1
- package/dist/lib/utils.cjs.map +1 -1
- package/dist/lib/utils.js +9 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/styles/globals.css +1263 -1
- package/dist/styles/globals.css.map +1 -1
- package/package.json +14 -17
|
@@ -1,2 +1,565 @@
|
|
|
1
|
-
"use strict";"use client";var Le=Object.create;var W=Object.defineProperty;var Te=Object.getOwnPropertyDescriptor;var _e=Object.getOwnPropertyNames;var We=Object.getPrototypeOf,Ve=Object.prototype.hasOwnProperty;var ze=(e,t)=>{for(var o in t)W(e,o,{get:t[o],enumerable:!0})},oe=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of _e(t))!Ve.call(e,r)&&r!==o&&W(e,r,{get:()=>t[r],enumerable:!(s=Te(t,r))||s.enumerable});return e};var x=(e,t,o)=>(o=e!=null?Le(We(e)):{},oe(t||!e||!e.__esModule?W(o,"default",{value:e,enumerable:!0}):o,e)),Me=e=>oe(W({},"__esModule",{value:!0}),e);var Qe={};ze(Qe,{Combobox:()=>ke});module.exports=Me(Qe);var N=require("react"),k=require("lucide-react"),Ne=require("cva");var ae=require("clsx"),ie=require("tailwind-merge");function a(...e){return(0,ie.twMerge)((0,ae.clsx)(e))}var m=require("cmdk"),le=require("lucide-react"),C=x(require("react"),1);var n=x(require("@radix-ui/react-dialog"),1),re=require("lucide-react"),S=x(require("react"),1),p=require("react/jsx-runtime");var Oe=n.Portal;var ne=S.forwardRef(({className:e,...t},o)=>(0,p.jsx)(n.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}));ne.displayName=n.Overlay.displayName;var se=S.forwardRef(({className:e,children:t,...o},s)=>(0,p.jsxs)(Oe,{children:[(0,p.jsx)(ne,{}),(0,p.jsxs)(n.Content,{ref:s,className:a("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-neutral-200 bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg dark:border-neutral-800 dark:bg-neutral-950",e),...o,children:[t,(0,p.jsxs)(n.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-neutral-950 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-neutral-100 data-[state=open]:text-neutral-500 dark:ring-offset-neutral-950 dark:focus:ring-neutral-300 dark:data-[state=open]:bg-neutral-800 dark:data-[state=open]:text-neutral-400",children:[(0,p.jsx)(re.X,{className:"h-4 w-4"}),(0,p.jsx)("span",{className:"sr-only",children:"Close"})]})]})]}));se.displayName=n.Content.displayName;var He=({className:e,...t})=>(0,p.jsx)("div",{className:a("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});He.displayName="DialogHeader";var Ge=({className:e,...t})=>(0,p.jsx)("div",{className:a("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Ge.displayName="DialogFooter";var Ae=S.forwardRef(({className:e,...t},o)=>(0,p.jsx)(n.Title,{ref:o,className:a("text-lg font-semibold leading-none tracking-tight",e),...t}));Ae.displayName=n.Title.displayName;var Be=S.forwardRef(({className:e,...t},o)=>(0,p.jsx)(n.Description,{ref:o,className:a("text-sm text-neutral-500 dark:text-neutral-400",e),...t}));Be.displayName=n.Description.displayName;var d=require("react/jsx-runtime"),H=C.forwardRef(({className:e,...t},o)=>(0,d.jsx)(m.Command,{ref:o,className:a("flex h-full w-full flex-col overflow-hidden rounded-xl bg-white text-neutral-950",e),...t}));H.displayName=m.Command.displayName;var G=C.forwardRef(({className:e,...t},o)=>(0,d.jsxs)("div",{className:"m-1 flex items-center rounded-xl border px-3","cmdk-input-wrapper":"",children:[(0,d.jsx)(le.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),(0,d.jsx)(m.Command.Input,{ref:o,className:a("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-neutral-500 disabled:cursor-not-allowed disabled:opacity-50",e),...t})]}));G.displayName=m.Command.Input.displayName;var A=C.forwardRef(({className:e,...t},o)=>(0,d.jsx)(m.Command.List,{ref:o,className:a("overflow-y-auto overflow-x-hidden",e),...t}));A.displayName=m.Command.List.displayName;var B=C.forwardRef((e,t)=>(0,d.jsx)(m.Command.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));B.displayName=m.Command.Empty.displayName;var F=C.forwardRef(({className:e,...t},o)=>(0,d.jsx)(m.Command.Group,{ref:o,className:a("overflow-hidden p-1 text-neutral-950 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-neutral-500",e),...t}));F.displayName=m.Command.Group.displayName;var Fe=C.forwardRef(({className:e,...t},o)=>(0,d.jsx)(m.Command.Separator,{ref:o,className:a("-mx-1 h-px bg-neutral-200",e),...t}));Fe.displayName=m.Command.Separator.displayName;var X=C.forwardRef(({className:e,...t},o)=>(0,d.jsx)(m.Command.Item,{ref:o,className:a("relative flex cursor-pointer select-none items-center rounded-xl px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-neutral-100 data-[selected=true]:text-neutral-900 data-[disabled=true]:opacity-50",e),...t}));X.displayName=m.Command.Item.displayName;var Xe=({className:e,...t})=>(0,d.jsx)("span",{className:a("ml-auto text-xs tracking-widest text-neutral-500",e),...t});Xe.displayName="CommandShortcut";var me=x(require("react"),1),v=x(require("@radix-ui/react-popover"),1);var K=require("react/jsx-runtime"),pe=v.Root,de=v.Trigger,J=me.forwardRef(({className:e,align:t="center",sideOffset:o=4,...s},r)=>(0,K.jsx)(v.Portal,{children:(0,K.jsx)(v.Content,{ref:r,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),...s})}));J.displayName=v.Content.displayName;var $=x(require("@radix-ui/react-separator"),1),ce=x(require("react"),1);var fe=require("react/jsx-runtime"),q=ce.forwardRef(({className:e,orientation:t="horizontal",decorative:o=!0,...s},r)=>(0,fe.jsx)($.Root,{ref:r,decorative:o,orientation:t,className:a("shrink-0 bg-grey-10",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...s}));q.displayName=$.Root.displayName;var ve=require("lucide-react");var I=x(require("@radix-ui/react-checkbox"),1),V=require("lucide-react"),Q=require("react");var y=require("react/jsx-runtime"),ue=(0,Q.forwardRef)(({className:e,...t},o)=>(0,y.jsx)(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:(0,y.jsxs)(I.Indicator,{className:"flex items-center justify-center text-current",children:[(0,y.jsx)(V.Check,{className:"hidden h-4 w-4 group-data-[state=checked]:block"}),(0,y.jsx)(V.Minus,{className:"hidden h-4 w-4 group-data-[state=indeterminate]:block"})]})}));ue.displayName=I.Root.displayName;var ge=(0,Q.forwardRef)(({classNames:e,children:t,...o},s)=>{let{disabled:r}=o,f=o.id??`${o.name??o.value?.toString()}-checkbox`,P=r?"text-grey-40 pointer-events-none":"";return(0,y.jsxs)("div",{className:a("flex space-x-2",e?.wrapper),children:[(0,y.jsx)(ue,{id:f,disabled:r,ref:s,...o}),(0,y.jsx)("label",{htmlFor:f,className:a(P,e?.label),children:t})]})});ge.displayName="Checkbox";var he=ge;var U=require("lucide-react"),c=require("react/jsx-runtime");function Ke({icon:e,hasCheckbox:t,isSelected:o,className:s,title:r,value:f,description:P,...z}){let L=e?(b=>{if(b in U.icons){let M=U.icons[b];return(0,c.jsx)(M,{size:14})}return null})(e):void 0;return(0,c.jsxs)("li",{className:a("group relative flex w-72 cursor-pointer flex-row items-center text-left text-sm",s),...z,"data-state":o?"checked":"unchecked",children:[L&&(0,c.jsx)("span",{className:"mr-2",children:L}),t&&(0,c.jsx)(he,{id:f,checked:o,onClick:b=>b.preventDefault()}),(0,c.jsxs)("div",{children:[(0,c.jsx)("p",{children:r}),(0,c.jsx)("p",{className:"text-xs text-grey-80",children:P})]}),(0,c.jsx)(ve.CheckIcon,{className:"absolute inset-y-0 right-0 my-auto hidden w-6 text-green-100 group-data-[state=checked]:block",size:16})]})}var ye=Ke;var Pe=require("cva");var Ce=require("react/jsx-runtime"),Je=(0,Pe.cva)("rounded-full px-2 py-0.5 text-xs font-semibold",{variants:{variant:{green:"bg-green-90 text-white",pickle:"bg-pickle-100 text-black",purple:"bg-purple-100 text-white"}},defaultVariants:{variant:"green"}});function xe({className:e,variant:t,...o}){return(0,Ce.jsx)("div",{className:a(Je({variant:t}),e),...o})}var Re=require("react/jsx-runtime");function $e({text:e,className:t,...o}){return e?(0,Re.jsx)("label",{className:a("text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70",t),...o,children:e}):null}var be=$e;var i=require("react/jsx-runtime"),ke=(0,N.forwardRef)((e,t)=>{let{value:o,label:s,options:r,classNames:f,multiselect:P,placeholder:z,variant:E="default",size:L,icon:b,className:M,onChange:T,children:O}=e,[u,_]=(0,N.useState)([]),[Y,Z]=(0,N.useState)(!1),j=b&&k.icons[b],we=r?.length<=5,w=E==="default",De=E==="chip",ee=()=>Z(!1);(0,N.useEffect)(()=>{_((P?o??[]:o?[o]:[]).map(l=>r.find(g=>g.value===l)).filter(l=>l!==void 0))},[o]);let Se=R=>{let l=r.find(g=>g.value===R);if(l){if(P)return _(g=>{let te=g.some(D=>D.value===R)?g.filter(D=>D!==l):[...g,l];return T?.(te.map(D=>D.value)),te});_([l]),T?.(l.value),ee()}},Ie=()=>{_([]),T?.(P?[]:"")},Ee=()=>{let R=u.length>0?u.map(l=>l.title).join(", "):z;return w?R:s};return(0,i.jsxs)("div",{className:a("flex flex-col gap-2",M),children:[w&&s&&(0,i.jsx)(be,{text:s,className:f?.label}),(0,i.jsxs)("div",{className:"relative flex",children:[(0,i.jsxs)(pe,{open:Y,onOpenChange:Z,children:[(0,i.jsx)(de,{asChild:!0,disabled:r.length===0,children:(0,i.jsxs)("div",{ref:t,className:a(qe({variant:E,size:L}),u.length>0&&"pr-10",f?.trigger),"aria-expanded":Y,children:[w&&j&&(0,i.jsx)(j,{className:"h-4 w-4 shrink-0"}),De&&u.length>0&&(0,i.jsx)(xe,{variant:"purple",children:u.length}),(0,i.jsx)("span",{className:a("w-full truncate leading-normal",w&&u.length==0&&"text-grey-40"),children:Ee()}),u.length==0&&(0,i.jsx)(k.ChevronDownIcon,{className:"shrink-0 transform group-data-[state=open]:rotate-180",size:"16"})]})}),(0,i.jsx)(H,{children:(0,i.jsxs)(J,{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:[!we&&(0,i.jsx)(G,{placeholder:"Search..."}),(0,i.jsxs)(A,{children:[(0,i.jsx)(B,{children:"No results"}),(0,i.jsx)(F,{children:r.map(({id:R,...l})=>(0,i.jsx)(X,{value:l.value,onSelect:Se,children:(0,i.jsx)(ye,{className:a(f?.items,"truncate py-1"),isSelected:u.some(g=>g.value===l.value),hasCheckbox:P,...l})},R))})]}),!!O&&(0,i.jsx)(q,{}),O&&O({close:ee})]})})]}),w&&u.length>0&&(0,i.jsx)("button",{type:"button",className:"absolute inset-y-0 right-1 my-auto flex h-8 w-8 cursor-pointer items-center justify-center rounded-full hover:bg-pickle-20",onClick:Ie,children:(0,i.jsx)(k.CircleX,{className:"h-4 w-4 text-green-100"})})]})]})});ke.displayName="Combobox";var qe=(0,Ne.cva)("group relative cursor-pointer text-green-100 flex flex-row items-center justify-between gap-2 border border-grey-20 focus:outline-green-80 disabled:bg-grey-5",{variants:{variant:{default:["w-full","max-w-80","rounded-lg"],chip:["font-bold","rounded-3xl","data-[state=open]:bg-black","data-[state=open]:text-white"]},size:{small:["h-8","py-1","px-2","text-xs"],normal:["h-9","py-2","px-3","text-sm"],large:["h-10","py-3","px-4","text-base"]}},defaultVariants:{variant:"default",size:"normal"}});0&&(module.exports={Combobox});
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
|
|
31
|
+
// src/components/ui/Combobox.tsx
|
|
32
|
+
var Combobox_exports = {};
|
|
33
|
+
__export(Combobox_exports, {
|
|
34
|
+
Combobox: () => Combobox
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(Combobox_exports);
|
|
37
|
+
var import_react2 = require("react");
|
|
38
|
+
var import_lucide_react6 = require("lucide-react");
|
|
39
|
+
var import_cva2 = require("cva");
|
|
40
|
+
|
|
41
|
+
// src/lib/utils.ts
|
|
42
|
+
var import_clsx = require("clsx");
|
|
43
|
+
var import_tailwind_merge = require("tailwind-merge");
|
|
44
|
+
function cn(...inputs) {
|
|
45
|
+
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// src/components/primitives/command.tsx
|
|
49
|
+
var import_cmdk = require("cmdk");
|
|
50
|
+
var import_lucide_react2 = require("lucide-react");
|
|
51
|
+
var React2 = __toESM(require("react"), 1);
|
|
52
|
+
|
|
53
|
+
// src/components/primitives/dialog.tsx
|
|
54
|
+
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
55
|
+
var import_lucide_react = require("lucide-react");
|
|
56
|
+
var React = __toESM(require("react"), 1);
|
|
57
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
58
|
+
var DialogPortal = DialogPrimitive.Portal;
|
|
59
|
+
var DialogOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
|
+
DialogPrimitive.Overlay,
|
|
61
|
+
{
|
|
62
|
+
ref,
|
|
63
|
+
className: cn(
|
|
64
|
+
"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",
|
|
65
|
+
className
|
|
66
|
+
),
|
|
67
|
+
...props
|
|
68
|
+
}
|
|
69
|
+
));
|
|
70
|
+
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
|
|
71
|
+
var DialogContent = React.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogPortal, { children: [
|
|
72
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogOverlay, {}),
|
|
73
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
74
|
+
DialogPrimitive.Content,
|
|
75
|
+
{
|
|
76
|
+
ref,
|
|
77
|
+
className: cn(
|
|
78
|
+
"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",
|
|
79
|
+
className
|
|
80
|
+
),
|
|
81
|
+
...props,
|
|
82
|
+
children: [
|
|
83
|
+
children,
|
|
84
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-neutral-950 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-neutral-100 data-[state=open]:text-neutral-500 dark:ring-offset-neutral-950 dark:focus:ring-neutral-300 dark:data-[state=open]:bg-neutral-800 dark:data-[state=open]:text-neutral-400", children: [
|
|
85
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.X, { className: "h-4 w-4" }),
|
|
86
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "sr-only", children: "Close" })
|
|
87
|
+
] })
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
] }));
|
|
92
|
+
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
93
|
+
var DialogHeader = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props });
|
|
94
|
+
DialogHeader.displayName = "DialogHeader";
|
|
95
|
+
var DialogFooter = ({ className, ...props }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
96
|
+
"div",
|
|
97
|
+
{
|
|
98
|
+
className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className),
|
|
99
|
+
...props
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
DialogFooter.displayName = "DialogFooter";
|
|
103
|
+
var DialogTitle = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
104
|
+
DialogPrimitive.Title,
|
|
105
|
+
{
|
|
106
|
+
ref,
|
|
107
|
+
className: cn("text-lg font-semibold leading-none tracking-tight", className),
|
|
108
|
+
...props
|
|
109
|
+
}
|
|
110
|
+
));
|
|
111
|
+
DialogTitle.displayName = DialogPrimitive.Title.displayName;
|
|
112
|
+
var DialogDescription = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
113
|
+
DialogPrimitive.Description,
|
|
114
|
+
{
|
|
115
|
+
ref,
|
|
116
|
+
className: cn("text-sm text-neutral-500 dark:text-neutral-400", className),
|
|
117
|
+
...props
|
|
118
|
+
}
|
|
119
|
+
));
|
|
120
|
+
DialogDescription.displayName = DialogPrimitive.Description.displayName;
|
|
121
|
+
|
|
122
|
+
// src/components/primitives/command.tsx
|
|
123
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
124
|
+
var Command = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
125
|
+
import_cmdk.Command,
|
|
126
|
+
{
|
|
127
|
+
ref,
|
|
128
|
+
className: cn(
|
|
129
|
+
"flex h-full w-full flex-col overflow-hidden rounded-xl bg-white text-neutral-950",
|
|
130
|
+
className
|
|
131
|
+
),
|
|
132
|
+
...props
|
|
133
|
+
}
|
|
134
|
+
));
|
|
135
|
+
Command.displayName = import_cmdk.Command.displayName;
|
|
136
|
+
var CommandInput = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "m-1 flex items-center rounded-xl border px-3", "cmdk-input-wrapper": "", children: [
|
|
137
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_lucide_react2.Search, { className: "mr-2 h-4 w-4 shrink-0 opacity-50" }),
|
|
138
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
139
|
+
import_cmdk.Command.Input,
|
|
140
|
+
{
|
|
141
|
+
ref,
|
|
142
|
+
className: cn(
|
|
143
|
+
"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",
|
|
144
|
+
className
|
|
145
|
+
),
|
|
146
|
+
...props
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
] }));
|
|
150
|
+
CommandInput.displayName = import_cmdk.Command.Input.displayName;
|
|
151
|
+
var CommandList = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
152
|
+
import_cmdk.Command.List,
|
|
153
|
+
{
|
|
154
|
+
ref,
|
|
155
|
+
className: cn("overflow-y-auto overflow-x-hidden", className),
|
|
156
|
+
...props
|
|
157
|
+
}
|
|
158
|
+
));
|
|
159
|
+
CommandList.displayName = import_cmdk.Command.List.displayName;
|
|
160
|
+
var CommandEmpty = React2.forwardRef((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_cmdk.Command.Empty, { ref, className: "py-6 text-center text-sm", ...props }));
|
|
161
|
+
CommandEmpty.displayName = import_cmdk.Command.Empty.displayName;
|
|
162
|
+
var CommandGroup = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
163
|
+
import_cmdk.Command.Group,
|
|
164
|
+
{
|
|
165
|
+
ref,
|
|
166
|
+
className: cn(
|
|
167
|
+
"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",
|
|
168
|
+
className
|
|
169
|
+
),
|
|
170
|
+
...props
|
|
171
|
+
}
|
|
172
|
+
));
|
|
173
|
+
CommandGroup.displayName = import_cmdk.Command.Group.displayName;
|
|
174
|
+
var CommandSeparator = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
175
|
+
import_cmdk.Command.Separator,
|
|
176
|
+
{
|
|
177
|
+
ref,
|
|
178
|
+
className: cn("-mx-1 h-px bg-neutral-200", className),
|
|
179
|
+
...props
|
|
180
|
+
}
|
|
181
|
+
));
|
|
182
|
+
CommandSeparator.displayName = import_cmdk.Command.Separator.displayName;
|
|
183
|
+
var CommandItem = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
184
|
+
import_cmdk.Command.Item,
|
|
185
|
+
{
|
|
186
|
+
ref,
|
|
187
|
+
className: cn(
|
|
188
|
+
"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",
|
|
189
|
+
className
|
|
190
|
+
),
|
|
191
|
+
...props
|
|
192
|
+
}
|
|
193
|
+
));
|
|
194
|
+
CommandItem.displayName = import_cmdk.Command.Item.displayName;
|
|
195
|
+
var CommandShortcut = ({ className, ...props }) => {
|
|
196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
197
|
+
"span",
|
|
198
|
+
{
|
|
199
|
+
className: cn("ml-auto text-xs tracking-widest text-neutral-500", className),
|
|
200
|
+
...props
|
|
201
|
+
}
|
|
202
|
+
);
|
|
203
|
+
};
|
|
204
|
+
CommandShortcut.displayName = "CommandShortcut";
|
|
205
|
+
|
|
206
|
+
// src/components/primitives/popover.tsx
|
|
207
|
+
var React3 = __toESM(require("react"), 1);
|
|
208
|
+
var PopoverPrimitive = __toESM(require("@radix-ui/react-popover"), 1);
|
|
209
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
210
|
+
var Popover = PopoverPrimitive.Root;
|
|
211
|
+
var PopoverTrigger = PopoverPrimitive.Trigger;
|
|
212
|
+
var PopoverContent = React3.forwardRef(({ className, align = "center", sideOffset = 4, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(PopoverPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
213
|
+
PopoverPrimitive.Content,
|
|
214
|
+
{
|
|
215
|
+
ref,
|
|
216
|
+
align,
|
|
217
|
+
sideOffset,
|
|
218
|
+
className: cn(
|
|
219
|
+
"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",
|
|
220
|
+
className
|
|
221
|
+
),
|
|
222
|
+
...props
|
|
223
|
+
}
|
|
224
|
+
) }));
|
|
225
|
+
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
|
226
|
+
|
|
227
|
+
// src/components/primitives/separator.tsx
|
|
228
|
+
var SeparatorPrimitive = __toESM(require("@radix-ui/react-separator"), 1);
|
|
229
|
+
var React4 = __toESM(require("react"), 1);
|
|
230
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
231
|
+
var Separator = React4.forwardRef(({ className, orientation = "horizontal", decorative = true, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
232
|
+
SeparatorPrimitive.Root,
|
|
233
|
+
{
|
|
234
|
+
ref,
|
|
235
|
+
decorative,
|
|
236
|
+
orientation,
|
|
237
|
+
className: cn(
|
|
238
|
+
"shrink-0 bg-grey-10",
|
|
239
|
+
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
240
|
+
className
|
|
241
|
+
),
|
|
242
|
+
...props
|
|
243
|
+
}
|
|
244
|
+
));
|
|
245
|
+
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
246
|
+
|
|
247
|
+
// src/components/ui/ListItem.tsx
|
|
248
|
+
var import_lucide_react4 = require("lucide-react");
|
|
249
|
+
|
|
250
|
+
// src/components/ui/Checkbox.tsx
|
|
251
|
+
var CheckboxPrimitive = __toESM(require("@radix-ui/react-checkbox"), 1);
|
|
252
|
+
var import_lucide_react3 = require("lucide-react");
|
|
253
|
+
var import_react = require("react");
|
|
254
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
255
|
+
var CheckboxToggle = (0, import_react.forwardRef)(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
256
|
+
CheckboxPrimitive.Root,
|
|
257
|
+
{
|
|
258
|
+
ref,
|
|
259
|
+
className: cn(
|
|
260
|
+
"group",
|
|
261
|
+
"peer",
|
|
262
|
+
"h-5",
|
|
263
|
+
"w-5",
|
|
264
|
+
"shrink-0",
|
|
265
|
+
"rounded-md",
|
|
266
|
+
"border",
|
|
267
|
+
"border-grey-10",
|
|
268
|
+
"outline",
|
|
269
|
+
"outline-1",
|
|
270
|
+
"outline-offset-2",
|
|
271
|
+
"outline-transparent",
|
|
272
|
+
"hover:border-grey-20",
|
|
273
|
+
"focus:outline-purple-100",
|
|
274
|
+
"active:border-green-80",
|
|
275
|
+
"disabled:cursor-not-allowed",
|
|
276
|
+
"disabled:opacity-50",
|
|
277
|
+
"data-[state=checked]:bg-green-80",
|
|
278
|
+
"data-[state=indeterminate]:bg-green-80",
|
|
279
|
+
"data-[state=checked]:text-white",
|
|
280
|
+
"data-[state=indeterminate]:text-primary-foreground",
|
|
281
|
+
props.disabled && "data-[state=checked]:text-foreground bg-grey-20 data-[state=checked]:bg-grey-20",
|
|
282
|
+
className
|
|
283
|
+
),
|
|
284
|
+
...props,
|
|
285
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(CheckboxPrimitive.Indicator, { className: "flex items-center justify-center text-current", children: [
|
|
286
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react3.Check, { className: "hidden h-4 w-4 group-data-[state=checked]:block" }),
|
|
287
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_lucide_react3.Minus, { className: "hidden h-4 w-4 group-data-[state=indeterminate]:block" })
|
|
288
|
+
] })
|
|
289
|
+
}
|
|
290
|
+
));
|
|
291
|
+
CheckboxToggle.displayName = CheckboxPrimitive.Root.displayName;
|
|
292
|
+
var Checkbox = (0, import_react.forwardRef)(
|
|
293
|
+
({ classNames, children, ...props }, ref) => {
|
|
294
|
+
const { disabled } = props;
|
|
295
|
+
const id = props.id ?? `${props.name ?? props.value?.toString()}-checkbox`;
|
|
296
|
+
const labelClassName = disabled ? "text-grey-40 pointer-events-none" : "";
|
|
297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: cn("flex space-x-2", classNames?.wrapper), children: [
|
|
298
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CheckboxToggle, { id, disabled, ref, ...props }),
|
|
299
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { htmlFor: id, className: cn(labelClassName, classNames?.label), children })
|
|
300
|
+
] });
|
|
301
|
+
}
|
|
302
|
+
);
|
|
303
|
+
Checkbox.displayName = "Checkbox";
|
|
304
|
+
var Checkbox_default = Checkbox;
|
|
305
|
+
|
|
306
|
+
// src/components/ui/ListItem.tsx
|
|
307
|
+
var import_lucide_react5 = require("lucide-react");
|
|
308
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
309
|
+
function ListItem({
|
|
310
|
+
icon,
|
|
311
|
+
hasCheckbox,
|
|
312
|
+
isSelected,
|
|
313
|
+
className,
|
|
314
|
+
title,
|
|
315
|
+
value,
|
|
316
|
+
description,
|
|
317
|
+
...props
|
|
318
|
+
}) {
|
|
319
|
+
const getIconIfValid = (icon2) => {
|
|
320
|
+
if (icon2 in import_lucide_react5.icons) {
|
|
321
|
+
const IconComponent = import_lucide_react5.icons[icon2];
|
|
322
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(IconComponent, { size: 14 });
|
|
323
|
+
}
|
|
324
|
+
return null;
|
|
325
|
+
};
|
|
326
|
+
const optionIcon = icon ? getIconIfValid(icon) : void 0;
|
|
327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
328
|
+
"li",
|
|
329
|
+
{
|
|
330
|
+
className: cn(
|
|
331
|
+
"group relative flex w-72 cursor-pointer flex-row items-center text-left text-sm",
|
|
332
|
+
className
|
|
333
|
+
),
|
|
334
|
+
...props,
|
|
335
|
+
"data-state": isSelected ? "checked" : "unchecked",
|
|
336
|
+
children: [
|
|
337
|
+
optionIcon && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "mr-2", children: optionIcon }),
|
|
338
|
+
hasCheckbox && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Checkbox_default, { id: value, checked: isSelected, onClick: (e) => e.preventDefault() }),
|
|
339
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
|
|
340
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: title }),
|
|
341
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-xs text-grey-80", children: description })
|
|
342
|
+
] }),
|
|
343
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
344
|
+
import_lucide_react4.CheckIcon,
|
|
345
|
+
{
|
|
346
|
+
className: "absolute inset-y-0 right-0 my-auto hidden w-6 text-green-100 group-data-[state=checked]:block",
|
|
347
|
+
size: 16
|
|
348
|
+
}
|
|
349
|
+
)
|
|
350
|
+
]
|
|
351
|
+
}
|
|
352
|
+
);
|
|
353
|
+
}
|
|
354
|
+
var ListItem_default = ListItem;
|
|
355
|
+
|
|
356
|
+
// src/components/ui/Badge.tsx
|
|
357
|
+
var import_cva = require("cva");
|
|
358
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
359
|
+
var badgeVariants = (0, import_cva.cva)("rounded-full px-2 py-0.5 text-xs font-semibold", {
|
|
360
|
+
variants: {
|
|
361
|
+
variant: {
|
|
362
|
+
green: "bg-green-90 text-white",
|
|
363
|
+
pickle: "bg-pickle-100 text-black",
|
|
364
|
+
purple: "bg-purple-100 text-white"
|
|
365
|
+
}
|
|
366
|
+
},
|
|
367
|
+
defaultVariants: {
|
|
368
|
+
variant: "green"
|
|
369
|
+
}
|
|
370
|
+
});
|
|
371
|
+
function Badge({ className, variant, ...props }) {
|
|
372
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: cn(badgeVariants({ variant }), className), ...props });
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// src/components/ui/Label.tsx
|
|
376
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
377
|
+
function Label({ text, className, ...props }) {
|
|
378
|
+
if (!text) return null;
|
|
379
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
380
|
+
"label",
|
|
381
|
+
{
|
|
382
|
+
className: cn(
|
|
383
|
+
"text-xs text-grey-80 peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
|
384
|
+
className
|
|
385
|
+
),
|
|
386
|
+
...props,
|
|
387
|
+
children: text
|
|
388
|
+
}
|
|
389
|
+
);
|
|
390
|
+
}
|
|
391
|
+
var Label_default = Label;
|
|
392
|
+
|
|
393
|
+
// src/components/ui/Combobox.tsx
|
|
394
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
395
|
+
var Combobox = (0, import_react2.forwardRef)((props, ref) => {
|
|
396
|
+
const {
|
|
397
|
+
value,
|
|
398
|
+
label,
|
|
399
|
+
options,
|
|
400
|
+
classNames,
|
|
401
|
+
multiselect,
|
|
402
|
+
placeholder,
|
|
403
|
+
variant = "default",
|
|
404
|
+
size,
|
|
405
|
+
icon,
|
|
406
|
+
className,
|
|
407
|
+
onChange: handleChange,
|
|
408
|
+
children: footer
|
|
409
|
+
} = props;
|
|
410
|
+
const [selected, setSelected] = (0, import_react2.useState)([]);
|
|
411
|
+
const [open, setOpen] = (0, import_react2.useState)(false);
|
|
412
|
+
const IconComponent = icon && import_lucide_react6.icons[icon];
|
|
413
|
+
const hideSearchBox = options?.length <= 5;
|
|
414
|
+
const isDefault = variant === "default";
|
|
415
|
+
const isChip = variant === "chip";
|
|
416
|
+
const isEmpty = selected.length == 0;
|
|
417
|
+
const showChevron = isDefault ? isEmpty : true;
|
|
418
|
+
const close = () => setOpen(false);
|
|
419
|
+
(0, import_react2.useEffect)(() => {
|
|
420
|
+
const valueArray = multiselect ? value ?? [] : value ? [value] : [];
|
|
421
|
+
setSelected(
|
|
422
|
+
valueArray.map((v) => options.find((o) => o.value === v)).filter((v) => v !== void 0)
|
|
423
|
+
);
|
|
424
|
+
}, [value]);
|
|
425
|
+
const handleSelect = (value2) => {
|
|
426
|
+
const option = options.find((o) => o.value === value2);
|
|
427
|
+
if (!option) return;
|
|
428
|
+
if (multiselect) {
|
|
429
|
+
return setSelected((prev) => {
|
|
430
|
+
const newSelected = prev.some((o) => o.value === value2) ? prev.filter((v) => v !== option) : [...prev, option];
|
|
431
|
+
handleChange?.(newSelected.map((o) => o.value));
|
|
432
|
+
return newSelected;
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
setSelected([option]);
|
|
436
|
+
handleChange?.(option.value);
|
|
437
|
+
close();
|
|
438
|
+
};
|
|
439
|
+
const handleClear = () => {
|
|
440
|
+
setSelected([]);
|
|
441
|
+
multiselect ? handleChange?.([]) : handleChange?.("");
|
|
442
|
+
};
|
|
443
|
+
const handleDisplayValue = () => {
|
|
444
|
+
const defaultLabel = !isEmpty ? selected.map((s) => s.title).join(", ") : placeholder;
|
|
445
|
+
return isDefault ? defaultLabel : label;
|
|
446
|
+
};
|
|
447
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: cn("flex flex-col gap-2", className), children: [
|
|
448
|
+
isDefault && label && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Label_default, { text: label, className: classNames?.label }),
|
|
449
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "relative flex", children: [
|
|
450
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Popover, { open, onOpenChange: setOpen, children: [
|
|
451
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
452
|
+
PopoverTrigger,
|
|
453
|
+
{
|
|
454
|
+
asChild: true,
|
|
455
|
+
disabled: options.length === 0,
|
|
456
|
+
"data-testid": `${props.id ?? props.name}-combobox-trigger`,
|
|
457
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
458
|
+
"div",
|
|
459
|
+
{
|
|
460
|
+
ref,
|
|
461
|
+
className: cn(
|
|
462
|
+
triggerVariants({ variant, size }),
|
|
463
|
+
isDefault && !isEmpty && "pr-10",
|
|
464
|
+
classNames?.trigger
|
|
465
|
+
),
|
|
466
|
+
"aria-expanded": open,
|
|
467
|
+
children: [
|
|
468
|
+
isDefault && IconComponent && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(IconComponent, { className: "h-4 w-4 shrink-0" }),
|
|
469
|
+
isChip && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Badge, { variant: "purple", children: selected.length }),
|
|
470
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
471
|
+
"span",
|
|
472
|
+
{
|
|
473
|
+
className: cn(
|
|
474
|
+
"w-full truncate leading-normal",
|
|
475
|
+
isDefault && isEmpty && "text-grey-40"
|
|
476
|
+
),
|
|
477
|
+
children: handleDisplayValue()
|
|
478
|
+
}
|
|
479
|
+
),
|
|
480
|
+
showChevron && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
481
|
+
import_lucide_react6.ChevronDownIcon,
|
|
482
|
+
{
|
|
483
|
+
className: "shrink-0 transform group-data-[state=open]:rotate-180",
|
|
484
|
+
size: "16"
|
|
485
|
+
}
|
|
486
|
+
)
|
|
487
|
+
]
|
|
488
|
+
}
|
|
489
|
+
)
|
|
490
|
+
}
|
|
491
|
+
),
|
|
492
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Command, { children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
493
|
+
PopoverContent,
|
|
494
|
+
{
|
|
495
|
+
className: cn(
|
|
496
|
+
"flex w-full max-w-xs flex-col overflow-hidden p-0",
|
|
497
|
+
"max-h-[--radix-popover-content-available-height]",
|
|
498
|
+
classNames?.content
|
|
499
|
+
),
|
|
500
|
+
collisionPadding: 8,
|
|
501
|
+
sideOffset: 4,
|
|
502
|
+
align: "start",
|
|
503
|
+
children: [
|
|
504
|
+
!hideSearchBox && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CommandInput, { placeholder: "Search..." }),
|
|
505
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(CommandList, { children: [
|
|
506
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CommandEmpty, { children: "No results" }),
|
|
507
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CommandGroup, { children: options.map(({ id, ...option }) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CommandItem, { value: option.value, onSelect: handleSelect, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
508
|
+
ListItem_default,
|
|
509
|
+
{
|
|
510
|
+
className: cn(classNames?.items, "truncate py-1"),
|
|
511
|
+
isSelected: selected.some((s) => s.value === option.value),
|
|
512
|
+
hasCheckbox: multiselect,
|
|
513
|
+
...option
|
|
514
|
+
}
|
|
515
|
+
) }, id)) })
|
|
516
|
+
] }),
|
|
517
|
+
!!footer && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Separator, {}),
|
|
518
|
+
footer && footer({ close })
|
|
519
|
+
]
|
|
520
|
+
}
|
|
521
|
+
) })
|
|
522
|
+
] }),
|
|
523
|
+
isDefault && !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
524
|
+
"button",
|
|
525
|
+
{
|
|
526
|
+
type: "button",
|
|
527
|
+
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",
|
|
528
|
+
onClick: handleClear,
|
|
529
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_lucide_react6.CircleX, { className: "h-4 w-4 text-green-100" })
|
|
530
|
+
}
|
|
531
|
+
)
|
|
532
|
+
] })
|
|
533
|
+
] });
|
|
534
|
+
});
|
|
535
|
+
Combobox.displayName = "Combobox";
|
|
536
|
+
var triggerVariants = (0, import_cva2.cva)(
|
|
537
|
+
"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",
|
|
538
|
+
{
|
|
539
|
+
variants: {
|
|
540
|
+
variant: {
|
|
541
|
+
default: ["w-full", "max-w-80", "rounded-lg"],
|
|
542
|
+
chip: [
|
|
543
|
+
"font-bold",
|
|
544
|
+
"rounded-3xl",
|
|
545
|
+
"data-[state=open]:bg-black",
|
|
546
|
+
"data-[state=open]:text-white"
|
|
547
|
+
]
|
|
548
|
+
},
|
|
549
|
+
size: {
|
|
550
|
+
small: ["h-8", "py-1", "px-2", "text-xs"],
|
|
551
|
+
normal: ["h-9", "py-2", "px-3", "text-sm"],
|
|
552
|
+
large: ["h-10", "py-3", "px-4", "text-base"]
|
|
553
|
+
}
|
|
554
|
+
},
|
|
555
|
+
defaultVariants: {
|
|
556
|
+
variant: "default",
|
|
557
|
+
size: "normal"
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
);
|
|
561
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
562
|
+
0 && (module.exports = {
|
|
563
|
+
Combobox
|
|
564
|
+
});
|
|
2
565
|
//# sourceMappingURL=Combobox.cjs.map
|