import type { CSSProperties } from "react"; import type { ThemeKeys } from "./theme"; /** * Implementation note: * SX should be treated as a safe, black box bag of styles. * Never add properties to SX if they *could* be colliding with the implementation details of the component. * e.g, display, padding, color, font-size, etc should never be set without the component knowing about it. * It breaks encapsulation and we now have to double check the component implementation to be sure it's safe to override some styles, on every call-site, which is not scalable. * If you think you need a low level style like mentionned above, make it part of the explicit prop contract of the component, add a variant or set the prop you need on the component's parent instead. */ /** * Layout properties that are safe to set on component without disturbing its own implementation details. * Favor using this over using Box when applicable. */ export interface SX { flexGrow?: 0 | 1; flexShrink?: 0; flexBasis?: 0; flexWrap?: "wrap"; order?: 0 | 1 | 2 | 3; alignSelf?: "center" | "stretch" | "start" | "end"; justifySelf?: "center" | "stretch" | "start" | "end"; visibility?: "hidden" | "visible"; position?: "absolute" | "fixed" | "relative" | "sticky"; marginLeft?: ThemeKeys<"space">; marginRight?: ThemeKeys<"space">; marginTop?: ThemeKeys<"space">; marginBottom?: ThemeKeys<"space">; marginInline?: ThemeKeys<"space">; marginBlock?: ThemeKeys<"space">; top?: ThemeKeys<"space">; left?: ThemeKeys<"space">; right?: ThemeKeys<"space">; bottom?: ThemeKeys<"space">; width?: CSSProperties["width"]; height?: CSSProperties["height"]; overflowY?: CSSProperties["overflowY"]; [key: `--${string}`]: string | number; }