UNPKG

@useloops/design-system

Version:

The official React based Loops design system

2 lines (1 loc) 964 B
import{jsx as e}from"react/jsx-runtime";import a from"react";import t from"../../GraphPopoverDataLayout/GraphPopoverDataLayout.js";import r from"../../../../node_modules/uuid/dist/esm-browser/v4.js";const o=(a,o=465)=>{const n=Math.max(...a.map((e,a)=>e.percentage));return a.map((i,l)=>({totalBars:a.length,barIndex:l,percentage:i.percentage,amount:i.amount,label:i.name,relativePercentage:i.relativePercentage,id:r(),checked:!0,tickInterval:10,disableTooltip:!1,hideCheckbox:!1,hideLabel:!1,hideValue:!1,animateBar:!0,disabled:!1,loading:!1,onChange:(e,a)=>console.warn(i,a),value:i.percentage,hidePercentageSymbol:i.hidePercentageSymbol,maxDataValue:n,graphMaxHeight:o,tooltipContent:e(t,{primaryHeadlineLabel:i.name,secondarySlot1:`${i.percentage}%`,secondarySlot2:`Selected by ${i.amount} respondents`})}))},n=(e,t=465)=>{const[r,n]=a.useState(()=>o(e,t));return{storedData:r,setStoredData:n,createInitialData:o}};export{o as createInitialData,n as default};