@ory/elements-react 1.0.0-next.10 → 1.0.0-next.11

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.
@@ -291,9 +291,9 @@ function useCardHeaderText(nodes, opts) {
291
291
  // src/theme/default/components/card/header.tsx
292
292
  import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
293
293
  function InnerCardHeader({ title, text }) {
294
- const { CardLogo } = useComponents();
294
+ const { Card } = useComponents();
295
295
  return /* @__PURE__ */ jsxs5("header", { className: "flex flex-col gap-8 antialiased", children: [
296
- /* @__PURE__ */ jsx5(CardLogo, {}),
296
+ /* @__PURE__ */ jsx5(Card.Logo, {}),
297
297
  /* @__PURE__ */ jsxs5("div", { children: [
298
298
  /* @__PURE__ */ jsx5("h2", { className: "font-semibold text-lg text-dialog-fg-default leading-normal", children: title }),
299
299
  /* @__PURE__ */ jsx5("p", { className: "text-sm leading-normal text-dialog-fg-subtle", children: text })
@@ -343,8 +343,8 @@ function cn(...inputs) {
343
343
  }
344
344
 
345
345
  // src/theme/default/components/form/index.tsx
346
- import { formatMessage } from "@ory/elements-react";
347
346
  import { useIntl as useIntl3 } from "react-intl";
347
+ import { uiTextToFormattedMessage } from "@ory/elements-react";
348
348
  import { jsx as jsx8 } from "react/jsx-runtime";
349
349
  function DefaultFormContainer({
350
350
  children,
@@ -380,11 +380,14 @@ function DefaultMessage({ message }) {
380
380
  "text-forms-fg-default": message.type === "info",
381
381
  "text-forms-fg-success": message.type === "success"
382
382
  }),
383
- children: formatMessage(message, intl)
383
+ children: uiTextToFormattedMessage(message, intl)
384
384
  }
385
385
  );
386
386
  }
387
387
 
388
+ // src/theme/default/components/card/auth-methods.tsx
389
+ import { useIntl as useIntl4 } from "react-intl";
390
+
388
391
  // src/theme/default/assets/icons/code.svg
389
392
  import * as React3 from "react";
390
393
  import { jsx as jsx9 } from "react/jsx-runtime";
@@ -422,7 +425,6 @@ var SvgWebauthn = (props) => {
422
425
  var webauthn_default = SvgWebauthn;
423
426
 
424
427
  // src/theme/default/components/card/auth-methods.tsx
425
- import { useIntl as useIntl4 } from "react-intl";
426
428
  import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
427
429
  var iconsMap = {
428
430
  code: code_default,
@@ -453,6 +455,10 @@ function DefaultAuthMethodListItem({
453
455
  }
454
456
 
455
457
  // src/theme/default/components/form/button.tsx
458
+ import { getNodeLabel } from "@ory/client-fetch";
459
+ import {
460
+ uiTextToFormattedMessage as uiTextToFormattedMessage2
461
+ } from "@ory/elements-react";
456
462
  import { useFormContext } from "react-hook-form";
457
463
  import { useIntl as useIntl5 } from "react-intl";
458
464
 
@@ -496,8 +502,6 @@ function Spinner({ className }) {
496
502
  }
497
503
 
498
504
  // src/theme/default/components/form/button.tsx
499
- import { formatMessage as formatMessage2 } from "@ory/elements-react";
500
- import { getNodeLabel } from "@ory/client-fetch";
501
505
  import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
502
506
  var DefaultButton = ({
503
507
  attributes,
@@ -562,7 +566,7 @@ var DefaultButton = ({
562
566
  "text-button-secondary-fg-default/20": isSubmitting && !isPrimary
563
567
  }
564
568
  ),
565
- children: formatMessage2(label, intl)
569
+ children: label ? uiTextToFormattedMessage2(label, intl) : ""
566
570
  }
567
571
  )
568
572
  ]
@@ -572,11 +576,14 @@ var DefaultButton = ({
572
576
  DefaultButton.displayName = "DefaultButton";
573
577
 
574
578
  // src/theme/default/components/form/checkbox.tsx
579
+ import { getNodeLabel as getNodeLabel2 } from "@ory/client-fetch";
580
+ import {
581
+ messageTestId,
582
+ uiTextToFormattedMessage as uiTextToFormattedMessage3
583
+ } from "@ory/elements-react";
575
584
  import { useState } from "react";
576
585
  import { useForm } from "react-hook-form";
577
586
  import { useIntl as useIntl6 } from "react-intl";
578
- import { formatMessage as formatMessage3, messageTestId } from "@ory/elements-react";
579
- import { getNodeLabel as getNodeLabel2 } from "@ory/client-fetch";
580
587
  import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
581
588
  function CheckboxSVG() {
582
589
  return /* @__PURE__ */ jsxs10(
@@ -653,13 +660,13 @@ var DefaultCheckbox = ({
653
660
  /* @__PURE__ */ jsx16(CheckboxSVG, {})
654
661
  ] }),
655
662
  /* @__PURE__ */ jsxs10("div", { className: "text-sm items-center", children: [
656
- /* @__PURE__ */ jsx16("label", { className: "text-sm font-normal leading-normal text-forms-fg-default", children: label && formatMessage3(label, intl) }),
663
+ /* @__PURE__ */ jsx16("label", { className: "text-sm font-normal leading-normal text-forms-fg-default", children: label && uiTextToFormattedMessage3(label, intl) }),
657
664
  node.messages.map((message) => /* @__PURE__ */ jsx16(
658
665
  "span",
659
666
  {
660
667
  className: "text-sm text-red-900 mt-1",
661
668
  ...messageTestId(message),
662
- children: formatMessage3(message, intl)
669
+ children: uiTextToFormattedMessage3(message, intl)
663
670
  },
664
671
  message.id
665
672
  ))
@@ -671,9 +678,7 @@ var DefaultCheckbox = ({
671
678
 
672
679
  // src/theme/default/components/form/group-container.tsx
673
680
  import { jsx as jsx17 } from "react/jsx-runtime";
674
- function DefaultGroupContainer({
675
- children
676
- }) {
681
+ function DefaultGroupContainer({ children }) {
677
682
  return /* @__PURE__ */ jsx17("div", { className: "grid grid-cols-1 gap-6", children });
678
683
  }
679
684
 
@@ -691,7 +696,9 @@ function DefaultImage({ attributes }) {
691
696
 
692
697
  // src/theme/default/components/form/input.tsx
693
698
  import { getNodeLabel as getNodeLabel3 } from "@ory/client-fetch";
694
- import { formatMessage as formatMessage4 } from "@ory/elements-react";
699
+ import {
700
+ uiTextToFormattedMessage as uiTextToFormattedMessage4
701
+ } from "@ory/elements-react";
695
702
  import { useFormContext as useFormContext2 } from "react-hook-form";
696
703
  import { useIntl as useIntl7 } from "react-intl";
697
704
  import { jsx as jsx20 } from "react/jsx-runtime";
@@ -710,7 +717,7 @@ var DefaultInput = ({
710
717
  defaultMessage: "Enter your {placeholder}"
711
718
  },
712
719
  {
713
- placeholder: formatMessage4(label, intl)
720
+ placeholder: uiTextToFormattedMessage4(label, intl)
714
721
  }
715
722
  ) : "";
716
723
  return /* @__PURE__ */ jsx20(
@@ -729,9 +736,12 @@ var DefaultInput = ({
729
736
 
730
737
  // src/theme/default/components/form/label.tsx
731
738
  import { FlowType as FlowType3, getNodeLabel as getNodeLabel4 } from "@ory/client-fetch";
739
+ import {
740
+ messageTestId as messageTestId2,
741
+ uiTextToFormattedMessage as uiTextToFormattedMessage5,
742
+ useOryFlow as useOryFlow4
743
+ } from "@ory/elements-react";
732
744
  import { useIntl as useIntl8 } from "react-intl";
733
- import { useOryFlow as useOryFlow4 } from "@ory/elements-react";
734
- import { formatMessage as formatMessage5, messageTestId as messageTestId2 } from "@ory/elements-react";
735
745
  import { jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
736
746
  function DefaultLabel({
737
747
  node,
@@ -753,7 +763,7 @@ function DefaultLabel({
753
763
  className: "text-sm font-medium leading-normal",
754
764
  htmlFor: attributes.name,
755
765
  ...rest,
756
- children: formatMessage5(label, intl)
766
+ children: uiTextToFormattedMessage5(label, intl)
757
767
  }
758
768
  ),
759
769
  isPassword && config.project.recovery_enabled && flowType === FlowType3.Login && // TODO: make it possible to override with a custom component
@@ -787,7 +797,7 @@ function DefaultLabel({
787
797
  "text-forms-fg-success": message.type === "success"
788
798
  }),
789
799
  ...messageTestId2(message),
790
- children: formatMessage5(message, intl)
800
+ children: uiTextToFormattedMessage5(message, intl)
791
801
  },
792
802
  message.id
793
803
  ))
@@ -795,10 +805,12 @@ function DefaultLabel({
795
805
  }
796
806
 
797
807
  // src/theme/default/components/form/link-button.tsx
808
+ import { getNodeLabel as getNodeLabel5 } from "@ory/client-fetch";
809
+ import {
810
+ uiTextToFormattedMessage as uiTextToFormattedMessage6
811
+ } from "@ory/elements-react";
798
812
  import { forwardRef } from "react";
799
813
  import { useIntl as useIntl9 } from "react-intl";
800
- import { formatMessage as formatMessage6 } from "@ory/elements-react";
801
- import { getNodeLabel as getNodeLabel5 } from "@ory/client-fetch";
802
814
  import { jsx as jsx22 } from "react/jsx-runtime";
803
815
  var DefaultLinkButton = forwardRef(({ attributes, node }, ref) => {
804
816
  const intl = useIntl9();
@@ -808,11 +820,11 @@ var DefaultLinkButton = forwardRef(({ attributes, node }, ref) => {
808
820
  {
809
821
  ...attributes,
810
822
  ref,
811
- title: formatMessage6(label, intl),
823
+ title: label ? uiTextToFormattedMessage6(label, intl) : "",
812
824
  className: cn(
813
825
  "antialiased rounded cursor-pointer text-center border border-transparent gap-3 leading-none bg-button-primary-bg-default hover:bg-button-primary-bg-hover transition-colors text-button-primary-fg-default hover:text-button-primary-fg-hover px-4 py-4.5 text-sm font-medium"
814
826
  ),
815
- children: formatMessage6(label, intl)
827
+ children: label ? uiTextToFormattedMessage6(label, intl) : ""
816
828
  }
817
829
  );
818
830
  });
@@ -899,7 +911,7 @@ var DefaultPinCodeInput = ({ attributes }) => {
899
911
 
900
912
  // src/theme/default/components/form/social.tsx
901
913
  import {
902
- formatMessage as formatMessage7,
914
+ uiTextToFormattedMessage as uiTextToFormattedMessage7,
903
915
  useOryFlow as useOryFlow5
904
916
  } from "@ory/elements-react";
905
917
 
@@ -1132,7 +1144,7 @@ function DefaultButtonSocial({
1132
1144
  className: "object-fill w-full h-full"
1133
1145
  }
1134
1146
  ) : /* @__PURE__ */ jsx38("span", { className: "rounded-full aspect-square border flex items-center justify-center text-xs", children: provider.slice(0, 2) }) }),
1135
- showLabel ? /* @__PURE__ */ jsx38("span", { className: "text-sm text-left leading-none font-medium text-forms-fg-default flex-grow", children: formatMessage7(node.meta.label, intl) }) : null
1147
+ showLabel && node.meta.label ? /* @__PURE__ */ jsx38("span", { className: "text-sm text-left leading-none font-medium text-forms-fg-default flex-grow", children: uiTextToFormattedMessage7(node.meta.label, intl) }) : null
1136
1148
  ]
1137
1149
  }
1138
1150
  );
@@ -1156,15 +1168,15 @@ function DefaultSocialButtonContainer({
1156
1168
  }
1157
1169
 
1158
1170
  // src/theme/default/components/form/text.tsx
1171
+ import { uiTextToFormattedMessage as uiTextToFormattedMessage8 } from "@ory/elements-react";
1159
1172
  import { useIntl as useIntl11 } from "react-intl";
1160
- import { formatMessage as formatMessage8 } from "@ory/elements-react";
1161
1173
  import { Fragment, jsx as jsx39, jsxs as jsxs25 } from "react/jsx-runtime";
1162
1174
  function DefaultText({ node, attributes }) {
1163
1175
  var _a;
1164
1176
  const intl = useIntl11();
1165
1177
  return /* @__PURE__ */ jsxs25(Fragment, { children: [
1166
- /* @__PURE__ */ jsx39("p", { "data-testid": `node/text/${attributes.id}/label`, children: formatMessage8(node.meta.label, intl) }),
1167
- (_a = attributes.text.context.secrets) == null ? void 0 : _a.map((text, index) => /* @__PURE__ */ jsx39("pre", { "data-testid": `node/text/lookup_secret_codes/text`, children: /* @__PURE__ */ jsx39("code", { children: formatMessage8(text, intl) }) }, index))
1178
+ /* @__PURE__ */ jsx39("p", { "data-testid": `node/text/${attributes.id}/label`, children: node.meta.label ? uiTextToFormattedMessage8(node.meta.label, intl) : "" }),
1179
+ (_a = attributes.text.context.secrets) == null ? void 0 : _a.map((text, index) => /* @__PURE__ */ jsx39("pre", { "data-testid": `node/text/lookup_secret_codes/text`, children: /* @__PURE__ */ jsx39("code", { children: text ? uiTextToFormattedMessage8(text, intl) : "" }) }, index))
1168
1180
  ] });
1169
1181
  }
1170
1182
 
@@ -1204,30 +1216,36 @@ function DefaultCurrentIdentifierButton({
1204
1216
 
1205
1217
  // src/theme/default/components/default-components.tsx
1206
1218
  var OryDefaultComponents = {
1207
- Card: DefaultCard,
1208
- CardHeader: DefaultCardHeader,
1209
- CardContent: DefaultCardContent,
1210
- CardFooter: DefaultCardFooter,
1211
- CardLogo: DefaultCardLogo,
1212
- // Generic
1213
- HorizontalDivider: DefaultHorizontalDivider,
1214
- // Form
1215
- FormGroup: DefaultGroupContainer,
1216
- SocialButtonContainer: DefaultSocialButtonContainer,
1217
- MessageContainer: DefaultMessageContainer,
1218
- Message: DefaultMessage,
1219
- Input: DefaultInput,
1220
- Image: DefaultImage,
1221
- Label: DefaultLabel,
1222
- Checkbox: DefaultCheckbox,
1223
- Text: DefaultText,
1224
- PinCodeInput: DefaultPinCodeInput,
1225
- Button: DefaultButton,
1226
- LinkButton: DefaultLinkButton,
1227
- SocialButton: DefaultButtonSocial,
1228
- FormContainer: DefaultFormContainer,
1229
- AuthMethodListItem: DefaultAuthMethodListItem,
1230
- CurrentIdentifierButton: DefaultCurrentIdentifierButton
1219
+ Card: {
1220
+ Root: DefaultCard,
1221
+ Footer: DefaultCardFooter,
1222
+ Header: DefaultCardHeader,
1223
+ Content: DefaultCardContent,
1224
+ Logo: DefaultCardLogo,
1225
+ Divider: DefaultHorizontalDivider,
1226
+ AuthMethodListItem: DefaultAuthMethodListItem
1227
+ },
1228
+ Node: {
1229
+ Button: DefaultButton,
1230
+ OidcButton: DefaultButtonSocial,
1231
+ CurrentIdentifierButton: DefaultCurrentIdentifierButton,
1232
+ Input: DefaultInput,
1233
+ CodeInput: DefaultPinCodeInput,
1234
+ Image: DefaultImage,
1235
+ Label: DefaultLabel,
1236
+ Checkbox: DefaultCheckbox,
1237
+ Text: DefaultText,
1238
+ Anchor: DefaultLinkButton
1239
+ },
1240
+ Form: {
1241
+ Root: DefaultFormContainer,
1242
+ Group: DefaultGroupContainer,
1243
+ OidcRoot: DefaultSocialButtonContainer
1244
+ },
1245
+ Message: {
1246
+ Root: DefaultMessageContainer,
1247
+ Content: DefaultMessage
1248
+ }
1231
1249
  };
1232
1250
 
1233
1251
  // src/theme/default/flows/error.tsx
@@ -1245,6 +1263,7 @@ import {
1245
1263
  OryProvider,
1246
1264
  OryTwoStepCard
1247
1265
  } from "@ory/elements-react";
1266
+ import merge from "lodash.merge";
1248
1267
  import { jsx as jsx43 } from "react/jsx-runtime";
1249
1268
  function Login({
1250
1269
  flow,
@@ -1252,10 +1271,7 @@ function Login({
1252
1271
  children,
1253
1272
  components: flowOverrideComponents
1254
1273
  }) {
1255
- const components = {
1256
- ...OryDefaultComponents,
1257
- ...flowOverrideComponents
1258
- };
1274
+ const components = flowOverrideComponents ? merge({}, OryDefaultComponents, flowOverrideComponents) : OryDefaultComponents;
1259
1275
  return /* @__PURE__ */ jsx43(
1260
1276
  OryProvider,
1261
1277
  {
@@ -1274,6 +1290,7 @@ import {
1274
1290
  OryProvider as OryProvider2,
1275
1291
  OryTwoStepCard as OryTwoStepCard2
1276
1292
  } from "@ory/elements-react";
1293
+ import merge2 from "lodash.merge";
1277
1294
  import { jsx as jsx44 } from "react/jsx-runtime";
1278
1295
  function Recovery({
1279
1296
  flow,
@@ -1281,10 +1298,7 @@ function Recovery({
1281
1298
  children,
1282
1299
  components: flowOverrideComponents
1283
1300
  }) {
1284
- const components = {
1285
- ...OryDefaultComponents,
1286
- ...flowOverrideComponents
1287
- };
1301
+ const components = flowOverrideComponents ? merge2({}, OryDefaultComponents, flowOverrideComponents) : OryDefaultComponents;
1288
1302
  return /* @__PURE__ */ jsx44(
1289
1303
  OryProvider2,
1290
1304
  {
@@ -1303,6 +1317,7 @@ import {
1303
1317
  OryProvider as OryProvider3,
1304
1318
  OryTwoStepCard as OryTwoStepCard3
1305
1319
  } from "@ory/elements-react";
1320
+ import merge3 from "lodash.merge";
1306
1321
  import { jsx as jsx45 } from "react/jsx-runtime";
1307
1322
  function Registration({
1308
1323
  flow,
@@ -1310,10 +1325,7 @@ function Registration({
1310
1325
  components: flowOverrideComponents,
1311
1326
  config
1312
1327
  }) {
1313
- const components = {
1314
- ...OryDefaultComponents,
1315
- ...flowOverrideComponents
1316
- };
1328
+ const components = flowOverrideComponents ? merge3({}, OryDefaultComponents, flowOverrideComponents) : OryDefaultComponents;
1317
1329
  return /* @__PURE__ */ jsx45(
1318
1330
  OryProvider3,
1319
1331
  {
@@ -1332,6 +1344,7 @@ import {
1332
1344
  OryProvider as OryProvider4,
1333
1345
  OryTwoStepCard as OryTwoStepCard4
1334
1346
  } from "@ory/elements-react";
1347
+ import merge4 from "lodash.merge";
1335
1348
  import { jsx as jsx46 } from "react/jsx-runtime";
1336
1349
  function Settings({
1337
1350
  flow,
@@ -1339,10 +1352,7 @@ function Settings({
1339
1352
  children,
1340
1353
  components: flowOverrideComponents
1341
1354
  }) {
1342
- const components = {
1343
- ...OryDefaultComponents,
1344
- ...flowOverrideComponents
1345
- };
1355
+ const components = flowOverrideComponents ? merge4({}, OryDefaultComponents, flowOverrideComponents) : OryDefaultComponents;
1346
1356
  return /* @__PURE__ */ jsx46(
1347
1357
  OryProvider4,
1348
1358
  {
@@ -1361,6 +1371,7 @@ import {
1361
1371
  OryProvider as OryProvider5,
1362
1372
  OryTwoStepCard as OryTwoStepCard5
1363
1373
  } from "@ory/elements-react";
1374
+ import merge5 from "lodash.merge";
1364
1375
  import { jsx as jsx47 } from "react/jsx-runtime";
1365
1376
  function Verification({
1366
1377
  flow,
@@ -1368,10 +1379,7 @@ function Verification({
1368
1379
  children,
1369
1380
  components: flowOverrideComponents
1370
1381
  }) {
1371
- const components = {
1372
- ...OryDefaultComponents,
1373
- ...flowOverrideComponents
1374
- };
1382
+ const components = flowOverrideComponents ? merge5({}, OryDefaultComponents, flowOverrideComponents) : OryDefaultComponents;
1375
1383
  return /* @__PURE__ */ jsx47(
1376
1384
  OryProvider5,
1377
1385
  {