mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
refactor(types): rewrite type definitions to account for intrinsic attributes
This commit is contained in:
parent
8c30452169
commit
3c04f122b0
158 changed files with 6997 additions and 5383 deletions
30
types/Button/Button.Skeleton.d.ts
vendored
Normal file
30
types/Button/Button.Skeleton.d.ts
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
/// <reference types="svelte" />
|
||||
|
||||
export default class ButtonSkeleton {
|
||||
$$prop_def: svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> & {
|
||||
/**
|
||||
* Set the `href` to use an anchor link
|
||||
*/
|
||||
href?: string;
|
||||
|
||||
/**
|
||||
* Specify the size of button skeleton
|
||||
* @default "default"
|
||||
*/
|
||||
size?: "default" | "field" | "small";
|
||||
|
||||
/**
|
||||
* Set to `true` to use the small variant
|
||||
* @default false
|
||||
*/
|
||||
small?: boolean;
|
||||
};
|
||||
|
||||
$$slot_def: {};
|
||||
|
||||
$on(eventname: "click", cb: (event: WindowEventMap["click"]) => void): () => void;
|
||||
$on(eventname: "mouseover", cb: (event: WindowEventMap["mouseover"]) => void): () => void;
|
||||
$on(eventname: "mouseenter", cb: (event: WindowEventMap["mouseenter"]) => void): () => void;
|
||||
$on(eventname: "mouseleave", cb: (event: WindowEventMap["mouseleave"]) => void): () => void;
|
||||
$on(eventname: string, cb: (event: Event) => void): () => void;
|
||||
}
|
96
types/Button/Button.d.ts
vendored
Normal file
96
types/Button/Button.d.ts
vendored
Normal file
|
@ -0,0 +1,96 @@
|
|||
/// <reference types="svelte" />
|
||||
|
||||
export default class Button {
|
||||
$$prop_def: {
|
||||
/**
|
||||
* Specify the kind of button
|
||||
* @default "primary"
|
||||
*/
|
||||
kind?: "primary" | "secondary" | "tertiary" | "ghost" | "danger" | "danger-tertiary" | "danger-ghost";
|
||||
|
||||
/**
|
||||
* Specify the size of button
|
||||
* @default "default"
|
||||
*/
|
||||
size?: "default" | "field" | "small";
|
||||
|
||||
/**
|
||||
* Set to `true` for the icon-only variant
|
||||
* @default false
|
||||
*/
|
||||
hasIconOnly?: boolean;
|
||||
|
||||
/**
|
||||
* Specify the icon from `carbon-icons-svelte` to render
|
||||
*/
|
||||
icon?: typeof import("carbon-icons-svelte/lib/Add16").default;
|
||||
|
||||
/**
|
||||
* Specify the ARIA label for the button icon
|
||||
*/
|
||||
iconDescription?: string;
|
||||
|
||||
/**
|
||||
* Set the alignment of the tooltip relative to the icon
|
||||
* `hasIconOnly` must be set to `true`
|
||||
*/
|
||||
tooltipAlignment?: "start" | "center" | "end";
|
||||
|
||||
/**
|
||||
* Set the position of the tooltip relative to the icon
|
||||
*/
|
||||
tooltipPosition?: "top" | "right" | "bottom" | "left";
|
||||
|
||||
/**
|
||||
* Set to `true` to render a custom HTML element
|
||||
* Props are destructured as `props` in the default slot (e.g. <Button let:props><div {...props}>...</div></Button>)
|
||||
* @default false
|
||||
*/
|
||||
as?: boolean;
|
||||
|
||||
/**
|
||||
* Set to `true` to display the skeleton state
|
||||
* @default false
|
||||
*/
|
||||
skeleton?: boolean;
|
||||
|
||||
/**
|
||||
* Set to `true` to disable the button
|
||||
* @default false
|
||||
*/
|
||||
disabled?: boolean;
|
||||
|
||||
/**
|
||||
* Set the `href` to use an anchor link
|
||||
*/
|
||||
href?: string;
|
||||
|
||||
/**
|
||||
* Specify the tabindex
|
||||
* @default "0"
|
||||
*/
|
||||
tabindex?: string;
|
||||
|
||||
/**
|
||||
* Specify the `type` attribute for the button element
|
||||
* @default "button"
|
||||
*/
|
||||
type?: string;
|
||||
|
||||
/**
|
||||
* Obtain a reference to the HTML element
|
||||
* @default null
|
||||
*/
|
||||
ref?: null | HTMLAnchorElement | HTMLButtonElement;
|
||||
};
|
||||
|
||||
$$slot_def: {
|
||||
default: { props: undefined };
|
||||
};
|
||||
|
||||
$on(eventname: "click", cb: (event: WindowEventMap["click"]) => void): () => void;
|
||||
$on(eventname: "mouseover", cb: (event: WindowEventMap["mouseover"]) => void): () => void;
|
||||
$on(eventname: "mouseenter", cb: (event: WindowEventMap["mouseenter"]) => void): () => void;
|
||||
$on(eventname: "mouseleave", cb: (event: WindowEventMap["mouseleave"]) => void): () => void;
|
||||
$on(eventname: string, cb: (event: Event) => void): () => void;
|
||||
}
|
17
types/Button/ButtonSet.d.ts
vendored
Normal file
17
types/Button/ButtonSet.d.ts
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
/// <reference types="svelte" />
|
||||
|
||||
export default class ButtonSet {
|
||||
$$prop_def: svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> & {
|
||||
/**
|
||||
* Set to `true` to stack the buttons vertically
|
||||
* @default false
|
||||
*/
|
||||
stacked?: boolean;
|
||||
};
|
||||
|
||||
$$slot_def: {
|
||||
default: {};
|
||||
};
|
||||
|
||||
$on(eventname: string, cb: (event: Event) => void): () => void;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue