@dynostack/react-grid 0.3.1 → 0.3.2
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/README.md +19 -5
- package/dist/index.cjs +24 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +25 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -157,7 +157,7 @@ type ViewSheetLabels = {
|
|
|
157
157
|
type ViewSheetConfig<TData> = {
|
|
158
158
|
/** Side of the screen to slide in from. Defaults to "right". */
|
|
159
159
|
side?: SheetSide;
|
|
160
|
-
/** Initial
|
|
160
|
+
/** Initial layout density. Defaults to "compact" (more fields per row). */
|
|
161
161
|
defaultDensity?: ViewSheetDensity;
|
|
162
162
|
/** Hide the density tabs entirely if you want a fixed layout. */
|
|
163
163
|
hideDensityTabs?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -157,7 +157,7 @@ type ViewSheetLabels = {
|
|
|
157
157
|
type ViewSheetConfig<TData> = {
|
|
158
158
|
/** Side of the screen to slide in from. Defaults to "right". */
|
|
159
159
|
side?: SheetSide;
|
|
160
|
-
/** Initial
|
|
160
|
+
/** Initial layout density. Defaults to "compact" (more fields per row). */
|
|
161
161
|
defaultDensity?: ViewSheetDensity;
|
|
162
162
|
/** Hide the density tabs entirely if you want a fixed layout. */
|
|
163
163
|
hideDensityTabs?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createContext, useContext, useState, useRef, useEffect, useMemo, useLayoutEffect, useId } from 'react';
|
|
2
2
|
import { useReactTable, getPaginationRowModel, getExpandedRowModel, getSortedRowModel, getFilteredRowModel, getCoreRowModel, flexRender } from '@tanstack/react-table';
|
|
3
|
-
import { Trash2Icon, XIcon, SearchIcon, RefreshCwIcon, ColumnsIcon, DownloadIcon, FileTextIcon, FileSpreadsheetIcon, PlusIcon, ChevronsLeftIcon, ChevronLeftIcon, ChevronRightIcon, ChevronsRightIcon, ArrowDownIcon, ArrowUpIcon, ChevronsUpDownIcon, PinOffIcon, PinIcon, EyeOffIcon, FilterIcon, CheckIcon, MoreHorizontalIcon, ChevronDownIcon, GripVerticalIcon, Loader2Icon, MinusIcon, CopyIcon, PencilIcon, EyeIcon, ChevronUpIcon,
|
|
3
|
+
import { Trash2Icon, XIcon, SearchIcon, RefreshCwIcon, ColumnsIcon, DownloadIcon, FileTextIcon, FileSpreadsheetIcon, PlusIcon, ChevronsLeftIcon, ChevronLeftIcon, ChevronRightIcon, ChevronsRightIcon, ArrowDownIcon, ArrowUpIcon, ChevronsUpDownIcon, PinOffIcon, PinIcon, EyeOffIcon, FilterIcon, CheckIcon, MoreHorizontalIcon, ChevronDownIcon, GripVerticalIcon, Loader2Icon, MinusIcon, CopyIcon, PencilIcon, EyeIcon, ChevronUpIcon, ListIcon, Rows3Icon, LayoutGridIcon } from 'lucide-react';
|
|
4
4
|
import { clsx } from 'clsx';
|
|
5
5
|
import { twMerge } from 'tailwind-merge';
|
|
6
6
|
import { Slot, Separator as Separator$1, Popover as Popover$1, Checkbox as Checkbox$1, DropdownMenu as DropdownMenu$1, Select as Select$1, Dialog, AlertDialog as AlertDialog$1 } from 'radix-ui';
|
|
@@ -2214,8 +2214,8 @@ function SheetOverlay({
|
|
|
2214
2214
|
);
|
|
2215
2215
|
}
|
|
2216
2216
|
var SIDE_CLASS = {
|
|
2217
|
-
right: "right-0 top-0 h-full w-
|
|
2218
|
-
left: "left-0 top-0 h-full w-
|
|
2217
|
+
right: "right-0 top-0 h-full w-full border-l sm:w-[min(48rem,calc(100vw-2rem))] data-closed:slide-out-to-right data-open:slide-in-from-right",
|
|
2218
|
+
left: "left-0 top-0 h-full w-full border-r sm:w-[min(48rem,calc(100vw-2rem))] data-closed:slide-out-to-left data-open:slide-in-from-left",
|
|
2219
2219
|
top: "left-0 top-0 w-full max-h-[80vh] border-b data-closed:slide-out-to-top data-open:slide-in-from-top",
|
|
2220
2220
|
bottom: "left-0 bottom-0 w-full max-h-[80vh] border-t data-closed:slide-out-to-bottom data-open:slide-in-from-bottom"
|
|
2221
2221
|
};
|
|
@@ -2290,14 +2290,19 @@ function SheetDescription({
|
|
|
2290
2290
|
);
|
|
2291
2291
|
}
|
|
2292
2292
|
var COLS_CLASS = {
|
|
2293
|
-
compact: "grid-cols-1",
|
|
2293
|
+
compact: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",
|
|
2294
2294
|
relaxed: "grid-cols-1 sm:grid-cols-2",
|
|
2295
|
-
comfy: "grid-cols-1
|
|
2295
|
+
comfy: "grid-cols-1"
|
|
2296
|
+
};
|
|
2297
|
+
var CARD_CLASS = {
|
|
2298
|
+
compact: "gap-0.5 p-2.5",
|
|
2299
|
+
relaxed: "gap-1 p-3",
|
|
2300
|
+
comfy: "gap-1.5 p-4"
|
|
2296
2301
|
};
|
|
2297
2302
|
var DENSITY_ICON = {
|
|
2298
|
-
compact: /* @__PURE__ */ jsx(
|
|
2303
|
+
compact: /* @__PURE__ */ jsx(LayoutGridIcon, { className: "size-3.5" }),
|
|
2299
2304
|
relaxed: /* @__PURE__ */ jsx(Rows3Icon, { className: "size-3.5" }),
|
|
2300
|
-
comfy: /* @__PURE__ */ jsx(
|
|
2305
|
+
comfy: /* @__PURE__ */ jsx(ListIcon, { className: "size-3.5" })
|
|
2301
2306
|
};
|
|
2302
2307
|
function DataTableViewSheet({
|
|
2303
2308
|
table,
|
|
@@ -2370,10 +2375,13 @@ function DataTableViewSheet({
|
|
|
2370
2375
|
return /* @__PURE__ */ jsxs(
|
|
2371
2376
|
"div",
|
|
2372
2377
|
{
|
|
2373
|
-
className:
|
|
2378
|
+
className: cn(
|
|
2379
|
+
"flex min-w-0 flex-col rounded-md border bg-card",
|
|
2380
|
+
CARD_CLASS[density]
|
|
2381
|
+
),
|
|
2374
2382
|
children: [
|
|
2375
2383
|
/* @__PURE__ */ jsx("span", { className: "text-[11px] uppercase tracking-wide text-muted-foreground", children: headerLabel }),
|
|
2376
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm text-foreground
|
|
2384
|
+
/* @__PURE__ */ jsx("span", { className: "break-words text-sm text-foreground", children: rendered })
|
|
2377
2385
|
]
|
|
2378
2386
|
},
|
|
2379
2387
|
colId
|
|
@@ -2398,11 +2406,15 @@ function AlertDialogContent({
|
|
|
2398
2406
|
...props
|
|
2399
2407
|
}) {
|
|
2400
2408
|
const container = usePortalContainer();
|
|
2409
|
+
const positionClass = container ? "absolute" : "fixed";
|
|
2401
2410
|
return /* @__PURE__ */ jsxs(AlertDialog$1.Portal, { container: container ?? void 0, children: [
|
|
2402
2411
|
/* @__PURE__ */ jsx(
|
|
2403
2412
|
AlertDialog$1.Overlay,
|
|
2404
2413
|
{
|
|
2405
|
-
className:
|
|
2414
|
+
className: cn(
|
|
2415
|
+
"inset-0 z-50 bg-foreground/30 backdrop-blur-sm data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",
|
|
2416
|
+
positionClass
|
|
2417
|
+
)
|
|
2406
2418
|
}
|
|
2407
2419
|
),
|
|
2408
2420
|
/* @__PURE__ */ jsx(
|
|
@@ -2410,7 +2422,8 @@ function AlertDialogContent({
|
|
|
2410
2422
|
{
|
|
2411
2423
|
"data-slot": "alert-dialog-content",
|
|
2412
2424
|
className: cn(
|
|
2413
|
-
"
|
|
2425
|
+
"top-1/2 left-1/2 z-50 grid w-[calc(100%-2rem)] max-w-md -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border bg-background p-6 shadow-lg outline-none data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
|
|
2426
|
+
positionClass,
|
|
2414
2427
|
className
|
|
2415
2428
|
),
|
|
2416
2429
|
...props,
|
|
@@ -2629,6 +2642,7 @@ function ActionsCellHost({ row }) {
|
|
|
2629
2642
|
onView?.(row.original);
|
|
2630
2643
|
} else if (a === "delete") {
|
|
2631
2644
|
onRequestDelete?.(row.original);
|
|
2645
|
+
return;
|
|
2632
2646
|
}
|
|
2633
2647
|
onRowAction?.(a, row.original);
|
|
2634
2648
|
}
|