shaf-star-rating
Version:
Accessible star rating element. Upgrades <input type="number" />
6 lines • 20.4 kB
JavaScript
!function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}var i=n(5),r=o(i);customElements.define("shaf-star-rating",r.default)},function(e,t,n){!function(e,n){n(t)}(this,function(e){function t(e,t,n){this.nodeName=e,this.attributes=t,this.children=n,this.key=t&&t.key}function n(e,n){var o,i,r,a,s=[];for(a=arguments.length;a-- >2;)K.push(arguments[a]);for(n&&n.children&&(K.length||K.push(n.children),delete n.children);K.length;)if((i=K.pop())instanceof Array)for(a=i.length;a--;)K.push(i[a]);else null!=i&&i!==!1&&("number"!=typeof i&&i!==!0||(i=String(i)),r="string"==typeof i,r&&o?s[s.length-1]+=i:(s.push(i),o=r));var l=new t(e,n||void 0,s);return B.vnode&&B.vnode(l),l}function o(e,t){if(t)for(var n in t)e[n]=t[n];return e}function i(e){return o({},e)}function r(e,t){for(var n=t.split("."),o=0;o<n.length&&e;o++)e=e[n[o]];return e}function a(e){return"function"==typeof e}function s(e){return"string"==typeof e}function l(e){var t="";for(var n in e)e[n]&&(t&&(t+=" "),t+=n);return t}function u(e,t){return n(e.nodeName,o(i(e.attributes),t),arguments.length>2?[].slice.call(arguments,2):e.children)}function d(e,t,n){var o=t.split(".");return function(t){for(var i=t&&t.target||this,a={},l=a,u=s(n)?r(t,n):i.nodeName?i.type.match(/^che|rad/)?i.checked:i.value:t,d=0;d<o.length-1;d++)l=l[o[d]]||(l[o[d]]=!d&&e.state[o[d]]||{});l[o[d]]=u,e.setState(a)}}function c(e){!e._dirty&&(e._dirty=!0)&&1==Q.push(e)&&(B.debounceRendering||W)(h)}function h(){var e,t=Q;for(Q=[];e=t.pop();)e._dirty&&D(e)}function p(e){var t=e&&e.nodeName;return t&&a(t)&&!(t.prototype&&t.prototype.render)}function f(e,t){return e.nodeName(y(e),t||q)}function v(e,t){return s(t)?e instanceof Text:s(t.nodeName)?m(e,t.nodeName):a(t.nodeName)?e._componentConstructor===t.nodeName||p(t):void 0}function m(e,t){return e.normalizedNodeName===t||I(e.nodeName)===I(t)}function y(e){var t=i(e.attributes);t.children=e.children;var n=e.nodeName.defaultProps;if(n)for(var o in n)void 0===t[o]&&(t[o]=n[o]);return t}function b(e){var t=e.parentNode;t&&t.removeChild(e)}function g(e,t,n,o,i){if("className"===t&&(t="class"),"class"===t&&o&&"object"==typeof o&&(o=l(o)),"key"===t);else if("class"!==t||i)if("style"===t){if((!o||s(o)||s(n))&&(e.style.cssText=o||""),o&&"object"==typeof o){if(!s(n))for(var r in n)r in o||(e.style[r]="");for(var r in o)e.style[r]="number"!=typeof o[r]||V[r]?o[r]:o[r]+"px"}}else if("dangerouslySetInnerHTML"===t)o&&(e.innerHTML=o.__html);else if("o"==t[0]&&"n"==t[1]){var u=e._listeners||(e._listeners={});t=I(t.substring(2)),o?u[t]||e.addEventListener(t,C,!!J[t]):u[t]&&e.removeEventListener(t,C,!!J[t]),u[t]=o}else if("list"!==t&&"type"!==t&&!i&&t in e)_(e,t,null==o?"":o),null!=o&&o!==!1||e.removeAttribute(t);else{var d=i&&t.match(/^xlink\:?(.+)/);null==o||o===!1?d?e.removeAttributeNS("http://www.w3.org/1999/xlink",I(d[1])):e.removeAttribute(t):"object"==typeof o||a(o)||(d?e.setAttributeNS("http://www.w3.org/1999/xlink",I(d[1]),o):e.setAttribute(t,o))}else e.className=o||""}function _(e,t,n){try{e[t]=n}catch(e){}}function C(e){return this._listeners[e.type](B.event&&B.event(e)||e)}function k(e){if(b(e),e instanceof Element){e._component=e._componentConstructor=null;var t=e.normalizedNodeName||I(e.nodeName);(X[t]||(X[t]=[])).push(e)}}function x(e,t){var n=I(e),o=X[n]&&X[n].pop()||(t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e));return o.normalizedNodeName=n,o}function w(){for(var e;e=Y.pop();)B.afterMount&&B.afterMount(e),e.componentDidMount&&e.componentDidMount()}function M(e,t,n,o,i,r){Z++||($=i instanceof SVGElement);var a=S(e,t,n,o);return i&&a.parentNode!==i&&i.appendChild(a),--Z||r||w(),a}function S(e,t,n,o){for(var i=t&&t.attributes;p(t);)t=f(t,n);if(null==t&&(t=""),s(t)){if(e){if(e instanceof Text&&e.parentNode)return e.nodeValue!=t&&(e.nodeValue=t),e;L(e)}return document.createTextNode(t)}if(a(t.nodeName))return H(e,t,n,o);var r=e,l=t.nodeName,u=$,d=t.children;if(s(l)||(l=String(l)),$="svg"===l||"foreignObject"!==l&&$,e){if(!m(e,l)){for(r=x(l,$);e.firstChild;)r.appendChild(e.firstChild);L(e)}}else r=x(l,$);d&&1===d.length&&"string"==typeof d[0]&&1===r.childNodes.length&&r.firstChild instanceof Text?r.firstChild.nodeValue!=d[0]&&(r.firstChild.nodeValue=d[0]):(d&&d.length||r.firstChild)&&N(r,d,n,o);var c=r[G];if(!c){r[G]=c={};for(var h=r.attributes,v=h.length;v--;)c[h[v].name]=h[v].value}return O(r,t.attributes,c),i&&"function"==typeof i.ref&&(c.ref=i.ref)(r),$=u,r}function N(e,t,n,o){var i,r,s,l,u=e.childNodes,d=[],c={},h=0,p=0,f=u.length,m=0,y=t&&t.length;if(f)for(var b=0;b<f;b++){var g=u[b],_=y?(r=g._component)?r.__key:(r=g[G])?r.key:null:null;_||0===_?(h++,c[_]=g):d[m++]=g}if(y)for(var b=0;b<y;b++){s=t[b],l=null;var _=s.key;if(null!=_)h&&_ in c&&(l=c[_],c[_]=void 0,h--);else if(!l&&p<m){for(i=p;i<m;i++)if(r=d[i],r&&v(r,s)){l=r,d[i]=void 0,i===m-1&&m--,i===p&&p++;break}!l&&p<m&&a(s.nodeName)&&o&&(l=d[p],d[p++]=void 0)}l=S(l,s,n,o),l&&l!==e&&l!==u[b]&&e.insertBefore(l,u[b]||null)}if(h)for(var b in c)c[b]&&L(c[b]);p<m&&E(d)}function E(e,t){for(var n=e.length;n--;)e[n]&&L(e[n],t)}function L(e,t){var n=e._component;n?F(n,!t):(e[G]&&e[G].ref&&e[G].ref(null),t||k(e),e.childNodes&&e.childNodes.length&&E(e.childNodes,t))}function O(e,t,n){for(var o in n)t&&o in t||null==n[o]||g(e,o,n[o],n[o]=void 0,$);if(t)for(var i in t)"children"===i||"innerHTML"===i||i in n&&t[i]===("value"===i||"checked"===i?e[i]:n[i])||g(e,i,n[i],n[i]=t[i],$)}function T(e){var t=e.constructor.name,n=ee[t];n?n.push(e):ee[t]=[e]}function P(e,t,n){var o=new e(t,n),i=ee[e.name];if(U.call(o,t,n),i)for(var r=i.length;r--;)if(i[r].constructor===e){o.nextBase=i[r].nextBase,i.splice(r,1);break}return o}function j(e,t,n,o,i){e._disable||(e._disable=!0,(e.__ref=t.ref)&&delete t.ref,(e.__key=t.key)&&delete t.key,!e.base||i?e.componentWillMount&&e.componentWillMount():e.componentWillReceiveProps&&e.componentWillReceiveProps(t,o),o&&o!==e.context&&(e.prevContext||(e.prevContext=e.context),e.context=o),e.prevProps||(e.prevProps=e.props),e.props=t,e._disable=!1,0!==n&&(1!==n&&B.syncComponentUpdates===!1&&e.base?c(e):D(e,1,i)),e.__ref&&e.__ref(e))}function D(e,t,n,r){if(!e._disable){var s,l,u,d,c=e.props,h=e.state,v=e.context,m=e.prevProps||c,b=e.prevState||h,g=e.prevContext||v,_=e.base,C=e.nextBase,k=_||C,x=e._component;if(_&&(e.props=m,e.state=b,e.context=g,2!==t&&e.shouldComponentUpdate&&e.shouldComponentUpdate(c,h,v)===!1?s=!0:e.componentWillUpdate&&e.componentWillUpdate(c,h,v),e.props=c,e.state=h,e.context=v),e.prevProps=e.prevState=e.prevContext=e.nextBase=null,e._dirty=!1,!s){for(e.render&&(l=e.render(c,h,v)),e.getChildContext&&(v=o(i(v),e.getChildContext()));p(l);)l=f(l,v);var S,N,E=l&&l.nodeName;if(a(E)){u=x;var O=y(l);u&&u.constructor===E?j(u,O,1,v):(S=u,u=P(E,O,v),u.nextBase=u.nextBase||C,u._parentComponent=e,e._component=u,j(u,O,0,v),D(u,1,n,!0)),N=u.base}else d=k,S=x,S&&(d=e._component=null),(k||1===t)&&(d&&(d._component=null),N=M(d,l,v,n||!_,k&&k.parentNode,!0));if(k&&N!==k&&u!==x){var T=k.parentNode;T&&N!==T&&(T.replaceChild(N,k),S||(k._component=null,L(k)))}if(S&&F(S,N!==k),e.base=N,N&&!r){for(var H=e,U=e;U=U._parentComponent;)(H=U).base=N;N._component=H,N._componentConstructor=H.constructor}}!_||n?Y.unshift(e):s||(e.componentDidUpdate&&e.componentDidUpdate(m,b,g),B.afterUpdate&&B.afterUpdate(e));var A,K=e._renderCallbacks;if(K)for(;A=K.pop();)A.call(e);Z||r||w()}}function H(e,t,n,o){for(var i=e&&e._component,r=e,a=i&&e._componentConstructor===t.nodeName,s=a,l=y(t);i&&!s&&(i=i._parentComponent);)s=i.constructor===t.nodeName;return i&&s&&(!o||i._component)?(j(i,l,3,n,o),e=i.base):(i&&!a&&(F(i,!0),e=r=null),i=P(t.nodeName,l,n),e&&!i.nextBase&&(i.nextBase=e,r=null),j(i,l,1,n,o),e=i.base,r&&e!==r&&(r._component=null,L(r))),e}function F(e,t){B.beforeUnmount&&B.beforeUnmount(e);var n=e.base;e._disable=!0,e.componentWillUnmount&&e.componentWillUnmount(),e.base=null;var o=e._component;o?F(o,t):n&&(n[G]&&n[G].ref&&n[G].ref(null),e.nextBase=n,t&&(b(n),T(e)),E(n.childNodes,!t)),e.__ref&&e.__ref(null),e.componentDidUnmount&&e.componentDidUnmount()}function U(e,t){this._dirty=!0,this.context=t,this.props=e,this.state||(this.state={})}function A(e,t,n){return M(n,e,{},!1,t)}var B={},K=[],R={},I=function(e){return R[e]||(R[e]=e.toLowerCase())},z="undefined"!=typeof Promise&&Promise.resolve(),W=z?function(e){z.then(e)}:setTimeout,q={},G="undefined"!=typeof Symbol?Symbol.for("preactattr"):"__preactattr_",V={boxFlex:1,boxFlexGroup:1,columnCount:1,fillOpacity:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,fontWeight:1,lineClamp:1,lineHeight:1,opacity:1,order:1,orphans:1,strokeOpacity:1,widows:1,zIndex:1,zoom:1},J={blur:1,error:1,focus:1,load:1,resize:1,scroll:1},Q=[],X={},Y=[],Z=0,$=!1,ee={};o(U.prototype,{linkState:function(e,t){var n=this._linkedStates||(this._linkedStates={});return n[e+t]||(n[e+t]=d(this,e,t))},setState:function(e,t){var n=this.state;this.prevState||(this.prevState=i(n)),o(n,a(e)?e(n,this.props):e),t&&(this._renderCallbacks=this._renderCallbacks||[]).push(t),c(this)},forceUpdate:function(){D(this,2)},render:function(){}}),e.h=n,e.cloneElement=u,e.Component=U,e.render=A,e.rerender=h,e.options=B})},function(e,t,n){var o,i;/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var i=typeof o;if("string"===i||"number"===i)e.push(o);else if(Array.isArray(o))e.push(n.apply(null,o));else if("object"===i)for(var a in o)r.call(o,a)&&o[a]&&e.push(a)}}return e.join(" ")}var r={}.hasOwnProperty;"undefined"!=typeof e&&e.exports?e.exports=n:(o=[],i=function(){return n}.apply(t,o),!(void 0!==i&&(e.exports=i)))}()},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),l=n(1),u=o(l),d=n(2),c=(o(d),n(4)),h=o(c),p=function(e){function t(e){i(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.input=e.input,n.state={value:n.input.value,hoverIndex:n.input.value,hasFocus:!1,inKeyboardMode:!1},n.handleFocus=n.handleFocus.bind(n),n.handleBlur=n.handleBlur.bind(n),n.handleHover=n.handleHover.bind(n),n.handleClick=n.handleClick.bind(n),n.handleChange=n.handleChange.bind(n),n.handleInput=n.handleInput.bind(n),n.handleMouseLeave=n.handleMouseLeave.bind(n),n.handleKeyDown=n.handleKeyDown.bind(n),n.handleDragStart=n.handleDragStart.bind(n),n.triggerChange=n.triggerChange.bind(n),n.increment=n.increment.bind(n),n.decrement=n.decrement.bind(n),n.input.addEventListener("focus",n.handleFocus),n.input.addEventListener("blur",n.handleBlur),n.input.addEventListener("input",n.handleInput),n.input.addEventListener("keydown",n.handleKeyDown),n}return a(t,e),s(t,[{key:"componentWillUnmount",value:function(){this.input.removeEventListener("focus",this.handleFocus),this.input.removeEventListener("blur",this.handleBlur),this.input.removeEventListener("input",this.handleInput),this.input.removeEventListener("keydown",this.handleKeyDown)}},{key:"decrement",value:function(){var e=parseFloat(this.input.step)||1,t=parseFloat(this.input.value)-e;"undefined"!=typeof this.input.min&&t<parseFloat(this.input.min)&&(t=parseFloat(this.input.min)),this.input.value=t,this.triggerChange(),this.setState({value:t})}},{key:"increment",value:function(){var e=parseFloat(this.input.step)||1,t=parseFloat(this.input.value)+e;"undefined"!=typeof this.input.min&&t>parseFloat(this.input.max)&&(t=parseFloat(this.input.max)),this.input.value=t,this.triggerChange(),this.setState({value:t})}},{key:"handleDragStart",value:function(){return!1}},{key:"handleKeyDown",value:function(e){e.keyCode>=37&&e.keyCode<=40&&this.setState({inKeyboardMode:!0}),37===e.keyCode?this.decrement():39===e.keyCode&&this.increment()}},{key:"handleClick",value:function(e){if(e.target!==this.input)return e.preventDefault(),this.input.focus(),void this.setState({inKeyboardMode:!1})}},{key:"handleHover",value:function(e){this.setState({hoverIndex:e,inKeyboardMode:!1})}},{key:"handleMouseLeave",value:function(){this.setState({inKeyboardMode:!0})}},{key:"handleFocus",value:function(e){this.setState({hasFocus:!0})}},{key:"handleBlur",value:function(e){this.setState({hasFocus:!1})}},{key:"handleInput",value:function(){this.handleChange(this.input.value)}},{key:"handleChange",value:function(e){this.input.value=e,this.triggerChange(),this.setState({value:e})}},{key:"triggerChange",value:function(){var e=document.createEvent("HTMLEvents");e.initEvent("change",!1,!0),this.input.dispatchEvent(e)}},{key:"render",value:function(){for(var e=Math.ceil(this.input.max||5),t=[],n=1;n<=e;n++){var o=this.state.value<n?0:100;t.push(u.default.h(h.default,{key:n,onChange:this.handleChange.bind(this,n),onHover:this.handleHover.bind(this,n),isSelected:this.state.hasFocus&&Math.floor(this.state.value)===n,fillPercentage:o,isHighlighted:this.state.hoverIndex>=n,inKeyboardMode:this.state.inKeyboardMode}))}return u.default.h("div",{class:"shaf-star-rating",onMouseOut:this.handleMouseLeave,onClick:this.handleClick,onDragStart:this.handleDragStart,"aria-hidden":!0},t)}}]),t}(l.Component);t.default=p,p.displayName="Rate"},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),l=n(1),u=o(l),d=n(2),c=(o(d),function(e){function t(e){i(this,t);var n=r(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.input=e.input,n.state.isActive=!1,n.state.isSelected=!1,n.handleClick=n.handleClick.bind(n),n.handleHover=n.handleHover.bind(n),n.handleMouseDown=n.handleMouseDown.bind(n),n.handleMouseUp=n.handleMouseUp.bind(n),n.handleMouseLeave=n.handleMouseLeave.bind(n),n.handleTouchStart=n.handleTouchStart.bind(n),n.handleTouchEnd=n.handleTouchEnd.bind(n),n.uniqId=Math.random(),n}return a(t,e),s(t,[{key:"handleClick",value:function(){this.props.onChange()}},{key:"handleHover",value:function(){this.props.onHover()}},{key:"handleMouseDown",value:function(){this.setState({isActive:!0})}},{key:"handleTouchStart",value:function(){this.props.onHover(),this.setState({isActive:!0})}},{key:"handleTouchEnd",value:function(){this.props.onChange(),this.setState({isActive:!1})}},{key:"handleMouseUp",value:function(){this.props.onChange(),this.setState({isActive:!1})}},{key:"handleMouseLeave",value:function(){this.setState({isActive:!1})}},{key:"render",value:function(){var e=void 0;e=this.props.inKeyboardMode||this.props.isHighlighted||this.props.fillPercentage>0?"#F3A536":"white";var t=void 0;t=(this.props.inKeyboardMode||this.props.isHighlighted)&&this.props.fillPercentage>0?1:!this.props.inKeyboardMode&&(this.props.isHighlighted||this.props.fillPercentage>0)?.4:0;var n=void 0;n=this.props.isSelected||this.state.isActive?"#0099E0":"#F3A536";var o=void 0;return o=this.state.isActive?2:1,u.default.h("div",{class:"shaf-star-rating-star",onClick:this.handleClick,onMouseOver:this.handleHover,onMouseDown:this.handleMouseDown,onMouseUp:this.handleMouseUp,onMouseLeave:this.handleMouseLeave,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd},u.default.h("svg",{viewBox:"0 0 24 24",style:{width:"24px",height:"24px"}},u.default.h("filter",{id:"blurfilter-"+this.uniqId,width:"24",height:"24"},u.default.h("feGaussianBlur",{in:"SourceGraphic",stdDeviation:"1"})),u.default.h("path",{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z",fill:"transparent",stroke:"#0099E0","stroke-width":"1",opacity:this.props.isSelected||this.state.isActive?1:0,style:{filter:"url(#blurfilter-"+this.uniqId+")"}}),u.default.h("path",{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z",fill:e,stroke:n,"stroke-width":o,"fill-opacity":t})))}}]),t}(l.Component));t.default=c},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(1),r=o(i),a=n(3),s=o(a),l=n(7),u=o(l),d=n(6),c=o(d);t.default=(0,u.default)({attributeChangedCallback:function(e,t,n){this.rendered&&this.updateRendering()},connectedCallback:function(){var e=this;this.querySelector("input")?this.init():window.requestAnimationFrame(function(){e.init()})},init:function(){var e=this;if(this.container=document.createElement("div"),document.body.attachShadow){this._shadowRoot=this.container.attachShadow({mode:"open"});var t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(c.default)),this._shadowRoot.appendChild(t)}this.appendChild(this.container),this.input=this.querySelector("input");var n={border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"fixed",width:"1px"};if(Object.keys(n).forEach(function(t){e.input.style[t]=n[t]}),MutationObserver){this.observer=new MutationObserver(function(t){e.updateRendering()});var o={attributes:!0,childList:!0,characterData:!0,subtree:!0};this.observer.observe(this.input,o)}this.updateRendering()},disconnectedCallback:function(){this.observer&&this.observer.disconnect()},updateRendering:function(){var e=this._shadowRoot||this.container;r.default.render(r.default.h(s.default,{input:this.input}),e,e.querySelector(":not(style)")),this.rendered=!0}}),document.addEventListener("DOMContentLoaded",function(){if(!document.body.attachShadow){var e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(c.default)),document.head.insertBefore(e,document.head.firstChild)}var t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode("shaf-star-rating {\n display: inline-block;\n vertical-align: middle;\n line-height: 1rem;\n cursor: pointer;\n}")),document.head.insertBefore(t,document.head.firstChild)})},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=".shaf-star-rating {\n display: inline-block;\n margin: 0;\n padding: 0;\n list-style: none;\n vertical-align: middle;\n font-weight: normal;\n font-style: normal;\n user-select: none;\n}\n\n.shaf-star-rating-star {\n display: inline-block;\n}"},function(e,t){function n(e){function t(){var e="undefined"!=typeof Reflect?Reflect.construct(HTMLElement,[],t):HTMLElement.call(Object.create(t.prototype));return e.initialize&&e.initialize(),e}return Object.setPrototypeOf(t,HTMLElement),t.prototype=Object.create(HTMLElement.prototype),Object.keys(e).forEach(function(n){t.prototype[n]=e[n]}),t}e.exports=n}]);