@wise/dynamic-flow-client-internal 4.16.0 → 4.17.0-exp-modal-renderer-b16f932
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.js +924 -926
- package/build/main.mjs +871 -873
- package/build/types/index.d.ts +3 -3
- package/package.json +5 -5
package/build/main.mjs
CHANGED
|
@@ -32,7 +32,7 @@ var __objRest = (source, exclude) => {
|
|
|
32
32
|
|
|
33
33
|
// src/index.ts
|
|
34
34
|
import { makeHttpClient } from "@wise/dynamic-flow-client";
|
|
35
|
-
import {
|
|
35
|
+
import { findRendererPropsByType, isValidSchema, JsonSchemaForm } from "@wise/dynamic-flow-client";
|
|
36
36
|
|
|
37
37
|
// src/i18n/index.ts
|
|
38
38
|
import { translations as coreTranslations } from "@wise/dynamic-flow-client";
|
|
@@ -693,6 +693,101 @@ var mapCtaToAlertAction = (callToAction) => {
|
|
|
693
693
|
};
|
|
694
694
|
var AlertRenderer_default = AlertRenderer;
|
|
695
695
|
|
|
696
|
+
// ../renderers/src/BoxRenderer.tsx
|
|
697
|
+
import classNames from "classnames";
|
|
698
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
699
|
+
var BoxRenderer = {
|
|
700
|
+
canRenderType: "box",
|
|
701
|
+
render: ({ children, control, margin, width }) => {
|
|
702
|
+
const hasFixedWidth = width !== "xl";
|
|
703
|
+
const hasBorder = control === "bordered" || control === "bordered-web";
|
|
704
|
+
const contents = /* @__PURE__ */ jsx2(
|
|
705
|
+
"div",
|
|
706
|
+
{
|
|
707
|
+
className: classNames({
|
|
708
|
+
"df-box-renderer-border": hasBorder,
|
|
709
|
+
[`df-box-renderer-width-${width}`]: hasFixedWidth,
|
|
710
|
+
[getMargin(margin)]: !hasFixedWidth
|
|
711
|
+
}),
|
|
712
|
+
children
|
|
713
|
+
}
|
|
714
|
+
);
|
|
715
|
+
return hasFixedWidth ? /* @__PURE__ */ jsx2("div", { className: classNames("df-box-renderer-fixed-width", getMargin(margin)), children: contents }) : contents;
|
|
716
|
+
}
|
|
717
|
+
};
|
|
718
|
+
var BoxRenderer_default = BoxRenderer;
|
|
719
|
+
|
|
720
|
+
// ../renderers/src/ButtonRenderer.tsx
|
|
721
|
+
import { Button } from "@transferwise/components";
|
|
722
|
+
import { useState } from "react";
|
|
723
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
724
|
+
var ButtonRenderer = {
|
|
725
|
+
canRenderType: "button",
|
|
726
|
+
render: ButtonComponent
|
|
727
|
+
};
|
|
728
|
+
function ButtonComponent(props) {
|
|
729
|
+
const { control, context, disabled, margin, title, size, stepLoadingState, onClick } = props;
|
|
730
|
+
const [isActive, setActive] = useState(false);
|
|
731
|
+
const isLoading = isActive && stepLoadingState !== "idle";
|
|
732
|
+
const priority = mapControl(control);
|
|
733
|
+
const type = priority === "tertiary" ? void 0 : mapContext(context);
|
|
734
|
+
return /* @__PURE__ */ jsx3(
|
|
735
|
+
Button,
|
|
736
|
+
{
|
|
737
|
+
block: true,
|
|
738
|
+
className: getMargin(margin),
|
|
739
|
+
disabled: isLoading ? false : disabled,
|
|
740
|
+
priority,
|
|
741
|
+
size: mapSize(size),
|
|
742
|
+
loading: isLoading,
|
|
743
|
+
type,
|
|
744
|
+
onClick: () => {
|
|
745
|
+
setActive(true);
|
|
746
|
+
onClick();
|
|
747
|
+
},
|
|
748
|
+
onBlur: () => {
|
|
749
|
+
setActive(false);
|
|
750
|
+
},
|
|
751
|
+
children: title
|
|
752
|
+
}
|
|
753
|
+
);
|
|
754
|
+
}
|
|
755
|
+
var mapContext = (context) => {
|
|
756
|
+
switch (context) {
|
|
757
|
+
case "neutral":
|
|
758
|
+
case "warning":
|
|
759
|
+
return "accent";
|
|
760
|
+
default:
|
|
761
|
+
return context;
|
|
762
|
+
}
|
|
763
|
+
};
|
|
764
|
+
var mapControl = (control) => {
|
|
765
|
+
switch (control) {
|
|
766
|
+
case "primary":
|
|
767
|
+
case "tertiary":
|
|
768
|
+
return control;
|
|
769
|
+
default:
|
|
770
|
+
return "secondary";
|
|
771
|
+
}
|
|
772
|
+
};
|
|
773
|
+
var mapSize = (size) => {
|
|
774
|
+
if (!size) {
|
|
775
|
+
return void 0;
|
|
776
|
+
}
|
|
777
|
+
switch (size) {
|
|
778
|
+
case "xs":
|
|
779
|
+
case "sm":
|
|
780
|
+
return "sm";
|
|
781
|
+
case "lg":
|
|
782
|
+
case "xl":
|
|
783
|
+
return "lg";
|
|
784
|
+
case "md":
|
|
785
|
+
default:
|
|
786
|
+
return "md";
|
|
787
|
+
}
|
|
788
|
+
};
|
|
789
|
+
var ButtonRenderer_default = ButtonRenderer;
|
|
790
|
+
|
|
696
791
|
// ../renderers/src/components/FieldInput.tsx
|
|
697
792
|
import { Field } from "@transferwise/components";
|
|
698
793
|
|
|
@@ -711,14 +806,14 @@ var help_messages_default = defineMessages({
|
|
|
711
806
|
});
|
|
712
807
|
|
|
713
808
|
// ../renderers/src/components/Help.tsx
|
|
714
|
-
import { jsx as
|
|
809
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
715
810
|
function Help({ help, onClick }) {
|
|
716
811
|
const intl = useIntl();
|
|
717
|
-
return /* @__PURE__ */
|
|
812
|
+
return /* @__PURE__ */ jsx4(
|
|
718
813
|
Info,
|
|
719
814
|
{
|
|
720
815
|
className: "m-l-1",
|
|
721
|
-
content: /* @__PURE__ */
|
|
816
|
+
content: /* @__PURE__ */ jsx4(Markdown, { config: { link: { target: "_blank" } }, children: help }),
|
|
722
817
|
presentation: "POPOVER",
|
|
723
818
|
size: "sm",
|
|
724
819
|
"aria-label": intl.formatMessage(help_messages_default.helpAria),
|
|
@@ -729,19 +824,19 @@ function Help({ help, onClick }) {
|
|
|
729
824
|
var Help_default = Help;
|
|
730
825
|
|
|
731
826
|
// ../renderers/src/components/LabelContentWithHelp.tsx
|
|
732
|
-
import { jsx as
|
|
827
|
+
import { jsx as jsx5, jsxs } from "react/jsx-runtime";
|
|
733
828
|
function LabelContentWithHelp({ text, help }) {
|
|
734
829
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
735
830
|
text,
|
|
736
|
-
/* @__PURE__ */
|
|
831
|
+
/* @__PURE__ */ jsx5(Help_default, { help })
|
|
737
832
|
] });
|
|
738
833
|
}
|
|
739
834
|
|
|
740
835
|
// ../renderers/src/components/FieldInput.tsx
|
|
741
|
-
import { jsx as
|
|
836
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
742
837
|
function FieldInput({ id, children, label, validation, description, help }) {
|
|
743
|
-
const labelContent = label && help ? /* @__PURE__ */
|
|
744
|
-
return /* @__PURE__ */
|
|
838
|
+
const labelContent = label && help ? /* @__PURE__ */ jsx6(LabelContentWithHelp, { text: label, help }) : label;
|
|
839
|
+
return /* @__PURE__ */ jsx6(
|
|
745
840
|
Field,
|
|
746
841
|
{
|
|
747
842
|
id,
|
|
@@ -766,7 +861,7 @@ var FieldInput_default = FieldInput;
|
|
|
766
861
|
|
|
767
862
|
// ../renderers/src/CheckboxInputRenderer.tsx
|
|
768
863
|
import { Checkbox } from "@transferwise/components";
|
|
769
|
-
import { jsx as
|
|
864
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
770
865
|
var CheckboxInputRenderer = {
|
|
771
866
|
canRenderType: "input-checkbox",
|
|
772
867
|
render: (props) => {
|
|
@@ -790,106 +885,11 @@ var CheckboxInputRenderer = {
|
|
|
790
885
|
"value"
|
|
791
886
|
]);
|
|
792
887
|
const checkboxProps = __spreadProps(__spreadValues({}, rest), { label: title, secondary: description, checked: value });
|
|
793
|
-
return /* @__PURE__ */
|
|
888
|
+
return /* @__PURE__ */ jsx7(FieldInput_default, { id, label: "", description: "", validation: validationState, help, children: /* @__PURE__ */ jsx7(Checkbox, __spreadValues({ id }, checkboxProps)) });
|
|
794
889
|
}
|
|
795
890
|
};
|
|
796
891
|
var CheckboxInputRenderer_default = CheckboxInputRenderer;
|
|
797
892
|
|
|
798
|
-
// ../renderers/src/BoxRenderer.tsx
|
|
799
|
-
import classNames from "classnames";
|
|
800
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
801
|
-
var BoxRenderer = {
|
|
802
|
-
canRenderType: "box",
|
|
803
|
-
render: ({ children, control, margin, width }) => {
|
|
804
|
-
const hasFixedWidth = width !== "xl";
|
|
805
|
-
const hasBorder = control === "bordered" || control === "bordered-web";
|
|
806
|
-
const contents = /* @__PURE__ */ jsx6(
|
|
807
|
-
"div",
|
|
808
|
-
{
|
|
809
|
-
className: classNames({
|
|
810
|
-
"df-box-renderer-border": hasBorder,
|
|
811
|
-
[`df-box-renderer-width-${width}`]: hasFixedWidth,
|
|
812
|
-
[getMargin(margin)]: !hasFixedWidth
|
|
813
|
-
}),
|
|
814
|
-
children
|
|
815
|
-
}
|
|
816
|
-
);
|
|
817
|
-
return hasFixedWidth ? /* @__PURE__ */ jsx6("div", { className: classNames("df-box-renderer-fixed-width", getMargin(margin)), children: contents }) : contents;
|
|
818
|
-
}
|
|
819
|
-
};
|
|
820
|
-
var BoxRenderer_default = BoxRenderer;
|
|
821
|
-
|
|
822
|
-
// ../renderers/src/ButtonRenderer.tsx
|
|
823
|
-
import { Button } from "@transferwise/components";
|
|
824
|
-
import { useState } from "react";
|
|
825
|
-
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
826
|
-
var ButtonRenderer = {
|
|
827
|
-
canRenderType: "button",
|
|
828
|
-
render: ButtonComponent
|
|
829
|
-
};
|
|
830
|
-
function ButtonComponent(props) {
|
|
831
|
-
const { control, context, disabled, margin, title, size, stepLoadingState, onClick } = props;
|
|
832
|
-
const [isActive, setActive] = useState(false);
|
|
833
|
-
const isLoading = isActive && stepLoadingState !== "idle";
|
|
834
|
-
const priority = mapControl(control);
|
|
835
|
-
const type = priority === "tertiary" ? void 0 : mapContext(context);
|
|
836
|
-
return /* @__PURE__ */ jsx7(
|
|
837
|
-
Button,
|
|
838
|
-
{
|
|
839
|
-
block: true,
|
|
840
|
-
className: getMargin(margin),
|
|
841
|
-
disabled: isLoading ? false : disabled,
|
|
842
|
-
priority,
|
|
843
|
-
size: mapSize(size),
|
|
844
|
-
loading: isLoading,
|
|
845
|
-
type,
|
|
846
|
-
onClick: () => {
|
|
847
|
-
setActive(true);
|
|
848
|
-
onClick();
|
|
849
|
-
},
|
|
850
|
-
onBlur: () => {
|
|
851
|
-
setActive(false);
|
|
852
|
-
},
|
|
853
|
-
children: title
|
|
854
|
-
}
|
|
855
|
-
);
|
|
856
|
-
}
|
|
857
|
-
var mapContext = (context) => {
|
|
858
|
-
switch (context) {
|
|
859
|
-
case "neutral":
|
|
860
|
-
case "warning":
|
|
861
|
-
return "accent";
|
|
862
|
-
default:
|
|
863
|
-
return context;
|
|
864
|
-
}
|
|
865
|
-
};
|
|
866
|
-
var mapControl = (control) => {
|
|
867
|
-
switch (control) {
|
|
868
|
-
case "primary":
|
|
869
|
-
case "tertiary":
|
|
870
|
-
return control;
|
|
871
|
-
default:
|
|
872
|
-
return "secondary";
|
|
873
|
-
}
|
|
874
|
-
};
|
|
875
|
-
var mapSize = (size) => {
|
|
876
|
-
if (!size) {
|
|
877
|
-
return void 0;
|
|
878
|
-
}
|
|
879
|
-
switch (size) {
|
|
880
|
-
case "xs":
|
|
881
|
-
case "sm":
|
|
882
|
-
return "sm";
|
|
883
|
-
case "lg":
|
|
884
|
-
case "xl":
|
|
885
|
-
return "lg";
|
|
886
|
-
case "md":
|
|
887
|
-
default:
|
|
888
|
-
return "md";
|
|
889
|
-
}
|
|
890
|
-
};
|
|
891
|
-
var ButtonRenderer_default = ButtonRenderer;
|
|
892
|
-
|
|
893
893
|
// ../renderers/src/ColumnsRenderer.tsx
|
|
894
894
|
import classNames2 from "classnames";
|
|
895
895
|
import { jsx as jsx8, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
@@ -1190,63 +1190,155 @@ var DividerRenderer = {
|
|
|
1190
1190
|
};
|
|
1191
1191
|
var DividerRenderer_default = DividerRenderer;
|
|
1192
1192
|
|
|
1193
|
-
// ../renderers/src/
|
|
1194
|
-
import {
|
|
1195
|
-
var FormRenderer = {
|
|
1196
|
-
canRenderType: "form",
|
|
1197
|
-
render: ({ children, margin }) => /* @__PURE__ */ jsx19("div", { className: getMargin(margin), children })
|
|
1198
|
-
};
|
|
1199
|
-
var FormRenderer_default = FormRenderer;
|
|
1193
|
+
// ../renderers/src/ExternalConfirmationRenderer.tsx
|
|
1194
|
+
import { Button as Button2, Markdown as Markdown2, Modal } from "@transferwise/components";
|
|
1200
1195
|
|
|
1201
|
-
// ../renderers/src/
|
|
1202
|
-
import {
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1196
|
+
// ../renderers/src/messages/external-confirmation.messages.ts
|
|
1197
|
+
import { defineMessages as defineMessages2 } from "react-intl";
|
|
1198
|
+
var external_confirmation_messages_default = defineMessages2({
|
|
1199
|
+
title: {
|
|
1200
|
+
id: "df.wise.ExternalConfirmation.title",
|
|
1201
|
+
defaultMessage: "Please confirm",
|
|
1202
|
+
description: "Heading for the confirmation screen."
|
|
1203
|
+
},
|
|
1204
|
+
description: {
|
|
1205
|
+
id: "df.wise.ExternalConfirmation.description",
|
|
1206
|
+
defaultMessage: "Please confirm you want to open **{origin}** in a new browser tab.",
|
|
1207
|
+
description: "Description for the confirmation screen."
|
|
1208
|
+
},
|
|
1209
|
+
open: {
|
|
1210
|
+
id: "df.wise.ExternalConfirmation.open",
|
|
1211
|
+
defaultMessage: "Open in new tab",
|
|
1212
|
+
description: "Button text confirming opening a new browser tab."
|
|
1213
|
+
},
|
|
1214
|
+
cancel: {
|
|
1215
|
+
id: "df.wise.ExternalConfirmation.cancel",
|
|
1216
|
+
defaultMessage: "Cancel",
|
|
1217
|
+
description: "Button text rejecting opening a new browser tab."
|
|
1218
|
+
}
|
|
1219
|
+
});
|
|
1219
1220
|
|
|
1220
|
-
// ../renderers/src/
|
|
1221
|
-
import {
|
|
1222
|
-
import {
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1221
|
+
// ../renderers/src/ExternalConfirmationRenderer.tsx
|
|
1222
|
+
import { useIntl as useIntl2 } from "react-intl";
|
|
1223
|
+
import { useEffect } from "react";
|
|
1224
|
+
import { Fragment, jsx as jsx19, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1225
|
+
var ExternalConfirmationRenderer = {
|
|
1226
|
+
canRenderType: "external-confirmation",
|
|
1227
|
+
render: ExternalConfirmationRendererComponent
|
|
1226
1228
|
};
|
|
1227
|
-
function
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1229
|
+
function ExternalConfirmationRendererComponent({
|
|
1230
|
+
url,
|
|
1231
|
+
status,
|
|
1232
|
+
onSuccess,
|
|
1233
|
+
onFailure,
|
|
1234
|
+
onCancel
|
|
1235
|
+
}) {
|
|
1236
|
+
const { formatMessage } = useIntl2();
|
|
1237
|
+
useEffect(() => {
|
|
1238
|
+
if (url) {
|
|
1239
|
+
const w = window.open(url, "_blank");
|
|
1240
|
+
if (w) {
|
|
1241
|
+
onSuccess();
|
|
1242
|
+
} else {
|
|
1243
|
+
onFailure();
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
}, []);
|
|
1247
|
+
return /* @__PURE__ */ jsx19(
|
|
1248
|
+
Modal,
|
|
1249
|
+
{
|
|
1250
|
+
open: status === "failure",
|
|
1251
|
+
title: formatMessage(external_confirmation_messages_default.title),
|
|
1252
|
+
body: /* @__PURE__ */ jsxs4(Fragment, { children: [
|
|
1253
|
+
/* @__PURE__ */ jsx19(Markdown2, { config: { link: { target: "_blank" } }, className: "text-xs-center m-b-5", children: formatMessage(external_confirmation_messages_default.description, { origin: getOrigin(url) }) }),
|
|
1254
|
+
/* @__PURE__ */ jsx19("div", { className: "df-box-renderer-fixed-width", children: /* @__PURE__ */ jsxs4("div", { className: "df-box-renderer-width-lg", children: [
|
|
1255
|
+
/* @__PURE__ */ jsx19(
|
|
1256
|
+
Button2,
|
|
1257
|
+
{
|
|
1258
|
+
block: true,
|
|
1259
|
+
className: "m-b-2",
|
|
1260
|
+
priority: "primary",
|
|
1261
|
+
size: "md",
|
|
1262
|
+
onClick: () => {
|
|
1263
|
+
window.open(url);
|
|
1264
|
+
onCancel();
|
|
1265
|
+
},
|
|
1266
|
+
children: formatMessage(external_confirmation_messages_default.open)
|
|
1267
|
+
}
|
|
1268
|
+
),
|
|
1269
|
+
/* @__PURE__ */ jsx19(Button2, { block: true, className: "m-b-2", priority: "tertiary", size: "md", onClick: onCancel, children: formatMessage(external_confirmation_messages_default.cancel) })
|
|
1270
|
+
] }) })
|
|
1271
|
+
] }),
|
|
1272
|
+
onClose: onCancel
|
|
1273
|
+
}
|
|
1274
|
+
);
|
|
1275
|
+
}
|
|
1276
|
+
function getOrigin(url) {
|
|
1277
|
+
try {
|
|
1278
|
+
return new URL(url).origin;
|
|
1279
|
+
} catch (e) {
|
|
1280
|
+
return url;
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
var ExternalConfirmationRenderer_default = ExternalConfirmationRenderer;
|
|
1284
|
+
|
|
1285
|
+
// ../renderers/src/FormRenderer.tsx
|
|
1286
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
1287
|
+
var FormRenderer = {
|
|
1288
|
+
canRenderType: "form",
|
|
1289
|
+
render: ({ children, margin }) => /* @__PURE__ */ jsx20("div", { className: getMargin(margin), children })
|
|
1290
|
+
};
|
|
1291
|
+
var FormRenderer_default = FormRenderer;
|
|
1292
|
+
|
|
1293
|
+
// ../renderers/src/FormSectionRenderer.tsx
|
|
1294
|
+
import { Header as Header2 } from "@transferwise/components";
|
|
1295
|
+
import { jsx as jsx21, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1296
|
+
var FormSectionRenderer = {
|
|
1297
|
+
canRenderType: "form-section",
|
|
1298
|
+
render: ({ title, description, children }) => /* @__PURE__ */ jsxs5("fieldset", { children: [
|
|
1299
|
+
title && /* @__PURE__ */ jsx21(
|
|
1300
|
+
Header2,
|
|
1301
|
+
{
|
|
1302
|
+
as: "h2",
|
|
1303
|
+
title
|
|
1304
|
+
}
|
|
1305
|
+
),
|
|
1306
|
+
description && /* @__PURE__ */ jsx21("p", { children: description }),
|
|
1307
|
+
children
|
|
1308
|
+
] })
|
|
1309
|
+
};
|
|
1310
|
+
var FormSectionRenderer_default = FormSectionRenderer;
|
|
1311
|
+
|
|
1312
|
+
// ../renderers/src/HeadingRenderer.tsx
|
|
1313
|
+
import { Display, Title } from "@transferwise/components";
|
|
1314
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
1315
|
+
var HeadingRenderer = {
|
|
1316
|
+
canRenderType: "heading",
|
|
1317
|
+
render: (props) => /* @__PURE__ */ jsx22(Heading, __spreadValues({}, props))
|
|
1318
|
+
};
|
|
1319
|
+
function Heading(props) {
|
|
1320
|
+
const { text, size, align, margin, control } = props;
|
|
1321
|
+
const className = getTextAlignmentAndMargin({ align, margin });
|
|
1322
|
+
return control === "display" ? /* @__PURE__ */ jsx22(DisplayHeading, { size, text, className }) : /* @__PURE__ */ jsx22(StandardHeading, { size, text, className });
|
|
1323
|
+
}
|
|
1324
|
+
function DisplayHeading({ size, text, className }) {
|
|
1325
|
+
return /* @__PURE__ */ jsx22(Display, { type: getDisplayType(size), className, children: text });
|
|
1326
|
+
}
|
|
1327
|
+
var getDisplayType = (size) => {
|
|
1328
|
+
switch (size) {
|
|
1329
|
+
case "xs":
|
|
1330
|
+
case "sm":
|
|
1331
|
+
return "display-small";
|
|
1332
|
+
case "xl":
|
|
1333
|
+
case "lg":
|
|
1334
|
+
return "display-large";
|
|
1243
1335
|
case "md":
|
|
1244
1336
|
default:
|
|
1245
1337
|
return "display-medium";
|
|
1246
1338
|
}
|
|
1247
1339
|
};
|
|
1248
1340
|
function StandardHeading({ size, text, className }) {
|
|
1249
|
-
return /* @__PURE__ */
|
|
1341
|
+
return /* @__PURE__ */ jsx22(Title, { type: getTitleTypeBySize(size), className, children: text });
|
|
1250
1342
|
}
|
|
1251
1343
|
var getTitleTypeBySize = (size) => {
|
|
1252
1344
|
var _a;
|
|
@@ -1263,7 +1355,7 @@ var HeadingRenderer_default = HeadingRenderer;
|
|
|
1263
1355
|
|
|
1264
1356
|
// ../renderers/src/ImageRenderer/UrlImage.tsx
|
|
1265
1357
|
import { Image } from "@transferwise/components";
|
|
1266
|
-
import { useEffect, useState as useState2 } from "react";
|
|
1358
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
1267
1359
|
|
|
1268
1360
|
// ../renderers/src/utils/api-utils.ts
|
|
1269
1361
|
function isRelativePath(url = "") {
|
|
@@ -1273,7 +1365,7 @@ function isRelativePath(url = "") {
|
|
|
1273
1365
|
}
|
|
1274
1366
|
|
|
1275
1367
|
// ../renderers/src/ImageRenderer/UrlImage.tsx
|
|
1276
|
-
import { jsx as
|
|
1368
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
1277
1369
|
function UrlImage({
|
|
1278
1370
|
accessibilityDescription,
|
|
1279
1371
|
align,
|
|
@@ -1283,12 +1375,12 @@ function UrlImage({
|
|
|
1283
1375
|
httpClient
|
|
1284
1376
|
}) {
|
|
1285
1377
|
const [imageSource, setImageSource] = useState2("");
|
|
1286
|
-
|
|
1378
|
+
useEffect2(() => {
|
|
1287
1379
|
if (!uri.startsWith("urn:")) {
|
|
1288
1380
|
void getImageSource(httpClient, uri).then(setImageSource);
|
|
1289
1381
|
}
|
|
1290
1382
|
}, [uri, httpClient]);
|
|
1291
|
-
return /* @__PURE__ */
|
|
1383
|
+
return /* @__PURE__ */ jsx23("div", { className: `df-image ${align} ${size || "md"}`, children: /* @__PURE__ */ jsx23(
|
|
1292
1384
|
Image,
|
|
1293
1385
|
{
|
|
1294
1386
|
className: `img-responsive ${getMargin(margin)}`,
|
|
@@ -1332,7 +1424,7 @@ var getImageSource = async (httpClient, imageUrl) => {
|
|
|
1332
1424
|
};
|
|
1333
1425
|
|
|
1334
1426
|
// ../renderers/src/ImageRenderer/UrnFlagImage.tsx
|
|
1335
|
-
import { jsx as
|
|
1427
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
1336
1428
|
var maxFlagSize = 600;
|
|
1337
1429
|
function UrnFlagImage({
|
|
1338
1430
|
accessibilityDescription,
|
|
@@ -1341,7 +1433,7 @@ function UrnFlagImage({
|
|
|
1341
1433
|
size,
|
|
1342
1434
|
uri
|
|
1343
1435
|
}) {
|
|
1344
|
-
return /* @__PURE__ */
|
|
1436
|
+
return /* @__PURE__ */ jsx24("div", { className: `df-image ${align} ${size || "md"} ${getMargin(margin)}`, children: /* @__PURE__ */ jsx24(UrnFlag, { size: maxFlagSize, urn: uri, accessibilityDescription }) });
|
|
1345
1437
|
}
|
|
1346
1438
|
|
|
1347
1439
|
// ../renderers/src/ImageRenderer/UrnIllustration.tsx
|
|
@@ -1365,7 +1457,7 @@ var isAnimated = (uri) => {
|
|
|
1365
1457
|
};
|
|
1366
1458
|
|
|
1367
1459
|
// ../renderers/src/ImageRenderer/UrnIllustration.tsx
|
|
1368
|
-
import { jsx as
|
|
1460
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
1369
1461
|
var urnPrefix = "urn:wise:illustrations:";
|
|
1370
1462
|
var isUrnIllustration = (uri) => uri.startsWith(urnPrefix);
|
|
1371
1463
|
function UrnIllustration({
|
|
@@ -1379,9 +1471,9 @@ function UrnIllustration({
|
|
|
1379
1471
|
const illustrationName = getIllustrationName(uri);
|
|
1380
1472
|
const illustration3DName = getIllustration3DName(uri);
|
|
1381
1473
|
if (illustration3DName && isAnimated(uri)) {
|
|
1382
|
-
return /* @__PURE__ */
|
|
1474
|
+
return /* @__PURE__ */ jsx25("div", { className: `df-image ${align} ${getMargin(margin)}`, children: /* @__PURE__ */ jsx25(Illustration3D, { name: illustration3DName, size: illustrationSize }) });
|
|
1383
1475
|
}
|
|
1384
|
-
return /* @__PURE__ */
|
|
1476
|
+
return /* @__PURE__ */ jsx25("div", { className: `df-image ${align} ${getMargin(margin)}`, children: /* @__PURE__ */ jsx25(
|
|
1385
1477
|
Illustration,
|
|
1386
1478
|
{
|
|
1387
1479
|
className: "df-illustration",
|
|
@@ -1401,24 +1493,24 @@ var getIllustration3DName = (uri) => {
|
|
|
1401
1493
|
};
|
|
1402
1494
|
|
|
1403
1495
|
// ../renderers/src/ImageRenderer/UrnImage.tsx
|
|
1404
|
-
import { jsx as
|
|
1496
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
1405
1497
|
var isUrnImage = (uri) => uri.startsWith("urn:");
|
|
1406
1498
|
function UrnImage(props) {
|
|
1407
1499
|
const { uri } = props;
|
|
1408
1500
|
if (isUrnIllustration(uri)) {
|
|
1409
|
-
return /* @__PURE__ */
|
|
1501
|
+
return /* @__PURE__ */ jsx26(UrnIllustration, __spreadValues({}, props));
|
|
1410
1502
|
}
|
|
1411
1503
|
if (isUrnFlag(uri)) {
|
|
1412
|
-
return /* @__PURE__ */
|
|
1504
|
+
return /* @__PURE__ */ jsx26(UrnFlagImage, __spreadValues({}, props));
|
|
1413
1505
|
}
|
|
1414
1506
|
return null;
|
|
1415
1507
|
}
|
|
1416
1508
|
|
|
1417
1509
|
// ../renderers/src/ImageRenderer/ImageRenderer.tsx
|
|
1418
|
-
import { jsx as
|
|
1510
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
1419
1511
|
var ImageRenderer = {
|
|
1420
1512
|
canRenderType: "image",
|
|
1421
|
-
render: (props) => isUrnImage(props.uri) ? /* @__PURE__ */
|
|
1513
|
+
render: (props) => isUrnImage(props.uri) ? /* @__PURE__ */ jsx27(UrnImage, __spreadValues({}, props)) : /* @__PURE__ */ jsx27(UrlImage, __spreadValues({}, props))
|
|
1422
1514
|
};
|
|
1423
1515
|
|
|
1424
1516
|
// ../renderers/src/ImageRenderer/index.tsx
|
|
@@ -1426,7 +1518,7 @@ var ImageRenderer_default = ImageRenderer;
|
|
|
1426
1518
|
|
|
1427
1519
|
// ../renderers/src/InstructionsRenderer.tsx
|
|
1428
1520
|
import { Header as Header3, InstructionsList } from "@transferwise/components";
|
|
1429
|
-
import { jsx as
|
|
1521
|
+
import { jsx as jsx28, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1430
1522
|
var doContext = ["positive", "neutral"];
|
|
1431
1523
|
var dontContext = ["warning", "negative"];
|
|
1432
1524
|
var InstructionsRenderer = {
|
|
@@ -1434,9 +1526,9 @@ var InstructionsRenderer = {
|
|
|
1434
1526
|
render: ({ items, margin, title }) => {
|
|
1435
1527
|
const dos = items.filter((item) => doContext.includes(item.context)).map(({ text }) => text);
|
|
1436
1528
|
const donts = items.filter((item) => dontContext.includes(item.context)).map(({ text }) => text);
|
|
1437
|
-
return /* @__PURE__ */
|
|
1438
|
-
title ? /* @__PURE__ */
|
|
1439
|
-
/* @__PURE__ */
|
|
1529
|
+
return /* @__PURE__ */ jsxs6("div", { className: getMargin(margin), children: [
|
|
1530
|
+
title ? /* @__PURE__ */ jsx28(Header3, { title }) : null,
|
|
1531
|
+
/* @__PURE__ */ jsx28(InstructionsList, { dos, donts })
|
|
1440
1532
|
] });
|
|
1441
1533
|
}
|
|
1442
1534
|
};
|
|
@@ -1454,7 +1546,7 @@ var onWheel = (event) => {
|
|
|
1454
1546
|
|
|
1455
1547
|
// ../renderers/src/utils/getInlineAvatar.tsx
|
|
1456
1548
|
import { AvatarView as AvatarView3 } from "@transferwise/components";
|
|
1457
|
-
import { jsx as
|
|
1549
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
1458
1550
|
var mediaSize2 = 24;
|
|
1459
1551
|
function getInlineAvatar({ icon, image }) {
|
|
1460
1552
|
const imageNode = getImageNode(image, mediaSize2);
|
|
@@ -1470,7 +1562,7 @@ function getInlineAvatar({ icon, image }) {
|
|
|
1470
1562
|
return iconNode;
|
|
1471
1563
|
}
|
|
1472
1564
|
if (iconNode) {
|
|
1473
|
-
return /* @__PURE__ */
|
|
1565
|
+
return /* @__PURE__ */ jsx29(AvatarView3, { size: mediaSize2, children: iconNode });
|
|
1474
1566
|
}
|
|
1475
1567
|
return null;
|
|
1476
1568
|
}
|
|
@@ -1493,7 +1585,7 @@ function pick(obj, ...keys) {
|
|
|
1493
1585
|
}
|
|
1494
1586
|
|
|
1495
1587
|
// ../renderers/src/IntegerInputRenderer.tsx
|
|
1496
|
-
import { jsx as
|
|
1588
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
1497
1589
|
var IntegerInputRenderer = {
|
|
1498
1590
|
canRenderType: "input-integer",
|
|
1499
1591
|
render: (props) => {
|
|
@@ -1508,7 +1600,7 @@ var IntegerInputRenderer = {
|
|
|
1508
1600
|
"maximum",
|
|
1509
1601
|
"minimum"
|
|
1510
1602
|
);
|
|
1511
|
-
return /* @__PURE__ */
|
|
1603
|
+
return /* @__PURE__ */ jsx30(
|
|
1512
1604
|
FieldInput_default,
|
|
1513
1605
|
{
|
|
1514
1606
|
id,
|
|
@@ -1516,7 +1608,7 @@ var IntegerInputRenderer = {
|
|
|
1516
1608
|
description,
|
|
1517
1609
|
validation: validationState,
|
|
1518
1610
|
help,
|
|
1519
|
-
children: /* @__PURE__ */
|
|
1611
|
+
children: /* @__PURE__ */ jsx30(InputGroup, { addonStart: getInputGroupAddonStart({ icon, image }), children: /* @__PURE__ */ jsx30(
|
|
1520
1612
|
Input,
|
|
1521
1613
|
__spreadValues({
|
|
1522
1614
|
id,
|
|
@@ -1538,12 +1630,85 @@ var IntegerInputRenderer = {
|
|
|
1538
1630
|
};
|
|
1539
1631
|
var IntegerInputRenderer_default = IntegerInputRenderer;
|
|
1540
1632
|
|
|
1633
|
+
// ../renderers/src/ListRenderer.tsx
|
|
1634
|
+
import { Body, Header as Header4 } from "@transferwise/components";
|
|
1635
|
+
import classNames3 from "classnames";
|
|
1636
|
+
import { jsx as jsx31, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1637
|
+
var ListRenderer = {
|
|
1638
|
+
canRenderType: "list",
|
|
1639
|
+
render: ({ callToAction, control, margin, items, title }) => /* @__PURE__ */ jsxs7("div", { className: getMargin(margin), children: [
|
|
1640
|
+
(title || callToAction) && /* @__PURE__ */ jsx31(Header4, { as: "h2", title: title != null ? title : "", action: getListAction(callToAction) }),
|
|
1641
|
+
items.map((props) => /* @__PURE__ */ jsx31(DesignSystemListItem, __spreadProps(__spreadValues({}, props), { control }), props.title))
|
|
1642
|
+
] })
|
|
1643
|
+
};
|
|
1644
|
+
var DesignSystemListItem = ({
|
|
1645
|
+
title,
|
|
1646
|
+
description,
|
|
1647
|
+
supportingValues,
|
|
1648
|
+
icon,
|
|
1649
|
+
image,
|
|
1650
|
+
control,
|
|
1651
|
+
tag
|
|
1652
|
+
}) => /* @__PURE__ */ jsx31(
|
|
1653
|
+
"label",
|
|
1654
|
+
{
|
|
1655
|
+
className: classNames3("np-option p-a-2", {
|
|
1656
|
+
"np-option__sm-media": true,
|
|
1657
|
+
"np-option__container-aligned": true
|
|
1658
|
+
}),
|
|
1659
|
+
children: /* @__PURE__ */ jsxs7("div", { className: "media", children: [
|
|
1660
|
+
icon || image ? /* @__PURE__ */ jsx31("div", { className: "media-left", children: /* @__PURE__ */ jsx31(
|
|
1661
|
+
ListItemMedia,
|
|
1662
|
+
{
|
|
1663
|
+
image,
|
|
1664
|
+
icon,
|
|
1665
|
+
preferAvatar: control === "with-avatar" || tag === "with-avatar"
|
|
1666
|
+
}
|
|
1667
|
+
) }) : null,
|
|
1668
|
+
/* @__PURE__ */ jsxs7("div", { className: "media-body", children: [
|
|
1669
|
+
/* @__PURE__ */ jsxs7("div", { className: "d-flex justify-content-between", children: [
|
|
1670
|
+
/* @__PURE__ */ jsx31("h4", { className: "np-text-body-large-bold text-primary np-option__title", children: title }),
|
|
1671
|
+
/* @__PURE__ */ jsx31("h4", { className: "np-text-body-large-bold text-primary np-option__title", children: supportingValues == null ? void 0 : supportingValues.value })
|
|
1672
|
+
] }),
|
|
1673
|
+
/* @__PURE__ */ jsxs7("div", { className: "d-flex justify-content-between", children: [
|
|
1674
|
+
/* @__PURE__ */ jsx31(Body, { className: "d-block np-option__body", children: description }),
|
|
1675
|
+
/* @__PURE__ */ jsx31(Body, { className: "d-block np-option__body", children: supportingValues == null ? void 0 : supportingValues.subvalue })
|
|
1676
|
+
] })
|
|
1677
|
+
] })
|
|
1678
|
+
] })
|
|
1679
|
+
},
|
|
1680
|
+
title
|
|
1681
|
+
);
|
|
1682
|
+
var ListItemMedia = ({
|
|
1683
|
+
icon,
|
|
1684
|
+
image,
|
|
1685
|
+
preferAvatar
|
|
1686
|
+
}) => {
|
|
1687
|
+
if (icon) {
|
|
1688
|
+
return /* @__PURE__ */ jsx31("div", { className: "circle circle-sm text-primary circle-inverse", children: /* @__PURE__ */ jsx31(OptionMedia, { icon, image, preferAvatar }) });
|
|
1689
|
+
}
|
|
1690
|
+
if (image) {
|
|
1691
|
+
return /* @__PURE__ */ jsx31("div", { className: "np-option__no-media-circle", children: /* @__PURE__ */ jsx31(OptionMedia, { icon, image, preferAvatar }) });
|
|
1692
|
+
}
|
|
1693
|
+
};
|
|
1694
|
+
var getListAction = (callToAction) => {
|
|
1695
|
+
if (callToAction) {
|
|
1696
|
+
return __spreadValues({
|
|
1697
|
+
"aria-label": callToAction.accessibilityDescription,
|
|
1698
|
+
text: callToAction.title,
|
|
1699
|
+
onClick: callToAction.onClick
|
|
1700
|
+
}, callToAction.type === "link" ? { href: callToAction.href, target: "_blank" } : {});
|
|
1701
|
+
}
|
|
1702
|
+
return void 0;
|
|
1703
|
+
};
|
|
1704
|
+
var ListRenderer_default = ListRenderer;
|
|
1705
|
+
|
|
1541
1706
|
// ../renderers/src/LoadingIndicatorRenderer.tsx
|
|
1542
1707
|
import { Loader } from "@transferwise/components";
|
|
1543
|
-
import { jsx as
|
|
1708
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
1544
1709
|
var LoadingIndicatorRenderer = {
|
|
1545
1710
|
canRenderType: "loading-indicator",
|
|
1546
|
-
render: ({ margin, size }) => /* @__PURE__ */
|
|
1711
|
+
render: ({ margin, size }) => /* @__PURE__ */ jsx32(
|
|
1547
1712
|
Loader,
|
|
1548
1713
|
{
|
|
1549
1714
|
size,
|
|
@@ -1555,30 +1720,30 @@ var LoadingIndicatorRenderer = {
|
|
|
1555
1720
|
var LoadingIndicatorRenderer_default = LoadingIndicatorRenderer;
|
|
1556
1721
|
|
|
1557
1722
|
// ../renderers/src/MarkdownRenderer.tsx
|
|
1558
|
-
import { Markdown as
|
|
1559
|
-
import { jsx as
|
|
1723
|
+
import { Markdown as Markdown3 } from "@transferwise/components";
|
|
1724
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
1560
1725
|
var MarkdownRenderer = {
|
|
1561
1726
|
canRenderType: "markdown",
|
|
1562
|
-
render: ({ content, align, margin }) => /* @__PURE__ */
|
|
1727
|
+
render: ({ content, align, margin }) => /* @__PURE__ */ jsx33("div", { className: getTextAlignmentAndMargin({ align, margin }), children: /* @__PURE__ */ jsx33(Markdown3, { className: "np-text-body-large", config: { link: { target: "_blank" } }, children: content }) })
|
|
1563
1728
|
};
|
|
1564
1729
|
var MarkdownRenderer_default = MarkdownRenderer;
|
|
1565
1730
|
|
|
1566
|
-
// ../renderers/src/
|
|
1567
|
-
import { Button as
|
|
1731
|
+
// ../renderers/src/ModalLayoutRenderer.tsx
|
|
1732
|
+
import { Button as Button3, Modal as Modal2 } from "@transferwise/components";
|
|
1568
1733
|
import { useState as useState3 } from "react";
|
|
1569
|
-
import { jsx as
|
|
1570
|
-
var
|
|
1571
|
-
canRenderType: "modal",
|
|
1572
|
-
render: (props) => /* @__PURE__ */
|
|
1734
|
+
import { jsx as jsx34, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1735
|
+
var ModalLayoutRenderer = {
|
|
1736
|
+
canRenderType: "modal-layout",
|
|
1737
|
+
render: (props) => /* @__PURE__ */ jsx34(DFModal, __spreadValues({}, props))
|
|
1573
1738
|
};
|
|
1574
|
-
var
|
|
1739
|
+
var ModalLayoutRenderer_default = ModalLayoutRenderer;
|
|
1575
1740
|
function DFModal({ content, margin, trigger }) {
|
|
1576
1741
|
const [visible, setVisible] = useState3(false);
|
|
1577
1742
|
const { children, title } = content;
|
|
1578
|
-
return /* @__PURE__ */
|
|
1579
|
-
/* @__PURE__ */
|
|
1580
|
-
/* @__PURE__ */
|
|
1581
|
-
|
|
1743
|
+
return /* @__PURE__ */ jsxs8("div", { className: getMargin(margin), children: [
|
|
1744
|
+
/* @__PURE__ */ jsx34(Button3, { priority: "tertiary", block: true, onClick: () => setVisible(true), children: trigger.title }),
|
|
1745
|
+
/* @__PURE__ */ jsx34(
|
|
1746
|
+
Modal2,
|
|
1582
1747
|
{
|
|
1583
1748
|
scroll: "content",
|
|
1584
1749
|
open: visible,
|
|
@@ -1594,11 +1759,11 @@ function DFModal({ content, margin, trigger }) {
|
|
|
1594
1759
|
// ../renderers/src/MultiSelectInputRenderer.tsx
|
|
1595
1760
|
import { SelectInput, SelectInputOptionContent } from "@transferwise/components";
|
|
1596
1761
|
import { useState as useState4 } from "react";
|
|
1597
|
-
import { useIntl as
|
|
1762
|
+
import { useIntl as useIntl3 } from "react-intl";
|
|
1598
1763
|
|
|
1599
1764
|
// ../renderers/src/messages/multi-select.messages.ts
|
|
1600
|
-
import { defineMessages as
|
|
1601
|
-
var multi_select_messages_default =
|
|
1765
|
+
import { defineMessages as defineMessages3 } from "react-intl";
|
|
1766
|
+
var multi_select_messages_default = defineMessages3({
|
|
1602
1767
|
summary: {
|
|
1603
1768
|
id: "df.wise.MultiSelect.summary",
|
|
1604
1769
|
defaultMessage: "{first} and {count} more",
|
|
@@ -1607,13 +1772,13 @@ var multi_select_messages_default = defineMessages2({
|
|
|
1607
1772
|
});
|
|
1608
1773
|
|
|
1609
1774
|
// ../renderers/src/MultiSelectInputRenderer.tsx
|
|
1610
|
-
import { jsx as
|
|
1775
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
1611
1776
|
var MultiSelectInputRenderer = {
|
|
1612
1777
|
canRenderType: "input-multi-select",
|
|
1613
|
-
render: (props) => /* @__PURE__ */
|
|
1778
|
+
render: (props) => /* @__PURE__ */ jsx35(MultiSelectInputRendererComponent, __spreadValues({}, props))
|
|
1614
1779
|
};
|
|
1615
1780
|
function MultiSelectInputRendererComponent(props) {
|
|
1616
|
-
const { formatMessage } =
|
|
1781
|
+
const { formatMessage } = useIntl3();
|
|
1617
1782
|
const [stagedIndices, setStagedIndices] = useState4();
|
|
1618
1783
|
const {
|
|
1619
1784
|
id,
|
|
@@ -1652,12 +1817,12 @@ function MultiSelectInputRendererComponent(props) {
|
|
|
1652
1817
|
const contentProps = {
|
|
1653
1818
|
title: option.title,
|
|
1654
1819
|
description: option.description,
|
|
1655
|
-
icon: /* @__PURE__ */
|
|
1820
|
+
icon: /* @__PURE__ */ jsx35(OptionMedia, { icon: option.icon, image: option.image, preferAvatar: false })
|
|
1656
1821
|
};
|
|
1657
|
-
return /* @__PURE__ */
|
|
1822
|
+
return /* @__PURE__ */ jsx35(SelectInputOptionContent, __spreadValues({}, contentProps));
|
|
1658
1823
|
};
|
|
1659
1824
|
const extraProps = { autoComplete };
|
|
1660
|
-
return /* @__PURE__ */
|
|
1825
|
+
return /* @__PURE__ */ jsx35(
|
|
1661
1826
|
FieldInput_default,
|
|
1662
1827
|
{
|
|
1663
1828
|
id,
|
|
@@ -1665,7 +1830,7 @@ function MultiSelectInputRendererComponent(props) {
|
|
|
1665
1830
|
help,
|
|
1666
1831
|
description,
|
|
1667
1832
|
validation: validationState,
|
|
1668
|
-
children: /* @__PURE__ */
|
|
1833
|
+
children: /* @__PURE__ */ jsx35(
|
|
1669
1834
|
SelectInput,
|
|
1670
1835
|
__spreadValues({
|
|
1671
1836
|
id,
|
|
@@ -1709,8 +1874,8 @@ import { UploadInput } from "@transferwise/components";
|
|
|
1709
1874
|
|
|
1710
1875
|
// ../renderers/src/components/UploadFieldInput.tsx
|
|
1711
1876
|
import { InlineAlert } from "@transferwise/components";
|
|
1712
|
-
import
|
|
1713
|
-
import { jsx as
|
|
1877
|
+
import classNames4 from "classnames";
|
|
1878
|
+
import { jsx as jsx36, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1714
1879
|
function UploadFieldInput({
|
|
1715
1880
|
id,
|
|
1716
1881
|
children,
|
|
@@ -1719,18 +1884,18 @@ function UploadFieldInput({
|
|
|
1719
1884
|
help,
|
|
1720
1885
|
validation
|
|
1721
1886
|
}) {
|
|
1722
|
-
const labelContent = label && help ? /* @__PURE__ */
|
|
1887
|
+
const labelContent = label && help ? /* @__PURE__ */ jsx36(LabelContentWithHelp, { text: label, help }) : label;
|
|
1723
1888
|
const descriptionId = description ? `${id}-description` : void 0;
|
|
1724
|
-
return /* @__PURE__ */
|
|
1889
|
+
return /* @__PURE__ */ jsxs9(
|
|
1725
1890
|
"div",
|
|
1726
1891
|
{
|
|
1727
|
-
className:
|
|
1892
|
+
className: classNames4("form-group d-block", {
|
|
1728
1893
|
"has-error": (validation == null ? void 0 : validation.status) === "invalid"
|
|
1729
1894
|
}),
|
|
1730
1895
|
children: [
|
|
1731
|
-
/* @__PURE__ */
|
|
1896
|
+
/* @__PURE__ */ jsx36("label", { htmlFor: id, className: "control-label", children: labelContent }),
|
|
1732
1897
|
children,
|
|
1733
|
-
(validation == null ? void 0 : validation.status) === "invalid" && /* @__PURE__ */
|
|
1898
|
+
(validation == null ? void 0 : validation.status) === "invalid" && /* @__PURE__ */ jsx36(InlineAlert, { type: "negative", id: descriptionId, children: validation.message })
|
|
1734
1899
|
]
|
|
1735
1900
|
}
|
|
1736
1901
|
);
|
|
@@ -1759,7 +1924,7 @@ var getFileType = (base64Url) => {
|
|
|
1759
1924
|
};
|
|
1760
1925
|
|
|
1761
1926
|
// ../renderers/src/MultiUploadInputRenderer.tsx
|
|
1762
|
-
import { jsx as
|
|
1927
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
1763
1928
|
var MultiUploadInputRenderer = {
|
|
1764
1929
|
canRenderType: "input-upload-multi",
|
|
1765
1930
|
render: (props) => {
|
|
@@ -1784,7 +1949,7 @@ var MultiUploadInputRenderer = {
|
|
|
1784
1949
|
};
|
|
1785
1950
|
const onDeleteFile = async (fileId) => onRemoveFile(value.findIndex((file) => file.id === fileId));
|
|
1786
1951
|
const descriptionId = description ? `${id}-description` : void 0;
|
|
1787
|
-
return /* @__PURE__ */
|
|
1952
|
+
return /* @__PURE__ */ jsx37(
|
|
1788
1953
|
UploadFieldInput_default,
|
|
1789
1954
|
{
|
|
1790
1955
|
id,
|
|
@@ -1792,7 +1957,7 @@ var MultiUploadInputRenderer = {
|
|
|
1792
1957
|
description,
|
|
1793
1958
|
validation: validationState,
|
|
1794
1959
|
help,
|
|
1795
|
-
children: /* @__PURE__ */
|
|
1960
|
+
children: /* @__PURE__ */ jsx37(
|
|
1796
1961
|
UploadInput,
|
|
1797
1962
|
{
|
|
1798
1963
|
id,
|
|
@@ -1816,7 +1981,7 @@ var MultiUploadInputRenderer_default = MultiUploadInputRenderer;
|
|
|
1816
1981
|
|
|
1817
1982
|
// ../renderers/src/NumberInputRenderer.tsx
|
|
1818
1983
|
import { Input as Input2, InputGroup as InputGroup2 } from "@transferwise/components";
|
|
1819
|
-
import { jsx as
|
|
1984
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
1820
1985
|
var NumberInputRenderer = {
|
|
1821
1986
|
canRenderType: "input-number",
|
|
1822
1987
|
render: (props) => {
|
|
@@ -1830,7 +1995,7 @@ var NumberInputRenderer = {
|
|
|
1830
1995
|
"maximum",
|
|
1831
1996
|
"minimum"
|
|
1832
1997
|
);
|
|
1833
|
-
return /* @__PURE__ */
|
|
1998
|
+
return /* @__PURE__ */ jsx38(
|
|
1834
1999
|
FieldInput_default,
|
|
1835
2000
|
{
|
|
1836
2001
|
id,
|
|
@@ -1838,7 +2003,7 @@ var NumberInputRenderer = {
|
|
|
1838
2003
|
description,
|
|
1839
2004
|
validation: validationState,
|
|
1840
2005
|
help,
|
|
1841
|
-
children: /* @__PURE__ */
|
|
2006
|
+
children: /* @__PURE__ */ jsx38(InputGroup2, { addonStart: getInputGroupAddonStart({ icon, image }), children: /* @__PURE__ */ jsx38(
|
|
1842
2007
|
Input2,
|
|
1843
2008
|
__spreadValues({
|
|
1844
2009
|
id,
|
|
@@ -1859,7 +2024,7 @@ var NumberInputRenderer = {
|
|
|
1859
2024
|
var NumberInputRenderer_default = NumberInputRenderer;
|
|
1860
2025
|
|
|
1861
2026
|
// ../renderers/src/ParagraphRenderer.tsx
|
|
1862
|
-
import { useIntl as
|
|
2027
|
+
import { useIntl as useIntl4 } from "react-intl";
|
|
1863
2028
|
|
|
1864
2029
|
// ../renderers/src/hooks/useSnackBarIfAvailable.ts
|
|
1865
2030
|
import { SnackbarContext } from "@transferwise/components";
|
|
@@ -1871,12 +2036,12 @@ function useSnackBarIfAvailable() {
|
|
|
1871
2036
|
}
|
|
1872
2037
|
|
|
1873
2038
|
// ../renderers/src/ParagraphRenderer.tsx
|
|
1874
|
-
import { Button as
|
|
1875
|
-
import
|
|
2039
|
+
import { Button as Button4, Input as Input3 } from "@transferwise/components";
|
|
2040
|
+
import classNames5 from "classnames";
|
|
1876
2041
|
|
|
1877
2042
|
// ../renderers/src/messages/paragraph.messages.ts
|
|
1878
|
-
import { defineMessages as
|
|
1879
|
-
var paragraph_messages_default =
|
|
2043
|
+
import { defineMessages as defineMessages4 } from "react-intl";
|
|
2044
|
+
var paragraph_messages_default = defineMessages4({
|
|
1880
2045
|
copy: {
|
|
1881
2046
|
id: "df.wise.DynamicParagraph.copy",
|
|
1882
2047
|
defaultMessage: "Copy",
|
|
@@ -1890,55 +2055,55 @@ var paragraph_messages_default = defineMessages3({
|
|
|
1890
2055
|
});
|
|
1891
2056
|
|
|
1892
2057
|
// ../renderers/src/ParagraphRenderer.tsx
|
|
1893
|
-
import { jsx as
|
|
2058
|
+
import { jsx as jsx39, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1894
2059
|
var ParagraphRenderer = {
|
|
1895
2060
|
canRenderType: "paragraph",
|
|
1896
|
-
render: (props) => /* @__PURE__ */
|
|
2061
|
+
render: (props) => /* @__PURE__ */ jsx39(Paragraph, __spreadValues({}, props))
|
|
1897
2062
|
};
|
|
1898
2063
|
function Paragraph({ align, control, margin, text }) {
|
|
1899
2064
|
const className = getTextAlignmentAndMargin({ align, margin });
|
|
1900
|
-
return control === "copyable" ? /* @__PURE__ */
|
|
2065
|
+
return control === "copyable" ? /* @__PURE__ */ jsx39(CopyableParagraph, { className, align, text }) : /* @__PURE__ */ jsx39(StandardParagraph, { className, text });
|
|
1901
2066
|
}
|
|
1902
2067
|
function StandardParagraph({ text, className }) {
|
|
1903
|
-
return /* @__PURE__ */
|
|
2068
|
+
return /* @__PURE__ */ jsx39("p", { className: `np-text-body-large ${className}`, children: text });
|
|
1904
2069
|
}
|
|
1905
2070
|
function CopyableParagraph({
|
|
1906
2071
|
text,
|
|
1907
2072
|
align,
|
|
1908
2073
|
className
|
|
1909
2074
|
}) {
|
|
1910
|
-
const { formatMessage } =
|
|
2075
|
+
const { formatMessage } = useIntl4();
|
|
1911
2076
|
const createSnackbar = useSnackBarIfAvailable();
|
|
1912
2077
|
const copy = () => {
|
|
1913
2078
|
navigator.clipboard.writeText(text).then(() => createSnackbar({ text: formatMessage(paragraph_messages_default.copied) })).catch(() => {
|
|
1914
2079
|
});
|
|
1915
2080
|
};
|
|
1916
2081
|
const inputAlignmentClasses = getTextAlignmentAndMargin({ align, margin: "sm" });
|
|
1917
|
-
return /* @__PURE__ */
|
|
1918
|
-
/* @__PURE__ */
|
|
2082
|
+
return /* @__PURE__ */ jsxs10("div", { className, children: [
|
|
2083
|
+
/* @__PURE__ */ jsx39(
|
|
1919
2084
|
Input3,
|
|
1920
2085
|
{
|
|
1921
2086
|
type: "text",
|
|
1922
2087
|
value: text,
|
|
1923
2088
|
readOnly: true,
|
|
1924
|
-
className:
|
|
2089
|
+
className: classNames5("text-ellipsis", inputAlignmentClasses)
|
|
1925
2090
|
}
|
|
1926
2091
|
),
|
|
1927
|
-
/* @__PURE__ */
|
|
2092
|
+
/* @__PURE__ */ jsx39(Button4, { block: true, onClick: copy, children: formatMessage(paragraph_messages_default.copy) })
|
|
1928
2093
|
] });
|
|
1929
2094
|
}
|
|
1930
2095
|
var ParagraphRenderer_default = ParagraphRenderer;
|
|
1931
2096
|
|
|
1932
2097
|
// ../renderers/src/RepeatableRenderer.tsx
|
|
1933
|
-
import { Button as
|
|
2098
|
+
import { Button as Button5, Header as Header5, InlineAlert as InlineAlert2, Modal as Modal3, NavigationOption as NavigationOption2 } from "@transferwise/components";
|
|
1934
2099
|
import { Plus } from "@transferwise/icons";
|
|
1935
|
-
import
|
|
2100
|
+
import classNames6 from "classnames";
|
|
1936
2101
|
import { useState as useState5 } from "react";
|
|
1937
|
-
import { useIntl as
|
|
2102
|
+
import { useIntl as useIntl5 } from "react-intl";
|
|
1938
2103
|
|
|
1939
2104
|
// ../renderers/src/messages/repeatable.messages.ts
|
|
1940
|
-
import { defineMessages as
|
|
1941
|
-
var repeatable_messages_default =
|
|
2105
|
+
import { defineMessages as defineMessages5 } from "react-intl";
|
|
2106
|
+
var repeatable_messages_default = defineMessages5({
|
|
1942
2107
|
addItemTitle: {
|
|
1943
2108
|
id: "df.wise.ArraySchema.addItemTitle",
|
|
1944
2109
|
defaultMessage: "Add Item",
|
|
@@ -1962,10 +2127,10 @@ var repeatable_messages_default = defineMessages4({
|
|
|
1962
2127
|
});
|
|
1963
2128
|
|
|
1964
2129
|
// ../renderers/src/RepeatableRenderer.tsx
|
|
1965
|
-
import { Fragment, jsx as
|
|
2130
|
+
import { Fragment as Fragment2, jsx as jsx40, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1966
2131
|
var RepeatableRenderer = {
|
|
1967
2132
|
canRenderType: "repeatable",
|
|
1968
|
-
render: (props) => /* @__PURE__ */
|
|
2133
|
+
render: (props) => /* @__PURE__ */ jsx40(Repeatable, __spreadValues({}, props))
|
|
1969
2134
|
};
|
|
1970
2135
|
function Repeatable(props) {
|
|
1971
2136
|
const {
|
|
@@ -1981,7 +2146,7 @@ function Repeatable(props) {
|
|
|
1981
2146
|
onSave,
|
|
1982
2147
|
onRemove
|
|
1983
2148
|
} = props;
|
|
1984
|
-
const { formatMessage } =
|
|
2149
|
+
const { formatMessage } = useIntl5();
|
|
1985
2150
|
const [openModalType, setOpenModalType] = useState5(null);
|
|
1986
2151
|
const onAddItem = () => {
|
|
1987
2152
|
onAdd();
|
|
@@ -2004,40 +2169,40 @@ function Repeatable(props) {
|
|
|
2004
2169
|
const onCancelEdit = () => {
|
|
2005
2170
|
setOpenModalType(null);
|
|
2006
2171
|
};
|
|
2007
|
-
return /* @__PURE__ */
|
|
2008
|
-
title && /* @__PURE__ */
|
|
2009
|
-
description && /* @__PURE__ */
|
|
2010
|
-
/* @__PURE__ */
|
|
2172
|
+
return /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
2173
|
+
title && /* @__PURE__ */ jsx40(Header5, { title }),
|
|
2174
|
+
description && /* @__PURE__ */ jsx40("p", { children: description }),
|
|
2175
|
+
/* @__PURE__ */ jsxs11(
|
|
2011
2176
|
"div",
|
|
2012
2177
|
{
|
|
2013
|
-
className:
|
|
2178
|
+
className: classNames6("form-group", {
|
|
2014
2179
|
"has-error": (validationState == null ? void 0 : validationState.status) === "invalid"
|
|
2015
2180
|
}),
|
|
2016
2181
|
children: [
|
|
2017
|
-
items == null ? void 0 : items.map((item, index) => /* @__PURE__ */
|
|
2018
|
-
/* @__PURE__ */
|
|
2182
|
+
items == null ? void 0 : items.map((item, index) => /* @__PURE__ */ jsx40(ItemSummaryOption, { item, onClick: () => onEditItem(index) }, item.id)),
|
|
2183
|
+
/* @__PURE__ */ jsx40(
|
|
2019
2184
|
NavigationOption2,
|
|
2020
2185
|
{
|
|
2021
|
-
media: /* @__PURE__ */
|
|
2186
|
+
media: /* @__PURE__ */ jsx40(Plus, {}),
|
|
2022
2187
|
title: addItemTitle || formatMessage(repeatable_messages_default.addItemTitle),
|
|
2023
2188
|
showMediaAtAllSizes: true,
|
|
2024
2189
|
onClick: () => onAddItem()
|
|
2025
2190
|
}
|
|
2026
2191
|
),
|
|
2027
|
-
(validationState == null ? void 0 : validationState.status) === "invalid" && /* @__PURE__ */
|
|
2192
|
+
(validationState == null ? void 0 : validationState.status) === "invalid" && /* @__PURE__ */ jsx40(InlineAlert2, { type: "negative", children: validationState.message })
|
|
2028
2193
|
]
|
|
2029
2194
|
}
|
|
2030
2195
|
),
|
|
2031
|
-
/* @__PURE__ */
|
|
2032
|
-
|
|
2196
|
+
/* @__PURE__ */ jsx40(
|
|
2197
|
+
Modal3,
|
|
2033
2198
|
{
|
|
2034
2199
|
open: openModalType !== null,
|
|
2035
2200
|
title: (openModalType === "add" ? addItemTitle : editItemTitle) || formatMessage(repeatable_messages_default.addItemTitle),
|
|
2036
|
-
body: /* @__PURE__ */
|
|
2037
|
-
/* @__PURE__ */
|
|
2038
|
-
/* @__PURE__ */
|
|
2039
|
-
/* @__PURE__ */
|
|
2040
|
-
/* @__PURE__ */
|
|
2201
|
+
body: /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
2202
|
+
/* @__PURE__ */ jsx40("div", { className: "m-b-2", children: editableItem }),
|
|
2203
|
+
/* @__PURE__ */ jsxs11("div", { children: [
|
|
2204
|
+
/* @__PURE__ */ jsx40(Button5, { priority: "primary", block: true, className: "m-b-2", onClick: () => onSaveItem(), children: formatMessage(repeatable_messages_default.addItem) }),
|
|
2205
|
+
/* @__PURE__ */ jsx40(Button5, { priority: "secondary", type: "negative", block: true, onClick: () => onRemoveItem(), children: formatMessage(repeatable_messages_default.removeItem) })
|
|
2041
2206
|
] })
|
|
2042
2207
|
] }),
|
|
2043
2208
|
onClose: () => onCancelEdit()
|
|
@@ -2049,10 +2214,10 @@ function ItemSummaryOption({
|
|
|
2049
2214
|
item,
|
|
2050
2215
|
onClick
|
|
2051
2216
|
}) {
|
|
2052
|
-
return /* @__PURE__ */
|
|
2217
|
+
return /* @__PURE__ */ jsx40(
|
|
2053
2218
|
NavigationOption2,
|
|
2054
2219
|
{
|
|
2055
|
-
media: /* @__PURE__ */
|
|
2220
|
+
media: /* @__PURE__ */ jsx40(OptionMedia, __spreadProps(__spreadValues({}, item), { preferAvatar: false })),
|
|
2056
2221
|
title: item.title,
|
|
2057
2222
|
content: item.description,
|
|
2058
2223
|
showMediaAtAllSizes: true,
|
|
@@ -2062,61 +2227,145 @@ function ItemSummaryOption({
|
|
|
2062
2227
|
}
|
|
2063
2228
|
var RepeatableRenderer_default = RepeatableRenderer;
|
|
2064
2229
|
|
|
2065
|
-
// ../renderers/src/
|
|
2066
|
-
import {
|
|
2067
|
-
import { useState as useState6 } from "react";
|
|
2068
|
-
import { useIntl as useIntl6 } from "react-intl";
|
|
2069
|
-
|
|
2070
|
-
// ../renderers/src/messages/search.messages.ts
|
|
2071
|
-
import { defineMessages as defineMessages5 } from "react-intl";
|
|
2072
|
-
var search_messages_default = defineMessages5({
|
|
2073
|
-
loading: {
|
|
2074
|
-
id: "df.wise.SearchLayout.loading",
|
|
2075
|
-
defaultMessage: "Loading...",
|
|
2076
|
-
description: "A message shown to the user while their search is being processed, before results appear."
|
|
2077
|
-
}
|
|
2078
|
-
});
|
|
2079
|
-
|
|
2080
|
-
// ../renderers/src/SearchRenderer/ErrorResult.tsx
|
|
2081
|
-
import { useIntl as useIntl5 } from "react-intl";
|
|
2230
|
+
// ../renderers/src/ReviewRenderer.tsx
|
|
2231
|
+
import { DefinitionList, Header as Header6 } from "@transferwise/components";
|
|
2082
2232
|
|
|
2083
|
-
// ../renderers/src/
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
id: "df.wise.PersistAsyncSchema.genericError",
|
|
2088
|
-
defaultMessage: "Something went wrong, please try again.",
|
|
2089
|
-
description: "Generic error message for persist async schema"
|
|
2090
|
-
},
|
|
2091
|
-
genericError: {
|
|
2092
|
-
id: "df.wise.ErrorBoundary.errorAlert",
|
|
2093
|
-
defaultMessage: "Something went wrong.",
|
|
2094
|
-
description: "Generic error message for when something has gone wrong."
|
|
2095
|
-
},
|
|
2096
|
-
retry: {
|
|
2097
|
-
id: "df.wise.ErrorBoundary.retry",
|
|
2098
|
-
defaultMessage: "Retry",
|
|
2099
|
-
description: "Usually this follows the generic error and contains a link."
|
|
2233
|
+
// ../renderers/src/utils/getHeaderAction.tsx
|
|
2234
|
+
var getHeaderAction = (callToAction) => {
|
|
2235
|
+
if (!callToAction) {
|
|
2236
|
+
return void 0;
|
|
2100
2237
|
}
|
|
2101
|
-
}
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2238
|
+
const { accessibilityDescription, href, title, onClick } = callToAction;
|
|
2239
|
+
return href ? {
|
|
2240
|
+
"aria-label": accessibilityDescription,
|
|
2241
|
+
text: title,
|
|
2242
|
+
href,
|
|
2243
|
+
target: "_blank"
|
|
2244
|
+
} : {
|
|
2245
|
+
"aria-label": accessibilityDescription,
|
|
2246
|
+
text: title,
|
|
2247
|
+
onClick: (event) => {
|
|
2248
|
+
event.preventDefault();
|
|
2249
|
+
onClick();
|
|
2250
|
+
}
|
|
2112
2251
|
};
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2252
|
+
};
|
|
2253
|
+
|
|
2254
|
+
// ../renderers/src/ReviewRenderer.tsx
|
|
2255
|
+
import { Fragment as Fragment3, jsx as jsx41, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2256
|
+
var ReviewRenderer = {
|
|
2257
|
+
canRenderType: "review",
|
|
2258
|
+
render: ({ callToAction, control, fields, margin, title, trackEvent }) => {
|
|
2259
|
+
const orientation = mapControlToDefinitionListLayout(control);
|
|
2260
|
+
return /* @__PURE__ */ jsxs12("div", { className: getMargin(margin), children: [
|
|
2261
|
+
(title || callToAction) && /* @__PURE__ */ jsx41(Header6, { title: title != null ? title : "", action: getHeaderAction(callToAction) }),
|
|
2262
|
+
/* @__PURE__ */ jsx41("div", { className: margin, children: /* @__PURE__ */ jsx41(
|
|
2263
|
+
DefinitionList,
|
|
2264
|
+
{
|
|
2265
|
+
layout: orientation,
|
|
2266
|
+
definitions: fields.map(
|
|
2267
|
+
({ label, value, help, analyticsId: fieldAnalyticsId }, index) => ({
|
|
2268
|
+
key: String(index),
|
|
2269
|
+
title: label,
|
|
2270
|
+
value: getFieldValue(
|
|
2271
|
+
value,
|
|
2272
|
+
help,
|
|
2273
|
+
orientation,
|
|
2274
|
+
() => trackEvent("Help Pressed", { layoutItemId: fieldAnalyticsId })
|
|
2275
|
+
)
|
|
2276
|
+
})
|
|
2277
|
+
)
|
|
2278
|
+
}
|
|
2279
|
+
) })
|
|
2280
|
+
] });
|
|
2281
|
+
}
|
|
2282
|
+
};
|
|
2283
|
+
var ReviewRenderer_default = ReviewRenderer;
|
|
2284
|
+
var mapControlToDefinitionListLayout = (control) => {
|
|
2285
|
+
switch (control) {
|
|
2286
|
+
case "horizontal":
|
|
2287
|
+
case "horizontal-end-aligned":
|
|
2288
|
+
return "HORIZONTAL_RIGHT_ALIGNED";
|
|
2289
|
+
case "horizontal-start-aligned":
|
|
2290
|
+
return "HORIZONTAL_LEFT_ALIGNED";
|
|
2291
|
+
case "vertical-two-column":
|
|
2292
|
+
return "VERTICAL_TWO_COLUMN";
|
|
2293
|
+
case "vertical":
|
|
2294
|
+
case "vertical-one-column":
|
|
2295
|
+
default:
|
|
2296
|
+
return "VERTICAL_ONE_COLUMN";
|
|
2297
|
+
}
|
|
2298
|
+
};
|
|
2299
|
+
var getFieldValue = (value, help, orientation, onClick) => {
|
|
2300
|
+
if (help) {
|
|
2301
|
+
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
2302
|
+
/* @__PURE__ */ jsx41(Help_default, { help, onClick }),
|
|
2303
|
+
" ",
|
|
2304
|
+
value
|
|
2305
|
+
] }) : /* @__PURE__ */ jsxs12(Fragment3, { children: [
|
|
2306
|
+
value,
|
|
2307
|
+
" ",
|
|
2308
|
+
/* @__PURE__ */ jsx41(Help_default, { help, onClick })
|
|
2309
|
+
] });
|
|
2310
|
+
}
|
|
2311
|
+
return value;
|
|
2312
|
+
};
|
|
2313
|
+
|
|
2314
|
+
// ../renderers/src/SearchRenderer/BlockSearchRendererComponent.tsx
|
|
2315
|
+
import { Input as Input4, Markdown as Markdown4, NavigationOption as NavigationOption3, NavigationOptionsList as NavigationOptionsList2 } from "@transferwise/components";
|
|
2316
|
+
import { useState as useState6 } from "react";
|
|
2317
|
+
import { useIntl as useIntl7 } from "react-intl";
|
|
2318
|
+
|
|
2319
|
+
// ../renderers/src/messages/search.messages.ts
|
|
2320
|
+
import { defineMessages as defineMessages6 } from "react-intl";
|
|
2321
|
+
var search_messages_default = defineMessages6({
|
|
2322
|
+
loading: {
|
|
2323
|
+
id: "df.wise.SearchLayout.loading",
|
|
2324
|
+
defaultMessage: "Loading...",
|
|
2325
|
+
description: "A message shown to the user while their search is being processed, before results appear."
|
|
2326
|
+
}
|
|
2327
|
+
});
|
|
2328
|
+
|
|
2329
|
+
// ../renderers/src/SearchRenderer/ErrorResult.tsx
|
|
2330
|
+
import { useIntl as useIntl6 } from "react-intl";
|
|
2331
|
+
|
|
2332
|
+
// ../renderers/src/messages/generic-error.messages.ts
|
|
2333
|
+
import { defineMessages as defineMessages7 } from "react-intl";
|
|
2334
|
+
var generic_error_messages_default = defineMessages7({
|
|
2335
|
+
genericErrorRetryHint: {
|
|
2336
|
+
id: "df.wise.PersistAsyncSchema.genericError",
|
|
2337
|
+
defaultMessage: "Something went wrong, please try again.",
|
|
2338
|
+
description: "Generic error message for persist async schema"
|
|
2339
|
+
},
|
|
2340
|
+
genericError: {
|
|
2341
|
+
id: "df.wise.ErrorBoundary.errorAlert",
|
|
2342
|
+
defaultMessage: "Something went wrong.",
|
|
2343
|
+
description: "Generic error message for when something has gone wrong."
|
|
2344
|
+
},
|
|
2345
|
+
retry: {
|
|
2346
|
+
id: "df.wise.ErrorBoundary.retry",
|
|
2347
|
+
defaultMessage: "Retry",
|
|
2348
|
+
description: "Usually this follows the generic error and contains a link."
|
|
2349
|
+
}
|
|
2350
|
+
});
|
|
2351
|
+
|
|
2352
|
+
// ../renderers/src/SearchRenderer/ErrorResult.tsx
|
|
2353
|
+
import { Button as Button6 } from "@transferwise/components";
|
|
2354
|
+
import { jsx as jsx42, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2355
|
+
function ErrorResult({ state }) {
|
|
2356
|
+
const intl = useIntl6();
|
|
2357
|
+
const buttonVisualProps = {
|
|
2358
|
+
priority: "tertiary",
|
|
2359
|
+
size: "sm",
|
|
2360
|
+
style: { marginTop: "-2px", padding: "0", width: "auto", display: "inline" }
|
|
2361
|
+
};
|
|
2362
|
+
return /* @__PURE__ */ jsxs13("p", { className: "m-t-2", children: [
|
|
2363
|
+
intl.formatMessage(generic_error_messages_default.genericError),
|
|
2364
|
+
"\xA0",
|
|
2365
|
+
/* @__PURE__ */ jsx42(
|
|
2366
|
+
Button6,
|
|
2367
|
+
__spreadProps(__spreadValues({}, buttonVisualProps), {
|
|
2368
|
+
onClick: () => {
|
|
2120
2369
|
state.onRetry();
|
|
2121
2370
|
},
|
|
2122
2371
|
children: intl.formatMessage(generic_error_messages_default.retry)
|
|
@@ -2126,7 +2375,7 @@ function ErrorResult({ state }) {
|
|
|
2126
2375
|
}
|
|
2127
2376
|
|
|
2128
2377
|
// ../renderers/src/SearchRenderer/BlockSearchRendererComponent.tsx
|
|
2129
|
-
import { Fragment as
|
|
2378
|
+
import { Fragment as Fragment4, jsx as jsx43, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2130
2379
|
function BlockSearchRendererComponent({
|
|
2131
2380
|
id,
|
|
2132
2381
|
isLoading,
|
|
@@ -2138,9 +2387,9 @@ function BlockSearchRendererComponent({
|
|
|
2138
2387
|
onChange
|
|
2139
2388
|
}) {
|
|
2140
2389
|
const [hasSearched, setHasSearched] = useState6(false);
|
|
2141
|
-
const { formatMessage } =
|
|
2142
|
-
return /* @__PURE__ */
|
|
2143
|
-
/* @__PURE__ */
|
|
2390
|
+
const { formatMessage } = useIntl7();
|
|
2391
|
+
return /* @__PURE__ */ jsxs14("div", { className: getMargin(margin), children: [
|
|
2392
|
+
/* @__PURE__ */ jsx43(FieldInput_default, { id, description: "", validation: void 0, help: "", label: title, children: /* @__PURE__ */ jsx43(
|
|
2144
2393
|
Input4,
|
|
2145
2394
|
{
|
|
2146
2395
|
id,
|
|
@@ -2157,7 +2406,7 @@ function BlockSearchRendererComponent({
|
|
|
2157
2406
|
}
|
|
2158
2407
|
}
|
|
2159
2408
|
) }),
|
|
2160
|
-
isLoading ? /* @__PURE__ */
|
|
2409
|
+
isLoading ? /* @__PURE__ */ jsx43(Fragment4, { children: formatMessage(search_messages_default.loading) }) : /* @__PURE__ */ jsx43(SearchResultContent, { state, trackEvent })
|
|
2161
2410
|
] });
|
|
2162
2411
|
}
|
|
2163
2412
|
function SearchResultContent({
|
|
@@ -2166,26 +2415,26 @@ function SearchResultContent({
|
|
|
2166
2415
|
}) {
|
|
2167
2416
|
switch (state.type) {
|
|
2168
2417
|
case "error":
|
|
2169
|
-
return /* @__PURE__ */
|
|
2418
|
+
return /* @__PURE__ */ jsx43(ErrorResult, { state });
|
|
2170
2419
|
case "results":
|
|
2171
|
-
return /* @__PURE__ */
|
|
2420
|
+
return /* @__PURE__ */ jsx43(SearchResults, { state, trackEvent });
|
|
2172
2421
|
case "noResults":
|
|
2173
|
-
return /* @__PURE__ */
|
|
2422
|
+
return /* @__PURE__ */ jsx43(EmptySearchResult, { state });
|
|
2174
2423
|
case "pending":
|
|
2175
2424
|
default:
|
|
2176
2425
|
return null;
|
|
2177
2426
|
}
|
|
2178
2427
|
}
|
|
2179
2428
|
function EmptySearchResult({ state }) {
|
|
2180
|
-
return /* @__PURE__ */
|
|
2429
|
+
return /* @__PURE__ */ jsx43(Markdown4, { className: "m-t-2", config: { link: { target: "_blank" } }, children: state.message });
|
|
2181
2430
|
}
|
|
2182
2431
|
function SearchResults({
|
|
2183
2432
|
state,
|
|
2184
2433
|
trackEvent
|
|
2185
2434
|
}) {
|
|
2186
|
-
return /* @__PURE__ */
|
|
2435
|
+
return /* @__PURE__ */ jsx43(NavigationOptionsList2, { children: state.results.map((result) => {
|
|
2187
2436
|
const { icon, image } = result;
|
|
2188
|
-
return /* @__PURE__ */
|
|
2437
|
+
return /* @__PURE__ */ jsx43(
|
|
2189
2438
|
NavigationOption3,
|
|
2190
2439
|
{
|
|
2191
2440
|
title: result.title,
|
|
@@ -2207,11 +2456,11 @@ function SearchResults({
|
|
|
2207
2456
|
var BlockSearchRendererComponent_default = BlockSearchRendererComponent;
|
|
2208
2457
|
|
|
2209
2458
|
// ../renderers/src/SearchRenderer/InlineSearchRendererComponent.tsx
|
|
2210
|
-
import { Markdown as
|
|
2459
|
+
import { Markdown as Markdown5, Typeahead } from "@transferwise/components";
|
|
2211
2460
|
import { Search } from "@transferwise/icons";
|
|
2212
2461
|
import { useState as useState7 } from "react";
|
|
2213
|
-
import { useIntl as
|
|
2214
|
-
import { jsx as
|
|
2462
|
+
import { useIntl as useIntl8 } from "react-intl";
|
|
2463
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
2215
2464
|
function InlineSearchRenderer({
|
|
2216
2465
|
id,
|
|
2217
2466
|
isLoading,
|
|
@@ -2222,8 +2471,8 @@ function InlineSearchRenderer({
|
|
|
2222
2471
|
trackEvent
|
|
2223
2472
|
}) {
|
|
2224
2473
|
const [hasSearched, setHasSearched] = useState7(false);
|
|
2225
|
-
const intl =
|
|
2226
|
-
return /* @__PURE__ */
|
|
2474
|
+
const intl = useIntl8();
|
|
2475
|
+
return /* @__PURE__ */ jsx44("div", { className: getMargin(margin), children: /* @__PURE__ */ jsx44(FieldInput_default, { id, description: "", validation: void 0, help: "", label: title, children: /* @__PURE__ */ jsx44(
|
|
2227
2476
|
Typeahead,
|
|
2228
2477
|
{
|
|
2229
2478
|
id: "typeahead-input-id",
|
|
@@ -2231,10 +2480,10 @@ function InlineSearchRenderer({
|
|
|
2231
2480
|
name: "typeahead-input-name",
|
|
2232
2481
|
size: "md",
|
|
2233
2482
|
maxHeight: 100,
|
|
2234
|
-
footer: /* @__PURE__ */
|
|
2483
|
+
footer: /* @__PURE__ */ jsx44(TypeaheadFooter, { state, isLoading }),
|
|
2235
2484
|
multiple: false,
|
|
2236
2485
|
clearable: false,
|
|
2237
|
-
addon: /* @__PURE__ */
|
|
2486
|
+
addon: /* @__PURE__ */ jsx44(Search, { size: 24 }),
|
|
2238
2487
|
options: state.type === "results" ? state.results.map(mapResultToTypeaheadOption) : [],
|
|
2239
2488
|
minQueryLength: 1,
|
|
2240
2489
|
onChange: (values) => {
|
|
@@ -2269,31 +2518,45 @@ function mapResultToTypeaheadOption(result) {
|
|
|
2269
2518
|
};
|
|
2270
2519
|
}
|
|
2271
2520
|
function TypeaheadFooter({ state, isLoading }) {
|
|
2272
|
-
const { formatMessage } =
|
|
2521
|
+
const { formatMessage } = useIntl8();
|
|
2273
2522
|
if (state.type === "noResults") {
|
|
2274
|
-
return /* @__PURE__ */
|
|
2523
|
+
return /* @__PURE__ */ jsx44(Markdown5, { className: "m-t-2 m-x-2", config: { link: { target: "_blank" } }, children: state.message });
|
|
2275
2524
|
}
|
|
2276
2525
|
if (state.type === "error") {
|
|
2277
|
-
return /* @__PURE__ */
|
|
2526
|
+
return /* @__PURE__ */ jsx44("div", { className: "m-t-2 m-x-2", children: /* @__PURE__ */ jsx44(ErrorResult, { state }) });
|
|
2278
2527
|
}
|
|
2279
2528
|
if (state.type === "pending" || isLoading) {
|
|
2280
|
-
return /* @__PURE__ */
|
|
2529
|
+
return /* @__PURE__ */ jsx44("p", { className: "m-t-2 m-x-2", children: formatMessage(search_messages_default.loading) });
|
|
2281
2530
|
}
|
|
2282
2531
|
return null;
|
|
2283
2532
|
}
|
|
2284
2533
|
var InlineSearchRendererComponent_default = InlineSearchRenderer;
|
|
2285
2534
|
|
|
2286
2535
|
// ../renderers/src/SearchRenderer/SearchRenderer.tsx
|
|
2287
|
-
import { jsx as
|
|
2536
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
2288
2537
|
var SearchRenderer = {
|
|
2289
2538
|
canRenderType: "search",
|
|
2290
|
-
render: (props) => props.control === "inline" ? /* @__PURE__ */
|
|
2539
|
+
render: (props) => props.control === "inline" ? /* @__PURE__ */ jsx45(InlineSearchRendererComponent_default, __spreadValues({}, props)) : /* @__PURE__ */ jsx45(BlockSearchRendererComponent_default, __spreadValues({}, props))
|
|
2291
2540
|
};
|
|
2292
2541
|
var SearchRenderer_default = SearchRenderer;
|
|
2293
2542
|
|
|
2543
|
+
// ../renderers/src/SectionRenderer.tsx
|
|
2544
|
+
import { Header as Header7 } from "@transferwise/components";
|
|
2545
|
+
import { jsx as jsx46, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2546
|
+
var SectionRenderer = {
|
|
2547
|
+
canRenderType: "section",
|
|
2548
|
+
render: ({ children, callToAction, margin, title }) => {
|
|
2549
|
+
return /* @__PURE__ */ jsxs15("section", { className: getMargin(margin), children: [
|
|
2550
|
+
(title || callToAction) && /* @__PURE__ */ jsx46(Header7, { title: title != null ? title : "", action: getHeaderAction(callToAction) }),
|
|
2551
|
+
children
|
|
2552
|
+
] });
|
|
2553
|
+
}
|
|
2554
|
+
};
|
|
2555
|
+
var SectionRenderer_default = SectionRenderer;
|
|
2556
|
+
|
|
2294
2557
|
// ../renderers/src/SelectInputRenderer/RadioInputRendererComponent.tsx
|
|
2295
2558
|
import { RadioGroup } from "@transferwise/components";
|
|
2296
|
-
import { Fragment as
|
|
2559
|
+
import { Fragment as Fragment5, jsx as jsx47, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2297
2560
|
function RadioInputRendererComponent(props) {
|
|
2298
2561
|
const {
|
|
2299
2562
|
id,
|
|
@@ -2307,8 +2570,8 @@ function RadioInputRendererComponent(props) {
|
|
|
2307
2570
|
validationState,
|
|
2308
2571
|
onSelect
|
|
2309
2572
|
} = props;
|
|
2310
|
-
return /* @__PURE__ */
|
|
2311
|
-
/* @__PURE__ */
|
|
2573
|
+
return /* @__PURE__ */ jsxs16(Fragment5, { children: [
|
|
2574
|
+
/* @__PURE__ */ jsx47(
|
|
2312
2575
|
FieldInput_default,
|
|
2313
2576
|
{
|
|
2314
2577
|
id,
|
|
@@ -2316,7 +2579,7 @@ function RadioInputRendererComponent(props) {
|
|
|
2316
2579
|
help,
|
|
2317
2580
|
description,
|
|
2318
2581
|
validation: validationState,
|
|
2319
|
-
children: /* @__PURE__ */
|
|
2582
|
+
children: /* @__PURE__ */ jsx47("span", { children: /* @__PURE__ */ jsx47(
|
|
2320
2583
|
RadioGroup,
|
|
2321
2584
|
{
|
|
2322
2585
|
name: id,
|
|
@@ -2325,7 +2588,7 @@ function RadioInputRendererComponent(props) {
|
|
|
2325
2588
|
value: index,
|
|
2326
2589
|
secondary: option.description,
|
|
2327
2590
|
disabled: option.disabled || disabled,
|
|
2328
|
-
avatar: /* @__PURE__ */
|
|
2591
|
+
avatar: /* @__PURE__ */ jsx47(OptionMedia, { icon: option.icon, image: option.image, preferAvatar: false })
|
|
2329
2592
|
})),
|
|
2330
2593
|
selectedValue: selectedIndex != null ? selectedIndex : void 0,
|
|
2331
2594
|
onChange: onSelect
|
|
@@ -2340,8 +2603,8 @@ function RadioInputRendererComponent(props) {
|
|
|
2340
2603
|
|
|
2341
2604
|
// ../renderers/src/SelectInputRenderer/TabInputRendererComponent.tsx
|
|
2342
2605
|
import { Tabs } from "@transferwise/components";
|
|
2343
|
-
import { useEffect as
|
|
2344
|
-
import { Fragment as
|
|
2606
|
+
import { useEffect as useEffect3 } from "react";
|
|
2607
|
+
import { Fragment as Fragment6, jsx as jsx48, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2345
2608
|
function TabInputRendererComponent(props) {
|
|
2346
2609
|
const {
|
|
2347
2610
|
id,
|
|
@@ -2355,13 +2618,13 @@ function TabInputRendererComponent(props) {
|
|
|
2355
2618
|
validationState,
|
|
2356
2619
|
onSelect
|
|
2357
2620
|
} = props;
|
|
2358
|
-
|
|
2621
|
+
useEffect3(() => {
|
|
2359
2622
|
if (!isValidIndex(selectedIndex, options.length)) {
|
|
2360
2623
|
onSelect(0);
|
|
2361
2624
|
}
|
|
2362
2625
|
}, [selectedIndex, onSelect, options.length]);
|
|
2363
|
-
return /* @__PURE__ */
|
|
2364
|
-
/* @__PURE__ */
|
|
2626
|
+
return /* @__PURE__ */ jsxs17(Fragment6, { children: [
|
|
2627
|
+
/* @__PURE__ */ jsx48(
|
|
2365
2628
|
FieldInput_default,
|
|
2366
2629
|
{
|
|
2367
2630
|
id,
|
|
@@ -2369,7 +2632,7 @@ function TabInputRendererComponent(props) {
|
|
|
2369
2632
|
help,
|
|
2370
2633
|
description,
|
|
2371
2634
|
validation: validationState,
|
|
2372
|
-
children: /* @__PURE__ */
|
|
2635
|
+
children: /* @__PURE__ */ jsx48(
|
|
2373
2636
|
Tabs,
|
|
2374
2637
|
{
|
|
2375
2638
|
name: id,
|
|
@@ -2378,7 +2641,7 @@ function TabInputRendererComponent(props) {
|
|
|
2378
2641
|
title: option.title,
|
|
2379
2642
|
// if we pass null, we get some props-types console errors
|
|
2380
2643
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
2381
|
-
content: /* @__PURE__ */
|
|
2644
|
+
content: /* @__PURE__ */ jsx48(Fragment6, {}),
|
|
2382
2645
|
disabled: option.disabled || disabled
|
|
2383
2646
|
})),
|
|
2384
2647
|
onTabSelect: onSelect
|
|
@@ -2393,7 +2656,7 @@ var isValidIndex = (index, options) => index !== null && index >= 0 && index < o
|
|
|
2393
2656
|
|
|
2394
2657
|
// ../renderers/src/SelectInputRenderer/SelectInputRendererComponent.tsx
|
|
2395
2658
|
import { SelectInput as SelectInput2, SelectInputOptionContent as SelectInputOptionContent2 } from "@transferwise/components";
|
|
2396
|
-
import { Fragment as
|
|
2659
|
+
import { Fragment as Fragment7, jsx as jsx49, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2397
2660
|
function SelectInputRendererComponent(props) {
|
|
2398
2661
|
const {
|
|
2399
2662
|
id,
|
|
@@ -2433,13 +2696,13 @@ function SelectInputRendererComponent(props) {
|
|
|
2433
2696
|
} : {
|
|
2434
2697
|
title: option.title,
|
|
2435
2698
|
description: option.description,
|
|
2436
|
-
icon: /* @__PURE__ */
|
|
2699
|
+
icon: /* @__PURE__ */ jsx49(OptionMedia, { icon: option.icon, image: option.image, preferAvatar: false })
|
|
2437
2700
|
};
|
|
2438
|
-
return /* @__PURE__ */
|
|
2701
|
+
return /* @__PURE__ */ jsx49(SelectInputOptionContent2, __spreadValues({}, contentProps));
|
|
2439
2702
|
};
|
|
2440
2703
|
const extraProps = { autoComplete };
|
|
2441
|
-
return /* @__PURE__ */
|
|
2442
|
-
/* @__PURE__ */
|
|
2704
|
+
return /* @__PURE__ */ jsxs18(Fragment7, { children: [
|
|
2705
|
+
/* @__PURE__ */ jsx49(
|
|
2443
2706
|
FieldInput_default,
|
|
2444
2707
|
{
|
|
2445
2708
|
id,
|
|
@@ -2447,7 +2710,7 @@ function SelectInputRendererComponent(props) {
|
|
|
2447
2710
|
help,
|
|
2448
2711
|
description,
|
|
2449
2712
|
validation: validationState,
|
|
2450
|
-
children: /* @__PURE__ */
|
|
2713
|
+
children: /* @__PURE__ */ jsx49(
|
|
2451
2714
|
SelectInput2,
|
|
2452
2715
|
__spreadValues({
|
|
2453
2716
|
name: id,
|
|
@@ -2468,9 +2731,9 @@ function SelectInputRendererComponent(props) {
|
|
|
2468
2731
|
}
|
|
2469
2732
|
|
|
2470
2733
|
// ../renderers/src/SelectInputRenderer/SegmentedInputRendererComponent.tsx
|
|
2471
|
-
import { useEffect as
|
|
2734
|
+
import { useEffect as useEffect4 } from "react";
|
|
2472
2735
|
import { SegmentedControl } from "@transferwise/components";
|
|
2473
|
-
import { Fragment as
|
|
2736
|
+
import { Fragment as Fragment8, jsx as jsx50, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2474
2737
|
function SegmentedInputRendererComponent(props) {
|
|
2475
2738
|
const {
|
|
2476
2739
|
id,
|
|
@@ -2483,13 +2746,13 @@ function SegmentedInputRendererComponent(props) {
|
|
|
2483
2746
|
validationState,
|
|
2484
2747
|
onSelect
|
|
2485
2748
|
} = props;
|
|
2486
|
-
|
|
2749
|
+
useEffect4(() => {
|
|
2487
2750
|
if (!isValidIndex2(selectedIndex, options.length)) {
|
|
2488
2751
|
onSelect(0);
|
|
2489
2752
|
}
|
|
2490
2753
|
}, [selectedIndex, onSelect, options.length]);
|
|
2491
|
-
return /* @__PURE__ */
|
|
2492
|
-
/* @__PURE__ */
|
|
2754
|
+
return /* @__PURE__ */ jsxs19(Fragment8, { children: [
|
|
2755
|
+
/* @__PURE__ */ jsx50(
|
|
2493
2756
|
FieldInput_default,
|
|
2494
2757
|
{
|
|
2495
2758
|
id,
|
|
@@ -2497,7 +2760,7 @@ function SegmentedInputRendererComponent(props) {
|
|
|
2497
2760
|
help,
|
|
2498
2761
|
description,
|
|
2499
2762
|
validation: validationState,
|
|
2500
|
-
children: /* @__PURE__ */
|
|
2763
|
+
children: /* @__PURE__ */ jsx50(
|
|
2501
2764
|
SegmentedControl,
|
|
2502
2765
|
{
|
|
2503
2766
|
name: `${id}-segmented-control`,
|
|
@@ -2514,44 +2777,44 @@ function SegmentedInputRendererComponent(props) {
|
|
|
2514
2777
|
)
|
|
2515
2778
|
}
|
|
2516
2779
|
),
|
|
2517
|
-
/* @__PURE__ */
|
|
2780
|
+
/* @__PURE__ */ jsx50("div", { id: `${id}-children`, children })
|
|
2518
2781
|
] });
|
|
2519
2782
|
}
|
|
2520
2783
|
var isValidIndex2 = (index, options) => index !== null && index >= 0 && index < options;
|
|
2521
2784
|
|
|
2522
2785
|
// ../renderers/src/SelectInputRenderer/SelectInputRenderer.tsx
|
|
2523
|
-
import { jsx as
|
|
2786
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
2524
2787
|
var SelectInputRenderer = {
|
|
2525
2788
|
canRenderType: "input-select",
|
|
2526
2789
|
render: (props) => {
|
|
2527
2790
|
switch (props.control) {
|
|
2528
2791
|
case "radio":
|
|
2529
|
-
return /* @__PURE__ */
|
|
2792
|
+
return /* @__PURE__ */ jsx51(RadioInputRendererComponent, __spreadValues({}, props));
|
|
2530
2793
|
case "tab":
|
|
2531
|
-
return props.options.length > 3 ? /* @__PURE__ */
|
|
2794
|
+
return props.options.length > 3 ? /* @__PURE__ */ jsx51(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ jsx51(TabInputRendererComponent, __spreadValues({}, props));
|
|
2532
2795
|
case "segmented":
|
|
2533
|
-
return props.options.length > 3 ? /* @__PURE__ */
|
|
2796
|
+
return props.options.length > 3 ? /* @__PURE__ */ jsx51(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ jsx51(SegmentedInputRendererComponent, __spreadValues({}, props));
|
|
2534
2797
|
case "select":
|
|
2535
2798
|
default:
|
|
2536
|
-
return /* @__PURE__ */
|
|
2799
|
+
return /* @__PURE__ */ jsx51(SelectInputRendererComponent, __spreadValues({}, props));
|
|
2537
2800
|
}
|
|
2538
2801
|
}
|
|
2539
2802
|
};
|
|
2540
2803
|
var SelectInputRenderer_default = SelectInputRenderer;
|
|
2541
2804
|
|
|
2542
2805
|
// ../renderers/src/StatusListRenderer.tsx
|
|
2543
|
-
import { Header as
|
|
2544
|
-
import { jsx as
|
|
2806
|
+
import { Header as Header8, Summary } from "@transferwise/components";
|
|
2807
|
+
import { jsx as jsx52, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2545
2808
|
var StatusListRenderer = {
|
|
2546
2809
|
canRenderType: "status-list",
|
|
2547
|
-
render: ({ margin, items, title }) => /* @__PURE__ */
|
|
2548
|
-
title ? /* @__PURE__ */
|
|
2549
|
-
items.map(({ callToAction, description, icon, status, title: itemTitle }) => /* @__PURE__ */
|
|
2810
|
+
render: ({ margin, items, title }) => /* @__PURE__ */ jsxs20("div", { className: getMargin(margin), children: [
|
|
2811
|
+
title ? /* @__PURE__ */ jsx52(Header8, { title, className: "m-b-2" }) : null,
|
|
2812
|
+
items.map(({ callToAction, description, icon, status, title: itemTitle }) => /* @__PURE__ */ jsx52(
|
|
2550
2813
|
Summary,
|
|
2551
2814
|
{
|
|
2552
2815
|
title: itemTitle,
|
|
2553
2816
|
description,
|
|
2554
|
-
icon: icon && "name" in icon ? /* @__PURE__ */
|
|
2817
|
+
icon: icon && "name" in icon ? /* @__PURE__ */ jsx52(DynamicIcon_default, { name: icon.name }) : null,
|
|
2555
2818
|
status: mapStatus(status),
|
|
2556
2819
|
action: getSummaryAction(callToAction)
|
|
2557
2820
|
},
|
|
@@ -2586,76 +2849,243 @@ var mapStatus = (status) => {
|
|
|
2586
2849
|
return status;
|
|
2587
2850
|
};
|
|
2588
2851
|
|
|
2589
|
-
// ../renderers/src/
|
|
2590
|
-
import {
|
|
2852
|
+
// ../renderers/src/utils/useCustomTheme.ts
|
|
2853
|
+
import { useTheme } from "@wise/components-theming";
|
|
2854
|
+
import { useEffect as useEffect5, useMemo } from "react";
|
|
2855
|
+
var ThemeRequiredEventName = "Theme Required";
|
|
2856
|
+
var useCustomTheme = (theme, trackEvent) => {
|
|
2857
|
+
const previousThemeHookValue = useTheme();
|
|
2858
|
+
const previousTheme = useMemo(() => previousThemeHookValue.theme, []);
|
|
2859
|
+
useEffect5(() => {
|
|
2860
|
+
trackEvent(ThemeRequiredEventName, { theme });
|
|
2861
|
+
return theme !== previousTheme ? () => {
|
|
2862
|
+
trackEvent(ThemeRequiredEventName, { theme: previousTheme });
|
|
2863
|
+
} : () => {
|
|
2864
|
+
};
|
|
2865
|
+
}, []);
|
|
2866
|
+
};
|
|
2591
2867
|
|
|
2592
|
-
// ../renderers/src/
|
|
2593
|
-
import {
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
"onBlur",
|
|
2610
|
-
"onFocus",
|
|
2611
|
-
"placeholder",
|
|
2612
|
-
"value"
|
|
2613
|
-
];
|
|
2614
|
-
function VariableTextInput(inputProps) {
|
|
2615
|
-
const { id, value, control, onChange } = inputProps;
|
|
2616
|
-
const commonProps = __spreadProps(__spreadValues({}, pick(inputProps, ...commonKeys)), { name: id });
|
|
2617
|
-
switch (control) {
|
|
2618
|
-
case "email":
|
|
2619
|
-
return /* @__PURE__ */ jsx49(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "email", onChange }));
|
|
2620
|
-
case "password":
|
|
2621
|
-
return /* @__PURE__ */ jsx49(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "password", onChange }));
|
|
2622
|
-
case "numeric": {
|
|
2623
|
-
const numericProps = __spreadProps(__spreadValues({}, commonProps), { type: "number", onWheel });
|
|
2624
|
-
return /* @__PURE__ */ jsx49(
|
|
2625
|
-
TextInput,
|
|
2626
|
-
__spreadProps(__spreadValues({}, numericProps), {
|
|
2627
|
-
onChange: (newValue) => {
|
|
2628
|
-
const numericValueOrNull = !Number.isNaN(Number.parseFloat(newValue)) ? newValue : null;
|
|
2629
|
-
onChange(numericValueOrNull);
|
|
2630
|
-
}
|
|
2631
|
-
})
|
|
2632
|
-
);
|
|
2633
|
-
}
|
|
2634
|
-
case "phone-number":
|
|
2635
|
-
return /* @__PURE__ */ jsx49(PhoneNumberInput, __spreadProps(__spreadValues({ initialValue: value }, commonProps), { onChange }));
|
|
2636
|
-
default: {
|
|
2637
|
-
return /* @__PURE__ */ jsx49(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "text", onChange }));
|
|
2868
|
+
// ../renderers/src/step/BackButton.tsx
|
|
2869
|
+
import { AvatarView as AvatarView4 } from "@transferwise/components";
|
|
2870
|
+
import { ArrowLeft } from "@transferwise/icons";
|
|
2871
|
+
import { jsx as jsx53, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2872
|
+
function BackButton({ title, onClick }) {
|
|
2873
|
+
return /* @__PURE__ */ jsx53("div", { className: "m-b-2", children: /* @__PURE__ */ jsxs21(
|
|
2874
|
+
"button",
|
|
2875
|
+
{
|
|
2876
|
+
type: "button",
|
|
2877
|
+
className: "df-back-btn",
|
|
2878
|
+
title,
|
|
2879
|
+
"aria-label": title,
|
|
2880
|
+
onClick,
|
|
2881
|
+
children: [
|
|
2882
|
+
/* @__PURE__ */ jsx53("span", { className: "sr-only", children: title }),
|
|
2883
|
+
/* @__PURE__ */ jsx53(AvatarView4, { interactive: true, children: /* @__PURE__ */ jsx53(ArrowLeft, { size: "24" }) })
|
|
2884
|
+
]
|
|
2638
2885
|
}
|
|
2639
|
-
}
|
|
2886
|
+
) });
|
|
2640
2887
|
}
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2888
|
+
var BackButton_default = BackButton;
|
|
2889
|
+
|
|
2890
|
+
// ../renderers/src/step/SplashCelebrationStepRenderer.tsx
|
|
2891
|
+
import { jsx as jsx54, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2892
|
+
var SplashCelebrationStepRenderer = {
|
|
2893
|
+
canRenderType: "step",
|
|
2894
|
+
canRender: ({ control }) => control === "splash-celebration",
|
|
2895
|
+
render: SplashCelebrationStepRendererComponent
|
|
2896
|
+
};
|
|
2897
|
+
function SplashCelebrationStepRendererComponent(props) {
|
|
2898
|
+
const { back, children, trackEvent } = props;
|
|
2899
|
+
useCustomTheme("forest-green", trackEvent);
|
|
2900
|
+
return /* @__PURE__ */ jsxs22("div", { className: "splash-screen m-t-5", children: [
|
|
2901
|
+
back ? /* @__PURE__ */ jsx54(BackButton_default, __spreadValues({}, back)) : null,
|
|
2902
|
+
children
|
|
2903
|
+
] });
|
|
2646
2904
|
}
|
|
2647
2905
|
|
|
2648
|
-
// ../renderers/src/
|
|
2649
|
-
import { jsx as
|
|
2650
|
-
var
|
|
2651
|
-
canRenderType: "
|
|
2906
|
+
// ../renderers/src/step/SplashStepRenderer.tsx
|
|
2907
|
+
import { jsx as jsx55, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2908
|
+
var SplashStepRenderer = {
|
|
2909
|
+
canRenderType: "step",
|
|
2910
|
+
canRender: ({ control }) => control === "splash",
|
|
2911
|
+
render: SplashStepRendererComponent
|
|
2912
|
+
};
|
|
2913
|
+
function SplashStepRendererComponent(props) {
|
|
2914
|
+
const { back, children } = props;
|
|
2915
|
+
return /* @__PURE__ */ jsxs23("div", { className: "splash-screen m-t-5", children: [
|
|
2916
|
+
back ? /* @__PURE__ */ jsx55(BackButton_default, __spreadValues({}, back)) : null,
|
|
2917
|
+
children
|
|
2918
|
+
] });
|
|
2919
|
+
}
|
|
2920
|
+
|
|
2921
|
+
// ../renderers/src/step/StepRenderer.tsx
|
|
2922
|
+
import { Alert as Alert2, Title as Title2 } from "@transferwise/components";
|
|
2923
|
+
import { Fragment as Fragment9, jsx as jsx56, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2924
|
+
var StepRenderer = {
|
|
2925
|
+
canRenderType: "step",
|
|
2926
|
+
render: StepRendererComponent
|
|
2927
|
+
};
|
|
2928
|
+
function StepRendererComponent(props) {
|
|
2929
|
+
const { back, description, error, title, children } = props;
|
|
2930
|
+
return /* @__PURE__ */ jsxs24(Fragment9, { children: [
|
|
2931
|
+
back ? /* @__PURE__ */ jsx56(BackButton_default, __spreadValues({}, back)) : null,
|
|
2932
|
+
title || description ? /* @__PURE__ */ jsxs24("div", { className: "m-b-4", children: [
|
|
2933
|
+
title ? /* @__PURE__ */ jsx56(Title2, { as: "h1", type: "title-section", className: "text-xs-center m-b-2", children: title }) : void 0,
|
|
2934
|
+
description ? /* @__PURE__ */ jsx56("p", { className: "text-xs-center np-text-body-large", children: description }) : void 0
|
|
2935
|
+
] }) : void 0,
|
|
2936
|
+
error ? /* @__PURE__ */ jsx56(Alert2, { type: "negative", className: "m-b-2", message: error }) : void 0,
|
|
2937
|
+
children
|
|
2938
|
+
] });
|
|
2939
|
+
}
|
|
2940
|
+
|
|
2941
|
+
// ../renderers/src/TabsRenderer.tsx
|
|
2942
|
+
import { Chips, SegmentedControl as SegmentedControl2, Tabs as Tabs2 } from "@transferwise/components";
|
|
2943
|
+
import { useState as useState8 } from "react";
|
|
2944
|
+
import { jsx as jsx57, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2945
|
+
var TabsRenderer = {
|
|
2946
|
+
canRenderType: "tabs",
|
|
2652
2947
|
render: (props) => {
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2948
|
+
switch (props.control) {
|
|
2949
|
+
case "segmented":
|
|
2950
|
+
if (props.tabs.length > 3) {
|
|
2951
|
+
return /* @__PURE__ */ jsx57(TabsRendererComponent, __spreadValues({}, props));
|
|
2952
|
+
}
|
|
2953
|
+
return /* @__PURE__ */ jsx57(SegmentedTabsRendererComponent, __spreadValues({}, props));
|
|
2954
|
+
case "chips":
|
|
2955
|
+
return /* @__PURE__ */ jsx57(ChipsTabsRendererComponent, __spreadValues({}, props));
|
|
2956
|
+
default:
|
|
2957
|
+
return /* @__PURE__ */ jsx57(TabsRendererComponent, __spreadValues({}, props));
|
|
2958
|
+
}
|
|
2959
|
+
}
|
|
2960
|
+
};
|
|
2961
|
+
function TabsRendererComponent({ uid, margin, tabs }) {
|
|
2962
|
+
const [selectedIndex, setSelectedIndex] = useState8(0);
|
|
2963
|
+
return /* @__PURE__ */ jsx57("div", { className: getMargin(margin), children: /* @__PURE__ */ jsx57(
|
|
2964
|
+
Tabs2,
|
|
2965
|
+
{
|
|
2966
|
+
name: uid,
|
|
2967
|
+
selected: selectedIndex != null ? selectedIndex : 0,
|
|
2968
|
+
tabs: tabs.map((option) => ({
|
|
2969
|
+
title: option.title,
|
|
2970
|
+
disabled: false,
|
|
2971
|
+
content: /* @__PURE__ */ jsxs25("div", { className: "m-t-2", children: [
|
|
2972
|
+
" ",
|
|
2973
|
+
option.children,
|
|
2974
|
+
" "
|
|
2975
|
+
] })
|
|
2976
|
+
})),
|
|
2977
|
+
onTabSelect: setSelectedIndex
|
|
2978
|
+
}
|
|
2979
|
+
) });
|
|
2980
|
+
}
|
|
2981
|
+
function SegmentedTabsRendererComponent({ uid, margin, tabs }) {
|
|
2982
|
+
var _a;
|
|
2983
|
+
const [selectedIndex, setSelectedIndex] = useState8(0);
|
|
2984
|
+
return /* @__PURE__ */ jsxs25("div", { className: getMargin(margin), children: [
|
|
2985
|
+
/* @__PURE__ */ jsx57(
|
|
2986
|
+
SegmentedControl2,
|
|
2987
|
+
{
|
|
2988
|
+
name: uid,
|
|
2989
|
+
value: String(selectedIndex),
|
|
2990
|
+
mode: "view",
|
|
2991
|
+
segments: tabs.map((tab, index) => ({
|
|
2992
|
+
id: String(index),
|
|
2993
|
+
value: String(index),
|
|
2994
|
+
label: tab.title,
|
|
2995
|
+
controls: `${uid}-children`
|
|
2996
|
+
})),
|
|
2997
|
+
onChange: (value) => setSelectedIndex(Number(value))
|
|
2998
|
+
}
|
|
2999
|
+
),
|
|
3000
|
+
/* @__PURE__ */ jsx57("div", { id: `${uid}-children`, className: "m-t-2", children: (_a = tabs[selectedIndex]) == null ? void 0 : _a.children })
|
|
3001
|
+
] });
|
|
3002
|
+
}
|
|
3003
|
+
function ChipsTabsRendererComponent({ margin, tabs }) {
|
|
3004
|
+
var _a;
|
|
3005
|
+
const [selectedIndex, setSelectedIndex] = useState8(0);
|
|
3006
|
+
return /* @__PURE__ */ jsxs25("div", { className: getMargin(margin), children: [
|
|
3007
|
+
/* @__PURE__ */ jsx57("div", { className: "chips-container", children: /* @__PURE__ */ jsx57(
|
|
3008
|
+
Chips,
|
|
3009
|
+
{
|
|
3010
|
+
chips: tabs.map((tab, index) => ({ label: tab.title, value: index })),
|
|
3011
|
+
selected: selectedIndex,
|
|
3012
|
+
onChange: ({ selectedValue }) => setSelectedIndex(Number(selectedValue))
|
|
3013
|
+
}
|
|
3014
|
+
) }),
|
|
3015
|
+
/* @__PURE__ */ jsx57("div", { className: "m-t-2", children: (_a = tabs[selectedIndex]) == null ? void 0 : _a.children })
|
|
3016
|
+
] });
|
|
3017
|
+
}
|
|
3018
|
+
|
|
3019
|
+
// ../renderers/src/TextInputRenderer.tsx
|
|
3020
|
+
import { InputGroup as InputGroup3 } from "@transferwise/components";
|
|
3021
|
+
|
|
3022
|
+
// ../renderers/src/components/VariableTextInput.tsx
|
|
3023
|
+
import {
|
|
3024
|
+
Input as Input5,
|
|
3025
|
+
InputWithDisplayFormat,
|
|
3026
|
+
PhoneNumberInput,
|
|
3027
|
+
TextArea,
|
|
3028
|
+
TextareaWithDisplayFormat
|
|
3029
|
+
} from "@transferwise/components";
|
|
3030
|
+
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
3031
|
+
var commonKeys = [
|
|
3032
|
+
"autoComplete",
|
|
3033
|
+
"autoCapitalize",
|
|
3034
|
+
"placeholder",
|
|
3035
|
+
"control",
|
|
3036
|
+
"disabled",
|
|
3037
|
+
"displayFormat",
|
|
3038
|
+
"id",
|
|
3039
|
+
"onBlur",
|
|
3040
|
+
"onFocus",
|
|
3041
|
+
"placeholder",
|
|
3042
|
+
"value"
|
|
3043
|
+
];
|
|
3044
|
+
function VariableTextInput(inputProps) {
|
|
3045
|
+
const { id, value, control, onChange } = inputProps;
|
|
3046
|
+
const commonProps = __spreadProps(__spreadValues({}, pick(inputProps, ...commonKeys)), { name: id });
|
|
3047
|
+
switch (control) {
|
|
3048
|
+
case "email":
|
|
3049
|
+
return /* @__PURE__ */ jsx58(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "email", onChange }));
|
|
3050
|
+
case "password":
|
|
3051
|
+
return /* @__PURE__ */ jsx58(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "password", onChange }));
|
|
3052
|
+
case "numeric": {
|
|
3053
|
+
const numericProps = __spreadProps(__spreadValues({}, commonProps), { type: "number", onWheel });
|
|
3054
|
+
return /* @__PURE__ */ jsx58(
|
|
3055
|
+
TextInput,
|
|
3056
|
+
__spreadProps(__spreadValues({}, numericProps), {
|
|
3057
|
+
onChange: (newValue) => {
|
|
3058
|
+
const numericValueOrNull = !Number.isNaN(Number.parseFloat(newValue)) ? newValue : null;
|
|
3059
|
+
onChange(numericValueOrNull);
|
|
3060
|
+
}
|
|
3061
|
+
})
|
|
3062
|
+
);
|
|
3063
|
+
}
|
|
3064
|
+
case "phone-number":
|
|
3065
|
+
return /* @__PURE__ */ jsx58(PhoneNumberInput, __spreadProps(__spreadValues({ initialValue: value }, commonProps), { onChange }));
|
|
3066
|
+
default: {
|
|
3067
|
+
return /* @__PURE__ */ jsx58(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "text", onChange }));
|
|
3068
|
+
}
|
|
3069
|
+
}
|
|
3070
|
+
}
|
|
3071
|
+
function TextInput(props) {
|
|
3072
|
+
const _a = props, { control, displayFormat, onChange } = _a, commonProps = __objRest(_a, ["control", "displayFormat", "onChange"]);
|
|
3073
|
+
const InputWithPattern = control === "textarea" ? TextareaWithDisplayFormat : InputWithDisplayFormat;
|
|
3074
|
+
const InputWithoutPattern = control === "textarea" ? TextArea : Input5;
|
|
3075
|
+
return displayFormat ? /* @__PURE__ */ jsx58(InputWithPattern, __spreadProps(__spreadValues({ displayPattern: displayFormat }, commonProps), { onChange })) : /* @__PURE__ */ jsx58(InputWithoutPattern, __spreadProps(__spreadValues({}, commonProps), { onChange: (e) => onChange(e.target.value) }));
|
|
3076
|
+
}
|
|
3077
|
+
|
|
3078
|
+
// ../renderers/src/TextInputRenderer.tsx
|
|
3079
|
+
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
3080
|
+
var TextInputRenderer = {
|
|
3081
|
+
canRenderType: "input-text",
|
|
3082
|
+
render: (props) => {
|
|
3083
|
+
const _a = props, {
|
|
3084
|
+
id,
|
|
3085
|
+
title,
|
|
3086
|
+
description,
|
|
3087
|
+
help,
|
|
3088
|
+
icon,
|
|
2659
3089
|
image,
|
|
2660
3090
|
validationState,
|
|
2661
3091
|
value: initialValue,
|
|
@@ -2681,7 +3111,7 @@ var TextInputRenderer = {
|
|
|
2681
3111
|
}
|
|
2682
3112
|
}
|
|
2683
3113
|
});
|
|
2684
|
-
return /* @__PURE__ */
|
|
3114
|
+
return /* @__PURE__ */ jsx59(
|
|
2685
3115
|
FieldInput_default,
|
|
2686
3116
|
{
|
|
2687
3117
|
id,
|
|
@@ -2689,7 +3119,7 @@ var TextInputRenderer = {
|
|
|
2689
3119
|
description,
|
|
2690
3120
|
validation: validationState,
|
|
2691
3121
|
help,
|
|
2692
|
-
children: /* @__PURE__ */
|
|
3122
|
+
children: /* @__PURE__ */ jsx59(InputGroup3, { addonStart: getInputGroupAddonStart({ icon, image }), children: /* @__PURE__ */ jsx59(VariableTextInput, __spreadValues({}, inputProps)) })
|
|
2693
3123
|
}
|
|
2694
3124
|
);
|
|
2695
3125
|
}
|
|
@@ -2703,7 +3133,7 @@ import { Upload, UploadInput as UploadInput2 } from "@transferwise/components";
|
|
|
2703
3133
|
var getRandomId = () => Math.random().toString(36).substring(2);
|
|
2704
3134
|
|
|
2705
3135
|
// ../renderers/src/UploadInputRenderer.tsx
|
|
2706
|
-
import { jsx as
|
|
3136
|
+
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
2707
3137
|
var UploadInputRenderer = {
|
|
2708
3138
|
canRenderType: "input-upload",
|
|
2709
3139
|
render: (props) => {
|
|
@@ -2719,14 +3149,14 @@ var UploadInputRenderer = {
|
|
|
2719
3149
|
};
|
|
2720
3150
|
return (
|
|
2721
3151
|
// We don't pass help here as there is no sensible place to display it
|
|
2722
|
-
/* @__PURE__ */
|
|
3152
|
+
/* @__PURE__ */ jsx60(
|
|
2723
3153
|
UploadFieldInput_default,
|
|
2724
3154
|
{
|
|
2725
3155
|
id,
|
|
2726
3156
|
label: void 0,
|
|
2727
3157
|
description: void 0,
|
|
2728
3158
|
validation: validationState,
|
|
2729
|
-
children: /* @__PURE__ */
|
|
3159
|
+
children: /* @__PURE__ */ jsx60(
|
|
2730
3160
|
UploadInput2,
|
|
2731
3161
|
{
|
|
2732
3162
|
id,
|
|
@@ -2781,7 +3211,7 @@ var LargeUploadRenderer = {
|
|
|
2781
3211
|
throw e;
|
|
2782
3212
|
}
|
|
2783
3213
|
};
|
|
2784
|
-
return /* @__PURE__ */
|
|
3214
|
+
return /* @__PURE__ */ jsx60(
|
|
2785
3215
|
FieldInput_default,
|
|
2786
3216
|
{
|
|
2787
3217
|
id,
|
|
@@ -2789,7 +3219,7 @@ var LargeUploadRenderer = {
|
|
|
2789
3219
|
description,
|
|
2790
3220
|
validation: validationState,
|
|
2791
3221
|
help,
|
|
2792
|
-
children: /* @__PURE__ */
|
|
3222
|
+
children: /* @__PURE__ */ jsx60(
|
|
2793
3223
|
Upload,
|
|
2794
3224
|
__spreadProps(__spreadValues({}, uploadProps), {
|
|
2795
3225
|
usAccept: getAcceptsString(accepts),
|
|
@@ -2804,438 +3234,6 @@ var LargeUploadRenderer = {
|
|
|
2804
3234
|
}
|
|
2805
3235
|
};
|
|
2806
3236
|
|
|
2807
|
-
// ../renderers/src/ReviewRenderer.tsx
|
|
2808
|
-
import { DefinitionList, Header as Header6 } from "@transferwise/components";
|
|
2809
|
-
|
|
2810
|
-
// ../renderers/src/utils/getHeaderAction.tsx
|
|
2811
|
-
var getHeaderAction = (callToAction) => {
|
|
2812
|
-
if (!callToAction) {
|
|
2813
|
-
return void 0;
|
|
2814
|
-
}
|
|
2815
|
-
const { accessibilityDescription, href, title, onClick } = callToAction;
|
|
2816
|
-
return href ? {
|
|
2817
|
-
"aria-label": accessibilityDescription,
|
|
2818
|
-
text: title,
|
|
2819
|
-
href,
|
|
2820
|
-
target: "_blank"
|
|
2821
|
-
} : {
|
|
2822
|
-
"aria-label": accessibilityDescription,
|
|
2823
|
-
text: title,
|
|
2824
|
-
onClick: (event) => {
|
|
2825
|
-
event.preventDefault();
|
|
2826
|
-
onClick();
|
|
2827
|
-
}
|
|
2828
|
-
};
|
|
2829
|
-
};
|
|
2830
|
-
|
|
2831
|
-
// ../renderers/src/ReviewRenderer.tsx
|
|
2832
|
-
import { Fragment as Fragment7, jsx as jsx52, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2833
|
-
var ReviewRenderer = {
|
|
2834
|
-
canRenderType: "review",
|
|
2835
|
-
render: ({ callToAction, control, fields, margin, title, trackEvent }) => {
|
|
2836
|
-
const orientation = mapControlToDefinitionListLayout(control);
|
|
2837
|
-
return /* @__PURE__ */ jsxs17("div", { className: getMargin(margin), children: [
|
|
2838
|
-
(title || callToAction) && /* @__PURE__ */ jsx52(Header6, { title: title != null ? title : "", action: getHeaderAction(callToAction) }),
|
|
2839
|
-
/* @__PURE__ */ jsx52("div", { className: margin, children: /* @__PURE__ */ jsx52(
|
|
2840
|
-
DefinitionList,
|
|
2841
|
-
{
|
|
2842
|
-
layout: orientation,
|
|
2843
|
-
definitions: fields.map(
|
|
2844
|
-
({ label, value, help, analyticsId: fieldAnalyticsId }, index) => ({
|
|
2845
|
-
key: String(index),
|
|
2846
|
-
title: label,
|
|
2847
|
-
value: getFieldValue(
|
|
2848
|
-
value,
|
|
2849
|
-
help,
|
|
2850
|
-
orientation,
|
|
2851
|
-
() => trackEvent("Help Pressed", { layoutItemId: fieldAnalyticsId })
|
|
2852
|
-
)
|
|
2853
|
-
})
|
|
2854
|
-
)
|
|
2855
|
-
}
|
|
2856
|
-
) })
|
|
2857
|
-
] });
|
|
2858
|
-
}
|
|
2859
|
-
};
|
|
2860
|
-
var ReviewRenderer_default = ReviewRenderer;
|
|
2861
|
-
var mapControlToDefinitionListLayout = (control) => {
|
|
2862
|
-
switch (control) {
|
|
2863
|
-
case "horizontal":
|
|
2864
|
-
case "horizontal-end-aligned":
|
|
2865
|
-
return "HORIZONTAL_RIGHT_ALIGNED";
|
|
2866
|
-
case "horizontal-start-aligned":
|
|
2867
|
-
return "HORIZONTAL_LEFT_ALIGNED";
|
|
2868
|
-
case "vertical-two-column":
|
|
2869
|
-
return "VERTICAL_TWO_COLUMN";
|
|
2870
|
-
case "vertical":
|
|
2871
|
-
case "vertical-one-column":
|
|
2872
|
-
default:
|
|
2873
|
-
return "VERTICAL_ONE_COLUMN";
|
|
2874
|
-
}
|
|
2875
|
-
};
|
|
2876
|
-
var getFieldValue = (value, help, orientation, onClick) => {
|
|
2877
|
-
if (help) {
|
|
2878
|
-
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ jsxs17(Fragment7, { children: [
|
|
2879
|
-
/* @__PURE__ */ jsx52(Help_default, { help, onClick }),
|
|
2880
|
-
" ",
|
|
2881
|
-
value
|
|
2882
|
-
] }) : /* @__PURE__ */ jsxs17(Fragment7, { children: [
|
|
2883
|
-
value,
|
|
2884
|
-
" ",
|
|
2885
|
-
/* @__PURE__ */ jsx52(Help_default, { help, onClick })
|
|
2886
|
-
] });
|
|
2887
|
-
}
|
|
2888
|
-
return value;
|
|
2889
|
-
};
|
|
2890
|
-
|
|
2891
|
-
// ../renderers/src/step/StepRenderer.tsx
|
|
2892
|
-
import { Alert as Alert2, Title as Title2 } from "@transferwise/components";
|
|
2893
|
-
|
|
2894
|
-
// ../renderers/src/step/BackButton.tsx
|
|
2895
|
-
import { AvatarView as AvatarView4 } from "@transferwise/components";
|
|
2896
|
-
import { ArrowLeft } from "@transferwise/icons";
|
|
2897
|
-
import { jsx as jsx53, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2898
|
-
function BackButton({ title, onClick }) {
|
|
2899
|
-
return /* @__PURE__ */ jsx53("div", { className: "m-b-2", children: /* @__PURE__ */ jsxs18(
|
|
2900
|
-
"button",
|
|
2901
|
-
{
|
|
2902
|
-
type: "button",
|
|
2903
|
-
className: "df-back-btn",
|
|
2904
|
-
title,
|
|
2905
|
-
"aria-label": title,
|
|
2906
|
-
onClick,
|
|
2907
|
-
children: [
|
|
2908
|
-
/* @__PURE__ */ jsx53("span", { className: "sr-only", children: title }),
|
|
2909
|
-
/* @__PURE__ */ jsx53(AvatarView4, { interactive: true, children: /* @__PURE__ */ jsx53(ArrowLeft, { size: "24" }) })
|
|
2910
|
-
]
|
|
2911
|
-
}
|
|
2912
|
-
) });
|
|
2913
|
-
}
|
|
2914
|
-
var BackButton_default = BackButton;
|
|
2915
|
-
|
|
2916
|
-
// ../renderers/src/step/StepRenderer.tsx
|
|
2917
|
-
import { Fragment as Fragment8, jsx as jsx54, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
2918
|
-
var StepRenderer = {
|
|
2919
|
-
canRenderType: "step",
|
|
2920
|
-
render: StepRendererComponent
|
|
2921
|
-
};
|
|
2922
|
-
function StepRendererComponent(props) {
|
|
2923
|
-
const { back, description, error, title, children } = props;
|
|
2924
|
-
return /* @__PURE__ */ jsxs19(Fragment8, { children: [
|
|
2925
|
-
back ? /* @__PURE__ */ jsx54(BackButton_default, __spreadValues({}, back)) : null,
|
|
2926
|
-
title || description ? /* @__PURE__ */ jsxs19("div", { className: "m-b-4", children: [
|
|
2927
|
-
title ? /* @__PURE__ */ jsx54(Title2, { as: "h1", type: "title-section", className: "text-xs-center m-b-2", children: title }) : void 0,
|
|
2928
|
-
description ? /* @__PURE__ */ jsx54("p", { className: "text-xs-center np-text-body-large", children: description }) : void 0
|
|
2929
|
-
] }) : void 0,
|
|
2930
|
-
error ? /* @__PURE__ */ jsx54(Alert2, { type: "negative", className: "m-b-2", message: error }) : void 0,
|
|
2931
|
-
children
|
|
2932
|
-
] });
|
|
2933
|
-
}
|
|
2934
|
-
|
|
2935
|
-
// ../renderers/src/ListRenderer.tsx
|
|
2936
|
-
import { Body, Header as Header7 } from "@transferwise/components";
|
|
2937
|
-
import classNames6 from "classnames";
|
|
2938
|
-
import { jsx as jsx55, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2939
|
-
var ListRenderer = {
|
|
2940
|
-
canRenderType: "list",
|
|
2941
|
-
render: ({ callToAction, control, margin, items, title }) => /* @__PURE__ */ jsxs20("div", { className: getMargin(margin), children: [
|
|
2942
|
-
(title || callToAction) && /* @__PURE__ */ jsx55(Header7, { as: "h2", title: title != null ? title : "", action: getListAction(callToAction) }),
|
|
2943
|
-
items.map((props) => /* @__PURE__ */ jsx55(DesignSystemListItem, __spreadProps(__spreadValues({}, props), { control }), props.title))
|
|
2944
|
-
] })
|
|
2945
|
-
};
|
|
2946
|
-
var DesignSystemListItem = ({
|
|
2947
|
-
title,
|
|
2948
|
-
description,
|
|
2949
|
-
supportingValues,
|
|
2950
|
-
icon,
|
|
2951
|
-
image,
|
|
2952
|
-
control,
|
|
2953
|
-
tag
|
|
2954
|
-
}) => /* @__PURE__ */ jsx55(
|
|
2955
|
-
"label",
|
|
2956
|
-
{
|
|
2957
|
-
className: classNames6("np-option p-a-2", {
|
|
2958
|
-
"np-option__sm-media": true,
|
|
2959
|
-
"np-option__container-aligned": true
|
|
2960
|
-
}),
|
|
2961
|
-
children: /* @__PURE__ */ jsxs20("div", { className: "media", children: [
|
|
2962
|
-
icon || image ? /* @__PURE__ */ jsx55("div", { className: "media-left", children: /* @__PURE__ */ jsx55(
|
|
2963
|
-
ListItemMedia,
|
|
2964
|
-
{
|
|
2965
|
-
image,
|
|
2966
|
-
icon,
|
|
2967
|
-
preferAvatar: control === "with-avatar" || tag === "with-avatar"
|
|
2968
|
-
}
|
|
2969
|
-
) }) : null,
|
|
2970
|
-
/* @__PURE__ */ jsxs20("div", { className: "media-body", children: [
|
|
2971
|
-
/* @__PURE__ */ jsxs20("div", { className: "d-flex justify-content-between", children: [
|
|
2972
|
-
/* @__PURE__ */ jsx55("h4", { className: "np-text-body-large-bold text-primary np-option__title", children: title }),
|
|
2973
|
-
/* @__PURE__ */ jsx55("h4", { className: "np-text-body-large-bold text-primary np-option__title", children: supportingValues == null ? void 0 : supportingValues.value })
|
|
2974
|
-
] }),
|
|
2975
|
-
/* @__PURE__ */ jsxs20("div", { className: "d-flex justify-content-between", children: [
|
|
2976
|
-
/* @__PURE__ */ jsx55(Body, { className: "d-block np-option__body", children: description }),
|
|
2977
|
-
/* @__PURE__ */ jsx55(Body, { className: "d-block np-option__body", children: supportingValues == null ? void 0 : supportingValues.subvalue })
|
|
2978
|
-
] })
|
|
2979
|
-
] })
|
|
2980
|
-
] })
|
|
2981
|
-
},
|
|
2982
|
-
title
|
|
2983
|
-
);
|
|
2984
|
-
var ListItemMedia = ({
|
|
2985
|
-
icon,
|
|
2986
|
-
image,
|
|
2987
|
-
preferAvatar
|
|
2988
|
-
}) => {
|
|
2989
|
-
if (icon) {
|
|
2990
|
-
return /* @__PURE__ */ jsx55("div", { className: "circle circle-sm text-primary circle-inverse", children: /* @__PURE__ */ jsx55(OptionMedia, { icon, image, preferAvatar }) });
|
|
2991
|
-
}
|
|
2992
|
-
if (image) {
|
|
2993
|
-
return /* @__PURE__ */ jsx55("div", { className: "np-option__no-media-circle", children: /* @__PURE__ */ jsx55(OptionMedia, { icon, image, preferAvatar }) });
|
|
2994
|
-
}
|
|
2995
|
-
};
|
|
2996
|
-
var getListAction = (callToAction) => {
|
|
2997
|
-
if (callToAction) {
|
|
2998
|
-
return __spreadValues({
|
|
2999
|
-
"aria-label": callToAction.accessibilityDescription,
|
|
3000
|
-
text: callToAction.title,
|
|
3001
|
-
onClick: callToAction.onClick
|
|
3002
|
-
}, callToAction.type === "link" ? { href: callToAction.href, target: "_blank" } : {});
|
|
3003
|
-
}
|
|
3004
|
-
return void 0;
|
|
3005
|
-
};
|
|
3006
|
-
var ListRenderer_default = ListRenderer;
|
|
3007
|
-
|
|
3008
|
-
// ../renderers/src/step/SplashStepRenderer.tsx
|
|
3009
|
-
import { jsx as jsx56, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
3010
|
-
var SplashStepRenderer = {
|
|
3011
|
-
canRenderType: "step",
|
|
3012
|
-
canRender: ({ control }) => control === "splash",
|
|
3013
|
-
render: SplashStepRendererComponent
|
|
3014
|
-
};
|
|
3015
|
-
function SplashStepRendererComponent(props) {
|
|
3016
|
-
const { back, children } = props;
|
|
3017
|
-
return /* @__PURE__ */ jsxs21("div", { className: "splash-screen m-t-5", children: [
|
|
3018
|
-
back ? /* @__PURE__ */ jsx56(BackButton_default, __spreadValues({}, back)) : null,
|
|
3019
|
-
children
|
|
3020
|
-
] });
|
|
3021
|
-
}
|
|
3022
|
-
|
|
3023
|
-
// ../renderers/src/utils/useCustomTheme.ts
|
|
3024
|
-
import { useTheme } from "@wise/components-theming";
|
|
3025
|
-
import { useEffect as useEffect4, useMemo } from "react";
|
|
3026
|
-
var ThemeRequiredEventName = "Theme Required";
|
|
3027
|
-
var useCustomTheme = (theme, trackEvent) => {
|
|
3028
|
-
const previousThemeHookValue = useTheme();
|
|
3029
|
-
const previousTheme = useMemo(() => previousThemeHookValue.theme, []);
|
|
3030
|
-
useEffect4(() => {
|
|
3031
|
-
trackEvent(ThemeRequiredEventName, { theme });
|
|
3032
|
-
return theme !== previousTheme ? () => {
|
|
3033
|
-
trackEvent(ThemeRequiredEventName, { theme: previousTheme });
|
|
3034
|
-
} : () => {
|
|
3035
|
-
};
|
|
3036
|
-
}, []);
|
|
3037
|
-
};
|
|
3038
|
-
|
|
3039
|
-
// ../renderers/src/step/SplashCelebrationStepRenderer.tsx
|
|
3040
|
-
import { jsx as jsx57, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3041
|
-
var SplashCelebrationStepRenderer = {
|
|
3042
|
-
canRenderType: "step",
|
|
3043
|
-
canRender: ({ control }) => control === "splash-celebration",
|
|
3044
|
-
render: SplashCelebrationStepRendererComponent
|
|
3045
|
-
};
|
|
3046
|
-
function SplashCelebrationStepRendererComponent(props) {
|
|
3047
|
-
const { back, children, trackEvent } = props;
|
|
3048
|
-
useCustomTheme("forest-green", trackEvent);
|
|
3049
|
-
return /* @__PURE__ */ jsxs22("div", { className: "splash-screen m-t-5", children: [
|
|
3050
|
-
back ? /* @__PURE__ */ jsx57(BackButton_default, __spreadValues({}, back)) : null,
|
|
3051
|
-
children
|
|
3052
|
-
] });
|
|
3053
|
-
}
|
|
3054
|
-
|
|
3055
|
-
// ../renderers/src/ExternalConfirmationRenderer.tsx
|
|
3056
|
-
import { Button as Button6, Markdown as Markdown5, Modal as Modal3 } from "@transferwise/components";
|
|
3057
|
-
|
|
3058
|
-
// ../renderers/src/messages/external-confirmation.messages.ts
|
|
3059
|
-
import { defineMessages as defineMessages7 } from "react-intl";
|
|
3060
|
-
var external_confirmation_messages_default = defineMessages7({
|
|
3061
|
-
title: {
|
|
3062
|
-
id: "df.wise.ExternalConfirmation.title",
|
|
3063
|
-
defaultMessage: "Please confirm",
|
|
3064
|
-
description: "Heading for the confirmation screen."
|
|
3065
|
-
},
|
|
3066
|
-
description: {
|
|
3067
|
-
id: "df.wise.ExternalConfirmation.description",
|
|
3068
|
-
defaultMessage: "Please confirm you want to open **{origin}** in a new browser tab.",
|
|
3069
|
-
description: "Description for the confirmation screen."
|
|
3070
|
-
},
|
|
3071
|
-
open: {
|
|
3072
|
-
id: "df.wise.ExternalConfirmation.open",
|
|
3073
|
-
defaultMessage: "Open in new tab",
|
|
3074
|
-
description: "Button text confirming opening a new browser tab."
|
|
3075
|
-
},
|
|
3076
|
-
cancel: {
|
|
3077
|
-
id: "df.wise.ExternalConfirmation.cancel",
|
|
3078
|
-
defaultMessage: "Cancel",
|
|
3079
|
-
description: "Button text rejecting opening a new browser tab."
|
|
3080
|
-
}
|
|
3081
|
-
});
|
|
3082
|
-
|
|
3083
|
-
// ../renderers/src/ExternalConfirmationRenderer.tsx
|
|
3084
|
-
import { useIntl as useIntl8 } from "react-intl";
|
|
3085
|
-
import { useEffect as useEffect5 } from "react";
|
|
3086
|
-
import { Fragment as Fragment9, jsx as jsx58, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3087
|
-
var ExternalConfirmationRenderer = {
|
|
3088
|
-
canRenderType: "external-confirmation",
|
|
3089
|
-
render: ExternalConfirmationRendererComponent
|
|
3090
|
-
};
|
|
3091
|
-
function ExternalConfirmationRendererComponent({
|
|
3092
|
-
url,
|
|
3093
|
-
status,
|
|
3094
|
-
onSuccess,
|
|
3095
|
-
onFailure,
|
|
3096
|
-
onCancel
|
|
3097
|
-
}) {
|
|
3098
|
-
const { formatMessage } = useIntl8();
|
|
3099
|
-
useEffect5(() => {
|
|
3100
|
-
if (url) {
|
|
3101
|
-
const w = window.open(url, "_blank");
|
|
3102
|
-
if (w) {
|
|
3103
|
-
onSuccess();
|
|
3104
|
-
} else {
|
|
3105
|
-
onFailure();
|
|
3106
|
-
}
|
|
3107
|
-
}
|
|
3108
|
-
}, []);
|
|
3109
|
-
return /* @__PURE__ */ jsx58(
|
|
3110
|
-
Modal3,
|
|
3111
|
-
{
|
|
3112
|
-
open: status === "failure",
|
|
3113
|
-
title: formatMessage(external_confirmation_messages_default.title),
|
|
3114
|
-
body: /* @__PURE__ */ jsxs23(Fragment9, { children: [
|
|
3115
|
-
/* @__PURE__ */ jsx58(Markdown5, { config: { link: { target: "_blank" } }, className: "text-xs-center m-b-5", children: formatMessage(external_confirmation_messages_default.description, { origin: getOrigin(url) }) }),
|
|
3116
|
-
/* @__PURE__ */ jsx58("div", { className: "df-box-renderer-fixed-width", children: /* @__PURE__ */ jsxs23("div", { className: "df-box-renderer-width-lg", children: [
|
|
3117
|
-
/* @__PURE__ */ jsx58(
|
|
3118
|
-
Button6,
|
|
3119
|
-
{
|
|
3120
|
-
block: true,
|
|
3121
|
-
className: "m-b-2",
|
|
3122
|
-
priority: "primary",
|
|
3123
|
-
size: "md",
|
|
3124
|
-
onClick: () => {
|
|
3125
|
-
window.open(url);
|
|
3126
|
-
onCancel();
|
|
3127
|
-
},
|
|
3128
|
-
children: formatMessage(external_confirmation_messages_default.open)
|
|
3129
|
-
}
|
|
3130
|
-
),
|
|
3131
|
-
/* @__PURE__ */ jsx58(Button6, { block: true, className: "m-b-2", priority: "tertiary", size: "md", onClick: onCancel, children: formatMessage(external_confirmation_messages_default.cancel) })
|
|
3132
|
-
] }) })
|
|
3133
|
-
] }),
|
|
3134
|
-
onClose: onCancel
|
|
3135
|
-
}
|
|
3136
|
-
);
|
|
3137
|
-
}
|
|
3138
|
-
function getOrigin(url) {
|
|
3139
|
-
try {
|
|
3140
|
-
return new URL(url).origin;
|
|
3141
|
-
} catch (e) {
|
|
3142
|
-
return url;
|
|
3143
|
-
}
|
|
3144
|
-
}
|
|
3145
|
-
var ExternalConfirmationRenderer_default = ExternalConfirmationRenderer;
|
|
3146
|
-
|
|
3147
|
-
// ../renderers/src/SectionRenderer.tsx
|
|
3148
|
-
import { Header as Header8 } from "@transferwise/components";
|
|
3149
|
-
import { jsx as jsx59, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3150
|
-
var SectionRenderer = {
|
|
3151
|
-
canRenderType: "section",
|
|
3152
|
-
render: ({ children, callToAction, margin, title }) => {
|
|
3153
|
-
return /* @__PURE__ */ jsxs24("section", { className: getMargin(margin), children: [
|
|
3154
|
-
(title || callToAction) && /* @__PURE__ */ jsx59(Header8, { title: title != null ? title : "", action: getHeaderAction(callToAction) }),
|
|
3155
|
-
children
|
|
3156
|
-
] });
|
|
3157
|
-
}
|
|
3158
|
-
};
|
|
3159
|
-
var SectionRenderer_default = SectionRenderer;
|
|
3160
|
-
|
|
3161
|
-
// ../renderers/src/TabsRenderer.tsx
|
|
3162
|
-
import { Chips, SegmentedControl as SegmentedControl2, Tabs as Tabs2 } from "@transferwise/components";
|
|
3163
|
-
import { useState as useState8 } from "react";
|
|
3164
|
-
import { jsx as jsx60, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3165
|
-
var TabsRenderer = {
|
|
3166
|
-
canRenderType: "tabs",
|
|
3167
|
-
render: (props) => {
|
|
3168
|
-
switch (props.control) {
|
|
3169
|
-
case "segmented":
|
|
3170
|
-
if (props.tabs.length > 3) {
|
|
3171
|
-
return /* @__PURE__ */ jsx60(TabsRendererComponent, __spreadValues({}, props));
|
|
3172
|
-
}
|
|
3173
|
-
return /* @__PURE__ */ jsx60(SegmentedTabsRendererComponent, __spreadValues({}, props));
|
|
3174
|
-
case "chips":
|
|
3175
|
-
return /* @__PURE__ */ jsx60(ChipsTabsRendererComponent, __spreadValues({}, props));
|
|
3176
|
-
default:
|
|
3177
|
-
return /* @__PURE__ */ jsx60(TabsRendererComponent, __spreadValues({}, props));
|
|
3178
|
-
}
|
|
3179
|
-
}
|
|
3180
|
-
};
|
|
3181
|
-
function TabsRendererComponent({ uid, margin, tabs }) {
|
|
3182
|
-
const [selectedIndex, setSelectedIndex] = useState8(0);
|
|
3183
|
-
return /* @__PURE__ */ jsx60("div", { className: getMargin(margin), children: /* @__PURE__ */ jsx60(
|
|
3184
|
-
Tabs2,
|
|
3185
|
-
{
|
|
3186
|
-
name: uid,
|
|
3187
|
-
selected: selectedIndex != null ? selectedIndex : 0,
|
|
3188
|
-
tabs: tabs.map((option) => ({
|
|
3189
|
-
title: option.title,
|
|
3190
|
-
disabled: false,
|
|
3191
|
-
content: /* @__PURE__ */ jsxs25("div", { className: "m-t-2", children: [
|
|
3192
|
-
" ",
|
|
3193
|
-
option.children,
|
|
3194
|
-
" "
|
|
3195
|
-
] })
|
|
3196
|
-
})),
|
|
3197
|
-
onTabSelect: setSelectedIndex
|
|
3198
|
-
}
|
|
3199
|
-
) });
|
|
3200
|
-
}
|
|
3201
|
-
function SegmentedTabsRendererComponent({ uid, margin, tabs }) {
|
|
3202
|
-
var _a;
|
|
3203
|
-
const [selectedIndex, setSelectedIndex] = useState8(0);
|
|
3204
|
-
return /* @__PURE__ */ jsxs25("div", { className: getMargin(margin), children: [
|
|
3205
|
-
/* @__PURE__ */ jsx60(
|
|
3206
|
-
SegmentedControl2,
|
|
3207
|
-
{
|
|
3208
|
-
name: uid,
|
|
3209
|
-
value: String(selectedIndex),
|
|
3210
|
-
mode: "view",
|
|
3211
|
-
segments: tabs.map((tab, index) => ({
|
|
3212
|
-
id: String(index),
|
|
3213
|
-
value: String(index),
|
|
3214
|
-
label: tab.title,
|
|
3215
|
-
controls: `${uid}-children`
|
|
3216
|
-
})),
|
|
3217
|
-
onChange: (value) => setSelectedIndex(Number(value))
|
|
3218
|
-
}
|
|
3219
|
-
),
|
|
3220
|
-
/* @__PURE__ */ jsx60("div", { id: `${uid}-children`, className: "m-t-2", children: (_a = tabs[selectedIndex]) == null ? void 0 : _a.children })
|
|
3221
|
-
] });
|
|
3222
|
-
}
|
|
3223
|
-
function ChipsTabsRendererComponent({ margin, tabs }) {
|
|
3224
|
-
var _a;
|
|
3225
|
-
const [selectedIndex, setSelectedIndex] = useState8(0);
|
|
3226
|
-
return /* @__PURE__ */ jsxs25("div", { className: getMargin(margin), children: [
|
|
3227
|
-
/* @__PURE__ */ jsx60("div", { className: "chips-container", children: /* @__PURE__ */ jsx60(
|
|
3228
|
-
Chips,
|
|
3229
|
-
{
|
|
3230
|
-
chips: tabs.map((tab, index) => ({ label: tab.title, value: index })),
|
|
3231
|
-
selected: selectedIndex,
|
|
3232
|
-
onChange: ({ selectedValue }) => setSelectedIndex(Number(selectedValue))
|
|
3233
|
-
}
|
|
3234
|
-
) }),
|
|
3235
|
-
/* @__PURE__ */ jsx60("div", { className: "m-t-2", children: (_a = tabs[selectedIndex]) == null ? void 0 : _a.children })
|
|
3236
|
-
] });
|
|
3237
|
-
}
|
|
3238
|
-
|
|
3239
3237
|
// ../renderers/src/getWiseRenderers.ts
|
|
3240
3238
|
var getWiseRenderers = () => [
|
|
3241
3239
|
AlertRenderer_default,
|
|
@@ -3257,7 +3255,7 @@ var getWiseRenderers = () => [
|
|
|
3257
3255
|
ListRenderer_default,
|
|
3258
3256
|
LoadingIndicatorRenderer_default,
|
|
3259
3257
|
MarkdownRenderer_default,
|
|
3260
|
-
|
|
3258
|
+
ModalLayoutRenderer_default,
|
|
3261
3259
|
MultiSelectInputRenderer_default,
|
|
3262
3260
|
MultiUploadInputRenderer_default,
|
|
3263
3261
|
NumberInputRenderer_default,
|
|
@@ -3280,7 +3278,7 @@ var getWiseRenderers = () => [
|
|
|
3280
3278
|
import { Modal as Modal4 } from "@transferwise/components";
|
|
3281
3279
|
import { jsx as jsx61 } from "react/jsx-runtime";
|
|
3282
3280
|
var ModalContentRenderer = {
|
|
3283
|
-
canRenderType: "modal
|
|
3281
|
+
canRenderType: "modal",
|
|
3284
3282
|
render: ({ title, children, open, onClose }) => {
|
|
3285
3283
|
return /* @__PURE__ */ jsx61(Modal4, { open, title, body: children, onClose });
|
|
3286
3284
|
}
|