@jarllyng/nostromo 3.12.2 → 3.14.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/chunk-CH5LTBAG.js +3 -0
- package/dist/chunk-CH5LTBAG.js.map +1 -0
- package/dist/chunk-HCO4XKPM.js +3 -0
- package/dist/chunk-HCO4XKPM.js.map +1 -0
- package/dist/chunk-JTHW25XF.cjs +3 -0
- package/dist/chunk-JTHW25XF.cjs.map +1 -0
- package/dist/chunk-KASVYULP.cjs +3 -0
- package/dist/chunk-KASVYULP.cjs.map +1 -0
- package/dist/chunk-UC577SR4.cjs +3 -0
- package/dist/chunk-UC577SR4.cjs.map +1 -0
- package/dist/chunk-YC6ALHAZ.js +3 -0
- package/dist/chunk-YC6ALHAZ.js.map +1 -0
- package/dist/components/core/data-table.cjs +1 -1
- package/dist/components/core/data-table.d.cts +22 -1
- package/dist/components/core/data-table.d.ts +22 -1
- package/dist/components/core/data-table.js +1 -1
- package/dist/components/core/table.cjs +1 -1
- package/dist/components/core/table.d.cts +10 -0
- package/dist/components/core/table.d.ts +10 -0
- package/dist/components/core/table.js +1 -1
- package/dist/components/core/toast.cjs +1 -1
- package/dist/components/core/toast.d.cts +59 -1
- package/dist/components/core/toast.d.ts +59 -1
- package/dist/components/core/toast.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
- package/dist/chunk-5Z3MYAVM.cjs +0 -3
- package/dist/chunk-5Z3MYAVM.cjs.map +0 -1
- package/dist/chunk-AYEM2M4H.cjs +0 -3
- package/dist/chunk-AYEM2M4H.cjs.map +0 -1
- package/dist/chunk-UIEGBT4T.js +0 -3
- package/dist/chunk-UIEGBT4T.js.map +0 -1
- package/dist/chunk-VNDL67OG.cjs +0 -3
- package/dist/chunk-VNDL67OG.cjs.map +0 -1
- package/dist/chunk-WO3KCAN6.js +0 -3
- package/dist/chunk-WO3KCAN6.js.map +0 -1
- package/dist/chunk-XJJJEWSU.js +0 -3
- package/dist/chunk-XJJJEWSU.js.map +0 -1
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {a as a$1}from'./chunk-COXN6XBA.js';import {a}from'./chunk-AC2JBXHQ.js';import t,{useState,useEffect,useRef,useCallback}from'react';import {cva}from'class-variance-authority';var $=cva("relative flex items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all duration-300",{variants:{variant:{default:"border-border bg-card text-card-foreground shadow-lg hover:shadow-xl",success:"border-success-200 bg-success-50 text-success-900 shadow-lg hover:shadow-xl",error:"border-destructive/20 bg-destructive/10 text-destructive shadow-lg hover:shadow-xl",warning:"border-warning-200 bg-warning-50 text-warning-900 shadow-lg hover:shadow-xl",info:"border-info-200 bg-info-50 text-info-900 shadow-lg hover:shadow-xl"},position:{"top-left":"fixed top-4 left-4 z-50 w-[calc(100vw-2rem)] max-w-sm","top-center":"fixed top-4 left-1/2 -translate-x-1/2 z-50 w-[calc(100vw-2rem)] max-w-sm","top-right":"fixed top-4 right-4 z-50 w-[calc(100vw-2rem)] max-w-sm","bottom-left":"fixed bottom-4 left-4 z-50 w-[calc(100vw-2rem)] max-w-sm","bottom-center":"fixed bottom-4 left-1/2 -translate-x-1/2 z-50 w-[calc(100vw-2rem)] max-w-sm","bottom-right":"fixed bottom-4 right-4 z-50 w-[calc(100vw-2rem)] max-w-sm"},animation:{default:"animate-in slide-in-from-right-full duration-300",slide:"animate-in slide-in-from-bottom-4 duration-300",fade:"animate-in fade-in-0 duration-300",scale:"animate-in zoom-in-95 duration-300",none:""}},defaultVariants:{variant:"default",position:"top-right",animation:"default"}}),b=cva("flex-shrink-0 w-5 h-5 transition-colors duration-200",{variants:{variant:{default:"text-muted-foreground",success:"text-success-600",error:"text-destructive",warning:"text-warning-600",info:"text-info-600"}},defaultVariants:{variant:"default"}}),B=t.createContext(void 0),H=t.createContext(false),q=()=>{let n=t.useContext(B);if(!n)throw new Error("useToast must be used within a ToastProvider");return n},A=0,D=()=>`toast-${++A}`,et=({children:n})=>{let[c,d]=useState([]),[l,s]=useState(()=>new Set),r=useRef(new Map),i=useCallback(e=>{let o=r.current.get(e);o&&(clearTimeout(o),r.current.delete(e));},[]),u=useCallback(e=>{i(e),s(o=>{if(o.has(e))return o;let a=new Set(o);return a.add(e),a});},[i]),g=useCallback(e=>{i(e),d(o=>o.filter(a=>a.id!==e)),s(o=>{if(!o.has(e))return o;let a=new Set(o);return a.delete(e),a});},[i]),T=useRef(u);useEffect(()=>{T.current=u;},[u]);let C=useCallback(e=>{let o=D(),a={...e,id:o};if(d(m=>[...m,a]),e.duration!==0){let m=setTimeout(()=>{T.current(o);},e.duration||5e3);r.current.set(o,m);}return o},[]),f=useCallback(()=>{r.current.forEach(e=>clearTimeout(e)),r.current.clear(),d(e=>(s(new Set(e.map(o=>o.id))),e));},[]);return useEffect(()=>{let e=r.current;return ()=>{e.forEach(o=>clearTimeout(o)),e.clear();}},[]),t.createElement(B.Provider,{value:{toasts:c,addToast:C,removeToast:u,clearToasts:f}},n,t.createElement(J,{toasts:c,dismissing:l,onExited:g}))},U={"top-left":"top-4 left-4 flex-col","top-center":"top-4 left-1/2 -translate-x-1/2 flex-col","top-right":"top-4 right-4 flex-col","bottom-left":"bottom-4 left-4 flex-col-reverse","bottom-center":"bottom-4 left-1/2 -translate-x-1/2 flex-col-reverse","bottom-right":"bottom-4 right-4 flex-col-reverse"},G=({position:n,children:c})=>t.createElement(H.Provider,{value:true},t.createElement("ol",{"data-toast-viewport":n,className:a("pointer-events-none fixed z-50 flex w-[calc(100vw-2rem)] max-w-sm gap-2 m-0 list-none p-0",U[n])},c)),J=({toasts:n,dismissing:c,onExited:d})=>{if(n.length===0)return null;let l=n.reduce((s,r)=>{let i=r.position??"top-right";return (s[i]??=[]).push(r),s},{});return t.createElement(t.Fragment,null,Object.entries(l).map(([s,r])=>t.createElement(G,{key:s,position:s},r.map(i=>t.createElement("li",{key:i.id,className:"contents"},t.createElement(K,{...i,dismissing:c.has(i.id),onExited:()=>d(i.id)}))))))},F=t.forwardRef(({id:n,title:c,description:d,variant:l="default",position:s="top-right",animation:r="default",duration:i=5e3,onClose:u,action:g,className:T,children:C,appearDelay:f=10,animationMs:e=150,dismissing:o=false,onExited:a$1,...m},j)=>{let h=t.useContext(H),[V,L]=useState(f<=0),[y,W]=useState(false);useEffect(()=>{if(f<=0)return;let N=window.setTimeout(()=>L(true),f);return ()=>clearTimeout(N)},[f]);let M=useRef(false),S=useRef(u),E=useRef(a$1);useEffect(()=>{S.current=u,E.current=a$1;},[u,a$1]);let x=useCallback(()=>{M.current||(M.current=true,W(true),window.setTimeout(()=>{S.current?.(),L(false),E.current?.();},e));},[e]);useEffect(()=>{o&&x();},[o,x]),useEffect(()=>{if(!h&&i>0){let N=window.setTimeout(x,i);return ()=>clearTimeout(N)}},[h,i,x]);let X=()=>{switch(l){case "success":return t.createElement("svg",{className:b({variant:l}),fill:"currentColor",viewBox:"0 0 20 20"},t.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"}));case "error":return t.createElement("svg",{className:b({variant:l}),fill:"currentColor",viewBox:"0 0 20 20"},t.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"}));case "warning":return t.createElement("svg",{className:b({variant:l}),fill:"currentColor",viewBox:"0 0 20 20"},t.createElement("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"}));case "info":return t.createElement("svg",{className:b({variant:l}),fill:"currentColor",viewBox:"0 0 20 20"},t.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"}));default:return null}};if(!V)return null;let I=l==="error",{style:O,..._}=m;return t.createElement("div",{ref:j,role:m.role??(I?"alert":"status"),"aria-live":m["aria-live"]??(I?"assertive":"polite"),"aria-atomic":m["aria-atomic"]??true,className:a($({variant:l,position:h?null:s,animation:r}),h&&"w-full",y?"opacity-0":"opacity-100","pointer-events-auto",T),"data-visible":V?"true":"false","data-leaving":y?"true":"false",..._,style:{transition:`all ${e}ms ease-in-out`,...O,transform:y?"translateX(100%)":O?.transform??"translateX(0)"}},t.createElement("div",{className:"flex items-start space-x-3"},X(),t.createElement("div",{className:"flex-1 min-w-0"},c&&t.createElement("div",{className:"text-sm font-medium"},c),d&&t.createElement("div",{className:"mt-1 text-sm opacity-90"},d),C)),g&&t.createElement("button",{type:"button",onClick:g.onClick,className:"ml-4 text-sm font-medium underline hover:no-underline focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-ring"},g.label),t.createElement("button",{type:"button",onClick:x,className:"absolute top-2 right-2 p-1 rounded-md hover:bg-muted focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-ring","aria-label":"Close notification"},t.createElement("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20"},t.createElement("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"}))))});F.displayName="Toast";var K=a$1(F),ot=()=>{let{addToast:n,removeToast:c,clearToasts:d}=q();return {success:(s,r)=>n({variant:"success",title:"Success",description:s,...r}),error:(s,r)=>n({variant:"error",title:"Error",description:s,...r}),warning:(s,r)=>n({variant:"warning",title:"Warning",description:s,...r}),info:(s,r)=>n({variant:"info",title:"Info",description:s,...r}),custom:s=>n(s),dismiss:c,clear:d}};export{$ as a,b,q as c,et as d,K as e,ot as f};//# sourceMappingURL=chunk-CH5LTBAG.js.map
|
|
3
|
+
//# sourceMappingURL=chunk-CH5LTBAG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/core/toast.tsx"],"names":["toastVariants","cva","toastIconVariants","ToastContext","React","ToastViewportContext","useToast","context","toastSequence","nextToastId","ToastProvider","children","toasts","setToasts","useState","dismissing","setDismissing","timeoutRefs","useRef","clearTimer","useCallback","id","timeoutId","removeToast","prev","next","finalize","toast","removeToastRef","useEffect","addToast","newToast","clearToasts","refs","ToastContainer","VIEWPORT_POSITIONS","ToastViewport","position","cn","onExited","toastsByPosition","acc","positionToasts","Toast","ToastComponent","_id","title","description","variant","animation","duration","onClose","action","className","appearDelay","animationMs","props","ref","contained","isVisible","setIsVisible","isLeaving","setIsLeaving","timer","closedRef","onCloseRef","onExitedRef","handleClose","getIcon","isUrgent","callerStyle","restProps","memo","useToastNotification","message","options"],"mappings":"sLAwDA,IAAMA,CAAAA,CAAgBC,GAAAA,CACpB,uIAAA,CACA,CACE,QAAA,CAAU,CACR,OAAA,CAAS,CACP,OAAA,CACE,sEAAA,CACF,OAAA,CACE,6EAAA,CACF,KAAA,CACE,oFAAA,CACF,OAAA,CACE,6EAAA,CACF,KAAM,oEACR,CAAA,CAMA,QAAA,CAAU,CACR,UAAA,C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AAS,CACPoE,CAAAA,CACAC,CAAAA,GAEA7C,CAAAA,CAAS,CACP,OAAA,CAAS,UACT,KAAA,CAAO,SAAA,CACP,WAAA,CAAa4C,CAAAA,CACb,GAAGC,CACL,CAAC,CAAA,CAEH,MAAO,CAACD,CAAAA,CAAiBC,CAAAA,GACvB7C,CAAAA,CAAS,CACP,OAAA,CAAS,OAAA,CACT,KAAA,CAAO,QACP,WAAA,CAAa4C,CAAAA,CACb,GAAGC,CACL,CAAC,CAAA,CAEH,OAAA,CAAS,CACPD,CAAAA,CACAC,IAEA7C,CAAAA,CAAS,CACP,OAAA,CAAS,SAAA,CACT,KAAA,CAAO,SAAA,CACP,WAAA,CAAa4C,CAAAA,CACb,GAAGC,CACL,CAAC,CAAA,CAEH,IAAA,CAAM,CAACD,CAAAA,CAAiBC,CAAAA,GACtB7C,CAAAA,CAAS,CACP,OAAA,CAAS,MAAA,CACT,KAAA,CAAO,MAAA,CACP,WAAA,CAAa4C,CAAAA,CACb,GAAGC,CACL,CAAC,CAAA,CAEH,MAAA,CAAShD,CAAAA,EAAkCG,CAAAA,CAASH,CAAK,CAAA,CAEzD,OAAA,CAASJ,CAAAA,CACT,KAAA,CAAOS,CACT,CAGF","file":"chunk-CH5LTBAG.js","sourcesContent":["import React, { useState, useEffect, useCallback, useRef } from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/utils\";\nimport { memo } from \"../../lib/memo\";\n\n/**\n * Notifications, and the provider that owns them.\n *\n * Three things about this component are worth reading before changing it.\n *\n * ## The viewport positions, the toast does not\n *\n * A `ToastProvider` renders one `ToastViewport` per position: a fixed, bounded\n * column that stacks its children in normal flex flow with a gap. The toasts\n * inside it are ordinary block elements.\n *\n * Every toast used to position itself instead, with `fixed right-4` plus `w-full`\n * and a `translateY(index * 8px)` for stacking. Both halves were wrong. `w-full`\n * against a fixed right offset made a 1200px-wide box starting at x=-16, so the\n * notification ran off the left edge of the window; and 8px of offset for a box\n * about 94px tall meant the second notification covered nearly all of the first.\n *\n * A standalone `<Toast position=\"top-right\">` still positions itself, because\n * that is a supported way to use it. `ToastViewportContext` is how a toast knows\n * which of the two it is in.\n *\n * ## One dismissal path\n *\n * Closing a toast used to leave it in the provider's `toasts` array forever: the\n * component unmounted itself and nothing told the provider. A persistent toast\n * dismissed ten times left ten invisible entries behind.\n *\n * Now every route - the close button, the timeout, `dismiss(id)`, `clear()` -\n * goes through the same two steps. `removeToast` marks the toast as dismissing,\n * which starts its exit animation; when the animation ends the toast reports back\n * and the provider drops it from state. `onClose` fires exactly once, guarded by\n * a ref, whichever route was taken.\n *\n * There is also exactly one timer per toast. Inside a viewport the provider owns\n * it; standalone, the toast owns its own. Previously both ran, and the provider's\n * could remove a toast before its own exit finished.\n *\n * ## Announcement is the default, not an opt-in\n *\n * A toast carries `role=\"status\"` and `aria-live=\"polite\"`, or `role=\"alert\"` and\n * `aria-live=\"assertive\"` for the error variant, so a message that appears\n * without warning is announced without the caller arranging anything. It is also\n * `aria-atomic`, so the title and description are read as one message rather than\n * as two arrivals. Pass `role` or `aria-live` to override either.\n *\n * Focus is deliberately not moved. A notification that steals focus interrupts\n * whatever the reader was doing, which is worse than the problem it solves; the\n * close button and any action stay reachable by Tab.\n */\n\n// Toast variants\nconst toastVariants = cva(\n \"relative flex items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all duration-300\",\n {\n variants: {\n variant: {\n default:\n \"border-border bg-card text-card-foreground shadow-lg hover:shadow-xl\",\n success:\n \"border-success-200 bg-success-50 text-success-900 shadow-lg hover:shadow-xl\",\n error:\n \"border-destructive/20 bg-destructive/10 text-destructive shadow-lg hover:shadow-xl\",\n warning:\n \"border-warning-200 bg-warning-50 text-warning-900 shadow-lg hover:shadow-xl\",\n info: \"border-info-200 bg-info-50 text-info-900 shadow-lg hover:shadow-xl\",\n },\n // Only applied when the toast is positioning itself. Inside a viewport the\n // column owns the position and the toast just fills its width.\n //\n // The width bound is the fix for the clipping: `w-full` next to a fixed\n // right offset is a full-viewport box pushed 16px off the left edge.\n position: {\n \"top-left\": \"fixed top-4 left-4 z-50 w-[calc(100vw-2rem)] max-w-sm\",\n \"top-center\":\n \"fixed top-4 left-1/2 -translate-x-1/2 z-50 w-[calc(100vw-2rem)] max-w-sm\",\n \"top-right\": \"fixed top-4 right-4 z-50 w-[calc(100vw-2rem)] max-w-sm\",\n \"bottom-left\":\n \"fixed bottom-4 left-4 z-50 w-[calc(100vw-2rem)] max-w-sm\",\n \"bottom-center\":\n \"fixed bottom-4 left-1/2 -translate-x-1/2 z-50 w-[calc(100vw-2rem)] max-w-sm\",\n \"bottom-right\":\n \"fixed bottom-4 right-4 z-50 w-[calc(100vw-2rem)] max-w-sm\",\n },\n animation: {\n default: \"animate-in slide-in-from-right-full duration-300\",\n slide: \"animate-in slide-in-from-bottom-4 duration-300\",\n fade: \"animate-in fade-in-0 duration-300\",\n scale: \"animate-in zoom-in-95 duration-300\",\n none: \"\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n position: \"top-right\",\n animation: \"default\",\n },\n },\n);\n\nconst toastIconVariants = cva(\n \"flex-shrink-0 w-5 h-5 transition-colors duration-200\",\n {\n variants: {\n variant: {\n default: \"text-muted-foreground\",\n success: \"text-success-600\",\n error: \"text-destructive\",\n warning: \"text-warning-600\",\n info: \"text-info-600\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n },\n);\n\nexport type ToastPosition =\n | \"top-left\"\n | \"top-center\"\n | \"top-right\"\n | \"bottom-left\"\n | \"bottom-center\"\n | \"bottom-right\";\n\n// Types\nexport interface ToastProps\n extends\n VariantProps<typeof toastVariants>,\n React.HTMLAttributes<HTMLDivElement> {\n id?: string;\n title?: string;\n description?: string;\n duration?: number;\n onClose?: () => void;\n action?: {\n label: string;\n onClick: () => void;\n };\n className?: string;\n children?: React.ReactNode;\n appearDelay?: number; // time in ms before first render becomes visible; default 10\n animationMs?: number; // exit animation duration; default 150\n /**\n * Internal. Set by the viewport to start the exit animation, so that a\n * programmatic `dismiss(id)` animates out like a click on the close button\n * rather than vanishing.\n */\n dismissing?: boolean;\n /** Internal. Told to the provider when the exit animation has finished. */\n onExited?: () => void;\n}\n\nexport interface ToastContextType {\n toasts: ToastProps[];\n addToast: (toast: Omit<ToastProps, \"id\">) => string;\n removeToast: (id: string) => void;\n clearToasts: () => void;\n}\n\n// Toast Context\nconst ToastContext = React.createContext<ToastContextType | undefined>(\n undefined,\n);\n\n/**\n * True inside a `ToastViewport`.\n *\n * A contained toast does not position itself and does not run its own\n * auto-dismiss timer, because the viewport does the first and the provider does\n * the second. Both used to happen twice.\n */\nconst ToastViewportContext = React.createContext(false);\n\nexport const useToast = () => {\n const context = React.useContext(ToastContext);\n if (!context) {\n throw new Error(\"useToast must be used within a ToastProvider\");\n }\n return context;\n};\n\n/**\n * Ids are a counter, not `Math.random()`.\n *\n * Random ids differ between a server render and the client that hydrates it,\n * which is a hydration mismatch waiting for the first server-rendered toast. A\n * counter is stable for a given sequence of calls, and these ids are only ever\n * used to address a toast within one provider.\n */\nlet toastSequence = 0;\nconst nextToastId = () => `toast-${++toastSequence}`;\n\n// Toast Provider\nexport const ToastProvider: React.FC<{ children: React.ReactNode }> = ({\n children,\n}) => {\n const [toasts, setToasts] = useState<ToastProps[]>([]);\n // Toasts whose exit animation is running. They are still in `toasts` - and so\n // still rendered - until the animation reports back.\n const [dismissing, setDismissing] = useState<ReadonlySet<string>>(\n () => new Set(),\n );\n const timeoutRefs = useRef<Map<string, ReturnType<typeof setTimeout>>>(\n new Map(),\n );\n\n const clearTimer = useCallback((id: string) => {\n const timeoutId = timeoutRefs.current.get(id);\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutRefs.current.delete(id);\n }\n }, []);\n\n /** Starts the exit. The toast leaves the array in `finalize`, not here. */\n const removeToast = useCallback(\n (id: string) => {\n clearTimer(id);\n setDismissing((prev) => {\n if (prev.has(id)) return prev;\n const next = new Set(prev);\n next.add(id);\n return next;\n });\n },\n [clearTimer],\n );\n\n /** The exit has finished: drop it. */\n const finalize = useCallback(\n (id: string) => {\n clearTimer(id);\n setToasts((prev) => prev.filter((toast) => toast.id !== id));\n setDismissing((prev) => {\n if (!prev.has(id)) return prev;\n const next = new Set(prev);\n next.delete(id);\n return next;\n });\n },\n [clearTimer],\n );\n\n const removeToastRef = useRef(removeToast);\n useEffect(() => {\n removeToastRef.current = removeToast;\n }, [removeToast]);\n\n const addToast = useCallback((toast: Omit<ToastProps, \"id\">) => {\n const id = nextToastId();\n const newToast = { ...toast, id };\n\n setToasts((prev) => [...prev, newToast]);\n\n // The provider owns the timer for a toast it renders, and it starts the same\n // exit a click on the close button would. The toast's own timer is disabled\n // inside a viewport, so this is the only one.\n if (toast.duration !== 0) {\n const timeoutId = setTimeout(() => {\n removeToastRef.current(id);\n }, toast.duration || 5000);\n timeoutRefs.current.set(id, timeoutId);\n }\n\n return id;\n }, []);\n\n const clearToasts = useCallback(() => {\n timeoutRefs.current.forEach((timeoutId) => clearTimeout(timeoutId));\n timeoutRefs.current.clear();\n // Animate them all out rather than cutting to nothing, so `clear()` looks\n // like dismissing each one.\n setToasts((prev) => {\n setDismissing(new Set(prev.map((toast) => toast.id!)));\n return prev;\n });\n }, []);\n\n // Cleanup on unmount\n useEffect(() => {\n const refs = timeoutRefs.current;\n return () => {\n refs.forEach((timeoutId) => clearTimeout(timeoutId));\n refs.clear();\n };\n }, []);\n\n return (\n <ToastContext.Provider\n value={{ toasts, addToast, removeToast, clearToasts }}\n >\n {children}\n <ToastContainer\n toasts={toasts}\n dismissing={dismissing}\n onExited={finalize}\n />\n </ToastContext.Provider>\n );\n};\n\nconst VIEWPORT_POSITIONS: Record<ToastPosition, string> = {\n // Bottom edges stack upwards, so the newest is nearest the edge and the older\n // ones move away from it. Reversing the column is what does that.\n \"top-left\": \"top-4 left-4 flex-col\",\n \"top-center\": \"top-4 left-1/2 -translate-x-1/2 flex-col\",\n \"top-right\": \"top-4 right-4 flex-col\",\n \"bottom-left\": \"bottom-4 left-4 flex-col-reverse\",\n \"bottom-center\": \"bottom-4 left-1/2 -translate-x-1/2 flex-col-reverse\",\n \"bottom-right\": \"bottom-4 right-4 flex-col-reverse\",\n};\n\n/**\n * One bounded column per position.\n *\n * `w-[calc(100vw-2rem)] max-w-sm` is the pair that keeps it on screen: full width\n * minus the 16px inset on each side, up to a readable maximum. The column is\n * `pointer-events-none` so it does not swallow clicks on the page underneath it,\n * and each toast turns pointer events back on for itself.\n */\nconst ToastViewport: React.FC<{\n position: ToastPosition;\n children: React.ReactNode;\n}> = ({ position, children }) => (\n <ToastViewportContext.Provider value={true}>\n <ol\n data-toast-viewport={position}\n className={cn(\n \"pointer-events-none fixed z-50 flex w-[calc(100vw-2rem)] max-w-sm gap-2 m-0 list-none p-0\",\n VIEWPORT_POSITIONS[position],\n )}\n >\n {children}\n </ol>\n </ToastViewportContext.Provider>\n);\n\n// Toast Container\nconst ToastContainer: React.FC<{\n toasts: ToastProps[];\n dismissing: ReadonlySet<string>;\n onExited: (id: string) => void;\n}> = ({ toasts, dismissing, onExited }) => {\n if (toasts.length === 0) return null;\n\n const toastsByPosition = toasts.reduce(\n (acc, toast) => {\n const position = (toast.position ?? \"top-right\") as ToastPosition;\n (acc[position] ??= []).push(toast);\n return acc;\n },\n {} as Record<ToastPosition, ToastProps[]>,\n );\n\n return (\n <>\n {(\n Object.entries(toastsByPosition) as [ToastPosition, ToastProps[]][]\n ).map(([position, positionToasts]) => (\n <ToastViewport key={position} position={position}>\n {positionToasts.map((toast) => (\n <li key={toast.id} className=\"contents\">\n <Toast\n {...toast}\n dismissing={dismissing.has(toast.id!)}\n onExited={() => onExited(toast.id!)}\n />\n </li>\n ))}\n </ToastViewport>\n ))}\n </>\n );\n};\n\n// Individual Toast Component\nconst ToastComponent = React.forwardRef<HTMLDivElement, ToastProps>(\n (\n {\n id: _id,\n title,\n description,\n variant = \"default\",\n position = \"top-right\",\n animation = \"default\",\n duration = 5000,\n onClose,\n action,\n className,\n children,\n appearDelay = 10,\n animationMs = 150,\n dismissing = false,\n onExited,\n ...props\n },\n ref,\n ) => {\n const contained = React.useContext(ToastViewportContext);\n const [isVisible, setIsVisible] = useState(appearDelay <= 0);\n const [isLeaving, setIsLeaving] = useState(false);\n\n useEffect(() => {\n if (appearDelay <= 0) {\n return;\n }\n const timer = window.setTimeout(() => setIsVisible(true), appearDelay);\n return () => clearTimeout(timer);\n }, [appearDelay]);\n\n // `onClose` fires once, whichever route got here: the close button, the\n // timeout, `dismiss(id)` or `clear()`. Without the guard, a second click\n // during the exit animation fired it twice.\n const closedRef = useRef(false);\n const onCloseRef = useRef(onClose);\n const onExitedRef = useRef(onExited);\n useEffect(() => {\n onCloseRef.current = onClose;\n onExitedRef.current = onExited;\n }, [onClose, onExited]);\n\n const handleClose = useCallback(() => {\n if (closedRef.current) return;\n closedRef.current = true;\n setIsLeaving(true);\n window.setTimeout(() => {\n onCloseRef.current?.();\n setIsVisible(false);\n // The provider drops it from state here, after the animation, so the\n // array and the screen agree.\n onExitedRef.current?.();\n }, animationMs);\n }, [animationMs]);\n\n // Started from outside: `dismiss(id)`, `clear()`, or the provider's timeout.\n useEffect(() => {\n if (dismissing) handleClose();\n }, [dismissing, handleClose]);\n\n // Auto close after duration.\n //\n // Only when standalone. Inside a viewport the provider owns this timer, and\n // running both meant a toast could be removed from state while its own exit\n // was still going.\n useEffect(() => {\n if (contained) return undefined;\n if (duration > 0) {\n const timer = window.setTimeout(handleClose, duration);\n return () => clearTimeout(timer);\n }\n return undefined;\n }, [contained, duration, handleClose]);\n\n const getIcon = () => {\n switch (variant) {\n case \"success\":\n return (\n <svg\n className={toastIconVariants({ variant })}\n fill=\"currentColor\"\n viewBox=\"0 0 20 20\"\n >\n <path\n fillRule=\"evenodd\"\n d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n case \"error\":\n return (\n <svg\n className={toastIconVariants({ variant })}\n fill=\"currentColor\"\n viewBox=\"0 0 20 20\"\n >\n <path\n fillRule=\"evenodd\"\n d=\"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n case \"warning\":\n return (\n <svg\n className={toastIconVariants({ variant })}\n fill=\"currentColor\"\n viewBox=\"0 0 20 20\"\n >\n <path\n fillRule=\"evenodd\"\n d=\"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n case \"info\":\n return (\n <svg\n className={toastIconVariants({ variant })}\n fill=\"currentColor\"\n viewBox=\"0 0 20 20\"\n >\n <path\n fillRule=\"evenodd\"\n d=\"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n default:\n return null;\n }\n };\n\n if (!isVisible) return null;\n\n // An error is the one variant a reader should be interrupted for. Everything\n // else waits for a pause. A caller who knows better can pass either.\n const isUrgent = variant === \"error\";\n const { style: callerStyle, ...restProps } = props;\n\n return (\n <div\n ref={ref}\n role={props.role ?? (isUrgent ? \"alert\" : \"status\")}\n aria-live={props[\"aria-live\"] ?? (isUrgent ? \"assertive\" : \"polite\")}\n // Read the title and the description as one message rather than as two\n // separate arrivals.\n aria-atomic={props[\"aria-atomic\"] ?? true}\n className={cn(\n toastVariants({\n variant,\n // Inside a viewport the column positions it; on its own it has to.\n position: contained ? null : position,\n animation,\n }),\n contained && \"w-full\",\n isLeaving ? \"opacity-0\" : \"opacity-100\",\n \"pointer-events-auto\",\n className,\n )}\n data-visible={isVisible ? \"true\" : \"false\"}\n data-leaving={isLeaving ? \"true\" : \"false\"}\n {...restProps}\n style={{\n transition: `all ${animationMs}ms ease-in-out`,\n ...callerStyle,\n // Last, so the exit is not silently overridden by a caller's transform.\n // It used to be first, and the container passed a transform on every\n // toast, so the exit animation never ran for a toast in a provider.\n transform: isLeaving\n ? \"translateX(100%)\"\n : (callerStyle?.transform ?? \"translateX(0)\"),\n }}\n >\n <div className=\"flex items-start space-x-3\">\n {getIcon()}\n <div className=\"flex-1 min-w-0\">\n {title && <div className=\"text-sm font-medium\">{title}</div>}\n {description && (\n <div className=\"mt-1 text-sm opacity-90\">{description}</div>\n )}\n {children}\n </div>\n </div>\n\n {action && (\n <button\n type=\"button\"\n onClick={action.onClick}\n className=\"ml-4 text-sm font-medium underline hover:no-underline focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-ring\"\n >\n {action.label}\n </button>\n )}\n\n <button\n type=\"button\"\n onClick={handleClose}\n className=\"absolute top-2 right-2 p-1 rounded-md hover:bg-muted focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-ring\"\n aria-label=\"Close notification\"\n >\n <svg className=\"w-4 h-4\" fill=\"currentColor\" viewBox=\"0 0 20 20\">\n <path\n fillRule=\"evenodd\"\n d=\"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z\"\n clipRule=\"evenodd\"\n />\n </svg>\n </button>\n </div>\n );\n },\n);\n\nToastComponent.displayName = \"Toast\";\n\n// Memoize Toast for performance optimization\nexport const Toast = memo(ToastComponent) as typeof ToastComponent;\n\n// Toast Hook for easy usage\nexport const useToastNotification = () => {\n const { addToast, removeToast, clearToasts } = useToast();\n\n const toast = {\n success: (\n message: string,\n options?: Omit<ToastProps, \"variant\" | \"title\">,\n ) =>\n addToast({\n variant: \"success\",\n title: \"Success\",\n description: message,\n ...options,\n }),\n\n error: (message: string, options?: Omit<ToastProps, \"variant\" | \"title\">) =>\n addToast({\n variant: \"error\",\n title: \"Error\",\n description: message,\n ...options,\n }),\n\n warning: (\n message: string,\n options?: Omit<ToastProps, \"variant\" | \"title\">,\n ) =>\n addToast({\n variant: \"warning\",\n title: \"Warning\",\n description: message,\n ...options,\n }),\n\n info: (message: string, options?: Omit<ToastProps, \"variant\" | \"title\">) =>\n addToast({\n variant: \"info\",\n title: \"Info\",\n description: message,\n ...options,\n }),\n\n custom: (toast: Omit<ToastProps, \"id\">) => addToast(toast),\n\n dismiss: removeToast,\n clear: clearToasts,\n };\n\n return toast;\n};\n\n// Export variants for external use\nexport { toastVariants, toastIconVariants };\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {a}from'./chunk-AC2JBXHQ.js';import r,{useState}from'react';import {cva}from'class-variance-authority';var U=cva("w-full border-collapse transition-all duration-200",{variants:{variant:{default:"border border-border shadow-sm hover:shadow-md",striped:"border border-border shadow-sm hover:shadow-md",bordered:"border-2 border-border shadow-md hover:shadow-lg",hover:"border border-border shadow-sm hover:shadow-md",elevated:"border border-border shadow-lg hover:shadow-xl",interactive:"border border-border shadow-sm hover:shadow-md hover:border-primary"},size:{sm:"text-xs sm:text-sm",md:"text-sm sm:text-base",lg:"text-base sm:text-lg"}},defaultVariants:{variant:"default",size:"md"}}),W=cva("font-medium text-left transition-all duration-200",{variants:{variant:{default:"bg-muted text-foreground hover:bg-muted/80",striped:"bg-muted text-foreground hover:bg-muted/80",bordered:"bg-muted text-foreground hover:bg-muted/80",hover:"bg-muted text-foreground hover:bg-muted/80",elevated:"bg-muted text-foreground hover:bg-muted/80",interactive:"bg-muted text-foreground hover:bg-primary/10 hover:text-primary"},size:{sm:"px-2 py-1 sm:px-3 sm:py-2",md:"px-3 py-2 sm:px-4 sm:py-3",lg:"px-4 py-3 sm:px-6 sm:py-4"}},defaultVariants:{variant:"default",size:"md"}}),X=cva("border-b border-border transition-colors",{variants:{variant:{default:"hover:bg-muted/50",striped:"even:bg-muted/50 hover:bg-muted/80",bordered:"hover:bg-muted/50",hover:"hover:bg-muted/50",elevated:"hover:bg-muted/80",interactive:"hover:bg-primary/10 hover:text-primary"}},defaultVariants:{variant:"default"}}),w=cva("border-border transition-all duration-200",{variants:{variant:{default:"border-b border-border hover:bg-muted/50",striped:"border-b border-border hover:bg-muted/80",bordered:"border border-border hover:bg-muted/50",hover:"border-b border-border hover:bg-muted/50",elevated:"border-b border-border hover:bg-muted/80",interactive:"border-b border-border hover:bg-primary/10 hover:text-primary"},size:{sm:"px-2 py-1 sm:px-3 sm:py-2",md:"px-3 py-2 sm:px-4 sm:py-3",lg:"px-4 py-3 sm:px-6 sm:py-4"}},defaultVariants:{variant:"default",size:"md"}});function Y({data:l,columns:n,loading:b=false,emptyText:p="No data",className:u,variant:d,size:i,rowKey:c="id",onRowClick:E,onSort:L,sortColumn:N,sortDirection:B,pagination:t,selection:s,caption:k,...I},D){let[j,A]=useState(null),S=N!==void 0,g=S&&N?{column:N,direction:B||"asc"}:j,F=e=>{if(!e.sortable)return;let o=g?.column===e.key&&g?.direction==="asc"?"desc":"asc";S||A({column:e.key,direction:o}),L?.(e,o);},f=(e,o)=>typeof c=="function"?c(e):e[c]??o,P=e=>s?.getCheckboxProps?.(e).disabled===true,h=s?l.map((e,o)=>({record:e,key:f(e,o)})).filter(({record:e})=>!P(e)).map(({key:e})=>e):[],z=e=>l.filter((o,a)=>e.includes(f(o,a))),H=(e,o)=>{if(!s)return false;let a=f(e,o);return s.selectedRowKeys.includes(a)},G=(e,o,a)=>{if(!s||P(e))return;let x=f(e,o),V=a?s.selectedRowKeys.includes(x)?s.selectedRowKeys:[...s.selectedRowKeys,x]:s.selectedRowKeys.filter(Q=>Q!==x);s.onChange(V,z(V));},$=e=>{if(!s)return;let o=s.selectedRowKeys.filter(x=>!h.includes(x)),a=e?[...o,...h]:o;s.onChange(a,z(a));},C=h.filter(e=>s?.selectedRowKeys.includes(e)),J=s&&h.length>0&&C.length===h.length,O=s&&C.length>0&&C.length<h.length;return r.createElement("div",{className:"w-full overflow-x-auto"},r.createElement("div",{className:"min-w-full"},r.createElement("table",{ref:D,className:a(U({variant:d,size:i}),u),...I},k&&r.createElement("caption",{className:"sr-only"},k),r.createElement(K,null,r.createElement(v,null,s&&r.createElement("th",{className:a(w({variant:d,size:i})),scope:"col",role:"columnheader"},r.createElement("input",{type:"checkbox",checked:J,ref:e=>{e&&(e.indeterminate=O||false);},onChange:e=>$(e.target.checked),className:"rounded border-input text-primary focus:ring-ring","aria-label":"Select all rows"})),n.map(e=>r.createElement("th",{key:e.key,className:a(w({variant:d,size:i}),e.className,e.align==="center"&&"text-center",e.align==="right"&&"text-right"),scope:"col",role:"columnheader",...e.width&&{style:{width:e.width}}},r.createElement("div",{className:"flex items-center gap-2"},r.createElement("span",null,e.title),e.sortable&&r.createElement("button",{type:"button",onClick:()=>F(e),className:"flex flex-col text-muted-foreground hover:text-foreground","aria-label":`Sort by ${e.title}`},r.createElement("svg",{className:a("w-3 h-3",g?.column===e.key&&g?.direction==="asc"?"text-primary":"text-muted-foreground"),fill:"currentColor",viewBox:"0 0 20 20"},r.createElement("path",{d:"M5 8l5-5 5 5H5z"})),r.createElement("svg",{className:a("w-3 h-3 -mt-1",g?.column===e.key&&g?.direction==="desc"?"text-primary":"text-muted-foreground"),fill:"currentColor",viewBox:"0 0 20 20"},r.createElement("path",{d:"M5 12l5 5 5-5H5z"})))))))),r.createElement(M,null,b?r.createElement(v,null,r.createElement(y,{colSpan:n.length+(s?1:0),variant:d,size:i,className:"text-center py-8"},r.createElement("div",{className:"flex items-center justify-center gap-2"},r.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-primary"}),r.createElement("span",null,"Loading...")))):l.length===0?r.createElement(v,null,r.createElement(y,{colSpan:n.length+(s?1:0),variant:d,size:i,className:"text-center py-8 text-muted-foreground"},p)):l.map((e,o)=>r.createElement(v,{key:f(e,o),variant:d,onClick:()=>E?.(e,o),selected:H(e,o)},s&&r.createElement(y,{variant:d,size:i},r.createElement("input",{type:"checkbox",checked:H(e,o),onChange:a=>G(e,o,a.target.checked),className:"rounded border-input text-primary focus:ring-ring","aria-label":`Select row ${o+1}`,...s.getCheckboxProps?.(e)})),n.map(a$1=>r.createElement(y,{key:a$1.key,variant:d,size:i,className:a(a$1.className,a$1.align==="center"&&"text-center",a$1.align==="right"&&"text-right")},a$1.render?a$1.render(a$1.dataIndex?e[a$1.dataIndex]:e,e,o):a$1.dataIndex?e[a$1.dataIndex]:e[a$1.key]))))))),t&&r.createElement("div",{className:"flex flex-col sm:flex-row items-center justify-between mt-4 px-2 sm:px-4 py-3 bg-card border-t border-border gap-2 sm:gap-0"},r.createElement("div",{className:"flex items-center gap-2"},r.createElement("span",{className:"text-sm text-muted-foreground"},"Showing ",(t.current-1)*t.pageSize+1," to"," ",Math.min(t.current*t.pageSize,t.total)," ","of ",t.total," results")),r.createElement("div",{className:"flex items-center gap-2"},t.showSizeChanger&&r.createElement("select",{value:t.pageSize,onChange:e=>t.onChange(1,Number(e.target.value)),className:"rounded border-input bg-background text-sm","aria-label":"Select page size"},r.createElement("option",{value:10},"10 / page"),r.createElement("option",{value:20},"20 / page"),r.createElement("option",{value:50},"50 / page"),r.createElement("option",{value:100},"100 / page")),r.createElement("div",{className:"flex items-center gap-1"},r.createElement("button",{type:"button",onClick:()=>t.onChange(t.current-1,t.pageSize),disabled:t.current<=1,className:"px-3 py-1 text-sm border border-input rounded hover:bg-muted disabled:opacity-50 disabled:cursor-not-allowed","aria-label":"Go to previous page"},"Previous"),r.createElement("span",{className:"px-3 py-1 text-sm"},"Page ",t.current," of"," ",Math.ceil(t.total/t.pageSize)),r.createElement("button",{type:"button",onClick:()=>t.onChange(t.current+1,t.pageSize),disabled:t.current>=Math.ceil(t.total/t.pageSize),className:"px-3 py-1 text-sm border border-input rounded hover:bg-muted disabled:opacity-50 disabled:cursor-not-allowed","aria-label":"Go to next page"},"Next")))))}var R=r.forwardRef(Y);R.displayName="Table";var te=R,K=r.forwardRef(({className:l,variant:n,size:b,children:p,...u},d)=>r.createElement("thead",{ref:d,className:a(W({variant:n,size:b}),l),...u},p));K.displayName="TableHeader";var M=r.forwardRef(({className:l,children:n,...b},p)=>r.createElement("tbody",{ref:p,className:a(l),...b},n));M.displayName="TableBody";var v=r.forwardRef(({className:l,children:n,onClick:b,selected:p,variant:u,...d},i)=>r.createElement("tr",{ref:i,className:a(X({variant:u}),p&&"bg-primary/10",b&&"cursor-pointer",l),onClick:b,...d},n));v.displayName="TableRow";var y=r.forwardRef(({className:l,children:n,variant:b,size:p,colSpan:u,rowSpan:d,...i},c)=>r.createElement("td",{ref:c,className:a(w({variant:b,size:p}),l),colSpan:u,rowSpan:d,...i},n));y.displayName="TableCell";var Z=r.forwardRef(({className:l,children:n,variant:b,size:p,colSpan:u,rowSpan:d,...i},c)=>r.createElement("th",{ref:c,className:a(w({variant:b,size:p}),"font-medium",l),colSpan:u,rowSpan:d,...i},n));Z.displayName="TableHead";export{U as a,W as b,w as c,te as d,K as e,M as f,v as g,y as h,Z as i};//# sourceMappingURL=chunk-HCO4XKPM.js.map
|
|
3
|
+
//# sourceMappingURL=chunk-HCO4XKPM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/core/table.tsx"],"names":["tableVariants","cva","tableHeaderVariants","tableRowVariants","tableCellVariants","TableComponent","data","columns","loading","emptyText","className","variant","size","rowKey","onRowClick","onSort","controlledSortColumn","controlledSortDirection","pagination","selection","caption","props","ref","internalSortState","setInternalSortState","useState","isControlled","sortState","handleSort","column","newDirection","getRowKey","record","index","isRowDisabled","selectableKeys","key","recordsForKeys","keys","isRowSelected","handleRowSelection","checked","newSelectedKeys","k","handleSelectAll","others","selectedOnPage","isAllSelected","isIndeterminate","React","cn","TableHeader","TableRow","input","TableBody","TableCell","e","TableForwardRef","Table","children","onClick","selected","colSpan","rowSpan","TableHead"],"mappings":"8GAKA,IAAMA,CAAAA,CAAgBC,IACpB,oDAAA,CACA,CACE,QAAA,CAAU,CACR,QAAS,CACP,OAAA,CAAS,gDAAA,CACT,OAAA,CAAS,iDACT,QAAA,CAAU,kDAAA,CACV,KAAA,CAAO,gDAAA,CACP,SAAU,gDAAA,CACV,WAAA,CACE,qEACJ,CAAA,CACA,KAAM,CACJ,EAAA,CAAI,qBACJ,EAAA,CAAI,sBAAA,CACJ,GAAI,sBACN,CACF,CAAA,CACA,eAAA,CAAiB,CACf,OAAA,CAAS,SAAA,CACT,IAAA,CAAM,IACR,CACF,CACF,CAAA,CAEMC,CAAAA,CAAsBD,GAAAA,CAC1B,oDACA,CACE,QAAA,CAAU,CACR,OAAA,CAAS,CACP,OAAA,CAAS,4CAAA,CACT,OAAA,CAAS,4CAAA,CACT,SAAU,4CAAA,CACV,KAAA,CAAO,4CAAA,CACP,QAAA,CAAU,6CACV,WAAA,CACE,iEACJ,CAAA,CACA,IAAA,CAAM,CACJ,EAAA,CAAI,2BAAA,CACJ,GAAI,2BAAA,CACJ,EAAA,CAAI,2BACN,CACF,CAAA,CACA,eAAA,CAAiB,CACf,QAAS,SAAA,CACT,IAAA,CAAM,IACR,CACF,CACF,CAAA,CASME,CAAAA,CAAmBF,GAAAA,CAAI,0CAAA,CAA4C,CACvE,QAAA,CAAU,CACR,OAAA,CAAS,CACP,QAAS,mBAAA,CACT,OAAA,CAAS,oCAAA,CACT,QAAA,CAAU,oBACV,KAAA,CAAO,mBAAA,CACP,QAAA,CAAU,mBAAA,CACV,YAAa,wCACf,CACF,CAAA,CACA,eA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UAAA,CAC7B,CAAC,CAAE,SAAA,CAAAvC,EAAW,QAAA,CAAAiD,CAAAA,CAAU,OAAA,CAAAhD,CAAAA,CAAS,KAAAC,CAAAA,CAAM,OAAA,CAAAkD,CAAAA,CAAS,OAAA,CAAAC,EAAS,GAAG1C,CAAM,CAAA,CAAGC,CAAAA,GACnE2B,EAAA,aAAA,CAAC,IAAA,CAAA,CACC,IAAK3B,CAAAA,CACL,SAAA,CAAW4B,EACT9C,CAAAA,CAAkB,CAAE,OAAA,CAAAO,CAAAA,CAAS,KAAAC,CAAK,CAAC,CAAA,CACnC,aAAA,CACAF,CACF,CAAA,CACA,OAAA,CAASoD,CAAAA,CACT,OAAA,CAASC,EACR,GAAG1C,CAAAA,CAAAA,CAEHsC,CACH,CAEJ,EAEAK,EAAU,WAAA,CAAc,WAAA","file":"chunk-HCO4XKPM.js","sourcesContent":["import React, { useState } from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/utils\";\n\n// Table variants\nconst tableVariants = cva(\n \"w-full border-collapse transition-all duration-200\",\n {\n variants: {\n variant: {\n default: \"border border-border shadow-sm hover:shadow-md\",\n striped: \"border border-border shadow-sm hover:shadow-md\",\n bordered: \"border-2 border-border shadow-md hover:shadow-lg\",\n hover: \"border border-border shadow-sm hover:shadow-md\",\n elevated: \"border border-border shadow-lg hover:shadow-xl\",\n interactive:\n \"border border-border shadow-sm hover:shadow-md hover:border-primary\",\n },\n size: {\n sm: \"text-xs sm:text-sm\",\n md: \"text-sm sm:text-base\",\n lg: \"text-base sm:text-lg\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"md\",\n },\n },\n);\n\nconst tableHeaderVariants = cva(\n \"font-medium text-left transition-all duration-200\",\n {\n variants: {\n variant: {\n default: \"bg-muted text-foreground hover:bg-muted/80\",\n striped: \"bg-muted text-foreground hover:bg-muted/80\",\n bordered: \"bg-muted text-foreground hover:bg-muted/80\",\n hover: \"bg-muted text-foreground hover:bg-muted/80\",\n elevated: \"bg-muted text-foreground hover:bg-muted/80\",\n interactive:\n \"bg-muted text-foreground hover:bg-primary/10 hover:text-primary\",\n },\n size: {\n sm: \"px-2 py-1 sm:px-3 sm:py-2\",\n md: \"px-3 py-2 sm:px-4 sm:py-3\",\n lg: \"px-4 py-3 sm:px-6 sm:py-4\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"md\",\n },\n },\n);\n\n/**\n * Row-level variants.\n *\n * `striped` has to live here, not on the cell: `even:` selects the even sibling\n * among *cells within a row*, so applying it there striped columns instead of\n * rows - and TableRow ignored the variant entirely, so nothing showed at all.\n */\nconst tableRowVariants = cva(\"border-b border-border transition-colors\", {\n variants: {\n variant: {\n default: \"hover:bg-muted/50\",\n striped: \"even:bg-muted/50 hover:bg-muted/80\",\n bordered: \"hover:bg-muted/50\",\n hover: \"hover:bg-muted/50\",\n elevated: \"hover:bg-muted/80\",\n interactive: \"hover:bg-primary/10 hover:text-primary\",\n },\n },\n defaultVariants: { variant: \"default\" },\n});\n\nconst tableCellVariants = cva(\"border-border transition-all duration-200\", {\n variants: {\n variant: {\n default: \"border-b border-border hover:bg-muted/50\",\n striped: \"border-b border-border hover:bg-muted/80\",\n bordered: \"border border-border hover:bg-muted/50\",\n hover: \"border-b border-border hover:bg-muted/50\",\n elevated: \"border-b border-border hover:bg-muted/80\",\n interactive:\n \"border-b border-border hover:bg-primary/10 hover:text-primary\",\n },\n size: {\n sm: \"px-2 py-1 sm:px-3 sm:py-2\",\n md: \"px-3 py-2 sm:px-4 sm:py-3\",\n lg: \"px-4 py-3 sm:px-6 sm:py-4\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"md\",\n },\n});\n\n// Types\nexport interface TableColumn<T = Record<string, unknown>> {\n key: string;\n title: string;\n dataIndex?: keyof T;\n render?: (value: unknown, record: T, index: number) => React.ReactNode;\n sortable?: boolean;\n width?: string | number;\n align?: \"left\" | \"center\" | \"right\";\n className?: string;\n}\n\nexport interface TableProps<T = Record<string, unknown>> extends VariantProps<\n typeof tableVariants\n> {\n data: T[];\n columns: TableColumn<T>[];\n loading?: boolean;\n emptyText?: string;\n caption?: string;\n className?: string;\n rowKey?: keyof T | ((record: T) => string | number);\n onRowClick?: (record: T, index: number) => void;\n onSort?: (column: TableColumn<T>, direction: \"asc\" | \"desc\") => void;\n sortColumn?: string;\n sortDirection?: \"asc\" | \"desc\";\n pagination?: {\n current: number;\n pageSize: number;\n total: number;\n onChange: (page: number, pageSize: number) => void;\n showSizeChanger?: boolean;\n showQuickJumper?: boolean;\n };\n selection?: {\n selectedRowKeys: (string | number)[];\n /**\n * `selectedRowKeys` is the complete selection, including keys for records on\n * other pages. `selectedRows` is only the subset present in `data`, because\n * the component has never been given the rest. Paginating server-side means\n * keeping your own key-to-record map and treating the keys as authoritative.\n */\n onChange: (selectedRowKeys: (string | number)[], selectedRows: T[]) => void;\n /**\n * A disabled row cannot be selected individually, and select-all skips it\n * rather than selecting it on the consumer's behalf.\n */\n getCheckboxProps?: (record: T) => { disabled?: boolean };\n };\n}\n\nexport interface TableHeaderProps extends VariantProps<\n typeof tableHeaderVariants\n> {\n className?: string;\n children: React.ReactNode;\n}\n\nexport interface TableBodyProps {\n className?: string;\n children: React.ReactNode;\n}\n\nexport interface TableRowProps extends VariantProps<typeof tableRowVariants> {\n className?: string;\n children: React.ReactNode;\n onClick?: () => void;\n selected?: boolean;\n}\n\nexport interface TableCellProps extends VariantProps<typeof tableCellVariants> {\n className?: string;\n children: React.ReactNode;\n colSpan?: number;\n rowSpan?: number;\n}\n\n// Table Components\nfunction TableComponent<\n T extends Record<string, unknown> = Record<string, unknown>,\n>(\n {\n data,\n columns,\n loading = false,\n emptyText = \"No data\",\n className,\n variant,\n size,\n rowKey = \"id\",\n onRowClick,\n onSort,\n sortColumn: controlledSortColumn,\n sortDirection: controlledSortDirection,\n pagination,\n selection,\n caption,\n ...props\n }: TableProps<T>,\n ref: React.Ref<HTMLTableElement>,\n) {\n // Use controlled props if provided, otherwise use internal state\n const [internalSortState, setInternalSortState] = useState<{\n column: string;\n direction: \"asc\" | \"desc\";\n } | null>(null);\n\n // Determine current sort state (controlled takes precedence)\n const isControlled = controlledSortColumn !== undefined;\n const sortState =\n isControlled && controlledSortColumn\n ? {\n column: controlledSortColumn,\n direction: controlledSortDirection || \"asc\",\n }\n : internalSortState;\n\n // Sync internal state with controlled props when they change\n // Sync internal state with controlled props when they change\n // Note: unneeded re-render caused by resetting state. We derive sortState above so stale internal state is ignored.\n /* \n useEffect(() => {\n if (isControlled && controlledSortColumn) {\n setInternalSortState(null);\n }\n }, [isControlled, controlledSortColumn]); \n */\n\n const handleSort = (column: TableColumn<T>) => {\n if (!column.sortable) return;\n\n const newDirection =\n sortState?.column === column.key && sortState?.direction === \"asc\"\n ? \"desc\"\n : \"asc\";\n\n // Only update internal state if not controlled\n if (!isControlled) {\n setInternalSortState({ column: column.key, direction: newDirection });\n }\n\n // Always call onSort callback for controlled usage\n onSort?.(column, newDirection);\n };\n\n /**\n * Nullish, not falsy.\n *\n * `record[rowKey] || index` reads a record with `id: 0` as having no key and\n * falls back to its position, so a zero-keyed row at index 1 reported itself as\n * key `1` - which is a different record's id. Empty string is a legitimate key\n * for the same reason.\n */\n const getRowKey = (record: T, index: number): string | number => {\n if (typeof rowKey === \"function\") {\n return rowKey(record);\n }\n return (record[rowKey] as string | number | undefined) ?? index;\n };\n\n const isRowDisabled = (record: T): boolean =>\n selection?.getCheckboxProps?.(record).disabled === true;\n\n /**\n * The rows on this page that a checkbox can actually act on.\n *\n * Everything below is expressed in terms of these rather than in terms of\n * `data.length` or `selectedRowKeys.length`. Selection is a list of keys that\n * may name records on other pages, so comparing its length to the number of\n * visible rows answered a question nobody asked: with two rows on screen and\n * two rows selected elsewhere, \"select all\" showed as checked.\n */\n const selectableKeys = selection\n ? data\n .map((record, index) => ({ record, key: getRowKey(record, index) }))\n .filter(({ record }) => !isRowDisabled(record))\n .map(({ key }) => key)\n : [];\n\n /**\n * The records behind a set of keys, as far as this page can tell.\n *\n * A key belonging to another page cannot be resolved here, because the\n * component has only been given the current page. The keys are the complete\n * answer; the records are the subset that is on screen. Documented on the prop,\n * because a consumer paginating server-side has to keep its own map.\n */\n const recordsForKeys = (keys: (string | number)[]): T[] =>\n data.filter((record, index) => keys.includes(getRowKey(record, index)));\n\n const isRowSelected = (record: T, index: number): boolean => {\n if (!selection) return false;\n const key = getRowKey(record, index);\n return selection.selectedRowKeys.includes(key);\n };\n\n const handleRowSelection = (\n record: T,\n index: number,\n checked: boolean,\n ): void => {\n if (!selection || isRowDisabled(record)) return;\n\n const key = getRowKey(record, index);\n const newSelectedKeys = checked\n ? selection.selectedRowKeys.includes(key)\n ? selection.selectedRowKeys\n : [...selection.selectedRowKeys, key]\n : selection.selectedRowKeys.filter((k) => k !== key);\n\n selection.onChange(newSelectedKeys, recordsForKeys(newSelectedKeys));\n };\n\n /**\n * Adds or removes this page's selectable rows, and leaves every other key\n * alone.\n *\n * It used to replace the whole selection with either every visible key or\n * nothing, so paging through a table and pressing select-all on the second page\n * silently discarded the first page's selection - and it included rows the\n * consumer had disabled.\n */\n const handleSelectAll = (checked: boolean) => {\n if (!selection) return;\n\n const others = selection.selectedRowKeys.filter(\n (key) => !selectableKeys.includes(key),\n );\n const newSelectedKeys = checked ? [...others, ...selectableKeys] : others;\n\n selection.onChange(newSelectedKeys, recordsForKeys(newSelectedKeys));\n };\n\n const selectedOnPage = selectableKeys.filter((key) =>\n selection?.selectedRowKeys.includes(key),\n );\n\n const isAllSelected =\n selection &&\n selectableKeys.length > 0 &&\n selectedOnPage.length === selectableKeys.length;\n\n const isIndeterminate =\n selection &&\n selectedOnPage.length > 0 &&\n selectedOnPage.length < selectableKeys.length;\n\n return (\n <div className=\"w-full overflow-x-auto\">\n <div className=\"min-w-full\">\n <table\n ref={ref}\n className={cn(tableVariants({ variant, size }), className)}\n {...props}\n >\n {caption && <caption className=\"sr-only\">{caption}</caption>}\n <TableHeader>\n <TableRow>\n {selection && (\n <th\n className={cn(tableCellVariants({ variant, size }))}\n scope=\"col\"\n role=\"columnheader\"\n >\n <input\n type=\"checkbox\"\n checked={isAllSelected}\n ref={(input) => {\n if (input) input.indeterminate = isIndeterminate || false;\n }}\n onChange={(e) => handleSelectAll(e.target.checked)}\n className=\"rounded border-input text-primary focus:ring-ring\"\n aria-label=\"Select all rows\"\n />\n </th>\n )}\n {columns.map((column) => (\n <th\n key={column.key}\n className={cn(\n tableCellVariants({ variant, size }),\n column.className,\n column.align === \"center\" && \"text-center\",\n column.align === \"right\" && \"text-right\",\n )}\n scope=\"col\"\n role=\"columnheader\"\n {...(column.width && { style: { width: column.width } })}\n >\n <div className=\"flex items-center gap-2\">\n <span>{column.title}</span>\n {column.sortable && (\n <button\n type=\"button\"\n onClick={() => handleSort(column)}\n className=\"flex flex-col text-muted-foreground hover:text-foreground\"\n aria-label={`Sort by ${column.title}`}\n >\n <svg\n className={cn(\n \"w-3 h-3\",\n sortState?.column === column.key &&\n sortState?.direction === \"asc\"\n ? \"text-primary\"\n : \"text-muted-foreground\",\n )}\n fill=\"currentColor\"\n viewBox=\"0 0 20 20\"\n >\n <path d=\"M5 8l5-5 5 5H5z\" />\n </svg>\n <svg\n className={cn(\n \"w-3 h-3 -mt-1\",\n sortState?.column === column.key &&\n sortState?.direction === \"desc\"\n ? \"text-primary\"\n : \"text-muted-foreground\",\n )}\n fill=\"currentColor\"\n viewBox=\"0 0 20 20\"\n >\n <path d=\"M5 12l5 5 5-5H5z\" />\n </svg>\n </button>\n )}\n </div>\n </th>\n ))}\n </TableRow>\n </TableHeader>\n <TableBody>\n {loading ? (\n <TableRow>\n <TableCell\n colSpan={columns.length + (selection ? 1 : 0)}\n variant={variant}\n size={size}\n className=\"text-center py-8\"\n >\n <div className=\"flex items-center justify-center gap-2\">\n <div className=\"animate-spin rounded-full h-4 w-4 border-b-2 border-primary\"></div>\n <span>Loading...</span>\n </div>\n </TableCell>\n </TableRow>\n ) : data.length === 0 ? (\n <TableRow>\n <TableCell\n colSpan={columns.length + (selection ? 1 : 0)}\n variant={variant}\n size={size}\n className=\"text-center py-8 text-muted-foreground\"\n >\n {emptyText}\n </TableCell>\n </TableRow>\n ) : (\n data.map((record, index) => (\n <TableRow\n key={getRowKey(record, index)}\n variant={variant}\n onClick={() => onRowClick?.(record, index)}\n selected={isRowSelected(record, index)}\n >\n {selection && (\n <TableCell variant={variant} size={size}>\n <input\n type=\"checkbox\"\n checked={isRowSelected(record, index)}\n onChange={(e) =>\n handleRowSelection(record, index, e.target.checked)\n }\n className=\"rounded border-input text-primary focus:ring-ring\"\n aria-label={`Select row ${index + 1}`}\n {...selection.getCheckboxProps?.(record)}\n />\n </TableCell>\n )}\n {columns.map((column) => (\n <TableCell\n key={column.key}\n variant={variant}\n size={size}\n className={cn(\n column.className,\n column.align === \"center\" && \"text-center\",\n column.align === \"right\" && \"text-right\",\n )}\n >\n {column.render\n ? column.render(\n column.dataIndex\n ? record[column.dataIndex]\n : record,\n record,\n index,\n )\n : column.dataIndex\n ? (record[column.dataIndex] as React.ReactNode)\n : ((record as Record<string, unknown>)[\n column.key\n ] as React.ReactNode)}\n </TableCell>\n ))}\n </TableRow>\n ))\n )}\n </TableBody>\n </table>\n </div>\n\n {pagination && (\n <div className=\"flex flex-col sm:flex-row items-center justify-between mt-4 px-2 sm:px-4 py-3 bg-card border-t border-border gap-2 sm:gap-0\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-sm text-muted-foreground\">\n Showing {(pagination.current - 1) * pagination.pageSize + 1} to{\" \"}\n {Math.min(\n pagination.current * pagination.pageSize,\n pagination.total,\n )}{\" \"}\n of {pagination.total} results\n </span>\n </div>\n\n <div className=\"flex items-center gap-2\">\n {pagination.showSizeChanger && (\n <select\n value={pagination.pageSize}\n onChange={(e) => pagination.onChange(1, Number(e.target.value))}\n className=\"rounded border-input bg-background text-sm\"\n aria-label=\"Select page size\"\n >\n <option value={10}>10 / page</option>\n <option value={20}>20 / page</option>\n <option value={50}>50 / page</option>\n <option value={100}>100 / page</option>\n </select>\n )}\n\n <div className=\"flex items-center gap-1\">\n <button\n type=\"button\"\n onClick={() =>\n pagination.onChange(\n pagination.current - 1,\n pagination.pageSize,\n )\n }\n disabled={pagination.current <= 1}\n className=\"px-3 py-1 text-sm border border-input rounded hover:bg-muted disabled:opacity-50 disabled:cursor-not-allowed\"\n aria-label=\"Go to previous page\"\n >\n Previous\n </button>\n\n <span className=\"px-3 py-1 text-sm\">\n Page {pagination.current} of{\" \"}\n {Math.ceil(pagination.total / pagination.pageSize)}\n </span>\n\n <button\n type=\"button\"\n onClick={() =>\n pagination.onChange(\n pagination.current + 1,\n pagination.pageSize,\n )\n }\n disabled={\n pagination.current >=\n Math.ceil(pagination.total / pagination.pageSize)\n }\n className=\"px-3 py-1 text-sm border border-input rounded hover:bg-muted disabled:opacity-50 disabled:cursor-not-allowed\"\n aria-label=\"Go to next page\"\n >\n Next\n </button>\n </div>\n </div>\n </div>\n )}\n </div>\n );\n}\n\nconst TableForwardRef = React.forwardRef(TableComponent) as <\n T extends Record<string, unknown> = Record<string, unknown>,\n>(\n props: TableProps<T> & { ref?: React.Ref<HTMLTableElement> },\n) => React.ReactElement;\n\n(\n TableForwardRef as React.ComponentType<TableProps<unknown>> & {\n displayName?: string;\n }\n).displayName = \"Table\";\n\nexport const Table = TableForwardRef;\n\nexport const TableHeader = React.forwardRef<\n HTMLTableSectionElement,\n TableHeaderProps\n>(({ className, variant, size, children, ...props }, ref) => (\n <thead\n ref={ref}\n className={cn(tableHeaderVariants({ variant, size }), className)}\n {...props}\n >\n {children}\n </thead>\n));\n\nTableHeader.displayName = \"TableHeader\";\n\nexport const TableBody = React.forwardRef<\n HTMLTableSectionElement,\n TableBodyProps\n>(({ className, children, ...props }, ref) => (\n <tbody ref={ref} className={cn(className)} {...props}>\n {children}\n </tbody>\n));\n\nTableBody.displayName = \"TableBody\";\n\nexport const TableRow = React.forwardRef<HTMLTableRowElement, TableRowProps>(\n ({ className, children, onClick, selected, variant, ...props }, ref) => (\n <tr\n ref={ref}\n className={cn(\n tableRowVariants({ variant }),\n selected && \"bg-primary/10\",\n onClick && \"cursor-pointer\",\n className,\n )}\n onClick={onClick}\n {...props}\n >\n {children}\n </tr>\n ),\n);\n\nTableRow.displayName = \"TableRow\";\n\nexport const TableCell = React.forwardRef<HTMLTableCellElement, TableCellProps>(\n ({ className, children, variant, size, colSpan, rowSpan, ...props }, ref) => (\n <td\n ref={ref}\n className={cn(tableCellVariants({ variant, size }), className)}\n colSpan={colSpan}\n rowSpan={rowSpan}\n {...props}\n >\n {children}\n </td>\n ),\n);\n\nTableCell.displayName = \"TableCell\";\n\nexport const TableHead = React.forwardRef<HTMLTableCellElement, TableCellProps>(\n ({ className, children, variant, size, colSpan, rowSpan, ...props }, ref) => (\n <th\n ref={ref}\n className={cn(\n tableCellVariants({ variant, size }),\n \"font-medium\",\n className,\n )}\n colSpan={colSpan}\n rowSpan={rowSpan}\n {...props}\n >\n {children}\n </th>\n ),\n);\n\nTableHead.displayName = \"TableHead\";\n\n// Export variants for external use\nexport { tableVariants, tableHeaderVariants, tableCellVariants };\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';var chunk7SPPGTBT_cjs=require('./chunk-7SPPGTBT.cjs'),chunkITRGJNWL_cjs=require('./chunk-ITRGJNWL.cjs'),t=require('react'),classVarianceAuthority=require('class-variance-authority');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var t__default=/*#__PURE__*/_interopDefault(t);var $=classVarianceAuthority.cva("relative flex items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all duration-300",{variants:{variant:{default:"border-border bg-card text-card-foreground shadow-lg hover:shadow-xl",success:"border-success-200 bg-success-50 text-success-900 shadow-lg hover:shadow-xl",error:"border-destructive/20 bg-destructive/10 text-destructive shadow-lg hover:shadow-xl",warning:"border-warning-200 bg-warning-50 text-warning-900 shadow-lg hover:shadow-xl",info:"border-info-200 bg-info-50 text-info-900 shadow-lg hover:shadow-xl"},position:{"top-left":"fixed top-4 left-4 z-50 w-[calc(100vw-2rem)] max-w-sm","top-center":"fixed top-4 left-1/2 -translate-x-1/2 z-50 w-[calc(100vw-2rem)] max-w-sm","top-right":"fixed top-4 right-4 z-50 w-[calc(100vw-2rem)] max-w-sm","bottom-left":"fixed bottom-4 left-4 z-50 w-[calc(100vw-2rem)] max-w-sm","bottom-center":"fixed bottom-4 left-1/2 -translate-x-1/2 z-50 w-[calc(100vw-2rem)] max-w-sm","bottom-right":"fixed bottom-4 right-4 z-50 w-[calc(100vw-2rem)] max-w-sm"},animation:{default:"animate-in slide-in-from-right-full duration-300",slide:"animate-in slide-in-from-bottom-4 duration-300",fade:"animate-in fade-in-0 duration-300",scale:"animate-in zoom-in-95 duration-300",none:""}},defaultVariants:{variant:"default",position:"top-right",animation:"default"}}),b=classVarianceAuthority.cva("flex-shrink-0 w-5 h-5 transition-colors duration-200",{variants:{variant:{default:"text-muted-foreground",success:"text-success-600",error:"text-destructive",warning:"text-warning-600",info:"text-info-600"}},defaultVariants:{variant:"default"}}),B=t__default.default.createContext(void 0),H=t__default.default.createContext(false),q=()=>{let n=t__default.default.useContext(B);if(!n)throw new Error("useToast must be used within a ToastProvider");return n},A=0,D=()=>`toast-${++A}`,et=({children:n})=>{let[c,d]=t.useState([]),[l,s]=t.useState(()=>new Set),r=t.useRef(new Map),i=t.useCallback(e=>{let o=r.current.get(e);o&&(clearTimeout(o),r.current.delete(e));},[]),u=t.useCallback(e=>{i(e),s(o=>{if(o.has(e))return o;let a=new Set(o);return a.add(e),a});},[i]),g=t.useCallback(e=>{i(e),d(o=>o.filter(a=>a.id!==e)),s(o=>{if(!o.has(e))return o;let a=new Set(o);return a.delete(e),a});},[i]),T=t.useRef(u);t.useEffect(()=>{T.current=u;},[u]);let C=t.useCallback(e=>{let o=D(),a={...e,id:o};if(d(m=>[...m,a]),e.duration!==0){let m=setTimeout(()=>{T.current(o);},e.duration||5e3);r.current.set(o,m);}return o},[]),f=t.useCallback(()=>{r.current.forEach(e=>clearTimeout(e)),r.current.clear(),d(e=>(s(new Set(e.map(o=>o.id))),e));},[]);return t.useEffect(()=>{let e=r.current;return ()=>{e.forEach(o=>clearTimeout(o)),e.clear();}},[]),t__default.default.createElement(B.Provider,{value:{toasts:c,addToast:C,removeToast:u,clearToasts:f}},n,t__default.default.createElement(J,{toasts:c,dismissing:l,onExited:g}))},U={"top-left":"top-4 left-4 flex-col","top-center":"top-4 left-1/2 -translate-x-1/2 flex-col","top-right":"top-4 right-4 flex-col","bottom-left":"bottom-4 left-4 flex-col-reverse","bottom-center":"bottom-4 left-1/2 -translate-x-1/2 flex-col-reverse","bottom-right":"bottom-4 right-4 flex-col-reverse"},G=({position:n,children:c})=>t__default.default.createElement(H.Provider,{value:true},t__default.default.createElement("ol",{"data-toast-viewport":n,className:chunkITRGJNWL_cjs.a("pointer-events-none fixed z-50 flex w-[calc(100vw-2rem)] max-w-sm gap-2 m-0 list-none p-0",U[n])},c)),J=({toasts:n,dismissing:c,onExited:d})=>{if(n.length===0)return null;let l=n.reduce((s,r)=>{let i=r.position??"top-right";return (s[i]??=[]).push(r),s},{});return t__default.default.createElement(t__default.default.Fragment,null,Object.entries(l).map(([s,r])=>t__default.default.createElement(G,{key:s,position:s},r.map(i=>t__default.default.createElement("li",{key:i.id,className:"contents"},t__default.default.createElement(K,{...i,dismissing:c.has(i.id),onExited:()=>d(i.id)}))))))},F=t__default.default.forwardRef(({id:n,title:c,description:d,variant:l="default",position:s="top-right",animation:r="default",duration:i=5e3,onClose:u,action:g,className:T,children:C,appearDelay:f=10,animationMs:e=150,dismissing:o=false,onExited:a,...m},j)=>{let h=t__default.default.useContext(H),[V,L]=t.useState(f<=0),[y,W]=t.useState(false);t.useEffect(()=>{if(f<=0)return;let N=window.setTimeout(()=>L(true),f);return ()=>clearTimeout(N)},[f]);let M=t.useRef(false),S=t.useRef(u),E=t.useRef(a);t.useEffect(()=>{S.current=u,E.current=a;},[u,a]);let x=t.useCallback(()=>{M.current||(M.current=true,W(true),window.setTimeout(()=>{S.current?.(),L(false),E.current?.();},e));},[e]);t.useEffect(()=>{o&&x();},[o,x]),t.useEffect(()=>{if(!h&&i>0){let N=window.setTimeout(x,i);return ()=>clearTimeout(N)}},[h,i,x]);let X=()=>{switch(l){case "success":return t__default.default.createElement("svg",{className:b({variant:l}),fill:"currentColor",viewBox:"0 0 20 20"},t__default.default.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"}));case "error":return t__default.default.createElement("svg",{className:b({variant:l}),fill:"currentColor",viewBox:"0 0 20 20"},t__default.default.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"}));case "warning":return t__default.default.createElement("svg",{className:b({variant:l}),fill:"currentColor",viewBox:"0 0 20 20"},t__default.default.createElement("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"}));case "info":return t__default.default.createElement("svg",{className:b({variant:l}),fill:"currentColor",viewBox:"0 0 20 20"},t__default.default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"}));default:return null}};if(!V)return null;let I=l==="error",{style:O,..._}=m;return t__default.default.createElement("div",{ref:j,role:m.role??(I?"alert":"status"),"aria-live":m["aria-live"]??(I?"assertive":"polite"),"aria-atomic":m["aria-atomic"]??true,className:chunkITRGJNWL_cjs.a($({variant:l,position:h?null:s,animation:r}),h&&"w-full",y?"opacity-0":"opacity-100","pointer-events-auto",T),"data-visible":V?"true":"false","data-leaving":y?"true":"false",..._,style:{transition:`all ${e}ms ease-in-out`,...O,transform:y?"translateX(100%)":O?.transform??"translateX(0)"}},t__default.default.createElement("div",{className:"flex items-start space-x-3"},X(),t__default.default.createElement("div",{className:"flex-1 min-w-0"},c&&t__default.default.createElement("div",{className:"text-sm font-medium"},c),d&&t__default.default.createElement("div",{className:"mt-1 text-sm opacity-90"},d),C)),g&&t__default.default.createElement("button",{type:"button",onClick:g.onClick,className:"ml-4 text-sm font-medium underline hover:no-underline focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-ring"},g.label),t__default.default.createElement("button",{type:"button",onClick:x,className:"absolute top-2 right-2 p-1 rounded-md hover:bg-muted focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-ring","aria-label":"Close notification"},t__default.default.createElement("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20"},t__default.default.createElement("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"}))))});F.displayName="Toast";var K=chunk7SPPGTBT_cjs.a(F),ot=()=>{let{addToast:n,removeToast:c,clearToasts:d}=q();return {success:(s,r)=>n({variant:"success",title:"Success",description:s,...r}),error:(s,r)=>n({variant:"error",title:"Error",description:s,...r}),warning:(s,r)=>n({variant:"warning",title:"Warning",description:s,...r}),info:(s,r)=>n({variant:"info",title:"Info",description:s,...r}),custom:s=>n(s),dismiss:c,clear:d}};exports.a=$;exports.b=b;exports.c=q;exports.d=et;exports.e=K;exports.f=ot;//# sourceMappingURL=chunk-JTHW25XF.cjs.map
|
|
3
|
+
//# sourceMappingURL=chunk-JTHW25XF.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/core/toast.tsx"],"names":["toastVariants","cva","toastIconVariants","ToastContext","React","ToastViewportContext","useToast","context","toastSequence","nextToastId","ToastProvider","children","toasts","setToasts","useState","dismissing","setDismissing","timeoutRefs","useRef","clearTimer","useCallback","id","timeoutId","removeToast","prev","next","finalize","toast","removeToastRef","useEffect","addToast","newToast","clearToasts","refs","ToastContainer","VIEWPORT_POSITIONS","ToastViewport","position","cn","onExited","toastsByPosition","acc","positionToasts","Toast","ToastComponent","_id","title","description","variant","animation","duration","onClose","action","className","appearDelay","animationMs","props","ref","contained","isVisible","setIsVisible","isLeaving","setIsLeaving","timer","closedRef","onCloseRef","onExitedRef","handleClose","getIcon","isUrgent","callerStyle","restProps","memo","useToastNotification","message","options"],"mappings":"mTAwDA,IAAMA,CAAAA,CAAgBC,0BAAAA,CACpB,uIAAA,CACA,CACE,QAAA,CAAU,CACR,OAAA,CAAS,CACP,OAAA,CACE,sEAAA,CACF,OAAA,CACE,6EAAA,CACF,KAAA,CACE,oFAAA,CACF,OAAA,CACE,6EAAA,CACF,KAAM,oEACR,CAAA,CAMA,QAAA,CAAU,CACR,UAAA,CAAY,uDAAA,CACZ,YAAA,CACE,0EAAA,CACF,YAAa,wDAAA,CACb,aAAA,CACE,0DAAA,CACF,eAAA,CACE,6EAAA,CACF,cAAA,CACE,2DACJ,CAAA,CACA,UAAW,CACT,OAAA,CAAS,kDAAA,CACT,KAAA,CAAO,gDAAA,CACP,IAAA,CAAM,mCAAA,CACN,KAAA,CAAO,qCACP,IAAA,CAAM,EACR,CACF,CAAA,CACA,gB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,OAAA,CACT,KAAA,CAAO,QACP,WAAA,CAAa4C,CAAAA,CACb,GAAGC,CACL,CAAC,CAAA,CAEH,OAAA,CAAS,CACPD,CAAAA,CACAC,IAEA7C,CAAAA,CAAS,CACP,OAAA,CAAS,SAAA,CACT,KAAA,CAAO,SAAA,CACP,WAAA,CAAa4C,CAAAA,CACb,GAAGC,CACL,CAAC,CAAA,CAEH,IAAA,CAAM,CAACD,CAAAA,CAAiBC,CAAAA,GACtB7C,CAAAA,CAAS,CACP,OAAA,CAAS,MAAA,CACT,KAAA,CAAO,MAAA,CACP,WAAA,CAAa4C,CAAAA,CACb,GAAGC,CACL,CAAC,CAAA,CAEH,MAAA,CAAShD,CAAAA,EAAkCG,CAAAA,CAASH,CAAK,CAAA,CAEzD,OAAA,CAASJ,CAAAA,CACT,KAAA,CAAOS,CACT,CAGF","file":"chunk-JTHW25XF.cjs","sourcesContent":["import React, { useState, useEffect, useCallback, useRef } from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"../../lib/utils\";\nimport { memo } from \"../../lib/memo\";\n\n/**\n * Notifications, and the provider that owns them.\n *\n * Three things about this component are worth reading before changing it.\n *\n * ## The viewport positions, the toast does not\n *\n * A `ToastProvider` renders one `ToastViewport` per position: a fixed, bounded\n * column that stacks its children in normal flex flow with a gap. The toasts\n * inside it are ordinary block elements.\n *\n * Every toast used to position itself instead, with `fixed right-4` plus `w-full`\n * and a `translateY(index * 8px)` for stacking. Both halves were wrong. `w-full`\n * against a fixed right offset made a 1200px-wide box starting at x=-16, so the\n * notification ran off the left edge of the window; and 8px of offset for a box\n * about 94px tall meant the second notification covered nearly all of the first.\n *\n * A standalone `<Toast position=\"top-right\">` still positions itself, because\n * that is a supported way to use it. `ToastViewportContext` is how a toast knows\n * which of the two it is in.\n *\n * ## One dismissal path\n *\n * Closing a toast used to leave it in the provider's `toasts` array forever: the\n * component unmounted itself and nothing told the provider. A persistent toast\n * dismissed ten times left ten invisible entries behind.\n *\n * Now every route - the close button, the timeout, `dismiss(id)`, `clear()` -\n * goes through the same two steps. `removeToast` marks the toast as dismissing,\n * which starts its exit animation; when the animation ends the toast reports back\n * and the provider drops it from state. `onClose` fires exactly once, guarded by\n * a ref, whichever route was taken.\n *\n * There is also exactly one timer per toast. Inside a viewport the provider owns\n * it; standalone, the toast owns its own. Previously both ran, and the provider's\n * could remove a toast before its own exit finished.\n *\n * ## Announcement is the default, not an opt-in\n *\n * A toast carries `role=\"status\"` and `aria-live=\"polite\"`, or `role=\"alert\"` and\n * `aria-live=\"assertive\"` for the error variant, so a message that appears\n * without warning is announced without the caller arranging anything. It is also\n * `aria-atomic`, so the title and description are read as one message rather than\n * as two arrivals. Pass `role` or `aria-live` to override either.\n *\n * Focus is deliberately not moved. A notification that steals focus interrupts\n * whatever the reader was doing, which is worse than the problem it solves; the\n * close button and any action stay reachable by Tab.\n */\n\n// Toast variants\nconst toastVariants = cva(\n \"relative flex items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all duration-300\",\n {\n variants: {\n variant: {\n default:\n \"border-border bg-card text-card-foreground shadow-lg hover:shadow-xl\",\n success:\n \"border-success-200 bg-success-50 text-success-900 shadow-lg hover:shadow-xl\",\n error:\n \"border-destructive/20 bg-destructive/10 text-destructive shadow-lg hover:shadow-xl\",\n warning:\n \"border-warning-200 bg-warning-50 text-warning-900 shadow-lg hover:shadow-xl\",\n info: \"border-info-200 bg-info-50 text-info-900 shadow-lg hover:shadow-xl\",\n },\n // Only applied when the toast is positioning itself. Inside a viewport the\n // column owns the position and the toast just fills its width.\n //\n // The width bound is the fix for the clipping: `w-full` next to a fixed\n // right offset is a full-viewport box pushed 16px off the left edge.\n position: {\n \"top-left\": \"fixed top-4 left-4 z-50 w-[calc(100vw-2rem)] max-w-sm\",\n \"top-center\":\n \"fixed top-4 left-1/2 -translate-x-1/2 z-50 w-[calc(100vw-2rem)] max-w-sm\",\n \"top-right\": \"fixed top-4 right-4 z-50 w-[calc(100vw-2rem)] max-w-sm\",\n \"bottom-left\":\n \"fixed bottom-4 left-4 z-50 w-[calc(100vw-2rem)] max-w-sm\",\n \"bottom-center\":\n \"fixed bottom-4 left-1/2 -translate-x-1/2 z-50 w-[calc(100vw-2rem)] max-w-sm\",\n \"bottom-right\":\n \"fixed bottom-4 right-4 z-50 w-[calc(100vw-2rem)] max-w-sm\",\n },\n animation: {\n default: \"animate-in slide-in-from-right-full duration-300\",\n slide: \"animate-in slide-in-from-bottom-4 duration-300\",\n fade: \"animate-in fade-in-0 duration-300\",\n scale: \"animate-in zoom-in-95 duration-300\",\n none: \"\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n position: \"top-right\",\n animation: \"default\",\n },\n },\n);\n\nconst toastIconVariants = cva(\n \"flex-shrink-0 w-5 h-5 transition-colors duration-200\",\n {\n variants: {\n variant: {\n default: \"text-muted-foreground\",\n success: \"text-success-600\",\n error: \"text-destructive\",\n warning: \"text-warning-600\",\n info: \"text-info-600\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n },\n);\n\nexport type ToastPosition =\n | \"top-left\"\n | \"top-center\"\n | \"top-right\"\n | \"bottom-left\"\n | \"bottom-center\"\n | \"bottom-right\";\n\n// Types\nexport interface ToastProps\n extends\n VariantProps<typeof toastVariants>,\n React.HTMLAttributes<HTMLDivElement> {\n id?: string;\n title?: string;\n description?: string;\n duration?: number;\n onClose?: () => void;\n action?: {\n label: string;\n onClick: () => void;\n };\n className?: string;\n children?: React.ReactNode;\n appearDelay?: number; // time in ms before first render becomes visible; default 10\n animationMs?: number; // exit animation duration; default 150\n /**\n * Internal. Set by the viewport to start the exit animation, so that a\n * programmatic `dismiss(id)` animates out like a click on the close button\n * rather than vanishing.\n */\n dismissing?: boolean;\n /** Internal. Told to the provider when the exit animation has finished. */\n onExited?: () => void;\n}\n\nexport interface ToastContextType {\n toasts: ToastProps[];\n addToast: (toast: Omit<ToastProps, \"id\">) => string;\n removeToast: (id: string) => void;\n clearToasts: () => void;\n}\n\n// Toast Context\nconst ToastContext = React.createContext<ToastContextType | undefined>(\n undefined,\n);\n\n/**\n * True inside a `ToastViewport`.\n *\n * A contained toast does not position itself and does not run its own\n * auto-dismiss timer, because the viewport does the first and the provider does\n * the second. Both used to happen twice.\n */\nconst ToastViewportContext = React.createContext(false);\n\nexport const useToast = () => {\n const context = React.useContext(ToastContext);\n if (!context) {\n throw new Error(\"useToast must be used within a ToastProvider\");\n }\n return context;\n};\n\n/**\n * Ids are a counter, not `Math.random()`.\n *\n * Random ids differ between a server render and the client that hydrates it,\n * which is a hydration mismatch waiting for the first server-rendered toast. A\n * counter is stable for a given sequence of calls, and these ids are only ever\n * used to address a toast within one provider.\n */\nlet toastSequence = 0;\nconst nextToastId = () => `toast-${++toastSequence}`;\n\n// Toast Provider\nexport const ToastProvider: React.FC<{ children: React.ReactNode }> = ({\n children,\n}) => {\n const [toasts, setToasts] = useState<ToastProps[]>([]);\n // Toasts whose exit animation is running. They are still in `toasts` - and so\n // still rendered - until the animation reports back.\n const [dismissing, setDismissing] = useState<ReadonlySet<string>>(\n () => new Set(),\n );\n const timeoutRefs = useRef<Map<string, ReturnType<typeof setTimeout>>>(\n new Map(),\n );\n\n const clearTimer = useCallback((id: string) => {\n const timeoutId = timeoutRefs.current.get(id);\n if (timeoutId) {\n clearTimeout(timeoutId);\n timeoutRefs.current.delete(id);\n }\n }, []);\n\n /** Starts the exit. The toast leaves the array in `finalize`, not here. */\n const removeToast = useCallback(\n (id: string) => {\n clearTimer(id);\n setDismissing((prev) => {\n if (prev.has(id)) return prev;\n const next = new Set(prev);\n next.add(id);\n return next;\n });\n },\n [clearTimer],\n );\n\n /** The exit has finished: drop it. */\n const finalize = useCallback(\n (id: string) => {\n clearTimer(id);\n setToasts((prev) => prev.filter((toast) => toast.id !== id));\n setDismissing((prev) => {\n if (!prev.has(id)) return prev;\n const next = new Set(prev);\n next.delete(id);\n return next;\n });\n },\n [clearTimer],\n );\n\n const removeToastRef = useRef(removeToast);\n useEffect(() => {\n removeToastRef.current = removeToast;\n }, [removeToast]);\n\n const addToast = useCallback((toast: Omit<ToastProps, \"id\">) => {\n const id = nextToastId();\n const newToast = { ...toast, id };\n\n setToasts((prev) => [...prev, newToast]);\n\n // The provider owns the timer for a toast it renders, and it starts the same\n // exit a click on the close button would. The toast's own timer is disabled\n // inside a viewport, so this is the only one.\n if (toast.duration !== 0) {\n const timeoutId = setTimeout(() => {\n removeToastRef.current(id);\n }, toast.duration || 5000);\n timeoutRefs.current.set(id, timeoutId);\n }\n\n return id;\n }, []);\n\n const clearToasts = useCallback(() => {\n timeoutRefs.current.forEach((timeoutId) => clearTimeout(timeoutId));\n timeoutRefs.current.clear();\n // Animate them all out rather than cutting to nothing, so `clear()` looks\n // like dismissing each one.\n setToasts((prev) => {\n setDismissing(new Set(prev.map((toast) => toast.id!)));\n return prev;\n });\n }, []);\n\n // Cleanup on unmount\n useEffect(() => {\n const refs = timeoutRefs.current;\n return () => {\n refs.forEach((timeoutId) => clearTimeout(timeoutId));\n refs.clear();\n };\n }, []);\n\n return (\n <ToastContext.Provider\n value={{ toasts, addToast, removeToast, clearToasts }}\n >\n {children}\n <ToastContainer\n toasts={toasts}\n dismissing={dismissing}\n onExited={finalize}\n />\n </ToastContext.Provider>\n );\n};\n\nconst VIEWPORT_POSITIONS: Record<ToastPosition, string> = {\n // Bottom edges stack upwards, so the newest is nearest the edge and the older\n // ones move away from it. Reversing the column is what does that.\n \"top-left\": \"top-4 left-4 flex-col\",\n \"top-center\": \"top-4 left-1/2 -translate-x-1/2 flex-col\",\n \"top-right\": \"top-4 right-4 flex-col\",\n \"bottom-left\": \"bottom-4 left-4 flex-col-reverse\",\n \"bottom-center\": \"bottom-4 left-1/2 -translate-x-1/2 flex-col-reverse\",\n \"bottom-right\": \"bottom-4 right-4 flex-col-reverse\",\n};\n\n/**\n * One bounded column per position.\n *\n * `w-[calc(100vw-2rem)] max-w-sm` is the pair that keeps it on screen: full width\n * minus the 16px inset on each side, up to a readable maximum. The column is\n * `pointer-events-none` so it does not swallow clicks on the page underneath it,\n * and each toast turns pointer events back on for itself.\n */\nconst ToastViewport: React.FC<{\n position: ToastPosition;\n children: React.ReactNode;\n}> = ({ position, children }) => (\n <ToastViewportContext.Provider value={true}>\n <ol\n data-toast-viewport={position}\n className={cn(\n \"pointer-events-none fixed z-50 flex w-[calc(100vw-2rem)] max-w-sm gap-2 m-0 list-none p-0\",\n VIEWPORT_POSITIONS[position],\n )}\n >\n {children}\n </ol>\n </ToastViewportContext.Provider>\n);\n\n// Toast Container\nconst ToastContainer: React.FC<{\n toasts: ToastProps[];\n dismissing: ReadonlySet<string>;\n onExited: (id: string) => void;\n}> = ({ toasts, dismissing, onExited }) => {\n if (toasts.length === 0) return null;\n\n const toastsByPosition = toasts.reduce(\n (acc, toast) => {\n const position = (toast.position ?? \"top-right\") as ToastPosition;\n (acc[position] ??= []).push(toast);\n return acc;\n },\n {} as Record<ToastPosition, ToastProps[]>,\n );\n\n return (\n <>\n {(\n Object.entries(toastsByPosition) as [ToastPosition, ToastProps[]][]\n ).map(([position, positionToasts]) => (\n <ToastViewport key={position} position={position}>\n {positionToasts.map((toast) => (\n <li key={toast.id} className=\"contents\">\n <Toast\n {...toast}\n dismissing={dismissing.has(toast.id!)}\n onExited={() => onExited(toast.id!)}\n />\n </li>\n ))}\n </ToastViewport>\n ))}\n </>\n );\n};\n\n// Individual Toast Component\nconst ToastComponent = React.forwardRef<HTMLDivElement, ToastProps>(\n (\n {\n id: _id,\n title,\n description,\n variant = \"default\",\n position = \"top-right\",\n animation = \"default\",\n duration = 5000,\n onClose,\n action,\n className,\n children,\n appearDelay = 10,\n animationMs = 150,\n dismissing = false,\n onExited,\n ...props\n },\n ref,\n ) => {\n const contained = React.useContext(ToastViewportContext);\n const [isVisible, setIsVisible] = useState(appearDelay <= 0);\n const [isLeaving, setIsLeaving] = useState(false);\n\n useEffect(() => {\n if (appearDelay <= 0) {\n return;\n }\n const timer = window.setTimeout(() => setIsVisible(true), appearDelay);\n return () => clearTimeout(timer);\n }, [appearDelay]);\n\n // `onClose` fires once, whichever route got here: the close button, the\n // timeout, `dismiss(id)` or `clear()`. Without the guard, a second click\n // during the exit animation fired it twice.\n const closedRef = useRef(false);\n const onCloseRef = useRef(onClose);\n const onExitedRef = useRef(onExited);\n useEffect(() => {\n onCloseRef.current = onClose;\n onExitedRef.current = onExited;\n }, [onClose, onExited]);\n\n const handleClose = useCallback(() => {\n if (closedRef.current) return;\n closedRef.current = true;\n setIsLeaving(true);\n window.setTimeout(() => {\n onCloseRef.current?.();\n setIsVisible(false);\n // The provider drops it from state here, after the animation, so the\n // array and the screen agree.\n onExitedRef.current?.();\n }, animationMs);\n }, [animationMs]);\n\n // Started from outside: `dismiss(id)`, `clear()`, or the provider's timeout.\n useEffect(() => {\n if (dismissing) handleClose();\n }, [dismissing, handleClose]);\n\n // Auto close after duration.\n //\n // Only when standalone. Inside a viewport the provider owns this timer, and\n // running both meant a toast could be removed from state while its own exit\n // was still going.\n useEffect(() => {\n if (contained) return undefined;\n if (duration > 0) {\n const timer = window.setTimeout(handleClose, duration);\n return () => clearTimeout(timer);\n }\n return undefined;\n }, [contained, duration, handleClose]);\n\n const getIcon = () => {\n switch (variant) {\n case \"success\":\n return (\n <svg\n className={toastIconVariants({ variant })}\n fill=\"currentColor\"\n viewBox=\"0 0 20 20\"\n >\n <path\n fillRule=\"evenodd\"\n d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n case \"error\":\n return (\n <svg\n className={toastIconVariants({ variant })}\n fill=\"currentColor\"\n viewBox=\"0 0 20 20\"\n >\n <path\n fillRule=\"evenodd\"\n d=\"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n case \"warning\":\n return (\n <svg\n className={toastIconVariants({ variant })}\n fill=\"currentColor\"\n viewBox=\"0 0 20 20\"\n >\n <path\n fillRule=\"evenodd\"\n d=\"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n case \"info\":\n return (\n <svg\n className={toastIconVariants({ variant })}\n fill=\"currentColor\"\n viewBox=\"0 0 20 20\"\n >\n <path\n fillRule=\"evenodd\"\n d=\"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z\"\n clipRule=\"evenodd\"\n />\n </svg>\n );\n default:\n return null;\n }\n };\n\n if (!isVisible) return null;\n\n // An error is the one variant a reader should be interrupted for. Everything\n // else waits for a pause. A caller who knows better can pass either.\n const isUrgent = variant === \"error\";\n const { style: callerStyle, ...restProps } = props;\n\n return (\n <div\n ref={ref}\n role={props.role ?? (isUrgent ? \"alert\" : \"status\")}\n aria-live={props[\"aria-live\"] ?? (isUrgent ? \"assertive\" : \"polite\")}\n // Read the title and the description as one message rather than as two\n // separate arrivals.\n aria-atomic={props[\"aria-atomic\"] ?? true}\n className={cn(\n toastVariants({\n variant,\n // Inside a viewport the column positions it; on its own it has to.\n position: contained ? null : position,\n animation,\n }),\n contained && \"w-full\",\n isLeaving ? \"opacity-0\" : \"opacity-100\",\n \"pointer-events-auto\",\n className,\n )}\n data-visible={isVisible ? \"true\" : \"false\"}\n data-leaving={isLeaving ? \"true\" : \"false\"}\n {...restProps}\n style={{\n transition: `all ${animationMs}ms ease-in-out`,\n ...callerStyle,\n // Last, so the exit is not silently overridden by a caller's transform.\n // It used to be first, and the container passed a transform on every\n // toast, so the exit animation never ran for a toast in a provider.\n transform: isLeaving\n ? \"translateX(100%)\"\n : (callerStyle?.transform ?? \"translateX(0)\"),\n }}\n >\n <div className=\"flex items-start space-x-3\">\n {getIcon()}\n <div className=\"flex-1 min-w-0\">\n {title && <div className=\"text-sm font-medium\">{title}</div>}\n {description && (\n <div className=\"mt-1 text-sm opacity-90\">{description}</div>\n )}\n {children}\n </div>\n </div>\n\n {action && (\n <button\n type=\"button\"\n onClick={action.onClick}\n className=\"ml-4 text-sm font-medium underline hover:no-underline focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-ring\"\n >\n {action.label}\n </button>\n )}\n\n <button\n type=\"button\"\n onClick={handleClose}\n className=\"absolute top-2 right-2 p-1 rounded-md hover:bg-muted focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-ring\"\n aria-label=\"Close notification\"\n >\n <svg className=\"w-4 h-4\" fill=\"currentColor\" viewBox=\"0 0 20 20\">\n <path\n fillRule=\"evenodd\"\n d=\"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z\"\n clipRule=\"evenodd\"\n />\n </svg>\n </button>\n </div>\n );\n },\n);\n\nToastComponent.displayName = \"Toast\";\n\n// Memoize Toast for performance optimization\nexport const Toast = memo(ToastComponent) as typeof ToastComponent;\n\n// Toast Hook for easy usage\nexport const useToastNotification = () => {\n const { addToast, removeToast, clearToasts } = useToast();\n\n const toast = {\n success: (\n message: string,\n options?: Omit<ToastProps, \"variant\" | \"title\">,\n ) =>\n addToast({\n variant: \"success\",\n title: \"Success\",\n description: message,\n ...options,\n }),\n\n error: (message: string, options?: Omit<ToastProps, \"variant\" | \"title\">) =>\n addToast({\n variant: \"error\",\n title: \"Error\",\n description: message,\n ...options,\n }),\n\n warning: (\n message: string,\n options?: Omit<ToastProps, \"variant\" | \"title\">,\n ) =>\n addToast({\n variant: \"warning\",\n title: \"Warning\",\n description: message,\n ...options,\n }),\n\n info: (message: string, options?: Omit<ToastProps, \"variant\" | \"title\">) =>\n addToast({\n variant: \"info\",\n title: \"Info\",\n description: message,\n ...options,\n }),\n\n custom: (toast: Omit<ToastProps, \"id\">) => addToast(toast),\n\n dismiss: removeToast,\n clear: clearToasts,\n };\n\n return toast;\n};\n\n// Export variants for external use\nexport { toastVariants, toastIconVariants };\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';var chunkUC577SR4_cjs=require('./chunk-UC577SR4.cjs'),chunkFUENXWR7_cjs=require('./chunk-FUENXWR7.cjs'),chunk7SPPGTBT_cjs=require('./chunk-7SPPGTBT.cjs'),chunkITRGJNWL_cjs=require('./chunk-ITRGJNWL.cjs'),t=require('react'),classVarianceAuthority=require('class-variance-authority');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var t__default=/*#__PURE__*/_interopDefault(t);function se(o){return typeof o=="boolean"?o:typeof o=="string"?o!=="false"&&o!=="":!!o}function ie(o){return o==null?"":String(o)}var Ie=classVarianceAuthority.cva("flex flex-wrap items-center gap-2 p-4 bg-muted border-b border-border",{variants:{variant:{default:"bg-muted",compact:"p-2 bg-card",minimal:"p-2 bg-transparent border-0"}},defaultVariants:{variant:"default"}});function ue({data:o,columns:C,searchable:D=true,searchPlaceholder:le="Search...",searchKeys:j,onSearch:P,searchTerm:E,onSearchTermChange:K,filterable:T=false,manualSearch:Y=false,manualFiltering:_=false,manualSorting:q=false,filters:b=[],onFilter:V,columnFilters:G,onColumnFiltersChange:H,defaultSortColumn:de,defaultSortDirection:ce="asc",sortColumn:J,sortDirection:ge,onSortChange:Q,defaultPageSize:me=10,showPagination:y=true,currentPage:U,pageSize:W,onPageChange:X,onPageSizeChange:z,totalItems:i,showSearch:Z=true,showFilters:R=true,filterBarClassName:fe,searchBarClassName:pe,rowKey:be="id",emptyText:ye="No data found",...he}){let B=E!==void 0,$=G!==void 0,w=J!==void 0,a=U!==void 0,[ke,xe]=t.useState(""),m=B?E:ke,ee=t.useMemo(()=>B?e=>K?.(e):xe,[B,K]),[Ce,ve]=t.useState({}),c=$?G:Ce,M=t.useMemo(()=>$?e=>H?.(e):ve,[$,H]),[Se,Te]=t.useState(de),[we,Ne]=t.useState(ce),v=w?J:Se,A=w?ge:we,ne=Te,re=Ne,[Fe,De]=t.useState(1),[Pe,Ve]=t.useState(me),f=a?U:Fe,s=W!==void 0?W:Pe,p=t.useMemo(()=>a?e=>X?.(e):De,[a,X]),te=t.useMemo(()=>z?e=>z(e):Ve,[z]),h=t.useMemo(()=>{if(Y||!D||!m.trim())return o;let e=m.toLowerCase(),r=j||C.map(n=>n.dataIndex||n.key).filter(Boolean);return o.filter(n=>r.some(u=>{let l=n[u];return l==null?false:String(l).toLowerCase().includes(e)}))},[o,m,D,j,C,Y]),k=t.useMemo(()=>_||!T||b.length===0||Object.keys(c).length===0?h:h.filter(e=>b.every(r=>{let n=c[r.key];if(n==null||n==="")return true;if(r.filterFn)return r.filterFn(n,e);let u=e[r.key];switch(r.type){case "text":return String(u).toLowerCase().includes(String(n).toLowerCase());case "number":{let l=Number(n);return Number.isNaN(l)?true:Number(u)===l}case "boolean":return !!u===se(n);case "select":return String(u)===String(n);default:return String(u).includes(String(n))}})),[h,c,T,b,_]),d=t.useMemo(()=>{if(q||!v)return k;let e=[...k],r=C.find(n=>n.key===v);return !r||!r.sortable||e.sort((n,u)=>{let l=r.dataIndex?n[r.dataIndex]:n[r.key],S=r.dataIndex?u[r.dataIndex]:u[r.key];if(l==null)return 1;if(S==null)return -1;let N=0;return typeof l=="number"&&typeof S=="number"?N=l-S:N=String(l).localeCompare(String(S)),A==="asc"?N:-N}),e},[k,v,A,C,q]),ze=t.useMemo(()=>{if(!y||a&&i!==void 0)return d;let e=(f-1)*s,r=e+s;return d.slice(e,r)},[d,f,s,y,a,i]);t.useMemo(()=>y?Math.ceil(a&&i!==void 0?i/s:d.length/s):1,[y,a,i,s,d.length]);let Be=t.useCallback(e=>{ee(e),a||p(1);},[ee,p,a]),I=t.useCallback((e,r)=>{let n={...c,[e]:r};M(n),a||p(1);},[c,M,p,a]),$e=t.useCallback((e,r)=>{if(w){Q?.(e.key,r);return}ne(e.key),re(r);},[w,Q,ne,re]),Me=t.useCallback((e,r)=>{p(e),r!==s&&(te(r),p(1));},[s,p,te]);return t__default.default.useEffect(()=>{P&&P(m,h);},[m,h,P]),t__default.default.useEffect(()=>{V&&V(c,k);},[c,k,V]),t__default.default.createElement("div",{className:"w-full"},(Z||R&&T&&b.length>0)&&t__default.default.createElement("div",{className:chunkITRGJNWL_cjs.a(Ie(),fe)},Z&&D&&t__default.default.createElement("div",{className:chunkITRGJNWL_cjs.a("flex-1 min-w-[200px]",pe)},t__default.default.createElement(chunkFUENXWR7_cjs.b,{type:"text",placeholder:le,value:m,onChange:e=>Be(e.target.value),className:"w-full","aria-label":"Search table"})),R&&T&&b.length>0&&t__default.default.createElement("div",{className:"flex flex-wrap items-center gap-2"},b.map(e=>{let r=c[e.key];return e.type==="boolean"?t__default.default.createElement("select",{key:e.key,value:r==null?"":se(r)?"true":"false",onChange:n=>I(e.key,n.target.value===""?void 0:n.target.value==="true"),className:"rounded-md border border-input px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring focus:border-primary","aria-label":`Filter by ${e.key}`},t__default.default.createElement("option",{value:""},"All ",e.key),t__default.default.createElement("option",{value:"true"},e.placeholder?`${e.placeholder}: yes`:"Yes"),t__default.default.createElement("option",{value:"false"},e.placeholder?`${e.placeholder}: no`:"No")):e.type==="select"&&e.options?t__default.default.createElement("select",{key:e.key,value:ie(r),onChange:n=>I(e.key,n.target.value||void 0),className:"rounded-md border border-input px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring focus:border-primary","aria-label":`Filter by ${e.key}`},t__default.default.createElement("option",{value:""},"All ",e.key),e.options.map(n=>t__default.default.createElement("option",{key:n.value,value:String(n.value)},n.label))):t__default.default.createElement(chunkFUENXWR7_cjs.b,{key:e.key,type:e.type==="number"?"number":"text",placeholder:e.placeholder||`Filter ${e.key}...`,value:ie(r),onChange:n=>I(e.key,n.target.value===""?void 0:e.type==="number"?Number(n.target.value):n.target.value),className:"min-w-[150px]","aria-label":`Filter by ${e.key}`})}),Object.keys(c).length>0&&t__default.default.createElement("button",{type:"button",onClick:()=>M({}),className:"px-3 py-2 text-sm text-muted-foreground hover:text-foreground underline","aria-label":"Clear all filters"},"Clear filters"))),t__default.default.createElement(chunkUC577SR4_cjs.d,{...he,data:ze,columns:C,rowKey:be,emptyText:ye,...v&&{sortColumn:v,sortDirection:A},onSort:$e,...y&&{pagination:{current:f,pageSize:s,total:a&&i!==void 0?i:d.length,onChange:Me,showSizeChanger:true}}}),y&&(a&&i!==void 0?i>0:d.length>0)&&t__default.default.createElement("div",{className:"mt-2 px-4 py-2 text-sm text-muted-foreground"},a&&i!==void 0?t__default.default.createElement(t__default.default.Fragment,null,"Showing ",(f-1)*s+1," to"," ",Math.min(f*s,i)," of ",i," ","results",m&&" (filtered)"):t__default.default.createElement(t__default.default.Fragment,null,"Showing ",(f-1)*s+1," to"," ",Math.min(f*s,d.length)," of"," ",d.length," results",m&&` (filtered from ${o.length} total)`)))}ue.displayName="DataTable";var He=chunk7SPPGTBT_cjs.a(ue);exports.a=ue;exports.b=He;//# sourceMappingURL=chunk-KASVYULP.cjs.map
|
|
3
|
+
//# sourceMappingURL=chunk-KASVYULP.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/core/data-table.tsx"],"names":["asBoolean","value","inputValue","filterBarVariants","cva","DataTable","initialData","columns","searchable","searchPlaceholder","searchKeys","onSearch","controlledSearchTerm","onSearchTermChange","filterable","manualSearch","manualFiltering","manualSorting","filters","onFilter","controlledColumnFilters","onColumnFiltersChange","defaultSortColumn","defaultSortDirection","controlledSortColumn","controlledSortDirection","onSortChange","defaultPageSize","showPagination","controlledCurrentPage","controlledPageSize","onPageChange","onPageSizeChange","totalItems","showSearch","showFilters","filterBarClassName","searchBarClassName","rowKey","emptyText","tableProps","isControlledSearch","isControlledFilters","isControlledSort","isControlledPagination","internalSearchTerm","setInternalSearchTerm","useState","searchTerm","setSearchTerm","useMemo","internalColumnFilters","setInternalColumnFilters","columnFilters","setColumnFilters","internalSortColumn","setInternalSortColumn","internalSortDirection","setInternalSortDirection","sortColumn","sortDirection","setSortColumn","setSortDirection","internalCurrentPage","setInternalCurrentPage","internalPageSize","setInternalPageSize","currentPage","pageSize","setCurrentPage","page","setPageSize","size","searchFilteredData","term","keys","col","record","key","filterFilteredData","filter","filterValue","recordValue","wanted","sortedData","sorted","column","a","b","aValue","bValue","comparison","paginatedData","startIndex","endIndex","handleSearch","useCallback","handleFilterChange","newFilters","handleSort","direction","handlePageChange","newPageSize","React","cn","Input","e","option","Table","DataTableMemoized","memo"],"mappings":"uZAoGA,SAASA,EAAAA,CAAUC,EAAyB,CAC1C,OAAI,OAAOA,CAAAA,EAAU,SAAA,CAAkBA,CAAAA,CACnC,OAAOA,CAAAA,EAAU,SAAiBA,CAAAA,GAAU,OAAA,EAAWA,CAAAA,GAAU,EAAA,CAC9D,EAAQA,CACjB,CAGA,SAASC,EAAAA,CAAWD,EAAwB,CAC1C,OAA8BA,CAAAA,EAAU,IAAA,CAAO,EAAA,CAAK,MAAA,CAAOA,CAAK,CAClE,CAGA,IAAME,EAAAA,CAAoBC,0BAAAA,CACxB,uEAAA,CACA,CACE,QAAA,CAAU,CACR,OAAA,CAAS,CACP,QAAS,UAAA,CACT,OAAA,CAAS,aAAA,CACT,OAAA,CAAS,6BACX,CACF,CAAA,CACA,eAAA,CAAiB,CACf,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,SAAA,CAElEe,CAAAA,EAAc,aACjB,CAAA,CAEAuD,kBAAAA,CAAA,aAAA,CAAAA,kBAAAA,CAAA,QAAA,CAAA,IAAA,CAAE,UAAA,CAAA,CACUpC,CAAAA,CAAc,CAAA,EAAKC,EAAW,CAAA,CAAE,KAAA,CAAI,GAAA,CAC7C,IAAA,CAAK,IAAID,CAAAA,CAAcC,CAAAA,CAAUgB,CAAAA,CAAW,MAAM,EAAE,KAAA,CAAI,GAAA,CACxDA,CAAAA,CAAW,MAAA,CAAO,WAClBpC,CAAAA,EAAc,CAAA,gBAAA,EAAmB1C,CAAAA,CAAY,MAAM,SACtD,CAEJ,CAEN,CAEJ,CAEAD,GAAU,WAAA,CAAc,WAAA,CAIjB,IAAMwG,EAAAA,CAAoBC,oBAAKzG,EAAS","file":"chunk-KASVYULP.cjs","sourcesContent":["import React, { useState, useMemo, useCallback } from \"react\";\nimport { cva } from \"class-variance-authority\";\nimport { cn } from \"../../lib/utils\";\nimport { memo } from \"../../lib/memo\";\nimport { Table, TableColumn, TableProps } from \"./table\";\nimport { Input } from \"./input\";\n\n// Filter types\nexport type FilterType = \"text\" | \"select\" | \"number\" | \"date\" | \"boolean\";\n\nexport interface ColumnFilter<T = Record<string, unknown>> {\n key: string;\n type: FilterType;\n options?: Array<{ label: string; value: string | number }>;\n placeholder?: string;\n filterFn?: (value: unknown, record: T) => boolean;\n}\n\nexport interface DataTableProps<T = Record<string, unknown>> extends Omit<\n TableProps<T>,\n \"data\" | \"onSort\" | \"sortColumn\" | \"sortDirection\"\n> {\n data: T[];\n columns: TableColumn<T>[];\n\n // Search\n searchable?: boolean;\n searchPlaceholder?: string;\n searchKeys?: Array<keyof T | string>;\n onSearch?: (searchTerm: string, filteredData: T[]) => void;\n\n // Controlled search (for server-side filtering)\n searchTerm?: string;\n onSearchTermChange?: (searchTerm: string) => void;\n\n // Filtering\n filterable?: boolean;\n filters?: ColumnFilter<T>[];\n onFilter?: (filters: Record<string, unknown>, filteredData: T[]) => void;\n\n // Controlled filters (for server-side filtering)\n columnFilters?: Record<string, unknown>;\n onColumnFiltersChange?: (filters: Record<string, unknown>) => void;\n\n // Sorting (enhanced)\n defaultSortColumn?: string;\n defaultSortDirection?: \"asc\" | \"desc\";\n\n // Controlled sorting (for server-side sorting)\n sortColumn?: string;\n sortDirection?: \"asc\" | \"desc\";\n onSortChange?: (column: string, direction: \"asc\" | \"desc\") => void;\n\n // Pagination (enhanced)\n defaultPageSize?: number;\n showPagination?: boolean;\n\n // Controlled pagination (for server-side pagination)\n currentPage?: number;\n pageSize?: number;\n onPageChange?: (page: number) => void;\n onPageSizeChange?: (size: number) => void;\n totalItems?: number; // Required for server-side pagination\n\n /**\n * Who does the work.\n *\n * Passing `searchTerm`, `columnFilters` or `sortColumn` makes DataTable\n * controlled - it stops owning that piece of state - but it kept filtering and\n * sorting the rows you gave it anyway. For a server-backed table that is\n * actively wrong: a server searching without accent distinctions returns\n * `{ name: \"José\" }` for the query `jose`, and the local substring filter then\n * threw the row away while `totalItems` still counted it. Controlled sorting\n * likewise reordered the page the server had already ordered.\n *\n * Controlled state and processing ownership are separate questions now. Set\n * these when the rows arriving in `data` are already searched, filtered or\n * sorted; the callbacks still fire so you know what the user asked for.\n *\n * Pagination has always worked this way, under a different name: it is manual\n * when `currentPage` and `totalItems` are both given.\n */\n manualSearch?: boolean;\n manualFiltering?: boolean;\n manualSorting?: boolean;\n\n // UI\n showSearch?: boolean;\n showFilters?: boolean;\n filterBarClassName?: string;\n searchBarClassName?: string;\n}\n\n/**\n * What a boolean filter value means, from a control or from a consumer.\n *\n * The select below emits real booleans, but a controlled `columnFilters` may hold\n * whatever the consumer put there, and \"false\" arriving as a string used to mean\n * true.\n */\nfunction asBoolean(value: unknown): boolean {\n if (typeof value === \"boolean\") return value;\n if (typeof value === \"string\") return value !== \"false\" && value !== \"\";\n return Boolean(value);\n}\n\n/** Empty for a value that is absent, and \"0\" or \"false\" when that is the value. */\nfunction inputValue(value: unknown): string {\n return value === undefined || value === null ? \"\" : String(value);\n}\n\n// Filter bar component\nconst filterBarVariants = cva(\n \"flex flex-wrap items-center gap-2 p-4 bg-muted border-b border-border\",\n {\n variants: {\n variant: {\n default: \"bg-muted\",\n compact: \"p-2 bg-card\",\n minimal: \"p-2 bg-transparent border-0\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n },\n },\n);\n\nexport function DataTable<\n T extends Record<string, unknown> = Record<string, unknown>,\n>({\n data: initialData,\n columns,\n searchable = true,\n searchPlaceholder = \"Search...\",\n searchKeys,\n onSearch,\n searchTerm: controlledSearchTerm,\n onSearchTermChange,\n filterable = false,\n manualSearch = false,\n manualFiltering = false,\n manualSorting = false,\n filters = [],\n onFilter,\n columnFilters: controlledColumnFilters,\n onColumnFiltersChange,\n defaultSortColumn,\n defaultSortDirection = \"asc\",\n sortColumn: controlledSortColumn,\n sortDirection: controlledSortDirection,\n onSortChange,\n defaultPageSize = 10,\n showPagination = true,\n currentPage: controlledCurrentPage,\n pageSize: controlledPageSize,\n onPageChange,\n onPageSizeChange,\n totalItems,\n showSearch = true,\n showFilters = true,\n filterBarClassName,\n searchBarClassName,\n rowKey = \"id\",\n emptyText = \"No data found\",\n ...tableProps\n}: DataTableProps<T>) {\n // Determine if component is in controlled mode\n const isControlledSearch = controlledSearchTerm !== undefined;\n const isControlledFilters = controlledColumnFilters !== undefined;\n const isControlledSort = controlledSortColumn !== undefined;\n const isControlledPagination = controlledCurrentPage !== undefined;\n\n // Search state (controlled or uncontrolled)\n const [internalSearchTerm, setInternalSearchTerm] = useState(\"\");\n const searchTerm = isControlledSearch\n ? controlledSearchTerm\n : internalSearchTerm;\n const setSearchTerm = useMemo(\n () =>\n isControlledSearch\n ? (value: string) => onSearchTermChange?.(value)\n : setInternalSearchTerm,\n [isControlledSearch, onSearchTermChange],\n );\n\n // Filter state (controlled or uncontrolled)\n const [internalColumnFilters, setInternalColumnFilters] = useState<\n Record<string, unknown>\n >({});\n const columnFilters = isControlledFilters\n ? controlledColumnFilters\n : internalColumnFilters;\n const setColumnFilters = useMemo(\n () =>\n isControlledFilters\n ? (filters: Record<string, unknown>) => onColumnFiltersChange?.(filters)\n : setInternalColumnFilters,\n [isControlledFilters, onColumnFiltersChange],\n );\n\n // Sort state (controlled or uncontrolled)\n const [internalSortColumn, setInternalSortColumn] = useState<\n string | undefined\n >(defaultSortColumn);\n const [internalSortDirection, setInternalSortDirection] = useState<\n \"asc\" | \"desc\"\n >(defaultSortDirection);\n const sortColumn = isControlledSort\n ? controlledSortColumn\n : internalSortColumn;\n const sortDirection = isControlledSort\n ? controlledSortDirection\n : internalSortDirection;\n // Only the uncontrolled path uses these. A controlled table goes through\n // `handleSort`, which emits both values at once - see the comment there for\n // what the controlled versions of these used to do.\n const setSortColumn = setInternalSortColumn;\n const setSortDirection = setInternalSortDirection;\n\n // Pagination state (controlled or uncontrolled)\n const [internalCurrentPage, setInternalCurrentPage] = useState(1);\n const [internalPageSize, setInternalPageSize] = useState(defaultPageSize);\n const currentPage = isControlledPagination\n ? controlledCurrentPage\n : internalCurrentPage;\n const pageSize =\n controlledPageSize !== undefined ? controlledPageSize : internalPageSize;\n const setCurrentPage = useMemo(\n () =>\n isControlledPagination\n ? (page: number) => onPageChange?.(page)\n : setInternalCurrentPage,\n [isControlledPagination, onPageChange],\n );\n const setPageSize = useMemo(\n () =>\n onPageSizeChange\n ? (size: number) => onPageSizeChange(size)\n : setInternalPageSize,\n [onPageSizeChange],\n );\n\n // Apply search\n const searchFilteredData = useMemo(() => {\n // The rows already are the search result; searching them again would only\n // remove what the server decided to include.\n if (manualSearch) return initialData;\n if (!searchable || !searchTerm.trim()) {\n return initialData;\n }\n\n const term = searchTerm.toLowerCase();\n const keys =\n searchKeys ||\n columns.map((col) => col.dataIndex || col.key).filter(Boolean);\n\n return initialData.filter((record) => {\n return keys.some((key) => {\n const value =\n typeof key === \"string\"\n ? (record as Record<string, unknown>)[key]\n : record[key as keyof T];\n\n if (value === null || value === undefined) return false;\n\n return String(value).toLowerCase().includes(term);\n });\n });\n }, [initialData, searchTerm, searchable, searchKeys, columns, manualSearch]);\n\n // Apply column filters\n const filterFilteredData = useMemo(() => {\n if (manualFiltering) return searchFilteredData;\n if (\n !filterable ||\n filters.length === 0 ||\n Object.keys(columnFilters).length === 0\n ) {\n return searchFilteredData;\n }\n\n return searchFilteredData.filter((record) => {\n return filters.every((filter) => {\n const filterValue = columnFilters[filter.key];\n\n // Skip if no filter value\n if (\n filterValue === undefined ||\n filterValue === null ||\n filterValue === \"\"\n ) {\n return true;\n }\n\n // Use custom filter function if provided\n if (filter.filterFn) {\n return filter.filterFn(filterValue, record);\n }\n\n // Default filtering logic\n const recordValue = (record as Record<string, unknown>)[filter.key];\n\n switch (filter.type) {\n case \"text\":\n return String(recordValue)\n .toLowerCase()\n .includes(String(filterValue).toLowerCase());\n case \"number\": {\n // A filter value that is not a number matches nothing rather than\n // matching zero. `Number(\"\")` is 0, which is how a cleared input used\n // to leave only the zero-valued rows on screen.\n const wanted = Number(filterValue);\n if (Number.isNaN(wanted)) return true;\n return Number(recordValue) === wanted;\n }\n case \"boolean\":\n // Not `Boolean(filterValue)`. The control used to be a text input, so\n // typing \"false\" gave the string \"false\", and `Boolean(\"false\")` is\n // true - the filter selected exactly the records it was asked to\n // exclude.\n return Boolean(recordValue) === asBoolean(filterValue);\n case \"select\":\n return String(recordValue) === String(filterValue);\n default:\n return String(recordValue).includes(String(filterValue));\n }\n });\n });\n }, [searchFilteredData, columnFilters, filterable, filters, manualFiltering]);\n\n // Apply sorting\n const sortedData = useMemo(() => {\n // Keep the order the server sent. Re-sorting a page it has already ordered\n // produces a different order, not the same one.\n if (manualSorting) return filterFilteredData;\n if (!sortColumn) {\n return filterFilteredData;\n }\n\n const sorted = [...filterFilteredData];\n const column = columns.find((col) => col.key === sortColumn);\n\n if (!column || !column.sortable) {\n return sorted;\n }\n\n sorted.sort((a, b) => {\n const aValue = column.dataIndex\n ? a[column.dataIndex]\n : (a as Record<string, unknown>)[column.key];\n const bValue = column.dataIndex\n ? b[column.dataIndex]\n : (b as Record<string, unknown>)[column.key];\n\n // Handle null/undefined\n if (aValue === null || aValue === undefined) return 1;\n if (bValue === null || bValue === undefined) return -1;\n\n // Compare values\n let comparison = 0;\n if (typeof aValue === \"number\" && typeof bValue === \"number\") {\n comparison = aValue - bValue;\n } else {\n comparison = String(aValue).localeCompare(String(bValue));\n }\n\n return sortDirection === \"asc\" ? comparison : -comparison;\n });\n\n return sorted;\n }, [filterFilteredData, sortColumn, sortDirection, columns, manualSorting]);\n\n // Apply pagination\n // In controlled mode with server-side pagination, use provided data directly\n // In uncontrolled mode, slice the data client-side\n const paginatedData = useMemo(() => {\n if (!showPagination) {\n return sortedData;\n }\n\n // If in controlled pagination mode with totalItems, assume data is already paginated\n if (isControlledPagination && totalItems !== undefined) {\n return sortedData; // Data is already paginated server-side\n }\n\n // Client-side pagination\n const startIndex = (currentPage - 1) * pageSize;\n const endIndex = startIndex + pageSize;\n\n return sortedData.slice(startIndex, endIndex);\n }, [\n sortedData,\n currentPage,\n pageSize,\n showPagination,\n isControlledPagination,\n totalItems,\n ]);\n\n // Calculate total pages for pagination display\n // Note: Currently not used but kept for future pagination UI enhancements\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const _totalPages = useMemo(() => {\n if (!showPagination) return 1;\n if (isControlledPagination && totalItems !== undefined) {\n return Math.ceil(totalItems / pageSize);\n }\n return Math.ceil(sortedData.length / pageSize);\n }, [\n showPagination,\n isControlledPagination,\n totalItems,\n pageSize,\n sortedData.length,\n ]);\n\n // Callbacks\n const handleSearch = useCallback(\n (value: string) => {\n setSearchTerm(value);\n if (!isControlledPagination) {\n setCurrentPage(1); // Reset to first page on search (only in uncontrolled mode)\n }\n },\n [setSearchTerm, setCurrentPage, isControlledPagination],\n );\n\n const handleFilterChange = useCallback(\n (key: string, value: unknown) => {\n const newFilters = {\n ...columnFilters,\n [key]: value,\n };\n setColumnFilters(newFilters);\n if (!isControlledPagination) {\n setCurrentPage(1); // Reset to first page on filter (only in uncontrolled mode)\n }\n },\n [columnFilters, setColumnFilters, setCurrentPage, isControlledPagination],\n );\n\n /**\n * One callback per click, carrying both new values.\n *\n * The controlled setters each emitted `onSortChange` on their own, and each one\n * read the *other* value from the render it was created in. Clicking \"Age\" on a\n * table sorted by name descending produced `(\"age\", \"desc\")` immediately\n * followed by `(\"name\", \"asc\")` - two requests, the second of which put the old\n * column back. A consumer writing both values from the callback, which is what\n * the docs show, ended up where it started.\n *\n * It also never fired at all for a controlled table that started unsorted,\n * because the setter guarded on an existing column and direction.\n */\n const handleSort = useCallback(\n (column: TableColumn<T>, direction: \"asc\" | \"desc\") => {\n if (isControlledSort) {\n onSortChange?.(column.key, direction);\n return;\n }\n setSortColumn(column.key);\n setSortDirection(direction);\n },\n [isControlledSort, onSortChange, setSortColumn, setSortDirection],\n );\n\n const handlePageChange = useCallback(\n (page: number, newPageSize: number) => {\n setCurrentPage(page);\n if (newPageSize !== pageSize) {\n setPageSize(newPageSize);\n setCurrentPage(1); // Reset to first page when page size changes\n }\n },\n [pageSize, setCurrentPage, setPageSize],\n );\n\n // Notify callbacks\n React.useEffect(() => {\n if (onSearch) {\n onSearch(searchTerm, searchFilteredData);\n }\n }, [searchTerm, searchFilteredData, onSearch]);\n\n React.useEffect(() => {\n if (onFilter) {\n onFilter(columnFilters, filterFilteredData);\n }\n }, [columnFilters, filterFilteredData, onFilter]);\n\n return (\n <div className=\"w-full\">\n {/* Search and Filter Bar */}\n {(showSearch || (showFilters && filterable && filters.length > 0)) && (\n <div className={cn(filterBarVariants(), filterBarClassName)}>\n {/* Search */}\n {showSearch && searchable && (\n <div className={cn(\"flex-1 min-w-[200px]\", searchBarClassName)}>\n <Input\n type=\"text\"\n placeholder={searchPlaceholder}\n value={searchTerm}\n onChange={(e) => handleSearch(e.target.value)}\n className=\"w-full\"\n aria-label=\"Search table\"\n />\n </div>\n )}\n\n {/* Column Filters */}\n {showFilters && filterable && filters.length > 0 && (\n <div className=\"flex flex-wrap items-center gap-2\">\n {filters.map((filter) => {\n const filterValue = columnFilters[filter.key];\n\n // A boolean needs three states - either value, or no filter -\n // which a text box cannot express. It used to be one, and typing\n // \"false\" selected the records where the value was true.\n if (filter.type === \"boolean\") {\n return (\n <select\n key={filter.key}\n value={\n filterValue === undefined || filterValue === null\n ? \"\"\n : asBoolean(filterValue)\n ? \"true\"\n : \"false\"\n }\n onChange={(e) =>\n handleFilterChange(\n filter.key,\n e.target.value === \"\"\n ? undefined\n : e.target.value === \"true\",\n )\n }\n className=\"rounded-md border border-input px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring focus:border-primary\"\n aria-label={`Filter by ${filter.key}`}\n >\n <option value=\"\">All {filter.key}</option>\n <option value=\"true\">\n {filter.placeholder\n ? `${filter.placeholder}: yes`\n : \"Yes\"}\n </option>\n <option value=\"false\">\n {filter.placeholder\n ? `${filter.placeholder}: no`\n : \"No\"}\n </option>\n </select>\n );\n }\n\n if (filter.type === \"select\" && filter.options) {\n return (\n <select\n key={filter.key}\n value={inputValue(filterValue)}\n onChange={(e) =>\n handleFilterChange(\n filter.key,\n e.target.value || undefined,\n )\n }\n className=\"rounded-md border border-input px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring focus:border-primary\"\n aria-label={`Filter by ${filter.key}`}\n >\n <option value=\"\">All {filter.key}</option>\n {filter.options.map((option) => (\n <option key={option.value} value={String(option.value)}>\n {option.label}\n </option>\n ))}\n </select>\n );\n }\n\n return (\n <Input\n key={filter.key}\n type={filter.type === \"number\" ? \"number\" : \"text\"}\n placeholder={\n filter.placeholder || `Filter ${filter.key}...`\n }\n // `String(filterValue || \"\")` blanked a legitimate 0 and a\n // legitimate false, so the box disagreed with the filter it\n // was showing.\n value={inputValue(filterValue)}\n onChange={(e) =>\n handleFilterChange(\n filter.key,\n // An emptied box is no filter. `Number(\"\")` is 0, which\n // used to leave only the zero-valued rows behind.\n e.target.value === \"\"\n ? undefined\n : filter.type === \"number\"\n ? Number(e.target.value)\n : e.target.value,\n )\n }\n className=\"min-w-[150px]\"\n aria-label={`Filter by ${filter.key}`}\n />\n );\n })}\n\n {/* Clear Filters */}\n {Object.keys(columnFilters).length > 0 && (\n <button\n type=\"button\"\n onClick={() => setColumnFilters({})}\n className=\"px-3 py-2 text-sm text-muted-foreground hover:text-foreground underline\"\n aria-label=\"Clear all filters\"\n >\n Clear filters\n </button>\n )}\n </div>\n )}\n </div>\n )}\n\n {/* Table */}\n <Table\n {...tableProps}\n data={paginatedData}\n columns={columns}\n rowKey={rowKey}\n emptyText={emptyText}\n {...(sortColumn && {\n sortColumn,\n sortDirection,\n })}\n onSort={handleSort}\n {...(showPagination && {\n pagination: {\n current: currentPage,\n pageSize: pageSize,\n total:\n isControlledPagination && totalItems !== undefined\n ? totalItems\n : sortedData.length,\n onChange: handlePageChange,\n showSizeChanger: true,\n },\n })}\n />\n\n {/* Results Summary */}\n {showPagination &&\n (isControlledPagination && totalItems !== undefined\n ? totalItems > 0\n : sortedData.length > 0) && (\n <div className=\"mt-2 px-4 py-2 text-sm text-muted-foreground\">\n {isControlledPagination && totalItems !== undefined ? (\n <>\n Showing {(currentPage - 1) * pageSize + 1} to{\" \"}\n {Math.min(currentPage * pageSize, totalItems)} of {totalItems}{\" \"}\n results\n {searchTerm && \" (filtered)\"}\n </>\n ) : (\n <>\n Showing {(currentPage - 1) * pageSize + 1} to{\" \"}\n {Math.min(currentPage * pageSize, sortedData.length)} of{\" \"}\n {sortedData.length} results\n {searchTerm && ` (filtered from ${initialData.length} total)`}\n </>\n )}\n </div>\n )}\n </div>\n );\n}\n\nDataTable.displayName = \"DataTable\";\n\n// Memoize DataTable for performance optimization\n// DataTable is a complex component with filtering, sorting, and pagination\nexport const DataTableMemoized = memo(DataTable) as typeof DataTable;\n"]}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';var chunkITRGJNWL_cjs=require('./chunk-ITRGJNWL.cjs'),r=require('react'),classVarianceAuthority=require('class-variance-authority');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var r__default=/*#__PURE__*/_interopDefault(r);var U=classVarianceAuthority.cva("w-full border-collapse transition-all duration-200",{variants:{variant:{default:"border border-border shadow-sm hover:shadow-md",striped:"border border-border shadow-sm hover:shadow-md",bordered:"border-2 border-border shadow-md hover:shadow-lg",hover:"border border-border shadow-sm hover:shadow-md",elevated:"border border-border shadow-lg hover:shadow-xl",interactive:"border border-border shadow-sm hover:shadow-md hover:border-primary"},size:{sm:"text-xs sm:text-sm",md:"text-sm sm:text-base",lg:"text-base sm:text-lg"}},defaultVariants:{variant:"default",size:"md"}}),W=classVarianceAuthority.cva("font-medium text-left transition-all duration-200",{variants:{variant:{default:"bg-muted text-foreground hover:bg-muted/80",striped:"bg-muted text-foreground hover:bg-muted/80",bordered:"bg-muted text-foreground hover:bg-muted/80",hover:"bg-muted text-foreground hover:bg-muted/80",elevated:"bg-muted text-foreground hover:bg-muted/80",interactive:"bg-muted text-foreground hover:bg-primary/10 hover:text-primary"},size:{sm:"px-2 py-1 sm:px-3 sm:py-2",md:"px-3 py-2 sm:px-4 sm:py-3",lg:"px-4 py-3 sm:px-6 sm:py-4"}},defaultVariants:{variant:"default",size:"md"}}),X=classVarianceAuthority.cva("border-b border-border transition-colors",{variants:{variant:{default:"hover:bg-muted/50",striped:"even:bg-muted/50 hover:bg-muted/80",bordered:"hover:bg-muted/50",hover:"hover:bg-muted/50",elevated:"hover:bg-muted/80",interactive:"hover:bg-primary/10 hover:text-primary"}},defaultVariants:{variant:"default"}}),w=classVarianceAuthority.cva("border-border transition-all duration-200",{variants:{variant:{default:"border-b border-border hover:bg-muted/50",striped:"border-b border-border hover:bg-muted/80",bordered:"border border-border hover:bg-muted/50",hover:"border-b border-border hover:bg-muted/50",elevated:"border-b border-border hover:bg-muted/80",interactive:"border-b border-border hover:bg-primary/10 hover:text-primary"},size:{sm:"px-2 py-1 sm:px-3 sm:py-2",md:"px-3 py-2 sm:px-4 sm:py-3",lg:"px-4 py-3 sm:px-6 sm:py-4"}},defaultVariants:{variant:"default",size:"md"}});function Y({data:l,columns:n,loading:b=false,emptyText:p="No data",className:u,variant:d,size:i,rowKey:c="id",onRowClick:E,onSort:L,sortColumn:N,sortDirection:B,pagination:t,selection:s,caption:k,...I},D){let[j,A]=r.useState(null),S=N!==void 0,g=S&&N?{column:N,direction:B||"asc"}:j,F=e=>{if(!e.sortable)return;let o=g?.column===e.key&&g?.direction==="asc"?"desc":"asc";S||A({column:e.key,direction:o}),L?.(e,o);},f=(e,o)=>typeof c=="function"?c(e):e[c]??o,P=e=>s?.getCheckboxProps?.(e).disabled===true,h=s?l.map((e,o)=>({record:e,key:f(e,o)})).filter(({record:e})=>!P(e)).map(({key:e})=>e):[],z=e=>l.filter((o,a)=>e.includes(f(o,a))),H=(e,o)=>{if(!s)return false;let a=f(e,o);return s.selectedRowKeys.includes(a)},G=(e,o,a)=>{if(!s||P(e))return;let x=f(e,o),V=a?s.selectedRowKeys.includes(x)?s.selectedRowKeys:[...s.selectedRowKeys,x]:s.selectedRowKeys.filter(Q=>Q!==x);s.onChange(V,z(V));},$=e=>{if(!s)return;let o=s.selectedRowKeys.filter(x=>!h.includes(x)),a=e?[...o,...h]:o;s.onChange(a,z(a));},C=h.filter(e=>s?.selectedRowKeys.includes(e)),J=s&&h.length>0&&C.length===h.length,O=s&&C.length>0&&C.length<h.length;return r__default.default.createElement("div",{className:"w-full overflow-x-auto"},r__default.default.createElement("div",{className:"min-w-full"},r__default.default.createElement("table",{ref:D,className:chunkITRGJNWL_cjs.a(U({variant:d,size:i}),u),...I},k&&r__default.default.createElement("caption",{className:"sr-only"},k),r__default.default.createElement(K,null,r__default.default.createElement(v,null,s&&r__default.default.createElement("th",{className:chunkITRGJNWL_cjs.a(w({variant:d,size:i})),scope:"col",role:"columnheader"},r__default.default.createElement("input",{type:"checkbox",checked:J,ref:e=>{e&&(e.indeterminate=O||false);},onChange:e=>$(e.target.checked),className:"rounded border-input text-primary focus:ring-ring","aria-label":"Select all rows"})),n.map(e=>r__default.default.createElement("th",{key:e.key,className:chunkITRGJNWL_cjs.a(w({variant:d,size:i}),e.className,e.align==="center"&&"text-center",e.align==="right"&&"text-right"),scope:"col",role:"columnheader",...e.width&&{style:{width:e.width}}},r__default.default.createElement("div",{className:"flex items-center gap-2"},r__default.default.createElement("span",null,e.title),e.sortable&&r__default.default.createElement("button",{type:"button",onClick:()=>F(e),className:"flex flex-col text-muted-foreground hover:text-foreground","aria-label":`Sort by ${e.title}`},r__default.default.createElement("svg",{className:chunkITRGJNWL_cjs.a("w-3 h-3",g?.column===e.key&&g?.direction==="asc"?"text-primary":"text-muted-foreground"),fill:"currentColor",viewBox:"0 0 20 20"},r__default.default.createElement("path",{d:"M5 8l5-5 5 5H5z"})),r__default.default.createElement("svg",{className:chunkITRGJNWL_cjs.a("w-3 h-3 -mt-1",g?.column===e.key&&g?.direction==="desc"?"text-primary":"text-muted-foreground"),fill:"currentColor",viewBox:"0 0 20 20"},r__default.default.createElement("path",{d:"M5 12l5 5 5-5H5z"})))))))),r__default.default.createElement(M,null,b?r__default.default.createElement(v,null,r__default.default.createElement(y,{colSpan:n.length+(s?1:0),variant:d,size:i,className:"text-center py-8"},r__default.default.createElement("div",{className:"flex items-center justify-center gap-2"},r__default.default.createElement("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-primary"}),r__default.default.createElement("span",null,"Loading...")))):l.length===0?r__default.default.createElement(v,null,r__default.default.createElement(y,{colSpan:n.length+(s?1:0),variant:d,size:i,className:"text-center py-8 text-muted-foreground"},p)):l.map((e,o)=>r__default.default.createElement(v,{key:f(e,o),variant:d,onClick:()=>E?.(e,o),selected:H(e,o)},s&&r__default.default.createElement(y,{variant:d,size:i},r__default.default.createElement("input",{type:"checkbox",checked:H(e,o),onChange:a=>G(e,o,a.target.checked),className:"rounded border-input text-primary focus:ring-ring","aria-label":`Select row ${o+1}`,...s.getCheckboxProps?.(e)})),n.map(a=>r__default.default.createElement(y,{key:a.key,variant:d,size:i,className:chunkITRGJNWL_cjs.a(a.className,a.align==="center"&&"text-center",a.align==="right"&&"text-right")},a.render?a.render(a.dataIndex?e[a.dataIndex]:e,e,o):a.dataIndex?e[a.dataIndex]:e[a.key]))))))),t&&r__default.default.createElement("div",{className:"flex flex-col sm:flex-row items-center justify-between mt-4 px-2 sm:px-4 py-3 bg-card border-t border-border gap-2 sm:gap-0"},r__default.default.createElement("div",{className:"flex items-center gap-2"},r__default.default.createElement("span",{className:"text-sm text-muted-foreground"},"Showing ",(t.current-1)*t.pageSize+1," to"," ",Math.min(t.current*t.pageSize,t.total)," ","of ",t.total," results")),r__default.default.createElement("div",{className:"flex items-center gap-2"},t.showSizeChanger&&r__default.default.createElement("select",{value:t.pageSize,onChange:e=>t.onChange(1,Number(e.target.value)),className:"rounded border-input bg-background text-sm","aria-label":"Select page size"},r__default.default.createElement("option",{value:10},"10 / page"),r__default.default.createElement("option",{value:20},"20 / page"),r__default.default.createElement("option",{value:50},"50 / page"),r__default.default.createElement("option",{value:100},"100 / page")),r__default.default.createElement("div",{className:"flex items-center gap-1"},r__default.default.createElement("button",{type:"button",onClick:()=>t.onChange(t.current-1,t.pageSize),disabled:t.current<=1,className:"px-3 py-1 text-sm border border-input rounded hover:bg-muted disabled:opacity-50 disabled:cursor-not-allowed","aria-label":"Go to previous page"},"Previous"),r__default.default.createElement("span",{className:"px-3 py-1 text-sm"},"Page ",t.current," of"," ",Math.ceil(t.total/t.pageSize)),r__default.default.createElement("button",{type:"button",onClick:()=>t.onChange(t.current+1,t.pageSize),disabled:t.current>=Math.ceil(t.total/t.pageSize),className:"px-3 py-1 text-sm border border-input rounded hover:bg-muted disabled:opacity-50 disabled:cursor-not-allowed","aria-label":"Go to next page"},"Next")))))}var R=r__default.default.forwardRef(Y);R.displayName="Table";var te=R,K=r__default.default.forwardRef(({className:l,variant:n,size:b,children:p,...u},d)=>r__default.default.createElement("thead",{ref:d,className:chunkITRGJNWL_cjs.a(W({variant:n,size:b}),l),...u},p));K.displayName="TableHeader";var M=r__default.default.forwardRef(({className:l,children:n,...b},p)=>r__default.default.createElement("tbody",{ref:p,className:chunkITRGJNWL_cjs.a(l),...b},n));M.displayName="TableBody";var v=r__default.default.forwardRef(({className:l,children:n,onClick:b,selected:p,variant:u,...d},i)=>r__default.default.createElement("tr",{ref:i,className:chunkITRGJNWL_cjs.a(X({variant:u}),p&&"bg-primary/10",b&&"cursor-pointer",l),onClick:b,...d},n));v.displayName="TableRow";var y=r__default.default.forwardRef(({className:l,children:n,variant:b,size:p,colSpan:u,rowSpan:d,...i},c)=>r__default.default.createElement("td",{ref:c,className:chunkITRGJNWL_cjs.a(w({variant:b,size:p}),l),colSpan:u,rowSpan:d,...i},n));y.displayName="TableCell";var Z=r__default.default.forwardRef(({className:l,children:n,variant:b,size:p,colSpan:u,rowSpan:d,...i},c)=>r__default.default.createElement("th",{ref:c,className:chunkITRGJNWL_cjs.a(w({variant:b,size:p}),"font-medium",l),colSpan:u,rowSpan:d,...i},n));Z.displayName="TableHead";exports.a=U;exports.b=W;exports.c=w;exports.d=te;exports.e=K;exports.f=M;exports.g=v;exports.h=y;exports.i=Z;//# sourceMappingURL=chunk-UC577SR4.cjs.map
|
|
3
|
+
//# sourceMappingURL=chunk-UC577SR4.cjs.map
|