|
1 | 1 | <script lang="ts">
|
2 | 2 | import { onMount } from "svelte";
|
| 3 | + import { twMerge } from "tailwind-merge"; |
3 | 4 | import clsx from "clsx";
|
4 | 5 | import { fade } from "svelte/transition";
|
5 | 6 | import { Button, ToolbarButton, type DatepickerProps, cn } from "$lib";
|
6 | 7 | import { datepicker } from "./theme";
|
7 | 8 |
|
8 |
| - let { value = $bindable(), defaultDate = null, range = false, rangeFrom = $bindable(), rangeTo = $bindable(), locale = "default", firstDayOfWeek = 0, dateFormat, placeholder = "Select date", disabled = false, required = false, inputClass = "", color = "primary", inline = false, autohide = true, showActionButtons = false, title = "", onselect, onclear, onapply, btnClass, inputmode = "none", classes, class: className }: DatepickerProps = $props(); |
| 9 | + let { value = $bindable(), defaultDate = null, range = false, rangeFrom = $bindable(), rangeTo = $bindable(), locale = "default", firstDayOfWeek = 0, dateFormat, placeholder = "Select date", disabled = false, required = false, inputClass = "", color = "primary", inline = false, autohide = true, showActionButtons = false, title = "", onselect, onclear, onapply, btnClass, inputmode = "none", classes, monthColor="alternative", monthBtnSelected ='bg-primary-500 text-white', monthBtn='text-gray-700 dark:text-gray-300', class: className }: DatepickerProps = $props(); |
9 | 10 |
|
10 | 11 | const dateFormatDefault = { year: "numeric", month: "long", day: "numeric" };
|
11 | 12 | // const dateFormatOptions = $derived(dateFormat ?? dateFormatDefault);
|
|
193 | 194 | if (!inline) isOpen = false;
|
194 | 195 | }
|
195 | 196 |
|
196 |
| - let { base, input, button, titleVariant, actionButtons, columnHeader, polite, grid, nav, dayButton } = datepicker(); |
| 197 | + let { base, input, button, titleVariant, actionButtons, columnHeader, polite, grid, nav, dayButton, monthButton } = datepicker(); |
197 | 198 | </script>
|
198 | 199 |
|
199 | 200 | {#snippet navButton(forward: boolean)}
|
|
241 | 242 | </div>
|
242 | 243 | <div class="grid grid-cols-4 gap-2 p-4">
|
243 | 244 | {#each monthNames as month, index}
|
244 |
| - <Button type="button" class="rounded-lg px-3 py-2 text-sm hover:bg-gray-100 focus:ring-2 focus:ring-blue-500 dark:hover:bg-gray-700 {currentMonth.getMonth() === index ? 'bg-blue-500 text-white' : 'text-gray-700 dark:text-gray-300'}" onclick={(event: MouseEvent) => selectMonth(index, event)}> |
| 245 | + <Button type="button" color={monthColor} class={twMerge(monthButton(), currentMonth.getMonth() === index ? clsx(monthBtnSelected) : clsx(monthBtn), clsx(classes?.monthButton))} onclick={(event: MouseEvent) => selectMonth(index, event)}> |
245 | 246 | {month}
|
246 | 247 | </Button>
|
247 | 248 | {/each}
|
|
0 commit comments