Files
heroui-vue/packages/styles/src/index.ts
T
2026-10-27 17:47:52 +08:00

2000 lines
45 KiB
TypeScript

/* Adapted from HeroUI v3, ce90ea3. Copyright 2025 NextUI Inc.
* See third-party/HEROUI-LICENSE. Modified: hv- class prefix; Vue state adapters. */
import { tv, type VariantProps } from "tailwind-variants";
export const buttonVariants = tv({
base: "hv-button",
defaultVariants: {
fullWidth: false,
isIconOnly: false,
size: "md",
variant: "primary",
},
variants: {
fullWidth: {
false: "",
true: "hv-button--full-width",
},
isIconOnly: {
true: "hv-button--icon-only",
},
size: {
lg: "hv-button--lg",
md: "hv-button--md",
sm: "hv-button--sm",
},
variant: {
danger: "hv-button--danger",
"danger-soft": "hv-button--danger-soft",
ghost: "hv-button--ghost",
outline: "hv-button--outline",
primary: "hv-button--primary",
secondary: "hv-button--secondary",
tertiary: "hv-button--tertiary",
},
},
});
export type ButtonVariants = VariantProps<typeof buttonVariants>;
const cardVariants = tv({
defaultVariants: {
variant: "default",
},
slots: {
base: "hv-card",
content: "hv-card__content",
description: "hv-card__description",
footer: "hv-card__footer",
header: "hv-card__header",
title: "hv-card__title",
},
variants: {
variant: {
default: {
base: "hv-card--default",
},
secondary: {
base: "hv-card--secondary",
},
tertiary: {
base: "hv-card--tertiary",
},
transparent: {
base: "hv-card--transparent",
},
},
},
});
export { cardVariants };
export type CardVariants = VariantProps<typeof cardVariants>;
export const inputVariants = tv({
base: "hv-input",
defaultVariants: {
fullWidth: false,
variant: "primary",
},
variants: {
fullWidth: {
false: "",
true: "hv-input--full-width",
},
variant: {
primary: "hv-input--primary",
secondary: "hv-input--secondary",
},
},
});
export type InputVariants = VariantProps<typeof inputVariants>;
export const switchVariants = tv({
defaultVariants: {
size: "md",
},
slots: {
base: "hv-switch",
content: "hv-switch__content",
control: "hv-switch__control",
icon: "hv-switch__icon",
thumb: "hv-switch__thumb",
},
variants: {
size: {
lg: {
base: "hv-switch--lg",
},
md: {
base: "hv-switch--md",
},
sm: {
base: "hv-switch--sm",
},
},
},
});
export type SwitchVariants = VariantProps<typeof switchVariants>;
export { tv, cn, type VariantProps } from "tailwind-variants";
export const closeButtonVariants = tv({
base: "hv-close-button",
defaultVariants: { variant: "default" },
variants: { variant: { default: "hv-close-button--default" } },
});
export type CloseButtonVariants = VariantProps<typeof closeButtonVariants>;
export const surfaceVariants = tv({
base: "hv-surface",
defaultVariants: {
variant: "default",
},
variants: {
variant: {
default: "hv-surface--default",
secondary: "hv-surface--secondary",
tertiary: "hv-surface--tertiary",
transparent: "hv-surface--transparent",
},
},
});
export type SurfaceVariants = VariantProps<typeof surfaceVariants>;
export const linkVariants = tv({
slots: {
base: "hv-link",
icon: "hv-link__icon",
},
});
export type LinkVariants = VariantProps<typeof linkVariants>;
export const spinnerVariants = tv({
base: "hv-spinner",
defaultVariants: {
color: "accent",
size: "md",
},
variants: {
color: {
accent: "hv-spinner--accent",
current: "hv-spinner--current",
danger: "hv-spinner--danger",
success: "hv-spinner--success",
warning: "hv-spinner--warning",
},
size: {
lg: "hv-spinner--lg",
md: "hv-spinner--md",
sm: "hv-spinner--sm",
xl: "hv-spinner--xl",
},
},
});
export type SpinnerVariants = VariantProps<typeof spinnerVariants>;
export const textAreaVariants = tv({
base: "hv-textarea",
defaultVariants: {
fullWidth: false,
variant: "primary",
},
variants: {
fullWidth: {
false: "",
true: "hv-textarea--full-width",
},
variant: {
primary: "hv-textarea--primary",
secondary: "hv-textarea--secondary",
},
},
});
export type TextAreaVariants = VariantProps<typeof textAreaVariants>;
export const avatarVariants = tv({
defaultVariants: {
color: "default",
size: "md",
},
slots: {
base: "hv-avatar",
fallback: "hv-avatar__fallback",
image: "hv-avatar__image",
},
variants: {
color: {
accent: {
fallback: "hv-avatar__fallback--accent",
},
danger: {
fallback: "hv-avatar__fallback--danger",
},
default: {
fallback: "hv-avatar__fallback--default",
},
success: {
fallback: "hv-avatar__fallback--success",
},
warning: {
fallback: "hv-avatar__fallback--warning",
},
},
size: {
lg: {
base: "hv-avatar--lg",
},
md: {
base: "hv-avatar--md",
},
sm: {
base: "hv-avatar--sm",
},
},
variant: {
default: {},
soft: {
base: "hv-avatar--soft",
},
},
},
});
export type AvatarVariants = VariantProps<typeof avatarVariants>;
export const avatarGroupVariants = tv({
defaultVariants: {
isGrid: false,
overlap: "clip",
},
slots: {
base: "hv-avatar-group",
count: "hv-avatar-group__count",
},
variants: {
isGrid: {
false: {},
true: {
base: "hv-avatar-group--grid",
},
},
overlap: {
clip: {
base: "hv-avatar-group--clip",
},
ring: {
base: "hv-avatar-group--ring",
},
},
},
});
export type AvatarGroupVariants = VariantProps<typeof avatarGroupVariants>;
export const skeletonVariants = tv({
defaultVariants: {
animationType: "shimmer",
},
slots: {
base: "hv-skeleton",
},
variants: {
animationType: {
none: "hv-skeleton--none",
pulse: "hv-skeleton--pulse",
shimmer: "hv-skeleton--shimmer",
},
},
});
export type SkeletonVariants = VariantProps<typeof skeletonVariants>;
export const separatorVariants = tv({
base: "hv-separator",
defaultVariants: {
orientation: "horizontal",
variant: "default",
},
variants: {
orientation: {
horizontal: "hv-separator--horizontal",
vertical: "hv-separator--vertical",
},
variant: {
default: "hv-separator--default",
secondary: "hv-separator--secondary",
tertiary: "hv-separator--tertiary",
},
},
});
export type SeparatorVariants = VariantProps<typeof separatorVariants>;
export const kbdVariants = tv({
defaultVariants: {
variant: "default",
},
slots: {
abbr: "hv-kbd__abbr",
base: "hv-kbd",
content: "hv-kbd__content",
},
variants: {
variant: {
default: "hv-kbd--default",
light: "hv-kbd--light",
},
},
});
export type KbdVariants = VariantProps<typeof kbdVariants>;
export const chipVariants = tv({
defaultVariants: {
color: "default",
size: "md",
variant: "secondary",
},
slots: {
base: "hv-chip",
label: "hv-chip__label",
},
variants: {
color: {
accent: {
base: "hv-chip--accent",
},
danger: {
base: "hv-chip--danger",
},
default: {
base: "hv-chip--default",
},
success: {
base: "hv-chip--success",
},
warning: {
base: "hv-chip--warning",
},
},
size: {
lg: {
base: "hv-chip--lg",
},
md: {
base: "hv-chip--md",
},
sm: {
base: "hv-chip--sm",
},
},
variant: {
primary: {
base: "hv-chip--primary",
},
secondary: {
base: "hv-chip--secondary",
},
soft: {
base: "hv-chip--soft",
},
tertiary: {
base: "hv-chip--tertiary",
},
},
},
});
export type ChipVariants = VariantProps<typeof chipVariants>;
export const badgeVariants = tv({
defaultVariants: {
color: "default",
placement: "top-right",
size: "md",
variant: "primary",
},
slots: {
anchor: "hv-badge-anchor",
base: "hv-badge",
label: "hv-badge__label",
},
variants: {
color: {
accent: {
base: "hv-badge--accent",
},
danger: {
base: "hv-badge--danger",
},
default: {
base: "hv-badge--default",
},
success: {
base: "hv-badge--success",
},
warning: {
base: "hv-badge--warning",
},
},
placement: {
"bottom-left": {
base: "hv-badge--bottom-left",
},
"bottom-right": {
base: "hv-badge--bottom-right",
},
"top-left": {
base: "hv-badge--top-left",
},
"top-right": {
base: "hv-badge--top-right",
},
},
size: {
lg: {
base: "hv-badge--lg",
},
md: {
base: "hv-badge--md",
},
sm: {
base: "hv-badge--sm",
},
},
variant: {
primary: {
base: "hv-badge--primary",
},
secondary: {
base: "hv-badge--secondary",
},
soft: {
base: "hv-badge--soft",
},
},
},
});
export type BadgeVariants = VariantProps<typeof badgeVariants>;
export const alertVariants = tv({
defaultVariants: {
status: "default",
},
slots: {
base: "hv-alert",
content: "hv-alert__content",
description: "hv-alert__description",
indicator: "hv-alert__indicator",
title: "hv-alert__title",
},
variants: {
status: {
accent: {
base: "hv-alert--accent",
},
danger: {
base: "hv-alert--danger",
},
default: {
base: "hv-alert--default",
},
success: {
base: "hv-alert--success",
},
warning: {
base: "hv-alert--warning",
},
},
},
});
export type AlertVariants = VariantProps<typeof alertVariants>;
export const inputGroupVariants = tv({
defaultVariants: {
fullWidth: false,
variant: "primary",
},
slots: {
base: "hv-input-group",
input: "hv-input-group__input",
prefix: "hv-input-group__prefix",
suffix: "hv-input-group__suffix",
},
variants: {
fullWidth: {
false: {},
true: {
base: "hv-input-group--full-width",
},
},
variant: {
primary: {
base: "hv-input-group--primary",
},
secondary: {
base: "hv-input-group--secondary",
},
},
},
});
export type InputGroupVariants = VariantProps<typeof inputGroupVariants>;
export const fieldsetVariants = tv({
slots: {
actions: "hv-fieldset__actions",
base: "hv-fieldset",
description: "hv-fieldset__description",
fieldGroup: "hv-fieldset__field-group",
legend: "hv-fieldset__legend",
},
});
export type FieldsetVariants = VariantProps<typeof fieldsetVariants>;
export const searchFieldVariants = tv({
defaultVariants: {
fullWidth: false,
variant: "primary",
},
slots: {
base: "hv-search-field",
clearButton: "hv-search-field__clear-button",
group: "hv-search-field__group",
input: "hv-search-field__input",
searchIcon: "hv-search-field__search-icon",
},
variants: {
fullWidth: {
false: {},
true: {
base: "hv-search-field--full-width",
group: "hv-search-field__group--full-width",
},
},
variant: {
primary: {
base: "hv-search-field--primary",
},
secondary: {
base: "hv-search-field--secondary",
},
},
},
});
export type SearchFieldVariants = VariantProps<typeof searchFieldVariants>;
export const checkboxVariants = tv({
defaultVariants: {
variant: "primary",
},
slots: {
base: "hv-checkbox",
content: "hv-checkbox__content",
control: "hv-checkbox__control",
indicator: "hv-checkbox__indicator",
},
variants: {
variant: {
primary: {
base: "hv-checkbox--primary",
},
secondary: {
base: "hv-checkbox--secondary",
},
},
},
});
export type CheckboxVariants = VariantProps<typeof checkboxVariants>;
export const checkboxGroupVariants = tv({
base: "hv-checkbox-group",
defaultVariants: {
variant: "primary",
},
variants: {
variant: {
primary: "hv-checkbox-group--primary",
secondary: "hv-checkbox-group--secondary",
},
},
});
export type CheckboxGroupVariants = VariantProps<typeof checkboxGroupVariants>;
export const radioVariants = tv({
slots: {
base: "hv-radio",
content: "hv-radio__content",
control: "hv-radio__control",
indicator: "hv-radio__indicator",
},
});
export type RadioVariants = VariantProps<typeof radioVariants>;
export const radioGroupVariants = tv({
base: "hv-radio-group",
defaultVariants: {
variant: "primary",
},
variants: {
variant: {
primary: "hv-radio-group--primary",
secondary: "hv-radio-group--secondary",
},
},
});
export type RadioGroupVariants = VariantProps<typeof radioGroupVariants>;
export const typographyVariants = tv({
defaultVariants: {
align: "start",
color: "default",
type: "body",
},
slots: {
base: "hv-typography",
prose: "hv-typography-prose",
},
variants: {
align: {
center: "hv-typography--align-center",
end: "hv-typography--align-end",
justify: "hv-typography--align-justify",
start: "hv-typography--align-start",
},
color: {
default: "hv-typography--color-default",
muted: "hv-typography--color-muted",
},
truncate: {
true: "hv-typography--truncate",
},
type: {
body: "hv-typography--body",
"body-sm": "hv-typography--body-sm",
"body-xs": "hv-typography--body-xs",
code: "hv-typography--code",
h1: "hv-typography--h1",
h2: "hv-typography--h2",
h3: "hv-typography--h3",
h4: "hv-typography--h4",
h5: "hv-typography--h5",
h6: "hv-typography--h6",
},
weight: {
bold: "hv-typography--weight-bold",
medium: "hv-typography--weight-medium",
normal: "hv-typography--weight-normal",
semibold: "hv-typography--weight-semibold",
},
},
});
export type TypographyVariants = VariantProps<typeof typographyVariants>;
export const breadcrumbsVariants = tv({
slots: {
base: "hv-breadcrumbs",
item: "hv-breadcrumbs__item",
link: "hv-breadcrumbs__link",
separator: "hv-breadcrumbs__separator",
},
});
export type BreadcrumbsVariants = VariantProps<typeof breadcrumbsVariants>;
export const emptyStateVariants = tv({
base: "hv-empty-state",
});
export type EmptyStateVariants = VariantProps<typeof emptyStateVariants>;
export const progressBarVariants = tv({
defaultVariants: {
color: "accent",
size: "md",
},
slots: {
base: "hv-progress-bar",
fill: "hv-progress-bar__fill",
output: "hv-progress-bar__output",
track: "hv-progress-bar__track",
},
variants: {
color: {
accent: {
base: "hv-progress-bar--accent",
},
danger: {
base: "hv-progress-bar--danger",
},
default: {
base: "hv-progress-bar--default",
},
success: {
base: "hv-progress-bar--success",
},
warning: {
base: "hv-progress-bar--warning",
},
},
size: {
lg: {
base: "hv-progress-bar--lg",
},
md: {
base: "hv-progress-bar--md",
},
sm: {
base: "hv-progress-bar--sm",
},
},
},
});
export type ProgressBarVariants = VariantProps<typeof progressBarVariants>;
export const progressCircleVariants = tv({
defaultVariants: {
color: "accent",
size: "md",
},
slots: {
base: "hv-progress-circle",
fillCircle: "hv-progress-circle__fill-circle",
track: "hv-progress-circle__track",
trackCircle: "hv-progress-circle__track-circle",
},
variants: {
color: {
accent: {
base: "hv-progress-circle--accent",
},
danger: {
base: "hv-progress-circle--danger",
},
default: {
base: "hv-progress-circle--default",
},
success: {
base: "hv-progress-circle--success",
},
warning: {
base: "hv-progress-circle--warning",
},
},
size: {
lg: {
base: "hv-progress-circle--lg",
},
md: {
base: "hv-progress-circle--md",
},
sm: {
base: "hv-progress-circle--sm",
},
},
},
});
export type ProgressCircleVariants = VariantProps<
typeof progressCircleVariants
>;
export const meterVariants = tv({
defaultVariants: {
color: "accent",
size: "md",
},
slots: {
base: "hv-meter",
fill: "hv-meter__fill",
output: "hv-meter__output",
track: "hv-meter__track",
},
variants: {
color: {
accent: {
base: "hv-meter--accent",
},
danger: {
base: "hv-meter--danger",
},
default: {
base: "hv-meter--default",
},
success: {
base: "hv-meter--success",
},
warning: {
base: "hv-meter--warning",
},
},
size: {
lg: {
base: "hv-meter--lg",
},
md: {
base: "hv-meter--md",
},
sm: {
base: "hv-meter--sm",
},
},
},
});
export type MeterVariants = VariantProps<typeof meterVariants>;
export const disclosureVariants = tv({
defaultVariants: {},
slots: {
base: "hv-disclosure",
body: "hv-disclosure__body",
bodyInner: "hv-disclosure__body-inner",
content: "hv-disclosure__content",
heading: "hv-disclosure__heading",
indicator: "hv-disclosure__indicator",
trigger: "hv-disclosure__trigger",
},
variants: {},
});
export type DisclosureVariants = VariantProps<typeof disclosureVariants>;
export const disclosureGroupVariants = tv({
defaultVariants: {},
slots: {
base: "hv-disclosure-group",
},
variants: {},
});
export type DisclosureGroupVariants = VariantProps<
typeof disclosureGroupVariants
>;
export const accordionVariants = tv({
slots: {
base: "hv-accordion",
body: "hv-accordion__body",
bodyInner: "hv-accordion__body-inner",
heading: "hv-accordion__heading",
indicator: "hv-accordion__indicator",
item: "hv-accordion__item",
panel: "hv-accordion__panel",
trigger: "hv-accordion__trigger",
},
variants: {
variant: {
default: {},
surface: {
base: "hv-accordion--surface",
},
},
},
});
export type AccordionVariants = VariantProps<typeof accordionVariants>;
export const modalVariants = tv({
defaultVariants: {
scroll: "inside",
size: "md",
variant: "opaque",
},
slots: {
backdrop: "hv-modal__backdrop",
body: "hv-modal__body",
closeTrigger: "hv-modal__close-trigger",
container: "hv-modal__container",
dialog: "hv-modal__dialog",
footer: "hv-modal__footer",
header: "hv-modal__header",
heading: "hv-modal__heading",
icon: "hv-modal__icon",
trigger: "hv-modal__trigger",
},
variants: {
scroll: {
inside: {
body: "hv-modal__body--scroll-inside",
dialog: "hv-modal__dialog--scroll-inside",
},
outside: {
body: "hv-modal__body--scroll-outside",
container: "hv-modal__container--scroll-outside",
dialog: "hv-modal__dialog--scroll-outside",
},
},
size: {
cover: {
dialog: "hv-modal__dialog--cover",
},
full: {
container: "hv-modal__container--full",
dialog: "hv-modal__dialog--full",
},
lg: {
dialog: "hv-modal__dialog--lg",
},
md: {
dialog: "hv-modal__dialog--md",
},
sm: {
dialog: "hv-modal__dialog--sm",
},
xs: {
dialog: "hv-modal__dialog--xs",
},
},
variant: {
blur: {
backdrop: "hv-modal__backdrop--blur",
},
opaque: {
backdrop: "hv-modal__backdrop--opaque",
},
transparent: {
backdrop: "hv-modal__backdrop--transparent",
},
},
},
});
export type ModalVariants = VariantProps<typeof modalVariants>;
export const popoverVariants = tv({
slots: {
base: "hv-popover",
dialog: "hv-popover__dialog",
heading: "hv-popover__heading",
trigger: "hv-popover__trigger",
},
});
export type PopoverVariants = VariantProps<typeof popoverVariants>;
export const tooltipVariants = tv({
slots: {
base: "hv-tooltip",
trigger: "hv-tooltip__trigger",
},
});
export type TooltipVariants = VariantProps<typeof tooltipVariants>;
export const scrollShadowVariants = tv({
defaultVariants: {
hideScrollBar: false,
orientation: "vertical",
variant: "fade",
},
slots: {
base: "hv-scroll-shadow",
},
variants: {
hideScrollBar: {
false: {},
true: {
base: "hv-scroll-shadow--hide-scrollbar",
},
},
orientation: {
horizontal: {
base: "hv-scroll-shadow--horizontal",
},
vertical: {
base: "hv-scroll-shadow--vertical",
},
},
variant: {
fade: {
base: "hv-scroll-shadow--fade",
},
},
},
});
export type ScrollShadowVariants = VariantProps<typeof scrollShadowVariants>;
export const tabsVariants = tv({
defaultVariants: {
align: "center",
variant: "primary",
},
slots: {
base: "hv-tabs",
scrollNext: "hv-tabs__list-container__scroll-next",
scrollPrev: "hv-tabs__list-container__scroll-prev",
scroller: "hv-tabs__list-container__scroller",
separator: "hv-tabs__separator",
tab: "hv-tabs__tab",
tabIndicator: "hv-tabs__indicator",
tabList: "hv-tabs__list",
tabListContainer: "hv-tabs__list-container",
tabPanel: "hv-tabs__panel",
},
variants: {
align: {
center: {}, // No class as the base already centers tab content
end: {
base: "hv-tabs--align-end",
},
start: {
base: "hv-tabs--align-start",
},
},
variant: {
primary: {},
secondary: {
base: "hv-tabs--secondary",
},
},
},
});
// Render props that should be excluded from TabsVariants (framework-specific)
type TabsRenderPropsKeys = "selectedKey";
export type TabsVariants = Omit<
VariantProps<typeof tabsVariants>,
TabsRenderPropsKeys
>;
export const buttonGroupVariants = tv({
defaultVariants: {
fullWidth: false,
orientation: "horizontal",
},
slots: {
base: "hv-button-group",
separator: "hv-button-group__separator",
},
variants: {
fullWidth: {
false: {},
true: {
base: "hv-button-group--full-width",
},
},
orientation: {
horizontal: {
base: "hv-button-group--horizontal",
},
vertical: {
base: "hv-button-group--vertical",
},
},
},
});
export type ButtonGroupVariants = VariantProps<typeof buttonGroupVariants>;
export const toggleButtonVariants = tv({
base: "hv-toggle-button",
defaultVariants: {
isIconOnly: false,
size: "md",
variant: "default",
},
variants: {
isIconOnly: {
true: "hv-toggle-button--icon-only",
},
size: {
lg: "hv-toggle-button--lg",
md: "hv-toggle-button--md",
sm: "hv-toggle-button--sm",
},
variant: {
default: "hv-toggle-button--default",
ghost: "hv-toggle-button--ghost",
},
},
});
export type ToggleButtonVariants = VariantProps<typeof toggleButtonVariants>;
export const toggleButtonGroupVariants = tv({
defaultVariants: {
fullWidth: false,
isDetached: false,
orientation: "horizontal",
},
slots: {
base: "hv-toggle-button-group",
separator: "hv-toggle-button-group__separator",
},
variants: {
fullWidth: {
false: {},
true: {
base: "hv-toggle-button-group--full-width",
},
},
isDetached: {
false: {},
true: {
base: "hv-toggle-button-group--detached",
},
},
orientation: {
horizontal: {
base: "hv-toggle-button-group--horizontal",
},
vertical: {
base: "hv-toggle-button-group--vertical",
},
},
},
});
export type ToggleButtonGroupVariants = VariantProps<
typeof toggleButtonGroupVariants
>;
export const toolbarVariants = tv({
base: "hv-toolbar",
defaultVariants: {
isAttached: false,
orientation: "horizontal",
},
variants: {
isAttached: {
true: "hv-toolbar--attached",
},
orientation: {
horizontal: "hv-toolbar--horizontal",
vertical: "hv-toolbar--vertical",
},
},
});
export type ToolbarVariants = VariantProps<typeof toolbarVariants>;
export const paginationVariants = tv({
defaultVariants: {
size: "md",
},
slots: {
base: "hv-pagination",
content: "hv-pagination__content",
ellipsis: "hv-pagination__ellipsis",
item: "hv-pagination__item",
link: "hv-pagination__link",
summary: "hv-pagination__summary",
},
variants: {
size: {
lg: {
base: "hv-pagination--lg",
},
md: {
base: "hv-pagination--md",
},
sm: {
base: "hv-pagination--sm",
},
},
},
});
export type PaginationVariants = VariantProps<typeof paginationVariants>;
export const headerVariants = tv({
base: "hv-header",
});
export type HeaderVariants = VariantProps<typeof headerVariants>;
export const inputOTPVariants = tv({
defaultVariants: {
variant: "primary",
},
slots: {
base: "hv-input-otp",
caret: "hv-input-otp__caret",
group: "hv-input-otp__group",
input: "hv-input-otp__input",
separator: "hv-input-otp__separator",
slot: "hv-input-otp__slot",
slotValue: "hv-input-otp__slot-value",
},
variants: {
variant: {
primary: {
base: "hv-input-otp--primary",
},
secondary: {
base: "hv-input-otp--secondary",
},
},
},
});
export type InputOTPVariants = VariantProps<typeof inputOTPVariants>;
export const numberFieldVariants = tv({
defaultVariants: {
fullWidth: false,
variant: "primary",
},
slots: {
base: "hv-number-field",
decrementButton: "hv-number-field__decrement-button",
group: "hv-number-field__group",
incrementButton: "hv-number-field__increment-button",
input: "hv-number-field__input",
},
variants: {
fullWidth: {
false: {},
true: {
base: "hv-number-field--full-width",
group: "hv-number-field__group--full-width",
},
},
variant: {
primary: {
base: "hv-number-field--primary",
},
secondary: {
base: "hv-number-field--secondary",
},
},
},
});
export type NumberFieldVariants = VariantProps<typeof numberFieldVariants>;
export const sliderVariants = tv({
slots: {
base: "hv-slider",
fill: "hv-slider__fill",
marks: "hv-slider__marks",
output: "hv-slider__output",
thumb: "hv-slider__thumb",
track: "hv-slider__track",
},
});
export type SliderVariants = VariantProps<typeof sliderVariants>;
// Adapted from HeroUI ce90ea3, Apache-2.0.
export const listboxVariants = tv({
base: "hv-list-box",
defaultVariants: { variant: "default" },
variants: {
variant: { default: "hv-list-box--default", danger: "hv-list-box--danger" },
},
});
export type ListBoxVariants = VariantProps<typeof listboxVariants>;
export const listboxItemVariants = tv({
slots: { item: "hv-list-box-item", indicator: "hv-list-box-item__indicator" },
defaultVariants: { variant: "default" },
variants: {
variant: {
default: { item: "hv-list-box-item--default" },
danger: { item: "hv-list-box-item--danger" },
},
},
});
export type ListBoxItemVariants = VariantProps<typeof listboxItemVariants>;
export const listboxSectionVariants = tv({ base: "hv-list-box-section" });
export type ListBoxSectionVariants = VariantProps<
typeof listboxSectionVariants
>;
export const alertDialogVariants = tv({
defaultVariants: {
size: "md",
status: "danger",
variant: "opaque",
},
slots: {
backdrop: "hv-alert-dialog__backdrop",
body: "hv-alert-dialog__body",
closeTrigger: "hv-alert-dialog__close-trigger",
container: "hv-alert-dialog__container",
dialog: "hv-alert-dialog__dialog",
footer: "hv-alert-dialog__footer",
header: "hv-alert-dialog__header",
heading: "hv-alert-dialog__heading",
icon: "hv-alert-dialog__icon",
trigger: "hv-alert-dialog__trigger",
},
variants: {
size: {
cover: {
dialog: "hv-alert-dialog__dialog--cover",
},
lg: {
dialog: "hv-alert-dialog__dialog--lg",
},
md: {
dialog: "hv-alert-dialog__dialog--md",
},
sm: {
dialog: "hv-alert-dialog__dialog--sm",
},
xs: {
dialog: "hv-alert-dialog__dialog--xs",
},
},
status: {
accent: {
icon: "hv-alert-dialog__icon--accent",
},
danger: {
icon: "hv-alert-dialog__icon--danger",
},
default: {
icon: "hv-alert-dialog__icon--default",
},
success: {
icon: "hv-alert-dialog__icon--success",
},
warning: {
icon: "hv-alert-dialog__icon--warning",
},
},
variant: {
blur: {
backdrop: "hv-alert-dialog__backdrop--blur",
},
opaque: {
backdrop: "hv-alert-dialog__backdrop--opaque",
},
transparent: {
backdrop: "hv-alert-dialog__backdrop--transparent",
},
},
},
});
export type AlertDialogVariants = VariantProps<typeof alertDialogVariants>;
export const drawerVariants = tv({
defaultVariants: {
placement: "bottom",
variant: "opaque",
},
slots: {
backdrop: "hv-drawer__backdrop",
body: "hv-drawer__body",
closeTrigger: "hv-drawer__close-trigger",
content: "hv-drawer__content",
dialog: "hv-drawer__dialog",
footer: "hv-drawer__footer",
handle: "hv-drawer__handle",
header: "hv-drawer__header",
heading: "hv-drawer__heading",
trigger: "hv-drawer__trigger",
},
variants: {
placement: {
bottom: {
content: "hv-drawer__content--bottom",
dialog: "hv-drawer__dialog--bottom",
},
left: {
content: "hv-drawer__content--left",
dialog: "hv-drawer__dialog--left",
},
right: {
content: "hv-drawer__content--right",
dialog: "hv-drawer__dialog--right",
},
top: {
content: "hv-drawer__content--top",
dialog: "hv-drawer__dialog--top",
},
},
variant: {
blur: {
backdrop: "hv-drawer__backdrop--blur",
},
opaque: {
backdrop: "hv-drawer__backdrop--opaque",
},
transparent: {
backdrop: "hv-drawer__backdrop--transparent",
},
},
},
});
export type DrawerVariants = VariantProps<typeof drawerVariants>;
export const selectVariants = tv({
defaultVariants: {
fullWidth: false,
variant: "primary",
},
slots: {
base: "hv-select",
clearButton: "hv-select__clear-button",
indicator: "hv-select__indicator",
popover: "hv-select__popover",
trigger: "hv-select__trigger",
value: "hv-select__value",
},
variants: {
fullWidth: {
false: {},
true: {
base: "hv-select--full-width",
trigger: "hv-select__trigger--full-width",
},
},
variant: {
primary: {
base: "hv-select--primary",
},
secondary: {
base: "hv-select--secondary",
},
},
},
});
export type SelectVariants = VariantProps<typeof selectVariants>;
export const dateFieldVariants = tv({
base: "hv-date-field",
defaultVariants: { fullWidth: false },
variants: { fullWidth: { true: "hv-date-field--full-width", false: "" } },
});
export type DateFieldVariants = VariantProps<typeof dateFieldVariants>;
export const datePickerVariants = tv({
slots: {
base: "hv-date-picker",
popover: "hv-date-picker__popover",
trigger: "hv-date-picker__trigger",
triggerIndicator: "hv-date-picker__trigger-indicator",
},
});
export type DatePickerVariants = VariantProps<typeof datePickerVariants>;
// Ported from HeroUI ce90ea3, Apache-2.0; hv namespace only.
export const dateRangePickerVariants = tv({
slots: {
base: "hv-date-range-picker",
popover: "hv-date-range-picker__popover",
rangeSeparator: "hv-date-range-picker__range-separator",
trigger: "hv-date-range-picker__trigger",
triggerIndicator: "hv-date-range-picker__trigger-indicator",
},
});
export type DateRangePickerVariants = VariantProps<
typeof dateRangePickerVariants
>;
export const dateInputGroupVariants = tv({
slots: {
base: "hv-date-input-group",
input: "hv-date-input-group__input",
inputContainer: "hv-date-input-group__input-container",
segment: "hv-date-input-group__segment",
prefix: "hv-date-input-group__prefix",
suffix: "hv-date-input-group__suffix",
},
defaultVariants: { fullWidth: false, variant: "primary" },
variants: {
fullWidth: { true: { base: "hv-date-input-group--full-width" }, false: {} },
variant: {
primary: { base: "hv-date-input-group--primary" },
secondary: { base: "hv-date-input-group--secondary" },
},
},
});
export type DateInputGroupVariants = VariantProps<
typeof dateInputGroupVariants
>;
export const toastVariants = tv({
defaultVariants: {
placement: "bottom",
variant: "default",
},
slots: {
action: "hv-toast__action",
close: "hv-toast__close-button",
content: "hv-toast__content",
description: "hv-toast__description",
indicator: "hv-toast__indicator",
region: "hv-toast-region",
title: "hv-toast__title",
toast: "hv-toast",
},
variants: {
placement: {
bottom: {
region: "hv-toast-region--bottom",
toast: "hv-toast--bottom",
},
"bottom end": {
region: "hv-toast-region--bottom-end",
toast: "hv-toast--bottom-end",
},
"bottom start": {
region: "hv-toast-region--bottom-start",
toast: "hv-toast--bottom-start",
},
top: {
region: "hv-toast-region--top",
toast: "hv-toast--top",
},
"top end": {
region: "hv-toast-region--top-end",
toast: "hv-toast--top-end",
},
"top start": {
region: "hv-toast-region--top-start",
toast: "hv-toast--top-start",
},
},
variant: {
accent: {
toast: "hv-toast--accent",
},
danger: {
toast: "hv-toast--danger",
},
default: {
toast: "hv-toast--default",
},
success: {
toast: "hv-toast--success",
},
warning: {
toast: "hv-toast--warning",
},
},
},
});
export type ToastVariants = VariantProps<typeof toastVariants>;
export const tableVariants = tv({
defaultVariants: {
variant: "primary",
},
slots: {
base: "hv-table-root",
body: "hv-table__body",
cell: "hv-table__cell",
column: "hv-table__column",
columnResizer: "hv-table__column-resizer",
content: "hv-table__content",
footer: "hv-table__footer",
header: "hv-table__header",
loadMore: "hv-table__load-more",
loadMoreContent: "hv-table__load-more-content",
resizableContainer: "hv-table__resizable-container",
row: "hv-table__row",
scrollContainer: "hv-table__scroll-container",
sortableColumnHeader: "hv-table__sortable-column-header",
sortableColumnIndicator: "hv-table__sortable-column-indicator",
},
variants: {
variant: {
primary: {
base: "hv-table-root--primary",
},
secondary: {
base: "hv-table-root--secondary",
},
},
},
});
export type TableVariants = VariantProps<typeof tableVariants>;
export const calendarVariants = tv({
defaultVariants: {},
slots: {
/** Root calendar container */
base: "hv-calendar",
/** Calendar cell (td) */
cell: "hv-calendar__cell",
/** Cell indicator (small dot at bottom of cell) */
cellIndicator: "hv-calendar__cell-indicator",
/** Calendar grid (table) */
grid: "hv-calendar__grid",
/** Grid body (tbody) */
gridBody: "hv-calendar__grid-body",
/** Grid header (thead) */
gridHeader: "hv-calendar__grid-header",
/** Grid row (tr) */
gridRow: "hv-calendar__grid-row",
/** Calendar header containing heading and navigation */
header: "hv-calendar__header",
/** Header cell (th - day names) */
headerCell: "hv-calendar__header-cell",
/** Month/year heading text */
heading: "hv-calendar__heading",
/** Previous/Next navigation button */
navButton: "hv-calendar__nav-button",
/** Navigation button icon */
navButtonIcon: "hv-calendar__nav-button-icon",
},
variants: {},
});
export type CalendarVariants = VariantProps<typeof calendarVariants>;
export const calendarYearPickerVariants = tv({
slots: {
trigger: "hv-calendar-year-picker__trigger",
triggerHeading: "hv-calendar-year-picker__trigger-heading",
triggerIndicator: "hv-calendar-year-picker__trigger-indicator",
yearCell: "hv-calendar-year-picker__year-cell",
yearGrid: "hv-calendar-year-picker__year-grid",
},
});
export type CalendarYearPickerVariants = VariantProps<
typeof calendarYearPickerVariants
>;
export const menuVariants = tv({
base: "hv-menu",
});
export type MenuVariants = VariantProps<typeof menuVariants>;
export const menuItemVariants = tv({
defaultVariants: {
variant: "default",
},
slots: {
indicator: "hv-menu-item__indicator",
item: "hv-menu-item",
submenuIndicator:
"hv-menu-item__indicator hv-menu-item__indicator--submenu",
},
variants: {
variant: {
danger: {
item: "hv-menu-item--danger",
},
default: {
item: "hv-menu-item--default",
},
},
},
});
export type MenuItemVariants = VariantProps<typeof menuItemVariants>;
export const menuSectionVariants = tv({
base: "hv-menu-section",
});
export type MenuSectionVariants = VariantProps<typeof menuSectionVariants>;
export const dropdownVariants = tv({
slots: {
menu: "hv-dropdown__menu",
popover: "hv-dropdown__popover",
root: "hv-dropdown",
trigger: "hv-dropdown__trigger",
},
});
export type DropdownVariants = VariantProps<typeof dropdownVariants>;
export const tagVariants = tv({
defaultVariants: {
size: "md",
variant: "default",
},
slots: {
base: "hv-tag",
removeButton: "hv-tag__remove-button",
},
variants: {
size: {
lg: {
base: "hv-tag--lg",
},
md: {
base: "hv-tag--md",
},
sm: {
base: "hv-tag--sm",
},
},
variant: {
default: {
base: "hv-tag--default",
},
surface: {
base: "hv-tag--surface",
},
},
},
});
export type TagVariants = VariantProps<typeof tagVariants>;
export const tagGroupVariants = tv({
slots: {
base: "hv-tag-group",
list: "hv-tag-group__list",
},
});
export type TagGroupVariants = VariantProps<typeof tagGroupVariants>;
export const errorMessageVariants = tv({
base: "hv-error-message",
});
export type ErrorMessageVariants = VariantProps<typeof errorMessageVariants>;
export const comboBoxVariants = tv({
defaultVariants: {
fullWidth: false,
},
slots: {
base: "hv-combo-box",
inputGroup: "hv-combo-box__input-group",
popover: "hv-combo-box__popover",
trigger: "hv-combo-box__trigger",
value: "hv-combo-box__value",
},
variants: {
fullWidth: {
false: {},
true: {
base: "hv-combo-box--full-width",
inputGroup: "hv-combo-box__input-group--full-width",
},
},
},
});
export type ComboBoxVariants = VariantProps<typeof comboBoxVariants>;
export const autocompleteVariants = tv({
defaultVariants: {
fullWidth: false,
variant: "primary",
},
slots: {
base: "hv-autocomplete",
clearButton: "hv-autocomplete__clear-button",
filter: "hv-autocomplete__filter",
indicator: "hv-autocomplete__indicator",
popover: "hv-autocomplete__popover",
trigger: "hv-autocomplete__trigger",
value: "hv-autocomplete__value",
},
variants: {
fullWidth: {
false: {},
true: {
base: "hv-autocomplete--full-width",
trigger: "hv-autocomplete__trigger--full-width",
},
},
variant: {
primary: {
base: "hv-autocomplete--primary",
},
secondary: {
base: "hv-autocomplete--secondary",
},
},
},
});
export type AutocompleteVariants = VariantProps<typeof autocompleteVariants>;
export const colorSwatchVariants = tv({
base: "hv-color-swatch",
defaultVariants: {
shape: "circle",
size: "md",
},
variants: {
shape: {
circle: "hv-color-swatch--circle",
square: "hv-color-swatch--square",
},
size: {
lg: "hv-color-swatch--lg",
md: "hv-color-swatch--md",
sm: "hv-color-swatch--sm",
xl: "hv-color-swatch--xl",
xs: "hv-color-swatch--xs",
},
},
});
export type ColorSwatchVariants = VariantProps<typeof colorSwatchVariants>;
/** HeroUI 3.2.6 / ce90ea3, Apache-2.0; hv namespace only. Baseline has base/trigger/popover only. */
export const colorPickerVariants = tv({
slots: {
base: "hv-color-picker",
popover: "hv-color-picker__popover",
trigger: "hv-color-picker__trigger",
},
});
export type ColorPickerVariants = VariantProps<typeof colorPickerVariants>;
/** HeroUI 3.2.6 / ce90ea3, Apache-2.0; hv namespace only. */
export const colorSwatchPickerVariants = tv({
defaultVariants: {
layout: "grid",
size: "md",
variant: "circle",
},
slots: {
base: "hv-color-swatch-picker",
indicator: "hv-color-swatch-picker__indicator",
item: "hv-color-swatch-picker__item",
swatch: "hv-color-swatch-picker__swatch",
},
variants: {
layout: {
grid: {
base: "hv-color-swatch-picker--grid",
},
stack: {
base: "hv-color-swatch-picker--stack",
},
},
size: {
lg: {
base: "hv-color-swatch-picker--lg",
},
md: {
base: "hv-color-swatch-picker--md",
},
sm: {
base: "hv-color-swatch-picker--sm",
},
xl: {
base: "hv-color-swatch-picker--xl",
},
xs: {
base: "hv-color-swatch-picker--xs",
},
},
variant: {
circle: {
base: "hv-color-swatch-picker--circle",
},
square: {
base: "hv-color-swatch-picker--square",
},
},
},
});
export type ColorSwatchPickerVariants = VariantProps<
typeof colorSwatchPickerVariants
>;
/** HeroUI 3.2.6 / ce90ea3, Apache-2.0; hv namespace only. */
export const colorAreaVariants = tv({
defaultVariants: {
showDots: false,
},
slots: {
base: "hv-color-area",
thumb: "hv-color-area__thumb",
},
variants: {
showDots: {
false: {},
true: {
base: "hv-color-area--show-dots",
},
},
},
});
export type ColorAreaVariants = VariantProps<typeof colorAreaVariants>;
/** HeroUI 3.2.6 / ce90ea3, Apache-2.0; hv namespace only. */
export const colorSliderVariants = tv({
slots: {
base: "hv-color-slider",
output: "hv-color-slider__output",
thumb: "hv-color-slider__thumb",
track: "hv-color-slider__track",
},
});
export type ColorSliderVariants = VariantProps<typeof colorSliderVariants>;
/** HeroUI 3.2.6 / ce90ea3, Apache-2.0; hv namespace only. */
export const timeFieldVariants = tv({
base: "hv-time-field",
defaultVariants: { fullWidth: false },
variants: { fullWidth: { false: "", true: "hv-time-field--full-width" } },
});
export type TimeFieldVariants = VariantProps<typeof timeFieldVariants>;
// Ported from HeroUI ce90ea3, Apache-2.0.
export const rangeCalendarVariants = tv({
defaultVariants: {},
slots: {
/** Root range calendar container */
base: "hv-range-calendar",
/** Calendar cell (td) */
cell: "hv-range-calendar__cell",
/** Cell indicator (small dot at bottom of cell) */
cellIndicator: "hv-range-calendar__cell-indicator",
/** Calendar grid (table) */
grid: "hv-range-calendar__grid",
/** Grid body (tbody) */
gridBody: "hv-range-calendar__grid-body",
/** Grid header (thead) */
gridHeader: "hv-range-calendar__grid-header",
/** Grid row (tr) */
gridRow: "hv-range-calendar__grid-row",
/** Calendar header containing heading and navigation */
header: "hv-range-calendar__header",
/** Header cell (th - day names) */
headerCell: "hv-range-calendar__header-cell",
/** Month/year heading text */
heading: "hv-range-calendar__heading",
/** Previous/Next navigation button */
navButton: "hv-range-calendar__nav-button",
/** Navigation button icon */
navButtonIcon: "hv-range-calendar__nav-button-icon",
},
variants: {},
});
export type RangeCalendarVariants = VariantProps<typeof rangeCalendarVariants>;
/** HeroUI 3.2.6 / ce90ea3, Apache-2.0; hv namespace only. */
export const colorFieldVariants = tv({
base: "hv-color-field",
defaultVariants: { fullWidth: false },
variants: { fullWidth: { false: "", true: "hv-color-field--full-width" } },
});
export type ColorFieldVariants = VariantProps<typeof colorFieldVariants>;
export const colorInputGroupVariants = tv({
defaultVariants: { fullWidth: false, variant: "primary" },
slots: {
base: "hv-color-input-group",
input: "hv-color-input-group__input",
prefix: "hv-color-input-group__prefix",
suffix: "hv-color-input-group__suffix",
},
variants: {
fullWidth: {
false: {},
true: { base: "hv-color-input-group--full-width" },
},
variant: {
primary: { base: "hv-color-input-group--primary" },
secondary: { base: "hv-color-input-group--secondary" },
},
},
});
export type ColorInputGroupVariants = VariantProps<
typeof colorInputGroupVariants
>;