@while-and-for/tremor-react
Version:
The React library to build dashboards faster.
2 lines (1 loc) • 2.04 kB
JavaScript
import e from"react";import{BaseColors as r}from"../../../lib/constants.js";import{border as t}from"../../../lib/shape.js";import{sizing as a}from"../../../lib/sizing.js";import{spacing as o}from"../../../lib/spacing.js";import{colorPalette as m}from"../../../lib/theme.js";import{getColorClassNames as d}from"../../../lib/utils.js";import{tremorTwMerge as s}from"../../../lib/tremorTwMerge.js";const l=({children:r})=>e.createElement("div",{className:s("rounded-tremor-default text-tremor-default","bg-tremor-background shadow-tremor-dropdown border-tremor-border","dark:bg-dark-tremor-background dark:shadow-dark-tremor-dropdown dark:border-dark-tremor-border",t.sm.all)},r),n=({value:r,name:o,color:l})=>e.createElement("div",{className:"flex items-center justify-between space-x-8"},e.createElement("div",{className:"flex items-center space-x-2"},e.createElement("span",{className:s("shrink-0 rounded-tremor-full","border-tremor-background shadow-tremor-card","dark:border-dark-tremor-background dark:shadow-dark-tremor-card",d(l,m.background).bgColor,a.sm.height,a.sm.width,t.md.all)}),e.createElement("p",{className:s("text-right whitespace-nowrap","text-tremor-content","dark:text-dark-tremor-content")},o)),e.createElement("p",{className:s("font-medium tabular-nums text-right whitespace-nowrap","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},r)),c=({active:a,payload:m,label:d,categoryColors:c,valueFormatter:i})=>a&&m?e.createElement(l,null,e.createElement("div",{className:s("border-tremor-border","dark:border-dark-tremor-border",o.twoXl.paddingX,o.sm.paddingY,t.sm.bottom)},e.createElement("p",{className:s("font-medium","text-tremor-content-emphasis","dark:text-dark-tremor-content-emphasis")},d)),e.createElement("div",{className:s(o.twoXl.paddingX,o.sm.paddingY,"space-y-1")},m.map((({value:t,name:a},o)=>{var m;return e.createElement(n,{key:`id-${o}`,value:i(t),name:a,color:null!==(m=c.get(a))&&void 0!==m?m:r.Blue})})))):null;export{l as ChartTooltipFrame,n as ChartTooltipRow,c as default};