@peak-ai/canvas 1.3.7-rc.2 → 1.3.7-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@peak-ai/canvas",
3
3
  "author": "squad-builder-experience",
4
4
  "license": "UNLICENSED",
5
- "version": "1.3.7-rc.2",
5
+ "version": "1.3.7-rc.3",
6
6
  "description": "",
7
7
  "dependencies": {
8
8
  "@peak-ai/ais-components": "6.41.0",
@@ -1,3 +1,4 @@
1
- import _asyncToGenerator from"@babel/runtime/helpers/asyncToGenerator";import _extends from"@babel/runtime/helpers/extends";import _regeneratorRuntime from"@babel/runtime/regenerator";/* eslint-disable @typescript-eslint/no-explicit-any */import{useCallback,useEffect,useRef,useState}from"react";import{ChevronDown,ChevronUp,ListFilter as FilterIcon,Loader2Icon}from"lucide-react";import{Button}from"./button";import{Checkbox}from"./checkbox";import{ScrollArea}from"./scroll-area";import{getAffectedComponentsWithLoader}from"../../../helpers";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";function FilterHeader(_ref){var label=_ref.label,count=_ref.count,isDisabled=_ref.isDisabled,isDropdownOpen=_ref.isDropdownOpen,isLoading=_ref.isLoading,toggleOpen=_ref.toggleOpen;var ChevronIcon=isDropdownOpen?ChevronUp:ChevronDown;return/*#__PURE__*/_jsxs(Button,{variant:"outline",size:"sm",disabled:isDisabled,onClick:toggleOpen,className:"px-2",children:[/*#__PURE__*/_jsx(FilterIcon,{size:16}),count>0?label+" ("+count+")":label,isLoading?/*#__PURE__*/_jsx(Loader2Icon,{className:"ml-2 animate-spin",size:16}):/*#__PURE__*/_jsx(ChevronIcon,{size:16,className:"ml-1"})]})}function FilterActions(_ref2){var selected=_ref2.selected,allSelected=_ref2.allSelected,onClear=_ref2.onClear,onSelectAll=_ref2.onSelectAll,isDisabled=_ref2.isDisabled;return/*#__PURE__*/_jsxs("div",{className:"flex items-center mb-3",children:[/*#__PURE__*/_jsx(Checkbox,{checked:allSelected,onCheckedChange:function onCheckedChange(){return allSelected?onClear():onSelectAll()},disabled:isDisabled}),/*#__PURE__*/_jsx("span",{className:"ml-2 text-sm text-gray-900",children:"Select All"}),selected.length>0&&/*#__PURE__*/_jsx("button",{type:"button",className:"ml-auto text-sm text-blue-600 hover:underline",onMouseDown:function onMouseDown(e){e.stopPropagation();e.preventDefault()},onClick:onClear,disabled:isDisabled,children:"Clear All"})]})}function FilterOptionList(_ref3){var options=_ref3.options,selected=_ref3.selected,onToggle=_ref3.onToggle,isDisabled=_ref3.isDisabled;return/*#__PURE__*/_jsx(ScrollArea,{viewportClassName:"max-h-48 overflow-y-auto mb-4 space-y-2",children:options.length>0?options.map(function(opt){return/*#__PURE__*/_jsxs("label",{className:"flex items-center space-x-2 hover:bg-gray-100 rounded p-1 transition",onClick:function onClick(e){e.preventDefault();e.stopPropagation();if(!isDisabled){onToggle(opt.value)}},children:[/*#__PURE__*/_jsx(Checkbox,{checked:selected.includes(opt.value),onChange:function onChange(){// Prevent checkbox from toggling when clicking label
2
- },onClick:function onClick(e){return e.stopPropagation()},disabled:isDisabled}),/*#__PURE__*/_jsx("span",{className:"text-sm text-gray-900",children:opt.label})]},opt.value)}):/*#__PURE__*/_jsx("div",{className:"text-sm text-gray-500",children:"No results found"})})}export function renderFilter(_ref4){var gjsModel=_ref4.gjsModel,performInteraction=_ref4.performInteraction;var wrapperRef=useRef(null);var _useState=useState(_extends({},gjsModel.get("componentProps"))),componentData=_useState[0],setComponentData=_useState[1];var _useState2=useState(_extends({},gjsModel.get("attributes"))),attributes=_useState2[0],setAttributes=_useState2[1];var _useState3=useState(false),isDropdownOpen=_useState3[0],setIsDropdownOpen=_useState3[1];var _useState4=useState(""),searchQuery=_useState4[0],setSearchQuery=_useState4[1];var _useState5=useState(false),isApplying=_useState5[0],setIsApplying=_useState5[1];var _componentData$option=componentData.options,options=_componentData$option===void 0?[]:_componentData$option,_componentData$value=componentData.value,value=_componentData$value===void 0?[]:_componentData$value,_componentData$classN=componentData.className,className=_componentData$classN===void 0?"":_componentData$classN,_componentData$affect=componentData.affectedComponents,affectedComponents=_componentData$affect===void 0?[]:_componentData$affect,_componentData$text=componentData.text,label=_componentData$text===void 0?"Filter":_componentData$text,_componentData$filter=componentData.filterType,filterType=_componentData$filter===void 0?"multiselect":_componentData$filter;var defaultValue=componentData["default"]||[];var _useState6=useState(function(){return Array.isArray(value)&&value.length>0?value:defaultValue}),selectedValues=_useState6[0],setSelectedValues=_useState6[1];var isMultiSelect=filterType==="multiselect";var isBusy=attributes.interactionApiInProgress||isApplying;var allOptionsSelected=selectedValues.length===options.length&&options.length>0;useEffect(function(){function updateComponentData(){setComponentData(_extends({},gjsModel.get("componentProps")))}function updateAttributes(){setAttributes(_extends({},gjsModel.get("attributes")))}gjsModel.on("change:componentProps",updateComponentData);gjsModel.on("change:attributes",updateAttributes);return function(){gjsModel.off("change:componentProps",updateComponentData);gjsModel.off("change:attributes",updateAttributes)}},[gjsModel]);useEffect(function(){var _wrapperRef$current$o,_wrapperRef$current;var doc=(_wrapperRef$current$o=(_wrapperRef$current=wrapperRef.current)==null?void 0:_wrapperRef$current.ownerDocument)!=null?_wrapperRef$current$o:document;function handleOutsideClick(e){if(isDropdownOpen&&wrapperRef.current&&!wrapperRef.current.contains(e.target)){setIsDropdownOpen(false)}}function handleEscape(e){if(e.key==="Escape"){setIsDropdownOpen(false)}}doc.addEventListener("pointerdown",handleOutsideClick);doc.addEventListener("keydown",handleEscape);return function(){doc.removeEventListener("pointerdown",handleOutsideClick);doc.removeEventListener("keydown",handleEscape)}},[isDropdownOpen]);var filteredOptions=options.filter(function(opt){return opt.label.toLowerCase().includes(searchQuery.toLowerCase())});function updateAndApply(_x){return _updateAndApply.apply(this,arguments)}function _updateAndApply(){_updateAndApply=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(newValues){var id;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:if(newValues===void 0){newValues=selectedValues}setIsApplying(true);_context.prev=2;gjsModel.set("componentProps",_extends({},gjsModel.get("componentProps"),{value:newValues}));id=gjsModel.get("id");_context.next=7;return performInteraction({interactionType:"filter",id:id,affectedComponents:getAffectedComponentsWithLoader([id].concat(affectedComponents),true)});case 7:_context.prev=7;setIsApplying(false);setIsDropdownOpen(false);return _context.finish(7);case 11:case"end":return _context.stop()}},_callee,null,[[2,,7,11]])}));return _updateAndApply.apply(this,arguments)}var handleOptionToggle=useCallback(function(val){if(isMultiSelect){setSelectedValues(function(prev){return prev.includes(val)?prev.filter(function(v){return v!==val}):[].concat(prev,[val])})}else{if(selectedValues.includes(val)){setSelectedValues([]);updateAndApply([])}else{var singleValue=[val];setSelectedValues(singleValue);updateAndApply(singleValue)}}},[isMultiSelect,selectedValues]);function handleClearAll(){setSelectedValues([])}function handleSelectAll(){setSelectedValues(options.map(function(o){return o.value}))}return/*#__PURE__*/_jsxs("div",{ref:wrapperRef,className:"relative inline-block "+className,style:{color:"#2A44D4",backgroundColor:"rgb(255 255 255)"},children:[/*#__PURE__*/_jsx(FilterHeader,{label:label,count:selectedValues.length,isDisabled:isBusy,isDropdownOpen:isDropdownOpen,isLoading:isBusy,toggleOpen:function toggleOpen(){return setIsDropdownOpen(function(prev){return!prev})}}),isDropdownOpen&&/*#__PURE__*/_jsxs("div",{className:"absolute right-0 top-full mt-2 w-64 bg-white border rounded-lg shadow-lg ring-1 ring-black ring-opacity-5 p-4 z-50",children:[/*#__PURE__*/_jsx("input",{type:"text",placeholder:"Search...",value:searchQuery,onChange:function onChange(e){return setSearchQuery(e.target.value)},className:"w-full mb-3 px-2 py-1 border rounded focus:outline-none",disabled:isBusy}),isMultiSelect&&/*#__PURE__*/_jsx(FilterActions,{selected:selectedValues,allSelected:allOptionsSelected,onClear:handleClearAll,onSelectAll:handleSelectAll,isDisabled:isBusy}),/*#__PURE__*/_jsx(FilterOptionList,{options:filteredOptions,selected:selectedValues,onToggle:handleOptionToggle,isDisabled:isBusy}),isMultiSelect&&/*#__PURE__*/_jsxs("div",{className:"flex justify-end space-x-2",children:[/*#__PURE__*/_jsx(Button,{variant:"ghost",size:"sm",onClick:function onClick(){return setIsDropdownOpen(false)},disabled:isApplying,children:"Cancel"}),/*#__PURE__*/_jsxs(Button,{variant:"default",size:"sm",onClick:function onClick(){return updateAndApply(selectedValues)},disabled:isBusy,children:[isApplying&&/*#__PURE__*/_jsx(Loader2Icon,{className:"animate-spin mr-2",size:16}),"Apply"]})]})]})]})}
1
+ import _asyncToGenerator from"@babel/runtime/helpers/asyncToGenerator";import _extends from"@babel/runtime/helpers/extends";import _regeneratorRuntime from"@babel/runtime/regenerator";/* eslint-disable @typescript-eslint/no-explicit-any */import{useCallback,useEffect,useRef,useState}from"react";import{ChevronDown,ChevronUp,ListFilter as FilterIcon,Loader2Icon}from"lucide-react";import{Button}from"./button";import{Checkbox}from"./checkbox";import{ScrollArea}from"./scroll-area";import{getAffectedComponentsWithLoader}from"../../../helpers";import{jsx as _jsx,jsxs as _jsxs}from"react/jsx-runtime";function FilterHeader(_ref){var label=_ref.label,count=_ref.count,isDisabled=_ref.isDisabled,isDropdownOpen=_ref.isDropdownOpen,isLoading=_ref.isLoading,toggleOpen=_ref.toggleOpen;var ChevronIcon=isDropdownOpen?ChevronUp:ChevronDown;return/*#__PURE__*/_jsxs(Button,{variant:"outline",size:"sm",disabled:isDisabled,onClick:toggleOpen,className:"px-2",children:[/*#__PURE__*/_jsx(FilterIcon,{size:16}),count>0?label+" ("+count+")":label,isLoading?/*#__PURE__*/_jsx(Loader2Icon,{className:"ml-2 animate-spin",size:16}):/*#__PURE__*/_jsx(ChevronIcon,{size:16,className:"ml-1"})]})}function FilterActions(_ref2){var selected=_ref2.selected,allSelected=_ref2.allSelected,onClear=_ref2.onClear,onSelectAll=_ref2.onSelectAll,isDisabled=_ref2.isDisabled;return/*#__PURE__*/_jsxs("div",{className:"flex items-center mb-3",children:[/*#__PURE__*/_jsx(Checkbox,{checked:allSelected,onCheckedChange:function onCheckedChange(){return allSelected?onClear():onSelectAll()},disabled:isDisabled}),/*#__PURE__*/_jsx("span",{className:"ml-2 text-sm text-gray-900",children:"Select All"}),selected.length>0&&/*#__PURE__*/_jsx("button",{type:"button",className:"ml-auto text-sm text-blue-600 hover:underline",onMouseDown:function onMouseDown(e){e.stopPropagation();e.preventDefault()},onClick:onClear,disabled:isDisabled,children:"Clear All"})]})}function FilterOptionList(_ref3){var options=_ref3.options,selected=_ref3.selected,onToggle=_ref3.onToggle,isDisabled=_ref3.isDisabled;return/*#__PURE__*/_jsx(ScrollArea,{viewportClassName:"max-h-48 overflow-y-auto mb-4 space-y-2",children:options.length>0?options.map(function(opt){return/*#__PURE__*/_jsxs("label",{className:"flex items-center space-x-2 hover:bg-gray-100 rounded p-1 transition hover:cursor-pointer",onClick:function onClick(e){e.preventDefault();e.stopPropagation();if(!isDisabled){onToggle(opt.value)}},children:[/*#__PURE__*/_jsx(Checkbox,{checked:selected.includes(opt.value),onChange:function onChange(){// Prevent checkbox from toggling when clicking label
2
+ }// onClick={(e) => e.stopPropagation()}
3
+ ,disabled:isDisabled}),/*#__PURE__*/_jsx("span",{className:"text-sm text-gray-900",children:opt.label})]},opt.value)}):/*#__PURE__*/_jsx("div",{className:"text-sm text-gray-500",children:"No results found"})})}export function renderFilter(_ref4){var gjsModel=_ref4.gjsModel,performInteraction=_ref4.performInteraction;var wrapperRef=useRef(null);var _useState=useState(_extends({},gjsModel.get("componentProps"))),componentData=_useState[0],setComponentData=_useState[1];var _useState2=useState(_extends({},gjsModel.get("attributes"))),attributes=_useState2[0],setAttributes=_useState2[1];var _useState3=useState(false),isDropdownOpen=_useState3[0],setIsDropdownOpen=_useState3[1];var _useState4=useState(""),searchQuery=_useState4[0],setSearchQuery=_useState4[1];var _useState5=useState(false),isApplying=_useState5[0],setIsApplying=_useState5[1];var _componentData$option=componentData.options,options=_componentData$option===void 0?[]:_componentData$option,_componentData$value=componentData.value,value=_componentData$value===void 0?[]:_componentData$value,_componentData$classN=componentData.className,className=_componentData$classN===void 0?"":_componentData$classN,_componentData$affect=componentData.affectedComponents,affectedComponents=_componentData$affect===void 0?[]:_componentData$affect,_componentData$text=componentData.text,label=_componentData$text===void 0?"Filter":_componentData$text,_componentData$filter=componentData.filterType,filterType=_componentData$filter===void 0?"multiselect":_componentData$filter;var defaultValue=componentData["default"]||[];var _useState6=useState(function(){return Array.isArray(value)&&value.length>0?value:defaultValue}),selectedValues=_useState6[0],setSelectedValues=_useState6[1];var isMultiSelect=filterType==="multiselect";var isBusy=attributes.interactionApiInProgress||isApplying;var allOptionsSelected=selectedValues.length===options.length&&options.length>0;useEffect(function(){function updateComponentData(){setComponentData(_extends({},gjsModel.get("componentProps")))}function updateAttributes(){setAttributes(_extends({},gjsModel.get("attributes")))}gjsModel.on("change:componentProps",updateComponentData);gjsModel.on("change:attributes",updateAttributes);return function(){gjsModel.off("change:componentProps",updateComponentData);gjsModel.off("change:attributes",updateAttributes)}},[gjsModel]);useEffect(function(){var _wrapperRef$current$o,_wrapperRef$current;var doc=(_wrapperRef$current$o=(_wrapperRef$current=wrapperRef.current)==null?void 0:_wrapperRef$current.ownerDocument)!=null?_wrapperRef$current$o:document;function handleOutsideClick(e){if(isDropdownOpen&&wrapperRef.current&&!wrapperRef.current.contains(e.target)){setIsDropdownOpen(false)}}function handleEscape(e){if(e.key==="Escape"){setIsDropdownOpen(false)}}doc.addEventListener("pointerdown",handleOutsideClick);doc.addEventListener("keydown",handleEscape);return function(){doc.removeEventListener("pointerdown",handleOutsideClick);doc.removeEventListener("keydown",handleEscape)}},[isDropdownOpen]);var filteredOptions=options.filter(function(opt){return opt.label.toLowerCase().includes(searchQuery.toLowerCase())});function updateAndApply(_x){return _updateAndApply.apply(this,arguments)}function _updateAndApply(){_updateAndApply=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(newValues){var id;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:if(newValues===void 0){newValues=selectedValues}setIsApplying(true);_context.prev=2;gjsModel.set("componentProps",_extends({},gjsModel.get("componentProps"),{value:newValues}));id=gjsModel.get("id");_context.next=7;return performInteraction({interactionType:"filter",id:id,affectedComponents:getAffectedComponentsWithLoader([id].concat(affectedComponents),true)});case 7:_context.prev=7;setIsApplying(false);setIsDropdownOpen(false);return _context.finish(7);case 11:case"end":return _context.stop()}},_callee,null,[[2,,7,11]])}));return _updateAndApply.apply(this,arguments)}var handleOptionToggle=useCallback(function(val){if(isMultiSelect){setSelectedValues(function(prev){return prev.includes(val)?prev.filter(function(v){return v!==val}):[].concat(prev,[val])})}else{if(selectedValues.includes(val)){setSelectedValues([]);updateAndApply([])}else{var singleValue=[val];setSelectedValues(singleValue);updateAndApply(singleValue)}}},[isMultiSelect,selectedValues]);function handleClearAll(){setSelectedValues([])}function handleSelectAll(){setSelectedValues(options.map(function(o){return o.value}))}return/*#__PURE__*/_jsxs("div",{ref:wrapperRef,className:"relative inline-block "+className,style:{color:"#2A44D4",backgroundColor:"rgb(255 255 255)"},children:[/*#__PURE__*/_jsx(FilterHeader,{label:label,count:selectedValues.length,isDisabled:isBusy,isDropdownOpen:isDropdownOpen,isLoading:isBusy,toggleOpen:function toggleOpen(){return setIsDropdownOpen(function(prev){return!prev})}}),isDropdownOpen&&/*#__PURE__*/_jsxs("div",{className:"absolute right-0 top-full mt-2 w-64 bg-white border rounded-lg shadow-lg ring-1 ring-black ring-opacity-5 p-4 z-50",children:[/*#__PURE__*/_jsx("input",{type:"text",placeholder:"Search...",value:searchQuery,onChange:function onChange(e){return setSearchQuery(e.target.value)},className:"w-full mb-3 px-2 py-1 border rounded focus:outline-none",disabled:isBusy}),isMultiSelect&&/*#__PURE__*/_jsx(FilterActions,{selected:selectedValues,allSelected:allOptionsSelected,onClear:handleClearAll,onSelectAll:handleSelectAll,isDisabled:isBusy}),/*#__PURE__*/_jsx(FilterOptionList,{options:filteredOptions,selected:selectedValues,onToggle:handleOptionToggle,isDisabled:isBusy}),isMultiSelect&&/*#__PURE__*/_jsxs("div",{className:"flex justify-end space-x-2",children:[/*#__PURE__*/_jsx(Button,{variant:"ghost",size:"sm",onClick:function onClick(){return setIsDropdownOpen(false)},disabled:isApplying,children:"Cancel"}),/*#__PURE__*/_jsxs(Button,{variant:"default",size:"sm",onClick:function onClick(){return updateAndApply(selectedValues)},disabled:isBusy,children:[isApplying&&/*#__PURE__*/_jsx(Loader2Icon,{className:"animate-spin mr-2",size:16}),"Apply"]})]})]})]})}
3
4
  //# sourceMappingURL=filter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"filter.js","names":["useCallback","useEffect","useRef","useState","ChevronDown","ChevronUp","ListFilter","FilterIcon","Loader2Icon","Button","Checkbox","ScrollArea","getAffectedComponentsWithLoader","jsx","_jsx","jsxs","_jsxs","FilterHeader","_ref","label","count","isDisabled","isDropdownOpen","isLoading","toggleOpen","ChevronIcon","variant","size","disabled","onClick","className","children","FilterActions","_ref2","selected","allSelected","onClear","onSelectAll","checked","onCheckedChange","length","type","onMouseDown","e","stopPropagation","preventDefault","FilterOptionList","_ref3","options","onToggle","viewportClassName","map","opt","value","includes","onChange","renderFilter","_ref4","gjsModel","performInteraction","wrapperRef","_useState","_extends","get","componentData","setComponentData","_useState2","attributes","setAttributes","_useState3","setIsDropdownOpen","_useState4","searchQuery","setSearchQuery","_useState5","isApplying","setIsApplying","_componentData$option","_componentData$value","_componentData$classN","_componentData$affect","affectedComponents","_componentData$text","text","_componentData$filter","filterType","defaultValue","_useState6","Array","isArray","selectedValues","setSelectedValues","isMultiSelect","isBusy","interactionApiInProgress","allOptionsSelected","updateComponentData","updateAttributes","on","off","_wrapperRef$current$o","_wrapperRef$current","doc","current","ownerDocument","document","handleOutsideClick","contains","target","handleEscape","key","addEventListener","removeEventListener","filteredOptions","filter","toLowerCase","updateAndApply","_x","_updateAndApply","apply","arguments","_asyncToGenerator","_regeneratorRuntime","mark","_callee","newValues","id","wrap","_callee$","_context","prev","next","set","interactionType","concat","finish","stop","handleOptionToggle","val","v","singleValue","handleClearAll","handleSelectAll","o","ref","style","color","backgroundColor","placeholder"],"sources":["../../../../src/shadcn/components/ui/filter.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { ChevronDown, ChevronUp, ListFilter as FilterIcon, Loader2Icon } from 'lucide-react';\n\nimport { Button } from './button';\nimport { Checkbox } from './checkbox';\nimport { ScrollArea } from './scroll-area';\nimport { getAffectedComponentsWithLoader } from '../../../helpers';\n\ntype FilterOption = {\n label: string;\n value: string;\n};\n\ntype FilterProps = {\n isEditable?: boolean;\n gjsModel: any;\n performInteraction: (payload: Record<string, any>) => Promise<void>;\n};\n\ntype FilterHeaderProps = {\n label: string;\n count: number;\n isDisabled: boolean;\n isDropdownOpen: boolean;\n isLoading: boolean;\n toggleOpen: () => void;\n};\n\ntype FilterActionsProps = {\n selected: string[];\n allSelected: boolean;\n onClear: () => void;\n onSelectAll: () => void;\n isDisabled: boolean;\n};\n\ntype FilterOptionListProps = {\n options: FilterOption[];\n selected: string[];\n onToggle: (value: string) => void;\n isDisabled: boolean;\n};\n\nfunction FilterHeader({\n label,\n count,\n isDisabled,\n isDropdownOpen,\n isLoading,\n toggleOpen,\n}: FilterHeaderProps) {\n const ChevronIcon = isDropdownOpen ? ChevronUp : ChevronDown;\n\n return (\n <Button variant=\"outline\" size=\"sm\" disabled={isDisabled} onClick={toggleOpen} className=\"px-2\">\n <FilterIcon size={16} />\n {count > 0 ? `${label} (${count})` : label}\n {isLoading ? (\n <Loader2Icon className=\"ml-2 animate-spin\" size={16} />\n ) : (\n <ChevronIcon size={16} className=\"ml-1\" />\n )}\n </Button>\n );\n}\n\nfunction FilterActions({\n selected,\n allSelected,\n onClear,\n onSelectAll,\n isDisabled,\n}: FilterActionsProps) {\n return (\n <div className=\"flex items-center mb-3\">\n <Checkbox\n checked={allSelected}\n onCheckedChange={() => (allSelected ? onClear() : onSelectAll())}\n disabled={isDisabled}\n />\n <span className=\"ml-2 text-sm text-gray-900\">Select All</span>\n {selected.length > 0 && (\n <button\n type=\"button\"\n className=\"ml-auto text-sm text-blue-600 hover:underline\"\n onMouseDown={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n onClick={onClear}\n disabled={isDisabled}\n >\n Clear All\n </button>\n )}\n </div>\n );\n}\n\nfunction FilterOptionList({ options, selected, onToggle, isDisabled }: FilterOptionListProps) {\n return (\n <ScrollArea viewportClassName=\"max-h-48 overflow-y-auto mb-4 space-y-2\">\n {options.length > 0 ? (\n options.map((opt) => (\n <label\n key={opt.value}\n className=\"flex items-center space-x-2 hover:bg-gray-100 rounded p-1 transition\"\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n\n if (!isDisabled) {\n onToggle(opt.value);\n }\n }}\n >\n <Checkbox\n checked={selected.includes(opt.value)}\n onChange={() => {\n // Prevent checkbox from toggling when clicking label\n }}\n onClick={(e) => e.stopPropagation()}\n disabled={isDisabled}\n />\n <span className=\"text-sm text-gray-900\">{opt.label}</span>\n </label>\n ))\n ) : (\n <div className=\"text-sm text-gray-500\">No results found</div>\n )}\n </ScrollArea>\n );\n}\n\nexport function renderFilter({ gjsModel, performInteraction }: FilterProps) {\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n const [componentData, setComponentData] = useState({ ...gjsModel.get('componentProps') });\n const [attributes, setAttributes] = useState({ ...gjsModel.get('attributes') });\n const [isDropdownOpen, setIsDropdownOpen] = useState(false);\n const [searchQuery, setSearchQuery] = useState('');\n const [isApplying, setIsApplying] = useState(false);\n\n const {\n options = [],\n value = [],\n className = '',\n affectedComponents = [],\n text: label = 'Filter',\n filterType = 'multiselect',\n } = componentData;\n\n const defaultValue = componentData.default || [];\n\n const [selectedValues, setSelectedValues] = useState<string[]>(() => {\n return Array.isArray(value) && value.length > 0 ? value : defaultValue;\n });\n\n const isMultiSelect = filterType === 'multiselect';\n const isBusy = attributes.interactionApiInProgress || isApplying;\n const allOptionsSelected = selectedValues.length === options.length && options.length > 0;\n\n useEffect(() => {\n function updateComponentData() {\n setComponentData({ ...gjsModel.get('componentProps') });\n }\n\n function updateAttributes() {\n setAttributes({ ...gjsModel.get('attributes') });\n }\n\n gjsModel.on('change:componentProps', updateComponentData);\n gjsModel.on('change:attributes', updateAttributes);\n\n return () => {\n gjsModel.off('change:componentProps', updateComponentData);\n gjsModel.off('change:attributes', updateAttributes);\n };\n }, [gjsModel]);\n\n useEffect(() => {\n const doc = wrapperRef.current?.ownerDocument ?? document;\n\n function handleOutsideClick(e: PointerEvent) {\n if (isDropdownOpen && wrapperRef.current && !wrapperRef.current.contains(e.target as Node)) {\n setIsDropdownOpen(false);\n }\n }\n\n function handleEscape(e: KeyboardEvent) {\n if (e.key === 'Escape') {\n setIsDropdownOpen(false);\n }\n }\n\n doc.addEventListener('pointerdown', handleOutsideClick);\n doc.addEventListener('keydown', handleEscape);\n\n return () => {\n doc.removeEventListener('pointerdown', handleOutsideClick);\n doc.removeEventListener('keydown', handleEscape);\n };\n }, [isDropdownOpen]);\n\n const filteredOptions = options.filter((opt: FilterOption) =>\n opt.label.toLowerCase().includes(searchQuery.toLowerCase()),\n );\n\n async function updateAndApply(newValues: string[] = selectedValues) {\n setIsApplying(true);\n\n try {\n gjsModel.set('componentProps', {\n ...gjsModel.get('componentProps'),\n value: newValues,\n });\n\n const id = gjsModel.get('id');\n\n await performInteraction({\n interactionType: 'filter',\n id,\n affectedComponents: getAffectedComponentsWithLoader([id, ...affectedComponents], true),\n });\n } finally {\n setIsApplying(false);\n setIsDropdownOpen(false);\n }\n }\n\n const handleOptionToggle = useCallback(\n (val: string) => {\n if (isMultiSelect) {\n setSelectedValues((prev) =>\n prev.includes(val) ? prev.filter((v) => v !== val) : [...prev, val],\n );\n } else {\n if (selectedValues.includes(val)) {\n setSelectedValues([]);\n updateAndApply([]);\n } else {\n const singleValue = [val];\n setSelectedValues(singleValue);\n updateAndApply(singleValue);\n }\n }\n },\n [isMultiSelect, selectedValues],\n );\n\n function handleClearAll() {\n setSelectedValues([]);\n }\n\n function handleSelectAll() {\n setSelectedValues(options.map((o: FilterOption) => o.value));\n }\n\n return (\n <div\n ref={wrapperRef}\n className={`relative inline-block ${className}`}\n style={{ color: '#2A44D4', backgroundColor: 'rgb(255 255 255)' }}\n >\n <FilterHeader\n label={label}\n count={selectedValues.length}\n isDisabled={isBusy}\n isDropdownOpen={isDropdownOpen}\n isLoading={isBusy}\n toggleOpen={() => setIsDropdownOpen((prev) => !prev)}\n />\n\n {isDropdownOpen && (\n <div className=\"absolute right-0 top-full mt-2 w-64 bg-white border rounded-lg shadow-lg ring-1 ring-black ring-opacity-5 p-4 z-50\">\n <input\n type=\"text\"\n placeholder=\"Search...\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n className=\"w-full mb-3 px-2 py-1 border rounded focus:outline-none\"\n disabled={isBusy}\n />\n\n {isMultiSelect && (\n <FilterActions\n selected={selectedValues}\n allSelected={allOptionsSelected}\n onClear={handleClearAll}\n onSelectAll={handleSelectAll}\n isDisabled={isBusy}\n />\n )}\n\n <FilterOptionList\n options={filteredOptions}\n selected={selectedValues}\n onToggle={handleOptionToggle}\n isDisabled={isBusy}\n />\n\n {isMultiSelect && (\n <div className=\"flex justify-end space-x-2\">\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => setIsDropdownOpen(false)}\n disabled={isApplying}\n >\n Cancel\n </Button>\n <Button\n variant=\"default\"\n size=\"sm\"\n onClick={() => updateAndApply(selectedValues)}\n disabled={isBusy}\n >\n {isApplying && <Loader2Icon className=\"animate-spin mr-2\" size={16} />}Apply\n </Button>\n </div>\n )}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":"wLAAA,uDACA,OAASA,WAAW,CAAEC,SAAS,CAAEC,MAAM,CAAEC,QAAQ,KAAQ,OAAO,CAChE,OAASC,WAAW,CAAEC,SAAS,CAAEC,UAAU,GAAI,CAAAC,UAAU,CAAEC,WAAW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7BzH,UAAU,CAAEwE,MAAO,CACpB,CACF,cAED/E,IAAA,CAACgC,gBAAgB,EACfE,OAAO,CAAEiE,eAAgB,CACzB/E,QAAQ,CAAEwD,cAAe,CACzBzC,QAAQ,CAAEwF,kBAAmB,CAC7BpH,UAAU,CAAEwE,MAAO,CACpB,CAAC,CAEDD,aAAa,eACZ5E,KAAA,QAAKc,SAAS,CAAC,4BAA4B,CAAAC,QAAA,eACzCjB,IAAA,CAACL,MAAM,EACLiB,OAAO,CAAC,OAAO,CACfC,IAAI,CAAC,IAAI,CACTE,OAAO,CAAE,QAAT,CAAAA,OAAOA,CAAA,QAAQ,CAAAyC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CACxC1C,QAAQ,CAAE+C,UAAW,CAAA5C,QAAA,CACtB,QAED,CAAQ,CAAC,cACTf,KAAA,CAACP,MAAM,EACLiB,OAAO,CAAC,SAAS,CACjBC,IAAI,CAAC,IAAI,CACTE,OAAO,CAAE,QAAT,CAAAA,OAAOA,CAAA,QAAQ,CAAAuF,cAAc,CAAC1B,cAAc,CAAC,CAAC,CAC9C9D,QAAQ,CAAEiE,MAAO,CAAA9D,QAAA,EAEhB4C,UAAU,eAAI7D,IAAA,CAACN,WAAW,EAACsB,SAAS,CAAC,mBAAmB,CAACH,IAAI,CAAE,EAAG,CAAE,CAAC,CAAC,OACzE,EAAQ,CAAC,EACN,CACN,EACE,CACN,EACE,CAET","ignoreList":[]}
1
+ {"version":3,"file":"filter.js","names":["useCallback","useEffect","useRef","useState","ChevronDown","ChevronUp","ListFilter","FilterIcon","Loader2Icon","Button","Checkbox","ScrollArea","getAffectedComponentsWithLoader","jsx","_jsx","jsxs","_jsxs","FilterHeader","_ref","label","count","isDisabled","isDropdownOpen","isLoading","toggleOpen","ChevronIcon","variant","size","disabled","onClick","className","children","FilterActions","_ref2","selected","allSelected","onClear","onSelectAll","checked","onCheckedChange","length","type","onMouseDown","e","stopPropagation","preventDefault","FilterOptionList","_ref3","options","onToggle","viewportClassName","map","opt","value","includes","onChange","renderFilter","_ref4","gjsModel","performInteraction","wrapperRef","_useState","_extends","get","componentData","setComponentData","_useState2","attributes","setAttributes","_useState3","setIsDropdownOpen","_useState4","searchQuery","setSearchQuery","_useState5","isApplying","setIsApplying","_componentData$option","_componentData$value","_componentData$classN","_componentData$affect","affectedComponents","_componentData$text","text","_componentData$filter","filterType","defaultValue","_useState6","Array","isArray","selectedValues","setSelectedValues","isMultiSelect","isBusy","interactionApiInProgress","allOptionsSelected","updateComponentData","updateAttributes","on","off","_wrapperRef$current$o","_wrapperRef$current","doc","current","ownerDocument","document","handleOutsideClick","contains","target","handleEscape","key","addEventListener","removeEventListener","filteredOptions","filter","toLowerCase","updateAndApply","_x","_updateAndApply","apply","arguments","_asyncToGenerator","_regeneratorRuntime","mark","_callee","newValues","id","wrap","_callee$","_context","prev","next","set","interactionType","concat","finish","stop","handleOptionToggle","val","v","singleValue","handleClearAll","handleSelectAll","o","ref","style","color","backgroundColor","placeholder"],"sources":["../../../../src/shadcn/components/ui/filter.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { useCallback, useEffect, useRef, useState } from 'react';\nimport { ChevronDown, ChevronUp, ListFilter as FilterIcon, Loader2Icon } from 'lucide-react';\n\nimport { Button } from './button';\nimport { Checkbox } from './checkbox';\nimport { ScrollArea } from './scroll-area';\nimport { getAffectedComponentsWithLoader } from '../../../helpers';\n\ntype FilterOption = {\n label: string;\n value: string;\n};\n\ntype FilterProps = {\n isEditable?: boolean;\n gjsModel: any;\n performInteraction: (payload: Record<string, any>) => Promise<void>;\n};\n\ntype FilterHeaderProps = {\n label: string;\n count: number;\n isDisabled: boolean;\n isDropdownOpen: boolean;\n isLoading: boolean;\n toggleOpen: () => void;\n};\n\ntype FilterActionsProps = {\n selected: string[];\n allSelected: boolean;\n onClear: () => void;\n onSelectAll: () => void;\n isDisabled: boolean;\n};\n\ntype FilterOptionListProps = {\n options: FilterOption[];\n selected: string[];\n onToggle: (value: string) => void;\n isDisabled: boolean;\n};\n\nfunction FilterHeader({\n label,\n count,\n isDisabled,\n isDropdownOpen,\n isLoading,\n toggleOpen,\n}: FilterHeaderProps) {\n const ChevronIcon = isDropdownOpen ? ChevronUp : ChevronDown;\n\n return (\n <Button variant=\"outline\" size=\"sm\" disabled={isDisabled} onClick={toggleOpen} className=\"px-2\">\n <FilterIcon size={16} />\n {count > 0 ? `${label} (${count})` : label}\n {isLoading ? (\n <Loader2Icon className=\"ml-2 animate-spin\" size={16} />\n ) : (\n <ChevronIcon size={16} className=\"ml-1\" />\n )}\n </Button>\n );\n}\n\nfunction FilterActions({\n selected,\n allSelected,\n onClear,\n onSelectAll,\n isDisabled,\n}: FilterActionsProps) {\n return (\n <div className=\"flex items-center mb-3\">\n <Checkbox\n checked={allSelected}\n onCheckedChange={() => (allSelected ? onClear() : onSelectAll())}\n disabled={isDisabled}\n />\n <span className=\"ml-2 text-sm text-gray-900\">Select All</span>\n {selected.length > 0 && (\n <button\n type=\"button\"\n className=\"ml-auto text-sm text-blue-600 hover:underline\"\n onMouseDown={(e) => {\n e.stopPropagation();\n e.preventDefault();\n }}\n onClick={onClear}\n disabled={isDisabled}\n >\n Clear All\n </button>\n )}\n </div>\n );\n}\n\nfunction FilterOptionList({ options, selected, onToggle, isDisabled }: FilterOptionListProps) {\n return (\n <ScrollArea viewportClassName=\"max-h-48 overflow-y-auto mb-4 space-y-2\">\n {options.length > 0 ? (\n options.map((opt) => (\n <label\n key={opt.value}\n className=\"flex items-center space-x-2 hover:bg-gray-100 rounded p-1 transition hover:cursor-pointer\"\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n\n if (!isDisabled) {\n onToggle(opt.value);\n }\n }}\n >\n <Checkbox\n checked={selected.includes(opt.value)}\n onChange={() => {\n // Prevent checkbox from toggling when clicking label\n }}\n // onClick={(e) => e.stopPropagation()}\n disabled={isDisabled}\n />\n <span className=\"text-sm text-gray-900\">{opt.label}</span>\n </label>\n ))\n ) : (\n <div className=\"text-sm text-gray-500\">No results found</div>\n )}\n </ScrollArea>\n );\n}\n\nexport function renderFilter({ gjsModel, performInteraction }: FilterProps) {\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n const [componentData, setComponentData] = useState({ ...gjsModel.get('componentProps') });\n const [attributes, setAttributes] = useState({ ...gjsModel.get('attributes') });\n const [isDropdownOpen, setIsDropdownOpen] = useState(false);\n const [searchQuery, setSearchQuery] = useState('');\n const [isApplying, setIsApplying] = useState(false);\n\n const {\n options = [],\n value = [],\n className = '',\n affectedComponents = [],\n text: label = 'Filter',\n filterType = 'multiselect',\n } = componentData;\n\n const defaultValue = componentData.default || [];\n\n const [selectedValues, setSelectedValues] = useState<string[]>(() => {\n return Array.isArray(value) && value.length > 0 ? value : defaultValue;\n });\n\n const isMultiSelect = filterType === 'multiselect';\n const isBusy = attributes.interactionApiInProgress || isApplying;\n const allOptionsSelected = selectedValues.length === options.length && options.length > 0;\n\n useEffect(() => {\n function updateComponentData() {\n setComponentData({ ...gjsModel.get('componentProps') });\n }\n\n function updateAttributes() {\n setAttributes({ ...gjsModel.get('attributes') });\n }\n\n gjsModel.on('change:componentProps', updateComponentData);\n gjsModel.on('change:attributes', updateAttributes);\n\n return () => {\n gjsModel.off('change:componentProps', updateComponentData);\n gjsModel.off('change:attributes', updateAttributes);\n };\n }, [gjsModel]);\n\n useEffect(() => {\n const doc = wrapperRef.current?.ownerDocument ?? document;\n\n function handleOutsideClick(e: PointerEvent) {\n if (isDropdownOpen && wrapperRef.current && !wrapperRef.current.contains(e.target as Node)) {\n setIsDropdownOpen(false);\n }\n }\n\n function handleEscape(e: KeyboardEvent) {\n if (e.key === 'Escape') {\n setIsDropdownOpen(false);\n }\n }\n\n doc.addEventListener('pointerdown', handleOutsideClick);\n doc.addEventListener('keydown', handleEscape);\n\n return () => {\n doc.removeEventListener('pointerdown', handleOutsideClick);\n doc.removeEventListener('keydown', handleEscape);\n };\n }, [isDropdownOpen]);\n\n const filteredOptions = options.filter((opt: FilterOption) =>\n opt.label.toLowerCase().includes(searchQuery.toLowerCase()),\n );\n\n async function updateAndApply(newValues: string[] = selectedValues) {\n setIsApplying(true);\n\n try {\n gjsModel.set('componentProps', {\n ...gjsModel.get('componentProps'),\n value: newValues,\n });\n\n const id = gjsModel.get('id');\n\n await performInteraction({\n interactionType: 'filter',\n id,\n affectedComponents: getAffectedComponentsWithLoader([id, ...affectedComponents], true),\n });\n } finally {\n setIsApplying(false);\n setIsDropdownOpen(false);\n }\n }\n\n const handleOptionToggle = useCallback(\n (val: string) => {\n if (isMultiSelect) {\n setSelectedValues((prev) =>\n prev.includes(val) ? prev.filter((v) => v !== val) : [...prev, val],\n );\n } else {\n if (selectedValues.includes(val)) {\n setSelectedValues([]);\n updateAndApply([]);\n } else {\n const singleValue = [val];\n setSelectedValues(singleValue);\n updateAndApply(singleValue);\n }\n }\n },\n [isMultiSelect, selectedValues],\n );\n\n function handleClearAll() {\n setSelectedValues([]);\n }\n\n function handleSelectAll() {\n setSelectedValues(options.map((o: FilterOption) => o.value));\n }\n\n return (\n <div\n ref={wrapperRef}\n className={`relative inline-block ${className}`}\n style={{ color: '#2A44D4', backgroundColor: 'rgb(255 255 255)' }}\n >\n <FilterHeader\n label={label}\n count={selectedValues.length}\n isDisabled={isBusy}\n isDropdownOpen={isDropdownOpen}\n isLoading={isBusy}\n toggleOpen={() => setIsDropdownOpen((prev) => !prev)}\n />\n\n {isDropdownOpen && (\n <div className=\"absolute right-0 top-full mt-2 w-64 bg-white border rounded-lg shadow-lg ring-1 ring-black ring-opacity-5 p-4 z-50\">\n <input\n type=\"text\"\n placeholder=\"Search...\"\n value={searchQuery}\n onChange={(e) => setSearchQuery(e.target.value)}\n className=\"w-full mb-3 px-2 py-1 border rounded focus:outline-none\"\n disabled={isBusy}\n />\n\n {isMultiSelect && (\n <FilterActions\n selected={selectedValues}\n allSelected={allOptionsSelected}\n onClear={handleClearAll}\n onSelectAll={handleSelectAll}\n isDisabled={isBusy}\n />\n )}\n\n <FilterOptionList\n options={filteredOptions}\n selected={selectedValues}\n onToggle={handleOptionToggle}\n isDisabled={isBusy}\n />\n\n {isMultiSelect && (\n <div className=\"flex justify-end space-x-2\">\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => setIsDropdownOpen(false)}\n disabled={isApplying}\n >\n Cancel\n </Button>\n <Button\n variant=\"default\"\n size=\"sm\"\n onClick={() => updateAndApply(selectedValues)}\n disabled={isBusy}\n >\n {isApplying && <Loader2Icon className=\"animate-spin mr-2\" size={16} />}Apply\n </Button>\n </div>\n )}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":"wLAAA,uDACA,OAASA,WAAW,CAAEC,SAAS,CAAEC,MAAM,CAAEC,QAAQ,KAAQ,OAAO,CAChE,OAASC,WAAW,CAAEC,SAAS,CAAEC,UAAU,GAAI,CAAAC,UAAU,CAAEC,WAAW,KAAQ,cAAc,CAE5F,OAASC,MAAM,KAAQ,UAAU,CACjC,OAASC,QAAQ,KAAQ,YAAY,CACrC,OAASC,UAAU,KAAQ,eAAe,CAC1C,OAASC,+BAA+B,KAAQ,kBAAkB,CAAC,OAAAC,GAAA,IAAAC,IAAA,CAAAC,IAAA,IAAAC,KAAA,yBAqCnE,QAAS,CAAAC,YAAYA,CAAAC,IAAA,CAOC,IANpB,CAAAC,KAAK,CAAAD,IAAA,CAALC,KAAK,CACLC,KAAK,CAAAF,IAAA,CAALE,KAAK,CACLC,UAAU,CAAAH,IAAA,CAAVG,UAAU,CACVC,cAAc,CAAAJ,IAAA,CAAdI,cAAc,CACdC,SAAS,CAAAL,IAAA,CAATK,SAAS,CACTC,UAAU,CAAAN,IAAA,CAAVM,UAAU,CAEV,GAAM,CAAAC,WAAW,CAAGH,cAAc,CAAGjB,SAAS,CAAGD,WAAW,CAE5D,mBACEY,KAAA,CAACP,MAAM,EAACiB,OAAO,CAAC,SAAS,CAACC,IAAI,CAAC,IAAI,CAACC,QAAQ,CAAEP,UAAW,CAACQ,OAAO,CAAEL,UAAW,CAACM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