@archpublicwebsite/rangepicker 1.2.13 → 1.2.14
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 +76 -107
- package/dist/Rangepicker.vue.d.ts.map +1 -1
- package/dist/RangepickerConstraints.stories.d.ts +2 -2
- package/dist/RangepickerConstraints.stories.d.ts.map +1 -1
- package/dist/RangepickerConstraints.stories.js +25 -25
- package/dist/RangepickerFormatting.stories.d.ts +2 -2
- package/dist/RangepickerFormatting.stories.d.ts.map +1 -1
- package/dist/RangepickerFormatting.stories.js +36 -36
- package/dist/RangepickerInput.stories.d.ts +2 -2
- package/dist/RangepickerInput.stories.d.ts.map +1 -1
- package/dist/RangepickerInput.stories.js +48 -48
- package/dist/RangepickerInput.vue.d.ts +0 -1
- package/dist/RangepickerInput.vue.d.ts.map +1 -1
- package/dist/RangepickerModes.stories.d.ts +2 -2
- package/dist/RangepickerModes.stories.d.ts.map +1 -1
- package/dist/RangepickerModes.stories.js +50 -50
- package/dist/RangepickerSpecialDates.stories.d.ts +2 -2
- package/dist/RangepickerSpecialDates.stories.d.ts.map +1 -1
- package/dist/RangepickerSpecialDates.stories.js +29 -33
- package/dist/RangepickerTheming.stories.d.ts +2 -2
- package/dist/RangepickerTheming.stories.d.ts.map +1 -1
- package/dist/RangepickerTheming.stories.js +49 -49
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -3
- package/dist/rangepicker.js +91 -114
- 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 +46 -24
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/calendar.d.ts.map +1 -1
- package/dist/utils/calendar.js +5 -9
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/position.d.ts.map +1 -1
- package/package.json +6 -5
|
@@ -1,38 +1,39 @@
|
|
|
1
|
-
import { ref } from
|
|
2
|
-
import Rangepicker from
|
|
1
|
+
import { ref } from 'vue';
|
|
2
|
+
import Rangepicker from './Rangepicker.vue';
|
|
3
3
|
// Helper to generate dates
|
|
4
4
|
const today = new Date();
|
|
5
|
-
|
|
5
|
+
function getDate(daysFromToday) {
|
|
6
6
|
const date = new Date(today);
|
|
7
7
|
date.setDate(today.getDate() + daysFromToday);
|
|
8
8
|
return date;
|
|
9
|
-
}
|
|
9
|
+
}
|
|
10
10
|
// Generate sample disabled dates (every Tuesday for the next 2 months)
|
|
11
|
-
|
|
11
|
+
function generateDisabledDates() {
|
|
12
12
|
const dates = [];
|
|
13
13
|
for (let i = 0; i < 60; i++) {
|
|
14
14
|
const date = getDate(i);
|
|
15
|
-
if (date.getDay() === 2) {
|
|
15
|
+
if (date.getDay() === 2) {
|
|
16
|
+
// Tuesday
|
|
16
17
|
dates.push(new Date(date));
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
return dates;
|
|
20
|
-
}
|
|
21
|
+
}
|
|
21
22
|
// Generate sample holidays
|
|
22
|
-
|
|
23
|
+
function generateHolidays() {
|
|
23
24
|
return [
|
|
24
25
|
getDate(7), // A week from now
|
|
25
26
|
getDate(14), // Two weeks from now
|
|
26
27
|
getDate(21), // Three weeks from now
|
|
27
28
|
getDate(30), // One month from now
|
|
28
29
|
];
|
|
29
|
-
}
|
|
30
|
+
}
|
|
30
31
|
/**
|
|
31
32
|
* Stories demonstrating special dates functionality
|
|
32
33
|
* including holidays and disabled dates.
|
|
33
34
|
*/
|
|
34
35
|
const meta = {
|
|
35
|
-
title:
|
|
36
|
+
title: 'Components/Rangepicker/Examples',
|
|
36
37
|
component: Rangepicker,
|
|
37
38
|
tags: ['autodocs'],
|
|
38
39
|
parameters: {
|
|
@@ -59,32 +60,32 @@ These dates can be visually distinguished and/or made non-selectable.
|
|
|
59
60
|
},
|
|
60
61
|
argTypes: {
|
|
61
62
|
disabledDates: {
|
|
62
|
-
control:
|
|
63
|
-
description:
|
|
63
|
+
control: 'object',
|
|
64
|
+
description: 'Array of dates that should be disabled for selection',
|
|
64
65
|
table: {
|
|
65
|
-
type: { summary:
|
|
66
|
-
defaultValue: { summary:
|
|
66
|
+
type: { summary: '(string | Date)[]' },
|
|
67
|
+
defaultValue: { summary: '[]' },
|
|
67
68
|
},
|
|
68
69
|
},
|
|
69
70
|
holidays: {
|
|
70
|
-
control:
|
|
71
|
-
description:
|
|
71
|
+
control: 'object',
|
|
72
|
+
description: 'Array of dates to mark as holidays',
|
|
72
73
|
table: {
|
|
73
|
-
type: { summary:
|
|
74
|
-
defaultValue: { summary:
|
|
74
|
+
type: { summary: '(string | Date)[]' },
|
|
75
|
+
defaultValue: { summary: '[]' },
|
|
75
76
|
},
|
|
76
77
|
},
|
|
77
78
|
variant: {
|
|
78
|
-
control:
|
|
79
|
-
options: [
|
|
79
|
+
control: 'select',
|
|
80
|
+
options: ['desktop', 'mobile'],
|
|
80
81
|
},
|
|
81
82
|
},
|
|
82
83
|
args: {
|
|
83
84
|
isOpen: true,
|
|
84
|
-
variant:
|
|
85
|
+
variant: 'desktop',
|
|
85
86
|
valueOfMonths: 2,
|
|
86
87
|
valueOfColumns: 2,
|
|
87
|
-
format:
|
|
88
|
+
format: 'DD MMM YYYY',
|
|
88
89
|
autoApply: true,
|
|
89
90
|
showTooltip: true,
|
|
90
91
|
minDate: today,
|
|
@@ -92,7 +93,7 @@ These dates can be visually distinguished and/or made non-selectable.
|
|
|
92
93
|
render: (args) => ({
|
|
93
94
|
components: { Rangepicker },
|
|
94
95
|
setup() {
|
|
95
|
-
const modelValue = ref({ startDate:
|
|
96
|
+
const modelValue = ref({ startDate: '', endDate: '' });
|
|
96
97
|
const isOpen = ref(args.isOpen ?? true);
|
|
97
98
|
return { args, modelValue, isOpen };
|
|
98
99
|
},
|
|
@@ -107,8 +108,8 @@ These dates can be visually distinguished and/or made non-selectable.
|
|
|
107
108
|
v-model:is-open="isOpen"
|
|
108
109
|
/>
|
|
109
110
|
</div>
|
|
110
|
-
|
|
111
|
-
})
|
|
111
|
+
`,
|
|
112
|
+
}),
|
|
112
113
|
};
|
|
113
114
|
export default meta;
|
|
114
115
|
/**
|
|
@@ -224,13 +225,7 @@ Combine both props for comprehensive date management.
|
|
|
224
225
|
*/
|
|
225
226
|
export const BlockedDateRange = {
|
|
226
227
|
args: {
|
|
227
|
-
disabledDates: [
|
|
228
|
-
getDate(10),
|
|
229
|
-
getDate(11),
|
|
230
|
-
getDate(12),
|
|
231
|
-
getDate(13),
|
|
232
|
-
getDate(14),
|
|
233
|
-
],
|
|
228
|
+
disabledDates: [getDate(10), getDate(11), getDate(12), getDate(13), getDate(14)],
|
|
234
229
|
},
|
|
235
230
|
parameters: {
|
|
236
231
|
docs: {
|
|
@@ -270,7 +265,8 @@ export const HolidayWeekends = {
|
|
|
270
265
|
for (let i = 0; i < 30; i++) {
|
|
271
266
|
const date = getDate(i);
|
|
272
267
|
const day = date.getDay();
|
|
273
|
-
if (day === 5 || day === 6 || day === 0) {
|
|
268
|
+
if (day === 5 || day === 6 || day === 0) {
|
|
269
|
+
// Fri, Sat, Sun
|
|
274
270
|
dates.push(new Date(date));
|
|
275
271
|
}
|
|
276
272
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from
|
|
2
|
-
import RangepickerInput from
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3';
|
|
2
|
+
import RangepickerInput from './RangepickerInput.vue';
|
|
3
3
|
/**
|
|
4
4
|
* Stories demonstrating theming and color customization options
|
|
5
5
|
* for the Rangepicker component.
|
|
@@ -1 +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,
|
|
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,CAAA;AAErD,OAAO,gBAAgB,MAAM,wBAAwB,CAAA;AAErD;;;GAGG;AACH,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,gBAAgB,CAwGvC,CAAA;AAED,eAAe,IAAI,CAAA;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAE9C;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,KAmDzB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,KAsC1B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,KA0DxB,CAAA"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ref, watch } from
|
|
2
|
-
import RangepickerInput from
|
|
1
|
+
import { ref, watch } from 'vue';
|
|
2
|
+
import RangepickerInput from './RangepickerInput.vue';
|
|
3
3
|
/**
|
|
4
4
|
* Stories demonstrating theming and color customization options
|
|
5
5
|
* for the Rangepicker component.
|
|
6
6
|
*/
|
|
7
7
|
const meta = {
|
|
8
|
-
title:
|
|
8
|
+
title: 'Components/Rangepicker/Examples',
|
|
9
9
|
component: RangepickerInput,
|
|
10
10
|
tags: ['autodocs'],
|
|
11
11
|
parameters: {
|
|
@@ -33,64 +33,64 @@ Each instance can have its own color scheme using HEX color values.
|
|
|
33
33
|
},
|
|
34
34
|
argTypes: {
|
|
35
35
|
primaryColor: {
|
|
36
|
-
control:
|
|
37
|
-
description:
|
|
36
|
+
control: 'color',
|
|
37
|
+
description: 'Primary color for selected dates and highlights (HEX format)',
|
|
38
38
|
table: {
|
|
39
|
-
type: { summary:
|
|
40
|
-
defaultValue: { summary:
|
|
39
|
+
type: { summary: 'string' },
|
|
40
|
+
defaultValue: { summary: 'undefined (uses default blue)' },
|
|
41
41
|
},
|
|
42
42
|
},
|
|
43
43
|
secondaryColor: {
|
|
44
|
-
control:
|
|
45
|
-
description:
|
|
44
|
+
control: 'color',
|
|
45
|
+
description: 'Secondary color for hover states (HEX format)',
|
|
46
46
|
table: {
|
|
47
|
-
type: { summary:
|
|
48
|
-
defaultValue: { summary:
|
|
47
|
+
type: { summary: 'string' },
|
|
48
|
+
defaultValue: { summary: 'undefined (uses default light blue)' },
|
|
49
49
|
},
|
|
50
50
|
},
|
|
51
51
|
borderRadius: {
|
|
52
|
-
control:
|
|
53
|
-
description:
|
|
52
|
+
control: 'text',
|
|
53
|
+
description: 'Border radius for the calendar container (CSS value)',
|
|
54
54
|
table: {
|
|
55
|
-
type: { summary:
|
|
56
|
-
defaultValue: { summary:
|
|
55
|
+
type: { summary: 'string' },
|
|
56
|
+
defaultValue: { summary: '0.75rem' },
|
|
57
57
|
},
|
|
58
58
|
},
|
|
59
59
|
fontFamily: {
|
|
60
|
-
control:
|
|
61
|
-
description:
|
|
60
|
+
control: 'text',
|
|
61
|
+
description: 'Font family for the calendar (CSS font-family value)',
|
|
62
62
|
table: {
|
|
63
|
-
type: { summary:
|
|
64
|
-
defaultValue: { summary:
|
|
63
|
+
type: { summary: 'string' },
|
|
64
|
+
defaultValue: { summary: 'inherit' },
|
|
65
65
|
},
|
|
66
66
|
},
|
|
67
67
|
variant: {
|
|
68
|
-
control:
|
|
69
|
-
options: [
|
|
68
|
+
control: 'select',
|
|
69
|
+
options: ['desktop', 'mobile'],
|
|
70
70
|
},
|
|
71
71
|
options: {
|
|
72
|
-
control:
|
|
72
|
+
control: 'object',
|
|
73
73
|
},
|
|
74
74
|
},
|
|
75
75
|
args: {
|
|
76
|
-
placeholder:
|
|
77
|
-
id:
|
|
78
|
-
name:
|
|
79
|
-
variant:
|
|
76
|
+
placeholder: 'Check in / Check out',
|
|
77
|
+
id: 'dates',
|
|
78
|
+
name: 'dates',
|
|
79
|
+
variant: 'desktop',
|
|
80
80
|
options: {
|
|
81
81
|
autoApply: true,
|
|
82
82
|
minDate: new Date(),
|
|
83
83
|
format: 'DD MMM YYYY',
|
|
84
84
|
numberOfColumns: 2,
|
|
85
85
|
numberOfMonths: 2,
|
|
86
|
-
}
|
|
86
|
+
},
|
|
87
87
|
},
|
|
88
88
|
render: (args) => ({
|
|
89
89
|
components: { RangepickerInput },
|
|
90
90
|
setup() {
|
|
91
|
-
const modelValue = ref(args.modelValue ??
|
|
91
|
+
const modelValue = ref(args.modelValue ?? '');
|
|
92
92
|
watch(() => args.modelValue, (value) => {
|
|
93
|
-
const nextValue = value ??
|
|
93
|
+
const nextValue = value ?? '';
|
|
94
94
|
if (nextValue !== modelValue.value) {
|
|
95
95
|
modelValue.value = nextValue;
|
|
96
96
|
}
|
|
@@ -101,8 +101,8 @@ Each instance can have its own color scheme using HEX color values.
|
|
|
101
101
|
<div style="padding: 2rem; background: #f5f5f5; min-height: 400px;">
|
|
102
102
|
<RangepickerInput v-bind="args" v-model="modelValue" class="form-control mb-0 shadow-none text-black lg:pl-2 border-0 w-full" />
|
|
103
103
|
</div>
|
|
104
|
-
|
|
105
|
-
})
|
|
104
|
+
`,
|
|
105
|
+
}),
|
|
106
106
|
};
|
|
107
107
|
export default meta;
|
|
108
108
|
/**
|
|
@@ -110,18 +110,18 @@ export default meta;
|
|
|
110
110
|
*/
|
|
111
111
|
export const ColorThemes = {
|
|
112
112
|
args: {
|
|
113
|
-
primaryColor:
|
|
114
|
-
secondaryColor:
|
|
115
|
-
modelValue:
|
|
113
|
+
primaryColor: '#ff00de',
|
|
114
|
+
secondaryColor: '#5a6258',
|
|
115
|
+
modelValue: '02 Feb 2026 - 04 Feb 2026',
|
|
116
116
|
},
|
|
117
117
|
argTypes: {
|
|
118
118
|
primaryColor: {
|
|
119
|
-
control:
|
|
120
|
-
description:
|
|
119
|
+
control: 'color',
|
|
120
|
+
description: 'Primary color for selected dates and highlights',
|
|
121
121
|
},
|
|
122
122
|
secondaryColor: {
|
|
123
|
-
control:
|
|
124
|
-
description:
|
|
123
|
+
control: 'color',
|
|
124
|
+
description: 'Secondary color for hover states',
|
|
125
125
|
},
|
|
126
126
|
},
|
|
127
127
|
parameters: {
|
|
@@ -165,14 +165,14 @@ Use the color pickers below to customize your theme, or try these popular preset
|
|
|
165
165
|
*/
|
|
166
166
|
export const BorderRadius = {
|
|
167
167
|
args: {
|
|
168
|
-
borderRadius:
|
|
169
|
-
modelValue:
|
|
168
|
+
borderRadius: '12px',
|
|
169
|
+
modelValue: '02 Feb 2026 - 04 Feb 2026',
|
|
170
170
|
},
|
|
171
171
|
argTypes: {
|
|
172
172
|
borderRadius: {
|
|
173
|
-
control:
|
|
174
|
-
options: [
|
|
175
|
-
description:
|
|
173
|
+
control: 'select',
|
|
174
|
+
options: ['4px', '6px', '8px', '12px'],
|
|
175
|
+
description: 'Border radius of the calendar container',
|
|
176
176
|
},
|
|
177
177
|
},
|
|
178
178
|
parameters: {
|
|
@@ -207,22 +207,22 @@ You can also use any valid CSS value like \`"0.75rem"\` or \`"16px"\`.
|
|
|
207
207
|
*/
|
|
208
208
|
export const FontFamily = {
|
|
209
209
|
args: {
|
|
210
|
-
fontFamily:
|
|
211
|
-
modelValue:
|
|
210
|
+
fontFamily: 'Georgia, serif',
|
|
211
|
+
modelValue: '02 Feb 2026 - 04 Feb 2026',
|
|
212
212
|
},
|
|
213
213
|
argTypes: {
|
|
214
214
|
fontFamily: {
|
|
215
|
-
control:
|
|
215
|
+
control: 'select',
|
|
216
216
|
options: [
|
|
217
|
-
|
|
217
|
+
'inherit',
|
|
218
218
|
"'Inter', sans-serif",
|
|
219
219
|
"'Roboto', sans-serif",
|
|
220
220
|
"'Poppins', sans-serif",
|
|
221
221
|
"'Arial', sans-serif",
|
|
222
|
-
|
|
222
|
+
'Georgia, serif',
|
|
223
223
|
"'Courier New', monospace",
|
|
224
224
|
],
|
|
225
|
-
description:
|
|
225
|
+
description: 'Font family for the calendar',
|
|
226
226
|
},
|
|
227
227
|
},
|
|
228
228
|
parameters: {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,2BAA2B,CAAA;AAClC,OAAO,WAAW,MAAM,mBAAmB,CAAA;AAC3C,OAAO,gBAAgB,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAGhB,eAAe,gBAAgB,CAAA;AAG/B,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAA;AAGxC,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,2BAA2B,CAAA;AAClC,OAAO,WAAW,MAAM,mBAAmB,CAAA;AAC3C,OAAO,gBAAgB,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAGhB,eAAe,gBAAgB,CAAA;AAG/B,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAA;AAGxC,YAAY,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,gBAAgB,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,CAAA;AAGhH,wBAAgB,cAAc,CAAC,UAAU,EAAE,GAAG,EAAE,OAAO,GAAE,OAAO,CAAC,gBAAgB,CAAM;;;;;;;;;;;;;EAsBtF"}
|
package/dist/index.js
CHANGED
|
@@ -10,9 +10,15 @@ export { Rangepicker, RangepickerInput };
|
|
|
10
10
|
export function useRangepicker(triggerRef, options = {}) {
|
|
11
11
|
const isOpen = ref(false);
|
|
12
12
|
const dateRange = ref({ startDate: '', endDate: '' });
|
|
13
|
-
const open = () => {
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const open = () => {
|
|
14
|
+
isOpen.value = true;
|
|
15
|
+
};
|
|
16
|
+
const close = () => {
|
|
17
|
+
isOpen.value = false;
|
|
18
|
+
};
|
|
19
|
+
const toggle = () => {
|
|
20
|
+
isOpen.value = !isOpen.value;
|
|
21
|
+
};
|
|
16
22
|
return {
|
|
17
23
|
isOpen,
|
|
18
24
|
dateRange,
|