@uniformdev/design-system 19.135.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 +723 -662
- package/dist/index.d.mts +167 -27
- package/dist/index.d.ts +167 -27
- package/dist/index.js +766 -696
- package/package.json +5 -4
package/dist/esm/index.js
CHANGED
|
@@ -20455,6 +20455,28 @@ var SYSTEM_FIELD_OPERATORS = [
|
|
|
20455
20455
|
editorType: "multiChoice"
|
|
20456
20456
|
}
|
|
20457
20457
|
];
|
|
20458
|
+
var PUBLISH_STATUS_FIELD_OPERATORS = [
|
|
20459
|
+
{
|
|
20460
|
+
label: "is...",
|
|
20461
|
+
value: "eq",
|
|
20462
|
+
editorType: "statusSingleChoice"
|
|
20463
|
+
},
|
|
20464
|
+
{
|
|
20465
|
+
label: "is any of...",
|
|
20466
|
+
value: "in",
|
|
20467
|
+
editorType: "statusMultiChoice"
|
|
20468
|
+
},
|
|
20469
|
+
{
|
|
20470
|
+
label: "is not...",
|
|
20471
|
+
value: "neq",
|
|
20472
|
+
editorType: "statusSingleChoice"
|
|
20473
|
+
},
|
|
20474
|
+
{
|
|
20475
|
+
label: "is none of...",
|
|
20476
|
+
value: "nin",
|
|
20477
|
+
editorType: "statusMultiChoice"
|
|
20478
|
+
}
|
|
20479
|
+
];
|
|
20458
20480
|
|
|
20459
20481
|
// src/components/SearchAndFilter/styles/SearchAndFilter.styles.ts
|
|
20460
20482
|
import { css as css92 } from "@emotion/react";
|
|
@@ -20493,7 +20515,7 @@ var ConditionalFilterRow = css92`
|
|
|
20493
20515
|
}
|
|
20494
20516
|
}
|
|
20495
20517
|
|
|
20496
|
-
&:
|
|
20518
|
+
&:nth-of-type(2) {
|
|
20497
20519
|
margin-left: 0;
|
|
20498
20520
|
grid-template-columns: 50px 1fr;
|
|
20499
20521
|
}
|
|
@@ -20647,15 +20669,6 @@ var IconBtn = css92`
|
|
|
20647
20669
|
border: none;
|
|
20648
20670
|
padding: var(--spacing-sm);
|
|
20649
20671
|
`;
|
|
20650
|
-
var CloseBtn = css92`
|
|
20651
|
-
color: var(--gray-500);
|
|
20652
|
-
background: transparent;
|
|
20653
|
-
border: none;
|
|
20654
|
-
padding: 0;
|
|
20655
|
-
position: absolute;
|
|
20656
|
-
top: var(--spacing-base);
|
|
20657
|
-
right: var(--spacing-base);
|
|
20658
|
-
`;
|
|
20659
20672
|
var SearchAndFilterOptionsContainer = css92`
|
|
20660
20673
|
background: var(--gray-50);
|
|
20661
20674
|
border: 1px solid var(--gray-300);
|
|
@@ -20664,7 +20677,7 @@ var SearchAndFilterOptionsContainer = css92`
|
|
|
20664
20677
|
display: flex;
|
|
20665
20678
|
flex-direction: column;
|
|
20666
20679
|
gap: var(--spacing-sm);
|
|
20667
|
-
padding: var(--spacing-md)
|
|
20680
|
+
padding: var(--spacing-md) 0 var(--spacing-base);
|
|
20668
20681
|
will-change: height;
|
|
20669
20682
|
position: relative;
|
|
20670
20683
|
z-index: 1;
|
|
@@ -20673,14 +20686,27 @@ var SearchAndFilterOptionsInnerContainer = css92`
|
|
|
20673
20686
|
display: flex;
|
|
20674
20687
|
flex-direction: column;
|
|
20675
20688
|
gap: var(--spacing-sm);
|
|
20689
|
+
padding-inline: var(--spacing-md);
|
|
20676
20690
|
`;
|
|
20677
20691
|
var SearchAndFilterButtonGroup = css92`
|
|
20678
|
-
margin-top: var(--spacing-
|
|
20692
|
+
margin-top: var(--spacing-xs);
|
|
20693
|
+
margin-left: calc(56px + var(--spacing-md));
|
|
20694
|
+
`;
|
|
20695
|
+
var SortFilterWrapper = (hiddenLocaleInput) => css92`
|
|
20696
|
+
border-top: 1px solid var(--gray-300);
|
|
20697
|
+
align-items: center;
|
|
20698
|
+
display: grid;
|
|
20699
|
+
grid-template-columns: ${hiddenLocaleInput ? "1fr" : "1fr 200px"};
|
|
20700
|
+
gap: var(--spacing-xl);
|
|
20701
|
+
padding: var(--spacing-base) var(--spacing-md) 0;
|
|
20702
|
+
position: relative;
|
|
20703
|
+
z-index: 0;
|
|
20679
20704
|
`;
|
|
20680
20705
|
var SortFilterInputRow = css92`
|
|
20681
20706
|
align-items: center;
|
|
20682
|
-
display:
|
|
20683
|
-
|
|
20707
|
+
display: grid;
|
|
20708
|
+
grid-template-columns: 1fr auto;
|
|
20709
|
+
gap: var(--spacing-base);
|
|
20684
20710
|
`;
|
|
20685
20711
|
|
|
20686
20712
|
// src/components/SearchAndFilter/FilterButton.tsx
|
|
@@ -20714,8 +20740,8 @@ var FilterButton2 = ({
|
|
|
20714
20740
|
};
|
|
20715
20741
|
|
|
20716
20742
|
// src/components/SearchAndFilter/FilterControls.tsx
|
|
20717
|
-
import { useEffect as
|
|
20718
|
-
import { useDebounce as
|
|
20743
|
+
import { useEffect as useEffect19, useState as useState18 } from "react";
|
|
20744
|
+
import { useDebounce as useDebounce3 } from "react-use";
|
|
20719
20745
|
|
|
20720
20746
|
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
20721
20747
|
import {
|
|
@@ -20723,231 +20749,14 @@ import {
|
|
|
20723
20749
|
useCallback as useCallback10,
|
|
20724
20750
|
useContext as useContext7,
|
|
20725
20751
|
useDeferredValue as useDeferredValue2,
|
|
20726
|
-
useEffect as
|
|
20752
|
+
useEffect as useEffect18,
|
|
20727
20753
|
useMemo as useMemo6,
|
|
20728
|
-
useState as
|
|
20754
|
+
useState as useState17
|
|
20729
20755
|
} from "react";
|
|
20730
|
-
import { jsx as jsx119 } from "@emotion/react/jsx-runtime";
|
|
20731
|
-
var SearchAndFilterContext = createContext6({
|
|
20732
|
-
searchTerm: "",
|
|
20733
|
-
setSearchTerm: () => {
|
|
20734
|
-
},
|
|
20735
|
-
filterVisibility: void 0,
|
|
20736
|
-
setFilterVisibility: () => {
|
|
20737
|
-
},
|
|
20738
|
-
filters: [],
|
|
20739
|
-
setFilters: () => {
|
|
20740
|
-
},
|
|
20741
|
-
handleAddFilter: () => {
|
|
20742
|
-
},
|
|
20743
|
-
handleResetFilters: () => {
|
|
20744
|
-
},
|
|
20745
|
-
handleDeleteFilter: () => {
|
|
20746
|
-
},
|
|
20747
|
-
setSortBy: () => {
|
|
20748
|
-
},
|
|
20749
|
-
sortByValue: "",
|
|
20750
|
-
filterOptions: [],
|
|
20751
|
-
sortOptions: [],
|
|
20752
|
-
validFilterQuery: [],
|
|
20753
|
-
totalResults: 0
|
|
20754
|
-
});
|
|
20755
|
-
var SearchAndFilterProvider = ({
|
|
20756
|
-
filters,
|
|
20757
|
-
filterOptions,
|
|
20758
|
-
sortOptions,
|
|
20759
|
-
defaultSortByValue,
|
|
20760
|
-
filterMode: filterMode3 = void 0,
|
|
20761
|
-
onSearchChange,
|
|
20762
|
-
onChange,
|
|
20763
|
-
onSortChange,
|
|
20764
|
-
resetFilterValues = [],
|
|
20765
|
-
totalResults,
|
|
20766
|
-
children
|
|
20767
|
-
}) => {
|
|
20768
|
-
const [searchTerm, setSearchTerm] = useState16("");
|
|
20769
|
-
const deferredSearchTerm = useDeferredValue2(searchTerm);
|
|
20770
|
-
const [filterVisibility, setFilterVisibility] = useState16(filterMode3);
|
|
20771
|
-
const [sortByValue, setSortByValue] = useState16(defaultSortByValue);
|
|
20772
|
-
const handleSearchTerm = useCallback10(
|
|
20773
|
-
(term) => {
|
|
20774
|
-
setSearchTerm(term);
|
|
20775
|
-
onSearchChange == null ? void 0 : onSearchChange(term);
|
|
20776
|
-
},
|
|
20777
|
-
[setSearchTerm, onSearchChange]
|
|
20778
|
-
);
|
|
20779
|
-
const handleOnSortChange = useCallback10(
|
|
20780
|
-
(sort) => {
|
|
20781
|
-
setSortByValue(sort);
|
|
20782
|
-
onSortChange(sort);
|
|
20783
|
-
},
|
|
20784
|
-
[onSortChange]
|
|
20785
|
-
);
|
|
20786
|
-
const handleToggleFilterVisibilty = useCallback10(
|
|
20787
|
-
(mode) => setFilterVisibility(mode),
|
|
20788
|
-
[setFilterVisibility]
|
|
20789
|
-
);
|
|
20790
|
-
const handleAddFilter = useCallback10(() => {
|
|
20791
|
-
onChange([...filters, { field: "", operator: "", value: "" }]);
|
|
20792
|
-
}, [filters, onChange]);
|
|
20793
|
-
const handleResetFilters = useCallback10(() => {
|
|
20794
|
-
onChange(resetFilterValues);
|
|
20795
|
-
}, [onChange, resetFilterValues]);
|
|
20796
|
-
const handleDeleteFilter = useCallback10(
|
|
20797
|
-
(index) => {
|
|
20798
|
-
const remainingFilters = filters.filter((_, i) => i !== index);
|
|
20799
|
-
onChange(remainingFilters);
|
|
20800
|
-
},
|
|
20801
|
-
[filters, onChange]
|
|
20802
|
-
);
|
|
20803
|
-
const validFilterQuery = useMemo6(() => {
|
|
20804
|
-
const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
|
|
20805
|
-
if (hasValidFilters) {
|
|
20806
|
-
return filters;
|
|
20807
|
-
}
|
|
20808
|
-
}, [filters]);
|
|
20809
|
-
useEffect17(() => {
|
|
20810
|
-
if (filterVisibility) {
|
|
20811
|
-
const handleEscKeyFilterClose = (e) => {
|
|
20812
|
-
if (e.key === "Escape") {
|
|
20813
|
-
setFilterVisibility(void 0);
|
|
20814
|
-
}
|
|
20815
|
-
};
|
|
20816
|
-
document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
20817
|
-
return () => {
|
|
20818
|
-
document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
20819
|
-
};
|
|
20820
|
-
}
|
|
20821
|
-
}, [filterVisibility]);
|
|
20822
|
-
return /* @__PURE__ */ jsx119(
|
|
20823
|
-
SearchAndFilterContext.Provider,
|
|
20824
|
-
{
|
|
20825
|
-
value: {
|
|
20826
|
-
searchTerm: deferredSearchTerm,
|
|
20827
|
-
setSearchTerm: (e) => handleSearchTerm(e),
|
|
20828
|
-
setSortBy: (e) => handleOnSortChange(e),
|
|
20829
|
-
sortByValue,
|
|
20830
|
-
filterVisibility,
|
|
20831
|
-
setFilterVisibility: (e) => handleToggleFilterVisibilty(e),
|
|
20832
|
-
filters,
|
|
20833
|
-
setFilters: (e) => onChange(e),
|
|
20834
|
-
handleAddFilter,
|
|
20835
|
-
handleResetFilters,
|
|
20836
|
-
handleDeleteFilter,
|
|
20837
|
-
filterOptions,
|
|
20838
|
-
sortOptions,
|
|
20839
|
-
validFilterQuery,
|
|
20840
|
-
totalResults
|
|
20841
|
-
},
|
|
20842
|
-
children: /* @__PURE__ */ jsx119(VerticalRhythm, { children })
|
|
20843
|
-
}
|
|
20844
|
-
);
|
|
20845
|
-
};
|
|
20846
|
-
var useSearchAndFilter = () => {
|
|
20847
|
-
const value = useContext7(SearchAndFilterContext);
|
|
20848
|
-
return { ...value };
|
|
20849
|
-
};
|
|
20850
|
-
|
|
20851
|
-
// src/components/SearchAndFilter/FilterControls.tsx
|
|
20852
|
-
import { Fragment as Fragment19, jsx as jsx120, jsxs as jsxs81 } from "@emotion/react/jsx-runtime";
|
|
20853
|
-
var FilterControls = ({
|
|
20854
|
-
children,
|
|
20855
|
-
defaultSortByValue,
|
|
20856
|
-
hideSearchInput
|
|
20857
|
-
}) => {
|
|
20858
|
-
var _a, _b, _c;
|
|
20859
|
-
const {
|
|
20860
|
-
setFilterVisibility,
|
|
20861
|
-
filterVisibility,
|
|
20862
|
-
setSearchTerm,
|
|
20863
|
-
validFilterQuery,
|
|
20864
|
-
searchTerm,
|
|
20865
|
-
sortByValue,
|
|
20866
|
-
filterOptions
|
|
20867
|
-
} = useSearchAndFilter();
|
|
20868
|
-
const [initialSortValue, setInitialSortValue] = useState17(sortByValue);
|
|
20869
|
-
const [localeSearchTerm, setLocaleSearchTerm] = useState17("");
|
|
20870
|
-
const [userHasChangedSortByValue, setUserHasChangedSortByValue] = useState17(false);
|
|
20871
|
-
useDebounce2(
|
|
20872
|
-
() => {
|
|
20873
|
-
setSearchTerm(localeSearchTerm);
|
|
20874
|
-
},
|
|
20875
|
-
300,
|
|
20876
|
-
[localeSearchTerm, searchTerm]
|
|
20877
|
-
);
|
|
20878
|
-
useEffect18(() => {
|
|
20879
|
-
if (searchTerm === "") {
|
|
20880
|
-
setLocaleSearchTerm("");
|
|
20881
|
-
}
|
|
20882
|
-
}, [searchTerm]);
|
|
20883
|
-
const handleFilterToggle = (mode) => {
|
|
20884
|
-
if (filterVisibility === "filters" && mode === "filters" || filterVisibility === "sort" && mode === "sort") {
|
|
20885
|
-
return setFilterVisibility(void 0);
|
|
20886
|
-
}
|
|
20887
|
-
return setFilterVisibility(mode);
|
|
20888
|
-
};
|
|
20889
|
-
const sortValue = (sortByValue != null ? sortByValue : defaultSortByValue).split("_");
|
|
20890
|
-
const sortDirection = sortValue == null ? void 0 : sortValue.pop();
|
|
20891
|
-
const sortField = sortValue == null ? void 0 : sortValue.join("_");
|
|
20892
|
-
const sortOn = sortField.startsWith("fields.") ? "contentTypeFields" : "metadata";
|
|
20893
|
-
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;
|
|
20894
|
-
const sortByIcon = userHasChangedSortByValue ? sortDirection === "ASC" ? "arrow-up" : "arrow-down" : "sort-az";
|
|
20895
|
-
useEffectOnce(() => {
|
|
20896
|
-
setInitialSortValue(sortByValue);
|
|
20897
|
-
});
|
|
20898
|
-
useEffect18(() => {
|
|
20899
|
-
if (initialSortValue !== sortByValue) {
|
|
20900
|
-
setUserHasChangedSortByValue(true);
|
|
20901
|
-
}
|
|
20902
|
-
}, [initialSortValue, sortByValue]);
|
|
20903
|
-
return /* @__PURE__ */ jsxs81(Fragment19, { children: [
|
|
20904
|
-
/* @__PURE__ */ jsx120(
|
|
20905
|
-
FilterButton2,
|
|
20906
|
-
{
|
|
20907
|
-
"aria-controls": "search-and-filter-options",
|
|
20908
|
-
"aria-label": "filter options",
|
|
20909
|
-
"aria-haspopup": "true",
|
|
20910
|
-
"aria-expanded": filterVisibility === "filters",
|
|
20911
|
-
filterCount: validFilterQuery == null ? void 0 : validFilterQuery.length,
|
|
20912
|
-
onClick: () => handleFilterToggle("filters"),
|
|
20913
|
-
dataTestId: "filters-button"
|
|
20914
|
-
}
|
|
20915
|
-
),
|
|
20916
|
-
/* @__PURE__ */ jsx120(
|
|
20917
|
-
FilterButton2,
|
|
20918
|
-
{
|
|
20919
|
-
"aria-controls": "search-and-filter-sortBy",
|
|
20920
|
-
"aria-label": "sort by options",
|
|
20921
|
-
"aria-haspopup": "true",
|
|
20922
|
-
text: !userHasChangedSortByValue ? "Sort" : sortByValueLabel,
|
|
20923
|
-
icon: sortByIcon,
|
|
20924
|
-
"aria-expanded": filterVisibility === "sort",
|
|
20925
|
-
hasSelectedValue: sortByValue !== "",
|
|
20926
|
-
onClick: () => handleFilterToggle("sort"),
|
|
20927
|
-
dataTestId: "sort-by-button"
|
|
20928
|
-
}
|
|
20929
|
-
),
|
|
20930
|
-
hideSearchInput ? null : /* @__PURE__ */ jsx120(
|
|
20931
|
-
InputKeywordSearch,
|
|
20932
|
-
{
|
|
20933
|
-
placeholder: "Search...",
|
|
20934
|
-
onSearchTextChanged: (e) => setLocaleSearchTerm(e),
|
|
20935
|
-
value: localeSearchTerm,
|
|
20936
|
-
compact: true,
|
|
20937
|
-
rounded: true,
|
|
20938
|
-
css: SearchInput
|
|
20939
|
-
}
|
|
20940
|
-
),
|
|
20941
|
-
children
|
|
20942
|
-
] });
|
|
20943
|
-
};
|
|
20944
|
-
|
|
20945
|
-
// src/components/SearchAndFilter/FilterItem.tsx
|
|
20946
|
-
import { useMemo as useMemo7 } from "react";
|
|
20947
20756
|
|
|
20948
20757
|
// src/components/SearchAndFilter/FilterEditor.tsx
|
|
20949
|
-
import { useEffect as
|
|
20950
|
-
import { useDebounce as
|
|
20758
|
+
import { useEffect as useEffect17, useState as useState16 } from "react";
|
|
20759
|
+
import { useDebounce as useDebounce2 } from "react-use";
|
|
20951
20760
|
|
|
20952
20761
|
// src/components/Validation/StatusBullet.styles.ts
|
|
20953
20762
|
import { css as css93 } from "@emotion/react";
|
|
@@ -21029,7 +20838,7 @@ var StatusDeleted = css93`
|
|
|
21029
20838
|
`;
|
|
21030
20839
|
|
|
21031
20840
|
// src/components/Validation/StatusBullet.tsx
|
|
21032
|
-
import { jsx as
|
|
20841
|
+
import { jsx as jsx119 } from "@emotion/react/jsx-runtime";
|
|
21033
20842
|
var StatusBullet = ({
|
|
21034
20843
|
status,
|
|
21035
20844
|
hideText = false,
|
|
@@ -21049,7 +20858,7 @@ var StatusBullet = ({
|
|
|
21049
20858
|
Deleted: StatusDeleted
|
|
21050
20859
|
};
|
|
21051
20860
|
const statusSize = size === "base" ? StatusBulletBase : StatusBulletSmall;
|
|
21052
|
-
return /* @__PURE__ */
|
|
20861
|
+
return /* @__PURE__ */ jsx119(
|
|
21053
20862
|
"span",
|
|
21054
20863
|
{
|
|
21055
20864
|
role: "status",
|
|
@@ -21062,7 +20871,7 @@ var StatusBullet = ({
|
|
|
21062
20871
|
};
|
|
21063
20872
|
|
|
21064
20873
|
// src/components/SearchAndFilter/FilterEditor.tsx
|
|
21065
|
-
import { Fragment as
|
|
20874
|
+
import { Fragment as Fragment19, jsx as jsx120, jsxs as jsxs81 } from "@emotion/react/jsx-runtime";
|
|
21066
20875
|
var readOnlyAttributes = {
|
|
21067
20876
|
isSearchable: false,
|
|
21068
20877
|
menuIsOpen: false,
|
|
@@ -21071,13 +20880,13 @@ var readOnlyAttributes = {
|
|
|
21071
20880
|
var FilterMultiChoiceEditor = ({
|
|
21072
20881
|
value,
|
|
21073
20882
|
options,
|
|
21074
|
-
|
|
20883
|
+
disabled: disabled2,
|
|
21075
20884
|
readOnly,
|
|
21076
20885
|
valueTestId,
|
|
21077
20886
|
...props
|
|
21078
20887
|
}) => {
|
|
21079
20888
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
21080
|
-
return /* @__PURE__ */
|
|
20889
|
+
return /* @__PURE__ */ jsx120("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx120(
|
|
21081
20890
|
InputComboBox,
|
|
21082
20891
|
{
|
|
21083
20892
|
...props,
|
|
@@ -21085,12 +20894,12 @@ var FilterMultiChoiceEditor = ({
|
|
|
21085
20894
|
options,
|
|
21086
20895
|
isMulti: true,
|
|
21087
20896
|
isClearable: true,
|
|
21088
|
-
isDisabled,
|
|
20897
|
+
isDisabled: disabled2,
|
|
21089
20898
|
onChange: (e) => {
|
|
21090
20899
|
var _a;
|
|
21091
|
-
return props.onChange((_a = e.map((
|
|
20900
|
+
return props.onChange((_a = e == null ? void 0 : e.map((option) => option.value)) != null ? _a : []);
|
|
21092
20901
|
},
|
|
21093
|
-
value,
|
|
20902
|
+
value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
|
|
21094
20903
|
"aria-readonly": readOnly,
|
|
21095
20904
|
styles: {
|
|
21096
20905
|
menu(base) {
|
|
@@ -21107,13 +20916,13 @@ var FilterMultiChoiceEditor = ({
|
|
|
21107
20916
|
var FilterSingleChoiceEditor = ({
|
|
21108
20917
|
options,
|
|
21109
20918
|
value,
|
|
21110
|
-
|
|
20919
|
+
disabled: disabled2,
|
|
21111
20920
|
readOnly,
|
|
21112
20921
|
onChange,
|
|
21113
20922
|
valueTestId
|
|
21114
20923
|
}) => {
|
|
21115
20924
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
21116
|
-
return /* @__PURE__ */
|
|
20925
|
+
return /* @__PURE__ */ jsx120("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx120(
|
|
21117
20926
|
InputComboBox,
|
|
21118
20927
|
{
|
|
21119
20928
|
placeholder: "Type to search...",
|
|
@@ -21123,8 +20932,8 @@ var FilterSingleChoiceEditor = ({
|
|
|
21123
20932
|
var _a;
|
|
21124
20933
|
return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
|
|
21125
20934
|
},
|
|
21126
|
-
isDisabled,
|
|
21127
|
-
value,
|
|
20935
|
+
isDisabled: disabled2,
|
|
20936
|
+
value: options == null ? void 0 : options.find((option) => option.value === value),
|
|
21128
20937
|
"aria-readonly": readOnly,
|
|
21129
20938
|
styles: {
|
|
21130
20939
|
menu(base) {
|
|
@@ -21139,18 +20948,18 @@ var FilterSingleChoiceEditor = ({
|
|
|
21139
20948
|
) });
|
|
21140
20949
|
};
|
|
21141
20950
|
var CustomOptions = ({ label, value }) => {
|
|
21142
|
-
return /* @__PURE__ */
|
|
20951
|
+
return /* @__PURE__ */ jsx120(StatusBullet, { status: label, message: value });
|
|
21143
20952
|
};
|
|
21144
20953
|
var StatusMultiEditor = ({
|
|
21145
20954
|
options,
|
|
21146
20955
|
value,
|
|
21147
|
-
|
|
20956
|
+
disabled: disabled2,
|
|
21148
20957
|
readOnly,
|
|
21149
20958
|
onChange,
|
|
21150
20959
|
valueTestId
|
|
21151
20960
|
}) => {
|
|
21152
20961
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
21153
|
-
return /* @__PURE__ */
|
|
20962
|
+
return /* @__PURE__ */ jsx120("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx120(
|
|
21154
20963
|
InputComboBox,
|
|
21155
20964
|
{
|
|
21156
20965
|
options,
|
|
@@ -21160,8 +20969,9 @@ var StatusMultiEditor = ({
|
|
|
21160
20969
|
return onChange((_a = e.map((item) => item.value)) != null ? _a : []);
|
|
21161
20970
|
},
|
|
21162
20971
|
formatOptionLabel: CustomOptions,
|
|
21163
|
-
|
|
21164
|
-
|
|
20972
|
+
"aria-readonly": readOnly,
|
|
20973
|
+
value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
|
|
20974
|
+
isDisabled: disabled2,
|
|
21165
20975
|
styles: {
|
|
21166
20976
|
menu(base) {
|
|
21167
20977
|
return {
|
|
@@ -21177,13 +20987,13 @@ var StatusMultiEditor = ({
|
|
|
21177
20987
|
var StatusSingleEditor = ({
|
|
21178
20988
|
options,
|
|
21179
20989
|
value,
|
|
21180
|
-
|
|
20990
|
+
disabled: disabled2,
|
|
21181
20991
|
readOnly,
|
|
21182
20992
|
onChange,
|
|
21183
20993
|
valueTestId
|
|
21184
20994
|
}) => {
|
|
21185
20995
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
21186
|
-
return /* @__PURE__ */
|
|
20996
|
+
return /* @__PURE__ */ jsx120("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx120(
|
|
21187
20997
|
InputComboBox,
|
|
21188
20998
|
{
|
|
21189
20999
|
options,
|
|
@@ -21192,8 +21002,9 @@ var StatusSingleEditor = ({
|
|
|
21192
21002
|
return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
|
|
21193
21003
|
},
|
|
21194
21004
|
formatOptionLabel: CustomOptions,
|
|
21195
|
-
|
|
21196
|
-
|
|
21005
|
+
"aria-readonly": readOnly,
|
|
21006
|
+
value: options == null ? void 0 : options.find((option) => option.value === value),
|
|
21007
|
+
isDisabled: disabled2,
|
|
21197
21008
|
styles: {
|
|
21198
21009
|
menu(base) {
|
|
21199
21010
|
return {
|
|
@@ -21206,9 +21017,15 @@ var StatusSingleEditor = ({
|
|
|
21206
21017
|
}
|
|
21207
21018
|
) });
|
|
21208
21019
|
};
|
|
21209
|
-
var TextEditor = ({
|
|
21210
|
-
|
|
21211
|
-
|
|
21020
|
+
var TextEditor = ({
|
|
21021
|
+
onChange,
|
|
21022
|
+
ariaLabel,
|
|
21023
|
+
value,
|
|
21024
|
+
readOnly,
|
|
21025
|
+
valueTestId
|
|
21026
|
+
}) => {
|
|
21027
|
+
useDebounce2(() => onChange, 500, [value]);
|
|
21028
|
+
return /* @__PURE__ */ jsx120(
|
|
21212
21029
|
Input,
|
|
21213
21030
|
{
|
|
21214
21031
|
showLabel: false,
|
|
@@ -21229,10 +21046,10 @@ var NumberRangeEditor = ({
|
|
|
21229
21046
|
readOnly,
|
|
21230
21047
|
valueTestId
|
|
21231
21048
|
}) => {
|
|
21232
|
-
const [minValue, setMinValue] =
|
|
21233
|
-
const [maxValue, setMaxValue] =
|
|
21234
|
-
const [error, setError] =
|
|
21235
|
-
|
|
21049
|
+
const [minValue, setMinValue] = useState16("");
|
|
21050
|
+
const [maxValue, setMaxValue] = useState16("");
|
|
21051
|
+
const [error, setError] = useState16("");
|
|
21052
|
+
useEffect17(() => {
|
|
21236
21053
|
if (!maxValue && !minValue) {
|
|
21237
21054
|
return;
|
|
21238
21055
|
}
|
|
@@ -21251,9 +21068,9 @@ var NumberRangeEditor = ({
|
|
|
21251
21068
|
setError("");
|
|
21252
21069
|
onChange([minValue, maxValue]);
|
|
21253
21070
|
}, [maxValue, minValue, setError]);
|
|
21254
|
-
return /* @__PURE__ */
|
|
21255
|
-
/* @__PURE__ */
|
|
21256
|
-
/* @__PURE__ */
|
|
21071
|
+
return /* @__PURE__ */ jsxs81(Fragment19, { children: [
|
|
21072
|
+
/* @__PURE__ */ jsxs81("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
21073
|
+
/* @__PURE__ */ jsx120(
|
|
21257
21074
|
Input,
|
|
21258
21075
|
{
|
|
21259
21076
|
label: `${ariaLabel}-min`,
|
|
@@ -21268,7 +21085,7 @@ var NumberRangeEditor = ({
|
|
|
21268
21085
|
readOnly
|
|
21269
21086
|
}
|
|
21270
21087
|
),
|
|
21271
|
-
/* @__PURE__ */
|
|
21088
|
+
/* @__PURE__ */ jsx120(
|
|
21272
21089
|
Input,
|
|
21273
21090
|
{
|
|
21274
21091
|
type: "number",
|
|
@@ -21284,7 +21101,7 @@ var NumberRangeEditor = ({
|
|
|
21284
21101
|
}
|
|
21285
21102
|
)
|
|
21286
21103
|
] }),
|
|
21287
|
-
/* @__PURE__ */
|
|
21104
|
+
/* @__PURE__ */ jsx120(ErrorContainer, { errorMessage: error })
|
|
21288
21105
|
] });
|
|
21289
21106
|
};
|
|
21290
21107
|
var NumberEditor = ({
|
|
@@ -21295,7 +21112,7 @@ var NumberEditor = ({
|
|
|
21295
21112
|
readOnly,
|
|
21296
21113
|
valueTestId
|
|
21297
21114
|
}) => {
|
|
21298
|
-
return /* @__PURE__ */
|
|
21115
|
+
return /* @__PURE__ */ jsx120(
|
|
21299
21116
|
Input,
|
|
21300
21117
|
{
|
|
21301
21118
|
label: ariaLabel,
|
|
@@ -21318,7 +21135,7 @@ var DateEditor = ({
|
|
|
21318
21135
|
readOnly,
|
|
21319
21136
|
valueTestId
|
|
21320
21137
|
}) => {
|
|
21321
|
-
return /* @__PURE__ */
|
|
21138
|
+
return /* @__PURE__ */ jsx120(
|
|
21322
21139
|
Input,
|
|
21323
21140
|
{
|
|
21324
21141
|
type: "date",
|
|
@@ -21340,10 +21157,10 @@ var DateRangeEditor = ({
|
|
|
21340
21157
|
readOnly,
|
|
21341
21158
|
valueTestId
|
|
21342
21159
|
}) => {
|
|
21343
|
-
const [minDateValue, setMinDateValue] =
|
|
21344
|
-
const [maxDateValue, setMaxDateValue] =
|
|
21345
|
-
const [error, setError] =
|
|
21346
|
-
|
|
21160
|
+
const [minDateValue, setMinDateValue] = useState16(value ? value[0] : "");
|
|
21161
|
+
const [maxDateValue, setMaxDateValue] = useState16(value ? value[1] : "");
|
|
21162
|
+
const [error, setError] = useState16("");
|
|
21163
|
+
useEffect17(() => {
|
|
21347
21164
|
if (!minDateValue || !maxDateValue) {
|
|
21348
21165
|
return;
|
|
21349
21166
|
}
|
|
@@ -21374,9 +21191,9 @@ var DateRangeEditor = ({
|
|
|
21374
21191
|
setError("");
|
|
21375
21192
|
onChange([minDateValue, maxDateValue]);
|
|
21376
21193
|
}, [minDateValue, maxDateValue, setError]);
|
|
21377
|
-
return /* @__PURE__ */
|
|
21378
|
-
/* @__PURE__ */
|
|
21379
|
-
/* @__PURE__ */
|
|
21194
|
+
return /* @__PURE__ */ jsxs81(Fragment19, { children: [
|
|
21195
|
+
/* @__PURE__ */ jsxs81("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
21196
|
+
/* @__PURE__ */ jsx120(
|
|
21380
21197
|
Input,
|
|
21381
21198
|
{
|
|
21382
21199
|
label: `${ariaLabel}-min-date`,
|
|
@@ -21389,7 +21206,7 @@ var DateRangeEditor = ({
|
|
|
21389
21206
|
readOnly
|
|
21390
21207
|
}
|
|
21391
21208
|
),
|
|
21392
|
-
/* @__PURE__ */
|
|
21209
|
+
/* @__PURE__ */ jsx120(
|
|
21393
21210
|
Input,
|
|
21394
21211
|
{
|
|
21395
21212
|
label: `${ariaLabel}-max-date`,
|
|
@@ -21403,18 +21220,19 @@ var DateRangeEditor = ({
|
|
|
21403
21220
|
}
|
|
21404
21221
|
)
|
|
21405
21222
|
] }),
|
|
21406
|
-
/* @__PURE__ */
|
|
21223
|
+
/* @__PURE__ */ jsx120(ErrorContainer, { errorMessage: error })
|
|
21407
21224
|
] });
|
|
21408
21225
|
};
|
|
21409
21226
|
var FilterEditorRenderer = ({ editorType, ...props }) => {
|
|
21410
|
-
const
|
|
21227
|
+
const { filterMapper: contextFilterMapper } = useSearchAndFilter();
|
|
21228
|
+
const Editor = contextFilterMapper == null ? void 0 : contextFilterMapper[editorType];
|
|
21411
21229
|
if (!Editor) {
|
|
21412
21230
|
return null;
|
|
21413
21231
|
}
|
|
21414
21232
|
if (editorType === "empty") {
|
|
21415
21233
|
return null;
|
|
21416
21234
|
}
|
|
21417
|
-
return /* @__PURE__ */
|
|
21235
|
+
return /* @__PURE__ */ jsx120(Editor, { ...props });
|
|
21418
21236
|
};
|
|
21419
21237
|
var filterMapper = {
|
|
21420
21238
|
multiChoice: FilterMultiChoiceEditor,
|
|
@@ -21429,14 +21247,14 @@ var filterMapper = {
|
|
|
21429
21247
|
empty: null
|
|
21430
21248
|
};
|
|
21431
21249
|
var ErrorContainer = ({ errorMessage }) => {
|
|
21432
|
-
return /* @__PURE__ */
|
|
21250
|
+
return /* @__PURE__ */ jsx120(
|
|
21433
21251
|
"div",
|
|
21434
21252
|
{
|
|
21435
21253
|
css: {
|
|
21436
21254
|
gridColumn: "span 6",
|
|
21437
21255
|
order: 6
|
|
21438
21256
|
},
|
|
21439
|
-
children: /* @__PURE__ */
|
|
21257
|
+
children: /* @__PURE__ */ jsx120(FieldMessage, { errorMessage })
|
|
21440
21258
|
}
|
|
21441
21259
|
);
|
|
21442
21260
|
};
|
|
@@ -21446,283 +21264,266 @@ var twoColumnGrid = {
|
|
|
21446
21264
|
gap: "var(--spacing-sm);"
|
|
21447
21265
|
};
|
|
21448
21266
|
|
|
21449
|
-
// src/components/SearchAndFilter/
|
|
21450
|
-
import
|
|
21451
|
-
|
|
21452
|
-
|
|
21453
|
-
|
|
21454
|
-
|
|
21455
|
-
|
|
21456
|
-
|
|
21457
|
-
|
|
21458
|
-
|
|
21459
|
-
|
|
21460
|
-
|
|
21461
|
-
|
|
21462
|
-
|
|
21463
|
-
|
|
21464
|
-
|
|
21465
|
-
|
|
21466
|
-
|
|
21467
|
-
|
|
21468
|
-
|
|
21469
|
-
|
|
21470
|
-
|
|
21471
|
-
|
|
21472
|
-
|
|
21473
|
-
|
|
21474
|
-
|
|
21475
|
-
|
|
21267
|
+
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
21268
|
+
import { jsx as jsx121 } from "@emotion/react/jsx-runtime";
|
|
21269
|
+
var SearchAndFilterContext = createContext6({
|
|
21270
|
+
searchTerm: "",
|
|
21271
|
+
setSearchTerm: () => {
|
|
21272
|
+
},
|
|
21273
|
+
filterVisibility: void 0,
|
|
21274
|
+
setFilterVisibility: () => {
|
|
21275
|
+
},
|
|
21276
|
+
filters: [],
|
|
21277
|
+
setFilters: () => {
|
|
21278
|
+
},
|
|
21279
|
+
handleAddFilter: () => {
|
|
21280
|
+
},
|
|
21281
|
+
handleResetFilters: () => {
|
|
21282
|
+
},
|
|
21283
|
+
handleDeleteFilter: () => {
|
|
21284
|
+
},
|
|
21285
|
+
handleLocaleChange: () => {
|
|
21286
|
+
},
|
|
21287
|
+
setSortBy: () => {
|
|
21288
|
+
},
|
|
21289
|
+
sortByValue: "",
|
|
21290
|
+
filterOptions: [],
|
|
21291
|
+
sortOptions: [],
|
|
21292
|
+
validFilterQuery: [],
|
|
21293
|
+
filterMapper: {},
|
|
21294
|
+
totalResults: 0,
|
|
21295
|
+
localeOptions: [],
|
|
21296
|
+
localeValue: ""
|
|
21297
|
+
});
|
|
21298
|
+
var SearchAndFilterProvider = ({
|
|
21299
|
+
filters,
|
|
21300
|
+
filterOptions,
|
|
21301
|
+
sortOptions,
|
|
21302
|
+
defaultSortByValue,
|
|
21303
|
+
defaultLocale = "",
|
|
21304
|
+
localeOptions,
|
|
21305
|
+
onLocaleChange,
|
|
21306
|
+
filterVisible = false,
|
|
21307
|
+
onSearchChange,
|
|
21308
|
+
onChange,
|
|
21309
|
+
onSortChange,
|
|
21310
|
+
resetFilterValues = [{ field: "", operator: "", value: "" }],
|
|
21311
|
+
totalResults,
|
|
21312
|
+
filterMapper: filterMapper2 = filterMapper,
|
|
21313
|
+
children
|
|
21476
21314
|
}) => {
|
|
21477
|
-
const
|
|
21478
|
-
const
|
|
21479
|
-
|
|
21480
|
-
|
|
21315
|
+
const [searchTerm, setSearchTerm] = useState17("");
|
|
21316
|
+
const deferredSearchTerm = useDeferredValue2(searchTerm);
|
|
21317
|
+
const [filterVisibility, setFilterVisibility] = useState17(filterVisible);
|
|
21318
|
+
const [sortByValue, setSortByValue] = useState17(defaultSortByValue);
|
|
21319
|
+
const [localeValue, setLocale] = useState17(defaultLocale);
|
|
21320
|
+
const handleSearchTerm = useCallback10(
|
|
21321
|
+
(term) => {
|
|
21322
|
+
setSearchTerm(term);
|
|
21323
|
+
onSearchChange == null ? void 0 : onSearchChange(term);
|
|
21324
|
+
},
|
|
21325
|
+
[setSearchTerm, onSearchChange]
|
|
21326
|
+
);
|
|
21327
|
+
const handleLocaleChange = useCallback10(
|
|
21328
|
+
(locale) => {
|
|
21329
|
+
setLocale(locale);
|
|
21330
|
+
onLocaleChange == null ? void 0 : onLocaleChange(locale);
|
|
21331
|
+
},
|
|
21332
|
+
[onLocaleChange]
|
|
21333
|
+
);
|
|
21334
|
+
const handleOnSortChange = useCallback10(
|
|
21335
|
+
(sort) => {
|
|
21336
|
+
setSortByValue(sort);
|
|
21337
|
+
onSortChange(sort);
|
|
21338
|
+
},
|
|
21339
|
+
[onSortChange]
|
|
21340
|
+
);
|
|
21341
|
+
const handleToggleFilterVisibilty = useCallback10(
|
|
21342
|
+
(visible) => setFilterVisibility(visible),
|
|
21343
|
+
[setFilterVisibility]
|
|
21344
|
+
);
|
|
21345
|
+
const handleAddFilter = useCallback10(() => {
|
|
21346
|
+
onChange([...filters, { field: "", operator: "", value: "" }]);
|
|
21347
|
+
}, [filters, onChange]);
|
|
21348
|
+
const handleResetFilters = useCallback10(() => {
|
|
21349
|
+
onChange(resetFilterValues);
|
|
21350
|
+
}, [onChange, resetFilterValues]);
|
|
21351
|
+
const handleDeleteFilter = useCallback10(
|
|
21352
|
+
(index) => {
|
|
21353
|
+
const remainingFilters = filters.filter((_, i) => i !== index);
|
|
21354
|
+
onChange(remainingFilters);
|
|
21355
|
+
},
|
|
21356
|
+
[filters, onChange]
|
|
21357
|
+
);
|
|
21358
|
+
const validFilterQuery = useMemo6(() => {
|
|
21359
|
+
const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
|
|
21360
|
+
if (hasValidFilters) {
|
|
21361
|
+
return filters;
|
|
21362
|
+
}
|
|
21363
|
+
}, [filters]);
|
|
21364
|
+
useEffect18(() => {
|
|
21481
21365
|
if (filterVisibility) {
|
|
21482
|
-
|
|
21366
|
+
const handleEscKeyFilterClose = (e) => {
|
|
21367
|
+
if (e.key === "Escape") {
|
|
21368
|
+
setFilterVisibility(false);
|
|
21369
|
+
}
|
|
21370
|
+
};
|
|
21371
|
+
document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
21372
|
+
return () => {
|
|
21373
|
+
document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
21374
|
+
};
|
|
21483
21375
|
}
|
|
21484
21376
|
}, [filterVisibility]);
|
|
21485
|
-
return /* @__PURE__ */
|
|
21486
|
-
|
|
21487
|
-
|
|
21488
|
-
|
|
21377
|
+
return /* @__PURE__ */ jsx121(
|
|
21378
|
+
SearchAndFilterContext.Provider,
|
|
21379
|
+
{
|
|
21380
|
+
value: {
|
|
21381
|
+
searchTerm: deferredSearchTerm,
|
|
21382
|
+
setSearchTerm: (e) => handleSearchTerm(e),
|
|
21383
|
+
setSortBy: (e) => handleOnSortChange(e),
|
|
21384
|
+
sortByValue,
|
|
21385
|
+
filterVisibility,
|
|
21386
|
+
setFilterVisibility: (e) => handleToggleFilterVisibilty(e),
|
|
21387
|
+
filters,
|
|
21388
|
+
setFilters: (e) => onChange(e),
|
|
21389
|
+
handleAddFilter,
|
|
21390
|
+
handleResetFilters,
|
|
21391
|
+
handleDeleteFilter,
|
|
21392
|
+
filterOptions,
|
|
21393
|
+
sortOptions,
|
|
21394
|
+
validFilterQuery,
|
|
21395
|
+
totalResults,
|
|
21396
|
+
localeOptions,
|
|
21397
|
+
localeValue,
|
|
21398
|
+
handleLocaleChange,
|
|
21399
|
+
filterMapper: filterMapper2
|
|
21400
|
+
},
|
|
21401
|
+
children: /* @__PURE__ */ jsx121(VerticalRhythm, { children })
|
|
21402
|
+
}
|
|
21403
|
+
);
|
|
21404
|
+
};
|
|
21405
|
+
var useSearchAndFilter = () => {
|
|
21406
|
+
const value = useContext7(SearchAndFilterContext);
|
|
21407
|
+
return { ...value };
|
|
21408
|
+
};
|
|
21409
|
+
|
|
21410
|
+
// src/components/SearchAndFilter/FilterControls.tsx
|
|
21411
|
+
import { Fragment as Fragment20, jsx as jsx122, jsxs as jsxs82 } from "@emotion/react/jsx-runtime";
|
|
21412
|
+
var FilterControls = ({
|
|
21413
|
+
children,
|
|
21414
|
+
hideSearchInput
|
|
21415
|
+
}) => {
|
|
21416
|
+
const { setFilterVisibility, filterVisibility, setSearchTerm, validFilterQuery, searchTerm } = useSearchAndFilter();
|
|
21417
|
+
const [localeSearchTerm, setLocaleSearchTerm] = useState18("");
|
|
21418
|
+
useDebounce3(
|
|
21419
|
+
() => {
|
|
21420
|
+
setSearchTerm(localeSearchTerm);
|
|
21421
|
+
},
|
|
21422
|
+
300,
|
|
21423
|
+
[localeSearchTerm, searchTerm]
|
|
21424
|
+
);
|
|
21425
|
+
useEffect19(() => {
|
|
21426
|
+
if (searchTerm === "") {
|
|
21427
|
+
setLocaleSearchTerm("");
|
|
21428
|
+
}
|
|
21429
|
+
}, [searchTerm]);
|
|
21430
|
+
return /* @__PURE__ */ jsxs82(Fragment20, { children: [
|
|
21431
|
+
/* @__PURE__ */ jsx122(
|
|
21432
|
+
FilterButton2,
|
|
21489
21433
|
{
|
|
21490
|
-
|
|
21491
|
-
"aria-label": "
|
|
21492
|
-
|
|
21493
|
-
|
|
21494
|
-
"
|
|
21495
|
-
|
|
21434
|
+
"aria-controls": "search-and-filter-options",
|
|
21435
|
+
"aria-label": "filter options",
|
|
21436
|
+
"aria-haspopup": "true",
|
|
21437
|
+
text: "Filter/Sort",
|
|
21438
|
+
"aria-expanded": filterVisibility === true,
|
|
21439
|
+
filterCount: validFilterQuery == null ? void 0 : validFilterQuery.length,
|
|
21440
|
+
onClick: () => setFilterVisibility(!filterVisibility),
|
|
21441
|
+
dataTestId: "filters-button"
|
|
21442
|
+
}
|
|
21443
|
+
),
|
|
21444
|
+
hideSearchInput ? null : /* @__PURE__ */ jsx122(
|
|
21445
|
+
InputKeywordSearch,
|
|
21446
|
+
{
|
|
21447
|
+
placeholder: "Search...",
|
|
21448
|
+
onSearchTextChanged: (e) => setLocaleSearchTerm(e),
|
|
21449
|
+
value: localeSearchTerm,
|
|
21450
|
+
compact: true,
|
|
21451
|
+
rounded: true,
|
|
21452
|
+
css: SearchInput
|
|
21496
21453
|
}
|
|
21497
21454
|
),
|
|
21498
21455
|
children
|
|
21499
|
-
] })
|
|
21456
|
+
] });
|
|
21500
21457
|
};
|
|
21501
21458
|
|
|
21502
21459
|
// src/components/SearchAndFilter/FilterItem.tsx
|
|
21503
|
-
import {
|
|
21504
|
-
|
|
21505
|
-
|
|
21506
|
-
|
|
21507
|
-
|
|
21508
|
-
|
|
21509
|
-
|
|
21510
|
-
|
|
21511
|
-
|
|
21512
|
-
}) => {
|
|
21513
|
-
var _a, _b;
|
|
21514
|
-
const { filters, handleDeleteFilter, filterOptions } = useSearchAndFilter();
|
|
21515
|
-
const label = filters[index].field !== "" ? filters[index].field : "unknown filter field";
|
|
21516
|
-
const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
|
|
21517
|
-
const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
|
|
21518
|
-
const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
|
|
21519
|
-
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly } = useMemo7(() => {
|
|
21520
|
-
var _a2;
|
|
21521
|
-
const currentSelectedFilter = filterOptions.find((item) => {
|
|
21522
|
-
var _a3;
|
|
21523
|
-
return (_a3 = item.options) == null ? void 0 : _a3.find((op) => op.value === filters[index].field);
|
|
21524
|
-
});
|
|
21525
|
-
const selectedFieldValue2 = (_a2 = currentSelectedFilter == null ? void 0 : currentSelectedFilter.options) == null ? void 0 : _a2.find((item) => {
|
|
21526
|
-
return filters[index].field === item.value;
|
|
21527
|
-
});
|
|
21528
|
-
const isCurrentFieldReadOnly = selectedFieldValue2 == null ? void 0 : selectedFieldValue2.readOnly;
|
|
21529
|
-
const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
|
|
21530
|
-
return filters[index].operator === item.value;
|
|
21531
|
-
});
|
|
21532
|
-
const selectedMetaValue2 = valueOptions.filter((item) => {
|
|
21533
|
-
if (Array.isArray(filters[index].value) && item.value) {
|
|
21534
|
-
return filters[index].value.includes(item.value);
|
|
21535
|
-
}
|
|
21536
|
-
return filters[index].value === item.value;
|
|
21537
|
-
});
|
|
21538
|
-
return {
|
|
21539
|
-
selectedFieldValue: selectedFieldValue2,
|
|
21540
|
-
selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
|
|
21541
|
-
selectedMetaValue: selectedMetaValue2.length > 0 ? selectedMetaValue2 : filters[index].value,
|
|
21542
|
-
readOnly: isCurrentFieldReadOnly
|
|
21543
|
-
};
|
|
21544
|
-
}, [filters, filterOptions, index, operatorOptions, valueOptions]);
|
|
21545
|
-
const readOnlyProps = readOnly ? {
|
|
21546
|
-
"aria-readonly": true,
|
|
21547
|
-
isSearchable: false,
|
|
21548
|
-
menuIsOpen: false,
|
|
21549
|
-
isClearable: false
|
|
21550
|
-
} : {};
|
|
21551
|
-
return /* @__PURE__ */ jsxs84("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
|
|
21552
|
-
/* @__PURE__ */ jsx124("span", { children: index === 0 ? "Where" : "and" }),
|
|
21553
|
-
/* @__PURE__ */ jsxs84("div", { css: ConditionalInputRow, children: [
|
|
21554
|
-
/* @__PURE__ */ jsx124(
|
|
21555
|
-
InputComboBox,
|
|
21556
|
-
{
|
|
21557
|
-
"aria-label": label,
|
|
21558
|
-
options: paramOptions,
|
|
21559
|
-
onChange: (e) => {
|
|
21560
|
-
var _a2;
|
|
21561
|
-
onParamChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
|
|
21562
|
-
},
|
|
21563
|
-
isOptionDisabled: (option) => {
|
|
21564
|
-
var _a2;
|
|
21565
|
-
return (_a2 = option == null ? void 0 : option.disabled) != null ? _a2 : false;
|
|
21566
|
-
},
|
|
21567
|
-
styles: {
|
|
21568
|
-
menu(base) {
|
|
21569
|
-
return {
|
|
21570
|
-
...base,
|
|
21571
|
-
minWidth: "max-content"
|
|
21572
|
-
};
|
|
21573
|
-
}
|
|
21574
|
-
},
|
|
21575
|
-
value: selectedFieldValue,
|
|
21576
|
-
...readOnlyProps,
|
|
21577
|
-
id: "filter-field"
|
|
21578
|
-
}
|
|
21579
|
-
),
|
|
21580
|
-
/* @__PURE__ */ jsx124(
|
|
21581
|
-
InputComboBox,
|
|
21582
|
-
{
|
|
21583
|
-
"aria-label": operatorLabel,
|
|
21584
|
-
options: operatorOptions,
|
|
21585
|
-
onChange: (e) => {
|
|
21586
|
-
var _a2;
|
|
21587
|
-
return onOperatorChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
|
|
21588
|
-
},
|
|
21589
|
-
isDisabled: !filters[index].field,
|
|
21590
|
-
value: selectedOperatorValue,
|
|
21591
|
-
styles: {
|
|
21592
|
-
menu(base) {
|
|
21593
|
-
return {
|
|
21594
|
-
...base,
|
|
21595
|
-
minWidth: "max-content"
|
|
21596
|
-
};
|
|
21597
|
-
}
|
|
21598
|
-
},
|
|
21599
|
-
...readOnlyProps,
|
|
21600
|
-
id: "filter-operator"
|
|
21601
|
-
}
|
|
21602
|
-
),
|
|
21603
|
-
/* @__PURE__ */ jsx124(
|
|
21604
|
-
FilterEditorRenderer,
|
|
21605
|
-
{
|
|
21606
|
-
"aria-label": metaDataLabel,
|
|
21607
|
-
editorType: metaDataPossibleOptions,
|
|
21608
|
-
options: valueOptions,
|
|
21609
|
-
onChange: (e) => onValueChange(e != null ? e : ""),
|
|
21610
|
-
readOnly,
|
|
21611
|
-
isDisabled: !filters[index].operator,
|
|
21612
|
-
value: selectedMetaValue,
|
|
21613
|
-
valueTestId: "filter-value"
|
|
21614
|
-
}
|
|
21615
|
-
),
|
|
21616
|
-
readOnly ? null : /* @__PURE__ */ jsx124(
|
|
21617
|
-
"button",
|
|
21618
|
-
{
|
|
21619
|
-
type: "button",
|
|
21620
|
-
onClick: () => handleDeleteFilter(index),
|
|
21621
|
-
"aria-label": "delete filter",
|
|
21622
|
-
css: IconBtn,
|
|
21623
|
-
"data-testid": "delete-filter",
|
|
21624
|
-
children: /* @__PURE__ */ jsx124(Icon, { icon: "trash", iconColor: "red", size: "1rem" })
|
|
21625
|
-
}
|
|
21626
|
-
)
|
|
21627
|
-
] })
|
|
21628
|
-
] });
|
|
21629
|
-
};
|
|
21630
|
-
var FilterItems = ({
|
|
21631
|
-
addButtonText = "add condition",
|
|
21632
|
-
resetButtonText = "reset filters"
|
|
21460
|
+
import { useMemo as useMemo8 } from "react";
|
|
21461
|
+
|
|
21462
|
+
// src/components/SearchAndFilter/FilterMenu.tsx
|
|
21463
|
+
import React24, { useEffect as useEffect20 } from "react";
|
|
21464
|
+
import { jsx as jsx123, jsxs as jsxs83 } from "@emotion/react/jsx-runtime";
|
|
21465
|
+
var SearchAndFilterOptionsContainer2 = ({
|
|
21466
|
+
buttonRow,
|
|
21467
|
+
sortControls,
|
|
21468
|
+
children
|
|
21633
21469
|
}) => {
|
|
21634
|
-
|
|
21635
|
-
|
|
21636
|
-
|
|
21637
|
-
|
|
21638
|
-
|
|
21639
|
-
|
|
21640
|
-
|
|
21641
|
-
|
|
21642
|
-
|
|
21643
|
-
|
|
21644
|
-
|
|
21645
|
-
|
|
21646
|
-
|
|
21647
|
-
|
|
21648
|
-
|
|
21649
|
-
|
|
21650
|
-
|
|
21651
|
-
|
|
21652
|
-
|
|
21653
|
-
|
|
21654
|
-
|
|
21655
|
-
|
|
21656
|
-
|
|
21657
|
-
|
|
21658
|
-
|
|
21659
|
-
|
|
21660
|
-
|
|
21661
|
-
|
|
21662
|
-
|
|
21663
|
-
|
|
21664
|
-
FilterMenu,
|
|
21665
|
-
{
|
|
21666
|
-
id: "search-and-filter-options",
|
|
21667
|
-
dataTestId: "search-and-filter-options",
|
|
21668
|
-
menuControls: /* @__PURE__ */ jsxs84(Fragment21, { children: [
|
|
21669
|
-
/* @__PURE__ */ jsxs84(
|
|
21670
|
-
"button",
|
|
21671
|
-
{
|
|
21672
|
-
type: "button",
|
|
21673
|
-
css: AddConditionalBtn,
|
|
21674
|
-
onClick: handleAddFilter,
|
|
21675
|
-
"data-testid": "add-filter",
|
|
21676
|
-
children: [
|
|
21677
|
-
/* @__PURE__ */ jsx124(Icon, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
|
|
21678
|
-
addButtonText
|
|
21679
|
-
]
|
|
21680
|
-
}
|
|
21681
|
-
),
|
|
21682
|
-
(filters == null ? void 0 : filters.length) ? /* @__PURE__ */ jsx124(
|
|
21683
|
-
"button",
|
|
21684
|
-
{
|
|
21685
|
-
type: "button",
|
|
21686
|
-
css: ResetConditionsBtn,
|
|
21687
|
-
onClick: () => {
|
|
21688
|
-
handleResetFilters();
|
|
21689
|
-
setFilterVisibility(void 0);
|
|
21690
|
-
},
|
|
21691
|
-
"data-testid": "reset-filters",
|
|
21692
|
-
children: resetButtonText
|
|
21693
|
-
}
|
|
21694
|
-
) : null
|
|
21695
|
-
] }),
|
|
21696
|
-
children: filters.map((item, i) => {
|
|
21697
|
-
var _a, _b, _c, _d, _e, _f;
|
|
21698
|
-
const availableTypeOptions = (_b = (_a = filterOptions.find((fo) => {
|
|
21699
|
-
var _a2;
|
|
21700
|
-
return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === item.field);
|
|
21701
|
-
})) == null ? void 0 : _a.options) != null ? _b : [];
|
|
21702
|
-
const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
|
|
21703
|
-
const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
|
|
21704
|
-
return /* @__PURE__ */ jsx124(
|
|
21705
|
-
FilterItem,
|
|
21706
|
-
{
|
|
21707
|
-
index: i,
|
|
21708
|
-
paramOptions: filterOptions,
|
|
21709
|
-
onParamChange: (e) => handleUpdateFilter(i, "field", e),
|
|
21710
|
-
operatorOptions: possibleOperators,
|
|
21711
|
-
onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
|
|
21712
|
-
onValueChange: (e) => handleUpdateFilter(i, "value", e),
|
|
21713
|
-
valueOptions: possibleValueOptions
|
|
21714
|
-
},
|
|
21715
|
-
i
|
|
21716
|
-
);
|
|
21717
|
-
})
|
|
21470
|
+
return /* @__PURE__ */ jsxs83("div", { css: SearchAndFilterOptionsContainer, children: [
|
|
21471
|
+
/* @__PURE__ */ jsx123("div", { css: SearchAndFilterOptionsInnerContainer, children }),
|
|
21472
|
+
buttonRow ? /* @__PURE__ */ jsx123(
|
|
21473
|
+
HorizontalRhythm,
|
|
21474
|
+
{
|
|
21475
|
+
css: SearchAndFilterButtonGroup,
|
|
21476
|
+
gap: "sm",
|
|
21477
|
+
align: "center",
|
|
21478
|
+
justify: "space-between",
|
|
21479
|
+
children: buttonRow
|
|
21480
|
+
}
|
|
21481
|
+
) : null,
|
|
21482
|
+
sortControls ? /* @__PURE__ */ jsx123("div", { children: sortControls }) : null
|
|
21483
|
+
] });
|
|
21484
|
+
};
|
|
21485
|
+
var FilterMenu = ({
|
|
21486
|
+
id,
|
|
21487
|
+
filterTitle = "Show results",
|
|
21488
|
+
menuControls,
|
|
21489
|
+
sortControls,
|
|
21490
|
+
children,
|
|
21491
|
+
dataTestId,
|
|
21492
|
+
resetButtonText = "reset"
|
|
21493
|
+
}) => {
|
|
21494
|
+
const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
|
|
21495
|
+
const innerMenuRef = React24.useRef(null);
|
|
21496
|
+
useEffect20(() => {
|
|
21497
|
+
var _a;
|
|
21498
|
+
if (filterVisibility) {
|
|
21499
|
+
(_a = innerMenuRef.current) == null ? void 0 : _a.focus();
|
|
21718
21500
|
}
|
|
21719
|
-
);
|
|
21501
|
+
}, [filterVisibility]);
|
|
21502
|
+
return /* @__PURE__ */ jsx123(VerticalRhythm, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ jsxs83(SearchAndFilterOptionsContainer2, { buttonRow: menuControls, sortControls, children: [
|
|
21503
|
+
/* @__PURE__ */ jsxs83(HorizontalRhythm, { gap: "sm", align: "center", justify: "space-between", children: [
|
|
21504
|
+
/* @__PURE__ */ jsx123("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }),
|
|
21505
|
+
(filters == null ? void 0 : filters.length) ? /* @__PURE__ */ jsx123(
|
|
21506
|
+
"button",
|
|
21507
|
+
{
|
|
21508
|
+
type: "button",
|
|
21509
|
+
css: ResetConditionsBtn,
|
|
21510
|
+
onClick: () => {
|
|
21511
|
+
handleResetFilters();
|
|
21512
|
+
setFilterVisibility(false);
|
|
21513
|
+
},
|
|
21514
|
+
"data-testid": "reset-filters",
|
|
21515
|
+
children: resetButtonText
|
|
21516
|
+
}
|
|
21517
|
+
) : null
|
|
21518
|
+
] }),
|
|
21519
|
+
children
|
|
21520
|
+
] }) : null });
|
|
21720
21521
|
};
|
|
21721
21522
|
|
|
21722
21523
|
// src/components/SegmentedControl/SegmentedControl.tsx
|
|
21723
21524
|
import { css as css95 } from "@emotion/react";
|
|
21724
21525
|
import { CgCheck as CgCheck4 } from "@react-icons/all-files/cg/CgCheck";
|
|
21725
|
-
import { useCallback as useCallback11, useMemo as
|
|
21526
|
+
import { useCallback as useCallback11, useMemo as useMemo7 } from "react";
|
|
21726
21527
|
|
|
21727
21528
|
// src/components/SegmentedControl/SegmentedControl.styles.ts
|
|
21728
21529
|
import { css as css94 } from "@emotion/react";
|
|
@@ -21846,7 +21647,7 @@ var segmentedControlLabelContentStyles = css94`
|
|
|
21846
21647
|
var segmentedControlLabelTextStyles = css94``;
|
|
21847
21648
|
|
|
21848
21649
|
// src/components/SegmentedControl/SegmentedControl.tsx
|
|
21849
|
-
import { jsx as
|
|
21650
|
+
import { jsx as jsx124, jsxs as jsxs84 } from "@emotion/react/jsx-runtime";
|
|
21850
21651
|
var SegmentedControl = ({
|
|
21851
21652
|
name,
|
|
21852
21653
|
options,
|
|
@@ -21856,6 +21657,8 @@ var SegmentedControl = ({
|
|
|
21856
21657
|
disabled: disabled2 = false,
|
|
21857
21658
|
orientation = "horizontal",
|
|
21858
21659
|
size = "md",
|
|
21660
|
+
hideOptionText = false,
|
|
21661
|
+
iconSize = "1.5em",
|
|
21859
21662
|
...props
|
|
21860
21663
|
}) => {
|
|
21861
21664
|
const onOptionChange = useCallback11(
|
|
@@ -21866,18 +21669,19 @@ var SegmentedControl = ({
|
|
|
21866
21669
|
},
|
|
21867
21670
|
[options, onChange]
|
|
21868
21671
|
);
|
|
21869
|
-
const sizeStyles =
|
|
21672
|
+
const sizeStyles = useMemo7(() => {
|
|
21870
21673
|
const map = {
|
|
21871
21674
|
sm: css95({ height: "calc(24px - 2px)", fontSize: "var(--fs-xs)" }),
|
|
21872
21675
|
md: css95({ height: "calc(32px - 2px)", fontSize: "var(--fs-sm)" }),
|
|
21873
|
-
lg: css95({ height: "calc(40px - 2px)", fontSize: "var(--fs-base)" })
|
|
21676
|
+
lg: css95({ height: "calc(40px - 2px)", fontSize: "var(--fs-base)" }),
|
|
21677
|
+
xl: css95({ height: "calc(48px - 2px)", fontSize: "var(--fs-base)" })
|
|
21874
21678
|
};
|
|
21875
21679
|
return map[size];
|
|
21876
21680
|
}, [size]);
|
|
21877
|
-
const isIconOnly =
|
|
21681
|
+
const isIconOnly = useMemo7(() => {
|
|
21878
21682
|
return options.every((option) => option && option.icon && !option.label);
|
|
21879
21683
|
}, [options]);
|
|
21880
|
-
return /* @__PURE__ */
|
|
21684
|
+
return /* @__PURE__ */ jsx124(
|
|
21881
21685
|
"div",
|
|
21882
21686
|
{
|
|
21883
21687
|
css: [segmentedControlStyles, orientation === "vertical" ? segmentedControlVerticalStyles : void 0],
|
|
@@ -21890,45 +21694,53 @@ var SegmentedControl = ({
|
|
|
21890
21694
|
}
|
|
21891
21695
|
const text = option.label ? option.label : option.icon ? null : String(option.value);
|
|
21892
21696
|
const isDisabled = disabled2 || option.disabled;
|
|
21893
|
-
return /* @__PURE__ */
|
|
21894
|
-
"
|
|
21697
|
+
return /* @__PURE__ */ jsx124(Tooltip, { title: (_a = option.tooltip) != null ? _a : "", children: /* @__PURE__ */ jsx124(
|
|
21698
|
+
"div",
|
|
21895
21699
|
{
|
|
21896
|
-
css:
|
|
21897
|
-
|
|
21898
|
-
|
|
21899
|
-
|
|
21900
|
-
|
|
21901
|
-
|
|
21902
|
-
|
|
21903
|
-
|
|
21904
|
-
|
|
21905
|
-
|
|
21906
|
-
|
|
21907
|
-
|
|
21908
|
-
|
|
21909
|
-
|
|
21910
|
-
|
|
21911
|
-
|
|
21912
|
-
|
|
21913
|
-
|
|
21914
|
-
|
|
21915
|
-
|
|
21916
|
-
|
|
21917
|
-
|
|
21918
|
-
|
|
21919
|
-
|
|
21700
|
+
css: segmentedControlItemStyles,
|
|
21701
|
+
"data-testid": option["data-testid"] ? option["data-testid"] : "container-segmented-control",
|
|
21702
|
+
children: /* @__PURE__ */ jsxs84(
|
|
21703
|
+
"label",
|
|
21704
|
+
{
|
|
21705
|
+
css: [
|
|
21706
|
+
segmentedControlLabelStyles(option.value === value, isDisabled),
|
|
21707
|
+
sizeStyles,
|
|
21708
|
+
isIconOnly ? segmentedControlLabelIconOnlyStyles : void 0
|
|
21709
|
+
],
|
|
21710
|
+
children: [
|
|
21711
|
+
/* @__PURE__ */ jsx124(
|
|
21712
|
+
"input",
|
|
21713
|
+
{
|
|
21714
|
+
css: segmentedControlInputStyles,
|
|
21715
|
+
type: "radio",
|
|
21716
|
+
name,
|
|
21717
|
+
value: index,
|
|
21718
|
+
checked: option.value === value,
|
|
21719
|
+
onChange: onOptionChange,
|
|
21720
|
+
disabled: isDisabled
|
|
21721
|
+
}
|
|
21722
|
+
),
|
|
21723
|
+
option.value !== value || noCheckmark ? null : /* @__PURE__ */ jsx124(CgCheck4, { css: segmentedControlLabelCheckStyles, "aria-label": "Selected", size: "1.5em" }),
|
|
21724
|
+
/* @__PURE__ */ jsxs84("span", { css: segmentedControlLabelContentStyles, children: [
|
|
21725
|
+
!option.icon ? null : /* @__PURE__ */ jsx124(Icon, { icon: option.icon, size: iconSize, iconColor: "currentColor" }),
|
|
21726
|
+
!text || hideOptionText ? null : /* @__PURE__ */ jsx124("span", { css: segmentedControlLabelTextStyles, children: text })
|
|
21727
|
+
] })
|
|
21728
|
+
]
|
|
21729
|
+
}
|
|
21730
|
+
)
|
|
21920
21731
|
}
|
|
21921
|
-
) }
|
|
21732
|
+
) }, JSON.stringify(option.value));
|
|
21922
21733
|
})
|
|
21923
21734
|
}
|
|
21924
21735
|
);
|
|
21925
21736
|
};
|
|
21926
21737
|
|
|
21927
21738
|
// src/components/SearchAndFilter/SortItems.tsx
|
|
21928
|
-
import { jsx as
|
|
21929
|
-
var SortItems = () => {
|
|
21739
|
+
import { jsx as jsx125, jsxs as jsxs85 } from "@emotion/react/jsx-runtime";
|
|
21740
|
+
var SortItems = ({ sortByLabel = "Sort by", localeLabel = "Locale returned" }) => {
|
|
21930
21741
|
var _a, _b;
|
|
21931
|
-
const { sortOptions, setSortBy, sortByValue } = useSearchAndFilter();
|
|
21742
|
+
const { sortOptions, setSortBy, sortByValue, localeValue, localeOptions, handleLocaleChange } = useSearchAndFilter();
|
|
21743
|
+
const hideLocaleOptions = !localeOptions;
|
|
21932
21744
|
const values = sortByValue.split("_");
|
|
21933
21745
|
const sortDirection = values.pop();
|
|
21934
21746
|
const sortField = values.join("_");
|
|
@@ -21936,57 +21748,286 @@ var SortItems = () => {
|
|
|
21936
21748
|
var _a2;
|
|
21937
21749
|
return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
|
|
21938
21750
|
})) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
|
|
21939
|
-
return /* @__PURE__ */
|
|
21940
|
-
/* @__PURE__ */
|
|
21941
|
-
|
|
21942
|
-
{
|
|
21943
|
-
|
|
21944
|
-
|
|
21945
|
-
|
|
21946
|
-
|
|
21947
|
-
|
|
21948
|
-
|
|
21949
|
-
|
|
21950
|
-
|
|
21951
|
-
|
|
21952
|
-
|
|
21953
|
-
|
|
21751
|
+
return /* @__PURE__ */ jsxs85("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
|
|
21752
|
+
/* @__PURE__ */ jsxs85(VerticalRhythm, { gap: "xs", children: [
|
|
21753
|
+
/* @__PURE__ */ jsx125("span", { css: Title, children: sortByLabel }),
|
|
21754
|
+
/* @__PURE__ */ jsxs85("div", { css: SortFilterInputRow, children: [
|
|
21755
|
+
/* @__PURE__ */ jsx125(
|
|
21756
|
+
InputComboBox,
|
|
21757
|
+
{
|
|
21758
|
+
id: "sort-by-field",
|
|
21759
|
+
"aria-label": "Sort by",
|
|
21760
|
+
options: sortOptions,
|
|
21761
|
+
onChange: (e) => {
|
|
21762
|
+
const fieldName = e == null ? void 0 : e.value;
|
|
21763
|
+
setSortBy(`${fieldName}_${sortDirection}`);
|
|
21764
|
+
},
|
|
21765
|
+
styles: {
|
|
21766
|
+
menu(base) {
|
|
21767
|
+
return {
|
|
21768
|
+
...base,
|
|
21769
|
+
minWidth: "max-content"
|
|
21770
|
+
};
|
|
21771
|
+
}
|
|
21772
|
+
},
|
|
21773
|
+
value: currentSelectedOption
|
|
21954
21774
|
}
|
|
21955
|
-
|
|
21956
|
-
|
|
21957
|
-
|
|
21958
|
-
|
|
21959
|
-
|
|
21960
|
-
|
|
21961
|
-
|
|
21962
|
-
|
|
21963
|
-
|
|
21964
|
-
|
|
21965
|
-
|
|
21966
|
-
|
|
21967
|
-
|
|
21968
|
-
|
|
21969
|
-
|
|
21970
|
-
|
|
21971
|
-
|
|
21972
|
-
|
|
21973
|
-
|
|
21974
|
-
|
|
21775
|
+
),
|
|
21776
|
+
/* @__PURE__ */ jsx125(
|
|
21777
|
+
SegmentedControl,
|
|
21778
|
+
{
|
|
21779
|
+
noCheckmark: true,
|
|
21780
|
+
name: "sortBy",
|
|
21781
|
+
hideOptionText: true,
|
|
21782
|
+
iconSize: "1rem",
|
|
21783
|
+
size: "xl",
|
|
21784
|
+
options: [
|
|
21785
|
+
{
|
|
21786
|
+
label: "Ascending",
|
|
21787
|
+
icon: "arrow-up",
|
|
21788
|
+
value: `ASC`,
|
|
21789
|
+
tooltip: "Ascending (e.g. A-Z, newest to oldest)",
|
|
21790
|
+
"data-testid": "sort-ascending"
|
|
21791
|
+
},
|
|
21792
|
+
{
|
|
21793
|
+
label: "Descending",
|
|
21794
|
+
icon: "arrow-down",
|
|
21795
|
+
value: `DESC`,
|
|
21796
|
+
tooltip: "Descending (e.g. Z-A, oldest to newest)",
|
|
21797
|
+
"data-testid": "sort-descending"
|
|
21798
|
+
}
|
|
21799
|
+
],
|
|
21800
|
+
onChange: (e) => setSortBy(`${sortField}_${e}`),
|
|
21801
|
+
value: sortDirection
|
|
21802
|
+
}
|
|
21803
|
+
)
|
|
21804
|
+
] })
|
|
21805
|
+
] }),
|
|
21806
|
+
hideLocaleOptions ? null : /* @__PURE__ */ jsxs85(VerticalRhythm, { gap: "xs", children: [
|
|
21807
|
+
/* @__PURE__ */ jsx125("span", { css: Title, children: localeLabel }),
|
|
21808
|
+
/* @__PURE__ */ jsx125(
|
|
21809
|
+
InputSelect,
|
|
21810
|
+
{
|
|
21811
|
+
name: "localeReturned",
|
|
21812
|
+
"aria-label": "Locale returned",
|
|
21813
|
+
label: "Locale returned",
|
|
21814
|
+
showLabel: false,
|
|
21815
|
+
"data-testid": "context-locale",
|
|
21816
|
+
onChange: (e) => {
|
|
21817
|
+
var _a2;
|
|
21818
|
+
return handleLocaleChange((_a2 = e.currentTarget.value) != null ? _a2 : "");
|
|
21819
|
+
},
|
|
21820
|
+
options: localeOptions,
|
|
21821
|
+
value: localeValue
|
|
21822
|
+
}
|
|
21823
|
+
)
|
|
21824
|
+
] })
|
|
21825
|
+
] });
|
|
21975
21826
|
};
|
|
21976
21827
|
|
|
21977
|
-
// src/components/SearchAndFilter/
|
|
21978
|
-
import { jsx as
|
|
21979
|
-
var
|
|
21980
|
-
|
|
21981
|
-
|
|
21982
|
-
|
|
21983
|
-
|
|
21828
|
+
// src/components/SearchAndFilter/FilterItem.tsx
|
|
21829
|
+
import { jsx as jsx126, jsxs as jsxs86 } from "@emotion/react/jsx-runtime";
|
|
21830
|
+
var FilterItem = ({
|
|
21831
|
+
index,
|
|
21832
|
+
paramOptions,
|
|
21833
|
+
operatorOptions,
|
|
21834
|
+
valueOptions,
|
|
21835
|
+
onParamChange,
|
|
21836
|
+
onOperatorChange,
|
|
21837
|
+
onValueChange
|
|
21838
|
+
}) => {
|
|
21839
|
+
var _a, _b;
|
|
21840
|
+
const { filters, handleDeleteFilter, filterOptions } = useSearchAndFilter();
|
|
21841
|
+
const label = filters[index].field !== "" ? filters[index].field : "unknown filter field";
|
|
21842
|
+
const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
|
|
21843
|
+
const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
|
|
21844
|
+
const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
|
|
21845
|
+
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = useMemo8(() => {
|
|
21846
|
+
var _a2;
|
|
21847
|
+
const currentSelectedFilter = filterOptions.find((item) => {
|
|
21848
|
+
var _a3;
|
|
21849
|
+
return (_a3 = item.options) == null ? void 0 : _a3.find((op) => op.value === filters[index].field);
|
|
21850
|
+
});
|
|
21851
|
+
const selectedFieldValue2 = (_a2 = currentSelectedFilter == null ? void 0 : currentSelectedFilter.options) == null ? void 0 : _a2.find((item) => {
|
|
21852
|
+
return filters[index].field === item.value;
|
|
21853
|
+
});
|
|
21854
|
+
const isCurrentFieldReadOnly = selectedFieldValue2 == null ? void 0 : selectedFieldValue2.readOnly;
|
|
21855
|
+
const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
|
|
21856
|
+
return filters[index].operator === item.value;
|
|
21857
|
+
});
|
|
21858
|
+
return {
|
|
21859
|
+
selectedFieldValue: selectedFieldValue2,
|
|
21860
|
+
selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
|
|
21861
|
+
selectedMetaValue: filters[index].value,
|
|
21862
|
+
readOnly: isCurrentFieldReadOnly,
|
|
21863
|
+
bindable: selectedFieldValue2 == null ? void 0 : selectedFieldValue2.bindable
|
|
21864
|
+
};
|
|
21865
|
+
}, [filters, filterOptions, index, operatorOptions]);
|
|
21866
|
+
const readOnlyProps = readOnly ? {
|
|
21867
|
+
"aria-readonly": true,
|
|
21868
|
+
isSearchable: false,
|
|
21869
|
+
menuIsOpen: false,
|
|
21870
|
+
isClearable: false
|
|
21871
|
+
} : {};
|
|
21872
|
+
return /* @__PURE__ */ jsxs86("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
|
|
21873
|
+
/* @__PURE__ */ jsx126("span", { children: index === 0 ? "Where" : "and" }),
|
|
21874
|
+
/* @__PURE__ */ jsxs86("div", { css: ConditionalInputRow, children: [
|
|
21875
|
+
/* @__PURE__ */ jsx126(
|
|
21876
|
+
InputComboBox,
|
|
21877
|
+
{
|
|
21878
|
+
"aria-label": label,
|
|
21879
|
+
options: paramOptions,
|
|
21880
|
+
onChange: (e) => {
|
|
21881
|
+
var _a2;
|
|
21882
|
+
onParamChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
|
|
21883
|
+
},
|
|
21884
|
+
isOptionDisabled: (option) => {
|
|
21885
|
+
var _a2;
|
|
21886
|
+
return (_a2 = option == null ? void 0 : option.disabled) != null ? _a2 : false;
|
|
21887
|
+
},
|
|
21888
|
+
styles: {
|
|
21889
|
+
menu(base) {
|
|
21890
|
+
return {
|
|
21891
|
+
...base,
|
|
21892
|
+
minWidth: "max-content"
|
|
21893
|
+
};
|
|
21894
|
+
}
|
|
21895
|
+
},
|
|
21896
|
+
value: selectedFieldValue,
|
|
21897
|
+
...readOnlyProps,
|
|
21898
|
+
id: "filter-field",
|
|
21899
|
+
name: `filter-field-${index}`
|
|
21900
|
+
}
|
|
21901
|
+
),
|
|
21902
|
+
/* @__PURE__ */ jsx126(
|
|
21903
|
+
InputComboBox,
|
|
21904
|
+
{
|
|
21905
|
+
"aria-label": operatorLabel,
|
|
21906
|
+
options: operatorOptions,
|
|
21907
|
+
onChange: (e) => {
|
|
21908
|
+
var _a2;
|
|
21909
|
+
return onOperatorChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
|
|
21910
|
+
},
|
|
21911
|
+
isDisabled: !filters[index].field,
|
|
21912
|
+
value: selectedOperatorValue,
|
|
21913
|
+
styles: {
|
|
21914
|
+
menu(base) {
|
|
21915
|
+
return {
|
|
21916
|
+
...base,
|
|
21917
|
+
minWidth: "max-content"
|
|
21918
|
+
};
|
|
21919
|
+
}
|
|
21920
|
+
},
|
|
21921
|
+
...readOnlyProps,
|
|
21922
|
+
id: "filter-operator",
|
|
21923
|
+
name: `filter-operator-${index}`
|
|
21924
|
+
}
|
|
21925
|
+
),
|
|
21926
|
+
/* @__PURE__ */ jsx126(
|
|
21927
|
+
FilterEditorRenderer,
|
|
21928
|
+
{
|
|
21929
|
+
"aria-label": metaDataLabel,
|
|
21930
|
+
editorType: metaDataPossibleOptions,
|
|
21931
|
+
options: valueOptions,
|
|
21932
|
+
onChange: (e) => onValueChange(e != null ? e : ""),
|
|
21933
|
+
readOnly,
|
|
21934
|
+
bindable,
|
|
21935
|
+
disabled: !filters[index].operator,
|
|
21936
|
+
value: selectedMetaValue,
|
|
21937
|
+
valueTestId: "filter-value"
|
|
21938
|
+
}
|
|
21939
|
+
),
|
|
21940
|
+
readOnly || index === 0 ? null : /* @__PURE__ */ jsx126(
|
|
21941
|
+
"button",
|
|
21942
|
+
{
|
|
21943
|
+
type: "button",
|
|
21944
|
+
onClick: () => handleDeleteFilter(index),
|
|
21945
|
+
"aria-label": "delete filter",
|
|
21946
|
+
css: IconBtn,
|
|
21947
|
+
"data-testid": "delete-filter",
|
|
21948
|
+
children: /* @__PURE__ */ jsx126(Icon, { icon: "trash", iconColor: "red", size: "1rem" })
|
|
21949
|
+
}
|
|
21950
|
+
)
|
|
21951
|
+
] })
|
|
21952
|
+
] });
|
|
21953
|
+
};
|
|
21954
|
+
var FilterItems = ({ addButtonText = "add condition" }) => {
|
|
21955
|
+
const { filterOptions, filters, setFilters, handleAddFilter } = useSearchAndFilter();
|
|
21956
|
+
const handleUpdateFilter = (index, prop, value) => {
|
|
21957
|
+
var _a, _b, _c, _d, _e;
|
|
21958
|
+
const next = [...filters];
|
|
21959
|
+
next[index] = { ...next[index], [prop]: value };
|
|
21960
|
+
if (prop === "operator") {
|
|
21961
|
+
if (["eq", "neq", "lt", "gt"].includes(value) && Array.isArray(next[index].value)) {
|
|
21962
|
+
next[index].value = next[index].value[0];
|
|
21963
|
+
}
|
|
21964
|
+
if (["between"].includes(value) && Array.isArray(next[index].value) === false) {
|
|
21965
|
+
next[index].value = [next[index].value, ""];
|
|
21966
|
+
}
|
|
21967
|
+
if (value === "def" || value === "true") {
|
|
21968
|
+
next[index].value = "true";
|
|
21969
|
+
}
|
|
21970
|
+
if (value === "ndef" || value === "false") {
|
|
21971
|
+
next[index].value = "false";
|
|
21972
|
+
}
|
|
21973
|
+
}
|
|
21974
|
+
if (prop === "field") {
|
|
21975
|
+
const firstOperatorInAvailableOperators = (_e = (_d = (_c = (_b = (_a = filterOptions.find((fo) => {
|
|
21976
|
+
var _a2;
|
|
21977
|
+
return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === value);
|
|
21978
|
+
})) == null ? void 0 : _a.options) == null ? void 0 : _b.find((op) => op.value === next[index].field)) == null ? void 0 : _c.operatorOptions) == null ? void 0 : _d[0].value) != null ? _e : "eq";
|
|
21979
|
+
next[index].operator = firstOperatorInAvailableOperators;
|
|
21980
|
+
next[index].value = "";
|
|
21981
|
+
}
|
|
21982
|
+
setFilters(next);
|
|
21984
21983
|
};
|
|
21985
|
-
return
|
|
21984
|
+
return /* @__PURE__ */ jsx126(
|
|
21985
|
+
FilterMenu,
|
|
21986
|
+
{
|
|
21987
|
+
id: "search-and-filter-options",
|
|
21988
|
+
dataTestId: "search-and-filter-options",
|
|
21989
|
+
menuControls: /* @__PURE__ */ jsxs86(
|
|
21990
|
+
"button",
|
|
21991
|
+
{
|
|
21992
|
+
type: "button",
|
|
21993
|
+
css: AddConditionalBtn,
|
|
21994
|
+
onClick: handleAddFilter,
|
|
21995
|
+
"data-testid": "add-filter",
|
|
21996
|
+
children: [
|
|
21997
|
+
/* @__PURE__ */ jsx126(Icon, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
|
|
21998
|
+
addButtonText
|
|
21999
|
+
]
|
|
22000
|
+
}
|
|
22001
|
+
),
|
|
22002
|
+
sortControls: /* @__PURE__ */ jsx126(SortItems, {}),
|
|
22003
|
+
children: filters.map((item, i) => {
|
|
22004
|
+
var _a, _b, _c, _d, _e, _f;
|
|
22005
|
+
const availableTypeOptions = (_b = (_a = filterOptions.find((fo) => {
|
|
22006
|
+
var _a2;
|
|
22007
|
+
return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === item.field);
|
|
22008
|
+
})) == null ? void 0 : _a.options) != null ? _b : [];
|
|
22009
|
+
const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
|
|
22010
|
+
const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
|
|
22011
|
+
return /* @__PURE__ */ jsx126(
|
|
22012
|
+
FilterItem,
|
|
22013
|
+
{
|
|
22014
|
+
index: i,
|
|
22015
|
+
paramOptions: filterOptions,
|
|
22016
|
+
onParamChange: (e) => handleUpdateFilter(i, "field", e),
|
|
22017
|
+
operatorOptions: possibleOperators,
|
|
22018
|
+
onOperatorChange: (e) => handleUpdateFilter(i, "operator", e),
|
|
22019
|
+
onValueChange: (e) => handleUpdateFilter(i, "value", e),
|
|
22020
|
+
valueOptions: possibleValueOptions
|
|
22021
|
+
},
|
|
22022
|
+
i
|
|
22023
|
+
);
|
|
22024
|
+
})
|
|
22025
|
+
}
|
|
22026
|
+
);
|
|
21986
22027
|
};
|
|
21987
22028
|
|
|
21988
22029
|
// src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
|
|
21989
|
-
import { Fragment as
|
|
22030
|
+
import { Fragment as Fragment21, jsx as jsx127, jsxs as jsxs87 } from "@emotion/react/jsx-runtime";
|
|
21990
22031
|
var SearchAndFilterResultContainer = ({
|
|
21991
22032
|
buttonText,
|
|
21992
22033
|
clearButtonLabel = "clear",
|
|
@@ -22020,46 +22061,50 @@ var SearchAndFilterResultContainer = ({
|
|
|
22020
22061
|
if (totalResults && totalResults > 0) {
|
|
22021
22062
|
return null;
|
|
22022
22063
|
}
|
|
22023
|
-
return /* @__PURE__ */ jsxs87(
|
|
22064
|
+
return /* @__PURE__ */ jsxs87(Fragment21, { children: [
|
|
22024
22065
|
/* @__PURE__ */ jsxs87(HorizontalRhythm, { children: [
|
|
22025
22066
|
/* @__PURE__ */ jsxs87("span", { children: [
|
|
22026
22067
|
totalResults,
|
|
22027
22068
|
" results ",
|
|
22028
22069
|
searchTerm ? `for "${searchTerm}"` : null
|
|
22029
22070
|
] }),
|
|
22030
|
-
!searchTerm ? null : /* @__PURE__ */
|
|
22071
|
+
!searchTerm ? null : /* @__PURE__ */ jsx127(Button, { buttonType: "ghostDestructive", size: "zero", onClick: () => setSearchTerm(""), children: clearButtonLabel })
|
|
22031
22072
|
] }),
|
|
22032
22073
|
totalResults === 0 ? /* @__PURE__ */ jsxs87(Callout, { title: calloutTitle2 != null ? calloutTitle2 : automateCalloutTitle(), type: "note", children: [
|
|
22033
|
-
calloutText ? /* @__PURE__ */
|
|
22034
|
-
/* @__PURE__ */
|
|
22074
|
+
calloutText ? /* @__PURE__ */ jsx127(Paragraph, { children: calloutText }) : null,
|
|
22075
|
+
/* @__PURE__ */ jsx127(Button, { buttonType: "tertiaryOutline", size: "xs", onClick: onHandleClear != null ? onHandleClear : handleResetFilters, children: buttonText != null ? buttonText : "Clear search" })
|
|
22035
22076
|
] }) : null
|
|
22036
22077
|
] });
|
|
22037
22078
|
};
|
|
22038
22079
|
|
|
22039
22080
|
// src/components/SearchAndFilter/SearchAndFilter.tsx
|
|
22040
|
-
import { jsx as
|
|
22081
|
+
import { jsx as jsx128, jsxs as jsxs88 } from "@emotion/react/jsx-runtime";
|
|
22041
22082
|
var SearchAndFilter = ({
|
|
22042
22083
|
filters,
|
|
22043
22084
|
filterOptions,
|
|
22044
|
-
|
|
22085
|
+
filterVisible,
|
|
22045
22086
|
sortOptions,
|
|
22046
22087
|
defaultSortByValue,
|
|
22047
22088
|
filterControls,
|
|
22048
22089
|
viewSwitchControls,
|
|
22049
|
-
resultsContainerView = /* @__PURE__ */
|
|
22050
|
-
children = /* @__PURE__ */
|
|
22090
|
+
resultsContainerView = /* @__PURE__ */ jsx128(SearchAndFilterResultContainer, {}),
|
|
22091
|
+
children = /* @__PURE__ */ jsx128(FilterItems, {}),
|
|
22092
|
+
filterMapper: filterMapper2 = filterMapper,
|
|
22051
22093
|
onChange,
|
|
22052
22094
|
onSearchChange,
|
|
22053
22095
|
onSortChange,
|
|
22096
|
+
onLocaleChange,
|
|
22054
22097
|
totalResults,
|
|
22055
|
-
resetFilterValues = []
|
|
22098
|
+
resetFilterValues = [],
|
|
22099
|
+
defaultLocale,
|
|
22100
|
+
localeOptions
|
|
22056
22101
|
}) => {
|
|
22057
|
-
return /* @__PURE__ */
|
|
22102
|
+
return /* @__PURE__ */ jsx128(
|
|
22058
22103
|
SearchAndFilterProvider,
|
|
22059
22104
|
{
|
|
22060
22105
|
filters,
|
|
22061
22106
|
filterOptions,
|
|
22062
|
-
|
|
22107
|
+
filterVisible,
|
|
22063
22108
|
defaultSortByValue,
|
|
22064
22109
|
sortOptions,
|
|
22065
22110
|
onChange,
|
|
@@ -22067,15 +22112,19 @@ var SearchAndFilter = ({
|
|
|
22067
22112
|
onSortChange,
|
|
22068
22113
|
totalResults,
|
|
22069
22114
|
resetFilterValues,
|
|
22115
|
+
defaultLocale,
|
|
22116
|
+
localeOptions,
|
|
22117
|
+
onLocaleChange,
|
|
22118
|
+
filterMapper: filterMapper2,
|
|
22070
22119
|
children: /* @__PURE__ */ jsxs88(VerticalRhythm, { css: SearchAndFilterContainer, "data-testid": "search-and-filter", children: [
|
|
22071
22120
|
/* @__PURE__ */ jsxs88("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
|
|
22072
|
-
/* @__PURE__ */
|
|
22121
|
+
/* @__PURE__ */ jsx128(
|
|
22073
22122
|
"div",
|
|
22074
22123
|
{
|
|
22075
22124
|
css: SearchAndFilterControlsWrapper(
|
|
22076
|
-
viewSwitchControls ? "auto
|
|
22125
|
+
viewSwitchControls ? "auto 1fr 0.05fr" : "auto auto 1fr"
|
|
22077
22126
|
),
|
|
22078
|
-
children: !filterControls ? /* @__PURE__ */
|
|
22127
|
+
children: !filterControls ? /* @__PURE__ */ jsx128(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
|
|
22079
22128
|
}
|
|
22080
22129
|
),
|
|
22081
22130
|
viewSwitchControls
|
|
@@ -22090,7 +22139,7 @@ var SearchAndFilter = ({
|
|
|
22090
22139
|
// src/components/SearchAndFilter/SearchOnlyFilter.tsx
|
|
22091
22140
|
import { createContext as createContext7, useState as useState19 } from "react";
|
|
22092
22141
|
import { useDebounce as useDebounce4 } from "react-use";
|
|
22093
|
-
import { jsx as
|
|
22142
|
+
import { jsx as jsx129 } from "@emotion/react/jsx-runtime";
|
|
22094
22143
|
var SearchOnlyContext = createContext7({
|
|
22095
22144
|
searchTerm: "",
|
|
22096
22145
|
setSearchTerm: () => {
|
|
@@ -22107,14 +22156,14 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
|
|
|
22107
22156
|
300,
|
|
22108
22157
|
[localeSearchTerm]
|
|
22109
22158
|
);
|
|
22110
|
-
return /* @__PURE__ */
|
|
22159
|
+
return /* @__PURE__ */ jsx129(
|
|
22111
22160
|
SearchOnlyContext.Provider,
|
|
22112
22161
|
{
|
|
22113
22162
|
value: {
|
|
22114
22163
|
searchTerm,
|
|
22115
22164
|
setSearchTerm: setLocaleSearchTerm
|
|
22116
22165
|
},
|
|
22117
|
-
children: /* @__PURE__ */
|
|
22166
|
+
children: /* @__PURE__ */ jsx129("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ jsx129(
|
|
22118
22167
|
InputKeywordSearch,
|
|
22119
22168
|
{
|
|
22120
22169
|
placeholder: "Search...",
|
|
@@ -22140,7 +22189,7 @@ var skeletonStyles = css96`
|
|
|
22140
22189
|
`;
|
|
22141
22190
|
|
|
22142
22191
|
// src/components/Skeleton/Skeleton.tsx
|
|
22143
|
-
import { jsx as
|
|
22192
|
+
import { jsx as jsx130 } from "@emotion/react/jsx-runtime";
|
|
22144
22193
|
var Skeleton = ({
|
|
22145
22194
|
width = "100%",
|
|
22146
22195
|
height = "1.25rem",
|
|
@@ -22148,7 +22197,7 @@ var Skeleton = ({
|
|
|
22148
22197
|
circle = false,
|
|
22149
22198
|
children,
|
|
22150
22199
|
...otherProps
|
|
22151
|
-
}) => /* @__PURE__ */
|
|
22200
|
+
}) => /* @__PURE__ */ jsx130(
|
|
22152
22201
|
"div",
|
|
22153
22202
|
{
|
|
22154
22203
|
css: [
|
|
@@ -22255,19 +22304,19 @@ var SwitchText = css97`
|
|
|
22255
22304
|
`;
|
|
22256
22305
|
|
|
22257
22306
|
// src/components/Switch/Switch.tsx
|
|
22258
|
-
import { Fragment as
|
|
22307
|
+
import { Fragment as Fragment22, jsx as jsx131, jsxs as jsxs89 } from "@emotion/react/jsx-runtime";
|
|
22259
22308
|
var Switch = React26.forwardRef(
|
|
22260
22309
|
({ label, infoText, toggleText, children, ...inputProps }, ref) => {
|
|
22261
22310
|
let additionalText = infoText;
|
|
22262
22311
|
if (infoText && toggleText) {
|
|
22263
22312
|
additionalText = inputProps.checked ? toggleText : infoText;
|
|
22264
22313
|
}
|
|
22265
|
-
return /* @__PURE__ */ jsxs89(
|
|
22314
|
+
return /* @__PURE__ */ jsxs89(Fragment22, { children: [
|
|
22266
22315
|
/* @__PURE__ */ jsxs89("label", { css: [SwitchInputContainer, inputProps.disabled ? SwitchInputDisabled : void 0], children: [
|
|
22267
|
-
/* @__PURE__ */
|
|
22268
|
-
/* @__PURE__ */
|
|
22316
|
+
/* @__PURE__ */ jsx131("input", { type: "checkbox", css: SwitchInput, ...inputProps, ref }),
|
|
22317
|
+
/* @__PURE__ */ jsx131("span", { css: SwitchInputLabel, children: label })
|
|
22269
22318
|
] }),
|
|
22270
|
-
additionalText ? /* @__PURE__ */
|
|
22319
|
+
additionalText ? /* @__PURE__ */ jsx131("p", { css: SwitchText, children: additionalText }) : null,
|
|
22271
22320
|
children
|
|
22272
22321
|
] });
|
|
22273
22322
|
}
|
|
@@ -22304,40 +22353,40 @@ var tableCellHead = css98`
|
|
|
22304
22353
|
`;
|
|
22305
22354
|
|
|
22306
22355
|
// src/components/Table/Table.tsx
|
|
22307
|
-
import { jsx as
|
|
22356
|
+
import { jsx as jsx132 } from "@emotion/react/jsx-runtime";
|
|
22308
22357
|
var Table = React27.forwardRef(
|
|
22309
22358
|
({ children, cellPadding, ...otherProps }, ref) => {
|
|
22310
|
-
return /* @__PURE__ */
|
|
22359
|
+
return /* @__PURE__ */ jsx132("table", { ref, css: table({ cellPadding }), ...otherProps, children });
|
|
22311
22360
|
}
|
|
22312
22361
|
);
|
|
22313
22362
|
var TableHead = React27.forwardRef(
|
|
22314
22363
|
({ children, ...otherProps }, ref) => {
|
|
22315
|
-
return /* @__PURE__ */
|
|
22364
|
+
return /* @__PURE__ */ jsx132("thead", { ref, css: tableHead, ...otherProps, children });
|
|
22316
22365
|
}
|
|
22317
22366
|
);
|
|
22318
22367
|
var TableBody = React27.forwardRef(
|
|
22319
22368
|
({ children, ...otherProps }, ref) => {
|
|
22320
|
-
return /* @__PURE__ */
|
|
22369
|
+
return /* @__PURE__ */ jsx132("tbody", { ref, ...otherProps, children });
|
|
22321
22370
|
}
|
|
22322
22371
|
);
|
|
22323
22372
|
var TableFoot = React27.forwardRef(
|
|
22324
22373
|
({ children, ...otherProps }, ref) => {
|
|
22325
|
-
return /* @__PURE__ */
|
|
22374
|
+
return /* @__PURE__ */ jsx132("tfoot", { ref, ...otherProps, children });
|
|
22326
22375
|
}
|
|
22327
22376
|
);
|
|
22328
22377
|
var TableRow = React27.forwardRef(
|
|
22329
22378
|
({ children, ...otherProps }, ref) => {
|
|
22330
|
-
return /* @__PURE__ */
|
|
22379
|
+
return /* @__PURE__ */ jsx132("tr", { ref, css: tableRow, ...otherProps, children });
|
|
22331
22380
|
}
|
|
22332
22381
|
);
|
|
22333
22382
|
var TableCellHead = React27.forwardRef(
|
|
22334
22383
|
({ children, ...otherProps }, ref) => {
|
|
22335
|
-
return /* @__PURE__ */
|
|
22384
|
+
return /* @__PURE__ */ jsx132("th", { ref, css: tableCellHead, ...otherProps, children });
|
|
22336
22385
|
}
|
|
22337
22386
|
);
|
|
22338
22387
|
var TableCellData = React27.forwardRef(
|
|
22339
22388
|
({ children, ...otherProps }, ref) => {
|
|
22340
|
-
return /* @__PURE__ */
|
|
22389
|
+
return /* @__PURE__ */ jsx132("td", { ref, ...otherProps, children });
|
|
22341
22390
|
}
|
|
22342
22391
|
);
|
|
22343
22392
|
|
|
@@ -22377,7 +22426,7 @@ var tabButtonGroupStyles = css99`
|
|
|
22377
22426
|
`;
|
|
22378
22427
|
|
|
22379
22428
|
// src/components/Tabs/Tabs.tsx
|
|
22380
|
-
import { jsx as
|
|
22429
|
+
import { jsx as jsx133 } from "@emotion/react/jsx-runtime";
|
|
22381
22430
|
var useCurrentTab = () => {
|
|
22382
22431
|
const context = useAriakitTabStore();
|
|
22383
22432
|
if (!context) {
|
|
@@ -22415,23 +22464,23 @@ var Tabs = ({
|
|
|
22415
22464
|
tab.setSelectedId(selected);
|
|
22416
22465
|
}
|
|
22417
22466
|
}, [selected, tab]);
|
|
22418
|
-
return /* @__PURE__ */
|
|
22467
|
+
return /* @__PURE__ */ jsx133(AriakitTabProvider, { store: tab, setSelectedId: onTabSelect, children });
|
|
22419
22468
|
};
|
|
22420
22469
|
var TabButtonGroup = ({ children, ...props }) => {
|
|
22421
|
-
return /* @__PURE__ */
|
|
22470
|
+
return /* @__PURE__ */ jsx133(AriakitTabList, { ...props, css: tabButtonGroupStyles, children });
|
|
22422
22471
|
};
|
|
22423
22472
|
var TabButton = ({
|
|
22424
22473
|
children,
|
|
22425
22474
|
id,
|
|
22426
22475
|
...props
|
|
22427
22476
|
}) => {
|
|
22428
|
-
return /* @__PURE__ */
|
|
22477
|
+
return /* @__PURE__ */ jsx133(AriakitTab, { type: "button", id, ...props, css: tabButtonStyles, children });
|
|
22429
22478
|
};
|
|
22430
22479
|
var TabContent = ({
|
|
22431
22480
|
children,
|
|
22432
22481
|
...props
|
|
22433
22482
|
}) => {
|
|
22434
|
-
return /* @__PURE__ */
|
|
22483
|
+
return /* @__PURE__ */ jsx133(AriakitTabPanel, { ...props, children });
|
|
22435
22484
|
};
|
|
22436
22485
|
|
|
22437
22486
|
// src/components/Toast/Toast.tsx
|
|
@@ -22662,9 +22711,9 @@ var toastContainerStyles = css100`
|
|
|
22662
22711
|
`;
|
|
22663
22712
|
|
|
22664
22713
|
// src/components/Toast/Toast.tsx
|
|
22665
|
-
import { jsx as
|
|
22714
|
+
import { jsx as jsx134 } from "@emotion/react/jsx-runtime";
|
|
22666
22715
|
var ToastContainer = ({ limit = 4 }) => {
|
|
22667
|
-
return /* @__PURE__ */
|
|
22716
|
+
return /* @__PURE__ */ jsx134(
|
|
22668
22717
|
ToastifyContainer,
|
|
22669
22718
|
{
|
|
22670
22719
|
css: toastContainerStyles,
|
|
@@ -22702,6 +22751,8 @@ export {
|
|
|
22702
22751
|
CurrentDrawerContext,
|
|
22703
22752
|
DATE_OPERATORS,
|
|
22704
22753
|
DashedBox,
|
|
22754
|
+
DateEditor,
|
|
22755
|
+
DateRangeEditor,
|
|
22705
22756
|
DateTimePicker,
|
|
22706
22757
|
DateTimePickerVariant,
|
|
22707
22758
|
DebouncedInputKeywordSearch,
|
|
@@ -22717,9 +22768,12 @@ export {
|
|
|
22717
22768
|
Fieldset,
|
|
22718
22769
|
FilterButton2 as FilterButton,
|
|
22719
22770
|
FilterControls,
|
|
22771
|
+
FilterEditorRenderer,
|
|
22720
22772
|
FilterItem,
|
|
22721
22773
|
FilterItems,
|
|
22722
22774
|
FilterMenu,
|
|
22775
|
+
FilterMultiChoiceEditor,
|
|
22776
|
+
FilterSingleChoiceEditor,
|
|
22723
22777
|
Heading,
|
|
22724
22778
|
HexModalBackground,
|
|
22725
22779
|
HorizontalRhythm,
|
|
@@ -22766,6 +22820,9 @@ export {
|
|
|
22766
22820
|
ModalDialog,
|
|
22767
22821
|
MultilineChip,
|
|
22768
22822
|
NUMBER_OPERATORS,
|
|
22823
|
+
NumberEditor,
|
|
22824
|
+
NumberRangeEditor,
|
|
22825
|
+
PUBLISH_STATUS_FIELD_OPERATORS,
|
|
22769
22826
|
PageHeaderSection,
|
|
22770
22827
|
Pagination,
|
|
22771
22828
|
Paragraph,
|
|
@@ -22818,6 +22875,8 @@ export {
|
|
|
22818
22875
|
ShortcutRevealer,
|
|
22819
22876
|
Skeleton,
|
|
22820
22877
|
StatusBullet,
|
|
22878
|
+
StatusMultiEditor,
|
|
22879
|
+
StatusSingleEditor,
|
|
22821
22880
|
SuccessMessage,
|
|
22822
22881
|
Switch,
|
|
22823
22882
|
TAKEOVER_STACK_ID,
|
|
@@ -22834,6 +22893,7 @@ export {
|
|
|
22834
22893
|
TableRow,
|
|
22835
22894
|
Tabs,
|
|
22836
22895
|
TakeoverDrawerRenderer,
|
|
22896
|
+
TextEditor,
|
|
22837
22897
|
Textarea,
|
|
22838
22898
|
Theme,
|
|
22839
22899
|
Tile2 as Tile,
|
|
@@ -22878,6 +22938,7 @@ export {
|
|
|
22878
22938
|
fadeInRtl,
|
|
22879
22939
|
fadeInTop,
|
|
22880
22940
|
fadeOutBottom,
|
|
22941
|
+
filterMapper,
|
|
22881
22942
|
fullWidthScreenIcon,
|
|
22882
22943
|
getDrawerAttributes,
|
|
22883
22944
|
getParentPath,
|