1import { aE as useDealStatus, j as jsxRuntimeExports, aF as Popover, aG as PopoverTrigger, B as Button, f as Badge, aH as PopoverContent, aI as RotateCcw, aJ as DEAL_STATUSES, M as Check } from "./index-DZUVA1tZ.js"; 2import { F as Filter } from "./filter-4X08Hsnh.js"; 3const STATUS_COLORS = { 4 emerald: "bg-emerald-500/20 text-emerald-400 border-emerald-500/30 hover:bg-emerald-500/30", 5 blue: "bg-blue-500/20 text-blue-400 border-blue-500/30 hover:bg-blue-500/30", 6 sky: "bg-sky-500/20 text-sky-400 border-sky-500/30 hover:bg-sky-500/30", 7 amber: "bg-amber-500/20 text-amber-400 border-amber-500/30 hover:bg-amber-500/30", 8 purple: "bg-purple-500/20 text-purple-400 border-purple-500/30 hover:bg-purple-500/30", 9 zinc: "bg-zinc-500/20 text-zinc-400 border-zinc-500/30 hover:bg-zinc-500/30", 10 red: "bg-red-500/20 text-red-400 border-red-500/30 hover:bg-red-500/30", 11 rose: "bg-rose-500/20 text-rose-400 border-rose-500/30 hover:bg-rose-500/30", 12 indigo: "bg-indigo-500/20 text-indigo-400 border-indigo-500/30 hover:bg-indigo-500/30", 13 violet: "bg-violet-500/20 text-violet-400 border-violet-500/30 hover:bg-violet-500/30", 14 teal: "bg-teal-500/20 text-teal-400 border-teal-500/30 hover:bg-teal-500/30" 15}; 16const INACTIVE_CLASS = "bg-background/80 text-foreground/80 border-border/70 hover:bg-muted hover:text-foreground"; 17function DealStatusFilterInline({ disabled = false }) { 18 const { soldStatuses, toggleStatus, isActive, resetToDefaults, selectAll } = useDealStatus(); 19 const isDefault = soldStatuses.length === 2 && soldStatuses.includes("CLOSED_OR_SOLD") && soldStatuses.includes("BOOKED"); 20 return /* @__PURE__ */ jsxRuntimeExports.jsxs(Popover, { children: [ 21 /* @__PURE__ */ jsxRuntimeExports.jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "outline", size: "sm", className: "h-10 gap-1.5 text-xs sm:h-8", disabled, title: disabled ? "Filter changes are locked by your administrator" : void 0, children: [
22 /* @__PURE__ */ jsxRuntimeExports.jsx(Filter, { className: "h-3.5 w-3.5" }), 23 /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Status Filter" }), 24 !isDefault && /* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "secondary", className: "h-4 px-1 text-[10px] ml-0.5", children: soldStatuses.length }) 25 ] }) }), 26 /* @__PURE__ */ jsxRuntimeExports.jsxs(PopoverContent, { className: "w-[calc(100vw-2rem)] max-w-80 p-3", align: "end", collisionPadding: 16, children: [ 27 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between mb-2", children: [ 28 /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-xs font-medium text-muted-foreground", children: 'Select which deal statuses count as "sold"' }), 29 /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-1", children: [ 30 /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { variant: "ghost", size: "sm", className: "h-8 px-2 text-[10px]", onClick: selectAll, children: "All" }),
31 /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { variant: "ghost", size: "sm", className: "h-8 px-2 text-[10px]", onClick: resetToDefaults, children: [ 32 /* @__PURE__ */ jsxRuntimeExports.jsx(RotateCcw, { className: "h-3 w-3 mr-1" }), 33 "Reset" 34 ] }) 35 ] }) 36 ] }), 37 /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1.5", children: DEAL_STATUSES.map((s) => { 38 const active = isActive(s.key); 39 return /* @__PURE__ */ jsxRuntimeExports.jsxs( 40 "button", 41 { 42 onClick: () => toggleStatus(s.key), 43 "aria-pressed": active, 44 className: `inline-flex min-h-9 items-center gap-1 rounded-md border px-2.5 py-1 text-xs font-medium transition-all cursor-pointer ${active ? STATUS_COLORS[s.color] ?? STATUS_COLORS.zinc : INACTIVE_CLASS}`, 45 children: [ 46 active && /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: "h-3 w-3" }), 47 s.label 48 ] 49 }, 50 s.key 51 ); 52 }) }),
53 /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-[10px] text-muted-foreground mt-2", children: [ 54 soldStatuses.length, 55 " of ", 56 DEAL_STATUSES.length, 57 " statuses active", 58 " · ", 59 "Default: Booked + Closed/Sold" 60 ] }) 61 ] }) 62 ] }); 63} 64export { 65 DealStatusFilterInline as D 66};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.