@uniformdev/mesh-sdk-react 20.50.2-alpha.1 → 20.50.2-alpha.109
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 +122 -6
- package/dist/index.d.ts +122 -6
- package/dist/index.esm.js +481 -284
- package/dist/index.js +839 -638
- package/dist/index.mjs +481 -284
- package/package.json +13 -12
package/dist/index.esm.js
CHANGED
|
@@ -266,6 +266,22 @@ function useConnectedDataAsVariables(connectedData) {
|
|
|
266
266
|
);
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
+
// src/hooks/useDelegation.ts
|
|
270
|
+
import { useContext } from "react";
|
|
271
|
+
|
|
272
|
+
// src/components/Delegation/DelegationContext.ts
|
|
273
|
+
import { createContext } from "react";
|
|
274
|
+
var DelegationContext = createContext(null);
|
|
275
|
+
|
|
276
|
+
// src/hooks/useDelegation.ts
|
|
277
|
+
function useDelegation() {
|
|
278
|
+
const ctx = useContext(DelegationContext);
|
|
279
|
+
if (!ctx) {
|
|
280
|
+
throw new Error("useDelegation must be used within a <DelegationProvider>");
|
|
281
|
+
}
|
|
282
|
+
return ctx;
|
|
283
|
+
}
|
|
284
|
+
|
|
269
285
|
// src/hooks/useDynamicInputsAsVariables.tsx
|
|
270
286
|
import { LOCALE_DYNAMIC_INPUT_NAME } from "@uniformdev/canvas";
|
|
271
287
|
import { useMemo as useMemo2 } from "react";
|
|
@@ -309,15 +325,15 @@ Current preview value: ${input3.value || "not provided"}`
|
|
|
309
325
|
import { useMemo as useMemo4, useRef } from "react";
|
|
310
326
|
|
|
311
327
|
// src/components/UniformMeshLocationContext.tsx
|
|
312
|
-
import { createContext as
|
|
328
|
+
import { createContext as createContext3, useContext as useContext3, useMemo as useMemo3, useState } from "react";
|
|
313
329
|
|
|
314
330
|
// src/components/UniformMeshSdkContext.tsx
|
|
315
331
|
import { Theme } from "@uniformdev/design-system";
|
|
316
|
-
import { createContext, useContext } from "react";
|
|
332
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
317
333
|
import { jsx as jsx16, jsxs as jsxs4 } from "@emotion/react/jsx-runtime";
|
|
318
|
-
var UniformMeshSdkContext =
|
|
334
|
+
var UniformMeshSdkContext = createContext2(void 0);
|
|
319
335
|
var useUniformMeshSdkContext = () => {
|
|
320
|
-
const context =
|
|
336
|
+
const context = useContext2(UniformMeshSdkContext);
|
|
321
337
|
if (!context) {
|
|
322
338
|
throw new Error("useUniformMeshSdkContext must be used within <MeshApp /> or <UniformMeshSdkContext />");
|
|
323
339
|
}
|
|
@@ -332,7 +348,7 @@ function useUniformMeshSdk() {
|
|
|
332
348
|
|
|
333
349
|
// src/components/UniformMeshLocationContext.tsx
|
|
334
350
|
import { jsx as jsx17 } from "@emotion/react/jsx-runtime";
|
|
335
|
-
var UniformMeshLocationContext =
|
|
351
|
+
var UniformMeshLocationContext = createContext3(void 0);
|
|
336
352
|
var UniformMeshLocationContextProvider = ({
|
|
337
353
|
children
|
|
338
354
|
}) => {
|
|
@@ -355,7 +371,7 @@ var UniformMeshLocationContextProvider = ({
|
|
|
355
371
|
return /* @__PURE__ */ jsx17(UniformMeshLocationContext.Provider, { value: { location }, children });
|
|
356
372
|
};
|
|
357
373
|
var useUniformMeshLocationContext = () => {
|
|
358
|
-
const context =
|
|
374
|
+
const context = useContext3(UniformMeshLocationContext);
|
|
359
375
|
if (!context) {
|
|
360
376
|
throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");
|
|
361
377
|
}
|
|
@@ -720,7 +736,7 @@ var variablesTipText = css`
|
|
|
720
736
|
|
|
721
737
|
// src/components/Variables/VariablesProvider.tsx
|
|
722
738
|
import mitt from "mitt";
|
|
723
|
-
import { createContext as
|
|
739
|
+
import { createContext as createContext4, useContext as useContext4, useEffect as useEffect3, useMemo as useMemo5, useState as useState3 } from "react";
|
|
724
740
|
|
|
725
741
|
// src/components/Variables/util/useVariableEditTransaction.ts
|
|
726
742
|
import { useCallback, useEffect as useEffect2, useState as useState2 } from "react";
|
|
@@ -770,11 +786,11 @@ function useVariableEditTransaction({
|
|
|
770
786
|
}
|
|
771
787
|
|
|
772
788
|
// src/components/Variables/VariableEditor.tsx
|
|
773
|
-
import {
|
|
789
|
+
import { standardSchemaResolver } from "@hookform/resolvers/standard-schema";
|
|
774
790
|
import { Button, Callout, HorizontalRhythm, Input, useShortcut } from "@uniformdev/design-system";
|
|
775
791
|
import { useLayoutEffect, useRef as useRef2 } from "react";
|
|
776
792
|
import { useForm } from "react-hook-form";
|
|
777
|
-
import * as z from "zod
|
|
793
|
+
import * as z from "zod";
|
|
778
794
|
|
|
779
795
|
// src/components/Variables/styles/VariableEditor.styles.ts
|
|
780
796
|
import { css as css2 } from "@emotion/react";
|
|
@@ -787,7 +803,7 @@ var variablesFormContainer = css2`
|
|
|
787
803
|
// src/components/Variables/VariableEditor.tsx
|
|
788
804
|
import { jsx as jsx19, jsxs as jsxs5 } from "@emotion/react/jsx-runtime";
|
|
789
805
|
var schema = z.object({
|
|
790
|
-
name: z.string().
|
|
806
|
+
name: z.string().min(1, "Name can't be empty").regex(/^[^${}]+$/, "$, {, and } are reserved characters and cannot be used in a variable name"),
|
|
791
807
|
default: z.string(),
|
|
792
808
|
displayName: z.string().optional(),
|
|
793
809
|
helpText: z.string().optional(),
|
|
@@ -813,7 +829,7 @@ function VariableEditor({
|
|
|
813
829
|
order: currentVariable == null ? void 0 : currentVariable.order,
|
|
814
830
|
type: (_d = currentVariable == null ? void 0 : currentVariable.type) != null ? _d : ""
|
|
815
831
|
},
|
|
816
|
-
resolver:
|
|
832
|
+
resolver: standardSchemaResolver(schema)
|
|
817
833
|
});
|
|
818
834
|
const submitHandler = handleSubmit((values) => {
|
|
819
835
|
const finalValue = {
|
|
@@ -909,7 +925,7 @@ function VariableEditor({
|
|
|
909
925
|
|
|
910
926
|
// src/components/Variables/VariablesProvider.tsx
|
|
911
927
|
import { jsx as jsx20, jsxs as jsxs6 } from "@emotion/react/jsx-runtime";
|
|
912
|
-
var VariablesContext =
|
|
928
|
+
var VariablesContext = createContext4(null);
|
|
913
929
|
function VariablesProvider({
|
|
914
930
|
value,
|
|
915
931
|
onChange,
|
|
@@ -1034,7 +1050,7 @@ function VariablesProvider({
|
|
|
1034
1050
|
] });
|
|
1035
1051
|
}
|
|
1036
1052
|
function useVariables(returnEmptyWithoutProvider = false) {
|
|
1037
|
-
const context =
|
|
1053
|
+
const context = useContext4(VariablesContext);
|
|
1038
1054
|
if (!context) {
|
|
1039
1055
|
if (returnEmptyWithoutProvider) {
|
|
1040
1056
|
return {
|
|
@@ -2300,7 +2316,7 @@ function VariablesComposer(props) {
|
|
|
2300
2316
|
nodes: [VariableNode],
|
|
2301
2317
|
editorState: deserializeVariablesEditorState(props.value)
|
|
2302
2318
|
}),
|
|
2303
|
-
//
|
|
2319
|
+
// oxlint-disable-next-line react/exhaustive-deps
|
|
2304
2320
|
[]
|
|
2305
2321
|
);
|
|
2306
2322
|
const editorState = useRef5(void 0);
|
|
@@ -3887,17 +3903,182 @@ function convertRequestDataToDataType(dataType, requestData) {
|
|
|
3887
3903
|
};
|
|
3888
3904
|
}
|
|
3889
3905
|
|
|
3906
|
+
// src/components/Delegation/DelegationGate.tsx
|
|
3907
|
+
import { Callout as Callout3, LoadingOverlay } from "@uniformdev/design-system";
|
|
3908
|
+
import { useEffect as useEffect12 } from "react";
|
|
3909
|
+
import { Fragment as Fragment10, jsx as jsx46 } from "@emotion/react/jsx-runtime";
|
|
3910
|
+
var defaultLoadingWrapperStyle = {
|
|
3911
|
+
position: "relative",
|
|
3912
|
+
minHeight: "12rem",
|
|
3913
|
+
width: "100%"
|
|
3914
|
+
};
|
|
3915
|
+
function DefaultDelegationLoading() {
|
|
3916
|
+
return /* @__PURE__ */ jsx46("div", { style: defaultLoadingWrapperStyle, children: /* @__PURE__ */ jsx46(LoadingOverlay, { isActive: true, statusMessage: "Connecting to Uniform..." }) });
|
|
3917
|
+
}
|
|
3918
|
+
function DefaultDelegationDisabled() {
|
|
3919
|
+
return /* @__PURE__ */ jsx46(Callout3, { type: "caution", title: "Feature unavailable", children: "This app requires permissions that are not currently enabled. Please contact your Uniform administrator to enable identity delegation for this integration." });
|
|
3920
|
+
}
|
|
3921
|
+
function DefaultDelegationError({ error }) {
|
|
3922
|
+
useEffect12(() => {
|
|
3923
|
+
console.error("Delegation connection failed", error);
|
|
3924
|
+
}, [error]);
|
|
3925
|
+
return /* @__PURE__ */ jsx46(Callout3, { type: "error", title: "Connection error", children: /* @__PURE__ */ jsx46("p", { children: "Failed to connect to Uniform. Try again, or contact your administrator if the problem persists." }) });
|
|
3926
|
+
}
|
|
3927
|
+
function DelegationGate({
|
|
3928
|
+
children,
|
|
3929
|
+
loadingComponent,
|
|
3930
|
+
disabledComponent,
|
|
3931
|
+
errorComponent
|
|
3932
|
+
}) {
|
|
3933
|
+
const { status, error } = useDelegation();
|
|
3934
|
+
if (status === "active") {
|
|
3935
|
+
return /* @__PURE__ */ jsx46(Fragment10, { children });
|
|
3936
|
+
}
|
|
3937
|
+
if (status === "idle" || status === "acquiring") {
|
|
3938
|
+
return /* @__PURE__ */ jsx46(Fragment10, { children: loadingComponent !== void 0 ? loadingComponent : /* @__PURE__ */ jsx46(DefaultDelegationLoading, {}) });
|
|
3939
|
+
}
|
|
3940
|
+
if (status === "disabled") {
|
|
3941
|
+
return /* @__PURE__ */ jsx46(Fragment10, { children: disabledComponent !== void 0 ? disabledComponent : /* @__PURE__ */ jsx46(DefaultDelegationDisabled, {}) });
|
|
3942
|
+
}
|
|
3943
|
+
if (status === "error") {
|
|
3944
|
+
const resolvedError = error != null ? error : new Error("Unknown delegation error");
|
|
3945
|
+
if (errorComponent !== void 0) {
|
|
3946
|
+
if (typeof errorComponent === "function") {
|
|
3947
|
+
return /* @__PURE__ */ jsx46(Fragment10, { children: errorComponent({ error: resolvedError }) });
|
|
3948
|
+
}
|
|
3949
|
+
return /* @__PURE__ */ jsx46(Fragment10, { children: errorComponent });
|
|
3950
|
+
}
|
|
3951
|
+
return /* @__PURE__ */ jsx46(DefaultDelegationError, { error: resolvedError });
|
|
3952
|
+
}
|
|
3953
|
+
return null;
|
|
3954
|
+
}
|
|
3955
|
+
|
|
3956
|
+
// src/components/Delegation/DelegationProvider.tsx
|
|
3957
|
+
import { useCallback as useCallback5, useEffect as useEffect13, useMemo as useMemo12, useRef as useRef7, useState as useState11 } from "react";
|
|
3958
|
+
import { jsx as jsx47 } from "@emotion/react/jsx-runtime";
|
|
3959
|
+
var DEFAULT_REVALIDATE_AFTER_MS = 5 * 60 * 1e3;
|
|
3960
|
+
function DelegationProvider({
|
|
3961
|
+
sdk,
|
|
3962
|
+
onSessionToken,
|
|
3963
|
+
checkActive,
|
|
3964
|
+
revalidateOnFocus = true,
|
|
3965
|
+
revalidateAfterMs = DEFAULT_REVALIDATE_AFTER_MS,
|
|
3966
|
+
children
|
|
3967
|
+
}) {
|
|
3968
|
+
const [status, setStatus] = useState11("idle");
|
|
3969
|
+
const [error, setError] = useState11(null);
|
|
3970
|
+
const acquiringRef = useRef7(false);
|
|
3971
|
+
const mountedRef = useRef7(true);
|
|
3972
|
+
const statusRef = useRef7("idle");
|
|
3973
|
+
statusRef.current = status;
|
|
3974
|
+
const acquire = useCallback5(async () => {
|
|
3975
|
+
if (acquiringRef.current) {
|
|
3976
|
+
return;
|
|
3977
|
+
}
|
|
3978
|
+
acquiringRef.current = true;
|
|
3979
|
+
setStatus("acquiring");
|
|
3980
|
+
setError(null);
|
|
3981
|
+
try {
|
|
3982
|
+
const isActive = await checkActive();
|
|
3983
|
+
if (isActive) {
|
|
3984
|
+
if (mountedRef.current) {
|
|
3985
|
+
setStatus("active");
|
|
3986
|
+
}
|
|
3987
|
+
return;
|
|
3988
|
+
}
|
|
3989
|
+
if (!mountedRef.current) {
|
|
3990
|
+
return;
|
|
3991
|
+
}
|
|
3992
|
+
const sessionToken = await sdk.getSessionToken();
|
|
3993
|
+
if (!mountedRef.current) {
|
|
3994
|
+
return;
|
|
3995
|
+
}
|
|
3996
|
+
if (!sessionToken) {
|
|
3997
|
+
setStatus("disabled");
|
|
3998
|
+
return;
|
|
3999
|
+
}
|
|
4000
|
+
await onSessionToken(sessionToken);
|
|
4001
|
+
if (mountedRef.current) {
|
|
4002
|
+
setStatus("active");
|
|
4003
|
+
}
|
|
4004
|
+
} catch (err) {
|
|
4005
|
+
if (mountedRef.current) {
|
|
4006
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
4007
|
+
setStatus("error");
|
|
4008
|
+
}
|
|
4009
|
+
} finally {
|
|
4010
|
+
acquiringRef.current = false;
|
|
4011
|
+
}
|
|
4012
|
+
}, [sdk, onSessionToken, checkActive]);
|
|
4013
|
+
useEffect13(() => {
|
|
4014
|
+
mountedRef.current = true;
|
|
4015
|
+
void acquire();
|
|
4016
|
+
return () => {
|
|
4017
|
+
mountedRef.current = false;
|
|
4018
|
+
};
|
|
4019
|
+
}, [acquire]);
|
|
4020
|
+
const revalidate = useCallback5(async () => {
|
|
4021
|
+
if (acquiringRef.current) {
|
|
4022
|
+
return;
|
|
4023
|
+
}
|
|
4024
|
+
if (statusRef.current !== "active") {
|
|
4025
|
+
return;
|
|
4026
|
+
}
|
|
4027
|
+
try {
|
|
4028
|
+
const isActive = await checkActive();
|
|
4029
|
+
if (!mountedRef.current) {
|
|
4030
|
+
return;
|
|
4031
|
+
}
|
|
4032
|
+
if (!isActive) {
|
|
4033
|
+
void acquire();
|
|
4034
|
+
}
|
|
4035
|
+
} catch (e) {
|
|
4036
|
+
}
|
|
4037
|
+
}, [checkActive, acquire]);
|
|
4038
|
+
useEffect13(() => {
|
|
4039
|
+
if (!revalidateOnFocus) {
|
|
4040
|
+
return;
|
|
4041
|
+
}
|
|
4042
|
+
if (typeof document === "undefined") {
|
|
4043
|
+
return;
|
|
4044
|
+
}
|
|
4045
|
+
let hiddenAt = document.visibilityState === "hidden" ? Date.now() : null;
|
|
4046
|
+
const handleVisibilityChange = () => {
|
|
4047
|
+
if (document.visibilityState === "hidden") {
|
|
4048
|
+
hiddenAt = Date.now();
|
|
4049
|
+
return;
|
|
4050
|
+
}
|
|
4051
|
+
if (document.visibilityState === "visible") {
|
|
4052
|
+
const elapsed = hiddenAt === null ? 0 : Date.now() - hiddenAt;
|
|
4053
|
+
hiddenAt = null;
|
|
4054
|
+
if (elapsed >= revalidateAfterMs) {
|
|
4055
|
+
void revalidate();
|
|
4056
|
+
}
|
|
4057
|
+
}
|
|
4058
|
+
};
|
|
4059
|
+
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
4060
|
+
return () => {
|
|
4061
|
+
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
4062
|
+
};
|
|
4063
|
+
}, [revalidateOnFocus, revalidateAfterMs, revalidate]);
|
|
4064
|
+
const reacquire = useCallback5(() => {
|
|
4065
|
+
void acquire();
|
|
4066
|
+
}, [acquire]);
|
|
4067
|
+
const value = useMemo12(() => ({ status, error, reacquire }), [status, error, reacquire]);
|
|
4068
|
+
return /* @__PURE__ */ jsx47(DelegationContext.Provider, { value, children });
|
|
4069
|
+
}
|
|
4070
|
+
|
|
3890
4071
|
// src/components/MeshApp.tsx
|
|
3891
|
-
import { LoadingIndicator as LoadingIndicator2, Theme as Theme2 } from "@uniformdev/design-system";
|
|
4072
|
+
import { IconsProvider, LoadingIndicator as LoadingIndicator2, Theme as Theme2 } from "@uniformdev/design-system";
|
|
3892
4073
|
|
|
3893
4074
|
// src/hooks/useInitializeUniformMeshSdk.ts
|
|
3894
4075
|
import { initializeUniformMeshSDK } from "@uniformdev/mesh-sdk";
|
|
3895
|
-
import { useEffect as
|
|
4076
|
+
import { useEffect as useEffect14, useRef as useRef8, useState as useState12 } from "react";
|
|
3896
4077
|
var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
3897
|
-
const [error, setError] =
|
|
3898
|
-
const [sdk, setSdk] =
|
|
3899
|
-
const initializationInProgress =
|
|
3900
|
-
|
|
4078
|
+
const [error, setError] = useState12();
|
|
4079
|
+
const [sdk, setSdk] = useState12();
|
|
4080
|
+
const initializationInProgress = useRef8(false);
|
|
4081
|
+
useEffect14(
|
|
3901
4082
|
() => {
|
|
3902
4083
|
if (typeof window === "undefined" || sdk) {
|
|
3903
4084
|
return;
|
|
@@ -3915,7 +4096,7 @@ var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
|
3915
4096
|
setSdk(window.UniformMeshSDK);
|
|
3916
4097
|
}
|
|
3917
4098
|
},
|
|
3918
|
-
//
|
|
4099
|
+
// oxlint-disable-next-line react/exhaustive-deps
|
|
3919
4100
|
[autoResizingDisabled]
|
|
3920
4101
|
);
|
|
3921
4102
|
return {
|
|
@@ -3930,7 +4111,7 @@ var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
|
3930
4111
|
};
|
|
3931
4112
|
|
|
3932
4113
|
// src/components/MeshApp.tsx
|
|
3933
|
-
import { jsx as
|
|
4114
|
+
import { jsx as jsx48, jsxs as jsxs21 } from "@emotion/react/jsx-runtime";
|
|
3934
4115
|
var MeshApp = ({
|
|
3935
4116
|
children,
|
|
3936
4117
|
loadingComponent,
|
|
@@ -3939,25 +4120,25 @@ var MeshApp = ({
|
|
|
3939
4120
|
const { initializing, error, sdk } = useInitializeUniformMeshSdk();
|
|
3940
4121
|
if (initializing || !sdk) {
|
|
3941
4122
|
const LoadingComponent = loadingComponent;
|
|
3942
|
-
return LoadingComponent ? /* @__PURE__ */
|
|
4123
|
+
return LoadingComponent ? /* @__PURE__ */ jsx48(LoadingComponent, {}) : /* @__PURE__ */ jsx48(LoadingIndicator2, {});
|
|
3943
4124
|
}
|
|
3944
4125
|
if (error) {
|
|
3945
4126
|
const ErrorComponent = errorComponent;
|
|
3946
4127
|
if (ErrorComponent) {
|
|
3947
|
-
return /* @__PURE__ */
|
|
4128
|
+
return /* @__PURE__ */ jsx48(ErrorComponent, { error });
|
|
3948
4129
|
}
|
|
3949
4130
|
throw error;
|
|
3950
4131
|
}
|
|
3951
4132
|
return /* @__PURE__ */ jsxs21(UniformMeshSdkContext.Provider, { value: { sdk }, children: [
|
|
3952
|
-
/* @__PURE__ */
|
|
3953
|
-
/* @__PURE__ */
|
|
4133
|
+
/* @__PURE__ */ jsx48(Theme2, {}),
|
|
4134
|
+
/* @__PURE__ */ jsx48(IconsProvider, { children: /* @__PURE__ */ jsx48(UniformMeshLocationContextProvider, { children }) })
|
|
3954
4135
|
] });
|
|
3955
4136
|
};
|
|
3956
4137
|
|
|
3957
4138
|
// src/components/ObjectSearch/DataRefreshButton.tsx
|
|
3958
4139
|
import { css as css14 } from "@emotion/react";
|
|
3959
4140
|
import { Button as Button2, LoadingIndicator as LoadingIndicator3 } from "@uniformdev/design-system";
|
|
3960
|
-
import { jsx as
|
|
4141
|
+
import { jsx as jsx49, jsxs as jsxs22 } from "@emotion/react/jsx-runtime";
|
|
3961
4142
|
var DataRefreshButton = ({
|
|
3962
4143
|
buttonText,
|
|
3963
4144
|
isLoading,
|
|
@@ -3965,7 +4146,7 @@ var DataRefreshButton = ({
|
|
|
3965
4146
|
...props
|
|
3966
4147
|
}) => {
|
|
3967
4148
|
return /* @__PURE__ */ jsxs22(Button2, { buttonType: "ghost", onClick: onRefreshData, disabled: isLoading, ...props, children: [
|
|
3968
|
-
!isLoading ? null : /* @__PURE__ */
|
|
4149
|
+
!isLoading ? null : /* @__PURE__ */ jsx49(
|
|
3969
4150
|
LoadingIndicator3,
|
|
3970
4151
|
{
|
|
3971
4152
|
css: css14`
|
|
@@ -3980,20 +4161,20 @@ var DataRefreshButton = ({
|
|
|
3980
4161
|
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
3981
4162
|
import { css as css16 } from "@emotion/react";
|
|
3982
4163
|
import { bindVariables } from "@uniformdev/canvas";
|
|
3983
|
-
import { Callout as
|
|
4164
|
+
import { Callout as Callout4, Container, ScrollableList, VerticalRhythm as VerticalRhythm3 } from "@uniformdev/design-system";
|
|
3984
4165
|
|
|
3985
4166
|
// src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
|
|
3986
4167
|
import { bindVariablesToObject as bindVariablesToObject2 } from "@uniformdev/canvas";
|
|
3987
4168
|
import {
|
|
3988
|
-
createContext as
|
|
3989
|
-
useCallback as
|
|
3990
|
-
useContext as
|
|
4169
|
+
createContext as createContext6,
|
|
4170
|
+
useCallback as useCallback6,
|
|
4171
|
+
useContext as useContext6,
|
|
3991
4172
|
useDeferredValue,
|
|
3992
|
-
useMemo as
|
|
3993
|
-
useState as
|
|
4173
|
+
useMemo as useMemo13,
|
|
4174
|
+
useState as useState13
|
|
3994
4175
|
} from "react";
|
|
3995
|
-
import { jsx as
|
|
3996
|
-
var ObjectSearchContext =
|
|
4176
|
+
import { jsx as jsx50 } from "@emotion/react/jsx-runtime";
|
|
4177
|
+
var ObjectSearchContext = createContext6({
|
|
3997
4178
|
onSetQuery: () => {
|
|
3998
4179
|
},
|
|
3999
4180
|
onSelectItem: () => {
|
|
@@ -4014,16 +4195,16 @@ var ObjectSearchProvider = ({
|
|
|
4014
4195
|
children,
|
|
4015
4196
|
defaultQuery
|
|
4016
4197
|
}) => {
|
|
4017
|
-
const [query, setQuery] =
|
|
4198
|
+
const [query, setQuery] = useState13({
|
|
4018
4199
|
contentType: "",
|
|
4019
4200
|
keyword: "",
|
|
4020
4201
|
...defaultQuery
|
|
4021
4202
|
});
|
|
4022
4203
|
const { flatVariables } = useVariables(true);
|
|
4023
4204
|
const querySearchDeferred = useDeferredValue(query);
|
|
4024
|
-
const [selectedItems, setSelectedItems] =
|
|
4025
|
-
const [list, setList] =
|
|
4026
|
-
const onSetQuery =
|
|
4205
|
+
const [selectedItems, setSelectedItems] = useState13(currentlySelectedItems != null ? currentlySelectedItems : []);
|
|
4206
|
+
const [list, setList] = useState13({});
|
|
4207
|
+
const onSetQuery = useCallback6(
|
|
4027
4208
|
(value2) => {
|
|
4028
4209
|
if (Array.isArray(value2.contentType) && value2.contentType.length > 0) {
|
|
4029
4210
|
return setQuery({
|
|
@@ -4035,7 +4216,7 @@ var ObjectSearchProvider = ({
|
|
|
4035
4216
|
},
|
|
4036
4217
|
[setQuery]
|
|
4037
4218
|
);
|
|
4038
|
-
const onSelectItem =
|
|
4219
|
+
const onSelectItem = useCallback6(
|
|
4039
4220
|
(selectedResult) => {
|
|
4040
4221
|
if (Array.isArray(selectedResult)) {
|
|
4041
4222
|
setSelectedItems(selectedResult);
|
|
@@ -4049,17 +4230,17 @@ var ObjectSearchProvider = ({
|
|
|
4049
4230
|
},
|
|
4050
4231
|
[setSelectedItems, selectedItems]
|
|
4051
4232
|
);
|
|
4052
|
-
const onRemoveAllSelectedItems =
|
|
4233
|
+
const onRemoveAllSelectedItems = useCallback6(() => {
|
|
4053
4234
|
setSelectedItems([]);
|
|
4054
4235
|
}, [setSelectedItems]);
|
|
4055
|
-
const onSetList =
|
|
4236
|
+
const onSetList = useCallback6(
|
|
4056
4237
|
(value2) => {
|
|
4057
4238
|
setList(value2);
|
|
4058
4239
|
},
|
|
4059
4240
|
[setList]
|
|
4060
4241
|
);
|
|
4061
|
-
const boundQuery =
|
|
4062
|
-
const value =
|
|
4242
|
+
const boundQuery = useMemo13(() => bindQuery(query, flatVariables), [query, flatVariables]);
|
|
4243
|
+
const value = useMemo13(
|
|
4063
4244
|
() => ({
|
|
4064
4245
|
boundQuery,
|
|
4065
4246
|
onSetQuery,
|
|
@@ -4083,10 +4264,10 @@ var ObjectSearchProvider = ({
|
|
|
4083
4264
|
onSetList
|
|
4084
4265
|
]
|
|
4085
4266
|
);
|
|
4086
|
-
return /* @__PURE__ */
|
|
4267
|
+
return /* @__PURE__ */ jsx50(ObjectSearchContext.Provider, { value, children });
|
|
4087
4268
|
};
|
|
4088
4269
|
function useObjectSearchContext() {
|
|
4089
|
-
return
|
|
4270
|
+
return useContext6(ObjectSearchContext);
|
|
4090
4271
|
}
|
|
4091
4272
|
function bindQuery(query, inputs) {
|
|
4092
4273
|
const { result, errors } = bindVariablesToObject2({
|
|
@@ -4179,7 +4360,7 @@ var ObjectListItemUnControlledContent = css15`
|
|
|
4179
4360
|
`;
|
|
4180
4361
|
|
|
4181
4362
|
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
4182
|
-
import { jsx as
|
|
4363
|
+
import { jsx as jsx51, jsxs as jsxs23 } from "@emotion/react/jsx-runtime";
|
|
4183
4364
|
var ObjectSearchListItem = ({
|
|
4184
4365
|
id,
|
|
4185
4366
|
title,
|
|
@@ -4220,7 +4401,7 @@ var ObjectSearchListItem = ({
|
|
|
4220
4401
|
css: ObjectListItemControlledContent,
|
|
4221
4402
|
"aria-disabled": disabled,
|
|
4222
4403
|
children: [
|
|
4223
|
-
imageUrl ? /* @__PURE__ */
|
|
4404
|
+
imageUrl ? /* @__PURE__ */ jsx51(
|
|
4224
4405
|
"img",
|
|
4225
4406
|
{
|
|
4226
4407
|
src: imageUrl,
|
|
@@ -4230,27 +4411,27 @@ var ObjectSearchListItem = ({
|
|
|
4230
4411
|
}
|
|
4231
4412
|
) : null,
|
|
4232
4413
|
/* @__PURE__ */ jsxs23("div", { role: "heading", css: ObjectListItemHeadingGroup, children: [
|
|
4233
|
-
!contentType ? null : /* @__PURE__ */
|
|
4234
|
-
/* @__PURE__ */
|
|
4414
|
+
!contentType ? null : /* @__PURE__ */ jsx51("span", { css: ObjectListItemSubtitle, children: formatedContentType }),
|
|
4415
|
+
/* @__PURE__ */ jsx51("span", { css: ObjectListItemTitle, "data-testid": "title", children: title })
|
|
4235
4416
|
] })
|
|
4236
4417
|
]
|
|
4237
4418
|
}
|
|
4238
4419
|
),
|
|
4239
4420
|
/* @__PURE__ */ jsxs23("div", { css: ObjectListItemInfoContainer, children: [
|
|
4240
|
-
selected ? /* @__PURE__ */
|
|
4241
|
-
!popoverData ? null : /* @__PURE__ */
|
|
4421
|
+
selected ? /* @__PURE__ */ jsx51(Chip, { text: "selected", size: "xs" }) : null,
|
|
4422
|
+
!popoverData ? null : /* @__PURE__ */ jsx51(Popover, { ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
|
|
4242
4423
|
] }),
|
|
4243
|
-
!children ? null : /* @__PURE__ */
|
|
4424
|
+
!children ? null : /* @__PURE__ */ jsx51("div", { css: ObjectListItemUnControlledContent, children })
|
|
4244
4425
|
]
|
|
4245
4426
|
}
|
|
4246
4427
|
);
|
|
4247
4428
|
};
|
|
4248
4429
|
var ObjectSearchListItemLoadingSkeleton = () => {
|
|
4249
|
-
return /* @__PURE__ */
|
|
4430
|
+
return /* @__PURE__ */ jsx51("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
|
|
4250
4431
|
};
|
|
4251
4432
|
|
|
4252
4433
|
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
4253
|
-
import { jsx as
|
|
4434
|
+
import { jsx as jsx52, jsxs as jsxs24 } from "@emotion/react/jsx-runtime";
|
|
4254
4435
|
var ObjectSearchContainer = ({
|
|
4255
4436
|
label,
|
|
4256
4437
|
enableDynamicInputToResultId,
|
|
@@ -4262,7 +4443,7 @@ var ObjectSearchContainer = ({
|
|
|
4262
4443
|
const { onSelectItem, selectedListItems, list } = useObjectSearchContext();
|
|
4263
4444
|
const { flatVariables } = useVariables(true);
|
|
4264
4445
|
const inputValue = (_b = (_a = selectedListItems == null ? void 0 : selectedListItems[0]) == null ? void 0 : _a.id) != null ? _b : "";
|
|
4265
|
-
const listItems = resultList != null ? resultList : /* @__PURE__ */
|
|
4446
|
+
const listItems = resultList != null ? resultList : /* @__PURE__ */ jsx52(
|
|
4266
4447
|
ScrollableList,
|
|
4267
4448
|
{
|
|
4268
4449
|
role: "list",
|
|
@@ -4271,7 +4452,7 @@ var ObjectSearchContainer = ({
|
|
|
4271
4452
|
max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
|
|
4272
4453
|
}
|
|
4273
4454
|
`,
|
|
4274
|
-
children: /* @__PURE__ */
|
|
4455
|
+
children: /* @__PURE__ */ jsx52(DefaultResultList, {})
|
|
4275
4456
|
}
|
|
4276
4457
|
);
|
|
4277
4458
|
const body = /* @__PURE__ */ jsxs24(VerticalRhythm3, { children: [
|
|
@@ -4306,7 +4487,7 @@ var ObjectSearchContainer = ({
|
|
|
4306
4487
|
]);
|
|
4307
4488
|
};
|
|
4308
4489
|
return /* @__PURE__ */ jsxs24(VerticalRhythm3, { children: [
|
|
4309
|
-
/* @__PURE__ */
|
|
4490
|
+
/* @__PURE__ */ jsx52(Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: label ? /* @__PURE__ */ jsx52(
|
|
4310
4491
|
InputVariables,
|
|
4311
4492
|
{
|
|
4312
4493
|
label,
|
|
@@ -4328,17 +4509,17 @@ var DefaultResultList = () => {
|
|
|
4328
4509
|
var _a;
|
|
4329
4510
|
const { list } = useObjectSearchContext();
|
|
4330
4511
|
if (!list.items) {
|
|
4331
|
-
return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */
|
|
4512
|
+
return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */ jsx52(ObjectSearchListItemLoadingSkeleton, {}, i));
|
|
4332
4513
|
}
|
|
4333
4514
|
if (list.items.length === 0) {
|
|
4334
|
-
return /* @__PURE__ */
|
|
4515
|
+
return /* @__PURE__ */ jsx52(Callout4, { type: "info", children: "No results were found" });
|
|
4335
4516
|
}
|
|
4336
|
-
return (_a = list.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */
|
|
4517
|
+
return (_a = list.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ jsx52(ObjectSearchListItem, { ...item }, item.id));
|
|
4337
4518
|
};
|
|
4338
4519
|
|
|
4339
4520
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
4340
4521
|
import { DebouncedInputKeywordSearch, InputSelect as InputSelect3 } from "@uniformdev/design-system";
|
|
4341
|
-
import { useMemo as
|
|
4522
|
+
import { useMemo as useMemo14, useState as useState14 } from "react";
|
|
4342
4523
|
|
|
4343
4524
|
// src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
|
|
4344
4525
|
import { css as css17 } from "@emotion/react";
|
|
@@ -4361,7 +4542,7 @@ var ObjectSearchFilterGrid = (gridColumns) => css17`
|
|
|
4361
4542
|
`;
|
|
4362
4543
|
|
|
4363
4544
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
4364
|
-
import { jsx as
|
|
4545
|
+
import { jsx as jsx53, jsxs as jsxs25 } from "@emotion/react/jsx-runtime";
|
|
4365
4546
|
var ObjectSearchFilter = ({
|
|
4366
4547
|
requireContentType,
|
|
4367
4548
|
typeSelectorAllTypesOptionText = "All content types",
|
|
@@ -4372,7 +4553,7 @@ var ObjectSearchFilter = ({
|
|
|
4372
4553
|
}) => {
|
|
4373
4554
|
var _a, _b;
|
|
4374
4555
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
4375
|
-
const [searchState, setSearchState] =
|
|
4556
|
+
const [searchState, setSearchState] = useState14({
|
|
4376
4557
|
contentType: (_a = query.contentType) != null ? _a : "",
|
|
4377
4558
|
keyword: (_b = query.keyword) != null ? _b : ""
|
|
4378
4559
|
});
|
|
@@ -4382,7 +4563,7 @@ var ObjectSearchFilter = ({
|
|
|
4382
4563
|
});
|
|
4383
4564
|
onSetQuery({ ...query, ...value });
|
|
4384
4565
|
};
|
|
4385
|
-
const memoizedSelectOptions =
|
|
4566
|
+
const memoizedSelectOptions = useMemo14(() => {
|
|
4386
4567
|
if (!requireContentType && !(selectOptions == null ? void 0 : selectOptions.length)) {
|
|
4387
4568
|
return [];
|
|
4388
4569
|
}
|
|
@@ -4400,7 +4581,7 @@ var ObjectSearchFilter = ({
|
|
|
4400
4581
|
ObjectSearchFilterGrid(shouldRenderSelect ? "1fr 2fr" : "1fr")
|
|
4401
4582
|
],
|
|
4402
4583
|
children: [
|
|
4403
|
-
memoizedSelectOptions.length ? /* @__PURE__ */
|
|
4584
|
+
memoizedSelectOptions.length ? /* @__PURE__ */ jsx53(
|
|
4404
4585
|
InputSelect3,
|
|
4405
4586
|
{
|
|
4406
4587
|
label: selectLabel,
|
|
@@ -4410,7 +4591,7 @@ var ObjectSearchFilter = ({
|
|
|
4410
4591
|
value: query.contentType
|
|
4411
4592
|
}
|
|
4412
4593
|
) : null,
|
|
4413
|
-
/* @__PURE__ */
|
|
4594
|
+
/* @__PURE__ */ jsx53(
|
|
4414
4595
|
DebouncedInputKeywordSearch,
|
|
4415
4596
|
{
|
|
4416
4597
|
inputFieldName: searchInputName,
|
|
@@ -4427,9 +4608,9 @@ var ObjectSearchFilter = ({
|
|
|
4427
4608
|
};
|
|
4428
4609
|
|
|
4429
4610
|
// src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
|
|
4430
|
-
import { jsx as
|
|
4611
|
+
import { jsx as jsx54 } from "@emotion/react/jsx-runtime";
|
|
4431
4612
|
var ObjectSearchFilterContainer2 = ({ children }) => {
|
|
4432
|
-
return /* @__PURE__ */
|
|
4613
|
+
return /* @__PURE__ */ jsx54("div", { children: /* @__PURE__ */ jsx54("div", { css: ObjectSearchFilterContainer, children }) });
|
|
4433
4614
|
};
|
|
4434
4615
|
|
|
4435
4616
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
@@ -4437,10 +4618,10 @@ import { Button as Button3, Chip as Chip2, Link, Popover as Popover2 } from "@un
|
|
|
4437
4618
|
import { format as timeagoFormat } from "timeago.js";
|
|
4438
4619
|
|
|
4439
4620
|
// src/components/Image/Image.tsx
|
|
4440
|
-
import { jsx as
|
|
4621
|
+
import { jsx as jsx55 } from "@emotion/react/jsx-runtime";
|
|
4441
4622
|
function Image({ src, alt, className }) {
|
|
4442
4623
|
const CompImage = src && typeof src !== "string" ? src : null;
|
|
4443
|
-
return CompImage ? /* @__PURE__ */
|
|
4624
|
+
return CompImage ? /* @__PURE__ */ jsx55(CompImage, { className }) : /* @__PURE__ */ jsx55("img", { src, alt, className });
|
|
4444
4625
|
}
|
|
4445
4626
|
|
|
4446
4627
|
// src/components/ObjectSearch/styles/ObjectSearchResultItemButton.styles.ts
|
|
@@ -4480,14 +4661,14 @@ var ButtonIcon = css18`
|
|
|
4480
4661
|
`;
|
|
4481
4662
|
|
|
4482
4663
|
// src/components/ObjectSearch/ObjectSearchResultItemButton.tsx
|
|
4483
|
-
import { jsx as
|
|
4664
|
+
import { jsx as jsx56, jsxs as jsxs26 } from "@emotion/react/jsx-runtime";
|
|
4484
4665
|
var ObjectSearchResultItemButton = ({
|
|
4485
4666
|
text,
|
|
4486
4667
|
icon,
|
|
4487
4668
|
...props
|
|
4488
4669
|
}) => {
|
|
4489
4670
|
return /* @__PURE__ */ jsxs26("button", { type: "button", css: ButtonStyles, ...props, children: [
|
|
4490
|
-
!icon ? null : /* @__PURE__ */
|
|
4671
|
+
!icon ? null : /* @__PURE__ */ jsx56(Image, { src: icon, css: ButtonIcon }),
|
|
4491
4672
|
text
|
|
4492
4673
|
] });
|
|
4493
4674
|
};
|
|
@@ -4497,7 +4678,7 @@ var LinkButton = ({
|
|
|
4497
4678
|
...props
|
|
4498
4679
|
}) => {
|
|
4499
4680
|
return /* @__PURE__ */ jsxs26("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
|
|
4500
|
-
!icon ? null : /* @__PURE__ */
|
|
4681
|
+
!icon ? null : /* @__PURE__ */ jsx56(Image, { src: icon, css: ButtonIcon }),
|
|
4501
4682
|
text
|
|
4502
4683
|
] });
|
|
4503
4684
|
};
|
|
@@ -4569,7 +4750,7 @@ var ObjectSearchImage = css19`
|
|
|
4569
4750
|
`;
|
|
4570
4751
|
|
|
4571
4752
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
4572
|
-
import { jsx as
|
|
4753
|
+
import { jsx as jsx57, jsxs as jsxs27 } from "@emotion/react/jsx-runtime";
|
|
4573
4754
|
var ObjectSearchResultItem = ({
|
|
4574
4755
|
id,
|
|
4575
4756
|
title,
|
|
@@ -4594,9 +4775,9 @@ var ObjectSearchResultItem = ({
|
|
|
4594
4775
|
onRemove == null ? void 0 : onRemove();
|
|
4595
4776
|
};
|
|
4596
4777
|
return /* @__PURE__ */ jsxs27("div", { css: ObjectSearchResultItemContainer, "data-testid": "search-result-item", children: [
|
|
4597
|
-
disableDnD ? null : /* @__PURE__ */
|
|
4598
|
-
/* @__PURE__ */
|
|
4599
|
-
!imageUrl ? null : /* @__PURE__ */
|
|
4778
|
+
disableDnD ? null : /* @__PURE__ */ jsx57("div", { role: "presentation", className: "drag-handle", css: ObjectSearchDragHandle }),
|
|
4779
|
+
/* @__PURE__ */ jsx57("div", { children: /* @__PURE__ */ jsxs27("div", { css: ObjectSearchContentContainer, children: [
|
|
4780
|
+
!imageUrl ? null : /* @__PURE__ */ jsx57(
|
|
4600
4781
|
"img",
|
|
4601
4782
|
{
|
|
4602
4783
|
src: imageUrl,
|
|
@@ -4606,9 +4787,9 @@ var ObjectSearchResultItem = ({
|
|
|
4606
4787
|
}
|
|
4607
4788
|
),
|
|
4608
4789
|
/* @__PURE__ */ jsxs27("div", { children: [
|
|
4609
|
-
/* @__PURE__ */
|
|
4790
|
+
/* @__PURE__ */ jsx57("span", { css: ObjectSearchResultItemSubtitle, "data-testid": "sub-title", children: formatedContentType }),
|
|
4610
4791
|
/* @__PURE__ */ jsxs27("span", { role: "heading", css: ObjectSearchResultItemTitle, "data-testid": "title", children: [
|
|
4611
|
-
onClick ? /* @__PURE__ */
|
|
4792
|
+
onClick ? /* @__PURE__ */ jsx57(
|
|
4612
4793
|
Link,
|
|
4613
4794
|
{
|
|
4614
4795
|
onClick: (e) => {
|
|
@@ -4620,28 +4801,28 @@ var ObjectSearchResultItem = ({
|
|
|
4620
4801
|
text: title != null ? title : name,
|
|
4621
4802
|
css: ObjectSearchResultItemTitleLink
|
|
4622
4803
|
}
|
|
4623
|
-
) : /* @__PURE__ */
|
|
4624
|
-
!popoverData ? null : /* @__PURE__ */
|
|
4804
|
+
) : /* @__PURE__ */ jsx57("span", { children: title != null ? title : name }),
|
|
4805
|
+
!popoverData ? null : /* @__PURE__ */ jsx57(Popover2, { ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
|
|
4625
4806
|
] }),
|
|
4626
4807
|
!createdAt && !publishStatus ? null : /* @__PURE__ */ jsxs27("div", { css: ObjectSearchAuthorStateGroup, children: [
|
|
4627
|
-
!(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */
|
|
4808
|
+
!(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ jsx57(Chip2, { theme: legacyThemeMapper(publishStatus.theme), text: publishStatus.text, size: "xs" }),
|
|
4628
4809
|
!createdAt && !publishedAt ? null : /* @__PURE__ */ jsxs27("div", { css: ObjectSearchUpdateGroup, children: [
|
|
4629
4810
|
!createdAt ? null : /* @__PURE__ */ jsxs27("small", { css: ObjectSearchResultItemTimeStamp, children: [
|
|
4630
|
-
/* @__PURE__ */
|
|
4811
|
+
/* @__PURE__ */ jsx57("strong", { children: "Last updated: " }),
|
|
4631
4812
|
timeagoFormat(createdAt)
|
|
4632
4813
|
] }),
|
|
4633
4814
|
!publishedAt ? null : /* @__PURE__ */ jsxs27("small", { css: ObjectSearchResultItemTimeStamp, children: [
|
|
4634
|
-
/* @__PURE__ */
|
|
4815
|
+
/* @__PURE__ */ jsx57("strong", { children: "Last published: " }),
|
|
4635
4816
|
timeagoFormat(publishedAt)
|
|
4636
4817
|
] })
|
|
4637
4818
|
] })
|
|
4638
4819
|
] }),
|
|
4639
|
-
/* @__PURE__ */
|
|
4820
|
+
/* @__PURE__ */ jsx57("div", { children })
|
|
4640
4821
|
] })
|
|
4641
4822
|
] }) }),
|
|
4642
4823
|
!editLink && hideRemoveButton ? null : /* @__PURE__ */ jsxs27("div", { css: ObjectSearchAuthorStateGroup, children: [
|
|
4643
|
-
!editLink ? null : /* @__PURE__ */
|
|
4644
|
-
hideRemoveButton ? null : /* @__PURE__ */
|
|
4824
|
+
!editLink ? null : /* @__PURE__ */ jsx57(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
|
|
4825
|
+
hideRemoveButton ? null : /* @__PURE__ */ jsx57(Button3, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
|
|
4645
4826
|
] })
|
|
4646
4827
|
] });
|
|
4647
4828
|
};
|
|
@@ -4693,7 +4874,7 @@ var ObjectSearchResultListTitle = css20`
|
|
|
4693
4874
|
`;
|
|
4694
4875
|
|
|
4695
4876
|
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
4696
|
-
import { Fragment as
|
|
4877
|
+
import { Fragment as Fragment11, jsx as jsx58, jsxs as jsxs28 } from "@emotion/react/jsx-runtime";
|
|
4697
4878
|
var DroppableHack2 = Droppable2;
|
|
4698
4879
|
var DraggableHack2 = Draggable2;
|
|
4699
4880
|
function ObjectSearchResultList({
|
|
@@ -4703,7 +4884,7 @@ function ObjectSearchResultList({
|
|
|
4703
4884
|
hideRemoveButton = false,
|
|
4704
4885
|
resultLabelOverride,
|
|
4705
4886
|
additionalButtons,
|
|
4706
|
-
renderResultComponent = (value) => /* @__PURE__ */
|
|
4887
|
+
renderResultComponent = (value) => /* @__PURE__ */ jsx58(ObjectSearchResultItem, { ...value }),
|
|
4707
4888
|
multiSelectId,
|
|
4708
4889
|
disableDnD = false,
|
|
4709
4890
|
getContainerForDnDReparenting,
|
|
@@ -4730,7 +4911,7 @@ function ObjectSearchResultList({
|
|
|
4730
4911
|
...item,
|
|
4731
4912
|
disableDnD: selectedListItems.length === 1 || disableDnD
|
|
4732
4913
|
});
|
|
4733
|
-
return /* @__PURE__ */
|
|
4914
|
+
return /* @__PURE__ */ jsx58(
|
|
4734
4915
|
"div",
|
|
4735
4916
|
{
|
|
4736
4917
|
css: [
|
|
@@ -4745,16 +4926,16 @@ function ObjectSearchResultList({
|
|
|
4745
4926
|
}
|
|
4746
4927
|
);
|
|
4747
4928
|
};
|
|
4748
|
-
return /* @__PURE__ */ jsxs28(
|
|
4929
|
+
return /* @__PURE__ */ jsxs28(Fragment11, { children: [
|
|
4749
4930
|
/* @__PURE__ */ jsxs28("div", { role: "group", css: ObjectSearchResultListContainer, children: [
|
|
4750
4931
|
!resultLabelOverride ? /* @__PURE__ */ jsxs28("div", { role: "note", css: ObjectSearchResultListCounterContainer, children: [
|
|
4751
|
-
/* @__PURE__ */
|
|
4932
|
+
/* @__PURE__ */ jsx58("span", { css: ObjectSearchResultListTitle, children: resultLabelText }),
|
|
4752
4933
|
" ",
|
|
4753
|
-
!selectedListItems.length ? null : /* @__PURE__ */
|
|
4934
|
+
!selectedListItems.length ? null : /* @__PURE__ */ jsx58(Counter, { count: selectedListItems.length })
|
|
4754
4935
|
] }) : resultLabelOverride,
|
|
4755
4936
|
/* @__PURE__ */ jsxs28("div", { css: ObjectSearchResultListCounterContainer, children: [
|
|
4756
4937
|
additionalButtons,
|
|
4757
|
-
hideRemoveButton ? null : /* @__PURE__ */
|
|
4938
|
+
hideRemoveButton ? null : /* @__PURE__ */ jsx58(
|
|
4758
4939
|
Button4,
|
|
4759
4940
|
{
|
|
4760
4941
|
buttonType: "ghostDestructive",
|
|
@@ -4766,7 +4947,7 @@ function ObjectSearchResultList({
|
|
|
4766
4947
|
)
|
|
4767
4948
|
] })
|
|
4768
4949
|
] }),
|
|
4769
|
-
!selectedListItems.length ? whenNothingSelected : /* @__PURE__ */
|
|
4950
|
+
!selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ jsx58(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx58(
|
|
4770
4951
|
DroppableHack2,
|
|
4771
4952
|
{
|
|
4772
4953
|
droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select",
|
|
@@ -4774,7 +4955,7 @@ function ObjectSearchResultList({
|
|
|
4774
4955
|
getContainerForClone: getContainerForDnDReparenting,
|
|
4775
4956
|
children: (provided) => /* @__PURE__ */ jsxs28("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
4776
4957
|
selectedListItems.map((item, i) => {
|
|
4777
|
-
return /* @__PURE__ */
|
|
4958
|
+
return /* @__PURE__ */ jsx58(
|
|
4778
4959
|
DraggableHack2,
|
|
4779
4960
|
{
|
|
4780
4961
|
draggableId: item.id,
|
|
@@ -4794,8 +4975,8 @@ function ObjectSearchResultList({
|
|
|
4794
4975
|
|
|
4795
4976
|
// src/components/ObjectSearch/QueryFilter.tsx
|
|
4796
4977
|
import { DebouncedInputKeywordSearch as DebouncedInputKeywordSearch2, Input as Input4, InputSelect as InputSelect4, VerticalRhythm as VerticalRhythm4 } from "@uniformdev/design-system";
|
|
4797
|
-
import { useEffect as
|
|
4798
|
-
import { jsx as
|
|
4978
|
+
import { useEffect as useEffect15, useState as useState15 } from "react";
|
|
4979
|
+
import { jsx as jsx59, jsxs as jsxs29 } from "@emotion/react/jsx-runtime";
|
|
4799
4980
|
var QueryFilter = ({
|
|
4800
4981
|
requireContentType,
|
|
4801
4982
|
queryFilterTitle = "Configure Query",
|
|
@@ -4823,7 +5004,7 @@ var QueryFilter = ({
|
|
|
4823
5004
|
}) => {
|
|
4824
5005
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
4825
5006
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
4826
|
-
const [queryState, setQueryState] =
|
|
5007
|
+
const [queryState, setQueryState] = useState15({
|
|
4827
5008
|
contentType: (_a = query.contentType) != null ? _a : "",
|
|
4828
5009
|
keyword: (_b = query.keyword) != null ? _b : "",
|
|
4829
5010
|
count: (_c = query.count) != null ? _c : 5,
|
|
@@ -4834,13 +5015,13 @@ var QueryFilter = ({
|
|
|
4834
5015
|
setQueryState((prev) => ({ ...prev, ...value }));
|
|
4835
5016
|
onSetQuery({ ...query, ...value });
|
|
4836
5017
|
};
|
|
4837
|
-
|
|
5018
|
+
useEffect15(() => {
|
|
4838
5019
|
onSetQuery(queryState);
|
|
4839
5020
|
}, []);
|
|
4840
5021
|
return /* @__PURE__ */ jsxs29("fieldset", { children: [
|
|
4841
|
-
/* @__PURE__ */
|
|
4842
|
-
/* @__PURE__ */
|
|
4843
|
-
/* @__PURE__ */
|
|
5022
|
+
/* @__PURE__ */ jsx59("span", { css: ObjectSearchFilterContainerLabel, children: queryFilterTitle }),
|
|
5023
|
+
/* @__PURE__ */ jsx59("div", { css: ObjectSearchFilterContainer, children: /* @__PURE__ */ jsxs29(VerticalRhythm4, { children: [
|
|
5024
|
+
/* @__PURE__ */ jsx59(
|
|
4844
5025
|
InputVariables,
|
|
4845
5026
|
{
|
|
4846
5027
|
label: searchInputLabel,
|
|
@@ -4848,7 +5029,7 @@ var QueryFilter = ({
|
|
|
4848
5029
|
onChange: (newQuery) => handleFilterChange({ keyword: newQuery }),
|
|
4849
5030
|
disableInlineMenu: true,
|
|
4850
5031
|
id: "qf_searchText",
|
|
4851
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
5032
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx59(
|
|
4852
5033
|
DebouncedInputKeywordSearch2,
|
|
4853
5034
|
{
|
|
4854
5035
|
id: "qf_searchText",
|
|
@@ -4863,7 +5044,7 @@ var QueryFilter = ({
|
|
|
4863
5044
|
}
|
|
4864
5045
|
),
|
|
4865
5046
|
/* @__PURE__ */ jsxs29("div", { css: ObjectSearchFilterGrid("1fr 100px"), children: [
|
|
4866
|
-
/* @__PURE__ */
|
|
5047
|
+
/* @__PURE__ */ jsx59(
|
|
4867
5048
|
InputVariables,
|
|
4868
5049
|
{
|
|
4869
5050
|
label: contentTypeLabel,
|
|
@@ -4871,7 +5052,7 @@ var QueryFilter = ({
|
|
|
4871
5052
|
value: (_g = queryState.contentType) != null ? _g : "",
|
|
4872
5053
|
onChange: (newType) => handleFilterChange({ contentType: newType }),
|
|
4873
5054
|
disableInlineMenu: true,
|
|
4874
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
5055
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx59(
|
|
4875
5056
|
InputSelect4,
|
|
4876
5057
|
{
|
|
4877
5058
|
id: "qf_contentType",
|
|
@@ -4885,7 +5066,7 @@ var QueryFilter = ({
|
|
|
4885
5066
|
)
|
|
4886
5067
|
}
|
|
4887
5068
|
),
|
|
4888
|
-
/* @__PURE__ */
|
|
5069
|
+
/* @__PURE__ */ jsx59(
|
|
4889
5070
|
InputVariables,
|
|
4890
5071
|
{
|
|
4891
5072
|
label: countLabel,
|
|
@@ -4894,7 +5075,7 @@ var QueryFilter = ({
|
|
|
4894
5075
|
onChange: (newCount) => handleFilterChange({ count: newCount }),
|
|
4895
5076
|
disableInlineMenu: true,
|
|
4896
5077
|
valueToResetTo: "5",
|
|
4897
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
5078
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx59(
|
|
4898
5079
|
Input4,
|
|
4899
5080
|
{
|
|
4900
5081
|
id: "qf_count",
|
|
@@ -4910,7 +5091,7 @@ var QueryFilter = ({
|
|
|
4910
5091
|
)
|
|
4911
5092
|
] }),
|
|
4912
5093
|
/* @__PURE__ */ jsxs29("div", { css: ObjectSearchFilterGrid("2fr 1fr"), children: [
|
|
4913
|
-
/* @__PURE__ */
|
|
5094
|
+
/* @__PURE__ */ jsx59(
|
|
4914
5095
|
InputVariables,
|
|
4915
5096
|
{
|
|
4916
5097
|
id: "qf_sortBy",
|
|
@@ -4918,7 +5099,7 @@ var QueryFilter = ({
|
|
|
4918
5099
|
value: queryState.sortBy,
|
|
4919
5100
|
onChange: (newSortBy) => handleFilterChange({ sortBy: newSortBy }),
|
|
4920
5101
|
disableInlineMenu: true,
|
|
4921
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
5102
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx59(
|
|
4922
5103
|
InputSelect4,
|
|
4923
5104
|
{
|
|
4924
5105
|
label: sortLabel,
|
|
@@ -4932,7 +5113,7 @@ var QueryFilter = ({
|
|
|
4932
5113
|
)
|
|
4933
5114
|
}
|
|
4934
5115
|
),
|
|
4935
|
-
/* @__PURE__ */
|
|
5116
|
+
/* @__PURE__ */ jsx59(
|
|
4936
5117
|
InputVariables,
|
|
4937
5118
|
{
|
|
4938
5119
|
label: sortOrderLabel,
|
|
@@ -4940,7 +5121,7 @@ var QueryFilter = ({
|
|
|
4940
5121
|
value: queryState.sortOrder,
|
|
4941
5122
|
onChange: (newSort) => handleFilterChange({ sortOrder: newSort }),
|
|
4942
5123
|
disableInlineMenu: true,
|
|
4943
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
5124
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx59(
|
|
4944
5125
|
InputSelect4,
|
|
4945
5126
|
{
|
|
4946
5127
|
label: sortOrderLabel,
|
|
@@ -4960,8 +5141,8 @@ var QueryFilter = ({
|
|
|
4960
5141
|
};
|
|
4961
5142
|
|
|
4962
5143
|
// src/components/ParamTypeDynamicDataProvider.tsx
|
|
4963
|
-
import { useEffect as
|
|
4964
|
-
import { jsx as
|
|
5144
|
+
import { useEffect as useEffect16, useMemo as useMemo15, useRef as useRef9 } from "react";
|
|
5145
|
+
import { jsx as jsx60 } from "@emotion/react/jsx-runtime";
|
|
4965
5146
|
function ParamTypeDynamicDataProvider(props) {
|
|
4966
5147
|
const { children } = props;
|
|
4967
5148
|
const {
|
|
@@ -4969,11 +5150,11 @@ function ParamTypeDynamicDataProvider(props) {
|
|
|
4969
5150
|
} = useMeshLocation("paramType");
|
|
4970
5151
|
const dynamicInputsAsVariables = useDynamicInputsAsVariables(dynamicInputs);
|
|
4971
5152
|
const connectedDataAsVariables = useConnectedDataAsVariables(connectedData);
|
|
4972
|
-
const variables =
|
|
5153
|
+
const variables = useMemo15(
|
|
4973
5154
|
() => ({ ...connectedDataAsVariables, ...dynamicInputsAsVariables }),
|
|
4974
5155
|
[dynamicInputsAsVariables, connectedDataAsVariables]
|
|
4975
5156
|
);
|
|
4976
|
-
return /* @__PURE__ */
|
|
5157
|
+
return /* @__PURE__ */ jsx60(VariablesProvider, { value: variables, onChange: () => {
|
|
4977
5158
|
}, editVariableComponent: JsonMeshVariableEditor, children });
|
|
4978
5159
|
}
|
|
4979
5160
|
var JsonMeshVariableEditor = ({
|
|
@@ -4982,9 +5163,9 @@ var JsonMeshVariableEditor = ({
|
|
|
4982
5163
|
variable,
|
|
4983
5164
|
context
|
|
4984
5165
|
}) => {
|
|
4985
|
-
const sillyRef =
|
|
5166
|
+
const sillyRef = useRef9(false);
|
|
4986
5167
|
const { editConnectedData } = useMeshLocation("paramType");
|
|
4987
|
-
|
|
5168
|
+
useEffect16(() => {
|
|
4988
5169
|
if (sillyRef.current) {
|
|
4989
5170
|
return;
|
|
4990
5171
|
}
|
|
@@ -5420,6 +5601,12 @@ var MULTI_SELECT_OPERATORS = [
|
|
|
5420
5601
|
editorType: "multiChoice",
|
|
5421
5602
|
expectedValueType: "array"
|
|
5422
5603
|
},
|
|
5604
|
+
{
|
|
5605
|
+
label: "is all of...",
|
|
5606
|
+
value: "all",
|
|
5607
|
+
editorType: "multiChoice",
|
|
5608
|
+
expectedValueType: "array"
|
|
5609
|
+
},
|
|
5423
5610
|
{
|
|
5424
5611
|
label: "is empty",
|
|
5425
5612
|
value: "ndef",
|
|
@@ -5448,9 +5635,9 @@ var MULTI_SELECT_OPERATORS = [
|
|
|
5448
5635
|
|
|
5449
5636
|
// src/components/SearchAndFilter/editors/DateEditor.tsx
|
|
5450
5637
|
import { Input as Input5 } from "@uniformdev/design-system";
|
|
5451
|
-
import { useState as
|
|
5638
|
+
import { useState as useState16 } from "react";
|
|
5452
5639
|
import { useDebounce as useDebounce2 } from "react-use";
|
|
5453
|
-
import { jsx as
|
|
5640
|
+
import { jsx as jsx61 } from "@emotion/react/jsx-runtime";
|
|
5454
5641
|
var DateEditor = ({
|
|
5455
5642
|
onChange,
|
|
5456
5643
|
ariaLabel,
|
|
@@ -5459,9 +5646,9 @@ var DateEditor = ({
|
|
|
5459
5646
|
readOnly,
|
|
5460
5647
|
valueTestId
|
|
5461
5648
|
}) => {
|
|
5462
|
-
const [innerValue, setInnerValue] =
|
|
5649
|
+
const [innerValue, setInnerValue] = useState16(value != null ? value : "");
|
|
5463
5650
|
useDebounce2(() => onChange(innerValue), 500, [innerValue]);
|
|
5464
|
-
return /* @__PURE__ */
|
|
5651
|
+
return /* @__PURE__ */ jsx61(
|
|
5465
5652
|
Input5,
|
|
5466
5653
|
{
|
|
5467
5654
|
type: "date",
|
|
@@ -5478,21 +5665,21 @@ var DateEditor = ({
|
|
|
5478
5665
|
|
|
5479
5666
|
// src/components/SearchAndFilter/editors/DateRangeEditor.tsx
|
|
5480
5667
|
import { Input as Input6 } from "@uniformdev/design-system";
|
|
5481
|
-
import { useEffect as
|
|
5668
|
+
import { useEffect as useEffect17, useState as useState17 } from "react";
|
|
5482
5669
|
import { useDebounce as useDebounce3 } from "react-use";
|
|
5483
5670
|
|
|
5484
5671
|
// src/components/SearchAndFilter/editors/shared/ErrorContainer.tsx
|
|
5485
5672
|
import { FieldMessage } from "@uniformdev/design-system";
|
|
5486
|
-
import { jsx as
|
|
5673
|
+
import { jsx as jsx62 } from "@emotion/react/jsx-runtime";
|
|
5487
5674
|
var ErrorContainer = ({ errorMessage }) => {
|
|
5488
|
-
return /* @__PURE__ */
|
|
5675
|
+
return /* @__PURE__ */ jsx62(
|
|
5489
5676
|
"div",
|
|
5490
5677
|
{
|
|
5491
5678
|
css: {
|
|
5492
5679
|
gridColumn: "span 6",
|
|
5493
5680
|
order: 6
|
|
5494
5681
|
},
|
|
5495
|
-
children: /* @__PURE__ */
|
|
5682
|
+
children: /* @__PURE__ */ jsx62(FieldMessage, { errorMessage })
|
|
5496
5683
|
}
|
|
5497
5684
|
);
|
|
5498
5685
|
};
|
|
@@ -5505,7 +5692,7 @@ var twoColumnGrid = {
|
|
|
5505
5692
|
};
|
|
5506
5693
|
|
|
5507
5694
|
// src/components/SearchAndFilter/editors/DateRangeEditor.tsx
|
|
5508
|
-
import { Fragment as
|
|
5695
|
+
import { Fragment as Fragment12, jsx as jsx63, jsxs as jsxs30 } from "@emotion/react/jsx-runtime";
|
|
5509
5696
|
var DateRangeEditor = ({
|
|
5510
5697
|
ariaLabel,
|
|
5511
5698
|
onChange,
|
|
@@ -5514,9 +5701,9 @@ var DateRangeEditor = ({
|
|
|
5514
5701
|
readOnly,
|
|
5515
5702
|
valueTestId
|
|
5516
5703
|
}) => {
|
|
5517
|
-
const [minDateValue, setMinDateValue] =
|
|
5518
|
-
const [maxDateValue, setMaxDateValue] =
|
|
5519
|
-
const [error, setError] =
|
|
5704
|
+
const [minDateValue, setMinDateValue] = useState17(value ? value[0] : "");
|
|
5705
|
+
const [maxDateValue, setMaxDateValue] = useState17(value ? value[1] : "");
|
|
5706
|
+
const [error, setError] = useState17("");
|
|
5520
5707
|
useDebounce3(
|
|
5521
5708
|
() => {
|
|
5522
5709
|
if (minDateValue && maxDateValue && !error) {
|
|
@@ -5528,7 +5715,7 @@ var DateRangeEditor = ({
|
|
|
5528
5715
|
500,
|
|
5529
5716
|
[minDateValue, maxDateValue]
|
|
5530
5717
|
);
|
|
5531
|
-
|
|
5718
|
+
useEffect17(() => {
|
|
5532
5719
|
if (!minDateValue || !maxDateValue) {
|
|
5533
5720
|
return;
|
|
5534
5721
|
}
|
|
@@ -5563,9 +5750,9 @@ var DateRangeEditor = ({
|
|
|
5563
5750
|
setMaxDateValue("");
|
|
5564
5751
|
}
|
|
5565
5752
|
}, [minDateValue, maxDateValue, setError]);
|
|
5566
|
-
return /* @__PURE__ */ jsxs30(
|
|
5753
|
+
return /* @__PURE__ */ jsxs30(Fragment12, { children: [
|
|
5567
5754
|
/* @__PURE__ */ jsxs30("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
5568
|
-
/* @__PURE__ */
|
|
5755
|
+
/* @__PURE__ */ jsx63(
|
|
5569
5756
|
Input6,
|
|
5570
5757
|
{
|
|
5571
5758
|
label: `${ariaLabel}-min-date`,
|
|
@@ -5579,7 +5766,7 @@ var DateRangeEditor = ({
|
|
|
5579
5766
|
"data-testid": "value-low"
|
|
5580
5767
|
}
|
|
5581
5768
|
),
|
|
5582
|
-
/* @__PURE__ */
|
|
5769
|
+
/* @__PURE__ */ jsx63(
|
|
5583
5770
|
Input6,
|
|
5584
5771
|
{
|
|
5585
5772
|
label: `${ariaLabel}-max-date`,
|
|
@@ -5594,7 +5781,7 @@ var DateRangeEditor = ({
|
|
|
5594
5781
|
}
|
|
5595
5782
|
)
|
|
5596
5783
|
] }),
|
|
5597
|
-
/* @__PURE__ */
|
|
5784
|
+
/* @__PURE__ */ jsx63(ErrorContainer, { errorMessage: error })
|
|
5598
5785
|
] });
|
|
5599
5786
|
};
|
|
5600
5787
|
|
|
@@ -5604,7 +5791,7 @@ import {
|
|
|
5604
5791
|
getComboBoxSelectedSelectableGroups,
|
|
5605
5792
|
InputComboBox
|
|
5606
5793
|
} from "@uniformdev/design-system";
|
|
5607
|
-
import { useMemo as
|
|
5794
|
+
import { useMemo as useMemo16 } from "react";
|
|
5608
5795
|
|
|
5609
5796
|
// src/components/SearchAndFilter/editors/shared/readOnlyAttributes.tsx
|
|
5610
5797
|
var readOnlyAttributes = {
|
|
@@ -5614,7 +5801,7 @@ var readOnlyAttributes = {
|
|
|
5614
5801
|
};
|
|
5615
5802
|
|
|
5616
5803
|
// src/components/SearchAndFilter/editors/FilterMultiChoiceEditor.tsx
|
|
5617
|
-
import { jsx as
|
|
5804
|
+
import { jsx as jsx64 } from "@emotion/react/jsx-runtime";
|
|
5618
5805
|
var FilterMultiChoiceEditor = ({
|
|
5619
5806
|
value,
|
|
5620
5807
|
options,
|
|
@@ -5625,11 +5812,11 @@ var FilterMultiChoiceEditor = ({
|
|
|
5625
5812
|
}) => {
|
|
5626
5813
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
5627
5814
|
const isClearable = !readOnly || !disabled;
|
|
5628
|
-
const { groupedOptions, selectedOptions } =
|
|
5815
|
+
const { groupedOptions, selectedOptions } = useMemo16(
|
|
5629
5816
|
() => convertComboBoxGroupsToSelectableGroups({ options: options != null ? options : [], selectedItems: new Set(value) }),
|
|
5630
5817
|
[options, value]
|
|
5631
5818
|
);
|
|
5632
|
-
return /* @__PURE__ */
|
|
5819
|
+
return /* @__PURE__ */ jsx64("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx64(
|
|
5633
5820
|
InputComboBox,
|
|
5634
5821
|
{
|
|
5635
5822
|
...props,
|
|
@@ -5662,8 +5849,8 @@ import {
|
|
|
5662
5849
|
convertComboBoxGroupsToSelectableGroups as convertComboBoxGroupsToSelectableGroups2,
|
|
5663
5850
|
InputComboBox as InputComboBox2
|
|
5664
5851
|
} from "@uniformdev/design-system";
|
|
5665
|
-
import { useMemo as
|
|
5666
|
-
import { jsx as
|
|
5852
|
+
import { useMemo as useMemo17 } from "react";
|
|
5853
|
+
import { jsx as jsx65 } from "@emotion/react/jsx-runtime";
|
|
5667
5854
|
var FilterSingleChoiceEditor = ({
|
|
5668
5855
|
options,
|
|
5669
5856
|
value,
|
|
@@ -5673,7 +5860,7 @@ var FilterSingleChoiceEditor = ({
|
|
|
5673
5860
|
valueTestId
|
|
5674
5861
|
}) => {
|
|
5675
5862
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
5676
|
-
const { groupedOptions, selectedOptions } =
|
|
5863
|
+
const { groupedOptions, selectedOptions } = useMemo17(
|
|
5677
5864
|
() => convertComboBoxGroupsToSelectableGroups2({
|
|
5678
5865
|
options: options != null ? options : [],
|
|
5679
5866
|
selectedItems: new Set(value ? [String(value)] : void 0),
|
|
@@ -5681,7 +5868,7 @@ var FilterSingleChoiceEditor = ({
|
|
|
5681
5868
|
}),
|
|
5682
5869
|
[options, value]
|
|
5683
5870
|
);
|
|
5684
|
-
return /* @__PURE__ */
|
|
5871
|
+
return /* @__PURE__ */ jsx65("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx65(
|
|
5685
5872
|
InputComboBox2,
|
|
5686
5873
|
{
|
|
5687
5874
|
placeholder: "Type to search...",
|
|
@@ -5711,9 +5898,9 @@ var FilterSingleChoiceEditor = ({
|
|
|
5711
5898
|
|
|
5712
5899
|
// src/components/SearchAndFilter/editors/NumberEditor.tsx
|
|
5713
5900
|
import { Input as Input7 } from "@uniformdev/design-system";
|
|
5714
|
-
import { useState as
|
|
5901
|
+
import { useState as useState18 } from "react";
|
|
5715
5902
|
import { useDebounce as useDebounce4 } from "react-use";
|
|
5716
|
-
import { jsx as
|
|
5903
|
+
import { jsx as jsx66 } from "@emotion/react/jsx-runtime";
|
|
5717
5904
|
var NumberEditor = ({
|
|
5718
5905
|
ariaLabel,
|
|
5719
5906
|
onChange,
|
|
@@ -5722,9 +5909,9 @@ var NumberEditor = ({
|
|
|
5722
5909
|
readOnly,
|
|
5723
5910
|
valueTestId
|
|
5724
5911
|
}) => {
|
|
5725
|
-
const [innerValue, setInnerValue] =
|
|
5912
|
+
const [innerValue, setInnerValue] = useState18(value != null ? value : "");
|
|
5726
5913
|
useDebounce4(() => onChange(innerValue), 500, [innerValue]);
|
|
5727
|
-
return /* @__PURE__ */
|
|
5914
|
+
return /* @__PURE__ */ jsx66(
|
|
5728
5915
|
Input7,
|
|
5729
5916
|
{
|
|
5730
5917
|
label: ariaLabel,
|
|
@@ -5742,9 +5929,9 @@ var NumberEditor = ({
|
|
|
5742
5929
|
|
|
5743
5930
|
// src/components/SearchAndFilter/editors/NumberRangeEditor.tsx
|
|
5744
5931
|
import { Input as Input8 } from "@uniformdev/design-system";
|
|
5745
|
-
import { useEffect as
|
|
5932
|
+
import { useEffect as useEffect18, useState as useState19 } from "react";
|
|
5746
5933
|
import { useDebounce as useDebounce5 } from "react-use";
|
|
5747
|
-
import { Fragment as
|
|
5934
|
+
import { Fragment as Fragment13, jsx as jsx67, jsxs as jsxs31 } from "@emotion/react/jsx-runtime";
|
|
5748
5935
|
var NumberRangeEditor = ({
|
|
5749
5936
|
onChange,
|
|
5750
5937
|
disabled,
|
|
@@ -5753,9 +5940,9 @@ var NumberRangeEditor = ({
|
|
|
5753
5940
|
readOnly,
|
|
5754
5941
|
valueTestId
|
|
5755
5942
|
}) => {
|
|
5756
|
-
const [minValue, setMinValue] =
|
|
5757
|
-
const [maxValue, setMaxValue] =
|
|
5758
|
-
const [error, setError] =
|
|
5943
|
+
const [minValue, setMinValue] = useState19("");
|
|
5944
|
+
const [maxValue, setMaxValue] = useState19("");
|
|
5945
|
+
const [error, setError] = useState19("");
|
|
5759
5946
|
useDebounce5(
|
|
5760
5947
|
() => {
|
|
5761
5948
|
if (minValue && maxValue && !error) {
|
|
@@ -5767,7 +5954,7 @@ var NumberRangeEditor = ({
|
|
|
5767
5954
|
500,
|
|
5768
5955
|
[minValue, maxValue]
|
|
5769
5956
|
);
|
|
5770
|
-
|
|
5957
|
+
useEffect18(() => {
|
|
5771
5958
|
if (!maxValue && !minValue) {
|
|
5772
5959
|
return;
|
|
5773
5960
|
}
|
|
@@ -5789,9 +5976,9 @@ var NumberRangeEditor = ({
|
|
|
5789
5976
|
setMaxValue(maxValue);
|
|
5790
5977
|
}
|
|
5791
5978
|
}, [maxValue, minValue, setError]);
|
|
5792
|
-
return /* @__PURE__ */ jsxs31(
|
|
5979
|
+
return /* @__PURE__ */ jsxs31(Fragment13, { children: [
|
|
5793
5980
|
/* @__PURE__ */ jsxs31("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
5794
|
-
/* @__PURE__ */
|
|
5981
|
+
/* @__PURE__ */ jsx67(
|
|
5795
5982
|
Input8,
|
|
5796
5983
|
{
|
|
5797
5984
|
label: `${ariaLabel}-min`,
|
|
@@ -5807,7 +5994,7 @@ var NumberRangeEditor = ({
|
|
|
5807
5994
|
"data-testid": "value-low"
|
|
5808
5995
|
}
|
|
5809
5996
|
),
|
|
5810
|
-
/* @__PURE__ */
|
|
5997
|
+
/* @__PURE__ */ jsx67(
|
|
5811
5998
|
Input8,
|
|
5812
5999
|
{
|
|
5813
6000
|
type: "number",
|
|
@@ -5824,7 +6011,7 @@ var NumberRangeEditor = ({
|
|
|
5824
6011
|
}
|
|
5825
6012
|
)
|
|
5826
6013
|
] }),
|
|
5827
|
-
/* @__PURE__ */
|
|
6014
|
+
/* @__PURE__ */ jsx67(ErrorContainer, { errorMessage: error })
|
|
5828
6015
|
] });
|
|
5829
6016
|
};
|
|
5830
6017
|
|
|
@@ -5834,13 +6021,13 @@ import {
|
|
|
5834
6021
|
getComboBoxSelectedSelectableGroups as getComboBoxSelectedSelectableGroups2,
|
|
5835
6022
|
InputComboBox as InputComboBox3
|
|
5836
6023
|
} from "@uniformdev/design-system";
|
|
5837
|
-
import { useMemo as
|
|
6024
|
+
import { useMemo as useMemo18 } from "react";
|
|
5838
6025
|
|
|
5839
6026
|
// src/components/SearchAndFilter/editors/shared/CustomOptions.tsx
|
|
5840
6027
|
import { StatusBullet } from "@uniformdev/design-system";
|
|
5841
|
-
import { jsx as
|
|
6028
|
+
import { jsx as jsx68 } from "@emotion/react/jsx-runtime";
|
|
5842
6029
|
var CustomOptions = ({ label, value }) => {
|
|
5843
|
-
return /* @__PURE__ */
|
|
6030
|
+
return /* @__PURE__ */ jsx68(
|
|
5844
6031
|
StatusBullet,
|
|
5845
6032
|
{
|
|
5846
6033
|
status: label,
|
|
@@ -5850,7 +6037,7 @@ var CustomOptions = ({ label, value }) => {
|
|
|
5850
6037
|
};
|
|
5851
6038
|
|
|
5852
6039
|
// src/components/SearchAndFilter/editors/StatusMultiEditor.tsx
|
|
5853
|
-
import { jsx as
|
|
6040
|
+
import { jsx as jsx69 } from "@emotion/react/jsx-runtime";
|
|
5854
6041
|
var StatusMultiEditor = ({
|
|
5855
6042
|
options,
|
|
5856
6043
|
value,
|
|
@@ -5860,11 +6047,11 @@ var StatusMultiEditor = ({
|
|
|
5860
6047
|
valueTestId
|
|
5861
6048
|
}) => {
|
|
5862
6049
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
5863
|
-
const { groupedOptions, selectedOptions } =
|
|
6050
|
+
const { groupedOptions, selectedOptions } = useMemo18(
|
|
5864
6051
|
() => convertComboBoxGroupsToSelectableGroups3({ options: options != null ? options : [], selectedItems: new Set(value) }),
|
|
5865
6052
|
[options, value]
|
|
5866
6053
|
);
|
|
5867
|
-
return /* @__PURE__ */
|
|
6054
|
+
return /* @__PURE__ */ jsx69("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx69(
|
|
5868
6055
|
InputComboBox3,
|
|
5869
6056
|
{
|
|
5870
6057
|
options: groupedOptions != null ? groupedOptions : [],
|
|
@@ -5895,8 +6082,8 @@ import {
|
|
|
5895
6082
|
convertComboBoxGroupsToSelectableGroups as convertComboBoxGroupsToSelectableGroups4,
|
|
5896
6083
|
InputComboBox as InputComboBox4
|
|
5897
6084
|
} from "@uniformdev/design-system";
|
|
5898
|
-
import { useMemo as
|
|
5899
|
-
import { jsx as
|
|
6085
|
+
import { useMemo as useMemo19 } from "react";
|
|
6086
|
+
import { jsx as jsx70 } from "@emotion/react/jsx-runtime";
|
|
5900
6087
|
var StatusSingleEditor = ({
|
|
5901
6088
|
options,
|
|
5902
6089
|
value,
|
|
@@ -5906,7 +6093,7 @@ var StatusSingleEditor = ({
|
|
|
5906
6093
|
valueTestId
|
|
5907
6094
|
}) => {
|
|
5908
6095
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
5909
|
-
const { groupedOptions, selectedOptions } =
|
|
6096
|
+
const { groupedOptions, selectedOptions } = useMemo19(
|
|
5910
6097
|
() => convertComboBoxGroupsToSelectableGroups4({
|
|
5911
6098
|
options: options != null ? options : [],
|
|
5912
6099
|
selectedItems: new Set(value ? [value] : void 0),
|
|
@@ -5914,7 +6101,7 @@ var StatusSingleEditor = ({
|
|
|
5914
6101
|
}),
|
|
5915
6102
|
[options, value]
|
|
5916
6103
|
);
|
|
5917
|
-
return /* @__PURE__ */
|
|
6104
|
+
return /* @__PURE__ */ jsx70("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx70(
|
|
5918
6105
|
InputComboBox4,
|
|
5919
6106
|
{
|
|
5920
6107
|
options: groupedOptions,
|
|
@@ -5943,9 +6130,9 @@ var StatusSingleEditor = ({
|
|
|
5943
6130
|
|
|
5944
6131
|
// src/components/SearchAndFilter/editors/TextEditor.tsx
|
|
5945
6132
|
import { Input as Input9 } from "@uniformdev/design-system";
|
|
5946
|
-
import { useState as
|
|
6133
|
+
import { useState as useState20 } from "react";
|
|
5947
6134
|
import { useDebounce as useDebounce6 } from "react-use";
|
|
5948
|
-
import { jsx as
|
|
6135
|
+
import { jsx as jsx71 } from "@emotion/react/jsx-runtime";
|
|
5949
6136
|
var TextEditor = ({
|
|
5950
6137
|
onChange,
|
|
5951
6138
|
ariaLabel,
|
|
@@ -5953,9 +6140,9 @@ var TextEditor = ({
|
|
|
5953
6140
|
readOnly,
|
|
5954
6141
|
valueTestId
|
|
5955
6142
|
}) => {
|
|
5956
|
-
const [innerValue, setInnerValue] =
|
|
6143
|
+
const [innerValue, setInnerValue] = useState20(value != null ? value : "");
|
|
5957
6144
|
useDebounce6(() => onChange(innerValue), 500, [innerValue]);
|
|
5958
|
-
return /* @__PURE__ */
|
|
6145
|
+
return /* @__PURE__ */ jsx71(
|
|
5959
6146
|
Input9,
|
|
5960
6147
|
{
|
|
5961
6148
|
showLabel: false,
|
|
@@ -5975,8 +6162,8 @@ import {
|
|
|
5975
6162
|
getComboBoxSelectedSelectableGroups as getComboBoxSelectedSelectableGroups3,
|
|
5976
6163
|
InputCreatableComboBox
|
|
5977
6164
|
} from "@uniformdev/design-system";
|
|
5978
|
-
import { useMemo as
|
|
5979
|
-
import { jsx as
|
|
6165
|
+
import { useMemo as useMemo20 } from "react";
|
|
6166
|
+
import { jsx as jsx72 } from "@emotion/react/jsx-runtime";
|
|
5980
6167
|
var TextMultiChoiceEditor = ({
|
|
5981
6168
|
value,
|
|
5982
6169
|
disabled,
|
|
@@ -5986,13 +6173,13 @@ var TextMultiChoiceEditor = ({
|
|
|
5986
6173
|
}) => {
|
|
5987
6174
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
5988
6175
|
const isClearable = !readOnly || !disabled;
|
|
5989
|
-
const { groupedOptions, selectedOptions } =
|
|
6176
|
+
const { groupedOptions, selectedOptions } = useMemo20(() => {
|
|
5990
6177
|
var _a;
|
|
5991
6178
|
const coercedValue = typeof value === "string" ? [value] : value != null ? value : [];
|
|
5992
6179
|
const options = (_a = coercedValue.map((v) => ({ label: v, value: v }))) != null ? _a : [];
|
|
5993
6180
|
return convertComboBoxGroupsToSelectableGroups5({ options, selectedItems: new Set(value) });
|
|
5994
6181
|
}, [value]);
|
|
5995
|
-
return /* @__PURE__ */
|
|
6182
|
+
return /* @__PURE__ */ jsx72("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx72(
|
|
5996
6183
|
InputCreatableComboBox,
|
|
5997
6184
|
{
|
|
5998
6185
|
...props,
|
|
@@ -6283,7 +6470,7 @@ var SearchAndFilterAdditionalContainer = css21`
|
|
|
6283
6470
|
`;
|
|
6284
6471
|
|
|
6285
6472
|
// src/components/SearchAndFilter/FilterButton.tsx
|
|
6286
|
-
import { jsx as
|
|
6473
|
+
import { jsx as jsx73, jsxs as jsxs32 } from "@emotion/react/jsx-runtime";
|
|
6287
6474
|
var FilterButton2 = ({
|
|
6288
6475
|
text = "Filters",
|
|
6289
6476
|
icon = customIcons["filter-add"],
|
|
@@ -6305,10 +6492,10 @@ var FilterButton2 = ({
|
|
|
6305
6492
|
...props,
|
|
6306
6493
|
"data-testid": dataTestId,
|
|
6307
6494
|
children: [
|
|
6308
|
-
/* @__PURE__ */
|
|
6309
|
-
/* @__PURE__ */
|
|
6310
|
-
filterCount ? /* @__PURE__ */
|
|
6311
|
-
showDropdownIcon ? /* @__PURE__ */
|
|
6495
|
+
/* @__PURE__ */ jsx73(Icon2, { icon, iconColor: "currentColor", size: "1rem" }),
|
|
6496
|
+
/* @__PURE__ */ jsx73("span", { css: FilterButtonText, children: text }),
|
|
6497
|
+
filterCount ? /* @__PURE__ */ jsx73(Counter2, { count: filterCount, bgColor: "var(--white)" }) : null,
|
|
6498
|
+
showDropdownIcon ? /* @__PURE__ */ jsx73(Icon2, { icon: "chevron-down", iconColor: "currentColor", size: "1rem" }) : null
|
|
6312
6499
|
]
|
|
6313
6500
|
}
|
|
6314
6501
|
);
|
|
@@ -6319,31 +6506,31 @@ import { CgClose } from "@react-icons/all-files/cg/CgClose";
|
|
|
6319
6506
|
import { hasReferencedVariables as hasReferencedVariables2 } from "@uniformdev/canvas";
|
|
6320
6507
|
import { Icon as Icon3, InputKeywordSearch } from "@uniformdev/design-system";
|
|
6321
6508
|
import { CLEAR_EDITOR_COMMAND as CLEAR_EDITOR_COMMAND2 } from "lexical";
|
|
6322
|
-
import { useEffect as
|
|
6509
|
+
import { useEffect as useEffect20, useRef as useRef10, useState as useState22 } from "react";
|
|
6323
6510
|
import { useDebounce as useDebounce7 } from "react-use";
|
|
6324
6511
|
import { v4 as v42 } from "uuid";
|
|
6325
6512
|
|
|
6326
6513
|
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
6327
6514
|
import { VerticalRhythm as VerticalRhythm5 } from "@uniformdev/design-system";
|
|
6328
6515
|
import {
|
|
6329
|
-
createContext as
|
|
6330
|
-
useCallback as
|
|
6331
|
-
useContext as
|
|
6516
|
+
createContext as createContext7,
|
|
6517
|
+
useCallback as useCallback7,
|
|
6518
|
+
useContext as useContext7,
|
|
6332
6519
|
useDeferredValue as useDeferredValue2,
|
|
6333
|
-
useEffect as
|
|
6334
|
-
useMemo as
|
|
6335
|
-
useState as
|
|
6520
|
+
useEffect as useEffect19,
|
|
6521
|
+
useMemo as useMemo21,
|
|
6522
|
+
useState as useState21
|
|
6336
6523
|
} from "react";
|
|
6337
6524
|
|
|
6338
6525
|
// src/components/SearchAndFilter/FilterEditor.tsx
|
|
6339
|
-
import { jsx as
|
|
6526
|
+
import { jsx as jsx74 } from "@emotion/react/jsx-runtime";
|
|
6340
6527
|
var FilterEditorRenderer = ({ editorType, ...props }) => {
|
|
6341
6528
|
const { filterMapper: contextFilterMapper } = useSearchAndFilter();
|
|
6342
6529
|
const Editor = contextFilterMapper == null ? void 0 : contextFilterMapper[editorType];
|
|
6343
6530
|
if (!Editor || editorType === "empty") {
|
|
6344
|
-
return /* @__PURE__ */
|
|
6531
|
+
return /* @__PURE__ */ jsx74("span", {});
|
|
6345
6532
|
}
|
|
6346
|
-
return /* @__PURE__ */
|
|
6533
|
+
return /* @__PURE__ */ jsx74(Editor, { ...props });
|
|
6347
6534
|
};
|
|
6348
6535
|
var filterMapper = {
|
|
6349
6536
|
multiChoice: FilterMultiChoiceEditor,
|
|
@@ -6361,9 +6548,9 @@ var filterMapper = {
|
|
|
6361
6548
|
function withInputVariables(WrappedComponent, noSwapping = false) {
|
|
6362
6549
|
const WithInputVariables = (props) => {
|
|
6363
6550
|
if (Array.isArray(props.value) || !props.bindable || props.disabled || props.readOnly) {
|
|
6364
|
-
return /* @__PURE__ */
|
|
6551
|
+
return /* @__PURE__ */ jsx74(WrappedComponent, { ...props });
|
|
6365
6552
|
}
|
|
6366
|
-
return /* @__PURE__ */
|
|
6553
|
+
return /* @__PURE__ */ jsx74(
|
|
6367
6554
|
InputVariables,
|
|
6368
6555
|
{
|
|
6369
6556
|
"data-testid": "filter-value",
|
|
@@ -6372,7 +6559,7 @@ function withInputVariables(WrappedComponent, noSwapping = false) {
|
|
|
6372
6559
|
onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
|
|
6373
6560
|
value: props.value,
|
|
6374
6561
|
disabled: props.disabled,
|
|
6375
|
-
inputWhenNoVariables: noSwapping ? void 0 : /* @__PURE__ */
|
|
6562
|
+
inputWhenNoVariables: noSwapping ? void 0 : /* @__PURE__ */ jsx74(WrappedComponent, { ...props })
|
|
6376
6563
|
}
|
|
6377
6564
|
);
|
|
6378
6565
|
};
|
|
@@ -6382,9 +6569,9 @@ function withInputVariablesForMultiValue(WrappedComponent) {
|
|
|
6382
6569
|
const WithInputVariables = (props) => {
|
|
6383
6570
|
var _a;
|
|
6384
6571
|
if (!props.bindable || props.disabled || props.readOnly) {
|
|
6385
|
-
return /* @__PURE__ */
|
|
6572
|
+
return /* @__PURE__ */ jsx74(WrappedComponent, { ...props });
|
|
6386
6573
|
}
|
|
6387
|
-
return /* @__PURE__ */
|
|
6574
|
+
return /* @__PURE__ */ jsx74(
|
|
6388
6575
|
InputVariables,
|
|
6389
6576
|
{
|
|
6390
6577
|
"data-testid": "filter-value",
|
|
@@ -6392,7 +6579,7 @@ function withInputVariablesForMultiValue(WrappedComponent) {
|
|
|
6392
6579
|
showMenuPosition: "inline-right",
|
|
6393
6580
|
onChange: (newValue) => props.onChange(newValue ? [newValue] : []),
|
|
6394
6581
|
value: (_a = props.value) == null ? void 0 : _a[0],
|
|
6395
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
6582
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx74(WrappedComponent, { ...props })
|
|
6396
6583
|
}
|
|
6397
6584
|
);
|
|
6398
6585
|
};
|
|
@@ -6408,8 +6595,8 @@ var bindableFiltersMapper = {
|
|
|
6408
6595
|
};
|
|
6409
6596
|
|
|
6410
6597
|
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
6411
|
-
import { jsx as
|
|
6412
|
-
var SearchAndFilterContext =
|
|
6598
|
+
import { jsx as jsx75 } from "@emotion/react/jsx-runtime";
|
|
6599
|
+
var SearchAndFilterContext = createContext7({
|
|
6413
6600
|
searchTerm: "",
|
|
6414
6601
|
setSearchTerm: () => {
|
|
6415
6602
|
},
|
|
@@ -6429,6 +6616,7 @@ var SearchAndFilterContext = createContext6({
|
|
|
6429
6616
|
validFilterQuery: [],
|
|
6430
6617
|
filterMapper: {},
|
|
6431
6618
|
totalResults: 0,
|
|
6619
|
+
isLoading: false,
|
|
6432
6620
|
allowBindingSearchTerm: false
|
|
6433
6621
|
});
|
|
6434
6622
|
var SearchAndFilterProvider = ({
|
|
@@ -6442,21 +6630,22 @@ var SearchAndFilterProvider = ({
|
|
|
6442
6630
|
resetFilterValues = [{ field: "", operator: "", value: "" }],
|
|
6443
6631
|
onResetFilterValues,
|
|
6444
6632
|
totalResults,
|
|
6633
|
+
isLoading,
|
|
6445
6634
|
filterMapper: filterMapper2 = filterMapper,
|
|
6446
6635
|
children,
|
|
6447
6636
|
allowBindingSearchTerm
|
|
6448
6637
|
}) => {
|
|
6449
|
-
const [searchTerm, setSearchTerm] =
|
|
6638
|
+
const [searchTerm, setSearchTerm] = useState21(defaultSearchTerm);
|
|
6450
6639
|
const deferredSearchTerm = useDeferredValue2(searchTerm);
|
|
6451
|
-
const [filterVisibility, setFilterVisibility] =
|
|
6452
|
-
const handleSearchTerm =
|
|
6640
|
+
const [filterVisibility, setFilterVisibility] = useState21(alwaysVisible || filterVisible);
|
|
6641
|
+
const handleSearchTerm = useCallback7(
|
|
6453
6642
|
(term) => {
|
|
6454
6643
|
setSearchTerm(term);
|
|
6455
6644
|
onSearchChange == null ? void 0 : onSearchChange(term);
|
|
6456
6645
|
},
|
|
6457
6646
|
[setSearchTerm, onSearchChange]
|
|
6458
6647
|
);
|
|
6459
|
-
const handleToggleFilterVisibility =
|
|
6648
|
+
const handleToggleFilterVisibility = useCallback7(
|
|
6460
6649
|
(visible) => {
|
|
6461
6650
|
if (alwaysVisible) {
|
|
6462
6651
|
return;
|
|
@@ -6465,30 +6654,31 @@ var SearchAndFilterProvider = ({
|
|
|
6465
6654
|
},
|
|
6466
6655
|
[alwaysVisible]
|
|
6467
6656
|
);
|
|
6468
|
-
const handleAddFilter =
|
|
6657
|
+
const handleAddFilter = useCallback7(() => {
|
|
6469
6658
|
onChange([...filters, { field: "", operator: "", value: "" }]);
|
|
6470
6659
|
}, [filters, onChange]);
|
|
6471
|
-
const handleResetFilters =
|
|
6660
|
+
const handleResetFilters = useCallback7(() => {
|
|
6661
|
+
setSearchTerm("");
|
|
6472
6662
|
if (onResetFilterValues) {
|
|
6473
6663
|
return onResetFilterValues();
|
|
6474
6664
|
}
|
|
6475
6665
|
onSearchChange == null ? void 0 : onSearchChange("");
|
|
6476
6666
|
onChange(resetFilterValues);
|
|
6477
6667
|
}, [onChange, resetFilterValues, onSearchChange, onResetFilterValues]);
|
|
6478
|
-
const handleDeleteFilter =
|
|
6668
|
+
const handleDeleteFilter = useCallback7(
|
|
6479
6669
|
(index) => {
|
|
6480
6670
|
const remainingFilters = filters.filter((_, i) => i !== index);
|
|
6481
6671
|
onChange(remainingFilters);
|
|
6482
6672
|
},
|
|
6483
6673
|
[filters, onChange]
|
|
6484
6674
|
);
|
|
6485
|
-
const validFilterQuery =
|
|
6675
|
+
const validFilterQuery = useMemo21(() => {
|
|
6486
6676
|
const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
|
|
6487
6677
|
if (hasValidFilters) {
|
|
6488
6678
|
return filters;
|
|
6489
6679
|
}
|
|
6490
6680
|
}, [filters]);
|
|
6491
|
-
|
|
6681
|
+
useEffect19(() => {
|
|
6492
6682
|
if (filterVisibility) {
|
|
6493
6683
|
const handleEscKeyFilterClose = (e) => {
|
|
6494
6684
|
if (e.key === "Escape") {
|
|
@@ -6501,7 +6691,7 @@ var SearchAndFilterProvider = ({
|
|
|
6501
6691
|
};
|
|
6502
6692
|
}
|
|
6503
6693
|
}, [filterVisibility, handleToggleFilterVisibility]);
|
|
6504
|
-
return /* @__PURE__ */
|
|
6694
|
+
return /* @__PURE__ */ jsx75(
|
|
6505
6695
|
SearchAndFilterContext.Provider,
|
|
6506
6696
|
{
|
|
6507
6697
|
value: {
|
|
@@ -6517,20 +6707,21 @@ var SearchAndFilterProvider = ({
|
|
|
6517
6707
|
filterOptions,
|
|
6518
6708
|
validFilterQuery,
|
|
6519
6709
|
totalResults,
|
|
6710
|
+
isLoading,
|
|
6520
6711
|
filterMapper: filterMapper2,
|
|
6521
6712
|
allowBindingSearchTerm
|
|
6522
6713
|
},
|
|
6523
|
-
children: /* @__PURE__ */
|
|
6714
|
+
children: /* @__PURE__ */ jsx75(VerticalRhythm5, { children })
|
|
6524
6715
|
}
|
|
6525
6716
|
);
|
|
6526
6717
|
};
|
|
6527
6718
|
var useSearchAndFilter = () => {
|
|
6528
|
-
const value =
|
|
6719
|
+
const value = useContext7(SearchAndFilterContext);
|
|
6529
6720
|
return { ...value };
|
|
6530
6721
|
};
|
|
6531
6722
|
|
|
6532
6723
|
// src/components/SearchAndFilter/FilterControls.tsx
|
|
6533
|
-
import { Fragment as
|
|
6724
|
+
import { Fragment as Fragment14, jsx as jsx76, jsxs as jsxs33 } from "@emotion/react/jsx-runtime";
|
|
6534
6725
|
var FilterControls = ({
|
|
6535
6726
|
children,
|
|
6536
6727
|
hideSearchInput
|
|
@@ -6543,10 +6734,10 @@ var FilterControls = ({
|
|
|
6543
6734
|
searchTerm,
|
|
6544
6735
|
allowBindingSearchTerm
|
|
6545
6736
|
} = useSearchAndFilter();
|
|
6546
|
-
const editorRef =
|
|
6737
|
+
const editorRef = useRef10(null);
|
|
6547
6738
|
const variableRefernceCountInSearchTerm = hasReferencedVariables2(searchTerm);
|
|
6548
|
-
const [idToResetInputVariables, setIdToResetInputVariables] =
|
|
6549
|
-
const [localSearchTerm, setLocalSearchTerm] =
|
|
6739
|
+
const [idToResetInputVariables, setIdToResetInputVariables] = useState22("data-resource-search-term-input");
|
|
6740
|
+
const [localSearchTerm, setLocalSearchTerm] = useState22(searchTerm);
|
|
6550
6741
|
useDebounce7(
|
|
6551
6742
|
() => {
|
|
6552
6743
|
setSearchTerm(localSearchTerm);
|
|
@@ -6554,14 +6745,14 @@ var FilterControls = ({
|
|
|
6554
6745
|
300,
|
|
6555
6746
|
[localSearchTerm]
|
|
6556
6747
|
);
|
|
6557
|
-
|
|
6748
|
+
useEffect20(() => {
|
|
6558
6749
|
if (searchTerm === "") {
|
|
6559
6750
|
setLocalSearchTerm("");
|
|
6560
6751
|
setIdToResetInputVariables(`data-resource-search-term-input-${v42()}`);
|
|
6561
6752
|
}
|
|
6562
6753
|
}, [searchTerm]);
|
|
6563
|
-
return /* @__PURE__ */ jsxs33(
|
|
6564
|
-
/* @__PURE__ */
|
|
6754
|
+
return /* @__PURE__ */ jsxs33(Fragment14, { children: [
|
|
6755
|
+
/* @__PURE__ */ jsx76(
|
|
6565
6756
|
FilterButton2,
|
|
6566
6757
|
{
|
|
6567
6758
|
"aria-controls": "search-and-filter-options",
|
|
@@ -6575,7 +6766,7 @@ var FilterControls = ({
|
|
|
6575
6766
|
}
|
|
6576
6767
|
),
|
|
6577
6768
|
hideSearchInput ? null : /* @__PURE__ */ jsxs33("div", { css: BindableKeywordSearchInputStyles, "data-testid": "search-container", children: [
|
|
6578
|
-
/* @__PURE__ */
|
|
6769
|
+
/* @__PURE__ */ jsx76(
|
|
6579
6770
|
InputVariables,
|
|
6580
6771
|
{
|
|
6581
6772
|
label: "",
|
|
@@ -6585,7 +6776,7 @@ var FilterControls = ({
|
|
|
6585
6776
|
value: localSearchTerm,
|
|
6586
6777
|
onChange: (value) => setLocalSearchTerm(value != null ? value : ""),
|
|
6587
6778
|
disableVariables: !allowBindingSearchTerm,
|
|
6588
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
6779
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx76(
|
|
6589
6780
|
InputKeywordSearch,
|
|
6590
6781
|
{
|
|
6591
6782
|
placeholder: "Search...",
|
|
@@ -6604,7 +6795,7 @@ var FilterControls = ({
|
|
|
6604
6795
|
)
|
|
6605
6796
|
}
|
|
6606
6797
|
),
|
|
6607
|
-
variableRefernceCountInSearchTerm ? /* @__PURE__ */
|
|
6798
|
+
variableRefernceCountInSearchTerm ? /* @__PURE__ */ jsx76("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ jsx76(
|
|
6608
6799
|
"button",
|
|
6609
6800
|
{
|
|
6610
6801
|
css: ClearSearchButtonStyles,
|
|
@@ -6618,7 +6809,7 @@ var FilterControls = ({
|
|
|
6618
6809
|
},
|
|
6619
6810
|
type: "button",
|
|
6620
6811
|
"data-testid": "keyword-search-clear-button",
|
|
6621
|
-
children: /* @__PURE__ */
|
|
6812
|
+
children: /* @__PURE__ */ jsx76(Icon3, { icon: CgClose, iconColor: "red", size: "1rem" })
|
|
6622
6813
|
}
|
|
6623
6814
|
) }) : null
|
|
6624
6815
|
] }),
|
|
@@ -6629,7 +6820,7 @@ var FilterControls = ({
|
|
|
6629
6820
|
// src/components/SearchAndFilter/FilterItem.tsx
|
|
6630
6821
|
import { CgTrash as CgTrash2 } from "@react-icons/all-files/cg/CgTrash";
|
|
6631
6822
|
import { Icon as Icon4, InputComboBox as InputComboBox5 } from "@uniformdev/design-system";
|
|
6632
|
-
import { useMemo as
|
|
6823
|
+
import { useMemo as useMemo22 } from "react";
|
|
6633
6824
|
|
|
6634
6825
|
// src/components/SearchAndFilter/util/isFilterBindable.ts
|
|
6635
6826
|
function isFilterBindable(filter, operator) {
|
|
@@ -6638,7 +6829,7 @@ function isFilterBindable(filter, operator) {
|
|
|
6638
6829
|
}
|
|
6639
6830
|
|
|
6640
6831
|
// src/components/SearchAndFilter/FilterItem.tsx
|
|
6641
|
-
import { jsx as
|
|
6832
|
+
import { jsx as jsx77, jsxs as jsxs34 } from "@emotion/react/jsx-runtime";
|
|
6642
6833
|
var FilterItem = ({
|
|
6643
6834
|
index,
|
|
6644
6835
|
operatorOptions,
|
|
@@ -6656,7 +6847,7 @@ var FilterItem = ({
|
|
|
6656
6847
|
const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
|
|
6657
6848
|
const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
|
|
6658
6849
|
const metaDataPossibleOptions = (_b = (_a = operatorOptions.find((op) => filters[index].operator === op.value)) == null ? void 0 : _a.editorType) != null ? _b : "singleChoice";
|
|
6659
|
-
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } =
|
|
6850
|
+
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = useMemo22(() => {
|
|
6660
6851
|
var _a2;
|
|
6661
6852
|
const currentSelectedFilterGroup = filterOptions.find((item) => {
|
|
6662
6853
|
var _a3;
|
|
@@ -6687,9 +6878,9 @@ var FilterItem = ({
|
|
|
6687
6878
|
const CustomLeftHandComponent = selectedFieldValue == null ? void 0 : selectedFieldValue.leftHandSideComponentWhenSelected;
|
|
6688
6879
|
const isEmptyOperator = metaDataPossibleOptions === "empty";
|
|
6689
6880
|
return /* @__PURE__ */ jsxs34("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
|
|
6690
|
-
/* @__PURE__ */
|
|
6881
|
+
/* @__PURE__ */ jsx77("span", { children: index === 0 ? initialCriteriaTitle : criteriaGroupOperator }),
|
|
6691
6882
|
/* @__PURE__ */ jsxs34("div", { css: [ConditionalInputRow, isEmptyOperator ? ConditionalInputRowEmpty : null], children: [
|
|
6692
|
-
CustomLeftHandComponent ? /* @__PURE__ */
|
|
6883
|
+
CustomLeftHandComponent ? /* @__PURE__ */ jsx77(
|
|
6693
6884
|
CustomLeftHandComponent,
|
|
6694
6885
|
{
|
|
6695
6886
|
filterOption: selectedFieldValue,
|
|
@@ -6699,7 +6890,7 @@ var FilterItem = ({
|
|
|
6699
6890
|
onFilterOptionChange("");
|
|
6700
6891
|
}
|
|
6701
6892
|
}
|
|
6702
|
-
) : /* @__PURE__ */
|
|
6893
|
+
) : /* @__PURE__ */ jsx77(
|
|
6703
6894
|
InputComboBox5,
|
|
6704
6895
|
{
|
|
6705
6896
|
"aria-label": label,
|
|
@@ -6726,7 +6917,7 @@ var FilterItem = ({
|
|
|
6726
6917
|
name: `filter-field-${index}`
|
|
6727
6918
|
}
|
|
6728
6919
|
),
|
|
6729
|
-
/* @__PURE__ */
|
|
6920
|
+
/* @__PURE__ */ jsx77(
|
|
6730
6921
|
InputComboBox5,
|
|
6731
6922
|
{
|
|
6732
6923
|
"aria-label": operatorLabel,
|
|
@@ -6750,7 +6941,7 @@ var FilterItem = ({
|
|
|
6750
6941
|
name: `filter-operator-${index}`
|
|
6751
6942
|
}
|
|
6752
6943
|
),
|
|
6753
|
-
/* @__PURE__ */
|
|
6944
|
+
/* @__PURE__ */ jsx77(
|
|
6754
6945
|
FilterEditorRenderer,
|
|
6755
6946
|
{
|
|
6756
6947
|
"aria-label": metaDataLabel,
|
|
@@ -6765,7 +6956,7 @@ var FilterItem = ({
|
|
|
6765
6956
|
filterFieldName: filters[index].field
|
|
6766
6957
|
}
|
|
6767
6958
|
),
|
|
6768
|
-
readOnly ? null : /* @__PURE__ */
|
|
6959
|
+
readOnly ? null : /* @__PURE__ */ jsx77(
|
|
6769
6960
|
"button",
|
|
6770
6961
|
{
|
|
6771
6962
|
type: "button",
|
|
@@ -6774,7 +6965,7 @@ var FilterItem = ({
|
|
|
6774
6965
|
css: IconBtn,
|
|
6775
6966
|
"data-testid": "delete-filter",
|
|
6776
6967
|
disabled: filters.length === 1,
|
|
6777
|
-
children: /* @__PURE__ */
|
|
6968
|
+
children: /* @__PURE__ */ jsx77(Icon4, { icon: CgTrash2, iconColor: filters.length === 1 ? "gray" : "red", size: "1rem" })
|
|
6778
6969
|
}
|
|
6779
6970
|
)
|
|
6780
6971
|
] })
|
|
@@ -6787,16 +6978,16 @@ import { Icon as Icon5 } from "@uniformdev/design-system";
|
|
|
6787
6978
|
|
|
6788
6979
|
// src/components/SearchAndFilter/FilterMenu.tsx
|
|
6789
6980
|
import { HorizontalRhythm as HorizontalRhythm8, VerticalRhythm as VerticalRhythm6 } from "@uniformdev/design-system";
|
|
6790
|
-
import
|
|
6791
|
-
import { jsx as
|
|
6981
|
+
import React8, { useEffect as useEffect21 } from "react";
|
|
6982
|
+
import { jsx as jsx78, jsxs as jsxs35 } from "@emotion/react/jsx-runtime";
|
|
6792
6983
|
var SearchAndFilterOptionsContainer2 = ({
|
|
6793
6984
|
buttonRow,
|
|
6794
6985
|
additionalFiltersContainer,
|
|
6795
6986
|
children
|
|
6796
6987
|
}) => {
|
|
6797
6988
|
return /* @__PURE__ */ jsxs35("div", { css: SearchAndFilterOptionsContainer, children: [
|
|
6798
|
-
/* @__PURE__ */
|
|
6799
|
-
buttonRow ? /* @__PURE__ */
|
|
6989
|
+
/* @__PURE__ */ jsx78("div", { css: SearchAndFilterOptionsInnerContainer, children }),
|
|
6990
|
+
buttonRow ? /* @__PURE__ */ jsx78(
|
|
6800
6991
|
HorizontalRhythm8,
|
|
6801
6992
|
{
|
|
6802
6993
|
css: SearchAndFilterButtonGroup,
|
|
@@ -6806,7 +6997,7 @@ var SearchAndFilterOptionsContainer2 = ({
|
|
|
6806
6997
|
children: buttonRow
|
|
6807
6998
|
}
|
|
6808
6999
|
) : null,
|
|
6809
|
-
additionalFiltersContainer ? /* @__PURE__ */
|
|
7000
|
+
additionalFiltersContainer ? /* @__PURE__ */ jsx78("div", { css: SearchAndFilterAdditionalContainer, children: additionalFiltersContainer }) : null
|
|
6810
7001
|
] });
|
|
6811
7002
|
};
|
|
6812
7003
|
var FilterMenu = ({
|
|
@@ -6819,22 +7010,22 @@ var FilterMenu = ({
|
|
|
6819
7010
|
resetButtonText = "reset"
|
|
6820
7011
|
}) => {
|
|
6821
7012
|
const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
|
|
6822
|
-
const innerMenuRef =
|
|
6823
|
-
|
|
7013
|
+
const innerMenuRef = React8.useRef(null);
|
|
7014
|
+
useEffect21(() => {
|
|
6824
7015
|
var _a;
|
|
6825
7016
|
if (filterVisibility) {
|
|
6826
7017
|
(_a = innerMenuRef.current) == null ? void 0 : _a.focus();
|
|
6827
7018
|
}
|
|
6828
7019
|
}, [filterVisibility]);
|
|
6829
|
-
return /* @__PURE__ */
|
|
7020
|
+
return /* @__PURE__ */ jsx78(VerticalRhythm6, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ jsxs35(
|
|
6830
7021
|
SearchAndFilterOptionsContainer2,
|
|
6831
7022
|
{
|
|
6832
7023
|
buttonRow: menuControls,
|
|
6833
7024
|
additionalFiltersContainer,
|
|
6834
7025
|
children: [
|
|
6835
7026
|
/* @__PURE__ */ jsxs35(HorizontalRhythm8, { gap: "sm", align: "center", justify: "space-between", children: [
|
|
6836
|
-
filterTitle ? /* @__PURE__ */
|
|
6837
|
-
(filters == null ? void 0 : filters.length) && resetButtonText ? /* @__PURE__ */
|
|
7027
|
+
filterTitle ? /* @__PURE__ */ jsx78("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }) : null,
|
|
7028
|
+
(filters == null ? void 0 : filters.length) && resetButtonText ? /* @__PURE__ */ jsx78(
|
|
6838
7029
|
"button",
|
|
6839
7030
|
{
|
|
6840
7031
|
type: "button",
|
|
@@ -6945,7 +7136,7 @@ function hasBindings(currentValue) {
|
|
|
6945
7136
|
}
|
|
6946
7137
|
|
|
6947
7138
|
// src/components/SearchAndFilter/FilterItems.tsx
|
|
6948
|
-
import { jsx as
|
|
7139
|
+
import { jsx as jsx79, jsxs as jsxs36 } from "@emotion/react/jsx-runtime";
|
|
6949
7140
|
var FilterItems = ({
|
|
6950
7141
|
addButtonText = "add condition",
|
|
6951
7142
|
additionalFiltersContainer,
|
|
@@ -6961,7 +7152,7 @@ var FilterItems = ({
|
|
|
6961
7152
|
next[index] = { ...next[index], [prop]: value };
|
|
6962
7153
|
if (prop === "operator") {
|
|
6963
7154
|
const newOperatorId = value;
|
|
6964
|
-
const currentFilter =
|
|
7155
|
+
const currentFilter = filters[index];
|
|
6965
7156
|
if (!newOperatorId) {
|
|
6966
7157
|
throw new Error("you bad");
|
|
6967
7158
|
}
|
|
@@ -6982,7 +7173,7 @@ var FilterItems = ({
|
|
|
6982
7173
|
}
|
|
6983
7174
|
setFilters(next);
|
|
6984
7175
|
};
|
|
6985
|
-
return /* @__PURE__ */
|
|
7176
|
+
return /* @__PURE__ */ jsx79(
|
|
6986
7177
|
FilterMenu,
|
|
6987
7178
|
{
|
|
6988
7179
|
id: "search-and-filter-options",
|
|
@@ -6995,7 +7186,7 @@ var FilterItems = ({
|
|
|
6995
7186
|
onClick: handleAddFilter,
|
|
6996
7187
|
"data-testid": "add-filter",
|
|
6997
7188
|
children: [
|
|
6998
|
-
/* @__PURE__ */
|
|
7189
|
+
/* @__PURE__ */ jsx79(Icon5, { icon: CgMathPlus, iconColor: "currentColor", size: "1rem" }),
|
|
6999
7190
|
addButtonText
|
|
7000
7191
|
]
|
|
7001
7192
|
}
|
|
@@ -7011,7 +7202,7 @@ var FilterItems = ({
|
|
|
7011
7202
|
})) == null ? void 0 : _a.options) != null ? _b : [];
|
|
7012
7203
|
const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
|
|
7013
7204
|
const possibleOperators = (_f = (_e = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _e.operatorOptions) != null ? _f : [];
|
|
7014
|
-
return /* @__PURE__ */
|
|
7205
|
+
return /* @__PURE__ */ jsx79(
|
|
7015
7206
|
FilterItem,
|
|
7016
7207
|
{
|
|
7017
7208
|
index: i,
|
|
@@ -7035,8 +7226,8 @@ var FilterItems = ({
|
|
|
7035
7226
|
import { VerticalRhythm as VerticalRhythm7 } from "@uniformdev/design-system";
|
|
7036
7227
|
|
|
7037
7228
|
// src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
|
|
7038
|
-
import { Button as Button5, Callout as
|
|
7039
|
-
import { Fragment as
|
|
7229
|
+
import { Button as Button5, Callout as Callout5, HorizontalRhythm as HorizontalRhythm9, Paragraph } from "@uniformdev/design-system";
|
|
7230
|
+
import { Fragment as Fragment15, jsx as jsx80, jsxs as jsxs37 } from "@emotion/react/jsx-runtime";
|
|
7040
7231
|
var SearchAndFilterResultContainer = ({
|
|
7041
7232
|
buttonText,
|
|
7042
7233
|
clearButtonLabel = "clear",
|
|
@@ -7045,7 +7236,7 @@ var SearchAndFilterResultContainer = ({
|
|
|
7045
7236
|
onHandleClear,
|
|
7046
7237
|
hideClearButton
|
|
7047
7238
|
}) => {
|
|
7048
|
-
const { searchTerm, totalResults, filters, handleResetFilters, setSearchTerm } = useSearchAndFilter();
|
|
7239
|
+
const { searchTerm, totalResults, filters, handleResetFilters, setSearchTerm, isLoading } = useSearchAndFilter();
|
|
7049
7240
|
const emptyFilters = filters.length === 0 || filters.every((filter) => !filter.value);
|
|
7050
7241
|
const getTextValue = ({
|
|
7051
7242
|
defaultPropText,
|
|
@@ -7076,7 +7267,7 @@ var SearchAndFilterResultContainer = ({
|
|
|
7076
7267
|
filterText: "No results match the selected filters",
|
|
7077
7268
|
fallbackText: "No matching results found"
|
|
7078
7269
|
});
|
|
7079
|
-
if (totalResults
|
|
7270
|
+
if (isLoading || totalResults === void 0 || totalResults > 0) {
|
|
7080
7271
|
return null;
|
|
7081
7272
|
}
|
|
7082
7273
|
const handleClearSearch = () => {
|
|
@@ -7087,18 +7278,18 @@ var SearchAndFilterResultContainer = ({
|
|
|
7087
7278
|
handleResetFilters();
|
|
7088
7279
|
}
|
|
7089
7280
|
};
|
|
7090
|
-
return /* @__PURE__ */ jsxs37(
|
|
7281
|
+
return /* @__PURE__ */ jsxs37(Fragment15, { children: [
|
|
7091
7282
|
/* @__PURE__ */ jsxs37(HorizontalRhythm9, { children: [
|
|
7092
7283
|
/* @__PURE__ */ jsxs37("span", { children: [
|
|
7093
7284
|
totalResults,
|
|
7094
7285
|
" results ",
|
|
7095
7286
|
searchTerm ? `for "${searchTerm}"` : null
|
|
7096
7287
|
] }),
|
|
7097
|
-
!searchTerm || hideClearButton ? null : /* @__PURE__ */
|
|
7288
|
+
!searchTerm || hideClearButton ? null : /* @__PURE__ */ jsx80(Button5, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
|
|
7098
7289
|
] }),
|
|
7099
|
-
totalResults === 0 ? /* @__PURE__ */ jsxs37(
|
|
7100
|
-
calloutText ? /* @__PURE__ */
|
|
7101
|
-
hideClearButton ? null : /* @__PURE__ */
|
|
7290
|
+
totalResults === 0 ? /* @__PURE__ */ jsxs37(Callout5, { title: automateCalloutTitle, type: "note", children: [
|
|
7291
|
+
calloutText ? /* @__PURE__ */ jsx80(Paragraph, { children: calloutText }) : null,
|
|
7292
|
+
hideClearButton ? null : /* @__PURE__ */ jsx80(
|
|
7102
7293
|
Button5,
|
|
7103
7294
|
{
|
|
7104
7295
|
buttonType: "tertiaryOutline",
|
|
@@ -7113,25 +7304,26 @@ var SearchAndFilterResultContainer = ({
|
|
|
7113
7304
|
};
|
|
7114
7305
|
|
|
7115
7306
|
// src/components/SearchAndFilter/SearchAndFilter.tsx
|
|
7116
|
-
import { jsx as
|
|
7307
|
+
import { jsx as jsx81, jsxs as jsxs38 } from "@emotion/react/jsx-runtime";
|
|
7117
7308
|
var SearchAndFilter = ({
|
|
7118
7309
|
filters,
|
|
7119
7310
|
filterOptions,
|
|
7120
7311
|
filterVisible,
|
|
7121
7312
|
filterControls,
|
|
7122
7313
|
viewSwitchControls,
|
|
7123
|
-
resultsContainerView = /* @__PURE__ */
|
|
7314
|
+
resultsContainerView = /* @__PURE__ */ jsx81(SearchAndFilterResultContainer, {}),
|
|
7124
7315
|
filterMapper: filterMapper2 = filterMapper,
|
|
7125
7316
|
additionalFiltersContainer,
|
|
7126
7317
|
onChange,
|
|
7127
7318
|
defaultSearchTerm,
|
|
7128
7319
|
onSearchChange,
|
|
7129
7320
|
totalResults,
|
|
7321
|
+
isLoading,
|
|
7130
7322
|
allowBindingSearchTerm = false,
|
|
7131
7323
|
resetFilterValues = [],
|
|
7132
7324
|
onResetFilterValues
|
|
7133
7325
|
}) => {
|
|
7134
|
-
return /* @__PURE__ */
|
|
7326
|
+
return /* @__PURE__ */ jsx81(
|
|
7135
7327
|
SearchAndFilterProvider,
|
|
7136
7328
|
{
|
|
7137
7329
|
filters,
|
|
@@ -7141,22 +7333,23 @@ var SearchAndFilter = ({
|
|
|
7141
7333
|
defaultSearchTerm,
|
|
7142
7334
|
onSearchChange,
|
|
7143
7335
|
totalResults,
|
|
7336
|
+
isLoading,
|
|
7144
7337
|
resetFilterValues,
|
|
7145
7338
|
filterMapper: filterMapper2,
|
|
7146
7339
|
allowBindingSearchTerm,
|
|
7147
7340
|
onResetFilterValues,
|
|
7148
7341
|
children: /* @__PURE__ */ jsxs38(VerticalRhythm7, { "data-testid": "search-and-filter", children: [
|
|
7149
7342
|
/* @__PURE__ */ jsxs38("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
|
|
7150
|
-
/* @__PURE__ */
|
|
7343
|
+
/* @__PURE__ */ jsx81(
|
|
7151
7344
|
"div",
|
|
7152
7345
|
{
|
|
7153
7346
|
css: SearchAndFilterControlsWrapper(viewSwitchControls ? "auto 1fr 0.05fr" : "auto 1fr"),
|
|
7154
|
-
children: !filterControls ? /* @__PURE__ */
|
|
7347
|
+
children: !filterControls ? /* @__PURE__ */ jsx81(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
|
|
7155
7348
|
}
|
|
7156
7349
|
),
|
|
7157
7350
|
viewSwitchControls
|
|
7158
7351
|
] }),
|
|
7159
|
-
/* @__PURE__ */
|
|
7352
|
+
/* @__PURE__ */ jsx81(FilterItems, { additionalFiltersContainer }),
|
|
7160
7353
|
resultsContainerView
|
|
7161
7354
|
] })
|
|
7162
7355
|
}
|
|
@@ -7165,17 +7358,17 @@ var SearchAndFilter = ({
|
|
|
7165
7358
|
|
|
7166
7359
|
// src/components/SearchAndFilter/SearchOnlyFilter.tsx
|
|
7167
7360
|
import { InputKeywordSearch as InputKeywordSearch2 } from "@uniformdev/design-system";
|
|
7168
|
-
import { createContext as
|
|
7361
|
+
import { createContext as createContext8, useState as useState23 } from "react";
|
|
7169
7362
|
import { useDebounce as useDebounce8 } from "react-use";
|
|
7170
|
-
import { jsx as
|
|
7171
|
-
var SearchOnlyContext =
|
|
7363
|
+
import { jsx as jsx82 } from "@emotion/react/jsx-runtime";
|
|
7364
|
+
var SearchOnlyContext = createContext8({
|
|
7172
7365
|
searchTerm: "",
|
|
7173
7366
|
setSearchTerm: () => {
|
|
7174
7367
|
}
|
|
7175
7368
|
});
|
|
7176
7369
|
var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
|
|
7177
7370
|
const { searchTerm, setSearchTerm } = useSearchAndFilter();
|
|
7178
|
-
const [localeSearchTerm, setLocaleSearchTerm] =
|
|
7371
|
+
const [localeSearchTerm, setLocaleSearchTerm] = useState23("");
|
|
7179
7372
|
useDebounce8(
|
|
7180
7373
|
() => {
|
|
7181
7374
|
setSearchTerm(localeSearchTerm);
|
|
@@ -7184,14 +7377,14 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
|
|
|
7184
7377
|
300,
|
|
7185
7378
|
[localeSearchTerm]
|
|
7186
7379
|
);
|
|
7187
|
-
return /* @__PURE__ */
|
|
7380
|
+
return /* @__PURE__ */ jsx82(
|
|
7188
7381
|
SearchOnlyContext.Provider,
|
|
7189
7382
|
{
|
|
7190
7383
|
value: {
|
|
7191
7384
|
searchTerm,
|
|
7192
7385
|
setSearchTerm: setLocaleSearchTerm
|
|
7193
7386
|
},
|
|
7194
|
-
children: /* @__PURE__ */
|
|
7387
|
+
children: /* @__PURE__ */ jsx82("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ jsx82(
|
|
7195
7388
|
InputKeywordSearch2,
|
|
7196
7389
|
{
|
|
7197
7390
|
placeholder: "Search...",
|
|
@@ -7441,7 +7634,7 @@ var InputVariableWrapper = css22`
|
|
|
7441
7634
|
`;
|
|
7442
7635
|
|
|
7443
7636
|
// src/components/SearchAndFilter/SortItems.tsx
|
|
7444
|
-
import { jsx as
|
|
7637
|
+
import { jsx as jsx83, jsxs as jsxs39 } from "@emotion/react/jsx-runtime";
|
|
7445
7638
|
var SortItems = ({
|
|
7446
7639
|
sortByLabel = "Sort by",
|
|
7447
7640
|
localeLabel = "Show locale",
|
|
@@ -7465,9 +7658,9 @@ var SortItems = ({
|
|
|
7465
7658
|
const localeLabelValue = sortOptions.length > 1 ? localeLabel : `${localeLabel}s`;
|
|
7466
7659
|
return /* @__PURE__ */ jsxs39("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
|
|
7467
7660
|
/* @__PURE__ */ jsxs39(VerticalRhythm8, { gap: "xs", children: [
|
|
7468
|
-
/* @__PURE__ */
|
|
7661
|
+
/* @__PURE__ */ jsx83("span", { css: Title2, children: sortByLabel }),
|
|
7469
7662
|
/* @__PURE__ */ jsxs39("div", { css: SortFilterInputRow, children: [
|
|
7470
|
-
/* @__PURE__ */
|
|
7663
|
+
/* @__PURE__ */ jsx83(
|
|
7471
7664
|
InputVariables,
|
|
7472
7665
|
{
|
|
7473
7666
|
disableInlineMenu: disableSortBinding,
|
|
@@ -7475,7 +7668,7 @@ var SortItems = ({
|
|
|
7475
7668
|
value: sortField,
|
|
7476
7669
|
valueToResetTo: "created_at",
|
|
7477
7670
|
onChange: (e) => onSortChange(`${e}_${sortDirection}`),
|
|
7478
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
7671
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx83(
|
|
7479
7672
|
InputComboBox6,
|
|
7480
7673
|
{
|
|
7481
7674
|
id: "sort-by-field",
|
|
@@ -7498,7 +7691,7 @@ var SortItems = ({
|
|
|
7498
7691
|
)
|
|
7499
7692
|
}
|
|
7500
7693
|
),
|
|
7501
|
-
/* @__PURE__ */
|
|
7694
|
+
/* @__PURE__ */ jsx83(
|
|
7502
7695
|
InputVariables,
|
|
7503
7696
|
{
|
|
7504
7697
|
disableInlineMenu: disableSortBinding,
|
|
@@ -7506,7 +7699,7 @@ var SortItems = ({
|
|
|
7506
7699
|
valueToResetTo: "DESC",
|
|
7507
7700
|
showMenuPosition: disableSortBinding ? void 0 : "inline-right",
|
|
7508
7701
|
onChange: (e) => onSortChange(`${sortField}_${e}`),
|
|
7509
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
7702
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx83(
|
|
7510
7703
|
SegmentedControl,
|
|
7511
7704
|
{
|
|
7512
7705
|
noCheckmark: true,
|
|
@@ -7538,14 +7731,14 @@ var SortItems = ({
|
|
|
7538
7731
|
)
|
|
7539
7732
|
] })
|
|
7540
7733
|
] }),
|
|
7541
|
-
hideLocaleOptions ? null : /* @__PURE__ */
|
|
7734
|
+
hideLocaleOptions ? null : /* @__PURE__ */ jsx83(VerticalRhythm8, { gap: "xs", css: InputVariableWrapper, children: /* @__PURE__ */ jsx83(
|
|
7542
7735
|
InputVariables,
|
|
7543
7736
|
{
|
|
7544
7737
|
label: localeLabelValue,
|
|
7545
7738
|
value: localeValue,
|
|
7546
7739
|
showMenuPosition: "inline-right",
|
|
7547
7740
|
onChange: (e) => onLocaleChange(e != null ? e : ""),
|
|
7548
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
7741
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx83(
|
|
7549
7742
|
InputSelect5,
|
|
7550
7743
|
{
|
|
7551
7744
|
name: "localeReturned",
|
|
@@ -7576,7 +7769,7 @@ function createLocationValidator(setValue, validate) {
|
|
|
7576
7769
|
|
|
7577
7770
|
// src/utils/useContentDataResourceLocaleInfo.ts
|
|
7578
7771
|
import { bindVariables as bindVariables2, createVariableReference as createVariableReference4, LOCALE_DYNAMIC_INPUT_NAME as LOCALE_DYNAMIC_INPUT_NAME2 } from "@uniformdev/canvas";
|
|
7579
|
-
import { useEffect as
|
|
7772
|
+
import { useEffect as useEffect22, useRef as useRef11 } from "react";
|
|
7580
7773
|
function useContentDataResourceLocaleInfo({
|
|
7581
7774
|
locale,
|
|
7582
7775
|
defaultLocale,
|
|
@@ -7584,12 +7777,12 @@ function useContentDataResourceLocaleInfo({
|
|
|
7584
7777
|
dynamicInputs
|
|
7585
7778
|
}) {
|
|
7586
7779
|
var _a;
|
|
7587
|
-
const setLocaleRef =
|
|
7780
|
+
const setLocaleRef = useRef11(setLocale);
|
|
7588
7781
|
setLocaleRef.current = setLocale;
|
|
7589
7782
|
const { flatVariables } = useVariables();
|
|
7590
7783
|
const effectiveLocale = locale != null ? locale : dynamicInputs[LOCALE_DYNAMIC_INPUT_NAME2] ? createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2) : defaultLocale != null ? defaultLocale : "";
|
|
7591
7784
|
const boundLocale = (_a = bindVariables2({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
|
|
7592
|
-
|
|
7785
|
+
useEffect22(() => {
|
|
7593
7786
|
if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
|
|
7594
7787
|
setLocaleRef.current(effectiveLocale);
|
|
7595
7788
|
}
|
|
@@ -7601,7 +7794,7 @@ function useContentDataResourceLocaleInfo({
|
|
|
7601
7794
|
import {
|
|
7602
7795
|
AddListButton as AddListButton2,
|
|
7603
7796
|
Button as Button6,
|
|
7604
|
-
Callout as
|
|
7797
|
+
Callout as Callout6,
|
|
7605
7798
|
DrawerContent,
|
|
7606
7799
|
Heading,
|
|
7607
7800
|
Input as Input10,
|
|
@@ -7611,7 +7804,7 @@ import {
|
|
|
7611
7804
|
InputToggle as InputToggle3,
|
|
7612
7805
|
Label,
|
|
7613
7806
|
LoadingIndicator as LoadingIndicator4,
|
|
7614
|
-
LoadingOverlay,
|
|
7807
|
+
LoadingOverlay as LoadingOverlay2,
|
|
7615
7808
|
Menu as Menu3,
|
|
7616
7809
|
MenuItem as MenuItem2,
|
|
7617
7810
|
ParameterGroup,
|
|
@@ -7642,7 +7835,7 @@ export {
|
|
|
7642
7835
|
AddListButton2 as AddListButton,
|
|
7643
7836
|
Button6 as Button,
|
|
7644
7837
|
CHECKBOX_OPERATORS,
|
|
7645
|
-
|
|
7838
|
+
Callout6 as Callout,
|
|
7646
7839
|
ControlledValuePlugin,
|
|
7647
7840
|
DATE_OPERATORS,
|
|
7648
7841
|
DATE_TIME_OPERATORS,
|
|
@@ -7655,6 +7848,9 @@ export {
|
|
|
7655
7848
|
DataTypeEditor,
|
|
7656
7849
|
DateEditor,
|
|
7657
7850
|
DateRangeEditor,
|
|
7851
|
+
DelegationContext,
|
|
7852
|
+
DelegationGate,
|
|
7853
|
+
DelegationProvider,
|
|
7658
7854
|
DrawerContent,
|
|
7659
7855
|
EDIT_VARIABLE_COMMAND,
|
|
7660
7856
|
FilterButton2 as FilterButton,
|
|
@@ -7677,7 +7873,7 @@ export {
|
|
|
7677
7873
|
Label,
|
|
7678
7874
|
LinkButton,
|
|
7679
7875
|
LoadingIndicator4 as LoadingIndicator,
|
|
7680
|
-
LoadingOverlay,
|
|
7876
|
+
LoadingOverlay2 as LoadingOverlay,
|
|
7681
7877
|
MULTI_SELECT_OPERATORS,
|
|
7682
7878
|
Menu3 as Menu,
|
|
7683
7879
|
MenuItem2 as MenuItem,
|
|
@@ -7767,6 +7963,7 @@ export {
|
|
|
7767
7963
|
urlEncodeRequestUrl,
|
|
7768
7964
|
useConnectedDataAsVariables,
|
|
7769
7965
|
useContentDataResourceLocaleInfo,
|
|
7966
|
+
useDelegation,
|
|
7770
7967
|
useDynamicInputsAsVariables,
|
|
7771
7968
|
useMeshLocation,
|
|
7772
7969
|
useObjectSearchContext,
|