@uniformdev/design-system 19.134.0 → 19.134.3-alpha.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +354 -289
- package/dist/index.d.mts +124 -8
- package/dist/index.d.ts +124 -8
- package/dist/index.js +376 -300
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -1371,6 +1371,8 @@ __export(src_exports, {
|
|
|
1371
1371
|
CurrentDrawerContext: () => CurrentDrawerContext,
|
|
1372
1372
|
DATE_OPERATORS: () => DATE_OPERATORS,
|
|
1373
1373
|
DashedBox: () => DashedBox,
|
|
1374
|
+
DateEditor: () => DateEditor,
|
|
1375
|
+
DateRangeEditor: () => DateRangeEditor,
|
|
1374
1376
|
DateTimePicker: () => DateTimePicker,
|
|
1375
1377
|
DateTimePickerVariant: () => DateTimePickerVariant,
|
|
1376
1378
|
DebouncedInputKeywordSearch: () => DebouncedInputKeywordSearch,
|
|
@@ -1386,9 +1388,12 @@ __export(src_exports, {
|
|
|
1386
1388
|
Fieldset: () => Fieldset,
|
|
1387
1389
|
FilterButton: () => FilterButton2,
|
|
1388
1390
|
FilterControls: () => FilterControls,
|
|
1391
|
+
FilterEditorRenderer: () => FilterEditorRenderer,
|
|
1389
1392
|
FilterItem: () => FilterItem,
|
|
1390
1393
|
FilterItems: () => FilterItems,
|
|
1391
1394
|
FilterMenu: () => FilterMenu,
|
|
1395
|
+
FilterMultiChoiceEditor: () => FilterMultiChoiceEditor,
|
|
1396
|
+
FilterSingleChoiceEditor: () => FilterSingleChoiceEditor,
|
|
1392
1397
|
Heading: () => Heading,
|
|
1393
1398
|
HexModalBackground: () => HexModalBackground,
|
|
1394
1399
|
HorizontalRhythm: () => HorizontalRhythm,
|
|
@@ -1435,6 +1440,8 @@ __export(src_exports, {
|
|
|
1435
1440
|
ModalDialog: () => ModalDialog,
|
|
1436
1441
|
MultilineChip: () => MultilineChip,
|
|
1437
1442
|
NUMBER_OPERATORS: () => NUMBER_OPERATORS,
|
|
1443
|
+
NumberEditor: () => NumberEditor,
|
|
1444
|
+
NumberRangeEditor: () => NumberRangeEditor,
|
|
1438
1445
|
PageHeaderSection: () => PageHeaderSection,
|
|
1439
1446
|
Pagination: () => Pagination,
|
|
1440
1447
|
Paragraph: () => Paragraph,
|
|
@@ -1487,6 +1494,8 @@ __export(src_exports, {
|
|
|
1487
1494
|
ShortcutRevealer: () => ShortcutRevealer,
|
|
1488
1495
|
Skeleton: () => Skeleton,
|
|
1489
1496
|
StatusBullet: () => StatusBullet,
|
|
1497
|
+
StatusMultiEditor: () => StatusMultiEditor,
|
|
1498
|
+
StatusSingleEditor: () => StatusSingleEditor,
|
|
1490
1499
|
SuccessMessage: () => SuccessMessage,
|
|
1491
1500
|
Switch: () => Switch,
|
|
1492
1501
|
TAKEOVER_STACK_ID: () => TAKEOVER_STACK_ID,
|
|
@@ -1503,6 +1512,7 @@ __export(src_exports, {
|
|
|
1503
1512
|
TableRow: () => TableRow,
|
|
1504
1513
|
Tabs: () => Tabs,
|
|
1505
1514
|
TakeoverDrawerRenderer: () => TakeoverDrawerRenderer,
|
|
1515
|
+
TextEditor: () => TextEditor,
|
|
1506
1516
|
Textarea: () => Textarea,
|
|
1507
1517
|
Theme: () => Theme,
|
|
1508
1518
|
Tile: () => Tile2,
|
|
@@ -1547,6 +1557,7 @@ __export(src_exports, {
|
|
|
1547
1557
|
fadeInRtl: () => fadeInRtl,
|
|
1548
1558
|
fadeInTop: () => fadeInTop,
|
|
1549
1559
|
fadeOutBottom: () => fadeOutBottom,
|
|
1560
|
+
filterMapper: () => filterMapper,
|
|
1550
1561
|
fullWidthScreenIcon: () => fullWidthScreenIcon,
|
|
1551
1562
|
getDrawerAttributes: () => getDrawerAttributes,
|
|
1552
1563
|
getParentPath: () => getParentPath,
|
|
@@ -13529,7 +13540,7 @@ function isMenuSeparator(child) {
|
|
|
13529
13540
|
// src/components/Menu/Menu.styles.ts
|
|
13530
13541
|
init_emotion_jsx_shim();
|
|
13531
13542
|
var import_react35 = require("@emotion/react");
|
|
13532
|
-
var menuStyles = import_react35.css`
|
|
13543
|
+
var menuStyles = (maxMenuHeight) => import_react35.css`
|
|
13533
13544
|
box-shadow: var(--shadow-base);
|
|
13534
13545
|
border-radius: var(--rounded-base);
|
|
13535
13546
|
background: var(--gray-50);
|
|
@@ -13539,10 +13550,21 @@ var menuStyles = import_react35.css`
|
|
|
13539
13550
|
outline: none;
|
|
13540
13551
|
position: relative;
|
|
13541
13552
|
z-index: var(--z-50);
|
|
13542
|
-
|
|
13543
13553
|
&:focus {
|
|
13544
13554
|
outline: none;
|
|
13545
13555
|
}
|
|
13556
|
+
|
|
13557
|
+
// resolves uni-2997 for smaller screens not being able to access large menus
|
|
13558
|
+
// the code was removed in https://github.com/uniformdev/platform/commit/0067e6c87aaf29147c656949bbf49d632d3e89dc#diff-84f70b10af4d4ec4f57c535e3c44b04c30ce95ac337ce21db9f1ffd8393a846d
|
|
13559
|
+
// but we need to keep it for the Menu component if the menu is larger than the screen
|
|
13560
|
+
${maxMenuHeight ? `
|
|
13561
|
+
overflow-x: hidden;
|
|
13562
|
+
overflow-y: auto;
|
|
13563
|
+
height: min(${maxMenuHeight}, var(--popover-available-height));
|
|
13564
|
+
scroll-snap-align: start;
|
|
13565
|
+
scroll-snap-stop: always;
|
|
13566
|
+
${scrollbarStyles}
|
|
13567
|
+
` : ""}
|
|
13546
13568
|
`;
|
|
13547
13569
|
|
|
13548
13570
|
// src/components/Menu/Menu.tsx
|
|
@@ -13558,6 +13580,7 @@ var Menu = React8.forwardRef(function Menu2({
|
|
|
13558
13580
|
disableAutoSeparatorManagement,
|
|
13559
13581
|
menuItemsContainerCssClasses,
|
|
13560
13582
|
testId,
|
|
13583
|
+
maxMenuHeight,
|
|
13561
13584
|
...props
|
|
13562
13585
|
}, ref) {
|
|
13563
13586
|
const placementOverride = legacyPlacements.includes(placement) ? void 0 : placement;
|
|
@@ -13572,7 +13595,7 @@ var Menu = React8.forwardRef(function Menu2({
|
|
|
13572
13595
|
shift: menu.parent ? -4 : 0,
|
|
13573
13596
|
...props,
|
|
13574
13597
|
css: [
|
|
13575
|
-
menuStyles,
|
|
13598
|
+
menuStyles(maxMenuHeight),
|
|
13576
13599
|
typeof menuItemsContainerCssClasses === "object" ? menuItemsContainerCssClasses : void 0
|
|
13577
13600
|
],
|
|
13578
13601
|
className: typeof menuItemsContainerCssClasses === "string" ? menuItemsContainerCssClasses : "",
|
|
@@ -13825,6 +13848,7 @@ var ButtonWithMenu = ({
|
|
|
13825
13848
|
size = "lg",
|
|
13826
13849
|
menuContainerCssClasses,
|
|
13827
13850
|
withoutPortal = false,
|
|
13851
|
+
maxMenuHeight,
|
|
13828
13852
|
...buttonProps
|
|
13829
13853
|
}) => {
|
|
13830
13854
|
const buttonTheme = {
|
|
@@ -13883,6 +13907,7 @@ var ButtonWithMenu = ({
|
|
|
13883
13907
|
placement,
|
|
13884
13908
|
menuTrigger: clickableButton,
|
|
13885
13909
|
menuItemsContainerCssClasses: menuContainerCssClasses,
|
|
13910
|
+
maxMenuHeight,
|
|
13886
13911
|
children
|
|
13887
13912
|
}
|
|
13888
13913
|
)
|
|
@@ -13894,6 +13919,7 @@ var ButtonWithMenu = ({
|
|
|
13894
13919
|
menuTrigger: dropdownButton,
|
|
13895
13920
|
menuItemsContainerCssClasses: menuContainerCssClasses,
|
|
13896
13921
|
portal: withoutPortal,
|
|
13922
|
+
maxMenuHeight,
|
|
13897
13923
|
children
|
|
13898
13924
|
}
|
|
13899
13925
|
) })
|
|
@@ -18867,6 +18893,7 @@ var MediaCard = ({
|
|
|
18867
18893
|
menuItems,
|
|
18868
18894
|
sideSection: sideSection2,
|
|
18869
18895
|
onClick,
|
|
18896
|
+
buttonType,
|
|
18870
18897
|
...cardProps
|
|
18871
18898
|
}) => {
|
|
18872
18899
|
const onStopPropogation = (0, import_react105.useCallback)((e) => {
|
|
@@ -18874,7 +18901,7 @@ var MediaCard = ({
|
|
|
18874
18901
|
}, []);
|
|
18875
18902
|
const hasMenuItems = Array.isArray(menuItems) ? menuItems.length > 0 : Boolean(menuItems);
|
|
18876
18903
|
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(Card, { css: cardBase, ...cardProps, onClick, "data-testid": "card-item", children: [
|
|
18877
|
-
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("button", { tabIndex: -1, css: coverWrapper, children: cover }),
|
|
18904
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("button", { tabIndex: -1, css: coverWrapper, type: buttonType, children: cover }),
|
|
18878
18905
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { css: contentWrapper, children: /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(HorizontalRhythm, { gap: "sm", justify: "space-between", align: "center", css: { width: "100%" }, children: [
|
|
18879
18906
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(VerticalRhythm, { gap: "0", align: "flex-start", css: { flex: 1, minWidth: 0 }, children: [
|
|
18880
18907
|
/* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(HorizontalRhythm, { gap: "xs", align: "center", css: { maxWidth: "100%" }, children: [
|
|
@@ -22300,6 +22327,18 @@ var ConditionalFilterRow = import_react139.css`
|
|
|
22300
22327
|
|
|
22301
22328
|
${cq("380px")} {
|
|
22302
22329
|
align-items: center;
|
|
22330
|
+
|
|
22331
|
+
&:after {
|
|
22332
|
+
content: '';
|
|
22333
|
+
display: block;
|
|
22334
|
+
height: 1px;
|
|
22335
|
+
background: var(--gray-300);
|
|
22336
|
+
width: calc(100% - var(--spacing-base));
|
|
22337
|
+
margin-left: var(--spacing-base);
|
|
22338
|
+
}
|
|
22339
|
+
&:last-of-type:after {
|
|
22340
|
+
display: none;
|
|
22341
|
+
}
|
|
22303
22342
|
}
|
|
22304
22343
|
|
|
22305
22344
|
&:first-of-type {
|
|
@@ -22307,6 +22346,12 @@ var ConditionalFilterRow = import_react139.css`
|
|
|
22307
22346
|
grid-template-columns: 50px 1fr;
|
|
22308
22347
|
}
|
|
22309
22348
|
|
|
22349
|
+
${cq("580px")} {
|
|
22350
|
+
&:after {
|
|
22351
|
+
display: none;
|
|
22352
|
+
}
|
|
22353
|
+
}
|
|
22354
|
+
|
|
22310
22355
|
@media (prefers-reduced-motion: no-preference) {
|
|
22311
22356
|
animation: ${fadeInLtr} var(--duration-fast) var(--timing-ease-out);
|
|
22312
22357
|
}
|
|
@@ -22314,15 +22359,24 @@ var ConditionalFilterRow = import_react139.css`
|
|
|
22314
22359
|
var ConditionalInputRow = import_react139.css`
|
|
22315
22360
|
display: flex;
|
|
22316
22361
|
gap: var(--spacing-sm);
|
|
22317
|
-
flex-
|
|
22362
|
+
flex-wrap: wrap;
|
|
22318
22363
|
|
|
22319
22364
|
${cq("380px")} {
|
|
22320
|
-
|
|
22321
|
-
|
|
22365
|
+
& > div:nth-child(-n + 2) {
|
|
22366
|
+
width: calc(50% - var(--spacing-sm));
|
|
22367
|
+
}
|
|
22368
|
+
|
|
22369
|
+
& > div:nth-child(n + 3) {
|
|
22370
|
+
width: calc(100% - 48px);
|
|
22371
|
+
}
|
|
22322
22372
|
}
|
|
22323
22373
|
${cq("580px")} {
|
|
22324
22374
|
display: grid;
|
|
22325
22375
|
grid-template-columns: 200px 160px 1fr 32px;
|
|
22376
|
+
|
|
22377
|
+
& > div:nth-child(n) {
|
|
22378
|
+
width: auto;
|
|
22379
|
+
}
|
|
22326
22380
|
}
|
|
22327
22381
|
`;
|
|
22328
22382
|
var SearchInput = import_react139.css`
|
|
@@ -22509,243 +22563,25 @@ var FilterButton2 = ({
|
|
|
22509
22563
|
|
|
22510
22564
|
// src/components/SearchAndFilter/FilterControls.tsx
|
|
22511
22565
|
init_emotion_jsx_shim();
|
|
22512
|
-
var
|
|
22513
|
-
var
|
|
22566
|
+
var import_react143 = require("react");
|
|
22567
|
+
var import_react_use4 = require("react-use");
|
|
22514
22568
|
|
|
22515
22569
|
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
22516
22570
|
init_emotion_jsx_shim();
|
|
22517
|
-
var
|
|
22518
|
-
var import_jsx_runtime119 = require("@emotion/react/jsx-runtime");
|
|
22519
|
-
var SearchAndFilterContext = (0, import_react140.createContext)({
|
|
22520
|
-
searchTerm: "",
|
|
22521
|
-
setSearchTerm: () => {
|
|
22522
|
-
},
|
|
22523
|
-
filterVisibility: void 0,
|
|
22524
|
-
setFilterVisibility: () => {
|
|
22525
|
-
},
|
|
22526
|
-
filters: [],
|
|
22527
|
-
setFilters: () => {
|
|
22528
|
-
},
|
|
22529
|
-
handleAddFilter: () => {
|
|
22530
|
-
},
|
|
22531
|
-
handleResetFilters: () => {
|
|
22532
|
-
},
|
|
22533
|
-
handleDeleteFilter: () => {
|
|
22534
|
-
},
|
|
22535
|
-
setSortBy: () => {
|
|
22536
|
-
},
|
|
22537
|
-
sortByValue: "",
|
|
22538
|
-
filterOptions: [],
|
|
22539
|
-
sortOptions: [],
|
|
22540
|
-
validFilterQuery: [],
|
|
22541
|
-
totalResults: 0
|
|
22542
|
-
});
|
|
22543
|
-
var SearchAndFilterProvider = ({
|
|
22544
|
-
filters,
|
|
22545
|
-
filterOptions,
|
|
22546
|
-
sortOptions,
|
|
22547
|
-
defaultSortByValue,
|
|
22548
|
-
filterMode: filterMode3 = void 0,
|
|
22549
|
-
onSearchChange,
|
|
22550
|
-
onChange,
|
|
22551
|
-
onSortChange,
|
|
22552
|
-
resetFilterValues = [],
|
|
22553
|
-
totalResults,
|
|
22554
|
-
children
|
|
22555
|
-
}) => {
|
|
22556
|
-
const [searchTerm, setSearchTerm] = (0, import_react140.useState)("");
|
|
22557
|
-
const deferredSearchTerm = (0, import_react140.useDeferredValue)(searchTerm);
|
|
22558
|
-
const [filterVisibility, setFilterVisibility] = (0, import_react140.useState)(filterMode3);
|
|
22559
|
-
const [sortByValue, setSortByValue] = (0, import_react140.useState)(defaultSortByValue);
|
|
22560
|
-
const handleSearchTerm = (0, import_react140.useCallback)(
|
|
22561
|
-
(term) => {
|
|
22562
|
-
setSearchTerm(term);
|
|
22563
|
-
onSearchChange == null ? void 0 : onSearchChange(term);
|
|
22564
|
-
},
|
|
22565
|
-
[setSearchTerm, onSearchChange]
|
|
22566
|
-
);
|
|
22567
|
-
const handleOnSortChange = (0, import_react140.useCallback)(
|
|
22568
|
-
(sort) => {
|
|
22569
|
-
setSortByValue(sort);
|
|
22570
|
-
onSortChange(sort);
|
|
22571
|
-
},
|
|
22572
|
-
[onSortChange]
|
|
22573
|
-
);
|
|
22574
|
-
const handleToggleFilterVisibilty = (0, import_react140.useCallback)(
|
|
22575
|
-
(mode) => setFilterVisibility(mode),
|
|
22576
|
-
[setFilterVisibility]
|
|
22577
|
-
);
|
|
22578
|
-
const handleAddFilter = (0, import_react140.useCallback)(() => {
|
|
22579
|
-
onChange([...filters, { field: "", operator: "", value: "" }]);
|
|
22580
|
-
}, [filters, onChange]);
|
|
22581
|
-
const handleResetFilters = (0, import_react140.useCallback)(() => {
|
|
22582
|
-
onChange(resetFilterValues);
|
|
22583
|
-
}, [onChange, resetFilterValues]);
|
|
22584
|
-
const handleDeleteFilter = (0, import_react140.useCallback)(
|
|
22585
|
-
(index) => {
|
|
22586
|
-
const remainingFilters = filters.filter((_, i) => i !== index);
|
|
22587
|
-
onChange(remainingFilters);
|
|
22588
|
-
},
|
|
22589
|
-
[filters, onChange]
|
|
22590
|
-
);
|
|
22591
|
-
const validFilterQuery = (0, import_react140.useMemo)(() => {
|
|
22592
|
-
const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
|
|
22593
|
-
if (hasValidFilters) {
|
|
22594
|
-
return filters;
|
|
22595
|
-
}
|
|
22596
|
-
}, [filters]);
|
|
22597
|
-
(0, import_react140.useEffect)(() => {
|
|
22598
|
-
if (filterVisibility) {
|
|
22599
|
-
const handleEscKeyFilterClose = (e) => {
|
|
22600
|
-
if (e.key === "Escape") {
|
|
22601
|
-
setFilterVisibility(void 0);
|
|
22602
|
-
}
|
|
22603
|
-
};
|
|
22604
|
-
document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
22605
|
-
return () => {
|
|
22606
|
-
document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
22607
|
-
};
|
|
22608
|
-
}
|
|
22609
|
-
}, [filterVisibility]);
|
|
22610
|
-
return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
22611
|
-
SearchAndFilterContext.Provider,
|
|
22612
|
-
{
|
|
22613
|
-
value: {
|
|
22614
|
-
searchTerm: deferredSearchTerm,
|
|
22615
|
-
setSearchTerm: (e) => handleSearchTerm(e),
|
|
22616
|
-
setSortBy: (e) => handleOnSortChange(e),
|
|
22617
|
-
sortByValue,
|
|
22618
|
-
filterVisibility,
|
|
22619
|
-
setFilterVisibility: (e) => handleToggleFilterVisibilty(e),
|
|
22620
|
-
filters,
|
|
22621
|
-
setFilters: (e) => onChange(e),
|
|
22622
|
-
handleAddFilter,
|
|
22623
|
-
handleResetFilters,
|
|
22624
|
-
handleDeleteFilter,
|
|
22625
|
-
filterOptions,
|
|
22626
|
-
sortOptions,
|
|
22627
|
-
validFilterQuery,
|
|
22628
|
-
totalResults
|
|
22629
|
-
},
|
|
22630
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(VerticalRhythm, { children })
|
|
22631
|
-
}
|
|
22632
|
-
);
|
|
22633
|
-
};
|
|
22634
|
-
var useSearchAndFilter = () => {
|
|
22635
|
-
const value = (0, import_react140.useContext)(SearchAndFilterContext);
|
|
22636
|
-
return { ...value };
|
|
22637
|
-
};
|
|
22638
|
-
|
|
22639
|
-
// src/components/SearchAndFilter/FilterControls.tsx
|
|
22640
|
-
var import_jsx_runtime120 = require("@emotion/react/jsx-runtime");
|
|
22641
|
-
var FilterControls = ({
|
|
22642
|
-
children,
|
|
22643
|
-
defaultSortByValue,
|
|
22644
|
-
hideSearchInput
|
|
22645
|
-
}) => {
|
|
22646
|
-
var _a, _b, _c;
|
|
22647
|
-
const {
|
|
22648
|
-
setFilterVisibility,
|
|
22649
|
-
filterVisibility,
|
|
22650
|
-
setSearchTerm,
|
|
22651
|
-
validFilterQuery,
|
|
22652
|
-
searchTerm,
|
|
22653
|
-
sortByValue,
|
|
22654
|
-
filterOptions
|
|
22655
|
-
} = useSearchAndFilter();
|
|
22656
|
-
const [initialSortValue, setInitialSortValue] = (0, import_react141.useState)(sortByValue);
|
|
22657
|
-
const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react141.useState)("");
|
|
22658
|
-
const [userHasChangedSortByValue, setUserHasChangedSortByValue] = (0, import_react141.useState)(false);
|
|
22659
|
-
(0, import_react_use3.useDebounce)(
|
|
22660
|
-
() => {
|
|
22661
|
-
setSearchTerm(localeSearchTerm);
|
|
22662
|
-
},
|
|
22663
|
-
300,
|
|
22664
|
-
[localeSearchTerm, searchTerm]
|
|
22665
|
-
);
|
|
22666
|
-
(0, import_react141.useEffect)(() => {
|
|
22667
|
-
if (searchTerm === "") {
|
|
22668
|
-
setLocaleSearchTerm("");
|
|
22669
|
-
}
|
|
22670
|
-
}, [searchTerm]);
|
|
22671
|
-
const handleFilterToggle = (mode) => {
|
|
22672
|
-
if (filterVisibility === "filters" && mode === "filters" || filterVisibility === "sort" && mode === "sort") {
|
|
22673
|
-
return setFilterVisibility(void 0);
|
|
22674
|
-
}
|
|
22675
|
-
return setFilterVisibility(mode);
|
|
22676
|
-
};
|
|
22677
|
-
const sortValue = (sortByValue != null ? sortByValue : defaultSortByValue).split("_");
|
|
22678
|
-
const sortDirection = sortValue == null ? void 0 : sortValue.pop();
|
|
22679
|
-
const sortField = sortValue == null ? void 0 : sortValue.join("_");
|
|
22680
|
-
const sortOn = sortField.startsWith("fields.") ? "contentTypeFields" : "metadata";
|
|
22681
|
-
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;
|
|
22682
|
-
const sortByIcon = userHasChangedSortByValue ? sortDirection === "ASC" ? "arrow-up" : "arrow-down" : "sort-az";
|
|
22683
|
-
(0, import_react_use3.useEffectOnce)(() => {
|
|
22684
|
-
setInitialSortValue(sortByValue);
|
|
22685
|
-
});
|
|
22686
|
-
(0, import_react141.useEffect)(() => {
|
|
22687
|
-
if (initialSortValue !== sortByValue) {
|
|
22688
|
-
setUserHasChangedSortByValue(true);
|
|
22689
|
-
}
|
|
22690
|
-
}, [initialSortValue, sortByValue]);
|
|
22691
|
-
return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(import_jsx_runtime120.Fragment, { children: [
|
|
22692
|
-
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
22693
|
-
FilterButton2,
|
|
22694
|
-
{
|
|
22695
|
-
"aria-controls": "search-and-filter-options",
|
|
22696
|
-
"aria-label": "filter options",
|
|
22697
|
-
"aria-haspopup": "true",
|
|
22698
|
-
"aria-expanded": filterVisibility === "filters",
|
|
22699
|
-
filterCount: validFilterQuery == null ? void 0 : validFilterQuery.length,
|
|
22700
|
-
onClick: () => handleFilterToggle("filters"),
|
|
22701
|
-
dataTestId: "filters-button"
|
|
22702
|
-
}
|
|
22703
|
-
),
|
|
22704
|
-
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
22705
|
-
FilterButton2,
|
|
22706
|
-
{
|
|
22707
|
-
"aria-controls": "search-and-filter-sortBy",
|
|
22708
|
-
"aria-label": "sort by options",
|
|
22709
|
-
"aria-haspopup": "true",
|
|
22710
|
-
text: !userHasChangedSortByValue ? "Sort" : sortByValueLabel,
|
|
22711
|
-
icon: sortByIcon,
|
|
22712
|
-
"aria-expanded": filterVisibility === "sort",
|
|
22713
|
-
hasSelectedValue: sortByValue !== "",
|
|
22714
|
-
onClick: () => handleFilterToggle("sort"),
|
|
22715
|
-
dataTestId: "sort-by-button"
|
|
22716
|
-
}
|
|
22717
|
-
),
|
|
22718
|
-
hideSearchInput ? null : /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
22719
|
-
InputKeywordSearch,
|
|
22720
|
-
{
|
|
22721
|
-
placeholder: "Search...",
|
|
22722
|
-
onSearchTextChanged: (e) => setLocaleSearchTerm(e),
|
|
22723
|
-
value: localeSearchTerm,
|
|
22724
|
-
compact: true,
|
|
22725
|
-
rounded: true,
|
|
22726
|
-
css: SearchInput
|
|
22727
|
-
}
|
|
22728
|
-
),
|
|
22729
|
-
children
|
|
22730
|
-
] });
|
|
22731
|
-
};
|
|
22732
|
-
|
|
22733
|
-
// src/components/SearchAndFilter/FilterItem.tsx
|
|
22734
|
-
init_emotion_jsx_shim();
|
|
22735
|
-
var import_react145 = require("react");
|
|
22571
|
+
var import_react142 = require("react");
|
|
22736
22572
|
|
|
22737
22573
|
// src/components/SearchAndFilter/FilterEditor.tsx
|
|
22738
22574
|
init_emotion_jsx_shim();
|
|
22739
|
-
var
|
|
22740
|
-
var
|
|
22575
|
+
var import_react141 = require("react");
|
|
22576
|
+
var import_react_use3 = require("react-use");
|
|
22741
22577
|
|
|
22742
22578
|
// src/components/Validation/StatusBullet.tsx
|
|
22743
22579
|
init_emotion_jsx_shim();
|
|
22744
22580
|
|
|
22745
22581
|
// src/components/Validation/StatusBullet.styles.ts
|
|
22746
22582
|
init_emotion_jsx_shim();
|
|
22747
|
-
var
|
|
22748
|
-
var StatusBulletContainer =
|
|
22583
|
+
var import_react140 = require("@emotion/react");
|
|
22584
|
+
var StatusBulletContainer = import_react140.css`
|
|
22749
22585
|
align-items: center;
|
|
22750
22586
|
align-self: center;
|
|
22751
22587
|
color: var(--gray-500);
|
|
@@ -22762,33 +22598,33 @@ var StatusBulletContainer = import_react142.css`
|
|
|
22762
22598
|
display: block;
|
|
22763
22599
|
}
|
|
22764
22600
|
`;
|
|
22765
|
-
var StatusBulletBase =
|
|
22601
|
+
var StatusBulletBase = import_react140.css`
|
|
22766
22602
|
font-size: var(--fs-sm);
|
|
22767
22603
|
&:before {
|
|
22768
22604
|
width: var(--fs-xs);
|
|
22769
22605
|
height: var(--fs-xs);
|
|
22770
22606
|
}
|
|
22771
22607
|
`;
|
|
22772
|
-
var StatusBulletSmall =
|
|
22608
|
+
var StatusBulletSmall = import_react140.css`
|
|
22773
22609
|
font-size: var(--fs-xs);
|
|
22774
22610
|
&:before {
|
|
22775
22611
|
width: var(--fs-xxs);
|
|
22776
22612
|
height: var(--fs-xxs);
|
|
22777
22613
|
}
|
|
22778
22614
|
`;
|
|
22779
|
-
var StatusDraft =
|
|
22615
|
+
var StatusDraft = import_react140.css`
|
|
22780
22616
|
&:before {
|
|
22781
22617
|
background: var(--white);
|
|
22782
22618
|
box-shadow: inset 0 0 0 0.125rem var(--primary-action-default);
|
|
22783
22619
|
}
|
|
22784
22620
|
`;
|
|
22785
|
-
var StatusModified =
|
|
22621
|
+
var StatusModified = import_react140.css`
|
|
22786
22622
|
&:before {
|
|
22787
22623
|
background: linear-gradient(to right, var(--white) 50%, var(--primary-action-default) 50% 100%);
|
|
22788
22624
|
box-shadow: inset 0 0 0 0.125rem var(--primary-action-default);
|
|
22789
22625
|
}
|
|
22790
22626
|
`;
|
|
22791
|
-
var StatusError =
|
|
22627
|
+
var StatusError = import_react140.css`
|
|
22792
22628
|
color: var(--error);
|
|
22793
22629
|
&:before {
|
|
22794
22630
|
/* TODO: replace this with an svg icon */
|
|
@@ -22801,29 +22637,29 @@ var StatusError = import_react142.css`
|
|
|
22801
22637
|
);
|
|
22802
22638
|
}
|
|
22803
22639
|
`;
|
|
22804
|
-
var StatusPublished =
|
|
22640
|
+
var StatusPublished = import_react140.css`
|
|
22805
22641
|
&:before {
|
|
22806
22642
|
background: var(--primary-action-default);
|
|
22807
22643
|
}
|
|
22808
22644
|
`;
|
|
22809
|
-
var StatusOrphan =
|
|
22645
|
+
var StatusOrphan = import_react140.css`
|
|
22810
22646
|
&:before {
|
|
22811
22647
|
background: var(--brand-secondary-5);
|
|
22812
22648
|
}
|
|
22813
22649
|
`;
|
|
22814
|
-
var StatusUnknown =
|
|
22650
|
+
var StatusUnknown = import_react140.css`
|
|
22815
22651
|
&:before {
|
|
22816
22652
|
background: var(--gray-800);
|
|
22817
22653
|
}
|
|
22818
22654
|
`;
|
|
22819
|
-
var StatusDeleted =
|
|
22655
|
+
var StatusDeleted = import_react140.css`
|
|
22820
22656
|
&:before {
|
|
22821
22657
|
background: var(--error);
|
|
22822
22658
|
}
|
|
22823
22659
|
`;
|
|
22824
22660
|
|
|
22825
22661
|
// src/components/Validation/StatusBullet.tsx
|
|
22826
|
-
var
|
|
22662
|
+
var import_jsx_runtime119 = require("@emotion/react/jsx-runtime");
|
|
22827
22663
|
var StatusBullet = ({
|
|
22828
22664
|
status,
|
|
22829
22665
|
hideText = false,
|
|
@@ -22843,7 +22679,7 @@ var StatusBullet = ({
|
|
|
22843
22679
|
Deleted: StatusDeleted
|
|
22844
22680
|
};
|
|
22845
22681
|
const statusSize = size === "base" ? StatusBulletBase : StatusBulletSmall;
|
|
22846
|
-
return /* @__PURE__ */ (0,
|
|
22682
|
+
return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
22847
22683
|
"span",
|
|
22848
22684
|
{
|
|
22849
22685
|
role: "status",
|
|
@@ -22856,7 +22692,7 @@ var StatusBullet = ({
|
|
|
22856
22692
|
};
|
|
22857
22693
|
|
|
22858
22694
|
// src/components/SearchAndFilter/FilterEditor.tsx
|
|
22859
|
-
var
|
|
22695
|
+
var import_jsx_runtime120 = require("@emotion/react/jsx-runtime");
|
|
22860
22696
|
var readOnlyAttributes = {
|
|
22861
22697
|
isSearchable: false,
|
|
22862
22698
|
menuIsOpen: false,
|
|
@@ -22865,13 +22701,13 @@ var readOnlyAttributes = {
|
|
|
22865
22701
|
var FilterMultiChoiceEditor = ({
|
|
22866
22702
|
value,
|
|
22867
22703
|
options,
|
|
22868
|
-
|
|
22704
|
+
disabled: disabled2,
|
|
22869
22705
|
readOnly,
|
|
22870
22706
|
valueTestId,
|
|
22871
22707
|
...props
|
|
22872
22708
|
}) => {
|
|
22873
22709
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
22874
|
-
return /* @__PURE__ */ (0,
|
|
22710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
22875
22711
|
InputComboBox,
|
|
22876
22712
|
{
|
|
22877
22713
|
...props,
|
|
@@ -22879,12 +22715,12 @@ var FilterMultiChoiceEditor = ({
|
|
|
22879
22715
|
options,
|
|
22880
22716
|
isMulti: true,
|
|
22881
22717
|
isClearable: true,
|
|
22882
|
-
isDisabled,
|
|
22718
|
+
isDisabled: disabled2,
|
|
22883
22719
|
onChange: (e) => {
|
|
22884
22720
|
var _a;
|
|
22885
|
-
return props.onChange((_a = e.map((
|
|
22721
|
+
return props.onChange((_a = e == null ? void 0 : e.map((option) => option.value)) != null ? _a : []);
|
|
22886
22722
|
},
|
|
22887
|
-
value,
|
|
22723
|
+
value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
|
|
22888
22724
|
"aria-readonly": readOnly,
|
|
22889
22725
|
styles: {
|
|
22890
22726
|
menu(base) {
|
|
@@ -22901,13 +22737,13 @@ var FilterMultiChoiceEditor = ({
|
|
|
22901
22737
|
var FilterSingleChoiceEditor = ({
|
|
22902
22738
|
options,
|
|
22903
22739
|
value,
|
|
22904
|
-
|
|
22740
|
+
disabled: disabled2,
|
|
22905
22741
|
readOnly,
|
|
22906
22742
|
onChange,
|
|
22907
22743
|
valueTestId
|
|
22908
22744
|
}) => {
|
|
22909
22745
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
22910
|
-
return /* @__PURE__ */ (0,
|
|
22746
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
22911
22747
|
InputComboBox,
|
|
22912
22748
|
{
|
|
22913
22749
|
placeholder: "Type to search...",
|
|
@@ -22917,8 +22753,8 @@ var FilterSingleChoiceEditor = ({
|
|
|
22917
22753
|
var _a;
|
|
22918
22754
|
return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
|
|
22919
22755
|
},
|
|
22920
|
-
isDisabled,
|
|
22921
|
-
value,
|
|
22756
|
+
isDisabled: disabled2,
|
|
22757
|
+
value: options == null ? void 0 : options.find((option) => option.value === value),
|
|
22922
22758
|
"aria-readonly": readOnly,
|
|
22923
22759
|
styles: {
|
|
22924
22760
|
menu(base) {
|
|
@@ -22933,18 +22769,18 @@ var FilterSingleChoiceEditor = ({
|
|
|
22933
22769
|
) });
|
|
22934
22770
|
};
|
|
22935
22771
|
var CustomOptions = ({ label, value }) => {
|
|
22936
|
-
return /* @__PURE__ */ (0,
|
|
22772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(StatusBullet, { status: label, message: value });
|
|
22937
22773
|
};
|
|
22938
22774
|
var StatusMultiEditor = ({
|
|
22939
22775
|
options,
|
|
22940
22776
|
value,
|
|
22941
|
-
|
|
22777
|
+
disabled: disabled2,
|
|
22942
22778
|
readOnly,
|
|
22943
22779
|
onChange,
|
|
22944
22780
|
valueTestId
|
|
22945
22781
|
}) => {
|
|
22946
22782
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
22947
|
-
return /* @__PURE__ */ (0,
|
|
22783
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
22948
22784
|
InputComboBox,
|
|
22949
22785
|
{
|
|
22950
22786
|
options,
|
|
@@ -22954,8 +22790,8 @@ var StatusMultiEditor = ({
|
|
|
22954
22790
|
return onChange((_a = e.map((item) => item.value)) != null ? _a : []);
|
|
22955
22791
|
},
|
|
22956
22792
|
formatOptionLabel: CustomOptions,
|
|
22957
|
-
value,
|
|
22958
|
-
isDisabled,
|
|
22793
|
+
value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
|
|
22794
|
+
isDisabled: disabled2,
|
|
22959
22795
|
styles: {
|
|
22960
22796
|
menu(base) {
|
|
22961
22797
|
return {
|
|
@@ -22971,13 +22807,13 @@ var StatusMultiEditor = ({
|
|
|
22971
22807
|
var StatusSingleEditor = ({
|
|
22972
22808
|
options,
|
|
22973
22809
|
value,
|
|
22974
|
-
|
|
22810
|
+
disabled: disabled2,
|
|
22975
22811
|
readOnly,
|
|
22976
22812
|
onChange,
|
|
22977
22813
|
valueTestId
|
|
22978
22814
|
}) => {
|
|
22979
22815
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
22980
|
-
return /* @__PURE__ */ (0,
|
|
22816
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
22981
22817
|
InputComboBox,
|
|
22982
22818
|
{
|
|
22983
22819
|
options,
|
|
@@ -22986,8 +22822,8 @@ var StatusSingleEditor = ({
|
|
|
22986
22822
|
return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
|
|
22987
22823
|
},
|
|
22988
22824
|
formatOptionLabel: CustomOptions,
|
|
22989
|
-
value,
|
|
22990
|
-
isDisabled,
|
|
22825
|
+
value: options == null ? void 0 : options.find((option) => option.value === value),
|
|
22826
|
+
isDisabled: disabled2,
|
|
22991
22827
|
styles: {
|
|
22992
22828
|
menu(base) {
|
|
22993
22829
|
return {
|
|
@@ -23000,9 +22836,15 @@ var StatusSingleEditor = ({
|
|
|
23000
22836
|
}
|
|
23001
22837
|
) });
|
|
23002
22838
|
};
|
|
23003
|
-
var TextEditor = ({
|
|
23004
|
-
|
|
23005
|
-
|
|
22839
|
+
var TextEditor = ({
|
|
22840
|
+
onChange,
|
|
22841
|
+
ariaLabel,
|
|
22842
|
+
value,
|
|
22843
|
+
readOnly,
|
|
22844
|
+
valueTestId
|
|
22845
|
+
}) => {
|
|
22846
|
+
(0, import_react_use3.useDebounce)(() => onChange, 500, [value]);
|
|
22847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23006
22848
|
Input,
|
|
23007
22849
|
{
|
|
23008
22850
|
showLabel: false,
|
|
@@ -23023,10 +22865,10 @@ var NumberRangeEditor = ({
|
|
|
23023
22865
|
readOnly,
|
|
23024
22866
|
valueTestId
|
|
23025
22867
|
}) => {
|
|
23026
|
-
const [minValue, setMinValue] = (0,
|
|
23027
|
-
const [maxValue, setMaxValue] = (0,
|
|
23028
|
-
const [error, setError] = (0,
|
|
23029
|
-
(0,
|
|
22868
|
+
const [minValue, setMinValue] = (0, import_react141.useState)("");
|
|
22869
|
+
const [maxValue, setMaxValue] = (0, import_react141.useState)("");
|
|
22870
|
+
const [error, setError] = (0, import_react141.useState)("");
|
|
22871
|
+
(0, import_react141.useEffect)(() => {
|
|
23030
22872
|
if (!maxValue && !minValue) {
|
|
23031
22873
|
return;
|
|
23032
22874
|
}
|
|
@@ -23045,9 +22887,9 @@ var NumberRangeEditor = ({
|
|
|
23045
22887
|
setError("");
|
|
23046
22888
|
onChange([minValue, maxValue]);
|
|
23047
22889
|
}, [maxValue, minValue, setError]);
|
|
23048
|
-
return /* @__PURE__ */ (0,
|
|
23049
|
-
/* @__PURE__ */ (0,
|
|
23050
|
-
/* @__PURE__ */ (0,
|
|
22890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(import_jsx_runtime120.Fragment, { children: [
|
|
22891
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
22892
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23051
22893
|
Input,
|
|
23052
22894
|
{
|
|
23053
22895
|
label: `${ariaLabel}-min`,
|
|
@@ -23062,7 +22904,7 @@ var NumberRangeEditor = ({
|
|
|
23062
22904
|
readOnly
|
|
23063
22905
|
}
|
|
23064
22906
|
),
|
|
23065
|
-
/* @__PURE__ */ (0,
|
|
22907
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23066
22908
|
Input,
|
|
23067
22909
|
{
|
|
23068
22910
|
type: "number",
|
|
@@ -23078,7 +22920,7 @@ var NumberRangeEditor = ({
|
|
|
23078
22920
|
}
|
|
23079
22921
|
)
|
|
23080
22922
|
] }),
|
|
23081
|
-
/* @__PURE__ */ (0,
|
|
22923
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(ErrorContainer, { errorMessage: error })
|
|
23082
22924
|
] });
|
|
23083
22925
|
};
|
|
23084
22926
|
var NumberEditor = ({
|
|
@@ -23089,7 +22931,7 @@ var NumberEditor = ({
|
|
|
23089
22931
|
readOnly,
|
|
23090
22932
|
valueTestId
|
|
23091
22933
|
}) => {
|
|
23092
|
-
return /* @__PURE__ */ (0,
|
|
22934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23093
22935
|
Input,
|
|
23094
22936
|
{
|
|
23095
22937
|
label: ariaLabel,
|
|
@@ -23112,7 +22954,7 @@ var DateEditor = ({
|
|
|
23112
22954
|
readOnly,
|
|
23113
22955
|
valueTestId
|
|
23114
22956
|
}) => {
|
|
23115
|
-
return /* @__PURE__ */ (0,
|
|
22957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23116
22958
|
Input,
|
|
23117
22959
|
{
|
|
23118
22960
|
type: "date",
|
|
@@ -23134,10 +22976,10 @@ var DateRangeEditor = ({
|
|
|
23134
22976
|
readOnly,
|
|
23135
22977
|
valueTestId
|
|
23136
22978
|
}) => {
|
|
23137
|
-
const [minDateValue, setMinDateValue] = (0,
|
|
23138
|
-
const [maxDateValue, setMaxDateValue] = (0,
|
|
23139
|
-
const [error, setError] = (0,
|
|
23140
|
-
(0,
|
|
22979
|
+
const [minDateValue, setMinDateValue] = (0, import_react141.useState)(value ? value[0] : "");
|
|
22980
|
+
const [maxDateValue, setMaxDateValue] = (0, import_react141.useState)(value ? value[1] : "");
|
|
22981
|
+
const [error, setError] = (0, import_react141.useState)("");
|
|
22982
|
+
(0, import_react141.useEffect)(() => {
|
|
23141
22983
|
if (!minDateValue || !maxDateValue) {
|
|
23142
22984
|
return;
|
|
23143
22985
|
}
|
|
@@ -23168,9 +23010,9 @@ var DateRangeEditor = ({
|
|
|
23168
23010
|
setError("");
|
|
23169
23011
|
onChange([minDateValue, maxDateValue]);
|
|
23170
23012
|
}, [minDateValue, maxDateValue, setError]);
|
|
23171
|
-
return /* @__PURE__ */ (0,
|
|
23172
|
-
/* @__PURE__ */ (0,
|
|
23173
|
-
/* @__PURE__ */ (0,
|
|
23013
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(import_jsx_runtime120.Fragment, { children: [
|
|
23014
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
23015
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23174
23016
|
Input,
|
|
23175
23017
|
{
|
|
23176
23018
|
label: `${ariaLabel}-min-date`,
|
|
@@ -23183,7 +23025,7 @@ var DateRangeEditor = ({
|
|
|
23183
23025
|
readOnly
|
|
23184
23026
|
}
|
|
23185
23027
|
),
|
|
23186
|
-
/* @__PURE__ */ (0,
|
|
23028
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23187
23029
|
Input,
|
|
23188
23030
|
{
|
|
23189
23031
|
label: `${ariaLabel}-max-date`,
|
|
@@ -23197,18 +23039,19 @@ var DateRangeEditor = ({
|
|
|
23197
23039
|
}
|
|
23198
23040
|
)
|
|
23199
23041
|
] }),
|
|
23200
|
-
/* @__PURE__ */ (0,
|
|
23042
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)(ErrorContainer, { errorMessage: error })
|
|
23201
23043
|
] });
|
|
23202
23044
|
};
|
|
23203
23045
|
var FilterEditorRenderer = ({ editorType, ...props }) => {
|
|
23204
|
-
const
|
|
23046
|
+
const { filterMapper: contextFilterMapper } = useSearchAndFilter();
|
|
23047
|
+
const Editor = contextFilterMapper == null ? void 0 : contextFilterMapper[editorType];
|
|
23205
23048
|
if (!Editor) {
|
|
23206
23049
|
return null;
|
|
23207
23050
|
}
|
|
23208
23051
|
if (editorType === "empty") {
|
|
23209
23052
|
return null;
|
|
23210
23053
|
}
|
|
23211
|
-
return /* @__PURE__ */ (0,
|
|
23054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(Editor, { ...props });
|
|
23212
23055
|
};
|
|
23213
23056
|
var filterMapper = {
|
|
23214
23057
|
multiChoice: FilterMultiChoiceEditor,
|
|
@@ -23223,14 +23066,14 @@ var filterMapper = {
|
|
|
23223
23066
|
empty: null
|
|
23224
23067
|
};
|
|
23225
23068
|
var ErrorContainer = ({ errorMessage }) => {
|
|
23226
|
-
return /* @__PURE__ */ (0,
|
|
23069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(
|
|
23227
23070
|
"div",
|
|
23228
23071
|
{
|
|
23229
23072
|
css: {
|
|
23230
23073
|
gridColumn: "span 6",
|
|
23231
23074
|
order: 6
|
|
23232
23075
|
},
|
|
23233
|
-
children: /* @__PURE__ */ (0,
|
|
23076
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(FieldMessage, { errorMessage })
|
|
23234
23077
|
}
|
|
23235
23078
|
);
|
|
23236
23079
|
};
|
|
@@ -23240,6 +23083,229 @@ var twoColumnGrid = {
|
|
|
23240
23083
|
gap: "var(--spacing-sm);"
|
|
23241
23084
|
};
|
|
23242
23085
|
|
|
23086
|
+
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
23087
|
+
var import_jsx_runtime121 = require("@emotion/react/jsx-runtime");
|
|
23088
|
+
var SearchAndFilterContext = (0, import_react142.createContext)({
|
|
23089
|
+
searchTerm: "",
|
|
23090
|
+
setSearchTerm: () => {
|
|
23091
|
+
},
|
|
23092
|
+
filterVisibility: void 0,
|
|
23093
|
+
setFilterVisibility: () => {
|
|
23094
|
+
},
|
|
23095
|
+
filters: [],
|
|
23096
|
+
setFilters: () => {
|
|
23097
|
+
},
|
|
23098
|
+
handleAddFilter: () => {
|
|
23099
|
+
},
|
|
23100
|
+
handleResetFilters: () => {
|
|
23101
|
+
},
|
|
23102
|
+
handleDeleteFilter: () => {
|
|
23103
|
+
},
|
|
23104
|
+
setSortBy: () => {
|
|
23105
|
+
},
|
|
23106
|
+
sortByValue: "",
|
|
23107
|
+
filterOptions: [],
|
|
23108
|
+
sortOptions: [],
|
|
23109
|
+
validFilterQuery: [],
|
|
23110
|
+
filterMapper: {},
|
|
23111
|
+
totalResults: 0
|
|
23112
|
+
});
|
|
23113
|
+
var SearchAndFilterProvider = ({
|
|
23114
|
+
filters,
|
|
23115
|
+
filterOptions,
|
|
23116
|
+
sortOptions,
|
|
23117
|
+
defaultSortByValue,
|
|
23118
|
+
filterMode: filterMode3 = void 0,
|
|
23119
|
+
onSearchChange,
|
|
23120
|
+
onChange,
|
|
23121
|
+
onSortChange,
|
|
23122
|
+
resetFilterValues = [],
|
|
23123
|
+
totalResults,
|
|
23124
|
+
filterMapper: filterMapper2 = filterMapper,
|
|
23125
|
+
children
|
|
23126
|
+
}) => {
|
|
23127
|
+
const [searchTerm, setSearchTerm] = (0, import_react142.useState)("");
|
|
23128
|
+
const deferredSearchTerm = (0, import_react142.useDeferredValue)(searchTerm);
|
|
23129
|
+
const [filterVisibility, setFilterVisibility] = (0, import_react142.useState)(filterMode3);
|
|
23130
|
+
const [sortByValue, setSortByValue] = (0, import_react142.useState)(defaultSortByValue);
|
|
23131
|
+
const handleSearchTerm = (0, import_react142.useCallback)(
|
|
23132
|
+
(term) => {
|
|
23133
|
+
setSearchTerm(term);
|
|
23134
|
+
onSearchChange == null ? void 0 : onSearchChange(term);
|
|
23135
|
+
},
|
|
23136
|
+
[setSearchTerm, onSearchChange]
|
|
23137
|
+
);
|
|
23138
|
+
const handleOnSortChange = (0, import_react142.useCallback)(
|
|
23139
|
+
(sort) => {
|
|
23140
|
+
setSortByValue(sort);
|
|
23141
|
+
onSortChange(sort);
|
|
23142
|
+
},
|
|
23143
|
+
[onSortChange]
|
|
23144
|
+
);
|
|
23145
|
+
const handleToggleFilterVisibilty = (0, import_react142.useCallback)(
|
|
23146
|
+
(mode) => setFilterVisibility(mode),
|
|
23147
|
+
[setFilterVisibility]
|
|
23148
|
+
);
|
|
23149
|
+
const handleAddFilter = (0, import_react142.useCallback)(() => {
|
|
23150
|
+
onChange([...filters, { field: "", operator: "", value: "" }]);
|
|
23151
|
+
}, [filters, onChange]);
|
|
23152
|
+
const handleResetFilters = (0, import_react142.useCallback)(() => {
|
|
23153
|
+
onChange(resetFilterValues);
|
|
23154
|
+
}, [onChange, resetFilterValues]);
|
|
23155
|
+
const handleDeleteFilter = (0, import_react142.useCallback)(
|
|
23156
|
+
(index) => {
|
|
23157
|
+
const remainingFilters = filters.filter((_, i) => i !== index);
|
|
23158
|
+
onChange(remainingFilters);
|
|
23159
|
+
},
|
|
23160
|
+
[filters, onChange]
|
|
23161
|
+
);
|
|
23162
|
+
const validFilterQuery = (0, import_react142.useMemo)(() => {
|
|
23163
|
+
const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
|
|
23164
|
+
if (hasValidFilters) {
|
|
23165
|
+
return filters;
|
|
23166
|
+
}
|
|
23167
|
+
}, [filters]);
|
|
23168
|
+
(0, import_react142.useEffect)(() => {
|
|
23169
|
+
if (filterVisibility) {
|
|
23170
|
+
const handleEscKeyFilterClose = (e) => {
|
|
23171
|
+
if (e.key === "Escape") {
|
|
23172
|
+
setFilterVisibility(void 0);
|
|
23173
|
+
}
|
|
23174
|
+
};
|
|
23175
|
+
document.addEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
23176
|
+
return () => {
|
|
23177
|
+
document.removeEventListener("keydown", (e) => handleEscKeyFilterClose(e));
|
|
23178
|
+
};
|
|
23179
|
+
}
|
|
23180
|
+
}, [filterVisibility]);
|
|
23181
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
23182
|
+
SearchAndFilterContext.Provider,
|
|
23183
|
+
{
|
|
23184
|
+
value: {
|
|
23185
|
+
searchTerm: deferredSearchTerm,
|
|
23186
|
+
setSearchTerm: (e) => handleSearchTerm(e),
|
|
23187
|
+
setSortBy: (e) => handleOnSortChange(e),
|
|
23188
|
+
sortByValue,
|
|
23189
|
+
filterVisibility,
|
|
23190
|
+
setFilterVisibility: (e) => handleToggleFilterVisibilty(e),
|
|
23191
|
+
filters,
|
|
23192
|
+
setFilters: (e) => onChange(e),
|
|
23193
|
+
handleAddFilter,
|
|
23194
|
+
handleResetFilters,
|
|
23195
|
+
handleDeleteFilter,
|
|
23196
|
+
filterOptions,
|
|
23197
|
+
sortOptions,
|
|
23198
|
+
validFilterQuery,
|
|
23199
|
+
totalResults,
|
|
23200
|
+
filterMapper: filterMapper2
|
|
23201
|
+
},
|
|
23202
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(VerticalRhythm, { children })
|
|
23203
|
+
}
|
|
23204
|
+
);
|
|
23205
|
+
};
|
|
23206
|
+
var useSearchAndFilter = () => {
|
|
23207
|
+
const value = (0, import_react142.useContext)(SearchAndFilterContext);
|
|
23208
|
+
return { ...value };
|
|
23209
|
+
};
|
|
23210
|
+
|
|
23211
|
+
// src/components/SearchAndFilter/FilterControls.tsx
|
|
23212
|
+
var import_jsx_runtime122 = require("@emotion/react/jsx-runtime");
|
|
23213
|
+
var FilterControls = ({
|
|
23214
|
+
children,
|
|
23215
|
+
defaultSortByValue,
|
|
23216
|
+
hideSearchInput
|
|
23217
|
+
}) => {
|
|
23218
|
+
var _a, _b, _c;
|
|
23219
|
+
const {
|
|
23220
|
+
setFilterVisibility,
|
|
23221
|
+
filterVisibility,
|
|
23222
|
+
setSearchTerm,
|
|
23223
|
+
validFilterQuery,
|
|
23224
|
+
searchTerm,
|
|
23225
|
+
sortByValue,
|
|
23226
|
+
filterOptions
|
|
23227
|
+
} = useSearchAndFilter();
|
|
23228
|
+
const [initialSortValue, setInitialSortValue] = (0, import_react143.useState)(sortByValue);
|
|
23229
|
+
const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react143.useState)("");
|
|
23230
|
+
const [userHasChangedSortByValue, setUserHasChangedSortByValue] = (0, import_react143.useState)(false);
|
|
23231
|
+
(0, import_react_use4.useDebounce)(
|
|
23232
|
+
() => {
|
|
23233
|
+
setSearchTerm(localeSearchTerm);
|
|
23234
|
+
},
|
|
23235
|
+
300,
|
|
23236
|
+
[localeSearchTerm, searchTerm]
|
|
23237
|
+
);
|
|
23238
|
+
(0, import_react143.useEffect)(() => {
|
|
23239
|
+
if (searchTerm === "") {
|
|
23240
|
+
setLocaleSearchTerm("");
|
|
23241
|
+
}
|
|
23242
|
+
}, [searchTerm]);
|
|
23243
|
+
const handleFilterToggle = (mode) => {
|
|
23244
|
+
if (filterVisibility === "filters" && mode === "filters" || filterVisibility === "sort" && mode === "sort") {
|
|
23245
|
+
return setFilterVisibility(void 0);
|
|
23246
|
+
}
|
|
23247
|
+
return setFilterVisibility(mode);
|
|
23248
|
+
};
|
|
23249
|
+
const sortValue = (sortByValue != null ? sortByValue : defaultSortByValue).split("_");
|
|
23250
|
+
const sortDirection = sortValue == null ? void 0 : sortValue.pop();
|
|
23251
|
+
const sortField = sortValue == null ? void 0 : sortValue.join("_");
|
|
23252
|
+
const sortOn = sortField.startsWith("fields.") ? "contentTypeFields" : "metadata";
|
|
23253
|
+
const sortByValueLabel = (_c = (_b = (_a = filterOptions == null ? void 0 : filterOptions.find((op) => op.value === sortOn)) == null ? void 0 : _a.options) == null ? void 0 : _b.find((f) => f.value === sortField)) == null ? void 0 : _c.label;
|
|
23254
|
+
const sortByIcon = userHasChangedSortByValue ? sortDirection === "ASC" ? "arrow-up" : "arrow-down" : "sort-az";
|
|
23255
|
+
(0, import_react_use4.useEffectOnce)(() => {
|
|
23256
|
+
setInitialSortValue(sortByValue);
|
|
23257
|
+
});
|
|
23258
|
+
(0, import_react143.useEffect)(() => {
|
|
23259
|
+
if (initialSortValue !== sortByValue) {
|
|
23260
|
+
setUserHasChangedSortByValue(true);
|
|
23261
|
+
}
|
|
23262
|
+
}, [initialSortValue, sortByValue]);
|
|
23263
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsxs)(import_jsx_runtime122.Fragment, { children: [
|
|
23264
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
23265
|
+
FilterButton2,
|
|
23266
|
+
{
|
|
23267
|
+
"aria-controls": "search-and-filter-options",
|
|
23268
|
+
"aria-label": "filter options",
|
|
23269
|
+
"aria-haspopup": "true",
|
|
23270
|
+
"aria-expanded": filterVisibility === "filters",
|
|
23271
|
+
filterCount: validFilterQuery == null ? void 0 : validFilterQuery.length,
|
|
23272
|
+
onClick: () => handleFilterToggle("filters"),
|
|
23273
|
+
dataTestId: "filters-button"
|
|
23274
|
+
}
|
|
23275
|
+
),
|
|
23276
|
+
/* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
23277
|
+
FilterButton2,
|
|
23278
|
+
{
|
|
23279
|
+
"aria-controls": "search-and-filter-sortBy",
|
|
23280
|
+
"aria-label": "sort by options",
|
|
23281
|
+
"aria-haspopup": "true",
|
|
23282
|
+
text: !userHasChangedSortByValue ? "Sort" : sortByValueLabel,
|
|
23283
|
+
icon: sortByIcon,
|
|
23284
|
+
"aria-expanded": filterVisibility === "sort",
|
|
23285
|
+
hasSelectedValue: sortByValue !== "",
|
|
23286
|
+
onClick: () => handleFilterToggle("sort"),
|
|
23287
|
+
dataTestId: "sort-by-button"
|
|
23288
|
+
}
|
|
23289
|
+
),
|
|
23290
|
+
hideSearchInput ? null : /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
23291
|
+
InputKeywordSearch,
|
|
23292
|
+
{
|
|
23293
|
+
placeholder: "Search...",
|
|
23294
|
+
onSearchTextChanged: (e) => setLocaleSearchTerm(e),
|
|
23295
|
+
value: localeSearchTerm,
|
|
23296
|
+
compact: true,
|
|
23297
|
+
rounded: true,
|
|
23298
|
+
css: SearchInput
|
|
23299
|
+
}
|
|
23300
|
+
),
|
|
23301
|
+
children
|
|
23302
|
+
] });
|
|
23303
|
+
};
|
|
23304
|
+
|
|
23305
|
+
// src/components/SearchAndFilter/FilterItem.tsx
|
|
23306
|
+
init_emotion_jsx_shim();
|
|
23307
|
+
var import_react145 = require("react");
|
|
23308
|
+
|
|
23243
23309
|
// src/components/SearchAndFilter/FilterMenu.tsx
|
|
23244
23310
|
init_emotion_jsx_shim();
|
|
23245
23311
|
var import_react144 = __toESM(require("react"));
|
|
@@ -23311,7 +23377,7 @@ var FilterItem = ({
|
|
|
23311
23377
|
const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
|
|
23312
23378
|
const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
|
|
23313
23379
|
const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
|
|
23314
|
-
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly } = (0, import_react145.useMemo)(() => {
|
|
23380
|
+
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = (0, import_react145.useMemo)(() => {
|
|
23315
23381
|
var _a2;
|
|
23316
23382
|
const currentSelectedFilter = filterOptions.find((item) => {
|
|
23317
23383
|
var _a3;
|
|
@@ -23324,19 +23390,14 @@ var FilterItem = ({
|
|
|
23324
23390
|
const selectedOperatorValue2 = operatorOptions == null ? void 0 : operatorOptions.find((item) => {
|
|
23325
23391
|
return filters[index].operator === item.value;
|
|
23326
23392
|
});
|
|
23327
|
-
const selectedMetaValue2 = valueOptions.filter((item) => {
|
|
23328
|
-
if (Array.isArray(filters[index].value) && item.value) {
|
|
23329
|
-
return filters[index].value.includes(item.value);
|
|
23330
|
-
}
|
|
23331
|
-
return filters[index].value === item.value;
|
|
23332
|
-
});
|
|
23333
23393
|
return {
|
|
23334
23394
|
selectedFieldValue: selectedFieldValue2,
|
|
23335
23395
|
selectedOperatorValue: selectedOperatorValue2 != null ? selectedOperatorValue2 : void 0,
|
|
23336
|
-
selectedMetaValue:
|
|
23337
|
-
readOnly: isCurrentFieldReadOnly
|
|
23396
|
+
selectedMetaValue: filters[index].value,
|
|
23397
|
+
readOnly: isCurrentFieldReadOnly,
|
|
23398
|
+
bindable: selectedFieldValue2 == null ? void 0 : selectedFieldValue2.bindable
|
|
23338
23399
|
};
|
|
23339
|
-
}, [filters, filterOptions, index, operatorOptions
|
|
23400
|
+
}, [filters, filterOptions, index, operatorOptions]);
|
|
23340
23401
|
const readOnlyProps = readOnly ? {
|
|
23341
23402
|
"aria-readonly": true,
|
|
23342
23403
|
isSearchable: false,
|
|
@@ -23403,7 +23464,8 @@ var FilterItem = ({
|
|
|
23403
23464
|
options: valueOptions,
|
|
23404
23465
|
onChange: (e) => onValueChange(e != null ? e : ""),
|
|
23405
23466
|
readOnly,
|
|
23406
|
-
|
|
23467
|
+
bindable,
|
|
23468
|
+
disabled: !filters[index].operator,
|
|
23407
23469
|
value: selectedMetaValue,
|
|
23408
23470
|
valueTestId: "filter-value"
|
|
23409
23471
|
}
|
|
@@ -23688,6 +23750,7 @@ var SegmentedControl = ({
|
|
|
23688
23750
|
{
|
|
23689
23751
|
css: [segmentedControlStyles, orientation === "vertical" ? segmentedControlVerticalStyles : void 0],
|
|
23690
23752
|
...props,
|
|
23753
|
+
"data-testid": "segmented-control",
|
|
23691
23754
|
children: options.map((option, index) => {
|
|
23692
23755
|
var _a;
|
|
23693
23756
|
if (!option) {
|
|
@@ -23854,6 +23917,7 @@ var SearchAndFilter = ({
|
|
|
23854
23917
|
viewSwitchControls,
|
|
23855
23918
|
resultsContainerView = /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(SearchAndFilterResultContainer, {}),
|
|
23856
23919
|
children = /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(FilterModeView, {}),
|
|
23920
|
+
filterMapper: filterMapper2 = filterMapper,
|
|
23857
23921
|
onChange,
|
|
23858
23922
|
onSearchChange,
|
|
23859
23923
|
onSortChange,
|
|
@@ -23873,6 +23937,7 @@ var SearchAndFilter = ({
|
|
|
23873
23937
|
onSortChange,
|
|
23874
23938
|
totalResults,
|
|
23875
23939
|
resetFilterValues,
|
|
23940
|
+
filterMapper: filterMapper2,
|
|
23876
23941
|
children: /* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(VerticalRhythm, { css: SearchAndFilterContainer, "data-testid": "search-and-filter", children: [
|
|
23877
23942
|
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
|
|
23878
23943
|
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
@@ -24516,6 +24581,8 @@ var ToastContainer = ({ limit = 4 }) => {
|
|
|
24516
24581
|
CurrentDrawerContext,
|
|
24517
24582
|
DATE_OPERATORS,
|
|
24518
24583
|
DashedBox,
|
|
24584
|
+
DateEditor,
|
|
24585
|
+
DateRangeEditor,
|
|
24519
24586
|
DateTimePicker,
|
|
24520
24587
|
DateTimePickerVariant,
|
|
24521
24588
|
DebouncedInputKeywordSearch,
|
|
@@ -24531,9 +24598,12 @@ var ToastContainer = ({ limit = 4 }) => {
|
|
|
24531
24598
|
Fieldset,
|
|
24532
24599
|
FilterButton,
|
|
24533
24600
|
FilterControls,
|
|
24601
|
+
FilterEditorRenderer,
|
|
24534
24602
|
FilterItem,
|
|
24535
24603
|
FilterItems,
|
|
24536
24604
|
FilterMenu,
|
|
24605
|
+
FilterMultiChoiceEditor,
|
|
24606
|
+
FilterSingleChoiceEditor,
|
|
24537
24607
|
Heading,
|
|
24538
24608
|
HexModalBackground,
|
|
24539
24609
|
HorizontalRhythm,
|
|
@@ -24580,6 +24650,8 @@ var ToastContainer = ({ limit = 4 }) => {
|
|
|
24580
24650
|
ModalDialog,
|
|
24581
24651
|
MultilineChip,
|
|
24582
24652
|
NUMBER_OPERATORS,
|
|
24653
|
+
NumberEditor,
|
|
24654
|
+
NumberRangeEditor,
|
|
24583
24655
|
PageHeaderSection,
|
|
24584
24656
|
Pagination,
|
|
24585
24657
|
Paragraph,
|
|
@@ -24632,6 +24704,8 @@ var ToastContainer = ({ limit = 4 }) => {
|
|
|
24632
24704
|
ShortcutRevealer,
|
|
24633
24705
|
Skeleton,
|
|
24634
24706
|
StatusBullet,
|
|
24707
|
+
StatusMultiEditor,
|
|
24708
|
+
StatusSingleEditor,
|
|
24635
24709
|
SuccessMessage,
|
|
24636
24710
|
Switch,
|
|
24637
24711
|
TAKEOVER_STACK_ID,
|
|
@@ -24648,6 +24722,7 @@ var ToastContainer = ({ limit = 4 }) => {
|
|
|
24648
24722
|
TableRow,
|
|
24649
24723
|
Tabs,
|
|
24650
24724
|
TakeoverDrawerRenderer,
|
|
24725
|
+
TextEditor,
|
|
24651
24726
|
Textarea,
|
|
24652
24727
|
Theme,
|
|
24653
24728
|
Tile,
|
|
@@ -24692,6 +24767,7 @@ var ToastContainer = ({ limit = 4 }) => {
|
|
|
24692
24767
|
fadeInRtl,
|
|
24693
24768
|
fadeInTop,
|
|
24694
24769
|
fadeOutBottom,
|
|
24770
|
+
filterMapper,
|
|
24695
24771
|
fullWidthScreenIcon,
|
|
24696
24772
|
getDrawerAttributes,
|
|
24697
24773
|
getParentPath,
|