@wakastellar/ui 2.4.0 → 3.1.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/blocks/antivirus-dashboard/index.d.ts +44 -0
- package/dist/blocks/clamav-service-status/index.d.ts +35 -0
- package/dist/blocks/file-scan-uploader/index.d.ts +29 -0
- package/dist/blocks/index.d.ts +18 -9
- package/dist/blocks/quarantine-manager/index.d.ts +27 -0
- package/dist/blocks/scan-history-log/index.d.ts +28 -0
- package/dist/blocks/scan-policy-editor/index.d.ts +27 -0
- package/dist/blocks/scan-report-generator/index.d.ts +47 -0
- package/dist/blocks/signature-database-manager/index.d.ts +39 -0
- package/dist/blocks/threat-alert-banner/index.d.ts +26 -0
- package/dist/components/index.d.ts +4 -4
- package/dist/components/waka-signature-pad/index.d.ts +1 -1
- package/dist/exceljs.min-BcLLX0PC.js +29 -0
- package/dist/exceljs.min-KOayaaQ4.mjs +23013 -0
- package/dist/export.cjs.js +1 -1
- package/dist/export.d.ts +2 -2
- package/dist/export.es.js +1 -1
- package/dist/index.cjs.js +136 -136
- package/dist/index.es.js +29978 -27215
- package/dist/stories/Button.stories.d.ts +1 -1
- package/dist/stories/Header.stories.d.ts +1 -1
- package/dist/stories/Page.stories.d.ts +1 -1
- package/dist/useDataTableImport-COVnvslz.js +9 -0
- package/dist/useDataTableImport-DAlxBY8w.mjs +237 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/logger.d.ts +9 -0
- package/package.json +6 -5
- package/src/blocks/antivirus-dashboard/AntivirusDashboard.stories.tsx +291 -0
- package/src/blocks/antivirus-dashboard/index.tsx +525 -0
- package/src/blocks/clamav-service-status/ClamAVServiceStatus.stories.tsx +195 -0
- package/src/blocks/clamav-service-status/index.tsx +370 -0
- package/src/blocks/file-scan-uploader/FileScanUploader.stories.tsx +257 -0
- package/src/blocks/file-scan-uploader/index.tsx +311 -0
- package/src/blocks/index.ts +163 -11
- package/src/blocks/quarantine-manager/QuarantineManager.stories.tsx +209 -0
- package/src/blocks/quarantine-manager/index.tsx +435 -0
- package/src/blocks/scan-history-log/ScanHistoryLog.stories.tsx +231 -0
- package/src/blocks/scan-history-log/index.tsx +406 -0
- package/src/blocks/scan-policy-editor/ScanPolicyEditor.stories.tsx +106 -0
- package/src/blocks/scan-policy-editor/index.tsx +418 -0
- package/src/blocks/scan-report-generator/ScanReportGenerator.stories.tsx +232 -0
- package/src/blocks/scan-report-generator/index.tsx +612 -0
- package/src/blocks/sidebar/index.tsx +2 -1
- package/src/blocks/signature-database-manager/SignatureDatabaseManager.stories.tsx +279 -0
- package/src/blocks/signature-database-manager/index.tsx +470 -0
- package/src/blocks/theme-creator-block/index.tsx +16 -2
- package/src/blocks/threat-alert-banner/ThreatAlertBanner.stories.tsx +152 -0
- package/src/blocks/threat-alert-banner/index.tsx +320 -0
- package/src/components/DataTable/DataTable.stories.tsx +203 -0
- package/src/components/DataTable/hooks/useDataTableExport.ts +38 -31
- package/src/components/DataTable/hooks/useDataTableImport.ts +31 -20
- package/src/components/error-boundary/ErrorBoundary.stories.tsx +125 -0
- package/src/components/index.ts +45 -4
- package/src/components/language-selector/LanguageSelector.stories.tsx +112 -0
- package/src/components/theme-selector/ThemeSelector.stories.tsx +77 -0
- package/src/components/toaster/Toaster.stories.tsx +67 -0
- package/src/components/waka-activity-feed/WakaActivityFeed.stories.tsx +116 -0
- package/src/components/waka-ad-banner/WakaAdBanner.stories.tsx +102 -0
- package/src/components/waka-ad-fallback/WakaAdFallback.stories.tsx +117 -0
- package/src/components/waka-ad-inline/WakaAdInline.stories.tsx +105 -0
- package/src/components/waka-ad-interstitial/WakaAdInterstitial.stories.tsx +92 -0
- package/src/components/waka-ad-placeholder/WakaAdPlaceholder.stories.tsx +89 -0
- package/src/components/waka-ad-provider/WakaAdProvider.stories.tsx +110 -0
- package/src/components/waka-ad-sidebar/WakaAdSidebar.stories.tsx +89 -0
- package/src/components/waka-ad-sidebar/index.tsx +3 -2
- package/src/components/waka-ad-sticky-footer/WakaAdStickyFooter.stories.tsx +88 -0
- package/src/components/waka-address-autocomplete/WakaAddressAutocomplete.stories.tsx +46 -0
- package/src/components/waka-admincrumb/WakaAdmincrumb.stories.tsx +166 -0
- package/src/components/waka-alert-panel/WakaAlertPanel.stories.tsx +45 -0
- package/src/components/waka-alert-stack/WakaAlertStack.stories.tsx +62 -0
- package/src/components/waka-allocation-matrix/WakaAllocationMatrix.stories.tsx +68 -0
- package/src/components/waka-approval-chain/WakaApprovalChain.stories.tsx +63 -0
- package/src/components/waka-audit-log/WakaAuditLog.stories.tsx +73 -0
- package/src/components/waka-autocomplete/WakaAutocomplete.stories.tsx +132 -172
- package/src/components/waka-biometric-prompt/WakaBiometricPrompt.stories.tsx +48 -0
- package/src/components/waka-breadcrumb/WakaBreadcrumb.stories.tsx +74 -191
- package/src/components/waka-breadcrumb-path/WakaBreadcrumbPath.stories.tsx +40 -0
- package/src/components/waka-budget-burn/WakaBudgetBurn.stories.tsx +86 -0
- package/src/components/waka-capacity-planner/WakaCapacityPlanner.stories.tsx +273 -0
- package/src/components/waka-cart-summary/WakaCartSummary.stories.tsx +176 -0
- package/src/components/waka-cart-summary/index.tsx +19 -10
- package/src/components/waka-challenge-timer/WakaChallengeTimer.stories.tsx +98 -0
- package/src/components/waka-chat-bubble/WakaChatBubble.stories.tsx +118 -0
- package/src/components/waka-checklist/WakaChecklist.stories.tsx +71 -0
- package/src/components/waka-checkout-stepper/WakaCheckoutStepper.stories.tsx +102 -0
- package/src/components/waka-cohort-table/WakaCohortTable.stories.tsx +56 -0
- package/src/components/waka-color-picker/WakaColorPicker.stories.tsx +99 -155
- package/src/components/waka-combo-counter/WakaComboCounter.stories.tsx +128 -0
- package/src/components/waka-command-bar/WakaCommandBar.stories.tsx +45 -0
- package/src/components/waka-compare-period/WakaComparePeriod.stories.tsx +76 -0
- package/src/components/waka-config-comparator/WakaConfigComparator.stories.tsx +143 -0
- package/src/components/waka-connection-matrix/WakaConnectionMatrix.stories.tsx +52 -0
- package/src/components/waka-content-recommendation/WakaContentRecommendation.stories.tsx +41 -0
- package/src/components/waka-coupon-input/WakaCouponInput.stories.tsx +126 -0
- package/src/components/waka-credit-card-input/WakaCreditCardInput.stories.tsx +120 -0
- package/src/components/waka-datetime-picker.form-integration/WakaDateTimePickerForm.stories.tsx +79 -0
- package/src/components/waka-dependency-tree/WakaDependencyTree.stories.tsx +72 -0
- package/src/components/waka-device-trust/WakaDeviceTrust.stories.tsx +109 -0
- package/src/components/waka-empty-state/WakaEmptyState.stories.tsx +87 -0
- package/src/components/waka-feature-announcement/WakaFeatureAnnouncement.stories.tsx +47 -0
- package/src/components/waka-feature-flag-row/WakaFeatureFlagRow.stories.tsx +188 -0
- package/src/components/waka-file-upload/WakaFileUpload.stories.tsx +118 -174
- package/src/components/waka-floating-nav/WakaFloatingNav.stories.tsx +53 -0
- package/src/components/waka-goal-progress/WakaGoalProgress.stories.tsx +137 -0
- package/src/components/waka-hotspot/WakaHotspot.stories.tsx +56 -0
- package/src/components/waka-invoice-preview/WakaInvoicePreview.stories.tsx +169 -0
- package/src/components/waka-kpi-dashboard/WakaKpiDashboard.stories.tsx +46 -0
- package/src/components/waka-level-progress/WakaLevelProgress.stories.tsx +94 -75
- package/src/components/waka-liquid-button/WakaLiquidButton.stories.tsx +45 -0
- package/src/components/waka-magic-link/WakaMagicLink.stories.tsx +61 -0
- package/src/components/waka-magnetic-button/WakaMagneticButton.stories.tsx +40 -0
- package/src/components/waka-mention-input/WakaMentionInput.stories.tsx +140 -0
- package/src/components/waka-milestone-road/WakaMilestoneRoad.stories.tsx +143 -0
- package/src/components/waka-orbital-menu/WakaOrbitalMenu.stories.tsx +54 -0
- package/src/components/waka-order-tracker/WakaOrderTracker.stories.tsx +163 -0
- package/src/components/waka-outstream-video/WakaOutstreamVideo.stories.tsx +94 -0
- package/src/components/waka-pagination/WakaPagination.stories.tsx +110 -280
- package/src/components/waka-password-strength/WakaPasswordStrength.stories.tsx +132 -268
- package/src/components/waka-payment-method-picker/WakaPaymentMethodPicker.stories.tsx +141 -0
- package/src/components/waka-permission-matrix/WakaPermissionMatrix.stories.tsx +124 -0
- package/src/components/waka-phone-input/WakaPhoneInput.stories.tsx +56 -0
- package/src/components/waka-points-popup/WakaPointsPopup.stories.tsx +96 -0
- package/src/components/waka-power-up/WakaPowerUp.stories.tsx +121 -0
- package/src/components/waka-presence-indicator/WakaPresenceIndicator.stories.tsx +49 -0
- package/src/components/waka-pricing-table/WakaPricingTable.stories.tsx +159 -0
- package/src/components/waka-product-card/WakaProductCard.stories.tsx +202 -0
- package/src/components/waka-progress-onboarding/WakaProgressOnboarding.stories.tsx +57 -0
- package/src/components/waka-pull-to-refresh/WakaPullToRefresh.stories.tsx +51 -0
- package/src/components/waka-rank-badge/WakaRankBadge.stories.tsx +108 -0
- package/src/components/waka-rating-input/WakaRatingInput.stories.tsx +51 -0
- package/src/components/waka-reaction-picker/WakaReactionPicker.stories.tsx +52 -0
- package/src/components/waka-region-map/WakaRegionMap.stories.tsx +181 -0
- package/src/components/waka-resource-pool/WakaResourcePool.stories.tsx +70 -0
- package/src/components/waka-rich-text-editor/WakaRichTextEditor.stories.tsx +108 -197
- package/src/components/waka-rollback-slider/WakaRollbackSlider.stories.tsx +41 -0
- package/src/components/waka-schedule-picker/WakaSchedulePicker.stories.tsx +64 -0
- package/src/components/waka-season-pass/WakaSeasonPass.stories.tsx +107 -0
- package/src/components/waka-security-scan-result/WakaSecurityScanResult.stories.tsx +146 -0
- package/src/components/waka-security-score/WakaSecurityScore.stories.tsx +63 -0
- package/src/components/waka-session-manager/WakaSessionManager.stories.tsx +68 -0
- package/src/components/waka-signature-pad/WakaSignaturePad.stories.tsx +159 -0
- package/src/components/waka-signature-pad/index.tsx +5 -3
- package/src/components/waka-sla-tracker/WakaSlaTracker.stories.tsx +65 -0
- package/src/components/waka-slider-range/WakaSliderRange.stories.tsx +66 -0
- package/src/components/waka-sponsored-badge/WakaSponsoredBadge.stories.tsx +60 -0
- package/src/components/waka-sponsored-card/WakaSponsoredCard.stories.tsx +64 -0
- package/src/components/waka-sponsored-feed/WakaSponsoredFeed.stories.tsx +58 -0
- package/src/components/waka-spotlight/WakaSpotlight.stories.tsx +53 -0
- package/src/components/waka-stats-hexagon/WakaStatsHexagon.stories.tsx +161 -0
- package/src/components/waka-stepper/WakaStepper.stories.tsx +137 -410
- package/src/components/waka-swipe-card/WakaSwipeCard.stories.tsx +51 -0
- package/src/components/waka-tag-input/WakaTagInput.stories.tsx +224 -0
- package/src/components/waka-team-banner/WakaTeamBanner.stories.tsx +50 -0
- package/src/components/waka-theme-creator/WakaThemeCreator.stories.tsx +58 -0
- package/src/components/waka-theme-manager/WakaThemeManager.stories.tsx +298 -0
- package/src/components/waka-theme-manager/index.tsx +6 -11
- package/src/components/waka-thread-view/WakaThreadView.stories.tsx +143 -0
- package/src/components/waka-timeline/WakaTimeline.stories.tsx +171 -324
- package/src/components/waka-tooltip-tour/WakaTooltipTour.stories.tsx +92 -0
- package/src/components/waka-tour-guide/WakaTourGuide.stories.tsx +89 -0
- package/src/components/waka-treemap-chart/WakaTreemapChart.stories.tsx +234 -129
- package/src/components/waka-treemap-chart/index.tsx +2 -2
- package/src/components/waka-two-factor-setup/WakaTwoFactorSetup.stories.tsx +142 -0
- package/src/components/waka-typing-indicator/WakaTypingIndicator.stories.tsx +134 -0
- package/src/components/waka-video-ad/WakaVideoAd.stories.tsx +138 -0
- package/src/components/waka-video-call/WakaVideoCall.stories.tsx +186 -0
- package/src/components/waka-video-overlay/WakaVideoOverlay.stories.tsx +100 -0
- package/src/components/waka-voice-message/WakaVoiceMessage.stories.tsx +190 -0
- package/src/components/waka-welcome-modal/WakaWelcomeModal.stories.tsx +87 -0
- package/src/components/waka-xp-bar/WakaXPBar.stories.tsx +29 -29
- package/dist/useDataTableImport-D8R2HQl6.mjs +0 -229
- package/dist/useDataTableImport-S_hhA5Wo.js +0 -9
- package/src/components/DataTable/README.md +0 -446
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StoryObj } from '@storybook/react
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
2
|
declare const meta: Meta<({ primary, size, backgroundColor, label, ...props }: import('./Button').ButtonProps) => import("react/jsx-runtime").JSX.Element>;
|
|
3
3
|
export default meta;
|
|
4
4
|
type Story = StoryObj<typeof meta>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StoryObj } from '@storybook/react
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
2
|
declare const meta: Meta<({ user, onLogin, onLogout, onCreateAccount }: import('./Header').HeaderProps) => import("react/jsx-runtime").JSX.Element>;
|
|
3
3
|
export default meta;
|
|
4
4
|
type Story = StoryObj<typeof meta>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";var D=Object.create;var C=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,K=Object.prototype.hasOwnProperty;var X=(h,r,x,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let b of U(r))!K.call(h,b)&&b!==x&&C(h,b,{get:()=>r[b],enumerable:!(l=O(r,b))||l.enumerable});return h};var S=(h,r,x)=>(x=h!=null?D(F(h)):{},X(r||!h||!h.__esModule?C(x,"default",{value:h,enumerable:!0}):x,h));const m=require("react");function T({data:h,columns:r,exportConfig:x}){const l=m.useMemo(()=>({formats:["csv","xlsx","json"],filename:"export",includeHeaders:!0,...x}),[x]),b=m.useCallback((e,n)=>{if(!e.length)return;const a=r.filter(d=>d.accessorKey||d.id).map(d=>d.header||d.accessorKey||d.id).join(","),o=e.map(d=>r.filter(i=>i.accessorKey||i.id).map(i=>{const s=i.accessorKey?d[i.accessorKey]:d[i.id],w=i.formatter?i.formatter(s):s,f=String(w||"");return f.includes(",")||f.includes('"')||f.includes(`
|
|
2
|
+
`)?`"${f.replace(/"/g,'""')}"`:f}).join(",")),t=[a,...o].join(`
|
|
3
|
+
`),p=new Blob([t],{type:"text/csv;charset=utf-8;"}),u=document.createElement("a");u.href=URL.createObjectURL(p),u.download=`${n||l.filename}.csv`,u.click(),URL.revokeObjectURL(u.href)},[r,l.filename]),v=m.useCallback((e,n)=>{const a=JSON.stringify(e,null,2),o=new Blob([a],{type:"application/json"}),t=document.createElement("a");t.href=URL.createObjectURL(o),t.download=`${n||l.filename}.json`,t.click(),URL.revokeObjectURL(t.href)},[l.filename]),E=m.useCallback(async(e,n)=>{try{if(typeof window>"u")throw new Error("XLSX export not available in server environment");const a=await Promise.resolve().then(()=>require("./exceljs.min-BcLLX0PC.js")).then(s=>s.exceljs_min),o=new a.Workbook,t=o.addWorksheet(l.options?.xlsx?.sheetName||"Sheet1"),p=r.filter(s=>s.accessorKey||s.id).map(s=>s.header||s.accessorKey||s.id);t.addRow(p),e.forEach(s=>{const w=r.filter(f=>f.accessorKey||f.id).map(f=>{const L=f.accessorKey?s[f.accessorKey]:s[f.id];return f.formatter?f.formatter(L):L});t.addRow(w)});const u=await o.xlsx.writeBuffer(),d=new Blob([u],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),i=document.createElement("a");i.href=URL.createObjectURL(d),i.download=`${n||l.filename}.xlsx`,i.click(),URL.revokeObjectURL(i.href)}catch(a){throw console.error("Erreur lors de l'export XLSX:",a),new Error("La librairie exceljs n'est pas disponible. Installez-la avec: pnpm add exceljs")}},[r,l.filename,l.options?.xlsx?.sheetName]),j=m.useCallback(async(e,n)=>{try{if(typeof window>"u")throw new Error("PDF export not available in server environment");const a=await import("jspdf"),o=await import("jspdf-autotable"),t=a.default||a.jsPDF,p=new t,u=o.default||o.autoTable,d=r.filter(s=>s.accessorKey||s.id).map(s=>s.header||s.accessorKey||s.id),i=e.map(s=>r.filter(w=>w.accessorKey||w.id).map(w=>{const f=w.accessorKey?s[w.accessorKey]:s[w.id];return w.formatter?w.formatter(f):f}));u(p,{head:[d],body:i,startY:20,styles:{fontSize:8},headStyles:{fillColor:[66,139,202]}}),p.save(`${n||l.filename}.pdf`)}catch(a){throw console.error("Erreur lors de l'export PDF:",a),new Error("Les librairies jsPDF et jspdf-autotable ne sont pas disponibles")}},[r,l.filename]),k=m.useCallback((e,n)=>{const a=r.filter(u=>u.accessorKey||u.id).map(u=>u.accessorKey||u.id);let o=`<?xml version="1.0" encoding="UTF-8"?>
|
|
4
|
+
<data>
|
|
5
|
+
`;e.forEach((u,d)=>{o+=` <row id="${d}">
|
|
6
|
+
`,a.forEach(i=>{const s=u[i],w=String(s||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");o+=` <${i}>${w}</${i}>
|
|
7
|
+
`}),o+=` </row>
|
|
8
|
+
`}),o+="</data>";const t=new Blob([o],{type:"application/xml"}),p=document.createElement("a");p.href=URL.createObjectURL(t),p.download=`${n||l.filename}.xml`,p.click(),URL.revokeObjectURL(p.href)},[r,l.filename]),y=m.useCallback(async(e,n,a)=>{const o=n||h,t=a||l.filename;if(l.onExport){l.onExport(o,e);return}switch(e.toLowerCase()){case"csv":b(o,t);break;case"json":v(o,t);break;case"xlsx":await E(o,t);break;case"pdf":await j(o,t);break;case"xml":k(o,t);break;default:throw new Error(`Format d'export non supporté: ${e}`)}},[h,l,b,v,E,j,k]),g=m.useCallback(async e=>y(e),[y]),c=m.useCallback(async(e,n)=>y(e,n),[y]);return{exportData:y,exportAll:g,exportSelected:c,supportedFormats:l.formats,isExportSupported:e=>l.formats.includes(e)}}function $({importConfig:h}){const r=m.useMemo(()=>({accept:".csv,.xlsx,.json,.xml",...h}),[h]),x=m.useCallback((c,e=",")=>{const n=c.split(`
|
|
9
|
+
`).filter(t=>t.trim());if(n.length===0)return[];const a=n[0].split(e).map(t=>t.trim().replace(/"/g,""));return n.slice(1).map(t=>{const p=t.split(e).map(d=>d.trim().replace(/"/g,"")),u={};return a.forEach((d,i)=>{u[d]=p[i]||""}),u})},[]),l=m.useCallback(c=>{try{const e=JSON.parse(c);return Array.isArray(e)?e:[e]}catch{throw new Error("Format JSON invalide")}},[]),b=m.useCallback(c=>{try{const a=new DOMParser().parseFromString(c,"text/xml").querySelectorAll("row");return Array.from(a).map(o=>{const t={};return Array.from(o.children).forEach(p=>{t[p.tagName]=p.textContent||""}),t})}catch{throw new Error("Format XML invalide")}},[]),v=m.useCallback(async c=>{try{if(typeof window>"u")throw new Error("XLSX parsing not available in server environment");const e=await Promise.resolve().then(()=>require("./exceljs.min-BcLLX0PC.js")).then(i=>i.exceljs_min),n=await c.arrayBuffer(),a=new e.Workbook;await a.xlsx.load(n);const o=r.parseOptions?.xlsx?.sheetIndex??0,t=r.parseOptions?.xlsx?.headerRow??1,p=a.worksheets[o];if(!p||p.rowCount===0)return[];const u=[];p.getRow(t).eachCell((i,s)=>{u[s-1]=String(i.value||"")});const d=[];for(let i=t+1;i<=p.rowCount;i++){const s=p.getRow(i),w={};u.forEach((f,L)=>{const R=s.getCell(L+1);w[f]=R.value??""}),d.push(w)}return d}catch{throw new Error("Erreur lors du parsing du fichier XLSX. Verifiez que exceljs est installe: pnpm add exceljs")}},[r.parseOptions?.xlsx?.sheetIndex,r.parseOptions?.xlsx?.headerRow]),E=m.useCallback(c=>r.validate?r.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"]},[r.validate]),j=m.useCallback(c=>r.columnMapping?c.map(e=>{const n={};return Object.entries(r.columnMapping).forEach(([a,o])=>{e[a]!==void 0&&(n[o]=e[a])}),n}):c,[r.columnMapping]),k=m.useCallback(async c=>{const e=c.name.split(".").pop()?.toLowerCase();let n=[];try{const a=await c.text();switch(e){case"csv":n=x(a,r.parseOptions?.csv?.delimiter);break;case"json":n=l(a);break;case"xml":n=b(a);break;case"xlsx":n=await v(c);break;default:throw new Error(`Format de fichier non supporté: ${e}`)}const o=E(n);if(!o.valid)throw new Error(`Données invalides: ${o.errors.join(", ")}`);const t=j(n);return r.onImport&&r.onImport(t),t}catch(a){throw new Error(`Erreur lors de l'import: ${a instanceof Error?a.message:"Erreur inconnue"}`)}},[r,x,l,b,v,E,j]),y=m.useCallback(()=>{const c=document.createElement("input");return c.type="file",c.accept=r.accept,c.multiple=!1,c},[r.accept]),g=m.useCallback(()=>new Promise((c,e)=>{const n=y();n.onchange=async a=>{const o=a.target.files?.[0];if(!o){e(new Error("Aucun fichier sélectionné"));return}try{const t=await k(o);c(t)}catch(t){e(t)}},n.click()}),[y,k]);return{importData:k,importWithUI:g,supportedFormats:r.accept?.split(",")||[],isFormatSupported:c=>{const e=c.split(".").pop()?.toLowerCase();return r.accept?.includes(e||"")||!1}}}exports.useDataTableExport=T;exports.useDataTableImport=$;
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { useMemo as S, useCallback as w } from "react";
|
|
2
|
+
function D({
|
|
3
|
+
data: b,
|
|
4
|
+
columns: a,
|
|
5
|
+
exportConfig: y
|
|
6
|
+
}) {
|
|
7
|
+
const u = S(() => ({
|
|
8
|
+
formats: ["csv", "xlsx", "json"],
|
|
9
|
+
filename: "export",
|
|
10
|
+
includeHeaders: !0,
|
|
11
|
+
...y
|
|
12
|
+
}), [y]), v = w((e, n) => {
|
|
13
|
+
if (!e.length) return;
|
|
14
|
+
const t = a.filter((d) => d.accessorKey || d.id).map((d) => d.header || d.accessorKey || d.id).join(","), o = e.map((d) => a.filter((i) => i.accessorKey || i.id).map((i) => {
|
|
15
|
+
const s = i.accessorKey ? d[i.accessorKey] : d[i.id], m = i.formatter ? i.formatter(s) : s, f = String(m || "");
|
|
16
|
+
return f.includes(",") || f.includes('"') || f.includes(`
|
|
17
|
+
`) ? `"${f.replace(/"/g, '""')}"` : f;
|
|
18
|
+
}).join(",")), r = [t, ...o].join(`
|
|
19
|
+
`), l = new Blob([r], { type: "text/csv;charset=utf-8;" }), p = document.createElement("a");
|
|
20
|
+
p.href = URL.createObjectURL(l), p.download = `${n || u.filename}.csv`, p.click(), URL.revokeObjectURL(p.href);
|
|
21
|
+
}, [a, u.filename]), E = w((e, n) => {
|
|
22
|
+
const t = JSON.stringify(e, null, 2), o = new Blob([t], { type: "application/json" }), r = document.createElement("a");
|
|
23
|
+
r.href = URL.createObjectURL(o), r.download = `${n || u.filename}.json`, r.click(), URL.revokeObjectURL(r.href);
|
|
24
|
+
}, [u.filename]), k = w(async (e, n) => {
|
|
25
|
+
try {
|
|
26
|
+
if (typeof window > "u")
|
|
27
|
+
throw new Error("XLSX export not available in server environment");
|
|
28
|
+
const t = await import("./exceljs.min-KOayaaQ4.mjs").then((s) => s.e), o = new t.Workbook(), r = o.addWorksheet(u.options?.xlsx?.sheetName || "Sheet1"), l = a.filter((s) => s.accessorKey || s.id).map((s) => s.header || s.accessorKey || s.id);
|
|
29
|
+
r.addRow(l), e.forEach((s) => {
|
|
30
|
+
const m = a.filter((f) => f.accessorKey || f.id).map((f) => {
|
|
31
|
+
const g = f.accessorKey ? s[f.accessorKey] : s[f.id];
|
|
32
|
+
return f.formatter ? f.formatter(g) : g;
|
|
33
|
+
});
|
|
34
|
+
r.addRow(m);
|
|
35
|
+
});
|
|
36
|
+
const p = await o.xlsx.writeBuffer(), d = new Blob([p], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" }), i = document.createElement("a");
|
|
37
|
+
i.href = URL.createObjectURL(d), i.download = `${n || u.filename}.xlsx`, i.click(), URL.revokeObjectURL(i.href);
|
|
38
|
+
} catch (t) {
|
|
39
|
+
throw console.error("Erreur lors de l'export XLSX:", t), new Error("La librairie exceljs n'est pas disponible. Installez-la avec: pnpm add exceljs");
|
|
40
|
+
}
|
|
41
|
+
}, [a, u.filename, u.options?.xlsx?.sheetName]), L = w(async (e, n) => {
|
|
42
|
+
try {
|
|
43
|
+
if (typeof window > "u")
|
|
44
|
+
throw new Error("PDF export not available in server environment");
|
|
45
|
+
const t = await import("jspdf"), o = await import("jspdf-autotable"), r = t.default || t.jsPDF, l = new r(), p = o.default || o.autoTable, d = a.filter((s) => s.accessorKey || s.id).map((s) => s.header || s.accessorKey || s.id), i = e.map(
|
|
46
|
+
(s) => a.filter((m) => m.accessorKey || m.id).map((m) => {
|
|
47
|
+
const f = m.accessorKey ? s[m.accessorKey] : s[m.id];
|
|
48
|
+
return m.formatter ? m.formatter(f) : f;
|
|
49
|
+
})
|
|
50
|
+
);
|
|
51
|
+
p(l, {
|
|
52
|
+
head: [d],
|
|
53
|
+
body: i,
|
|
54
|
+
startY: 20,
|
|
55
|
+
styles: { fontSize: 8 },
|
|
56
|
+
headStyles: { fillColor: [66, 139, 202] }
|
|
57
|
+
}), l.save(`${n || u.filename}.pdf`);
|
|
58
|
+
} catch (t) {
|
|
59
|
+
throw console.error("Erreur lors de l'export PDF:", t), new Error("Les librairies jsPDF et jspdf-autotable ne sont pas disponibles");
|
|
60
|
+
}
|
|
61
|
+
}, [a, u.filename]), x = w((e, n) => {
|
|
62
|
+
const t = a.filter((p) => p.accessorKey || p.id).map((p) => p.accessorKey || p.id);
|
|
63
|
+
let o = `<?xml version="1.0" encoding="UTF-8"?>
|
|
64
|
+
<data>
|
|
65
|
+
`;
|
|
66
|
+
e.forEach((p, d) => {
|
|
67
|
+
o += ` <row id="${d}">
|
|
68
|
+
`, t.forEach((i) => {
|
|
69
|
+
const s = p[i], m = String(s || "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
70
|
+
o += ` <${i}>${m}</${i}>
|
|
71
|
+
`;
|
|
72
|
+
}), o += ` </row>
|
|
73
|
+
`;
|
|
74
|
+
}), o += "</data>";
|
|
75
|
+
const r = new Blob([o], { type: "application/xml" }), l = document.createElement("a");
|
|
76
|
+
l.href = URL.createObjectURL(r), l.download = `${n || u.filename}.xml`, l.click(), URL.revokeObjectURL(l.href);
|
|
77
|
+
}, [a, u.filename]), h = w(async (e, n, t) => {
|
|
78
|
+
const o = n || b, r = t || u.filename;
|
|
79
|
+
if (u.onExport) {
|
|
80
|
+
u.onExport(o, e);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
switch (e.toLowerCase()) {
|
|
84
|
+
case "csv":
|
|
85
|
+
v(o, r);
|
|
86
|
+
break;
|
|
87
|
+
case "json":
|
|
88
|
+
E(o, r);
|
|
89
|
+
break;
|
|
90
|
+
case "xlsx":
|
|
91
|
+
await k(o, r);
|
|
92
|
+
break;
|
|
93
|
+
case "pdf":
|
|
94
|
+
await L(o, r);
|
|
95
|
+
break;
|
|
96
|
+
case "xml":
|
|
97
|
+
x(o, r);
|
|
98
|
+
break;
|
|
99
|
+
default:
|
|
100
|
+
throw new Error(`Format d'export non supporté: ${e}`);
|
|
101
|
+
}
|
|
102
|
+
}, [b, u, v, E, k, L, x]), j = w(async (e) => h(e), [h]), c = w(async (e, n) => h(e, n), [h]);
|
|
103
|
+
return {
|
|
104
|
+
exportData: h,
|
|
105
|
+
exportAll: j,
|
|
106
|
+
exportSelected: c,
|
|
107
|
+
supportedFormats: u.formats,
|
|
108
|
+
isExportSupported: (e) => u.formats.includes(e)
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function U({
|
|
112
|
+
importConfig: b
|
|
113
|
+
}) {
|
|
114
|
+
const a = S(() => ({
|
|
115
|
+
accept: ".csv,.xlsx,.json,.xml",
|
|
116
|
+
...b
|
|
117
|
+
}), [b]), y = w((c, e = ",") => {
|
|
118
|
+
const n = c.split(`
|
|
119
|
+
`).filter((r) => r.trim());
|
|
120
|
+
if (n.length === 0) return [];
|
|
121
|
+
const t = n[0].split(e).map((r) => r.trim().replace(/"/g, ""));
|
|
122
|
+
return n.slice(1).map((r) => {
|
|
123
|
+
const l = r.split(e).map((d) => d.trim().replace(/"/g, "")), p = {};
|
|
124
|
+
return t.forEach((d, i) => {
|
|
125
|
+
p[d] = l[i] || "";
|
|
126
|
+
}), p;
|
|
127
|
+
});
|
|
128
|
+
}, []), u = w((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
|
+
}, []), v = w((c) => {
|
|
136
|
+
try {
|
|
137
|
+
const t = new DOMParser().parseFromString(c, "text/xml").querySelectorAll("row");
|
|
138
|
+
return Array.from(t).map((o) => {
|
|
139
|
+
const r = {};
|
|
140
|
+
return Array.from(o.children).forEach((l) => {
|
|
141
|
+
r[l.tagName] = l.textContent || "";
|
|
142
|
+
}), r;
|
|
143
|
+
});
|
|
144
|
+
} catch {
|
|
145
|
+
throw new Error("Format XML invalide");
|
|
146
|
+
}
|
|
147
|
+
}, []), E = w(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("./exceljs.min-KOayaaQ4.mjs").then((i) => i.e), n = await c.arrayBuffer(), t = new e.Workbook();
|
|
152
|
+
await t.xlsx.load(n);
|
|
153
|
+
const o = a.parseOptions?.xlsx?.sheetIndex ?? 0, r = a.parseOptions?.xlsx?.headerRow ?? 1, l = t.worksheets[o];
|
|
154
|
+
if (!l || l.rowCount === 0) return [];
|
|
155
|
+
const p = [];
|
|
156
|
+
l.getRow(r).eachCell((i, s) => {
|
|
157
|
+
p[s - 1] = String(i.value || "");
|
|
158
|
+
});
|
|
159
|
+
const d = [];
|
|
160
|
+
for (let i = r + 1; i <= l.rowCount; i++) {
|
|
161
|
+
const s = l.getRow(i), m = {};
|
|
162
|
+
p.forEach((f, g) => {
|
|
163
|
+
const R = s.getCell(g + 1);
|
|
164
|
+
m[f] = R.value ?? "";
|
|
165
|
+
}), d.push(m);
|
|
166
|
+
}
|
|
167
|
+
return d;
|
|
168
|
+
} catch {
|
|
169
|
+
throw new Error("Erreur lors du parsing du fichier XLSX. Verifiez que exceljs est installe: pnpm add exceljs");
|
|
170
|
+
}
|
|
171
|
+
}, [a.parseOptions?.xlsx?.sheetIndex, a.parseOptions?.xlsx?.headerRow]), k = w((c) => a.validate ? a.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"] }, [a.validate]), L = w((c) => a.columnMapping ? c.map((e) => {
|
|
172
|
+
const n = {};
|
|
173
|
+
return Object.entries(a.columnMapping).forEach(([t, o]) => {
|
|
174
|
+
e[t] !== void 0 && (n[o] = e[t]);
|
|
175
|
+
}), n;
|
|
176
|
+
}) : c, [a.columnMapping]), x = w(async (c) => {
|
|
177
|
+
const e = c.name.split(".").pop()?.toLowerCase();
|
|
178
|
+
let n = [];
|
|
179
|
+
try {
|
|
180
|
+
const t = await c.text();
|
|
181
|
+
switch (e) {
|
|
182
|
+
case "csv":
|
|
183
|
+
n = y(t, a.parseOptions?.csv?.delimiter);
|
|
184
|
+
break;
|
|
185
|
+
case "json":
|
|
186
|
+
n = u(t);
|
|
187
|
+
break;
|
|
188
|
+
case "xml":
|
|
189
|
+
n = v(t);
|
|
190
|
+
break;
|
|
191
|
+
case "xlsx":
|
|
192
|
+
n = await E(c);
|
|
193
|
+
break;
|
|
194
|
+
default:
|
|
195
|
+
throw new Error(`Format de fichier non supporté: ${e}`);
|
|
196
|
+
}
|
|
197
|
+
const o = k(n);
|
|
198
|
+
if (!o.valid)
|
|
199
|
+
throw new Error(`Données invalides: ${o.errors.join(", ")}`);
|
|
200
|
+
const r = L(n);
|
|
201
|
+
return a.onImport && a.onImport(r), r;
|
|
202
|
+
} catch (t) {
|
|
203
|
+
throw new Error(`Erreur lors de l'import: ${t instanceof Error ? t.message : "Erreur inconnue"}`);
|
|
204
|
+
}
|
|
205
|
+
}, [a, y, u, v, E, k, L]), h = w(() => {
|
|
206
|
+
const c = document.createElement("input");
|
|
207
|
+
return c.type = "file", c.accept = a.accept, c.multiple = !1, c;
|
|
208
|
+
}, [a.accept]), j = w(() => new Promise((c, e) => {
|
|
209
|
+
const n = h();
|
|
210
|
+
n.onchange = async (t) => {
|
|
211
|
+
const o = t.target.files?.[0];
|
|
212
|
+
if (!o) {
|
|
213
|
+
e(new Error("Aucun fichier sélectionné"));
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
try {
|
|
217
|
+
const r = await x(o);
|
|
218
|
+
c(r);
|
|
219
|
+
} catch (r) {
|
|
220
|
+
e(r);
|
|
221
|
+
}
|
|
222
|
+
}, n.click();
|
|
223
|
+
}), [h, x]);
|
|
224
|
+
return {
|
|
225
|
+
importData: x,
|
|
226
|
+
importWithUI: j,
|
|
227
|
+
supportedFormats: a.accept?.split(",") || [],
|
|
228
|
+
isFormatSupported: (c) => {
|
|
229
|
+
const e = c.split(".").pop()?.toLowerCase();
|
|
230
|
+
return a.accept?.includes(e || "") || !1;
|
|
231
|
+
}
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
export {
|
|
235
|
+
U as a,
|
|
236
|
+
D as u
|
|
237
|
+
};
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -3,3 +3,4 @@ export { tweak, type VariantProps } from './tweak';
|
|
|
3
3
|
export * from './datetime-helpers';
|
|
4
4
|
export { ThemeLoader, initThemeLoader, getThemeLoader, loadTheme, applyTheme, useThemeLoader } from './theme-loader';
|
|
5
5
|
export type { ThemeLoaderConfig } from './theme-loader';
|
|
6
|
+
export { logger, type Logger } from './logger';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wakastellar/ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Zero-config UI Library for Next.js with TweakCN theming and i18n support",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui",
|
|
@@ -107,15 +107,15 @@
|
|
|
107
107
|
"@tiptap/extension-underline": "^2.0.0 || ^3.0.0",
|
|
108
108
|
"@tiptap/react": "^2.0.0 || ^3.0.0",
|
|
109
109
|
"@tiptap/starter-kit": "^2.0.0 || ^3.0.0",
|
|
110
|
-
"
|
|
110
|
+
"exceljs": ">=4.3.0",
|
|
111
|
+
"jspdf": ">=4.1.0",
|
|
111
112
|
"jspdf-autotable": "*",
|
|
112
113
|
"next": ">=14.0.0",
|
|
113
114
|
"react": ">=18.0.0",
|
|
114
115
|
"react-dom": ">=18.0.0",
|
|
115
116
|
"react-hook-form": "^7.0.0",
|
|
116
117
|
"recharts": "^2.0.0",
|
|
117
|
-
"tailwindcss": ">=3.4.0 || >=4.0.0"
|
|
118
|
-
"xlsx": "*"
|
|
118
|
+
"tailwindcss": ">=3.4.0 || >=4.0.0"
|
|
119
119
|
},
|
|
120
120
|
"peerDependenciesMeta": {
|
|
121
121
|
"react-hook-form": {
|
|
@@ -139,7 +139,7 @@
|
|
|
139
139
|
"@tiptap/extension-underline": {
|
|
140
140
|
"optional": true
|
|
141
141
|
},
|
|
142
|
-
"
|
|
142
|
+
"exceljs": {
|
|
143
143
|
"optional": true
|
|
144
144
|
},
|
|
145
145
|
"jspdf": {
|
|
@@ -172,6 +172,7 @@
|
|
|
172
172
|
"@vitest/ui": "^3.2.4",
|
|
173
173
|
"autoprefixer": "^10.4.16",
|
|
174
174
|
"esbuild": "^0.25.0",
|
|
175
|
+
"install-peerdeps": "^3.0.7",
|
|
175
176
|
"jsdom": "^23.0.1",
|
|
176
177
|
"playwright": "^1.56.0",
|
|
177
178
|
"postcss": "^8.4.31",
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
import { AntivirusDashboard, defaultRecentScans, defaultWeeklyStats, defaultTopThreats } from "./index"
|
|
3
|
+
|
|
4
|
+
const meta: Meta<typeof AntivirusDashboard> = {
|
|
5
|
+
title: "Blocks/Antivirus/AntivirusDashboard",
|
|
6
|
+
component: AntivirusDashboard,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: "padded",
|
|
9
|
+
},
|
|
10
|
+
tags: ["autodocs"],
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default meta
|
|
14
|
+
type Story = StoryObj<typeof AntivirusDashboard>
|
|
15
|
+
|
|
16
|
+
export const Default: Story = {
|
|
17
|
+
args: {
|
|
18
|
+
serviceHealth: "healthy",
|
|
19
|
+
clamavVersion: "1.0.3",
|
|
20
|
+
signatureCount: 8642758,
|
|
21
|
+
lastSignatureUpdate: new Date(Date.now() - 2 * 3600000), // 2 hours ago
|
|
22
|
+
scansToday: 1096,
|
|
23
|
+
threatsDetected: 23,
|
|
24
|
+
quarantinedFiles: 15,
|
|
25
|
+
detectionRate: 2.1,
|
|
26
|
+
recentScans: defaultRecentScans,
|
|
27
|
+
weeklyStats: defaultWeeklyStats,
|
|
28
|
+
topThreats: defaultTopThreats,
|
|
29
|
+
onStartScan: () => console.log("Start scan clicked"),
|
|
30
|
+
onViewQuarantine: () => console.log("View quarantine clicked"),
|
|
31
|
+
},
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const Healthy: Story = {
|
|
35
|
+
args: {
|
|
36
|
+
serviceHealth: "healthy",
|
|
37
|
+
clamavVersion: "1.0.3",
|
|
38
|
+
signatureCount: 8642758,
|
|
39
|
+
lastSignatureUpdate: new Date(Date.now() - 30 * 60000), // 30 minutes ago
|
|
40
|
+
scansToday: 2456,
|
|
41
|
+
threatsDetected: 0,
|
|
42
|
+
quarantinedFiles: 0,
|
|
43
|
+
detectionRate: 0,
|
|
44
|
+
recentScans: [
|
|
45
|
+
{
|
|
46
|
+
id: "scan1",
|
|
47
|
+
filename: "document.pdf",
|
|
48
|
+
result: "clean",
|
|
49
|
+
scanDate: new Date(Date.now() - 5 * 60000),
|
|
50
|
+
duration: 234,
|
|
51
|
+
fileSize: 2048576,
|
|
52
|
+
userId: "user123",
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: "scan2",
|
|
56
|
+
filename: "report_2024.xlsx",
|
|
57
|
+
result: "clean",
|
|
58
|
+
scanDate: new Date(Date.now() - 15 * 60000),
|
|
59
|
+
duration: 567,
|
|
60
|
+
fileSize: 5242880,
|
|
61
|
+
userId: "user456",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "scan3",
|
|
65
|
+
filename: "presentation.pptx",
|
|
66
|
+
result: "clean",
|
|
67
|
+
scanDate: new Date(Date.now() - 25 * 60000),
|
|
68
|
+
duration: 892,
|
|
69
|
+
fileSize: 15728640,
|
|
70
|
+
userId: "user789",
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
weeklyStats: [
|
|
74
|
+
{ day: "Mon", scans: 345, threats: 0 },
|
|
75
|
+
{ day: "Tue", scans: 398, threats: 0 },
|
|
76
|
+
{ day: "Wed", scans: 267, threats: 0 },
|
|
77
|
+
{ day: "Thu", scans: 423, threats: 0 },
|
|
78
|
+
{ day: "Fri", scans: 389, threats: 0 },
|
|
79
|
+
{ day: "Sat", scans: 198, threats: 0 },
|
|
80
|
+
{ day: "Sun", scans: 176, threats: 0 },
|
|
81
|
+
],
|
|
82
|
+
topThreats: [],
|
|
83
|
+
onStartScan: () => console.log("Start scan clicked"),
|
|
84
|
+
onViewQuarantine: () => console.log("View quarantine clicked"),
|
|
85
|
+
},
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const HighThreatActivity: Story = {
|
|
89
|
+
args: {
|
|
90
|
+
serviceHealth: "degraded",
|
|
91
|
+
clamavVersion: "1.0.3",
|
|
92
|
+
signatureCount: 8642758,
|
|
93
|
+
lastSignatureUpdate: new Date(Date.now() - 4 * 3600000), // 4 hours ago
|
|
94
|
+
scansToday: 892,
|
|
95
|
+
threatsDetected: 47,
|
|
96
|
+
quarantinedFiles: 38,
|
|
97
|
+
detectionRate: 5.3,
|
|
98
|
+
recentScans: [
|
|
99
|
+
{
|
|
100
|
+
id: "scan1",
|
|
101
|
+
filename: "suspicious_archive.zip",
|
|
102
|
+
result: "infected",
|
|
103
|
+
threatName: "Win.Trojan.Genome-9999999",
|
|
104
|
+
scanDate: new Date(Date.now() - 2 * 60000),
|
|
105
|
+
duration: 1234,
|
|
106
|
+
fileSize: 10485760,
|
|
107
|
+
userId: "user321",
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: "scan2",
|
|
111
|
+
filename: "malicious_script.js",
|
|
112
|
+
result: "infected",
|
|
113
|
+
threatName: "Trojan.GenericKD.67890123",
|
|
114
|
+
scanDate: new Date(Date.now() - 5 * 60000),
|
|
115
|
+
duration: 156,
|
|
116
|
+
fileSize: 45678,
|
|
117
|
+
userId: "user456",
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: "scan3",
|
|
121
|
+
filename: "infected_document.docx",
|
|
122
|
+
result: "infected",
|
|
123
|
+
threatName: "W97M.Downloader",
|
|
124
|
+
scanDate: new Date(Date.now() - 8 * 60000),
|
|
125
|
+
duration: 678,
|
|
126
|
+
fileSize: 2048576,
|
|
127
|
+
userId: "user789",
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
id: "scan4",
|
|
131
|
+
filename: "phishing_page.html",
|
|
132
|
+
result: "infected",
|
|
133
|
+
threatName: "HTML.Phishing.Bank-12345",
|
|
134
|
+
scanDate: new Date(Date.now() - 12 * 60000),
|
|
135
|
+
duration: 234,
|
|
136
|
+
fileSize: 15678,
|
|
137
|
+
userId: "user123",
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
id: "scan5",
|
|
141
|
+
filename: "backdoor.exe",
|
|
142
|
+
result: "infected",
|
|
143
|
+
threatName: "Backdoor.Meterpreter",
|
|
144
|
+
scanDate: new Date(Date.now() - 15 * 60000),
|
|
145
|
+
duration: 445,
|
|
146
|
+
fileSize: 524288,
|
|
147
|
+
userId: "user654",
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
weeklyStats: [
|
|
151
|
+
{ day: "Mon", scans: 245, threats: 18 },
|
|
152
|
+
{ day: "Tue", scans: 298, threats: 25 },
|
|
153
|
+
{ day: "Wed", scans: 267, threats: 12 },
|
|
154
|
+
{ day: "Thu", scans: 323, threats: 38 },
|
|
155
|
+
{ day: "Fri", scans: 289, threats: 29 },
|
|
156
|
+
{ day: "Sat", scans: 198, threats: 15 },
|
|
157
|
+
{ day: "Sun", scans: 176, threats: 8 },
|
|
158
|
+
],
|
|
159
|
+
topThreats: [
|
|
160
|
+
{ name: "Win.Trojan.Genome-9999999", count: 15, severity: "critical" },
|
|
161
|
+
{ name: "Trojan.GenericKD.67890123", count: 12, severity: "high" },
|
|
162
|
+
{ name: "Backdoor.Meterpreter", count: 9, severity: "critical" },
|
|
163
|
+
{ name: "W97M.Downloader", count: 7, severity: "high" },
|
|
164
|
+
{ name: "HTML.Phishing.Bank-12345", count: 5, severity: "medium" },
|
|
165
|
+
{ name: "JS.Downloader.Nemucod", count: 4, severity: "medium" },
|
|
166
|
+
{ name: "PHP.Webshell.Generic", count: 3, severity: "high" },
|
|
167
|
+
],
|
|
168
|
+
onStartScan: () => console.log("Start scan clicked"),
|
|
169
|
+
onViewQuarantine: () => console.log("View quarantine clicked"),
|
|
170
|
+
},
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export const ServiceDown: Story = {
|
|
174
|
+
args: {
|
|
175
|
+
serviceHealth: "down",
|
|
176
|
+
clamavVersion: "1.0.3",
|
|
177
|
+
signatureCount: 8642758,
|
|
178
|
+
lastSignatureUpdate: new Date(Date.now() - 24 * 3600000), // 1 day ago
|
|
179
|
+
scansToday: 0,
|
|
180
|
+
threatsDetected: 0,
|
|
181
|
+
quarantinedFiles: 15,
|
|
182
|
+
detectionRate: 0,
|
|
183
|
+
recentScans: [],
|
|
184
|
+
weeklyStats: [
|
|
185
|
+
{ day: "Mon", scans: 0, threats: 0 },
|
|
186
|
+
{ day: "Tue", scans: 0, threats: 0 },
|
|
187
|
+
{ day: "Wed", scans: 0, threats: 0 },
|
|
188
|
+
{ day: "Thu", scans: 0, threats: 0 },
|
|
189
|
+
{ day: "Fri", scans: 0, threats: 0 },
|
|
190
|
+
{ day: "Sat", scans: 0, threats: 0 },
|
|
191
|
+
{ day: "Sun", scans: 0, threats: 0 },
|
|
192
|
+
],
|
|
193
|
+
topThreats: [],
|
|
194
|
+
onStartScan: () => console.log("Start scan clicked"),
|
|
195
|
+
onViewQuarantine: () => console.log("View quarantine clicked"),
|
|
196
|
+
},
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export const WithoutActions: Story = {
|
|
200
|
+
args: {
|
|
201
|
+
serviceHealth: "healthy",
|
|
202
|
+
clamavVersion: "1.0.3",
|
|
203
|
+
signatureCount: 8642758,
|
|
204
|
+
lastSignatureUpdate: new Date(Date.now() - 1 * 3600000),
|
|
205
|
+
scansToday: 567,
|
|
206
|
+
threatsDetected: 12,
|
|
207
|
+
quarantinedFiles: 8,
|
|
208
|
+
detectionRate: 2.1,
|
|
209
|
+
recentScans: defaultRecentScans,
|
|
210
|
+
weeklyStats: defaultWeeklyStats,
|
|
211
|
+
topThreats: defaultTopThreats,
|
|
212
|
+
},
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export const RealWorldScenario: Story = {
|
|
216
|
+
args: {
|
|
217
|
+
serviceHealth: "healthy",
|
|
218
|
+
clamavVersion: "1.0.3",
|
|
219
|
+
signatureCount: 8642758,
|
|
220
|
+
lastSignatureUpdate: new Date(Date.now() - 45 * 60000),
|
|
221
|
+
scansToday: 3247,
|
|
222
|
+
threatsDetected: 8,
|
|
223
|
+
quarantinedFiles: 6,
|
|
224
|
+
detectionRate: 0.25,
|
|
225
|
+
recentScans: [
|
|
226
|
+
{
|
|
227
|
+
id: "scan1",
|
|
228
|
+
filename: "invoice_2024_Q1.pdf",
|
|
229
|
+
result: "clean",
|
|
230
|
+
scanDate: new Date(Date.now() - 1 * 60000),
|
|
231
|
+
duration: 189,
|
|
232
|
+
fileSize: 1048576,
|
|
233
|
+
userId: "accounting@company.com",
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
id: "scan2",
|
|
237
|
+
filename: "company_presentation.pptx",
|
|
238
|
+
result: "clean",
|
|
239
|
+
scanDate: new Date(Date.now() - 3 * 60000),
|
|
240
|
+
duration: 1234,
|
|
241
|
+
fileSize: 25165824,
|
|
242
|
+
userId: "sales@company.com",
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
id: "scan3",
|
|
246
|
+
filename: "suspicious_email_attachment.zip",
|
|
247
|
+
result: "infected",
|
|
248
|
+
threatName: "Trojan.GenericKD.67890123",
|
|
249
|
+
scanDate: new Date(Date.now() - 8 * 60000),
|
|
250
|
+
duration: 567,
|
|
251
|
+
fileSize: 3145728,
|
|
252
|
+
userId: "it@company.com",
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
id: "scan4",
|
|
256
|
+
filename: "employee_records.xlsx",
|
|
257
|
+
result: "clean",
|
|
258
|
+
scanDate: new Date(Date.now() - 12 * 60000),
|
|
259
|
+
duration: 345,
|
|
260
|
+
fileSize: 2097152,
|
|
261
|
+
userId: "hr@company.com",
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
id: "scan5",
|
|
265
|
+
filename: "test_eicar.txt",
|
|
266
|
+
result: "infected",
|
|
267
|
+
threatName: "Eicar-Test-Signature",
|
|
268
|
+
scanDate: new Date(Date.now() - 20 * 60000),
|
|
269
|
+
duration: 45,
|
|
270
|
+
fileSize: 68,
|
|
271
|
+
userId: "security@company.com",
|
|
272
|
+
},
|
|
273
|
+
],
|
|
274
|
+
weeklyStats: [
|
|
275
|
+
{ day: "Mon", scans: 456, threats: 2 },
|
|
276
|
+
{ day: "Tue", scans: 512, threats: 3 },
|
|
277
|
+
{ day: "Wed", scans: 489, threats: 1 },
|
|
278
|
+
{ day: "Thu", scans: 534, threats: 4 },
|
|
279
|
+
{ day: "Fri", scans: 623, threats: 5 },
|
|
280
|
+
{ day: "Sat", scans: 278, threats: 0 },
|
|
281
|
+
{ day: "Sun", scans: 198, threats: 1 },
|
|
282
|
+
],
|
|
283
|
+
topThreats: [
|
|
284
|
+
{ name: "Trojan.GenericKD.67890123", count: 4, severity: "high" },
|
|
285
|
+
{ name: "Eicar-Test-Signature", count: 3, severity: "low" },
|
|
286
|
+
{ name: "JS.Downloader.Nemucod", count: 2, severity: "medium" },
|
|
287
|
+
],
|
|
288
|
+
onStartScan: () => console.log("Start scan clicked"),
|
|
289
|
+
onViewQuarantine: () => console.log("View quarantine clicked"),
|
|
290
|
+
},
|
|
291
|
+
}
|