Skip to content

Commit d055975

Browse files
committed
fix: #1611
feat: add inputmode=none to Datepicker
1 parent 7f513f6 commit d055975

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/lib/datepicker/Datepicker.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@
183183
<div bind:this={datepickerContainerElement} class={["relative", inline && "inline-block"]}>
184184
{#if !inline}
185185
<div class="relative">
186-
<input bind:this={inputElement} type="text" class={cn(input({ color }), inputClass)} {placeholder} value={range ? `${formatDate(rangeFrom)} - ${formatDate(rangeTo)}` : formatDate(value)} onfocus={() => (isOpen = true)} oninput={handleInputChange} onkeydown={handleInputKeydown} {disabled} {required} aria-haspopup="dialog" />
186+
<input bind:this={inputElement} type="text" class={cn(input({ color }), inputClass)} {placeholder} value={range ? `${formatDate(rangeFrom)} - ${formatDate(rangeTo)}` : formatDate(value)} onfocus={() => (isOpen = true)} oninput={handleInputChange} onkeydown={handleInputKeydown} {disabled} {required} inputmode="none" aria-haspopup="dialog" />
187187
<button type="button" class={cn(button(), btnClass)} onclick={() => (isOpen = !isOpen)} {disabled} aria-label={isOpen ? "Close date picker" : "Open date picker"}>
188188
<svg class="h-4 w-4 text-gray-500 dark:text-gray-400" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
189189
<path d="M20 4a2 2 0 0 0-2-2h-2V1a1 1 0 0 0-2 0v1h-3V1a1 1 0 0 0-2 0v1H6V1a1 1 0 0 0-2 0v1H2a2 2 0 0 0-2 2v2h20V4ZM0 18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8H0v10Zm5-8h10a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Z"></path>

src/routes/docs/components/datepicker.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The Datepicker component provides an interactive calendar interface for selectin
2727

2828
Use the Datepicker for single date selection. The selected date is bound to the `value` prop.
2929

30-
```svelte example
30+
```svelte example class="h-[430px]"
3131
<script lang="ts">
3232
import { Datepicker, P } from "flowbite-svelte";
3333
let selectedDate = $state<Date | undefined>(undefined);
@@ -43,7 +43,7 @@ Use the Datepicker for single date selection. The selected date is bound to the
4343

4444
Enable date range selection using the `range` prop. The start and end dates are bound to `rangeFrom` and `rangeTo` respectively.
4545

46-
```svelte example
46+
```svelte example class="h-[430px]"
4747
<script lang="ts">
4848
import { Datepicker, P } from "flowbite-svelte";
4949
@@ -67,7 +67,7 @@ Enable date range selection using the `range` prop. The start and end dates are
6767

6868
Use the `inline` prop to display the calendar without a popup.
6969

70-
```svelte example
70+
```svelte example class="h-[430px]"
7171
<script lang="ts">
7272
import { Datepicker, P } from "flowbite-svelte";
7373
let selectedDate = $state<Date | undefined>(undefined);
@@ -83,7 +83,7 @@ Use the `inline` prop to display the calendar without a popup.
8383

8484
Customize the primary color of the Datepicker using the `color` prop.
8585

86-
```svelte example
86+
```svelte example class="h-[430px]"
8787
<script lang="ts">
8888
import { Datepicker } from "flowbite-svelte";
8989
</script>
@@ -97,7 +97,7 @@ Customize the primary color of the Datepicker using the `color` prop.
9797

9898
Set a specific locale for date formatting using the `locale` prop.
9999

100-
```svelte example
100+
```svelte example class="h-[430px]"
101101
<script lang="ts">
102102
import { Datepicker } from "flowbite-svelte";
103103
</script>
@@ -111,7 +111,7 @@ Set a specific locale for date formatting using the `locale` prop.
111111

112112
Specify a custom date format using the `dateFormat` prop.
113113

114-
```svelte example
114+
```svelte example class="h-[430px]"
115115
<script lang="ts">
116116
import { Datepicker } from "flowbite-svelte";
117117
</script>
@@ -125,7 +125,7 @@ Specify a custom date format using the `dateFormat` prop.
125125

126126
Add action buttons (Today, Clear, Apply) using the `showActionButtons` prop. You can also listen for the `clear` and `apply` events to perform specific actions when these buttons are clicked.
127127

128-
```svelte example
128+
```svelte example class="h-[460px]"
129129
<script lang="ts">
130130
import { Datepicker, P, type DateOrRange } from "flowbite-svelte";
131131
let selectedDate = $state<Date | undefined>(undefined);
@@ -154,7 +154,7 @@ Add action buttons (Today, Clear, Apply) using the `showActionButtons` prop. You
154154

155155
Add a custom title to the Datepicker using the `title` prop.
156156

157-
```svelte example
157+
```svelte example class="h-[430px]"
158158
<script lang="ts">
159159
import { Datepicker } from "flowbite-svelte";
160160
</script>
@@ -168,7 +168,7 @@ Add a custom title to the Datepicker using the `title` prop.
168168

169169
Use the `disabled` prop to disable the Datepicker.
170170

171-
```svelte example
171+
```svelte example class="h-[430px]"
172172
<script lang="ts">
173173
import { Datepicker } from "flowbite-svelte";
174174
</script>
@@ -182,7 +182,7 @@ Use the `disabled` prop to disable the Datepicker.
182182

183183
Mark the Datepicker as a required field using the `required` prop.
184184

185-
```svelte example
185+
```svelte example class="h-[430px]"
186186
<script lang="ts">
187187
import { Datepicker } from "flowbite-svelte";
188188
</script>
@@ -196,7 +196,7 @@ Mark the Datepicker as a required field using the `required` prop.
196196

197197
Set a custom first day of the week using the `firstDayOfWeek` prop.
198198

199-
```svelte example
199+
```svelte example class="h-[430px]"
200200
<script lang="ts">
201201
import { Datepicker } from "flowbite-svelte";
202202
</script>
@@ -210,7 +210,7 @@ Set a custom first day of the week using the `firstDayOfWeek` prop.
210210

211211
Listen for date selection events using the `onselect` event.
212212

213-
```svelte example
213+
```svelte example class="h-[430px]"
214214
<script lang="ts">
215215
import { Datepicker, type DateOrRange } from "flowbite-svelte";
216216

0 commit comments

Comments
 (0)