@xploreu/components 0.4.15 → 0.4.17

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.
Files changed (43) hide show
  1. package/dist/{chunk-FB6VMMUL.js → chunk-BSWTMWP5.js} +2 -2
  2. package/dist/{chunk-FB6VMMUL.js.map → chunk-BSWTMWP5.js.map} +1 -1
  3. package/dist/{chunk-VE5SIEG4.js → chunk-C7KUNTTO.js} +2 -2
  4. package/dist/{chunk-VE5SIEG4.js.map → chunk-C7KUNTTO.js.map} +1 -1
  5. package/dist/chunk-CPRMLK2G.js +2 -0
  6. package/dist/chunk-CPRMLK2G.js.map +1 -0
  7. package/dist/{chunk-QX6F73UK.js → chunk-F2QUDOBO.js} +2 -2
  8. package/dist/{chunk-QX6F73UK.js.map → chunk-F2QUDOBO.js.map} +1 -1
  9. package/dist/chunk-GNQKITNA.js +2 -0
  10. package/dist/chunk-GNQKITNA.js.map +1 -0
  11. package/dist/{chunk-GJZZ55GE.js → chunk-IIFWJ2BW.js} +2 -2
  12. package/dist/{chunk-GJZZ55GE.js.map → chunk-IIFWJ2BW.js.map} +1 -1
  13. package/dist/{chunk-TG3TM7XY.js → chunk-LTSUNU7E.js} +2 -2
  14. package/dist/{chunk-TG3TM7XY.js.map → chunk-LTSUNU7E.js.map} +1 -1
  15. package/dist/chunk-OK4K7DSW.js +2 -0
  16. package/dist/chunk-OK4K7DSW.js.map +1 -0
  17. package/dist/chunk-ZNZVX4PT.js +2 -0
  18. package/dist/chunk-ZNZVX4PT.js.map +1 -0
  19. package/dist/composites/combobox-chip-outside.js +1 -1
  20. package/dist/composites/combobox-chip.js +1 -1
  21. package/dist/composites/combobox-simple.js +1 -1
  22. package/dist/composites/filter-combobox.d.ts +3 -1
  23. package/dist/composites/filter-combobox.js +1 -1
  24. package/dist/composites/index.js +1 -1
  25. package/dist/composites/phone-input.js +1 -1
  26. package/dist/composites/profile-avatar.d.ts +1 -1
  27. package/dist/primitives/combobox.js +1 -1
  28. package/dist/primitives/index.js +1 -1
  29. package/dist/ui/combobox.js +1 -1
  30. package/dist/ui/dialog.d.ts +10 -1
  31. package/dist/ui/dialog.js +1 -1
  32. package/dist/ui/index.d.ts +2 -1
  33. package/dist/ui/index.js +1 -1
  34. package/dist/ui/pagination.js +1 -1
  35. package/package.json +108 -108
  36. package/dist/chunk-3VMZENNL.js +0 -2
  37. package/dist/chunk-3VMZENNL.js.map +0 -1
  38. package/dist/chunk-AKTRVGKT.js +0 -2
  39. package/dist/chunk-AKTRVGKT.js.map +0 -1
  40. package/dist/chunk-JILBFCPY.js +0 -2
  41. package/dist/chunk-JILBFCPY.js.map +0 -1
  42. package/dist/chunk-M73NAM5U.js +0 -2
  43. package/dist/chunk-M73NAM5U.js.map +0 -1
@@ -1,2 +0,0 @@
1
- import {b,c,g,d,f,h as h$1,i,j,k as k$1,e}from'./chunk-5YDJTHDG.js';import'react';import {XIcon}from'lucide-react';import {cn}from'@xploreu/lib/cn';import {jsx,jsxs}from'react/jsx-runtime';function C(o){return jsx(b,{...o})}function h(o){return jsx(c,{...o})}function w(o){return jsx(g,{...o})}function x({className:o,...i}){return jsx(e,{className:cn("fixed inset-0 z-50 bg-black/50 backdrop-blur-sm",o),...i})}function k({className:o,children:i,showCloseButton:c=true,closeClassName:v,...y}){return jsxs(d,{children:[jsx(x,{}),jsxs(f,{className:cn("fixed left-[50%] top-[50%] z-50 grid w-[calc(100%-2rem)] max-w-lg translate-x-[-50%] translate-y-[-50%] bg-bg-primary shadow-xp-lg rounded-xl overflow-hidden",o),...y,children:[i,c&&jsxs(g,{className:cn("data-[state=open]:bg-bg-primary data-[state=open]:text-text-primary absolute top-3 right-4 rounded-xs transition-colors hover:text-text-error-primary-hover disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",v),children:[jsx(XIcon,{}),jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function H({className:o,...i}){return jsx(h$1,{className:cn("relative px-4 py-3 flex flex-col bg-bg-primary border-b border-border-tertiary bg-radial-[100%_200%_at_0%_0%] from-modal-dialog-stop-0 to-bg-primary has-[[data-slot=dialog-icon]]:pl-16",o),...i})}function N({className:o,...i}){return jsx("div",{"data-slot":"dialog-content",className:cn("px-4 py-4 max-h-[60vh] overflow-y-auto",o),...i})}function B({className:o,...i$1}){return jsx(i,{className:cn("flex gap-2 items-center justify-end bg-bg-primary border-t border-border-tertiary px-4 py-3 shadow-[0px_-1px_24px_0px_var(--color-shadow-xs)] peer-[[data-slot=dialog-content]]:border-0",o),...i$1})}function F({className:o,...i}){return jsx(j,{className:cn("text-label-bold-2 text-text-primary",o),...i})}function z({className:o,...i}){return jsx(k$1,{className:cn("mt-0.5 text-body-regular-3 text-text-secondary",o),...i})}function R({className:o,...i}){return jsx("div",{"data-slot":"dialog-icon",className:cn("absolute top-[13px] left-4 flex items-center justify-center rounded-lg bg-bg-primary p-2.5 [&_svg]:size-4 bg-bg-brand-solid text-fg-white shadow-[0px_1px_2px_-1px_var(--color-shadow-lg-01),0px_1px_3px_0px_var(--color-shadow-md-01),0px_0px_0px_4px_var(--color-focus-ring-secondary)]",o),...i})}export{C as a,h as b,w as c,k as d,H as e,N as f,B as g,F as h,z as i,R as j};//# sourceMappingURL=chunk-AKTRVGKT.js.map
2
- //# sourceMappingURL=chunk-AKTRVGKT.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/ui/dialog.tsx"],"names":["Dialog","props","jsx","DialogTrigger","DialogClose","DialogBackdrop","className","cn","DialogPopup","children","showCloseButton","closeClassName","jsxs","DialogPortal","XIcon","DialogHeader","DialogContent","DialogFooter","DialogTitle","DialogDescription","DialogIcon"],"mappings":"6LA4BA,SAASA,CAAAA,CAAOC,CAAAA,CAAoB,CAClC,OAAOC,GAAAA,CAACF,CAAAA,CAAA,CAAiB,GAAGC,CAAAA,CAAO,CACrC,CAIA,SAASE,CAAAA,CAAcF,EAA2B,CAChD,OAAOC,GAAAA,CAACC,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react';\r\n\r\nimport {\r\n Dialog as DialogPrimitive,\r\n DialogPopup as DialogPopupPrimitive,\r\n DialogDescription as DialogDescriptionPrimitive,\r\n DialogFooter as DialogFooterPrimitive,\r\n DialogHeader as DialogHeaderPrimitive,\r\n DialogTitle as DialogTitlePrimitive,\r\n DialogTrigger as DialogTriggerPrimitive,\r\n DialogPortal as DialogPortalPrimitive,\r\n DialogBackdrop as DialogBackdropPrimitive,\r\n DialogClose as DialogClosePrimitive,\r\n type DialogProps as DialogPrimitiveProps,\r\n type DialogPopupProps as DialogPopupPrimitiveProps,\r\n type DialogDescriptionProps as DialogDescriptionPrimitiveProps,\r\n type DialogFooterProps as DialogFooterPrimitiveProps,\r\n type DialogHeaderProps as DialogHeaderPrimitiveProps,\r\n type DialogTitleProps as DialogTitlePrimitiveProps,\r\n type DialogTriggerProps as DialogTriggerPrimitiveProps,\r\n type DialogBackdropProps as DialogBackdropPrimitiveProps,\r\n type DialogCloseProps as DialogClosePrimitiveProps,\r\n} from '../primitives/dialog';\r\nimport { cn } from '@xploreu/lib/cn';\r\n\r\ntype DialogProps = DialogPrimitiveProps;\r\n\r\nfunction Dialog(props: DialogProps) {\r\n return <DialogPrimitive {...props} />;\r\n}\r\n\r\ntype DialogTriggerProps = DialogTriggerPrimitiveProps;\r\n\r\nfunction DialogTrigger(props: DialogTriggerProps) {\r\n return <DialogTriggerPrimitive {...props} />;\r\n}\r\n\r\ntype DialogCloseProps = DialogClosePrimitiveProps;\r\n\r\nfunction DialogClose(props: DialogCloseProps) {\r\n return <DialogClosePrimitive {...props} />;\r\n}\r\n\r\ntype DialogBackdropProps = DialogBackdropPrimitiveProps;\r\n\r\nfunction DialogBackdrop({ className, ...props }: DialogBackdropProps) {\r\n return (\r\n <DialogBackdropPrimitive\r\n className={cn('fixed inset-0 z-50 bg-black/50 backdrop-blur-sm', className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\ntype DialogPopupProps = DialogPopupPrimitiveProps & {\r\n showCloseButton?: boolean;\r\n closeClassName?: string;\r\n};\r\n\r\nfunction DialogPopup({\r\n className,\r\n children,\r\n showCloseButton = true,\r\n closeClassName,\r\n ...props\r\n}: DialogPopupProps) {\r\n return (\r\n <DialogPortalPrimitive>\r\n <DialogBackdrop />\r\n <DialogPopupPrimitive\r\n className={cn(\r\n \"fixed left-[50%] top-[50%] z-50 grid w-[calc(100%-2rem)] max-w-lg translate-x-[-50%] translate-y-[-50%] bg-bg-primary shadow-xp-lg rounded-xl overflow-hidden\",\r\n className,\r\n )}\r\n {...props}\r\n >\r\n {children}\r\n {showCloseButton && (\r\n <DialogClosePrimitive\r\n className={cn(\r\n \"data-[state=open]:bg-bg-primary data-[state=open]:text-text-primary absolute top-3 right-4 rounded-xs transition-colors hover:text-text-error-primary-hover disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4\",\r\n closeClassName\r\n )}\r\n >\r\n <XIcon />\r\n <span className=\"sr-only\">Close</span>\r\n </DialogClosePrimitive>\r\n )}\r\n </DialogPopupPrimitive>\r\n </DialogPortalPrimitive>\r\n );\r\n}\r\n\r\ntype DialogHeaderProps = DialogHeaderPrimitiveProps;\r\n\r\nfunction DialogHeader({ className, ...props }: DialogHeaderProps) {\r\n return (\r\n <DialogHeaderPrimitive\r\n className={cn(\"relative px-4 py-3 flex flex-col bg-bg-primary border-b border-border-tertiary bg-radial-[100%_200%_at_0%_0%] from-modal-dialog-stop-0 to-bg-primary has-[[data-slot=dialog-icon]]:pl-16\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\ntype DialogContentProps = React.HTMLAttributes<HTMLDivElement>;\r\n\r\nfunction DialogContent({ className, ...props }: DialogContentProps) {\r\n return (\r\n <div\r\n data-slot=\"dialog-content\"\r\n className={cn(\"px-4 py-4 max-h-[60vh] overflow-y-auto\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\ntype DialogFooterProps = DialogFooterPrimitiveProps;\r\n\r\nfunction DialogFooter({ className, ...props }: DialogFooterProps) {\r\n return (\r\n <DialogFooterPrimitive\r\n className={cn(\r\n \"flex gap-2 items-center justify-end bg-bg-primary border-t border-border-tertiary px-4 py-3 shadow-[0px_-1px_24px_0px_var(--color-shadow-xs)] peer-[[data-slot=dialog-content]]:border-0\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\ntype DialogTitleProps = DialogTitlePrimitiveProps;\r\n\r\nfunction DialogTitle({ className, ...props }: DialogTitleProps) {\r\n return (\r\n <DialogTitlePrimitive\r\n className={cn(\"text-label-bold-2 text-text-primary\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\ntype DialogDescriptionProps = DialogDescriptionPrimitiveProps;\r\n\r\nfunction DialogDescription({ className, ...props }: DialogDescriptionProps) {\r\n return (\r\n <DialogDescriptionPrimitive\r\n className={cn(\"mt-0.5 text-body-regular-3 text-text-secondary\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nfunction DialogIcon({ className, ...props }: React.ComponentProps<\"div\">) {\r\n return (\r\n <div\r\n data-slot=\"dialog-icon\"\r\n className={cn(\"absolute top-[13px] left-4 flex items-center justify-center rounded-lg bg-bg-primary p-2.5 [&_svg]:size-4 bg-bg-brand-solid text-fg-white shadow-[0px_1px_2px_-1px_var(--color-shadow-lg-01),0px_1px_3px_0px_var(--color-shadow-md-01),0px_0px_0px_4px_var(--color-focus-ring-secondary)]\", className)}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\nexport {\r\n Dialog,\r\n DialogTrigger,\r\n DialogClose,\r\n DialogPopup,\r\n DialogHeader,\r\n DialogContent,\r\n DialogFooter,\r\n DialogTitle,\r\n DialogDescription,\r\n DialogIcon,\r\n type DialogProps,\r\n type DialogTriggerProps,\r\n type DialogCloseProps,\r\n type DialogPopupProps,\r\n type DialogHeaderProps,\r\n type DialogContentProps,\r\n type DialogFooterProps,\r\n type DialogTitleProps,\r\n type DialogDescriptionProps,\r\n};"]}
@@ -1,2 +0,0 @@
1
- import {b,c as c$1}from'./chunk-2XZRLJCN.js';import*as x from'react';import {Combobox}from'@base-ui/react/combobox';import {AnimatePresence,motion}from'motion/react';import {useControlledState}from'@xploreu/hooks/use-controlled-state';import {useDataState}from'@xploreu/hooks/use-data-state';import {getStrictContext}from'@xploreu/lib/get-strict-context';import {jsx}from'react/jsx-runtime';var [V,L]=getStrictContext("ComboboxContext"),[H,c]=getStrictContext("ComboboxActiveValueContext");function M({behavior:o="default",...b}){let[p,i]=useControlledState({value:b?.open,defaultValue:b?.defaultOpen,onChange:b?.onOpenChange}),[a,m]=useControlledState({value:b?.inputValue?.toString(),defaultValue:b?.defaultInputValue?.toString(),onChange:b?.onInputValueChange}),[n,h]=x.useState(null),g=(s,r)=>{if(r.reason==="input-clear")return r.cancel();m(s,r);},d=(s,r)=>{let y=r.trigger?.dataset;if(o==="chip-outside"&&(r.reason==="trigger-press"&&y?.slot==="combobox-clear-input"&&!s||r.reason==="item-press"))return r.cancel();i(s,r);};return jsx(H,{value:{highlightedValue:n,setHighlightedValue:h},children:jsx(V,{value:{open:p,setOpen:i,inputValue:a,setInputValue:m},children:jsx(Combobox.Root,{"data-slot":"combobox",...b,onInputValueChange:g,onOpenChange:d})})})}function k(o){return jsx(Combobox.Trigger,{"data-slot":"combobox-trigger",...o})}function E(o){return jsx(Combobox.Label,{"data-slot":"combobox-label",...o})}function O(o){return jsx(Combobox.InputGroup,{"data-slot":"combobox-input-group",...o})}function B(o){return jsx(Combobox.Input,{"data-slot":"combobox-input",...o})}function F(o){return jsx(Combobox.Icon,{"data-slot":"combobox-icon",...o})}function q(o){return jsx(Combobox.Clear,{"data-slot":"combobox-clear",...o})}function z(o){return jsx(Combobox.Value,{"data-slot":"combobox-value",...o})}function J(o){return jsx(Combobox.Chips,{"data-slot":"combobox-chips",...o})}function K(o){return jsx(Combobox.Chip,{"data-slot":"combobox-chip",...o})}function N(o){return jsx(Combobox.ChipRemove,{"data-slot":"combobox-chip-remove",...o})}function Q(o){let{open:b}=L();return jsx(AnimatePresence,{children:b&&jsx(Combobox.Portal,{"data-slot":"combobox-portal",keepMounted:true,...o})})}function U(o){return jsx(Combobox.Positioner,{"data-slot":"combobox-positioner",...o})}function W({initialFocus:o,finalFocus:b,transition:p={type:"spring",stiffness:300,damping:25},...i}){return jsx(Combobox.Popup,{finalFocus:b,initialFocus:o,render:jsx(motion.div,{animate:{opacity:1,scale:1},"data-slot":"combobox-popup",exit:{opacity:0,scale:.5},initial:{opacity:0,scale:.5},transition:p,...i},"combobox-popup")})}function X(o){return jsx(Combobox.Backdrop,{"data-slot":"combobox-backdrop",...o})}function Y(o){return jsx(Combobox.Status,{"data-slot":"combobox-status",...o})}function Z(o){return jsx(Combobox.Empty,{"data-slot":"combobox-empty",...o})}function _(o){return jsx(Combobox.List,{"data-slot":"combobox-list",...o})}function $({transition:o={type:"spring",stiffness:350,damping:35},...b$1}){let{highlightedValue:p}=c();return jsx(b,{click:false,controlledItems:true,"data-slot":"combobox-highlight",transition:o,value:p,...b$1})}function j(o){return jsx(c$1,{"data-slot":"combobox-highlight-item",...o})}function D(o){return jsx(Combobox.Row,{"data-slot":"combobox-row",...o})}function oo(o){let{setHighlightedValue:b}=c(),[,p]=useDataState("highlighted",void 0,(i,a)=>{if(i===true){let m=a.current,n=m?.dataset.value||m?.id||null;n&&b(n);}});return jsx(Combobox.Item,{ref:p,"data-slot":"combobox-item",...o})}function to(o){return jsx(Combobox.ItemIndicator,{"data-slot":"combobox-item-indicator",...o})}function eo(o){return jsx(Combobox.Separator,{"data-slot":"combobox-separator",...o})}function bo(o){return jsx(Combobox.Group,{"data-slot":"combobox-group",...o})}function ro(o){return jsx(Combobox.GroupLabel,{"data-slot":"combobox-group-label",...o})}function po(o){return jsx(Combobox.Collection,{"data-slot":"combobox-collection",...o})}function io(o){return jsx(Combobox.Arrow,{"data-slot":"combobox-arrow",...o})}export{bo as A,ro as B,po as C,io as D,L as a,c as b,M as c,k as d,E as e,O as f,B as g,F as h,q as i,z as j,J as k,K as l,N as m,Q as n,U as o,W as p,X as q,Y as r,Z as s,_ as t,$ as u,j as v,D as w,oo as x,to as y,eo as z};//# sourceMappingURL=chunk-JILBFCPY.js.map
2
- //# sourceMappingURL=chunk-JILBFCPY.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/primitives/combobox.tsx"],"names":["ComboboxProvider","useCombobox","getStrictContext","ComboboxActiveValueProvider","useComboboxActiveValue","Combobox","behavior","props","open","setOpen","useControlledState","inputValue","setInputValue","highlightedValue","setHighlightedValue","handleInputValueChange","eventDetails","handleOpenChange","dataSet","jsx","ComboboxPrimitive","ComboboxTrigger","ComboboxLabel","ComboboxInputGroup","ComboboxInput","ComboboxIcon","ComboboxClear","ComboboxValue","ComboboxChips","ComboboxChip","ComboboxChipRemove","ComboboxPortal","AnimatePresence","ComboboxPositioner","ComboboxPopup","initialFocus","finalFocus","transition","motion","ComboboxBackdrop","ComboboxStatus","ComboboxEmpty","ComboboxList","ComboboxHighlight","Highlight","ComboboxHighlightItem","HighlightItem","ComboboxRow","ComboboxItem","highlightedRef","useDataState","value","ref","el","v","ComboboxItemIndicator","ComboboxSeparator","ComboboxGroup","ComboboxGroupLabel","ComboboxCollection","ComboboxArrow"],"mappings":"uYAiCA,IAAM,CAACA,CAAAA,CAAkBC,CAAW,EAClCC,gBAAAA,CAAsC,iBAAiB,EAEnD,CAACC,CAAAA,CAA6BC,CAAsB,CAAA,CACxDF,gBAAAA,CAAiD,4BAA4B,EAM/E,SAASG,CAAAA,CAA8D,CACrE,SAAAC,CAAAA,CAAW,SAAA,CACX,GAAGC,CACL,CAAA,CAAmC,CACjC,GAAM,CAACC,EAAMC,CAAO,CAAA,CAAIC,mBAAmB,CACzC,KAAA,CAAOH,GAAO,IAAA,CACd,YAAA,CAAcA,GAAO,WAAA,CACrB,QAAA,CAAUA,CAAAA,EAAO,YACnB,CAAC,CAAA,CAEK,CAACI,EAAYC,CAAa,CAAA,CAAIF,mBAAmB,CACrD,KAAA,C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AM,CAClB,IAAME,CAAAA,CAAKD,CAAAA,CAAI,QACTE,CAAAA,CAAID,CAAAA,EAAI,OAAA,CAAQ,KAAA,EAASA,GAAI,EAAA,EAAM,IAAA,CACrCC,GAAGxC,CAAAA,CAAoBwC,CAAC,EAC9B,CACF,CACF,EAEA,OAAOnC,GAAAA,CAACC,SAAkB,IAAA,CAAlB,CACN,IAAK6B,CAAAA,CACL,WAAA,CAAU,gBACT,GAAG1C,CAAAA,CACN,CACF,CAIA,SAASgD,EAAAA,CAAsBhD,CAAAA,CAAmC,CAChE,OAAOY,GAAAA,CAACC,SAAkB,aAAA,CAAlB,CACN,YAAU,yBAAA,CACT,GAAGb,EACN,CACF,CAIA,SAASiD,EAAAA,CAAkBjD,CAAAA,CAA+B,CACxD,OAAOY,GAAAA,CAACC,QAAAA,CAAkB,SAAA,CAAlB,CACN,WAAA,CAAU,oBAAA,CACT,GAAGb,CAAAA,CACN,CACF,CAIA,SAASkD,EAAAA,CAAclD,EAA2B,CAChD,OAAOY,IAACC,QAAAA,CAAkB,KAAA,CAAlB,CACN,WAAA,CAAU,gBAAA,CACT,GAAGb,CAAAA,CACN,CACF,CAIA,SAASmD,GAAmBnD,CAAAA,CAAgC,CAC1D,OAAOY,GAAAA,CAACC,QAAAA,CAAkB,WAAlB,CACN,WAAA,CAAU,uBACT,GAAGb,CAAAA,CACN,CACF,CAIA,SAASoD,GAAmBpD,CAAAA,CAAgC,CAC1D,OAAOY,GAAAA,CAACC,QAAAA,CAAkB,UAAA,CAAlB,CACN,YAAU,qBAAA,CACT,GAAGb,EACN,CACF,CAIA,SAASqD,EAAAA,CAAcrD,CAAAA,CAA2B,CAChD,OAAOY,GAAAA,CAACC,SAAkB,KAAA,CAAlB,CACN,YAAU,gBAAA,CACT,GAAGb,EACN,CACF","file":"chunk-JILBFCPY.js","sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\n\r\nimport { Combobox as ComboboxPrimitive } from \"@base-ui/react/combobox\"\r\nimport {\r\n AnimatePresence,\r\n type HTMLMotionProps,\r\n motion\r\n} from \"motion/react\"\r\n\r\nimport {\r\n Highlight,\r\n HighlightItem,\r\n type HighlightItemProps,\r\n type HighlightProps,\r\n} from \"../effects/highlight\"\r\nimport { useControlledState } from \"@xploreu/hooks/use-controlled-state\"\r\nimport { useDataState } from \"@xploreu/hooks/use-data-state\"\r\nimport { getStrictContext } from \"@xploreu/lib/get-strict-context\"\r\n\r\ntype ComboboxContextType = {\r\n open: boolean;\r\n setOpen: (open: boolean, eventDetails: ComboboxPrimitive.Root.ChangeEventDetails) => void;\r\n inputValue: string;\r\n setInputValue: (inputValue: string, eventDetails: ComboboxPrimitive.Root.ChangeEventDetails) => void;\r\n}\r\n\r\ntype ComboboxActiveValueContextType = {\r\n highlightedValue: string | null;\r\n setHighlightedValue: (value: string | null) => void;\r\n}\r\n\r\nconst [ComboboxProvider, useCombobox] =\r\n getStrictContext<ComboboxContextType>(\"ComboboxContext\")\r\n\r\nconst [ComboboxActiveValueProvider, useComboboxActiveValue] =\r\n getStrictContext<ComboboxActiveValueContextType>(\"ComboboxActiveValueContext\")\r\n\r\ntype ComboboxProps<Value, Multiple extends boolean | undefined = false> = ComboboxPrimitive.Root.Props<Value, Multiple> & {\r\n behavior?: \"default\" | \"chip-outside\";\r\n}\r\n\r\nfunction Combobox<Value, Multiple extends boolean | undefined = false>({\r\n behavior = \"default\",\r\n ...props\r\n}: ComboboxProps<Value, Multiple>) {\r\n const [open, setOpen] = useControlledState({\r\n value: props?.open,\r\n defaultValue: props?.defaultOpen,\r\n onChange: props?.onOpenChange,\r\n })\r\n\r\n const [inputValue, setInputValue] = useControlledState({\r\n value: props?.inputValue?.toString(),\r\n defaultValue: props?.defaultInputValue?.toString(),\r\n onChange: props?.onInputValueChange,\r\n })\r\n\r\n const [highlightedValue, setHighlightedValue] = React.useState<string | null>(null)\r\n\r\n const handleInputValueChange: ComboboxProps<Value, Multiple>[\"onInputValueChange\"] = (inputValue, eventDetails) => {\r\n // if the input is cleared, we want to cancel the event to prevent resetting the input value.\r\n if (eventDetails.reason === \"input-clear\") return eventDetails.cancel()\r\n\r\n setInputValue(inputValue, eventDetails)\r\n }\r\n\r\n const handleOpenChange: ComboboxProps<Value, Multiple>[\"onOpenChange\"] = (open, eventDetails) => {\r\n const dataSet = (eventDetails.trigger as HTMLElement)?.dataset\r\n\r\n\r\n if (behavior === \"chip-outside\") {\r\n if (\r\n eventDetails.reason === \"trigger-press\" &&\r\n dataSet?.slot === \"combobox-clear-input\" &&\r\n !open\r\n ) {\r\n return eventDetails.cancel()\r\n }\r\n\r\n if (eventDetails.reason === \"item-press\") {\r\n return eventDetails.cancel()\r\n }\r\n }\r\n\r\n setOpen(open, eventDetails)\r\n }\r\n\r\n return (\r\n <ComboboxActiveValueProvider value={{ highlightedValue, setHighlightedValue }}>\r\n <ComboboxProvider value={{ open, setOpen, inputValue, setInputValue }}>\r\n <ComboboxPrimitive.Root\r\n data-slot=\"combobox\"\r\n {...props}\r\n onInputValueChange={handleInputValueChange}\r\n onOpenChange={handleOpenChange}\r\n />\r\n </ComboboxProvider>\r\n </ComboboxActiveValueProvider>\r\n )\r\n}\r\n\r\ntype ComboboxTriggerProps = ComboboxPrimitive.Trigger.Props\r\n\r\nfunction ComboboxTrigger(props: ComboboxTriggerProps) {\r\n return <ComboboxPrimitive.Trigger\r\n data-slot=\"combobox-trigger\"\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxLabelProps = ComboboxPrimitive.Label.Props\r\n\r\nfunction ComboboxLabel(props: ComboboxLabelProps) {\r\n return <ComboboxPrimitive.Label\r\n data-slot=\"combobox-label\"\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxInputGroupProps = ComboboxPrimitive.InputGroup.Props\r\n\r\nfunction ComboboxInputGroup(props: ComboboxInputGroupProps) {\r\n return <ComboboxPrimitive.InputGroup\r\n data-slot=\"combobox-input-group\"\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxInputProps = ComboboxPrimitive.Input.Props\r\n\r\nfunction ComboboxInput(props: ComboboxInputProps) {\r\n return <ComboboxPrimitive.Input\r\n data-slot=\"combobox-input\"\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxIconProps = ComboboxPrimitive.Icon.Props\r\n\r\nfunction ComboboxIcon(props: ComboboxIconProps) {\r\n return <ComboboxPrimitive.Icon\r\n data-slot=\"combobox-icon\"\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxClearProps = ComboboxPrimitive.Clear.Props\r\n\r\nfunction ComboboxClear(props: ComboboxClearProps) {\r\n return <ComboboxPrimitive.Clear\r\n data-slot=\"combobox-clear\"\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxValueProps = ComboboxPrimitive.Value.Props\r\n\r\nfunction ComboboxValue(props: ComboboxValueProps) {\r\n return <ComboboxPrimitive.Value\r\n data-slot=\"combobox-value\"\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxChipsProps = ComboboxPrimitive.Chips.Props\r\n\r\nfunction ComboboxChips(props: ComboboxChipsProps) {\r\n return <ComboboxPrimitive.Chips\r\n data-slot=\"combobox-chips\"\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxChipProps = ComboboxPrimitive.Chip.Props\r\n\r\nfunction ComboboxChip(props: ComboboxChipProps) {\r\n return <ComboboxPrimitive.Chip\r\n data-slot=\"combobox-chip\"\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxChipRemoveProps = ComboboxPrimitive.ChipRemove.Props\r\n\r\nfunction ComboboxChipRemove(props: ComboboxChipRemoveProps) {\r\n return <ComboboxPrimitive.ChipRemove\r\n data-slot=\"combobox-chip-remove\"\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxPortalProps = Omit<\r\n ComboboxPrimitive.Portal.Props,\r\n \"keepMounted\"\r\n>\r\n\r\nfunction ComboboxPortal(props: ComboboxPortalProps) {\r\n const { open } = useCombobox()\r\n\r\n return (\r\n <AnimatePresence>\r\n {open && (\r\n <ComboboxPrimitive.Portal\r\n data-slot=\"combobox-portal\"\r\n keepMounted\r\n {...props}\r\n />\r\n )}\r\n </AnimatePresence>\r\n )\r\n}\r\n\r\ntype ComboboxPositionerProps = ComboboxPrimitive.Positioner.Props\r\n\r\nfunction ComboboxPositioner(props: ComboboxPositionerProps) {\r\n return (\r\n <ComboboxPrimitive.Positioner\r\n data-slot=\"combobox-positioner\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxPopupProps = Omit<\r\n ComboboxPrimitive.Popup.Props,\r\n \"render\"\r\n> &\r\n HTMLMotionProps<\"div\">\r\n\r\nfunction ComboboxPopup({\r\n initialFocus,\r\n finalFocus,\r\n transition = { type: \"spring\", stiffness: 300, damping: 25 },\r\n ...props\r\n}: ComboboxPopupProps) {\r\n return (\r\n <ComboboxPrimitive.Popup\r\n finalFocus={finalFocus}\r\n initialFocus={initialFocus}\r\n render={\r\n <motion.div\r\n key=\"combobox-popup\"\r\n animate={{ opacity: 1, scale: 1 }}\r\n data-slot=\"combobox-popup\"\r\n exit={{ opacity: 0, scale: 0.5 }}\r\n initial={{ opacity: 0, scale: 0.5 }}\r\n transition={transition}\r\n {...props}\r\n />\r\n }\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxBackdropProps = ComboboxPrimitive.Backdrop.Props\r\n\r\nfunction ComboboxBackdrop(props: ComboboxBackdropProps) {\r\n return <ComboboxPrimitive.Backdrop\r\n data-slot=\"combobox-backdrop\"\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxStatusProps = ComboboxPrimitive.Status.Props\r\n\r\nfunction ComboboxStatus(props: ComboboxStatusProps) {\r\n return <ComboboxPrimitive.Status\r\n data-slot=\"combobox-status\"\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxEmptyProps = ComboboxPrimitive.Empty.Props\r\n\r\nfunction ComboboxEmpty(props: ComboboxEmptyProps) {\r\n return <ComboboxPrimitive.Empty\r\n data-slot=\"combobox-empty\"\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxListProps = ComboboxPrimitive.List.Props\r\n\r\nfunction ComboboxList(props: ComboboxListProps) {\r\n return <ComboboxPrimitive.List\r\n data-slot=\"combobox-list\"\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxHighlightProps = Omit<\r\n HighlightProps,\r\n \"controlledItems\" | \"enabled\" | \"hover\"\r\n>\r\n\r\nfunction ComboboxHighlight({\r\n transition = { type: \"spring\", stiffness: 350, damping: 35 },\r\n ...props\r\n}: ComboboxHighlightProps) {\r\n const { highlightedValue } = useComboboxActiveValue()\r\n\r\n return (\r\n <Highlight\r\n click={false}\r\n controlledItems\r\n data-slot=\"combobox-highlight\"\r\n transition={transition}\r\n value={highlightedValue}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxHighlightItemProps = HighlightItemProps\r\n\r\nfunction ComboboxHighlightItem(props: ComboboxHighlightItemProps) {\r\n return (\r\n <HighlightItem\r\n data-slot=\"combobox-highlight-item\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxRowProps = ComboboxPrimitive.Row.Props\r\n\r\nfunction ComboboxRow(props: ComboboxRowProps) {\r\n return <ComboboxPrimitive.Row\r\n data-slot=\"combobox-row\"\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxItemProps = ComboboxPrimitive.Item.Props\r\n\r\nfunction ComboboxItem(props: ComboboxItemProps) {\r\n const { setHighlightedValue } = useComboboxActiveValue()\r\n const [, highlightedRef] = useDataState<HTMLDivElement>(\r\n \"highlighted\",\r\n undefined,\r\n (value, ref) => {\r\n if (value === true) {\r\n const el = ref.current\r\n const v = el?.dataset.value || el?.id || null\r\n if (v) setHighlightedValue(v)\r\n }\r\n },\r\n )\r\n\r\n return <ComboboxPrimitive.Item\r\n ref={highlightedRef}\r\n data-slot=\"combobox-item\"\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxItemIndicatorProps = ComboboxPrimitive.ItemIndicator.Props\r\n\r\nfunction ComboboxItemIndicator(props: ComboboxItemIndicatorProps) {\r\n return <ComboboxPrimitive.ItemIndicator\r\n data-slot=\"combobox-item-indicator\"\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxSeparatorProps = ComboboxPrimitive.Separator.Props\r\n\r\nfunction ComboboxSeparator(props: ComboboxSeparatorProps) {\r\n return <ComboboxPrimitive.Separator\r\n data-slot=\"combobox-separator\"\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxGroupProps = ComboboxPrimitive.Group.Props\r\n\r\nfunction ComboboxGroup(props: ComboboxGroupProps) {\r\n return <ComboboxPrimitive.Group\r\n data-slot=\"combobox-group\"\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxGroupLabelProps = ComboboxPrimitive.GroupLabel.Props\r\n\r\nfunction ComboboxGroupLabel(props: ComboboxGroupLabelProps) {\r\n return <ComboboxPrimitive.GroupLabel\r\n data-slot=\"combobox-group-label\"\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxCollectionProps = ComboboxPrimitive.Collection.Props\r\n\r\nfunction ComboboxCollection(props: ComboboxCollectionProps) {\r\n return <ComboboxPrimitive.Collection\r\n data-slot=\"combobox-collection\"\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxArrowProps = ComboboxPrimitive.Arrow.Props\r\n\r\nfunction ComboboxArrow(props: ComboboxArrowProps) {\r\n return <ComboboxPrimitive.Arrow\r\n data-slot=\"combobox-arrow\"\r\n {...props}\r\n />\r\n}\r\n\r\nexport {\r\n Combobox,\r\n type ComboboxActiveValueContextType,\r\n ComboboxArrow,\r\n type ComboboxArrowProps,\r\n ComboboxBackdrop,\r\n type ComboboxBackdropProps,\r\n ComboboxChip,\r\n type ComboboxChipProps,\r\n ComboboxChipRemove,\r\n type ComboboxChipRemoveProps,\r\n ComboboxChips,\r\n type ComboboxChipsProps,\r\n ComboboxClear,\r\n type ComboboxClearProps,\r\n ComboboxCollection,\r\n type ComboboxCollectionProps,\r\n type ComboboxContextType,\r\n ComboboxEmpty,\r\n type ComboboxEmptyProps,\r\n ComboboxGroup,\r\n ComboboxGroupLabel,\r\n type ComboboxGroupLabelProps,\r\n type ComboboxGroupProps,\r\n ComboboxHighlight,\r\n ComboboxHighlightItem,\r\n type ComboboxHighlightItemProps,\r\n type ComboboxHighlightProps,\r\n ComboboxIcon,\r\n type ComboboxIconProps,\r\n ComboboxInput,\r\n ComboboxInputGroup,\r\n type ComboboxInputGroupProps,\r\n type ComboboxInputProps,\r\n ComboboxItem,\r\n ComboboxItemIndicator,\r\n type ComboboxItemIndicatorProps,\r\n type ComboboxItemProps,\r\n ComboboxLabel,\r\n type ComboboxLabelProps,\r\n ComboboxList,\r\n type ComboboxListProps,\r\n ComboboxPopup,\r\n type ComboboxPopupProps,\r\n ComboboxPortal,\r\n type ComboboxPortalProps,\r\n ComboboxPositioner,\r\n type ComboboxPositionerProps,\r\n type ComboboxProps,\r\n ComboboxRow,\r\n type ComboboxRowProps,\r\n ComboboxSeparator,\r\n type ComboboxSeparatorProps,\r\n ComboboxStatus,\r\n type ComboboxStatusProps,\r\n ComboboxTrigger,\r\n type ComboboxTriggerProps,\r\n ComboboxValue,\r\n type ComboboxValueProps,\r\n useCombobox,\r\n useComboboxActiveValue,\r\n}"]}
@@ -1,2 +0,0 @@
1
- import {a,b,m,e,q,s,w,x,F}from'./chunk-3VMZENNL.js';import*as r from'react';import {ChevronDownIcon}from'lucide-react';import {cn}from'@xploreu/lib/cn';import {jsxs,jsx,Fragment}from'react/jsx-runtime';function Y(o){let{items:n,placeholder:b$1="Select",icon:I,container:R,isPending:v,className:w$1,triggerClassName:L,contentClassName:k,disabled:T,infiniteScroll:P}=o,a$1=o.multiple===true,u=r.useMemo(()=>{if(a$1)return o.value;let e=o.value;return e?[e]:[]},[a$1,o.value,o.value]),$=r.useMemo(()=>{if(a$1)return o.defaultValue??[];let e=o.defaultValue;return e?[e]:[]},[a$1,o.defaultValue,o.defaultValue]),[q$1,c]=r.useState(()=>(u!==void 0?u:$)??[]);r.useEffect(()=>{u!==void 0&&c(u);},[u]);let m$1=q$1??[],s$1=m$1.length>0,[p,z]=r.useState(""),S=r.useMemo(()=>{if(!p.trim())return n;let e=p.toLowerCase();return n?.filter(l=>l.label.toLowerCase().includes(e)||l.value.toLowerCase().includes(e))},[n,p]),A=e=>{let l=e;if(a$1)c(l),o.onValueChange?.(l);else {let x=l.length>0?l[l.length-1]:null;c(x?[x]:[]),o.onValueChange?.(x);}},B=()=>{c([]),a$1?o.onValueChange?.([]):o.onValueChange?.(null);},E=r.useMemo(()=>s$1?a$1?`${b$1} (${m$1.length})`:m$1[0]?.label??b$1:a$1?`All ${b$1}`:b$1,[s$1,a$1,b$1,m$1]);return jsxs(a,{multiple:true,items:n,value:m$1,onValueChange:A,isItemEqualToValue:(e,l)=>e.value===l.value,disabled:T,children:[jsxs(b,{className:cn("group flex h-9 w-fit max-w-[220px] items-center gap-2 rounded-xp-card-base border bg-bg-primary px-3 text-body-medium-3 transition-colors","border-border-primary text-text-secondary hover:bg-bg-primary-hover",s$1&&"border-border-brand bg-bg-brand-primary text-text-brand-secondary","disabled:pointer-events-none disabled:opacity-50","data-[popup-open]:border-border-brand data-[popup-open]:bg-bg-brand-primary data-[popup-open]:text-text-brand-secondary",L,w$1),children:[I&&jsx("span",{className:cn("size-4 shrink-0",s$1?"text-fg-brand-primary":"text-fg-quaternary"),children:I}),jsx("span",{className:"truncate",children:E}),jsx(ChevronDownIcon,{className:cn("size-4 shrink-0 transition-transform group-data-[popup-open]:rotate-180",s$1?"text-fg-brand-primary":"text-fg-quaternary")})]}),jsx(m,{container:R,className:cn("w-72",k),align:"start",sideOffset:8,children:a$1?jsxs("div",{className:"flex flex-col",children:[jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border-primary",children:[jsx("span",{className:"text-label-semibold-3 text-text-primary",children:b$1}),jsxs("button",{type:"button",disabled:!s$1,onClick:B,className:cn("text-body-medium-3 transition-colors",s$1?"cursor-pointer text-text-brand-secondary hover:text-text-brand-secondary-hover":"cursor-not-allowed text-text-disabled"),children:["Clear",s$1?` (${m$1.length})`:""]})]}),jsx(e,{value:p,onChange:e=>z(e.target.value),placeholder:`Search ${b$1.toLowerCase()}...`}),jsx(q,{status:v||n===void 0?"pending":S?.length===0?"empty":null}),jsxs(s,{children:[S?.map(e=>jsx(w,{indicator:"checkbox",value:e,children:jsx(x,{children:e.label})},e.value)),jsx(F,{...P})]})]}):jsxs(Fragment,{children:[jsx(q,{status:v||n===void 0?"pending":n?.length===0?"empty":null}),jsxs(s,{children:[n?.map(e=>jsx(w,{value:e,children:jsx(x,{children:e.label})},e.value)),jsx(F,{...P})]})]})})]})}export{Y as a};//# sourceMappingURL=chunk-M73NAM5U.js.map
2
- //# sourceMappingURL=chunk-M73NAM5U.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/composites/filter-combobox.tsx"],"names":["FilterCombobox","props","items","placeholder","icon","container","isPending","className","triggerClassName","contentClassName","disabled","infiniteScroll","isMultiple","controlledArray","single","defaultArray","internalValue","setInternalValue","valueArray","hasValue","search","setSearch","filteredItems","q","it","handleValueChange","next","arr","handleClear","triggerLabel","jsxs","Combobox","a","b","ComboboxTrigger","cn","jsx","ChevronDownIcon","ComboboxPopup","ComboboxInput","ComboboxStatus","ComboboxList","item","ComboboxItem","ComboboxItemTitle","ComboboxInfiniteScroll","Fragment"],"mappings":"0MA6DA,SAASA,CAAAA,CAAeC,CAAAA,CAA4B,CAClD,GAAM,CACJ,KAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,GAAAA,CAAc,SACd,IAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,SAAA,CAAAC,GAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,QAAA,CAAAC,CAAAA,CACA,cAAA,CAAAC,CACF,CAAA,CAAIV,CAAAA,CAEEW,GAAAA,CAAaX,CAAAA,CAAM,QAAA,GAAa,IA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B,IAAAA,CAAAgB,QAAAA,CAAA,CACE,QAAA,CAAA,CAAAV,GAAAA,CAACI,CAAAA,CAAA,CACC,MAAA,CACElC,CAAAA,EAAaJ,CAAAA,GAAU,MAAA,CACnB,SAAA,CACAA,CAAAA,EAAO,MAAA,GAAW,CAAA,CAChB,OAAA,CACA,KAEV,CAAA,CACA4B,IAAAA,CAACW,CAAAA,CAAA,CACE,QAAA,CAAA,CAAAvC,CAAAA,EAAO,GAAA,CAAKwC,CAAAA,EACXN,GAAAA,CAACO,CAAAA,CAAA,CAA8B,KAAA,CAAOD,CAAAA,CACpC,QAAA,CAAAN,GAAAA,CAACQ,CAAAA,CAAA,CACE,QAAA,CAAAF,CAAAA,CAAK,KAAA,CACR,CAAA,CAAA,CAHiBA,CAAAA,CAAK,KAIxB,CACD,CAAA,CACDN,GAAAA,CAACS,CAAAA,CAAA,CAAwB,GAAGlC,CAAAA,CAAgB,CAAA,CAAA,CAC9C,CAAA,CAAA,CACF,CAAA,CAEJ,GACF,CAEJ","file":"chunk-M73NAM5U.js","sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\nimport { CheckCircle2Icon, ChevronDownIcon, SearchIcon } from \"lucide-react\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport {\r\n ComboboxItemIndicator as ComboboxItemIndicatorPrimitive\r\n} from \"../primitives/combobox\"\r\nimport { ComboboxHighlightItem, ComboboxItem, ComboboxItemTitle } from \"../ui/combobox\"\r\nimport { Input } from \"../ui/input\"\r\nimport {\r\n Combobox,\r\n ComboboxInfiniteScroll,\r\n ComboboxInput,\r\n ComboboxList,\r\n ComboboxPopup,\r\n ComboboxPortal,\r\n ComboboxStatus,\r\n ComboboxTrigger,\r\n type ComboboxProps,\r\n} from \"../ui/combobox\"\r\n\r\n// ─── Types ───\r\n\r\nexport type FilterComboboxItem = {\r\n label: string\r\n value: string\r\n}\r\n\r\ntype BaseProps = {\r\n items: FilterComboboxItem[] | undefined\r\n placeholder?: string\r\n icon?: React.ReactNode\r\n container?: React.ComponentProps<typeof ComboboxPortal>[\"container\"]\r\n isPending?: boolean\r\n className?: string\r\n triggerClassName?: string\r\n contentClassName?: string\r\n disabled?: boolean\r\n infiniteScroll?: React.ComponentProps<typeof ComboboxInfiniteScroll>\r\n}\r\n\r\ntype SingleProps = BaseProps & {\r\n multiple?: false\r\n value?: FilterComboboxItem | null\r\n defaultValue?: FilterComboboxItem | null\r\n onValueChange?: (value: FilterComboboxItem | null) => void\r\n}\r\n\r\ntype MultipleProps = BaseProps & {\r\n multiple: true\r\n value?: FilterComboboxItem[]\r\n defaultValue?: FilterComboboxItem[]\r\n onValueChange?: (value: FilterComboboxItem[]) => void\r\n}\r\n\r\nexport type FilterComboboxProps = SingleProps | MultipleProps\r\n\r\n// ─── Component ───\r\n\r\nfunction FilterCombobox(props: FilterComboboxProps) {\r\n const {\r\n items,\r\n placeholder = \"Select\",\r\n icon,\r\n container,\r\n isPending,\r\n className,\r\n triggerClassName,\r\n contentClassName,\r\n disabled,\r\n infiniteScroll,\r\n } = props\r\n\r\n const isMultiple = props.multiple === true\r\n\r\n // Normalize controlled value to array for internal combobox (always multiple=true internally)\r\n const controlledArray = React.useMemo(() => {\r\n if (isMultiple) {\r\n return (props as MultipleProps).value\r\n }\r\n const single = (props as SingleProps).value\r\n return single ? [single] : []\r\n }, [isMultiple, (props as SingleProps).value, (props as MultipleProps).value])\r\n\r\n const defaultArray = React.useMemo(() => {\r\n if (isMultiple) {\r\n return (props as MultipleProps).defaultValue ?? []\r\n }\r\n const single = (props as SingleProps).defaultValue\r\n return single ? [single] : []\r\n }, [isMultiple, (props as SingleProps).defaultValue, (props as MultipleProps).defaultValue])\r\n\r\n const [internalValue, setInternalValue] = React.useState<FilterComboboxItem[]>(\r\n () =>\r\n (controlledArray !== undefined\r\n ? (controlledArray as FilterComboboxItem[])\r\n : (defaultArray as FilterComboboxItem[])) ?? []\r\n )\r\n\r\n // Sync when controlled value changes externally\r\n React.useEffect(() => {\r\n if (controlledArray !== undefined) {\r\n setInternalValue(controlledArray as FilterComboboxItem[])\r\n }\r\n }, [controlledArray])\r\n\r\n const valueArray = internalValue ?? []\r\n const hasValue = valueArray.length > 0\r\n\r\n // Search for multiple variant\r\n const [search, setSearch] = React.useState(\"\")\r\n\r\n const filteredItems = React.useMemo(() => {\r\n if (!search.trim()) return items\r\n const q = search.toLowerCase()\r\n return items?.filter(\r\n (it) => it.label.toLowerCase().includes(q) || it.value.toLowerCase().includes(q)\r\n )\r\n }, [items, search])\r\n\r\n const handleValueChange: ComboboxProps<FilterComboboxItem, boolean>[\"onValueChange\"] = (\r\n next\r\n ) => {\r\n const arr = next as FilterComboboxItem[]\r\n if (isMultiple) {\r\n setInternalValue(arr)\r\n ; (props as MultipleProps).onValueChange?.(arr)\r\n } else {\r\n // single: take last selected (base-ui gives array)\r\n const single = arr.length > 0 ? arr[arr.length - 1] : null\r\n const normalized = single ? [single] : []\r\n setInternalValue(normalized)\r\n ; (props as SingleProps).onValueChange?.(single)\r\n }\r\n }\r\n\r\n const handleClear = () => {\r\n setInternalValue([])\r\n if (isMultiple) {\r\n ; (props as MultipleProps).onValueChange?.([])\r\n } else {\r\n ; (props as SingleProps).onValueChange?.(null)\r\n }\r\n }\r\n\r\n // Trigger label\r\n const triggerLabel = React.useMemo(() => {\r\n if (!hasValue) {\r\n return isMultiple ? `All ${placeholder}` : placeholder\r\n }\r\n if (isMultiple) {\r\n return `${placeholder} (${valueArray.length})`\r\n }\r\n return valueArray[0]?.label ?? placeholder\r\n }, [hasValue, isMultiple, placeholder, valueArray])\r\n\r\n return (\r\n <Combobox\r\n multiple\r\n items={items}\r\n value={valueArray}\r\n onValueChange={handleValueChange}\r\n isItemEqualToValue={(a, b) => a.value === b.value}\r\n disabled={disabled}\r\n >\r\n <ComboboxTrigger\r\n className={cn(\r\n \"group flex h-9 w-fit max-w-[220px] items-center gap-2 rounded-xp-card-base border bg-bg-primary px-3 text-body-medium-3 transition-colors\",\r\n \"border-border-primary text-text-secondary hover:bg-bg-primary-hover\",\r\n hasValue && \"border-border-brand bg-bg-brand-primary text-text-brand-secondary\",\r\n \"disabled:pointer-events-none disabled:opacity-50\",\r\n \"data-[popup-open]:border-border-brand data-[popup-open]:bg-bg-brand-primary data-[popup-open]:text-text-brand-secondary\",\r\n triggerClassName,\r\n className\r\n )}\r\n >\r\n {icon && (\r\n <span\r\n className={cn(\r\n \"size-4 shrink-0\",\r\n hasValue ? \"text-fg-brand-primary\" : \"text-fg-quaternary\"\r\n )}\r\n >\r\n {icon}\r\n </span>\r\n )}\r\n <span className=\"truncate\">{triggerLabel}</span>\r\n <ChevronDownIcon\r\n className={cn(\r\n \"size-4 shrink-0 transition-transform group-data-[popup-open]:rotate-180\",\r\n hasValue ? \"text-fg-brand-primary\" : \"text-fg-quaternary\"\r\n )}\r\n />\r\n </ComboboxTrigger>\r\n\r\n <ComboboxPopup\r\n container={container}\r\n className={cn(\"w-72\", contentClassName)}\r\n align=\"start\"\r\n sideOffset={8}\r\n >\r\n {isMultiple ? (\r\n <div className=\"flex flex-col\">\r\n {/* Header: title + Clear (n) */}\r\n <div className=\"flex items-center justify-between px-3 py-2 border-b border-border-primary\">\r\n <span className=\"text-label-semibold-3 text-text-primary\">{placeholder}</span>\r\n <button\r\n type=\"button\"\r\n disabled={!hasValue}\r\n onClick={handleClear}\r\n className={cn(\r\n \"text-body-medium-3 transition-colors\",\r\n hasValue\r\n ? \"cursor-pointer text-text-brand-secondary hover:text-text-brand-secondary-hover\"\r\n : \"cursor-not-allowed text-text-disabled\"\r\n )}\r\n >\r\n Clear{hasValue ? ` (${valueArray.length})` : \"\"}\r\n </button>\r\n </div>\r\n\r\n {/* Search */}\r\n <ComboboxInput\r\n value={search}\r\n onChange={(e) => setSearch(e.target.value)}\r\n placeholder={`Search ${placeholder.toLowerCase()}...`}\r\n />\r\n\r\n {/* List */}\r\n <ComboboxStatus\r\n status={\r\n isPending || items === undefined\r\n ? \"pending\"\r\n : filteredItems?.length === 0\r\n ? \"empty\"\r\n : null\r\n }\r\n />\r\n <ComboboxList>\r\n {filteredItems?.map((item) => (\r\n <ComboboxItem indicator=\"checkbox\" key={item.value} value={item}>\r\n <ComboboxItemTitle>\r\n {item.label}\r\n </ComboboxItemTitle>\r\n </ComboboxItem>\r\n )\r\n )}\r\n <ComboboxInfiniteScroll {...infiniteScroll} />\r\n </ComboboxList>\r\n </div>\r\n ) : (\r\n <>\r\n <ComboboxStatus\r\n status={\r\n isPending || items === undefined\r\n ? \"pending\"\r\n : items?.length === 0\r\n ? \"empty\"\r\n : null\r\n }\r\n />\r\n <ComboboxList>\r\n {items?.map((item) => (\r\n <ComboboxItem key={item.value} value={item}>\r\n <ComboboxItemTitle>\r\n {item.label}\r\n </ComboboxItemTitle>\r\n </ComboboxItem>\r\n ))}\r\n <ComboboxInfiniteScroll {...infiniteScroll} />\r\n </ComboboxList>\r\n </>\r\n )}\r\n </ComboboxPopup>\r\n </Combobox>\r\n )\r\n}\r\n\r\nexport { FilterCombobox }\r\n"]}