@siyahi/ui 0.0.0-stage → 0.1.0-next.4
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 +174 -2
- package/THIRD_PARTY_NOTICES.md +51 -0
- package/dist/components/registry/dashboard-01/section-cards.d.ts +17 -0
- package/dist/components/registry/dashboard-01/section-cards.js +39 -0
- package/dist/components/registry/dashboardcn/bar-list.d.ts +24 -0
- package/dist/components/registry/dashboardcn/bar-list.js +71 -0
- package/dist/components/registry/heatmap/calendar-heatmap.d.ts +134 -0
- package/dist/components/registry/heatmap/calendar-heatmap.js +497 -0
- package/dist/components/registry/heatmap/status-heatmap.d.ts +120 -0
- package/dist/components/registry/heatmap/status-heatmap.js +330 -0
- package/dist/components/registry/heatmap/weekday-heatmap.d.ts +145 -0
- package/dist/components/registry/heatmap/weekday-heatmap.js +489 -0
- package/dist/components/registry/niko-table/components/data-table-column-actions.d.ts +26 -0
- package/dist/components/registry/niko-table/components/data-table-column-actions.js +32 -0
- package/dist/components/registry/niko-table/components/data-table-column-filter.d.ts +13 -0
- package/dist/components/registry/niko-table/components/data-table-column-filter.js +17 -0
- package/dist/components/registry/niko-table/components/data-table-column-header.d.ts +30 -0
- package/dist/components/registry/niko-table/components/data-table-column-header.js +35 -0
- package/dist/components/registry/niko-table/components/data-table-column-sort.d.ts +21 -0
- package/dist/components/registry/niko-table/components/data-table-column-sort.js +36 -0
- package/dist/components/registry/niko-table/components/data-table-column-title.d.ts +12 -0
- package/dist/components/registry/niko-table/components/data-table-column-title.js +18 -0
- package/dist/components/registry/niko-table/components/data-table-empty-state.d.ts +108 -0
- package/dist/components/registry/niko-table/components/data-table-empty-state.js +148 -0
- package/dist/components/registry/niko-table/components/data-table-faceted-filter.d.ts +46 -0
- package/dist/components/registry/niko-table/components/data-table-faceted-filter.js +133 -0
- package/dist/components/registry/niko-table/components/data-table-grouped-rows.d.ts +111 -0
- package/dist/components/registry/niko-table/components/data-table-grouped-rows.js +77 -0
- package/dist/components/registry/niko-table/components/data-table-row-context-menu-slot.d.ts +65 -0
- package/dist/components/registry/niko-table/components/data-table-row-context-menu-slot.js +65 -0
- package/dist/components/registry/niko-table/components/data-table-row-context-menu.d.ts +50 -0
- package/dist/components/registry/niko-table/components/data-table-row-context-menu.js +42 -0
- package/dist/components/registry/niko-table/components/data-table-row-menu.d.ts +51 -0
- package/dist/components/registry/niko-table/components/data-table-row-menu.js +65 -0
- package/dist/components/registry/niko-table/components/data-table-toolbar-section.d.ts +7 -0
- package/dist/components/registry/niko-table/components/data-table-toolbar-section.js +63 -0
- package/dist/components/registry/niko-table/config/data-table.d.ts +156 -0
- package/dist/components/registry/niko-table/config/data-table.js +279 -0
- package/dist/components/registry/niko-table/config/feature-detection.d.ts +39 -0
- package/dist/components/registry/niko-table/config/feature-detection.js +174 -0
- package/dist/components/registry/niko-table/core/data-table-context.d.ts +157 -0
- package/dist/components/registry/niko-table/core/data-table-context.js +326 -0
- package/dist/components/registry/niko-table/core/data-table-error-boundary.d.ts +85 -0
- package/dist/components/registry/niko-table/core/data-table-error-boundary.js +116 -0
- package/dist/components/registry/niko-table/core/data-table-grouped-row.d.ts +49 -0
- package/dist/components/registry/niko-table/core/data-table-grouped-row.js +112 -0
- package/dist/components/registry/niko-table/core/data-table-root.d.ts +62 -0
- package/dist/components/registry/niko-table/core/data-table-root.js +406 -0
- package/dist/components/registry/niko-table/core/data-table-structure.d.ts +153 -0
- package/dist/components/registry/niko-table/core/data-table-structure.js +370 -0
- package/dist/components/registry/niko-table/core/data-table.d.ts +30 -0
- package/dist/components/registry/niko-table/core/data-table.js +126 -0
- package/dist/components/registry/niko-table/filters/table-column-actions.d.ts +49 -0
- package/dist/components/registry/niko-table/filters/table-column-actions.js +48 -0
- package/dist/components/registry/niko-table/filters/table-column-sort.d.ts +51 -0
- package/dist/components/registry/niko-table/filters/table-column-sort.js +184 -0
- package/dist/components/registry/niko-table/filters/table-column-title.d.ts +17 -0
- package/dist/components/registry/niko-table/filters/table-column-title.js +20 -0
- package/dist/components/registry/niko-table/filters/table-faceted-filter.d.ts +40 -0
- package/dist/components/registry/niko-table/filters/table-faceted-filter.js +210 -0
- package/dist/components/registry/niko-table/hooks/use-derived-column-title.d.ts +29 -0
- package/dist/components/registry/niko-table/hooks/use-derived-column-title.js +40 -0
- package/dist/components/registry/niko-table/hooks/use-generated-options.d.ts +49 -0
- package/dist/components/registry/niko-table/hooks/use-generated-options.js +144 -0
- package/dist/components/registry/niko-table/lib/build-faceted-options.d.ts +59 -0
- package/dist/components/registry/niko-table/lib/build-faceted-options.js +82 -0
- package/dist/components/registry/niko-table/lib/column-resize-handle.d.ts +33 -0
- package/dist/components/registry/niko-table/lib/column-resize-handle.js +175 -0
- package/dist/components/registry/niko-table/lib/constants.d.ts +128 -0
- package/dist/components/registry/niko-table/lib/constants.js +123 -0
- package/dist/components/registry/niko-table/lib/create-scroll-handler.d.ts +35 -0
- package/dist/components/registry/niko-table/lib/create-scroll-handler.js +63 -0
- package/dist/components/registry/niko-table/lib/data-table-features.d.ts +218 -0
- package/dist/components/registry/niko-table/lib/data-table-features.js +127 -0
- package/dist/components/registry/niko-table/lib/filter-functions.d.ts +47 -0
- package/dist/components/registry/niko-table/lib/filter-functions.js +309 -0
- package/dist/components/registry/niko-table/lib/filter-rows.d.ts +14 -0
- package/dist/components/registry/niko-table/lib/filter-rows.js +28 -0
- package/dist/components/registry/niko-table/lib/flex-columns.d.ts +48 -0
- package/dist/components/registry/niko-table/lib/flex-columns.js +65 -0
- package/dist/components/registry/niko-table/lib/format.d.ts +33 -0
- package/dist/components/registry/niko-table/lib/format.js +99 -0
- package/dist/components/registry/niko-table/lib/render-cell-content.d.ts +17 -0
- package/dist/components/registry/niko-table/lib/render-cell-content.js +65 -0
- package/dist/components/registry/niko-table/lib/row-click.d.ts +67 -0
- package/dist/components/registry/niko-table/lib/row-click.js +28 -0
- package/dist/components/registry/niko-table/lib/styles.d.ts +6 -0
- package/dist/components/registry/niko-table/lib/styles.js +24 -0
- package/dist/components/registry/niko-table/lib/use-header-min-widths.d.ts +17 -0
- package/dist/components/registry/niko-table/lib/use-header-min-widths.js +82 -0
- package/dist/components/registry/niko-table/types/index.d.ts +141 -0
- package/dist/components/registry/niko-table/types/index.js +2 -0
- package/dist/components/registry/niko-table/ui/table.d.ts +13 -0
- package/dist/components/registry/niko-table/ui/table.js +74 -0
- package/dist/components/registry/sidebar-07/app-sidebar.d.ts +18 -0
- package/dist/components/registry/sidebar-07/app-sidebar.js +26 -0
- package/dist/components/registry/sidebar-07/nav-main.d.ts +15 -0
- package/dist/components/registry/sidebar-07/nav-main.js +25 -0
- package/dist/components/registry/sidebar-07/nav-projects.d.ts +9 -0
- package/dist/components/registry/sidebar-07/nav-projects.js +43 -0
- package/dist/components/registry/sidebar-07/nav-user.d.ts +9 -0
- package/dist/components/registry/sidebar-07/nav-user.js +70 -0
- package/dist/components/registry/sidebar-07/team-switcher.d.ts +10 -0
- package/dist/components/registry/sidebar-07/team-switcher.js +70 -0
- package/dist/components/siyahi/delta.d.ts +10 -0
- package/dist/components/siyahi/delta.js +27 -0
- package/dist/components/siyahi/local-time.d.ts +7 -0
- package/dist/components/siyahi/local-time.js +22 -0
- package/dist/components/siyahi/price-chart.d.ts +12 -0
- package/dist/components/siyahi/price-chart.js +80 -0
- package/dist/components/siyahi/siyahi-provider.d.ts +12 -0
- package/dist/components/siyahi/siyahi-provider.js +31 -0
- package/dist/components/siyahi/treemap.d.ts +14 -0
- package/dist/components/siyahi/treemap.js +58 -0
- package/dist/components/ui/alert.d.ts +12 -0
- package/dist/components/ui/alert.js +43 -0
- package/dist/components/ui/avatar.d.ts +13 -0
- package/dist/components/ui/avatar.js +50 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/badge.js +29 -0
- package/dist/components/ui/breadcrumb.d.ts +12 -0
- package/dist/components/ui/breadcrumb.js +72 -0
- package/dist/components/ui/button.d.ts +10 -0
- package/dist/components/ui/button.js +44 -0
- package/dist/components/ui/calendar.d.ts +12 -0
- package/dist/components/ui/calendar.js +107 -0
- package/dist/components/ui/card.d.ts +13 -0
- package/dist/components/ui/card.js +56 -0
- package/dist/components/ui/chart.d.ts +46 -0
- package/dist/components/ui/chart.js +149 -0
- package/dist/components/ui/collapsible.d.ts +7 -0
- package/dist/components/ui/collapsible.js +24 -0
- package/dist/components/ui/command.d.ts +21 -0
- package/dist/components/ui/command.js +88 -0
- package/dist/components/ui/context-menu.d.ts +31 -0
- package/dist/components/ui/context-menu.js +132 -0
- package/dist/components/ui/dialog.d.ts +19 -0
- package/dist/components/ui/dialog.js +91 -0
- package/dist/components/ui/dropdown-menu.d.ts +31 -0
- package/dist/components/ui/dropdown-menu.js +136 -0
- package/dist/components/ui/input-group.d.ts +20 -0
- package/dist/components/ui/input-group.js +79 -0
- package/dist/components/ui/input.d.ts +5 -0
- package/dist/components/ui/input.js +15 -0
- package/dist/components/ui/popover.d.ts +11 -0
- package/dist/components/ui/popover.js +55 -0
- package/dist/components/ui/progress.d.ts +9 -0
- package/dist/components/ui/progress.js +43 -0
- package/dist/components/ui/scroll-area.d.ts +7 -0
- package/dist/components/ui/scroll-area.js +36 -0
- package/dist/components/ui/select.d.ts +17 -0
- package/dist/components/ui/select.js +97 -0
- package/dist/components/ui/separator.d.ts +5 -0
- package/dist/components/ui/separator.js +15 -0
- package/dist/components/ui/sheet.d.ts +16 -0
- package/dist/components/ui/sheet.js +89 -0
- package/dist/components/ui/sidebar.d.ts +65 -0
- package/dist/components/ui/sidebar.js +385 -0
- package/dist/components/ui/skeleton.d.ts +4 -0
- package/dist/components/ui/skeleton.js +12 -0
- package/dist/components/ui/slider.d.ts +5 -0
- package/dist/components/ui/slider.js +33 -0
- package/dist/components/ui/table.d.ts +12 -0
- package/dist/components/ui/table.js +66 -0
- package/dist/components/ui/tabs.d.ts +12 -0
- package/dist/components/ui/tabs.js +45 -0
- package/dist/components/ui/textarea.d.ts +5 -0
- package/dist/components/ui/textarea.js +13 -0
- package/dist/components/ui/toggle-group.d.ts +13 -0
- package/dist/components/ui/toggle-group.js +52 -0
- package/dist/components/ui/toggle.d.ts +10 -0
- package/dist/components/ui/toggle.js +36 -0
- package/dist/components/ui/tooltip.d.ts +8 -0
- package/dist/components/ui/tooltip.js +41 -0
- package/dist/hooks/use-mobile.d.ts +3 -0
- package/dist/hooks/use-mobile.js +18 -0
- package/dist/index.d.ts +73 -0
- package/dist/index.js +71 -0
- package/dist/lib/format.d.ts +24 -0
- package/dist/lib/format.js +58 -0
- package/dist/lib/locale.d.ts +12 -0
- package/dist/lib/locale.js +8 -0
- package/dist/lib/recharts.d.ts +2 -0
- package/dist/lib/recharts.js +1 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +1 -0
- package/package.json +78 -3
- package/registry.lock.json +413 -0
- package/report.css +129 -0
- package/styles/shadcn.css +643 -0
- package/styles/siyahi.css +189 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/registry/niko-table/components/data-table-grouped-rows.tsx
|
|
5
|
+
const DataTableGroupRowContext = React.createContext(null);
|
|
6
|
+
/** Provider — used by the body, not by callers. */
|
|
7
|
+
function DataTableGroupRowProvider({ value, children }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(DataTableGroupRowContext.Provider, {
|
|
9
|
+
value,
|
|
10
|
+
children
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Read the group row a custom `<DataTableGroupedRows>` child is rendering for.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* function RegionGroupRow() {
|
|
18
|
+
* const { groupLabel, count, isExpanded, toggle } = useDataTableGroupRow()
|
|
19
|
+
* return (
|
|
20
|
+
* <TableCell colSpan={4} onClick={toggle}>
|
|
21
|
+
* {groupLabel} — {count} in region {isExpanded ? "▾" : "▸"}
|
|
22
|
+
* </TableCell>
|
|
23
|
+
* )
|
|
24
|
+
* }
|
|
25
|
+
*/
|
|
26
|
+
function useDataTableGroupRow() {
|
|
27
|
+
const ctx = React.useContext(DataTableGroupRowContext);
|
|
28
|
+
if (!ctx) throw new Error("useDataTableGroupRow must be used inside <DataTableGroupedRows>. Nest your group-row component as its child.");
|
|
29
|
+
return ctx;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Declarative, composable group rows for niko-table bodies.
|
|
33
|
+
*
|
|
34
|
+
* Nest it inside a `DataTableBody` so grouping reads as part of the table's
|
|
35
|
+
* JSX tree. It renders nothing itself — its presence is what turns grouping
|
|
36
|
+
* on (feature detection maps it to `enableGrouping` + `enableExpanding`), and
|
|
37
|
+
* the body renders a group row wherever TanStack's grouped row model produces
|
|
38
|
+
* one.
|
|
39
|
+
*
|
|
40
|
+
* This is the whole opt-in. There is no `enableGrouping` config flag to set
|
|
41
|
+
* and no renderer to wire up: compose the component, or don't.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* // Built-in group row
|
|
45
|
+
* <DataTableBody>
|
|
46
|
+
* <DataTableGroupedRows />
|
|
47
|
+
* </DataTableBody>
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* // Your own, reading the group from context
|
|
51
|
+
* <DataTableBody>
|
|
52
|
+
* <DataTableGroupedRows>
|
|
53
|
+
* <RegionGroupRow />
|
|
54
|
+
* </DataTableGroupedRows>
|
|
55
|
+
* </DataTableBody>
|
|
56
|
+
*/
|
|
57
|
+
function DataTableGroupedRows(_props) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
DataTableGroupedRows.displayName = "DataTableGroupedRows";
|
|
61
|
+
/**
|
|
62
|
+
* Body-side: find a nested `<DataTableGroupedRows>` among `children`.
|
|
63
|
+
*
|
|
64
|
+
* Matches on `displayName` as well as reference, because re-exports and HMR
|
|
65
|
+
* both break reference equality.
|
|
66
|
+
*/
|
|
67
|
+
function resolveGroupedRowsSlot(children) {
|
|
68
|
+
let found;
|
|
69
|
+
React.Children.forEach(children, (child) => {
|
|
70
|
+
if (!React.isValidElement(child)) return;
|
|
71
|
+
const type = child.type;
|
|
72
|
+
if (child.type === DataTableGroupedRows || type.displayName === "DataTableGroupedRows") found = child.props;
|
|
73
|
+
});
|
|
74
|
+
return found;
|
|
75
|
+
}
|
|
76
|
+
//#endregion
|
|
77
|
+
export { DataTableGroupRowProvider, DataTableGroupedRows, resolveGroupedRowsSlot, useDataTableGroupRow };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import { RowData } from "@tanstack/react-table";
|
|
3
|
+
//#region src/components/registry/niko-table/components/data-table-row-context-menu-slot.d.ts
|
|
4
|
+
export interface DataTableRowContextMenuSlotProps<TData extends RowData> {
|
|
5
|
+
/**
|
|
6
|
+
* The row menu. Preferred (shadcn/composable) form is a declarative
|
|
7
|
+
* component that reads the row via `useDataTableRow()`:
|
|
8
|
+
*
|
|
9
|
+
* <DataTableRowContextMenuSlot>
|
|
10
|
+
* <TeamRowMenu onEdit={…} onDelete={…} />
|
|
11
|
+
* </DataTableRowContextMenuSlot>
|
|
12
|
+
*
|
|
13
|
+
* A `(row) => menu` function is also accepted for cases that would rather
|
|
14
|
+
* close over the row explicitly.
|
|
15
|
+
*/
|
|
16
|
+
children: React$1.ReactNode | ((row: TData) => React$1.ReactNode);
|
|
17
|
+
/**
|
|
18
|
+
* Optional per-row predicate — return `false` to give a specific row no
|
|
19
|
+
* menu (e.g. locked/browse-only rows). Table-level gating (e.g. "no manage
|
|
20
|
+
* permission") is better done by simply not rendering the slot at all.
|
|
21
|
+
*/
|
|
22
|
+
enabledFor?: (row: TData) => boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Declarative, composable row context menu for niko-table bodies.
|
|
26
|
+
*
|
|
27
|
+
* Nest it inside a `DataTableBody` / `DataTableVirtualizedBody` — or any of
|
|
28
|
+
* the four DnD bodies (`DataTableDndBody`, `DataTableDndColumnBody`,
|
|
29
|
+
* `DataTableVirtualizedDndBody`, `DataTableVirtualizedDndColumnBody`) — so
|
|
30
|
+
* the per-row menu reads as part of the table's JSX tree. It renders nothing
|
|
31
|
+
* itself — the body detects it among its children and renders its menu for
|
|
32
|
+
* every (enabled) row inside a `DataTableRowMenuScope`, so a declarative
|
|
33
|
+
* `<XRowMenu>` composed from `RowMenuItem` / `RowMenuSub` / … resolves the
|
|
34
|
+
* row and surface from context. The body's `renderRowContextMenu` prop still
|
|
35
|
+
* works and wins when both are present.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* <DataTableVirtualizedBody estimateSize={44}>
|
|
39
|
+
* <DataTableRowContextMenuSlot enabledFor={(m) => !m.isLocked}>
|
|
40
|
+
* <PoolRowMenu onOffer={…} onDirectAssign={…} />
|
|
41
|
+
* </DataTableRowContextMenuSlot>
|
|
42
|
+
* <DataTableVirtualizedSkeleton rows={8} />
|
|
43
|
+
* </DataTableVirtualizedBody>
|
|
44
|
+
*/
|
|
45
|
+
export declare function DataTableRowContextMenuSlot<TData extends RowData>(_props: DataTableRowContextMenuSlotProps<TData>): null;
|
|
46
|
+
export declare namespace DataTableRowContextMenuSlot {
|
|
47
|
+
var displayName: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Resolve the effective per-row menu renderer for a body: the explicit
|
|
51
|
+
* `renderRowContextMenu` prop wins; otherwise a nested
|
|
52
|
+
* `<DataTableRowContextMenuSlot>` child (declarative node or function),
|
|
53
|
+
* honouring its optional `enabledFor` predicate.
|
|
54
|
+
*/
|
|
55
|
+
export declare function resolveRowContextMenuRenderer<TData extends RowData>(prop: ((row: TData) => React$1.ReactNode) | undefined, children: React$1.ReactNode): ((row: TData) => React$1.ReactNode) | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Body-side hook: resolve the per-row menu renderer and return a **stable**
|
|
58
|
+
* callback identity, so memoized rows (`BodyRow`) don't re-render just because
|
|
59
|
+
* the body re-rendered. `resolveRowContextMenuRenderer` returns a fresh
|
|
60
|
+
* function each render (it closes over `children`); we keep the latest in a ref
|
|
61
|
+
* and hand out a stable wrapper that reads it. The wrapper identity only
|
|
62
|
+
* changes when the presence of a menu changes.
|
|
63
|
+
*/
|
|
64
|
+
export declare function useResolvedRowContextMenuRenderer<TData extends RowData>(prop: ((row: TData) => React$1.ReactNode) | undefined, children: React$1.ReactNode): ((row: TData) => React$1.ReactNode) | undefined;
|
|
65
|
+
//#endregion
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
//#region src/components/registry/niko-table/components/data-table-row-context-menu-slot.tsx
|
|
3
|
+
/**
|
|
4
|
+
* Declarative, composable row context menu for niko-table bodies.
|
|
5
|
+
*
|
|
6
|
+
* Nest it inside a `DataTableBody` / `DataTableVirtualizedBody` — or any of
|
|
7
|
+
* the four DnD bodies (`DataTableDndBody`, `DataTableDndColumnBody`,
|
|
8
|
+
* `DataTableVirtualizedDndBody`, `DataTableVirtualizedDndColumnBody`) — so
|
|
9
|
+
* the per-row menu reads as part of the table's JSX tree. It renders nothing
|
|
10
|
+
* itself — the body detects it among its children and renders its menu for
|
|
11
|
+
* every (enabled) row inside a `DataTableRowMenuScope`, so a declarative
|
|
12
|
+
* `<XRowMenu>` composed from `RowMenuItem` / `RowMenuSub` / … resolves the
|
|
13
|
+
* row and surface from context. The body's `renderRowContextMenu` prop still
|
|
14
|
+
* works and wins when both are present.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* <DataTableVirtualizedBody estimateSize={44}>
|
|
18
|
+
* <DataTableRowContextMenuSlot enabledFor={(m) => !m.isLocked}>
|
|
19
|
+
* <PoolRowMenu onOffer={…} onDirectAssign={…} />
|
|
20
|
+
* </DataTableRowContextMenuSlot>
|
|
21
|
+
* <DataTableVirtualizedSkeleton rows={8} />
|
|
22
|
+
* </DataTableVirtualizedBody>
|
|
23
|
+
*/
|
|
24
|
+
function DataTableRowContextMenuSlot(_props) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
DataTableRowContextMenuSlot.displayName = "DataTableRowContextMenuSlot";
|
|
28
|
+
/**
|
|
29
|
+
* Resolve the effective per-row menu renderer for a body: the explicit
|
|
30
|
+
* `renderRowContextMenu` prop wins; otherwise a nested
|
|
31
|
+
* `<DataTableRowContextMenuSlot>` child (declarative node or function),
|
|
32
|
+
* honouring its optional `enabledFor` predicate.
|
|
33
|
+
*/
|
|
34
|
+
function resolveRowContextMenuRenderer(prop, children) {
|
|
35
|
+
if (prop) return prop;
|
|
36
|
+
let slotProps;
|
|
37
|
+
React$1.Children.forEach(children, (child) => {
|
|
38
|
+
if (!React$1.isValidElement(child)) return;
|
|
39
|
+
const type = child.type;
|
|
40
|
+
if (child.type === DataTableRowContextMenuSlot || type.displayName === "DataTableRowContextMenuSlot") slotProps = child.props;
|
|
41
|
+
});
|
|
42
|
+
if (!slotProps) return void 0;
|
|
43
|
+
const { children: menu, enabledFor } = slotProps;
|
|
44
|
+
return (row) => {
|
|
45
|
+
if (enabledFor && !enabledFor(row)) return null;
|
|
46
|
+
return typeof menu === "function" ? menu(row) : menu;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Body-side hook: resolve the per-row menu renderer and return a **stable**
|
|
51
|
+
* callback identity, so memoized rows (`BodyRow`) don't re-render just because
|
|
52
|
+
* the body re-rendered. `resolveRowContextMenuRenderer` returns a fresh
|
|
53
|
+
* function each render (it closes over `children`); we keep the latest in a ref
|
|
54
|
+
* and hand out a stable wrapper that reads it. The wrapper identity only
|
|
55
|
+
* changes when the presence of a menu changes.
|
|
56
|
+
*/
|
|
57
|
+
function useResolvedRowContextMenuRenderer(prop, children) {
|
|
58
|
+
const resolved = resolveRowContextMenuRenderer(prop, children);
|
|
59
|
+
const latestRef = React$1.useRef(resolved);
|
|
60
|
+
latestRef.current = resolved;
|
|
61
|
+
const hasMenu = !!resolved;
|
|
62
|
+
return React$1.useMemo(() => hasMenu ? (row) => latestRef.current?.(row) : void 0, [hasMenu]);
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { DataTableRowContextMenuSlot, resolveRowContextMenuRenderer, useResolvedRowContextMenuRenderer };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
//#region src/components/registry/niko-table/components/data-table-row-context-menu.d.ts
|
|
3
|
+
export interface DataTableRowContextMenuProps {
|
|
4
|
+
/**
|
|
5
|
+
* The row's `original` data. Provided to the menu children via
|
|
6
|
+
* `DataTableRowMenuScope` so a declarative `<XRowMenu>` can read it with
|
|
7
|
+
* `useDataTableRow()` and render the same items as the kebab dropdown.
|
|
8
|
+
*/
|
|
9
|
+
row: unknown;
|
|
10
|
+
/**
|
|
11
|
+
* The `<TableRow>` element the menu anchors to. Radix's `asChild` merges
|
|
12
|
+
* the right-click listener onto this element (via Slot), so no wrapper
|
|
13
|
+
* node is introduced and table markup (`<tbody> > <tr>`) stays valid.
|
|
14
|
+
*/
|
|
15
|
+
trigger: React$1.ReactElement;
|
|
16
|
+
/**
|
|
17
|
+
* The menu items to show on right-click — compose `ContextMenuItem`,
|
|
18
|
+
* `ContextMenuSeparator`, `ContextMenuSub`, etc. The portal + surface
|
|
19
|
+
* chrome is owned here so callers only supply the actions.
|
|
20
|
+
*
|
|
21
|
+
* Tip: reuse the same items your row's "…" actions column renders so
|
|
22
|
+
* right-click and the kebab menu stay in sync (write once).
|
|
23
|
+
*/
|
|
24
|
+
children: React$1.ReactNode;
|
|
25
|
+
/** Extra className for the popup surface. */
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Attaches a right-click context menu to a single data-table row.
|
|
30
|
+
*
|
|
31
|
+
* Low-level primitive used internally by the bodies (and directly by card
|
|
32
|
+
* views): pass the row's data as `row`, the row's `<TableRow>` element as
|
|
33
|
+
* `trigger`, and the menu as `children`. Children are wrapped in a
|
|
34
|
+
* `DataTableRowMenuScope surface="context"`, so a declarative `<XRowMenu>`
|
|
35
|
+
* built from `RowMenuItem`/… (see `data-table-row-menu`) works here — as do
|
|
36
|
+
* raw `ContextMenuItem`s. The popup is portalled and only mounts on open.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* <DataTableRowContextMenu
|
|
40
|
+
* row={row.original}
|
|
41
|
+
* trigger={<TableRow data-row-id={row.id}>{cells}</TableRow>}
|
|
42
|
+
* >
|
|
43
|
+
* <PlayerRowMenu onView={view} onRemove={remove} />
|
|
44
|
+
* </DataTableRowContextMenu>
|
|
45
|
+
*/
|
|
46
|
+
export declare function DataTableRowContextMenu({ row, trigger, children, className }: DataTableRowContextMenuProps): React$1.JSX.Element;
|
|
47
|
+
export declare namespace DataTableRowContextMenu {
|
|
48
|
+
var displayName: string;
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ContextMenu, ContextMenuContent, ContextMenuTrigger } from "../../../ui/context-menu.js";
|
|
3
|
+
import { DataTableRowMenuScope } from "./data-table-row-menu.js";
|
|
4
|
+
import * as React$1 from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/registry/niko-table/components/data-table-row-context-menu.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Attaches a right-click context menu to a single data-table row.
|
|
9
|
+
*
|
|
10
|
+
* Low-level primitive used internally by the bodies (and directly by card
|
|
11
|
+
* views): pass the row's data as `row`, the row's `<TableRow>` element as
|
|
12
|
+
* `trigger`, and the menu as `children`. Children are wrapped in a
|
|
13
|
+
* `DataTableRowMenuScope surface="context"`, so a declarative `<XRowMenu>`
|
|
14
|
+
* built from `RowMenuItem`/… (see `data-table-row-menu`) works here — as do
|
|
15
|
+
* raw `ContextMenuItem`s. The popup is portalled and only mounts on open.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* <DataTableRowContextMenu
|
|
19
|
+
* row={row.original}
|
|
20
|
+
* trigger={<TableRow data-row-id={row.id}>{cells}</TableRow>}
|
|
21
|
+
* >
|
|
22
|
+
* <PlayerRowMenu onView={view} onRemove={remove} />
|
|
23
|
+
* </DataTableRowContextMenu>
|
|
24
|
+
*/
|
|
25
|
+
function DataTableRowContextMenu({ row, trigger, children, className }) {
|
|
26
|
+
const [open, setOpen] = React$1.useState(false);
|
|
27
|
+
const anchoredTrigger = open ? React$1.cloneElement(trigger, { "data-context-menu-open": "" }) : trigger;
|
|
28
|
+
return /* @__PURE__ */ jsxs(ContextMenu, {
|
|
29
|
+
onOpenChange: setOpen,
|
|
30
|
+
children: [/* @__PURE__ */ jsx(ContextMenuTrigger, { render: anchoredTrigger }), /* @__PURE__ */ jsx(ContextMenuContent, {
|
|
31
|
+
className,
|
|
32
|
+
children: /* @__PURE__ */ jsx(DataTableRowMenuScope, {
|
|
33
|
+
row,
|
|
34
|
+
surface: "context",
|
|
35
|
+
children
|
|
36
|
+
})
|
|
37
|
+
})]
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
DataTableRowContextMenu.displayName = "DataTableRowContextMenu";
|
|
41
|
+
//#endregion
|
|
42
|
+
export { DataTableRowContextMenu };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger } from "../../../ui/dropdown-menu.js";
|
|
2
|
+
import * as React$1 from "react";
|
|
3
|
+
//#region src/components/registry/niko-table/components/data-table-row-menu.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Composable row menu for niko-table — the shadcn-style, write-once way to give
|
|
6
|
+
* a table's "…" dropdown and its right-click context menu the *same* actions.
|
|
7
|
+
*
|
|
8
|
+
* Define the actions ONCE as a component using the polymorphic `RowMenuItem` /
|
|
9
|
+
* `RowMenuSeparator` / `RowMenuSub` … pieces and `useDataTableRow()`:
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* function TeamRowMenu({ onEdit, onDelete }: TeamRowMenuProps) {
|
|
13
|
+
* const team = useDataTableRow<TeamRow>()
|
|
14
|
+
* return (
|
|
15
|
+
* <>
|
|
16
|
+
* <RowMenuItem onClick={() => onEdit(team)}>Edit</RowMenuItem>
|
|
17
|
+
* <RowMenuSeparator />
|
|
18
|
+
* <RowMenuItem variant="destructive" onClick={() => onDelete(team.id)}>
|
|
19
|
+
* Delete
|
|
20
|
+
* </RowMenuItem>
|
|
21
|
+
* </>
|
|
22
|
+
* )
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* Then drop `<TeamRowMenu … />` into the kebab cell (inside a
|
|
26
|
+
* `DataTableRowMenuScope surface="dropdown"`) and into the body's
|
|
27
|
+
* `<DataTableRowContextMenuSlot>` — the same component renders as a dropdown
|
|
28
|
+
* menu or a context menu depending on the surface it finds in context.
|
|
29
|
+
*/
|
|
30
|
+
type RowMenuSurface = "dropdown" | "context";
|
|
31
|
+
/**
|
|
32
|
+
* Provides the current row and the menu surface to the row-menu pieces nested
|
|
33
|
+
* inside. The context-menu body sets this up automatically; kebab cells wrap
|
|
34
|
+
* their `DropdownMenuContent` children with `surface="dropdown"`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function DataTableRowMenuScope({ row, surface, children }: {
|
|
37
|
+
row: unknown;
|
|
38
|
+
surface: RowMenuSurface;
|
|
39
|
+
children: React$1.ReactNode;
|
|
40
|
+
}): React$1.JSX.Element;
|
|
41
|
+
/** Read the row a row-menu is rendering for. Throws outside a scope. */
|
|
42
|
+
export declare function useDataTableRow<TData>(): TData;
|
|
43
|
+
export declare function RowMenuItem(props: React$1.ComponentProps<typeof DropdownMenuItem>): React$1.JSX.Element;
|
|
44
|
+
export declare function RowMenuSeparator(props: React$1.ComponentProps<typeof DropdownMenuSeparator>): React$1.JSX.Element;
|
|
45
|
+
export declare function RowMenuGroup(props: React$1.ComponentProps<typeof DropdownMenuGroup>): React$1.JSX.Element;
|
|
46
|
+
export declare function RowMenuLabel(props: React$1.ComponentProps<typeof DropdownMenuLabel>): React$1.JSX.Element;
|
|
47
|
+
export declare function RowMenuSub(props: React$1.ComponentProps<typeof DropdownMenuSub>): React$1.JSX.Element;
|
|
48
|
+
export declare function RowMenuSubTrigger(props: React$1.ComponentProps<typeof DropdownMenuSubTrigger>): React$1.JSX.Element;
|
|
49
|
+
export declare function RowMenuSubContent(props: React$1.ComponentProps<typeof DropdownMenuSubContent>): React$1.JSX.Element;
|
|
50
|
+
//#endregion
|
|
51
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ContextMenuGroup, ContextMenuItem, ContextMenuLabel, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger } from "../../../ui/context-menu.js";
|
|
3
|
+
import { DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger } from "../../../ui/dropdown-menu.js";
|
|
4
|
+
import * as React$1 from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region src/components/registry/niko-table/components/data-table-row-menu.tsx
|
|
7
|
+
const RowMenuSurfaceContext = React$1.createContext(null);
|
|
8
|
+
/** Sentinel so `useDataTableRow` can tell "no provider" from a row of `undefined`. */
|
|
9
|
+
const NO_ROW = Symbol("niko-table.no-row");
|
|
10
|
+
const DataTableRowValueContext = React$1.createContext(NO_ROW);
|
|
11
|
+
/**
|
|
12
|
+
* Provides the current row and the menu surface to the row-menu pieces nested
|
|
13
|
+
* inside. The context-menu body sets this up automatically; kebab cells wrap
|
|
14
|
+
* their `DropdownMenuContent` children with `surface="dropdown"`.
|
|
15
|
+
*/
|
|
16
|
+
function DataTableRowMenuScope({ row, surface, children }) {
|
|
17
|
+
return /* @__PURE__ */ jsx(RowMenuSurfaceContext.Provider, {
|
|
18
|
+
value: surface,
|
|
19
|
+
children: /* @__PURE__ */ jsx(DataTableRowValueContext.Provider, {
|
|
20
|
+
value: row,
|
|
21
|
+
children
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/** Read the row a row-menu is rendering for. Throws outside a scope. */
|
|
26
|
+
function useDataTableRow() {
|
|
27
|
+
const row = React$1.useContext(DataTableRowValueContext);
|
|
28
|
+
if (row === NO_ROW) throw new Error("useDataTableRow must be used inside a DataTableRowMenuScope — i.e. a table row context menu, or a kebab DropdownMenuContent wrapped with surface=\"dropdown\".");
|
|
29
|
+
return row;
|
|
30
|
+
}
|
|
31
|
+
function useRowMenuSurface() {
|
|
32
|
+
const surface = React$1.useContext(RowMenuSurfaceContext);
|
|
33
|
+
if (!surface) throw new Error("Row menu pieces (RowMenuItem, RowMenuSub, …) must be rendered inside a DataTableRowMenuScope — i.e. a table row context menu or a kebab DropdownMenuContent wrapped with surface=\"dropdown\".");
|
|
34
|
+
return surface;
|
|
35
|
+
}
|
|
36
|
+
function RowMenuItem(props) {
|
|
37
|
+
const Item = useRowMenuSurface() === "context" ? ContextMenuItem : DropdownMenuItem;
|
|
38
|
+
return /* @__PURE__ */ jsx(Item, { ...props });
|
|
39
|
+
}
|
|
40
|
+
function RowMenuSeparator(props) {
|
|
41
|
+
const Separator = useRowMenuSurface() === "context" ? ContextMenuSeparator : DropdownMenuSeparator;
|
|
42
|
+
return /* @__PURE__ */ jsx(Separator, { ...props });
|
|
43
|
+
}
|
|
44
|
+
function RowMenuGroup(props) {
|
|
45
|
+
const Group = useRowMenuSurface() === "context" ? ContextMenuGroup : DropdownMenuGroup;
|
|
46
|
+
return /* @__PURE__ */ jsx(Group, { ...props });
|
|
47
|
+
}
|
|
48
|
+
function RowMenuLabel(props) {
|
|
49
|
+
const Label = useRowMenuSurface() === "context" ? ContextMenuLabel : DropdownMenuLabel;
|
|
50
|
+
return /* @__PURE__ */ jsx(Label, { ...props });
|
|
51
|
+
}
|
|
52
|
+
function RowMenuSub(props) {
|
|
53
|
+
const Sub = useRowMenuSurface() === "context" ? ContextMenuSub : DropdownMenuSub;
|
|
54
|
+
return /* @__PURE__ */ jsx(Sub, { ...props });
|
|
55
|
+
}
|
|
56
|
+
function RowMenuSubTrigger(props) {
|
|
57
|
+
const SubTrigger = useRowMenuSurface() === "context" ? ContextMenuSubTrigger : DropdownMenuSubTrigger;
|
|
58
|
+
return /* @__PURE__ */ jsx(SubTrigger, { ...props });
|
|
59
|
+
}
|
|
60
|
+
function RowMenuSubContent(props) {
|
|
61
|
+
const SubContent = useRowMenuSurface() === "context" ? ContextMenuSubContent : DropdownMenuSubContent;
|
|
62
|
+
return /* @__PURE__ */ jsx(SubContent, { ...props });
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { DataTableRowMenuScope, RowMenuGroup, RowMenuItem, RowMenuLabel, RowMenuSeparator, RowMenuSub, RowMenuSubContent, RowMenuSubTrigger, useDataTableRow };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
//#region src/components/registry/niko-table/components/data-table-toolbar-section.d.ts
|
|
3
|
+
export interface DataTableToolbarSectionProps extends React.ComponentProps<"div"> {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export declare const DataTableToolbarSection: React.NamedExoticComponent<Omit<DataTableToolbarSectionProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
//#endregion
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../../lib/utils.js";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/registry/niko-table/components/data-table-toolbar-section.tsx
|
|
6
|
+
/**
|
|
7
|
+
* niko-table — created by Semir N. (Semkoo, https://github.com/Semkoo) with AI assistance.
|
|
8
|
+
*
|
|
9
|
+
* Before reporting anything: please check the changelog first.
|
|
10
|
+
* - In-repo: ./CHANGELOG.md
|
|
11
|
+
* - Docs site: https://niko-table.com/changelog
|
|
12
|
+
*
|
|
13
|
+
* Found a bug or have a fix? Open an issue or PR on GitHub so other
|
|
14
|
+
* users (and future LLMs reading this code) benefit:
|
|
15
|
+
* https://github.com/Semkoo/niko-table-registry
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* A simple, flexible toolbar container for composing table controls.
|
|
19
|
+
* Use this as a layout container and add your own search, filters, sorting, etc.
|
|
20
|
+
*
|
|
21
|
+
* @example - Basic toolbar with search and filters
|
|
22
|
+
* <DataTableToolbarSection>
|
|
23
|
+
* <DataTableSearchInput placeholder="Search..." />
|
|
24
|
+
* <DataTableFilterButton column="status" title="Status" />
|
|
25
|
+
* <DataTableSortMenu />
|
|
26
|
+
* </DataTableToolbarSection>
|
|
27
|
+
*
|
|
28
|
+
* @example - Custom layout with left and right sections
|
|
29
|
+
* <DataTableToolbarSection className="justify-between">
|
|
30
|
+
* <div className="flex gap-2">
|
|
31
|
+
* <DataTableSearchInput />
|
|
32
|
+
* <DataTableFilterButton column="status" />
|
|
33
|
+
* </div>
|
|
34
|
+
* <div className="flex gap-2">
|
|
35
|
+
* <DataTableSortMenu />
|
|
36
|
+
* <DataTableViewMenu />
|
|
37
|
+
* </div>
|
|
38
|
+
* </DataTableToolbarSection>
|
|
39
|
+
*
|
|
40
|
+
* @example - With custom elements
|
|
41
|
+
* <DataTableToolbarSection>
|
|
42
|
+
* <DataTableSearchInput />
|
|
43
|
+
* <span className="text-sm text-muted-foreground">
|
|
44
|
+
* {table.getFilteredRowModel().rows.length} results
|
|
45
|
+
* </span>
|
|
46
|
+
* <Button variant="outline">Export</Button>
|
|
47
|
+
* </DataTableToolbarSection>
|
|
48
|
+
*/
|
|
49
|
+
const DataTableToolbarSectionInternal = React.forwardRef(({ children, className, ...props }, ref) => {
|
|
50
|
+
return /* @__PURE__ */ jsx("div", {
|
|
51
|
+
ref,
|
|
52
|
+
role: "toolbar",
|
|
53
|
+
"aria-orientation": "horizontal",
|
|
54
|
+
className: cn("flex w-full flex-wrap items-center gap-2 p-1", className),
|
|
55
|
+
...props,
|
|
56
|
+
children
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
DataTableToolbarSectionInternal.displayName = "DataTableToolbarSectionInternal";
|
|
60
|
+
const DataTableToolbarSection = React.memo(DataTableToolbarSectionInternal);
|
|
61
|
+
DataTableToolbarSection.displayName = "DataTableToolbarSection";
|
|
62
|
+
//#endregion
|
|
63
|
+
export { DataTableToolbarSection };
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { FilterVariant } from "../lib/constants.js";
|
|
2
|
+
import { LucideIcon } from "lucide-react";
|
|
3
|
+
//#region src/components/registry/niko-table/config/data-table.d.ts
|
|
4
|
+
export type SortIconVariant = FilterVariant;
|
|
5
|
+
interface SortIcons {
|
|
6
|
+
asc: LucideIcon;
|
|
7
|
+
desc: LucideIcon;
|
|
8
|
+
unsorted: LucideIcon;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A mapped type rather than an interface so it can be passed as a Select's
|
|
12
|
+
* `items` label map (interfaces carry no implicit index signature).
|
|
13
|
+
*/
|
|
14
|
+
type SortLabels = Record<"asc" | "desc", string>;
|
|
15
|
+
export declare const SORT_ICONS: Record<SortIconVariant, SortIcons>;
|
|
16
|
+
export declare const SORT_LABELS: Record<SortIconVariant, SortLabels>;
|
|
17
|
+
/**
|
|
18
|
+
* @credit Adapted from React Table's default config
|
|
19
|
+
* @see https://react-table.tanstack.com/docs/overview
|
|
20
|
+
*/
|
|
21
|
+
export declare const dataTableConfig: {
|
|
22
|
+
readonly debounceMs: 300;
|
|
23
|
+
readonly throttleMs: 50;
|
|
24
|
+
readonly textOperators: ({
|
|
25
|
+
label: string;
|
|
26
|
+
value: "ilike";
|
|
27
|
+
} | {
|
|
28
|
+
label: string;
|
|
29
|
+
value: "not.ilike";
|
|
30
|
+
} | {
|
|
31
|
+
label: string;
|
|
32
|
+
value: "eq";
|
|
33
|
+
} | {
|
|
34
|
+
label: string;
|
|
35
|
+
value: "neq";
|
|
36
|
+
} | {
|
|
37
|
+
label: string;
|
|
38
|
+
value: "empty";
|
|
39
|
+
} | {
|
|
40
|
+
label: string;
|
|
41
|
+
value: "not.empty";
|
|
42
|
+
})[];
|
|
43
|
+
readonly numericOperators: ({
|
|
44
|
+
label: string;
|
|
45
|
+
value: "eq";
|
|
46
|
+
} | {
|
|
47
|
+
label: string;
|
|
48
|
+
value: "neq";
|
|
49
|
+
} | {
|
|
50
|
+
label: string;
|
|
51
|
+
value: "lt";
|
|
52
|
+
} | {
|
|
53
|
+
label: string;
|
|
54
|
+
value: "lte";
|
|
55
|
+
} | {
|
|
56
|
+
label: string;
|
|
57
|
+
value: "gt";
|
|
58
|
+
} | {
|
|
59
|
+
label: string;
|
|
60
|
+
value: "gte";
|
|
61
|
+
} | {
|
|
62
|
+
label: string;
|
|
63
|
+
value: "between";
|
|
64
|
+
} | {
|
|
65
|
+
label: string;
|
|
66
|
+
value: "empty";
|
|
67
|
+
} | {
|
|
68
|
+
label: string;
|
|
69
|
+
value: "not.empty";
|
|
70
|
+
})[];
|
|
71
|
+
readonly dateOperators: ({
|
|
72
|
+
label: string;
|
|
73
|
+
value: "eq";
|
|
74
|
+
} | {
|
|
75
|
+
label: string;
|
|
76
|
+
value: "neq";
|
|
77
|
+
} | {
|
|
78
|
+
label: string;
|
|
79
|
+
value: "lt";
|
|
80
|
+
} | {
|
|
81
|
+
label: string;
|
|
82
|
+
value: "gt";
|
|
83
|
+
} | {
|
|
84
|
+
label: string;
|
|
85
|
+
value: "lte";
|
|
86
|
+
} | {
|
|
87
|
+
label: string;
|
|
88
|
+
value: "gte";
|
|
89
|
+
} | {
|
|
90
|
+
label: string;
|
|
91
|
+
value: "between";
|
|
92
|
+
} | {
|
|
93
|
+
label: string;
|
|
94
|
+
value: "empty";
|
|
95
|
+
} | {
|
|
96
|
+
label: string;
|
|
97
|
+
value: "not.empty";
|
|
98
|
+
})[];
|
|
99
|
+
readonly selectOperators: ({
|
|
100
|
+
label: string;
|
|
101
|
+
value: "eq";
|
|
102
|
+
} | {
|
|
103
|
+
label: string;
|
|
104
|
+
value: "neq";
|
|
105
|
+
} | {
|
|
106
|
+
label: string;
|
|
107
|
+
value: "empty";
|
|
108
|
+
} | {
|
|
109
|
+
label: string;
|
|
110
|
+
value: "not.empty";
|
|
111
|
+
})[];
|
|
112
|
+
readonly multiSelectOperators: ({
|
|
113
|
+
label: string;
|
|
114
|
+
value: "in";
|
|
115
|
+
} | {
|
|
116
|
+
label: string;
|
|
117
|
+
value: "not.in";
|
|
118
|
+
} | {
|
|
119
|
+
label: string;
|
|
120
|
+
value: "empty";
|
|
121
|
+
} | {
|
|
122
|
+
label: string;
|
|
123
|
+
value: "not.empty";
|
|
124
|
+
})[];
|
|
125
|
+
readonly booleanOperators: ({
|
|
126
|
+
label: string;
|
|
127
|
+
value: "eq";
|
|
128
|
+
} | {
|
|
129
|
+
label: string;
|
|
130
|
+
value: "neq";
|
|
131
|
+
})[];
|
|
132
|
+
/**
|
|
133
|
+
* Choices for a boolean filter's value select. Also handed to the select as
|
|
134
|
+
* `items`, where Base UI reads the closed trigger's label from.
|
|
135
|
+
*/
|
|
136
|
+
readonly booleanValues: readonly [{
|
|
137
|
+
readonly label: "True";
|
|
138
|
+
readonly value: "true";
|
|
139
|
+
}, {
|
|
140
|
+
readonly label: "False";
|
|
141
|
+
readonly value: "false";
|
|
142
|
+
}];
|
|
143
|
+
readonly sortOrders: readonly [{
|
|
144
|
+
readonly label: "Asc";
|
|
145
|
+
readonly value: "asc";
|
|
146
|
+
}, {
|
|
147
|
+
readonly label: "Desc";
|
|
148
|
+
readonly value: "desc";
|
|
149
|
+
}];
|
|
150
|
+
readonly filterVariants: ("boolean" | "date" | "dateRange" | "multiSelect" | "number" | "range" | "select" | "text")[];
|
|
151
|
+
readonly operators: ("between" | "empty" | "eq" | "gt" | "gte" | "ilike" | "in" | "lt" | "lte" | "neq" | "not.empty" | "not.ilike" | "not.in" | "relative")[];
|
|
152
|
+
readonly joinOperators: ("and" | "or")[];
|
|
153
|
+
};
|
|
154
|
+
export type DataTableConfig = typeof dataTableConfig;
|
|
155
|
+
//#endregion
|
|
156
|
+
export {};
|