@uniformdev/design-system 19.122.1-alpha.0 → 19.125.2-alpha.3
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 +287 -106
- package/dist/index.d.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +280 -98
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1467,6 +1467,7 @@ __export(src_exports, {
|
|
|
1467
1467
|
RICHTEXT_OPERATORS: () => RICHTEXT_OPERATORS,
|
|
1468
1468
|
ResolveIcon: () => ResolveIcon,
|
|
1469
1469
|
RichTextToolbarIcon: () => RichTextToolbarIcon,
|
|
1470
|
+
SYSTEM_DATE_OPERATORS: () => SYSTEM_DATE_OPERATORS,
|
|
1470
1471
|
SYSTEM_FIELD_OPERATORS: () => SYSTEM_FIELD_OPERATORS,
|
|
1471
1472
|
ScrollableList: () => ScrollableList,
|
|
1472
1473
|
ScrollableListInputItem: () => ScrollableListInputItem,
|
|
@@ -4200,7 +4201,7 @@ var import_react22 = require("@emotion/react");
|
|
|
4200
4201
|
var PageHeaderSectionContainer = import_react22.css`
|
|
4201
4202
|
display: flex;
|
|
4202
4203
|
justify-content: space-between;
|
|
4203
|
-
margin-bottom: var(--spacing-
|
|
4204
|
+
margin-bottom: var(--spacing-sm);
|
|
4204
4205
|
flex-direction: column;
|
|
4205
4206
|
gap: var(--spacing-sm);
|
|
4206
4207
|
|
|
@@ -15579,7 +15580,8 @@ function InputComboBox(props) {
|
|
|
15579
15580
|
background: "var(--gray-100)",
|
|
15580
15581
|
"&:hover": {
|
|
15581
15582
|
borderColor: "var(--gray-300)"
|
|
15582
|
-
}
|
|
15583
|
+
},
|
|
15584
|
+
...state.isFocused ? { borderColor: "var(--gray-300)" } : {}
|
|
15583
15585
|
},
|
|
15584
15586
|
...(_b = (_a2 = props.styles) == null ? void 0 : _a2.control) == null ? void 0 : _b.call(_a2, base, state)
|
|
15585
15587
|
};
|
|
@@ -19390,6 +19392,16 @@ var toggleInput2 = import_react110.css`
|
|
|
19390
19392
|
color: var(--white);
|
|
19391
19393
|
}
|
|
19392
19394
|
|
|
19395
|
+
&:indeterminate,
|
|
19396
|
+
&:indeterminate:hover,
|
|
19397
|
+
&:indeterminate:focus {
|
|
19398
|
+
background: var(--accent-dark-active)
|
|
19399
|
+
url('data:image/svg+xml;base64,PHN2ZwogIHdpZHRoPSIxNiIKICBoZWlnaHQ9IjE2IgogIHZpZXdCb3g9IjAgMCAyNCAyNCIKICBmaWxsPSJub25lIgogIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKPgogIDxwYXRoCiAgICBkPSJNNCAxMkM0IDExLjQ0NzcgNC40NDc3MiAxMSA1IDExSDE5QzE5LjU1MjMgMTEgMjAgMTEuNDQ3NyAyMCAxMkMyMCAxMi41NTIzIDE5LjU1MjMgMTMgMTkgMTNINUM0LjQ0NzcyIDEzIDQgMTIuNTUyMyA0IDEyWiIKICAgIGZpbGw9IndoaXRlIgogIC8+Cjwvc3ZnPg==')
|
|
19400
|
+
no-repeat center center;
|
|
19401
|
+
border-color: var(--accent-dark-active);
|
|
19402
|
+
color: var(--white);
|
|
19403
|
+
}
|
|
19404
|
+
|
|
19393
19405
|
&:hover {
|
|
19394
19406
|
border-color: var(--accent-dark-hover);
|
|
19395
19407
|
}
|
|
@@ -22116,6 +22128,43 @@ var USER_OPERATORS = [
|
|
|
22116
22128
|
editorType: "text"
|
|
22117
22129
|
}
|
|
22118
22130
|
];
|
|
22131
|
+
var SYSTEM_DATE_OPERATORS = [
|
|
22132
|
+
{
|
|
22133
|
+
label: "is...",
|
|
22134
|
+
value: "eq",
|
|
22135
|
+
editorType: "date"
|
|
22136
|
+
},
|
|
22137
|
+
{
|
|
22138
|
+
label: "is between...",
|
|
22139
|
+
value: "between",
|
|
22140
|
+
editorType: "dateRange"
|
|
22141
|
+
},
|
|
22142
|
+
{
|
|
22143
|
+
label: "is before...",
|
|
22144
|
+
value: "lt",
|
|
22145
|
+
editorType: "date"
|
|
22146
|
+
},
|
|
22147
|
+
{
|
|
22148
|
+
label: "is after...",
|
|
22149
|
+
value: "gt",
|
|
22150
|
+
editorType: "date"
|
|
22151
|
+
},
|
|
22152
|
+
{
|
|
22153
|
+
label: "is on or before...",
|
|
22154
|
+
value: "lte",
|
|
22155
|
+
editorType: "date"
|
|
22156
|
+
},
|
|
22157
|
+
{
|
|
22158
|
+
label: "is on or after...",
|
|
22159
|
+
value: "gte",
|
|
22160
|
+
editorType: "date"
|
|
22161
|
+
},
|
|
22162
|
+
{
|
|
22163
|
+
label: "is not...",
|
|
22164
|
+
value: "neq",
|
|
22165
|
+
editorType: "date"
|
|
22166
|
+
}
|
|
22167
|
+
];
|
|
22119
22168
|
var RICHTEXT_OPERATORS = [
|
|
22120
22169
|
{
|
|
22121
22170
|
label: "is empty...",
|
|
@@ -22303,7 +22352,6 @@ var AddConditionalBtn = import_react138.css`
|
|
|
22303
22352
|
gap: var(--spacing-sm);
|
|
22304
22353
|
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
22305
22354
|
padding: 0;
|
|
22306
|
-
font-size: var(--fs-sm);
|
|
22307
22355
|
|
|
22308
22356
|
&:hover,
|
|
22309
22357
|
&:focus {
|
|
@@ -22358,7 +22406,7 @@ var SearchAndFilterOptionsContainer = import_react138.css`
|
|
|
22358
22406
|
padding: var(--spacing-md) var(--spacing-md) var(--spacing-base);
|
|
22359
22407
|
will-change: height;
|
|
22360
22408
|
position: relative;
|
|
22361
|
-
z-index:
|
|
22409
|
+
z-index: 1;
|
|
22362
22410
|
`;
|
|
22363
22411
|
var SearchAndFilterOptionsInnerContainer = import_react138.css`
|
|
22364
22412
|
display: flex;
|
|
@@ -22368,6 +22416,11 @@ var SearchAndFilterOptionsInnerContainer = import_react138.css`
|
|
|
22368
22416
|
var SearchAndFilterButtonGroup = import_react138.css`
|
|
22369
22417
|
margin-top: var(--spacing-base);
|
|
22370
22418
|
`;
|
|
22419
|
+
var SortFilterInputRow = import_react138.css`
|
|
22420
|
+
align-items: center;
|
|
22421
|
+
display: flex;
|
|
22422
|
+
gap: var(--spacing-sm);
|
|
22423
|
+
`;
|
|
22371
22424
|
|
|
22372
22425
|
// src/components/SearchAndFilter/FilterButton.tsx
|
|
22373
22426
|
var import_jsx_runtime117 = require("@emotion/react/jsx-runtime");
|
|
@@ -22543,7 +22596,9 @@ var FilterControls = ({
|
|
|
22543
22596
|
sortByValue,
|
|
22544
22597
|
filterOptions
|
|
22545
22598
|
} = useSearchAndFilter();
|
|
22599
|
+
const [initialSortValue, setInitialSortValue] = (0, import_react140.useState)(sortByValue);
|
|
22546
22600
|
const [localeSearchTerm, setLocaleSearchTerm] = (0, import_react140.useState)("");
|
|
22601
|
+
const [userHasChangedSortByValue, setUserHasChangedSortByValue] = (0, import_react140.useState)(false);
|
|
22547
22602
|
(0, import_react_use3.useDebounce)(
|
|
22548
22603
|
() => {
|
|
22549
22604
|
setSearchTerm(localeSearchTerm);
|
|
@@ -22557,7 +22612,7 @@ var FilterControls = ({
|
|
|
22557
22612
|
}
|
|
22558
22613
|
}, [searchTerm]);
|
|
22559
22614
|
const handleFilterToggle = (mode) => {
|
|
22560
|
-
if (filterVisibility &&
|
|
22615
|
+
if (filterVisibility === "filters" && mode === "filters" || filterVisibility === "sort" && mode === "sort") {
|
|
22561
22616
|
return setFilterVisibility(void 0);
|
|
22562
22617
|
}
|
|
22563
22618
|
return setFilterVisibility(mode);
|
|
@@ -22567,7 +22622,15 @@ var FilterControls = ({
|
|
|
22567
22622
|
const sortField = sortValue == null ? void 0 : sortValue.join("_");
|
|
22568
22623
|
const sortOn = sortField.startsWith("fields.") ? "contentTypeFields" : "metadata";
|
|
22569
22624
|
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;
|
|
22570
|
-
const sortByIcon = sortDirection === "ASC" ? "arrow-up" : "arrow-down";
|
|
22625
|
+
const sortByIcon = userHasChangedSortByValue ? sortDirection === "ASC" ? "arrow-up" : "arrow-down" : "sort-az";
|
|
22626
|
+
(0, import_react_use3.useEffectOnce)(() => {
|
|
22627
|
+
setInitialSortValue(sortByValue);
|
|
22628
|
+
});
|
|
22629
|
+
(0, import_react140.useEffect)(() => {
|
|
22630
|
+
if (initialSortValue !== sortByValue) {
|
|
22631
|
+
setUserHasChangedSortByValue(true);
|
|
22632
|
+
}
|
|
22633
|
+
}, [initialSortValue, sortByValue]);
|
|
22571
22634
|
return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)(import_jsx_runtime119.Fragment, { children: [
|
|
22572
22635
|
/* @__PURE__ */ (0, import_jsx_runtime119.jsx)(
|
|
22573
22636
|
FilterButton2,
|
|
@@ -22586,7 +22649,7 @@ var FilterControls = ({
|
|
|
22586
22649
|
"aria-controls": "search-and-filter-sortBy",
|
|
22587
22650
|
"aria-label": "sort by options",
|
|
22588
22651
|
"aria-haspopup": "true",
|
|
22589
|
-
text: sortByValueLabel,
|
|
22652
|
+
text: !userHasChangedSortByValue ? "Sort" : sortByValueLabel,
|
|
22590
22653
|
icon: sortByIcon,
|
|
22591
22654
|
"aria-expanded": filterVisibility === "sort",
|
|
22592
22655
|
hasSelectedValue: sortByValue !== "",
|
|
@@ -22745,10 +22808,11 @@ var FilterMultiChoiceEditor = ({
|
|
|
22745
22808
|
options,
|
|
22746
22809
|
isDisabled,
|
|
22747
22810
|
readOnly,
|
|
22811
|
+
valueTestId,
|
|
22748
22812
|
...props
|
|
22749
22813
|
}) => {
|
|
22750
22814
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
22751
|
-
return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
22815
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
22752
22816
|
InputComboBox,
|
|
22753
22817
|
{
|
|
22754
22818
|
...props,
|
|
@@ -22763,19 +22827,28 @@ var FilterMultiChoiceEditor = ({
|
|
|
22763
22827
|
},
|
|
22764
22828
|
value,
|
|
22765
22829
|
"aria-readonly": readOnly,
|
|
22830
|
+
styles: {
|
|
22831
|
+
menu(base) {
|
|
22832
|
+
return {
|
|
22833
|
+
...base,
|
|
22834
|
+
minWidth: "max-content"
|
|
22835
|
+
};
|
|
22836
|
+
}
|
|
22837
|
+
},
|
|
22766
22838
|
...readOnlyProps
|
|
22767
22839
|
}
|
|
22768
|
-
);
|
|
22840
|
+
) });
|
|
22769
22841
|
};
|
|
22770
22842
|
var FilterSingleChoiceEditor = ({
|
|
22771
22843
|
options,
|
|
22772
22844
|
value,
|
|
22773
22845
|
isDisabled,
|
|
22774
22846
|
readOnly,
|
|
22775
|
-
onChange
|
|
22847
|
+
onChange,
|
|
22848
|
+
valueTestId
|
|
22776
22849
|
}) => {
|
|
22777
22850
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
22778
|
-
return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
22851
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
22779
22852
|
InputComboBox,
|
|
22780
22853
|
{
|
|
22781
22854
|
placeholder: "Type to search...",
|
|
@@ -22788,9 +22861,17 @@ var FilterSingleChoiceEditor = ({
|
|
|
22788
22861
|
isDisabled,
|
|
22789
22862
|
value,
|
|
22790
22863
|
"aria-readonly": readOnly,
|
|
22864
|
+
styles: {
|
|
22865
|
+
menu(base) {
|
|
22866
|
+
return {
|
|
22867
|
+
...base,
|
|
22868
|
+
minWidth: "max-content"
|
|
22869
|
+
};
|
|
22870
|
+
}
|
|
22871
|
+
},
|
|
22791
22872
|
...readOnlyProps
|
|
22792
22873
|
}
|
|
22793
|
-
);
|
|
22874
|
+
) });
|
|
22794
22875
|
};
|
|
22795
22876
|
var CustomOptions = ({ label, value }) => {
|
|
22796
22877
|
return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(StatusBullet, { status: label, message: value });
|
|
@@ -22800,10 +22881,11 @@ var StatusMultiEditor = ({
|
|
|
22800
22881
|
value,
|
|
22801
22882
|
isDisabled,
|
|
22802
22883
|
readOnly,
|
|
22803
|
-
onChange
|
|
22884
|
+
onChange,
|
|
22885
|
+
valueTestId
|
|
22804
22886
|
}) => {
|
|
22805
22887
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
22806
|
-
return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
22888
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
22807
22889
|
InputComboBox,
|
|
22808
22890
|
{
|
|
22809
22891
|
options,
|
|
@@ -22815,19 +22897,28 @@ var StatusMultiEditor = ({
|
|
|
22815
22897
|
formatOptionLabel: CustomOptions,
|
|
22816
22898
|
value,
|
|
22817
22899
|
isDisabled,
|
|
22900
|
+
styles: {
|
|
22901
|
+
menu(base) {
|
|
22902
|
+
return {
|
|
22903
|
+
...base,
|
|
22904
|
+
minWidth: "max-content"
|
|
22905
|
+
};
|
|
22906
|
+
}
|
|
22907
|
+
},
|
|
22818
22908
|
...readOnlyProps
|
|
22819
22909
|
}
|
|
22820
|
-
);
|
|
22910
|
+
) });
|
|
22821
22911
|
};
|
|
22822
22912
|
var StatusSingleEditor = ({
|
|
22823
22913
|
options,
|
|
22824
22914
|
value,
|
|
22825
22915
|
isDisabled,
|
|
22826
22916
|
readOnly,
|
|
22827
|
-
onChange
|
|
22917
|
+
onChange,
|
|
22918
|
+
valueTestId
|
|
22828
22919
|
}) => {
|
|
22829
22920
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
22830
|
-
return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
22921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { "data-testid": valueTestId, children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
22831
22922
|
InputComboBox,
|
|
22832
22923
|
{
|
|
22833
22924
|
options,
|
|
@@ -22838,11 +22929,19 @@ var StatusSingleEditor = ({
|
|
|
22838
22929
|
formatOptionLabel: CustomOptions,
|
|
22839
22930
|
value,
|
|
22840
22931
|
isDisabled,
|
|
22932
|
+
styles: {
|
|
22933
|
+
menu(base) {
|
|
22934
|
+
return {
|
|
22935
|
+
...base,
|
|
22936
|
+
minWidth: "max-content"
|
|
22937
|
+
};
|
|
22938
|
+
}
|
|
22939
|
+
},
|
|
22841
22940
|
...readOnlyProps
|
|
22842
22941
|
}
|
|
22843
|
-
);
|
|
22942
|
+
) });
|
|
22844
22943
|
};
|
|
22845
|
-
var TextEditor = ({ onChange, ariaLabel, value, readOnly }) => {
|
|
22944
|
+
var TextEditor = ({ onChange, ariaLabel, value, readOnly, valueTestId }) => {
|
|
22846
22945
|
(0, import_react_use4.useDebounce)(() => onChange, 500, [value]);
|
|
22847
22946
|
return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
22848
22947
|
Input,
|
|
@@ -22852,11 +22951,19 @@ var TextEditor = ({ onChange, ariaLabel, value, readOnly }) => {
|
|
|
22852
22951
|
onChange: (e) => onChange(e.currentTarget.value),
|
|
22853
22952
|
placeholder: "Enter phrase to search\u2026",
|
|
22854
22953
|
value,
|
|
22855
|
-
readOnly
|
|
22954
|
+
readOnly,
|
|
22955
|
+
"data-testid": valueTestId
|
|
22856
22956
|
}
|
|
22857
22957
|
);
|
|
22858
22958
|
};
|
|
22859
|
-
var NumberRangeEditor = ({
|
|
22959
|
+
var NumberRangeEditor = ({
|
|
22960
|
+
onChange,
|
|
22961
|
+
disabled: disabled2,
|
|
22962
|
+
ariaLabel,
|
|
22963
|
+
value,
|
|
22964
|
+
readOnly,
|
|
22965
|
+
valueTestId
|
|
22966
|
+
}) => {
|
|
22860
22967
|
const [minValue, setMinValue] = (0, import_react142.useState)("");
|
|
22861
22968
|
const [maxValue, setMaxValue] = (0, import_react142.useState)("");
|
|
22862
22969
|
const [error, setError] = (0, import_react142.useState)("");
|
|
@@ -22879,41 +22986,50 @@ var NumberRangeEditor = ({ onChange, disabled: disabled2, ariaLabel, value, read
|
|
|
22879
22986
|
setError("");
|
|
22880
22987
|
onChange([minValue, maxValue]);
|
|
22881
22988
|
}, [maxValue, minValue, setError]);
|
|
22882
|
-
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
|
|
22883
|
-
/* @__PURE__ */ (0, import_jsx_runtime121.
|
|
22884
|
-
|
|
22885
|
-
|
|
22886
|
-
|
|
22887
|
-
|
|
22888
|
-
|
|
22889
|
-
|
|
22890
|
-
|
|
22891
|
-
|
|
22892
|
-
|
|
22893
|
-
|
|
22894
|
-
|
|
22895
|
-
|
|
22896
|
-
|
|
22897
|
-
|
|
22898
|
-
|
|
22899
|
-
|
|
22900
|
-
|
|
22901
|
-
|
|
22902
|
-
|
|
22903
|
-
|
|
22904
|
-
|
|
22905
|
-
|
|
22906
|
-
|
|
22907
|
-
|
|
22908
|
-
|
|
22909
|
-
|
|
22910
|
-
|
|
22911
|
-
|
|
22912
|
-
|
|
22989
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(import_jsx_runtime121.Fragment, { children: [
|
|
22990
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
22991
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
22992
|
+
Input,
|
|
22993
|
+
{
|
|
22994
|
+
label: `${ariaLabel}-min`,
|
|
22995
|
+
type: "number",
|
|
22996
|
+
showLabel: false,
|
|
22997
|
+
min: 0,
|
|
22998
|
+
placeholder: "Low",
|
|
22999
|
+
onChange: (e) => setMinValue(e.currentTarget.value),
|
|
23000
|
+
"aria-invalid": !error ? false : true,
|
|
23001
|
+
disabled: disabled2,
|
|
23002
|
+
value: value ? value[0] : "",
|
|
23003
|
+
readOnly
|
|
23004
|
+
}
|
|
23005
|
+
),
|
|
23006
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
23007
|
+
Input,
|
|
23008
|
+
{
|
|
23009
|
+
type: "number",
|
|
23010
|
+
label: `${ariaLabel}-max`,
|
|
23011
|
+
showLabel: false,
|
|
23012
|
+
min: 0,
|
|
23013
|
+
placeholder: "High",
|
|
23014
|
+
onChange: (e) => setMaxValue(e.currentTarget.value),
|
|
23015
|
+
"aria-invalid": !error ? false : true,
|
|
23016
|
+
disabled: disabled2,
|
|
23017
|
+
value: value ? value[1] : "",
|
|
23018
|
+
readOnly
|
|
23019
|
+
}
|
|
23020
|
+
)
|
|
23021
|
+
] }),
|
|
22913
23022
|
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(ErrorContainer, { errorMessage: error })
|
|
22914
23023
|
] });
|
|
22915
23024
|
};
|
|
22916
|
-
var NumberEditor = ({
|
|
23025
|
+
var NumberEditor = ({
|
|
23026
|
+
ariaLabel,
|
|
23027
|
+
onChange,
|
|
23028
|
+
disabled: disabled2,
|
|
23029
|
+
value,
|
|
23030
|
+
readOnly,
|
|
23031
|
+
valueTestId
|
|
23032
|
+
}) => {
|
|
22917
23033
|
return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
22918
23034
|
Input,
|
|
22919
23035
|
{
|
|
@@ -22924,11 +23040,19 @@ var NumberEditor = ({ ariaLabel, onChange, disabled: disabled2, value, readOnly
|
|
|
22924
23040
|
onChange: (e) => onChange(e.currentTarget.value),
|
|
22925
23041
|
disabled: disabled2,
|
|
22926
23042
|
value,
|
|
22927
|
-
readOnly
|
|
23043
|
+
readOnly,
|
|
23044
|
+
"data-testid": valueTestId
|
|
22928
23045
|
}
|
|
22929
23046
|
);
|
|
22930
23047
|
};
|
|
22931
|
-
var DateEditor = ({
|
|
23048
|
+
var DateEditor = ({
|
|
23049
|
+
onChange,
|
|
23050
|
+
ariaLabel,
|
|
23051
|
+
disabled: disabled2,
|
|
23052
|
+
value,
|
|
23053
|
+
readOnly,
|
|
23054
|
+
valueTestId
|
|
23055
|
+
}) => {
|
|
22932
23056
|
return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
22933
23057
|
Input,
|
|
22934
23058
|
{
|
|
@@ -22938,11 +23062,19 @@ var DateEditor = ({ onChange, ariaLabel, disabled: disabled2, value, readOnly })
|
|
|
22938
23062
|
onChange: (e) => onChange(e.currentTarget.value),
|
|
22939
23063
|
disabled: disabled2,
|
|
22940
23064
|
value,
|
|
22941
|
-
readOnly
|
|
23065
|
+
readOnly,
|
|
23066
|
+
"data-testid": valueTestId
|
|
22942
23067
|
}
|
|
22943
23068
|
);
|
|
22944
23069
|
};
|
|
22945
|
-
var DateRangeEditor = ({
|
|
23070
|
+
var DateRangeEditor = ({
|
|
23071
|
+
ariaLabel,
|
|
23072
|
+
onChange,
|
|
23073
|
+
disabled: disabled2,
|
|
23074
|
+
value,
|
|
23075
|
+
readOnly,
|
|
23076
|
+
valueTestId
|
|
23077
|
+
}) => {
|
|
22946
23078
|
const [minDateValue, setMinDateValue] = (0, import_react142.useState)(value ? value[0] : "");
|
|
22947
23079
|
const [maxDateValue, setMaxDateValue] = (0, import_react142.useState)(value ? value[1] : "");
|
|
22948
23080
|
const [error, setError] = (0, import_react142.useState)("");
|
|
@@ -22977,33 +23109,35 @@ var DateRangeEditor = ({ ariaLabel, onChange, disabled: disabled2, value, readOn
|
|
|
22977
23109
|
setError("");
|
|
22978
23110
|
onChange([minDateValue, maxDateValue]);
|
|
22979
23111
|
}, [minDateValue, maxDateValue, setError]);
|
|
22980
|
-
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(
|
|
22981
|
-
/* @__PURE__ */ (0, import_jsx_runtime121.
|
|
22982
|
-
|
|
22983
|
-
|
|
22984
|
-
|
|
22985
|
-
|
|
22986
|
-
|
|
22987
|
-
|
|
22988
|
-
|
|
22989
|
-
|
|
22990
|
-
|
|
22991
|
-
|
|
22992
|
-
|
|
22993
|
-
|
|
22994
|
-
|
|
22995
|
-
|
|
22996
|
-
|
|
22997
|
-
|
|
22998
|
-
|
|
22999
|
-
|
|
23000
|
-
|
|
23001
|
-
|
|
23002
|
-
|
|
23003
|
-
|
|
23004
|
-
|
|
23005
|
-
|
|
23006
|
-
|
|
23112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(import_jsx_runtime121.Fragment, { children: [
|
|
23113
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
23114
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
23115
|
+
Input,
|
|
23116
|
+
{
|
|
23117
|
+
label: `${ariaLabel}-min-date`,
|
|
23118
|
+
type: "date",
|
|
23119
|
+
showLabel: false,
|
|
23120
|
+
value: minDateValue,
|
|
23121
|
+
onChange: (e) => setMinDateValue(e.currentTarget.value),
|
|
23122
|
+
"aria-invalid": !error ? false : true,
|
|
23123
|
+
disabled: disabled2,
|
|
23124
|
+
readOnly
|
|
23125
|
+
}
|
|
23126
|
+
),
|
|
23127
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
23128
|
+
Input,
|
|
23129
|
+
{
|
|
23130
|
+
label: `${ariaLabel}-max-date`,
|
|
23131
|
+
type: "date",
|
|
23132
|
+
showLabel: false,
|
|
23133
|
+
value: maxDateValue,
|
|
23134
|
+
onChange: (e) => setMaxDateValue(e.currentTarget.value),
|
|
23135
|
+
"aria-invalid": !error ? false : true,
|
|
23136
|
+
disabled: disabled2,
|
|
23137
|
+
readOnly
|
|
23138
|
+
}
|
|
23139
|
+
)
|
|
23140
|
+
] }),
|
|
23007
23141
|
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(ErrorContainer, { errorMessage: error })
|
|
23008
23142
|
] });
|
|
23009
23143
|
};
|
|
@@ -23069,7 +23203,7 @@ var SearchAndFilterOptionsContainer2 = ({
|
|
|
23069
23203
|
) : null
|
|
23070
23204
|
] });
|
|
23071
23205
|
};
|
|
23072
|
-
var FilterMenu = ({ id, filterTitle = "Show
|
|
23206
|
+
var FilterMenu = ({ id, filterTitle = "Show results", menuControls, children }) => {
|
|
23073
23207
|
const { filterVisibility, setFilterVisibility } = useSearchAndFilter();
|
|
23074
23208
|
const innerMenuRef = import_react143.default.useRef(null);
|
|
23075
23209
|
(0, import_react143.useEffect)(() => {
|
|
@@ -23143,8 +23277,8 @@ var FilterItem = ({
|
|
|
23143
23277
|
menuIsOpen: false,
|
|
23144
23278
|
isClearable: false
|
|
23145
23279
|
} : {};
|
|
23146
|
-
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { css: ConditionalFilterRow, children: [
|
|
23147
|
-
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { children: index === 0 ? "
|
|
23280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
|
|
23281
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)("span", { children: index === 0 ? "Where" : "and" }),
|
|
23148
23282
|
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)("div", { css: ConditionalInputRow, children: [
|
|
23149
23283
|
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
23150
23284
|
InputComboBox,
|
|
@@ -23155,8 +23289,21 @@ var FilterItem = ({
|
|
|
23155
23289
|
var _a2;
|
|
23156
23290
|
onParamChange((_a2 = e == null ? void 0 : e.value) != null ? _a2 : "");
|
|
23157
23291
|
},
|
|
23292
|
+
isOptionDisabled: (option) => {
|
|
23293
|
+
var _a2;
|
|
23294
|
+
return (_a2 = option == null ? void 0 : option.disabled) != null ? _a2 : false;
|
|
23295
|
+
},
|
|
23296
|
+
styles: {
|
|
23297
|
+
menu(base) {
|
|
23298
|
+
return {
|
|
23299
|
+
...base,
|
|
23300
|
+
minWidth: "max-content"
|
|
23301
|
+
};
|
|
23302
|
+
}
|
|
23303
|
+
},
|
|
23158
23304
|
value: selectedFieldValue,
|
|
23159
|
-
...readOnlyProps
|
|
23305
|
+
...readOnlyProps,
|
|
23306
|
+
id: "filter-field"
|
|
23160
23307
|
}
|
|
23161
23308
|
),
|
|
23162
23309
|
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
@@ -23170,7 +23317,16 @@ var FilterItem = ({
|
|
|
23170
23317
|
},
|
|
23171
23318
|
isDisabled: !filters[index].field,
|
|
23172
23319
|
value: selectedOperatorValue,
|
|
23173
|
-
|
|
23320
|
+
styles: {
|
|
23321
|
+
menu(base) {
|
|
23322
|
+
return {
|
|
23323
|
+
...base,
|
|
23324
|
+
minWidth: "max-content"
|
|
23325
|
+
};
|
|
23326
|
+
}
|
|
23327
|
+
},
|
|
23328
|
+
...readOnlyProps,
|
|
23329
|
+
id: "filter-operator"
|
|
23174
23330
|
}
|
|
23175
23331
|
),
|
|
23176
23332
|
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
@@ -23182,16 +23338,18 @@ var FilterItem = ({
|
|
|
23182
23338
|
onChange: (e) => onValueChange(e != null ? e : ""),
|
|
23183
23339
|
readOnly,
|
|
23184
23340
|
isDisabled: !filters[index].operator,
|
|
23185
|
-
value: selectedMetaValue
|
|
23341
|
+
value: selectedMetaValue,
|
|
23342
|
+
valueTestId: "filter-value"
|
|
23186
23343
|
}
|
|
23187
23344
|
),
|
|
23188
|
-
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
23345
|
+
readOnly ? null : /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
23189
23346
|
"button",
|
|
23190
23347
|
{
|
|
23191
23348
|
type: "button",
|
|
23192
23349
|
onClick: () => handleDeleteFilter(index),
|
|
23193
23350
|
"aria-label": "delete filter",
|
|
23194
23351
|
css: IconBtn,
|
|
23352
|
+
"data-testid": "delete-filter",
|
|
23195
23353
|
children: /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Icon, { icon: "trash", iconColor: "red", size: "1rem" })
|
|
23196
23354
|
}
|
|
23197
23355
|
)
|
|
@@ -23204,6 +23362,7 @@ var FilterItems = ({
|
|
|
23204
23362
|
}) => {
|
|
23205
23363
|
const { filterOptions, filters, setFilters, handleAddFilter, handleResetFilters, setFilterVisibility } = useSearchAndFilter();
|
|
23206
23364
|
const handleUpdateFilter = (index, prop, value) => {
|
|
23365
|
+
var _a, _b, _c, _d, _e;
|
|
23207
23366
|
const next = [...filters];
|
|
23208
23367
|
next[index] = { ...next[index], [prop]: value };
|
|
23209
23368
|
if (prop === "operator") {
|
|
@@ -23216,7 +23375,11 @@ var FilterItems = ({
|
|
|
23216
23375
|
}
|
|
23217
23376
|
}
|
|
23218
23377
|
if (prop === "field") {
|
|
23219
|
-
|
|
23378
|
+
const firstOperatorInAvailableOperators = (_e = (_d = (_c = (_b = (_a = filterOptions.find((fo) => {
|
|
23379
|
+
var _a2;
|
|
23380
|
+
return (_a2 = fo.options) == null ? void 0 : _a2.find((op) => op.value === value);
|
|
23381
|
+
})) == null ? void 0 : _a.options) == null ? void 0 : _b.find((op) => op.value === next[index].field)) == null ? void 0 : _c.operatorOptions) == null ? void 0 : _d[0].value) != null ? _e : "eq";
|
|
23382
|
+
next[index].operator = firstOperatorInAvailableOperators;
|
|
23220
23383
|
next[index].value = "";
|
|
23221
23384
|
}
|
|
23222
23385
|
setFilters(next);
|
|
@@ -23226,10 +23389,19 @@ var FilterItems = ({
|
|
|
23226
23389
|
{
|
|
23227
23390
|
id: "search-and-filter-options",
|
|
23228
23391
|
menuControls: /* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(import_jsx_runtime123.Fragment, { children: [
|
|
23229
|
-
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
|
|
23230
|
-
|
|
23231
|
-
|
|
23232
|
-
|
|
23392
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsxs)(
|
|
23393
|
+
"button",
|
|
23394
|
+
{
|
|
23395
|
+
type: "button",
|
|
23396
|
+
css: AddConditionalBtn,
|
|
23397
|
+
onClick: handleAddFilter,
|
|
23398
|
+
"data-testid": "add-filter",
|
|
23399
|
+
children: [
|
|
23400
|
+
/* @__PURE__ */ (0, import_jsx_runtime123.jsx)(Icon, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
|
|
23401
|
+
addButtonText
|
|
23402
|
+
]
|
|
23403
|
+
}
|
|
23404
|
+
),
|
|
23233
23405
|
(filters == null ? void 0 : filters.length) ? /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
23234
23406
|
"button",
|
|
23235
23407
|
{
|
|
@@ -23239,6 +23411,7 @@ var FilterItems = ({
|
|
|
23239
23411
|
handleResetFilters();
|
|
23240
23412
|
setFilterVisibility(void 0);
|
|
23241
23413
|
},
|
|
23414
|
+
"data-testid": "reset-filters",
|
|
23242
23415
|
children: resetButtonText
|
|
23243
23416
|
}
|
|
23244
23417
|
) : null
|
|
@@ -23496,7 +23669,7 @@ var SortItems = () => {
|
|
|
23496
23669
|
var _a2;
|
|
23497
23670
|
return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
|
|
23498
23671
|
})) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
|
|
23499
|
-
return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(FilterMenu, { id: "search-and-filter-options", filterTitle: "Sort by", children: /* @__PURE__ */ (0, import_jsx_runtime125.
|
|
23672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(FilterMenu, { id: "search-and-filter-options", filterTitle: "Sort by", children: /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)("div", { css: SortFilterInputRow, children: [
|
|
23500
23673
|
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(
|
|
23501
23674
|
InputComboBox,
|
|
23502
23675
|
{
|
|
@@ -23505,6 +23678,14 @@ var SortItems = () => {
|
|
|
23505
23678
|
const fieldName = e == null ? void 0 : e.value;
|
|
23506
23679
|
setSortBy(`${fieldName}_${sortDirection}`);
|
|
23507
23680
|
},
|
|
23681
|
+
styles: {
|
|
23682
|
+
menu(base) {
|
|
23683
|
+
return {
|
|
23684
|
+
...base,
|
|
23685
|
+
minWidth: "max-content"
|
|
23686
|
+
};
|
|
23687
|
+
}
|
|
23688
|
+
},
|
|
23508
23689
|
value: currentSelectedOption
|
|
23509
23690
|
}
|
|
23510
23691
|
),
|
|
@@ -23521,7 +23702,7 @@ var SortItems = () => {
|
|
|
23521
23702
|
value: sortDirection
|
|
23522
23703
|
}
|
|
23523
23704
|
)
|
|
23524
|
-
] }) })
|
|
23705
|
+
] }) });
|
|
23525
23706
|
};
|
|
23526
23707
|
|
|
23527
23708
|
// src/components/SearchAndFilter/FilterModeView.tsx
|
|
@@ -24357,6 +24538,7 @@ var ToastContainer = ({ limit = 4 }) => {
|
|
|
24357
24538
|
RICHTEXT_OPERATORS,
|
|
24358
24539
|
ResolveIcon,
|
|
24359
24540
|
RichTextToolbarIcon,
|
|
24541
|
+
SYSTEM_DATE_OPERATORS,
|
|
24360
24542
|
SYSTEM_FIELD_OPERATORS,
|
|
24361
24543
|
ScrollableList,
|
|
24362
24544
|
ScrollableListInputItem,
|