@upbound/monarch-blocks 0.13.0 → 0.13.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/dist/data-table.d.ts +2 -3
- package/dist/data-table.js +344 -316
- package/dist/data-table.js.map +1 -1
- package/dist/{empty-view--jBQ7evg.d.ts → empty-view-BgEn71l5.d.ts} +31 -51
- package/dist/graph.d.ts +1 -2
- package/dist/graph.js +207 -168
- package/dist/graph.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +489 -478
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -3829,12 +3829,10 @@ function TimestampCell({ timestamp }) {
|
|
|
3829
3829
|
}
|
|
3830
3830
|
|
|
3831
3831
|
// src/data-table/data-table.tsx
|
|
3832
|
-
import * as
|
|
3832
|
+
import * as React12 from "react";
|
|
3833
3833
|
import {
|
|
3834
3834
|
useTable
|
|
3835
3835
|
} from "@tanstack/react-table";
|
|
3836
|
-
import { Icon as Icon11 } from "@upbound/monarch-core";
|
|
3837
|
-
import { InputGroup as InputGroup4, InputGroupAddon as InputGroupAddon4, InputGroupButton as InputGroupButton2, InputGroupInput as InputGroupInput3 } from "@upbound/monarch-core";
|
|
3838
3836
|
|
|
3839
3837
|
// src/lib/data-table/features.ts
|
|
3840
3838
|
import {
|
|
@@ -4492,13 +4490,67 @@ function useFilterVisibility(filterVisibility) {
|
|
|
4492
4490
|
return { showFilterToggle, filterRowVisible, setFilterRowVisible };
|
|
4493
4491
|
}
|
|
4494
4492
|
|
|
4493
|
+
// src/data-table/data-table-search.tsx
|
|
4494
|
+
import * as React8 from "react";
|
|
4495
|
+
import { Icon as Icon6 } from "@upbound/monarch-core";
|
|
4496
|
+
import { InputGroup as InputGroup4, InputGroupAddon as InputGroupAddon4, InputGroupButton as InputGroupButton2, InputGroupInput as InputGroupInput3 } from "@upbound/monarch-core";
|
|
4497
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
4498
|
+
function DataTableSearch({
|
|
4499
|
+
value,
|
|
4500
|
+
onValueChange,
|
|
4501
|
+
placeholder = "Search\u2026",
|
|
4502
|
+
className,
|
|
4503
|
+
disabled = false
|
|
4504
|
+
}) {
|
|
4505
|
+
const id = `table-search-${React8.useId()}`;
|
|
4506
|
+
const inputRef = React8.useRef(null);
|
|
4507
|
+
const [draft, setDraft] = React8.useState(value);
|
|
4508
|
+
const [isPending, startTransition] = React8.useTransition();
|
|
4509
|
+
if (!isPending && draft !== value) {
|
|
4510
|
+
setDraft(value);
|
|
4511
|
+
}
|
|
4512
|
+
const commit = (next) => {
|
|
4513
|
+
setDraft(next);
|
|
4514
|
+
startTransition(() => onValueChange(next));
|
|
4515
|
+
};
|
|
4516
|
+
return /* @__PURE__ */ jsxs8(InputGroup4, { className: cn("w-70", className), children: [
|
|
4517
|
+
/* @__PURE__ */ jsx10(InputGroupAddon4, { align: "inline-start", children: /* @__PURE__ */ jsx10(Icon6, { name: "magnifying-glass" }) }),
|
|
4518
|
+
/* @__PURE__ */ jsx10(
|
|
4519
|
+
InputGroupInput3,
|
|
4520
|
+
__spreadProps(__spreadValues({}, SEARCH_INPUT_PROPS), {
|
|
4521
|
+
id,
|
|
4522
|
+
className: SEARCH_INPUT_CLASS,
|
|
4523
|
+
"aria-label": "Search",
|
|
4524
|
+
placeholder,
|
|
4525
|
+
disabled,
|
|
4526
|
+
ref: inputRef,
|
|
4527
|
+
value: draft,
|
|
4528
|
+
onChange: (e) => commit(e.target.value)
|
|
4529
|
+
})
|
|
4530
|
+
),
|
|
4531
|
+
!!draft && !disabled && /* @__PURE__ */ jsx10(InputGroupAddon4, { align: "inline-end", children: /* @__PURE__ */ jsx10(
|
|
4532
|
+
InputGroupButton2,
|
|
4533
|
+
{
|
|
4534
|
+
size: "icon-xs",
|
|
4535
|
+
"aria-label": "Clear search",
|
|
4536
|
+
onClick: () => {
|
|
4537
|
+
var _a;
|
|
4538
|
+
commit("");
|
|
4539
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
4540
|
+
},
|
|
4541
|
+
children: /* @__PURE__ */ jsx10(Icon6, { name: "xmark" })
|
|
4542
|
+
}
|
|
4543
|
+
) })
|
|
4544
|
+
] });
|
|
4545
|
+
}
|
|
4546
|
+
|
|
4495
4547
|
// src/data-table/empty-view.tsx
|
|
4496
4548
|
import { Alert, AlertDescription } from "@upbound/monarch-core";
|
|
4497
4549
|
import { Button as Button5 } from "@upbound/monarch-core";
|
|
4498
4550
|
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@upbound/monarch-core";
|
|
4499
|
-
import { Icon as
|
|
4551
|
+
import { Icon as Icon7 } from "@upbound/monarch-core";
|
|
4500
4552
|
import { IconTile } from "@upbound/monarch-core";
|
|
4501
|
-
import { jsx as
|
|
4553
|
+
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
4502
4554
|
var defaultErrorConfig = {
|
|
4503
4555
|
icon: "circle-exclamation",
|
|
4504
4556
|
header: "Something went wrong",
|
|
@@ -4529,37 +4581,37 @@ function DataTableEmptyView({
|
|
|
4529
4581
|
const isFilteredEmpty = tableState === "empty" && filterCount > 0;
|
|
4530
4582
|
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;
|
|
4531
4583
|
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;
|
|
4532
|
-
const defaultAction = isFilteredEmpty && !(config == null ? void 0 : config.action) ? /* @__PURE__ */
|
|
4533
|
-
/* @__PURE__ */
|
|
4584
|
+
const defaultAction = isFilteredEmpty && !(config == null ? void 0 : config.action) ? /* @__PURE__ */ jsxs9(Button5, { variant: "outline", size: "sm", onClick: resetFilters, children: [
|
|
4585
|
+
/* @__PURE__ */ jsx11(Icon7, { name: "xmark" }),
|
|
4534
4586
|
"Clear filters"
|
|
4535
4587
|
] }) : null;
|
|
4536
|
-
return /* @__PURE__ */
|
|
4537
|
-
/* @__PURE__ */
|
|
4538
|
-
config.icon && /* @__PURE__ */
|
|
4539
|
-
config.header && /* @__PURE__ */
|
|
4540
|
-
config.subheader && /* @__PURE__ */
|
|
4588
|
+
return /* @__PURE__ */ jsx11("div", { className: cn("flex size-full flex-col justify-center", wrapperClassName), children: config && /* @__PURE__ */ jsxs9(Empty, { className: cn("border border-dashed", config.className), children: [
|
|
4589
|
+
/* @__PURE__ */ jsxs9(EmptyHeader, { children: [
|
|
4590
|
+
config.icon && /* @__PURE__ */ jsx11(EmptyMedia, { children: /* @__PURE__ */ jsx11(IconTile, { variant: "branded", size: "md", children: /* @__PURE__ */ jsx11(Icon7, { name: config.icon }) }) }),
|
|
4591
|
+
config.header && /* @__PURE__ */ jsx11(EmptyTitle, { children: config.header }),
|
|
4592
|
+
config.subheader && /* @__PURE__ */ jsx11(EmptyDescription, { children: config.subheader })
|
|
4541
4593
|
] }),
|
|
4542
|
-
(config.details || config.action || defaultAction) && /* @__PURE__ */
|
|
4543
|
-
config.details && /* @__PURE__ */
|
|
4594
|
+
(config.details || config.action || defaultAction) && /* @__PURE__ */ jsxs9(EmptyContent, { children: [
|
|
4595
|
+
config.details && /* @__PURE__ */ jsx11(Alert, { children: /* @__PURE__ */ jsx11(AlertDescription, { children: config.details }) }),
|
|
4544
4596
|
(_d = config.action) != null ? _d : defaultAction
|
|
4545
4597
|
] })
|
|
4546
4598
|
] }) });
|
|
4547
4599
|
}
|
|
4548
4600
|
|
|
4549
4601
|
// src/data-table/filter-toggle.tsx
|
|
4550
|
-
import { Badge as Badge3, Button as Button6, Icon as
|
|
4551
|
-
import { jsx as
|
|
4602
|
+
import { Badge as Badge3, Button as Button6, Icon as Icon8 } from "@upbound/monarch-core";
|
|
4603
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
4552
4604
|
function FilterToggle({ pressed, onPressedChange, count }) {
|
|
4553
|
-
return /* @__PURE__ */
|
|
4554
|
-
/* @__PURE__ */
|
|
4605
|
+
return /* @__PURE__ */ jsxs10(Button6, { variant: "outline", onClick: () => onPressedChange(!pressed), className: "shrink-0", children: [
|
|
4606
|
+
/* @__PURE__ */ jsx12(Icon8, { name: "filter", "data-icon": "inline-start" }),
|
|
4555
4607
|
pressed ? "Hide filters" : "Show filters",
|
|
4556
|
-
!!count && /* @__PURE__ */
|
|
4608
|
+
!!count && /* @__PURE__ */ jsx12(Badge3, { variant: "secondary", className: "tabular-nums", children: count })
|
|
4557
4609
|
] });
|
|
4558
4610
|
}
|
|
4559
4611
|
|
|
4560
4612
|
// src/data-table/pagination.tsx
|
|
4561
4613
|
import { Button as Button7 } from "@upbound/monarch-core";
|
|
4562
|
-
import { Icon as
|
|
4614
|
+
import { Icon as Icon9 } from "@upbound/monarch-core";
|
|
4563
4615
|
import { Label as Label2 } from "@upbound/monarch-core";
|
|
4564
4616
|
import {
|
|
4565
4617
|
Pagination,
|
|
@@ -4570,7 +4622,7 @@ import {
|
|
|
4570
4622
|
} from "@upbound/monarch-core";
|
|
4571
4623
|
import { Select as Select2, SelectContent as SelectContent2, SelectGroup as SelectGroup2, SelectItem as SelectItem2, SelectTrigger as SelectTrigger2, SelectValue as SelectValue2 } from "@upbound/monarch-core";
|
|
4572
4624
|
import { Tooltip as Tooltip5, TooltipContent as TooltipContent4, TooltipTrigger as TooltipTrigger4 } from "@upbound/monarch-core";
|
|
4573
|
-
import { jsx as
|
|
4625
|
+
import { jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4574
4626
|
var DEFAULT_PAGINATION_CONFIG = {
|
|
4575
4627
|
summary: true,
|
|
4576
4628
|
arrows: true,
|
|
@@ -4609,36 +4661,36 @@ function DataTablePagination({
|
|
|
4609
4661
|
const currentPage = pageIndex + 1;
|
|
4610
4662
|
const mounted = useMounted();
|
|
4611
4663
|
const locale = mounted ? void 0 : "en-US";
|
|
4612
|
-
return /* @__PURE__ */
|
|
4613
|
-
resolved.summary ? /* @__PURE__ */
|
|
4664
|
+
return /* @__PURE__ */ jsxs11("div", { "data-testid": "table-footer", className: "flex items-center justify-between px-2 pt-4", children: [
|
|
4665
|
+
resolved.summary ? /* @__PURE__ */ jsxs11("div", { className: "text-body text-muted-foreground", "data-testid": "table-pagination-summary", children: [
|
|
4614
4666
|
"Showing ",
|
|
4615
|
-
/* @__PURE__ */
|
|
4667
|
+
/* @__PURE__ */ jsx13("span", { className: "text-foreground font-medium", children: itemStart.toLocaleString(locale) }),
|
|
4616
4668
|
" to",
|
|
4617
4669
|
" ",
|
|
4618
|
-
/* @__PURE__ */
|
|
4670
|
+
/* @__PURE__ */ jsx13("span", { className: "text-foreground font-medium", children: itemEnd.toLocaleString(locale) }),
|
|
4619
4671
|
" of",
|
|
4620
4672
|
" ",
|
|
4621
|
-
/* @__PURE__ */
|
|
4673
|
+
/* @__PURE__ */ jsxs11("span", { className: "text-foreground font-medium", children: [
|
|
4622
4674
|
rowCount.toLocaleString(locale),
|
|
4623
4675
|
!isRowCountExact && "+"
|
|
4624
4676
|
] }),
|
|
4625
4677
|
" ",
|
|
4626
4678
|
"results",
|
|
4627
|
-
!isRowCountExact && /* @__PURE__ */
|
|
4628
|
-
/* @__PURE__ */
|
|
4629
|
-
/* @__PURE__ */
|
|
4679
|
+
!isRowCountExact && /* @__PURE__ */ jsxs11(Tooltip5, { children: [
|
|
4680
|
+
/* @__PURE__ */ jsx13(TooltipTrigger4, { className: "ml-1 align-middle", children: /* @__PURE__ */ jsx13(Icon9, { name: "circle-info", size: "sm" }) }),
|
|
4681
|
+
/* @__PURE__ */ jsx13(TooltipContent4, { children: "Add filters or refine your search to reduce the result set." })
|
|
4630
4682
|
] })
|
|
4631
|
-
] }) : /* @__PURE__ */
|
|
4632
|
-
/* @__PURE__ */
|
|
4633
|
-
resolved.pageSizeSelector && /* @__PURE__ */
|
|
4634
|
-
/* @__PURE__ */
|
|
4635
|
-
/* @__PURE__ */
|
|
4636
|
-
/* @__PURE__ */
|
|
4637
|
-
/* @__PURE__ */
|
|
4683
|
+
] }) : /* @__PURE__ */ jsx13("div", {}),
|
|
4684
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-4", children: [
|
|
4685
|
+
resolved.pageSizeSelector && /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
4686
|
+
/* @__PURE__ */ jsx13(Label2, { htmlFor: PAGE_SIZE_SELECT_ID, className: "font-semibold", children: "Rows per page" }),
|
|
4687
|
+
/* @__PURE__ */ jsxs11(Select2, { value: String(effectivePageSize), onValueChange: (value) => onPageSizeChange(Number(value)), children: [
|
|
4688
|
+
/* @__PURE__ */ jsx13(SelectTrigger2, { id: PAGE_SIZE_SELECT_ID, size: "sm", className: "w-18", "data-testid": "table-page-size-select", children: /* @__PURE__ */ jsx13(SelectValue2, {}) }),
|
|
4689
|
+
/* @__PURE__ */ jsx13(SelectContent2, { align: "end", children: /* @__PURE__ */ jsx13(SelectGroup2, { children: normalizedPageSizeOptions.map((option) => /* @__PURE__ */ jsx13(SelectItem2, { value: String(option), children: option }, option)) }) })
|
|
4638
4690
|
] })
|
|
4639
4691
|
] }),
|
|
4640
|
-
pageCount > 1 && (resolved.arrows || resolved.numbers) && /* @__PURE__ */
|
|
4641
|
-
resolved.arrows && /* @__PURE__ */
|
|
4692
|
+
pageCount > 1 && (resolved.arrows || resolved.numbers) && /* @__PURE__ */ jsx13(Pagination, { className: "mx-0 w-auto justify-end", children: /* @__PURE__ */ jsxs11(PaginationContent, { children: [
|
|
4693
|
+
resolved.arrows && /* @__PURE__ */ jsx13(PaginationItem, { children: /* @__PURE__ */ jsx13(
|
|
4642
4694
|
Button7,
|
|
4643
4695
|
{
|
|
4644
4696
|
variant: "outline",
|
|
@@ -4646,10 +4698,10 @@ function DataTablePagination({
|
|
|
4646
4698
|
"aria-label": "Go to first page",
|
|
4647
4699
|
disabled: currentPage <= 1,
|
|
4648
4700
|
onClick: () => onPageChange(1),
|
|
4649
|
-
children: /* @__PURE__ */
|
|
4701
|
+
children: /* @__PURE__ */ jsx13(Icon9, { name: "chevrons-left", className: "cn-rtl-flip" })
|
|
4650
4702
|
}
|
|
4651
4703
|
) }),
|
|
4652
|
-
resolved.arrows && /* @__PURE__ */
|
|
4704
|
+
resolved.arrows && /* @__PURE__ */ jsx13(PaginationItem, { children: /* @__PURE__ */ jsx13(
|
|
4653
4705
|
Button7,
|
|
4654
4706
|
{
|
|
4655
4707
|
variant: "outline",
|
|
@@ -4657,11 +4709,11 @@ function DataTablePagination({
|
|
|
4657
4709
|
"aria-label": "Go to previous page",
|
|
4658
4710
|
disabled: currentPage <= 1,
|
|
4659
4711
|
onClick: () => onPageChange(currentPage - 1),
|
|
4660
|
-
children: /* @__PURE__ */
|
|
4712
|
+
children: /* @__PURE__ */ jsx13(Icon9, { name: "chevron-left", className: "cn-rtl-flip" })
|
|
4661
4713
|
}
|
|
4662
4714
|
) }),
|
|
4663
4715
|
resolved.numbers && visiblePages.map(
|
|
4664
|
-
(page, index) => page === void 0 ? /* @__PURE__ */
|
|
4716
|
+
(page, index) => page === void 0 ? /* @__PURE__ */ jsx13(PaginationItem, { children: /* @__PURE__ */ jsx13(PaginationEllipsis, {}) }, `ellipsis-${index}`) : /* @__PURE__ */ jsx13(PaginationItem, { children: /* @__PURE__ */ jsx13(
|
|
4665
4717
|
PaginationLink,
|
|
4666
4718
|
{
|
|
4667
4719
|
href: "#",
|
|
@@ -4675,7 +4727,7 @@ function DataTablePagination({
|
|
|
4675
4727
|
}
|
|
4676
4728
|
) }, page)
|
|
4677
4729
|
),
|
|
4678
|
-
resolved.arrows && /* @__PURE__ */
|
|
4730
|
+
resolved.arrows && /* @__PURE__ */ jsx13(PaginationItem, { children: /* @__PURE__ */ jsx13(
|
|
4679
4731
|
Button7,
|
|
4680
4732
|
{
|
|
4681
4733
|
variant: "outline",
|
|
@@ -4683,10 +4735,10 @@ function DataTablePagination({
|
|
|
4683
4735
|
"aria-label": "Go to next page",
|
|
4684
4736
|
disabled: currentPage >= pageCount,
|
|
4685
4737
|
onClick: () => onPageChange(currentPage + 1),
|
|
4686
|
-
children: /* @__PURE__ */
|
|
4738
|
+
children: /* @__PURE__ */ jsx13(Icon9, { name: "chevron-right", className: "cn-rtl-flip" })
|
|
4687
4739
|
}
|
|
4688
4740
|
) }),
|
|
4689
|
-
resolved.arrows && /* @__PURE__ */
|
|
4741
|
+
resolved.arrows && /* @__PURE__ */ jsx13(PaginationItem, { children: /* @__PURE__ */ jsx13(
|
|
4690
4742
|
Button7,
|
|
4691
4743
|
{
|
|
4692
4744
|
variant: "outline",
|
|
@@ -4694,7 +4746,7 @@ function DataTablePagination({
|
|
|
4694
4746
|
"aria-label": "Go to last page",
|
|
4695
4747
|
disabled: currentPage >= pageCount,
|
|
4696
4748
|
onClick: () => onPageChange(pageCount),
|
|
4697
|
-
children: /* @__PURE__ */
|
|
4749
|
+
children: /* @__PURE__ */ jsx13(Icon9, { name: "chevrons-right", className: "cn-rtl-flip" })
|
|
4698
4750
|
}
|
|
4699
4751
|
) })
|
|
4700
4752
|
] }) })
|
|
@@ -4703,7 +4755,7 @@ function DataTablePagination({
|
|
|
4703
4755
|
}
|
|
4704
4756
|
|
|
4705
4757
|
// src/data-table/table-primitives.tsx
|
|
4706
|
-
import * as
|
|
4758
|
+
import * as React9 from "react";
|
|
4707
4759
|
import { flexRender as flexRender2 } from "@tanstack/react-table";
|
|
4708
4760
|
import { ContextMenu, ContextMenuTrigger } from "@upbound/monarch-core";
|
|
4709
4761
|
import {
|
|
@@ -4713,7 +4765,7 @@ import {
|
|
|
4713
4765
|
DropdownMenuSeparator as DropdownMenuSeparator2,
|
|
4714
4766
|
DropdownMenuTrigger as DropdownMenuTrigger4
|
|
4715
4767
|
} from "@upbound/monarch-core";
|
|
4716
|
-
import { Icon as
|
|
4768
|
+
import { Icon as Icon10 } from "@upbound/monarch-core";
|
|
4717
4769
|
import { Skeleton } from "@upbound/monarch-core";
|
|
4718
4770
|
import {
|
|
4719
4771
|
Table as BaseTable,
|
|
@@ -4724,7 +4776,7 @@ import {
|
|
|
4724
4776
|
TableRow as BaseTableRow
|
|
4725
4777
|
} from "@upbound/monarch-core";
|
|
4726
4778
|
import { Tooltip as Tooltip6, TooltipContent as TooltipContent5, TooltipTrigger as TooltipTrigger5 } from "@upbound/monarch-core";
|
|
4727
|
-
import { Fragment as Fragment7, jsx as
|
|
4779
|
+
import { Fragment as Fragment7, jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4728
4780
|
var HEADER_SURFACE_BG = "bg-[color-mix(in_oklch,var(--muted)_50%,var(--card))]";
|
|
4729
4781
|
var TABLE_HEAD_CLASSES = "text-body-sm text-muted-foreground h-10 px-4 text-left align-middle font-medium whitespace-nowrap has-[[role=checkbox]]:pr-0";
|
|
4730
4782
|
var TABLE_CELL_CLASSES = "px-4 py-2 align-middle whitespace-nowrap has-[[role=checkbox]]:pr-0";
|
|
@@ -4738,7 +4790,7 @@ function DataTableRoot({
|
|
|
4738
4790
|
children
|
|
4739
4791
|
}) {
|
|
4740
4792
|
if (layout === "grid") {
|
|
4741
|
-
return /* @__PURE__ */
|
|
4793
|
+
return /* @__PURE__ */ jsx14(
|
|
4742
4794
|
"div",
|
|
4743
4795
|
{
|
|
4744
4796
|
ref: gridRootRef,
|
|
@@ -4749,7 +4801,7 @@ function DataTableRoot({
|
|
|
4749
4801
|
}
|
|
4750
4802
|
);
|
|
4751
4803
|
}
|
|
4752
|
-
return /* @__PURE__ */
|
|
4804
|
+
return /* @__PURE__ */ jsx14(BaseTable, { className, style, children });
|
|
4753
4805
|
}
|
|
4754
4806
|
function getColumnPinningProps(column, surface = "body") {
|
|
4755
4807
|
const isPinned = column.getIsPinned();
|
|
@@ -4772,8 +4824,8 @@ function getColumnPinningProps(column, surface = "body") {
|
|
|
4772
4824
|
}
|
|
4773
4825
|
function DataTableSortIcon({ sortOrder }) {
|
|
4774
4826
|
if (!sortOrder) return null;
|
|
4775
|
-
return /* @__PURE__ */
|
|
4776
|
-
|
|
4827
|
+
return /* @__PURE__ */ jsx14(
|
|
4828
|
+
Icon10,
|
|
4777
4829
|
{
|
|
4778
4830
|
size: "xs",
|
|
4779
4831
|
name: sortOrder === "asc" ? "arrow-up" : "arrow-down",
|
|
@@ -4792,57 +4844,57 @@ function ColumnActionsMenuItems({
|
|
|
4792
4844
|
const canResize = header.column.getCanResize();
|
|
4793
4845
|
const canHide = header.column.getCanHide();
|
|
4794
4846
|
const canPin = !isGrid && header.column.getCanPin();
|
|
4795
|
-
return /* @__PURE__ */
|
|
4796
|
-
canSort && /* @__PURE__ */
|
|
4797
|
-
/* @__PURE__ */
|
|
4847
|
+
return /* @__PURE__ */ jsxs12(DropdownMenuContent4, { align: "start", className: "w-45", children: [
|
|
4848
|
+
canSort && /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
4849
|
+
/* @__PURE__ */ jsxs12(
|
|
4798
4850
|
DropdownMenuItem4,
|
|
4799
4851
|
{
|
|
4800
4852
|
disabled: header.column.getIsSorted() === "asc",
|
|
4801
4853
|
onClick: () => header.column.toggleSorting(false),
|
|
4802
4854
|
children: [
|
|
4803
|
-
/* @__PURE__ */
|
|
4855
|
+
/* @__PURE__ */ jsx14(Icon10, { name: "arrow-up" }),
|
|
4804
4856
|
"Sort ascending"
|
|
4805
4857
|
]
|
|
4806
4858
|
}
|
|
4807
4859
|
),
|
|
4808
|
-
/* @__PURE__ */
|
|
4860
|
+
/* @__PURE__ */ jsxs12(
|
|
4809
4861
|
DropdownMenuItem4,
|
|
4810
4862
|
{
|
|
4811
4863
|
disabled: header.column.getIsSorted() === "desc",
|
|
4812
4864
|
onClick: () => header.column.toggleSorting(true),
|
|
4813
4865
|
children: [
|
|
4814
|
-
/* @__PURE__ */
|
|
4866
|
+
/* @__PURE__ */ jsx14(Icon10, { name: "arrow-down" }),
|
|
4815
4867
|
"Sort descending"
|
|
4816
4868
|
]
|
|
4817
4869
|
}
|
|
4818
4870
|
),
|
|
4819
|
-
!!header.column.getIsSorted() && /* @__PURE__ */
|
|
4820
|
-
/* @__PURE__ */
|
|
4871
|
+
!!header.column.getIsSorted() && /* @__PURE__ */ jsxs12(DropdownMenuItem4, { onClick: () => header.column.clearSorting(), children: [
|
|
4872
|
+
/* @__PURE__ */ jsx14(Icon10, { name: "xmark" }),
|
|
4821
4873
|
"Remove sorting"
|
|
4822
4874
|
] })
|
|
4823
4875
|
] }),
|
|
4824
|
-
canResize && /* @__PURE__ */
|
|
4825
|
-
canSort && /* @__PURE__ */
|
|
4826
|
-
!isGrid && /* @__PURE__ */
|
|
4827
|
-
/* @__PURE__ */
|
|
4876
|
+
canResize && /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
4877
|
+
canSort && /* @__PURE__ */ jsx14(DropdownMenuSeparator2, {}),
|
|
4878
|
+
!isGrid && /* @__PURE__ */ jsxs12(DropdownMenuItem4, { onClick: () => onAutosizeColumn(header.column.id), children: [
|
|
4879
|
+
/* @__PURE__ */ jsx14(Icon10, { name: "arrows-left-right" }),
|
|
4828
4880
|
"Autosize column"
|
|
4829
4881
|
] }),
|
|
4830
|
-
/* @__PURE__ */
|
|
4831
|
-
/* @__PURE__ */
|
|
4882
|
+
/* @__PURE__ */ jsxs12(DropdownMenuItem4, { onClick: () => onAutosizeAll(), children: [
|
|
4883
|
+
/* @__PURE__ */ jsx14(Icon10, { name: "table-columns" }),
|
|
4832
4884
|
isGrid ? "Reset all columns" : "Autosize all columns"
|
|
4833
4885
|
] })
|
|
4834
4886
|
] }),
|
|
4835
|
-
(canHide || canPin) && /* @__PURE__ */
|
|
4836
|
-
(canSort || canResize) && /* @__PURE__ */
|
|
4837
|
-
canHide && /* @__PURE__ */
|
|
4838
|
-
/* @__PURE__ */
|
|
4887
|
+
(canHide || canPin) && /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
4888
|
+
(canSort || canResize) && /* @__PURE__ */ jsx14(DropdownMenuSeparator2, {}),
|
|
4889
|
+
canHide && /* @__PURE__ */ jsxs12(DropdownMenuItem4, { onClick: () => header.column.toggleVisibility(), children: [
|
|
4890
|
+
/* @__PURE__ */ jsx14(Icon10, { name: "eye-slash" }),
|
|
4839
4891
|
"Hide column"
|
|
4840
4892
|
] }),
|
|
4841
|
-
canPin && (header.column.getIsPinned() ? /* @__PURE__ */
|
|
4842
|
-
/* @__PURE__ */
|
|
4893
|
+
canPin && (header.column.getIsPinned() ? /* @__PURE__ */ jsxs12(DropdownMenuItem4, { onClick: () => header.column.pin(false), children: [
|
|
4894
|
+
/* @__PURE__ */ jsx14(Icon10, { name: "thumbtack" }),
|
|
4843
4895
|
"Unpin column"
|
|
4844
|
-
] }) : /* @__PURE__ */
|
|
4845
|
-
/* @__PURE__ */
|
|
4896
|
+
] }) : /* @__PURE__ */ jsxs12(DropdownMenuItem4, { onClick: () => header.column.pin("start"), children: [
|
|
4897
|
+
/* @__PURE__ */ jsx14(Icon10, { name: "thumbtack" }),
|
|
4846
4898
|
"Pin column"
|
|
4847
4899
|
] }))
|
|
4848
4900
|
] })
|
|
@@ -4862,7 +4914,7 @@ function HeaderCellContent({
|
|
|
4862
4914
|
const resizeHandler = header.getResizeHandler();
|
|
4863
4915
|
const headerTitle = typeof header.column.columnDef.header === "string" ? header.column.columnDef.header : "";
|
|
4864
4916
|
const sorted = header.column.getIsSorted();
|
|
4865
|
-
const labelButton = /* @__PURE__ */
|
|
4917
|
+
const labelButton = /* @__PURE__ */ jsxs12(
|
|
4866
4918
|
"button",
|
|
4867
4919
|
{
|
|
4868
4920
|
type: "button",
|
|
@@ -4873,10 +4925,10 @@ function HeaderCellContent({
|
|
|
4873
4925
|
shouldShowActionsMenu ? "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50 cursor-pointer" : "cursor-default"
|
|
4874
4926
|
),
|
|
4875
4927
|
children: [
|
|
4876
|
-
/* @__PURE__ */
|
|
4877
|
-
/* @__PURE__ */
|
|
4878
|
-
shouldShowActionsMenu && /* @__PURE__ */
|
|
4879
|
-
|
|
4928
|
+
/* @__PURE__ */ jsx14(DataTableSortIcon, { sortOrder: sorted }),
|
|
4929
|
+
/* @__PURE__ */ jsx14("span", { className: "min-w-0 truncate", children: flexRender2(header.column.columnDef.header, header.getContext()) }),
|
|
4930
|
+
shouldShowActionsMenu && /* @__PURE__ */ jsx14(
|
|
4931
|
+
Icon10,
|
|
4880
4932
|
{
|
|
4881
4933
|
size: "sm",
|
|
4882
4934
|
name: "ellipsis",
|
|
@@ -4886,9 +4938,9 @@ function HeaderCellContent({
|
|
|
4886
4938
|
]
|
|
4887
4939
|
}
|
|
4888
4940
|
);
|
|
4889
|
-
const label = shouldShowActionsMenu ? /* @__PURE__ */
|
|
4890
|
-
/* @__PURE__ */
|
|
4891
|
-
/* @__PURE__ */
|
|
4941
|
+
const label = shouldShowActionsMenu ? /* @__PURE__ */ jsxs12(DropdownMenu4, { children: [
|
|
4942
|
+
/* @__PURE__ */ jsx14(DropdownMenuTrigger4, { asChild: true, children: labelButton }),
|
|
4943
|
+
/* @__PURE__ */ jsx14(
|
|
4892
4944
|
ColumnActionsMenuItems,
|
|
4893
4945
|
{
|
|
4894
4946
|
header,
|
|
@@ -4898,12 +4950,12 @@ function HeaderCellContent({
|
|
|
4898
4950
|
}
|
|
4899
4951
|
)
|
|
4900
4952
|
] }) : labelButton;
|
|
4901
|
-
return /* @__PURE__ */
|
|
4902
|
-
/* @__PURE__ */
|
|
4903
|
-
/* @__PURE__ */
|
|
4904
|
-
/* @__PURE__ */
|
|
4953
|
+
return /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
4954
|
+
/* @__PURE__ */ jsx14("div", { className: "flex min-w-0 flex-1 items-center gap-1", children: /* @__PURE__ */ jsx14("div", { className: "min-w-0 flex-1", children: !isActionColumn && !isGroupedColumn && (headerTitle ? /* @__PURE__ */ jsxs12(Tooltip6, { children: [
|
|
4955
|
+
/* @__PURE__ */ jsx14(TooltipTrigger5, { asChild: true, children: label }),
|
|
4956
|
+
/* @__PURE__ */ jsx14(TooltipContent5, { children: headerTitle })
|
|
4905
4957
|
] }) : label) }) }),
|
|
4906
|
-
canResize && /* @__PURE__ */
|
|
4958
|
+
canResize && /* @__PURE__ */ jsx14(
|
|
4907
4959
|
"button",
|
|
4908
4960
|
{
|
|
4909
4961
|
type: "button",
|
|
@@ -4947,7 +4999,7 @@ function DataTableHeader({
|
|
|
4947
4999
|
const stickyTopPx = stickyHeader ? stickyHeaderOffset + headerGroupIndex * stickyHeaderRowHeight : void 0;
|
|
4948
5000
|
const isPinned = !isGrid && header.column.getIsPinned();
|
|
4949
5001
|
const pinning = isGrid ? { className: "", style: {} } : getColumnPinningProps(header.column, "header");
|
|
4950
|
-
const content = /* @__PURE__ */
|
|
5002
|
+
const content = /* @__PURE__ */ jsx14(
|
|
4951
5003
|
HeaderCellContent,
|
|
4952
5004
|
{
|
|
4953
5005
|
header,
|
|
@@ -4968,7 +5020,7 @@ function DataTableHeader({
|
|
|
4968
5020
|
isPinned && "z-30"
|
|
4969
5021
|
);
|
|
4970
5022
|
if (isGrid) {
|
|
4971
|
-
return /* @__PURE__ */
|
|
5023
|
+
return /* @__PURE__ */ jsx14(
|
|
4972
5024
|
"div",
|
|
4973
5025
|
{
|
|
4974
5026
|
role: "columnheader",
|
|
@@ -4981,7 +5033,7 @@ function DataTableHeader({
|
|
|
4981
5033
|
header.id
|
|
4982
5034
|
);
|
|
4983
5035
|
}
|
|
4984
|
-
return /* @__PURE__ */
|
|
5036
|
+
return /* @__PURE__ */ jsx14(
|
|
4985
5037
|
BaseTableHead,
|
|
4986
5038
|
{
|
|
4987
5039
|
className: cn(cellClassName, "whitespace-normal"),
|
|
@@ -4996,19 +5048,19 @@ function DataTableHeader({
|
|
|
4996
5048
|
});
|
|
4997
5049
|
};
|
|
4998
5050
|
if (isGrid) {
|
|
4999
|
-
return /* @__PURE__ */
|
|
5051
|
+
return /* @__PURE__ */ jsx14(
|
|
5000
5052
|
"div",
|
|
5001
5053
|
{
|
|
5002
5054
|
role: "rowgroup",
|
|
5003
5055
|
className: cn("col-span-full grid grid-cols-subgrid", HEADER_SURFACE_BG, !!stickyHeader && "sticky z-20"),
|
|
5004
5056
|
style: stickyHeader ? { top: stickyHeaderOffset } : void 0,
|
|
5005
|
-
children: headerGroups.map((headerGroup, headerGroupIndex) => /* @__PURE__ */
|
|
5057
|
+
children: headerGroups.map((headerGroup, headerGroupIndex) => /* @__PURE__ */ jsx14("div", { role: "row", className: "col-span-full grid grid-cols-subgrid border-b", children: renderHeaders(headerGroup, headerGroupIndex) }, headerGroup.id))
|
|
5006
5058
|
}
|
|
5007
5059
|
);
|
|
5008
5060
|
}
|
|
5009
|
-
return /* @__PURE__ */
|
|
5061
|
+
return /* @__PURE__ */ jsx14(BaseTableHeader, { children: headerGroups.map((headerGroup, headerGroupIndex) => /* @__PURE__ */ jsx14(BaseTableRow, { children: renderHeaders(headerGroup, headerGroupIndex) }, headerGroup.id)) });
|
|
5010
5062
|
}
|
|
5011
|
-
var DataTableRow =
|
|
5063
|
+
var DataTableRow = React9.forwardRef(
|
|
5012
5064
|
(_a, ref) => {
|
|
5013
5065
|
var _b = _a, { hoverable, disabled, className, layout = "auto" } = _b, props = __objRest(_b, ["hoverable", "disabled", "className", "layout"]);
|
|
5014
5066
|
const classes = cn(
|
|
@@ -5018,7 +5070,7 @@ var DataTableRow = React8.forwardRef(
|
|
|
5018
5070
|
className
|
|
5019
5071
|
);
|
|
5020
5072
|
if (layout === "grid") {
|
|
5021
|
-
return /* @__PURE__ */
|
|
5073
|
+
return /* @__PURE__ */ jsx14(
|
|
5022
5074
|
"div",
|
|
5023
5075
|
__spreadValues({
|
|
5024
5076
|
ref,
|
|
@@ -5027,7 +5079,7 @@ var DataTableRow = React8.forwardRef(
|
|
|
5027
5079
|
}, props)
|
|
5028
5080
|
);
|
|
5029
5081
|
}
|
|
5030
|
-
return /* @__PURE__ */
|
|
5082
|
+
return /* @__PURE__ */ jsx14(BaseTableRow, __spreadValues({ ref, className: classes }, props));
|
|
5031
5083
|
}
|
|
5032
5084
|
);
|
|
5033
5085
|
DataTableRow.displayName = "DataTableRow";
|
|
@@ -5058,7 +5110,7 @@ function DataTableCell({
|
|
|
5058
5110
|
isPinned && "z-10",
|
|
5059
5111
|
className
|
|
5060
5112
|
);
|
|
5061
|
-
const cellElement = isGrid ? /* @__PURE__ */
|
|
5113
|
+
const cellElement = isGrid ? /* @__PURE__ */ jsx14(
|
|
5062
5114
|
"div",
|
|
5063
5115
|
{
|
|
5064
5116
|
role: "cell",
|
|
@@ -5066,7 +5118,7 @@ function DataTableCell({
|
|
|
5066
5118
|
style: { minWidth: cell.column.columnDef.minSize },
|
|
5067
5119
|
children: content
|
|
5068
5120
|
}
|
|
5069
|
-
) : /* @__PURE__ */
|
|
5121
|
+
) : /* @__PURE__ */ jsx14(
|
|
5070
5122
|
BaseTableCell,
|
|
5071
5123
|
{
|
|
5072
5124
|
className: cellClassName,
|
|
@@ -5078,9 +5130,9 @@ function DataTableCell({
|
|
|
5078
5130
|
}
|
|
5079
5131
|
);
|
|
5080
5132
|
if (!shouldShowContextualMenu || !onContextCell) return cellElement;
|
|
5081
|
-
return /* @__PURE__ */
|
|
5082
|
-
/* @__PURE__ */
|
|
5083
|
-
/* @__PURE__ */
|
|
5133
|
+
return /* @__PURE__ */ jsxs12(ContextMenu, { children: [
|
|
5134
|
+
/* @__PURE__ */ jsx14(ContextMenuTrigger, { asChild: true, children: cellElement }),
|
|
5135
|
+
/* @__PURE__ */ jsx14(
|
|
5084
5136
|
CellContextualFilter,
|
|
5085
5137
|
{
|
|
5086
5138
|
filter: contextualFilter,
|
|
@@ -5099,7 +5151,7 @@ function DataTableGroupRow({
|
|
|
5099
5151
|
layout = "auto"
|
|
5100
5152
|
}) {
|
|
5101
5153
|
if (layout === "grid") {
|
|
5102
|
-
return /* @__PURE__ */
|
|
5154
|
+
return /* @__PURE__ */ jsx14("div", { role: "row", className: "bg-muted/50 hover:bg-muted/50 col-span-full grid grid-cols-subgrid", children: /* @__PURE__ */ jsx14(
|
|
5103
5155
|
"div",
|
|
5104
5156
|
{
|
|
5105
5157
|
role: "cell",
|
|
@@ -5109,7 +5161,7 @@ function DataTableGroupRow({
|
|
|
5109
5161
|
}
|
|
5110
5162
|
) });
|
|
5111
5163
|
}
|
|
5112
|
-
return /* @__PURE__ */
|
|
5164
|
+
return /* @__PURE__ */ jsx14(BaseTableRow, { className: "bg-muted/50 hover:bg-muted/50", children: /* @__PURE__ */ jsx14(BaseTableCell, { colSpan, className: "text-foreground border-b font-semibold whitespace-nowrap", children: groupLabel }) });
|
|
5113
5165
|
}
|
|
5114
5166
|
function DataTableSkeletonBody({
|
|
5115
5167
|
rowCount = 10,
|
|
@@ -5118,32 +5170,32 @@ function DataTableSkeletonBody({
|
|
|
5118
5170
|
layout = "auto"
|
|
5119
5171
|
}) {
|
|
5120
5172
|
const isGrid = layout === "grid";
|
|
5121
|
-
const rows = Array.from({ length: rowCount }).map((_, rowIndex) => /* @__PURE__ */
|
|
5173
|
+
const rows = Array.from({ length: rowCount }).map((_, rowIndex) => /* @__PURE__ */ jsx14(DataTableRow, { layout, children: columns.map(
|
|
5122
5174
|
(col) => {
|
|
5123
5175
|
var _a, _b;
|
|
5124
|
-
return isGrid ? /* @__PURE__ */
|
|
5176
|
+
return isGrid ? /* @__PURE__ */ jsx14(
|
|
5125
5177
|
"div",
|
|
5126
5178
|
{
|
|
5127
5179
|
role: "cell",
|
|
5128
5180
|
className: cn(TABLE_CELL_CLASSES, "flex items-center overflow-hidden"),
|
|
5129
5181
|
style: { minWidth: col.minSize },
|
|
5130
|
-
children: (_a = renderCell == null ? void 0 : renderCell(col.id)) != null ? _a : /* @__PURE__ */
|
|
5182
|
+
children: (_a = renderCell == null ? void 0 : renderCell(col.id)) != null ? _a : /* @__PURE__ */ jsx14(Skeleton, { className: "h-4 w-full" })
|
|
5131
5183
|
},
|
|
5132
5184
|
`skeleton-col-${col.id}-row-${rowIndex}`
|
|
5133
|
-
) : /* @__PURE__ */
|
|
5185
|
+
) : /* @__PURE__ */ jsx14(
|
|
5134
5186
|
BaseTableCell,
|
|
5135
5187
|
{
|
|
5136
5188
|
style: { width: col.size, minWidth: col.minSize, maxWidth: col.maxSize },
|
|
5137
|
-
children: (_b = renderCell == null ? void 0 : renderCell(col.id)) != null ? _b : /* @__PURE__ */
|
|
5189
|
+
children: (_b = renderCell == null ? void 0 : renderCell(col.id)) != null ? _b : /* @__PURE__ */ jsx14(Skeleton, { className: "h-4 w-full" })
|
|
5138
5190
|
},
|
|
5139
5191
|
`skeleton-col-${col.id}-row-${rowIndex}`
|
|
5140
5192
|
);
|
|
5141
5193
|
}
|
|
5142
5194
|
) }, `skeleton-row-${rowIndex}`));
|
|
5143
5195
|
if (isGrid) {
|
|
5144
|
-
return /* @__PURE__ */
|
|
5196
|
+
return /* @__PURE__ */ jsx14("div", { role: "rowgroup", className: "col-span-full grid grid-cols-subgrid", "data-testid": "table-skeleton-loader", children: rows });
|
|
5145
5197
|
}
|
|
5146
|
-
return /* @__PURE__ */
|
|
5198
|
+
return /* @__PURE__ */ jsx14(BaseTableBody, { "data-testid": "table-skeleton-loader", children: rows });
|
|
5147
5199
|
}
|
|
5148
5200
|
function DataTableExpandedRow({
|
|
5149
5201
|
colSpan,
|
|
@@ -5153,9 +5205,9 @@ function DataTableExpandedRow({
|
|
|
5153
5205
|
}) {
|
|
5154
5206
|
if (!show) return null;
|
|
5155
5207
|
if (layout === "grid") {
|
|
5156
|
-
return /* @__PURE__ */
|
|
5208
|
+
return /* @__PURE__ */ jsx14("div", { role: "row", className: "col-span-full grid grid-cols-subgrid", children: /* @__PURE__ */ jsx14("div", { role: "cell", style: { gridColumn: `span ${colSpan}` }, className: "bg-card p-0 align-top whitespace-normal", children }) });
|
|
5157
5209
|
}
|
|
5158
|
-
return /* @__PURE__ */
|
|
5210
|
+
return /* @__PURE__ */ jsx14(BaseTableRow, { className: "hover:bg-transparent", children: /* @__PURE__ */ jsx14(BaseTableCell, { colSpan, className: "bg-card p-0 align-top whitespace-normal", children }) });
|
|
5159
5211
|
}
|
|
5160
5212
|
function DataTableBody({
|
|
5161
5213
|
tableRows,
|
|
@@ -5181,7 +5233,7 @@ function DataTableBody({
|
|
|
5181
5233
|
minSize: c.columnDef.minSize,
|
|
5182
5234
|
maxSize: c.columnDef.maxSize
|
|
5183
5235
|
}));
|
|
5184
|
-
return /* @__PURE__ */
|
|
5236
|
+
return /* @__PURE__ */ jsx14(
|
|
5185
5237
|
DataTableSkeletonBody,
|
|
5186
5238
|
{
|
|
5187
5239
|
columns: skeletonColumns,
|
|
@@ -5195,18 +5247,18 @@ function DataTableBody({
|
|
|
5195
5247
|
var _a, _b, _c, _d, _e;
|
|
5196
5248
|
if ((_a = row.getIsGrouped) == null ? void 0 : _a.call(row)) {
|
|
5197
5249
|
const groupLabel = (_c = row.groupingValue) != null ? _c : row.groupingColumnId ? (_b = row.getGroupingValue) == null ? void 0 : _b.call(row, row.groupingColumnId) : void 0;
|
|
5198
|
-
return /* @__PURE__ */
|
|
5250
|
+
return /* @__PURE__ */ jsx14(DataTableGroupRow, { groupLabel: String(groupLabel != null ? groupLabel : ""), colSpan, layout }, row.id);
|
|
5199
5251
|
}
|
|
5200
5252
|
const isExpanded = !!(((_d = row.getCanExpand) == null ? void 0 : _d.call(row)) && ((_e = row.getIsExpanded) == null ? void 0 : _e.call(row)));
|
|
5201
5253
|
const expandedRow = renderExpandedRow && isExpanded ? renderExpandedRow(row.original) : null;
|
|
5202
|
-
return /* @__PURE__ */
|
|
5203
|
-
/* @__PURE__ */
|
|
5254
|
+
return /* @__PURE__ */ jsxs12(React9.Fragment, { children: [
|
|
5255
|
+
/* @__PURE__ */ jsx14(
|
|
5204
5256
|
DataTableRow,
|
|
5205
5257
|
__spreadProps(__spreadValues({}, onRowRender ? onRowRender(row.original, row) : {}), {
|
|
5206
5258
|
"data-expanded": isExpanded || void 0,
|
|
5207
5259
|
"data-depth": row.depth || void 0,
|
|
5208
5260
|
layout,
|
|
5209
|
-
children: row.getVisibleCells().filter((cell) => !isFilterOnlyColumn(cell.column)).map((cell) => /* @__PURE__ */
|
|
5261
|
+
children: row.getVisibleCells().filter((cell) => !isFilterOnlyColumn(cell.column)).map((cell) => /* @__PURE__ */ jsx14(
|
|
5210
5262
|
DataTableCell,
|
|
5211
5263
|
{
|
|
5212
5264
|
cell,
|
|
@@ -5220,21 +5272,21 @@ function DataTableBody({
|
|
|
5220
5272
|
))
|
|
5221
5273
|
})
|
|
5222
5274
|
),
|
|
5223
|
-
/* @__PURE__ */
|
|
5275
|
+
/* @__PURE__ */ jsx14(DataTableExpandedRow, { colSpan, show: expandedRow != null, layout, children: expandedRow })
|
|
5224
5276
|
] }, row.id);
|
|
5225
5277
|
});
|
|
5226
5278
|
if (isGrid) {
|
|
5227
|
-
return /* @__PURE__ */
|
|
5279
|
+
return /* @__PURE__ */ jsx14("div", { role: "rowgroup", className: "col-span-full grid grid-cols-subgrid", children: rows });
|
|
5228
5280
|
}
|
|
5229
|
-
return /* @__PURE__ */
|
|
5281
|
+
return /* @__PURE__ */ jsx14(BaseTableBody, { children: rows });
|
|
5230
5282
|
}
|
|
5231
5283
|
|
|
5232
5284
|
// src/data-table/view-filter.tsx
|
|
5233
|
-
import * as
|
|
5285
|
+
import * as React11 from "react";
|
|
5234
5286
|
|
|
5235
5287
|
// src/filter-bar/filter-bar.tsx
|
|
5236
|
-
import * as
|
|
5237
|
-
import { Icon as
|
|
5288
|
+
import * as React10 from "react";
|
|
5289
|
+
import { Icon as Icon11 } from "@upbound/monarch-core";
|
|
5238
5290
|
import { Badge as Badge4 } from "@upbound/monarch-core";
|
|
5239
5291
|
import { Button as Button8 } from "@upbound/monarch-core";
|
|
5240
5292
|
import { ButtonGroup as ButtonGroup2, ButtonGroupText as ButtonGroupText2 } from "@upbound/monarch-core";
|
|
@@ -5264,7 +5316,7 @@ import {
|
|
|
5264
5316
|
import { Input as Input2 } from "@upbound/monarch-core";
|
|
5265
5317
|
import { Label as Label3 } from "@upbound/monarch-core";
|
|
5266
5318
|
import { Popover as Popover2, PopoverContent as PopoverContent2, PopoverTrigger as PopoverTrigger2 } from "@upbound/monarch-core";
|
|
5267
|
-
import { Fragment as Fragment8, jsx as
|
|
5319
|
+
import { Fragment as Fragment8, jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5268
5320
|
function asCheckboxValue(value) {
|
|
5269
5321
|
return Array.isArray(value) ? value : [];
|
|
5270
5322
|
}
|
|
@@ -5333,13 +5385,13 @@ function FilterBar(_a) {
|
|
|
5333
5385
|
const remainingFilters = filters.filter((f) => !usedKeys.has(f.key));
|
|
5334
5386
|
const availableFilters = filters.some(hasOrder) ? remainingFilters : sortBy(remainingFilters, (f) => f.label);
|
|
5335
5387
|
const shouldShowFilters = availableFilters.length > 0 || activeFilters.length > 0;
|
|
5336
|
-
const [pendingOpenKey, setPendingOpenKey] =
|
|
5388
|
+
const [pendingOpenKey, setPendingOpenKey] = React10.useState(null);
|
|
5337
5389
|
function handleAddFilter(key) {
|
|
5338
5390
|
onAddFilter(key);
|
|
5339
5391
|
setPendingOpenKey(key);
|
|
5340
5392
|
}
|
|
5341
|
-
const containerRef =
|
|
5342
|
-
return /* @__PURE__ */
|
|
5393
|
+
const containerRef = React10.useRef(null);
|
|
5394
|
+
return /* @__PURE__ */ jsxs13(
|
|
5343
5395
|
"div",
|
|
5344
5396
|
__spreadProps(__spreadValues({
|
|
5345
5397
|
"data-slot": "filter-bar",
|
|
@@ -5348,7 +5400,7 @@ function FilterBar(_a) {
|
|
|
5348
5400
|
ref: composeRefs(containerRef, ref)
|
|
5349
5401
|
}, props), {
|
|
5350
5402
|
children: [
|
|
5351
|
-
availableFilters.length > 0 && /* @__PURE__ */
|
|
5403
|
+
availableFilters.length > 0 && /* @__PURE__ */ jsxs13(
|
|
5352
5404
|
Combobox2,
|
|
5353
5405
|
{
|
|
5354
5406
|
items: availableFilters,
|
|
@@ -5359,14 +5411,14 @@ function FilterBar(_a) {
|
|
|
5359
5411
|
if (filter) handleAddFilter(filter.key);
|
|
5360
5412
|
},
|
|
5361
5413
|
children: [
|
|
5362
|
-
/* @__PURE__ */
|
|
5363
|
-
/* @__PURE__ */
|
|
5414
|
+
/* @__PURE__ */ jsxs13(ComboboxTrigger2, { "aria-label": "Add filter", showIndicator: false, render: /* @__PURE__ */ jsx15(Button8, { variant: "outline" }), children: [
|
|
5415
|
+
/* @__PURE__ */ jsx15(Icon11, { name: "plus", "data-icon": "inline-start" }),
|
|
5364
5416
|
"Add filter"
|
|
5365
5417
|
] }),
|
|
5366
|
-
/* @__PURE__ */
|
|
5367
|
-
/* @__PURE__ */
|
|
5368
|
-
/* @__PURE__ */
|
|
5369
|
-
/* @__PURE__ */
|
|
5418
|
+
/* @__PURE__ */ jsxs13(ComboboxContent2, { container: containerRef, align: "start", className: "w-48", children: [
|
|
5419
|
+
/* @__PURE__ */ jsx15(ComboboxInput2, { showTrigger: false, placeholder: "Search filters\u2026" }),
|
|
5420
|
+
/* @__PURE__ */ jsx15(ComboboxEmpty2, { children: "No filters found." }),
|
|
5421
|
+
/* @__PURE__ */ jsx15(ComboboxList2, { children: (filter) => /* @__PURE__ */ jsx15(ComboboxItem2, { value: filter, children: filter.label }, filter.key) })
|
|
5370
5422
|
] })
|
|
5371
5423
|
]
|
|
5372
5424
|
}
|
|
@@ -5374,7 +5426,7 @@ function FilterBar(_a) {
|
|
|
5374
5426
|
activeFilters.map((active) => {
|
|
5375
5427
|
const definition = filters.find((f) => f.key === active.key);
|
|
5376
5428
|
if (!definition) return null;
|
|
5377
|
-
return /* @__PURE__ */
|
|
5429
|
+
return /* @__PURE__ */ jsx15(
|
|
5378
5430
|
FilterChip,
|
|
5379
5431
|
{
|
|
5380
5432
|
definition,
|
|
@@ -5397,7 +5449,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
5397
5449
|
const type = (_a = definition.type) != null ? _a : "checkbox";
|
|
5398
5450
|
switch (type) {
|
|
5399
5451
|
case "checkbox":
|
|
5400
|
-
return /* @__PURE__ */
|
|
5452
|
+
return /* @__PURE__ */ jsx15(
|
|
5401
5453
|
CheckboxFilterChip,
|
|
5402
5454
|
{
|
|
5403
5455
|
definition,
|
|
@@ -5409,7 +5461,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
5409
5461
|
}
|
|
5410
5462
|
);
|
|
5411
5463
|
case "radio":
|
|
5412
|
-
return /* @__PURE__ */
|
|
5464
|
+
return /* @__PURE__ */ jsx15(
|
|
5413
5465
|
RadioFilterChip,
|
|
5414
5466
|
{
|
|
5415
5467
|
definition,
|
|
@@ -5421,7 +5473,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
5421
5473
|
}
|
|
5422
5474
|
);
|
|
5423
5475
|
case "text":
|
|
5424
|
-
return /* @__PURE__ */
|
|
5476
|
+
return /* @__PURE__ */ jsx15(
|
|
5425
5477
|
TextFilterChip,
|
|
5426
5478
|
{
|
|
5427
5479
|
definition,
|
|
@@ -5432,7 +5484,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
5432
5484
|
}
|
|
5433
5485
|
);
|
|
5434
5486
|
case "multiText":
|
|
5435
|
-
return /* @__PURE__ */
|
|
5487
|
+
return /* @__PURE__ */ jsx15(
|
|
5436
5488
|
MultiTextFilterChip,
|
|
5437
5489
|
{
|
|
5438
5490
|
definition,
|
|
@@ -5443,7 +5495,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
5443
5495
|
}
|
|
5444
5496
|
);
|
|
5445
5497
|
case "date":
|
|
5446
|
-
return /* @__PURE__ */
|
|
5498
|
+
return /* @__PURE__ */ jsx15(
|
|
5447
5499
|
DateFilterChip,
|
|
5448
5500
|
{
|
|
5449
5501
|
definition,
|
|
@@ -5456,7 +5508,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
5456
5508
|
}
|
|
5457
5509
|
}
|
|
5458
5510
|
function FilterChipRemoveButton({ label, onRemove }) {
|
|
5459
|
-
return /* @__PURE__ */
|
|
5511
|
+
return /* @__PURE__ */ jsx15(Button8, { variant: "outline", size: "icon", "aria-label": `Remove ${label} filter`, onClick: onRemove, children: /* @__PURE__ */ jsx15(Icon11, { name: "xmark" }) });
|
|
5460
5512
|
}
|
|
5461
5513
|
function CheckboxFilterChip({
|
|
5462
5514
|
definition,
|
|
@@ -5475,9 +5527,9 @@ function CheckboxFilterChip({
|
|
|
5475
5527
|
const next = values.includes(optionValue) ? values.filter((v) => v !== optionValue) : [...values, optionValue];
|
|
5476
5528
|
onChangeValue(next);
|
|
5477
5529
|
}
|
|
5478
|
-
return /* @__PURE__ */
|
|
5479
|
-
/* @__PURE__ */
|
|
5480
|
-
searchable ? /* @__PURE__ */
|
|
5530
|
+
return /* @__PURE__ */ jsxs13(ButtonGroup2, { children: [
|
|
5531
|
+
/* @__PURE__ */ jsx15(ButtonGroupText2, { children: label }),
|
|
5532
|
+
searchable ? /* @__PURE__ */ jsxs13(
|
|
5481
5533
|
Combobox2,
|
|
5482
5534
|
{
|
|
5483
5535
|
items: options,
|
|
@@ -5487,34 +5539,34 @@ function CheckboxFilterChip({
|
|
|
5487
5539
|
value: options.filter((o) => values.includes(o.value)),
|
|
5488
5540
|
onValueChange: (selected) => onChangeValue(selected.map((s) => s.value)),
|
|
5489
5541
|
children: [
|
|
5490
|
-
/* @__PURE__ */
|
|
5542
|
+
/* @__PURE__ */ jsx15(
|
|
5491
5543
|
ComboboxTrigger2,
|
|
5492
5544
|
{
|
|
5493
|
-
render: /* @__PURE__ */
|
|
5494
|
-
children: /* @__PURE__ */
|
|
5545
|
+
render: /* @__PURE__ */ jsx15(Button8, { variant: "outline", className: "gap-1 font-normal [&>svg:last-child]:size-(--icon-sm)" }),
|
|
5546
|
+
children: /* @__PURE__ */ jsx15("span", { className: values.length === 0 ? "text-muted-foreground" : "", children: displayLabel })
|
|
5495
5547
|
}
|
|
5496
5548
|
),
|
|
5497
|
-
/* @__PURE__ */
|
|
5549
|
+
/* @__PURE__ */ jsxs13(
|
|
5498
5550
|
ComboboxContent2,
|
|
5499
5551
|
{
|
|
5500
5552
|
container,
|
|
5501
5553
|
className: "min-w-64",
|
|
5502
5554
|
collisionAvoidance: { side: "none", align: "shift" },
|
|
5503
5555
|
children: [
|
|
5504
|
-
/* @__PURE__ */
|
|
5505
|
-
values.length > 0 && /* @__PURE__ */
|
|
5506
|
-
/* @__PURE__ */
|
|
5507
|
-
/* @__PURE__ */
|
|
5508
|
-
/* @__PURE__ */
|
|
5556
|
+
/* @__PURE__ */ jsx15(ComboboxInput2, { showTrigger: false, placeholder: `Search ${label.toLowerCase()}\u2026` }),
|
|
5557
|
+
values.length > 0 && /* @__PURE__ */ jsxs13(Fragment8, { children: [
|
|
5558
|
+
/* @__PURE__ */ jsxs13(ComboboxSelectedChips2, { children: [
|
|
5559
|
+
/* @__PURE__ */ jsx15(ComboboxValue2, { children: (selected) => /* @__PURE__ */ jsx15(Fragment8, { children: selected.map((item) => /* @__PURE__ */ jsx15(ComboboxChip2, { children: item.label }, item.value)) }) }),
|
|
5560
|
+
/* @__PURE__ */ jsx15(ComboboxClearAll2, { onClick: () => onChangeValue([]) })
|
|
5509
5561
|
] }),
|
|
5510
|
-
/* @__PURE__ */
|
|
5562
|
+
/* @__PURE__ */ jsx15(ComboboxSeparator2, {})
|
|
5511
5563
|
] }),
|
|
5512
|
-
/* @__PURE__ */
|
|
5564
|
+
/* @__PURE__ */ jsxs13(ComboboxEmpty2, { children: [
|
|
5513
5565
|
"No ",
|
|
5514
5566
|
label.toLowerCase(),
|
|
5515
5567
|
" found."
|
|
5516
5568
|
] }),
|
|
5517
|
-
/* @__PURE__ */
|
|
5569
|
+
/* @__PURE__ */ jsx15(ComboboxList2, { children: (item) => /* @__PURE__ */ jsxs13(ComboboxItem2, { value: item, children: [
|
|
5518
5570
|
item.icon,
|
|
5519
5571
|
item.label
|
|
5520
5572
|
] }, item.value) })
|
|
@@ -5523,12 +5575,12 @@ function CheckboxFilterChip({
|
|
|
5523
5575
|
)
|
|
5524
5576
|
]
|
|
5525
5577
|
}
|
|
5526
|
-
) : /* @__PURE__ */
|
|
5527
|
-
/* @__PURE__ */
|
|
5528
|
-
/* @__PURE__ */
|
|
5529
|
-
/* @__PURE__ */
|
|
5578
|
+
) : /* @__PURE__ */ jsxs13(DropdownMenu5, { defaultOpen: autoOpen, children: [
|
|
5579
|
+
/* @__PURE__ */ jsx15(DropdownMenuTrigger5, { asChild: true, children: /* @__PURE__ */ jsxs13(Button8, { variant: "outline", className: "gap-1 font-normal", children: [
|
|
5580
|
+
/* @__PURE__ */ jsx15("span", { className: values.length === 0 ? "text-muted-foreground" : "", children: displayLabel }),
|
|
5581
|
+
/* @__PURE__ */ jsx15(Icon11, { name: "chevron-down", size: "sm", className: "text-muted-foreground" })
|
|
5530
5582
|
] }) }),
|
|
5531
|
-
/* @__PURE__ */
|
|
5583
|
+
/* @__PURE__ */ jsx15(DropdownMenuContent5, { align: "start", className: "w-48", children: options.map((opt) => /* @__PURE__ */ jsxs13(
|
|
5532
5584
|
DropdownMenuCheckboxItem2,
|
|
5533
5585
|
{
|
|
5534
5586
|
checked: values.includes(opt.value),
|
|
@@ -5541,7 +5593,7 @@ function CheckboxFilterChip({
|
|
|
5541
5593
|
opt.value
|
|
5542
5594
|
)) })
|
|
5543
5595
|
] }),
|
|
5544
|
-
/* @__PURE__ */
|
|
5596
|
+
/* @__PURE__ */ jsx15(FilterChipRemoveButton, { label, onRemove })
|
|
5545
5597
|
] });
|
|
5546
5598
|
}
|
|
5547
5599
|
function RadioFilterChip({
|
|
@@ -5558,9 +5610,9 @@ function RadioFilterChip({
|
|
|
5558
5610
|
const selectedValue = asRadioValue(value);
|
|
5559
5611
|
const displayLabel = selectedValue ? (_b = (_a = options.find((o) => o.value === selectedValue)) == null ? void 0 : _a.label) != null ? _b : selectedValue : "Any";
|
|
5560
5612
|
const selected = (_c = options.find((o) => o.value === selectedValue)) != null ? _c : null;
|
|
5561
|
-
return /* @__PURE__ */
|
|
5562
|
-
/* @__PURE__ */
|
|
5563
|
-
searchable ? /* @__PURE__ */
|
|
5613
|
+
return /* @__PURE__ */ jsxs13(ButtonGroup2, { children: [
|
|
5614
|
+
/* @__PURE__ */ jsx15(ButtonGroupText2, { children: label }),
|
|
5615
|
+
searchable ? /* @__PURE__ */ jsxs13(
|
|
5564
5616
|
Combobox2,
|
|
5565
5617
|
{
|
|
5566
5618
|
items: options,
|
|
@@ -5572,27 +5624,27 @@ function RadioFilterChip({
|
|
|
5572
5624
|
return onChangeValue((_a2 = next == null ? void 0 : next.value) != null ? _a2 : "");
|
|
5573
5625
|
},
|
|
5574
5626
|
children: [
|
|
5575
|
-
/* @__PURE__ */
|
|
5627
|
+
/* @__PURE__ */ jsx15(
|
|
5576
5628
|
ComboboxTrigger2,
|
|
5577
5629
|
{
|
|
5578
|
-
render: /* @__PURE__ */
|
|
5579
|
-
children: /* @__PURE__ */
|
|
5630
|
+
render: /* @__PURE__ */ jsx15(Button8, { variant: "outline", className: "gap-1 font-normal [&>svg:last-child]:size-(--icon-sm)" }),
|
|
5631
|
+
children: /* @__PURE__ */ jsx15("span", { className: selectedValue ? "" : "text-muted-foreground", children: displayLabel })
|
|
5580
5632
|
}
|
|
5581
5633
|
),
|
|
5582
|
-
/* @__PURE__ */
|
|
5634
|
+
/* @__PURE__ */ jsxs13(
|
|
5583
5635
|
ComboboxContent2,
|
|
5584
5636
|
{
|
|
5585
5637
|
container,
|
|
5586
5638
|
className: "min-w-64",
|
|
5587
5639
|
collisionAvoidance: { side: "none", align: "shift" },
|
|
5588
5640
|
children: [
|
|
5589
|
-
/* @__PURE__ */
|
|
5590
|
-
/* @__PURE__ */
|
|
5641
|
+
/* @__PURE__ */ jsx15(ComboboxInput2, { showTrigger: false, placeholder: `Search ${label.toLowerCase()}\u2026` }),
|
|
5642
|
+
/* @__PURE__ */ jsxs13(ComboboxEmpty2, { children: [
|
|
5591
5643
|
"No ",
|
|
5592
5644
|
label.toLowerCase(),
|
|
5593
5645
|
" found."
|
|
5594
5646
|
] }),
|
|
5595
|
-
/* @__PURE__ */
|
|
5647
|
+
/* @__PURE__ */ jsx15(ComboboxList2, { children: (item) => /* @__PURE__ */ jsxs13(ComboboxItem2, { value: item, children: [
|
|
5596
5648
|
item.icon,
|
|
5597
5649
|
item.label
|
|
5598
5650
|
] }, item.value) })
|
|
@@ -5601,17 +5653,17 @@ function RadioFilterChip({
|
|
|
5601
5653
|
)
|
|
5602
5654
|
]
|
|
5603
5655
|
}
|
|
5604
|
-
) : /* @__PURE__ */
|
|
5605
|
-
/* @__PURE__ */
|
|
5606
|
-
/* @__PURE__ */
|
|
5607
|
-
/* @__PURE__ */
|
|
5656
|
+
) : /* @__PURE__ */ jsxs13(DropdownMenu5, { defaultOpen: autoOpen, children: [
|
|
5657
|
+
/* @__PURE__ */ jsx15(DropdownMenuTrigger5, { asChild: true, children: /* @__PURE__ */ jsxs13(Button8, { variant: "outline", className: "gap-1 font-normal", children: [
|
|
5658
|
+
/* @__PURE__ */ jsx15("span", { className: selectedValue ? "" : "text-muted-foreground", children: displayLabel }),
|
|
5659
|
+
/* @__PURE__ */ jsx15(Icon11, { name: "chevron-down", size: "sm", className: "text-muted-foreground" })
|
|
5608
5660
|
] }) }),
|
|
5609
|
-
/* @__PURE__ */
|
|
5661
|
+
/* @__PURE__ */ jsx15(DropdownMenuContent5, { align: "start", className: "w-48", children: /* @__PURE__ */ jsx15(DropdownMenuRadioGroup, { value: selectedValue, onValueChange: onChangeValue, children: options.map((opt) => /* @__PURE__ */ jsxs13(DropdownMenuRadioItem, { value: opt.value, children: [
|
|
5610
5662
|
opt.icon,
|
|
5611
5663
|
opt.label
|
|
5612
5664
|
] }, opt.value)) }) })
|
|
5613
5665
|
] }),
|
|
5614
|
-
/* @__PURE__ */
|
|
5666
|
+
/* @__PURE__ */ jsx15(FilterChipRemoveButton, { label, onRemove })
|
|
5615
5667
|
] });
|
|
5616
5668
|
}
|
|
5617
5669
|
function TextFilterChip({
|
|
@@ -5623,12 +5675,12 @@ function TextFilterChip({
|
|
|
5623
5675
|
}) {
|
|
5624
5676
|
const { label, placeholder } = definition;
|
|
5625
5677
|
const text = asTextValue(value);
|
|
5626
|
-
const [open, setOpen] =
|
|
5627
|
-
return /* @__PURE__ */
|
|
5628
|
-
/* @__PURE__ */
|
|
5629
|
-
/* @__PURE__ */
|
|
5630
|
-
/* @__PURE__ */
|
|
5631
|
-
/* @__PURE__ */
|
|
5678
|
+
const [open, setOpen] = React10.useState(!!autoOpen);
|
|
5679
|
+
return /* @__PURE__ */ jsxs13(ButtonGroup2, { children: [
|
|
5680
|
+
/* @__PURE__ */ jsx15(ButtonGroupText2, { children: label }),
|
|
5681
|
+
/* @__PURE__ */ jsxs13(Popover2, { open, onOpenChange: setOpen, children: [
|
|
5682
|
+
/* @__PURE__ */ jsx15(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx15(Button8, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx15("span", { className: text ? "" : "text-muted-foreground", children: text || "Any" }) }) }),
|
|
5683
|
+
/* @__PURE__ */ jsx15(PopoverContent2, { align: "start", children: /* @__PURE__ */ jsx15(
|
|
5632
5684
|
Input2,
|
|
5633
5685
|
{
|
|
5634
5686
|
autoFocus: true,
|
|
@@ -5641,7 +5693,7 @@ function TextFilterChip({
|
|
|
5641
5693
|
}
|
|
5642
5694
|
) })
|
|
5643
5695
|
] }),
|
|
5644
|
-
/* @__PURE__ */
|
|
5696
|
+
/* @__PURE__ */ jsx15(FilterChipRemoveButton, { label, onRemove })
|
|
5645
5697
|
] });
|
|
5646
5698
|
}
|
|
5647
5699
|
function MultiTextFilterChip({
|
|
@@ -5653,7 +5705,7 @@ function MultiTextFilterChip({
|
|
|
5653
5705
|
}) {
|
|
5654
5706
|
const { label, placeholder } = definition;
|
|
5655
5707
|
const tokens = asMultiTextValue(value);
|
|
5656
|
-
const [draft, setDraft] =
|
|
5708
|
+
const [draft, setDraft] = React10.useState("");
|
|
5657
5709
|
const displayLabel = tokens.length === 0 ? "Any" : tokens.length === 1 ? tokens[0] : `${tokens.length} values`;
|
|
5658
5710
|
function addToken() {
|
|
5659
5711
|
const token = draft.trim();
|
|
@@ -5667,25 +5719,25 @@ function MultiTextFilterChip({
|
|
|
5667
5719
|
function removeToken(token) {
|
|
5668
5720
|
onChangeValue(tokens.filter((t) => t !== token));
|
|
5669
5721
|
}
|
|
5670
|
-
return /* @__PURE__ */
|
|
5671
|
-
/* @__PURE__ */
|
|
5672
|
-
/* @__PURE__ */
|
|
5673
|
-
/* @__PURE__ */
|
|
5674
|
-
/* @__PURE__ */
|
|
5675
|
-
tokens.length > 0 && /* @__PURE__ */
|
|
5722
|
+
return /* @__PURE__ */ jsxs13(ButtonGroup2, { children: [
|
|
5723
|
+
/* @__PURE__ */ jsx15(ButtonGroupText2, { children: label }),
|
|
5724
|
+
/* @__PURE__ */ jsxs13(Popover2, { defaultOpen: autoOpen, children: [
|
|
5725
|
+
/* @__PURE__ */ jsx15(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx15(Button8, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx15("span", { className: tokens.length === 0 ? "text-muted-foreground" : "", children: displayLabel }) }) }),
|
|
5726
|
+
/* @__PURE__ */ jsx15(PopoverContent2, { align: "start", children: /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-2", children: [
|
|
5727
|
+
tokens.length > 0 && /* @__PURE__ */ jsx15("div", { className: "flex flex-wrap gap-1", children: tokens.map((token) => /* @__PURE__ */ jsxs13(Badge4, { variant: "secondary", className: "gap-1", children: [
|
|
5676
5728
|
token,
|
|
5677
|
-
/* @__PURE__ */
|
|
5729
|
+
/* @__PURE__ */ jsx15(
|
|
5678
5730
|
"button",
|
|
5679
5731
|
{
|
|
5680
5732
|
type: "button",
|
|
5681
5733
|
"aria-label": `Remove ${token}`,
|
|
5682
5734
|
onClick: () => removeToken(token),
|
|
5683
5735
|
className: "cursor-pointer",
|
|
5684
|
-
children: /* @__PURE__ */
|
|
5736
|
+
children: /* @__PURE__ */ jsx15(Icon11, { name: "xmark", size: "xs" })
|
|
5685
5737
|
}
|
|
5686
5738
|
)
|
|
5687
5739
|
] }, token)) }),
|
|
5688
|
-
/* @__PURE__ */
|
|
5740
|
+
/* @__PURE__ */ jsx15(
|
|
5689
5741
|
Input2,
|
|
5690
5742
|
{
|
|
5691
5743
|
autoFocus: true,
|
|
@@ -5704,7 +5756,7 @@ function MultiTextFilterChip({
|
|
|
5704
5756
|
)
|
|
5705
5757
|
] }) })
|
|
5706
5758
|
] }),
|
|
5707
|
-
/* @__PURE__ */
|
|
5759
|
+
/* @__PURE__ */ jsx15(FilterChipRemoveButton, { label, onRemove })
|
|
5708
5760
|
] });
|
|
5709
5761
|
}
|
|
5710
5762
|
function DateFilterChip({
|
|
@@ -5734,12 +5786,12 @@ function DateFilterChip({
|
|
|
5734
5786
|
if (!endDate) return;
|
|
5735
5787
|
onChangeValue({ startDate, endDate: applyTimeToDate(endDate, time) });
|
|
5736
5788
|
}
|
|
5737
|
-
return /* @__PURE__ */
|
|
5738
|
-
/* @__PURE__ */
|
|
5739
|
-
/* @__PURE__ */
|
|
5740
|
-
/* @__PURE__ */
|
|
5741
|
-
/* @__PURE__ */
|
|
5742
|
-
/* @__PURE__ */
|
|
5789
|
+
return /* @__PURE__ */ jsxs13(ButtonGroup2, { children: [
|
|
5790
|
+
/* @__PURE__ */ jsx15(ButtonGroupText2, { children: label }),
|
|
5791
|
+
/* @__PURE__ */ jsxs13(Popover2, { defaultOpen: autoOpen, children: [
|
|
5792
|
+
/* @__PURE__ */ jsx15(PopoverTrigger2, { asChild: true, children: /* @__PURE__ */ jsx15(Button8, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx15("span", { className: startDate ? "" : "text-muted-foreground", children: displayLabel }) }) }),
|
|
5793
|
+
/* @__PURE__ */ jsx15(PopoverContent2, { align: "start", className: "w-fit", children: /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-2", children: [
|
|
5794
|
+
/* @__PURE__ */ jsx15(
|
|
5743
5795
|
Calendar2,
|
|
5744
5796
|
{
|
|
5745
5797
|
mode: "range",
|
|
@@ -5747,9 +5799,9 @@ function DateFilterChip({
|
|
|
5747
5799
|
onSelect: pickRange
|
|
5748
5800
|
}
|
|
5749
5801
|
),
|
|
5750
|
-
showTimeInputs && /* @__PURE__ */
|
|
5751
|
-
/* @__PURE__ */
|
|
5752
|
-
/* @__PURE__ */
|
|
5802
|
+
showTimeInputs && /* @__PURE__ */ jsxs13("div", { className: "flex flex-col gap-2", children: [
|
|
5803
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex w-full items-center gap-2", children: [
|
|
5804
|
+
/* @__PURE__ */ jsx15(
|
|
5753
5805
|
Label3,
|
|
5754
5806
|
{
|
|
5755
5807
|
htmlFor: `${definition.key}-start-time`,
|
|
@@ -5757,7 +5809,7 @@ function DateFilterChip({
|
|
|
5757
5809
|
children: "Start"
|
|
5758
5810
|
}
|
|
5759
5811
|
),
|
|
5760
|
-
/* @__PURE__ */
|
|
5812
|
+
/* @__PURE__ */ jsx15(
|
|
5761
5813
|
Input2,
|
|
5762
5814
|
{
|
|
5763
5815
|
id: `${definition.key}-start-time`,
|
|
@@ -5769,8 +5821,8 @@ function DateFilterChip({
|
|
|
5769
5821
|
}
|
|
5770
5822
|
)
|
|
5771
5823
|
] }),
|
|
5772
|
-
/* @__PURE__ */
|
|
5773
|
-
/* @__PURE__ */
|
|
5824
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex w-full items-center gap-2", children: [
|
|
5825
|
+
/* @__PURE__ */ jsx15(
|
|
5774
5826
|
Label3,
|
|
5775
5827
|
{
|
|
5776
5828
|
htmlFor: `${definition.key}-end-time`,
|
|
@@ -5778,7 +5830,7 @@ function DateFilterChip({
|
|
|
5778
5830
|
children: "End"
|
|
5779
5831
|
}
|
|
5780
5832
|
),
|
|
5781
|
-
/* @__PURE__ */
|
|
5833
|
+
/* @__PURE__ */ jsx15(
|
|
5782
5834
|
Input2,
|
|
5783
5835
|
{
|
|
5784
5836
|
id: `${definition.key}-end-time`,
|
|
@@ -5793,7 +5845,7 @@ function DateFilterChip({
|
|
|
5793
5845
|
] })
|
|
5794
5846
|
] }) })
|
|
5795
5847
|
] }),
|
|
5796
|
-
/* @__PURE__ */
|
|
5848
|
+
/* @__PURE__ */ jsx15(FilterChipRemoveButton, { label, onRemove })
|
|
5797
5849
|
] });
|
|
5798
5850
|
}
|
|
5799
5851
|
|
|
@@ -5804,7 +5856,7 @@ var isCheckboxColumnFilter = (definition) => definition.type === "checkbox";
|
|
|
5804
5856
|
var isMultiTextColumnFilter = (definition) => definition.type === "multiText";
|
|
5805
5857
|
|
|
5806
5858
|
// src/data-table/view-filter.tsx
|
|
5807
|
-
import { jsx as
|
|
5859
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
5808
5860
|
function toFilterOption(opt) {
|
|
5809
5861
|
return typeof opt === "string" ? { value: opt, label: opt } : { value: opt.value, label: opt.label };
|
|
5810
5862
|
}
|
|
@@ -5847,7 +5899,7 @@ function ViewFilter({
|
|
|
5847
5899
|
onColumnFiltersChange,
|
|
5848
5900
|
className
|
|
5849
5901
|
}) {
|
|
5850
|
-
const filterableColumns =
|
|
5902
|
+
const filterableColumns = React11.useMemo(
|
|
5851
5903
|
() => columns.filter((column) => !isFilterOnlyColumn(column) && column.getCanFilter()).flatMap((column) => {
|
|
5852
5904
|
var _a;
|
|
5853
5905
|
const filter = (_a = column.columnDef.meta) == null ? void 0 : _a.filter;
|
|
@@ -5855,7 +5907,7 @@ function ViewFilter({
|
|
|
5855
5907
|
}),
|
|
5856
5908
|
[columns]
|
|
5857
5909
|
);
|
|
5858
|
-
const filterDefinitions =
|
|
5910
|
+
const filterDefinitions = React11.useMemo(
|
|
5859
5911
|
() => filterableColumns.map(({ key, filter }) => toFilterBarDefinition(key, filter)).sort((a, b) => {
|
|
5860
5912
|
if (a.order == null && b.order == null) return 0;
|
|
5861
5913
|
if (a.order == null) return 1;
|
|
@@ -5864,15 +5916,15 @@ function ViewFilter({
|
|
|
5864
5916
|
}),
|
|
5865
5917
|
[filterableColumns]
|
|
5866
5918
|
);
|
|
5867
|
-
const emptyValueByKey =
|
|
5919
|
+
const emptyValueByKey = React11.useMemo(
|
|
5868
5920
|
() => new Map(filterableColumns.map(({ key, filter }) => [key, emptyValueFor(filter)])),
|
|
5869
5921
|
[filterableColumns]
|
|
5870
5922
|
);
|
|
5871
|
-
const activeFilters =
|
|
5923
|
+
const activeFilters = React11.useMemo(
|
|
5872
5924
|
() => columnFilters.map((filter) => ({ key: filter.id, value: filter.value })),
|
|
5873
5925
|
[columnFilters]
|
|
5874
5926
|
);
|
|
5875
|
-
return /* @__PURE__ */
|
|
5927
|
+
return /* @__PURE__ */ jsx16(
|
|
5876
5928
|
FilterBar,
|
|
5877
5929
|
{
|
|
5878
5930
|
className,
|
|
@@ -5886,10 +5938,10 @@ function ViewFilter({
|
|
|
5886
5938
|
}
|
|
5887
5939
|
|
|
5888
5940
|
// src/section-header.tsx
|
|
5889
|
-
import { jsx as
|
|
5941
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
5890
5942
|
function SectionHeader(_a) {
|
|
5891
5943
|
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
5892
|
-
return /* @__PURE__ */
|
|
5944
|
+
return /* @__PURE__ */ jsx17(
|
|
5893
5945
|
"div",
|
|
5894
5946
|
__spreadProps(__spreadValues({
|
|
5895
5947
|
"data-slot": "section-header",
|
|
@@ -5901,19 +5953,19 @@ function SectionHeader(_a) {
|
|
|
5901
5953
|
}
|
|
5902
5954
|
function SectionHeaderContent(_a) {
|
|
5903
5955
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
5904
|
-
return /* @__PURE__ */
|
|
5956
|
+
return /* @__PURE__ */ jsx17("div", __spreadValues({ "data-slot": "section-header-content", className: cn("flex flex-col gap-1", className) }, props));
|
|
5905
5957
|
}
|
|
5906
5958
|
function SectionHeaderTitle(_a) {
|
|
5907
5959
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
5908
|
-
return /* @__PURE__ */
|
|
5960
|
+
return /* @__PURE__ */ jsx17("h2", __spreadValues({ "data-slot": "section-header-title", className: cn("text-h3 text-foreground", className) }, props));
|
|
5909
5961
|
}
|
|
5910
5962
|
function SectionHeaderDescription(_a) {
|
|
5911
5963
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
5912
|
-
return /* @__PURE__ */
|
|
5964
|
+
return /* @__PURE__ */ jsx17("p", __spreadValues({ "data-slot": "section-header-description", className: cn("text-body text-muted-foreground", className) }, props));
|
|
5913
5965
|
}
|
|
5914
5966
|
function SectionHeaderMeta(_a) {
|
|
5915
5967
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
5916
|
-
return /* @__PURE__ */
|
|
5968
|
+
return /* @__PURE__ */ jsx17(
|
|
5917
5969
|
"div",
|
|
5918
5970
|
__spreadValues({
|
|
5919
5971
|
"data-slot": "section-header-meta",
|
|
@@ -5927,15 +5979,15 @@ function SectionHeaderMeta(_a) {
|
|
|
5927
5979
|
}
|
|
5928
5980
|
function SectionHeaderActions(_a) {
|
|
5929
5981
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
5930
|
-
return /* @__PURE__ */
|
|
5982
|
+
return /* @__PURE__ */ jsx17("div", __spreadValues({ "data-slot": "section-header-actions", className: cn("flex items-center gap-2", className) }, props));
|
|
5931
5983
|
}
|
|
5932
5984
|
function SectionHeaderTabs(_a) {
|
|
5933
5985
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
5934
|
-
return /* @__PURE__ */
|
|
5986
|
+
return /* @__PURE__ */ jsx17("div", __spreadValues({ "data-slot": "section-header-tabs", className: cn("border-b", className) }, props));
|
|
5935
5987
|
}
|
|
5936
5988
|
|
|
5937
5989
|
// src/data-table/data-table.tsx
|
|
5938
|
-
import { Fragment as Fragment9, jsx as
|
|
5990
|
+
import { Fragment as Fragment9, jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5939
5991
|
var DEFAULT_PAGE_SIZE = 20;
|
|
5940
5992
|
var noop = () => {
|
|
5941
5993
|
};
|
|
@@ -5993,23 +6045,21 @@ function DataTable({
|
|
|
5993
6045
|
celFilterConfig,
|
|
5994
6046
|
filterVisibility
|
|
5995
6047
|
}) {
|
|
5996
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
6048
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
5997
6049
|
const isGrid = layout === "grid";
|
|
5998
|
-
const
|
|
5999
|
-
const
|
|
6000
|
-
const
|
|
6001
|
-
const [
|
|
6002
|
-
const [
|
|
6003
|
-
const [
|
|
6004
|
-
const [
|
|
6005
|
-
const [innerColumnPinning, setInnerColumnPinning] = React11.useState({ start: [], end: [] });
|
|
6006
|
-
const [innerPagination, setInnerPagination] = React11.useState({
|
|
6050
|
+
const tableBodyScrollRef = React12.useRef(null);
|
|
6051
|
+
const [innerGlobalFilter, setInnerGlobalFilter] = React12.useState("");
|
|
6052
|
+
const [innerColumnOrdering, setInnerColumnOrdering] = React12.useState([]);
|
|
6053
|
+
const [innerColumnFilters, setInnerColumnFilters] = React12.useState([]);
|
|
6054
|
+
const [innerSorting, setInnerSorting] = React12.useState(((_a = config.state) == null ? void 0 : _a.sorting) || []);
|
|
6055
|
+
const [innerColumnPinning, setInnerColumnPinning] = React12.useState({ start: [], end: [] });
|
|
6056
|
+
const [innerPagination, setInnerPagination] = React12.useState({
|
|
6007
6057
|
pageIndex: ((_c = (_b = config.state) == null ? void 0 : _b.pagination) == null ? void 0 : _c.pageIndex) || 0,
|
|
6008
6058
|
pageSize: ((_e = (_d = config.state) == null ? void 0 : _d.pagination) == null ? void 0 : _e.pageSize) || DEFAULT_PAGE_SIZE
|
|
6009
6059
|
});
|
|
6010
|
-
const [innerGrouping, setInnerGrouping] =
|
|
6011
|
-
const [innerColumnVisibility, setInnerColumnVisibility] =
|
|
6012
|
-
const [innerExpanded, setInnerExpanded] =
|
|
6060
|
+
const [innerGrouping, setInnerGrouping] = React12.useState([]);
|
|
6061
|
+
const [innerColumnVisibility, setInnerColumnVisibility] = React12.useState({});
|
|
6062
|
+
const [innerExpanded, setInnerExpanded] = React12.useState({});
|
|
6013
6063
|
const {
|
|
6014
6064
|
columnSizing,
|
|
6015
6065
|
handleColumnSizingChange,
|
|
@@ -6026,6 +6076,9 @@ function DataTable({
|
|
|
6026
6076
|
filterRowVisible,
|
|
6027
6077
|
setFilterRowVisible
|
|
6028
6078
|
} = useFilterVisibility(filterVisibility);
|
|
6079
|
+
if (parentGlobalFilter !== void 0 && parentGlobalFilter !== innerGlobalFilter) {
|
|
6080
|
+
setInnerGlobalFilter(parentGlobalFilter);
|
|
6081
|
+
}
|
|
6029
6082
|
const globalFilter = parentGlobalFilter != null ? parentGlobalFilter : innerGlobalFilter;
|
|
6030
6083
|
const applyGlobalFilter = parentSetGlobalFilter != null ? parentSetGlobalFilter : setInnerGlobalFilter;
|
|
6031
6084
|
const columnFilters = parentColumnFilters || innerColumnFilters;
|
|
@@ -6033,25 +6086,25 @@ function DataTable({
|
|
|
6033
6086
|
const pagination = parentPagination || innerPagination;
|
|
6034
6087
|
const setPagination = parentSetPagination != null ? parentSetPagination : setInnerPagination;
|
|
6035
6088
|
const shouldDisablePagination = paginationConfig === false;
|
|
6036
|
-
const resetPageIndexOnFilterChange =
|
|
6089
|
+
const resetPageIndexOnFilterChange = React12.useCallback(() => {
|
|
6037
6090
|
if (!serverSidePagination || pagination.pageIndex === 0) return;
|
|
6038
6091
|
setPagination((prev) => __spreadProps(__spreadValues({}, prev), { pageIndex: 0 }));
|
|
6039
6092
|
}, [serverSidePagination, pagination.pageIndex, setPagination]);
|
|
6040
|
-
const setGlobalFilter =
|
|
6093
|
+
const setGlobalFilter = React12.useCallback(
|
|
6041
6094
|
(value) => {
|
|
6042
6095
|
applyGlobalFilter(value);
|
|
6043
6096
|
resetPageIndexOnFilterChange();
|
|
6044
6097
|
},
|
|
6045
6098
|
[applyGlobalFilter, resetPageIndexOnFilterChange]
|
|
6046
6099
|
);
|
|
6047
|
-
const setColumnFilters =
|
|
6100
|
+
const setColumnFilters = React12.useCallback(
|
|
6048
6101
|
(value) => {
|
|
6049
6102
|
applyColumnFilters(value);
|
|
6050
6103
|
resetPageIndexOnFilterChange();
|
|
6051
6104
|
},
|
|
6052
6105
|
[applyColumnFilters, resetPageIndexOnFilterChange]
|
|
6053
6106
|
);
|
|
6054
|
-
|
|
6107
|
+
React12.useLayoutEffect(() => {
|
|
6055
6108
|
var _a2;
|
|
6056
6109
|
if (shouldDisablePagination) return;
|
|
6057
6110
|
(_a2 = tableBodyScrollRef.current) == null ? void 0 : _a2.scrollTo({ top: 0 });
|
|
@@ -6133,7 +6186,7 @@ function DataTable({
|
|
|
6133
6186
|
const orderedVisibleColumns = table.getVisibleLeafColumns().filter((col) => !isFilterOnlyColumn(col));
|
|
6134
6187
|
const hasFilters = !!celFilterConfig || hasFilterableColumns(flatColumns);
|
|
6135
6188
|
const showFilterToggle = filterToggleRequested && !disableFilters && hasFilters;
|
|
6136
|
-
const [gridMeasuredMins, setGridMeasuredMins] =
|
|
6189
|
+
const [gridMeasuredMins, setGridMeasuredMins] = React12.useState({});
|
|
6137
6190
|
const { gridTemplateColumns, gridRootRef, handleAutosizeAll, handleAutosizeColumn, handleResetColumnSize } = useGridLayout({
|
|
6138
6191
|
layout,
|
|
6139
6192
|
table,
|
|
@@ -6147,7 +6200,7 @@ function DataTable({
|
|
|
6147
6200
|
rawHandleAutosizeColumn,
|
|
6148
6201
|
rawHandleResetColumnSize
|
|
6149
6202
|
});
|
|
6150
|
-
const handleContextCell =
|
|
6203
|
+
const handleContextCell = React12.useCallback(
|
|
6151
6204
|
(filter, cell) => {
|
|
6152
6205
|
var _a2, _b2;
|
|
6153
6206
|
if (celFilterConfig == null ? void 0 : celFilterConfig.onContextualFilter) {
|
|
@@ -6164,13 +6217,13 @@ function DataTable({
|
|
|
6164
6217
|
},
|
|
6165
6218
|
[celFilterConfig, onContextCell, setColumnFilters, table]
|
|
6166
6219
|
);
|
|
6167
|
-
const handleContextSearch =
|
|
6220
|
+
const handleContextSearch = React12.useCallback(
|
|
6168
6221
|
(searchTerm) => {
|
|
6169
6222
|
setGlobalFilter(searchTerm);
|
|
6170
6223
|
},
|
|
6171
6224
|
[setGlobalFilter]
|
|
6172
6225
|
);
|
|
6173
|
-
const totalTableWidth =
|
|
6226
|
+
const totalTableWidth = React12.useMemo(() => {
|
|
6174
6227
|
if (isGrid) return 0;
|
|
6175
6228
|
const firstGroup = headerGroups[0];
|
|
6176
6229
|
if (!firstGroup) return 0;
|
|
@@ -6194,12 +6247,7 @@ function DataTable({
|
|
|
6194
6247
|
}
|
|
6195
6248
|
setGlobalFilter("");
|
|
6196
6249
|
};
|
|
6197
|
-
|
|
6198
|
-
if (parentGlobalFilter !== void 0) {
|
|
6199
|
-
setInnerGlobalFilter(parentGlobalFilter);
|
|
6200
|
-
}
|
|
6201
|
-
}, [parentGlobalFilter]);
|
|
6202
|
-
React11.useEffect(() => {
|
|
6250
|
+
React12.useEffect(() => {
|
|
6203
6251
|
if (disableColumnReordering) return;
|
|
6204
6252
|
const allColumnIds = flatColumns.map((col) => col.id);
|
|
6205
6253
|
const normalizedColumnOrdering = normalizeColumnOrdering(columnOrdering, allColumnIds);
|
|
@@ -6208,38 +6256,18 @@ function DataTable({
|
|
|
6208
6256
|
}
|
|
6209
6257
|
}, [columnOrdering, disableColumnReordering, flatColumns, setColumnOrdering]);
|
|
6210
6258
|
const showViewHeader = !!title || !!Actions;
|
|
6211
|
-
const showClearSearchButton = globalFilter && !shouldDisable;
|
|
6212
6259
|
const showColumnOptions = !disableColumnReordering || !disableColumnVisibility;
|
|
6213
|
-
const toolbarSearch = !disableSearch && /* @__PURE__ */
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
value: globalFilter,
|
|
6225
|
-
onChange: (e) => setGlobalFilter(e.target.value)
|
|
6226
|
-
})
|
|
6227
|
-
),
|
|
6228
|
-
!!showClearSearchButton && /* @__PURE__ */ jsx17(InputGroupAddon4, { align: "inline-end", children: /* @__PURE__ */ jsx17(
|
|
6229
|
-
InputGroupButton2,
|
|
6230
|
-
{
|
|
6231
|
-
size: "icon-xs",
|
|
6232
|
-
"aria-label": "Clear search",
|
|
6233
|
-
onClick: () => {
|
|
6234
|
-
var _a2;
|
|
6235
|
-
setGlobalFilter("");
|
|
6236
|
-
(_a2 = searchInputRef.current) == null ? void 0 : _a2.focus();
|
|
6237
|
-
},
|
|
6238
|
-
children: /* @__PURE__ */ jsx17(Icon11, { name: "xmark" })
|
|
6239
|
-
}
|
|
6240
|
-
) })
|
|
6241
|
-
] });
|
|
6242
|
-
const toolbarColumns = !!showColumnOptions && /* @__PURE__ */ jsx17(
|
|
6260
|
+
const toolbarSearch = !disableSearch && /* @__PURE__ */ jsx18(
|
|
6261
|
+
DataTableSearch,
|
|
6262
|
+
{
|
|
6263
|
+
value: globalFilter,
|
|
6264
|
+
onValueChange: setGlobalFilter,
|
|
6265
|
+
placeholder: search == null ? void 0 : search.placeholder,
|
|
6266
|
+
className: search == null ? void 0 : search.className,
|
|
6267
|
+
disabled: shouldDisable
|
|
6268
|
+
}
|
|
6269
|
+
);
|
|
6270
|
+
const toolbarColumns = !!showColumnOptions && /* @__PURE__ */ jsx18(
|
|
6243
6271
|
ColumnOptions,
|
|
6244
6272
|
{
|
|
6245
6273
|
columns: flatColumns,
|
|
@@ -6248,7 +6276,7 @@ function DataTable({
|
|
|
6248
6276
|
disableColumnOrdering: disableColumnReordering
|
|
6249
6277
|
}
|
|
6250
6278
|
);
|
|
6251
|
-
return /* @__PURE__ */
|
|
6279
|
+
return /* @__PURE__ */ jsxs14(
|
|
6252
6280
|
"div",
|
|
6253
6281
|
{
|
|
6254
6282
|
id: `table-${id}`,
|
|
@@ -6259,19 +6287,19 @@ function DataTable({
|
|
|
6259
6287
|
className
|
|
6260
6288
|
),
|
|
6261
6289
|
children: [
|
|
6262
|
-
showViewHeader && /* @__PURE__ */
|
|
6263
|
-
!!title && /* @__PURE__ */
|
|
6264
|
-
!!description && /* @__PURE__ */
|
|
6290
|
+
showViewHeader && /* @__PURE__ */ jsx18(SectionHeader, { className: "mb-4 flex w-full gap-2", children: /* @__PURE__ */ jsxs14(SectionHeaderContent, { children: [
|
|
6291
|
+
!!title && /* @__PURE__ */ jsx18(SectionHeaderTitle, { children: title }),
|
|
6292
|
+
!!description && /* @__PURE__ */ jsx18(SectionHeaderDescription, { children: description })
|
|
6265
6293
|
] }) }),
|
|
6266
|
-
/* @__PURE__ */
|
|
6294
|
+
/* @__PURE__ */ jsxs14("div", { className: "mb-4 flex flex-row gap-2", children: [
|
|
6267
6295
|
toolbarSearch,
|
|
6268
|
-
/* @__PURE__ */
|
|
6269
|
-
showFilterToggle && /* @__PURE__ */
|
|
6270
|
-
!!Actions && /* @__PURE__ */
|
|
6296
|
+
/* @__PURE__ */ jsxs14("div", { className: "ml-auto flex items-center gap-2", children: [
|
|
6297
|
+
showFilterToggle && /* @__PURE__ */ jsx18(FilterToggle, { pressed: filterRowVisible, onPressedChange: setFilterRowVisible, count: filterCount }),
|
|
6298
|
+
!!Actions && /* @__PURE__ */ jsx18(Actions, { state: tableState }),
|
|
6271
6299
|
toolbarColumns
|
|
6272
6300
|
] })
|
|
6273
6301
|
] }),
|
|
6274
|
-
!disableFilters && (!showFilterToggle || filterRowVisible) && /* @__PURE__ */
|
|
6302
|
+
!disableFilters && (!showFilterToggle || filterRowVisible) && /* @__PURE__ */ jsx18("div", { className: "flex w-full", children: celFilterConfig ? /* @__PURE__ */ jsx18("div", { className: cn("mr-2 mb-4 min-w-0 flex-1", celFilterClassName), children: /* @__PURE__ */ jsx18(
|
|
6275
6303
|
CelFilterBar,
|
|
6276
6304
|
{
|
|
6277
6305
|
schema: celFilterConfig.schema,
|
|
@@ -6281,7 +6309,7 @@ function DataTable({
|
|
|
6281
6309
|
onRestrictedOptionSelect: celFilterConfig.onRestrictedOptionSelect,
|
|
6282
6310
|
showClearButton: celFilterConfig.showClearButton
|
|
6283
6311
|
}
|
|
6284
|
-
) }) : /* @__PURE__ */
|
|
6312
|
+
) }) : /* @__PURE__ */ jsx18(
|
|
6285
6313
|
ViewFilter,
|
|
6286
6314
|
{
|
|
6287
6315
|
columns: flatColumns,
|
|
@@ -6290,8 +6318,8 @@ function DataTable({
|
|
|
6290
6318
|
className: "data-[visible-filters=true]:mb-4"
|
|
6291
6319
|
}
|
|
6292
6320
|
) }),
|
|
6293
|
-
shouldRenderTableContent ? /* @__PURE__ */
|
|
6294
|
-
/* @__PURE__ */
|
|
6321
|
+
shouldRenderTableContent ? /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
6322
|
+
/* @__PURE__ */ jsx18("div", { className: "flex min-h-0 flex-1 flex-col", "data-testid": "table-main", children: /* @__PURE__ */ jsx18(
|
|
6295
6323
|
"div",
|
|
6296
6324
|
{
|
|
6297
6325
|
ref: tableBodyScrollRef,
|
|
@@ -6300,7 +6328,7 @@ function DataTable({
|
|
|
6300
6328
|
"min-h-0 flex-1 overflow-auto rounded-lg border **:data-[slot=table-container]:overflow-visible",
|
|
6301
6329
|
!!stickyHeader && !fitContent && STICKY_HEADER_MAX_HEIGHT_CLASS
|
|
6302
6330
|
),
|
|
6303
|
-
children: /* @__PURE__ */
|
|
6331
|
+
children: /* @__PURE__ */ jsxs14(
|
|
6304
6332
|
DataTableRoot,
|
|
6305
6333
|
{
|
|
6306
6334
|
layout,
|
|
@@ -6308,7 +6336,7 @@ function DataTable({
|
|
|
6308
6336
|
gridRootRef,
|
|
6309
6337
|
style: isGrid ? { width: "100%" } : totalTableWidth > 0 ? { width: `max(100%, ${totalTableWidth}px)`, minWidth: "100%" } : { width: "100%" },
|
|
6310
6338
|
children: [
|
|
6311
|
-
/* @__PURE__ */
|
|
6339
|
+
/* @__PURE__ */ jsx18(
|
|
6312
6340
|
DataTableHeader,
|
|
6313
6341
|
{
|
|
6314
6342
|
headerGroups,
|
|
@@ -6319,7 +6347,7 @@ function DataTable({
|
|
|
6319
6347
|
layout
|
|
6320
6348
|
}
|
|
6321
6349
|
),
|
|
6322
|
-
/* @__PURE__ */
|
|
6350
|
+
/* @__PURE__ */ jsx18(
|
|
6323
6351
|
DataTableBody,
|
|
6324
6352
|
{
|
|
6325
6353
|
tableRows,
|
|
@@ -6341,11 +6369,11 @@ function DataTable({
|
|
|
6341
6369
|
)
|
|
6342
6370
|
}
|
|
6343
6371
|
) }),
|
|
6344
|
-
!shouldDisablePagination && !!pagination && /* @__PURE__ */
|
|
6372
|
+
!shouldDisablePagination && !!pagination && /* @__PURE__ */ jsx18(
|
|
6345
6373
|
DataTablePagination,
|
|
6346
6374
|
{
|
|
6347
6375
|
rowCount,
|
|
6348
|
-
rowCountRelation: (
|
|
6376
|
+
rowCountRelation: (_g = config.rowCountRelation) != null ? _g : "eq",
|
|
6349
6377
|
paginationConfig,
|
|
6350
6378
|
pageSize: pagination.pageSize,
|
|
6351
6379
|
pageIndex: pagination.pageIndex,
|
|
@@ -6353,7 +6381,7 @@ function DataTable({
|
|
|
6353
6381
|
onPageSizeChange: (nextPageSize) => setPagination((prev) => __spreadProps(__spreadValues({}, prev || pagination), { pageIndex: 0, pageSize: nextPageSize }))
|
|
6354
6382
|
}
|
|
6355
6383
|
)
|
|
6356
|
-
] }) : /* @__PURE__ */
|
|
6384
|
+
] }) : /* @__PURE__ */ jsx18(
|
|
6357
6385
|
DataTableEmptyView,
|
|
6358
6386
|
{
|
|
6359
6387
|
emptyView,
|
|
@@ -6373,19 +6401,19 @@ import {
|
|
|
6373
6401
|
} from "@tanstack/react-table";
|
|
6374
6402
|
|
|
6375
6403
|
// src/floating-widget.tsx
|
|
6376
|
-
import * as
|
|
6404
|
+
import * as React13 from "react";
|
|
6377
6405
|
import { Button as Button9 } from "@upbound/monarch-core";
|
|
6378
6406
|
import { DropdownMenu as DropdownMenu6, DropdownMenuContent as DropdownMenuContent6, DropdownMenuTrigger as DropdownMenuTrigger6 } from "@upbound/monarch-core";
|
|
6379
6407
|
import { Icon as Icon12 } from "@upbound/monarch-core";
|
|
6380
6408
|
import { Kbd as Kbd2 } from "@upbound/monarch-core";
|
|
6381
6409
|
import { Tooltip as Tooltip7, TooltipContent as TooltipContent6, TooltipTrigger as TooltipTrigger6 } from "@upbound/monarch-core";
|
|
6382
|
-
import { jsx as
|
|
6383
|
-
var FloatingWidgetContext =
|
|
6410
|
+
import { jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
6411
|
+
var FloatingWidgetContext = React13.createContext(null);
|
|
6384
6412
|
function FloatingWidgetProvider({ children }) {
|
|
6385
|
-
const [isOpen, setIsOpen] =
|
|
6386
|
-
const [isCollapsed, setIsCollapsed] =
|
|
6387
|
-
const [isExpanded, setIsExpanded] =
|
|
6388
|
-
const value =
|
|
6413
|
+
const [isOpen, setIsOpen] = React13.useState(false);
|
|
6414
|
+
const [isCollapsed, setIsCollapsed] = React13.useState(false);
|
|
6415
|
+
const [isExpanded, setIsExpanded] = React13.useState(false);
|
|
6416
|
+
const value = React13.useMemo(
|
|
6389
6417
|
() => ({
|
|
6390
6418
|
isOpen,
|
|
6391
6419
|
isCollapsed,
|
|
@@ -6417,10 +6445,10 @@ function FloatingWidgetProvider({ children }) {
|
|
|
6417
6445
|
}),
|
|
6418
6446
|
[isOpen, isCollapsed, isExpanded]
|
|
6419
6447
|
);
|
|
6420
|
-
return /* @__PURE__ */
|
|
6448
|
+
return /* @__PURE__ */ jsx19(FloatingWidgetContext.Provider, { value, children });
|
|
6421
6449
|
}
|
|
6422
6450
|
function useFloatingWidget() {
|
|
6423
|
-
const ctx =
|
|
6451
|
+
const ctx = React13.useContext(FloatingWidgetContext);
|
|
6424
6452
|
if (!ctx) {
|
|
6425
6453
|
throw new Error("useFloatingWidget must be used inside <FloatingWidgetProvider>.");
|
|
6426
6454
|
}
|
|
@@ -6428,14 +6456,14 @@ function useFloatingWidget() {
|
|
|
6428
6456
|
}
|
|
6429
6457
|
function FloatingWidget({ title = "Ask AI", subtitle, menuItems, children, className }) {
|
|
6430
6458
|
const { isOpen, isCollapsed, isExpanded, close, collapse, restore, toggleExpand } = useFloatingWidget();
|
|
6431
|
-
const [dragWidth, setDragWidth] =
|
|
6432
|
-
const [isDragging, setIsDragging] =
|
|
6433
|
-
|
|
6459
|
+
const [dragWidth, setDragWidth] = React13.useState(null);
|
|
6460
|
+
const [isDragging, setIsDragging] = React13.useState(false);
|
|
6461
|
+
React13.useEffect(() => {
|
|
6434
6462
|
setDragWidth(null);
|
|
6435
6463
|
}, [isExpanded]);
|
|
6436
6464
|
const MIN_WIDTH = 420;
|
|
6437
|
-
const widgetRef =
|
|
6438
|
-
const handleResizeMouseDown =
|
|
6465
|
+
const widgetRef = React13.useRef(null);
|
|
6466
|
+
const handleResizeMouseDown = React13.useCallback((e) => {
|
|
6439
6467
|
var _a, _b;
|
|
6440
6468
|
e.preventDefault();
|
|
6441
6469
|
setIsDragging(true);
|
|
@@ -6455,7 +6483,7 @@ function FloatingWidget({ title = "Ask AI", subtitle, menuItems, children, class
|
|
|
6455
6483
|
window.addEventListener("mousemove", onMove);
|
|
6456
6484
|
window.addEventListener("mouseup", onUp);
|
|
6457
6485
|
}, []);
|
|
6458
|
-
|
|
6486
|
+
React13.useEffect(() => {
|
|
6459
6487
|
if (!isOpen) return;
|
|
6460
6488
|
function handleKeydown(e) {
|
|
6461
6489
|
if (e.key === "Escape") {
|
|
@@ -6467,7 +6495,7 @@ function FloatingWidget({ title = "Ask AI", subtitle, menuItems, children, class
|
|
|
6467
6495
|
}, [isOpen, close]);
|
|
6468
6496
|
if (!isOpen) return null;
|
|
6469
6497
|
const dragStyle = dragWidth != null && !isCollapsed ? { width: `${dragWidth}px`, minWidth: `${MIN_WIDTH}px` } : void 0;
|
|
6470
|
-
return /* @__PURE__ */
|
|
6498
|
+
return /* @__PURE__ */ jsxs15(
|
|
6471
6499
|
"div",
|
|
6472
6500
|
{
|
|
6473
6501
|
ref: widgetRef,
|
|
@@ -6491,8 +6519,8 @@ function FloatingWidget({ title = "Ask AI", subtitle, menuItems, children, class
|
|
|
6491
6519
|
className
|
|
6492
6520
|
),
|
|
6493
6521
|
children: [
|
|
6494
|
-
!isCollapsed && /* @__PURE__ */
|
|
6495
|
-
/* @__PURE__ */
|
|
6522
|
+
!isCollapsed && /* @__PURE__ */ jsxs15(Tooltip7, { children: [
|
|
6523
|
+
/* @__PURE__ */ jsx19(TooltipTrigger6, { asChild: true, children: /* @__PURE__ */ jsx19(
|
|
6496
6524
|
"div",
|
|
6497
6525
|
{
|
|
6498
6526
|
role: "separator",
|
|
@@ -6500,56 +6528,56 @@ function FloatingWidget({ title = "Ask AI", subtitle, menuItems, children, class
|
|
|
6500
6528
|
"aria-label": "Resize widget",
|
|
6501
6529
|
onMouseDown: handleResizeMouseDown,
|
|
6502
6530
|
className: "group absolute inset-y-0 left-0 z-20 hidden w-3 cursor-col-resize touch-none items-center justify-center bg-transparent select-none sm:flex",
|
|
6503
|
-
children: /* @__PURE__ */
|
|
6531
|
+
children: /* @__PURE__ */ jsx19("div", { className: "bg-border h-12 w-1 shrink-0 rounded-lg opacity-0 transition-opacity duration-150 group-hover:opacity-100" })
|
|
6504
6532
|
}
|
|
6505
6533
|
) }),
|
|
6506
|
-
/* @__PURE__ */
|
|
6534
|
+
/* @__PURE__ */ jsx19(TooltipContent6, { side: "left", children: "Resize" })
|
|
6507
6535
|
] }),
|
|
6508
|
-
/* @__PURE__ */
|
|
6509
|
-
/* @__PURE__ */
|
|
6510
|
-
/* @__PURE__ */
|
|
6511
|
-
subtitle && /* @__PURE__ */
|
|
6536
|
+
/* @__PURE__ */ jsxs15("header", { className: "flex min-h-12 shrink-0 items-center gap-1 border-b px-3 py-2", children: [
|
|
6537
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex min-w-0 flex-1 flex-col justify-center", children: [
|
|
6538
|
+
/* @__PURE__ */ jsx19("span", { className: "text-body truncate font-medium", children: title }),
|
|
6539
|
+
subtitle && /* @__PURE__ */ jsx19("span", { className: "text-body-sm text-muted-foreground truncate", children: subtitle })
|
|
6512
6540
|
] }),
|
|
6513
|
-
menuItems && !isCollapsed && /* @__PURE__ */
|
|
6514
|
-
/* @__PURE__ */
|
|
6515
|
-
/* @__PURE__ */
|
|
6516
|
-
/* @__PURE__ */
|
|
6541
|
+
menuItems && !isCollapsed && /* @__PURE__ */ jsxs15(Tooltip7, { children: [
|
|
6542
|
+
/* @__PURE__ */ jsxs15(DropdownMenu6, { children: [
|
|
6543
|
+
/* @__PURE__ */ jsx19(TooltipTrigger6, { asChild: true, children: /* @__PURE__ */ jsx19(DropdownMenuTrigger6, { asChild: true, children: /* @__PURE__ */ jsx19(Button9, { variant: "ghost", size: "icon-sm", "aria-label": "More options", children: /* @__PURE__ */ jsx19(Icon12, { name: "ellipsis-vertical" }) }) }) }),
|
|
6544
|
+
/* @__PURE__ */ jsx19(DropdownMenuContent6, { align: "end", children: menuItems })
|
|
6517
6545
|
] }),
|
|
6518
|
-
/* @__PURE__ */
|
|
6546
|
+
/* @__PURE__ */ jsx19(TooltipContent6, { children: "More options" })
|
|
6519
6547
|
] }),
|
|
6520
|
-
!isCollapsed && /* @__PURE__ */
|
|
6521
|
-
/* @__PURE__ */
|
|
6548
|
+
!isCollapsed && /* @__PURE__ */ jsxs15(Tooltip7, { children: [
|
|
6549
|
+
/* @__PURE__ */ jsx19(TooltipTrigger6, { asChild: true, children: /* @__PURE__ */ jsx19(
|
|
6522
6550
|
Button9,
|
|
6523
6551
|
{
|
|
6524
6552
|
variant: "ghost",
|
|
6525
6553
|
size: "icon-sm",
|
|
6526
6554
|
onClick: toggleExpand,
|
|
6527
6555
|
"aria-label": isExpanded ? "Shrink widget" : "Expand widget",
|
|
6528
|
-
children: /* @__PURE__ */
|
|
6556
|
+
children: /* @__PURE__ */ jsx19(Icon12, { name: isExpanded ? "shrink" : "arrow-up-right-and-arrow-down-left-from-center" })
|
|
6529
6557
|
}
|
|
6530
6558
|
) }),
|
|
6531
|
-
/* @__PURE__ */
|
|
6559
|
+
/* @__PURE__ */ jsx19(TooltipContent6, { children: isExpanded ? "Shrink widget" : "Expand widget" })
|
|
6532
6560
|
] }),
|
|
6533
|
-
/* @__PURE__ */
|
|
6534
|
-
/* @__PURE__ */
|
|
6535
|
-
/* @__PURE__ */
|
|
6561
|
+
/* @__PURE__ */ jsxs15(Tooltip7, { children: [
|
|
6562
|
+
/* @__PURE__ */ jsx19(TooltipTrigger6, { asChild: true, children: isCollapsed ? /* @__PURE__ */ jsx19(Button9, { variant: "ghost", size: "icon-sm", onClick: restore, "aria-label": "Restore widget", children: /* @__PURE__ */ jsx19(Icon12, { name: "window-maximize" }) }) : /* @__PURE__ */ jsx19(Button9, { variant: "ghost", size: "icon-sm", onClick: collapse, "aria-label": "Minimize widget", children: /* @__PURE__ */ jsx19(Icon12, { name: "minus" }) }) }),
|
|
6563
|
+
/* @__PURE__ */ jsx19(TooltipContent6, { children: isCollapsed ? "Restore widget" : "Minimize widget" })
|
|
6536
6564
|
] }),
|
|
6537
|
-
/* @__PURE__ */
|
|
6538
|
-
/* @__PURE__ */
|
|
6539
|
-
/* @__PURE__ */
|
|
6565
|
+
/* @__PURE__ */ jsxs15(Tooltip7, { children: [
|
|
6566
|
+
/* @__PURE__ */ jsx19(TooltipTrigger6, { asChild: true, children: /* @__PURE__ */ jsx19(Button9, { variant: "ghost", size: "icon-sm", onClick: close, "aria-label": "Close widget", children: /* @__PURE__ */ jsx19(Icon12, { name: "xmark" }) }) }),
|
|
6567
|
+
/* @__PURE__ */ jsxs15(TooltipContent6, { children: [
|
|
6540
6568
|
"Close widget",
|
|
6541
|
-
/* @__PURE__ */
|
|
6569
|
+
/* @__PURE__ */ jsx19(Kbd2, { children: "Esc" })
|
|
6542
6570
|
] })
|
|
6543
6571
|
] })
|
|
6544
6572
|
] }),
|
|
6545
|
-
!isCollapsed && /* @__PURE__ */
|
|
6573
|
+
!isCollapsed && /* @__PURE__ */ jsx19("div", { className: "flex min-h-0 flex-1 flex-col", children })
|
|
6546
6574
|
]
|
|
6547
6575
|
}
|
|
6548
6576
|
);
|
|
6549
6577
|
}
|
|
6550
6578
|
|
|
6551
6579
|
// src/graph/graph-actions-provider.tsx
|
|
6552
|
-
import * as
|
|
6580
|
+
import * as React15 from "react";
|
|
6553
6581
|
|
|
6554
6582
|
// src/graph/hooks/useGraphActionsContext.ts
|
|
6555
6583
|
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
@@ -6563,10 +6591,10 @@ var useGraphActionsContext = () => {
|
|
|
6563
6591
|
};
|
|
6564
6592
|
|
|
6565
6593
|
// src/graph/hooks/useGraphActions.ts
|
|
6566
|
-
import { useCallback as useCallback10, useState as
|
|
6594
|
+
import { useCallback as useCallback10, useState as useState13 } from "react";
|
|
6567
6595
|
|
|
6568
6596
|
// src/graph/graph-node.tsx
|
|
6569
|
-
import * as
|
|
6597
|
+
import * as React14 from "react";
|
|
6570
6598
|
import { getIncomers, getOutgoers, Handle, Position as Position2 } from "reactflow";
|
|
6571
6599
|
import { Badge as Badge5, Card as Card2, Icon as Icon13, Spinner, Tooltip as Tooltip8, TooltipContent as TooltipContent7, TooltipTrigger as TooltipTrigger7 } from "@upbound/monarch-core";
|
|
6572
6600
|
|
|
@@ -6579,7 +6607,7 @@ var GRAPH_RANK_SEP = 54;
|
|
|
6579
6607
|
|
|
6580
6608
|
// src/graph/graph-edge.tsx
|
|
6581
6609
|
import { getSmoothStepPath, getStraightPath, Position } from "reactflow";
|
|
6582
|
-
import { jsx as
|
|
6610
|
+
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
6583
6611
|
var GraphEdge = ({
|
|
6584
6612
|
id,
|
|
6585
6613
|
sourceX,
|
|
@@ -6605,14 +6633,14 @@ var GraphEdge = ({
|
|
|
6605
6633
|
borderRadius: 8,
|
|
6606
6634
|
offset: 0
|
|
6607
6635
|
});
|
|
6608
|
-
return /* @__PURE__ */
|
|
6609
|
-
/* @__PURE__ */
|
|
6610
|
-
/* @__PURE__ */
|
|
6636
|
+
return /* @__PURE__ */ jsxs16("g", { id, className: "react-flow__edge-path", children: [
|
|
6637
|
+
/* @__PURE__ */ jsx20("path", { d: straightEdgePath, className: "stroke-border fill-transparent stroke-2" }),
|
|
6638
|
+
/* @__PURE__ */ jsx20("path", { d: edgePath, className: "stroke-border fill-transparent stroke-2" })
|
|
6611
6639
|
] });
|
|
6612
6640
|
};
|
|
6613
6641
|
|
|
6614
6642
|
// src/graph/graph-node.tsx
|
|
6615
|
-
import { Fragment as Fragment10, jsx as
|
|
6643
|
+
import { Fragment as Fragment10, jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6616
6644
|
function isDefaultNode(node) {
|
|
6617
6645
|
return node.type !== "loading";
|
|
6618
6646
|
}
|
|
@@ -6622,29 +6650,29 @@ function GraphNode(_a) {
|
|
|
6622
6650
|
const { nodes: originalNodes, edges: originalEdges } = useGraphActionsContext();
|
|
6623
6651
|
const nodes = originalNodes;
|
|
6624
6652
|
const edges = originalEdges;
|
|
6625
|
-
const handleClick =
|
|
6653
|
+
const handleClick = React14.useCallback(() => {
|
|
6626
6654
|
var _a3;
|
|
6627
6655
|
(_a3 = data == null ? void 0 : data.onClick) == null ? void 0 : _a3.call(data, id, data);
|
|
6628
6656
|
}, [data, id]);
|
|
6629
6657
|
const compact = (_a2 = data == null ? void 0 : data.compact) != null ? _a2 : false;
|
|
6630
6658
|
const state = (_b2 = data == null ? void 0 : data.state) != null ? _b2 : "default";
|
|
6631
|
-
const compactBadges =
|
|
6659
|
+
const compactBadges = React14.useMemo(() => {
|
|
6632
6660
|
const badges = data.badges.compact || [];
|
|
6633
6661
|
if (state === "paused") {
|
|
6634
6662
|
return [
|
|
6635
|
-
{ children: /* @__PURE__ */
|
|
6663
|
+
{ children: /* @__PURE__ */ jsx21(Icon13, { name: "pause", size: "xs" }), variant: "secondary", tooltipContent: "Resource is paused" },
|
|
6636
6664
|
...badges
|
|
6637
6665
|
];
|
|
6638
6666
|
}
|
|
6639
6667
|
return badges;
|
|
6640
6668
|
}, [data.badges.compact, state]);
|
|
6641
|
-
const defaultBadges =
|
|
6669
|
+
const defaultBadges = React14.useMemo(() => {
|
|
6642
6670
|
const badges = data.badges.default || [];
|
|
6643
6671
|
if (state === "paused") {
|
|
6644
6672
|
return [
|
|
6645
6673
|
{
|
|
6646
|
-
children: /* @__PURE__ */
|
|
6647
|
-
/* @__PURE__ */
|
|
6674
|
+
children: /* @__PURE__ */ jsxs17(Fragment10, { children: [
|
|
6675
|
+
/* @__PURE__ */ jsx21(Icon13, { name: "pause", size: "xs", className: "mr-1" }),
|
|
6648
6676
|
" Paused"
|
|
6649
6677
|
] }),
|
|
6650
6678
|
variant: "secondary",
|
|
@@ -6655,7 +6683,7 @@ function GraphNode(_a) {
|
|
|
6655
6683
|
}
|
|
6656
6684
|
return badges;
|
|
6657
6685
|
}, [data.badges.default, state]);
|
|
6658
|
-
const currentNode =
|
|
6686
|
+
const currentNode = React14.useMemo(
|
|
6659
6687
|
() => ({
|
|
6660
6688
|
id,
|
|
6661
6689
|
position: { x: 0, y: 0 },
|
|
@@ -6665,15 +6693,15 @@ function GraphNode(_a) {
|
|
|
6665
6693
|
}),
|
|
6666
6694
|
[id, data, props.type]
|
|
6667
6695
|
);
|
|
6668
|
-
const _hasIncomingEdge =
|
|
6696
|
+
const _hasIncomingEdge = React14.useMemo(() => {
|
|
6669
6697
|
return getIncomers(currentNode, nodes, edges).length > 0;
|
|
6670
6698
|
}, [currentNode, nodes, edges]);
|
|
6671
|
-
const hasOutgoingEdge =
|
|
6699
|
+
const hasOutgoingEdge = React14.useMemo(() => {
|
|
6672
6700
|
return getOutgoers(currentNode, nodes, edges).length > 0;
|
|
6673
6701
|
}, [currentNode, nodes, edges]);
|
|
6674
6702
|
const targetX = GRAPH_NODE_WIDTH / 2 - 4;
|
|
6675
6703
|
const sourceX = 4;
|
|
6676
|
-
return /* @__PURE__ */
|
|
6704
|
+
return /* @__PURE__ */ jsxs17(
|
|
6677
6705
|
Card2,
|
|
6678
6706
|
{
|
|
6679
6707
|
className: cn(
|
|
@@ -6684,7 +6712,7 @@ function GraphNode(_a) {
|
|
|
6684
6712
|
),
|
|
6685
6713
|
style: { height: compact ? GRAPH_NODE_COLLAPSED_HEIGHT : GRAPH_NODE_HEIGHT, width: GRAPH_NODE_WIDTH },
|
|
6686
6714
|
children: [
|
|
6687
|
-
/* @__PURE__ */
|
|
6715
|
+
/* @__PURE__ */ jsx21(
|
|
6688
6716
|
Handle,
|
|
6689
6717
|
{
|
|
6690
6718
|
type: "target",
|
|
@@ -6696,13 +6724,13 @@ function GraphNode(_a) {
|
|
|
6696
6724
|
isConnectable: false
|
|
6697
6725
|
}
|
|
6698
6726
|
),
|
|
6699
|
-
/* @__PURE__ */
|
|
6700
|
-
/* @__PURE__ */
|
|
6701
|
-
!!compact && /* @__PURE__ */
|
|
6702
|
-
compactBadges.length > 0 && /* @__PURE__ */
|
|
6727
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex w-full flex-1 cursor-pointer flex-col", onClick: handleClick, children: [
|
|
6728
|
+
/* @__PURE__ */ jsxs17("div", { className: cn("flex w-full justify-between gap-1 px-2.5", compact && "flex-row-reverse items-start"), children: [
|
|
6729
|
+
!!compact && /* @__PURE__ */ jsxs17(Fragment10, { children: [
|
|
6730
|
+
compactBadges.length > 0 && /* @__PURE__ */ jsx21("div", { className: "flex shrink-0 flex-row items-center gap-1.5 overflow-hidden", children: compactBadges.map((_c, index) => {
|
|
6703
6731
|
var _d = _c, { tooltipContent, variant } = _d, badge = __objRest(_d, ["tooltipContent", "variant"]);
|
|
6704
|
-
return /* @__PURE__ */
|
|
6705
|
-
/* @__PURE__ */
|
|
6732
|
+
return /* @__PURE__ */ jsxs17(Tooltip8, { children: [
|
|
6733
|
+
/* @__PURE__ */ jsx21(TooltipTrigger7, { children: /* @__PURE__ */ jsx21(
|
|
6706
6734
|
Badge5,
|
|
6707
6735
|
__spreadProps(__spreadValues({
|
|
6708
6736
|
variant
|
|
@@ -6711,17 +6739,17 @@ function GraphNode(_a) {
|
|
|
6711
6739
|
children: badge.children
|
|
6712
6740
|
})
|
|
6713
6741
|
) }),
|
|
6714
|
-
tooltipContent && /* @__PURE__ */
|
|
6742
|
+
tooltipContent && /* @__PURE__ */ jsx21(TooltipContent7, { children: tooltipContent })
|
|
6715
6743
|
] }, index);
|
|
6716
6744
|
}) }),
|
|
6717
|
-
state === "progressing" && /* @__PURE__ */
|
|
6745
|
+
state === "progressing" && /* @__PURE__ */ jsx21("div", { className: "flex shrink-0 flex-row items-center gap-1.5 overflow-hidden", children: /* @__PURE__ */ jsx21("div", { className: "flex size-[20px]! items-center justify-center", children: /* @__PURE__ */ jsx21(Spinner, { size: "sm" }) }) })
|
|
6718
6746
|
] }),
|
|
6719
|
-
/* @__PURE__ */
|
|
6720
|
-
/* @__PURE__ */
|
|
6721
|
-
/* @__PURE__ */
|
|
6722
|
-
!compact && /* @__PURE__ */
|
|
6747
|
+
/* @__PURE__ */ jsxs17("div", { className: "mr-auto grow-0 overflow-hidden", children: [
|
|
6748
|
+
/* @__PURE__ */ jsx21("h5", { className: "text-body-sm/tight truncate font-bold", children: data.title }),
|
|
6749
|
+
/* @__PURE__ */ jsx21("p", { className: "text-body-sm truncate leading-none", children: data.subtitle }),
|
|
6750
|
+
!compact && /* @__PURE__ */ jsx21("p", { className: "text-body-sm text-muted-foreground mt-1 truncate", children: data.name })
|
|
6723
6751
|
] }),
|
|
6724
|
-
/* @__PURE__ */
|
|
6752
|
+
/* @__PURE__ */ jsx21(
|
|
6725
6753
|
"span",
|
|
6726
6754
|
{
|
|
6727
6755
|
className: cn(
|
|
@@ -6733,18 +6761,18 @@ function GraphNode(_a) {
|
|
|
6733
6761
|
}
|
|
6734
6762
|
)
|
|
6735
6763
|
] }),
|
|
6736
|
-
!compact && /* @__PURE__ */
|
|
6737
|
-
/* @__PURE__ */
|
|
6764
|
+
!compact && /* @__PURE__ */ jsx21(Fragment10, { children: (defaultBadges.length > 0 || state === "progressing") && /* @__PURE__ */ jsxs17("div", { className: "mt-auto flex h-8 items-center border-t px-2.5", children: [
|
|
6765
|
+
/* @__PURE__ */ jsx21("div", { className: "flex gap-1.5 overflow-hidden overflow-x-auto", children: defaultBadges.map((_e, index) => {
|
|
6738
6766
|
var _f = _e, { tooltipContent, variant } = _f, badge = __objRest(_f, ["tooltipContent", "variant"]);
|
|
6739
|
-
return /* @__PURE__ */
|
|
6740
|
-
/* @__PURE__ */
|
|
6741
|
-
tooltipContent && /* @__PURE__ */
|
|
6767
|
+
return /* @__PURE__ */ jsxs17(Tooltip8, { children: [
|
|
6768
|
+
/* @__PURE__ */ jsx21(TooltipTrigger7, { children: /* @__PURE__ */ jsx21(Badge5, __spreadProps(__spreadValues({ variant }, badge), { className: "cursor-default! py-px! whitespace-nowrap", children: badge.children })) }),
|
|
6769
|
+
tooltipContent && /* @__PURE__ */ jsx21(TooltipContent7, { children: tooltipContent })
|
|
6742
6770
|
] }, index);
|
|
6743
6771
|
}) }),
|
|
6744
|
-
state === "progressing" && /* @__PURE__ */
|
|
6772
|
+
state === "progressing" && /* @__PURE__ */ jsx21("div", { className: "ml-auto flex size-[20px]! items-center justify-center", children: /* @__PURE__ */ jsx21(Spinner, { size: "sm" }) })
|
|
6745
6773
|
] }) })
|
|
6746
6774
|
] }),
|
|
6747
|
-
!!hasOutgoingEdge && /* @__PURE__ */
|
|
6775
|
+
!!hasOutgoingEdge && /* @__PURE__ */ jsxs17(
|
|
6748
6776
|
"div",
|
|
6749
6777
|
{
|
|
6750
6778
|
className: "absolute top-0 right-0 h-full w-auto translate-x-full",
|
|
@@ -6752,7 +6780,7 @@ function GraphNode(_a) {
|
|
|
6752
6780
|
width: GRAPH_RANK_SEP
|
|
6753
6781
|
},
|
|
6754
6782
|
children: [
|
|
6755
|
-
/* @__PURE__ */
|
|
6783
|
+
/* @__PURE__ */ jsx21("svg", { height: 20, width: GRAPH_NODE_SEP, className: "absolute top-1/2 -translate-y-1/2", children: /* @__PURE__ */ jsx21(
|
|
6756
6784
|
GraphEdge,
|
|
6757
6785
|
{
|
|
6758
6786
|
id: `${id}-expadable`,
|
|
@@ -6767,8 +6795,8 @@ function GraphNode(_a) {
|
|
|
6767
6795
|
stopOpacity: 0
|
|
6768
6796
|
}
|
|
6769
6797
|
) }),
|
|
6770
|
-
/* @__PURE__ */
|
|
6771
|
-
/* @__PURE__ */
|
|
6798
|
+
/* @__PURE__ */ jsxs17(Tooltip8, { children: [
|
|
6799
|
+
/* @__PURE__ */ jsx21(TooltipTrigger7, { asChild: true, children: /* @__PURE__ */ jsx21(
|
|
6772
6800
|
"button",
|
|
6773
6801
|
{
|
|
6774
6802
|
type: "button",
|
|
@@ -6779,15 +6807,15 @@ function GraphNode(_a) {
|
|
|
6779
6807
|
e.stopPropagation();
|
|
6780
6808
|
(_a3 = data.onExpandToggle) == null ? void 0 : _a3.call(data, id);
|
|
6781
6809
|
},
|
|
6782
|
-
children: /* @__PURE__ */
|
|
6810
|
+
children: /* @__PURE__ */ jsx21(Icon13, { name: data.expanded ? "minus" : "plus", size: "xs" })
|
|
6783
6811
|
}
|
|
6784
6812
|
) }),
|
|
6785
|
-
/* @__PURE__ */
|
|
6813
|
+
/* @__PURE__ */ jsx21(TooltipContent7, { children: data.expanded ? "Collapse" : "Expand" })
|
|
6786
6814
|
] })
|
|
6787
6815
|
]
|
|
6788
6816
|
}
|
|
6789
6817
|
),
|
|
6790
|
-
/* @__PURE__ */
|
|
6818
|
+
/* @__PURE__ */ jsx21(
|
|
6791
6819
|
Handle,
|
|
6792
6820
|
{
|
|
6793
6821
|
type: "source",
|
|
@@ -6805,7 +6833,7 @@ function GraphNode(_a) {
|
|
|
6805
6833
|
}
|
|
6806
6834
|
function GraphNodeSkeleton(_props) {
|
|
6807
6835
|
const compact = false;
|
|
6808
|
-
return /* @__PURE__ */
|
|
6836
|
+
return /* @__PURE__ */ jsxs17(
|
|
6809
6837
|
Card2,
|
|
6810
6838
|
{
|
|
6811
6839
|
className: cn(
|
|
@@ -6813,7 +6841,7 @@ function GraphNodeSkeleton(_props) {
|
|
|
6813
6841
|
compact && `h-[47px]!`
|
|
6814
6842
|
),
|
|
6815
6843
|
children: [
|
|
6816
|
-
/* @__PURE__ */
|
|
6844
|
+
/* @__PURE__ */ jsx21(
|
|
6817
6845
|
Handle,
|
|
6818
6846
|
{
|
|
6819
6847
|
type: "target",
|
|
@@ -6825,19 +6853,19 @@ function GraphNodeSkeleton(_props) {
|
|
|
6825
6853
|
isConnectable: false
|
|
6826
6854
|
}
|
|
6827
6855
|
),
|
|
6828
|
-
/* @__PURE__ */
|
|
6829
|
-
/* @__PURE__ */
|
|
6830
|
-
/* @__PURE__ */
|
|
6831
|
-
/* @__PURE__ */
|
|
6832
|
-
!compact && /* @__PURE__ */
|
|
6856
|
+
/* @__PURE__ */ jsxs17("div", { className: cn("flex w-full gap-1 px-2.5", compact && "flex-row-reverse"), children: [
|
|
6857
|
+
/* @__PURE__ */ jsxs17("div", { className: cn("grow-0 overflow-hidden", compact && "mr-auto"), children: [
|
|
6858
|
+
/* @__PURE__ */ jsx21("div", { className: "bg-muted mb-1 h-3 w-16 animate-pulse rounded-sm" }),
|
|
6859
|
+
/* @__PURE__ */ jsx21("div", { className: "bg-muted h-3 w-40 animate-pulse rounded-sm" }),
|
|
6860
|
+
!compact && /* @__PURE__ */ jsx21("div", { className: "bg-muted mt-2 h-3 w-48 animate-pulse rounded-sm" })
|
|
6833
6861
|
] }),
|
|
6834
|
-
/* @__PURE__ */
|
|
6862
|
+
/* @__PURE__ */ jsx21("div", { className: cn("bg-muted size-[26px] shrink-0 animate-pulse rounded-md", !compact && "ml-auto") })
|
|
6835
6863
|
] }),
|
|
6836
|
-
!compact && /* @__PURE__ */
|
|
6837
|
-
/* @__PURE__ */
|
|
6838
|
-
/* @__PURE__ */
|
|
6864
|
+
!compact && /* @__PURE__ */ jsx21("div", { className: "mt-auto flex h-8 items-center border-t px-2.5", children: /* @__PURE__ */ jsxs17("div", { className: "flex gap-1.5 overflow-hidden overflow-x-auto", children: [
|
|
6865
|
+
/* @__PURE__ */ jsx21("div", { className: "bg-muted h-4 w-12 animate-pulse rounded-sm" }),
|
|
6866
|
+
/* @__PURE__ */ jsx21("div", { className: "bg-muted h-4 w-12 animate-pulse rounded-sm" })
|
|
6839
6867
|
] }) }),
|
|
6840
|
-
/* @__PURE__ */
|
|
6868
|
+
/* @__PURE__ */ jsx21(
|
|
6841
6869
|
Handle,
|
|
6842
6870
|
{
|
|
6843
6871
|
type: "source",
|
|
@@ -6856,8 +6884,8 @@ function GraphNodeSkeleton(_props) {
|
|
|
6856
6884
|
|
|
6857
6885
|
// src/graph/hooks/useGraphActions.ts
|
|
6858
6886
|
var useGraphActions = (initialNodes = [], initialEdges = []) => {
|
|
6859
|
-
const [nodes, setNodes] =
|
|
6860
|
-
const [edges, setEdges] =
|
|
6887
|
+
const [nodes, setNodes] = useState13(initialNodes);
|
|
6888
|
+
const [edges, setEdges] = useState13(initialEdges);
|
|
6861
6889
|
const addNodes = useCallback10((newNodes) => {
|
|
6862
6890
|
setNodes((prevNodes) => {
|
|
6863
6891
|
const existingIds = new Set(prevNodes.map((node) => node.id));
|
|
@@ -6918,11 +6946,11 @@ var useGraphActions = (initialNodes = [], initialEdges = []) => {
|
|
|
6918
6946
|
};
|
|
6919
6947
|
|
|
6920
6948
|
// src/graph/graph-actions-provider.tsx
|
|
6921
|
-
import { jsx as
|
|
6922
|
-
var GraphActionsProvider =
|
|
6949
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
6950
|
+
var GraphActionsProvider = React15.forwardRef(
|
|
6923
6951
|
({ initialNodes = [], initialEdges = [], children }, ref) => {
|
|
6924
6952
|
const graphActions = useGraphActions(initialNodes, initialEdges);
|
|
6925
|
-
|
|
6953
|
+
React15.useImperativeHandle(
|
|
6926
6954
|
ref,
|
|
6927
6955
|
() => ({
|
|
6928
6956
|
addNodes: graphActions.addNodes,
|
|
@@ -6935,18 +6963,18 @@ var GraphActionsProvider = React14.forwardRef(
|
|
|
6935
6963
|
}),
|
|
6936
6964
|
[graphActions]
|
|
6937
6965
|
);
|
|
6938
|
-
return /* @__PURE__ */
|
|
6966
|
+
return /* @__PURE__ */ jsx22(GraphActionsContext.Provider, { value: graphActions, children });
|
|
6939
6967
|
}
|
|
6940
6968
|
);
|
|
6941
6969
|
GraphActionsProvider.displayName = "GraphActionsProvider";
|
|
6942
6970
|
|
|
6943
6971
|
// src/graph/graph.tsx
|
|
6944
|
-
import * as
|
|
6972
|
+
import * as React18 from "react";
|
|
6945
6973
|
import { useTable as useTable2 } from "@tanstack/react-table";
|
|
6946
|
-
import { Icon as Icon14
|
|
6974
|
+
import { Icon as Icon14 } from "@upbound/monarch-core";
|
|
6947
6975
|
|
|
6948
6976
|
// src/graph/graph-view.tsx
|
|
6949
|
-
import * as
|
|
6977
|
+
import * as React17 from "react";
|
|
6950
6978
|
import { Background, Controls, MiniMap, ReactFlow, ReactFlowProvider } from "reactflow";
|
|
6951
6979
|
|
|
6952
6980
|
// src/graph/hooks/useAutoLayout.ts
|
|
@@ -7154,7 +7182,7 @@ var useNodeVisibility = (nodes, edges) => {
|
|
|
7154
7182
|
};
|
|
7155
7183
|
|
|
7156
7184
|
// src/graph/hooks/useViewportFocus.ts
|
|
7157
|
-
import * as
|
|
7185
|
+
import * as React16 from "react";
|
|
7158
7186
|
import { useReactFlow, useStore } from "reactflow";
|
|
7159
7187
|
function getViewportFocusCenter(node) {
|
|
7160
7188
|
var _a;
|
|
@@ -7169,7 +7197,7 @@ function useViewportFocus(nodeMap, viewportFocusNodeId) {
|
|
|
7169
7197
|
const { setCenter } = useReactFlow();
|
|
7170
7198
|
const viewportReady = useStore((state) => state.width > 0 && state.height > 0);
|
|
7171
7199
|
const node = viewportFocusNodeId ? nodeMap.get(viewportFocusNodeId) : void 0;
|
|
7172
|
-
|
|
7200
|
+
React16.useEffect(() => {
|
|
7173
7201
|
if (!node || !viewportReady) {
|
|
7174
7202
|
return;
|
|
7175
7203
|
}
|
|
@@ -7179,24 +7207,24 @@ function useViewportFocus(nodeMap, viewportFocusNodeId) {
|
|
|
7179
7207
|
}
|
|
7180
7208
|
|
|
7181
7209
|
// src/graph/graph-view.tsx
|
|
7182
|
-
import { jsx as
|
|
7210
|
+
import { jsx as jsx23, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
7183
7211
|
var GraphViewInternal = ({ nodeTypes: parentNodeTypes, edgeTypes: parentEdgeTypes, children, viewportFocusNodeId }) => {
|
|
7184
7212
|
const { nodes, edges, toggleNodeExpansion } = useGraphActionsContext();
|
|
7185
|
-
const nodeTypes =
|
|
7213
|
+
const nodeTypes = React17.useMemo(
|
|
7186
7214
|
() => __spreadValues({
|
|
7187
7215
|
default: GraphNode,
|
|
7188
7216
|
loading: GraphNodeSkeleton
|
|
7189
7217
|
}, parentNodeTypes),
|
|
7190
7218
|
[parentNodeTypes]
|
|
7191
7219
|
);
|
|
7192
|
-
const edgeTypes =
|
|
7220
|
+
const edgeTypes = React17.useMemo(
|
|
7193
7221
|
() => __spreadValues({
|
|
7194
7222
|
default: GraphEdge
|
|
7195
7223
|
}, parentEdgeTypes),
|
|
7196
7224
|
[parentEdgeTypes]
|
|
7197
7225
|
);
|
|
7198
7226
|
const { nodes: visibleNodes, edges: visibleEdges } = useNodeVisibility(nodes, edges);
|
|
7199
|
-
const nodesWithExpansion =
|
|
7227
|
+
const nodesWithExpansion = React17.useMemo(() => {
|
|
7200
7228
|
return visibleNodes.map((node) => {
|
|
7201
7229
|
if (isDefaultNode(node) && !node.data.onExpandToggle) {
|
|
7202
7230
|
return __spreadProps(__spreadValues({}, node), {
|
|
@@ -7216,7 +7244,7 @@ var GraphViewInternal = ({ nodeTypes: parentNodeTypes, edgeTypes: parentEdgeType
|
|
|
7216
7244
|
viewportFocusNodeId
|
|
7217
7245
|
});
|
|
7218
7246
|
useViewportFocus(nodeMap, viewportFocusNodeId);
|
|
7219
|
-
return /* @__PURE__ */
|
|
7247
|
+
return /* @__PURE__ */ jsxs18(
|
|
7220
7248
|
ReactFlow,
|
|
7221
7249
|
{
|
|
7222
7250
|
nodeTypes,
|
|
@@ -7235,21 +7263,21 @@ var GraphViewInternal = ({ nodeTypes: parentNodeTypes, edgeTypes: parentEdgeType
|
|
|
7235
7263
|
panOnScroll: true,
|
|
7236
7264
|
selectionOnDrag: true,
|
|
7237
7265
|
children: [
|
|
7238
|
-
/* @__PURE__ */
|
|
7239
|
-
/* @__PURE__ */
|
|
7240
|
-
/* @__PURE__ */
|
|
7266
|
+
/* @__PURE__ */ jsx23(Background, { className: "bg-muted text-muted" }),
|
|
7267
|
+
/* @__PURE__ */ jsx23(Controls, { showInteractive: false }),
|
|
7268
|
+
/* @__PURE__ */ jsx23(MiniMap, { zoomable: true, pannable: true }),
|
|
7241
7269
|
children
|
|
7242
7270
|
]
|
|
7243
7271
|
}
|
|
7244
7272
|
);
|
|
7245
7273
|
};
|
|
7246
|
-
var GraphView =
|
|
7247
|
-
return /* @__PURE__ */
|
|
7274
|
+
var GraphView = React17.forwardRef(({ defaultNodes = [], defaultEdges = [], nodeTypes, edgeTypes, children, viewportFocusNodeId }, ref) => {
|
|
7275
|
+
return /* @__PURE__ */ jsx23(ReactFlowProvider, { children: /* @__PURE__ */ jsx23(GraphActionsProvider, { ref, initialNodes: defaultNodes, initialEdges: defaultEdges, children: /* @__PURE__ */ jsx23(GraphViewInternal, { nodeTypes, edgeTypes, viewportFocusNodeId, children }) }) });
|
|
7248
7276
|
});
|
|
7249
7277
|
GraphView.displayName = "GraphView";
|
|
7250
7278
|
|
|
7251
7279
|
// src/graph/graph.tsx
|
|
7252
|
-
import { jsx as
|
|
7280
|
+
import { jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
7253
7281
|
var defaultGraphErrorConfig = {
|
|
7254
7282
|
icon: "triangle-exclamation",
|
|
7255
7283
|
header: "An error occurred",
|
|
@@ -7285,17 +7313,14 @@ function Graph({
|
|
|
7285
7313
|
children
|
|
7286
7314
|
}) {
|
|
7287
7315
|
var _a, _b, _c;
|
|
7288
|
-
const graphRef =
|
|
7289
|
-
const
|
|
7290
|
-
const [
|
|
7291
|
-
|
|
7316
|
+
const graphRef = React18.useRef(null);
|
|
7317
|
+
const [innerGlobalFilter, setInnerGlobalFilter] = React18.useState("");
|
|
7318
|
+
const [innerColumnFilters, setInnerColumnFilters] = React18.useState([]);
|
|
7319
|
+
if (parentGlobalFilter !== void 0 && parentGlobalFilter !== innerGlobalFilter) {
|
|
7320
|
+
setInnerGlobalFilter(parentGlobalFilter);
|
|
7321
|
+
}
|
|
7292
7322
|
const globalFilter = parentGlobalFilter != null ? parentGlobalFilter : innerGlobalFilter;
|
|
7293
7323
|
const setGlobalFilter = parentSetGlobalFilter != null ? parentSetGlobalFilter : setInnerGlobalFilter;
|
|
7294
|
-
React17.useEffect(() => {
|
|
7295
|
-
if (parentGlobalFilter !== void 0) {
|
|
7296
|
-
setInnerGlobalFilter(parentGlobalFilter);
|
|
7297
|
-
}
|
|
7298
|
-
}, [parentGlobalFilter]);
|
|
7299
7324
|
const columnFilters = parentColumnFilters != null ? parentColumnFilters : innerColumnFilters;
|
|
7300
7325
|
const setColumnFilters = parentSetColumnFilters != null ? parentSetColumnFilters : setInnerColumnFilters;
|
|
7301
7326
|
const table = useTable2({
|
|
@@ -7309,7 +7334,7 @@ function Graph({
|
|
|
7309
7334
|
});
|
|
7310
7335
|
const flatColumns = table.getAllFlatColumns();
|
|
7311
7336
|
const filteredRows = table.getFilteredRowModel().rows;
|
|
7312
|
-
const filteredData =
|
|
7337
|
+
const filteredData = React18.useMemo(() => filteredRows.map((row) => row.original), [filteredRows]);
|
|
7313
7338
|
const filterCount = columnFilters.map(
|
|
7314
7339
|
({ id: columnFilterId, value }) => {
|
|
7315
7340
|
var _a2, _b2;
|
|
@@ -7323,10 +7348,10 @@ function Graph({
|
|
|
7323
7348
|
setColumnFilters([]);
|
|
7324
7349
|
setGlobalFilter("");
|
|
7325
7350
|
};
|
|
7326
|
-
const memoizedNodeTypes =
|
|
7327
|
-
const memoizedEdgeTypes =
|
|
7328
|
-
const memoizedConfig =
|
|
7329
|
-
|
|
7351
|
+
const memoizedNodeTypes = React18.useMemo(() => config.nodeTypes, [config.nodeTypes]);
|
|
7352
|
+
const memoizedEdgeTypes = React18.useMemo(() => config.edgeTypes, [config.edgeTypes]);
|
|
7353
|
+
const memoizedConfig = React18.useMemo(() => config, [config]);
|
|
7354
|
+
React18.useEffect(() => {
|
|
7330
7355
|
if (!graphRef.current) {
|
|
7331
7356
|
return;
|
|
7332
7357
|
}
|
|
@@ -7346,27 +7371,13 @@ function Graph({
|
|
|
7346
7371
|
empty: (_b = emptyView == null ? void 0 : emptyView.empty) != null ? _b : defaultGraphEmptyConfig,
|
|
7347
7372
|
filter: (_c = emptyView == null ? void 0 : emptyView.filter) != null ? _c : defaultGraphNoFilterFoundConfig
|
|
7348
7373
|
};
|
|
7349
|
-
return /* @__PURE__ */
|
|
7350
|
-
!!title && /* @__PURE__ */
|
|
7351
|
-
showToolbar && /* @__PURE__ */
|
|
7352
|
-
!disableSearch && /* @__PURE__ */
|
|
7353
|
-
|
|
7354
|
-
/* @__PURE__ */ jsx23(
|
|
7355
|
-
InputGroupInput4,
|
|
7356
|
-
__spreadProps(__spreadValues({}, SEARCH_INPUT_PROPS), {
|
|
7357
|
-
id: searchInputId,
|
|
7358
|
-
className: SEARCH_INPUT_CLASS,
|
|
7359
|
-
"aria-label": "Search",
|
|
7360
|
-
placeholder: "Search\u2026",
|
|
7361
|
-
disabled: shouldDisable,
|
|
7362
|
-
value: globalFilter,
|
|
7363
|
-
onChange: (e) => setGlobalFilter(e.target.value)
|
|
7364
|
-
})
|
|
7365
|
-
)
|
|
7366
|
-
] }),
|
|
7367
|
-
!!Actions && /* @__PURE__ */ jsx23("div", { className: "ml-auto flex items-center gap-2", children: /* @__PURE__ */ jsx23(Actions, { state: graphState }) })
|
|
7374
|
+
return /* @__PURE__ */ jsxs19("div", { id: `graph-${id}`, className: cn("flex size-full flex-1 flex-col", className), children: [
|
|
7375
|
+
!!title && /* @__PURE__ */ jsx24(SectionHeader, { className: "mb-4", children: /* @__PURE__ */ jsx24(SectionHeaderContent, { children: /* @__PURE__ */ jsx24(SectionHeaderTitle, { children: title }) }) }),
|
|
7376
|
+
showToolbar && /* @__PURE__ */ jsxs19("div", { className: "mb-4 flex flex-row gap-2", children: [
|
|
7377
|
+
!disableSearch && /* @__PURE__ */ jsx24(DataTableSearch, { value: globalFilter, onValueChange: setGlobalFilter, disabled: shouldDisable }),
|
|
7378
|
+
!!Actions && /* @__PURE__ */ jsx24("div", { className: "ml-auto flex items-center gap-2", children: /* @__PURE__ */ jsx24(Actions, { state: graphState }) })
|
|
7368
7379
|
] }),
|
|
7369
|
-
showFilters && /* @__PURE__ */
|
|
7380
|
+
showFilters && /* @__PURE__ */ jsx24(
|
|
7370
7381
|
ViewFilter,
|
|
7371
7382
|
{
|
|
7372
7383
|
columns: flatColumns,
|
|
@@ -7375,9 +7386,9 @@ function Graph({
|
|
|
7375
7386
|
className: "mb-4"
|
|
7376
7387
|
}
|
|
7377
7388
|
),
|
|
7378
|
-
shouldRenderGraphContent ? /* @__PURE__ */
|
|
7379
|
-
graphState === "loading" && /* @__PURE__ */
|
|
7380
|
-
/* @__PURE__ */
|
|
7389
|
+
shouldRenderGraphContent ? /* @__PURE__ */ jsxs19("div", { className: "relative size-full flex-1", children: [
|
|
7390
|
+
graphState === "loading" && /* @__PURE__ */ jsx24(Icon14, { name: "circle-notch", className: "absolute top-4 left-4 z-10 animate-spin" }),
|
|
7391
|
+
/* @__PURE__ */ jsx24(
|
|
7381
7392
|
GraphView,
|
|
7382
7393
|
{
|
|
7383
7394
|
viewportFocusNodeId,
|
|
@@ -7387,7 +7398,7 @@ function Graph({
|
|
|
7387
7398
|
children
|
|
7388
7399
|
}
|
|
7389
7400
|
)
|
|
7390
|
-
] }) : /* @__PURE__ */
|
|
7401
|
+
] }) : /* @__PURE__ */ jsx24(
|
|
7391
7402
|
DataTableEmptyView,
|
|
7392
7403
|
{
|
|
7393
7404
|
emptyView: resolvedEmptyView,
|
|
@@ -7400,11 +7411,11 @@ function Graph({
|
|
|
7400
7411
|
}
|
|
7401
7412
|
|
|
7402
7413
|
// src/graph/hooks/useGetViewportNodeIds.ts
|
|
7403
|
-
import { useEffect as useEffect10, useMemo as useMemo14, useRef as
|
|
7414
|
+
import { useEffect as useEffect10, useMemo as useMemo14, useRef as useRef11, useState as useState15 } from "react";
|
|
7404
7415
|
import { useStore as useStore2, useViewport } from "reactflow";
|
|
7405
7416
|
var useGetDebouncedViewport = (debounceDelay = 1e3) => {
|
|
7406
|
-
const timerRef =
|
|
7407
|
-
const [debouncedValues, setDebouncedValues] =
|
|
7417
|
+
const timerRef = useRef11(null);
|
|
7418
|
+
const [debouncedValues, setDebouncedValues] = useState15({ x: 0, y: 0, zoom: 1, width: 0, height: 0, nodes: [] });
|
|
7408
7419
|
const { x, y, zoom } = useViewport();
|
|
7409
7420
|
const { width, height, nodes } = useStore2((state) => ({
|
|
7410
7421
|
width: state.width,
|
|
@@ -7464,30 +7475,30 @@ var getGraphDescendants = (node, nodes, edges) => {
|
|
|
7464
7475
|
};
|
|
7465
7476
|
|
|
7466
7477
|
// src/page-header.tsx
|
|
7467
|
-
import { jsx as
|
|
7478
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
7468
7479
|
function PageHeader(_a) {
|
|
7469
7480
|
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
7470
|
-
return /* @__PURE__ */
|
|
7481
|
+
return /* @__PURE__ */ jsx25("div", __spreadProps(__spreadValues({ "data-slot": "page-header", className: cn("flex w-full items-start justify-between gap-4", className) }, props), { children }));
|
|
7471
7482
|
}
|
|
7472
7483
|
function PageHeaderAvatar(_a) {
|
|
7473
7484
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
7474
|
-
return /* @__PURE__ */
|
|
7485
|
+
return /* @__PURE__ */ jsx25("div", __spreadValues({ "data-slot": "page-header-avatar", className: cn("shrink-0 self-center", className) }, props));
|
|
7475
7486
|
}
|
|
7476
7487
|
function PageHeaderContent(_a) {
|
|
7477
7488
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
7478
|
-
return /* @__PURE__ */
|
|
7489
|
+
return /* @__PURE__ */ jsx25("div", __spreadValues({ "data-slot": "page-header-content", className: cn("flex flex-1 flex-col gap-1", className) }, props));
|
|
7479
7490
|
}
|
|
7480
7491
|
function PageHeaderTitle(_a) {
|
|
7481
7492
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
7482
|
-
return /* @__PURE__ */
|
|
7493
|
+
return /* @__PURE__ */ jsx25("h1", __spreadValues({ "data-slot": "page-header-title", className: cn("text-h1 text-foreground", className) }, props));
|
|
7483
7494
|
}
|
|
7484
7495
|
function PageHeaderDescription(_a) {
|
|
7485
7496
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
7486
|
-
return /* @__PURE__ */
|
|
7497
|
+
return /* @__PURE__ */ jsx25("p", __spreadValues({ "data-slot": "page-header-description", className: cn("text-body text-muted-foreground", className) }, props));
|
|
7487
7498
|
}
|
|
7488
7499
|
function PageHeaderMeta(_a) {
|
|
7489
7500
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
7490
|
-
return /* @__PURE__ */
|
|
7501
|
+
return /* @__PURE__ */ jsx25(
|
|
7491
7502
|
"div",
|
|
7492
7503
|
__spreadValues({
|
|
7493
7504
|
"data-slot": "page-header-meta",
|
|
@@ -7501,27 +7512,27 @@ function PageHeaderMeta(_a) {
|
|
|
7501
7512
|
}
|
|
7502
7513
|
function PageHeaderActions(_a) {
|
|
7503
7514
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
7504
|
-
return /* @__PURE__ */
|
|
7515
|
+
return /* @__PURE__ */ jsx25("div", __spreadValues({ "data-slot": "page-header-actions", className: cn("flex items-center gap-2", className) }, props));
|
|
7505
7516
|
}
|
|
7506
7517
|
function PageHeaderTabs(_a) {
|
|
7507
7518
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
7508
|
-
return /* @__PURE__ */
|
|
7519
|
+
return /* @__PURE__ */ jsx25("div", __spreadValues({ "data-slot": "page-header-tabs", className: cn("border-b", className) }, props));
|
|
7509
7520
|
}
|
|
7510
7521
|
|
|
7511
7522
|
// src/timeline.tsx
|
|
7512
7523
|
import { Icon as Icon15 } from "@upbound/monarch-core";
|
|
7513
7524
|
import { Item as Item2, ItemGroup as ItemGroup2 } from "@upbound/monarch-core";
|
|
7514
|
-
import { jsx as
|
|
7525
|
+
import { jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
7515
7526
|
function Timeline(_a) {
|
|
7516
7527
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
7517
|
-
return /* @__PURE__ */
|
|
7528
|
+
return /* @__PURE__ */ jsx26(ItemGroup2, __spreadValues({ "data-slot": "timeline", className: cn(className) }, props));
|
|
7518
7529
|
}
|
|
7519
7530
|
function TimelineItem(_a) {
|
|
7520
7531
|
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
7521
|
-
return /* @__PURE__ */
|
|
7522
|
-
/* @__PURE__ */
|
|
7523
|
-
/* @__PURE__ */
|
|
7524
|
-
/* @__PURE__ */
|
|
7532
|
+
return /* @__PURE__ */ jsxs20(Item2, __spreadProps(__spreadValues({ "data-slot": "timeline-item", className: cn("group/timeline-item gap-3 py-4", className) }, props), { children: [
|
|
7533
|
+
/* @__PURE__ */ jsxs20("div", { className: "relative flex flex-col items-center self-stretch", children: [
|
|
7534
|
+
/* @__PURE__ */ jsx26(Icon15, { name: "circle-dot", size: "sm", className: "text-primary shrink-0" }),
|
|
7535
|
+
/* @__PURE__ */ jsx26(
|
|
7525
7536
|
"span",
|
|
7526
7537
|
{
|
|
7527
7538
|
"aria-hidden": "true",
|