import { SvelteComponentTyped, type ComponentConstructorOptions } from "svelte"; import type { SvelteHTMLElements } from "svelte/elements"; export type SpacingScale = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13; export type SpacingValue = 0 | SpacingScale | string; export type OffsetValue = 0 | SpacingScale | string; type $RestProps = NoInfer; type $Elements = { [$Tag in keyof HTMLElementTagNameMap]: Omit<$RestProps<$Tag>, keyof $Props<$Tag>> }; type $Props = { /** * Set the background fill using a Carbon theme token. */ fill?: "background" | "layer-01" | "layer-02" | "layer-03" | "layer-accent" | "field" | "inverse" | "brand" | undefined; /** * Set padding on all sides. Numbers `1`–`13` use the shared layout scale, `0` clears it; strings accept any CSS length. */ padding?: SpacingValue | undefined; /** * Set horizontal padding. Numbers `1`–`13` use the shared layout scale, `0` clears it; strings accept any CSS length. */ paddingX?: SpacingValue | undefined; /** * Set vertical padding. Numbers `1`–`13` use the shared layout scale, `0` clears it; strings accept any CSS length. */ paddingY?: SpacingValue | undefined; /** * Set the top padding, overriding `padding` and `paddingY` on that side. Numbers `1`–`13` use the shared layout scale, `0` clears it; strings accept any CSS length. */ paddingTop?: SpacingValue | undefined; /** * Set the right padding, overriding `padding` and `paddingX` on that side. Numbers `1`–`13` use the shared layout scale, `0` clears it; strings accept any CSS length. */ paddingRight?: SpacingValue | undefined; /** * Set the bottom padding, overriding `padding` and `paddingY` on that side. Numbers `1`–`13` use the shared layout scale, `0` clears it; strings accept any CSS length. */ paddingBottom?: SpacingValue | undefined; /** * Set the left padding, overriding `padding` and `paddingX` on that side. Numbers `1`–`13` use the shared layout scale, `0` clears it; strings accept any CSS length. */ paddingLeft?: SpacingValue | undefined; /** * Set the inline-start padding, overriding `padding` and `paddingX` on that side. Logical: it is the left padding in a left-to-right page and the right padding in a right-to-left one. Numbers `1`–`13` use the shared layout scale, `0` clears it; strings accept any CSS length. */ paddingStart?: SpacingValue | undefined; /** * Set the inline-end padding, overriding `padding` and `paddingX` on that side. Logical: it is the right padding in a left-to-right page and the left padding in a right-to-left one. Numbers `1`–`13` use the shared layout scale, `0` clears it; strings accept any CSS length. */ paddingEnd?: SpacingValue | undefined; /** * Set margin on all sides. Numbers `1`–`13` use the shared layout scale, `0` clears it; strings accept any CSS length. */ margin?: SpacingValue | undefined; /** * Set horizontal margin. Numbers `1`–`13` use the shared layout scale, `0` clears it; strings accept any CSS length. */ marginX?: SpacingValue | undefined; /** * Set vertical margin. Numbers `1`–`13` use the shared layout scale, `0` clears it; strings accept any CSS length. */ marginY?: SpacingValue | undefined; /** * Set the top margin, overriding `margin` and `marginY` on that side. Numbers `1`–`13` use the shared layout scale, `0` clears it; strings accept any CSS length. */ marginTop?: SpacingValue | undefined; /** * Set the right margin, overriding `margin` and `marginX` on that side. Numbers `1`–`13` use the shared layout scale, `0` clears it; strings accept any CSS length. */ marginRight?: SpacingValue | undefined; /** * Set the bottom margin, overriding `margin` and `marginY` on that side. Numbers `1`–`13` use the shared layout scale, `0` clears it; strings accept any CSS length. */ marginBottom?: SpacingValue | undefined; /** * Set the left margin, overriding `margin` and `marginX` on that side. Numbers `1`–`13` use the shared layout scale, `0` clears it; strings accept any CSS length. */ marginLeft?: SpacingValue | undefined; /** * Set the inline-start margin, overriding `margin` and `marginX` on that side. Logical: it is the left margin in a left-to-right page and the right margin in a right-to-left one. Numbers `1`–`13` use the shared layout scale, `0` clears it; strings accept any CSS length. */ marginStart?: SpacingValue | undefined; /** * Set the inline-end margin, overriding `margin` and `marginX` on that side. Logical: it is the right margin in a left-to-right page and the left margin in a right-to-left one. Numbers `1`–`13` use the shared layout scale, `0` clears it; strings accept any CSS length. */ marginEnd?: SpacingValue | undefined; /** * Set the border using a Carbon border token. */ border?: "subtle" | "strong" | "interactive" | "disabled" | undefined; /** * Set the border style. Only takes effect when `border` is set. * @default "solid" */ borderStyle?: "solid" | "dashed"; /** * Set the border width. Only takes effect when `border` is set. Numbers are treated as pixels; strings accept any CSS length. */ borderWidth?: number | string | undefined; /** * Set which side the border applies to. Only takes effect when `border` is set. * @default "all" */ borderSide?: "all" | "top" | "right" | "bottom" | "left"; /** * Set to `true` to apply a Carbon raised box shadow. * @default false */ shadow?: boolean; /** * Set the width. Numbers are treated as pixels; strings accept any CSS length. */ width?: number | string | undefined; /** * Set the max width. Numbers are treated as pixels; strings accept any CSS length. */ maxWidth?: number | string | undefined; /** * Set the min width. Numbers are treated as pixels; strings accept any CSS length. */ minWidth?: number | string | undefined; /** * Set to `true` to span the full width of the container * @default false */ fullWidth?: boolean; /** * Set the height. Numbers `1`–`13` use the shared layout scale, `0` clears it; strings accept any CSS length; `"viewport"` sets the full viewport height (`100dvh`, with a `100vh` fallback). */ height?: SpacingValue | "viewport" | undefined; /** * Set the min height. Numbers `1`–`13` use the shared layout scale, `0` clears it; strings accept any CSS length; `"viewport"` sets the full viewport height (`100dvh`, with a `100vh` fallback). */ minHeight?: SpacingValue | "viewport" | undefined; /** * Set the max height. Numbers `1`–`13` use the shared layout scale, `0` clears it; strings accept any CSS length. */ maxHeight?: SpacingValue | undefined; /** * Set the CSS position. `"absolute"` places the box against its nearest positioned ancestor, such as a Box with `position="relative"`. `"sticky"` is relative to the nearest scroll container, not the viewport. */ position?: "relative" | "absolute" | "sticky" | undefined; /** * Set the CSS display. `"none"` hides the box and keeps its content mounted. */ display?: "block" | "inline-block" | "flex" | "inline-flex" | "grid" | "none" | undefined; /** * Set the flex direction of children. Only takes effect when `display` is * `"flex"` or `"inline-flex"`. */ direction?: "row" | "column" | undefined; /** * Set the gap between children. Numbers `1`–`13` use the shared layout scale, `0` clears it; strings accept any CSS length. Only takes effect when `display` is `"flex"`, `"inline-flex"`, or `"grid"`. */ gap?: SpacingValue | undefined; /** * Set the grid columns. Numbers create that many equal-width columns; strings set `grid-template-columns` directly. Only takes effect when `display` is `"grid"`. */ columns?: number | string | undefined; /** * Set the cross-axis alignment of children. Only takes effect when * `display` is `"flex"`, `"inline-flex"`, or `"grid"`. */ align?: "start" | "center" | "end" | "stretch" | "baseline" | undefined; /** * Set the main-axis alignment of children. Only takes effect when * `display` is `"flex"`, `"inline-flex"`, or `"grid"`. */ justify?: "start" | "center" | "end" | "space-between" | "space-around" | "space-evenly" | undefined; /** * Set how flex children wrap onto multiple lines. Only takes effect when * `display` is `"flex"` or `"inline-flex"`. */ wrap?: "nowrap" | "wrap" | "wrap-reverse" | undefined; /** * Set this box's own cross-axis alignment inside a flex or grid parent, * overriding the parent's `align`. */ alignSelf?: "start" | "center" | "end" | "stretch" | "baseline" | undefined; /** * Set to `true` to let this box grow to fill free space inside a flex parent. * @default false */ grow?: boolean; /** * Set the CSS overflow behavior. */ overflow?: "visible" | "hidden" | "auto" | "scroll" | undefined; /** * Set the CSS horizontal overflow behavior. Overrides `overflow` on that axis. */ overflowX?: "visible" | "hidden" | "auto" | "scroll" | undefined; /** * Set the CSS vertical overflow behavior. Overrides `overflow` on that axis. */ overflowY?: "visible" | "hidden" | "auto" | "scroll" | undefined; /** * Set the offset from the top when `position` is set. Numbers `0`–`13` use the shared layout scale; strings accept any CSS length. */ top?: OffsetValue | undefined; /** * Set the offset from the bottom when `position` is set. Numbers `0`–`13` use the shared layout scale; strings accept any CSS length. */ bottom?: OffsetValue | undefined; /** * Set the offset from the left when `position` is set. Numbers `0`–`13` use the shared layout scale; strings accept any CSS length. */ left?: OffsetValue | undefined; /** * Set the offset from the right when `position` is set. Numbers `0`–`13` use the shared layout scale; strings accept any CSS length. */ right?: OffsetValue | undefined; /** * Hide the box below this breakpoint. It stays visible at the breakpoint and above. */ hideBelow?: "sm" | "md" | "lg" | "xlg" | "max" | undefined; /** * Hide the box above this breakpoint. It stays visible at the breakpoint and below. */ hideAbove?: "sm" | "md" | "lg" | "xlg" | "max" | undefined; /** * Specify the tag name. * @default "div" */ tag?: Tag; /** * Obtain a reference to the HTML element. * @default null */ ref?: null | HTMLElementTagNameMap[Tag]; children?: (this: void) => void; [key: `data-${string}`]: unknown; }; export type BoxProps = $Elements[Tag] & $Props; export default class Box extends SvelteComponentTyped< BoxProps, { click: WindowEventMap["click"]; focusin: WindowEventMap["focusin"]; focusout: WindowEventMap["focusout"]; keydown: WindowEventMap["keydown"]; keyup: WindowEventMap["keyup"]; mouseenter: WindowEventMap["mouseenter"]; mouseleave: WindowEventMap["mouseleave"]; mouseover: WindowEventMap["mouseover"]; scroll: WindowEventMap["scroll"]; }, { default: Record } > { constructor(options: ComponentConstructorOptions>); }