initial commit

This commit is contained in:
2026-08-26 15:01:15 +05:30
parent aa42d9ee81
commit cf4f4ecd9c
87 changed files with 12814 additions and 2328 deletions

View File

@@ -1,31 +1,21 @@
import React from 'react';
import PropTypes from 'prop-types';
// third-party
import { CSVLink } from 'react-csv';
import { MdDownload } from 'react-icons/md';
import { Download, Loader2 } from 'lucide-react';
import { Button } from '@astryxdesign/core/Button';
// ==============================|| CSV EXPORT ||============================== //
// This file used to be Mantis's 596-line react-table v7 toolkit — HeaderSort,
// TablePagination, IndeterminateCheckbox, TableRowSelection, DraggableHeader,
// DragPreview, DraggableRow, HidingSelect, SortingSelect, EmptyTable. None of
// them were imported anywhere: the two consumers (dispatch/Preview.js and
// reports/ordersDetails.js) only ever pulled `CSVExport`. Rather than port ten
// dead helpers to Astryx, they were deleted and only the export button remains.
export const CSVExport = ({ data, filename, headers, label, style, btnLoading, onClick }) => (
export const CSVExport = ({ data, filename, headers, label, style, btnLoading, onClick, className = '' }) => (
<CSVLink data={data} filename={filename} headers={headers} style={{ textDecoration: 'none' }}>
<Button
label={label || 'Download'}
icon={btnLoading ? undefined : <MdDownload />}
variant={btnLoading ? 'secondary' : 'primary'}
isLoading={btnLoading}
isDisabled={btnLoading}
tooltip="CSV Export"
style={style}
<button
type="button"
disabled={btnLoading}
onClick={(e) => onClick?.(e)}
/>
className={`h-9 px-3.5 bg-black hover:bg-neutral-800 active:scale-[0.98] text-white text-xs font-semibold rounded-md shadow-xs flex items-center gap-1.5 transition-all cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed ${className}`}
style={style}
title="CSV Export"
>
{btnLoading ? <Loader2 className="w-3.5 h-3.5 animate-spin" /> : <Download className="w-3.5 h-3.5" />}
<span>{label || 'CSV'}</span>
</button>
</CSVLink>
);
@@ -36,7 +26,8 @@ CSVExport.propTypes = {
label: PropTypes.any,
style: PropTypes.object,
btnLoading: PropTypes.any,
onClick: PropTypes.func
onClick: PropTypes.func,
className: PropTypes.string
};
export default CSVExport;