forked from cerc-io/snowballtools-base
171 lines
3.4 KiB
TypeScript
171 lines
3.4 KiB
TypeScript
import { VariantProps, tv } from 'tailwind-variants';
|
|
|
|
export const selectTheme = tv({
|
|
slots: {
|
|
container: ['flex', 'flex-col', 'relative', 'gap-2', 'w-full'],
|
|
label: [
|
|
'text-sm',
|
|
'text-elements-high-em',
|
|
'dark:text-foreground-secondary',
|
|
],
|
|
description: [
|
|
'text-xs',
|
|
'text-elements-low-em',
|
|
'dark:text-foreground-secondary',
|
|
],
|
|
inputWrapper: [
|
|
'relative',
|
|
'flex',
|
|
'flex-wrap',
|
|
'gap-1',
|
|
'min-w-[200px]',
|
|
'w-full',
|
|
'rounded-lg',
|
|
'bg-transparent',
|
|
'dark:bg-overlay2',
|
|
'text-elements-mid-em',
|
|
'shadow-sm',
|
|
'border',
|
|
'border-border-interactive',
|
|
'focus-ring',
|
|
'disabled:shadow-none',
|
|
'disabled:border-none',
|
|
],
|
|
input: ['outline-none', 'dark:bg-overlay2', 'dark:text-foreground'],
|
|
iconContainer: [
|
|
'absolute',
|
|
'inset-y-0',
|
|
'flex',
|
|
'items-center',
|
|
'gap-2',
|
|
'z-10',
|
|
'cursor-pointer',
|
|
],
|
|
icon: ['text-elements-mid-em', 'dark:text-foreground-secondary'],
|
|
helperIcon: [],
|
|
helperText: [
|
|
'flex',
|
|
'gap-2',
|
|
'items-center',
|
|
'text-elements-low-em',
|
|
'dark:text-foreground-secondary',
|
|
],
|
|
popover: [
|
|
'z-20',
|
|
'absolute',
|
|
'px-1',
|
|
'py-1',
|
|
'flex-col',
|
|
'gap-0.5',
|
|
'min-w-full',
|
|
'bg-surface-floating',
|
|
'dark:bg-overlay2',
|
|
'shadow-dropdown',
|
|
'w-auto',
|
|
'max-h-60',
|
|
'overflow-auto',
|
|
'border',
|
|
'border-gray-200',
|
|
'dark:border-overlay',
|
|
'rounded-xl',
|
|
],
|
|
},
|
|
variants: {
|
|
orientation: {
|
|
horizontal: {
|
|
container: [],
|
|
},
|
|
vertical: {
|
|
container: [],
|
|
},
|
|
},
|
|
variant: {
|
|
default: {
|
|
container: [],
|
|
},
|
|
danger: {
|
|
container: [],
|
|
},
|
|
},
|
|
error: {
|
|
true: {
|
|
inputWrapper: [
|
|
'outline',
|
|
'outline-offset-0',
|
|
'outline-border-danger',
|
|
'shadow-none',
|
|
'focus:outline-border-danger',
|
|
],
|
|
helperText: ['text-error'],
|
|
},
|
|
},
|
|
size: {
|
|
md: {
|
|
container: ['min-h-11'],
|
|
inputWrapper: ['min-h-11', 'text-sm', 'pl-4', 'pr-4'],
|
|
icon: ['h-[18px]', 'w-[18px]'],
|
|
helperText: 'text-sm',
|
|
helperIcon: ['h-5', 'w-5'],
|
|
popover: ['mt-12'],
|
|
},
|
|
sm: {
|
|
container: ['min-h-8'],
|
|
inputWrapper: ['min-h-8', 'text-xs', 'pl-3', 'pr-3'],
|
|
icon: ['h-4', 'w-4'],
|
|
helperText: 'text-xs',
|
|
helperIcon: ['h-4', 'w-4'],
|
|
popover: ['mt-9'],
|
|
},
|
|
},
|
|
isOpen: {
|
|
true: {
|
|
popover: ['flex'],
|
|
},
|
|
false: {
|
|
popover: ['hidden'],
|
|
},
|
|
},
|
|
hasValue: {
|
|
true: '',
|
|
},
|
|
searchable: {
|
|
true: '',
|
|
false: {
|
|
input: ['cursor-pointer'],
|
|
},
|
|
},
|
|
hideValues: {
|
|
true: {
|
|
input: ['placeholder:text-elements-mid-em'],
|
|
},
|
|
},
|
|
},
|
|
compoundVariants: [
|
|
{
|
|
size: 'md',
|
|
hasValue: true,
|
|
class: {
|
|
inputWrapper: ['pl-1'],
|
|
},
|
|
},
|
|
{
|
|
size: 'sm',
|
|
hasValue: true,
|
|
class: {
|
|
inputWrapper: ['pl-0.5'],
|
|
},
|
|
},
|
|
],
|
|
defaultVariants: {
|
|
orientation: 'horizontal',
|
|
variant: 'default',
|
|
size: 'md',
|
|
state: 'default',
|
|
error: false,
|
|
isOpen: false,
|
|
hasValue: false,
|
|
},
|
|
});
|
|
|
|
export type SelectTheme = VariantProps<typeof selectTheme>;
|