Fix a couple <Disclosure> mistakes
* Incorrect error messages from <DisclosurePanel> * Not using buttonId correctly (don't think this had any practical impact though)
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { useDisclosureContext, DisclosureStates } from "./Disclosure.svelte";
|
||||
import { usePanelContext } from "./DisclosurePanel.svelte";
|
||||
import { useId } from "$lib/hooks/use-id";
|
||||
import { Keys } from "$lib/utils/keyboard";
|
||||
import { forwardEventsBuilder } from "$lib/internal/forwardEventsBuilder";
|
||||
import { get_current_component } from "svelte/internal";
|
||||
@@ -18,7 +17,6 @@
|
||||
export let disabled = false;
|
||||
const api = useDisclosureContext("DisclosureButton");
|
||||
const panelContext = usePanelContext();
|
||||
const id = `headlessui-disclosure-button-${useId()}`;
|
||||
|
||||
$: buttonStore = $api.buttonStore;
|
||||
$: panelStore = $api.panelStore;
|
||||
@@ -82,7 +80,7 @@
|
||||
$: propsWeControl = isWithinPanel
|
||||
? { type }
|
||||
: {
|
||||
id,
|
||||
id: $api.buttonId,
|
||||
type,
|
||||
"aria-expanded": disabled
|
||||
? undefined
|
||||
|
||||
@@ -20,11 +20,10 @@
|
||||
export let as: SupportedAs = "div";
|
||||
export let use: HTMLActionArray = [];
|
||||
|
||||
const api = useDisclosureContext("DisclosureButton");
|
||||
$: id = $api.panelId;
|
||||
const api = useDisclosureContext("DisclosurePanel");
|
||||
let openClosedState = useOpenClosed();
|
||||
|
||||
setContext(DISCLOSURE_PANEL_CONTEXT_NAME, id);
|
||||
setContext(DISCLOSURE_PANEL_CONTEXT_NAME, $api.panelId);
|
||||
|
||||
$: panelStore = $api.panelStore;
|
||||
|
||||
@@ -33,7 +32,7 @@
|
||||
? $openClosedState === State.Open
|
||||
: $api.disclosureState === DisclosureStates.Open;
|
||||
|
||||
$: propsWeControl = { id };
|
||||
$: propsWeControl = { id: $api.panelId };
|
||||
|
||||
$: slotProps = {
|
||||
open: $api.disclosureState === DisclosureStates.Open,
|
||||
|
||||
Reference in New Issue
Block a user