{"version":3,"file":"Center.cjs","names":[],"sources":["../../../src/components/Center/Center.tsx"],"sourcesContent":["import type { CSSProperties, HTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"@/utils/cn\";\nimport styles from \"./Center.module.css\";\n\nexport type CenterAxis = \"both\" | \"horizontal\" | \"vertical\";\n\nexport interface CenterProps extends HTMLAttributes<HTMLDivElement> {\n    /** Which axis to center on. Default `\"both\"`. */\n    axis?: CenterAxis;\n    /** Fixed height for the container. Numbers map to `${n}px`; strings pass through. Useful when centering inside an unsized parent. */\n    minHeight?: number | string;\n    /** When `true` (default), takes up `100%` width of the parent. */\n    fullWidth?: boolean;\n    children?: ReactNode;\n}\n\n/**\n * Center children horizontally, vertically, or both. Flex-based; works with\n * any child size. Pair with `minHeight` (or set parent height) when\n * centering vertically.\n *\n * @example\n * <Center axis=\"both\" minHeight=\"100vh\">\n *     <Spinner />\n * </Center>\n */\nexport function Center({\n    axis = \"both\",\n    minHeight,\n    fullWidth = true,\n    className,\n    style,\n    children,\n    ...props\n}: CenterProps) {\n    const finalStyle: CSSProperties = {\n        ...(minHeight !== undefined\n            ? { minHeight: typeof minHeight === \"number\" ? `${minHeight}px` : minHeight }\n            : null),\n        ...(fullWidth ? { width: \"100%\" } : null),\n        ...style,\n    };\n    return (\n        <div className={cn(styles.center, styles[axis], className)} style={finalStyle} {...props}>\n            {children}\n        </div>\n    );\n}\n"],"mappings":"0GA0BA,SAAgB,EAAO,CACnB,OAAO,OACP,YACA,YAAY,GACZ,YACA,QACA,WACA,GAAG,GACS,CACZ,IAAM,EAA4B,CAC9B,GAAI,IAAc,IAAA,GAEZ,KADA,CAAE,UAAW,OAAO,GAAc,SAAW,GAAG,EAAU,IAAM,CAAU,EAEhF,GAAI,EAAY,CAAE,MAAO,MAAO,EAAI,KACpC,GAAG,CACP,EACA,OACI,EAAA,EAAA,IAAA,CAAC,MAAD,CAAK,UAAW,EAAA,GAAG,EAAA,QAAO,OAAQ,EAAA,QAAO,GAAO,CAAS,EAAG,MAAO,EAAY,GAAI,EAC9E,UACA,CAAA,CAEb"}