2023-03-14 13:18:55 +00:00
|
|
|
{{!
|
|
|
|
Copyright (c) HashiCorp, Inc.
|
|
|
|
SPDX-License-Identifier: MPL-2.0
|
|
|
|
}}
|
|
|
|
|
2021-07-06 15:56:36 +00:00
|
|
|
<StateChart
|
|
|
|
@src={{this.chart}}
|
|
|
|
as |State Guard Action dispatch state|
|
|
|
|
>
|
2020-11-30 16:52:13 +00:00
|
|
|
<div
|
|
|
|
class="copy-button"
|
|
|
|
...attributes
|
|
|
|
>
|
2021-07-06 15:56:36 +00:00
|
|
|
{{#let (fn dispatch 'SUCCESS') (fn dispatch 'ERROR') (fn dispatch 'RESET') as |success error reset|}}
|
2020-11-30 16:52:13 +00:00
|
|
|
<button
|
2021-07-06 15:56:36 +00:00
|
|
|
{{with-copyable @value success=success error=error}}
|
|
|
|
aria-label={{t 'components.copy-button.title' name=@name}}
|
2020-11-30 16:52:13 +00:00
|
|
|
type="button"
|
|
|
|
class="copy-btn"
|
|
|
|
...attributes
|
|
|
|
{{tooltip
|
2021-07-06 15:56:36 +00:00
|
|
|
(if (state-matches state 'success') (t 'components.copy-button.success' name=@name) (t 'components.copy-button.error'))
|
2020-11-30 16:52:13 +00:00
|
|
|
options=(hash
|
|
|
|
trigger='manual'
|
|
|
|
showOnCreate=(not (state-matches state 'idle'))
|
|
|
|
delay=(array 0 3000)
|
2021-07-06 15:56:36 +00:00
|
|
|
onHidden=reset
|
2020-11-30 16:52:13 +00:00
|
|
|
)
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{{~yield~}}
|
|
|
|
</button>
|
2021-07-06 15:56:36 +00:00
|
|
|
{{/let}}
|
2020-06-17 09:25:54 +00:00
|
|
|
</div>
|
|
|
|
</StateChart>
|