@aurodesignsystem/auro-background
Version:
auro-background HTML custom element
223 lines (187 loc) • 7.89 kB
TypeScript
import type { AuroBackground } from "src/auro-background.js";
/**
* This type can be used to create scoped tags for your components.
*
* Usage:
*
* ```ts
* import type { ScopedElements } from "path/to/library/jsx-integration";
*
* declare module "my-library" {
* namespace JSX {
* interface IntrinsicElements
* extends ScopedElements<'test-', ''> {}
* }
* }
* ```
*
* @deprecated Runtime scoped elements result in duplicate types and can confusing for developers. It is recommended to use the `prefix` and `suffix` options to generate new types instead.
*/
export type ScopedElements<
Prefix extends string = "",
Suffix extends string = ""
> = {
[Key in keyof CustomElements as `${Prefix}${Key}${Suffix}`]: CustomElements[Key];
};
type BaseProps<T extends HTMLElement> = {
/** Content added between the opening and closing tags of the element */
children?: any;
/** Used for declaratively styling one or more elements using CSS (Cascading Stylesheets) */
class?: string;
/** Used for declaratively styling one or more elements using CSS (Cascading Stylesheets) */
className?: string;
/** Takes an object where the key is the class name(s) and the value is a boolean expression. When true, the class is applied, and when false, it is removed. */
classList?: Record<string, boolean | undefined>;
/** Specifies the text direction of the element. */
dir?: "ltr" | "rtl";
/** Contains a space-separated list of the part names of the element that should be exposed on the host element. */
exportparts?: string;
/** For <label> and <output>, lets you associate the label with some control. */
htmlFor?: string;
/** Specifies whether the element should be hidden. */
hidden?: boolean | string;
/** A unique identifier for the element. */
id?: string;
/** Keys tell React which array item each component corresponds to */
key?: string | number;
/** Specifies the language of the element. */
lang?: string;
/** Contains a space-separated list of the part names of the element. Part names allows CSS to select and style specific elements in a shadow tree via the ::part pseudo-element. */
part?: string;
/** Use the ref attribute with a variable to assign a DOM element to the variable once the element is rendered. */
ref?: T | ((e: T) => void);
/** Adds a reference for a custom element slot */
slot?: string;
/** Prop for setting inline styles */
style?: Record<string, string | number>;
/** Overrides the default Tab button behavior. Avoid using values other than -1 and 0. */
tabIndex?: number;
/** Specifies the tooltip text for the element. */
title?: string;
/** Passing 'no' excludes the element content from being translated. */
translate?: "yes" | "no";
/** The popover global attribute is used to designate an element as a popover element. */
popover?: "auto" | "hint" | "manual";
/** Turns an element element into a popover control button; takes the ID of the popover element to control as its value. */
popovertarget?: "top" | "bottom" | "left" | "right" | "auto";
/** Specifies the action to be performed on a popover element being controlled by a control element. */
popovertargetaction?: "show" | "hide" | "toggle";
} ;
type BaseEvents = {
};
export type AuroBackgroundProps = {
/** Sets the background image at all breakpoints */
"bg"?: AuroBackground['bg'];
/** Sets the background image at `ds-grid-breakpoint-lg` and above */
"bgLg"?: AuroBackground['bgLg'];
/** Sets the background image at `ds-grid-breakpoint-md` and above */
"bgMd"?: AuroBackground['bgMd'];
/** Sets the background image at `ds-grid-breakpoint-sm` and above */
"bgSm"?: AuroBackground['bgSm'];
/** Applies custom height at all breakpoints */
"height"?: AuroBackground['height'];
/** Applies custom height at `ds-grid-breakpoint-lg` and above */
"heightLg"?: AuroBackground['heightLg'];
/** Applies custom height at `ds-grid-breakpoint-md` and above */
"heightMd"?: AuroBackground['heightMd'];
/** Applies custom height at `ds-grid-breakpoint-sm` and above */
"heightSm"?: AuroBackground['heightSm'];
/** Applies internal padding at all breakpoints */
"inset"?: AuroBackground['inset'];
/** Applies internal padding at `ds-grid-breakpoint-lg` and above */
"insetLg"?: AuroBackground['insetLg'];
/** Applies internal padding at `ds-grid-breakpoint-md` and above */
"insetMd"?: AuroBackground['insetMd'];
/** Applies internal padding at `ds-grid-breakpoint-sm` and above */
"insetSm"?: AuroBackground['insetSm'];
/** Applies custom width at all breakpoints */
"width"?: AuroBackground['width'];
/** Applies custom width at `ds-grid-breakpoint-lg` and above */
"widthLg"?: AuroBackground['widthLg'];
/** Applies custom width at `ds-grid-breakpoint-md` and above */
"widthMd"?: AuroBackground['widthMd'];
/** Applies custom width at `ds-grid-breakpoint-sm` and above */
"widthSm"?: AuroBackground['widthSm'];
}
export type CustomElements = {
/**
* The `auro-background` element provides users a way to add a background image or color block including a gradient.
*
* ## Attributes & Properties
*
* Component attributes and properties that can be applied to the element or by using JavaScript.
*
* - `bg`: Sets the background image at all breakpoints
* - `bgLg`: Sets the background image at `ds-grid-breakpoint-lg` and above
* - `bgMd`: Sets the background image at `ds-grid-breakpoint-md` and above
* - `bgSm`: Sets the background image at `ds-grid-breakpoint-sm` and above
* - `height`: Applies custom height at all breakpoints
* - `heightLg`: Applies custom height at `ds-grid-breakpoint-lg` and above
* - `heightMd`: Applies custom height at `ds-grid-breakpoint-md` and above
* - `heightSm`: Applies custom height at `ds-grid-breakpoint-sm` and above
* - `inset`: Applies internal padding at all breakpoints
* - `insetLg`: Applies internal padding at `ds-grid-breakpoint-lg` and above
* - `insetMd`: Applies internal padding at `ds-grid-breakpoint-md` and above
* - `insetSm`: Applies internal padding at `ds-grid-breakpoint-sm` and above
* - `width`: Applies custom width at all breakpoints
* - `widthLg`: Applies custom width at `ds-grid-breakpoint-lg` and above
* - `widthMd`: Applies custom width at `ds-grid-breakpoint-md` and above
* - `widthSm`: Applies custom width at `ds-grid-breakpoint-sm` and above
*
* ## Slots
*
* Areas where markup can be added to the component.
*
* - `(default)`: Default slot for content within the background container.
*
* ## Methods
*
* Methods that can be called to access component functionality.
*
* - `register(name?: string = "auro-background") => void`: This will register this element with the browser.
*/
"auro-background": Partial<AuroBackgroundProps & BaseProps<AuroBackground> & BaseEvents>;
}
export type CustomCssProperties = {
}
declare module 'react' {
namespace JSX {
interface IntrinsicElements extends CustomElements {}
}
}
declare module 'preact' {
namespace JSX {
interface IntrinsicElements extends CustomElements {}
}
}
declare module '@builder.io/qwik' {
namespace JSX {
interface IntrinsicElements extends CustomElements {}
}
}
declare module '@stencil/core' {
namespace JSX {
interface IntrinsicElements extends CustomElements {}
}
}
declare module 'hono/jsx' {
namespace JSX {
interface IntrinsicElements extends CustomElements {}
}
}
declare module 'react-native' {
namespace JSX {
interface IntrinsicElements extends CustomElements {}
}
}
declare global {
namespace JSX {
interface IntrinsicElements extends CustomElements {}
}
}
declare global {
namespace svelteHTML {
interface IntrinsicElements extends CustomElements {}
}
}
export { AuroBackground } from "./index.js";