@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
|
@@ -1,27 +1,123 @@
|
|
|
1
1
|
import { ref, watch } from "vue";
|
|
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
|
const meta = {
|
|
4
|
-
title: "Components/Rangepicker",
|
|
39
|
+
title: "Components/Rangepicker/Overview",
|
|
5
40
|
component: RangepickerInput,
|
|
41
|
+
tags: ['autodocs'],
|
|
42
|
+
parameters: {
|
|
43
|
+
docs: {
|
|
44
|
+
description: {
|
|
45
|
+
component: `
|
|
46
|
+
A flexible date range picker component with responsive design,
|
|
47
|
+
customizable theming, and comprehensive date constraints.
|
|
48
|
+
|
|
49
|
+
See the **Props** categories in the sidebar for detailed documentation.
|
|
50
|
+
`,
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
},
|
|
6
54
|
argTypes: {
|
|
7
55
|
modelValue: {
|
|
8
|
-
control: "text"
|
|
56
|
+
control: "text",
|
|
57
|
+
description: "Two-way binding for formatted date range string",
|
|
58
|
+
table: {
|
|
59
|
+
type: { summary: "string" },
|
|
60
|
+
defaultValue: { summary: '""' },
|
|
61
|
+
},
|
|
9
62
|
},
|
|
10
|
-
|
|
11
|
-
control: "
|
|
63
|
+
placeholder: {
|
|
64
|
+
control: "text",
|
|
65
|
+
description: "Placeholder text shown when no date is selected",
|
|
66
|
+
table: {
|
|
67
|
+
type: { summary: "string" },
|
|
68
|
+
defaultValue: { summary: "Select dates" },
|
|
69
|
+
},
|
|
12
70
|
},
|
|
13
71
|
variant: {
|
|
14
72
|
control: "select",
|
|
15
|
-
options: ["desktop", "mobile"]
|
|
73
|
+
options: ["desktop", "mobile"],
|
|
74
|
+
description: "Display variant - desktop shows dropdown, mobile shows bottom sheet",
|
|
75
|
+
table: {
|
|
76
|
+
type: { summary: "'desktop' | 'mobile'" },
|
|
77
|
+
defaultValue: { summary: "desktop" },
|
|
78
|
+
},
|
|
16
79
|
},
|
|
17
80
|
primaryColor: {
|
|
18
81
|
control: "color",
|
|
19
|
-
description: "Primary color for selected dates and highlights"
|
|
82
|
+
description: "Primary color for selected dates and highlights (HEX format)",
|
|
83
|
+
table: {
|
|
84
|
+
type: { summary: "string" },
|
|
85
|
+
},
|
|
20
86
|
},
|
|
21
87
|
secondaryColor: {
|
|
22
88
|
control: "color",
|
|
23
|
-
description: "Secondary color for hover states"
|
|
24
|
-
|
|
89
|
+
description: "Secondary color for hover states (HEX format)",
|
|
90
|
+
table: {
|
|
91
|
+
type: { summary: "string" },
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
options: {
|
|
95
|
+
control: "object",
|
|
96
|
+
description: "Configuration options for the rangepicker",
|
|
97
|
+
table: {
|
|
98
|
+
type: { summary: "LitepickerOptions" },
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
id: {
|
|
102
|
+
control: "text",
|
|
103
|
+
description: "HTML id attribute for the input",
|
|
104
|
+
},
|
|
105
|
+
name: {
|
|
106
|
+
control: "text",
|
|
107
|
+
description: "HTML name attribute for the input",
|
|
108
|
+
},
|
|
109
|
+
readonly: {
|
|
110
|
+
control: "boolean",
|
|
111
|
+
description: "Whether the input is readonly",
|
|
112
|
+
table: {
|
|
113
|
+
type: { summary: "boolean" },
|
|
114
|
+
defaultValue: { summary: "true" },
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
close: {
|
|
118
|
+
control: "boolean",
|
|
119
|
+
description: "Programmatic control to close the picker",
|
|
120
|
+
},
|
|
25
121
|
},
|
|
26
122
|
args: {
|
|
27
123
|
modelValue: "",
|
|
@@ -66,52 +162,43 @@ const meta = {
|
|
|
66
162
|
return { args, modelValue };
|
|
67
163
|
},
|
|
68
164
|
template: `
|
|
69
|
-
<div style="padding: 2rem; background: #f5f5f5; min-height:
|
|
165
|
+
<div style="padding: 2rem; background: #f5f5f5; min-height: 400px;">
|
|
70
166
|
<RangepickerInput v-bind="args" v-model="modelValue" class="form-control mb-0 shadow-none text-black lg:pl-2 border-0 w-full" />
|
|
71
167
|
</div>
|
|
72
168
|
`
|
|
73
169
|
})
|
|
74
170
|
};
|
|
75
171
|
export default meta;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
primaryColor: "#f97316",
|
|
109
|
-
secondaryColor: "#fb923c"
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
export const CustomPinkColor = {
|
|
113
|
-
args: {
|
|
114
|
-
primaryColor: "#ec4899",
|
|
115
|
-
secondaryColor: "#f472b6"
|
|
116
|
-
}
|
|
172
|
+
/**
|
|
173
|
+
* Default rangepicker with standard configuration.
|
|
174
|
+
* Click the input to open the calendar and select a date range.
|
|
175
|
+
*
|
|
176
|
+
* Explore the categorized stories in the sidebar to learn about different features:
|
|
177
|
+
* - **Modes** - Display variants (desktop/mobile) and behavior modes
|
|
178
|
+
* - **Constraints** - Date limits and validation rules
|
|
179
|
+
* - **Formatting** - Date format patterns
|
|
180
|
+
* - **Theming** - Color and visual customization
|
|
181
|
+
* - **Special Dates** - Holidays and disabled dates
|
|
182
|
+
*/
|
|
183
|
+
export const Default = {
|
|
184
|
+
parameters: {
|
|
185
|
+
docs: {
|
|
186
|
+
description: {
|
|
187
|
+
story: `
|
|
188
|
+
### Default Configuration
|
|
189
|
+
|
|
190
|
+
The default rangepicker setup with:
|
|
191
|
+
- Desktop variant (dropdown calendar)
|
|
192
|
+
- Auto-apply enabled
|
|
193
|
+
- 2-month view
|
|
194
|
+
- Format: DD MMM YYYY
|
|
195
|
+
- Min date: Today
|
|
196
|
+
|
|
197
|
+
Click the input field to open the calendar.
|
|
198
|
+
|
|
199
|
+
> 💡 **Tip**: Check the other story categories in the sidebar for detailed examples of all features.
|
|
200
|
+
`,
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
},
|
|
117
204
|
};
|
|
@@ -28,6 +28,9 @@ interface Props {
|
|
|
28
28
|
variant?: 'desktop' | 'mobile';
|
|
29
29
|
primaryColor?: string;
|
|
30
30
|
secondaryColor?: string;
|
|
31
|
+
fontFamily?: string;
|
|
32
|
+
borderRadius?: string;
|
|
33
|
+
showClearButton?: boolean;
|
|
31
34
|
}
|
|
32
35
|
declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
33
36
|
"update:modelValue": (value: string) => any;
|
|
@@ -39,6 +42,7 @@ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, imp
|
|
|
39
42
|
variant: "desktop" | "mobile";
|
|
40
43
|
placeholder: string;
|
|
41
44
|
readonly: boolean;
|
|
45
|
+
showClearButton: boolean;
|
|
42
46
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
|
|
43
47
|
wrapperRef: HTMLDivElement;
|
|
44
48
|
inputRef: HTMLInputElement;
|
|
@@ -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":"AAkRA,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;IACvB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B;;;;;;;;aANW,SAAS,GAAG,QAAQ;iBAJhB,MAAM;cACT,OAAO;qBAQA,OAAO;;;;;AA4P3B,wBAUG"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/vue3";
|
|
2
|
+
import RangepickerInput from "./RangepickerInput.vue";
|
|
3
|
+
/**
|
|
4
|
+
* Stories demonstrating different display modes and behaviors
|
|
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
|
+
* Desktop variant displays the calendar as a dropdown below the input field.
|
|
12
|
+
* Best for desktop/laptop screens with sufficient viewport space.
|
|
13
|
+
*/
|
|
14
|
+
export declare const DesktopVariant: Story;
|
|
15
|
+
/**
|
|
16
|
+
* Mobile variant displays the calendar as a bottom sheet overlay.
|
|
17
|
+
* Optimized for touch devices and smaller screens.
|
|
18
|
+
*/
|
|
19
|
+
export declare const MobileVariant: Story;
|
|
20
|
+
/**
|
|
21
|
+
* Single date mode allows selecting only one date instead of a range.
|
|
22
|
+
* Useful for single date inputs like birth dates or event dates.
|
|
23
|
+
*/
|
|
24
|
+
export declare const SingleMode: Story;
|
|
25
|
+
/**
|
|
26
|
+
* Auto Apply mode automatically confirms the selection when both dates are picked.
|
|
27
|
+
* No need to click an Apply/Confirm button.
|
|
28
|
+
*/
|
|
29
|
+
export declare const AutoApply: Story;
|
|
30
|
+
/**
|
|
31
|
+
* Manual Apply mode requires clicking an Apply button to confirm selection.
|
|
32
|
+
* Gives users a chance to review before confirming.
|
|
33
|
+
*/
|
|
34
|
+
export declare const ManualApply: Story;
|
|
35
|
+
//# sourceMappingURL=RangepickerModes.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RangepickerModes.stories.d.ts","sourceRoot":"","sources":["../src/RangepickerModes.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,CAuFvC,CAAC;AAEF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE/C;;;GAGG;AACH,eAAO,MAAM,cAAc,EAAE,KAqB5B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,KAoB3B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,EAAE,KA6BxB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,KA2BvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,EAAE,KA2BzB,CAAC"}
|
|
@@ -0,0 +1,239 @@
|
|
|
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
|
+
primaryColor: "#ff1b1b"
|
|
99
|
+
},
|
|
100
|
+
parameters: {
|
|
101
|
+
docs: {
|
|
102
|
+
description: {
|
|
103
|
+
story: `
|
|
104
|
+
### Desktop Variant
|
|
105
|
+
|
|
106
|
+
The default display mode. Shows the calendar as a floating dropdown below the input.
|
|
107
|
+
|
|
108
|
+
- **Type**: \`'desktop' | 'mobile'\`
|
|
109
|
+
- **Default**: \`'desktop'\`
|
|
110
|
+
|
|
111
|
+
Best suited for desktop and laptop screens where there's sufficient viewport space.
|
|
112
|
+
`,
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Mobile variant displays the calendar as a bottom sheet overlay.
|
|
119
|
+
* Optimized for touch devices and smaller screens.
|
|
120
|
+
*/
|
|
121
|
+
export const MobileVariant = {
|
|
122
|
+
args: {
|
|
123
|
+
variant: "mobile",
|
|
124
|
+
},
|
|
125
|
+
parameters: {
|
|
126
|
+
docs: {
|
|
127
|
+
description: {
|
|
128
|
+
story: `
|
|
129
|
+
### Mobile Variant
|
|
130
|
+
|
|
131
|
+
Displays the calendar as a bottom sheet overlay, optimized for mobile devices.
|
|
132
|
+
|
|
133
|
+
- **Type**: \`'desktop' | 'mobile'\`
|
|
134
|
+
- **Value**: \`'mobile'\`
|
|
135
|
+
|
|
136
|
+
Provides a touch-friendly interface with larger tap targets.
|
|
137
|
+
`,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Single date mode allows selecting only one date instead of a range.
|
|
144
|
+
* Useful for single date inputs like birth dates or event dates.
|
|
145
|
+
*/
|
|
146
|
+
export const SingleMode = {
|
|
147
|
+
args: {
|
|
148
|
+
variant: "desktop",
|
|
149
|
+
placeholder: "Select date",
|
|
150
|
+
options: {
|
|
151
|
+
autoApply: true,
|
|
152
|
+
singleMode: true,
|
|
153
|
+
format: 'DD MMM YYYY',
|
|
154
|
+
numberOfColumns: 1,
|
|
155
|
+
numberOfMonths: 1,
|
|
156
|
+
minDate: new Date(),
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
parameters: {
|
|
160
|
+
docs: {
|
|
161
|
+
description: {
|
|
162
|
+
story: `
|
|
163
|
+
### Single Mode
|
|
164
|
+
|
|
165
|
+
Enable selecting a single date instead of a date range.
|
|
166
|
+
|
|
167
|
+
- **Type**: \`boolean\`
|
|
168
|
+
- **Default**: \`false\`
|
|
169
|
+
|
|
170
|
+
When enabled, clicking a date immediately selects it without requiring a second click for the end date.
|
|
171
|
+
`,
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Auto Apply mode automatically confirms the selection when both dates are picked.
|
|
178
|
+
* No need to click an Apply/Confirm button.
|
|
179
|
+
*/
|
|
180
|
+
export const AutoApply = {
|
|
181
|
+
args: {
|
|
182
|
+
variant: "desktop",
|
|
183
|
+
options: {
|
|
184
|
+
autoApply: true,
|
|
185
|
+
format: 'DD MMM YYYY',
|
|
186
|
+
numberOfColumns: 2,
|
|
187
|
+
numberOfMonths: 2,
|
|
188
|
+
minDate: new Date(),
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
parameters: {
|
|
192
|
+
docs: {
|
|
193
|
+
description: {
|
|
194
|
+
story: `
|
|
195
|
+
### Auto Apply
|
|
196
|
+
|
|
197
|
+
Automatically apply selection without requiring an Apply button click.
|
|
198
|
+
|
|
199
|
+
- **Type**: \`boolean\`
|
|
200
|
+
- **Default**: \`false\`
|
|
201
|
+
|
|
202
|
+
When enabled, the selection is confirmed immediately after picking the end date. When disabled, users must click an Apply button to confirm.
|
|
203
|
+
`,
|
|
204
|
+
},
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
/**
|
|
209
|
+
* Manual Apply mode requires clicking an Apply button to confirm selection.
|
|
210
|
+
* Gives users a chance to review before confirming.
|
|
211
|
+
*/
|
|
212
|
+
export const ManualApply = {
|
|
213
|
+
args: {
|
|
214
|
+
variant: "desktop",
|
|
215
|
+
options: {
|
|
216
|
+
autoApply: false,
|
|
217
|
+
format: 'DD MMM YYYY',
|
|
218
|
+
numberOfColumns: 2,
|
|
219
|
+
numberOfMonths: 2,
|
|
220
|
+
minDate: new Date(),
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
parameters: {
|
|
224
|
+
docs: {
|
|
225
|
+
description: {
|
|
226
|
+
story: `
|
|
227
|
+
### Manual Apply
|
|
228
|
+
|
|
229
|
+
Require user to click Apply button to confirm their selection.
|
|
230
|
+
|
|
231
|
+
- **Type**: \`boolean\`
|
|
232
|
+
- **Value**: \`false\`
|
|
233
|
+
|
|
234
|
+
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.
|
|
235
|
+
`,
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
};
|
|
@@ -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"}
|