An open source design system that's fully customizable and agent ready
TypeScript
refactor(login-templates): clean up login templates for XDS purity (#1482)
rubyycheung486deba090fb
diff --git a/apps/sandbox/public/templates/apple-logo.png b/apps/sandbox/public/templates/apple-logo.pngnew file mode 100644index 0000000000..31fa44e6eeBinary files /dev/null and b/apps/sandbox/public/templates/apple-logo.png differdiff --git a/apps/sandbox/public/templates/colorful-working-horizontal-1.png b/apps/sandbox/public/templates/colorful-working-horizontal-1.pngnew file mode 100644index 0000000000..249000dea6Binary files /dev/null and b/apps/sandbox/public/templates/colorful-working-horizontal-1.png differdiff --git a/apps/sandbox/public/templates/google-logo.png b/apps/sandbox/public/templates/google-logo.pngnew file mode 100644index 0000000000..6171bacf9fBinary files /dev/null and b/apps/sandbox/public/templates/google-logo.png differdiff --git a/apps/sandbox/public/templates/light-working-vertical-1.png b/apps/sandbox/public/templates/light-working-vertical-1.pngnew file mode 100644index 0000000000..175e700cacBinary files /dev/null and b/apps/sandbox/public/templates/light-working-vertical-1.png differdiff --git a/apps/sandbox/public/templates/login-sso-bg.jpg b/apps/sandbox/public/templates/login-sso-bg.jpgnew file mode 100644index 0000000000..341b0153c0Binary files /dev/null and b/apps/sandbox/public/templates/login-sso-bg.jpg differdiff --git a/apps/sandbox/public/templates/meta-logo.svg b/apps/sandbox/public/templates/meta-logo.svgnew file mode 100644index 0000000000..a28cf80ef6--- /dev/null+++ b/apps/sandbox/public/templates/meta-logo.svg@@ -0,0 +1,19 @@+<?xml version="1.0" encoding="UTF-8"?><svg width="290" height="191" viewBox="0 0 290 191" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:cc="http://creativecommons.org/ns#">+<desc xmlns="http://www.w3.org/2000/svg">Logo of Meta Platforms -- Graphic created by Detmar Owen</desc>+<defs xmlns="http://www.w3.org/2000/svg">+<linearGradient id="Grad_Logo1" x1="61" y1="117" x2="259" y2="127" gradientUnits="userSpaceOnUse">+<stop style="stop-color:#0064e1" offset="0"/>+<stop style="stop-color:#0064e1" offset="0.4"/>+<stop style="stop-color:#0073ee" offset="0.83"/>+<stop style="stop-color:#0082fb" offset="1"/>+</linearGradient>+<linearGradient id="Grad_Logo2" x1="45" y1="139" x2="45" y2="66" gradientUnits="userSpaceOnUse">+<stop style="stop-color:#0082fb" offset="0"/>+<stop style="stop-color:#0064e0" offset="1"/>+</linearGradient>+</defs>+<path xmlns="http://www.w3.org/2000/svg" id="Logo0" style="fill:#0081fb" d="m31.06,125.96c0,10.98 2.41,19.41 5.56,24.51 4.13,6.68 10.29,9.51 16.57,9.51 8.1,0 15.51-2.01 29.79-21.76 11.44-15.83 24.92-38.05 33.99-51.98l15.36-23.6c10.67-16.39 23.02-34.61 37.18-46.96 11.56-10.08 24.03-15.68 36.58-15.68 21.07,0 41.14,12.21 56.5,35.11 16.81,25.08 24.97,56.67 24.97,89.27 0,19.38-3.82,33.62-10.32,44.87-6.28,10.88-18.52,21.75-39.11,21.75l0-31.02c17.63,0 22.03-16.2 22.03-34.74 0-26.42-6.16-55.74-19.73-76.69-9.63-14.86-22.11-23.94-35.84-23.94-14.85,0-26.8,11.2-40.23,31.17-7.14,10.61-14.47,23.54-22.7,38.13l-9.06,16.05c-18.2,32.27-22.81,39.62-31.91,51.75-15.95,21.24-29.57,29.29-47.5,29.29-21.27,0-34.72-9.21-43.05-23.09-6.8-11.31-10.14-26.15-10.14-43.06z"/>+<path xmlns="http://www.w3.org/2000/svg" id="Logo1" style="fill:url(#Grad_Logo1)" d="m24.49,37.3c14.24-21.95 34.79-37.3 58.36-37.3 13.65,0 27.22,4.04 41.39,15.61 15.5,12.65 32.02,33.48 52.63,67.81l7.39,12.32c17.84,29.72 27.99,45.01 33.93,52.22 7.64,9.26 12.99,12.02 19.94,12.02 17.63,0 22.03-16.2 22.03-34.74l27.4-.86c0,19.38-3.82,33.62-10.32,44.87-6.28,10.88-18.52,21.75-39.11,21.75-12.8,0-24.14-2.78-36.68-14.61-9.64-9.08-20.91-25.21-29.58-39.71l-25.79-43.08c-12.94-21.62-24.81-37.74-31.68-45.04-7.39-7.85-16.89-17.33-32.05-17.33-12.27,0-22.69,8.61-31.41,21.78z"/>+<path xmlns="http://www.w3.org/2000/svg" id="Logo2" style="fill:url(#Grad_Logo2)" d="m82.35,31.23c-12.27,0-22.69,8.61-31.41,21.78-12.33,18.61-19.88,46.33-19.88,72.95 0,10.98 2.41,19.41 5.56,24.51l-26.48,17.44c-6.8-11.31-10.14-26.15-10.14-43.06 0-30.75 8.44-62.8 24.49-87.55 14.24-21.95 34.79-37.3 58.36-37.3z"/>+<path xmlns="http://www.w3.org/2000/svg" id="Text" style="fill:#192830" d="m347.94,6.04h35.93l61.09,110.52 61.1-110.52h35.15v181.6h-29.31v-139.18l-53.58,96.38h-27.5l-53.57-96.38v139.18h-29.31z m285.11,67.71c-21.02,0-33.68,15.82-36.71,35.41h71.34c-1.47-20.18-13.11-35.41-34.63-35.41z m-65.77,46.57c0-41.22 26.64-71.22 66.28-71.22 38.99,0 62.27,29.62 62.27,73.42v8.05h-99.49c3.53,21.31 17.67,35.67 40.47,35.67 18.19,0 29.56-5.55 40.34-15.7l15.57,19.07c-14.67,13.49-33.33,21.27-56.95,21.27-42.91,0-68.49-31.29-68.49-70.56z m164.09-43.97h-26.98v-24h26.98v-39.69h28.28v39.69h40.99v24h-40.99v60.83c0,20.77 6.64,28.15 22.96,28.15 7.45,0 11.72-.64 18.03-1.69v23.74c-7.86,2.22-15.36,3.24-23.48,3.24-30.53,0-45.79-16.68-45.79-50.07z m188.35,23.34c-5.68-14.34-18.35-24.9-36.97-24.9-24.2,0-39.69,17.17-39.69,45.14 0,27.27 14.26,45.27 38.53,45.27 19.08,0 32.7-11.1 38.13-24.91z m28.28,87.95h-27.76v-18.94c-7.76,11.15-21.88,22.18-44.75,22.18-36.78,0-61.36-30.79-61.36-70.95 0-40.54 25.17-70.83 62.92-70.83 18.66,0 33.3,7.46 43.19,20.63v-17.38h27.76z"/>+</svg>\ No newline at end of filediff --git a/packages/cli/templates/pages/login-split/page.tsx b/packages/cli/templates/pages/login-split/page.tsxindex af6e6eb1cf..37b6cd9482 100644--- a/packages/cli/templates/pages/login-split/page.tsx+++ b/packages/cli/templates/pages/login-split/page.tsx@@ -2,61 +2,47 @@import {useState} from 'react';import * as stylex from '@stylexjs/stylex';-import {XDSVStack, XDSHStack} from '@xds/core/Layout';+import {XDSVStack, XDSHStack, XDSStackItem} from '@xds/core/Layout';+import {XDSGrid} from '@xds/core/Grid';import {XDSCenter} from '@xds/core/Center';import {XDSCard} from '@xds/core/Card';-import {XDSText, XDSHeading} from '@xds/core/Text';+import {XDSText} from '@xds/core/Text';+import {XDSIcon} from '@xds/core/Icon';+import {SquaresPlusIcon} from '@heroicons/react/24/outline';import {XDSTextInput} from '@xds/core/TextInput';import {XDSButton} from '@xds/core/Button';import {XDSLink} from '@xds/core/Link';import {XDSDivider} from '@xds/core/Divider';-import {colorVars, spacingVars} from '@xds/core/theme/tokens.stylex';+import {+ colorVars,+ spacingVars,+ radiusVars,+} from '@xds/core/theme/tokens.stylex';-// Brand icons — no heroicons equivalent+const COVER_IMAGE_URL = '/templates/light-working-vertical-1.png';-const AppleIcon = (props: React.SVGProps<SVGSVGElement>) => (- <svg viewBox="0 0 24 24" fill="currentColor" width={16} height={16} {...props}>- <path d="M17.05 20.28c-.98.95-2.05.88-3.08.4-1.09-.5-2.08-.48-3.24 0-1.44.62-2.2.44-3.06-.4C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z" />- </svg>-);--const GoogleIcon = (props: React.SVGProps<SVGSVGElement>) => (- <svg viewBox="0 0 24 24" fill="currentColor" width={16} height={16} {...props}>- <path d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92a5.06 5.06 0 01-2.2 3.32v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.1z" fill="#4285F4" />- <path d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z" fill="#34A853" />- <path d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z" fill="#FBBC05" />- <path d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z" fill="#EA4335" />- </svg>-);+const APPLE_ICON_URL = '/templates/apple-logo.png';+const GOOGLE_ICON_URL = '/templates/google-logo.png';const styles = stylex.create({page: {- minHeight: '100dvh',- padding: spacingVars['--spacing-6'],backgroundColor: colorVars['--color-background-body'],},fullWidth: {width: '100%',},- centered: {textAlign: 'center'},- splitRow: {- display: 'flex',- alignItems: 'stretch',- },- formSide: {- width: '50%',+ formColumn: {padding: spacingVars['--spacing-8'],- display: 'flex',- flexDirection: 'column',- justifyContent: 'center',},- coverImage: {- width: '50%',- minHeight: 400,- objectFit: 'cover',+ imageColumn: {+ paddingBlock: spacingVars['--spacing-4'],+ paddingInlineEnd: spacingVars['--spacing-4'],},- socialButton: {- flex: 1,+ coverImage: {+ width: '100%',+ height: '100%',+ objectFit: 'cover' as const,+ borderRadius: radiusVars['--radius-container'],},});@@ -66,119 +52,130 @@ export default function LoginTwoColumn() {const [loginFailed, setLoginFailed] = useState(false);return (- <XDSCenter axis="both" xstyle={styles.page}>+ <XDSCenter axis="both" height="100dvh" xstyle={styles.page}><XDSVStack gap={4} hAlign="center">{/* Card */}<XDSCard padding={0} maxWidth={1000} width="100%">- <div {...stylex.props(styles.splitRow)}>+ <XDSGrid columns={2} align="stretch">{/* Left — Form */}- <div {...stylex.props(styles.formSide)}>- <XDSVStack gap={4}>- <XDSVStack hAlign="center" xstyle={styles.centered}>- <XDSVStack gap={1}>- <XDSHeading level={2}>Welcome back</XDSHeading>- <XDSText type="body" color="secondary" size="sm">- Login to your Product Inc. account- </XDSText>- </XDSVStack>- </XDSVStack>+ <XDSVStack xstyle={styles.formColumn}>+ <XDSHStack gap={2} vAlign="center">+ <XDSIcon icon={SquaresPlusIcon} />+ <XDSText type="body" weight="bold">Product Inc.</XDSText>+ </XDSHStack>- <XDSVStack gap={2}>- <XDSTextInput- label="Email"- isLabelHidden- type="email"- placeholder="[email protected]"- value={email}- onChange={setEmail}- size="lg"- />- <XDSVStack gap={1}>- <XDSTextInput- label="Password"- isLabelHidden- placeholder="Enter your password"- type="password"- value={password}- onChange={(v: string) => {- setPassword(v);- setLoginFailed(false);- }}- size="lg"- status={- loginFailed- ? {- type: 'error',- message: 'Incorrect password. Try again.',- }- : undefined- }- />- {loginFailed && (- <XDSVStack hAlign="end">- <XDSLink- label="Forgot your password?"- href="#"- size="sm"- color="secondary"- type="supporting">- Forgot your password?- </XDSLink>+ <XDSStackItem size="fill">+ <XDSCenter axis="vertical" height="100%">+ <XDSVStack gap={4} xstyle={styles.fullWidth}>+ <XDSVStack gap={1}>+ <XDSText type="display-1" as="h2">Welcome back</XDSText>+ <XDSText type="body" color="secondary" size="sm">+ Login to your Product Inc. account+ </XDSText>+ </XDSVStack>++ <XDSVStack gap={2}>+ <XDSTextInput+ label="Email"+ isLabelHidden+ type="email"+ placeholder="[email protected]"+ value={email}+ onChange={setEmail}+ size="lg"+ />+ <XDSVStack gap={1}>+ <XDSTextInput+ label="Password"+ isLabelHidden+ placeholder="Enter your password"+ type="password"+ value={password}+ onChange={(v: string) => {+ setPassword(v);+ setLoginFailed(false);+ }}+ size="lg"+ status={+ loginFailed+ ? {+ type: 'error',+ message: 'Incorrect password. Try again.',+ }+ : undefined+ }+ />+ {loginFailed && (+ <XDSVStack hAlign="end">+ <XDSLink+ label="Forgot your password?"+ href="#"+ size="sm"+ color="secondary"+ type="supporting">+ Forgot your password?+ </XDSLink>+ </XDSVStack>+ )}</XDSVStack>- )}- </XDSVStack>- </XDSVStack>+ </XDSVStack>- <XDSButton- label="Login"- variant="primary"- size="lg"- xstyle={styles.fullWidth}- onClick={() => setLoginFailed(true)}- />+ <XDSButton+ label="Login"+ variant="primary"+ size="lg"+ xstyle={styles.fullWidth}+ onClick={() => setLoginFailed(true)}+ />- <XDSDivider label="Or continue with" />+ <XDSDivider label="Or continue with" />- <XDSHStack gap={3}>- <XDSButton- label="Apple"- variant="secondary"- icon={<AppleIcon />}- size="lg"- xstyle={styles.socialButton}- />- <XDSButton- label="Google"- variant="secondary"- icon={<GoogleIcon />}- size="lg"- xstyle={styles.socialButton}- />- </XDSHStack>+ <XDSHStack gap={3}>+ <XDSStackItem size="fill">+ <XDSButton+ label="Apple"+ variant="secondary"+ icon={<img src={APPLE_ICON_URL} width={16} height={16} alt="" />}+ size="lg"+ xstyle={styles.fullWidth}+ />+ </XDSStackItem>+ <XDSStackItem size="fill">+ <XDSButton+ label="Google"+ variant="secondary"+ icon={<img src={GOOGLE_ICON_URL} width={16} height={16} alt="" />}+ size="lg"+ xstyle={styles.fullWidth}+ />+ </XDSStackItem>+ </XDSHStack>+ </XDSVStack>+ </XDSCenter>+ </XDSStackItem>- <XDSVStack hAlign="center">- <XDSText type="supporting" color="secondary">- Don't have an account?{' '}- <XDSLink label="Sign up" href="#" type="supporting">- Sign up- </XDSLink>- </XDSText>- </XDSVStack>- </XDSVStack>- </div>+ <XDSText type="supporting" color="secondary">+ Don't have an account?{' '}+ <XDSLink label="Sign up" href="#" type="supporting">+ Sign up+ </XDSLink>+ </XDSText>+ </XDSVStack>{/* Right — Cover image */}- <img- {...stylex.props(styles.coverImage)}- src="/templates/colorful-home-vertical-3.png"- alt="Colorful home scene"- />- </div>+ <XDSVStack xstyle={styles.imageColumn}>+ <img+ {...stylex.props(styles.coverImage)}+ src={COVER_IMAGE_URL}+ alt="Two people working at a desk"+ />+ </XDSVStack>+ </XDSGrid></XDSCard>{/* Terms */}<XDSVStack hAlign="center">- <XDSText type="supporting" color="secondary" xstyle={styles.centered}>+ <XDSText type="supporting" color="secondary">By clicking continue, you agree to our{' '}<XDSLink label="Terms of Service" href="#" type="supporting">Terms of Servicediff --git a/packages/cli/templates/pages/login-sso/page.tsx b/packages/cli/templates/pages/login-sso/page.tsxindex e2f246266e..e1b1b51557 100644--- a/packages/cli/templates/pages/login-sso/page.tsx+++ b/packages/cli/templates/pages/login-sso/page.tsx@@ -2,10 +2,10 @@import {useState} from 'react';import * as stylex from '@stylexjs/stylex';-import {CubeIcon, ShieldCheckIcon} from '@heroicons/react/24/outline';+import {ShieldCheckIcon} from '@heroicons/react/24/outline';import {XDSVStack, XDSHStack} from '@xds/core/Layout';import {XDSCenter} from '@xds/core/Center';-import {XDSText, XDSHeading} from '@xds/core/Text';+import {XDSText} from '@xds/core/Text';import {XDSTextInput} from '@xds/core/TextInput';import {XDSButton} from '@xds/core/Button';import {XDSCard} from '@xds/core/Card';@@ -13,104 +13,44 @@ import {XDSSection} from '@xds/core/Section';import {XDSLink} from '@xds/core/Link';import {XDSDivider} from '@xds/core/Divider';import {XDSIcon} from '@xds/core/Icon';-import {- colorVars,- spacingVars,- radiusVars,-} from '@xds/core/theme/tokens.stylex';+import {XDSAvatar} from '@xds/core/Avatar';+import {shadowVars} from '@xds/core/theme/tokens.stylex';// ---------------------------------------------------------------------------// Styles// ---------------------------------------------------------------------------+const BG_URL = '/templates/login-sso-bg.jpg';+const styles = stylex.create({page: {- minHeight: '100dvh',- padding: spacingVars['--spacing-6'],- backgroundColor: colorVars['--color-background-body'],+ height: '100dvh',+ backgroundImage: `url(${BG_URL})`,+ backgroundSize: 'cover',+ backgroundPosition: 'center',+ },+ card: {+ boxShadow: shadowVars['--shadow-high'],+ borderWidth: 0,},fullWidth: {width: '100%',},- centered: {textAlign: 'center'},- providerBadge: (bgColor: string) => ({- width: 48,- height: 48,- borderRadius: radiusVars['--radius-container'],- backgroundColor: bgColor,- color: '#fff',- fontSize: 20,- fontWeight: 700,- }),- providerLogo: {- width: 48,- height: 48,- },- termsFooter: {- maxWidth: 400,- },});-// Meta infinity-loop logo (from https://upload.wikimedia.org/wikipedia/commons/d/d0/Meta_Platforms_logo.svg)-function MetaLogo(props: React.SVGProps<SVGSVGElement>) {- const id = Math.random().toString(36).slice(2, 8);- const g1 = `ml-g1-${id}`;- const g2 = `ml-g2-${id}`;- return (- <svg viewBox="0 0 290 191" {...props}>- <defs>- <linearGradient- id={g1}- x1="61"- y1="117"- x2="259"- y2="127"- gradientUnits="userSpaceOnUse">- <stop offset="0" stopColor="#0064e1" />- <stop offset="0.4" stopColor="#0064e1" />- <stop offset="0.83" stopColor="#0073ee" />- <stop offset="1" stopColor="#0082fb" />- </linearGradient>- <linearGradient- id={g2}- x1="45"- y1="139"- x2="45"- y2="66"- gradientUnits="userSpaceOnUse">- <stop offset="0" stopColor="#0082fb" />- <stop offset="1" stopColor="#0064e0" />- </linearGradient>- </defs>- <path- fill="#0081fb"- d="m31.06,125.96c0,10.98 2.41,19.41 5.56,24.51 4.13,6.68 10.29,9.51 16.57,9.51 8.1,0 15.51-2.01 29.79-21.76 11.44-15.83 24.92-38.05 33.99-51.98l15.36-23.6c10.67-16.39 23.02-34.61 37.18-46.96 11.56-10.08 24.03-15.68 36.58-15.68 21.07,0 41.14,12.21 56.5,35.11 16.81,25.08 24.97,56.67 24.97,89.27 0,19.38-3.82,33.62-10.32,44.87-6.28,10.88-18.52,21.75-39.11,21.75l0-31.02c17.63,0 22.03-16.2 22.03-34.74 0-26.42-6.16-55.74-19.73-76.69-9.63-14.86-22.11-23.94-35.84-23.94-14.85,0-26.8,11.2-40.23,31.17-7.14,10.61-14.47,23.54-22.7,38.13l-9.06,16.05c-18.2,32.27-22.81,39.62-31.91,51.75-15.95,21.24-29.57,29.29-47.5,29.29-21.27,0-34.72-9.21-43.05-23.09-6.8-11.31-10.14-26.15-10.14-43.06z"- />- <path- fill={`url(#${g1})`}- d="m24.49,37.3c14.24-21.95 34.79-37.3 58.36-37.3 13.65,0 27.22,4.04 41.39,15.61 15.5,12.65 32.02,33.48 52.63,67.81l7.39,12.32c17.84,29.72 27.99,45.01 33.93,52.22 7.64,9.26 12.99,12.02 19.94,12.02 17.63,0 22.03-16.2 22.03-34.74l27.4-.86c0,19.38-3.82,33.62-10.32,44.87-6.28,10.88-18.52,21.75-39.11,21.75-12.8,0-24.14-2.78-36.68-14.61-9.64-9.08-20.91-25.21-29.58-39.71l-25.79-43.08c-12.94-21.62-24.81-37.74-31.68-45.04-7.39-7.85-16.89-17.33-32.05-17.33-12.27,0-22.69,8.61-31.41,21.78z"- />- <path- fill={`url(#${g2})`}- d="m82.35,31.23c-12.27,0-22.69,8.61-31.41,21.78-12.33,18.61-19.88,46.33-19.88,72.95 0,10.98 2.41,19.41 5.56,24.51l-26.48,17.44c-6.8-11.31-10.14-26.15-10.14-43.06 0-30.75 8.44-62.8 24.49-87.55 14.24-21.95 34.79-37.3 58.36-37.3z"- />- </svg>- );-}+const META_LOGO_URL = '/templates/meta-logo.svg';-// Mock SSO providers keyed by email domaintype SSOProvider = {name: string;- color: string;abbr: string;- logo?: React.ComponentType<React.SVGProps<SVGSVGElement>>;+ logoUrl?: string;};const SSO_PROVIDERS: Record<string, SSOProvider> = {- 'google.com': {name: 'Google Workspace', color: '#4285F4', abbr: 'G'},- 'microsoft.com': {name: 'Microsoft Entra ID', color: '#00A4EF', abbr: 'M'},- 'okta.com': {name: 'Okta', color: '#007DC1', abbr: 'O'},- 'meta.com': {name: 'Meta SSO', color: '#0668E1', abbr: 'M', logo: MetaLogo},- 'apple.com': {name: 'Apple Business', color: '#000000', abbr: 'A'},+ 'google.com': {name: 'Google Workspace', abbr: 'G'},+ 'microsoft.com': {name: 'Microsoft Entra ID', abbr: 'M'},+ 'okta.com': {name: 'Okta', abbr: 'O'},+ 'meta.com': {name: 'Meta SSO', abbr: 'M', logoUrl: META_LOGO_URL},+ 'apple.com': {name: 'Apple Business', abbr: 'A'},};function getProvider(email: string) {@@ -150,212 +90,192 @@ export default function LoginSSO() {return (<XDSCenter axis="both" xstyle={styles.page}>- <XDSVStack gap={4} hAlign="center">- {/* Logo */}- <XDSVStack gap={2} hAlign="center">- <XDSIcon icon={CubeIcon} size="lg" />- <XDSText type="body" weight="bold" size="lg">- Product Inc.- </XDSText>- </XDSVStack>+ <XDSCard padding={8} width={400} xstyle={styles.card}>+ <XDSVStack gap={4}>+ {/* ── Step 1: Email entry ── */}+ {step === 'email' && (+ <>+ <XDSVStack gap={1} hAlign="center">+ <XDSText type="display-1" as="h2">Welcome back</XDSText>+ <XDSText type="body" color="secondary" size="sm">+ Enter your details to sign in to your account+ </XDSText>+ </XDSVStack>- {/* Card */}- <XDSCard padding={8} width={400}>- <XDSVStack gap={4}>- {/* ── Step 1: Email entry ── */}- {step === 'email' && (- <>- <XDSVStack hAlign="center" xstyle={styles.centered}>- <XDSVStack gap={1}>- <XDSHeading level={2}>Welcome back</XDSHeading>- <XDSText type="body" color="secondary" size="sm">- Enter your work email to continue- </XDSText>- </XDSVStack>- </XDSVStack>+ <XDSVStack gap={2}>+ <XDSTextInput+ label="Work email"+ isLabelHidden+ type="email"+ placeholder="[email protected]"+ value={email}+ onChange={setEmail}+ size="lg"+ onKeyDown={(e: React.KeyboardEvent) => {+ if (e.key === 'Enter') handleContinue();+ }}+ />+ <XDSTextInput+ label="Password"+ isLabelHidden+ type="password"+ placeholder="Password"+ value={password}+ onChange={setPassword}+ size="lg"+ />+ </XDSVStack>- <XDSVStack gap={4}>- <XDSTextInput- label="Work email"- isLabelHidden- type="email"- placeholder="[email protected]"- value={email}- onChange={setEmail}- size="lg"- onKeyDown={(e: React.KeyboardEvent) => {- if (e.key === 'Enter') handleContinue();- }}- />- <XDSButton- label="Continue"- variant="primary"- size="lg"- xstyle={styles.fullWidth}- onClick={handleContinue}- isDisabled={!emailValid}- />- </XDSVStack>+ <XDSLink+ label="Having trouble signing in?"+ href="#"+ size="sm"+ color="secondary"+ type="supporting">+ Having trouble signing in?+ </XDSLink>- <XDSDivider label="or" />+ <XDSButton+ label="Sign in"+ variant="primary"+ size="lg"+ xstyle={styles.fullWidth}+ onClick={handleContinue}+ isDisabled={!emailValid}+ />- <XDSButton- label="Continue with SSO"- variant="secondary"- size="lg"- xstyle={styles.fullWidth}- />+ <XDSDivider label="Or sign in with" />- <XDSVStack hAlign="center">- <XDSText type="supporting" color="secondary">- Don't have an account?{' '}- <XDSLink label="Sign up" href="#" type="supporting">- Sign up- </XDSLink>- </XDSText>- </XDSVStack>- </>- )}+ <XDSButton+ label="Continue with SSO"+ variant="secondary"+ size="lg"+ xstyle={styles.fullWidth}+ />++ <XDSVStack hAlign="center">+ <XDSText type="supporting" color="secondary">+ Don't have an account?{' '}+ <XDSLink label="Request access" href="#" type="supporting">+ Request access+ </XDSLink>+ </XDSText>+ </XDSVStack>+ </>+ )}- {/* ── Step 2a: SSO provider detected ── */}- {step === 'sso-confirm' && provider && (- <>- <XDSVStack hAlign="center" xstyle={styles.centered}>- <XDSVStack gap={2}>- <XDSHStack hAlign="center">- {provider.logo ? (- <provider.logo {...stylex.props(styles.providerLogo)} />+ {/* ── Step 2a: SSO provider detected ── */}+ {step === 'sso-confirm' && provider && (+ <>+ <XDSVStack gap={2} hAlign="center">+ {provider.logoUrl ? (+ <img src={provider.logoUrl} width={48} height={48} alt="" />) : (- <XDSCenter- axis="both"- xstyle={styles.providerBadge(provider.color)}>- {provider.abbr}- </XDSCenter>+ <XDSAvatar name={provider.name} size={48} />)}- </XDSHStack>- <XDSHeading level={2}>- Sign in with {provider.name}- </XDSHeading>- <XDSText type="body" color="secondary" size="sm">- You will be redirected back after signing in.- </XDSText>- </XDSVStack>- </XDSVStack>+ <XDSText type="display-3" as="h2">+ Sign in with {provider.name}+ </XDSText>+ <XDSText type="body" color="secondary" size="sm">+ You will be redirected back after signing in.+ </XDSText>+ </XDSVStack>- {/* SSO info card */}- <XDSCard padding={0}>- <XDSSection variant="wash" padding={4}>- <XDSHStack gap={2} vAlign="center">- <XDSIcon icon={ShieldCheckIcon} color="secondary" />- <XDSVStack gap={0}>- <XDSText type="label">{provider.name}</XDSText>- <XDSText type="supporting" color="secondary">- {email}- </XDSText>- </XDSVStack>- </XDSHStack>- </XDSSection>- </XDSCard>+ <XDSCard padding={0}>+ <XDSSection variant="wash" padding={4}>+ <XDSHStack gap={2} vAlign="center">+ <XDSIcon icon={ShieldCheckIcon} color="secondary" />+ <XDSVStack gap={0}>+ <XDSText type="label">{provider.name}</XDSText>+ <XDSText type="supporting" color="secondary">+ {email}+ </XDSText>+ </XDSVStack>+ </XDSHStack>+ </XDSSection>+ </XDSCard>- <XDSVStack gap={3}>- <XDSButton- label={`Continue with ${provider.name}`}- variant="primary"- size="lg"- xstyle={styles.fullWidth}- />- <XDSButton- label="Use a different email"- variant="ghost"- size="lg"- xstyle={styles.fullWidth}- onClick={handleBack}- />- </XDSVStack>- </>- )}+ <XDSVStack gap={3}>+ <XDSButton+ label={`Continue with ${provider.name}`}+ variant="primary"+ size="lg"+ xstyle={styles.fullWidth}+ />+ <XDSButton+ label="Use a different email"+ variant="ghost"+ size="lg"+ xstyle={styles.fullWidth}+ onClick={handleBack}+ />+ </XDSVStack>+ </>+ )}- {/* ── Step 2b: No SSO — password fallback ── */}- {step === 'password-fallback' && (- <>- <XDSVStack hAlign="center" xstyle={styles.centered}>- <XDSVStack gap={1}>- <XDSHeading level={2}>Welcome back</XDSHeading>- <XDSText type="body" color="secondary" size="sm">- {email}- </XDSText>- </XDSVStack>- </XDSVStack>+ {/* ── Step 2b: No SSO — password fallback ── */}+ {step === 'password-fallback' && (+ <>+ <XDSVStack gap={1} hAlign="center">+ <XDSText type="display-1" as="h2">Welcome back</XDSText>+ <XDSText type="body" color="secondary" size="sm">+ {email}+ </XDSText>+ </XDSVStack>- <XDSVStack gap={4}>- <XDSVStack gap={1}>- <XDSTextInput- label="Password"- type="password"- value={password}- size="lg"- onChange={(v: string) => {- setPassword(v);- setLoginFailed(false);- }}- status={- loginFailed- ? {- type: 'error',- message: 'Incorrect password. Try again.',- }- : undefined- }- />- {loginFailed && (- <XDSVStack hAlign="end">- <XDSLink- label="Forgot password?"- href="#"- size="sm"- color="secondary"- type="supporting">- Forgot password?- </XDSLink>+ <XDSVStack gap={4}>+ <XDSVStack gap={1}>+ <XDSTextInput+ label="Password"+ type="password"+ value={password}+ size="lg"+ onChange={(v: string) => {+ setPassword(v);+ setLoginFailed(false);+ }}+ status={+ loginFailed+ ? {+ type: 'error',+ message: 'Incorrect password. Try again.',+ }+ : undefined+ }+ />+ {loginFailed && (+ <XDSVStack hAlign="end">+ <XDSLink+ label="Forgot password?"+ href="#"+ size="sm"+ color="secondary"+ type="supporting">+ Forgot password?+ </XDSLink>+ </XDSVStack>+ )}</XDSVStack>- )}- </XDSVStack>-- <XDSButton- label="Sign in"- variant="primary"- size="lg"- xstyle={styles.fullWidth}- onClick={() => setLoginFailed(true)}- />- <XDSButton- label="Use a different email"- variant="ghost"- size="lg"- xstyle={styles.fullWidth}- onClick={handleBack}- />- </XDSVStack>- </>- )}- </XDSVStack>- </XDSCard>- {/* Terms */}- <XDSVStack hAlign="center" xstyle={styles.termsFooter}>- <XDSText type="supporting" color="secondary" xstyle={styles.centered}>- By continuing, you agree to our{' '}- <XDSLink label="Terms of Service" href="#" type="supporting">- Terms of Service- </XDSLink>{' '}- and{' '}- <XDSLink label="Privacy Policy" href="#" type="supporting">- Privacy Policy- </XDSLink>- .- </XDSText>- </XDSVStack>- </XDSVStack>+ <XDSButton+ label="Sign in"+ variant="primary"+ size="lg"+ xstyle={styles.fullWidth}+ onClick={() => setLoginFailed(true)}+ />+ <XDSButton+ label="Use a different email"+ variant="ghost"+ size="lg"+ xstyle={styles.fullWidth}+ onClick={handleBack}+ />+ </XDSVStack>+ </>+ )}+ </XDSVStack>+ </XDSCard></XDSCenter>);}