UNPKG

@carbon/ibm-products-web-components

Version:
86 lines (84 loc) 3.2 kB
/** * Copyright IBM Corp. 2020, 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 "../../globals/settings.js"; import { __decorate } from "../../_virtual/_@oxc-project_runtime@0.127.0/helpers/decorate.js"; import tearsheet_default from "./tearsheet.scss.js"; import { tearsheetSignal } from "./tearsheet-signal.js"; import "../side-panel/index.js"; import { LitElement, html } from "lit"; import { property } from "lit/decorators.js"; import HostListenerMixin from "@carbon/web-components/es/globals/mixins/host-listener.js"; import { carbonElement } from "@carbon/web-components/es/globals/decorators/carbon-element.js"; import { SignalWatcher } from "@lit-labs/signals"; //#region src/components/tearsheet-preview/tearsheet-influencer.ts /** * @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. */ /** * Tearsheet Influencer component - Left-side panel for contextual information. * Automatically converts to a slide-in panel on small screens. * * @element c4p-tearsheet-influencer * @slot - Content for the influencer panel * @fires cds-tearsheet-influencer-closed - Fired when the influencer panel is closed (mobile only) */ let CDSTearsheetInfluencer = class CDSTearsheetInfluencer extends SignalWatcher(HostListenerMixin(LitElement)) { constructor(..._args) { super(..._args); this.slot = "influencer"; this.isFlush = false; this.influencerPanelOpen = false; this.influencerPanelAriaLabel = "Influencer panel"; this.handleClose = () => { this.influencerPanelOpen = false; this.dispatchEvent(new CustomEvent("cds-tearsheet-influencer-closed", { bubbles: true, composed: true })); }; } render() { const { isSm } = tearsheetSignal.get(); return !isSm ? html` <aside aria-label="${this.influencerPanelAriaLabel}"> <slot></slot> </aside>` : html` <c4p-side-panel size="sm" ?open="${this.influencerPanelOpen}" placement="left" aria-label="${this.influencerPanelAriaLabel}" aria-modal="true" @c4p-side-panel-closed="${this.handleClose}" > <slot></slot> </c4p-side-panel>`; } static { this.styles = tearsheet_default; } }; __decorate([property({ reflect: true })], CDSTearsheetInfluencer.prototype, "slot", void 0); __decorate([property({ type: Boolean, reflect: true, attribute: "is-flush" })], CDSTearsheetInfluencer.prototype, "isFlush", void 0); __decorate([property({ type: Boolean, reflect: true, attribute: "influencer-panel-open" })], CDSTearsheetInfluencer.prototype, "influencerPanelOpen", void 0); __decorate([property({ attribute: "influencer-panel-aria-label" })], CDSTearsheetInfluencer.prototype, "influencerPanelAriaLabel", void 0); CDSTearsheetInfluencer = __decorate([carbonElement(`c4p-tearsheet-influencer`)], CDSTearsheetInfluencer); var tearsheet_influencer_default = CDSTearsheetInfluencer; //#endregion export { tearsheet_influencer_default as default }; //# sourceMappingURL=tearsheet-influencer.js.map