"use strict";var _interopRequireWildcard=require("@babel/runtime/helpers/interopRequireWildcard"),_interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.defaultProps=exports.propTypes=void 0;var _classCallCheck2=_interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")),_possibleConstructorReturn2=_interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")),_getPrototypeOf2=_interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")),_assertThisInitialized2=_interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized")),_createClass2=_interopRequireDefault(require("@babel/runtime/helpers/createClass")),_inherits2=_interopRequireDefault(require("@babel/runtime/helpers/inherits")),_defineProperty2=_interopRequireDefault(require("@babel/runtime/helpers/defineProperty")),_objectSpread2=_interopRequireDefault(require("@babel/runtime/helpers/objectSpread")),_react=_interopRequireWildcard(require("react")),_propTypes=_interopRequireDefault(require("prop-types")),_classnames=_interopRequireDefault(require("classnames")),_componentHelper=require("../../shared/component-helper"),_Slider=_interopRequireDefault(require("../../components/slider/Slider")),_Input=_interopRequireDefault(require("../../components/input/Input")),_Modal=_interopRequireDefault(require("../../components/modal/Modal")),_FormLabel=_interopRequireDefault(require("../../components/form-label/FormLabel")),renderProps={},propTypes={label_text:_propTypes.default.string.isRequired,range_min:_propTypes.default.number.isRequired,range_max:_propTypes.default.number.isRequired,range_val:_propTypes.default.number.isRequired,range_step:_propTypes.default.number.isRequired,range_output_description:_propTypes.default.string.isRequired,range_output_extra_information:_propTypes.default.string.isRequired,range_trigger_text:_propTypes.default.string.isRequired,range_modal_text:_propTypes.default.string.isRequired,class:_propTypes.default.string,className:_propTypes.default.string,children:_propTypes.default.oneOfType([_propTypes.default.string,_propTypes.default.node,_propTypes.default.func])};exports.propTypes=propTypes;var defaultProps=(0,_objectSpread2.default)({title:null,text:null,descriptionListData:null,descriptionListInfo:null,class:null,className:null,children:null},renderProps);exports.defaultProps=defaultProps;var RangeSlider=function(e){function t(e){var r;return(0,_classCallCheck2.default)(this,t),r=(0,_possibleConstructorReturn2.default)(this,(0,_getPrototypeOf2.default)(t).call(this,e)),(0,_defineProperty2.default)((0,_assertThisInitialized2.default)(r),"state",{value:null}),r.state.value=e.range_val,r}return(0,_inherits2.default)(t,e),(0,_createClass2.default)(t,null,[{key:"enableWebComponent",value:function(){(0,_componentHelper.registerElement)(t.tagName,t,defaultProps)}}]),(0,_createClass2.default)(t,[{key:"render",value:function(){var t=this,e=this.props,r=e.range_min,a=e.range_max,l=e.range_step,i=e.label_text,n=e.range_output_description,s=e.range_output_extra_information,u=e.range_trigger_text,p=e.range_modal_text,o=e.className,d=e.class,_={className:(0,_classnames.default)("dnb-range-slider",o,d)};return(0,_componentHelper.validateDOMAttributes)(this.props,_),_react.default.createElement("div",_,_react.default.createElement("div",{className:"dnb-range-slider__label"},_react.default.createElement("div",{className:"dnb-range-slider__label__inner"},_react.default.createElement(_FormLabel.default,{for_id:"range-slider",text:i}))),_react.default.createElement("div",{className:"dnb-range-slider__slider"},_react.default.createElement("div",{className:"dnb-range-slider__input-container"},_react.default.createElement(_Slider.default,{id:"range-slider",min:r,max:a,value:this.state.value,step:l,on_init:function(e){var r=e.value;t.setState({value:r})},on_change:function(e){var r=e.value;t.setState({value:r})}})),_react.default.createElement("div",{className:"dnb-range-slider__output-container"},_react.default.createElement(_Input.default,{type:"text",size:"large",value:this.state.value,font_class:"typo-light dnb-typo-number--oldstyle",description:n,status:s,status_state:"info",on_change:function(e){var r=e.value;t.setState({value:parseFloat(r)})}})),_react.default.createElement("div",{className:"dnb-range-slider__slider__modal"},_react.default.createElement(_Modal.default,{type:"button",trigger_text:u,modal_content:p}))))}}]),t}(_react.PureComponent);exports.default=RangeSlider,(0,_defineProperty2.default)(RangeSlider,"tagName","dnb-range-slider"),(0,_defineProperty2.default)(RangeSlider,"defaultProps",defaultProps),RangeSlider.propTypes="production"!==process.env.NODE_ENV?propTypes:{};
//# sourceMappingURL=RangeSlider.js.map
