@tantainnovative/ndpr-toolkit
Version:
Nigeria Data Protection Toolkit — enterprise-grade compliance components for the Nigeria Data Protection Act (NDPA) 2023
2 lines • 7.04 kB
JavaScript
"use client";
import {b,d}from'./chunk-XP5PL6K7.mjs';export{b as generateROPASummary,d as identifyComplianceGaps}from'./chunk-XP5PL6K7.mjs';import {a}from'./chunk-SFGW37LE.mjs';import {c}from'./chunk-PHA3YMFO.mjs';import'./chunk-5LJ652AH.mjs';import'./chunk-ZJYULEER.mjs';import {useMemo}from'react';import {jsxs,jsx}from'react/jsx-runtime';var w={consent:"Consent",contract:"Contract",legal_obligation:"Legal Obligation",vital_interests:"Vital Interests",public_interest:"Public Interest",legitimate_interests:"Legitimate Interests"},B=["consent","contract","legal_obligation","vital_interests","public_interest","legitimate_interests"],k={active:"ndpr-badge ndpr-badge--success",inactive:"ndpr-badge ndpr-badge--warning",archived:"bg-gray-100 text-gray-800 dark:bg-gray-700 dark:text-gray-300"},N={active:"Active",inactive:"Inactive",archived:"Archived"};function C(i){return i?new Date(i).toLocaleDateString():"N/A"}function G(i){return !!i.nextReviewDate&&i.nextReviewDate<=Date.now()}var I=({ropa:i,title:u,description:b$1,className:P="",classNames:t,unstyled:d$1,showSummary:L=true,showComplianceGaps:D=true,onRecordClick:l})=>{var R,y;let _=c(),O=(R=u!=null?u:_.ropa.title)!=null?R:"Record of Processing Activities (ROPA)",S=(y=b$1!=null?b$1:_.ropa.description)!=null?y:"Maintain a comprehensive record of all data processing activities as required by the NDPA accountability principle.",x=i.records,s=useMemo(()=>b(i),[i]),g=useMemo(()=>d(i),[i]);return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${P}`,t==null?void 0:t.root,d$1),children:[jsxs("div",{className:a("",t==null?void 0:t.header,d$1),children:[jsx("h2",{className:a("ndpr-section-heading",t==null?void 0:t.title,d$1),children:O}),jsx("p",{className:"ndpr-card__subtitle",children:S})]}),L&&jsxs("div",{className:a("mb-6",t==null?void 0:t.summary,d$1),children:[jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-4",children:[["p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md text-center","ndpr-text-info","Total Records",s.totalRecords,false],["p-4 bg-green-50 dark:bg-green-900/20 rounded-md text-center","ndpr-text-success","Active",s.activeRecords,false],["p-4 bg-purple-50 dark:bg-purple-900/20 rounded-md text-center","ndpr-text-info","Cross-Border",s.crossBorderRecords,false],["p-4 bg-orange-50 dark:bg-orange-900/20 rounded-md text-center","ndpr-text-warning","Records with Gaps",g.length,true]].map(([r,o,p,c,m])=>jsxs("div",{className:a(r,t==null?void 0:t.summaryCard,d$1),children:[jsx("p",{className:m?a(`ndpr-stat__value ${o}`,t==null?void 0:t.complianceScore,d$1):`ndpr-stat__value ${o}`,children:c}),jsx("p",{className:`text-xs ${o}`,children:p})]},p))}),jsxs("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4 mb-4",children:[jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"ndpr-form-field__label",children:"By Lawful Basis"}),B.map(r=>jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:w[r]}),jsx("span",{className:"font-medium",children:s.byLawfulBasis[r]||0})]},r))]}),jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"ndpr-form-field__label",children:"Risk Indicators"}),[["Sensitive Data",s.sensitiveDataRecords,false],["DPIA Required",s.dpiaRequiredRecords,false],["Automated Decisions",s.automatedDecisionRecords,false],["Due for Review",s.recordsDueForReview.length,s.recordsDueForReview.length>0]].map(([r,o,p])=>jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:r}),jsx("span",{className:`font-medium ${p?"ndpr-text-destructive":""}`,children:o})]},r))]}),s.topDepartments.length>0&&jsxs("div",{className:"ndpr-panel",children:[jsx("p",{className:"ndpr-form-field__label",children:"Top Departments"}),s.topDepartments.slice(0,5).map(r=>jsxs("div",{className:"flex justify-between text-xs mb-1",children:[jsx("span",{className:"ndpr-card__subtitle",children:r.department}),jsx("span",{className:"font-medium",children:r.count})]},r.department))]})]})]}),D&&g.length>0&&jsxs("div",{className:a("p-3 bg-red-50 dark:bg-red-900/20 rounded-md mb-6",t==null?void 0:t.gapAlert,d$1),role:"status","aria-live":"polite",children:[jsx("p",{className:"text-sm font-medium ndpr-text-destructive mb-2",children:"Compliance Gaps Detected"}),g.slice(0,5).map(r=>jsxs("div",{className:"mb-2",children:[jsx("p",{className:"text-xs font-medium ndpr-text-destructive",children:r.recordName}),jsx("ul",{className:"list-disc list-inside",children:r.gaps.map((o,p)=>jsx("li",{className:"text-xs ndpr-text-destructive",children:o},p))})]},r.recordId)),g.length>5&&jsxs("p",{className:"text-xs ndpr-text-destructive mt-1",children:["...and ",g.length-5," more record(s) with gaps."]})]}),x.length===0?jsx("p",{className:"ndpr-empty-state",children:"No processing records found."}):jsx("div",{className:"overflow-x-auto",children:jsxs("table",{className:a("w-full text-sm text-left",t==null?void 0:t.table,d$1),children:[jsx("thead",{className:a("ndpr-table__head",t==null?void 0:t.tableHeader,d$1),children:jsxs("tr",{children:[jsx("th",{className:"ndpr-table__cell",children:"Name"}),jsx("th",{className:"ndpr-table__cell",children:"Lawful Basis"}),jsx("th",{className:"ndpr-table__cell",children:"Data Categories"}),jsx("th",{className:"ndpr-table__cell",children:"Retention"}),jsx("th",{className:"ndpr-table__cell",children:"Status"}),jsx("th",{className:"ndpr-table__cell",children:"Last Reviewed"})]})}),jsx("tbody",{children:x.map(r=>{let o=G(r),p=g.some(m=>m.recordId===r.id),c=!!l;return jsxs("tr",{onClick:c?()=>l==null?void 0:l(r):void 0,role:c?"button":void 0,tabIndex:c?0:void 0,onKeyDown:c?m=>{(m.key==="Enter"||m.key===" ")&&(m.preventDefault(),l==null||l(r));}:void 0,className:a(`border-b dark:border-gray-600 ${o?"bg-red-50 dark:bg-red-900/10":p?"bg-yellow-50 dark:bg-yellow-900/10":"bg-white dark:bg-gray-800"} ${c?"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700":""}`,t==null?void 0:t.tableRow,d$1),children:[jsx("td",{className:"ndpr-table__cell",children:jsxs("div",{children:[jsx("p",{className:"font-medium",children:r.name}),r.department&&jsx("p",{className:"ndpr-form-field__hint",children:r.department}),o&&jsx("span",{className:"text-xs ndpr-text-destructive font-medium",children:"Review Overdue"})]})}),jsx("td",{className:"ndpr-table__cell",children:jsx("span",{className:"ndpr-badge ndpr-badge--info",children:w[r.lawfulBasis]})}),jsx("td",{className:"ndpr-table__cell",children:jsx("p",{className:"text-xs ndpr-text-muted max-w-xs truncate",children:r.dataCategories.join(", ")})}),jsx("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:r.retentionPeriod||"N/A"}),jsx("td",{className:"ndpr-table__cell",children:jsx("span",{className:a(`px-2 py-1 rounded text-xs font-medium ${k[r.status]}`,t==null?void 0:t.statusBadge,d$1),children:N[r.status]})}),jsx("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:C(r.lastReviewedAt)})]},r.id)})})]})})]})};export{I as ROPAManagerLite};