carbon-components-svelte/types/CodeSnippet/CodeSnippet.d.ts
Eric Liu fa9b90cd79
Alignment with Carbon version 10.32 (#588)
* feat(code-snippet): add copy functionality

- docs: add custom feedback copy text example

* feat(tile): support disabled state for SelectableTile, RadioTile

Closes #539

* build(rollup): add clipboard-copy to globals

* feat(copy-button): add copy functionality

* feat(content-switcher): deprecate the light prop

- docs: remove the light variant example

* fix(toolbar-search): remove outer div

* feat(search): add searchClass prop

* fix(composed-modal): set hasScrollingContent class on ModalBody

* docs(data-table): add expandable size examples

* feat(tooltip): add TooltipFooter component

* fix(time-picker): correctly display invalidText

* feat(breadcrumb): support overflow menu

* feat(multi-select): export inputRef prop

* chore(deps-dev): upgrade carbon-components to v10.32.0

* feat(form): add noMargin prop to FormGroup

* docs(tooltip): document TooltipFooter

* feat(context-menu): support danger kind for ContextMenuOption

* feat(data-table): support rendering empty table header in skeleton

* refactor(types): use shorter import path in DataTableSkeleton

* feat(data-table): allow sorting to be disabled for a specific header

* docs(data-table): update example to desort the Protocol header

As an example, it makes more sense because all the values ("http") are the same.

* fix(context-menu): set initial y offset of context menu based on window height #577

* fix(context-menu): render submenu based on viewport constraints #577
2021-04-02 13:31:53 -07:00

122 lines
2.5 KiB
TypeScript

/// <reference types="svelte" />
import { SvelteComponentTyped } from "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>)
* You must use the `code` prop to copy the code
*/
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` for the disabled variant
* Only applies to the "single", "multi" types
* @default false
*/
disabled?: 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 extends SvelteComponentTyped<
CodeSnippetProps,
{
click: WindowEventMap["click"];
mouseover: WindowEventMap["mouseover"];
mouseenter: WindowEventMap["mouseenter"];
mouseleave: WindowEventMap["mouseleave"];
animationend: WindowEventMap["animationend"];
copy: CustomEvent<any>;
},
{ default: {} }
> {}