-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
154 changed files
with
517 additions
and
522 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,129 +1,114 @@ | ||
import type { SvelteComponentTyped } from "svelte"; | ||
import type { SvelteHTMLElements } from "svelte/elements"; | ||
|
||
import type { ButtonSkeletonProps } from "./ButtonSkeleton.svelte"; | ||
|
||
type RestProps = SvelteHTMLElements["button"] & | ||
SvelteHTMLElements["a"] & | ||
SvelteHTMLElements["div"]; | ||
|
||
export interface ButtonProps extends ButtonSkeletonProps, RestProps { | ||
/** | ||
* 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 | ||
* @deprecated inferred using the $$slots API | ||
* @default false | ||
*/ | ||
hasIconOnly?: boolean; | ||
|
||
/** | ||
* Specify the icon from `carbon-icons-svelte` to render | ||
* @default undefined | ||
*/ | ||
icon?: typeof import("carbon-icons-svelte").CarbonIcon; | ||
|
||
/** | ||
* Specify the ARIA label for the button icon | ||
* @default undefined | ||
*/ | ||
iconDescription?: string; | ||
|
||
/** | ||
* Set the alignment of the tooltip relative to the icon | ||
* `hasIconOnly` must be set to `true` | ||
* @default "center" | ||
*/ | ||
tooltipAlignment?: "start" | "center" | "end"; | ||
|
||
/** | ||
* Set the position of the tooltip relative to the icon | ||
* @default "bottom" | ||
*/ | ||
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 | ||
* @default undefined | ||
*/ | ||
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; | ||
|
||
[key: `data-${string}`]: any; | ||
} | ||
|
||
export default class Button extends SvelteComponentTyped< | ||
ButtonProps, | ||
{ | ||
click: WindowEventMap["click"]; | ||
mouseover: WindowEventMap["mouseover"]; | ||
mouseenter: WindowEventMap["mouseenter"]; | ||
mouseleave: WindowEventMap["mouseleave"]; | ||
}, | ||
{ | ||
default: { | ||
props: { | ||
role: "button"; | ||
type?: string; | ||
tabindex: any; | ||
disabled: boolean; | ||
href?: string; | ||
class: string; | ||
[key: string]: any; | ||
}; | ||
}; | ||
} | ||
> {} | ||
|
||
import type { SvelteComponentTyped } from "svelte";import type { SvelteHTMLElements } from "svelte/elements"; | ||
|
||
import type { ButtonSkeletonProps } from "./ButtonSkeleton.svelte"; | ||
|
||
|
||
|
||
type RestProps = SvelteHTMLElements["button"]&SvelteHTMLElements["a"]&SvelteHTMLElements["div"]; | ||
|
||
export type ButtonProps = ButtonSkeletonProps, RestProps & { | ||
|
||
/** | ||
* 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 | ||
* @deprecated inferred using the $$slots API | ||
* @default false | ||
*/ | ||
hasIconOnly?: boolean; | ||
|
||
/** | ||
* Specify the icon from `carbon-icons-svelte` to render | ||
* @default undefined | ||
*/ | ||
icon?: typeof import("carbon-icons-svelte").CarbonIcon; | ||
|
||
/** | ||
* Specify the ARIA label for the button icon | ||
* @default undefined | ||
*/ | ||
iconDescription?: string; | ||
|
||
/** | ||
* Set the alignment of the tooltip relative to the icon | ||
* `hasIconOnly` must be set to `true` | ||
* @default "center" | ||
*/ | ||
tooltipAlignment?: "start" | "center" | "end"; | ||
|
||
/** | ||
* Set the position of the tooltip relative to the icon | ||
* @default "bottom" | ||
*/ | ||
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 | ||
* @default undefined | ||
*/ | ||
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; | ||
|
||
[key: `data-${string}`]: any; | ||
} | ||
|
||
|
||
export default class Button extends SvelteComponentTyped< | ||
ButtonProps, | ||
{click: WindowEventMap["click"]; | ||
mouseover: WindowEventMap["mouseover"]; | ||
mouseenter: WindowEventMap["mouseenter"]; | ||
mouseleave: WindowEventMap["mouseleave"]; | ||
}, | ||
{default: { props: { role: "button"; type?: string; tabindex: any; disabled: boolean; href?: string; class: string; [key: string]: any; } } | ||
;} | ||
> { | ||
|
||
} |
Oops, something went wrong.