{# Django template for CopyToClipboard #}
{% load components %}
{% with buttonClass=className|default:''|add:' usx-copy' escapedCopyText=copyText|default:''|escapejs %}
{% dict onclick="navigator.clipboard.writeText('"|add:escapedCopyText|add:"')" as copyAttributes %}
{% button ghost=True className=buttonClass extraAttributes=copyAttributes as copyButton %}
{% icon name='content_copy' className="usx-copy__copy" staticBaseUrl=staticBaseUrl %}{% endicon %}
{% icon name='check' className="usx-copy__check" staticBaseUrl=staticBaseUrl %}{% endicon %}
{% if label %}{{ label }}{% endif %}
{% endbutton %}
{% if tooltipProps != None %}
{% fragment as tooltipLabel %}{{ tooltipProps.label|default_if_none:'' }}{% if tooltipProps.copiedTooltip != None %}{{ tooltipProps.copiedTooltip }}{% else %}Copied{% endif %}{% endfragment %}
{% tooltip props=tooltipProps label=tooltipLabel %}{{ copyButton }}{% endtooltip %}
{% else %}
{{ copyButton }}
{% endif %}
{% endwith %}