2021-05-22 12:32:32 +03:00
|
|
|
<script>
|
|
|
|
|
export let label;
|
|
|
|
|
export let value;
|
|
|
|
|
export let checked;
|
|
|
|
|
export let name;
|
2021-06-21 19:21:43 +03:00
|
|
|
export let isEditable = false;
|
2021-07-06 08:39:17 +03:00
|
|
|
export let disabled = false;
|
2021-07-22 08:04:48 +03:00
|
|
|
export let className = '';
|
2021-05-22 12:32:32 +03:00
|
|
|
</script>
|
|
|
|
|
|
2021-07-06 08:39:17 +03:00
|
|
|
<label
|
2021-07-22 08:04:48 +03:00
|
|
|
class="{className} inline-flex items-center w-full {disabled
|
2021-07-06 08:39:17 +03:00
|
|
|
? 'cursor-not-allowed'
|
|
|
|
|
: 'cursor-pointer'}"
|
|
|
|
|
>
|
2021-05-22 12:32:32 +03:00
|
|
|
<input
|
|
|
|
|
type="checkbox"
|
|
|
|
|
class="rounded border-gray-300 text-indigo-600 shadow-sm focus:border-indigo-300 focus:ring focus:ring-offset-0 focus:ring-indigo-200 focus:ring-opacity-50"
|
|
|
|
|
{name}
|
|
|
|
|
{value}
|
2021-07-06 08:39:17 +03:00
|
|
|
disabled={disabled || isEditable}
|
2021-05-22 12:32:32 +03:00
|
|
|
bind:checked
|
|
|
|
|
/>
|
2021-06-21 19:21:43 +03:00
|
|
|
{#if isEditable}
|
|
|
|
|
<input
|
|
|
|
|
class="form-input p-2 mt-1 ml-1 block w-2/4 bg-gray-100 border-t-0 border-l-0 border-r-0 border-b-1"
|
|
|
|
|
type="text"
|
|
|
|
|
placeholder="Your option"
|
|
|
|
|
bind:value={label}
|
|
|
|
|
/>
|
|
|
|
|
{:else}
|
|
|
|
|
<span class="ml-2">{label}</span>
|
|
|
|
|
{/if}
|
|
|
|
|
|
|
|
|
|
<slot name="iconbutton" />
|
2021-05-22 12:32:32 +03:00
|
|
|
</label>
|