UNPKG

@carbon/ibm-products-web-components

Version:

Carbon for IBM Products Web Components

70 lines (66 loc) 2.69 kB
/** * Copyright IBM Corp. 2024 * * 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 { __decorate } from 'tslib'; import { LitElement, html } from 'lit'; import { prefix } from '../../globals/settings.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 styles from './interstitial-screen-body-item.scss.js'; import { property } from 'lit/decorators.js'; import { interstitialDetailsSignal, updateInterstitialDetailsSignal } from './interstitial-screen-context.js'; /** * @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() { super(...arguments); /** * This will serve the labels for each step */ this.stepTitle = ''; } firstUpdated(_changedProperties) { this.updateStepDetails(); } updateStepDetails() { var _a, _b, _c; const randomId = crypto === null || crypto === void 0 ? void 0 : crypto.randomUUID(); const stepKey = `${((_a = this.stepTitle) === null || _a === void 0 ? void 0 : _a.replace(/\s+/g, '')) || randomId}`; const newStep = { stepTitle: this.stepTitle, id: (_b = this.id) !== null && _b !== void 0 ? _b : stepKey, }; const exists = (_c = interstitialDetailsSignal .get() .stepDetails) === null || _c === void 0 ? void 0 : _c.some((step) => step.stepTitle === newStep.stepTitle); if (!exists && newStep.stepTitle) { updateInterstitialDetailsSignal({ name: 'stepDetails', detail: newStep }); } } render() { return html ` <slot @slotchange=${this.updateStepDetails}></slot> `; } }; CDSInterstitialScreenBodyItem.styles = styles; __decorate([ property({ reflect: true }) ], CDSInterstitialScreenBodyItem.prototype, "stepTitle", void 0); CDSInterstitialScreenBodyItem = __decorate([ carbonElement(`${prefix}-interstitial-screen-body-item`) ], CDSInterstitialScreenBodyItem); var CDSInterstitialScreenBodyItem$1 = CDSInterstitialScreenBodyItem; export { CDSInterstitialScreenBodyItem$1 as default }; //# sourceMappingURL=interstitial-screen-body-item.js.map