@dodopayments/ui 1.0.3 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/ai/component-registry.json +65 -10
  2. package/ai/components/auth-card.md +69 -11
  3. package/ai/components/radio-group.md +65 -0
  4. package/ai/components/sidebar.md +1 -1
  5. package/ai/components/test-mode-banner.md +7 -3
  6. package/ai/components/toast.md +12 -1
  7. package/dist/components/auth-card/auth-card.d.ts +22 -7
  8. package/dist/components/auth-card/auth-card.d.ts.map +1 -1
  9. package/dist/components/auth-card/auth-card.js +22 -13
  10. package/dist/components/auth-card/auth-card.js.map +1 -1
  11. package/dist/components/radio-group/radio-group.d.ts +30 -2
  12. package/dist/components/radio-group/radio-group.d.ts.map +1 -1
  13. package/dist/components/radio-group/radio-group.js +6 -1
  14. package/dist/components/radio-group/radio-group.js.map +1 -1
  15. package/dist/components/sidebar/sidebar.d.ts +1 -1
  16. package/dist/components/sidebar/sidebar.d.ts.map +1 -1
  17. package/dist/components/sidebar/sidebar.js +4 -2
  18. package/dist/components/sidebar/sidebar.js.map +1 -1
  19. package/dist/components/test-mode-banner/test-mode-banner.d.ts +6 -2
  20. package/dist/components/test-mode-banner/test-mode-banner.d.ts.map +1 -1
  21. package/dist/components/test-mode-banner/test-mode-banner.js +7 -4
  22. package/dist/components/test-mode-banner/test-mode-banner.js.map +1 -1
  23. package/dist/components/toast/toast.d.ts +10 -0
  24. package/dist/components/toast/toast.d.ts.map +1 -1
  25. package/dist/components/toast/toast.js +7 -0
  26. package/dist/components/toast/toast.js.map +1 -1
  27. package/dist/icons/index.d.ts +3 -0
  28. package/dist/icons/index.js +3 -0
  29. package/dist/icons/ui/fingerprint.d.ts +3 -0
  30. package/dist/icons/ui/fingerprint.js +5 -0
  31. package/dist/icons/ui/flask.d.ts +3 -0
  32. package/dist/icons/ui/flask.js +5 -0
  33. package/dist/icons/ui/money-bills.d.ts +3 -0
  34. package/dist/icons/ui/money-bills.js +5 -0
  35. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://dodo-ui.dev/schema/component-registry.json",
3
3
  "name": "@dodopayments/ui",
4
- "version": "1.0.3",
4
+ "version": "1.2.0",
5
5
  "components": [
6
6
  {
7
7
  "slug": "alert",
@@ -17555,6 +17555,13 @@
17555
17555
  "description": "Card only: why the option cannot be picked, e.g. \"Not available for subscriptions\". Setting it disables the\noption; the reason shows under the description and is announced with it.",
17556
17556
  "source": "dodo"
17557
17557
  },
17558
+ {
17559
+ "name": "icon",
17560
+ "type": "ReactNode",
17561
+ "required": false,
17562
+ "description": "Card only: a tile (e.g. a `FeaturedIcon`) on a row above the text, with the radio at the row's end. Decorative.",
17563
+ "source": "dodo"
17564
+ },
17558
17565
  {
17559
17566
  "name": "label",
17560
17567
  "type": "ReactNode",
@@ -17569,6 +17576,13 @@
17569
17576
  "description": "Card only: a logo before the text, e.g. a `PaymentLogo` for a payment method. Decorative: the label names\nthe option.",
17570
17577
  "source": "dodo"
17571
17578
  },
17579
+ {
17580
+ "name": "media",
17581
+ "type": "ReactNode",
17582
+ "required": false,
17583
+ "description": "Card only: a full-bleed preview well (160 tall) above the text, e.g. a sketch of the screen the choice leads\nto. The radio moves after the title. Decorative: the label names the option.",
17584
+ "source": "dodo"
17585
+ },
17572
17586
  {
17573
17587
  "name": "note",
17574
17588
  "type": "ReactNode",
@@ -17685,6 +17699,10 @@
17685
17699
  {
17686
17700
  "name": "radio-group/refund-type",
17687
17701
  "code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport { Field } from \"@dodopayments/ui/field\";\nimport { Input } from \"@dodopayments/ui/input\";\nimport { Radio, RadioGroup } from \"@dodopayments/ui/radio-group\";\nimport { useEffect, useState } from \"react\";\n\nconst PAID = 4900;\nconst usd = new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\" });\n\nexport default function RadioGroupRefundType() {\n const [type, setType] = useState(\"full\");\n const [amount, setAmount] = useState<number | null>(null);\n const [loading, setLoading] = useState(false);\n const [refunded, setRefunded] = useState<number | null>(null);\n\n useEffect(() => {\n if (!loading) return;\n const timer = setTimeout(() => {\n setLoading(false);\n setRefunded(type === \"full\" ? PAID : amount);\n }, 1200);\n return () => clearTimeout(timer);\n }, [loading, type, amount]);\n\n const refund = type === \"full\" ? PAID : amount;\n const valid = refund !== null && refund > 0 && refund <= PAID;\n\n return (\n <div className=\"flex w-full max-w-xl flex-col gap-4\">\n <RadioGroup\n aria-label=\"Refund type\"\n value={type}\n onValueChange={(value) => {\n setType(value);\n setRefunded(null);\n }}\n className=\"grid gap-4 sm:grid-cols-2\"\n >\n <Radio\n variant=\"card\"\n value=\"full\"\n label=\"Full refund\"\n description={`Refund all ${usd.format(PAID / 100)}`}\n className=\"w-full\"\n />\n <Radio\n variant=\"card\"\n value=\"partial\"\n label=\"Partial refund\"\n description=\"Refund part of the amount\"\n className=\"w-full\"\n />\n </RadioGroup>\n {type === \"partial\" ? (\n <Field label=\"Refund amount\">\n <Input\n type=\"money\"\n currency=\"USD\"\n value={amount}\n onValueChange={(value) => {\n setAmount(value);\n setRefunded(null);\n }}\n min={1}\n max={PAID}\n maxLabel=\"Max refundable\"\n />\n </Field>\n ) : null}\n <div className=\"flex flex-wrap items-center gap-3\">\n <Button\n loading={loading}\n loadingText=\"Refunding…\"\n disabled={!valid || refunded !== null}\n onClick={() => setLoading(true)}\n >\n {valid ? `Refund ${usd.format(refund / 100)}` : \"Refund\"}\n </Button>\n <p role=\"status\" className=\"text-body-secondary text-muted-foreground\">\n {refunded !== null ? `${usd.format(refunded / 100)} refunded to Visa •••• 4242.` : \"\"}\n </p>\n </div>\n </div>\n );\n}"
17702
+ },
17703
+ {
17704
+ "name": "radio-group/setup-path",
17705
+ "code": "\"use client\";\n\nimport { FeaturedIcon } from \"@dodopayments/ui/featured-icon\";\nimport { FlaskIcon, MoneyBillsIcon } from \"@dodopayments/ui/icons\";\nimport { Radio, RadioGroup } from \"@dodopayments/ui/radio-group\";\n\nexport default function RadioGroupSetupPath() {\n return (\n <div className=\"flex flex-col gap-6\">\n <RadioGroup aria-label=\"Setup path\" defaultValue=\"ai\" className=\"grid gap-4 sm:grid-cols-2\">\n <Radio\n variant=\"card\"\n value=\"ai\"\n className=\"w-full\"\n label=\"Set up with an AI tool\"\n description=\"Jump straight into your codebase and integrate.\"\n media={<span className=\"h-28 w-56 rounded-t-lg bg-background shadow-md\" />}\n >\n <ul className=\"list-disc ps-5\">\n <li>Best if you want to start building now</li>\n <li>Use Cursor, Claude Code and other agents</li>\n </ul>\n </Radio>\n <Radio\n variant=\"card\"\n value=\"dashboard\"\n className=\"w-full\"\n label=\"Set up in the dashboard\"\n description=\"Create products in the dashboard, then integrate.\"\n media={<span className=\"h-28 w-56 rounded-t-lg bg-background shadow-md\" />}\n >\n <ul className=\"list-disc ps-5\">\n <li>Best if you want to explore Dodo first</li>\n <li>We walk you through each step</li>\n </ul>\n </Radio>\n </RadioGroup>\n <RadioGroup aria-label=\"Mode\" defaultValue=\"test\" className=\"grid gap-4 sm:grid-cols-2\">\n <Radio\n variant=\"card\"\n value=\"test\"\n className=\"w-full\"\n label=\"I'm still building\"\n description=\"Test payments without real money.\"\n icon={<FeaturedIcon icon={<FlaskIcon />} />}\n />\n <Radio\n variant=\"card\"\n value=\"live\"\n className=\"w-full\"\n label=\"I'm ready to collect payments\"\n description=\"Accept real payments from customers.\"\n icon={<FeaturedIcon icon={<MoneyBillsIcon />} />}\n />\n </RadioGroup>\n </div>\n );\n}"
17688
17706
  }
17689
17707
  ],
17690
17708
  "docsUrl": "/components/radio-group"
@@ -18914,7 +18932,7 @@
18914
18932
  },
18915
18933
  {
18916
18934
  "name": "SidebarMenuCollapsibleContent",
18917
- "description": "The animated panel (primitive `CollapsiblePanel`) holding the sub-menu. Unmounts when closed unless `keepMounted`.\nOn the desktop icon rail it is a small Popover beside the icon instead: the trigger's `tooltip` as its title, the\nsub-menu in the white panel.",
18935
+ "description": "The animated panel (primitive `CollapsiblePanel`, grown on grid rows) holding the sub-menu. Unmounts when closed unless `keepMounted`.\nOn the desktop icon rail it is a small Popover beside the icon instead: the trigger's `tooltip` as its title, the\nsub-menu in the white panel.",
18918
18936
  "props": [
18919
18937
  {
18920
18938
  "name": "className",
@@ -20687,7 +20705,7 @@
20687
20705
  },
20688
20706
  {
20689
20707
  "name": "tone",
20690
- "type": "\"info\" | \"success\" | \"error\" | \"loading\"",
20708
+ "type": "\"info\" | \"success\" | \"warning\" | \"error\" | \"loading\"",
20691
20709
  "required": false,
20692
20710
  "default": "\"info\"",
20693
20711
  "description": "The tone: tray tint, Featured icon (the Spinner while loading) and footer colour.",
@@ -20710,6 +20728,10 @@
20710
20728
  "signature": "toast.error(message: React.ReactNode, options?: ToastOptions): string",
20711
20729
  "description": "Shows an error toast (high priority by default) and returns its id."
20712
20730
  },
20731
+ {
20732
+ "signature": "toast.warning(message: React.ReactNode, options?: ToastOptions): string",
20733
+ "description": "Shows a warning toast and returns its id."
20734
+ },
20713
20735
  {
20714
20736
  "signature": "toast.info(message: React.ReactNode, options?: ToastOptions): string",
20715
20737
  "description": "Shows an info toast and returns its id."
@@ -20861,7 +20883,7 @@
20861
20883
  },
20862
20884
  {
20863
20885
  "name": "toast/types",
20864
- "code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport { toast } from \"@dodopayments/ui/toast\";\n\nexport default function ToastTypes() {\n return (\n <div className=\"flex flex-wrap justify-center gap-3\">\n <Button\n variant=\"secondary\"\n onClick={() =>\n toast.error(\"Couldn't load product\", {\n description: \"The product was deleted or you no longer have access.\",\n })\n }\n >\n Error\n </Button>\n <Button\n variant=\"secondary\"\n onClick={() => toast.success(\"Changes saved\", { description: \"Your product is now live.\" })}\n >\n Success\n </Button>\n <Button\n variant=\"secondary\"\n onClick={() =>\n toast.info(\"Test mode is on\", { description: \"Payments you make now use test data.\" })\n }\n >\n Info\n </Button>\n </div>\n );\n}"
20886
+ "code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport { toast } from \"@dodopayments/ui/toast\";\n\nexport default function ToastTypes() {\n return (\n <div className=\"flex flex-wrap justify-center gap-3\">\n <Button\n variant=\"secondary\"\n onClick={() =>\n toast.error(\"Couldn't load product\", {\n description: \"The product was deleted or you no longer have access.\",\n })\n }\n >\n Error\n </Button>\n <Button\n variant=\"secondary\"\n onClick={() => toast.success(\"Changes saved\", { description: \"Your product is now live.\" })}\n >\n Success\n </Button>\n <Button\n variant=\"secondary\"\n onClick={() =>\n toast.warning(\"Live mode not activated\", {\n description: \"Finish verification to accept real payments.\",\n })\n }\n >\n Warning\n </Button>\n <Button\n variant=\"secondary\"\n onClick={() =>\n toast.info(\"Test mode is on\", { description: \"Payments you make now use test data.\" })\n }\n >\n Info\n </Button>\n </div>\n );\n}"
20865
20887
  }
20866
20888
  ],
20867
20889
  "docsUrl": "/components/toast"
@@ -21112,7 +21134,7 @@
21112
21134
  "title": "Test Mode Banner",
21113
21135
  "category": "Feedback",
21114
21136
  "status": "stable",
21115
- "description": "Warning strip that stays at the top of the dashboard while test mode is on, so nobody mistakes\ntest data for live data. It is the app shell's own strip (not an Alert): a centred 12px (Body/Secondary)\nmessage on a dark strip (`bg-test-banner`: Grey 900, Grey 800 in dark mode), sticky by\ndefault, with an optional underlined \"Switch to live mode\" link button. It slides in from above on mount. Pair it with\n`TestModeBadge` next to test-mode records.",
21137
+ "description": "Warning strip that stays at the top of the dashboard while test mode is on, so nobody mistakes\ntest data for live data. It is the app shell's own strip (not an Alert): a centred 12px (Body/Secondary)\nmessage on a dark strip (`bg-test-banner`: Grey 900, Grey 800 in dark mode), sticky by\ndefault, with an optional underlined \"Switch to live mode\" link button and a \"Learn more\" link. It slides in from above on mount. Pair it with\n`TestModeBadge` next to test-mode records.",
21116
21138
  "importPath": "@dodopayments/ui/test-mode-banner",
21117
21139
  "exports": [
21118
21140
  "TestModeBadge",
@@ -21124,7 +21146,7 @@
21124
21146
  "parts": [
21125
21147
  {
21126
21148
  "name": "TestModeBanner",
21127
- "description": "Warning strip that stays at the top of the dashboard while test mode is on, so nobody mistakes\ntest data for live data. It is the app shell's own strip (not an Alert): a centred 12px (Body/Secondary)\nmessage on a dark strip (`bg-test-banner`: Grey 900, Grey 800 in dark mode), sticky by\ndefault, with an optional underlined \"Switch to live mode\" link button. It slides in from above on mount. Pair it with\n`TestModeBadge` next to test-mode records.",
21149
+ "description": "Warning strip that stays at the top of the dashboard while test mode is on, so nobody mistakes\ntest data for live data. It is the app shell's own strip (not an Alert): a centred 12px (Body/Secondary)\nmessage on a dark strip (`bg-test-banner`: Grey 900, Grey 800 in dark mode), sticky by\ndefault, with an optional underlined \"Switch to live mode\" link button and a \"Learn more\" link. It slides in from above on mount. Pair it with\n`TestModeBadge` next to test-mode records.",
21128
21150
  "props": [
21129
21151
  {
21130
21152
  "name": "labels",
@@ -21133,6 +21155,13 @@
21133
21155
  "description": "English strings; pass translations here.",
21134
21156
  "source": "dodo"
21135
21157
  },
21158
+ {
21159
+ "name": "learnMoreHref",
21160
+ "type": "string",
21161
+ "required": false,
21162
+ "description": "Shows a \"Learn more\" link to this page (e.g. test vs live mode docs), opened in a new tab.",
21163
+ "source": "dodo"
21164
+ },
21136
21165
  {
21137
21166
  "name": "onSwitchToLive",
21138
21167
  "type": "(() => void)",
@@ -21224,7 +21253,7 @@
21224
21253
  "examples": [
21225
21254
  {
21226
21255
  "name": "test-mode-banner/basic",
21227
- "code": "\"use client\";\n\nimport { TestModeBadge, TestModeBanner } from \"@dodopayments/ui/test-mode-banner\";\n\nexport default function TestModeBannerBasic() {\n return (\n <div className=\"w-full overflow-hidden rounded-xl border\">\n <TestModeBanner onSwitchToLive={() => undefined} />\n <div className=\"flex items-center gap-2 p-4 text-sm\">\n <span className=\"font-medium\">pay_2IjeQm4hqU6RA4Z4kwDee</span>\n <TestModeBadge />\n </div>\n </div>\n );\n}"
21256
+ "code": "\"use client\";\n\nimport { TestModeBadge, TestModeBanner } from \"@dodopayments/ui/test-mode-banner\";\n\nexport default function TestModeBannerBasic() {\n return (\n <div className=\"w-full overflow-hidden rounded-xl border\">\n <TestModeBanner\n onSwitchToLive={() => undefined}\n learnMoreHref=\"https://docs.dodopayments.com/miscellaneous/test-mode-vs-live-mode\"\n />\n <div className=\"flex items-center gap-2 p-4 text-sm\">\n <span className=\"font-medium\">pay_2IjeQm4hqU6RA4Z4kwDee</span>\n <TestModeBadge />\n </div>\n </div>\n );\n}"
21228
21257
  }
21229
21258
  ],
21230
21259
  "docsUrl": "/components/test-mode-banner"
@@ -28051,7 +28080,7 @@
28051
28080
  "title": "Auth Card",
28052
28081
  "category": "Blocks",
28053
28082
  "status": "stable",
28054
- "description": "Sign-in card, ported from the dashboard login page and the customer portal login: a logo, a\nheading and four steps. `\"email\"` shows optional social `providers` (the last used one says so\nat its end) with an \"Or\" divider and an email form; with `onPasswordContinue` its main button is\n\"Continue with password\" and a secondary \"Log in with OTP\" sends a code. `\"password\"` adds a\npassword field with a show/hide button and a forgot-password link; `\"code\"` shows an `OtpField`\nthat submits by itself once every slot is filled; `\"sent\"` tells the user to open the link in their\nemail. You own `step` and switch it from your handlers; the card keeps the email, shows loading\nbuttons for returned promises, moves focus to the new step and shows `error` under the field it\nbelongs to. Renders a `<section>` labelled by the heading.",
28083
+ "description": "Sign-in card, ported from the dashboard login page and the customer portal login: a logo, a\nheading and four steps. `\"email\"` shows optional social `providers` (the last used one says so\nat its end) with an \"Or\" divider and an email form; with `onPasswordContinue` its main button is\n\"Continue with password\" and a secondary \"Log in with OTP\" sends a code. `\"password\"` adds a\npassword field with a show/hide button and a forgot-password link (and keeps the providers with\n`providersOnPasswordStep`); `\"code\"` shows an `OtpField` that submits by itself once every slot\nis filled; `\"sent\"` tells the user to open the link in their email. You own `step` and switch it\nfrom your handlers; the card keeps the email, shows loading buttons for returned promises, moves\nfocus to the new step and shows `error` under the field it belongs to. Renders a `<section>`\nlabelled by the heading.",
28055
28084
  "importPath": "@dodopayments/ui/auth-card",
28056
28085
  "exports": [
28057
28086
  "AuthCard",
@@ -28067,7 +28096,7 @@
28067
28096
  "parts": [
28068
28097
  {
28069
28098
  "name": "AuthCard",
28070
- "description": "Sign-in card, ported from the dashboard login page and the customer portal login: a logo, a\nheading and four steps. `\"email\"` shows optional social `providers` (the last used one says so\nat its end) with an \"Or\" divider and an email form; with `onPasswordContinue` its main button is\n\"Continue with password\" and a secondary \"Log in with OTP\" sends a code. `\"password\"` adds a\npassword field with a show/hide button and a forgot-password link; `\"code\"` shows an `OtpField`\nthat submits by itself once every slot is filled; `\"sent\"` tells the user to open the link in their\nemail. You own `step` and switch it from your handlers; the card keeps the email, shows loading\nbuttons for returned promises, moves focus to the new step and shows `error` under the field it\nbelongs to. Renders a `<section>` labelled by the heading.",
28099
+ "description": "Sign-in card, ported from the dashboard login page and the customer portal login: a logo, a\nheading and four steps. `\"email\"` shows optional social `providers` (the last used one says so\nat its end) with an \"Or\" divider and an email form; with `onPasswordContinue` its main button is\n\"Continue with password\" and a secondary \"Log in with OTP\" sends a code. `\"password\"` adds a\npassword field with a show/hide button and a forgot-password link (and keeps the providers with\n`providersOnPasswordStep`); `\"code\"` shows an `OtpField` that submits by itself once every slot\nis filled; `\"sent\"` tells the user to open the link in their email. You own `step` and switch it\nfrom your handlers; the card keeps the email, shows loading buttons for returned promises, moves\nfocus to the new step and shows `error` under the field it belongs to. Renders a `<section>`\nlabelled by the heading.",
28071
28100
  "props": [
28072
28101
  {
28073
28102
  "name": "title",
@@ -28076,6 +28105,13 @@
28076
28105
  "description": "Heading of the email and password steps, e.g. \"Sign in to Dodo Payments\".",
28077
28106
  "source": "dodo"
28078
28107
  },
28108
+ {
28109
+ "name": "actions",
28110
+ "type": "readonly AuthCardProviderOption[]",
28111
+ "required": false,
28112
+ "description": "More ways to sign in as secondary buttons at the end of the email and password steps, after\n\"Log in with OTP\", e.g. `{ id: \"passkey\", label: \"Sign in with passkey\", icon: <KeyIcon /> }`.\nThe `id` is passed to `onActionSelect` and matched against `lastUsedProvider`.",
28113
+ "source": "dodo"
28114
+ },
28079
28115
  {
28080
28116
  "name": "backLabel",
28081
28117
  "type": "ReactNode",
@@ -28195,7 +28231,7 @@
28195
28231
  "name": "lastUsedProvider",
28196
28232
  "type": "string",
28197
28233
  "required": false,
28198
- "description": "How this person signed in last time: a provider's `id`, `\"password\"` or `\"otp\"`. That button gets a small\n\"Last used\" chip on its top edge (the password chip shows on \"Continue with password\" and on the password\nstep's submit button).",
28234
+ "description": "How this person signed in last time: a provider's or an action's `id`, `\"password\"` or `\"otp\"`. That button gets a small\n\"Last used\" chip on its top edge (the password chip shows on \"Continue with password\" and on the password\nstep's submit button).",
28199
28235
  "source": "dodo"
28200
28236
  },
28201
28237
  {
@@ -28220,6 +28256,13 @@
28220
28256
  "description": "Logo or avatar above the title, e.g. the Dodo `Logo variant=\"mark\"` or the merchant's `Avatar`.",
28221
28257
  "source": "dodo"
28222
28258
  },
28259
+ {
28260
+ "name": "onActionSelect",
28261
+ "type": "((action: string) => unknown)",
28262
+ "required": false,
28263
+ "description": "Called with an action's `id` when its button is pressed. Return a promise to show it loading.",
28264
+ "source": "dodo"
28265
+ },
28223
28266
  {
28224
28267
  "name": "onBack",
28225
28268
  "type": "(() => void)",
@@ -28338,6 +28381,14 @@
28338
28381
  "description": "Social or SSO sign-in buttons above the email form, followed by an \"Or\" divider. `\"google\"` and\n`\"github\"` bring their mark and label; pass `{ id, label, icon }` for others. They sit side\nby side, two per row, and stack on a narrow card. A single provider spans the card.",
28339
28382
  "source": "dodo"
28340
28383
  },
28384
+ {
28385
+ "name": "providersOnPasswordStep",
28386
+ "type": "boolean",
28387
+ "required": false,
28388
+ "default": "false",
28389
+ "description": "Also show `providers` and the \"Or\" divider on the password step, above the email field. With\n`step=\"password\"` the card is then one screen: providers, email and password.",
28390
+ "source": "dodo"
28391
+ },
28341
28392
  {
28342
28393
  "name": "resendLabel",
28343
28394
  "type": "ReactNode",
@@ -28423,6 +28474,10 @@
28423
28474
  "name": "auth-card/magic-link",
28424
28475
  "code": "\"use client\";\n\nimport { AuthCard, type AuthCardStep } from \"@dodopayments/ui/auth-card\";\nimport { Avatar, AvatarFallback } from \"@dodopayments/ui/avatar\";\nimport { Link } from \"@dodopayments/ui/link\";\nimport * as React from \"react\";\n\nfunction wait(ms: number) {\n return new Promise<void>((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n\nexport default function AuthCardMagicLink() {\n const [step, setStep] = React.useState<AuthCardStep>(\"email\");\n\n return (\n <AuthCard\n logo={\n <Avatar>\n <AvatarFallback name=\"Acme Inc.\" />\n </Avatar>\n }\n title=\"Sign in to Acme Inc.\"\n description=\"Manage your subscriptions, invoices and payment methods.\"\n submitLabel=\"Email me a sign-in link\"\n step={step}\n onEmailSubmit={async () => {\n await wait(800);\n setStep(\"sent\");\n }}\n onResend={() => wait(800)}\n onBack={() => setStep(\"email\")}\n footer={\n <>\n Powered by{\" \"}\n <Link href=\"https://dodopayments.com\" external>\n Dodo Payments\n </Link>\n </>\n }\n />\n );\n}"
28425
28476
  },
28477
+ {
28478
+ "name": "auth-card/one-screen",
28479
+ "code": "\"use client\";\n\nimport { AuthCard } from \"@dodopayments/ui/auth-card\";\nimport { Link } from \"@dodopayments/ui/link\";\nimport * as React from \"react\";\n\n/** The only password this demo accepts. */\nconst DEMO_PASSWORD = \"dodo1234\";\n\nfunction wait(ms: number) {\n return new Promise<void>((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n\nexport default function AuthCardOneScreen() {\n const [error, setError] = React.useState<string>();\n\n return (\n <AuthCard\n title=\"Sign in to the Partner Hub\"\n description={\n <>\n Don&apos;t have an account? <Link href=\"#sign-up\">Sign up</Link>\n </>\n }\n step=\"password\"\n providers={[\"google\"]}\n providersOnPasswordStep\n error={error}\n emailLabel=\"Email\"\n forgotPassword={<Link href=\"#forgot-password\">Forgot password?</Link>}\n passwordSubmitLabel=\"Sign in\"\n onProviderSelect={() => wait(800)}\n onEmailChange={() => setError(undefined)}\n onPasswordSubmit={async (_email, password) => {\n setError(undefined);\n await wait(800);\n if (password !== DEMO_PASSWORD) {\n throw new Error(`Incorrect email or password. Try ${DEMO_PASSWORD}.`);\n }\n }}\n onError={(reason) =>\n setError(reason instanceof Error ? reason.message : \"Something went wrong.\")\n }\n />\n );\n}"
28480
+ },
28426
28481
  {
28427
28482
  "name": "auth-card/password",
28428
28483
  "code": "\"use client\";\n\nimport { AuthCard, type AuthCardStep } from \"@dodopayments/ui/auth-card\";\nimport { Link } from \"@dodopayments/ui/link\";\nimport { Logo } from \"@dodopayments/ui/logo\";\nimport * as React from \"react\";\n\n/** The only password this demo accepts. */\nconst DEMO_PASSWORD = \"dodo1234\";\n\nfunction wait(ms: number) {\n return new Promise<void>((resolve) => {\n setTimeout(resolve, ms);\n });\n}\n\nexport default function AuthCardPassword() {\n const [step, setStep] = React.useState<AuthCardStep>(\"password\");\n const [error, setError] = React.useState<string>();\n\n return (\n <AuthCard\n logo={<Logo variant=\"mark\" decorative />}\n title=\"Sign in to Dodo Payments\"\n description={\n <>\n Don&apos;t have an account? <Link href=\"#sign-up\">Sign up</Link>\n </>\n }\n step={step}\n error={error}\n defaultEmail=\"dhruv@dodopayments.com\"\n forgotPassword={<Link href=\"#forgot-password\">Forgot password</Link>}\n legal={\n <>\n By signing in, you agree to our <Link href=\"#terms\">Terms &amp; Conditions</Link> and{\" \"}\n <Link href=\"#privacy\">Privacy Policy</Link>\n </>\n }\n footer={\n <>\n Need help? <Link href=\"#support\">Contact support</Link>\n </>\n }\n onEmailChange={() => setError(undefined)}\n onPasswordSubmit={async (_email, password) => {\n setError(undefined);\n await wait(800);\n if (password !== DEMO_PASSWORD) {\n throw new Error(`Incorrect email or password. Try ${DEMO_PASSWORD}.`);\n }\n setStep(\"sent\");\n }}\n onEmailSubmit={async () => {\n setError(undefined);\n await wait(800);\n setStep(\"sent\");\n }}\n onBack={() => {\n setError(undefined);\n setStep(\"password\");\n }}\n onError={(reason) =>\n setError(reason instanceof Error ? reason.message : \"Something went wrong.\")\n }\n sentTitle=\"You're signed in\"\n sentDescription=\"Your app would open the dashboard now.\"\n backLabel=\"Start over\"\n />\n );\n}"
@@ -4,11 +4,12 @@ Sign-in card, ported from the dashboard login page and the customer portal login
4
4
  heading and four steps. `"email"` shows optional social `providers` (the last used one says so
5
5
  at its end) with an "Or" divider and an email form; with `onPasswordContinue` its main button is
6
6
  "Continue with password" and a secondary "Log in with OTP" sends a code. `"password"` adds a
7
- password field with a show/hide button and a forgot-password link; `"code"` shows an `OtpField`
8
- that submits by itself once every slot is filled; `"sent"` tells the user to open the link in their
9
- email. You own `step` and switch it from your handlers; the card keeps the email, shows loading
10
- buttons for returned promises, moves focus to the new step and shows `error` under the field it
11
- belongs to. Renders a `<section>` labelled by the heading.
7
+ password field with a show/hide button and a forgot-password link (and keeps the providers with
8
+ `providersOnPasswordStep`); `"code"` shows an `OtpField` that submits by itself once every slot
9
+ is filled; `"sent"` tells the user to open the link in their email. You own `step` and switch it
10
+ from your handlers; the card keeps the email, shows loading buttons for returned promises, moves
11
+ focus to the new step and shows `error` under the field it belongs to. Renders a `<section>`
12
+ labelled by the heading.
12
13
 
13
14
  ```tsx
14
15
  import { AuthCard, GitHubLogo, GoogleLogo } from "@dodopayments/ui/auth-card";
@@ -20,15 +21,17 @@ Sign-in card, ported from the dashboard login page and the customer portal login
20
21
  heading and four steps. `"email"` shows optional social `providers` (the last used one says so
21
22
  at its end) with an "Or" divider and an email form; with `onPasswordContinue` its main button is
22
23
  "Continue with password" and a secondary "Log in with OTP" sends a code. `"password"` adds a
23
- password field with a show/hide button and a forgot-password link; `"code"` shows an `OtpField`
24
- that submits by itself once every slot is filled; `"sent"` tells the user to open the link in their
25
- email. You own `step` and switch it from your handlers; the card keeps the email, shows loading
26
- buttons for returned promises, moves focus to the new step and shows `error` under the field it
27
- belongs to. Renders a `<section>` labelled by the heading.
24
+ password field with a show/hide button and a forgot-password link (and keeps the providers with
25
+ `providersOnPasswordStep`); `"code"` shows an `OtpField` that submits by itself once every slot
26
+ is filled; `"sent"` tells the user to open the link in their email. You own `step` and switch it
27
+ from your handlers; the card keeps the email, shows loading buttons for returned promises, moves
28
+ focus to the new step and shows `error` under the field it belongs to. Renders a `<section>`
29
+ labelled by the heading.
28
30
 
29
31
  | Prop | Type | Default | Description |
30
32
  | --- | --- | --- | --- |
31
33
  | `title` (required) | `ReactNode` | - | Heading of the email and password steps, e.g. "Sign in to Dodo Payments". |
34
+ | `actions` | `readonly AuthCardProviderOption[]` | - | More ways to sign in as secondary buttons at the end of the email and password steps, after "Log in with OTP", e.g. `{ id: "passkey", label: "Sign in with passkey", icon: <KeyIcon /> }`. The `id` is passed to `onActionSelect` and matched against `lastUsedProvider`. |
32
35
  | `backLabel` | `ReactNode` | `"Use a different email"` | Label of the back button. |
33
36
  | `codeDescription` | `ReactNode` | `"Enter the {codeLength}-digit code we sent to {email}."` | Text under the heading of the code step. |
34
37
  | `codeLabel` | `string` | `"Verification code"` | Accessible name of the code field (it has no visible label). |
@@ -44,10 +47,11 @@ belongs to. Renders a `<section>` labelled by the heading.
44
47
  | `footer` | `ReactNode` | - | Content at the bottom of the card on every step, e.g. "Need help? Contact support". |
45
48
  | `forgotPassword` | `ReactNode` | - | Link at the end of the password label row, e.g. `<Link href="/forgot-password">Forgot password</Link>`. |
46
49
  | `lastUsedLabel` | `ReactNode` | `"Last used"` | Text of the "Last used" chip. |
47
- | `lastUsedProvider` | `string` | - | How this person signed in last time: a provider's `id`, `"password"` or `"otp"`. That button gets a small "Last used" chip on its top edge (the password chip shows on "Continue with password" and on the password step's submit button). |
50
+ | `lastUsedProvider` | `string` | - | How this person signed in last time: a provider's or an action's `id`, `"password"` or `"otp"`. That button gets a small "Last used" chip on its top edge (the password chip shows on "Continue with password" and on the password step's submit button). |
48
51
  | `legal` | `ReactNode` | - | Terms and privacy note under the email and password forms. |
49
52
  | `loading` | `boolean` | `false` | Shows the current step's main action as loading when you track the request yourself instead of returning a promise. |
50
53
  | `logo` | `ReactNode` | - | Logo or avatar above the title, e.g. the Dodo `Logo variant="mark"` or the merchant's `Avatar`. |
54
+ | `onActionSelect` | `((action: string) => unknown)` | - | Called with an action's `id` when its button is pressed. Return a promise to show it loading. |
51
55
  | `onBack` | `(() => void)` | - | Returns to the email step. Shows a back button on the code and sent steps. |
52
56
  | `onCodeSubmit` | `((code: string) => unknown)` | - | Called with the code as soon as every slot is filled, and when "Verify" is pressed. Return a promise to show a loading button; when it rejects the code is cleared for another try. |
53
57
  | `onEmailChange` | `((email: string) => void)` | - | Called with the new value on every keystroke in the email field. |
@@ -64,6 +68,7 @@ belongs to. Renders a `<section>` labelled by the heading.
64
68
  | `passwordSubmitLabel` | `ReactNode` | `"Continue"` | Label of the password form's submit button. |
65
69
  | `passwordToggleLabel` | `string` | `"Show password"` | Accessible name of the toggle button that shows the password (`aria-pressed` says whether it is shown). |
66
70
  | `providers` | `readonly AuthCardProvider[]` | - | Social or SSO sign-in buttons above the email form, followed by an "Or" divider. `"google"` and `"github"` bring their mark and label; pass `{ id, label, icon }` for others. They sit side by side, two per row, and stack on a narrow card. A single provider spans the card. |
71
+ | `providersOnPasswordStep` | `boolean` | `false` | Also show `providers` and the "Or" divider on the password step, above the email field. With `step="password"` the card is then one screen: providers, email and password. |
67
72
  | `resendLabel` | `ReactNode` | `"Resend code" on the code step, "Resend link" on the sent step` | Label of the resend button. |
68
73
  | `sentDescription` | `ReactNode` | `"We sent a sign-in link to {email}."` | Text under the heading of the sent step. |
69
74
  | `sentTitle` | `ReactNode` | `"Check your email"` | Heading of the sent step. |
@@ -234,6 +239,59 @@ export default function AuthCardMagicLink() {
234
239
  }
235
240
  ```
236
241
 
242
+ ### auth-card/one-screen
243
+
244
+ ```tsx
245
+ "use client";
246
+
247
+ import { AuthCard } from "@dodopayments/ui/auth-card";
248
+ import { Link } from "@dodopayments/ui/link";
249
+ import * as React from "react";
250
+
251
+ /** The only password this demo accepts. */
252
+ const DEMO_PASSWORD = "dodo1234";
253
+
254
+ function wait(ms: number) {
255
+ return new Promise<void>((resolve) => {
256
+ setTimeout(resolve, ms);
257
+ });
258
+ }
259
+
260
+ export default function AuthCardOneScreen() {
261
+ const [error, setError] = React.useState<string>();
262
+
263
+ return (
264
+ <AuthCard
265
+ title="Sign in to the Partner Hub"
266
+ description={
267
+ <>
268
+ Don&apos;t have an account? <Link href="#sign-up">Sign up</Link>
269
+ </>
270
+ }
271
+ step="password"
272
+ providers={["google"]}
273
+ providersOnPasswordStep
274
+ error={error}
275
+ emailLabel="Email"
276
+ forgotPassword={<Link href="#forgot-password">Forgot password?</Link>}
277
+ passwordSubmitLabel="Sign in"
278
+ onProviderSelect={() => wait(800)}
279
+ onEmailChange={() => setError(undefined)}
280
+ onPasswordSubmit={async (_email, password) => {
281
+ setError(undefined);
282
+ await wait(800);
283
+ if (password !== DEMO_PASSWORD) {
284
+ throw new Error(`Incorrect email or password. Try ${DEMO_PASSWORD}.`);
285
+ }
286
+ }}
287
+ onError={(reason) =>
288
+ setError(reason instanceof Error ? reason.message : "Something went wrong.")
289
+ }
290
+ />
291
+ );
292
+ }
293
+ ```
294
+
237
295
  ### auth-card/password
238
296
 
239
297
  ```tsx
@@ -44,8 +44,10 @@ selected when it mounts does not animate.
44
44
  | `content` | `ReactNode` | - | Card only: content that opens under the card while the option is selected, e.g. the card form of the "Card" method. It mounts only while selected, outside the clickable label, so it can hold inputs and buttons. Needs the option inside a `RadioGroup`. |
45
45
  | `description` | `ReactNode` | - | Helper text under the label, announced as the radio's description. |
46
46
  | `disabledReason` | `ReactNode` | - | Card only: why the option cannot be picked, e.g. "Not available for subscriptions". Setting it disables the option; the reason shows under the description and is announced with it. |
47
+ | `icon` | `ReactNode` | - | Card only: a tile (e.g. a `FeaturedIcon`) on a row above the text, with the radio at the row's end. Decorative. |
47
48
  | `label` | `ReactNode` | - | The option's text. With it, the radio is wrapped in a `<label>`, so clicking the text selects it. |
48
49
  | `logo` | `ReactNode` | - | Card only: a logo before the text, e.g. a `PaymentLogo` for a payment method. Decorative: the label names the option. |
50
+ | `media` | `ReactNode` | - | Card only: a full-bleed preview well (160 tall) above the text, e.g. a sketch of the screen the choice leads to. The radio moves after the title. Decorative: the label names the option. |
49
51
  | `note` | `ReactNode` | - | Card only: a fee or discount line under the description (Body/Secondary, Content/Primary), e.g. "+2% fee". |
50
52
  | `size` | `"default" \| "lg"` | `"default"` | `default`: 18px circle (16px from `sm`), the default.<br>`lg`: 20px circle with an 8px dot for prominent choices such as plans or payout methods. |
51
53
  | `variant` | `"default" \| "card"` | `"default"` | `default`: A 16px radio, with an optional label and description beside it. For lists of options.<br>`card`: A card with a 12px radio before its title and a description. Needs a `label`. For choices that each need a short explanation, such as pricing type. |
@@ -335,3 +337,66 @@ export default function RadioGroupRefundType() {
335
337
  }
336
338
  ```
337
339
 
340
+ ### radio-group/setup-path
341
+
342
+ ```tsx
343
+ "use client";
344
+
345
+ import { FeaturedIcon } from "@dodopayments/ui/featured-icon";
346
+ import { FlaskIcon, MoneyBillsIcon } from "@dodopayments/ui/icons";
347
+ import { Radio, RadioGroup } from "@dodopayments/ui/radio-group";
348
+
349
+ export default function RadioGroupSetupPath() {
350
+ return (
351
+ <div className="flex flex-col gap-6">
352
+ <RadioGroup aria-label="Setup path" defaultValue="ai" className="grid gap-4 sm:grid-cols-2">
353
+ <Radio
354
+ variant="card"
355
+ value="ai"
356
+ className="w-full"
357
+ label="Set up with an AI tool"
358
+ description="Jump straight into your codebase and integrate."
359
+ media={<span className="h-28 w-56 rounded-t-lg bg-background shadow-md" />}
360
+ >
361
+ <ul className="list-disc ps-5">
362
+ <li>Best if you want to start building now</li>
363
+ <li>Use Cursor, Claude Code and other agents</li>
364
+ </ul>
365
+ </Radio>
366
+ <Radio
367
+ variant="card"
368
+ value="dashboard"
369
+ className="w-full"
370
+ label="Set up in the dashboard"
371
+ description="Create products in the dashboard, then integrate."
372
+ media={<span className="h-28 w-56 rounded-t-lg bg-background shadow-md" />}
373
+ >
374
+ <ul className="list-disc ps-5">
375
+ <li>Best if you want to explore Dodo first</li>
376
+ <li>We walk you through each step</li>
377
+ </ul>
378
+ </Radio>
379
+ </RadioGroup>
380
+ <RadioGroup aria-label="Mode" defaultValue="test" className="grid gap-4 sm:grid-cols-2">
381
+ <Radio
382
+ variant="card"
383
+ value="test"
384
+ className="w-full"
385
+ label="I'm still building"
386
+ description="Test payments without real money."
387
+ icon={<FeaturedIcon icon={<FlaskIcon />} />}
388
+ />
389
+ <Radio
390
+ variant="card"
391
+ value="live"
392
+ className="w-full"
393
+ label="I'm ready to collect payments"
394
+ description="Accept real payments from customers."
395
+ icon={<FeaturedIcon icon={<MoneyBillsIcon />} />}
396
+ />
397
+ </RadioGroup>
398
+ </div>
399
+ );
400
+ }
401
+ ```
402
+
@@ -94,7 +94,7 @@ Also accepts Base UI props: `defaultOpen`, `disabled`, `onOpenChange`, `open`.
94
94
 
95
95
  ## SidebarMenuCollapsibleContent
96
96
 
97
- The animated panel (primitive `CollapsiblePanel`) holding the sub-menu. Unmounts when closed unless `keepMounted`.
97
+ The animated panel (primitive `CollapsiblePanel`, grown on grid rows) holding the sub-menu. Unmounts when closed unless `keepMounted`.
98
98
  On the desktop icon rail it is a small Popover beside the icon instead: the trigger's `tooltip` as its title, the
99
99
  sub-menu in the white panel.
100
100
 
@@ -3,7 +3,7 @@
3
3
  Warning strip that stays at the top of the dashboard while test mode is on, so nobody mistakes
4
4
  test data for live data. It is the app shell's own strip (not an Alert): a centred 12px (Body/Secondary)
5
5
  message on a dark strip (`bg-test-banner`: Grey 900, Grey 800 in dark mode), sticky by
6
- default, with an optional underlined "Switch to live mode" link button. It slides in from above on mount. Pair it with
6
+ default, with an optional underlined "Switch to live mode" link button and a "Learn more" link. It slides in from above on mount. Pair it with
7
7
  `TestModeBadge` next to test-mode records.
8
8
 
9
9
  ```tsx
@@ -15,12 +15,13 @@ import { TestModeBanner, TestModeBadge } from "@dodopayments/ui/test-mode-banner
15
15
  Warning strip that stays at the top of the dashboard while test mode is on, so nobody mistakes
16
16
  test data for live data. It is the app shell's own strip (not an Alert): a centred 12px (Body/Secondary)
17
17
  message on a dark strip (`bg-test-banner`: Grey 900, Grey 800 in dark mode), sticky by
18
- default, with an optional underlined "Switch to live mode" link button. It slides in from above on mount. Pair it with
18
+ default, with an optional underlined "Switch to live mode" link button and a "Learn more" link. It slides in from above on mount. Pair it with
19
19
  `TestModeBadge` next to test-mode records.
20
20
 
21
21
  | Prop | Type | Default | Description |
22
22
  | --- | --- | --- | --- |
23
23
  | `labels` | `Partial<TestModeBannerLabels>` | - | English strings; pass translations here. |
24
+ | `learnMoreHref` | `string` | - | Shows a "Learn more" link to this page (e.g. test vs live mode docs), opened in a new tab. |
24
25
  | `onSwitchToLive` | `(() => void)` | - | Shows a "Switch to live mode" button that calls this. Omit it when the user cannot switch. |
25
26
  | `sticky` | `boolean` | `true` | Stick to the top of the scroll container. |
26
27
 
@@ -54,7 +55,10 @@ import { TestModeBadge, TestModeBanner } from "@dodopayments/ui/test-mode-banner
54
55
  export default function TestModeBannerBasic() {
55
56
  return (
56
57
  <div className="w-full overflow-hidden rounded-xl border">
57
- <TestModeBanner onSwitchToLive={() => undefined} />
58
+ <TestModeBanner
59
+ onSwitchToLive={() => undefined}
60
+ learnMoreHref="https://docs.dodopayments.com/miscellaneous/test-mode-vs-live-mode"
61
+ />
58
62
  <div className="flex items-center gap-2 p-4 text-sm">
59
63
  <span className="font-medium">pay_2IjeQm4hqU6RA4Z4kwDee</span>
60
64
  <TestModeBadge />
@@ -44,7 +44,7 @@ real toasts with `toast.success()` and the other helpers. The close button and D
44
44
  | `dismissLabel` | `string` | `"Dismiss"` | Label of the Dismiss button in the actions row. |
45
45
  | `footer` | `ReactNode` | - | Footer text on the tray under the panel, in the tone colour. |
46
46
  | `onDismiss` | `(() => void)` | - | Called by the close button and Dismiss. Without it the toast shows no close button. |
47
- | `tone` | `"info" \| "success" \| "error" \| "loading"` | `"info"` | The tone: tray tint, Featured icon (the Spinner while loading) and footer colour. |
47
+ | `tone` | `"info" \| "success" \| "warning" \| "error" \| "loading"` | `"info"` | The tone: tray tint, Featured icon (the Spinner while loading) and footer colour. |
48
48
 
49
49
  ## toast
50
50
 
@@ -55,6 +55,7 @@ Queue a toast from anywhere (event handlers, mutations, plain functions). Requir
55
55
  | --- | --- |
56
56
  | `toast.success(message: React.ReactNode, options?: ToastOptions): string` | Shows a success toast and returns its id. |
57
57
  | `toast.error(message: React.ReactNode, options?: ToastOptions): string` | Shows an error toast (high priority by default) and returns its id. |
58
+ | `toast.warning(message: React.ReactNode, options?: ToastOptions): string` | Shows a warning toast and returns its id. |
58
59
  | `toast.info(message: React.ReactNode, options?: ToastOptions): string` | Shows an info toast and returns its id. |
59
60
  | `toast.loading(message: React.ReactNode, options?: ToastOptions): string` | Shows a toast with a spinner that stays until updated (same `id`) or dismissed. Returns its id. |
60
61
  | `toast.promise<T>(promise: Promise<T>, messages: ToastPromiseMessages<T>): Promise<T>` | Shows a loading toast that turns into a success or error toast when `promise` settles. Returns a promise that resolves with the value or rejects with the error, so handle it. |
@@ -258,6 +259,16 @@ export default function ToastTypes() {
258
259
  >
259
260
  Success
260
261
  </Button>
262
+ <Button
263
+ variant="secondary"
264
+ onClick={() =>
265
+ toast.warning("Live mode not activated", {
266
+ description: "Finish verification to accept real payments.",
267
+ })
268
+ }
269
+ >
270
+ Warning
271
+ </Button>
261
272
  <Button
262
273
  variant="secondary"
263
274
  onClick={() =>
@@ -111,10 +111,24 @@ export interface AuthCardProps extends Omit<CardRootProps, "title" | "variant" |
111
111
  * by side, two per row, and stack on a narrow card. A single provider spans the card.
112
112
  */
113
113
  providers?: readonly AuthCardProvider[];
114
+ /**
115
+ * Also show `providers` and the "Or" divider on the password step, above the email field. With
116
+ * `step="password"` the card is then one screen: providers, email and password.
117
+ * @default false
118
+ */
119
+ providersOnPasswordStep?: boolean;
114
120
  /** Called with a provider's `id` when its button is pressed. Return a promise to show it loading. */
115
121
  onProviderSelect?: (provider: string) => unknown;
116
122
  /**
117
- * How this person signed in last time: a provider's `id`, `"password"` or `"otp"`. That button gets a small
123
+ * More ways to sign in as secondary buttons at the end of the email and password steps, after
124
+ * "Log in with OTP", e.g. `{ id: "passkey", label: "Sign in with passkey", icon: <KeyIcon /> }`.
125
+ * The `id` is passed to `onActionSelect` and matched against `lastUsedProvider`.
126
+ */
127
+ actions?: readonly AuthCardProviderOption[];
128
+ /** Called with an action's `id` when its button is pressed. Return a promise to show it loading. */
129
+ onActionSelect?: (action: string) => unknown;
130
+ /**
131
+ * How this person signed in last time: a provider's or an action's `id`, `"password"` or `"otp"`. That button gets a small
118
132
  * "Last used" chip on its top edge (the password chip shows on "Continue with password" and on the password
119
133
  * step's submit button).
120
134
  */
@@ -219,11 +233,12 @@ export interface AuthCardProps extends Omit<CardRootProps, "title" | "variant" |
219
233
  * heading and four steps. `"email"` shows optional social `providers` (the last used one says so
220
234
  * at its end) with an "Or" divider and an email form; with `onPasswordContinue` its main button is
221
235
  * "Continue with password" and a secondary "Log in with OTP" sends a code. `"password"` adds a
222
- * password field with a show/hide button and a forgot-password link; `"code"` shows an `OtpField`
223
- * that submits by itself once every slot is filled; `"sent"` tells the user to open the link in their
224
- * email. You own `step` and switch it from your handlers; the card keeps the email, shows loading
225
- * buttons for returned promises, moves focus to the new step and shows `error` under the field it
226
- * belongs to. Renders a `<section>` labelled by the heading.
236
+ * password field with a show/hide button and a forgot-password link (and keeps the providers with
237
+ * `providersOnPasswordStep`); `"code"` shows an `OtpField` that submits by itself once every slot
238
+ * is filled; `"sent"` tells the user to open the link in their email. You own `step` and switch it
239
+ * from your handlers; the card keeps the email, shows loading buttons for returned promises, moves
240
+ * focus to the new step and shows `error` under the field it belongs to. Renders a `<section>`
241
+ * labelled by the heading.
227
242
  */
228
- export declare function AuthCard({ logo, title, description, step, email, defaultEmail, onEmailChange, onEmailSubmit, emailLabel, emailPlaceholder, submitLabel, onPasswordContinue, passwordContinueLabel, otpLabel, onPasswordSubmit, passwordLabel, passwordPlaceholder, forgotPassword, passwordSubmitLabel, passwordToggleLabel, providers, onProviderSelect, lastUsedProvider, lastUsedLabel, dividerLabel, children, legal, onCodeSubmit, codeLength, codeTitle, codeDescription, codeLabel, verifyLabel, sentTitle, sentDescription, onResend, resendLabel, onBack, backLabel, error, loading, onError, footer, titleAs: Title, className, ...props }: AuthCardProps): React.JSX.Element;
243
+ export declare function AuthCard({ logo, title, description, step, email, defaultEmail, onEmailChange, onEmailSubmit, emailLabel, emailPlaceholder, submitLabel, onPasswordContinue, passwordContinueLabel, otpLabel, onPasswordSubmit, passwordLabel, passwordPlaceholder, forgotPassword, passwordSubmitLabel, passwordToggleLabel, providers, providersOnPasswordStep, onProviderSelect, actions, onActionSelect, lastUsedProvider, lastUsedLabel, dividerLabel, children, legal, onCodeSubmit, codeLength, codeTitle, codeDescription, codeLabel, verifyLabel, sentTitle, sentDescription, onResend, resendLabel, onBack, backLabel, error, loading, onError, footer, titleAs: Title, className, ...props }: AuthCardProps): React.JSX.Element;
229
244
  //# sourceMappingURL=auth-card.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth-card.d.ts","sourceRoot":"","sources":["../../../src/components/auth-card/auth-card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,OAAO,EAAqB,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAOzE;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAElE,wGAAwG;AACxG,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAErD,kGAAkG;AAClG,MAAM,WAAW,sBAAsB;IACrC,2EAA2E;IAC3E,EAAE,EAAE,MAAM,CAAC;IACX,mBAAmB;IACnB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,mCAAmC;IACnC,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACxB;AAED,6DAA6D;AAC7D,MAAM,MAAM,gBAAgB,GAAG,kBA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,CAAC,SAAS,CAAC;IAC9B,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B;;;;OAIG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,0FAA0F;IAC1F,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;;OAGG;IACH,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CAC9B;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,EACvB,IAAI,EACJ,KAAK,EACL,WAAW,EACX,IAAc,EACd,KAAK,EACL,YAAiB,EACjB,aAAa,EACb,aAAa,EACb,UAA+B,EAC/B,gBAAoC,EACpC,WAAwB,EACxB,kBAAkB,EAClB,qBAAgD,EAChD,QAA4B,EAC5B,gBAAgB,EAChB,aAA0B,EAC1B,mBAA2C,EAC3C,cAAc,EACd,mBAAgC,EAChC,mBAAqC,EACrC,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,aAA2B,EAC3B,YAAmB,EACnB,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,UAAc,EACd,SAA8B,EAC9B,eAAe,EACf,SAA+B,EAC/B,WAAsB,EACtB,SAA8B,EAC9B,eAAe,EACf,QAAQ,EACR,WAAW,EACX,MAAM,EACN,SAAmC,EACnC,KAAK,EACL,OAAe,EACf,OAAO,EACP,MAAM,EACN,OAAO,EAAE,KAAY,EACrB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,aAAa,qBA8hBf"}
1
+ {"version":3,"file":"auth-card.d.ts","sourceRoot":"","sources":["../../../src/components/auth-card/auth-card.tsx"],"names":[],"mappings":"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