UNPKG

@synergy-design-system/components

Version:

This package provides the base of the Synergy Design System as native web components. It uses [lit](https://www.lit.dev) and parts of [shoelace](https://shoelace.style/). Synergy officially supports the latest two versions of all major browsers (as define

75 lines (74 loc) 3.33 kB
/** * --------------------------------------------------------------------- * 🔒 AUTOGENERATED BY VENDORISM * Removing this comment will prevent it from being managed by it. * --------------------------------------------------------------------- */ import SynergyElement from '../../internal/synergy-element.js'; import SynIcon from '../icon/icon.component.js'; import type { CSSResultGroup } from 'lit'; /** * @summary Details show a brief summary and expand to show additional content. * @documentation https://synergy-design-system.github.io/?path=/docs/components-syn-details--docs * @status stable * @since 2.0 * * @dependency syn-icon * * @slot - The details' main content. * @slot summary - The details' summary. Alternatively, you can use the `summary` attribute. * @slot expand-icon - Optional expand icon to use instead of the default. Works best with `<syn-icon>`. * @slot collapse-icon - Optional collapse icon to use instead of the default. Works best with `<syn-icon>`. * * @event syn-show - Emitted when the details opens. * @event syn-after-show - Emitted after the details opens and all animations are complete. * @event syn-hide - Emitted when the details closes. * @event syn-after-hide - Emitted after the details closes and all animations are complete. * * @csspart base - The component's base wrapper. * @csspart header - The header that wraps both the summary and the expand/collapse icon. * @csspart summary - The container that wraps the summary. * @csspart summary-icon - The container that wraps the expand/collapse icons. * @csspart content - The details content. * @csspart body - The container that wraps the details content. * * @animation details.show - The animation to use when showing details. You can use `height: auto` with this animation. * @animation details.hide - The animation to use when hiding details. You can use `height: auto` with this animation. * * @cssproperty --syn-details-open-rotation - The rotation angle of the summary icon when the details is open. */ export default class SynDetails extends SynergyElement { static styles: CSSResultGroup; static dependencies: { 'syn-icon': typeof SynIcon; }; private readonly localize; details: HTMLDetailsElement; header: HTMLElement; body: HTMLElement; expandIconSlot: HTMLSlotElement; detailsObserver: MutationObserver; /** * Indicates whether or not the details is open. You can toggle this attribute to show and hide the details, or you * can use the `show()` and `hide()` methods and this attribute will reflect the details' open state. */ open: boolean; /** The summary to show in the header. If you need to display HTML, use the `summary` slot instead. */ summary: string; /** Disables the details so it can't be toggled. */ disabled: boolean; /** Draws the details as contained element. */ contained: boolean; /** The details's size. */ size: 'medium' | 'large'; firstUpdated(): void; disconnectedCallback(): void; private handleSummaryClick; private handleSummaryKeyDown; handleOpenChange(): Promise<void>; /** Shows the details. */ show(): Promise<void>; /** Hides the details */ hide(): Promise<void>; render(): import("lit").TemplateResult<1>; }