@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
|
@@ -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,34 @@
|
|
|
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
|
+
* Regional formats with dropdown to switch between US and European
|
|
20
|
+
*/
|
|
21
|
+
export declare const RegionalFormats: Story;
|
|
22
|
+
/**
|
|
23
|
+
* Full month name format: D MMMM YYYY (e.g., "26 January 2026")
|
|
24
|
+
*/
|
|
25
|
+
export declare const FullMonthFormat: Story;
|
|
26
|
+
/**
|
|
27
|
+
* Short format without year: DD MMM (e.g., "26 Jan")
|
|
28
|
+
*/
|
|
29
|
+
export declare const ShortFormat: Story;
|
|
30
|
+
/**
|
|
31
|
+
* Custom placeholder text
|
|
32
|
+
*/
|
|
33
|
+
export declare const CustomPlaceholder: Story;
|
|
34
|
+
//# 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,CA8EvC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,KA+B3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,KAiCvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,KAiD7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,KA+B7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,KAiCzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,KA8B/B,CAAC"}
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { ref, watch } from "vue";
|
|
2
|
+
import RangepickerInput from "./RangepickerInput.vue";
|
|
3
|
+
/**
|
|
4
|
+
* Stories demonstrating formatting and display options
|
|
5
|
+
* for the Rangepicker component.
|
|
6
|
+
*/
|
|
7
|
+
const meta = {
|
|
8
|
+
title: "Components/Rangepicker/Formatting",
|
|
9
|
+
component: RangepickerInput,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
parameters: {
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component: `
|
|
15
|
+
## Formatting
|
|
16
|
+
|
|
17
|
+
Configure how dates are displayed in the input field and calendar.
|
|
18
|
+
The component uses [dayjs](https://day.js.org/docs/en/display/format) format tokens.
|
|
19
|
+
|
|
20
|
+
### Common Format Tokens
|
|
21
|
+
|
|
22
|
+
| Token | Output | Description |
|
|
23
|
+
|-------|--------|-------------|
|
|
24
|
+
| \`DD\` | 01-31 | Day of month (2 digits) |
|
|
25
|
+
| \`D\` | 1-31 | Day of month |
|
|
26
|
+
| \`MMM\` | Jan-Dec | Month abbreviation |
|
|
27
|
+
| \`MMMM\` | January-December | Full month name |
|
|
28
|
+
| \`MM\` | 01-12 | Month (2 digits) |
|
|
29
|
+
| \`YYYY\` | 2026 | 4-digit year |
|
|
30
|
+
| \`YY\` | 26 | 2-digit year |
|
|
31
|
+
`,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
argTypes: {
|
|
36
|
+
placeholder: {
|
|
37
|
+
control: "text",
|
|
38
|
+
description: "Placeholder text shown when no date is selected",
|
|
39
|
+
table: {
|
|
40
|
+
type: { summary: "string" },
|
|
41
|
+
defaultValue: { summary: "Select dates" },
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
options: {
|
|
45
|
+
control: "object",
|
|
46
|
+
description: "Configuration options including format settings",
|
|
47
|
+
},
|
|
48
|
+
variant: {
|
|
49
|
+
control: "select",
|
|
50
|
+
options: ["desktop", "mobile"],
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
args: {
|
|
54
|
+
id: "dates",
|
|
55
|
+
name: "dates",
|
|
56
|
+
variant: "desktop",
|
|
57
|
+
},
|
|
58
|
+
render: (args) => ({
|
|
59
|
+
components: { RangepickerInput },
|
|
60
|
+
setup() {
|
|
61
|
+
const modelValue = ref(args.modelValue ?? "");
|
|
62
|
+
watch(() => args.modelValue, (value) => {
|
|
63
|
+
const nextValue = value ?? "";
|
|
64
|
+
if (nextValue !== modelValue.value) {
|
|
65
|
+
modelValue.value = nextValue;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
return { args, modelValue };
|
|
69
|
+
},
|
|
70
|
+
template: `
|
|
71
|
+
<div style="padding: 2rem; background: #f5f5f5; min-height: 400px;">
|
|
72
|
+
<RangepickerInput v-bind="args" v-model="modelValue" class="form-control mb-0 shadow-none text-black lg:pl-2 border-0 w-full" />
|
|
73
|
+
<div v-if="modelValue" style="margin-top: 1rem; padding: 0.75rem; background: white; border-radius: 0.375rem; border: 1px solid #e5e7eb;">
|
|
74
|
+
<strong style="color: #374151;">Selected: </strong>
|
|
75
|
+
<span style="color: #059669; font-family: monospace;">{{ modelValue }}</span>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
`
|
|
79
|
+
})
|
|
80
|
+
};
|
|
81
|
+
export default meta;
|
|
82
|
+
/**
|
|
83
|
+
* Default format: DD MMM YYYY (e.g., "26 Jan 2026")
|
|
84
|
+
*/
|
|
85
|
+
export const DefaultFormat = {
|
|
86
|
+
args: {
|
|
87
|
+
placeholder: "Check in / Check out",
|
|
88
|
+
modelValue: "02 Feb 2026 - 04 Feb 2026",
|
|
89
|
+
options: {
|
|
90
|
+
autoApply: true,
|
|
91
|
+
minDate: new Date(),
|
|
92
|
+
format: 'DD MMM YYYY',
|
|
93
|
+
numberOfColumns: 2,
|
|
94
|
+
numberOfMonths: 2,
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
parameters: {
|
|
98
|
+
docs: {
|
|
99
|
+
description: {
|
|
100
|
+
story: `
|
|
101
|
+
### Default Format
|
|
102
|
+
|
|
103
|
+
The default date format: \`DD MMM YYYY\`
|
|
104
|
+
|
|
105
|
+
**Output**: \`26 Jan 2026 - 30 Jan 2026\`
|
|
106
|
+
|
|
107
|
+
\`\`\`typescript
|
|
108
|
+
options: {
|
|
109
|
+
format: 'DD MMM YYYY'
|
|
110
|
+
}
|
|
111
|
+
\`\`\`
|
|
112
|
+
`,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* ISO format: YYYY-MM-DD (e.g., "2026-01-26")
|
|
119
|
+
*/
|
|
120
|
+
export const ISOFormat = {
|
|
121
|
+
args: {
|
|
122
|
+
placeholder: "Select dates (ISO format)",
|
|
123
|
+
modelValue: "2026-02-02 - 2026-02-04",
|
|
124
|
+
options: {
|
|
125
|
+
autoApply: true,
|
|
126
|
+
minDate: new Date(),
|
|
127
|
+
format: 'YYYY-MM-DD',
|
|
128
|
+
numberOfColumns: 2,
|
|
129
|
+
numberOfMonths: 2,
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
parameters: {
|
|
133
|
+
docs: {
|
|
134
|
+
description: {
|
|
135
|
+
story: `
|
|
136
|
+
### ISO Format
|
|
137
|
+
|
|
138
|
+
Standard ISO date format: \`YYYY-MM-DD\`
|
|
139
|
+
|
|
140
|
+
**Output**: \`2026-01-26 - 2026-01-30\`
|
|
141
|
+
|
|
142
|
+
Useful for APIs and databases that expect ISO format.
|
|
143
|
+
|
|
144
|
+
\`\`\`typescript
|
|
145
|
+
options: {
|
|
146
|
+
format: 'YYYY-MM-DD'
|
|
147
|
+
}
|
|
148
|
+
\`\`\`
|
|
149
|
+
`,
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
/**
|
|
155
|
+
* Regional formats with dropdown to switch between US and European
|
|
156
|
+
*/
|
|
157
|
+
export const RegionalFormats = {
|
|
158
|
+
args: {
|
|
159
|
+
placeholder: "Select dates",
|
|
160
|
+
modelValue: "02/02/2026 - 02/04/2026",
|
|
161
|
+
options: {
|
|
162
|
+
autoApply: true,
|
|
163
|
+
minDate: new Date(),
|
|
164
|
+
format: 'MM/DD/YYYY',
|
|
165
|
+
numberOfColumns: 2,
|
|
166
|
+
numberOfMonths: 2,
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
argTypes: {
|
|
170
|
+
'options.format': {
|
|
171
|
+
control: 'select',
|
|
172
|
+
options: ['MM/DD/YYYY', 'DD/MM/YYYY'],
|
|
173
|
+
description: 'Date format',
|
|
174
|
+
table: {
|
|
175
|
+
type: { summary: 'string' },
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
parameters: {
|
|
180
|
+
docs: {
|
|
181
|
+
description: {
|
|
182
|
+
story: `
|
|
183
|
+
### Regional Formats
|
|
184
|
+
|
|
185
|
+
Switch between US and European date formats using the dropdown control.
|
|
186
|
+
|
|
187
|
+
**US Format** (\`MM/DD/YYYY\`): \`01/26/2026 - 01/30/2026\`
|
|
188
|
+
|
|
189
|
+
**European Format** (\`DD/MM/YYYY\`): \`26/01/2026 - 30/01/2026\`
|
|
190
|
+
|
|
191
|
+
\`\`\`typescript
|
|
192
|
+
// US Format
|
|
193
|
+
options: {
|
|
194
|
+
format: 'MM/DD/YYYY'
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// European Format
|
|
198
|
+
options: {
|
|
199
|
+
format: 'DD/MM/YYYY'
|
|
200
|
+
}
|
|
201
|
+
\`\`\`
|
|
202
|
+
`,
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* Full month name format: D MMMM YYYY (e.g., "26 January 2026")
|
|
209
|
+
*/
|
|
210
|
+
export const FullMonthFormat = {
|
|
211
|
+
args: {
|
|
212
|
+
placeholder: "Select dates",
|
|
213
|
+
modelValue: "2 February 2026 - 4 February 2026",
|
|
214
|
+
options: {
|
|
215
|
+
autoApply: true,
|
|
216
|
+
minDate: new Date(),
|
|
217
|
+
format: 'D MMMM YYYY',
|
|
218
|
+
numberOfColumns: 2,
|
|
219
|
+
numberOfMonths: 2,
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
parameters: {
|
|
223
|
+
docs: {
|
|
224
|
+
description: {
|
|
225
|
+
story: `
|
|
226
|
+
### Full Month Name
|
|
227
|
+
|
|
228
|
+
Display full month name: \`D MMMM YYYY\`
|
|
229
|
+
|
|
230
|
+
**Output**: \`26 January 2026 - 30 January 2026\`
|
|
231
|
+
|
|
232
|
+
\`\`\`typescript
|
|
233
|
+
options: {
|
|
234
|
+
format: 'D MMMM YYYY'
|
|
235
|
+
}
|
|
236
|
+
\`\`\`
|
|
237
|
+
`,
|
|
238
|
+
},
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
/**
|
|
243
|
+
* Short format without year: DD MMM (e.g., "26 Jan")
|
|
244
|
+
*/
|
|
245
|
+
export const ShortFormat = {
|
|
246
|
+
args: {
|
|
247
|
+
placeholder: "Select dates",
|
|
248
|
+
modelValue: "02 Feb - 04 Feb",
|
|
249
|
+
options: {
|
|
250
|
+
autoApply: true,
|
|
251
|
+
minDate: new Date(),
|
|
252
|
+
format: 'DD MMM',
|
|
253
|
+
numberOfColumns: 2,
|
|
254
|
+
numberOfMonths: 2,
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
parameters: {
|
|
258
|
+
docs: {
|
|
259
|
+
description: {
|
|
260
|
+
story: `
|
|
261
|
+
### Short Format (No Year)
|
|
262
|
+
|
|
263
|
+
Compact format without year: \`DD MMM\`
|
|
264
|
+
|
|
265
|
+
**Output**: \`26 Jan - 30 Jan\`
|
|
266
|
+
|
|
267
|
+
Useful for short-term bookings where the year is implied.
|
|
268
|
+
|
|
269
|
+
\`\`\`typescript
|
|
270
|
+
options: {
|
|
271
|
+
format: 'DD MMM'
|
|
272
|
+
}
|
|
273
|
+
\`\`\`
|
|
274
|
+
`,
|
|
275
|
+
},
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
};
|
|
279
|
+
/**
|
|
280
|
+
* Custom placeholder text
|
|
281
|
+
*/
|
|
282
|
+
export const CustomPlaceholder = {
|
|
283
|
+
args: {
|
|
284
|
+
placeholder: "When are you traveling?",
|
|
285
|
+
modelValue: "02 Feb 2026 - 04 Feb 2026",
|
|
286
|
+
options: {
|
|
287
|
+
autoApply: true,
|
|
288
|
+
minDate: new Date(),
|
|
289
|
+
format: 'DD MMM YYYY',
|
|
290
|
+
numberOfColumns: 2,
|
|
291
|
+
numberOfMonths: 2,
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
parameters: {
|
|
295
|
+
docs: {
|
|
296
|
+
description: {
|
|
297
|
+
story: `
|
|
298
|
+
### Custom Placeholder
|
|
299
|
+
|
|
300
|
+
Set a custom placeholder text for the input field.
|
|
301
|
+
|
|
302
|
+
- **Type**: \`string\`
|
|
303
|
+
- **Default**: \`'Select dates'\`
|
|
304
|
+
|
|
305
|
+
\`\`\`vue
|
|
306
|
+
<RangepickerInput placeholder="When are you traveling?" />
|
|
307
|
+
\`\`\`
|
|
308
|
+
`,
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
};
|
|
@@ -1,14 +1,53 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/vue3";
|
|
2
2
|
import RangepickerInput from "./RangepickerInput.vue";
|
|
3
|
+
/**
|
|
4
|
+
* # Rangepicker
|
|
5
|
+
*
|
|
6
|
+
* A flexible date range picker component for Vue 3 applications.
|
|
7
|
+
*
|
|
8
|
+
* ## Features
|
|
9
|
+
*
|
|
10
|
+
* - 📅 Date range selection with visual calendar
|
|
11
|
+
* - 📱 Responsive design (desktop dropdown / mobile bottom sheet)
|
|
12
|
+
* - 🎨 Customizable colors via props
|
|
13
|
+
* - 🔒 Date constraints (min/max dates, min/max days)
|
|
14
|
+
* - 🎯 Holiday and disabled dates support
|
|
15
|
+
* - 🌍 Flexible date formatting via dayjs
|
|
16
|
+
*
|
|
17
|
+
* ## Quick Start
|
|
18
|
+
*
|
|
19
|
+
* ```vue
|
|
20
|
+
* <template>
|
|
21
|
+
* <RangepickerInput
|
|
22
|
+
* v-model="dates"
|
|
23
|
+
* placeholder="Check in / Check out"
|
|
24
|
+
* :options="{ minDate: new Date(), format: 'DD MMM YYYY' }"
|
|
25
|
+
* />
|
|
26
|
+
* </template>
|
|
27
|
+
* ```
|
|
28
|
+
*
|
|
29
|
+
* ## Props Documentation
|
|
30
|
+
*
|
|
31
|
+
* Explore the categorized stories in the sidebar:
|
|
32
|
+
* - **Modes** - Display variants and behavior modes
|
|
33
|
+
* - **Constraints** - Date limits and validation
|
|
34
|
+
* - **Formatting** - Date format patterns
|
|
35
|
+
* - **Theming** - Color customization
|
|
36
|
+
* - **Special Dates** - Holidays and disabled dates
|
|
37
|
+
*/
|
|
3
38
|
declare const meta: Meta<typeof RangepickerInput>;
|
|
4
39
|
export default meta;
|
|
5
40
|
type Story = StoryObj<typeof RangepickerInput>;
|
|
41
|
+
/**
|
|
42
|
+
* Default rangepicker with standard configuration.
|
|
43
|
+
* Click the input to open the calendar and select a date range.
|
|
44
|
+
*
|
|
45
|
+
* Explore the categorized stories in the sidebar to learn about different features:
|
|
46
|
+
* - **Modes** - Display variants (desktop/mobile) and behavior modes
|
|
47
|
+
* - **Constraints** - Date limits and validation rules
|
|
48
|
+
* - **Formatting** - Date format patterns
|
|
49
|
+
* - **Theming** - Color and visual customization
|
|
50
|
+
* - **Special Dates** - Holidays and disabled dates
|
|
51
|
+
*/
|
|
6
52
|
export declare const Default: Story;
|
|
7
|
-
export declare const Mobile: Story;
|
|
8
|
-
export declare const CustomBlueColor: Story;
|
|
9
|
-
export declare const CustomPurpleColor: Story;
|
|
10
|
-
export declare const CustomRedColor: Story;
|
|
11
|
-
export declare const CustomGreenColor: Story;
|
|
12
|
-
export declare const CustomOrangeColor: Story;
|
|
13
|
-
export declare const CustomPinkColor: Story;
|
|
14
53
|
//# sourceMappingURL=RangepickerInput.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RangepickerInput.stories.d.ts","sourceRoot":"","sources":["../src/RangepickerInput.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,gBAAgB,MAAM,wBAAwB,CAAC;AAEtD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,gBAAgB,
|
|
1
|
+
{"version":3,"file":"RangepickerInput.stories.d.ts","sourceRoot":"","sources":["../src/RangepickerInput.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,gBAAgB,MAAM,wBAAwB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,gBAAgB,CAyIvC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE/C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,OAAO,EAAE,KAqBrB,CAAC"}
|