@jarllyng/nostromo 3.3.1 → 3.5.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/animations.css +144 -0
- package/dist/chunk-3FY7LZ3B.js +3 -0
- package/dist/chunk-3FY7LZ3B.js.map +1 -0
- 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-E53C3RDD.cjs +3 -0
- package/dist/chunk-E53C3RDD.cjs.map +1 -0
- package/dist/chunk-EEGXD4HC.cjs +3 -0
- package/dist/chunk-EEGXD4HC.cjs.map +1 -0
- package/dist/chunk-ESUSGG6O.js +3 -0
- package/dist/chunk-ESUSGG6O.js.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/collapsible.cjs +3 -0
- package/dist/components/core/collapsible.cjs.map +1 -0
- package/dist/components/core/collapsible.d.cts +17 -0
- package/dist/components/core/collapsible.d.ts +17 -0
- package/dist/components/core/collapsible.js +3 -0
- package/dist/components/core/collapsible.js.map +1 -0
- package/dist/components/core/popover.cjs +3 -0
- package/dist/components/core/popover.cjs.map +1 -0
- package/dist/components/core/popover.d.cts +39 -0
- package/dist/components/core/popover.d.ts +39 -0
- package/dist/components/core/popover.js +3 -0
- package/dist/components/core/popover.js.map +1 -0
- 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.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/tailwind.css +4 -0
- package/dist/themes/lv-426.css +6 -0
- package/dist/themes/mother.css +6 -0
- package/dist/themes/nostromo.css +6 -0
- package/dist/themes/sulaco.css +6 -0
- package/package.json +31 -5
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enter/exit animation utilities.
|
|
3
|
+
*
|
|
4
|
+
* Dialog, Calendar and Toast have carried `animate-in`, `fade-in-0`,
|
|
5
|
+
* `zoom-in-95` and `slide-in-from-*` in their class lists since they were
|
|
6
|
+
* written, and none of those utilities existed: `tailwindcss-animate` is a
|
|
7
|
+
* Tailwind v3 plugin, this package is CSS-first on v4 with no plugin to
|
|
8
|
+
* register, and nothing defined them here. They were inert strings, so those
|
|
9
|
+
* three components have never actually animated in or out.
|
|
10
|
+
*
|
|
11
|
+
* Written out rather than pulled from `tw-animate-css`, which is the maintained
|
|
12
|
+
* v4 successor. A consumer imports `@jarllyng/nostromo/tailwind.css` from their
|
|
13
|
+
* own project, so a bare `@import "tw-animate-css"` in here would have to
|
|
14
|
+
* resolve from *their* bundler against *our* node_modules - which works with
|
|
15
|
+
* some setups and not others. A published stylesheet should be self-contained.
|
|
16
|
+
*
|
|
17
|
+
* Only the utilities the components actually use are defined. Anything else
|
|
18
|
+
* would be more dead classes, which is the problem being fixed.
|
|
19
|
+
*
|
|
20
|
+
* The per-element variables are `--na-*`, not `--nostromo-*`, on purpose. The
|
|
21
|
+
* consumer CSS contract test asserts that every `--nostromo-*` the generated CSS
|
|
22
|
+
* references is defined as a theme token - that invariant is worth keeping, and
|
|
23
|
+
* these are locals a utility sets for its own keyframe to read, not tokens
|
|
24
|
+
* anyone should theme. `--nostromo-animate-duration` *is* a token, and is
|
|
25
|
+
* declared in all four themes.
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
@keyframes nostromo-enter {
|
|
29
|
+
from {
|
|
30
|
+
opacity: var(--na-enter-opacity, 1);
|
|
31
|
+
transform: translate3d(
|
|
32
|
+
var(--na-enter-translate-x, 0),
|
|
33
|
+
var(--na-enter-translate-y, 0),
|
|
34
|
+
0
|
|
35
|
+
)
|
|
36
|
+
scale3d(
|
|
37
|
+
var(--na-enter-scale, 1),
|
|
38
|
+
var(--na-enter-scale, 1),
|
|
39
|
+
var(--na-enter-scale, 1)
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@keyframes nostromo-exit {
|
|
45
|
+
to {
|
|
46
|
+
opacity: var(--na-exit-opacity, 1);
|
|
47
|
+
transform: translate3d(
|
|
48
|
+
var(--na-exit-translate-x, 0),
|
|
49
|
+
var(--na-exit-translate-y, 0),
|
|
50
|
+
0
|
|
51
|
+
)
|
|
52
|
+
scale3d(
|
|
53
|
+
var(--na-exit-scale, 1),
|
|
54
|
+
var(--na-exit-scale, 1),
|
|
55
|
+
var(--na-exit-scale, 1)
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@utility animate-in {
|
|
61
|
+
animation-name: nostromo-enter;
|
|
62
|
+
animation-duration: var(--nostromo-animate-duration, 150ms);
|
|
63
|
+
animation-fill-mode: both;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@utility animate-out {
|
|
67
|
+
animation-name: nostromo-exit;
|
|
68
|
+
animation-duration: var(--nostromo-animate-duration, 150ms);
|
|
69
|
+
animation-fill-mode: both;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@utility fade-in-* {
|
|
73
|
+
--na-enter-opacity: calc(--value(integer) / 100);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@utility fade-out-* {
|
|
77
|
+
--na-exit-opacity: calc(--value(integer) / 100);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@utility zoom-in-* {
|
|
81
|
+
--na-enter-scale: calc(--value(integer) / 100);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@utility zoom-out-* {
|
|
85
|
+
--na-exit-scale: calc(--value(integer) / 100);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* Direction is the side the element comes *from*, so the sign is inverted
|
|
89
|
+
relative to a translate utility: sliding in from the top starts above. */
|
|
90
|
+
@utility slide-in-from-top-* {
|
|
91
|
+
--na-enter-translate-y: calc(--value(integer) * var(--spacing) * -1);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
@utility slide-in-from-bottom-* {
|
|
95
|
+
--na-enter-translate-y: calc(--value(integer) * var(--spacing));
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@utility slide-in-from-left-* {
|
|
99
|
+
--na-enter-translate-x: calc(--value(integer) * var(--spacing) * -1);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
@utility slide-in-from-right-* {
|
|
103
|
+
--na-enter-translate-x: calc(--value(integer) * var(--spacing));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/* Collapsible and Accordion animate to a height Radix measures at runtime and
|
|
107
|
+
exposes as a custom property on the content element. */
|
|
108
|
+
@keyframes nostromo-collapsible-down {
|
|
109
|
+
from {
|
|
110
|
+
height: 0;
|
|
111
|
+
}
|
|
112
|
+
to {
|
|
113
|
+
height: var(--radix-collapsible-content-height);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@keyframes nostromo-collapsible-up {
|
|
118
|
+
from {
|
|
119
|
+
height: var(--radix-collapsible-content-height);
|
|
120
|
+
}
|
|
121
|
+
to {
|
|
122
|
+
height: 0;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@utility animate-collapsible-down {
|
|
127
|
+
animation: nostromo-collapsible-down var(--nostromo-animate-duration, 150ms)
|
|
128
|
+
ease-out;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@utility animate-collapsible-up {
|
|
132
|
+
animation: nostromo-collapsible-up var(--nostromo-animate-duration, 150ms)
|
|
133
|
+
ease-out;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/* Respect the user's setting. Every animation above is decorative. */
|
|
137
|
+
@media (prefers-reduced-motion: reduce) {
|
|
138
|
+
.animate-in,
|
|
139
|
+
.animate-out,
|
|
140
|
+
.animate-collapsible-down,
|
|
141
|
+
.animate-collapsible-up {
|
|
142
|
+
animation: none;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {a}from'./chunk-AC2JBXHQ.js';import*as o from'react';import*as e from'@radix-ui/react-popover';import {cva}from'class-variance-authority';var l=cva("z-50 rounded-lg border border-border bg-background p-4 text-foreground shadow-lg outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",{variants:{size:{sm:"w-56",default:"w-72",lg:"w-96",auto:"w-auto"}},defaultVariants:{size:"default"}}),c=e.Root,b=e.Trigger,g=e.Anchor,u=e.Close,v=o.forwardRef(({className:t,align:r="center",sideOffset:a$1=8,size:n,...p},s)=>o.createElement(e.Portal,null,o.createElement(e.Content,{ref:s,align:r,sideOffset:a$1,className:a(l({size:n}),t),...p})));v.displayName=e.Content.displayName;var d=o.forwardRef(({className:t,...r},a$1)=>o.createElement(e.Arrow,{ref:a$1,className:a("fill-background",t),...r}));d.displayName=e.Arrow.displayName;export{l as a,c as b,b as c,g as d,u as e,v as f,d as g};//# sourceMappingURL=chunk-3FY7LZ3B.js.map
|
|
3
|
+
//# sourceMappingURL=chunk-3FY7LZ3B.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/core/popover.tsx"],"names":["popoverContentVariants","cva","Popover","PopoverTrigger","PopoverAnchor","PopoverClose","Pop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A,CAAjB,CACC,GAAA,CAAKA,GAAAA,CACL,SAAA,CAAWC,CAAAA,CAAG,iBAAA,CAAmBN,CAAS,CAAA,CACzC,GAAGI,CAAAA,CACN,CACD,EACDG,CAAAA,CAAa,WAAA,CAA+B,CAAA,CAAA,KAAA,CAAM,WAAA","file":"chunk-3FY7LZ3B.js","sourcesContent":["import * as React from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/utils\";\n\n/**\n * `@radix-ui/react-popover` was already a dependency - Calendar mounts its month\n * grid in one - but it was never exposed, so a consumer wanting a popover had to\n * add the package a second time and theme it themselves.\n */\n\nconst popoverContentVariants = cva(\n \"z-50 rounded-lg border border-border bg-background p-4 text-foreground shadow-lg outline-none \" +\n \"data-[state=open]:animate-in data-[state=closed]:animate-out \" +\n \"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 \" +\n \"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 \" +\n \"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 \" +\n \"data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n {\n variants: {\n size: {\n sm: \"w-56\",\n default: \"w-72\",\n lg: \"w-96\",\n auto: \"w-auto\",\n },\n },\n defaultVariants: {\n size: \"default\",\n },\n },\n);\n\nconst Popover = PopoverPrimitive.Root;\nconst PopoverTrigger = PopoverPrimitive.Trigger;\nconst PopoverAnchor = PopoverPrimitive.Anchor;\nconst PopoverClose = PopoverPrimitive.Close;\n\ntype PopoverContentBase = Omit<\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>,\n \"aria-label\" | \"aria-labelledby\"\n> &\n VariantProps<typeof popoverContentVariants>;\n\n/**\n * An accessible name is required, not optional.\n *\n * Radix gives the content `role=\"dialog\"`, and a dialog without a name is an\n * `aria-dialog-name` violation - axe flags it, and a screen reader announces\n * \"dialog\" and nothing else. It is not something a default can solve, because a\n * generic \"Popover\" label is worse than useless. So the type asks for one of the\n * two ways to supply it, which turns a runtime audit finding into a compile\n * error.\n */\nexport type PopoverContentProps = PopoverContentBase &\n (\n | { \"aria-label\": string; \"aria-labelledby\"?: never }\n | { \"aria-labelledby\": string; \"aria-label\"?: never }\n );\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n PopoverContentProps\n>(({ className, align = \"center\", sideOffset = 8, size, ...props }, ref) => (\n // Portalled by default: an un-portalled popover inherits `overflow: hidden`\n // and any stacking context from whatever it happens to be nested in, which is\n // how popovers end up clipped inside cards and tables.\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(popoverContentVariants({ size }), className)}\n {...props}\n />\n </PopoverPrimitive.Portal>\n));\nPopoverContent.displayName = PopoverPrimitive.Content.displayName;\n\nconst PopoverArrow = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Arrow>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Arrow>\n>(({ className, ...props }, ref) => (\n <PopoverPrimitive.Arrow\n ref={ref}\n className={cn(\"fill-background\", className)}\n {...props}\n />\n));\nPopoverArrow.displayName = PopoverPrimitive.Arrow.displayName;\n\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverAnchor,\n PopoverClose,\n PopoverArrow,\n popoverContentVariants,\n};\n"]}
|
|
@@ -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","stroke","Line","paint","Area","ChartReferenceLine","ReferenceLine"],"mappings":"ydAoDO,IAAMA,CAAAA,CAAe,CAC1B,sCAAA,CACA,qCAAA,CACA,wCAAA,CACA,wCAAA,C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AO,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,CAAAA,EAAU,CACvC,GAAI,CAAO,CAAA,CAAA,cAAA,CAAeA,CAAK,CAAA,CAAG,OAClC,IAAMC,CAAAA,CAAOD,CAAAA,CAAM,IAAA,CACnB,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rid,\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
|
+
'use strict';var chunkITRGJNWL_cjs=require('./chunk-ITRGJNWL.cjs'),o=require('react'),e=require('@radix-ui/react-popover'),classVarianceAuthority=require('class-variance-authority');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 o__namespace=/*#__PURE__*/_interopNamespace(o);var e__namespace=/*#__PURE__*/_interopNamespace(e);var l=classVarianceAuthority.cva("z-50 rounded-lg border border-border bg-background p-4 text-foreground shadow-lg outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",{variants:{size:{sm:"w-56",default:"w-72",lg:"w-96",auto:"w-auto"}},defaultVariants:{size:"default"}}),c=e__namespace.Root,b=e__namespace.Trigger,g=e__namespace.Anchor,u=e__namespace.Close,v=o__namespace.forwardRef(({className:t,align:r="center",sideOffset:a=8,size:n,...p},s)=>o__namespace.createElement(e__namespace.Portal,null,o__namespace.createElement(e__namespace.Content,{ref:s,align:r,sideOffset:a,className:chunkITRGJNWL_cjs.a(l({size:n}),t),...p})));v.displayName=e__namespace.Content.displayName;var d=o__namespace.forwardRef(({className:t,...r},a)=>o__namespace.createElement(e__namespace.Arrow,{ref:a,className:chunkITRGJNWL_cjs.a("fill-background",t),...r}));d.displayName=e__namespace.Arrow.displayName;exports.a=l;exports.b=c;exports.c=b;exports.d=g;exports.e=u;exports.f=v;exports.g=d;//# sourceMappingURL=chunk-E53C3RDD.cjs.map
|
|
3
|
+
//# sourceMappingURL=chunk-E53C3RDD.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/core/popover.tsx"],"names":["popoverContentVariants","cva","Popover","e","PopoverTrigger","PopoverAnchor","PopoverClose","PopoverContent","o","className","align","sideOffset","size","props","ref","cn","PopoverArrow"],"mappings":"+kBAWA,IAAMA,CAAAA,CAAyBC,0BAAAA,CAC7B,gbAAA,CAMA,CACE,QAAA,CAAU,CACR,IAAA,CAAM,CACJ,EAAA,CAAI,MAAA,CACJ,OAAA,CAAS,MAAA,CACT,EAAA,CAAI,MAAA,CACJ,IAAA,CAAM,QACR,CACF,CAAA,CACA,gBAAiB,CACf,IAAA,CAAM,SACR,CACF,CACF,CAAA,CAEMC,CAAAA,CAA2BC,YAAA,CAAA,IAAA,CAC3BC,CAAAA,CAAkCD,YAAA,CAAA,OAAA,CAClCE,CAAAA,CAAiCF,YAAA,CAAA,MAAA,CACjCG,CAAAA,CAAgCH,YAAA,CAAA,KAAA,CAwBhCI,CAAAA,CAAuBC,YAAA,CAAA,UAAA,CAG3B,CAAC,CAAE,SAAA,CAAAC,CAAAA,CAAW,KAAA,CAAAC,CAAAA,CAAQ,QAAA,CAAU,UAAA,CAAAC,CAAAA,CAAa,CAAA,CAAG,IAAA,CAAAC,CAAAA,CAAM,GAAGC,CAAM,EAAGC,CAAAA,GAIlEN,YAAA,CAAA,aAAA,CAAkBL,YAAA,CAAA,MAAA,CAAjB,IAAA,CACCK,YAAA,CAAA,aAAA,CAAkBL,YAAA,CAAA,OAAA,CAAjB,CACC,GAAA,CAAKW,CAAAA,CACL,KAAA,CAAOJ,CAAAA,CACP,UAAA,CAAYC,CAAAA,CACZ,SAAA,CAAWI,mBAAAA,CAAGf,CAAAA,CAAuB,CAAE,IAAA,CAAAY,CAAK,CAAC,CAAA,CAAGH,CAAS,CAAA,CACxD,GAAGI,CAAAA,CACN,CACF,CACD,EACDN,CAAAA,CAAe,WAAA,CAA+BJ,qBAAQ,WAAA,CAEtD,IAAMa,CAAAA,CAAqBR,YAAA,CAAA,UAAA,CAGzB,CAAC,CAAE,SAAA,CAAAC,CAAAA,CAAW,GAAGI,CAAM,CAAA,CAAGC,CAAAA,GAC1BN,YAAA,CAAA,aAAA,CAAkBL,YAAA,CAAA,KAAA,CAAjB,CACC,GAAA,CAAKW,CAAAA,CACL,SAAA,CAAWC,mBAAAA,CAAG,iBAAA,CAAmBN,CAAS,CAAA,CACzC,GAAGI,CAAAA,CACN,CACD,EACDG,CAAAA,CAAa,WAAA,CAA+Bb,YAAA,CAAA,KAAA,CAAM,WAAA","file":"chunk-E53C3RDD.cjs","sourcesContent":["import * as React from \"react\";\nimport * as PopoverPrimitive from \"@radix-ui/react-popover\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/utils\";\n\n/**\n * `@radix-ui/react-popover` was already a dependency - Calendar mounts its month\n * grid in one - but it was never exposed, so a consumer wanting a popover had to\n * add the package a second time and theme it themselves.\n */\n\nconst popoverContentVariants = cva(\n \"z-50 rounded-lg border border-border bg-background p-4 text-foreground shadow-lg outline-none \" +\n \"data-[state=open]:animate-in data-[state=closed]:animate-out \" +\n \"data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 \" +\n \"data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 \" +\n \"data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 \" +\n \"data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n {\n variants: {\n size: {\n sm: \"w-56\",\n default: \"w-72\",\n lg: \"w-96\",\n auto: \"w-auto\",\n },\n },\n defaultVariants: {\n size: \"default\",\n },\n },\n);\n\nconst Popover = PopoverPrimitive.Root;\nconst PopoverTrigger = PopoverPrimitive.Trigger;\nconst PopoverAnchor = PopoverPrimitive.Anchor;\nconst PopoverClose = PopoverPrimitive.Close;\n\ntype PopoverContentBase = Omit<\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>,\n \"aria-label\" | \"aria-labelledby\"\n> &\n VariantProps<typeof popoverContentVariants>;\n\n/**\n * An accessible name is required, not optional.\n *\n * Radix gives the content `role=\"dialog\"`, and a dialog without a name is an\n * `aria-dialog-name` violation - axe flags it, and a screen reader announces\n * \"dialog\" and nothing else. It is not something a default can solve, because a\n * generic \"Popover\" label is worse than useless. So the type asks for one of the\n * two ways to supply it, which turns a runtime audit finding into a compile\n * error.\n */\nexport type PopoverContentProps = PopoverContentBase &\n (\n | { \"aria-label\": string; \"aria-labelledby\"?: never }\n | { \"aria-labelledby\": string; \"aria-label\"?: never }\n );\n\nconst PopoverContent = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Content>,\n PopoverContentProps\n>(({ className, align = \"center\", sideOffset = 8, size, ...props }, ref) => (\n // Portalled by default: an un-portalled popover inherits `overflow: hidden`\n // and any stacking context from whatever it happens to be nested in, which is\n // how popovers end up clipped inside cards and tables.\n <PopoverPrimitive.Portal>\n <PopoverPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(popoverContentVariants({ size }), className)}\n {...props}\n />\n </PopoverPrimitive.Portal>\n));\nPopoverContent.displayName = PopoverPrimitive.Content.displayName;\n\nconst PopoverArrow = React.forwardRef<\n React.ElementRef<typeof PopoverPrimitive.Arrow>,\n React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Arrow>\n>(({ className, ...props }, ref) => (\n <PopoverPrimitive.Arrow\n ref={ref}\n className={cn(\"fill-background\", className)}\n {...props}\n />\n));\nPopoverArrow.displayName = PopoverPrimitive.Arrow.displayName;\n\nexport {\n Popover,\n PopoverTrigger,\n PopoverContent,\n PopoverAnchor,\n PopoverClose,\n PopoverArrow,\n popoverContentVariants,\n};\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';var chunkITRGJNWL_cjs=require('./chunk-ITRGJNWL.cjs'),e=require('react'),l=require('@radix-ui/react-collapsible');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 e__namespace=/*#__PURE__*/_interopNamespace(e);var l__namespace=/*#__PURE__*/_interopNamespace(l);var n=l__namespace.Root,C=l__namespace.CollapsibleTrigger,p=e__namespace.forwardRef(({className:o,children:t,...a},s)=>e__namespace.createElement(l__namespace.CollapsibleContent,{ref:s,className:chunkITRGJNWL_cjs.a("overflow-hidden text-foreground","data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down",o),...a},t));p.displayName=l__namespace.CollapsibleContent.displayName;exports.a=n;exports.b=C;exports.c=p;//# sourceMappingURL=chunk-EEGXD4HC.cjs.map
|
|
3
|
+
//# sourceMappingURL=chunk-EEGXD4HC.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/core/collapsible.tsx"],"names":["Collapsible","l","CollapsibleTrigger","CollapsibleContent","e","className","children","props","ref","cn"],"mappings":"whBAcA,IAAMA,EAAmCC,YAAA,CAAA,IAAA,CACnCC,CAAAA,CAA0CD,YAAA,CAAA,kBAAA,CAE1CE,CAAAA,CAA2BC,wBAG/B,CAAC,CAAE,UAAAC,CAAAA,CAAW,QAAA,CAAAC,EAAU,GAAGC,CAAM,CAAA,CAAGC,CAAAA,GACpCJ,2BAAsBH,YAAA,CAAA,kBAAA,CAArB,CACC,IAAKO,CAAAA,CACL,SAAA,CAAWC,oBACT,iCAAA,CACA,uFAAA,CACAJ,CACF,CAAA,CACC,GAAGE,CAAAA,CAAAA,CAEHD,CACH,CACD,EACDH,CAAAA,CAAmB,YACIF,YAAA,CAAA,kBAAA,CAAmB,WAAA","file":"chunk-EEGXD4HC.cjs","sourcesContent":["import * as React from \"react\";\nimport * as CollapsiblePrimitive from \"@radix-ui/react-collapsible\";\nimport { cn } from \"../../lib/utils\";\n\n/**\n * Accordion answers \"one of several sections open at a time\". Collapsible is the\n * single-region case - a filter panel, a sidebar group, a \"show more\" - where\n * there is nothing to coordinate with.\n *\n * The height animation needs Radix's `--radix-collapsible-content-height`, which\n * only exists on the content element, so the transition lives on the wrapper\n * here rather than being left to every caller to rediscover.\n */\n\nconst Collapsible = CollapsiblePrimitive.Root;\nconst CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;\n\nconst CollapsibleContent = React.forwardRef<\n React.ElementRef<typeof CollapsiblePrimitive.CollapsibleContent>,\n React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.CollapsibleContent>\n>(({ className, children, ...props }, ref) => (\n <CollapsiblePrimitive.CollapsibleContent\n ref={ref}\n className={cn(\n \"overflow-hidden text-foreground\",\n \"data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down\",\n className,\n )}\n {...props}\n >\n {children}\n </CollapsiblePrimitive.CollapsibleContent>\n));\nCollapsibleContent.displayName =\n CollapsiblePrimitive.CollapsibleContent.displayName;\n\nexport { Collapsible, CollapsibleTrigger, CollapsibleContent };\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {a}from'./chunk-AC2JBXHQ.js';import*as e from'react';import*as l from'@radix-ui/react-collapsible';var n=l.Root,C=l.CollapsibleTrigger,p=e.forwardRef(({className:o,children:t,...a$1},s)=>e.createElement(l.CollapsibleContent,{ref:s,className:a("overflow-hidden text-foreground","data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down",o),...a$1},t));p.displayName=l.CollapsibleContent.displayName;export{n as a,C as b,p as c};//# sourceMappingURL=chunk-ESUSGG6O.js.map
|
|
3
|
+
//# sourceMappingURL=chunk-ESUSGG6O.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/core/collapsible.tsx"],"names":["Collapsible","CollapsibleTrigger","CollapsibleContent","className","children","props","ref","cn"],"mappings":"0GAcA,IAAMA,EAAmC,CAAA,CAAA,IAAA,CACnCC,CAAAA,CAA0C,CAAA,CAAA,kBAAA,CAE1CC,CAAAA,CAA2B,aAG/B,CAAC,CAAE,UAAAC,CAAAA,CAAW,QAAA,CAAAC,EAAU,GAAGC,GAAM,CAAA,CAAGC,CAAAA,GACpC,gBAAsB,CAAA,CAAA,kBAAA,CAArB,CACC,IAAKA,CAAAA,CACL,SAAA,CAAWC,EACT,iCAAA,CACA,uFAAA,CACAJ,CACF,CAAA,CACC,GAAGE,GAAAA,CAAAA,CAEHD,CACH,CACD,EACDF,CAAAA,CAAmB,YACI,CAAA,CAAA,kBAAA,CAAmB,WAAA","file":"chunk-ESUSGG6O.js","sourcesContent":["import * as React from \"react\";\nimport * as CollapsiblePrimitive from \"@radix-ui/react-collapsible\";\nimport { cn } from \"../../lib/utils\";\n\n/**\n * Accordion answers \"one of several sections open at a time\". Collapsible is the\n * single-region case - a filter panel, a sidebar group, a \"show more\" - where\n * there is nothing to coordinate with.\n *\n * The height animation needs Radix's `--radix-collapsible-content-height`, which\n * only exists on the content element, so the transition lives on the wrapper\n * here rather than being left to every caller to rediscover.\n */\n\nconst Collapsible = CollapsiblePrimitive.Root;\nconst CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;\n\nconst CollapsibleContent = React.forwardRef<\n React.ElementRef<typeof CollapsiblePrimitive.CollapsibleContent>,\n React.ComponentPropsWithoutRef<typeof CollapsiblePrimitive.CollapsibleContent>\n>(({ className, children, ...props }, ref) => (\n <CollapsiblePrimitive.CollapsibleContent\n ref={ref}\n className={cn(\n \"overflow-hidden text-foreground\",\n \"data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down\",\n className,\n )}\n {...props}\n >\n {children}\n </CollapsiblePrimitive.CollapsibleContent>\n));\nCollapsibleContent.displayName =\n CollapsiblePrimitive.CollapsibleContent.displayName;\n\nexport { Collapsible, CollapsibleTrigger, CollapsibleContent };\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"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';var chunkEEGXD4HC_cjs=require('../../chunk-EEGXD4HC.cjs');require('../../chunk-ITRGJNWL.cjs');Object.defineProperty(exports,"Collapsible",{enumerable:true,get:function(){return chunkEEGXD4HC_cjs.a}});Object.defineProperty(exports,"CollapsibleContent",{enumerable:true,get:function(){return chunkEEGXD4HC_cjs.c}});Object.defineProperty(exports,"CollapsibleTrigger",{enumerable:true,get:function(){return chunkEEGXD4HC_cjs.b}});//# sourceMappingURL=collapsible.cjs.map
|
|
3
|
+
//# sourceMappingURL=collapsible.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"collapsible.cjs"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Accordion answers "one of several sections open at a time". Collapsible is the
|
|
6
|
+
* single-region case - a filter panel, a sidebar group, a "show more" - where
|
|
7
|
+
* there is nothing to coordinate with.
|
|
8
|
+
*
|
|
9
|
+
* The height animation needs Radix's `--radix-collapsible-content-height`, which
|
|
10
|
+
* only exists on the content element, so the transition lives on the wrapper
|
|
11
|
+
* here rather than being left to every caller to rediscover.
|
|
12
|
+
*/
|
|
13
|
+
declare const Collapsible: React.ForwardRefExoticComponent<CollapsiblePrimitive.CollapsibleProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
declare const CollapsibleTrigger: React.ForwardRefExoticComponent<CollapsiblePrimitive.CollapsibleTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
15
|
+
declare const CollapsibleContent: React.ForwardRefExoticComponent<Omit<CollapsiblePrimitive.CollapsibleContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
|
|
17
|
+
export { Collapsible, CollapsibleContent, CollapsibleTrigger };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Accordion answers "one of several sections open at a time". Collapsible is the
|
|
6
|
+
* single-region case - a filter panel, a sidebar group, a "show more" - where
|
|
7
|
+
* there is nothing to coordinate with.
|
|
8
|
+
*
|
|
9
|
+
* The height animation needs Radix's `--radix-collapsible-content-height`, which
|
|
10
|
+
* only exists on the content element, so the transition lives on the wrapper
|
|
11
|
+
* here rather than being left to every caller to rediscover.
|
|
12
|
+
*/
|
|
13
|
+
declare const Collapsible: React.ForwardRefExoticComponent<CollapsiblePrimitive.CollapsibleProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
declare const CollapsibleTrigger: React.ForwardRefExoticComponent<CollapsiblePrimitive.CollapsibleTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
15
|
+
declare const CollapsibleContent: React.ForwardRefExoticComponent<Omit<CollapsiblePrimitive.CollapsibleContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
|
|
17
|
+
export { Collapsible, CollapsibleContent, CollapsibleTrigger };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"collapsible.js"}
|