From 08d063a0abc9851b0806c1c174c6e0168ad09414 Mon Sep 17 00:00:00 2001 From: Charlie Joseph Date: Thu, 26 Nov 2026 19:47:40 +0000 Subject: [PATCH 01/20] refactor(ui): share the theme and shadcn primitives as workspace packages --- package-lock.json | 70 +++- package.json | 24 +- packages/theme/fonts.css | 8 + packages/theme/package.json | 21 ++ packages/theme/theme.css | 328 ++++++++++++++++++ packages/ui-react/package.json | 37 ++ .../ui-react/src}/components/ui/alert.tsx | 2 +- .../ui-react/src}/components/ui/avatar.tsx | 2 +- .../ui-react/src}/components/ui/badge.tsx | 2 +- .../src}/components/ui/breadcrumb.tsx | 2 +- .../ui-react/src}/components/ui/button.tsx | 2 +- .../ui-react/src}/components/ui/card.tsx | 2 +- .../ui-react/src}/components/ui/checkbox.tsx | 2 +- .../src}/components/ui/collapsible.tsx | 0 .../ui-react/src}/components/ui/dialog.tsx | 2 +- .../src}/components/ui/dropdown-menu.tsx | 2 +- .../ui-react/src}/components/ui/icon.tsx | 0 .../ui-react/src}/components/ui/input-otp.tsx | 2 +- .../ui-react/src}/components/ui/input.tsx | 2 +- .../src}/components/ui/inset-card.tsx | 2 +- .../ui-react/src}/components/ui/label.tsx | 2 +- .../src}/components/ui/navigation-menu.tsx | 2 +- .../components/ui/placeholder-pattern.tsx | 0 .../ui-react/src}/components/ui/select.tsx | 2 +- .../ui-react/src}/components/ui/separator.tsx | 2 +- .../ui-react/src}/components/ui/sheet.tsx | 2 +- .../ui-react/src}/components/ui/sidebar.tsx | 16 +- .../ui-react/src}/components/ui/skeleton.tsx | 2 +- .../ui-react/src}/components/ui/spinner.tsx | 2 +- .../src}/components/ui/toggle-group.tsx | 4 +- .../ui-react/src}/components/ui/toggle.tsx | 2 +- .../ui-react/src}/components/ui/tooltip.tsx | 2 +- .../ui-react/src/hooks/use-mobile.ts | 0 .../js => packages/ui-react/src}/lib/utils.ts | 5 - pnpm-workspace.yaml | 5 - resources/css/app.css | 316 +---------------- resources/js/app.tsx | 2 +- resources/js/components/alert-error.tsx | 2 +- resources/js/components/app-content.tsx | 2 +- resources/js/components/app-header.tsx | 19 +- resources/js/components/app-logo-mark.tsx | 2 +- resources/js/components/app-shell.tsx | 2 +- .../js/components/app-sidebar-header.tsx | 2 +- resources/js/components/app-sidebar.tsx | 2 +- resources/js/components/appearance-tabs.tsx | 2 +- resources/js/components/breadcrumbs.tsx | 2 +- resources/js/components/code-input.tsx | 2 +- resources/js/components/delete-user.tsx | 6 +- .../js/components/demo-location-picker.tsx | 2 +- resources/js/components/input-error.tsx | 2 +- resources/js/components/keyring/activity.tsx | 4 +- .../js/components/keyring/change-password.tsx | 4 +- resources/js/components/keyring/devices.tsx | 6 +- .../keyring/recovery-codes-dialog.tsx | 6 +- resources/js/components/keyring/sessions.tsx | 8 +- .../js/components/keyring/sign-in-methods.tsx | 18 +- resources/js/components/keyring/signed-in.tsx | 6 +- resources/js/components/nav-footer.tsx | 4 +- resources/js/components/nav-main.tsx | 2 +- resources/js/components/nav-user.tsx | 6 +- resources/js/components/password-input.tsx | 4 +- resources/js/components/status-message.tsx | 2 +- resources/js/components/text-link.tsx | 2 +- resources/js/components/user-info.tsx | 6 +- resources/js/components/user-menu-content.tsx | 2 +- resources/js/hooks/use-current-url.ts | 2 +- resources/js/keyring/factors.tsx | 8 +- .../js/layouts/auth/auth-card-layout.tsx | 2 +- resources/js/layouts/settings/layout.tsx | 3 +- resources/js/lib/url.ts | 5 + resources/js/pages/auth/challenge.tsx | 6 +- resources/js/pages/auth/device-report.tsx | 4 +- resources/js/pages/auth/email-change.tsx | 4 +- .../js/pages/auth/email-verification.tsx | 4 +- resources/js/pages/auth/forgot-password.tsx | 6 +- resources/js/pages/auth/login.tsx | 10 +- resources/js/pages/auth/register.tsx | 8 +- resources/js/pages/auth/reset-password.tsx | 8 +- resources/js/pages/auth/verify-email.tsx | 4 +- resources/js/pages/dashboard.tsx | 6 +- resources/js/pages/settings/appearance.tsx | 2 +- resources/js/pages/settings/profile.tsx | 8 +- resources/js/pages/settings/security.tsx | 6 +- resources/js/pages/welcome.tsx | 4 +- tsconfig.json | 8 +- vite.config.ts | 3 + 86 files changed, 618 insertions(+), 498 deletions(-) create mode 100644 packages/theme/fonts.css create mode 100644 packages/theme/package.json create mode 100644 packages/theme/theme.css create mode 100644 packages/ui-react/package.json rename {resources/js => packages/ui-react/src}/components/ui/alert.tsx (98%) rename {resources/js => packages/ui-react/src}/components/ui/avatar.tsx (96%) rename {resources/js => packages/ui-react/src}/components/ui/badge.tsx (98%) rename {resources/js => packages/ui-react/src}/components/ui/breadcrumb.tsx (98%) rename {resources/js => packages/ui-react/src}/components/ui/button.tsx (98%) rename {resources/js => packages/ui-react/src}/components/ui/card.tsx (97%) rename {resources/js => packages/ui-react/src}/components/ui/checkbox.tsx (96%) rename {resources/js => packages/ui-react/src}/components/ui/collapsible.tsx (100%) rename {resources/js => packages/ui-react/src}/components/ui/dialog.tsx (99%) rename {resources/js => packages/ui-react/src}/components/ui/dropdown-menu.tsx (99%) rename {resources/js => packages/ui-react/src}/components/ui/icon.tsx (100%) rename {resources/js => packages/ui-react/src}/components/ui/input-otp.tsx (98%) rename {resources/js => packages/ui-react/src}/components/ui/input.tsx (96%) rename {resources/js => packages/ui-react/src}/components/ui/inset-card.tsx (98%) rename {resources/js => packages/ui-react/src}/components/ui/label.tsx (93%) rename {resources/js => packages/ui-react/src}/components/ui/navigation-menu.tsx (99%) rename {resources/js => packages/ui-react/src}/components/ui/placeholder-pattern.tsx (100%) rename {resources/js => packages/ui-react/src}/components/ui/select.tsx (99%) rename {resources/js => packages/ui-react/src}/components/ui/separator.tsx (94%) rename {resources/js => packages/ui-react/src}/components/ui/sheet.tsx (99%) rename {resources/js => packages/ui-react/src}/components/ui/sidebar.tsx (98%) rename {resources/js => packages/ui-react/src}/components/ui/skeleton.tsx (86%) rename {resources/js => packages/ui-react/src}/components/ui/spinner.tsx (88%) rename {resources/js => packages/ui-react/src}/components/ui/toggle-group.tsx (95%) rename {resources/js => packages/ui-react/src}/components/ui/toggle.tsx (97%) rename {resources/js => packages/ui-react/src}/components/ui/tooltip.tsx (97%) rename resources/js/hooks/use-mobile.tsx => packages/ui-react/src/hooks/use-mobile.ts (100%) rename {resources/js => packages/ui-react/src}/lib/utils.ts (50%) delete mode 100644 pnpm-workspace.yaml create mode 100644 resources/js/lib/url.ts diff --git a/package-lock.json b/package-lock.json index 96d1745..506f845 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,39 +4,27 @@ "requires": true, "packages": { "": { + "workspaces": [ + "packages/*", + "kits/*" + ], "dependencies": { "@inertiajs/react": "^3.0.0", "@inertiajs/vite": "^3.0.0", "@keyringjs/keyring": "^0.1.1", - "@radix-ui/react-avatar": "^1.1.3", - "@radix-ui/react-checkbox": "^1.1.4", - "@radix-ui/react-collapsible": "^1.1.3", - "@radix-ui/react-dialog": "^1.1.6", - "@radix-ui/react-dropdown-menu": "^2.1.6", - "@radix-ui/react-label": "^2.1.2", - "@radix-ui/react-navigation-menu": "^1.2.5", - "@radix-ui/react-select": "^2.1.6", - "@radix-ui/react-separator": "^1.1.2", - "@radix-ui/react-slot": "^1.2.3", - "@radix-ui/react-toggle": "^1.1.2", - "@radix-ui/react-toggle-group": "^1.1.2", - "@radix-ui/react-tooltip": "^1.1.8", + "@keyringjs/theme": "0.0.0", + "@keyringjs/ui-react": "0.0.0", "@tailwindcss/vite": "^4.1.11", "@types/react": "^19.2.0", "@types/react-dom": "^19.2.0", "@vitejs/plugin-react": "^6.1.1", - "class-variance-authority": "^0.7.1", - "clsx": "^2.1.1", "concurrently": "^10.0.3", - "input-otp": "^1.4.2", "laravel-vite-plugin": "^3.0.0", "lucide-react": "^0.475.0", "react": "^19.2.0", "react-dom": "^19.2.0", "sonner": "^2.0.0", - "tailwind-merge": "^3.0.1", "tailwindcss": "^4.0.0", - "tw-animate-css": "^1.4.0", "typescript": "^5.7.2", "vite": "npm:@voidzero-dev/vite-plus-core@1.4.0" }, @@ -657,6 +645,14 @@ } } }, + "node_modules/@keyringjs/theme": { + "resolved": "packages/theme", + "link": true + }, + "node_modules/@keyringjs/ui-react": { + "resolved": "packages/ui-react", + "link": true + }, "node_modules/@laravel/multiplex": { "version": "0.4.5", "resolved": "https://registry.npmjs.org/@laravel/multiplex/-/multiplex-0.4.5.tgz", @@ -10802,6 +10798,44 @@ "type": "github", "url": "https://github.com/sponsors/wooorm" } + }, + "packages/theme": { + "name": "@keyringjs/theme", + "version": "0.0.0", + "dependencies": { + "tw-animate-css": "^1.4.0" + }, + "peerDependencies": { + "tailwindcss": "^4.0.0" + } + }, + "packages/ui-react": { + "name": "@keyringjs/ui-react", + "version": "0.0.0", + "dependencies": { + "@radix-ui/react-avatar": "^1.1.3", + "@radix-ui/react-checkbox": "^1.1.4", + "@radix-ui/react-collapsible": "^1.1.3", + "@radix-ui/react-dialog": "^1.1.6", + "@radix-ui/react-dropdown-menu": "^2.1.6", + "@radix-ui/react-label": "^2.1.2", + "@radix-ui/react-navigation-menu": "^1.2.5", + "@radix-ui/react-select": "^2.1.6", + "@radix-ui/react-separator": "^1.1.2", + "@radix-ui/react-slot": "^1.2.3", + "@radix-ui/react-toggle": "^1.1.2", + "@radix-ui/react-toggle-group": "^1.1.2", + "@radix-ui/react-tooltip": "^1.1.8", + "class-variance-authority": "^0.7.1", + "clsx": "^2.1.1", + "input-otp": "^1.4.2", + "lucide-react": "^0.475.0", + "tailwind-merge": "^3.0.1" + }, + "peerDependencies": { + "react": "^19.2.0", + "react-dom": "^19.2.0" + } } } } diff --git a/package.json b/package.json index 373096b..6717e1b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,10 @@ { "$schema": "https://www.schemastore.org/package.json", "private": true, + "workspaces": [ + "packages/*", + "kits/*" + ], "type": "module", "scripts": { "build": "vp build", @@ -19,35 +23,19 @@ "@inertiajs/react": "^3.0.0", "@inertiajs/vite": "^3.0.0", "@keyringjs/keyring": "^0.1.1", - "@radix-ui/react-avatar": "^1.1.3", - "@radix-ui/react-checkbox": "^1.1.4", - "@radix-ui/react-collapsible": "^1.1.3", - "@radix-ui/react-dialog": "^1.1.6", - "@radix-ui/react-dropdown-menu": "^2.1.6", - "@radix-ui/react-label": "^2.1.2", - "@radix-ui/react-navigation-menu": "^1.2.5", - "@radix-ui/react-select": "^2.1.6", - "@radix-ui/react-separator": "^1.1.2", - "@radix-ui/react-slot": "^1.2.3", - "@radix-ui/react-toggle": "^1.1.2", - "@radix-ui/react-toggle-group": "^1.1.2", - "@radix-ui/react-tooltip": "^1.1.8", + "@keyringjs/theme": "0.0.0", + "@keyringjs/ui-react": "0.0.0", "@tailwindcss/vite": "^4.1.11", "@types/react": "^19.2.0", "@types/react-dom": "^19.2.0", "@vitejs/plugin-react": "^6.1.1", - "class-variance-authority": "^0.7.1", - "clsx": "^2.1.1", "concurrently": "^10.0.3", - "input-otp": "^1.4.2", "laravel-vite-plugin": "^3.0.0", "lucide-react": "^0.475.0", "react": "^19.2.0", "react-dom": "^19.2.0", "sonner": "^2.0.0", - "tailwind-merge": "^3.0.1", "tailwindcss": "^4.0.0", - "tw-animate-css": "^1.4.0", "typescript": "^5.7.2", "vite": "npm:@voidzero-dev/vite-plus-core@1.4.0" }, diff --git a/packages/theme/fonts.css b/packages/theme/fonts.css new file mode 100644 index 0000000..bed58fb --- /dev/null +++ b/packages/theme/fonts.css @@ -0,0 +1,8 @@ +/* + * Inter from Bunny Fonts, for kits that don't load it themselves. Import it + * before the theme, since a CSS @import has to come first: + * + * @import '@keyringjs/theme/fonts.css'; + * @import '@keyringjs/theme'; + */ +@import url('https://fonts.bunny.net/css?family=inter:400,500,600,700&display=swap'); diff --git a/packages/theme/package.json b/packages/theme/package.json new file mode 100644 index 0000000..5fd1975 --- /dev/null +++ b/packages/theme/package.json @@ -0,0 +1,21 @@ +{ + "name": "@keyringjs/theme", + "version": "0.0.0", + "private": true, + "description": "Keyring starter kits' Tailwind v4 theme: palette, shadcn tokens, dark mode and fonts.", + "type": "module", + "exports": { + ".": { + "style": "./theme.css", + "default": "./theme.css" + }, + "./theme.css": "./theme.css", + "./fonts.css": "./fonts.css" + }, + "dependencies": { + "tw-animate-css": "^1.4.0" + }, + "peerDependencies": { + "tailwindcss": "^4.0.0" + } +} diff --git a/packages/theme/theme.css b/packages/theme/theme.css new file mode 100644 index 0000000..2293a9f --- /dev/null +++ b/packages/theme/theme.css @@ -0,0 +1,328 @@ +/* + * Keyring starter kits' theme: Tailwind v4, the palette, the shadcn tokens, + * dark mode and the font stack. Dark mode follows a `dark` class on any + * ancestor (usually ). The font stack starts with Inter, which the app + * loads itself. + * @monorepo-only:start + * + * Every kit, React or Vue, imports this one file from its own stylesheet and + * adds its @source lines after it: + * + * @import '@keyringjs/theme'; + * @source '../views'; + * + * The Inertia kit loads Inter with laravel-vite-plugin's Bunny fonts. A kit + * without that can import '@keyringjs/theme/fonts.css' before this file. + * @monorepo-only:end + */ +@import 'tailwindcss'; + +@import 'tw-animate-css'; + +@custom-variant dark (&:is(.dark *)); + +/* + * The palette is entity/ui's: a warm gray, a blue accent, and deep-gray for + * dark mode. The shadcn tokens further down map onto it, so every component + * picks it up. + */ +@theme { + --font-sans: + 'Inter', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', + 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'; + + --radius-lg: var(--radius); + --radius-md: calc(var(--radius) - 2px); + --radius-sm: calc(var(--radius) - 4px); + + --color-gray-50: oklch(98.26% 0.002 67); + --color-gray-100: oklch(96.87% 0.002 15.1); + --color-gray-150: oklch(95.42% 0.003 38.5); + --color-gray-200: oklch(92.22% 0.006 42.8); + --color-gray-250: oklch(89.17% 0.006 42.9); + --color-gray-300: oklch(85.95% 0.008 36.2); + --color-gray-350: oklch(83.62% 0.006 42.9); + --color-gray-400: oklch(79.58% 0.006 30.5); + --color-gray-450: oklch(74.66% 0.004 38.8); + --color-gray-500: oklch(61.31% 0.005 33.9); + --color-gray-550: oklch(54.44% 0.004 16.6); + --color-gray-600: oklch(43.65% 0.003 48.3); + --color-gray-700: oklch(34.13% 0.002 67.5); + --color-gray-750: oklch(30.08% 0.002 106.8); + --color-gray-800: oklch(25.3% 0.001 16.5); + --color-gray-900: oklch(20.58% 0.002 16.7); + --color-gray-950: oklch(17.42% 0.002 16.8); + + --color-deep-gray-500: #4a4b50; + --color-deep-gray-600: #3b3c40; + --color-deep-gray-700: #313338; + --color-deep-gray-800: #28292e; + --color-deep-gray-850: #232529; + --color-deep-gray-900: #1f2024; + --color-deep-gray-950: #1a1b1f; + --color-deep-gray-975: #17181c; + --color-deep-gray-1000: #131417; + + --color-accent-0: oklch(0.971 0.01 264); + --color-accent-50: oklch(0.9 0.035 264); + --color-accent-100: oklch(0.83 0.072 264); + --color-accent-200: oklch(0.74 0.105 265); + --color-accent-300: oklch(0.677 0.135 265); + --color-accent-400: oklch(0.62 0.15 266); + --color-accent-500: oklch(0.564 0.152 266); + --color-accent-600: oklch(0.501 0.14 267); + --color-accent-700: oklch(0.429 0.125 268); + --color-accent-800: oklch(0.351 0.1 270); + --color-accent-900: oklch(0.268 0.072 271); + + --ease-out-quart: cubic-bezier(0.165, 0.84, 0.44, 1); + --ease-out-quint: cubic-bezier(0.23, 1, 0.32, 1); +} + +/* Tokens that change with the theme, so the utilities read the variables. */ +@theme inline { + --color-background: var(--background); + --color-foreground: var(--foreground); + + --color-card: var(--card); + --color-card-foreground: var(--card-foreground); + + --color-popover: var(--popover); + --color-popover-foreground: var(--popover-foreground); + + --color-primary: var(--primary); + --color-primary-hover: var(--primary-hover); + --color-primary-foreground: var(--primary-foreground); + + --color-secondary: var(--secondary); + --color-secondary-hover: var(--secondary-hover); + --color-secondary-foreground: var(--secondary-foreground); + + --color-muted: var(--muted); + --color-muted-foreground: var(--muted-foreground); + + --color-accent: var(--accent); + --color-accent-foreground: var(--accent-foreground); + + --color-destructive: var(--destructive); + --color-destructive-hover: var(--destructive-hover); + --color-destructive-foreground: var(--destructive-foreground); + + --color-border: var(--border); + --color-input: var(--input); + --color-ring: var(--ring); + + /* Surfaces: the ground under the panel, a tinted well, a raised control and a field. */ + --color-ground: var(--ground); + --color-tint: var(--tint); + --color-raised: var(--raised); + --color-field: var(--field); + + --color-chart-1: var(--chart-1); + --color-chart-2: var(--chart-2); + --color-chart-3: var(--chart-3); + --color-chart-4: var(--chart-4); + --color-chart-5: var(--chart-5); + + --color-sidebar: var(--sidebar); + --color-sidebar-foreground: var(--sidebar-foreground); + --color-sidebar-primary: var(--sidebar-primary); + --color-sidebar-primary-foreground: var(--sidebar-primary-foreground); + --color-sidebar-accent: var(--sidebar-accent); + --color-sidebar-accent-foreground: var(--sidebar-accent-foreground); + --color-sidebar-border: var(--sidebar-border); + --color-sidebar-ring: var(--sidebar-ring); + + /* Elevation: a fine ring plus a short, crisp drop. Dark mode swaps the ring for a solid outline. */ + --shadow-raised: var(--elevation-raised); + --shadow-card: var(--elevation-card); + --shadow-panel: var(--elevation-panel); + --shadow-inset: var(--elevation-inset); + --shadow-field: var(--elevation-field); + --shadow-popover: var(--elevation-popover); + --shadow-dialog: var(--elevation-dialog); + --shadow-primary: var(--elevation-primary); + --shadow-danger: var(--elevation-danger); +} + +:root { + --background: #ffffff; + --foreground: var(--color-gray-950); + --card: #ffffff; + --card-foreground: var(--color-gray-950); + --popover: #ffffff; + --popover-foreground: var(--color-gray-950); + --primary: var(--color-accent-500); + --primary-hover: var(--color-accent-600); + --primary-foreground: #ffffff; + --secondary: var(--color-gray-100); + --secondary-hover: var(--color-gray-150); + --secondary-foreground: var(--color-gray-950); + --muted: var(--color-gray-100); + /* gray-550 rather than entity/ui's gray-500, which misses 4.5:1 on white. */ + --muted-foreground: var(--color-gray-550); + --accent: var(--color-gray-100); + --accent-foreground: var(--color-gray-950); + --destructive: oklch(61.93% 0.207 31.5); + --destructive-hover: oklch(55% 0.19 31.5); + --destructive-foreground: oklch(52% 0.18 31.6); + --border: var(--color-gray-200); + --input: var(--color-gray-250); + --ring: var(--color-accent-500); + --ground: var(--color-gray-50); + --tint: var(--color-gray-50); + --raised: #ffffff; + --field: #ffffff; + --chart-1: oklch(0.646 0.222 41.116); + --chart-2: oklch(0.6 0.118 184.704); + --chart-3: oklch(0.398 0.07 227.392); + --chart-4: oklch(0.828 0.189 84.429); + --chart-5: oklch(0.769 0.188 70.08); + --radius: 0.625rem; + --sidebar: var(--color-gray-50); + --sidebar-foreground: var(--color-gray-600); + --sidebar-primary: var(--color-gray-950); + --sidebar-primary-foreground: #ffffff; + --sidebar-accent: oklch(92.22% 0.006 42.8 / 0.5); + --sidebar-accent-foreground: var(--color-gray-950); + --sidebar-border: var(--color-gray-200); + --sidebar-ring: var(--color-accent-500); + + --elevation-raised: + 0 0 0 1px oklch(17.42% 0.002 16.8 / 0.09), + 0 1px 2px 0 oklch(17.42% 0.002 16.8 / 0.08); + --elevation-card: + 0 0 0 1px oklch(25.3% 0.001 16.5 / 0.08), + 0 1px 2px 0 oklch(17.42% 0.002 16.8 / 0.05), + 0 4px 8px -4px oklch(17.42% 0.002 16.8 / 0.06); + --elevation-panel: + 0 0 0 1px oklch(25.3% 0.001 16.5 / 0.06), + 0 1px 3px 0 oklch(17.42% 0.002 16.8 / 0.05); + --elevation-inset: + inset 0 0 0 1px var(--color-gray-150), + 0 1px 2px 0 oklch(17.42% 0.002 16.8 / 0.04); + --elevation-field: + 0 0 0 1px oklch(17.42% 0.002 16.8 / 0.1), + 0 1px 2px 0 oklch(17.42% 0.002 16.8 / 0.06); + --elevation-popover: + 0 0 0 1px rgb(39 44 48 / 0.08), 0 4px 8px 0 rgb(39 44 48 / 0.1), + 0 14px 40px 0 rgb(39 44 48 / 0.06); + --elevation-dialog: + 0 0 0 1px rgb(1 33 57 / 0.12), 0 0 0 7px rgb(255 255 255 / 0.3), + 0 10px 13px 0 rgb(0 0 0 / 0.06), 0 17px 17px 0 rgb(0 0 0 / 0.05), + 0 28px 20px 0 rgb(0 0 0 / 0.03); + --elevation-primary: + inset 0 1px 0 0 rgb(255 255 255 / 0.18), + 0 0 0 1px var(--color-accent-600), + 0 1px 2px 0 oklch(0.268 0.072 271 / 0.3); + --elevation-danger: + inset 0 1px 0 0 rgb(255 255 255 / 0.18), 0 0 0 1px oklch(55% 0.19 31.5), + 0 1px 2px 0 oklch(34% 0.09 31.6 / 0.3); + + /* The soft wash behind hero and header cards. */ + --wash-1: oklch(0.93 0.045 264 / 0.75); + --wash-2: oklch(0.95 0.04 200 / 0.45); + --auth-glow: var(--color-accent-300); +} + +.dark { + --background: var(--color-deep-gray-975); + --foreground: oklch(0.96 0.003 270); + --card: var(--color-deep-gray-900); + --card-foreground: oklch(0.96 0.003 270); + --popover: var(--color-deep-gray-850); + --popover-foreground: oklch(0.96 0.003 270); + --primary: var(--color-accent-500); + --primary-hover: var(--color-accent-400); + --primary-foreground: #ffffff; + --secondary: var(--color-deep-gray-800); + --secondary-hover: var(--color-deep-gray-700); + --secondary-foreground: oklch(0.96 0.003 270); + --muted: var(--color-deep-gray-850); + --muted-foreground: oklch(0.7 0.008 270); + --accent: var(--color-deep-gray-800); + --accent-foreground: oklch(0.96 0.003 270); + --destructive: oklch(58% 0.19 29); + --destructive-hover: oklch(63% 0.19 29); + --destructive-foreground: oklch(0.74 0.15 27); + --border: var(--color-deep-gray-700); + --input: var(--color-deep-gray-600); + --ring: var(--color-accent-300); + --ground: var(--color-deep-gray-1000); + --tint: var(--color-deep-gray-950); + --raised: var(--color-deep-gray-800); + --field: var(--color-deep-gray-1000); + --chart-1: oklch(0.488 0.243 264.376); + --chart-2: oklch(0.696 0.17 162.48); + --chart-3: oklch(0.769 0.188 70.08); + --chart-4: oklch(0.627 0.265 303.9); + --chart-5: oklch(0.645 0.246 16.439); + --sidebar: var(--color-deep-gray-1000); + --sidebar-foreground: oklch(0.76 0.006 270); + --sidebar-primary: oklch(0.96 0.003 270); + --sidebar-primary-foreground: var(--color-deep-gray-1000); + --sidebar-accent: rgb(255 255 255 / 0.04); + --sidebar-accent-foreground: oklch(0.96 0.003 270); + --sidebar-border: var(--color-deep-gray-700); + --sidebar-ring: var(--color-accent-300); + + --elevation-raised: + 0 0 0 0.5px var(--color-deep-gray-500), 0 1px 2px 0 rgb(0 0 0 / 0.5); + --elevation-card: + 0 0 0 0.5px var(--color-deep-gray-700), 0 1px 2px 0 rgb(0 0 0 / 0.5), + 0 4px 8px -4px rgb(0 0 0 / 0.4); + --elevation-panel: + 0 0 0 0.5px var(--color-deep-gray-800), 0 1px 2px 0 rgb(0 0 0 / 0.5); + --elevation-inset: inset 0 0 0 0.5px var(--color-deep-gray-700); + --elevation-field: + 0 0 0 0.5px var(--color-deep-gray-600), + inset 0 1px 2px 0 rgb(0 0 0 / 0.3); + --elevation-popover: + 0 0 0 0.5px var(--color-deep-gray-600), 0 4px 8px -4px rgb(0 0 0 / 0.6), + 0 14px 40px 0 rgb(0 0 0 / 0.35); + --elevation-dialog: + 0 0 0 0.5px var(--color-deep-gray-600), + 0 0 0 7px rgb(255 255 255 / 0.03), 0 24px 48px -12px rgb(0 0 0 / 0.7); + --elevation-primary: + inset 0 1px 0 0 rgb(255 255 255 / 0.16), + 0 0 0 0.5px var(--color-accent-400), 0 1px 2px 0 rgb(0 0 0 / 0.5); + --elevation-danger: + inset 0 1px 0 0 rgb(255 255 255 / 0.16), 0 0 0 0.5px oklch(63% 0.19 29), + 0 1px 2px 0 rgb(0 0 0 / 0.5); + + --wash-1: oklch(0.42 0.11 266 / 0.32); + --wash-2: oklch(0.4 0.06 200 / 0.18); + --auth-glow: var(--color-accent-800); +} + +/* A soft colour wash, top left, for hero and header cards. */ +@utility bg-wash { + background-image: + radial-gradient(90% 120% at 0% 0%, var(--wash-1) 0%, transparent 60%), + radial-gradient(70% 90% at 100% 0%, var(--wash-2) 0%, transparent 65%); +} + +/* The sign-in pages' backdrop: blue at the top, fading to the page. */ +@utility bg-auth-backdrop { + background-color: var(--background); + background-image: radial-gradient( + 125% 125% at 50% 90%, + var(--background) 40%, + var(--auth-glow) 100% + ); +} + +@layer base { + * { + @apply border-border; + } + + html { + font-synthesis: none; + text-rendering: optimizeLegibility; + } + + body { + @apply bg-background text-foreground; + } +} diff --git a/packages/ui-react/package.json b/packages/ui-react/package.json new file mode 100644 index 0000000..78cf637 --- /dev/null +++ b/packages/ui-react/package.json @@ -0,0 +1,37 @@ +{ + "name": "@keyringjs/ui-react", + "version": "0.0.0", + "private": true, + "description": "The shadcn/ui primitives every React starter kit shares: no router or Inertia imports.", + "type": "module", + "sideEffects": false, + "exports": { + "./utils": "./src/lib/utils.ts", + "./hooks/*": "./src/hooks/*.ts", + "./*": "./src/components/ui/*.tsx" + }, + "dependencies": { + "@radix-ui/react-avatar": "^1.1.3", + "@radix-ui/react-checkbox": "^1.1.4", + "@radix-ui/react-collapsible": "^1.1.3", + "@radix-ui/react-dialog": "^1.1.6", + "@radix-ui/react-dropdown-menu": "^2.1.6", + "@radix-ui/react-label": "^2.1.2", + "@radix-ui/react-navigation-menu": "^1.2.5", + "@radix-ui/react-select": "^2.1.6", + "@radix-ui/react-separator": "^1.1.2", + "@radix-ui/react-slot": "^1.2.3", + "@radix-ui/react-toggle": "^1.1.2", + "@radix-ui/react-toggle-group": "^1.1.2", + "@radix-ui/react-tooltip": "^1.1.8", + "class-variance-authority": "^0.7.1", + "clsx": "^2.1.1", + "input-otp": "^1.4.2", + "lucide-react": "^0.475.0", + "tailwind-merge": "^3.0.1" + }, + "peerDependencies": { + "react": "^19.2.0", + "react-dom": "^19.2.0" + } +} diff --git a/resources/js/components/ui/alert.tsx b/packages/ui-react/src/components/ui/alert.tsx similarity index 98% rename from resources/js/components/ui/alert.tsx rename to packages/ui-react/src/components/ui/alert.tsx index a155fa0..e83a29b 100644 --- a/resources/js/components/ui/alert.tsx +++ b/packages/ui-react/src/components/ui/alert.tsx @@ -1,7 +1,7 @@ import { cva, type VariantProps } from "class-variance-authority" import * as React from "react" -import { cn } from "@/lib/utils" +import { cn } from "../../lib/utils" const alertVariants = cva( "relative w-full rounded-xl px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start inset-ring [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current", diff --git a/resources/js/components/ui/avatar.tsx b/packages/ui-react/src/components/ui/avatar.tsx similarity index 96% rename from resources/js/components/ui/avatar.tsx rename to packages/ui-react/src/components/ui/avatar.tsx index 5a6986a..b88f8a2 100644 --- a/resources/js/components/ui/avatar.tsx +++ b/packages/ui-react/src/components/ui/avatar.tsx @@ -1,7 +1,7 @@ import * as AvatarPrimitive from "@radix-ui/react-avatar" import * as React from "react" -import { cn } from "@/lib/utils" +import { cn } from "../../lib/utils" function Avatar({ className, diff --git a/resources/js/components/ui/badge.tsx b/packages/ui-react/src/components/ui/badge.tsx similarity index 98% rename from resources/js/components/ui/badge.tsx rename to packages/ui-react/src/components/ui/badge.tsx index 23c1433..4bac29b 100644 --- a/resources/js/components/ui/badge.tsx +++ b/packages/ui-react/src/components/ui/badge.tsx @@ -2,7 +2,7 @@ import { Slot } from "@radix-ui/react-slot" import { cva, type VariantProps } from "class-variance-authority" import * as React from "react" -import { cn } from "@/lib/utils" +import { cn } from "../../lib/utils" /* * Soft pills: a tint of the colour, its text in a deeper shade and a fine diff --git a/resources/js/components/ui/breadcrumb.tsx b/packages/ui-react/src/components/ui/breadcrumb.tsx similarity index 98% rename from resources/js/components/ui/breadcrumb.tsx rename to packages/ui-react/src/components/ui/breadcrumb.tsx index d3749b0..c1955df 100644 --- a/resources/js/components/ui/breadcrumb.tsx +++ b/packages/ui-react/src/components/ui/breadcrumb.tsx @@ -2,7 +2,7 @@ import { Slot } from "@radix-ui/react-slot" import { ChevronRight, MoreHorizontal } from "lucide-react" import * as React from "react" -import { cn } from "@/lib/utils" +import { cn } from "../../lib/utils" function Breadcrumb({ ...props }: React.ComponentProps<"nav">) { return