@uipath/apollo-wind 0.7.2-pr188.4865fad
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/LICENSE +21 -0
- package/README.md +188 -0
- package/dist/components/forms/data-fetcher.cjs +250 -0
- package/dist/components/forms/data-fetcher.d.ts +173 -0
- package/dist/components/forms/data-fetcher.js +207 -0
- package/dist/components/forms/demo-mocks.cjs +1031 -0
- package/dist/components/forms/demo-mocks.d.ts +10 -0
- package/dist/components/forms/demo-mocks.js +997 -0
- package/dist/components/forms/field-renderer.cjs +595 -0
- package/dist/components/forms/field-renderer.d.ts +14 -0
- package/dist/components/forms/field-renderer.js +561 -0
- package/dist/components/forms/form-designer.cjs +2314 -0
- package/dist/components/forms/form-designer.d.ts +1 -0
- package/dist/components/forms/form-designer.js +2280 -0
- package/dist/components/forms/form-examples.cjs +962 -0
- package/dist/components/forms/form-examples.d.ts +46 -0
- package/dist/components/forms/form-examples.js +907 -0
- package/dist/components/forms/form-plugins.cjs +225 -0
- package/dist/components/forms/form-plugins.d.ts +11 -0
- package/dist/components/forms/form-plugins.js +176 -0
- package/dist/components/forms/form-schema.cjs +56 -0
- package/dist/components/forms/form-schema.d.ts +324 -0
- package/dist/components/forms/form-schema.js +13 -0
- package/dist/components/forms/form-state-viewer.cjs +498 -0
- package/dist/components/forms/form-state-viewer.d.ts +15 -0
- package/dist/components/forms/form-state-viewer.js +464 -0
- package/dist/components/forms/index.cjs +103 -0
- package/dist/components/forms/index.d.ts +13 -0
- package/dist/components/forms/index.js +9 -0
- package/dist/components/forms/metadata-form.cjs +400 -0
- package/dist/components/forms/metadata-form.d.ts +16 -0
- package/dist/components/forms/metadata-form.js +366 -0
- package/dist/components/forms/rules-engine.cjs +343 -0
- package/dist/components/forms/rules-engine.d.ts +99 -0
- package/dist/components/forms/rules-engine.js +293 -0
- package/dist/components/forms/schema-serializer.cjs +250 -0
- package/dist/components/forms/schema-serializer.d.ts +27 -0
- package/dist/components/forms/schema-serializer.js +213 -0
- package/dist/components/forms/schema-viewer.cjs +157 -0
- package/dist/components/forms/schema-viewer.d.ts +29 -0
- package/dist/components/forms/schema-viewer.js +117 -0
- package/dist/components/forms/validation-converter.cjs +154 -0
- package/dist/components/forms/validation-converter.d.ts +42 -0
- package/dist/components/forms/validation-converter.js +114 -0
- package/dist/components/ui/accordion.cjs +82 -0
- package/dist/components/ui/accordion.d.ts +7 -0
- package/dist/components/ui/accordion.js +39 -0
- package/dist/components/ui/alert-dialog.cjs +126 -0
- package/dist/components/ui/alert-dialog.d.ts +20 -0
- package/dist/components/ui/alert-dialog.js +62 -0
- package/dist/components/ui/alert.cjs +77 -0
- package/dist/components/ui/alert.d.ts +8 -0
- package/dist/components/ui/alert.js +37 -0
- package/dist/components/ui/aspect-ratio.cjs +38 -0
- package/dist/components/ui/aspect-ratio.d.ts +3 -0
- package/dist/components/ui/aspect-ratio.js +4 -0
- package/dist/components/ui/avatar.cjs +63 -0
- package/dist/components/ui/avatar.d.ts +6 -0
- package/dist/components/ui/avatar.js +23 -0
- package/dist/components/ui/badge.cjs +63 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/badge.js +26 -0
- package/dist/components/ui/breadcrumb.cjs +118 -0
- package/dist/components/ui/breadcrumb.d.ts +19 -0
- package/dist/components/ui/breadcrumb.js +66 -0
- package/dist/components/ui/button-group.cjs +68 -0
- package/dist/components/ui/button-group.d.ts +14 -0
- package/dist/components/ui/button-group.js +28 -0
- package/dist/components/ui/button.cjs +78 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/button.js +41 -0
- package/dist/components/ui/calendar.cjs +144 -0
- package/dist/components/ui/calendar.d.ts +8 -0
- package/dist/components/ui/calendar.js +107 -0
- package/dist/components/ui/card.cjs +89 -0
- package/dist/components/ui/card.d.ts +8 -0
- package/dist/components/ui/card.js +40 -0
- package/dist/components/ui/checkbox.cjs +52 -0
- package/dist/components/ui/checkbox.d.ts +6 -0
- package/dist/components/ui/checkbox.js +18 -0
- package/dist/components/ui/collapsible.cjs +45 -0
- package/dist/components/ui/collapsible.d.ts +5 -0
- package/dist/components/ui/collapsible.js +5 -0
- package/dist/components/ui/combobox.cjs +102 -0
- package/dist/components/ui/combobox.d.ts +15 -0
- package/dist/components/ui/combobox.js +68 -0
- package/dist/components/ui/command.cjs +131 -0
- package/dist/components/ui/command.d.ts +80 -0
- package/dist/components/ui/command.js +73 -0
- package/dist/components/ui/context-menu.cjs +173 -0
- package/dist/components/ui/context-menu.d.ts +27 -0
- package/dist/components/ui/context-menu.js +97 -0
- package/dist/components/ui/data-table.cjs +292 -0
- package/dist/components/ui/data-table.d.ts +23 -0
- package/dist/components/ui/data-table.js +252 -0
- package/dist/components/ui/date-picker.cjs +118 -0
- package/dist/components/ui/date-picker.d.ts +21 -0
- package/dist/components/ui/date-picker.js +81 -0
- package/dist/components/ui/datetime-picker.cjs +154 -0
- package/dist/components/ui/datetime-picker.d.ts +9 -0
- package/dist/components/ui/datetime-picker.js +120 -0
- package/dist/components/ui/dialog.cjs +159 -0
- package/dist/components/ui/dialog.d.ts +15 -0
- package/dist/components/ui/dialog.js +98 -0
- package/dist/components/ui/drawer.cjs +116 -0
- package/dist/components/ui/drawer.d.ts +18 -0
- package/dist/components/ui/drawer.js +55 -0
- package/dist/components/ui/dropdown-menu.cjs +174 -0
- package/dist/components/ui/dropdown-menu.d.ts +27 -0
- package/dist/components/ui/dropdown-menu.js +98 -0
- package/dist/components/ui/editable-cell.cjs +256 -0
- package/dist/components/ui/editable-cell.d.ts +24 -0
- package/dist/components/ui/editable-cell.js +219 -0
- package/dist/components/ui/empty-state.cjs +73 -0
- package/dist/components/ui/empty-state.d.ts +16 -0
- package/dist/components/ui/empty-state.js +39 -0
- package/dist/components/ui/file-upload.cjs +236 -0
- package/dist/components/ui/file-upload.d.ts +10 -0
- package/dist/components/ui/file-upload.js +202 -0
- package/dist/components/ui/hover-card.cjs +55 -0
- package/dist/components/ui/hover-card.d.ts +6 -0
- package/dist/components/ui/hover-card.js +15 -0
- package/dist/components/ui/index.cjs +546 -0
- package/dist/components/ui/index.d.ts +55 -0
- package/dist/components/ui/index.js +55 -0
- package/dist/components/ui/input.cjs +45 -0
- package/dist/components/ui/input.d.ts +5 -0
- package/dist/components/ui/input.js +11 -0
- package/dist/components/ui/label.cjs +47 -0
- package/dist/components/ui/label.d.ts +7 -0
- package/dist/components/ui/label.js +13 -0
- package/dist/components/ui/layout/column.cjs +84 -0
- package/dist/components/ui/layout/column.d.ts +21 -0
- package/dist/components/ui/layout/column.js +50 -0
- package/dist/components/ui/layout/grid.cjs +101 -0
- package/dist/components/ui/layout/grid.d.ts +22 -0
- package/dist/components/ui/layout/grid.js +67 -0
- package/dist/components/ui/layout/index.cjs +44 -0
- package/dist/components/ui/layout/index.d.ts +7 -0
- package/dist/components/ui/layout/index.js +4 -0
- package/dist/components/ui/layout/row.cjs +84 -0
- package/dist/components/ui/layout/row.d.ts +21 -0
- package/dist/components/ui/layout/row.js +50 -0
- package/dist/components/ui/layout/types.cjs +18 -0
- package/dist/components/ui/layout/types.d.ts +149 -0
- package/dist/components/ui/layout/types.js +0 -0
- package/dist/components/ui/layout/utils.cjs +324 -0
- package/dist/components/ui/layout/utils.d.ts +76 -0
- package/dist/components/ui/layout/utils.js +239 -0
- package/dist/components/ui/menubar.cjs +210 -0
- package/dist/components/ui/menubar.d.ts +28 -0
- package/dist/components/ui/menubar.js +131 -0
- package/dist/components/ui/multi-select.cjs +187 -0
- package/dist/components/ui/multi-select.d.ts +18 -0
- package/dist/components/ui/multi-select.js +153 -0
- package/dist/components/ui/navigation-menu.cjs +122 -0
- package/dist/components/ui/navigation-menu.d.ts +12 -0
- package/dist/components/ui/navigation-menu.js +64 -0
- package/dist/components/ui/pagination.cjs +131 -0
- package/dist/components/ui/pagination.d.ts +28 -0
- package/dist/components/ui/pagination.js +79 -0
- package/dist/components/ui/popover.cjs +61 -0
- package/dist/components/ui/popover.d.ts +7 -0
- package/dist/components/ui/popover.js +18 -0
- package/dist/components/ui/progress.cjs +51 -0
- package/dist/components/ui/progress.d.ts +4 -0
- package/dist/components/ui/progress.js +17 -0
- package/dist/components/ui/radio-group.cjs +61 -0
- package/dist/components/ui/radio-group.d.ts +5 -0
- package/dist/components/ui/radio-group.js +24 -0
- package/dist/components/ui/resizable.cjs +60 -0
- package/dist/components/ui/resizable.d.ts +23 -0
- package/dist/components/ui/resizable.js +20 -0
- package/dist/components/ui/scroll-area.cjs +67 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/scroll-area.js +30 -0
- package/dist/components/ui/search.cjs +153 -0
- package/dist/components/ui/search.d.ts +19 -0
- package/dist/components/ui/search.js +116 -0
- package/dist/components/ui/select.cjs +151 -0
- package/dist/components/ui/select.d.ts +13 -0
- package/dist/components/ui/select.js +90 -0
- package/dist/components/ui/separator.cjs +47 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/separator.js +13 -0
- package/dist/components/ui/sheet.cjs +142 -0
- package/dist/components/ui/sheet.d.ts +25 -0
- package/dist/components/ui/sheet.js +81 -0
- package/dist/components/ui/skeleton.cjs +43 -0
- package/dist/components/ui/skeleton.d.ts +2 -0
- package/dist/components/ui/skeleton.js +9 -0
- package/dist/components/ui/slider.cjs +63 -0
- package/dist/components/ui/slider.d.ts +4 -0
- package/dist/components/ui/slider.js +29 -0
- package/dist/components/ui/sonner.cjs +76 -0
- package/dist/components/ui/sonner.d.ts +4 -0
- package/dist/components/ui/sonner.js +39 -0
- package/dist/components/ui/spinner.cjs +78 -0
- package/dist/components/ui/spinner.d.ts +11 -0
- package/dist/components/ui/spinner.js +41 -0
- package/dist/components/ui/stats-card.cjs +102 -0
- package/dist/components/ui/stats-card.d.ts +15 -0
- package/dist/components/ui/stats-card.js +68 -0
- package/dist/components/ui/stepper.cjs +99 -0
- package/dist/components/ui/stepper.d.ts +14 -0
- package/dist/components/ui/stepper.js +65 -0
- package/dist/components/ui/switch.cjs +48 -0
- package/dist/components/ui/switch.d.ts +4 -0
- package/dist/components/ui/switch.js +14 -0
- package/dist/components/ui/table.cjs +110 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/table.js +55 -0
- package/dist/components/ui/tabs.cjs +67 -0
- package/dist/components/ui/tabs.d.ts +7 -0
- package/dist/components/ui/tabs.js +24 -0
- package/dist/components/ui/textarea.cjs +44 -0
- package/dist/components/ui/textarea.d.ts +4 -0
- package/dist/components/ui/textarea.js +10 -0
- package/dist/components/ui/toggle-group.cjs +73 -0
- package/dist/components/ui/toggle-group.d.ts +12 -0
- package/dist/components/ui/toggle-group.js +36 -0
- package/dist/components/ui/toggle.cjs +71 -0
- package/dist/components/ui/toggle.d.ts +12 -0
- package/dist/components/ui/toggle.js +34 -0
- package/dist/components/ui/tooltip.cjs +58 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/tooltip.js +15 -0
- package/dist/examples/admin-layout-example.d.ts +92 -0
- package/dist/examples/app-shell-example.d.ts +52 -0
- package/dist/examples/dashboard-example.d.ts +11 -0
- package/dist/examples/data-management-example.d.ts +1 -0
- package/dist/examples/flow-editor-layout-example.d.ts +22 -0
- package/dist/examples/flow-start-example.d.ts +30 -0
- package/dist/examples/form-builder-example.d.ts +1 -0
- package/dist/examples/new-project-example.d.ts +30 -0
- package/dist/examples/settings-example.d.ts +1 -0
- package/dist/examples/vscode-example.d.ts +80 -0
- package/dist/index.cjs +830 -0
- package/dist/index.d.ts +86 -0
- package/dist/index.js +67 -0
- package/dist/lib/index.cjs +42 -0
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.js +2 -0
- package/dist/lib/utils.cjs +70 -0
- package/dist/lib/utils.d.ts +14 -0
- package/dist/lib/utils.js +30 -0
- package/dist/postcss.config.export.cjs +43 -0
- package/dist/postcss.config.export.js +9 -0
- package/dist/styles.css +6868 -0
- package/dist/tailwind.css +239 -0
- package/dist/tailwind.preset.cjs +77 -0
- package/dist/tailwind.preset.js +43 -0
- package/package.json +157 -0
- package/postcss.config.export.js +9 -0
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from "react";
|
|
3
|
+
import { ArrowDown, ArrowUp, ArrowUpDown, ChevronDown } from "lucide-react";
|
|
4
|
+
import { Button } from "./button.js";
|
|
5
|
+
import { Checkbox } from "./checkbox.js";
|
|
6
|
+
import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuTrigger } from "./dropdown-menu.js";
|
|
7
|
+
import { EditableCell } from "./editable-cell.js";
|
|
8
|
+
import { Input } from "./input.js";
|
|
9
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "./table.js";
|
|
10
|
+
import { flexRender, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel, useReactTable } from "@tanstack/react-table";
|
|
11
|
+
function DataTable({ columns, data, searchKey, searchPlaceholder = 'Search...', showColumnToggle = true, showPagination = true, pageSize = 10, editable = false, onCellUpdate, resizable = false, compact = false, columnToggleText = 'Columns' }) {
|
|
12
|
+
const [sorting, setSorting] = useState([]);
|
|
13
|
+
const [columnFilters, setColumnFilters] = useState([]);
|
|
14
|
+
const [columnVisibility, setColumnVisibility] = useState({});
|
|
15
|
+
const [rowSelection, setRowSelection] = useState({});
|
|
16
|
+
const processedColumns = useMemo(()=>{
|
|
17
|
+
if (!editable || !onCellUpdate) return columns;
|
|
18
|
+
return columns.map((col)=>{
|
|
19
|
+
const meta = col.meta;
|
|
20
|
+
if (!meta?.type || col.cell) return col;
|
|
21
|
+
return {
|
|
22
|
+
...col,
|
|
23
|
+
cell: (cellContext)=>/*#__PURE__*/ jsx(EditableCell, {
|
|
24
|
+
cell: cellContext,
|
|
25
|
+
onUpdate: (value)=>{
|
|
26
|
+
onCellUpdate(cellContext.row.index, cellContext.column.id, value);
|
|
27
|
+
}
|
|
28
|
+
})
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
}, [
|
|
32
|
+
columns,
|
|
33
|
+
editable,
|
|
34
|
+
onCellUpdate
|
|
35
|
+
]);
|
|
36
|
+
const table = useReactTable({
|
|
37
|
+
data,
|
|
38
|
+
columns: processedColumns,
|
|
39
|
+
onSortingChange: setSorting,
|
|
40
|
+
onColumnFiltersChange: setColumnFilters,
|
|
41
|
+
getCoreRowModel: getCoreRowModel(),
|
|
42
|
+
getPaginationRowModel: getPaginationRowModel(),
|
|
43
|
+
getSortedRowModel: getSortedRowModel(),
|
|
44
|
+
getFilteredRowModel: getFilteredRowModel(),
|
|
45
|
+
onColumnVisibilityChange: setColumnVisibility,
|
|
46
|
+
onRowSelectionChange: setRowSelection,
|
|
47
|
+
enableColumnResizing: resizable,
|
|
48
|
+
columnResizeMode: 'onChange',
|
|
49
|
+
state: {
|
|
50
|
+
sorting,
|
|
51
|
+
columnFilters,
|
|
52
|
+
columnVisibility,
|
|
53
|
+
rowSelection
|
|
54
|
+
},
|
|
55
|
+
initialState: {
|
|
56
|
+
pagination: {
|
|
57
|
+
pageSize
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
62
|
+
className: "w-full",
|
|
63
|
+
children: [
|
|
64
|
+
/*#__PURE__*/ jsxs("div", {
|
|
65
|
+
className: "flex items-center gap-4 py-4",
|
|
66
|
+
children: [
|
|
67
|
+
searchKey && /*#__PURE__*/ jsx(Input, {
|
|
68
|
+
placeholder: searchPlaceholder,
|
|
69
|
+
value: table.getColumn(searchKey)?.getFilterValue() ?? '',
|
|
70
|
+
onChange: (event)=>table.getColumn(searchKey)?.setFilterValue(event.target.value),
|
|
71
|
+
className: "max-w-sm"
|
|
72
|
+
}),
|
|
73
|
+
showColumnToggle && /*#__PURE__*/ jsxs(DropdownMenu, {
|
|
74
|
+
children: [
|
|
75
|
+
/*#__PURE__*/ jsx(DropdownMenuTrigger, {
|
|
76
|
+
asChild: true,
|
|
77
|
+
children: /*#__PURE__*/ jsxs(Button, {
|
|
78
|
+
variant: "outline",
|
|
79
|
+
className: "ml-auto",
|
|
80
|
+
children: [
|
|
81
|
+
columnToggleText,
|
|
82
|
+
" ",
|
|
83
|
+
/*#__PURE__*/ jsx(ChevronDown, {
|
|
84
|
+
className: "ml-2 h-4 w-4"
|
|
85
|
+
})
|
|
86
|
+
]
|
|
87
|
+
})
|
|
88
|
+
}),
|
|
89
|
+
/*#__PURE__*/ jsx(DropdownMenuContent, {
|
|
90
|
+
align: "end",
|
|
91
|
+
children: table.getAllColumns().filter((column)=>column.getCanHide()).map((column)=>/*#__PURE__*/ jsx(DropdownMenuCheckboxItem, {
|
|
92
|
+
className: "capitalize",
|
|
93
|
+
checked: column.getIsVisible(),
|
|
94
|
+
onCheckedChange: (value)=>column.toggleVisibility(!!value),
|
|
95
|
+
children: column.id
|
|
96
|
+
}, column.id))
|
|
97
|
+
})
|
|
98
|
+
]
|
|
99
|
+
})
|
|
100
|
+
]
|
|
101
|
+
}),
|
|
102
|
+
/*#__PURE__*/ jsx("div", {
|
|
103
|
+
className: "rounded-md border overflow-auto",
|
|
104
|
+
children: /*#__PURE__*/ jsxs(Table, {
|
|
105
|
+
style: resizable ? {
|
|
106
|
+
width: table.getTotalSize(),
|
|
107
|
+
tableLayout: 'fixed'
|
|
108
|
+
} : void 0,
|
|
109
|
+
children: [
|
|
110
|
+
/*#__PURE__*/ jsx(TableHeader, {
|
|
111
|
+
children: table.getHeaderGroups().map((headerGroup)=>/*#__PURE__*/ jsx(TableRow, {
|
|
112
|
+
children: headerGroup.headers.map((header)=>{
|
|
113
|
+
const { column } = header;
|
|
114
|
+
return /*#__PURE__*/ jsxs(TableHead, {
|
|
115
|
+
className: compact ? 'relative h-8 px-2 py-1' : 'relative',
|
|
116
|
+
style: {
|
|
117
|
+
width: resizable ? header.getSize() : 150 !== column.getSize() ? column.getSize() : void 0,
|
|
118
|
+
minWidth: column.columnDef.minSize,
|
|
119
|
+
maxWidth: column.columnDef.maxSize
|
|
120
|
+
},
|
|
121
|
+
children: [
|
|
122
|
+
header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext()),
|
|
123
|
+
resizable && header.column.getCanResize() && /*#__PURE__*/ jsx("div", {
|
|
124
|
+
onMouseDown: header.getResizeHandler(),
|
|
125
|
+
onTouchStart: header.getResizeHandler(),
|
|
126
|
+
className: "absolute -right-1 top-0 z-10 h-full w-2 cursor-col-resize select-none touch-none group",
|
|
127
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
128
|
+
className: `h-full w-px mx-auto ${header.column.getIsResizing() ? 'bg-primary' : 'group-hover:bg-primary/50'}`
|
|
129
|
+
})
|
|
130
|
+
})
|
|
131
|
+
]
|
|
132
|
+
}, header.id);
|
|
133
|
+
})
|
|
134
|
+
}, headerGroup.id))
|
|
135
|
+
}),
|
|
136
|
+
/*#__PURE__*/ jsx(TableBody, {
|
|
137
|
+
children: table.getRowModel().rows?.length ? table.getRowModel().rows.map((row)=>/*#__PURE__*/ jsx(TableRow, {
|
|
138
|
+
"data-state": row.getIsSelected() && 'selected',
|
|
139
|
+
children: row.getVisibleCells().map((cell)=>{
|
|
140
|
+
const { column } = cell;
|
|
141
|
+
return /*#__PURE__*/ jsx(TableCell, {
|
|
142
|
+
className: compact ? 'truncate px-2 py-1' : 'truncate',
|
|
143
|
+
style: {
|
|
144
|
+
width: resizable ? cell.column.getSize() : 150 !== column.getSize() ? column.getSize() : void 0,
|
|
145
|
+
minWidth: column.columnDef.minSize,
|
|
146
|
+
maxWidth: column.columnDef.maxSize
|
|
147
|
+
},
|
|
148
|
+
children: flexRender(cell.column.columnDef.cell, cell.getContext())
|
|
149
|
+
}, cell.id);
|
|
150
|
+
})
|
|
151
|
+
}, row.id)) : /*#__PURE__*/ jsx(TableRow, {
|
|
152
|
+
children: /*#__PURE__*/ jsx(TableCell, {
|
|
153
|
+
colSpan: columns.length,
|
|
154
|
+
className: "h-24 text-center",
|
|
155
|
+
children: "No results."
|
|
156
|
+
})
|
|
157
|
+
})
|
|
158
|
+
})
|
|
159
|
+
]
|
|
160
|
+
})
|
|
161
|
+
}),
|
|
162
|
+
showPagination && /*#__PURE__*/ jsxs("div", {
|
|
163
|
+
className: "flex items-center justify-between space-x-2 py-4",
|
|
164
|
+
children: [
|
|
165
|
+
/*#__PURE__*/ jsxs("div", {
|
|
166
|
+
className: "flex-1 text-sm text-muted-foreground",
|
|
167
|
+
children: [
|
|
168
|
+
table.getFilteredSelectedRowModel().rows.length,
|
|
169
|
+
" of",
|
|
170
|
+
' ',
|
|
171
|
+
table.getFilteredRowModel().rows.length,
|
|
172
|
+
" row(s) selected."
|
|
173
|
+
]
|
|
174
|
+
}),
|
|
175
|
+
/*#__PURE__*/ jsxs("div", {
|
|
176
|
+
className: "flex items-center space-x-2",
|
|
177
|
+
children: [
|
|
178
|
+
/*#__PURE__*/ jsx(Button, {
|
|
179
|
+
variant: "outline",
|
|
180
|
+
size: "sm",
|
|
181
|
+
onClick: ()=>table.previousPage(),
|
|
182
|
+
disabled: !table.getCanPreviousPage(),
|
|
183
|
+
children: "Previous"
|
|
184
|
+
}),
|
|
185
|
+
/*#__PURE__*/ jsxs("div", {
|
|
186
|
+
className: "text-sm font-medium",
|
|
187
|
+
children: [
|
|
188
|
+
"Page ",
|
|
189
|
+
table.getState().pagination.pageIndex + 1,
|
|
190
|
+
" of ",
|
|
191
|
+
table.getPageCount()
|
|
192
|
+
]
|
|
193
|
+
}),
|
|
194
|
+
/*#__PURE__*/ jsx(Button, {
|
|
195
|
+
variant: "outline",
|
|
196
|
+
size: "sm",
|
|
197
|
+
onClick: ()=>table.nextPage(),
|
|
198
|
+
disabled: !table.getCanNextPage(),
|
|
199
|
+
children: "Next"
|
|
200
|
+
})
|
|
201
|
+
]
|
|
202
|
+
})
|
|
203
|
+
]
|
|
204
|
+
})
|
|
205
|
+
]
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
function DataTableColumnHeader({ column, title, children }) {
|
|
209
|
+
const sorted = column.getIsSorted();
|
|
210
|
+
const handleClick = ()=>{
|
|
211
|
+
if ('asc' === sorted) column.toggleSorting(true);
|
|
212
|
+
else if ('desc' === sorted) column.clearSorting();
|
|
213
|
+
else column.toggleSorting(false);
|
|
214
|
+
};
|
|
215
|
+
return /*#__PURE__*/ jsxs(Button, {
|
|
216
|
+
variant: "ghost",
|
|
217
|
+
size: "sm",
|
|
218
|
+
className: "-ml-3 h-8 data-[state=open]:bg-accent",
|
|
219
|
+
onClick: handleClick,
|
|
220
|
+
children: [
|
|
221
|
+
/*#__PURE__*/ jsx("span", {
|
|
222
|
+
children: title
|
|
223
|
+
}),
|
|
224
|
+
children,
|
|
225
|
+
'asc' === sorted ? /*#__PURE__*/ jsx(ArrowUp, {
|
|
226
|
+
className: "ml-2 h-4 w-4"
|
|
227
|
+
}) : 'desc' === sorted ? /*#__PURE__*/ jsx(ArrowDown, {
|
|
228
|
+
className: "ml-2 h-4 w-4"
|
|
229
|
+
}) : /*#__PURE__*/ jsx(ArrowUpDown, {
|
|
230
|
+
className: "ml-2 h-4 w-4"
|
|
231
|
+
})
|
|
232
|
+
]
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
function DataTableSelectColumn() {
|
|
236
|
+
return {
|
|
237
|
+
id: 'select',
|
|
238
|
+
header: ({ table })=>/*#__PURE__*/ jsx(Checkbox, {
|
|
239
|
+
checked: table.getIsAllPageRowsSelected() || table.getIsSomePageRowsSelected() && 'indeterminate',
|
|
240
|
+
onCheckedChange: (value)=>table.toggleAllPageRowsSelected(!!value),
|
|
241
|
+
"aria-label": "Select all"
|
|
242
|
+
}),
|
|
243
|
+
cell: ({ row })=>/*#__PURE__*/ jsx(Checkbox, {
|
|
244
|
+
checked: row.getIsSelected(),
|
|
245
|
+
onCheckedChange: (value)=>row.toggleSelected(!!value),
|
|
246
|
+
"aria-label": "Select row"
|
|
247
|
+
}),
|
|
248
|
+
enableSorting: false,
|
|
249
|
+
enableHiding: false
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
export { DataTable, DataTableColumnHeader, DataTableSelectColumn };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
var __webpack_require__ = {};
|
|
4
|
+
(()=>{
|
|
5
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
6
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: definition[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
14
|
+
})();
|
|
15
|
+
(()=>{
|
|
16
|
+
__webpack_require__.r = (exports1)=>{
|
|
17
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
18
|
+
value: 'Module'
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
21
|
+
value: true
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
})();
|
|
25
|
+
var __webpack_exports__ = {};
|
|
26
|
+
__webpack_require__.r(__webpack_exports__);
|
|
27
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
28
|
+
DatePicker: ()=>DatePicker,
|
|
29
|
+
DateRangePicker: ()=>DateRangePicker
|
|
30
|
+
});
|
|
31
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
32
|
+
const external_date_fns_namespaceObject = require("date-fns");
|
|
33
|
+
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
34
|
+
const external_button_cjs_namespaceObject = require("./button.cjs");
|
|
35
|
+
const external_calendar_cjs_namespaceObject = require("./calendar.cjs");
|
|
36
|
+
const external_popover_cjs_namespaceObject = require("./popover.cjs");
|
|
37
|
+
const index_cjs_namespaceObject = require("../../lib/index.cjs");
|
|
38
|
+
function DatePicker({ value, onValueChange, disabled, placeholder = 'Pick a date', className, calendarProps }) {
|
|
39
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_popover_cjs_namespaceObject.Popover, {
|
|
40
|
+
children: [
|
|
41
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.PopoverTrigger, {
|
|
42
|
+
asChild: true,
|
|
43
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_button_cjs_namespaceObject.Button, {
|
|
44
|
+
variant: "outline",
|
|
45
|
+
"aria-label": value ? `Selected date: ${(0, external_date_fns_namespaceObject.format)(value, 'PPP')}` : placeholder,
|
|
46
|
+
className: (0, index_cjs_namespaceObject.cn)('w-full justify-start text-left font-normal', !value && 'text-muted-foreground', className),
|
|
47
|
+
disabled: disabled,
|
|
48
|
+
children: [
|
|
49
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.CalendarIcon, {}),
|
|
50
|
+
value ? (0, external_date_fns_namespaceObject.format)(value, 'PPP') : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
51
|
+
children: placeholder
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
})
|
|
55
|
+
}),
|
|
56
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.PopoverContent, {
|
|
57
|
+
className: "w-auto p-0",
|
|
58
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_calendar_cjs_namespaceObject.Calendar, {
|
|
59
|
+
mode: "single",
|
|
60
|
+
selected: value,
|
|
61
|
+
onSelect: onValueChange,
|
|
62
|
+
initialFocus: true,
|
|
63
|
+
...calendarProps
|
|
64
|
+
})
|
|
65
|
+
})
|
|
66
|
+
]
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function DateRangePicker({ value, onValueChange, disabled, placeholder = 'Pick a date range', className, calendarProps }) {
|
|
70
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_popover_cjs_namespaceObject.Popover, {
|
|
71
|
+
children: [
|
|
72
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.PopoverTrigger, {
|
|
73
|
+
asChild: true,
|
|
74
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_button_cjs_namespaceObject.Button, {
|
|
75
|
+
variant: "outline",
|
|
76
|
+
"aria-label": value?.from ? value.to ? `Selected range: ${(0, external_date_fns_namespaceObject.format)(value.from, 'LLL dd, y')} to ${(0, external_date_fns_namespaceObject.format)(value.to, 'LLL dd, y')}` : `Selected date: ${(0, external_date_fns_namespaceObject.format)(value.from, 'LLL dd, y')}` : placeholder,
|
|
77
|
+
className: (0, index_cjs_namespaceObject.cn)('w-[300px] justify-start text-left font-normal', !value && 'text-muted-foreground', className),
|
|
78
|
+
disabled: disabled,
|
|
79
|
+
children: [
|
|
80
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.CalendarIcon, {}),
|
|
81
|
+
value?.from ? value.to ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
82
|
+
children: [
|
|
83
|
+
(0, external_date_fns_namespaceObject.format)(value.from, 'LLL dd, y'),
|
|
84
|
+
" - ",
|
|
85
|
+
(0, external_date_fns_namespaceObject.format)(value.to, 'LLL dd, y')
|
|
86
|
+
]
|
|
87
|
+
}) : (0, external_date_fns_namespaceObject.format)(value.from, 'LLL dd, y') : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
88
|
+
children: placeholder
|
|
89
|
+
})
|
|
90
|
+
]
|
|
91
|
+
})
|
|
92
|
+
}),
|
|
93
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.PopoverContent, {
|
|
94
|
+
className: "w-auto p-0",
|
|
95
|
+
align: "start",
|
|
96
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_calendar_cjs_namespaceObject.Calendar, {
|
|
97
|
+
initialFocus: true,
|
|
98
|
+
mode: "range",
|
|
99
|
+
defaultMonth: value?.from,
|
|
100
|
+
selected: value,
|
|
101
|
+
onSelect: onValueChange,
|
|
102
|
+
numberOfMonths: 2,
|
|
103
|
+
required: false,
|
|
104
|
+
...calendarProps
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
]
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
exports.DatePicker = __webpack_exports__.DatePicker;
|
|
111
|
+
exports.DateRangePicker = __webpack_exports__.DateRangePicker;
|
|
112
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
113
|
+
"DatePicker",
|
|
114
|
+
"DateRangePicker"
|
|
115
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
116
|
+
Object.defineProperty(exports, '__esModule', {
|
|
117
|
+
value: true
|
|
118
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { DateRange } from 'react-day-picker';
|
|
2
|
+
import type * as React from 'react';
|
|
3
|
+
import { Calendar } from './calendar';
|
|
4
|
+
export interface DatePickerProps {
|
|
5
|
+
value?: Date;
|
|
6
|
+
onValueChange?: (date: Date | undefined) => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
calendarProps?: Omit<React.ComponentProps<typeof Calendar>, 'mode' | 'selected' | 'onSelect' | 'initialFocus'>;
|
|
11
|
+
}
|
|
12
|
+
export declare function DatePicker({ value, onValueChange, disabled, placeholder, className, calendarProps, }: DatePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export interface DateRangePickerProps {
|
|
14
|
+
value?: DateRange;
|
|
15
|
+
onValueChange?: (range: DateRange | undefined) => void;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
className?: string;
|
|
19
|
+
calendarProps?: Omit<React.ComponentProps<typeof Calendar>, 'mode' | 'selected' | 'onSelect' | 'initialFocus' | 'defaultMonth' | 'numberOfMonths' | 'required'>;
|
|
20
|
+
}
|
|
21
|
+
export declare function DateRangePicker({ value, onValueChange, disabled, placeholder, className, calendarProps, }: DateRangePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { format } from "date-fns";
|
|
4
|
+
import { CalendarIcon } from "lucide-react";
|
|
5
|
+
import { Button } from "./button.js";
|
|
6
|
+
import { Calendar } from "./calendar.js";
|
|
7
|
+
import { Popover, PopoverContent, PopoverTrigger } from "./popover.js";
|
|
8
|
+
import { cn } from "../../lib/index.js";
|
|
9
|
+
function DatePicker({ value, onValueChange, disabled, placeholder = 'Pick a date', className, calendarProps }) {
|
|
10
|
+
return /*#__PURE__*/ jsxs(Popover, {
|
|
11
|
+
children: [
|
|
12
|
+
/*#__PURE__*/ jsx(PopoverTrigger, {
|
|
13
|
+
asChild: true,
|
|
14
|
+
children: /*#__PURE__*/ jsxs(Button, {
|
|
15
|
+
variant: "outline",
|
|
16
|
+
"aria-label": value ? `Selected date: ${format(value, 'PPP')}` : placeholder,
|
|
17
|
+
className: cn('w-full justify-start text-left font-normal', !value && 'text-muted-foreground', className),
|
|
18
|
+
disabled: disabled,
|
|
19
|
+
children: [
|
|
20
|
+
/*#__PURE__*/ jsx(CalendarIcon, {}),
|
|
21
|
+
value ? format(value, 'PPP') : /*#__PURE__*/ jsx("span", {
|
|
22
|
+
children: placeholder
|
|
23
|
+
})
|
|
24
|
+
]
|
|
25
|
+
})
|
|
26
|
+
}),
|
|
27
|
+
/*#__PURE__*/ jsx(PopoverContent, {
|
|
28
|
+
className: "w-auto p-0",
|
|
29
|
+
children: /*#__PURE__*/ jsx(Calendar, {
|
|
30
|
+
mode: "single",
|
|
31
|
+
selected: value,
|
|
32
|
+
onSelect: onValueChange,
|
|
33
|
+
initialFocus: true,
|
|
34
|
+
...calendarProps
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
]
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function DateRangePicker({ value, onValueChange, disabled, placeholder = 'Pick a date range', className, calendarProps }) {
|
|
41
|
+
return /*#__PURE__*/ jsxs(Popover, {
|
|
42
|
+
children: [
|
|
43
|
+
/*#__PURE__*/ jsx(PopoverTrigger, {
|
|
44
|
+
asChild: true,
|
|
45
|
+
children: /*#__PURE__*/ jsxs(Button, {
|
|
46
|
+
variant: "outline",
|
|
47
|
+
"aria-label": value?.from ? value.to ? `Selected range: ${format(value.from, 'LLL dd, y')} to ${format(value.to, 'LLL dd, y')}` : `Selected date: ${format(value.from, 'LLL dd, y')}` : placeholder,
|
|
48
|
+
className: cn('w-[300px] justify-start text-left font-normal', !value && 'text-muted-foreground', className),
|
|
49
|
+
disabled: disabled,
|
|
50
|
+
children: [
|
|
51
|
+
/*#__PURE__*/ jsx(CalendarIcon, {}),
|
|
52
|
+
value?.from ? value.to ? /*#__PURE__*/ jsxs(Fragment, {
|
|
53
|
+
children: [
|
|
54
|
+
format(value.from, 'LLL dd, y'),
|
|
55
|
+
" - ",
|
|
56
|
+
format(value.to, 'LLL dd, y')
|
|
57
|
+
]
|
|
58
|
+
}) : format(value.from, 'LLL dd, y') : /*#__PURE__*/ jsx("span", {
|
|
59
|
+
children: placeholder
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
})
|
|
63
|
+
}),
|
|
64
|
+
/*#__PURE__*/ jsx(PopoverContent, {
|
|
65
|
+
className: "w-auto p-0",
|
|
66
|
+
align: "start",
|
|
67
|
+
children: /*#__PURE__*/ jsx(Calendar, {
|
|
68
|
+
initialFocus: true,
|
|
69
|
+
mode: "range",
|
|
70
|
+
defaultMonth: value?.from,
|
|
71
|
+
selected: value,
|
|
72
|
+
onSelect: onValueChange,
|
|
73
|
+
numberOfMonths: 2,
|
|
74
|
+
required: false,
|
|
75
|
+
...calendarProps
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
export { DatePicker, DateRangePicker };
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
DateTimePicker: ()=>DateTimePicker
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const external_react_namespaceObject = require("react");
|
|
31
|
+
const external_date_fns_namespaceObject = require("date-fns");
|
|
32
|
+
const external_lucide_react_namespaceObject = require("lucide-react");
|
|
33
|
+
const external_button_cjs_namespaceObject = require("./button.cjs");
|
|
34
|
+
const external_calendar_cjs_namespaceObject = require("./calendar.cjs");
|
|
35
|
+
const external_popover_cjs_namespaceObject = require("./popover.cjs");
|
|
36
|
+
const external_input_cjs_namespaceObject = require("./input.cjs");
|
|
37
|
+
const external_label_cjs_namespaceObject = require("./label.cjs");
|
|
38
|
+
const index_cjs_namespaceObject = require("../../lib/index.cjs");
|
|
39
|
+
function DateTimePicker({ value, onValueChange, disabled, placeholder = 'Pick a date and time', className, use12Hour = false }) {
|
|
40
|
+
const [open, setOpen] = external_react_namespaceObject.useState(false);
|
|
41
|
+
const [selectedDate, setSelectedDate] = external_react_namespaceObject.useState(value);
|
|
42
|
+
const [timeValue, setTimeValue] = external_react_namespaceObject.useState(value ? (0, external_date_fns_namespaceObject.format)(value, use12Hour ? 'hh:mm a' : 'HH:mm') : '');
|
|
43
|
+
const handleDateSelect = (date)=>{
|
|
44
|
+
if (!date) return;
|
|
45
|
+
if (selectedDate) {
|
|
46
|
+
date.setHours(selectedDate.getHours());
|
|
47
|
+
date.setMinutes(selectedDate.getMinutes());
|
|
48
|
+
date.setSeconds(selectedDate.getSeconds());
|
|
49
|
+
}
|
|
50
|
+
setSelectedDate(date);
|
|
51
|
+
onValueChange?.(date);
|
|
52
|
+
};
|
|
53
|
+
const handleTimeChange = (e)=>{
|
|
54
|
+
const time = e.target.value;
|
|
55
|
+
setTimeValue(time);
|
|
56
|
+
if (!selectedDate) return;
|
|
57
|
+
const [hours, minutes] = time.split(':').map(Number);
|
|
58
|
+
const newDate = new Date(selectedDate);
|
|
59
|
+
newDate.setHours(hours);
|
|
60
|
+
newDate.setMinutes(minutes);
|
|
61
|
+
setSelectedDate(newDate);
|
|
62
|
+
onValueChange?.(newDate);
|
|
63
|
+
};
|
|
64
|
+
const formatDisplayValue = ()=>{
|
|
65
|
+
if (!selectedDate) return placeholder;
|
|
66
|
+
const datePart = (0, external_date_fns_namespaceObject.format)(selectedDate, 'PPP');
|
|
67
|
+
const timePart = (0, external_date_fns_namespaceObject.format)(selectedDate, use12Hour ? 'hh:mm a' : 'HH:mm');
|
|
68
|
+
return `${datePart} at ${timePart}`;
|
|
69
|
+
};
|
|
70
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_popover_cjs_namespaceObject.Popover, {
|
|
71
|
+
open: open,
|
|
72
|
+
onOpenChange: setOpen,
|
|
73
|
+
children: [
|
|
74
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.PopoverTrigger, {
|
|
75
|
+
asChild: true,
|
|
76
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_button_cjs_namespaceObject.Button, {
|
|
77
|
+
variant: "outline",
|
|
78
|
+
className: (0, index_cjs_namespaceObject.cn)('w-full justify-start text-left font-normal', !selectedDate && 'text-muted-foreground', className),
|
|
79
|
+
disabled: disabled,
|
|
80
|
+
children: [
|
|
81
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.CalendarIcon, {
|
|
82
|
+
className: "mr-2 h-4 w-4"
|
|
83
|
+
}),
|
|
84
|
+
formatDisplayValue()
|
|
85
|
+
]
|
|
86
|
+
})
|
|
87
|
+
}),
|
|
88
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_popover_cjs_namespaceObject.PopoverContent, {
|
|
89
|
+
className: "w-auto p-0",
|
|
90
|
+
align: "start",
|
|
91
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
92
|
+
className: "p-3 space-y-3",
|
|
93
|
+
children: [
|
|
94
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_calendar_cjs_namespaceObject.Calendar, {
|
|
95
|
+
mode: "single",
|
|
96
|
+
selected: selectedDate,
|
|
97
|
+
onSelect: handleDateSelect,
|
|
98
|
+
initialFocus: true
|
|
99
|
+
}),
|
|
100
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
101
|
+
className: "border-t pt-3 space-y-2",
|
|
102
|
+
children: [
|
|
103
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_label_cjs_namespaceObject.Label, {
|
|
104
|
+
className: "text-sm font-medium flex items-center gap-2",
|
|
105
|
+
children: [
|
|
106
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_lucide_react_namespaceObject.Clock, {
|
|
107
|
+
className: "h-4 w-4"
|
|
108
|
+
}),
|
|
109
|
+
"Time"
|
|
110
|
+
]
|
|
111
|
+
}),
|
|
112
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_input_cjs_namespaceObject.Input, {
|
|
113
|
+
type: "time",
|
|
114
|
+
value: timeValue,
|
|
115
|
+
onChange: handleTimeChange,
|
|
116
|
+
className: "w-full"
|
|
117
|
+
})
|
|
118
|
+
]
|
|
119
|
+
}),
|
|
120
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
121
|
+
className: "flex gap-2",
|
|
122
|
+
children: [
|
|
123
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_button_cjs_namespaceObject.Button, {
|
|
124
|
+
variant: "outline",
|
|
125
|
+
className: "w-full",
|
|
126
|
+
onClick: ()=>{
|
|
127
|
+
setSelectedDate(void 0);
|
|
128
|
+
setTimeValue('');
|
|
129
|
+
onValueChange?.(void 0);
|
|
130
|
+
setOpen(false);
|
|
131
|
+
},
|
|
132
|
+
children: "Clear"
|
|
133
|
+
}),
|
|
134
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_button_cjs_namespaceObject.Button, {
|
|
135
|
+
className: "w-full",
|
|
136
|
+
onClick: ()=>setOpen(false),
|
|
137
|
+
disabled: !selectedDate,
|
|
138
|
+
children: "Done"
|
|
139
|
+
})
|
|
140
|
+
]
|
|
141
|
+
})
|
|
142
|
+
]
|
|
143
|
+
})
|
|
144
|
+
})
|
|
145
|
+
]
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
exports.DateTimePicker = __webpack_exports__.DateTimePicker;
|
|
149
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
150
|
+
"DateTimePicker"
|
|
151
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
152
|
+
Object.defineProperty(exports, '__esModule', {
|
|
153
|
+
value: true
|
|
154
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface DateTimePickerProps {
|
|
2
|
+
value?: Date;
|
|
3
|
+
onValueChange?: (date: Date | undefined) => void;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
use12Hour?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function DateTimePicker({ value, onValueChange, disabled, placeholder, className, use12Hour, }: DateTimePickerProps): import("react/jsx-runtime").JSX.Element;
|