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