@carbon/ibm-products-web-components
Version:
Carbon for IBM Products Web Components
64 lines (62 loc) • 2.56 kB
JavaScript
/**
* 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 { registerFocusableContainers } from "../../utilities/manageFocusTrap/manageFocusTrap.js";
import { interstitialDetailsSignal, updateInterstitialDetailsSignal } from "./interstitial-screen-context.js";
import interstitial_screen_body_item_default$1 from "./interstitial-screen-body-item.scss.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";
//#region src/components/interstitial-screen/interstitial-screen-body-item.ts
/**
* @license
*
* Copyright IBM Corp. 2025
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
/**
* interstitial-screen-body-item for body children
* @element c4p-interstitial-screen-body-item
*/
let CDSInterstitialScreenBodyItem = class CDSInterstitialScreenBodyItem extends HostListenerMixin(LitElement) {
constructor(..._args) {
super(..._args);
this.stepTitle = "";
}
firstUpdated(_changedProperties) {
this.updateStepDetails();
registerFocusableContainers(this);
}
updateStepDetails() {
const randomId = crypto?.randomUUID();
const stepKey = `${this.stepTitle?.replace(/\s+/g, "") || randomId}`;
const newStep = {
stepTitle: this.stepTitle,
id: this.id ?? stepKey
};
if (!interstitialDetailsSignal.get().stepDetails?.some((step) => step.stepTitle === newStep.stepTitle) && newStep.stepTitle) updateInterstitialDetailsSignal({
name: "stepDetails",
detail: newStep
});
}
render() {
return html` <slot @slotchange=${this.updateStepDetails}></slot> `;
}
static {
this.styles = interstitial_screen_body_item_default$1;
}
};
__decorate([property({ reflect: true })], CDSInterstitialScreenBodyItem.prototype, "stepTitle", void 0);
CDSInterstitialScreenBodyItem = __decorate([carbonElement(`c4p-interstitial-screen-body-item`)], CDSInterstitialScreenBodyItem);
var interstitial_screen_body_item_default = CDSInterstitialScreenBodyItem;
//#endregion
export { interstitial_screen_body_item_default as default };
//# sourceMappingURL=interstitial-screen-body-item.js.map