@uniformdev/mesh-sdk-react 20.50.2-alpha.2 → 20.50.2-alpha.77
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 +115 -5
- package/dist/index.d.ts +115 -5
- package/dist/index.esm.js +528 -322
- package/dist/index.js +844 -634
- package/dist/index.mjs +528 -322
- package/package.json +11 -10
package/dist/index.esm.js
CHANGED
|
@@ -266,6 +266,22 @@ function useConnectedDataAsVariables(connectedData) {
|
|
|
266
266
|
);
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
+
// src/hooks/useDelegation.ts
|
|
270
|
+
import { useContext } from "react";
|
|
271
|
+
|
|
272
|
+
// src/components/Delegation/DelegationContext.ts
|
|
273
|
+
import { createContext } from "react";
|
|
274
|
+
var DelegationContext = createContext(null);
|
|
275
|
+
|
|
276
|
+
// src/hooks/useDelegation.ts
|
|
277
|
+
function useDelegation() {
|
|
278
|
+
const ctx = useContext(DelegationContext);
|
|
279
|
+
if (!ctx) {
|
|
280
|
+
throw new Error("useDelegation must be used within a <DelegationProvider>");
|
|
281
|
+
}
|
|
282
|
+
return ctx;
|
|
283
|
+
}
|
|
284
|
+
|
|
269
285
|
// src/hooks/useDynamicInputsAsVariables.tsx
|
|
270
286
|
import { LOCALE_DYNAMIC_INPUT_NAME } from "@uniformdev/canvas";
|
|
271
287
|
import { useMemo as useMemo2 } from "react";
|
|
@@ -309,15 +325,15 @@ Current preview value: ${input3.value || "not provided"}`
|
|
|
309
325
|
import { useMemo as useMemo4, useRef } from "react";
|
|
310
326
|
|
|
311
327
|
// src/components/UniformMeshLocationContext.tsx
|
|
312
|
-
import { createContext as
|
|
328
|
+
import { createContext as createContext3, useContext as useContext3, useMemo as useMemo3, useState } from "react";
|
|
313
329
|
|
|
314
330
|
// src/components/UniformMeshSdkContext.tsx
|
|
315
331
|
import { Theme } from "@uniformdev/design-system";
|
|
316
|
-
import { createContext, useContext } from "react";
|
|
332
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
317
333
|
import { jsx as jsx16, jsxs as jsxs4 } from "@emotion/react/jsx-runtime";
|
|
318
|
-
var UniformMeshSdkContext =
|
|
334
|
+
var UniformMeshSdkContext = createContext2(void 0);
|
|
319
335
|
var useUniformMeshSdkContext = () => {
|
|
320
|
-
const context =
|
|
336
|
+
const context = useContext2(UniformMeshSdkContext);
|
|
321
337
|
if (!context) {
|
|
322
338
|
throw new Error("useUniformMeshSdkContext must be used within <MeshApp /> or <UniformMeshSdkContext />");
|
|
323
339
|
}
|
|
@@ -332,7 +348,7 @@ function useUniformMeshSdk() {
|
|
|
332
348
|
|
|
333
349
|
// src/components/UniformMeshLocationContext.tsx
|
|
334
350
|
import { jsx as jsx17 } from "@emotion/react/jsx-runtime";
|
|
335
|
-
var UniformMeshLocationContext =
|
|
351
|
+
var UniformMeshLocationContext = createContext3(void 0);
|
|
336
352
|
var UniformMeshLocationContextProvider = ({
|
|
337
353
|
children
|
|
338
354
|
}) => {
|
|
@@ -355,7 +371,7 @@ var UniformMeshLocationContextProvider = ({
|
|
|
355
371
|
return /* @__PURE__ */ jsx17(UniformMeshLocationContext.Provider, { value: { location }, children });
|
|
356
372
|
};
|
|
357
373
|
var useUniformMeshLocationContext = () => {
|
|
358
|
-
const context =
|
|
374
|
+
const context = useContext3(UniformMeshLocationContext);
|
|
359
375
|
if (!context) {
|
|
360
376
|
throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");
|
|
361
377
|
}
|
|
@@ -720,7 +736,7 @@ var variablesTipText = css`
|
|
|
720
736
|
|
|
721
737
|
// src/components/Variables/VariablesProvider.tsx
|
|
722
738
|
import mitt from "mitt";
|
|
723
|
-
import { createContext as
|
|
739
|
+
import { createContext as createContext4, useContext as useContext4, useEffect as useEffect3, useMemo as useMemo5, useState as useState3 } from "react";
|
|
724
740
|
|
|
725
741
|
// src/components/Variables/util/useVariableEditTransaction.ts
|
|
726
742
|
import { useCallback, useEffect as useEffect2, useState as useState2 } from "react";
|
|
@@ -909,7 +925,7 @@ function VariableEditor({
|
|
|
909
925
|
|
|
910
926
|
// src/components/Variables/VariablesProvider.tsx
|
|
911
927
|
import { jsx as jsx20, jsxs as jsxs6 } from "@emotion/react/jsx-runtime";
|
|
912
|
-
var VariablesContext =
|
|
928
|
+
var VariablesContext = createContext4(null);
|
|
913
929
|
function VariablesProvider({
|
|
914
930
|
value,
|
|
915
931
|
onChange,
|
|
@@ -1034,7 +1050,7 @@ function VariablesProvider({
|
|
|
1034
1050
|
] });
|
|
1035
1051
|
}
|
|
1036
1052
|
function useVariables(returnEmptyWithoutProvider = false) {
|
|
1037
|
-
const context =
|
|
1053
|
+
const context = useContext4(VariablesContext);
|
|
1038
1054
|
if (!context) {
|
|
1039
1055
|
if (returnEmptyWithoutProvider) {
|
|
1040
1056
|
return {
|
|
@@ -2300,7 +2316,7 @@ function VariablesComposer(props) {
|
|
|
2300
2316
|
nodes: [VariableNode],
|
|
2301
2317
|
editorState: deserializeVariablesEditorState(props.value)
|
|
2302
2318
|
}),
|
|
2303
|
-
//
|
|
2319
|
+
// oxlint-disable-next-line react/exhaustive-deps
|
|
2304
2320
|
[]
|
|
2305
2321
|
);
|
|
2306
2322
|
const editorState = useRef5(void 0);
|
|
@@ -3887,17 +3903,192 @@ function convertRequestDataToDataType(dataType, requestData) {
|
|
|
3887
3903
|
};
|
|
3888
3904
|
}
|
|
3889
3905
|
|
|
3906
|
+
// src/components/Delegation/DelegationGate.tsx
|
|
3907
|
+
import { Callout as Callout3, LoadingOverlay } from "@uniformdev/design-system";
|
|
3908
|
+
import { Fragment as Fragment10, jsx as jsx46, jsxs as jsxs21 } from "@emotion/react/jsx-runtime";
|
|
3909
|
+
var defaultLoadingWrapperStyle = {
|
|
3910
|
+
position: "relative",
|
|
3911
|
+
minHeight: "12rem",
|
|
3912
|
+
width: "100%"
|
|
3913
|
+
};
|
|
3914
|
+
function DefaultDelegationLoading() {
|
|
3915
|
+
return /* @__PURE__ */ jsx46("div", { style: defaultLoadingWrapperStyle, children: /* @__PURE__ */ jsx46(LoadingOverlay, { isActive: true, statusMessage: "Connecting to Uniform..." }) });
|
|
3916
|
+
}
|
|
3917
|
+
function DefaultDelegationDisabled() {
|
|
3918
|
+
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." });
|
|
3919
|
+
}
|
|
3920
|
+
function DefaultDelegationError({ error }) {
|
|
3921
|
+
return /* @__PURE__ */ jsxs21(Callout3, { type: "error", title: "Connection error", children: [
|
|
3922
|
+
/* @__PURE__ */ jsx46("p", { children: "Failed to establish a secure connection with Uniform." }),
|
|
3923
|
+
/* @__PURE__ */ jsx46(
|
|
3924
|
+
"pre",
|
|
3925
|
+
{
|
|
3926
|
+
style: {
|
|
3927
|
+
marginTop: 8,
|
|
3928
|
+
marginBottom: 0,
|
|
3929
|
+
whiteSpace: "pre-wrap",
|
|
3930
|
+
wordBreak: "break-word"
|
|
3931
|
+
},
|
|
3932
|
+
children: error.message
|
|
3933
|
+
}
|
|
3934
|
+
)
|
|
3935
|
+
] });
|
|
3936
|
+
}
|
|
3937
|
+
function DelegationGate({
|
|
3938
|
+
children,
|
|
3939
|
+
loadingComponent,
|
|
3940
|
+
disabledComponent,
|
|
3941
|
+
errorComponent
|
|
3942
|
+
}) {
|
|
3943
|
+
const { status, error } = useDelegation();
|
|
3944
|
+
if (status === "active") {
|
|
3945
|
+
return /* @__PURE__ */ jsx46(Fragment10, { children });
|
|
3946
|
+
}
|
|
3947
|
+
if (status === "idle" || status === "acquiring") {
|
|
3948
|
+
return /* @__PURE__ */ jsx46(Fragment10, { children: loadingComponent !== void 0 ? loadingComponent : /* @__PURE__ */ jsx46(DefaultDelegationLoading, {}) });
|
|
3949
|
+
}
|
|
3950
|
+
if (status === "disabled") {
|
|
3951
|
+
return /* @__PURE__ */ jsx46(Fragment10, { children: disabledComponent !== void 0 ? disabledComponent : /* @__PURE__ */ jsx46(DefaultDelegationDisabled, {}) });
|
|
3952
|
+
}
|
|
3953
|
+
if (status === "error") {
|
|
3954
|
+
const resolvedError = error != null ? error : new Error("Unknown delegation error");
|
|
3955
|
+
if (errorComponent !== void 0) {
|
|
3956
|
+
if (typeof errorComponent === "function") {
|
|
3957
|
+
return /* @__PURE__ */ jsx46(Fragment10, { children: errorComponent({ error: resolvedError }) });
|
|
3958
|
+
}
|
|
3959
|
+
return /* @__PURE__ */ jsx46(Fragment10, { children: errorComponent });
|
|
3960
|
+
}
|
|
3961
|
+
return /* @__PURE__ */ jsx46(DefaultDelegationError, { error: resolvedError });
|
|
3962
|
+
}
|
|
3963
|
+
return null;
|
|
3964
|
+
}
|
|
3965
|
+
|
|
3966
|
+
// src/components/Delegation/DelegationProvider.tsx
|
|
3967
|
+
import { useCallback as useCallback5, useEffect as useEffect12, useMemo as useMemo12, useRef as useRef7, useState as useState11 } from "react";
|
|
3968
|
+
import { jsx as jsx47 } from "@emotion/react/jsx-runtime";
|
|
3969
|
+
var DEFAULT_REVALIDATE_AFTER_MS = 5 * 60 * 1e3;
|
|
3970
|
+
function DelegationProvider({
|
|
3971
|
+
sdk,
|
|
3972
|
+
onSessionToken,
|
|
3973
|
+
checkActive,
|
|
3974
|
+
revalidateOnFocus = true,
|
|
3975
|
+
revalidateAfterMs = DEFAULT_REVALIDATE_AFTER_MS,
|
|
3976
|
+
children
|
|
3977
|
+
}) {
|
|
3978
|
+
const [status, setStatus] = useState11("idle");
|
|
3979
|
+
const [error, setError] = useState11(null);
|
|
3980
|
+
const acquiringRef = useRef7(false);
|
|
3981
|
+
const mountedRef = useRef7(true);
|
|
3982
|
+
const statusRef = useRef7("idle");
|
|
3983
|
+
statusRef.current = status;
|
|
3984
|
+
const acquire = useCallback5(async () => {
|
|
3985
|
+
if (acquiringRef.current) {
|
|
3986
|
+
return;
|
|
3987
|
+
}
|
|
3988
|
+
acquiringRef.current = true;
|
|
3989
|
+
setStatus("acquiring");
|
|
3990
|
+
setError(null);
|
|
3991
|
+
try {
|
|
3992
|
+
const isActive = await checkActive();
|
|
3993
|
+
if (isActive) {
|
|
3994
|
+
if (mountedRef.current) {
|
|
3995
|
+
setStatus("active");
|
|
3996
|
+
}
|
|
3997
|
+
return;
|
|
3998
|
+
}
|
|
3999
|
+
if (!mountedRef.current) {
|
|
4000
|
+
return;
|
|
4001
|
+
}
|
|
4002
|
+
const sessionToken = await sdk.getSessionToken();
|
|
4003
|
+
if (!mountedRef.current) {
|
|
4004
|
+
return;
|
|
4005
|
+
}
|
|
4006
|
+
if (!sessionToken) {
|
|
4007
|
+
setStatus("disabled");
|
|
4008
|
+
return;
|
|
4009
|
+
}
|
|
4010
|
+
await onSessionToken(sessionToken);
|
|
4011
|
+
if (mountedRef.current) {
|
|
4012
|
+
setStatus("active");
|
|
4013
|
+
}
|
|
4014
|
+
} catch (err) {
|
|
4015
|
+
if (mountedRef.current) {
|
|
4016
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
4017
|
+
setStatus("error");
|
|
4018
|
+
}
|
|
4019
|
+
} finally {
|
|
4020
|
+
acquiringRef.current = false;
|
|
4021
|
+
}
|
|
4022
|
+
}, [sdk, onSessionToken, checkActive]);
|
|
4023
|
+
useEffect12(() => {
|
|
4024
|
+
mountedRef.current = true;
|
|
4025
|
+
void acquire();
|
|
4026
|
+
return () => {
|
|
4027
|
+
mountedRef.current = false;
|
|
4028
|
+
};
|
|
4029
|
+
}, [acquire]);
|
|
4030
|
+
const revalidate = useCallback5(async () => {
|
|
4031
|
+
if (acquiringRef.current) {
|
|
4032
|
+
return;
|
|
4033
|
+
}
|
|
4034
|
+
if (statusRef.current !== "active") {
|
|
4035
|
+
return;
|
|
4036
|
+
}
|
|
4037
|
+
try {
|
|
4038
|
+
const isActive = await checkActive();
|
|
4039
|
+
if (!mountedRef.current) {
|
|
4040
|
+
return;
|
|
4041
|
+
}
|
|
4042
|
+
if (!isActive) {
|
|
4043
|
+
void acquire();
|
|
4044
|
+
}
|
|
4045
|
+
} catch (e) {
|
|
4046
|
+
}
|
|
4047
|
+
}, [checkActive, acquire]);
|
|
4048
|
+
useEffect12(() => {
|
|
4049
|
+
if (!revalidateOnFocus) {
|
|
4050
|
+
return;
|
|
4051
|
+
}
|
|
4052
|
+
if (typeof document === "undefined") {
|
|
4053
|
+
return;
|
|
4054
|
+
}
|
|
4055
|
+
let hiddenAt = document.visibilityState === "hidden" ? Date.now() : null;
|
|
4056
|
+
const handleVisibilityChange = () => {
|
|
4057
|
+
if (document.visibilityState === "hidden") {
|
|
4058
|
+
hiddenAt = Date.now();
|
|
4059
|
+
return;
|
|
4060
|
+
}
|
|
4061
|
+
if (document.visibilityState === "visible") {
|
|
4062
|
+
const elapsed = hiddenAt === null ? 0 : Date.now() - hiddenAt;
|
|
4063
|
+
hiddenAt = null;
|
|
4064
|
+
if (elapsed >= revalidateAfterMs) {
|
|
4065
|
+
void revalidate();
|
|
4066
|
+
}
|
|
4067
|
+
}
|
|
4068
|
+
};
|
|
4069
|
+
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
4070
|
+
return () => {
|
|
4071
|
+
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
4072
|
+
};
|
|
4073
|
+
}, [revalidateOnFocus, revalidateAfterMs, revalidate]);
|
|
4074
|
+
const reacquire = useCallback5(() => {
|
|
4075
|
+
void acquire();
|
|
4076
|
+
}, [acquire]);
|
|
4077
|
+
const value = useMemo12(() => ({ status, error, reacquire }), [status, error, reacquire]);
|
|
4078
|
+
return /* @__PURE__ */ jsx47(DelegationContext.Provider, { value, children });
|
|
4079
|
+
}
|
|
4080
|
+
|
|
3890
4081
|
// src/components/MeshApp.tsx
|
|
3891
|
-
import { LoadingIndicator as LoadingIndicator2, Theme as Theme2 } from "@uniformdev/design-system";
|
|
4082
|
+
import { IconsProvider, LoadingIndicator as LoadingIndicator2, Theme as Theme2 } from "@uniformdev/design-system";
|
|
3892
4083
|
|
|
3893
4084
|
// src/hooks/useInitializeUniformMeshSdk.ts
|
|
3894
4085
|
import { initializeUniformMeshSDK } from "@uniformdev/mesh-sdk";
|
|
3895
|
-
import { useEffect as
|
|
4086
|
+
import { useEffect as useEffect13, useRef as useRef8, useState as useState12 } from "react";
|
|
3896
4087
|
var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
3897
|
-
const [error, setError] =
|
|
3898
|
-
const [sdk, setSdk] =
|
|
3899
|
-
const initializationInProgress =
|
|
3900
|
-
|
|
4088
|
+
const [error, setError] = useState12();
|
|
4089
|
+
const [sdk, setSdk] = useState12();
|
|
4090
|
+
const initializationInProgress = useRef8(false);
|
|
4091
|
+
useEffect13(
|
|
3901
4092
|
() => {
|
|
3902
4093
|
if (typeof window === "undefined" || sdk) {
|
|
3903
4094
|
return;
|
|
@@ -3915,7 +4106,7 @@ var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
|
3915
4106
|
setSdk(window.UniformMeshSDK);
|
|
3916
4107
|
}
|
|
3917
4108
|
},
|
|
3918
|
-
//
|
|
4109
|
+
// oxlint-disable-next-line react/exhaustive-deps
|
|
3919
4110
|
[autoResizingDisabled]
|
|
3920
4111
|
);
|
|
3921
4112
|
return {
|
|
@@ -3930,7 +4121,7 @@ var useInitializeUniformMeshSdk = ({ autoResizingDisabled } = {}) => {
|
|
|
3930
4121
|
};
|
|
3931
4122
|
|
|
3932
4123
|
// src/components/MeshApp.tsx
|
|
3933
|
-
import { jsx as
|
|
4124
|
+
import { jsx as jsx48, jsxs as jsxs22 } from "@emotion/react/jsx-runtime";
|
|
3934
4125
|
var MeshApp = ({
|
|
3935
4126
|
children,
|
|
3936
4127
|
loadingComponent,
|
|
@@ -3939,33 +4130,33 @@ var MeshApp = ({
|
|
|
3939
4130
|
const { initializing, error, sdk } = useInitializeUniformMeshSdk();
|
|
3940
4131
|
if (initializing || !sdk) {
|
|
3941
4132
|
const LoadingComponent = loadingComponent;
|
|
3942
|
-
return LoadingComponent ? /* @__PURE__ */
|
|
4133
|
+
return LoadingComponent ? /* @__PURE__ */ jsx48(LoadingComponent, {}) : /* @__PURE__ */ jsx48(LoadingIndicator2, {});
|
|
3943
4134
|
}
|
|
3944
4135
|
if (error) {
|
|
3945
4136
|
const ErrorComponent = errorComponent;
|
|
3946
4137
|
if (ErrorComponent) {
|
|
3947
|
-
return /* @__PURE__ */
|
|
4138
|
+
return /* @__PURE__ */ jsx48(ErrorComponent, { error });
|
|
3948
4139
|
}
|
|
3949
4140
|
throw error;
|
|
3950
4141
|
}
|
|
3951
|
-
return /* @__PURE__ */
|
|
3952
|
-
/* @__PURE__ */
|
|
3953
|
-
/* @__PURE__ */
|
|
4142
|
+
return /* @__PURE__ */ jsxs22(UniformMeshSdkContext.Provider, { value: { sdk }, children: [
|
|
4143
|
+
/* @__PURE__ */ jsx48(Theme2, {}),
|
|
4144
|
+
/* @__PURE__ */ jsx48(IconsProvider, { children: /* @__PURE__ */ jsx48(UniformMeshLocationContextProvider, { children }) })
|
|
3954
4145
|
] });
|
|
3955
4146
|
};
|
|
3956
4147
|
|
|
3957
4148
|
// src/components/ObjectSearch/DataRefreshButton.tsx
|
|
3958
4149
|
import { css as css14 } from "@emotion/react";
|
|
3959
4150
|
import { Button as Button2, LoadingIndicator as LoadingIndicator3 } from "@uniformdev/design-system";
|
|
3960
|
-
import { jsx as
|
|
4151
|
+
import { jsx as jsx49, jsxs as jsxs23 } from "@emotion/react/jsx-runtime";
|
|
3961
4152
|
var DataRefreshButton = ({
|
|
3962
4153
|
buttonText,
|
|
3963
4154
|
isLoading,
|
|
3964
4155
|
onRefreshData,
|
|
3965
4156
|
...props
|
|
3966
4157
|
}) => {
|
|
3967
|
-
return /* @__PURE__ */
|
|
3968
|
-
!isLoading ? null : /* @__PURE__ */
|
|
4158
|
+
return /* @__PURE__ */ jsxs23(Button2, { buttonType: "ghost", onClick: onRefreshData, disabled: isLoading, ...props, children: [
|
|
4159
|
+
!isLoading ? null : /* @__PURE__ */ jsx49(
|
|
3969
4160
|
LoadingIndicator3,
|
|
3970
4161
|
{
|
|
3971
4162
|
css: css14`
|
|
@@ -3980,20 +4171,20 @@ var DataRefreshButton = ({
|
|
|
3980
4171
|
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
3981
4172
|
import { css as css16 } from "@emotion/react";
|
|
3982
4173
|
import { bindVariables } from "@uniformdev/canvas";
|
|
3983
|
-
import { Callout as
|
|
4174
|
+
import { Callout as Callout4, Container, ScrollableList, VerticalRhythm as VerticalRhythm3 } from "@uniformdev/design-system";
|
|
3984
4175
|
|
|
3985
4176
|
// src/components/ObjectSearch/hooks/ObjectSearchContext.tsx
|
|
3986
4177
|
import { bindVariablesToObject as bindVariablesToObject2 } from "@uniformdev/canvas";
|
|
3987
4178
|
import {
|
|
3988
|
-
createContext as
|
|
3989
|
-
useCallback as
|
|
3990
|
-
useContext as
|
|
4179
|
+
createContext as createContext6,
|
|
4180
|
+
useCallback as useCallback6,
|
|
4181
|
+
useContext as useContext6,
|
|
3991
4182
|
useDeferredValue,
|
|
3992
|
-
useMemo as
|
|
3993
|
-
useState as
|
|
4183
|
+
useMemo as useMemo13,
|
|
4184
|
+
useState as useState13
|
|
3994
4185
|
} from "react";
|
|
3995
|
-
import { jsx as
|
|
3996
|
-
var ObjectSearchContext =
|
|
4186
|
+
import { jsx as jsx50 } from "@emotion/react/jsx-runtime";
|
|
4187
|
+
var ObjectSearchContext = createContext6({
|
|
3997
4188
|
onSetQuery: () => {
|
|
3998
4189
|
},
|
|
3999
4190
|
onSelectItem: () => {
|
|
@@ -4014,16 +4205,16 @@ var ObjectSearchProvider = ({
|
|
|
4014
4205
|
children,
|
|
4015
4206
|
defaultQuery
|
|
4016
4207
|
}) => {
|
|
4017
|
-
const [query, setQuery] =
|
|
4208
|
+
const [query, setQuery] = useState13({
|
|
4018
4209
|
contentType: "",
|
|
4019
4210
|
keyword: "",
|
|
4020
4211
|
...defaultQuery
|
|
4021
4212
|
});
|
|
4022
4213
|
const { flatVariables } = useVariables(true);
|
|
4023
4214
|
const querySearchDeferred = useDeferredValue(query);
|
|
4024
|
-
const [selectedItems, setSelectedItems] =
|
|
4025
|
-
const [list, setList] =
|
|
4026
|
-
const onSetQuery =
|
|
4215
|
+
const [selectedItems, setSelectedItems] = useState13(currentlySelectedItems != null ? currentlySelectedItems : []);
|
|
4216
|
+
const [list, setList] = useState13({});
|
|
4217
|
+
const onSetQuery = useCallback6(
|
|
4027
4218
|
(value2) => {
|
|
4028
4219
|
if (Array.isArray(value2.contentType) && value2.contentType.length > 0) {
|
|
4029
4220
|
return setQuery({
|
|
@@ -4035,7 +4226,7 @@ var ObjectSearchProvider = ({
|
|
|
4035
4226
|
},
|
|
4036
4227
|
[setQuery]
|
|
4037
4228
|
);
|
|
4038
|
-
const onSelectItem =
|
|
4229
|
+
const onSelectItem = useCallback6(
|
|
4039
4230
|
(selectedResult) => {
|
|
4040
4231
|
if (Array.isArray(selectedResult)) {
|
|
4041
4232
|
setSelectedItems(selectedResult);
|
|
@@ -4049,17 +4240,17 @@ var ObjectSearchProvider = ({
|
|
|
4049
4240
|
},
|
|
4050
4241
|
[setSelectedItems, selectedItems]
|
|
4051
4242
|
);
|
|
4052
|
-
const onRemoveAllSelectedItems =
|
|
4243
|
+
const onRemoveAllSelectedItems = useCallback6(() => {
|
|
4053
4244
|
setSelectedItems([]);
|
|
4054
4245
|
}, [setSelectedItems]);
|
|
4055
|
-
const onSetList =
|
|
4246
|
+
const onSetList = useCallback6(
|
|
4056
4247
|
(value2) => {
|
|
4057
4248
|
setList(value2);
|
|
4058
4249
|
},
|
|
4059
4250
|
[setList]
|
|
4060
4251
|
);
|
|
4061
|
-
const boundQuery =
|
|
4062
|
-
const value =
|
|
4252
|
+
const boundQuery = useMemo13(() => bindQuery(query, flatVariables), [query, flatVariables]);
|
|
4253
|
+
const value = useMemo13(
|
|
4063
4254
|
() => ({
|
|
4064
4255
|
boundQuery,
|
|
4065
4256
|
onSetQuery,
|
|
@@ -4083,10 +4274,10 @@ var ObjectSearchProvider = ({
|
|
|
4083
4274
|
onSetList
|
|
4084
4275
|
]
|
|
4085
4276
|
);
|
|
4086
|
-
return /* @__PURE__ */
|
|
4277
|
+
return /* @__PURE__ */ jsx50(ObjectSearchContext.Provider, { value, children });
|
|
4087
4278
|
};
|
|
4088
4279
|
function useObjectSearchContext() {
|
|
4089
|
-
return
|
|
4280
|
+
return useContext6(ObjectSearchContext);
|
|
4090
4281
|
}
|
|
4091
4282
|
function bindQuery(query, inputs) {
|
|
4092
4283
|
const { result, errors } = bindVariablesToObject2({
|
|
@@ -4179,7 +4370,7 @@ var ObjectListItemUnControlledContent = css15`
|
|
|
4179
4370
|
`;
|
|
4180
4371
|
|
|
4181
4372
|
// src/components/ObjectSearch/ObjectSearchListItem.tsx
|
|
4182
|
-
import { jsx as
|
|
4373
|
+
import { jsx as jsx51, jsxs as jsxs24 } from "@emotion/react/jsx-runtime";
|
|
4183
4374
|
var ObjectSearchListItem = ({
|
|
4184
4375
|
id,
|
|
4185
4376
|
title,
|
|
@@ -4204,7 +4395,7 @@ var ObjectSearchListItem = ({
|
|
|
4204
4395
|
return onSelectItem([selectedItem]);
|
|
4205
4396
|
};
|
|
4206
4397
|
const selected = selectedListItems.some((item) => item.id === id);
|
|
4207
|
-
return /* @__PURE__ */
|
|
4398
|
+
return /* @__PURE__ */ jsxs24(
|
|
4208
4399
|
"div",
|
|
4209
4400
|
{
|
|
4210
4401
|
role: "listitem",
|
|
@@ -4212,7 +4403,7 @@ var ObjectSearchListItem = ({
|
|
|
4212
4403
|
"data-testid": "list-item",
|
|
4213
4404
|
...props,
|
|
4214
4405
|
children: [
|
|
4215
|
-
/* @__PURE__ */
|
|
4406
|
+
/* @__PURE__ */ jsxs24(
|
|
4216
4407
|
"div",
|
|
4217
4408
|
{
|
|
4218
4409
|
role: "button",
|
|
@@ -4220,7 +4411,7 @@ var ObjectSearchListItem = ({
|
|
|
4220
4411
|
css: ObjectListItemControlledContent,
|
|
4221
4412
|
"aria-disabled": disabled,
|
|
4222
4413
|
children: [
|
|
4223
|
-
imageUrl ? /* @__PURE__ */
|
|
4414
|
+
imageUrl ? /* @__PURE__ */ jsx51(
|
|
4224
4415
|
"img",
|
|
4225
4416
|
{
|
|
4226
4417
|
src: imageUrl,
|
|
@@ -4229,28 +4420,28 @@ var ObjectSearchListItem = ({
|
|
|
4229
4420
|
loading: "lazy"
|
|
4230
4421
|
}
|
|
4231
4422
|
) : null,
|
|
4232
|
-
/* @__PURE__ */
|
|
4233
|
-
!contentType ? null : /* @__PURE__ */
|
|
4234
|
-
/* @__PURE__ */
|
|
4423
|
+
/* @__PURE__ */ jsxs24("div", { role: "heading", css: ObjectListItemHeadingGroup, children: [
|
|
4424
|
+
!contentType ? null : /* @__PURE__ */ jsx51("span", { css: ObjectListItemSubtitle, children: formatedContentType }),
|
|
4425
|
+
/* @__PURE__ */ jsx51("span", { css: ObjectListItemTitle, "data-testid": "title", children: title })
|
|
4235
4426
|
] })
|
|
4236
4427
|
]
|
|
4237
4428
|
}
|
|
4238
4429
|
),
|
|
4239
|
-
/* @__PURE__ */
|
|
4240
|
-
selected ? /* @__PURE__ */
|
|
4241
|
-
!popoverData ? null : /* @__PURE__ */
|
|
4430
|
+
/* @__PURE__ */ jsxs24("div", { css: ObjectListItemInfoContainer, children: [
|
|
4431
|
+
selected ? /* @__PURE__ */ jsx51(Chip, { text: "selected", size: "xs" }) : null,
|
|
4432
|
+
!popoverData ? null : /* @__PURE__ */ jsx51(Popover, { ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
|
|
4242
4433
|
] }),
|
|
4243
|
-
!children ? null : /* @__PURE__ */
|
|
4434
|
+
!children ? null : /* @__PURE__ */ jsx51("div", { css: ObjectListItemUnControlledContent, children })
|
|
4244
4435
|
]
|
|
4245
4436
|
}
|
|
4246
4437
|
);
|
|
4247
4438
|
};
|
|
4248
4439
|
var ObjectSearchListItemLoadingSkeleton = () => {
|
|
4249
|
-
return /* @__PURE__ */
|
|
4440
|
+
return /* @__PURE__ */ jsx51("div", { role: "presentation", css: [ObjectListItemContainer, ObjectListItemLoading] });
|
|
4250
4441
|
};
|
|
4251
4442
|
|
|
4252
4443
|
// src/components/ObjectSearch/ObjectSearchContainer.tsx
|
|
4253
|
-
import { jsx as
|
|
4444
|
+
import { jsx as jsx52, jsxs as jsxs25 } from "@emotion/react/jsx-runtime";
|
|
4254
4445
|
var ObjectSearchContainer = ({
|
|
4255
4446
|
label,
|
|
4256
4447
|
enableDynamicInputToResultId,
|
|
@@ -4262,7 +4453,7 @@ var ObjectSearchContainer = ({
|
|
|
4262
4453
|
const { onSelectItem, selectedListItems, list } = useObjectSearchContext();
|
|
4263
4454
|
const { flatVariables } = useVariables(true);
|
|
4264
4455
|
const inputValue = (_b = (_a = selectedListItems == null ? void 0 : selectedListItems[0]) == null ? void 0 : _a.id) != null ? _b : "";
|
|
4265
|
-
const listItems = resultList != null ? resultList : /* @__PURE__ */
|
|
4456
|
+
const listItems = resultList != null ? resultList : /* @__PURE__ */ jsx52(
|
|
4266
4457
|
ScrollableList,
|
|
4267
4458
|
{
|
|
4268
4459
|
role: "list",
|
|
@@ -4271,10 +4462,10 @@ var ObjectSearchContainer = ({
|
|
|
4271
4462
|
max-height: ${selectedListItems.length === 0 ? "50vh" : "184px"};
|
|
4272
4463
|
}
|
|
4273
4464
|
`,
|
|
4274
|
-
children: /* @__PURE__ */
|
|
4465
|
+
children: /* @__PURE__ */ jsx52(DefaultResultList, {})
|
|
4275
4466
|
}
|
|
4276
4467
|
);
|
|
4277
|
-
const body = /* @__PURE__ */
|
|
4468
|
+
const body = /* @__PURE__ */ jsxs25(VerticalRhythm3, { children: [
|
|
4278
4469
|
searchFilters,
|
|
4279
4470
|
listItems
|
|
4280
4471
|
] });
|
|
@@ -4305,8 +4496,8 @@ var ObjectSearchContainer = ({
|
|
|
4305
4496
|
}
|
|
4306
4497
|
]);
|
|
4307
4498
|
};
|
|
4308
|
-
return /* @__PURE__ */
|
|
4309
|
-
/* @__PURE__ */
|
|
4499
|
+
return /* @__PURE__ */ jsxs25(VerticalRhythm3, { children: [
|
|
4500
|
+
/* @__PURE__ */ jsx52(Container, { backgroundColor: "gray-50", padding: "var(--spacing-base)", border: true, children: label ? /* @__PURE__ */ jsx52(
|
|
4310
4501
|
InputVariables,
|
|
4311
4502
|
{
|
|
4312
4503
|
label,
|
|
@@ -4328,17 +4519,17 @@ var DefaultResultList = () => {
|
|
|
4328
4519
|
var _a;
|
|
4329
4520
|
const { list } = useObjectSearchContext();
|
|
4330
4521
|
if (!list.items) {
|
|
4331
|
-
return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */
|
|
4522
|
+
return Array.from(Array(5).keys()).map((i) => /* @__PURE__ */ jsx52(ObjectSearchListItemLoadingSkeleton, {}, i));
|
|
4332
4523
|
}
|
|
4333
4524
|
if (list.items.length === 0) {
|
|
4334
|
-
return /* @__PURE__ */
|
|
4525
|
+
return /* @__PURE__ */ jsx52(Callout4, { type: "info", children: "No results were found" });
|
|
4335
4526
|
}
|
|
4336
|
-
return (_a = list.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */
|
|
4527
|
+
return (_a = list.items) == null ? void 0 : _a.map((item) => /* @__PURE__ */ jsx52(ObjectSearchListItem, { ...item }, item.id));
|
|
4337
4528
|
};
|
|
4338
4529
|
|
|
4339
4530
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
4340
4531
|
import { DebouncedInputKeywordSearch, InputSelect as InputSelect3 } from "@uniformdev/design-system";
|
|
4341
|
-
import { useMemo as
|
|
4532
|
+
import { useMemo as useMemo14, useState as useState14 } from "react";
|
|
4342
4533
|
|
|
4343
4534
|
// src/components/ObjectSearch/styles/ObjectSearchFilterContainer.styles.ts
|
|
4344
4535
|
import { css as css17 } from "@emotion/react";
|
|
@@ -4361,7 +4552,7 @@ var ObjectSearchFilterGrid = (gridColumns) => css17`
|
|
|
4361
4552
|
`;
|
|
4362
4553
|
|
|
4363
4554
|
// src/components/ObjectSearch/ObjectSearchFilter.tsx
|
|
4364
|
-
import { jsx as
|
|
4555
|
+
import { jsx as jsx53, jsxs as jsxs26 } from "@emotion/react/jsx-runtime";
|
|
4365
4556
|
var ObjectSearchFilter = ({
|
|
4366
4557
|
requireContentType,
|
|
4367
4558
|
typeSelectorAllTypesOptionText = "All content types",
|
|
@@ -4372,7 +4563,7 @@ var ObjectSearchFilter = ({
|
|
|
4372
4563
|
}) => {
|
|
4373
4564
|
var _a, _b;
|
|
4374
4565
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
4375
|
-
const [searchState, setSearchState] =
|
|
4566
|
+
const [searchState, setSearchState] = useState14({
|
|
4376
4567
|
contentType: (_a = query.contentType) != null ? _a : "",
|
|
4377
4568
|
keyword: (_b = query.keyword) != null ? _b : ""
|
|
4378
4569
|
});
|
|
@@ -4382,7 +4573,7 @@ var ObjectSearchFilter = ({
|
|
|
4382
4573
|
});
|
|
4383
4574
|
onSetQuery({ ...query, ...value });
|
|
4384
4575
|
};
|
|
4385
|
-
const memoizedSelectOptions =
|
|
4576
|
+
const memoizedSelectOptions = useMemo14(() => {
|
|
4386
4577
|
if (!requireContentType && !(selectOptions == null ? void 0 : selectOptions.length)) {
|
|
4387
4578
|
return [];
|
|
4388
4579
|
}
|
|
@@ -4392,7 +4583,7 @@ var ObjectSearchFilter = ({
|
|
|
4392
4583
|
];
|
|
4393
4584
|
}, [requireContentType, typeSelectorAllTypesOptionText, selectOptions]);
|
|
4394
4585
|
const shouldRenderSelect = memoizedSelectOptions.length > 0;
|
|
4395
|
-
return /* @__PURE__ */
|
|
4586
|
+
return /* @__PURE__ */ jsxs26(
|
|
4396
4587
|
"fieldset",
|
|
4397
4588
|
{
|
|
4398
4589
|
css: [
|
|
@@ -4400,7 +4591,7 @@ var ObjectSearchFilter = ({
|
|
|
4400
4591
|
ObjectSearchFilterGrid(shouldRenderSelect ? "1fr 2fr" : "1fr")
|
|
4401
4592
|
],
|
|
4402
4593
|
children: [
|
|
4403
|
-
memoizedSelectOptions.length ? /* @__PURE__ */
|
|
4594
|
+
memoizedSelectOptions.length ? /* @__PURE__ */ jsx53(
|
|
4404
4595
|
InputSelect3,
|
|
4405
4596
|
{
|
|
4406
4597
|
label: selectLabel,
|
|
@@ -4410,7 +4601,7 @@ var ObjectSearchFilter = ({
|
|
|
4410
4601
|
value: query.contentType
|
|
4411
4602
|
}
|
|
4412
4603
|
) : null,
|
|
4413
|
-
/* @__PURE__ */
|
|
4604
|
+
/* @__PURE__ */ jsx53(
|
|
4414
4605
|
DebouncedInputKeywordSearch,
|
|
4415
4606
|
{
|
|
4416
4607
|
inputFieldName: searchInputName,
|
|
@@ -4427,9 +4618,9 @@ var ObjectSearchFilter = ({
|
|
|
4427
4618
|
};
|
|
4428
4619
|
|
|
4429
4620
|
// src/components/ObjectSearch/ObjectSearchFilterContainer.tsx
|
|
4430
|
-
import { jsx as
|
|
4621
|
+
import { jsx as jsx54 } from "@emotion/react/jsx-runtime";
|
|
4431
4622
|
var ObjectSearchFilterContainer2 = ({ children }) => {
|
|
4432
|
-
return /* @__PURE__ */
|
|
4623
|
+
return /* @__PURE__ */ jsx54("div", { children: /* @__PURE__ */ jsx54("div", { css: ObjectSearchFilterContainer, children }) });
|
|
4433
4624
|
};
|
|
4434
4625
|
|
|
4435
4626
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
@@ -4437,10 +4628,10 @@ import { Button as Button3, Chip as Chip2, Link, Popover as Popover2 } from "@un
|
|
|
4437
4628
|
import { format as timeagoFormat } from "timeago.js";
|
|
4438
4629
|
|
|
4439
4630
|
// src/components/Image/Image.tsx
|
|
4440
|
-
import { jsx as
|
|
4631
|
+
import { jsx as jsx55 } from "@emotion/react/jsx-runtime";
|
|
4441
4632
|
function Image({ src, alt, className }) {
|
|
4442
4633
|
const CompImage = src && typeof src !== "string" ? src : null;
|
|
4443
|
-
return CompImage ? /* @__PURE__ */
|
|
4634
|
+
return CompImage ? /* @__PURE__ */ jsx55(CompImage, { className }) : /* @__PURE__ */ jsx55("img", { src, alt, className });
|
|
4444
4635
|
}
|
|
4445
4636
|
|
|
4446
4637
|
// src/components/ObjectSearch/styles/ObjectSearchResultItemButton.styles.ts
|
|
@@ -4480,14 +4671,14 @@ var ButtonIcon = css18`
|
|
|
4480
4671
|
`;
|
|
4481
4672
|
|
|
4482
4673
|
// src/components/ObjectSearch/ObjectSearchResultItemButton.tsx
|
|
4483
|
-
import { jsx as
|
|
4674
|
+
import { jsx as jsx56, jsxs as jsxs27 } from "@emotion/react/jsx-runtime";
|
|
4484
4675
|
var ObjectSearchResultItemButton = ({
|
|
4485
4676
|
text,
|
|
4486
4677
|
icon,
|
|
4487
4678
|
...props
|
|
4488
4679
|
}) => {
|
|
4489
|
-
return /* @__PURE__ */
|
|
4490
|
-
!icon ? null : /* @__PURE__ */
|
|
4680
|
+
return /* @__PURE__ */ jsxs27("button", { type: "button", css: ButtonStyles, ...props, children: [
|
|
4681
|
+
!icon ? null : /* @__PURE__ */ jsx56(Image, { src: icon, css: ButtonIcon }),
|
|
4491
4682
|
text
|
|
4492
4683
|
] });
|
|
4493
4684
|
};
|
|
@@ -4496,8 +4687,8 @@ var LinkButton = ({
|
|
|
4496
4687
|
icon,
|
|
4497
4688
|
...props
|
|
4498
4689
|
}) => {
|
|
4499
|
-
return /* @__PURE__ */
|
|
4500
|
-
!icon ? null : /* @__PURE__ */
|
|
4690
|
+
return /* @__PURE__ */ jsxs27("a", { ...props, css: ButtonStyles, target: "_blank", rel: "noopener noreferrer", children: [
|
|
4691
|
+
!icon ? null : /* @__PURE__ */ jsx56(Image, { src: icon, css: ButtonIcon }),
|
|
4501
4692
|
text
|
|
4502
4693
|
] });
|
|
4503
4694
|
};
|
|
@@ -4569,7 +4760,7 @@ var ObjectSearchImage = css19`
|
|
|
4569
4760
|
`;
|
|
4570
4761
|
|
|
4571
4762
|
// src/components/ObjectSearch/ObjectSearchResultItem.tsx
|
|
4572
|
-
import { jsx as
|
|
4763
|
+
import { jsx as jsx57, jsxs as jsxs28 } from "@emotion/react/jsx-runtime";
|
|
4573
4764
|
var ObjectSearchResultItem = ({
|
|
4574
4765
|
id,
|
|
4575
4766
|
title,
|
|
@@ -4593,10 +4784,10 @@ var ObjectSearchResultItem = ({
|
|
|
4593
4784
|
onSelectItem({ id, title: id });
|
|
4594
4785
|
onRemove == null ? void 0 : onRemove();
|
|
4595
4786
|
};
|
|
4596
|
-
return /* @__PURE__ */
|
|
4597
|
-
disableDnD ? null : /* @__PURE__ */
|
|
4598
|
-
/* @__PURE__ */
|
|
4599
|
-
!imageUrl ? null : /* @__PURE__ */
|
|
4787
|
+
return /* @__PURE__ */ jsxs28("div", { css: ObjectSearchResultItemContainer, "data-testid": "search-result-item", children: [
|
|
4788
|
+
disableDnD ? null : /* @__PURE__ */ jsx57("div", { role: "presentation", className: "drag-handle", css: ObjectSearchDragHandle }),
|
|
4789
|
+
/* @__PURE__ */ jsx57("div", { children: /* @__PURE__ */ jsxs28("div", { css: ObjectSearchContentContainer, children: [
|
|
4790
|
+
!imageUrl ? null : /* @__PURE__ */ jsx57(
|
|
4600
4791
|
"img",
|
|
4601
4792
|
{
|
|
4602
4793
|
src: imageUrl,
|
|
@@ -4605,10 +4796,10 @@ var ObjectSearchResultItem = ({
|
|
|
4605
4796
|
loading: "lazy"
|
|
4606
4797
|
}
|
|
4607
4798
|
),
|
|
4608
|
-
/* @__PURE__ */
|
|
4609
|
-
/* @__PURE__ */
|
|
4610
|
-
/* @__PURE__ */
|
|
4611
|
-
onClick ? /* @__PURE__ */
|
|
4799
|
+
/* @__PURE__ */ jsxs28("div", { children: [
|
|
4800
|
+
/* @__PURE__ */ jsx57("span", { css: ObjectSearchResultItemSubtitle, "data-testid": "sub-title", children: formatedContentType }),
|
|
4801
|
+
/* @__PURE__ */ jsxs28("span", { role: "heading", css: ObjectSearchResultItemTitle, "data-testid": "title", children: [
|
|
4802
|
+
onClick ? /* @__PURE__ */ jsx57(
|
|
4612
4803
|
Link,
|
|
4613
4804
|
{
|
|
4614
4805
|
onClick: (e) => {
|
|
@@ -4620,28 +4811,28 @@ var ObjectSearchResultItem = ({
|
|
|
4620
4811
|
text: title != null ? title : name,
|
|
4621
4812
|
css: ObjectSearchResultItemTitleLink
|
|
4622
4813
|
}
|
|
4623
|
-
) : /* @__PURE__ */
|
|
4624
|
-
!popoverData ? null : /* @__PURE__ */
|
|
4814
|
+
) : /* @__PURE__ */ jsx57("span", { children: title != null ? title : name }),
|
|
4815
|
+
!popoverData ? null : /* @__PURE__ */ jsx57(Popover2, { ariaLabel: title, buttonText: `See ${title} details`, children: popoverData })
|
|
4625
4816
|
] }),
|
|
4626
|
-
!createdAt && !publishStatus ? null : /* @__PURE__ */
|
|
4627
|
-
!(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */
|
|
4628
|
-
!createdAt && !publishedAt ? null : /* @__PURE__ */
|
|
4629
|
-
!createdAt ? null : /* @__PURE__ */
|
|
4630
|
-
/* @__PURE__ */
|
|
4817
|
+
!createdAt && !publishStatus ? null : /* @__PURE__ */ jsxs28("div", { css: ObjectSearchAuthorStateGroup, children: [
|
|
4818
|
+
!(publishStatus == null ? void 0 : publishStatus.text) ? null : /* @__PURE__ */ jsx57(Chip2, { theme: legacyThemeMapper(publishStatus.theme), text: publishStatus.text, size: "xs" }),
|
|
4819
|
+
!createdAt && !publishedAt ? null : /* @__PURE__ */ jsxs28("div", { css: ObjectSearchUpdateGroup, children: [
|
|
4820
|
+
!createdAt ? null : /* @__PURE__ */ jsxs28("small", { css: ObjectSearchResultItemTimeStamp, children: [
|
|
4821
|
+
/* @__PURE__ */ jsx57("strong", { children: "Last updated: " }),
|
|
4631
4822
|
timeagoFormat(createdAt)
|
|
4632
4823
|
] }),
|
|
4633
|
-
!publishedAt ? null : /* @__PURE__ */
|
|
4634
|
-
/* @__PURE__ */
|
|
4824
|
+
!publishedAt ? null : /* @__PURE__ */ jsxs28("small", { css: ObjectSearchResultItemTimeStamp, children: [
|
|
4825
|
+
/* @__PURE__ */ jsx57("strong", { children: "Last published: " }),
|
|
4635
4826
|
timeagoFormat(publishedAt)
|
|
4636
4827
|
] })
|
|
4637
4828
|
] })
|
|
4638
4829
|
] }),
|
|
4639
|
-
/* @__PURE__ */
|
|
4830
|
+
/* @__PURE__ */ jsx57("div", { children })
|
|
4640
4831
|
] })
|
|
4641
4832
|
] }) }),
|
|
4642
|
-
!editLink && hideRemoveButton ? null : /* @__PURE__ */
|
|
4643
|
-
!editLink ? null : /* @__PURE__ */
|
|
4644
|
-
hideRemoveButton ? null : /* @__PURE__ */
|
|
4833
|
+
!editLink && hideRemoveButton ? null : /* @__PURE__ */ jsxs28("div", { css: ObjectSearchAuthorStateGroup, children: [
|
|
4834
|
+
!editLink ? null : /* @__PURE__ */ jsx57(LinkButton, { text: "Edit", href: editLink, icon: editLinkIcon }),
|
|
4835
|
+
hideRemoveButton ? null : /* @__PURE__ */ jsx57(Button3, { buttonType: "ghostDestructive", onClick: onRemoveItem, children: "Remove" })
|
|
4645
4836
|
] })
|
|
4646
4837
|
] });
|
|
4647
4838
|
};
|
|
@@ -4693,7 +4884,7 @@ var ObjectSearchResultListTitle = css20`
|
|
|
4693
4884
|
`;
|
|
4694
4885
|
|
|
4695
4886
|
// src/components/ObjectSearch/ObjectSearchResultList.tsx
|
|
4696
|
-
import { Fragment as
|
|
4887
|
+
import { Fragment as Fragment11, jsx as jsx58, jsxs as jsxs29 } from "@emotion/react/jsx-runtime";
|
|
4697
4888
|
var DroppableHack2 = Droppable2;
|
|
4698
4889
|
var DraggableHack2 = Draggable2;
|
|
4699
4890
|
function ObjectSearchResultList({
|
|
@@ -4703,7 +4894,7 @@ function ObjectSearchResultList({
|
|
|
4703
4894
|
hideRemoveButton = false,
|
|
4704
4895
|
resultLabelOverride,
|
|
4705
4896
|
additionalButtons,
|
|
4706
|
-
renderResultComponent = (value) => /* @__PURE__ */
|
|
4897
|
+
renderResultComponent = (value) => /* @__PURE__ */ jsx58(ObjectSearchResultItem, { ...value }),
|
|
4707
4898
|
multiSelectId,
|
|
4708
4899
|
disableDnD = false,
|
|
4709
4900
|
getContainerForDnDReparenting,
|
|
@@ -4730,7 +4921,7 @@ function ObjectSearchResultList({
|
|
|
4730
4921
|
...item,
|
|
4731
4922
|
disableDnD: selectedListItems.length === 1 || disableDnD
|
|
4732
4923
|
});
|
|
4733
|
-
return /* @__PURE__ */
|
|
4924
|
+
return /* @__PURE__ */ jsx58(
|
|
4734
4925
|
"div",
|
|
4735
4926
|
{
|
|
4736
4927
|
css: [
|
|
@@ -4745,16 +4936,16 @@ function ObjectSearchResultList({
|
|
|
4745
4936
|
}
|
|
4746
4937
|
);
|
|
4747
4938
|
};
|
|
4748
|
-
return /* @__PURE__ */
|
|
4749
|
-
/* @__PURE__ */
|
|
4750
|
-
!resultLabelOverride ? /* @__PURE__ */
|
|
4751
|
-
/* @__PURE__ */
|
|
4939
|
+
return /* @__PURE__ */ jsxs29(Fragment11, { children: [
|
|
4940
|
+
/* @__PURE__ */ jsxs29("div", { role: "group", css: ObjectSearchResultListContainer, children: [
|
|
4941
|
+
!resultLabelOverride ? /* @__PURE__ */ jsxs29("div", { role: "note", css: ObjectSearchResultListCounterContainer, children: [
|
|
4942
|
+
/* @__PURE__ */ jsx58("span", { css: ObjectSearchResultListTitle, children: resultLabelText }),
|
|
4752
4943
|
" ",
|
|
4753
|
-
!selectedListItems.length ? null : /* @__PURE__ */
|
|
4944
|
+
!selectedListItems.length ? null : /* @__PURE__ */ jsx58(Counter, { count: selectedListItems.length })
|
|
4754
4945
|
] }) : resultLabelOverride,
|
|
4755
|
-
/* @__PURE__ */
|
|
4946
|
+
/* @__PURE__ */ jsxs29("div", { css: ObjectSearchResultListCounterContainer, children: [
|
|
4756
4947
|
additionalButtons,
|
|
4757
|
-
hideRemoveButton ? null : /* @__PURE__ */
|
|
4948
|
+
hideRemoveButton ? null : /* @__PURE__ */ jsx58(
|
|
4758
4949
|
Button4,
|
|
4759
4950
|
{
|
|
4760
4951
|
buttonType: "ghostDestructive",
|
|
@@ -4766,15 +4957,15 @@ function ObjectSearchResultList({
|
|
|
4766
4957
|
)
|
|
4767
4958
|
] })
|
|
4768
4959
|
] }),
|
|
4769
|
-
!selectedListItems.length ? whenNothingSelected : /* @__PURE__ */
|
|
4960
|
+
!selectedListItems.length ? whenNothingSelected : /* @__PURE__ */ jsx58(DragDropContext, { onDragEnd: (res) => onDragEnd(res), children: /* @__PURE__ */ jsx58(
|
|
4770
4961
|
DroppableHack2,
|
|
4771
4962
|
{
|
|
4772
4963
|
droppableId: multiSelectId != null ? multiSelectId : "canvas-multi-select",
|
|
4773
4964
|
renderClone: getContainerForDnDReparenting ? getDraggableItem : void 0,
|
|
4774
4965
|
getContainerForClone: getContainerForDnDReparenting,
|
|
4775
|
-
children: (provided) => /* @__PURE__ */
|
|
4966
|
+
children: (provided) => /* @__PURE__ */ jsxs29("div", { ...provided.droppableProps, ref: provided.innerRef, children: [
|
|
4776
4967
|
selectedListItems.map((item, i) => {
|
|
4777
|
-
return /* @__PURE__ */
|
|
4968
|
+
return /* @__PURE__ */ jsx58(
|
|
4778
4969
|
DraggableHack2,
|
|
4779
4970
|
{
|
|
4780
4971
|
draggableId: item.id,
|
|
@@ -4794,8 +4985,8 @@ function ObjectSearchResultList({
|
|
|
4794
4985
|
|
|
4795
4986
|
// src/components/ObjectSearch/QueryFilter.tsx
|
|
4796
4987
|
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
|
|
4988
|
+
import { useEffect as useEffect14, useState as useState15 } from "react";
|
|
4989
|
+
import { jsx as jsx59, jsxs as jsxs30 } from "@emotion/react/jsx-runtime";
|
|
4799
4990
|
var QueryFilter = ({
|
|
4800
4991
|
requireContentType,
|
|
4801
4992
|
queryFilterTitle = "Configure Query",
|
|
@@ -4823,7 +5014,7 @@ var QueryFilter = ({
|
|
|
4823
5014
|
}) => {
|
|
4824
5015
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
4825
5016
|
const { query, onSetQuery } = useObjectSearchContext();
|
|
4826
|
-
const [queryState, setQueryState] =
|
|
5017
|
+
const [queryState, setQueryState] = useState15({
|
|
4827
5018
|
contentType: (_a = query.contentType) != null ? _a : "",
|
|
4828
5019
|
keyword: (_b = query.keyword) != null ? _b : "",
|
|
4829
5020
|
count: (_c = query.count) != null ? _c : 5,
|
|
@@ -4834,13 +5025,13 @@ var QueryFilter = ({
|
|
|
4834
5025
|
setQueryState((prev) => ({ ...prev, ...value }));
|
|
4835
5026
|
onSetQuery({ ...query, ...value });
|
|
4836
5027
|
};
|
|
4837
|
-
|
|
5028
|
+
useEffect14(() => {
|
|
4838
5029
|
onSetQuery(queryState);
|
|
4839
5030
|
}, []);
|
|
4840
|
-
return /* @__PURE__ */
|
|
4841
|
-
/* @__PURE__ */
|
|
4842
|
-
/* @__PURE__ */
|
|
4843
|
-
/* @__PURE__ */
|
|
5031
|
+
return /* @__PURE__ */ jsxs30("fieldset", { children: [
|
|
5032
|
+
/* @__PURE__ */ jsx59("span", { css: ObjectSearchFilterContainerLabel, children: queryFilterTitle }),
|
|
5033
|
+
/* @__PURE__ */ jsx59("div", { css: ObjectSearchFilterContainer, children: /* @__PURE__ */ jsxs30(VerticalRhythm4, { children: [
|
|
5034
|
+
/* @__PURE__ */ jsx59(
|
|
4844
5035
|
InputVariables,
|
|
4845
5036
|
{
|
|
4846
5037
|
label: searchInputLabel,
|
|
@@ -4848,7 +5039,7 @@ var QueryFilter = ({
|
|
|
4848
5039
|
onChange: (newQuery) => handleFilterChange({ keyword: newQuery }),
|
|
4849
5040
|
disableInlineMenu: true,
|
|
4850
5041
|
id: "qf_searchText",
|
|
4851
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
5042
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx59(
|
|
4852
5043
|
DebouncedInputKeywordSearch2,
|
|
4853
5044
|
{
|
|
4854
5045
|
id: "qf_searchText",
|
|
@@ -4862,8 +5053,8 @@ var QueryFilter = ({
|
|
|
4862
5053
|
)
|
|
4863
5054
|
}
|
|
4864
5055
|
),
|
|
4865
|
-
/* @__PURE__ */
|
|
4866
|
-
/* @__PURE__ */
|
|
5056
|
+
/* @__PURE__ */ jsxs30("div", { css: ObjectSearchFilterGrid("1fr 100px"), children: [
|
|
5057
|
+
/* @__PURE__ */ jsx59(
|
|
4867
5058
|
InputVariables,
|
|
4868
5059
|
{
|
|
4869
5060
|
label: contentTypeLabel,
|
|
@@ -4871,7 +5062,7 @@ var QueryFilter = ({
|
|
|
4871
5062
|
value: (_g = queryState.contentType) != null ? _g : "",
|
|
4872
5063
|
onChange: (newType) => handleFilterChange({ contentType: newType }),
|
|
4873
5064
|
disableInlineMenu: true,
|
|
4874
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
5065
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx59(
|
|
4875
5066
|
InputSelect4,
|
|
4876
5067
|
{
|
|
4877
5068
|
id: "qf_contentType",
|
|
@@ -4885,7 +5076,7 @@ var QueryFilter = ({
|
|
|
4885
5076
|
)
|
|
4886
5077
|
}
|
|
4887
5078
|
),
|
|
4888
|
-
/* @__PURE__ */
|
|
5079
|
+
/* @__PURE__ */ jsx59(
|
|
4889
5080
|
InputVariables,
|
|
4890
5081
|
{
|
|
4891
5082
|
label: countLabel,
|
|
@@ -4894,7 +5085,7 @@ var QueryFilter = ({
|
|
|
4894
5085
|
onChange: (newCount) => handleFilterChange({ count: newCount }),
|
|
4895
5086
|
disableInlineMenu: true,
|
|
4896
5087
|
valueToResetTo: "5",
|
|
4897
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
5088
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx59(
|
|
4898
5089
|
Input4,
|
|
4899
5090
|
{
|
|
4900
5091
|
id: "qf_count",
|
|
@@ -4909,8 +5100,8 @@ var QueryFilter = ({
|
|
|
4909
5100
|
}
|
|
4910
5101
|
)
|
|
4911
5102
|
] }),
|
|
4912
|
-
/* @__PURE__ */
|
|
4913
|
-
/* @__PURE__ */
|
|
5103
|
+
/* @__PURE__ */ jsxs30("div", { css: ObjectSearchFilterGrid("2fr 1fr"), children: [
|
|
5104
|
+
/* @__PURE__ */ jsx59(
|
|
4914
5105
|
InputVariables,
|
|
4915
5106
|
{
|
|
4916
5107
|
id: "qf_sortBy",
|
|
@@ -4918,7 +5109,7 @@ var QueryFilter = ({
|
|
|
4918
5109
|
value: queryState.sortBy,
|
|
4919
5110
|
onChange: (newSortBy) => handleFilterChange({ sortBy: newSortBy }),
|
|
4920
5111
|
disableInlineMenu: true,
|
|
4921
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
5112
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx59(
|
|
4922
5113
|
InputSelect4,
|
|
4923
5114
|
{
|
|
4924
5115
|
label: sortLabel,
|
|
@@ -4932,7 +5123,7 @@ var QueryFilter = ({
|
|
|
4932
5123
|
)
|
|
4933
5124
|
}
|
|
4934
5125
|
),
|
|
4935
|
-
/* @__PURE__ */
|
|
5126
|
+
/* @__PURE__ */ jsx59(
|
|
4936
5127
|
InputVariables,
|
|
4937
5128
|
{
|
|
4938
5129
|
label: sortOrderLabel,
|
|
@@ -4940,7 +5131,7 @@ var QueryFilter = ({
|
|
|
4940
5131
|
value: queryState.sortOrder,
|
|
4941
5132
|
onChange: (newSort) => handleFilterChange({ sortOrder: newSort }),
|
|
4942
5133
|
disableInlineMenu: true,
|
|
4943
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
5134
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx59(
|
|
4944
5135
|
InputSelect4,
|
|
4945
5136
|
{
|
|
4946
5137
|
label: sortOrderLabel,
|
|
@@ -4960,8 +5151,8 @@ var QueryFilter = ({
|
|
|
4960
5151
|
};
|
|
4961
5152
|
|
|
4962
5153
|
// src/components/ParamTypeDynamicDataProvider.tsx
|
|
4963
|
-
import { useEffect as
|
|
4964
|
-
import { jsx as
|
|
5154
|
+
import { useEffect as useEffect15, useMemo as useMemo15, useRef as useRef9 } from "react";
|
|
5155
|
+
import { jsx as jsx60 } from "@emotion/react/jsx-runtime";
|
|
4965
5156
|
function ParamTypeDynamicDataProvider(props) {
|
|
4966
5157
|
const { children } = props;
|
|
4967
5158
|
const {
|
|
@@ -4969,11 +5160,11 @@ function ParamTypeDynamicDataProvider(props) {
|
|
|
4969
5160
|
} = useMeshLocation("paramType");
|
|
4970
5161
|
const dynamicInputsAsVariables = useDynamicInputsAsVariables(dynamicInputs);
|
|
4971
5162
|
const connectedDataAsVariables = useConnectedDataAsVariables(connectedData);
|
|
4972
|
-
const variables =
|
|
5163
|
+
const variables = useMemo15(
|
|
4973
5164
|
() => ({ ...connectedDataAsVariables, ...dynamicInputsAsVariables }),
|
|
4974
5165
|
[dynamicInputsAsVariables, connectedDataAsVariables]
|
|
4975
5166
|
);
|
|
4976
|
-
return /* @__PURE__ */
|
|
5167
|
+
return /* @__PURE__ */ jsx60(VariablesProvider, { value: variables, onChange: () => {
|
|
4977
5168
|
}, editVariableComponent: JsonMeshVariableEditor, children });
|
|
4978
5169
|
}
|
|
4979
5170
|
var JsonMeshVariableEditor = ({
|
|
@@ -4982,9 +5173,9 @@ var JsonMeshVariableEditor = ({
|
|
|
4982
5173
|
variable,
|
|
4983
5174
|
context
|
|
4984
5175
|
}) => {
|
|
4985
|
-
const sillyRef =
|
|
5176
|
+
const sillyRef = useRef9(false);
|
|
4986
5177
|
const { editConnectedData } = useMeshLocation("paramType");
|
|
4987
|
-
|
|
5178
|
+
useEffect15(() => {
|
|
4988
5179
|
if (sillyRef.current) {
|
|
4989
5180
|
return;
|
|
4990
5181
|
}
|
|
@@ -5420,6 +5611,12 @@ var MULTI_SELECT_OPERATORS = [
|
|
|
5420
5611
|
editorType: "multiChoice",
|
|
5421
5612
|
expectedValueType: "array"
|
|
5422
5613
|
},
|
|
5614
|
+
{
|
|
5615
|
+
label: "is all of...",
|
|
5616
|
+
value: "all",
|
|
5617
|
+
editorType: "multiChoice",
|
|
5618
|
+
expectedValueType: "array"
|
|
5619
|
+
},
|
|
5423
5620
|
{
|
|
5424
5621
|
label: "is empty",
|
|
5425
5622
|
value: "ndef",
|
|
@@ -5448,9 +5645,9 @@ var MULTI_SELECT_OPERATORS = [
|
|
|
5448
5645
|
|
|
5449
5646
|
// src/components/SearchAndFilter/editors/DateEditor.tsx
|
|
5450
5647
|
import { Input as Input5 } from "@uniformdev/design-system";
|
|
5451
|
-
import { useState as
|
|
5648
|
+
import { useState as useState16 } from "react";
|
|
5452
5649
|
import { useDebounce as useDebounce2 } from "react-use";
|
|
5453
|
-
import { jsx as
|
|
5650
|
+
import { jsx as jsx61 } from "@emotion/react/jsx-runtime";
|
|
5454
5651
|
var DateEditor = ({
|
|
5455
5652
|
onChange,
|
|
5456
5653
|
ariaLabel,
|
|
@@ -5459,9 +5656,9 @@ var DateEditor = ({
|
|
|
5459
5656
|
readOnly,
|
|
5460
5657
|
valueTestId
|
|
5461
5658
|
}) => {
|
|
5462
|
-
const [innerValue, setInnerValue] =
|
|
5659
|
+
const [innerValue, setInnerValue] = useState16(value != null ? value : "");
|
|
5463
5660
|
useDebounce2(() => onChange(innerValue), 500, [innerValue]);
|
|
5464
|
-
return /* @__PURE__ */
|
|
5661
|
+
return /* @__PURE__ */ jsx61(
|
|
5465
5662
|
Input5,
|
|
5466
5663
|
{
|
|
5467
5664
|
type: "date",
|
|
@@ -5478,21 +5675,21 @@ var DateEditor = ({
|
|
|
5478
5675
|
|
|
5479
5676
|
// src/components/SearchAndFilter/editors/DateRangeEditor.tsx
|
|
5480
5677
|
import { Input as Input6 } from "@uniformdev/design-system";
|
|
5481
|
-
import { useEffect as
|
|
5678
|
+
import { useEffect as useEffect16, useState as useState17 } from "react";
|
|
5482
5679
|
import { useDebounce as useDebounce3 } from "react-use";
|
|
5483
5680
|
|
|
5484
5681
|
// src/components/SearchAndFilter/editors/shared/ErrorContainer.tsx
|
|
5485
5682
|
import { FieldMessage } from "@uniformdev/design-system";
|
|
5486
|
-
import { jsx as
|
|
5683
|
+
import { jsx as jsx62 } from "@emotion/react/jsx-runtime";
|
|
5487
5684
|
var ErrorContainer = ({ errorMessage }) => {
|
|
5488
|
-
return /* @__PURE__ */
|
|
5685
|
+
return /* @__PURE__ */ jsx62(
|
|
5489
5686
|
"div",
|
|
5490
5687
|
{
|
|
5491
5688
|
css: {
|
|
5492
5689
|
gridColumn: "span 6",
|
|
5493
5690
|
order: 6
|
|
5494
5691
|
},
|
|
5495
|
-
children: /* @__PURE__ */
|
|
5692
|
+
children: /* @__PURE__ */ jsx62(FieldMessage, { errorMessage })
|
|
5496
5693
|
}
|
|
5497
5694
|
);
|
|
5498
5695
|
};
|
|
@@ -5505,7 +5702,7 @@ var twoColumnGrid = {
|
|
|
5505
5702
|
};
|
|
5506
5703
|
|
|
5507
5704
|
// src/components/SearchAndFilter/editors/DateRangeEditor.tsx
|
|
5508
|
-
import { Fragment as
|
|
5705
|
+
import { Fragment as Fragment12, jsx as jsx63, jsxs as jsxs31 } from "@emotion/react/jsx-runtime";
|
|
5509
5706
|
var DateRangeEditor = ({
|
|
5510
5707
|
ariaLabel,
|
|
5511
5708
|
onChange,
|
|
@@ -5514,9 +5711,9 @@ var DateRangeEditor = ({
|
|
|
5514
5711
|
readOnly,
|
|
5515
5712
|
valueTestId
|
|
5516
5713
|
}) => {
|
|
5517
|
-
const [minDateValue, setMinDateValue] =
|
|
5518
|
-
const [maxDateValue, setMaxDateValue] =
|
|
5519
|
-
const [error, setError] =
|
|
5714
|
+
const [minDateValue, setMinDateValue] = useState17(value ? value[0] : "");
|
|
5715
|
+
const [maxDateValue, setMaxDateValue] = useState17(value ? value[1] : "");
|
|
5716
|
+
const [error, setError] = useState17("");
|
|
5520
5717
|
useDebounce3(
|
|
5521
5718
|
() => {
|
|
5522
5719
|
if (minDateValue && maxDateValue && !error) {
|
|
@@ -5528,7 +5725,7 @@ var DateRangeEditor = ({
|
|
|
5528
5725
|
500,
|
|
5529
5726
|
[minDateValue, maxDateValue]
|
|
5530
5727
|
);
|
|
5531
|
-
|
|
5728
|
+
useEffect16(() => {
|
|
5532
5729
|
if (!minDateValue || !maxDateValue) {
|
|
5533
5730
|
return;
|
|
5534
5731
|
}
|
|
@@ -5563,9 +5760,9 @@ var DateRangeEditor = ({
|
|
|
5563
5760
|
setMaxDateValue("");
|
|
5564
5761
|
}
|
|
5565
5762
|
}, [minDateValue, maxDateValue, setError]);
|
|
5566
|
-
return /* @__PURE__ */
|
|
5567
|
-
/* @__PURE__ */
|
|
5568
|
-
/* @__PURE__ */
|
|
5763
|
+
return /* @__PURE__ */ jsxs31(Fragment12, { children: [
|
|
5764
|
+
/* @__PURE__ */ jsxs31("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
5765
|
+
/* @__PURE__ */ jsx63(
|
|
5569
5766
|
Input6,
|
|
5570
5767
|
{
|
|
5571
5768
|
label: `${ariaLabel}-min-date`,
|
|
@@ -5579,7 +5776,7 @@ var DateRangeEditor = ({
|
|
|
5579
5776
|
"data-testid": "value-low"
|
|
5580
5777
|
}
|
|
5581
5778
|
),
|
|
5582
|
-
/* @__PURE__ */
|
|
5779
|
+
/* @__PURE__ */ jsx63(
|
|
5583
5780
|
Input6,
|
|
5584
5781
|
{
|
|
5585
5782
|
label: `${ariaLabel}-max-date`,
|
|
@@ -5594,7 +5791,7 @@ var DateRangeEditor = ({
|
|
|
5594
5791
|
}
|
|
5595
5792
|
)
|
|
5596
5793
|
] }),
|
|
5597
|
-
/* @__PURE__ */
|
|
5794
|
+
/* @__PURE__ */ jsx63(ErrorContainer, { errorMessage: error })
|
|
5598
5795
|
] });
|
|
5599
5796
|
};
|
|
5600
5797
|
|
|
@@ -5604,7 +5801,7 @@ import {
|
|
|
5604
5801
|
getComboBoxSelectedSelectableGroups,
|
|
5605
5802
|
InputComboBox
|
|
5606
5803
|
} from "@uniformdev/design-system";
|
|
5607
|
-
import { useMemo as
|
|
5804
|
+
import { useMemo as useMemo16 } from "react";
|
|
5608
5805
|
|
|
5609
5806
|
// src/components/SearchAndFilter/editors/shared/readOnlyAttributes.tsx
|
|
5610
5807
|
var readOnlyAttributes = {
|
|
@@ -5614,7 +5811,7 @@ var readOnlyAttributes = {
|
|
|
5614
5811
|
};
|
|
5615
5812
|
|
|
5616
5813
|
// src/components/SearchAndFilter/editors/FilterMultiChoiceEditor.tsx
|
|
5617
|
-
import { jsx as
|
|
5814
|
+
import { jsx as jsx64 } from "@emotion/react/jsx-runtime";
|
|
5618
5815
|
var FilterMultiChoiceEditor = ({
|
|
5619
5816
|
value,
|
|
5620
5817
|
options,
|
|
@@ -5625,11 +5822,11 @@ var FilterMultiChoiceEditor = ({
|
|
|
5625
5822
|
}) => {
|
|
5626
5823
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
5627
5824
|
const isClearable = !readOnly || !disabled;
|
|
5628
|
-
const { groupedOptions, selectedOptions } =
|
|
5825
|
+
const { groupedOptions, selectedOptions } = useMemo16(
|
|
5629
5826
|
() => convertComboBoxGroupsToSelectableGroups({ options: options != null ? options : [], selectedItems: new Set(value) }),
|
|
5630
5827
|
[options, value]
|
|
5631
5828
|
);
|
|
5632
|
-
return /* @__PURE__ */
|
|
5829
|
+
return /* @__PURE__ */ jsx64("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx64(
|
|
5633
5830
|
InputComboBox,
|
|
5634
5831
|
{
|
|
5635
5832
|
...props,
|
|
@@ -5662,8 +5859,8 @@ import {
|
|
|
5662
5859
|
convertComboBoxGroupsToSelectableGroups as convertComboBoxGroupsToSelectableGroups2,
|
|
5663
5860
|
InputComboBox as InputComboBox2
|
|
5664
5861
|
} from "@uniformdev/design-system";
|
|
5665
|
-
import { useMemo as
|
|
5666
|
-
import { jsx as
|
|
5862
|
+
import { useMemo as useMemo17 } from "react";
|
|
5863
|
+
import { jsx as jsx65 } from "@emotion/react/jsx-runtime";
|
|
5667
5864
|
var FilterSingleChoiceEditor = ({
|
|
5668
5865
|
options,
|
|
5669
5866
|
value,
|
|
@@ -5673,7 +5870,7 @@ var FilterSingleChoiceEditor = ({
|
|
|
5673
5870
|
valueTestId
|
|
5674
5871
|
}) => {
|
|
5675
5872
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
5676
|
-
const { groupedOptions, selectedOptions } =
|
|
5873
|
+
const { groupedOptions, selectedOptions } = useMemo17(
|
|
5677
5874
|
() => convertComboBoxGroupsToSelectableGroups2({
|
|
5678
5875
|
options: options != null ? options : [],
|
|
5679
5876
|
selectedItems: new Set(value ? [String(value)] : void 0),
|
|
@@ -5681,7 +5878,7 @@ var FilterSingleChoiceEditor = ({
|
|
|
5681
5878
|
}),
|
|
5682
5879
|
[options, value]
|
|
5683
5880
|
);
|
|
5684
|
-
return /* @__PURE__ */
|
|
5881
|
+
return /* @__PURE__ */ jsx65("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx65(
|
|
5685
5882
|
InputComboBox2,
|
|
5686
5883
|
{
|
|
5687
5884
|
placeholder: "Type to search...",
|
|
@@ -5711,9 +5908,9 @@ var FilterSingleChoiceEditor = ({
|
|
|
5711
5908
|
|
|
5712
5909
|
// src/components/SearchAndFilter/editors/NumberEditor.tsx
|
|
5713
5910
|
import { Input as Input7 } from "@uniformdev/design-system";
|
|
5714
|
-
import { useState as
|
|
5911
|
+
import { useState as useState18 } from "react";
|
|
5715
5912
|
import { useDebounce as useDebounce4 } from "react-use";
|
|
5716
|
-
import { jsx as
|
|
5913
|
+
import { jsx as jsx66 } from "@emotion/react/jsx-runtime";
|
|
5717
5914
|
var NumberEditor = ({
|
|
5718
5915
|
ariaLabel,
|
|
5719
5916
|
onChange,
|
|
@@ -5722,9 +5919,9 @@ var NumberEditor = ({
|
|
|
5722
5919
|
readOnly,
|
|
5723
5920
|
valueTestId
|
|
5724
5921
|
}) => {
|
|
5725
|
-
const [innerValue, setInnerValue] =
|
|
5922
|
+
const [innerValue, setInnerValue] = useState18(value != null ? value : "");
|
|
5726
5923
|
useDebounce4(() => onChange(innerValue), 500, [innerValue]);
|
|
5727
|
-
return /* @__PURE__ */
|
|
5924
|
+
return /* @__PURE__ */ jsx66(
|
|
5728
5925
|
Input7,
|
|
5729
5926
|
{
|
|
5730
5927
|
label: ariaLabel,
|
|
@@ -5742,9 +5939,9 @@ var NumberEditor = ({
|
|
|
5742
5939
|
|
|
5743
5940
|
// src/components/SearchAndFilter/editors/NumberRangeEditor.tsx
|
|
5744
5941
|
import { Input as Input8 } from "@uniformdev/design-system";
|
|
5745
|
-
import { useEffect as
|
|
5942
|
+
import { useEffect as useEffect17, useState as useState19 } from "react";
|
|
5746
5943
|
import { useDebounce as useDebounce5 } from "react-use";
|
|
5747
|
-
import { Fragment as
|
|
5944
|
+
import { Fragment as Fragment13, jsx as jsx67, jsxs as jsxs32 } from "@emotion/react/jsx-runtime";
|
|
5748
5945
|
var NumberRangeEditor = ({
|
|
5749
5946
|
onChange,
|
|
5750
5947
|
disabled,
|
|
@@ -5753,9 +5950,9 @@ var NumberRangeEditor = ({
|
|
|
5753
5950
|
readOnly,
|
|
5754
5951
|
valueTestId
|
|
5755
5952
|
}) => {
|
|
5756
|
-
const [minValue, setMinValue] =
|
|
5757
|
-
const [maxValue, setMaxValue] =
|
|
5758
|
-
const [error, setError] =
|
|
5953
|
+
const [minValue, setMinValue] = useState19("");
|
|
5954
|
+
const [maxValue, setMaxValue] = useState19("");
|
|
5955
|
+
const [error, setError] = useState19("");
|
|
5759
5956
|
useDebounce5(
|
|
5760
5957
|
() => {
|
|
5761
5958
|
if (minValue && maxValue && !error) {
|
|
@@ -5767,7 +5964,7 @@ var NumberRangeEditor = ({
|
|
|
5767
5964
|
500,
|
|
5768
5965
|
[minValue, maxValue]
|
|
5769
5966
|
);
|
|
5770
|
-
|
|
5967
|
+
useEffect17(() => {
|
|
5771
5968
|
if (!maxValue && !minValue) {
|
|
5772
5969
|
return;
|
|
5773
5970
|
}
|
|
@@ -5789,9 +5986,9 @@ var NumberRangeEditor = ({
|
|
|
5789
5986
|
setMaxValue(maxValue);
|
|
5790
5987
|
}
|
|
5791
5988
|
}, [maxValue, minValue, setError]);
|
|
5792
|
-
return /* @__PURE__ */
|
|
5793
|
-
/* @__PURE__ */
|
|
5794
|
-
/* @__PURE__ */
|
|
5989
|
+
return /* @__PURE__ */ jsxs32(Fragment13, { children: [
|
|
5990
|
+
/* @__PURE__ */ jsxs32("div", { css: twoColumnGrid, "data-testid": valueTestId, children: [
|
|
5991
|
+
/* @__PURE__ */ jsx67(
|
|
5795
5992
|
Input8,
|
|
5796
5993
|
{
|
|
5797
5994
|
label: `${ariaLabel}-min`,
|
|
@@ -5807,7 +6004,7 @@ var NumberRangeEditor = ({
|
|
|
5807
6004
|
"data-testid": "value-low"
|
|
5808
6005
|
}
|
|
5809
6006
|
),
|
|
5810
|
-
/* @__PURE__ */
|
|
6007
|
+
/* @__PURE__ */ jsx67(
|
|
5811
6008
|
Input8,
|
|
5812
6009
|
{
|
|
5813
6010
|
type: "number",
|
|
@@ -5824,7 +6021,7 @@ var NumberRangeEditor = ({
|
|
|
5824
6021
|
}
|
|
5825
6022
|
)
|
|
5826
6023
|
] }),
|
|
5827
|
-
/* @__PURE__ */
|
|
6024
|
+
/* @__PURE__ */ jsx67(ErrorContainer, { errorMessage: error })
|
|
5828
6025
|
] });
|
|
5829
6026
|
};
|
|
5830
6027
|
|
|
@@ -5834,13 +6031,13 @@ import {
|
|
|
5834
6031
|
getComboBoxSelectedSelectableGroups as getComboBoxSelectedSelectableGroups2,
|
|
5835
6032
|
InputComboBox as InputComboBox3
|
|
5836
6033
|
} from "@uniformdev/design-system";
|
|
5837
|
-
import { useMemo as
|
|
6034
|
+
import { useMemo as useMemo18 } from "react";
|
|
5838
6035
|
|
|
5839
6036
|
// src/components/SearchAndFilter/editors/shared/CustomOptions.tsx
|
|
5840
6037
|
import { StatusBullet } from "@uniformdev/design-system";
|
|
5841
|
-
import { jsx as
|
|
6038
|
+
import { jsx as jsx68 } from "@emotion/react/jsx-runtime";
|
|
5842
6039
|
var CustomOptions = ({ label, value }) => {
|
|
5843
|
-
return /* @__PURE__ */
|
|
6040
|
+
return /* @__PURE__ */ jsx68(
|
|
5844
6041
|
StatusBullet,
|
|
5845
6042
|
{
|
|
5846
6043
|
status: label,
|
|
@@ -5850,7 +6047,7 @@ var CustomOptions = ({ label, value }) => {
|
|
|
5850
6047
|
};
|
|
5851
6048
|
|
|
5852
6049
|
// src/components/SearchAndFilter/editors/StatusMultiEditor.tsx
|
|
5853
|
-
import { jsx as
|
|
6050
|
+
import { jsx as jsx69 } from "@emotion/react/jsx-runtime";
|
|
5854
6051
|
var StatusMultiEditor = ({
|
|
5855
6052
|
options,
|
|
5856
6053
|
value,
|
|
@@ -5860,11 +6057,11 @@ var StatusMultiEditor = ({
|
|
|
5860
6057
|
valueTestId
|
|
5861
6058
|
}) => {
|
|
5862
6059
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
5863
|
-
const { groupedOptions, selectedOptions } =
|
|
6060
|
+
const { groupedOptions, selectedOptions } = useMemo18(
|
|
5864
6061
|
() => convertComboBoxGroupsToSelectableGroups3({ options: options != null ? options : [], selectedItems: new Set(value) }),
|
|
5865
6062
|
[options, value]
|
|
5866
6063
|
);
|
|
5867
|
-
return /* @__PURE__ */
|
|
6064
|
+
return /* @__PURE__ */ jsx69("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx69(
|
|
5868
6065
|
InputComboBox3,
|
|
5869
6066
|
{
|
|
5870
6067
|
options: groupedOptions != null ? groupedOptions : [],
|
|
@@ -5895,8 +6092,8 @@ import {
|
|
|
5895
6092
|
convertComboBoxGroupsToSelectableGroups as convertComboBoxGroupsToSelectableGroups4,
|
|
5896
6093
|
InputComboBox as InputComboBox4
|
|
5897
6094
|
} from "@uniformdev/design-system";
|
|
5898
|
-
import { useMemo as
|
|
5899
|
-
import { jsx as
|
|
6095
|
+
import { useMemo as useMemo19 } from "react";
|
|
6096
|
+
import { jsx as jsx70 } from "@emotion/react/jsx-runtime";
|
|
5900
6097
|
var StatusSingleEditor = ({
|
|
5901
6098
|
options,
|
|
5902
6099
|
value,
|
|
@@ -5906,7 +6103,7 @@ var StatusSingleEditor = ({
|
|
|
5906
6103
|
valueTestId
|
|
5907
6104
|
}) => {
|
|
5908
6105
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
5909
|
-
const { groupedOptions, selectedOptions } =
|
|
6106
|
+
const { groupedOptions, selectedOptions } = useMemo19(
|
|
5910
6107
|
() => convertComboBoxGroupsToSelectableGroups4({
|
|
5911
6108
|
options: options != null ? options : [],
|
|
5912
6109
|
selectedItems: new Set(value ? [value] : void 0),
|
|
@@ -5914,7 +6111,7 @@ var StatusSingleEditor = ({
|
|
|
5914
6111
|
}),
|
|
5915
6112
|
[options, value]
|
|
5916
6113
|
);
|
|
5917
|
-
return /* @__PURE__ */
|
|
6114
|
+
return /* @__PURE__ */ jsx70("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx70(
|
|
5918
6115
|
InputComboBox4,
|
|
5919
6116
|
{
|
|
5920
6117
|
options: groupedOptions,
|
|
@@ -5943,9 +6140,9 @@ var StatusSingleEditor = ({
|
|
|
5943
6140
|
|
|
5944
6141
|
// src/components/SearchAndFilter/editors/TextEditor.tsx
|
|
5945
6142
|
import { Input as Input9 } from "@uniformdev/design-system";
|
|
5946
|
-
import { useState as
|
|
6143
|
+
import { useState as useState20 } from "react";
|
|
5947
6144
|
import { useDebounce as useDebounce6 } from "react-use";
|
|
5948
|
-
import { jsx as
|
|
6145
|
+
import { jsx as jsx71 } from "@emotion/react/jsx-runtime";
|
|
5949
6146
|
var TextEditor = ({
|
|
5950
6147
|
onChange,
|
|
5951
6148
|
ariaLabel,
|
|
@@ -5953,9 +6150,9 @@ var TextEditor = ({
|
|
|
5953
6150
|
readOnly,
|
|
5954
6151
|
valueTestId
|
|
5955
6152
|
}) => {
|
|
5956
|
-
const [innerValue, setInnerValue] =
|
|
6153
|
+
const [innerValue, setInnerValue] = useState20(value != null ? value : "");
|
|
5957
6154
|
useDebounce6(() => onChange(innerValue), 500, [innerValue]);
|
|
5958
|
-
return /* @__PURE__ */
|
|
6155
|
+
return /* @__PURE__ */ jsx71(
|
|
5959
6156
|
Input9,
|
|
5960
6157
|
{
|
|
5961
6158
|
showLabel: false,
|
|
@@ -5975,8 +6172,8 @@ import {
|
|
|
5975
6172
|
getComboBoxSelectedSelectableGroups as getComboBoxSelectedSelectableGroups3,
|
|
5976
6173
|
InputCreatableComboBox
|
|
5977
6174
|
} from "@uniformdev/design-system";
|
|
5978
|
-
import { useMemo as
|
|
5979
|
-
import { jsx as
|
|
6175
|
+
import { useMemo as useMemo20 } from "react";
|
|
6176
|
+
import { jsx as jsx72 } from "@emotion/react/jsx-runtime";
|
|
5980
6177
|
var TextMultiChoiceEditor = ({
|
|
5981
6178
|
value,
|
|
5982
6179
|
disabled,
|
|
@@ -5986,13 +6183,13 @@ var TextMultiChoiceEditor = ({
|
|
|
5986
6183
|
}) => {
|
|
5987
6184
|
const readOnlyProps = readOnly ? readOnlyAttributes : {};
|
|
5988
6185
|
const isClearable = !readOnly || !disabled;
|
|
5989
|
-
const { groupedOptions, selectedOptions } =
|
|
6186
|
+
const { groupedOptions, selectedOptions } = useMemo20(() => {
|
|
5990
6187
|
var _a;
|
|
5991
6188
|
const coercedValue = typeof value === "string" ? [value] : value != null ? value : [];
|
|
5992
6189
|
const options = (_a = coercedValue.map((v) => ({ label: v, value: v }))) != null ? _a : [];
|
|
5993
6190
|
return convertComboBoxGroupsToSelectableGroups5({ options, selectedItems: new Set(value) });
|
|
5994
6191
|
}, [value]);
|
|
5995
|
-
return /* @__PURE__ */
|
|
6192
|
+
return /* @__PURE__ */ jsx72("div", { "data-testid": valueTestId, children: /* @__PURE__ */ jsx72(
|
|
5996
6193
|
InputCreatableComboBox,
|
|
5997
6194
|
{
|
|
5998
6195
|
...props,
|
|
@@ -6283,7 +6480,7 @@ var SearchAndFilterAdditionalContainer = css21`
|
|
|
6283
6480
|
`;
|
|
6284
6481
|
|
|
6285
6482
|
// src/components/SearchAndFilter/FilterButton.tsx
|
|
6286
|
-
import { jsx as
|
|
6483
|
+
import { jsx as jsx73, jsxs as jsxs33 } from "@emotion/react/jsx-runtime";
|
|
6287
6484
|
var FilterButton2 = ({
|
|
6288
6485
|
text = "Filters",
|
|
6289
6486
|
icon = customIcons["filter-add"],
|
|
@@ -6293,7 +6490,7 @@ var FilterButton2 = ({
|
|
|
6293
6490
|
showDropdownIcon,
|
|
6294
6491
|
...props
|
|
6295
6492
|
}) => {
|
|
6296
|
-
return /* @__PURE__ */
|
|
6493
|
+
return /* @__PURE__ */ jsxs33(
|
|
6297
6494
|
"button",
|
|
6298
6495
|
{
|
|
6299
6496
|
type: "button",
|
|
@@ -6305,10 +6502,10 @@ var FilterButton2 = ({
|
|
|
6305
6502
|
...props,
|
|
6306
6503
|
"data-testid": dataTestId,
|
|
6307
6504
|
children: [
|
|
6308
|
-
/* @__PURE__ */
|
|
6309
|
-
/* @__PURE__ */
|
|
6310
|
-
filterCount ? /* @__PURE__ */
|
|
6311
|
-
showDropdownIcon ? /* @__PURE__ */
|
|
6505
|
+
/* @__PURE__ */ jsx73(Icon2, { icon, iconColor: "currentColor", size: "1rem" }),
|
|
6506
|
+
/* @__PURE__ */ jsx73("span", { css: FilterButtonText, children: text }),
|
|
6507
|
+
filterCount ? /* @__PURE__ */ jsx73(Counter2, { count: filterCount, bgColor: "var(--white)" }) : null,
|
|
6508
|
+
showDropdownIcon ? /* @__PURE__ */ jsx73(Icon2, { icon: "chevron-down", iconColor: "currentColor", size: "1rem" }) : null
|
|
6312
6509
|
]
|
|
6313
6510
|
}
|
|
6314
6511
|
);
|
|
@@ -6319,31 +6516,31 @@ import { CgClose } from "@react-icons/all-files/cg/CgClose";
|
|
|
6319
6516
|
import { hasReferencedVariables as hasReferencedVariables2 } from "@uniformdev/canvas";
|
|
6320
6517
|
import { Icon as Icon3, InputKeywordSearch } from "@uniformdev/design-system";
|
|
6321
6518
|
import { CLEAR_EDITOR_COMMAND as CLEAR_EDITOR_COMMAND2 } from "lexical";
|
|
6322
|
-
import { useEffect as
|
|
6519
|
+
import { useEffect as useEffect19, useRef as useRef10, useState as useState22 } from "react";
|
|
6323
6520
|
import { useDebounce as useDebounce7 } from "react-use";
|
|
6324
6521
|
import { v4 as v42 } from "uuid";
|
|
6325
6522
|
|
|
6326
6523
|
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
6327
6524
|
import { VerticalRhythm as VerticalRhythm5 } from "@uniformdev/design-system";
|
|
6328
6525
|
import {
|
|
6329
|
-
createContext as
|
|
6330
|
-
useCallback as
|
|
6331
|
-
useContext as
|
|
6526
|
+
createContext as createContext7,
|
|
6527
|
+
useCallback as useCallback7,
|
|
6528
|
+
useContext as useContext7,
|
|
6332
6529
|
useDeferredValue as useDeferredValue2,
|
|
6333
|
-
useEffect as
|
|
6334
|
-
useMemo as
|
|
6335
|
-
useState as
|
|
6530
|
+
useEffect as useEffect18,
|
|
6531
|
+
useMemo as useMemo21,
|
|
6532
|
+
useState as useState21
|
|
6336
6533
|
} from "react";
|
|
6337
6534
|
|
|
6338
6535
|
// src/components/SearchAndFilter/FilterEditor.tsx
|
|
6339
|
-
import { jsx as
|
|
6536
|
+
import { jsx as jsx74 } from "@emotion/react/jsx-runtime";
|
|
6340
6537
|
var FilterEditorRenderer = ({ editorType, ...props }) => {
|
|
6341
6538
|
const { filterMapper: contextFilterMapper } = useSearchAndFilter();
|
|
6342
6539
|
const Editor = contextFilterMapper == null ? void 0 : contextFilterMapper[editorType];
|
|
6343
6540
|
if (!Editor || editorType === "empty") {
|
|
6344
|
-
return /* @__PURE__ */
|
|
6541
|
+
return /* @__PURE__ */ jsx74("span", {});
|
|
6345
6542
|
}
|
|
6346
|
-
return /* @__PURE__ */
|
|
6543
|
+
return /* @__PURE__ */ jsx74(Editor, { ...props });
|
|
6347
6544
|
};
|
|
6348
6545
|
var filterMapper = {
|
|
6349
6546
|
multiChoice: FilterMultiChoiceEditor,
|
|
@@ -6361,9 +6558,9 @@ var filterMapper = {
|
|
|
6361
6558
|
function withInputVariables(WrappedComponent, noSwapping = false) {
|
|
6362
6559
|
const WithInputVariables = (props) => {
|
|
6363
6560
|
if (Array.isArray(props.value) || !props.bindable || props.disabled || props.readOnly) {
|
|
6364
|
-
return /* @__PURE__ */
|
|
6561
|
+
return /* @__PURE__ */ jsx74(WrappedComponent, { ...props });
|
|
6365
6562
|
}
|
|
6366
|
-
return /* @__PURE__ */
|
|
6563
|
+
return /* @__PURE__ */ jsx74(
|
|
6367
6564
|
InputVariables,
|
|
6368
6565
|
{
|
|
6369
6566
|
"data-testid": "filter-value",
|
|
@@ -6372,7 +6569,7 @@ function withInputVariables(WrappedComponent, noSwapping = false) {
|
|
|
6372
6569
|
onChange: (newValue) => props.onChange(newValue != null ? newValue : ""),
|
|
6373
6570
|
value: props.value,
|
|
6374
6571
|
disabled: props.disabled,
|
|
6375
|
-
inputWhenNoVariables: noSwapping ? void 0 : /* @__PURE__ */
|
|
6572
|
+
inputWhenNoVariables: noSwapping ? void 0 : /* @__PURE__ */ jsx74(WrappedComponent, { ...props })
|
|
6376
6573
|
}
|
|
6377
6574
|
);
|
|
6378
6575
|
};
|
|
@@ -6382,9 +6579,9 @@ function withInputVariablesForMultiValue(WrappedComponent) {
|
|
|
6382
6579
|
const WithInputVariables = (props) => {
|
|
6383
6580
|
var _a;
|
|
6384
6581
|
if (!props.bindable || props.disabled || props.readOnly) {
|
|
6385
|
-
return /* @__PURE__ */
|
|
6582
|
+
return /* @__PURE__ */ jsx74(WrappedComponent, { ...props });
|
|
6386
6583
|
}
|
|
6387
|
-
return /* @__PURE__ */
|
|
6584
|
+
return /* @__PURE__ */ jsx74(
|
|
6388
6585
|
InputVariables,
|
|
6389
6586
|
{
|
|
6390
6587
|
"data-testid": "filter-value",
|
|
@@ -6392,7 +6589,7 @@ function withInputVariablesForMultiValue(WrappedComponent) {
|
|
|
6392
6589
|
showMenuPosition: "inline-right",
|
|
6393
6590
|
onChange: (newValue) => props.onChange(newValue ? [newValue] : []),
|
|
6394
6591
|
value: (_a = props.value) == null ? void 0 : _a[0],
|
|
6395
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
6592
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx74(WrappedComponent, { ...props })
|
|
6396
6593
|
}
|
|
6397
6594
|
);
|
|
6398
6595
|
};
|
|
@@ -6408,8 +6605,8 @@ var bindableFiltersMapper = {
|
|
|
6408
6605
|
};
|
|
6409
6606
|
|
|
6410
6607
|
// src/components/SearchAndFilter/hooks/useSearchAndFilter.tsx
|
|
6411
|
-
import { jsx as
|
|
6412
|
-
var SearchAndFilterContext =
|
|
6608
|
+
import { jsx as jsx75 } from "@emotion/react/jsx-runtime";
|
|
6609
|
+
var SearchAndFilterContext = createContext7({
|
|
6413
6610
|
searchTerm: "",
|
|
6414
6611
|
setSearchTerm: () => {
|
|
6415
6612
|
},
|
|
@@ -6429,6 +6626,7 @@ var SearchAndFilterContext = createContext6({
|
|
|
6429
6626
|
validFilterQuery: [],
|
|
6430
6627
|
filterMapper: {},
|
|
6431
6628
|
totalResults: 0,
|
|
6629
|
+
isLoading: false,
|
|
6432
6630
|
allowBindingSearchTerm: false
|
|
6433
6631
|
});
|
|
6434
6632
|
var SearchAndFilterProvider = ({
|
|
@@ -6442,21 +6640,22 @@ var SearchAndFilterProvider = ({
|
|
|
6442
6640
|
resetFilterValues = [{ field: "", operator: "", value: "" }],
|
|
6443
6641
|
onResetFilterValues,
|
|
6444
6642
|
totalResults,
|
|
6643
|
+
isLoading,
|
|
6445
6644
|
filterMapper: filterMapper2 = filterMapper,
|
|
6446
6645
|
children,
|
|
6447
6646
|
allowBindingSearchTerm
|
|
6448
6647
|
}) => {
|
|
6449
|
-
const [searchTerm, setSearchTerm] =
|
|
6648
|
+
const [searchTerm, setSearchTerm] = useState21(defaultSearchTerm);
|
|
6450
6649
|
const deferredSearchTerm = useDeferredValue2(searchTerm);
|
|
6451
|
-
const [filterVisibility, setFilterVisibility] =
|
|
6452
|
-
const handleSearchTerm =
|
|
6650
|
+
const [filterVisibility, setFilterVisibility] = useState21(alwaysVisible || filterVisible);
|
|
6651
|
+
const handleSearchTerm = useCallback7(
|
|
6453
6652
|
(term) => {
|
|
6454
6653
|
setSearchTerm(term);
|
|
6455
6654
|
onSearchChange == null ? void 0 : onSearchChange(term);
|
|
6456
6655
|
},
|
|
6457
6656
|
[setSearchTerm, onSearchChange]
|
|
6458
6657
|
);
|
|
6459
|
-
const handleToggleFilterVisibility =
|
|
6658
|
+
const handleToggleFilterVisibility = useCallback7(
|
|
6460
6659
|
(visible) => {
|
|
6461
6660
|
if (alwaysVisible) {
|
|
6462
6661
|
return;
|
|
@@ -6465,30 +6664,30 @@ var SearchAndFilterProvider = ({
|
|
|
6465
6664
|
},
|
|
6466
6665
|
[alwaysVisible]
|
|
6467
6666
|
);
|
|
6468
|
-
const handleAddFilter =
|
|
6667
|
+
const handleAddFilter = useCallback7(() => {
|
|
6469
6668
|
onChange([...filters, { field: "", operator: "", value: "" }]);
|
|
6470
6669
|
}, [filters, onChange]);
|
|
6471
|
-
const handleResetFilters =
|
|
6670
|
+
const handleResetFilters = useCallback7(() => {
|
|
6472
6671
|
if (onResetFilterValues) {
|
|
6473
6672
|
return onResetFilterValues();
|
|
6474
6673
|
}
|
|
6475
6674
|
onSearchChange == null ? void 0 : onSearchChange("");
|
|
6476
6675
|
onChange(resetFilterValues);
|
|
6477
6676
|
}, [onChange, resetFilterValues, onSearchChange, onResetFilterValues]);
|
|
6478
|
-
const handleDeleteFilter =
|
|
6677
|
+
const handleDeleteFilter = useCallback7(
|
|
6479
6678
|
(index) => {
|
|
6480
6679
|
const remainingFilters = filters.filter((_, i) => i !== index);
|
|
6481
6680
|
onChange(remainingFilters);
|
|
6482
6681
|
},
|
|
6483
6682
|
[filters, onChange]
|
|
6484
6683
|
);
|
|
6485
|
-
const validFilterQuery =
|
|
6684
|
+
const validFilterQuery = useMemo21(() => {
|
|
6486
6685
|
const hasValidFilters = filters.every((f) => f.field && f.operator && f.value);
|
|
6487
6686
|
if (hasValidFilters) {
|
|
6488
6687
|
return filters;
|
|
6489
6688
|
}
|
|
6490
6689
|
}, [filters]);
|
|
6491
|
-
|
|
6690
|
+
useEffect18(() => {
|
|
6492
6691
|
if (filterVisibility) {
|
|
6493
6692
|
const handleEscKeyFilterClose = (e) => {
|
|
6494
6693
|
if (e.key === "Escape") {
|
|
@@ -6501,7 +6700,7 @@ var SearchAndFilterProvider = ({
|
|
|
6501
6700
|
};
|
|
6502
6701
|
}
|
|
6503
6702
|
}, [filterVisibility, handleToggleFilterVisibility]);
|
|
6504
|
-
return /* @__PURE__ */
|
|
6703
|
+
return /* @__PURE__ */ jsx75(
|
|
6505
6704
|
SearchAndFilterContext.Provider,
|
|
6506
6705
|
{
|
|
6507
6706
|
value: {
|
|
@@ -6517,20 +6716,21 @@ var SearchAndFilterProvider = ({
|
|
|
6517
6716
|
filterOptions,
|
|
6518
6717
|
validFilterQuery,
|
|
6519
6718
|
totalResults,
|
|
6719
|
+
isLoading,
|
|
6520
6720
|
filterMapper: filterMapper2,
|
|
6521
6721
|
allowBindingSearchTerm
|
|
6522
6722
|
},
|
|
6523
|
-
children: /* @__PURE__ */
|
|
6723
|
+
children: /* @__PURE__ */ jsx75(VerticalRhythm5, { children })
|
|
6524
6724
|
}
|
|
6525
6725
|
);
|
|
6526
6726
|
};
|
|
6527
6727
|
var useSearchAndFilter = () => {
|
|
6528
|
-
const value =
|
|
6728
|
+
const value = useContext7(SearchAndFilterContext);
|
|
6529
6729
|
return { ...value };
|
|
6530
6730
|
};
|
|
6531
6731
|
|
|
6532
6732
|
// src/components/SearchAndFilter/FilterControls.tsx
|
|
6533
|
-
import { Fragment as
|
|
6733
|
+
import { Fragment as Fragment14, jsx as jsx76, jsxs as jsxs34 } from "@emotion/react/jsx-runtime";
|
|
6534
6734
|
var FilterControls = ({
|
|
6535
6735
|
children,
|
|
6536
6736
|
hideSearchInput
|
|
@@ -6543,10 +6743,10 @@ var FilterControls = ({
|
|
|
6543
6743
|
searchTerm,
|
|
6544
6744
|
allowBindingSearchTerm
|
|
6545
6745
|
} = useSearchAndFilter();
|
|
6546
|
-
const editorRef =
|
|
6746
|
+
const editorRef = useRef10(null);
|
|
6547
6747
|
const variableRefernceCountInSearchTerm = hasReferencedVariables2(searchTerm);
|
|
6548
|
-
const [idToResetInputVariables, setIdToResetInputVariables] =
|
|
6549
|
-
const [localSearchTerm, setLocalSearchTerm] =
|
|
6748
|
+
const [idToResetInputVariables, setIdToResetInputVariables] = useState22("data-resource-search-term-input");
|
|
6749
|
+
const [localSearchTerm, setLocalSearchTerm] = useState22(searchTerm);
|
|
6550
6750
|
useDebounce7(
|
|
6551
6751
|
() => {
|
|
6552
6752
|
setSearchTerm(localSearchTerm);
|
|
@@ -6554,14 +6754,14 @@ var FilterControls = ({
|
|
|
6554
6754
|
300,
|
|
6555
6755
|
[localSearchTerm]
|
|
6556
6756
|
);
|
|
6557
|
-
|
|
6757
|
+
useEffect19(() => {
|
|
6558
6758
|
if (searchTerm === "") {
|
|
6559
6759
|
setLocalSearchTerm("");
|
|
6560
6760
|
setIdToResetInputVariables(`data-resource-search-term-input-${v42()}`);
|
|
6561
6761
|
}
|
|
6562
6762
|
}, [searchTerm]);
|
|
6563
|
-
return /* @__PURE__ */
|
|
6564
|
-
/* @__PURE__ */
|
|
6763
|
+
return /* @__PURE__ */ jsxs34(Fragment14, { children: [
|
|
6764
|
+
/* @__PURE__ */ jsx76(
|
|
6565
6765
|
FilterButton2,
|
|
6566
6766
|
{
|
|
6567
6767
|
"aria-controls": "search-and-filter-options",
|
|
@@ -6574,8 +6774,8 @@ var FilterControls = ({
|
|
|
6574
6774
|
dataTestId: "filters-button"
|
|
6575
6775
|
}
|
|
6576
6776
|
),
|
|
6577
|
-
hideSearchInput ? null : /* @__PURE__ */
|
|
6578
|
-
/* @__PURE__ */
|
|
6777
|
+
hideSearchInput ? null : /* @__PURE__ */ jsxs34("div", { css: BindableKeywordSearchInputStyles, "data-testid": "search-container", children: [
|
|
6778
|
+
/* @__PURE__ */ jsx76(
|
|
6579
6779
|
InputVariables,
|
|
6580
6780
|
{
|
|
6581
6781
|
label: "",
|
|
@@ -6585,7 +6785,7 @@ var FilterControls = ({
|
|
|
6585
6785
|
value: localSearchTerm,
|
|
6586
6786
|
onChange: (value) => setLocalSearchTerm(value != null ? value : ""),
|
|
6587
6787
|
disableVariables: !allowBindingSearchTerm,
|
|
6588
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
6788
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx76(
|
|
6589
6789
|
InputKeywordSearch,
|
|
6590
6790
|
{
|
|
6591
6791
|
placeholder: "Search...",
|
|
@@ -6604,7 +6804,7 @@ var FilterControls = ({
|
|
|
6604
6804
|
)
|
|
6605
6805
|
}
|
|
6606
6806
|
),
|
|
6607
|
-
variableRefernceCountInSearchTerm ? /* @__PURE__ */
|
|
6807
|
+
variableRefernceCountInSearchTerm ? /* @__PURE__ */ jsx76("div", { css: ClearSearchButtonContainer, children: /* @__PURE__ */ jsx76(
|
|
6608
6808
|
"button",
|
|
6609
6809
|
{
|
|
6610
6810
|
css: ClearSearchButtonStyles,
|
|
@@ -6618,7 +6818,7 @@ var FilterControls = ({
|
|
|
6618
6818
|
},
|
|
6619
6819
|
type: "button",
|
|
6620
6820
|
"data-testid": "keyword-search-clear-button",
|
|
6621
|
-
children: /* @__PURE__ */
|
|
6821
|
+
children: /* @__PURE__ */ jsx76(Icon3, { icon: CgClose, iconColor: "red", size: "1rem" })
|
|
6622
6822
|
}
|
|
6623
6823
|
) }) : null
|
|
6624
6824
|
] }),
|
|
@@ -6629,7 +6829,7 @@ var FilterControls = ({
|
|
|
6629
6829
|
// src/components/SearchAndFilter/FilterItem.tsx
|
|
6630
6830
|
import { CgTrash as CgTrash2 } from "@react-icons/all-files/cg/CgTrash";
|
|
6631
6831
|
import { Icon as Icon4, InputComboBox as InputComboBox5 } from "@uniformdev/design-system";
|
|
6632
|
-
import { useMemo as
|
|
6832
|
+
import { useMemo as useMemo22 } from "react";
|
|
6633
6833
|
|
|
6634
6834
|
// src/components/SearchAndFilter/util/isFilterBindable.ts
|
|
6635
6835
|
function isFilterBindable(filter, operator) {
|
|
@@ -6638,7 +6838,7 @@ function isFilterBindable(filter, operator) {
|
|
|
6638
6838
|
}
|
|
6639
6839
|
|
|
6640
6840
|
// src/components/SearchAndFilter/FilterItem.tsx
|
|
6641
|
-
import { jsx as
|
|
6841
|
+
import { jsx as jsx77, jsxs as jsxs35 } from "@emotion/react/jsx-runtime";
|
|
6642
6842
|
var FilterItem = ({
|
|
6643
6843
|
index,
|
|
6644
6844
|
operatorOptions,
|
|
@@ -6656,7 +6856,7 @@ var FilterItem = ({
|
|
|
6656
6856
|
const operatorLabel = filters[index].operator !== "" ? `operator ${filters[index].operator}` : "unknown operator";
|
|
6657
6857
|
const metaDataLabel = filters[index].value !== "" ? `value ${filters[index].value}` : "unknown value";
|
|
6658
6858
|
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 } =
|
|
6859
|
+
const { selectedFieldValue, selectedOperatorValue, selectedMetaValue, readOnly, bindable } = useMemo22(() => {
|
|
6660
6860
|
var _a2;
|
|
6661
6861
|
const currentSelectedFilterGroup = filterOptions.find((item) => {
|
|
6662
6862
|
var _a3;
|
|
@@ -6686,10 +6886,10 @@ var FilterItem = ({
|
|
|
6686
6886
|
} : {};
|
|
6687
6887
|
const CustomLeftHandComponent = selectedFieldValue == null ? void 0 : selectedFieldValue.leftHandSideComponentWhenSelected;
|
|
6688
6888
|
const isEmptyOperator = metaDataPossibleOptions === "empty";
|
|
6689
|
-
return /* @__PURE__ */
|
|
6690
|
-
/* @__PURE__ */
|
|
6691
|
-
/* @__PURE__ */
|
|
6692
|
-
CustomLeftHandComponent ? /* @__PURE__ */
|
|
6889
|
+
return /* @__PURE__ */ jsxs35("div", { css: ConditionalFilterRow, "data-testid": "filter-item", children: [
|
|
6890
|
+
/* @__PURE__ */ jsx77("span", { children: index === 0 ? initialCriteriaTitle : criteriaGroupOperator }),
|
|
6891
|
+
/* @__PURE__ */ jsxs35("div", { css: [ConditionalInputRow, isEmptyOperator ? ConditionalInputRowEmpty : null], children: [
|
|
6892
|
+
CustomLeftHandComponent ? /* @__PURE__ */ jsx77(
|
|
6693
6893
|
CustomLeftHandComponent,
|
|
6694
6894
|
{
|
|
6695
6895
|
filterOption: selectedFieldValue,
|
|
@@ -6699,7 +6899,7 @@ var FilterItem = ({
|
|
|
6699
6899
|
onFilterOptionChange("");
|
|
6700
6900
|
}
|
|
6701
6901
|
}
|
|
6702
|
-
) : /* @__PURE__ */
|
|
6902
|
+
) : /* @__PURE__ */ jsx77(
|
|
6703
6903
|
InputComboBox5,
|
|
6704
6904
|
{
|
|
6705
6905
|
"aria-label": label,
|
|
@@ -6726,7 +6926,7 @@ var FilterItem = ({
|
|
|
6726
6926
|
name: `filter-field-${index}`
|
|
6727
6927
|
}
|
|
6728
6928
|
),
|
|
6729
|
-
/* @__PURE__ */
|
|
6929
|
+
/* @__PURE__ */ jsx77(
|
|
6730
6930
|
InputComboBox5,
|
|
6731
6931
|
{
|
|
6732
6932
|
"aria-label": operatorLabel,
|
|
@@ -6750,7 +6950,7 @@ var FilterItem = ({
|
|
|
6750
6950
|
name: `filter-operator-${index}`
|
|
6751
6951
|
}
|
|
6752
6952
|
),
|
|
6753
|
-
/* @__PURE__ */
|
|
6953
|
+
/* @__PURE__ */ jsx77(
|
|
6754
6954
|
FilterEditorRenderer,
|
|
6755
6955
|
{
|
|
6756
6956
|
"aria-label": metaDataLabel,
|
|
@@ -6765,7 +6965,7 @@ var FilterItem = ({
|
|
|
6765
6965
|
filterFieldName: filters[index].field
|
|
6766
6966
|
}
|
|
6767
6967
|
),
|
|
6768
|
-
readOnly ? null : /* @__PURE__ */
|
|
6968
|
+
readOnly ? null : /* @__PURE__ */ jsx77(
|
|
6769
6969
|
"button",
|
|
6770
6970
|
{
|
|
6771
6971
|
type: "button",
|
|
@@ -6774,7 +6974,7 @@ var FilterItem = ({
|
|
|
6774
6974
|
css: IconBtn,
|
|
6775
6975
|
"data-testid": "delete-filter",
|
|
6776
6976
|
disabled: filters.length === 1,
|
|
6777
|
-
children: /* @__PURE__ */
|
|
6977
|
+
children: /* @__PURE__ */ jsx77(Icon4, { icon: CgTrash2, iconColor: filters.length === 1 ? "gray" : "red", size: "1rem" })
|
|
6778
6978
|
}
|
|
6779
6979
|
)
|
|
6780
6980
|
] })
|
|
@@ -6787,16 +6987,16 @@ import { Icon as Icon5 } from "@uniformdev/design-system";
|
|
|
6787
6987
|
|
|
6788
6988
|
// src/components/SearchAndFilter/FilterMenu.tsx
|
|
6789
6989
|
import { HorizontalRhythm as HorizontalRhythm8, VerticalRhythm as VerticalRhythm6 } from "@uniformdev/design-system";
|
|
6790
|
-
import
|
|
6791
|
-
import { jsx as
|
|
6990
|
+
import React7, { useEffect as useEffect20 } from "react";
|
|
6991
|
+
import { jsx as jsx78, jsxs as jsxs36 } from "@emotion/react/jsx-runtime";
|
|
6792
6992
|
var SearchAndFilterOptionsContainer2 = ({
|
|
6793
6993
|
buttonRow,
|
|
6794
6994
|
additionalFiltersContainer,
|
|
6795
6995
|
children
|
|
6796
6996
|
}) => {
|
|
6797
|
-
return /* @__PURE__ */
|
|
6798
|
-
/* @__PURE__ */
|
|
6799
|
-
buttonRow ? /* @__PURE__ */
|
|
6997
|
+
return /* @__PURE__ */ jsxs36("div", { css: SearchAndFilterOptionsContainer, children: [
|
|
6998
|
+
/* @__PURE__ */ jsx78("div", { css: SearchAndFilterOptionsInnerContainer, children }),
|
|
6999
|
+
buttonRow ? /* @__PURE__ */ jsx78(
|
|
6800
7000
|
HorizontalRhythm8,
|
|
6801
7001
|
{
|
|
6802
7002
|
css: SearchAndFilterButtonGroup,
|
|
@@ -6806,7 +7006,7 @@ var SearchAndFilterOptionsContainer2 = ({
|
|
|
6806
7006
|
children: buttonRow
|
|
6807
7007
|
}
|
|
6808
7008
|
) : null,
|
|
6809
|
-
additionalFiltersContainer ? /* @__PURE__ */
|
|
7009
|
+
additionalFiltersContainer ? /* @__PURE__ */ jsx78("div", { css: SearchAndFilterAdditionalContainer, children: additionalFiltersContainer }) : null
|
|
6810
7010
|
] });
|
|
6811
7011
|
};
|
|
6812
7012
|
var FilterMenu = ({
|
|
@@ -6819,22 +7019,22 @@ var FilterMenu = ({
|
|
|
6819
7019
|
resetButtonText = "reset"
|
|
6820
7020
|
}) => {
|
|
6821
7021
|
const { filterVisibility, setFilterVisibility, handleResetFilters, filters } = useSearchAndFilter();
|
|
6822
|
-
const innerMenuRef =
|
|
6823
|
-
|
|
7022
|
+
const innerMenuRef = React7.useRef(null);
|
|
7023
|
+
useEffect20(() => {
|
|
6824
7024
|
var _a;
|
|
6825
7025
|
if (filterVisibility) {
|
|
6826
7026
|
(_a = innerMenuRef.current) == null ? void 0 : _a.focus();
|
|
6827
7027
|
}
|
|
6828
7028
|
}, [filterVisibility]);
|
|
6829
|
-
return /* @__PURE__ */
|
|
7029
|
+
return /* @__PURE__ */ jsx78(VerticalRhythm6, { gap: "sm", "aria-haspopup": "true", id, "data-testid": dataTestId, children: filterVisibility ? /* @__PURE__ */ jsxs36(
|
|
6830
7030
|
SearchAndFilterOptionsContainer2,
|
|
6831
7031
|
{
|
|
6832
7032
|
buttonRow: menuControls,
|
|
6833
7033
|
additionalFiltersContainer,
|
|
6834
7034
|
children: [
|
|
6835
|
-
/* @__PURE__ */
|
|
6836
|
-
filterTitle ? /* @__PURE__ */
|
|
6837
|
-
(filters == null ? void 0 : filters.length) && resetButtonText ? /* @__PURE__ */
|
|
7035
|
+
/* @__PURE__ */ jsxs36(HorizontalRhythm8, { gap: "sm", align: "center", justify: "space-between", children: [
|
|
7036
|
+
filterTitle ? /* @__PURE__ */ jsx78("span", { css: Title, ref: innerMenuRef, tabIndex: 0, children: filterTitle }) : null,
|
|
7037
|
+
(filters == null ? void 0 : filters.length) && resetButtonText ? /* @__PURE__ */ jsx78(
|
|
6838
7038
|
"button",
|
|
6839
7039
|
{
|
|
6840
7040
|
type: "button",
|
|
@@ -6945,7 +7145,7 @@ function hasBindings(currentValue) {
|
|
|
6945
7145
|
}
|
|
6946
7146
|
|
|
6947
7147
|
// src/components/SearchAndFilter/FilterItems.tsx
|
|
6948
|
-
import { jsx as
|
|
7148
|
+
import { jsx as jsx79, jsxs as jsxs37 } from "@emotion/react/jsx-runtime";
|
|
6949
7149
|
var FilterItems = ({
|
|
6950
7150
|
addButtonText = "add condition",
|
|
6951
7151
|
additionalFiltersContainer,
|
|
@@ -6961,7 +7161,7 @@ var FilterItems = ({
|
|
|
6961
7161
|
next[index] = { ...next[index], [prop]: value };
|
|
6962
7162
|
if (prop === "operator") {
|
|
6963
7163
|
const newOperatorId = value;
|
|
6964
|
-
const currentFilter =
|
|
7164
|
+
const currentFilter = filters[index];
|
|
6965
7165
|
if (!newOperatorId) {
|
|
6966
7166
|
throw new Error("you bad");
|
|
6967
7167
|
}
|
|
@@ -6982,12 +7182,12 @@ var FilterItems = ({
|
|
|
6982
7182
|
}
|
|
6983
7183
|
setFilters(next);
|
|
6984
7184
|
};
|
|
6985
|
-
return /* @__PURE__ */
|
|
7185
|
+
return /* @__PURE__ */ jsx79(
|
|
6986
7186
|
FilterMenu,
|
|
6987
7187
|
{
|
|
6988
7188
|
id: "search-and-filter-options",
|
|
6989
7189
|
dataTestId: "search-and-filter-options",
|
|
6990
|
-
menuControls: /* @__PURE__ */
|
|
7190
|
+
menuControls: /* @__PURE__ */ jsxs37(
|
|
6991
7191
|
"button",
|
|
6992
7192
|
{
|
|
6993
7193
|
type: "button",
|
|
@@ -6995,7 +7195,7 @@ var FilterItems = ({
|
|
|
6995
7195
|
onClick: handleAddFilter,
|
|
6996
7196
|
"data-testid": "add-filter",
|
|
6997
7197
|
children: [
|
|
6998
|
-
/* @__PURE__ */
|
|
7198
|
+
/* @__PURE__ */ jsx79(Icon5, { icon: CgMathPlus, iconColor: "currentColor", size: "1rem" }),
|
|
6999
7199
|
addButtonText
|
|
7000
7200
|
]
|
|
7001
7201
|
}
|
|
@@ -7011,7 +7211,7 @@ var FilterItems = ({
|
|
|
7011
7211
|
})) == null ? void 0 : _a.options) != null ? _b : [];
|
|
7012
7212
|
const possibleValueOptions = (_d = (_c = availableTypeOptions == null ? void 0 : availableTypeOptions.find((op) => op.value === item.field)) == null ? void 0 : _c.valueOptions) != null ? _d : [];
|
|
7013
7213
|
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__ */
|
|
7214
|
+
return /* @__PURE__ */ jsx79(
|
|
7015
7215
|
FilterItem,
|
|
7016
7216
|
{
|
|
7017
7217
|
index: i,
|
|
@@ -7035,8 +7235,8 @@ var FilterItems = ({
|
|
|
7035
7235
|
import { VerticalRhythm as VerticalRhythm7 } from "@uniformdev/design-system";
|
|
7036
7236
|
|
|
7037
7237
|
// src/components/SearchAndFilter/SearchAndFilterResultContainer.tsx
|
|
7038
|
-
import { Button as Button5, Callout as
|
|
7039
|
-
import { Fragment as
|
|
7238
|
+
import { Button as Button5, Callout as Callout5, HorizontalRhythm as HorizontalRhythm9, Paragraph } from "@uniformdev/design-system";
|
|
7239
|
+
import { Fragment as Fragment15, jsx as jsx80, jsxs as jsxs38 } from "@emotion/react/jsx-runtime";
|
|
7040
7240
|
var SearchAndFilterResultContainer = ({
|
|
7041
7241
|
buttonText,
|
|
7042
7242
|
clearButtonLabel = "clear",
|
|
@@ -7045,7 +7245,7 @@ var SearchAndFilterResultContainer = ({
|
|
|
7045
7245
|
onHandleClear,
|
|
7046
7246
|
hideClearButton
|
|
7047
7247
|
}) => {
|
|
7048
|
-
const { searchTerm, totalResults, filters, handleResetFilters, setSearchTerm } = useSearchAndFilter();
|
|
7248
|
+
const { searchTerm, totalResults, filters, handleResetFilters, setSearchTerm, isLoading } = useSearchAndFilter();
|
|
7049
7249
|
const emptyFilters = filters.length === 0 || filters.every((filter) => !filter.value);
|
|
7050
7250
|
const getTextValue = ({
|
|
7051
7251
|
defaultPropText,
|
|
@@ -7076,7 +7276,7 @@ var SearchAndFilterResultContainer = ({
|
|
|
7076
7276
|
filterText: "No results match the selected filters",
|
|
7077
7277
|
fallbackText: "No matching results found"
|
|
7078
7278
|
});
|
|
7079
|
-
if (totalResults
|
|
7279
|
+
if (isLoading || totalResults === void 0 || totalResults > 0) {
|
|
7080
7280
|
return null;
|
|
7081
7281
|
}
|
|
7082
7282
|
const handleClearSearch = () => {
|
|
@@ -7087,18 +7287,18 @@ var SearchAndFilterResultContainer = ({
|
|
|
7087
7287
|
handleResetFilters();
|
|
7088
7288
|
}
|
|
7089
7289
|
};
|
|
7090
|
-
return /* @__PURE__ */
|
|
7091
|
-
/* @__PURE__ */
|
|
7092
|
-
/* @__PURE__ */
|
|
7290
|
+
return /* @__PURE__ */ jsxs38(Fragment15, { children: [
|
|
7291
|
+
/* @__PURE__ */ jsxs38(HorizontalRhythm9, { children: [
|
|
7292
|
+
/* @__PURE__ */ jsxs38("span", { children: [
|
|
7093
7293
|
totalResults,
|
|
7094
7294
|
" results ",
|
|
7095
7295
|
searchTerm ? `for "${searchTerm}"` : null
|
|
7096
7296
|
] }),
|
|
7097
|
-
!searchTerm || hideClearButton ? null : /* @__PURE__ */
|
|
7297
|
+
!searchTerm || hideClearButton ? null : /* @__PURE__ */ jsx80(Button5, { buttonType: "ghostDestructive", size: "zero", onClick: handleClearSearch, children: clearButtonLabel })
|
|
7098
7298
|
] }),
|
|
7099
|
-
totalResults === 0 ? /* @__PURE__ */
|
|
7100
|
-
calloutText ? /* @__PURE__ */
|
|
7101
|
-
hideClearButton ? null : /* @__PURE__ */
|
|
7299
|
+
totalResults === 0 ? /* @__PURE__ */ jsxs38(Callout5, { title: automateCalloutTitle, type: "note", children: [
|
|
7300
|
+
calloutText ? /* @__PURE__ */ jsx80(Paragraph, { children: calloutText }) : null,
|
|
7301
|
+
hideClearButton ? null : /* @__PURE__ */ jsx80(
|
|
7102
7302
|
Button5,
|
|
7103
7303
|
{
|
|
7104
7304
|
buttonType: "tertiaryOutline",
|
|
@@ -7113,25 +7313,26 @@ var SearchAndFilterResultContainer = ({
|
|
|
7113
7313
|
};
|
|
7114
7314
|
|
|
7115
7315
|
// src/components/SearchAndFilter/SearchAndFilter.tsx
|
|
7116
|
-
import { jsx as
|
|
7316
|
+
import { jsx as jsx81, jsxs as jsxs39 } from "@emotion/react/jsx-runtime";
|
|
7117
7317
|
var SearchAndFilter = ({
|
|
7118
7318
|
filters,
|
|
7119
7319
|
filterOptions,
|
|
7120
7320
|
filterVisible,
|
|
7121
7321
|
filterControls,
|
|
7122
7322
|
viewSwitchControls,
|
|
7123
|
-
resultsContainerView = /* @__PURE__ */
|
|
7323
|
+
resultsContainerView = /* @__PURE__ */ jsx81(SearchAndFilterResultContainer, {}),
|
|
7124
7324
|
filterMapper: filterMapper2 = filterMapper,
|
|
7125
7325
|
additionalFiltersContainer,
|
|
7126
7326
|
onChange,
|
|
7127
7327
|
defaultSearchTerm,
|
|
7128
7328
|
onSearchChange,
|
|
7129
7329
|
totalResults,
|
|
7330
|
+
isLoading,
|
|
7130
7331
|
allowBindingSearchTerm = false,
|
|
7131
7332
|
resetFilterValues = [],
|
|
7132
7333
|
onResetFilterValues
|
|
7133
7334
|
}) => {
|
|
7134
|
-
return /* @__PURE__ */
|
|
7335
|
+
return /* @__PURE__ */ jsx81(
|
|
7135
7336
|
SearchAndFilterProvider,
|
|
7136
7337
|
{
|
|
7137
7338
|
filters,
|
|
@@ -7141,22 +7342,23 @@ var SearchAndFilter = ({
|
|
|
7141
7342
|
defaultSearchTerm,
|
|
7142
7343
|
onSearchChange,
|
|
7143
7344
|
totalResults,
|
|
7345
|
+
isLoading,
|
|
7144
7346
|
resetFilterValues,
|
|
7145
7347
|
filterMapper: filterMapper2,
|
|
7146
7348
|
allowBindingSearchTerm,
|
|
7147
7349
|
onResetFilterValues,
|
|
7148
|
-
children: /* @__PURE__ */
|
|
7149
|
-
/* @__PURE__ */
|
|
7150
|
-
/* @__PURE__ */
|
|
7350
|
+
children: /* @__PURE__ */ jsxs39(VerticalRhythm7, { "data-testid": "search-and-filter", children: [
|
|
7351
|
+
/* @__PURE__ */ jsxs39("div", { css: SearchAndFilterOutterControlWrapper(viewSwitchControls ? "1fr auto" : "1fr"), children: [
|
|
7352
|
+
/* @__PURE__ */ jsx81(
|
|
7151
7353
|
"div",
|
|
7152
7354
|
{
|
|
7153
7355
|
css: SearchAndFilterControlsWrapper(viewSwitchControls ? "auto 1fr 0.05fr" : "auto 1fr"),
|
|
7154
|
-
children: !filterControls ? /* @__PURE__ */
|
|
7356
|
+
children: !filterControls ? /* @__PURE__ */ jsx81(FilterControls, { hideSearchInput: !onSearchChange }) : filterControls
|
|
7155
7357
|
}
|
|
7156
7358
|
),
|
|
7157
7359
|
viewSwitchControls
|
|
7158
7360
|
] }),
|
|
7159
|
-
/* @__PURE__ */
|
|
7361
|
+
/* @__PURE__ */ jsx81(FilterItems, { additionalFiltersContainer }),
|
|
7160
7362
|
resultsContainerView
|
|
7161
7363
|
] })
|
|
7162
7364
|
}
|
|
@@ -7165,17 +7367,17 @@ var SearchAndFilter = ({
|
|
|
7165
7367
|
|
|
7166
7368
|
// src/components/SearchAndFilter/SearchOnlyFilter.tsx
|
|
7167
7369
|
import { InputKeywordSearch as InputKeywordSearch2 } from "@uniformdev/design-system";
|
|
7168
|
-
import { createContext as
|
|
7370
|
+
import { createContext as createContext8, useState as useState23 } from "react";
|
|
7169
7371
|
import { useDebounce as useDebounce8 } from "react-use";
|
|
7170
|
-
import { jsx as
|
|
7171
|
-
var SearchOnlyContext =
|
|
7372
|
+
import { jsx as jsx82 } from "@emotion/react/jsx-runtime";
|
|
7373
|
+
var SearchOnlyContext = createContext8({
|
|
7172
7374
|
searchTerm: "",
|
|
7173
7375
|
setSearchTerm: () => {
|
|
7174
7376
|
}
|
|
7175
7377
|
});
|
|
7176
7378
|
var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
|
|
7177
7379
|
const { searchTerm, setSearchTerm } = useSearchAndFilter();
|
|
7178
|
-
const [localeSearchTerm, setLocaleSearchTerm] =
|
|
7380
|
+
const [localeSearchTerm, setLocaleSearchTerm] = useState23("");
|
|
7179
7381
|
useDebounce8(
|
|
7180
7382
|
() => {
|
|
7181
7383
|
setSearchTerm(localeSearchTerm);
|
|
@@ -7184,14 +7386,14 @@ var SearchOnlyFilter = ({ onSearchChange, maxWidth }) => {
|
|
|
7184
7386
|
300,
|
|
7185
7387
|
[localeSearchTerm]
|
|
7186
7388
|
);
|
|
7187
|
-
return /* @__PURE__ */
|
|
7389
|
+
return /* @__PURE__ */ jsx82(
|
|
7188
7390
|
SearchOnlyContext.Provider,
|
|
7189
7391
|
{
|
|
7190
7392
|
value: {
|
|
7191
7393
|
searchTerm,
|
|
7192
7394
|
setSearchTerm: setLocaleSearchTerm
|
|
7193
7395
|
},
|
|
7194
|
-
children: /* @__PURE__ */
|
|
7396
|
+
children: /* @__PURE__ */ jsx82("div", { css: { maxWidth: maxWidth != null ? maxWidth : "712px" }, children: /* @__PURE__ */ jsx82(
|
|
7195
7397
|
InputKeywordSearch2,
|
|
7196
7398
|
{
|
|
7197
7399
|
placeholder: "Search...",
|
|
@@ -7441,7 +7643,7 @@ var InputVariableWrapper = css22`
|
|
|
7441
7643
|
`;
|
|
7442
7644
|
|
|
7443
7645
|
// src/components/SearchAndFilter/SortItems.tsx
|
|
7444
|
-
import { jsx as
|
|
7646
|
+
import { jsx as jsx83, jsxs as jsxs40 } from "@emotion/react/jsx-runtime";
|
|
7445
7647
|
var SortItems = ({
|
|
7446
7648
|
sortByLabel = "Sort by",
|
|
7447
7649
|
localeLabel = "Show locale",
|
|
@@ -7463,11 +7665,11 @@ var SortItems = ({
|
|
|
7463
7665
|
return (_a2 = item.options) == null ? void 0 : _a2.find((option) => option.value === sortField);
|
|
7464
7666
|
})) == null ? void 0 : _a.options) == null ? void 0 : _b.find((nestedOption) => nestedOption.value === sortField);
|
|
7465
7667
|
const localeLabelValue = sortOptions.length > 1 ? localeLabel : `${localeLabel}s`;
|
|
7466
|
-
return /* @__PURE__ */
|
|
7467
|
-
/* @__PURE__ */
|
|
7468
|
-
/* @__PURE__ */
|
|
7469
|
-
/* @__PURE__ */
|
|
7470
|
-
/* @__PURE__ */
|
|
7668
|
+
return /* @__PURE__ */ jsxs40("div", { css: [SortFilterWrapper(hideLocaleOptions)], "data-testid": "sorting-options", children: [
|
|
7669
|
+
/* @__PURE__ */ jsxs40(VerticalRhythm8, { gap: "xs", children: [
|
|
7670
|
+
/* @__PURE__ */ jsx83("span", { css: Title2, children: sortByLabel }),
|
|
7671
|
+
/* @__PURE__ */ jsxs40("div", { css: SortFilterInputRow, children: [
|
|
7672
|
+
/* @__PURE__ */ jsx83(
|
|
7471
7673
|
InputVariables,
|
|
7472
7674
|
{
|
|
7473
7675
|
disableInlineMenu: disableSortBinding,
|
|
@@ -7475,7 +7677,7 @@ var SortItems = ({
|
|
|
7475
7677
|
value: sortField,
|
|
7476
7678
|
valueToResetTo: "created_at",
|
|
7477
7679
|
onChange: (e) => onSortChange(`${e}_${sortDirection}`),
|
|
7478
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
7680
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx83(
|
|
7479
7681
|
InputComboBox6,
|
|
7480
7682
|
{
|
|
7481
7683
|
id: "sort-by-field",
|
|
@@ -7498,7 +7700,7 @@ var SortItems = ({
|
|
|
7498
7700
|
)
|
|
7499
7701
|
}
|
|
7500
7702
|
),
|
|
7501
|
-
/* @__PURE__ */
|
|
7703
|
+
/* @__PURE__ */ jsx83(
|
|
7502
7704
|
InputVariables,
|
|
7503
7705
|
{
|
|
7504
7706
|
disableInlineMenu: disableSortBinding,
|
|
@@ -7506,7 +7708,7 @@ var SortItems = ({
|
|
|
7506
7708
|
valueToResetTo: "DESC",
|
|
7507
7709
|
showMenuPosition: disableSortBinding ? void 0 : "inline-right",
|
|
7508
7710
|
onChange: (e) => onSortChange(`${sortField}_${e}`),
|
|
7509
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
7711
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx83(
|
|
7510
7712
|
SegmentedControl,
|
|
7511
7713
|
{
|
|
7512
7714
|
noCheckmark: true,
|
|
@@ -7538,14 +7740,14 @@ var SortItems = ({
|
|
|
7538
7740
|
)
|
|
7539
7741
|
] })
|
|
7540
7742
|
] }),
|
|
7541
|
-
hideLocaleOptions ? null : /* @__PURE__ */
|
|
7743
|
+
hideLocaleOptions ? null : /* @__PURE__ */ jsx83(VerticalRhythm8, { gap: "xs", css: InputVariableWrapper, children: /* @__PURE__ */ jsx83(
|
|
7542
7744
|
InputVariables,
|
|
7543
7745
|
{
|
|
7544
7746
|
label: localeLabelValue,
|
|
7545
7747
|
value: localeValue,
|
|
7546
7748
|
showMenuPosition: "inline-right",
|
|
7547
7749
|
onChange: (e) => onLocaleChange(e != null ? e : ""),
|
|
7548
|
-
inputWhenNoVariables: /* @__PURE__ */
|
|
7750
|
+
inputWhenNoVariables: /* @__PURE__ */ jsx83(
|
|
7549
7751
|
InputSelect5,
|
|
7550
7752
|
{
|
|
7551
7753
|
name: "localeReturned",
|
|
@@ -7576,7 +7778,7 @@ function createLocationValidator(setValue, validate) {
|
|
|
7576
7778
|
|
|
7577
7779
|
// src/utils/useContentDataResourceLocaleInfo.ts
|
|
7578
7780
|
import { bindVariables as bindVariables2, createVariableReference as createVariableReference4, LOCALE_DYNAMIC_INPUT_NAME as LOCALE_DYNAMIC_INPUT_NAME2 } from "@uniformdev/canvas";
|
|
7579
|
-
import { useEffect as
|
|
7781
|
+
import { useEffect as useEffect21, useRef as useRef11 } from "react";
|
|
7580
7782
|
function useContentDataResourceLocaleInfo({
|
|
7581
7783
|
locale,
|
|
7582
7784
|
defaultLocale,
|
|
@@ -7584,12 +7786,12 @@ function useContentDataResourceLocaleInfo({
|
|
|
7584
7786
|
dynamicInputs
|
|
7585
7787
|
}) {
|
|
7586
7788
|
var _a;
|
|
7587
|
-
const setLocaleRef =
|
|
7789
|
+
const setLocaleRef = useRef11(setLocale);
|
|
7588
7790
|
setLocaleRef.current = setLocale;
|
|
7589
7791
|
const { flatVariables } = useVariables();
|
|
7590
7792
|
const effectiveLocale = locale != null ? locale : dynamicInputs[LOCALE_DYNAMIC_INPUT_NAME2] ? createVariableReference4(LOCALE_DYNAMIC_INPUT_NAME2) : defaultLocale != null ? defaultLocale : "";
|
|
7591
7793
|
const boundLocale = (_a = bindVariables2({ variables: flatVariables, value: effectiveLocale }).result) != null ? _a : effectiveLocale;
|
|
7592
|
-
|
|
7794
|
+
useEffect21(() => {
|
|
7593
7795
|
if (locale === void 0 && effectiveLocale && setLocaleRef.current) {
|
|
7594
7796
|
setLocaleRef.current(effectiveLocale);
|
|
7595
7797
|
}
|
|
@@ -7601,7 +7803,7 @@ function useContentDataResourceLocaleInfo({
|
|
|
7601
7803
|
import {
|
|
7602
7804
|
AddListButton as AddListButton2,
|
|
7603
7805
|
Button as Button6,
|
|
7604
|
-
Callout as
|
|
7806
|
+
Callout as Callout6,
|
|
7605
7807
|
DrawerContent,
|
|
7606
7808
|
Heading,
|
|
7607
7809
|
Input as Input10,
|
|
@@ -7611,7 +7813,7 @@ import {
|
|
|
7611
7813
|
InputToggle as InputToggle3,
|
|
7612
7814
|
Label,
|
|
7613
7815
|
LoadingIndicator as LoadingIndicator4,
|
|
7614
|
-
LoadingOverlay,
|
|
7816
|
+
LoadingOverlay as LoadingOverlay2,
|
|
7615
7817
|
Menu as Menu3,
|
|
7616
7818
|
MenuItem as MenuItem2,
|
|
7617
7819
|
ParameterGroup,
|
|
@@ -7642,7 +7844,7 @@ export {
|
|
|
7642
7844
|
AddListButton2 as AddListButton,
|
|
7643
7845
|
Button6 as Button,
|
|
7644
7846
|
CHECKBOX_OPERATORS,
|
|
7645
|
-
|
|
7847
|
+
Callout6 as Callout,
|
|
7646
7848
|
ControlledValuePlugin,
|
|
7647
7849
|
DATE_OPERATORS,
|
|
7648
7850
|
DATE_TIME_OPERATORS,
|
|
@@ -7655,6 +7857,9 @@ export {
|
|
|
7655
7857
|
DataTypeEditor,
|
|
7656
7858
|
DateEditor,
|
|
7657
7859
|
DateRangeEditor,
|
|
7860
|
+
DelegationContext,
|
|
7861
|
+
DelegationGate,
|
|
7862
|
+
DelegationProvider,
|
|
7658
7863
|
DrawerContent,
|
|
7659
7864
|
EDIT_VARIABLE_COMMAND,
|
|
7660
7865
|
FilterButton2 as FilterButton,
|
|
@@ -7677,7 +7882,7 @@ export {
|
|
|
7677
7882
|
Label,
|
|
7678
7883
|
LinkButton,
|
|
7679
7884
|
LoadingIndicator4 as LoadingIndicator,
|
|
7680
|
-
LoadingOverlay,
|
|
7885
|
+
LoadingOverlay2 as LoadingOverlay,
|
|
7681
7886
|
MULTI_SELECT_OPERATORS,
|
|
7682
7887
|
Menu3 as Menu,
|
|
7683
7888
|
MenuItem2 as MenuItem,
|
|
@@ -7767,6 +7972,7 @@ export {
|
|
|
7767
7972
|
urlEncodeRequestUrl,
|
|
7768
7973
|
useConnectedDataAsVariables,
|
|
7769
7974
|
useContentDataResourceLocaleInfo,
|
|
7975
|
+
useDelegation,
|
|
7770
7976
|
useDynamicInputsAsVariables,
|
|
7771
7977
|
useMeshLocation,
|
|
7772
7978
|
useObjectSearchContext,
|