Liferay.Loader.define("data-engine-js-components-web@1.0.89/js/custom/form-report/components/chart/Legend",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/icon","liferay!frontend-js-react-web$react","../../utils/colors"],(function(e,t,l){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function Legend({activeIndex:t,labels:l,onMouseOut:a,onMouseOver:r}){const[u,c]=(0,n.useState)(!1),handleOnMouseOver=({currentTarget:e})=>{const t=e.closest("li").dataset.item;r(parseInt(t,10))};return n.default.createElement("div",{className:"legend-container well well-lg"},n.default.createElement("div",{className:"legend-list"},n.default.createElement("ul",null,l.slice(0,u?l.length:e).map(((e,l)=>n.default.createElement(Label,{active:null===t||t===l,color:(0,o.default)(l),index:l,key:"item-".concat(l),label:e,onMouseOut:a,onMouseOver:handleOnMouseOver}))),n.default.createElement(ShowAll,{expand:c,expanded:u,labelsLength:l.length}))))};var a=_interopRequireDefault(l("@frontend-taglib-clay$clayui/button")),r=_interopRequireDefault(l("@frontend-taglib-clay$clayui/icon")),n=function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var l={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=a?Object.getOwnPropertyDescriptor(e,r):null;n&&(n.get||n.set)?Object.defineProperty(l,r,n):l[r]=e[r]}l.default=e,t&&t.set(e,l);return l}(l("liferay!frontend-js-react-web$react")),o=_interopRequireDefault(l("../../utils/colors"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}const e=10,Label=({active:e,color:t,index:l,label:a,onMouseOut:r,onMouseOver:o})=>n.default.createElement("li",{className:e?"":"dim","data-item":l},n.default.createElement("svg",{height:"20",width:"20"},n.default.createElement("circle",{cx:"10",cy:"10",fill:t,onMouseOut:r,onMouseOver:o,r:"9",strokeWidth:"3"})),n.default.createElement("p",{onMouseOut:r,onMouseOver:o,x:"0em",y:"1em"},n.default.createElement("span",{dy:"2em",x:"2.5em"},a))),ShowAll=({expand:t,expanded:l,labelsLength:o})=>{if(o<=e)return null;return n.default.createElement("div",{className:"show-more-action"},n.default.createElement("svg",{height:"20",width:"20"},n.default.createElement("g",null,n.default.createElement("circle",{cx:"10",cy:"10",fill:"#F0F5FF",r:"9",strokeWidth:"3"}),n.default.createElement(r.default,{symbol:l?"caret-top-l":"caret-bottom-l"}))),n.default.createElement(a.default,{className:"show-more-button",displayType:"unstyled",onClick:()=>{t(!l)}},l?Liferay.Language.get("show-less"):Liferay.Language.get("show-all")))}}}));
//# sourceMappingURL=Legend.js.map