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:
Ryan Gossiaux
2021-12-26 22:58:55 -08:00
parent d1940e5d16
commit 206b83963e
2 changed files with 4 additions and 7 deletions

View File

@@ -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,