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.37 kB
"use strict";const e=require("react/jsx-runtime");require("react");const j=require("react-intl"),u=({filter:c,showLegends:t,chartLegends:n,legendLabel:a,legendPosition:s,legendCheckBack:i,legendLabelBack:l,legendLabelColor:m,onToggle:h,reverseLegend:x})=>{const d=()=>e.jsx(e.Fragment,{children:t&&a&&e.jsx("div",{className:"legend item",children:e.jsx("label",{className:"legend-title",children:a})})}),o=()=>(x&&n.reverse(),e.jsx(e.Fragment,{children:t&&n.map(r=>e.jsxs("div",{className:"legend item",onClick:()=>h(r.id),children:[e.jsx("input",{className:"ignore",type:"checkbox",checked:c.length==0||!c.includes(r.id),readOnly:!0}),e.jsx("span",{className:i?"checkmark-with-bg":"checkmark",style:{backgroundColor:i==!0?r.color:"#FFF"}}),e.jsx("label",{legendLabelBack:l,style:{backgroundColor:l==!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()]})]})},N=j.injectIntl(u);module.exports=N;