Skip to content

Commit

Permalink
fix(slider): add tooltip stop
Browse files Browse the repository at this point in the history
  • Loading branch information
koory1st committed Jan 28, 2024
1 parent 74c683f commit e5e7c66
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/slider/src/lib/button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
export let showTooltip = true;
export let formatTooltip = null;
$: tooltipValue = formatTooltip ? formatTooltip(value) : value;
/** @type {'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end'} */
export let placement = 'top';
let button;
$: hovering = false;
Expand Down Expand Up @@ -183,7 +185,7 @@

<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
<!-- svelte-ignore a11y-no-static-element-interactions -->
<SvelTooltip bind:updatePopper content={tooltipValue} placement="top" visible={tooltipVisible}>
<SvelTooltip bind:updatePopper content={tooltipValue} {placement} visible={tooltipVisible}>
<div
bind:this={button}
class={wrapperClass}
Expand Down
4 changes: 4 additions & 0 deletions packages/slider/src/lib/slider.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
let slider;
let firstButton;
export let formatTooltip = null;
/** @type {'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end'} */
export let placement = 'top';
onMount(async () => {
if (range) {
Expand Down Expand Up @@ -262,6 +264,7 @@
bind:value={firstValue}
disabled={sliderDisabled}
{formatTooltip}
{placement}
{resetSize}
{showTooltip}
{sliderSize}
Expand All @@ -288,6 +291,7 @@
{vertical}
{showTooltip}
{formatTooltip}
{placement}
/>
{/if}
{#if showStops}
Expand Down

0 comments on commit e5e7c66

Please sign in to comment.