@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/graph.js
CHANGED
|
@@ -429,7 +429,7 @@ var GraphActionsProvider = React2.forwardRef(
|
|
|
429
429
|
GraphActionsProvider.displayName = "GraphActionsProvider";
|
|
430
430
|
|
|
431
431
|
// src/graph/graph.tsx
|
|
432
|
-
import * as
|
|
432
|
+
import * as React8 from "react";
|
|
433
433
|
import { useTable } from "@tanstack/react-table";
|
|
434
434
|
|
|
435
435
|
// src/lib/data-table/features.ts
|
|
@@ -482,7 +482,7 @@ var dataTableFeatures = tableFeatures({
|
|
|
482
482
|
});
|
|
483
483
|
|
|
484
484
|
// src/graph/graph.tsx
|
|
485
|
-
import { Icon as
|
|
485
|
+
import { Icon as Icon5 } from "@upbound/monarch-core";
|
|
486
486
|
|
|
487
487
|
// src/lib/data-table/contextual-filters.ts
|
|
488
488
|
function getColumnFilterCount(filterValue, filter) {
|
|
@@ -534,6 +534,11 @@ function getTableState({
|
|
|
534
534
|
return rowCount === 0 ? "empty" : "success";
|
|
535
535
|
}
|
|
536
536
|
|
|
537
|
+
// src/data-table/data-table-search.tsx
|
|
538
|
+
import * as React3 from "react";
|
|
539
|
+
import { Icon as Icon2 } from "@upbound/monarch-core";
|
|
540
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "@upbound/monarch-core";
|
|
541
|
+
|
|
537
542
|
// src/lib/search-input.ts
|
|
538
543
|
var SEARCH_INPUT_PROPS = {
|
|
539
544
|
type: "search",
|
|
@@ -549,13 +554,64 @@ var SEARCH_INPUT_PROPS = {
|
|
|
549
554
|
};
|
|
550
555
|
var SEARCH_INPUT_CLASS = "[&::-webkit-search-cancel-button]:appearance-none";
|
|
551
556
|
|
|
557
|
+
// src/data-table/data-table-search.tsx
|
|
558
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
559
|
+
function DataTableSearch({
|
|
560
|
+
value,
|
|
561
|
+
onValueChange,
|
|
562
|
+
placeholder = "Search\u2026",
|
|
563
|
+
className,
|
|
564
|
+
disabled = false
|
|
565
|
+
}) {
|
|
566
|
+
const id = `table-search-${React3.useId()}`;
|
|
567
|
+
const inputRef = React3.useRef(null);
|
|
568
|
+
const [draft, setDraft] = React3.useState(value);
|
|
569
|
+
const [isPending, startTransition] = React3.useTransition();
|
|
570
|
+
if (!isPending && draft !== value) {
|
|
571
|
+
setDraft(value);
|
|
572
|
+
}
|
|
573
|
+
const commit = (next) => {
|
|
574
|
+
setDraft(next);
|
|
575
|
+
startTransition(() => onValueChange(next));
|
|
576
|
+
};
|
|
577
|
+
return /* @__PURE__ */ jsxs3(InputGroup, { className: cn("w-70", className), children: [
|
|
578
|
+
/* @__PURE__ */ jsx4(InputGroupAddon, { align: "inline-start", children: /* @__PURE__ */ jsx4(Icon2, { name: "magnifying-glass" }) }),
|
|
579
|
+
/* @__PURE__ */ jsx4(
|
|
580
|
+
InputGroupInput,
|
|
581
|
+
__spreadProps(__spreadValues({}, SEARCH_INPUT_PROPS), {
|
|
582
|
+
id,
|
|
583
|
+
className: SEARCH_INPUT_CLASS,
|
|
584
|
+
"aria-label": "Search",
|
|
585
|
+
placeholder,
|
|
586
|
+
disabled,
|
|
587
|
+
ref: inputRef,
|
|
588
|
+
value: draft,
|
|
589
|
+
onChange: (e) => commit(e.target.value)
|
|
590
|
+
})
|
|
591
|
+
),
|
|
592
|
+
!!draft && !disabled && /* @__PURE__ */ jsx4(InputGroupAddon, { align: "inline-end", children: /* @__PURE__ */ jsx4(
|
|
593
|
+
InputGroupButton,
|
|
594
|
+
{
|
|
595
|
+
size: "icon-xs",
|
|
596
|
+
"aria-label": "Clear search",
|
|
597
|
+
onClick: () => {
|
|
598
|
+
var _a;
|
|
599
|
+
commit("");
|
|
600
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
601
|
+
},
|
|
602
|
+
children: /* @__PURE__ */ jsx4(Icon2, { name: "xmark" })
|
|
603
|
+
}
|
|
604
|
+
) })
|
|
605
|
+
] });
|
|
606
|
+
}
|
|
607
|
+
|
|
552
608
|
// src/data-table/empty-view.tsx
|
|
553
609
|
import { Alert, AlertDescription } from "@upbound/monarch-core";
|
|
554
610
|
import { Button } from "@upbound/monarch-core";
|
|
555
611
|
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@upbound/monarch-core";
|
|
556
|
-
import { Icon as
|
|
612
|
+
import { Icon as Icon3 } from "@upbound/monarch-core";
|
|
557
613
|
import { IconTile } from "@upbound/monarch-core";
|
|
558
|
-
import { jsx as
|
|
614
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
559
615
|
var defaultErrorConfig = {
|
|
560
616
|
icon: "circle-exclamation",
|
|
561
617
|
header: "Something went wrong",
|
|
@@ -586,29 +642,29 @@ function DataTableEmptyView({
|
|
|
586
642
|
const isFilteredEmpty = tableState === "empty" && filterCount > 0;
|
|
587
643
|
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;
|
|
588
644
|
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;
|
|
589
|
-
const defaultAction = isFilteredEmpty && !(config == null ? void 0 : config.action) ? /* @__PURE__ */
|
|
590
|
-
/* @__PURE__ */
|
|
645
|
+
const defaultAction = isFilteredEmpty && !(config == null ? void 0 : config.action) ? /* @__PURE__ */ jsxs4(Button, { variant: "outline", size: "sm", onClick: resetFilters, children: [
|
|
646
|
+
/* @__PURE__ */ jsx5(Icon3, { name: "xmark" }),
|
|
591
647
|
"Clear filters"
|
|
592
648
|
] }) : null;
|
|
593
|
-
return /* @__PURE__ */
|
|
594
|
-
/* @__PURE__ */
|
|
595
|
-
config.icon && /* @__PURE__ */
|
|
596
|
-
config.header && /* @__PURE__ */
|
|
597
|
-
config.subheader && /* @__PURE__ */
|
|
649
|
+
return /* @__PURE__ */ jsx5("div", { className: cn("flex size-full flex-col justify-center", wrapperClassName), children: config && /* @__PURE__ */ jsxs4(Empty, { className: cn("border border-dashed", config.className), children: [
|
|
650
|
+
/* @__PURE__ */ jsxs4(EmptyHeader, { children: [
|
|
651
|
+
config.icon && /* @__PURE__ */ jsx5(EmptyMedia, { children: /* @__PURE__ */ jsx5(IconTile, { variant: "branded", size: "md", children: /* @__PURE__ */ jsx5(Icon3, { name: config.icon }) }) }),
|
|
652
|
+
config.header && /* @__PURE__ */ jsx5(EmptyTitle, { children: config.header }),
|
|
653
|
+
config.subheader && /* @__PURE__ */ jsx5(EmptyDescription, { children: config.subheader })
|
|
598
654
|
] }),
|
|
599
|
-
(config.details || config.action || defaultAction) && /* @__PURE__ */
|
|
600
|
-
config.details && /* @__PURE__ */
|
|
655
|
+
(config.details || config.action || defaultAction) && /* @__PURE__ */ jsxs4(EmptyContent, { children: [
|
|
656
|
+
config.details && /* @__PURE__ */ jsx5(Alert, { children: /* @__PURE__ */ jsx5(AlertDescription, { children: config.details }) }),
|
|
601
657
|
(_d = config.action) != null ? _d : defaultAction
|
|
602
658
|
] })
|
|
603
659
|
] }) });
|
|
604
660
|
}
|
|
605
661
|
|
|
606
662
|
// src/data-table/view-filter.tsx
|
|
607
|
-
import * as
|
|
663
|
+
import * as React5 from "react";
|
|
608
664
|
|
|
609
665
|
// src/filter-bar/filter-bar.tsx
|
|
610
|
-
import * as
|
|
611
|
-
import { Icon as
|
|
666
|
+
import * as React4 from "react";
|
|
667
|
+
import { Icon as Icon4 } from "@upbound/monarch-core";
|
|
612
668
|
import { Badge as Badge2 } from "@upbound/monarch-core";
|
|
613
669
|
import { Button as Button2 } from "@upbound/monarch-core";
|
|
614
670
|
import { ButtonGroup, ButtonGroupText } from "@upbound/monarch-core";
|
|
@@ -638,7 +694,7 @@ import {
|
|
|
638
694
|
import { Input } from "@upbound/monarch-core";
|
|
639
695
|
import { Label } from "@upbound/monarch-core";
|
|
640
696
|
import { Popover, PopoverContent, PopoverTrigger } from "@upbound/monarch-core";
|
|
641
|
-
import { Fragment as Fragment2, jsx as
|
|
697
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
642
698
|
function asCheckboxValue(value) {
|
|
643
699
|
return Array.isArray(value) ? value : [];
|
|
644
700
|
}
|
|
@@ -707,13 +763,13 @@ function FilterBar(_a) {
|
|
|
707
763
|
const remainingFilters = filters.filter((f) => !usedKeys.has(f.key));
|
|
708
764
|
const availableFilters = filters.some(hasOrder) ? remainingFilters : sortBy(remainingFilters, (f) => f.label);
|
|
709
765
|
const shouldShowFilters = availableFilters.length > 0 || activeFilters.length > 0;
|
|
710
|
-
const [pendingOpenKey, setPendingOpenKey] =
|
|
766
|
+
const [pendingOpenKey, setPendingOpenKey] = React4.useState(null);
|
|
711
767
|
function handleAddFilter(key) {
|
|
712
768
|
onAddFilter(key);
|
|
713
769
|
setPendingOpenKey(key);
|
|
714
770
|
}
|
|
715
|
-
const containerRef =
|
|
716
|
-
return /* @__PURE__ */
|
|
771
|
+
const containerRef = React4.useRef(null);
|
|
772
|
+
return /* @__PURE__ */ jsxs5(
|
|
717
773
|
"div",
|
|
718
774
|
__spreadProps(__spreadValues({
|
|
719
775
|
"data-slot": "filter-bar",
|
|
@@ -722,7 +778,7 @@ function FilterBar(_a) {
|
|
|
722
778
|
ref: composeRefs(containerRef, ref)
|
|
723
779
|
}, props), {
|
|
724
780
|
children: [
|
|
725
|
-
availableFilters.length > 0 && /* @__PURE__ */
|
|
781
|
+
availableFilters.length > 0 && /* @__PURE__ */ jsxs5(
|
|
726
782
|
Combobox,
|
|
727
783
|
{
|
|
728
784
|
items: availableFilters,
|
|
@@ -733,14 +789,14 @@ function FilterBar(_a) {
|
|
|
733
789
|
if (filter) handleAddFilter(filter.key);
|
|
734
790
|
},
|
|
735
791
|
children: [
|
|
736
|
-
/* @__PURE__ */
|
|
737
|
-
/* @__PURE__ */
|
|
792
|
+
/* @__PURE__ */ jsxs5(ComboboxTrigger, { "aria-label": "Add filter", showIndicator: false, render: /* @__PURE__ */ jsx6(Button2, { variant: "outline" }), children: [
|
|
793
|
+
/* @__PURE__ */ jsx6(Icon4, { name: "plus", "data-icon": "inline-start" }),
|
|
738
794
|
"Add filter"
|
|
739
795
|
] }),
|
|
740
|
-
/* @__PURE__ */
|
|
741
|
-
/* @__PURE__ */
|
|
742
|
-
/* @__PURE__ */
|
|
743
|
-
/* @__PURE__ */
|
|
796
|
+
/* @__PURE__ */ jsxs5(ComboboxContent, { container: containerRef, align: "start", className: "w-48", children: [
|
|
797
|
+
/* @__PURE__ */ jsx6(ComboboxInput, { showTrigger: false, placeholder: "Search filters\u2026" }),
|
|
798
|
+
/* @__PURE__ */ jsx6(ComboboxEmpty, { children: "No filters found." }),
|
|
799
|
+
/* @__PURE__ */ jsx6(ComboboxList, { children: (filter) => /* @__PURE__ */ jsx6(ComboboxItem, { value: filter, children: filter.label }, filter.key) })
|
|
744
800
|
] })
|
|
745
801
|
]
|
|
746
802
|
}
|
|
@@ -748,7 +804,7 @@ function FilterBar(_a) {
|
|
|
748
804
|
activeFilters.map((active) => {
|
|
749
805
|
const definition = filters.find((f) => f.key === active.key);
|
|
750
806
|
if (!definition) return null;
|
|
751
|
-
return /* @__PURE__ */
|
|
807
|
+
return /* @__PURE__ */ jsx6(
|
|
752
808
|
FilterChip,
|
|
753
809
|
{
|
|
754
810
|
definition,
|
|
@@ -771,7 +827,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
771
827
|
const type = (_a = definition.type) != null ? _a : "checkbox";
|
|
772
828
|
switch (type) {
|
|
773
829
|
case "checkbox":
|
|
774
|
-
return /* @__PURE__ */
|
|
830
|
+
return /* @__PURE__ */ jsx6(
|
|
775
831
|
CheckboxFilterChip,
|
|
776
832
|
{
|
|
777
833
|
definition,
|
|
@@ -783,7 +839,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
783
839
|
}
|
|
784
840
|
);
|
|
785
841
|
case "radio":
|
|
786
|
-
return /* @__PURE__ */
|
|
842
|
+
return /* @__PURE__ */ jsx6(
|
|
787
843
|
RadioFilterChip,
|
|
788
844
|
{
|
|
789
845
|
definition,
|
|
@@ -795,7 +851,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
795
851
|
}
|
|
796
852
|
);
|
|
797
853
|
case "text":
|
|
798
|
-
return /* @__PURE__ */
|
|
854
|
+
return /* @__PURE__ */ jsx6(
|
|
799
855
|
TextFilterChip,
|
|
800
856
|
{
|
|
801
857
|
definition,
|
|
@@ -806,7 +862,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
806
862
|
}
|
|
807
863
|
);
|
|
808
864
|
case "multiText":
|
|
809
|
-
return /* @__PURE__ */
|
|
865
|
+
return /* @__PURE__ */ jsx6(
|
|
810
866
|
MultiTextFilterChip,
|
|
811
867
|
{
|
|
812
868
|
definition,
|
|
@@ -817,7 +873,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
817
873
|
}
|
|
818
874
|
);
|
|
819
875
|
case "date":
|
|
820
|
-
return /* @__PURE__ */
|
|
876
|
+
return /* @__PURE__ */ jsx6(
|
|
821
877
|
DateFilterChip,
|
|
822
878
|
{
|
|
823
879
|
definition,
|
|
@@ -830,7 +886,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
830
886
|
}
|
|
831
887
|
}
|
|
832
888
|
function FilterChipRemoveButton({ label, onRemove }) {
|
|
833
|
-
return /* @__PURE__ */
|
|
889
|
+
return /* @__PURE__ */ jsx6(Button2, { variant: "outline", size: "icon", "aria-label": `Remove ${label} filter`, onClick: onRemove, children: /* @__PURE__ */ jsx6(Icon4, { name: "xmark" }) });
|
|
834
890
|
}
|
|
835
891
|
function CheckboxFilterChip({
|
|
836
892
|
definition,
|
|
@@ -849,9 +905,9 @@ function CheckboxFilterChip({
|
|
|
849
905
|
const next = values.includes(optionValue) ? values.filter((v) => v !== optionValue) : [...values, optionValue];
|
|
850
906
|
onChangeValue(next);
|
|
851
907
|
}
|
|
852
|
-
return /* @__PURE__ */
|
|
853
|
-
/* @__PURE__ */
|
|
854
|
-
searchable ? /* @__PURE__ */
|
|
908
|
+
return /* @__PURE__ */ jsxs5(ButtonGroup, { children: [
|
|
909
|
+
/* @__PURE__ */ jsx6(ButtonGroupText, { children: label }),
|
|
910
|
+
searchable ? /* @__PURE__ */ jsxs5(
|
|
855
911
|
Combobox,
|
|
856
912
|
{
|
|
857
913
|
items: options,
|
|
@@ -861,34 +917,34 @@ function CheckboxFilterChip({
|
|
|
861
917
|
value: options.filter((o) => values.includes(o.value)),
|
|
862
918
|
onValueChange: (selected) => onChangeValue(selected.map((s) => s.value)),
|
|
863
919
|
children: [
|
|
864
|
-
/* @__PURE__ */
|
|
920
|
+
/* @__PURE__ */ jsx6(
|
|
865
921
|
ComboboxTrigger,
|
|
866
922
|
{
|
|
867
|
-
render: /* @__PURE__ */
|
|
868
|
-
children: /* @__PURE__ */
|
|
923
|
+
render: /* @__PURE__ */ jsx6(Button2, { variant: "outline", className: "gap-1 font-normal [&>svg:last-child]:size-(--icon-sm)" }),
|
|
924
|
+
children: /* @__PURE__ */ jsx6("span", { className: values.length === 0 ? "text-muted-foreground" : "", children: displayLabel })
|
|
869
925
|
}
|
|
870
926
|
),
|
|
871
|
-
/* @__PURE__ */
|
|
927
|
+
/* @__PURE__ */ jsxs5(
|
|
872
928
|
ComboboxContent,
|
|
873
929
|
{
|
|
874
930
|
container,
|
|
875
931
|
className: "min-w-64",
|
|
876
932
|
collisionAvoidance: { side: "none", align: "shift" },
|
|
877
933
|
children: [
|
|
878
|
-
/* @__PURE__ */
|
|
879
|
-
values.length > 0 && /* @__PURE__ */
|
|
880
|
-
/* @__PURE__ */
|
|
881
|
-
/* @__PURE__ */
|
|
882
|
-
/* @__PURE__ */
|
|
934
|
+
/* @__PURE__ */ jsx6(ComboboxInput, { showTrigger: false, placeholder: `Search ${label.toLowerCase()}\u2026` }),
|
|
935
|
+
values.length > 0 && /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
936
|
+
/* @__PURE__ */ jsxs5(ComboboxSelectedChips, { children: [
|
|
937
|
+
/* @__PURE__ */ jsx6(ComboboxValue, { children: (selected) => /* @__PURE__ */ jsx6(Fragment2, { children: selected.map((item) => /* @__PURE__ */ jsx6(ComboboxChip, { children: item.label }, item.value)) }) }),
|
|
938
|
+
/* @__PURE__ */ jsx6(ComboboxClearAll, { onClick: () => onChangeValue([]) })
|
|
883
939
|
] }),
|
|
884
|
-
/* @__PURE__ */
|
|
940
|
+
/* @__PURE__ */ jsx6(ComboboxSeparator, {})
|
|
885
941
|
] }),
|
|
886
|
-
/* @__PURE__ */
|
|
942
|
+
/* @__PURE__ */ jsxs5(ComboboxEmpty, { children: [
|
|
887
943
|
"No ",
|
|
888
944
|
label.toLowerCase(),
|
|
889
945
|
" found."
|
|
890
946
|
] }),
|
|
891
|
-
/* @__PURE__ */
|
|
947
|
+
/* @__PURE__ */ jsx6(ComboboxList, { children: (item) => /* @__PURE__ */ jsxs5(ComboboxItem, { value: item, children: [
|
|
892
948
|
item.icon,
|
|
893
949
|
item.label
|
|
894
950
|
] }, item.value) })
|
|
@@ -897,12 +953,12 @@ function CheckboxFilterChip({
|
|
|
897
953
|
)
|
|
898
954
|
]
|
|
899
955
|
}
|
|
900
|
-
) : /* @__PURE__ */
|
|
901
|
-
/* @__PURE__ */
|
|
902
|
-
/* @__PURE__ */
|
|
903
|
-
/* @__PURE__ */
|
|
956
|
+
) : /* @__PURE__ */ jsxs5(DropdownMenu, { defaultOpen: autoOpen, children: [
|
|
957
|
+
/* @__PURE__ */ jsx6(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs5(Button2, { variant: "outline", className: "gap-1 font-normal", children: [
|
|
958
|
+
/* @__PURE__ */ jsx6("span", { className: values.length === 0 ? "text-muted-foreground" : "", children: displayLabel }),
|
|
959
|
+
/* @__PURE__ */ jsx6(Icon4, { name: "chevron-down", size: "sm", className: "text-muted-foreground" })
|
|
904
960
|
] }) }),
|
|
905
|
-
/* @__PURE__ */
|
|
961
|
+
/* @__PURE__ */ jsx6(DropdownMenuContent, { align: "start", className: "w-48", children: options.map((opt) => /* @__PURE__ */ jsxs5(
|
|
906
962
|
DropdownMenuCheckboxItem,
|
|
907
963
|
{
|
|
908
964
|
checked: values.includes(opt.value),
|
|
@@ -915,7 +971,7 @@ function CheckboxFilterChip({
|
|
|
915
971
|
opt.value
|
|
916
972
|
)) })
|
|
917
973
|
] }),
|
|
918
|
-
/* @__PURE__ */
|
|
974
|
+
/* @__PURE__ */ jsx6(FilterChipRemoveButton, { label, onRemove })
|
|
919
975
|
] });
|
|
920
976
|
}
|
|
921
977
|
function RadioFilterChip({
|
|
@@ -932,9 +988,9 @@ function RadioFilterChip({
|
|
|
932
988
|
const selectedValue = asRadioValue(value);
|
|
933
989
|
const displayLabel = selectedValue ? (_b = (_a = options.find((o) => o.value === selectedValue)) == null ? void 0 : _a.label) != null ? _b : selectedValue : "Any";
|
|
934
990
|
const selected = (_c = options.find((o) => o.value === selectedValue)) != null ? _c : null;
|
|
935
|
-
return /* @__PURE__ */
|
|
936
|
-
/* @__PURE__ */
|
|
937
|
-
searchable ? /* @__PURE__ */
|
|
991
|
+
return /* @__PURE__ */ jsxs5(ButtonGroup, { children: [
|
|
992
|
+
/* @__PURE__ */ jsx6(ButtonGroupText, { children: label }),
|
|
993
|
+
searchable ? /* @__PURE__ */ jsxs5(
|
|
938
994
|
Combobox,
|
|
939
995
|
{
|
|
940
996
|
items: options,
|
|
@@ -946,27 +1002,27 @@ function RadioFilterChip({
|
|
|
946
1002
|
return onChangeValue((_a2 = next == null ? void 0 : next.value) != null ? _a2 : "");
|
|
947
1003
|
},
|
|
948
1004
|
children: [
|
|
949
|
-
/* @__PURE__ */
|
|
1005
|
+
/* @__PURE__ */ jsx6(
|
|
950
1006
|
ComboboxTrigger,
|
|
951
1007
|
{
|
|
952
|
-
render: /* @__PURE__ */
|
|
953
|
-
children: /* @__PURE__ */
|
|
1008
|
+
render: /* @__PURE__ */ jsx6(Button2, { variant: "outline", className: "gap-1 font-normal [&>svg:last-child]:size-(--icon-sm)" }),
|
|
1009
|
+
children: /* @__PURE__ */ jsx6("span", { className: selectedValue ? "" : "text-muted-foreground", children: displayLabel })
|
|
954
1010
|
}
|
|
955
1011
|
),
|
|
956
|
-
/* @__PURE__ */
|
|
1012
|
+
/* @__PURE__ */ jsxs5(
|
|
957
1013
|
ComboboxContent,
|
|
958
1014
|
{
|
|
959
1015
|
container,
|
|
960
1016
|
className: "min-w-64",
|
|
961
1017
|
collisionAvoidance: { side: "none", align: "shift" },
|
|
962
1018
|
children: [
|
|
963
|
-
/* @__PURE__ */
|
|
964
|
-
/* @__PURE__ */
|
|
1019
|
+
/* @__PURE__ */ jsx6(ComboboxInput, { showTrigger: false, placeholder: `Search ${label.toLowerCase()}\u2026` }),
|
|
1020
|
+
/* @__PURE__ */ jsxs5(ComboboxEmpty, { children: [
|
|
965
1021
|
"No ",
|
|
966
1022
|
label.toLowerCase(),
|
|
967
1023
|
" found."
|
|
968
1024
|
] }),
|
|
969
|
-
/* @__PURE__ */
|
|
1025
|
+
/* @__PURE__ */ jsx6(ComboboxList, { children: (item) => /* @__PURE__ */ jsxs5(ComboboxItem, { value: item, children: [
|
|
970
1026
|
item.icon,
|
|
971
1027
|
item.label
|
|
972
1028
|
] }, item.value) })
|
|
@@ -975,17 +1031,17 @@ function RadioFilterChip({
|
|
|
975
1031
|
)
|
|
976
1032
|
]
|
|
977
1033
|
}
|
|
978
|
-
) : /* @__PURE__ */
|
|
979
|
-
/* @__PURE__ */
|
|
980
|
-
/* @__PURE__ */
|
|
981
|
-
/* @__PURE__ */
|
|
1034
|
+
) : /* @__PURE__ */ jsxs5(DropdownMenu, { defaultOpen: autoOpen, children: [
|
|
1035
|
+
/* @__PURE__ */ jsx6(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs5(Button2, { variant: "outline", className: "gap-1 font-normal", children: [
|
|
1036
|
+
/* @__PURE__ */ jsx6("span", { className: selectedValue ? "" : "text-muted-foreground", children: displayLabel }),
|
|
1037
|
+
/* @__PURE__ */ jsx6(Icon4, { name: "chevron-down", size: "sm", className: "text-muted-foreground" })
|
|
982
1038
|
] }) }),
|
|
983
|
-
/* @__PURE__ */
|
|
1039
|
+
/* @__PURE__ */ jsx6(DropdownMenuContent, { align: "start", className: "w-48", children: /* @__PURE__ */ jsx6(DropdownMenuRadioGroup, { value: selectedValue, onValueChange: onChangeValue, children: options.map((opt) => /* @__PURE__ */ jsxs5(DropdownMenuRadioItem, { value: opt.value, children: [
|
|
984
1040
|
opt.icon,
|
|
985
1041
|
opt.label
|
|
986
1042
|
] }, opt.value)) }) })
|
|
987
1043
|
] }),
|
|
988
|
-
/* @__PURE__ */
|
|
1044
|
+
/* @__PURE__ */ jsx6(FilterChipRemoveButton, { label, onRemove })
|
|
989
1045
|
] });
|
|
990
1046
|
}
|
|
991
1047
|
function TextFilterChip({
|
|
@@ -997,12 +1053,12 @@ function TextFilterChip({
|
|
|
997
1053
|
}) {
|
|
998
1054
|
const { label, placeholder } = definition;
|
|
999
1055
|
const text = asTextValue(value);
|
|
1000
|
-
const [open, setOpen] =
|
|
1001
|
-
return /* @__PURE__ */
|
|
1002
|
-
/* @__PURE__ */
|
|
1003
|
-
/* @__PURE__ */
|
|
1004
|
-
/* @__PURE__ */
|
|
1005
|
-
/* @__PURE__ */
|
|
1056
|
+
const [open, setOpen] = React4.useState(!!autoOpen);
|
|
1057
|
+
return /* @__PURE__ */ jsxs5(ButtonGroup, { children: [
|
|
1058
|
+
/* @__PURE__ */ jsx6(ButtonGroupText, { children: label }),
|
|
1059
|
+
/* @__PURE__ */ jsxs5(Popover, { open, onOpenChange: setOpen, children: [
|
|
1060
|
+
/* @__PURE__ */ jsx6(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx6(Button2, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx6("span", { className: text ? "" : "text-muted-foreground", children: text || "Any" }) }) }),
|
|
1061
|
+
/* @__PURE__ */ jsx6(PopoverContent, { align: "start", children: /* @__PURE__ */ jsx6(
|
|
1006
1062
|
Input,
|
|
1007
1063
|
{
|
|
1008
1064
|
autoFocus: true,
|
|
@@ -1015,7 +1071,7 @@ function TextFilterChip({
|
|
|
1015
1071
|
}
|
|
1016
1072
|
) })
|
|
1017
1073
|
] }),
|
|
1018
|
-
/* @__PURE__ */
|
|
1074
|
+
/* @__PURE__ */ jsx6(FilterChipRemoveButton, { label, onRemove })
|
|
1019
1075
|
] });
|
|
1020
1076
|
}
|
|
1021
1077
|
function MultiTextFilterChip({
|
|
@@ -1027,7 +1083,7 @@ function MultiTextFilterChip({
|
|
|
1027
1083
|
}) {
|
|
1028
1084
|
const { label, placeholder } = definition;
|
|
1029
1085
|
const tokens = asMultiTextValue(value);
|
|
1030
|
-
const [draft, setDraft] =
|
|
1086
|
+
const [draft, setDraft] = React4.useState("");
|
|
1031
1087
|
const displayLabel = tokens.length === 0 ? "Any" : tokens.length === 1 ? tokens[0] : `${tokens.length} values`;
|
|
1032
1088
|
function addToken() {
|
|
1033
1089
|
const token = draft.trim();
|
|
@@ -1041,25 +1097,25 @@ function MultiTextFilterChip({
|
|
|
1041
1097
|
function removeToken(token) {
|
|
1042
1098
|
onChangeValue(tokens.filter((t) => t !== token));
|
|
1043
1099
|
}
|
|
1044
|
-
return /* @__PURE__ */
|
|
1045
|
-
/* @__PURE__ */
|
|
1046
|
-
/* @__PURE__ */
|
|
1047
|
-
/* @__PURE__ */
|
|
1048
|
-
/* @__PURE__ */
|
|
1049
|
-
tokens.length > 0 && /* @__PURE__ */
|
|
1100
|
+
return /* @__PURE__ */ jsxs5(ButtonGroup, { children: [
|
|
1101
|
+
/* @__PURE__ */ jsx6(ButtonGroupText, { children: label }),
|
|
1102
|
+
/* @__PURE__ */ jsxs5(Popover, { defaultOpen: autoOpen, children: [
|
|
1103
|
+
/* @__PURE__ */ jsx6(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx6(Button2, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx6("span", { className: tokens.length === 0 ? "text-muted-foreground" : "", children: displayLabel }) }) }),
|
|
1104
|
+
/* @__PURE__ */ jsx6(PopoverContent, { align: "start", children: /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2", children: [
|
|
1105
|
+
tokens.length > 0 && /* @__PURE__ */ jsx6("div", { className: "flex flex-wrap gap-1", children: tokens.map((token) => /* @__PURE__ */ jsxs5(Badge2, { variant: "secondary", className: "gap-1", children: [
|
|
1050
1106
|
token,
|
|
1051
|
-
/* @__PURE__ */
|
|
1107
|
+
/* @__PURE__ */ jsx6(
|
|
1052
1108
|
"button",
|
|
1053
1109
|
{
|
|
1054
1110
|
type: "button",
|
|
1055
1111
|
"aria-label": `Remove ${token}`,
|
|
1056
1112
|
onClick: () => removeToken(token),
|
|
1057
1113
|
className: "cursor-pointer",
|
|
1058
|
-
children: /* @__PURE__ */
|
|
1114
|
+
children: /* @__PURE__ */ jsx6(Icon4, { name: "xmark", size: "xs" })
|
|
1059
1115
|
}
|
|
1060
1116
|
)
|
|
1061
1117
|
] }, token)) }),
|
|
1062
|
-
/* @__PURE__ */
|
|
1118
|
+
/* @__PURE__ */ jsx6(
|
|
1063
1119
|
Input,
|
|
1064
1120
|
{
|
|
1065
1121
|
autoFocus: true,
|
|
@@ -1078,7 +1134,7 @@ function MultiTextFilterChip({
|
|
|
1078
1134
|
)
|
|
1079
1135
|
] }) })
|
|
1080
1136
|
] }),
|
|
1081
|
-
/* @__PURE__ */
|
|
1137
|
+
/* @__PURE__ */ jsx6(FilterChipRemoveButton, { label, onRemove })
|
|
1082
1138
|
] });
|
|
1083
1139
|
}
|
|
1084
1140
|
function DateFilterChip({
|
|
@@ -1108,12 +1164,12 @@ function DateFilterChip({
|
|
|
1108
1164
|
if (!endDate) return;
|
|
1109
1165
|
onChangeValue({ startDate, endDate: applyTimeToDate(endDate, time) });
|
|
1110
1166
|
}
|
|
1111
|
-
return /* @__PURE__ */
|
|
1112
|
-
/* @__PURE__ */
|
|
1113
|
-
/* @__PURE__ */
|
|
1114
|
-
/* @__PURE__ */
|
|
1115
|
-
/* @__PURE__ */
|
|
1116
|
-
/* @__PURE__ */
|
|
1167
|
+
return /* @__PURE__ */ jsxs5(ButtonGroup, { children: [
|
|
1168
|
+
/* @__PURE__ */ jsx6(ButtonGroupText, { children: label }),
|
|
1169
|
+
/* @__PURE__ */ jsxs5(Popover, { defaultOpen: autoOpen, children: [
|
|
1170
|
+
/* @__PURE__ */ jsx6(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx6(Button2, { variant: "outline", className: "gap-1 font-normal", children: /* @__PURE__ */ jsx6("span", { className: startDate ? "" : "text-muted-foreground", children: displayLabel }) }) }),
|
|
1171
|
+
/* @__PURE__ */ jsx6(PopoverContent, { align: "start", className: "w-fit", children: /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2", children: [
|
|
1172
|
+
/* @__PURE__ */ jsx6(
|
|
1117
1173
|
Calendar,
|
|
1118
1174
|
{
|
|
1119
1175
|
mode: "range",
|
|
@@ -1121,9 +1177,9 @@ function DateFilterChip({
|
|
|
1121
1177
|
onSelect: pickRange
|
|
1122
1178
|
}
|
|
1123
1179
|
),
|
|
1124
|
-
showTimeInputs && /* @__PURE__ */
|
|
1125
|
-
/* @__PURE__ */
|
|
1126
|
-
/* @__PURE__ */
|
|
1180
|
+
showTimeInputs && /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2", children: [
|
|
1181
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex w-full items-center gap-2", children: [
|
|
1182
|
+
/* @__PURE__ */ jsx6(
|
|
1127
1183
|
Label,
|
|
1128
1184
|
{
|
|
1129
1185
|
htmlFor: `${definition.key}-start-time`,
|
|
@@ -1131,7 +1187,7 @@ function DateFilterChip({
|
|
|
1131
1187
|
children: "Start"
|
|
1132
1188
|
}
|
|
1133
1189
|
),
|
|
1134
|
-
/* @__PURE__ */
|
|
1190
|
+
/* @__PURE__ */ jsx6(
|
|
1135
1191
|
Input,
|
|
1136
1192
|
{
|
|
1137
1193
|
id: `${definition.key}-start-time`,
|
|
@@ -1143,8 +1199,8 @@ function DateFilterChip({
|
|
|
1143
1199
|
}
|
|
1144
1200
|
)
|
|
1145
1201
|
] }),
|
|
1146
|
-
/* @__PURE__ */
|
|
1147
|
-
/* @__PURE__ */
|
|
1202
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex w-full items-center gap-2", children: [
|
|
1203
|
+
/* @__PURE__ */ jsx6(
|
|
1148
1204
|
Label,
|
|
1149
1205
|
{
|
|
1150
1206
|
htmlFor: `${definition.key}-end-time`,
|
|
@@ -1152,7 +1208,7 @@ function DateFilterChip({
|
|
|
1152
1208
|
children: "End"
|
|
1153
1209
|
}
|
|
1154
1210
|
),
|
|
1155
|
-
/* @__PURE__ */
|
|
1211
|
+
/* @__PURE__ */ jsx6(
|
|
1156
1212
|
Input,
|
|
1157
1213
|
{
|
|
1158
1214
|
id: `${definition.key}-end-time`,
|
|
@@ -1167,7 +1223,7 @@ function DateFilterChip({
|
|
|
1167
1223
|
] })
|
|
1168
1224
|
] }) })
|
|
1169
1225
|
] }),
|
|
1170
|
-
/* @__PURE__ */
|
|
1226
|
+
/* @__PURE__ */ jsx6(FilterChipRemoveButton, { label, onRemove })
|
|
1171
1227
|
] });
|
|
1172
1228
|
}
|
|
1173
1229
|
|
|
@@ -1178,7 +1234,7 @@ var isCheckboxColumnFilter = (definition) => definition.type === "checkbox";
|
|
|
1178
1234
|
var isMultiTextColumnFilter = (definition) => definition.type === "multiText";
|
|
1179
1235
|
|
|
1180
1236
|
// src/data-table/view-filter.tsx
|
|
1181
|
-
import { jsx as
|
|
1237
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1182
1238
|
function toFilterOption(opt) {
|
|
1183
1239
|
return typeof opt === "string" ? { value: opt, label: opt } : { value: opt.value, label: opt.label };
|
|
1184
1240
|
}
|
|
@@ -1221,7 +1277,7 @@ function ViewFilter({
|
|
|
1221
1277
|
onColumnFiltersChange,
|
|
1222
1278
|
className
|
|
1223
1279
|
}) {
|
|
1224
|
-
const filterableColumns =
|
|
1280
|
+
const filterableColumns = React5.useMemo(
|
|
1225
1281
|
() => columns.filter((column) => !isFilterOnlyColumn(column) && column.getCanFilter()).flatMap((column) => {
|
|
1226
1282
|
var _a;
|
|
1227
1283
|
const filter = (_a = column.columnDef.meta) == null ? void 0 : _a.filter;
|
|
@@ -1229,7 +1285,7 @@ function ViewFilter({
|
|
|
1229
1285
|
}),
|
|
1230
1286
|
[columns]
|
|
1231
1287
|
);
|
|
1232
|
-
const filterDefinitions =
|
|
1288
|
+
const filterDefinitions = React5.useMemo(
|
|
1233
1289
|
() => filterableColumns.map(({ key, filter }) => toFilterBarDefinition(key, filter)).sort((a, b) => {
|
|
1234
1290
|
if (a.order == null && b.order == null) return 0;
|
|
1235
1291
|
if (a.order == null) return 1;
|
|
@@ -1238,15 +1294,15 @@ function ViewFilter({
|
|
|
1238
1294
|
}),
|
|
1239
1295
|
[filterableColumns]
|
|
1240
1296
|
);
|
|
1241
|
-
const emptyValueByKey =
|
|
1297
|
+
const emptyValueByKey = React5.useMemo(
|
|
1242
1298
|
() => new Map(filterableColumns.map(({ key, filter }) => [key, emptyValueFor(filter)])),
|
|
1243
1299
|
[filterableColumns]
|
|
1244
1300
|
);
|
|
1245
|
-
const activeFilters =
|
|
1301
|
+
const activeFilters = React5.useMemo(
|
|
1246
1302
|
() => columnFilters.map((filter) => ({ key: filter.id, value: filter.value })),
|
|
1247
1303
|
[columnFilters]
|
|
1248
1304
|
);
|
|
1249
|
-
return /* @__PURE__ */
|
|
1305
|
+
return /* @__PURE__ */ jsx7(
|
|
1250
1306
|
FilterBar,
|
|
1251
1307
|
{
|
|
1252
1308
|
className,
|
|
@@ -1260,10 +1316,10 @@ function ViewFilter({
|
|
|
1260
1316
|
}
|
|
1261
1317
|
|
|
1262
1318
|
// src/section-header.tsx
|
|
1263
|
-
import { jsx as
|
|
1319
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1264
1320
|
function SectionHeader(_a) {
|
|
1265
1321
|
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
1266
|
-
return /* @__PURE__ */
|
|
1322
|
+
return /* @__PURE__ */ jsx8(
|
|
1267
1323
|
"div",
|
|
1268
1324
|
__spreadProps(__spreadValues({
|
|
1269
1325
|
"data-slot": "section-header",
|
|
@@ -1275,15 +1331,15 @@ function SectionHeader(_a) {
|
|
|
1275
1331
|
}
|
|
1276
1332
|
function SectionHeaderContent(_a) {
|
|
1277
1333
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1278
|
-
return /* @__PURE__ */
|
|
1334
|
+
return /* @__PURE__ */ jsx8("div", __spreadValues({ "data-slot": "section-header-content", className: cn("flex flex-col gap-1", className) }, props));
|
|
1279
1335
|
}
|
|
1280
1336
|
function SectionHeaderTitle(_a) {
|
|
1281
1337
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1282
|
-
return /* @__PURE__ */
|
|
1338
|
+
return /* @__PURE__ */ jsx8("h2", __spreadValues({ "data-slot": "section-header-title", className: cn("text-h3 text-foreground", className) }, props));
|
|
1283
1339
|
}
|
|
1284
1340
|
|
|
1285
1341
|
// src/graph/graph-view.tsx
|
|
1286
|
-
import * as
|
|
1342
|
+
import * as React7 from "react";
|
|
1287
1343
|
import { Background, Controls, MiniMap, ReactFlow, ReactFlowProvider } from "reactflow";
|
|
1288
1344
|
|
|
1289
1345
|
// src/graph/hooks/useAutoLayout.ts
|
|
@@ -1491,7 +1547,7 @@ var useNodeVisibility = (nodes, edges) => {
|
|
|
1491
1547
|
};
|
|
1492
1548
|
|
|
1493
1549
|
// src/graph/hooks/useViewportFocus.ts
|
|
1494
|
-
import * as
|
|
1550
|
+
import * as React6 from "react";
|
|
1495
1551
|
import { useReactFlow, useStore } from "reactflow";
|
|
1496
1552
|
function getViewportFocusCenter(node) {
|
|
1497
1553
|
var _a;
|
|
@@ -1506,7 +1562,7 @@ function useViewportFocus(nodeMap, viewportFocusNodeId) {
|
|
|
1506
1562
|
const { setCenter } = useReactFlow();
|
|
1507
1563
|
const viewportReady = useStore((state) => state.width > 0 && state.height > 0);
|
|
1508
1564
|
const node = viewportFocusNodeId ? nodeMap.get(viewportFocusNodeId) : void 0;
|
|
1509
|
-
|
|
1565
|
+
React6.useEffect(() => {
|
|
1510
1566
|
if (!node || !viewportReady) {
|
|
1511
1567
|
return;
|
|
1512
1568
|
}
|
|
@@ -1516,24 +1572,24 @@ function useViewportFocus(nodeMap, viewportFocusNodeId) {
|
|
|
1516
1572
|
}
|
|
1517
1573
|
|
|
1518
1574
|
// src/graph/graph-view.tsx
|
|
1519
|
-
import { jsx as
|
|
1575
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1520
1576
|
var GraphViewInternal = ({ nodeTypes: parentNodeTypes, edgeTypes: parentEdgeTypes, children, viewportFocusNodeId }) => {
|
|
1521
1577
|
const { nodes, edges, toggleNodeExpansion } = useGraphActionsContext();
|
|
1522
|
-
const nodeTypes =
|
|
1578
|
+
const nodeTypes = React7.useMemo(
|
|
1523
1579
|
() => __spreadValues({
|
|
1524
1580
|
default: GraphNode,
|
|
1525
1581
|
loading: GraphNodeSkeleton
|
|
1526
1582
|
}, parentNodeTypes),
|
|
1527
1583
|
[parentNodeTypes]
|
|
1528
1584
|
);
|
|
1529
|
-
const edgeTypes =
|
|
1585
|
+
const edgeTypes = React7.useMemo(
|
|
1530
1586
|
() => __spreadValues({
|
|
1531
1587
|
default: GraphEdge
|
|
1532
1588
|
}, parentEdgeTypes),
|
|
1533
1589
|
[parentEdgeTypes]
|
|
1534
1590
|
);
|
|
1535
1591
|
const { nodes: visibleNodes, edges: visibleEdges } = useNodeVisibility(nodes, edges);
|
|
1536
|
-
const nodesWithExpansion =
|
|
1592
|
+
const nodesWithExpansion = React7.useMemo(() => {
|
|
1537
1593
|
return visibleNodes.map((node) => {
|
|
1538
1594
|
if (isDefaultNode(node) && !node.data.onExpandToggle) {
|
|
1539
1595
|
return __spreadProps(__spreadValues({}, node), {
|
|
@@ -1553,7 +1609,7 @@ var GraphViewInternal = ({ nodeTypes: parentNodeTypes, edgeTypes: parentEdgeType
|
|
|
1553
1609
|
viewportFocusNodeId
|
|
1554
1610
|
});
|
|
1555
1611
|
useViewportFocus(nodeMap, viewportFocusNodeId);
|
|
1556
|
-
return /* @__PURE__ */
|
|
1612
|
+
return /* @__PURE__ */ jsxs6(
|
|
1557
1613
|
ReactFlow,
|
|
1558
1614
|
{
|
|
1559
1615
|
nodeTypes,
|
|
@@ -1572,21 +1628,21 @@ var GraphViewInternal = ({ nodeTypes: parentNodeTypes, edgeTypes: parentEdgeType
|
|
|
1572
1628
|
panOnScroll: true,
|
|
1573
1629
|
selectionOnDrag: true,
|
|
1574
1630
|
children: [
|
|
1575
|
-
/* @__PURE__ */
|
|
1576
|
-
/* @__PURE__ */
|
|
1577
|
-
/* @__PURE__ */
|
|
1631
|
+
/* @__PURE__ */ jsx9(Background, { className: "bg-muted text-muted" }),
|
|
1632
|
+
/* @__PURE__ */ jsx9(Controls, { showInteractive: false }),
|
|
1633
|
+
/* @__PURE__ */ jsx9(MiniMap, { zoomable: true, pannable: true }),
|
|
1578
1634
|
children
|
|
1579
1635
|
]
|
|
1580
1636
|
}
|
|
1581
1637
|
);
|
|
1582
1638
|
};
|
|
1583
|
-
var GraphView =
|
|
1584
|
-
return /* @__PURE__ */
|
|
1639
|
+
var GraphView = React7.forwardRef(({ defaultNodes = [], defaultEdges = [], nodeTypes, edgeTypes, children, viewportFocusNodeId }, ref) => {
|
|
1640
|
+
return /* @__PURE__ */ jsx9(ReactFlowProvider, { children: /* @__PURE__ */ jsx9(GraphActionsProvider, { ref, initialNodes: defaultNodes, initialEdges: defaultEdges, children: /* @__PURE__ */ jsx9(GraphViewInternal, { nodeTypes, edgeTypes, viewportFocusNodeId, children }) }) });
|
|
1585
1641
|
});
|
|
1586
1642
|
GraphView.displayName = "GraphView";
|
|
1587
1643
|
|
|
1588
1644
|
// src/graph/graph.tsx
|
|
1589
|
-
import { jsx as
|
|
1645
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1590
1646
|
var defaultGraphErrorConfig = {
|
|
1591
1647
|
icon: "triangle-exclamation",
|
|
1592
1648
|
header: "An error occurred",
|
|
@@ -1622,17 +1678,14 @@ function Graph({
|
|
|
1622
1678
|
children
|
|
1623
1679
|
}) {
|
|
1624
1680
|
var _a, _b, _c;
|
|
1625
|
-
const graphRef =
|
|
1626
|
-
const
|
|
1627
|
-
const [
|
|
1628
|
-
|
|
1681
|
+
const graphRef = React8.useRef(null);
|
|
1682
|
+
const [innerGlobalFilter, setInnerGlobalFilter] = React8.useState("");
|
|
1683
|
+
const [innerColumnFilters, setInnerColumnFilters] = React8.useState([]);
|
|
1684
|
+
if (parentGlobalFilter !== void 0 && parentGlobalFilter !== innerGlobalFilter) {
|
|
1685
|
+
setInnerGlobalFilter(parentGlobalFilter);
|
|
1686
|
+
}
|
|
1629
1687
|
const globalFilter = parentGlobalFilter != null ? parentGlobalFilter : innerGlobalFilter;
|
|
1630
1688
|
const setGlobalFilter = parentSetGlobalFilter != null ? parentSetGlobalFilter : setInnerGlobalFilter;
|
|
1631
|
-
React7.useEffect(() => {
|
|
1632
|
-
if (parentGlobalFilter !== void 0) {
|
|
1633
|
-
setInnerGlobalFilter(parentGlobalFilter);
|
|
1634
|
-
}
|
|
1635
|
-
}, [parentGlobalFilter]);
|
|
1636
1689
|
const columnFilters = parentColumnFilters != null ? parentColumnFilters : innerColumnFilters;
|
|
1637
1690
|
const setColumnFilters = parentSetColumnFilters != null ? parentSetColumnFilters : setInnerColumnFilters;
|
|
1638
1691
|
const table = useTable({
|
|
@@ -1646,7 +1699,7 @@ function Graph({
|
|
|
1646
1699
|
});
|
|
1647
1700
|
const flatColumns = table.getAllFlatColumns();
|
|
1648
1701
|
const filteredRows = table.getFilteredRowModel().rows;
|
|
1649
|
-
const filteredData =
|
|
1702
|
+
const filteredData = React8.useMemo(() => filteredRows.map((row) => row.original), [filteredRows]);
|
|
1650
1703
|
const filterCount = columnFilters.map(
|
|
1651
1704
|
({ id: columnFilterId, value }) => {
|
|
1652
1705
|
var _a2, _b2;
|
|
@@ -1660,10 +1713,10 @@ function Graph({
|
|
|
1660
1713
|
setColumnFilters([]);
|
|
1661
1714
|
setGlobalFilter("");
|
|
1662
1715
|
};
|
|
1663
|
-
const memoizedNodeTypes =
|
|
1664
|
-
const memoizedEdgeTypes =
|
|
1665
|
-
const memoizedConfig =
|
|
1666
|
-
|
|
1716
|
+
const memoizedNodeTypes = React8.useMemo(() => config.nodeTypes, [config.nodeTypes]);
|
|
1717
|
+
const memoizedEdgeTypes = React8.useMemo(() => config.edgeTypes, [config.edgeTypes]);
|
|
1718
|
+
const memoizedConfig = React8.useMemo(() => config, [config]);
|
|
1719
|
+
React8.useEffect(() => {
|
|
1667
1720
|
if (!graphRef.current) {
|
|
1668
1721
|
return;
|
|
1669
1722
|
}
|
|
@@ -1683,27 +1736,13 @@ function Graph({
|
|
|
1683
1736
|
empty: (_b = emptyView == null ? void 0 : emptyView.empty) != null ? _b : defaultGraphEmptyConfig,
|
|
1684
1737
|
filter: (_c = emptyView == null ? void 0 : emptyView.filter) != null ? _c : defaultGraphNoFilterFoundConfig
|
|
1685
1738
|
};
|
|
1686
|
-
return /* @__PURE__ */
|
|
1687
|
-
!!title && /* @__PURE__ */
|
|
1688
|
-
showToolbar && /* @__PURE__ */
|
|
1689
|
-
!disableSearch && /* @__PURE__ */
|
|
1690
|
-
|
|
1691
|
-
/* @__PURE__ */ jsx9(
|
|
1692
|
-
InputGroupInput,
|
|
1693
|
-
__spreadProps(__spreadValues({}, SEARCH_INPUT_PROPS), {
|
|
1694
|
-
id: searchInputId,
|
|
1695
|
-
className: SEARCH_INPUT_CLASS,
|
|
1696
|
-
"aria-label": "Search",
|
|
1697
|
-
placeholder: "Search\u2026",
|
|
1698
|
-
disabled: shouldDisable,
|
|
1699
|
-
value: globalFilter,
|
|
1700
|
-
onChange: (e) => setGlobalFilter(e.target.value)
|
|
1701
|
-
})
|
|
1702
|
-
)
|
|
1703
|
-
] }),
|
|
1704
|
-
!!Actions && /* @__PURE__ */ jsx9("div", { className: "ml-auto flex items-center gap-2", children: /* @__PURE__ */ jsx9(Actions, { state: graphState }) })
|
|
1739
|
+
return /* @__PURE__ */ jsxs7("div", { id: `graph-${id}`, className: cn("flex size-full flex-1 flex-col", className), children: [
|
|
1740
|
+
!!title && /* @__PURE__ */ jsx10(SectionHeader, { className: "mb-4", children: /* @__PURE__ */ jsx10(SectionHeaderContent, { children: /* @__PURE__ */ jsx10(SectionHeaderTitle, { children: title }) }) }),
|
|
1741
|
+
showToolbar && /* @__PURE__ */ jsxs7("div", { className: "mb-4 flex flex-row gap-2", children: [
|
|
1742
|
+
!disableSearch && /* @__PURE__ */ jsx10(DataTableSearch, { value: globalFilter, onValueChange: setGlobalFilter, disabled: shouldDisable }),
|
|
1743
|
+
!!Actions && /* @__PURE__ */ jsx10("div", { className: "ml-auto flex items-center gap-2", children: /* @__PURE__ */ jsx10(Actions, { state: graphState }) })
|
|
1705
1744
|
] }),
|
|
1706
|
-
showFilters && /* @__PURE__ */
|
|
1745
|
+
showFilters && /* @__PURE__ */ jsx10(
|
|
1707
1746
|
ViewFilter,
|
|
1708
1747
|
{
|
|
1709
1748
|
columns: flatColumns,
|
|
@@ -1712,9 +1751,9 @@ function Graph({
|
|
|
1712
1751
|
className: "mb-4"
|
|
1713
1752
|
}
|
|
1714
1753
|
),
|
|
1715
|
-
shouldRenderGraphContent ? /* @__PURE__ */
|
|
1716
|
-
graphState === "loading" && /* @__PURE__ */
|
|
1717
|
-
/* @__PURE__ */
|
|
1754
|
+
shouldRenderGraphContent ? /* @__PURE__ */ jsxs7("div", { className: "relative size-full flex-1", children: [
|
|
1755
|
+
graphState === "loading" && /* @__PURE__ */ jsx10(Icon5, { name: "circle-notch", className: "absolute top-4 left-4 z-10 animate-spin" }),
|
|
1756
|
+
/* @__PURE__ */ jsx10(
|
|
1718
1757
|
GraphView,
|
|
1719
1758
|
{
|
|
1720
1759
|
viewportFocusNodeId,
|
|
@@ -1724,7 +1763,7 @@ function Graph({
|
|
|
1724
1763
|
children
|
|
1725
1764
|
}
|
|
1726
1765
|
)
|
|
1727
|
-
] }) : /* @__PURE__ */
|
|
1766
|
+
] }) : /* @__PURE__ */ jsx10(
|
|
1728
1767
|
DataTableEmptyView,
|
|
1729
1768
|
{
|
|
1730
1769
|
emptyView: resolvedEmptyView,
|
|
@@ -1737,11 +1776,11 @@ function Graph({
|
|
|
1737
1776
|
}
|
|
1738
1777
|
|
|
1739
1778
|
// src/graph/hooks/useGetViewportNodeIds.ts
|
|
1740
|
-
import { useEffect as useEffect3, useMemo as useMemo7, useRef as
|
|
1779
|
+
import { useEffect as useEffect3, useMemo as useMemo7, useRef as useRef4, useState as useState5 } from "react";
|
|
1741
1780
|
import { useStore as useStore2, useViewport } from "reactflow";
|
|
1742
1781
|
var useGetDebouncedViewport = (debounceDelay = 1e3) => {
|
|
1743
|
-
const timerRef =
|
|
1744
|
-
const [debouncedValues, setDebouncedValues] =
|
|
1782
|
+
const timerRef = useRef4(null);
|
|
1783
|
+
const [debouncedValues, setDebouncedValues] = useState5({ x: 0, y: 0, zoom: 1, width: 0, height: 0, nodes: [] });
|
|
1745
1784
|
const { x, y, zoom } = useViewport();
|
|
1746
1785
|
const { width, height, nodes } = useStore2((state) => ({
|
|
1747
1786
|
width: state.width,
|