2023-03-15 16:00:52 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
*/
|
|
|
|
|
2022-06-04 00:34:42 +00:00
|
|
|
import Component from '@glimmer/component';
|
|
|
|
import { tracked } from '@glimmer/tracking';
|
2018-06-26 21:35:47 +00:00
|
|
|
|
2022-06-04 00:34:42 +00:00
|
|
|
/**
|
|
|
|
* @module HoverCopyButton
|
|
|
|
* The `HoverCopyButton` is used on dark backgrounds to show a copy button.
|
|
|
|
*
|
|
|
|
* @example ```js
|
|
|
|
* <HoverCopyButton @copyValue={{stringify this.model.id}} @alwaysShow={{true}} />```
|
|
|
|
*
|
|
|
|
* @param {string} copyValue - The value to be copied.
|
|
|
|
* @param {boolean} [alwaysShow] - Boolean that affects the class.
|
|
|
|
*/
|
2018-06-26 21:35:47 +00:00
|
|
|
|
2022-06-04 00:34:42 +00:00
|
|
|
export default class HoverCopyButton extends Component {
|
|
|
|
get alwaysShow() {
|
|
|
|
return this.args.alwaysShow || false;
|
|
|
|
}
|
|
|
|
get copyValue() {
|
|
|
|
return this.args.copyValue || false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@tracked tooltipText = 'Copy';
|
|
|
|
}
|