@hashicorp/design-system-components
Version:
Helios Design System Components
31 lines (26 loc) • 1.43 kB
JavaScript
import Component from '@glimmer/component';
import { precompileTemplate } from '@ember/template-compilation';
import { setComponentTemplate } from '@ember/component';
var TEMPLATE = precompileTemplate("{{!\n Copyright (c) HashiCorp, Inc.\n SPDX-License-Identifier: MPL-2.0\n}}\n{{#if @isOptional}}\n <Hds::Text::Body class={{this.classNames}} tag=\"span\" @size=\"100\" @weight=\"regular\">\n ({{hds-t \"hds.components.form.common.optional_field_indicator\" default=\"Optional\"}})\n </Hds::Text::Body>\n{{/if}}\n{{#if @isRequired}}\n <Hds::Badge\n aria-hidden=\"true\"\n class={{this.classNames}}\n @size=\"small\"\n @color=\"neutral\"\n @text={{hds-t \"hds.components.form.common.required_field_indicator\" default=\"Required\"}}\n />\n{{/if}}");
/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
class HdsFormIndicator extends Component {
/**
* Get the class names to apply to the component.
* @method classNames
* @return {string} The "class" attribute to apply to the component.
*/
get classNames() {
const classes = ['hds-form-indicator'];
if (this.args.isOptional) {
// add speficic class for "optional" indicator
classes.push('hds-form-indicator--optional');
}
return classes.join(' ');
}
}
setComponentTemplate(TEMPLATE, HdsFormIndicator);
export { HdsFormIndicator as default };
//# sourceMappingURL=index.js.map