import { type ReactNode } from "react"; import type { StyleProp, ViewStyle } from "react-native"; import { type WidthKey } from "./tokens.js"; /** The FILL nature: fill the parent's bounds in a Column, share a Row. */ export declare const FILL: ViewStyle; /** What a HUG component appends inside a stretching Column (and nowhere else). */ export declare const HUG_IN_STRETCH_COLUMN: ViewStyle; /** The layout facts a kit layout container publishes to its children. */ export interface LayoutAxis { /** The container's main axis: children of a Row are content-sized on it. */ axis: "row" | "column"; /** Column only: children stretch across it (React Native's default `alignItems`). */ stretch: boolean; /** A content-sized cell (a bare Column inside a Row): a FILL child collapses here. */ hugging: boolean; /** * Column only, and only a tile-grid cell sets it: the cell is definite on its * main axis too, because the grid stretches every cell to the height of the * row it wrapped onto. A surface child (a Card) grows to fill that height, so * the tiles of one row share a flush bottom edge (CSS Grid's `align-items: * stretch`, the default every tile grid is expected to have); a field or a * hug component keeps its own height, the cell's slack stays below it. */ bounded?: boolean; /** * A Row with `stacks` that is rendering as a column right now. Its children * are still Row children: their `span`s apply again the moment it unstacks, * so a span here is not misplaced. */ stacked?: boolean; } /** Publish the layout facts of a kit layout container to its subtree. */ export declare function LayoutAxisProvider({ value, children }: { value: LayoutAxis; children?: ReactNode; }): import("react").FunctionComponentElement>; /** The nearest kit layout container's facts, or null outside every kit container. */ export declare function useLayoutAxis(): LayoutAxis | null; /** * The value a Row or Column publishes. `sized` is whether the container itself * has bounds inside a Row parent (a `span`, `fill`, or `grow`): an unsized Row * or Column inside a Row is content-sized, so it is a hugging cell. */ export declare function layoutAxis(axis: "row" | "column", stretch: boolean, parent: LayoutAxis | null, sized: boolean): LayoutAxis; /** The value a Column publishes (see `layoutAxis`). */ export declare function columnAxis(stretch: boolean, parent: LayoutAxis | null, sized: boolean): LayoutAxis; /** The value a definite Row publishes: children are content-sized on the row axis. */ export declare const ROW_AXIS: LayoutAxis; /** The value a definite-width column cell publishes (Container). */ export declare const CELL_AXIS: LayoutAxis; /** * The value a tile-grid cell publishes (Grid, DashboardGrid): a definite-width * column that is also `bounded`, since the grid stretches it to its row's * height. A Card in it grows to that height without being asked. */ export declare const GRID_CELL_AXIS: LayoutAxis; /** The twelve-column grid that Row spans and the DashboardGrid share. */ export declare const GRID_COLUMNS = 12; /** * The px width of a cell spanning `span` of `columns` equal units in a row * `width` wide whose cells sit `gap` apart: a multi-column span also swallows * the gaps it straddles, so two 6-column cells plus the gap between them fill * the row exactly, as do twelve 1-column cells and their eleven gaps. Floored to a * hundredth of a pixel (the fraction a browser's `1fr` track keeps: the hand-off's * two pager cards are 576 wide, its anatomy split 724.06 and 425.92), so rounding can * only leave a sub-pixel sliver rather than overflow the row into an extra wrap, and a * whole-pixel floor no longer moves a cell up to a pixel in from where the track sits. */ export declare function spanWidth(width: number, span: number, gap: number, columns?: number): number; /** A length floored to a hundredth of a pixel, the finest step a track width keeps. */ export declare function floorHundredth(px: number): number; /** A span clamped to a whole number of the twelve columns (1..12). */ export declare function clampSpan(span: number): number; /** * The HUG nature, resolved against the nearest kit layout container: the * `alignSelf:"flex-start"` that stops a stretching Column from widening the * component, and nothing anywhere else. Append it after the component's skin * styles on the outermost node. */ export declare function useHugStyle(): ViewStyle | null; /** * The measure axis: the Container steps on a component. A step caps the * component at that width of the shared scale (fluid below it: inside anything * narrower it fills its parent) and centers it in its column; `start` pins it * to the leading edge instead. Omit every step to take the parent's bounds. * Container's own `ContainerProps` extends this, so the grammar is one. */ export interface MeasureProps { xxxs?: boolean; xxs?: boolean; xs?: boolean; sm?: boolean; md?: boolean; lg?: boolean; xl?: boolean; xxl?: boolean; xxxl?: boolean; wide?: boolean; wider?: boolean; widest?: boolean; page?: boolean; /** Pin a capped component to the leading edge instead of centering it in its column. */ start?: boolean; } /** * The step a component's measure props name, or null when none is passed. * Narrowest first when several are, so a stray wider step never silently widens * a deliberate narrow one: the precedence IS the scale's declaration order in * `widths` (ascending, which `test/sizing.test.tsx` pins), read through the * measure axis (`MEASURE` in axis.ts), so a step added to the scale needs no * second list here. */ export declare function stepOf(p: MeasureProps): WidthKey | null; /** * The style for a measured component: FILL capped at the step, centered in its * column or pinned to the start. The alignment is resolved against the nearest * kit layout container like HUG is: in a Row `alignSelf` is the CROSS axis * (it would pin a field to the top of the row), so only the cap applies there * and the Row's own `justifyContent` places the box. */ export declare function measureStyle(step: WidthKey, start: boolean, axis: LayoutAxis | null): ViewStyle; /** The measure style for a component's props, or null when no step is passed. */ export declare function useMeasureStyle(p: MeasureProps): ViewStyle | null; /** * The sizing style for a HUG component that also offers `block` and the measure * axis: a step caps it (FILL up to the step, so a call-to-action is as wide as * its measure), `block` turns it into FILL (a full-width button in a Column, an * equal share in a Row), and without either the component hugs. A step wins * over `block`: it is the more specific ask. */ export declare function useSizing(p: { block?: boolean; } & MeasureProps): ViewStyle | null; export interface FillOptions { /** * The component's content is a stable label (a Select shows its value), so * collapsing to it inside a bare Column in a Row is the toolbar idiom * (Bootstrap `.col-auto`), not a defect: no warning there. */ hugsInCell?: boolean; } /** * The FILL nature for a component root, capped at the step its measure props * name (pass the component's props; a component without the axis passes * nothing), plus the development warning for the one layout that collapses it: * a bare Column inside a Row. Give that Column a `span` or `fill` so the field * has bounds. */ export declare function useFillStyle(component: string, measure?: MeasureProps, options?: FillOptions): ViewStyle; /** The style keys a layout container owns; a non-layout component never takes them. */ export type SizingKey = "width" | "minWidth" | "maxWidth" | "flex" | "flexBasis" | "flexGrow" | "flexShrink" | "alignSelf"; /** * The `style` a non-layout component accepts: `ViewStyle` without the sizing * keys. Width, min/max width, flex, and `alignSelf` belong to the parent layout * container (a Column `span`, `fill`, a Container step) or to the component's * own measure axis (`MeasureProps`); passing them here is a type error, not a * runtime warning. */ export type LayoutStyle = StyleProp>; //# sourceMappingURL=sizing.d.ts.map