-
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
2,185 additions
and
395 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
Bits UI | ||
================= | ||
The following is a list of sources from which code was used/modified in this codebase. | ||
|
||
------------------------------------------------------------------------------- | ||
This codebase contains a modified portion of code from Adobe which can be obtained at: | ||
* SOURCE: | ||
* https://www.npmjs.com/package/@react-aria/utils | ||
* LICENSE: | ||
* https://unpkg.com/@react-aria/utils@3.24.1/LICENSE | ||
|
||
* SOURCE: | ||
* https://www.npmjs.com/package/react-stately | ||
* LICENSE: | ||
* https://unpkg.com/react-stately@3.31.1/LICENSE | ||
|
||
------------------------------------------------------------------------------- | ||
|
||
This codebase contains a modified portion of code from Melt UI which can be obtained at: | ||
* SOURCE: | ||
* https://www.npmjs.com/package/@melt-ui/svelte | ||
* LICENSE: | ||
* https://unpkg.com/@melt-ui/svelte@0.76.2/LICENSE | ||
|
||
------------------------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/bits-ui/src/lib/bits/alert-dialog/components/alert-dialog-cancel.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
packages/bits-ui/src/lib/bits/listbox/components/listbox-content.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<script lang="ts"> | ||
import { box } from "svelte-toolbelt"; | ||
import type { ContentProps } from "../index.js"; | ||
import { useListboxContent } from "../listbox.svelte.js"; | ||
import { useId } from "$lib/internal/useId.svelte.js"; | ||
import { mergeProps } from "$lib/internal/mergeProps.js"; | ||
let { | ||
children, | ||
child, | ||
ref = $bindable(null), | ||
id = useId(), | ||
...restProps | ||
}: ContentProps = $props(); | ||
const contentState = useListboxContent({ | ||
id: box.with(() => id), | ||
ref: box.with( | ||
() => ref, | ||
(v) => (ref = v) | ||
), | ||
}); | ||
const mergedProps = $derived(mergeProps(restProps, contentState.props)); | ||
</script> | ||
|
||
{#if child} | ||
{@render child?.({ props: mergedProps })} | ||
{:else} | ||
<div {...mergedProps}> | ||
{@render children?.()} | ||
</div> | ||
{/if} |
33 changes: 33 additions & 0 deletions
33
packages/bits-ui/src/lib/bits/listbox/components/listbox-group-label.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<script lang="ts"> | ||
import { box } from "svelte-toolbelt"; | ||
import type { GroupLabelProps } from "../index.js"; | ||
import { useListboxGroupLabel } from "../listbox.svelte.js"; | ||
import { useId } from "$lib/internal/useId.svelte.js"; | ||
import { mergeProps } from "$lib/internal/mergeProps.js"; | ||
let { | ||
children, | ||
child, | ||
ref = $bindable(null), | ||
id = useId(), | ||
...restProps | ||
}: GroupLabelProps = $props(); | ||
const groupLabelState = useListboxGroupLabel({ | ||
id: box.with(() => id), | ||
ref: box.with( | ||
() => ref, | ||
(v) => (ref = v) | ||
), | ||
}); | ||
const mergedProps = $derived(mergeProps(restProps, groupLabelState.props)); | ||
</script> | ||
|
||
{#if child} | ||
{@render child?.({ props: mergedProps })} | ||
{:else} | ||
<div {...mergedProps}> | ||
{@render children?.()} | ||
</div> | ||
{/if} |
33 changes: 33 additions & 0 deletions
33
packages/bits-ui/src/lib/bits/listbox/components/listbox-group.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<script lang="ts"> | ||
import { box } from "svelte-toolbelt"; | ||
import type { GroupProps } from "../index.js"; | ||
import { useListboxGroup } from "../listbox.svelte.js"; | ||
import { useId } from "$lib/internal/useId.svelte.js"; | ||
import { mergeProps } from "$lib/internal/mergeProps.js"; | ||
let { | ||
children, | ||
child, | ||
id = useId(), | ||
ref = $bindable(null), | ||
...restProps | ||
}: GroupProps = $props(); | ||
const groupState = useListboxGroup({ | ||
id: box.with(() => id), | ||
ref: box.with( | ||
() => ref, | ||
(v) => (ref = v) | ||
), | ||
}); | ||
const mergedProps = $derived(mergeProps(restProps, groupState.props)); | ||
</script> | ||
|
||
{#if child} | ||
{@render child?.({ props: mergedProps })} | ||
{:else} | ||
<div {...mergedProps}> | ||
{@render children?.()} | ||
</div> | ||
{/if} |
48 changes: 48 additions & 0 deletions
48
packages/bits-ui/src/lib/bits/listbox/components/listbox-item.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<script lang="ts"> | ||
import { box } from "svelte-toolbelt"; | ||
import type { ItemProps } from "../index.js"; | ||
import { useListboxItem } from "../listbox.svelte.js"; | ||
import { useId } from "$lib/internal/useId.svelte.js"; | ||
import { mergeProps } from "$lib/internal/mergeProps.js"; | ||
let { | ||
children, | ||
child, | ||
id = useId(), | ||
ref = $bindable(null), | ||
value, | ||
disabled = false, | ||
label = "", | ||
...restProps | ||
}: ItemProps = $props(); | ||
const itemState = useListboxItem({ | ||
id: box.with(() => id), | ||
ref: box.with( | ||
() => ref, | ||
(v) => (ref = v) | ||
), | ||
value: box.with( | ||
() => value, | ||
(v) => { | ||
value = v; | ||
} | ||
), | ||
disabled: box.with(() => disabled), | ||
label: box.with(() => label), | ||
}); | ||
const mergedProps = $derived(mergeProps(restProps, itemState.props)); | ||
</script> | ||
|
||
{#if child} | ||
{@render child?.({ props: mergedProps, selected: itemState.isSelected })} | ||
{:else} | ||
<div {...mergedProps}> | ||
{#if children} | ||
{@render children?.({ selected: itemState.isSelected })} | ||
{:else if label} | ||
{label} | ||
{/if} | ||
</div> | ||
{/if} |
33 changes: 33 additions & 0 deletions
33
packages/bits-ui/src/lib/bits/listbox/components/listbox-label.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<script lang="ts"> | ||
import { box } from "svelte-toolbelt"; | ||
import type { LabelProps } from "../index.js"; | ||
import { useListboxLabel } from "../listbox.svelte.js"; | ||
import { useId } from "$lib/internal/useId.svelte.js"; | ||
import { mergeProps } from "$lib/internal/mergeProps.js"; | ||
let { | ||
children, | ||
child, | ||
ref = $bindable(null), | ||
id = useId(), | ||
...restProps | ||
}: LabelProps = $props(); | ||
const labelState = useListboxLabel({ | ||
id: box.with(() => id), | ||
ref: box.with( | ||
() => ref, | ||
(v) => (ref = v) | ||
), | ||
}); | ||
const mergedProps = $derived(mergeProps(restProps, labelState.props)); | ||
</script> | ||
|
||
{#if child} | ||
{@render child?.({ props: mergedProps })} | ||
{:else} | ||
<div {...mergedProps}> | ||
{@render children?.()} | ||
</div> | ||
{/if} |
Oops, something went wrong.