UNPKG

@hashicorp/design-system-components

Version:
51 lines (48 loc) 2.03 kB
import Component from '@glimmer/component'; import { assert } from '@ember/debug'; import { hash } from '@ember/helper'; import { HdsApplicationStateAlignValues } from './types.js'; import HdsApplicationStateMedia from './media.js'; import HdsApplicationStateHeader from './header.js'; import HdsApplicationStateBody from './body.js'; import HdsApplicationStateFooter from './footer.js'; import { precompileTemplate } from '@ember/template-compilation'; import { setComponentTemplate } from '@ember/component'; /** * Copyright IBM Corp. 2021, 2025 * SPDX-License-Identifier: MPL-2.0 */ const ALIGNS = Object.values(HdsApplicationStateAlignValues); class HdsApplicationState extends Component { get isAutoCentered() { return this.args.isAutoCentered ?? true; } get align() { const validAlignValues = Object.values(HdsApplicationStateAlignValues); assert(`@align for "Hds::ApplicationState" must be one of the following: ${validAlignValues.join(', ')}; received: ${this.args.align}`, this.args.align == null || validAlignValues.includes(this.args.align)); return this.args.align ?? HdsApplicationStateAlignValues.Left; } get classNames() { const classes = ['hds-application-state']; // add a class based on the @align argument classes.push(`hds-application-state--align-${this.align}`); if (this.isAutoCentered) { classes.push('hds-application-state--is-auto-centered'); } return classes.join(' '); } static { setComponentTemplate(precompileTemplate("<div class={{this.classNames}} ...attributes>\n {{yield (hash Media=HdsApplicationStateMedia Header=HdsApplicationStateHeader Body=HdsApplicationStateBody Footer=HdsApplicationStateFooter)}}\n</div>", { strictMode: true, scope: () => ({ hash, HdsApplicationStateMedia, HdsApplicationStateHeader, HdsApplicationStateBody, HdsApplicationStateFooter }) }), this); } } export { ALIGNS, HdsApplicationState as default }; //# sourceMappingURL=index.js.map