import _ from 'lodash'
window.lodash = _.noConflict()
import React from 'react';
import { Listbox } from '@headlessui/react'
declare global {
interface Props {}
interface Window {
wp:any,
lodash:any
}
interface Math {
round:(x: number) => number
}
}
const CheckmarkIcon = () => (
)
const ExpandIcon = ({open=false}) => ()
const CustomSelect:React.FC<{
title:string,attrname:string,attrval:any,children:any,width?:string,className?:any,style?:any,setAttributes:any
}> = props => {
const {title,attrname,attrval,children,width="12",className="",style={},setAttributes=()=>{}} = props;
const mappedvalues = _.map(children,d=>({value:d.props.value,label:d.props.children}))
let founditem = _.find(mappedvalues,m=>(m.value==attrval))
let founditemstr=!_.isNil(founditem)&&_.has(founditem,'label')?founditem.label:attrval
let w = Math.round((parseInt(width)/12)*100)+'%'
return (
);
}
export default CustomSelect