@archpublicwebsite/rangepicker 1.1.0 → 1.2.0
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 +261 -104
- package/dist/Rangepicker.vue.d.ts +4 -28
- package/dist/Rangepicker.vue.d.ts.map +1 -1
- package/dist/RangepickerConstraints.stories.d.ts +34 -0
- package/dist/RangepickerConstraints.stories.d.ts.map +1 -0
- package/dist/RangepickerConstraints.stories.js +301 -0
- package/dist/RangepickerFormatting.stories.d.ts +34 -0
- package/dist/RangepickerFormatting.stories.d.ts.map +1 -0
- package/dist/RangepickerFormatting.stories.js +312 -0
- package/dist/RangepickerInput.stories.d.ts +46 -7
- package/dist/RangepickerInput.stories.d.ts.map +1 -1
- package/dist/RangepickerInput.stories.js +137 -50
- package/dist/RangepickerInput.vue.d.ts +4 -0
- package/dist/RangepickerInput.vue.d.ts.map +1 -1
- package/dist/RangepickerModes.stories.d.ts +35 -0
- package/dist/RangepickerModes.stories.d.ts.map +1 -0
- package/dist/RangepickerModes.stories.js +239 -0
- package/dist/RangepickerSpecialDates.stories.d.ts +31 -0
- package/dist/RangepickerSpecialDates.stories.d.ts.map +1 -0
- package/dist/RangepickerSpecialDates.stories.js +302 -0
- package/dist/RangepickerTheming.stories.d.ts +22 -0
- package/dist/RangepickerTheming.stories.d.ts.map +1 -0
- package/dist/RangepickerTheming.stories.js +266 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/rangepicker.js +297 -324
- package/dist/rangepicker.js.map +1 -1
- package/dist/rangepicker.umd.cjs +1 -1
- package/dist/rangepicker.umd.cjs.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types.d.ts +70 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +9 -13
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@ Custom, lightweight date range picker component for Vue 3 with Tailwind CSS pref
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- 🎨 **Vue 3 Composition API** - Built with modern Vue 3 and TypeScript
|
|
8
|
-
- 📦 **
|
|
8
|
+
- 📦 **CSS Prefix Support** - All Tailwind classes prefixed with `arch-` to prevent conflicts with Vuetify/Bootstrap
|
|
9
9
|
- 📅 **Dayjs Integration** - Powerful date manipulation without moment.js bloat
|
|
10
10
|
- 🎨 **Themeable** - Easy color customization via props (HEX colors)
|
|
11
11
|
- 📱 **Mobile Responsive** - Touch-friendly with bottom sheet on mobile
|
|
@@ -38,10 +38,47 @@ const dates = ref('')
|
|
|
38
38
|
</script>
|
|
39
39
|
|
|
40
40
|
<template>
|
|
41
|
-
<RangepickerInput
|
|
42
|
-
v-model="dates"
|
|
41
|
+
<RangepickerInput
|
|
42
|
+
v-model="dates"
|
|
43
|
+
primary-color="#3b82f6"
|
|
44
|
+
placeholder="Check in / Check out"
|
|
45
|
+
/>
|
|
46
|
+
</template>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### TypeScript Support
|
|
50
|
+
|
|
51
|
+
Full TypeScript support with exported types for type-safe development:
|
|
52
|
+
|
|
53
|
+
```vue
|
|
54
|
+
<script setup lang="ts">
|
|
55
|
+
import { ref } from 'vue'
|
|
56
|
+
import {
|
|
57
|
+
RangepickerInput,
|
|
58
|
+
type RangepickerProps,
|
|
59
|
+
type DateRange
|
|
60
|
+
} from '@archpublicwebsite/rangepicker'
|
|
61
|
+
import '@archpublicwebsite/rangepicker/style.css'
|
|
62
|
+
|
|
63
|
+
// Type-safe date range
|
|
64
|
+
const dates = ref<DateRange>({ startDate: '', endDate: '' })
|
|
65
|
+
|
|
66
|
+
// Type-safe props configuration
|
|
67
|
+
const pickerOptions: Partial<RangepickerProps> = {
|
|
68
|
+
format: 'DD/MM/YYYY',
|
|
69
|
+
autoApply: true,
|
|
70
|
+
minDays: 2,
|
|
71
|
+
maxDays: 30,
|
|
72
|
+
showTooltip: true
|
|
73
|
+
}
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
<template>
|
|
77
|
+
<RangepickerInput
|
|
78
|
+
v-model="dates"
|
|
79
|
+
v-bind="pickerOptions"
|
|
43
80
|
primary-color="#3b82f6"
|
|
44
|
-
placeholder="Check in / Check out"
|
|
81
|
+
placeholder="Check in / Check out"
|
|
45
82
|
/>
|
|
46
83
|
</template>
|
|
47
84
|
```
|
|
@@ -52,8 +89,8 @@ const dates = ref('')
|
|
|
52
89
|
- No Flash of Unstyled Content (FOUC)
|
|
53
90
|
- Industry standard (like Vuetify, Element Plus, etc.)
|
|
54
91
|
|
|
55
|
-
**Tailwind CSS
|
|
56
|
-
|
|
92
|
+
**Tailwind CSS Prefix:**
|
|
93
|
+
All Tailwind utility classes are prefixed with `arch-` to prevent conflicts with other CSS frameworks like Vuetify or Bootstrap. Your existing styles won't be affected!
|
|
57
94
|
|
|
58
95
|
## Color Customization
|
|
59
96
|
|
|
@@ -97,12 +134,58 @@ const dates3 = ref('')
|
|
|
97
134
|
</template>
|
|
98
135
|
```
|
|
99
136
|
|
|
137
|
+
### Font Customization
|
|
138
|
+
|
|
139
|
+
Use custom fonts to match your brand typography:
|
|
140
|
+
|
|
141
|
+
```vue
|
|
142
|
+
<script setup>
|
|
143
|
+
import { ref } from 'vue'
|
|
144
|
+
import { RangepickerInput } from '@archpublicwebsite/rangepicker'
|
|
145
|
+
|
|
146
|
+
const dates1 = ref('')
|
|
147
|
+
const dates2 = ref('')
|
|
148
|
+
const dates3 = ref('')
|
|
149
|
+
</script>
|
|
150
|
+
|
|
151
|
+
<template>
|
|
152
|
+
<!-- Roboto font -->
|
|
153
|
+
<RangepickerInput
|
|
154
|
+
v-model="dates1"
|
|
155
|
+
font-family="'Roboto', sans-serif"
|
|
156
|
+
primary-color="#3b82f6"
|
|
157
|
+
placeholder="With Roboto"
|
|
158
|
+
/>
|
|
159
|
+
|
|
160
|
+
<!-- Poppins font -->
|
|
161
|
+
<RangepickerInput
|
|
162
|
+
v-model="dates2"
|
|
163
|
+
font-family="'Poppins', sans-serif"
|
|
164
|
+
primary-color="#8b5cf6"
|
|
165
|
+
placeholder="With Poppins"
|
|
166
|
+
/>
|
|
167
|
+
|
|
168
|
+
<!-- Inherit from parent (default) -->
|
|
169
|
+
<RangepickerInput
|
|
170
|
+
v-model="dates3"
|
|
171
|
+
placeholder="Inherits parent font"
|
|
172
|
+
/>
|
|
173
|
+
</template>
|
|
174
|
+
|
|
175
|
+
<style>
|
|
176
|
+
/* Import fonts if needed */
|
|
177
|
+
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;600;700&display=swap');
|
|
178
|
+
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');
|
|
179
|
+
</style>
|
|
180
|
+
```
|
|
181
|
+
|
|
100
182
|
### Color Props
|
|
101
183
|
|
|
102
184
|
| Prop | Type | Default | Description |
|
|
103
185
|
|------|------|---------|-------------|
|
|
104
186
|
| `primary-color` | `string` | - | Main color for selected dates and buttons (HEX format, e.g., `#3b82f6`) |
|
|
105
187
|
| `secondary-color` | `string` | - | Color for hover states and secondary elements (HEX format, optional) |
|
|
188
|
+
| `font-family` | `string` | `inherit` | Custom font family (e.g., `'Roboto', sans-serif`, `'Poppins', sans-serif`) |
|
|
106
189
|
|
|
107
190
|
**Features:**
|
|
108
191
|
- ✅ **Scoped per instance** - Multiple pickers can have different colors simultaneously
|
|
@@ -110,19 +193,20 @@ const dates3 = ref('')
|
|
|
110
193
|
- ✅ **HEX format** - Standard 3 or 6 digit HEX colors (e.g., `#3b82f6`, `#fff`)
|
|
111
194
|
- ✅ **Auto-conversion** - Automatically converts HEX to RGB for CSS variables
|
|
112
195
|
- ✅ **Optional** - Falls back to default theme if not provided
|
|
196
|
+
- ✅ **Custom fonts** - Use any font family, inherits from parent by default
|
|
113
197
|
|
|
114
198
|
## Framework Compatibility
|
|
115
199
|
|
|
116
200
|
This package is designed to work seamlessly with any Vue 3 framework:
|
|
117
201
|
|
|
118
|
-
- ✅ **Vuetify** -
|
|
119
|
-
- ✅ **Bootstrap** -
|
|
202
|
+
- ✅ **Vuetify** - No CSS conflicts thanks to `arch-` prefix
|
|
203
|
+
- ✅ **Bootstrap** - Works alongside Bootstrap utilities
|
|
120
204
|
- ✅ **Element Plus** - Fully compatible
|
|
121
205
|
- ✅ **Quasar** - No issues
|
|
122
206
|
- ✅ **Plain Vue 3** - Works great standalone
|
|
123
207
|
- ✅ **Nuxt 3** - SSR compatible
|
|
124
208
|
|
|
125
|
-
|
|
209
|
+
The `arch-` prefix on all Tailwind classes ensures zero conflicts with other CSS frameworks.
|
|
126
210
|
|
|
127
211
|
## Usage
|
|
128
212
|
|
|
@@ -161,6 +245,21 @@ const options = {
|
|
|
161
245
|
### Basic Usage
|
|
162
246
|
|
|
163
247
|
```vue
|
|
248
|
+
<script setup lang="ts">
|
|
249
|
+
import { ref, computed } from 'vue'
|
|
250
|
+
import { Rangepicker, type DateRange } from '@archpublicwebsite/rangepicker'
|
|
251
|
+
import '@archpublicwebsite/rangepicker/style.css'
|
|
252
|
+
|
|
253
|
+
const triggerRef = ref<HTMLElement | null>(null)
|
|
254
|
+
const isOpen = ref(false)
|
|
255
|
+
const dateRange = ref<DateRange>({ startDate: '', endDate: '' })
|
|
256
|
+
|
|
257
|
+
const dateRangeText = computed(() => {
|
|
258
|
+
if (!dateRange.value.startDate || !dateRange.value.endDate) return ''
|
|
259
|
+
return `${dateRange.value.startDate} - ${dateRange.value.endDate}`
|
|
260
|
+
})
|
|
261
|
+
</script>
|
|
262
|
+
|
|
164
263
|
<template>
|
|
165
264
|
<div>
|
|
166
265
|
<input
|
|
@@ -177,25 +276,10 @@ const options = {
|
|
|
177
276
|
v-model:is-open="isOpen"
|
|
178
277
|
:trigger-element="triggerRef"
|
|
179
278
|
:value-of-months="2"
|
|
180
|
-
|
|
279
|
+
format="DD MMM YYYY"
|
|
181
280
|
/>
|
|
182
281
|
</div>
|
|
183
282
|
</template>
|
|
184
|
-
|
|
185
|
-
<script setup lang="ts">
|
|
186
|
-
import { ref, computed } from 'vue'
|
|
187
|
-
import { Rangepicker } from '@archpublicwebsite/rangepicker'
|
|
188
|
-
import '@archpublicwebsite/rangepicker/style.css'
|
|
189
|
-
|
|
190
|
-
const triggerRef = ref<HTMLElement | null>(null)
|
|
191
|
-
const isOpen = ref(false)
|
|
192
|
-
const dateRange = ref({ startDate: '', endDate: '' })
|
|
193
|
-
|
|
194
|
-
const dateRangeText = computed(() => {
|
|
195
|
-
if (!dateRange.value.startDate || !dateRange.value.endDate) return ''
|
|
196
|
-
return `${dateRange.value.startDate} - ${dateRange.value.endDate}`
|
|
197
|
-
})
|
|
198
|
-
</script>
|
|
199
283
|
```
|
|
200
284
|
|
|
201
285
|
### Using the Composable
|
|
@@ -203,67 +287,43 @@ const dateRangeText = computed(() => {
|
|
|
203
287
|
```vue
|
|
204
288
|
<script setup lang="ts">
|
|
205
289
|
import { ref } from 'vue'
|
|
206
|
-
import {
|
|
290
|
+
import {
|
|
291
|
+
Rangepicker,
|
|
292
|
+
useRangepicker,
|
|
293
|
+
type RangepickerProps
|
|
294
|
+
} from '@archpublicwebsite/rangepicker'
|
|
207
295
|
import '@archpublicwebsite/rangepicker/style.css'
|
|
208
296
|
|
|
209
297
|
const triggerRef = ref<HTMLElement | null>(null)
|
|
210
|
-
|
|
298
|
+
|
|
299
|
+
// Type-safe composable options
|
|
300
|
+
const options: Partial<RangepickerProps> = {
|
|
211
301
|
valueOfMonths: 2,
|
|
212
302
|
format: 'DD MMM YYYY',
|
|
213
303
|
minDays: 1,
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
```
|
|
304
|
+
autoApply: true
|
|
305
|
+
}
|
|
217
306
|
|
|
218
|
-
|
|
307
|
+
const { isOpen, dateRange, open, close, toggle } = useRangepicker(triggerRef, options)
|
|
308
|
+
</script>
|
|
219
309
|
|
|
220
|
-
```vue
|
|
221
310
|
<template>
|
|
222
311
|
<div>
|
|
223
|
-
<
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
readonly
|
|
229
|
-
@click="isBookingOpen = true"
|
|
230
|
-
/>
|
|
312
|
+
<button ref="triggerRef" @click="toggle">
|
|
313
|
+
{{ dateRange.startDate && dateRange.endDate
|
|
314
|
+
? `${dateRange.startDate} - ${dateRange.endDate}`
|
|
315
|
+
: 'Select dates' }}
|
|
316
|
+
</button>
|
|
231
317
|
|
|
232
318
|
<Rangepicker
|
|
233
|
-
v-model="
|
|
234
|
-
v-model:is-open="
|
|
235
|
-
:trigger-element="
|
|
236
|
-
|
|
237
|
-
:value-of-columns="2"
|
|
238
|
-
:min-days="1"
|
|
239
|
-
:format="'DD MMM YYYY'"
|
|
240
|
-
:show-tooltip="true"
|
|
241
|
-
:holidays="holidays"
|
|
242
|
-
:min-date="today"
|
|
243
|
-
variant="desktop"
|
|
319
|
+
v-model="dateRange"
|
|
320
|
+
v-model:is-open="isOpen"
|
|
321
|
+
:trigger-element="triggerRef"
|
|
322
|
+
v-bind="options"
|
|
244
323
|
/>
|
|
245
324
|
</div>
|
|
246
325
|
</template>
|
|
247
|
-
|
|
248
|
-
<script setup lang="ts">
|
|
249
|
-
import { ref, computed } from 'vue'
|
|
250
|
-
import { Rangepicker } from '@archpublicwebsite/rangepicker'
|
|
251
|
-
import '@archpublicwebsite/rangepicker/style.css'
|
|
252
|
-
import dayjs from 'dayjs'
|
|
253
|
-
|
|
254
|
-
const bookingInputRef = ref<HTMLElement | null>(null)
|
|
255
|
-
const isBookingOpen = ref(false)
|
|
256
|
-
const bookingDates = ref({ startDate: '', endDate: '' })
|
|
257
|
-
const today = dayjs().format('YYYY-MM-DD')
|
|
258
|
-
const holidays = ref(['2025-12-25', '2025-01-01'])
|
|
259
|
-
|
|
260
|
-
const bookingText = computed(() => {
|
|
261
|
-
if (!bookingDates.value.startDate || !bookingDates.value.endDate) return ''
|
|
262
|
-
return `${bookingDates.value.startDate} - ${bookingDates.value.endDate}`
|
|
263
|
-
})
|
|
264
|
-
</script>
|
|
265
326
|
```
|
|
266
|
-
|
|
267
327
|
## Props
|
|
268
328
|
|
|
269
329
|
| Prop | Type | Default | Description |
|
|
@@ -299,6 +359,128 @@ const bookingText = computed(() => {
|
|
|
299
359
|
| `dateSelected` | `Dayjs` | Emitted when a date is clicked |
|
|
300
360
|
| `rangeSelected` | `{ start: Dayjs, end: Dayjs }` | Emitted when range is complete |
|
|
301
361
|
|
|
362
|
+
## TypeScript Support
|
|
363
|
+
|
|
364
|
+
This package is built with TypeScript and provides full type definitions. All types are automatically exported for your convenience.
|
|
365
|
+
|
|
366
|
+
### Available Types
|
|
367
|
+
|
|
368
|
+
```typescript
|
|
369
|
+
import type {
|
|
370
|
+
RangepickerProps, // Component props interface
|
|
371
|
+
RangepickerEmits, // Event emitter interface
|
|
372
|
+
DateRange, // Date range object type
|
|
373
|
+
CalendarDay, // Internal calendar day type
|
|
374
|
+
CalendarMonth // Internal calendar month type
|
|
375
|
+
} from '@archpublicwebsite/rangepicker'
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
### Type Definitions
|
|
379
|
+
|
|
380
|
+
#### `RangepickerProps`
|
|
381
|
+
Complete props interface with JSDoc documentation. All props are optional with sensible defaults:
|
|
382
|
+
|
|
383
|
+
```typescript
|
|
384
|
+
interface RangepickerProps {
|
|
385
|
+
modelValue?: { startDate?: string | Date | Dayjs; endDate?: string | Date | Dayjs }
|
|
386
|
+
isOpen?: boolean
|
|
387
|
+
variant?: 'desktop' | 'mobile'
|
|
388
|
+
minDate?: string | Date | Dayjs
|
|
389
|
+
maxDate?: string | Date | Dayjs
|
|
390
|
+
minDays?: number
|
|
391
|
+
maxDays?: number
|
|
392
|
+
close?: boolean
|
|
393
|
+
valueOfMonths?: number // default: 2
|
|
394
|
+
valueOfColumns?: number // default: 2
|
|
395
|
+
disabledDates?: (string | Date)[]
|
|
396
|
+
holidays?: (string | Date)[]
|
|
397
|
+
format?: string // default: 'YYYY-MM-DD'
|
|
398
|
+
delimiter?: string // default: ' - '
|
|
399
|
+
placeholder?: string
|
|
400
|
+
label?: string
|
|
401
|
+
showTooltip?: boolean // default: true
|
|
402
|
+
autoApply?: boolean // default: false
|
|
403
|
+
position?: 'auto' | 'top' | 'bottom'
|
|
404
|
+
triggerElement?: HTMLElement | null
|
|
405
|
+
colorStyles?: Record<string, string>
|
|
406
|
+
}
|
|
407
|
+
```
|
|
408
|
+
|
|
409
|
+
#### `DateRange`
|
|
410
|
+
Type for the v-model binding:
|
|
411
|
+
|
|
412
|
+
```typescript
|
|
413
|
+
interface DateRange {
|
|
414
|
+
startDate: string
|
|
415
|
+
endDate: string
|
|
416
|
+
}
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
#### `RangepickerEmits`
|
|
420
|
+
Event emitter types for type-safe event handling:
|
|
421
|
+
|
|
422
|
+
```typescript
|
|
423
|
+
interface RangepickerEmits {
|
|
424
|
+
'update:modelValue': [value: { startDate: string; endDate: string }]
|
|
425
|
+
'update:isOpen': [value: boolean]
|
|
426
|
+
'dateSelected': [date: Dayjs]
|
|
427
|
+
'rangeSelected': [start: Dayjs, end: Dayjs]
|
|
428
|
+
}
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
### Usage Examples
|
|
432
|
+
|
|
433
|
+
#### Type-Safe Component Props
|
|
434
|
+
|
|
435
|
+
```typescript
|
|
436
|
+
import type { RangepickerProps } from '@archpublicwebsite/rangepicker'
|
|
437
|
+
|
|
438
|
+
// Define props with autocomplete support
|
|
439
|
+
const config: Partial<RangepickerProps> = {
|
|
440
|
+
format: 'DD/MM/YYYY',
|
|
441
|
+
minDays: 2,
|
|
442
|
+
maxDays: 30,
|
|
443
|
+
autoApply: true,
|
|
444
|
+
showTooltip: true
|
|
445
|
+
}
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
#### Type-Safe Event Handlers
|
|
449
|
+
|
|
450
|
+
```typescript
|
|
451
|
+
import type { Dayjs } from 'dayjs'
|
|
452
|
+
|
|
453
|
+
function handleDateSelected(date: Dayjs) {
|
|
454
|
+
console.log('Selected:', date.format('YYYY-MM-DD'))
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
function handleRangeSelected(start: Dayjs, end: Dayjs) {
|
|
458
|
+
const nights = end.diff(start, 'day')
|
|
459
|
+
console.log(`Booking: ${nights} nights`)
|
|
460
|
+
}
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
#### Type-Safe Refs
|
|
464
|
+
|
|
465
|
+
```typescript
|
|
466
|
+
import { ref } from 'vue'
|
|
467
|
+
import type { DateRange } from '@archpublicwebsite/rangepicker'
|
|
468
|
+
|
|
469
|
+
const dateRange = ref<DateRange>({ startDate: '', endDate: '' })
|
|
470
|
+
const holidays = ref<string[]>(['2025-12-25', '2025-01-01'])
|
|
471
|
+
const disabledDates = ref<Date[]>([new Date('2025-12-24')])
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
### IDE Support
|
|
475
|
+
|
|
476
|
+
With the exported types, you'll get:
|
|
477
|
+
|
|
478
|
+
- ✅ **Autocomplete** - IntelliSense for all props and events
|
|
479
|
+
- ✅ **Type Checking** - Compile-time error detection
|
|
480
|
+
- ✅ **Documentation** - Hover tooltips with prop descriptions and default values
|
|
481
|
+
- ✅ **Refactoring** - Safe rename and refactor operations
|
|
482
|
+
- ✅ **Error Prevention** - Catch typos and incorrect prop usage before runtime
|
|
483
|
+
|
|
302
484
|
## Development
|
|
303
485
|
|
|
304
486
|
```bash
|
|
@@ -318,40 +500,15 @@ pnpm type-check
|
|
|
318
500
|
pnpm preview
|
|
319
501
|
```
|
|
320
502
|
|
|
321
|
-
## Package Structure
|
|
322
|
-
|
|
323
|
-
```
|
|
324
|
-
packages/rangepicker/
|
|
325
|
-
├── dist/ # Built files (published to npm)
|
|
326
|
-
│ ├── rangepicker.js # ES module (39.91 KB, gzipped: 9.42 KB)
|
|
327
|
-
│ ├── rangepicker.umd.cjs # UMD module (20.18 KB, gzipped: 7.07 KB)
|
|
328
|
-
│ ├── style.css # Compiled styles (16.25 KB)
|
|
329
|
-
│ └── *.d.ts # TypeScript type definitions
|
|
330
|
-
├── src/
|
|
331
|
-
│ ├── index.ts # Main entry point
|
|
332
|
-
│ ├── Rangepicker.vue # Core calendar component
|
|
333
|
-
│ ├── RangepickerInput.vue # Input wrapper component
|
|
334
|
-
│ ├── types.ts # Type definitions
|
|
335
|
-
│ ├── utils/
|
|
336
|
-
│ │ ├── calendar.ts # Calendar generation logic
|
|
337
|
-
│ │ ├── date.ts # Dayjs utilities
|
|
338
|
-
│ │ └── position.ts # Smart positioning
|
|
339
|
-
│ └── styles/
|
|
340
|
-
│ └── rangepicker.scss # Source styles (compiled during build)
|
|
341
|
-
├── package.json
|
|
342
|
-
├── vite.config.ts
|
|
343
|
-
└── tailwind.config.js # Tailwind config for package build
|
|
344
|
-
```
|
|
345
|
-
|
|
346
503
|
## CSS Architecture
|
|
347
504
|
|
|
348
|
-
The component uses **
|
|
505
|
+
The component uses **Tailwind CSS with `arch-` prefix** to prevent conflicts with other frameworks:
|
|
349
506
|
|
|
350
|
-
###
|
|
351
|
-
- ✅ **
|
|
352
|
-
- ✅ **
|
|
353
|
-
- ✅ **
|
|
354
|
-
- ✅ **
|
|
507
|
+
### Why the prefix?
|
|
508
|
+
- ✅ **Zero conflicts** with Vuetify, Bootstrap, Element Plus, etc.
|
|
509
|
+
- ✅ **Safe to use** alongside any CSS framework
|
|
510
|
+
- ✅ **All utilities prefixed**: `.arch-flex`, `.arch-text-sm`, `.arch-bg-white`, etc.
|
|
511
|
+
- ✅ **Custom classes untouched**: `.rangepicker-*` classes remain unprefixed
|
|
355
512
|
|
|
356
513
|
### Styling Options
|
|
357
514
|
|
|
@@ -384,11 +541,11 @@ The component uses **compiled Tailwind CSS** bundled in the package:
|
|
|
384
541
|
### Styles not showing
|
|
385
542
|
Make sure you imported the CSS:
|
|
386
543
|
```js
|
|
387
|
-
import '@archpublicwebsite/rangepicker/
|
|
544
|
+
import '@archpublicwebsite/rangepicker/style.css'
|
|
388
545
|
```
|
|
389
546
|
|
|
390
|
-
###
|
|
391
|
-
|
|
547
|
+
### CSS conflicts with Vuetify
|
|
548
|
+
This should NOT happen thanks to the `arch-` prefix. If you see conflicts, please open an issue.
|
|
392
549
|
|
|
393
550
|
### TypeScript errors
|
|
394
551
|
Ensure `vue` is installed as a dependency in your project.
|
|
@@ -1,31 +1,6 @@
|
|
|
1
1
|
import { Dayjs } from 'dayjs';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
startDate?: string | Date | Dayjs;
|
|
5
|
-
endDate?: string | Date | Dayjs;
|
|
6
|
-
};
|
|
7
|
-
isOpen?: boolean;
|
|
8
|
-
variant?: 'desktop' | 'mobile';
|
|
9
|
-
minDate?: string | Date | Dayjs;
|
|
10
|
-
maxDate?: string | Date | Dayjs;
|
|
11
|
-
minDays?: number;
|
|
12
|
-
maxDays?: number;
|
|
13
|
-
close?: boolean;
|
|
14
|
-
valueOfMonths?: number;
|
|
15
|
-
valueOfColumns?: number;
|
|
16
|
-
disabledDates?: (string | Date)[];
|
|
17
|
-
holidays?: (string | Date)[];
|
|
18
|
-
format?: string;
|
|
19
|
-
delimiter?: string;
|
|
20
|
-
placeholder?: string;
|
|
21
|
-
label?: string;
|
|
22
|
-
showTooltip?: boolean;
|
|
23
|
-
autoApply?: boolean;
|
|
24
|
-
position?: 'auto' | 'top' | 'bottom';
|
|
25
|
-
triggerElement?: HTMLElement | null;
|
|
26
|
-
colorStyles?: Record<string, string>;
|
|
27
|
-
}
|
|
28
|
-
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
2
|
+
import { RangepickerProps } from './types';
|
|
3
|
+
declare const _default: import('vue').DefineComponent<RangepickerProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
29
4
|
"update:modelValue": (value: {
|
|
30
5
|
startDate: string;
|
|
31
6
|
endDate: string;
|
|
@@ -33,7 +8,7 @@ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, imp
|
|
|
33
8
|
"update:isOpen": (value: boolean) => any;
|
|
34
9
|
dateSelected: (date: Dayjs) => any;
|
|
35
10
|
rangeSelected: (start: Dayjs, end: Dayjs) => any;
|
|
36
|
-
}, string, import('vue').PublicProps, Readonly<
|
|
11
|
+
}, string, import('vue').PublicProps, Readonly<RangepickerProps> & Readonly<{
|
|
37
12
|
"onUpdate:modelValue"?: (value: {
|
|
38
13
|
startDate: string;
|
|
39
14
|
endDate: string;
|
|
@@ -51,6 +26,7 @@ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, imp
|
|
|
51
26
|
showTooltip: boolean;
|
|
52
27
|
autoApply: boolean;
|
|
53
28
|
position: "auto" | "top" | "bottom";
|
|
29
|
+
borderRadius: string;
|
|
54
30
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
55
31
|
calendarRef: HTMLDivElement;
|
|
56
32
|
}, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Rangepicker.vue.d.ts","sourceRoot":"","sources":["../src/Rangepicker.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Rangepicker.vue.d.ts","sourceRoot":"","sources":["../src/Rangepicker.vue"],"names":[],"mappings":"AAujBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAInC,OAAO,KAAK,EAAe,gBAAgB,EAAE,MAAM,SAAS,CAAC;;;mBAgBjB,MAAM;iBAAW,MAAM;;;;;;;mBAAvB,MAAM;iBAAW,MAAM;;;;;;;;;;;;;;;;;;;AA0lBnE,wBAUG"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/vue3";
|
|
2
|
+
import RangepickerInput from "./RangepickerInput.vue";
|
|
3
|
+
/**
|
|
4
|
+
* Stories demonstrating date constraints and validation options
|
|
5
|
+
* for the Rangepicker component.
|
|
6
|
+
*/
|
|
7
|
+
declare const meta: Meta<typeof RangepickerInput>;
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof RangepickerInput>;
|
|
10
|
+
/**
|
|
11
|
+
* Set a minimum date to prevent selection of past dates.
|
|
12
|
+
*/
|
|
13
|
+
export declare const MinDate: Story;
|
|
14
|
+
/**
|
|
15
|
+
* Set a maximum date to limit how far in the future users can select.
|
|
16
|
+
*/
|
|
17
|
+
export declare const MaxDate: Story;
|
|
18
|
+
/**
|
|
19
|
+
* Combine minDate and maxDate to create a booking window.
|
|
20
|
+
*/
|
|
21
|
+
export declare const MinMaxDateRange: Story;
|
|
22
|
+
/**
|
|
23
|
+
* Require a minimum number of days in the selected range.
|
|
24
|
+
*/
|
|
25
|
+
export declare const MinDays: Story;
|
|
26
|
+
/**
|
|
27
|
+
* Limit the maximum number of days that can be selected.
|
|
28
|
+
*/
|
|
29
|
+
export declare const MaxDays: Story;
|
|
30
|
+
/**
|
|
31
|
+
* Combine minDays and maxDays to enforce a stay duration range.
|
|
32
|
+
*/
|
|
33
|
+
export declare const MinMaxDays: Story;
|
|
34
|
+
//# sourceMappingURL=RangepickerConstraints.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RangepickerConstraints.stories.d.ts","sourceRoot":"","sources":["../src/RangepickerConstraints.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,gBAAgB,MAAM,wBAAwB,CAAC;AAEtD;;;GAGG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,gBAAgB,CAuDvC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAQ/C;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,KAgCrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,KAkCrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,KAgC7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,KAuCrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,KAuCrB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,KAsCxB,CAAC"}
|