UNPKG

@hashicorp/design-system-components

Version:
36 lines (33 loc) 1.2 kB
import Component from '@glimmer/component'; import { assert } from '@ember/debug'; import { HdsSeparatorSpacingValues } from './types.js'; import { precompileTemplate } from '@ember/template-compilation'; import { setComponentTemplate } from '@ember/component'; /** * Copyright IBM Corp. 2021, 2025 * SPDX-License-Identifier: MPL-2.0 */ const DEFAULT_SPACING = HdsSeparatorSpacingValues.TwentyFour; const SPACING = Object.values(HdsSeparatorSpacingValues); class HdsSeparator extends Component { get spacing() { const { spacing = DEFAULT_SPACING } = this.args; assert(`@spacing for "Hds::Separator" must be one of the following: ${SPACING.join(', ')}; received: ${spacing}`, SPACING.includes(spacing)); return spacing; } get classNames() { const classes = ['hds-separator']; // add a class based on the @spacing argument classes.push(`hds-separator--spacing-${this.spacing}`); return classes.join(' '); } static { setComponentTemplate(precompileTemplate("<hr class={{this.classNames}} ...attributes />", { strictMode: true }), this); } } export { DEFAULT_SPACING, SPACING, HdsSeparator as default }; //# sourceMappingURL=index.js.map