Files
vault/ui/lib/core/addon/components/tool-tip.js
claire bontempo e61bd967e3 Add docfy for addon components (#27188)
* move script to scripts folder

* add docfy to router and scripts

* add docfy to router and scripts

* fix jsdoc syntax

* add component markdown files to gitignore

* improve error handling for scripts

* tidy up remaining jsdoc syntax

* add sample jsdoc components

* add known issue info

* make not using multi-line components clearer

* make generating docs clearer

* update copy

* final how to docfy cleanup

* fix ts file @module syntax

* fix read more syntax

* make docfy typescript compatible
2024-05-29 14:06:38 -07:00

57 lines
1.3 KiB
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import Component from '@glimmer/component';
import { action } from '@ember/object';
import { debounce } from '@ember/runloop';
/**
* @deprecated
* @module ToolTip
*
* @example
* <ToolTip @verticalPosition="above" as |T|>
* <T.Trigger>
* <Icon @name="check-circle" class="has-text-success" />
* </T.Trigger>
* <T.Content @defaultClass="tool-tip">
* <div class="box">
* My tooltip text
* </div>
* </T.Content>
* </ToolTip>
*
* * Use HDS tooltip instead
* @param {string} [verticalPosition] - vertical position specification (above, below)
* @param {string} [horizontalPosition] - horizontal position specification (center, auto-right)
*
*/
export default class ToolTipComponent extends Component {
get delay() {
return this.args.delay || 200;
}
get horizontalPosition() {
return this.args.horizontalPosition || 'auto-right';
}
toggleState({ dropdown, action }) {
dropdown.actions[action]();
}
@action
open(dropdown) {
debounce(this, 'toggleState', { dropdown, action: 'open' }, this.delay);
}
@action
close(dropdown) {
debounce(this, 'toggleState', { dropdown, action: 'close' }, this.delay);
}
@action
prevent() {
return false;
}
}