@uniformdev/design-system 19.134.3-alpha.10 → 19.134.3-alpha.28
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/esm/index.js +306 -283
- package/dist/index.d.mts +113 -7
- package/dist/index.d.ts +113 -7
- package/dist/index.js +328 -294
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1371,6 +1371,8 @@ __export(src_exports, {
|
|
|
1371
1371
|
CurrentDrawerContext: () => CurrentDrawerContext,
|
|
1372
1372
|
DATE_OPERATORS: () => DATE_OPERATORS,
|
|
1373
1373
|
DashedBox: () => DashedBox,
|
|
1374
|
+
DateEditor: () => DateEditor,
|
|
1375
|
+
DateRangeEditor: () => DateRangeEditor,
|
|
1374
1376
|
DateTimePicker: () => DateTimePicker,
|
|
1375
1377
|
DateTimePickerVariant: () => DateTimePickerVariant,
|
|
1376
1378
|
DebouncedInputKeywordSearch: () => DebouncedInputKeywordSearch,
|
|
@@ -1386,9 +1388,12 @@ __export(src_exports, {
|
|
|
1386
1388
|
Fieldset: () => Fieldset,
|
|
1387
1389
|
FilterButton: () => FilterButton2,
|
|
1388
1390
|
FilterControls: () => FilterControls,
|
|
1391
|
+
FilterEditorRenderer: () => FilterEditorRenderer,
|
|
1389
1392
|
FilterItem: () => FilterItem,
|
|
1390
1393
|
FilterItems: () => FilterItems,
|
|
1391
1394
|
FilterMenu: () => FilterMenu,
|
|
1395
|
+
FilterMultiChoiceEditor: () => FilterMultiChoiceEditor,
|
|
1396
|
+
FilterSingleChoiceEditor: () => FilterSingleChoiceEditor,
|
|
1392
1397
|
Heading: () => Heading,
|
|
1393
1398
|
HexModalBackground: () => HexModalBackground,
|
|
1394
1399
|
HorizontalRhythm: () => HorizontalRhythm,
|
|
@@ -1435,6 +1440,8 @@ __export(src_exports, {
|
|
|
1435
1440
|
ModalDialog: () => ModalDialog,
|
|
1436
1441
|
MultilineChip: () => MultilineChip,
|
|
1437
1442
|
NUMBER_OPERATORS: () => NUMBER_OPERATORS,
|
|
1443
|
+
NumberEditor: () => NumberEditor,
|
|
1444
|
+
NumberRangeEditor: () => NumberRangeEditor,
|
|
1438
1445
|
PageHeaderSection: () => PageHeaderSection,
|
|
1439
1446
|
Pagination: () => Pagination,
|
|
1440
1447
|
Paragraph: () => Paragraph,
|
|
@@ -1487,6 +1494,8 @@ __export(src_exports, {
|
|
|
1487
1494
|
ShortcutRevealer: () => ShortcutRevealer,
|
|
1488
1495
|
Skeleton: () => Skeleton,
|
|
1489
1496
|
StatusBullet: () => StatusBullet,
|
|
1497
|
+
StatusMultiEditor: () => StatusMultiEditor,
|
|
1498
|
+
StatusSingleEditor: () => StatusSingleEditor,
|
|
1490
1499
|
SuccessMessage: () => SuccessMessage,
|
|
1491
1500
|
Switch: () => Switch,
|
|
1492
1501
|
TAKEOVER_STACK_ID: () => TAKEOVER_STACK_ID,
|
|
@@ -1503,6 +1512,7 @@ __export(src_exports, {
|
|
|
1503
1512
|
TableRow: () => TableRow,
|
|
1504
1513
|
Tabs: () => Tabs,
|
|
1505
1514
|
TakeoverDrawerRenderer: () => TakeoverDrawerRenderer,
|
|
1515
|
+
TextEditor: () => TextEditor,
|
|
1506
1516
|
Textarea: () => Textarea,
|
|
1507
1517
|
Theme: () => Theme,
|
|
1508
1518
|
Tile: () => Tile2,
|
|
@@ -1547,6 +1557,7 @@ __export(src_exports, {
|
|
|
1547
1557
|
fadeInRtl: () => fadeInRtl,
|
|
1548
1558
|
fadeInTop: () => fadeInTop,
|
|
1549
1559
|
fadeOutBottom: () => fadeOutBottom,
|
|
1560
|
+
filterMapper: () => filterMapper,
|
|
1550
1561
|
fullWidthScreenIcon: () => fullWidthScreenIcon,
|
|
1551
1562
|
getDrawerAttributes: () => getDrawerAttributes,
|
|
1552
1563
|
getParentPath: () => getParentPath,
|
|
@@ -18882,6 +18893,7 @@ var MediaCard = ({
|
|
|
18882
18893
|
menuItems,
|
|
18883
18894
|
sideSection: sideSection2,
|
|
18884
18895
|
onClick,
|
|
18896
|
+
buttonType,
|
|
18885
18897
|
...cardProps
|
|
18886
18898
|
}) => {
|
|
18887
18899
|
const onStopPropogation = (0, import_react105.useCallback)((e) => {
|
|
@@ -18889,7 +18901,7 @@ var MediaCard = ({
|
|
|
18889
18901
|
}, []);
|
|
18890
18902
|
const hasMenuItems = Array.isArray(menuItems) ? menuItems.length > 0 : Boolean(menuItems);
|
|
18891
18903
|
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(Card, { css: cardBase, ...cardProps, onClick, "data-testid": "card-item", children: [
|
|
18892
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("button", { tabIndex: -1, css: coverWrapper, children: cover }),
|
|
18904
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("button", { tabIndex: -1, css: coverWrapper, type: buttonType, children: cover }),
|
|
18893
18905
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { css: contentWrapper, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(HorizontalRhythm, { gap: "sm", justify: "space-between", align: "center", css: { width: "100%" }, children: [
|
|
18894
18906
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(VerticalRhythm, { gap: "0", align: "flex-start", css: { flex: 1, minWidth: 0 }, children: [
|
|
18895
18907
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(HorizontalRhythm, { gap: "xs", align: "center", css: { maxWidth: "100%" }, children: [
|
|
@@ -22551,243 +22563,25 @@ var FilterButton2 = ({
|
|
|
22551
22563
|
|
|
22552
22564
|
// src/components/SearchAndFilter/FilterControls.tsx
|
|
22553
22565
|
init_emotion_jsx_shim();
|
|
22554
|
-
var
|
|
22555
|
-
var
|
|
22566
|
+
var import_react143 = require("react");
|
|
22567
|
+
var import_react_use4 = require("react-use");
|
|
22556
22568
|
|
|
22557
22569
|
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
22558
22570
|
init_emotion_jsx_shim();
|
|
22559
|
-
var
|
|
22560
|
-
var import_jsx_runtime119 = require("@emotion/react/jsx-runtime");
|
|
22561
|
-
var SearchAndFilterContext = (0, import_react140.createContext)({
|
|
22562
|
-
searchTerm: "",
|
|
22563
|
-
setSearchTerm: () => {
|
|
22564
|
-
},
|
|
22565
|
-
filterVisibility: void 0,
|
|
22566
|
-
setFilterVisibility: () => {
|
|
22567
|
-
},
|
|
22568
|
-
filters: [],
|
|
22569
|
-
setFilters: () => {
|
|
22570
|
-
},
|
|
22571
|
-
handleAddFilter: () => {
|
|
22572
|
-
},
|
|
22573
|
-
handleResetFilters: () => {
|
|
22574
|
-
},
|
|
22575
|
-
handleDeleteFilter: () => {
|
|
22576
|
-
},
|
|
22577
|
-
setSortBy: () => {
|
|
22578
|
-
},
|
|
22579
|
-
sortByValue: "",
|
|
22580
|
-
filterOptions: [],
|
|
22581
|
-
sortOptions: [],
|
|
22582
|
-
validFilterQuery: [],
|
|
22583
|
-
totalResults: 0
|
|
22584
|
-
});
|
|
22585
|
-
var SearchAndFilterProvider = ({
|
|
22586
|
-
filters,
|
|
22587
|
-
filterOptions,
|
|
22588
|
-
sortOptions,
|
|
22589
|
-
defaultSortByValue,
|
|
22590
|
-
filterMode: filterMode3 = void 0,
|
|
22591
|
-
onSearchChange,
|
|
22592
|
-
onChange,
|
|
22593
|
-
onSortChange,
|
|
22594
|
-
resetFilterValues = [],
|
|
22595
|
-
totalResults,
|
|
22596
|
-
children
|
|
22597
|
-
}) => {
|
|
22598
|
-
const [searchTerm, setSearchTerm] = (0, import_react140.useState)("");
|
|
22599
|
-
const deferredSearchTerm = (0, import_react140.useDeferredValue)(searchTerm);
|
|
22600
|
-
const [filterVisibility, setFilterVisibility] = (0, import_react140.useState)(filterMode3);
|
|
22601
|
-
const [sortByValue, setSortByValue] = (0, import_react140.useState)(defaultSortByValue);
|
|
22602
|
-
const handleSearchTerm = (0, import_react140.useCallback)(
|
|
22603
|
-
(term) => {
|
|
22604
|
-
setSearchTerm(term);
|
|
22605
|
-
onSearchChange == null ? void 0 : onSearchChange(term);
|
|
22606
|
-
},
|
|
22607
|
-
[setSearchTerm, onSearchChange]
|
|
22608
|
-
);
|
|
22609
|
-
const handleOnSortChange = (0, import_react140.useCallback)(
|
|
22610
|
-
(sort) => {
|
|
22611
|
-
setSortByValue(sort);
|
|
22612
|
-
onSortChange(sort);
|
|
22613
|
-
},
|
|
22614
|
-
[onSortChange]
|
|
22615
|
-
);
|
|
22616
|
-
const handleToggleFilterVisibilty = (0, import_react140.useCallback)(
|
|
22617
|
-
(mode) => setFilterVisibility(mode),
|
|
22618
|
-
[setFilterVisibility]
|
|
22619
|
-
);
|
|
22620
|
-
const handleAddFilter = (0, import_react140.useCallback)(() => {
|
|
22621
|
-
onChange([...filters, { field: "", operator: "", value: "" }]);
|
|
22622
|
-
}, [filters, onChange]);
|
|
22623
|
-
const handleResetFilters = (0, import_react140.useCallback)(() => {
|
|
22624
|
-
onChange(resetFilterValues);
|
|
22625
|
-
}, [onChange, resetFilterValues]);
|
|
22626
|
-
const handleDeleteFilter = (0, import_react140.useCallback)(
|
|
22627
|
-
(index) => {
|
|
22628
|
-
const remainingFilters = filters.filter((_, i) => i !== index);
|
|
22629
|
-
onChange(remainingFilters);
|
|
22630
|
-
},
|
|
22631
|
-
[filters, onChange]
|
|
22632
|
-
);
|
|
22633
|
-
const validFilterQuery = (0, import_react140.useMemo)(() => {
|
|
22634
|
-
const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
|
|
22635
|
-
if (hasValidFilters) {
|
|
22636
|
-
return filters;
|
|
22637
|
-
}
|
|
22638
|
-
}, [filters]);
|
|
22639
|
-
(0, import_react140.useEffect)(() => {
|
|
22640
|
-
if (filterVisibility) {
|
|
22641
|
-
const handleEscKeyFilterClose = (e) => {
|
|
22642
|
-
if (e.key === "Escape") {
|
|
22643
|
-
setFilterVisibility(void 0);
|
|
22644
|
-
}
|
|
22645
|
-
};
|
|
22646
|
-
document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
22647
|
-
return () => {
|
|
22648
|
-
document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
22649
|
-
};
|
|
22650
|
-
}
|
|
22651
|
-
}, [filterVisibility]);
|
|
22652
|
-
return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
22653
|
-
SearchAndFilterContext.Provider,
|
|
22654
|
-
{
|
|
22655
|
-
value: {
|
|
22656
|
-
searchTerm: deferredSearchTerm,
|
|
22657
|
-
setSearchTerm: (e) => handleSearchTerm(e),
|
|
22658
|
-
setSortBy: (e) => handleOnSortChange(e),
|
|
22659
|
-
sortByValue,
|
|
22660
|
-
filterVisibility,
|
|
22661
|
-
setFilterVisibility: (e) => handleToggleFilterVisibilty(e),
|
|
22662
|
-
filters,
|
|
22663
|
-
setFilters: (e) => onChange(e),
|
|
22664
|
-
handleAddFilter,
|
|
22665
|
-
handleResetFilters,
|
|
22666
|
-
handleDeleteFilter,
|
|
22667
|
-
filterOptions,
|
|
22668
|
-
sortOptions,
|
|
22669
|
-
validFilterQuery,
|
|
22670
|
-
totalResults
|
|
22671
|
-
},
|
|
22672
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(VerticalRhythm, { children })
|
|
22673
|
-
}
|
|
22674
|
-
);
|
|
22675
|
-
};
|
|
22676
|
-
var useSearchAndFilter = () => {
|
|
22677
|
-
const value = (0, import_react140.useContext)(SearchAndFilterContext);
|
|
22678
|
-
return { ...value };
|
|
22679
|
-
};
|
|
22680
|
-
|
|
22681
|
-
// src/components/SearchAndFilter/FilterControls.tsx
|
|
22682
|
-
var import_jsx_runtime120 = require("@emotion/react/jsx-runtime");
|
|
22683
|
-
var FilterControls = ({
|
|
22684
|
-
children,
|
|
22685
|
-
defaultSortByValue,
|
|
22686
|
-
hideSearchInput
|
|
22687
|
-
}) => {
|
|
22688
|
-
var _a, _b, _c;
|
|
22689
|
-
const {
|
|
22690
|
-
setFilterVisibility,
|
|
22691
|
-
filterVisibility,
|
|
22692
|
-
setSearchTerm,
|
|
22693
|
-
validFilterQuery,
|
|
22694
|
-
searchTerm,
|
|
22695
|
-
sortByValue,
|
|
22696
|
-
filterOptions
|
|
22697
|
-
} = useSearchAndFilter();
|
|
22698
|
-
const [initialSortValue, setInitialSortValue] = (0, import_react141.useState)(sortByValue);
|
|
22699
|
-
const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react141.useState)("");
|
|
22700
|
-
const [userHasChangedSortByValue, setUserHasChangedSortByValue] = (0, import_react141.useState)(false);
|
|
22701
|
-
(0, import_react_use3.useDebounce)(
|
|
22702
|
-
() => {
|
|
22703
|
-
setSearchTerm(localeSearchTerm);
|
|
22704
|
-
},
|
|
22705
|
-
300,
|
|
22706
|
-
[localeSearchTerm, searchTerm]
|
|
22707
|
-
);
|
|
22708
|
-
(0, import_react141.useEffect)(() => {
|
|
22709
|
-
if (searchTerm === "") {
|
|
22710
|
-
setLocaleSearchTerm("");
|
|
22711
|
-
}
|
|
22712
|
-
}, [searchTerm]);
|
|
22713
|
-
const handleFilterToggle = (mode) => {
|
|
22714
|
-
if (filterVisibility === "filters" && mode === "filters" || filterVisibility === "sort" && mode === "sort") {
|
|
22715
|
-
return setFilterVisibility(void 0);
|
|
22716
|
-
}
|
|
22717
|
-
return setFilterVisibility(mode);
|
|
22718
|
-
};
|
|
22719
|
-
const sortValue = (sortByValue != null ? sortByValue : defaultSortByValue).split("_");
|
|
22720
|
-
const sortDirection = sortValue == null ? void 0 : sortValue.pop();
|
|
22721
|
-
const sortField = sortValue == null ? void 0 : sortValue.join("_");
|
|
22722
|
-
const sortOn = sortField.startsWith("fields.") ? "contentTypeFields" : "metadata";
|
|
22723
|
-
const sortByValueLabel = (_c = (_b = (_a = filterOptions == null ? void 0 : filterOptions.find((op) => op.value === sortOn)) == null ? void 0 : _a.options) == null ? void 0 : _b.find((f) => f.value === sortField)) == null ? void 0 : _c.label;
|
|
22724
|
-
const sortByIcon = userHasChangedSortByValue ? sortDirection === "ASC" ? "arrow-up" : "arrow-down" : "sort-az";
|
|
22725
|
-
(0, import_react_use3.useEffectOnce)(() => {
|
|
22726
|
-
setInitialSortValue(sortByValue);
|
|
22727
|
-
});
|
|
22728
|
-
(0, import_react141.useEffect)(() => {
|
|
22729
|
-
if (initialSortValue !== sortByValue) {
|
|
22730
|
-
setUserHasChangedSortByValue(true);
|
|
22731
|
-
}
|
|
22732
|
-
}, [initialSortValue, sortByValue]);
|
|
22733
|
-
return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(import_jsx_runtime120.Fragment, { children: [
|
|
22734
|
-
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
22735
|
-
FilterButton2,
|
|
22736
|
-
{
|
|
22737
|
-
"aria-controls": "search-and-filter-options",
|
|
22738
|
-
"aria-label": "filter options",
|
|
22739
|
-
"aria-haspopup": "true",
|
|
22740
|
-
"aria-expanded": filterVisibility === "filters",
|
|
22741
|
-
filterCount: validFilterQuery == null ? void 0 : validFilterQuery.length,
|
|
22742
|
-
onClick: () => handleFilterToggle("filters"),
|
|
22743
|
-
dataTestId: "filters-button"
|
|
22744
|
-
}
|
|
22745
|
-
),
|
|
22746
|
-
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
22747
|
-
FilterButton2,
|
|
22748
|
-
{
|
|
22749
|
-
"aria-controls": "search-and-filter-sortBy",
|
|
22750
|
-
"aria-label": "sort by options",
|
|
22751
|
-
"aria-haspopup": "true",
|
|
22752
|
-
text: !userHasChangedSortByValue ? "Sort" : sortByValueLabel,
|
|
22753
|
-
icon: sortByIcon,
|
|
22754
|
-
"aria-expanded": filterVisibility === "sort",
|
|
22755
|
-
hasSelectedValue: sortByValue !== "",
|
|
22756
|
-
onClick: () => handleFilterToggle("sort"),
|
|
22757
|
-
dataTestId: "sort-by-button"
|
|
22758
|
-
}
|
|
22759
|
-
),
|
|
22760
|
-
hideSearchInput ? null : /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
22761
|
-
InputKeywordSearch,
|
|
22762
|
-
{
|
|
22763
|
-
placeholder: "Search...",
|
|
22764
|
-
onSearchTextChanged: (e) => setLocaleSearchTerm(e),
|
|
22765
|
-
value: localeSearchTerm,
|
|
22766
|
-
compact: true,
|
|
22767
|
-
rounded: true,
|
|
22768
|
-
css: SearchInput
|
|
22769
|
-
}
|
|
22770
|
-
),
|
|
22771
|
-
children
|
|
22772
|
-
] });
|
|
22773
|
-
};
|
|
22774
|
-
|
|
22775
|
-
// src/components/SearchAndFilter/FilterItem.tsx
|
|
22776
|
-
init_emotion_jsx_shim();
|
|
22777
|
-
var import_react145 = require("react");
|
|
22571
|
+
var import_react142 = require("react");
|
|
22778
22572
|
|
|
22779
22573
|
// src/components/SearchAndFilter/FilterEditor.tsx
|
|
22780
22574
|
init_emotion_jsx_shim();
|
|
22781
|
-
var
|
|
22782
|
-
var
|
|
22575
|
+
var import_react141 = require("react");
|
|
22576
|
+
var import_react_use3 = require("react-use");
|
|
22783
22577
|
|
|
22784
22578
|
// src/components/Validation/StatusBullet.tsx
|
|
22785
22579
|
init_emotion_jsx_shim();
|
|
22786
22580
|
|
|
22787
22581
|
// src/components/Validation/StatusBullet.styles.ts
|
|
22788
22582
|
init_emotion_jsx_shim();
|
|
22789
|
-
var
|
|
22790
|
-
var StatusBulletContainer =
|
|
22583
|
+
var import_react140 = require("@emotion/react");
|
|
22584
|
+
var StatusBulletContainer = import_react140.css`
|
|
22791
22585
|
align-items: center;
|
|
22792
22586
|
align-self: center;
|
|
22793
22587
|
color: var(--gray-500);
|
|
@@ -22804,33 +22598,33 @@ var StatusBulletContainer = import_react142.css`
|
|
|
22804
22598
|
display: block;
|
|
22805
22599
|
}
|
|
22806
22600
|
`;
|
|
22807
|
-
var StatusBulletBase =
|
|
22601
|
+
var StatusBulletBase = import_react140.css`
|
|
22808
22602
|
font-size: var(--fs-sm);
|
|
22809
22603
|
&:before {
|
|
22810
22604
|
width: var(--fs-xs);
|
|
22811
22605
|
height: var(--fs-xs);
|
|
22812
22606
|
}
|
|
22813
22607
|
`;
|
|
22814
|
-
var StatusBulletSmall =
|
|
22608
|
+
var StatusBulletSmall = import_react140.css`
|
|
22815
22609
|
font-size: var(--fs-xs);
|
|
22816
22610
|
&:before {
|
|
22817
22611
|
width: var(--fs-xxs);
|
|
22818
22612
|
height: var(--fs-xxs);
|
|
22819
22613
|
}
|
|
22820
22614
|
`;
|
|
22821
|
-
var StatusDraft =
|
|
22615
|
+
var StatusDraft = import_react140.css`
|
|
22822
22616
|
&:before {
|
|
22823
22617
|
background: var(--white);
|
|
22824
22618
|
box-shadow: inset 0 0 0 0.125rem var(--primary-action-default);
|
|
22825
22619
|
}
|
|
22826
22620
|
`;
|
|
22827
|
-
var StatusModified =
|
|
22621
|
+
var StatusModified = import_react140.css`
|
|
22828
22622
|
&:before {
|
|
22829
22623
|
background: linear-gradient(to right, var(--white) 50%, var(--primary-action-default) 50% 100%);
|
|
22830
22624
|
box-shadow: inset 0 0 0 0.125rem var(--primary-action-default);
|
|
22831
22625
|
}
|
|
22832
22626
|
`;
|
|
22833
|
-
var StatusError =
|
|
22627
|
+
var StatusError = import_react140.css`
|
|
22834
22628
|
color: var(--error);
|
|
22835
22629
|
&:before {
|
|
22836
22630
|
/* TODO: replace this with an svg icon */
|
|
@@ -22843,29 +22637,29 @@ var StatusError = import_react142.css`
|
|
|
22843
22637
|
);
|
|
22844
22638
|
}
|
|
22845
22639
|
`;
|
|
22846
|
-
var StatusPublished =
|
|
22640
|
+
var StatusPublished = import_react140.css`
|
|
22847
22641
|
&:before {
|
|
22848
22642
|
background: var(--primary-action-default);
|
|
22849
22643
|
}
|
|
22850
22644
|
`;
|
|
22851
|
-
var StatusOrphan =
|
|
22645
|
+
var StatusOrphan = import_react140.css`
|
|
22852
22646
|
&:before {
|
|
22853
22647
|
background: var(--brand-secondary-5);
|
|
22854
22648
|
}
|
|
22855
22649
|
`;
|
|
22856
|
-
var StatusUnknown =
|
|
22650
|
+
var StatusUnknown = import_react140.css`
|
|
22857
22651
|
&:before {
|
|
22858
22652
|
background: var(--gray-800);
|
|
22859
22653
|
}
|
|
22860
22654
|
`;
|
|
22861
|
-
var StatusDeleted =
|
|
22655
|
+
var StatusDeleted = import_react140.css`
|
|
22862
22656
|
&:before {
|
|
22863
22657
|
background: var(--error);
|
|
22864
22658
|
}
|
|
22865
22659
|
`;
|
|
22866
22660
|
|
|
22867
22661
|
// src/components/Validation/StatusBullet.tsx
|
|
22868
|
-
var
|
|
22662
|
+
var import_jsx_runtime119 = require("@emotion/react/jsx-runtime");
|
|
22869
22663
|
var StatusBullet = ({
|
|
22870
22664
|
status,
|
|
22871
22665
|
hideText = false,
|
|
@@ -22885,7 +22679,7 @@ var StatusBullet = ({
|
|
|
22885
22679
|
Deleted: StatusDeleted
|
|
22886
22680
|
};
|
|
22887
22681
|
const statusSize = size === "base" ? StatusBulletBase : StatusBulletSmall;
|
|
22888
|
-
return /* @__PURE__ */ (0,
|
|
22682
|
+
return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
22889
22683
|
"span",
|
|
22890
22684
|
{
|
|
22891
22685
|
role: "status",
|
|
@@ -22898,7 +22692,7 @@ var StatusBullet = ({
|
|
|
22898
22692
|
};
|
|
22899
22693
|
|
|
22900
22694
|
// src/components/SearchAndFilter/FilterEditor.tsx
|
|
22901
|
-
var
|
|
22695
|
+
var import_jsx_runtime120 = require("@emotion/react/jsx-runtime");
|
|
22902
22696
|
var readOnlyAttributes = {
|
|
22903
22697
|
isSearchable: false,
|
|
22904
22698
|
menuIsOpen: false,
|
|
@@ -22907,13 +22701,13 @@ var readOnlyAttributes = {
|
|
|
22907
22701
|
var FilterMultiChoiceEditor = ({
|
|
22908
22702
|
value,
|
|
22909
22703
|
options,
|
|
22910
|
-
|
|
22704
|
+
disabled: disabled2,
|
|
22911
22705
|
readOnly,
|
|
22912
22706
|
valueTestId,
|
|
22913
22707
|
...props
|
|
22914
22708
|
}) => {
|
|
22915
22709
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
22916
|
-
return /* @__PURE__ */ (0,
|
|
22710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
22917
22711
|
InputComboBox,
|
|
22918
22712
|
{
|
|
22919
22713
|
...props,
|
|
@@ -22921,12 +22715,12 @@ var FilterMultiChoiceEditor = ({
|
|
|
22921
22715
|
options,
|
|
22922
22716
|
isMulti: true,
|
|
22923
22717
|
isClearable: true,
|
|
22924
|
-
isDisabled,
|
|
22718
|
+
isDisabled: disabled2,
|
|
22925
22719
|
onChange: (e) => {
|
|
22926
22720
|
var _a;
|
|
22927
|
-
return props.onChange((_a = e.map((
|
|
22721
|
+
return props.onChange((_a = e == null ? void 0 : e.map((option) => option.value)) != null ? _a : []);
|
|
22928
22722
|
},
|
|
22929
|
-
value,
|
|
22723
|
+
value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
|
|
22930
22724
|
"aria-readonly": readOnly,
|
|
22931
22725
|
styles: {
|
|
22932
22726
|
menu(base) {
|
|
@@ -22943,13 +22737,13 @@ var FilterMultiChoiceEditor = ({
|
|
|
22943
22737
|
var FilterSingleChoiceEditor = ({
|
|
22944
22738
|
options,
|
|
22945
22739
|
value,
|
|
22946
|
-
|
|
22740
|
+
disabled: disabled2,
|
|
22947
22741
|
readOnly,
|
|
22948
22742
|
onChange,
|
|
22949
22743
|
valueTestId
|
|
22950
22744
|
}) => {
|
|
22951
22745
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
22952
|
-
return /* @__PURE__ */ (0,
|
|
22746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
22953
22747
|
InputComboBox,
|
|
22954
22748
|
{
|
|
22955
22749
|
placeholder: "Type to search...",
|
|
@@ -22959,8 +22753,8 @@ var FilterSingleChoiceEditor = ({
|
|
|
22959
22753
|
var _a;
|
|
22960
22754
|
return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
|
|
22961
22755
|
},
|
|
22962
|
-
isDisabled,
|
|
22963
|
-
value,
|
|
22756
|
+
isDisabled: disabled2,
|
|
22757
|
+
value: options == null ? void 0 : options.find((option) => option.value === value),
|
|
22964
22758
|
"aria-readonly": readOnly,
|
|
22965
22759
|
styles: {
|
|
22966
22760
|
menu(base) {
|
|
@@ -22975,18 +22769,18 @@ var FilterSingleChoiceEditor = ({
|
|
|
22975
22769
|
) });
|
|
22976
22770
|
};
|
|
22977
22771
|
var CustomOptions = ({ label, value }) => {
|
|
22978
|
-
return /* @__PURE__ */ (0,
|
|
22772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(StatusBullet, { status: label, message: value });
|
|
22979
22773
|
};
|
|
22980
22774
|
var StatusMultiEditor = ({
|
|
22981
22775
|
options,
|
|
22982
22776
|
value,
|
|
22983
|
-
|
|
22777
|
+
disabled: disabled2,
|
|
22984
22778
|
readOnly,
|
|
22985
22779
|
onChange,
|
|
22986
22780
|
valueTestId
|
|
22987
22781
|
}) => {
|
|
22988
22782
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
22989
|
-
return /* @__PURE__ */ (0,
|
|
22783
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
22990
22784
|
InputComboBox,
|
|
22991
22785
|
{
|
|
22992
22786
|
options,
|
|
@@ -22996,8 +22790,8 @@ var StatusMultiEditor = ({
|
|
|
22996
22790
|
return onChange((_a = e.map((item) => item.value)) != null ? _a : []);
|
|
22997
22791
|
},
|
|
22998
22792
|
formatOptionLabel: CustomOptions,
|
|
22999
|
-
value,
|
|
23000
|
-
isDisabled,
|
|
22793
|
+
value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
|
|
22794
|
+
isDisabled: disabled2,
|
|
23001
22795
|
styles: {
|
|
23002
22796
|
menu(base) {
|
|
23003
22797
|
return {
|
|
@@ -23013,13 +22807,13 @@ var StatusMultiEditor = ({
|
|
|
23013
22807
|
var StatusSingleEditor = ({
|
|
23014
22808
|
options,
|
|
23015
22809
|
value,
|
|
23016
|
-
|
|
22810
|
+
disabled: disabled2,
|
|
23017
22811
|
readOnly,
|
|
23018
22812
|
onChange,
|
|
23019
22813
|
valueTestId
|
|
23020
22814
|
}) => {
|
|
23021
22815
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
23022
|
-
return /* @__PURE__ */ (0,
|
|
22816
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23023
22817
|
InputComboBox,
|
|
23024
22818
|
{
|
|
23025
22819
|
options,
|
|
@@ -23028,8 +22822,8 @@ var StatusSingleEditor = ({
|
|
|
23028
22822
|
return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
|
|
23029
22823
|
},
|
|
23030
22824
|
formatOptionLabel: CustomOptions,
|
|
23031
|
-
value,
|
|
23032
|
-
isDisabled,
|
|
22825
|
+
value: options == null ? void 0 : options.find((option) => option.value === value),
|
|
22826
|
+
isDisabled: disabled2,
|
|
23033
22827
|
styles: {
|
|
23034
22828
|
menu(base) {
|
|
23035
22829
|
return {
|
|
@@ -23042,9 +22836,15 @@ var StatusSingleEditor = ({
|
|
|
23042
22836
|
}
|
|
23043
22837
|
) });
|
|
23044
22838
|
};
|
|
23045
|
-
var TextEditor = ({
|
|
23046
|
-
|
|
23047
|
-
|
|
22839
|
+
var TextEditor = ({
|
|
22840
|
+
onChange,
|
|
22841
|
+
ariaLabel,
|
|
22842
|
+
value,
|
|
22843
|
+
readOnly,
|
|
22844
|
+
valueTestId
|
|
22845
|
+
}) => {
|
|
22846
|
+
(0, import_react_use3.useDebounce)(() => onChange, 500, [value]);
|
|
22847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23048
22848
|
Input,
|
|
23049
22849
|
{
|
|
23050
22850
|
showLabel: false,
|
|
@@ -23065,10 +22865,10 @@ var NumberRangeEditor = ({
|
|
|
23065
22865
|
readOnly,
|
|
23066
22866
|
valueTestId
|
|
23067
22867
|
}) => {
|
|
23068
|
-
const [minValue, setMinValue] = (0,
|
|
23069
|
-
const [maxValue, setMaxValue] = (0,
|
|
23070
|
-
const [error, setError] = (0,
|
|
23071
|
-
(0,
|
|
22868
|
+
const [minValue, setMinValue] = (0, import_react141.useState)("");
|
|
22869
|
+
const [maxValue, setMaxValue] = (0, import_react141.useState)("");
|
|
22870
|
+
const [error, setError] = (0, import_react141.useState)("");
|
|
22871
|
+
(0, import_react141.useEffect)(() => {
|
|
23072
22872
|
if (!maxValue && !minValue) {
|
|
23073
22873
|
return;
|
|
23074
22874
|
}
|
|
@@ -23087,9 +22887,9 @@ var NumberRangeEditor = ({
|
|
|
23087
22887
|
setError("");
|
|
23088
22888
|
onChange([minValue, maxValue]);
|
|
23089
22889
|
}, [maxValue, minValue, setError]);
|
|
23090
|
-
return /* @__PURE__ */ (0,
|
|
23091
|
-
/* @__PURE__ */ (0,
|
|
23092
|
-
/* @__PURE__ */ (0,
|
|
22890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(import_jsx_runtime120.Fragment, { children: [
|
|
22891
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
22892
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23093
22893
|
Input,
|
|
23094
22894
|
{
|
|
23095
22895
|
label: `${ariaLabel}-min`,
|
|
@@ -23104,7 +22904,7 @@ var NumberRangeEditor = ({
|
|
|
23104
22904
|
readOnly
|
|
23105
22905
|
}
|
|
23106
22906
|
),
|
|
23107
|
-
/* @__PURE__ */ (0,
|
|
22907
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23108
22908
|
Input,
|
|
23109
22909
|
{
|
|
23110
22910
|
type: "number",
|
|
@@ -23120,7 +22920,7 @@ var NumberRangeEditor = ({
|
|
|
23120
22920
|
}
|
|
23121
22921
|
)
|
|
23122
22922
|
] }),
|
|
23123
|
-
/* @__PURE__ */ (0,
|
|
22923
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(ErrorContainer, { errorMessage: error })
|
|
23124
22924
|
] });
|
|
23125
22925
|
};
|
|
23126
22926
|
var NumberEditor = ({
|
|
@@ -23131,7 +22931,7 @@ var NumberEditor = ({
|
|
|
23131
22931
|
readOnly,
|
|
23132
22932
|
valueTestId
|
|
23133
22933
|
}) => {
|
|
23134
|
-
return /* @__PURE__ */ (0,
|
|
22934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23135
22935
|
Input,
|
|
23136
22936
|
{
|
|
23137
22937
|
label: ariaLabel,
|
|
@@ -23154,7 +22954,7 @@ var DateEditor = ({
|
|
|
23154
22954
|
readOnly,
|
|
23155
22955
|
valueTestId
|
|
23156
22956
|
}) => {
|
|
23157
|
-
return /* @__PURE__ */ (0,
|
|
22957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23158
22958
|
Input,
|
|
23159
22959
|
{
|
|
23160
22960
|
type: "date",
|
|
@@ -23176,10 +22976,10 @@ var DateRangeEditor = ({
|
|
|
23176
22976
|
readOnly,
|
|
23177
22977
|
valueTestId
|
|
23178
22978
|
}) => {
|
|
23179
|
-
const [minDateValue, setMinDateValue] = (0,
|
|
23180
|
-
const [maxDateValue, setMaxDateValue] = (0,
|
|
23181
|
-
const [error, setError] = (0,
|
|
23182
|
-
(0,
|
|
22979
|
+
const [minDateValue, setMinDateValue] = (0, import_react141.useState)(value ? value[0] : "");
|
|
22980
|
+
const [maxDateValue, setMaxDateValue] = (0, import_react141.useState)(value ? value[1] : "");
|
|
22981
|
+
const [error, setError] = (0, import_react141.useState)("");
|
|
22982
|
+
(0, import_react141.useEffect)(() => {
|
|
23183
22983
|
if (!minDateValue || !maxDateValue) {
|
|
23184
22984
|
return;
|
|
23185
22985
|
}
|
|
@@ -23210,9 +23010,9 @@ var DateRangeEditor = ({
|
|
|
23210
23010
|
setError("");
|
|
23211
23011
|
onChange([minDateValue, maxDateValue]);
|
|
23212
23012
|
}, [minDateValue, maxDateValue, setError]);
|
|
23213
|
-
return /* @__PURE__ */ (0,
|
|
23214
|
-
/* @__PURE__ */ (0,
|
|
23215
|
-
/* @__PURE__ */ (0,
|
|
23013
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(import_jsx_runtime120.Fragment, { children: [
|
|
23014
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
23015
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23216
23016
|
Input,
|
|
23217
23017
|
{
|
|
23218
23018
|
label: `${ariaLabel}-min-date`,
|
|
@@ -23225,7 +23025,7 @@ var DateRangeEditor = ({
|
|
|
23225
23025
|
readOnly
|
|
23226
23026
|
}
|
|
23227
23027
|
),
|
|
23228
|
-
/* @__PURE__ */ (0,
|
|
23028
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23229
23029
|
Input,
|
|
23230
23030
|
{
|
|
23231
23031
|
label: `${ariaLabel}-max-date`,
|
|
@@ -23239,18 +23039,19 @@ var DateRangeEditor = ({
|
|
|
23239
23039
|
}
|
|
23240
23040
|
)
|
|
23241
23041
|
] }),
|
|
23242
|
-
/* @__PURE__ */ (0,
|
|
23042
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(ErrorContainer, { errorMessage: error })
|
|
23243
23043
|
] });
|
|
23244
23044
|
};
|
|
23245
23045
|
var FilterEditorRenderer = ({ editorType, ...props }) => {
|
|
23246
|
-
const
|
|
23046
|
+
const { filterMapper: contextFilterMapper } = useSearchAndFilter();
|
|
23047
|
+
const Editor = contextFilterMapper == null ? void 0 : contextFilterMapper[editorType];
|
|
23247
23048
|
if (!Editor) {
|
|
23248
23049
|
return null;
|
|
23249
23050
|
}
|
|
23250
23051
|
if (editorType === "empty") {
|
|
23251
23052
|
return null;
|
|
23252
23053
|
}
|
|
23253
|
-
return /* @__PURE__ */ (0,
|
|
23054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Editor, { ...props });
|
|
23254
23055
|
};
|
|
23255
23056
|
var filterMapper = {
|
|
23256
23057
|
multiChoice: FilterMultiChoiceEditor,
|
|
@@ -23265,14 +23066,14 @@ var filterMapper = {
|
|
|
23265
23066
|
empty: null
|
|
23266
23067
|
};
|
|
23267
23068
|
var ErrorContainer = ({ errorMessage }) => {
|
|
23268
|
-
return /* @__PURE__ */ (0,
|
|
23069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23269
23070
|
"div",
|
|
23270
23071
|
{
|
|
23271
23072
|
css: {
|
|
23272
23073
|
gridColumn: "span 6",
|
|
23273
23074
|
order: 6
|
|
23274
23075
|
},
|
|
23275
|
-
children: /* @__PURE__ */ (0,
|
|
23076
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(FieldMessage, { errorMessage })
|
|
23276
23077
|
}
|
|
23277
23078
|
);
|
|
23278
23079
|
};
|
|
@@ -23282,6 +23083,229 @@ var twoColumnGrid = {
|
|
|
23282
23083
|
gap: "var(--spacing-sm);"
|
|
23283
23084
|
};
|
|
23284
23085
|
|
|
23086
|
+
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
23087
|
+
var import_jsx_runtime121 = require("@emotion/react/jsx-runtime");
|
|
23088
|
+
var SearchAndFilterContext = (0, import_react142.createContext)({
|
|
23089
|
+
searchTerm: "",
|
|
23090
|
+
setSearchTerm: () => {
|
|
23091
|
+
},
|
|
23092
|
+
filterVisibility: void 0,
|
|
23093
|
+
setFilterVisibility: () => {
|
|
23094
|
+
},
|
|
23095
|
+
filters: [],
|
|
23096
|
+
setFilters: () => {
|
|
23097
|
+
},
|
|
23098
|
+
handleAddFilter: () => {
|
|
23099
|
+
},
|
|
23100
|
+
handleResetFilters: () => {
|
|
23101
|
+
},
|
|
23102
|
+
handleDeleteFilter: () => {
|
|
23103
|
+
},
|
|
23104
|
+
setSortBy: () => {
|
|
23105
|
+
},
|
|
23106
|
+
sortByValue: "",
|
|
23107
|
+
filterOptions: [],
|
|
23108
|
+
sortOptions: [],
|
|
23109
|
+
validFilterQuery: [],
|
|
23110
|
+
filterMapper: {},
|
|
23111
|
+
totalResults: 0
|
|
23112
|
+
});
|
|
23113
|
+
var SearchAndFilterProvider = ({
|
|
23114
|
+
filters,
|
|
23115
|
+
filterOptions,
|
|
23116
|
+
sortOptions,
|
|
23117
|
+
defaultSortByValue,
|
|
23118
|
+
filterMode: filterMode3 = void 0,
|
|
23119
|
+
onSearchChange,
|
|
23120
|
+
onChange,
|
|
23121
|
+
onSortChange,
|
|
23122
|
+
resetFilterValues = [],
|
|
23123
|
+
totalResults,
|
|
23124
|
+
filterMapper: filterMapper2 = filterMapper,
|
|
23125
|
+
children
|
|
23126
|
+
}) => {
|
|
23127
|
+
const [searchTerm, setSearchTerm] = (0, import_react142.useState)("");
|
|
23128
|
+
const deferredSearchTerm = (0, import_react142.useDeferredValue)(searchTerm);
|
|
23129
|
+
const [filterVisibility, setFilterVisibility] = (0, import_react142.useState)(filterMode3);
|
|
23130
|
+
const [sortByValue, setSortByValue] = (0, import_react142.useState)(defaultSortByValue);
|
|
23131
|
+
const handleSearchTerm = (0, import_react142.useCallback)(
|
|
23132
|
+
(term) => {
|
|
23133
|
+
setSearchTerm(term);
|
|
23134
|
+
onSearchChange == null ? void 0 : onSearchChange(term);
|
|
23135
|
+
},
|
|
23136
|
+
[setSearchTerm, onSearchChange]
|
|
23137
|
+
);
|
|
23138
|
+
const handleOnSortChange = (0, import_react142.useCallback)(
|
|
23139
|
+
(sort) => {
|
|
23140
|
+
setSortByValue(sort);
|
|
23141
|
+
onSortChange(sort);
|
|
23142
|
+
},
|
|
23143
|
+
[onSortChange]
|
|
23144
|
+
);
|
|
23145
|
+
const handleToggleFilterVisibilty = (0, import_react142.useCallback)(
|
|
23146
|
+
(mode) => setFilterVisibility(mode),
|
|
23147
|
+
[setFilterVisibility]
|
|
23148
|
+
);
|
|
23149
|
+
const handleAddFilter = (0, import_react142.useCallback)(() => {
|
|
23150
|
+
onChange([...filters, { field: "", operator: "", value: "" }]);
|
|
23151
|
+
}, [filters, onChange]);
|
|
23152
|
+
const handleResetFilters = (0, import_react142.useCallback)(() => {
|
|
23153
|
+
onChange(resetFilterValues);
|
|
23154
|
+
}, [onChange, resetFilterValues]);
|
|
23155
|
+
const handleDeleteFilter = (0, import_react142.useCallback)(
|
|
23156
|
+
(index) => {
|
|
23157
|
+
const remainingFilters = filters.filter((_, i) => i !== index);
|
|
23158
|
+
onChange(remainingFilters);
|
|
23159
|
+
},
|
|
23160
|
+
[filters, onChange]
|
|
23161
|
+
);
|
|
23162
|
+
const validFilterQuery = (0, import_react142.useMemo)(() => {
|
|
23163
|
+
const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
|
|
23164
|
+
if (hasValidFilters) {
|
|
23165
|
+
return filters;
|
|
23166
|
+
}
|
|
23167
|
+
}, [filters]);
|
|
23168
|
+
(0, import_react142.useEffect)(() => {
|
|
23169
|
+
if (filterVisibility) {
|
|
23170
|
+
const handleEscKeyFilterClose = (e) => {
|
|
23171
|
+
if (e.key === "Escape") {
|
|
23172
|
+
setFilterVisibility(void 0);
|
|
23173
|
+
}
|
|
23174
|
+
};
|
|
23175
|
+
document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
23176
|
+
return () => {
|
|
23177
|
+
document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
23178
|
+
};
|
|
23179
|
+
}
|
|
23180
|
+
}, [filterVisibility]);
|
|
23181
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
23182
|
+
SearchAndFilterContext.Provider,
|
|
23183
|
+
{
|
|
23184
|
+
value: {
|
|
23185
|
+
searchTerm: deferredSearchTerm,
|
|
23186
|
+
setSearchTerm: (e) => handleSearchTerm(e),
|
|
23187
|
+
setSortBy: (e) => handleOnSortChange(e),
|
|
23188
|
+
sortByValue,
|
|
23189
|
+
filterVisibility,
|
|
23190
|
+
setFilterVisibility: (e) => handleToggleFilterVisibilty(e),
|
|
23191
|
+
filters,
|
|
23192
|
+
setFilters: (e) => onChange(e),
|
|
23193
|
+
handleAddFilter,
|
|
23194
|
+
handleResetFilters,
|
|
23195
|
+
handleDeleteFilter,
|
|
23196
|
+
filterOptions,
|
|
23197
|
+
sortOptions,
|
|
23198
|
+
validFilterQuery,
|
|
23199
|
+
totalResults,
|
|
23200
|
+
filterMapper: filterMapper2
|
|
23201
|
+
},
|
|
23202
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(VerticalRhythm, { children })
|
|
23203
|
+
}
|
|
23204
|
+
);
|
|
23205
|
+
};
|
|
23206
|
+
var useSearchAndFilter = () => {
|
|
23207
|
+
const value = (0, import_react142.useContext)(SearchAndFilterContext);
|
|
23208
|
+
return { ...value };
|
|
23209
|
+
};
|
|
23210
|
+
|
|
23211
|
+
// src/components/SearchAndFilter/FilterControls.tsx
|
|
23212
|
+
var import_jsx_runtime122 = require("@emotion/react/jsx-runtime");
|
|
23213
|
+
var FilterControls = ({
|
|
23214
|
+
children,
|
|
23215
|
+
defaultSortByValue,
|
|
23216
|
+
hideSearchInput
|
|
23217
|
+
}) => {
|
|
23218
|
+
var _a, _b, _c;
|
|
23219
|
+
const {
|
|
23220
|
+
setFilterVisibility,
|
|
23221
|
+
filterVisibility,
|
|
23222
|
+
setSearchTerm,
|
|
23223
|
+
validFilterQuery,
|
|
23224
|
+
searchTerm,
|
|
23225
|
+
sortByValue,
|
|
23226
|
+
filterOptions
|
|
23227
|
+
} = useSearchAndFilter();
|
|
23228
|
+
const [initialSortValue, setInitialSortValue] = (0, import_react143.useState)(sortByValue);
|
|
23229
|
+
const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react143.useState)("");
|
|
23230
|
+
const [userHasChangedSortByValue, setUserHasChangedSortByValue] = (0, import_react143.useState)(false);
|
|
23231
|
+
(0, import_react_use4.useDebounce)(
|
|
23232
|
+
() => {
|
|
23233
|
+
setSearchTerm(localeSearchTerm);
|
|
23234
|
+
},
|
|
23235
|
+
300,
|
|
23236
|
+
[localeSearchTerm, searchTerm]
|
|
23237
|
+
);
|
|
23238
|
+
(0, import_react143.useEffect)(() => {
|
|
23239
|
+
if (searchTerm === "") {
|
|
23240
|
+
setLocaleSearchTerm("");
|
|
23241
|
+
}
|
|
23242
|
+
}, [searchTerm]);
|
|
23243
|
+
const handleFilterToggle = (mode) => {
|
|
23244
|
+
if (filterVisibility === "filters" && mode === "filters" || filterVisibility === "sort" && mode === "sort") {
|
|
23245
|
+
return setFilterVisibility(void 0);
|
|
23246
|
+
}
|
|
23247
|
+
return setFilterVisibility(mode);
|
|
23248
|
+
};
|
|
23249
|
+
const sortValue = (sortByValue != null ? sortByValue : defaultSortByValue).split("_");
|
|
23250
|
+
const sortDirection = sortValue == null ? void 0 : sortValue.pop();
|
|
23251
|
+
const sortField = sortValue == null ? void 0 : sortValue.join("_");
|
|
23252
|
+
const sortOn = sortField.startsWith("fields.") ? "contentTypeFields" : "metadata";
|
|
23253
|
+
const sortByValueLabel = (_c = (_b = (_a = filterOptions == null ? void 0 : filterOptions.find((op) => op.value === sortOn)) == null ? void 0 : _a.options) == null ? void 0 : _b.find((f) => f.value === sortField)) == null ? void 0 : _c.label;
|
|
23254
|
+
const sortByIcon = userHasChangedSortByValue ? sortDirection === "ASC" ? "arrow-up" : "arrow-down" : "sort-az";
|
|
23255
|
+
(0, import_react_use4.useEffectOnce)(() => {
|
|
23256
|
+
setInitialSortValue(sortByValue);
|
|
23257
|
+
});
|
|
23258
|
+
(0, import_react143.useEffect)(() => {
|
|
23259
|
+
if (initialSortValue !== sortByValue) {
|
|
23260
|
+
setUserHasChangedSortByValue(true);
|
|
23261
|
+
}
|
|
23262
|
+
}, [initialSortValue, sortByValue]);
|
|
23263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(import_jsx_runtime122.Fragment, { children: [
|
|
23264
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
23265
|
+
FilterButton2,
|
|
23266
|
+
{
|
|
23267
|
+
"aria-controls": "search-and-filter-options",
|
|
23268
|
+
"aria-label": "filter options",
|
|
23269
|
+
"aria-haspopup": "true",
|
|
23270
|
+
"aria-expanded": filterVisibility === "filters",
|
|
23271
|
+
filterCount: validFilterQuery == null ? void 0 : validFilterQuery.length,
|
|
23272
|
+
onClick: () => handleFilterToggle("filters"),
|
|
23273
|
+
dataTestId: "filters-button"
|
|
23274
|
+
}
|
|
23275
|
+
),
|
|
23276
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
23277
|
+
FilterButton2,
|
|
23278
|
+
{
|
|
23279
|
+
"aria-controls": "search-and-filter-sortBy",
|
|
23280
|
+
"aria-label": "sort by options",
|
|
23281
|
+
"aria-haspopup": "true",
|
|
23282
|
+
text: !userHasChangedSortByValue ? "Sort" : sortByValueLabel,
|
|
23283
|
+
icon: sortByIcon,
|
|
23284
|
+
"aria-expanded": filterVisibility === "sort",
|
|
23285
|
+
hasSelectedValue: sortByValue !== "",
|
|
23286
|
+
onClick: () => handleFilterToggle("sort"),
|
|
23287
|
+
dataTestId: "sort-by-button"
|
|
23288
|
+
}
|
|
23289
|
+
),
|
|
23290
|
+
hideSearchInput ? null : /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
23291
|
+
InputKeywordSearch,
|
|
23292
|
+
{
|
|
23293
|
+
placeholder: "Search...",
|
|
23294
|
+
onSearchTextChanged: (e) => setLocaleSearchTerm(e),
|
|
23295
|
+
value: localeSearchTerm,
|
|
23296
|
+
compact: true,
|
|
23297
|
+
rounded: true,
|
|
23298
|
+
css: SearchInput
|
|
23299
|
+
}
|
|
23300
|
+
),
|
|
23301
|
+
children
|
|
23302
|
+
] });
|
|
23303
|
+
};
|
|
23304
|
+
|
|
23305
|
+
// src/components/SearchAndFilter/FilterItem.tsx
|
|
23306
|
+
init_emotion_jsx_shim();
|
|
23307
|
+
var import_react145 = require("react");
|
|
23308
|
+
|
|
23285
23309
|
// src/components/SearchAndFilter/FilterMenu.tsx
|
|
23286
23310
|
init_emotion_jsx_shim();
|
|
23287
23311
|
var import_react144 = __toESM(require("react"));
|
|
@@ -23353,7 +23377,7 @@ var FilterItem = ({
|
|
|
23353
23377
|
const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
|
|
23354
23378
|
const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
|
|
23355
23379
|
const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
|
|
23356
|
-
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly } = (0, import_react145.useMemo)(() => {
|
|
23380
|
+
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = (0, import_react145.useMemo)(() => {
|
|
23357
23381
|
var _a2;
|
|
23358
23382
|
const currentSelectedFilter = filterOptions.find((item) => {
|
|
23359
23383
|
var _a3;
|
|
@@ -23366,19 +23390,14 @@ var FilterItem = ({
|
|
|
23366
23390
|
const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
|
|
23367
23391
|
return filters[index].operator === item.value;
|
|
23368
23392
|
});
|
|
23369
|
-
const selectedMetaValue2 = valueOptions.filter((item) => {
|
|
23370
|
-
if (Array.isArray(filters[index].value) && item.value) {
|
|
23371
|
-
return filters[index].value.includes(item.value);
|
|
23372
|
-
}
|
|
23373
|
-
return filters[index].value === item.value;
|
|
23374
|
-
});
|
|
23375
23393
|
return {
|
|
23376
23394
|
selectedFieldValue: selectedFieldValue2,
|
|
23377
23395
|
selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
|
|
23378
|
-
selectedMetaValue:
|
|
23379
|
-
readOnly: isCurrentFieldReadOnly
|
|
23396
|
+
selectedMetaValue: filters[index].value,
|
|
23397
|
+
readOnly: isCurrentFieldReadOnly,
|
|
23398
|
+
bindable: selectedFieldValue2 == null ? void 0 : selectedFieldValue2.bindable
|
|
23380
23399
|
};
|
|
23381
|
-
}, [filters, filterOptions, index, operatorOptions
|
|
23400
|
+
}, [filters, filterOptions, index, operatorOptions]);
|
|
23382
23401
|
const readOnlyProps = readOnly ? {
|
|
23383
23402
|
"aria-readonly": true,
|
|
23384
23403
|
isSearchable: false,
|
|
@@ -23445,7 +23464,8 @@ var FilterItem = ({
|
|
|
23445
23464
|
options: valueOptions,
|
|
23446
23465
|
onChange: (e) => onValueChange(e != null ? e : ""),
|
|
23447
23466
|
readOnly,
|
|
23448
|
-
|
|
23467
|
+
bindable,
|
|
23468
|
+
disabled: !filters[index].operator,
|
|
23449
23469
|
value: selectedMetaValue,
|
|
23450
23470
|
valueTestId: "filter-value"
|
|
23451
23471
|
}
|
|
@@ -23730,6 +23750,7 @@ var SegmentedControl = ({
|
|
|
23730
23750
|
{
|
|
23731
23751
|
css: [segmentedControlStyles, orientation === "vertical" ? segmentedControlVerticalStyles : void 0],
|
|
23732
23752
|
...props,
|
|
23753
|
+
"data-testid": "segmented-control",
|
|
23733
23754
|
children: options.map((option, index) => {
|
|
23734
23755
|
var _a;
|
|
23735
23756
|
if (!option) {
|
|
@@ -23896,6 +23917,7 @@ var SearchAndFilter = ({
|
|
|
23896
23917
|
viewSwitchControls,
|
|
23897
23918
|
resultsContainerView = /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(SearchAndFilterResultContainer, {}),
|
|
23898
23919
|
children = /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(FilterModeView, {}),
|
|
23920
|
+
filterMapper: filterMapper2 = filterMapper,
|
|
23899
23921
|
onChange,
|
|
23900
23922
|
onSearchChange,
|
|
23901
23923
|
onSortChange,
|
|
@@ -23915,6 +23937,7 @@ var SearchAndFilter = ({
|
|
|
23915
23937
|
onSortChange,
|
|
23916
23938
|
totalResults,
|
|
23917
23939
|
resetFilterValues,
|
|
23940
|
+
filterMapper: filterMapper2,
|
|
23918
23941
|
children: /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(VerticalRhythm, { css: SearchAndFilterContainer, "data-testid": "search-and-filter", children: [
|
|
23919
23942
|
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
|
|
23920
23943
|
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
@@ -24558,6 +24581,8 @@ var ToastContainer = ({ limit = 4 }) => {
|
|
|
24558
24581
|
CurrentDrawerContext,
|
|
24559
24582
|
DATE_OPERATORS,
|
|
24560
24583
|
DashedBox,
|
|
24584
|
+
DateEditor,
|
|
24585
|
+
DateRangeEditor,
|
|
24561
24586
|
DateTimePicker,
|
|
24562
24587
|
DateTimePickerVariant,
|
|
24563
24588
|
DebouncedInputKeywordSearch,
|
|
@@ -24573,9 +24598,12 @@ var ToastContainer = ({ limit = 4 }) => {
|
|
|
24573
24598
|
Fieldset,
|
|
24574
24599
|
FilterButton,
|
|
24575
24600
|
FilterControls,
|
|
24601
|
+
FilterEditorRenderer,
|
|
24576
24602
|
FilterItem,
|
|
24577
24603
|
FilterItems,
|
|
24578
24604
|
FilterMenu,
|
|
24605
|
+
FilterMultiChoiceEditor,
|
|
24606
|
+
FilterSingleChoiceEditor,
|
|
24579
24607
|
Heading,
|
|
24580
24608
|
HexModalBackground,
|
|
24581
24609
|
HorizontalRhythm,
|
|
@@ -24622,6 +24650,8 @@ var ToastContainer = ({ limit = 4 }) => {
|
|
|
24622
24650
|
ModalDialog,
|
|
24623
24651
|
MultilineChip,
|
|
24624
24652
|
NUMBER_OPERATORS,
|
|
24653
|
+
NumberEditor,
|
|
24654
|
+
NumberRangeEditor,
|
|
24625
24655
|
PageHeaderSection,
|
|
24626
24656
|
Pagination,
|
|
24627
24657
|
Paragraph,
|
|
@@ -24674,6 +24704,8 @@ var ToastContainer = ({ limit = 4 }) => {
|
|
|
24674
24704
|
ShortcutRevealer,
|
|
24675
24705
|
Skeleton,
|
|
24676
24706
|
StatusBullet,
|
|
24707
|
+
StatusMultiEditor,
|
|
24708
|
+
StatusSingleEditor,
|
|
24677
24709
|
SuccessMessage,
|
|
24678
24710
|
Switch,
|
|
24679
24711
|
TAKEOVER_STACK_ID,
|
|
@@ -24690,6 +24722,7 @@ var ToastContainer = ({ limit = 4 }) => {
|
|
|
24690
24722
|
TableRow,
|
|
24691
24723
|
Tabs,
|
|
24692
24724
|
TakeoverDrawerRenderer,
|
|
24725
|
+
TextEditor,
|
|
24693
24726
|
Textarea,
|
|
24694
24727
|
Theme,
|
|
24695
24728
|
Tile,
|
|
@@ -24734,6 +24767,7 @@ var ToastContainer = ({ limit = 4 }) => {
|
|
|
24734
24767
|
fadeInRtl,
|
|
24735
24768
|
fadeInTop,
|
|
24736
24769
|
fadeOutBottom,
|
|
24770
|
+
filterMapper,
|
|
24737
24771
|
fullWidthScreenIcon,
|
|
24738
24772
|
getDrawerAttributes,
|
|
24739
24773
|
getParentPath,
|