import type { ComponentProps } from "../../types/component-props"; import type { SpacingScale, BoxElement } from "../../types/layout-primitives"; import type React from "react"; /** * Props for the Box component - a fundamental container primitive for spacing and sizing control. * * The Box component provides a flexible, semantic container with comprehensive spacing, sizing, * and visual customization options. All spacing values use the unified spacing scale with * fluid responsive values via CSS clamp(). * * ## Design Principles * - **Logical Properties**: Uses `padding-inline`/`padding-block` for better i18n support * - **Fluid Spacing**: All spacing scales responsively without media queries * - **Semantic HTML**: Defaults to `div` but supports semantic elements via `as` prop * - **CSS Custom Properties**: All values customizable via CSS variables * * @example * // Basic container with padding * *

Content

*
* * @example * // Centered container with max width * *
Centered content
*
* * @example * // Card-like box with radius * *

Card Title

*

Card content

*
*/ export interface BoxProps extends Partial, Omit, "className"> { /** * Padding on all sides. * Uses unified spacing scale: '0' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' * Maps to CSS custom properties (--spacing-*) * @example * Content */ padding?: SpacingScale; /** * Padding on inline axis (left/right in LTR, right/left in RTL). * Uses logical property `padding-inline` for better internationalization. * @example * Wide horizontal padding */ paddingInline?: SpacingScale; /** * Padding on block axis (top/bottom). * Uses logical property `padding-block` for consistency. * @example * Vertical padding */ paddingBlock?: SpacingScale; /** * Margin on all sides. * Uses unified spacing scale: '0' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' * @example * Content with margin */ margin?: SpacingScale; /** * Margin on inline axis (left/right in LTR). * For centering, use inline styles: `style={{ marginInline: 'auto' }}` * @example * Horizontal margin */ marginInline?: SpacingScale; /** * Margin on block axis (top/bottom). * @example * Vertical margin */ marginBlock?: SpacingScale; /** * Width behavior control. * - 'auto': Natural width (default) * - 'full': 100% width * - 'fit': Width fits content (fit-content) * - 'max': Width determined by widest content (max-content) * @default 'auto' * @example * Full width box */ width?: "auto" | "full" | "fit" | "max"; /** * Maximum width constraint. * Useful for readable text widths and responsive containers. * Sizes map to: xs(480px), sm(640px), md(768px), lg(1024px), xl(1280px), container(1200px) * @example * * Centered container with max width * */ maxWidth?: "xs" | "sm" | "md" | "lg" | "xl" | "container"; /** * Border radius for rounded corners. * - 'xs' through 'xl': Increasing radii (2px - 12px) * - 'full': Fully rounded (9999px) for pills/circles * @example * Slightly rounded box * @example * * * */ radius?: SpacingScale | "full"; /** * Polymorphic element type to render. * Defaults to 'div' but supports semantic HTML elements. * Choose semantic elements for better accessibility: * - 'section' for thematic groupings * - 'article' for self-contained content * - 'aside' for tangentially related content * - 'main' for primary page content * - 'header'/'footer' for page/section headers/footers * - 'nav' for navigation landmarks * @default 'div' * @example * *

Section Content

*
*/ as?: BoxElement; /** * Additional CSS classes to apply. * Merged with generated utility classes. * @example * Content */ className?: string; /** * Children elements to render inside the Box. */ children?: React.ReactNode; }