An open source design system that's fully customizable and agent ready
TypeScript
feat: add Meta Theme (#692)
rubyycheungce390047fb52
diff --git a/apps/sandbox/next.config.mjs b/apps/sandbox/next.config.mjsindex 036ff9fdd9..d5a53a654f 100644--- a/apps/sandbox/next.config.mjs+++ b/apps/sandbox/next.config.mjs@@ -26,6 +26,7 @@ const nextConfig = {'@xds/theme-default','@xds/theme-neutral','@xds/theme-brutalist',+ '@xds/theme-meta',],images: {unoptimized: true,diff --git a/apps/sandbox/package.json b/apps/sandbox/package.jsonindex e50120a35d..14d88afa2c 100644--- a/apps/sandbox/package.json+++ b/apps/sandbox/package.json@@ -15,6 +15,7 @@"@xds/theme-default": "*","@xds/theme-neutral": "*","@xds/theme-brutalist": "*",+ "@xds/theme-meta": "*","@xds/theme-whatsapp": "*","next": "^15.5.14","react": "^19.2.4",diff --git a/apps/sandbox/src/app/SandboxNav.tsx b/apps/sandbox/src/app/SandboxNav.tsxindex 4733bf9b1b..4288fb685b 100644--- a/apps/sandbox/src/app/SandboxNav.tsx+++ b/apps/sandbox/src/app/SandboxNav.tsx@@ -58,6 +58,7 @@ export function SandboxNav() {{value: 'default', label: 'Default'},{value: 'neutral', label: 'Neutral'},{value: 'brutalist', label: 'Brutalist'},+ {value: 'meta', label: 'Meta'},{value: 'whatsapp', label: 'WhatsApp'},]}/>diff --git a/apps/sandbox/src/app/layout.tsx b/apps/sandbox/src/app/layout.tsxindex cf14bb9a8e..e7e090b295 100644--- a/apps/sandbox/src/app/layout.tsx+++ b/apps/sandbox/src/app/layout.tsx@@ -9,6 +9,7 @@ import type {Metadata} from 'next';* 3. @xds/theme-default/theme.css → @layer xds-theme (default theme)* 4. @xds/theme-neutral/theme.css → @layer xds-theme (neutral theme)* 5. @xds/theme-brutalist/theme.css → @layer xds-theme (brutalist theme)+ * 6. @xds/theme-meta/theme.css → @layer xds-theme (meta theme)** All theme CSS files are in @layer xds-theme and scoped via* @scope ([data-xds-theme="name"]), so only the active theme's rules apply.@@ -21,6 +22,7 @@ import '@xds/core/xds.css';import '@xds/theme-default/theme.css';import '@xds/theme-neutral/theme.css';import '@xds/theme-brutalist/theme.css';+import '@xds/theme-meta/theme.css';import {Providers} from './providers';export const metadata: Metadata = {diff --git a/apps/sandbox/src/app/providers.tsx b/apps/sandbox/src/app/providers.tsxindex 8c6ba35f7a..e029212cc3 100644--- a/apps/sandbox/src/app/providers.tsx+++ b/apps/sandbox/src/app/providers.tsx@@ -5,6 +5,7 @@ import {XDSTheme} from '@xds/core/theme';import {defaultTheme} from '@xds/theme-default';import {neutralTheme} from '@xds/theme-neutral';import {brutalistTheme} from '@xds/theme-brutalist';+import {metaTheme} from '@xds/theme-meta';import {whatsappTheme} from '@xds/theme-whatsapp';import type {XDSDefinedTheme, ThemeMode} from '@xds/core/theme';@@ -12,6 +13,7 @@ const themes: Record<string, XDSDefinedTheme> = {default: defaultTheme,neutral: neutralTheme,brutalist: brutalistTheme,+ meta: metaTheme,whatsapp: whatsappTheme,};diff --git a/apps/sandbox/src/components/MetaIllustrations.tsx b/apps/sandbox/src/components/MetaIllustrations.tsxnew file mode 100644index 0000000000..58dd8a4b17--- /dev/null+++ b/apps/sandbox/src/components/MetaIllustrations.tsx@@ -0,0 +1,706 @@+/**+ * Empty state illustrations for the Meta theme.+ *+ * Modern SVG illustrations that use XDS color tokens via CSS custom+ * properties. They adapt automatically to light/dark mode and any theme.+ *+ * Usage:+ * import { SearchIllustration } from '@xds/theme-meta';+ * <XDSEmptyState icon={<SearchIllustration />} title="No results" />+ */++import type {CSSProperties} from 'react';++interface IllustrationProps {+ /** Width in pixels. Height scales proportionally. @default 200 */+ size?: number;+ style?: CSSProperties;+ className?: string;+}++/**+ * No results / search empty state.+ * Browser window with magnifying glass.+ */+export function SearchIllustration({+ size = 200,+ style,+ className,+}: IllustrationProps) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 280 240"+ fill="none"+ width={size}+ height={size * (240 / 280)}+ style={style}+ className={className}+ aria-hidden="true">+ <defs>+ <filter id="es-s1" x="-20%" y="-10%" width="140%" height="140%">+ <feDropShadow+ dx="0"+ dy="6"+ stdDeviation="10"+ floodColor="var(--color-shadow, rgba(0,0,0,0.08))"+ />+ </filter>+ <filter id="es-s2" x="-20%" y="-10%" width="140%" height="130%">+ <feDropShadow+ dx="0"+ dy="4"+ stdDeviation="6"+ floodColor="var(--color-shadow, rgba(0,0,0,0.06))"+ />+ </filter>+ </defs>+ <g filter="url(#es-s1)">+ <rect+ x="50"+ y="52"+ width="148"+ height="112"+ rx="14"+ fill="var(--color-card, white)"+ />+ <rect+ x="50"+ y="52"+ width="148"+ height="30"+ rx="14"+ fill="var(--color-muted, #E8EAF0)"+ />+ <rect+ x="50"+ y="68"+ width="148"+ height="14"+ fill="var(--color-muted, #E8EAF0)"+ />+ <circle cx="68" cy="67" r="4.5" fill="#FF7B7B" />+ <circle cx="82" cy="67" r="4.5" fill="#FFB84D" />+ <circle cx="96" cy="67" r="4.5" fill="#4DC870" />+ <rect+ x="70"+ y="96"+ width="60"+ height="7"+ rx="3.5"+ fill="var(--color-border-emphasized, #D0D4DE)"+ />+ <rect+ x="70"+ y="111"+ width="44"+ height="7"+ rx="3.5"+ fill="var(--color-border, #D8DBE4)"+ />+ <rect+ x="70"+ y="126"+ width="52"+ height="7"+ rx="3.5"+ fill="var(--color-border, #DFE2EA)"+ />+ <rect+ x="70"+ y="141"+ width="34"+ height="7"+ rx="3.5"+ fill="var(--color-border, #E4E7EE)"+ />+ </g>+ <g transform="translate(195, 68)" filter="url(#es-s2)">+ <circle+ cx="0"+ cy="0"+ r="32"+ fill="var(--color-accent-muted, #D4E6FF)"+ stroke="var(--color-accent, #0064E0)"+ strokeWidth="4"+ />+ <line+ x1="22"+ y1="22"+ x2="42"+ y2="42"+ stroke="var(--color-accent, #0064E0)"+ strokeWidth="7"+ strokeLinecap="round"+ />+ <path+ d="M-14 -18 C-6 -26, 8 -26, 16 -18"+ stroke="var(--color-card, white)"+ strokeWidth="3.5"+ strokeLinecap="round"+ fill="none"+ opacity="0.8"+ />+ <path+ d="M-6 -8 C-6 -16, 8 -18, 8 -10 C8 -4, 0 -3, 0 1"+ stroke="var(--color-card, white)"+ strokeWidth="3.5"+ strokeLinecap="round"+ fill="none"+ opacity="0.9"+ />+ <circle+ cx="0"+ cy="9"+ r="3"+ fill="var(--color-card, white)"+ opacity="0.9"+ />+ </g>+ <circle+ cx="42"+ cy="82"+ r="20"+ fill="none"+ stroke="var(--color-accent, #0064E0)"+ strokeWidth="2.5"+ opacity="0.15"+ />+ <circle+ cx="42"+ cy="152"+ r="8"+ fill="var(--color-accent, #0064E0)"+ opacity="0.12"+ />+ <circle+ cx="252"+ cy="155"+ r="16"+ fill="none"+ stroke="var(--color-accent, #0064E0)"+ strokeWidth="2"+ opacity="0.1"+ />+ <circle+ cx="252"+ cy="108"+ r="6"+ fill="var(--color-accent, #0064E0)"+ opacity="0.1"+ />+ </svg>+ );+}++/**+ * Empty inbox / no messages.+ * Tray with floating envelopes.+ */+export function InboxIllustration({+ size = 200,+ style,+ className,+}: IllustrationProps) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 280 240"+ fill="none"+ width={size}+ height={size * (240 / 280)}+ style={style}+ className={className}+ aria-hidden="true">+ <defs>+ <filter id="ei-i1" x="-20%" y="-10%" width="140%" height="140%">+ <feDropShadow+ dx="0"+ dy="6"+ stdDeviation="10"+ floodColor="var(--color-shadow, rgba(0,0,0,0.08))"+ />+ </filter>+ <filter id="ei-i2" x="-20%" y="-10%" width="140%" height="130%">+ <feDropShadow+ dx="0"+ dy="4"+ stdDeviation="6"+ floodColor="var(--color-shadow, rgba(0,0,0,0.06))"+ />+ </filter>+ </defs>+ <g filter="url(#ei-i1)">+ <rect+ x="55"+ y="125"+ width="170"+ height="68"+ rx="20"+ fill="var(--color-card, white)"+ />+ <rect+ x="72"+ y="139"+ width="136"+ height="42"+ rx="12"+ fill="var(--color-muted, #E8EAF0)"+ />+ <rect+ x="55"+ y="125"+ width="170"+ height="30"+ rx="20"+ fill="var(--color-card, white)"+ />+ </g>+ <g transform="translate(108, 55)" filter="url(#ei-i2)">+ <rect+ x="-45"+ y="-28"+ width="90"+ height="56"+ rx="10"+ fill="var(--color-card, white)"+ stroke="var(--color-border-emphasized, #D0D4DE)"+ strokeWidth="2"+ />+ <path+ d="M-45 -28 L0 8 L45 -28"+ stroke="var(--color-border-strong, #C0C4D0)"+ strokeWidth="2.5"+ fill="none"+ />+ <circle+ cx="0"+ cy="15"+ r="10"+ fill="var(--color-accent, #0064E0)"+ opacity="0.2"+ />+ <circle+ cx="0"+ cy="15"+ r="5"+ fill="var(--color-accent, #0064E0)"+ opacity="0.45"+ />+ </g>+ <g transform="translate(200, 88) rotate(8)" filter="url(#ei-i2)">+ <rect+ x="-32"+ y="-22"+ width="64"+ height="44"+ rx="8"+ fill="var(--color-card, white)"+ stroke="var(--color-border-emphasized, #D0D4DE)"+ strokeWidth="1.5"+ />+ <path+ d="M-32 -22 L0 4 L32 -22"+ stroke="var(--color-border-strong, #C0C4D0)"+ strokeWidth="2"+ fill="none"+ />+ <rect+ x="-18"+ y="9"+ width="24"+ height="4"+ rx="2"+ fill="var(--color-accent, #0064E0)"+ opacity="0.25"+ />+ </g>+ <circle+ cx="48"+ cy="95"+ r="18"+ fill="none"+ stroke="var(--color-accent, #0064E0)"+ strokeWidth="2.5"+ opacity="0.15"+ />+ <circle+ cx="248"+ cy="70"+ r="14"+ fill="none"+ stroke="var(--color-accent, #0064E0)"+ strokeWidth="2"+ opacity="0.1"+ />+ <circle+ cx="42"+ cy="165"+ r="7"+ fill="var(--color-accent, #0064E0)"+ opacity="0.12"+ />+ <circle+ cx="255"+ cy="150"+ r="6"+ fill="var(--color-accent, #0064E0)"+ opacity="0.1"+ />+ </svg>+ );+}++/**+ * No data / empty chart.+ * Dashboard card with bar chart placeholder.+ */+export function NoDataIllustration({+ size = 200,+ style,+ className,+}: IllustrationProps) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 280 240"+ fill="none"+ width={size}+ height={size * (240 / 280)}+ style={style}+ className={className}+ aria-hidden="true">+ <defs>+ <filter id="ed-d1" x="-20%" y="-10%" width="140%" height="140%">+ <feDropShadow+ dx="0"+ dy="6"+ stdDeviation="10"+ floodColor="var(--color-shadow, rgba(0,0,0,0.08))"+ />+ </filter>+ </defs>+ <g filter="url(#ed-d1)">+ <rect+ x="40"+ y="38"+ width="200"+ height="155"+ rx="16"+ fill="var(--color-card, white)"+ />+ <rect+ x="62"+ y="58"+ width="60"+ height="7"+ rx="3.5"+ fill="var(--color-border-emphasized, #C8CCD6)"+ />+ <rect+ x="62"+ y="72"+ width="42"+ height="6"+ rx="3"+ fill="var(--color-border, #D8DBE4)"+ />+ </g>+ <rect+ x="68"+ y="108"+ width="32"+ height="62"+ rx="8"+ fill="var(--color-accent, #0064E0)"+ opacity="0.35"+ />+ <rect+ x="112"+ y="85"+ width="32"+ height="85"+ rx="8"+ fill="var(--color-accent, #0064E0)"+ opacity="0.5"+ />+ <rect+ x="156"+ y="118"+ width="32"+ height="52"+ rx="8"+ fill="var(--color-accent, #0064E0)"+ opacity="0.25"+ />+ <rect+ x="200"+ y="98"+ width="32"+ height="72"+ rx="8"+ fill="var(--color-accent, #0064E0)"+ opacity="0.4"+ />+ <path+ d="M84 100 C110 82, 144 115, 172 105 C188 99, 208 88, 216 92"+ stroke="var(--color-accent, #0064E0)"+ strokeWidth="3"+ strokeDasharray="7 5"+ fill="none"+ opacity="0.35"+ />+ <circle+ cx="32"+ cy="85"+ r="18"+ fill="none"+ stroke="var(--color-accent, #0064E0)"+ strokeWidth="2.5"+ opacity="0.15"+ />+ <circle+ cx="258"+ cy="60"+ r="7"+ fill="var(--color-accent, #0064E0)"+ opacity="0.12"+ />+ <circle+ cx="30"+ cy="170"+ r="6"+ fill="var(--color-accent, #0064E0)"+ opacity="0.1"+ />+ <circle+ cx="260"+ cy="140"+ r="14"+ fill="none"+ stroke="var(--color-accent, #0064E0)"+ strokeWidth="2"+ opacity="0.1"+ />+ </svg>+ );+}++/**+ * Error / something went wrong.+ * Document with error badge and gear.+ */+export function ErrorIllustration({+ size = 200,+ style,+ className,+}: IllustrationProps) {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 280 240"+ fill="none"+ width={size}+ height={size * (240 / 280)}+ style={style}+ className={className}+ aria-hidden="true">+ <defs>+ <filter id="ee-e1" x="-20%" y="-10%" width="140%" height="140%">+ <feDropShadow+ dx="0"+ dy="6"+ stdDeviation="10"+ floodColor="var(--color-shadow, rgba(0,0,0,0.08))"+ />+ </filter>+ <filter id="ee-e2" x="-20%" y="-10%" width="140%" height="130%">+ <feDropShadow+ dx="0"+ dy="4"+ stdDeviation="6"+ floodColor="var(--color-shadow, rgba(0,0,0,0.06))"+ />+ </filter>+ </defs>+ <g filter="url(#ee-e1)">+ <rect+ x="72"+ y="38"+ width="136"+ height="162"+ rx="14"+ fill="var(--color-card, white)"+ />+ <rect+ x="92"+ y="62"+ width="60"+ height="7"+ rx="3.5"+ fill="var(--color-border-emphasized, #D0D4DE)"+ />+ <rect+ x="92"+ y="77"+ width="42"+ height="6"+ rx="3"+ fill="var(--color-border, #D8DBE4)"+ />+ <rect+ x="92"+ y="100"+ width="96"+ height="6"+ rx="3"+ fill="var(--color-border, #E0E3EA)"+ />+ <rect+ x="92"+ y="114"+ width="74"+ height="6"+ rx="3"+ fill="var(--color-border, #E0E3EA)"+ />+ <rect+ x="92"+ y="128"+ width="84"+ height="6"+ rx="3"+ fill="var(--color-border, #E6E8EE)"+ />+ <rect+ x="92"+ y="142"+ width="58"+ height="6"+ rx="3"+ fill="var(--color-border, #E6E8EE)"+ />+ <rect+ x="92"+ y="156"+ width="68"+ height="6"+ rx="3"+ fill="var(--color-border, #ECEDF0)"+ />+ </g>+ <g transform="translate(190, 155)" filter="url(#ee-e2)">+ <circle+ cx="0"+ cy="0"+ r="35"+ fill="var(--color-error-muted, #FFE0E0)"+ stroke="var(--color-error, #D83030)"+ strokeWidth="3"+ />+ <line+ x1="-12"+ y1="-12"+ x2="12"+ y2="12"+ stroke="var(--color-error, #D83030)"+ strokeWidth="5.5"+ strokeLinecap="round"+ />+ <line+ x1="12"+ y1="-12"+ x2="-12"+ y2="12"+ stroke="var(--color-error, #D83030)"+ strokeWidth="5.5"+ strokeLinecap="round"+ />+ <ellipse+ cx="-9"+ cy="-14"+ rx="14"+ ry="9"+ fill="var(--color-card, white)"+ opacity="0.35"+ transform="rotate(-15)"+ />+ </g>+ <g transform="translate(48, 158)" filter="url(#ee-e2)" opacity="0.7">+ <circle cx="0" cy="0" r="20" fill="var(--color-muted, #E0E3EA)" />+ <circle+ cx="0"+ cy="0"+ r="8"+ fill="var(--color-card, white)"+ stroke="var(--color-border-emphasized, #CDD0DA)"+ strokeWidth="2.5"+ />+ <rect+ x="-5"+ y="-26"+ width="10"+ height="12"+ rx="4"+ fill="var(--color-muted, #E0E3EA)"+ />+ <rect+ x="-5"+ y="14"+ width="10"+ height="12"+ rx="4"+ fill="var(--color-muted, #E0E3EA)"+ />+ <rect+ x="-26"+ y="-5"+ width="12"+ height="10"+ rx="4"+ fill="var(--color-muted, #E0E3EA)"+ />+ <rect+ x="14"+ y="-5"+ width="12"+ height="10"+ rx="4"+ fill="var(--color-muted, #E0E3EA)"+ />+ </g>+ <circle+ cx="50"+ cy="65"+ r="16"+ fill="none"+ stroke="var(--color-error, #D83030)"+ strokeWidth="2.5"+ opacity="0.12"+ />+ <circle+ cx="248"+ cy="80"+ r="12"+ fill="none"+ stroke="var(--color-error, #D83030)"+ strokeWidth="2"+ opacity="0.1"+ />+ <circle+ cx="250"+ cy="190"+ r="6"+ fill="var(--color-error-muted, #FFD0D0)"+ opacity="0.35"+ />+ <circle+ cx="38"+ cy="110"+ r="5"+ fill="var(--color-error, #D83030)"+ opacity="0.08"+ />+ </svg>+ );+}diff --git a/package.json b/package.jsonindex 62807e6c16..9c68a8eb95 100644--- a/package.json+++ b/package.json@@ -9,7 +9,7 @@"internal/*"],"scripts": {- "build": "yarn workspace @xds/core build && yarn workspace @xds/theme-default build && yarn workspace @xds/theme-neutral build && yarn workspace @xds/theme-brutalist build && yarn workspace @xds/theme-whatsapp build",+ "build": "yarn workspace @xds/core build && yarn workspace @xds/theme-default build && yarn workspace @xds/theme-neutral build && yarn workspace @xds/theme-brutalist build && yarn workspace @xds/theme-whatsapp build && yarn workspace @xds/theme-meta build","dev": "yarn workspace @xds/storybook dev","test": "vitest run","test:watch": "vitest",diff --git a/packages/themes/meta/package.json b/packages/themes/meta/package.jsonnew file mode 100644index 0000000000..84b21362c7--- /dev/null+++ b/packages/themes/meta/package.json@@ -0,0 +1,36 @@+{+ "name": "@xds/theme-meta",+ "version": "0.0.1",+ "private": false,+ "description": "Meta theme for XDS components — Meta's brand identity with blue accent and clean aesthetics",+ "license": "MIT",+ "sideEffects": false,+ "main": "./dist/index.js",+ "types": "./dist/index.d.ts",+ "exports": {+ ".": {+ "types": "./dist/index.d.ts",+ "import": "./dist/index.mjs",+ "require": "./dist/index.js"+ },+ "./theme.css": "./dist/theme.css"+ },+ "files": [+ "dist",+ "src"+ ],+ "scripts": {+ "build": "xds theme build src/metaTheme.ts -o dist/theme.css && node scripts/gen-compat-css.mjs && tsup && rm -f dist/meta.js dist/meta.d.ts"+ },+ "dependencies": {+ "@heroicons/react": "^2.2.0"+ },+ "peerDependencies": {+ "@xds/core": "*",+ "react": ">=19"+ },+ "devDependencies": {+ "@xds/cli": "*"+ },+ "module": "./dist/index.mjs"+}diff --git a/packages/themes/meta/scripts/gen-compat-css.mjs b/packages/themes/meta/scripts/gen-compat-css.mjsnew file mode 100644index 0000000000..9cb857b20b--- /dev/null+++ b/packages/themes/meta/scripts/gen-compat-css.mjs@@ -0,0 +1,39 @@+/**+ * Generate theme-compat.css from theme.css+ *+ * Strips @scope and @layer, uses doubled [data-xds-theme] selector+ * for higher specificity (0,2,0) to beat StyleX's :root (0,1,0).+ */+import {readFileSync, writeFileSync} from 'fs';+import {dirname, join} from 'path';+import {fileURLToPath} from 'url';++const __dirname = dirname(fileURLToPath(import.meta.url));+const distDir = join(__dirname, '..', 'dist');++const css = readFileSync(join(distDir, 'theme.css'), 'utf8');++// Doubled selector = specificity (0,2,0), beats :root (0,1,0)+const varsSel = '[data-xds-theme="meta"][data-xds-theme="meta"]';+const ruleSel = '[data-xds-theme="meta"]';++// Extract :scope vars+const scopeMatch = css.match(/:scope\s*\{([^}]+)\}/);+const vars = scopeMatch?.[1]?.trim() ?? '';++// Extract .xds-* component rules+const xdsRules = css.match(/\.xds-[^{]+\{[^}]+\}/g) ?? [];++// Extract prose element rules+const proseRules =+ css.match(+ /(:is\(h[^}]+\}|h[1-6]\s*\{[^}]+\}|p\s*\{[^}]+\}|small\s*\{[^}]+\}|code[^}]*\{[^}]+\}|hr\s*\{[^}]+\})/g,+ ) ?? [];++let out = `/* Meta Theme — compat CSS (doubled selector for specificity) */\n\n`;+out += `${varsSel} {\n ${vars}\n}\n\n`;+for (const rule of xdsRules) out += `${ruleSel} ${rule}\n\n`;+for (const rule of proseRules) out += `${ruleSel} ${rule}\n\n`;++writeFileSync(join(distDir, 'theme-compat.css'), out);+console.log(`✓ dist/theme-compat.css (${out.length} bytes)`);diff --git a/packages/themes/meta/src/icons.tsx b/packages/themes/meta/src/icons.tsxnew file mode 100644index 0000000000..b8c7d73833--- /dev/null+++ b/packages/themes/meta/src/icons.tsx@@ -0,0 +1,58 @@+/**+ * @file icons.tsx+ * @input Uses @heroicons/react outline and solid icon components, XDSIconRegistry type+ * @output Exports metaIconRegistry for the Meta theme+ * @position Icon configuration for the Meta theme; consumed by index.ts+ *+ * Maps semantic icon names to Heroicons components.+ * Uses the same Heroicons library as the default theme —+ * Meta products use a similar clean outline icon style.+ */++import React from 'react';+import type {XDSIconRegistry} from '@xds/core/Icon';++import {+ XMarkIcon,+ ChevronDownIcon,+ ChevronLeftIcon,+ ChevronRightIcon,+ CheckIcon,+ CalendarDaysIcon,+ ClockIcon,+ InformationCircleIcon,+ Bars3Icon,+ EllipsisHorizontalIcon,+ MagnifyingGlassIcon,+} from '@heroicons/react/24/outline';++import {+ CheckCircleIcon,+ XCircleIcon,+ ExclamationTriangleIcon,+ ArrowTopRightOnSquareIcon,+} from '@heroicons/react/24/solid';++const iconProps = {+ width: '1em',+ height: '1em',+ 'aria-hidden': true as const,+};++export const metaIconRegistry: XDSIconRegistry = {+ close: <XMarkIcon {...iconProps} />,+ chevronDown: <ChevronDownIcon {...iconProps} />,+ chevronLeft: <ChevronLeftIcon {...iconProps} />,+ chevronRight: <ChevronRightIcon {...iconProps} />,+ check: <CheckIcon {...iconProps} />,+ checkCircle: <CheckCircleIcon {...iconProps} />,+ xCircle: <XCircleIcon {...iconProps} />,+ warning: <ExclamationTriangleIcon {...iconProps} />,+ info: <InformationCircleIcon {...iconProps} />,+ calendar: <CalendarDaysIcon {...iconProps} />,+ clock: <ClockIcon {...iconProps} />,+ externalLink: <ArrowTopRightOnSquareIcon {...iconProps} />,+ menu: <Bars3Icon {...iconProps} />,+ moreHorizontal: <EllipsisHorizontalIcon {...iconProps} />,+ search: <MagnifyingGlassIcon {...iconProps} />,+};diff --git a/packages/themes/meta/src/index.ts b/packages/themes/meta/src/index.tsnew file mode 100644index 0000000000..bfc1da7eb1--- /dev/null+++ b/packages/themes/meta/src/index.ts@@ -0,0 +1,2 @@+export {metaTheme} from './metaTheme';+export {metaIconRegistry} from './icons';diff --git a/packages/themes/meta/src/metaTheme.ts b/packages/themes/meta/src/metaTheme.tsnew file mode 100644index 0000000000..5186308017--- /dev/null+++ b/packages/themes/meta/src/metaTheme.ts@@ -0,0 +1,437 @@+/**+ * Meta Theme for XDS+ *+ * Color tokens derived from CDS (Core Design System) — Meta's internal+ * design system platform. All color values map to the XMDS 3.0 palette.+ *+ * Component overrides use xdsClassName class targeting (#763), pseudo-class+ * selectors (#811), and the defineTheme variants field (#790).+ * No core CSS custom properties needed — all theming is pure defineTheme.+ */++import {defineTheme} from '@xds/core/theme';+import {metaIconRegistry} from './icons';++export const metaTheme = defineTheme({+ name: 'meta',++ // Typography — Figtree font family, default scale+ typography: {+ scale: {base: 14, ratio: 1.2},+ body: {+ family: 'Figtree',+ fallbacks:+ '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", Helvetica, Arial, sans-serif',+ url: 'https://fonts.googleapis.com/css2?family=Figtree:ital,wght@0,300..900;1,300..900&display=swap',+ },+ code: {+ family: 'SF Mono',+ fallbacks: '"Cascadia Code", "Segoe UI Mono", Menlo, Consolas, monospace',+ },+ },++ // Motion — default Meta timing+ motion: {fast: 175, medium: 410, ratio: 0.75},++ tokens: {+ // =========================================================================+ // Core Accent — Meta Blue (CDS: PRIMARY_BUTTON_BACKGROUND = BLUE_500)+ // =========================================================================+ '--color-accent': ['#0064E0', '#0064E0'],+ '--color-accent-muted': ['#0064E033', '#0082FB3F'],+ '--color-on-accent': ['#FFFFFF', '#FFFFFF'],++ // =========================================================================+ // Surfaces+ // =========================================================================+ '--color-background-surface': ['#FFFFFF', '#1F1F22'],+ '--color-background-body': ['#F2F4F6', '#111112'],+ '--color-background-card': ['#FFFFFF', '#1F1F20'],+ '--color-background-popover': ['#FFFFFF', '#1F1F20'],+ '--color-background-muted': ['#F2F4F6', '#28292C'],+ '--color-overlay': ['#1111121F', '#11111299'],+ '--color-overlay-hover': [+ 'rgba(17, 17, 18, 0.05)',+ 'rgba(242, 244, 246, 0.05)',+ ],+ '--color-overlay-pressed': [+ 'rgba(17, 17, 18, 0.08)',+ 'rgba(242, 244, 246, 0.08)',+ ],+ '--color-neutral': ['rgba(17, 17, 18, 0.06)', 'rgba(242, 244, 246, 0.1)'],++ // =========================================================================+ // Text+ // =========================================================================+ '--color-text-primary': ['#111112', '#F3F4F5'],+ '--color-text-secondary': ['#5D6C7B', '#AAAFB5'],+ '--color-text-disabled': ['#96A6B4', '#6F747C'],+ '--color-text-accent': ['#0064E0', '#0064E0'],+ '--color-on-dark': ['#FFFFFF', '#FFFFFF'],+ '--color-on-light': ['#000000', '#000000'],++ // =========================================================================+ // Icons+ // =========================================================================+ '--color-icon-primary': ['#111112', '#F2F4F6'],+ '--color-icon-secondary': ['#5D6C7B', '#AAAFB5'],+ '--color-icon-disabled': ['#DDE2E8', '#6F747C'],+ '--color-icon-accent': ['#0064E0', '#0064E0'],++ // =========================================================================+ // Status — CDS: NEGATIVE, POSITIVE, WARNING+ // =========================================================================+ '--color-success': ['#147B29', '#3CBC22'],+ '--color-success-muted': [+ 'rgba(20, 123, 41, 0.1)',+ 'rgba(60, 188, 34, 0.15)',+ ],+ '--color-on-success': ['#FFFFFF', '#FFFFFF'],+ '--color-error': ['#D31130', '#FB7D87'],+ '--color-error-muted': [+ 'rgba(211, 17, 48, 0.1)',+ 'rgba(251, 125, 135, 0.15)',+ ],+ '--color-on-error': ['#FFFFFF', '#FFFFFF'],+ '--color-warning': ['#965E03', '#D69804'],+ '--color-warning-muted': [+ 'rgba(150, 94, 3, 0.1)',+ 'rgba(214, 152, 4, 0.15)',+ ],+ '--color-on-warning': ['#0A1317', '#0A1317'],++ // =========================================================================+ // Borders+ // =========================================================================+ '--color-border': ['#DDE2E8', '#F2F4F619'],+ '--color-border-emphasized': ['#DDE2E8', '#494D53'],++ // =========================================================================+ // Effects+ // =========================================================================+ '--color-skeleton': ['#E7EAED', '#28292C'],+ '--color-shadow': ['rgba(17, 17, 18, 0.12)', 'rgba(17, 17, 18, 0.12)'],+ '--color-tint-hover': ['black', 'white'],++ // =========================================================================+ // Named palette — CDS XMDS 3.0 color ramps+ // =========================================================================+ '--color-background-blue': ['#D7E9FF', '#001F4C'],+ '--color-border-blue': ['#0044A3', '#3087FF'],+ '--color-icon-blue': ['#0044A3', '#3087FF'],+ '--color-text-blue': ['#003B8E', '#4D99FF'],++ '--color-background-gray': ['#F2F4F6', '#28292C'],+ '--color-border-gray': ['#DFE2E5', '#494D53'],+ '--color-icon-gray': ['#666A72', '#9FA4AB'],+ '--color-text-gray': ['#111112', '#F2F4F6'],++ '--color-background-green': ['#C4F8B9', '#053018'],+ '--color-border-green': ['#147B29', '#3CBC22'],+ '--color-icon-green': ['#147B29', '#3CBC22'],+ '--color-text-green': ['#076D29', '#4EC72A'],++ '--color-background-red': ['#FEE4E6', '#5A0107'],+ '--color-border-red': ['#D31130', '#FB7D87'],+ '--color-icon-red': ['#D31130', '#FB7D87'],+ '--color-text-red': ['#BE0424', '#FD8E99'],++ '--color-background-orange': ['#FFE6CF', '#4E1608'],+ '--color-border-orange': ['#B34A01', '#F88617'],+ '--color-icon-orange': ['#B34A01', '#F88617'],+ '--color-text-orange': ['#A13F04', '#FD9537'],++ '--color-background-yellow': ['#FCEC85', '#451E03'],+ '--color-border-yellow': ['#965E03', '#D69804'],+ '--color-icon-yellow': ['#965E03', '#D69804'],+ '--color-text-yellow': ['#8A5001', '#E2A400'],++ '--color-background-purple': ['#ECE2FF', '#140036'],+ '--color-border-purple': ['#5828CA', '#9B73FF'],+ '--color-icon-purple': ['#5828CA', '#9B73FF'],+ '--color-text-purple': ['#4D1EB6', '#A985FF'],++ '--color-background-pink': ['#FFE1ED', '#520019'],+ '--color-border-pink': ['#C71050', '#FE73A1'],+ '--color-icon-pink': ['#C71050', '#FE73A1'],+ '--color-text-pink': ['#B30543', '#FF85B0'],++ '--color-background-cyan': ['#C7F1FF', '#001B2A'],+ '--color-border-cyan': ['#006BA3', '#00AFFA'],+ '--color-icon-cyan': ['#006BA3', '#00AFFA'],+ '--color-text-cyan': ['#005F91', '#21BDFF'],++ '--color-background-teal': ['#BCF5F0', '#062D38'],+ '--color-border-teal': ['#08767D', '#0DB7AF'],+ '--color-icon-teal': ['#08767D', '#0DB7AF'],+ '--color-text-teal': ['#0F686F', '#1DC3B9'],++ // =========================================================================+ // Radius — Meta-style generous rounding+ // =========================================================================+ '--radius-none': '4px',+ '--radius-inner': '8px',+ '--radius-element': '12px',+ '--radius-container': '16px',+ '--radius-page': '32px',+ '--radius-full': '9999px',++ // =========================================================================+ // Text size overrides+ // =========================================================================+ '--font-size-2xl': '1.75rem', // 28px — heading 1+ },++ components: {+ // =========================================================================+ // Button — pill shape, medium weight, custom muted/outline variants+ // =========================================================================+ button: {+ base: {+ borderRadius: '9999px !important',+ },+ 'variant:primary': {fontWeight: '500'},+ 'variant:secondary': {fontWeight: '500'},+ 'variant:destructive': {fontWeight: '500'},+ 'variant:ghost': {fontWeight: '500'},+ 'variant:primary-muted': {+ backgroundColor: 'light-dark(#ECF5FF, #182849)',+ color: 'light-dark(#0457CB, #78BEFF)',+ fontWeight: '500',+ },+ 'variant:destructive-muted': {+ backgroundColor: 'light-dark(#FFF0F2, #471B1A)',+ color: 'light-dark(var(--color-error), #FE9DA6)',+ fontWeight: '500',+ },+ 'variant:primary-outline': {+ backgroundColor: 'transparent',+ borderWidth: '1px',+ borderStyle: 'solid',+ borderColor: 'light-dark(var(--color-accent), #4BA9FE)',+ color: 'light-dark(var(--color-accent), #4BA9FE)',+ fontWeight: '500',+ },+ 'variant:secondary-outline': {+ backgroundColor: 'transparent',+ borderWidth: '1px',+ borderStyle: 'solid',+ borderColor: 'light-dark(var(--color-border), #525456)',+ color: 'light-dark(var(--color-text-primary), #F3F4F5)',+ fontWeight: '500',+ },+ 'variant:destructive-outline': {+ backgroundColor: 'transparent',+ borderWidth: '1px',+ borderStyle: 'solid',+ borderColor: 'light-dark(var(--color-error), #FB7D87)',+ color: 'light-dark(var(--color-error), #FB7D87)',+ fontWeight: '500',+ },+ },++ // =========================================================================+ // Card — 20px padding, 32px radius+ // =========================================================================+ card: {+ base: {+ '--xds-card-padding': '20px',+ '--card-radius': '32px',+ },+ },++ // =========================================================================+ // Section — 20px padding+ // =========================================================================+ section: {+ base: {+ '--xds-section-padding': '20px',+ },+ },++ // =========================================================================+ // Field status — plain text (no background pill)+ // =========================================================================+ 'field-status': {+ base: {+ backgroundColor: 'transparent',+ paddingBlock: '0',+ paddingInline: '0',+ },+ },++ // =========================================================================+ // Text input — search variant pill+ // =========================================================================+ 'text-input': {+ 'variant:search': {+ backgroundColor: 'light-dark(#F3F4F5, #28292C)',+ borderColor: 'transparent',+ borderRadius: '9999px',+ },+ },++ // =========================================================================+ // Banner — per-status card bg (#810), primary icon, 32px radius+ // =========================================================================+ banner: {+ base: {+ '--banner-radius': '32px',+ },+ 'status:info': {backgroundColor: 'var(--color-background-card)'},+ 'status:warning': {backgroundColor: 'var(--color-background-card)'},+ 'status:error': {backgroundColor: 'var(--color-background-card)'},+ 'status:success': {backgroundColor: 'var(--color-background-card)'},+ },+ 'banner-icon': {+ base: {color: 'var(--color-icon-primary)'},+ },++ // =========================================================================+ // Badge — subtle pastel backgrounds+ // =========================================================================+ badge: {+ base: {fontWeight: '500'},+ 'variant:info': {+ backgroundColor: 'light-dark(#DBECFF, #14367E)',+ color: 'var(--color-text-primary)',+ },+ 'variant:success': {+ backgroundColor: 'light-dark(#DAF0D4, #154321)',+ color: 'var(--color-text-primary)',+ },+ 'variant:warning': {+ backgroundColor: 'light-dark(#FAEBA4, #5B2F05)',+ color: 'var(--color-text-primary)',+ },+ 'variant:error': {+ backgroundColor: 'light-dark(#FEE4E6, #73161A)',+ color: 'var(--color-text-primary)',+ },+ },++ // =========================================================================+ // Radio — ring style via pseudo-class overrides (#811)+ // =========================================================================+ radio: {+ base: {+ borderColor: '#8F9296',+ borderWidth: '2px',+ },+ ':hover': {+ borderColor: 'color-mix(in srgb, #8F9296, black 20%)',+ },+ },+ 'radio-dot': {+ base: {+ backgroundColor: 'var(--color-accent)',+ width: '14px',+ height: '14px',+ },+ },++ // =========================================================================+ // Checkbox — thicker border, pseudo-class hover (#811)+ // =========================================================================+ checkbox: {+ base: {+ borderColor: '#8F9296',+ borderWidth: '2px',+ borderRadius: '4px',+ },+ ':hover': {+ borderColor: 'color-mix(in srgb, #8F9296, black 20%)',+ },+ },++ // =========================================================================+ // Switch — gray track, pseudo-class hover (#811)+ // =========================================================================+ switch: {+ base: {backgroundColor: '#8F9296'},+ ':hover': {+ backgroundColor: 'color-mix(in srgb, #8F9296, black 5%)',+ },+ },+ 'switch-thumb': {+ base: {+ boxShadow: '0 1px 3px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.15)',+ width: '22px',+ height: '22px',+ },+ },++ // =========================================================================+ // Slider — custom track via sub-element target (#763)+ // =========================================================================+ 'slider-track': {+ base: {backgroundColor: '#8F9296'},+ },++ // =========================================================================+ // Calendar — selected date via state class (#763)+ // =========================================================================+ 'calendar-day': {+ selected: {backgroundColor: 'var(--color-accent)'},+ },++ // =========================================================================+ // Empty state — heading 1 size+ // =========================================================================+ 'emptystate-title': {+ base: {fontSize: '1.75rem'},+ },++ // =========================================================================+ // Dialog — custom bg, 32px radius+ // =========================================================================+ dialog: {+ base: {+ backgroundColor: 'light-dark(var(--color-background-surface), #1F1F20)',+ '--dialog-radius': '32px',+ '--xds-card-padding': '20px',+ },+ },++ // =========================================================================+ // Layout — dialog internals: no borders, no body padding+ // =========================================================================+ 'layout-header': {+ base: {borderBlockEndWidth: '0'},+ },+ 'layout-content': {+ base: {paddingBlockStart: '0', paddingBlockEnd: '0'},+ },+ 'layout-footer': {+ base: {borderBlockStartWidth: '0'},+ },++ // =========================================================================+ // Popover / Menu — generous radius+ // =========================================================================+ popover: {+ base: {+ borderRadius: '16px',+ padding: '16px !important',+ },+ },+ 'dropdown-menu': {+ base: {+ '--dropdown-radius': '16px',+ '--dropdown-padding': '8px',+ padding: '8px !important',+ },+ },+ 'more-menu': {+ base: {+ borderRadius: '16px',+ padding: '8px !important',+ },+ },+ tooltip: {+ base: {borderRadius: '16px'},+ },+ },++ icons: metaIconRegistry,+});diff --git a/packages/themes/meta/tsup.config.ts b/packages/themes/meta/tsup.config.tsnew file mode 100644index 0000000000..176795f3bb--- /dev/null+++ b/packages/themes/meta/tsup.config.ts@@ -0,0 +1,9 @@+import {defineConfig} from 'tsup';++export default defineConfig({+ entry: ['src/index.ts'],+ format: ['cjs', 'esm'],+ dts: true,+ clean: false, // Don't clean — xds build-theme already put theme.css in dist/+ external: ['@xds/core', 'react'],+});