import type { ComponentProps } from "../../types"; import type { SpacingScale, GridElement, GridItemElement } from "../../types/layout-primitives"; /** * Number of columns in the grid (1-12) */ export type GridColumns = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12; /** * Grid auto-fit/auto-fill behavior */ export type GridAuto = "fit" | "fill"; /** * Props for the Grid component * * Grid provides a CSS Grid-based layout primitive for responsive multi-column layouts. * Supports explicit column counts, auto-fit/auto-fill, gap spacing, and alignment control. * * @example * ```tsx * // 3-column grid * * Card 1 * Card 2 * Card 3 * * ``` * * @example * ```tsx * // Auto-fit grid with minimum column width * * Card 1 * Card 2 * * ``` * * @example * ```tsx * // Grid with custom column spans * * Main content * Sidebar * * ``` */ export interface GridProps extends Partial, Omit, "className"> { /** * Number of columns in the grid (1-12) * * Creates an explicit column layout with equal-width columns. * Mutually exclusive with `auto` prop. * * @default 1 * * @example * ```tsx * *
Column 1
*
Column 2
*
Column 3
*
* ``` */ columns?: GridColumns; /** * Auto-fit or auto-fill behavior * * - `fit`: Columns expand to fill available space (grid-template-columns: repeat(auto-fit, ...)) * - `fill`: Creates as many columns as fit, even if empty (repeat(auto-fill, ...)) * * Requires `minColumnWidth` to be set. Mutually exclusive with `columns` prop. * * @example * ```tsx * *
Item 1
*
Item 2
*
Item 3
*
* ``` */ auto?: GridAuto; /** * Minimum column width for auto-fit/auto-fill grids * * Must be specified in rem units (e.g., "15rem", "20rem"). * Used with `auto` prop to create responsive grids without media queries. * * @example * ```tsx * *
Card
*
* ``` */ minColumnWidth?: string; /** * Gap spacing between grid items * * Uses the unified spacing scale from globals. * * @default undefined (uses default `.grid` gap) * * @example * ```tsx * *
Item 1
*
Item 2
*
* ``` */ gap?: SpacingScale; /** * Horizontal gap spacing (column gap) * * Overrides `gap` for horizontal spacing only. * Uses the unified spacing scale. * * @example * ```tsx * *
Item 1
*
Item 2
*
* ``` */ gapX?: SpacingScale; /** * Vertical gap spacing (row gap) * * Overrides `gap` for vertical spacing only. * Uses the unified spacing scale. * * @example * ```tsx * *
Item 1
*
Item 2
*
* ``` */ gapY?: SpacingScale; /** * Horizontal alignment of grid items (justify-items) * * Controls horizontal alignment of items within their grid cells. * * @example * ```tsx * *
Centered item
*
* ``` */ justifyItems?: "start" | "center" | "end" | "stretch"; /** * Vertical alignment of grid items (align-items) * * Controls vertical alignment of items within their grid cells. * * @example * ```tsx * *
Vertically centered
*
* ``` */ alignItems?: "start" | "center" | "end" | "stretch"; /** * HTML element to render as * * @default "div" * * @example * ```tsx * *
Post 1
*
Post 2
*
* ``` */ as?: GridElement; /** * Additional CSS class name(s) * * @example * ```tsx * *
Item
*
* ``` */ className?: string; /** * Additional CSS class name(s) (alternative to className) * * @example * ```tsx * *
Item
*
* ``` */ classes?: string; /** * Children elements (typically Grid.Item components) * * @example * ```tsx * * Item 1 * Item 2 (2 columns wide) * * ``` */ children?: React.ReactNode; } /** * Props for the Grid.Item component * * Grid.Item represents a single item within a Grid layout. * Supports column span control for flexible grid layouts. * * @example * ```tsx * * Main content (8/12) * Sidebar (4/12) * * ``` * * @example * ```tsx * * 1 column * 2 columns * 1 column * * ``` */ export interface GridItemProps extends Partial, Omit, "className"> { /** * Number of columns this item should span (1-12) * * Determines the width of the grid item relative to the parent grid's columns. * * @default 1 * * @example * ```tsx * * Half width * Half width * * ``` */ span?: GridColumns; /** * Row span for the grid item * * Determines how many rows this item should span. * * @example * ```tsx * * Tall item * Normal * Normal * * ``` */ rowSpan?: number; /** * HTML element to render as * * @default "div" * * @example * ```tsx * * List item 1 * List item 2 * * ``` */ as?: GridItemElement; /** * Additional CSS class name(s) * * @example * ```tsx * * Featured content * * ``` */ className?: string; /** * Additional CSS class name(s) (alternative to className) * * @example * ```tsx * * Content * * ``` */ classes?: string; /** * Children elements * * @example * ```tsx * *

Title

*

Content

*
* ``` */ children?: React.ReactNode; }