Initial commit with files

Still need to fix the imports
This commit is contained in:
Ryan Gossiaux
2021-12-13 17:13:47 -08:00
parent 42aba8a158
commit db9ec57065
56 changed files with 4034 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
<script lang="ts" context="module">
export interface LabelContext {
name?: string;
props?: object;
register: (value: string) => void;
labelIds?: string;
}
</script>
<script lang="ts">
import { setContext } from "svelte";
import { writable, Writable } from "svelte/store";
export let name: string;
let labelIds = [];
let contextStore: Writable<LabelContext> = writable({
name,
register,
props: $$restProps,
});
setContext("headlessui-label-context", contextStore);
$: contextStore.set({
name,
props: $$restProps,
register,
labelIds: labelIds.length > 0 ? labelIds.join(" ") : undefined,
});
function register(value: string) {
labelIds = [...labelIds, value];
return () => {
labelIds = labelIds.filter((labelId) => labelId !== value);
};
}
</script>
<slot labelledby={$contextStore.labelIds} />