import{_ as _extends}from"./_rollupPluginBabelHelpers-B5fk9IVe.js";import React__default,{useState,useEffect}from"react";import PropTypes from"prop-types";import{F as FilterInput}from"./FilterInput.component-DGKAGon-.js";const filterStyles=`
	jn-mb-px
	jn-bg-theme-filters
	jn-rounded-t
	jn-pt-4
	jn-px-4
	jn-pb-2
`,inputWrapperStyles=`
	jn-w-full
	jn-flex
	jn-mb-2
`,searchWrapperStyles=`
	jn-ml-auto
`,filterPillWrapperStyles=`
	jn-flex
	jn-flex-wrap
`,errortextStyles=`
	jn-text-theme-error
	jn-text-sm
	jn-mt-[-0.25rem]
	jn-mb-1.5
`,Filters=a=>{let{search:h=null,filters:i=null,selectedFilterKey:j="",onSelectedFilterKeyChange:b,filterValue:k="",valuePlaceholder:l="",onFilterValueChange:c,onFilter:d,onFilterClear:e,children:f,className:m="",loading:n=!1,error:o=!1,errortext:p="",...g}=a;const[q,r]=useState(!1),[s,t]=useState(!1);return useEffect(()=>{t(o||"string"==typeof p&&0<p.length)},[o,p]),useEffect(()=>{r(n)},[n]),React__default.createElement("div",_extends({className:`juno-filters ${s?"juno-filters-error ":""} ${filterStyles} ${m}`},g),React__default.createElement("div",{className:`juno-filters-input-wrapper ${inputWrapperStyles}`},i&&i.options?React__default.createElement(FilterInput,{keyLabel:i.keyLabel,valueLabel:i.valueLabel,options:i.options,selectedFilterKey:j,onSelectedFilterKeyChange:b,filterValue:k,valuePlaceholder:l,onFilterValueChange:c,onFilter:d,onClear:e,loading:q,error:s}):null,h?React__default.createElement("div",{className:`${searchWrapperStyles}`},h):null),s&&p?React__default.createElement("div",{className:`juno-filters-errortext ${errortextStyles}`},p):"",React__default.createElement("div",{className:`${filterPillWrapperStyles}`},f))};Filters.propTypes={search:PropTypes.node,filters:PropTypes.object,selectedFilterKey:PropTypes.string,onSelectedFilterKeyChange:PropTypes.func,filterValue:PropTypes.string,valuePlaceholder:PropTypes.string,onFilterValueChange:PropTypes.func,onFilter:PropTypes.func,onFilterClear:PropTypes.func,className:PropTypes.string,loading:PropTypes.bool,error:PropTypes.bool,errortext:PropTypes.string,children:PropTypes.any};export{Filters as F};