mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
refactor(types): shorten ref, id JSDocs, use CarbonIcon type, export component props
This commit is contained in:
parent
d38e6d8be6
commit
75d4b4cf03
219 changed files with 5168 additions and 5259 deletions
198
types/CodeSnippet/CodeSnippet.d.ts
vendored
198
types/CodeSnippet/CodeSnippet.d.ts
vendored
|
@ -1,104 +1,106 @@
|
|||
/// <reference types="svelte" />
|
||||
|
||||
export interface CodeSnippetProps {
|
||||
/**
|
||||
* Set the type of code snippet
|
||||
* @default "single"
|
||||
*/
|
||||
type?: "single" | "inline" | "multi";
|
||||
|
||||
/**
|
||||
* Set the code snippet text
|
||||
* Alternatively, use the default slot (e.g. <CodeSnippet>{`code`}</CodeSnippet>)
|
||||
*/
|
||||
code?: string;
|
||||
|
||||
/**
|
||||
* Set to `true` to expand a multi-line code snippet (type="multi")
|
||||
* @default false
|
||||
*/
|
||||
expanded?: boolean;
|
||||
|
||||
/**
|
||||
* Set to `true` to hide the copy button
|
||||
* @default false
|
||||
*/
|
||||
hideCopyButton?: boolean;
|
||||
|
||||
/**
|
||||
* Set to `true` to wrap the text
|
||||
* Note that `type` must be "multi"
|
||||
* @default false
|
||||
*/
|
||||
wrapText?: boolean;
|
||||
|
||||
/**
|
||||
* Set to `true` to enable the light variant
|
||||
* @default false
|
||||
*/
|
||||
light?: boolean;
|
||||
|
||||
/**
|
||||
* Set to `true` to display the skeleton state
|
||||
* @default false
|
||||
*/
|
||||
skeleton?: boolean;
|
||||
|
||||
/**
|
||||
* Specify the ARIA label for the copy button icon
|
||||
*/
|
||||
copyButtonDescription?: string;
|
||||
|
||||
/**
|
||||
* Specify the ARIA label of the copy button
|
||||
*/
|
||||
copyLabel?: string;
|
||||
|
||||
/**
|
||||
* Specify the feedback text displayed when clicking the snippet
|
||||
* @default "Copied!"
|
||||
*/
|
||||
feedback?: string;
|
||||
|
||||
/**
|
||||
* Set the timeout duration (ms) to display feedback text
|
||||
* @default 2000
|
||||
*/
|
||||
feedbackTimeout?: number;
|
||||
|
||||
/**
|
||||
* Specify the show less text
|
||||
* `type` must be "multi"
|
||||
* @default "Show less"
|
||||
*/
|
||||
showLessText?: string;
|
||||
|
||||
/**
|
||||
* Specify the show more text
|
||||
* `type` must be "multi"
|
||||
* @default "Show more"
|
||||
*/
|
||||
showMoreText?: string;
|
||||
|
||||
/**
|
||||
* Set to `true` to enable the show more/less button
|
||||
* @default false
|
||||
*/
|
||||
showMoreLess?: boolean;
|
||||
|
||||
/**
|
||||
* Set an id for the code element
|
||||
* @default "ccs-" + Math.random().toString(36)
|
||||
*/
|
||||
id?: string;
|
||||
|
||||
/**
|
||||
* Obtain a reference to the pre HTML element
|
||||
* @default null
|
||||
*/
|
||||
ref?: null | HTMLPreElement;
|
||||
}
|
||||
|
||||
export default class CodeSnippet {
|
||||
$$prop_def: svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> & {
|
||||
/**
|
||||
* Set the type of code snippet
|
||||
* @default "single"
|
||||
*/
|
||||
type?: "single" | "inline" | "multi";
|
||||
|
||||
/**
|
||||
* Set the code snippet text
|
||||
* Alternatively, use the default slot (e.g. <CodeSnippet>{`code`}</CodeSnippet>)
|
||||
*/
|
||||
code?: string;
|
||||
|
||||
/**
|
||||
* Set to `true` to expand a multi-line code snippet (type="multi")
|
||||
* @default false
|
||||
*/
|
||||
expanded?: boolean;
|
||||
|
||||
/**
|
||||
* Set to `true` to hide the copy button
|
||||
* @default false
|
||||
*/
|
||||
hideCopyButton?: boolean;
|
||||
|
||||
/**
|
||||
* Set to `true` to wrap the text
|
||||
* Note that `type` must be "multi"
|
||||
* @default false
|
||||
*/
|
||||
wrapText?: boolean;
|
||||
|
||||
/**
|
||||
* Set to `true` to enable the light variant
|
||||
* @default false
|
||||
*/
|
||||
light?: boolean;
|
||||
|
||||
/**
|
||||
* Set to `true` to display the skeleton state
|
||||
* @default false
|
||||
*/
|
||||
skeleton?: boolean;
|
||||
|
||||
/**
|
||||
* Specify the ARIA label for the copy button icon
|
||||
*/
|
||||
copyButtonDescription?: string;
|
||||
|
||||
/**
|
||||
* Specify the ARIA label of the copy button
|
||||
*/
|
||||
copyLabel?: string;
|
||||
|
||||
/**
|
||||
* Specify the feedback text displayed when clicking the snippet
|
||||
* @default "Copied!"
|
||||
*/
|
||||
feedback?: string;
|
||||
|
||||
/**
|
||||
* Set the timeout duration (ms) to display feedback text
|
||||
* @default 2000
|
||||
*/
|
||||
feedbackTimeout?: number;
|
||||
|
||||
/**
|
||||
* Specify the show less text
|
||||
* `type` must be "multi"
|
||||
* @default "Show less"
|
||||
*/
|
||||
showLessText?: string;
|
||||
|
||||
/**
|
||||
* Specify the show more text
|
||||
* `type` must be "multi"
|
||||
* @default "Show more"
|
||||
*/
|
||||
showMoreText?: string;
|
||||
|
||||
/**
|
||||
* Set to `true` to enable the show more/less button
|
||||
* @default false
|
||||
*/
|
||||
showMoreLess?: boolean;
|
||||
|
||||
/**
|
||||
* Set an id for the code element
|
||||
*/
|
||||
id?: string;
|
||||
|
||||
/**
|
||||
* Obtain a reference to the pre HTML element
|
||||
* @default null
|
||||
*/
|
||||
ref?: null | HTMLPreElement;
|
||||
};
|
||||
|
||||
$$prop_def: CodeSnippetProps;
|
||||
$$slot_def: {
|
||||
default: {};
|
||||
};
|
||||
|
|
17
types/CodeSnippet/CodeSnippetSkeleton.d.ts
vendored
17
types/CodeSnippet/CodeSnippetSkeleton.d.ts
vendored
|
@ -1,14 +1,15 @@
|
|||
/// <reference types="svelte" />
|
||||
|
||||
export default class CodeSnippetSkeleton {
|
||||
$$prop_def: svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> & {
|
||||
/**
|
||||
* Set the type of code snippet
|
||||
* @default "single"
|
||||
*/
|
||||
type?: "single" | "inline" | "multi";
|
||||
};
|
||||
export interface CodeSnippetSkeletonProps extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> {
|
||||
/**
|
||||
* Set the type of code snippet
|
||||
* @default "single"
|
||||
*/
|
||||
type?: "single" | "inline" | "multi";
|
||||
}
|
||||
|
||||
export default class CodeSnippetSkeleton {
|
||||
$$prop_def: CodeSnippetSkeletonProps;
|
||||
$$slot_def: {};
|
||||
|
||||
$on(eventname: "click", cb: (event: WindowEventMap["click"]) => void): () => void;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue