@wise/dynamic-flow-client-internal 5.20.0-exp-box-cq-2-e95523a → 5.21.0

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/build/main.mjs CHANGED
@@ -127,7 +127,7 @@ import { useDynamicFlow } from "@wise/dynamic-flow-client";
127
127
  // src/dynamicFlow/telemetry/app-version.ts
128
128
  var appVersion = (
129
129
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
130
- typeof process !== "undefined" ? "5.19.3" : "0.0.0"
130
+ typeof process !== "undefined" ? "5.21.0" : "0.0.0"
131
131
  );
132
132
 
133
133
  // src/dynamicFlow/context-menu/useContextMenu.tsx
@@ -377,30 +377,25 @@ var AlertRenderer_default = AlertRenderer;
377
377
  // ../renderers/src/BoxRenderer.tsx
378
378
  var import_classnames = __toESM(require_classnames());
379
379
  import { jsx as jsx3 } from "react/jsx-runtime";
380
- var getBoxRenderer = (className) => {
381
- const renderer = {
382
- canRenderType: "box",
383
- render: ({ children, control, margin, width }) => {
384
- const hasFixedWidth = width !== "xl";
385
- const hasBorder = control === "bordered" || control === "bordered-web";
386
- const contents = /* @__PURE__ */ jsx3(
387
- "div",
388
- {
389
- className: (0, import_classnames.default)({
390
- [className]: !!className,
391
- "df-box-renderer-border": hasBorder,
392
- [`df-box-renderer-width-${width}`]: hasFixedWidth,
393
- [getMargin(margin)]: !hasFixedWidth
394
- }),
395
- children
396
- }
397
- );
398
- return hasFixedWidth ? /* @__PURE__ */ jsx3("div", { className: (0, import_classnames.default)("df-box-renderer-fixed-width", getMargin(margin)), children: contents }) : contents;
399
- }
400
- };
401
- return renderer;
380
+ var BoxRenderer = {
381
+ canRenderType: "box",
382
+ render: ({ children, control, margin, width }) => {
383
+ const hasFixedWidth = width !== "xl";
384
+ const hasBorder = control === "bordered" || control === "bordered-web";
385
+ const contents = /* @__PURE__ */ jsx3(
386
+ "div",
387
+ {
388
+ className: (0, import_classnames.default)("df-box-renderer", {
389
+ "df-box-renderer-border": hasBorder,
390
+ [`df-box-renderer-width-${width}`]: hasFixedWidth,
391
+ [getMargin(margin)]: !hasFixedWidth
392
+ }),
393
+ children
394
+ }
395
+ );
396
+ return hasFixedWidth ? /* @__PURE__ */ jsx3("div", { className: (0, import_classnames.default)("df-box-renderer-fixed-width", getMargin(margin)), children: contents }) : contents;
397
+ }
402
398
  };
403
- var BoxRenderer = getBoxRenderer("df-box-renderer");
404
399
  var BoxRenderer_default = BoxRenderer;
405
400
 
406
401
  // ../renderers/src/ButtonRenderer/AddressValidationButtonRenderer.tsx
@@ -856,11 +851,24 @@ var getPriority = (control, tags) => {
856
851
  return control && isButtonPriority(control) ? control : "secondary";
857
852
  };
858
853
 
854
+ // ../renderers/src/CheckboxInputRenderer.tsx
855
+ import { Checkbox, ListItem as ListItem3 } from "@transferwise/components";
856
+
859
857
  // ../renderers/src/components/FieldInput.tsx
860
858
  import { Field } from "@transferwise/components";
861
- import { useEffect as useEffect4, useRef } from "react";
862
859
 
863
- // ../renderers/src/utils/scroll-to-if-not-visible.ts
860
+ // ../renderers/src/utils/useScrollToError.ts
861
+ import { useEffect as useEffect4, useRef } from "react";
862
+ var useScrollToError = (validationState, features) => {
863
+ const ref = useRef(null);
864
+ const enabled = (features == null ? void 0 : features.scrollToError) !== false;
865
+ useEffect4(() => {
866
+ if ((validationState == null ? void 0 : validationState.status) === "invalid" && (validationState == null ? void 0 : validationState.message) && enabled) {
867
+ scrollToIfNotVisible(ref.current);
868
+ }
869
+ }, [validationState == null ? void 0 : validationState.status, validationState == null ? void 0 : validationState.message, enabled]);
870
+ return { ref };
871
+ };
864
872
  var scrollToIfNotVisible = (ref) => {
865
873
  const rect = ref == null ? void 0 : ref.getBoundingClientRect();
866
874
  if (!ref || !rect) {
@@ -921,23 +929,19 @@ function FieldInput({
921
929
  description,
922
930
  help,
923
931
  loadingState = "idle",
924
- inlineAlert
932
+ inlineAlert,
933
+ features
925
934
  }) {
935
+ var _a;
926
936
  const labelContent = label && help ? /* @__PURE__ */ jsx19(LabelContentWithHelp, { text: label, help }) : label;
927
- const message = validation == null ? void 0 : validation.message;
928
- const ref = useRef(null);
929
- useEffect4(() => {
930
- if (message) {
931
- scrollToIfNotVisible(ref.current);
932
- }
933
- }, [message]);
937
+ const { ref } = useScrollToError(validation, features);
934
938
  return /* @__PURE__ */ jsx19("div", { ref, children: /* @__PURE__ */ jsx19(
935
939
  Field,
936
940
  {
937
941
  id,
938
942
  label: labelContent,
939
943
  description,
940
- message: message != null ? message : inlineAlert == null ? void 0 : inlineAlert.content,
944
+ message: (_a = validation == null ? void 0 : validation.message) != null ? _a : inlineAlert == null ? void 0 : inlineAlert.content,
941
945
  messageLoading: loadingState !== "idle",
942
946
  sentiment: mapStatusToSentiment(validation, inlineAlert == null ? void 0 : inlineAlert.context),
943
947
  children
@@ -957,33 +961,30 @@ var mapStatusToSentiment = (validation, defaultContext) => {
957
961
  };
958
962
  var FieldInput_default = FieldInput;
959
963
 
960
- // ../renderers/src/CheckboxInputRenderer.tsx
961
- import { Checkbox, ListItem as ListItem3 } from "@transferwise/components";
962
-
963
- // ../renderers/src/utils/listItem/getMedia.tsx
964
- import { jsx as jsx20 } from "react/jsx-runtime";
965
- var getMedia = (media, preferAvatar) => media ? /* @__PURE__ */ jsx20(OptionMedia, { media, preferAvatar }) : void 0;
966
-
967
964
  // ../renderers/src/utils/listItem/getAdditionalText.tsx
968
965
  import { ListItem } from "@transferwise/components";
969
- import { jsx as jsx21 } from "react/jsx-runtime";
966
+ import { jsx as jsx20 } from "react/jsx-runtime";
970
967
  var getAdditionalText = (additionalText) => {
971
968
  if (!additionalText) {
972
969
  return void 0;
973
970
  }
974
- return /* @__PURE__ */ jsx21(ListItem.AdditionalInfo, { children: additionalText });
971
+ return /* @__PURE__ */ jsx20(ListItem.AdditionalInfo, { children: additionalText });
975
972
  };
976
973
 
974
+ // ../renderers/src/utils/listItem/getInlineAlert.tsx
975
+ import { ListItem as ListItem2 } from "@transferwise/components";
976
+ import { jsx as jsx21 } from "react/jsx-runtime";
977
+ var getInlineAlert = (inlineAlert) => inlineAlert ? /* @__PURE__ */ jsx21(ListItem2.Prompt, { sentiment: inlineAlert == null ? void 0 : inlineAlert.context, children: inlineAlert.content }) : void 0;
978
+
979
+ // ../renderers/src/utils/listItem/getMedia.tsx
980
+ import { jsx as jsx22 } from "react/jsx-runtime";
981
+ var getMedia = (media, preferAvatar) => media ? /* @__PURE__ */ jsx22(OptionMedia, { media, preferAvatar }) : void 0;
982
+
977
983
  // ../renderers/src/utils/listItem/getSupportingValues.ts
978
984
  var getSupportingValues = (supportingValues) => {
979
985
  return __spreadValues(__spreadValues({}, (supportingValues == null ? void 0 : supportingValues.value) ? { valueTitle: supportingValues.value } : {}), (supportingValues == null ? void 0 : supportingValues.subvalue) ? { valueSubtitle: supportingValues.subvalue } : {});
980
986
  };
981
987
 
982
- // ../renderers/src/utils/listItem/getInlineAlert.tsx
983
- import { ListItem as ListItem2 } from "@transferwise/components";
984
- import { jsx as jsx22 } from "react/jsx-runtime";
985
- var getInlineAlert = (inlineAlert) => inlineAlert ? /* @__PURE__ */ jsx22(ListItem2.Prompt, { sentiment: inlineAlert == null ? void 0 : inlineAlert.context, children: inlineAlert.content }) : void 0;
986
-
987
988
  // ../renderers/src/CheckboxInputRenderer.tsx
988
989
  import { jsx as jsx23 } from "react/jsx-runtime";
989
990
  var CheckboxInputRenderer = {
@@ -1031,6 +1032,7 @@ var CheckboxComponent = (props) => {
1031
1032
  help,
1032
1033
  inlineAlert: rest.inlineAlert,
1033
1034
  loadingState: rest.fieldLoadingState,
1035
+ features: rest.features,
1034
1036
  children: /* @__PURE__ */ jsx23(Checkbox, __spreadValues({ id }, checkboxProps))
1035
1037
  }
1036
1038
  );
@@ -1046,9 +1048,11 @@ var CheckboxItemComponent = (props) => {
1046
1048
  title,
1047
1049
  validationState,
1048
1050
  value,
1051
+ features,
1049
1052
  onChange
1050
1053
  } = props;
1051
- return /* @__PURE__ */ jsx23(
1054
+ const { ref } = useScrollToError(validationState, features);
1055
+ return /* @__PURE__ */ jsx23("div", { ref, children: /* @__PURE__ */ jsx23(
1052
1056
  ListItem3,
1053
1057
  __spreadValues({
1054
1058
  title,
@@ -1059,7 +1063,7 @@ var CheckboxItemComponent = (props) => {
1059
1063
  prompt: getInlineAlertOrValidation(validationState, inlineAlert),
1060
1064
  control: /* @__PURE__ */ jsx23(ListItem3.Checkbox, { checked: value, onChange: () => onChange(!value) })
1061
1065
  }, getSupportingValues(supportingValues))
1062
- );
1066
+ ) });
1063
1067
  };
1064
1068
  var SwitchItemComponent = (props) => {
1065
1069
  const {
@@ -1072,9 +1076,11 @@ var SwitchItemComponent = (props) => {
1072
1076
  title,
1073
1077
  validationState,
1074
1078
  value,
1079
+ features,
1075
1080
  onChange
1076
1081
  } = props;
1077
- return /* @__PURE__ */ jsx23(
1082
+ const { ref } = useScrollToError(validationState, features);
1083
+ return /* @__PURE__ */ jsx23("div", { ref, children: /* @__PURE__ */ jsx23(
1078
1084
  ListItem3,
1079
1085
  __spreadValues({
1080
1086
  title,
@@ -1085,7 +1091,7 @@ var SwitchItemComponent = (props) => {
1085
1091
  prompt: getInlineAlertOrValidation(validationState, inlineAlert),
1086
1092
  control: /* @__PURE__ */ jsx23(ListItem3.Switch, { checked: value, onClick: () => onChange(!value) })
1087
1093
  }, getSupportingValues(supportingValues))
1088
- );
1094
+ ) });
1089
1095
  };
1090
1096
  var getInlineAlertOrValidation = (validationState, inlineAlert) => {
1091
1097
  if ((validationState == null ? void 0 : validationState.status) === "invalid") {
@@ -1228,6 +1234,7 @@ var DateInputRenderer = {
1228
1234
  inlineAlert: props.inlineAlert,
1229
1235
  loadingState: props.fieldLoadingState,
1230
1236
  help,
1237
+ features: props.features,
1231
1238
  children: /* @__PURE__ */ jsx26(VariableDateInput_default, { control, inputProps })
1232
1239
  }
1233
1240
  );
@@ -1920,6 +1927,7 @@ var IntegerInputRenderer = {
1920
1927
  inlineAlert: props.inlineAlert,
1921
1928
  loadingState: props.fieldLoadingState,
1922
1929
  help,
1930
+ features: props.features,
1923
1931
  children: /* @__PURE__ */ jsx43(InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ jsx43(
1924
1932
  Input,
1925
1933
  __spreadValues({
@@ -2183,6 +2191,7 @@ function MoneyInputRendererComponent(props) {
2183
2191
  description,
2184
2192
  validation: validationState,
2185
2193
  help,
2194
+ features: props.features,
2186
2195
  children: /* @__PURE__ */ jsx52(
2187
2196
  MoneyInput,
2188
2197
  {
@@ -2252,6 +2261,7 @@ function InlineComponent(props) {
2252
2261
  id,
2253
2262
  description,
2254
2263
  disabled,
2264
+ features,
2255
2265
  help,
2256
2266
  options,
2257
2267
  selectedIndices,
@@ -2267,6 +2277,7 @@ function InlineComponent(props) {
2267
2277
  help,
2268
2278
  description,
2269
2279
  validation: validationState,
2280
+ features,
2270
2281
  children: options.map((option, index) => {
2271
2282
  var _a;
2272
2283
  const {
@@ -2334,6 +2345,7 @@ function DefaultComponent(props) {
2334
2345
  autoComplete,
2335
2346
  description,
2336
2347
  disabled,
2348
+ features,
2337
2349
  help,
2338
2350
  options,
2339
2351
  placeholder,
@@ -2379,6 +2391,7 @@ function DefaultComponent(props) {
2379
2391
  help,
2380
2392
  description,
2381
2393
  validation: validationState,
2394
+ features,
2382
2395
  children: /* @__PURE__ */ jsx54(
2383
2396
  SelectInput,
2384
2397
  __spreadValues({
@@ -2425,6 +2438,7 @@ function InlineCheckboxComponent(props) {
2425
2438
  id,
2426
2439
  description,
2427
2440
  disabled,
2441
+ features,
2428
2442
  help,
2429
2443
  options,
2430
2444
  selectedIndices,
@@ -2440,6 +2454,7 @@ function InlineCheckboxComponent(props) {
2440
2454
  help,
2441
2455
  description,
2442
2456
  validation: validationState,
2457
+ features,
2443
2458
  children: options.map((option, index) => {
2444
2459
  var _a;
2445
2460
  const {
@@ -2487,7 +2502,6 @@ import { Status, UploadInput } from "@transferwise/components";
2487
2502
 
2488
2503
  // ../renderers/src/components/UploadFieldInput.tsx
2489
2504
  var import_classnames4 = __toESM(require_classnames());
2490
- import { useEffect as useEffect8, useRef as useRef2 } from "react";
2491
2505
  import { InlineAlert as InlineAlert2 } from "@transferwise/components";
2492
2506
  import { jsx as jsx57, jsxs as jsxs12 } from "react/jsx-runtime";
2493
2507
  function UploadFieldInput({
@@ -2496,17 +2510,12 @@ function UploadFieldInput({
2496
2510
  label,
2497
2511
  description,
2498
2512
  help,
2499
- validation
2513
+ validation,
2514
+ features
2500
2515
  }) {
2501
2516
  const labelContent = label && help ? /* @__PURE__ */ jsx57(LabelContentWithHelp, { text: label, help }) : label;
2502
2517
  const descriptionId = description ? `${id}-description` : void 0;
2503
- const message = validation == null ? void 0 : validation.message;
2504
- const ref = useRef2(null);
2505
- useEffect8(() => {
2506
- if (message) {
2507
- scrollToIfNotVisible(ref.current);
2508
- }
2509
- }, [message]);
2518
+ const { ref } = useScrollToError(validation, features);
2510
2519
  return /* @__PURE__ */ jsxs12(
2511
2520
  "div",
2512
2521
  {
@@ -2563,6 +2572,7 @@ var MultiUploadInputRenderer = {
2563
2572
  title,
2564
2573
  description,
2565
2574
  disabled,
2575
+ features,
2566
2576
  maxSize,
2567
2577
  maxItems,
2568
2578
  uploadLabel,
@@ -2585,6 +2595,7 @@ var MultiUploadInputRenderer = {
2585
2595
  description,
2586
2596
  validation: validationState,
2587
2597
  help,
2598
+ features,
2588
2599
  children: /* @__PURE__ */ jsx58(
2589
2600
  UploadInput,
2590
2601
  {
@@ -2638,6 +2649,7 @@ var NumberInputRenderer = {
2638
2649
  inlineAlert: props.inlineAlert,
2639
2650
  loadingState: props.fieldLoadingState,
2640
2651
  help,
2652
+ features: props.features,
2641
2653
  children: /* @__PURE__ */ jsx59(InputGroup2, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ jsx59(
2642
2654
  Input2,
2643
2655
  __spreadValues({
@@ -2799,6 +2811,7 @@ function Repeatable(props) {
2799
2811
  description,
2800
2812
  editableItem,
2801
2813
  editItemTitle,
2814
+ features,
2802
2815
  items,
2803
2816
  title,
2804
2817
  validationState,
@@ -2809,6 +2822,7 @@ function Repeatable(props) {
2809
2822
  } = props;
2810
2823
  const { formatMessage } = useIntl9();
2811
2824
  const [openModalType, setOpenModalType] = useState9(null);
2825
+ const { ref } = useScrollToError(validationState, features);
2812
2826
  const onAddItem = () => {
2813
2827
  onAdd();
2814
2828
  setOpenModalType("add");
@@ -2831,29 +2845,31 @@ function Repeatable(props) {
2831
2845
  setOpenModalType(null);
2832
2846
  };
2833
2847
  return /* @__PURE__ */ jsxs14(Fragment5, { children: [
2834
- title && /* @__PURE__ */ jsx62(Header6, { title }),
2835
- description && /* @__PURE__ */ jsx62("p", { children: description }),
2836
- /* @__PURE__ */ jsxs14(
2837
- "div",
2838
- {
2839
- className: (0, import_classnames6.default)("form-group", {
2840
- "has-error": (validationState == null ? void 0 : validationState.status) === "invalid"
2841
- }),
2842
- children: [
2843
- items == null ? void 0 : items.map((item, index) => /* @__PURE__ */ jsx62(ItemSummaryOption, { item, onClick: () => onEditItem(index) }, item.id)),
2844
- /* @__PURE__ */ jsx62(
2845
- NavigationOption,
2846
- {
2847
- media: /* @__PURE__ */ jsx62(Plus, {}),
2848
- title: addItemTitle || formatMessage(repeatable_messages_default.addItemTitle),
2849
- showMediaAtAllSizes: true,
2850
- onClick: () => onAddItem()
2851
- }
2852
- ),
2853
- (validationState == null ? void 0 : validationState.status) === "invalid" && /* @__PURE__ */ jsx62(InlineAlert3, { type: "negative", children: validationState.message })
2854
- ]
2855
- }
2856
- ),
2848
+ /* @__PURE__ */ jsxs14("div", { ref, children: [
2849
+ title && /* @__PURE__ */ jsx62(Header6, { title }),
2850
+ description && /* @__PURE__ */ jsx62("p", { children: description }),
2851
+ /* @__PURE__ */ jsxs14(
2852
+ "div",
2853
+ {
2854
+ className: (0, import_classnames6.default)("form-group", {
2855
+ "has-error": (validationState == null ? void 0 : validationState.status) === "invalid"
2856
+ }),
2857
+ children: [
2858
+ items == null ? void 0 : items.map((item, index) => /* @__PURE__ */ jsx62(ItemSummaryOption, { item, onClick: () => onEditItem(index) }, item.id)),
2859
+ /* @__PURE__ */ jsx62(
2860
+ NavigationOption,
2861
+ {
2862
+ media: /* @__PURE__ */ jsx62(Plus, {}),
2863
+ title: addItemTitle || formatMessage(repeatable_messages_default.addItemTitle),
2864
+ showMediaAtAllSizes: true,
2865
+ onClick: () => onAddItem()
2866
+ }
2867
+ ),
2868
+ (validationState == null ? void 0 : validationState.status) === "invalid" && /* @__PURE__ */ jsx62(InlineAlert3, { type: "negative", children: validationState.message })
2869
+ ]
2870
+ }
2871
+ )
2872
+ ] }),
2857
2873
  /* @__PURE__ */ jsx62(
2858
2874
  Modal4,
2859
2875
  {
@@ -3082,6 +3098,7 @@ function BlockSearchRendererComponent({
3082
3098
  id,
3083
3099
  hint,
3084
3100
  isLoading,
3101
+ features,
3085
3102
  margin,
3086
3103
  query,
3087
3104
  state,
@@ -3092,23 +3109,34 @@ function BlockSearchRendererComponent({
3092
3109
  const [hasSearched, setHasSearched] = useState10(false);
3093
3110
  const { formatMessage } = useIntl12();
3094
3111
  return /* @__PURE__ */ jsxs18("div", { className: getMargin(margin), children: [
3095
- /* @__PURE__ */ jsx66(FieldInput_default, { id, description: "", validation: void 0, help: "", label: title, children: /* @__PURE__ */ jsx66(InputGroup3, { addonStart: { content: /* @__PURE__ */ jsx66(Search, { size: 24 }) }, children: /* @__PURE__ */ jsx66(
3096
- Input4,
3112
+ /* @__PURE__ */ jsx66(
3113
+ FieldInput_default,
3097
3114
  {
3098
3115
  id,
3099
- name: id,
3100
- placeholder: hint,
3101
- type: "text",
3102
- value: query,
3103
- onChange: ({ currentTarget: { value } }) => {
3104
- if (!hasSearched) {
3105
- setHasSearched(true);
3106
- trackEvent("Search Started");
3116
+ description: "",
3117
+ validation: void 0,
3118
+ help: "",
3119
+ label: title,
3120
+ features,
3121
+ children: /* @__PURE__ */ jsx66(InputGroup3, { addonStart: { content: /* @__PURE__ */ jsx66(Search, { size: 24 }) }, children: /* @__PURE__ */ jsx66(
3122
+ Input4,
3123
+ {
3124
+ id,
3125
+ name: id,
3126
+ placeholder: hint,
3127
+ type: "text",
3128
+ value: query,
3129
+ onChange: ({ currentTarget: { value } }) => {
3130
+ if (!hasSearched) {
3131
+ setHasSearched(true);
3132
+ trackEvent("Search Started");
3133
+ }
3134
+ onChange(value);
3135
+ }
3107
3136
  }
3108
- onChange(value);
3109
- }
3137
+ ) })
3110
3138
  }
3111
- ) }) }),
3139
+ ),
3112
3140
  isLoading ? /* @__PURE__ */ jsx66("span", { children: formatMessage(search_messages_default.loading) }) : /* @__PURE__ */ jsx66(SearchResultContent, { state, trackEvent })
3113
3141
  ] });
3114
3142
  }
@@ -3177,50 +3205,62 @@ function InlineSearchRenderer({
3177
3205
  id,
3178
3206
  hint,
3179
3207
  isLoading,
3208
+ features,
3180
3209
  margin,
3181
- onChange,
3182
3210
  state,
3183
3211
  title,
3212
+ onChange,
3184
3213
  trackEvent
3185
3214
  }) {
3186
3215
  const [hasSearched, setHasSearched] = useState11(false);
3187
3216
  const intl = useIntl13();
3188
- return /* @__PURE__ */ jsx67("div", { className: getMargin(margin), children: /* @__PURE__ */ jsx67(FieldInput_default, { id, description: "", validation: void 0, help: "", label: title, children: /* @__PURE__ */ jsx67(
3189
- Typeahead,
3217
+ return /* @__PURE__ */ jsx67("div", { className: getMargin(margin), children: /* @__PURE__ */ jsx67(
3218
+ FieldInput_default,
3190
3219
  {
3191
- id: "typeahead-input-id",
3192
- intl,
3193
- name: "typeahead-input-name",
3194
- size: "md",
3195
- placeholder: hint,
3196
- maxHeight: 100,
3197
- footer: /* @__PURE__ */ jsx67(TypeaheadFooter, { state, isLoading }),
3198
- multiple: false,
3199
- clearable: false,
3200
- addon: /* @__PURE__ */ jsx67(Search2, { size: 24 }),
3201
- options: state.type === "results" ? state.results.map(mapResultToTypeaheadOption) : [],
3202
- minQueryLength: 1,
3203
- onChange: (values) => {
3204
- if (values.length > 0) {
3205
- const [updatedValue] = values;
3206
- const { value: result } = updatedValue;
3207
- if (result) {
3208
- trackEvent("Search Result Selected", __spreadValues({
3209
- type: result.type
3210
- }, result.type === "action" ? { actionId: result.id } : {}));
3211
- result.onClick();
3220
+ id,
3221
+ description: "",
3222
+ validation: void 0,
3223
+ help: "",
3224
+ label: title,
3225
+ features,
3226
+ children: /* @__PURE__ */ jsx67(
3227
+ Typeahead,
3228
+ {
3229
+ id: "typeahead-input-id",
3230
+ intl,
3231
+ name: "typeahead-input-name",
3232
+ size: "md",
3233
+ placeholder: hint,
3234
+ maxHeight: 100,
3235
+ footer: /* @__PURE__ */ jsx67(TypeaheadFooter, { state, isLoading }),
3236
+ multiple: false,
3237
+ clearable: false,
3238
+ addon: /* @__PURE__ */ jsx67(Search2, { size: 24 }),
3239
+ options: state.type === "results" ? state.results.map(mapResultToTypeaheadOption) : [],
3240
+ minQueryLength: 1,
3241
+ onChange: (values) => {
3242
+ if (values.length > 0) {
3243
+ const [updatedValue] = values;
3244
+ const { value: result } = updatedValue;
3245
+ if (result) {
3246
+ trackEvent("Search Result Selected", __spreadValues({
3247
+ type: result.type
3248
+ }, result.type === "action" ? { actionId: result.id } : {}));
3249
+ result.onClick();
3250
+ }
3251
+ }
3252
+ },
3253
+ onInputChange: (query) => {
3254
+ if (!hasSearched) {
3255
+ setHasSearched(true);
3256
+ trackEvent("Search Started");
3257
+ }
3258
+ onChange(query);
3212
3259
  }
3213
3260
  }
3214
- },
3215
- onInputChange: (query) => {
3216
- if (!hasSearched) {
3217
- setHasSearched(true);
3218
- trackEvent("Search Started");
3219
- }
3220
- onChange(query);
3221
- }
3261
+ )
3222
3262
  }
3223
- ) }) });
3263
+ ) });
3224
3264
  }
3225
3265
  function mapResultToTypeaheadOption(result) {
3226
3266
  return {
@@ -3303,6 +3343,7 @@ function RadioInputRendererComponent(props) {
3303
3343
  children,
3304
3344
  description,
3305
3345
  disabled,
3346
+ features,
3306
3347
  help,
3307
3348
  title,
3308
3349
  options,
@@ -3319,6 +3360,7 @@ function RadioInputRendererComponent(props) {
3319
3360
  help,
3320
3361
  description,
3321
3362
  validation: validationState,
3363
+ features,
3322
3364
  children: /* @__PURE__ */ jsx70("span", { children: /* @__PURE__ */ jsx70(
3323
3365
  RadioGroup,
3324
3366
  {
@@ -3343,7 +3385,7 @@ function RadioInputRendererComponent(props) {
3343
3385
 
3344
3386
  // ../renderers/src/SelectInputRenderer/TabInputRendererComponent.tsx
3345
3387
  import { Tabs } from "@transferwise/components";
3346
- import { useEffect as useEffect9 } from "react";
3388
+ import { useEffect as useEffect8 } from "react";
3347
3389
  import { Fragment as Fragment9, jsx as jsx71, jsxs as jsxs21 } from "react/jsx-runtime";
3348
3390
  function TabInputRendererComponent(props) {
3349
3391
  const {
@@ -3351,6 +3393,7 @@ function TabInputRendererComponent(props) {
3351
3393
  children,
3352
3394
  description,
3353
3395
  disabled,
3396
+ features,
3354
3397
  help,
3355
3398
  title,
3356
3399
  options,
@@ -3358,7 +3401,7 @@ function TabInputRendererComponent(props) {
3358
3401
  validationState,
3359
3402
  onSelect
3360
3403
  } = props;
3361
- useEffect9(() => {
3404
+ useEffect8(() => {
3362
3405
  if (!isValidIndex2(selectedIndex, options.length)) {
3363
3406
  onSelect(0);
3364
3407
  }
@@ -3372,6 +3415,7 @@ function TabInputRendererComponent(props) {
3372
3415
  help,
3373
3416
  description,
3374
3417
  validation: validationState,
3418
+ features,
3375
3419
  children: /* @__PURE__ */ jsx71(
3376
3420
  Tabs,
3377
3421
  {
@@ -3404,6 +3448,7 @@ function SelectInputRendererComponent(props) {
3404
3448
  children,
3405
3449
  description,
3406
3450
  disabled,
3451
+ features,
3407
3452
  help,
3408
3453
  title,
3409
3454
  options,
@@ -3450,6 +3495,7 @@ function SelectInputRendererComponent(props) {
3450
3495
  help,
3451
3496
  description,
3452
3497
  validation: validationState,
3498
+ features,
3453
3499
  children: /* @__PURE__ */ jsx72(
3454
3500
  SelectInput2,
3455
3501
  __spreadValues({
@@ -3471,7 +3517,7 @@ function SelectInputRendererComponent(props) {
3471
3517
  }
3472
3518
 
3473
3519
  // ../renderers/src/SelectInputRenderer/SegmentedInputRendererComponent.tsx
3474
- import { useEffect as useEffect10 } from "react";
3520
+ import { useEffect as useEffect9 } from "react";
3475
3521
  import { SegmentedControl } from "@transferwise/components";
3476
3522
  import { Fragment as Fragment11, jsx as jsx73, jsxs as jsxs23 } from "react/jsx-runtime";
3477
3523
  function SegmentedInputRendererComponent(props) {
@@ -3479,6 +3525,7 @@ function SegmentedInputRendererComponent(props) {
3479
3525
  id,
3480
3526
  children,
3481
3527
  description,
3528
+ features,
3482
3529
  help,
3483
3530
  title,
3484
3531
  options,
@@ -3486,7 +3533,7 @@ function SegmentedInputRendererComponent(props) {
3486
3533
  validationState,
3487
3534
  onSelect
3488
3535
  } = props;
3489
- useEffect10(() => {
3536
+ useEffect9(() => {
3490
3537
  if (!isValidIndex3(selectedIndex, options.length)) {
3491
3538
  onSelect(0);
3492
3539
  }
@@ -3500,6 +3547,7 @@ function SegmentedInputRendererComponent(props) {
3500
3547
  help,
3501
3548
  description,
3502
3549
  validation: validationState,
3550
+ features,
3503
3551
  children: /* @__PURE__ */ jsx73(
3504
3552
  SegmentedControl,
3505
3553
  {
@@ -3524,13 +3572,14 @@ var isValidIndex3 = (index, options) => index !== null && index >= 0 && index <
3524
3572
 
3525
3573
  // ../renderers/src/SelectInputRenderer/RadioItemRendererComponent.tsx
3526
3574
  import { Header as Header8, InlineAlert as InlineAlert4, List as List2, ListItem as ListItem11 } from "@transferwise/components";
3527
- import { Fragment as Fragment12, jsx as jsx74, jsxs as jsxs24 } from "react/jsx-runtime";
3575
+ import { jsx as jsx74, jsxs as jsxs24 } from "react/jsx-runtime";
3528
3576
  function RadioItemRendererComponent(props) {
3529
3577
  const {
3530
3578
  id,
3531
3579
  children,
3532
3580
  description: rootDescription,
3533
3581
  disabled: rootDisabled,
3582
+ features,
3534
3583
  help,
3535
3584
  title: rootTitle,
3536
3585
  options,
@@ -3538,7 +3587,8 @@ function RadioItemRendererComponent(props) {
3538
3587
  validationState,
3539
3588
  onSelect
3540
3589
  } = props;
3541
- return /* @__PURE__ */ jsxs24(Fragment12, { children: [
3590
+ const { ref } = useScrollToError(validationState, features);
3591
+ return /* @__PURE__ */ jsxs24("div", { ref, children: [
3542
3592
  rootTitle && /* @__PURE__ */ jsx74(
3543
3593
  Header8,
3544
3594
  {
@@ -3651,12 +3701,12 @@ var StatusListRenderer_default = StatusListRenderer;
3651
3701
 
3652
3702
  // ../renderers/src/utils/useCustomTheme.ts
3653
3703
  import { useTheme } from "@wise/components-theming";
3654
- import { useEffect as useEffect11, useMemo } from "react";
3704
+ import { useEffect as useEffect10, useMemo } from "react";
3655
3705
  var ThemeRequiredEventName = "Theme Required";
3656
3706
  var useCustomTheme = (theme, trackEvent) => {
3657
3707
  const theming = useTheme();
3658
3708
  const previousTheme = useMemo(() => theming.theme, []);
3659
- useEffect11(() => {
3709
+ useEffect10(() => {
3660
3710
  theming.setTheme(theme);
3661
3711
  trackEvent(ThemeRequiredEventName, { theme });
3662
3712
  return theme !== previousTheme ? () => {
@@ -3669,7 +3719,7 @@ var useCustomTheme = (theme, trackEvent) => {
3669
3719
 
3670
3720
  // ../renderers/src/step/StepFooter.tsx
3671
3721
  import { Button as Button7 } from "@transferwise/components";
3672
- import { useEffect as useEffect12, useRef as useRef3, useState as useState12 } from "react";
3722
+ import { useEffect as useEffect11, useRef as useRef2, useState as useState12 } from "react";
3673
3723
  import { useIntl as useIntl14 } from "react-intl";
3674
3724
 
3675
3725
  // ../renderers/src/messages/step.messages.ts
@@ -3683,7 +3733,7 @@ var step_messages_default = defineMessages11({
3683
3733
  });
3684
3734
 
3685
3735
  // ../renderers/src/step/StepFooter.tsx
3686
- import { Fragment as Fragment13, jsx as jsx77, jsxs as jsxs26 } from "react/jsx-runtime";
3736
+ import { Fragment as Fragment12, jsx as jsx77, jsxs as jsxs26 } from "react/jsx-runtime";
3687
3737
  var SCROLL_TO_BOTTOM = "scroll-to-bottom";
3688
3738
  var StepFooter = ({ footer, tags }) => {
3689
3739
  if (tags == null ? void 0 : tags.includes(SCROLL_TO_BOTTOM)) {
@@ -3697,7 +3747,7 @@ var DefaultFooter = ({ footer }) => {
3697
3747
  };
3698
3748
  var FooterWithScrollButton = ({ footer }) => {
3699
3749
  const { formatMessage } = useIntl14();
3700
- const endOfLayoutRef = useRef3(null);
3750
+ const endOfLayoutRef = useRef2(null);
3701
3751
  const isElementVisible = useIsElementVisible(endOfLayoutRef);
3702
3752
  const scrollButton = /* @__PURE__ */ jsx77(
3703
3753
  Button7,
@@ -3717,7 +3767,7 @@ var FooterWithScrollButton = ({ footer }) => {
3717
3767
  if (isElementVisible && !hasStepFooterContent) {
3718
3768
  return /* @__PURE__ */ jsx77("div", { ref: endOfLayoutRef, "aria-hidden": "true" });
3719
3769
  }
3720
- return /* @__PURE__ */ jsxs26(Fragment13, { children: [
3770
+ return /* @__PURE__ */ jsxs26(Fragment12, { children: [
3721
3771
  /* @__PURE__ */ jsx77("div", { ref: endOfLayoutRef, "aria-hidden": "true" }),
3722
3772
  /* @__PURE__ */ jsxs26("div", { className: "df-step-fixed__footer", children: [
3723
3773
  !isElementVisible && scrollButton,
@@ -3727,7 +3777,7 @@ var FooterWithScrollButton = ({ footer }) => {
3727
3777
  };
3728
3778
  var useIsElementVisible = (elementRef) => {
3729
3779
  const [isVisible, setIsVisible] = useState12(false);
3730
- useEffect12(() => {
3780
+ useEffect11(() => {
3731
3781
  const element = elementRef.current;
3732
3782
  if (!element) return;
3733
3783
  const observer = new IntersectionObserver(([entry]) => {
@@ -3741,10 +3791,10 @@ var useIsElementVisible = (elementRef) => {
3741
3791
 
3742
3792
  // ../renderers/src/step/StepHeader.tsx
3743
3793
  import { Title as Title2 } from "@transferwise/components";
3744
- import { Fragment as Fragment14, jsx as jsx78, jsxs as jsxs27 } from "react/jsx-runtime";
3794
+ import { Fragment as Fragment13, jsx as jsx78, jsxs as jsxs27 } from "react/jsx-runtime";
3745
3795
  var StepHeader = ({ title, description, tags }) => {
3746
3796
  const { titleType, alignmentClassName } = getHeaderStyle(tags);
3747
- return /* @__PURE__ */ jsxs27(Fragment14, { children: [
3797
+ return /* @__PURE__ */ jsxs27(Fragment13, { children: [
3748
3798
  title ? /* @__PURE__ */ jsx78(Title2, { as: "h1", type: titleType, className: `${alignmentClassName} m-b-2`, children: title }) : void 0,
3749
3799
  description ? /* @__PURE__ */ jsx78("p", { className: `${alignmentClassName} np-text-body-large`, children: description }) : void 0
3750
3800
  ] });
@@ -4090,6 +4140,7 @@ var TextInputRenderer = {
4090
4140
  inlineAlert: props.inlineAlert,
4091
4141
  loadingState: props.fieldLoadingState,
4092
4142
  help,
4143
+ features: props.features,
4093
4144
  children: /* @__PURE__ */ jsx87(InputGroup4, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ jsx87(VariableTextInput, __spreadValues({}, inputProps)) })
4094
4145
  }
4095
4146
  );
@@ -4108,7 +4159,18 @@ import { jsx as jsx88 } from "react/jsx-runtime";
4108
4159
  var UploadInputRenderer = {
4109
4160
  canRenderType: "input-upload",
4110
4161
  render: (props) => {
4111
- const { id, accepts, title, description, disabled, maxSize, validationState, value, onUpload } = props;
4162
+ const {
4163
+ id,
4164
+ accepts,
4165
+ title,
4166
+ description,
4167
+ disabled,
4168
+ features,
4169
+ maxSize,
4170
+ validationState,
4171
+ value,
4172
+ onUpload
4173
+ } = props;
4112
4174
  const onUploadFile = async (formData) => {
4113
4175
  const file = formData.get("file");
4114
4176
  return onUpload(file).then(() => ({
@@ -4127,6 +4189,7 @@ var UploadInputRenderer = {
4127
4189
  label: void 0,
4128
4190
  description: void 0,
4129
4191
  validation: validationState,
4192
+ features,
4130
4193
  children: /* @__PURE__ */ jsx88(
4131
4194
  UploadInput2,
4132
4195
  {
@@ -4167,6 +4230,7 @@ var LargeUploadRenderer = {
4167
4230
  type,
4168
4231
  validationState,
4169
4232
  maxSize = null,
4233
+ features,
4170
4234
  onUpload
4171
4235
  } = _a, rest = __objRest(_a, [
4172
4236
  "id",
@@ -4179,6 +4243,7 @@ var LargeUploadRenderer = {
4179
4243
  "type",
4180
4244
  "validationState",
4181
4245
  "maxSize",
4246
+ "features",
4182
4247
  "onUpload"
4183
4248
  ]);
4184
4249
  const uploadProps = __spreadProps(__spreadValues({}, rest), { id, name: id, maxSize });
@@ -4201,6 +4266,7 @@ var LargeUploadRenderer = {
4201
4266
  description,
4202
4267
  validation: validationState,
4203
4268
  help,
4269
+ features,
4204
4270
  children: /* @__PURE__ */ jsx88(
4205
4271
  Upload,
4206
4272
  __spreadProps(__spreadValues({}, uploadProps), {