@ignatremizov/vue-tailwind-datepicker 2.0.1 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -0
- package/dist/vue-tailwind-datepicker.js +4488 -4389
- package/dist/vue-tailwind-datepicker.umd.cjs +3 -3
- package/package.json +33 -8
package/README.md
CHANGED
|
@@ -227,6 +227,42 @@ const rangeDate = ref({
|
|
|
227
227
|
/>
|
|
228
228
|
```
|
|
229
229
|
|
|
230
|
+
**Template ref API (stable integration)**
|
|
231
|
+
|
|
232
|
+
For host flows that need imperative focus/readiness control, use the component ref API instead of querying internal `.vtd-*` selectors:
|
|
233
|
+
|
|
234
|
+
- `isReady(): boolean`
|
|
235
|
+
- `waitForReady(options?): Promise<boolean>`
|
|
236
|
+
- `focusCalendar(options?): Promise<boolean>`
|
|
237
|
+
- `focusInput(options?): boolean`
|
|
238
|
+
|
|
239
|
+
`waitForReady` is event-driven with a timeout fallback. Use `timeoutMs` (or legacy `maxAttempts`/`retryDelayMs`).
|
|
240
|
+
|
|
241
|
+
```vue
|
|
242
|
+
<script setup lang="ts">
|
|
243
|
+
import VueTailwindDatepicker from '@ignatremizov/vue-tailwind-datepicker'
|
|
244
|
+
import { ref } from 'vue'
|
|
245
|
+
|
|
246
|
+
type DatePickerRef = InstanceType<typeof VueTailwindDatepicker>
|
|
247
|
+
|
|
248
|
+
const pickerRef = ref<DatePickerRef | null>(null)
|
|
249
|
+
const rangeDate = ref({
|
|
250
|
+
startDate: '',
|
|
251
|
+
endDate: '',
|
|
252
|
+
})
|
|
253
|
+
|
|
254
|
+
async function focusCalendarAfterOpen() {
|
|
255
|
+
const ready = await pickerRef.value?.waitForReady({ timeoutMs: 400 })
|
|
256
|
+
if (ready)
|
|
257
|
+
await pickerRef.value?.focusCalendar({ preventScroll: true })
|
|
258
|
+
}
|
|
259
|
+
</script>
|
|
260
|
+
|
|
261
|
+
<template>
|
|
262
|
+
<VueTailwindDatepicker ref="pickerRef" v-model="rangeDate" use-range />
|
|
263
|
+
</template>
|
|
264
|
+
```
|
|
265
|
+
|
|
230
266
|
Selector wheel visuals are also themeable through CSS variables on `.vtd-datepicker` (month/year selected and hover colors, borders, typography, wheel cell sizing, and shared selected/unselected wheel text tokens used by selector + time wheels). Calendar range preview colors/opacity are exposed via `--vtd-calendar-range-preview-bg` and `--vtd-calendar-range-preview-bg-dark`. See `docs/theming-options.md` for examples.
|
|
231
267
|
|
|
232
268
|
## Shortcut Layout Customization
|