@object-ui/plugin-charts 4.0.11 → 4.0.12

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # @object-ui/plugin-charts
2
2
 
3
+ ## 4.0.12
4
+
5
+ ### Patch Changes
6
+
7
+ - @object-ui/types@4.0.12
8
+ - @object-ui/core@4.0.12
9
+ - @object-ui/i18n@4.0.12
10
+ - @object-ui/react@4.0.12
11
+ - @object-ui/components@4.0.12
12
+
3
13
  ## 4.0.11
4
14
 
5
15
  ### Patch Changes
package/dist/index.js CHANGED
@@ -160,6 +160,11 @@ function H({ id: e, className: t, children: n, config: r, ...i }) {
160
160
  "data-slot": "chart",
161
161
  "data-chart": s,
162
162
  className: K("flex w-full h-[350px] justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground", t),
163
+ style: {
164
+ minHeight: 280,
165
+ minWidth: 0,
166
+ ...i.style
167
+ },
163
168
  ...i,
164
169
  children: [/* @__PURE__ */ b(Te, {
165
170
  id: s,
@@ -1,4 +1,4 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@object-ui/core`),require(`react`),require(`@object-ui/components`),require(`react/jsx-runtime`),require(`recharts`),require(`@object-ui/react`),require(`lucide-react`),require(`@object-ui/i18n`)):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`react/jsx-runtime`,`recharts`,`@object-ui/react`,`lucide-react`,`@object-ui/i18n`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginCharts={},e.ObjectUICore,e.React,e.ObjectUIComponents,e.react_jsx_runtime,e.recharts,e.ObjectUIReact,e.lucide_react,e._object_ui_i18n))})(this,function(e,t,n,r,i,a,o,s,c){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var l=Object.create,u=Object.defineProperty,d=Object.getOwnPropertyDescriptor,f=Object.getOwnPropertyNames,p=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty,h=(e,t)=>()=>(e&&(t=e(e=0)),t),g=(e,t)=>{let n={};for(var r in e)u(n,r,{get:e[r],enumerable:!0});return t||u(n,Symbol.toStringTag,{value:`Module`}),n},_=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=f(t),a=0,o=i.length,s;a<o;a++)s=i[a],!m.call(e,s)&&s!==n&&u(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=d(t,s))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:l(p(e)),_(t||!e||!e.__esModule?u(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var v=g({default:()=>y});function y({data:e=[],dataKey:t=`value`,xAxisKey:n=`name`,height:r=400,className:o=``,color:s=`hsl(var(--primary))`}){return(0,i.jsx)(`div`,{className:`p-2 sm:p-3 md:p-4 rounded-xl border border-border bg-card/40 backdrop-blur-sm shadow-lg shadow-background/5 ${o}`,children:(0,i.jsx)(a.ResponsiveContainer,{width:`100%`,height:r,children:(0,i.jsxs)(a.BarChart,{data:e,margin:{top:10,right:10,left:10,bottom:5},children:[(0,i.jsxs)(`defs`,{children:[(0,i.jsxs)(`linearGradient`,{id:`barGradient`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,i.jsx)(`stop`,{offset:`0%`,stopColor:s,stopOpacity:1}),(0,i.jsx)(`stop`,{offset:`90%`,stopColor:s,stopOpacity:.6}),(0,i.jsx)(`stop`,{offset:`100%`,stopColor:s,stopOpacity:.3})]}),(0,i.jsxs)(`filter`,{id:`glow`,height:`130%`,children:[(0,i.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`3`,result:`blur`}),(0,i.jsx)(`feOffset`,{in:`blur`,dx:`0`,dy:`0`,result:`offsetBlur`}),(0,i.jsx)(`feFlood`,{floodColor:s,floodOpacity:`0.5`,result:`offsetColor`}),(0,i.jsx)(`feComposite`,{in:`offsetColor`,in2:`offsetBlur`,operator:`in`,result:`offsetBlur`}),(0,i.jsxs)(`feMerge`,{children:[(0,i.jsx)(`feMergeNode`,{in:`offsetBlur`}),(0,i.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]})]}),(0,i.jsx)(a.CartesianGrid,{strokeDasharray:`3 3`,stroke:`hsl(var(--border))`,vertical:!1}),(0,i.jsx)(a.XAxis,{dataKey:n,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:12,fontFamily:`monospace`},tickLine:!1,axisLine:{stroke:`hsl(var(--border))`},dy:10}),(0,i.jsx)(a.YAxis,{tick:{fill:`hsl(var(--muted-foreground))`,fontSize:12,fontFamily:`monospace`},tickLine:!1,axisLine:!1}),(0,i.jsx)(a.Tooltip,{cursor:{fill:`hsl(var(--muted))`,opacity:.2},contentStyle:{backgroundColor:`hsl(var(--popover))`,borderColor:`hsl(var(--border))`,color:`hsl(var(--popover-foreground))`,borderRadius:`8px`,fontFamily:`monospace`,boxShadow:`0 4px 6px -1px rgb(0 0 0 / 0.1)`},itemStyle:{color:`hsl(var(--primary))`}}),(0,i.jsx)(a.Legend,{wrapperStyle:{paddingTop:`20px`,fontFamily:`monospace`}}),(0,i.jsx)(a.Bar,{dataKey:t,fill:`url(#barGradient)`,radius:[4,4,0,0],filter:`url(#glow)`,animationDuration:1500})]})})})}var b=h((()=>{}));function x(){let e=n.useContext(O);if(!e)throw Error(`useChart must be used within a <ChartContainer />`);return e}function S({id:e,className:t,children:r,config:o,...s}){let c=n.useId(),l=`chart-${e||c.replace(/:/g,``)}`;return(0,i.jsx)(O.Provider,{value:{config:o},children:(0,i.jsxs)(`div`,{"data-slot":`chart`,"data-chart":l,className:E(`flex w-full h-[350px] justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground`,t),...s,children:[(0,i.jsx)(k,{id:l,config:o}),(0,i.jsx)(a.ResponsiveContainer,{width:`100%`,height:`100%`,children:r})]})})}function C({active:e,payload:t,className:r,indicator:a=`dot`,hideLabel:o=!1,hideIndicator:s=!1,label:c,labelFormatter:l,labelClassName:u,formatter:d,color:f,nameKey:p,labelKey:m}){let{config:h}=x(),g=n.useMemo(()=>{if(o||!t?.length)return null;let[e]=t,n=T(h,e,`${m||e?.dataKey||e?.name||`value`}`),r=!m&&typeof c==`string`?h[c]?.label||c:n?.label;return l?(0,i.jsx)(`div`,{className:E(`font-medium`,u),children:l(r,t)}):r?(0,i.jsx)(`div`,{className:E(`font-medium`,u),children:r}):null},[c,l,t,o,u,h,m]);if(!e||!t?.length)return null;let _=t.length===1&&a!==`dot`;return(0,i.jsxs)(`div`,{className:E(`border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl`,r),children:[_?null:g,(0,i.jsx)(`div`,{className:`grid gap-1.5`,children:t.filter(e=>e.type!==`none`).map((e,t)=>{let n=T(h,e,`${p||e.name||e.dataKey||`value`}`),r=f||e.payload.fill||e.color;return(0,i.jsx)(`div`,{className:E(`[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5`,a===`dot`?`items-center`:``),children:d&&e?.value!==void 0&&e.name?d(e.value,e.name,e,t,e.payload):(0,i.jsxs)(i.Fragment,{children:[n?.icon?(0,i.jsx)(n.icon,{}):!s&&(0,i.jsx)(`div`,{className:E(`shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)`,a===`dot`?`h-2.5 w-2.5`:``,a===`line`?`w-1`:``,a===`dashed`?`w-0 border-[1.5px] border-dashed bg-transparent`:``,_&&a===`dashed`?`my-0.5`:``),style:{"--color-bg":r,"--color-border":r}}),(0,i.jsxs)(`div`,{className:E(`flex flex-1 justify-between leading-none`,_?`items-end`:`items-center`),children:[(0,i.jsxs)(`div`,{className:`grid gap-1.5`,children:[_?g:null,(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:n?.label||e.name})]}),e.value&&(0,i.jsx)(`span`,{className:`text-foreground font-mono font-medium tabular-nums`,children:e.value.toLocaleString()})]})]})},e.dataKey)})})]})}function w({className:e,hideIcon:t=!1,payload:n,verticalAlign:r=`bottom`,nameKey:a}){let{config:o}=x();return n?.length?(0,i.jsx)(`div`,{className:E(`flex items-center justify-center gap-4`,r===`top`?`pb-3`:`pt-3`,e),children:n.filter(e=>e.type!==`none`).map(e=>{let n=T(o,e,`${a||e.dataKey||`value`}`);return(0,i.jsxs)(`div`,{className:E(`[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3`),children:[n?.icon&&!t?(0,i.jsx)(n.icon,{}):(0,i.jsx)(`div`,{className:`h-2 w-2 shrink-0 rounded-[2px]`,style:{backgroundColor:e.color}}),n?.label]},e.value)})}):null}function T(e,t,n){if(typeof t!=`object`||!t)return;let r=`payload`in t&&typeof t.payload==`object`&&t.payload!==null?t.payload:void 0,i=n;return n in t&&typeof t[n]==`string`?i=t[n]:r&&n in r&&typeof r[n]==`string`&&(i=r[n]),i in e?e[i]:e[n]}var E,D,O,k,A,j,M=h((()=>{E=(...e)=>e.filter(Boolean).join(` `),D={light:``,dark:`.dark`},O=n.createContext(null),k=({id:e,config:t})=>{let n=Object.entries(t).filter(([,e])=>e.theme||e.color);return n.length?(0,i.jsx)(`style`,{dangerouslySetInnerHTML:{__html:Object.entries(D).map(([t,r])=>`
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@object-ui/core`),require(`react`),require(`@object-ui/components`),require(`react/jsx-runtime`),require(`recharts`),require(`@object-ui/react`),require(`lucide-react`),require(`@object-ui/i18n`)):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`react/jsx-runtime`,`recharts`,`@object-ui/react`,`lucide-react`,`@object-ui/i18n`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginCharts={},e.ObjectUICore,e.React,e.ObjectUIComponents,e.react_jsx_runtime,e.recharts,e.ObjectUIReact,e.lucide_react,e._object_ui_i18n))})(this,function(e,t,n,r,i,a,o,s,c){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var l=Object.create,u=Object.defineProperty,d=Object.getOwnPropertyDescriptor,f=Object.getOwnPropertyNames,p=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty,h=(e,t)=>()=>(e&&(t=e(e=0)),t),g=(e,t)=>{let n={};for(var r in e)u(n,r,{get:e[r],enumerable:!0});return t||u(n,Symbol.toStringTag,{value:`Module`}),n},_=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=f(t),a=0,o=i.length,s;a<o;a++)s=i[a],!m.call(e,s)&&s!==n&&u(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=d(t,s))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:l(p(e)),_(t||!e||!e.__esModule?u(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var v=g({default:()=>y});function y({data:e=[],dataKey:t=`value`,xAxisKey:n=`name`,height:r=400,className:o=``,color:s=`hsl(var(--primary))`}){return(0,i.jsx)(`div`,{className:`p-2 sm:p-3 md:p-4 rounded-xl border border-border bg-card/40 backdrop-blur-sm shadow-lg shadow-background/5 ${o}`,children:(0,i.jsx)(a.ResponsiveContainer,{width:`100%`,height:r,children:(0,i.jsxs)(a.BarChart,{data:e,margin:{top:10,right:10,left:10,bottom:5},children:[(0,i.jsxs)(`defs`,{children:[(0,i.jsxs)(`linearGradient`,{id:`barGradient`,x1:`0`,y1:`0`,x2:`0`,y2:`1`,children:[(0,i.jsx)(`stop`,{offset:`0%`,stopColor:s,stopOpacity:1}),(0,i.jsx)(`stop`,{offset:`90%`,stopColor:s,stopOpacity:.6}),(0,i.jsx)(`stop`,{offset:`100%`,stopColor:s,stopOpacity:.3})]}),(0,i.jsxs)(`filter`,{id:`glow`,height:`130%`,children:[(0,i.jsx)(`feGaussianBlur`,{in:`SourceAlpha`,stdDeviation:`3`,result:`blur`}),(0,i.jsx)(`feOffset`,{in:`blur`,dx:`0`,dy:`0`,result:`offsetBlur`}),(0,i.jsx)(`feFlood`,{floodColor:s,floodOpacity:`0.5`,result:`offsetColor`}),(0,i.jsx)(`feComposite`,{in:`offsetColor`,in2:`offsetBlur`,operator:`in`,result:`offsetBlur`}),(0,i.jsxs)(`feMerge`,{children:[(0,i.jsx)(`feMergeNode`,{in:`offsetBlur`}),(0,i.jsx)(`feMergeNode`,{in:`SourceGraphic`})]})]})]}),(0,i.jsx)(a.CartesianGrid,{strokeDasharray:`3 3`,stroke:`hsl(var(--border))`,vertical:!1}),(0,i.jsx)(a.XAxis,{dataKey:n,tick:{fill:`hsl(var(--muted-foreground))`,fontSize:12,fontFamily:`monospace`},tickLine:!1,axisLine:{stroke:`hsl(var(--border))`},dy:10}),(0,i.jsx)(a.YAxis,{tick:{fill:`hsl(var(--muted-foreground))`,fontSize:12,fontFamily:`monospace`},tickLine:!1,axisLine:!1}),(0,i.jsx)(a.Tooltip,{cursor:{fill:`hsl(var(--muted))`,opacity:.2},contentStyle:{backgroundColor:`hsl(var(--popover))`,borderColor:`hsl(var(--border))`,color:`hsl(var(--popover-foreground))`,borderRadius:`8px`,fontFamily:`monospace`,boxShadow:`0 4px 6px -1px rgb(0 0 0 / 0.1)`},itemStyle:{color:`hsl(var(--primary))`}}),(0,i.jsx)(a.Legend,{wrapperStyle:{paddingTop:`20px`,fontFamily:`monospace`}}),(0,i.jsx)(a.Bar,{dataKey:t,fill:`url(#barGradient)`,radius:[4,4,0,0],filter:`url(#glow)`,animationDuration:1500})]})})})}var b=h((()=>{}));function x(){let e=n.useContext(O);if(!e)throw Error(`useChart must be used within a <ChartContainer />`);return e}function S({id:e,className:t,children:r,config:o,...s}){let c=n.useId(),l=`chart-${e||c.replace(/:/g,``)}`;return(0,i.jsx)(O.Provider,{value:{config:o},children:(0,i.jsxs)(`div`,{"data-slot":`chart`,"data-chart":l,className:E(`flex w-full h-[350px] justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground`,t),style:{minHeight:280,minWidth:0,...s.style},...s,children:[(0,i.jsx)(k,{id:l,config:o}),(0,i.jsx)(a.ResponsiveContainer,{width:`100%`,height:`100%`,children:r})]})})}function C({active:e,payload:t,className:r,indicator:a=`dot`,hideLabel:o=!1,hideIndicator:s=!1,label:c,labelFormatter:l,labelClassName:u,formatter:d,color:f,nameKey:p,labelKey:m}){let{config:h}=x(),g=n.useMemo(()=>{if(o||!t?.length)return null;let[e]=t,n=T(h,e,`${m||e?.dataKey||e?.name||`value`}`),r=!m&&typeof c==`string`?h[c]?.label||c:n?.label;return l?(0,i.jsx)(`div`,{className:E(`font-medium`,u),children:l(r,t)}):r?(0,i.jsx)(`div`,{className:E(`font-medium`,u),children:r}):null},[c,l,t,o,u,h,m]);if(!e||!t?.length)return null;let _=t.length===1&&a!==`dot`;return(0,i.jsxs)(`div`,{className:E(`border-border/50 bg-background grid min-w-[8rem] items-start gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs shadow-xl`,r),children:[_?null:g,(0,i.jsx)(`div`,{className:`grid gap-1.5`,children:t.filter(e=>e.type!==`none`).map((e,t)=>{let n=T(h,e,`${p||e.name||e.dataKey||`value`}`),r=f||e.payload.fill||e.color;return(0,i.jsx)(`div`,{className:E(`[&>svg]:text-muted-foreground flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5`,a===`dot`?`items-center`:``),children:d&&e?.value!==void 0&&e.name?d(e.value,e.name,e,t,e.payload):(0,i.jsxs)(i.Fragment,{children:[n?.icon?(0,i.jsx)(n.icon,{}):!s&&(0,i.jsx)(`div`,{className:E(`shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)`,a===`dot`?`h-2.5 w-2.5`:``,a===`line`?`w-1`:``,a===`dashed`?`w-0 border-[1.5px] border-dashed bg-transparent`:``,_&&a===`dashed`?`my-0.5`:``),style:{"--color-bg":r,"--color-border":r}}),(0,i.jsxs)(`div`,{className:E(`flex flex-1 justify-between leading-none`,_?`items-end`:`items-center`),children:[(0,i.jsxs)(`div`,{className:`grid gap-1.5`,children:[_?g:null,(0,i.jsx)(`span`,{className:`text-muted-foreground`,children:n?.label||e.name})]}),e.value&&(0,i.jsx)(`span`,{className:`text-foreground font-mono font-medium tabular-nums`,children:e.value.toLocaleString()})]})]})},e.dataKey)})})]})}function w({className:e,hideIcon:t=!1,payload:n,verticalAlign:r=`bottom`,nameKey:a}){let{config:o}=x();return n?.length?(0,i.jsx)(`div`,{className:E(`flex items-center justify-center gap-4`,r===`top`?`pb-3`:`pt-3`,e),children:n.filter(e=>e.type!==`none`).map(e=>{let n=T(o,e,`${a||e.dataKey||`value`}`);return(0,i.jsxs)(`div`,{className:E(`[&>svg]:text-muted-foreground flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3`),children:[n?.icon&&!t?(0,i.jsx)(n.icon,{}):(0,i.jsx)(`div`,{className:`h-2 w-2 shrink-0 rounded-[2px]`,style:{backgroundColor:e.color}}),n?.label]},e.value)})}):null}function T(e,t,n){if(typeof t!=`object`||!t)return;let r=`payload`in t&&typeof t.payload==`object`&&t.payload!==null?t.payload:void 0,i=n;return n in t&&typeof t[n]==`string`?i=t[n]:r&&n in r&&typeof r[n]==`string`&&(i=r[n]),i in e?e[i]:e[n]}var E,D,O,k,A,j,M=h((()=>{E=(...e)=>e.filter(Boolean).join(` `),D={light:``,dark:`.dark`},O=n.createContext(null),k=({id:e,config:t})=>{let n=Object.entries(t).filter(([,e])=>e.theme||e.color);return n.length?(0,i.jsx)(`style`,{dangerouslySetInnerHTML:{__html:Object.entries(D).map(([t,r])=>`
2
2
  ${r} [data-chart=${e}] {
3
3
  ${n.map(([e,n])=>{let r=n.theme?.[t]||n.color;return r?` --color-${e}: ${r};`:null}).join(`
4
4
  `)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/plugin-charts",
3
- "version": "4.0.11",
3
+ "version": "4.0.12",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Chart components plugin for Object UI, powered by Recharts",
@@ -24,13 +24,13 @@
24
24
  }
25
25
  },
26
26
  "dependencies": {
27
- "lucide-react": "^1.14.0",
27
+ "lucide-react": "^1.16.0",
28
28
  "recharts": "^3.8.1",
29
- "@object-ui/components": "4.0.11",
30
- "@object-ui/core": "4.0.11",
31
- "@object-ui/i18n": "4.0.11",
32
- "@object-ui/react": "4.0.11",
33
- "@object-ui/types": "4.0.11"
29
+ "@object-ui/components": "4.0.12",
30
+ "@object-ui/core": "4.0.12",
31
+ "@object-ui/i18n": "4.0.12",
32
+ "@object-ui/react": "4.0.12",
33
+ "@object-ui/types": "4.0.12"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": "^18.0.0 || ^19.0.0",
@@ -39,9 +39,9 @@
39
39
  "devDependencies": {
40
40
  "@types/react": "19.2.14",
41
41
  "@types/react-dom": "19.2.3",
42
- "@vitejs/plugin-react": "^6.0.1",
42
+ "@vitejs/plugin-react": "^6.0.2",
43
43
  "typescript": "^6.0.3",
44
- "vite": "^8.0.12",
44
+ "vite": "^8.0.13",
45
45
  "vite-plugin-dts": "^5.0.0"
46
46
  },
47
47
  "keywords": [