@appcorp/shadcn 2.0.5 → 2.0.6

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.
@@ -1 +1 @@
1
- "use strict";"use client";import*as e from"react";import{Area as x,AreaChart as D,CartesianGrid as k,XAxis as v,YAxis as w}from"recharts";import{Card as S,CardContent as L,CardDescription as T,CardHeader as b,CardTitle as N}from"../../components/ui/card";import{ChartContainer as $,ChartLegend as A,ChartLegendContent as M,ChartTooltip as V,ChartTooltipContent as G}from"../../components/ui/chart";import{Select as R,SelectContent as F,SelectItem as I,SelectTrigger as K,SelectValue as O}from"../../components/ui/select";const H=r=>r.reduce((l,n,o)=>(l[n.toLowerCase()]={label:n,color:`var(--chart-${o+1})`},l),{});export const AreaChartV1=({dates:r,description:l,legends:n,title:o,selectors:d,locale:m="en-US",onSelectorChange:p})=>{const[c,u]=e.useState("30d"),C=H(n),f=t=>{u(t),p(t)},E=e.useMemo(()=>{var t;const h=(t={"7d":7,"30d":30,"90d":90}[c])!==null&&t!==void 0?t:90,s=new Date(r[r.length-1].date),i=new Date(s);i.setDate(s.getDate()-h);const y=i.getTime();return r.filter(g=>new Date(g.date).getTime()>=y)},[r,c]);return e.createElement(S,{className:"pt-0"},e.createElement(b,{className:"flex items-center gap-2 space-y-0 border-b py-5 sm:flex-row"},e.createElement("div",{className:"grid flex-1 gap-1"},e.createElement(N,null,o),e.createElement(T,null,l)),e.createElement(R,{value:c,onValueChange:f},e.createElement(K,{className:"hidden w-40 rounded-lg sm:ml-auto sm:flex","aria-label":"Select a value"},e.createElement(O,{placeholder:"Last 3 months"})),e.createElement(F,{className:"rounded-xl"},d.map(t=>e.createElement(I,{key:t.label,value:t.value},t.label))))),e.createElement(L,{className:"px-2 pt-4 sm:px-6 sm:pt-6"},e.createElement($,{config:C,className:"aspect-auto h-[250px] w-full"},e.createElement(D,{data:E},e.createElement("defs",null,n.map(t=>{const a=t.toLowerCase();return e.createElement("linearGradient",{key:a,id:`fill${t}`,x1:"0",y1:"0",x2:"0",y2:"1"},e.createElement("stop",{offset:"5%",stopColor:`var(--color-${a})`,stopOpacity:.8}),e.createElement("stop",{offset:"95%",stopColor:`var(--color-${a})`,stopOpacity:.1}))})),e.createElement(k,{vertical:!1}),e.createElement(w,{domain:[0,"auto"],hide:!0}),e.createElement(v,{dataKey:"date",tickLine:!1,axisLine:!1,tickMargin:8,minTickGap:32,tickFormatter:t=>new Date(t).toLocaleDateString(m,{month:"short",day:"numeric"})}),e.createElement(V,{cursor:!1,content:e.createElement(G,{labelFormatter:t=>new Date(t).toLocaleDateString(m,{month:"short",day:"numeric"}),indicator:"dot"})}),n.map(t=>{const a=t.toLowerCase();return e.createElement(x,{key:a,dataKey:a,type:"monotone",fill:`url(#fill${t})`,stroke:`var(--color-${a})`,stackId:"a"})}),e.createElement(A,{content:e.createElement(M,null)})))))};
1
+ "use strict";"use client";import*as e from"react";import{Area as k,AreaChart as v,CartesianGrid as w,XAxis as L,YAxis as S}from"recharts";import{Card as T,CardContent as b,CardDescription as M,CardHeader as N,CardTitle as $}from"../../components/ui/card";import{ChartContainer as A,ChartLegend as V,ChartLegendContent as G,ChartTooltip as R,ChartTooltipContent as F}from"../../components/ui/chart";import{Select as I,SelectContent as K,SelectItem as O,SelectTrigger as H,SelectValue as U}from"../../components/ui/select";const X=n=>n.reduce((o,r,l)=>(o[r.toLowerCase()]={label:r,color:`var(--chart-${l+1})`},o),{});export const AreaChartV1=({dates:n,description:o,legends:r,title:l,selectors:u,locale:c="en-US",onSelectorChange:s})=>{const[m,p]=e.useState("30d"),C=e.useMemo(()=>X(r),[r]),f=e.useCallback(t=>{p(t),s(t)},[s]),E=e.useMemo(()=>{var t;const g=(t={"7d":7,"30d":30,"90d":90}[m])!==null&&t!==void 0?t:90,i=new Date(n[n.length-1].date),d=new Date(i);d.setDate(i.getDate()-g);const x=d.getTime();return n.filter(D=>new Date(D.date).getTime()>=x)},[n,m]),h=e.useMemo(()=>e.createElement(F,{labelFormatter:t=>new Date(t).toLocaleDateString(c,{month:"short",day:"numeric"}),indicator:"dot"}),[c]),y=e.useMemo(()=>e.createElement(G,null),[]);return e.createElement(T,{className:"pt-0"},e.createElement(N,{className:"flex items-center gap-2 space-y-0 border-b py-5 sm:flex-row"},e.createElement("div",{className:"grid flex-1 gap-1"},e.createElement($,null,l),e.createElement(M,null,o)),e.createElement(I,{value:m,onValueChange:f},e.createElement(H,{className:"hidden w-40 rounded-lg sm:ml-auto sm:flex","aria-label":"Select a value"},e.createElement(U,{placeholder:"Last 3 months"})),e.createElement(K,{className:"rounded-xl"},u.map(t=>e.createElement(O,{key:t.label,value:t.value},t.label))))),e.createElement(b,{className:"px-2 pt-4 sm:px-6 sm:pt-6"},e.createElement(A,{config:C,className:"aspect-auto h-[250px] w-full"},e.createElement(v,{data:E},e.createElement("defs",null,r.map(t=>{const a=t.toLowerCase();return e.createElement("linearGradient",{key:a,id:`fill${t}`,x1:"0",y1:"0",x2:"0",y2:"1"},e.createElement("stop",{offset:"5%",stopColor:`var(--color-${a})`,stopOpacity:.8}),e.createElement("stop",{offset:"95%",stopColor:`var(--color-${a})`,stopOpacity:.1}))})),e.createElement(w,{vertical:!1}),e.createElement(S,{domain:[0,"auto"],hide:!0}),e.createElement(L,{dataKey:"date",tickLine:!1,axisLine:!1,tickMargin:8,minTickGap:32,tickFormatter:t=>new Date(t).toLocaleDateString(c,{month:"short",day:"numeric"})}),e.createElement(R,{cursor:!1,content:h}),r.map(t=>{const a=t.toLowerCase();return e.createElement(k,{key:a,dataKey:a,type:"monotone",fill:`url(#fill${t})`,stroke:`var(--color-${a})`,stackId:"a"})}),e.createElement(V,{content:y})))))};
@@ -1,7 +1,2 @@
1
1
  export type { ChartConfig } from "./chart-impl";
2
- export declare const ChartContainer: typeof import("./chart-impl")["ChartContainer"];
3
- export declare const ChartTooltip: typeof import("./chart-impl")["ChartTooltip"];
4
- export declare const ChartTooltipContent: typeof import("./chart-impl")["ChartTooltipContent"];
5
- export declare const ChartLegend: typeof import("./chart-impl")["ChartLegend"];
6
- export declare const ChartLegendContent: typeof import("./chart-impl")["ChartLegendContent"];
7
- export declare const ChartStyle: typeof import("./chart-impl")["ChartStyle"];
2
+ export { ChartContainer, ChartTooltip, ChartTooltipContent, ChartLegend, ChartLegendContent, ChartStyle, } from "./chart-impl";
@@ -1 +1 @@
1
- "use strict";"use client";import*as n from"react";const r=import("./chart-impl"),t=o=>n.lazy(()=>r.then(e=>({default:e[o]})));export const ChartContainer=t("ChartContainer"),ChartTooltip=t("ChartTooltip"),ChartTooltipContent=t("ChartTooltipContent"),ChartLegend=t("ChartLegend"),ChartLegendContent=t("ChartLegendContent"),ChartStyle=t("ChartStyle");
1
+ "use strict";"use client";export{ChartContainer,ChartTooltip,ChartTooltipContent,ChartLegend,ChartLegendContent,ChartStyle}from"./chart-impl";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/shadcn",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "license": "MIT",
5
5
  "author": "Taimoor Khan <taimoor.m.k@live.com>",
6
6
  "repository": "https://github.com/app-corp/shadcn",