@archpublicwebsite/rangepicker 1.0.2 â 1.0.6
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 +140 -66
- package/dist/RangepickerInput.vue.d.ts.map +1 -1
- package/dist/rangepicker.js +2 -2
- 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/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,41 +1,38 @@
|
|
|
1
|
-
# rangepicker
|
|
1
|
+
# @archpublicwebsite/rangepicker
|
|
2
2
|
|
|
3
|
-
Custom, lightweight date range picker component for Vue 3.
|
|
3
|
+
Custom, lightweight date range picker component for Vue 3 with Tailwind CSS prefix support.
|
|
4
4
|
|
|
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
|
-
- ðĻ **Themeable** - Easy color customization via
|
|
10
|
+
- ðĻ **Themeable** - Easy color customization via props (HEX colors)
|
|
11
11
|
- ðą **Mobile Responsive** - Touch-friendly with bottom sheet on mobile
|
|
12
12
|
- ðŊ **Smart Positioning** - Auto-adjusts based on available viewport space
|
|
13
13
|
- âŋ **Accessible** - Keyboard navigation and screen reader support
|
|
14
14
|
- ð **SSR Compatible** - Works perfectly with Nuxt 3
|
|
15
|
-
- ðŠķ **Lightweight** -
|
|
15
|
+
- ðŠķ **Lightweight** - ~49KB CSS (gzipped: 5.3KB), ~40KB JS (gzipped: 9.4KB)
|
|
16
16
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
19
|
-
From the monorepo root:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
pnpm add rangepicker --filter @pba/nuxt
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
Or install dependencies in the rangepicker package:
|
|
26
|
-
|
|
27
19
|
```bash
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
npm install @archpublicwebsite/rangepicker
|
|
21
|
+
# or
|
|
22
|
+
pnpm add @archpublicwebsite/rangepicker
|
|
23
|
+
# or
|
|
24
|
+
yarn add @archpublicwebsite/rangepicker
|
|
30
25
|
```
|
|
31
26
|
|
|
32
27
|
## Quick Start
|
|
33
28
|
|
|
29
|
+
**Important:** You must import both the component AND the CSS file.
|
|
30
|
+
|
|
34
31
|
```vue
|
|
35
32
|
<script setup>
|
|
36
33
|
import { ref } from 'vue'
|
|
37
|
-
import { RangepickerInput } from '@
|
|
38
|
-
import '@
|
|
34
|
+
import { RangepickerInput } from '@archpublicwebsite/rangepicker'
|
|
35
|
+
import '@archpublicwebsite/rangepicker/style.css' // Required!
|
|
39
36
|
|
|
40
37
|
const dates = ref('')
|
|
41
38
|
</script>
|
|
@@ -49,7 +46,14 @@ const dates = ref('')
|
|
|
49
46
|
</template>
|
|
50
47
|
```
|
|
51
48
|
|
|
52
|
-
**
|
|
49
|
+
**Why separate CSS import?**
|
|
50
|
+
- Better performance (CSS cached independently)
|
|
51
|
+
- Smaller JS bundle
|
|
52
|
+
- No Flash of Unstyled Content (FOUC)
|
|
53
|
+
- Industry standard (like Vuetify, Element Plus, etc.)
|
|
54
|
+
|
|
55
|
+
**Tailwind CSS Prefix:**
|
|
56
|
+
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!
|
|
53
57
|
|
|
54
58
|
## Color Customization
|
|
55
59
|
|
|
@@ -58,7 +62,8 @@ Customize colors easily by passing HEX color values as props. Each rangepicker i
|
|
|
58
62
|
```vue
|
|
59
63
|
<script setup>
|
|
60
64
|
import { ref } from 'vue'
|
|
61
|
-
import { RangepickerInput } from '@
|
|
65
|
+
import { RangepickerInput } from '@archpublicwebsite/rangepicker'
|
|
66
|
+
import '@archpublicwebsite/rangepicker/style.css'
|
|
62
67
|
|
|
63
68
|
const dates1 = ref('')
|
|
64
69
|
const dates2 = ref('')
|
|
@@ -106,22 +111,53 @@ const dates3 = ref('')
|
|
|
106
111
|
- â
**Auto-conversion** - Automatically converts HEX to RGB for CSS variables
|
|
107
112
|
- â
**Optional** - Falls back to default theme if not provided
|
|
108
113
|
|
|
109
|
-
##
|
|
114
|
+
## Framework Compatibility
|
|
110
115
|
|
|
111
|
-
|
|
116
|
+
This package is designed to work seamlessly with any Vue 3 framework:
|
|
112
117
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
```
|
|
118
|
+
- â
**Vuetify** - No CSS conflicts thanks to `arch-` prefix
|
|
119
|
+
- â
**Bootstrap** - Works alongside Bootstrap utilities
|
|
120
|
+
- â
**Element Plus** - Fully compatible
|
|
121
|
+
- â
**Quasar** - No issues
|
|
122
|
+
- â
**Plain Vue 3** - Works great standalone
|
|
123
|
+
- â
**Nuxt 3** - SSR compatible
|
|
120
124
|
|
|
121
|
-
|
|
125
|
+
The `arch-` prefix on all Tailwind classes ensures zero conflicts with other CSS frameworks.
|
|
122
126
|
|
|
123
127
|
## Usage
|
|
124
128
|
|
|
129
|
+
### With Vuetify (Recommended)
|
|
130
|
+
|
|
131
|
+
```vue
|
|
132
|
+
<script setup>
|
|
133
|
+
import { ref } from 'vue'
|
|
134
|
+
import { RangepickerInput } from '@archpublicwebsite/rangepicker'
|
|
135
|
+
import '@archpublicwebsite/rangepicker/style.css'
|
|
136
|
+
import '@archpublicwebsite/rangepicker/style.css'
|
|
137
|
+
|
|
138
|
+
const dates = ref('')
|
|
139
|
+
const options = {
|
|
140
|
+
autoApply: true,
|
|
141
|
+
minDate: new Date(),
|
|
142
|
+
format: 'DD MMM YYYY',
|
|
143
|
+
numberOfColumns: 2,
|
|
144
|
+
numberOfMonths: 2,
|
|
145
|
+
}
|
|
146
|
+
</script>
|
|
147
|
+
|
|
148
|
+
<template>
|
|
149
|
+
<v-container>
|
|
150
|
+
<RangepickerInput
|
|
151
|
+
v-model="dates"
|
|
152
|
+
:options="options"
|
|
153
|
+
primary-color="#1976d2"
|
|
154
|
+
placeholder="Check in / Check out"
|
|
155
|
+
class="my-custom-input"
|
|
156
|
+
/>
|
|
157
|
+
</v-container>
|
|
158
|
+
</template>
|
|
159
|
+
```
|
|
160
|
+
|
|
125
161
|
### Basic Usage
|
|
126
162
|
|
|
127
163
|
```vue
|
|
@@ -140,7 +176,7 @@ Customize colors using CSS variables:
|
|
|
140
176
|
v-model="dateRange"
|
|
141
177
|
v-model:is-open="isOpen"
|
|
142
178
|
:trigger-element="triggerRef"
|
|
143
|
-
:
|
|
179
|
+
:value-of-months="2"
|
|
144
180
|
:format="'DD MMM YYYY'"
|
|
145
181
|
/>
|
|
146
182
|
</div>
|
|
@@ -148,8 +184,8 @@ Customize colors using CSS variables:
|
|
|
148
184
|
|
|
149
185
|
<script setup lang="ts">
|
|
150
186
|
import { ref, computed } from 'vue'
|
|
151
|
-
import { Rangepicker } from 'rangepicker'
|
|
152
|
-
import 'rangepicker/style.css'
|
|
187
|
+
import { Rangepicker } from '@archpublicwebsite/rangepicker'
|
|
188
|
+
import '@archpublicwebsite/rangepicker/style.css'
|
|
153
189
|
|
|
154
190
|
const triggerRef = ref<HTMLElement | null>(null)
|
|
155
191
|
const isOpen = ref(false)
|
|
@@ -167,12 +203,12 @@ const dateRangeText = computed(() => {
|
|
|
167
203
|
```vue
|
|
168
204
|
<script setup lang="ts">
|
|
169
205
|
import { ref } from 'vue'
|
|
170
|
-
import { Rangepicker, useRangepicker } from 'rangepicker'
|
|
171
|
-
import 'rangepicker/style.css'
|
|
206
|
+
import { Rangepicker, useRangepicker } from '@archpublicwebsite/rangepicker'
|
|
207
|
+
import '@archpublicwebsite/rangepicker/style.css'
|
|
172
208
|
|
|
173
209
|
const triggerRef = ref<HTMLElement | null>(null)
|
|
174
210
|
const { isOpen, dateRange, open, close, toggle } = useRangepicker(triggerRef, {
|
|
175
|
-
|
|
211
|
+
valueOfMonths: 2,
|
|
176
212
|
format: 'DD MMM YYYY',
|
|
177
213
|
minDays: 1,
|
|
178
214
|
})
|
|
@@ -197,8 +233,8 @@ const { isOpen, dateRange, open, close, toggle } = useRangepicker(triggerRef, {
|
|
|
197
233
|
v-model="bookingDates"
|
|
198
234
|
v-model:is-open="isBookingOpen"
|
|
199
235
|
:trigger-element="bookingInputRef"
|
|
200
|
-
:
|
|
201
|
-
:
|
|
236
|
+
:value-of-months="2"
|
|
237
|
+
:value-of-columns="2"
|
|
202
238
|
:min-days="1"
|
|
203
239
|
:format="'DD MMM YYYY'"
|
|
204
240
|
:show-tooltip="true"
|
|
@@ -211,8 +247,8 @@ const { isOpen, dateRange, open, close, toggle } = useRangepicker(triggerRef, {
|
|
|
211
247
|
|
|
212
248
|
<script setup lang="ts">
|
|
213
249
|
import { ref, computed } from 'vue'
|
|
214
|
-
import { Rangepicker } from 'rangepicker'
|
|
215
|
-
import 'rangepicker/style.css'
|
|
250
|
+
import { Rangepicker } from '@archpublicwebsite/rangepicker'
|
|
251
|
+
import '@archpublicwebsite/rangepicker/style.css'
|
|
216
252
|
import dayjs from 'dayjs'
|
|
217
253
|
|
|
218
254
|
const bookingInputRef = ref<HTMLElement | null>(null)
|
|
@@ -241,8 +277,8 @@ const bookingText = computed(() => {
|
|
|
241
277
|
| `maxDate` | `string \| Date \| Dayjs` | - | Maximum selectable date |
|
|
242
278
|
| `minDays` | `number` | - | Minimum number of days in range |
|
|
243
279
|
| `maxDays` | `number` | - | Maximum number of days in range |
|
|
244
|
-
| `
|
|
245
|
-
| `
|
|
280
|
+
| `valueOfMonths` | `number` | `2` | Number of months to display |
|
|
281
|
+
| `valueOfColumns` | `number` | `2` | Grid columns for months |
|
|
246
282
|
| `disabledDates` | `(string \| Date)[]` | `[]` | Array of disabled dates |
|
|
247
283
|
| `holidays` | `(string \| Date)[]` | `[]` | Array of holiday dates |
|
|
248
284
|
| `format` | `string` | `'YYYY-MM-DD'` | Date format |
|
|
@@ -286,55 +322,93 @@ pnpm preview
|
|
|
286
322
|
|
|
287
323
|
```
|
|
288
324
|
packages/rangepicker/
|
|
289
|
-
âââ dist/ # Built files
|
|
290
|
-
â âââ rangepicker.js # ES module
|
|
291
|
-
â âââ rangepicker.umd.cjs # UMD module
|
|
292
|
-
â âââ style.css # Compiled styles
|
|
293
|
-
â âââ
|
|
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 with arch- prefix (48.69 KB, gzipped: 5.29 KB)
|
|
329
|
+
â âââ *.d.ts # TypeScript type definitions
|
|
294
330
|
âââ src/
|
|
295
|
-
â âââ index.ts # Main entry
|
|
296
|
-
â âââ Rangepicker.vue #
|
|
331
|
+
â âââ index.ts # Main entry point
|
|
332
|
+
â âââ Rangepicker.vue # Core calendar component
|
|
333
|
+
â âââ RangepickerInput.vue # Input wrapper component
|
|
297
334
|
â âââ types.ts # Type definitions
|
|
298
335
|
â âââ utils/
|
|
299
|
-
â â âââ calendar.ts # Calendar logic
|
|
300
|
-
â â âââ date.ts #
|
|
301
|
-
â â âââ position.ts #
|
|
336
|
+
â â âââ calendar.ts # Calendar generation logic
|
|
337
|
+
â â âââ date.ts # Dayjs utilities
|
|
338
|
+
â â âââ position.ts # Smart positioning
|
|
302
339
|
â âââ styles/
|
|
303
|
-
â âââ rangepicker.scss
|
|
304
|
-
âââ index.html # Demo page
|
|
340
|
+
â âââ rangepicker.scss # Tailwind CSS with arch- prefix
|
|
305
341
|
âââ package.json
|
|
306
342
|
âââ vite.config.ts
|
|
307
|
-
âââ
|
|
343
|
+
âââ tailwind.config.js # With prefix: 'arch-'
|
|
308
344
|
```
|
|
309
345
|
|
|
310
|
-
##
|
|
346
|
+
## CSS Architecture
|
|
311
347
|
|
|
312
|
-
The component uses Tailwind CSS
|
|
348
|
+
The component uses **Tailwind CSS with `arch-` prefix** to prevent conflicts with other frameworks:
|
|
313
349
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
350
|
+
### Why the prefix?
|
|
351
|
+
- â
**Zero conflicts** with Vuetify, Bootstrap, Element Plus, etc.
|
|
352
|
+
- â
**Safe to use** alongside any CSS framework
|
|
353
|
+
- â
**All utilities prefixed**: `.arch-flex`, `.arch-text-sm`, `.arch-bg-white`, etc.
|
|
354
|
+
- â
**Custom classes untouched**: `.rangepicker-*` classes remain unprefixed
|
|
317
355
|
|
|
318
|
-
|
|
356
|
+
### Styling Options
|
|
319
357
|
|
|
358
|
+
1. **Color Props (Easiest)**:
|
|
359
|
+
```vue
|
|
360
|
+
<RangepickerInput
|
|
361
|
+
primary-color="#3b82f6"
|
|
362
|
+
secondary-color="#60a5fa"
|
|
363
|
+
/>
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
2. **CSS Variables (Global)**:
|
|
320
367
|
```css
|
|
321
|
-
|
|
322
|
-
|
|
368
|
+
:root {
|
|
369
|
+
--color-primary: 59 130 246; /* RGB format */
|
|
370
|
+
--color-secondary: 148 163 184;
|
|
323
371
|
}
|
|
372
|
+
```
|
|
324
373
|
|
|
325
|
-
.
|
|
326
|
-
|
|
374
|
+
3. **Custom CSS Overrides**:
|
|
375
|
+
```css
|
|
376
|
+
/* Override component styles */
|
|
377
|
+
.rangepicker-day-selected {
|
|
378
|
+
background-color: purple !important;
|
|
327
379
|
}
|
|
328
380
|
```
|
|
329
381
|
|
|
382
|
+
## Troubleshooting
|
|
383
|
+
|
|
384
|
+
### Styles not showing
|
|
385
|
+
Make sure you imported the CSS:
|
|
386
|
+
```js
|
|
387
|
+
import '@archpublicwebsite/rangepicker/style.css'
|
|
388
|
+
```
|
|
389
|
+
|
|
390
|
+
### CSS conflicts with Vuetify
|
|
391
|
+
This should NOT happen thanks to the `arch-` prefix. If you see conflicts, please open an issue.
|
|
392
|
+
|
|
393
|
+
### TypeScript errors
|
|
394
|
+
Ensure `vue` is installed as a dependency in your project.
|
|
395
|
+
|
|
330
396
|
## Browser Support
|
|
331
397
|
|
|
332
398
|
- Chrome/Edge (latest 2 versions)
|
|
333
399
|
- Firefox (latest 2 versions)
|
|
334
|
-
- Safari (latest 2 versions)
|
|
400
|
+
- Safari (latest 2 versions)
|
|
335
401
|
- Mobile Safari (iOS 14+)
|
|
336
402
|
- Chrome for Android (latest)
|
|
337
403
|
|
|
404
|
+
## Contributing
|
|
405
|
+
|
|
406
|
+
See the main repository [README](../../README.md) for contribution guidelines.
|
|
407
|
+
|
|
338
408
|
## License
|
|
339
409
|
|
|
340
|
-
MIT
|
|
410
|
+
MIT ÂĐ Archipelago International
|
|
411
|
+
|
|
412
|
+
---
|
|
413
|
+
|
|
414
|
+
**Made with âĪïļ for PBA Hotel Apps**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RangepickerInput.vue.d.ts","sourceRoot":"","sources":["../src/RangepickerInput.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RangepickerInput.vue.d.ts","sourceRoot":"","sources":["../src/RangepickerInput.vue"],"names":[],"mappings":"AA+MA,UAAU,iBAAiB;IACzB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,SAAS,CAAC,EAAE,GAAG,CAAA;IACf,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;IACzB,OAAO,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;IACvB,OAAO,CAAC,EAAE,IAAI,GAAG,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,WAAW,CAAC,EAAE,GAAG,CAAA;IACjB,aAAa,CAAC,EAAE,GAAG,CAAA;IACnB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,UAAU,KAAK;IACb,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,iBAAiB,CAAA;IAC3B,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAA;IAC9B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;;;;;;;;aAHW,SAAS,GAAG,QAAQ;iBAJhB,MAAM;cACT,OAAO;;;;;AAyNpB,wBAUG"}
|
package/dist/rangepicker.js
CHANGED
|
@@ -876,7 +876,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
876
876
|
return props.modelValue || "";
|
|
877
877
|
});
|
|
878
878
|
const inputClass = computed(() => {
|
|
879
|
-
return props.class || "
|
|
879
|
+
return props.class || "arch-w-full arch-px-3 arch-py-2 arch-border arch-border-gray-300 arch-rounded-lg arch-text-sm arch-text-gray-900 focus:arch-outline-none focus:arch-ring-2 focus:arch-ring-blue-500 focus:arch-border-blue-500";
|
|
880
880
|
});
|
|
881
881
|
function openPicker() {
|
|
882
882
|
isOpen.value = true;
|
|
@@ -955,7 +955,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
955
955
|
};
|
|
956
956
|
}
|
|
957
957
|
});
|
|
958
|
-
const RangepickerInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-
|
|
958
|
+
const RangepickerInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4e3d84fa"]]);
|
|
959
959
|
function useRangepicker(triggerRef, options = {}) {
|
|
960
960
|
const isOpen = ref(false);
|
|
961
961
|
const dateRange = ref({ startDate: "", endDate: "" });
|