30 lines
820 B
Handlebars
30 lines
820 B
Handlebars
<StateChart @src={{chart}} as |State Guard Action dispatch state|>
|
|
<Ref @target={{this}} @name="dispatch" @value={{dispatch}} />
|
|
<div
|
|
{{did-insert this.connect}}
|
|
{{will-destroy this.disconnect}}
|
|
class="copy-button"
|
|
id={{this.guid}}
|
|
...attributes
|
|
>
|
|
<button
|
|
title={{concat "Copy " @name " to the clipboard"}}
|
|
type="button"
|
|
class="copy-btn"
|
|
data-clipboard-text={{@value}}
|
|
...attributes
|
|
{{tooltip
|
|
(if (state-matches state 'success') (concat 'Copied ' @name '!!') 'There was a problem!')
|
|
options=(hash
|
|
trigger='manual'
|
|
showOnCreate=(not (state-matches state 'idle'))
|
|
delay=(array 0 3000)
|
|
onHidden=(action dispatch 'RESET')
|
|
)
|
|
}}
|
|
>
|
|
{{~yield~}}
|
|
</button>
|
|
</div>
|
|
</StateChart>
|