UNPKG

@hashicorp/design-system-components

Version:
41 lines (38 loc) 1.78 kB
import Component from '@glimmer/component'; import { assert } from '@ember/debug'; import { guidFor } from '@ember/object/internals'; import { hash } from '@ember/helper'; import HdsIcon from '../icon/index.js'; import HdsTooltipModifier from '../../../modifiers/hds-tooltip.js'; import HdsTHelper from '../../../helpers/hds-t.js'; import { precompileTemplate } from '@ember/template-compilation'; import { setComponentTemplate } from '@ember/component'; /** * Copyright IBM Corp. 2021, 2025 * SPDX-License-Identifier: MPL-2.0 */ class HdsAdvancedTableThButtonTooltip extends Component { // Generates a unique ID for the (hidden) "label prefix" <span> element _prefixLabelId = guidFor(this); get tooltip() { assert(`@tooltip for "HdsAdvancedTableThButtonTooltip" must be a string`, typeof this.args.tooltip === 'string'); return this.args.tooltip; } get classNames() { const classes = ['hds-advanced-table__th-button', 'hds-advanced-table__th-button--tooltip']; return classes.join(' '); } static { setComponentTemplate(precompileTemplate("<button type=\"button\" class={{this.classNames}} {{hdsTooltip this.tooltip options=(hash placement=\"bottom\")}} aria-labelledby=\"{{this._prefixLabelId}} {{@labelId}}\" ...attributes>\n <span id={{this._prefixLabelId}} class=\"hds-advanced-table__th-button-aria-label-hidden-segment\">\n {{hdsT \"hds.components.common.tooltip-prefix\" default=\"More information for\"}}\n </span>\n <HdsIcon @name=\"info\" />\n</button>", { strictMode: true, scope: () => ({ hdsTooltip: HdsTooltipModifier, hash, hdsT: HdsTHelper, HdsIcon }) }), this); } } export { HdsAdvancedTableThButtonTooltip as default }; //# sourceMappingURL=th-button-tooltip.js.map