import React from 'react'; import { ColorsActionTokenAlias, ColorsBackdropTokenAlias, ColorsBackgroundTokenAlias, ColorsOverlayTokenAlias, ColorsSurfaceTokenAlias, DepthShadowAlias, ShapeBorderWidthScale, SpacingSpaceScale } from '../tokens'; import { ResponsiveProp } from '../utils/css'; type Element = 'div' | 'span' | 'section' | 'legend' | 'ul' | 'li'; type Overflow = 'hidden' | 'scroll'; type Position = 'relative' | 'absolute' | 'fixed' | 'sticky'; export type ColorTokenScale = 'text' | 'text-critical' | 'text-disabled' | 'text-highlight' | 'text-on-critical' | 'text-on-dark' | 'text-on-interactive' | 'text-on-primary' | 'text-primary' | 'text-primary-hovered' | 'text-primary-pressed' | 'text-subdued' | 'text-subdued-on-dark' | 'text-success' | 'text-warning'; export type BorderTokenAlias = 'base' | 'dark' | 'divider' | 'divider-on-dark' | 'transparent'; type Spacing = ResponsiveProp; export type BorderRadiusTokenScale = '05' | '1' | '2' | '3' | '4' | '5' | '6' | 'full'; export type BackgroundColors = ColorsBackdropTokenAlias | ColorsBackgroundTokenAlias | ColorsOverlayTokenAlias | ColorsActionTokenAlias | ColorsSurfaceTokenAlias; export interface BoxProps extends React.AriaAttributes { children?: React.ReactNode; /** HTML Element type * @default 'div' */ as?: Element; /** Background color */ background?: BackgroundColors; /** Border style */ border?: BorderTokenAlias; /** Vertical end border style */ borderBlockEnd?: BorderTokenAlias; /** Horizontal start border style */ borderInlineStart?: BorderTokenAlias; /** Horizontal end border style */ borderInlineEnd?: BorderTokenAlias; /** Vertical start border style */ borderBlockStart?: BorderTokenAlias; /** Border radius */ borderRadius?: BorderRadiusTokenScale; /** Vertical end horizontal start border radius */ borderRadiusEndStart?: BorderRadiusTokenScale; /** Vertical end horizontal end border radius */ borderRadiusEndEnd?: BorderRadiusTokenScale; /** Vertical start horizontal start border radius */ borderRadiusStartStart?: BorderRadiusTokenScale; /** Vertical start horizontal end border radius */ borderRadiusStartEnd?: BorderRadiusTokenScale; /** Border width */ borderWidth?: ShapeBorderWidthScale; /** Vertical start border width */ borderBlockStartWidth?: ShapeBorderWidthScale; /** Vertical end border width */ borderBlockEndWidth?: ShapeBorderWidthScale; /** Horizontal start border width */ borderInlineStartWidth?: ShapeBorderWidthScale; /** Horizontal end border width */ borderInlineEndWidth?: ShapeBorderWidthScale; /** Color of children */ color?: ColorTokenScale; /** HTML id attribute */ id?: string; /** Minimum height of container */ minHeight?: string; /** Minimum width of container */ minWidth?: string; /** Maximum width of container */ maxWidth?: string; /** Clip horizontal content of children */ overflowX?: Overflow; /** Clip vertical content of children */ overflowY?: Overflow; /** Spacing around children. Accepts a spacing token or an object of spacing tokens for different screen sizes. * @example * padding='4' * padding={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}} */ padding?: Spacing; /** Vertical start spacing around children. Accepts a spacing token or an object of spacing tokens for different screen sizes. * @example * paddingBlockStart='4' * paddingBlockStart={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}} */ paddingBlockStart?: Spacing; /** Vertical end spacing around children. Accepts a spacing token or an object of spacing tokens for different screen sizes. * @example * paddingBlockEnd='4' * paddingBlockEnd={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}} */ paddingBlockEnd?: Spacing; /** Horizontal start spacing around children. Accepts a spacing token or an object of spacing tokens for different screen sizes. * @example * paddingInlineStart='4' * paddingInlineStart={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}} */ paddingInlineStart?: Spacing; /** Horizontal end spacing around children. Accepts a spacing token or an object of spacing tokens for different screen sizes. * @example * paddingInlineEnd='4' * paddingInlineEnd={{xs: '2', sm: '3', md: '4', lg: '5', xl: '6'}} */ paddingInlineEnd?: Spacing; /** Aria role */ role?: Extract; /** Shadow on box */ shadow?: DepthShadowAlias; /** Set tab order */ tabIndex?: Extract['tabIndex'], number>; /** Width of container */ width?: string; /** Position of box */ position?: Position; /** Top position of box */ insetBlockStart?: Spacing; /** Bottom position of box */ insetBlockEnd?: Spacing; /** Left position of box */ insetInlineStart?: Spacing; /** Right position of box */ insetInlineEnd?: Spacing; /** Opacity of box */ opacity?: string; /** Outline style */ outline?: BorderTokenAlias; /** Visually hide the contents during print */ printHidden?: boolean; /** Visually hide the contents (still announced by screenreader) */ visuallyHidden?: boolean; /** z-index of box */ zIndex?: string; /** Is it a flexbox */ flex?: boolean; } type GlobalProps = 'inherit' | 'initial' | 'revert' | 'revert-layer' | 'unset'; type OverflowProps = 'safe center' | 'unsafe center'; type BaselineProps = 'baseline' | 'first baseline' | 'last baseline'; type CommonFlex = 'start' | 'flex-start' | 'end' | 'flex-end' | 'center'; type Distributed = 'space-between' | 'space-around' | 'space-evenly' | 'stretch'; export interface BoxAlignmentStyleProps { display?: 'block' | 'inline' | 'inline-block' | 'flex' | 'inline-flex' | 'grid' | 'inline-grid' | 'flow-root' | GlobalProps; /** * The distribution of space around items along the main axis. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content). * @default 'stretch' */ justifyContent?: 'normal' | 'left' | 'right' | Distributed | CommonFlex | OverflowProps | GlobalProps; /** * The distribution of space around child items along the cross axis. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/align-content). * @default 'start' */ alignContent?: 'normal' | Distributed | CommonFlex | BaselineProps | OverflowProps | GlobalProps; /** * The alignment of children within their container. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/align-items). * @default 'stretch' */ alignItems?: 'normal' | 'stretch' | 'self-start' | 'self-end' | CommonFlex | GlobalProps | BaselineProps; /** The space to display between both rows and columns. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/gap). */ gap?: Spacing; /** The space to display between columns. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/column-gap). */ columnGap?: Spacing; /** The space to display between rows. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/row-gap). */ rowGap?: Spacing; } export interface FlexStyleProps extends BoxAlignmentStyleProps { /** * The direction in which to layout children. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-direction). * @default 'row' */ direction?: 'row' | 'column' | 'row-reverse' | 'column-reverse'; /** * Whether to wrap items onto multiple lines. See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/flex-wrap). * @default false */ wrap?: boolean | 'wrap' | 'nowrap' | 'wrap-reverse'; } export {};