@archpublicwebsite/rangepicker 1.0.9 → 1.0.13

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.
@@ -1,68 +1,26 @@
1
1
  import { ref, watch } from "vue";
2
2
  import RangepickerInput from "./RangepickerInput.vue";
3
- import StoryWrapper from "./StoryWrapper.vue";
4
- /**
5
- * RangepickerInput is a date range picker component that provides an intuitive
6
- * interface for selecting date ranges. It supports both desktop and mobile variants,
7
- * custom styling, and various configuration options.
8
- *
9
- * ## Features
10
- * - Desktop and mobile variants
11
- * - Custom color theming
12
- * - Date restrictions (min/max dates, min/max days)
13
- * - Multiple date formats
14
- * - Tooltip support showing number of nights
15
- * - Auto-apply or manual confirmation
16
- */
17
3
  const meta = {
18
- title: "Components/Rangepicker/Input",
4
+ title: "Components/Rangepicker",
19
5
  component: RangepickerInput,
20
- tags: ['autodocs'],
21
6
  argTypes: {
22
7
  modelValue: {
23
- control: "text",
24
- description: "The selected date range in format 'DD MMM YYYY - DD MMM YYYY'"
8
+ control: "text"
25
9
  },
26
- placeholder: {
27
- control: "text",
28
- description: "Placeholder text shown when no date is selected"
10
+ options: {
11
+ control: "object"
29
12
  },
30
13
  variant: {
31
14
  control: "select",
32
- options: ["desktop", "mobile"],
33
- description: "Display variant - desktop shows side-by-side calendars, mobile shows stacked"
15
+ options: ["desktop", "mobile"]
34
16
  },
35
17
  primaryColor: {
36
18
  control: "color",
37
- description: "Primary color for selected dates and highlights (hex format)"
19
+ description: "Primary color for selected dates and highlights"
38
20
  },
39
21
  secondaryColor: {
40
22
  control: "color",
41
- description: "Secondary color for hover states (hex format)"
42
- },
43
- id: {
44
- control: "text",
45
- description: "HTML id attribute for the input element"
46
- },
47
- name: {
48
- control: "text",
49
- description: "HTML name attribute for form submission"
50
- },
51
- readonly: {
52
- control: "boolean",
53
- description: "Whether the input is readonly"
54
- },
55
- options: {
56
- control: "object",
57
- description: "Litepicker configuration options"
58
- },
59
- 'onUpdate:modelValue': {
60
- action: 'update:modelValue',
61
- description: "Emitted when date range changes"
62
- },
63
- 'onFocusin': {
64
- action: 'focusin',
65
- description: "Emitted when input receives focus"
23
+ description: "Secondary color for hover states"
66
24
  }
67
25
  },
68
26
  args: {
@@ -71,7 +29,6 @@ const meta = {
71
29
  id: "dates",
72
30
  name: "dates",
73
31
  variant: "desktop",
74
- readonly: true,
75
32
  options: {
76
33
  autoApply: true,
77
34
  allowRepick: true,
@@ -87,7 +44,6 @@ const meta = {
87
44
  numberOfColumns: 2,
88
45
  numberOfMonths: 2,
89
46
  singleMode: false,
90
- showTooltip: true,
91
47
  tooltipText: {
92
48
  one: 'night',
93
49
  other: 'nights',
@@ -98,7 +54,7 @@ const meta = {
98
54
  }
99
55
  },
100
56
  render: (args) => ({
101
- components: { RangepickerInput, StoryWrapper },
57
+ components: { RangepickerInput },
102
58
  setup() {
103
59
  const modelValue = ref(args.modelValue ?? "");
104
60
  watch(() => args.modelValue, (value) => {
@@ -107,213 +63,55 @@ const meta = {
107
63
  modelValue.value = nextValue;
108
64
  }
109
65
  });
110
- const handleUpdate = (value) => {
111
- modelValue.value = value;
112
- args['onUpdate:modelValue']?.(value);
113
- };
114
- return { args, modelValue, handleUpdate };
66
+ return { args, modelValue };
115
67
  },
116
68
  template: `
117
- <StoryWrapper>
118
- <RangepickerInput
119
- v-bind="args"
120
- v-model="modelValue"
121
- @update:model-value="handleUpdate"
122
- class="tw-w-full"
123
- />
124
- </StoryWrapper>
69
+ <div style="padding: 2rem; background: #f5f5f5; min-height: 360px;">
70
+ <RangepickerInput v-bind="args" v-model="modelValue" class="form-control mb-0 shadow-none text-black lg:pl-2 border-0 w-full" />
71
+ </div>
125
72
  `
126
73
  })
127
74
  };
128
75
  export default meta;
129
- /**
130
- * Default state with no pre-selected dates.
131
- * Shows the basic usage with standard configuration.
132
- */
133
76
  export const Default = {};
134
- /**
135
- * Desktop variant with 2 columns showing months side by side.
136
- * Best for larger screens and quick date range selection.
137
- */
138
- export const Desktop = {
139
- args: {
140
- variant: "desktop",
141
- placeholder: "Select your dates"
142
- }
143
- };
144
- /**
145
- * Mobile variant with stacked calendar display.
146
- * Optimized for smaller screens and touch interactions.
147
- */
148
77
  export const Mobile = {
149
78
  args: {
150
- variant: "mobile",
151
- placeholder: "Tap to select dates"
152
- }
153
- };
154
- /**
155
- * Pre-selected date range.
156
- * Useful for editing existing bookings or showing current selection.
157
- */
158
- export const WithPreselectedDates = {
159
- args: {
160
- modelValue: (() => {
161
- const start = new Date();
162
- const end = new Date();
163
- end.setDate(end.getDate() + 7);
164
- const format = (date) => {
165
- const day = date.getDate().toString().padStart(2, '0');
166
- const month = date.toLocaleString('en-US', { month: 'short' });
167
- const year = date.getFullYear();
168
- return `${day} ${month} ${year}`;
169
- };
170
- return `${format(start)} - ${format(end)}`;
171
- })()
79
+ variant: "mobile"
172
80
  }
173
81
  };
174
- /**
175
- * Custom brand colors for theming.
176
- * Primary color is used for selected dates, secondary for hover states.
177
- */
178
- export const CustomColors = {
82
+ export const CustomBlueColor = {
179
83
  args: {
180
- primaryColor: "#10b981",
181
- secondaryColor: "#34d399",
182
- placeholder: "Pick your travel dates"
183
- }
184
- };
185
- /**
186
- * Date restrictions with minimum and maximum selectable dates.
187
- * Prevents users from selecting dates outside the allowed range.
188
- */
189
- export const WithDateRestrictions = {
190
- args: {
191
- placeholder: "Available dates only",
192
- options: {
193
- autoApply: true,
194
- minDate: new Date(),
195
- maxDate: (() => {
196
- const maxDate = new Date();
197
- maxDate.setMonth(maxDate.getMonth() + 3);
198
- return maxDate;
199
- })(),
200
- format: 'DD MMM YYYY',
201
- numberOfColumns: 2,
202
- numberOfMonths: 2,
203
- showTooltip: true,
204
- tooltipText: {
205
- one: 'night',
206
- other: 'nights',
207
- },
208
- tooltipNumber: (totalDays) => totalDays - 1,
209
- }
84
+ primaryColor: "#3b82f6",
85
+ secondaryColor: "#60a5fa"
210
86
  }
211
87
  };
212
- /**
213
- * Minimum and maximum stay duration restrictions.
214
- * Enforces booking rules like "minimum 3 nights" or "maximum 14 nights".
215
- */
216
- export const WithStayDurationLimits = {
88
+ export const CustomPurpleColor = {
217
89
  args: {
218
- placeholder: "3-14 nights stay",
219
- options: {
220
- autoApply: true,
221
- minDate: new Date(),
222
- minDays: 3,
223
- maxDays: 14,
224
- format: 'DD MMM YYYY',
225
- numberOfColumns: 2,
226
- numberOfMonths: 2,
227
- showTooltip: true,
228
- tooltipText: {
229
- one: 'night',
230
- other: 'nights',
231
- },
232
- tooltipNumber: (totalDays) => totalDays - 1,
233
- }
90
+ primaryColor: "#8b5cf6",
91
+ secondaryColor: "#a78bfa"
234
92
  }
235
93
  };
236
- /**
237
- * Different date format (YYYY-MM-DD).
238
- * Useful for backend integration or regional preferences.
239
- */
240
- export const CustomDateFormat = {
94
+ export const CustomRedColor = {
241
95
  args: {
242
- placeholder: "YYYY-MM-DD format",
243
- options: {
244
- autoApply: true,
245
- minDate: new Date(),
246
- format: 'YYYY-MM-DD',
247
- numberOfColumns: 2,
248
- numberOfMonths: 2,
249
- showTooltip: true,
250
- tooltipText: {
251
- one: 'night',
252
- other: 'nights',
253
- },
254
- tooltipNumber: (totalDays) => totalDays - 1,
255
- }
96
+ primaryColor: "#ef4444",
97
+ secondaryColor: "#f87171"
256
98
  }
257
99
  };
258
- /**
259
- * Manual apply mode - requires user to click apply button.
260
- * Gives users a chance to review their selection before confirming.
261
- */
262
- export const ManualApply = {
100
+ export const CustomGreenColor = {
263
101
  args: {
264
- placeholder: "Click apply to confirm",
265
- options: {
266
- autoApply: false,
267
- allowRepick: true,
268
- minDate: new Date(),
269
- format: 'DD MMM YYYY',
270
- numberOfColumns: 2,
271
- numberOfMonths: 2,
272
- showTooltip: true,
273
- tooltipText: {
274
- one: 'night',
275
- other: 'nights',
276
- },
277
- tooltipNumber: (totalDays) => totalDays - 1,
278
- }
102
+ primaryColor: "#10b981",
103
+ secondaryColor: "#34d399"
279
104
  }
280
105
  };
281
- /**
282
- * Compact single column layout.
283
- * Saves space while still providing full functionality.
284
- */
285
- export const SingleColumn = {
106
+ export const CustomOrangeColor = {
286
107
  args: {
287
- placeholder: "Compact view",
288
- options: {
289
- autoApply: true,
290
- minDate: new Date(),
291
- format: 'DD MMM YYYY',
292
- numberOfColumns: 1,
293
- numberOfMonths: 2,
294
- showTooltip: true,
295
- tooltipText: {
296
- one: 'night',
297
- other: 'nights',
298
- },
299
- tooltipNumber: (totalDays) => totalDays - 1,
300
- }
108
+ primaryColor: "#f97316",
109
+ secondaryColor: "#fb923c"
301
110
  }
302
111
  };
303
- /**
304
- * Without tooltip display.
305
- * Cleaner interface when night count is not needed.
306
- */
307
- export const WithoutTooltip = {
112
+ export const CustomPinkColor = {
308
113
  args: {
309
- placeholder: "No tooltip shown",
310
- options: {
311
- autoApply: true,
312
- minDate: new Date(),
313
- format: 'DD MMM YYYY',
314
- numberOfColumns: 2,
315
- numberOfMonths: 2,
316
- showTooltip: false
317
- }
114
+ primaryColor: "#ec4899",
115
+ secondaryColor: "#f472b6"
318
116
  }
319
117
  };
@@ -1 +1 @@
1
- {"version":3,"file":"RangepickerInput.vue.d.ts","sourceRoot":"","sources":["../src/RangepickerInput.vue"],"names":[],"mappings":"AAgNA,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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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;CACxB;;;;;;;;aAHW,SAAS,GAAG,QAAQ;iBAJhB,MAAM;cACT,OAAO;;;;;AAyNpB,wBAUG"}
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import './styles/rangepicker.scss';
2
2
  import Rangepicker from './Rangepicker.vue';
3
3
  import RangepickerInput from './RangepickerInput.vue';
4
- import type { DateRange, RangepickerProps } from './types';
4
+ import type { DateRange, RangepickerProps, RangepickerEmits, CalendarDay, CalendarMonth } from './types';
5
5
  export default RangepickerInput;
6
6
  export { Rangepicker, RangepickerInput };
7
- export type { RangepickerProps, DateRange };
7
+ export type { RangepickerProps, RangepickerEmits, DateRange, CalendarDay, CalendarMonth };
8
8
  export declare function useRangepicker(triggerRef: any, options?: Partial<RangepickerProps>): {
9
9
  isOpen: import("vue").Ref<boolean, boolean>;
10
10
  dateRange: import("vue").Ref<{
@@ -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,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAG1D,eAAe,gBAAgB,CAAA;AAG/B,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAA;AAGxC,YAAY,EAAE,gBAAgB,EAAE,SAAS,EAAE,CAAA;AAG3C,wBAAgB,cAAc,CAAC,UAAU,EAAE,GAAG,EAAE,OAAO,GAAE,OAAO,CAAC,gBAAgB,CAAM;;;;;;;;;;;;;EAgBtF"}
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,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAGxG,eAAe,gBAAgB,CAAA;AAG/B,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAA;AAGxC,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,CAAA;AAGzF,wBAAgB,cAAc,CAAC,UAAU,EAAE,GAAG,EAAE,OAAO,GAAE,OAAO,CAAC,gBAAgB,CAAM;;;;;;;;;;;;;EAgBtF"}