@archpublicwebsite/rangepicker 1.0.14 → 1.0.18

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 CHANGED
@@ -134,12 +134,58 @@ const dates3 = ref('')
134
134
  </template>
135
135
  ```
136
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
+
137
182
  ### Color Props
138
183
 
139
184
  | Prop | Type | Default | Description |
140
185
  |------|------|---------|-------------|
141
186
  | `primary-color` | `string` | - | Main color for selected dates and buttons (HEX format, e.g., `#3b82f6`) |
142
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`) |
143
189
 
144
190
  **Features:**
145
191
  - ✅ **Scoped per instance** - Multiple pickers can have different colors simultaneously
@@ -147,6 +193,7 @@ const dates3 = ref('')
147
193
  - ✅ **HEX format** - Standard 3 or 6 digit HEX colors (e.g., `#3b82f6`, `#fff`)
148
194
  - ✅ **Auto-conversion** - Automatically converts HEX to RGB for CSS variables
149
195
  - ✅ **Optional** - Falls back to default theme if not provided
196
+ - ✅ **Custom fonts** - Use any font family, inherits from parent by default
150
197
 
151
198
  ## Framework Compatibility
152
199
 
@@ -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"}
@@ -0,0 +1,301 @@
1
+ import { ref, watch } from "vue";
2
+ import RangepickerInput from "./RangepickerInput.vue";
3
+ /**
4
+ * Stories demonstrating date constraints and validation options
5
+ * for the Rangepicker component.
6
+ */
7
+ const meta = {
8
+ title: "Components/Rangepicker/Constraints",
9
+ component: RangepickerInput,
10
+ tags: ['autodocs'],
11
+ parameters: {
12
+ docs: {
13
+ description: {
14
+ component: `
15
+ ## Date Constraints & Validation
16
+
17
+ Configure date constraints to limit the selectable date range. These options help
18
+ enforce business rules like booking windows, minimum stay requirements, and blackout dates.
19
+ `,
20
+ },
21
+ },
22
+ },
23
+ argTypes: {
24
+ options: {
25
+ control: "object",
26
+ description: "Configuration options including date constraints",
27
+ },
28
+ variant: {
29
+ control: "select",
30
+ options: ["desktop", "mobile"],
31
+ },
32
+ },
33
+ args: {
34
+ placeholder: "Check in / Check out",
35
+ id: "dates",
36
+ name: "dates",
37
+ variant: "desktop",
38
+ },
39
+ render: (args) => ({
40
+ components: { RangepickerInput },
41
+ setup() {
42
+ const modelValue = ref(args.modelValue ?? "");
43
+ watch(() => args.modelValue, (value) => {
44
+ const nextValue = value ?? "";
45
+ if (nextValue !== modelValue.value) {
46
+ modelValue.value = nextValue;
47
+ }
48
+ });
49
+ return { args, modelValue };
50
+ },
51
+ template: `
52
+ <div style="padding: 2rem; background: #f5f5f5; min-height: 400px;">
53
+ <RangepickerInput v-bind="args" v-model="modelValue" class="form-control mb-0 shadow-none text-black lg:pl-2 border-0 w-full" />
54
+ </div>
55
+ `
56
+ })
57
+ };
58
+ export default meta;
59
+ // Helper to get future dates
60
+ const today = new Date();
61
+ const nextWeek = new Date(today.getTime() + 7 * 24 * 60 * 60 * 1000);
62
+ const nextMonth = new Date(today.getTime() + 30 * 24 * 60 * 60 * 1000);
63
+ const threeMonthsLater = new Date(today.getTime() + 90 * 24 * 60 * 60 * 1000);
64
+ /**
65
+ * Set a minimum date to prevent selection of past dates.
66
+ */
67
+ export const MinDate = {
68
+ args: {
69
+ options: {
70
+ autoApply: true,
71
+ minDate: today,
72
+ format: 'DD MMM YYYY',
73
+ numberOfColumns: 2,
74
+ numberOfMonths: 2,
75
+ }
76
+ },
77
+ parameters: {
78
+ docs: {
79
+ description: {
80
+ story: `
81
+ ### Minimum Date
82
+
83
+ Prevent selection of dates before a specified date.
84
+
85
+ - **Type**: \`Date | string | Dayjs\`
86
+ - **Default**: \`undefined\`
87
+
88
+ Useful for preventing users from selecting past dates for future bookings.
89
+
90
+ \`\`\`typescript
91
+ options: {
92
+ minDate: new Date() // Today
93
+ }
94
+ \`\`\`
95
+ `,
96
+ },
97
+ },
98
+ },
99
+ };
100
+ /**
101
+ * Set a maximum date to limit how far in the future users can select.
102
+ */
103
+ export const MaxDate = {
104
+ args: {
105
+ options: {
106
+ autoApply: true,
107
+ minDate: today,
108
+ maxDate: threeMonthsLater,
109
+ format: 'DD MMM YYYY',
110
+ numberOfColumns: 2,
111
+ numberOfMonths: 2,
112
+ }
113
+ },
114
+ parameters: {
115
+ docs: {
116
+ description: {
117
+ story: `
118
+ ### Maximum Date
119
+
120
+ Limit how far in the future dates can be selected.
121
+
122
+ - **Type**: \`Date | string | Dayjs\`
123
+ - **Default**: \`undefined\`
124
+
125
+ Useful for booking systems that only allow reservations within a certain window.
126
+
127
+ \`\`\`typescript
128
+ options: {
129
+ minDate: new Date(),
130
+ maxDate: new Date(Date.now() + 90 * 24 * 60 * 60 * 1000) // 3 months from now
131
+ }
132
+ \`\`\`
133
+ `,
134
+ },
135
+ },
136
+ },
137
+ };
138
+ /**
139
+ * Combine minDate and maxDate to create a booking window.
140
+ */
141
+ export const MinMaxDateRange = {
142
+ args: {
143
+ placeholder: "Select within booking window",
144
+ options: {
145
+ autoApply: true,
146
+ minDate: nextWeek,
147
+ maxDate: threeMonthsLater,
148
+ format: 'DD MMM YYYY',
149
+ numberOfColumns: 2,
150
+ numberOfMonths: 2,
151
+ }
152
+ },
153
+ parameters: {
154
+ docs: {
155
+ description: {
156
+ story: `
157
+ ### Min/Max Date Range
158
+
159
+ Combine both constraints to create a specific booking window.
160
+
161
+ In this example, bookings are only allowed starting from next week up to 3 months from now.
162
+
163
+ \`\`\`typescript
164
+ options: {
165
+ minDate: nextWeek,
166
+ maxDate: threeMonthsLater
167
+ }
168
+ \`\`\`
169
+ `,
170
+ },
171
+ },
172
+ },
173
+ };
174
+ /**
175
+ * Require a minimum number of days in the selected range.
176
+ */
177
+ export const MinDays = {
178
+ args: {
179
+ placeholder: "Minimum 3 nights",
180
+ options: {
181
+ autoApply: true,
182
+ minDate: today,
183
+ minDays: 3,
184
+ format: 'DD MMM YYYY',
185
+ numberOfColumns: 2,
186
+ numberOfMonths: 2,
187
+ tooltipText: {
188
+ one: 'night',
189
+ other: 'nights',
190
+ },
191
+ tooltipNumber: (totalDays) => totalDays - 1,
192
+ }
193
+ },
194
+ parameters: {
195
+ docs: {
196
+ description: {
197
+ story: `
198
+ ### Minimum Days
199
+
200
+ Require a minimum number of days in the range selection.
201
+
202
+ - **Type**: \`number\`
203
+ - **Default**: \`undefined\`
204
+
205
+ Useful for enforcing minimum stay requirements in hotel bookings.
206
+
207
+ \`\`\`typescript
208
+ options: {
209
+ minDays: 3 // Minimum 3 nights stay
210
+ }
211
+ \`\`\`
212
+ `,
213
+ },
214
+ },
215
+ },
216
+ };
217
+ /**
218
+ * Limit the maximum number of days that can be selected.
219
+ */
220
+ export const MaxDays = {
221
+ args: {
222
+ placeholder: "Maximum 14 nights",
223
+ options: {
224
+ autoApply: true,
225
+ minDate: today,
226
+ maxDays: 14,
227
+ format: 'DD MMM YYYY',
228
+ numberOfColumns: 2,
229
+ numberOfMonths: 2,
230
+ tooltipText: {
231
+ one: 'night',
232
+ other: 'nights',
233
+ },
234
+ tooltipNumber: (totalDays) => totalDays - 1,
235
+ }
236
+ },
237
+ parameters: {
238
+ docs: {
239
+ description: {
240
+ story: `
241
+ ### Maximum Days
242
+
243
+ Limit the maximum number of days in the range selection.
244
+
245
+ - **Type**: \`number\`
246
+ - **Default**: \`undefined\`
247
+
248
+ Useful for limiting booking duration.
249
+
250
+ \`\`\`typescript
251
+ options: {
252
+ maxDays: 14 // Maximum 14 nights stay
253
+ }
254
+ \`\`\`
255
+ `,
256
+ },
257
+ },
258
+ },
259
+ };
260
+ /**
261
+ * Combine minDays and maxDays to enforce a stay duration range.
262
+ */
263
+ export const MinMaxDays = {
264
+ args: {
265
+ placeholder: "3-7 nights stay",
266
+ options: {
267
+ autoApply: true,
268
+ minDate: today,
269
+ minDays: 3,
270
+ maxDays: 7,
271
+ format: 'DD MMM YYYY',
272
+ numberOfColumns: 2,
273
+ numberOfMonths: 2,
274
+ tooltipText: {
275
+ one: 'night',
276
+ other: 'nights',
277
+ },
278
+ tooltipNumber: (totalDays) => totalDays - 1,
279
+ }
280
+ },
281
+ parameters: {
282
+ docs: {
283
+ description: {
284
+ story: `
285
+ ### Min/Max Days Combined
286
+
287
+ Enforce a specific range of allowed stay durations.
288
+
289
+ In this example, stays must be between 3 and 7 nights.
290
+
291
+ \`\`\`typescript
292
+ options: {
293
+ minDays: 3,
294
+ maxDays: 7
295
+ }
296
+ \`\`\`
297
+ `,
298
+ },
299
+ },
300
+ },
301
+ };
@@ -0,0 +1,42 @@
1
+ import type { Meta, StoryObj } from "@storybook/vue3";
2
+ import RangepickerInput from "./RangepickerInput.vue";
3
+ /**
4
+ * Stories demonstrating formatting and display 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
+ * Default format: DD MMM YYYY (e.g., "26 Jan 2026")
12
+ */
13
+ export declare const DefaultFormat: Story;
14
+ /**
15
+ * ISO format: YYYY-MM-DD (e.g., "2026-01-26")
16
+ */
17
+ export declare const ISOFormat: Story;
18
+ /**
19
+ * US format: MM/DD/YYYY (e.g., "01/26/2026")
20
+ */
21
+ export declare const USFormat: Story;
22
+ /**
23
+ * European format: DD/MM/YYYY (e.g., "26/01/2026")
24
+ */
25
+ export declare const EuropeanFormat: Story;
26
+ /**
27
+ * Full month name format: D MMMM YYYY (e.g., "26 January 2026")
28
+ */
29
+ export declare const FullMonthFormat: Story;
30
+ /**
31
+ * Short format without year: DD MMM (e.g., "26 Jan")
32
+ */
33
+ export declare const ShortFormat: Story;
34
+ /**
35
+ * Custom placeholder text
36
+ */
37
+ export declare const CustomPlaceholder: Story;
38
+ /**
39
+ * Booking-style placeholder
40
+ */
41
+ export declare const BookingPlaceholder: Story;
42
+ //# sourceMappingURL=RangepickerFormatting.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RangepickerFormatting.stories.d.ts","sourceRoot":"","sources":["../src/RangepickerFormatting.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,CA0EvC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,KA8B3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,KAgCvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,KA8BtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,KA8B5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,KA8B7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,KAgCzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,KA6B/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,KA8BhC,CAAC"}