Skip to content

Commit

Permalink
fix: update melt & select/combo docs (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
huntabyte authored Feb 22, 2024
1 parent 5a92cd7 commit bc0560c
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/quiet-starfishes-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"bits-ui": patch
---

Floating/Modal Components: improve handling of interact outside events
5 changes: 5 additions & 0 deletions .changeset/sweet-forks-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"bits-ui": patch
---

Dialogs: Fix bug where dragging outside of dialog would close it
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"type": "module",
"dependencies": {
"@internationalized/date": "^3.5.1",
"@melt-ui/svelte": "0.71.2",
"@melt-ui/svelte": "0.74.2",
"nanoid": "^5.0.5"
},
"peerDependencies": {
Expand Down
14 changes: 7 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/content/api-reference/combobox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ export const item: APISchema<Combobox.ItemProps> = {
name: "disabled",
description: "Present when the item is disabled.",
},
{
name: "highlighted",
description: "Present when the item is highlighted, via keyboard navigation or hover.",
},
{
name: "combobox-item",
description: "Present on the item element.",
Expand Down
4 changes: 4 additions & 0 deletions src/content/api-reference/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ export const item: APISchema<Select.ItemProps> = {
value: enums("selected", "hovered"),
isEnum: true,
},
{
name: "highlighted",
description: "Present when the item is highlighted, via keyboard navigation or hover.",
},
{
name: "disabled",
description: "Present when the item is disabled.",
Expand Down
3 changes: 3 additions & 0 deletions src/tests/combobox/Combobox.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import ComboboxTest from "./ComboboxTest.svelte";
import type { Item } from "./ComboboxTest.svelte";
import { getTestKbd } from "../utils.js";
import type { Combobox } from "$lib";
import { sleep } from "$lib/internal";

const kbd = getTestKbd();

Expand Down Expand Up @@ -133,7 +134,9 @@ describe("Combobox", () => {
it("closes on outside click", async () => {
const { user, queryByTestId, getByTestId } = await open();
const outside = getByTestId("outside");
await sleep(100);
await user.click(outside);
await sleep(100);
expect(queryByTestId("content")).toBeNull();
});

Expand Down
4 changes: 4 additions & 0 deletions src/tests/popover/Popover.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { describe, it } from "vitest";
import { getTestKbd } from "../utils.js";
import PopoverTest from "./PopoverTest.svelte";
import type { Popover } from "$lib";
import { sleep } from "$lib/internal/sleep.js";

const kbd = getTestKbd();

Expand Down Expand Up @@ -67,7 +68,10 @@ describe("Popover", () => {
it("closes on outside click", async () => {
const { user, queryByTestId, getByTestId } = await open();
const outside = getByTestId("outside");
await sleep(100);
await user.click(outside);
await sleep(100);

expect(queryByTestId("content")).toBeNull();
});

Expand Down
3 changes: 3 additions & 0 deletions src/tests/select/Select.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import SelectTest from "./SelectTest.svelte";
import type { Item } from "./SelectTest.svelte";
import { getTestKbd } from "../utils.js";
import type { Select } from "$lib";
import { sleep } from "$lib/internal";

const kbd = getTestKbd();

Expand Down Expand Up @@ -130,7 +131,9 @@ describe("Select", () => {
it("closes on outside click", async () => {
const { user, queryByTestId, getByTestId } = await open();
const outside = getByTestId("outside");
await sleep(100);
await user.click(outside);
await sleep(100);
expect(queryByTestId("content")).toBeNull();
});

Expand Down

0 comments on commit bc0560c

Please sign in to comment.