Skip to content

Commit

Permalink
update to latest melt version / APIs (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
huntabyte authored Oct 18, 2023
1 parent 10204a9 commit 4c9aca7
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 47 deletions.
5 changes: 5 additions & 0 deletions .changeset/dull-rabbits-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"bits-ui": minor
---

- update to the latest Melt UI version
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"types": "./dist/index.d.ts",
"type": "module",
"dependencies": {
"@melt-ui/svelte": "0.41.3",
"@melt-ui/svelte": "0.55.2",
"nanoid": "^4.0.2"
},
"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.

10 changes: 5 additions & 5 deletions src/lib/bits/select/components/SelectContent.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
transition:transition={transitionConfig}
use:melt={builder}
{...$$restProps}
on:m-keydown={dispatch}
on:m-pointerleave={dispatch}
>
<slot {builder} />
</div>
Expand All @@ -49,7 +49,7 @@
out:outTransition={outTransitionConfig}
use:melt={builder}
{...$$restProps}
on:m-keydown={dispatch}
on:m-pointerleave={dispatch}
>
<slot {builder} />
</div>
Expand All @@ -59,7 +59,7 @@
in:inTransition={inTransitionConfig}
use:melt={builder}
{...$$restProps}
on:m-keydown={dispatch}
on:m-pointerleave={dispatch}
>
<slot {builder} />
</div>
Expand All @@ -69,13 +69,13 @@
out:outTransition={outTransitionConfig}
use:melt={builder}
{...$$restProps}
on:m-keydown={dispatch}
on:m-pointerleave={dispatch}
>
<slot {builder} />
</div>
{:else if $open}
{@const builder = $menu}
<div use:melt={builder} {...$$restProps} on:m-keydown={dispatch}>
<div use:melt={builder} {...$$restProps} on:m-pointerleave={dispatch}>
<slot {builder} />
</div>
{/if}
2 changes: 1 addition & 1 deletion src/lib/bits/select/components/SelectInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
type $$Props = InputProps;
export let asChild = false;
const input = ctx.get().elements.input;
const input = ctx.get().elements.hiddenInput;
</script>

{#if asChild}
Expand Down
11 changes: 1 addition & 10 deletions src/lib/bits/select/components/SelectItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,7 @@
<slot builder={$option({ value, disabled, label })} />
{:else}
{@const builder = $option({ value, disabled, label })}
<div
use:melt={builder}
{...$$restProps}
on:m-click={dispatch}
on:m-focusin={dispatch}
on:m-focusout={dispatch}
on:m-keydown={dispatch}
on:m-pointerleave={dispatch}
on:m-pointermove={dispatch}
>
<div use:melt={builder} {...$$restProps} on:m-click={dispatch} on:m-pointermove={dispatch}>
<slot {builder}>
{label ? label : value}
</slot>
Expand Down
15 changes: 0 additions & 15 deletions src/lib/bits/select/components/SelectSeparator.svelte

This file was deleted.

2 changes: 1 addition & 1 deletion src/lib/bits/select/ctx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ function getItemIndicator() {

function setArrow(size = 8) {
const select = get();
select.options.arrowSize.set(size);
select.options.arrowSize?.set(size);
return select;
}
2 changes: 1 addition & 1 deletion src/lib/bits/select/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Input from "./components/SelectInput.svelte";
import Item from "./components/SelectItem.svelte";
import ItemIndicator from "./components/SelectItemIndicator.svelte";
import Label from "./components/SelectLabel.svelte";
import Separator from "./components/SelectSeparator.svelte";
import Separator from "../separator/components/Separator.svelte";
import Trigger from "./components/SelectTrigger.svelte";
import Value from "./components/SelectValue.svelte";

Expand Down
8 changes: 2 additions & 6 deletions src/lib/bits/select/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,7 @@ type ArrowProps = Expand<

type ItemEvents<T extends Element = HTMLDivElement> = {
click: CustomEventHandler<MouseEvent, T>;
keydown: CustomEventHandler<KeyboardEvent, T>;
focusin: CustomEventHandler<FocusEvent, T>;
focusout: CustomEventHandler<FocusEvent, T>;
pointerleave: CustomEventHandler<MouseEvent, T>;
pointermove: CustomEventHandler<MouseEvent, T>;
pointermove: CustomEventHandler<PointerEvent, T>;
};

type TriggerEvents<T extends Element = HTMLButtonElement> = {
Expand All @@ -66,7 +62,7 @@ type LabelEvents<T extends Element = HTMLSpanElement> = {
click: CustomEventHandler<MouseEvent, T>;
};
type ContentEvents<T extends Element = HTMLDivElement> = {
keydown: CustomEventHandler<KeyboardEvent, T>;
pointerleave: CustomEventHandler<PointerEvent, T>;
};

export type {
Expand Down

0 comments on commit 4c9aca7

Please sign in to comment.