@uniformdev/mesh-sdk-react 19.157.1-alpha.6 → 19.159.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/index.d.mts +95 -130
- package/dist/index.d.ts +95 -130
- package/dist/index.esm.js +743 -636
- package/dist/index.js +796 -703
- package/dist/index.mjs +743 -636
- package/package.json +5 -5
package/dist/index.esm.js
CHANGED
|
@@ -7478,11 +7478,6 @@ var SYSTEM_DATE_OPERATORS = [
|
|
|
7478
7478
|
label: "is on or after...",
|
|
7479
7479
|
value: "sys-date-gte",
|
|
7480
7480
|
editorType: "date"
|
|
7481
|
-
},
|
|
7482
|
-
{
|
|
7483
|
-
label: "is not",
|
|
7484
|
-
value: "sys-date-neq",
|
|
7485
|
-
editorType: "date"
|
|
7486
7481
|
}
|
|
7487
7482
|
];
|
|
7488
7483
|
var RICHTEXT_OPERATORS = [
|
|
@@ -7638,311 +7633,175 @@ var MULTI_SELECT_OPERATORS = [
|
|
|
7638
7633
|
}
|
|
7639
7634
|
];
|
|
7640
7635
|
|
|
7641
|
-
// src/components/SearchAndFilter/
|
|
7642
|
-
import {
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
import {
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
|
|
7650
|
-
|
|
7651
|
-
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
|
|
7660
|
-
|
|
7661
|
-
|
|
7662
|
-
|
|
7663
|
-
|
|
7664
|
-
|
|
7665
|
-
|
|
7666
|
-
|
|
7667
|
-
|
|
7668
|
-
&:after {
|
|
7669
|
-
content: '';
|
|
7670
|
-
display: block;
|
|
7671
|
-
height: 1px;
|
|
7672
|
-
background: var(--gray-300);
|
|
7673
|
-
width: calc(100% - var(--spacing-base));
|
|
7674
|
-
margin-left: var(--spacing-base);
|
|
7675
|
-
}
|
|
7676
|
-
&:last-of-type:after {
|
|
7677
|
-
display: none;
|
|
7636
|
+
// src/components/SearchAndFilter/editors/DateEditor.tsx
|
|
7637
|
+
import { Input as Input6 } from "@uniformdev/design-system";
|
|
7638
|
+
import { useState as useState19 } from "react";
|
|
7639
|
+
import { useDebounce as useDebounce4 } from "react-use";
|
|
7640
|
+
import { jsx as jsx69 } from "@emotion/react/jsx-runtime";
|
|
7641
|
+
var DateEditor = ({
|
|
7642
|
+
onChange,
|
|
7643
|
+
ariaLabel,
|
|
7644
|
+
disabled,
|
|
7645
|
+
value,
|
|
7646
|
+
readOnly,
|
|
7647
|
+
valueTestId
|
|
7648
|
+
}) => {
|
|
7649
|
+
const [innerValue, setInnerValue] = useState19(value != null ? value : "");
|
|
7650
|
+
useDebounce4(() => onChange(innerValue), 500, [innerValue]);
|
|
7651
|
+
return /* @__PURE__ */ jsx69(
|
|
7652
|
+
Input6,
|
|
7653
|
+
{
|
|
7654
|
+
type: "date",
|
|
7655
|
+
label: ariaLabel,
|
|
7656
|
+
showLabel: false,
|
|
7657
|
+
onChange: (e) => setInnerValue(e.currentTarget.value),
|
|
7658
|
+
disabled,
|
|
7659
|
+
value: innerValue,
|
|
7660
|
+
readOnly,
|
|
7661
|
+
"data-testid": valueTestId
|
|
7678
7662
|
}
|
|
7679
|
-
|
|
7663
|
+
);
|
|
7664
|
+
};
|
|
7680
7665
|
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
|
|
7666
|
+
// src/components/SearchAndFilter/editors/DateRangeEditor.tsx
|
|
7667
|
+
import { Input as Input7 } from "@uniformdev/design-system";
|
|
7668
|
+
import { useEffect as useEffect19, useState as useState20 } from "react";
|
|
7669
|
+
import { useDebounce as useDebounce5 } from "react-use";
|
|
7685
7670
|
|
|
7686
|
-
|
|
7687
|
-
|
|
7688
|
-
|
|
7671
|
+
// src/components/SearchAndFilter/editors/shared/ErrorContainer.tsx
|
|
7672
|
+
import { FieldMessage } from "@uniformdev/design-system";
|
|
7673
|
+
import { jsx as jsx70 } from "@emotion/react/jsx-runtime";
|
|
7674
|
+
var ErrorContainer = ({ errorMessage }) => {
|
|
7675
|
+
return /* @__PURE__ */ jsx70(
|
|
7676
|
+
"div",
|
|
7677
|
+
{
|
|
7678
|
+
css: {
|
|
7679
|
+
gridColumn: "span 6",
|
|
7680
|
+
order: 6
|
|
7681
|
+
},
|
|
7682
|
+
children: /* @__PURE__ */ jsx70(FieldMessage, { errorMessage })
|
|
7689
7683
|
}
|
|
7690
|
-
|
|
7684
|
+
);
|
|
7685
|
+
};
|
|
7691
7686
|
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
|
|
7696
|
-
var
|
|
7697
|
-
|
|
7698
|
-
gap: var(--spacing-sm);
|
|
7699
|
-
flex-wrap: wrap;
|
|
7687
|
+
// src/components/SearchAndFilter/editors/shared/twoColumnGrid.tsx
|
|
7688
|
+
var twoColumnGrid = {
|
|
7689
|
+
display: "grid",
|
|
7690
|
+
gridTemplateColumns: "1fr 1fr",
|
|
7691
|
+
gap: "var(--spacing-sm);"
|
|
7692
|
+
};
|
|
7700
7693
|
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7694
|
+
// src/components/SearchAndFilter/editors/DateRangeEditor.tsx
|
|
7695
|
+
import { Fragment as Fragment14, jsx as jsx71, jsxs as jsxs42 } from "@emotion/react/jsx-runtime";
|
|
7696
|
+
var DateRangeEditor = ({
|
|
7697
|
+
ariaLabel,
|
|
7698
|
+
onChange,
|
|
7699
|
+
disabled,
|
|
7700
|
+
value,
|
|
7701
|
+
readOnly,
|
|
7702
|
+
valueTestId
|
|
7703
|
+
}) => {
|
|
7704
|
+
const [minDateValue, setMinDateValue] = useState20(value ? value[0] : "");
|
|
7705
|
+
const [maxDateValue, setMaxDateValue] = useState20(value ? value[1] : "");
|
|
7706
|
+
const [error, setError] = useState20("");
|
|
7707
|
+
useDebounce5(
|
|
7708
|
+
() => {
|
|
7709
|
+
if (minDateValue && maxDateValue && !error) {
|
|
7710
|
+
onChange([minDateValue, maxDateValue]);
|
|
7711
|
+
} else {
|
|
7712
|
+
onChange([]);
|
|
7713
|
+
}
|
|
7714
|
+
},
|
|
7715
|
+
500,
|
|
7716
|
+
[minDateValue, maxDateValue]
|
|
7717
|
+
);
|
|
7718
|
+
useEffect19(() => {
|
|
7719
|
+
if (!minDateValue || !maxDateValue) {
|
|
7720
|
+
return;
|
|
7704
7721
|
}
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
|
|
7722
|
+
const minDate = new Date(minDateValue);
|
|
7723
|
+
const maxDate = new Date(maxDateValue);
|
|
7724
|
+
if (maxDate < minDate) {
|
|
7725
|
+
setError("The max date cannot be lower than the min date");
|
|
7726
|
+
return;
|
|
7708
7727
|
}
|
|
7709
|
-
|
|
7710
|
-
|
|
7711
|
-
|
|
7712
|
-
grid-template-columns: 200px 160px 1fr 32px;
|
|
7713
|
-
|
|
7714
|
-
& > div:nth-child(n) {
|
|
7715
|
-
width: auto;
|
|
7728
|
+
if (maxDate && !minDate) {
|
|
7729
|
+
setError("Please enter both a low and high date");
|
|
7730
|
+
return;
|
|
7716
7731
|
}
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7732
|
+
const minDateString = minDate.toDateString();
|
|
7733
|
+
const maxDateString = maxDate.toDateString();
|
|
7734
|
+
if (minDateString === maxDateString || maxDateString === minDateString) {
|
|
7735
|
+
setError("The min and max date cannot be the same");
|
|
7736
|
+
return;
|
|
7737
|
+
}
|
|
7738
|
+
if (minDate > maxDate) {
|
|
7739
|
+
setError("The min date cannot be higher than the max date");
|
|
7740
|
+
return;
|
|
7741
|
+
}
|
|
7742
|
+
if (error) {
|
|
7743
|
+
setError("");
|
|
7744
|
+
}
|
|
7745
|
+
if (minDate && maxDate) {
|
|
7746
|
+
setMinDateValue(minDateValue);
|
|
7747
|
+
setMaxDateValue(maxDateValue);
|
|
7748
|
+
} else {
|
|
7749
|
+
setMinDateValue("");
|
|
7750
|
+
setMaxDateValue("");
|
|
7751
|
+
}
|
|
7752
|
+
}, [minDateValue, maxDateValue, setError]);
|
|
7753
|
+
return /* @__PURE__ */ jsxs42(Fragment14, { children: [
|
|
7754
|
+
/* @__PURE__ */ jsxs42("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
7755
|
+
/* @__PURE__ */ jsx71(
|
|
7756
|
+
Input7,
|
|
7757
|
+
{
|
|
7758
|
+
label: `${ariaLabel}-min-date`,
|
|
7759
|
+
type: "date",
|
|
7760
|
+
showLabel: false,
|
|
7761
|
+
value: minDateValue,
|
|
7762
|
+
onChange: (e) => setMinDateValue(e.currentTarget.value),
|
|
7763
|
+
"aria-invalid": !error ? false : true,
|
|
7764
|
+
disabled,
|
|
7765
|
+
readOnly,
|
|
7766
|
+
"data-testid": "value-low"
|
|
7767
|
+
}
|
|
7768
|
+
),
|
|
7769
|
+
/* @__PURE__ */ jsx71(
|
|
7770
|
+
Input7,
|
|
7771
|
+
{
|
|
7772
|
+
label: `${ariaLabel}-max-date`,
|
|
7773
|
+
type: "date",
|
|
7774
|
+
showLabel: false,
|
|
7775
|
+
value: maxDateValue,
|
|
7776
|
+
onChange: (e) => setMaxDateValue(e.currentTarget.value),
|
|
7777
|
+
"aria-invalid": !error ? false : true,
|
|
7778
|
+
disabled,
|
|
7779
|
+
readOnly,
|
|
7780
|
+
"data-testid": "value-high"
|
|
7781
|
+
}
|
|
7782
|
+
)
|
|
7783
|
+
] }),
|
|
7784
|
+
/* @__PURE__ */ jsx71(ErrorContainer, { errorMessage: error })
|
|
7785
|
+
] });
|
|
7786
|
+
};
|
|
7765
7787
|
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7788
|
+
// src/components/SearchAndFilter/editors/FilterMultiChoiceEditor.tsx
|
|
7789
|
+
import {
|
|
7790
|
+
convertComboBoxGroupsToSelectableGroups,
|
|
7791
|
+
getComboBoxSelectedSelectableGroups,
|
|
7792
|
+
InputComboBox
|
|
7793
|
+
} from "@uniformdev/design-system";
|
|
7794
|
+
import { useMemo as useMemo17 } from "react";
|
|
7770
7795
|
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7796
|
+
// src/components/SearchAndFilter/editors/shared/readOnlyAttributes.tsx
|
|
7797
|
+
var readOnlyAttributes = {
|
|
7798
|
+
isSearchable: false,
|
|
7799
|
+
menuIsOpen: false,
|
|
7800
|
+
isClearable: false
|
|
7801
|
+
};
|
|
7776
7802
|
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
}
|
|
7780
|
-
}
|
|
7781
|
-
|
|
7782
|
-
&:disabled {
|
|
7783
|
-
opacity: var(--opacity-50);
|
|
7784
|
-
}
|
|
7785
|
-
`;
|
|
7786
|
-
var FilterButtonText = css38`
|
|
7787
|
-
overflow: hidden;
|
|
7788
|
-
text-overflow: ellipsis;
|
|
7789
|
-
white-space: nowrap;
|
|
7790
|
-
max-width: 14ch;
|
|
7791
|
-
`;
|
|
7792
|
-
var FilterButtonSelected = css38`
|
|
7793
|
-
background: var(--gray-100);
|
|
7794
|
-
border-color: var(--gray-300);
|
|
7795
|
-
|
|
7796
|
-
svg {
|
|
7797
|
-
color: var(--accent-dark);
|
|
7798
|
-
}
|
|
7799
|
-
`;
|
|
7800
|
-
var FilterButtonWithOptions = css38`
|
|
7801
|
-
:where([aria-expanded='true']) {
|
|
7802
|
-
background: var(--purple-rain-100);
|
|
7803
|
-
border-color: var(--accent-light);
|
|
7804
|
-
color: var(--typography-base);
|
|
7805
|
-
box-shadow: var(--elevation-100);
|
|
7806
|
-
|
|
7807
|
-
svg {
|
|
7808
|
-
color: var(--accent-dark);
|
|
7809
|
-
}
|
|
7810
|
-
}
|
|
7811
|
-
`;
|
|
7812
|
-
var SearchIcon = css38`
|
|
7813
|
-
color: var(--icon-color);
|
|
7814
|
-
position: absolute;
|
|
7815
|
-
inset: 0 var(--spacing-base) 0 auto;
|
|
7816
|
-
margin: auto;
|
|
7817
|
-
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
7818
|
-
`;
|
|
7819
|
-
var AddConditionalBtn = css38`
|
|
7820
|
-
align-items: center;
|
|
7821
|
-
background: transparent;
|
|
7822
|
-
border: none;
|
|
7823
|
-
color: var(--primary-action-default);
|
|
7824
|
-
display: flex;
|
|
7825
|
-
gap: var(--spacing-sm);
|
|
7826
|
-
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
7827
|
-
padding: 0;
|
|
7828
|
-
|
|
7829
|
-
&:hover,
|
|
7830
|
-
&:focus {
|
|
7831
|
-
color: var(--primary-action-hover);
|
|
7832
|
-
}
|
|
7833
|
-
|
|
7834
|
-
&:disabled {
|
|
7835
|
-
color: var(--gray-400);
|
|
7836
|
-
}
|
|
7837
|
-
`;
|
|
7838
|
-
var Title = css38`
|
|
7839
|
-
color: var(--typography-light);
|
|
7840
|
-
|
|
7841
|
-
&:focus {
|
|
7842
|
-
outline: none;
|
|
7843
|
-
}
|
|
7844
|
-
`;
|
|
7845
|
-
var ResetConditionsBtn = css38`
|
|
7846
|
-
background: transparent;
|
|
7847
|
-
border: none;
|
|
7848
|
-
color: var(--action-destructive-default);
|
|
7849
|
-
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
7850
|
-
padding: 0;
|
|
7851
|
-
|
|
7852
|
-
&:hover,
|
|
7853
|
-
&:focus {
|
|
7854
|
-
color: var(--action-destructive-hover);
|
|
7855
|
-
}
|
|
7856
|
-
`;
|
|
7857
|
-
var IconBtn = css38`
|
|
7858
|
-
background: transparent;
|
|
7859
|
-
border: none;
|
|
7860
|
-
padding: var(--spacing-sm);
|
|
7861
|
-
`;
|
|
7862
|
-
var SearchAndFilterOptionsContainer = css38`
|
|
7863
|
-
background: var(--gray-50);
|
|
7864
|
-
border: 1px solid var(--gray-300);
|
|
7865
|
-
border-radius: var(--rounded-base);
|
|
7866
|
-
container-type: inline-size;
|
|
7867
|
-
display: flex;
|
|
7868
|
-
flex-direction: column;
|
|
7869
|
-
gap: var(--spacing-sm);
|
|
7870
|
-
padding: var(--spacing-md) 0 var(--spacing-base);
|
|
7871
|
-
will-change: height;
|
|
7872
|
-
position: relative;
|
|
7873
|
-
z-index: 1;
|
|
7874
|
-
`;
|
|
7875
|
-
var SearchAndFilterOptionsInnerContainer = css38`
|
|
7876
|
-
display: flex;
|
|
7877
|
-
flex-direction: column;
|
|
7878
|
-
gap: var(--spacing-sm);
|
|
7879
|
-
padding-inline: var(--spacing-md);
|
|
7880
|
-
`;
|
|
7881
|
-
var SearchAndFilterButtonGroup = css38`
|
|
7882
|
-
margin-top: var(--spacing-xs);
|
|
7883
|
-
margin-left: calc(56px + var(--spacing-md));
|
|
7884
|
-
`;
|
|
7885
|
-
|
|
7886
|
-
// src/components/SearchAndFilter/FilterButton.tsx
|
|
7887
|
-
import { jsx as jsx69, jsxs as jsxs42 } from "@emotion/react/jsx-runtime";
|
|
7888
|
-
var FilterButton2 = ({
|
|
7889
|
-
text = "Filters",
|
|
7890
|
-
icon = "filter-add",
|
|
7891
|
-
filterCount,
|
|
7892
|
-
hasSelectedValue,
|
|
7893
|
-
dataTestId,
|
|
7894
|
-
...props
|
|
7895
|
-
}) => {
|
|
7896
|
-
return /* @__PURE__ */ jsxs42(
|
|
7897
|
-
"button",
|
|
7898
|
-
{
|
|
7899
|
-
type: "button",
|
|
7900
|
-
css: [
|
|
7901
|
-
FilterButton,
|
|
7902
|
-
hasSelectedValue ? FilterButtonSelected : void 0,
|
|
7903
|
-
filterCount ? [FilterButtonWithOptions, FilterButtonSelected] : void 0
|
|
7904
|
-
],
|
|
7905
|
-
...props,
|
|
7906
|
-
"data-testid": dataTestId,
|
|
7907
|
-
children: [
|
|
7908
|
-
/* @__PURE__ */ jsx69(Icon6, { icon, iconColor: "currentColor", size: "1rem" }),
|
|
7909
|
-
/* @__PURE__ */ jsx69("span", { css: FilterButtonText, children: text }),
|
|
7910
|
-
filterCount ? /* @__PURE__ */ jsx69(Counter2, { count: filterCount, bgColor: "var(--white)" }) : null
|
|
7911
|
-
]
|
|
7912
|
-
}
|
|
7913
|
-
);
|
|
7914
|
-
};
|
|
7915
|
-
|
|
7916
|
-
// src/components/SearchAndFilter/FilterControls.tsx
|
|
7917
|
-
import { CgClose as CgClose5 } from "@react-icons/all-files/cg/CgClose";
|
|
7918
|
-
import { Icon as Icon7, InputKeywordSearch as InputKeywordSearch2 } from "@uniformdev/design-system";
|
|
7919
|
-
import { CLEAR_EDITOR_COMMAND as CLEAR_EDITOR_COMMAND2 } from "lexical";
|
|
7920
|
-
import { useEffect as useEffect21, useRef as useRef16, useState as useState21 } from "react";
|
|
7921
|
-
import { useDebounce as useDebounce5 } from "react-use";
|
|
7922
|
-
import { v4 as v43 } from "uuid";
|
|
7923
|
-
|
|
7924
|
-
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
7925
|
-
import { VerticalRhythm as VerticalRhythm5 } from "@uniformdev/design-system";
|
|
7926
|
-
import {
|
|
7927
|
-
createContext as createContext6,
|
|
7928
|
-
useCallback as useCallback6,
|
|
7929
|
-
useContext as useContext8,
|
|
7930
|
-
useDeferredValue as useDeferredValue2,
|
|
7931
|
-
useEffect as useEffect20,
|
|
7932
|
-
useMemo as useMemo17,
|
|
7933
|
-
useState as useState20
|
|
7934
|
-
} from "react";
|
|
7935
|
-
|
|
7936
|
-
// src/components/SearchAndFilter/FilterEditor.tsx
|
|
7937
|
-
import { FieldMessage, Input as Input6, InputComboBox, StatusBullet } from "@uniformdev/design-system";
|
|
7938
|
-
import { useEffect as useEffect19, useState as useState19 } from "react";
|
|
7939
|
-
import { useDebounce as useDebounce4 } from "react-use";
|
|
7940
|
-
import { Fragment as Fragment14, jsx as jsx70, jsxs as jsxs43 } from "@emotion/react/jsx-runtime";
|
|
7941
|
-
var readOnlyAttributes = {
|
|
7942
|
-
isSearchable: false,
|
|
7943
|
-
menuIsOpen: false,
|
|
7944
|
-
isClearable: false
|
|
7945
|
-
};
|
|
7803
|
+
// src/components/SearchAndFilter/editors/FilterMultiChoiceEditor.tsx
|
|
7804
|
+
import { jsx as jsx72 } from "@emotion/react/jsx-runtime";
|
|
7946
7805
|
var FilterMultiChoiceEditor = ({
|
|
7947
7806
|
value,
|
|
7948
7807
|
options,
|
|
@@ -7953,20 +7812,24 @@ var FilterMultiChoiceEditor = ({
|
|
|
7953
7812
|
}) => {
|
|
7954
7813
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
7955
7814
|
const isClearable = !readOnly || !disabled;
|
|
7956
|
-
|
|
7815
|
+
const { groupedOptions, selectedOptions } = useMemo17(
|
|
7816
|
+
() => convertComboBoxGroupsToSelectableGroups({ options: options != null ? options : [], selectedItems: new Set(value) }),
|
|
7817
|
+
[options, value]
|
|
7818
|
+
);
|
|
7819
|
+
return /* @__PURE__ */ jsx72("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx72(
|
|
7957
7820
|
InputComboBox,
|
|
7958
7821
|
{
|
|
7959
7822
|
...props,
|
|
7960
7823
|
placeholder: "Type to search...",
|
|
7961
|
-
options,
|
|
7824
|
+
options: groupedOptions,
|
|
7962
7825
|
isMulti: true,
|
|
7963
7826
|
isClearable,
|
|
7964
7827
|
isDisabled: disabled,
|
|
7965
7828
|
onChange: (e) => {
|
|
7966
|
-
|
|
7967
|
-
return props.onChange(
|
|
7829
|
+
const selectedValues = getComboBoxSelectedSelectableGroups(e);
|
|
7830
|
+
return props.onChange([...selectedValues]);
|
|
7968
7831
|
},
|
|
7969
|
-
value:
|
|
7832
|
+
value: selectedOptions,
|
|
7970
7833
|
"aria-readonly": readOnly,
|
|
7971
7834
|
styles: {
|
|
7972
7835
|
menu(base) {
|
|
@@ -7980,6 +7843,14 @@ var FilterMultiChoiceEditor = ({
|
|
|
7980
7843
|
}
|
|
7981
7844
|
) });
|
|
7982
7845
|
};
|
|
7846
|
+
|
|
7847
|
+
// src/components/SearchAndFilter/editors/FilterSingleChoiceEditor.tsx
|
|
7848
|
+
import {
|
|
7849
|
+
convertComboBoxGroupsToSelectableGroups as convertComboBoxGroupsToSelectableGroups2,
|
|
7850
|
+
InputComboBox as InputComboBox2
|
|
7851
|
+
} from "@uniformdev/design-system";
|
|
7852
|
+
import { useMemo as useMemo18 } from "react";
|
|
7853
|
+
import { jsx as jsx73 } from "@emotion/react/jsx-runtime";
|
|
7983
7854
|
var FilterSingleChoiceEditor = ({
|
|
7984
7855
|
options,
|
|
7985
7856
|
value,
|
|
@@ -7988,91 +7859,30 @@ var FilterSingleChoiceEditor = ({
|
|
|
7988
7859
|
onChange,
|
|
7989
7860
|
valueTestId
|
|
7990
7861
|
}) => {
|
|
7991
|
-
var _a;
|
|
7992
7862
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
7993
|
-
|
|
7994
|
-
|
|
7863
|
+
const { groupedOptions, selectedOptions } = useMemo18(
|
|
7864
|
+
() => convertComboBoxGroupsToSelectableGroups2({
|
|
7865
|
+
options: options != null ? options : [],
|
|
7866
|
+
selectedItems: new Set(value ? [value] : void 0),
|
|
7867
|
+
selectionMode: "single"
|
|
7868
|
+
}),
|
|
7869
|
+
[options, value]
|
|
7870
|
+
);
|
|
7871
|
+
return /* @__PURE__ */ jsx73("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx73(
|
|
7872
|
+
InputComboBox2,
|
|
7995
7873
|
{
|
|
7996
7874
|
placeholder: "Type to search...",
|
|
7997
|
-
options,
|
|
7875
|
+
options: groupedOptions,
|
|
7998
7876
|
isClearable: true,
|
|
7999
7877
|
onChange: (e) => {
|
|
8000
|
-
|
|
8001
|
-
|
|
8002
|
-
},
|
|
8003
|
-
isDisabled: disabled,
|
|
8004
|
-
value: (_a = options == null ? void 0 : options.find((option) => option.value === value)) != null ? _a : null,
|
|
8005
|
-
"aria-readonly": readOnly,
|
|
8006
|
-
styles: {
|
|
8007
|
-
menu(base) {
|
|
8008
|
-
return {
|
|
8009
|
-
...base,
|
|
8010
|
-
minWidth: "max-content"
|
|
8011
|
-
};
|
|
7878
|
+
if (Array.isArray(e == null ? void 0 : e.value)) {
|
|
7879
|
+
return;
|
|
8012
7880
|
}
|
|
7881
|
+
return onChange(e == null ? void 0 : e.value);
|
|
8013
7882
|
},
|
|
8014
|
-
...readOnlyProps
|
|
8015
|
-
}
|
|
8016
|
-
) });
|
|
8017
|
-
};
|
|
8018
|
-
var CustomOptions = ({ label, value }) => {
|
|
8019
|
-
return /* @__PURE__ */ jsx70(StatusBullet, { status: label, message: value });
|
|
8020
|
-
};
|
|
8021
|
-
var StatusMultiEditor = ({
|
|
8022
|
-
options,
|
|
8023
|
-
value,
|
|
8024
|
-
disabled,
|
|
8025
|
-
readOnly,
|
|
8026
|
-
onChange,
|
|
8027
|
-
valueTestId
|
|
8028
|
-
}) => {
|
|
8029
|
-
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
8030
|
-
return /* @__PURE__ */ jsx70("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx70(
|
|
8031
|
-
InputComboBox,
|
|
8032
|
-
{
|
|
8033
|
-
options,
|
|
8034
|
-
isMulti: true,
|
|
8035
|
-
onChange: (e) => {
|
|
8036
|
-
var _a;
|
|
8037
|
-
return onChange((_a = e.map((item) => item.value)) != null ? _a : []);
|
|
8038
|
-
},
|
|
8039
|
-
formatOptionLabel: CustomOptions,
|
|
8040
|
-
"aria-readonly": readOnly,
|
|
8041
|
-
value: options == null ? void 0 : options.filter((option) => value == null ? void 0 : value.includes(option.value)),
|
|
8042
7883
|
isDisabled: disabled,
|
|
8043
|
-
|
|
8044
|
-
menu(base) {
|
|
8045
|
-
return {
|
|
8046
|
-
...base,
|
|
8047
|
-
minWidth: "max-content"
|
|
8048
|
-
};
|
|
8049
|
-
}
|
|
8050
|
-
},
|
|
8051
|
-
...readOnlyProps
|
|
8052
|
-
}
|
|
8053
|
-
) });
|
|
8054
|
-
};
|
|
8055
|
-
var StatusSingleEditor = ({
|
|
8056
|
-
options,
|
|
8057
|
-
value,
|
|
8058
|
-
disabled,
|
|
8059
|
-
readOnly,
|
|
8060
|
-
onChange,
|
|
8061
|
-
valueTestId
|
|
8062
|
-
}) => {
|
|
8063
|
-
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
8064
|
-
return /* @__PURE__ */ jsx70("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx70(
|
|
8065
|
-
InputComboBox,
|
|
8066
|
-
{
|
|
8067
|
-
options,
|
|
8068
|
-
onChange: (e) => {
|
|
8069
|
-
var _a;
|
|
8070
|
-
return onChange((_a = e == null ? void 0 : e.value) != null ? _a : "");
|
|
8071
|
-
},
|
|
8072
|
-
formatOptionLabel: CustomOptions,
|
|
7884
|
+
value: selectedOptions,
|
|
8073
7885
|
"aria-readonly": readOnly,
|
|
8074
|
-
value: options == null ? void 0 : options.find((option) => option.value === value),
|
|
8075
|
-
isDisabled: disabled,
|
|
8076
7886
|
styles: {
|
|
8077
7887
|
menu(base) {
|
|
8078
7888
|
return {
|
|
@@ -8085,28 +7895,43 @@ var StatusSingleEditor = ({
|
|
|
8085
7895
|
}
|
|
8086
7896
|
) });
|
|
8087
7897
|
};
|
|
8088
|
-
|
|
8089
|
-
|
|
7898
|
+
|
|
7899
|
+
// src/components/SearchAndFilter/editors/NumberEditor.tsx
|
|
7900
|
+
import { Input as Input8 } from "@uniformdev/design-system";
|
|
7901
|
+
import { useState as useState21 } from "react";
|
|
7902
|
+
import { useDebounce as useDebounce6 } from "react-use";
|
|
7903
|
+
import { jsx as jsx74 } from "@emotion/react/jsx-runtime";
|
|
7904
|
+
var NumberEditor = ({
|
|
8090
7905
|
ariaLabel,
|
|
7906
|
+
onChange,
|
|
7907
|
+
disabled,
|
|
8091
7908
|
value,
|
|
8092
7909
|
readOnly,
|
|
8093
7910
|
valueTestId
|
|
8094
7911
|
}) => {
|
|
8095
|
-
const [innerValue, setInnerValue] =
|
|
8096
|
-
|
|
8097
|
-
return /* @__PURE__ */
|
|
8098
|
-
|
|
7912
|
+
const [innerValue, setInnerValue] = useState21(value != null ? value : "");
|
|
7913
|
+
useDebounce6(() => onChange(innerValue), 500, [innerValue]);
|
|
7914
|
+
return /* @__PURE__ */ jsx74(
|
|
7915
|
+
Input8,
|
|
8099
7916
|
{
|
|
8100
|
-
showLabel: false,
|
|
8101
7917
|
label: ariaLabel,
|
|
7918
|
+
type: "number",
|
|
7919
|
+
showLabel: false,
|
|
7920
|
+
min: 0,
|
|
8102
7921
|
onChange: (e) => setInnerValue(e.currentTarget.value),
|
|
8103
|
-
|
|
7922
|
+
disabled,
|
|
8104
7923
|
value: innerValue,
|
|
8105
7924
|
readOnly,
|
|
8106
7925
|
"data-testid": valueTestId
|
|
8107
7926
|
}
|
|
8108
7927
|
);
|
|
8109
7928
|
};
|
|
7929
|
+
|
|
7930
|
+
// src/components/SearchAndFilter/editors/NumberRangeEditor.tsx
|
|
7931
|
+
import { Input as Input9 } from "@uniformdev/design-system";
|
|
7932
|
+
import { useEffect as useEffect20, useState as useState22 } from "react";
|
|
7933
|
+
import { useDebounce as useDebounce7 } from "react-use";
|
|
7934
|
+
import { Fragment as Fragment15, jsx as jsx75, jsxs as jsxs43 } from "@emotion/react/jsx-runtime";
|
|
8110
7935
|
var NumberRangeEditor = ({
|
|
8111
7936
|
onChange,
|
|
8112
7937
|
disabled,
|
|
@@ -8115,10 +7940,10 @@ var NumberRangeEditor = ({
|
|
|
8115
7940
|
readOnly,
|
|
8116
7941
|
valueTestId
|
|
8117
7942
|
}) => {
|
|
8118
|
-
const [minValue, setMinValue] =
|
|
8119
|
-
const [maxValue, setMaxValue] =
|
|
8120
|
-
const [error, setError] =
|
|
8121
|
-
|
|
7943
|
+
const [minValue, setMinValue] = useState22("");
|
|
7944
|
+
const [maxValue, setMaxValue] = useState22("");
|
|
7945
|
+
const [error, setError] = useState22("");
|
|
7946
|
+
useDebounce7(
|
|
8122
7947
|
() => {
|
|
8123
7948
|
if (minValue && maxValue && !error) {
|
|
8124
7949
|
onChange([minValue, maxValue]);
|
|
@@ -8129,7 +7954,7 @@ var NumberRangeEditor = ({
|
|
|
8129
7954
|
500,
|
|
8130
7955
|
[minValue, maxValue]
|
|
8131
7956
|
);
|
|
8132
|
-
|
|
7957
|
+
useEffect20(() => {
|
|
8133
7958
|
if (!maxValue && !minValue) {
|
|
8134
7959
|
return;
|
|
8135
7960
|
}
|
|
@@ -8151,10 +7976,10 @@ var NumberRangeEditor = ({
|
|
|
8151
7976
|
setMaxValue(maxValue);
|
|
8152
7977
|
}
|
|
8153
7978
|
}, [maxValue, minValue, setError]);
|
|
8154
|
-
return /* @__PURE__ */ jsxs43(
|
|
7979
|
+
return /* @__PURE__ */ jsxs43(Fragment15, { children: [
|
|
8155
7980
|
/* @__PURE__ */ jsxs43("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
8156
|
-
/* @__PURE__ */
|
|
8157
|
-
|
|
7981
|
+
/* @__PURE__ */ jsx75(
|
|
7982
|
+
Input9,
|
|
8158
7983
|
{
|
|
8159
7984
|
label: `${ariaLabel}-min`,
|
|
8160
7985
|
type: "number",
|
|
@@ -8169,8 +7994,8 @@ var NumberRangeEditor = ({
|
|
|
8169
7994
|
"data-testid": "value-low"
|
|
8170
7995
|
}
|
|
8171
7996
|
),
|
|
8172
|
-
/* @__PURE__ */
|
|
8173
|
-
|
|
7997
|
+
/* @__PURE__ */ jsx75(
|
|
7998
|
+
Input9,
|
|
8174
7999
|
{
|
|
8175
8000
|
type: "number",
|
|
8176
8001
|
label: `${ariaLabel}-max`,
|
|
@@ -8186,149 +8011,448 @@ var NumberRangeEditor = ({
|
|
|
8186
8011
|
}
|
|
8187
8012
|
)
|
|
8188
8013
|
] }),
|
|
8189
|
-
/* @__PURE__ */
|
|
8014
|
+
/* @__PURE__ */ jsx75(ErrorContainer, { errorMessage: error })
|
|
8190
8015
|
] });
|
|
8191
8016
|
};
|
|
8192
|
-
|
|
8193
|
-
|
|
8017
|
+
|
|
8018
|
+
// src/components/SearchAndFilter/editors/StatusMultiEditor.tsx
|
|
8019
|
+
import {
|
|
8020
|
+
convertComboBoxGroupsToSelectableGroups as convertComboBoxGroupsToSelectableGroups3,
|
|
8021
|
+
getComboBoxSelectedSelectableGroups as getComboBoxSelectedSelectableGroups2,
|
|
8022
|
+
InputComboBox as InputComboBox3
|
|
8023
|
+
} from "@uniformdev/design-system";
|
|
8024
|
+
import { useMemo as useMemo19 } from "react";
|
|
8025
|
+
|
|
8026
|
+
// src/components/SearchAndFilter/editors/shared/CustomOptions.tsx
|
|
8027
|
+
import { StatusBullet } from "@uniformdev/design-system";
|
|
8028
|
+
import { jsx as jsx76 } from "@emotion/react/jsx-runtime";
|
|
8029
|
+
var CustomOptions = ({ label, value }) => {
|
|
8030
|
+
return /* @__PURE__ */ jsx76(
|
|
8031
|
+
StatusBullet,
|
|
8032
|
+
{
|
|
8033
|
+
status: label,
|
|
8034
|
+
message: Array.isArray(value) ? value.join(",") : value
|
|
8035
|
+
}
|
|
8036
|
+
);
|
|
8037
|
+
};
|
|
8038
|
+
|
|
8039
|
+
// src/components/SearchAndFilter/editors/StatusMultiEditor.tsx
|
|
8040
|
+
import { jsx as jsx77 } from "@emotion/react/jsx-runtime";
|
|
8041
|
+
var StatusMultiEditor = ({
|
|
8042
|
+
options,
|
|
8043
|
+
value,
|
|
8044
|
+
disabled,
|
|
8045
|
+
readOnly,
|
|
8194
8046
|
onChange,
|
|
8047
|
+
valueTestId
|
|
8048
|
+
}) => {
|
|
8049
|
+
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
8050
|
+
const { groupedOptions, selectedOptions } = useMemo19(
|
|
8051
|
+
() => convertComboBoxGroupsToSelectableGroups3({ options: options != null ? options : [], selectedItems: new Set(value) }),
|
|
8052
|
+
[options, value]
|
|
8053
|
+
);
|
|
8054
|
+
return /* @__PURE__ */ jsx77("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx77(
|
|
8055
|
+
InputComboBox3,
|
|
8056
|
+
{
|
|
8057
|
+
options: groupedOptions != null ? groupedOptions : [],
|
|
8058
|
+
isMulti: true,
|
|
8059
|
+
onChange: (e) => {
|
|
8060
|
+
const selectedValues = getComboBoxSelectedSelectableGroups2(e);
|
|
8061
|
+
return onChange([...selectedValues]);
|
|
8062
|
+
},
|
|
8063
|
+
formatOptionLabel: CustomOptions,
|
|
8064
|
+
"aria-readonly": readOnly,
|
|
8065
|
+
value: selectedOptions,
|
|
8066
|
+
isDisabled: disabled,
|
|
8067
|
+
styles: {
|
|
8068
|
+
menu(base) {
|
|
8069
|
+
return {
|
|
8070
|
+
...base,
|
|
8071
|
+
minWidth: "max-content"
|
|
8072
|
+
};
|
|
8073
|
+
}
|
|
8074
|
+
},
|
|
8075
|
+
...readOnlyProps
|
|
8076
|
+
}
|
|
8077
|
+
) });
|
|
8078
|
+
};
|
|
8079
|
+
|
|
8080
|
+
// src/components/SearchAndFilter/editors/StatusSingleEditor.tsx
|
|
8081
|
+
import {
|
|
8082
|
+
convertComboBoxGroupsToSelectableGroups as convertComboBoxGroupsToSelectableGroups4,
|
|
8083
|
+
InputComboBox as InputComboBox4
|
|
8084
|
+
} from "@uniformdev/design-system";
|
|
8085
|
+
import { useMemo as useMemo20 } from "react";
|
|
8086
|
+
import { jsx as jsx78 } from "@emotion/react/jsx-runtime";
|
|
8087
|
+
var StatusSingleEditor = ({
|
|
8088
|
+
options,
|
|
8089
|
+
value,
|
|
8195
8090
|
disabled,
|
|
8091
|
+
readOnly,
|
|
8092
|
+
onChange,
|
|
8093
|
+
valueTestId
|
|
8094
|
+
}) => {
|
|
8095
|
+
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
8096
|
+
const { groupedOptions, selectedOptions } = useMemo20(
|
|
8097
|
+
() => convertComboBoxGroupsToSelectableGroups4({
|
|
8098
|
+
options: options != null ? options : [],
|
|
8099
|
+
selectedItems: new Set(value ? [value] : void 0),
|
|
8100
|
+
selectionMode: "single"
|
|
8101
|
+
}),
|
|
8102
|
+
[options, value]
|
|
8103
|
+
);
|
|
8104
|
+
return /* @__PURE__ */ jsx78("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx78(
|
|
8105
|
+
InputComboBox4,
|
|
8106
|
+
{
|
|
8107
|
+
options: groupedOptions,
|
|
8108
|
+
onChange: (e) => {
|
|
8109
|
+
if (Array.isArray(e == null ? void 0 : e.value)) {
|
|
8110
|
+
return;
|
|
8111
|
+
}
|
|
8112
|
+
return onChange(e == null ? void 0 : e.value);
|
|
8113
|
+
},
|
|
8114
|
+
formatOptionLabel: CustomOptions,
|
|
8115
|
+
"aria-readonly": readOnly,
|
|
8116
|
+
value: selectedOptions,
|
|
8117
|
+
isDisabled: disabled,
|
|
8118
|
+
styles: {
|
|
8119
|
+
menu(base) {
|
|
8120
|
+
return {
|
|
8121
|
+
...base,
|
|
8122
|
+
minWidth: "max-content"
|
|
8123
|
+
};
|
|
8124
|
+
}
|
|
8125
|
+
},
|
|
8126
|
+
...readOnlyProps
|
|
8127
|
+
}
|
|
8128
|
+
) });
|
|
8129
|
+
};
|
|
8130
|
+
|
|
8131
|
+
// src/components/SearchAndFilter/editors/TextEditor.tsx
|
|
8132
|
+
import { Input as Input10 } from "@uniformdev/design-system";
|
|
8133
|
+
import { useState as useState23 } from "react";
|
|
8134
|
+
import { useDebounce as useDebounce8 } from "react-use";
|
|
8135
|
+
import { jsx as jsx79 } from "@emotion/react/jsx-runtime";
|
|
8136
|
+
var TextEditor = ({
|
|
8137
|
+
onChange,
|
|
8138
|
+
ariaLabel,
|
|
8196
8139
|
value,
|
|
8197
8140
|
readOnly,
|
|
8198
8141
|
valueTestId
|
|
8199
8142
|
}) => {
|
|
8200
|
-
const [innerValue, setInnerValue] =
|
|
8201
|
-
|
|
8202
|
-
return /* @__PURE__ */
|
|
8203
|
-
|
|
8143
|
+
const [innerValue, setInnerValue] = useState23(value != null ? value : "");
|
|
8144
|
+
useDebounce8(() => onChange(innerValue), 500, [innerValue]);
|
|
8145
|
+
return /* @__PURE__ */ jsx79(
|
|
8146
|
+
Input10,
|
|
8204
8147
|
{
|
|
8205
|
-
label: ariaLabel,
|
|
8206
|
-
type: "number",
|
|
8207
8148
|
showLabel: false,
|
|
8208
|
-
|
|
8149
|
+
label: ariaLabel,
|
|
8209
8150
|
onChange: (e) => setInnerValue(e.currentTarget.value),
|
|
8210
|
-
|
|
8151
|
+
placeholder: "Enter phrase to search\u2026",
|
|
8211
8152
|
value: innerValue,
|
|
8212
8153
|
readOnly,
|
|
8213
8154
|
"data-testid": valueTestId
|
|
8214
8155
|
}
|
|
8215
|
-
);
|
|
8216
|
-
};
|
|
8217
|
-
|
|
8218
|
-
|
|
8219
|
-
|
|
8220
|
-
|
|
8221
|
-
|
|
8222
|
-
|
|
8223
|
-
|
|
8156
|
+
);
|
|
8157
|
+
};
|
|
8158
|
+
|
|
8159
|
+
// src/components/SearchAndFilter/FilterButton.tsx
|
|
8160
|
+
import { Counter as Counter2, Icon as Icon6 } from "@uniformdev/design-system";
|
|
8161
|
+
|
|
8162
|
+
// src/components/SearchAndFilter/styles/SearchAndFilter.styles.ts
|
|
8163
|
+
import { css as css38 } from "@emotion/react";
|
|
8164
|
+
import { cq, fadeInLtr } from "@uniformdev/design-system";
|
|
8165
|
+
var SearchAndFilterControlsWrapper = (gridColumns) => css38`
|
|
8166
|
+
align-items: stretch;
|
|
8167
|
+
display: grid;
|
|
8168
|
+
grid-template-columns: ${gridColumns};
|
|
8169
|
+
gap: var(--spacing-sm);
|
|
8170
|
+
`;
|
|
8171
|
+
var SearchAndFilterOutterControlWrapper = (gridColumns) => css38`
|
|
8172
|
+
align-items: stretch;
|
|
8173
|
+
display: grid;
|
|
8174
|
+
grid-template-columns: ${gridColumns};
|
|
8175
|
+
gap: var(--spacing-sm);
|
|
8176
|
+
`;
|
|
8177
|
+
var ConditionalFilterRow = css38`
|
|
8178
|
+
align-items: baseline;
|
|
8179
|
+
display: grid;
|
|
8180
|
+
grid-template-columns: 35px 1fr;
|
|
8181
|
+
gap: var(--spacing-sm);
|
|
8182
|
+
margin-left: var(--spacing-base);
|
|
8183
|
+
|
|
8184
|
+
${cq("380px")} {
|
|
8185
|
+
&:after {
|
|
8186
|
+
content: '';
|
|
8187
|
+
display: block;
|
|
8188
|
+
height: 1px;
|
|
8189
|
+
background: var(--gray-300);
|
|
8190
|
+
width: calc(100% - var(--spacing-base));
|
|
8191
|
+
margin-left: var(--spacing-base);
|
|
8192
|
+
}
|
|
8193
|
+
&:last-of-type:after {
|
|
8194
|
+
display: none;
|
|
8195
|
+
}
|
|
8196
|
+
}
|
|
8197
|
+
|
|
8198
|
+
&:nth-of-type(2) {
|
|
8199
|
+
margin-left: 0;
|
|
8200
|
+
grid-template-columns: 50px 1fr;
|
|
8201
|
+
}
|
|
8202
|
+
|
|
8203
|
+
${cq("580px")} {
|
|
8204
|
+
&:after {
|
|
8205
|
+
display: none;
|
|
8206
|
+
}
|
|
8207
|
+
}
|
|
8208
|
+
|
|
8209
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
8210
|
+
animation: ${fadeInLtr} var(--duration-fast) var(--timing-ease-out);
|
|
8211
|
+
}
|
|
8212
|
+
`;
|
|
8213
|
+
var ConditionalInputRow = css38`
|
|
8214
|
+
display: flex;
|
|
8215
|
+
gap: var(--spacing-sm);
|
|
8216
|
+
flex-wrap: wrap;
|
|
8217
|
+
|
|
8218
|
+
${cq("380px")} {
|
|
8219
|
+
& > div:nth-child(-n + 2) {
|
|
8220
|
+
width: calc(50% - var(--spacing-sm));
|
|
8221
|
+
}
|
|
8222
|
+
|
|
8223
|
+
& > div:nth-child(n + 3) {
|
|
8224
|
+
width: calc(100% - 48px);
|
|
8225
|
+
}
|
|
8226
|
+
}
|
|
8227
|
+
${cq("764px")} {
|
|
8228
|
+
align-items: flex-start;
|
|
8229
|
+
display: grid;
|
|
8230
|
+
grid-template-columns: 200px 160px 1fr 32px;
|
|
8231
|
+
|
|
8232
|
+
& > div:nth-child(n) {
|
|
8233
|
+
width: auto;
|
|
8234
|
+
}
|
|
8235
|
+
}
|
|
8236
|
+
`;
|
|
8237
|
+
var SearchInput = css38`
|
|
8238
|
+
max-height: 40px;
|
|
8239
|
+
min-height: unset;
|
|
8240
|
+
`;
|
|
8241
|
+
var BindableKeywordSearchInputStyles = css38`
|
|
8242
|
+
position: relative;
|
|
8243
|
+
width: 100%;
|
|
8244
|
+
|
|
8245
|
+
& [data-lexical-editor='true'] {
|
|
8246
|
+
padding: var(--spacing-sm) var(--spacing-lg) var(--spacing-sm) var(--spacing-base);
|
|
8247
|
+
font-size: var(--fs-sm);
|
|
8248
|
+
border-radius: var(--rounded-full);
|
|
8249
|
+
max-height: 40px;
|
|
8250
|
+
min-height: unset;
|
|
8251
|
+
width: 100%;
|
|
8252
|
+
position: relative;
|
|
8253
|
+
white-space: nowrap;
|
|
8254
|
+
}
|
|
8255
|
+
`;
|
|
8256
|
+
var ClearSearchButtonContainer = css38`
|
|
8257
|
+
align-items: center;
|
|
8258
|
+
display: flex;
|
|
8259
|
+
position: absolute;
|
|
8260
|
+
inset: 0 var(--spacing-lg) 0 auto;
|
|
8261
|
+
`;
|
|
8262
|
+
var ClearSearchButtonStyles = css38`
|
|
8263
|
+
background: none;
|
|
8264
|
+
border: none;
|
|
8265
|
+
padding: 0;
|
|
8266
|
+
pointer-events: all;
|
|
8267
|
+
`;
|
|
8268
|
+
var FilterButton = css38`
|
|
8269
|
+
align-items: center;
|
|
8270
|
+
background: var(--white);
|
|
8271
|
+
border: 1px solid var(--gray-300);
|
|
8272
|
+
border-radius: var(--rounded-full);
|
|
8273
|
+
color: var(--typography-base);
|
|
8274
|
+
display: flex;
|
|
8275
|
+
font-size: var(--fs-sm);
|
|
8276
|
+
gap: var(--spacing-sm);
|
|
8277
|
+
padding: var(--spacing-sm) var(--spacing-base);
|
|
8278
|
+
max-height: 40px;
|
|
8279
|
+
transition: color var(--duration-fast) var(--timing-ease-out),
|
|
8280
|
+
background-color var(--duration-fast) var(--timing-ease-out),
|
|
8281
|
+
border-color var(--duration-fast) var(--timing-ease-out),
|
|
8282
|
+
box-shadow var(--duration-fast) var(--timing-ease-out);
|
|
8283
|
+
|
|
8284
|
+
svg {
|
|
8285
|
+
color: var(--gray-300);
|
|
8286
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
8287
|
+
}
|
|
8288
|
+
|
|
8289
|
+
&:hover,
|
|
8290
|
+
:where([aria-expanded='true']) {
|
|
8291
|
+
outline: none;
|
|
8292
|
+
background: var(--gray-200);
|
|
8293
|
+
border-color: var(--gray-300);
|
|
8294
|
+
|
|
8295
|
+
svg {
|
|
8296
|
+
color: var(--typography-base);
|
|
8297
|
+
}
|
|
8298
|
+
}
|
|
8299
|
+
|
|
8300
|
+
&:disabled {
|
|
8301
|
+
opacity: var(--opacity-50);
|
|
8302
|
+
}
|
|
8303
|
+
`;
|
|
8304
|
+
var FilterButtonText = css38`
|
|
8305
|
+
overflow: hidden;
|
|
8306
|
+
text-overflow: ellipsis;
|
|
8307
|
+
white-space: nowrap;
|
|
8308
|
+
max-width: 14ch;
|
|
8309
|
+
`;
|
|
8310
|
+
var FilterButtonSelected = css38`
|
|
8311
|
+
background: var(--gray-100);
|
|
8312
|
+
border-color: var(--gray-300);
|
|
8313
|
+
|
|
8314
|
+
svg {
|
|
8315
|
+
color: var(--accent-dark);
|
|
8316
|
+
}
|
|
8317
|
+
`;
|
|
8318
|
+
var FilterButtonWithOptions = css38`
|
|
8319
|
+
:where([aria-expanded='true']) {
|
|
8320
|
+
background: var(--purple-rain-100);
|
|
8321
|
+
border-color: var(--accent-light);
|
|
8322
|
+
color: var(--typography-base);
|
|
8323
|
+
box-shadow: var(--elevation-100);
|
|
8324
|
+
|
|
8325
|
+
svg {
|
|
8326
|
+
color: var(--accent-dark);
|
|
8327
|
+
}
|
|
8328
|
+
}
|
|
8329
|
+
`;
|
|
8330
|
+
var SearchIcon = css38`
|
|
8331
|
+
color: var(--icon-color);
|
|
8332
|
+
position: absolute;
|
|
8333
|
+
inset: 0 var(--spacing-base) 0 auto;
|
|
8334
|
+
margin: auto;
|
|
8335
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
8336
|
+
`;
|
|
8337
|
+
var AddConditionalBtn = css38`
|
|
8338
|
+
align-items: center;
|
|
8339
|
+
background: transparent;
|
|
8340
|
+
border: none;
|
|
8341
|
+
color: var(--primary-action-default);
|
|
8342
|
+
display: flex;
|
|
8343
|
+
gap: var(--spacing-sm);
|
|
8344
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
8345
|
+
padding: 0;
|
|
8346
|
+
|
|
8347
|
+
&:hover,
|
|
8348
|
+
&:focus {
|
|
8349
|
+
color: var(--primary-action-hover);
|
|
8350
|
+
}
|
|
8351
|
+
|
|
8352
|
+
&:disabled {
|
|
8353
|
+
color: var(--gray-400);
|
|
8354
|
+
}
|
|
8355
|
+
`;
|
|
8356
|
+
var Title = css38`
|
|
8357
|
+
color: var(--typography-light);
|
|
8358
|
+
|
|
8359
|
+
&:focus {
|
|
8360
|
+
outline: none;
|
|
8361
|
+
}
|
|
8362
|
+
`;
|
|
8363
|
+
var ResetConditionsBtn = css38`
|
|
8364
|
+
background: transparent;
|
|
8365
|
+
border: none;
|
|
8366
|
+
color: var(--action-destructive-default);
|
|
8367
|
+
transition: color var(--duration-fast) var(--timing-ease-out);
|
|
8368
|
+
padding: 0;
|
|
8369
|
+
|
|
8370
|
+
&:hover,
|
|
8371
|
+
&:focus {
|
|
8372
|
+
color: var(--action-destructive-hover);
|
|
8373
|
+
}
|
|
8374
|
+
`;
|
|
8375
|
+
var IconBtn = css38`
|
|
8376
|
+
background: transparent;
|
|
8377
|
+
border: none;
|
|
8378
|
+
padding: var(--spacing-sm);
|
|
8379
|
+
`;
|
|
8380
|
+
var SearchAndFilterOptionsContainer = css38`
|
|
8381
|
+
background: var(--gray-50);
|
|
8382
|
+
border: 1px solid var(--gray-300);
|
|
8383
|
+
border-radius: var(--rounded-base);
|
|
8384
|
+
container-type: inline-size;
|
|
8385
|
+
display: flex;
|
|
8386
|
+
flex-direction: column;
|
|
8387
|
+
gap: var(--spacing-sm);
|
|
8388
|
+
padding: var(--spacing-md) 0 var(--spacing-base);
|
|
8389
|
+
will-change: height;
|
|
8390
|
+
position: relative;
|
|
8391
|
+
z-index: 1;
|
|
8392
|
+
`;
|
|
8393
|
+
var SearchAndFilterOptionsInnerContainer = css38`
|
|
8394
|
+
display: flex;
|
|
8395
|
+
flex-direction: column;
|
|
8396
|
+
gap: var(--spacing-sm);
|
|
8397
|
+
padding-inline: var(--spacing-md);
|
|
8398
|
+
`;
|
|
8399
|
+
var SearchAndFilterButtonGroup = css38`
|
|
8400
|
+
margin-top: var(--spacing-xs);
|
|
8401
|
+
margin-left: calc(56px + var(--spacing-md));
|
|
8402
|
+
`;
|
|
8403
|
+
|
|
8404
|
+
// src/components/SearchAndFilter/FilterButton.tsx
|
|
8405
|
+
import { jsx as jsx80, jsxs as jsxs44 } from "@emotion/react/jsx-runtime";
|
|
8406
|
+
var FilterButton2 = ({
|
|
8407
|
+
text = "Filters",
|
|
8408
|
+
icon = "filter-add",
|
|
8409
|
+
filterCount,
|
|
8410
|
+
hasSelectedValue,
|
|
8411
|
+
dataTestId,
|
|
8412
|
+
...props
|
|
8224
8413
|
}) => {
|
|
8225
|
-
|
|
8226
|
-
|
|
8227
|
-
return /* @__PURE__ */ jsx70(
|
|
8228
|
-
Input6,
|
|
8414
|
+
return /* @__PURE__ */ jsxs44(
|
|
8415
|
+
"button",
|
|
8229
8416
|
{
|
|
8230
|
-
type: "
|
|
8231
|
-
|
|
8232
|
-
|
|
8233
|
-
|
|
8234
|
-
|
|
8235
|
-
|
|
8236
|
-
|
|
8237
|
-
"data-testid":
|
|
8417
|
+
type: "button",
|
|
8418
|
+
css: [
|
|
8419
|
+
FilterButton,
|
|
8420
|
+
hasSelectedValue ? FilterButtonSelected : void 0,
|
|
8421
|
+
filterCount ? [FilterButtonWithOptions, FilterButtonSelected] : void 0
|
|
8422
|
+
],
|
|
8423
|
+
...props,
|
|
8424
|
+
"data-testid": dataTestId,
|
|
8425
|
+
children: [
|
|
8426
|
+
/* @__PURE__ */ jsx80(Icon6, { icon, iconColor: "currentColor", size: "1rem" }),
|
|
8427
|
+
/* @__PURE__ */ jsx80("span", { css: FilterButtonText, children: text }),
|
|
8428
|
+
filterCount ? /* @__PURE__ */ jsx80(Counter2, { count: filterCount, bgColor: "var(--white)" }) : null
|
|
8429
|
+
]
|
|
8238
8430
|
}
|
|
8239
8431
|
);
|
|
8240
8432
|
};
|
|
8241
|
-
|
|
8242
|
-
|
|
8243
|
-
|
|
8244
|
-
|
|
8245
|
-
|
|
8246
|
-
|
|
8247
|
-
|
|
8248
|
-
}
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
|
|
8257
|
-
|
|
8258
|
-
|
|
8259
|
-
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
if (!minDateValue || !maxDateValue) {
|
|
8265
|
-
return;
|
|
8266
|
-
}
|
|
8267
|
-
const minDate = new Date(minDateValue);
|
|
8268
|
-
const maxDate = new Date(maxDateValue);
|
|
8269
|
-
if (maxDate < minDate) {
|
|
8270
|
-
setError("The max date cannot be lower than the min date");
|
|
8271
|
-
return;
|
|
8272
|
-
}
|
|
8273
|
-
if (maxDate && !minDate) {
|
|
8274
|
-
setError("Please enter both a low and high date");
|
|
8275
|
-
return;
|
|
8276
|
-
}
|
|
8277
|
-
const minDateString = minDate.toDateString();
|
|
8278
|
-
const maxDateString = maxDate.toDateString();
|
|
8279
|
-
if (minDateString === maxDateString || maxDateString === minDateString) {
|
|
8280
|
-
setError("The min and max date cannot be the same");
|
|
8281
|
-
return;
|
|
8282
|
-
}
|
|
8283
|
-
if (minDate > maxDate) {
|
|
8284
|
-
setError("The min date cannot be higher than the max date");
|
|
8285
|
-
return;
|
|
8286
|
-
}
|
|
8287
|
-
if (error) {
|
|
8288
|
-
setError("");
|
|
8289
|
-
}
|
|
8290
|
-
if (minDate && maxDate) {
|
|
8291
|
-
setMinDateValue(minDateValue);
|
|
8292
|
-
setMaxDateValue(maxDateValue);
|
|
8293
|
-
} else {
|
|
8294
|
-
setMinDateValue("");
|
|
8295
|
-
setMaxDateValue("");
|
|
8296
|
-
}
|
|
8297
|
-
}, [minDateValue, maxDateValue, setError]);
|
|
8298
|
-
return /* @__PURE__ */ jsxs43(Fragment14, { children: [
|
|
8299
|
-
/* @__PURE__ */ jsxs43("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
8300
|
-
/* @__PURE__ */ jsx70(
|
|
8301
|
-
Input6,
|
|
8302
|
-
{
|
|
8303
|
-
label: `${ariaLabel}-min-date`,
|
|
8304
|
-
type: "date",
|
|
8305
|
-
showLabel: false,
|
|
8306
|
-
value: minDateValue,
|
|
8307
|
-
onChange: (e) => setMinDateValue(e.currentTarget.value),
|
|
8308
|
-
"aria-invalid": !error ? false : true,
|
|
8309
|
-
disabled,
|
|
8310
|
-
readOnly,
|
|
8311
|
-
"data-testid": "value-low"
|
|
8312
|
-
}
|
|
8313
|
-
),
|
|
8314
|
-
/* @__PURE__ */ jsx70(
|
|
8315
|
-
Input6,
|
|
8316
|
-
{
|
|
8317
|
-
label: `${ariaLabel}-max-date`,
|
|
8318
|
-
type: "date",
|
|
8319
|
-
showLabel: false,
|
|
8320
|
-
value: maxDateValue,
|
|
8321
|
-
onChange: (e) => setMaxDateValue(e.currentTarget.value),
|
|
8322
|
-
"aria-invalid": !error ? false : true,
|
|
8323
|
-
disabled,
|
|
8324
|
-
readOnly,
|
|
8325
|
-
"data-testid": "value-high"
|
|
8326
|
-
}
|
|
8327
|
-
)
|
|
8328
|
-
] }),
|
|
8329
|
-
/* @__PURE__ */ jsx70(ErrorContainer, { errorMessage: error })
|
|
8330
|
-
] });
|
|
8331
|
-
};
|
|
8433
|
+
|
|
8434
|
+
// src/components/SearchAndFilter/FilterControls.tsx
|
|
8435
|
+
import { CgClose as CgClose5 } from "@react-icons/all-files/cg/CgClose";
|
|
8436
|
+
import { Icon as Icon7, InputKeywordSearch as InputKeywordSearch2 } from "@uniformdev/design-system";
|
|
8437
|
+
import { CLEAR_EDITOR_COMMAND as CLEAR_EDITOR_COMMAND2 } from "lexical";
|
|
8438
|
+
import { useEffect as useEffect22, useRef as useRef16, useState as useState25 } from "react";
|
|
8439
|
+
import { useDebounce as useDebounce9 } from "react-use";
|
|
8440
|
+
import { v4 as v43 } from "uuid";
|
|
8441
|
+
|
|
8442
|
+
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
8443
|
+
import { VerticalRhythm as VerticalRhythm5 } from "@uniformdev/design-system";
|
|
8444
|
+
import {
|
|
8445
|
+
createContext as createContext6,
|
|
8446
|
+
useCallback as useCallback6,
|
|
8447
|
+
useContext as useContext8,
|
|
8448
|
+
useDeferredValue as useDeferredValue2,
|
|
8449
|
+
useEffect as useEffect21,
|
|
8450
|
+
useMemo as useMemo21,
|
|
8451
|
+
useState as useState24
|
|
8452
|
+
} from "react";
|
|
8453
|
+
|
|
8454
|
+
// src/components/SearchAndFilter/FilterEditor.tsx
|
|
8455
|
+
import { jsx as jsx81 } from "@emotion/react/jsx-runtime";
|
|
8332
8456
|
var FilterEditorRenderer = ({ editorType, ...props }) => {
|
|
8333
8457
|
const { filterMapper: contextFilterMapper } = useSearchAndFilter();
|
|
8334
8458
|
const Editor = contextFilterMapper == null ? void 0 : contextFilterMapper[editorType];
|
|
@@ -8338,7 +8462,7 @@ var FilterEditorRenderer = ({ editorType, ...props }) => {
|
|
|
8338
8462
|
if (editorType === "empty") {
|
|
8339
8463
|
return null;
|
|
8340
8464
|
}
|
|
8341
|
-
return /* @__PURE__ */
|
|
8465
|
+
return /* @__PURE__ */ jsx81(Editor, { ...props });
|
|
8342
8466
|
};
|
|
8343
8467
|
var filterMapper = {
|
|
8344
8468
|
multiChoice: FilterMultiChoiceEditor,
|
|
@@ -8355,9 +8479,9 @@ var filterMapper = {
|
|
|
8355
8479
|
function withInputVariables(WrappedComponent) {
|
|
8356
8480
|
const WithInputVariables = (props) => {
|
|
8357
8481
|
if (Array.isArray(props.value) || !props.bindable || props.disabled || props.readOnly) {
|
|
8358
|
-
return /* @__PURE__ */
|
|
8482
|
+
return /* @__PURE__ */ jsx81(WrappedComponent, { ...props });
|
|
8359
8483
|
}
|
|
8360
|
-
return /* @__PURE__ */
|
|
8484
|
+
return /* @__PURE__ */ jsx81(
|
|
8361
8485
|
InputVariables,
|
|
8362
8486
|
{
|
|
8363
8487
|
disableInlineMenu: true,
|
|
@@ -8365,7 +8489,7 @@ function withInputVariables(WrappedComponent) {
|
|
|
8365
8489
|
onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
|
|
8366
8490
|
value: props.value,
|
|
8367
8491
|
disabled: props.disabled,
|
|
8368
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
8492
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx81(WrappedComponent, { ...props })
|
|
8369
8493
|
}
|
|
8370
8494
|
);
|
|
8371
8495
|
};
|
|
@@ -8375,16 +8499,16 @@ function withInputVariablesForMultiValue(WrappedComponent) {
|
|
|
8375
8499
|
const WithInputVariables = (props) => {
|
|
8376
8500
|
var _a;
|
|
8377
8501
|
if (!props.bindable || props.disabled || props.readOnly) {
|
|
8378
|
-
return /* @__PURE__ */
|
|
8502
|
+
return /* @__PURE__ */ jsx81(WrappedComponent, { ...props });
|
|
8379
8503
|
}
|
|
8380
|
-
return /* @__PURE__ */
|
|
8504
|
+
return /* @__PURE__ */ jsx81(
|
|
8381
8505
|
InputVariables,
|
|
8382
8506
|
{
|
|
8383
8507
|
disableInlineMenu: true,
|
|
8384
8508
|
showMenuPosition: "inline-right",
|
|
8385
8509
|
onChange: (newValue) => props.onChange(newValue ? [newValue] : []),
|
|
8386
8510
|
value: (_a = props.value) == null ? void 0 : _a[0],
|
|
8387
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
8511
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx81(WrappedComponent, { ...props })
|
|
8388
8512
|
}
|
|
8389
8513
|
);
|
|
8390
8514
|
};
|
|
@@ -8398,26 +8522,9 @@ var bindableFiltersMapper = {
|
|
|
8398
8522
|
text: withInputVariables(TextEditor),
|
|
8399
8523
|
number: withInputVariables(NumberEditor)
|
|
8400
8524
|
};
|
|
8401
|
-
var ErrorContainer = ({ errorMessage }) => {
|
|
8402
|
-
return /* @__PURE__ */ jsx70(
|
|
8403
|
-
"div",
|
|
8404
|
-
{
|
|
8405
|
-
css: {
|
|
8406
|
-
gridColumn: "span 6",
|
|
8407
|
-
order: 6
|
|
8408
|
-
},
|
|
8409
|
-
children: /* @__PURE__ */ jsx70(FieldMessage, { errorMessage })
|
|
8410
|
-
}
|
|
8411
|
-
);
|
|
8412
|
-
};
|
|
8413
|
-
var twoColumnGrid = {
|
|
8414
|
-
display: "grid",
|
|
8415
|
-
gridTemplateColumns: "1fr 1fr",
|
|
8416
|
-
gap: "var(--spacing-sm);"
|
|
8417
|
-
};
|
|
8418
8525
|
|
|
8419
8526
|
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
8420
|
-
import { jsx as
|
|
8527
|
+
import { jsx as jsx82 } from "@emotion/react/jsx-runtime";
|
|
8421
8528
|
var SearchAndFilterContext = createContext6({
|
|
8422
8529
|
searchTerm: "",
|
|
8423
8530
|
setSearchTerm: () => {
|
|
@@ -8453,9 +8560,9 @@ var SearchAndFilterProvider = ({
|
|
|
8453
8560
|
children,
|
|
8454
8561
|
allowBindingSearchTerm
|
|
8455
8562
|
}) => {
|
|
8456
|
-
const [searchTerm, setSearchTerm] =
|
|
8563
|
+
const [searchTerm, setSearchTerm] = useState24(defaultSearchTerm);
|
|
8457
8564
|
const deferredSearchTerm = useDeferredValue2(searchTerm);
|
|
8458
|
-
const [filterVisibility, setFilterVisibility] =
|
|
8565
|
+
const [filterVisibility, setFilterVisibility] = useState24(filterVisible);
|
|
8459
8566
|
const handleSearchTerm = useCallback6(
|
|
8460
8567
|
(term) => {
|
|
8461
8568
|
setSearchTerm(term);
|
|
@@ -8481,13 +8588,13 @@ var SearchAndFilterProvider = ({
|
|
|
8481
8588
|
},
|
|
8482
8589
|
[filters, onChange]
|
|
8483
8590
|
);
|
|
8484
|
-
const validFilterQuery =
|
|
8591
|
+
const validFilterQuery = useMemo21(() => {
|
|
8485
8592
|
const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
|
|
8486
8593
|
if (hasValidFilters) {
|
|
8487
8594
|
return filters;
|
|
8488
8595
|
}
|
|
8489
8596
|
}, [filters]);
|
|
8490
|
-
|
|
8597
|
+
useEffect21(() => {
|
|
8491
8598
|
if (filterVisibility) {
|
|
8492
8599
|
const handleEscKeyFilterClose = (e) => {
|
|
8493
8600
|
if (e.key === "Escape") {
|
|
@@ -8500,7 +8607,7 @@ var SearchAndFilterProvider = ({
|
|
|
8500
8607
|
};
|
|
8501
8608
|
}
|
|
8502
8609
|
}, [filterVisibility]);
|
|
8503
|
-
return /* @__PURE__ */
|
|
8610
|
+
return /* @__PURE__ */ jsx82(
|
|
8504
8611
|
SearchAndFilterContext.Provider,
|
|
8505
8612
|
{
|
|
8506
8613
|
value: {
|
|
@@ -8519,7 +8626,7 @@ var SearchAndFilterProvider = ({
|
|
|
8519
8626
|
filterMapper: filterMapper2,
|
|
8520
8627
|
allowBindingSearchTerm
|
|
8521
8628
|
},
|
|
8522
|
-
children: /* @__PURE__ */
|
|
8629
|
+
children: /* @__PURE__ */ jsx82(VerticalRhythm5, { children })
|
|
8523
8630
|
}
|
|
8524
8631
|
);
|
|
8525
8632
|
};
|
|
@@ -8529,7 +8636,7 @@ var useSearchAndFilter = () => {
|
|
|
8529
8636
|
};
|
|
8530
8637
|
|
|
8531
8638
|
// src/components/SearchAndFilter/FilterControls.tsx
|
|
8532
|
-
import { Fragment as
|
|
8639
|
+
import { Fragment as Fragment16, jsx as jsx83, jsxs as jsxs45 } from "@emotion/react/jsx-runtime";
|
|
8533
8640
|
var FilterControls = ({
|
|
8534
8641
|
children,
|
|
8535
8642
|
hideSearchInput
|
|
@@ -8544,23 +8651,23 @@ var FilterControls = ({
|
|
|
8544
8651
|
} = useSearchAndFilter();
|
|
8545
8652
|
const editorRef = useRef16(null);
|
|
8546
8653
|
const hasVariableInSearchTerm = hasReferencedVariables(searchTerm);
|
|
8547
|
-
const [idToResetInputVariables, setIdToResetInputVariables] =
|
|
8548
|
-
const [localeSearchTerm, setLocaleSearchTerm] =
|
|
8549
|
-
|
|
8654
|
+
const [idToResetInputVariables, setIdToResetInputVariables] = useState25("data-resource-search-term-input");
|
|
8655
|
+
const [localeSearchTerm, setLocaleSearchTerm] = useState25(searchTerm);
|
|
8656
|
+
useDebounce9(
|
|
8550
8657
|
() => {
|
|
8551
8658
|
setSearchTerm(localeSearchTerm);
|
|
8552
8659
|
},
|
|
8553
8660
|
300,
|
|
8554
8661
|
[localeSearchTerm]
|
|
8555
8662
|
);
|
|
8556
|
-
|
|
8663
|
+
useEffect22(() => {
|
|
8557
8664
|
if (searchTerm === "") {
|
|
8558
8665
|
setLocaleSearchTerm("");
|
|
8559
8666
|
setIdToResetInputVariables(`data-resource-search-term-input-${v43()}`);
|
|
8560
8667
|
}
|
|
8561
8668
|
}, [searchTerm]);
|
|
8562
|
-
return /* @__PURE__ */
|
|
8563
|
-
/* @__PURE__ */
|
|
8669
|
+
return /* @__PURE__ */ jsxs45(Fragment16, { children: [
|
|
8670
|
+
/* @__PURE__ */ jsx83(
|
|
8564
8671
|
FilterButton2,
|
|
8565
8672
|
{
|
|
8566
8673
|
"aria-controls": "search-and-filter-options",
|
|
@@ -8573,8 +8680,8 @@ var FilterControls = ({
|
|
|
8573
8680
|
dataTestId: "filters-button"
|
|
8574
8681
|
}
|
|
8575
8682
|
),
|
|
8576
|
-
hideSearchInput ? null : /* @__PURE__ */
|
|
8577
|
-
/* @__PURE__ */
|
|
8683
|
+
hideSearchInput ? null : /* @__PURE__ */ jsxs45("div", { css: BindableKeywordSearchInputStyles, children: [
|
|
8684
|
+
/* @__PURE__ */ jsx83(
|
|
8578
8685
|
InputVariables,
|
|
8579
8686
|
{
|
|
8580
8687
|
label: "",
|
|
@@ -8584,7 +8691,7 @@ var FilterControls = ({
|
|
|
8584
8691
|
value: localeSearchTerm,
|
|
8585
8692
|
onChange: (value) => setLocaleSearchTerm(value != null ? value : ""),
|
|
8586
8693
|
disableVariables: !allowBindingSearchTerm,
|
|
8587
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
8694
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx83(
|
|
8588
8695
|
InputKeywordSearch2,
|
|
8589
8696
|
{
|
|
8590
8697
|
placeholder: "Search...",
|
|
@@ -8597,7 +8704,7 @@ var FilterControls = ({
|
|
|
8597
8704
|
)
|
|
8598
8705
|
}
|
|
8599
8706
|
),
|
|
8600
|
-
hasVariableInSearchTerm ? /* @__PURE__ */
|
|
8707
|
+
hasVariableInSearchTerm ? /* @__PURE__ */ jsx83("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ jsx83(
|
|
8601
8708
|
"button",
|
|
8602
8709
|
{
|
|
8603
8710
|
css: ClearSearchButtonStyles,
|
|
@@ -8611,7 +8718,7 @@ var FilterControls = ({
|
|
|
8611
8718
|
},
|
|
8612
8719
|
type: "button",
|
|
8613
8720
|
"data-testid": "keyword-search-clear-button",
|
|
8614
|
-
children: /* @__PURE__ */
|
|
8721
|
+
children: /* @__PURE__ */ jsx83(Icon7, { icon: CgClose5, iconColor: "red", size: "1rem" })
|
|
8615
8722
|
}
|
|
8616
8723
|
) }) : null
|
|
8617
8724
|
] }),
|
|
@@ -8620,21 +8727,21 @@ var FilterControls = ({
|
|
|
8620
8727
|
};
|
|
8621
8728
|
|
|
8622
8729
|
// src/components/SearchAndFilter/FilterItem.tsx
|
|
8623
|
-
import { Icon as Icon8, InputComboBox as
|
|
8624
|
-
import { useMemo as
|
|
8730
|
+
import { Icon as Icon8, InputComboBox as InputComboBox5 } from "@uniformdev/design-system";
|
|
8731
|
+
import { useMemo as useMemo22 } from "react";
|
|
8625
8732
|
|
|
8626
8733
|
// src/components/SearchAndFilter/FilterMenu.tsx
|
|
8627
8734
|
import { HorizontalRhythm as HorizontalRhythm8, VerticalRhythm as VerticalRhythm6 } from "@uniformdev/design-system";
|
|
8628
|
-
import React13, { useEffect as
|
|
8629
|
-
import { jsx as
|
|
8735
|
+
import React13, { useEffect as useEffect23 } from "react";
|
|
8736
|
+
import { jsx as jsx84, jsxs as jsxs46 } from "@emotion/react/jsx-runtime";
|
|
8630
8737
|
var SearchAndFilterOptionsContainer2 = ({
|
|
8631
8738
|
buttonRow,
|
|
8632
8739
|
additionalFiltersContainer,
|
|
8633
8740
|
children
|
|
8634
8741
|
}) => {
|
|
8635
|
-
return /* @__PURE__ */
|
|
8636
|
-
/* @__PURE__ */
|
|
8637
|
-
buttonRow ? /* @__PURE__ */
|
|
8742
|
+
return /* @__PURE__ */ jsxs46("div", { css: SearchAndFilterOptionsContainer, children: [
|
|
8743
|
+
/* @__PURE__ */ jsx84("div", { css: SearchAndFilterOptionsInnerContainer, children }),
|
|
8744
|
+
buttonRow ? /* @__PURE__ */ jsx84(
|
|
8638
8745
|
HorizontalRhythm8,
|
|
8639
8746
|
{
|
|
8640
8747
|
css: SearchAndFilterButtonGroup,
|
|
@@ -8644,7 +8751,7 @@ var SearchAndFilterOptionsContainer2 = ({
|
|
|
8644
8751
|
children: buttonRow
|
|
8645
8752
|
}
|
|
8646
8753
|
) : null,
|
|
8647
|
-
additionalFiltersContainer ? /* @__PURE__ */
|
|
8754
|
+
additionalFiltersContainer ? /* @__PURE__ */ jsx84("div", { children: additionalFiltersContainer }) : null
|
|
8648
8755
|
] });
|
|
8649
8756
|
};
|
|
8650
8757
|
var FilterMenu = ({
|
|
@@ -8658,21 +8765,21 @@ var FilterMenu = ({
|
|
|
8658
8765
|
}) => {
|
|
8659
8766
|
const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
|
|
8660
8767
|
const innerMenuRef = React13.useRef(null);
|
|
8661
|
-
|
|
8768
|
+
useEffect23(() => {
|
|
8662
8769
|
var _a;
|
|
8663
8770
|
if (filterVisibility) {
|
|
8664
8771
|
(_a = innerMenuRef.current) == null ? void 0 : _a.focus();
|
|
8665
8772
|
}
|
|
8666
8773
|
}, [filterVisibility]);
|
|
8667
|
-
return /* @__PURE__ */
|
|
8774
|
+
return /* @__PURE__ */ jsx84(VerticalRhythm6, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ jsxs46(
|
|
8668
8775
|
SearchAndFilterOptionsContainer2,
|
|
8669
8776
|
{
|
|
8670
8777
|
buttonRow: menuControls,
|
|
8671
8778
|
additionalFiltersContainer,
|
|
8672
8779
|
children: [
|
|
8673
|
-
/* @__PURE__ */
|
|
8674
|
-
/* @__PURE__ */
|
|
8675
|
-
(filters == null ? void 0 : filters.length) ? /* @__PURE__ */
|
|
8780
|
+
/* @__PURE__ */ jsxs46(HorizontalRhythm8, { gap: "sm", align: "center", justify: "space-between", children: [
|
|
8781
|
+
/* @__PURE__ */ jsx84("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }),
|
|
8782
|
+
(filters == null ? void 0 : filters.length) ? /* @__PURE__ */ jsx84(
|
|
8676
8783
|
"button",
|
|
8677
8784
|
{
|
|
8678
8785
|
type: "button",
|
|
@@ -8693,7 +8800,7 @@ var FilterMenu = ({
|
|
|
8693
8800
|
};
|
|
8694
8801
|
|
|
8695
8802
|
// src/components/SearchAndFilter/FilterItem.tsx
|
|
8696
|
-
import { jsx as
|
|
8803
|
+
import { jsx as jsx85, jsxs as jsxs47 } from "@emotion/react/jsx-runtime";
|
|
8697
8804
|
var FilterItem = ({
|
|
8698
8805
|
index,
|
|
8699
8806
|
paramOptions,
|
|
@@ -8709,7 +8816,7 @@ var FilterItem = ({
|
|
|
8709
8816
|
const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
|
|
8710
8817
|
const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
|
|
8711
8818
|
const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
|
|
8712
|
-
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } =
|
|
8819
|
+
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = useMemo22(() => {
|
|
8713
8820
|
var _a2;
|
|
8714
8821
|
const currentSelectedFilter = filterOptions.find((item) => {
|
|
8715
8822
|
var _a3;
|
|
@@ -8736,11 +8843,11 @@ var FilterItem = ({
|
|
|
8736
8843
|
menuIsOpen: false,
|
|
8737
8844
|
isClearable: false
|
|
8738
8845
|
} : {};
|
|
8739
|
-
return /* @__PURE__ */
|
|
8740
|
-
/* @__PURE__ */
|
|
8741
|
-
/* @__PURE__ */
|
|
8742
|
-
/* @__PURE__ */
|
|
8743
|
-
|
|
8846
|
+
return /* @__PURE__ */ jsxs47("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
|
|
8847
|
+
/* @__PURE__ */ jsx85("span", { children: index === 0 ? "Where" : "and" }),
|
|
8848
|
+
/* @__PURE__ */ jsxs47("div", { css: ConditionalInputRow, children: [
|
|
8849
|
+
/* @__PURE__ */ jsx85(
|
|
8850
|
+
InputComboBox5,
|
|
8744
8851
|
{
|
|
8745
8852
|
"aria-label": label,
|
|
8746
8853
|
options: paramOptions,
|
|
@@ -8766,8 +8873,8 @@ var FilterItem = ({
|
|
|
8766
8873
|
name: `filter-field-${index}`
|
|
8767
8874
|
}
|
|
8768
8875
|
),
|
|
8769
|
-
/* @__PURE__ */
|
|
8770
|
-
|
|
8876
|
+
/* @__PURE__ */ jsx85(
|
|
8877
|
+
InputComboBox5,
|
|
8771
8878
|
{
|
|
8772
8879
|
"aria-label": operatorLabel,
|
|
8773
8880
|
options: operatorOptions,
|
|
@@ -8790,7 +8897,7 @@ var FilterItem = ({
|
|
|
8790
8897
|
name: `filter-operator-${index}`
|
|
8791
8898
|
}
|
|
8792
8899
|
),
|
|
8793
|
-
/* @__PURE__ */
|
|
8900
|
+
/* @__PURE__ */ jsx85(
|
|
8794
8901
|
FilterEditorRenderer,
|
|
8795
8902
|
{
|
|
8796
8903
|
"aria-label": metaDataLabel,
|
|
@@ -8804,7 +8911,7 @@ var FilterItem = ({
|
|
|
8804
8911
|
valueTestId: "filter-value"
|
|
8805
8912
|
}
|
|
8806
8913
|
),
|
|
8807
|
-
readOnly || index === 0 ? null : /* @__PURE__ */
|
|
8914
|
+
readOnly || index === 0 ? null : /* @__PURE__ */ jsx85(
|
|
8808
8915
|
"button",
|
|
8809
8916
|
{
|
|
8810
8917
|
type: "button",
|
|
@@ -8812,7 +8919,7 @@ var FilterItem = ({
|
|
|
8812
8919
|
"aria-label": "delete filter",
|
|
8813
8920
|
css: IconBtn,
|
|
8814
8921
|
"data-testid": "delete-filter",
|
|
8815
|
-
children: /* @__PURE__ */
|
|
8922
|
+
children: /* @__PURE__ */ jsx85(Icon8, { icon: "trash", iconColor: "red", size: "1rem" })
|
|
8816
8923
|
}
|
|
8817
8924
|
)
|
|
8818
8925
|
] })
|
|
@@ -8828,13 +8935,13 @@ var FilterItems = ({
|
|
|
8828
8935
|
const next = [...filters];
|
|
8829
8936
|
next[index] = { ...next[index], [prop]: value };
|
|
8830
8937
|
if (prop === "operator") {
|
|
8831
|
-
if (["eq", "neq", "lt", "gt"].includes(value) && Array.isArray(next[index].value)) {
|
|
8938
|
+
if (!Array.isArray(value) && ["eq", "neq", "lt", "gt"].includes(value) && Array.isArray(next[index].value)) {
|
|
8832
8939
|
next[index].value = next[index].value[0];
|
|
8833
8940
|
}
|
|
8834
8941
|
if (filters[index].operator === "ndef" || filters[index].operator === "def") {
|
|
8835
8942
|
next[index].value = "";
|
|
8836
8943
|
}
|
|
8837
|
-
if (["between"].includes(value) && Array.isArray(next[index].value) === false) {
|
|
8944
|
+
if (!Array.isArray(value) && ["between"].includes(value) && Array.isArray(next[index].value) === false) {
|
|
8838
8945
|
next[index].value = [next[index].value, ""];
|
|
8839
8946
|
}
|
|
8840
8947
|
if (value === "def" || value === "true") {
|
|
@@ -8854,12 +8961,12 @@ var FilterItems = ({
|
|
|
8854
8961
|
}
|
|
8855
8962
|
setFilters(next);
|
|
8856
8963
|
};
|
|
8857
|
-
return /* @__PURE__ */
|
|
8964
|
+
return /* @__PURE__ */ jsx85(
|
|
8858
8965
|
FilterMenu,
|
|
8859
8966
|
{
|
|
8860
8967
|
id: "search-and-filter-options",
|
|
8861
8968
|
dataTestId: "search-and-filter-options",
|
|
8862
|
-
menuControls: /* @__PURE__ */
|
|
8969
|
+
menuControls: /* @__PURE__ */ jsxs47(
|
|
8863
8970
|
"button",
|
|
8864
8971
|
{
|
|
8865
8972
|
type: "button",
|
|
@@ -8867,7 +8974,7 @@ var FilterItems = ({
|
|
|
8867
8974
|
onClick: handleAddFilter,
|
|
8868
8975
|
"data-testid": "add-filter",
|
|
8869
8976
|
children: [
|
|
8870
|
-
/* @__PURE__ */
|
|
8977
|
+
/* @__PURE__ */ jsx85(Icon8, { icon: "math-plus", iconColor: "currentColor", size: "1rem" }),
|
|
8871
8978
|
addButtonText
|
|
8872
8979
|
]
|
|
8873
8980
|
}
|
|
@@ -8881,7 +8988,7 @@ var FilterItems = ({
|
|
|
8881
8988
|
})) == null ? void 0 : _a.options) != null ? _b : [];
|
|
8882
8989
|
const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
|
|
8883
8990
|
const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
|
|
8884
|
-
return /* @__PURE__ */
|
|
8991
|
+
return /* @__PURE__ */ jsx85(
|
|
8885
8992
|
FilterItem,
|
|
8886
8993
|
{
|
|
8887
8994
|
index: i,
|
|
@@ -8904,7 +9011,7 @@ import { VerticalRhythm as VerticalRhythm7 } from "@uniformdev/design-system";
|
|
|
8904
9011
|
|
|
8905
9012
|
// src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
|
|
8906
9013
|
import { Button as Button6, Callout as Callout6, HorizontalRhythm as HorizontalRhythm9, Paragraph } from "@uniformdev/design-system";
|
|
8907
|
-
import { Fragment as
|
|
9014
|
+
import { Fragment as Fragment17, jsx as jsx86, jsxs as jsxs48 } from "@emotion/react/jsx-runtime";
|
|
8908
9015
|
var SearchAndFilterResultContainer = ({
|
|
8909
9016
|
buttonText,
|
|
8910
9017
|
clearButtonLabel = "clear",
|
|
@@ -8934,31 +9041,31 @@ var SearchAndFilterResultContainer = ({
|
|
|
8934
9041
|
handleResetFilters();
|
|
8935
9042
|
}
|
|
8936
9043
|
};
|
|
8937
|
-
return /* @__PURE__ */
|
|
8938
|
-
/* @__PURE__ */
|
|
8939
|
-
/* @__PURE__ */
|
|
9044
|
+
return /* @__PURE__ */ jsxs48(Fragment17, { children: [
|
|
9045
|
+
/* @__PURE__ */ jsxs48(HorizontalRhythm9, { children: [
|
|
9046
|
+
/* @__PURE__ */ jsxs48("span", { children: [
|
|
8940
9047
|
totalResults,
|
|
8941
9048
|
" results ",
|
|
8942
9049
|
searchTerm ? `for "${searchTerm}"` : null
|
|
8943
9050
|
] }),
|
|
8944
|
-
!searchTerm || hideClearButton ? null : /* @__PURE__ */
|
|
9051
|
+
!searchTerm || hideClearButton ? null : /* @__PURE__ */ jsx86(Button6, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
|
|
8945
9052
|
] }),
|
|
8946
|
-
totalResults === 0 ? /* @__PURE__ */
|
|
8947
|
-
calloutText ? /* @__PURE__ */
|
|
8948
|
-
hideClearButton ? null : /* @__PURE__ */
|
|
9053
|
+
totalResults === 0 ? /* @__PURE__ */ jsxs48(Callout6, { title: calloutTitle != null ? calloutTitle : automateCalloutTitle(), type: "note", children: [
|
|
9054
|
+
calloutText ? /* @__PURE__ */ jsx86(Paragraph, { children: calloutText }) : null,
|
|
9055
|
+
hideClearButton ? null : /* @__PURE__ */ jsx86(Button6, { buttonType: "tertiaryOutline", size: "xs", onClick: handleClearSearch, children: buttonText != null ? buttonText : "Clear search" })
|
|
8949
9056
|
] }) : null
|
|
8950
9057
|
] });
|
|
8951
9058
|
};
|
|
8952
9059
|
|
|
8953
9060
|
// src/components/SearchAndFilter/SearchAndFilter.tsx
|
|
8954
|
-
import { jsx as
|
|
9061
|
+
import { jsx as jsx87, jsxs as jsxs49 } from "@emotion/react/jsx-runtime";
|
|
8955
9062
|
var SearchAndFilter = ({
|
|
8956
9063
|
filters,
|
|
8957
9064
|
filterOptions,
|
|
8958
9065
|
filterVisible,
|
|
8959
9066
|
filterControls,
|
|
8960
9067
|
viewSwitchControls,
|
|
8961
|
-
resultsContainerView = /* @__PURE__ */
|
|
9068
|
+
resultsContainerView = /* @__PURE__ */ jsx87(SearchAndFilterResultContainer, {}),
|
|
8962
9069
|
filterMapper: filterMapper2 = filterMapper,
|
|
8963
9070
|
additionalFiltersContainer,
|
|
8964
9071
|
onChange,
|
|
@@ -8968,7 +9075,7 @@ var SearchAndFilter = ({
|
|
|
8968
9075
|
allowBindingSearchTerm = false,
|
|
8969
9076
|
resetFilterValues = []
|
|
8970
9077
|
}) => {
|
|
8971
|
-
return /* @__PURE__ */
|
|
9078
|
+
return /* @__PURE__ */ jsx87(
|
|
8972
9079
|
SearchAndFilterProvider,
|
|
8973
9080
|
{
|
|
8974
9081
|
filters,
|
|
@@ -8981,18 +9088,18 @@ var SearchAndFilter = ({
|
|
|
8981
9088
|
resetFilterValues,
|
|
8982
9089
|
filterMapper: filterMapper2,
|
|
8983
9090
|
allowBindingSearchTerm,
|
|
8984
|
-
children: /* @__PURE__ */
|
|
8985
|
-
/* @__PURE__ */
|
|
8986
|
-
/* @__PURE__ */
|
|
9091
|
+
children: /* @__PURE__ */ jsxs49(VerticalRhythm7, { "data-testid": "search-and-filter", children: [
|
|
9092
|
+
/* @__PURE__ */ jsxs49("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
|
|
9093
|
+
/* @__PURE__ */ jsx87(
|
|
8987
9094
|
"div",
|
|
8988
9095
|
{
|
|
8989
9096
|
css: SearchAndFilterControlsWrapper(viewSwitchControls ? "auto 1fr 0.05fr" : "auto 1fr"),
|
|
8990
|
-
children: !filterControls ? /* @__PURE__ */
|
|
9097
|
+
children: !filterControls ? /* @__PURE__ */ jsx87(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
|
|
8991
9098
|
}
|
|
8992
9099
|
),
|
|
8993
9100
|
viewSwitchControls
|
|
8994
9101
|
] }),
|
|
8995
|
-
/* @__PURE__ */
|
|
9102
|
+
/* @__PURE__ */ jsx87(FilterItems, { additionalFiltersContainer }),
|
|
8996
9103
|
resultsContainerView
|
|
8997
9104
|
] })
|
|
8998
9105
|
}
|
|
@@ -9001,9 +9108,9 @@ var SearchAndFilter = ({
|
|
|
9001
9108
|
|
|
9002
9109
|
// src/components/SearchAndFilter/SearchOnlyFilter.tsx
|
|
9003
9110
|
import { InputKeywordSearch as InputKeywordSearch3 } from "@uniformdev/design-system";
|
|
9004
|
-
import { createContext as createContext7, useState as
|
|
9005
|
-
import { useDebounce as
|
|
9006
|
-
import { jsx as
|
|
9111
|
+
import { createContext as createContext7, useState as useState26 } from "react";
|
|
9112
|
+
import { useDebounce as useDebounce10 } from "react-use";
|
|
9113
|
+
import { jsx as jsx88 } from "@emotion/react/jsx-runtime";
|
|
9007
9114
|
var SearchOnlyContext = createContext7({
|
|
9008
9115
|
searchTerm: "",
|
|
9009
9116
|
setSearchTerm: () => {
|
|
@@ -9011,8 +9118,8 @@ var SearchOnlyContext = createContext7({
|
|
|
9011
9118
|
});
|
|
9012
9119
|
var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
|
|
9013
9120
|
const { searchTerm, setSearchTerm } = useSearchAndFilter();
|
|
9014
|
-
const [localeSearchTerm, setLocaleSearchTerm] =
|
|
9015
|
-
|
|
9121
|
+
const [localeSearchTerm, setLocaleSearchTerm] = useState26("");
|
|
9122
|
+
useDebounce10(
|
|
9016
9123
|
() => {
|
|
9017
9124
|
setSearchTerm(localeSearchTerm);
|
|
9018
9125
|
onSearchChange == null ? void 0 : onSearchChange(localeSearchTerm);
|
|
@@ -9020,14 +9127,14 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
|
|
|
9020
9127
|
300,
|
|
9021
9128
|
[localeSearchTerm]
|
|
9022
9129
|
);
|
|
9023
|
-
return /* @__PURE__ */
|
|
9130
|
+
return /* @__PURE__ */ jsx88(
|
|
9024
9131
|
SearchOnlyContext.Provider,
|
|
9025
9132
|
{
|
|
9026
9133
|
value: {
|
|
9027
9134
|
searchTerm,
|
|
9028
9135
|
setSearchTerm: setLocaleSearchTerm
|
|
9029
9136
|
},
|
|
9030
|
-
children: /* @__PURE__ */
|
|
9137
|
+
children: /* @__PURE__ */ jsx88("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ jsx88(
|
|
9031
9138
|
InputKeywordSearch3,
|
|
9032
9139
|
{
|
|
9033
9140
|
placeholder: "Search...",
|
|
@@ -9042,7 +9149,7 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
|
|
|
9042
9149
|
};
|
|
9043
9150
|
|
|
9044
9151
|
// src/components/SearchAndFilter/SortItems.tsx
|
|
9045
|
-
import { InputComboBox as
|
|
9152
|
+
import { InputComboBox as InputComboBox6, InputSelect as InputSelect8, SegmentedControl, VerticalRhythm as VerticalRhythm8 } from "@uniformdev/design-system";
|
|
9046
9153
|
|
|
9047
9154
|
// src/components/SearchAndFilter/styles/SortItems.styles.ts
|
|
9048
9155
|
import { css as css39 } from "@emotion/react";
|
|
@@ -9278,7 +9385,7 @@ var InputVariableWrapper = css39`
|
|
|
9278
9385
|
`;
|
|
9279
9386
|
|
|
9280
9387
|
// src/components/SearchAndFilter/SortItems.tsx
|
|
9281
|
-
import { jsx as
|
|
9388
|
+
import { jsx as jsx89, jsxs as jsxs50 } from "@emotion/react/jsx-runtime";
|
|
9282
9389
|
var SortItems = ({
|
|
9283
9390
|
sortByLabel = "Sort by",
|
|
9284
9391
|
localeLabel = "Show locale",
|
|
@@ -9300,11 +9407,11 @@ var SortItems = ({
|
|
|
9300
9407
|
return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
|
|
9301
9408
|
})) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
|
|
9302
9409
|
const localeLabelValue = sortOptions.length > 1 ? localeLabel : `${localeLabel}s`;
|
|
9303
|
-
return /* @__PURE__ */
|
|
9304
|
-
/* @__PURE__ */
|
|
9305
|
-
/* @__PURE__ */
|
|
9306
|
-
/* @__PURE__ */
|
|
9307
|
-
/* @__PURE__ */
|
|
9410
|
+
return /* @__PURE__ */ jsxs50("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
|
|
9411
|
+
/* @__PURE__ */ jsxs50(VerticalRhythm8, { gap: "xs", children: [
|
|
9412
|
+
/* @__PURE__ */ jsx89("span", { css: Title2, children: sortByLabel }),
|
|
9413
|
+
/* @__PURE__ */ jsxs50("div", { css: SortFilterInputRow, children: [
|
|
9414
|
+
/* @__PURE__ */ jsx89(
|
|
9308
9415
|
InputVariables,
|
|
9309
9416
|
{
|
|
9310
9417
|
disableInlineMenu: disableSortBinding,
|
|
@@ -9312,8 +9419,8 @@ var SortItems = ({
|
|
|
9312
9419
|
value: sortField,
|
|
9313
9420
|
valueToResetTo: "created_at",
|
|
9314
9421
|
onChange: (e) => onSortChange(`${e}_${sortDirection}`),
|
|
9315
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
9316
|
-
|
|
9422
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx89(
|
|
9423
|
+
InputComboBox6,
|
|
9317
9424
|
{
|
|
9318
9425
|
id: "sort-by-field",
|
|
9319
9426
|
"aria-label": "Sort by",
|
|
@@ -9335,7 +9442,7 @@ var SortItems = ({
|
|
|
9335
9442
|
)
|
|
9336
9443
|
}
|
|
9337
9444
|
),
|
|
9338
|
-
/* @__PURE__ */
|
|
9445
|
+
/* @__PURE__ */ jsx89(
|
|
9339
9446
|
InputVariables,
|
|
9340
9447
|
{
|
|
9341
9448
|
disableInlineMenu: disableSortBinding,
|
|
@@ -9343,7 +9450,7 @@ var SortItems = ({
|
|
|
9343
9450
|
valueToResetTo: "DESC",
|
|
9344
9451
|
showMenuPosition: disableSortBinding ? void 0 : "inline-right",
|
|
9345
9452
|
onChange: (e) => onSortChange(`${sortField}_${e}`),
|
|
9346
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
9453
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx89(
|
|
9347
9454
|
SegmentedControl,
|
|
9348
9455
|
{
|
|
9349
9456
|
noCheckmark: true,
|
|
@@ -9375,14 +9482,14 @@ var SortItems = ({
|
|
|
9375
9482
|
)
|
|
9376
9483
|
] })
|
|
9377
9484
|
] }),
|
|
9378
|
-
hideLocaleOptions ? null : /* @__PURE__ */
|
|
9485
|
+
hideLocaleOptions ? null : /* @__PURE__ */ jsx89(VerticalRhythm8, { gap: "xs", css: InputVariableWrapper, children: /* @__PURE__ */ jsx89(
|
|
9379
9486
|
InputVariables,
|
|
9380
9487
|
{
|
|
9381
9488
|
label: localeLabelValue,
|
|
9382
9489
|
value: localeValue,
|
|
9383
9490
|
showMenuPosition: "inline-right",
|
|
9384
9491
|
onChange: (e) => onLocaleChange(e != null ? e : ""),
|
|
9385
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
9492
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx89(
|
|
9386
9493
|
InputSelect8,
|
|
9387
9494
|
{
|
|
9388
9495
|
name: "localeReturned",
|
|
@@ -9413,7 +9520,7 @@ function createLocationValidator(setValue, validate) {
|
|
|
9413
9520
|
|
|
9414
9521
|
// src/utils/useContentDataResourceLocaleInfo.ts
|
|
9415
9522
|
import { bindVariables as bindVariables2, createVariableReference as createVariableReference4, LOCALE_DYNAMIC_INPUT_NAME as LOCALE_DYNAMIC_INPUT_NAME2 } from "@uniformdev/canvas";
|
|
9416
|
-
import { useEffect as
|
|
9523
|
+
import { useEffect as useEffect24, useRef as useRef17 } from "react";
|
|
9417
9524
|
function useContentDataResourceLocaleInfo({
|
|
9418
9525
|
locale,
|
|
9419
9526
|
setLocale,
|
|
@@ -9425,7 +9532,7 @@ function useContentDataResourceLocaleInfo({
|
|
|
9425
9532
|
const { flatVariables } = useVariables();
|
|
9426
9533
|
const effectiveLocale = locale != null ? locale : dynamicInputs[LOCALE_DYNAMIC_INPUT_NAME2] ? createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2) : "";
|
|
9427
9534
|
const boundLocale = (_a = bindVariables2({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
|
|
9428
|
-
|
|
9535
|
+
useEffect24(() => {
|
|
9429
9536
|
if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
|
|
9430
9537
|
setLocaleRef.current(createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2));
|
|
9431
9538
|
}
|
|
@@ -9440,8 +9547,8 @@ import {
|
|
|
9440
9547
|
Callout as Callout7,
|
|
9441
9548
|
DrawerContent,
|
|
9442
9549
|
Heading,
|
|
9443
|
-
Input as
|
|
9444
|
-
InputComboBox as
|
|
9550
|
+
Input as Input11,
|
|
9551
|
+
InputComboBox as InputComboBox7,
|
|
9445
9552
|
InputKeywordSearch as InputKeywordSearch4,
|
|
9446
9553
|
InputSelect as InputSelect9,
|
|
9447
9554
|
InputToggle as InputToggle3,
|
|
@@ -9507,8 +9614,8 @@ export {
|
|
|
9507
9614
|
Heading,
|
|
9508
9615
|
INSERT_VARIABLE_COMMAND,
|
|
9509
9616
|
icons_exports as Icons,
|
|
9510
|
-
|
|
9511
|
-
|
|
9617
|
+
Input11 as Input,
|
|
9618
|
+
InputComboBox7 as InputComboBox,
|
|
9512
9619
|
InputKeywordSearch4 as InputKeywordSearch,
|
|
9513
9620
|
InputSelect9 as InputSelect,
|
|
9514
9621
|
InputToggle3 as InputToggle,
|