@wise/dynamic-flow-client 3.19.7 → 3.20.1

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.
Files changed (25) hide show
  1. package/build/main.js +146 -117
  2. package/build/main.min.js +1 -1
  3. package/build/main.mjs +146 -117
  4. package/build/types/legacy/jsonSchemaForm/allOfSchema/AllOfSchema.d.ts +0 -5
  5. package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/ArraySchema.d.ts +1 -6
  6. package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.d.ts +0 -6
  7. package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.d.ts +0 -6
  8. package/build/types/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.d.ts +1 -8
  9. package/build/types/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.d.ts +0 -8
  10. package/build/types/legacy/jsonSchemaForm/objectSchema/ObjectSchema.d.ts +0 -6
  11. package/build/types/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.d.ts +0 -6
  12. package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.d.ts +0 -5
  13. package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.d.ts +0 -5
  14. package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.d.ts +0 -5
  15. package/build/types/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.d.ts +1 -4
  16. package/build/types/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.d.ts +0 -9
  17. package/build/types/legacy/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.d.ts +0 -5
  18. package/build/types/revamp/domain/mappers/layout/buttonLayoutToComponent.d.ts +4 -1
  19. package/build/types/revamp/domain/mappers/schema/tests/test-utils.d.ts +1 -0
  20. package/build/types/revamp/domain/mappers/schema/types.d.ts +2 -1
  21. package/build/types/revamp/domain/types.d.ts +2 -1
  22. package/build/types/revamp/types.d.ts +3 -2
  23. package/build/types/revamp/useDynamicFlowCore.d.ts +1 -0
  24. package/build/types/revamp/utils/openLinkInNewTab.d.ts +1 -0
  25. package/package.json +17 -18
package/build/main.js CHANGED
@@ -144,10 +144,10 @@ var init_clsx = __esm({
144
144
  }
145
145
  });
146
146
 
147
- // ../../node_modules/.pnpm/@wise+art@2.14.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.5_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index-93a0c34e.esm.js
147
+ // ../../node_modules/.pnpm/@wise+art@2.15.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index-a91e5689.esm.js
148
148
  var import_react7, import_jsx_runtime17, unknownFlagName, Flag, Sizes, ImageSizes, imageSizes, Assets, RenderMode;
149
- var init_index_93a0c34e_esm = __esm({
150
- "../../node_modules/.pnpm/@wise+art@2.14.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.5_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index-93a0c34e.esm.js"() {
149
+ var init_index_a91e5689_esm = __esm({
150
+ "../../node_modules/.pnpm/@wise+art@2.15.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index-a91e5689.esm.js"() {
151
151
  "use strict";
152
152
  init_clsx();
153
153
  import_react7 = require("react");
@@ -156,7 +156,8 @@ var init_index_93a0c34e_esm = __esm({
156
156
  Flag = ({
157
157
  code,
158
158
  intrinsicSize = 64,
159
- className = void 0
159
+ className = void 0,
160
+ loading = "lazy"
160
161
  }) => {
161
162
  const [fallback, setFallback] = (0, import_react7.useState)(null);
162
163
  (0, import_react7.useEffect)(() => {
@@ -167,6 +168,7 @@ var init_index_93a0c34e_esm = __esm({
167
168
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("img", {
168
169
  className: clsx(`wds-flag wds-flag-${name}`, className),
169
170
  src: `https://wise.com/web-art/assets/flags/${name}.svg`,
171
+ loading,
170
172
  alt: "",
171
173
  width: intrinsicSize,
172
174
  height: intrinsicSize,
@@ -7014,25 +7016,89 @@ var getActionByReference = ($ref, actions = []) => {
7014
7016
  };
7015
7017
 
7016
7018
  // src/revamp/domain/mappers/layout/buttonLayoutToComponent.ts
7017
- var buttonLayoutToComponent = (uid, button, { onAction, step }) => {
7019
+ var buttonLayoutToComponent = (uid, button, mapperProps) => {
7020
+ if (button.behavior) {
7021
+ return buttonLayoutToComponentWithBehavior(
7022
+ uid,
7023
+ __spreadProps(__spreadValues({}, button), { behavior: button.behavior }),
7024
+ mapperProps
7025
+ );
7026
+ }
7027
+ if (button.action) {
7028
+ return buttonLayoutToComponentWithAction(
7029
+ uid,
7030
+ __spreadProps(__spreadValues({}, button), { action: button.action }),
7031
+ mapperProps
7032
+ );
7033
+ }
7034
+ return buttonLayoutToComponentWithNoop(uid, button);
7035
+ };
7036
+ var buttonLayoutToComponentWithBehavior = (uid, button, mapperProps) => {
7037
+ const { onAction, onLink, step } = mapperProps;
7038
+ const { context, control, disabled, margin = "md", pinOrder, size, title, behavior } = button;
7039
+ const { action, link } = behavior;
7040
+ const inlinedAction = action ? inlineAction(action, step == null ? void 0 : step.actions) : null;
7041
+ const onClick = (() => {
7042
+ if (inlinedAction) {
7043
+ return () => {
7044
+ void onAction(inlinedAction);
7045
+ };
7046
+ }
7047
+ if (link) {
7048
+ return () => {
7049
+ onLink(link.url);
7050
+ };
7051
+ }
7052
+ return () => {
7053
+ };
7054
+ })();
7055
+ return createButtonComponent({
7056
+ uid,
7057
+ context: mapLegacyContext(context != null ? context : "neutral"),
7058
+ control,
7059
+ disabled: disabled != null ? disabled : false,
7060
+ margin,
7061
+ pinOrder,
7062
+ size,
7063
+ title: title != null ? title : "",
7064
+ onClick
7065
+ });
7066
+ };
7067
+ var buttonLayoutToComponentWithAction = (uid, button, mapperProps) => {
7068
+ const { onAction, step } = mapperProps;
7018
7069
  const { context, control, disabled, margin = "md", pinOrder, size, title } = button;
7019
- const action = button.action ? inlineAction(button.action, step == null ? void 0 : step.actions) : {};
7020
- const onClick = button.action ? () => {
7021
- void onAction(action);
7022
- } : () => {
7070
+ const { action } = button;
7071
+ const inlinedAction = action ? inlineAction(action, step == null ? void 0 : step.actions) : {};
7072
+ const onClick = () => {
7073
+ void onAction(inlinedAction);
7023
7074
  };
7024
7075
  return createButtonComponent({
7025
7076
  uid,
7026
- context: getButtonContext({ context, action }),
7027
- control: getButtonControl({ control, action }),
7028
- disabled: getButtonDisabled({ disabled, action }),
7077
+ context: getButtonContext({ context, action: inlinedAction }),
7078
+ control: getButtonControl({ control, action: inlinedAction }),
7079
+ disabled: getButtonDisabled({ disabled, action: inlinedAction }),
7029
7080
  margin,
7030
7081
  pinOrder,
7031
7082
  size,
7032
- title: getButtonTitle({ title, action }),
7083
+ title: getButtonTitle({ title, action: inlinedAction }),
7033
7084
  onClick
7034
7085
  });
7035
7086
  };
7087
+ var buttonLayoutToComponentWithNoop = (uid, button) => {
7088
+ const { context, control, disabled, margin = "md", pinOrder, size, title } = button;
7089
+ return createButtonComponent({
7090
+ uid,
7091
+ context: mapLegacyContext(context != null ? context : "neutral"),
7092
+ control,
7093
+ disabled: disabled != null ? disabled : false,
7094
+ margin,
7095
+ pinOrder,
7096
+ size,
7097
+ title: title != null ? title : "",
7098
+ onClick: () => {
7099
+ }
7100
+ });
7101
+ };
7036
7102
  var getButtonTitle = ({ title, action }) => {
7037
7103
  var _a;
7038
7104
  return (_a = title != null ? title : action == null ? void 0 : action.title) != null ? _a : "";
@@ -10731,6 +10797,7 @@ function useDynamicFlowCore(props) {
10731
10797
  const httpClient = useStableCallback(rest.httpClient);
10732
10798
  const onCompletion = useStableCallback(rest.onCompletion);
10733
10799
  const onValueChange = useStableCallback(props.onValueChange);
10800
+ const onLink = useStableCallback(props.onLink);
10734
10801
  const onError = useStableCallback(rest.onError);
10735
10802
  const onEvent = useStableCallback(rest.onEvent);
10736
10803
  const onLog = useStableCallback(rest.onLog);
@@ -10794,6 +10861,7 @@ function useDynamicFlowCore(props) {
10794
10861
  onAction,
10795
10862
  onRefresh,
10796
10863
  onPoll,
10864
+ onLink,
10797
10865
  onValueChange
10798
10866
  });
10799
10867
  setStepComponent(() => {
@@ -10972,14 +11040,7 @@ function DynamicFlowCore(props) {
10972
11040
  onEvent == null ? void 0 : onEvent("Dynamic Flow - Failed", { error });
10973
11041
  onError == null ? void 0 : onError(error);
10974
11042
  },
10975
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
10976
- "div",
10977
- {
10978
- id: (_b = (_a = stepComponentRef.current) == null ? void 0 : _a.step) == null ? void 0 : _b.id,
10979
- className: "dynamic-flow",
10980
- children: stepComponentRef.current ? render(stepComponentRef.current) : null
10981
- }
10982
- )
11043
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { id: (_b = (_a = stepComponentRef.current) == null ? void 0 : _a.step) == null ? void 0 : _b.id, className: "dynamic-flow", children: stepComponentRef.current ? render(stepComponentRef.current) : null })
10983
11044
  }
10984
11045
  );
10985
11046
  }
@@ -11361,8 +11422,8 @@ var DateInputRenderer_default = DateInputRenderer;
11361
11422
  // ../renderers/src/DecisionRenderer.tsx
11362
11423
  var import_components9 = require("@transferwise/components");
11363
11424
 
11364
- // ../../node_modules/.pnpm/@wise+art@2.14.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.5_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index.esm.js
11365
- init_index_93a0c34e_esm();
11425
+ // ../../node_modules/.pnpm/@wise+art@2.15.0_@transferwise+neptune-css@14.18.0_@types+react@18.3.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@wise/art/dist/index.esm.js
11426
+ init_index_a91e5689_esm();
11366
11427
  init_clsx();
11367
11428
  var import_react8 = require("react");
11368
11429
  var import_jsx_runtime18 = require("react/jsx-runtime");
@@ -13039,13 +13100,24 @@ var getWiseRenderers = () => [
13039
13100
  StepRenderer
13040
13101
  ];
13041
13102
 
13103
+ // src/revamp/utils/openLinkInNewTab.tsx
13104
+ var openLinkInNewTab = (url) => {
13105
+ var _a;
13106
+ try {
13107
+ const w = (_a = window == null ? void 0 : window.open) == null ? void 0 : _a.call(window, url, "_blank");
13108
+ return Boolean(w);
13109
+ } catch (e) {
13110
+ return false;
13111
+ }
13112
+ };
13113
+
13042
13114
  // src/revamp/DynamicFlowWise.tsx
13043
13115
  var import_jsx_runtime59 = require("react/jsx-runtime");
13044
13116
  var wiseRenderers = getWiseRenderers();
13045
13117
  function DynamicFlowWise(props) {
13046
- const { httpClient, renderers } = props;
13118
+ const { httpClient, renderers, onLink = openLinkInNewTab } = props;
13047
13119
  const mergedRenderers = (0, import_react20.useMemo)(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
13048
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(RendererHttpClientProvider, { httpClient, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(DynamicFlowCore, __spreadProps(__spreadValues({}, props), { renderers: mergedRenderers })) });
13120
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(RendererHttpClientProvider, { httpClient, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(DynamicFlowCore, __spreadProps(__spreadValues({}, props), { renderers: mergedRenderers, onLink })) });
13049
13121
  }
13050
13122
  var DynamicFlowWise_default = DynamicFlowWise;
13051
13123
 
@@ -13076,10 +13148,17 @@ var useHasHttpClientProvider = () => {
13076
13148
  var import_jsx_runtime61 = require("react/jsx-runtime");
13077
13149
  var wiseRenderers2 = getWiseRenderers();
13078
13150
  var DynamicFragmentWise = (0, import_react22.forwardRef)(function DynamicFragmentWise2(props, ref) {
13079
- const { httpClient, onCompletion = () => {
13080
- }, onEvent, onError, renderers } = props;
13151
+ const {
13152
+ httpClient,
13153
+ onCompletion = () => {
13154
+ },
13155
+ onEvent,
13156
+ onError,
13157
+ renderers,
13158
+ onLink = openLinkInNewTab
13159
+ } = props;
13081
13160
  const mergedRenderers = (0, import_react22.useMemo)(() => [...renderers != null ? renderers : [], ...wiseRenderers2], [renderers]);
13082
- const { stepComponentRef } = useDynamicFlowCore(__spreadValues({ onCompletion }, props));
13161
+ const { stepComponentRef } = useDynamicFlowCore(__spreadProps(__spreadValues({ onCompletion }, props), { onLink }));
13083
13162
  (0, import_react22.useImperativeHandle)(
13084
13163
  ref,
13085
13164
  () => ({
@@ -13117,8 +13196,8 @@ var import_react23 = require("react");
13117
13196
  var import_jsx_runtime62 = require("react/jsx-runtime");
13118
13197
  var DynamicFragmentCore = (0, import_react23.forwardRef)(function DynamicFragmentCore2(props, ref) {
13119
13198
  const { onCompletion = () => {
13120
- }, onEvent, onError, renderers } = props;
13121
- const { stepComponentRef } = useDynamicFlowCore(__spreadValues({ onCompletion }, props));
13199
+ }, onEvent, onError, onLink = openLinkInNewTab, renderers } = props;
13200
+ const { stepComponentRef } = useDynamicFlowCore(__spreadProps(__spreadValues({ onCompletion }, props), { onLink }));
13122
13201
  (0, import_react23.useImperativeHandle)(
13123
13202
  ref,
13124
13203
  () => ({
@@ -14853,6 +14932,7 @@ var getSchemaColumnClasses = (width) => ({
14853
14932
  "col-sm-4": width === "sm"
14854
14933
  });
14855
14934
  function AllOfSchema(props) {
14935
+ const { disabled = false } = props;
14856
14936
  const onChangeModelIndex = (index, onChangeProps) => {
14857
14937
  const modelSchema = props.schema.allOf[index];
14858
14938
  models[index] = getValidObjectModelParts(onChangeProps.model, modelSchema) || {};
@@ -14872,7 +14952,7 @@ function AllOfSchema(props) {
14872
14952
  model: models[index],
14873
14953
  errors: props.errors,
14874
14954
  submitted: props.submitted,
14875
- disabled: props.disabled,
14955
+ disabled,
14876
14956
  onChange: (onChangeProps) => onChangeModelIndex(index, __spreadProps(__spreadValues({}, onChangeProps), {
14877
14957
  // We can safely assume that the model here is going to be of the same type as the model prop
14878
14958
  model: onChangeProps.model
@@ -14883,9 +14963,6 @@ function AllOfSchema(props) {
14883
14963
  )) })
14884
14964
  ] });
14885
14965
  }
14886
- AllOfSchema.defaultProps = {
14887
- disabled: false
14888
- };
14889
14966
  var AllOfSchema_default = AllOfSchema;
14890
14967
 
14891
14968
  // src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
@@ -14899,28 +14976,22 @@ var import_formatting2 = require("@transferwise/formatting");
14899
14976
  var import_react_intl22 = require("react-intl");
14900
14977
  var import_jsx_runtime79 = require("react/jsx-runtime");
14901
14978
  function ControlFeedback(props) {
14902
- var _a;
14979
+ const { errors = "", validations = [], validationMessages = {} } = props;
14903
14980
  const defaultValidationMessages = useDefaultValidationMessages(props.schema);
14904
- const validationMessages = __spreadValues(__spreadValues(__spreadValues({}, defaultValidationMessages), props.validationMessages), props.schema.validationMessages);
14905
- const isErrorVisible = (props.submitted || !props.changed) && Boolean(props.errors);
14906
- const isValidationVisible = !isErrorVisible && (props.submitted || props.changed && props.blurred) && Boolean((_a = props.validations) == null ? void 0 : _a.length);
14981
+ const mergedValidationMessages = __spreadValues(__spreadValues(__spreadValues({}, defaultValidationMessages), validationMessages), props.schema.validationMessages);
14982
+ const isErrorVisible = (props.submitted || !props.changed) && Boolean(errors);
14983
+ const isValidationVisible = !isErrorVisible && (props.submitted || props.changed && props.blurred) && Boolean(validations == null ? void 0 : validations.length);
14907
14984
  const isDescriptionVisible = props.schema.type !== "boolean" && props.schema.description && !isErrorVisible && !isValidationVisible;
14908
14985
  const hasInfoMessage = Boolean(props.infoMessage);
14909
14986
  return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { id: props.id, children: [
14910
- isErrorVisible ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_components46.InlineAlert, { type: "error", children: props.errors }) : null,
14911
- isValidationVisible ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_components46.InlineAlert, { type: "error", children: props.validations.map((validation) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { children: validationMessages[validation] }, validation)) }) : null,
14987
+ isErrorVisible ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_components46.InlineAlert, { type: "error", children: errors }) : null,
14988
+ isValidationVisible ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_components46.InlineAlert, { type: "error", children: validations.map((validation) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { children: mergedValidationMessages[validation] }, validation)) }) : null,
14912
14989
  (isDescriptionVisible || hasInfoMessage) && /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)(import_components46.InlineAlert, { type: "info", children: [
14913
14990
  isDescriptionVisible && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { children: props.schema.description }),
14914
14991
  hasInfoMessage && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { children: props.infoMessage })
14915
14992
  ] })
14916
14993
  ] });
14917
14994
  }
14918
- ControlFeedback.defaultProps = {
14919
- errors: "",
14920
- validations: [],
14921
- validationMessages: {},
14922
- validationAsyncSuccessMessage: null
14923
- };
14924
14995
  function useDefaultValidationMessages(schema) {
14925
14996
  const { formatMessage, locale } = (0, import_react_intl22.useIntl)();
14926
14997
  const formattedMessages = {
@@ -15040,7 +15111,7 @@ function useFormattedDefaultErrorMessages({
15040
15111
  var import_jsx_runtime80 = require("react/jsx-runtime");
15041
15112
  function MultipleFileUploadSchema(props) {
15042
15113
  var _a, _b;
15043
- const { onChange, schema } = props;
15114
+ const { onChange, errors = null, schema, required = false } = props;
15044
15115
  const onEvent = useEventDispatcher();
15045
15116
  const defaultErrorMessages = useFormattedDefaultErrorMessages(schema);
15046
15117
  const uid = (0, import_react34.useMemo)(() => schema.$id || generateRandomId(), [schema.$id]);
@@ -15077,8 +15148,8 @@ function MultipleFileUploadSchema(props) {
15077
15148
  }
15078
15149
  const validFiles = getSuccessfullyProcessedFiles(files);
15079
15150
  const fileIds = validFiles.map((file) => file.id);
15080
- const fileListValidationFailures = getArrayValidationFailures(fileIds, schema, props.required);
15081
- const showError = Boolean(props.errors) || (inputChanged || props.submitted) && Boolean(fileListValidationFailures.length);
15151
+ const fileListValidationFailures = getArrayValidationFailures(fileIds, schema, required);
15152
+ const showError = Boolean(errors) || (inputChanged || props.submitted) && Boolean(fileListValidationFailures.length);
15082
15153
  const accepts = "accepts" in fileSchemaDescriptor && fileSchemaDescriptor.accepts;
15083
15154
  const maxSize = "maxSize" in fileSchemaDescriptor && fileSchemaDescriptor.maxSize;
15084
15155
  const uploadInputProps = __spreadProps(__spreadValues(__spreadValues({
@@ -15107,14 +15178,10 @@ function MultipleFileUploadSchema(props) {
15107
15178
  id: feedbackId,
15108
15179
  changed: inputChanged,
15109
15180
  submitted: props.submitted,
15110
- errors: props.errors,
15181
+ errors,
15111
15182
  schema: props.schema,
15112
15183
  validations: fileListValidationFailures,
15113
- validationMessages: getValidationMessages(
15114
- schema,
15115
- Boolean(props.required),
15116
- defaultErrorMessages
15117
- ),
15184
+ validationMessages: getValidationMessages(schema, Boolean(required), defaultErrorMessages),
15118
15185
  infoMessage: null,
15119
15186
  focused: false,
15120
15187
  blurred: true
@@ -15122,10 +15189,6 @@ function MultipleFileUploadSchema(props) {
15122
15189
  )
15123
15190
  ] });
15124
15191
  }
15125
- MultipleFileUploadSchema.defaultProps = {
15126
- errors: null,
15127
- required: false
15128
- };
15129
15192
  var MultipleFileUploadSchema_default = MultipleFileUploadSchema;
15130
15193
  function getSuccessfullyProcessedFiles(allFiles) {
15131
15194
  return allFiles.filter((file) => !file.error && file.status === "succeeded");
@@ -15822,22 +15885,18 @@ var RepeatableSchema_default = RepeatableSchema;
15822
15885
  // src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.tsx
15823
15886
  var import_jsx_runtime86 = require("react/jsx-runtime");
15824
15887
  function ArrayListSchema(props) {
15825
- const { schema } = props;
15888
+ const { errors = null, schema } = props;
15826
15889
  if (isMultipleFileUploadSchema(schema)) {
15827
- return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(MultipleFileUploadSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
15890
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(MultipleFileUploadSchema_default, __spreadProps(__spreadValues({}, props), { errors, schema }));
15828
15891
  }
15829
15892
  if (isMultiSelectConstSchema(schema)) {
15830
- return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(MultiSelectSchema, __spreadProps(__spreadValues({}, props), { schema }));
15893
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(MultiSelectSchema, __spreadProps(__spreadValues({}, props), { errors, schema }));
15831
15894
  }
15832
15895
  if (isListArraySchema(schema)) {
15833
- return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(RepeatableSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
15896
+ return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(RepeatableSchema_default, __spreadProps(__spreadValues({}, props), { errors, schema }));
15834
15897
  }
15835
15898
  throw new Error("Invalid array list schema");
15836
15899
  }
15837
- ArrayListSchema.defaultProps = {
15838
- errors: null,
15839
- required: false
15840
- };
15841
15900
  var ArrayListSchema_default = ArrayListSchema;
15842
15901
 
15843
15902
  // src/legacy/jsonSchemaForm/arrayTypeSchema/ArraySchema.tsx
@@ -15849,9 +15908,6 @@ var ArraySchema = (props) => {
15849
15908
  }
15850
15909
  throw new Error("Not implemented");
15851
15910
  };
15852
- ArraySchema.defaultProps = {
15853
- required: false
15854
- };
15855
15911
  var ArraySchema_default = ArraySchema;
15856
15912
 
15857
15913
  // src/legacy/jsonSchemaForm/objectSchema/ObjectSchema.tsx
@@ -15865,6 +15921,7 @@ var getSchemaColumnClasses2 = (width) => ({
15865
15921
  "col-sm-4": width === "sm"
15866
15922
  });
15867
15923
  function ObjectSchema(props) {
15924
+ const { disabled = false, hideTitle = false } = props;
15868
15925
  const [model, setModel] = (0, import_react38.useState)(() => __spreadValues({}, getValidObjectModelParts(props.model, props.schema)));
15869
15926
  const onChangeProperty = (propertyName, onChangeProps) => {
15870
15927
  if (onChangeProps.model !== null) {
@@ -15897,8 +15954,8 @@ function ObjectSchema(props) {
15897
15954
  return /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)(import_jsx_runtime88.Fragment, { children: [
15898
15955
  props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(DynamicAlert_default, { component: props.schema.alert }),
15899
15956
  /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("fieldset", { children: [
15900
- props.schema.title && !props.hideTitle && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_components52.Header, { title: props.schema.title, as: "legend" }),
15901
- props.schema.description && !props.hideTitle && /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("p", { children: [
15957
+ props.schema.title && !hideTitle && /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(import_components52.Header, { title: props.schema.title, as: "legend" }),
15958
+ props.schema.description && !hideTitle && /* @__PURE__ */ (0, import_jsx_runtime88.jsxs)("p", { children: [
15902
15959
  " ",
15903
15960
  props.schema.description,
15904
15961
  " "
@@ -15917,7 +15974,7 @@ function ObjectSchema(props) {
15917
15974
  errors: propsErrors == null ? void 0 : propsErrors[propertyName],
15918
15975
  submitted: props.submitted,
15919
15976
  required: isRequired(propertyName),
15920
- disabled: props.disabled,
15977
+ disabled,
15921
15978
  onChange: (onChangeProps) => onChangeProperty(propertyName, onChangeProps),
15922
15979
  onPersistAsync: props.onPersistAsync
15923
15980
  }
@@ -15928,10 +15985,6 @@ function ObjectSchema(props) {
15928
15985
  ] })
15929
15986
  ] });
15930
15987
  }
15931
- ObjectSchema.defaultProps = {
15932
- hideTitle: false,
15933
- disabled: false
15934
- };
15935
15988
  var ObjectSchema_default = ObjectSchema;
15936
15989
 
15937
15990
  // src/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
@@ -16666,8 +16719,8 @@ function SchemaFormControl(props) {
16666
16719
  const {
16667
16720
  id,
16668
16721
  schema,
16669
- value,
16670
- disabled,
16722
+ value = null,
16723
+ disabled = false,
16671
16724
  invalid,
16672
16725
  required,
16673
16726
  onChange,
@@ -16717,13 +16770,6 @@ function SchemaFormControl(props) {
16717
16770
  };
16718
16771
  return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { "aria-describedby": describedBy, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(FormControl, __spreadValues(__spreadValues({ type: controlType, value: safeValue }, events), controlProps)) });
16719
16772
  }
16720
- SchemaFormControl.defaultProps = {
16721
- value: null,
16722
- onFocus: null,
16723
- onBlur: null,
16724
- onSearchChange: null,
16725
- disabled: false
16726
- };
16727
16773
  var warnIfInvalidSchema = (schema, log, controlType) => {
16728
16774
  if (isOneOfSchema2(schema) && schema.oneOf.length === 2 && !schema.control) {
16729
16775
  log.warning(
@@ -16750,6 +16796,7 @@ function OneOfSchema(props) {
16750
16796
  const [changed, setChanged] = (0, import_react41.useState)(false);
16751
16797
  const [focused, setFocused] = (0, import_react41.useState)(false);
16752
16798
  const [blurred, setBlurred] = (0, import_react41.useState)(false);
16799
+ const { disabled = false, required = false } = props;
16753
16800
  const id = (0, import_react41.useMemo)(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
16754
16801
  const [schemaIndex, setSchemaIndex] = (0, import_react41.useState)(
16755
16802
  getActiveSchemaIndex(props.schema, props.model)
@@ -16831,10 +16878,10 @@ function OneOfSchema(props) {
16831
16878
  id,
16832
16879
  schema: schemaForSelect,
16833
16880
  value: schemaIndex,
16834
- disabled: props.disabled,
16881
+ disabled,
16835
16882
  invalid: !isEmpty(props.errors) || validations.length > 0,
16836
16883
  describedBy: feedbackId,
16837
- required: props.required,
16884
+ required,
16838
16885
  onChange: onChooseNewSchema,
16839
16886
  onFocus,
16840
16887
  onBlur,
@@ -16865,7 +16912,7 @@ function OneOfSchema(props) {
16865
16912
  errors: props.errors,
16866
16913
  submitted: props.submitted,
16867
16914
  hideTitle: true,
16868
- disabled: props.disabled,
16915
+ disabled,
16869
16916
  onChange: (parameters) => onChildModelChange(schemaIndex, parameters),
16870
16917
  onPersistAsync: props.onPersistAsync
16871
16918
  }
@@ -16887,12 +16934,13 @@ function getTitleAndHelp(schema, forId) {
16887
16934
  return schema.title ? titleElement : helpElement;
16888
16935
  }
16889
16936
  function getValidations(props, schemaIndex) {
16890
- const selectedSchema = props.schema.oneOf[schemaIndex != null ? schemaIndex : -1];
16937
+ const { schema, required = false } = props;
16938
+ const selectedSchema = schema.oneOf[schemaIndex != null ? schemaIndex : -1];
16891
16939
  if (isConstSchema2(selectedSchema)) {
16892
- return getValidationFailures(selectedSchema.const, props.schema, Boolean(props.required));
16940
+ return getValidationFailures(selectedSchema.const, schema, Boolean(required));
16893
16941
  }
16894
16942
  if (schemaIndex === null || schemaIndex < 0) {
16895
- return getValidationFailures(null, props.schema, Boolean(props.required));
16943
+ return getValidationFailures(null, schema, Boolean(required));
16896
16944
  }
16897
16945
  return [];
16898
16946
  }
@@ -16912,10 +16960,6 @@ function mapOneOfToConst(schema, index) {
16912
16960
  const { title, description, disabled = false, icon, image, keywords } = schema;
16913
16961
  return { title, description, disabled, icon, image, const: index, keywords };
16914
16962
  }
16915
- OneOfSchema.defaultProps = {
16916
- required: false,
16917
- disabled: false
16918
- };
16919
16963
  var OneOfSchema_default = OneOfSchema;
16920
16964
 
16921
16965
  // src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
@@ -16983,7 +17027,7 @@ function UploadInputAdapter(props) {
16983
17027
  // src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
16984
17028
  var import_jsx_runtime94 = require("react/jsx-runtime");
16985
17029
  function PersistAsyncBlobSchema(props) {
16986
- const { model, schema, submitted, required, errors, onChange } = props;
17030
+ const { model, schema, submitted, required = false, errors, onChange } = props;
16987
17031
  const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0, import_react43.useState)({});
16988
17032
  const [persistAsyncValidations, setPersistAsyncValidations] = (0, import_react43.useState)(null);
16989
17033
  const [validations, setValidations] = (0, import_react43.useState)([]);
@@ -17067,9 +17111,6 @@ function PersistAsyncBlobSchema(props) {
17067
17111
  )
17068
17112
  ] });
17069
17113
  }
17070
- PersistAsyncBlobSchema.defaultProps = {
17071
- required: false
17072
- };
17073
17114
  var PersistAsyncBlobSchema_default = PersistAsyncBlobSchema;
17074
17115
 
17075
17116
  // src/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.tsx
@@ -17085,9 +17126,6 @@ function PersistAsyncSchema(props) {
17085
17126
  }
17086
17127
  return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(PersistAsyncBasicSchema_default, __spreadValues({}, props));
17087
17128
  }
17088
- PersistAsyncSchema.defaultProps = {
17089
- required: false
17090
- };
17091
17129
  var PersistAsyncSchema_default = PersistAsyncSchema;
17092
17130
 
17093
17131
  // src/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
@@ -17117,7 +17155,6 @@ var PromotedOneOfCheckboxControl = (props) => {
17117
17155
  };
17118
17156
  return /* @__PURE__ */ (0, import_jsx_runtime96.jsx)("div", { className: "form-group", children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(import_components57.Checkbox, { id, label: title, checked, onChange: toggleSelection }) });
17119
17157
  };
17120
- PromotedOneOfCheckboxControl.defaultProps = {};
17121
17158
  var PromotedOneOfCheckboxControl_default = PromotedOneOfCheckboxControl;
17122
17159
 
17123
17160
  // src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.tsx
@@ -17301,7 +17338,7 @@ function getValueFromOption(option) {
17301
17338
  var import_react45 = require("react");
17302
17339
  var import_jsx_runtime101 = require("react/jsx-runtime");
17303
17340
  function ValidationAsyncSchema(props) {
17304
- const { schema, model, required, submitted, errors, onChange } = props;
17341
+ const { schema, model, required = false, submitted, errors, onChange } = props;
17305
17342
  const [validationAsyncModel, setValidationAsyncModel] = (0, import_react45.useState)(model);
17306
17343
  const previousRequestedModelReference = (0, import_react45.useRef)(null);
17307
17344
  const [validationAsyncSuccessMessage, setValidationAsyncSuccessMessage] = (0, import_react45.useState)(
@@ -17385,7 +17422,6 @@ function ValidationAsyncSchema(props) {
17385
17422
  };
17386
17423
  return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeSchemaProps));
17387
17424
  }
17388
- ValidationAsyncSchema.defaultProps = { required: false };
17389
17425
  var ValidationAsyncSchema_default = ValidationAsyncSchema;
17390
17426
 
17391
17427
  // src/legacy/jsonSchemaForm/genericSchema/GenericSchema.tsx
@@ -18168,11 +18204,12 @@ var getDefaultValue = (schema) => {
18168
18204
  };
18169
18205
  var BasicTypeSchema = (props) => {
18170
18206
  var _a, _b, _c;
18207
+ const { disabled = false, required = false } = props;
18171
18208
  const onChange = (newModel, _type, metadata) => {
18172
18209
  setChanged(true);
18173
18210
  setModelAndBroadcast(sanitiseModel(newModel), "user", metadata);
18174
18211
  };
18175
- const getValidationKeys = (newModel) => getValidationFailures(newModel, props.schema, props.required);
18212
+ const getValidationKeys = (newModel) => getValidationFailures(newModel, props.schema, required);
18176
18213
  const setModelAndBroadcast = (newModel, type, metadata) => {
18177
18214
  setModel(newModel);
18178
18215
  const validationKeys = getValidationKeys(newModel);
@@ -18252,7 +18289,7 @@ var BasicTypeSchema = (props) => {
18252
18289
  id,
18253
18290
  schema: props.schema,
18254
18291
  value: model,
18255
- disabled: !!props.disabled,
18292
+ disabled: !!disabled,
18256
18293
  onChange,
18257
18294
  onFocus,
18258
18295
  onBlur,
@@ -18277,11 +18314,6 @@ var BasicTypeSchema = (props) => {
18277
18314
  ] })
18278
18315
  ] }) : null;
18279
18316
  };
18280
- BasicTypeSchema.defaultProps = {
18281
- required: false,
18282
- disabled: false,
18283
- onBlur: null
18284
- };
18285
18317
  var BasicTypeSchema_default = BasicTypeSchema;
18286
18318
 
18287
18319
  // src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
@@ -18299,7 +18331,7 @@ var controlTypesWithPersistOnChange = /* @__PURE__ */ new Set([
18299
18331
  FormControlType.UPLOAD
18300
18332
  ]);
18301
18333
  function PersistAsyncBasicSchema(props) {
18302
- const { schema, required, submitted, errors, onChange, onPersistAsync } = props;
18334
+ const { schema, required = false, submitted, errors, onChange, onPersistAsync } = props;
18303
18335
  const intl = (0, import_react_intl40.useIntl)();
18304
18336
  const httpClient = useHttpClient();
18305
18337
  const onEvent = useEventDispatcher();
@@ -18389,9 +18421,6 @@ function PersistAsyncBasicSchema(props) {
18389
18421
  }
18390
18422
  );
18391
18423
  }
18392
- PersistAsyncBasicSchema.defaultProps = {
18393
- required: false
18394
- };
18395
18424
  var PersistAsyncBasicSchema_default = PersistAsyncBasicSchema;
18396
18425
 
18397
18426
  // src/legacy/common/hooks/usePersistAsync/usePersistAsync.ts