@wakastellar/ui 1.0.10 → 2.0.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.
Files changed (149) hide show
  1. package/README.md +163 -193
  2. package/dist/blocks/chat/index.d.ts +2 -0
  3. package/dist/blocks/chat/widget.d.ts +100 -0
  4. package/dist/charts.cjs.js +1 -0
  5. package/dist/charts.es.js +16 -0
  6. package/dist/cn-B-fTneHh.js +1 -0
  7. package/dist/cn-DzRe1GWm.mjs +21 -0
  8. package/dist/components/index.d.ts +122 -0
  9. package/dist/components/waka-3d-pie-chart/index.d.ts +67 -0
  10. package/dist/components/waka-achievement-unlock/index.d.ts +83 -0
  11. package/dist/components/waka-activity-feed/index.d.ts +78 -0
  12. package/dist/components/waka-address-autocomplete/index.d.ts +124 -0
  13. package/dist/components/waka-alert-stack/index.d.ts +58 -0
  14. package/dist/components/waka-allocation-matrix/index.d.ts +193 -0
  15. package/dist/components/waka-approval-chain/index.d.ts +43 -0
  16. package/dist/components/waka-audit-log/index.d.ts +142 -0
  17. package/dist/components/waka-badge-showcase/index.d.ts +51 -0
  18. package/dist/components/waka-biometric-prompt/index.d.ts +84 -0
  19. package/dist/components/waka-bottom-sheet/index.d.ts +61 -0
  20. package/dist/components/waka-breadcrumb-path/index.d.ts +46 -0
  21. package/dist/components/waka-budget-burn/index.d.ts +154 -0
  22. package/dist/components/waka-capacity-planner/index.d.ts +132 -0
  23. package/dist/components/waka-cart-summary/index.d.ts +154 -0
  24. package/dist/components/waka-challenge-timer/index.d.ts +86 -0
  25. package/dist/components/waka-chat-bubble/index.d.ts +127 -0
  26. package/dist/components/waka-checklist/index.d.ts +123 -0
  27. package/dist/components/waka-checkout-stepper/index.d.ts +154 -0
  28. package/dist/components/waka-cohort-table/index.d.ts +130 -0
  29. package/dist/components/waka-combo-counter/index.d.ts +53 -0
  30. package/dist/components/waka-command-bar/index.d.ts +45 -0
  31. package/dist/components/waka-compare-period/index.d.ts +122 -0
  32. package/dist/components/waka-connection-matrix/index.d.ts +117 -0
  33. package/dist/components/waka-contribution-graph/index.d.ts +34 -0
  34. package/dist/components/waka-cost-breakdown/index.d.ts +50 -0
  35. package/dist/components/waka-coupon-input/index.d.ts +105 -0
  36. package/dist/components/waka-credit-card-input/index.d.ts +95 -0
  37. package/dist/components/waka-daily-reward/index.d.ts +76 -0
  38. package/dist/components/waka-deployment-lane/index.d.ts +43 -0
  39. package/dist/components/waka-device-trust/index.d.ts +95 -0
  40. package/dist/components/waka-dock/index.d.ts +44 -0
  41. package/dist/components/waka-empty-state/index.d.ts +85 -0
  42. package/dist/components/waka-error-shake/index.d.ts +49 -0
  43. package/dist/components/waka-feature-announcement/index.d.ts +112 -0
  44. package/dist/components/waka-floating-nav/index.d.ts +51 -0
  45. package/dist/components/waka-flow-diagram/index.d.ts +71 -0
  46. package/dist/components/waka-funnel-chart/index.d.ts +108 -0
  47. package/dist/components/waka-glow-card/index.d.ts +32 -0
  48. package/dist/components/waka-goal-progress/index.d.ts +139 -0
  49. package/dist/components/waka-haptic-button/index.d.ts +45 -0
  50. package/dist/components/waka-health-pulse/index.d.ts +28 -0
  51. package/dist/components/waka-heatmap/index.d.ts +135 -0
  52. package/dist/components/waka-hotspot/index.d.ts +106 -0
  53. package/dist/components/waka-incident-timeline/index.d.ts +38 -0
  54. package/dist/components/waka-invoice-preview/index.d.ts +137 -0
  55. package/dist/components/waka-kpi-dashboard/index.d.ts +80 -0
  56. package/dist/components/waka-leaderboard/index.d.ts +85 -0
  57. package/dist/components/waka-level-progress/index.d.ts +89 -0
  58. package/dist/components/waka-liquid-button/index.d.ts +41 -0
  59. package/dist/components/waka-loading-orbit/index.d.ts +90 -0
  60. package/dist/components/waka-loot-box/index.d.ts +87 -0
  61. package/dist/components/waka-magic-link/index.d.ts +34 -0
  62. package/dist/components/waka-magnetic-button/index.d.ts +56 -0
  63. package/dist/components/waka-mention-input/index.d.ts +106 -0
  64. package/dist/components/waka-metric-sparkline/index.d.ts +46 -0
  65. package/dist/components/waka-milestone-road/index.d.ts +91 -0
  66. package/dist/components/waka-morph-button/index.d.ts +62 -0
  67. package/dist/components/waka-network-topology/index.d.ts +35 -0
  68. package/dist/components/waka-orbital-menu/index.d.ts +61 -0
  69. package/dist/components/waka-order-tracker/index.d.ts +121 -0
  70. package/dist/components/waka-password-strength/index.d.ts +98 -0
  71. package/dist/components/waka-payment-method-picker/index.d.ts +88 -0
  72. package/dist/components/waka-permission-matrix/index.d.ts +197 -0
  73. package/dist/components/waka-phone-input/index.d.ts +93 -0
  74. package/dist/components/waka-pipeline-view/index.d.ts +49 -0
  75. package/dist/components/waka-player-card/index.d.ts +36 -0
  76. package/dist/components/waka-points-popup/index.d.ts +75 -0
  77. package/dist/components/waka-power-up/index.d.ts +103 -0
  78. package/dist/components/waka-presence-indicator/index.d.ts +188 -0
  79. package/dist/components/waka-pricing-table/index.d.ts +77 -0
  80. package/dist/components/waka-product-card/index.d.ts +81 -0
  81. package/dist/components/waka-progress-onboarding/index.d.ts +97 -0
  82. package/dist/components/waka-pull-to-refresh/index.d.ts +45 -0
  83. package/dist/components/waka-quest-card/index.d.ts +110 -0
  84. package/dist/components/waka-quota-bar/index.d.ts +100 -0
  85. package/dist/components/waka-radar-score/index.d.ts +95 -0
  86. package/dist/components/waka-rank-badge/index.d.ts +58 -0
  87. package/dist/components/waka-rating-input/index.d.ts +110 -0
  88. package/dist/components/waka-reaction-picker/index.d.ts +77 -0
  89. package/dist/components/waka-region-map/index.d.ts +27 -0
  90. package/dist/components/waka-resource-gauge/index.d.ts +78 -0
  91. package/dist/components/waka-resource-pool/index.d.ts +81 -0
  92. package/dist/components/waka-rollback-slider/index.d.ts +79 -0
  93. package/dist/components/waka-sankey-diagram/index.d.ts +120 -0
  94. package/dist/components/waka-schedule-picker/index.d.ts +100 -0
  95. package/dist/components/waka-scratch-card/index.d.ts +87 -0
  96. package/dist/components/waka-season-pass/index.d.ts +65 -0
  97. package/dist/components/waka-security-score/index.d.ts +124 -0
  98. package/dist/components/waka-server-rack/index.d.ts +44 -0
  99. package/dist/components/waka-session-manager/index.d.ts +116 -0
  100. package/dist/components/waka-signature-pad/index.d.ts +87 -0
  101. package/dist/components/waka-skeleton-wave/index.d.ts +79 -0
  102. package/dist/components/waka-skill-tree/index.d.ts +78 -0
  103. package/dist/components/waka-sla-tracker/index.d.ts +65 -0
  104. package/dist/components/waka-slider-range/index.d.ts +88 -0
  105. package/dist/components/waka-spin-wheel/index.d.ts +51 -0
  106. package/dist/components/waka-spotlight/index.d.ts +47 -0
  107. package/dist/components/waka-stats-hexagon/index.d.ts +149 -0
  108. package/dist/components/waka-status-matrix/index.d.ts +38 -0
  109. package/dist/components/waka-streak-counter/index.d.ts +27 -0
  110. package/dist/components/waka-success-explosion/index.d.ts +51 -0
  111. package/dist/components/waka-swipe-card/index.d.ts +64 -0
  112. package/dist/components/waka-tabs-morph/index.d.ts +66 -0
  113. package/dist/components/waka-tag-input/index.d.ts +134 -0
  114. package/dist/components/waka-team-banner/index.d.ts +122 -0
  115. package/dist/components/waka-terminal-output/index.d.ts +48 -0
  116. package/dist/components/waka-thread-view/index.d.ts +101 -0
  117. package/dist/components/waka-tilt-card/index.d.ts +36 -0
  118. package/dist/components/waka-tooltip-tour/index.d.ts +118 -0
  119. package/dist/components/waka-tour-guide/index.d.ts +122 -0
  120. package/dist/components/waka-tournament-bracket/index.d.ts +101 -0
  121. package/dist/components/waka-treemap-chart/index.d.ts +104 -0
  122. package/dist/components/waka-two-factor-setup/index.d.ts +93 -0
  123. package/dist/components/waka-typewriter/index.d.ts +98 -0
  124. package/dist/components/waka-typing-indicator/index.d.ts +64 -0
  125. package/dist/components/waka-versus-card/index.d.ts +117 -0
  126. package/dist/components/waka-video-call/index.d.ts +170 -0
  127. package/dist/components/waka-voice-message/index.d.ts +117 -0
  128. package/dist/components/waka-welcome-modal/index.d.ts +120 -0
  129. package/dist/components/waka-xp-bar/index.d.ts +54 -0
  130. package/dist/export.cjs.js +1 -0
  131. package/dist/export.d.ts +3 -1
  132. package/dist/export.es.js +5 -0
  133. package/dist/index-B9GTFkji.js +1 -0
  134. package/dist/index-c0jcWyEL.mjs +466 -0
  135. package/dist/index.cjs.js +2530 -22
  136. package/dist/index.d.ts +1 -0
  137. package/dist/index.es.js +71378 -18523
  138. package/dist/rich-text.cjs.js +1 -0
  139. package/dist/rich-text.es.js +4 -0
  140. package/dist/types-BOWIoR7j.mjs +1111 -0
  141. package/dist/types-D2yCJ91P.js +1 -0
  142. package/dist/useDataTableImport-D8R2HQl6.mjs +229 -0
  143. package/dist/useDataTableImport-S_hhA5Wo.js +9 -0
  144. package/package.json +57 -20
  145. package/src/styles/base.css +108 -0
  146. package/src/styles/code-highlight.css +82 -86
  147. package/src/styles/globals-v3.css +9 -0
  148. package/src/styles/globals.css +57 -74
  149. package/src/styles/tailwind.preset.js +69 -0
@@ -0,0 +1 @@
1
+ "use strict";var he=Object.create;var ie=Object.defineProperty;var me=Object.getOwnPropertyDescriptor;var xe=Object.getOwnPropertyNames;var pe=Object.getPrototypeOf,ge=Object.prototype.hasOwnProperty;var Ce=(e,n,r,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of xe(n))!ge.call(e,i)&&i!==r&&ie(e,i,{get:()=>n[i],enumerable:!(s=me(n,i))||s.enumerable});return e};var be=(e,n,r)=>(r=e!=null?he(pe(e)):{},Ce(n||!e||!e.__esModule?ie(r,"default",{value:e,enumerable:!0}):r,e));const t=require("react/jsx-runtime"),q=require("react"),V=require("./cn-B-fTneHh.js"),re=require("lucide-react");function ye(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:()=>e[r]})}}return n.default=e,Object.freeze(n)}const j=ye(q);function se({className:e,...n}){return t.jsx("div",{className:V.cn("animate-pulse rounded-md bg-muted",e),...n})}function oe(){const[e,n]=q.useState(null),[r,s]=q.useState(!0),[i,k]=q.useState(null);return q.useEffect(()=>{let f=!0;return(async()=>{try{const a=await import("recharts");f&&(n({ResponsiveContainer:a.ResponsiveContainer,BarChart:a.BarChart,LineChart:a.LineChart,AreaChart:a.AreaChart,PieChart:a.PieChart,Bar:a.Bar,Line:a.Line,Area:a.Area,Pie:a.Pie,Cell:a.Cell,XAxis:a.XAxis,YAxis:a.YAxis,CartesianGrid:a.CartesianGrid,Tooltip:a.Tooltip,Legend:a.Legend,defs:"defs",linearGradient:"linearGradient",stop:"stop"}),s(!1))}catch(a){f&&(k(a instanceof Error?a:new Error("Failed to load Recharts")),s(!1))}})(),()=>{f=!1}},[]),{components:e,loading:r,error:i,isAvailable:!r&&!i&&e!==null}}const je=["hsl(var(--chart-1, 220 70% 50%))","hsl(var(--chart-2, 160 60% 45%))","hsl(var(--chart-3, 30 80% 55%))","hsl(var(--chart-4, 280 65% 60%))","hsl(var(--chart-5, 340 75% 55%))"],J={colors:je,gridColor:"hsl(var(--border, 220 13% 91%))",axisColor:"hsl(var(--muted-foreground, 220 9% 46%))",textColor:"hsl(var(--foreground, 224 71% 4%))",tooltipBackground:"hsl(var(--popover, 0 0% 100%))",tooltipText:"hsl(var(--popover-foreground, 224 71% 4%))",tooltipBorder:"hsl(var(--border, 220 13% 91%))",fontFamily:"inherit"};function Q(e,n="default"){const r=q.useMemo(()=>({colors:e?.colors??J.colors,gridColor:e?.gridColor??J.gridColor,axisColor:e?.axisColor??J.axisColor,textColor:e?.textColor??J.textColor,tooltipBackground:e?.tooltipBackground??J.tooltipBackground,tooltipText:e?.tooltipText??J.tooltipText,tooltipBorder:e?.tooltipBorder??J.tooltipBorder,fontFamily:e?.fontFamily??J.fontFamily}),[e]),s=q.useMemo(()=>f=>r.colors[f%r.colors.length],[r.colors]),i=q.useMemo(()=>({contentStyle:{backgroundColor:r.tooltipBackground,color:r.tooltipText,border:`1px solid ${r.tooltipBorder}`,borderRadius:"var(--radius, 0.5rem)",padding:"8px 12px",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",fontFamily:r.fontFamily},wrapperStyle:{outline:"none"},itemStyle:{color:r.tooltipText,padding:"2px 0"},labelStyle:{color:r.textColor,fontWeight:600,marginBottom:"4px"}}),[r]),k=q.useMemo(()=>{const f="relative";switch(n){case"gradient":return`${f} bg-gradient-to-br from-background to-muted/20`;case"outline":return`${f} border border-border rounded-lg p-4`;case"glass":return`${f} bg-background/50 backdrop-blur-sm border border-border/50 rounded-lg p-4`;default:return f}},[n]);return{theme:r,getColor:s,tooltipStyles:i,containerClasses:k}}const ke={sm:{width:"100%",height:150},md:{width:"100%",height:250},lg:{width:"100%",height:350},xl:{width:"100%",height:450},auto:{width:"100%",height:300}},ee=j.forwardRef(({children:e,variant:n="default",size:r="md",height:s,width:i,theme:k,className:f,style:g,title:a,description:h,loading:o,error:u,responsive:c=!0},C)=>{const{components:p,loading:m,error:v,isAvailable:M}=oe(),{containerClasses:L}=Q(k,n),_=o||m,X=u||(v?"Recharts non disponible. Installez recharts pour utiliser les graphiques.":null),D=ke[r],K=i??D.width,T=s??D.height;if(_)return t.jsxs("div",{ref:C,className:V.cn(L,f),style:g,children:[a&&t.jsx(ne,{title:a,description:h}),t.jsx(se,{className:"w-full",style:{height:T}})]});if(X||!M)return t.jsxs("div",{ref:C,className:V.cn(L,f),style:g,children:[a&&t.jsx(ne,{title:a,description:h}),t.jsx("div",{className:"flex items-center justify-center text-muted-foreground text-sm border border-dashed border-border rounded-lg",style:{height:T},children:t.jsxs("div",{className:"text-center p-4",children:[t.jsx("p",{children:X||"Graphique non disponible"}),t.jsx("p",{className:"text-xs mt-1",children:"Installez recharts: pnpm add recharts"})]})})]});const{ResponsiveContainer:O}=p;return t.jsxs("div",{ref:C,className:V.cn(L,f),style:g,children:[a&&t.jsx(ne,{title:a,description:h}),c?t.jsx(O,{width:K,height:T,children:e(p)}):t.jsx("div",{style:{width:K,height:T},children:e(p)})]})});ee.displayName="WakaChart";function ne({title:e,description:n}){return t.jsxs("div",{className:"mb-4",children:[t.jsx("h3",{className:"text-lg font-semibold",children:e}),n&&t.jsx("p",{className:"text-sm text-muted-foreground",children:n})]})}const le=j.forwardRef(({data:e,dataKeys:n,series:r,variant:s="default",size:i="md",height:k,width:f,animation:g=!0,animationDuration:a=500,grid:h=!0,tooltip:o=!0,legend:u,axis:c,theme:C,className:p,style:m,title:v,description:M,loading:L,error:_,onClick:X,responsive:D=!0,layout:K="vertical",stacked:T=!1,radius:O=4,barSize:P,barGap:b=4,barCategoryGap:E="20%"},R)=>{const{theme:A,getColor:G,tooltipStyles:$}=Q(C,s),y=j.useMemo(()=>{if(r&&r.length>0)return r;if(n&&n.length>0)return n.map((d,w)=>({dataKey:d,label:d,color:G(w)}));if(e.length>0&&"value"in e[0])return[{dataKey:"value",label:"Value",color:G(0)}];const x=e[0];return x?Object.keys(x).filter(d=>d!=="name"&&typeof x[d]=="number").map((d,w)=>({dataKey:d,label:d,color:G(w)})):[]},[r,n,e,G]),S=j.useMemo(()=>u?typeof u=="boolean"?{enabled:u,position:"bottom",align:"center"}:u:null,[u]),l=j.useMemo(()=>o?typeof o=="boolean"?{enabled:o}:o:null,[o]);return t.jsx(ee,{ref:R,variant:s,size:i,height:k,width:f,theme:C,className:p,style:m,title:v,description:M,loading:L,error:_,responsive:D,children:x=>{if(!x)return null;const{BarChart:d,Bar:w,XAxis:N,YAxis:W,CartesianGrid:H,Tooltip:I,Legend:F}=x;return t.jsxs(d,{data:e,layout:K==="horizontal"?"vertical":"horizontal",barGap:b,barCategoryGap:E,children:[h&&t.jsx(H,{strokeDasharray:"3 3",stroke:A.gridColor,horizontal:!0,vertical:!1}),c?.showXAxis!==!1&&t.jsx(N,{dataKey:"name",axisLine:{stroke:A.axisColor},tickLine:{stroke:A.axisColor},tick:{fill:A.textColor,fontSize:12},tickFormatter:c?.xAxisFormatter}),c?.showYAxis!==!1&&t.jsx(W,{axisLine:{stroke:A.axisColor},tickLine:{stroke:A.axisColor},tick:{fill:A.textColor,fontSize:12},tickFormatter:c?.yAxisFormatter,domain:c?.yAxisDomain,unit:c?.yAxisUnit}),l?.enabled!==!1&&o&&t.jsx(I,{...$,formatter:l&&typeof l!="boolean"&&l.formatter?(z,U)=>l.formatter(z,U,e[0]):z=>{const U=l&&typeof l!="boolean"&&l.valuePrefix||"",B=l&&typeof l!="boolean"&&l.valueSuffix||"";return`${U}${z}${B}`}}),S?.enabled&&t.jsx(F,{align:S.align,verticalAlign:S.position==="top"?"top":"bottom",wrapperStyle:{paddingTop:S.position==="bottom"?16:0}}),y.map((z,U)=>t.jsx(w,{dataKey:z.dataKey,name:z.label,fill:z.color||G(U),radius:O,stackId:T?"stack":void 0,barSize:P,animationDuration:a,isAnimationActive:g},z.dataKey))]})}})});le.displayName="WakaBarChart";const ce=j.forwardRef(({data:e,dataKeys:n,series:r,variant:s="default",size:i="md",height:k,width:f,animation:g=!0,animationDuration:a=500,grid:h=!0,tooltip:o=!0,legend:u,axis:c,theme:C,className:p,style:m,title:v,description:M,loading:L,error:_,onClick:X,responsive:D=!0,curve:K="monotone",dots:T=!0,dotSize:O=4,activeDot:P=!0,strokeWidth:b=2},E)=>{const{theme:R,getColor:A,tooltipStyles:G}=Q(C,s),$=j.useMemo(()=>{if(r&&r.length>0)return r;if(n&&n.length>0)return n.map((x,d)=>({dataKey:x,label:x,color:A(d),strokeWidth:b}));if(e.length>0&&"value"in e[0])return[{dataKey:"value",label:"Value",color:A(0),strokeWidth:b}];const l=e[0];return l?Object.keys(l).filter(x=>x!=="name"&&typeof l[x]=="number").map((x,d)=>({dataKey:x,label:x,color:A(d),strokeWidth:b})):[]},[r,n,e,A,b]),y=j.useMemo(()=>u?typeof u=="boolean"?{enabled:u,position:"bottom",align:"center"}:u:null,[u]),S=j.useMemo(()=>o?typeof o=="boolean"?{enabled:o}:o:null,[o]);return t.jsx(ee,{ref:E,variant:s,size:i,height:k,width:f,theme:C,className:p,style:m,title:v,description:M,loading:L,error:_,responsive:D,children:l=>{if(!l)return null;const{LineChart:x,Line:d,XAxis:w,YAxis:N,CartesianGrid:W,Tooltip:H,Legend:I}=l;return t.jsxs(x,{data:e,children:[h&&t.jsx(W,{strokeDasharray:"3 3",stroke:R.gridColor,horizontal:!0,vertical:!1}),c?.showXAxis!==!1&&t.jsx(w,{dataKey:"name",axisLine:{stroke:R.axisColor},tickLine:{stroke:R.axisColor},tick:{fill:R.textColor,fontSize:12},tickFormatter:c?.xAxisFormatter}),c?.showYAxis!==!1&&t.jsx(N,{axisLine:{stroke:R.axisColor},tickLine:{stroke:R.axisColor},tick:{fill:R.textColor,fontSize:12},tickFormatter:c?.yAxisFormatter,domain:c?.yAxisDomain,unit:c?.yAxisUnit}),S?.enabled!==!1&&o&&t.jsx(H,{...G,formatter:S&&typeof S!="boolean"&&S.formatter?(F,z)=>S.formatter(F,z,e[0]):F=>{const z=S&&typeof S!="boolean"&&S.valuePrefix||"",U=S&&typeof S!="boolean"&&S.valueSuffix||"";return`${z}${F}${U}`}}),y?.enabled&&t.jsx(I,{align:y.align,verticalAlign:y.position==="top"?"top":"bottom",wrapperStyle:{paddingTop:y.position==="bottom"?16:0}}),$.map((F,z)=>t.jsx(d,{dataKey:F.dataKey,name:F.label,stroke:F.color||A(z),strokeWidth:F.strokeWidth||b,strokeDasharray:F.strokeDasharray,type:K,dot:T?{r:O,fill:F.color||A(z)}:!1,activeDot:P?{r:O+2}:!1,animationDuration:a,isAnimationActive:g},F.dataKey))]})}})});ce.displayName="WakaLineChart";const ue=j.forwardRef(({data:e,dataKeys:n,series:r,variant:s="default",size:i="md",height:k,width:f,animation:g=!0,animationDuration:a=500,grid:h=!0,tooltip:o=!0,legend:u,axis:c,theme:C,className:p,style:m,title:v,description:M,loading:L,error:_,onClick:X,responsive:D=!0,curve:K="monotone",dots:T=!1,dotSize:O=4,activeDot:P=!0,strokeWidth:b=2,stacked:E=!1,fillOpacity:R=.3,gradientDirection:A="vertical"},G)=>{const{theme:$,getColor:y,tooltipStyles:S}=Q(C,s),l=j.useMemo(()=>{if(r&&r.length>0)return r;if(n&&n.length>0)return n.map((N,W)=>({dataKey:N,label:N,color:y(W),strokeWidth:b,fillOpacity:R}));if(e.length>0&&"value"in e[0])return[{dataKey:"value",label:"Value",color:y(0),strokeWidth:b,fillOpacity:R}];const w=e[0];return w?Object.keys(w).filter(N=>N!=="name"&&typeof w[N]=="number").map((N,W)=>({dataKey:N,label:N,color:y(W),strokeWidth:b,fillOpacity:R})):[]},[r,n,e,y,b,R]),x=j.useMemo(()=>u?typeof u=="boolean"?{enabled:u,position:"bottom",align:"center"}:u:null,[u]),d=j.useMemo(()=>o?typeof o=="boolean"?{enabled:o}:o:null,[o]);return t.jsx(ee,{ref:G,variant:s,size:i,height:k,width:f,theme:C,className:p,style:m,title:v,description:M,loading:L,error:_,responsive:D,children:w=>{if(!w)return null;const{AreaChart:N,Area:W,XAxis:H,YAxis:I,CartesianGrid:F,Tooltip:z,Legend:U}=w;return t.jsxs(N,{data:e,children:[t.jsx("defs",{children:l.map((B,Y)=>{const Z=B.color||y(Y),te=`gradient-${B.dataKey}-${Y}`;return t.jsxs("linearGradient",{id:te,x1:"0",y1:"0",x2:A==="horizontal"?"1":"0",y2:A==="horizontal"?"0":"1",children:[t.jsx("stop",{offset:"5%",stopColor:Z,stopOpacity:.8}),t.jsx("stop",{offset:"95%",stopColor:Z,stopOpacity:.1})]},te)})}),h&&t.jsx(F,{strokeDasharray:"3 3",stroke:$.gridColor,horizontal:!0,vertical:!1}),c?.showXAxis!==!1&&t.jsx(H,{dataKey:"name",axisLine:{stroke:$.axisColor},tickLine:{stroke:$.axisColor},tick:{fill:$.textColor,fontSize:12},tickFormatter:c?.xAxisFormatter}),c?.showYAxis!==!1&&t.jsx(I,{axisLine:{stroke:$.axisColor},tickLine:{stroke:$.axisColor},tick:{fill:$.textColor,fontSize:12},tickFormatter:c?.yAxisFormatter,domain:c?.yAxisDomain,unit:c?.yAxisUnit}),d?.enabled!==!1&&o&&t.jsx(z,{...S,formatter:d&&typeof d!="boolean"&&d.formatter?(B,Y)=>d.formatter(B,Y,e[0]):B=>{const Y=d&&typeof d!="boolean"&&d.valuePrefix||"",Z=d&&typeof d!="boolean"&&d.valueSuffix||"";return`${Y}${B}${Z}`}}),x?.enabled&&t.jsx(U,{align:x.align,verticalAlign:x.position==="top"?"top":"bottom",wrapperStyle:{paddingTop:x.position==="bottom"?16:0}}),l.map((B,Y)=>{const Z=B.color||y(Y),te=`gradient-${B.dataKey}-${Y}`;return t.jsx(W,{dataKey:B.dataKey,name:B.label,stroke:Z,strokeWidth:B.strokeWidth||b,fill:`url(#${te})`,fillOpacity:B.fillOpacity??R,type:K,dot:T?{r:O,fill:Z}:!1,stackId:E?"stack":void 0,animationDuration:a,isAnimationActive:g},B.dataKey)})]})}})});ue.displayName="WakaAreaChart";const de=j.forwardRef(({data:e,variant:n="default",size:r="md",height:s,width:i,animation:k=!0,animationDuration:f=500,tooltip:g=!0,legend:a=!0,theme:h,className:o,style:u,title:c,description:C,loading:p,error:m,onClick:v,responsive:M=!0,dataKey:L="value",nameKey:_="name",innerRadius:X=0,outerRadius:D="80%",startAngle:K=90,endAngle:T=-270,paddingAngle:O=2,label:P=!1,labelPosition:b="outside"},E)=>{const{theme:R,getColor:A,tooltipStyles:G}=Q(h,n),$=j.useMemo(()=>a?typeof a=="boolean"?{enabled:a,position:"bottom",align:"center"}:a:null,[a]),y=j.useMemo(()=>g?typeof g=="boolean"?{enabled:g}:g:null,[g]),S=j.useCallback(l=>{if(!P)return null;const x=Math.PI/180,d=b==="inside"?l.innerRadius+(l.outerRadius-l.innerRadius)*.5:l.outerRadius*1.1,w=l.cx+d*Math.cos(-l.midAngle*x),N=l.cy+d*Math.sin(-l.midAngle*x);let W="";return P==="percent"?W=`${(l.percent*100).toFixed(0)}%`:P==="value"?W=String(l.value):P==="name"?W=l.name:W=`${(l.percent*100).toFixed(0)}%`,t.jsx("text",{x:w,y:N,fill:b==="inside"?"#fff":R.textColor,textAnchor:w>l.cx?"start":"end",dominantBaseline:"central",fontSize:12,children:W})},[P,b,R.textColor]);return t.jsx(ee,{ref:E,variant:n,size:r,height:s,width:i,theme:h,className:o,style:u,title:c,description:C,loading:p,error:m,responsive:M,children:l=>{if(!l)return null;const{PieChart:x,Pie:d,Cell:w,Tooltip:N,Legend:W}=l;return t.jsxs(x,{children:[y?.enabled!==!1&&g&&t.jsx(N,{...G,formatter:y&&typeof y!="boolean"&&y.formatter?(H,I)=>y.formatter(H,I,e[0]):H=>{const I=y&&typeof y!="boolean"&&y.valuePrefix||"",F=y&&typeof y!="boolean"&&y.valueSuffix||"";return`${I}${H}${F}`}}),$?.enabled&&t.jsx(W,{align:$.align,verticalAlign:$.position==="top"?"top":"bottom",layout:$.position==="left"||$.position==="right"?"vertical":"horizontal",wrapperStyle:{paddingTop:$.position==="bottom"?16:0}}),t.jsx(d,{data:e,dataKey:L,nameKey:_,cx:"50%",cy:"50%",innerRadius:X,outerRadius:D,startAngle:K,endAngle:T,paddingAngle:O,animationDuration:f,isAnimationActive:k,label:P?S:!1,labelLine:P&&b==="outside",children:e.map((H,I)=>t.jsx(w,{fill:A(I),stroke:"transparent"},`cell-${I}`))})]})}})});de.displayName="WakaPieChart";const ae=j.forwardRef(({data:e,type:n="line",width:r=100,height:s=30,color:i="hsl(var(--chart-1))",fillColor:k,fillOpacity:f=.3,showMinMax:g=!1,showValue:a=!1,className:h,animation:o=!0},u)=>{const{components:c,loading:C,isAvailable:p}=oe(),m=j.useMemo(()=>e.map((b,E)=>({index:E,value:b})),[e]),{min:v,max:M,current:L}=j.useMemo(()=>{const b=e.filter(E=>typeof E=="number"&&!isNaN(E));return{min:Math.min(...b),max:Math.max(...b),current:b[b.length-1]}},[e]);if(C)return t.jsx("div",{ref:u,className:V.cn("inline-flex items-center gap-2",h),children:t.jsx("div",{className:"bg-muted animate-pulse rounded",style:{width:r,height:s}})});if(!p||!c)return t.jsxs("div",{ref:u,className:V.cn("inline-flex items-center gap-2",h),children:[t.jsx(ve,{data:e,width:r,height:s,color:i,type:n,fillColor:k,fillOpacity:f}),a&&t.jsx("span",{className:"text-sm font-medium",children:L})]});const{ResponsiveContainer:_,LineChart:X,BarChart:D,AreaChart:K,Line:T,Bar:O,Area:P}=c;return t.jsxs("div",{ref:u,className:V.cn("inline-flex items-center gap-2",h),children:[t.jsx("div",{style:{width:r,height:s},children:t.jsx(_,{width:"100%",height:"100%",children:n==="bar"?t.jsx(D,{data:m,children:t.jsx(O,{dataKey:"value",fill:i,radius:1,isAnimationActive:o})}):n==="area"?t.jsxs(K,{data:m,children:[t.jsx("defs",{children:t.jsxs("linearGradient",{id:`sparkline-gradient-${i.replace(/[^a-z0-9]/gi,"")}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[t.jsx("stop",{offset:"5%",stopColor:k||i,stopOpacity:.8}),t.jsx("stop",{offset:"95%",stopColor:k||i,stopOpacity:.1})]})}),t.jsx(P,{type:"monotone",dataKey:"value",stroke:i,fill:`url(#sparkline-gradient-${i.replace(/[^a-z0-9]/gi,"")})`,fillOpacity:f,strokeWidth:1.5,dot:!1,isAnimationActive:o})]}):t.jsx(X,{data:m,children:t.jsx(T,{type:"monotone",dataKey:"value",stroke:i,strokeWidth:1.5,dot:!1,isAnimationActive:o})})})}),g&&t.jsxs("div",{className:"flex flex-col text-xs text-muted-foreground",children:[t.jsxs("span",{children:["↑ ",M]}),t.jsxs("span",{children:["↓ ",v]})]}),a&&t.jsx("span",{className:"text-sm font-medium",children:L})]})});ae.displayName="WakaSparkline";function ve({data:e,width:n,height:r,color:s,type:i,fillColor:k,fillOpacity:f}){const a=n-4,h=r-4,o=Math.min(...e),c=Math.max(...e)-o||1,C=e.map((m,v)=>{const M=2+v/(e.length-1||1)*a,L=2+h-(m-o)/c*h;return{x:M,y:L,value:m}});if(i==="bar"){const m=a/e.length-1;return t.jsx("svg",{width:n,height:r,children:e.map((v,M)=>{const L=(v-o)/c*h;return t.jsx("rect",{x:2+M*(m+1),y:2+h-L,width:m,height:L,fill:s,rx:1},M)})})}const p=C.map((m,v)=>`${v===0?"M":"L"} ${m.x} ${m.y}`).join(" ");if(i==="area"){const m=`${p} L ${C[C.length-1].x} ${r-2} L 2 ${r-2} Z`;return t.jsxs("svg",{width:n,height:r,children:[t.jsx("path",{d:m,fill:k||s,fillOpacity:f}),t.jsx("path",{d:p,fill:"none",stroke:s,strokeWidth:1.5})]})}return t.jsx("svg",{width:n,height:r,children:t.jsx("path",{d:p,fill:"none",stroke:s,strokeWidth:1.5})})}const fe=j.forwardRef(({data:e,type:n="sparkline",width:r=80,height:s=24,color:i,showTrend:k=!0,valueFormatter:f,className:g},a)=>{const h=j.useMemo(()=>!e||e.length===0?[]:typeof e[0]=="number"?e:e.map(p=>{const m=p.value??Object.values(p).find(v=>typeof v=="number");return typeof m=="number"?m:0}),[e]),{trend:o,trendPercent:u,currentValue:c}=j.useMemo(()=>{if(h.length<2)return{trend:"neutral",trendPercent:0,currentValue:h[0]??0};const p=h[0],m=h[h.length-1],v=m-p,M=p!==0?v/p*100:0;return{trend:v>0?"up":v<0?"down":"neutral",trendPercent:M,currentValue:m}},[h]),C=j.useMemo(()=>i||(o==="up"?"hsl(var(--chart-2, 142 76% 36%))":o==="down"?"hsl(var(--destructive, 0 84% 60%))":"hsl(var(--muted-foreground, 220 9% 46%))"),[i,o]);return h.length===0?t.jsx("div",{ref:a,className:V.cn("flex items-center gap-1 text-muted-foreground",g),children:t.jsx(re.Minus,{className:"h-3 w-3"})}):(f?f(c):c.toLocaleString(),t.jsxs("div",{ref:a,className:V.cn("flex items-center gap-2",g),children:[t.jsx(ae,{data:h,type:n==="sparkline"?"line":n,width:r,height:s,color:C,animation:!1}),k&&t.jsxs("div",{className:"flex items-center gap-1",children:[o==="up"&&t.jsx(re.TrendingUp,{className:"h-3 w-3 text-green-600 dark:text-green-400"}),o==="down"&&t.jsx(re.TrendingDown,{className:"h-3 w-3 text-red-600 dark:text-red-400"}),o==="neutral"&&t.jsx(re.Minus,{className:"h-3 w-3 text-muted-foreground"}),t.jsxs("span",{className:V.cn("text-xs font-medium",o==="up"&&"text-green-600 dark:text-green-400",o==="down"&&"text-red-600 dark:text-red-400",o==="neutral"&&"text-muted-foreground"),children:[o!=="neutral"&&(u>0?"+":""),u.toFixed(1),"%"]})]})]}))});fe.displayName="WakaMiniChart";function Ae(e){const{accessorKey:n,header:r=String(n),chartType:s="sparkline",width:i=100,height:k=24,color:f,showValue:g=!1,valueFormatter:a}=e;return{accessorKey:n,header:r,size:i+(g?60:0),enableSorting:!1,enableColumnFilter:!1,cell:h=>{const o=h.getValue();let u=[];return Array.isArray(o)&&(typeof o[0]=="number"?u=o:typeof o[0]=="object"&&o[0]!==null&&(u=o.map(c=>{const C=c.value??Object.values(c).find(p=>typeof p=="number");return typeof C=="number"?C:0}))),{type:"chart",chartType:s,data:u,width:i,height:k,color:f,showTrend:!0,valueFormatter:a}},meta:{isChartColumn:!0,chartConfig:e}}}const Se={cell:e=>{if(!Array.isArray(e))return null;let n=[];return typeof e[0]=="number"?n=e:typeof e[0]=="object"&&e[0]!==null&&(n=e.map(r=>{const s=r.value??Object.values(r).find(i=>typeof i=="number");return typeof s=="number"?s:0})),{type:"sparkline",data:n}},size:100,enableSorting:!1,enableFiltering:!1},Le=["hsl(var(--chart-1))","hsl(var(--chart-2))","hsl(var(--chart-3))","hsl(var(--chart-4))","hsl(var(--chart-5))"],we={sm:{width:"100%",height:150},md:{width:"100%",height:250},lg:{width:"100%",height:350},xl:{width:"100%",height:450},auto:{width:"100%",height:300}};exports.CHART_SIZE_MAP=we;exports.DEFAULT_CHART_COLORS=Le;exports.Skeleton=se;exports.WakaAreaChart=ue;exports.WakaBarChart=le;exports.WakaChart=ee;exports.WakaLineChart=ce;exports.WakaMiniChart=fe;exports.WakaPieChart=de;exports.WakaSparkline=ae;exports.createChartColumn=Ae;exports.sparklineTemplate=Se;exports.useChartTheme=Q;exports.useRechartsLoader=oe;
@@ -0,0 +1,229 @@
1
+ import { useMemo as S, useCallback as u } from "react";
2
+ function X({
3
+ data: h,
4
+ columns: i,
5
+ exportConfig: y
6
+ }) {
7
+ const p = S(() => ({
8
+ formats: ["csv", "xlsx", "json"],
9
+ filename: "export",
10
+ includeHeaders: !0,
11
+ ...y
12
+ }), [y]), x = u((e, o) => {
13
+ if (!e.length) return;
14
+ const r = i.filter((a) => a.accessorKey || a.id).map((a) => a.header || a.accessorKey || a.id).join(","), s = e.map((a) => i.filter((n) => n.accessorKey || n.id).map((n) => {
15
+ const f = n.accessorKey ? a[n.accessorKey] : a[n.id], k = n.formatter ? n.formatter(f) : f, L = String(k || "");
16
+ return L.includes(",") || L.includes('"') || L.includes(`
17
+ `) ? `"${L.replace(/"/g, '""')}"` : L;
18
+ }).join(",")), t = [r, ...s].join(`
19
+ `), d = new Blob([t], { type: "text/csv;charset=utf-8;" }), l = document.createElement("a");
20
+ l.href = URL.createObjectURL(d), l.download = `${o || p.filename}.csv`, l.click(), URL.revokeObjectURL(l.href);
21
+ }, [i, p.filename]), b = u((e, o) => {
22
+ const r = JSON.stringify(e, null, 2), s = new Blob([r], { type: "application/json" }), t = document.createElement("a");
23
+ t.href = URL.createObjectURL(s), t.download = `${o || p.filename}.json`, t.click(), URL.revokeObjectURL(t.href);
24
+ }, [p.filename]), v = u(async (e, o) => {
25
+ try {
26
+ if (typeof window > "u")
27
+ throw new Error("XLSX export not available in server environment");
28
+ const r = await import("xlsx"), t = [
29
+ i.filter((a) => a.accessorKey || a.id).map((a) => a.header || a.accessorKey || a.id),
30
+ ...e.map(
31
+ (a) => i.filter((n) => n.accessorKey || n.id).map((n) => {
32
+ const f = n.accessorKey ? a[n.accessorKey] : a[n.id];
33
+ return n.formatter ? n.formatter(f) : f;
34
+ })
35
+ )
36
+ ], d = r.utils.aoa_to_sheet(t), l = r.utils.book_new();
37
+ r.utils.book_append_sheet(l, d, "Sheet1"), r.writeFile(l, `${o || p.filename}.xlsx`);
38
+ } catch (r) {
39
+ throw console.error("Erreur lors de l'export XLSX:", r), new Error("La librairie xlsx n'est pas disponible");
40
+ }
41
+ }, [i, p.filename]), E = u(async (e, o) => {
42
+ try {
43
+ if (typeof window > "u")
44
+ throw new Error("PDF export not available in server environment");
45
+ const r = await import("jspdf"), s = await import("jspdf-autotable"), t = new r.default(), d = i.filter((a) => a.accessorKey || a.id).map((a) => a.header || a.accessorKey || a.id), l = e.map(
46
+ (a) => i.filter((n) => n.accessorKey || n.id).map((n) => {
47
+ const f = n.accessorKey ? a[n.accessorKey] : a[n.id];
48
+ return n.formatter ? n.formatter(f) : f;
49
+ })
50
+ );
51
+ t.autoTable({
52
+ head: [d],
53
+ body: l,
54
+ startY: 20,
55
+ styles: { fontSize: 8 },
56
+ headStyles: { fillColor: [66, 139, 202] }
57
+ }), t.save(`${o || p.filename}.pdf`);
58
+ } catch (r) {
59
+ throw console.error("Erreur lors de l'export PDF:", r), new Error("Les librairies jsPDF et jspdf-autotable ne sont pas disponibles");
60
+ }
61
+ }, [i, p.filename]), w = u((e, o) => {
62
+ const r = i.filter((l) => l.accessorKey || l.id).map((l) => l.accessorKey || l.id);
63
+ let s = `<?xml version="1.0" encoding="UTF-8"?>
64
+ <data>
65
+ `;
66
+ e.forEach((l, a) => {
67
+ s += ` <row id="${a}">
68
+ `, r.forEach((n) => {
69
+ const f = l[n], k = String(f || "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
70
+ s += ` <${n}>${k}</${n}>
71
+ `;
72
+ }), s += ` </row>
73
+ `;
74
+ }), s += "</data>";
75
+ const t = new Blob([s], { type: "application/xml" }), d = document.createElement("a");
76
+ d.href = URL.createObjectURL(t), d.download = `${o || p.filename}.xml`, d.click(), URL.revokeObjectURL(d.href);
77
+ }, [i, p.filename]), m = u(async (e, o, r) => {
78
+ const s = o || h, t = r || p.filename;
79
+ if (p.onExport) {
80
+ p.onExport(s, e);
81
+ return;
82
+ }
83
+ switch (e.toLowerCase()) {
84
+ case "csv":
85
+ x(s, t);
86
+ break;
87
+ case "json":
88
+ b(s, t);
89
+ break;
90
+ case "xlsx":
91
+ await v(s, t);
92
+ break;
93
+ case "pdf":
94
+ await E(s, t);
95
+ break;
96
+ case "xml":
97
+ w(s, t);
98
+ break;
99
+ default:
100
+ throw new Error(`Format d'export non supporté: ${e}`);
101
+ }
102
+ }, [h, p, x, b, v, E, w]), g = u(async (e) => m(e), [m]), c = u(async (e, o) => m(e, o), [m]);
103
+ return {
104
+ exportData: m,
105
+ exportAll: g,
106
+ exportSelected: c,
107
+ supportedFormats: p.formats,
108
+ isExportSupported: (e) => p.formats.includes(e)
109
+ };
110
+ }
111
+ function D({
112
+ importConfig: h
113
+ }) {
114
+ const i = S(() => ({
115
+ accept: ".csv,.xlsx,.json,.xml",
116
+ ...h
117
+ }), [h]), y = u((c, e = ",") => {
118
+ const o = c.split(`
119
+ `).filter((t) => t.trim());
120
+ if (o.length === 0) return [];
121
+ const r = o[0].split(e).map((t) => t.trim().replace(/"/g, ""));
122
+ return o.slice(1).map((t) => {
123
+ const d = t.split(e).map((a) => a.trim().replace(/"/g, "")), l = {};
124
+ return r.forEach((a, n) => {
125
+ l[a] = d[n] || "";
126
+ }), l;
127
+ });
128
+ }, []), p = u((c) => {
129
+ try {
130
+ const e = JSON.parse(c);
131
+ return Array.isArray(e) ? e : [e];
132
+ } catch {
133
+ throw new Error("Format JSON invalide");
134
+ }
135
+ }, []), x = u((c) => {
136
+ try {
137
+ const r = new DOMParser().parseFromString(c, "text/xml").querySelectorAll("row");
138
+ return Array.from(r).map((s) => {
139
+ const t = {};
140
+ return Array.from(s.children).forEach((d) => {
141
+ t[d.tagName] = d.textContent || "";
142
+ }), t;
143
+ });
144
+ } catch {
145
+ throw new Error("Format XML invalide");
146
+ }
147
+ }, []), b = u(async (c) => {
148
+ try {
149
+ if (typeof window > "u")
150
+ throw new Error("XLSX parsing not available in server environment");
151
+ const e = await import("xlsx"), o = await c.arrayBuffer(), r = e.read(o, { type: "array" }), s = r.SheetNames[0], t = r.Sheets[s], d = e.utils.sheet_to_json(t, { header: 1 });
152
+ if (d.length === 0) return [];
153
+ const l = d[0];
154
+ return d.slice(1).map((a) => {
155
+ const n = {};
156
+ return l.forEach((f, k) => {
157
+ n[f] = a[k] || "";
158
+ }), n;
159
+ });
160
+ } catch {
161
+ throw new Error("Erreur lors du parsing du fichier XLSX");
162
+ }
163
+ }, []), v = u((c) => i.validate ? i.validate(c) : Array.isArray(c) ? c.length === 0 ? { valid: !1, errors: ["Aucune donnée trouvée"] } : { valid: !0, errors: [] } : { valid: !1, errors: ["Les données doivent être un tableau"] }, [i.validate]), E = u((c) => i.columnMapping ? c.map((e) => {
164
+ const o = {};
165
+ return Object.entries(i.columnMapping).forEach(([r, s]) => {
166
+ e[r] !== void 0 && (o[s] = e[r]);
167
+ }), o;
168
+ }) : c, [i.columnMapping]), w = u(async (c) => {
169
+ const e = c.name.split(".").pop()?.toLowerCase();
170
+ let o = [];
171
+ try {
172
+ const r = await c.text();
173
+ switch (e) {
174
+ case "csv":
175
+ o = y(r, i.parseOptions?.csv?.delimiter);
176
+ break;
177
+ case "json":
178
+ o = p(r);
179
+ break;
180
+ case "xml":
181
+ o = x(r);
182
+ break;
183
+ case "xlsx":
184
+ o = await b(c);
185
+ break;
186
+ default:
187
+ throw new Error(`Format de fichier non supporté: ${e}`);
188
+ }
189
+ const s = v(o);
190
+ if (!s.valid)
191
+ throw new Error(`Données invalides: ${s.errors.join(", ")}`);
192
+ const t = E(o);
193
+ return i.onImport && i.onImport(t), t;
194
+ } catch (r) {
195
+ throw new Error(`Erreur lors de l'import: ${r instanceof Error ? r.message : "Erreur inconnue"}`);
196
+ }
197
+ }, [i, y, p, x, b, v, E]), m = u(() => {
198
+ const c = document.createElement("input");
199
+ return c.type = "file", c.accept = i.accept, c.multiple = !1, c;
200
+ }, [i.accept]), g = u(() => new Promise((c, e) => {
201
+ const o = m();
202
+ o.onchange = async (r) => {
203
+ const s = r.target.files?.[0];
204
+ if (!s) {
205
+ e(new Error("Aucun fichier sélectionné"));
206
+ return;
207
+ }
208
+ try {
209
+ const t = await w(s);
210
+ c(t);
211
+ } catch (t) {
212
+ e(t);
213
+ }
214
+ }, o.click();
215
+ }), [m, w]);
216
+ return {
217
+ importData: w,
218
+ importWithUI: g,
219
+ supportedFormats: i.accept?.split(",") || [],
220
+ isFormatSupported: (c) => {
221
+ const e = c.split(".").pop()?.toLowerCase();
222
+ return i.accept?.includes(e || "") || !1;
223
+ }
224
+ };
225
+ }
226
+ export {
227
+ D as a,
228
+ X as u
229
+ };
@@ -0,0 +1,9 @@
1
+ "use strict";var j=Object.create;var C=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var X=Object.getOwnPropertyNames;var K=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var O=(f,n,w,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let h of X(n))!F.call(f,h)&&h!==w&&C(f,h,{get:()=>n[h],enumerable:!(l=D(n,h))||l.enumerable});return f};var g=(f,n,w)=>(w=f!=null?j(K(f)):{},O(n||!f||!f.__esModule?C(w,"default",{value:f,enumerable:!0}):w,f));const d=require("react");function R({data:f,columns:n,exportConfig:w}){const l=d.useMemo(()=>({formats:["csv","xlsx","json"],filename:"export",includeHeaders:!0,...w}),[w]),h=d.useCallback((e,s)=>{if(!e.length)return;const r=n.filter(a=>a.accessorKey||a.id).map(a=>a.header||a.accessorKey||a.id).join(","),c=e.map(a=>n.filter(o=>o.accessorKey||o.id).map(o=>{const m=o.accessorKey?a[o.accessorKey]:a[o.id],E=o.formatter?o.formatter(m):m,L=String(E||"");return L.includes(",")||L.includes('"')||L.includes(`
2
+ `)?`"${L.replace(/"/g,'""')}"`:L}).join(",")),t=[r,...c].join(`
3
+ `),u=new Blob([t],{type:"text/csv;charset=utf-8;"}),p=document.createElement("a");p.href=URL.createObjectURL(u),p.download=`${s||l.filename}.csv`,p.click(),URL.revokeObjectURL(p.href)},[n,l.filename]),x=d.useCallback((e,s)=>{const r=JSON.stringify(e,null,2),c=new Blob([r],{type:"application/json"}),t=document.createElement("a");t.href=URL.createObjectURL(c),t.download=`${s||l.filename}.json`,t.click(),URL.revokeObjectURL(t.href)},[l.filename]),k=d.useCallback(async(e,s)=>{try{if(typeof window>"u")throw new Error("XLSX export not available in server environment");const r=await import("xlsx"),t=[n.filter(a=>a.accessorKey||a.id).map(a=>a.header||a.accessorKey||a.id),...e.map(a=>n.filter(o=>o.accessorKey||o.id).map(o=>{const m=o.accessorKey?a[o.accessorKey]:a[o.id];return o.formatter?o.formatter(m):m}))],u=r.utils.aoa_to_sheet(t),p=r.utils.book_new();r.utils.book_append_sheet(p,u,"Sheet1"),r.writeFile(p,`${s||l.filename}.xlsx`)}catch(r){throw console.error("Erreur lors de l'export XLSX:",r),new Error("La librairie xlsx n'est pas disponible")}},[n,l.filename]),v=d.useCallback(async(e,s)=>{try{if(typeof window>"u")throw new Error("PDF export not available in server environment");const r=await import("jspdf"),c=await import("jspdf-autotable"),t=new r.default,u=n.filter(a=>a.accessorKey||a.id).map(a=>a.header||a.accessorKey||a.id),p=e.map(a=>n.filter(o=>o.accessorKey||o.id).map(o=>{const m=o.accessorKey?a[o.accessorKey]:a[o.id];return o.formatter?o.formatter(m):m}));t.autoTable({head:[u],body:p,startY:20,styles:{fontSize:8},headStyles:{fillColor:[66,139,202]}}),t.save(`${s||l.filename}.pdf`)}catch(r){throw console.error("Erreur lors de l'export PDF:",r),new Error("Les librairies jsPDF et jspdf-autotable ne sont pas disponibles")}},[n,l.filename]),y=d.useCallback((e,s)=>{const r=n.filter(p=>p.accessorKey||p.id).map(p=>p.accessorKey||p.id);let c=`<?xml version="1.0" encoding="UTF-8"?>
4
+ <data>
5
+ `;e.forEach((p,a)=>{c+=` <row id="${a}">
6
+ `,r.forEach(o=>{const m=p[o],E=String(m||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");c+=` <${o}>${E}</${o}>
7
+ `}),c+=` </row>
8
+ `}),c+="</data>";const t=new Blob([c],{type:"application/xml"}),u=document.createElement("a");u.href=URL.createObjectURL(t),u.download=`${s||l.filename}.xml`,u.click(),URL.revokeObjectURL(u.href)},[n,l.filename]),b=d.useCallback(async(e,s,r)=>{const c=s||f,t=r||l.filename;if(l.onExport){l.onExport(c,e);return}switch(e.toLowerCase()){case"csv":h(c,t);break;case"json":x(c,t);break;case"xlsx":await k(c,t);break;case"pdf":await v(c,t);break;case"xml":y(c,t);break;default:throw new Error(`Format d'export non supporté: ${e}`)}},[f,l,h,x,k,v,y]),S=d.useCallback(async e=>b(e),[b]),i=d.useCallback(async(e,s)=>b(e,s),[b]);return{exportData:b,exportAll:S,exportSelected:i,supportedFormats:l.formats,isExportSupported:e=>l.formats.includes(e)}}function U({importConfig:f}){const n=d.useMemo(()=>({accept:".csv,.xlsx,.json,.xml",...f}),[f]),w=d.useCallback((i,e=",")=>{const s=i.split(`
9
+ `).filter(t=>t.trim());if(s.length===0)return[];const r=s[0].split(e).map(t=>t.trim().replace(/"/g,""));return s.slice(1).map(t=>{const u=t.split(e).map(a=>a.trim().replace(/"/g,"")),p={};return r.forEach((a,o)=>{p[a]=u[o]||""}),p})},[]),l=d.useCallback(i=>{try{const e=JSON.parse(i);return Array.isArray(e)?e:[e]}catch{throw new Error("Format JSON invalide")}},[]),h=d.useCallback(i=>{try{const r=new DOMParser().parseFromString(i,"text/xml").querySelectorAll("row");return Array.from(r).map(c=>{const t={};return Array.from(c.children).forEach(u=>{t[u.tagName]=u.textContent||""}),t})}catch{throw new Error("Format XML invalide")}},[]),x=d.useCallback(async i=>{try{if(typeof window>"u")throw new Error("XLSX parsing not available in server environment");const e=await import("xlsx"),s=await i.arrayBuffer(),r=e.read(s,{type:"array"}),c=r.SheetNames[0],t=r.Sheets[c],u=e.utils.sheet_to_json(t,{header:1});if(u.length===0)return[];const p=u[0];return u.slice(1).map(a=>{const o={};return p.forEach((m,E)=>{o[m]=a[E]||""}),o})}catch{throw new Error("Erreur lors du parsing du fichier XLSX")}},[]),k=d.useCallback(i=>n.validate?n.validate(i):Array.isArray(i)?i.length===0?{valid:!1,errors:["Aucune donnée trouvée"]}:{valid:!0,errors:[]}:{valid:!1,errors:["Les données doivent être un tableau"]},[n.validate]),v=d.useCallback(i=>n.columnMapping?i.map(e=>{const s={};return Object.entries(n.columnMapping).forEach(([r,c])=>{e[r]!==void 0&&(s[c]=e[r])}),s}):i,[n.columnMapping]),y=d.useCallback(async i=>{const e=i.name.split(".").pop()?.toLowerCase();let s=[];try{const r=await i.text();switch(e){case"csv":s=w(r,n.parseOptions?.csv?.delimiter);break;case"json":s=l(r);break;case"xml":s=h(r);break;case"xlsx":s=await x(i);break;default:throw new Error(`Format de fichier non supporté: ${e}`)}const c=k(s);if(!c.valid)throw new Error(`Données invalides: ${c.errors.join(", ")}`);const t=v(s);return n.onImport&&n.onImport(t),t}catch(r){throw new Error(`Erreur lors de l'import: ${r instanceof Error?r.message:"Erreur inconnue"}`)}},[n,w,l,h,x,k,v]),b=d.useCallback(()=>{const i=document.createElement("input");return i.type="file",i.accept=n.accept,i.multiple=!1,i},[n.accept]),S=d.useCallback(()=>new Promise((i,e)=>{const s=b();s.onchange=async r=>{const c=r.target.files?.[0];if(!c){e(new Error("Aucun fichier sélectionné"));return}try{const t=await y(c);i(t)}catch(t){e(t)}},s.click()}),[b,y]);return{importData:y,importWithUI:S,supportedFormats:n.accept?.split(",")||[],isFormatSupported:i=>{const e=i.split(".").pop()?.toLowerCase();return n.accept?.includes(e||"")||!1}}}exports.useDataTableExport=R;exports.useDataTableImport=U;
package/package.json CHANGED
@@ -1,23 +1,49 @@
1
1
  {
2
2
  "name": "@wakastellar/ui",
3
- "version": "1.0.10",
4
- "description": "UI Library compatible TweakCN + i18n pour Next.js",
3
+ "version": "2.0.0",
4
+ "description": "Zero-config UI Library for Next.js with TweakCN theming and i18n support",
5
5
  "keywords": [
6
6
  "ui",
7
- "interfaces"
7
+ "react",
8
+ "nextjs",
9
+ "tailwindcss",
10
+ "components",
11
+ "ui-library"
8
12
  ],
9
13
  "publisher": "wakastellar",
10
14
  "displayName": "Wakastellar - UI",
11
15
  "main": "./dist/index.cjs.js",
12
16
  "module": "./dist/index.es.js",
13
17
  "types": "./dist/index.d.ts",
18
+ "sideEffects": [
19
+ "**/*.css"
20
+ ],
14
21
  "exports": {
15
22
  ".": {
16
23
  "types": "./dist/index.d.ts",
17
24
  "import": "./dist/index.es.js",
18
25
  "require": "./dist/index.cjs.js"
19
26
  },
27
+ "./charts": {
28
+ "types": "./dist/charts.d.ts",
29
+ "import": "./dist/charts.es.js",
30
+ "require": "./dist/charts.cjs.js"
31
+ },
32
+ "./rich-text": {
33
+ "types": "./dist/rich-text.d.ts",
34
+ "import": "./dist/rich-text.es.js",
35
+ "require": "./dist/rich-text.cjs.js"
36
+ },
37
+ "./export": {
38
+ "types": "./dist/export.d.ts",
39
+ "import": "./dist/export.es.js",
40
+ "require": "./dist/export.cjs.js"
41
+ },
20
42
  "./styles": "./src/styles/globals.css",
43
+ "./styles/v3": "./src/styles/globals-v3.css",
44
+ "./styles/v4": "./src/styles/globals.css",
45
+ "./styles/base": "./src/styles/base.css",
46
+ "./tailwind-preset": "./src/styles/tailwind.preset.js",
21
47
  "./styles/*": "./src/styles/*.css"
22
48
  },
23
49
  "files": [
@@ -53,7 +79,6 @@
53
79
  "@radix-ui/react-tooltip": "^1.0.7",
54
80
  "@tanstack/react-table": "^8.21.3",
55
81
  "@tanstack/react-virtual": "^3.13.12",
56
- "@types/prismjs": "^1.26.5",
57
82
  "class-variance-authority": "^0.7.1",
58
83
  "clsx": "^2.1.1",
59
84
  "cmdk": "^0.2.0",
@@ -62,30 +87,32 @@
62
87
  "lucide-react": "^0.293.0",
63
88
  "next-i18next": "^15.2.0",
64
89
  "prismjs": "^1.30.0",
65
- "react": ">=19.1.0",
66
90
  "react-datepicker": "^8.7.0",
67
91
  "react-day-picker": "^9.11.1",
68
- "react-dom": ">=18.0.0",
69
92
  "react-i18next": "^13.2.0",
70
93
  "tailwind-merge": "^3.3.1",
71
94
  "tailwind-variants": "^0.1.18"
72
95
  },
73
96
  "peerDependencies": {
74
- "next": ">=15.5.4",
75
- "react": ">=19.1.0",
76
- "react-dom": ">=18.0.0",
77
- "react-hook-form": "^7.0.0",
78
- "xlsx": "*",
97
+ "@tiptap/extension-link": "^2.0.0 || ^3.0.0",
98
+ "@tiptap/extension-text-align": "^2.0.0 || ^3.0.0",
99
+ "@tiptap/extension-underline": "^2.0.0 || ^3.0.0",
100
+ "@tiptap/react": "^2.0.0 || ^3.0.0",
101
+ "@tiptap/starter-kit": "^2.0.0 || ^3.0.0",
79
102
  "jspdf": "*",
80
103
  "jspdf-autotable": "*",
104
+ "next": ">=14.0.0",
105
+ "react": ">=18.0.0",
106
+ "react-dom": ">=18.0.0",
107
+ "react-hook-form": "^7.0.0",
81
108
  "recharts": "^2.0.0",
82
- "@tiptap/react": "^2.0.0 || ^3.0.0",
83
- "@tiptap/starter-kit": "^2.0.0 || ^3.0.0",
84
- "@tiptap/extension-link": "^2.0.0 || ^3.0.0",
85
- "@tiptap/extension-text-align": "^2.0.0 || ^3.0.0",
86
- "@tiptap/extension-underline": "^2.0.0 || ^3.0.0"
109
+ "tailwindcss": ">=3.4.0 || >=4.0.0",
110
+ "xlsx": "*"
87
111
  },
88
112
  "peerDependenciesMeta": {
113
+ "react-hook-form": {
114
+ "optional": true
115
+ },
89
116
  "recharts": {
90
117
  "optional": true
91
118
  },
@@ -103,6 +130,15 @@
103
130
  },
104
131
  "@tiptap/extension-underline": {
105
132
  "optional": true
133
+ },
134
+ "xlsx": {
135
+ "optional": true
136
+ },
137
+ "jspdf": {
138
+ "optional": true
139
+ },
140
+ "jspdf-autotable": {
141
+ "optional": true
106
142
  }
107
143
  },
108
144
  "devDependencies": {
@@ -111,6 +147,7 @@
111
147
  "@testing-library/react": "^14.1.2",
112
148
  "@testing-library/user-event": "^14.5.1",
113
149
  "@types/node": "^24.7.2",
150
+ "@types/prismjs": "^1.26.5",
114
151
  "@types/react": "^18.3.26",
115
152
  "@types/react-datepicker": "^7.0.0",
116
153
  "@types/react-dom": "^18.3.5",
@@ -122,14 +159,14 @@
122
159
  "jsdom": "^23.0.1",
123
160
  "playwright": "^1.56.0",
124
161
  "postcss": "^8.4.31",
125
- "react-hook-form": "^7.49.2",
162
+ "react-hook-form": "^7.70.0",
126
163
  "storybook": "^9.1.10",
127
- "tailwindcss": "^3.4.0",
128
- "tailwindcss-animate": "^1.0.7",
164
+ "tailwindcss": "^4.1.8",
129
165
  "typescript": "^5.5.0",
130
166
  "vite": "^7.1.9",
131
167
  "vite-plugin-dts": "^4.5.4",
132
- "vitest": "^3.2.4"
168
+ "vitest": "^3.2.4",
169
+ "vitest-axe": "^0.1.0"
133
170
  },
134
171
  "scripts": {
135
172
  "dev": "vite build --watch --mode development",
@@ -0,0 +1,108 @@
1
+ /* ============================================
2
+ WakaStart UI - Base Styles
3
+ Compatible Tailwind v3 & v4
4
+ ============================================ */
5
+
6
+ /* Import des thèmes TweakCN */
7
+ @import './themes/index.css';
8
+
9
+ /* Import des styles additionnels */
10
+ @import './prism.css';
11
+ @import './code-highlight.css';
12
+ @import './datepicker.css';
13
+
14
+ /* ============================================
15
+ Default Theme - shadcn/ui format (H S L)
16
+ ============================================ */
17
+
18
+ :root,
19
+ [data-theme="default"] {
20
+ --background: 0 0% 100%;
21
+ --foreground: 222.2 84% 4.9%;
22
+ --card: 0 0% 100%;
23
+ --card-foreground: 222.2 84% 4.9%;
24
+ --popover: 0 0% 100%;
25
+ --popover-foreground: 222.2 84% 4.9%;
26
+ --primary: 222.2 47.4% 11.2%;
27
+ --primary-foreground: 210 40% 98%;
28
+ --secondary: 210 40% 96.1%;
29
+ --secondary-foreground: 222.2 47.4% 11.2%;
30
+ --muted: 210 40% 96.1%;
31
+ --muted-foreground: 215.4 16.3% 46.9%;
32
+ --accent: 210 40% 96.1%;
33
+ --accent-foreground: 222.2 47.4% 11.2%;
34
+ --destructive: 0 84.2% 60.2%;
35
+ --destructive-foreground: 210 40% 98%;
36
+ --border: 214.3 31.8% 91.4%;
37
+ --input: 214.3 31.8% 91.4%;
38
+ --ring: 222.2 84% 4.9%;
39
+ --chart-1: 222.2 47.4% 11.2%;
40
+ --chart-2: 215 25% 27%;
41
+ --chart-3: 210 20% 50%;
42
+ --chart-4: 210 25% 70%;
43
+ --chart-5: 210 20% 85%;
44
+ --radius: 0.5rem;
45
+ }
46
+
47
+ .dark,
48
+ [data-theme="default"].dark {
49
+ --background: 222.2 84% 4.9%;
50
+ --foreground: 210 40% 98%;
51
+ --card: 222.2 84% 4.9%;
52
+ --card-foreground: 210 40% 98%;
53
+ --popover: 222.2 84% 4.9%;
54
+ --popover-foreground: 210 40% 98%;
55
+ --primary: 210 40% 98%;
56
+ --primary-foreground: 222.2 47.4% 11.2%;
57
+ --secondary: 217.2 32.6% 17.5%;
58
+ --secondary-foreground: 210 40% 98%;
59
+ --muted: 217.2 32.6% 17.5%;
60
+ --muted-foreground: 215 20.2% 65.1%;
61
+ --accent: 217.2 32.6% 17.5%;
62
+ --accent-foreground: 210 40% 98%;
63
+ --destructive: 0 62.8% 30.6%;
64
+ --destructive-foreground: 210 40% 98%;
65
+ --border: 217.2 32.6% 17.5%;
66
+ --input: 217.2 32.6% 17.5%;
67
+ --ring: 212.7 26.8% 83.9%;
68
+ --chart-1: 210 40% 98%;
69
+ --chart-2: 215 20% 70%;
70
+ --chart-3: 210 15% 50%;
71
+ --chart-4: 210 20% 35%;
72
+ --chart-5: 217 25% 25%;
73
+ }
74
+
75
+ /* ============================================
76
+ Base Resets
77
+ ============================================ */
78
+
79
+ * {
80
+ border-color: hsl(var(--border));
81
+ }
82
+
83
+ body {
84
+ background-color: hsl(var(--background));
85
+ color: hsl(var(--foreground));
86
+ }
87
+
88
+ /* ============================================
89
+ Keyframes (compatible v3 & v4)
90
+ ============================================ */
91
+
92
+ @keyframes accordion-down {
93
+ from {
94
+ height: 0;
95
+ }
96
+ to {
97
+ height: var(--radix-accordion-content-height);
98
+ }
99
+ }
100
+
101
+ @keyframes accordion-up {
102
+ from {
103
+ height: var(--radix-accordion-content-height);
104
+ }
105
+ to {
106
+ height: 0;
107
+ }
108
+ }