-
-
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
21 changed files
with
1,203 additions
and
394 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
31 changes: 0 additions & 31 deletions
31
packages/bits-ui/src/lib/bits/slider/components/slider-input.svelte
This file was deleted.
Oops, something went wrong.
42 changes: 24 additions & 18 deletions
42
packages/bits-ui/src/lib/bits/slider/components/slider-range.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 |
---|---|---|
@@ -1,26 +1,32 @@ | ||
<script lang="ts"> | ||
import { melt } from "@melt-ui/svelte"; | ||
import { getCtx } from "../ctx.js"; | ||
import { box } from "svelte-toolbelt"; | ||
import type { RangeProps } from "../index.js"; | ||
import { useSliderRange } from "../slider.svelte.js"; | ||
import { useId } from "$lib/internal/useId.svelte.js"; | ||
import { mergeProps } from "$lib/internal/mergeProps.js"; | ||
type $$Props = RangeProps; | ||
let { | ||
children, | ||
child, | ||
ref = $bindable(null), | ||
id = useId(), | ||
...restProps | ||
}: RangeProps = $props(); | ||
export let asChild: $$Props["asChild"] = false; | ||
export let el: $$Props["el"] = undefined; | ||
const { | ||
elements: { range }, | ||
getAttrs, | ||
} = getCtx(); | ||
const attrs = getAttrs("range"); | ||
$: builder = $range; | ||
$: Object.assign(builder, attrs); | ||
const rangeState = useSliderRange({ | ||
id: box.with(() => id), | ||
ref: box.with( | ||
() => ref, | ||
(v) => (ref = v) | ||
), | ||
}); | ||
const mergedProps = $derived(mergeProps(restProps, rangeState.props)); | ||
</script> | ||
|
||
{#if asChild} | ||
<slot {builder} /> | ||
{#if child} | ||
{@render child?.({ props: mergedProps })} | ||
{:else} | ||
<span bind:this={ref} use:melt={builder} {...$$restProps} /> | ||
<span {...mergedProps}> | ||
{@render children?.()} | ||
</span> | ||
{/if} |
48 changes: 29 additions & 19 deletions
48
packages/bits-ui/src/lib/bits/slider/components/slider-thumb.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 |
---|---|---|
@@ -1,27 +1,37 @@ | ||
<script lang="ts"> | ||
import { melt } from "@melt-ui/svelte"; | ||
import { getCtx } from "../ctx.js"; | ||
import type { ThumbEvents, ThumbProps } from "../index.js"; | ||
import { createDispatcher } from "$lib/internal/events.js"; | ||
import { box } from "svelte-toolbelt"; | ||
import type { ThumbProps } from "../index.js"; | ||
import { useSliderThumb } from "../slider.svelte.js"; | ||
import { useId } from "$lib/internal/useId.svelte.js"; | ||
import { mergeProps } from "$lib/internal/mergeProps.js"; | ||
type $$Props = ThumbProps; | ||
type $$Events = ThumbEvents; | ||
let { | ||
children, | ||
child, | ||
ref = $bindable(null), | ||
id = useId(), | ||
index, | ||
disabled = false, | ||
...restProps | ||
}: ThumbProps = $props(); | ||
export let asChild: $$Props["asChild"] = false; | ||
export let el: $$Props["el"] = undefined; | ||
export let thumb: $$Props["thumb"]; | ||
const thumbState = useSliderThumb({ | ||
id: box.with(() => id), | ||
ref: box.with( | ||
() => ref, | ||
(v) => (ref = v) | ||
), | ||
index: box.with(() => index), | ||
disabled: box.with(() => disabled), | ||
}); | ||
const { getAttrs } = getCtx(); | ||
const dispatch = createDispatcher(); | ||
const attrs = getAttrs("thumb"); | ||
$: builder = thumb; | ||
$: Object.assign(builder, attrs); | ||
const mergedProps = $derived(mergeProps(restProps, thumbState.props)); | ||
</script> | ||
|
||
{#if asChild} | ||
<slot {builder} /> | ||
{#if child} | ||
{@render child?.({ props: mergedProps })} | ||
{:else} | ||
<span bind:this={ref} use:melt={builder} {...$$restProps} on:m-keydown={dispatch} /> | ||
<span {...mergedProps}> | ||
{@render children?.()} | ||
</span> | ||
{/if} |
39 changes: 24 additions & 15 deletions
39
packages/bits-ui/src/lib/bits/slider/components/slider-tick.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 |
---|---|---|
@@ -1,24 +1,33 @@ | ||
<script lang="ts"> | ||
import { melt } from "@melt-ui/svelte"; | ||
import { getCtx } from "../ctx.js"; | ||
import { box } from "svelte-toolbelt"; | ||
import type { TickProps } from "../index.js"; | ||
import { useSliderTick } from "../slider.svelte.js"; | ||
import { useId } from "$lib/internal/useId.svelte.js"; | ||
import { mergeProps } from "$lib/internal/mergeProps.js"; | ||
type $$Props = TickProps; | ||
let { | ||
children, | ||
child, | ||
ref = $bindable(null), | ||
id = useId(), | ||
index, | ||
...restProps | ||
}: TickProps = $props(); | ||
export let asChild: $$Props["asChild"] = false; | ||
export let el: $$Props["el"] = undefined; | ||
export let tick: $$Props["tick"]; | ||
const tickState = useSliderTick({ | ||
id: box.with(() => id), | ||
ref: box.with( | ||
() => ref, | ||
(v) => (ref = v) | ||
), | ||
index: box.with(() => index), | ||
}); | ||
const { getAttrs } = getCtx(); | ||
const attrs = getAttrs("tick"); | ||
$: builder = tick; | ||
$: Object.assign(builder, attrs); | ||
const mergedProps = $derived(mergeProps(restProps, tickState.props)); | ||
</script> | ||
|
||
{#if asChild} | ||
<slot {builder} /> | ||
{#if child} | ||
{@render child?.({ props: mergedProps })} | ||
{:else} | ||
<span bind:this={ref} use:melt={builder} {...$$restProps} /> | ||
<span {...mergedProps}>{@render children?.()}</span> | ||
{/if} |
Oops, something went wrong.