alope-ui 1.2.61 → 1.2.62
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/components/Table/Table.d.ts +2 -1
- package/dist/main.cjs +4 -4
- package/dist/main.js +2 -1
- package/package.json +1 -1
|
@@ -14,6 +14,7 @@ export type TableType<T> = {
|
|
|
14
14
|
data: T[];
|
|
15
15
|
striped?: boolean;
|
|
16
16
|
hoverable?: boolean;
|
|
17
|
+
customEmptyData?: React.ReactNode;
|
|
17
18
|
size?: keyof typeof TableSize;
|
|
18
19
|
caption?: string;
|
|
19
20
|
captionPosition?: "top" | "bottom";
|
|
@@ -24,5 +25,5 @@ export type TableType<T> = {
|
|
|
24
25
|
};
|
|
25
26
|
export declare function Table<T extends {
|
|
26
27
|
id: string | number;
|
|
27
|
-
}>({ columns, data, striped, hoverable, size, caption, captionPosition, stickyHeader, selectable, onSelectionChange, selectedRows, }: TableType<T>): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
}>({ columns, data, striped, hoverable, customEmptyData, size, caption, captionPosition, stickyHeader, selectable, onSelectionChange, selectedRows, }: TableType<T>): import("react/jsx-runtime").JSX.Element;
|
|
28
29
|
export {};
|
package/dist/main.cjs
CHANGED
|
@@ -117,10 +117,10 @@ return{left:`calc(${100*r}% + ${r*-v+v/2}px)`,opacity:k?1:0,pointerEvents:"none"
|
|
|
117
117
|
const r=Number(d)-Number(n),t=Math.floor(r/Number(i)),s=Array.from({length:t+1},(r,s)=>{const o=s/t*100
|
|
118
118
|
return e.jsx("div",{className:a.cn("absolute top-1/2 -translate-y-1/2 w-[2px] h-2 rounded-full",y),style:{left:`${o}%`}},s)})
|
|
119
119
|
return e.jsx("div",{className:"absolute top-full mt-2 -left-0.5 -right-0.5 h-2 me-[11px] ms-[9px]",children:s})})()]}),p,e.jsx("div",{className:"w-32",children:e.jsx(Q,{min:n,max:d,step:i,type:Number(c)<=0?"text":"number",value:Number(c)<=0?"":c,onChange:x})})]})]})},exports.Spinner=({color:r="primary",size:t="md",duration:s=1e3,thickness:o,label:n,labelPosition:l="right"})=>{const d=te[r],i=ae[t],c=se[t],m=oe[l],u=`${s}ms`,x=o?`${o}px`:void 0,g=e.jsx("span",{"aria-hidden":Boolean(n),role:n?void 0:"status","aria-label":n?void 0:"Loading",className:a.cn(i,d,"inline-block shrink-0 rounded-full animate-spin border-t-transparent dark:border-t-transparent"),style:{animationDuration:u,borderWidth:x}})
|
|
120
|
-
return n?e.jsxs("div",{role:"status",className:a.cn("inline-flex items-center justify-center gap-2",m),children:[g,e.jsx("span",{className:a.cn(c,"text-gray-700 dark:text-neutral-200 font-medium select-none"),children:n})]}):g},exports.Table=function({columns:r,data:t,striped:s=!1,hoverable:o=!0,size:
|
|
121
|
-
return e.jsxs("div",{className:"w-full",children:[
|
|
122
|
-
return e.jsxs("tr",{className:a.cn("transition-colors",s&&n%2!=0&&"bg-gray-50/70 dark:bg-neutral-800/40",o&&"hover:bg-gray-100/80 dark:hover:bg-neutral-800/70",l&&"bg-primary/10 dark:bg-primary/20"),children:[
|
|
123
|
-
|
|
120
|
+
return n?e.jsxs("div",{role:"status",className:a.cn("inline-flex items-center justify-center gap-2",m),children:[g,e.jsx("span",{className:a.cn(c,"text-gray-700 dark:text-neutral-200 font-medium select-none"),children:n})]}):g},exports.Table=function({columns:r,data:t,striped:s=!1,hoverable:o=!0,customEmptyData:n,size:l="md",caption:d,captionPosition:i="bottom",stickyHeader:c=!1,selectable:m=!1,onSelectionChange:u,selectedRows:x=[]}){const g=ne[l],b=t.length>0&&x.length===t.length,p=x.length>0&&x.length<t.length
|
|
121
|
+
return e.jsxs("div",{className:"w-full",children:[d&&"top"===i&&e.jsx("p",{className:"text-center text-sm font-medium mb-2 text-gray-600 dark:text-neutral-400",children:d}),e.jsx("div",{className:a.cn("overflow-x-auto w-full rounded-lg border border-gray-200 dark:border-neutral-800 bg-white dark:bg-neutral-900",c&&"max-h-[400px] overflow-y-auto"),children:e.jsxs("table",{className:"min-w-full border-collapse text-left",children:[e.jsx("thead",{className:"bg-gray-50 dark:bg-neutral-800 text-gray-700 dark:text-neutral-200",children:e.jsxs("tr",{children:[m&&e.jsx("th",{className:a.cn("w-12 font-semibold border-b border-gray-200 dark:border-neutral-800",g,c&&"sticky top-0 bg-gray-50 dark:bg-neutral-800 z-10"),children:e.jsx(z,{checked:b,indeterminate:p,onChange:e=>{e.target.checked?u?.(t):u?.([])}})}),r.map((r,t)=>e.jsx("th",{className:a.cn("font-semibold whitespace-nowrap border-b border-gray-200 dark:border-neutral-800",g,c&&"sticky top-0 bg-gray-50 dark:bg-neutral-800 z-10"),children:r.header},t))]})}),e.jsx("tbody",{className:"divide-y divide-gray-200 dark:divide-neutral-800 text-gray-700 dark:text-neutral-300",children:t.length>0?t.map((t,n)=>{const l=m&&x.some(e=>e.id===t.id)
|
|
122
|
+
return e.jsxs("tr",{className:a.cn("transition-colors",s&&n%2!=0&&"bg-gray-50/70 dark:bg-neutral-800/40",o&&"hover:bg-gray-100/80 dark:hover:bg-neutral-800/70",l&&"bg-primary/10 dark:bg-primary/20"),children:[m&&e.jsx("td",{className:a.cn(g),children:e.jsx(z,{checked:l,onChange:()=>(e=>{const r=x.some(r=>r.id===e.id)
|
|
123
|
+
u?.(r?x.filter(r=>r.id!==e.id):[...x,e])})(t)})}),r.map((r,s)=>e.jsx("td",{className:a.cn(g),children:r.render?r.render(t[r.accessor],t):null!=t[r.accessor]?String(t[r.accessor]):"-"},s))]},t.id??n)}):e.jsx("tr",{children:e.jsx("td",{colSpan:r.length+(m?1:0),className:a.cn("py-8 text-center text-gray-500 dark:text-neutral-400",g),children:n??"Tidak ada data."})})})]})}),d&&"bottom"===i&&e.jsx("p",{className:"text-center text-sm font-medium mt-2 text-gray-600 dark:text-neutral-400",children:d})]})},exports.Tabs=({tabs:t,fitted:s,variant:o="line",wrapperClassName:n,buttonClassName:l,activeClassName:d,inactiveClassName:i,activeTab:c,onTabChange:m})=>{const[u,x]=r.useState(0),g=void 0!==c&&void 0!==m,b=g?c:u,p=le[o],h=de[o],k=r.useRef([]),f=r.useRef(null)
|
|
124
124
|
return r.useEffect(()=>{!g&&b>=t.length&&x(Math.max(0,t.length-1))},[t,b,g]),r.useEffect(()=>{const e=k.current[b],r=f.current
|
|
125
125
|
if(e&&r){const a=e.offsetLeft,t=e.offsetWidth
|
|
126
126
|
r.style.transform=`translateX(${a}px)`,r.style.width=`${t}px`,e.scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})}},[b,t]),e.jsxs("div",{children:[e.jsx("div",{className:a.cn("relative",p.wrapper,n),children:e.jsxs("nav",{className:"relative -mb-px flex space-x-2 overflow-x-auto scroll-smooth","aria-label":"Tabs",children:[t.map((r,t)=>{const o=a.cn("hover:cursor-pointer",s&&"flex-1",p.button,l,b===t?a.cn(p.active,d):a.cn(p.inactive,i),r.disabled&&"hover:cursor-not-allowed cursor-not-allowed opacity-50")
|
package/dist/main.js
CHANGED
|
@@ -2798,6 +2798,7 @@ function Table({
|
|
|
2798
2798
|
data,
|
|
2799
2799
|
striped = false,
|
|
2800
2800
|
hoverable = true,
|
|
2801
|
+
customEmptyData,
|
|
2801
2802
|
size = "md",
|
|
2802
2803
|
caption,
|
|
2803
2804
|
captionPosition = "bottom",
|
|
@@ -2898,7 +2899,7 @@ function Table({
|
|
|
2898
2899
|
"py-8 text-center text-gray-500 dark:text-neutral-400",
|
|
2899
2900
|
tableSizeClass
|
|
2900
2901
|
),
|
|
2901
|
-
children: "Tidak ada data."
|
|
2902
|
+
children: customEmptyData ?? "Tidak ada data."
|
|
2902
2903
|
}
|
|
2903
2904
|
) }) })
|
|
2904
2905
|
] })
|