@upbound/monarch-blocks 0.13.1 → 0.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat-interface.js +60 -59
- package/dist/chat-interface.js.map +1 -1
- package/dist/data-table.d.ts +4 -3
- package/dist/data-table.js +429 -383
- package/dist/data-table.js.map +1 -1
- package/dist/{empty-view-BgEn71l5.d.ts → empty-view-DQt8-Ho8.d.ts} +9 -2
- package/dist/graph.d.ts +1 -1
- package/dist/graph.js +242 -185
- package/dist/graph.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +633 -603
- package/dist/index.js.map +1 -1
- package/dist/relative-time.d.ts +1 -1
- package/dist/relative-time.js +6 -11
- package/dist/relative-time.js.map +1 -1
- package/package.json +6 -6
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) {
|
|
@@ -511,18 +511,41 @@ function getColumnFilterCount(filterValue, filter) {
|
|
|
511
511
|
return 0;
|
|
512
512
|
}
|
|
513
513
|
|
|
514
|
+
// src/lib/data-table/filter-types.ts
|
|
515
|
+
var isDateRangeColumnFilter = (definition) => definition.type === "dateRange";
|
|
516
|
+
var isRadioColumnFilter = (definition) => definition.type === "radio";
|
|
517
|
+
var isCheckboxColumnFilter = (definition) => definition.type === "checkbox";
|
|
518
|
+
var isMultiTextColumnFilter = (definition) => definition.type === "multiText";
|
|
519
|
+
|
|
514
520
|
// src/lib/data-table/utils.ts
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
521
|
+
var filterColumnByCheckedValues = Object.assign(
|
|
522
|
+
(row, columnId, checkedValues) => {
|
|
523
|
+
if (!(checkedValues == null ? void 0 : checkedValues.length)) return true;
|
|
524
|
+
const value = row.getValue(columnId);
|
|
525
|
+
const values = Array.isArray(value) ? value : [value];
|
|
526
|
+
return values.some((item) => item != null && checkedValues.includes(String(item)));
|
|
527
|
+
},
|
|
528
|
+
{ autoRemove: (checkedValues) => !Array.isArray(checkedValues) || checkedValues.length === 0 }
|
|
529
|
+
);
|
|
530
|
+
function withDefaultFilterFns(columns) {
|
|
531
|
+
return columns.map((column) => {
|
|
532
|
+
var _a;
|
|
533
|
+
let next = column;
|
|
534
|
+
if ("columns" in column && column.columns) {
|
|
535
|
+
next = __spreadProps(__spreadValues({}, next), { columns: withDefaultFilterFns(column.columns) });
|
|
536
|
+
}
|
|
537
|
+
const filter = (_a = column.meta) == null ? void 0 : _a.filter;
|
|
538
|
+
if (filter && isCheckboxColumnFilter(filter) && column.filterFn === void 0) {
|
|
539
|
+
next = __spreadProps(__spreadValues({}, next), { filterFn: filterColumnByCheckedValues });
|
|
540
|
+
}
|
|
541
|
+
return next;
|
|
542
|
+
});
|
|
518
543
|
}
|
|
519
544
|
function hasFilterableColumns(columns) {
|
|
520
|
-
return columns.some(
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
}
|
|
525
|
-
);
|
|
545
|
+
return columns.some((column) => {
|
|
546
|
+
var _a;
|
|
547
|
+
return column.getCanFilter() && !!((_a = column.columnDef.meta) == null ? void 0 : _a.filter);
|
|
548
|
+
});
|
|
526
549
|
}
|
|
527
550
|
function getTableState({
|
|
528
551
|
error,
|
|
@@ -534,6 +557,11 @@ function getTableState({
|
|
|
534
557
|
return rowCount === 0 ? "empty" : "success";
|
|
535
558
|
}
|
|
536
559
|
|
|
560
|
+
// src/data-table/data-table-search.tsx
|
|
561
|
+
import * as React3 from "react";
|
|
562
|
+
import { Icon as Icon2 } from "@upbound/monarch-core";
|
|
563
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput } from "@upbound/monarch-core";
|
|
564
|
+
|
|
537
565
|
// src/lib/search-input.ts
|
|
538
566
|
var SEARCH_INPUT_PROPS = {
|
|
539
567
|
type: "search",
|
|
@@ -549,13 +577,64 @@ var SEARCH_INPUT_PROPS = {
|
|
|
549
577
|
};
|
|
550
578
|
var SEARCH_INPUT_CLASS = "[&::-webkit-search-cancel-button]:appearance-none";
|
|
551
579
|
|
|
580
|
+
// src/data-table/data-table-search.tsx
|
|
581
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
582
|
+
function DataTableSearch({
|
|
583
|
+
value,
|
|
584
|
+
onValueChange,
|
|
585
|
+
placeholder = "Search\u2026",
|
|
586
|
+
className,
|
|
587
|
+
disabled = false
|
|
588
|
+
}) {
|
|
589
|
+
const id = `table-search-${React3.useId()}`;
|
|
590
|
+
const inputRef = React3.useRef(null);
|
|
591
|
+
const [draft, setDraft] = React3.useState(value);
|
|
592
|
+
const [isPending, startTransition] = React3.useTransition();
|
|
593
|
+
if (!isPending && draft !== value) {
|
|
594
|
+
setDraft(value);
|
|
595
|
+
}
|
|
596
|
+
const commit = (next) => {
|
|
597
|
+
setDraft(next);
|
|
598
|
+
startTransition(() => onValueChange(next));
|
|
599
|
+
};
|
|
600
|
+
return /* @__PURE__ */ jsxs3(InputGroup, { className: cn("w-70", className), children: [
|
|
601
|
+
/* @__PURE__ */ jsx4(InputGroupAddon, { align: "inline-start", children: /* @__PURE__ */ jsx4(Icon2, { name: "magnifying-glass" }) }),
|
|
602
|
+
/* @__PURE__ */ jsx4(
|
|
603
|
+
InputGroupInput,
|
|
604
|
+
__spreadProps(__spreadValues({}, SEARCH_INPUT_PROPS), {
|
|
605
|
+
id,
|
|
606
|
+
className: SEARCH_INPUT_CLASS,
|
|
607
|
+
"aria-label": "Search",
|
|
608
|
+
placeholder,
|
|
609
|
+
disabled,
|
|
610
|
+
ref: inputRef,
|
|
611
|
+
value: draft,
|
|
612
|
+
onChange: (e) => commit(e.target.value)
|
|
613
|
+
})
|
|
614
|
+
),
|
|
615
|
+
!!draft && !disabled && /* @__PURE__ */ jsx4(InputGroupAddon, { align: "inline-end", children: /* @__PURE__ */ jsx4(
|
|
616
|
+
InputGroupButton,
|
|
617
|
+
{
|
|
618
|
+
size: "icon-xs",
|
|
619
|
+
"aria-label": "Clear search",
|
|
620
|
+
onClick: () => {
|
|
621
|
+
var _a;
|
|
622
|
+
commit("");
|
|
623
|
+
(_a = inputRef.current) == null ? void 0 : _a.focus();
|
|
624
|
+
},
|
|
625
|
+
children: /* @__PURE__ */ jsx4(Icon2, { name: "xmark" })
|
|
626
|
+
}
|
|
627
|
+
) })
|
|
628
|
+
] });
|
|
629
|
+
}
|
|
630
|
+
|
|
552
631
|
// src/data-table/empty-view.tsx
|
|
553
632
|
import { Alert, AlertDescription } from "@upbound/monarch-core";
|
|
554
633
|
import { Button } from "@upbound/monarch-core";
|
|
555
634
|
import { Empty, EmptyContent, EmptyDescription, EmptyHeader, EmptyMedia, EmptyTitle } from "@upbound/monarch-core";
|
|
556
|
-
import { Icon as
|
|
635
|
+
import { Icon as Icon3 } from "@upbound/monarch-core";
|
|
557
636
|
import { IconTile } from "@upbound/monarch-core";
|
|
558
|
-
import { jsx as
|
|
637
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
559
638
|
var defaultErrorConfig = {
|
|
560
639
|
icon: "circle-exclamation",
|
|
561
640
|
header: "Something went wrong",
|
|
@@ -586,29 +665,29 @@ function DataTableEmptyView({
|
|
|
586
665
|
const isFilteredEmpty = tableState === "empty" && filterCount > 0;
|
|
587
666
|
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
667
|
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__ */
|
|
668
|
+
const defaultAction = isFilteredEmpty && !(config == null ? void 0 : config.action) ? /* @__PURE__ */ jsxs4(Button, { variant: "outline", size: "sm", onClick: resetFilters, children: [
|
|
669
|
+
/* @__PURE__ */ jsx5(Icon3, { name: "xmark" }),
|
|
591
670
|
"Clear filters"
|
|
592
671
|
] }) : null;
|
|
593
|
-
return /* @__PURE__ */
|
|
594
|
-
/* @__PURE__ */
|
|
595
|
-
config.icon && /* @__PURE__ */
|
|
596
|
-
config.header && /* @__PURE__ */
|
|
597
|
-
config.subheader && /* @__PURE__ */
|
|
672
|
+
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: [
|
|
673
|
+
/* @__PURE__ */ jsxs4(EmptyHeader, { children: [
|
|
674
|
+
config.icon && /* @__PURE__ */ jsx5(EmptyMedia, { children: /* @__PURE__ */ jsx5(IconTile, { variant: "branded", size: "md", children: /* @__PURE__ */ jsx5(Icon3, { name: config.icon }) }) }),
|
|
675
|
+
config.header && /* @__PURE__ */ jsx5(EmptyTitle, { children: config.header }),
|
|
676
|
+
config.subheader && /* @__PURE__ */ jsx5(EmptyDescription, { children: config.subheader })
|
|
598
677
|
] }),
|
|
599
|
-
(config.details || config.action || defaultAction) && /* @__PURE__ */
|
|
600
|
-
config.details && /* @__PURE__ */
|
|
678
|
+
(config.details || config.action || defaultAction) && /* @__PURE__ */ jsxs4(EmptyContent, { children: [
|
|
679
|
+
config.details && /* @__PURE__ */ jsx5(Alert, { children: /* @__PURE__ */ jsx5(AlertDescription, { children: config.details }) }),
|
|
601
680
|
(_d = config.action) != null ? _d : defaultAction
|
|
602
681
|
] })
|
|
603
682
|
] }) });
|
|
604
683
|
}
|
|
605
684
|
|
|
606
685
|
// src/data-table/view-filter.tsx
|
|
607
|
-
import * as
|
|
686
|
+
import * as React5 from "react";
|
|
608
687
|
|
|
609
688
|
// src/filter-bar/filter-bar.tsx
|
|
610
|
-
import * as
|
|
611
|
-
import { Icon as
|
|
689
|
+
import * as React4 from "react";
|
|
690
|
+
import { Icon as Icon4 } from "@upbound/monarch-core";
|
|
612
691
|
import { Badge as Badge2 } from "@upbound/monarch-core";
|
|
613
692
|
import { Button as Button2 } from "@upbound/monarch-core";
|
|
614
693
|
import { ButtonGroup, ButtonGroupText } from "@upbound/monarch-core";
|
|
@@ -638,7 +717,7 @@ import {
|
|
|
638
717
|
import { Input } from "@upbound/monarch-core";
|
|
639
718
|
import { Label } from "@upbound/monarch-core";
|
|
640
719
|
import { Popover, PopoverContent, PopoverTrigger } from "@upbound/monarch-core";
|
|
641
|
-
import { Fragment as Fragment2, jsx as
|
|
720
|
+
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
642
721
|
function asCheckboxValue(value) {
|
|
643
722
|
return Array.isArray(value) ? value : [];
|
|
644
723
|
}
|
|
@@ -707,13 +786,13 @@ function FilterBar(_a) {
|
|
|
707
786
|
const remainingFilters = filters.filter((f) => !usedKeys.has(f.key));
|
|
708
787
|
const availableFilters = filters.some(hasOrder) ? remainingFilters : sortBy(remainingFilters, (f) => f.label);
|
|
709
788
|
const shouldShowFilters = availableFilters.length > 0 || activeFilters.length > 0;
|
|
710
|
-
const [pendingOpenKey, setPendingOpenKey] =
|
|
789
|
+
const [pendingOpenKey, setPendingOpenKey] = React4.useState(null);
|
|
711
790
|
function handleAddFilter(key) {
|
|
712
791
|
onAddFilter(key);
|
|
713
792
|
setPendingOpenKey(key);
|
|
714
793
|
}
|
|
715
|
-
const containerRef =
|
|
716
|
-
return /* @__PURE__ */
|
|
794
|
+
const containerRef = React4.useRef(null);
|
|
795
|
+
return /* @__PURE__ */ jsxs5(
|
|
717
796
|
"div",
|
|
718
797
|
__spreadProps(__spreadValues({
|
|
719
798
|
"data-slot": "filter-bar",
|
|
@@ -722,7 +801,7 @@ function FilterBar(_a) {
|
|
|
722
801
|
ref: composeRefs(containerRef, ref)
|
|
723
802
|
}, props), {
|
|
724
803
|
children: [
|
|
725
|
-
availableFilters.length > 0 && /* @__PURE__ */
|
|
804
|
+
availableFilters.length > 0 && /* @__PURE__ */ jsxs5(
|
|
726
805
|
Combobox,
|
|
727
806
|
{
|
|
728
807
|
items: availableFilters,
|
|
@@ -733,14 +812,14 @@ function FilterBar(_a) {
|
|
|
733
812
|
if (filter) handleAddFilter(filter.key);
|
|
734
813
|
},
|
|
735
814
|
children: [
|
|
736
|
-
/* @__PURE__ */
|
|
737
|
-
/* @__PURE__ */
|
|
815
|
+
/* @__PURE__ */ jsxs5(ComboboxTrigger, { "aria-label": "Add filter", showIndicator: false, render: /* @__PURE__ */ jsx6(Button2, { variant: "outline" }), children: [
|
|
816
|
+
/* @__PURE__ */ jsx6(Icon4, { name: "plus", "data-icon": "inline-start" }),
|
|
738
817
|
"Add filter"
|
|
739
818
|
] }),
|
|
740
|
-
/* @__PURE__ */
|
|
741
|
-
/* @__PURE__ */
|
|
742
|
-
/* @__PURE__ */
|
|
743
|
-
/* @__PURE__ */
|
|
819
|
+
/* @__PURE__ */ jsxs5(ComboboxContent, { container: containerRef, align: "start", className: "w-48", children: [
|
|
820
|
+
/* @__PURE__ */ jsx6(ComboboxInput, { showTrigger: false, placeholder: "Search filters\u2026" }),
|
|
821
|
+
/* @__PURE__ */ jsx6(ComboboxEmpty, { children: "No filters found." }),
|
|
822
|
+
/* @__PURE__ */ jsx6(ComboboxList, { children: (filter) => /* @__PURE__ */ jsx6(ComboboxItem, { value: filter, children: filter.label }, filter.key) })
|
|
744
823
|
] })
|
|
745
824
|
]
|
|
746
825
|
}
|
|
@@ -748,7 +827,7 @@ function FilterBar(_a) {
|
|
|
748
827
|
activeFilters.map((active) => {
|
|
749
828
|
const definition = filters.find((f) => f.key === active.key);
|
|
750
829
|
if (!definition) return null;
|
|
751
|
-
return /* @__PURE__ */
|
|
830
|
+
return /* @__PURE__ */ jsx6(
|
|
752
831
|
FilterChip,
|
|
753
832
|
{
|
|
754
833
|
definition,
|
|
@@ -771,7 +850,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
771
850
|
const type = (_a = definition.type) != null ? _a : "checkbox";
|
|
772
851
|
switch (type) {
|
|
773
852
|
case "checkbox":
|
|
774
|
-
return /* @__PURE__ */
|
|
853
|
+
return /* @__PURE__ */ jsx6(
|
|
775
854
|
CheckboxFilterChip,
|
|
776
855
|
{
|
|
777
856
|
definition,
|
|
@@ -783,7 +862,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
783
862
|
}
|
|
784
863
|
);
|
|
785
864
|
case "radio":
|
|
786
|
-
return /* @__PURE__ */
|
|
865
|
+
return /* @__PURE__ */ jsx6(
|
|
787
866
|
RadioFilterChip,
|
|
788
867
|
{
|
|
789
868
|
definition,
|
|
@@ -795,7 +874,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
795
874
|
}
|
|
796
875
|
);
|
|
797
876
|
case "text":
|
|
798
|
-
return /* @__PURE__ */
|
|
877
|
+
return /* @__PURE__ */ jsx6(
|
|
799
878
|
TextFilterChip,
|
|
800
879
|
{
|
|
801
880
|
definition,
|
|
@@ -806,7 +885,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
806
885
|
}
|
|
807
886
|
);
|
|
808
887
|
case "multiText":
|
|
809
|
-
return /* @__PURE__ */
|
|
888
|
+
return /* @__PURE__ */ jsx6(
|
|
810
889
|
MultiTextFilterChip,
|
|
811
890
|
{
|
|
812
891
|
definition,
|
|
@@ -817,7 +896,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
817
896
|
}
|
|
818
897
|
);
|
|
819
898
|
case "date":
|
|
820
|
-
return /* @__PURE__ */
|
|
899
|
+
return /* @__PURE__ */ jsx6(
|
|
821
900
|
DateFilterChip,
|
|
822
901
|
{
|
|
823
902
|
definition,
|
|
@@ -830,7 +909,7 @@ function FilterChip({ definition, value, autoOpen, container, onChangeValue, onR
|
|
|
830
909
|
}
|
|
831
910
|
}
|
|
832
911
|
function FilterChipRemoveButton({ label, onRemove }) {
|
|
833
|
-
return /* @__PURE__ */
|
|
912
|
+
return /* @__PURE__ */ jsx6(Button2, { variant: "outline", size: "icon", "aria-label": `Remove ${label} filter`, onClick: onRemove, children: /* @__PURE__ */ jsx6(Icon4, { name: "xmark" }) });
|
|
834
913
|
}
|
|
835
914
|
function CheckboxFilterChip({
|
|
836
915
|
definition,
|
|
@@ -849,9 +928,9 @@ function CheckboxFilterChip({
|
|
|
849
928
|
const next = values.includes(optionValue) ? values.filter((v) => v !== optionValue) : [...values, optionValue];
|
|
850
929
|
onChangeValue(next);
|
|
851
930
|
}
|
|
852
|
-
return /* @__PURE__ */
|
|
853
|
-
/* @__PURE__ */
|
|
854
|
-
searchable ? /* @__PURE__ */
|
|
931
|
+
return /* @__PURE__ */ jsxs5(ButtonGroup, { children: [
|
|
932
|
+
/* @__PURE__ */ jsx6(ButtonGroupText, { children: label }),
|
|
933
|
+
searchable ? /* @__PURE__ */ jsxs5(
|
|
855
934
|
Combobox,
|
|
856
935
|
{
|
|
857
936
|
items: options,
|
|
@@ -861,34 +940,34 @@ function CheckboxFilterChip({
|
|
|
861
940
|
value: options.filter((o) => values.includes(o.value)),
|
|
862
941
|
onValueChange: (selected) => onChangeValue(selected.map((s) => s.value)),
|
|
863
942
|
children: [
|
|
864
|
-
/* @__PURE__ */
|
|
943
|
+
/* @__PURE__ */ jsx6(
|
|
865
944
|
ComboboxTrigger,
|
|
866
945
|
{
|
|
867
|
-
render: /* @__PURE__ */
|
|
868
|
-
children: /* @__PURE__ */
|
|
946
|
+
render: /* @__PURE__ */ jsx6(Button2, { variant: "outline", className: "gap-1 font-normal [&>svg:last-child]:size-(--icon-sm)" }),
|
|
947
|
+
children: /* @__PURE__ */ jsx6("span", { className: values.length === 0 ? "text-muted-foreground" : "", children: displayLabel })
|
|
869
948
|
}
|
|
870
949
|
),
|
|
871
|
-
/* @__PURE__ */
|
|
950
|
+
/* @__PURE__ */ jsxs5(
|
|
872
951
|
ComboboxContent,
|
|
873
952
|
{
|
|
874
953
|
container,
|
|
875
954
|
className: "min-w-64",
|
|
876
955
|
collisionAvoidance: { side: "none", align: "shift" },
|
|
877
956
|
children: [
|
|
878
|
-
/* @__PURE__ */
|
|
879
|
-
values.length > 0 && /* @__PURE__ */
|
|
880
|
-
/* @__PURE__ */
|
|
881
|
-
/* @__PURE__ */
|
|
882
|
-
/* @__PURE__ */
|
|
957
|
+
/* @__PURE__ */ jsx6(ComboboxInput, { showTrigger: false, placeholder: `Search ${label.toLowerCase()}\u2026` }),
|
|
958
|
+
values.length > 0 && /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
959
|
+
/* @__PURE__ */ jsxs5(ComboboxSelectedChips, { children: [
|
|
960
|
+
/* @__PURE__ */ jsx6(ComboboxValue, { children: (selected) => /* @__PURE__ */ jsx6(Fragment2, { children: selected.map((item) => /* @__PURE__ */ jsx6(ComboboxChip, { children: item.label }, item.value)) }) }),
|
|
961
|
+
/* @__PURE__ */ jsx6(ComboboxClearAll, { onClick: () => onChangeValue([]) })
|
|
883
962
|
] }),
|
|
884
|
-
/* @__PURE__ */
|
|
963
|
+
/* @__PURE__ */ jsx6(ComboboxSeparator, {})
|
|
885
964
|
] }),
|
|
886
|
-
/* @__PURE__ */
|
|
965
|
+
/* @__PURE__ */ jsxs5(ComboboxEmpty, { children: [
|
|
887
966
|
"No ",
|
|
888
967
|
label.toLowerCase(),
|
|
889
968
|
" found."
|
|
890
969
|
] }),
|
|
891
|
-
/* @__PURE__ */
|
|
970
|
+
/* @__PURE__ */ jsx6(ComboboxList, { children: (item) => /* @__PURE__ */ jsxs5(ComboboxItem, { value: item, children: [
|
|
892
971
|
item.icon,
|
|
893
972
|
item.label
|
|
894
973
|
] }, item.value) })
|
|
@@ -897,12 +976,12 @@ function CheckboxFilterChip({
|
|
|
897
976
|
)
|
|
898
977
|
]
|
|
899
978
|
}
|
|
900
|
-
) : /* @__PURE__ */
|
|
901
|
-
/* @__PURE__ */
|
|
902
|
-
/* @__PURE__ */
|
|
903
|
-
/* @__PURE__ */
|
|
979
|
+
) : /* @__PURE__ */ jsxs5(DropdownMenu, { defaultOpen: autoOpen, children: [
|
|
980
|
+
/* @__PURE__ */ jsx6(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs5(Button2, { variant: "outline", className: "gap-1 font-normal", children: [
|
|
981
|
+
/* @__PURE__ */ jsx6("span", { className: values.length === 0 ? "text-muted-foreground" : "", children: displayLabel }),
|
|
982
|
+
/* @__PURE__ */ jsx6(Icon4, { name: "chevron-down", size: "sm", className: "text-muted-foreground" })
|
|
904
983
|
] }) }),
|
|
905
|
-
/* @__PURE__ */
|
|
984
|
+
/* @__PURE__ */ jsx6(DropdownMenuContent, { align: "start", className: "w-48", children: options.map((opt) => /* @__PURE__ */ jsxs5(
|
|
906
985
|
DropdownMenuCheckboxItem,
|
|
907
986
|
{
|
|
908
987
|
checked: values.includes(opt.value),
|
|
@@ -915,7 +994,7 @@ function CheckboxFilterChip({
|
|
|
915
994
|
opt.value
|
|
916
995
|
)) })
|
|
917
996
|
] }),
|
|
918
|
-
/* @__PURE__ */
|
|
997
|
+
/* @__PURE__ */ jsx6(FilterChipRemoveButton, { label, onRemove })
|
|
919
998
|
] });
|
|
920
999
|
}
|
|
921
1000
|
function RadioFilterChip({
|
|
@@ -932,9 +1011,9 @@ function RadioFilterChip({
|
|
|
932
1011
|
const selectedValue = asRadioValue(value);
|
|
933
1012
|
const displayLabel = selectedValue ? (_b = (_a = options.find((o) => o.value === selectedValue)) == null ? void 0 : _a.label) != null ? _b : selectedValue : "Any";
|
|
934
1013
|
const selected = (_c = options.find((o) => o.value === selectedValue)) != null ? _c : null;
|
|
935
|
-
return /* @__PURE__ */
|
|
936
|
-
/* @__PURE__ */
|
|
937
|
-
searchable ? /* @__PURE__ */
|
|
1014
|
+
return /* @__PURE__ */ jsxs5(ButtonGroup, { children: [
|
|
1015
|
+
/* @__PURE__ */ jsx6(ButtonGroupText, { children: label }),
|
|
1016
|
+
searchable ? /* @__PURE__ */ jsxs5(
|
|
938
1017
|
Combobox,
|
|
939
1018
|
{
|
|
940
1019
|
items: options,
|
|
@@ -946,27 +1025,27 @@ function RadioFilterChip({
|
|
|
946
1025
|
return onChangeValue((_a2 = next == null ? void 0 : next.value) != null ? _a2 : "");
|
|
947
1026
|
},
|
|
948
1027
|
children: [
|
|
949
|
-
/* @__PURE__ */
|
|
1028
|
+
/* @__PURE__ */ jsx6(
|
|
950
1029
|
ComboboxTrigger,
|
|
951
1030
|
{
|
|
952
|
-
render: /* @__PURE__ */
|
|
953
|
-
children: /* @__PURE__ */
|
|
1031
|
+
render: /* @__PURE__ */ jsx6(Button2, { variant: "outline", className: "gap-1 font-normal [&>svg:last-child]:size-(--icon-sm)" }),
|
|
1032
|
+
children: /* @__PURE__ */ jsx6("span", { className: selectedValue ? "" : "text-muted-foreground", children: displayLabel })
|
|
954
1033
|
}
|
|
955
1034
|
),
|
|
956
|
-
/* @__PURE__ */
|
|
1035
|
+
/* @__PURE__ */ jsxs5(
|
|
957
1036
|
ComboboxContent,
|
|
958
1037
|
{
|
|
959
1038
|
container,
|
|
960
1039
|
className: "min-w-64",
|
|
961
1040
|
collisionAvoidance: { side: "none", align: "shift" },
|
|
962
1041
|
children: [
|
|
963
|
-
/* @__PURE__ */
|
|
964
|
-
/* @__PURE__ */
|
|
1042
|
+
/* @__PURE__ */ jsx6(ComboboxInput, { showTrigger: false, placeholder: `Search ${label.toLowerCase()}\u2026` }),
|
|
1043
|
+
/* @__PURE__ */ jsxs5(ComboboxEmpty, { children: [
|
|
965
1044
|
"No ",
|
|
966
1045
|
label.toLowerCase(),
|
|
967
1046
|
" found."
|
|
968
1047
|
] }),
|
|
969
|
-
/* @__PURE__ */
|
|
1048
|
+
/* @__PURE__ */ jsx6(ComboboxList, { children: (item) => /* @__PURE__ */ jsxs5(ComboboxItem, { value: item, children: [
|
|
970
1049
|
item.icon,
|
|
971
1050
|
item.label
|
|
972
1051
|
] }, item.value) })
|
|
@@ -975,17 +1054,17 @@ function RadioFilterChip({
|
|
|
975
1054
|
)
|
|
976
1055
|
]
|
|
977
1056
|
}
|
|
978
|
-
) : /* @__PURE__ */
|
|
979
|
-
/* @__PURE__ */
|
|
980
|
-
/* @__PURE__ */
|
|
981
|
-
/* @__PURE__ */
|
|
1057
|
+
) : /* @__PURE__ */ jsxs5(DropdownMenu, { defaultOpen: autoOpen, children: [
|
|
1058
|
+
/* @__PURE__ */ jsx6(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs5(Button2, { variant: "outline", className: "gap-1 font-normal", children: [
|
|
1059
|
+
/* @__PURE__ */ jsx6("span", { className: selectedValue ? "" : "text-muted-foreground", children: displayLabel }),
|
|
1060
|
+
/* @__PURE__ */ jsx6(Icon4, { name: "chevron-down", size: "sm", className: "text-muted-foreground" })
|
|
982
1061
|
] }) }),
|
|
983
|
-
/* @__PURE__ */
|
|
1062
|
+
/* @__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
1063
|
opt.icon,
|
|
985
1064
|
opt.label
|
|
986
1065
|
] }, opt.value)) }) })
|
|
987
1066
|
] }),
|
|
988
|
-
/* @__PURE__ */
|
|
1067
|
+
/* @__PURE__ */ jsx6(FilterChipRemoveButton, { label, onRemove })
|
|
989
1068
|
] });
|
|
990
1069
|
}
|
|
991
1070
|
function TextFilterChip({
|
|
@@ -997,12 +1076,12 @@ function TextFilterChip({
|
|
|
997
1076
|
}) {
|
|
998
1077
|
const { label, placeholder } = definition;
|
|
999
1078
|
const text = asTextValue(value);
|
|
1000
|
-
const [open, setOpen] =
|
|
1001
|
-
return /* @__PURE__ */
|
|
1002
|
-
/* @__PURE__ */
|
|
1003
|
-
/* @__PURE__ */
|
|
1004
|
-
/* @__PURE__ */
|
|
1005
|
-
/* @__PURE__ */
|
|
1079
|
+
const [open, setOpen] = React4.useState(!!autoOpen);
|
|
1080
|
+
return /* @__PURE__ */ jsxs5(ButtonGroup, { children: [
|
|
1081
|
+
/* @__PURE__ */ jsx6(ButtonGroupText, { children: label }),
|
|
1082
|
+
/* @__PURE__ */ jsxs5(Popover, { open, onOpenChange: setOpen, children: [
|
|
1083
|
+
/* @__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" }) }) }),
|
|
1084
|
+
/* @__PURE__ */ jsx6(PopoverContent, { align: "start", children: /* @__PURE__ */ jsx6(
|
|
1006
1085
|
Input,
|
|
1007
1086
|
{
|
|
1008
1087
|
autoFocus: true,
|
|
@@ -1015,7 +1094,7 @@ function TextFilterChip({
|
|
|
1015
1094
|
}
|
|
1016
1095
|
) })
|
|
1017
1096
|
] }),
|
|
1018
|
-
/* @__PURE__ */
|
|
1097
|
+
/* @__PURE__ */ jsx6(FilterChipRemoveButton, { label, onRemove })
|
|
1019
1098
|
] });
|
|
1020
1099
|
}
|
|
1021
1100
|
function MultiTextFilterChip({
|
|
@@ -1027,7 +1106,7 @@ function MultiTextFilterChip({
|
|
|
1027
1106
|
}) {
|
|
1028
1107
|
const { label, placeholder } = definition;
|
|
1029
1108
|
const tokens = asMultiTextValue(value);
|
|
1030
|
-
const [draft, setDraft] =
|
|
1109
|
+
const [draft, setDraft] = React4.useState("");
|
|
1031
1110
|
const displayLabel = tokens.length === 0 ? "Any" : tokens.length === 1 ? tokens[0] : `${tokens.length} values`;
|
|
1032
1111
|
function addToken() {
|
|
1033
1112
|
const token = draft.trim();
|
|
@@ -1041,25 +1120,25 @@ function MultiTextFilterChip({
|
|
|
1041
1120
|
function removeToken(token) {
|
|
1042
1121
|
onChangeValue(tokens.filter((t) => t !== token));
|
|
1043
1122
|
}
|
|
1044
|
-
return /* @__PURE__ */
|
|
1045
|
-
/* @__PURE__ */
|
|
1046
|
-
/* @__PURE__ */
|
|
1047
|
-
/* @__PURE__ */
|
|
1048
|
-
/* @__PURE__ */
|
|
1049
|
-
tokens.length > 0 && /* @__PURE__ */
|
|
1123
|
+
return /* @__PURE__ */ jsxs5(ButtonGroup, { children: [
|
|
1124
|
+
/* @__PURE__ */ jsx6(ButtonGroupText, { children: label }),
|
|
1125
|
+
/* @__PURE__ */ jsxs5(Popover, { defaultOpen: autoOpen, children: [
|
|
1126
|
+
/* @__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 }) }) }),
|
|
1127
|
+
/* @__PURE__ */ jsx6(PopoverContent, { align: "start", children: /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2", children: [
|
|
1128
|
+
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
1129
|
token,
|
|
1051
|
-
/* @__PURE__ */
|
|
1130
|
+
/* @__PURE__ */ jsx6(
|
|
1052
1131
|
"button",
|
|
1053
1132
|
{
|
|
1054
1133
|
type: "button",
|
|
1055
1134
|
"aria-label": `Remove ${token}`,
|
|
1056
1135
|
onClick: () => removeToken(token),
|
|
1057
1136
|
className: "cursor-pointer",
|
|
1058
|
-
children: /* @__PURE__ */
|
|
1137
|
+
children: /* @__PURE__ */ jsx6(Icon4, { name: "xmark", size: "xs" })
|
|
1059
1138
|
}
|
|
1060
1139
|
)
|
|
1061
1140
|
] }, token)) }),
|
|
1062
|
-
/* @__PURE__ */
|
|
1141
|
+
/* @__PURE__ */ jsx6(
|
|
1063
1142
|
Input,
|
|
1064
1143
|
{
|
|
1065
1144
|
autoFocus: true,
|
|
@@ -1078,7 +1157,7 @@ function MultiTextFilterChip({
|
|
|
1078
1157
|
)
|
|
1079
1158
|
] }) })
|
|
1080
1159
|
] }),
|
|
1081
|
-
/* @__PURE__ */
|
|
1160
|
+
/* @__PURE__ */ jsx6(FilterChipRemoveButton, { label, onRemove })
|
|
1082
1161
|
] });
|
|
1083
1162
|
}
|
|
1084
1163
|
function DateFilterChip({
|
|
@@ -1108,12 +1187,12 @@ function DateFilterChip({
|
|
|
1108
1187
|
if (!endDate) return;
|
|
1109
1188
|
onChangeValue({ startDate, endDate: applyTimeToDate(endDate, time) });
|
|
1110
1189
|
}
|
|
1111
|
-
return /* @__PURE__ */
|
|
1112
|
-
/* @__PURE__ */
|
|
1113
|
-
/* @__PURE__ */
|
|
1114
|
-
/* @__PURE__ */
|
|
1115
|
-
/* @__PURE__ */
|
|
1116
|
-
/* @__PURE__ */
|
|
1190
|
+
return /* @__PURE__ */ jsxs5(ButtonGroup, { children: [
|
|
1191
|
+
/* @__PURE__ */ jsx6(ButtonGroupText, { children: label }),
|
|
1192
|
+
/* @__PURE__ */ jsxs5(Popover, { defaultOpen: autoOpen, children: [
|
|
1193
|
+
/* @__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 }) }) }),
|
|
1194
|
+
/* @__PURE__ */ jsx6(PopoverContent, { align: "start", className: "w-fit", children: /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2", children: [
|
|
1195
|
+
/* @__PURE__ */ jsx6(
|
|
1117
1196
|
Calendar,
|
|
1118
1197
|
{
|
|
1119
1198
|
mode: "range",
|
|
@@ -1121,9 +1200,9 @@ function DateFilterChip({
|
|
|
1121
1200
|
onSelect: pickRange
|
|
1122
1201
|
}
|
|
1123
1202
|
),
|
|
1124
|
-
showTimeInputs && /* @__PURE__ */
|
|
1125
|
-
/* @__PURE__ */
|
|
1126
|
-
/* @__PURE__ */
|
|
1203
|
+
showTimeInputs && /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2", children: [
|
|
1204
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex w-full items-center gap-2", children: [
|
|
1205
|
+
/* @__PURE__ */ jsx6(
|
|
1127
1206
|
Label,
|
|
1128
1207
|
{
|
|
1129
1208
|
htmlFor: `${definition.key}-start-time`,
|
|
@@ -1131,7 +1210,7 @@ function DateFilterChip({
|
|
|
1131
1210
|
children: "Start"
|
|
1132
1211
|
}
|
|
1133
1212
|
),
|
|
1134
|
-
/* @__PURE__ */
|
|
1213
|
+
/* @__PURE__ */ jsx6(
|
|
1135
1214
|
Input,
|
|
1136
1215
|
{
|
|
1137
1216
|
id: `${definition.key}-start-time`,
|
|
@@ -1143,8 +1222,8 @@ function DateFilterChip({
|
|
|
1143
1222
|
}
|
|
1144
1223
|
)
|
|
1145
1224
|
] }),
|
|
1146
|
-
/* @__PURE__ */
|
|
1147
|
-
/* @__PURE__ */
|
|
1225
|
+
/* @__PURE__ */ jsxs5("div", { className: "flex w-full items-center gap-2", children: [
|
|
1226
|
+
/* @__PURE__ */ jsx6(
|
|
1148
1227
|
Label,
|
|
1149
1228
|
{
|
|
1150
1229
|
htmlFor: `${definition.key}-end-time`,
|
|
@@ -1152,7 +1231,7 @@ function DateFilterChip({
|
|
|
1152
1231
|
children: "End"
|
|
1153
1232
|
}
|
|
1154
1233
|
),
|
|
1155
|
-
/* @__PURE__ */
|
|
1234
|
+
/* @__PURE__ */ jsx6(
|
|
1156
1235
|
Input,
|
|
1157
1236
|
{
|
|
1158
1237
|
id: `${definition.key}-end-time`,
|
|
@@ -1167,18 +1246,12 @@ function DateFilterChip({
|
|
|
1167
1246
|
] })
|
|
1168
1247
|
] }) })
|
|
1169
1248
|
] }),
|
|
1170
|
-
/* @__PURE__ */
|
|
1249
|
+
/* @__PURE__ */ jsx6(FilterChipRemoveButton, { label, onRemove })
|
|
1171
1250
|
] });
|
|
1172
1251
|
}
|
|
1173
1252
|
|
|
1174
|
-
// src/lib/data-table/filter-types.ts
|
|
1175
|
-
var isDateRangeColumnFilter = (definition) => definition.type === "dateRange";
|
|
1176
|
-
var isRadioColumnFilter = (definition) => definition.type === "radio";
|
|
1177
|
-
var isCheckboxColumnFilter = (definition) => definition.type === "checkbox";
|
|
1178
|
-
var isMultiTextColumnFilter = (definition) => definition.type === "multiText";
|
|
1179
|
-
|
|
1180
1253
|
// src/data-table/view-filter.tsx
|
|
1181
|
-
import { jsx as
|
|
1254
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
1182
1255
|
function toFilterOption(opt) {
|
|
1183
1256
|
return typeof opt === "string" ? { value: opt, label: opt } : { value: opt.value, label: opt.label };
|
|
1184
1257
|
}
|
|
@@ -1221,15 +1294,15 @@ function ViewFilter({
|
|
|
1221
1294
|
onColumnFiltersChange,
|
|
1222
1295
|
className
|
|
1223
1296
|
}) {
|
|
1224
|
-
const filterableColumns =
|
|
1225
|
-
() => columns.filter((column) =>
|
|
1297
|
+
const filterableColumns = React5.useMemo(
|
|
1298
|
+
() => columns.filter((column) => column.getCanFilter()).flatMap((column) => {
|
|
1226
1299
|
var _a;
|
|
1227
1300
|
const filter = (_a = column.columnDef.meta) == null ? void 0 : _a.filter;
|
|
1228
1301
|
return filter ? [{ key: column.id, filter }] : [];
|
|
1229
1302
|
}),
|
|
1230
1303
|
[columns]
|
|
1231
1304
|
);
|
|
1232
|
-
const filterDefinitions =
|
|
1305
|
+
const filterDefinitions = React5.useMemo(
|
|
1233
1306
|
() => filterableColumns.map(({ key, filter }) => toFilterBarDefinition(key, filter)).sort((a, b) => {
|
|
1234
1307
|
if (a.order == null && b.order == null) return 0;
|
|
1235
1308
|
if (a.order == null) return 1;
|
|
@@ -1238,15 +1311,15 @@ function ViewFilter({
|
|
|
1238
1311
|
}),
|
|
1239
1312
|
[filterableColumns]
|
|
1240
1313
|
);
|
|
1241
|
-
const emptyValueByKey =
|
|
1314
|
+
const emptyValueByKey = React5.useMemo(
|
|
1242
1315
|
() => new Map(filterableColumns.map(({ key, filter }) => [key, emptyValueFor(filter)])),
|
|
1243
1316
|
[filterableColumns]
|
|
1244
1317
|
);
|
|
1245
|
-
const activeFilters =
|
|
1318
|
+
const activeFilters = React5.useMemo(
|
|
1246
1319
|
() => columnFilters.map((filter) => ({ key: filter.id, value: filter.value })),
|
|
1247
1320
|
[columnFilters]
|
|
1248
1321
|
);
|
|
1249
|
-
return /* @__PURE__ */
|
|
1322
|
+
return /* @__PURE__ */ jsx7(
|
|
1250
1323
|
FilterBar,
|
|
1251
1324
|
{
|
|
1252
1325
|
className,
|
|
@@ -1260,10 +1333,10 @@ function ViewFilter({
|
|
|
1260
1333
|
}
|
|
1261
1334
|
|
|
1262
1335
|
// src/section-header.tsx
|
|
1263
|
-
import { jsx as
|
|
1336
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
1264
1337
|
function SectionHeader(_a) {
|
|
1265
1338
|
var _b = _a, { className, children } = _b, props = __objRest(_b, ["className", "children"]);
|
|
1266
|
-
return /* @__PURE__ */
|
|
1339
|
+
return /* @__PURE__ */ jsx8(
|
|
1267
1340
|
"div",
|
|
1268
1341
|
__spreadProps(__spreadValues({
|
|
1269
1342
|
"data-slot": "section-header",
|
|
@@ -1275,15 +1348,15 @@ function SectionHeader(_a) {
|
|
|
1275
1348
|
}
|
|
1276
1349
|
function SectionHeaderContent(_a) {
|
|
1277
1350
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1278
|
-
return /* @__PURE__ */
|
|
1351
|
+
return /* @__PURE__ */ jsx8("div", __spreadValues({ "data-slot": "section-header-content", className: cn("flex flex-col gap-1", className) }, props));
|
|
1279
1352
|
}
|
|
1280
1353
|
function SectionHeaderTitle(_a) {
|
|
1281
1354
|
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
1282
|
-
return /* @__PURE__ */
|
|
1355
|
+
return /* @__PURE__ */ jsx8("h2", __spreadValues({ "data-slot": "section-header-title", className: cn("text-h3 text-foreground", className) }, props));
|
|
1283
1356
|
}
|
|
1284
1357
|
|
|
1285
1358
|
// src/graph/graph-view.tsx
|
|
1286
|
-
import * as
|
|
1359
|
+
import * as React7 from "react";
|
|
1287
1360
|
import { Background, Controls, MiniMap, ReactFlow, ReactFlowProvider } from "reactflow";
|
|
1288
1361
|
|
|
1289
1362
|
// src/graph/hooks/useAutoLayout.ts
|
|
@@ -1491,7 +1564,7 @@ var useNodeVisibility = (nodes, edges) => {
|
|
|
1491
1564
|
};
|
|
1492
1565
|
|
|
1493
1566
|
// src/graph/hooks/useViewportFocus.ts
|
|
1494
|
-
import * as
|
|
1567
|
+
import * as React6 from "react";
|
|
1495
1568
|
import { useReactFlow, useStore } from "reactflow";
|
|
1496
1569
|
function getViewportFocusCenter(node) {
|
|
1497
1570
|
var _a;
|
|
@@ -1506,7 +1579,7 @@ function useViewportFocus(nodeMap, viewportFocusNodeId) {
|
|
|
1506
1579
|
const { setCenter } = useReactFlow();
|
|
1507
1580
|
const viewportReady = useStore((state) => state.width > 0 && state.height > 0);
|
|
1508
1581
|
const node = viewportFocusNodeId ? nodeMap.get(viewportFocusNodeId) : void 0;
|
|
1509
|
-
|
|
1582
|
+
React6.useEffect(() => {
|
|
1510
1583
|
if (!node || !viewportReady) {
|
|
1511
1584
|
return;
|
|
1512
1585
|
}
|
|
@@ -1516,24 +1589,24 @@ function useViewportFocus(nodeMap, viewportFocusNodeId) {
|
|
|
1516
1589
|
}
|
|
1517
1590
|
|
|
1518
1591
|
// src/graph/graph-view.tsx
|
|
1519
|
-
import { jsx as
|
|
1592
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1520
1593
|
var GraphViewInternal = ({ nodeTypes: parentNodeTypes, edgeTypes: parentEdgeTypes, children, viewportFocusNodeId }) => {
|
|
1521
1594
|
const { nodes, edges, toggleNodeExpansion } = useGraphActionsContext();
|
|
1522
|
-
const nodeTypes =
|
|
1595
|
+
const nodeTypes = React7.useMemo(
|
|
1523
1596
|
() => __spreadValues({
|
|
1524
1597
|
default: GraphNode,
|
|
1525
1598
|
loading: GraphNodeSkeleton
|
|
1526
1599
|
}, parentNodeTypes),
|
|
1527
1600
|
[parentNodeTypes]
|
|
1528
1601
|
);
|
|
1529
|
-
const edgeTypes =
|
|
1602
|
+
const edgeTypes = React7.useMemo(
|
|
1530
1603
|
() => __spreadValues({
|
|
1531
1604
|
default: GraphEdge
|
|
1532
1605
|
}, parentEdgeTypes),
|
|
1533
1606
|
[parentEdgeTypes]
|
|
1534
1607
|
);
|
|
1535
1608
|
const { nodes: visibleNodes, edges: visibleEdges } = useNodeVisibility(nodes, edges);
|
|
1536
|
-
const nodesWithExpansion =
|
|
1609
|
+
const nodesWithExpansion = React7.useMemo(() => {
|
|
1537
1610
|
return visibleNodes.map((node) => {
|
|
1538
1611
|
if (isDefaultNode(node) && !node.data.onExpandToggle) {
|
|
1539
1612
|
return __spreadProps(__spreadValues({}, node), {
|
|
@@ -1553,7 +1626,7 @@ var GraphViewInternal = ({ nodeTypes: parentNodeTypes, edgeTypes: parentEdgeType
|
|
|
1553
1626
|
viewportFocusNodeId
|
|
1554
1627
|
});
|
|
1555
1628
|
useViewportFocus(nodeMap, viewportFocusNodeId);
|
|
1556
|
-
return /* @__PURE__ */
|
|
1629
|
+
return /* @__PURE__ */ jsxs6(
|
|
1557
1630
|
ReactFlow,
|
|
1558
1631
|
{
|
|
1559
1632
|
nodeTypes,
|
|
@@ -1572,21 +1645,21 @@ var GraphViewInternal = ({ nodeTypes: parentNodeTypes, edgeTypes: parentEdgeType
|
|
|
1572
1645
|
panOnScroll: true,
|
|
1573
1646
|
selectionOnDrag: true,
|
|
1574
1647
|
children: [
|
|
1575
|
-
/* @__PURE__ */
|
|
1576
|
-
/* @__PURE__ */
|
|
1577
|
-
/* @__PURE__ */
|
|
1648
|
+
/* @__PURE__ */ jsx9(Background, { className: "bg-muted text-muted" }),
|
|
1649
|
+
/* @__PURE__ */ jsx9(Controls, { showInteractive: false }),
|
|
1650
|
+
/* @__PURE__ */ jsx9(MiniMap, { zoomable: true, pannable: true }),
|
|
1578
1651
|
children
|
|
1579
1652
|
]
|
|
1580
1653
|
}
|
|
1581
1654
|
);
|
|
1582
1655
|
};
|
|
1583
|
-
var GraphView =
|
|
1584
|
-
return /* @__PURE__ */
|
|
1656
|
+
var GraphView = React7.forwardRef(({ defaultNodes = [], defaultEdges = [], nodeTypes, edgeTypes, children, viewportFocusNodeId }, ref) => {
|
|
1657
|
+
return /* @__PURE__ */ jsx9(ReactFlowProvider, { children: /* @__PURE__ */ jsx9(GraphActionsProvider, { ref, initialNodes: defaultNodes, initialEdges: defaultEdges, children: /* @__PURE__ */ jsx9(GraphViewInternal, { nodeTypes, edgeTypes, viewportFocusNodeId, children }) }) });
|
|
1585
1658
|
});
|
|
1586
1659
|
GraphView.displayName = "GraphView";
|
|
1587
1660
|
|
|
1588
1661
|
// src/graph/graph.tsx
|
|
1589
|
-
import { jsx as
|
|
1662
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1590
1663
|
var defaultGraphErrorConfig = {
|
|
1591
1664
|
icon: "triangle-exclamation",
|
|
1592
1665
|
header: "An error occurred",
|
|
@@ -1622,23 +1695,21 @@ function Graph({
|
|
|
1622
1695
|
children
|
|
1623
1696
|
}) {
|
|
1624
1697
|
var _a, _b, _c;
|
|
1625
|
-
const graphRef =
|
|
1626
|
-
const
|
|
1627
|
-
const [
|
|
1628
|
-
|
|
1698
|
+
const graphRef = React8.useRef(null);
|
|
1699
|
+
const [innerGlobalFilter, setInnerGlobalFilter] = React8.useState("");
|
|
1700
|
+
const [innerColumnFilters, setInnerColumnFilters] = React8.useState([]);
|
|
1701
|
+
if (parentGlobalFilter !== void 0 && parentGlobalFilter !== innerGlobalFilter) {
|
|
1702
|
+
setInnerGlobalFilter(parentGlobalFilter);
|
|
1703
|
+
}
|
|
1629
1704
|
const globalFilter = parentGlobalFilter != null ? parentGlobalFilter : innerGlobalFilter;
|
|
1630
1705
|
const setGlobalFilter = parentSetGlobalFilter != null ? parentSetGlobalFilter : setInnerGlobalFilter;
|
|
1631
|
-
React7.useEffect(() => {
|
|
1632
|
-
if (parentGlobalFilter !== void 0) {
|
|
1633
|
-
setInnerGlobalFilter(parentGlobalFilter);
|
|
1634
|
-
}
|
|
1635
|
-
}, [parentGlobalFilter]);
|
|
1636
1706
|
const columnFilters = parentColumnFilters != null ? parentColumnFilters : innerColumnFilters;
|
|
1637
1707
|
const setColumnFilters = parentSetColumnFilters != null ? parentSetColumnFilters : setInnerColumnFilters;
|
|
1708
|
+
const columns = React8.useMemo(() => withDefaultFilterFns(columnDefinitions), [columnDefinitions]);
|
|
1638
1709
|
const table = useTable({
|
|
1639
1710
|
features: dataTableFeatures,
|
|
1640
1711
|
data: config.data,
|
|
1641
|
-
columns
|
|
1712
|
+
columns,
|
|
1642
1713
|
state: { columnFilters, globalFilter },
|
|
1643
1714
|
onColumnFiltersChange: setColumnFilters,
|
|
1644
1715
|
onGlobalFilterChange: setGlobalFilter,
|
|
@@ -1646,7 +1717,7 @@ function Graph({
|
|
|
1646
1717
|
});
|
|
1647
1718
|
const flatColumns = table.getAllFlatColumns();
|
|
1648
1719
|
const filteredRows = table.getFilteredRowModel().rows;
|
|
1649
|
-
const filteredData =
|
|
1720
|
+
const filteredData = React8.useMemo(() => filteredRows.map((row) => row.original), [filteredRows]);
|
|
1650
1721
|
const filterCount = columnFilters.map(
|
|
1651
1722
|
({ id: columnFilterId, value }) => {
|
|
1652
1723
|
var _a2, _b2;
|
|
@@ -1660,10 +1731,10 @@ function Graph({
|
|
|
1660
1731
|
setColumnFilters([]);
|
|
1661
1732
|
setGlobalFilter("");
|
|
1662
1733
|
};
|
|
1663
|
-
const memoizedNodeTypes =
|
|
1664
|
-
const memoizedEdgeTypes =
|
|
1665
|
-
const memoizedConfig =
|
|
1666
|
-
|
|
1734
|
+
const memoizedNodeTypes = React8.useMemo(() => config.nodeTypes, [config.nodeTypes]);
|
|
1735
|
+
const memoizedEdgeTypes = React8.useMemo(() => config.edgeTypes, [config.edgeTypes]);
|
|
1736
|
+
const memoizedConfig = React8.useMemo(() => config, [config]);
|
|
1737
|
+
React8.useEffect(() => {
|
|
1667
1738
|
if (!graphRef.current) {
|
|
1668
1739
|
return;
|
|
1669
1740
|
}
|
|
@@ -1683,27 +1754,13 @@ function Graph({
|
|
|
1683
1754
|
empty: (_b = emptyView == null ? void 0 : emptyView.empty) != null ? _b : defaultGraphEmptyConfig,
|
|
1684
1755
|
filter: (_c = emptyView == null ? void 0 : emptyView.filter) != null ? _c : defaultGraphNoFilterFoundConfig
|
|
1685
1756
|
};
|
|
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 }) })
|
|
1757
|
+
return /* @__PURE__ */ jsxs7("div", { id: `graph-${id}`, className: cn("flex size-full flex-1 flex-col", className), children: [
|
|
1758
|
+
!!title && /* @__PURE__ */ jsx10(SectionHeader, { className: "mb-4", children: /* @__PURE__ */ jsx10(SectionHeaderContent, { children: /* @__PURE__ */ jsx10(SectionHeaderTitle, { children: title }) }) }),
|
|
1759
|
+
showToolbar && /* @__PURE__ */ jsxs7("div", { className: "mb-4 flex flex-row gap-2", children: [
|
|
1760
|
+
!disableSearch && /* @__PURE__ */ jsx10(DataTableSearch, { value: globalFilter, onValueChange: setGlobalFilter, disabled: shouldDisable }),
|
|
1761
|
+
!!Actions && /* @__PURE__ */ jsx10("div", { className: "ml-auto flex items-center gap-2", children: /* @__PURE__ */ jsx10(Actions, { state: graphState }) })
|
|
1705
1762
|
] }),
|
|
1706
|
-
showFilters && /* @__PURE__ */
|
|
1763
|
+
showFilters && /* @__PURE__ */ jsx10(
|
|
1707
1764
|
ViewFilter,
|
|
1708
1765
|
{
|
|
1709
1766
|
columns: flatColumns,
|
|
@@ -1712,9 +1769,9 @@ function Graph({
|
|
|
1712
1769
|
className: "mb-4"
|
|
1713
1770
|
}
|
|
1714
1771
|
),
|
|
1715
|
-
shouldRenderGraphContent ? /* @__PURE__ */
|
|
1716
|
-
graphState === "loading" && /* @__PURE__ */
|
|
1717
|
-
/* @__PURE__ */
|
|
1772
|
+
shouldRenderGraphContent ? /* @__PURE__ */ jsxs7("div", { className: "relative size-full flex-1", children: [
|
|
1773
|
+
graphState === "loading" && /* @__PURE__ */ jsx10(Icon5, { name: "circle-notch", className: "absolute top-4 left-4 z-10 animate-spin" }),
|
|
1774
|
+
/* @__PURE__ */ jsx10(
|
|
1718
1775
|
GraphView,
|
|
1719
1776
|
{
|
|
1720
1777
|
viewportFocusNodeId,
|
|
@@ -1724,7 +1781,7 @@ function Graph({
|
|
|
1724
1781
|
children
|
|
1725
1782
|
}
|
|
1726
1783
|
)
|
|
1727
|
-
] }) : /* @__PURE__ */
|
|
1784
|
+
] }) : /* @__PURE__ */ jsx10(
|
|
1728
1785
|
DataTableEmptyView,
|
|
1729
1786
|
{
|
|
1730
1787
|
emptyView: resolvedEmptyView,
|
|
@@ -1737,11 +1794,11 @@ function Graph({
|
|
|
1737
1794
|
}
|
|
1738
1795
|
|
|
1739
1796
|
// src/graph/hooks/useGetViewportNodeIds.ts
|
|
1740
|
-
import { useEffect as useEffect3, useMemo as useMemo7, useRef as
|
|
1797
|
+
import { useEffect as useEffect3, useMemo as useMemo7, useRef as useRef4, useState as useState5 } from "react";
|
|
1741
1798
|
import { useStore as useStore2, useViewport } from "reactflow";
|
|
1742
1799
|
var useGetDebouncedViewport = (debounceDelay = 1e3) => {
|
|
1743
|
-
const timerRef =
|
|
1744
|
-
const [debouncedValues, setDebouncedValues] =
|
|
1800
|
+
const timerRef = useRef4(null);
|
|
1801
|
+
const [debouncedValues, setDebouncedValues] = useState5({ x: 0, y: 0, zoom: 1, width: 0, height: 0, nodes: [] });
|
|
1745
1802
|
const { x, y, zoom } = useViewport();
|
|
1746
1803
|
const { width, height, nodes } = useStore2((state) => ({
|
|
1747
1804
|
width: state.width,
|