@jarllyng/nostromo 3.3.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-3HKYX26O.cjs +3 -0
- package/dist/chunk-3HKYX26O.cjs.map +1 -0
- package/dist/chunk-CCNO2VWE.js +3 -0
- package/dist/chunk-CCNO2VWE.js.map +1 -0
- package/dist/chunk-TCA5Z7FL.js +3 -0
- package/dist/chunk-TCA5Z7FL.js.map +1 -0
- package/dist/chunk-Z7WEJ5IQ.cjs +3 -0
- package/dist/chunk-Z7WEJ5IQ.cjs.map +1 -0
- package/dist/components/core/chart-composable.cjs +3 -0
- package/dist/components/core/chart-composable.cjs.map +1 -0
- package/dist/components/core/chart-composable.d.cts +110 -0
- package/dist/components/core/chart-composable.d.ts +110 -0
- package/dist/components/core/chart-composable.js +3 -0
- package/dist/components/core/chart-composable.js.map +1 -0
- package/dist/components/core/tooltip.cjs +1 -1
- package/dist/components/core/tooltip.d.cts +9 -1
- package/dist/components/core/tooltip.d.ts +9 -1
- package/dist/components/core/tooltip.js +1 -1
- package/dist/components/marketing/gallery.d.cts +1 -1
- package/dist/components/marketing/gallery.d.ts +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +16 -11
- package/dist/chunk-MDXW6IRM.cjs +0 -3
- package/dist/chunk-MDXW6IRM.cjs.map +0 -1
- package/dist/chunk-MOPCE5RA.js +0 -3
- package/dist/chunk-MOPCE5RA.js.map +0 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';var chunkITRGJNWL_cjs=require('./chunk-ITRGJNWL.cjs'),t=require('react'),recharts=require('recharts');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var t__namespace=/*#__PURE__*/_interopNamespace(t);var f=["hsl(var(--nostromo-color-brand-500))","hsl(var(--nostromo-color-info-500))","hsl(var(--nostromo-color-success-500))","hsl(var(--nostromo-color-warning-500))","hsl(var(--nostromo-color-error-500))","hsl(var(--nostromo-color-brand-300))","hsl(var(--nostromo-color-info-700))","hsl(var(--nostromo-color-success-700))"],h="hsl(var(--nostromo-color-neutral-600))",d="hsl(var(--nostromo-color-neutral-700))",m="hsl(var(--nostromo-color-neutral-300))",x=t__namespace.createContext(null);function M(r,e){let o=[],n=s=>{t__namespace.Children.forEach(s,a=>{if(!t__namespace.isValidElement(a))return;let i=a.type;if(i===G||i===N||i===X){let c=a.props.dataKey;typeof c=="string"&&!o.includes(c)&&o.push(c);}let p=a.props.children;p&&n(p);});};return n(r),new Map(o.map((s,a)=>[s,e[a%e.length]]))}function O(r,e){return r??e??f[0]}function l(r,e){let o=t__namespace.useContext(x);return O(e,o?.colorFor(r))}var I=t__namespace.forwardRef(function({data:e,children:o,height:n=300,width:s="100%",colors:a=f,className:i,ariaLabel:p},c){let C=t__namespace.useMemo(()=>M(o,a),[o,a]),g=t__namespace.useMemo(()=>({colorFor:R=>C.get(R)??a[0]}),[C,a]);return t__namespace.createElement(x.Provider,{value:g},t__namespace.createElement("div",{ref:c,className:chunkITRGJNWL_cjs.a("w-full",i),style:{height:n},role:"img","aria-label":p},t__namespace.createElement(recharts.ResponsiveContainer,{width:s,height:n},t__namespace.createElement(recharts.ComposedChart,{data:e,margin:{top:5,right:5,left:5,bottom:5}},o))))});function Y(r){return t__namespace.createElement(recharts.CartesianGrid,{strokeDasharray:"3 3",stroke:m,...r})}function z(r){return t__namespace.createElement(recharts.XAxis,{stroke:h,tick:{fill:d,fontSize:12},...r})}function D(r){return t__namespace.createElement(recharts.YAxis,{stroke:h,tick:{fill:d,fontSize:12},...r})}function F(r){return t__namespace.createElement(recharts.Tooltip,{cursor:{fill:m,fillOpacity:.3},contentStyle:{background:"hsl(var(--nostromo-color-neutral-50))",border:"1px solid hsl(var(--nostromo-color-neutral-300))",borderRadius:8,color:"hsl(var(--nostromo-color-neutral-900))",fontSize:12},...r})}function V(r){return t__namespace.createElement(recharts.Legend,{wrapperStyle:{fontSize:12},...r})}function G({dataKey:r,color:e,...o}){let n=l(r,e),s=o.stackId?[0,0,0,0]:[4,4,0,0];return t__namespace.createElement(recharts.Bar,{dataKey:r,fill:n,radius:s,...o})}function N({dataKey:r,color:e,...o}){let n=l(r,e);return t__namespace.createElement(recharts.Line,{dataKey:r,stroke:n,strokeWidth:2,dot:false,...o})}function X({dataKey:r,color:e,...o}){let n=l(r,e);return t__namespace.createElement(recharts.Area,{dataKey:r,stroke:n,fill:n,fillOpacity:.6,strokeWidth:2,...o})}function _(r){return t__namespace.createElement(recharts.ReferenceLine,{stroke:"hsl(var(--nostromo-color-neutral-600))",strokeDasharray:"4 4",...r})}exports.a=f;exports.b=M;exports.c=O;exports.d=I;exports.e=Y;exports.f=z;exports.g=D;exports.h=F;exports.i=V;exports.j=G;exports.k=N;exports.l=X;exports.m=_;//# sourceMappingURL=chunk-3HKYX26O.cjs.map
|
|
3
|
+
//# sourceMappingURL=chunk-3HKYX26O.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/core/chart-composable.tsx"],"names":["chartPalette","AXIS_STROKE","TICK_FILL","GRID_STROKE","ChartContext","t","buildColorMap","children","palette","keys","walk","nodes","child","type","ChartBar","ChartLine","ChartArea","key","nested","k","i","resolveSeriesColor","explicit","fromContainer","useSeriesColor","dataKey","ctx","ChartContainer","data","height","width","colors","className","ariaLabel","ref","colorMap","value","cn","ResponsiveContainer","ComposedChart","ChartGrid","props","CartesianGrid","ChartXAxis","XAxis","ChartYAxis","YAxis","ChartTooltip","Tooltip","ChartLegend","Legend","color","fill","radius","Bar","st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AK,KAAA,CACJ,GAAGd,CAAAA,CACN,CAEJ,CAUO,SAASzB,CAAAA,CAAU,CAAE,OAAA,CAAAS,CAAAA,CAAS,KAAA,CAAA0B,CAAAA,CAAO,GAAGV,CAAM,CAAA,CAAmB,CACtE,IAAMgB,CAAAA,CAAQjC,CAAAA,CAAeC,CAAAA,CAAS0B,CAAK,CAAA,CAC3C,OACE9C,YAAA,CAAA,aAAA,CAACqD,aAAAA,CAAA,CACC,OAAA,CAASjC,CAAAA,CACT,MAAA,CAAQgC,CAAAA,CACR,IAAA,CAAMA,CAAAA,CACN,WAAA,CAAa,EAAA,CACb,WAAA,CAAa,CAAA,CACZ,GAAGhB,CAAAA,CACN,CAEJ,CAMO,SAASkB,CAAAA,CAAmBlB,CAAAA,CAAgC,CACjE,OACEpC,YAAA,CAAA,aAAA,CAACuD,sBAAAA,CAAA,CACC,MAAA,CAAO,wCAAA,CACP,eAAA,CAAgB,KAAA,CACf,GAAGnB,EACN,CAEJ","file":"chunk-3HKYX26O.cjs","sourcesContent":["import * as React from \"react\";\nimport {\n Area,\n Bar,\n CartesianGrid,\n ComposedChart,\n Legend,\n Line,\n ReferenceLine,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from \"recharts\";\nimport { cn } from \"../../lib/utils\";\n\n/**\n * A composable chart, alongside the single-shot `<Chart type=\"...\" />`.\n *\n * `Chart` renders one series type from a `dataKeys` array. That shape cannot\n * express a stacked bar, a bar and a line together, a second axis, or a\n * reference line - no amount of new `type` strings fixes it, because the\n * limitation is that a chart is one prop rather than a tree.\n *\n * These pieces are thin wrappers over recharts with the theme applied, so a\n * chart is written the way the rest of the library is:\n *\n * <ChartContainer data={data}>\n * <ChartGrid />\n * <ChartXAxis dataKey=\"month\" />\n * <ChartYAxis />\n * <ChartTooltip />\n * <ChartLegend />\n * <ChartBar dataKey=\"desktop\" stackId=\"devices\" />\n * <ChartBar dataKey=\"mobile\" stackId=\"devices\" />\n * <ChartLine dataKey=\"target\" />\n * </ChartContainer>\n *\n * Wrapping recharts' own components works here, which is worth stating because\n * it did not use to: recharts 2 matched children by identity and silently\n * dropped anything it did not recognise, which is why most wrappers around it\n * re-export the primitives instead. recharts 3 resolves wrapped children -\n * verified by rendering a wrapped Bar and counting `.recharts-bar` nodes - so\n * these can carry defaults rather than making every caller repeat them.\n *\n * `Chart` is untouched and stays supported. This is additive.\n */\n\n/**\n * Ordered for distinguishability, same as `Chart`'s: distinct hues first, brand\n * variants last, so a two-series chart is not two neighbouring purples.\n */\nexport const chartPalette = [\n \"hsl(var(--nostromo-color-brand-500))\",\n \"hsl(var(--nostromo-color-info-500))\",\n \"hsl(var(--nostromo-color-success-500))\",\n \"hsl(var(--nostromo-color-warning-500))\",\n \"hsl(var(--nostromo-color-error-500))\",\n \"hsl(var(--nostromo-color-brand-300))\",\n \"hsl(var(--nostromo-color-info-700))\",\n \"hsl(var(--nostromo-color-success-700))\",\n] as const;\n\nconst AXIS_STROKE = \"hsl(var(--nostromo-color-neutral-600))\";\nconst TICK_FILL = \"hsl(var(--nostromo-color-neutral-700))\";\nconst GRID_STROKE = \"hsl(var(--nostromo-color-neutral-300))\";\n\ninterface ChartContextValue {\n /** dataKey -> colour, assigned in the order series appear in the tree. */\n colorFor: (dataKey: string) => string;\n}\n\nconst ChartContext = React.createContext<ChartContextValue | null>(null);\n\n/**\n * Colour is resolved by dataKey rather than by a render-order counter.\n *\n * A counter incremented during render gives a different answer on a re-render\n * and a different one again under StrictMode's double invoke, so a series can\n * change colour for no reason. Walking the tree once per render and mapping\n * dataKey to palette slot is stable: the same chart always assigns the same\n * colours, and a series keeps its colour when a sibling is added after it.\n *\n * Exported so the assignment can be tested directly. recharts draws no geometry\n * under jsdom - the series groups appear but carry no fill - so scraping the SVG\n * for colours asserts nothing, however convincing the selector looks.\n */\nexport function buildColorMap(\n children: React.ReactNode,\n palette: readonly string[],\n): Map<string, string> {\n const keys: string[] = [];\n\n const walk = (nodes: React.ReactNode) => {\n React.Children.forEach(nodes, (child) => {\n if (!React.isValidElement(child)) return;\n const type = child.type;\n if (type === ChartBar || type === ChartLine || type === ChartArea) {\n const key = (child.props as { dataKey?: string }).dataKey;\n if (typeof key === \"string\" && !keys.includes(key)) keys.push(key);\n }\n const nested = (child.props as { children?: React.ReactNode }).children;\n if (nested) walk(nested);\n });\n };\n walk(children);\n\n return new Map(\n keys.map((k, i) => [k, palette[i % palette.length] as string]),\n );\n}\n\n/**\n * An explicit `color` wins; otherwise the container's slot; otherwise the first\n * palette entry, so a series rendered outside a ChartContainer still gets a\n * themed colour rather than recharts' off-theme default.\n *\n * Pulled out of the hook so it can be tested without a render - the same reason\n * buildColorMap is exported.\n */\nexport function resolveSeriesColor(\n explicit: string | undefined,\n fromContainer: string | undefined,\n): string {\n return explicit ?? fromContainer ?? (chartPalette[0] as string);\n}\n\nfunction useSeriesColor(dataKey: string, explicit?: string): string {\n const ctx = React.useContext(ChartContext);\n return resolveSeriesColor(explicit, ctx?.colorFor(dataKey));\n}\n\nexport interface ChartContainerProps {\n data: ReadonlyArray<Record<string, unknown>>;\n children: React.ReactNode;\n /** Pixel height of the plotting area. */\n height?: number;\n /**\n * Width of the plotting area. Responsive by default; give it a number for a\n * fixed-width chart, or to get real geometry in a jsdom test - recharts lays\n * out at zero there otherwise, and every query for rendered SVG comes back\n * empty while the series groups still exist.\n */\n width?: number | `${number}%`;\n /** Override the series palette. Series without an explicit colour draw from it in tree order. */\n colors?: readonly string[];\n className?: string;\n ariaLabel?: string;\n}\n\nexport const ChartContainer = React.forwardRef<\n HTMLDivElement,\n ChartContainerProps\n>(function ChartContainer(\n {\n data,\n children,\n height = 300,\n width = \"100%\",\n colors = chartPalette,\n className,\n ariaLabel,\n },\n ref,\n) {\n const colorMap = React.useMemo(\n () => buildColorMap(children, colors),\n [children, colors],\n );\n const value = React.useMemo<ChartContextValue>(\n () => ({\n colorFor: (key) => colorMap.get(key) ?? (colors[0] as string),\n }),\n [colorMap, colors],\n );\n\n return (\n <ChartContext.Provider value={value}>\n <div\n ref={ref}\n className={cn(\"w-full\", className)}\n style={{ height }}\n role=\"img\"\n aria-label={ariaLabel}\n >\n <ResponsiveContainer width={width} height={height}>\n <ComposedChart\n data={data as Record<string, unknown>[]}\n margin={{ top: 5, right: 5, left: 5, bottom: 5 }}\n >\n {children}\n </ComposedChart>\n </ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n );\n});\n\nexport type ChartGridProps = React.ComponentProps<typeof CartesianGrid>;\n\nexport function ChartGrid(props: ChartGridProps) {\n return (\n <CartesianGrid strokeDasharray=\"3 3\" stroke={GRID_STROKE} {...props} />\n );\n}\n\nexport type ChartXAxisProps = React.ComponentProps<typeof XAxis>;\n\nexport function ChartXAxis(props: ChartXAxisProps) {\n return (\n <XAxis\n stroke={AXIS_STROKE}\n tick={{ fill: TICK_FILL, fontSize: 12 }}\n {...props}\n />\n );\n}\n\nexport type ChartYAxisProps = React.ComponentProps<typeof YAxis>;\n\nexport function ChartYAxis(props: ChartYAxisProps) {\n return (\n <YAxis\n stroke={AXIS_STROKE}\n tick={{ fill: TICK_FILL, fontSize: 12 }}\n {...props}\n />\n );\n}\n\nexport type ChartTooltipProps = React.ComponentProps<typeof Tooltip>;\n\nexport function ChartTooltip(props: ChartTooltipProps) {\n return (\n <Tooltip\n cursor={{ fill: GRID_STROKE, fillOpacity: 0.3 }}\n contentStyle={{\n background: \"hsl(var(--nostromo-color-neutral-50))\",\n border: \"1px solid hsl(var(--nostromo-color-neutral-300))\",\n borderRadius: 8,\n color: \"hsl(var(--nostromo-color-neutral-900))\",\n fontSize: 12,\n }}\n {...props}\n />\n );\n}\n\nexport type ChartLegendProps = React.ComponentProps<typeof Legend>;\n\nexport function ChartLegend(props: ChartLegendProps) {\n return <Legend wrapperStyle={{ fontSize: 12 }} {...props} />;\n}\n\nexport interface ChartBarProps extends Omit<\n React.ComponentProps<typeof Bar>,\n \"fill\"\n> {\n dataKey: string;\n /** Overrides the palette slot this series would otherwise get. */\n color?: string;\n}\n\nexport function ChartBar({ dataKey, color, ...props }: ChartBarProps) {\n const fill = useSeriesColor(dataKey, color);\n // Rounded top only, and only when unstacked: rounding every bar in a stack\n // puts a notch between the segments.\n const radius: [number, number, number, number] = props.stackId\n ? [0, 0, 0, 0]\n : [4, 4, 0, 0];\n return <Bar dataKey={dataKey} fill={fill} radius={radius} {...props} />;\n}\n\nexport interface ChartLineProps extends Omit<\n React.ComponentProps<typeof Line>,\n \"stroke\"\n> {\n dataKey: string;\n color?: string;\n}\n\nexport function ChartLine({ dataKey, color, ...props }: ChartLineProps) {\n const stroke = useSeriesColor(dataKey, color);\n return (\n <Line\n dataKey={dataKey}\n stroke={stroke}\n strokeWidth={2}\n dot={false}\n {...props}\n />\n );\n}\n\nexport interface ChartAreaProps extends Omit<\n React.ComponentProps<typeof Area>,\n \"stroke\" | \"fill\"\n> {\n dataKey: string;\n color?: string;\n}\n\nexport function ChartArea({ dataKey, color, ...props }: ChartAreaProps) {\n const paint = useSeriesColor(dataKey, color);\n return (\n <Area\n dataKey={dataKey}\n stroke={paint}\n fill={paint}\n fillOpacity={0.6}\n strokeWidth={2}\n {...props}\n />\n );\n}\n\nexport type ChartReferenceLineProps = React.ComponentProps<\n typeof ReferenceLine\n>;\n\nexport function ChartReferenceLine(props: ChartReferenceLineProps) {\n return (\n <ReferenceLine\n stroke=\"hsl(var(--nostromo-color-neutral-600))\"\n strokeDasharray=\"4 4\"\n {...props}\n />\n );\n}\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {a}from'./chunk-AC2JBXHQ.js';import*as t from'react';import {ResponsiveContainer,ComposedChart,Bar,Line,Area,CartesianGrid,XAxis,YAxis,Tooltip,Legend,ReferenceLine}from'recharts';var f=["hsl(var(--nostromo-color-brand-500))","hsl(var(--nostromo-color-info-500))","hsl(var(--nostromo-color-success-500))","hsl(var(--nostromo-color-warning-500))","hsl(var(--nostromo-color-error-500))","hsl(var(--nostromo-color-brand-300))","hsl(var(--nostromo-color-info-700))","hsl(var(--nostromo-color-success-700))"],h="hsl(var(--nostromo-color-neutral-600))",d="hsl(var(--nostromo-color-neutral-700))",m="hsl(var(--nostromo-color-neutral-300))",x=t.createContext(null);function M(r,e){let o=[],n=s=>{t.Children.forEach(s,a=>{if(!t.isValidElement(a))return;let i=a.type;if(i===G||i===N||i===X){let c=a.props.dataKey;typeof c=="string"&&!o.includes(c)&&o.push(c);}let p=a.props.children;p&&n(p);});};return n(r),new Map(o.map((s,a)=>[s,e[a%e.length]]))}function O(r,e){return r??e??f[0]}function l(r,e){let o=t.useContext(x);return O(e,o?.colorFor(r))}var I=t.forwardRef(function({data:e,children:o,height:n=300,width:s="100%",colors:a$1=f,className:i,ariaLabel:p},c){let C=t.useMemo(()=>M(o,a$1),[o,a$1]),g=t.useMemo(()=>({colorFor:R=>C.get(R)??a$1[0]}),[C,a$1]);return t.createElement(x.Provider,{value:g},t.createElement("div",{ref:c,className:a("w-full",i),style:{height:n},role:"img","aria-label":p},t.createElement(ResponsiveContainer,{width:s,height:n},t.createElement(ComposedChart,{data:e,margin:{top:5,right:5,left:5,bottom:5}},o))))});function Y(r){return t.createElement(CartesianGrid,{strokeDasharray:"3 3",stroke:m,...r})}function z(r){return t.createElement(XAxis,{stroke:h,tick:{fill:d,fontSize:12},...r})}function D(r){return t.createElement(YAxis,{stroke:h,tick:{fill:d,fontSize:12},...r})}function F(r){return t.createElement(Tooltip,{cursor:{fill:m,fillOpacity:.3},contentStyle:{background:"hsl(var(--nostromo-color-neutral-50))",border:"1px solid hsl(var(--nostromo-color-neutral-300))",borderRadius:8,color:"hsl(var(--nostromo-color-neutral-900))",fontSize:12},...r})}function V(r){return t.createElement(Legend,{wrapperStyle:{fontSize:12},...r})}function G({dataKey:r,color:e,...o}){let n=l(r,e),s=o.stackId?[0,0,0,0]:[4,4,0,0];return t.createElement(Bar,{dataKey:r,fill:n,radius:s,...o})}function N({dataKey:r,color:e,...o}){let n=l(r,e);return t.createElement(Line,{dataKey:r,stroke:n,strokeWidth:2,dot:false,...o})}function X({dataKey:r,color:e,...o}){let n=l(r,e);return t.createElement(Area,{dataKey:r,stroke:n,fill:n,fillOpacity:.6,strokeWidth:2,...o})}function _(r){return t.createElement(ReferenceLine,{stroke:"hsl(var(--nostromo-color-neutral-600))",strokeDasharray:"4 4",...r})}export{f as a,M as b,O as c,I as d,Y as e,z as f,D as g,F as h,V as i,G as j,N as k,X as l,_ as m};//# sourceMappingURL=chunk-CCNO2VWE.js.map
|
|
3
|
+
//# sourceMappingURL=chunk-CCNO2VWE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/core/chart-composable.tsx"],"names":["chartPalette","AXIS_STROKE","TICK_FILL","GRID_STROKE","ChartContext","buildColorMap","children","palette","keys","walk","nodes","child","type","ChartBar","ChartLine","ChartArea","key","nested","k","i","resolveSeriesColor","explicit","fromContainer","useSeriesColor","dataKey","ctx","ChartContainer","data","height","width","colors","className","ariaLabel","ref","colorMap","value","cn","ResponsiveContainer","ComposedChart","ChartGrid","props","CartesianGrid","ChartXAxis","XAxis","ChartYAxis","YAxis","ChartTooltip","Tooltip","ChartLegend","Legend","color","fill","radius","Bar","stroke","Line","paint","Area","ChartReferenceLine","ReferenceLine"],"mappings":"0LAoDO,IAAMA,CAAAA,CAAe,CAC1B,sCAAA,CACA,qCAAA,CACA,wCAAA,CACA,wCAAA,CACA,sCAAA,CACA,sCAAA,CACA,qCAAA,CACA,wCACF,CAAA,CAEMC,CAAAA,CAAc,wCAAA,CACdC,CAAAA,CAAY,wCAAA,CACZC,CAAAA,CAAc,wCAAA,CAOdC,CAAAA,CAAqB,CAAA,CAAA,aAAA,CAAwC,IAAI,EAehE,SAASC,CAAAA,CACdC,CAAAA,CACAC,CAAAA,CACqB,CACrB,IAAMC,CAAAA,CAAiB,EAAC,CAElBC,CAAAA,CAAQC,CAAAA,EAA2B,CACjC,CAAA,CAAA,QAAA,CAAS,OAAA,CAAQA,CAAAA,CAAQC,CA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AAA,CACP,eAAA,CAAgB,KAAA,CACf,GAAGnB,EACN,CAEJ","file":"chunk-CCNO2VWE.js","sourcesContent":["import * as React from \"react\";\nimport {\n Area,\n Bar,\n CartesianGrid,\n ComposedChart,\n Legend,\n Line,\n ReferenceLine,\n ResponsiveContainer,\n Tooltip,\n XAxis,\n YAxis,\n} from \"recharts\";\nimport { cn } from \"../../lib/utils\";\n\n/**\n * A composable chart, alongside the single-shot `<Chart type=\"...\" />`.\n *\n * `Chart` renders one series type from a `dataKeys` array. That shape cannot\n * express a stacked bar, a bar and a line together, a second axis, or a\n * reference line - no amount of new `type` strings fixes it, because the\n * limitation is that a chart is one prop rather than a tree.\n *\n * These pieces are thin wrappers over recharts with the theme applied, so a\n * chart is written the way the rest of the library is:\n *\n * <ChartContainer data={data}>\n * <ChartGrid />\n * <ChartXAxis dataKey=\"month\" />\n * <ChartYAxis />\n * <ChartTooltip />\n * <ChartLegend />\n * <ChartBar dataKey=\"desktop\" stackId=\"devices\" />\n * <ChartBar dataKey=\"mobile\" stackId=\"devices\" />\n * <ChartLine dataKey=\"target\" />\n * </ChartContainer>\n *\n * Wrapping recharts' own components works here, which is worth stating because\n * it did not use to: recharts 2 matched children by identity and silently\n * dropped anything it did not recognise, which is why most wrappers around it\n * re-export the primitives instead. recharts 3 resolves wrapped children -\n * verified by rendering a wrapped Bar and counting `.recharts-bar` nodes - so\n * these can carry defaults rather than making every caller repeat them.\n *\n * `Chart` is untouched and stays supported. This is additive.\n */\n\n/**\n * Ordered for distinguishability, same as `Chart`'s: distinct hues first, brand\n * variants last, so a two-series chart is not two neighbouring purples.\n */\nexport const chartPalette = [\n \"hsl(var(--nostromo-color-brand-500))\",\n \"hsl(var(--nostromo-color-info-500))\",\n \"hsl(var(--nostromo-color-success-500))\",\n \"hsl(var(--nostromo-color-warning-500))\",\n \"hsl(var(--nostromo-color-error-500))\",\n \"hsl(var(--nostromo-color-brand-300))\",\n \"hsl(var(--nostromo-color-info-700))\",\n \"hsl(var(--nostromo-color-success-700))\",\n] as const;\n\nconst AXIS_STROKE = \"hsl(var(--nostromo-color-neutral-600))\";\nconst TICK_FILL = \"hsl(var(--nostromo-color-neutral-700))\";\nconst GRID_STROKE = \"hsl(var(--nostromo-color-neutral-300))\";\n\ninterface ChartContextValue {\n /** dataKey -> colour, assigned in the order series appear in the tree. */\n colorFor: (dataKey: string) => string;\n}\n\nconst ChartContext = React.createContext<ChartContextValue | null>(null);\n\n/**\n * Colour is resolved by dataKey rather than by a render-order counter.\n *\n * A counter incremented during render gives a different answer on a re-render\n * and a different one again under StrictMode's double invoke, so a series can\n * change colour for no reason. Walking the tree once per render and mapping\n * dataKey to palette slot is stable: the same chart always assigns the same\n * colours, and a series keeps its colour when a sibling is added after it.\n *\n * Exported so the assignment can be tested directly. recharts draws no geometry\n * under jsdom - the series groups appear but carry no fill - so scraping the SVG\n * for colours asserts nothing, however convincing the selector looks.\n */\nexport function buildColorMap(\n children: React.ReactNode,\n palette: readonly string[],\n): Map<string, string> {\n const keys: string[] = [];\n\n const walk = (nodes: React.ReactNode) => {\n React.Children.forEach(nodes, (child) => {\n if (!React.isValidElement(child)) return;\n const type = child.type;\n if (type === ChartBar || type === ChartLine || type === ChartArea) {\n const key = (child.props as { dataKey?: string }).dataKey;\n if (typeof key === \"string\" && !keys.includes(key)) keys.push(key);\n }\n const nested = (child.props as { children?: React.ReactNode }).children;\n if (nested) walk(nested);\n });\n };\n walk(children);\n\n return new Map(\n keys.map((k, i) => [k, palette[i % palette.length] as string]),\n );\n}\n\n/**\n * An explicit `color` wins; otherwise the container's slot; otherwise the first\n * palette entry, so a series rendered outside a ChartContainer still gets a\n * themed colour rather than recharts' off-theme default.\n *\n * Pulled out of the hook so it can be tested without a render - the same reason\n * buildColorMap is exported.\n */\nexport function resolveSeriesColor(\n explicit: string | undefined,\n fromContainer: string | undefined,\n): string {\n return explicit ?? fromContainer ?? (chartPalette[0] as string);\n}\n\nfunction useSeriesColor(dataKey: string, explicit?: string): string {\n const ctx = React.useContext(ChartContext);\n return resolveSeriesColor(explicit, ctx?.colorFor(dataKey));\n}\n\nexport interface ChartContainerProps {\n data: ReadonlyArray<Record<string, unknown>>;\n children: React.ReactNode;\n /** Pixel height of the plotting area. */\n height?: number;\n /**\n * Width of the plotting area. Responsive by default; give it a number for a\n * fixed-width chart, or to get real geometry in a jsdom test - recharts lays\n * out at zero there otherwise, and every query for rendered SVG comes back\n * empty while the series groups still exist.\n */\n width?: number | `${number}%`;\n /** Override the series palette. Series without an explicit colour draw from it in tree order. */\n colors?: readonly string[];\n className?: string;\n ariaLabel?: string;\n}\n\nexport const ChartContainer = React.forwardRef<\n HTMLDivElement,\n ChartContainerProps\n>(function ChartContainer(\n {\n data,\n children,\n height = 300,\n width = \"100%\",\n colors = chartPalette,\n className,\n ariaLabel,\n },\n ref,\n) {\n const colorMap = React.useMemo(\n () => buildColorMap(children, colors),\n [children, colors],\n );\n const value = React.useMemo<ChartContextValue>(\n () => ({\n colorFor: (key) => colorMap.get(key) ?? (colors[0] as string),\n }),\n [colorMap, colors],\n );\n\n return (\n <ChartContext.Provider value={value}>\n <div\n ref={ref}\n className={cn(\"w-full\", className)}\n style={{ height }}\n role=\"img\"\n aria-label={ariaLabel}\n >\n <ResponsiveContainer width={width} height={height}>\n <ComposedChart\n data={data as Record<string, unknown>[]}\n margin={{ top: 5, right: 5, left: 5, bottom: 5 }}\n >\n {children}\n </ComposedChart>\n </ResponsiveContainer>\n </div>\n </ChartContext.Provider>\n );\n});\n\nexport type ChartGridProps = React.ComponentProps<typeof CartesianGrid>;\n\nexport function ChartGrid(props: ChartGridProps) {\n return (\n <CartesianGrid strokeDasharray=\"3 3\" stroke={GRID_STROKE} {...props} />\n );\n}\n\nexport type ChartXAxisProps = React.ComponentProps<typeof XAxis>;\n\nexport function ChartXAxis(props: ChartXAxisProps) {\n return (\n <XAxis\n stroke={AXIS_STROKE}\n tick={{ fill: TICK_FILL, fontSize: 12 }}\n {...props}\n />\n );\n}\n\nexport type ChartYAxisProps = React.ComponentProps<typeof YAxis>;\n\nexport function ChartYAxis(props: ChartYAxisProps) {\n return (\n <YAxis\n stroke={AXIS_STROKE}\n tick={{ fill: TICK_FILL, fontSize: 12 }}\n {...props}\n />\n );\n}\n\nexport type ChartTooltipProps = React.ComponentProps<typeof Tooltip>;\n\nexport function ChartTooltip(props: ChartTooltipProps) {\n return (\n <Tooltip\n cursor={{ fill: GRID_STROKE, fillOpacity: 0.3 }}\n contentStyle={{\n background: \"hsl(var(--nostromo-color-neutral-50))\",\n border: \"1px solid hsl(var(--nostromo-color-neutral-300))\",\n borderRadius: 8,\n color: \"hsl(var(--nostromo-color-neutral-900))\",\n fontSize: 12,\n }}\n {...props}\n />\n );\n}\n\nexport type ChartLegendProps = React.ComponentProps<typeof Legend>;\n\nexport function ChartLegend(props: ChartLegendProps) {\n return <Legend wrapperStyle={{ fontSize: 12 }} {...props} />;\n}\n\nexport interface ChartBarProps extends Omit<\n React.ComponentProps<typeof Bar>,\n \"fill\"\n> {\n dataKey: string;\n /** Overrides the palette slot this series would otherwise get. */\n color?: string;\n}\n\nexport function ChartBar({ dataKey, color, ...props }: ChartBarProps) {\n const fill = useSeriesColor(dataKey, color);\n // Rounded top only, and only when unstacked: rounding every bar in a stack\n // puts a notch between the segments.\n const radius: [number, number, number, number] = props.stackId\n ? [0, 0, 0, 0]\n : [4, 4, 0, 0];\n return <Bar dataKey={dataKey} fill={fill} radius={radius} {...props} />;\n}\n\nexport interface ChartLineProps extends Omit<\n React.ComponentProps<typeof Line>,\n \"stroke\"\n> {\n dataKey: string;\n color?: string;\n}\n\nexport function ChartLine({ dataKey, color, ...props }: ChartLineProps) {\n const stroke = useSeriesColor(dataKey, color);\n return (\n <Line\n dataKey={dataKey}\n stroke={stroke}\n strokeWidth={2}\n dot={false}\n {...props}\n />\n );\n}\n\nexport interface ChartAreaProps extends Omit<\n React.ComponentProps<typeof Area>,\n \"stroke\" | \"fill\"\n> {\n dataKey: string;\n color?: string;\n}\n\nexport function ChartArea({ dataKey, color, ...props }: ChartAreaProps) {\n const paint = useSeriesColor(dataKey, color);\n return (\n <Area\n dataKey={dataKey}\n stroke={paint}\n fill={paint}\n fillOpacity={0.6}\n strokeWidth={2}\n {...props}\n />\n );\n}\n\nexport type ChartReferenceLineProps = React.ComponentProps<\n typeof ReferenceLine\n>;\n\nexport function ChartReferenceLine(props: ChartReferenceLineProps) {\n return (\n <ReferenceLine\n stroke=\"hsl(var(--nostromo-color-neutral-600))\"\n strokeDasharray=\"4 4\"\n {...props}\n />\n );\n}\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {a as a$2}from'./chunk-COXN6XBA.js';import {a as a$1}from'./chunk-AC2JBXHQ.js';import a,{useState,useRef,useCallback,useEffect}from'react';import {cva}from'class-variance-authority';var Y=cva("absolute z-50 px-3 py-2 text-sm font-medium rounded-md shadow-lg transition-opacity duration-200",{variants:{variant:{default:"bg-popover text-popover-foreground border border-border",light:"bg-popover text-popover-foreground border border-border",dark:"bg-popover text-popover-foreground border border-border",success:"bg-success text-success-foreground",warning:"bg-warning text-warning-foreground",error:"bg-destructive text-destructive-foreground",info:"bg-info text-info-foreground"},size:{sm:"text-xs px-2 py-1",md:"text-sm px-3 py-2",lg:"text-base px-4 py-3"},placement:{top:"bottom-full left-1/2 -translate-x-1/2 mb-2","top-start":"bottom-full left-0 mb-2","top-end":"bottom-full right-0 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2","bottom-start":"top-full left-0 mt-2","bottom-end":"top-full right-0 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2","left-start":"right-full top-0 mr-2","left-end":"right-full bottom-0 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2","right-start":"left-full top-0 ml-2","right-end":"left-full bottom-0 ml-2"}},defaultVariants:{variant:"default",size:"md",placement:"top"}}),Z=cva("absolute w-2 h-2 rotate-45",{variants:{variant:{default:"bg-popover border border-border",light:"bg-popover border border-border",dark:"bg-popover border border-border",success:"bg-success-500",warning:"bg-warning-500",error:"bg-destructive",info:"bg-info-500"},placement:{top:"top-full left-1/2 -translate-x-1/2 -translate-y-1/2","top-start":"top-full left-4 -translate-y-1/2","top-end":"top-full right-4 -translate-y-1/2",bottom:"bottom-full left-1/2 -translate-x-1/2 translate-y-1/2","bottom-start":"bottom-full left-4 translate-y-1/2","bottom-end":"bottom-full right-4 translate-y-1/2",left:"left-full top-1/2 -translate-x-1/2 -translate-y-1/2","left-start":"left-full top-4 -translate-x-1/2","left-end":"left-full bottom-4 -translate-x-1/2",right:"right-full top-1/2 translate-x-1/2 -translate-y-1/2","right-start":"right-full top-4 translate-x-1/2","right-end":"right-full bottom-4 translate-x-1/2"}},defaultVariants:{variant:"default",placement:"top"}}),O=a.createContext(void 0),$=()=>{let u=a.useContext(O);if(!u)throw new Error("Tooltip components must be used within a Tooltip");return u},q=a.forwardRef(({children:u,content:h,trigger:T="hover",open:i,onOpenChange:d,delayDuration:e=700,skipDelayDuration:y=300,disabled:f=false,className:E,contentClassName:s,sideOffset:C=4,alignOffset:M=0,avoidCollisions:R=true,collisionBoundary:w,collisionPadding:o=8,hideWhenDetached:x=false,sticky:D="partial",updatePositionDeps:L,closeOnBlur:H=true,...v},c)=>{let[N,t]=useState(false),r=useRef(null),g=useRef(null),l=i!==void 0,n=l?i:N,p=useCallback(_=>{f||(l||t(_),d?.(_));},[f,l,d]),m=useCallback(()=>{r.current!=null&&(clearTimeout(r.current),r.current=null),g.current!=null&&(clearTimeout(g.current),g.current=null);},[]),W=useCallback(()=>{m(),p(true);},[m,p]),B=useCallback(()=>{m(),p(false);},[m,p]),V=useCallback(()=>{m(),!f&&(e>0?r.current=window.setTimeout(()=>{p(true);},e):p(true));},[m,f,e,p]),z=useCallback(()=>{m(),y>0?g.current=window.setTimeout(()=>{p(false);},y):p(false);},[m,y,p]),G=useCallback(()=>{n?z():V();},[n,V,z]),J=useCallback(()=>{n?B():W();},[n,W,B]);useEffect(()=>()=>{m();},[m]);let Q={open:n,setOpen:p,trigger:T,delayDuration:e,skipDelayDuration:y,openNow:W,closeNow:B,openWithDelay:V,closeWithDelay:z,toggleWithDelay:G,toggleNow:J,closeOnBlur:H},U=n===true&&h!==void 0;return a.createElement(O.Provider,{value:Q},a.createElement("div",{ref:c,className:a$1("relative inline-block",E),"data-open":n,...v},u,U?a.createElement(F,{className:s||"",sideOffset:C,alignOffset:M,avoidCollisions:R,collisionBoundary:w||null,collisionPadding:o,hideWhenDetached:x,sticky:D,updatePositionDeps:L||[],variant:v.variant,size:v.size,placement:v.placement},h):null))});q.displayName="Tooltip";var A=a.forwardRef(({children:u,asChild:h=true,className:T,...i},d)=>{let{trigger:e,openNow:y,closeNow:f,openWithDelay:E,closeWithDelay:s,toggleNow:C,closeOnBlur:M}=$(),R=useRef(null),w={ref:o=>{R.current=o,typeof d=="function"?d(o):d&&(d.current=o);},className:a$1(T),"data-tooltip-trigger":true,onMouseEnter:o=>{i.onMouseEnter?.(o),e==="hover"&&E();},onMouseLeave:o=>{i.onMouseLeave?.(o),e==="hover"&&s();},onPointerEnter:o=>{i.onPointerEnter?.(o),e==="hover"&&E();},onPointerLeave:o=>{i.onPointerLeave?.(o),e==="hover"&&s();},onClick:o=>{i.onClick?.(o),e==="click"&&C();},onFocus:o=>{i.onFocus?.(o),e==="focus"&&y();},onBlur:o=>{i.onBlur?.(o),M&&f();},onKeyDown:o=>{i.onKeyDown?.(o),o.key==="Escape"&&f();}};return h&&a.isValidElement(u)?a.cloneElement(u,{...u.props||{},...w}):a.createElement("span",{...w,tabIndex:e==="focus"?0:void 0,role:e==="click"?"button":void 0},u)});A.displayName="TooltipTrigger";var F=a.forwardRef(({children:u,variant:h="default",size:T="md",placement:i="top",className:d,sideOffset:e=4,alignOffset:y=0,avoidCollisions:f=true,collisionBoundary:E,collisionPadding:s=8,hideWhenDetached:C=false,sticky:M="partial",updatePositionDeps:R,...w},o)=>{let x=a.useContext(O)?.open??true,D=useRef(null),[L,H]=useState({top:0,left:0}),v=useCallback(()=>{if(!D.current)return;let c=D.current,N=c.parentElement?.querySelector("[data-tooltip-trigger]");if(!N)return;let t=N.getBoundingClientRect(),r=c.getBoundingClientRect(),g={width:window.innerWidth,height:window.innerHeight},l=0,n=0;switch(i){case "top":l=t.top-r.height-e,n=t.left+t.width/2-r.width/2;break;case "top-start":l=t.top-r.height-e,n=t.left;break;case "top-end":l=t.top-r.height-e,n=t.right-r.width;break;case "bottom":l=t.bottom+e,n=t.left+t.width/2-r.width/2;break;case "bottom-start":l=t.bottom+e,n=t.left;break;case "bottom-end":l=t.bottom+e,n=t.right-r.width;break;case "left":l=t.top+t.height/2-r.height/2,n=t.left-r.width-e;break;case "left-start":l=t.top,n=t.left-r.width-e;break;case "left-end":l=t.bottom-r.height,n=t.left-r.width-e;break;case "right":l=t.top+t.height/2-r.height/2,n=t.right+e;break;case "right-start":l=t.top,n=t.right+e;break;case "right-end":l=t.bottom-r.height,n=t.right+e;break}f&&(n<s?n=s:n+r.width>g.width-s&&(n=g.width-r.width-s),l<s?l=s:l+r.height>g.height-s&&(l=g.height-r.height-s)),H({top:l,left:n});},[i,e,f,s]);return a.useLayoutEffect(()=>{v();let c=()=>v();return window.addEventListener("resize",c),window.addEventListener("scroll",c),()=>{window.removeEventListener("resize",c),window.removeEventListener("scroll",c);}},[v,R,x]),a.createElement("div",{ref:c=>{D.current=c,typeof o=="function"?o(c):o&&(o.current=c);},role:"tooltip","data-tooltip-instance":"nostromo","data-state":x?"open":"closed","aria-hidden":x?void 0:true,className:a$1(Y({variant:h,size:T,placement:i}),x?"opacity-100":"pointer-events-none opacity-0",d),style:{position:"fixed",top:L.top,left:L.left,zIndex:50},...w},u,a.createElement("div",{className:a$1(Z({variant:h,placement:i}))}))});F.displayName="TooltipContent";var tt=({children:u,delayDuration:h=700,skipDelayDuration:T=300,defaultOpen:i=false})=>a.createElement("div",{"data-tooltip-provider":true},u),j=a$2(q);j.Trigger=A;j.Content=F;j.Provider=tt;export{Y as a,Z as b,A as c,F as d,tt as e,j as f};//# sourceMappingURL=chunk-TCA5Z7FL.js.map
|
|
3
|
+
//# sourceMappingURL=chunk-TCA5Z7FL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/core/tooltip.tsx"],"names":["tooltipVariants","cva","arrowVariants","TooltipContext","React","useTooltipContext","context","TooltipComponent","children","content","trigger","controlledOpen","onOpenChange","delayDuration","skipDelayDuration","disabled","className","contentClassName","sideOffset","alignOffset","avoidCollisions","collisionBoundary","collisionPadding","hideWhenDetached","sticky","updatePositionDeps","closeOnBlur","props","ref","internalOpen","setInternalOpen","useState","delayTimerRef","useRef","skipDelayTimerRef","isControlled","open","setOpen","useCallback","newOpen","clearTimers","openNow","closeNow","openWithDelay","closeWithDelay","toggleWithDelay","toggleNow","useEffect","contextValue","shouldRenderContent","cn","TooltipContent","TooltipTrigger","asChild","triggerRef","triggerProps","node","e","variant","size","placement","_alignOffset","_collisionBoundary","_hideWhenDetached","_sticky","contentRef","position","setPosition","updatePosition","triggerRect","contentRect","viewport","top","left","handleResize","TooltipProvider","_delayDuration","_skipDelayDuration","_defaultOpen","Tooltip","memo"],"mappings":"iMAMMA,CAAAA,CAAkBC,GAAAA,CACtB,kGAAA,CACA,CACE,QAAA,CAAU,CACR,OAAA,CAAS,CACP,QAAS,yDAAA,CACT,KAAA,CAAO,yDAAA,CACP,IAAA,CAAM,0DACN,OAAA,CAAS,oCAAA,CACT,OAAA,CAAS,oCAAA,CACT,MAAO,4CAAA,CACP,IAAA,CAAM,8BACR,CAAA,CACA,IAAA,CAAM,CACJ,EAAA,CAAI,mBAAA,CACJ,GAAI,mBAAA,CACJ,EAAA,CAAI,qBACN,CAAA,CACA,UAAW,CACT,GAAA,CAAK,4CAAA,CACL,WAAA,CAAa,0BACb,SAAA,CAAW,0BAAA,CACX,MAAA,CAAQ,yCAAA,CACR,eAAgB,sBAAA,CAChB,YAAA,CAAc,uBAAA,CACd,IAAA,CAAM,2CACN,YAAA,C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AAmBC,CAAAA,CAAqB,GAAA,CACxC,WAAA,CAAaC,EAAe,KAC9B,CAAA,GACS1E,CAAAA,CAAA,aAAA,CAAC,OAAI,uBAAA,CAAqB,IAAA,CAAA,CAAEI,CAAS,CAAA,CAIxCuE,EAAUC,GAAAA,CAAKzE,CAAgB,EAOrCwE,CAAAA,CAAQ,QAAU3B,CAAAA,CAClB2B,CAAAA,CAAQ,OAAA,CAAU5B,CAAAA,CAClB4B,EAAQ,QAAA,CAAWJ,EAAAA","file":"chunk-TCA5Z7FL.js","sourcesContent":["import React, { useState, useRef, useEffect, useCallback } from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/utils\";\nimport { memo } from \"../../lib/memo\";\n\n// Tooltip variants\nconst tooltipVariants = cva(\n \"absolute z-50 px-3 py-2 text-sm font-medium rounded-md shadow-lg transition-opacity duration-200\",\n {\n variants: {\n variant: {\n default: \"bg-popover text-popover-foreground border border-border\",\n light: \"bg-popover text-popover-foreground border border-border\",\n dark: \"bg-popover text-popover-foreground border border-border\",\n success: \"bg-success text-success-foreground\",\n warning: \"bg-warning text-warning-foreground\",\n error: \"bg-destructive text-destructive-foreground\",\n info: \"bg-info text-info-foreground\",\n },\n size: {\n sm: \"text-xs px-2 py-1\",\n md: \"text-sm px-3 py-2\",\n lg: \"text-base px-4 py-3\",\n },\n placement: {\n top: \"bottom-full left-1/2 -translate-x-1/2 mb-2\",\n \"top-start\": \"bottom-full left-0 mb-2\",\n \"top-end\": \"bottom-full right-0 mb-2\",\n bottom: \"top-full left-1/2 -translate-x-1/2 mt-2\",\n \"bottom-start\": \"top-full left-0 mt-2\",\n \"bottom-end\": \"top-full right-0 mt-2\",\n left: \"right-full top-1/2 -translate-y-1/2 mr-2\",\n \"left-start\": \"right-full top-0 mr-2\",\n \"left-end\": \"right-full bottom-0 mr-2\",\n right: \"left-full top-1/2 -translate-y-1/2 ml-2\",\n \"right-start\": \"left-full top-0 ml-2\",\n \"right-end\": \"left-full bottom-0 ml-2\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"md\",\n placement: \"top\",\n },\n },\n);\n\nconst arrowVariants = cva(\"absolute w-2 h-2 rotate-45\", {\n variants: {\n variant: {\n default: \"bg-popover border border-border\",\n light: \"bg-popover border border-border\",\n dark: \"bg-popover border border-border\",\n success: \"bg-success-500\",\n warning: \"bg-warning-500\",\n error: \"bg-destructive\",\n info: \"bg-info-500\",\n },\n placement: {\n top: \"top-full left-1/2 -translate-x-1/2 -translate-y-1/2\",\n \"top-start\": \"top-full left-4 -translate-y-1/2\",\n \"top-end\": \"top-full right-4 -translate-y-1/2\",\n bottom: \"bottom-full left-1/2 -translate-x-1/2 translate-y-1/2\",\n \"bottom-start\": \"bottom-full left-4 translate-y-1/2\",\n \"bottom-end\": \"bottom-full right-4 translate-y-1/2\",\n left: \"left-full top-1/2 -translate-x-1/2 -translate-y-1/2\",\n \"left-start\": \"left-full top-4 -translate-x-1/2\",\n \"left-end\": \"left-full bottom-4 -translate-x-1/2\",\n right: \"right-full top-1/2 translate-x-1/2 -translate-y-1/2\",\n \"right-start\": \"right-full top-4 translate-x-1/2\",\n \"right-end\": \"right-full bottom-4 translate-x-1/2\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n placement: \"top\",\n },\n});\n\n// Types\nexport interface TooltipProps extends VariantProps<typeof tooltipVariants> {\n children: React.ReactNode;\n /**\n * The tooltip body, for the shorthand form:\n * `<Tooltip content=\"...\"> <button /></Tooltip>`.\n *\n * Optional, because `TooltipTrigger` and `TooltipContent` are exported and\n * composing them is the other supported form - and the one the docs show. It\n * was required, which meant the composed form did not type-check at all.\n */\n content?: React.ReactNode;\n trigger?: \"hover\" | \"click\" | \"focus\" | \"manual\";\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n delayDuration?: number;\n skipDelayDuration?: number;\n disabled?: boolean;\n className?: string;\n contentClassName?: string;\n sideOffset?: number;\n alignOffset?: number;\n avoidCollisions?: boolean;\n collisionBoundary?: Element | null;\n collisionPadding?: number;\n hideWhenDetached?: boolean;\n sticky?: \"partial\" | \"always\";\n updatePositionDeps?: React.DependencyList;\n closeOnBlur?: boolean;\n}\n\nexport interface TooltipContentProps extends VariantProps<\n typeof tooltipVariants\n> {\n children: React.ReactNode;\n className?: string;\n sideOffset?: number;\n alignOffset?: number;\n avoidCollisions?: boolean;\n collisionBoundary?: Element | null;\n collisionPadding?: number;\n hideWhenDetached?: boolean;\n sticky?: \"partial\" | \"always\";\n updatePositionDeps?: React.DependencyList;\n}\n\nexport interface TooltipTriggerProps extends React.HTMLAttributes<HTMLElement> {\n children: React.ReactNode;\n asChild?: boolean;\n className?: string;\n}\n\n// Tooltip Context\ninterface TooltipContextType {\n open: boolean;\n setOpen: (open: boolean) => void;\n trigger: \"hover\" | \"click\" | \"focus\" | \"manual\";\n delayDuration: number;\n skipDelayDuration: number;\n openNow: () => void;\n closeNow: () => void;\n openWithDelay: () => void;\n closeWithDelay: () => void;\n toggleWithDelay: () => void;\n toggleNow: () => void;\n closeOnBlur: boolean;\n}\n\nconst TooltipContext = React.createContext<TooltipContextType | undefined>(\n undefined,\n);\n\nconst useTooltipContext = () => {\n const context = React.useContext(TooltipContext);\n if (!context) {\n throw new Error(\"Tooltip components must be used within a Tooltip\");\n }\n return context;\n};\n\n// Main Tooltip Component\nconst TooltipComponent = React.forwardRef<HTMLDivElement, TooltipProps>(\n (\n {\n children,\n content,\n trigger = \"hover\",\n open: controlledOpen,\n onOpenChange,\n delayDuration = 700,\n skipDelayDuration = 300,\n disabled = false,\n className,\n contentClassName,\n sideOffset = 4,\n alignOffset = 0,\n avoidCollisions = true,\n collisionBoundary,\n collisionPadding = 8,\n hideWhenDetached = false,\n sticky = \"partial\",\n updatePositionDeps,\n closeOnBlur = true,\n ...props\n },\n ref,\n ) => {\n const [internalOpen, setInternalOpen] = useState(false);\n const delayTimerRef = useRef<number | ReturnType<typeof setTimeout> | null>(\n null,\n );\n const skipDelayTimerRef = useRef<\n number | ReturnType<typeof setTimeout> | null\n >(null);\n\n const isControlled = controlledOpen !== undefined;\n const open = isControlled ? controlledOpen : internalOpen;\n\n const setOpen = useCallback(\n (newOpen: boolean) => {\n if (disabled) return;\n\n if (isControlled) {\n onOpenChange?.(newOpen);\n } else {\n setInternalOpen(newOpen);\n onOpenChange?.(newOpen); // notify i uncontrolled\n }\n },\n [disabled, isControlled, onOpenChange],\n );\n\n // --- Tooltip open/close/toggle helpers ---\n const clearTimers = useCallback(() => {\n if (delayTimerRef.current != null) {\n clearTimeout(delayTimerRef.current);\n delayTimerRef.current = null;\n }\n if (skipDelayTimerRef.current != null) {\n clearTimeout(skipDelayTimerRef.current);\n skipDelayTimerRef.current = null;\n }\n }, []);\n\n const openNow = useCallback(() => {\n clearTimers();\n setOpen(true);\n }, [clearTimers, setOpen]);\n\n const closeNow = useCallback(() => {\n clearTimers();\n setOpen(false);\n }, [clearTimers, setOpen]);\n\n const openWithDelay = useCallback(() => {\n clearTimers();\n if (disabled) return;\n if (delayDuration > 0) {\n delayTimerRef.current = window.setTimeout(() => {\n setOpen(true);\n }, delayDuration);\n } else {\n setOpen(true);\n }\n }, [clearTimers, disabled, delayDuration, setOpen]);\n\n const closeWithDelay = useCallback(() => {\n clearTimers();\n if (skipDelayDuration > 0) {\n skipDelayTimerRef.current = window.setTimeout(() => {\n setOpen(false);\n }, skipDelayDuration);\n } else {\n setOpen(false);\n }\n }, [clearTimers, skipDelayDuration, setOpen]);\n\n const toggleWithDelay = useCallback(() => {\n if (open) {\n closeWithDelay();\n } else {\n openWithDelay();\n }\n }, [open, openWithDelay, closeWithDelay]);\n\n const toggleNow = useCallback(() => {\n if (open) closeNow();\n else openNow();\n }, [open, openNow, closeNow]);\n\n // Cleanup timers on unmount\n useEffect(() => {\n return () => {\n clearTimers();\n };\n }, [clearTimers]);\n\n const contextValue: TooltipContextType = {\n open,\n setOpen,\n trigger,\n delayDuration,\n skipDelayDuration,\n openNow,\n closeNow,\n openWithDelay,\n closeWithDelay,\n toggleWithDelay,\n toggleNow,\n closeOnBlur,\n };\n\n // Only render the TooltipContent when open is true (and no pending close timer),\n // to help guard against duplicate tooltips in StrictMode/rapid toggles.\n //\n // `content !== undefined` matters for the composed form. Without it, opening\n // a `<Tooltip><TooltipTrigger /><TooltipContent /></Tooltip>` rendered this\n // slot too, with `undefined` inside - a second, empty bubble next to the real\n // one. The shorthand and the composed form are now mutually exclusive, which\n // is what they always looked like from the outside.\n const shouldRenderContent = open === true && content !== undefined;\n\n return (\n <TooltipContext.Provider value={contextValue}>\n <div\n ref={ref}\n className={cn(\"relative inline-block\", className)}\n data-open={open}\n {...props}\n >\n {children}\n {shouldRenderContent ? (\n <TooltipContent\n className={contentClassName || \"\"}\n sideOffset={sideOffset}\n alignOffset={alignOffset}\n avoidCollisions={avoidCollisions}\n collisionBoundary={collisionBoundary || null}\n collisionPadding={collisionPadding}\n hideWhenDetached={hideWhenDetached}\n sticky={sticky}\n updatePositionDeps={updatePositionDeps || []}\n variant={props.variant}\n size={props.size}\n placement={props.placement}\n >\n {content}\n </TooltipContent>\n ) : null}\n </div>\n </TooltipContext.Provider>\n );\n },\n);\n\nTooltipComponent.displayName = \"Tooltip\";\n\n// Note: Tooltip memoization and subcomponent attachment happens at end of file\n\n// Tooltip Trigger Component\nexport const TooltipTrigger = React.forwardRef<\n HTMLElement,\n TooltipTriggerProps\n>(({ children, asChild = true, className, ...props }, ref) => {\n const {\n trigger,\n openNow,\n closeNow,\n openWithDelay,\n closeWithDelay,\n toggleNow,\n closeOnBlur,\n } = useTooltipContext();\n const triggerRef = useRef<HTMLElement>(null);\n\n const triggerProps = {\n ref: (node: HTMLElement) => {\n (triggerRef as React.MutableRefObject<HTMLElement | null>).current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n (ref as React.MutableRefObject<HTMLElement | null>).current = node;\n }\n },\n className: cn(className),\n \"data-tooltip-trigger\": true,\n onMouseEnter: (e: React.MouseEvent<HTMLElement>) => {\n // Call external handler first\n props.onMouseEnter?.(e as React.MouseEvent<HTMLElement>);\n if (trigger === \"hover\") {\n openWithDelay();\n }\n },\n onMouseLeave: (e: React.MouseEvent<HTMLElement>) => {\n props.onMouseLeave?.(e as React.MouseEvent<HTMLElement>);\n if (trigger === \"hover\") closeWithDelay();\n },\n onPointerEnter: (e: React.PointerEvent) => {\n // @ts-expect-error - Event handler type compatibility\n props.onPointerEnter?.(e);\n if (trigger === \"hover\") openWithDelay();\n },\n onPointerLeave: (e: React.PointerEvent) => {\n // @ts-expect-error - Event handler type compatibility\n props.onPointerLeave?.(e);\n if (trigger === \"hover\") closeWithDelay();\n },\n onClick: (e: React.MouseEvent) => {\n // @ts-expect-error - Event handler type compatibility\n props.onClick?.(e);\n if (trigger === \"click\") toggleNow();\n },\n onFocus: (e: React.FocusEvent) => {\n // @ts-expect-error - Event handler type compatibility\n props.onFocus?.(e);\n if (trigger === \"focus\") openNow();\n },\n onBlur: (e: React.FocusEvent) => {\n // @ts-expect-error - Event handler type compatibility\n props.onBlur?.(e);\n if (closeOnBlur) closeNow();\n },\n onKeyDown: (e: React.KeyboardEvent) => {\n // @ts-expect-error - Event handler type compatibility\n props.onKeyDown?.(e);\n if (e.key === \"Escape\") closeNow();\n },\n };\n\n if (asChild && React.isValidElement(children)) {\n // eslint-disable-next-line react-hooks/refs -- cloneElement merges triggerProps (incl. ref) onto the child; the ref is not read here\n return React.cloneElement(children, {\n ...(children.props || {}),\n ...triggerProps,\n });\n }\n\n return (\n <span\n {...triggerProps}\n tabIndex={trigger === \"focus\" ? 0 : undefined}\n role={trigger === \"click\" ? \"button\" : undefined}\n >\n {children}\n </span>\n );\n});\n\nTooltipTrigger.displayName = \"TooltipTrigger\";\n\n// Tooltip Content Component\nexport const TooltipContent = React.forwardRef<\n HTMLDivElement,\n TooltipContentProps\n>(\n (\n {\n children,\n variant = \"default\",\n size = \"md\",\n placement = \"top\",\n className,\n sideOffset = 4,\n alignOffset: _alignOffset = 0,\n avoidCollisions = true,\n collisionBoundary: _collisionBoundary,\n collisionPadding = 8,\n hideWhenDetached: _hideWhenDetached = false,\n sticky: _sticky = \"partial\",\n updatePositionDeps,\n ...props\n },\n ref,\n ) => {\n // Read the context directly rather than through useTooltipContext: that\n // throws without a provider, and TooltipContent was usable standalone before\n // this. Absent a Tooltip parent there is nothing to open it, so treat it as\n // shown - which is also what it did previously.\n const open = React.useContext(TooltipContext)?.open ?? true;\n const contentRef = useRef<HTMLDivElement>(null);\n const [position, setPosition] = useState({ top: 0, left: 0 });\n\n const updatePosition = useCallback(() => {\n if (!contentRef.current) return;\n\n const content = contentRef.current;\n const trigger = content.parentElement?.querySelector(\n \"[data-tooltip-trigger]\",\n ) as HTMLElement;\n\n if (!trigger) return;\n\n const triggerRect = trigger.getBoundingClientRect();\n const contentRect = content.getBoundingClientRect();\n const viewport = {\n width: window.innerWidth,\n height: window.innerHeight,\n };\n\n let top = 0;\n let left = 0;\n\n // Calculate position based on placement\n switch (placement) {\n case \"top\":\n top = triggerRect.top - contentRect.height - sideOffset;\n left =\n triggerRect.left + triggerRect.width / 2 - contentRect.width / 2;\n break;\n case \"top-start\":\n top = triggerRect.top - contentRect.height - sideOffset;\n left = triggerRect.left;\n break;\n case \"top-end\":\n top = triggerRect.top - contentRect.height - sideOffset;\n left = triggerRect.right - contentRect.width;\n break;\n case \"bottom\":\n top = triggerRect.bottom + sideOffset;\n left =\n triggerRect.left + triggerRect.width / 2 - contentRect.width / 2;\n break;\n case \"bottom-start\":\n top = triggerRect.bottom + sideOffset;\n left = triggerRect.left;\n break;\n case \"bottom-end\":\n top = triggerRect.bottom + sideOffset;\n left = triggerRect.right - contentRect.width;\n break;\n case \"left\":\n top =\n triggerRect.top + triggerRect.height / 2 - contentRect.height / 2;\n left = triggerRect.left - contentRect.width - sideOffset;\n break;\n case \"left-start\":\n top = triggerRect.top;\n left = triggerRect.left - contentRect.width - sideOffset;\n break;\n case \"left-end\":\n top = triggerRect.bottom - contentRect.height;\n left = triggerRect.left - contentRect.width - sideOffset;\n break;\n case \"right\":\n top =\n triggerRect.top + triggerRect.height / 2 - contentRect.height / 2;\n left = triggerRect.right + sideOffset;\n break;\n case \"right-start\":\n top = triggerRect.top;\n left = triggerRect.right + sideOffset;\n break;\n case \"right-end\":\n top = triggerRect.bottom - contentRect.height;\n left = triggerRect.right + sideOffset;\n break;\n }\n\n // Apply collision detection if enabled\n if (avoidCollisions) {\n // Horizontal collision detection\n if (left < collisionPadding) {\n left = collisionPadding;\n } else if (\n left + contentRect.width >\n viewport.width - collisionPadding\n ) {\n left = viewport.width - contentRect.width - collisionPadding;\n }\n\n // Vertical collision detection\n if (top < collisionPadding) {\n top = collisionPadding;\n } else if (\n top + contentRect.height >\n viewport.height - collisionPadding\n ) {\n top = viewport.height - contentRect.height - collisionPadding;\n }\n }\n\n setPosition({ top, left });\n }, [placement, sideOffset, avoidCollisions, collisionPadding]);\n\n React.useLayoutEffect(() => {\n updatePosition();\n\n const handleResize = () => updatePosition();\n window.addEventListener(\"resize\", handleResize);\n window.addEventListener(\"scroll\", handleResize);\n\n return () => {\n window.removeEventListener(\"resize\", handleResize);\n window.removeEventListener(\"scroll\", handleResize);\n };\n // is a dependency: the box is measured to place it, and measuring\n // it while closed gave a stale position on the first show.\n }, [updatePosition, updatePositionDeps, open]);\n\n return (\n <div\n ref={(node) => {\n (\n contentRef as React.MutableRefObject<HTMLDivElement | null>\n ).current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n (ref as React.MutableRefObject<HTMLDivElement | null>).current =\n node;\n }\n }}\n role=\"tooltip\"\n data-tooltip-instance=\"nostromo\"\n data-state={open ? \"open\" : \"closed\"}\n aria-hidden={open ? undefined : true}\n className={cn(\n tooltipVariants({ variant, size, placement }),\n // The content never read the open state. `data-open` was written on the\n // wrapper and nothing - no CSS, no conditional render - ever acted on\n // it, so the tooltip was permanently visible, sitting on top of its own\n // trigger. Bound to opacity rather than unmounted so the\n // `transition-opacity` the variants already declare still runs.\n open ? \"opacity-100\" : \"pointer-events-none opacity-0\",\n className,\n )}\n style={{\n position: \"fixed\",\n top: position.top,\n left: position.left,\n zIndex: 50,\n }}\n {...props}\n >\n {children}\n <div className={cn(arrowVariants({ variant, placement }))} />\n </div>\n );\n },\n);\n\nTooltipContent.displayName = \"TooltipContent\";\n\n// Tooltip Provider for global configuration\nexport interface TooltipProviderProps {\n children: React.ReactNode;\n delayDuration?: number;\n skipDelayDuration?: number;\n defaultOpen?: boolean;\n}\n\nexport const TooltipProvider: React.FC<TooltipProviderProps> = ({\n children,\n delayDuration: _delayDuration = 700,\n skipDelayDuration: _skipDelayDuration = 300,\n defaultOpen: _defaultOpen = false,\n}) => {\n return <div data-tooltip-provider>{children}</div>;\n};\n\n// Memoize Tooltip for performance optimization (after all subcomponents are defined)\nconst Tooltip = memo(TooltipComponent) as typeof TooltipComponent & {\n Trigger: typeof TooltipTrigger;\n Content: typeof TooltipContent;\n Provider: typeof TooltipProvider;\n};\n\n// Attach subcomponents to Tooltip for compound component pattern\nTooltip.Trigger = TooltipTrigger;\nTooltip.Content = TooltipContent;\nTooltip.Provider = TooltipProvider;\n\n// Export variants and Tooltip for external use\nexport { Tooltip, tooltipVariants, arrowVariants };\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';var chunk7SPPGTBT_cjs=require('./chunk-7SPPGTBT.cjs'),chunkITRGJNWL_cjs=require('./chunk-ITRGJNWL.cjs'),a=require('react'),classVarianceAuthority=require('class-variance-authority');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var a__default=/*#__PURE__*/_interopDefault(a);var Y=classVarianceAuthority.cva("absolute z-50 px-3 py-2 text-sm font-medium rounded-md shadow-lg transition-opacity duration-200",{variants:{variant:{default:"bg-popover text-popover-foreground border border-border",light:"bg-popover text-popover-foreground border border-border",dark:"bg-popover text-popover-foreground border border-border",success:"bg-success text-success-foreground",warning:"bg-warning text-warning-foreground",error:"bg-destructive text-destructive-foreground",info:"bg-info text-info-foreground"},size:{sm:"text-xs px-2 py-1",md:"text-sm px-3 py-2",lg:"text-base px-4 py-3"},placement:{top:"bottom-full left-1/2 -translate-x-1/2 mb-2","top-start":"bottom-full left-0 mb-2","top-end":"bottom-full right-0 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2","bottom-start":"top-full left-0 mt-2","bottom-end":"top-full right-0 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2","left-start":"right-full top-0 mr-2","left-end":"right-full bottom-0 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2","right-start":"left-full top-0 ml-2","right-end":"left-full bottom-0 ml-2"}},defaultVariants:{variant:"default",size:"md",placement:"top"}}),Z=classVarianceAuthority.cva("absolute w-2 h-2 rotate-45",{variants:{variant:{default:"bg-popover border border-border",light:"bg-popover border border-border",dark:"bg-popover border border-border",success:"bg-success-500",warning:"bg-warning-500",error:"bg-destructive",info:"bg-info-500"},placement:{top:"top-full left-1/2 -translate-x-1/2 -translate-y-1/2","top-start":"top-full left-4 -translate-y-1/2","top-end":"top-full right-4 -translate-y-1/2",bottom:"bottom-full left-1/2 -translate-x-1/2 translate-y-1/2","bottom-start":"bottom-full left-4 translate-y-1/2","bottom-end":"bottom-full right-4 translate-y-1/2",left:"left-full top-1/2 -translate-x-1/2 -translate-y-1/2","left-start":"left-full top-4 -translate-x-1/2","left-end":"left-full bottom-4 -translate-x-1/2",right:"right-full top-1/2 translate-x-1/2 -translate-y-1/2","right-start":"right-full top-4 translate-x-1/2","right-end":"right-full bottom-4 translate-x-1/2"}},defaultVariants:{variant:"default",placement:"top"}}),O=a__default.default.createContext(void 0),$=()=>{let u=a__default.default.useContext(O);if(!u)throw new Error("Tooltip components must be used within a Tooltip");return u},q=a__default.default.forwardRef(({children:u,content:h,trigger:T="hover",open:i,onOpenChange:d,delayDuration:e=700,skipDelayDuration:y=300,disabled:f=false,className:E,contentClassName:s,sideOffset:C=4,alignOffset:M=0,avoidCollisions:R=true,collisionBoundary:w,collisionPadding:o=8,hideWhenDetached:x=false,sticky:D="partial",updatePositionDeps:L,closeOnBlur:H=true,...v},c)=>{let[N,t]=a.useState(false),r=a.useRef(null),g=a.useRef(null),l=i!==void 0,n=l?i:N,p=a.useCallback(_=>{f||(l||t(_),d?.(_));},[f,l,d]),m=a.useCallback(()=>{r.current!=null&&(clearTimeout(r.current),r.current=null),g.current!=null&&(clearTimeout(g.current),g.current=null);},[]),W=a.useCallback(()=>{m(),p(true);},[m,p]),B=a.useCallback(()=>{m(),p(false);},[m,p]),V=a.useCallback(()=>{m(),!f&&(e>0?r.current=window.setTimeout(()=>{p(true);},e):p(true));},[m,f,e,p]),z=a.useCallback(()=>{m(),y>0?g.current=window.setTimeout(()=>{p(false);},y):p(false);},[m,y,p]),G=a.useCallback(()=>{n?z():V();},[n,V,z]),J=a.useCallback(()=>{n?B():W();},[n,W,B]);a.useEffect(()=>()=>{m();},[m]);let Q={open:n,setOpen:p,trigger:T,delayDuration:e,skipDelayDuration:y,openNow:W,closeNow:B,openWithDelay:V,closeWithDelay:z,toggleWithDelay:G,toggleNow:J,closeOnBlur:H},U=n===true&&h!==void 0;return a__default.default.createElement(O.Provider,{value:Q},a__default.default.createElement("div",{ref:c,className:chunkITRGJNWL_cjs.a("relative inline-block",E),"data-open":n,...v},u,U?a__default.default.createElement(F,{className:s||"",sideOffset:C,alignOffset:M,avoidCollisions:R,collisionBoundary:w||null,collisionPadding:o,hideWhenDetached:x,sticky:D,updatePositionDeps:L||[],variant:v.variant,size:v.size,placement:v.placement},h):null))});q.displayName="Tooltip";var A=a__default.default.forwardRef(({children:u,asChild:h=true,className:T,...i},d)=>{let{trigger:e,openNow:y,closeNow:f,openWithDelay:E,closeWithDelay:s,toggleNow:C,closeOnBlur:M}=$(),R=a.useRef(null),w={ref:o=>{R.current=o,typeof d=="function"?d(o):d&&(d.current=o);},className:chunkITRGJNWL_cjs.a(T),"data-tooltip-trigger":true,onMouseEnter:o=>{i.onMouseEnter?.(o),e==="hover"&&E();},onMouseLeave:o=>{i.onMouseLeave?.(o),e==="hover"&&s();},onPointerEnter:o=>{i.onPointerEnter?.(o),e==="hover"&&E();},onPointerLeave:o=>{i.onPointerLeave?.(o),e==="hover"&&s();},onClick:o=>{i.onClick?.(o),e==="click"&&C();},onFocus:o=>{i.onFocus?.(o),e==="focus"&&y();},onBlur:o=>{i.onBlur?.(o),M&&f();},onKeyDown:o=>{i.onKeyDown?.(o),o.key==="Escape"&&f();}};return h&&a__default.default.isValidElement(u)?a__default.default.cloneElement(u,{...u.props||{},...w}):a__default.default.createElement("span",{...w,tabIndex:e==="focus"?0:void 0,role:e==="click"?"button":void 0},u)});A.displayName="TooltipTrigger";var F=a__default.default.forwardRef(({children:u,variant:h="default",size:T="md",placement:i="top",className:d,sideOffset:e=4,alignOffset:y=0,avoidCollisions:f=true,collisionBoundary:E,collisionPadding:s=8,hideWhenDetached:C=false,sticky:M="partial",updatePositionDeps:R,...w},o)=>{let x=a__default.default.useContext(O)?.open??true,D=a.useRef(null),[L,H]=a.useState({top:0,left:0}),v=a.useCallback(()=>{if(!D.current)return;let c=D.current,N=c.parentElement?.querySelector("[data-tooltip-trigger]");if(!N)return;let t=N.getBoundingClientRect(),r=c.getBoundingClientRect(),g={width:window.innerWidth,height:window.innerHeight},l=0,n=0;switch(i){case "top":l=t.top-r.height-e,n=t.left+t.width/2-r.width/2;break;case "top-start":l=t.top-r.height-e,n=t.left;break;case "top-end":l=t.top-r.height-e,n=t.right-r.width;break;case "bottom":l=t.bottom+e,n=t.left+t.width/2-r.width/2;break;case "bottom-start":l=t.bottom+e,n=t.left;break;case "bottom-end":l=t.bottom+e,n=t.right-r.width;break;case "left":l=t.top+t.height/2-r.height/2,n=t.left-r.width-e;break;case "left-start":l=t.top,n=t.left-r.width-e;break;case "left-end":l=t.bottom-r.height,n=t.left-r.width-e;break;case "right":l=t.top+t.height/2-r.height/2,n=t.right+e;break;case "right-start":l=t.top,n=t.right+e;break;case "right-end":l=t.bottom-r.height,n=t.right+e;break}f&&(n<s?n=s:n+r.width>g.width-s&&(n=g.width-r.width-s),l<s?l=s:l+r.height>g.height-s&&(l=g.height-r.height-s)),H({top:l,left:n});},[i,e,f,s]);return a__default.default.useLayoutEffect(()=>{v();let c=()=>v();return window.addEventListener("resize",c),window.addEventListener("scroll",c),()=>{window.removeEventListener("resize",c),window.removeEventListener("scroll",c);}},[v,R,x]),a__default.default.createElement("div",{ref:c=>{D.current=c,typeof o=="function"?o(c):o&&(o.current=c);},role:"tooltip","data-tooltip-instance":"nostromo","data-state":x?"open":"closed","aria-hidden":x?void 0:true,className:chunkITRGJNWL_cjs.a(Y({variant:h,size:T,placement:i}),x?"opacity-100":"pointer-events-none opacity-0",d),style:{position:"fixed",top:L.top,left:L.left,zIndex:50},...w},u,a__default.default.createElement("div",{className:chunkITRGJNWL_cjs.a(Z({variant:h,placement:i}))}))});F.displayName="TooltipContent";var tt=({children:u,delayDuration:h=700,skipDelayDuration:T=300,defaultOpen:i=false})=>a__default.default.createElement("div",{"data-tooltip-provider":true},u),j=chunk7SPPGTBT_cjs.a(q);j.Trigger=A;j.Content=F;j.Provider=tt;exports.a=Y;exports.b=Z;exports.c=A;exports.d=F;exports.e=tt;exports.f=j;//# sourceMappingURL=chunk-Z7WEJ5IQ.cjs.map
|
|
3
|
+
//# sourceMappingURL=chunk-Z7WEJ5IQ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/core/tooltip.tsx"],"names":["tooltipVariants","cva","arrowVariants","TooltipContext","React","useTooltipContext","context","TooltipComponent","children","content","trigger","controlledOpen","onOpenChange","delayDuration","skipDelayDuration","disabled","className","contentClassName","sideOffset","alignOffset","avoidCollisions","collisionBoundary","collisionPadding","hideWhenDetached","sticky","updatePositionDeps","closeOnBlur","props","ref","internalOpen","setInternalOpen","useState","delayTimerRef","useRef","skipDelayTimerRef","isControlled","open","setOpen","useCallback","newOpen","clearTimers","openNow","closeNow","openWithDelay","closeWithDelay","toggleWithDelay","toggleNow","useEffect","contextValue","shouldRenderContent","cn","TooltipContent","TooltipTrigger","asChild","triggerRef","triggerProps","node","e","variant","size","placement","_alignOffset","_collisionBoundary","_hideWhenDetached","_sticky","contentRef","position","setPosition","updatePosition","triggerRect","contentRect","viewport","top","left","handleResize","TooltipProvider","_delayDuration","_skipDelayDuration","_defaultOpen","Tooltip","memo"],"mappings":"uTAMMA,CAAAA,CAAkBC,0BAAAA,CACtB,kGAAA,CACA,CACE,QAAA,CAAU,CACR,OAAA,CAAS,CACP,QAAS,yDAAA,CACT,KAAA,CAAO,yDAAA,CACP,IAAA,CAAM,0DACN,OAAA,CAAS,oCAAA,CACT,OAAA,CAAS,oCAAA,CACT,MAAO,4CAAA,CACP,IAAA,CAAM,8BACR,CAAA,CACA,IAAA,CAAM,CACJ,EAAA,CAAI,mBAAA,CACJ,GAAI,mBAAA,CACJ,EAAA,CAAI,qBACN,CAAA,CACA,UAAW,CACT,GAAA,CAAK,4CAAA,CACL,WAAA,CAAa,0BACb,SAAA,CAAW,0BAAA,CACX,MAAA,CAAQ,yCAAA,CACR,eAAgB,sBAAA,CAChB,YAAA,CAAc,uBAAA,CACd,IAAA,CAAM,2CACN,YAAA,CAAc,uBAAA,CACd,UAAA,CAAY,0BAAA,CACZ,MAAO,yCAAA,CACP,aAAA,CAAe,sBAAA,CACf,WAAA,CAAa,yBACf,CACF,CAAA,CACA,eAAA,CAAiB,CACf,OAAA,CAAS,SAAA,CACT,IAAA,CAAM,IAAA,CACN,UAAW,KACb,CACF,CACF,CAAA,CAEMC,EAAgBD,0BAAAA,CAAI,4BAAA,CAA8B,CACtD,QAAA,CAAU,CACR,OAAA,CAAS,CACP,OAAA,CAAS,iCAAA,CACT,MAAO,iCAAA,CACP,IAAA,CAAM,iCAAA,CACN,OAAA,CAAS,iBACT,OAAA,CAAS,gBAAA,CACT,KAAA,CAAO,gBAAA,CACP,KAAM,aACR,CAAA,CACA,SAAA,CAAW,CACT,IAAK,qDAAA,CACL,WAAA,CAAa,kCAAA,CACb,SA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aAAA,CAAaA,CAAAA,CAAO,MAAA,CAAY,KAChC,SAAA,CAAWc,mBAAAA,CACTlD,CAAAA,CAAgB,CAAE,QAAA0D,CAAAA,CAAS,IAAA,CAAAC,CAAAA,CAAM,SAAA,CAAAC,CAAU,CAAC,CAAA,CAM5CxB,CAAAA,CAAO,aAAA,CAAgB,+BAAA,CACvBpB,CACF,CAAA,CACA,KAAA,CAAO,CACL,QAAA,CAAU,OAAA,CACV,GAAA,CAAKkD,CAAAA,CAAS,IACd,IAAA,CAAMA,CAAAA,CAAS,IAAA,CACf,MAAA,CAAQ,EACV,CAAA,CACC,GAAGvC,CAAAA,CAAAA,CAEHnB,CAAAA,CACDJ,mBAAA,aAAA,CAAC,KAAA,CAAA,CAAI,SAAA,CAAW8C,mBAAAA,CAAGhD,EAAc,CAAE,OAAA,CAAAwD,CAAAA,CAAS,SAAA,CAAAE,CAAU,CAAC,CAAC,CAAA,CAAG,CAC7D,CAEJ,CACF,EAEAT,CAAAA,CAAe,WAAA,CAAc,gBAAA,CAUtB,IAAMwB,EAAAA,CAAkD,CAAC,CAC9D,QAAA,CAAAnE,CAAAA,CACA,aAAA,CAAeoE,CAAAA,CAAiB,IAChC,iBAAA,CAAmBC,CAAAA,CAAqB,GAAA,CACxC,WAAA,CAAaC,EAAe,KAC9B,CAAA,GACS1E,kBAAAA,CAAA,aAAA,CAAC,OAAI,uBAAA,CAAqB,IAAA,CAAA,CAAEI,CAAS,CAAA,CAIxCuE,EAAUC,mBAAAA,CAAKzE,CAAgB,EAOrCwE,CAAAA,CAAQ,QAAU3B,CAAAA,CAClB2B,CAAAA,CAAQ,OAAA,CAAU5B,CAAAA,CAClB4B,EAAQ,QAAA,CAAWJ,EAAAA","file":"chunk-Z7WEJ5IQ.cjs","sourcesContent":["import React, { useState, useRef, useEffect, useCallback } from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/utils\";\nimport { memo } from \"../../lib/memo\";\n\n// Tooltip variants\nconst tooltipVariants = cva(\n \"absolute z-50 px-3 py-2 text-sm font-medium rounded-md shadow-lg transition-opacity duration-200\",\n {\n variants: {\n variant: {\n default: \"bg-popover text-popover-foreground border border-border\",\n light: \"bg-popover text-popover-foreground border border-border\",\n dark: \"bg-popover text-popover-foreground border border-border\",\n success: \"bg-success text-success-foreground\",\n warning: \"bg-warning text-warning-foreground\",\n error: \"bg-destructive text-destructive-foreground\",\n info: \"bg-info text-info-foreground\",\n },\n size: {\n sm: \"text-xs px-2 py-1\",\n md: \"text-sm px-3 py-2\",\n lg: \"text-base px-4 py-3\",\n },\n placement: {\n top: \"bottom-full left-1/2 -translate-x-1/2 mb-2\",\n \"top-start\": \"bottom-full left-0 mb-2\",\n \"top-end\": \"bottom-full right-0 mb-2\",\n bottom: \"top-full left-1/2 -translate-x-1/2 mt-2\",\n \"bottom-start\": \"top-full left-0 mt-2\",\n \"bottom-end\": \"top-full right-0 mt-2\",\n left: \"right-full top-1/2 -translate-y-1/2 mr-2\",\n \"left-start\": \"right-full top-0 mr-2\",\n \"left-end\": \"right-full bottom-0 mr-2\",\n right: \"left-full top-1/2 -translate-y-1/2 ml-2\",\n \"right-start\": \"left-full top-0 ml-2\",\n \"right-end\": \"left-full bottom-0 ml-2\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"md\",\n placement: \"top\",\n },\n },\n);\n\nconst arrowVariants = cva(\"absolute w-2 h-2 rotate-45\", {\n variants: {\n variant: {\n default: \"bg-popover border border-border\",\n light: \"bg-popover border border-border\",\n dark: \"bg-popover border border-border\",\n success: \"bg-success-500\",\n warning: \"bg-warning-500\",\n error: \"bg-destructive\",\n info: \"bg-info-500\",\n },\n placement: {\n top: \"top-full left-1/2 -translate-x-1/2 -translate-y-1/2\",\n \"top-start\": \"top-full left-4 -translate-y-1/2\",\n \"top-end\": \"top-full right-4 -translate-y-1/2\",\n bottom: \"bottom-full left-1/2 -translate-x-1/2 translate-y-1/2\",\n \"bottom-start\": \"bottom-full left-4 translate-y-1/2\",\n \"bottom-end\": \"bottom-full right-4 translate-y-1/2\",\n left: \"left-full top-1/2 -translate-x-1/2 -translate-y-1/2\",\n \"left-start\": \"left-full top-4 -translate-x-1/2\",\n \"left-end\": \"left-full bottom-4 -translate-x-1/2\",\n right: \"right-full top-1/2 translate-x-1/2 -translate-y-1/2\",\n \"right-start\": \"right-full top-4 translate-x-1/2\",\n \"right-end\": \"right-full bottom-4 translate-x-1/2\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n placement: \"top\",\n },\n});\n\n// Types\nexport interface TooltipProps extends VariantProps<typeof tooltipVariants> {\n children: React.ReactNode;\n /**\n * The tooltip body, for the shorthand form:\n * `<Tooltip content=\"...\"> <button /></Tooltip>`.\n *\n * Optional, because `TooltipTrigger` and `TooltipContent` are exported and\n * composing them is the other supported form - and the one the docs show. It\n * was required, which meant the composed form did not type-check at all.\n */\n content?: React.ReactNode;\n trigger?: \"hover\" | \"click\" | \"focus\" | \"manual\";\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n delayDuration?: number;\n skipDelayDuration?: number;\n disabled?: boolean;\n className?: string;\n contentClassName?: string;\n sideOffset?: number;\n alignOffset?: number;\n avoidCollisions?: boolean;\n collisionBoundary?: Element | null;\n collisionPadding?: number;\n hideWhenDetached?: boolean;\n sticky?: \"partial\" | \"always\";\n updatePositionDeps?: React.DependencyList;\n closeOnBlur?: boolean;\n}\n\nexport interface TooltipContentProps extends VariantProps<\n typeof tooltipVariants\n> {\n children: React.ReactNode;\n className?: string;\n sideOffset?: number;\n alignOffset?: number;\n avoidCollisions?: boolean;\n collisionBoundary?: Element | null;\n collisionPadding?: number;\n hideWhenDetached?: boolean;\n sticky?: \"partial\" | \"always\";\n updatePositionDeps?: React.DependencyList;\n}\n\nexport interface TooltipTriggerProps extends React.HTMLAttributes<HTMLElement> {\n children: React.ReactNode;\n asChild?: boolean;\n className?: string;\n}\n\n// Tooltip Context\ninterface TooltipContextType {\n open: boolean;\n setOpen: (open: boolean) => void;\n trigger: \"hover\" | \"click\" | \"focus\" | \"manual\";\n delayDuration: number;\n skipDelayDuration: number;\n openNow: () => void;\n closeNow: () => void;\n openWithDelay: () => void;\n closeWithDelay: () => void;\n toggleWithDelay: () => void;\n toggleNow: () => void;\n closeOnBlur: boolean;\n}\n\nconst TooltipContext = React.createContext<TooltipContextType | undefined>(\n undefined,\n);\n\nconst useTooltipContext = () => {\n const context = React.useContext(TooltipContext);\n if (!context) {\n throw new Error(\"Tooltip components must be used within a Tooltip\");\n }\n return context;\n};\n\n// Main Tooltip Component\nconst TooltipComponent = React.forwardRef<HTMLDivElement, TooltipProps>(\n (\n {\n children,\n content,\n trigger = \"hover\",\n open: controlledOpen,\n onOpenChange,\n delayDuration = 700,\n skipDelayDuration = 300,\n disabled = false,\n className,\n contentClassName,\n sideOffset = 4,\n alignOffset = 0,\n avoidCollisions = true,\n collisionBoundary,\n collisionPadding = 8,\n hideWhenDetached = false,\n sticky = \"partial\",\n updatePositionDeps,\n closeOnBlur = true,\n ...props\n },\n ref,\n ) => {\n const [internalOpen, setInternalOpen] = useState(false);\n const delayTimerRef = useRef<number | ReturnType<typeof setTimeout> | null>(\n null,\n );\n const skipDelayTimerRef = useRef<\n number | ReturnType<typeof setTimeout> | null\n >(null);\n\n const isControlled = controlledOpen !== undefined;\n const open = isControlled ? controlledOpen : internalOpen;\n\n const setOpen = useCallback(\n (newOpen: boolean) => {\n if (disabled) return;\n\n if (isControlled) {\n onOpenChange?.(newOpen);\n } else {\n setInternalOpen(newOpen);\n onOpenChange?.(newOpen); // notify i uncontrolled\n }\n },\n [disabled, isControlled, onOpenChange],\n );\n\n // --- Tooltip open/close/toggle helpers ---\n const clearTimers = useCallback(() => {\n if (delayTimerRef.current != null) {\n clearTimeout(delayTimerRef.current);\n delayTimerRef.current = null;\n }\n if (skipDelayTimerRef.current != null) {\n clearTimeout(skipDelayTimerRef.current);\n skipDelayTimerRef.current = null;\n }\n }, []);\n\n const openNow = useCallback(() => {\n clearTimers();\n setOpen(true);\n }, [clearTimers, setOpen]);\n\n const closeNow = useCallback(() => {\n clearTimers();\n setOpen(false);\n }, [clearTimers, setOpen]);\n\n const openWithDelay = useCallback(() => {\n clearTimers();\n if (disabled) return;\n if (delayDuration > 0) {\n delayTimerRef.current = window.setTimeout(() => {\n setOpen(true);\n }, delayDuration);\n } else {\n setOpen(true);\n }\n }, [clearTimers, disabled, delayDuration, setOpen]);\n\n const closeWithDelay = useCallback(() => {\n clearTimers();\n if (skipDelayDuration > 0) {\n skipDelayTimerRef.current = window.setTimeout(() => {\n setOpen(false);\n }, skipDelayDuration);\n } else {\n setOpen(false);\n }\n }, [clearTimers, skipDelayDuration, setOpen]);\n\n const toggleWithDelay = useCallback(() => {\n if (open) {\n closeWithDelay();\n } else {\n openWithDelay();\n }\n }, [open, openWithDelay, closeWithDelay]);\n\n const toggleNow = useCallback(() => {\n if (open) closeNow();\n else openNow();\n }, [open, openNow, closeNow]);\n\n // Cleanup timers on unmount\n useEffect(() => {\n return () => {\n clearTimers();\n };\n }, [clearTimers]);\n\n const contextValue: TooltipContextType = {\n open,\n setOpen,\n trigger,\n delayDuration,\n skipDelayDuration,\n openNow,\n closeNow,\n openWithDelay,\n closeWithDelay,\n toggleWithDelay,\n toggleNow,\n closeOnBlur,\n };\n\n // Only render the TooltipContent when open is true (and no pending close timer),\n // to help guard against duplicate tooltips in StrictMode/rapid toggles.\n //\n // `content !== undefined` matters for the composed form. Without it, opening\n // a `<Tooltip><TooltipTrigger /><TooltipContent /></Tooltip>` rendered this\n // slot too, with `undefined` inside - a second, empty bubble next to the real\n // one. The shorthand and the composed form are now mutually exclusive, which\n // is what they always looked like from the outside.\n const shouldRenderContent = open === true && content !== undefined;\n\n return (\n <TooltipContext.Provider value={contextValue}>\n <div\n ref={ref}\n className={cn(\"relative inline-block\", className)}\n data-open={open}\n {...props}\n >\n {children}\n {shouldRenderContent ? (\n <TooltipContent\n className={contentClassName || \"\"}\n sideOffset={sideOffset}\n alignOffset={alignOffset}\n avoidCollisions={avoidCollisions}\n collisionBoundary={collisionBoundary || null}\n collisionPadding={collisionPadding}\n hideWhenDetached={hideWhenDetached}\n sticky={sticky}\n updatePositionDeps={updatePositionDeps || []}\n variant={props.variant}\n size={props.size}\n placement={props.placement}\n >\n {content}\n </TooltipContent>\n ) : null}\n </div>\n </TooltipContext.Provider>\n );\n },\n);\n\nTooltipComponent.displayName = \"Tooltip\";\n\n// Note: Tooltip memoization and subcomponent attachment happens at end of file\n\n// Tooltip Trigger Component\nexport const TooltipTrigger = React.forwardRef<\n HTMLElement,\n TooltipTriggerProps\n>(({ children, asChild = true, className, ...props }, ref) => {\n const {\n trigger,\n openNow,\n closeNow,\n openWithDelay,\n closeWithDelay,\n toggleNow,\n closeOnBlur,\n } = useTooltipContext();\n const triggerRef = useRef<HTMLElement>(null);\n\n const triggerProps = {\n ref: (node: HTMLElement) => {\n (triggerRef as React.MutableRefObject<HTMLElement | null>).current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n (ref as React.MutableRefObject<HTMLElement | null>).current = node;\n }\n },\n className: cn(className),\n \"data-tooltip-trigger\": true,\n onMouseEnter: (e: React.MouseEvent<HTMLElement>) => {\n // Call external handler first\n props.onMouseEnter?.(e as React.MouseEvent<HTMLElement>);\n if (trigger === \"hover\") {\n openWithDelay();\n }\n },\n onMouseLeave: (e: React.MouseEvent<HTMLElement>) => {\n props.onMouseLeave?.(e as React.MouseEvent<HTMLElement>);\n if (trigger === \"hover\") closeWithDelay();\n },\n onPointerEnter: (e: React.PointerEvent) => {\n // @ts-expect-error - Event handler type compatibility\n props.onPointerEnter?.(e);\n if (trigger === \"hover\") openWithDelay();\n },\n onPointerLeave: (e: React.PointerEvent) => {\n // @ts-expect-error - Event handler type compatibility\n props.onPointerLeave?.(e);\n if (trigger === \"hover\") closeWithDelay();\n },\n onClick: (e: React.MouseEvent) => {\n // @ts-expect-error - Event handler type compatibility\n props.onClick?.(e);\n if (trigger === \"click\") toggleNow();\n },\n onFocus: (e: React.FocusEvent) => {\n // @ts-expect-error - Event handler type compatibility\n props.onFocus?.(e);\n if (trigger === \"focus\") openNow();\n },\n onBlur: (e: React.FocusEvent) => {\n // @ts-expect-error - Event handler type compatibility\n props.onBlur?.(e);\n if (closeOnBlur) closeNow();\n },\n onKeyDown: (e: React.KeyboardEvent) => {\n // @ts-expect-error - Event handler type compatibility\n props.onKeyDown?.(e);\n if (e.key === \"Escape\") closeNow();\n },\n };\n\n if (asChild && React.isValidElement(children)) {\n // eslint-disable-next-line react-hooks/refs -- cloneElement merges triggerProps (incl. ref) onto the child; the ref is not read here\n return React.cloneElement(children, {\n ...(children.props || {}),\n ...triggerProps,\n });\n }\n\n return (\n <span\n {...triggerProps}\n tabIndex={trigger === \"focus\" ? 0 : undefined}\n role={trigger === \"click\" ? \"button\" : undefined}\n >\n {children}\n </span>\n );\n});\n\nTooltipTrigger.displayName = \"TooltipTrigger\";\n\n// Tooltip Content Component\nexport const TooltipContent = React.forwardRef<\n HTMLDivElement,\n TooltipContentProps\n>(\n (\n {\n children,\n variant = \"default\",\n size = \"md\",\n placement = \"top\",\n className,\n sideOffset = 4,\n alignOffset: _alignOffset = 0,\n avoidCollisions = true,\n collisionBoundary: _collisionBoundary,\n collisionPadding = 8,\n hideWhenDetached: _hideWhenDetached = false,\n sticky: _sticky = \"partial\",\n updatePositionDeps,\n ...props\n },\n ref,\n ) => {\n // Read the context directly rather than through useTooltipContext: that\n // throws without a provider, and TooltipContent was usable standalone before\n // this. Absent a Tooltip parent there is nothing to open it, so treat it as\n // shown - which is also what it did previously.\n const open = React.useContext(TooltipContext)?.open ?? true;\n const contentRef = useRef<HTMLDivElement>(null);\n const [position, setPosition] = useState({ top: 0, left: 0 });\n\n const updatePosition = useCallback(() => {\n if (!contentRef.current) return;\n\n const content = contentRef.current;\n const trigger = content.parentElement?.querySelector(\n \"[data-tooltip-trigger]\",\n ) as HTMLElement;\n\n if (!trigger) return;\n\n const triggerRect = trigger.getBoundingClientRect();\n const contentRect = content.getBoundingClientRect();\n const viewport = {\n width: window.innerWidth,\n height: window.innerHeight,\n };\n\n let top = 0;\n let left = 0;\n\n // Calculate position based on placement\n switch (placement) {\n case \"top\":\n top = triggerRect.top - contentRect.height - sideOffset;\n left =\n triggerRect.left + triggerRect.width / 2 - contentRect.width / 2;\n break;\n case \"top-start\":\n top = triggerRect.top - contentRect.height - sideOffset;\n left = triggerRect.left;\n break;\n case \"top-end\":\n top = triggerRect.top - contentRect.height - sideOffset;\n left = triggerRect.right - contentRect.width;\n break;\n case \"bottom\":\n top = triggerRect.bottom + sideOffset;\n left =\n triggerRect.left + triggerRect.width / 2 - contentRect.width / 2;\n break;\n case \"bottom-start\":\n top = triggerRect.bottom + sideOffset;\n left = triggerRect.left;\n break;\n case \"bottom-end\":\n top = triggerRect.bottom + sideOffset;\n left = triggerRect.right - contentRect.width;\n break;\n case \"left\":\n top =\n triggerRect.top + triggerRect.height / 2 - contentRect.height / 2;\n left = triggerRect.left - contentRect.width - sideOffset;\n break;\n case \"left-start\":\n top = triggerRect.top;\n left = triggerRect.left - contentRect.width - sideOffset;\n break;\n case \"left-end\":\n top = triggerRect.bottom - contentRect.height;\n left = triggerRect.left - contentRect.width - sideOffset;\n break;\n case \"right\":\n top =\n triggerRect.top + triggerRect.height / 2 - contentRect.height / 2;\n left = triggerRect.right + sideOffset;\n break;\n case \"right-start\":\n top = triggerRect.top;\n left = triggerRect.right + sideOffset;\n break;\n case \"right-end\":\n top = triggerRect.bottom - contentRect.height;\n left = triggerRect.right + sideOffset;\n break;\n }\n\n // Apply collision detection if enabled\n if (avoidCollisions) {\n // Horizontal collision detection\n if (left < collisionPadding) {\n left = collisionPadding;\n } else if (\n left + contentRect.width >\n viewport.width - collisionPadding\n ) {\n left = viewport.width - contentRect.width - collisionPadding;\n }\n\n // Vertical collision detection\n if (top < collisionPadding) {\n top = collisionPadding;\n } else if (\n top + contentRect.height >\n viewport.height - collisionPadding\n ) {\n top = viewport.height - contentRect.height - collisionPadding;\n }\n }\n\n setPosition({ top, left });\n }, [placement, sideOffset, avoidCollisions, collisionPadding]);\n\n React.useLayoutEffect(() => {\n updatePosition();\n\n const handleResize = () => updatePosition();\n window.addEventListener(\"resize\", handleResize);\n window.addEventListener(\"scroll\", handleResize);\n\n return () => {\n window.removeEventListener(\"resize\", handleResize);\n window.removeEventListener(\"scroll\", handleResize);\n };\n // is a dependency: the box is measured to place it, and measuring\n // it while closed gave a stale position on the first show.\n }, [updatePosition, updatePositionDeps, open]);\n\n return (\n <div\n ref={(node) => {\n (\n contentRef as React.MutableRefObject<HTMLDivElement | null>\n ).current = node;\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n (ref as React.MutableRefObject<HTMLDivElement | null>).current =\n node;\n }\n }}\n role=\"tooltip\"\n data-tooltip-instance=\"nostromo\"\n data-state={open ? \"open\" : \"closed\"}\n aria-hidden={open ? undefined : true}\n className={cn(\n tooltipVariants({ variant, size, placement }),\n // The content never read the open state. `data-open` was written on the\n // wrapper and nothing - no CSS, no conditional render - ever acted on\n // it, so the tooltip was permanently visible, sitting on top of its own\n // trigger. Bound to opacity rather than unmounted so the\n // `transition-opacity` the variants already declare still runs.\n open ? \"opacity-100\" : \"pointer-events-none opacity-0\",\n className,\n )}\n style={{\n position: \"fixed\",\n top: position.top,\n left: position.left,\n zIndex: 50,\n }}\n {...props}\n >\n {children}\n <div className={cn(arrowVariants({ variant, placement }))} />\n </div>\n );\n },\n);\n\nTooltipContent.displayName = \"TooltipContent\";\n\n// Tooltip Provider for global configuration\nexport interface TooltipProviderProps {\n children: React.ReactNode;\n delayDuration?: number;\n skipDelayDuration?: number;\n defaultOpen?: boolean;\n}\n\nexport const TooltipProvider: React.FC<TooltipProviderProps> = ({\n children,\n delayDuration: _delayDuration = 700,\n skipDelayDuration: _skipDelayDuration = 300,\n defaultOpen: _defaultOpen = false,\n}) => {\n return <div data-tooltip-provider>{children}</div>;\n};\n\n// Memoize Tooltip for performance optimization (after all subcomponents are defined)\nconst Tooltip = memo(TooltipComponent) as typeof TooltipComponent & {\n Trigger: typeof TooltipTrigger;\n Content: typeof TooltipContent;\n Provider: typeof TooltipProvider;\n};\n\n// Attach subcomponents to Tooltip for compound component pattern\nTooltip.Trigger = TooltipTrigger;\nTooltip.Content = TooltipContent;\nTooltip.Provider = TooltipProvider;\n\n// Export variants and Tooltip for external use\nexport { Tooltip, tooltipVariants, arrowVariants };\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';var chunk3HKYX26O_cjs=require('../../chunk-3HKYX26O.cjs');require('../../chunk-ITRGJNWL.cjs');Object.defineProperty(exports,"ChartArea",{enumerable:true,get:function(){return chunk3HKYX26O_cjs.l}});Object.defineProperty(exports,"ChartBar",{enumerable:true,get:function(){return chunk3HKYX26O_cjs.j}});Object.defineProperty(exports,"ChartContainer",{enumerable:true,get:function(){return chunk3HKYX26O_cjs.d}});Object.defineProperty(exports,"ChartGrid",{enumerable:true,get:function(){return chunk3HKYX26O_cjs.e}});Object.defineProperty(exports,"ChartLegend",{enumerable:true,get:function(){return chunk3HKYX26O_cjs.i}});Object.defineProperty(exports,"ChartLine",{enumerable:true,get:function(){return chunk3HKYX26O_cjs.k}});Object.defineProperty(exports,"ChartReferenceLine",{enumerable:true,get:function(){return chunk3HKYX26O_cjs.m}});Object.defineProperty(exports,"ChartTooltip",{enumerable:true,get:function(){return chunk3HKYX26O_cjs.h}});Object.defineProperty(exports,"ChartXAxis",{enumerable:true,get:function(){return chunk3HKYX26O_cjs.f}});Object.defineProperty(exports,"ChartYAxis",{enumerable:true,get:function(){return chunk3HKYX26O_cjs.g}});Object.defineProperty(exports,"buildColorMap",{enumerable:true,get:function(){return chunk3HKYX26O_cjs.b}});Object.defineProperty(exports,"chartPalette",{enumerable:true,get:function(){return chunk3HKYX26O_cjs.a}});Object.defineProperty(exports,"resolveSeriesColor",{enumerable:true,get:function(){return chunk3HKYX26O_cjs.c}});//# sourceMappingURL=chart-composable.cjs.map
|
|
3
|
+
//# sourceMappingURL=chart-composable.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"chart-composable.cjs"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Area, Bar, CartesianGrid, Legend, Line, ReferenceLine, Tooltip, XAxis, YAxis } from 'recharts';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A composable chart, alongside the single-shot `<Chart type="..." />`.
|
|
6
|
+
*
|
|
7
|
+
* `Chart` renders one series type from a `dataKeys` array. That shape cannot
|
|
8
|
+
* express a stacked bar, a bar and a line together, a second axis, or a
|
|
9
|
+
* reference line - no amount of new `type` strings fixes it, because the
|
|
10
|
+
* limitation is that a chart is one prop rather than a tree.
|
|
11
|
+
*
|
|
12
|
+
* These pieces are thin wrappers over recharts with the theme applied, so a
|
|
13
|
+
* chart is written the way the rest of the library is:
|
|
14
|
+
*
|
|
15
|
+
* <ChartContainer data={data}>
|
|
16
|
+
* <ChartGrid />
|
|
17
|
+
* <ChartXAxis dataKey="month" />
|
|
18
|
+
* <ChartYAxis />
|
|
19
|
+
* <ChartTooltip />
|
|
20
|
+
* <ChartLegend />
|
|
21
|
+
* <ChartBar dataKey="desktop" stackId="devices" />
|
|
22
|
+
* <ChartBar dataKey="mobile" stackId="devices" />
|
|
23
|
+
* <ChartLine dataKey="target" />
|
|
24
|
+
* </ChartContainer>
|
|
25
|
+
*
|
|
26
|
+
* Wrapping recharts' own components works here, which is worth stating because
|
|
27
|
+
* it did not use to: recharts 2 matched children by identity and silently
|
|
28
|
+
* dropped anything it did not recognise, which is why most wrappers around it
|
|
29
|
+
* re-export the primitives instead. recharts 3 resolves wrapped children -
|
|
30
|
+
* verified by rendering a wrapped Bar and counting `.recharts-bar` nodes - so
|
|
31
|
+
* these can carry defaults rather than making every caller repeat them.
|
|
32
|
+
*
|
|
33
|
+
* `Chart` is untouched and stays supported. This is additive.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* Ordered for distinguishability, same as `Chart`'s: distinct hues first, brand
|
|
37
|
+
* variants last, so a two-series chart is not two neighbouring purples.
|
|
38
|
+
*/
|
|
39
|
+
declare const chartPalette: readonly ["hsl(var(--nostromo-color-brand-500))", "hsl(var(--nostromo-color-info-500))", "hsl(var(--nostromo-color-success-500))", "hsl(var(--nostromo-color-warning-500))", "hsl(var(--nostromo-color-error-500))", "hsl(var(--nostromo-color-brand-300))", "hsl(var(--nostromo-color-info-700))", "hsl(var(--nostromo-color-success-700))"];
|
|
40
|
+
/**
|
|
41
|
+
* Colour is resolved by dataKey rather than by a render-order counter.
|
|
42
|
+
*
|
|
43
|
+
* A counter incremented during render gives a different answer on a re-render
|
|
44
|
+
* and a different one again under StrictMode's double invoke, so a series can
|
|
45
|
+
* change colour for no reason. Walking the tree once per render and mapping
|
|
46
|
+
* dataKey to palette slot is stable: the same chart always assigns the same
|
|
47
|
+
* colours, and a series keeps its colour when a sibling is added after it.
|
|
48
|
+
*
|
|
49
|
+
* Exported so the assignment can be tested directly. recharts draws no geometry
|
|
50
|
+
* under jsdom - the series groups appear but carry no fill - so scraping the SVG
|
|
51
|
+
* for colours asserts nothing, however convincing the selector looks.
|
|
52
|
+
*/
|
|
53
|
+
declare function buildColorMap(children: React.ReactNode, palette: readonly string[]): Map<string, string>;
|
|
54
|
+
/**
|
|
55
|
+
* An explicit `color` wins; otherwise the container's slot; otherwise the first
|
|
56
|
+
* palette entry, so a series rendered outside a ChartContainer still gets a
|
|
57
|
+
* themed colour rather than recharts' off-theme default.
|
|
58
|
+
*
|
|
59
|
+
* Pulled out of the hook so it can be tested without a render - the same reason
|
|
60
|
+
* buildColorMap is exported.
|
|
61
|
+
*/
|
|
62
|
+
declare function resolveSeriesColor(explicit: string | undefined, fromContainer: string | undefined): string;
|
|
63
|
+
interface ChartContainerProps {
|
|
64
|
+
data: ReadonlyArray<Record<string, unknown>>;
|
|
65
|
+
children: React.ReactNode;
|
|
66
|
+
/** Pixel height of the plotting area. */
|
|
67
|
+
height?: number;
|
|
68
|
+
/**
|
|
69
|
+
* Width of the plotting area. Responsive by default; give it a number for a
|
|
70
|
+
* fixed-width chart, or to get real geometry in a jsdom test - recharts lays
|
|
71
|
+
* out at zero there otherwise, and every query for rendered SVG comes back
|
|
72
|
+
* empty while the series groups still exist.
|
|
73
|
+
*/
|
|
74
|
+
width?: number | `${number}%`;
|
|
75
|
+
/** Override the series palette. Series without an explicit colour draw from it in tree order. */
|
|
76
|
+
colors?: readonly string[];
|
|
77
|
+
className?: string;
|
|
78
|
+
ariaLabel?: string;
|
|
79
|
+
}
|
|
80
|
+
declare const ChartContainer: React.ForwardRefExoticComponent<ChartContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
81
|
+
type ChartGridProps = React.ComponentProps<typeof CartesianGrid>;
|
|
82
|
+
declare function ChartGrid(props: ChartGridProps): React.JSX.Element;
|
|
83
|
+
type ChartXAxisProps = React.ComponentProps<typeof XAxis>;
|
|
84
|
+
declare function ChartXAxis(props: ChartXAxisProps): React.JSX.Element;
|
|
85
|
+
type ChartYAxisProps = React.ComponentProps<typeof YAxis>;
|
|
86
|
+
declare function ChartYAxis(props: ChartYAxisProps): React.JSX.Element;
|
|
87
|
+
type ChartTooltipProps = React.ComponentProps<typeof Tooltip>;
|
|
88
|
+
declare function ChartTooltip(props: ChartTooltipProps): React.JSX.Element;
|
|
89
|
+
type ChartLegendProps = React.ComponentProps<typeof Legend>;
|
|
90
|
+
declare function ChartLegend(props: ChartLegendProps): React.JSX.Element;
|
|
91
|
+
interface ChartBarProps extends Omit<React.ComponentProps<typeof Bar>, "fill"> {
|
|
92
|
+
dataKey: string;
|
|
93
|
+
/** Overrides the palette slot this series would otherwise get. */
|
|
94
|
+
color?: string;
|
|
95
|
+
}
|
|
96
|
+
declare function ChartBar({ dataKey, color, ...props }: ChartBarProps): React.JSX.Element;
|
|
97
|
+
interface ChartLineProps extends Omit<React.ComponentProps<typeof Line>, "stroke"> {
|
|
98
|
+
dataKey: string;
|
|
99
|
+
color?: string;
|
|
100
|
+
}
|
|
101
|
+
declare function ChartLine({ dataKey, color, ...props }: ChartLineProps): React.JSX.Element;
|
|
102
|
+
interface ChartAreaProps extends Omit<React.ComponentProps<typeof Area>, "stroke" | "fill"> {
|
|
103
|
+
dataKey: string;
|
|
104
|
+
color?: string;
|
|
105
|
+
}
|
|
106
|
+
declare function ChartArea({ dataKey, color, ...props }: ChartAreaProps): React.JSX.Element;
|
|
107
|
+
type ChartReferenceLineProps = React.ComponentProps<typeof ReferenceLine>;
|
|
108
|
+
declare function ChartReferenceLine(props: ChartReferenceLineProps): React.JSX.Element;
|
|
109
|
+
|
|
110
|
+
export { ChartArea, type ChartAreaProps, ChartBar, type ChartBarProps, ChartContainer, type ChartContainerProps, ChartGrid, type ChartGridProps, ChartLegend, type ChartLegendProps, ChartLine, type ChartLineProps, ChartReferenceLine, type ChartReferenceLineProps, ChartTooltip, type ChartTooltipProps, ChartXAxis, type ChartXAxisProps, ChartYAxis, type ChartYAxisProps, buildColorMap, chartPalette, resolveSeriesColor };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Area, Bar, CartesianGrid, Legend, Line, ReferenceLine, Tooltip, XAxis, YAxis } from 'recharts';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A composable chart, alongside the single-shot `<Chart type="..." />`.
|
|
6
|
+
*
|
|
7
|
+
* `Chart` renders one series type from a `dataKeys` array. That shape cannot
|
|
8
|
+
* express a stacked bar, a bar and a line together, a second axis, or a
|
|
9
|
+
* reference line - no amount of new `type` strings fixes it, because the
|
|
10
|
+
* limitation is that a chart is one prop rather than a tree.
|
|
11
|
+
*
|
|
12
|
+
* These pieces are thin wrappers over recharts with the theme applied, so a
|
|
13
|
+
* chart is written the way the rest of the library is:
|
|
14
|
+
*
|
|
15
|
+
* <ChartContainer data={data}>
|
|
16
|
+
* <ChartGrid />
|
|
17
|
+
* <ChartXAxis dataKey="month" />
|
|
18
|
+
* <ChartYAxis />
|
|
19
|
+
* <ChartTooltip />
|
|
20
|
+
* <ChartLegend />
|
|
21
|
+
* <ChartBar dataKey="desktop" stackId="devices" />
|
|
22
|
+
* <ChartBar dataKey="mobile" stackId="devices" />
|
|
23
|
+
* <ChartLine dataKey="target" />
|
|
24
|
+
* </ChartContainer>
|
|
25
|
+
*
|
|
26
|
+
* Wrapping recharts' own components works here, which is worth stating because
|
|
27
|
+
* it did not use to: recharts 2 matched children by identity and silently
|
|
28
|
+
* dropped anything it did not recognise, which is why most wrappers around it
|
|
29
|
+
* re-export the primitives instead. recharts 3 resolves wrapped children -
|
|
30
|
+
* verified by rendering a wrapped Bar and counting `.recharts-bar` nodes - so
|
|
31
|
+
* these can carry defaults rather than making every caller repeat them.
|
|
32
|
+
*
|
|
33
|
+
* `Chart` is untouched and stays supported. This is additive.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* Ordered for distinguishability, same as `Chart`'s: distinct hues first, brand
|
|
37
|
+
* variants last, so a two-series chart is not two neighbouring purples.
|
|
38
|
+
*/
|
|
39
|
+
declare const chartPalette: readonly ["hsl(var(--nostromo-color-brand-500))", "hsl(var(--nostromo-color-info-500))", "hsl(var(--nostromo-color-success-500))", "hsl(var(--nostromo-color-warning-500))", "hsl(var(--nostromo-color-error-500))", "hsl(var(--nostromo-color-brand-300))", "hsl(var(--nostromo-color-info-700))", "hsl(var(--nostromo-color-success-700))"];
|
|
40
|
+
/**
|
|
41
|
+
* Colour is resolved by dataKey rather than by a render-order counter.
|
|
42
|
+
*
|
|
43
|
+
* A counter incremented during render gives a different answer on a re-render
|
|
44
|
+
* and a different one again under StrictMode's double invoke, so a series can
|
|
45
|
+
* change colour for no reason. Walking the tree once per render and mapping
|
|
46
|
+
* dataKey to palette slot is stable: the same chart always assigns the same
|
|
47
|
+
* colours, and a series keeps its colour when a sibling is added after it.
|
|
48
|
+
*
|
|
49
|
+
* Exported so the assignment can be tested directly. recharts draws no geometry
|
|
50
|
+
* under jsdom - the series groups appear but carry no fill - so scraping the SVG
|
|
51
|
+
* for colours asserts nothing, however convincing the selector looks.
|
|
52
|
+
*/
|
|
53
|
+
declare function buildColorMap(children: React.ReactNode, palette: readonly string[]): Map<string, string>;
|
|
54
|
+
/**
|
|
55
|
+
* An explicit `color` wins; otherwise the container's slot; otherwise the first
|
|
56
|
+
* palette entry, so a series rendered outside a ChartContainer still gets a
|
|
57
|
+
* themed colour rather than recharts' off-theme default.
|
|
58
|
+
*
|
|
59
|
+
* Pulled out of the hook so it can be tested without a render - the same reason
|
|
60
|
+
* buildColorMap is exported.
|
|
61
|
+
*/
|
|
62
|
+
declare function resolveSeriesColor(explicit: string | undefined, fromContainer: string | undefined): string;
|
|
63
|
+
interface ChartContainerProps {
|
|
64
|
+
data: ReadonlyArray<Record<string, unknown>>;
|
|
65
|
+
children: React.ReactNode;
|
|
66
|
+
/** Pixel height of the plotting area. */
|
|
67
|
+
height?: number;
|
|
68
|
+
/**
|
|
69
|
+
* Width of the plotting area. Responsive by default; give it a number for a
|
|
70
|
+
* fixed-width chart, or to get real geometry in a jsdom test - recharts lays
|
|
71
|
+
* out at zero there otherwise, and every query for rendered SVG comes back
|
|
72
|
+
* empty while the series groups still exist.
|
|
73
|
+
*/
|
|
74
|
+
width?: number | `${number}%`;
|
|
75
|
+
/** Override the series palette. Series without an explicit colour draw from it in tree order. */
|
|
76
|
+
colors?: readonly string[];
|
|
77
|
+
className?: string;
|
|
78
|
+
ariaLabel?: string;
|
|
79
|
+
}
|
|
80
|
+
declare const ChartContainer: React.ForwardRefExoticComponent<ChartContainerProps & React.RefAttributes<HTMLDivElement>>;
|
|
81
|
+
type ChartGridProps = React.ComponentProps<typeof CartesianGrid>;
|
|
82
|
+
declare function ChartGrid(props: ChartGridProps): React.JSX.Element;
|
|
83
|
+
type ChartXAxisProps = React.ComponentProps<typeof XAxis>;
|
|
84
|
+
declare function ChartXAxis(props: ChartXAxisProps): React.JSX.Element;
|
|
85
|
+
type ChartYAxisProps = React.ComponentProps<typeof YAxis>;
|
|
86
|
+
declare function ChartYAxis(props: ChartYAxisProps): React.JSX.Element;
|
|
87
|
+
type ChartTooltipProps = React.ComponentProps<typeof Tooltip>;
|
|
88
|
+
declare function ChartTooltip(props: ChartTooltipProps): React.JSX.Element;
|
|
89
|
+
type ChartLegendProps = React.ComponentProps<typeof Legend>;
|
|
90
|
+
declare function ChartLegend(props: ChartLegendProps): React.JSX.Element;
|
|
91
|
+
interface ChartBarProps extends Omit<React.ComponentProps<typeof Bar>, "fill"> {
|
|
92
|
+
dataKey: string;
|
|
93
|
+
/** Overrides the palette slot this series would otherwise get. */
|
|
94
|
+
color?: string;
|
|
95
|
+
}
|
|
96
|
+
declare function ChartBar({ dataKey, color, ...props }: ChartBarProps): React.JSX.Element;
|
|
97
|
+
interface ChartLineProps extends Omit<React.ComponentProps<typeof Line>, "stroke"> {
|
|
98
|
+
dataKey: string;
|
|
99
|
+
color?: string;
|
|
100
|
+
}
|
|
101
|
+
declare function ChartLine({ dataKey, color, ...props }: ChartLineProps): React.JSX.Element;
|
|
102
|
+
interface ChartAreaProps extends Omit<React.ComponentProps<typeof Area>, "stroke" | "fill"> {
|
|
103
|
+
dataKey: string;
|
|
104
|
+
color?: string;
|
|
105
|
+
}
|
|
106
|
+
declare function ChartArea({ dataKey, color, ...props }: ChartAreaProps): React.JSX.Element;
|
|
107
|
+
type ChartReferenceLineProps = React.ComponentProps<typeof ReferenceLine>;
|
|
108
|
+
declare function ChartReferenceLine(props: ChartReferenceLineProps): React.JSX.Element;
|
|
109
|
+
|
|
110
|
+
export { ChartArea, type ChartAreaProps, ChartBar, type ChartBarProps, ChartContainer, type ChartContainerProps, ChartGrid, type ChartGridProps, ChartLegend, type ChartLegendProps, ChartLine, type ChartLineProps, ChartReferenceLine, type ChartReferenceLineProps, ChartTooltip, type ChartTooltipProps, ChartXAxis, type ChartXAxisProps, ChartYAxis, type ChartYAxisProps, buildColorMap, chartPalette, resolveSeriesColor };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
export{l as ChartArea,j as ChartBar,d as ChartContainer,e as ChartGrid,i as ChartLegend,k as ChartLine,m as ChartReferenceLine,h as ChartTooltip,f as ChartXAxis,g as ChartYAxis,b as buildColorMap,a as chartPalette,c as resolveSeriesColor}from'../../chunk-CCNO2VWE.js';import'../../chunk-AC2JBXHQ.js';//# sourceMappingURL=chart-composable.js.map
|
|
3
|
+
//# sourceMappingURL=chart-composable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"chart-composable.js"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
'use strict';var
|
|
2
|
+
'use strict';var chunkZ7WEJ5IQ_cjs=require('../../chunk-Z7WEJ5IQ.cjs');require('../../chunk-7SPPGTBT.cjs'),require('../../chunk-ITRGJNWL.cjs');Object.defineProperty(exports,"Tooltip",{enumerable:true,get:function(){return chunkZ7WEJ5IQ_cjs.f}});Object.defineProperty(exports,"TooltipContent",{enumerable:true,get:function(){return chunkZ7WEJ5IQ_cjs.d}});Object.defineProperty(exports,"TooltipProvider",{enumerable:true,get:function(){return chunkZ7WEJ5IQ_cjs.e}});Object.defineProperty(exports,"TooltipTrigger",{enumerable:true,get:function(){return chunkZ7WEJ5IQ_cjs.c}});Object.defineProperty(exports,"arrowVariants",{enumerable:true,get:function(){return chunkZ7WEJ5IQ_cjs.b}});Object.defineProperty(exports,"tooltipVariants",{enumerable:true,get:function(){return chunkZ7WEJ5IQ_cjs.a}});//# sourceMappingURL=tooltip.cjs.map
|
|
3
3
|
//# sourceMappingURL=tooltip.cjs.map
|
|
@@ -13,7 +13,15 @@ declare const arrowVariants: (props?: ({
|
|
|
13
13
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
14
14
|
interface TooltipProps extends VariantProps<typeof tooltipVariants> {
|
|
15
15
|
children: React__default.ReactNode;
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* The tooltip body, for the shorthand form:
|
|
18
|
+
* `<Tooltip content="..."> <button /></Tooltip>`.
|
|
19
|
+
*
|
|
20
|
+
* Optional, because `TooltipTrigger` and `TooltipContent` are exported and
|
|
21
|
+
* composing them is the other supported form - and the one the docs show. It
|
|
22
|
+
* was required, which meant the composed form did not type-check at all.
|
|
23
|
+
*/
|
|
24
|
+
content?: React__default.ReactNode;
|
|
17
25
|
trigger?: "hover" | "click" | "focus" | "manual";
|
|
18
26
|
open?: boolean;
|
|
19
27
|
onOpenChange?: (open: boolean) => void;
|