@manik02/vue3-timepicker 0.4.4 → 0.4.5

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.
Files changed (2) hide show
  1. package/README.md +111 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -228,6 +228,117 @@ Press `a` or `p` while focused to toggle between AM and PM.
228
228
 
229
229
  The dropdown columns will show values at the specified intervals (e.g. 00, 15, 30, 45 for a 15-minute step).
230
230
 
231
+ ## More quick examples
232
+
233
+ ### Start empty and allow clearing
234
+
235
+ ```vue
236
+ <script setup lang="ts">
237
+ import { ref } from "vue";
238
+
239
+ const time = ref<string | null>(null);
240
+
241
+ function clearTime() {
242
+ time.value = null;
243
+ }
244
+ </script>
245
+
246
+ <template>
247
+ <TimePicker v-model="time" format="HH:mm" />
248
+ <button type="button" @click="clearTime">Clear</button>
249
+ <pre>{{ time }}</pre>
250
+ </template>
251
+ ```
252
+
253
+ ### Typing-only input (no dropdown)
254
+
255
+ ```vue
256
+ <template>
257
+ <TimePicker
258
+ v-model="time"
259
+ format="HH:mm:ss"
260
+ :hide-dropdown="true"
261
+ placeholder="Type time (e.g. 13:45:00)"
262
+ />
263
+ </template>
264
+ ```
265
+
266
+ ### Working-hours bounds
267
+
268
+ ```vue
269
+ <template>
270
+ <TimePicker
271
+ v-model="time"
272
+ format="HH:mm"
273
+ min-time="09:00:00"
274
+ max-time="18:00:00"
275
+ />
276
+ </template>
277
+ ```
278
+
279
+ ### Disable specific slots and ranges
280
+
281
+ ```vue
282
+ <template>
283
+ <TimePicker
284
+ v-model="time"
285
+ format="HH:mm"
286
+ :disabled-times="[
287
+ '10:30:00',
288
+ ['12:00:00', '13:00:00'],
289
+ ['15:15:00', '15:45:00']
290
+ ]"
291
+ />
292
+ </template>
293
+ ```
294
+
295
+ ### React to validation state in UI
296
+
297
+ ```vue
298
+ <script setup lang="ts">
299
+ import { computed, ref } from "vue";
300
+
301
+ const time = ref("08:00:00");
302
+ const validationState = ref<"valid" | "invalid" | "out-of-range">("valid");
303
+
304
+ const message = computed(() => {
305
+ if (validationState.value === "out-of-range") return "Adjusted to nearest allowed time";
306
+ if (validationState.value === "invalid") return "Please enter a valid time";
307
+ return "Looks good";
308
+ });
309
+ </script>
310
+
311
+ <template>
312
+ <TimePicker
313
+ v-model="time"
314
+ v-model:validationState="validationState"
315
+ format="HH:mm"
316
+ min-time="09:00:00"
317
+ max-time="17:00:00"
318
+ />
319
+ <small>{{ message }}</small>
320
+ </template>
321
+ ```
322
+
323
+ ### Range picker with 30-minute intervals
324
+
325
+ ```vue
326
+ <script setup lang="ts">
327
+ import { ref } from "vue";
328
+
329
+ const range = ref<[string, string]>(["09:00:00", "17:00:00"]);
330
+ </script>
331
+
332
+ <template>
333
+ <TimePicker
334
+ v-model="range"
335
+ :range="true"
336
+ format="HH:mm"
337
+ :minute-step="30"
338
+ />
339
+ </template>
340
+ ```
341
+
231
342
  ## Size presets
232
343
 
233
344
  ```vue
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@manik02/vue3-timepicker",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
4
4
  "description": "A flexible Vue 3 timepicker component with multiple format support, range selection, and fully customisable styling",
5
5
  "license": "MIT",
6
6
  "author": "Manos Savvides",