Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | /** * Layout Component Types * * Centralized type definitions for all layout components including * Container, Grid, Flex, Section, and their variants. * * @module types/layout */ import { HTMLAttributes } from 'react'; // ============================================================================ // Container Types // ============================================================================ /** * Container Component Props * * Props for the main Container component that centers content and applies * consistent max-width for responsive layouts. * * @example * ```tsx * <Container size="lg"> * <h1>Page Title</h1> * </Container> * ``` */ export interface ContainerProps extends React.HTMLAttributes<HTMLDivElement> { /** Container max width variant */ size?: 'sm' | 'md' | 'lg' | 'xl' | 'full'; /** Remove horizontal padding */ noPadding?: boolean; /** Center content horizontally (default: true) */ center?: boolean; /** Custom element type to render as */ as?: React.ElementType; } /** * Inline Container Props * * Props for the inline Container component used within Section components. * Simpler variant with boolean padding control. */ export interface InlineContainerProps extends HTMLAttributes<HTMLDivElement> { /** Container max width variant */ size?: 'sm' | 'md' | 'lg' | 'xl' | 'full'; /** Center content horizontally (default: true) */ center?: boolean; /** Enable horizontal padding (default: true) */ padding?: boolean; } // ============================================================================ // Grid Types // ============================================================================ /** * Responsive Grid Configuration * * Defines responsive column counts for different breakpoints. */ export interface ResponsiveGridConfig { /** Columns at small breakpoint (640px+) */ sm?: 1 | 2 | 3 | 4 | 6 | 12; /** Columns at medium breakpoint (768px+) */ md?: 1 | 2 | 3 | 4 | 6 | 12; /** Columns at large breakpoint (1024px+) */ lg?: 1 | 2 | 3 | 4 | 6 | 12; /** Columns at extra large breakpoint (1280px+) */ xl?: 1 | 2 | 3 | 4 | 6 | 12; } /** * Grid Component Props * * Props for the CSS Grid layout component with responsive configuration. * * @example * ```tsx * <Grid cols={3} gap="md" responsive={{ sm: 1, md: 2, lg: 3 }}> * <Card>Item 1</Card> * <Card>Item 2</Card> * <Card>Item 3</Card> * </Grid> * ``` */ export interface GridProps extends React.HTMLAttributes<HTMLDivElement> { /** Number of columns in the grid */ cols?: 1 | 2 | 3 | 4 | 6 | 12; /** Responsive column configuration for different breakpoints */ responsive?: ResponsiveGridConfig; /** Gap size between grid items */ gap?: 'none' | 'sm' | 'md' | 'lg' | 'xl'; /** Vertical alignment of grid items */ alignItems?: 'start' | 'center' | 'end' | 'stretch'; /** Horizontal alignment of grid items */ justifyItems?: 'start' | 'center' | 'end' | 'stretch'; } /** * Responsive Grid Item Span Configuration * * Defines responsive column spans for grid items at different breakpoints. */ export interface ResponsiveGridItemConfig { /** Column span at small breakpoint (640px+) */ sm?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12; /** Column span at medium breakpoint (768px+) */ md?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12; /** Column span at large breakpoint (1024px+) */ lg?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12; /** Column span at extra large breakpoint (1280px+) */ xl?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12; } /** * Grid Item Component Props * * Props for GridItem wrapper with column/row spanning capabilities. * * @example * ```tsx * <Grid cols={12}> * <GridItem colSpan={8}>Main content</GridItem> * <GridItem colSpan={4}>Sidebar</GridItem> * </Grid> * ``` */ export interface GridItemProps extends React.HTMLAttributes<HTMLDivElement> { /** Number of columns this item should span */ colSpan?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12; /** Number of rows this item should span */ rowSpan?: 1 | 2 | 3 | 4 | 5 | 6; /** Responsive column span configuration */ responsive?: ResponsiveGridItemConfig; } // ============================================================================ // Flex Types // ============================================================================ /** * Flex Component Props * * Props for the Flexbox layout component with direction, alignment, and gap controls. * * @example * ```tsx * <Flex direction="row" align="center" justify="between" gap={4}> * <Logo /> * <Navigation /> * </Flex> * ``` */ export interface FlexProps extends HTMLAttributes<HTMLDivElement> { /** Flex direction (main axis) */ direction?: 'row' | 'column' | 'row-reverse' | 'column-reverse'; /** Align items along cross axis */ align?: 'start' | 'center' | 'end' | 'stretch' | 'baseline'; /** Justify content along main axis */ justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'; /** Gap between flex items (Tailwind spacing scale: 0-96) */ gap?: number; /** Enable flex wrapping */ wrap?: boolean | 'reverse'; /** Custom element type to render as */ as?: 'div' | 'section' | 'article' | 'aside' | 'nav' | 'header' | 'footer' | 'button' | 'span' | 'a' | 'label' | 'ul' | 'li' | 'p'; } /** * HStack Component Props * * Props for horizontal stack layout (shorthand for Flex with direction="row"). * * @example * ```tsx * <HStack align="center" gap={4}> * <Icon /> * <Text>Label</Text> * </HStack> * ``` */ export type HStackProps = Omit<FlexProps, 'direction'>; /** * VStack Component Props * * Props for vertical stack layout (shorthand for Flex with direction="column"). * * @example * ```tsx * <VStack gap={2}> * <Heading>Title</Heading> * <Text>Description</Text> * </VStack> * ``` */ export type VStackProps = Omit<FlexProps, 'direction'>; /** * Center Component Props * * Props for centered content layout (shorthand for Flex with align="center" justify="center"). * * @example * ```tsx * <Center> * <Spinner /> * </Center> * ``` */ export type CenterProps = Omit<FlexProps, 'align' | 'justify'>; // ============================================================================ // Section Types // ============================================================================ /** * Section Component Props * * Props for page section wrapper with consistent vertical spacing and background variants. * * @example * ```tsx * <Section variant="gray" padding="lg"> * <h2>Section Title</h2> * <Content /> * </Section> * ``` */ export interface SectionProps extends HTMLAttributes<HTMLElement> { /** Vertical padding size */ padding?: 'none' | 'sm' | 'md' | 'lg' | 'xl'; /** Background color variant */ variant?: 'default' | 'gray' | 'dark' | 'blue'; /** Disable automatic container wrapper (render full width) */ fullWidth?: boolean; /** Custom element type to render as */ as?: 'section' | 'div' | 'article' | 'aside' | 'main'; } /** * Page Header Component Props * * Props for consistent page header section with title and optional description. * * @example * ```tsx * <PageHeader * title="Products" * description="Browse our collection" * center * /> * ``` */ export interface PageHeaderProps extends HTMLAttributes<HTMLElement> { /** Main header title */ title: string; /** Optional header description/subtitle */ description?: string; /** Center align text content */ center?: boolean; } // ============================================================================ // Common Layout Types // ============================================================================ /** * Spacing Size * * Standard spacing scale used across layout components. */ export type SpacingSize = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'; /** * Alignment Option * * Common alignment values for flex and grid layouts. */ export type Alignment = 'start' | 'center' | 'end' | 'stretch' | 'baseline'; /** * Justify Option * * Common justify values for flex and grid layouts. */ export type Justify = 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'; /** * Responsive Breakpoint * * Standard breakpoint names used in responsive configurations. */ export type Breakpoint = 'sm' | 'md' | 'lg' | 'xl' | '2xl'; /** * Layout Direction * * Direction options for flex and stack layouts. */ export type Direction = 'horizontal' | 'vertical'; |