@heroui/theme
Version:
The default theme for HeroUI components
165 lines (162 loc) • 4.24 kB
JavaScript
import {
tv
} from "./chunk-TX3FPB7D.mjs";
import {
groupDataFocusVisibleClasses,
hiddenInputClasses
} from "./chunk-JGY6VQQQ.mjs";
// src/components/radio.ts
var radio = tv({
slots: {
base: "group relative max-w-fit inline-flex items-center justify-start cursor-pointer tap-highlight-transparent p-2 -m-2 select-none",
wrapper: [
"relative",
"inline-flex",
"items-center",
"justify-center",
"shrink-0",
"overflow-hidden",
"border-solid",
"border-medium",
"box-border",
"border-default",
"rounded-full",
"group-data-[hover-unselected=true]:bg-default-100",
// focus ring
...groupDataFocusVisibleClasses
],
hiddenInput: hiddenInputClasses,
labelWrapper: "flex flex-col ml-1",
control: [
"z-10",
"w-2",
"h-2",
"opacity-0",
"scale-0",
"origin-center",
"rounded-full",
"group-data-[selected=true]:opacity-100",
"group-data-[selected=true]:scale-100"
],
label: "relative text-foreground select-none",
description: "relative text-foreground-400"
},
variants: {
color: {
default: {
control: "bg-default-500 text-default-foreground",
wrapper: "group-data-[selected=true]:border-default-500"
},
primary: {
control: "bg-primary text-primary-foreground",
wrapper: "group-data-[selected=true]:border-primary"
},
secondary: {
control: "bg-secondary text-secondary-foreground",
wrapper: "group-data-[selected=true]:border-secondary"
},
success: {
control: "bg-success text-success-foreground",
wrapper: "group-data-[selected=true]:border-success"
},
warning: {
control: "bg-warning text-warning-foreground",
wrapper: "group-data-[selected=true]:border-warning"
},
danger: {
control: "bg-danger text-danger-foreground",
wrapper: "group-data-[selected=true]:border-danger"
}
},
size: {
sm: {
wrapper: "w-4 h-4",
control: "w-1.5 h-1.5",
labelWrapper: "ml-1",
label: "text-small",
description: "text-tiny"
},
md: {
wrapper: "w-5 h-5",
control: "w-2 h-2",
labelWrapper: "ms-2",
label: "text-medium",
description: "text-small"
},
lg: {
wrapper: "w-6 h-6",
control: "w-2.5 h-2.5",
labelWrapper: "ms-2",
label: "text-large",
description: "text-medium"
}
},
isDisabled: {
true: {
base: "opacity-disabled pointer-events-none"
}
},
isInvalid: {
true: {
control: "bg-danger text-danger-foreground",
wrapper: "border-danger group-data-[selected=true]:border-danger",
label: "text-danger",
description: "text-danger-300"
}
},
disableAnimation: {
true: {},
false: {
wrapper: [
"group-data-[pressed=true]:scale-95",
"transition-transform-colors",
"motion-reduce:transition-none"
],
control: "transition-transform-opacity motion-reduce:transition-none",
label: "transition-colors motion-reduce:transition-none",
description: "transition-colors motion-reduce:transition-none"
}
}
},
defaultVariants: {
color: "primary",
size: "md",
isDisabled: false,
isInvalid: false
}
});
var radioGroup = tv({
slots: {
base: "relative flex flex-col gap-2",
label: "relative text-foreground-500",
wrapper: "flex flex-col flex-wrap gap-2 data-[orientation=horizontal]:flex-row",
description: "text-tiny text-foreground-400",
errorMessage: "text-tiny text-danger"
},
variants: {
isRequired: {
true: {
label: "after:content-['*'] after:text-danger after:ml-0.5"
}
},
isInvalid: {
true: {
description: "text-danger"
}
},
disableAnimation: {
true: {},
false: {
description: "transition-colors !duration-150 motion-reduce:transition-none"
}
}
},
defaultVariants: {
isInvalid: false,
isRequired: false
}
});
export {
radio,
radioGroup
};