@uniformdev/design-system 19.135.0 → 19.136.0
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 +465 -425
- package/dist/index.d.mts +59 -24
- package/dist/index.d.ts +59 -24
- package/dist/index.js +537 -499
- package/package.json +5 -4
package/dist/index.js
CHANGED
|
@@ -1435,6 +1435,7 @@ __export(src_exports, {
|
|
|
1435
1435
|
ModalDialog: () => ModalDialog,
|
|
1436
1436
|
MultilineChip: () => MultilineChip,
|
|
1437
1437
|
NUMBER_OPERATORS: () => NUMBER_OPERATORS,
|
|
1438
|
+
PUBLISH_STATUS_FIELD_OPERATORS: () => PUBLISH_STATUS_FIELD_OPERATORS,
|
|
1438
1439
|
PageHeaderSection: () => PageHeaderSection,
|
|
1439
1440
|
Pagination: () => Pagination,
|
|
1440
1441
|
Paragraph: () => Paragraph,
|
|
@@ -22288,6 +22289,28 @@ var SYSTEM_FIELD_OPERATORS = [
|
|
|
22288
22289
|
editorType: "multiChoice"
|
|
22289
22290
|
}
|
|
22290
22291
|
];
|
|
22292
|
+
var PUBLISH_STATUS_FIELD_OPERATORS = [
|
|
22293
|
+
{
|
|
22294
|
+
label: "is...",
|
|
22295
|
+
value: "eq",
|
|
22296
|
+
editorType: "statusSingleChoice"
|
|
22297
|
+
},
|
|
22298
|
+
{
|
|
22299
|
+
label: "is any of...",
|
|
22300
|
+
value: "in",
|
|
22301
|
+
editorType: "statusMultiChoice"
|
|
22302
|
+
},
|
|
22303
|
+
{
|
|
22304
|
+
label: "is not...",
|
|
22305
|
+
value: "neq",
|
|
22306
|
+
editorType: "statusSingleChoice"
|
|
22307
|
+
},
|
|
22308
|
+
{
|
|
22309
|
+
label: "is none of...",
|
|
22310
|
+
value: "nin",
|
|
22311
|
+
editorType: "statusMultiChoice"
|
|
22312
|
+
}
|
|
22313
|
+
];
|
|
22291
22314
|
|
|
22292
22315
|
// src/components/SearchAndFilter/FilterButton.tsx
|
|
22293
22316
|
init_emotion_jsx_shim();
|
|
@@ -22330,7 +22353,7 @@ var ConditionalFilterRow = import_react139.css`
|
|
|
22330
22353
|
}
|
|
22331
22354
|
}
|
|
22332
22355
|
|
|
22333
|
-
&:
|
|
22356
|
+
&:nth-of-type(2) {
|
|
22334
22357
|
margin-left: 0;
|
|
22335
22358
|
grid-template-columns: 50px 1fr;
|
|
22336
22359
|
}
|
|
@@ -22484,15 +22507,6 @@ var IconBtn = import_react139.css`
|
|
|
22484
22507
|
border: none;
|
|
22485
22508
|
padding: var(--spacing-sm);
|
|
22486
22509
|
`;
|
|
22487
|
-
var CloseBtn = import_react139.css`
|
|
22488
|
-
color: var(--gray-500);
|
|
22489
|
-
background: transparent;
|
|
22490
|
-
border: none;
|
|
22491
|
-
padding: 0;
|
|
22492
|
-
position: absolute;
|
|
22493
|
-
top: var(--spacing-base);
|
|
22494
|
-
right: var(--spacing-base);
|
|
22495
|
-
`;
|
|
22496
22510
|
var SearchAndFilterOptionsContainer = import_react139.css`
|
|
22497
22511
|
background: var(--gray-50);
|
|
22498
22512
|
border: 1px solid var(--gray-300);
|
|
@@ -22501,7 +22515,7 @@ var SearchAndFilterOptionsContainer = import_react139.css`
|
|
|
22501
22515
|
display: flex;
|
|
22502
22516
|
flex-direction: column;
|
|
22503
22517
|
gap: var(--spacing-sm);
|
|
22504
|
-
padding: var(--spacing-md)
|
|
22518
|
+
padding: var(--spacing-md) 0 var(--spacing-base);
|
|
22505
22519
|
will-change: height;
|
|
22506
22520
|
position: relative;
|
|
22507
22521
|
z-index: 1;
|
|
@@ -22510,14 +22524,27 @@ var SearchAndFilterOptionsInnerContainer = import_react139.css`
|
|
|
22510
22524
|
display: flex;
|
|
22511
22525
|
flex-direction: column;
|
|
22512
22526
|
gap: var(--spacing-sm);
|
|
22527
|
+
padding-inline: var(--spacing-md);
|
|
22513
22528
|
`;
|
|
22514
22529
|
var SearchAndFilterButtonGroup = import_react139.css`
|
|
22515
|
-
margin-top: var(--spacing-
|
|
22530
|
+
margin-top: var(--spacing-xs);
|
|
22531
|
+
margin-left: calc(56px + var(--spacing-md));
|
|
22532
|
+
`;
|
|
22533
|
+
var SortFilterWrapper = (hiddenLocaleInput) => import_react139.css`
|
|
22534
|
+
border-top: 1px solid var(--gray-300);
|
|
22535
|
+
align-items: center;
|
|
22536
|
+
display: grid;
|
|
22537
|
+
grid-template-columns: ${hiddenLocaleInput ? "1fr" : "1fr 200px"};
|
|
22538
|
+
gap: var(--spacing-xl);
|
|
22539
|
+
padding: var(--spacing-base) var(--spacing-md) 0;
|
|
22540
|
+
position: relative;
|
|
22541
|
+
z-index: 0;
|
|
22516
22542
|
`;
|
|
22517
22543
|
var SortFilterInputRow = import_react139.css`
|
|
22518
22544
|
align-items: center;
|
|
22519
|
-
display:
|
|
22520
|
-
|
|
22545
|
+
display: grid;
|
|
22546
|
+
grid-template-columns: 1fr auto;
|
|
22547
|
+
gap: var(--spacing-base);
|
|
22521
22548
|
`;
|
|
22522
22549
|
|
|
22523
22550
|
// src/components/SearchAndFilter/FilterButton.tsx
|
|
@@ -22575,31 +22602,39 @@ var SearchAndFilterContext = (0, import_react140.createContext)({
|
|
|
22575
22602
|
},
|
|
22576
22603
|
handleDeleteFilter: () => {
|
|
22577
22604
|
},
|
|
22605
|
+
handleLocaleChange: () => {
|
|
22606
|
+
},
|
|
22578
22607
|
setSortBy: () => {
|
|
22579
22608
|
},
|
|
22580
22609
|
sortByValue: "",
|
|
22581
22610
|
filterOptions: [],
|
|
22582
22611
|
sortOptions: [],
|
|
22583
22612
|
validFilterQuery: [],
|
|
22584
|
-
totalResults: 0
|
|
22613
|
+
totalResults: 0,
|
|
22614
|
+
localeOptions: [],
|
|
22615
|
+
localeValue: ""
|
|
22585
22616
|
});
|
|
22586
22617
|
var SearchAndFilterProvider = ({
|
|
22587
22618
|
filters,
|
|
22588
22619
|
filterOptions,
|
|
22589
22620
|
sortOptions,
|
|
22590
22621
|
defaultSortByValue,
|
|
22591
|
-
|
|
22622
|
+
defaultLocale = "",
|
|
22623
|
+
localeOptions,
|
|
22624
|
+
onLocaleChange,
|
|
22625
|
+
filterVisible = false,
|
|
22592
22626
|
onSearchChange,
|
|
22593
22627
|
onChange,
|
|
22594
22628
|
onSortChange,
|
|
22595
|
-
resetFilterValues = [],
|
|
22629
|
+
resetFilterValues = [{ field: "", operator: "", value: "" }],
|
|
22596
22630
|
totalResults,
|
|
22597
22631
|
children
|
|
22598
22632
|
}) => {
|
|
22599
22633
|
const [searchTerm, setSearchTerm] = (0, import_react140.useState)("");
|
|
22600
22634
|
const deferredSearchTerm = (0, import_react140.useDeferredValue)(searchTerm);
|
|
22601
|
-
const [filterVisibility, setFilterVisibility] = (0, import_react140.useState)(
|
|
22635
|
+
const [filterVisibility, setFilterVisibility] = (0, import_react140.useState)(filterVisible);
|
|
22602
22636
|
const [sortByValue, setSortByValue] = (0, import_react140.useState)(defaultSortByValue);
|
|
22637
|
+
const [localeValue, setLocale] = (0, import_react140.useState)(defaultLocale);
|
|
22603
22638
|
const handleSearchTerm = (0, import_react140.useCallback)(
|
|
22604
22639
|
(term) => {
|
|
22605
22640
|
setSearchTerm(term);
|
|
@@ -22607,6 +22642,13 @@ var SearchAndFilterProvider = ({
|
|
|
22607
22642
|
},
|
|
22608
22643
|
[setSearchTerm, onSearchChange]
|
|
22609
22644
|
);
|
|
22645
|
+
const handleLocaleChange = (0, import_react140.useCallback)(
|
|
22646
|
+
(locale) => {
|
|
22647
|
+
setLocale(locale);
|
|
22648
|
+
onLocaleChange == null ? void 0 : onLocaleChange(locale);
|
|
22649
|
+
},
|
|
22650
|
+
[onLocaleChange]
|
|
22651
|
+
);
|
|
22610
22652
|
const handleOnSortChange = (0, import_react140.useCallback)(
|
|
22611
22653
|
(sort) => {
|
|
22612
22654
|
setSortByValue(sort);
|
|
@@ -22615,7 +22657,7 @@ var SearchAndFilterProvider = ({
|
|
|
22615
22657
|
[onSortChange]
|
|
22616
22658
|
);
|
|
22617
22659
|
const handleToggleFilterVisibilty = (0, import_react140.useCallback)(
|
|
22618
|
-
(
|
|
22660
|
+
(visible) => setFilterVisibility(visible),
|
|
22619
22661
|
[setFilterVisibility]
|
|
22620
22662
|
);
|
|
22621
22663
|
const handleAddFilter = (0, import_react140.useCallback)(() => {
|
|
@@ -22641,7 +22683,7 @@ var SearchAndFilterProvider = ({
|
|
|
22641
22683
|
if (filterVisibility) {
|
|
22642
22684
|
const handleEscKeyFilterClose = (e) => {
|
|
22643
22685
|
if (e.key === "Escape") {
|
|
22644
|
-
setFilterVisibility(
|
|
22686
|
+
setFilterVisibility(false);
|
|
22645
22687
|
}
|
|
22646
22688
|
};
|
|
22647
22689
|
document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
@@ -22668,7 +22710,10 @@ var SearchAndFilterProvider = ({
|
|
|
22668
22710
|
filterOptions,
|
|
22669
22711
|
sortOptions,
|
|
22670
22712
|
validFilterQuery,
|
|
22671
|
-
totalResults
|
|
22713
|
+
totalResults,
|
|
22714
|
+
localeOptions,
|
|
22715
|
+
localeValue,
|
|
22716
|
+
handleLocaleChange
|
|
22672
22717
|
},
|
|
22673
22718
|
children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(VerticalRhythm, { children })
|
|
22674
22719
|
}
|
|
@@ -22683,22 +22728,10 @@ var useSearchAndFilter = () => {
|
|
|
22683
22728
|
var import_jsx_runtime120 = require("@emotion/react/jsx-runtime");
|
|
22684
22729
|
var FilterControls = ({
|
|
22685
22730
|
children,
|
|
22686
|
-
defaultSortByValue,
|
|
22687
22731
|
hideSearchInput
|
|
22688
22732
|
}) => {
|
|
22689
|
-
|
|
22690
|
-
const {
|
|
22691
|
-
setFilterVisibility,
|
|
22692
|
-
filterVisibility,
|
|
22693
|
-
setSearchTerm,
|
|
22694
|
-
validFilterQuery,
|
|
22695
|
-
searchTerm,
|
|
22696
|
-
sortByValue,
|
|
22697
|
-
filterOptions
|
|
22698
|
-
} = useSearchAndFilter();
|
|
22699
|
-
const [initialSortValue, setInitialSortValue] = (0, import_react141.useState)(sortByValue);
|
|
22733
|
+
const { setFilterVisibility, filterVisibility, setSearchTerm, validFilterQuery, searchTerm } = useSearchAndFilter();
|
|
22700
22734
|
const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react141.useState)("");
|
|
22701
|
-
const [userHasChangedSortByValue, setUserHasChangedSortByValue] = (0, import_react141.useState)(false);
|
|
22702
22735
|
(0, import_react_use3.useDebounce)(
|
|
22703
22736
|
() => {
|
|
22704
22737
|
setSearchTerm(localeSearchTerm);
|
|
@@ -22711,26 +22744,6 @@ var FilterControls = ({
|
|
|
22711
22744
|
setLocaleSearchTerm("");
|
|
22712
22745
|
}
|
|
22713
22746
|
}, [searchTerm]);
|
|
22714
|
-
const handleFilterToggle = (mode) => {
|
|
22715
|
-
if (filterVisibility === "filters" && mode === "filters" || filterVisibility === "sort" && mode === "sort") {
|
|
22716
|
-
return setFilterVisibility(void 0);
|
|
22717
|
-
}
|
|
22718
|
-
return setFilterVisibility(mode);
|
|
22719
|
-
};
|
|
22720
|
-
const sortValue = (sortByValue != null ? sortByValue : defaultSortByValue).split("_");
|
|
22721
|
-
const sortDirection = sortValue == null ? void 0 : sortValue.pop();
|
|
22722
|
-
const sortField = sortValue == null ? void 0 : sortValue.join("_");
|
|
22723
|
-
const sortOn = sortField.startsWith("fields.") ? "contentTypeFields" : "metadata";
|
|
22724
|
-
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;
|
|
22725
|
-
const sortByIcon = userHasChangedSortByValue ? sortDirection === "ASC" ? "arrow-up" : "arrow-down" : "sort-az";
|
|
22726
|
-
(0, import_react_use3.useEffectOnce)(() => {
|
|
22727
|
-
setInitialSortValue(sortByValue);
|
|
22728
|
-
});
|
|
22729
|
-
(0, import_react141.useEffect)(() => {
|
|
22730
|
-
if (initialSortValue !== sortByValue) {
|
|
22731
|
-
setUserHasChangedSortByValue(true);
|
|
22732
|
-
}
|
|
22733
|
-
}, [initialSortValue, sortByValue]);
|
|
22734
22747
|
return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(import_jsx_runtime120.Fragment, { children: [
|
|
22735
22748
|
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
22736
22749
|
FilterButton2,
|
|
@@ -22738,26 +22751,13 @@ var FilterControls = ({
|
|
|
22738
22751
|
"aria-controls": "search-and-filter-options",
|
|
22739
22752
|
"aria-label": "filter options",
|
|
22740
22753
|
"aria-haspopup": "true",
|
|
22741
|
-
|
|
22754
|
+
text: "Filter/Sort",
|
|
22755
|
+
"aria-expanded": filterVisibility === true,
|
|
22742
22756
|
filterCount: validFilterQuery == null ? void 0 : validFilterQuery.length,
|
|
22743
|
-
onClick: () =>
|
|
22757
|
+
onClick: () => setFilterVisibility(!filterVisibility),
|
|
22744
22758
|
dataTestId: "filters-button"
|
|
22745
22759
|
}
|
|
22746
22760
|
),
|
|
22747
|
-
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
22748
|
-
FilterButton2,
|
|
22749
|
-
{
|
|
22750
|
-
"aria-controls": "search-and-filter-sortBy",
|
|
22751
|
-
"aria-label": "sort by options",
|
|
22752
|
-
"aria-haspopup": "true",
|
|
22753
|
-
text: !userHasChangedSortByValue ? "Sort" : sortByValueLabel,
|
|
22754
|
-
icon: sortByIcon,
|
|
22755
|
-
"aria-expanded": filterVisibility === "sort",
|
|
22756
|
-
hasSelectedValue: sortByValue !== "",
|
|
22757
|
-
onClick: () => handleFilterToggle("sort"),
|
|
22758
|
-
dataTestId: "sort-by-button"
|
|
22759
|
-
}
|
|
22760
|
-
),
|
|
22761
22761
|
hideSearchInput ? null : /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
22762
22762
|
InputKeywordSearch,
|
|
22763
22763
|
{
|
|
@@ -22775,7 +22775,7 @@ var FilterControls = ({
|
|
|
22775
22775
|
|
|
22776
22776
|
// src/components/SearchAndFilter/FilterItem.tsx
|
|
22777
22777
|
init_emotion_jsx_shim();
|
|
22778
|
-
var
|
|
22778
|
+
var import_react148 = require("react");
|
|
22779
22779
|
|
|
22780
22780
|
// src/components/SearchAndFilter/FilterEditor.tsx
|
|
22781
22781
|
init_emotion_jsx_shim();
|
|
@@ -22999,6 +22999,7 @@ var StatusMultiEditor = ({
|
|
|
22999
22999
|
formatOptionLabel: CustomOptions,
|
|
23000
23000
|
value,
|
|
23001
23001
|
isDisabled,
|
|
23002
|
+
"aria-readonly": readOnly,
|
|
23002
23003
|
styles: {
|
|
23003
23004
|
menu(base) {
|
|
23004
23005
|
return {
|
|
@@ -23031,6 +23032,7 @@ var StatusSingleEditor = ({
|
|
|
23031
23032
|
formatOptionLabel: CustomOptions,
|
|
23032
23033
|
value,
|
|
23033
23034
|
isDisabled,
|
|
23035
|
+
"aria-readonly": readOnly,
|
|
23034
23036
|
styles: {
|
|
23035
23037
|
menu(base) {
|
|
23036
23038
|
return {
|
|
@@ -23289,6 +23291,7 @@ var import_react144 = __toESM(require("react"));
|
|
|
23289
23291
|
var import_jsx_runtime123 = require("@emotion/react/jsx-runtime");
|
|
23290
23292
|
var SearchAndFilterOptionsContainer2 = ({
|
|
23291
23293
|
buttonRow,
|
|
23294
|
+
sortControls,
|
|
23292
23295
|
children
|
|
23293
23296
|
}) => {
|
|
23294
23297
|
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { css: SearchAndFilterOptionsContainer, children: [
|
|
@@ -23302,17 +23305,20 @@ var SearchAndFilterOptionsContainer2 = ({
|
|
|
23302
23305
|
justify: "space-between",
|
|
23303
23306
|
children: buttonRow
|
|
23304
23307
|
}
|
|
23305
|
-
) : null
|
|
23308
|
+
) : null,
|
|
23309
|
+
sortControls ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)("div", { children: sortControls }) : null
|
|
23306
23310
|
] });
|
|
23307
23311
|
};
|
|
23308
23312
|
var FilterMenu = ({
|
|
23309
23313
|
id,
|
|
23310
23314
|
filterTitle = "Show results",
|
|
23311
23315
|
menuControls,
|
|
23316
|
+
sortControls,
|
|
23312
23317
|
children,
|
|
23313
|
-
dataTestId
|
|
23318
|
+
dataTestId,
|
|
23319
|
+
resetButtonText = "reset"
|
|
23314
23320
|
}) => {
|
|
23315
|
-
const { filterVisibility, setFilterVisibility } = useSearchAndFilter();
|
|
23321
|
+
const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
|
|
23316
23322
|
const innerMenuRef = import_react144.default.useRef(null);
|
|
23317
23323
|
(0, import_react144.useEffect)(() => {
|
|
23318
23324
|
var _a;
|
|
@@ -23320,78 +23326,392 @@ var FilterMenu = ({
|
|
|
23320
23326
|
(_a = innerMenuRef.current) == null ? void 0 : _a.focus();
|
|
23321
23327
|
}
|
|
23322
23328
|
}, [filterVisibility]);
|
|
23323
|
-
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(VerticalRhythm, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(SearchAndFilterOptionsContainer2, { buttonRow: menuControls, children: [
|
|
23324
|
-
/* @__PURE__ */ (0, import_jsx_runtime123.
|
|
23325
|
-
|
|
23326
|
-
|
|
23327
|
-
|
|
23328
|
-
|
|
23329
|
-
|
|
23330
|
-
|
|
23331
|
-
|
|
23332
|
-
|
|
23333
|
-
|
|
23334
|
-
|
|
23335
|
-
|
|
23329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(VerticalRhythm, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(SearchAndFilterOptionsContainer2, { buttonRow: menuControls, sortControls, children: [
|
|
23330
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(HorizontalRhythm, { gap: "sm", align: "center", justify: "space-between", children: [
|
|
23331
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }),
|
|
23332
|
+
(filters == null ? void 0 : filters.length) ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
23333
|
+
"button",
|
|
23334
|
+
{
|
|
23335
|
+
type: "button",
|
|
23336
|
+
css: ResetConditionsBtn,
|
|
23337
|
+
onClick: () => {
|
|
23338
|
+
handleResetFilters();
|
|
23339
|
+
setFilterVisibility(false);
|
|
23340
|
+
},
|
|
23341
|
+
"data-testid": "reset-filters",
|
|
23342
|
+
children: resetButtonText
|
|
23343
|
+
}
|
|
23344
|
+
) : null
|
|
23345
|
+
] }),
|
|
23336
23346
|
children
|
|
23337
23347
|
] }) : null });
|
|
23338
23348
|
};
|
|
23339
23349
|
|
|
23340
|
-
// src/components/SearchAndFilter/
|
|
23350
|
+
// src/components/SearchAndFilter/SortItems.tsx
|
|
23351
|
+
init_emotion_jsx_shim();
|
|
23352
|
+
|
|
23353
|
+
// src/components/SegmentedControl/SegmentedControl.tsx
|
|
23354
|
+
init_emotion_jsx_shim();
|
|
23355
|
+
var import_react146 = require("@emotion/react");
|
|
23356
|
+
var import_CgCheck5 = require("@react-icons/all-files/cg/CgCheck");
|
|
23357
|
+
var import_react147 = require("react");
|
|
23358
|
+
|
|
23359
|
+
// src/components/SegmentedControl/SegmentedControl.styles.ts
|
|
23360
|
+
init_emotion_jsx_shim();
|
|
23361
|
+
var import_react145 = require("@emotion/react");
|
|
23362
|
+
var segmentedControlStyles = import_react145.css`
|
|
23363
|
+
--segmented-control-rounded-value: var(--rounded-base);
|
|
23364
|
+
--segmented-control-border-width: 1px;
|
|
23365
|
+
--segmented-control-selected-color: var(--brand-secondary-3);
|
|
23366
|
+
--segmented-control-first-border-radius: var(--segmented-control-rounded-value) 0 0
|
|
23367
|
+
var(--segmented-control-rounded-value);
|
|
23368
|
+
--segmented-control-last-border-radius: 0 var(--segmented-control-rounded-value)
|
|
23369
|
+
var(--segmented-control-rounded-value) 0;
|
|
23370
|
+
|
|
23371
|
+
position: relative;
|
|
23372
|
+
display: flex;
|
|
23373
|
+
justify-content: flex-start;
|
|
23374
|
+
width: fit-content;
|
|
23375
|
+
background-color: var(--gray-300);
|
|
23376
|
+
padding: var(--segmented-control-border-width);
|
|
23377
|
+
gap: var(--segmented-control-border-width);
|
|
23378
|
+
border-radius: calc(var(--segmented-control-rounded-value) + var(--segmented-control-border-width));
|
|
23379
|
+
font-size: var(--fs-xs);
|
|
23380
|
+
`;
|
|
23381
|
+
var segmentedControlVerticalStyles = import_react145.css`
|
|
23382
|
+
flex-direction: column;
|
|
23383
|
+
--segmented-control-first-border-radius: var(--segmented-control-rounded-value)
|
|
23384
|
+
var(--segmented-control-rounded-value) 0 0;
|
|
23385
|
+
--segmented-control-last-border-radius: 0 0 var(--segmented-control-rounded-value)
|
|
23386
|
+
var(--segmented-control-rounded-value);
|
|
23387
|
+
`;
|
|
23388
|
+
var segmentedControlItemStyles = import_react145.css`
|
|
23389
|
+
&:first-of-type label {
|
|
23390
|
+
border-radius: var(--segmented-control-first-border-radius);
|
|
23391
|
+
}
|
|
23392
|
+
&:last-of-type label {
|
|
23393
|
+
border-radius: var(--segmented-control-last-border-radius);
|
|
23394
|
+
}
|
|
23395
|
+
`;
|
|
23396
|
+
var segmentedControlInputStyles = import_react145.css`
|
|
23397
|
+
${accessibleHidden}
|
|
23398
|
+
`;
|
|
23399
|
+
var segmentedControlLabelStyles = (checked, disabled2) => import_react145.css`
|
|
23400
|
+
position: relative;
|
|
23401
|
+
display: flex;
|
|
23402
|
+
align-items: center;
|
|
23403
|
+
justify-content: center;
|
|
23404
|
+
height: 2rem;
|
|
23405
|
+
padding-inline: var(--spacing-base);
|
|
23406
|
+
background-color: white;
|
|
23407
|
+
transition-property: background-color, color, box-shadow;
|
|
23408
|
+
transition-duration: var(--duration-xfast);
|
|
23409
|
+
transition-timing-function: ease-in-out;
|
|
23410
|
+
z-index: 1;
|
|
23411
|
+
cursor: pointer;
|
|
23412
|
+
|
|
23413
|
+
&:has(:checked:not(:disabled)) {
|
|
23414
|
+
background-color: var(--segmented-control-selected-color);
|
|
23415
|
+
outline: var(--segmented-control-border-width) solid var(--segmented-control-selected-color);
|
|
23416
|
+
box-shadow: 0 0.43em 1.7em 0 rgba(0, 0, 0, 0.15);
|
|
23417
|
+
color: white;
|
|
23418
|
+
-webkit-text-stroke-width: thin;
|
|
23419
|
+
z-index: 0;
|
|
23420
|
+
}
|
|
23421
|
+
|
|
23422
|
+
&:hover:not(:has(:disabled, :checked)) {
|
|
23423
|
+
background-color: var(--gray-100);
|
|
23424
|
+
}
|
|
23425
|
+
|
|
23426
|
+
&:has(:disabled) {
|
|
23427
|
+
color: var(--gray-400);
|
|
23428
|
+
cursor: default;
|
|
23429
|
+
}
|
|
23430
|
+
|
|
23431
|
+
&:has(:checked:disabled) {
|
|
23432
|
+
color: var(--gray-50);
|
|
23433
|
+
background-color: var(--gray-400);
|
|
23434
|
+
}
|
|
23435
|
+
|
|
23436
|
+
// Firefox fallback using emotion variables
|
|
23437
|
+
// we can delete this whole block of code and variables in SegmentedControl.tsx
|
|
23438
|
+
// once Firefox supports :has selector
|
|
23439
|
+
@supports not selector(:has(*)) {
|
|
23440
|
+
// equivalent to &:has(:checked:not(:disabled))
|
|
23441
|
+
${checked && !disabled2 ? `
|
|
23442
|
+
background-color: var(--segmented-control-selected-color);
|
|
23443
|
+
outline: var(--segmented-control-border-width) solid var(--segmented-control-selected-color);
|
|
23444
|
+
box-shadow: 0 0.43em 1.7em 0 rgba(0, 0, 0, 0.15);
|
|
23445
|
+
color: white;
|
|
23446
|
+
-webkit-text-stroke-width: thin;
|
|
23447
|
+
z-index: 0;` : void 0}
|
|
23448
|
+
|
|
23449
|
+
// equivalent to &:hover:not(:has(:disabled, :checked))
|
|
23450
|
+
&:hover {
|
|
23451
|
+
${!checked && !disabled2 ? `background-color: var(--gray-100);` : void 0}
|
|
23452
|
+
}
|
|
23453
|
+
|
|
23454
|
+
// equivalent to &:has(:disabled)
|
|
23455
|
+
${disabled2 ? `
|
|
23456
|
+
color: var(--gray-400);
|
|
23457
|
+
cursor: default;` : void 0}
|
|
23458
|
+
|
|
23459
|
+
// equivalent to &:has(:checked:disabled)
|
|
23460
|
+
${checked && disabled2 && `
|
|
23461
|
+
color: var(--gray-50);
|
|
23462
|
+
background-color: var(--gray-400);
|
|
23463
|
+
`}
|
|
23464
|
+
}
|
|
23465
|
+
`;
|
|
23466
|
+
var segmentedControlLabelIconOnlyStyles = import_react145.css`
|
|
23467
|
+
padding-inline: 0.5em;
|
|
23468
|
+
`;
|
|
23469
|
+
var segmentedControlLabelCheckStyles = import_react145.css`
|
|
23470
|
+
opacity: 0.5;
|
|
23471
|
+
`;
|
|
23472
|
+
var segmentedControlLabelContentStyles = import_react145.css`
|
|
23473
|
+
display: flex;
|
|
23474
|
+
align-items: center;
|
|
23475
|
+
justify-content: center;
|
|
23476
|
+
gap: var(--spacing-sm);
|
|
23477
|
+
height: 100%;
|
|
23478
|
+
`;
|
|
23479
|
+
var segmentedControlLabelTextStyles = import_react145.css``;
|
|
23480
|
+
|
|
23481
|
+
// src/components/SegmentedControl/SegmentedControl.tsx
|
|
23341
23482
|
var import_jsx_runtime124 = require("@emotion/react/jsx-runtime");
|
|
23342
|
-
var
|
|
23343
|
-
|
|
23344
|
-
|
|
23345
|
-
|
|
23346
|
-
|
|
23347
|
-
|
|
23348
|
-
|
|
23349
|
-
|
|
23483
|
+
var SegmentedControl = ({
|
|
23484
|
+
name,
|
|
23485
|
+
options,
|
|
23486
|
+
value,
|
|
23487
|
+
onChange,
|
|
23488
|
+
noCheckmark = false,
|
|
23489
|
+
disabled: disabled2 = false,
|
|
23490
|
+
orientation = "horizontal",
|
|
23491
|
+
size = "md",
|
|
23492
|
+
hideOptionText = false,
|
|
23493
|
+
iconSize = "1.5em",
|
|
23494
|
+
...props
|
|
23350
23495
|
}) => {
|
|
23351
|
-
|
|
23352
|
-
|
|
23353
|
-
|
|
23354
|
-
|
|
23355
|
-
const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
|
|
23356
|
-
const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
|
|
23357
|
-
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly } = (0, import_react145.useMemo)(() => {
|
|
23358
|
-
var _a2;
|
|
23359
|
-
const currentSelectedFilter = filterOptions.find((item) => {
|
|
23360
|
-
var _a3;
|
|
23361
|
-
return (_a3 = item.options) == null ? void 0 : _a3.find((op) => op.value === filters[index].field);
|
|
23362
|
-
});
|
|
23363
|
-
const selectedFieldValue2 = (_a2 = currentSelectedFilter == null ? void 0 : currentSelectedFilter.options) == null ? void 0 : _a2.find((item) => {
|
|
23364
|
-
return filters[index].field === item.value;
|
|
23365
|
-
});
|
|
23366
|
-
const isCurrentFieldReadOnly = selectedFieldValue2 == null ? void 0 : selectedFieldValue2.readOnly;
|
|
23367
|
-
const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
|
|
23368
|
-
return filters[index].operator === item.value;
|
|
23369
|
-
});
|
|
23370
|
-
const selectedMetaValue2 = valueOptions.filter((item) => {
|
|
23371
|
-
if (Array.isArray(filters[index].value) && item.value) {
|
|
23372
|
-
return filters[index].value.includes(item.value);
|
|
23496
|
+
const onOptionChange = (0, import_react147.useCallback)(
|
|
23497
|
+
(event) => {
|
|
23498
|
+
if (event.target.checked) {
|
|
23499
|
+
onChange == null ? void 0 : onChange(options[parseInt(event.target.value)].value);
|
|
23373
23500
|
}
|
|
23374
|
-
|
|
23375
|
-
|
|
23376
|
-
|
|
23377
|
-
|
|
23378
|
-
|
|
23379
|
-
|
|
23380
|
-
|
|
23501
|
+
},
|
|
23502
|
+
[options, onChange]
|
|
23503
|
+
);
|
|
23504
|
+
const sizeStyles = (0, import_react147.useMemo)(() => {
|
|
23505
|
+
const map = {
|
|
23506
|
+
sm: (0, import_react146.css)({ height: "calc(24px - 2px)", fontSize: "var(--fs-xs)" }),
|
|
23507
|
+
md: (0, import_react146.css)({ height: "calc(32px - 2px)", fontSize: "var(--fs-sm)" }),
|
|
23508
|
+
lg: (0, import_react146.css)({ height: "calc(40px - 2px)", fontSize: "var(--fs-base)" }),
|
|
23509
|
+
xl: (0, import_react146.css)({ height: "calc(48px - 2px)", fontSize: "var(--fs-base)" })
|
|
23381
23510
|
};
|
|
23382
|
-
|
|
23383
|
-
|
|
23384
|
-
|
|
23385
|
-
|
|
23386
|
-
|
|
23387
|
-
|
|
23388
|
-
|
|
23389
|
-
|
|
23390
|
-
|
|
23391
|
-
|
|
23392
|
-
|
|
23393
|
-
|
|
23394
|
-
|
|
23511
|
+
return map[size];
|
|
23512
|
+
}, [size]);
|
|
23513
|
+
const isIconOnly = (0, import_react147.useMemo)(() => {
|
|
23514
|
+
return options.every((option) => option && option.icon && !option.label);
|
|
23515
|
+
}, [options]);
|
|
23516
|
+
return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
23517
|
+
"div",
|
|
23518
|
+
{
|
|
23519
|
+
css: [segmentedControlStyles, orientation === "vertical" ? segmentedControlVerticalStyles : void 0],
|
|
23520
|
+
...props,
|
|
23521
|
+
"data-testid": "segmented-control",
|
|
23522
|
+
children: options.map((option, index) => {
|
|
23523
|
+
var _a;
|
|
23524
|
+
if (!option) {
|
|
23525
|
+
return null;
|
|
23526
|
+
}
|
|
23527
|
+
const text = option.label ? option.label : option.icon ? null : String(option.value);
|
|
23528
|
+
const isDisabled = disabled2 || option.disabled;
|
|
23529
|
+
return /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Tooltip, { title: (_a = option.tooltip) != null ? _a : "", children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
23530
|
+
"div",
|
|
23531
|
+
{
|
|
23532
|
+
css: segmentedControlItemStyles,
|
|
23533
|
+
"data-testid": option["data-testid"] ? option["data-testid"] : "container-segmented-control",
|
|
23534
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
|
|
23535
|
+
"label",
|
|
23536
|
+
{
|
|
23537
|
+
css: [
|
|
23538
|
+
segmentedControlLabelStyles(option.value === value, isDisabled),
|
|
23539
|
+
sizeStyles,
|
|
23540
|
+
isIconOnly ? segmentedControlLabelIconOnlyStyles : void 0
|
|
23541
|
+
],
|
|
23542
|
+
children: [
|
|
23543
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
23544
|
+
"input",
|
|
23545
|
+
{
|
|
23546
|
+
css: segmentedControlInputStyles,
|
|
23547
|
+
type: "radio",
|
|
23548
|
+
name,
|
|
23549
|
+
value: index,
|
|
23550
|
+
checked: option.value === value,
|
|
23551
|
+
onChange: onOptionChange,
|
|
23552
|
+
disabled: isDisabled
|
|
23553
|
+
}
|
|
23554
|
+
),
|
|
23555
|
+
option.value !== value || noCheckmark ? null : /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_CgCheck5.CgCheck, { css: segmentedControlLabelCheckStyles, "aria-label": "Selected", size: "1.5em" }),
|
|
23556
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("span", { css: segmentedControlLabelContentStyles, children: [
|
|
23557
|
+
!option.icon ? null : /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(Icon, { icon: option.icon, size: iconSize, iconColor: "currentColor" }),
|
|
23558
|
+
!text || hideOptionText ? null : /* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { css: segmentedControlLabelTextStyles, children: text })
|
|
23559
|
+
] })
|
|
23560
|
+
]
|
|
23561
|
+
}
|
|
23562
|
+
)
|
|
23563
|
+
}
|
|
23564
|
+
) }, JSON.stringify(option.value));
|
|
23565
|
+
})
|
|
23566
|
+
}
|
|
23567
|
+
);
|
|
23568
|
+
};
|
|
23569
|
+
|
|
23570
|
+
// src/components/SearchAndFilter/SortItems.tsx
|
|
23571
|
+
var import_jsx_runtime125 = require("@emotion/react/jsx-runtime");
|
|
23572
|
+
var SortItems = ({ sortByLabel = "Sort by", localeLabel = "Locale returned" }) => {
|
|
23573
|
+
var _a, _b;
|
|
23574
|
+
const { sortOptions, setSortBy, sortByValue, localeValue, localeOptions, handleLocaleChange } = useSearchAndFilter();
|
|
23575
|
+
const hideLocaleOptions = !localeOptions;
|
|
23576
|
+
const values = sortByValue.split("_");
|
|
23577
|
+
const sortDirection = values.pop();
|
|
23578
|
+
const sortField = values.join("_");
|
|
23579
|
+
const currentSelectedOption = (_b = (_a = sortOptions.find((item) => {
|
|
23580
|
+
var _a2;
|
|
23581
|
+
return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
|
|
23582
|
+
})) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
|
|
23583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
|
|
23584
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(VerticalRhythm, { gap: "xs", children: [
|
|
23585
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)("span", { css: Title, children: sortByLabel }),
|
|
23586
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { css: SortFilterInputRow, children: [
|
|
23587
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
23588
|
+
InputComboBox,
|
|
23589
|
+
{
|
|
23590
|
+
id: "sort-by-field",
|
|
23591
|
+
"aria-label": "Sort by",
|
|
23592
|
+
options: sortOptions,
|
|
23593
|
+
onChange: (e) => {
|
|
23594
|
+
const fieldName = e == null ? void 0 : e.value;
|
|
23595
|
+
setSortBy(`${fieldName}_${sortDirection}`);
|
|
23596
|
+
},
|
|
23597
|
+
styles: {
|
|
23598
|
+
menu(base) {
|
|
23599
|
+
return {
|
|
23600
|
+
...base,
|
|
23601
|
+
minWidth: "max-content"
|
|
23602
|
+
};
|
|
23603
|
+
}
|
|
23604
|
+
},
|
|
23605
|
+
value: currentSelectedOption
|
|
23606
|
+
}
|
|
23607
|
+
),
|
|
23608
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
23609
|
+
SegmentedControl,
|
|
23610
|
+
{
|
|
23611
|
+
noCheckmark: true,
|
|
23612
|
+
name: "sortBy",
|
|
23613
|
+
hideOptionText: true,
|
|
23614
|
+
iconSize: "1rem",
|
|
23615
|
+
size: "xl",
|
|
23616
|
+
options: [
|
|
23617
|
+
{
|
|
23618
|
+
label: "Ascending",
|
|
23619
|
+
icon: "arrow-up",
|
|
23620
|
+
value: `ASC`,
|
|
23621
|
+
tooltip: "Ascending (e.g. A-Z, newest to oldest)",
|
|
23622
|
+
"data-testid": "sort-ascending"
|
|
23623
|
+
},
|
|
23624
|
+
{
|
|
23625
|
+
label: "Descending",
|
|
23626
|
+
icon: "arrow-down",
|
|
23627
|
+
value: `DESC`,
|
|
23628
|
+
tooltip: "Descending (e.g. Z-A, oldest to newest)",
|
|
23629
|
+
"data-testid": "sort-descending"
|
|
23630
|
+
}
|
|
23631
|
+
],
|
|
23632
|
+
onChange: (e) => setSortBy(`${sortField}_${e}`),
|
|
23633
|
+
value: sortDirection
|
|
23634
|
+
}
|
|
23635
|
+
)
|
|
23636
|
+
] })
|
|
23637
|
+
] }),
|
|
23638
|
+
hideLocaleOptions ? null : /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(VerticalRhythm, { gap: "xs", children: [
|
|
23639
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)("span", { css: Title, children: localeLabel }),
|
|
23640
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
23641
|
+
InputSelect,
|
|
23642
|
+
{
|
|
23643
|
+
name: "localeReturned",
|
|
23644
|
+
"aria-label": "Locale returned",
|
|
23645
|
+
label: "Locale returned",
|
|
23646
|
+
showLabel: false,
|
|
23647
|
+
"data-testid": "context-locale",
|
|
23648
|
+
onChange: (e) => {
|
|
23649
|
+
var _a2;
|
|
23650
|
+
return handleLocaleChange((_a2 = e.currentTarget.value) != null ? _a2 : "");
|
|
23651
|
+
},
|
|
23652
|
+
options: localeOptions,
|
|
23653
|
+
value: localeValue
|
|
23654
|
+
}
|
|
23655
|
+
)
|
|
23656
|
+
] })
|
|
23657
|
+
] });
|
|
23658
|
+
};
|
|
23659
|
+
|
|
23660
|
+
// src/components/SearchAndFilter/FilterItem.tsx
|
|
23661
|
+
var import_jsx_runtime126 = require("@emotion/react/jsx-runtime");
|
|
23662
|
+
var FilterItem = ({
|
|
23663
|
+
index,
|
|
23664
|
+
paramOptions,
|
|
23665
|
+
operatorOptions,
|
|
23666
|
+
valueOptions,
|
|
23667
|
+
onParamChange,
|
|
23668
|
+
onOperatorChange,
|
|
23669
|
+
onValueChange
|
|
23670
|
+
}) => {
|
|
23671
|
+
var _a, _b;
|
|
23672
|
+
const { filters, handleDeleteFilter, filterOptions } = useSearchAndFilter();
|
|
23673
|
+
const label = filters[index].field !== "" ? filters[index].field : "unknown filter field";
|
|
23674
|
+
const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
|
|
23675
|
+
const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
|
|
23676
|
+
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)(() => {
|
|
23678
|
+
var _a2;
|
|
23679
|
+
const currentSelectedFilter = filterOptions.find((item) => {
|
|
23680
|
+
var _a3;
|
|
23681
|
+
return (_a3 = item.options) == null ? void 0 : _a3.find((op) => op.value === filters[index].field);
|
|
23682
|
+
});
|
|
23683
|
+
const selectedFieldValue2 = (_a2 = currentSelectedFilter == null ? void 0 : currentSelectedFilter.options) == null ? void 0 : _a2.find((item) => {
|
|
23684
|
+
return filters[index].field === item.value;
|
|
23685
|
+
});
|
|
23686
|
+
const isCurrentFieldReadOnly = selectedFieldValue2 == null ? void 0 : selectedFieldValue2.readOnly;
|
|
23687
|
+
const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
|
|
23688
|
+
return filters[index].operator === item.value;
|
|
23689
|
+
});
|
|
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
|
+
return {
|
|
23697
|
+
selectedFieldValue: selectedFieldValue2,
|
|
23698
|
+
selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
|
|
23699
|
+
selectedMetaValue: selectedMetaValue2.length > 0 ? selectedMetaValue2 : filters[index].value,
|
|
23700
|
+
readOnly: isCurrentFieldReadOnly
|
|
23701
|
+
};
|
|
23702
|
+
}, [filters, filterOptions, index, operatorOptions, valueOptions]);
|
|
23703
|
+
const readOnlyProps = readOnly ? {
|
|
23704
|
+
"aria-readonly": true,
|
|
23705
|
+
isSearchable: false,
|
|
23706
|
+
menuIsOpen: false,
|
|
23707
|
+
isClearable: false
|
|
23708
|
+
} : {};
|
|
23709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime126.jsxs)("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
|
|
23710
|
+
/* @__PURE__ */ (0, import_jsx_runtime126.jsx)("span", { children: index === 0 ? "Where" : "and" }),
|
|
23711
|
+
/* @__PURE__ */ (0, import_jsx_runtime126.jsxs)("div", { css: ConditionalInputRow, children: [
|
|
23712
|
+
/* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
23713
|
+
InputComboBox,
|
|
23714
|
+
{
|
|
23395
23715
|
"aria-label": label,
|
|
23396
23716
|
options: paramOptions,
|
|
23397
23717
|
onChange: (e) => {
|
|
@@ -23412,10 +23732,11 @@ var FilterItem = ({
|
|
|
23412
23732
|
},
|
|
23413
23733
|
value: selectedFieldValue,
|
|
23414
23734
|
...readOnlyProps,
|
|
23415
|
-
id: "filter-field"
|
|
23735
|
+
id: "filter-field",
|
|
23736
|
+
name: `filter-field-${index}`
|
|
23416
23737
|
}
|
|
23417
23738
|
),
|
|
23418
|
-
/* @__PURE__ */ (0,
|
|
23739
|
+
/* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
23419
23740
|
InputComboBox,
|
|
23420
23741
|
{
|
|
23421
23742
|
"aria-label": operatorLabel,
|
|
@@ -23435,10 +23756,11 @@ var FilterItem = ({
|
|
|
23435
23756
|
}
|
|
23436
23757
|
},
|
|
23437
23758
|
...readOnlyProps,
|
|
23438
|
-
id: "filter-operator"
|
|
23759
|
+
id: "filter-operator",
|
|
23760
|
+
name: `filter-operator-${index}`
|
|
23439
23761
|
}
|
|
23440
23762
|
),
|
|
23441
|
-
/* @__PURE__ */ (0,
|
|
23763
|
+
/* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
23442
23764
|
FilterEditorRenderer,
|
|
23443
23765
|
{
|
|
23444
23766
|
"aria-label": metaDataLabel,
|
|
@@ -23451,7 +23773,7 @@ var FilterItem = ({
|
|
|
23451
23773
|
valueTestId: "filter-value"
|
|
23452
23774
|
}
|
|
23453
23775
|
),
|
|
23454
|
-
readOnly ? null : /* @__PURE__ */ (0,
|
|
23776
|
+
readOnly || index === 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
23455
23777
|
"button",
|
|
23456
23778
|
{
|
|
23457
23779
|
type: "button",
|
|
@@ -23459,17 +23781,14 @@ var FilterItem = ({
|
|
|
23459
23781
|
"aria-label": "delete filter",
|
|
23460
23782
|
css: IconBtn,
|
|
23461
23783
|
"data-testid": "delete-filter",
|
|
23462
|
-
children: /* @__PURE__ */ (0,
|
|
23784
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(Icon, { icon: "trash", iconColor: "red", size: "1rem" })
|
|
23463
23785
|
}
|
|
23464
23786
|
)
|
|
23465
23787
|
] })
|
|
23466
23788
|
] });
|
|
23467
23789
|
};
|
|
23468
|
-
var FilterItems = ({
|
|
23469
|
-
|
|
23470
|
-
resetButtonText = "reset filters"
|
|
23471
|
-
}) => {
|
|
23472
|
-
const { filterOptions, filters, setFilters, handleAddFilter, handleResetFilters, setFilterVisibility } = useSearchAndFilter();
|
|
23790
|
+
var FilterItems = ({ addButtonText = "add condition" }) => {
|
|
23791
|
+
const { filterOptions, filters, setFilters, handleAddFilter } = useSearchAndFilter();
|
|
23473
23792
|
const handleUpdateFilter = (index, prop, value) => {
|
|
23474
23793
|
var _a, _b, _c, _d, _e;
|
|
23475
23794
|
const next = [...filters];
|
|
@@ -23498,39 +23817,25 @@ var FilterItems = ({
|
|
|
23498
23817
|
}
|
|
23499
23818
|
setFilters(next);
|
|
23500
23819
|
};
|
|
23501
|
-
return /* @__PURE__ */ (0,
|
|
23820
|
+
return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
23502
23821
|
FilterMenu,
|
|
23503
23822
|
{
|
|
23504
23823
|
id: "search-and-filter-options",
|
|
23505
23824
|
dataTestId: "search-and-filter-options",
|
|
23506
|
-
menuControls: /* @__PURE__ */ (0,
|
|
23507
|
-
|
|
23508
|
-
|
|
23509
|
-
|
|
23510
|
-
|
|
23511
|
-
|
|
23512
|
-
|
|
23513
|
-
|
|
23514
|
-
|
|
23515
|
-
|
|
23516
|
-
|
|
23517
|
-
|
|
23518
|
-
|
|
23519
|
-
|
|
23520
|
-
(filters == null ? void 0 : filters.length) ? /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(
|
|
23521
|
-
"button",
|
|
23522
|
-
{
|
|
23523
|
-
type: "button",
|
|
23524
|
-
css: ResetConditionsBtn,
|
|
23525
|
-
onClick: () => {
|
|
23526
|
-
handleResetFilters();
|
|
23527
|
-
setFilterVisibility(void 0);
|
|
23528
|
-
},
|
|
23529
|
-
"data-testid": "reset-filters",
|
|
23530
|
-
children: resetButtonText
|
|
23531
|
-
}
|
|
23532
|
-
) : null
|
|
23533
|
-
] }),
|
|
23825
|
+
menuControls: /* @__PURE__ */ (0, import_jsx_runtime126.jsxs)(
|
|
23826
|
+
"button",
|
|
23827
|
+
{
|
|
23828
|
+
type: "button",
|
|
23829
|
+
css: AddConditionalBtn,
|
|
23830
|
+
onClick: handleAddFilter,
|
|
23831
|
+
"data-testid": "add-filter",
|
|
23832
|
+
children: [
|
|
23833
|
+
/* @__PURE__ */ (0, import_jsx_runtime126.jsx)(Icon, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
|
|
23834
|
+
addButtonText
|
|
23835
|
+
]
|
|
23836
|
+
}
|
|
23837
|
+
),
|
|
23838
|
+
sortControls: /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(SortItems, {}),
|
|
23534
23839
|
children: filters.map((item, i) => {
|
|
23535
23840
|
var _a, _b, _c, _d, _e, _f;
|
|
23536
23841
|
const availableTypeOptions = (_b = (_a = filterOptions.find((fo) => {
|
|
@@ -23539,7 +23844,7 @@ var FilterItems = ({
|
|
|
23539
23844
|
})) == null ? void 0 : _a.options) != null ? _b : [];
|
|
23540
23845
|
const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
|
|
23541
23846
|
const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
|
|
23542
|
-
return /* @__PURE__ */ (0,
|
|
23847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
23543
23848
|
FilterItem,
|
|
23544
23849
|
{
|
|
23545
23850
|
index: i,
|
|
@@ -23560,283 +23865,9 @@ var FilterItems = ({
|
|
|
23560
23865
|
// src/components/SearchAndFilter/SearchAndFilter.tsx
|
|
23561
23866
|
init_emotion_jsx_shim();
|
|
23562
23867
|
|
|
23563
|
-
// src/components/SearchAndFilter/FilterModeView.tsx
|
|
23564
|
-
init_emotion_jsx_shim();
|
|
23565
|
-
|
|
23566
|
-
// src/components/SearchAndFilter/SortItems.tsx
|
|
23567
|
-
init_emotion_jsx_shim();
|
|
23568
|
-
|
|
23569
|
-
// src/components/SegmentedControl/SegmentedControl.tsx
|
|
23570
|
-
init_emotion_jsx_shim();
|
|
23571
|
-
var import_react147 = require("@emotion/react");
|
|
23572
|
-
var import_CgCheck5 = require("@react-icons/all-files/cg/CgCheck");
|
|
23573
|
-
var import_react148 = require("react");
|
|
23574
|
-
|
|
23575
|
-
// src/components/SegmentedControl/SegmentedControl.styles.ts
|
|
23576
|
-
init_emotion_jsx_shim();
|
|
23577
|
-
var import_react146 = require("@emotion/react");
|
|
23578
|
-
var segmentedControlStyles = import_react146.css`
|
|
23579
|
-
--segmented-control-rounded-value: var(--rounded-base);
|
|
23580
|
-
--segmented-control-border-width: 1px;
|
|
23581
|
-
--segmented-control-selected-color: var(--brand-secondary-3);
|
|
23582
|
-
--segmented-control-first-border-radius: var(--segmented-control-rounded-value) 0 0
|
|
23583
|
-
var(--segmented-control-rounded-value);
|
|
23584
|
-
--segmented-control-last-border-radius: 0 var(--segmented-control-rounded-value)
|
|
23585
|
-
var(--segmented-control-rounded-value) 0;
|
|
23586
|
-
|
|
23587
|
-
position: relative;
|
|
23588
|
-
display: flex;
|
|
23589
|
-
justify-content: flex-start;
|
|
23590
|
-
width: fit-content;
|
|
23591
|
-
background-color: var(--gray-300);
|
|
23592
|
-
padding: var(--segmented-control-border-width);
|
|
23593
|
-
gap: var(--segmented-control-border-width);
|
|
23594
|
-
border-radius: calc(var(--segmented-control-rounded-value) + var(--segmented-control-border-width));
|
|
23595
|
-
font-size: var(--fs-xs);
|
|
23596
|
-
`;
|
|
23597
|
-
var segmentedControlVerticalStyles = import_react146.css`
|
|
23598
|
-
flex-direction: column;
|
|
23599
|
-
--segmented-control-first-border-radius: var(--segmented-control-rounded-value)
|
|
23600
|
-
var(--segmented-control-rounded-value) 0 0;
|
|
23601
|
-
--segmented-control-last-border-radius: 0 0 var(--segmented-control-rounded-value)
|
|
23602
|
-
var(--segmented-control-rounded-value);
|
|
23603
|
-
`;
|
|
23604
|
-
var segmentedControlItemStyles = import_react146.css`
|
|
23605
|
-
&:first-of-type label {
|
|
23606
|
-
border-radius: var(--segmented-control-first-border-radius);
|
|
23607
|
-
}
|
|
23608
|
-
&:last-of-type label {
|
|
23609
|
-
border-radius: var(--segmented-control-last-border-radius);
|
|
23610
|
-
}
|
|
23611
|
-
`;
|
|
23612
|
-
var segmentedControlInputStyles = import_react146.css`
|
|
23613
|
-
${accessibleHidden}
|
|
23614
|
-
`;
|
|
23615
|
-
var segmentedControlLabelStyles = (checked, disabled2) => import_react146.css`
|
|
23616
|
-
position: relative;
|
|
23617
|
-
display: flex;
|
|
23618
|
-
align-items: center;
|
|
23619
|
-
justify-content: center;
|
|
23620
|
-
height: 2rem;
|
|
23621
|
-
padding-inline: var(--spacing-base);
|
|
23622
|
-
background-color: white;
|
|
23623
|
-
transition-property: background-color, color, box-shadow;
|
|
23624
|
-
transition-duration: var(--duration-xfast);
|
|
23625
|
-
transition-timing-function: ease-in-out;
|
|
23626
|
-
z-index: 1;
|
|
23627
|
-
cursor: pointer;
|
|
23628
|
-
|
|
23629
|
-
&:has(:checked:not(:disabled)) {
|
|
23630
|
-
background-color: var(--segmented-control-selected-color);
|
|
23631
|
-
outline: var(--segmented-control-border-width) solid var(--segmented-control-selected-color);
|
|
23632
|
-
box-shadow: 0 0.43em 1.7em 0 rgba(0, 0, 0, 0.15);
|
|
23633
|
-
color: white;
|
|
23634
|
-
-webkit-text-stroke-width: thin;
|
|
23635
|
-
z-index: 0;
|
|
23636
|
-
}
|
|
23637
|
-
|
|
23638
|
-
&:hover:not(:has(:disabled, :checked)) {
|
|
23639
|
-
background-color: var(--gray-100);
|
|
23640
|
-
}
|
|
23641
|
-
|
|
23642
|
-
&:has(:disabled) {
|
|
23643
|
-
color: var(--gray-400);
|
|
23644
|
-
cursor: default;
|
|
23645
|
-
}
|
|
23646
|
-
|
|
23647
|
-
&:has(:checked:disabled) {
|
|
23648
|
-
color: var(--gray-50);
|
|
23649
|
-
background-color: var(--gray-400);
|
|
23650
|
-
}
|
|
23651
|
-
|
|
23652
|
-
// Firefox fallback using emotion variables
|
|
23653
|
-
// we can delete this whole block of code and variables in SegmentedControl.tsx
|
|
23654
|
-
// once Firefox supports :has selector
|
|
23655
|
-
@supports not selector(:has(*)) {
|
|
23656
|
-
// equivalent to &:has(:checked:not(:disabled))
|
|
23657
|
-
${checked && !disabled2 ? `
|
|
23658
|
-
background-color: var(--segmented-control-selected-color);
|
|
23659
|
-
outline: var(--segmented-control-border-width) solid var(--segmented-control-selected-color);
|
|
23660
|
-
box-shadow: 0 0.43em 1.7em 0 rgba(0, 0, 0, 0.15);
|
|
23661
|
-
color: white;
|
|
23662
|
-
-webkit-text-stroke-width: thin;
|
|
23663
|
-
z-index: 0;` : void 0}
|
|
23664
|
-
|
|
23665
|
-
// equivalent to &:hover:not(:has(:disabled, :checked))
|
|
23666
|
-
&:hover {
|
|
23667
|
-
${!checked && !disabled2 ? `background-color: var(--gray-100);` : void 0}
|
|
23668
|
-
}
|
|
23669
|
-
|
|
23670
|
-
// equivalent to &:has(:disabled)
|
|
23671
|
-
${disabled2 ? `
|
|
23672
|
-
color: var(--gray-400);
|
|
23673
|
-
cursor: default;` : void 0}
|
|
23674
|
-
|
|
23675
|
-
// equivalent to &:has(:checked:disabled)
|
|
23676
|
-
${checked && disabled2 && `
|
|
23677
|
-
color: var(--gray-50);
|
|
23678
|
-
background-color: var(--gray-400);
|
|
23679
|
-
`}
|
|
23680
|
-
}
|
|
23681
|
-
`;
|
|
23682
|
-
var segmentedControlLabelIconOnlyStyles = import_react146.css`
|
|
23683
|
-
padding-inline: 0.5em;
|
|
23684
|
-
`;
|
|
23685
|
-
var segmentedControlLabelCheckStyles = import_react146.css`
|
|
23686
|
-
opacity: 0.5;
|
|
23687
|
-
`;
|
|
23688
|
-
var segmentedControlLabelContentStyles = import_react146.css`
|
|
23689
|
-
display: flex;
|
|
23690
|
-
align-items: center;
|
|
23691
|
-
justify-content: center;
|
|
23692
|
-
gap: var(--spacing-sm);
|
|
23693
|
-
height: 100%;
|
|
23694
|
-
`;
|
|
23695
|
-
var segmentedControlLabelTextStyles = import_react146.css``;
|
|
23696
|
-
|
|
23697
|
-
// src/components/SegmentedControl/SegmentedControl.tsx
|
|
23698
|
-
var import_jsx_runtime125 = require("@emotion/react/jsx-runtime");
|
|
23699
|
-
var SegmentedControl = ({
|
|
23700
|
-
name,
|
|
23701
|
-
options,
|
|
23702
|
-
value,
|
|
23703
|
-
onChange,
|
|
23704
|
-
noCheckmark = false,
|
|
23705
|
-
disabled: disabled2 = false,
|
|
23706
|
-
orientation = "horizontal",
|
|
23707
|
-
size = "md",
|
|
23708
|
-
...props
|
|
23709
|
-
}) => {
|
|
23710
|
-
const onOptionChange = (0, import_react148.useCallback)(
|
|
23711
|
-
(event) => {
|
|
23712
|
-
if (event.target.checked) {
|
|
23713
|
-
onChange == null ? void 0 : onChange(options[parseInt(event.target.value)].value);
|
|
23714
|
-
}
|
|
23715
|
-
},
|
|
23716
|
-
[options, onChange]
|
|
23717
|
-
);
|
|
23718
|
-
const sizeStyles = (0, import_react148.useMemo)(() => {
|
|
23719
|
-
const map = {
|
|
23720
|
-
sm: (0, import_react147.css)({ height: "calc(24px - 2px)", fontSize: "var(--fs-xs)" }),
|
|
23721
|
-
md: (0, import_react147.css)({ height: "calc(32px - 2px)", fontSize: "var(--fs-sm)" }),
|
|
23722
|
-
lg: (0, import_react147.css)({ height: "calc(40px - 2px)", fontSize: "var(--fs-base)" })
|
|
23723
|
-
};
|
|
23724
|
-
return map[size];
|
|
23725
|
-
}, [size]);
|
|
23726
|
-
const isIconOnly = (0, import_react148.useMemo)(() => {
|
|
23727
|
-
return options.every((option) => option && option.icon && !option.label);
|
|
23728
|
-
}, [options]);
|
|
23729
|
-
return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
23730
|
-
"div",
|
|
23731
|
-
{
|
|
23732
|
-
css: [segmentedControlStyles, orientation === "vertical" ? segmentedControlVerticalStyles : void 0],
|
|
23733
|
-
...props,
|
|
23734
|
-
"data-testid": "segmented-control",
|
|
23735
|
-
children: options.map((option, index) => {
|
|
23736
|
-
var _a;
|
|
23737
|
-
if (!option) {
|
|
23738
|
-
return null;
|
|
23739
|
-
}
|
|
23740
|
-
const text = option.label ? option.label : option.icon ? null : String(option.value);
|
|
23741
|
-
const isDisabled = disabled2 || option.disabled;
|
|
23742
|
-
return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Tooltip, { title: (_a = option.tooltip) != null ? _a : "", children: /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("div", { css: segmentedControlItemStyles, "data-testid": "container-segmented-control", children: /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(
|
|
23743
|
-
"label",
|
|
23744
|
-
{
|
|
23745
|
-
css: [
|
|
23746
|
-
segmentedControlLabelStyles(option.value === value, isDisabled),
|
|
23747
|
-
sizeStyles,
|
|
23748
|
-
isIconOnly ? segmentedControlLabelIconOnlyStyles : void 0
|
|
23749
|
-
],
|
|
23750
|
-
children: [
|
|
23751
|
-
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
23752
|
-
"input",
|
|
23753
|
-
{
|
|
23754
|
-
css: segmentedControlInputStyles,
|
|
23755
|
-
type: "radio",
|
|
23756
|
-
name,
|
|
23757
|
-
value: index,
|
|
23758
|
-
checked: option.value === value,
|
|
23759
|
-
onChange: onOptionChange,
|
|
23760
|
-
disabled: isDisabled
|
|
23761
|
-
}
|
|
23762
|
-
),
|
|
23763
|
-
option.value !== value || noCheckmark ? null : /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(import_CgCheck5.CgCheck, { css: segmentedControlLabelCheckStyles, "aria-label": "Selected", size: "1.5em" }),
|
|
23764
|
-
/* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("span", { css: segmentedControlLabelContentStyles, children: [
|
|
23765
|
-
!option.icon ? null : /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(Icon, { icon: option.icon, size: "1.5em", iconColor: "currentColor" }),
|
|
23766
|
-
!text ? null : /* @__PURE__ */ (0, import_jsx_runtime125.jsx)("span", { css: segmentedControlLabelTextStyles, children: text })
|
|
23767
|
-
] })
|
|
23768
|
-
]
|
|
23769
|
-
}
|
|
23770
|
-
) }) }, JSON.stringify(option.value));
|
|
23771
|
-
})
|
|
23772
|
-
}
|
|
23773
|
-
);
|
|
23774
|
-
};
|
|
23775
|
-
|
|
23776
|
-
// src/components/SearchAndFilter/SortItems.tsx
|
|
23777
|
-
var import_jsx_runtime126 = require("@emotion/react/jsx-runtime");
|
|
23778
|
-
var SortItems = () => {
|
|
23779
|
-
var _a, _b;
|
|
23780
|
-
const { sortOptions, setSortBy, sortByValue } = useSearchAndFilter();
|
|
23781
|
-
const values = sortByValue.split("_");
|
|
23782
|
-
const sortDirection = values.pop();
|
|
23783
|
-
const sortField = values.join("_");
|
|
23784
|
-
const currentSelectedOption = (_b = (_a = sortOptions.find((item) => {
|
|
23785
|
-
var _a2;
|
|
23786
|
-
return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
|
|
23787
|
-
})) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
|
|
23788
|
-
return /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(FilterMenu, { id: "search-and-filter-options", filterTitle: "Sort by", dataTestId: "sorting-options", children: /* @__PURE__ */ (0, import_jsx_runtime126.jsxs)("div", { css: SortFilterInputRow, children: [
|
|
23789
|
-
/* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
23790
|
-
InputComboBox,
|
|
23791
|
-
{
|
|
23792
|
-
options: sortOptions,
|
|
23793
|
-
onChange: (e) => {
|
|
23794
|
-
const fieldName = e == null ? void 0 : e.value;
|
|
23795
|
-
setSortBy(`${fieldName}_${sortDirection}`);
|
|
23796
|
-
},
|
|
23797
|
-
styles: {
|
|
23798
|
-
menu(base) {
|
|
23799
|
-
return {
|
|
23800
|
-
...base,
|
|
23801
|
-
minWidth: "max-content"
|
|
23802
|
-
};
|
|
23803
|
-
}
|
|
23804
|
-
},
|
|
23805
|
-
value: currentSelectedOption,
|
|
23806
|
-
id: "sort-by-field"
|
|
23807
|
-
}
|
|
23808
|
-
),
|
|
23809
|
-
/* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
23810
|
-
SegmentedControl,
|
|
23811
|
-
{
|
|
23812
|
-
noCheckmark: true,
|
|
23813
|
-
name: "sortBy",
|
|
23814
|
-
options: [
|
|
23815
|
-
{ label: "Ascending", value: `ASC` },
|
|
23816
|
-
{ label: "Descending", value: `DESC` }
|
|
23817
|
-
],
|
|
23818
|
-
onChange: (e) => setSortBy(`${sortField}_${e}`),
|
|
23819
|
-
value: sortDirection,
|
|
23820
|
-
"data-testid": "ordering-options"
|
|
23821
|
-
}
|
|
23822
|
-
)
|
|
23823
|
-
] }) });
|
|
23824
|
-
};
|
|
23825
|
-
|
|
23826
|
-
// src/components/SearchAndFilter/FilterModeView.tsx
|
|
23827
|
-
var import_jsx_runtime127 = require("@emotion/react/jsx-runtime");
|
|
23828
|
-
var FilterModeView = () => {
|
|
23829
|
-
const { filterVisibility } = useSearchAndFilter();
|
|
23830
|
-
const modeView = {
|
|
23831
|
-
filters: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(FilterItems, {}),
|
|
23832
|
-
sort: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(SortItems, {})
|
|
23833
|
-
};
|
|
23834
|
-
return filterVisibility ? modeView[filterVisibility] : null;
|
|
23835
|
-
};
|
|
23836
|
-
|
|
23837
23868
|
// src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
|
|
23838
23869
|
init_emotion_jsx_shim();
|
|
23839
|
-
var
|
|
23870
|
+
var import_jsx_runtime127 = require("@emotion/react/jsx-runtime");
|
|
23840
23871
|
var SearchAndFilterResultContainer = ({
|
|
23841
23872
|
buttonText,
|
|
23842
23873
|
clearButtonLabel = "clear",
|
|
@@ -23870,46 +23901,49 @@ var SearchAndFilterResultContainer = ({
|
|
|
23870
23901
|
if (totalResults && totalResults > 0) {
|
|
23871
23902
|
return null;
|
|
23872
23903
|
}
|
|
23873
|
-
return /* @__PURE__ */ (0,
|
|
23874
|
-
/* @__PURE__ */ (0,
|
|
23875
|
-
/* @__PURE__ */ (0,
|
|
23904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(import_jsx_runtime127.Fragment, { children: [
|
|
23905
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(HorizontalRhythm, { children: [
|
|
23906
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsxs)("span", { children: [
|
|
23876
23907
|
totalResults,
|
|
23877
23908
|
" results ",
|
|
23878
23909
|
searchTerm ? `for "${searchTerm}"` : null
|
|
23879
23910
|
] }),
|
|
23880
|
-
!searchTerm ? null : /* @__PURE__ */ (0,
|
|
23911
|
+
!searchTerm ? null : /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(Button, { buttonType: "ghostDestructive", size: "zero", onClick: () => setSearchTerm(""), children: clearButtonLabel })
|
|
23881
23912
|
] }),
|
|
23882
|
-
totalResults === 0 ? /* @__PURE__ */ (0,
|
|
23883
|
-
calloutText ? /* @__PURE__ */ (0,
|
|
23884
|
-
/* @__PURE__ */ (0,
|
|
23913
|
+
totalResults === 0 ? /* @__PURE__ */ (0, import_jsx_runtime127.jsxs)(Callout, { title: calloutTitle2 != null ? calloutTitle2 : automateCalloutTitle(), type: "note", children: [
|
|
23914
|
+
calloutText ? /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(Paragraph, { children: calloutText }) : null,
|
|
23915
|
+
/* @__PURE__ */ (0, import_jsx_runtime127.jsx)(Button, { buttonType: "tertiaryOutline", size: "xs", onClick: onHandleClear != null ? onHandleClear : handleResetFilters, children: buttonText != null ? buttonText : "Clear search" })
|
|
23885
23916
|
] }) : null
|
|
23886
23917
|
] });
|
|
23887
23918
|
};
|
|
23888
23919
|
|
|
23889
23920
|
// src/components/SearchAndFilter/SearchAndFilter.tsx
|
|
23890
|
-
var
|
|
23921
|
+
var import_jsx_runtime128 = require("@emotion/react/jsx-runtime");
|
|
23891
23922
|
var SearchAndFilter = ({
|
|
23892
23923
|
filters,
|
|
23893
23924
|
filterOptions,
|
|
23894
|
-
|
|
23925
|
+
filterVisible,
|
|
23895
23926
|
sortOptions,
|
|
23896
23927
|
defaultSortByValue,
|
|
23897
23928
|
filterControls,
|
|
23898
23929
|
viewSwitchControls,
|
|
23899
|
-
resultsContainerView = /* @__PURE__ */ (0,
|
|
23900
|
-
children = /* @__PURE__ */ (0,
|
|
23930
|
+
resultsContainerView = /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(SearchAndFilterResultContainer, {}),
|
|
23931
|
+
children = /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(FilterItems, {}),
|
|
23901
23932
|
onChange,
|
|
23902
23933
|
onSearchChange,
|
|
23903
23934
|
onSortChange,
|
|
23935
|
+
onLocaleChange,
|
|
23904
23936
|
totalResults,
|
|
23905
|
-
resetFilterValues = []
|
|
23937
|
+
resetFilterValues = [],
|
|
23938
|
+
defaultLocale,
|
|
23939
|
+
localeOptions
|
|
23906
23940
|
}) => {
|
|
23907
|
-
return /* @__PURE__ */ (0,
|
|
23941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
23908
23942
|
SearchAndFilterProvider,
|
|
23909
23943
|
{
|
|
23910
23944
|
filters,
|
|
23911
23945
|
filterOptions,
|
|
23912
|
-
|
|
23946
|
+
filterVisible,
|
|
23913
23947
|
defaultSortByValue,
|
|
23914
23948
|
sortOptions,
|
|
23915
23949
|
onChange,
|
|
@@ -23917,15 +23951,18 @@ var SearchAndFilter = ({
|
|
|
23917
23951
|
onSortChange,
|
|
23918
23952
|
totalResults,
|
|
23919
23953
|
resetFilterValues,
|
|
23920
|
-
|
|
23921
|
-
|
|
23922
|
-
|
|
23954
|
+
defaultLocale,
|
|
23955
|
+
localeOptions,
|
|
23956
|
+
onLocaleChange,
|
|
23957
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime128.jsxs)(VerticalRhythm, { css: SearchAndFilterContainer, "data-testid": "search-and-filter", children: [
|
|
23958
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsxs)("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
|
|
23959
|
+
/* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
23923
23960
|
"div",
|
|
23924
23961
|
{
|
|
23925
23962
|
css: SearchAndFilterControlsWrapper(
|
|
23926
|
-
viewSwitchControls ? "auto
|
|
23963
|
+
viewSwitchControls ? "auto 1fr 0.05fr" : "auto auto 1fr"
|
|
23927
23964
|
),
|
|
23928
|
-
children: !filterControls ? /* @__PURE__ */ (0,
|
|
23965
|
+
children: !filterControls ? /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
|
|
23929
23966
|
}
|
|
23930
23967
|
),
|
|
23931
23968
|
viewSwitchControls
|
|
@@ -23941,7 +23978,7 @@ var SearchAndFilter = ({
|
|
|
23941
23978
|
init_emotion_jsx_shim();
|
|
23942
23979
|
var import_react149 = require("react");
|
|
23943
23980
|
var import_react_use5 = require("react-use");
|
|
23944
|
-
var
|
|
23981
|
+
var import_jsx_runtime129 = require("@emotion/react/jsx-runtime");
|
|
23945
23982
|
var SearchOnlyContext = (0, import_react149.createContext)({
|
|
23946
23983
|
searchTerm: "",
|
|
23947
23984
|
setSearchTerm: () => {
|
|
@@ -23958,14 +23995,14 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
|
|
|
23958
23995
|
300,
|
|
23959
23996
|
[localeSearchTerm]
|
|
23960
23997
|
);
|
|
23961
|
-
return /* @__PURE__ */ (0,
|
|
23998
|
+
return /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
23962
23999
|
SearchOnlyContext.Provider,
|
|
23963
24000
|
{
|
|
23964
24001
|
value: {
|
|
23965
24002
|
searchTerm,
|
|
23966
24003
|
setSearchTerm: setLocaleSearchTerm
|
|
23967
24004
|
},
|
|
23968
|
-
children: /* @__PURE__ */ (0,
|
|
24005
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
23969
24006
|
InputKeywordSearch,
|
|
23970
24007
|
{
|
|
23971
24008
|
placeholder: "Search...",
|
|
@@ -23995,7 +24032,7 @@ var skeletonStyles = import_react150.css`
|
|
|
23995
24032
|
`;
|
|
23996
24033
|
|
|
23997
24034
|
// src/components/Skeleton/Skeleton.tsx
|
|
23998
|
-
var
|
|
24035
|
+
var import_jsx_runtime130 = require("@emotion/react/jsx-runtime");
|
|
23999
24036
|
var Skeleton = ({
|
|
24000
24037
|
width = "100%",
|
|
24001
24038
|
height = "1.25rem",
|
|
@@ -24003,7 +24040,7 @@ var Skeleton = ({
|
|
|
24003
24040
|
circle = false,
|
|
24004
24041
|
children,
|
|
24005
24042
|
...otherProps
|
|
24006
|
-
}) => /* @__PURE__ */ (0,
|
|
24043
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime130.jsx)(
|
|
24007
24044
|
"div",
|
|
24008
24045
|
{
|
|
24009
24046
|
css: [
|
|
@@ -24112,19 +24149,19 @@ var SwitchText = import_react151.css`
|
|
|
24112
24149
|
`;
|
|
24113
24150
|
|
|
24114
24151
|
// src/components/Switch/Switch.tsx
|
|
24115
|
-
var
|
|
24152
|
+
var import_jsx_runtime131 = require("@emotion/react/jsx-runtime");
|
|
24116
24153
|
var Switch = React26.forwardRef(
|
|
24117
24154
|
({ label, infoText, toggleText, children, ...inputProps }, ref) => {
|
|
24118
24155
|
let additionalText = infoText;
|
|
24119
24156
|
if (infoText && toggleText) {
|
|
24120
24157
|
additionalText = inputProps.checked ? toggleText : infoText;
|
|
24121
24158
|
}
|
|
24122
|
-
return /* @__PURE__ */ (0,
|
|
24123
|
-
/* @__PURE__ */ (0,
|
|
24124
|
-
/* @__PURE__ */ (0,
|
|
24125
|
-
/* @__PURE__ */ (0,
|
|
24159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime131.jsxs)(import_jsx_runtime131.Fragment, { children: [
|
|
24160
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsxs)("label", { css: [SwitchInputContainer, inputProps.disabled ? SwitchInputDisabled : void 0], children: [
|
|
24161
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)("input", { type: "checkbox", css: SwitchInput, ...inputProps, ref }),
|
|
24162
|
+
/* @__PURE__ */ (0, import_jsx_runtime131.jsx)("span", { css: SwitchInputLabel, children: label })
|
|
24126
24163
|
] }),
|
|
24127
|
-
additionalText ? /* @__PURE__ */ (0,
|
|
24164
|
+
additionalText ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("p", { css: SwitchText, children: additionalText }) : null,
|
|
24128
24165
|
children
|
|
24129
24166
|
] });
|
|
24130
24167
|
}
|
|
@@ -24163,40 +24200,40 @@ var tableCellHead = import_react152.css`
|
|
|
24163
24200
|
`;
|
|
24164
24201
|
|
|
24165
24202
|
// src/components/Table/Table.tsx
|
|
24166
|
-
var
|
|
24203
|
+
var import_jsx_runtime132 = require("@emotion/react/jsx-runtime");
|
|
24167
24204
|
var Table = React27.forwardRef(
|
|
24168
24205
|
({ children, cellPadding, ...otherProps }, ref) => {
|
|
24169
|
-
return /* @__PURE__ */ (0,
|
|
24206
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("table", { ref, css: table({ cellPadding }), ...otherProps, children });
|
|
24170
24207
|
}
|
|
24171
24208
|
);
|
|
24172
24209
|
var TableHead = React27.forwardRef(
|
|
24173
24210
|
({ children, ...otherProps }, ref) => {
|
|
24174
|
-
return /* @__PURE__ */ (0,
|
|
24211
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("thead", { ref, css: tableHead, ...otherProps, children });
|
|
24175
24212
|
}
|
|
24176
24213
|
);
|
|
24177
24214
|
var TableBody = React27.forwardRef(
|
|
24178
24215
|
({ children, ...otherProps }, ref) => {
|
|
24179
|
-
return /* @__PURE__ */ (0,
|
|
24216
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("tbody", { ref, ...otherProps, children });
|
|
24180
24217
|
}
|
|
24181
24218
|
);
|
|
24182
24219
|
var TableFoot = React27.forwardRef(
|
|
24183
24220
|
({ children, ...otherProps }, ref) => {
|
|
24184
|
-
return /* @__PURE__ */ (0,
|
|
24221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("tfoot", { ref, ...otherProps, children });
|
|
24185
24222
|
}
|
|
24186
24223
|
);
|
|
24187
24224
|
var TableRow = React27.forwardRef(
|
|
24188
24225
|
({ children, ...otherProps }, ref) => {
|
|
24189
|
-
return /* @__PURE__ */ (0,
|
|
24226
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("tr", { ref, css: tableRow, ...otherProps, children });
|
|
24190
24227
|
}
|
|
24191
24228
|
);
|
|
24192
24229
|
var TableCellHead = React27.forwardRef(
|
|
24193
24230
|
({ children, ...otherProps }, ref) => {
|
|
24194
|
-
return /* @__PURE__ */ (0,
|
|
24231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("th", { ref, css: tableCellHead, ...otherProps, children });
|
|
24195
24232
|
}
|
|
24196
24233
|
);
|
|
24197
24234
|
var TableCellData = React27.forwardRef(
|
|
24198
24235
|
({ children, ...otherProps }, ref) => {
|
|
24199
|
-
return /* @__PURE__ */ (0,
|
|
24236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime132.jsx)("td", { ref, ...otherProps, children });
|
|
24200
24237
|
}
|
|
24201
24238
|
);
|
|
24202
24239
|
|
|
@@ -24232,7 +24269,7 @@ var tabButtonGroupStyles = import_react153.css`
|
|
|
24232
24269
|
`;
|
|
24233
24270
|
|
|
24234
24271
|
// src/components/Tabs/Tabs.tsx
|
|
24235
|
-
var
|
|
24272
|
+
var import_jsx_runtime133 = require("@emotion/react/jsx-runtime");
|
|
24236
24273
|
var useCurrentTab = () => {
|
|
24237
24274
|
const context = (0, import_react154.useTabStore)();
|
|
24238
24275
|
if (!context) {
|
|
@@ -24270,23 +24307,23 @@ var Tabs = ({
|
|
|
24270
24307
|
tab.setSelectedId(selected);
|
|
24271
24308
|
}
|
|
24272
24309
|
}, [selected, tab]);
|
|
24273
|
-
return /* @__PURE__ */ (0,
|
|
24310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_react154.TabProvider, { store: tab, setSelectedId: onTabSelect, children });
|
|
24274
24311
|
};
|
|
24275
24312
|
var TabButtonGroup = ({ children, ...props }) => {
|
|
24276
|
-
return /* @__PURE__ */ (0,
|
|
24313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_react154.TabList, { ...props, css: tabButtonGroupStyles, children });
|
|
24277
24314
|
};
|
|
24278
24315
|
var TabButton = ({
|
|
24279
24316
|
children,
|
|
24280
24317
|
id,
|
|
24281
24318
|
...props
|
|
24282
24319
|
}) => {
|
|
24283
|
-
return /* @__PURE__ */ (0,
|
|
24320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_react154.Tab, { type: "button", id, ...props, css: tabButtonStyles, children });
|
|
24284
24321
|
};
|
|
24285
24322
|
var TabContent = ({
|
|
24286
24323
|
children,
|
|
24287
24324
|
...props
|
|
24288
24325
|
}) => {
|
|
24289
|
-
return /* @__PURE__ */ (0,
|
|
24326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(import_react154.TabPanel, { ...props, children });
|
|
24290
24327
|
};
|
|
24291
24328
|
|
|
24292
24329
|
// src/components/Toast/Toast.tsx
|
|
@@ -24519,9 +24556,9 @@ var toastContainerStyles = import_react156.css`
|
|
|
24519
24556
|
`;
|
|
24520
24557
|
|
|
24521
24558
|
// src/components/Toast/Toast.tsx
|
|
24522
|
-
var
|
|
24559
|
+
var import_jsx_runtime134 = require("@emotion/react/jsx-runtime");
|
|
24523
24560
|
var ToastContainer = ({ limit = 4 }) => {
|
|
24524
|
-
return /* @__PURE__ */ (0,
|
|
24561
|
+
return /* @__PURE__ */ (0, import_jsx_runtime134.jsx)(
|
|
24525
24562
|
import_react_toastify.ToastContainer,
|
|
24526
24563
|
{
|
|
24527
24564
|
css: toastContainerStyles,
|
|
@@ -24624,6 +24661,7 @@ var ToastContainer = ({ limit = 4 }) => {
|
|
|
24624
24661
|
ModalDialog,
|
|
24625
24662
|
MultilineChip,
|
|
24626
24663
|
NUMBER_OPERATORS,
|
|
24664
|
+
PUBLISH_STATUS_FIELD_OPERATORS,
|
|
24627
24665
|
PageHeaderSection,
|
|
24628
24666
|
Pagination,
|
|
24629
24667
|
Paragraph,
|