@archpublicwebsite/rangepicker 1.0.13 → 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 +47 -0
- 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 +42 -0
- package/dist/RangepickerFormatting.stories.d.ts.map +1 -0
- package/dist/RangepickerFormatting.stories.js +352 -0
- package/dist/RangepickerInput.stories.d.ts +42 -6
- package/dist/RangepickerInput.stories.d.ts.map +1 -1
- package/dist/RangepickerInput.stories.js +148 -47
- package/dist/RangepickerInput.vue.d.ts +1 -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 +238 -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 +54 -0
- package/dist/RangepickerTheming.stories.d.ts.map +1 -0
- package/dist/RangepickerTheming.stories.js +379 -0
- package/dist/rangepicker.js +31 -32
- 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 +4 -8
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { ref, watch } from "vue";
|
|
2
|
+
import RangepickerInput from "./RangepickerInput.vue";
|
|
3
|
+
/**
|
|
4
|
+
* Stories demonstrating different display modes and behaviors
|
|
5
|
+
* for the Rangepicker component.
|
|
6
|
+
*/
|
|
7
|
+
const meta = {
|
|
8
|
+
title: "Components/Rangepicker/Modes",
|
|
9
|
+
component: RangepickerInput,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
parameters: {
|
|
12
|
+
docs: {
|
|
13
|
+
description: {
|
|
14
|
+
component: `
|
|
15
|
+
## Modes
|
|
16
|
+
|
|
17
|
+
Set the default mode for the rangepicker. The component supports different display variants
|
|
18
|
+
and behavior modes to fit various use cases.
|
|
19
|
+
|
|
20
|
+
> **TIP**: Depending on the mode, the picker behavior might be different,
|
|
21
|
+
> so make sure to use the proper configuration.
|
|
22
|
+
`,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
argTypes: {
|
|
27
|
+
variant: {
|
|
28
|
+
control: "select",
|
|
29
|
+
options: ["desktop", "mobile"],
|
|
30
|
+
description: "Display variant - desktop shows dropdown, mobile shows bottom sheet",
|
|
31
|
+
table: {
|
|
32
|
+
type: { summary: "'desktop' | 'mobile'" },
|
|
33
|
+
defaultValue: { summary: "desktop" },
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
options: {
|
|
37
|
+
control: "object",
|
|
38
|
+
description: "Configuration options for the rangepicker",
|
|
39
|
+
},
|
|
40
|
+
primaryColor: {
|
|
41
|
+
control: "color",
|
|
42
|
+
description: "Primary color for selected dates and highlights (HEX format)",
|
|
43
|
+
},
|
|
44
|
+
secondaryColor: {
|
|
45
|
+
control: "color",
|
|
46
|
+
description: "Secondary color for hover states (HEX format)",
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
args: {
|
|
50
|
+
placeholder: "Check in / Check out",
|
|
51
|
+
id: "dates",
|
|
52
|
+
name: "dates",
|
|
53
|
+
variant: "desktop",
|
|
54
|
+
options: {
|
|
55
|
+
autoApply: true,
|
|
56
|
+
allowRepick: true,
|
|
57
|
+
dropdowns: {
|
|
58
|
+
minYear: new Date().getFullYear(),
|
|
59
|
+
maxYear: new Date().getFullYear() + 2,
|
|
60
|
+
months: true,
|
|
61
|
+
years: true,
|
|
62
|
+
},
|
|
63
|
+
startDate: new Date(),
|
|
64
|
+
minDate: new Date(),
|
|
65
|
+
format: 'DD MMM YYYY',
|
|
66
|
+
numberOfColumns: 2,
|
|
67
|
+
numberOfMonths: 2,
|
|
68
|
+
singleMode: false,
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
render: (args) => ({
|
|
72
|
+
components: { RangepickerInput },
|
|
73
|
+
setup() {
|
|
74
|
+
const modelValue = ref(args.modelValue ?? "");
|
|
75
|
+
watch(() => args.modelValue, (value) => {
|
|
76
|
+
const nextValue = value ?? "";
|
|
77
|
+
if (nextValue !== modelValue.value) {
|
|
78
|
+
modelValue.value = nextValue;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
return { args, modelValue };
|
|
82
|
+
},
|
|
83
|
+
template: `
|
|
84
|
+
<div style="padding: 2rem; background: #f5f5f5; min-height: 400px;">
|
|
85
|
+
<RangepickerInput v-bind="args" v-model="modelValue" class="form-control mb-0 shadow-none text-black lg:pl-2 border-0 w-full" />
|
|
86
|
+
</div>
|
|
87
|
+
`
|
|
88
|
+
})
|
|
89
|
+
};
|
|
90
|
+
export default meta;
|
|
91
|
+
/**
|
|
92
|
+
* Desktop variant displays the calendar as a dropdown below the input field.
|
|
93
|
+
* Best for desktop/laptop screens with sufficient viewport space.
|
|
94
|
+
*/
|
|
95
|
+
export const DesktopVariant = {
|
|
96
|
+
args: {
|
|
97
|
+
variant: "desktop",
|
|
98
|
+
},
|
|
99
|
+
parameters: {
|
|
100
|
+
docs: {
|
|
101
|
+
description: {
|
|
102
|
+
story: `
|
|
103
|
+
### Desktop Variant
|
|
104
|
+
|
|
105
|
+
The default display mode. Shows the calendar as a floating dropdown below the input.
|
|
106
|
+
|
|
107
|
+
- **Type**: \`'desktop' | 'mobile'\`
|
|
108
|
+
- **Default**: \`'desktop'\`
|
|
109
|
+
|
|
110
|
+
Best suited for desktop and laptop screens where there's sufficient viewport space.
|
|
111
|
+
`,
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Mobile variant displays the calendar as a bottom sheet overlay.
|
|
118
|
+
* Optimized for touch devices and smaller screens.
|
|
119
|
+
*/
|
|
120
|
+
export const MobileVariant = {
|
|
121
|
+
args: {
|
|
122
|
+
variant: "mobile",
|
|
123
|
+
},
|
|
124
|
+
parameters: {
|
|
125
|
+
docs: {
|
|
126
|
+
description: {
|
|
127
|
+
story: `
|
|
128
|
+
### Mobile Variant
|
|
129
|
+
|
|
130
|
+
Displays the calendar as a bottom sheet overlay, optimized for mobile devices.
|
|
131
|
+
|
|
132
|
+
- **Type**: \`'desktop' | 'mobile'\`
|
|
133
|
+
- **Value**: \`'mobile'\`
|
|
134
|
+
|
|
135
|
+
Provides a touch-friendly interface with larger tap targets.
|
|
136
|
+
`,
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
/**
|
|
142
|
+
* Single date mode allows selecting only one date instead of a range.
|
|
143
|
+
* Useful for single date inputs like birth dates or event dates.
|
|
144
|
+
*/
|
|
145
|
+
export const SingleMode = {
|
|
146
|
+
args: {
|
|
147
|
+
variant: "desktop",
|
|
148
|
+
placeholder: "Select date",
|
|
149
|
+
options: {
|
|
150
|
+
autoApply: true,
|
|
151
|
+
singleMode: true,
|
|
152
|
+
format: 'DD MMM YYYY',
|
|
153
|
+
numberOfColumns: 1,
|
|
154
|
+
numberOfMonths: 1,
|
|
155
|
+
minDate: new Date(),
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
parameters: {
|
|
159
|
+
docs: {
|
|
160
|
+
description: {
|
|
161
|
+
story: `
|
|
162
|
+
### Single Mode
|
|
163
|
+
|
|
164
|
+
Enable selecting a single date instead of a date range.
|
|
165
|
+
|
|
166
|
+
- **Type**: \`boolean\`
|
|
167
|
+
- **Default**: \`false\`
|
|
168
|
+
|
|
169
|
+
When enabled, clicking a date immediately selects it without requiring a second click for the end date.
|
|
170
|
+
`,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* Auto Apply mode automatically confirms the selection when both dates are picked.
|
|
177
|
+
* No need to click an Apply/Confirm button.
|
|
178
|
+
*/
|
|
179
|
+
export const AutoApply = {
|
|
180
|
+
args: {
|
|
181
|
+
variant: "desktop",
|
|
182
|
+
options: {
|
|
183
|
+
autoApply: true,
|
|
184
|
+
format: 'DD MMM YYYY',
|
|
185
|
+
numberOfColumns: 2,
|
|
186
|
+
numberOfMonths: 2,
|
|
187
|
+
minDate: new Date(),
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
parameters: {
|
|
191
|
+
docs: {
|
|
192
|
+
description: {
|
|
193
|
+
story: `
|
|
194
|
+
### Auto Apply
|
|
195
|
+
|
|
196
|
+
Automatically apply selection without requiring an Apply button click.
|
|
197
|
+
|
|
198
|
+
- **Type**: \`boolean\`
|
|
199
|
+
- **Default**: \`false\`
|
|
200
|
+
|
|
201
|
+
When enabled, the selection is confirmed immediately after picking the end date. When disabled, users must click an Apply button to confirm.
|
|
202
|
+
`,
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* Manual Apply mode requires clicking an Apply button to confirm selection.
|
|
209
|
+
* Gives users a chance to review before confirming.
|
|
210
|
+
*/
|
|
211
|
+
export const ManualApply = {
|
|
212
|
+
args: {
|
|
213
|
+
variant: "desktop",
|
|
214
|
+
options: {
|
|
215
|
+
autoApply: false,
|
|
216
|
+
format: 'DD MMM YYYY',
|
|
217
|
+
numberOfColumns: 2,
|
|
218
|
+
numberOfMonths: 2,
|
|
219
|
+
minDate: new Date(),
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
parameters: {
|
|
223
|
+
docs: {
|
|
224
|
+
description: {
|
|
225
|
+
story: `
|
|
226
|
+
### Manual Apply
|
|
227
|
+
|
|
228
|
+
Require user to click Apply button to confirm their selection.
|
|
229
|
+
|
|
230
|
+
- **Type**: \`boolean\`
|
|
231
|
+
- **Value**: \`false\`
|
|
232
|
+
|
|
233
|
+
When \`autoApply\` is set to \`false\`, users must explicitly confirm their date selection by clicking an Apply button. This gives users a chance to review their selection before confirming.
|
|
234
|
+
`,
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/vue3";
|
|
2
|
+
import Rangepicker from "./Rangepicker.vue";
|
|
3
|
+
/**
|
|
4
|
+
* Stories demonstrating special dates functionality
|
|
5
|
+
* including holidays and disabled dates.
|
|
6
|
+
*/
|
|
7
|
+
declare const meta: Meta<typeof Rangepicker>;
|
|
8
|
+
export default meta;
|
|
9
|
+
type Story = StoryObj<typeof Rangepicker>;
|
|
10
|
+
/**
|
|
11
|
+
* Disable specific dates to prevent selection.
|
|
12
|
+
* In this example, all Tuesdays are disabled.
|
|
13
|
+
*/
|
|
14
|
+
export declare const DisabledDates: Story;
|
|
15
|
+
/**
|
|
16
|
+
* Mark specific dates as holidays with visual styling.
|
|
17
|
+
*/
|
|
18
|
+
export declare const Holidays: Story;
|
|
19
|
+
/**
|
|
20
|
+
* Combine disabled dates and holidays for comprehensive date management.
|
|
21
|
+
*/
|
|
22
|
+
export declare const CombinedSpecialDates: Story;
|
|
23
|
+
/**
|
|
24
|
+
* Block specific date ranges (e.g., maintenance periods).
|
|
25
|
+
*/
|
|
26
|
+
export declare const BlockedDateRange: Story;
|
|
27
|
+
/**
|
|
28
|
+
* Holiday weekends - mark Friday through Sunday as holidays.
|
|
29
|
+
*/
|
|
30
|
+
export declare const HolidayWeekends: Story;
|
|
31
|
+
//# sourceMappingURL=RangepickerSpecialDates.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RangepickerSpecialDates.stories.d.ts","sourceRoot":"","sources":["../src/RangepickerSpecialDates.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,WAAW,MAAM,mBAAmB,CAAC;AAgC5C;;;GAGG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,WAAW,CA+ElC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,WAAW,CAAC,CAAC;AAE1C;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,KAiC3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,KA+BtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,KA+BlC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,KAoC9B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,KAqC7B,CAAC"}
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
import Rangepicker from "./Rangepicker.vue";
|
|
3
|
+
// Helper to generate dates
|
|
4
|
+
const today = new Date();
|
|
5
|
+
const getDate = (daysFromToday) => {
|
|
6
|
+
const date = new Date(today);
|
|
7
|
+
date.setDate(today.getDate() + daysFromToday);
|
|
8
|
+
return date;
|
|
9
|
+
};
|
|
10
|
+
// Generate sample disabled dates (every Tuesday for the next 2 months)
|
|
11
|
+
const generateDisabledDates = () => {
|
|
12
|
+
const dates = [];
|
|
13
|
+
for (let i = 0; i < 60; i++) {
|
|
14
|
+
const date = getDate(i);
|
|
15
|
+
if (date.getDay() === 2) { // Tuesday
|
|
16
|
+
dates.push(new Date(date));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return dates;
|
|
20
|
+
};
|
|
21
|
+
// Generate sample holidays
|
|
22
|
+
const generateHolidays = () => {
|
|
23
|
+
return [
|
|
24
|
+
getDate(7), // A week from now
|
|
25
|
+
getDate(14), // Two weeks from now
|
|
26
|
+
getDate(21), // Three weeks from now
|
|
27
|
+
getDate(30), // One month from now
|
|
28
|
+
];
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Stories demonstrating special dates functionality
|
|
32
|
+
* including holidays and disabled dates.
|
|
33
|
+
*/
|
|
34
|
+
const meta = {
|
|
35
|
+
title: "Components/Rangepicker/Special Dates",
|
|
36
|
+
component: Rangepicker,
|
|
37
|
+
tags: ['autodocs'],
|
|
38
|
+
parameters: {
|
|
39
|
+
docs: {
|
|
40
|
+
description: {
|
|
41
|
+
component: `
|
|
42
|
+
## Special Dates
|
|
43
|
+
|
|
44
|
+
Configure special dates such as holidays and disabled dates.
|
|
45
|
+
These dates can be visually distinguished and/or made non-selectable.
|
|
46
|
+
|
|
47
|
+
### Props
|
|
48
|
+
|
|
49
|
+
| Prop | Type | Description |
|
|
50
|
+
|------|------|-------------|
|
|
51
|
+
| \`disabledDates\` | \`(string \\| Date)[]\` | Array of dates that cannot be selected |
|
|
52
|
+
| \`holidays\` | \`(string \\| Date)[]\` | Array of dates marked as holidays (visually styled) |
|
|
53
|
+
|
|
54
|
+
> **INFO**: Disabled dates appear grayed out and cannot be clicked.
|
|
55
|
+
> Holiday dates are visually highlighted but remain selectable unless also in disabledDates.
|
|
56
|
+
`,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
argTypes: {
|
|
61
|
+
disabledDates: {
|
|
62
|
+
control: "object",
|
|
63
|
+
description: "Array of dates that should be disabled for selection",
|
|
64
|
+
table: {
|
|
65
|
+
type: { summary: "(string | Date)[]" },
|
|
66
|
+
defaultValue: { summary: "[]" },
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
holidays: {
|
|
70
|
+
control: "object",
|
|
71
|
+
description: "Array of dates to mark as holidays",
|
|
72
|
+
table: {
|
|
73
|
+
type: { summary: "(string | Date)[]" },
|
|
74
|
+
defaultValue: { summary: "[]" },
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
variant: {
|
|
78
|
+
control: "select",
|
|
79
|
+
options: ["desktop", "mobile"],
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
args: {
|
|
83
|
+
isOpen: true,
|
|
84
|
+
variant: "desktop",
|
|
85
|
+
valueOfMonths: 2,
|
|
86
|
+
valueOfColumns: 2,
|
|
87
|
+
format: "DD MMM YYYY",
|
|
88
|
+
autoApply: true,
|
|
89
|
+
showTooltip: true,
|
|
90
|
+
minDate: today,
|
|
91
|
+
},
|
|
92
|
+
render: (args) => ({
|
|
93
|
+
components: { Rangepicker },
|
|
94
|
+
setup() {
|
|
95
|
+
const modelValue = ref({ startDate: "", endDate: "" });
|
|
96
|
+
const isOpen = ref(args.isOpen ?? true);
|
|
97
|
+
return { args, modelValue, isOpen };
|
|
98
|
+
},
|
|
99
|
+
template: `
|
|
100
|
+
<div style="padding: 2rem; background: #f5f5f5; min-height: 450px;">
|
|
101
|
+
<p style="margin-bottom: 1rem; color: #666; font-size: 14px;">
|
|
102
|
+
Calendar is displayed inline for demonstration. In normal usage, it appears as a popup.
|
|
103
|
+
</p>
|
|
104
|
+
<Rangepicker
|
|
105
|
+
v-bind="args"
|
|
106
|
+
v-model="modelValue"
|
|
107
|
+
v-model:is-open="isOpen"
|
|
108
|
+
/>
|
|
109
|
+
</div>
|
|
110
|
+
`
|
|
111
|
+
})
|
|
112
|
+
};
|
|
113
|
+
export default meta;
|
|
114
|
+
/**
|
|
115
|
+
* Disable specific dates to prevent selection.
|
|
116
|
+
* In this example, all Tuesdays are disabled.
|
|
117
|
+
*/
|
|
118
|
+
export const DisabledDates = {
|
|
119
|
+
args: {
|
|
120
|
+
disabledDates: generateDisabledDates(),
|
|
121
|
+
},
|
|
122
|
+
parameters: {
|
|
123
|
+
docs: {
|
|
124
|
+
description: {
|
|
125
|
+
story: `
|
|
126
|
+
### Disabled Dates
|
|
127
|
+
|
|
128
|
+
Prevent selection of specific dates by passing an array of dates to \`disabledDates\`.
|
|
129
|
+
|
|
130
|
+
In this example, all Tuesdays for the next 2 months are disabled.
|
|
131
|
+
|
|
132
|
+
\`\`\`typescript
|
|
133
|
+
const disabledDates = [
|
|
134
|
+
new Date('2026-01-27'),
|
|
135
|
+
new Date('2026-02-03'),
|
|
136
|
+
new Date('2026-02-10'),
|
|
137
|
+
// ...
|
|
138
|
+
];
|
|
139
|
+
|
|
140
|
+
<Rangepicker :disabled-dates="disabledDates" />
|
|
141
|
+
\`\`\`
|
|
142
|
+
|
|
143
|
+
**Use cases:**
|
|
144
|
+
- Block fully booked dates
|
|
145
|
+
- Disable maintenance days
|
|
146
|
+
- Prevent selection of past dates
|
|
147
|
+
`,
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* Mark specific dates as holidays with visual styling.
|
|
154
|
+
*/
|
|
155
|
+
export const Holidays = {
|
|
156
|
+
args: {
|
|
157
|
+
holidays: generateHolidays(),
|
|
158
|
+
},
|
|
159
|
+
parameters: {
|
|
160
|
+
docs: {
|
|
161
|
+
description: {
|
|
162
|
+
story: `
|
|
163
|
+
### Holidays
|
|
164
|
+
|
|
165
|
+
Mark specific dates as holidays. These dates are visually distinguished
|
|
166
|
+
but remain selectable unless also in \`disabledDates\`.
|
|
167
|
+
|
|
168
|
+
\`\`\`typescript
|
|
169
|
+
const holidays = [
|
|
170
|
+
new Date('2026-01-01'), // New Year's Day
|
|
171
|
+
new Date('2026-12-25'), // Christmas
|
|
172
|
+
new Date('2026-12-26'), // Boxing Day
|
|
173
|
+
];
|
|
174
|
+
|
|
175
|
+
<Rangepicker :holidays="holidays" />
|
|
176
|
+
\`\`\`
|
|
177
|
+
|
|
178
|
+
**Use cases:**
|
|
179
|
+
- Highlight public holidays
|
|
180
|
+
- Mark special rate days
|
|
181
|
+
- Show peak season dates
|
|
182
|
+
`,
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* Combine disabled dates and holidays for comprehensive date management.
|
|
189
|
+
*/
|
|
190
|
+
export const CombinedSpecialDates = {
|
|
191
|
+
args: {
|
|
192
|
+
disabledDates: generateDisabledDates(),
|
|
193
|
+
holidays: generateHolidays(),
|
|
194
|
+
},
|
|
195
|
+
parameters: {
|
|
196
|
+
docs: {
|
|
197
|
+
description: {
|
|
198
|
+
story: `
|
|
199
|
+
### Combined: Disabled Dates & Holidays
|
|
200
|
+
|
|
201
|
+
Combine both props for comprehensive date management.
|
|
202
|
+
|
|
203
|
+
- **Disabled dates** (Tuesdays): Cannot be selected, shown grayed out
|
|
204
|
+
- **Holidays**: Visually highlighted, can be selected
|
|
205
|
+
|
|
206
|
+
\`\`\`typescript
|
|
207
|
+
<Rangepicker
|
|
208
|
+
:disabled-dates="blockedDates"
|
|
209
|
+
:holidays="holidayDates"
|
|
210
|
+
/>
|
|
211
|
+
\`\`\`
|
|
212
|
+
|
|
213
|
+
**Real-world example:**
|
|
214
|
+
- Holidays with premium pricing
|
|
215
|
+
- Maintenance days that block bookings
|
|
216
|
+
- Seasonal closures
|
|
217
|
+
`,
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
/**
|
|
223
|
+
* Block specific date ranges (e.g., maintenance periods).
|
|
224
|
+
*/
|
|
225
|
+
export const BlockedDateRange = {
|
|
226
|
+
args: {
|
|
227
|
+
disabledDates: [
|
|
228
|
+
getDate(10),
|
|
229
|
+
getDate(11),
|
|
230
|
+
getDate(12),
|
|
231
|
+
getDate(13),
|
|
232
|
+
getDate(14),
|
|
233
|
+
],
|
|
234
|
+
},
|
|
235
|
+
parameters: {
|
|
236
|
+
docs: {
|
|
237
|
+
description: {
|
|
238
|
+
story: `
|
|
239
|
+
### Blocked Date Range
|
|
240
|
+
|
|
241
|
+
Block a consecutive range of dates (e.g., for maintenance or closures).
|
|
242
|
+
|
|
243
|
+
In this example, a 5-day period starting 10 days from now is blocked.
|
|
244
|
+
|
|
245
|
+
\`\`\`typescript
|
|
246
|
+
// Block 5 consecutive days
|
|
247
|
+
const maintenancePeriod = [
|
|
248
|
+
new Date('2026-02-05'),
|
|
249
|
+
new Date('2026-02-06'),
|
|
250
|
+
new Date('2026-02-07'),
|
|
251
|
+
new Date('2026-02-08'),
|
|
252
|
+
new Date('2026-02-09'),
|
|
253
|
+
];
|
|
254
|
+
|
|
255
|
+
<Rangepicker :disabled-dates="maintenancePeriod" />
|
|
256
|
+
\`\`\`
|
|
257
|
+
`,
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* Holiday weekends - mark Friday through Sunday as holidays.
|
|
264
|
+
*/
|
|
265
|
+
export const HolidayWeekends = {
|
|
266
|
+
args: {
|
|
267
|
+
holidays: (() => {
|
|
268
|
+
const dates = [];
|
|
269
|
+
// Find the next 4 weekends and mark them as holidays
|
|
270
|
+
for (let i = 0; i < 30; i++) {
|
|
271
|
+
const date = getDate(i);
|
|
272
|
+
const day = date.getDay();
|
|
273
|
+
if (day === 5 || day === 6 || day === 0) { // Fri, Sat, Sun
|
|
274
|
+
dates.push(new Date(date));
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return dates;
|
|
278
|
+
})(),
|
|
279
|
+
},
|
|
280
|
+
parameters: {
|
|
281
|
+
docs: {
|
|
282
|
+
description: {
|
|
283
|
+
story: `
|
|
284
|
+
### Holiday Weekends
|
|
285
|
+
|
|
286
|
+
Mark all weekends as holidays/special rate days.
|
|
287
|
+
|
|
288
|
+
\`\`\`typescript
|
|
289
|
+
const weekends = dates.filter(date => {
|
|
290
|
+
const day = date.getDay();
|
|
291
|
+
return day === 0 || day === 5 || day === 6; // Sun, Fri, Sat
|
|
292
|
+
});
|
|
293
|
+
|
|
294
|
+
<Rangepicker :holidays="weekends" />
|
|
295
|
+
\`\`\`
|
|
296
|
+
|
|
297
|
+
**Use case:** Highlight weekend premium pricing for hotels.
|
|
298
|
+
`,
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/vue3";
|
|
2
|
+
import RangepickerInput from "./RangepickerInput.vue";
|
|
3
|
+
/**
|
|
4
|
+
* Stories demonstrating theming and color customization 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 theme with no custom colors applied.
|
|
12
|
+
*/
|
|
13
|
+
export declare const DefaultTheme: Story;
|
|
14
|
+
/**
|
|
15
|
+
* Blue theme - professional and trustworthy.
|
|
16
|
+
*/
|
|
17
|
+
export declare const BlueTheme: Story;
|
|
18
|
+
/**
|
|
19
|
+
* Purple theme - creative and modern.
|
|
20
|
+
*/
|
|
21
|
+
export declare const PurpleTheme: Story;
|
|
22
|
+
/**
|
|
23
|
+
* Red theme - bold and attention-grabbing.
|
|
24
|
+
*/
|
|
25
|
+
export declare const RedTheme: Story;
|
|
26
|
+
/**
|
|
27
|
+
* Green theme - natural and calming.
|
|
28
|
+
*/
|
|
29
|
+
export declare const GreenTheme: Story;
|
|
30
|
+
/**
|
|
31
|
+
* Orange theme - warm and energetic.
|
|
32
|
+
*/
|
|
33
|
+
export declare const OrangeTheme: Story;
|
|
34
|
+
/**
|
|
35
|
+
* Pink theme - playful and vibrant.
|
|
36
|
+
*/
|
|
37
|
+
export declare const PinkTheme: Story;
|
|
38
|
+
/**
|
|
39
|
+
* Teal theme - fresh and modern.
|
|
40
|
+
*/
|
|
41
|
+
export declare const TealTheme: Story;
|
|
42
|
+
/**
|
|
43
|
+
* Indigo theme - elegant and sophisticated.
|
|
44
|
+
*/
|
|
45
|
+
export declare const IndigoTheme: Story;
|
|
46
|
+
/**
|
|
47
|
+
* Dark theme - sleek and modern.
|
|
48
|
+
*/
|
|
49
|
+
export declare const DarkTheme: Story;
|
|
50
|
+
/**
|
|
51
|
+
* Interactive color picker - try your own colors!
|
|
52
|
+
*/
|
|
53
|
+
export declare const CustomColors: Story;
|
|
54
|
+
//# sourceMappingURL=RangepickerTheming.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RangepickerTheming.stories.d.ts","sourceRoot":"","sources":["../src/RangepickerTheming.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,CAwFvC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,KAa1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,KAuBvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,KAuBzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,KAuBtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,KAuBxB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,KAuBzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,KAuBvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,KAuBvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,KAuBzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,KAuBvB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,KAwB1B,CAAC"}
|