@invopop/popui 0.0.100 → 0.0.101
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
<script>import { createEventDispatcher } from "svelte";
|
|
2
|
-
|
|
2
|
+
export let id = Math.random().toString(36).slice(2, 7);
|
|
3
3
|
export let checked = false;
|
|
4
4
|
export let indeterminate = false;
|
|
5
|
+
export let label = "";
|
|
5
6
|
const dispatch = createEventDispatcher();
|
|
6
7
|
function updateInput(event) {
|
|
7
|
-
if (event instanceof CustomEvent)
|
|
8
|
-
return;
|
|
9
8
|
const target = event.target;
|
|
10
9
|
checked = target.checked;
|
|
11
10
|
dispatch("change", checked);
|
|
12
|
-
dispatchWcEvent(target, "change", checked);
|
|
13
11
|
}
|
|
14
12
|
</script>
|
|
15
13
|
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
<label
|
|
15
|
+
for={id}
|
|
16
|
+
class="inline-flex items-center space-x-2 cursor-pointer group text-base text-neutral-800"
|
|
17
|
+
>
|
|
18
|
+
<input
|
|
19
|
+
{id}
|
|
20
|
+
type="checkbox"
|
|
21
|
+
{checked}
|
|
22
|
+
{indeterminate}
|
|
23
|
+
class="form-checkbox w-4 h-4 text-workspace-accent focus:text-workspace-accent rounded border border-neutral-200 hover:border-neutral-300 group-hover:border-neutral-300 focus:ring-0 focus:ring-offset-0"
|
|
24
|
+
{...$$restProps}
|
|
25
|
+
on:change={updateInput}
|
|
26
|
+
on:click|stopPropagation
|
|
27
|
+
/>
|
|
28
|
+
{#if label}
|
|
29
|
+
<span>{label}</span>
|
|
30
|
+
{/if}
|
|
31
|
+
</label>
|
|
@@ -2,8 +2,10 @@ import { SvelteComponent } from "svelte";
|
|
|
2
2
|
declare const __propDef: {
|
|
3
3
|
props: {
|
|
4
4
|
[x: string]: any;
|
|
5
|
+
id?: string | undefined;
|
|
5
6
|
checked?: boolean | undefined;
|
|
6
7
|
indeterminate?: boolean | undefined;
|
|
8
|
+
label?: string | undefined;
|
|
7
9
|
};
|
|
8
10
|
events: {
|
|
9
11
|
click: MouseEvent;
|