!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("openstack-uicore-foundation",[],t):"object"==typeof exports?exports["openstack-uicore-foundation"]=t():e["openstack-uicore-foundation"]=t()}(this,(()=>(()=>{"use strict";var e={6689:e=>{e.exports=require("react")}},t={};function o(a){var r=t[a];if(void 0!==r)return r.exports;var n=t[a]={exports:{}};return e[a](n,n.exports,o),n.exports}(()=>{o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t}})(),(()=>{o.d=(e,t)=>{for(var a in t)o.o(t,a)&&!o.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})}})(),(()=>{o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t)})(),(()=>{o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}})();var a={};return(()=>{o.r(a),o.d(a,{default:()=>n});var e=o(6689),t=o.n(e);const r=({value:e,label:o,options:a})=>[t().createElement("option",{key:"group"+e,className:"option-group",value:e},o),a.map(((e,o)=>t().createElement("option",{className:"option-child",key:e.value,value:e.value}," - ",e.label)))];class n extends t().Component{constructor(e){super(e),this.state={value:e.value},this.handleChange=this.handleChange.bind(this)}componentDidUpdate(e,t,o){this.props.value!==e.value&&this.setState({value:this.props.value})}handleChange(e){this.props.onChange(e)}render(){let{id:e,options:o,placeholder:a,className:n,error:l}=this.props,s=this.props.hasOwnProperty("error")&&""!=l,{value:p}=this.state;return t().createElement("div",null,t().createElement("select",{id:e,className:n+" form-control "+(s?"error":""),value:p,onChange:this.handleChange},t().createElement("option",{value:"",disabled:!0},a),o.map(((e,o)=>void 0!==e.options?t().createElement(r,{key:"group_opt_"+o,label:e.label,value:e.value,options:e.options}):t().createElement("option",{key:e.value,value:e.value},e.label)))),s&&t().createElement("p",{className:"error-label"},l))}}})(),a})()));
//# sourceMappingURL=grouped-dropdown.js.map