@carbon/ibm-products-web-components
Version:
Carbon for IBM Products Web Components
109 lines • 3.58 kB
TypeScript
/**
* @license
*
* Copyright IBM Corp. 2026
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import { LitElement } from 'lit';
import CDSButton from '@carbon/web-components/es/components/button/button.js';
import '@carbon/web-components/es/components/button/index.js';
export declare const ButtonSizes: readonly ["sm", "md", "lg", "xl", "2xl"];
export type ButtonSize = (typeof ButtonSizes)[number];
export type ButtonKind = 'primary' | 'secondary' | 'tertiary' | 'danger' | 'ghost' | 'danger--ghost';
/**
* Action button configuration that extends CDSButton properties.
* Includes all standard button attributes plus custom action-specific properties.
*/
export interface ActionButton extends Partial<Omit<CDSButton, 'kind'>> {
kind?: ButtonKind;
label?: string;
loading?: boolean;
onClick?: (event: Event) => void;
[key: string]: any;
}
/**
* Action Set component - A specialized button set with validation and ordering logic.
* Extends Carbon's button-set with additional features for action buttons.
*
* @element c4p-action-set
* @slot - Slot for cds-button elements (used when actions prop is not provided)
*/
export declare class CDSActionSet extends LitElement {
/**
* Number of slotted buttons (computed internally).
*/
private _slottedButtonCount;
/**
* Computed property: `true` if the buttons are currently stacked.
* This is derived from size, disableStacking, and button count.
*/
get stacked(): boolean;
/**
* The size of buttons to use for the actions.
*/
buttonSize?: ButtonSize;
/**
* The size of the action set. Different button arrangements are used at
* different sizes, to make best use of the available space.
*/
size: ButtonSize;
/**
* When true, prevents automatic stacking of buttons even when size would
* normally trigger stacking (e.g., 'sm' size or 'md' with 3+ actions).
* Buttons will remain in a horizontal layout.
*/
disableStacking: boolean;
/**
* Array of action button configurations. When provided, buttons will be
* rendered internally instead of using slotted content.
*/
actions: ActionButton[];
static styles: any;
/**
* Applies common button styling (size, classes, expressive attribute)
* @private
*/
private _applyButtonStyles;
/**
* Processes actions: validates, determines stacking, and sorts
* @private
*/
private _processActions;
/**
* Handler for @slotchange, processes and orders buttons based on ActionSet logic
*
* @private
*/
protected _handleSlotChange(event: Event): void;
/**
* Reorders the button elements in the DOM based on the sorted actions
* and applies appropriate styling
*
* @private
*/
private _reorderButtons;
/**
* When a button within the action-set is focused, hide the margin on both sides
* of the focused button, by applying the appropriate styles to its sibling
*
* @private
*/
private _hideSiblingMargin;
connectedCallback(): void;
disconnectedCallback(): void;
/**
* Renders buttons from the actions prop
* @private
*/
private _renderActionsFromProp;
render(): import("lit-html").TemplateResult<1>;
}
declare global {
interface HTMLElementTagNameMap {
'c4p-action-set': CDSActionSet;
}
}
export default CDSActionSet;
//# sourceMappingURL=action-set.d.ts.map