An open source design system that's fully customizable and agent ready
TypeScript
feat(theme): add Stone theme (#2020)
rubyycheung30e9d122fd08
diff --git a/package.json b/package.jsonindex 9e633cfd55..5e48c5028b 100644--- a/package.json+++ b/package.json@@ -10,7 +10,7 @@"internal/*"],"scripts": {- "build": "yarn workspace @xds/core build && yarn workspace @xds/vega build && yarn workspace @xds/theme-default build && yarn workspace @xds/theme-neutral build && yarn workspace @xds/theme-brutalist build && yarn workspace @xds/theme-daily build && yarn workspace @xds/theme-matcha build",+ "build": "yarn workspace @xds/core build && yarn workspace @xds/vega build && yarn workspace @xds/theme-default build && yarn workspace @xds/theme-neutral build && yarn workspace @xds/theme-brutalist build && yarn workspace @xds/theme-daily build && yarn workspace @xds/theme-matcha build && yarn workspace @xds/theme-stone build","dev": "yarn workspace @xds/storybook dev","test": "vitest run","test:watch": "vitest",diff --git a/packages/themes/stone/README.md b/packages/themes/stone/README.mdnew file mode 100644index 0000000000..72b346bf9f--- /dev/null+++ b/packages/themes/stone/README.md@@ -0,0 +1,44 @@+# @xds/theme-stone++Warm stone and slate theme with earthy neutral tones. Uses Montserrat for headings, Figtree for body text, and [Lucide](https://lucide.dev) icons.++## Install++```bash+npm install @xds/theme-stone+```++## Usage++Wrap your app with `XDSTheme` and pass the theme:++```tsx+import {XDSTheme} from '@xds/core/theme';+import {stoneTheme} from '@xds/theme-stone/built';++function App() {+ return (+ <XDSTheme theme={stoneTheme}>+ {/* your app */}+ </XDSTheme>+ );+}+```++### Import paths++| Path | Use case |+|------|----------|+| `@xds/theme-stone` | Source build (StyleX compilation via `@xds/build`) |+| `@xds/theme-stone/built` | Pre-built dist (Tailwind, plain CSS, or no build step) |+| `@xds/theme-stone/theme.css` | Pre-built CSS file (import in your stylesheet) |++If you're using `@xds/build` for StyleX source compilation, import from the bare path. Otherwise, use `/built`.++### CSS import++Add the theme CSS to your stylesheet:++```css+@import "@xds/theme-stone/theme.css";+```diff --git a/packages/themes/stone/package.json b/packages/themes/stone/package.jsonnew file mode 100644index 0000000000..55e3c2be9a--- /dev/null+++ b/packages/themes/stone/package.json@@ -0,0 +1,62 @@+{+ "name": "@xds/theme-stone",+ "version": "0.0.13",+ "displayName": "Stone Theme",+ "private": false,+ "description": "Warm stone and slate theme for XDS \u2014 earthy neutral palette with Montserrat headings, Figtree body, and Lucide icons",+ "author": "Meta Open Source",+ "license": "MIT",+ "homepage": "https://github.com/facebookexperimental/xds#readme",+ "repository": {+ "type": "git",+ "url": "git+https://github.com/facebookexperimental/xds.git",+ "directory": "packages/themes/stone"+ },+ "bugs": {+ "url": "https://github.com/facebookexperimental/xds/issues"+ },+ "keywords": [+ "xds",+ "theme",+ "design-system",+ "lucide",+ "design-tokens"+ ],+ "sideEffects": false,+ "main": "./dist/source.js",+ "types": "./dist/source.d.ts",+ "exports": {+ ".": {+ "types": "./dist/source.d.ts",+ "import": "./dist/source.mjs",+ "require": "./dist/source.js"+ },+ "./built": {+ "types": "./dist/stone.d.ts",+ "import": "./dist/stone.js",+ "require": "./dist/stone.js"+ },+ "./theme.css": {+ "types": "./theme.css.d.ts",+ "default": "./dist/theme.css"+ }+ },+ "files": [+ "dist",+ "src"+ ],+ "scripts": {+ "build": "xds theme build src/stoneTheme.ts -o dist/theme.css && tsup && tsc --project tsconfig.build.json"+ },+ "dependencies": {+ "lucide-react": "^1.14.0"+ },+ "peerDependencies": {+ "@xds/core": "0.0.13",+ "react": ">=19"+ },+ "devDependencies": {+ "@xds/cli": "0.0.13"+ },+ "module": "./dist/source.mjs"+}diff --git a/packages/themes/stone/src/icons.tsx b/packages/themes/stone/src/icons.tsxnew file mode 100644index 0000000000..4dd82ce7f1--- /dev/null+++ b/packages/themes/stone/src/icons.tsx@@ -0,0 +1,76 @@+/**+ * @file icons.tsx+ * @input Uses lucide-react icon components, XDSIconRegistry type+ * @output Exports stoneIconRegistry for the neutral theme+ * @position Icon configuration for the neutral theme; consumed by index.ts+ *+ * Maps semantic icon names to Lucide icon components.+ * These icons are bundled with the theme, not with @xds/core.+ */++import React from 'react';+import type {XDSIconRegistry} from '@xds/core/Icon';++import {+ X,+ ChevronDown,+ ChevronLeft,+ ChevronRight,+ Check,+ CheckCircle,+ XCircle,+ AlertTriangle,+ Info,+ Calendar,+ Clock,+ ExternalLink,+ Menu,+ MoreHorizontal,+ Search,+ ArrowUp,+ ArrowDown,+ ArrowUpDown,+ Filter,+ EyeOff,+ Columns,+ Copy,+ CheckCheck,+ Wrench,+ Square,+ Mic,+ CircleDot,+} from 'lucide-react';++const iconProps = {+ size: '1em',+ 'aria-hidden': true as const,+};++export const stoneIconRegistry: XDSIconRegistry = {+ close: <X {...iconProps} />,+ chevronDown: <ChevronDown {...iconProps} />,+ chevronLeft: <ChevronLeft {...iconProps} />,+ chevronRight: <ChevronRight {...iconProps} />,+ check: <Check {...iconProps} />,+ success: <CheckCircle {...iconProps} />,+ error: <XCircle {...iconProps} />,+ warning: <AlertTriangle {...iconProps} />,+ info: <Info {...iconProps} />,+ calendar: <Calendar {...iconProps} />,+ clock: <Clock {...iconProps} />,+ externalLink: <ExternalLink {...iconProps} />,+ menu: <Menu {...iconProps} />,+ moreHorizontal: <MoreHorizontal {...iconProps} />,+ search: <Search {...iconProps} />,+ arrowUp: <ArrowUp {...iconProps} />,+ arrowDown: <ArrowDown {...iconProps} />,+ arrowsUpDown: <ArrowUpDown {...iconProps} />,+ funnel: <Filter {...iconProps} />,+ eyeSlash: <EyeOff {...iconProps} />,+ viewColumns: <Columns {...iconProps} />,+ copy: <Copy {...iconProps} />,+ checkDouble: <CheckCheck {...iconProps} />,+ wrench: <Wrench {...iconProps} />,+ stop: <Square {...iconProps} />,+ microphone: <Mic {...iconProps} />,+};diff --git a/packages/themes/stone/src/source.ts b/packages/themes/stone/src/source.tsnew file mode 100644index 0000000000..78ae78f362--- /dev/null+++ b/packages/themes/stone/src/source.ts@@ -0,0 +1,2 @@+export {stoneTheme} from './stoneTheme';+export {stoneIconRegistry} from './icons';diff --git a/packages/themes/stone/src/stoneTheme.ts b/packages/themes/stone/src/stoneTheme.tsnew file mode 100644index 0000000000..fc872037ac--- /dev/null+++ b/packages/themes/stone/src/stoneTheme.ts@@ -0,0 +1,228 @@+/**+ * Stone Theme+ *+ * A warm, earthy neutral theme inspired by natural stone and sandstone.+ * Core palette: #28282A, #84848B, #D8D8DB, #F5F5F3, #FFFFFF+ * Uses Montserrat for headings and Figtree for body text.+ */++import {defineTheme, defineSyntaxTheme} from '@xds/core/theme';+import {stoneIconRegistry} from './icons';++/** Stone syntax palette — warm, muted tones to match the earthy aesthetic. */+const stoneSyntax = defineSyntaxTheme({+ name: 'xds-stone',+ tokens: {+ keyword: ['#7c5e3a', '#c4a882'],+ string: ['#2e6b4a', '#7bc49e'],+ comment: ['#84848B', '#84848B'],+ number: ['#a16830', '#d4a06a'],+ function: ['#3a5e8c', '#7ba8d4'],+ type: ['#6b4a8c', '#b08ed4'],+ variable: ['#28282A', '#D8D8DB'],+ operator: ['#84848B', '#a1a1a6'],+ constant: ['#a16830', '#d4a06a'],+ tag: ['#b5463a', '#e08a82'],+ attribute: ['#8c6b30', '#d4b870'],+ property: ['#3a7c6b', '#70c4b0'],+ punctuation: ['#84848B', '#5a5a60'],+ background: ['#F5F5F3', '#1a1a1c'],+ },+});++export const stoneTheme = defineTheme({+ name: 'stone',++ typography: {+ scale: {base: 14, ratio: 1.2},+ body: {+ family: 'Figtree',+ fallbacks:+ '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',+ },+ heading: {+ family: 'Montserrat',+ fallbacks:+ '"Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif',+ weights: {3: 'bold', 4: 'bold'},+ },+ code: {+ family: 'JetBrains Mono',+ fallbacks: '"SF Mono", Monaco, Consolas, monospace',+ },+ },++ motion: {fast: 125, medium: 300, slow: 700, ratio: 0.75},++ syntax: stoneSyntax,++ tokens: {+ // =========================================================================+ // Colors — warm stone palette+ // Core: #28282A, #84848B, #D8D8DB, #F5F5F3, #FFFFFF+ // =========================================================================++ // Core semantic+ '--color-accent': ['#28282A', '#F5F5F3'],+ '--color-accent-muted': ['#28282A14', '#F5F5F320'],+ '--color-neutral': ['#28282A0F', '#F5F5F31A'],+ '--color-background-surface': ['#FFFFFF', '#1a1a1c'],+ '--color-background-body': ['#F5F5F3', '#111113'],+ '--color-overlay': ['#28282A80', '#28282ACC'],+ '--color-overlay-hover': ['#28282A0D', '#F5F5F30D'],+ '--color-overlay-pressed': ['#28282A1A', '#F5F5F31A'],+ '--color-background-muted': ['#F5F5F3', '#28282A'],++ // Text+ '--color-text-primary': ['#28282A', '#F5F5F3'],+ '--color-text-secondary': ['#84848B', '#a1a1a6'],+ '--color-text-disabled': ['#D8D8DB', '#5a5a60'],+ '--color-text-accent': ['#28282A', '#F5F5F3'],+ '--color-on-dark': '#FFFFFF',+ '--color-on-light': '#28282A',+ '--color-on-accent': ['#FFFFFF', '#28282A'],+ '--color-on-success': ['#FFFFFF', '#28282A'],+ '--color-on-error': ['#FFFFFF', '#28282A'],+ '--color-on-warning': ['#28282A', '#28282A'],++ // Icon+ '--color-icon-accent': ['#28282A', '#F5F5F3'],+ '--color-icon-primary': ['#28282A', '#F5F5F3'],+ '--color-icon-secondary': ['#84848B', '#a1a1a6'],+ '--color-icon-disabled': ['#D8D8DB', '#5a5a60'],++ // Surface variants+ '--color-background-card': ['#FFFFFF', '#1e1e20'],+ '--color-background-popover': ['#FFFFFF', '#28282A'],+ '--color-background-inverted': ['#28282A', '#F5F5F3'],++ // Status / Sentiment+ '--color-success': ['#109936', '#34c265'],+ '--color-success-muted': ['#10993620', '#34c26520'],+ '--color-error': ['#FD0000', '#ff5c5c'],+ '--color-error-muted': ['#FD000020', '#ff5c5c20'],+ '--color-warning': ['#FFB600', '#ffc940'],+ '--color-warning-muted': ['#FFB60020', '#ffc94020'],++ // Border+ '--color-border': ['#D8D8DB', '#F5F5F31A'],+ '--color-border-emphasized': ['#84848B', '#5a5a60'],++ // Effects+ '--color-skeleton': ['#D8D8DB', '#5a5a60'],+ '--color-shadow': ['#28282A1A', '#0000004D'],+ '--color-tint-hover': ['black', 'white'],++ // Categorical — Blue+ '--color-background-blue': ['#3a5e8c33', '#3a5e8c33'],+ '--color-border-blue': ['#3a5e8c', '#7ba8d4'],+ '--color-icon-blue': ['#3a5e8c', '#7ba8d4'],+ '--color-text-blue': ['#2e4a6e', '#8dbce0'],++ // Categorical — Cyan+ '--color-background-cyan': ['#3a7c7c33', '#3a7c7c33'],+ '--color-border-cyan': ['#3a7c7c', '#70c4c4'],+ '--color-icon-cyan': ['#3a7c7c', '#70c4c4'],+ '--color-text-cyan': ['#2e6060', '#82d4d4'],++ // Categorical — Gray+ '--color-background-gray': ['#84848B33', '#5a5a6033'],+ '--color-border-gray': ['#84848B', '#84848B'],+ '--color-icon-gray': ['#84848B', '#a1a1a6'],+ '--color-text-gray': ['#28282A', '#F5F5F3'],++ // Categorical — Green+ '--color-background-green': ['#10993633', '#34c26533'],+ '--color-border-green': ['#109936', '#34c265'],+ '--color-icon-green': ['#109936', '#34c265'],+ '--color-text-green': ['#0d7a2b', '#3fd672'],++ // Categorical — Orange+ '--color-background-orange': ['#c4762033', '#d4903a33'],+ '--color-border-orange': ['#c47620', '#d4903a'],+ '--color-icon-orange': ['#c47620', '#d4903a'],+ '--color-text-orange': ['#a06018', '#e0a04a'],++ // Categorical — Pink+ '--color-background-pink': ['#c44a7033', '#e07a9a33'],+ '--color-border-pink': ['#c44a70', '#e07a9a'],+ '--color-icon-pink': ['#c44a70', '#e07a9a'],+ '--color-text-pink': ['#a03a5a', '#f08aaa'],++ // Categorical — Purple+ '--color-background-purple': ['#6b4a8c33', '#b08ed433'],+ '--color-border-purple': ['#6b4a8c', '#b08ed4'],+ '--color-icon-purple': ['#6b4a8c', '#b08ed4'],+ '--color-text-purple': ['#553a70', '#c0a0e0'],++ // Categorical — Red+ '--color-background-red': ['#FD000033', '#ff5c5c33'],+ '--color-border-red': ['#FD0000', '#ff5c5c'],+ '--color-icon-red': ['#FD0000', '#ff5c5c'],+ '--color-text-red': ['#cc0000', '#ff7a7a'],++ // Categorical — Teal+ '--color-background-teal': ['#2e6b5a33', '#5ab89833'],+ '--color-border-teal': ['#2e6b5a', '#5ab898'],+ '--color-icon-teal': ['#2e6b5a', '#5ab898'],+ '--color-text-teal': ['#245546', '#6ccaaa'],++ // Categorical — Yellow+ '--color-background-yellow': ['#FFB60033', '#ffc94033'],+ '--color-border-yellow': ['#FFB600', '#ffc940'],+ '--color-icon-yellow': ['#FFB600', '#ffc940'],+ '--color-text-yellow': ['#cc9200', '#ffd960'],++ // =========================================================================+ // Radius — clean and subtle+ // =========================================================================+ '--radius-none': '0.125rem',+ '--radius-inner': '0.25rem',+ '--radius-element': '0.5rem',+ '--radius-container': '0.75rem',+ '--radius-page': '1.5rem',+ '--radius-full': '9999px',++ // =========================================================================+ // Shadows+ // =========================================================================+ '--shadow-low':+ '0 2px 4px #28282A0D, 0 4px 8px #28282A1A',+ '--shadow-med':+ '0 2px 4px #28282A0D, 0 4px 12px #28282A1A',+ '--shadow-high':+ '0 4px 6px #28282A1A, 0 12px 24px #28282A26',+ '--shadow-inset-hover': 'inset 0px 0px 0px 2px #28282A30',+ '--shadow-inset-selected': 'inset 0px 0px 0px 2px #28282A50',+ '--shadow-inset-success': 'inset 0px 0px 0px 2px #10993650',+ '--shadow-inset-warning': 'inset 0px 0px 0px 2px #FFB60050',+ '--shadow-inset-error': 'inset 0px 0px 0px 2px #FD000050',+ },++ components: {+ button: {+ base: {+ borderRadius: 'var(--radius-full)',+ },+ 'variant:secondary': {+ borderWidth: '1px',+ borderStyle: 'solid',+ borderColor: 'var(--color-border)',+ },+ },++ card: {+ base: {+ padding: 'var(--spacing-3)',+ },+ },++ section: {+ base: {+ padding: 'var(--spacing-3)',+ },+ },+ },++ icons: stoneIconRegistry,+});diff --git a/packages/themes/stone/theme.css.d.ts b/packages/themes/stone/theme.css.d.tsnew file mode 100644index 0000000000..cb0ff5c3b5--- /dev/null+++ b/packages/themes/stone/theme.css.d.ts@@ -0,0 +1 @@+export {};diff --git a/packages/themes/stone/tsconfig.build.json b/packages/themes/stone/tsconfig.build.jsonnew file mode 100644index 0000000000..03d4647cd5--- /dev/null+++ b/packages/themes/stone/tsconfig.build.json@@ -0,0 +1,13 @@+{+ "extends": "../../../tsconfig.json",+ "compilerOptions": {+ "outDir": "./dist",+ "rootDir": "./src",+ "noEmit": false,+ "declaration": true,+ "emitDeclarationOnly": true+ },+ "include": [+ "src"+ ]+}diff --git a/packages/themes/stone/tsup.config.ts b/packages/themes/stone/tsup.config.tsnew file mode 100644index 0000000000..c503745454--- /dev/null+++ b/packages/themes/stone/tsup.config.ts@@ -0,0 +1,9 @@+import {defineConfig} from 'tsup';++export default defineConfig({+ entry: ['src/source.ts', 'src/icons.tsx'],+ format: ['cjs', 'esm'],+ dts: false,+ clean: false, // Don't clean — xds theme build already put theme files in dist/+ external: ['@xds/core', 'react', 'lucide-react'],+});