@uniformdev/design-system 19.136.0 → 19.136.1-alpha.4
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 +276 -255
- package/dist/index.d.mts +111 -6
- package/dist/index.d.ts +111 -6
- package/dist/index.js +298 -266
- 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
|
PUBLISH_STATUS_FIELD_OPERATORS: () => PUBLISH_STATUS_FIELD_OPERATORS,
|
|
1439
1446
|
PageHeaderSection: () => PageHeaderSection,
|
|
1440
1447
|
Pagination: () => Pagination,
|
|
@@ -1488,6 +1495,8 @@ __export(src_exports, {
|
|
|
1488
1495
|
ShortcutRevealer: () => ShortcutRevealer,
|
|
1489
1496
|
Skeleton: () => Skeleton,
|
|
1490
1497
|
StatusBullet: () => StatusBullet,
|
|
1498
|
+
StatusMultiEditor: () => StatusMultiEditor,
|
|
1499
|
+
StatusSingleEditor: () => StatusSingleEditor,
|
|
1491
1500
|
SuccessMessage: () => SuccessMessage,
|
|
1492
1501
|
Switch: () => Switch,
|
|
1493
1502
|
TAKEOVER_STACK_ID: () => TAKEOVER_STACK_ID,
|
|
@@ -1504,6 +1513,7 @@ __export(src_exports, {
|
|
|
1504
1513
|
TableRow: () => TableRow,
|
|
1505
1514
|
Tabs: () => Tabs,
|
|
1506
1515
|
TakeoverDrawerRenderer: () => TakeoverDrawerRenderer,
|
|
1516
|
+
TextEditor: () => TextEditor,
|
|
1507
1517
|
Textarea: () => Textarea,
|
|
1508
1518
|
Theme: () => Theme,
|
|
1509
1519
|
Tile: () => Tile2,
|
|
@@ -1548,6 +1558,7 @@ __export(src_exports, {
|
|
|
1548
1558
|
fadeInRtl: () => fadeInRtl,
|
|
1549
1559
|
fadeInTop: () => fadeInTop,
|
|
1550
1560
|
fadeOutBottom: () => fadeOutBottom,
|
|
1561
|
+
filterMapper: () => filterMapper,
|
|
1551
1562
|
fullWidthScreenIcon: () => fullWidthScreenIcon,
|
|
1552
1563
|
getDrawerAttributes: () => getDrawerAttributes,
|
|
1553
1564
|
getParentPath: () => getParentPath,
|
|
@@ -22579,216 +22590,25 @@ var FilterButton2 = ({
|
|
|
22579
22590
|
|
|
22580
22591
|
// src/components/SearchAndFilter/FilterControls.tsx
|
|
22581
22592
|
init_emotion_jsx_shim();
|
|
22582
|
-
var
|
|
22583
|
-
var
|
|
22593
|
+
var import_react143 = require("react");
|
|
22594
|
+
var import_react_use4 = require("react-use");
|
|
22584
22595
|
|
|
22585
22596
|
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
22586
22597
|
init_emotion_jsx_shim();
|
|
22587
|
-
var
|
|
22588
|
-
var import_jsx_runtime119 = require("@emotion/react/jsx-runtime");
|
|
22589
|
-
var SearchAndFilterContext = (0, import_react140.createContext)({
|
|
22590
|
-
searchTerm: "",
|
|
22591
|
-
setSearchTerm: () => {
|
|
22592
|
-
},
|
|
22593
|
-
filterVisibility: void 0,
|
|
22594
|
-
setFilterVisibility: () => {
|
|
22595
|
-
},
|
|
22596
|
-
filters: [],
|
|
22597
|
-
setFilters: () => {
|
|
22598
|
-
},
|
|
22599
|
-
handleAddFilter: () => {
|
|
22600
|
-
},
|
|
22601
|
-
handleResetFilters: () => {
|
|
22602
|
-
},
|
|
22603
|
-
handleDeleteFilter: () => {
|
|
22604
|
-
},
|
|
22605
|
-
handleLocaleChange: () => {
|
|
22606
|
-
},
|
|
22607
|
-
setSortBy: () => {
|
|
22608
|
-
},
|
|
22609
|
-
sortByValue: "",
|
|
22610
|
-
filterOptions: [],
|
|
22611
|
-
sortOptions: [],
|
|
22612
|
-
validFilterQuery: [],
|
|
22613
|
-
totalResults: 0,
|
|
22614
|
-
localeOptions: [],
|
|
22615
|
-
localeValue: ""
|
|
22616
|
-
});
|
|
22617
|
-
var SearchAndFilterProvider = ({
|
|
22618
|
-
filters,
|
|
22619
|
-
filterOptions,
|
|
22620
|
-
sortOptions,
|
|
22621
|
-
defaultSortByValue,
|
|
22622
|
-
defaultLocale = "",
|
|
22623
|
-
localeOptions,
|
|
22624
|
-
onLocaleChange,
|
|
22625
|
-
filterVisible = false,
|
|
22626
|
-
onSearchChange,
|
|
22627
|
-
onChange,
|
|
22628
|
-
onSortChange,
|
|
22629
|
-
resetFilterValues = [{ field: "", operator: "", value: "" }],
|
|
22630
|
-
totalResults,
|
|
22631
|
-
children
|
|
22632
|
-
}) => {
|
|
22633
|
-
const [searchTerm, setSearchTerm] = (0, import_react140.useState)("");
|
|
22634
|
-
const deferredSearchTerm = (0, import_react140.useDeferredValue)(searchTerm);
|
|
22635
|
-
const [filterVisibility, setFilterVisibility] = (0, import_react140.useState)(filterVisible);
|
|
22636
|
-
const [sortByValue, setSortByValue] = (0, import_react140.useState)(defaultSortByValue);
|
|
22637
|
-
const [localeValue, setLocale] = (0, import_react140.useState)(defaultLocale);
|
|
22638
|
-
const handleSearchTerm = (0, import_react140.useCallback)(
|
|
22639
|
-
(term) => {
|
|
22640
|
-
setSearchTerm(term);
|
|
22641
|
-
onSearchChange == null ? void 0 : onSearchChange(term);
|
|
22642
|
-
},
|
|
22643
|
-
[setSearchTerm, onSearchChange]
|
|
22644
|
-
);
|
|
22645
|
-
const handleLocaleChange = (0, import_react140.useCallback)(
|
|
22646
|
-
(locale) => {
|
|
22647
|
-
setLocale(locale);
|
|
22648
|
-
onLocaleChange == null ? void 0 : onLocaleChange(locale);
|
|
22649
|
-
},
|
|
22650
|
-
[onLocaleChange]
|
|
22651
|
-
);
|
|
22652
|
-
const handleOnSortChange = (0, import_react140.useCallback)(
|
|
22653
|
-
(sort) => {
|
|
22654
|
-
setSortByValue(sort);
|
|
22655
|
-
onSortChange(sort);
|
|
22656
|
-
},
|
|
22657
|
-
[onSortChange]
|
|
22658
|
-
);
|
|
22659
|
-
const handleToggleFilterVisibilty = (0, import_react140.useCallback)(
|
|
22660
|
-
(visible) => setFilterVisibility(visible),
|
|
22661
|
-
[setFilterVisibility]
|
|
22662
|
-
);
|
|
22663
|
-
const handleAddFilter = (0, import_react140.useCallback)(() => {
|
|
22664
|
-
onChange([...filters, { field: "", operator: "", value: "" }]);
|
|
22665
|
-
}, [filters, onChange]);
|
|
22666
|
-
const handleResetFilters = (0, import_react140.useCallback)(() => {
|
|
22667
|
-
onChange(resetFilterValues);
|
|
22668
|
-
}, [onChange, resetFilterValues]);
|
|
22669
|
-
const handleDeleteFilter = (0, import_react140.useCallback)(
|
|
22670
|
-
(index) => {
|
|
22671
|
-
const remainingFilters = filters.filter((_, i) => i !== index);
|
|
22672
|
-
onChange(remainingFilters);
|
|
22673
|
-
},
|
|
22674
|
-
[filters, onChange]
|
|
22675
|
-
);
|
|
22676
|
-
const validFilterQuery = (0, import_react140.useMemo)(() => {
|
|
22677
|
-
const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
|
|
22678
|
-
if (hasValidFilters) {
|
|
22679
|
-
return filters;
|
|
22680
|
-
}
|
|
22681
|
-
}, [filters]);
|
|
22682
|
-
(0, import_react140.useEffect)(() => {
|
|
22683
|
-
if (filterVisibility) {
|
|
22684
|
-
const handleEscKeyFilterClose = (e) => {
|
|
22685
|
-
if (e.key === "Escape") {
|
|
22686
|
-
setFilterVisibility(false);
|
|
22687
|
-
}
|
|
22688
|
-
};
|
|
22689
|
-
document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
22690
|
-
return () => {
|
|
22691
|
-
document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
22692
|
-
};
|
|
22693
|
-
}
|
|
22694
|
-
}, [filterVisibility]);
|
|
22695
|
-
return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
22696
|
-
SearchAndFilterContext.Provider,
|
|
22697
|
-
{
|
|
22698
|
-
value: {
|
|
22699
|
-
searchTerm: deferredSearchTerm,
|
|
22700
|
-
setSearchTerm: (e) => handleSearchTerm(e),
|
|
22701
|
-
setSortBy: (e) => handleOnSortChange(e),
|
|
22702
|
-
sortByValue,
|
|
22703
|
-
filterVisibility,
|
|
22704
|
-
setFilterVisibility: (e) => handleToggleFilterVisibilty(e),
|
|
22705
|
-
filters,
|
|
22706
|
-
setFilters: (e) => onChange(e),
|
|
22707
|
-
handleAddFilter,
|
|
22708
|
-
handleResetFilters,
|
|
22709
|
-
handleDeleteFilter,
|
|
22710
|
-
filterOptions,
|
|
22711
|
-
sortOptions,
|
|
22712
|
-
validFilterQuery,
|
|
22713
|
-
totalResults,
|
|
22714
|
-
localeOptions,
|
|
22715
|
-
localeValue,
|
|
22716
|
-
handleLocaleChange
|
|
22717
|
-
},
|
|
22718
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(VerticalRhythm, { children })
|
|
22719
|
-
}
|
|
22720
|
-
);
|
|
22721
|
-
};
|
|
22722
|
-
var useSearchAndFilter = () => {
|
|
22723
|
-
const value = (0, import_react140.useContext)(SearchAndFilterContext);
|
|
22724
|
-
return { ...value };
|
|
22725
|
-
};
|
|
22726
|
-
|
|
22727
|
-
// src/components/SearchAndFilter/FilterControls.tsx
|
|
22728
|
-
var import_jsx_runtime120 = require("@emotion/react/jsx-runtime");
|
|
22729
|
-
var FilterControls = ({
|
|
22730
|
-
children,
|
|
22731
|
-
hideSearchInput
|
|
22732
|
-
}) => {
|
|
22733
|
-
const { setFilterVisibility, filterVisibility, setSearchTerm, validFilterQuery, searchTerm } = useSearchAndFilter();
|
|
22734
|
-
const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react141.useState)("");
|
|
22735
|
-
(0, import_react_use3.useDebounce)(
|
|
22736
|
-
() => {
|
|
22737
|
-
setSearchTerm(localeSearchTerm);
|
|
22738
|
-
},
|
|
22739
|
-
300,
|
|
22740
|
-
[localeSearchTerm, searchTerm]
|
|
22741
|
-
);
|
|
22742
|
-
(0, import_react141.useEffect)(() => {
|
|
22743
|
-
if (searchTerm === "") {
|
|
22744
|
-
setLocaleSearchTerm("");
|
|
22745
|
-
}
|
|
22746
|
-
}, [searchTerm]);
|
|
22747
|
-
return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(import_jsx_runtime120.Fragment, { children: [
|
|
22748
|
-
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
22749
|
-
FilterButton2,
|
|
22750
|
-
{
|
|
22751
|
-
"aria-controls": "search-and-filter-options",
|
|
22752
|
-
"aria-label": "filter options",
|
|
22753
|
-
"aria-haspopup": "true",
|
|
22754
|
-
text: "Filter/Sort",
|
|
22755
|
-
"aria-expanded": filterVisibility === true,
|
|
22756
|
-
filterCount: validFilterQuery == null ? void 0 : validFilterQuery.length,
|
|
22757
|
-
onClick: () => setFilterVisibility(!filterVisibility),
|
|
22758
|
-
dataTestId: "filters-button"
|
|
22759
|
-
}
|
|
22760
|
-
),
|
|
22761
|
-
hideSearchInput ? null : /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
22762
|
-
InputKeywordSearch,
|
|
22763
|
-
{
|
|
22764
|
-
placeholder: "Search...",
|
|
22765
|
-
onSearchTextChanged: (e) => setLocaleSearchTerm(e),
|
|
22766
|
-
value: localeSearchTerm,
|
|
22767
|
-
compact: true,
|
|
22768
|
-
rounded: true,
|
|
22769
|
-
css: SearchInput
|
|
22770
|
-
}
|
|
22771
|
-
),
|
|
22772
|
-
children
|
|
22773
|
-
] });
|
|
22774
|
-
};
|
|
22775
|
-
|
|
22776
|
-
// src/components/SearchAndFilter/FilterItem.tsx
|
|
22777
|
-
init_emotion_jsx_shim();
|
|
22778
|
-
var import_react148 = require("react");
|
|
22598
|
+
var import_react142 = require("react");
|
|
22779
22599
|
|
|
22780
22600
|
// src/components/SearchAndFilter/FilterEditor.tsx
|
|
22781
22601
|
init_emotion_jsx_shim();
|
|
22782
|
-
var
|
|
22783
|
-
var
|
|
22602
|
+
var import_react141 = require("react");
|
|
22603
|
+
var import_react_use3 = require("react-use");
|
|
22784
22604
|
|
|
22785
22605
|
// src/components/Validation/StatusBullet.tsx
|
|
22786
22606
|
init_emotion_jsx_shim();
|
|
22787
22607
|
|
|
22788
22608
|
// src/components/Validation/StatusBullet.styles.ts
|
|
22789
22609
|
init_emotion_jsx_shim();
|
|
22790
|
-
var
|
|
22791
|
-
var StatusBulletContainer =
|
|
22610
|
+
var import_react140 = require("@emotion/react");
|
|
22611
|
+
var StatusBulletContainer = import_react140.css`
|
|
22792
22612
|
align-items: center;
|
|
22793
22613
|
align-self: center;
|
|
22794
22614
|
color: var(--gray-500);
|
|
@@ -22805,33 +22625,33 @@ var StatusBulletContainer = import_react142.css`
|
|
|
22805
22625
|
display: block;
|
|
22806
22626
|
}
|
|
22807
22627
|
`;
|
|
22808
|
-
var StatusBulletBase =
|
|
22628
|
+
var StatusBulletBase = import_react140.css`
|
|
22809
22629
|
font-size: var(--fs-sm);
|
|
22810
22630
|
&:before {
|
|
22811
22631
|
width: var(--fs-xs);
|
|
22812
22632
|
height: var(--fs-xs);
|
|
22813
22633
|
}
|
|
22814
22634
|
`;
|
|
22815
|
-
var StatusBulletSmall =
|
|
22635
|
+
var StatusBulletSmall = import_react140.css`
|
|
22816
22636
|
font-size: var(--fs-xs);
|
|
22817
22637
|
&:before {
|
|
22818
22638
|
width: var(--fs-xxs);
|
|
22819
22639
|
height: var(--fs-xxs);
|
|
22820
22640
|
}
|
|
22821
22641
|
`;
|
|
22822
|
-
var StatusDraft =
|
|
22642
|
+
var StatusDraft = import_react140.css`
|
|
22823
22643
|
&:before {
|
|
22824
22644
|
background: var(--white);
|
|
22825
22645
|
box-shadow: inset 0 0 0 0.125rem var(--primary-action-default);
|
|
22826
22646
|
}
|
|
22827
22647
|
`;
|
|
22828
|
-
var StatusModified =
|
|
22648
|
+
var StatusModified = import_react140.css`
|
|
22829
22649
|
&:before {
|
|
22830
22650
|
background: linear-gradient(to right, var(--white) 50%, var(--primary-action-default) 50% 100%);
|
|
22831
22651
|
box-shadow: inset 0 0 0 0.125rem var(--primary-action-default);
|
|
22832
22652
|
}
|
|
22833
22653
|
`;
|
|
22834
|
-
var StatusError =
|
|
22654
|
+
var StatusError = import_react140.css`
|
|
22835
22655
|
color: var(--error);
|
|
22836
22656
|
&:before {
|
|
22837
22657
|
/* TODO: replace this with an svg icon */
|
|
@@ -22844,29 +22664,29 @@ var StatusError = import_react142.css`
|
|
|
22844
22664
|
);
|
|
22845
22665
|
}
|
|
22846
22666
|
`;
|
|
22847
|
-
var StatusPublished =
|
|
22667
|
+
var StatusPublished = import_react140.css`
|
|
22848
22668
|
&:before {
|
|
22849
22669
|
background: var(--primary-action-default);
|
|
22850
22670
|
}
|
|
22851
22671
|
`;
|
|
22852
|
-
var StatusOrphan =
|
|
22672
|
+
var StatusOrphan = import_react140.css`
|
|
22853
22673
|
&:before {
|
|
22854
22674
|
background: var(--brand-secondary-5);
|
|
22855
22675
|
}
|
|
22856
22676
|
`;
|
|
22857
|
-
var StatusUnknown =
|
|
22677
|
+
var StatusUnknown = import_react140.css`
|
|
22858
22678
|
&:before {
|
|
22859
22679
|
background: var(--gray-800);
|
|
22860
22680
|
}
|
|
22861
22681
|
`;
|
|
22862
|
-
var StatusDeleted =
|
|
22682
|
+
var StatusDeleted = import_react140.css`
|
|
22863
22683
|
&:before {
|
|
22864
22684
|
background: var(--error);
|
|
22865
22685
|
}
|
|
22866
22686
|
`;
|
|
22867
22687
|
|
|
22868
22688
|
// src/components/Validation/StatusBullet.tsx
|
|
22869
|
-
var
|
|
22689
|
+
var import_jsx_runtime119 = require("@emotion/react/jsx-runtime");
|
|
22870
22690
|
var StatusBullet = ({
|
|
22871
22691
|
status,
|
|
22872
22692
|
hideText = false,
|
|
@@ -22886,7 +22706,7 @@ var StatusBullet = ({
|
|
|
22886
22706
|
Deleted: StatusDeleted
|
|
22887
22707
|
};
|
|
22888
22708
|
const statusSize = size === "base" ? StatusBulletBase : StatusBulletSmall;
|
|
22889
|
-
return /* @__PURE__ */ (0,
|
|
22709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
22890
22710
|
"span",
|
|
22891
22711
|
{
|
|
22892
22712
|
role: "status",
|
|
@@ -22899,7 +22719,7 @@ var StatusBullet = ({
|
|
|
22899
22719
|
};
|
|
22900
22720
|
|
|
22901
22721
|
// src/components/SearchAndFilter/FilterEditor.tsx
|
|
22902
|
-
var
|
|
22722
|
+
var import_jsx_runtime120 = require("@emotion/react/jsx-runtime");
|
|
22903
22723
|
var readOnlyAttributes = {
|
|
22904
22724
|
isSearchable: false,
|
|
22905
22725
|
menuIsOpen: false,
|
|
@@ -22908,13 +22728,13 @@ var readOnlyAttributes = {
|
|
|
22908
22728
|
var FilterMultiChoiceEditor = ({
|
|
22909
22729
|
value,
|
|
22910
22730
|
options,
|
|
22911
|
-
|
|
22731
|
+
disabled: disabled2,
|
|
22912
22732
|
readOnly,
|
|
22913
22733
|
valueTestId,
|
|
22914
22734
|
...props
|
|
22915
22735
|
}) => {
|
|
22916
22736
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
22917
|
-
return /* @__PURE__ */ (0,
|
|
22737
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
22918
22738
|
InputComboBox,
|
|
22919
22739
|
{
|
|
22920
22740
|
...props,
|
|
@@ -22922,12 +22742,12 @@ var FilterMultiChoiceEditor = ({
|
|
|
22922
22742
|
options,
|
|
22923
22743
|
isMulti: true,
|
|
22924
22744
|
isClearable: true,
|
|
22925
|
-
isDisabled,
|
|
22745
|
+
isDisabled: disabled2,
|
|
22926
22746
|
onChange: (e) => {
|
|
22927
22747
|
var _a;
|
|
22928
|
-
return props.onChange((_a = e.map((
|
|
22748
|
+
return props.onChange((_a = e == null ? void 0 : e.map((option) => option.value)) != null ? _a : []);
|
|
22929
22749
|
},
|
|
22930
|
-
value,
|
|
22750
|
+
value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
|
|
22931
22751
|
"aria-readonly": readOnly,
|
|
22932
22752
|
styles: {
|
|
22933
22753
|
menu(base) {
|
|
@@ -22944,13 +22764,13 @@ var FilterMultiChoiceEditor = ({
|
|
|
22944
22764
|
var FilterSingleChoiceEditor = ({
|
|
22945
22765
|
options,
|
|
22946
22766
|
value,
|
|
22947
|
-
|
|
22767
|
+
disabled: disabled2,
|
|
22948
22768
|
readOnly,
|
|
22949
22769
|
onChange,
|
|
22950
22770
|
valueTestId
|
|
22951
22771
|
}) => {
|
|
22952
22772
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
22953
|
-
return /* @__PURE__ */ (0,
|
|
22773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
22954
22774
|
InputComboBox,
|
|
22955
22775
|
{
|
|
22956
22776
|
placeholder: "Type to search...",
|
|
@@ -22960,8 +22780,8 @@ var FilterSingleChoiceEditor = ({
|
|
|
22960
22780
|
var _a;
|
|
22961
22781
|
return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
|
|
22962
22782
|
},
|
|
22963
|
-
isDisabled,
|
|
22964
|
-
value,
|
|
22783
|
+
isDisabled: disabled2,
|
|
22784
|
+
value: options == null ? void 0 : options.find((option) => option.value === value),
|
|
22965
22785
|
"aria-readonly": readOnly,
|
|
22966
22786
|
styles: {
|
|
22967
22787
|
menu(base) {
|
|
@@ -22976,18 +22796,18 @@ var FilterSingleChoiceEditor = ({
|
|
|
22976
22796
|
) });
|
|
22977
22797
|
};
|
|
22978
22798
|
var CustomOptions = ({ label, value }) => {
|
|
22979
|
-
return /* @__PURE__ */ (0,
|
|
22799
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(StatusBullet, { status: label, message: value });
|
|
22980
22800
|
};
|
|
22981
22801
|
var StatusMultiEditor = ({
|
|
22982
22802
|
options,
|
|
22983
22803
|
value,
|
|
22984
|
-
|
|
22804
|
+
disabled: disabled2,
|
|
22985
22805
|
readOnly,
|
|
22986
22806
|
onChange,
|
|
22987
22807
|
valueTestId
|
|
22988
22808
|
}) => {
|
|
22989
22809
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
22990
|
-
return /* @__PURE__ */ (0,
|
|
22810
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
22991
22811
|
InputComboBox,
|
|
22992
22812
|
{
|
|
22993
22813
|
options,
|
|
@@ -22997,9 +22817,9 @@ var StatusMultiEditor = ({
|
|
|
22997
22817
|
return onChange((_a = e.map((item) => item.value)) != null ? _a : []);
|
|
22998
22818
|
},
|
|
22999
22819
|
formatOptionLabel: CustomOptions,
|
|
23000
|
-
value,
|
|
23001
|
-
isDisabled,
|
|
23002
22820
|
"aria-readonly": readOnly,
|
|
22821
|
+
value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
|
|
22822
|
+
isDisabled: disabled2,
|
|
23003
22823
|
styles: {
|
|
23004
22824
|
menu(base) {
|
|
23005
22825
|
return {
|
|
@@ -23015,13 +22835,13 @@ var StatusMultiEditor = ({
|
|
|
23015
22835
|
var StatusSingleEditor = ({
|
|
23016
22836
|
options,
|
|
23017
22837
|
value,
|
|
23018
|
-
|
|
22838
|
+
disabled: disabled2,
|
|
23019
22839
|
readOnly,
|
|
23020
22840
|
onChange,
|
|
23021
22841
|
valueTestId
|
|
23022
22842
|
}) => {
|
|
23023
22843
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
23024
|
-
return /* @__PURE__ */ (0,
|
|
22844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23025
22845
|
InputComboBox,
|
|
23026
22846
|
{
|
|
23027
22847
|
options,
|
|
@@ -23030,9 +22850,9 @@ var StatusSingleEditor = ({
|
|
|
23030
22850
|
return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
|
|
23031
22851
|
},
|
|
23032
22852
|
formatOptionLabel: CustomOptions,
|
|
23033
|
-
value,
|
|
23034
|
-
isDisabled,
|
|
23035
22853
|
"aria-readonly": readOnly,
|
|
22854
|
+
value: options == null ? void 0 : options.find((option) => option.value === value),
|
|
22855
|
+
isDisabled: disabled2,
|
|
23036
22856
|
styles: {
|
|
23037
22857
|
menu(base) {
|
|
23038
22858
|
return {
|
|
@@ -23045,9 +22865,15 @@ var StatusSingleEditor = ({
|
|
|
23045
22865
|
}
|
|
23046
22866
|
) });
|
|
23047
22867
|
};
|
|
23048
|
-
var TextEditor = ({
|
|
23049
|
-
|
|
23050
|
-
|
|
22868
|
+
var TextEditor = ({
|
|
22869
|
+
onChange,
|
|
22870
|
+
ariaLabel,
|
|
22871
|
+
value,
|
|
22872
|
+
readOnly,
|
|
22873
|
+
valueTestId
|
|
22874
|
+
}) => {
|
|
22875
|
+
(0, import_react_use3.useDebounce)(() => onChange, 500, [value]);
|
|
22876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23051
22877
|
Input,
|
|
23052
22878
|
{
|
|
23053
22879
|
showLabel: false,
|
|
@@ -23068,10 +22894,10 @@ var NumberRangeEditor = ({
|
|
|
23068
22894
|
readOnly,
|
|
23069
22895
|
valueTestId
|
|
23070
22896
|
}) => {
|
|
23071
|
-
const [minValue, setMinValue] = (0,
|
|
23072
|
-
const [maxValue, setMaxValue] = (0,
|
|
23073
|
-
const [error, setError] = (0,
|
|
23074
|
-
(0,
|
|
22897
|
+
const [minValue, setMinValue] = (0, import_react141.useState)("");
|
|
22898
|
+
const [maxValue, setMaxValue] = (0, import_react141.useState)("");
|
|
22899
|
+
const [error, setError] = (0, import_react141.useState)("");
|
|
22900
|
+
(0, import_react141.useEffect)(() => {
|
|
23075
22901
|
if (!maxValue && !minValue) {
|
|
23076
22902
|
return;
|
|
23077
22903
|
}
|
|
@@ -23090,9 +22916,9 @@ var NumberRangeEditor = ({
|
|
|
23090
22916
|
setError("");
|
|
23091
22917
|
onChange([minValue, maxValue]);
|
|
23092
22918
|
}, [maxValue, minValue, setError]);
|
|
23093
|
-
return /* @__PURE__ */ (0,
|
|
23094
|
-
/* @__PURE__ */ (0,
|
|
23095
|
-
/* @__PURE__ */ (0,
|
|
22919
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(import_jsx_runtime120.Fragment, { children: [
|
|
22920
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
22921
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23096
22922
|
Input,
|
|
23097
22923
|
{
|
|
23098
22924
|
label: `${ariaLabel}-min`,
|
|
@@ -23107,7 +22933,7 @@ var NumberRangeEditor = ({
|
|
|
23107
22933
|
readOnly
|
|
23108
22934
|
}
|
|
23109
22935
|
),
|
|
23110
|
-
/* @__PURE__ */ (0,
|
|
22936
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23111
22937
|
Input,
|
|
23112
22938
|
{
|
|
23113
22939
|
type: "number",
|
|
@@ -23123,7 +22949,7 @@ var NumberRangeEditor = ({
|
|
|
23123
22949
|
}
|
|
23124
22950
|
)
|
|
23125
22951
|
] }),
|
|
23126
|
-
/* @__PURE__ */ (0,
|
|
22952
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(ErrorContainer, { errorMessage: error })
|
|
23127
22953
|
] });
|
|
23128
22954
|
};
|
|
23129
22955
|
var NumberEditor = ({
|
|
@@ -23134,7 +22960,7 @@ var NumberEditor = ({
|
|
|
23134
22960
|
readOnly,
|
|
23135
22961
|
valueTestId
|
|
23136
22962
|
}) => {
|
|
23137
|
-
return /* @__PURE__ */ (0,
|
|
22963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23138
22964
|
Input,
|
|
23139
22965
|
{
|
|
23140
22966
|
label: ariaLabel,
|
|
@@ -23157,7 +22983,7 @@ var DateEditor = ({
|
|
|
23157
22983
|
readOnly,
|
|
23158
22984
|
valueTestId
|
|
23159
22985
|
}) => {
|
|
23160
|
-
return /* @__PURE__ */ (0,
|
|
22986
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23161
22987
|
Input,
|
|
23162
22988
|
{
|
|
23163
22989
|
type: "date",
|
|
@@ -23179,10 +23005,10 @@ var DateRangeEditor = ({
|
|
|
23179
23005
|
readOnly,
|
|
23180
23006
|
valueTestId
|
|
23181
23007
|
}) => {
|
|
23182
|
-
const [minDateValue, setMinDateValue] = (0,
|
|
23183
|
-
const [maxDateValue, setMaxDateValue] = (0,
|
|
23184
|
-
const [error, setError] = (0,
|
|
23185
|
-
(0,
|
|
23008
|
+
const [minDateValue, setMinDateValue] = (0, import_react141.useState)(value ? value[0] : "");
|
|
23009
|
+
const [maxDateValue, setMaxDateValue] = (0, import_react141.useState)(value ? value[1] : "");
|
|
23010
|
+
const [error, setError] = (0, import_react141.useState)("");
|
|
23011
|
+
(0, import_react141.useEffect)(() => {
|
|
23186
23012
|
if (!minDateValue || !maxDateValue) {
|
|
23187
23013
|
return;
|
|
23188
23014
|
}
|
|
@@ -23213,9 +23039,9 @@ var DateRangeEditor = ({
|
|
|
23213
23039
|
setError("");
|
|
23214
23040
|
onChange([minDateValue, maxDateValue]);
|
|
23215
23041
|
}, [minDateValue, maxDateValue, setError]);
|
|
23216
|
-
return /* @__PURE__ */ (0,
|
|
23217
|
-
/* @__PURE__ */ (0,
|
|
23218
|
-
/* @__PURE__ */ (0,
|
|
23042
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(import_jsx_runtime120.Fragment, { children: [
|
|
23043
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
23044
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23219
23045
|
Input,
|
|
23220
23046
|
{
|
|
23221
23047
|
label: `${ariaLabel}-min-date`,
|
|
@@ -23228,7 +23054,7 @@ var DateRangeEditor = ({
|
|
|
23228
23054
|
readOnly
|
|
23229
23055
|
}
|
|
23230
23056
|
),
|
|
23231
|
-
/* @__PURE__ */ (0,
|
|
23057
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23232
23058
|
Input,
|
|
23233
23059
|
{
|
|
23234
23060
|
label: `${ariaLabel}-max-date`,
|
|
@@ -23242,18 +23068,19 @@ var DateRangeEditor = ({
|
|
|
23242
23068
|
}
|
|
23243
23069
|
)
|
|
23244
23070
|
] }),
|
|
23245
|
-
/* @__PURE__ */ (0,
|
|
23071
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(ErrorContainer, { errorMessage: error })
|
|
23246
23072
|
] });
|
|
23247
23073
|
};
|
|
23248
23074
|
var FilterEditorRenderer = ({ editorType, ...props }) => {
|
|
23249
|
-
const
|
|
23075
|
+
const { filterMapper: contextFilterMapper } = useSearchAndFilter();
|
|
23076
|
+
const Editor = contextFilterMapper == null ? void 0 : contextFilterMapper[editorType];
|
|
23250
23077
|
if (!Editor) {
|
|
23251
23078
|
return null;
|
|
23252
23079
|
}
|
|
23253
23080
|
if (editorType === "empty") {
|
|
23254
23081
|
return null;
|
|
23255
23082
|
}
|
|
23256
|
-
return /* @__PURE__ */ (0,
|
|
23083
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Editor, { ...props });
|
|
23257
23084
|
};
|
|
23258
23085
|
var filterMapper = {
|
|
23259
23086
|
multiChoice: FilterMultiChoiceEditor,
|
|
@@ -23268,14 +23095,14 @@ var filterMapper = {
|
|
|
23268
23095
|
empty: null
|
|
23269
23096
|
};
|
|
23270
23097
|
var ErrorContainer = ({ errorMessage }) => {
|
|
23271
|
-
return /* @__PURE__ */ (0,
|
|
23098
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23272
23099
|
"div",
|
|
23273
23100
|
{
|
|
23274
23101
|
css: {
|
|
23275
23102
|
gridColumn: "span 6",
|
|
23276
23103
|
order: 6
|
|
23277
23104
|
},
|
|
23278
|
-
children: /* @__PURE__ */ (0,
|
|
23105
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(FieldMessage, { errorMessage })
|
|
23279
23106
|
}
|
|
23280
23107
|
);
|
|
23281
23108
|
};
|
|
@@ -23285,6 +23112,202 @@ var twoColumnGrid = {
|
|
|
23285
23112
|
gap: "var(--spacing-sm);"
|
|
23286
23113
|
};
|
|
23287
23114
|
|
|
23115
|
+
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
23116
|
+
var import_jsx_runtime121 = require("@emotion/react/jsx-runtime");
|
|
23117
|
+
var SearchAndFilterContext = (0, import_react142.createContext)({
|
|
23118
|
+
searchTerm: "",
|
|
23119
|
+
setSearchTerm: () => {
|
|
23120
|
+
},
|
|
23121
|
+
filterVisibility: void 0,
|
|
23122
|
+
setFilterVisibility: () => {
|
|
23123
|
+
},
|
|
23124
|
+
filters: [],
|
|
23125
|
+
setFilters: () => {
|
|
23126
|
+
},
|
|
23127
|
+
handleAddFilter: () => {
|
|
23128
|
+
},
|
|
23129
|
+
handleResetFilters: () => {
|
|
23130
|
+
},
|
|
23131
|
+
handleDeleteFilter: () => {
|
|
23132
|
+
},
|
|
23133
|
+
handleLocaleChange: () => {
|
|
23134
|
+
},
|
|
23135
|
+
setSortBy: () => {
|
|
23136
|
+
},
|
|
23137
|
+
sortByValue: "",
|
|
23138
|
+
filterOptions: [],
|
|
23139
|
+
sortOptions: [],
|
|
23140
|
+
validFilterQuery: [],
|
|
23141
|
+
filterMapper: {},
|
|
23142
|
+
totalResults: 0,
|
|
23143
|
+
localeOptions: [],
|
|
23144
|
+
localeValue: ""
|
|
23145
|
+
});
|
|
23146
|
+
var SearchAndFilterProvider = ({
|
|
23147
|
+
filters,
|
|
23148
|
+
filterOptions,
|
|
23149
|
+
sortOptions,
|
|
23150
|
+
defaultSortByValue,
|
|
23151
|
+
defaultLocale = "",
|
|
23152
|
+
localeOptions,
|
|
23153
|
+
onLocaleChange,
|
|
23154
|
+
filterVisible = false,
|
|
23155
|
+
onSearchChange,
|
|
23156
|
+
onChange,
|
|
23157
|
+
onSortChange,
|
|
23158
|
+
resetFilterValues = [{ field: "", operator: "", value: "" }],
|
|
23159
|
+
totalResults,
|
|
23160
|
+
filterMapper: filterMapper2 = filterMapper,
|
|
23161
|
+
children
|
|
23162
|
+
}) => {
|
|
23163
|
+
const [searchTerm, setSearchTerm] = (0, import_react142.useState)("");
|
|
23164
|
+
const deferredSearchTerm = (0, import_react142.useDeferredValue)(searchTerm);
|
|
23165
|
+
const [filterVisibility, setFilterVisibility] = (0, import_react142.useState)(filterVisible);
|
|
23166
|
+
const [sortByValue, setSortByValue] = (0, import_react142.useState)(defaultSortByValue);
|
|
23167
|
+
const [localeValue, setLocale] = (0, import_react142.useState)(defaultLocale);
|
|
23168
|
+
const handleSearchTerm = (0, import_react142.useCallback)(
|
|
23169
|
+
(term) => {
|
|
23170
|
+
setSearchTerm(term);
|
|
23171
|
+
onSearchChange == null ? void 0 : onSearchChange(term);
|
|
23172
|
+
},
|
|
23173
|
+
[setSearchTerm, onSearchChange]
|
|
23174
|
+
);
|
|
23175
|
+
const handleLocaleChange = (0, import_react142.useCallback)(
|
|
23176
|
+
(locale) => {
|
|
23177
|
+
setLocale(locale);
|
|
23178
|
+
onLocaleChange == null ? void 0 : onLocaleChange(locale);
|
|
23179
|
+
},
|
|
23180
|
+
[onLocaleChange]
|
|
23181
|
+
);
|
|
23182
|
+
const handleOnSortChange = (0, import_react142.useCallback)(
|
|
23183
|
+
(sort) => {
|
|
23184
|
+
setSortByValue(sort);
|
|
23185
|
+
onSortChange(sort);
|
|
23186
|
+
},
|
|
23187
|
+
[onSortChange]
|
|
23188
|
+
);
|
|
23189
|
+
const handleToggleFilterVisibilty = (0, import_react142.useCallback)(
|
|
23190
|
+
(visible) => setFilterVisibility(visible),
|
|
23191
|
+
[setFilterVisibility]
|
|
23192
|
+
);
|
|
23193
|
+
const handleAddFilter = (0, import_react142.useCallback)(() => {
|
|
23194
|
+
onChange([...filters, { field: "", operator: "", value: "" }]);
|
|
23195
|
+
}, [filters, onChange]);
|
|
23196
|
+
const handleResetFilters = (0, import_react142.useCallback)(() => {
|
|
23197
|
+
onChange(resetFilterValues);
|
|
23198
|
+
}, [onChange, resetFilterValues]);
|
|
23199
|
+
const handleDeleteFilter = (0, import_react142.useCallback)(
|
|
23200
|
+
(index) => {
|
|
23201
|
+
const remainingFilters = filters.filter((_, i) => i !== index);
|
|
23202
|
+
onChange(remainingFilters);
|
|
23203
|
+
},
|
|
23204
|
+
[filters, onChange]
|
|
23205
|
+
);
|
|
23206
|
+
const validFilterQuery = (0, import_react142.useMemo)(() => {
|
|
23207
|
+
const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
|
|
23208
|
+
if (hasValidFilters) {
|
|
23209
|
+
return filters;
|
|
23210
|
+
}
|
|
23211
|
+
}, [filters]);
|
|
23212
|
+
(0, import_react142.useEffect)(() => {
|
|
23213
|
+
if (filterVisibility) {
|
|
23214
|
+
const handleEscKeyFilterClose = (e) => {
|
|
23215
|
+
if (e.key === "Escape") {
|
|
23216
|
+
setFilterVisibility(false);
|
|
23217
|
+
}
|
|
23218
|
+
};
|
|
23219
|
+
document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
23220
|
+
return () => {
|
|
23221
|
+
document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
23222
|
+
};
|
|
23223
|
+
}
|
|
23224
|
+
}, [filterVisibility]);
|
|
23225
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
23226
|
+
SearchAndFilterContext.Provider,
|
|
23227
|
+
{
|
|
23228
|
+
value: {
|
|
23229
|
+
searchTerm: deferredSearchTerm,
|
|
23230
|
+
setSearchTerm: (e) => handleSearchTerm(e),
|
|
23231
|
+
setSortBy: (e) => handleOnSortChange(e),
|
|
23232
|
+
sortByValue,
|
|
23233
|
+
filterVisibility,
|
|
23234
|
+
setFilterVisibility: (e) => handleToggleFilterVisibilty(e),
|
|
23235
|
+
filters,
|
|
23236
|
+
setFilters: (e) => onChange(e),
|
|
23237
|
+
handleAddFilter,
|
|
23238
|
+
handleResetFilters,
|
|
23239
|
+
handleDeleteFilter,
|
|
23240
|
+
filterOptions,
|
|
23241
|
+
sortOptions,
|
|
23242
|
+
validFilterQuery,
|
|
23243
|
+
totalResults,
|
|
23244
|
+
localeOptions,
|
|
23245
|
+
localeValue,
|
|
23246
|
+
handleLocaleChange,
|
|
23247
|
+
filterMapper: filterMapper2
|
|
23248
|
+
},
|
|
23249
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(VerticalRhythm, { children })
|
|
23250
|
+
}
|
|
23251
|
+
);
|
|
23252
|
+
};
|
|
23253
|
+
var useSearchAndFilter = () => {
|
|
23254
|
+
const value = (0, import_react142.useContext)(SearchAndFilterContext);
|
|
23255
|
+
return { ...value };
|
|
23256
|
+
};
|
|
23257
|
+
|
|
23258
|
+
// src/components/SearchAndFilter/FilterControls.tsx
|
|
23259
|
+
var import_jsx_runtime122 = require("@emotion/react/jsx-runtime");
|
|
23260
|
+
var FilterControls = ({
|
|
23261
|
+
children,
|
|
23262
|
+
hideSearchInput
|
|
23263
|
+
}) => {
|
|
23264
|
+
const { setFilterVisibility, filterVisibility, setSearchTerm, validFilterQuery, searchTerm } = useSearchAndFilter();
|
|
23265
|
+
const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react143.useState)("");
|
|
23266
|
+
(0, import_react_use4.useDebounce)(
|
|
23267
|
+
() => {
|
|
23268
|
+
setSearchTerm(localeSearchTerm);
|
|
23269
|
+
},
|
|
23270
|
+
300,
|
|
23271
|
+
[localeSearchTerm, searchTerm]
|
|
23272
|
+
);
|
|
23273
|
+
(0, import_react143.useEffect)(() => {
|
|
23274
|
+
if (searchTerm === "") {
|
|
23275
|
+
setLocaleSearchTerm("");
|
|
23276
|
+
}
|
|
23277
|
+
}, [searchTerm]);
|
|
23278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(import_jsx_runtime122.Fragment, { children: [
|
|
23279
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
23280
|
+
FilterButton2,
|
|
23281
|
+
{
|
|
23282
|
+
"aria-controls": "search-and-filter-options",
|
|
23283
|
+
"aria-label": "filter options",
|
|
23284
|
+
"aria-haspopup": "true",
|
|
23285
|
+
text: "Filter/Sort",
|
|
23286
|
+
"aria-expanded": filterVisibility === true,
|
|
23287
|
+
filterCount: validFilterQuery == null ? void 0 : validFilterQuery.length,
|
|
23288
|
+
onClick: () => setFilterVisibility(!filterVisibility),
|
|
23289
|
+
dataTestId: "filters-button"
|
|
23290
|
+
}
|
|
23291
|
+
),
|
|
23292
|
+
hideSearchInput ? null : /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
23293
|
+
InputKeywordSearch,
|
|
23294
|
+
{
|
|
23295
|
+
placeholder: "Search...",
|
|
23296
|
+
onSearchTextChanged: (e) => setLocaleSearchTerm(e),
|
|
23297
|
+
value: localeSearchTerm,
|
|
23298
|
+
compact: true,
|
|
23299
|
+
rounded: true,
|
|
23300
|
+
css: SearchInput
|
|
23301
|
+
}
|
|
23302
|
+
),
|
|
23303
|
+
children
|
|
23304
|
+
] });
|
|
23305
|
+
};
|
|
23306
|
+
|
|
23307
|
+
// src/components/SearchAndFilter/FilterItem.tsx
|
|
23308
|
+
init_emotion_jsx_shim();
|
|
23309
|
+
var import_react148 = require("react");
|
|
23310
|
+
|
|
23288
23311
|
// src/components/SearchAndFilter/FilterMenu.tsx
|
|
23289
23312
|
init_emotion_jsx_shim();
|
|
23290
23313
|
var import_react144 = __toESM(require("react"));
|
|
@@ -23674,7 +23697,7 @@ var FilterItem = ({
|
|
|
23674
23697
|
const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
|
|
23675
23698
|
const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
|
|
23676
23699
|
const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
|
|
23677
|
-
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly } = (0, import_react148.useMemo)(() => {
|
|
23700
|
+
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = (0, import_react148.useMemo)(() => {
|
|
23678
23701
|
var _a2;
|
|
23679
23702
|
const currentSelectedFilter = filterOptions.find((item) => {
|
|
23680
23703
|
var _a3;
|
|
@@ -23687,19 +23710,14 @@ var FilterItem = ({
|
|
|
23687
23710
|
const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
|
|
23688
23711
|
return filters[index].operator === item.value;
|
|
23689
23712
|
});
|
|
23690
|
-
const selectedMetaValue2 = valueOptions.filter((item) => {
|
|
23691
|
-
if (Array.isArray(filters[index].value) && item.value) {
|
|
23692
|
-
return filters[index].value.includes(item.value);
|
|
23693
|
-
}
|
|
23694
|
-
return filters[index].value === item.value;
|
|
23695
|
-
});
|
|
23696
23713
|
return {
|
|
23697
23714
|
selectedFieldValue: selectedFieldValue2,
|
|
23698
23715
|
selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
|
|
23699
|
-
selectedMetaValue:
|
|
23700
|
-
readOnly: isCurrentFieldReadOnly
|
|
23716
|
+
selectedMetaValue: filters[index].value,
|
|
23717
|
+
readOnly: isCurrentFieldReadOnly,
|
|
23718
|
+
bindable: selectedFieldValue2 == null ? void 0 : selectedFieldValue2.bindable
|
|
23701
23719
|
};
|
|
23702
|
-
}, [filters, filterOptions, index, operatorOptions
|
|
23720
|
+
}, [filters, filterOptions, index, operatorOptions]);
|
|
23703
23721
|
const readOnlyProps = readOnly ? {
|
|
23704
23722
|
"aria-readonly": true,
|
|
23705
23723
|
isSearchable: false,
|
|
@@ -23768,7 +23786,8 @@ var FilterItem = ({
|
|
|
23768
23786
|
options: valueOptions,
|
|
23769
23787
|
onChange: (e) => onValueChange(e != null ? e : ""),
|
|
23770
23788
|
readOnly,
|
|
23771
|
-
|
|
23789
|
+
bindable,
|
|
23790
|
+
disabled: !filters[index].operator,
|
|
23772
23791
|
value: selectedMetaValue,
|
|
23773
23792
|
valueTestId: "filter-value"
|
|
23774
23793
|
}
|
|
@@ -23929,6 +23948,7 @@ var SearchAndFilter = ({
|
|
|
23929
23948
|
viewSwitchControls,
|
|
23930
23949
|
resultsContainerView = /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(SearchAndFilterResultContainer, {}),
|
|
23931
23950
|
children = /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(FilterItems, {}),
|
|
23951
|
+
filterMapper: filterMapper2 = filterMapper,
|
|
23932
23952
|
onChange,
|
|
23933
23953
|
onSearchChange,
|
|
23934
23954
|
onSortChange,
|
|
@@ -23954,6 +23974,7 @@ var SearchAndFilter = ({
|
|
|
23954
23974
|
defaultLocale,
|
|
23955
23975
|
localeOptions,
|
|
23956
23976
|
onLocaleChange,
|
|
23977
|
+
filterMapper: filterMapper2,
|
|
23957
23978
|
children: /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(VerticalRhythm, { css: SearchAndFilterContainer, "data-testid": "search-and-filter", children: [
|
|
23958
23979
|
/* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
|
|
23959
23980
|
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
@@ -24597,6 +24618,8 @@ var ToastContainer = ({ limit = 4 }) => {
|
|
|
24597
24618
|
CurrentDrawerContext,
|
|
24598
24619
|
DATE_OPERATORS,
|
|
24599
24620
|
DashedBox,
|
|
24621
|
+
DateEditor,
|
|
24622
|
+
DateRangeEditor,
|
|
24600
24623
|
DateTimePicker,
|
|
24601
24624
|
DateTimePickerVariant,
|
|
24602
24625
|
DebouncedInputKeywordSearch,
|
|
@@ -24612,9 +24635,12 @@ var ToastContainer = ({ limit = 4 }) => {
|
|
|
24612
24635
|
Fieldset,
|
|
24613
24636
|
FilterButton,
|
|
24614
24637
|
FilterControls,
|
|
24638
|
+
FilterEditorRenderer,
|
|
24615
24639
|
FilterItem,
|
|
24616
24640
|
FilterItems,
|
|
24617
24641
|
FilterMenu,
|
|
24642
|
+
FilterMultiChoiceEditor,
|
|
24643
|
+
FilterSingleChoiceEditor,
|
|
24618
24644
|
Heading,
|
|
24619
24645
|
HexModalBackground,
|
|
24620
24646
|
HorizontalRhythm,
|
|
@@ -24661,6 +24687,8 @@ var ToastContainer = ({ limit = 4 }) => {
|
|
|
24661
24687
|
ModalDialog,
|
|
24662
24688
|
MultilineChip,
|
|
24663
24689
|
NUMBER_OPERATORS,
|
|
24690
|
+
NumberEditor,
|
|
24691
|
+
NumberRangeEditor,
|
|
24664
24692
|
PUBLISH_STATUS_FIELD_OPERATORS,
|
|
24665
24693
|
PageHeaderSection,
|
|
24666
24694
|
Pagination,
|
|
@@ -24714,6 +24742,8 @@ var ToastContainer = ({ limit = 4 }) => {
|
|
|
24714
24742
|
ShortcutRevealer,
|
|
24715
24743
|
Skeleton,
|
|
24716
24744
|
StatusBullet,
|
|
24745
|
+
StatusMultiEditor,
|
|
24746
|
+
StatusSingleEditor,
|
|
24717
24747
|
SuccessMessage,
|
|
24718
24748
|
Switch,
|
|
24719
24749
|
TAKEOVER_STACK_ID,
|
|
@@ -24730,6 +24760,7 @@ var ToastContainer = ({ limit = 4 }) => {
|
|
|
24730
24760
|
TableRow,
|
|
24731
24761
|
Tabs,
|
|
24732
24762
|
TakeoverDrawerRenderer,
|
|
24763
|
+
TextEditor,
|
|
24733
24764
|
Textarea,
|
|
24734
24765
|
Theme,
|
|
24735
24766
|
Tile,
|
|
@@ -24774,6 +24805,7 @@ var ToastContainer = ({ limit = 4 }) => {
|
|
|
24774
24805
|
fadeInRtl,
|
|
24775
24806
|
fadeInTop,
|
|
24776
24807
|
fadeOutBottom,
|
|
24808
|
+
filterMapper,
|
|
24777
24809
|
fullWidthScreenIcon,
|
|
24778
24810
|
getDrawerAttributes,
|
|
24779
24811
|
getParentPath,
|