update shadcn/tailwind config

This commit is contained in:
padreug 2025-03-09 14:59:19 +01:00
parent 2a83972b47
commit 903636b6f9
9 changed files with 278 additions and 195 deletions

View file

@ -4,104 +4,119 @@
@layer base {
:root {
/* Light theme */
--background: rgb(231, 236, 254);
--background: 0 0% 100%;
--background: oklch(0.97 0.02 250);
--foreground: rgb(75, 78, 104);
--foreground: 222.2 84% 4.9%;
--foreground: oklch(0.40 0.03 265);
--card: rgb(226, 230, 242);
--card: 0 0% 100%;
--card: oklch(0.92 0.02 260);
--card-foreground: rgb(75, 78, 104);
--card-foreground: 222.2 84% 4.9%;
--card-foreground: oklch(0.40 0.03 265);
--popover: rgb(226, 230, 242);
--popover: 0 0% 100%;
--popover: oklch(0.92 0.02 260);
--popover-foreground: rgb(75, 78, 104);
--popover-foreground: 222.2 84% 4.9%;
--popover-foreground: oklch(0.40 0.03 265);
--primary: rgb(31, 102, 244);
--primary: 222.2 47.4% 11.2%;
--primary: oklch(0.60 0.20 260);
--primary-foreground: rgb(231, 236, 254);
--primary-foreground: 210 40% 98%;
--primary-foreground: oklch(0.97 0.02 250);
--secondary: rgb(212, 217, 228);
--secondary: 210 40% 96.1%;
--secondary: oklch(0.87 0.03 255);
--secondary-foreground: rgb(75, 78, 104);
--secondary-foreground: 222.2 47.4% 11.2%;
--secondary-foreground: oklch(0.40 0.03 265);
--muted: rgb(212, 217, 228);
--muted: 210 40% 96.1%;
--muted: oklch(0.87 0.03 255);
--muted-foreground: rgb(115, 120, 141);
--muted-foreground: 215.4 16.3% 46.9%;
--muted-foreground: oklch(0.55 0.03 265);
--accent: rgb(241, 127, 101);
--accent: 210 40% 96.1%;
--accent: oklch(0.70 0.15 30);
--accent-foreground: rgb(231, 236, 254);
--accent-foreground: 222.2 47.4% 11.2%;
--accent-foreground: oklch(0.97 0.02 250);
--destructive: rgb(210, 15, 57);
--destructive: 0 84.2% 60.2%;
--destructive: oklch(0.50 0.28 15);
--destructive-foreground: rgb(231, 236, 254);
--destructive-foreground: 210 40% 98%;
--destructive-foreground: oklch(0.97 0.02 250);
--border: rgb(197, 201, 216);
--border: 214.3 31.8% 91.4%;
--border: oklch(0.83 0.02 265);
--input: rgb(197, 201, 216);
--input: 214.3 31.8% 91.4%;
--input: oklch(0.83 0.02 265);
--ring: rgb(31, 102, 244);
--ring: 222.2 84% 4.9%;
--ring: oklch(0.60 0.20 260);
--radius: 0.5rem;
--chart-1: 12 76% 61%;
--chart-2: 173 58% 39%;
--chart-3: 197 37% 24%;
--chart-4: 43 74% 66%;
--chart-5: 27 87% 67%;
}
.dark {
/* Dark theme */
--background: rgb(26, 32, 54);
--background: 222.2 84% 4.9%;
--background: oklch(0.25 0.05 265);
--foreground: rgb(218, 226, 248);
--foreground: 210 40% 98%;
--foreground: oklch(0.90 0.03 260);
--card: rgb(22, 27, 45);
--card: 222.2 84% 4.9%;
--card: oklch(0.20 0.05 265);
--card-foreground: rgb(218, 226, 248);
--card-foreground: 210 40% 98%;
--card-foreground: oklch(0.90 0.03 260);
--popover: rgb(22, 27, 45);
--popover: 222.2 84% 4.9%;
--popover: oklch(0.20 0.05 265);
--popover-foreground: rgb(218, 226, 248);
--popover-foreground: 210 40% 98%;
--popover-foreground: oklch(0.90 0.03 260);
--primary: rgb(127, 167, 249);
--primary: 210 40% 98%;
--primary: oklch(0.75 0.15 260);
--primary-foreground: rgb(26, 32, 54);
--primary-foreground: 222.2 47.4% 11.2%;
--primary-foreground: oklch(0.25 0.05 265);
--secondary: rgb(38, 46, 72);
--secondary: 217.2 32.6% 17.5%;
--secondary: oklch(0.30 0.06 265);
--secondary-foreground: rgb(218, 226, 248);
--secondary-foreground: 210 40% 98%;
--secondary-foreground: oklch(0.90 0.03 260);
--muted: rgb(38, 46, 72);
--muted: 217.2 32.6% 17.5%;
--muted: oklch(0.30 0.06 265);
--muted-foreground: rgb(177, 186, 211);
--muted-foreground: 215 20.2% 65.1%;
--muted-foreground: oklch(0.78 0.06 265);
--accent: rgb(255, 179, 164);
--accent: 217.2 32.6% 17.5%;
--accent: oklch(0.83 0.12 30);
--accent-foreground: rgb(26, 32, 54);
--accent-foreground: 210 40% 98%;
--accent-foreground: oklch(0.25 0.05 265);
--destructive: rgb(247, 130, 150);
--destructive: 0 62.8% 30.6%;
--destructive: oklch(0.75 0.18 15);
--destructive-foreground: rgb(26, 32, 54);
--destructive-foreground: 210 40% 98%;
--destructive-foreground: oklch(0.25 0.05 265);
--border: rgb(38, 46, 72);
--border: 217.2 32.6% 17.5%;
--border: oklch(0.30 0.06 265);
--input: rgb(38, 46, 72);
--input: 217.2 32.6% 17.5%;
--input: oklch(0.30 0.06 265);
--ring: rgb(127, 167, 249);
--ring: 212.7 26.8% 83.9%;
--ring: oklch(0.75 0.15 260);
--chart-1: 220 70% 50%;
--chart-2: 160 60% 45%;
--chart-3: 30 80% 55%;
--chart-4: 280 65% 60%;
--chart-5: 340 75% 55%;
}
}
@ -294,3 +309,11 @@
border-color: var(--destructive-foreground);
}
}
@layer base {
* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
}
}

View file

@ -0,0 +1,16 @@
<script setup lang="ts">
import type { HTMLAttributes } from 'vue'
import { cn } from '@/lib/utils'
import { type BadgeVariants, badgeVariants } from '.'
const props = defineProps<{
variant?: BadgeVariants['variant']
class?: HTMLAttributes['class']
}>()
</script>
<template>
<div :class="cn(badgeVariants({ variant }), props.class)">
<slot />
</div>
</template>

View file

@ -0,0 +1,25 @@
import { cva, type VariantProps } from 'class-variance-authority'
export { default as Badge } from './Badge.vue'
export const badgeVariants = cva(
'inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2',
{
variants: {
variant: {
default:
'border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80',
secondary:
'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
destructive:
'border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80',
outline: 'text-foreground',
},
},
defaultVariants: {
variant: 'default',
},
},
)
export type BadgeVariants = VariantProps<typeof badgeVariants>

View file

@ -1,3 +1,5 @@
import type { Updater } from '@tanstack/vue-table'
import type { Ref } from 'vue'
import { type ClassValue, clsx } from 'clsx'
import { twMerge } from 'tailwind-merge'
@ -5,11 +7,9 @@ export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
export async function withTimeout<T>(promise: Promise<T>, timeoutMs: number = 10000): Promise<T> {
return Promise.race([
promise,
new Promise<T>((_, reject) =>
setTimeout(() => reject(new Error('Operation timed out')), timeoutMs)
)
])
export function valueUpdater<T extends Updater<any>>(updaterOrValue: T, ref: Ref) {
ref.value
= typeof updaterOrValue === 'function'
? updaterOrValue(ref.value)
: updaterOrValue
}