@upbound/monarch-blocks 0.13.2 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat-interface.js +60 -59
- package/dist/chat-interface.js.map +1 -1
- package/dist/data-table.d.ts +4 -3
- package/dist/data-table.js +168 -150
- package/dist/data-table.js.map +1 -1
- package/dist/{empty-view-BgEn71l5.d.ts → empty-view-DQt8-Ho8.d.ts} +9 -2
- package/dist/graph.css +13 -0
- package/dist/graph.d.ts +15 -3
- package/dist/graph.js +130 -76
- package/dist/graph.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +354 -299
- package/dist/index.js.map +1 -1
- package/dist/relative-time.d.ts +1 -1
- package/dist/relative-time.js +6 -11
- package/dist/relative-time.js.map +1 -1
- package/package.json +3 -3
|
@@ -179,13 +179,20 @@ declare module '@tanstack/react-table' {
|
|
|
179
179
|
pinning?: 'start' | 'end';
|
|
180
180
|
/** Marks an actions column — hides its header label and excludes it from contextual filtering. */
|
|
181
181
|
actions?: boolean;
|
|
182
|
-
/**
|
|
182
|
+
/**
|
|
183
|
+
* The column's non-CEL filter definition, read by the plain filter bar and contextual filtering. A `checkbox`
|
|
184
|
+
* filter keeps rows whose value is one of the checked values (`filterColumnByCheckedValues`) unless the column sets
|
|
185
|
+
* its own `filterFn`.
|
|
186
|
+
*/
|
|
183
187
|
filter?: ColumnFilterDefinition;
|
|
184
188
|
/** Parses a cell into a filter value for contextual (right-click) cell filtering. */
|
|
185
189
|
contextualFilterValue?: ContextualFilterValueParser<TData, TValue>;
|
|
186
190
|
/** Parses a cell into a search term for contextual (right-click) global search. */
|
|
187
191
|
contextualGlobalSearchValue?: ContextualGlobalSearchValueParser<TData, TValue>;
|
|
188
|
-
/**
|
|
192
|
+
/**
|
|
193
|
+
* When true, the column is used only for filtering and is never rendered in the table or listed in the Columns
|
|
194
|
+
* menu. If it has a `filter`, the plain filter bar still shows a chip for it.
|
|
195
|
+
*/
|
|
189
196
|
filterOnly?: boolean;
|
|
190
197
|
/** Column sizing for `layout="grid"` mode — see `GridColumnSizing`. */
|
|
191
198
|
grid?: GridColumnSizing;
|
package/dist/graph.css
CHANGED
|
@@ -32,15 +32,28 @@
|
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
.react-flow__controls-button {
|
|
35
|
+
width: 20px;
|
|
36
|
+
height: 20px;
|
|
37
|
+
padding: 6px;
|
|
35
38
|
background: var(--card);
|
|
36
39
|
border-bottom: 1px solid var(--border);
|
|
37
40
|
color: var(--foreground);
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
.react-flow__controls-button svg {
|
|
44
|
+
max-width: 10px;
|
|
45
|
+
max-height: 10px;
|
|
41
46
|
fill: var(--foreground);
|
|
42
47
|
}
|
|
43
48
|
|
|
49
|
+
.react-flow__controls-button:last-child {
|
|
50
|
+
border-bottom: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.react-flow__background circle {
|
|
54
|
+
fill: var(--border);
|
|
55
|
+
}
|
|
56
|
+
|
|
44
57
|
.react-flow__controls-button:hover {
|
|
45
58
|
background: var(--accent);
|
|
46
59
|
}
|
package/dist/graph.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Node, NodeProps, Edge, EdgeProps, NodeTypes, EdgeTypes } from 'reactflo
|
|
|
2
2
|
export { Edge, Node } from 'reactflow';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ColumnFiltersState } from '@tanstack/react-table';
|
|
5
|
-
import { T as TableDataState } from './empty-view-
|
|
5
|
+
import { T as TableDataState } from './empty-view-DQt8-Ho8.js';
|
|
6
6
|
import { DataTableColumnDef, DataTableEmptyConfig } from './data-table.js';
|
|
7
7
|
import '@upbound/monarch-core';
|
|
8
8
|
|
|
@@ -43,7 +43,7 @@ type NodeDefault<T extends object = object> = Node<NodeData<T>> & {
|
|
|
43
43
|
};
|
|
44
44
|
declare function isDefaultNode(node: NodeLoading | NodeDefault): node is NodeDefault;
|
|
45
45
|
type GraphNodeProps<T extends NodeData | {}> = NodeProps<T>;
|
|
46
|
-
declare function GraphNode<T extends NodeData = NodeData>({ id, data, ...props }: GraphNodeProps<T>): React.JSX.Element;
|
|
46
|
+
declare function GraphNode<T extends NodeData = NodeData>({ id, data, selected, ...props }: GraphNodeProps<T>): React.JSX.Element;
|
|
47
47
|
declare function GraphNodeSkeleton(_props: NodeProps<{}>): React.JSX.Element;
|
|
48
48
|
|
|
49
49
|
interface GraphActionsProviderProps {
|
|
@@ -88,6 +88,12 @@ interface GraphProps<T extends object> {
|
|
|
88
88
|
loading?: boolean;
|
|
89
89
|
showError?: boolean;
|
|
90
90
|
className?: string;
|
|
91
|
+
/** Classes for the graph canvas (not the toolbar). Defaults to `rounded-xl border`. */
|
|
92
|
+
canvasClassName?: string;
|
|
93
|
+
/** Hide the canvas minimap. Defaults to `false`. */
|
|
94
|
+
hideMiniMap?: boolean;
|
|
95
|
+
/** Hide the canvas zoom controls (zoom in, zoom out, fit view). Defaults to `false`. */
|
|
96
|
+
hideControls?: boolean;
|
|
91
97
|
emptyView?: GraphEmptyView;
|
|
92
98
|
ActionsComponent?: React.ComponentType<{
|
|
93
99
|
state: GraphDataState;
|
|
@@ -102,7 +108,7 @@ interface GraphProps<T extends object> {
|
|
|
102
108
|
declare const defaultGraphErrorConfig: DataTableEmptyConfig;
|
|
103
109
|
declare const defaultGraphEmptyConfig: DataTableEmptyConfig;
|
|
104
110
|
declare const defaultGraphNoFilterFoundConfig: DataTableEmptyConfig;
|
|
105
|
-
declare function Graph<T extends object>({ id, viewportFocusNodeId, config, columnDefinitions, title, emptyView, showError, className, loading, ActionsComponent: Actions, disableSearch, disableFilters, searchTerm: parentGlobalFilter, onSearchTermChange: parentSetGlobalFilter, filters: parentColumnFilters, onFiltersChange: parentSetColumnFilters, children, }: React.PropsWithChildren<GraphProps<T>>): React.JSX.Element;
|
|
111
|
+
declare function Graph<T extends object>({ id, viewportFocusNodeId, config, columnDefinitions, title, emptyView, showError, className, canvasClassName, hideMiniMap, hideControls, loading, ActionsComponent: Actions, disableSearch, disableFilters, searchTerm: parentGlobalFilter, onSearchTermChange: parentSetGlobalFilter, filters: parentColumnFilters, onFiltersChange: parentSetColumnFilters, children, }: React.PropsWithChildren<GraphProps<T>>): React.JSX.Element;
|
|
106
112
|
|
|
107
113
|
declare const GraphView: React.ForwardRefExoticComponent<{
|
|
108
114
|
viewportFocusNodeId?: string;
|
|
@@ -111,6 +117,12 @@ declare const GraphView: React.ForwardRefExoticComponent<{
|
|
|
111
117
|
nodeTypes?: NodeTypes;
|
|
112
118
|
edgeTypes?: EdgeTypes;
|
|
113
119
|
children?: React.ReactNode;
|
|
120
|
+
/** Classes for the canvas container. Defaults to `rounded-xl border`; override e.g. with `rounded-none border-0`. */
|
|
121
|
+
className?: string;
|
|
122
|
+
/** Hide the minimap in the bottom-right corner. Defaults to `false`. */
|
|
123
|
+
hideMiniMap?: boolean;
|
|
124
|
+
/** Hide the zoom controls (zoom in, zoom out, fit view). Defaults to `false`. */
|
|
125
|
+
hideControls?: boolean;
|
|
114
126
|
} & {
|
|
115
127
|
children?: React.ReactNode | undefined;
|
|
116
128
|
} & React.RefAttributes<GraphActionsProviderRef>>;
|
package/dist/graph.js
CHANGED
|
@@ -50,7 +50,7 @@ import { useCallback as useCallback2, useState } from "react";
|
|
|
50
50
|
// src/graph/graph-node.tsx
|
|
51
51
|
import * as React from "react";
|
|
52
52
|
import { getIncomers, getOutgoers, Handle, Position as Position2 } from "reactflow";
|
|
53
|
-
import { Badge, Card, Icon,
|
|
53
|
+
import { Badge, Button, Card, Icon, Tooltip, TooltipContent, TooltipTrigger } from "@upbound/monarch-core";
|
|
54
54
|
|
|
55
55
|
// src/lib/utils.ts
|
|
56
56
|
import { cn } from "@upbound/monarch-core/utils";
|
|
@@ -105,7 +105,7 @@ function isDefaultNode(node) {
|
|
|
105
105
|
return node.type !== "loading";
|
|
106
106
|
}
|
|
107
107
|
function GraphNode(_a) {
|
|
108
|
-
var _b = _a, { id, data } = _b, props = __objRest(_b, ["id", "data"]);
|
|
108
|
+
var _b = _a, { id, data, selected } = _b, props = __objRest(_b, ["id", "data", "selected"]);
|
|
109
109
|
var _a2, _b2;
|
|
110
110
|
const { nodes: originalNodes, edges: originalEdges } = useGraphActionsContext();
|
|
111
111
|
const nodes = originalNodes;
|
|
@@ -165,10 +165,11 @@ function GraphNode(_a) {
|
|
|
165
165
|
Card,
|
|
166
166
|
{
|
|
167
167
|
className: cn(
|
|
168
|
-
"relative gap-1.5 overflow-visible rounded-
|
|
168
|
+
"relative gap-1.5 overflow-visible rounded-xl py-0",
|
|
169
169
|
`flex h-[106px]! w-[260px]! flex-col pt-2.5! pb-0!`,
|
|
170
170
|
`hover:shadow-md motion-safe:transition-shadow`,
|
|
171
|
-
compact && `h-[47px]
|
|
171
|
+
compact && `h-[47px]!`,
|
|
172
|
+
(selected || data.isHighlighted) && "ring-primary ring-2"
|
|
172
173
|
),
|
|
173
174
|
style: { height: compact ? GRAPH_NODE_COLLAPSED_HEIGHT : GRAPH_NODE_HEIGHT, width: GRAPH_NODE_WIDTH },
|
|
174
175
|
children: [
|
|
@@ -186,34 +187,32 @@ function GraphNode(_a) {
|
|
|
186
187
|
),
|
|
187
188
|
/* @__PURE__ */ jsxs2("div", { className: "flex w-full flex-1 cursor-pointer flex-col", onClick: handleClick, children: [
|
|
188
189
|
/* @__PURE__ */ jsxs2("div", { className: cn("flex w-full justify-between gap-1 px-2.5", compact && "flex-row-reverse items-start"), children: [
|
|
189
|
-
!!compact && /* @__PURE__ */
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}) }),
|
|
205
|
-
state === "progressing" && /* @__PURE__ */ jsx2("div", { className: "flex shrink-0 flex-row items-center gap-1.5 overflow-hidden", children: /* @__PURE__ */ jsx2("div", { className: "flex size-[20px]! items-center justify-center", children: /* @__PURE__ */ jsx2(Spinner, { size: "sm" }) }) })
|
|
206
|
-
] }),
|
|
190
|
+
!!compact && /* @__PURE__ */ jsx2(Fragment, { children: compactBadges.length > 0 && /* @__PURE__ */ jsx2("div", { className: "flex shrink-0 flex-row items-center gap-1.5 overflow-hidden", children: compactBadges.map((_c, index) => {
|
|
191
|
+
var _d = _c, { tooltipContent, variant } = _d, badge = __objRest(_d, ["tooltipContent", "variant"]);
|
|
192
|
+
return /* @__PURE__ */ jsxs2(Tooltip, { children: [
|
|
193
|
+
/* @__PURE__ */ jsx2(TooltipTrigger, { children: /* @__PURE__ */ jsx2(
|
|
194
|
+
Badge,
|
|
195
|
+
__spreadProps(__spreadValues({
|
|
196
|
+
variant
|
|
197
|
+
}, badge), {
|
|
198
|
+
className: "flex size-[20px]! cursor-default! items-center justify-center p-0!",
|
|
199
|
+
children: badge.children
|
|
200
|
+
})
|
|
201
|
+
) }),
|
|
202
|
+
tooltipContent && /* @__PURE__ */ jsx2(TooltipContent, { children: tooltipContent })
|
|
203
|
+
] }, index);
|
|
204
|
+
}) }) }),
|
|
207
205
|
/* @__PURE__ */ jsxs2("div", { className: "mr-auto grow-0 overflow-hidden", children: [
|
|
208
|
-
/* @__PURE__ */ jsx2("h5", { className: "text-body-sm
|
|
209
|
-
/* @__PURE__ */ jsx2("p", { className: "text-body-sm truncate
|
|
210
|
-
!compact && /* @__PURE__ */ jsx2("p", { className: "text-body-sm text-muted-foreground mt-
|
|
206
|
+
/* @__PURE__ */ jsx2("h5", { className: "text-body-sm truncate font-medium", children: data.title }),
|
|
207
|
+
/* @__PURE__ */ jsx2("p", { className: "text-body-sm text-muted-foreground truncate", children: data.subtitle }),
|
|
208
|
+
!compact && /* @__PURE__ */ jsx2("p", { className: "text-body-sm text-muted-foreground mt-0.5 truncate", children: data.name })
|
|
211
209
|
] }),
|
|
212
210
|
/* @__PURE__ */ jsx2(
|
|
213
|
-
|
|
211
|
+
Badge,
|
|
214
212
|
{
|
|
213
|
+
variant: "secondary",
|
|
215
214
|
className: cn(
|
|
216
|
-
"
|
|
215
|
+
"cursor-default!",
|
|
217
216
|
["progressing", "paused"].includes(state) && "opacity-30",
|
|
218
217
|
data.typeDescriptors.className
|
|
219
218
|
),
|
|
@@ -221,16 +220,13 @@ function GraphNode(_a) {
|
|
|
221
220
|
}
|
|
222
221
|
)
|
|
223
222
|
] }),
|
|
224
|
-
!compact && /* @__PURE__ */ jsx2(Fragment, { children:
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}) }),
|
|
232
|
-
state === "progressing" && /* @__PURE__ */ jsx2("div", { className: "ml-auto flex size-[20px]! items-center justify-center", children: /* @__PURE__ */ jsx2(Spinner, { size: "sm" }) })
|
|
233
|
-
] }) })
|
|
223
|
+
!compact && /* @__PURE__ */ jsx2(Fragment, { children: defaultBadges.length > 0 && /* @__PURE__ */ jsx2("div", { className: "mt-auto flex h-8 items-center border-t px-2.5", children: /* @__PURE__ */ jsx2("div", { className: "flex gap-1.5 overflow-hidden overflow-x-auto", children: defaultBadges.map((_e, index) => {
|
|
224
|
+
var _f = _e, { tooltipContent, variant } = _f, badge = __objRest(_f, ["tooltipContent", "variant"]);
|
|
225
|
+
return /* @__PURE__ */ jsxs2(Tooltip, { children: [
|
|
226
|
+
/* @__PURE__ */ jsx2(TooltipTrigger, { children: /* @__PURE__ */ jsx2(Badge, __spreadProps(__spreadValues({ variant }, badge), { className: "cursor-default! py-px! whitespace-nowrap", children: badge.children })) }),
|
|
227
|
+
tooltipContent && /* @__PURE__ */ jsx2(TooltipContent, { children: tooltipContent })
|
|
228
|
+
] }, index);
|
|
229
|
+
}) }) }) })
|
|
234
230
|
] }),
|
|
235
231
|
!!hasOutgoingEdge && /* @__PURE__ */ jsxs2(
|
|
236
232
|
"div",
|
|
@@ -257,11 +253,13 @@ function GraphNode(_a) {
|
|
|
257
253
|
) }),
|
|
258
254
|
/* @__PURE__ */ jsxs2(Tooltip, { children: [
|
|
259
255
|
/* @__PURE__ */ jsx2(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx2(
|
|
260
|
-
|
|
256
|
+
Button,
|
|
261
257
|
{
|
|
262
258
|
type: "button",
|
|
259
|
+
variant: "outline",
|
|
260
|
+
size: "icon-xs",
|
|
263
261
|
"aria-label": data.expanded ? "Collapse" : "Expand",
|
|
264
|
-
className: "
|
|
262
|
+
className: "absolute top-1/2 left-1/2 size-5 -translate-1/2 rounded-full active:not-aria-[haspopup]:-translate-1/2",
|
|
265
263
|
onClick: (e) => {
|
|
266
264
|
var _a3;
|
|
267
265
|
e.stopPropagation();
|
|
@@ -297,7 +295,7 @@ function GraphNodeSkeleton(_props) {
|
|
|
297
295
|
Card,
|
|
298
296
|
{
|
|
299
297
|
className: cn(
|
|
300
|
-
`flex h-[106px]! w-[260px]! flex-col gap-1.5 rounded-
|
|
298
|
+
`flex h-[106px]! w-[260px]! flex-col gap-1.5 rounded-xl px-0 py-0 pt-2.5! pb-0! hover:shadow-md motion-safe:transition-shadow`,
|
|
301
299
|
compact && `h-[47px]!`
|
|
302
300
|
),
|
|
303
301
|
children: [
|
|
@@ -511,18 +509,41 @@ function getColumnFilterCount(filterValue, filter) {
|
|
|
511
509
|
return 0;
|
|
512
510
|
}
|
|
513
511
|
|
|
512
|
+
// src/lib/data-table/filter-types.ts
|
|
513
|
+
var isDateRangeColumnFilter = (definition) => definition.type === "dateRange";
|
|
514
|
+
var isRadioColumnFilter = (definition) => definition.type === "radio";
|
|
515
|
+
var isCheckboxColumnFilter = (definition) => definition.type === "checkbox";
|
|
516
|
+
var isMultiTextColumnFilter = (definition) => definition.type === "multiText";
|
|
517
|
+
|
|
514
518
|
// src/lib/data-table/utils.ts
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
519
|
+
var filterColumnByCheckedValues = Object.assign(
|
|
520
|
+
(row, columnId, checkedValues) => {
|
|
521
|
+
if (!(checkedValues == null ? void 0 : checkedValues.length)) return true;
|
|
522
|
+
const value = row.getValue(columnId);
|
|
523
|
+
const values = Array.isArray(value) ? value : [value];
|
|
524
|
+
return values.some((item) => item != null && checkedValues.includes(String(item)));
|
|
525
|
+
},
|
|
526
|
+
{ autoRemove: (checkedValues) => !Array.isArray(checkedValues) || checkedValues.length === 0 }
|
|
527
|
+
);
|
|
528
|
+
function withDefaultFilterFns(columns) {
|
|
529
|
+
return columns.map((column) => {
|
|
530
|
+
var _a;
|
|
531
|
+
let next = column;
|
|
532
|
+
if ("columns" in column && column.columns) {
|
|
533
|
+
next = __spreadProps(__spreadValues({}, next), { columns: withDefaultFilterFns(column.columns) });
|
|
534
|
+
}
|
|
535
|
+
const filter = (_a = column.meta) == null ? void 0 : _a.filter;
|
|
536
|
+
if (filter && isCheckboxColumnFilter(filter) && column.filterFn === void 0) {
|
|
537
|
+
next = __spreadProps(__spreadValues({}, next), { filterFn: filterColumnByCheckedValues });
|
|
538
|
+
}
|
|
539
|
+
return next;
|
|
540
|
+
});
|
|
518
541
|
}
|
|
519
542
|
function hasFilterableColumns(columns) {
|
|
520
|
-
return columns.some(
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
}
|
|
525
|
-
);
|
|
543
|
+
return columns.some((column) => {
|
|
544
|
+
var _a;
|
|
545
|
+
return column.getCanFilter() && !!((_a = column.columnDef.meta) == null ? void 0 : _a.filter);
|
|
546
|
+
});
|
|
526
547
|
}
|
|
527
548
|
function getTableState({
|
|
528
549
|
error,
|
|
@@ -607,7 +628,7 @@ function DataTableSearch({
|
|
|
607
628
|
|
|
608
629
|
// src/data-table/empty-view.tsx
|
|
609
630
|
import { Alert, AlertDescription } from "@upbound/monarch-core";
|
|
610
|
-
import { Button } from "@upbound/monarch-core";
|
|
631
|
+
import { Button as Button2 } from "@upbound/monarch-core";
|
|
611
632
|
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@upbound/monarch-core";
|
|
612
633
|
import { Icon as Icon3 } from "@upbound/monarch-core";
|
|
613
634
|
import { IconTile } from "@upbound/monarch-core";
|
|
@@ -642,7 +663,7 @@ function DataTableEmptyView({
|
|
|
642
663
|
const isFilteredEmpty = tableState === "empty" && filterCount > 0;
|
|
643
664
|
const config = tableState === "error" ? mergeConfig(defaultErrorConfig, emptyView == null ? void 0 : emptyView.error) : tableState === "empty" ? isFilteredEmpty ? mergeConfig(defaultNoFilterFoundConfig, emptyView == null ? void 0 : emptyView.filter) : mergeConfig(defaultEmptyConfig, emptyView == null ? void 0 : emptyView.empty) : null;
|
|
644
665
|
const wrapperClassName = tableState === "error" ? (_c = (_a = emptyView == null ? void 0 : emptyView.error) == null ? void 0 : _a.wrapperClassName) != null ? _c : (_b = emptyView == null ? void 0 : emptyView.empty) == null ? void 0 : _b.wrapperClassName : config == null ? void 0 : config.wrapperClassName;
|
|
645
|
-
const defaultAction = isFilteredEmpty && !(config == null ? void 0 : config.action) ? /* @__PURE__ */ jsxs4(
|
|
666
|
+
const defaultAction = isFilteredEmpty && !(config == null ? void 0 : config.action) ? /* @__PURE__ */ jsxs4(Button2, { variant: "outline", size: "sm", onClick: resetFilters, children: [
|
|
646
667
|
/* @__PURE__ */ jsx5(Icon3, { name: "xmark" }),
|
|
647
668
|
"Clear filters"
|
|
648
669
|
] }) : null;
|
|
@@ -666,7 +687,7 @@ import * as React5 from "react";
|
|
|
666
687
|
import * as React4 from "react";
|
|
667
688
|
import { Icon as Icon4 } from "@upbound/monarch-core";
|
|
668
689
|
import { Badge as Badge2 } from "@upbound/monarch-core";
|
|
669
|
-
import { Button as
|
|
690
|
+
import { Button as Button3 } from "@upbound/monarch-core";
|
|
670
691
|
import { ButtonGroup, ButtonGroupText } from "@upbound/monarch-core";
|
|
671
692
|
import { Calendar } from "@upbound/monarch-core";
|
|
672
693
|
import {
|
|
@@ -789,7 +810,7 @@ function FilterBar(_a) {
|
|
|
789
810
|
if (filter) handleAddFilter(filter.key);
|
|
790
811
|
},
|
|
791
812
|
children: [
|
|
792
|
-
/* @__PURE__ */ jsxs5(ComboboxTrigger, { "aria-label": "Add filter", showIndicator: false, render: /* @__PURE__ */ jsx6(
|
|
813
|
+
/* @__PURE__ */ jsxs5(ComboboxTrigger, { "aria-label": "Add filter", showIndicator: false, render: /* @__PURE__ */ jsx6(Button3, { variant: "outline" }), children: [
|
|
793
814
|
/* @__PURE__ */ jsx6(Icon4, { name: "plus", "data-icon": "inline-start" }),
|
|
794
815
|
"Add filter"
|
|
795
816
|
] }),
|
|
@@ -886,7 +907,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
886
907
|
}
|
|
887
908
|
}
|
|
888
909
|
function FilterChipRemoveButton({ label, onRemove }) {
|
|
889
|
-
return /* @__PURE__ */ jsx6(
|
|
910
|
+
return /* @__PURE__ */ jsx6(Button3, { variant: "outline", size: "icon", "aria-label": `Remove ${label} filter`, onClick: onRemove, children: /* @__PURE__ */ jsx6(Icon4, { name: "xmark" }) });
|
|
890
911
|
}
|
|
891
912
|
function CheckboxFilterChip({
|
|
892
913
|
definition,
|
|
@@ -920,7 +941,7 @@ function CheckboxFilterChip({
|
|
|
920
941
|
/* @__PURE__ */ jsx6(
|
|
921
942
|
ComboboxTrigger,
|
|
922
943
|
{
|
|
923
|
-
render: /* @__PURE__ */ jsx6(
|
|
944
|
+
render: /* @__PURE__ */ jsx6(Button3, { variant: "outline", className: "gap-1 font-normal [&>svg:last-child]:size-(--icon-sm)" }),
|
|
924
945
|
children: /* @__PURE__ */ jsx6("span", { className: values.length === 0 ? "text-muted-foreground" : "", children: displayLabel })
|
|
925
946
|
}
|
|
926
947
|
),
|
|
@@ -954,7 +975,7 @@ function CheckboxFilterChip({
|
|
|
954
975
|
]
|
|
955
976
|
}
|
|
956
977
|
) : /* @__PURE__ */ jsxs5(DropdownMenu, { defaultOpen: autoOpen, children: [
|
|
957
|
-
/* @__PURE__ */ jsx6(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs5(
|
|
978
|
+
/* @__PURE__ */ jsx6(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs5(Button3, { variant: "outline", className: "gap-1 font-normal", children: [
|
|
958
979
|
/* @__PURE__ */ jsx6("span", { className: values.length === 0 ? "text-muted-foreground" : "", children: displayLabel }),
|
|
959
980
|
/* @__PURE__ */ jsx6(Icon4, { name: "chevron-down", size: "sm", className: "text-muted-foreground" })
|
|
960
981
|
] }) }),
|
|
@@ -1005,7 +1026,7 @@ function RadioFilterChip({
|
|
|
1005
1026
|
/* @__PURE__ */ jsx6(
|
|
1006
1027
|
ComboboxTrigger,
|
|
1007
1028
|
{
|
|
1008
|
-
render: /* @__PURE__ */ jsx6(
|
|
1029
|
+
render: /* @__PURE__ */ jsx6(Button3, { variant: "outline", className: "gap-1 font-normal [&>svg:last-child]:size-(--icon-sm)" }),
|
|
1009
1030
|
children: /* @__PURE__ */ jsx6("span", { className: selectedValue ? "" : "text-muted-foreground", children: displayLabel })
|
|
1010
1031
|
}
|
|
1011
1032
|
),
|
|
@@ -1032,7 +1053,7 @@ function RadioFilterChip({
|
|
|
1032
1053
|
]
|
|
1033
1054
|
}
|
|
1034
1055
|
) : /* @__PURE__ */ jsxs5(DropdownMenu, { defaultOpen: autoOpen, children: [
|
|
1035
|
-
/* @__PURE__ */ jsx6(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs5(
|
|
1056
|
+
/* @__PURE__ */ jsx6(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs5(Button3, { variant: "outline", className: "gap-1 font-normal", children: [
|
|
1036
1057
|
/* @__PURE__ */ jsx6("span", { className: selectedValue ? "" : "text-muted-foreground", children: displayLabel }),
|
|
1037
1058
|
/* @__PURE__ */ jsx6(Icon4, { name: "chevron-down", size: "sm", className: "text-muted-foreground" })
|
|
1038
1059
|
] }) }),
|
|
@@ -1057,7 +1078,7 @@ function TextFilterChip({
|
|
|
1057
1078
|
return /* @__PURE__ */ jsxs5(ButtonGroup, { children: [
|
|
1058
1079
|
/* @__PURE__ */ jsx6(ButtonGroupText, { children: label }),
|
|
1059
1080
|
/* @__PURE__ */ jsxs5(Popover, { open, onOpenChange: setOpen, children: [
|
|
1060
|
-
/* @__PURE__ */ jsx6(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx6(
|
|
1081
|
+
/* @__PURE__ */ jsx6(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx6(Button3, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx6("span", { className: text ? "" : "text-muted-foreground", children: text || "Any" }) }) }),
|
|
1061
1082
|
/* @__PURE__ */ jsx6(PopoverContent, { align: "start", children: /* @__PURE__ */ jsx6(
|
|
1062
1083
|
Input,
|
|
1063
1084
|
{
|
|
@@ -1100,7 +1121,7 @@ function MultiTextFilterChip({
|
|
|
1100
1121
|
return /* @__PURE__ */ jsxs5(ButtonGroup, { children: [
|
|
1101
1122
|
/* @__PURE__ */ jsx6(ButtonGroupText, { children: label }),
|
|
1102
1123
|
/* @__PURE__ */ jsxs5(Popover, { defaultOpen: autoOpen, children: [
|
|
1103
|
-
/* @__PURE__ */ jsx6(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx6(
|
|
1124
|
+
/* @__PURE__ */ jsx6(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx6(Button3, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx6("span", { className: tokens.length === 0 ? "text-muted-foreground" : "", children: displayLabel }) }) }),
|
|
1104
1125
|
/* @__PURE__ */ jsx6(PopoverContent, { align: "start", children: /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2", children: [
|
|
1105
1126
|
tokens.length > 0 && /* @__PURE__ */ jsx6("div", { className: "flex flex-wrap gap-1", children: tokens.map((token) => /* @__PURE__ */ jsxs5(Badge2, { variant: "secondary", className: "gap-1", children: [
|
|
1106
1127
|
token,
|
|
@@ -1167,7 +1188,7 @@ function DateFilterChip({
|
|
|
1167
1188
|
return /* @__PURE__ */ jsxs5(ButtonGroup, { children: [
|
|
1168
1189
|
/* @__PURE__ */ jsx6(ButtonGroupText, { children: label }),
|
|
1169
1190
|
/* @__PURE__ */ jsxs5(Popover, { defaultOpen: autoOpen, children: [
|
|
1170
|
-
/* @__PURE__ */ jsx6(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx6(
|
|
1191
|
+
/* @__PURE__ */ jsx6(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx6(Button3, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx6("span", { className: startDate ? "" : "text-muted-foreground", children: displayLabel }) }) }),
|
|
1171
1192
|
/* @__PURE__ */ jsx6(PopoverContent, { align: "start", className: "w-fit", children: /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2", children: [
|
|
1172
1193
|
/* @__PURE__ */ jsx6(
|
|
1173
1194
|
Calendar,
|
|
@@ -1227,12 +1248,6 @@ function DateFilterChip({
|
|
|
1227
1248
|
] });
|
|
1228
1249
|
}
|
|
1229
1250
|
|
|
1230
|
-
// src/lib/data-table/filter-types.ts
|
|
1231
|
-
var isDateRangeColumnFilter = (definition) => definition.type === "dateRange";
|
|
1232
|
-
var isRadioColumnFilter = (definition) => definition.type === "radio";
|
|
1233
|
-
var isCheckboxColumnFilter = (definition) => definition.type === "checkbox";
|
|
1234
|
-
var isMultiTextColumnFilter = (definition) => definition.type === "multiText";
|
|
1235
|
-
|
|
1236
1251
|
// src/data-table/view-filter.tsx
|
|
1237
1252
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1238
1253
|
function toFilterOption(opt) {
|
|
@@ -1278,7 +1293,7 @@ function ViewFilter({
|
|
|
1278
1293
|
className
|
|
1279
1294
|
}) {
|
|
1280
1295
|
const filterableColumns = React5.useMemo(
|
|
1281
|
-
() => columns.filter((column) =>
|
|
1296
|
+
() => columns.filter((column) => column.getCanFilter()).flatMap((column) => {
|
|
1282
1297
|
var _a;
|
|
1283
1298
|
const filter = (_a = column.columnDef.meta) == null ? void 0 : _a.filter;
|
|
1284
1299
|
return filter ? [{ key: column.id, filter }] : [];
|
|
@@ -1573,7 +1588,15 @@ function useViewportFocus(nodeMap, viewportFocusNodeId) {
|
|
|
1573
1588
|
|
|
1574
1589
|
// src/graph/graph-view.tsx
|
|
1575
1590
|
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1576
|
-
var GraphViewInternal = ({
|
|
1591
|
+
var GraphViewInternal = ({
|
|
1592
|
+
nodeTypes: parentNodeTypes,
|
|
1593
|
+
edgeTypes: parentEdgeTypes,
|
|
1594
|
+
children,
|
|
1595
|
+
viewportFocusNodeId,
|
|
1596
|
+
className,
|
|
1597
|
+
hideMiniMap = false,
|
|
1598
|
+
hideControls = false
|
|
1599
|
+
}) => {
|
|
1577
1600
|
const { nodes, edges, toggleNodeExpansion } = useGraphActionsContext();
|
|
1578
1601
|
const nodeTypes = React7.useMemo(
|
|
1579
1602
|
() => __spreadValues({
|
|
@@ -1612,6 +1635,7 @@ var GraphViewInternal = ({ nodeTypes: parentNodeTypes, edgeTypes: parentEdgeType
|
|
|
1612
1635
|
return /* @__PURE__ */ jsxs6(
|
|
1613
1636
|
ReactFlow,
|
|
1614
1637
|
{
|
|
1638
|
+
className: cn("overflow-hidden rounded-xl border", className),
|
|
1615
1639
|
nodeTypes,
|
|
1616
1640
|
edgeTypes,
|
|
1617
1641
|
nodes: layoutedNodes,
|
|
@@ -1628,17 +1652,40 @@ var GraphViewInternal = ({ nodeTypes: parentNodeTypes, edgeTypes: parentEdgeType
|
|
|
1628
1652
|
panOnScroll: true,
|
|
1629
1653
|
selectionOnDrag: true,
|
|
1630
1654
|
children: [
|
|
1631
|
-
/* @__PURE__ */ jsx9(Background, { className: "bg-muted
|
|
1632
|
-
/* @__PURE__ */ jsx9(Controls, { showInteractive: false }),
|
|
1633
|
-
/* @__PURE__ */ jsx9(MiniMap, { zoomable: true, pannable: true }),
|
|
1655
|
+
/* @__PURE__ */ jsx9(Background, { className: "bg-muted/50", size: 2 }),
|
|
1656
|
+
!hideControls && /* @__PURE__ */ jsx9(Controls, { showInteractive: false }),
|
|
1657
|
+
!hideMiniMap && /* @__PURE__ */ jsx9(MiniMap, { zoomable: true, pannable: true }),
|
|
1634
1658
|
children
|
|
1635
1659
|
]
|
|
1636
1660
|
}
|
|
1637
1661
|
);
|
|
1638
1662
|
};
|
|
1639
|
-
var GraphView = React7.forwardRef(
|
|
1640
|
-
|
|
1641
|
-
|
|
1663
|
+
var GraphView = React7.forwardRef(
|
|
1664
|
+
({
|
|
1665
|
+
defaultNodes = [],
|
|
1666
|
+
defaultEdges = [],
|
|
1667
|
+
nodeTypes,
|
|
1668
|
+
edgeTypes,
|
|
1669
|
+
children,
|
|
1670
|
+
viewportFocusNodeId,
|
|
1671
|
+
className,
|
|
1672
|
+
hideMiniMap,
|
|
1673
|
+
hideControls
|
|
1674
|
+
}, ref) => {
|
|
1675
|
+
return /* @__PURE__ */ jsx9(ReactFlowProvider, { children: /* @__PURE__ */ jsx9(GraphActionsProvider, { ref, initialNodes: defaultNodes, initialEdges: defaultEdges, children: /* @__PURE__ */ jsx9(
|
|
1676
|
+
GraphViewInternal,
|
|
1677
|
+
{
|
|
1678
|
+
nodeTypes,
|
|
1679
|
+
edgeTypes,
|
|
1680
|
+
viewportFocusNodeId,
|
|
1681
|
+
className,
|
|
1682
|
+
hideMiniMap,
|
|
1683
|
+
hideControls,
|
|
1684
|
+
children
|
|
1685
|
+
}
|
|
1686
|
+
) }) });
|
|
1687
|
+
}
|
|
1688
|
+
);
|
|
1642
1689
|
GraphView.displayName = "GraphView";
|
|
1643
1690
|
|
|
1644
1691
|
// src/graph/graph.tsx
|
|
@@ -1667,6 +1714,9 @@ function Graph({
|
|
|
1667
1714
|
emptyView,
|
|
1668
1715
|
showError,
|
|
1669
1716
|
className,
|
|
1717
|
+
canvasClassName,
|
|
1718
|
+
hideMiniMap = false,
|
|
1719
|
+
hideControls = false,
|
|
1670
1720
|
loading = false,
|
|
1671
1721
|
ActionsComponent: Actions,
|
|
1672
1722
|
disableSearch = false,
|
|
@@ -1688,10 +1738,11 @@ function Graph({
|
|
|
1688
1738
|
const setGlobalFilter = parentSetGlobalFilter != null ? parentSetGlobalFilter : setInnerGlobalFilter;
|
|
1689
1739
|
const columnFilters = parentColumnFilters != null ? parentColumnFilters : innerColumnFilters;
|
|
1690
1740
|
const setColumnFilters = parentSetColumnFilters != null ? parentSetColumnFilters : setInnerColumnFilters;
|
|
1741
|
+
const columns = React8.useMemo(() => withDefaultFilterFns(columnDefinitions), [columnDefinitions]);
|
|
1691
1742
|
const table = useTable({
|
|
1692
1743
|
features: dataTableFeatures,
|
|
1693
1744
|
data: config.data,
|
|
1694
|
-
columns
|
|
1745
|
+
columns,
|
|
1695
1746
|
state: { columnFilters, globalFilter },
|
|
1696
1747
|
onColumnFiltersChange: setColumnFilters,
|
|
1697
1748
|
onGlobalFilterChange: setGlobalFilter,
|
|
@@ -1760,6 +1811,9 @@ function Graph({
|
|
|
1760
1811
|
ref: graphRef,
|
|
1761
1812
|
nodeTypes: memoizedNodeTypes,
|
|
1762
1813
|
edgeTypes: memoizedEdgeTypes,
|
|
1814
|
+
className: canvasClassName,
|
|
1815
|
+
hideMiniMap,
|
|
1816
|
+
hideControls,
|
|
1763
1817
|
children
|
|
1764
1818
|
}
|
|
1765
1819
|
)
|