@xploreu/components 0.4.16 → 0.4.18

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 (71) hide show
  1. package/dist/chunk-2RHSXF3X.js +2 -0
  2. package/dist/chunk-2RHSXF3X.js.map +1 -0
  3. package/dist/chunk-3C5RPQNM.js +2 -0
  4. package/dist/chunk-3C5RPQNM.js.map +1 -0
  5. package/dist/{chunk-RVQZK2AK.js → chunk-BSWTMWP5.js} +2 -2
  6. package/dist/{chunk-RVQZK2AK.js.map → chunk-BSWTMWP5.js.map} +1 -1
  7. package/dist/{chunk-FE2732UW.js → chunk-C7KUNTTO.js} +2 -2
  8. package/dist/{chunk-FE2732UW.js.map → chunk-C7KUNTTO.js.map} +1 -1
  9. package/dist/chunk-DX767LBV.js +2 -0
  10. package/dist/chunk-DX767LBV.js.map +1 -0
  11. package/dist/{chunk-R4WEEB5H.js → chunk-F2QUDOBO.js} +2 -2
  12. package/dist/{chunk-R4WEEB5H.js.map → chunk-F2QUDOBO.js.map} +1 -1
  13. package/dist/chunk-GNQKITNA.js +2 -0
  14. package/dist/chunk-GNQKITNA.js.map +1 -0
  15. package/dist/{chunk-ZWZMXZGN.js → chunk-IIFWJ2BW.js} +2 -2
  16. package/dist/{chunk-ZWZMXZGN.js.map → chunk-IIFWJ2BW.js.map} +1 -1
  17. package/dist/{chunk-YZNI5HEX.js → chunk-J6CW2XBL.js} +2 -2
  18. package/dist/{chunk-YZNI5HEX.js.map → chunk-J6CW2XBL.js.map} +1 -1
  19. package/dist/chunk-L2QE2YOM.js +2 -0
  20. package/dist/{chunk-5YDJTHDG.js.map → chunk-L2QE2YOM.js.map} +1 -1
  21. package/dist/{chunk-KYVYO45Y.js → chunk-LTSUNU7E.js} +2 -2
  22. package/dist/{chunk-KYVYO45Y.js.map → chunk-LTSUNU7E.js.map} +1 -1
  23. package/dist/{chunk-CPRMLK2G.js → chunk-NWX5WD7D.js} +2 -2
  24. package/dist/{chunk-CPRMLK2G.js.map → chunk-NWX5WD7D.js.map} +1 -1
  25. package/dist/chunk-OK4K7DSW.js +2 -0
  26. package/dist/chunk-OK4K7DSW.js.map +1 -0
  27. package/dist/{chunk-Z67QQMOX.js → chunk-VY735IE2.js} +2 -2
  28. package/dist/{chunk-Z67QQMOX.js.map → chunk-VY735IE2.js.map} +1 -1
  29. package/dist/chunk-ZNZVX4PT.js +2 -0
  30. package/dist/chunk-ZNZVX4PT.js.map +1 -0
  31. package/dist/composites/combobox-chip-outside.js +1 -1
  32. package/dist/composites/combobox-chip.js +1 -1
  33. package/dist/composites/combobox-simple.js +1 -1
  34. package/dist/composites/filter-combobox.d.ts +3 -1
  35. package/dist/composites/filter-combobox.js +1 -1
  36. package/dist/composites/index.js +1 -1
  37. package/dist/composites/phone-input.js +1 -1
  38. package/dist/composites/profile-avatar.d.ts +1 -1
  39. package/dist/primitives/combobox.js +1 -1
  40. package/dist/primitives/dialog.js +1 -1
  41. package/dist/primitives/index.d.ts +1 -1
  42. package/dist/primitives/index.js +1 -1
  43. package/dist/primitives/sheet.js +1 -1
  44. package/dist/primitives/tooltip.d.ts +20 -6
  45. package/dist/primitives/tooltip.js +1 -1
  46. package/dist/ui/badge.d.ts +3 -3
  47. package/dist/ui/button.d.ts +1 -1
  48. package/dist/ui/combobox.js +1 -1
  49. package/dist/ui/dialog.js +1 -1
  50. package/dist/ui/index.d.ts +2 -2
  51. package/dist/ui/index.js +1 -1
  52. package/dist/ui/input.d.ts +1 -1
  53. package/dist/ui/pagination.js +1 -1
  54. package/dist/ui/sheet.js +1 -1
  55. package/dist/ui/table.js +1 -1
  56. package/dist/ui/tooltip.d.ts +8 -10
  57. package/dist/ui/tooltip.js +1 -1
  58. package/package.json +108 -108
  59. package/dist/chunk-5YDJTHDG.js +0 -2
  60. package/dist/chunk-COJ4DWGS.js +0 -2
  61. package/dist/chunk-COJ4DWGS.js.map +0 -1
  62. package/dist/chunk-EL7P7FN5.js +0 -2
  63. package/dist/chunk-EL7P7FN5.js.map +0 -1
  64. package/dist/chunk-JILBFCPY.js +0 -2
  65. package/dist/chunk-JILBFCPY.js.map +0 -1
  66. package/dist/chunk-NBRMYO6B.js +0 -2
  67. package/dist/chunk-NBRMYO6B.js.map +0 -1
  68. package/dist/chunk-P6Y4P5QT.js +0 -2
  69. package/dist/chunk-P6Y4P5QT.js.map +0 -1
  70. package/dist/chunk-VHXY2BUM.js +0 -2
  71. package/dist/chunk-VHXY2BUM.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ import {c as c$1,d,e,f,g,h,b as b$1}from'./chunk-DX767LBV.js';import'react';import {cn}from'@xploreu/lib/cn';import {jsx,jsxs}from'react/jsx-runtime';function n({delay:o=0,...t}){return jsx(b$1,{delay:o,...t})}function b({delay:o=0,...t}){return jsx(n,{delay:o,children:jsx(c$1,{...t})})}function c(o){return jsx(d,{...o})}function w({className:o,sideOffset:t=8,children:a,withArrow:m=true,style:d,...v}){return jsx(e,{children:jsx(f,{sideOffset:t,className:"z-1000",...v,children:jsxs(g,{className:cn("z-50 w-fit text-balance rounded-xp-tooltip bg-bg-primary-solid px-xp-lg py-xp-md text-body-regular-3 text-text-white",o),style:d,children:[a,m&&jsx(h,{className:"z-50 size-2.5 rotate-45 rounded-xp-card-base-xxs bg-bg-primary-solid fill-primary data-[side=bottom]:-top-[5px] data-[side=top]:-bottom-[5px] data-[side=right]:-left-[5px] data-[side=left]:-right-[5px]"})]})})})}export{b as a,c as b,w as c};//# sourceMappingURL=chunk-2RHSXF3X.js.map
2
+ //# sourceMappingURL=chunk-2RHSXF3X.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ui/tooltip.tsx"],"names":["TooltipProvider","delay","props","jsx","Tooltip","TooltipTrigger","TooltipPopup","className","sideOffset","children","withArrow","style","TooltipPortal","TooltipPositioner","jsxs","cn","TooltipArrow"],"mappings":"sJAoBA,SAASA,CAAAA,CAAgB,CAAE,KAAA,CAAAC,CAAAA,CAAQ,CAAA,CAAG,G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tooltip as TooltipPrimitive,\r\n TooltipTrigger as TooltipTriggerPrimitive,\r\n TooltipPositioner as TooltipPositionerPrimitive,\r\n TooltipPopup as TooltipPopupPrimitive,\r\n TooltipArrow as TooltipArrowPrimitive,\r\n TooltipPortal as TooltipPortalPrimitive,\r\n type TooltipProviderProps as TooltipProviderPrimitiveProps,\r\n type TooltipProps as TooltipPrimitiveProps,\r\n type TooltipTriggerProps as TooltipTriggerPrimitiveProps,\r\n type TooltipPositionerProps as TooltipPositionerPrimitiveProps,\r\n type TooltipPopupProps as TooltipPopupPrimitiveProps,\r\n} from '../primitives/tooltip';\r\nimport { cn } from '@xploreu/lib/cn';\r\n\r\ntype TooltipProviderProps = TooltipProviderPrimitiveProps;\r\n\r\nfunction TooltipProvider({ delay = 0, ...props }: TooltipProviderProps) {\r\n return <TooltipProviderPrimitive delay={delay} {...props} />;\r\n}\r\n\r\ntype TooltipProps = TooltipPrimitiveProps & {\r\n delay?: TooltipProviderPrimitiveProps['delay'];\r\n};\r\n\r\nfunction Tooltip({ delay = 0, ...props }: TooltipProps) {\r\n return (\r\n <TooltipProvider delay={delay}>\r\n <TooltipPrimitive {...props} />\r\n </TooltipProvider>\r\n );\r\n}\r\n\r\ntype TooltipTriggerProps = TooltipTriggerPrimitiveProps;\r\n\r\nfunction TooltipTrigger(props: TooltipTriggerProps) {\r\n return <TooltipTriggerPrimitive {...props} />;\r\n}\r\n\r\ntype TooltipPopupProps = TooltipPositionerPrimitiveProps &\r\n TooltipPopupPrimitiveProps & {\r\n withArrow?: boolean;\r\n };\r\n\r\nfunction TooltipPopup({\r\n className,\r\n sideOffset = 8,\r\n children,\r\n withArrow = true,\r\n style,\r\n ...props\r\n}: TooltipPopupProps) {\r\n return (\r\n <TooltipPortalPrimitive>\r\n <TooltipPositionerPrimitive\r\n sideOffset={sideOffset}\r\n className=\"z-1000\"\r\n {...props}\r\n >\r\n <TooltipPopupPrimitive\r\n className={cn(\r\n 'z-50 w-fit text-balance rounded-xp-tooltip bg-bg-primary-solid px-xp-lg py-xp-md text-body-regular-3 text-text-white',\r\n className,\r\n )}\r\n style={style}\r\n >\r\n {children}\r\n {withArrow && (\r\n <TooltipArrowPrimitive className=\"z-50 size-2.5 rotate-45 rounded-xp-card-base-xxs bg-bg-primary-solid fill-primary data-[side=bottom]:-top-[5px] data-[side=top]:-bottom-[5px] data-[side=right]:-left-[5px] data-[side=left]:-right-[5px]\" />\r\n )}\r\n </TooltipPopupPrimitive>\r\n </TooltipPositionerPrimitive>\r\n </TooltipPortalPrimitive>\r\n );\r\n}\r\n\r\nexport {\r\n Tooltip,\r\n TooltipTrigger,\r\n TooltipPopup,\r\n type TooltipProps,\r\n type TooltipTriggerProps,\r\n type TooltipPopupProps,\r\n};\r\n"]}
@@ -0,0 +1,2 @@
1
+ import {a,b,c}from'./chunk-2RHSXF3X.js';import {a as a$3}from'./chunk-5ETIHFSE.js';import {a as a$2}from'./chunk-XJTOYNCA.js';import {a as a$1}from'./chunk-UCCQUPMT.js';import'react';import {InfoIcon}from'lucide-react';import {cn}from'@xploreu/lib/cn';import {jsx,jsxs,Fragment}from'react/jsx-runtime';function E({className:t,...r}){return jsx("div",{className:"relative w-full overflow-x-auto rounded-xl border border-border-primary bg-bg-primary","data-slot":"table-container",children:jsx("table",{className:cn("w-full caption-bottom text-body-regular-2",t),"data-slot":"table",...r})})}function S({className:t,...r}){return jsx("thead",{className:cn("bg-bg-secondary [&_tr]:border-border-tertiary",t),"data-slot":"table-header",...r})}function A({className:t,...r}){return jsx("tbody",{className:cn("[&_tr:last-child]:border-0",t),"data-slot":"table-body",...r})}function j({className:t,...r}){return jsx("tfoot",{className:cn("border-t border-border-primary bg-bg-secondary font-medium [&>tr]:last:border-b-0",t),"data-slot":"table-footer",...r})}function q({className:t,...r}){return jsx("tr",{className:cn("border-b border-border-secondary transition-colors hover:bg-bg-secondary data-[state=selected]:bg-bg-brand-primary/40",t),"data-slot":"table-row",...r})}function B({className:t,align:r,variant:c$1="string",tooltip:n,sortable:o,sortDirection:b$1,onSort:p,children:N,...C}){let s=r||(c$1==="number"?"end":"start"),i=!!(n||o),P=s==="end",m=n?jsxs(a,{children:[jsx(b,{render:jsx("button",{type:"button",className:"inline-flex items-center justify-center text-fg-quaternary hover:text-text-primary"}),children:jsx(InfoIcon,{className:"size-3.5"})}),jsx(c,{side:"top",children:n})]}):null,u=o?jsx("button",{type:"button",onClick:p,className:"inline-flex items-center text-fg-quaternary hover:text-text-primary focus:outline-none","aria-label":"Sort column",children:b$1==="asc"?jsx(a$1,{size:12}):b$1==="desc"?jsx(a$2,{size:12}):jsx(a$3,{size:12})}):null,d=jsx("span",{className:cn("truncate",o&&"cursor-pointer select-none"),onClick:o?p:void 0,children:N});return jsx("th",{className:cn("text-label-bold-3 text-text-tertiary h-10 px-4 py-3 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",!i&&s==="end"&&"text-right",!i&&s==="start"&&"text-left",!i&&s==="center"&&"text-center",t),"data-slot":"table-head",...C,children:i?jsx("div",{className:"flex w-full items-center justify-between gap-2",children:P?jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[m,u]}),jsx("div",{className:"flex items-center shrink-0 justify-end",children:d})]}):jsxs(Fragment,{children:[d,jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[m,u]})]})}):d})}function D({className:t,align:r,variant:c="string",...n}){let o=r||(c==="number"?"end":"start");return jsx("td",{className:cn("text-text-primary px-4 py-3 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0",o==="end"&&"text-right",o==="start"&&"text-left",o==="center"&&"text-center",t),"data-slot":"table-cell",...n})}function O({className:t,...r}){return jsx("caption",{className:cn("text-text-secondary mt-4 text-body-regular-2",t),"data-slot":"table-caption",...r})}export{E as a,S as b,A as c,j as d,q as e,B as f,D as g,O as h};//# sourceMappingURL=chunk-3C5RPQNM.js.map
2
+ //# sourceMappingURL=chunk-3C5RPQNM.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ui/table.tsx"],"names":["Table","className","props","jsx","cn","TableHeader","TableBody","TableFooter","TableRow","TableHead","align","variant","tooltip","sortable","sortDirection","onSort","children","effectiveAlign","hasControls","isEnd","tooltipElement","jsxs","Tooltip","TooltipTrigger","InfoIcon","TooltipPopup","sortElement","sort_ascending_icon_default","sort_descending_icon_default","sort_default_icon_default","titleElement","Fragment","TableCell","TableCaption"],"mappings":"8SAWA,SAASA,CAAAA,CAAM,CAAE,SAAA,CAAAC,CAAAA,CAAW,GAAGC,CAAM,CAAA,CAAkC,CACrE,OACEC,GAAAA,CAAC,KAAA,CAAA,CACC,UAAU,uFAAA,CACV,WAAA,CAAU,iBAAA,CAEV,QAAA,CAAAA,GAAAA,CAAC,OAAA,CAAA,CACC,UAAWC,EAAAA,CAAG,2CAAA,CAA6CH,CAAS,CAAA,CACpE,WAAA,CAAU,QACT,GAAGC,CAAAA,CACN,CAAA,CACF,CAEJ,CAEA,SAASG,EAAY,CAAE,SAAA,CAAAJ,EAAW,GAAGC,CAAM,EAAkC,CAC3E,OACEC,IAAC,OAAA,CAAA,CACC,SAAA,CAAWC,GACT,+CAAA,CACAH,CACF,EACA,WAAA,CAAU,cAAA,CACT,GAAGC,CAAAA,CACN,CAEJ,CAEA,SAASI,CAAAA,CAAU,CAAE,UAAAL,CAAAA,CAAW,GAAGC,CAAM,CAAA,CAAkC,CACzE,OACEC,GAAAA,CAAC,OAAA,CAAA,CACC,SAAA,CAAWC,EAAAA,CAAG,4BAAA,CAA8BH,CAAS,EACrD,WAAA,CAAU,YAAA,CACT,GAAGC,CAAAA,CACN,CAEJ,CAEA,SAASK,CAAAA,CAAY,CAAE,SAAA,CAAAN,CAAAA,CAAW,GAAGC,CAAM,CAAA,CAAkC,CAC3E,OACEC,GAAAA,CAAC,OAAA,CAAA,CACC,UAAWC,EAAAA,CACT,mFAAA,CACAH,CACF,CAAA,CACA,WAAA,CAAU,eACT,GAAGC,CAAAA,CACN,CAEJ,CAEA,SAASM,EAAS,CA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AA,CAAAS,EACA,OAAA,CAAAC,CAAAA,CAAU,SACV,GAAGT,CACL,CAAA,CAAmB,CACjB,IAAMe,CAAAA,CAAiBP,IAAUC,CAAAA,GAAY,QAAA,CAAW,MAAQ,OAAA,CAAA,CAEhE,OACER,IAAC,IAAA,CAAA,CACC,SAAA,CAAWC,GACT,0FAAA,CACAa,CAAAA,GAAmB,OAAS,YAAA,CAC5BA,CAAAA,GAAmB,SAAW,WAAA,CAC9BA,CAAAA,GAAmB,UAAY,aAAA,CAC/BhB,CACF,CAAA,CACA,WAAA,CAAU,YAAA,CACT,GAAGC,EACN,CAEJ,CAEA,SAAS+B,CAAAA,CAAa,CACpB,UAAAhC,CAAAA,CACA,GAAGC,CACL,CAAA,CAAoC,CAClC,OACEC,IAAC,SAAA,CAAA,CACC,SAAA,CAAWC,GAAG,8CAAA,CAAgDH,CAAS,EACvE,WAAA,CAAU,eAAA,CACT,GAAGC,CAAAA,CACN,CAEJ","file":"chunk-3C5RPQNM.js","sourcesContent":["import * as React from \"react\"\r\nimport { InfoIcon } from \"lucide-react\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport { SortAscendingIcon, SortDefaultIcon, SortDescendingIcon } from \"../icons\"\r\nimport {\r\n Tooltip,\r\n TooltipPopup,\r\n TooltipTrigger,\r\n} from \"./tooltip\"\r\n\r\nfunction Table({ className, ...props }: React.ComponentProps<\"table\">) {\r\n return (\r\n <div\r\n className=\"relative w-full overflow-x-auto rounded-xl border border-border-primary bg-bg-primary\"\r\n data-slot=\"table-container\"\r\n >\r\n <table\r\n className={cn(\"w-full caption-bottom text-body-regular-2\", className)}\r\n data-slot=\"table\"\r\n {...props}\r\n />\r\n </div>\r\n )\r\n}\r\n\r\nfunction TableHeader({ className, ...props }: React.ComponentProps<\"thead\">) {\r\n return (\r\n <thead\r\n className={cn(\r\n \"bg-bg-secondary [&_tr]:border-border-tertiary\",\r\n className\r\n )}\r\n data-slot=\"table-header\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nfunction TableBody({ className, ...props }: React.ComponentProps<\"tbody\">) {\r\n return (\r\n <tbody\r\n className={cn(\"[&_tr:last-child]:border-0\", className)}\r\n data-slot=\"table-body\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nfunction TableFooter({ className, ...props }: React.ComponentProps<\"tfoot\">) {\r\n return (\r\n <tfoot\r\n className={cn(\r\n \"border-t border-border-primary bg-bg-secondary font-medium [&>tr]:last:border-b-0\",\r\n className\r\n )}\r\n data-slot=\"table-footer\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nfunction TableRow({ className, ...props }: React.ComponentProps<\"tr\">) {\r\n return (\r\n <tr\r\n className={cn(\r\n \"border-b border-border-secondary transition-colors hover:bg-bg-secondary data-[state=selected]:bg-bg-brand-primary/40\",\r\n className\r\n )}\r\n data-slot=\"table-row\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ninterface TableHeadProps extends Omit<React.ComponentProps<\"th\">, \"align\"> {\r\n align?: \"start\" | \"end\" | \"center\"\r\n variant?: \"string\" | \"number\"\r\n tooltip?: React.ReactNode\r\n sortable?: boolean\r\n sortDirection?: \"asc\" | \"desc\" | false | null\r\n onSort?: () => void\r\n}\r\n\r\nfunction TableHead({\r\n className,\r\n align,\r\n variant = \"string\",\r\n tooltip,\r\n sortable,\r\n sortDirection,\r\n onSort,\r\n children,\r\n ...props\r\n}: TableHeadProps) {\r\n const effectiveAlign = align || (variant === \"number\" ? \"end\" : \"start\")\r\n const hasControls = Boolean(tooltip || sortable)\r\n const isEnd = effectiveAlign === \"end\"\r\n\r\n const tooltipElement = tooltip ? (\r\n <Tooltip>\r\n <TooltipTrigger\r\n render={\r\n <button\r\n type=\"button\"\r\n className=\"inline-flex items-center justify-center text-fg-quaternary hover:text-text-primary\"\r\n />\r\n }\r\n >\r\n <InfoIcon className=\"size-3.5\" />\r\n </TooltipTrigger>\r\n <TooltipPopup side=\"top\">{tooltip}</TooltipPopup>\r\n </Tooltip>\r\n ) : null\r\n\r\n const sortElement = sortable ? (\r\n <button\r\n type=\"button\"\r\n onClick={onSort}\r\n className=\"inline-flex items-center text-fg-quaternary hover:text-text-primary focus:outline-none\"\r\n aria-label=\"Sort column\"\r\n >\r\n {sortDirection === \"asc\" ? (\r\n <SortAscendingIcon size={12} />\r\n ) : sortDirection === \"desc\" ? (\r\n <SortDescendingIcon size={12} />\r\n ) : (\r\n <SortDefaultIcon size={12} />\r\n )}\r\n </button>\r\n ) : null\r\n\r\n const titleElement = (\r\n <span\r\n className={cn(\"truncate\", sortable && \"cursor-pointer select-none\")}\r\n onClick={sortable ? onSort : undefined}\r\n >\r\n {children}\r\n </span>\r\n )\r\n\r\n return (\r\n <th\r\n className={cn(\r\n \"text-label-bold-3 text-text-tertiary h-10 px-4 py-3 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0\",\r\n !hasControls && effectiveAlign === \"end\" && \"text-right\",\r\n !hasControls && effectiveAlign === \"start\" && \"text-left\",\r\n !hasControls && effectiveAlign === \"center\" && \"text-center\",\r\n className\r\n )}\r\n data-slot=\"table-head\"\r\n {...props}\r\n >\r\n {hasControls ? (\r\n <div className=\"flex w-full items-center justify-between gap-2\">\r\n {isEnd ? (\r\n <>\r\n <div className=\"flex items-center gap-1.5 shrink-0\">\r\n {tooltipElement}\r\n {sortElement}\r\n </div>\r\n <div className=\"flex items-center shrink-0 justify-end\">\r\n {titleElement}\r\n </div>\r\n </>\r\n ) : (\r\n <>\r\n {titleElement}\r\n <div className=\"flex items-center gap-1.5 shrink-0\">\r\n {tooltipElement}\r\n {sortElement}\r\n </div>\r\n </>\r\n )}\r\n </div>\r\n ) : (\r\n titleElement\r\n )}\r\n </th>\r\n )\r\n}\r\n\r\ninterface TableCellProps extends Omit<React.ComponentProps<\"td\">, \"align\"> {\r\n align?: \"start\" | \"end\" | \"center\"\r\n variant?: \"string\" | \"number\"\r\n}\r\n\r\nfunction TableCell({\r\n className,\r\n align,\r\n variant = \"string\",\r\n ...props\r\n}: TableCellProps) {\r\n const effectiveAlign = align || (variant === \"number\" ? \"end\" : \"start\")\r\n\r\n return (\r\n <td\r\n className={cn(\r\n \"text-text-primary px-4 py-3 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0\",\r\n effectiveAlign === \"end\" && \"text-right\",\r\n effectiveAlign === \"start\" && \"text-left\",\r\n effectiveAlign === \"center\" && \"text-center\",\r\n className\r\n )}\r\n data-slot=\"table-cell\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nfunction TableCaption({\r\n className,\r\n ...props\r\n}: React.ComponentProps<\"caption\">) {\r\n return (\r\n <caption\r\n className={cn(\"text-text-secondary mt-4 text-body-regular-2\", className)}\r\n data-slot=\"table-caption\"\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\nexport {\r\n Table,\r\n TableBody,\r\n TableCaption,\r\n TableCell,\r\n TableFooter,\r\n TableHead,\r\n TableHeader,\r\n TableRow,\r\n type TableCellProps,\r\n type TableHeadProps,\r\n}"]}
@@ -1,2 +1,2 @@
1
- import {a as a$1,b,m,e,q,s,w}from'./chunk-EL7P7FN5.js';import {a}from'./chunk-JH6RZ3QH.js';import*as t from'react';import*as C from'react-phone-number-input';import Y from'react-phone-number-input/flags';import {cn}from'@xploreu/lib/cn';import'@base-ui/react/combobox';import {ChevronsUpDownIcon}from'lucide-react';import {jsx,jsxs}from'react/jsx-runtime';var R=({country:l,countryName:o})=>{let s=l?Y[l]:void 0;return jsx("span",{className:"flex h-4 w-6 shrink-0 overflow-hidden rounded-sm bg-fg-quaternary/20 [&_svg:not([class*='size-'])]:size-full",children:s&&jsx(s,{title:o})})},d=44,k=288,H=6;function D({disabled:l,value:o,options:s$1,onChange:i}){let[c,r]=t.useState(false),[b$1,g]=t.useState(""),[y,N]=t.useState(0),v=t.useRef(null),m$1=t.useMemo(()=>s$1.filter(e=>!!e.value),[s$1]),u=t.useMemo(()=>{let e=b$1.trim().toLowerCase();return e?m$1.filter(a=>{let f=C.getCountryCallingCode(a.value);return a.label.toLowerCase().includes(e)||a.value.toLowerCase().includes(e)||f.includes(e.replace(/^\+/,""))}):m$1},[b$1,m$1]),_=t.useMemo(()=>m$1.find(e=>e.value===o)??null,[m$1,o]);t.useEffect(()=>{N(0),v.current&&(v.current.scrollTop=0);},[b$1]);let z=Math.min(u.length*d,k),h=t.useMemo(()=>{let e=Math.floor(y/d),a=Math.max(0,e-H),f=Math.ceil(k/d),P=Math.min(u.length,e+f+H);return {startIndex:a,endIndex:P,items:u.slice(a,P)}},[u,y]),F=h.startIndex*d,U=Math.max(0,(u.length-h.endIndex)*d),q$1=t.useCallback(e=>{e?.value&&(i(e.value),g(""),r(false));},[i]);return jsxs(a$1,{behavior:"default",disabled:l,inputValue:b$1,items:u,open:c,value:_,virtualized:true,filter:null,isItemEqualToValue:(e,a)=>e.value===a.value,openOnInputClick:false,onValueChange:q$1,onInputValueChange:g,onOpenChange:e=>{r(e),e||g("");},children:[jsx(b,{render:jsxs("button",{type:"button",className:cn(a(),"h-11 w-18 shrink-0 justify-between gap-1 rounded-r-none border-r-0 px-3","hover:bg-bg-primary-hover focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand","disabled:pointer-events-none disabled:opacity-50"),disabled:l,children:[jsxs("span",{className:"flex items-center gap-1.5 overflow-hidden",children:[jsx(R,{country:o,countryName:o}),o&&jsx("span",{className:"text-body-medium-3 text-text-primary",children:o})]}),jsx(ChevronsUpDownIcon,{className:"size-3.5 shrink-0 text-fg-quaternary"})]})}),jsxs(m,{className:"w-72",children:[jsx(e,{placeholder:"Search country...","aria-label":"Search country"}),jsx(q,{status:u.length===0?"empty":null}),jsx(s,{ref:v,className:"relative gap-0",style:{height:z},onScroll:e=>N(e.currentTarget.scrollTop),children:jsx("div",{className:"flex w-full shrink-0 flex-col",style:{paddingTop:F,paddingBottom:U},children:h.items.map((e,a)=>{let f=h.startIndex+a;return jsx(w,{index:f,value:e,children:jsxs("div",{className:"flex items-center gap-2 w-full min-w-0",children:[jsx(R,{country:e.value,countryName:e.label}),jsx("span",{className:"flex-1 text-sm truncate",children:e.label}),jsxs("span",{className:"text-sm text-text-tertiary shrink-0",children:["+",C.getCountryCallingCode(e.value)]})]})},e.value)})})})]})]})}var L=t.forwardRef(({className:l,onChange:o,...s},i)=>{let c=t.useCallback(r=>{r.currentTarget.value==="+"&&(r.currentTarget.value=""),o?.(r);},[o]);return jsx("input",{className:cn(a(),"h-11 flex-1 rounded-l-none text-body-regular-2",l),ref:i,type:"tel",onChange:c,...s})});L.displayName="InputComponent";var G=t.forwardRef(({className:l,onChange:o,value:s,...i},c)=>jsx(C.default,{ref:c,className:cn("flex w-full min-w-0 items-center",l),flagComponent:R,countrySelectComponent:D,inputComponent:L,smartCaret:false,value:s||void 0,onChange:r=>o?.(r||""),...i}));G.displayName="PhoneInput";export{G as a};//# sourceMappingURL=chunk-RVQZK2AK.js.map
2
- //# sourceMappingURL=chunk-RVQZK2AK.js.map
1
+ import {a as a$1,b,m,e,q,s,w}from'./chunk-GNQKITNA.js';import {a}from'./chunk-JH6RZ3QH.js';import*as t from'react';import*as C from'react-phone-number-input';import Y from'react-phone-number-input/flags';import {cn}from'@xploreu/lib/cn';import'@base-ui/react/combobox';import {ChevronsUpDownIcon}from'lucide-react';import {jsx,jsxs}from'react/jsx-runtime';var R=({country:l,countryName:o})=>{let s=l?Y[l]:void 0;return jsx("span",{className:"flex h-4 w-6 shrink-0 overflow-hidden rounded-sm bg-fg-quaternary/20 [&_svg:not([class*='size-'])]:size-full",children:s&&jsx(s,{title:o})})},d=44,k=288,H=6;function D({disabled:l,value:o,options:s$1,onChange:i}){let[c,r]=t.useState(false),[b$1,g]=t.useState(""),[y,N]=t.useState(0),v=t.useRef(null),m$1=t.useMemo(()=>s$1.filter(e=>!!e.value),[s$1]),u=t.useMemo(()=>{let e=b$1.trim().toLowerCase();return e?m$1.filter(a=>{let f=C.getCountryCallingCode(a.value);return a.label.toLowerCase().includes(e)||a.value.toLowerCase().includes(e)||f.includes(e.replace(/^\+/,""))}):m$1},[b$1,m$1]),_=t.useMemo(()=>m$1.find(e=>e.value===o)??null,[m$1,o]);t.useEffect(()=>{N(0),v.current&&(v.current.scrollTop=0);},[b$1]);let z=Math.min(u.length*d,k),h=t.useMemo(()=>{let e=Math.floor(y/d),a=Math.max(0,e-H),f=Math.ceil(k/d),P=Math.min(u.length,e+f+H);return {startIndex:a,endIndex:P,items:u.slice(a,P)}},[u,y]),F=h.startIndex*d,U=Math.max(0,(u.length-h.endIndex)*d),q$1=t.useCallback(e=>{e?.value&&(i(e.value),g(""),r(false));},[i]);return jsxs(a$1,{behavior:"default",disabled:l,inputValue:b$1,items:u,open:c,value:_,virtualized:true,filter:null,isItemEqualToValue:(e,a)=>e.value===a.value,openOnInputClick:false,onValueChange:q$1,onInputValueChange:g,onOpenChange:e=>{r(e),e||g("");},children:[jsx(b,{render:jsxs("button",{type:"button",className:cn(a(),"h-11 w-18 shrink-0 justify-between gap-1 rounded-r-none border-r-0 px-3","hover:bg-bg-primary-hover focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand","disabled:pointer-events-none disabled:opacity-50"),disabled:l,children:[jsxs("span",{className:"flex items-center gap-1.5 overflow-hidden",children:[jsx(R,{country:o,countryName:o}),o&&jsx("span",{className:"text-body-medium-3 text-text-primary",children:o})]}),jsx(ChevronsUpDownIcon,{className:"size-3.5 shrink-0 text-fg-quaternary"})]})}),jsxs(m,{className:"w-72",children:[jsx(e,{placeholder:"Search country...","aria-label":"Search country"}),jsx(q,{status:u.length===0?"empty":null}),jsx(s,{ref:v,className:"relative gap-0",style:{height:z},onScroll:e=>N(e.currentTarget.scrollTop),children:jsx("div",{className:"flex w-full shrink-0 flex-col",style:{paddingTop:F,paddingBottom:U},children:h.items.map((e,a)=>{let f=h.startIndex+a;return jsx(w,{index:f,value:e,children:jsxs("div",{className:"flex items-center gap-2 w-full min-w-0",children:[jsx(R,{country:e.value,countryName:e.label}),jsx("span",{className:"flex-1 text-sm truncate",children:e.label}),jsxs("span",{className:"text-sm text-text-tertiary shrink-0",children:["+",C.getCountryCallingCode(e.value)]})]})},e.value)})})})]})]})}var L=t.forwardRef(({className:l,onChange:o,...s},i)=>{let c=t.useCallback(r=>{r.currentTarget.value==="+"&&(r.currentTarget.value=""),o?.(r);},[o]);return jsx("input",{className:cn(a(),"h-11 flex-1 rounded-l-none text-body-regular-2",l),ref:i,type:"tel",onChange:c,...s})});L.displayName="InputComponent";var G=t.forwardRef(({className:l,onChange:o,value:s,...i},c)=>jsx(C.default,{ref:c,className:cn("flex w-full min-w-0 items-center",l),flagComponent:R,countrySelectComponent:D,inputComponent:L,smartCaret:false,value:s||void 0,onChange:r=>o?.(r||""),...i}));G.displayName="PhoneInput";export{G as a};//# sourceMappingURL=chunk-BSWTMWP5.js.map
2
+ //# sourceMappingURL=chunk-BSWTMWP5.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/composites/phone-input.tsx"],"names":["FlagComponent","country","countryName","Flag","flags","jsx","COUNTRY_ROW_HEIGHT","COUNTRY_LIST_HEIGHT","COUNTRY_OVERSCAN","CountrySelect","disabled","selectedCountry","countryList","onChange","open","setOpen","inputValue","setInputValue","scrollTop","setScrollTop","listRef","items","item","filteredItems","search","callingCode","value","listHeight","virtualRange","visibleStartIndex","startIndex","visibleCount","endIndex","paddingTop","paddingBottom","handleValueChange","jsxs","Combobox","a","b","ComboboxTrigger","cn","inputVariants","ChevronsUpDownIcon","ComboboxPopup","ComboboxInput","ComboboxStatus","ComboboxList","event","virtualIndex","index","ComboboxItem","InputComponent","className","props","ref","handleChange","PhoneInput"],"mappings":"oWAoCA,IAAMA,EAAgB,CAAC,CAAE,OAAA,CAAAC,CAAAA,CAAS,YAAAC,CAAY,CAAA,GAA0B,CACtE,IAAMC,EAAOF,CAAAA,CAAUG,CAAAA,CAAMH,CAAO,CAAA,CAAI,MAAA,CAExC,OACEI,GAAAA,CAAC,MAAA,CAAA,CAAK,UAAU,8GAAA,CACb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,SAAWA,CAAAA,EAAUb,CAAAA,GAAWa,CAAAA,EAAU,EAAqB,EAC9D,GAAG4B,CAAAA,CACN,CAEH,EACHG,EAAW,WAAA,CAAc,YAAA","file":"chunk-RVQZK2AK.js","sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\nimport * as RPNInput from \"react-phone-number-input\"\r\nimport flags from \"react-phone-number-input/flags\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport { Combobox as ComboboxPrimitive } from \"@base-ui/react/combobox\"\r\nimport {\r\n Combobox,\r\n ComboboxInput,\r\n ComboboxItem,\r\n ComboboxList,\r\n ComboboxPopup,\r\n ComboboxStatus,\r\n ComboboxTrigger,\r\n} from \"../ui/combobox\"\r\nimport { inputVariants } from \"../ui/input\"\r\nimport { ChevronsUpDownIcon } from \"lucide-react\"\r\n\r\n// ---------------------------------------------------------------------------\r\n// Types\r\n// ---------------------------------------------------------------------------\r\n\r\ntype PhoneInputProps = Omit<\r\n React.ComponentProps<\"input\">,\r\n \"onChange\" | \"value\" | \"ref\"\r\n> &\r\n Omit<RPNInput.Props<typeof RPNInput.default>, \"onChange\"> & {\r\n onChange?: (value: RPNInput.Value) => void\r\n }\r\n\r\n// ---------------------------------------------------------------------------\r\n// Flag\r\n// ---------------------------------------------------------------------------\r\n\r\nconst FlagComponent = ({ country, countryName }: RPNInput.FlagProps) => {\r\n const Flag = country ? flags[country] : undefined\r\n\r\n return (\r\n <span className=\"flex h-4 w-6 shrink-0 overflow-hidden rounded-sm bg-fg-quaternary/20 [&_svg:not([class*='size-'])]:size-full\">\r\n {Flag && <Flag title={countryName} />}\r\n </span>\r\n )\r\n}\r\n\r\n// ---------------------------------------------------------------------------\r\n// Country Select — uses base-ui Combobox\r\n// ---------------------------------------------------------------------------\r\n\r\ntype CountryEntry = { label: string; value: RPNInput.Country | undefined }\r\ntype CountryItem = { label: string; value: RPNInput.Country }\r\n\r\nconst COUNTRY_ROW_HEIGHT = 44\r\nconst COUNTRY_LIST_HEIGHT = 288\r\nconst COUNTRY_OVERSCAN = 6\r\n\r\ntype CountrySelectProps = {\r\n disabled?: boolean\r\n value: RPNInput.Country\r\n options: CountryEntry[]\r\n onChange: (country: RPNInput.Country) => void\r\n}\r\n\r\nfunction CountrySelect({\r\n disabled,\r\n value: selectedCountry,\r\n options: countryList,\r\n onChange,\r\n}: CountrySelectProps) {\r\n const [open, setOpen] = React.useState(false)\r\n const [inputValue, setInputValue] = React.useState(\"\")\r\n const [scrollTop, setScrollTop] = React.useState(0)\r\n const listRef = React.useRef<HTMLDivElement>(null)\r\n\r\n const items = React.useMemo(\r\n () => countryList.filter((item): item is CountryItem => Boolean(item.value)),\r\n [countryList]\r\n )\r\n\r\n const filteredItems = React.useMemo(() => {\r\n const search = inputValue.trim().toLowerCase()\r\n\r\n if (!search) return items\r\n\r\n return items.filter((item) => {\r\n const callingCode = RPNInput.getCountryCallingCode(item.value)\r\n\r\n return item.label.toLowerCase().includes(search)\r\n || item.value.toLowerCase().includes(search)\r\n || callingCode.includes(search.replace(/^\\+/, \"\"))\r\n })\r\n }, [inputValue, items])\r\n\r\n const value = React.useMemo(\r\n () => items.find((item) => item.value === selectedCountry) ?? null,\r\n [items, selectedCountry]\r\n )\r\n\r\n React.useEffect(() => {\r\n setScrollTop(0)\r\n if (listRef.current) listRef.current.scrollTop = 0\r\n }, [inputValue])\r\n\r\n const listHeight = Math.min(\r\n filteredItems.length * COUNTRY_ROW_HEIGHT,\r\n COUNTRY_LIST_HEIGHT\r\n )\r\n\r\n const virtualRange = React.useMemo(() => {\r\n const visibleStartIndex = Math.floor(scrollTop / COUNTRY_ROW_HEIGHT)\r\n const startIndex = Math.max(\r\n 0,\r\n visibleStartIndex - COUNTRY_OVERSCAN\r\n )\r\n const visibleCount = Math.ceil(COUNTRY_LIST_HEIGHT / COUNTRY_ROW_HEIGHT)\r\n const endIndex = Math.min(\r\n filteredItems.length,\r\n visibleStartIndex + visibleCount + COUNTRY_OVERSCAN\r\n )\r\n\r\n return {\r\n startIndex,\r\n endIndex,\r\n items: filteredItems.slice(startIndex, endIndex),\r\n }\r\n }, [filteredItems, scrollTop])\r\n\r\n const paddingTop = virtualRange.startIndex * COUNTRY_ROW_HEIGHT\r\n const paddingBottom = Math.max(\r\n 0,\r\n (filteredItems.length - virtualRange.endIndex) * COUNTRY_ROW_HEIGHT\r\n )\r\n\r\n const handleValueChange = React.useCallback(\r\n (item: CountryItem | null) => {\r\n if (!item?.value) return\r\n\r\n onChange(item.value)\r\n setInputValue(\"\")\r\n setOpen(false)\r\n },\r\n [onChange]\r\n )\r\n\r\n return (\r\n <Combobox\r\n behavior=\"default\"\r\n disabled={disabled}\r\n inputValue={inputValue}\r\n items={filteredItems}\r\n open={open}\r\n value={value}\r\n virtualized\r\n filter={null}\r\n isItemEqualToValue={(a, b) => a.value === b.value}\r\n openOnInputClick={false}\r\n onValueChange={handleValueChange}\r\n onInputValueChange={setInputValue}\r\n onOpenChange={(open) => {\r\n setOpen(open)\r\n if (!open) setInputValue(\"\")\r\n }}\r\n >\r\n {/* Visible trigger button styled as part of the input */}\r\n <ComboboxTrigger\r\n render={\r\n <button\r\n type=\"button\"\r\n className={cn(\r\n inputVariants(),\r\n \"h-11 w-18 shrink-0 justify-between gap-1 rounded-r-none border-r-0 px-3\",\r\n \"hover:bg-bg-primary-hover focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand\",\r\n \"disabled:pointer-events-none disabled:opacity-50\"\r\n )}\r\n disabled={disabled}\r\n >\r\n <span className=\"flex items-center gap-1.5 overflow-hidden\">\r\n <FlagComponent\r\n country={selectedCountry}\r\n countryName={selectedCountry}\r\n />\r\n {selectedCountry && (\r\n <span className=\"text-body-medium-3 text-text-primary\">\r\n {selectedCountry}\r\n </span>\r\n )}\r\n </span>\r\n <ChevronsUpDownIcon className=\"size-3.5 shrink-0 text-fg-quaternary\" />\r\n </button>\r\n }\r\n />\r\n\r\n {/* Dropdown content */}\r\n <ComboboxPopup className=\"w-72\">\r\n <ComboboxInput\r\n placeholder=\"Search country...\"\r\n aria-label=\"Search country\"\r\n />\r\n <ComboboxStatus status={filteredItems.length === 0 ? \"empty\" : null} />\r\n <ComboboxList\r\n ref={listRef}\r\n className=\"relative gap-0\"\r\n style={{ height: listHeight }}\r\n onScroll={(event) => setScrollTop(event.currentTarget.scrollTop)}\r\n >\r\n <div\r\n className=\"flex w-full shrink-0 flex-col\"\r\n style={{ paddingTop, paddingBottom }}\r\n >\r\n {virtualRange.items.map((item, virtualIndex) => {\r\n const index = virtualRange.startIndex + virtualIndex\r\n\r\n return (\r\n <ComboboxItem\r\n key={item.value}\r\n index={index}\r\n value={item}\r\n >\r\n <div className=\"flex items-center gap-2 w-full min-w-0\">\r\n <FlagComponent country={item.value} countryName={item.label} />\r\n <span className=\"flex-1 text-sm truncate\">{item.label}</span>\r\n <span className=\"text-sm text-text-tertiary shrink-0\">\r\n +{RPNInput.getCountryCallingCode(item.value)}\r\n </span>\r\n </div>\r\n </ComboboxItem>\r\n )\r\n })}\r\n </div>\r\n </ComboboxList>\r\n </ComboboxPopup>\r\n </Combobox >\r\n )\r\n}\r\n\r\n// ---------------------------------------------------------------------------\r\n// Input Component\r\n// ---------------------------------------------------------------------------\r\n\r\nconst InputComponent = React.forwardRef<\r\n HTMLInputElement,\r\n React.ComponentProps<\"input\">\r\n>(({ className, onChange, ...props }, ref) => {\r\n const handleChange = React.useCallback(\r\n (event: React.ChangeEvent<HTMLInputElement>) => {\r\n if (event.currentTarget.value === \"+\") {\r\n event.currentTarget.value = \"\"\r\n }\r\n\r\n onChange?.(event)\r\n },\r\n [onChange]\r\n )\r\n\r\n return (\r\n <input\r\n className={cn(\r\n inputVariants(),\r\n \"h-11 flex-1 rounded-l-none text-body-regular-2\",\r\n className\r\n )}\r\n ref={ref}\r\n type=\"tel\"\r\n onChange={handleChange}\r\n {...props}\r\n />\r\n )\r\n})\r\nInputComponent.displayName = \"InputComponent\"\r\n\r\n// ---------------------------------------------------------------------------\r\n// Phone Input\r\n// ---------------------------------------------------------------------------\r\n\r\nconst PhoneInput: React.ForwardRefExoticComponent<PhoneInputProps> =\r\n React.forwardRef<\r\n React.ElementRef<typeof RPNInput.default>,\r\n PhoneInputProps\r\n >(({\r\n className,\r\n onChange,\r\n value,\r\n ...props\r\n }, ref) => {\r\n return (\r\n <RPNInput.default\r\n ref={ref}\r\n className={cn(\r\n \"flex w-full min-w-0 items-center\",\r\n className\r\n )}\r\n flagComponent={FlagComponent}\r\n countrySelectComponent={CountrySelect}\r\n inputComponent={InputComponent}\r\n smartCaret={false}\r\n value={value || undefined}\r\n onChange={(value) => onChange?.(value || (\"\" as RPNInput.Value))}\r\n {...props}\r\n />\r\n )\r\n })\r\nPhoneInput.displayName = \"PhoneInput\"\r\n\r\nexport { PhoneInput, type PhoneInputProps }\r\n"]}
1
+ {"version":3,"sources":["../src/composites/phone-input.tsx"],"names":["FlagComponent","country","countryName","Flag","flags","jsx","COUNTRY_ROW_HEIGHT","COUNTRY_LIST_HEIGHT","COUNTRY_OVERSCAN","CountrySelect","disabled","selectedCountry","countryList","onChange","open","setOpen","inputValue","setInputValue","scrollTop","setScrollTop","listRef","items","item","filteredItems","search","callingCode","value","listHeight","virtualRange","visibleStartIndex","startIndex","visibleCount","endIndex","paddingTop","paddingBottom","handleValueChange","jsxs","Combobox","a","b","ComboboxTrigger","cn","inputVariants","ChevronsUpDownIcon","ComboboxPopup","ComboboxInput","ComboboxStatus","ComboboxList","event","virtualIndex","index","ComboboxItem","InputComponent","className","props","ref","handleChange","PhoneInput"],"mappings":"oWAoCA,IAAMA,EAAgB,CAAC,CAAE,OAAA,CAAAC,CAAAA,CAAS,YAAAC,CAAY,CAAA,GAA0B,CACtE,IAAMC,EAAOF,CAAAA,CAAUG,CAAAA,CAAMH,CAAO,CAAA,CAAI,MAAA,CAExC,OACEI,GAAAA,CAAC,MAAA,CAAA,CAAK,UAAU,8GAAA,CACb,QAAA,CAAAF,CAAAA,EAAQE,GAAAA,C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CAAAA,EAAU,EAAqB,EAC9D,GAAG4B,CAAAA,CACN,CAEH,EACHG,EAAW,WAAA,CAAc,YAAA","file":"chunk-BSWTMWP5.js","sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\nimport * as RPNInput from \"react-phone-number-input\"\r\nimport flags from \"react-phone-number-input/flags\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport { Combobox as ComboboxPrimitive } from \"@base-ui/react/combobox\"\r\nimport {\r\n Combobox,\r\n ComboboxInput,\r\n ComboboxItem,\r\n ComboboxList,\r\n ComboboxPopup,\r\n ComboboxStatus,\r\n ComboboxTrigger,\r\n} from \"../ui/combobox\"\r\nimport { inputVariants } from \"../ui/input\"\r\nimport { ChevronsUpDownIcon } from \"lucide-react\"\r\n\r\n// ---------------------------------------------------------------------------\r\n// Types\r\n// ---------------------------------------------------------------------------\r\n\r\ntype PhoneInputProps = Omit<\r\n React.ComponentProps<\"input\">,\r\n \"onChange\" | \"value\" | \"ref\"\r\n> &\r\n Omit<RPNInput.Props<typeof RPNInput.default>, \"onChange\"> & {\r\n onChange?: (value: RPNInput.Value) => void\r\n }\r\n\r\n// ---------------------------------------------------------------------------\r\n// Flag\r\n// ---------------------------------------------------------------------------\r\n\r\nconst FlagComponent = ({ country, countryName }: RPNInput.FlagProps) => {\r\n const Flag = country ? flags[country] : undefined\r\n\r\n return (\r\n <span className=\"flex h-4 w-6 shrink-0 overflow-hidden rounded-sm bg-fg-quaternary/20 [&_svg:not([class*='size-'])]:size-full\">\r\n {Flag && <Flag title={countryName} />}\r\n </span>\r\n )\r\n}\r\n\r\n// ---------------------------------------------------------------------------\r\n// Country Select — uses base-ui Combobox\r\n// ---------------------------------------------------------------------------\r\n\r\ntype CountryEntry = { label: string; value: RPNInput.Country | undefined }\r\ntype CountryItem = { label: string; value: RPNInput.Country }\r\n\r\nconst COUNTRY_ROW_HEIGHT = 44\r\nconst COUNTRY_LIST_HEIGHT = 288\r\nconst COUNTRY_OVERSCAN = 6\r\n\r\ntype CountrySelectProps = {\r\n disabled?: boolean\r\n value: RPNInput.Country\r\n options: CountryEntry[]\r\n onChange: (country: RPNInput.Country) => void\r\n}\r\n\r\nfunction CountrySelect({\r\n disabled,\r\n value: selectedCountry,\r\n options: countryList,\r\n onChange,\r\n}: CountrySelectProps) {\r\n const [open, setOpen] = React.useState(false)\r\n const [inputValue, setInputValue] = React.useState(\"\")\r\n const [scrollTop, setScrollTop] = React.useState(0)\r\n const listRef = React.useRef<HTMLDivElement>(null)\r\n\r\n const items = React.useMemo(\r\n () => countryList.filter((item): item is CountryItem => Boolean(item.value)),\r\n [countryList]\r\n )\r\n\r\n const filteredItems = React.useMemo(() => {\r\n const search = inputValue.trim().toLowerCase()\r\n\r\n if (!search) return items\r\n\r\n return items.filter((item) => {\r\n const callingCode = RPNInput.getCountryCallingCode(item.value)\r\n\r\n return item.label.toLowerCase().includes(search)\r\n || item.value.toLowerCase().includes(search)\r\n || callingCode.includes(search.replace(/^\\+/, \"\"))\r\n })\r\n }, [inputValue, items])\r\n\r\n const value = React.useMemo(\r\n () => items.find((item) => item.value === selectedCountry) ?? null,\r\n [items, selectedCountry]\r\n )\r\n\r\n React.useEffect(() => {\r\n setScrollTop(0)\r\n if (listRef.current) listRef.current.scrollTop = 0\r\n }, [inputValue])\r\n\r\n const listHeight = Math.min(\r\n filteredItems.length * COUNTRY_ROW_HEIGHT,\r\n COUNTRY_LIST_HEIGHT\r\n )\r\n\r\n const virtualRange = React.useMemo(() => {\r\n const visibleStartIndex = Math.floor(scrollTop / COUNTRY_ROW_HEIGHT)\r\n const startIndex = Math.max(\r\n 0,\r\n visibleStartIndex - COUNTRY_OVERSCAN\r\n )\r\n const visibleCount = Math.ceil(COUNTRY_LIST_HEIGHT / COUNTRY_ROW_HEIGHT)\r\n const endIndex = Math.min(\r\n filteredItems.length,\r\n visibleStartIndex + visibleCount + COUNTRY_OVERSCAN\r\n )\r\n\r\n return {\r\n startIndex,\r\n endIndex,\r\n items: filteredItems.slice(startIndex, endIndex),\r\n }\r\n }, [filteredItems, scrollTop])\r\n\r\n const paddingTop = virtualRange.startIndex * COUNTRY_ROW_HEIGHT\r\n const paddingBottom = Math.max(\r\n 0,\r\n (filteredItems.length - virtualRange.endIndex) * COUNTRY_ROW_HEIGHT\r\n )\r\n\r\n const handleValueChange = React.useCallback(\r\n (item: CountryItem | null) => {\r\n if (!item?.value) return\r\n\r\n onChange(item.value)\r\n setInputValue(\"\")\r\n setOpen(false)\r\n },\r\n [onChange]\r\n )\r\n\r\n return (\r\n <Combobox\r\n behavior=\"default\"\r\n disabled={disabled}\r\n inputValue={inputValue}\r\n items={filteredItems}\r\n open={open}\r\n value={value}\r\n virtualized\r\n filter={null}\r\n isItemEqualToValue={(a, b) => a.value === b.value}\r\n openOnInputClick={false}\r\n onValueChange={handleValueChange}\r\n onInputValueChange={setInputValue}\r\n onOpenChange={(open) => {\r\n setOpen(open)\r\n if (!open) setInputValue(\"\")\r\n }}\r\n >\r\n {/* Visible trigger button styled as part of the input */}\r\n <ComboboxTrigger\r\n render={\r\n <button\r\n type=\"button\"\r\n className={cn(\r\n inputVariants(),\r\n \"h-11 w-18 shrink-0 justify-between gap-1 rounded-r-none border-r-0 px-3\",\r\n \"hover:bg-bg-primary-hover focus-visible:z-10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-brand\",\r\n \"disabled:pointer-events-none disabled:opacity-50\"\r\n )}\r\n disabled={disabled}\r\n >\r\n <span className=\"flex items-center gap-1.5 overflow-hidden\">\r\n <FlagComponent\r\n country={selectedCountry}\r\n countryName={selectedCountry}\r\n />\r\n {selectedCountry && (\r\n <span className=\"text-body-medium-3 text-text-primary\">\r\n {selectedCountry}\r\n </span>\r\n )}\r\n </span>\r\n <ChevronsUpDownIcon className=\"size-3.5 shrink-0 text-fg-quaternary\" />\r\n </button>\r\n }\r\n />\r\n\r\n {/* Dropdown content */}\r\n <ComboboxPopup className=\"w-72\">\r\n <ComboboxInput\r\n placeholder=\"Search country...\"\r\n aria-label=\"Search country\"\r\n />\r\n <ComboboxStatus status={filteredItems.length === 0 ? \"empty\" : null} />\r\n <ComboboxList\r\n ref={listRef}\r\n className=\"relative gap-0\"\r\n style={{ height: listHeight }}\r\n onScroll={(event) => setScrollTop(event.currentTarget.scrollTop)}\r\n >\r\n <div\r\n className=\"flex w-full shrink-0 flex-col\"\r\n style={{ paddingTop, paddingBottom }}\r\n >\r\n {virtualRange.items.map((item, virtualIndex) => {\r\n const index = virtualRange.startIndex + virtualIndex\r\n\r\n return (\r\n <ComboboxItem\r\n key={item.value}\r\n index={index}\r\n value={item}\r\n >\r\n <div className=\"flex items-center gap-2 w-full min-w-0\">\r\n <FlagComponent country={item.value} countryName={item.label} />\r\n <span className=\"flex-1 text-sm truncate\">{item.label}</span>\r\n <span className=\"text-sm text-text-tertiary shrink-0\">\r\n +{RPNInput.getCountryCallingCode(item.value)}\r\n </span>\r\n </div>\r\n </ComboboxItem>\r\n )\r\n })}\r\n </div>\r\n </ComboboxList>\r\n </ComboboxPopup>\r\n </Combobox >\r\n )\r\n}\r\n\r\n// ---------------------------------------------------------------------------\r\n// Input Component\r\n// ---------------------------------------------------------------------------\r\n\r\nconst InputComponent = React.forwardRef<\r\n HTMLInputElement,\r\n React.ComponentProps<\"input\">\r\n>(({ className, onChange, ...props }, ref) => {\r\n const handleChange = React.useCallback(\r\n (event: React.ChangeEvent<HTMLInputElement>) => {\r\n if (event.currentTarget.value === \"+\") {\r\n event.currentTarget.value = \"\"\r\n }\r\n\r\n onChange?.(event)\r\n },\r\n [onChange]\r\n )\r\n\r\n return (\r\n <input\r\n className={cn(\r\n inputVariants(),\r\n \"h-11 flex-1 rounded-l-none text-body-regular-2\",\r\n className\r\n )}\r\n ref={ref}\r\n type=\"tel\"\r\n onChange={handleChange}\r\n {...props}\r\n />\r\n )\r\n})\r\nInputComponent.displayName = \"InputComponent\"\r\n\r\n// ---------------------------------------------------------------------------\r\n// Phone Input\r\n// ---------------------------------------------------------------------------\r\n\r\nconst PhoneInput: React.ForwardRefExoticComponent<PhoneInputProps> =\r\n React.forwardRef<\r\n React.ElementRef<typeof RPNInput.default>,\r\n PhoneInputProps\r\n >(({\r\n className,\r\n onChange,\r\n value,\r\n ...props\r\n }, ref) => {\r\n return (\r\n <RPNInput.default\r\n ref={ref}\r\n className={cn(\r\n \"flex w-full min-w-0 items-center\",\r\n className\r\n )}\r\n flagComponent={FlagComponent}\r\n countrySelectComponent={CountrySelect}\r\n inputComponent={InputComponent}\r\n smartCaret={false}\r\n value={value || undefined}\r\n onChange={(value) => onChange?.(value || (\"\" as RPNInput.Value))}\r\n {...props}\r\n />\r\n )\r\n })\r\nPhoneInput.displayName = \"PhoneInput\"\r\n\r\nexport { PhoneInput, type PhoneInputProps }\r\n"]}
@@ -1,2 +1,2 @@
1
- import {a,j,i,k,l,m,q,s,w,F}from'./chunk-EL7P7FN5.js';import {a as a$1}from'./chunk-JH6RZ3QH.js';import {f,g}from'./chunk-JILBFCPY.js';import*as u from'react';import {cn}from'@xploreu/lib/cn';import {useControlledState}from'@xploreu/hooks/use-controlled-state';import {jsxs,jsx,Fragment}from'react/jsx-runtime';function Z({multiple:z=true,inputPlaceholder:E="Search...",container:G,items:s$1,infiniteScroll:T,isPending:j$1,taggable:c=false,maxVisible:i$1,...m$1}){let[q$1,O]=useControlledState({value:m$1?.inputValue?.toString(),defaultValue:m$1?.defaultInputValue?.toString(),onChange:m$1?.onInputValueChange}),[b,g$1]=useControlledState({value:m$1?.value??[],defaultValue:m$1?.defaultValue??[],onChange:m$1?.onValueChange}),[h,V]=u.useState([]),C=u.useRef(new Set);u.useEffect(()=>{let e=new Set(b.map(n=>n.value));V(n=>{let l=n.filter(o=>e.has(o.value));return l.length===n.length?n:(C.current=new Set(l.map(o=>o.value)),l)});},[b]);let a$2=q$1?.toString().trim()??"",A=u.useMemo(()=>a$2?b.some(e=>e.value.toLowerCase()===a$2.toLowerCase()):false,[a$2,b]),p=u.useMemo(()=>!c||!a$2?false:!s$1?.some(e=>e.label.toLowerCase()===a$2.toLowerCase()),[c,a$2,s$1]),B=u.useMemo(()=>{let e=[...s$1??[],...h];return p?[...e,{label:a$2,value:a$2,tag:true}]:e},[s$1,h,p,a$2]);return jsxs(a,{...m$1,behavior:"chip-outside",multiple:true,items:c?B:s$1,isItemEqualToValue:(e,n)=>e.value===n.value,onValueChange:(e,n)=>{if(c){let l=e.filter(o=>o?.tag===true&&!C.current.has(o.value));if(l.length>0){for(let o of l)C.current.add(o.value);V(o=>[...o,...l]);}}g$1(z?e:[e[e.length-1]],n);},onInputValueChange:O,children:[jsx(f,{className:cn(a$1(),"h-auto min-h-13 flex flex-wrap items-center gap-1.5 px-3 py-1.5 cursor-text"),children:jsxs(j,{className:cn("contents",i$1!==void 0&&"flex-nowrap overflow-hidden"),children:[jsx(i,{children:e=>{let n=i$1!==void 0?e.slice(0,i$1):e,l$1=i$1!==void 0?e.length-i$1:0;return jsxs(Fragment,{children:[n?.map(o=>jsxs(k,{className:cn(i$1!==void 0&&"min-w-0 shrink"),children:[o?.image&&jsx("img",{src:o.image,alt:o?.label||"",className:"size-4 rounded-full object-cover shrink-0 mr-1"}),i$1!==void 0?jsx("span",{className:"truncate",children:o?.label||""}):o?.label||"",jsx(l,{})]},o?.value||"")),l$1>0&&jsxs(k,{className:"shrink-0",children:["+",l$1]})]})}}),jsx(g,{render:jsx("input",{className:"flex-1 min-w-[80px] bg-transparent outline-none text-body-regular-1 text-text-primary placeholder:text-text-placeholder",placeholder:b.length===0?E:void 0})})]})}),jsxs(m,{container:G,children:[jsx(q,{status:j$1||s$1===void 0?"pending":s$1?.length===0&&!p?"empty":null}),jsxs(s,{children:[s$1?.map(e=>jsx(w,{value:e,children:jsxs("div",{className:"flex items-center gap-2 w-full min-w-0",children:[e.image&&jsx("img",{src:e.image,alt:e.label,className:"size-6 rounded-full object-cover shrink-0"}),jsx("span",{className:"truncate",children:e.label})]})},e.value)),p&&jsx(w,{value:{label:a$2,value:a$2,tag:true},children:jsxs("div",{className:"flex items-center gap-1.5 w-full min-w-0",children:[!A&&jsx("span",{className:"text-text-secondary",children:"Create:"}),jsx("span",{className:"font-medium text-text-primary truncate",children:a$2})]})}),jsx(F,{...T})]})]})]})}export{Z as a};//# sourceMappingURL=chunk-FE2732UW.js.map
2
- //# sourceMappingURL=chunk-FE2732UW.js.map
1
+ import {a,j,i,k,l,m,q,s,w,F}from'./chunk-GNQKITNA.js';import {a as a$1}from'./chunk-JH6RZ3QH.js';import {f,g}from'./chunk-ZNZVX4PT.js';import*as u from'react';import {cn}from'@xploreu/lib/cn';import {useControlledState}from'@xploreu/hooks/use-controlled-state';import {jsxs,jsx,Fragment}from'react/jsx-runtime';function Z({multiple:z=true,inputPlaceholder:E="Search...",container:G,items:s$1,infiniteScroll:T,isPending:j$1,taggable:c=false,maxVisible:i$1,...m$1}){let[q$1,O]=useControlledState({value:m$1?.inputValue?.toString(),defaultValue:m$1?.defaultInputValue?.toString(),onChange:m$1?.onInputValueChange}),[b,g$1]=useControlledState({value:m$1?.value??[],defaultValue:m$1?.defaultValue??[],onChange:m$1?.onValueChange}),[h,V]=u.useState([]),C=u.useRef(new Set);u.useEffect(()=>{let e=new Set(b.map(n=>n.value));V(n=>{let l=n.filter(o=>e.has(o.value));return l.length===n.length?n:(C.current=new Set(l.map(o=>o.value)),l)});},[b]);let a$2=q$1?.toString().trim()??"",A=u.useMemo(()=>a$2?b.some(e=>e.value.toLowerCase()===a$2.toLowerCase()):false,[a$2,b]),p=u.useMemo(()=>!c||!a$2?false:!s$1?.some(e=>e.label.toLowerCase()===a$2.toLowerCase()),[c,a$2,s$1]),B=u.useMemo(()=>{let e=[...s$1??[],...h];return p?[...e,{label:a$2,value:a$2,tag:true}]:e},[s$1,h,p,a$2]);return jsxs(a,{...m$1,behavior:"chip-outside",multiple:true,items:c?B:s$1,isItemEqualToValue:(e,n)=>e.value===n.value,onValueChange:(e,n)=>{if(c){let l=e.filter(o=>o?.tag===true&&!C.current.has(o.value));if(l.length>0){for(let o of l)C.current.add(o.value);V(o=>[...o,...l]);}}g$1(z?e:[e[e.length-1]],n);},onInputValueChange:O,children:[jsx(f,{className:cn(a$1(),"h-auto min-h-13 flex flex-wrap items-center gap-1.5 px-3 py-1.5 cursor-text"),children:jsxs(j,{className:cn("contents",i$1!==void 0&&"flex-nowrap overflow-hidden"),children:[jsx(i,{children:e=>{let n=i$1!==void 0?e.slice(0,i$1):e,l$1=i$1!==void 0?e.length-i$1:0;return jsxs(Fragment,{children:[n?.map(o=>jsxs(k,{className:cn(i$1!==void 0&&"min-w-0 shrink"),children:[o?.image&&jsx("img",{src:o.image,alt:o?.label||"",className:"size-4 rounded-full object-cover shrink-0 mr-1"}),i$1!==void 0?jsx("span",{className:"truncate",children:o?.label||""}):o?.label||"",jsx(l,{})]},o?.value||"")),l$1>0&&jsxs(k,{className:"shrink-0",children:["+",l$1]})]})}}),jsx(g,{render:jsx("input",{className:"flex-1 min-w-[80px] bg-transparent outline-none text-body-regular-1 text-text-primary placeholder:text-text-placeholder",placeholder:b.length===0?E:void 0})})]})}),jsxs(m,{container:G,children:[jsx(q,{status:j$1||s$1===void 0?"pending":s$1?.length===0&&!p?"empty":null}),jsxs(s,{children:[s$1?.map(e=>jsx(w,{value:e,children:jsxs("div",{className:"flex items-center gap-2 w-full min-w-0",children:[e.image&&jsx("img",{src:e.image,alt:e.label,className:"size-6 rounded-full object-cover shrink-0"}),jsx("span",{className:"truncate",children:e.label})]})},e.value)),p&&jsx(w,{value:{label:a$2,value:a$2,tag:true},children:jsxs("div",{className:"flex items-center gap-1.5 w-full min-w-0",children:[!A&&jsx("span",{className:"text-text-secondary",children:"Create:"}),jsx("span",{className:"font-medium text-text-primary truncate",children:a$2})]})}),jsx(F,{...T})]})]})]})}export{Z as a};//# sourceMappingURL=chunk-C7KUNTTO.js.map
2
+ //# sourceMappingURL=chunk-C7KUNTTO.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/composites/combobox-chip.tsx"],"names":["ComboboxChip","multiple","inputPlaceholder","container","items","infiniteScroll","isPending","taggable","maxVisible","props","inputValue","setInputValue","useControlledState","value","setValue","createdItems","setCreatedItems","createdValuesRef","currentValues","v","prev","next","item","trimmedInput","isInputSelected","isCreatingItem","combinedItems","base","jsxs","Combobox","a","b","eventDetails","newTags","tag","jsx","ComboboxInputGroup","cn","inputVariants","ComboboxChips","ComboboxValue","visible","overflow","Fragment","ComboboxChipRemove","ComboboxInput","ComboboxPopup","ComboboxStatus","ComboboxList","ComboboxItem","ComboboxInfiniteScroll"],"mappings":"uTA6CA,SAASA,CAAAA,CAAyF,CAChG,QAAA,CAAAC,EAAW,IAAA,CACX,gBAAA,CAAAC,CAAAA,CAAmB,WAAA,CACnB,SAAA,CAAAC,CAAAA,CACA,KAAA,CAAAC,GAAAA,CACA,eAAAC,CAAAA,CACA,SAAA,CAAAC,GAAAA,CACA,QAAA,CAAAC,CAAAA,CAAW,KAAA,CACX,UAAA,CAAAC,GAAAA,CACA,GAAGC,GACL,CAAA,CAA6B,CAC3B,GAAM,CAACC,GAAAA,CAAYC,CAAa,CAAA,CAAIC,mBAAmB,CACrD,KAAA,CAAOH,GAAAA,EAAO,UAAA,EAAY,QAAA,EAAS,CACnC,YAAA,CAAcA,GAAAA,EAAO,mBAAmB,QAAA,EAAS,CACjD,QAAA,CAAUA,GAAAA,EAAO,kBACnB,CAAC,CAAA,CAEK,CAACI,EAAOC,GAAQ,CAAA,CAAIF,kBAAAA,CAAmB,CAC3C,KAAA,CAAOH,GAAAA,EAAO,KAAA,EAAS,GACvB,YAAA,CAAcA,GAAAA,EAAO,YAAA,EAAgB,EAAC,CACtC,QAAA,CAAUA,GAAAA,EAAO,aACnB,CAAC,CAAA,CAIK,CAACM,CAAAA,CAAcC,CAAe,CAAA,CAAU,CAAA,CAAA,QAAA,CAAkB,EAAE,EAC5DC,CAAAA,CAAyB,CAAA,CAAA,MAAA,CAAoB,IAAI,GAAK,CAAA,CAEtD,CAAA,CAAA,SAAA,CAAU,IAAM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AAK,CAAA,CAE7D,QAAA,CAAAK,IAAAA,CAAC,OAAI,SAAA,CAAU,0CAAA,CACZ,QAAA,CAAA,CAAA,CAACJ,CAAAA,EACAW,GAAAA,CAAC,MAAA,CAAA,CAAK,SAAA,CAAU,qBAAA,CAAsB,mBAAO,CAAA,CAE/CA,GAAAA,CAAC,MAAA,CAAA,CAAK,SAAA,CAAU,wCAAA,CACb,QAAA,CAAAZ,GAAAA,CACH,CAAA,CAAA,CACF,EACF,CAAA,CAEFY,GAAAA,CAACe,CAAAA,CAAA,CAAwB,GAAG7C,CAAAA,CAAgB,CAAA,CAAA,CAC9C,CAAA,CAAA,CACF,GACF,CAEJ","file":"chunk-FE2732UW.js","sourcesContent":["import * as React from \"react\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport {\r\n ComboboxInput as ComboboxInputPrimitive,\r\n ComboboxInputGroup,\r\n} from \"../primitives/combobox\"\r\nimport {\r\n Combobox,\r\n ComboboxChip as ComboboxChipUI,\r\n ComboboxChipRemove,\r\n ComboboxChips,\r\n ComboboxInfiniteScroll,\r\n ComboboxItem,\r\n ComboboxList,\r\n ComboboxPortal,\r\n ComboboxPopup,\r\n ComboboxStatus,\r\n ComboboxValue,\r\n type ComboboxProps\r\n} from \"../ui/combobox\"\r\nimport { useControlledState } from \"@xploreu/hooks/use-controlled-state\"\r\nimport { inputVariants } from \"../ui/input\"\r\n\r\ntype ComboboxChipProps<Value> = Omit<ComboboxProps<Value, true>, \"multiple\"> & {\r\n multiple?: boolean\r\n inputPlaceholder?: string\r\n container?: React.ComponentProps<typeof ComboboxPortal>[\"container\"]\r\n items: ({ label: string; value: string; image?: string }[]) | undefined\r\n infiniteScroll?: React.ComponentProps<typeof ComboboxInfiniteScroll>\r\n isPending?: boolean\r\n /**\r\n * When true, enables creatable / taggable mode.\r\n * If the typed value has no exact match in the current item list,\r\n * a \"Create \\\"…\\\"\" option is shown at the top of the dropdown.\r\n * Created items are appended to the value with `{ label, value, tag: true }`.\r\n */\r\n taggable?: boolean\r\n /**\r\n * Maximum number of chips to show before collapsing the rest into a \"+N\" chip.\r\n * When undefined, all chips are shown.\r\n */\r\n maxVisible?: number\r\n}\r\n\r\nfunction ComboboxChip<Value extends { label: string; value: string; image?: string; tag?: true }>({\r\n multiple = true,\r\n inputPlaceholder = \"Search...\",\r\n container,\r\n items,\r\n infiniteScroll,\r\n isPending,\r\n taggable = false,\r\n maxVisible,\r\n ...props\r\n}: ComboboxChipProps<Value>) {\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 [value, setValue] = useControlledState({\r\n value: props?.value ?? [],\r\n defaultValue: props?.defaultValue ?? [],\r\n onChange: props?.onValueChange,\r\n })\r\n\r\n // Track items created via taggable mode\r\n // Sync with value to avoid stale tags when controlled value is reset from outside\r\n const [createdItems, setCreatedItems] = React.useState<Value[]>([])\r\n const createdValuesRef = React.useRef<Set<string>>(new Set())\r\n\r\n React.useEffect(() => {\r\n const currentValues = new Set(value.map((v) => v.value))\r\n setCreatedItems((prev) => {\r\n const next = prev.filter((item) => currentValues.has(item.value))\r\n if (next.length === prev.length) return prev\r\n createdValuesRef.current = new Set(next.map((v) => v.value))\r\n return next\r\n })\r\n }, [value])\r\n\r\n const trimmedInput = inputValue?.toString().trim() ?? \"\"\r\n const isInputSelected = React.useMemo(() => {\r\n if (!trimmedInput) return false\r\n return value.some(\r\n (item) => item.value.toLowerCase() === trimmedInput.toLowerCase()\r\n )\r\n }, [trimmedInput, value])\r\n\r\n // true = show the taggable item in dropdown (either as \"Create:\" or as checked item)\r\n const isCreatingItem = React.useMemo(() => {\r\n if (!taggable || !trimmedInput) return false\r\n return !items?.some(\r\n (item) => item.label.toLowerCase() === trimmedInput.toLowerCase()\r\n )\r\n }, [taggable, trimmedInput, items])\r\n\r\n // Merge server items with locally created tags + the \"Create\" placeholder\r\n const combinedItems = React.useMemo(() => {\r\n const base: Value[] = [\r\n ...items ?? [],\r\n ...createdItems,\r\n ]\r\n\r\n if (isCreatingItem) {\r\n return [...base, { label: trimmedInput, value: trimmedInput, tag: true } as unknown as Value]\r\n }\r\n\r\n return base\r\n }, [items, createdItems, isCreatingItem, trimmedInput])\r\n\r\n const handleValueChange: ComboboxProps<Value, true>[\"onValueChange\"] = (value, eventDetails) => {\r\n if (taggable) {\r\n const newTags = value.filter(\r\n (v) => v?.tag === true && !createdValuesRef.current.has(v.value)\r\n )\r\n if (newTags.length > 0) {\r\n for (const tag of newTags) {\r\n createdValuesRef.current.add(tag.value)\r\n }\r\n setCreatedItems((prev) => [...prev, ...newTags])\r\n }\r\n }\r\n\r\n if (!multiple) {\r\n setValue([value[value.length - 1]], eventDetails)\r\n } else {\r\n setValue(value, eventDetails)\r\n }\r\n }\r\n\r\n return (\r\n <Combobox\r\n {...props}\r\n behavior=\"chip-outside\"\r\n multiple\r\n items={taggable ? combinedItems : items}\r\n isItemEqualToValue={(a, b) => a.value === b.value}\r\n onValueChange={handleValueChange}\r\n onInputValueChange={setInputValue}\r\n >\r\n {/* Input box with chips inside */}\r\n <ComboboxInputGroup\r\n className={cn(\r\n inputVariants(),\r\n \"h-auto min-h-13 flex flex-wrap items-center gap-1.5 px-3 py-1.5 cursor-text\"\r\n )}\r\n >\r\n {/* Chips inside the input box */}\r\n <ComboboxChips\r\n className={cn(\r\n \"contents\",\r\n maxVisible !== undefined && \"flex-nowrap overflow-hidden\"\r\n )}\r\n >\r\n <ComboboxValue>\r\n {(value: Value[]) => {\r\n const visible = maxVisible !== undefined ? value.slice(0, maxVisible) : value\r\n const overflow = maxVisible !== undefined ? value.length - maxVisible : 0\r\n return (\r\n <>\r\n {visible?.map((item) => (\r\n <ComboboxChipUI\r\n key={item?.value || \"\"}\r\n className={cn(maxVisible !== undefined && \"min-w-0 shrink\")}\r\n >\r\n {item?.image && (\r\n <img\r\n src={item.image}\r\n alt={item?.label || \"\"}\r\n className=\"size-4 rounded-full object-cover shrink-0 mr-1\"\r\n />\r\n )}\r\n {maxVisible !== undefined\r\n ? <span className=\"truncate\">{item?.label || \"\"}</span>\r\n : (item?.label || \"\")\r\n }\r\n <ComboboxChipRemove />\r\n </ComboboxChipUI>\r\n ))}\r\n {overflow > 0 && (\r\n <ComboboxChipUI className=\"shrink-0\">\r\n +{overflow}\r\n </ComboboxChipUI>\r\n )}\r\n </>\r\n )\r\n }}\r\n </ComboboxValue>\r\n {/* Text input — shrinks to fit remaining space (inside Chips so backspace works) */}\r\n <ComboboxInputPrimitive\r\n render={\r\n <input\r\n className=\"flex-1 min-w-[80px] bg-transparent outline-none text-body-regular-1 text-text-primary placeholder:text-text-placeholder\"\r\n placeholder={value.length === 0 ? inputPlaceholder : undefined}\r\n />\r\n }\r\n />\r\n </ComboboxChips>\r\n </ComboboxInputGroup>\r\n\r\n <ComboboxPopup container={container}>\r\n <ComboboxStatus\r\n status={\r\n isPending || items === undefined\r\n ? \"pending\"\r\n : items?.length === 0 && !isCreatingItem\r\n ? \"empty\"\r\n : null\r\n }\r\n />\r\n <ComboboxList>\r\n {items?.map((item) => (\r\n <ComboboxItem\r\n key={item.value}\r\n value={item as Value}\r\n >\r\n <div className=\"flex items-center gap-2 w-full min-w-0\">\r\n {item.image && (\r\n <img\r\n src={item.image}\r\n alt={item.label}\r\n className=\"size-6 rounded-full object-cover shrink-0\"\r\n />\r\n )}\r\n <span className=\"truncate\">{item.label}</span>\r\n </div>\r\n </ComboboxItem>\r\n ))}\r\n {isCreatingItem && (\r\n <ComboboxItem\r\n value={{ label: trimmedInput, value: trimmedInput, tag: true }}\r\n >\r\n <div className=\"flex items-center gap-1.5 w-full min-w-0\">\r\n {!isInputSelected && (\r\n <span className=\"text-text-secondary\">Create:</span>\r\n )}\r\n <span className=\"font-medium text-text-primary truncate\">\r\n {trimmedInput}\r\n </span>\r\n </div>\r\n </ComboboxItem>\r\n )}\r\n <ComboboxInfiniteScroll {...infiniteScroll} />\r\n </ComboboxList>\r\n </ComboboxPopup>\r\n </Combobox>\r\n )\r\n}\r\n\r\nexport { ComboboxChip }\r\nexport type { ComboboxChipProps }\r\n"]}
1
+ {"version":3,"sources":["../src/composites/combobox-chip.tsx"],"names":["ComboboxChip","multiple","inputPlaceholder","container","items","infiniteScroll","isPending","taggable","maxVisible","props","inputValue","setInputValue","useControlledState","value","setValue","createdItems","setCreatedItems","createdValuesRef","currentValues","v","prev","next","item","trimmedInput","isInputSelected","isCreatingItem","combinedItems","base","jsxs","Combobox","a","b","eventDetails","newTags","tag","jsx","ComboboxInputGroup","cn","inputVariants","ComboboxChips","ComboboxValue","visible","overflow","Fragment","ComboboxChipRemove","ComboboxInput","ComboboxPopup","ComboboxStatus","ComboboxList","ComboboxItem","ComboboxInfiniteScroll"],"mappings":"uTA6CA,SAASA,CAAAA,CAAyF,CAChG,QAAA,CAAAC,EAAW,IAAA,CACX,gBAAA,CAAAC,CAAAA,CAAmB,WAAA,CACnB,SAAA,CAAAC,CAAAA,CACA,KAAA,CAAAC,GAAAA,CACA,eAAAC,CAAAA,CACA,SAAA,CAAAC,GAAAA,CACA,QAAA,CAAAC,CAAAA,CAAW,KAAA,CACX,UAAA,CAAAC,GAAAA,CACA,GAAGC,GACL,CAAA,CAA6B,CAC3B,GAAM,CAACC,GAAAA,CAAYC,CAAa,CAAA,CAAIC,mBAAmB,CACrD,KAAA,CAAOH,GAAAA,EAAO,UAAA,EAAY,QAAA,EAAS,CACnC,YAAA,CAAcA,GAAAA,EAAO,mBAAmB,QAAA,EAAS,CACjD,QAAA,CAAUA,GAAAA,EAAO,kBACnB,CAAC,CAAA,CAEK,CAACI,EAAOC,GAAQ,CAAA,CAAIF,kBAAAA,CAAmB,CAC3C,KAAA,CAAOH,GAAAA,EAAO,KAAA,EAAS,GACvB,YAAA,CAAcA,GAAAA,EAAO,YAAA,EAAgB,EAAC,CACtC,QAAA,CAAUA,GAAAA,EAAO,aACnB,CAAC,CAAA,CAIK,CAACM,CAAAA,CAAcC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AAK,KAaZ,CACD,CAAA,CACAG,CAAAA,EACCU,GAAAA,CAACc,CAAAA,CAAA,CACC,KAAA,CAAO,CAAE,MAAO1B,GAAAA,CAAc,KAAA,CAAOA,GAAAA,CAAc,GAAA,CAAK,IAAK,CAAA,CAE7D,QAAA,CAAAK,IAAAA,CAAC,OAAI,SAAA,CAAU,0CAAA,CACZ,QAAA,CAAA,CAAA,CAACJ,CAAAA,EACAW,GAAAA,CAAC,MAAA,CAAA,CAAK,SAAA,CAAU,qBAAA,CAAsB,mBAAO,CAAA,CAE/CA,GAAAA,CAAC,MAAA,CAAA,CAAK,SAAA,CAAU,wCAAA,CACb,QAAA,CAAAZ,GAAAA,CACH,CAAA,CAAA,CACF,EACF,CAAA,CAEFY,GAAAA,CAACe,CAAAA,CAAA,CAAwB,GAAG7C,CAAAA,CAAgB,CAAA,CAAA,CAC9C,CAAA,CAAA,CACF,GACF,CAEJ","file":"chunk-C7KUNTTO.js","sourcesContent":["import * as React from \"react\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport {\r\n ComboboxInput as ComboboxInputPrimitive,\r\n ComboboxInputGroup,\r\n} from \"../primitives/combobox\"\r\nimport {\r\n Combobox,\r\n ComboboxChip as ComboboxChipUI,\r\n ComboboxChipRemove,\r\n ComboboxChips,\r\n ComboboxInfiniteScroll,\r\n ComboboxItem,\r\n ComboboxList,\r\n ComboboxPortal,\r\n ComboboxPopup,\r\n ComboboxStatus,\r\n ComboboxValue,\r\n type ComboboxProps\r\n} from \"../ui/combobox\"\r\nimport { useControlledState } from \"@xploreu/hooks/use-controlled-state\"\r\nimport { inputVariants } from \"../ui/input\"\r\n\r\ntype ComboboxChipProps<Value> = Omit<ComboboxProps<Value, true>, \"multiple\"> & {\r\n multiple?: boolean\r\n inputPlaceholder?: string\r\n container?: React.ComponentProps<typeof ComboboxPortal>[\"container\"]\r\n items: ({ label: string; value: string; image?: string }[]) | undefined\r\n infiniteScroll?: React.ComponentProps<typeof ComboboxInfiniteScroll>\r\n isPending?: boolean\r\n /**\r\n * When true, enables creatable / taggable mode.\r\n * If the typed value has no exact match in the current item list,\r\n * a \"Create \\\"…\\\"\" option is shown at the top of the dropdown.\r\n * Created items are appended to the value with `{ label, value, tag: true }`.\r\n */\r\n taggable?: boolean\r\n /**\r\n * Maximum number of chips to show before collapsing the rest into a \"+N\" chip.\r\n * When undefined, all chips are shown.\r\n */\r\n maxVisible?: number\r\n}\r\n\r\nfunction ComboboxChip<Value extends { label: string; value: string; image?: string; tag?: true }>({\r\n multiple = true,\r\n inputPlaceholder = \"Search...\",\r\n container,\r\n items,\r\n infiniteScroll,\r\n isPending,\r\n taggable = false,\r\n maxVisible,\r\n ...props\r\n}: ComboboxChipProps<Value>) {\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 [value, setValue] = useControlledState({\r\n value: props?.value ?? [],\r\n defaultValue: props?.defaultValue ?? [],\r\n onChange: props?.onValueChange,\r\n })\r\n\r\n // Track items created via taggable mode\r\n // Sync with value to avoid stale tags when controlled value is reset from outside\r\n const [createdItems, setCreatedItems] = React.useState<Value[]>([])\r\n const createdValuesRef = React.useRef<Set<string>>(new Set())\r\n\r\n React.useEffect(() => {\r\n const currentValues = new Set(value.map((v) => v.value))\r\n setCreatedItems((prev) => {\r\n const next = prev.filter((item) => currentValues.has(item.value))\r\n if (next.length === prev.length) return prev\r\n createdValuesRef.current = new Set(next.map((v) => v.value))\r\n return next\r\n })\r\n }, [value])\r\n\r\n const trimmedInput = inputValue?.toString().trim() ?? \"\"\r\n const isInputSelected = React.useMemo(() => {\r\n if (!trimmedInput) return false\r\n return value.some(\r\n (item) => item.value.toLowerCase() === trimmedInput.toLowerCase()\r\n )\r\n }, [trimmedInput, value])\r\n\r\n // true = show the taggable item in dropdown (either as \"Create:\" or as checked item)\r\n const isCreatingItem = React.useMemo(() => {\r\n if (!taggable || !trimmedInput) return false\r\n return !items?.some(\r\n (item) => item.label.toLowerCase() === trimmedInput.toLowerCase()\r\n )\r\n }, [taggable, trimmedInput, items])\r\n\r\n // Merge server items with locally created tags + the \"Create\" placeholder\r\n const combinedItems = React.useMemo(() => {\r\n const base: Value[] = [\r\n ...items ?? [],\r\n ...createdItems,\r\n ]\r\n\r\n if (isCreatingItem) {\r\n return [...base, { label: trimmedInput, value: trimmedInput, tag: true } as unknown as Value]\r\n }\r\n\r\n return base\r\n }, [items, createdItems, isCreatingItem, trimmedInput])\r\n\r\n const handleValueChange: ComboboxProps<Value, true>[\"onValueChange\"] = (value, eventDetails) => {\r\n if (taggable) {\r\n const newTags = value.filter(\r\n (v) => v?.tag === true && !createdValuesRef.current.has(v.value)\r\n )\r\n if (newTags.length > 0) {\r\n for (const tag of newTags) {\r\n createdValuesRef.current.add(tag.value)\r\n }\r\n setCreatedItems((prev) => [...prev, ...newTags])\r\n }\r\n }\r\n\r\n if (!multiple) {\r\n setValue([value[value.length - 1]], eventDetails)\r\n } else {\r\n setValue(value, eventDetails)\r\n }\r\n }\r\n\r\n return (\r\n <Combobox\r\n {...props}\r\n behavior=\"chip-outside\"\r\n multiple\r\n items={taggable ? combinedItems : items}\r\n isItemEqualToValue={(a, b) => a.value === b.value}\r\n onValueChange={handleValueChange}\r\n onInputValueChange={setInputValue}\r\n >\r\n {/* Input box with chips inside */}\r\n <ComboboxInputGroup\r\n className={cn(\r\n inputVariants(),\r\n \"h-auto min-h-13 flex flex-wrap items-center gap-1.5 px-3 py-1.5 cursor-text\"\r\n )}\r\n >\r\n {/* Chips inside the input box */}\r\n <ComboboxChips\r\n className={cn(\r\n \"contents\",\r\n maxVisible !== undefined && \"flex-nowrap overflow-hidden\"\r\n )}\r\n >\r\n <ComboboxValue>\r\n {(value: Value[]) => {\r\n const visible = maxVisible !== undefined ? value.slice(0, maxVisible) : value\r\n const overflow = maxVisible !== undefined ? value.length - maxVisible : 0\r\n return (\r\n <>\r\n {visible?.map((item) => (\r\n <ComboboxChipUI\r\n key={item?.value || \"\"}\r\n className={cn(maxVisible !== undefined && \"min-w-0 shrink\")}\r\n >\r\n {item?.image && (\r\n <img\r\n src={item.image}\r\n alt={item?.label || \"\"}\r\n className=\"size-4 rounded-full object-cover shrink-0 mr-1\"\r\n />\r\n )}\r\n {maxVisible !== undefined\r\n ? <span className=\"truncate\">{item?.label || \"\"}</span>\r\n : (item?.label || \"\")\r\n }\r\n <ComboboxChipRemove />\r\n </ComboboxChipUI>\r\n ))}\r\n {overflow > 0 && (\r\n <ComboboxChipUI className=\"shrink-0\">\r\n +{overflow}\r\n </ComboboxChipUI>\r\n )}\r\n </>\r\n )\r\n }}\r\n </ComboboxValue>\r\n {/* Text input — shrinks to fit remaining space (inside Chips so backspace works) */}\r\n <ComboboxInputPrimitive\r\n render={\r\n <input\r\n className=\"flex-1 min-w-[80px] bg-transparent outline-none text-body-regular-1 text-text-primary placeholder:text-text-placeholder\"\r\n placeholder={value.length === 0 ? inputPlaceholder : undefined}\r\n />\r\n }\r\n />\r\n </ComboboxChips>\r\n </ComboboxInputGroup>\r\n\r\n <ComboboxPopup container={container}>\r\n <ComboboxStatus\r\n status={\r\n isPending || items === undefined\r\n ? \"pending\"\r\n : items?.length === 0 && !isCreatingItem\r\n ? \"empty\"\r\n : null\r\n }\r\n />\r\n <ComboboxList>\r\n {items?.map((item) => (\r\n <ComboboxItem\r\n key={item.value}\r\n value={item as Value}\r\n >\r\n <div className=\"flex items-center gap-2 w-full min-w-0\">\r\n {item.image && (\r\n <img\r\n src={item.image}\r\n alt={item.label}\r\n className=\"size-6 rounded-full object-cover shrink-0\"\r\n />\r\n )}\r\n <span className=\"truncate\">{item.label}</span>\r\n </div>\r\n </ComboboxItem>\r\n ))}\r\n {isCreatingItem && (\r\n <ComboboxItem\r\n value={{ label: trimmedInput, value: trimmedInput, tag: true }}\r\n >\r\n <div className=\"flex items-center gap-1.5 w-full min-w-0\">\r\n {!isInputSelected && (\r\n <span className=\"text-text-secondary\">Create:</span>\r\n )}\r\n <span className=\"font-medium text-text-primary truncate\">\r\n {trimmedInput}\r\n </span>\r\n </div>\r\n </ComboboxItem>\r\n )}\r\n <ComboboxInfiniteScroll {...infiniteScroll} />\r\n </ComboboxList>\r\n </ComboboxPopup>\r\n </Combobox>\r\n )\r\n}\r\n\r\nexport { ComboboxChip }\r\nexport type { ComboboxChipProps }\r\n"]}
@@ -0,0 +1,2 @@
1
+ import'react';import {Tooltip}from'@base-ui/react/tooltip';import {useMotionValue,AnimatePresence,useSpring,motion}from'motion/react';import {useControlledState}from'@xploreu/hooks/use-controlled-state';import {getStrictContext}from'@xploreu/lib/get-strict-context';import {jsx}from'react/jsx-runtime';var [C,u]=getStrictContext("TooltipContext");function R(o){return jsx(Tooltip.Provider,{"data-slot":"tooltip-provider",...o})}function S({followCursor:o=false,followCursorSpringOptions:n={stiffness:200,damping:17},...p}){let[a,e]=useControlledState({value:p?.open,defaultValue:p?.defaultOpen,onChange:p?.onOpenChange}),r=useMotionValue(0),i=useMotionValue(0);return jsx(C,{value:{isOpen:a,setIsOpen:e,x:r,y:i,followCursor:o,followCursorSpringOptions:n},children:jsx(Tooltip.Root,{"data-slot":"tooltip",...p,onOpenChange:e})})}function h({onMouseMove:o,...n}){let{x:p,y:a,followCursor:e}=u(),r=i=>{o?.(i);let s=i.currentTarget.getBoundingClientRect();if(e==="x"||e===true){let T=(i.clientX-s.left-s.width/2)/2;p.set(T);}if(e==="y"||e===true){let T=(i.clientY-s.top-s.height/2)/2;a.set(T);}};return jsx(Tooltip.Trigger,{"data-slot":"tooltip-trigger",onMouseMove:r,...n})}function A(o){let{isOpen:n}=u();return jsx(AnimatePresence,{children:n&&jsx(Tooltip.Portal,{keepMounted:true,"data-slot":"tooltip-portal",...o})})}function b(o){return jsx(Tooltip.Positioner,{"data-slot":"tooltip-positioner",...o})}function V({transition:o={type:"spring",stiffness:300,damping:25},style:n,...p}){let{x:a,y:e,followCursor:r,followCursorSpringOptions:i}=u(),s=useSpring(a,i),P=useSpring(e,i);return jsx(Tooltip.Popup,{render:jsx(motion.div,{"data-slot":"tooltip-popup",initial:{opacity:0,scale:.5},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.5},transition:o,style:{x:r==="x"||r===true?s:void 0,y:r==="y"||r===true?P:void 0,...n},...p},"tooltip-popup")})}function X(o){return jsx(Tooltip.Arrow,{"data-slot":"tooltip-arrow",...o})}export{u as a,R as b,S as c,h as d,A as e,b as f,V as g,X as h};//# sourceMappingURL=chunk-DX767LBV.js.map
2
+ //# sourceMappingURL=chunk-DX767LBV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/primitives/tooltip.tsx"],"names":["LocalTooltipProvider","useTooltip","getStrictContext","TooltipProvider","props","jsx","TooltipPrimitive","Tooltip","followCursor","followCursorSpringOptions","isOpen","setIsOpen","useControlledState","x","useMotionValue","y","TooltipTrigger","onMouseMove","handleMouseMove","event","target","offsetXFromCenter","offsetYFromCenter","TooltipPortal","AnimatePresence","TooltipPositioner","TooltipPopup","transition","style","translateX","useSpring","translateY","motion","TooltipArrow"],"mappings":"8SA0BA,IAAM,CAACA,CAAAA,CAAsBC,CAAU,EACrCC,gBAAAA,CAAqC,gBAAgB,EAMvD,SAASC,CAAAA,CAAgBC,EAA6B,CACpD,OAAOC,IAACC,OAAAA,CAAiB,QAAA,CAAjB,CAA0B,WAAA,CAAU,kBAAA,CAAoB,GAAGF,CAAAA,CAAO,CAC5E,CAOA,SAASG,EAAQ,CACf,YAAA,CAAAC,EAAe,KAAA,CACf,yBAAA,CAAAC,EAA4B,CAAE,SAAA,CAAW,IAAK,OAAA,CAAS,EAAG,EAC1D,GAAGL,CACL,EAAiB,CACf,GAAM,CAACM,CAAAA,CAAQC,CAAS,EAAIC,kBAAAA,CAAmB,CAC7C,MAAOR,CAAAA,EAAO,IAAA,CACd,aAAcA,CAAAA,EAAO,WAAA,CACrB,SAAUA,CAAAA,EAAO,YACnB,CAAC,CAAA,CACKS,CAAA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,EACA,MAAA,CACN,CAAA,CACErB,IAAiB,GAAA,EAAOA,CAAAA,GAAiB,KACrCuB,CAAAA,CACA,MAAA,CACN,GAAGH,CACL,CAAA,CACC,GAAGxB,CAAAA,CAAAA,CAjBA,eAkBN,EAEJ,CAEJ,CAIA,SAAS6B,CAAAA,CAAa7B,CAAAA,CAA0B,CAC9C,OAAOC,GAAAA,CAACC,QAAiB,KAAA,CAAjB,CAAuB,YAAU,eAAA,CAAiB,GAAGF,EAAO,CACtE","file":"chunk-DX767LBV.js","sourcesContent":["'use client';\r\n\r\nimport * as React from 'react';\r\nimport { Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip';\r\nimport {\r\n AnimatePresence,\r\n motion,\r\n useMotionValue,\r\n useSpring,\r\n type HTMLMotionProps,\r\n type MotionValue,\r\n type SpringOptions,\r\n} from 'motion/react';\r\n\r\nimport { useControlledState } from '@xploreu/hooks/use-controlled-state';\r\nimport { getStrictContext } from '@xploreu/lib/get-strict-context';\r\n\r\ntype TooltipContextType = {\r\n isOpen: boolean;\r\n setIsOpen: TooltipProps['onOpenChange'];\r\n x: MotionValue<number>;\r\n y: MotionValue<number>;\r\n followCursor?: boolean | 'x' | 'y';\r\n followCursorSpringOptions?: SpringOptions;\r\n};\r\n\r\nconst [LocalTooltipProvider, useTooltip] =\r\n getStrictContext<TooltipContextType>('TooltipContext');\r\n\r\ntype TooltipProviderProps = React.ComponentProps<\r\n typeof TooltipPrimitive.Provider\r\n>;\r\n\r\nfunction TooltipProvider(props: TooltipProviderProps) {\r\n return <TooltipPrimitive.Provider data-slot=\"tooltip-provider\" {...props} />;\r\n}\r\n\r\ntype TooltipProps = React.ComponentProps<typeof TooltipPrimitive.Root> & {\r\n followCursor?: boolean | 'x' | 'y';\r\n followCursorSpringOptions?: SpringOptions;\r\n};\r\n\r\nfunction Tooltip({\r\n followCursor = false,\r\n followCursorSpringOptions = { stiffness: 200, damping: 17 },\r\n ...props\r\n}: TooltipProps) {\r\n const [isOpen, setIsOpen] = useControlledState({\r\n value: props?.open,\r\n defaultValue: props?.defaultOpen,\r\n onChange: props?.onOpenChange,\r\n });\r\n const x = useMotionValue(0);\r\n const y = useMotionValue(0);\r\n\r\n return (\r\n <LocalTooltipProvider\r\n value={{\r\n isOpen,\r\n setIsOpen,\r\n x,\r\n y,\r\n followCursor,\r\n followCursorSpringOptions,\r\n }}\r\n >\r\n <TooltipPrimitive.Root\r\n data-slot=\"tooltip\"\r\n {...props}\r\n onOpenChange={setIsOpen}\r\n />\r\n </LocalTooltipProvider>\r\n );\r\n}\r\n\r\ntype TooltipTriggerProps = React.ComponentProps<\r\n typeof TooltipPrimitive.Trigger\r\n>;\r\n\r\nfunction TooltipTrigger({ onMouseMove, ...props }: TooltipTriggerProps) {\r\n const { x, y, followCursor } = useTooltip();\r\n\r\n const handleMouseMove = (\r\n event: Parameters<NonNullable<TooltipTriggerProps['onMouseMove']>>[0],\r\n ) => {\r\n onMouseMove?.(event);\r\n\r\n const target = event.currentTarget.getBoundingClientRect();\r\n\r\n if (followCursor === 'x' || followCursor === true) {\r\n const eventOffsetX = event.clientX - target.left;\r\n const offsetXFromCenter = (eventOffsetX - target.width / 2) / 2;\r\n x.set(offsetXFromCenter);\r\n }\r\n\r\n if (followCursor === 'y' || followCursor === true) {\r\n const eventOffsetY = event.clientY - target.top;\r\n const offsetYFromCenter = (eventOffsetY - target.height / 2) / 2;\r\n y.set(offsetYFromCenter);\r\n }\r\n };\r\n\r\n return (\r\n <TooltipPrimitive.Trigger\r\n data-slot=\"tooltip-trigger\"\r\n onMouseMove={handleMouseMove}\r\n {...props}\r\n />\r\n );\r\n}\r\n\r\ntype TooltipPortalProps = Omit<\r\n React.ComponentProps<typeof TooltipPrimitive.Portal>,\r\n 'keepMounted'\r\n>;\r\n\r\nfunction TooltipPortal(props: TooltipPortalProps) {\r\n const { isOpen } = useTooltip();\r\n\r\n return (\r\n <AnimatePresence>\r\n {isOpen && (\r\n <TooltipPrimitive.Portal\r\n keepMounted\r\n data-slot=\"tooltip-portal\"\r\n {...props}\r\n />\r\n )}\r\n </AnimatePresence>\r\n );\r\n}\r\n\r\ntype TooltipPositionerProps = React.ComponentProps<\r\n typeof TooltipPrimitive.Positioner\r\n>;\r\n\r\nfunction TooltipPositioner(props: TooltipPositionerProps) {\r\n return (\r\n <TooltipPrimitive.Positioner data-slot=\"tooltip-positioner\" {...props} />\r\n );\r\n}\r\n\r\ntype TooltipPopupProps = Omit<\r\n React.ComponentProps<typeof TooltipPrimitive.Popup>,\r\n 'render'\r\n> &\r\n HTMLMotionProps<'div'>;\r\n\r\nfunction TooltipPopup({\r\n transition = { type: 'spring', stiffness: 300, damping: 25 },\r\n style,\r\n ...props\r\n}: TooltipPopupProps) {\r\n const { x, y, followCursor, followCursorSpringOptions } = useTooltip();\r\n const translateX = useSpring(x, followCursorSpringOptions);\r\n const translateY = useSpring(y, followCursorSpringOptions);\r\n\r\n return (\r\n <TooltipPrimitive.Popup\r\n render={\r\n <motion.div\r\n key=\"tooltip-popup\"\r\n data-slot=\"tooltip-popup\"\r\n initial={{ opacity: 0, scale: 0.5 }}\r\n animate={{ opacity: 1, scale: 1 }}\r\n exit={{ opacity: 0, scale: 0.5 }}\r\n transition={transition}\r\n style={{\r\n x:\r\n followCursor === 'x' || followCursor === true\r\n ? translateX\r\n : undefined,\r\n y:\r\n followCursor === 'y' || followCursor === true\r\n ? translateY\r\n : undefined,\r\n ...style,\r\n }}\r\n {...props}\r\n />\r\n }\r\n />\r\n );\r\n}\r\n\r\ntype TooltipArrowProps = React.ComponentProps<typeof TooltipPrimitive.Arrow>;\r\n\r\nfunction TooltipArrow(props: TooltipArrowProps) {\r\n return <TooltipPrimitive.Arrow data-slot=\"tooltip-arrow\" {...props} />;\r\n}\r\n\r\nexport {\r\n TooltipProvider,\r\n Tooltip,\r\n TooltipTrigger,\r\n TooltipPortal,\r\n TooltipPositioner,\r\n TooltipPopup,\r\n TooltipArrow,\r\n useTooltip,\r\n type TooltipProviderProps,\r\n type TooltipProps,\r\n type TooltipTriggerProps,\r\n type TooltipPortalProps,\r\n type TooltipPositionerProps,\r\n type TooltipPopupProps,\r\n type TooltipArrowProps,\r\n type TooltipContextType,\r\n};\r\n"]}
@@ -1,2 +1,2 @@
1
- import {a,b,i,m,s,w}from'./chunk-EL7P7FN5.js';import*as l from'react';import {ChevronDownIcon,ChevronLeftIcon,ChevronRightIcon}from'lucide-react';import {cn}from'@xploreu/lib/cn';import {jsxs,Fragment,jsx}from'react/jsx-runtime';function j({page:r,pageSize:a$1,total:i$1,onPageChange:b$1,onPageSizeChange:n,pageSizeOptions:m$1=[10,20,50,100],showPageSize:c=true,showRange:d=true,className:C,...N}){let u=Math.max(1,Math.ceil(i$1/a$1)),h=i$1===0?0:(r-1)*a$1+1,P=Math.min(r*a$1,i$1),s$1=l.useMemo(()=>m$1.map(e=>({label:String(e),value:e})),[m$1]),I=l.useMemo(()=>s$1.find(e=>e.value===a$1)??s$1[0],[s$1,a$1]);return jsxs("div",{className:cn("flex w-full flex-col-reverse gap-3 mt-4 sm:flex-row sm:items-center sm:justify-between border-t border-border-primary pt-3 text-body-regular-2 text-text-secondary",C),"data-slot":"pagination",...N,children:[jsxs("div",{className:"flex items-center gap-2",children:[c&&n&&jsxs(Fragment,{children:[jsx("span",{className:"text-label-regular-3 text-text-tertiary",children:"Rows per page"}),jsxs(a,{items:s$1,value:I,onValueChange:e=>{e&&n&&n(e.value);},isItemEqualToValue:(e,w)=>e.value===w.value,children:[jsxs(b,{className:"h-8 gap-2 rounded-lg border border-border-primary bg-bg-primary px-3 text-label-semibold-3 text-text-primary hover:bg-bg-secondary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border-brand-primary","aria-label":"Rows per page",children:[jsx(i,{children:e=>e?e.label:String(a$1)}),jsx(ChevronDownIcon,{className:"size-3.5 text-text-tertiary"})]}),jsx(m,{className:"w-24",children:jsx(s,{children:s$1.map(e=>jsx(w,{value:e,children:e.label},e.value))})})]})]}),c&&d&&jsx("span",{className:"text-text-tertiary",children:"\xB7"}),d&&jsxs("span",{className:"text-label-regular-3 text-text-tertiary",children:[h,"\u2013",P," of ",i$1]})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{type:"button",disabled:r<=1,onClick:()=>b$1(r-1),className:"inline-flex size-8 cursor-pointer items-center justify-center rounded-lg border border-border-primary bg-bg-primary text-text-secondary transition-colors hover:bg-bg-secondary hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-40","aria-label":"Previous page",children:jsx(ChevronLeftIcon,{className:"size-4"})}),jsxs("span",{className:"px-2 text-label-semibold-3 text-text-primary",children:["Page ",r," / ",u]}),jsx("button",{type:"button",disabled:r>=u,onClick:()=>b$1(r+1),className:"inline-flex size-8 cursor-pointer items-center justify-center rounded-lg border border-border-primary bg-bg-primary text-text-secondary transition-colors hover:bg-bg-secondary hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-40","aria-label":"Next page",children:jsx(ChevronRightIcon,{className:"size-4"})})]})]})}export{j as a};//# sourceMappingURL=chunk-R4WEEB5H.js.map
2
- //# sourceMappingURL=chunk-R4WEEB5H.js.map
1
+ import {a,b,i,m,s,w}from'./chunk-GNQKITNA.js';import*as l from'react';import {ChevronDownIcon,ChevronLeftIcon,ChevronRightIcon}from'lucide-react';import {cn}from'@xploreu/lib/cn';import {jsxs,Fragment,jsx}from'react/jsx-runtime';function j({page:r,pageSize:a$1,total:i$1,onPageChange:b$1,onPageSizeChange:n,pageSizeOptions:m$1=[10,20,50,100],showPageSize:c=true,showRange:d=true,className:C,...N}){let u=Math.max(1,Math.ceil(i$1/a$1)),h=i$1===0?0:(r-1)*a$1+1,P=Math.min(r*a$1,i$1),s$1=l.useMemo(()=>m$1.map(e=>({label:String(e),value:e})),[m$1]),I=l.useMemo(()=>s$1.find(e=>e.value===a$1)??s$1[0],[s$1,a$1]);return jsxs("div",{className:cn("flex w-full flex-col-reverse gap-3 mt-4 sm:flex-row sm:items-center sm:justify-between border-t border-border-primary pt-3 text-body-regular-2 text-text-secondary",C),"data-slot":"pagination",...N,children:[jsxs("div",{className:"flex items-center gap-2",children:[c&&n&&jsxs(Fragment,{children:[jsx("span",{className:"text-label-regular-3 text-text-tertiary",children:"Rows per page"}),jsxs(a,{items:s$1,value:I,onValueChange:e=>{e&&n&&n(e.value);},isItemEqualToValue:(e,w)=>e.value===w.value,children:[jsxs(b,{className:"h-8 gap-2 rounded-lg border border-border-primary bg-bg-primary px-3 text-label-semibold-3 text-text-primary hover:bg-bg-secondary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border-brand-primary","aria-label":"Rows per page",children:[jsx(i,{children:e=>e?e.label:String(a$1)}),jsx(ChevronDownIcon,{className:"size-3.5 text-text-tertiary"})]}),jsx(m,{className:"w-24",children:jsx(s,{children:s$1.map(e=>jsx(w,{value:e,children:e.label},e.value))})})]})]}),c&&d&&jsx("span",{className:"text-text-tertiary",children:"\xB7"}),d&&jsxs("span",{className:"text-label-regular-3 text-text-tertiary",children:[h,"\u2013",P," of ",i$1]})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{type:"button",disabled:r<=1,onClick:()=>b$1(r-1),className:"inline-flex size-8 cursor-pointer items-center justify-center rounded-lg border border-border-primary bg-bg-primary text-text-secondary transition-colors hover:bg-bg-secondary hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-40","aria-label":"Previous page",children:jsx(ChevronLeftIcon,{className:"size-4"})}),jsxs("span",{className:"px-2 text-label-semibold-3 text-text-primary",children:["Page ",r," / ",u]}),jsx("button",{type:"button",disabled:r>=u,onClick:()=>b$1(r+1),className:"inline-flex size-8 cursor-pointer items-center justify-center rounded-lg border border-border-primary bg-bg-primary text-text-secondary transition-colors hover:bg-bg-secondary hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-40","aria-label":"Next page",children:jsx(ChevronRightIcon,{className:"size-4"})})]})]})}export{j as a};//# sourceMappingURL=chunk-F2QUDOBO.js.map
2
+ //# sourceMappingURL=chunk-F2QUDOBO.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ui/pagination.tsx"],"names":["Pagination","page","pageSize","total","onPageChange","onPageSizeChange","pageSizeOptions","showPageSize","showRange","className","props","totalPages","startItem","endItem","items","opt","selectedItem","item","jsxs","cn","Fragment","jsx","Combobox","a","b","ComboboxTrigger","ComboboxValue","val","ChevronDownIcon","ComboboxPopup","ComboboxList","ComboboxItem","ChevronLeftIcon","ChevronRightIcon"],"mappings":"qOA6BO,SAASA,CAAAA,CAAW,CACzB,KAAAC,CAAAA,CACA,QAAA,CAAAC,GAAAA,CACA,KAAA,CAAAC,IACA,YAAA,CAAAC,GAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,gBAAAC,GAAAA,CAAkB,CAAC,EAAA,CAAI,EAAA,CAAI,GAAI,GAAG,CAAA,CAClC,YAAA,CAAAC,CAAAA,CAAe,KACf,SAAA,CAAAC,CAAAA,CAAY,IAAA,CACZ,SAAA,CAAAC,EACA,GAAGC,CACL,CAAA,CAAoB,CAClB,IAAMC,CAAAA,CAAa,IAAA,CAAK,GAAA,CAAI,CAAA,CAAG,KAAK,IAAA,CAAKR,GAAAA,CAAQD,GAAQ,CAAC,EACpDU,CAAAA,CAAYT,GAAAA,GAAU,CAAA,CAAI,CAAA,CAAA,CAAKF,EAAO,CAAA,EAAKC,GAAAA,CAAW,CAAA,CACtDW,CAAAA,CAAU,KAAK,GAAA,CAAIZ,CAAAA,CAAOC,GAAAA,CAAUC,GAAK,EAEzCW,GAAAA,CAAoC,CAAA,CAAA,OAAA,CACxC,IAAMR,GAAAA,CAAgB,IAAKS,CAAAA,GAAS,CAAE,KAAA,CAAO,MAAA,CAAOA,CAAG,CAAA,CAAG,KAAA,CAAOA,CAAI,CAAA,CAAE,EACvE,CAACT,GAAe,CAClB,CAAA,CAEMU,EAAqB,CAAA,CAAA,OAAA,CACzB,IAAMF,GAAAA,CAAM,IAAA,CAAMG,GAASA,CAAAA,CAAK,KAAA,GAAUf,GAAQ,CAAA,EAAKY,IAAM,CAAC,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ightIcon } from \"lucide-react\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport {\r\n Combobox,\r\n ComboboxItem,\r\n ComboboxList,\r\n ComboboxPopup,\r\n ComboboxTrigger,\r\n ComboboxValue,\r\n} from \"./combobox\"\r\n\r\nexport interface PaginationProps extends React.ComponentProps<\"div\"> {\r\n page: number\r\n pageSize: number\r\n total: number\r\n onPageChange: (page: number) => void\r\n onPageSizeChange?: (pageSize: number) => void\r\n pageSizeOptions?: number[]\r\n showPageSize?: boolean\r\n showRange?: boolean\r\n}\r\n\r\ntype PageSizeOptionItem = {\r\n label: string\r\n value: number\r\n}\r\n\r\nexport function Pagination({\r\n page,\r\n pageSize,\r\n total,\r\n onPageChange,\r\n onPageSizeChange,\r\n pageSizeOptions = [10, 20, 50, 100],\r\n showPageSize = true,\r\n showRange = true,\r\n className,\r\n ...props\r\n}: PaginationProps) {\r\n const totalPages = Math.max(1, Math.ceil(total / pageSize))\r\n const startItem = total === 0 ? 0 : (page - 1) * pageSize + 1\r\n const endItem = Math.min(page * pageSize, total)\r\n\r\n const items: PageSizeOptionItem[] = React.useMemo(\r\n () => pageSizeOptions.map((opt) => ({ label: String(opt), value: opt })),\r\n [pageSizeOptions]\r\n )\r\n\r\n const selectedItem = React.useMemo(\r\n () => items.find((item) => item.value === pageSize) ?? items[0],\r\n [items, pageSize]\r\n )\r\n\r\n return (\r\n <div\r\n className={cn(\r\n \"flex w-full flex-col-reverse gap-3 mt-4 sm:flex-row sm:items-center sm:justify-between border-t border-border-primary pt-3 text-body-regular-2 text-text-secondary\",\r\n className\r\n )}\r\n data-slot=\"pagination\"\r\n {...props}\r\n >\r\n {/* Left: Rows per page & range */}\r\n <div className=\"flex items-center gap-2\">\r\n {showPageSize && onPageSizeChange && (\r\n <>\r\n <span className=\"text-label-regular-3 text-text-tertiary\">\r\n Rows per page\r\n </span>\r\n <Combobox<PageSizeOptionItem>\r\n items={items}\r\n value={selectedItem}\r\n onValueChange={(item) => {\r\n if (item && onPageSizeChange) {\r\n onPageSizeChange(item.value)\r\n }\r\n }}\r\n isItemEqualToValue={(a, b) => a.value === b.value}\r\n >\r\n <ComboboxTrigger\r\n className=\"h-8 gap-2 rounded-lg border border-border-primary bg-bg-primary px-3 text-label-semibold-3 text-text-primary hover:bg-bg-secondary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border-brand-primary\"\r\n aria-label=\"Rows per page\"\r\n >\r\n <ComboboxValue>\r\n {(val) => (val ? val.label : String(pageSize))}\r\n </ComboboxValue>\r\n <ChevronDownIcon className=\"size-3.5 text-text-tertiary\" />\r\n </ComboboxTrigger>\r\n\r\n <ComboboxPopup className=\"w-24\">\r\n <ComboboxList>\r\n {items.map((item) => (\r\n <ComboboxItem\r\n key={item.value}\r\n value={item}\r\n >\r\n {item.label}\r\n </ComboboxItem>\r\n ))}\r\n </ComboboxList>\r\n </ComboboxPopup>\r\n </Combobox>\r\n </>\r\n )}\r\n\r\n {showPageSize && showRange && (\r\n <span className=\"text-text-tertiary\">·</span>\r\n )}\r\n\r\n {showRange && (\r\n <span className=\"text-label-regular-3 text-text-tertiary\">\r\n {startItem}–{endItem} of {total}\r\n </span>\r\n )}\r\n </div>\r\n\r\n {/* Right: Page controls */}\r\n <div className=\"flex items-center gap-1\">\r\n <button\r\n type=\"button\"\r\n disabled={page <= 1}\r\n onClick={() => onPageChange(page - 1)}\r\n className=\"inline-flex size-8 cursor-pointer items-center justify-center rounded-lg border border-border-primary bg-bg-primary text-text-secondary transition-colors hover:bg-bg-secondary hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-40\"\r\n aria-label=\"Previous page\"\r\n >\r\n <ChevronLeftIcon className=\"size-4\" />\r\n </button>\r\n\r\n <span className=\"px-2 text-label-semibold-3 text-text-primary\">\r\n Page {page} / {totalPages}\r\n </span>\r\n\r\n <button\r\n type=\"button\"\r\n disabled={page >= totalPages}\r\n onClick={() => onPageChange(page + 1)}\r\n className=\"inline-flex size-8 cursor-pointer items-center justify-center rounded-lg border border-border-primary bg-bg-primary text-text-secondary transition-colors hover:bg-bg-secondary hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-40\"\r\n aria-label=\"Next page\"\r\n >\r\n <ChevronRightIcon className=\"size-4\" />\r\n </button>\r\n </div>\r\n </div>\r\n )\r\n}\r\n"]}
1
+ {"version":3,"sources":["../src/ui/pagination.tsx"],"names":["Pagination","page","pageSize","total","onPageChange","onPageSizeChange","pageSizeOptions","showPageSize","showRange","className","props","totalPages","startItem","endItem","items","opt","selectedItem","item","jsxs","cn","Fragment","jsx","Combobox","a","b","ComboboxTrigger","ComboboxValue","val","ChevronDownIcon","ComboboxPopup","ComboboxList","ComboboxItem","ChevronLeftIcon","ChevronRightIcon"],"mappings":"qOA6BO,SAASA,CAAAA,CAAW,CACzB,KAAAC,CAAAA,CACA,QAAA,CAAAC,GAAAA,CACA,KAAA,CAAAC,IACA,YAAA,CAAAC,GAAAA,CACA,gBAAA,CAAAC,CAAAA,CACA,gBAAAC,GAAAA,CAAkB,CAAC,EAAA,CAAI,EAAA,CAAI,GAAI,GAAG,CAAA,CAClC,YAAA,CAAAC,CAAAA,CAAe,KACf,SAAA,CAAAC,CAAAA,CAAY,IAAA,CACZ,SAAA,CAAAC,EACA,GAAGC,CACL,CAAA,CAAoB,CAClB,IAAMC,CAAAA,CAAa,IAAA,CAAK,GAAA,CAAI,CAAA,CAAG,KAAK,IAAA,CAAKR,GAAAA,CAAQD,GAAQ,CAAC,EACpDU,CAAAA,CAAYT,GAAAA,GAAU,CAAA,CAAI,CAAA,CAAA,CAAKF,EAAO,CAAA,EAAKC,GAAAA,CAAW,CAAA,CACtDW,CAAAA,CAAU,KAAK,GAAA,CAAIZ,CAAAA,CAAOC,GAAAA,CAAUC,GAAK,EAEzCW,GAAAA,CAAoC,CAAA,CAAA,OAAA,CACxC,IAAMR,GAAAA,CAAgB,IAAKS,CAAAA,GAAS,CAAE,KAAA,CAAO,MAAA,CAAOA,CAAG,CAAA,CAAG,KAAA,CAA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AAoB,GAAAA,CAACY,gBAAAA,CAAA,CAAiB,SAAA,CAAU,QAAA,CAAS,CAAA,CACvC,CAAA,CAAA,CACF,GACF,CAEJ","file":"chunk-F2QUDOBO.js","sourcesContent":["import * as React from \"react\"\r\nimport { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport {\r\n Combobox,\r\n ComboboxItem,\r\n ComboboxList,\r\n ComboboxPopup,\r\n ComboboxTrigger,\r\n ComboboxValue,\r\n} from \"./combobox\"\r\n\r\nexport interface PaginationProps extends React.ComponentProps<\"div\"> {\r\n page: number\r\n pageSize: number\r\n total: number\r\n onPageChange: (page: number) => void\r\n onPageSizeChange?: (pageSize: number) => void\r\n pageSizeOptions?: number[]\r\n showPageSize?: boolean\r\n showRange?: boolean\r\n}\r\n\r\ntype PageSizeOptionItem = {\r\n label: string\r\n value: number\r\n}\r\n\r\nexport function Pagination({\r\n page,\r\n pageSize,\r\n total,\r\n onPageChange,\r\n onPageSizeChange,\r\n pageSizeOptions = [10, 20, 50, 100],\r\n showPageSize = true,\r\n showRange = true,\r\n className,\r\n ...props\r\n}: PaginationProps) {\r\n const totalPages = Math.max(1, Math.ceil(total / pageSize))\r\n const startItem = total === 0 ? 0 : (page - 1) * pageSize + 1\r\n const endItem = Math.min(page * pageSize, total)\r\n\r\n const items: PageSizeOptionItem[] = React.useMemo(\r\n () => pageSizeOptions.map((opt) => ({ label: String(opt), value: opt })),\r\n [pageSizeOptions]\r\n )\r\n\r\n const selectedItem = React.useMemo(\r\n () => items.find((item) => item.value === pageSize) ?? items[0],\r\n [items, pageSize]\r\n )\r\n\r\n return (\r\n <div\r\n className={cn(\r\n \"flex w-full flex-col-reverse gap-3 mt-4 sm:flex-row sm:items-center sm:justify-between border-t border-border-primary pt-3 text-body-regular-2 text-text-secondary\",\r\n className\r\n )}\r\n data-slot=\"pagination\"\r\n {...props}\r\n >\r\n {/* Left: Rows per page & range */}\r\n <div className=\"flex items-center gap-2\">\r\n {showPageSize && onPageSizeChange && (\r\n <>\r\n <span className=\"text-label-regular-3 text-text-tertiary\">\r\n Rows per page\r\n </span>\r\n <Combobox<PageSizeOptionItem>\r\n items={items}\r\n value={selectedItem}\r\n onValueChange={(item) => {\r\n if (item && onPageSizeChange) {\r\n onPageSizeChange(item.value)\r\n }\r\n }}\r\n isItemEqualToValue={(a, b) => a.value === b.value}\r\n >\r\n <ComboboxTrigger\r\n className=\"h-8 gap-2 rounded-lg border border-border-primary bg-bg-primary px-3 text-label-semibold-3 text-text-primary hover:bg-bg-secondary focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-border-brand-primary\"\r\n aria-label=\"Rows per page\"\r\n >\r\n <ComboboxValue>\r\n {(val) => (val ? val.label : String(pageSize))}\r\n </ComboboxValue>\r\n <ChevronDownIcon className=\"size-3.5 text-text-tertiary\" />\r\n </ComboboxTrigger>\r\n\r\n <ComboboxPopup className=\"w-24\">\r\n <ComboboxList>\r\n {items.map((item) => (\r\n <ComboboxItem\r\n key={item.value}\r\n value={item}\r\n >\r\n {item.label}\r\n </ComboboxItem>\r\n ))}\r\n </ComboboxList>\r\n </ComboboxPopup>\r\n </Combobox>\r\n </>\r\n )}\r\n\r\n {showPageSize && showRange && (\r\n <span className=\"text-text-tertiary\">·</span>\r\n )}\r\n\r\n {showRange && (\r\n <span className=\"text-label-regular-3 text-text-tertiary\">\r\n {startItem}–{endItem} of {total}\r\n </span>\r\n )}\r\n </div>\r\n\r\n {/* Right: Page controls */}\r\n <div className=\"flex items-center gap-1\">\r\n <button\r\n type=\"button\"\r\n disabled={page <= 1}\r\n onClick={() => onPageChange(page - 1)}\r\n className=\"inline-flex size-8 cursor-pointer items-center justify-center rounded-lg border border-border-primary bg-bg-primary text-text-secondary transition-colors hover:bg-bg-secondary hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-40\"\r\n aria-label=\"Previous page\"\r\n >\r\n <ChevronLeftIcon className=\"size-4\" />\r\n </button>\r\n\r\n <span className=\"px-2 text-label-semibold-3 text-text-primary\">\r\n Page {page} / {totalPages}\r\n </span>\r\n\r\n <button\r\n type=\"button\"\r\n disabled={page >= totalPages}\r\n onClick={() => onPageChange(page + 1)}\r\n className=\"inline-flex size-8 cursor-pointer items-center justify-center rounded-lg border border-border-primary bg-bg-primary text-text-secondary transition-colors hover:bg-bg-secondary hover:text-text-primary disabled:cursor-not-allowed disabled:opacity-40\"\r\n aria-label=\"Next page\"\r\n >\r\n <ChevronRightIcon className=\"size-4\" />\r\n </button>\r\n </div>\r\n </div>\r\n )\r\n}\r\n"]}
@@ -0,0 +1,2 @@
1
+ import {b}from'./chunk-JH6RZ3QH.js';import {c,d,e,f,g,a,h,i,j as j$1,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D}from'./chunk-ZNZVX4PT.js';import {a as a$2}from'./chunk-TED2PUK6.js';import {a as a$1}from'./chunk-XG3W7QMP.js';import {b as b$1,e as e$1}from'./chunk-JLZNZFOO.js';import'react';import {SearchIcon,XIcon,Loader2Icon,CheckCircle2Icon}from'lucide-react';import {cn}from'@xploreu/lib/cn';import {jsx,jsxs,Fragment}from'react/jsx-runtime';function yo(o){return jsx(c,{...o})}function j(o){let{className:t,...r}=o;return jsx(d,{className:cn("group/combobox-trigger flex items-center gap-2",t),...r})}function vo(o){let{className:t,...r}=o;return jsx(e,{className:cn("text-label-semibold-2 text-text-secondary",t),...r})}function go(o){let{className:t,...r}=o;return jsx(f,{className:cn("flex w-full items-center gap-2",t),...r})}function ho({className:o,wrapperClassName:t,...r}){return jsx("div",{className:cn("p-3 border-b border-border-primary",t),children:jsx(g,{className:o,render:jsx(b,{size:"sm",startContent:jsx(SearchIcon,{})}),...r})})}function Io({className:o,displayValueKey:t={label:"label",value:"value"},placeholder:r="Search and Select Company",inputProps:m,...i}){let{inputValue:s,setInputValue:p}=a(),{className:x,startContent:C,...Z}=m||{};return jsx("div",{className:cn("flex flex-col gap-2",o),children:jsxs(eo,{onMouseDown:n=>n.preventBaseUIHandler(),className:"flex-col",children:[jsx(g,{render:jsx(b,{className:cn("h-9 text-body-regular-3 pl-9 pr-7",x),endContent:jsx(j,{nativeButton:false,render:jsx(XIcon,{className:"!size-5 !right-1.5 data-[hidden=true]:opacity-0 opacity-100 transition-opacity duration-300 cursor-pointer","data-hidden":!s,"data-slot":"combobox-clear-input",onClick:n=>{p("",{reason:"none",event:n.nativeEvent,cancel:()=>{},allowPropagation:()=>{},isCanceled:false,isPropagationAllowed:true,trigger:void 0});}})}),placeholder:r,startContent:C??jsx(SearchIcon,{className:"!size-4 !text-fg-tertiary-hover"}),...Z}),...i}),jsx(oo,{children:n=>n?.map(d=>jsxs(to,{children:[d?.[t.label]||"",jsx(ro,{})]},d?.[t.value]||""))})]})})}function fo(o){let{className:t,...r}=o;return jsx(h,{className:cn("text-text-secondary",t),...r})}function No(o){return jsx(i,{render:jsx(XIcon,{}),...o})}function oo(o){return jsx(j$1,{...o})}function eo({className:o,...t}){return jsx(k,{className:cn("flex flex-wrap gap-2",o),...t})}function to({className:o,...t}){return jsx(b$1,{className:cn("ring-1 ring-border-brand text-body-medium-3",o),color:"brand",render:jsx(l,{...t}),size:"lg"})}function ro({className:o,...t}){return jsx(e$1,{className:cn("text-fg-quaternary",o),render:jsx(m,{...t})})}function wo({className:o$1,align:t="start",sideOffset:r=4,container:m,initialFocus:i,finalFocus:s,style:p$1,children:x,...C}){return jsx(n,{container:m,children:jsx(o,{align:t,className:"isolate z-50",sideOffset:r,...C,children:jsx(p,{className:cn("group/combobox-popup bg-bg-primary text-text-primary max-h-(--available-height) w-72 max-w-(--available-width) origin-(--transform-origin) rounded-md border border-border-primary shadow-md outline-hidden",o$1),finalFocus:s,initialFocus:i,style:p$1,children:jsx(bo,{children:x})})})})}function Lo(o){return jsx(n,{...o})}function So(o$1){return jsx(o,{...o$1})}function ko(o){let{className:t,...r}=o;return jsx(q,{className:cn("bg-black/30",t),...r})}function Go({className:o,status:t,...r$1}){let{inputValue:m}=a(),i=m?.toString().trim(),p=t==="empty"&&i?`No matches for "${i}".`:t==="empty"&&!i?"No results.":t==="pending"?jsxs(Fragment,{children:[jsx(Loader2Icon,{className:"animate-spin size-4"}),jsx("span",{children:"Searching..."})]}):null;return jsx(r,{className:cn("px-2 py-2.5 text-body-regular-2 text-text-disabled flex items-center gap-2",!p&&"hidden",o),...r$1,children:p})}function Ro({className:o,...t}){return jsx(s,{className:cn("px-3 py-2 text-body-regular-2 text-text-secondary",o),...t})}function Ho({className:o,...t$1}){return jsx(t,{className:cn("max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] overflow-auto scrollbar-thin flex flex-col p-1 focus-visible:outline-none data-[empty]:hidden",o),...t$1})}function bo(o){let{className:t,...r}=o;return jsx(u,{className:cn("absolute inset-0 bg-bg-primary-hover",t),...r})}function io(o){return jsx(v,{...o})}function Vo(o){let{className:t,...r}=o;return jsx(w,{className:cn("group/combobox-row",t),...r})}function To({className:o,children:t,indicator:r="check-circle",...m}){let{disabled:i}=m;return jsx(io,{activeClassName:"bg-bg-primary-hover rounded-md",disabled:i,children:jsxs(x,{"data-indicator":r,className:cn("group/combobox-item relative flex w-full cursor-default items-center gap-xp-md my-px p-xp-md [[data-indicator=check-circle][data-selected]]:pr-8 data-[indicator=checkbox]:pl-8 outline-none",o),...m,children:[t,jsx(mo,{className:"absolute group-data-[indicator=check-circle]/combobox-item:right-2 group-data-[indicator=checkbox]/combobox-item:left-2",keepMounted:r==="checkbox",render:(s,p)=>jsxs("span",{...s,children:[r==="check-circle"&&jsx(CheckCircle2Icon,{className:"size-4 text-fg-brand-primary shrink-0"}),r==="checkbox"&&jsx(a$1,{checked:p.selected})]})})]})})}function Bo({className:o,...t}){return jsx("span",{className:cn("text-body-medium-3 text-text-primary truncate",o),...t})}function Ao({className:o,...t}){return jsx("span",{className:cn("text-body-regular-3 text-text-secondary truncate",o),...t})}function mo(o){return jsx(y,{...o})}function Eo(o){let{className:t,...r}=o;return jsx(z,{className:cn("my-1 h-px bg-border-primary",t),...r})}function zo(o){let{className:t,...r}=o;return jsx(A,{className:cn("py-1",t),...r})}function Mo(o){let{className:t,...r}=o;return jsx(B,{className:cn("px-3 py-1 text-body-semibold-sm text-text-secondary",t),...r})}function Do(o){return jsx(C,{...o})}function Fo(o){let{className:t,...r}=o;return jsx(D,{className:cn("fill-bg-primary",t),...r})}function Oo({hasMore:o,threshold:t=.5,...r}){return jsx(a$2,{hasMore:o,threshold:t,...r,children:o&&jsxs("div",{className:"px-2 py-2.5 text-body-regular-2 text-text-disabled flex items-center gap-2",children:[jsx(Loader2Icon,{className:"animate-spin size-4"}),jsx("span",{children:"Loading more..."})]})})}export{Eo as A,zo as B,Mo as C,Do as D,Fo as E,Oo as F,yo as a,j as b,vo as c,go as d,ho as e,Io as f,fo as g,No as h,oo as i,eo as j,to as k,ro as l,wo as m,Lo as n,So as o,ko as p,Go as q,Ro as r,Ho as s,bo as t,io as u,Vo as v,To as w,Bo as x,Ao as y,mo as z};//# sourceMappingURL=chunk-GNQKITNA.js.map
2
+ //# sourceMappingURL=chunk-GNQKITNA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/ui/combobox.tsx"],"names":["Combobox","props","jsx","ComboboxTrigger","className","rest","cn","ComboboxLabel","ComboboxInputGroup","ComboboxInput","wrapperClassName","Input","SearchIcon","ComboboxInputFilter","displayValueKey","placeholder","inputProps","inputValue","setInputValue","useCombobox","inputClassName","startContent","restInputProps","jsxs","ComboboxChips","e","XIcon","event","ComboboxValue","value","item","ComboboxChip","ComboboxChipRemove","ComboboxIcon","ComboboxClear","Badge","BadgeButton","ComboboxPopup","align","sideOffset","container","initialFocus","finalFocus","style","children","ComboboxPortal","ComboboxPositioner","ComboboxHighlight","ComboboxBackdrop","ComboboxStatus","status","trimmedInputValue","text","Fragment","Loader2Icon","ComboboxEmpty","ComboboxList","ComboboxHighlightItem","ComboboxRow","ComboboxItem","indicator","disabled","ComboboxItemIndicator","state","CheckCircle2Icon","Checkbox","ComboboxItemTitle","ComboboxItemDescription","ComboboxSeparator","ComboboxGroup","ComboboxGroupLabel","ComboboxCollection","ComboboxArrow","ComboboxInfiniteScroll","hasMore","threshold","InfiniteScroll"],"mappings":"2bA6EA,SAASA,EAAAA,CAA8DC,CAAAA,CAAuC,CAC5G,OACEC,GAAAA,CAACF,CAAAA,CAAA,CAAmB,GAAGC,CAAAA,CAAO,CAElC,CAIA,SAASE,CAAAA,CAAgBF,CAAAA,CAA6B,CACpD,GAAM,CAAE,SAAA,CAAAG,CAAAA,CAAW,GAAGC,CAAK,CAAA,CAAIJ,CAAAA,CAE/B,OAAOC,GAAAA,CAACC,CAAAA,CAAA,CACN,SAAA,CAAWG,EAAAA,CACT,gDAAA,CACAF,CACF,CAAA,CACC,GAAGC,CAAAA,CACN,CACF,CAIA,SAASE,EAAAA,CAAcN,CAAAA,CAA2B,CAChD,GAAM,CAAE,SAAA,CAAAG,CAAAA,CAAW,GAAGC,CAAK,CAAA,CAAIJ,CAAAA,CAE/B,OAAOC,GAAAA,CAACK,CAAAA,CAAA,CACN,SAAA,CAAWD,EAAAA,CACT,2CAAA,CACAF,CACF,CAAA,CACC,GAAGC,CAAAA,CACN,CACF,CAIA,SAASG,EAAAA,CAAmBP,CAAAA,CAAgC,CAC1D,GAAM,CAAE,SAAA,CAAAG,CAAAA,CAAW,GAAGC,CAAK,CAAA,CAAIJ,CAAAA,CAE/B,OAAOC,GAAAA,CAACM,CAAAA,CAAA,CACN,SAAA,CAAWF,EAAAA,CACT,gCAAA,CACAF,CACF,CAAA,CACC,GAAGC,CAAAA,CACN,CACF,CAMA,SAASI,EAAAA,CAAc,CACrB,SAAA,CAAAL,CAAAA,CACA,gBAAA,CAAAM,CAAAA,CACA,GAAGT,CACL,CAAA,CAAuB,CAErB,OACEC,GAAAA,CAAC,KAAA,CAAA,CAAI,SAAA,CAAWI,GAAG,oCAAA,CAAsCI,CAAgB,CAAA,CACvE,QAAA,CAAAR,GAA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,CAAA,CACF,EAEJ,CAEJ","file":"chunk-GNQKITNA.js","sourcesContent":["import * as React from \"react\"\r\n\r\nimport {\r\n CheckCircle2Icon,\r\n Loader2Icon,\r\n SearchIcon,\r\n XIcon\r\n} from \"lucide-react\"\r\n\r\nimport {\r\n Combobox as ComboboxPrimitive,\r\n ComboboxArrow as ComboboxArrowPrimitive,\r\n type ComboboxArrowProps as ComboboxArrowPrimitiveProps,\r\n ComboboxBackdrop as ComboboxBackdropPrimitive,\r\n type ComboboxBackdropProps as ComboboxBackdropPrimitiveProps,\r\n ComboboxChip as ComboboxChipPrimitive,\r\n type ComboboxChipProps as ComboboxChipPrimitiveProps,\r\n ComboboxChipRemove as ComboboxChipRemovePrimitive,\r\n type ComboboxChipRemoveProps as ComboboxChipRemovePrimitiveProps,\r\n ComboboxChips as ComboboxChipsPrimitive,\r\n type ComboboxChipsProps as ComboboxChipsPrimitiveProps,\r\n ComboboxClear as ComboboxClearPrimitive,\r\n type ComboboxClearProps as ComboboxClearPrimitiveProps,\r\n ComboboxCollection as ComboboxCollectionPrimitive,\r\n type ComboboxCollectionProps as ComboboxCollectionPrimitiveProps,\r\n ComboboxEmpty as ComboboxEmptyPrimitive,\r\n type ComboboxEmptyProps as ComboboxEmptyPrimitiveProps,\r\n ComboboxGroup as ComboboxGroupPrimitive,\r\n ComboboxGroupLabel as ComboboxGroupLabelPrimitive,\r\n type ComboboxGroupLabelProps as ComboboxGroupLabelPrimitiveProps,\r\n type ComboboxGroupProps as ComboboxGroupPrimitiveProps,\r\n ComboboxHighlight as ComboboxHighlightPrimitive,\r\n ComboboxHighlightItem as ComboboxHighlightItemPrimitive,\r\n type ComboboxHighlightItemProps as ComboboxHighlightItemPrimitiveProps,\r\n type ComboboxHighlightProps as ComboboxHighlightPrimitiveProps,\r\n ComboboxIcon as ComboboxIconPrimitive,\r\n type ComboboxIconProps as ComboboxIconPrimitiveProps,\r\n ComboboxInput as ComboboxInputPrimitive,\r\n ComboboxInputGroup as ComboboxInputGroupPrimitive,\r\n type ComboboxInputGroupProps as ComboboxInputGroupPrimitiveProps,\r\n type ComboboxInputProps as ComboboxInputPrimitiveProps,\r\n ComboboxItem as ComboboxItemPrimitive,\r\n ComboboxItemIndicator as ComboboxItemIndicatorPrimitive,\r\n type ComboboxItemIndicatorProps as ComboboxItemIndicatorPrimitiveProps,\r\n type ComboboxItemProps as ComboboxItemPrimitiveProps,\r\n ComboboxLabel as ComboboxLabelPrimitive,\r\n type ComboboxLabelProps as ComboboxLabelPrimitiveProps,\r\n ComboboxList as ComboboxListPrimitive,\r\n type ComboboxListProps as ComboboxListPrimitiveProps,\r\n ComboboxPopup as ComboboxPopupPrimitive,\r\n type ComboboxPopupProps as ComboboxPopupPrimitiveProps,\r\n ComboboxPortal as ComboboxPortalPrimitive,\r\n type ComboboxPortalProps as ComboboxPortalPrimitiveProps,\r\n ComboboxPositioner as ComboboxPositionerPrimitive,\r\n type ComboboxPositionerProps as ComboboxPositionerPrimitiveProps,\r\n type ComboboxProps as ComboboxPrimitiveProps,\r\n ComboboxRow as ComboboxRowPrimitive,\r\n type ComboboxRowProps as ComboboxRowPrimitiveProps,\r\n ComboboxSeparator as ComboboxSeparatorPrimitive,\r\n type ComboboxSeparatorProps as ComboboxSeparatorPrimitiveProps,\r\n ComboboxStatus as ComboboxStatusPrimitive,\r\n type ComboboxStatusProps as ComboboxStatusPrimitiveProps,\r\n ComboboxTrigger as ComboboxTriggerPrimitive,\r\n type ComboboxTriggerProps as ComboboxTriggerPrimitiveProps,\r\n ComboboxValue as ComboboxValuePrimitive,\r\n type ComboboxValueProps as ComboboxValuePrimitiveProps,\r\n useCombobox,\r\n} from \"../primitives/combobox\"\r\nimport { cn } from \"@xploreu/lib/cn\"\r\n\r\nimport { Badge, BadgeButton } from \"./badge\"\r\nimport { InfiniteScroll } from \"./infinite-scroll\"\r\nimport { Input, inputVariants } from \"./input\"\r\nimport { Checkbox } from \"./checkbox\"\r\n\r\ntype ComboboxProps<Value, Multiple extends boolean | undefined = false> = ComboboxPrimitiveProps<Value, Multiple>\r\n\r\nfunction Combobox<Value, Multiple extends boolean | undefined = false>(props: ComboboxProps<Value, Multiple>) {\r\n return (\r\n <ComboboxPrimitive {...props} />\r\n )\r\n}\r\n\r\ntype ComboboxTriggerProps = ComboboxTriggerPrimitiveProps\r\n\r\nfunction ComboboxTrigger(props: ComboboxTriggerProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxTriggerPrimitive\r\n className={cn(\r\n \"group/combobox-trigger flex items-center gap-2\",\r\n className,\r\n )}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxLabelProps = ComboboxLabelPrimitiveProps\r\n\r\nfunction ComboboxLabel(props: ComboboxLabelProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxLabelPrimitive\r\n className={cn(\r\n \"text-label-semibold-2 text-text-secondary\",\r\n className,\r\n )}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxInputGroupProps = ComboboxInputGroupPrimitiveProps\r\n\r\nfunction ComboboxInputGroup(props: ComboboxInputGroupProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxInputGroupPrimitive\r\n className={cn(\r\n \"flex w-full items-center gap-2\",\r\n className,\r\n )}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxInputProps = ComboboxInputPrimitiveProps & {\r\n wrapperClassName?: string\r\n}\r\n\r\nfunction ComboboxInput({\r\n className,\r\n wrapperClassName,\r\n ...props\r\n}: ComboboxInputProps) {\r\n\r\n return (\r\n <div className={cn(\"p-3 border-b border-border-primary\", wrapperClassName)}>\r\n <ComboboxInputPrimitive\r\n className={className}\r\n render={<Input size=\"sm\" startContent={<SearchIcon />} />}\r\n {...props}\r\n />\r\n </div>\r\n )\r\n}\r\n\r\nfunction ComboboxInputFilter({\r\n className,\r\n displayValueKey = { label: \"label\", value: \"value\" },\r\n placeholder = \"Search and Select Company\",\r\n inputProps,\r\n ...props\r\n}: ComboboxInputProps & {\r\n displayValueKey?: {\r\n label: string\r\n value: string\r\n }\r\n placeholder?: string\r\n inputProps?: React.ComponentProps<typeof Input>\r\n}) {\r\n const { inputValue, setInputValue } = useCombobox()\r\n const { className: inputClassName, startContent, ...restInputProps } = inputProps || {}\r\n\r\n return (\r\n <div className={cn(\"flex flex-col gap-2\", className)}>\r\n <ComboboxChips\r\n onMouseDown={(e) => e.preventBaseUIHandler()}\r\n className=\"flex-col\"\r\n >\r\n <ComboboxInputPrimitive\r\n render={\r\n <Input\r\n className={cn(\"h-9 text-body-regular-3 pl-9 pr-7\", inputClassName)}\r\n endContent={\r\n <ComboboxTrigger\r\n nativeButton={false}\r\n render={(\r\n <XIcon\r\n className=\"!size-5 !right-1.5 data-[hidden=true]:opacity-0 opacity-100 transition-opacity duration-300 cursor-pointer\"\r\n data-hidden={!inputValue}\r\n data-slot=\"combobox-clear-input\"\r\n onClick={(event) => {\r\n setInputValue(\"\", {\r\n reason: \"none\",\r\n event: event.nativeEvent,\r\n cancel: () => { },\r\n allowPropagation: () => { },\r\n isCanceled: false,\r\n isPropagationAllowed: true,\r\n trigger: undefined,\r\n })\r\n }}\r\n />\r\n )}\r\n />\r\n }\r\n placeholder={placeholder}\r\n startContent={startContent ?? <SearchIcon className=\"!size-4 !text-fg-tertiary-hover\" />}\r\n {...restInputProps}\r\n />\r\n }\r\n {...props}\r\n />\r\n <ComboboxValue>\r\n {/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}\r\n {(value) => value?.map((item: any) => (\r\n <ComboboxChip key={item?.[displayValueKey.value] || \"\"}>\r\n {item?.[displayValueKey.label] || \"\"}\r\n <ComboboxChipRemove />\r\n </ComboboxChip>\r\n ))}\r\n </ComboboxValue>\r\n </ComboboxChips>\r\n </div>\r\n )\r\n}\r\n\r\ntype ComboboxIconProps = ComboboxIconPrimitiveProps\r\n\r\nfunction ComboboxIcon(props: ComboboxIconProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxIconPrimitive\r\n className={cn(\"text-text-secondary\", className)}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxClearProps = ComboboxClearPrimitiveProps\r\n\r\nfunction ComboboxClear(props: ComboboxClearProps) {\r\n\r\n return (\r\n <ComboboxClearPrimitive\r\n render={<XIcon />}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxValueProps = ComboboxValuePrimitiveProps\r\n\r\nfunction ComboboxValue(props: ComboboxValueProps) {\r\n return <ComboboxValuePrimitive {...props} />\r\n}\r\n\r\ntype ComboboxChipsProps = ComboboxChipsPrimitiveProps\r\n\r\nfunction ComboboxChips({\r\n className,\r\n ...props\r\n}: ComboboxChipsProps) {\r\n return <ComboboxChipsPrimitive\r\n className={cn(\"flex flex-wrap gap-2\", className)}\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxChipProps = ComboboxChipPrimitiveProps\r\n\r\nfunction ComboboxChip({\r\n className,\r\n ...props\r\n}: ComboboxChipProps) {\r\n return (\r\n <Badge\r\n className={cn(\"ring-1 ring-border-brand text-body-medium-3\", className)}\r\n color=\"brand\"\r\n render={(\r\n <ComboboxChipPrimitive\r\n {...props}\r\n />\r\n )}\r\n size=\"lg\"\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxChipRemoveProps = ComboboxChipRemovePrimitiveProps\r\n\r\nfunction ComboboxChipRemove({\r\n className,\r\n ...props\r\n}: ComboboxChipRemoveProps) {\r\n return (\r\n <BadgeButton\r\n className={cn(\"text-fg-quaternary\", className)}\r\n render={(\r\n <ComboboxChipRemovePrimitive\r\n {...props}\r\n />\r\n )}\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxPopupProps = ComboboxPositionerPrimitiveProps &\r\n ComboboxPopupPrimitiveProps & {\r\n container?: React.ComponentProps<typeof ComboboxPortal>[\"container\"]\r\n }\r\n\r\nfunction ComboboxPopup({\r\n className,\r\n align = \"start\",\r\n sideOffset = 4,\r\n container,\r\n initialFocus,\r\n finalFocus,\r\n style,\r\n children,\r\n ...props\r\n}: ComboboxPopupProps) {\r\n return (\r\n <ComboboxPortalPrimitive container={container}>\r\n <ComboboxPositionerPrimitive\r\n align={align}\r\n className=\"isolate z-50\"\r\n sideOffset={sideOffset}\r\n {...props}\r\n >\r\n <ComboboxPopupPrimitive\r\n className={cn(\r\n \"group/combobox-popup bg-bg-primary text-text-primary max-h-(--available-height) w-72 max-w-(--available-width) origin-(--transform-origin) rounded-md border border-border-primary shadow-md outline-hidden\",\r\n className,\r\n )}\r\n finalFocus={finalFocus}\r\n initialFocus={initialFocus}\r\n style={style}\r\n >\r\n <ComboboxHighlight>\r\n {children}\r\n </ComboboxHighlight>\r\n </ComboboxPopupPrimitive>\r\n </ComboboxPositionerPrimitive>\r\n </ComboboxPortalPrimitive>\r\n )\r\n}\r\n\r\ntype ComboboxPortalProps = ComboboxPortalPrimitiveProps\r\n\r\nfunction ComboboxPortal(props: ComboboxPortalProps) {\r\n return <ComboboxPortalPrimitive {...props} />\r\n}\r\n\r\ntype ComboboxPositionerProps = ComboboxPositionerPrimitiveProps\r\n\r\nfunction ComboboxPositioner(props: ComboboxPositionerProps) {\r\n return <ComboboxPositionerPrimitive {...props} />\r\n}\r\n\r\ntype ComboboxBackdropProps = ComboboxBackdropPrimitiveProps\r\n\r\nfunction ComboboxBackdrop(props: ComboboxBackdropProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxBackdropPrimitive\r\n className={cn(\"bg-black/30\", className)}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxStatusProps = ComboboxStatusPrimitiveProps\r\n\r\nfunction ComboboxStatus({\r\n className,\r\n status,\r\n ...props\r\n}: Omit<ComboboxStatusProps, \"children\"> & {\r\n status?: \"empty\" | \"pending\" | null\r\n}) {\r\n const { inputValue } = useCombobox()\r\n\r\n const trimmedInputValue = inputValue?.toString().trim()\r\n\r\n const getText = () => {\r\n if (status === \"empty\" && trimmedInputValue)\r\n return `No matches for \"${trimmedInputValue}\".`\r\n\r\n if (status === \"empty\" && !trimmedInputValue)\r\n return \"No results.\"\r\n\r\n if (status === \"pending\")\r\n return (\r\n <>\r\n <Loader2Icon className=\"animate-spin size-4\" />\r\n <span>\r\n Searching...\r\n </span>\r\n </>\r\n )\r\n\r\n return null\r\n }\r\n\r\n const text = getText()\r\n\r\n return (\r\n <ComboboxStatusPrimitive\r\n className={cn(\r\n \"px-2 py-2.5 text-body-regular-2 text-text-disabled flex items-center gap-2\",\r\n !text && \"hidden\",\r\n className\r\n )}\r\n {...props}\r\n >\r\n {text}\r\n </ComboboxStatusPrimitive>\r\n )\r\n}\r\n\r\ntype ComboboxLoadingProps = React.ComponentProps<\"div\">\r\n\r\ntype ComboboxEmptyProps = ComboboxEmptyPrimitiveProps\r\n\r\nfunction ComboboxEmpty({ className, ...props }: ComboboxEmptyProps) {\r\n return <ComboboxEmptyPrimitive\r\n className={cn(\"px-3 py-2 text-body-regular-2 text-text-secondary\", className)}\r\n {...props}\r\n />\r\n}\r\n\r\ntype ComboboxListProps = ComboboxListPrimitiveProps\r\n\r\nfunction ComboboxList({\r\n className,\r\n ...props\r\n}: ComboboxListProps) {\r\n return (\r\n <ComboboxListPrimitive\r\n className={cn(\"max-h-[min(calc(--spacing(72)---spacing(9)),calc(var(--available-height)---spacing(9)))] overflow-auto scrollbar-thin flex flex-col p-1 focus-visible:outline-none data-[empty]:hidden\", className)}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxHighlightProps = ComboboxHighlightPrimitiveProps\r\n\r\nfunction ComboboxHighlight(props: ComboboxHighlightProps) {\r\n const { className, ...rest } = props\r\n\r\n return (\r\n <ComboboxHighlightPrimitive\r\n className={cn(\"absolute inset-0 bg-bg-primary-hover\", className)}\r\n {...rest}\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxHighlightItemProps = ComboboxHighlightItemPrimitiveProps\r\n\r\nfunction ComboboxHighlightItem(props: ComboboxHighlightItemProps) {\r\n return <ComboboxHighlightItemPrimitive {...props} />\r\n}\r\n\r\ntype ComboboxRowProps = ComboboxRowPrimitiveProps\r\n\r\nfunction ComboboxRow(props: ComboboxRowProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxRowPrimitive\r\n className={cn(\"group/combobox-row\", className)}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxItemProps = ComboboxItemPrimitiveProps & {\r\n indicator?: \"check-circle\" | \"checkbox\"\r\n}\r\n\r\nfunction ComboboxItem({\r\n className,\r\n children,\r\n indicator = \"check-circle\",\r\n ...props\r\n}: ComboboxItemProps) {\r\n const { disabled } = props\r\n\r\n return (\r\n <ComboboxHighlightItem\r\n activeClassName=\"bg-bg-primary-hover rounded-md\"\r\n disabled={disabled}\r\n >\r\n <ComboboxItemPrimitive\r\n data-indicator={indicator}\r\n className={cn(\r\n \"group/combobox-item relative flex w-full cursor-default items-center gap-xp-md my-px p-xp-md [[data-indicator=check-circle][data-selected]]:pr-8 data-[indicator=checkbox]:pl-8 outline-none\",\r\n className,\r\n )}\r\n {...props}\r\n >\r\n {children}\r\n <ComboboxItemIndicator\r\n className=\"absolute group-data-[indicator=check-circle]/combobox-item:right-2 group-data-[indicator=checkbox]/combobox-item:left-2\"\r\n keepMounted={indicator === \"checkbox\"}\r\n render={(props, state) => (\r\n <span {...props}>\r\n {indicator === \"check-circle\" && (\r\n <CheckCircle2Icon className=\"size-4 text-fg-brand-primary shrink-0\" />\r\n )}\r\n\r\n {indicator === \"checkbox\" && (\r\n <Checkbox checked={state.selected} />\r\n )}\r\n </span>\r\n )}\r\n />\r\n </ComboboxItemPrimitive>\r\n </ComboboxHighlightItem>\r\n )\r\n}\r\n\r\ntype ComboboxItemTitleProps = React.ComponentProps<\"span\">\r\n\r\nfunction ComboboxItemTitle({\r\n className,\r\n ...props\r\n}: ComboboxItemTitleProps) {\r\n return (\r\n <span\r\n className={cn(\r\n \"text-body-medium-3 text-text-primary truncate\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxItemDescriptionProps = React.ComponentProps<\"span\">\r\n\r\nfunction ComboboxItemDescription({\r\n className,\r\n ...props\r\n}: ComboboxItemDescriptionProps) {\r\n return (\r\n <span\r\n className={cn(\r\n \"text-body-regular-3 text-text-secondary truncate\",\r\n className\r\n )}\r\n {...props}\r\n />\r\n )\r\n}\r\n\r\ntype ComboboxItemIndicatorProps = ComboboxItemIndicatorPrimitiveProps\r\n\r\nfunction ComboboxItemIndicator(props: ComboboxItemIndicatorProps) {\r\n return (\r\n <ComboboxItemIndicatorPrimitive {...props} />\r\n )\r\n}\r\n\r\ntype ComboboxSeparatorProps = ComboboxSeparatorPrimitiveProps\r\n\r\nfunction ComboboxSeparator(props: ComboboxSeparatorProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxSeparatorPrimitive\r\n className={cn(\"my-1 h-px bg-border-primary\", className)}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxGroupProps = ComboboxGroupPrimitiveProps\r\n\r\nfunction ComboboxGroup(props: ComboboxGroupProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxGroupPrimitive\r\n className={cn(\"py-1\", className)}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxGroupLabelProps = ComboboxGroupLabelPrimitiveProps\r\n\r\nfunction ComboboxGroupLabel(props: ComboboxGroupLabelProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxGroupLabelPrimitive\r\n className={cn(\"px-3 py-1 text-body-semibold-sm text-text-secondary\", className)}\r\n {...rest}\r\n />\r\n}\r\n\r\ntype ComboboxCollectionProps = ComboboxCollectionPrimitiveProps\r\n\r\nfunction ComboboxCollection(props: ComboboxCollectionProps) {\r\n return <ComboboxCollectionPrimitive {...props} />\r\n}\r\n\r\ntype ComboboxArrowProps = ComboboxArrowPrimitiveProps\r\n\r\nfunction ComboboxArrow(props: ComboboxArrowProps) {\r\n const { className, ...rest } = props\r\n\r\n return <ComboboxArrowPrimitive\r\n className={cn(\"fill-bg-primary\", className)}\r\n {...rest}\r\n />\r\n}\r\n\r\nfunction ComboboxInfiniteScroll({\r\n hasMore,\r\n threshold = 0.5,\r\n ...props\r\n}: Omit<React.ComponentProps<typeof InfiniteScroll>, \"children\">) {\r\n return (\r\n <InfiniteScroll\r\n hasMore={hasMore}\r\n threshold={threshold}\r\n {...props}\r\n >\r\n {hasMore && (\r\n <div className=\"px-2 py-2.5 text-body-regular-2 text-text-disabled flex items-center gap-2\">\r\n <Loader2Icon className=\"animate-spin size-4\" />\r\n <span>\r\n Loading more...\r\n </span>\r\n </div>\r\n )}\r\n </InfiniteScroll>\r\n )\r\n}\r\n\r\nexport {\r\n Combobox,\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 ComboboxPopup,\r\n type ComboboxPopupProps,\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 ComboboxInfiniteScroll,\r\n ComboboxInput,\r\n ComboboxInputFilter,\r\n ComboboxInputGroup,\r\n type ComboboxInputGroupProps,\r\n type ComboboxInputProps,\r\n ComboboxItem,\r\n ComboboxItemTitle,\r\n type ComboboxItemTitleProps,\r\n ComboboxItemDescription,\r\n type ComboboxItemDescriptionProps,\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 type ComboboxLoadingProps,\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}"]}
@@ -1,2 +1,2 @@
1
- import {a,b,i,m,q,s,w,x,F}from'./chunk-EL7P7FN5.js';import {a as a$1}from'./chunk-JH6RZ3QH.js';import'react';import {ChevronDownIcon}from'lucide-react';import'class-variance-authority';import {cn}from'@xploreu/lib/cn';import {jsxs,jsx}from'react/jsx-runtime';function B({items:t,value:f,defaultValue:g,onValueChange:d,placeholder:I="Select",icon:l,container:S,isPending:y,className:P,triggerClassName:V,contentClassName:v,disabled:N,size:h="md",infiniteScroll:R}){return jsxs(a,{items:t,value:f,defaultValue:g,onValueChange:d,isItemEqualToValue:(e,T)=>e.value===T.value,disabled:N,children:[jsxs(b,{className:cn(a$1({size:h}),"group flex cursor-pointer items-center gap-2 pr-3 text-left",V,P),children:[l&&jsx("span",{className:"size-4.5 shrink-0 text-fg-quaternary",children:l}),jsx("span",{className:"flex-1 truncate",children:jsx(i,{children:e=>jsx("span",{className:e?"text-text-primary":"text-text-placeholder",children:e?.label??I})})}),jsx(ChevronDownIcon,{className:"size-4 shrink-0 text-fg-quaternary transition-transform group-data-[popup-open]:rotate-180"})]}),jsxs(m,{container:S,className:cn("w-72",v),align:"start",sideOffset:8,children:[jsx(q,{status:y||t===void 0?"pending":t.length===0?"empty":null}),jsxs(s,{children:[t?.map(e=>jsx(w,{value:e,children:jsx(x,{children:e.label})},e.value)),jsx(F,{...R})]})]})]})}export{B as a};//# sourceMappingURL=chunk-ZWZMXZGN.js.map
2
- //# sourceMappingURL=chunk-ZWZMXZGN.js.map
1
+ import {a,b,i,m,q,s,w,x,F}from'./chunk-GNQKITNA.js';import {a as a$1}from'./chunk-JH6RZ3QH.js';import'react';import {ChevronDownIcon}from'lucide-react';import'class-variance-authority';import {cn}from'@xploreu/lib/cn';import {jsxs,jsx}from'react/jsx-runtime';function B({items:t,value:f,defaultValue:g,onValueChange:d,placeholder:I="Select",icon:l,container:S,isPending:y,className:P,triggerClassName:V,contentClassName:v,disabled:N,size:h="md",infiniteScroll:R}){return jsxs(a,{items:t,value:f,defaultValue:g,onValueChange:d,isItemEqualToValue:(e,T)=>e.value===T.value,disabled:N,children:[jsxs(b,{className:cn(a$1({size:h}),"group flex cursor-pointer items-center gap-2 pr-3 text-left",V,P),children:[l&&jsx("span",{className:"size-4.5 shrink-0 text-fg-quaternary",children:l}),jsx("span",{className:"flex-1 truncate",children:jsx(i,{children:e=>jsx("span",{className:e?"text-text-primary":"text-text-placeholder",children:e?.label??I})})}),jsx(ChevronDownIcon,{className:"size-4 shrink-0 text-fg-quaternary transition-transform group-data-[popup-open]:rotate-180"})]}),jsxs(m,{container:S,className:cn("w-72",v),align:"start",sideOffset:8,children:[jsx(q,{status:y||t===void 0?"pending":t.length===0?"empty":null}),jsxs(s,{children:[t?.map(e=>jsx(w,{value:e,children:jsx(x,{children:e.label})},e.value)),jsx(F,{...R})]})]})]})}export{B as a};//# sourceMappingURL=chunk-IIFWJ2BW.js.map
2
+ //# sourceMappingURL=chunk-IIFWJ2BW.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/composites/combobox-simple.tsx"],"names":["ComboboxSimple","items","value","defaultValue","onValueChange","placeholder","icon","container","isPending","className","triggerClassName","contentClassName","disabled","size","infiniteScroll","jsxs","Combobox","a","b","ComboboxTrigger","cn","inputVariants","jsx","ComboboxValue","item","ChevronDownIcon","ComboboxPopup","ComboboxStatus","ComboboxList","ComboboxItem","ComboboxItemTitle","ComboboxInfiniteScroll"],"mappings":"mQA8CA,SAASA,CAAAA,CAAe,CACtB,KAAA,CAAAC,CAAAA,CACA,MAAAC,CAAAA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AM,QACN,UAAA,CAAY,CAAA,CAEZ,UAAAW,GAAAA,CAACK,CAAAA,CAAA,CACC,MAAA,CACEnB,CAAAA,EAAaP,IAAU,MAAA,CACnB,SAAA,CACAA,EAAM,MAAA,GAAW,CAAA,CACf,QACA,IAAA,CAEV,CAAA,CACAc,KAACa,CAAAA,CAAA,CACE,UAAA3B,CAAAA,EAAO,GAAA,CAAKuB,GACXF,GAAAA,CAACO,CAAAA,CAAA,CAA8B,KAAA,CAAOL,CAAAA,CACpC,SAAAF,GAAAA,CAACQ,CAAAA,CAAA,CACE,QAAA,CAAAN,CAAAA,CAAK,MACR,CAAA,CAAA,CAHiBA,CAAAA,CAAK,KAIxB,CACD,CAAA,CACDF,IAACS,CAAAA,CAAA,CAAwB,GAAGjB,CAAAA,CAAgB,CAAA,CAAA,CAC9C,CAAA,CAAA,CACF,CAAA,CAAA,CACF,CAEJ","file":"chunk-ZWZMXZGN.js","sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\nimport { ChevronDownIcon } from \"lucide-react\"\r\nimport { type VariantProps } from \"class-variance-authority\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport { inputVariants } from \"../ui/input\"\r\nimport { ComboboxItem, ComboboxItemTitle } from \"../ui/combobox\"\r\nimport {\r\n Combobox,\r\n ComboboxInfiniteScroll,\r\n ComboboxList,\r\n ComboboxPopup,\r\n ComboboxPortal,\r\n ComboboxStatus,\r\n ComboboxTrigger,\r\n ComboboxValue,\r\n} from \"../ui/combobox\"\r\n\r\n// ─── Types ───\r\n\r\nexport type ComboboxSimpleItem = {\r\n label: string\r\n value: string\r\n}\r\n\r\nexport type ComboboxSimpleProps = {\r\n items: ComboboxSimpleItem[] | undefined\r\n value?: ComboboxSimpleItem | null\r\n defaultValue?: ComboboxSimpleItem | null\r\n onValueChange?: (value: ComboboxSimpleItem | null) => void\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 size?: VariantProps<typeof inputVariants>[\"size\"]\r\n infiniteScroll?: React.ComponentProps<typeof ComboboxInfiniteScroll>\r\n}\r\n\r\n// ─── Component ───\r\n\r\nfunction ComboboxSimple({\r\n items,\r\n value,\r\n defaultValue,\r\n onValueChange,\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 size = \"md\",\r\n infiniteScroll,\r\n}: ComboboxSimpleProps) {\r\n return (\r\n <Combobox\r\n items={items}\r\n value={value}\r\n defaultValue={defaultValue}\r\n onValueChange={onValueChange}\r\n isItemEqualToValue={(a, b) => a.value === b.value}\r\n disabled={disabled}\r\n >\r\n <ComboboxTrigger\r\n className={cn(\r\n inputVariants({ size }),\r\n \"group flex cursor-pointer items-center gap-2 pr-3 text-left\",\r\n triggerClassName,\r\n className\r\n )}\r\n >\r\n {icon && (\r\n <span className=\"size-4.5 shrink-0 text-fg-quaternary\">{icon}</span>\r\n )}\r\n <span className=\"flex-1 truncate\">\r\n <ComboboxValue>\r\n {(item) => (\r\n <span className={item ? \"text-text-primary\" : \"text-text-placeholder\"}>\r\n {item?.label ?? placeholder}\r\n </span>\r\n )}\r\n </ComboboxValue>\r\n </span>\r\n <ChevronDownIcon\r\n className=\"size-4 shrink-0 text-fg-quaternary transition-transform group-data-[popup-open]:rotate-180\"\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 <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 </ComboboxPopup>\r\n </Combobox>\r\n )\r\n}\r\n\r\nexport { ComboboxSimple }\r\n"]}
1
+ {"version":3,"sources":["../src/composites/combobox-simple.tsx"],"names":["ComboboxSimple","items","value","defaultValue","onValueChange","placeholder","icon","container","isPending","className","triggerClassName","contentClassName","disabled","size","infiniteScroll","jsxs","Combobox","a","b","ComboboxTrigger","cn","inputVariants","jsx","ComboboxValue","item","ChevronDownIcon","ComboboxPopup","ComboboxStatus","ComboboxList","ComboboxItem","ComboboxItemTitle","ComboboxInfiniteScroll"],"mappings":"mQA8CA,SAASA,CAAAA,CAAe,CACtB,KAAA,CAAAC,CAAAA,CACA,MAAAC,CAAAA,CACA,YAAA,CAAAC,EACA,aAAA,CAAAC,CAAAA,CACA,YAAAC,CAAAA,CAAc,QAAA,CACd,KAAAC,CAAAA,CACA,SAAA,CAAAC,EACA,SAAA,CAAAC,CAAAA,CACA,UAAAC,CAAAA,CACA,gBAAA,CAAAC,EACA,gBAAA,CAAAC,CAAAA,CACA,SAAAC,CAAAA,CACA,IAAA,CAAAC,EAAO,IAAA,CACP,cAAA,CAAAC,CACF,CAAA,CAAwB,CACtB,OACEC,IAAAA,CAACC,CAAAA,CAAA,CACC,KAAA,CAAOf,CAAAA,CACP,MAAOC,CAAAA,CACP,YAAA,CAAcC,EACd,aAAA,CAAeC,CAAAA,CACf,mBAAoB,CAACa,CAAAA,CAAGC,IAAMD,CAAAA,CAAE,KAAA,GAAUC,EAAE,KAAA,CAC5C,QAAA,CAAUN,EAEV,QAAA,CAAA,CAAAG,IAAAA,CAACI,EAAA,CACC,SAAA,CAAWC,GACTC,GAAAA,CAAc,CAAE,KAAAR,CAAK,CAAC,EACtB,6DAAA,CACAH,CAAAA,CACAD,CACF,CAAA,CAEC,QAAA,CAAA,CAAAH,CAAAA,EACCgB,GAAAA,CAAC,MAAA,CAAA,CAAK,SAAA,CAAU,uCAAwC,QAAA,CAAAhB,CAAAA,CAAK,EAE/DgB,GAAAA,CAAC,MAAA,CAAA,CAAK,UAAU,iBAAA,CACd,QAAA,CAAAA,IAACC,CAAAA,CAAA,CACE,SAACC,CAAAA,EACAF,GAAAA,CAAC,QAAK,SAAA,CAAWE,CAAAA,CAAO,oBAAsB,uBAAA,CAC3C,QAAA,CAAAA,GAAM,KAAA,EAASnB,CAAAA,CAClB,EAEJ,CAAA,CACF,CAAA,CACAiB,IAACG,eAAAA,CAAA,CACC,UAAU,4FAAA,CACZ,CAAA,CAAA,CACF,EAEAV,IAAAA,CAACW,CAAAA,CAAA,CACC,SAAA,CAAWnB,CAAAA,CACX,UAAWa,EAAAA,CAAG,MAAA,CAAQT,CAAgB,CAAA,CACtC,KAAA,CAAM,QACN,UAAA,CAAY,CAAA,CAEZ,UAAAW,GAAAA,CAACK,CAAAA,CAAA,CACC,MAAA,CACEnB,CAAAA,EAAaP,IAAU,MAAA,CACnB,SAAA,CACAA,EAAM,MAAA,GAAW,CAAA,CACf,QACA,IAAA,CAEV,CAAA,CACAc,KAACa,CAAAA,CAAA,CACE,UAAA3B,CAAAA,EAAO,GAAA,CAAKuB,GACXF,GAAAA,CAACO,CAAAA,CAAA,CAA8B,KAAA,CAAOL,CAAAA,CACpC,SAAAF,GAAAA,CAACQ,CAAAA,CAAA,CACE,QAAA,CAAAN,CAAAA,CAAK,MACR,CAAA,CAAA,CAHiBA,CAAAA,CAAK,KAIxB,CACD,CAAA,CACDF,IAACS,CAAAA,CAAA,CAAwB,GAAGjB,CAAAA,CAAgB,CAAA,CAAA,CAC9C,CAAA,CAAA,CACF,CAAA,CAAA,CACF,CAEJ","file":"chunk-IIFWJ2BW.js","sourcesContent":["\"use client\"\r\n\r\nimport * as React from \"react\"\r\nimport { ChevronDownIcon } from \"lucide-react\"\r\nimport { type VariantProps } from \"class-variance-authority\"\r\n\r\nimport { cn } from \"@xploreu/lib/cn\"\r\nimport { inputVariants } from \"../ui/input\"\r\nimport { ComboboxItem, ComboboxItemTitle } from \"../ui/combobox\"\r\nimport {\r\n Combobox,\r\n ComboboxInfiniteScroll,\r\n ComboboxList,\r\n ComboboxPopup,\r\n ComboboxPortal,\r\n ComboboxStatus,\r\n ComboboxTrigger,\r\n ComboboxValue,\r\n} from \"../ui/combobox\"\r\n\r\n// ─── Types ───\r\n\r\nexport type ComboboxSimpleItem = {\r\n label: string\r\n value: string\r\n}\r\n\r\nexport type ComboboxSimpleProps = {\r\n items: ComboboxSimpleItem[] | undefined\r\n value?: ComboboxSimpleItem | null\r\n defaultValue?: ComboboxSimpleItem | null\r\n onValueChange?: (value: ComboboxSimpleItem | null) => void\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 size?: VariantProps<typeof inputVariants>[\"size\"]\r\n infiniteScroll?: React.ComponentProps<typeof ComboboxInfiniteScroll>\r\n}\r\n\r\n// ─── Component ───\r\n\r\nfunction ComboboxSimple({\r\n items,\r\n value,\r\n defaultValue,\r\n onValueChange,\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 size = \"md\",\r\n infiniteScroll,\r\n}: ComboboxSimpleProps) {\r\n return (\r\n <Combobox\r\n items={items}\r\n value={value}\r\n defaultValue={defaultValue}\r\n onValueChange={onValueChange}\r\n isItemEqualToValue={(a, b) => a.value === b.value}\r\n disabled={disabled}\r\n >\r\n <ComboboxTrigger\r\n className={cn(\r\n inputVariants({ size }),\r\n \"group flex cursor-pointer items-center gap-2 pr-3 text-left\",\r\n triggerClassName,\r\n className\r\n )}\r\n >\r\n {icon && (\r\n <span className=\"size-4.5 shrink-0 text-fg-quaternary\">{icon}</span>\r\n )}\r\n <span className=\"flex-1 truncate\">\r\n <ComboboxValue>\r\n {(item) => (\r\n <span className={item ? \"text-text-primary\" : \"text-text-placeholder\"}>\r\n {item?.label ?? placeholder}\r\n </span>\r\n )}\r\n </ComboboxValue>\r\n </span>\r\n <ChevronDownIcon\r\n className=\"size-4 shrink-0 text-fg-quaternary transition-transform group-data-[popup-open]:rotate-180\"\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 <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 </ComboboxPopup>\r\n </Combobox>\r\n )\r\n}\r\n\r\nexport { ComboboxSimple }\r\n"]}
@@ -1,2 +1,2 @@
1
- import {a,b,e,d,c,k as k$1,l,f,g as g$1,h,i}from'./chunk-Z67QQMOX.js';import'react';import {XIcon}from'lucide-react';import {cn}from'@xploreu/lib/cn';import {jsx,jsxs}from'react/jsx-runtime';function D(e){return jsx(a,{...e})}function F(e){return jsx(b,{...e})}function H(e$1){return jsx(e,{...e$1})}function g({className:e,...t}){return jsx(d,{className:cn("fixed inset-0 z-50 bg-black/50 backdrop-blur-sm",e),...t})}var x={right:"inset-y-0 right-0 h-full w-full max-w-sm border-l border-border-primary",left:"inset-y-0 left-0 h-full w-full max-w-sm border-r border-border-primary",top:"inset-x-0 top-0 h-full max-h-sm w-full border-b border-border-primary",bottom:"inset-x-0 bottom-0 h-full max-h-sm w-full border-t border-border-primary"};function O({side:e$1="right",className:t,children:u,showCloseButton:d=true,closeClassName:c$1,...b}){return jsxs(c,{children:[jsx(g,{}),jsxs(k$1,{side:e$1,className:cn("fixed z-50 flex flex-col bg-bg-primary shadow-xp-lg",x[e$1],t),...b,children:[u,d&&jsxs(e,{className:cn('absolute top-4 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',c$1),children:[jsx(XIcon,{}),jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function z({className:e,...t}){return jsx(l,{className:cn("flex-1 overflow-y-auto px-6 py-4",e),...t})}function k({className:e,...t}){return jsx(f,{className:cn("flex flex-col gap-1 border-b border-border-tertiary px-6 py-4",e),...t})}function _({className:e,...t}){return jsx(g$1,{className:cn("mt-auto flex items-center justify-end gap-2 border-t border-border-tertiary px-6 py-4",e),...t})}function R({className:e,...t}){return jsx(h,{className:cn("text-label-bold-2 text-text-primary",e),...t})}function B({className:e,...t}){return jsx(i,{className:cn("text-body-regular-3 text-text-secondary",e),...t})}export{D as a,F as b,H as c,g as d,O as e,z as f,k as g,_ as h,R as i,B as j};//# sourceMappingURL=chunk-YZNI5HEX.js.map
2
- //# sourceMappingURL=chunk-YZNI5HEX.js.map
1
+ import {a,b,e,d,c,k as k$1,l,f,g as g$1,h,i}from'./chunk-VY735IE2.js';import'react';import {XIcon}from'lucide-react';import {cn}from'@xploreu/lib/cn';import {jsx,jsxs}from'react/jsx-runtime';function D(e){return jsx(a,{...e})}function F(e){return jsx(b,{...e})}function H(e$1){return jsx(e,{...e$1})}function g({className:e,...t}){return jsx(d,{className:cn("fixed inset-0 z-50 bg-black/50 backdrop-blur-sm",e),...t})}var x={right:"inset-y-0 right-0 h-full w-full max-w-sm border-l border-border-primary",left:"inset-y-0 left-0 h-full w-full max-w-sm border-r border-border-primary",top:"inset-x-0 top-0 h-full max-h-sm w-full border-b border-border-primary",bottom:"inset-x-0 bottom-0 h-full max-h-sm w-full border-t border-border-primary"};function O({side:e$1="right",className:t,children:u,showCloseButton:d=true,closeClassName:c$1,...b}){return jsxs(c,{children:[jsx(g,{}),jsxs(k$1,{side:e$1,className:cn("fixed z-50 flex flex-col bg-bg-primary shadow-xp-lg",x[e$1],t),...b,children:[u,d&&jsxs(e,{className:cn('absolute top-4 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',c$1),children:[jsx(XIcon,{}),jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function z({className:e,...t}){return jsx(l,{className:cn("flex-1 overflow-y-auto px-6 py-4",e),...t})}function k({className:e,...t}){return jsx(f,{className:cn("flex flex-col gap-1 border-b border-border-tertiary px-6 py-4",e),...t})}function _({className:e,...t}){return jsx(g$1,{className:cn("mt-auto flex items-center justify-end gap-2 border-t border-border-tertiary px-6 py-4",e),...t})}function R({className:e,...t}){return jsx(h,{className:cn("text-label-bold-2 text-text-primary",e),...t})}function B({className:e,...t}){return jsx(i,{className:cn("text-body-regular-3 text-text-secondary",e),...t})}export{D as a,F as b,H as c,g as d,O as e,z as f,k as g,_ as h,R as i,B as j};//# sourceMappingURL=chunk-J6CW2XBL.js.map
2
+ //# sourceMappingURL=chunk-J6CW2XBL.js.map