|
|
@ -7,12 +7,14 @@ |
|
|
import clickOutside from "../../Actions/click_outside" |
|
|
import clickOutside from "../../Actions/click_outside" |
|
|
import Search from "./Search.svelte" |
|
|
import Search from "./Search.svelte" |
|
|
import Icon from "../../Icon/Icon.svelte" |
|
|
import Icon from "../../Icon/Icon.svelte" |
|
|
|
|
|
import StatusLight from "../../StatusLight/StatusLight.svelte" |
|
|
|
|
|
|
|
|
export let id = null |
|
|
export let id = null |
|
|
export let disabled = false |
|
|
export let disabled = false |
|
|
export let error = null |
|
|
export let error = null |
|
|
export let fieldText = "" |
|
|
export let fieldText = "" |
|
|
export let fieldIcon = "" |
|
|
export let fieldIcon = "" |
|
|
|
|
|
export let fieldColour = "" |
|
|
export let isPlaceholder = false |
|
|
export let isPlaceholder = false |
|
|
export let placeholderOption = null |
|
|
export let placeholderOption = null |
|
|
export let options = [] |
|
|
export let options = [] |
|
|
@ -21,6 +23,7 @@ |
|
|
export let getOptionLabel = option => option |
|
|
export let getOptionLabel = option => option |
|
|
export let getOptionValue = option => option |
|
|
export let getOptionValue = option => option |
|
|
export let getOptionIcon = () => null |
|
|
export let getOptionIcon = () => null |
|
|
|
|
|
export let getOptionColour = () => null |
|
|
export let open = false |
|
|
export let open = false |
|
|
export let readonly = false |
|
|
export let readonly = false |
|
|
export let quiet = false |
|
|
export let quiet = false |
|
|
@ -83,11 +86,10 @@ |
|
|
on:mousedown={onClick} |
|
|
on:mousedown={onClick} |
|
|
> |
|
|
> |
|
|
{#if fieldIcon} |
|
|
{#if fieldIcon} |
|
|
<span class="icon-Placeholder-Padding"> |
|
|
<span class="option-icon"> |
|
|
<Icon name={fieldIcon} /> |
|
|
<Icon name={fieldIcon} /> |
|
|
</span> |
|
|
</span> |
|
|
{/if} |
|
|
{/if} |
|
|
|
|
|
|
|
|
<span |
|
|
<span |
|
|
class="spectrum-Picker-label" |
|
|
class="spectrum-Picker-label" |
|
|
class:is-placeholder={isPlaceholder} |
|
|
class:is-placeholder={isPlaceholder} |
|
|
@ -105,6 +107,11 @@ |
|
|
<use xlink:href="#spectrum-icon-18-Alert" /> |
|
|
<use xlink:href="#spectrum-icon-18-Alert" /> |
|
|
</svg> |
|
|
</svg> |
|
|
{/if} |
|
|
{/if} |
|
|
|
|
|
{#if fieldColour} |
|
|
|
|
|
<span class="option-colour"> |
|
|
|
|
|
<StatusLight custom color={fieldColour} /> |
|
|
|
|
|
</span> |
|
|
|
|
|
{/if} |
|
|
<svg |
|
|
<svg |
|
|
class="spectrum-Icon spectrum-UIIcon-ChevronDown100 spectrum-Picker-menuIcon" |
|
|
class="spectrum-Icon spectrum-UIIcon-ChevronDown100 spectrum-Picker-menuIcon" |
|
|
focusable="false" |
|
|
focusable="false" |
|
|
@ -159,7 +166,7 @@ |
|
|
on:click={() => onSelectOption(getOptionValue(option, idx))} |
|
|
on:click={() => onSelectOption(getOptionValue(option, idx))} |
|
|
> |
|
|
> |
|
|
{#if getOptionIcon(option, idx)} |
|
|
{#if getOptionIcon(option, idx)} |
|
|
<span class="icon-Padding"> |
|
|
<span class="option-icon"> |
|
|
<Icon name={getOptionIcon(option, idx)} /> |
|
|
<Icon name={getOptionIcon(option, idx)} /> |
|
|
</span> |
|
|
</span> |
|
|
{/if} |
|
|
{/if} |
|
|
@ -173,6 +180,11 @@ |
|
|
> |
|
|
> |
|
|
<use xlink:href="#spectrum-css-icon-Checkmark100" /> |
|
|
<use xlink:href="#spectrum-css-icon-Checkmark100" /> |
|
|
</svg> |
|
|
</svg> |
|
|
|
|
|
{#if getOptionColour(option, idx)} |
|
|
|
|
|
<span class="option-colour"> |
|
|
|
|
|
<StatusLight custom color={getOptionColour(option, idx)} /> |
|
|
|
|
|
</span> |
|
|
|
|
|
{/if} |
|
|
</li> |
|
|
</li> |
|
|
{/each} |
|
|
{/each} |
|
|
{/if} |
|
|
{/if} |
|
|
@ -208,12 +220,18 @@ |
|
|
padding-right: 2px; |
|
|
padding-right: 2px; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.icon-Padding { |
|
|
/* Icon and colour alignment */ |
|
|
padding-right: 10px; |
|
|
.spectrum-Menu-checkmark { |
|
|
|
|
|
align-self: center; |
|
|
|
|
|
margin-top: 0; |
|
|
|
|
|
} |
|
|
|
|
|
.option-colour { |
|
|
|
|
|
padding-left: 8px; |
|
|
} |
|
|
} |
|
|
.icon-Placeholder-Padding { |
|
|
.option-icon { |
|
|
padding-right: 10px; |
|
|
padding-right: 8px; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
.spectrum-Popover :global(.spectrum-Search) { |
|
|
.spectrum-Popover :global(.spectrum-Search) { |
|
|
margin-top: -1px; |
|
|
margin-top: -1px; |
|
|
margin-left: -1px; |
|
|
margin-left: -1px; |
|
|
|