UNPKG

@devgateway/dvz-ui-react

Version:

A modular, embeddable React component library for data visualization and UI, built with TypeScript. Provides reusable components for charts, maps, dashboards, and more, with built-in support for internationalization and Redux integration.

2 lines (1 loc) 1.46 kB
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime");require("react");const j=require("react-intl"),x=({filter:t,showLegends:c,chartLegends:n,legendLabel:l,legendPosition:s,legendCheckBack:a,legendLabelBack:i,legendLabelColor:m,onToggle:u,reverseLegend:h})=>{const d=()=>e.jsx(e.Fragment,{children:c&&l&&e.jsx("div",{className:"legend item",children:e.jsx("label",{className:"legend-title",children:l})})}),o=()=>(h&&n.reverse(),e.jsx(e.Fragment,{children:c&&n.map(r=>e.jsxs("div",{className:"legend item",onClick:()=>u(r.id),children:[e.jsx("input",{className:"ignore",type:"checkbox",checked:t.length==0||!t.includes(r.id),readOnly:!0}),e.jsx("span",{className:a?"checkmark-with-bg":"checkmark",style:{backgroundColor:a==!0?r.color:"#FFF"}}),e.jsx("label",{legendLabelBack:i,style:{backgroundColor:i==!0?r.color:"#FFF",color:m},children:r.label})]}))}));return e.jsxs("div",{children:[" ",(s=="top"||s=="bottom")&&e.jsx("div",{className:`legends container has-standard-12-font-size ${s}`,children:e.jsxs("div",{className:"legend-sections",children:[e.jsx("div",{className:"title-section",children:d()}),e.jsx("div",{className:"legends container has-standard-12-font-size items-section",children:o()})]})}),(s=="right"||s=="left")&&e.jsxs("div",{className:`legends container has-standard-12-font-size ${s}`,children:[d(),o()]})]})},v=j.injectIntl(x);exports.default=v;