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