/* * Copyright (C) 2026 Fluxer Contributors * * This file is part of Fluxer. * * Fluxer is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Fluxer is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with Fluxer. If not, see . */ /** @jsxRuntime automatic */ /** @jsxImportSource hono/jsx */ import {cn} from '@fluxer/admin/src/utils/ClassNames'; import type {Child, PropsWithChildren} from 'hono/jsx'; export interface HeadingProps { level: 1 | 2 | 3 | 4 | 5 | 6; size?: 'xs' | 'sm' | 'base' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl'; class?: string; } const headingSizes: Record<1 | 2 | 3 | 4 | 5 | 6, string> = { 1: 'text-3xl font-bold', 2: 'text-2xl font-semibold', 3: 'text-xl font-semibold', 4: 'text-lg font-semibold', 5: 'text-base font-semibold', 6: 'text-sm font-semibold', }; const customSizes: Record, string> = { xs: 'text-xs', sm: 'text-sm', base: 'text-base', lg: 'text-lg', xl: 'text-xl', '2xl': 'text-2xl', '3xl': 'text-3xl', '4xl': 'text-4xl', }; export function Heading(props: PropsWithChildren) { const {level, size, children, class: className} = props; const classes = cn('text-gray-900 tracking-tight', size ? customSizes[size] : headingSizes[level], className); if (level === 1) return

{children}

; if (level === 2) return

{children}

; if (level === 3) return

{children}

; if (level === 4) return

{children}

; if (level === 5) return
{children}
; return
{children}
; } export interface TextProps { size?: 'xs' | 'sm' | 'base' | 'lg'; weight?: 'normal' | 'medium' | 'semibold' | 'bold'; color?: 'default' | 'muted' | 'primary' | 'danger' | 'success'; class?: string; } const textSizes: Record, string> = { xs: 'text-xs', sm: 'text-sm', base: 'text-base', lg: 'text-lg', }; const textWeights: Record, string> = { normal: 'font-normal', medium: 'font-medium', semibold: 'font-semibold', bold: 'font-bold', }; const textColors: Record, string> = { default: 'text-gray-900', muted: 'text-neutral-500', primary: 'text-brand-primary', danger: 'text-red-600', success: 'text-green-600', }; export function Text(props: PropsWithChildren) { const {size = 'base', weight = 'normal', color = 'default', children, class: className} = props; const classes = cn(textSizes[size], textWeights[weight], textColors[color], className); return

{children}

; } export interface LabelProps { htmlFor?: string; required?: boolean; class?: string; } export function Label(props: PropsWithChildren) { const {htmlFor, required = false, children, class: className} = props; const classes = cn('block text-xs font-semibold uppercase tracking-wide text-neutral-500', className); return ( ); } export interface CaptionProps { variant?: 'default' | 'error' | 'success'; class?: string; } const captionVariants: Record, string> = { default: 'text-gray-500', error: 'text-red-600', success: 'text-green-600', }; export function Caption(props: PropsWithChildren) { const {variant = 'default', children, class: className} = props; const classes = cn('text-xs', captionVariants[variant], className); return

{children}

; } export interface SectionHeadingProps { actions?: Child; class?: string; } export function SectionHeading(props: PropsWithChildren) { const {actions, children, class: className} = props; if (actions) { return (

{children}

{actions}
); } return

{children}

; }