This repository has been archived by the owner on Feb 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
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
1 parent
c0f27c0
commit 01e9b4f
Showing
7 changed files
with
114 additions
and
3 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
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,29 @@ | ||
<script lang="ts"> | ||
import { RangeSlider } from '$lib/components' | ||
import { FormField, type FormRangeSliderProps } from '.' | ||
type $$Props = FormRangeSliderProps | ||
export let color: $$Props['color'] = undefined | ||
export let options: $$Props['options'] | ||
export let cssPrefix: $$Props['cssPrefix'] = 'form-range-slider' | ||
export let inline: $$Props['inline'] = undefined | ||
export let description: $$Props['description'] = undefined | ||
export let value: $$Props['value'] = undefined | ||
$: rangeSliderProps = { | ||
color, | ||
inline, | ||
description, | ||
options, | ||
} | ||
</script> | ||
|
||
<FormField {...$$restProps} {cssPrefix}> | ||
<slot name="label" /> | ||
<RangeSlider {...rangeSliderProps} bind:value {options}> | ||
<slot /> | ||
</RangeSlider> | ||
<slot name="hint" /> | ||
</FormField> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script> | ||
import { Doc, Preview } from '$lib/components' | ||
import FormRangeSliderDefault from './FormRangeSliderDefault.svelte' | ||
</script> | ||
|
||
<h1>Form Range Slider</h1> | ||
<p> | ||
The base component that is used for Range Slider is <a | ||
href="https://refreshless.com/nouislider/" | ||
target="_blank" | ||
rel="noreferrer">noUiSlider</a> you can read about options and details in the documentaion website. | ||
</p> | ||
|
||
<Doc title="Defaults" /> | ||
<Preview src="./FormRangeSliderDefault.svelte"> | ||
<FormRangeSliderDefault /> | ||
</Preview> |
48 changes: 48 additions & 0 deletions
48
src/routes/docs/form/form-range-slider/FormRangeSliderDefault.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 { El, FormRangeSlider } from '@ubeac/svelte' | ||
import type { Options } from 'nouislider' | ||
let value1: any | ||
let value2: any | ||
let format = { | ||
to: function (val: any) { | ||
return parseInt(val) | ||
}, | ||
from: function (val: any) { | ||
return parseInt(val) | ||
}, | ||
} | ||
let options1: Options = { | ||
range: { | ||
min: 10, | ||
max: 100, | ||
}, | ||
step: 10, | ||
start: [40], | ||
direction: 'ltr', | ||
behaviour: 'tap-drag', | ||
tooltips: true, | ||
format: format, | ||
} | ||
let options2: Options = { | ||
range: { | ||
min: 10, | ||
max: 100, | ||
}, | ||
start: [20, 70], | ||
step: 1, | ||
direction: 'ltr', | ||
behaviour: 'tap-drag', | ||
connect: true, | ||
format: format, | ||
} | ||
</script> | ||
|
||
<FormRangeSlider color="primary" bind:value={value1} options={options1} label="Zoom(X)" /> | ||
<El>Value: {value1}</El> | ||
|
||
<FormRangeSlider options={options2} bind:value={value2} label="Distance Range" /> | ||
<El>Values: {value2}</El> |
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