UNPKG

@aurodesignsystem/auro-header

Version:
191 lines (155 loc) 6.8 kB
import type { AuroHeader } from "src/auro-header.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 AuroHeaderProps = { /** Determines the semantic heading level of the HTML element. Options are `1` - `6`. */ "level"?: AuroHeader['level']; /** Determines the font of heading, Options are `heading` or `display`. */ "typography"?: AuroHeader['typography']; /** Determines the visual appearance of the header. Options are `1` - `6`. */ "visualLevel"?: AuroHeader['visualLevel']; /** @deprecated true - (Deprecated) Allows user to pass in CSS custom property or direct hex value to change the color of the header. */ "color"?: AuroHeader['color']; /** @deprecated true - (Deprecated) Determines the visual appearance of the header. Options are `display`, `800`, `700`, `600`, `500`, `400`, `300`. */ "display"?: AuroHeader['display']; /** @deprecated true - (Deprecated) Specify the margin(s) to be altered. Options are `top`, `bottom`, or `both`. */ "margin"?: AuroHeader['margin']; /** @deprecated true - (Deprecated) Specify size of margin adjustment, either `none`, `25`, `50`, `100`, `150`, `200`, `300`, `400`, `600` or `800`. */ "size"?: AuroHeader['size']; } export type CustomElements = { /** * The `auro-header` element is a custom element to make using headers with the Auro Design System seamless and easy. * * ## Attributes & Properties * * Component attributes and properties that can be applied to the element or by using JavaScript. * * - `level`: Determines the semantic heading level of the HTML element. Options are `1` - `6`. * - `typography`: Determines the font of heading, Options are `heading` or `display`. * - `visualLevel`: Determines the visual appearance of the header. Options are `1` - `6`. * - `color`: (Deprecated) Allows user to pass in CSS custom property or direct hex value to change the color of the header. * - `display`: (Deprecated) Determines the visual appearance of the header. Options are `display`, `800`, `700`, `600`, `500`, `400`, `300`. * - `margin`: (Deprecated) Specify the margin(s) to be altered. Options are `top`, `bottom`, or `both`. * - `size`: (Deprecated) Specify size of margin adjustment, either `none`, `25`, `50`, `100`, `150`, `200`, `300`, `400`, `600` or `800`. * * ## Methods * * Methods that can be called to access component functionality. * * - `_initializeDefaults() => void`: undefined * - `register(name?: string = "auro-header") => void`: This will register this element with the browser. */ "auro-header": Partial<AuroHeaderProps & BaseProps<AuroHeader> & 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 { AuroHeader } from "./index.js";