2021-03-31 22:59:07 +13:00
|
|
|
<script>
|
2021-04-09 03:04:27 +12:00
|
|
|
import "@spectrum-css/button/dist/index-vars.css"
|
|
|
|
|
|
|
|
export let disabled = false
|
|
|
|
|
|
|
|
/** @type {('S', 'M', 'L', 'XL')} Size of button */
|
2021-04-15 22:50:56 +12:00
|
|
|
export let size = "M"
|
2021-04-10 01:21:51 +12:00
|
|
|
|
|
|
|
// Types
|
2021-04-15 22:50:56 +12:00
|
|
|
export let cta, primary, secondary, warning, overBackground
|
2021-04-09 04:04:03 +12:00
|
|
|
|
|
|
|
export let quiet = false
|
2021-03-31 22:59:07 +13:00
|
|
|
|
2021-04-15 22:50:56 +12:00
|
|
|
export let icon = undefined
|
|
|
|
</script>
|
2021-04-09 03:04:27 +12:00
|
|
|
|
2021-04-10 01:21:51 +12:00
|
|
|
<button
|
|
|
|
class:spectrum-Button--cta={cta}
|
|
|
|
class:spectrum-Button--primary={primary}
|
|
|
|
class:spectrum-Button--secondary={secondary}
|
|
|
|
class:spectrum-Button--warning={warning}
|
|
|
|
class:spectrum-Button--overBackground={overBackground}
|
|
|
|
class:spectrum-Button--quiet={quiet}
|
|
|
|
class="spectrum-Button spectrum-Button--size{size.toUpperCase()}"
|
|
|
|
{disabled}
|
|
|
|
on:click|preventDefault>
|
|
|
|
{#if icon}
|
2021-04-15 22:50:56 +12:00
|
|
|
<svg
|
|
|
|
class="spectrum-Icon spectrum-Icon--size{size.toUpperCase()}"
|
|
|
|
focusable="false"
|
|
|
|
aria-hidden="true"
|
|
|
|
aria-label={icon}>
|
2021-04-10 01:21:51 +12:00
|
|
|
<use xlink:href="#spectrum-icon-18-{icon}" />
|
|
|
|
</svg>
|
|
|
|
{/if}
|
2021-04-15 22:50:56 +12:00
|
|
|
{#if $$slots}
|
2021-04-09 03:04:27 +12:00
|
|
|
<span class="spectrum-Button-label"><slot /></span>
|
2021-04-10 01:21:51 +12:00
|
|
|
{/if}
|
|
|
|
</button>
|
2021-03-31 22:59:07 +13:00
|
|
|
|
|
|
|
<style>
|
2021-04-17 04:12:22 +12:00
|
|
|
.spectrum-Button-label {
|
|
|
|
white-space: nowrap;
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
}
|
2021-03-31 22:59:07 +13:00
|
|
|
</style>
|