Standardize event names to be consistent with @headlessui-react

Was previously using Vue names since Vue was the primary reference while porting, but as the public API is closer to the React one it makes sense to use that.

Fixes #8
This commit is contained in:
Ryan Gossiaux
2021-12-19 00:28:09 -08:00
parent 63d44e125c
commit 8e890b2e80
9 changed files with 13 additions and 18 deletions

View File

@@ -36,9 +36,9 @@
<div class="space-y-1">
<Listbox
value={active}
on:updateValue={(event) => {
console.log("value:", event.detail.value);
active = event.detail.value;
on:change={(event) => {
console.log("value:", event.detail);
active = event.detail;
}}
>
<ListboxLabel class="block text-sm font-medium leading-5 text-gray-700">

View File

@@ -7,8 +7,6 @@
ListboxOptions,
} from "$lib";
import { onMount } from "svelte";
function classNames(
...classes: (false | null | undefined | string)[]
): string {
@@ -36,8 +34,8 @@
<div class="space-y-1">
<Listbox
value={active}
on:updateValue={(event) => {
active = event.detail.value;
on:change={(event) => {
active = event.detail;
}}
>
<ListboxLabel class="block text-sm font-medium leading-5 text-gray-700">

View File

@@ -20,15 +20,12 @@
description: "You are the only one able to access this project",
},
];
let active;
let active: typeof access[number];
</script>
<div class="p-12 max-w-xl">
<a href="/">Link before</a>
<RadioGroup
value={active}
on:updateValue={(event) => (active = event.detail)}
>
<RadioGroup value={active} on:change={(event) => (active = event.detail)}>
<fieldset class="space-y-4">
<legend>
<h2 class="text-xl">Privacy setting</h2>

View File

@@ -15,7 +15,7 @@
<Switch
as="button"
checked={state}
on:updateValue={(event) => (state = event.detail)}
on:change={(event) => (state = event.detail)}
class={({ checked }) =>
classNames(
"relative inline-flex flex-shrink-0 h-6 border-2 border-transparent rounded-full cursor-pointer w-11 focus:outline-none focus:shadow-outline transition-colors ease-in-out duration-200",

View File

@@ -33,7 +33,7 @@
<Switch
as="button"
checked={manual}
on:updateValue={(event) => (manual = event.detail)}
on:change={(event) => (manual = event.detail)}
class={({ checked }) =>
classNames(
"relative inline-flex flex-shrink-0 h-6 border-2 border-transparent rounded-full cursor-pointer w-11 focus:outline-none focus:shadow-outline transition-colors ease-in-out duration-200",