carbon-components-angular
Version:
Next generation components
135 lines (131 loc) • 4.63 kB
TypeScript
/**
*
* carbon-angular v0.0.0 | code-snippet.component.d.ts
*
* Copyright 2014, 2025 IBM
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { AfterViewInit, OnInit } from "@angular/core";
import { I18n } from "carbon-components-angular/i18n";
import { EventService } from "carbon-components-angular/utils";
import { BaseIconButton } from "carbon-components-angular/button";
import * as i0 from "@angular/core";
export declare enum SnippetType {
single = "single",
multi = "multi",
inline = "inline"
}
/**
* Get started with importing the module:
*
* ```typescript
* import { CodeSnippetModule } from 'carbon-components-angular';
* ```
*
* ```html
* <cds-code-snippet>Code</cds-code-snippet>
* ```
*
* [See demo](../../?path=/story/components-code-snippet--basic)
*/
export declare class CodeSnippet extends BaseIconButton implements OnInit, AfterViewInit {
protected i18n: I18n;
protected eventService: EventService;
get snippetClass(): boolean;
get snippetSingleClass(): boolean;
get snippetMultiClass(): boolean;
get snippetDisabledClass(): boolean;
get snippetInlineLightClass(): boolean;
readonly rowHeightInPixel: number;
/**
* It can be `"single"`, `"multi"` or `"inline"`
*/
display: SnippetType;
translations: any;
/**
* copy button description to show on hover
*/
copyButtonDescription: string;
/**
* Set to `true` to hide copy button
*/
hideCopyButton: boolean;
/**
* Set to `true` to disable the code snippet
*/
disabled: boolean;
/**
* Specify the max number of rows to show when collapsed
* Default is `15`
*/
maxCollapsedNumberOfRows: number;
/**
* Specify the min number of rows to show when collapsed
* Default is `3`
*/
minCollapsedNumberOfRows: number;
/**
* Specify the max number of rows to show when expanded
* Default is `0`, hence all content will be visible when expanded
*/
maxExpandedNumberOfRows: number;
/**
* Specify the min number of rows to show when expanded
* Default is `16`, hence height of expanded row will be 16 * rowHeightInPixel (16) = 256px
*/
minExpandedNumberOfRows: number;
/**
* Set to `true` to wrap the text
*/
wrapText: boolean;
/**
* @deprecated since v5 - Use `cdsLayer` directive instead
* Set to `"light"` to apply the light style
*/
theme: "light" | "dark";
/**
* Text displayed in the tooltip when user clicks button to copy code.
*/
feedbackText: any;
/**
* Time in miliseconds to keep the feedback tooltip displayed.
* Defaults to 2 seconds
*/
feedbackTimeout: number;
expanded: boolean;
skeleton: boolean;
styles: any;
code: any;
codeContent: any;
codeContainer: any;
showFeedback: boolean;
animating: boolean;
hasExpandButton: any;
isExpandable: boolean;
hasRightOverflow: boolean;
hasRight: boolean;
hasLeft: boolean;
/**
* Creates an instance of CodeSnippet.
*/
constructor(i18n: I18n, eventService: EventService);
handleScroll(): void;
toggleSnippetExpansion(): void;
onCopyButtonClicked(): void;
ngOnInit(): void;
ngAfterViewInit(): void;
calculateContainerHeight(): void;
protected canExpand(): void;
static ɵfac: i0.ɵɵFactoryDeclaration<CodeSnippet, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<CodeSnippet, "cds-code-snippet, ibm-code-snippet", never, { "display": "display"; "translations": "translations"; "copyButtonDescription": "copyButtonDescription"; "hideCopyButton": "hideCopyButton"; "disabled": "disabled"; "maxCollapsedNumberOfRows": "maxCollapsedNumberOfRows"; "minCollapsedNumberOfRows": "minCollapsedNumberOfRows"; "maxExpandedNumberOfRows": "maxExpandedNumberOfRows"; "minExpandedNumberOfRows": "minExpandedNumberOfRows"; "wrapText": "wrapText"; "theme": "theme"; "feedbackText": "feedbackText"; "feedbackTimeout": "feedbackTimeout"; "expanded": "expanded"; "skeleton": "skeleton"; }, {}, never, ["*"], false>;
}