Skip to content

Commit

Permalink
fix(DatePicker): fix auto submit when wrapped in form
Browse files Browse the repository at this point in the history
  • Loading branch information
N00nDay committed Sep 26, 2023
1 parent 8cf181e commit 3814dc7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/lib/components/datepicker/DateInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@

{#if allowClear && value}
<button
type="button"
aria-label="clear"
on:click={handleClear}
class="absolute inset-y-0 group-focus-within:flex active:flex items-center"
Expand Down Expand Up @@ -307,6 +308,7 @@

{#if allowClear && value}
<button
type="button"
aria-label="clear"
on:click={handleClear}
class="absolute inset-y-0 group-focus-within:flex active:flex items-center"
Expand Down
14 changes: 12 additions & 2 deletions src/lib/components/datepicker/DatePicker.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@
>
<div class="h-14 px-3 py-2 flex items-center w-full">
<Button
htmlType="button"
ariaLabel="previous year"
size="xs"
shape="circle"
Expand All @@ -316,6 +317,7 @@
</svg>
</Button>
<Button
htmlType="button"
ariaLabel="previous month"
size="xs"
shape="circle"
Expand All @@ -342,6 +344,7 @@
<!-- {/key} -->
</div>
<Button
htmlType="button"
ariaLabel="next month"
size="xs"
shape="circle"
Expand All @@ -360,6 +363,7 @@
</svg>
</Button>
<Button
htmlType="button"
ariaLabel="next month"
size="xs"
shape="circle"
Expand Down Expand Up @@ -421,6 +425,7 @@
</span>
{:else}
<button
type="button"
aria-label="{iLocale.months[
browseDate.month()
]} {calendarDay.date()} {browseDate.year()} "
Expand Down Expand Up @@ -493,6 +498,7 @@
>
{#each actions as action}
<Button
htmlType="button"
size="sm"
type="primary"
shape="pill"
Expand All @@ -504,9 +510,13 @@
{/if}
{#if showTime || !closeOnSelect}
<div class="p-3 gap-3 flex items-center justify-evenly w-full border-t border-border">
<Button class="w-full bg-default text-default-content" on:click={handleCancel}>Clear</Button
<Button
htmlType="button"
class="w-full bg-default text-default-content"
on:click={handleCancel}>Clear</Button
>
<Button htmlType="button" type="primary" class="w-full" on:click={handleApply}>Apply</Button
>
<Button type="primary" class="w-full" on:click={handleApply}>Apply</Button>
</div>
{/if}
</div>
Expand Down

0 comments on commit 3814dc7

Please sign in to comment.