Skip to content

Commit

Permalink
feat: added showTooltip attr
Browse files Browse the repository at this point in the history
  • Loading branch information
pkc918 committed Jan 5, 2024
1 parent c0091ae commit 095caba
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions components/Slider/src/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
export let vertical: KSliderProps['vertical'] = false;
export let attrs: KSliderProps['attrs'] = {};
export let cls: KSliderProps['cls'] = undefined;
export let showTooltip: KSliderProps['showTooltip'] = true;
/*********************** KForm logic start ************************/
let disabledFrom = false;
Expand Down Expand Up @@ -193,13 +194,13 @@
style={btnStyle}
>
{#if $$slots.buttonRender}
<KTooltip placement="top" content={String(value)}>
<KTooltip disabled={!showTooltip} placement="top" content={String(value)}>
<div slot="triggerEl" class={buttonCls}>
<slot name="buttonRender" />
</div>
</KTooltip>
{:else}
<KTooltip placement="top" content={String(value)}>
<KTooltip disabled={!showTooltip} placement="top" content={String(value)}>
<div slot="triggerEl" class={buttonCls}></div>
</KTooltip>
{/if}
Expand Down
1 change: 1 addition & 0 deletions components/Slider/src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export type KSliderProps = {
step: number;
disabled: boolean;
vertical: boolean;
showTooltip: boolean;
cls: ClassValue;
attrs: Record<string, string>;
};
2 changes: 1 addition & 1 deletion docs/example/slider/basic.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</script>

<div>
<KSlider on:input={handleInput1} value={value1}></KSlider>
<KSlider showTooltip={false} on:input={handleInput1} value={value1}></KSlider>
<p class="px-2">value: {value1}</p>
</div>

Expand Down

0 comments on commit 095caba

Please sign in to comment.