@getgreenline/blaze-ui 1.0.3 → 1.0.4-5.01-beta
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/accordion.d.ts +8 -0
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +19 -0
- package/dist/components/alert-dialog.d.ts +18 -0
- package/dist/components/alert-dialog.d.ts.map +1 -0
- package/dist/components/alert-dialog.js +41 -0
- package/dist/components/alert.d.ts +10 -0
- package/dist/components/alert.d.ts.map +1 -0
- package/dist/components/alert.js +26 -0
- package/dist/components/aspect-ratio.d.ts +4 -0
- package/dist/components/aspect-ratio.d.ts.map +1 -0
- package/dist/components/aspect-ratio.js +8 -0
- package/dist/components/avatar.d.ts +7 -0
- package/dist/components/avatar.d.ts.map +1 -0
- package/dist/components/avatar.js +15 -0
- package/dist/components/badge.d.ts +10 -0
- package/dist/components/badge.d.ts.map +1 -0
- package/dist/components/badge.js +24 -0
- package/dist/components/breadcrumb.d.ts +12 -0
- package/dist/components/breadcrumb.d.ts.map +1 -0
- package/dist/components/breadcrumb.js +29 -0
- package/dist/components/button-group.d.ts +12 -0
- package/dist/components/button-group.d.ts.map +1 -0
- package/dist/components/button-group.js +29 -0
- package/dist/components/button.d.ts +16 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +37 -0
- package/dist/components/card.d.ts +10 -0
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +26 -0
- package/dist/components/carousel.d.ts +20 -0
- package/dist/components/carousel.d.ts.map +1 -0
- package/dist/components/carousel.js +92 -0
- package/dist/components/chart.d.ts +63 -0
- package/dist/components/chart.d.ts.map +1 -0
- package/dist/components/chart.js +133 -0
- package/dist/components/checkbox.d.ts +5 -0
- package/dist/components/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox.js +10 -0
- package/dist/components/collapsible.d.ts +6 -0
- package/dist/components/collapsible.d.ts.map +1 -0
- package/dist/components/collapsible.js +15 -0
- package/dist/components/command.d.ts +19 -0
- package/dist/components/command.d.ts.map +1 -0
- package/dist/components/command.js +35 -0
- package/dist/components/context-menu.d.ts +26 -0
- package/dist/components/context-menu.d.ts.map +1 -0
- package/dist/components/context-menu.js +52 -0
- package/dist/components/data-table.d.ts +85 -0
- package/dist/components/data-table.d.ts.map +1 -0
- package/dist/components/data-table.js +390 -0
- package/dist/components/dialog.d.ts +16 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +37 -0
- package/dist/components/drawer.d.ts +14 -0
- package/dist/components/drawer.d.ts.map +1 -0
- package/dist/components/drawer.js +36 -0
- package/dist/components/dropdown-menu.d.ts +26 -0
- package/dist/components/dropdown-menu.d.ts.map +1 -0
- package/dist/components/dropdown-menu.js +52 -0
- package/dist/components/empty.d.ts +12 -0
- package/dist/components/empty.d.ts.map +1 -0
- package/dist/components/empty.js +35 -0
- package/dist/components/field.d.ts +25 -0
- package/dist/components/field.d.ts.map +1 -0
- package/dist/components/field.js +74 -0
- package/dist/components/form.d.ts +25 -0
- package/dist/components/form.d.ts.map +1 -0
- package/dist/components/form.js +60 -0
- package/dist/components/header-app-switcher.d.ts +53 -0
- package/dist/components/header-app-switcher.d.ts.map +1 -0
- package/dist/components/header-app-switcher.js +154 -0
- package/dist/components/hierarchical-select.d.ts +31 -0
- package/dist/components/hierarchical-select.d.ts.map +1 -0
- package/dist/components/hierarchical-select.js +143 -0
- package/dist/components/hover-card.d.ts +7 -0
- package/dist/components/hover-card.d.ts.map +1 -0
- package/dist/components/hover-card.js +15 -0
- package/dist/components/input-group.d.ts +17 -0
- package/dist/components/input-group.d.ts.map +1 -0
- package/dist/components/input-group.js +66 -0
- package/dist/components/input-otp.d.ts +12 -0
- package/dist/components/input-otp.d.ts.map +1 -0
- package/dist/components/input-otp.js +22 -0
- package/dist/components/input.d.ts +8 -0
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/input.js +15 -0
- package/dist/components/item.d.ts +24 -0
- package/dist/components/item.d.ts.map +1 -0
- package/dist/components/item.js +68 -0
- package/dist/components/kbd.d.ts +4 -0
- package/dist/components/kbd.d.ts.map +1 -0
- package/dist/components/kbd.js +11 -0
- package/dist/components/label.d.ts +8 -0
- package/dist/components/label.d.ts.map +1 -0
- package/dist/components/label.js +9 -0
- package/dist/components/login-screen.d.ts +4 -0
- package/dist/components/login-screen.d.ts.map +1 -0
- package/dist/components/login-screen.js +300 -0
- package/dist/components/login-screen.types.d.ts +82 -0
- package/dist/components/login-screen.types.d.ts.map +1 -0
- package/dist/components/login-screen.views.d.ts +114 -0
- package/dist/components/login-screen.views.d.ts.map +1 -0
- package/dist/components/login-screen.views.js +53 -0
- package/dist/components/menubar.d.ts +27 -0
- package/dist/components/menubar.d.ts.map +1 -0
- package/dist/components/menubar.js +55 -0
- package/dist/components/multi-search-select.d.ts +17 -0
- package/dist/components/multi-search-select.d.ts.map +1 -0
- package/dist/components/multi-search-select.js +40 -0
- package/dist/components/multi-select.d.ts +19 -0
- package/dist/components/multi-select.d.ts.map +1 -0
- package/dist/components/multi-select.js +87 -0
- package/dist/components/navigation-menu.d.ts +15 -0
- package/dist/components/navigation-menu.d.ts.map +1 -0
- package/dist/components/navigation-menu.js +33 -0
- package/dist/components/page-header/actions.d.ts +9 -0
- package/dist/components/page-header/actions.d.ts.map +1 -0
- package/dist/components/page-header/actions.js +21 -0
- package/dist/components/page-header/types.d.ts +33 -0
- package/dist/components/page-header/types.d.ts.map +1 -0
- package/dist/components/page-header/utils.d.ts +4 -0
- package/dist/components/page-header/utils.d.ts.map +1 -0
- package/dist/components/page-header/utils.js +17 -0
- package/dist/components/page-header.d.ts +4 -0
- package/dist/components/page-header.d.ts.map +1 -0
- package/dist/components/page-header.js +12 -0
- package/dist/components/pagination.d.ts +14 -0
- package/dist/components/pagination.d.ts.map +1 -0
- package/dist/components/pagination.js +31 -0
- package/dist/components/popover.d.ts +8 -0
- package/dist/components/popover.d.ts.map +1 -0
- package/dist/components/popover.js +18 -0
- package/dist/components/progress.d.ts +5 -0
- package/dist/components/progress.d.ts.map +1 -0
- package/dist/components/progress.js +9 -0
- package/dist/components/radio-group.d.ts +6 -0
- package/dist/components/radio-group.d.ts.map +1 -0
- package/dist/components/radio-group.js +13 -0
- package/dist/components/resizable.d.ts +9 -0
- package/dist/components/resizable.d.ts.map +1 -0
- package/dist/components/resizable.js +16 -0
- package/dist/components/scroll-area.d.ts +6 -0
- package/dist/components/scroll-area.d.ts.map +1 -0
- package/dist/components/scroll-area.js +14 -0
- package/dist/components/search-bar.d.ts +15 -0
- package/dist/components/search-bar.d.ts.map +1 -0
- package/dist/components/search-bar.js +25 -0
- package/dist/components/segmented-control.d.ts +24 -0
- package/dist/components/segmented-control.d.ts.map +1 -0
- package/dist/components/segmented-control.js +88 -0
- package/dist/components/select.d.ts +16 -0
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +39 -0
- package/dist/components/selection-panel.d.ts +29 -0
- package/dist/components/selection-panel.d.ts.map +1 -0
- package/dist/components/selection-panel.js +255 -0
- package/dist/components/separator.d.ts +5 -0
- package/dist/components/separator.d.ts.map +1 -0
- package/dist/components/separator.js +11 -0
- package/dist/components/sheet.d.ts +17 -0
- package/dist/components/sheet.d.ts.map +1 -0
- package/dist/components/sheet.js +42 -0
- package/dist/components/sidebar.d.ts +70 -0
- package/dist/components/sidebar.d.ts.map +1 -0
- package/dist/components/sidebar.js +213 -0
- package/dist/components/skeleton.d.ts +3 -0
- package/dist/components/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton.js +8 -0
- package/dist/components/slider.d.ts +5 -0
- package/dist/components/slider.d.ts.map +1 -0
- package/dist/components/slider.js +19 -0
- package/dist/components/sonner.d.ts +4 -0
- package/dist/components/sonner.d.ts.map +1 -0
- package/dist/components/sonner.js +22 -0
- package/dist/components/spinner.d.ts +4 -0
- package/dist/components/spinner.d.ts.map +1 -0
- package/dist/components/spinner.js +9 -0
- package/dist/components/switch.d.ts +5 -0
- package/dist/components/switch.d.ts.map +1 -0
- package/dist/components/switch.js +9 -0
- package/dist/components/table.d.ts +11 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +29 -0
- package/dist/components/tabs.d.ts +8 -0
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +18 -0
- package/dist/components/textarea.d.ts +8 -0
- package/dist/components/textarea.d.ts.map +1 -0
- package/dist/components/textarea.js +15 -0
- package/dist/components/toggle-group.d.ts +8 -0
- package/dist/components/toggle-group.d.ts.map +1 -0
- package/dist/components/toggle-group.js +22 -0
- package/dist/components/toggle.d.ts +10 -0
- package/dist/components/toggle.d.ts.map +1 -0
- package/dist/components/toggle.js +27 -0
- package/dist/components/tooltip.d.ts +8 -0
- package/dist/components/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip.js +18 -0
- package/dist/components/visually-hidden.d.ts +16 -0
- package/dist/components/visually-hidden.d.ts.map +1 -0
- package/dist/components/visually-hidden.js +22 -0
- package/dist/globals.css +719 -0
- package/dist/hooks/use-invalid-attention.d.ts +20 -0
- package/dist/hooks/use-invalid-attention.d.ts.map +1 -0
- package/dist/hooks/use-invalid-attention.js +65 -0
- package/dist/hooks/use-mobile.d.ts +2 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-mobile.js +18 -0
- package/dist/index.d.ts +68 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +68 -0
- package/dist/lib/portal-wrapper.d.ts +32 -0
- package/dist/lib/portal-wrapper.d.ts.map +1 -0
- package/dist/lib/portal-wrapper.js +34 -0
- package/dist/lib/utils.js +8 -0
- package/dist/svgs/blaze-dispatch-logo.d.ts +5 -0
- package/dist/svgs/blaze-dispatch-logo.d.ts.map +1 -0
- package/dist/svgs/blaze-ecom-logo.d.ts +7 -0
- package/dist/svgs/blaze-ecom-logo.d.ts.map +1 -0
- package/dist/svgs/blaze-insights-logo.d.ts +5 -0
- package/dist/svgs/blaze-insights-logo.d.ts.map +1 -0
- package/dist/svgs/blaze-lighthouse-logo.d.ts +6 -0
- package/dist/svgs/blaze-lighthouse-logo.d.ts.map +1 -0
- package/dist/svgs/blaze-pay-logo.d.ts +5 -0
- package/dist/svgs/blaze-pay-logo.d.ts.map +1 -0
- package/dist/svgs/blaze-pos-logo.d.ts +5 -0
- package/dist/svgs/blaze-pos-logo.d.ts.map +1 -0
- package/dist/svgs/blaze-retail-logo.d.ts +7 -0
- package/dist/svgs/blaze-retail-logo.d.ts.map +1 -0
- package/dist/svgs/blaze-sites-logo.d.ts +5 -0
- package/dist/svgs/blaze-sites-logo.d.ts.map +1 -0
- package/dist/svgs/header-app-switcher-logos.d.ts +15 -0
- package/dist/svgs/header-app-switcher-logos.d.ts.map +1 -0
- package/dist/svgs/header-app-switcher-logos.js +22 -0
- package/package.json +95 -31
- package/README.md +0 -80
- package/build/components/button.d.ts +0 -12
- package/build/components/button.d.ts.map +0 -1
- package/build/components/button.js +0 -106
- package/build/components/button.js.map +0 -1
- package/build/index.d.ts +0 -4
- package/build/index.d.ts.map +0 -1
- package/build/index.js +0 -11
- package/build/index.js.map +0 -1
- package/build/index.mjs +0 -6
- package/build/lib/utils.js +0 -9
- package/build/lib/utils.js.map +0 -1
- package/build/styles/blaze-ui.css +0 -97
- package/build/styles/blaze-ui.css.map +0 -1
- package/build/styles/styles.d.ts +0 -3
- package/build/styles/styles.d.ts.map +0 -1
- package/build/styles/styles.js +0 -8
- package/build/styles/styles.js.map +0 -1
- package/src/styles/blaze-ui.css +0 -157
- package/src/styles/styles.ts +0 -5
- /package/{build → dist}/lib/utils.d.ts +0 -0
- /package/{build → dist}/lib/utils.d.ts.map +0 -0
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { SettingsIcon, CheckIcon, InboxIcon, Loader2Icon, ArrowUpDownIcon, ArrowUpIcon, ArrowDownIcon, ChevronDownIcon, ChevronRightIcon, ChevronUpIcon, MoreHorizontalIcon } from 'lucide-react';
|
|
4
|
+
export { CheckIcon, XIcon } from 'lucide-react';
|
|
5
|
+
import { Menu } from '@base-ui/react/menu';
|
|
6
|
+
import { Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from './select.js';
|
|
7
|
+
import { cn } from '../lib/utils.js';
|
|
8
|
+
import { Checkbox } from './checkbox.js';
|
|
9
|
+
import { Button } from './button.js';
|
|
10
|
+
import { Pagination, PaginationContent, PaginationItem, PaginationPrevious, PaginationNext, PaginationLink, PaginationEllipsis } from './pagination.js';
|
|
11
|
+
|
|
12
|
+
const DEFAULT_PAGE_SIZE_OPTIONS = [5, 10, 25, 50];
|
|
13
|
+
function renderCellValue(value) {
|
|
14
|
+
if (value == null || React.isValidElement(value))
|
|
15
|
+
return value;
|
|
16
|
+
if (typeof value !== "object")
|
|
17
|
+
return value;
|
|
18
|
+
if (Array.isArray(value))
|
|
19
|
+
return value.length;
|
|
20
|
+
return String(value);
|
|
21
|
+
}
|
|
22
|
+
function DataTable({ columns, data, onRowClick, onSelectionChange, selectedRowIds, onSort, sortState, expandable = false, renderExpandedRow, actions, className, pagination, treeData = false, reorderable = false, onReorder, onDragReorder, customFilterColumnsWhiteList, loading = false, loadingRows = 5, emptyState, clickableFields, showColumnVisibility = true, footerContent, expandedRowIds, onExpandedChange, reservePaginationSpace = false, striped = true, selectContentClassName, menuPopupClassName, }) {
|
|
23
|
+
const [internalSelectedRows, setInternalSelectedRows] = React.useState(new Set());
|
|
24
|
+
const [internalExpandedRows, setInternalExpandedRows] = React.useState(new Set());
|
|
25
|
+
const [internalSortConfig, setInternalSortConfig] = React.useState({ key: "", direction: null });
|
|
26
|
+
const [hiddenColumns, setHiddenColumns] = React.useState([]);
|
|
27
|
+
const [draggedRowId, setDraggedRowId] = React.useState(null);
|
|
28
|
+
const [dragOverRowId, setDragOverRowId] = React.useState(null);
|
|
29
|
+
const scrollContainerRef = React.useRef(null);
|
|
30
|
+
React.useEffect(() => {
|
|
31
|
+
if (pagination?.currentPage && scrollContainerRef.current) {
|
|
32
|
+
scrollContainerRef.current.scrollTo({ top: 0, behavior: "smooth" });
|
|
33
|
+
}
|
|
34
|
+
}, [pagination?.currentPage]);
|
|
35
|
+
const selectedRows = React.useMemo(() => {
|
|
36
|
+
if (selectedRowIds !== undefined) {
|
|
37
|
+
return new Set(selectedRowIds);
|
|
38
|
+
}
|
|
39
|
+
return internalSelectedRows;
|
|
40
|
+
}, [selectedRowIds, internalSelectedRows]);
|
|
41
|
+
const expandedRows = React.useMemo(() => {
|
|
42
|
+
if (expandedRowIds !== undefined) {
|
|
43
|
+
return new Set(expandedRowIds);
|
|
44
|
+
}
|
|
45
|
+
return internalExpandedRows;
|
|
46
|
+
}, [expandedRowIds, internalExpandedRows]);
|
|
47
|
+
const sortConfig = React.useMemo(() => {
|
|
48
|
+
if (sortState !== undefined) {
|
|
49
|
+
return sortState;
|
|
50
|
+
}
|
|
51
|
+
return internalSortConfig;
|
|
52
|
+
}, [sortState, internalSortConfig]);
|
|
53
|
+
const setSelectedRows = React.useCallback((newSelected) => {
|
|
54
|
+
if (selectedRowIds === undefined) {
|
|
55
|
+
setInternalSelectedRows(newSelected);
|
|
56
|
+
}
|
|
57
|
+
}, [selectedRowIds]);
|
|
58
|
+
const setExpandedRows = React.useCallback((newExpanded) => {
|
|
59
|
+
if (expandedRowIds === undefined) {
|
|
60
|
+
setInternalExpandedRows(newExpanded);
|
|
61
|
+
}
|
|
62
|
+
}, [expandedRowIds]);
|
|
63
|
+
const hasRowSelection = !!onSelectionChange;
|
|
64
|
+
const hasActions = actions && actions.length > 0;
|
|
65
|
+
const showActionsColumn = hasActions || showColumnVisibility;
|
|
66
|
+
const toggleRowSelection = (rowId) => {
|
|
67
|
+
const newSelected = new Set(selectedRows);
|
|
68
|
+
if (newSelected.has(rowId)) {
|
|
69
|
+
newSelected.delete(rowId);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
newSelected.add(rowId);
|
|
73
|
+
}
|
|
74
|
+
setSelectedRows(newSelected);
|
|
75
|
+
const selectedIdsArray = Array.from(newSelected);
|
|
76
|
+
onSelectionChange?.(selectedIdsArray);
|
|
77
|
+
};
|
|
78
|
+
const toggleAllRows = () => {
|
|
79
|
+
const currentPageIds = data.map((row) => row.id);
|
|
80
|
+
const allCurrentPageSelected = currentPageIds.every((id) => selectedRows.has(id));
|
|
81
|
+
let newSelected;
|
|
82
|
+
if (allCurrentPageSelected) {
|
|
83
|
+
newSelected = new Set(selectedRows);
|
|
84
|
+
currentPageIds.forEach((id) => newSelected.delete(id));
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
newSelected = new Set(selectedRows);
|
|
88
|
+
currentPageIds.forEach((id) => newSelected.add(id));
|
|
89
|
+
}
|
|
90
|
+
setSelectedRows(newSelected);
|
|
91
|
+
const selectedIdsArray = Array.from(newSelected);
|
|
92
|
+
onSelectionChange?.(selectedIdsArray);
|
|
93
|
+
};
|
|
94
|
+
const toggleRowExpansion = (rowId) => {
|
|
95
|
+
const newExpanded = new Set(expandedRows);
|
|
96
|
+
if (newExpanded.has(rowId)) {
|
|
97
|
+
newExpanded.delete(rowId);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
newExpanded.add(rowId);
|
|
101
|
+
}
|
|
102
|
+
setExpandedRows(newExpanded);
|
|
103
|
+
onExpandedChange?.(Array.from(newExpanded));
|
|
104
|
+
};
|
|
105
|
+
const handleSort = (key) => {
|
|
106
|
+
let direction = "asc";
|
|
107
|
+
if (sortConfig.key === key) {
|
|
108
|
+
if (sortConfig.direction === "asc") {
|
|
109
|
+
direction = "desc";
|
|
110
|
+
}
|
|
111
|
+
else if (sortConfig.direction === "desc") {
|
|
112
|
+
direction = null;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (sortState === undefined) {
|
|
116
|
+
setInternalSortConfig({ key, direction });
|
|
117
|
+
}
|
|
118
|
+
onSort?.(key, direction);
|
|
119
|
+
};
|
|
120
|
+
const processedData = React.useMemo(() => {
|
|
121
|
+
const result = [...data];
|
|
122
|
+
if (!onSort && sortConfig.key && sortConfig.direction) {
|
|
123
|
+
result.sort((a, b) => {
|
|
124
|
+
const aValue = a[sortConfig.key];
|
|
125
|
+
const bValue = b[sortConfig.key];
|
|
126
|
+
if (aValue === bValue)
|
|
127
|
+
return 0;
|
|
128
|
+
const comparison = typeof aValue === "number" && typeof bValue === "number"
|
|
129
|
+
? aValue - bValue
|
|
130
|
+
: String(aValue ?? "").localeCompare(String(bValue ?? ""), undefined, {
|
|
131
|
+
numeric: true,
|
|
132
|
+
});
|
|
133
|
+
return sortConfig.direction === "asc" ? comparison : -comparison;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
return result;
|
|
137
|
+
}, [data, sortConfig, onSort]);
|
|
138
|
+
const getSortIcon = (columnKey) => {
|
|
139
|
+
if (sortConfig.key !== columnKey) {
|
|
140
|
+
return (jsx(ArrowUpDownIcon, { className: "tw:ml-2 tw:size-4 tw:text-muted-foreground" }));
|
|
141
|
+
}
|
|
142
|
+
if (sortConfig.direction === "asc") {
|
|
143
|
+
return jsx(ArrowUpIcon, { className: "tw:ml-2 tw:size-4 tw:text-foreground" });
|
|
144
|
+
}
|
|
145
|
+
if (sortConfig.direction === "desc") {
|
|
146
|
+
return jsx(ArrowDownIcon, { className: "tw:ml-2 tw:size-4 tw:text-foreground" });
|
|
147
|
+
}
|
|
148
|
+
return (jsx(ArrowUpDownIcon, { className: "tw:ml-2 tw:size-4 tw:text-muted-foreground" }));
|
|
149
|
+
};
|
|
150
|
+
const hasChildren = (row) => treeData && row.children && row.children.length > 0;
|
|
151
|
+
const isExpandable = expandable || treeData;
|
|
152
|
+
const visibleColumns = columns.filter((col) => !hiddenColumns.includes(col.key));
|
|
153
|
+
const toggleColumnVisibility = (columnKey) => {
|
|
154
|
+
const newHidden = hiddenColumns.includes(columnKey)
|
|
155
|
+
? hiddenColumns.filter((key) => key !== columnKey)
|
|
156
|
+
: [...hiddenColumns, columnKey];
|
|
157
|
+
setHiddenColumns(newHidden);
|
|
158
|
+
};
|
|
159
|
+
const filterableColumns = customFilterColumnsWhiteList
|
|
160
|
+
? columns.filter((col) => customFilterColumnsWhiteList.includes(col.key))
|
|
161
|
+
: columns;
|
|
162
|
+
const getRowBackgroundClass = (row, rowIndex, depth) => {
|
|
163
|
+
if (selectedRows.has(row.id))
|
|
164
|
+
return "tw:bg-accent";
|
|
165
|
+
if (depth > 0)
|
|
166
|
+
return striped ? "tw:bg-muted" : "tw:bg-card";
|
|
167
|
+
if (striped && rowIndex % 2 === 1)
|
|
168
|
+
return "tw:bg-muted";
|
|
169
|
+
return "tw:bg-card";
|
|
170
|
+
};
|
|
171
|
+
const getClickableField = (fieldKey) => {
|
|
172
|
+
return clickableFields?.find((cf) => cf.field === fieldKey);
|
|
173
|
+
};
|
|
174
|
+
const getVisibleActions = (row) => {
|
|
175
|
+
if (!actions)
|
|
176
|
+
return [];
|
|
177
|
+
return actions.filter((action) => !action.condition || action.condition(row));
|
|
178
|
+
};
|
|
179
|
+
const renderRow = (row, rowIndex, depth = 0, parentRow, siblingCount) => {
|
|
180
|
+
const canExpand = hasChildren(row) || (expandable && renderExpandedRow);
|
|
181
|
+
const isExpanded = expandedRows.has(row.id);
|
|
182
|
+
const indentPadding = depth * 24;
|
|
183
|
+
const rowBgClass = getRowBackgroundClass(row, rowIndex, depth);
|
|
184
|
+
const visibleActionsForRow = getVisibleActions(row);
|
|
185
|
+
const isDragging = draggedRowId === row.id;
|
|
186
|
+
const isDragOver = dragOverRowId === row.id;
|
|
187
|
+
const totalSiblings = siblingCount ?? data.length;
|
|
188
|
+
const isRowClickable = !!onRowClick;
|
|
189
|
+
const handleRowClick = (event) => {
|
|
190
|
+
const target = event.target;
|
|
191
|
+
if (target?.closest('button, a, input, select, textarea, [role="button"], [role="checkbox"], [role="menuitem"]')) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
onRowClick?.(row);
|
|
195
|
+
};
|
|
196
|
+
const handleRowKeyDown = (event) => {
|
|
197
|
+
if (event.target !== event.currentTarget)
|
|
198
|
+
return;
|
|
199
|
+
if (event.key !== "Enter" && event.key !== " ")
|
|
200
|
+
return;
|
|
201
|
+
event.preventDefault();
|
|
202
|
+
onRowClick?.(row);
|
|
203
|
+
};
|
|
204
|
+
const handleDragStart = (e) => {
|
|
205
|
+
setDraggedRowId(row.id);
|
|
206
|
+
e.dataTransfer.effectAllowed = "move";
|
|
207
|
+
e.dataTransfer.setData("text/plain", row.id);
|
|
208
|
+
};
|
|
209
|
+
const handleDragEnd = () => {
|
|
210
|
+
setDraggedRowId(null);
|
|
211
|
+
setDragOverRowId(null);
|
|
212
|
+
};
|
|
213
|
+
const handleDragOver = (e) => {
|
|
214
|
+
e.preventDefault();
|
|
215
|
+
e.dataTransfer.dropEffect = "move";
|
|
216
|
+
if (draggedRowId !== row.id) {
|
|
217
|
+
setDragOverRowId(row.id);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
const handleDragLeave = () => {
|
|
221
|
+
setDragOverRowId(null);
|
|
222
|
+
};
|
|
223
|
+
const handleDrop = (e) => {
|
|
224
|
+
e.preventDefault();
|
|
225
|
+
const draggedId = e.dataTransfer.getData("text/plain");
|
|
226
|
+
if (draggedId && draggedId !== row.id) {
|
|
227
|
+
onDragReorder?.(draggedId, row.id, parentRow?.id);
|
|
228
|
+
}
|
|
229
|
+
setDraggedRowId(null);
|
|
230
|
+
setDragOverRowId(null);
|
|
231
|
+
};
|
|
232
|
+
return (jsxs(React.Fragment, { children: [jsxs("tr", { className: cn("tw:border-b tw:transition-colors hover:tw:bg-accent/50", isRowClickable &&
|
|
233
|
+
"tw:cursor-pointer tw:focus-visible:outline-none tw:focus-visible:ring-2 tw:focus-visible:ring-ring tw:focus-visible:ring-inset", rowBgClass, isDragging && "tw:opacity-50", isDragOver && "tw:ring-2 tw:ring-primary tw:ring-inset"), tabIndex: isRowClickable ? 0 : undefined, onClick: isRowClickable ? handleRowClick : undefined, onKeyDown: isRowClickable ? handleRowKeyDown : undefined, draggable: reorderable, onDragStart: reorderable ? handleDragStart : undefined, onDragEnd: reorderable ? handleDragEnd : undefined, onDragOver: reorderable ? handleDragOver : undefined, onDragLeave: reorderable ? handleDragLeave : undefined, onDrop: reorderable ? handleDrop : undefined, children: [isExpandable && (jsx("td", { className: cn("tw:p-2 tw:w-12", rowBgClass), onClick: (event) => event.stopPropagation(), children: jsx("div", { style: { paddingLeft: indentPadding }, children: canExpand ? (jsx("button", { onClick: () => toggleRowExpansion(row.id), className: "tw:flex tw:items-center tw:justify-center hover:tw:bg-accent tw:rounded tw:p-1", "aria-label": isExpanded ? "Collapse row" : "Expand row", "aria-expanded": isExpanded, children: isExpanded ? (jsx(ChevronDownIcon, { className: "tw:text-muted-foreground tw:size-4 tw:shrink-0 tw:transition-transform tw:duration-200" })) : (jsx(ChevronRightIcon, { className: "tw:text-muted-foreground tw:size-4 tw:shrink-0 tw:transition-transform tw:duration-200" })) })) : (jsx("span", { className: "tw:w-6" })) }) })), hasRowSelection && (jsx("td", { className: cn("tw:p-2 tw:w-12", rowBgClass), onClick: (event) => event.stopPropagation(), children: jsx("div", { className: "tw:flex tw:items-center tw:justify-center", children: jsx(Checkbox, { checked: selectedRows.has(row.id), onCheckedChange: () => toggleRowSelection(row.id), "aria-label": `Select row ${rowIndex + 1}`, className: "tw:h-[22px] tw:w-[22px]" }) }) })), reorderable && (jsx("td", { className: cn("tw:p-2 tw:w-12", rowBgClass), onClick: (event) => event.stopPropagation(), children: jsxs("div", { className: "tw:flex tw:flex-col tw:items-center tw:gap-0.5", children: [jsx("button", { onClick: () => onReorder?.(row.id, "up", parentRow?.id), className: "tw:flex tw:items-center tw:justify-center hover:tw:bg-accent tw:rounded tw:p-0.5 tw:text-muted-foreground hover:tw:text-foreground tw:transition-colors", disabled: rowIndex === 0, "aria-label": "Move row up", children: jsx(ChevronUpIcon, { className: cn("tw:size-4", rowIndex === 0 && "tw:opacity-30") }) }), jsx("button", { onClick: () => onReorder?.(row.id, "down", parentRow?.id), className: "tw:flex tw:items-center tw:justify-center hover:tw:bg-accent tw:rounded tw:p-0.5 tw:text-muted-foreground hover:tw:text-foreground tw:transition-colors", disabled: rowIndex === totalSiblings - 1, "aria-label": "Move row down", children: jsx(ChevronDownIcon, { className: cn("tw:size-4", rowIndex === totalSiblings - 1 && "tw:opacity-30") }) })] }) })), visibleColumns.map((column, colIndex) => {
|
|
234
|
+
const clickableField = getClickableField(column.key);
|
|
235
|
+
const cellContent = column.render
|
|
236
|
+
? column.render(row[column.key], row, rowIndex, depth)
|
|
237
|
+
: renderCellValue(row[column.key]);
|
|
238
|
+
return (jsx("td", { className: cn("tw:p-4 tw:align-middle tw:max-w-0 tw:overflow-hidden", column.align === "center" && "tw:text-center", column.align === "right" && "tw:text-right", column.className, rowBgClass), children: jsx("div", { className: cn("tw:truncate", clickableField && "tw:!text-primary"), style: {
|
|
239
|
+
paddingLeft: colIndex === 0
|
|
240
|
+
? isExpandable
|
|
241
|
+
? depth > 0
|
|
242
|
+
? 16
|
|
243
|
+
: 0
|
|
244
|
+
: indentPadding
|
|
245
|
+
: 0,
|
|
246
|
+
}, children: clickableField ? (jsx("button", { type: "button", onClick: (event) => {
|
|
247
|
+
event.stopPropagation();
|
|
248
|
+
clickableField.onClick(row);
|
|
249
|
+
}, className: "tw:inline tw:cursor-pointer tw:appearance-none tw:border-0 tw:bg-transparent tw:p-0 tw:text-inherit tw:font-[inherit] tw:transition-colors hover:tw:!text-primary/80 hover:tw:underline", children: cellContent })) : (cellContent) }) }, column.key));
|
|
250
|
+
}), showActionsColumn && (jsx("td", { className: cn("tw:p-2 tw:text-right tw:sticky tw:right-0", rowBgClass), onClick: (event) => event.stopPropagation(), children: visibleActionsForRow.length > 0 && (jsxs(Menu.Root, { modal: false, children: [jsx(Menu.Trigger, { id: `base-ui-row-action-${row.id}`, render: (props) => (jsx(Button, { variant: "ghost", size: "icon", className: "tw:h-8 tw:w-8", "aria-label": "Row actions", ...props, id: `base-ui-row-action-${row.id}`, children: jsx(MoreHorizontalIcon, { className: "tw:size-4" }) })) }), jsx(Menu.Portal, { children: jsx(Menu.Positioner, { side: "bottom", align: "end", sideOffset: 4, collisionPadding: 8, children: jsx(Menu.Popup, { "aria-labelledby": "base-ui-toggle-columns-trigger", className: cn("tw:bg-popover tw:font-sans tw:text-popover-foreground tw:data-[state=open]:animate-in tw:data-[state=closed]:animate-out tw:data-[state=closed]:fade-out-0 tw:data-[state=open]:fade-in-0 tw:data-[state=closed]:zoom-out-95 tw:data-[state=open]:zoom-in-95 tw:data-[side=bottom]:slide-in-from-top-2 tw:data-[side=left]:slide-in-from-right-2 tw:data-[side=right]:slide-in-from-left-2 tw:data-[side=top]:slide-in-from-bottom-2 tw:z-50 tw:min-w-[8rem] tw:overflow-x-hidden tw:overflow-y-auto tw:rounded-md tw:border tw:p-1 tw:shadow-md"), children: visibleActionsForRow.map((action, index) => (jsxs(Menu.Item, { onClick: () => action.onClick(row), className: cn("tw:focus:bg-accent tw:focus:text-accent-foreground tw:relative tw:flex tw:cursor-default tw:items-center tw:gap-2 tw:rounded-sm tw:px-2 tw:py-1.5 tw:text-[14px] tw:outline-hidden tw:select-none tw:data-[disabled]:pointer-events-none tw:data-[disabled]:opacity-50", action.variant === "destructive" &&
|
|
251
|
+
"tw:text-destructive focus:tw:text-destructive"), children: [action.icon && (jsx("span", { className: "tw:mr-2", children: action.icon })), action.label] }, index))) }) }) })] })) }))] }), expandable && !treeData && isExpanded && renderExpandedRow && (jsx("tr", { className: "tw:border-b tw:bg-muted/30", children: jsx("td", { colSpan: visibleColumns.length +
|
|
252
|
+
(showActionsColumn ? 1 : 0) +
|
|
253
|
+
(hasRowSelection ? 1 : 0) +
|
|
254
|
+
(isExpandable ? 1 : 0) +
|
|
255
|
+
(reorderable ? 1 : 0), className: "tw:p-4", children: renderExpandedRow(row) }) })), treeData &&
|
|
256
|
+
isExpanded &&
|
|
257
|
+
row.children &&
|
|
258
|
+
row.children.map((child, childIndex) => renderRow(child, childIndex, depth + 1, row, row.children?.length))] }, row.id));
|
|
259
|
+
};
|
|
260
|
+
const renderPaginationItems = () => {
|
|
261
|
+
if (!pagination)
|
|
262
|
+
return null;
|
|
263
|
+
const { currentPage, totalPages, onPageChange } = pagination;
|
|
264
|
+
const items = [];
|
|
265
|
+
const maxVisiblePages = 5;
|
|
266
|
+
let startPage = Math.max(1, currentPage - Math.floor(maxVisiblePages / 2));
|
|
267
|
+
const endPage = Math.min(totalPages, startPage + maxVisiblePages - 1);
|
|
268
|
+
if (endPage - startPage + 1 < maxVisiblePages) {
|
|
269
|
+
startPage = Math.max(1, endPage - maxVisiblePages + 1);
|
|
270
|
+
}
|
|
271
|
+
if (startPage > 1) {
|
|
272
|
+
items.push(jsx(PaginationItem, { children: jsx(PaginationLink, { href: "#", onClick: (e) => {
|
|
273
|
+
e.preventDefault();
|
|
274
|
+
if (!loading)
|
|
275
|
+
onPageChange(1);
|
|
276
|
+
}, "aria-label": "Go to page 1", "aria-disabled": loading, className: cn(loading && "tw:pointer-events-none tw:opacity-50"), children: "1" }) }, 1));
|
|
277
|
+
if (startPage > 2) {
|
|
278
|
+
items.push(jsx(PaginationItem, { children: jsx(PaginationEllipsis, {}) }, "ellipsis-start"));
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
for (let i = startPage; i <= endPage; i++) {
|
|
282
|
+
items.push(jsx(PaginationItem, { children: jsx(PaginationLink, { href: "#", isActive: i === currentPage, onClick: (e) => {
|
|
283
|
+
e.preventDefault();
|
|
284
|
+
if (!loading)
|
|
285
|
+
onPageChange(i);
|
|
286
|
+
}, "aria-label": i === currentPage ? `Page ${i}, current page` : `Go to page ${i}`, "aria-current": i === currentPage ? "page" : undefined, "aria-disabled": loading, className: cn(loading && "tw:pointer-events-none tw:opacity-50"), children: i }) }, i));
|
|
287
|
+
}
|
|
288
|
+
if (endPage < totalPages) {
|
|
289
|
+
if (endPage < totalPages - 1) {
|
|
290
|
+
items.push(jsx(PaginationItem, { children: jsx(PaginationEllipsis, {}) }, "ellipsis-end"));
|
|
291
|
+
}
|
|
292
|
+
items.push(jsx(PaginationItem, { children: jsx(PaginationLink, { href: "#", onClick: (e) => {
|
|
293
|
+
e.preventDefault();
|
|
294
|
+
if (!loading)
|
|
295
|
+
onPageChange(totalPages);
|
|
296
|
+
}, "aria-label": `Go to page ${totalPages}`, "aria-disabled": loading, className: cn(loading && "tw:pointer-events-none tw:opacity-50"), children: totalPages }) }, totalPages));
|
|
297
|
+
}
|
|
298
|
+
return items;
|
|
299
|
+
};
|
|
300
|
+
const calculateMinTableWidth = () => {
|
|
301
|
+
let totalWidth = 0;
|
|
302
|
+
// Add fixed column widths (48px each for expand, selection, reorder, actions)
|
|
303
|
+
if (isExpandable)
|
|
304
|
+
totalWidth += 48;
|
|
305
|
+
if (hasRowSelection)
|
|
306
|
+
totalWidth += 48;
|
|
307
|
+
if (reorderable)
|
|
308
|
+
totalWidth += 48;
|
|
309
|
+
if (showActionsColumn)
|
|
310
|
+
totalWidth += 48;
|
|
311
|
+
// Add specified column widths
|
|
312
|
+
visibleColumns.forEach((col) => {
|
|
313
|
+
if (col.width) {
|
|
314
|
+
// Parse width value (e.g., "80px" -> 80, "10%" -> skip)
|
|
315
|
+
const widthMatch = col.width.match(/^(\d+)px$/);
|
|
316
|
+
if (widthMatch && widthMatch[1]) {
|
|
317
|
+
totalWidth += parseInt(widthMatch[1], 10);
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
// If width is not in px (e.g., percentage), use default
|
|
321
|
+
totalWidth += 150;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
// No width specified, use default minimum
|
|
326
|
+
totalWidth += 150;
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
return `${totalWidth}px`;
|
|
330
|
+
};
|
|
331
|
+
return (jsxs("div", { className: cn("tw:w-full tw:h-full tw:flex tw:flex-col", className), children: [jsxs("div", { className: "tw:relative tw:flex-1 tw:flex tw:flex-col tw:min-h-0 tw:overflow-hidden tw:rounded-md tw:border", children: [jsx("div", { ref: scrollContainerRef, className: "tw:flex-1 tw:overflow-auto tw:bg-card [&::-webkit-scrollbar]:tw:h-2 [&::-webkit-scrollbar]:tw:w-2 [&::-webkit-scrollbar-track]:tw:bg-muted [&::-webkit-scrollbar-thumb]:tw:bg-muted-foreground/30 [&::-webkit-scrollbar-thumb]:tw:rounded-full hover:[&::-webkit-scrollbar-thumb]:tw:bg-muted-foreground/50", children: jsxs("table", { className: "tw:w-full tw:table-fixed tw:caption-bottom tw:text-sm", role: "grid", "aria-busy": loading, style: { minWidth: calculateMinTableWidth() }, children: [jsx("thead", { className: "tw:border-b tw:sticky tw:top-0 tw:z-10 tw:bg-card", children: jsxs("tr", { children: [isExpandable && (jsx("th", { scope: "col", className: "tw:h-10 tw:w-12 tw:px-2" })), hasRowSelection && (jsx("th", { scope: "col", className: "tw:h-10 tw:w-12 tw:px-2", children: jsx("div", { className: "tw:flex tw:items-center tw:justify-center", children: jsx(Checkbox, { checked: data.length > 0 &&
|
|
332
|
+
data.every((row) => selectedRows.has(row.id)), onCheckedChange: toggleAllRows, "aria-label": "Select all rows", className: "tw:h-[22px] tw:w-[22px]" }) }) })), reorderable && (jsx("th", { scope: "col", className: "tw:h-10 tw:w-12 tw:px-2" })), visibleColumns.map((column) => (jsx("th", { scope: "col", "aria-sort": column.sortable && sortConfig.key === column.key
|
|
333
|
+
? sortConfig.direction === "asc"
|
|
334
|
+
? "ascending"
|
|
335
|
+
: sortConfig.direction === "desc"
|
|
336
|
+
? "descending"
|
|
337
|
+
: "none"
|
|
338
|
+
: undefined, className: cn("tw:!h-[40px] tw:px-4 tw:text-left tw:align-middle tw:font-medium tw:text-foreground tw:whitespace-nowrap", column.align === "center" && "tw:text-center", column.align === "right" && "tw:text-right"), style: { width: column.width }, children: column.sortable ? (jsxs("button", { onClick: () => !loading && handleSort(column.key), disabled: loading, "aria-label": `Sort by ${column.label}${sortConfig.key === column.key
|
|
339
|
+
? sortConfig.direction === "asc"
|
|
340
|
+
? ", currently sorted ascending"
|
|
341
|
+
: sortConfig.direction === "desc"
|
|
342
|
+
? ", currently sorted descending"
|
|
343
|
+
: ""
|
|
344
|
+
: ""}`, className: cn("tw:flex tw:items-center hover:tw:text-foreground/80 tw:transition-colors", loading && "tw:opacity-50 tw:cursor-not-allowed"), children: [column.label, getSortIcon(column.key)] })) : (column.label) }, column.key))), showActionsColumn && (jsx("th", { scope: "col", className: "tw:h-10 tw:w-20 tw:px-2 tw:sticky tw:right-0 tw:bg-card", children: jsx("div", { className: "tw:flex tw:items-center tw:justify-end tw:pr-1", children: showColumnVisibility && (jsxs(Menu.Root, { modal: false, children: [jsx(Menu.Trigger, { id: "base-ui-toggle-columns-trigger", render: (props) => (jsx(Button, { variant: "ghost", size: "icon", className: "tw:h-8 tw:w-8", "aria-label": "Toggle column visibility", ...props, id: "base-ui-toggle-columns-trigger", children: jsx(SettingsIcon, { className: "tw:size-5 tw:text-muted-foreground" }) })) }), jsx(Menu.Portal, { children: jsx(Menu.Positioner, { side: "bottom", align: "end", sideOffset: 4, collisionPadding: 8, children: jsx(Menu.Popup, { "aria-labelledby": `base-ui-toggle-columns-trigger`, className: cn("tw:bg-popover tw:font-sans tw:text-popover-foreground tw:data-[state=open]:animate-in tw:data-[state=closed]:animate-out tw:data-[state=closed]:fade-out-0 tw:data-[state=open]:fade-in-0 tw:data-[state=closed]:zoom-out-95 tw:data-[state=open]:zoom-in-95 tw:data-[side=bottom]:slide-in-from-top-2 tw:data-[side=left]:slide-in-from-right-2 tw:data-[side=right]:slide-in-from-left-2 tw:data-[side=top]:slide-in-from-bottom-2 tw:z-50 tw:min-w-[8rem] tw:overflow-x-hidden tw:overflow-y-auto tw:rounded-md tw:border tw:p-1 tw:shadow-md", menuPopupClassName), children: jsxs(Menu.Group, { children: [jsx(Menu.GroupLabel, { className: "tw:px-2 tw:py-1.5 tw:text-[14px] tw:font-medium", children: "Toggle Columns" }), jsx("div", { className: "tw:bg-border tw:-mx-1 tw:my-1 tw:h-px" }), filterableColumns.map((column) => {
|
|
345
|
+
const isVisible = !hiddenColumns.includes(column.key);
|
|
346
|
+
return (jsxs(Menu.Item, { onClick: () => toggleColumnVisibility(column.key), closeOnClick: false, className: cn("tw:focus:bg-accent tw:focus:text-accent-foreground tw:relative tw:flex tw:cursor-default tw:items-center tw:gap-2 tw:rounded-sm tw:py-1.5 tw:pr-2 tw:pl-8 tw:text-[14px] tw:outline-hidden tw:select-none tw:data-[disabled]:pointer-events-none tw:data-[disabled]:opacity-50"), children: [jsx("span", { className: "tw:pointer-events-none tw:absolute tw:left-2 tw:flex tw:size-3.5 tw:items-center tw:justify-center", children: isVisible && (jsx(CheckIcon, { className: "tw:size-4" })) }), column.label] }, column.key));
|
|
347
|
+
})] }) }) }) })] })) }) }))] }) }), jsx("tbody", { className: "tw:relative", children: data.length === 0 && !loading ? (jsx("tr", { children: jsx("td", { colSpan: visibleColumns.length +
|
|
348
|
+
(showActionsColumn ? 1 : 0) +
|
|
349
|
+
(hasRowSelection ? 1 : 0) +
|
|
350
|
+
(isExpandable ? 1 : 0) +
|
|
351
|
+
(reorderable ? 1 : 0), className: "tw:h-48", children: jsxs("div", { className: "tw:flex tw:flex-col tw:items-center tw:justify-center tw:h-full tw:text-center", children: [emptyState?.icon || (jsx("div", { className: "tw:h-12 tw:w-12 tw:rounded-full tw:bg-muted tw:flex tw:items-center tw:justify-center tw:mb-3", children: jsx(InboxIcon, { className: "tw:size-6 tw:text-muted-foreground" }) })), jsx("p", { className: "tw:text-base tw:font-medium tw:text-foreground", children: emptyState?.title || "No results found" }), jsx("p", { className: "tw:text-sm tw:text-muted-foreground tw:mt-1", children: emptyState?.description ||
|
|
352
|
+
"There are no items to display." })] }) }) })) : (processedData.map((row, rowIndex) => renderRow(row, rowIndex, 0))) })] }) }), loading && (jsx("div", { className: "tw:absolute tw:inset-0 tw:z-20 tw:flex tw:items-center tw:justify-center tw:bg-card/50 tw:backdrop-blur-[1px]", children: jsxs("div", { className: "tw:flex tw:flex-col tw:items-center", children: [jsx(Loader2Icon, { className: "tw:size-8 tw:animate-spin tw:text-primary" }), data.length === 0 && (jsx("p", { className: "tw:text-sm tw:text-muted-foreground tw:mt-3", children: "Loading..." }))] }) }))] }), footerContent && (jsx("div", { className: "tw:border-t tw:px-4 tw:py-3 tw:bg-card", children: footerContent })), pagination &&
|
|
353
|
+
(pagination.totalPages > 1 ||
|
|
354
|
+
pagination.mode === "cursor" ||
|
|
355
|
+
pagination.showTotalItems ||
|
|
356
|
+
(pagination.pageSizeOptions ?? DEFAULT_PAGE_SIZE_OPTIONS).length >
|
|
357
|
+
0) && (jsxs("div", { className: "tw:relative tw:flex tw:items-center tw:justify-between tw:border-t tw:px-4 tw:py-4 tw:bg-card", children: [(() => {
|
|
358
|
+
const options = pagination.pageSizeOptions ?? DEFAULT_PAGE_SIZE_OPTIONS;
|
|
359
|
+
if (options.length === 0)
|
|
360
|
+
return jsx("div", {});
|
|
361
|
+
return (jsxs("div", { className: "tw:flex tw:items-center tw:gap-2 tw:z-10", children: [jsx("span", { className: "tw:text-[14px] tw:text-muted-foreground tw:whitespace-nowrap", id: "rows-per-page-label", children: "Rows per page:" }), jsxs(Select, { value: String(pagination.pageSize ?? options[0]), onValueChange: (val) => !loading && pagination.onPageSizeChange?.(Number(val)), disabled: loading, children: [jsx(SelectTrigger, { id: "base-ui-pagination-trigger", className: "tw:flex tw:h-[32px] tw:w-[70px] tw:items-center tw:justify-between tw:rounded-md tw:border tw:border-input tw:bg-transparent tw:px-3 tw:py-2 tw:text-[14px] tw:shadow-sm tw:ring-offset-background placeholder:tw:text-muted-foreground focus:tw:outline-none focus:tw:ring-1 focus:tw:ring-ring disabled:tw:cursor-not-allowed disabled:tw:opacity-50", children: jsx(SelectValue, {}) }), jsx(SelectContent, { side: "top", align: "end", className: selectContentClassName, children: options.map((size) => (jsx(SelectItem, { value: String(size), children: size }, size))) })] })] }));
|
|
362
|
+
})(), pagination.showTotalItems &&
|
|
363
|
+
pagination.totalItems !== undefined && (jsx("div", { className: "tw:absolute tw:left-1/2 tw:-translate-x-1/2 tw:flex tw:justify-center tw:items-center", children: jsxs("span", { className: "tw:text-[14px] tw:text-muted-foreground", children: ["Total: ", pagination.totalItems] }) })), jsx("div", { className: "tw:z-10", children: jsx(Pagination, { className: "tw:!mx-0 tw:!w-auto", "aria-label": "Table pagination", children: jsxs(PaginationContent, { children: [jsx(PaginationItem, { children: jsx(PaginationPrevious, { href: "#", onClick: (e) => {
|
|
364
|
+
e.preventDefault();
|
|
365
|
+
if (!loading &&
|
|
366
|
+
!pagination.disablePrevious &&
|
|
367
|
+
pagination.currentPage > 1) {
|
|
368
|
+
pagination.onPageChange(pagination.currentPage - 1);
|
|
369
|
+
}
|
|
370
|
+
}, "aria-label": "Go to previous page", "aria-disabled": loading ||
|
|
371
|
+
pagination.disablePrevious ||
|
|
372
|
+
pagination.currentPage <= 1, className: cn((loading ||
|
|
373
|
+
pagination.disablePrevious ||
|
|
374
|
+
pagination.currentPage <= 1) &&
|
|
375
|
+
"tw:pointer-events-none tw:opacity-50") }) }), pagination.mode !== "cursor" && renderPaginationItems(), jsx(PaginationItem, { children: jsx(PaginationNext, { href: "#", onClick: (e) => {
|
|
376
|
+
e.preventDefault();
|
|
377
|
+
if (!loading &&
|
|
378
|
+
!pagination.disableNext &&
|
|
379
|
+
pagination.currentPage < pagination.totalPages) {
|
|
380
|
+
pagination.onPageChange(pagination.currentPage + 1);
|
|
381
|
+
}
|
|
382
|
+
}, "aria-label": "Go to next page", "aria-disabled": loading ||
|
|
383
|
+
pagination.disableNext ||
|
|
384
|
+
pagination.currentPage >= pagination.totalPages, className: cn((loading ||
|
|
385
|
+
pagination.disableNext ||
|
|
386
|
+
pagination.currentPage >= pagination.totalPages) &&
|
|
387
|
+
"tw:pointer-events-none tw:opacity-50") }) })] }) }) })] }))] }));
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
export { DataTable };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
3
|
+
declare function Dialog({ ...props }: React.ComponentProps<typeof DialogPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function DialogTrigger({ ...props }: React.ComponentProps<typeof DialogPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function DialogPortal({ ...props }: React.ComponentProps<typeof DialogPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function DialogClose({ ...props }: React.ComponentProps<typeof DialogPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function DialogOverlay({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function DialogContent({ className, children, showCloseButton, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
|
|
9
|
+
showCloseButton?: boolean;
|
|
10
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare function DialogHeader({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare function DialogFooter({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function DialogTitle({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function DialogDescription({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
|
|
16
|
+
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/components/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AAKzD,iBAAS,MAAM,CAAC,EACd,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,2CAEnD;AAED,iBAAS,aAAa,CAAC,EACrB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,2CAEtD;AAED,iBAAS,YAAY,CAAC,EACpB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,MAAM,CAAC,2CAErD;AAED,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAEpD;AAED,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,2CAWtD;AAED,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,QAAQ,EACR,eAAsB,EACtB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,GAAG;IACxD,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,2CAyBA;AAED,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAWzE;AAED,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAWzE;AAED,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAQpD;AAED,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,WAAW,CAAC,2CAQ1D;AAED,OAAO,EACL,MAAM,EACN,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,WAAW,EACX,aAAa,GACd,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
3
|
+
import { XIcon } from 'lucide-react';
|
|
4
|
+
import { cn } from '../lib/utils.js';
|
|
5
|
+
|
|
6
|
+
function Dialog({ ...props }) {
|
|
7
|
+
return jsx(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
|
|
8
|
+
}
|
|
9
|
+
function DialogTrigger({ ...props }) {
|
|
10
|
+
return jsx(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
11
|
+
}
|
|
12
|
+
function DialogPortal({ ...props }) {
|
|
13
|
+
return jsx(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
14
|
+
}
|
|
15
|
+
function DialogClose({ ...props }) {
|
|
16
|
+
return jsx(DialogPrimitive.Close, { "data-slot": "dialog-close", ...props });
|
|
17
|
+
}
|
|
18
|
+
function DialogOverlay({ className, ...props }) {
|
|
19
|
+
return (jsx(DialogPrimitive.Overlay, { "data-slot": "dialog-overlay", className: cn("tw:data-[state=open]:animate-in tw:data-[state=closed]:animate-out tw:data-[state=closed]:fade-out-0 tw:data-[state=open]:fade-in-0 tw:fixed tw:inset-0 tw:z-50 tw:bg-black/50", className), ...props }));
|
|
20
|
+
}
|
|
21
|
+
function DialogContent({ className, children, showCloseButton = true, ...props }) {
|
|
22
|
+
return (jsxs(DialogPortal, { "data-slot": "dialog-portal", children: [jsx(DialogOverlay, {}), jsxs(DialogPrimitive.Content, { "data-slot": "dialog-content", className: cn("tw:bg-background tw:data-[state=open]:animate-in tw:data-[state=closed]:animate-out tw:data-[state=closed]:fade-out-0 tw:data-[state=open]:fade-in-0 tw:data-[state=closed]:zoom-out-95 tw:data-[state=open]:zoom-in-95 tw:fixed tw:top-[50%] tw:left-[50%] tw:z-50 tw:grid tw:w-full tw:max-w-[calc(100%-2rem)] tw:translate-x-[-50%] tw:translate-y-[-50%] tw:gap-4 tw:rounded-lg tw:border tw:p-6 tw:shadow-lg tw:duration-200 tw:sm:max-w-lg", className), ...props, children: [children, showCloseButton && (jsxs(DialogPrimitive.Close, { "data-slot": "dialog-close", className: "tw:ring-offset-background tw:focus:ring-ring tw:data-[state=open]:bg-accent tw:data-[state=open]:text-muted-foreground tw:absolute tw:top-4 tw:right-4 tw:rounded-xs tw:opacity-70 tw:transition-opacity tw:hover:opacity-100 tw:focus:ring-2 tw:focus:ring-offset-2 tw:focus:outline-hidden tw:disabled:pointer-events-none tw:[&_svg]:pointer-events-none tw:[&_svg]:shrink-0 tw:[&_svg:not([class*='size-'])]:size-4", children: [jsx(XIcon, {}), jsx("span", { className: "tw:sr-only", children: "Close" })] }))] })] }));
|
|
23
|
+
}
|
|
24
|
+
function DialogHeader({ className, ...props }) {
|
|
25
|
+
return (jsx("div", { "data-slot": "dialog-header", className: cn("tw:flex tw:flex-col tw:gap-2 tw:text-center tw:sm:text-left", className), ...props }));
|
|
26
|
+
}
|
|
27
|
+
function DialogFooter({ className, ...props }) {
|
|
28
|
+
return (jsx("div", { "data-slot": "dialog-footer", className: cn("tw:flex tw:flex-col-reverse tw:gap-2 tw:sm:flex-row tw:sm:justify-end", className), ...props }));
|
|
29
|
+
}
|
|
30
|
+
function DialogTitle({ className, ...props }) {
|
|
31
|
+
return (jsx(DialogPrimitive.Title, { "data-slot": "dialog-title", className: cn("tw:text-lg tw:leading-none tw:font-semibold", className), ...props }));
|
|
32
|
+
}
|
|
33
|
+
function DialogDescription({ className, ...props }) {
|
|
34
|
+
return (jsx(DialogPrimitive.Description, { "data-slot": "dialog-description", className: cn("tw:text-muted-foreground tw:text-sm", className), ...props }));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Drawer as DrawerPrimitive } from "vaul";
|
|
3
|
+
declare function Drawer({ ...props }: React.ComponentProps<typeof DrawerPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function DrawerTrigger({ ...props }: React.ComponentProps<typeof DrawerPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function DrawerPortal({ ...props }: React.ComponentProps<typeof DrawerPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function DrawerClose({ ...props }: React.ComponentProps<typeof DrawerPrimitive.Close>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function DrawerOverlay({ className, ...props }: React.ComponentProps<typeof DrawerPrimitive.Overlay>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function DrawerContent({ className, children, ...props }: React.ComponentProps<typeof DrawerPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare function DrawerHeader({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare function DrawerFooter({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare function DrawerTitle({ className, ...props }: React.ComponentProps<typeof DrawerPrimitive.Title>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare function DrawerDescription({ className, ...props }: React.ComponentProps<typeof DrawerPrimitive.Description>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export { Drawer, DrawerPortal, DrawerOverlay, DrawerTrigger, DrawerClose, DrawerContent, DrawerHeader, DrawerFooter, DrawerTitle, DrawerDescription, };
|
|
14
|
+
//# sourceMappingURL=drawer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../src/components/drawer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,MAAM,CAAA;AAIhD,iBAAS,MAAM,CAAC,EACd,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,2CAEnD;AAED,iBAAS,aAAa,CAAC,EACrB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,2CAEtD;AAED,iBAAS,YAAY,CAAC,EACpB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,MAAM,CAAC,2CAErD;AAED,iBAAS,WAAW,CAAC,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAEpD;AAED,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,2CAWtD;AAED,iBAAS,aAAa,CAAC,EACrB,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,2CAqBtD;AAED,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAWzE;AAED,iBAAS,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,2CAWzE;AAED,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,2CAQpD;AAED,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,WAAW,CAAC,2CAQ1D;AAED,OAAO,EACL,MAAM,EACN,YAAY,EACZ,aAAa,EACb,aAAa,EACb,WAAW,EACX,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,iBAAiB,GAClB,CAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { Drawer as Drawer$1 } from 'vaul';
|
|
3
|
+
import { cn } from '../lib/utils.js';
|
|
4
|
+
|
|
5
|
+
function Drawer({ ...props }) {
|
|
6
|
+
return jsx(Drawer$1.Root, { "data-slot": "drawer", ...props });
|
|
7
|
+
}
|
|
8
|
+
function DrawerTrigger({ ...props }) {
|
|
9
|
+
return jsx(Drawer$1.Trigger, { "data-slot": "drawer-trigger", ...props });
|
|
10
|
+
}
|
|
11
|
+
function DrawerPortal({ ...props }) {
|
|
12
|
+
return jsx(Drawer$1.Portal, { "data-slot": "drawer-portal", ...props });
|
|
13
|
+
}
|
|
14
|
+
function DrawerClose({ ...props }) {
|
|
15
|
+
return jsx(Drawer$1.Close, { "data-slot": "drawer-close", ...props });
|
|
16
|
+
}
|
|
17
|
+
function DrawerOverlay({ className, ...props }) {
|
|
18
|
+
return (jsx(Drawer$1.Overlay, { "data-slot": "drawer-overlay", className: cn("tw:data-[state=open]:animate-in tw:data-[state=closed]:animate-out tw:data-[state=closed]:fade-out-0 tw:data-[state=open]:fade-in-0 tw:fixed tw:inset-0 tw:z-50 tw:bg-black/50", className), ...props }));
|
|
19
|
+
}
|
|
20
|
+
function DrawerContent({ className, children, ...props }) {
|
|
21
|
+
return (jsxs(DrawerPortal, { "data-slot": "drawer-portal", children: [jsx(DrawerOverlay, {}), jsxs(Drawer$1.Content, { "data-slot": "drawer-content", className: cn("tw:group/drawer-content tw:bg-background tw:fixed tw:z-50 tw:flex tw:h-auto tw:flex-col", "tw:data-[vaul-drawer-direction=top]:inset-x-0 tw:data-[vaul-drawer-direction=top]:top-0 tw:data-[vaul-drawer-direction=top]:mb-24 tw:data-[vaul-drawer-direction=top]:max-h-[80vh] tw:data-[vaul-drawer-direction=top]:rounded-b-lg tw:data-[vaul-drawer-direction=top]:border-b", "tw:data-[vaul-drawer-direction=bottom]:inset-x-0 tw:data-[vaul-drawer-direction=bottom]:bottom-0 tw:data-[vaul-drawer-direction=bottom]:mt-24 tw:data-[vaul-drawer-direction=bottom]:max-h-[80vh] tw:data-[vaul-drawer-direction=bottom]:rounded-t-lg tw:data-[vaul-drawer-direction=bottom]:border-t", "tw:data-[vaul-drawer-direction=right]:inset-y-0 tw:data-[vaul-drawer-direction=right]:right-0 tw:data-[vaul-drawer-direction=right]:w-3/4 tw:data-[vaul-drawer-direction=right]:border-l tw:data-[vaul-drawer-direction=right]:sm:max-w-sm", "tw:data-[vaul-drawer-direction=left]:inset-y-0 tw:data-[vaul-drawer-direction=left]:left-0 tw:data-[vaul-drawer-direction=left]:w-3/4 tw:data-[vaul-drawer-direction=left]:border-r tw:data-[vaul-drawer-direction=left]:sm:max-w-sm", className), ...props, children: [jsx("div", { className: "tw:bg-muted tw:mx-auto tw:mt-4 tw:hidden tw:h-2 tw:w-[100px] tw:shrink-0 tw:rounded-full tw:group-data-[vaul-drawer-direction=bottom]/drawer-content:block" }), children] })] }));
|
|
22
|
+
}
|
|
23
|
+
function DrawerHeader({ className, ...props }) {
|
|
24
|
+
return (jsx("div", { "data-slot": "drawer-header", className: cn("tw:flex tw:flex-col tw:gap-0.5 tw:p-4 tw:group-data-[vaul-drawer-direction=bottom]/drawer-content:text-center tw:group-data-[vaul-drawer-direction=top]/drawer-content:text-center tw:md:gap-1.5 tw:md:text-left", className), ...props }));
|
|
25
|
+
}
|
|
26
|
+
function DrawerFooter({ className, ...props }) {
|
|
27
|
+
return (jsx("div", { "data-slot": "drawer-footer", className: cn("tw:mt-auto tw:flex tw:flex-col tw:gap-2 tw:p-4", className), ...props }));
|
|
28
|
+
}
|
|
29
|
+
function DrawerTitle({ className, ...props }) {
|
|
30
|
+
return (jsx(Drawer$1.Title, { "data-slot": "drawer-title", className: cn("tw:text-foreground tw:font-semibold", className), ...props }));
|
|
31
|
+
}
|
|
32
|
+
function DrawerDescription({ className, ...props }) {
|
|
33
|
+
return (jsx(Drawer$1.Description, { "data-slot": "drawer-description", className: cn("tw:text-muted-foreground tw:text-sm", className), ...props }));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
3
|
+
declare function DropdownMenu({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function DropdownMenuPortal({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
declare function DropdownMenuTrigger({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
declare function DropdownMenuContent({ className, sideOffset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function DropdownMenuGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
declare function DropdownMenuItem({ className, inset, variant, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
|
|
9
|
+
inset?: boolean;
|
|
10
|
+
variant?: "default" | "destructive";
|
|
11
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
declare function DropdownMenuCheckboxItem({ className, children, checked, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare function DropdownMenuRadioGroup({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
declare function DropdownMenuRadioItem({ className, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
declare function DropdownMenuLabel({ className, inset, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
|
|
16
|
+
inset?: boolean;
|
|
17
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
declare function DropdownMenuSeparator({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
declare function DropdownMenuShortcut({ className, ...props }: React.ComponentProps<"span">): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
declare function DropdownMenuSub({ ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
declare function DropdownMenuSubTrigger({ className, inset, children, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
|
|
22
|
+
inset?: boolean;
|
|
23
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
declare function DropdownMenuSubContent({ className, ...props }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export { DropdownMenu, DropdownMenuPortal, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuGroup, DropdownMenuLabel, DropdownMenuItem, DropdownMenuCheckboxItem, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubTrigger, DropdownMenuSubContent, };
|
|
26
|
+
//# sourceMappingURL=dropdown-menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown-menu.d.ts","sourceRoot":"","sources":["../../src/components/dropdown-menu.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,qBAAqB,MAAM,+BAA+B,CAAA;AAKtE,iBAAS,YAAY,CAAC,EACpB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,IAAI,CAAC,2CAEzD;AAED,iBAAS,kBAAkB,CAAC,EAC1B,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,MAAM,CAAC,2CAI3D;AAED,iBAAS,mBAAmB,CAAC,EAC3B,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,OAAO,CAAC,2CAO5D;AAED,iBAAS,mBAAmB,CAAC,EAC3B,SAAS,EACT,UAAc,EACd,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,OAAO,CAAC,2CAc5D;AAED,iBAAS,iBAAiB,CAAC,EACzB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,KAAK,CAAC,2CAI1D;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,KAAK,EACL,OAAmB,EACnB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,IAAI,CAAC,GAAG;IAC3D,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,CAAA;CACpC,2CAaA;AAED,iBAAS,wBAAwB,CAAC,EAChC,SAAS,EACT,QAAQ,EACR,OAAO,EACP,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,YAAY,CAAC,2CAmBjE;AAED,iBAAS,sBAAsB,CAAC,EAC9B,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,UAAU,CAAC,2CAO/D;AAED,iBAAS,qBAAqB,CAAC,EAC7B,SAAS,EACT,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,SAAS,CAAC,2CAkB9D;AAED,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,KAAK,CAAC,GAAG;IAC5D,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,2CAYA;AAED,iBAAS,qBAAqB,CAAC,EAC7B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,SAAS,CAAC,2CAQ9D;AAED,iBAAS,oBAAoB,CAAC,EAC5B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,2CAW9B;AAED,iBAAS,eAAe,CAAC,EACvB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,GAAG,CAAC,2CAExD;AAED,iBAAS,sBAAsB,CAAC,EAC9B,SAAS,EACT,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,UAAU,CAAC,GAAG;IACjE,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,2CAeA;AAED,iBAAS,sBAAsB,CAAC,EAC9B,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,qBAAqB,CAAC,UAAU,CAAC,2CAW/D;AAED,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,sBAAsB,GACvB,CAAA"}
|