@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.
@@ -0,0 +1,379 @@
1
+ import { ref, watch } from "vue";
2
+ import RangepickerInput from "./RangepickerInput.vue";
3
+ /**
4
+ * Stories demonstrating theming and color customization options
5
+ * for the Rangepicker component.
6
+ */
7
+ const meta = {
8
+ title: "Components/Rangepicker/Theming",
9
+ component: RangepickerInput,
10
+ tags: ['autodocs'],
11
+ parameters: {
12
+ docs: {
13
+ description: {
14
+ component: `
15
+ ## Theming & Colors
16
+
17
+ Customize the appearance of the rangepicker with color props.
18
+ Each instance can have its own color scheme using HEX color values.
19
+
20
+ ### Color Props
21
+
22
+ | Prop | Description |
23
+ |------|-------------|
24
+ | \`primaryColor\` | Main accent color for selected dates, buttons, and highlights |
25
+ | \`secondaryColor\` | Hover states and range highlighting |
26
+
27
+ > **TIP**: Use complementary colors for \`primaryColor\` and \`secondaryColor\`
28
+ > to create a cohesive look. The secondary color should typically be a lighter
29
+ > shade of the primary color.
30
+ `,
31
+ },
32
+ },
33
+ },
34
+ argTypes: {
35
+ primaryColor: {
36
+ control: "color",
37
+ description: "Primary color for selected dates and highlights (HEX format)",
38
+ table: {
39
+ type: { summary: "string" },
40
+ defaultValue: { summary: "undefined (uses default blue)" },
41
+ },
42
+ },
43
+ secondaryColor: {
44
+ control: "color",
45
+ description: "Secondary color for hover states (HEX format)",
46
+ table: {
47
+ type: { summary: "string" },
48
+ defaultValue: { summary: "undefined (uses default light blue)" },
49
+ },
50
+ },
51
+ variant: {
52
+ control: "select",
53
+ options: ["desktop", "mobile"],
54
+ },
55
+ options: {
56
+ control: "object",
57
+ },
58
+ },
59
+ args: {
60
+ placeholder: "Check in / Check out",
61
+ id: "dates",
62
+ name: "dates",
63
+ variant: "desktop",
64
+ options: {
65
+ autoApply: true,
66
+ minDate: new Date(),
67
+ format: 'DD MMM YYYY',
68
+ numberOfColumns: 2,
69
+ numberOfMonths: 2,
70
+ }
71
+ },
72
+ render: (args) => ({
73
+ components: { RangepickerInput },
74
+ setup() {
75
+ const modelValue = ref(args.modelValue ?? "");
76
+ watch(() => args.modelValue, (value) => {
77
+ const nextValue = value ?? "";
78
+ if (nextValue !== modelValue.value) {
79
+ modelValue.value = nextValue;
80
+ }
81
+ });
82
+ return { args, modelValue };
83
+ },
84
+ template: `
85
+ <div style="padding: 2rem; background: #f5f5f5; min-height: 400px;">
86
+ <RangepickerInput v-bind="args" v-model="modelValue" class="form-control mb-0 shadow-none text-black lg:pl-2 border-0 w-full" />
87
+ </div>
88
+ `
89
+ })
90
+ };
91
+ export default meta;
92
+ /**
93
+ * Default theme with no custom colors applied.
94
+ */
95
+ export const DefaultTheme = {
96
+ args: {},
97
+ parameters: {
98
+ docs: {
99
+ description: {
100
+ story: `
101
+ ### Default Theme
102
+
103
+ No custom colors applied. Uses the component's default color scheme.
104
+ `,
105
+ },
106
+ },
107
+ },
108
+ };
109
+ /**
110
+ * Blue theme - professional and trustworthy.
111
+ */
112
+ export const BlueTheme = {
113
+ args: {
114
+ primaryColor: "#3b82f6",
115
+ secondaryColor: "#60a5fa",
116
+ },
117
+ parameters: {
118
+ docs: {
119
+ description: {
120
+ story: `
121
+ ### Blue Theme
122
+
123
+ A professional blue color scheme.
124
+
125
+ \`\`\`vue
126
+ <RangepickerInput
127
+ primaryColor="#3b82f6"
128
+ secondaryColor="#60a5fa"
129
+ />
130
+ \`\`\`
131
+ `,
132
+ },
133
+ },
134
+ },
135
+ };
136
+ /**
137
+ * Purple theme - creative and modern.
138
+ */
139
+ export const PurpleTheme = {
140
+ args: {
141
+ primaryColor: "#8b5cf6",
142
+ secondaryColor: "#a78bfa",
143
+ },
144
+ parameters: {
145
+ docs: {
146
+ description: {
147
+ story: `
148
+ ### Purple Theme
149
+
150
+ A creative purple color scheme.
151
+
152
+ \`\`\`vue
153
+ <RangepickerInput
154
+ primaryColor="#8b5cf6"
155
+ secondaryColor="#a78bfa"
156
+ />
157
+ \`\`\`
158
+ `,
159
+ },
160
+ },
161
+ },
162
+ };
163
+ /**
164
+ * Red theme - bold and attention-grabbing.
165
+ */
166
+ export const RedTheme = {
167
+ args: {
168
+ primaryColor: "#ef4444",
169
+ secondaryColor: "#f87171",
170
+ },
171
+ parameters: {
172
+ docs: {
173
+ description: {
174
+ story: `
175
+ ### Red Theme
176
+
177
+ A bold red color scheme.
178
+
179
+ \`\`\`vue
180
+ <RangepickerInput
181
+ primaryColor="#ef4444"
182
+ secondaryColor="#f87171"
183
+ />
184
+ \`\`\`
185
+ `,
186
+ },
187
+ },
188
+ },
189
+ };
190
+ /**
191
+ * Green theme - natural and calming.
192
+ */
193
+ export const GreenTheme = {
194
+ args: {
195
+ primaryColor: "#10b981",
196
+ secondaryColor: "#34d399",
197
+ },
198
+ parameters: {
199
+ docs: {
200
+ description: {
201
+ story: `
202
+ ### Green Theme
203
+
204
+ A natural green color scheme.
205
+
206
+ \`\`\`vue
207
+ <RangepickerInput
208
+ primaryColor="#10b981"
209
+ secondaryColor="#34d399"
210
+ />
211
+ \`\`\`
212
+ `,
213
+ },
214
+ },
215
+ },
216
+ };
217
+ /**
218
+ * Orange theme - warm and energetic.
219
+ */
220
+ export const OrangeTheme = {
221
+ args: {
222
+ primaryColor: "#f97316",
223
+ secondaryColor: "#fb923c",
224
+ },
225
+ parameters: {
226
+ docs: {
227
+ description: {
228
+ story: `
229
+ ### Orange Theme
230
+
231
+ A warm orange color scheme.
232
+
233
+ \`\`\`vue
234
+ <RangepickerInput
235
+ primaryColor="#f97316"
236
+ secondaryColor="#fb923c"
237
+ />
238
+ \`\`\`
239
+ `,
240
+ },
241
+ },
242
+ },
243
+ };
244
+ /**
245
+ * Pink theme - playful and vibrant.
246
+ */
247
+ export const PinkTheme = {
248
+ args: {
249
+ primaryColor: "#ec4899",
250
+ secondaryColor: "#f472b6",
251
+ },
252
+ parameters: {
253
+ docs: {
254
+ description: {
255
+ story: `
256
+ ### Pink Theme
257
+
258
+ A playful pink color scheme.
259
+
260
+ \`\`\`vue
261
+ <RangepickerInput
262
+ primaryColor="#ec4899"
263
+ secondaryColor="#f472b6"
264
+ />
265
+ \`\`\`
266
+ `,
267
+ },
268
+ },
269
+ },
270
+ };
271
+ /**
272
+ * Teal theme - fresh and modern.
273
+ */
274
+ export const TealTheme = {
275
+ args: {
276
+ primaryColor: "#14b8a6",
277
+ secondaryColor: "#2dd4bf",
278
+ },
279
+ parameters: {
280
+ docs: {
281
+ description: {
282
+ story: `
283
+ ### Teal Theme
284
+
285
+ A fresh teal color scheme.
286
+
287
+ \`\`\`vue
288
+ <RangepickerInput
289
+ primaryColor="#14b8a6"
290
+ secondaryColor="#2dd4bf"
291
+ />
292
+ \`\`\`
293
+ `,
294
+ },
295
+ },
296
+ },
297
+ };
298
+ /**
299
+ * Indigo theme - elegant and sophisticated.
300
+ */
301
+ export const IndigoTheme = {
302
+ args: {
303
+ primaryColor: "#6366f1",
304
+ secondaryColor: "#818cf8",
305
+ },
306
+ parameters: {
307
+ docs: {
308
+ description: {
309
+ story: `
310
+ ### Indigo Theme
311
+
312
+ An elegant indigo color scheme.
313
+
314
+ \`\`\`vue
315
+ <RangepickerInput
316
+ primaryColor="#6366f1"
317
+ secondaryColor="#818cf8"
318
+ />
319
+ \`\`\`
320
+ `,
321
+ },
322
+ },
323
+ },
324
+ };
325
+ /**
326
+ * Dark theme - sleek and modern.
327
+ */
328
+ export const DarkTheme = {
329
+ args: {
330
+ primaryColor: "#374151",
331
+ secondaryColor: "#6b7280",
332
+ },
333
+ parameters: {
334
+ docs: {
335
+ description: {
336
+ story: `
337
+ ### Dark/Gray Theme
338
+
339
+ A sleek dark gray color scheme.
340
+
341
+ \`\`\`vue
342
+ <RangepickerInput
343
+ primaryColor="#374151"
344
+ secondaryColor="#6b7280"
345
+ />
346
+ \`\`\`
347
+ `,
348
+ },
349
+ },
350
+ },
351
+ };
352
+ /**
353
+ * Interactive color picker - try your own colors!
354
+ */
355
+ export const CustomColors = {
356
+ args: {
357
+ primaryColor: "#0ea5e9",
358
+ secondaryColor: "#38bdf8",
359
+ },
360
+ parameters: {
361
+ docs: {
362
+ description: {
363
+ story: `
364
+ ### Custom Colors
365
+
366
+ Use the **Controls** panel below to experiment with your own color combinations!
367
+
368
+ 1. Click the color picker for \`primaryColor\`
369
+ 2. Choose your main accent color
370
+ 3. Click the color picker for \`secondaryColor\`
371
+ 4. Choose a complementary lighter shade
372
+
373
+ > **TIP**: For best results, make the secondary color a lighter version
374
+ > of the primary color (increase lightness by 10-20%).
375
+ `,
376
+ },
377
+ },
378
+ },
379
+ };
@@ -313,27 +313,28 @@ const _hoisted_6 = {
313
313
  class: "arch-text-xs arch-text-gray-500 arch-mt-1"
314
314
  };
315
315
  const _hoisted_7 = { class: "rangepicker-body" };
316
- const _hoisted_8 = { class: "rangepicker-month-header" };
317
- const _hoisted_9 = ["disabled"];
318
- const _hoisted_10 = {
316
+ const _hoisted_8 = { class: "rangepicker-month-grid" };
317
+ const _hoisted_9 = { class: "rangepicker-month-header" };
318
+ const _hoisted_10 = ["disabled"];
319
+ const _hoisted_11 = {
319
320
  key: 1,
320
321
  class: "arch-w-8"
321
322
  };
322
- const _hoisted_11 = { class: "rangepicker-month-title" };
323
- const _hoisted_12 = ["disabled"];
324
- const _hoisted_13 = {
323
+ const _hoisted_12 = { class: "rangepicker-month-title" };
324
+ const _hoisted_13 = ["disabled"];
325
+ const _hoisted_14 = {
325
326
  key: 3,
326
327
  class: "arch-w-8"
327
328
  };
328
- const _hoisted_14 = { class: "rangepicker-weekdays" };
329
- const _hoisted_15 = { class: "rangepicker-grid" };
330
- const _hoisted_16 = ["disabled", "aria-label", "onClick", "onMouseenter"];
331
- const _hoisted_17 = {
329
+ const _hoisted_15 = { class: "rangepicker-weekdays" };
330
+ const _hoisted_16 = { class: "rangepicker-grid" };
331
+ const _hoisted_17 = ["disabled", "aria-label", "onClick", "onMouseenter"];
332
+ const _hoisted_18 = {
332
333
  key: 0,
333
334
  class: "arch-mt-4 arch-flex arch-items-center arch-justify-end arch-gap-2 arch-border-t arch-border-gray-200 arch-pt-4"
334
335
  };
335
- const _hoisted_18 = ["disabled"];
336
- const _hoisted_19 = { class: "arch-flex arch-items-center arch-gap-1" };
336
+ const _hoisted_19 = ["disabled"];
337
+ const _hoisted_20 = { class: "arch-flex arch-items-center arch-gap-1" };
337
338
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
338
339
  __name: "Rangepicker",
339
340
  props: {
@@ -368,7 +369,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
368
369
  const numberOfMonths = computed(
369
370
  () => isMobile.value ? 1 : props.valueOfMonths
370
371
  );
371
- const numberOfColumns = computed(
372
+ computed(
372
373
  () => isMobile.value ? 1 : props.valueOfColumns
373
374
  );
374
375
  const calendarRef = ref(null);
@@ -638,17 +639,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
638
639
  ])
639
640
  ]),
640
641
  createElementVNode("div", _hoisted_7, [
641
- createElementVNode("div", {
642
- class: normalizeClass(["rangepicker-month-grid", [
643
- __props.variant === "mobile" ? "arch-grid-cols-1" : `lg:arch-grid-cols-${numberOfColumns.value}`
644
- ]])
645
- }, [
642
+ createElementVNode("div", _hoisted_8, [
646
643
  (openBlock(true), createElementBlock(Fragment, null, renderList(calendarMonths.value, (monthData, index) => {
647
644
  return openBlock(), createElementBlock("div", {
648
645
  key: monthData.month.format("YYYY-MM"),
649
646
  class: "rangepicker-month"
650
647
  }, [
651
- createElementVNode("div", _hoisted_8, [
648
+ createElementVNode("div", _hoisted_9, [
652
649
  __props.variant === "mobile" || index === 0 ? (openBlock(), createElementBlock("button", {
653
650
  key: 0,
654
651
  class: "rangepicker-nav-button",
@@ -668,8 +665,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
668
665
  "clip-rule": "evenodd"
669
666
  })
670
667
  ], -1)
671
- ])], 8, _hoisted_9)) : (openBlock(), createElementBlock("div", _hoisted_10)),
672
- createElementVNode("span", _hoisted_11, toDisplayString(monthData.month.format("MMMM YYYY")), 1),
668
+ ])], 8, _hoisted_10)) : (openBlock(), createElementBlock("div", _hoisted_11)),
669
+ createElementVNode("span", _hoisted_12, toDisplayString(monthData.month.format("MMMM YYYY")), 1),
673
670
  __props.variant === "mobile" || index === calendarMonths.value.length - 1 ? (openBlock(), createElementBlock("button", {
674
671
  key: 2,
675
672
  class: "rangepicker-nav-button",
@@ -689,9 +686,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
689
686
  "clip-rule": "evenodd"
690
687
  })
691
688
  ], -1)
692
- ])], 8, _hoisted_12)) : (openBlock(), createElementBlock("div", _hoisted_13))
689
+ ])], 8, _hoisted_13)) : (openBlock(), createElementBlock("div", _hoisted_14))
693
690
  ]),
694
- createElementVNode("div", _hoisted_14, [
691
+ createElementVNode("div", _hoisted_15, [
695
692
  (openBlock(true), createElementBlock(Fragment, null, renderList(weekdays.value, (weekday) => {
696
693
  return openBlock(), createElementBlock("div", {
697
694
  key: weekday,
@@ -699,7 +696,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
699
696
  }, toDisplayString(weekday), 1);
700
697
  }), 128))
701
698
  ]),
702
- createElementVNode("div", _hoisted_15, [
699
+ createElementVNode("div", _hoisted_16, [
703
700
  (openBlock(true), createElementBlock(Fragment, null, renderList(monthData.days, (day) => {
704
701
  return openBlock(), createElementBlock("button", {
705
702
  key: day.date.unix(),
@@ -711,13 +708,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
711
708
  onMouseleave: handleDayLeave
712
709
  }, [
713
710
  createElementVNode("span", null, toDisplayString(day.date.date()), 1)
714
- ], 42, _hoisted_16);
711
+ ], 42, _hoisted_17);
715
712
  }), 128))
716
713
  ])
717
714
  ]);
718
715
  }), 128))
719
- ], 2),
720
- !__props.autoApply ? (openBlock(), createElementBlock("div", _hoisted_17, [
716
+ ]),
717
+ !__props.autoApply ? (openBlock(), createElementBlock("div", _hoisted_18, [
721
718
  createElementVNode("button", {
722
719
  class: "arch-px-4 arch-py-2 arch-text-sm arch-font-medium arch-text-gray-700 hover:arch-bg-gray-100 arch-rounded-lg arch-transition-colors",
723
720
  onClick: cancel
@@ -726,7 +723,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
726
723
  class: "arch-px-4 arch-py-2 arch-text-sm arch-font-medium arch-text-white arch-bg-blue-600 hover:arch-bg-blue-700 arch-rounded-lg arch-transition-colors disabled:arch-opacity-50 disabled:arch-cursor-not-allowed",
727
724
  disabled: !localStartDate.value || !localEndDate.value,
728
725
  onClick: apply
729
- }, " Apply ", 8, _hoisted_18)
726
+ }, " Apply ", 8, _hoisted_19)
730
727
  ])) : createCommentVNode("", true)
731
728
  ]),
732
729
  showTooltipComputed.value ? (openBlock(), createElementBlock("div", {
@@ -734,7 +731,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
734
731
  class: "rangepicker-tooltip",
735
732
  style: normalizeStyle(tooltipStyle.value)
736
733
  }, [
737
- createElementVNode("div", _hoisted_19, toDisplayString(tooltipText.value), 1)
734
+ createElementVNode("div", _hoisted_20, toDisplayString(tooltipText.value), 1)
738
735
  ], 4)) : createCommentVNode("", true)
739
736
  ], 6)
740
737
  ])) : createCommentVNode("", true)
@@ -752,7 +749,7 @@ const _export_sfc = (sfc, props) => {
752
749
  }
753
750
  return target;
754
751
  };
755
- const Rangepicker = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-28d37b0e"]]);
752
+ const Rangepicker = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-d26b2742"]]);
756
753
  const _hoisted_1 = ["id", "value", "placeholder", "readonly", "name"];
757
754
  const _sfc_main = /* @__PURE__ */ defineComponent({
758
755
  __name: "RangepickerInput",
@@ -767,7 +764,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
767
764
  options: {},
768
765
  variant: { default: "desktop" },
769
766
  primaryColor: {},
770
- secondaryColor: {}
767
+ secondaryColor: {},
768
+ fontFamily: {}
771
769
  },
772
770
  emits: ["update:modelValue", "focusin"],
773
771
  setup(__props, { emit: __emit }) {
@@ -845,6 +843,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
845
843
  styles["--color-secondary"] = rgb;
846
844
  }
847
845
  }
846
+ styles["--font-family"] = props.fontFamily || "inherit";
848
847
  return styles;
849
848
  });
850
849
  return (_ctx, _cache) => {
@@ -893,7 +892,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
893
892
  };
894
893
  }
895
894
  });
896
- const RangepickerInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4e3d84fa"]]);
895
+ const RangepickerInput = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-425c6c38"]]);
897
896
  function useRangepicker(triggerRef, options = {}) {
898
897
  const isOpen = ref(false);
899
898
  const dateRange = ref({ startDate: "", endDate: "" });