Skip to content

Commit bab15a5

Browse files
committed
[fix](@svelteui/core): fix no pointer events in Input right section
ISSUES CLOSED: #446
1 parent cba20e2 commit bab15a5

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

packages/svelteui-core/src/components/Input/Input.stories.svelte

+9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { Meta, Template, Story } from '@storybook/addon-svelte-csf';
33
import { Input } from './index';
44
import { EnvelopeClosed } from 'radix-icons-svelte';
5+
import { Button } from '../Button';
56
67
let value = 'Hello';
78
let valueNumber = 0;
@@ -38,3 +39,11 @@
3839
</svelte:fragment>
3940
</Input>
4041
</Story>
42+
43+
<Story name="With right section" id="inputRightSectionStory">
44+
<Input bind:value>
45+
<svelte:fragment slot="rightSection">
46+
<Button on:click={() => console.log('heelo')} />
47+
</svelte:fragment>
48+
</Input>
49+
</Story>

packages/svelteui-core/src/components/Input/Input.styles.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,10 @@ export default createStyles(
236236
display: 'flex',
237237
alignItems: 'center',
238238
justifyContent: 'center',
239-
pointerEvents: 'none',
240239
width: rightSectionWidth
240+
},
241+
noPointerEvents: {
242+
pointerEvents: 'none'
241243
}
242244
};
243245
}

packages/svelteui-core/src/components/Input/Input.svelte

+7-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
function isInput(root: string): root is Input {
4848
return ['input', 'select', 'textarea', 'datalist'].includes(root);
4949
}
50+
function isSelect(root: string): boolean {
51+
return root === 'select';
52+
}
5053
let isHTMLElement = true;
5154
let isComponent = false;
5255
@@ -226,7 +229,10 @@ Base component to create custom inputs
226229
</div>
227230
{/if}
228231
{#if showRightSection}
229-
<div {...rightSectionProps} class={classes.rightSection}>
232+
<div
233+
{...rightSectionProps}
234+
class={cx(classes.rightSection, { [classes.noPointerEvents]: isSelect(root) })}
235+
>
230236
<slot name="rightSection" />
231237
</div>
232238
{/if}

0 commit comments

Comments
 (0)