@hashicorp/design-system-components
Version:
Helios Design System Components
35 lines (32 loc) • 1.26 kB
JavaScript
import Component from '@glimmer/component';
import HdsFormIndicator from '../indicator/index.js';
import { precompileTemplate } from '@ember/template-compilation';
import { setComponentTemplate } from '@ember/component';
/**
* Copyright IBM Corp. 2021, 2025
* SPDX-License-Identifier: MPL-2.0
*/
class HdsFormLegend extends Component {
get classNames() {
const classes = ['hds-form-legend'];
// add typographic classes
classes.push('hds-typography-body-200', 'hds-font-weight-semibold');
// add a class based on the @contextualClass argument
// notice: this will *not* be documented for public use
// the reason for this is that the contextual component declarations don't pass attributes to the component
if (this.args.contextualClass) {
classes.push(this.args.contextualClass);
}
return classes.join(' ');
}
static {
setComponentTemplate(precompileTemplate("<legend class={{this.classNames}} id={{@id}} ...attributes>\n {{yield}}\n <HdsFormIndicator @isRequired={{@isRequired}} @isOptional={{@isOptional}} />\n</legend>", {
strictMode: true,
scope: () => ({
HdsFormIndicator
})
}), this);
}
}
export { HdsFormLegend as default };
//# sourceMappingURL=index.js.map