UNPKG

@hashicorp/design-system-components

Version:
37 lines (34 loc) 1.23 kB
import Component from '@glimmer/component'; import { hash } from '@ember/helper'; import { precompileTemplate } from '@ember/template-compilation'; import { setComponentTemplate } from '@ember/component'; /** * Copyright IBM Corp. 2021, 2025 * SPDX-License-Identifier: MPL-2.0 */ const NOOP = () => {}; class HdsDialogPrimitiveFooter extends Component { // eslint-disable-next-line @typescript-eslint/no-explicit-any get onDismiss() { const { onDismiss } = this.args; // notice: this is to make sure the function is always defined when consumers add `{{on 'click' F.close}}` to a button in the DialogFooter. // in reality it's always used inside the main components as a yielded component, so the onDismiss handler is always defined if (typeof onDismiss === 'function') { return onDismiss; } else { return NOOP; } } static { setComponentTemplate(precompileTemplate("<div class=\"hds-dialog-primitive__footer {{@contextualClass}}\" ...attributes>\n {{yield (hash close=this.onDismiss)}}\n</div>", { strictMode: true, scope: () => ({ hash }) }), this); } } export { HdsDialogPrimitiveFooter as default }; //# sourceMappingURL=footer.js.map