@archpublicwebsite/rangepicker 1.0.5 → 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.
Files changed (2) hide show
  1. package/README.md +140 -66
  2. 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
- - ðŸ“Ķ **Framework Agnostic CSS** - Pre-compiled CSS, no Tailwind required in your project
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 CSS variables
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** - No external datepicker dependencies
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
- cd packages/rangepicker
29
- pnpm install
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 '@archi-ui/rangepicker'
38
- import '@archi-ui/rangepicker/style.css' // Pre-compiled CSS - no Tailwind needed!
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
- **No Tailwind CSS required!** The package includes pre-compiled CSS that works with any framework.
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 '@archi-ui/rangepicker'
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
- ## Customization
114
+ ## Framework Compatibility
110
115
 
111
- Customize colors using CSS variables:
116
+ This package is designed to work seamlessly with any Vue 3 framework:
112
117
 
113
- ```css
114
- /* Your global styles */
115
- :root {
116
- --color-primary: 59 130 246; /* blue-500 */
117
- --color-secondary: 148 163 184; /* slate-400 */
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
- **📖 See [CUSTOMIZATION.md](./CUSTOMIZATION.md) for complete theming guide**
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
- :number-of-months="2"
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
- numberOfMonths: 2,
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
- :number-of-months="2"
201
- :number-of-columns="2"
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
- | `numberOfMonths` | `number` | `2` | Number of months to display |
245
- | `numberOfColumns` | `number` | `2` | Grid columns for months |
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
- │ └── index.d.ts # TypeScript types
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 # Component
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 # Date utilities
301
- │ │ └── position.ts # Positioning
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
- └── tsconfig.json
343
+ └── tailwind.config.js # With prefix: 'arch-'
308
344
  ```
309
345
 
310
- ## Styling
346
+ ## CSS Architecture
311
347
 
312
- The component uses Tailwind CSS for styling. You can customize the appearance by:
348
+ The component uses **Tailwind CSS with `arch-` prefix** to prevent conflicts with other frameworks:
313
349
 
314
- 1. **Using Tailwind Classes**: The component uses standard Tailwind classes that can be customized via your Tailwind config
315
- 2. **CSS Variables**: Override CSS custom properties for colors and spacing
316
- 3. **Custom CSS**: Import your own styles after the component styles
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
- Example custom styling:
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
- .rangepicker-day-selected {
322
- @apply bg-purple-600 text-white hover:bg-purple-700;
368
+ :root {
369
+ --color-primary: 59 130 246; /* RGB format */
370
+ --color-secondary: 148 163 184;
323
371
  }
372
+ ```
324
373
 
325
- .rangepicker-day-in-range {
326
- @apply bg-purple-50 text-purple-900;
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**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archpublicwebsite/rangepicker",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "Custom date range picker component for PBA Hotel Apps",
5
5
  "author": "Archipelago International",
6
6
  "license": "MIT",