@plexui/vue 0.8.1 → 0.9.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.
Files changed (185) hide show
  1. package/dist/es/components/Badge/Badge.js +1 -1
  2. package/dist/es/components/Badge/Badge.js.map +1 -1
  3. package/dist/es/components/Button/Button.js +13 -5
  4. package/dist/es/components/Button/Button.js.map +1 -1
  5. package/dist/es/components/Button/ButtonLink.js +7 -1
  6. package/dist/es/components/Button/ButtonLink.js.map +1 -1
  7. package/dist/es/components/Button/NavigationButton.js +27 -0
  8. package/dist/es/components/Button/NavigationButton.js.map +1 -0
  9. package/dist/es/components/Button/NavigationGlyph.js +27 -0
  10. package/dist/es/components/Button/NavigationGlyph.js.map +1 -0
  11. package/dist/es/components/Button/index.js +1 -0
  12. package/dist/es/components/Button/index.js.map +1 -1
  13. package/dist/es/components/Checkbox/Checkbox.js +14 -4
  14. package/dist/es/components/Checkbox/Checkbox.js.map +1 -1
  15. package/dist/es/components/DateInput/DateInput.js +7 -3
  16. package/dist/es/components/DateInput/DateInput.js.map +1 -1
  17. package/dist/es/components/DatePicker/Calendar.js +130 -86
  18. package/dist/es/components/DatePicker/Calendar.js.map +1 -1
  19. package/dist/es/components/DatePicker/CalendarNavigationIcon.js +31 -0
  20. package/dist/es/components/DatePicker/CalendarNavigationIcon.js.map +1 -0
  21. package/dist/es/components/DatePicker/DatePicker.js +16 -4
  22. package/dist/es/components/DatePicker/DatePicker.js.map +1 -1
  23. package/dist/es/components/DatePicker/context.js.map +1 -1
  24. package/dist/es/components/DatePicker/useCalendarGutter.js +14 -0
  25. package/dist/es/components/DatePicker/useCalendarGutter.js.map +1 -0
  26. package/dist/es/components/DateRangePicker/Calendar.js +92 -71
  27. package/dist/es/components/DateRangePicker/Calendar.js.map +1 -1
  28. package/dist/es/components/DateRangePicker/DateRangePicker.js +13 -4
  29. package/dist/es/components/DateRangePicker/DateRangePicker.js.map +1 -1
  30. package/dist/es/components/DateRangePicker/Trigger.js +1 -0
  31. package/dist/es/components/DateRangePicker/Trigger.js.map +1 -1
  32. package/dist/es/components/Dialog/Dialog.js +124 -52
  33. package/dist/es/components/Dialog/Dialog.js.map +1 -1
  34. package/dist/es/components/Dialog/index.js.map +1 -1
  35. package/dist/es/components/Dialog/sheetDrag.js +77 -24
  36. package/dist/es/components/Dialog/sheetDrag.js.map +1 -1
  37. package/dist/es/components/Field/Field.js +58 -5
  38. package/dist/es/components/Field/Field.js.map +1 -1
  39. package/dist/es/components/FieldGroup/FieldGroup.js +3 -1
  40. package/dist/es/components/FieldGroup/FieldGroup.js.map +1 -1
  41. package/dist/es/components/FileUpload/FileUpload.js +50 -11
  42. package/dist/es/components/FileUpload/FileUpload.js.map +1 -1
  43. package/dist/es/components/FloatingLabelInput/FloatingLabelInput.js +24 -13
  44. package/dist/es/components/FloatingLabelInput/FloatingLabelInput.js.map +1 -1
  45. package/dist/es/components/FloatingLabelSelect/FloatingLabelSelect.js +9 -3
  46. package/dist/es/components/FloatingLabelSelect/FloatingLabelSelect.js.map +1 -1
  47. package/dist/es/components/Icon/index.js +1 -0
  48. package/dist/es/components/Icon/index.js.map +1 -1
  49. package/dist/es/components/Icon/svg/Disclosure.js +10 -0
  50. package/dist/es/components/Icon/svg/Disclosure.js.map +1 -0
  51. package/dist/es/components/Indicator/LoadingIndicator.js +2 -2
  52. package/dist/es/components/Indicator/LoadingIndicator.js.map +1 -1
  53. package/dist/es/components/Input/Input.js +15 -5
  54. package/dist/es/components/Input/Input.js.map +1 -1
  55. package/dist/es/components/InputGroup/InputGroup.js +3 -1
  56. package/dist/es/components/InputGroup/InputGroup.js.map +1 -1
  57. package/dist/es/components/MarkdownEditor/MarkdownEditor.js +126 -151
  58. package/dist/es/components/MarkdownEditor/MarkdownEditor.js.map +1 -1
  59. package/dist/es/components/Menu/Menu.js +217 -35
  60. package/dist/es/components/Menu/Menu.js.map +1 -1
  61. package/dist/es/components/Menu/internal.js +2 -1
  62. package/dist/es/components/Menu/internal.js.map +1 -1
  63. package/dist/es/components/OTPInput/OTPInput.js +7 -4
  64. package/dist/es/components/OTPInput/OTPInput.js.map +1 -1
  65. package/dist/es/components/Page/Page.js +93 -14
  66. package/dist/es/components/Page/Page.js.map +1 -1
  67. package/dist/es/components/Page/index.js +1 -1
  68. package/dist/es/components/Page/index.js.map +1 -1
  69. package/dist/es/components/Popover/Popover.js +16 -6
  70. package/dist/es/components/Popover/Popover.js.map +1 -1
  71. package/dist/es/components/Popover/deferredPointerDownOutside.js +6 -0
  72. package/dist/es/components/Popover/deferredPointerDownOutside.js.map +1 -1
  73. package/dist/es/components/RadioGroup/RadioGroup.js +29 -12
  74. package/dist/es/components/RadioGroup/RadioGroup.js.map +1 -1
  75. package/dist/es/components/Select/Select.js +75 -25
  76. package/dist/es/components/Select/Select.js.map +1 -1
  77. package/dist/es/components/SelectControl/SelectControl.js +58 -25
  78. package/dist/es/components/SelectControl/SelectControl.js.map +1 -1
  79. package/dist/es/components/SelectControl/index.js +1 -1
  80. package/dist/es/components/SelectControl/index.js.map +1 -1
  81. package/dist/es/components/ShimmerText/ShimmerText.js +16 -3
  82. package/dist/es/components/ShimmerText/ShimmerText.js.map +1 -1
  83. package/dist/es/components/Slider/Slider.js +56 -16
  84. package/dist/es/components/Slider/Slider.js.map +1 -1
  85. package/dist/es/components/Sortable/Sortable.js +20 -13
  86. package/dist/es/components/Sortable/Sortable.js.map +1 -1
  87. package/dist/es/components/Switch/Switch.js +6 -3
  88. package/dist/es/components/Switch/Switch.js.map +1 -1
  89. package/dist/es/components/Tabs/Tabs.js +12 -11
  90. package/dist/es/components/Tabs/Tabs.js.map +1 -1
  91. package/dist/es/components/TagInput/TagInput.js +46 -6
  92. package/dist/es/components/TagInput/TagInput.js.map +1 -1
  93. package/dist/es/components/Textarea/Textarea.js +13 -2
  94. package/dist/es/components/Textarea/Textarea.js.map +1 -1
  95. package/dist/es/components/Toast/ToastRenderer.js +144 -0
  96. package/dist/es/components/Toast/ToastRenderer.js.map +1 -0
  97. package/dist/es/components/Toast/Toaster.js +23 -1
  98. package/dist/es/components/Toast/Toaster.js.map +1 -1
  99. package/dist/es/components/Toast/toastLifecycle.js +283 -0
  100. package/dist/es/components/Toast/toastLifecycle.js.map +1 -0
  101. package/dist/es/components/Toolbar/Toolbar.js +107 -0
  102. package/dist/es/components/Toolbar/Toolbar.js.map +1 -0
  103. package/dist/es/components/Toolbar/index.js +2 -0
  104. package/dist/es/components/Toolbar/index.js.map +1 -0
  105. package/dist/es/components/Tooltip/CopyTooltip.js +39 -13
  106. package/dist/es/components/Tooltip/CopyTooltip.js.map +1 -1
  107. package/dist/es/components/Tooltip/Tooltip.js +35 -14
  108. package/dist/es/components/Tooltip/Tooltip.js.map +1 -1
  109. package/dist/es/composables/useFloatingBoundary.js +48 -0
  110. package/dist/es/composables/useFloatingBoundary.js.map +1 -0
  111. package/dist/es/composables/usePhoneSubmenu.js +19 -0
  112. package/dist/es/composables/usePhoneSubmenu.js.map +1 -0
  113. package/dist/es/lib/copyToClipboard.js +16 -7
  114. package/dist/es/lib/copyToClipboard.js.map +1 -1
  115. package/dist/es/lib/floatingBoundary.js +90 -0
  116. package/dist/es/lib/floatingBoundary.js.map +1 -0
  117. package/dist/es/lib/focusRestore.js +56 -0
  118. package/dist/es/lib/focusRestore.js.map +1 -0
  119. package/dist/es/lib/helpers.js +0 -18
  120. package/dist/es/lib/helpers.js.map +1 -1
  121. package/dist/es/lib/inputMode.js +9 -0
  122. package/dist/es/lib/inputMode.js.map +1 -0
  123. package/dist/es/lib/menuInitialFocus.js +100 -0
  124. package/dist/es/lib/menuInitialFocus.js.map +1 -0
  125. package/dist/es/lib/menuSubmenuPlacement.js +219 -0
  126. package/dist/es/lib/menuSubmenuPlacement.js.map +1 -0
  127. package/dist/es/lib/observeTextareaWidth.js +49 -0
  128. package/dist/es/lib/observeTextareaWidth.js.map +1 -0
  129. package/dist/es/lib/selectPress.js +34 -0
  130. package/dist/es/lib/selectPress.js.map +1 -0
  131. package/dist/es/lib/sortable.js +74 -20
  132. package/dist/es/lib/sortable.js.map +1 -1
  133. package/dist/types/components/Button/Button.d.ts +6 -2
  134. package/dist/types/components/Button/ButtonLink.d.ts +6 -2
  135. package/dist/types/components/Button/NavigationButton.d.ts +27 -0
  136. package/dist/types/components/Button/NavigationGlyph.d.ts +16 -0
  137. package/dist/types/components/Button/index.d.ts +1 -0
  138. package/dist/types/components/Checkbox/Checkbox.d.ts +12 -12
  139. package/dist/types/components/DateInput/DateInput.d.ts +4 -4
  140. package/dist/types/components/DatePicker/CalendarNavigationIcon.d.ts +6 -0
  141. package/dist/types/components/DatePicker/DatePicker.d.ts +13 -13
  142. package/dist/types/components/DatePicker/context.d.ts +1 -0
  143. package/dist/types/components/DatePicker/useCalendarGutter.d.ts +2 -0
  144. package/dist/types/components/DateRangePicker/DateRangePicker.d.ts +13 -13
  145. package/dist/types/components/Dialog/Dialog.d.ts +46 -11
  146. package/dist/types/components/Dialog/index.d.ts +1 -1
  147. package/dist/types/components/Field/Field.d.ts +2 -2
  148. package/dist/types/components/FileUpload/FileUpload.d.ts +6 -6
  149. package/dist/types/components/FloatingLabelInput/FloatingLabelInput.d.ts +4 -4
  150. package/dist/types/components/Icon/index.d.ts +1 -0
  151. package/dist/types/components/Icon/svg/Disclosure.d.ts +3 -0
  152. package/dist/types/components/Indicator/LoadingIndicator.d.ts +2 -2
  153. package/dist/types/components/Input/Input.d.ts +2 -2
  154. package/dist/types/components/MarkdownEditor/MarkdownEditor.d.ts +8 -8
  155. package/dist/types/components/Menu/Menu.d.ts +18 -25
  156. package/dist/types/components/OTPInput/OTPInput.d.ts +6 -6
  157. package/dist/types/components/Page/Page.d.ts +48 -7
  158. package/dist/types/components/Page/index.d.ts +1 -1
  159. package/dist/types/components/Popover/Popover.d.ts +17 -6
  160. package/dist/types/components/RadioGroup/RadioGroup.d.ts +10 -10
  161. package/dist/types/components/SelectControl/index.d.ts +1 -1
  162. package/dist/types/components/Sortable/Sortable.d.ts +8 -8
  163. package/dist/types/components/Switch/Switch.d.ts +34 -12
  164. package/dist/types/components/Tabs/Tabs.d.ts +6 -6
  165. package/dist/types/components/TagInput/TagInput.d.ts +4 -4
  166. package/dist/types/components/Textarea/Textarea.d.ts +2 -2
  167. package/dist/types/components/Toast/ToastRenderer.d.ts +79 -0
  168. package/dist/types/components/Toast/Toaster.d.ts +6 -2
  169. package/dist/types/components/Toast/toastLifecycle.d.ts +90 -0
  170. package/dist/types/components/Toolbar/Toolbar.d.ts +149 -0
  171. package/dist/types/components/Toolbar/index.d.ts +1 -0
  172. package/dist/types/components/Tooltip/CopyTooltip.d.ts +2 -2
  173. package/dist/types/components/Tooltip/Tooltip.d.ts +6 -6
  174. package/dist/types/composables/useFloatingBoundary.d.ts +24 -0
  175. package/dist/types/composables/usePhoneSubmenu.d.ts +3 -0
  176. package/dist/types/lib/floatingBoundary.d.ts +9 -0
  177. package/dist/types/lib/focusRestore.d.ts +5 -0
  178. package/dist/types/lib/helpers.d.ts +0 -4
  179. package/dist/types/lib/inputMode.d.ts +7 -0
  180. package/dist/types/lib/menuInitialFocus.d.ts +9 -0
  181. package/dist/types/lib/menuSubmenuPlacement.d.ts +44 -0
  182. package/dist/types/lib/observeTextareaWidth.d.ts +2 -0
  183. package/dist/types/lib/selectPress.d.ts +23 -0
  184. package/dist/types/lib/sortable.d.ts +1 -1
  185. package/package.json +2 -2
@@ -1,11 +1,13 @@
1
1
  import { DateTime, Interval } from "luxon";
2
- import { computed, createCommentVNode, defineComponent, h, onMounted, ref, shallowRef, watch } from "vue";
2
+ import { computed, createCommentVNode, defineComponent, h, ref, shallowRef, watch } from "vue";
3
3
  import { useBreakpoint } from "../../composables/useBreakpoints.js";
4
4
  import { chunkIntoWeeks, getDaysOfMonth, isAfter, isBefore, isSameDay, isToday, weekPosition } from "../../lib/dateUtils.js";
5
5
  import { waitForAnimationFrame } from "../../lib/helpers.js";
6
6
  import { Button } from "../Button/index.js";
7
- import { Check, ChevronLeft, ChevronRight } from "../Icon/index.js";
7
+ import { Check } from "../Icon/index.js";
8
+ import { CalendarNavigationIcon } from "../DatePicker/CalendarNavigationIcon.js";
8
9
  import { TransitionGroup } from "../Transition/index.js";
10
+ import { isHoverPointer } from "../../lib/inputMode.js";
9
11
  import s from "@plexui/styles/components/DateRangePicker/Calendar.module.css";
10
12
  import { useDateRangeContext } from "./context.js";
11
13
  import {} from "./types.js";
@@ -16,8 +18,8 @@ import {} from "./types.js";
16
18
  // React, when the value jumps out of view.
17
19
  // - React's pending-focus effect is a post watcher on the left month; its
18
20
  // cleanup cancels the frame, as the effect's does.
19
- // - Below the `sm` breakpoint the right calendar is a placeholder, as React's
20
- // `{isSmallUp && ...}`: TransitionGroup still renders its (empty) wrapper
21
+ // - Below the `md` breakpoint the right calendar is a placeholder, as React's
22
+ // `{isMediumUp && ...}`: TransitionGroup still renders its (empty) wrapper
21
23
  // when animations are off.
22
24
  // - React quirk kept: the day buttons have no `type`.
23
25
  // The day a grid key moves to: a day, a week, the first or last day of the
@@ -49,30 +51,36 @@ export const DateRangeCalendar = defineComponent({
49
51
  name: "DateRangeCalendar",
50
52
  setup() {
51
53
  const context = useDateRangeContext();
52
- const isSmallUp = useBreakpoint("sm");
54
+ const isMediumUp = useBreakpoint("md");
53
55
  const calendarContainerRef = shallowRef(null);
54
56
  // The day to focus once a key has moved the view to its month
55
57
  let pendingFocus = null;
56
58
  const selectionRange = shallowRef(null);
57
59
  const calendarSteps = ref(0);
58
60
  const forceRenderIncrement = ref(0);
59
- const leftCalendarDate = shallowRef(isSmallUp.value
61
+ const leftCalendarDate = shallowRef(isMediumUp.value
60
62
  ? getLeftCalendarDate(context.value?.[0] ?? DateTime.now(), context.max)
61
63
  : (context.value?.[0] ?? DateTime.now()));
62
- const rightCalendarDate = computed(() => isSmallUp.value
64
+ const rightCalendarDate = computed(() => isMediumUp.value
63
65
  ? leftCalendarDate.value.plus({ months: 1 }).startOf("month")
64
66
  : leftCalendarDate.value.startOf("month"));
65
67
  const canGoBack = () => !context.min || isBefore(context.min, leftCalendarDate.value.startOf("month"));
66
68
  const canGoForward = () => !context.max || isBefore(rightCalendarDate.value.endOf("month"), context.max);
67
69
  const handleNext = () => {
70
+ if (context.disabled)
71
+ return;
68
72
  calendarSteps.value += 1;
69
73
  leftCalendarDate.value = leftCalendarDate.value.plus({ months: 1 });
70
74
  };
71
75
  const handlePrevious = () => {
76
+ if (context.disabled)
77
+ return;
72
78
  calendarSteps.value -= 1;
73
79
  leftCalendarDate.value = leftCalendarDate.value.minus({ months: 1 });
74
80
  };
75
81
  const handleDateSelect = (selectedDate) => {
82
+ if (context.disabled)
83
+ return;
76
84
  if (!selectionRange.value) {
77
85
  selectionRange.value = [selectedDate, selectedDate];
78
86
  return;
@@ -89,6 +97,8 @@ export const DateRangeCalendar = defineComponent({
89
97
  selectionRange.value = null;
90
98
  };
91
99
  const handleDateMouseEnter = (hoveredDate) => {
100
+ if (context.disabled)
101
+ return;
92
102
  // If we're not actively selecting, no-op
93
103
  const currentSelectionRange = selectionRange.value;
94
104
  if (!currentSelectionRange) {
@@ -121,7 +131,7 @@ export const DateRangeCalendar = defineComponent({
121
131
  ?.focus();
122
132
  };
123
133
  const handleDayKeyDown = (event, day) => {
124
- if (event.altKey || event.ctrlKey || event.metaKey) {
134
+ if (context.disabled || event.altKey || event.ctrlKey || event.metaKey) {
125
135
  return;
126
136
  }
127
137
  // While a move waits for its month to render, the next key starts from
@@ -179,43 +189,45 @@ export const DateRangeCalendar = defineComponent({
179
189
  // Reset state the calendar view entirely
180
190
  selectionRange.value = null;
181
191
  calendarSteps.value = 0;
182
- leftCalendarDate.value = isSmallUp.value ? getLeftCalendarDate(value[0], context.max) : value[0];
192
+ leftCalendarDate.value = isMediumUp.value ? getLeftCalendarDate(value[0], context.max) : value[0];
183
193
  forceRenderIncrement.value += 1;
184
194
  }
185
195
  });
186
- // Detect height changes when new calendars are rendered
187
- const measureHeight = () => {
188
- waitForAnimationFrame(() => {
196
+ // Observe calendar border boxes as Phone geometry/fonts change, as well as month changes.
197
+ watch([leftCalendarDate, forceRenderIncrement, isMediumUp], (_value, _previous, onCleanup) => {
198
+ let cancelTransition;
199
+ let observer;
200
+ const cancelMeasure = waitForAnimationFrame(() => {
189
201
  const container = calendarContainerRef.value;
190
- if (!container) {
202
+ if (!container)
191
203
  return;
192
- }
193
- let maxHeight = -Infinity;
194
- // Find the tallest calendar
195
- container.querySelectorAll("[data-calendar]")?.forEach((element) => {
196
- // NOTE: clientHeight does not respect the scale() that popover uses to animate in, which is what we want
197
- // We want to know the full height of the element, without any transform applied.
198
- const height = element.clientHeight;
199
- // Ignore calendars that are exiting
200
- if (element.closest("[data-exiting]")) {
204
+ const calendars = () => Array.from(container.querySelectorAll("[data-calendar]"))
205
+ .filter((element) => !element.closest("[data-exiting]"));
206
+ const measure = () => {
207
+ const visible = calendars();
208
+ if (!visible.length)
201
209
  return;
210
+ const height = `${Math.max(...visible.map((element) => element.clientHeight))}px`;
211
+ if (container.style.height !== height)
212
+ container.style.height = height;
213
+ // Do not animate the initial measurement. CSS follows live reduced motion.
214
+ if (!container.style.transition && !cancelTransition) {
215
+ cancelTransition = waitForAnimationFrame(() => {
216
+ container.style.transition = "height var(--calendar-height-duration, 0.25s) var(--cubic-move)";
217
+ });
202
218
  }
203
- if (height > maxHeight) {
204
- maxHeight = height;
205
- }
206
- });
207
- container.style.height = `${maxHeight}px`;
208
- // Don't animate the initial height.
209
- // This is relevant when the calendar opens to a larger size than the default.
210
- if (!container.style.transition) {
211
- waitForAnimationFrame(() => {
212
- container.style.transition = `height 0.25s var(--cubic-move)`;
213
- });
214
- }
219
+ };
220
+ measure();
221
+ observer = typeof ResizeObserver !== "undefined" ? new ResizeObserver(measure) : undefined;
222
+ observer?.observe(container, { box: "border-box" });
223
+ calendars().forEach((calendar) => observer?.observe(calendar, { box: "border-box" }));
215
224
  });
216
- };
217
- onMounted(measureHeight);
218
- watch(leftCalendarDate, measureHeight, { flush: "post" });
225
+ onCleanup(() => {
226
+ cancelMeasure();
227
+ cancelTransition?.();
228
+ observer?.disconnect();
229
+ });
230
+ }, { immediate: true, flush: "post" });
219
231
  // Focus a pending day once its month has rendered. TransitionGroup marks
220
232
  // the leaving calendar after this render, so wait a frame like the height does
221
233
  watch(leftCalendarDate, (_date, _previous, onCleanup) => {
@@ -251,7 +263,8 @@ export const DateRangeCalendar = defineComponent({
251
263
  onDayKeyDown: handleDayKeyDown,
252
264
  };
253
265
  return h("div", { key: `stable-view-${forceRenderIncrement.value}`, class: s.CalendarWrapper }, [
254
- h("div", { ref: setContainer, class: s.CalendarContainer, onMouseleave: handleCalendarMouseLeave }, [
266
+ h("div", { ref: setContainer, class: s.CalendarContainer, onPointerleave: (event) => { if (isHoverPointer(event))
267
+ handleCalendarMouseLeave(); } }, [
255
268
  h("div", { class: s.Previous }, [
256
269
  h(Button, {
257
270
  "variant": "ghost",
@@ -261,9 +274,9 @@ export const DateRangeCalendar = defineComponent({
261
274
  "gutterSize": "2xs",
262
275
  "iconSize": "sm",
263
276
  "onClick": handlePrevious,
264
- "disabled": !canGoBack(),
277
+ "disabled": context.disabled || !canGoBack(),
265
278
  "aria-label": "Previous month",
266
- }, { default: () => [h(ChevronLeft)] }),
279
+ }, { default: () => [h(CalendarNavigationIcon, { direction: "previous" })] }),
267
280
  ]),
268
281
  h("div", { class: s.Next }, [
269
282
  h(Button, {
@@ -274,39 +287,41 @@ export const DateRangeCalendar = defineComponent({
274
287
  "gutterSize": "2xs",
275
288
  "iconSize": "sm",
276
289
  "onClick": handleNext,
277
- "disabled": !canGoForward(),
290
+ "disabled": context.disabled || !canGoForward(),
278
291
  "aria-label": "Next month",
279
- }, { default: () => [h(ChevronRight)] }),
292
+ }, { default: () => [h(CalendarNavigationIcon, { direction: "next" })] }),
280
293
  ]),
281
- h("div", {
282
- class: s.CalendarRange,
283
- style: { transform: `translate(calc(${calendarSteps.value * -1} * var(--calendar-step)), 0)` },
284
- }, [
285
- h(TransitionGroup, { enterDuration: 400, exitDuration: 400 }, {
286
- default: () => [
287
- h(CalendarView, {
288
- key: left.toLocaleString({ month: "long", year: "numeric" }),
289
- stepPosition: calendarSteps.value,
290
- date: left,
291
- ...viewProps,
292
- }),
293
- isSmallUp.value
294
- ? h(CalendarView, {
295
- key: right.toLocaleString({ month: "long", year: "numeric" }),
296
- stepPosition: calendarSteps.value + 1,
297
- date: right,
294
+ h("div", { class: s.CalendarViewport }, [
295
+ h("div", {
296
+ class: s.CalendarRange,
297
+ style: { transform: `translate(calc(${calendarSteps.value * -1} * var(--calendar-step)), 0)` },
298
+ }, [
299
+ h(TransitionGroup, { enterDuration: 400, exitDuration: 400 }, {
300
+ default: () => [
301
+ h(CalendarView, {
302
+ key: left.toLocaleString({ month: "long", year: "numeric" }),
303
+ stepPosition: calendarSteps.value,
304
+ date: left,
298
305
  ...viewProps,
299
- })
300
- : createCommentVNode(),
301
- ],
302
- }),
306
+ }),
307
+ isMediumUp.value
308
+ ? h(CalendarView, {
309
+ key: right.toLocaleString({ month: "long", year: "numeric" }),
310
+ stepPosition: calendarSteps.value + 1,
311
+ date: right,
312
+ ...viewProps,
313
+ })
314
+ : createCommentVNode(),
315
+ ],
316
+ }),
317
+ ]),
303
318
  ]),
304
319
  ]),
305
320
  ]);
306
321
  };
307
322
  },
308
323
  });
309
- const daysOfTheWeekLabels = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
324
+ const daysOfTheWeekLabels = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
310
325
  const CalendarView = defineComponent({
311
326
  name: "DateRangeCalendarView",
312
327
  props: {
@@ -362,7 +377,10 @@ const CalendarView = defineComponent({
362
377
  const dayLabels = [...daysOfTheWeekLabels.slice(weekStartsOn), ...daysOfTheWeekLabels.slice(0, weekStartsOn)];
363
378
  return h("div", { "class": s.Calendar, "style": { left: `calc(${position} * var(--calendar-step))` }, "data-calendar": true }, [
364
379
  h("p", { class: s.MonthLabel }, [startOfMonth.monthLong, " ", String(startOfMonth.year)]),
365
- h("div", { class: s.Week }, dayLabels.map((day) => h("div", { key: day, class: s.DayLabel }, day))),
380
+ h("div", { class: [s.Week, s.WeekdayHeader] }, dayLabels.map((day) => h("div", { key: day, class: s.DayLabel }, [
381
+ h("span", { class: s.ShortDayLabel }, day.slice(0, 2)),
382
+ h("span", { class: s.LongDayLabel }, day),
383
+ ]))),
366
384
  ...weeks.map((week, weekIndex) => h("div", { class: s.Week, key: weekIndex }, week.map((d, dayIndex) => {
367
385
  if (!d) {
368
386
  return h("div", { class: s.Day, key: `${weekIndex}-${dayIndex}` });
@@ -396,12 +414,14 @@ const CalendarView = defineComponent({
396
414
  // The full date names the day, which "15" alone does not across months
397
415
  h("button", {
398
416
  "class": s.InteractiveDay,
399
- "disabled": !enabled,
417
+ "disabled": context.disabled || !enabled,
400
418
  "aria-label": d.toLocaleString(DateTime.DATE_HUGE),
401
419
  "aria-pressed": isStart || isEnd || isInRange ? "true" : "false",
402
420
  "aria-current": dayIsToday ? "date" : undefined,
403
- "onClick": () => d && props.onDateSelect?.(d),
404
- "onMouseenter": () => d && props.onDateMouseEnter?.(d),
421
+ "onClick": () => { if (!context.disabled && d)
422
+ props.onDateSelect?.(d); },
423
+ "onPointerenter": (event) => { if (!context.disabled && d && isHoverPointer(event))
424
+ props.onDateMouseEnter?.(d); },
405
425
  "onKeydown": (event) => d && props.onDayKeyDown?.(event, d),
406
426
  }, [String(d.day), dayIsToday ? h("span", { class: s.TodayDot }) : null]),
407
427
  ]);
@@ -423,7 +443,7 @@ export const DateRangeShortcuts = defineComponent({
423
443
  if (!isMediumUp.value || !shortcuts?.length) {
424
444
  return null;
425
445
  }
426
- const { value, min, max, maxRangeDays, onChange } = context;
446
+ const { value, min, max, maxRangeDays, disabled, onChange } = context;
427
447
  return h("div", { class: s.Shortcuts }, shortcuts.map((shortcut) => {
428
448
  const { label, getDateRange } = shortcut;
429
449
  const range = getDateRange();
@@ -439,8 +459,9 @@ export const DateRangeShortcuts = defineComponent({
439
459
  iconSize: "sm",
440
460
  block: true,
441
461
  selected: isActive,
442
- disabled: !isRangeWithinLimits(range, min, max, maxRangeDays),
443
- onClick: () => onChange(range, shortcut),
462
+ disabled: disabled || !isRangeWithinLimits(range, min, max, maxRangeDays),
463
+ onClick: () => { if (!context.disabled)
464
+ onChange(range, shortcut); },
444
465
  }, { default: () => [h("span", { class: s.ButtonText }, label), isActive ? h(Check) : null] });
445
466
  }));
446
467
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Calendar.js","sourceRoot":"","sources":["../../../../src/components/DateRangePicker/Calendar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,eAAe,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAiB,MAAM,KAAK,CAAA;AACxH,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAC5H,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACnE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AACxD,OAAO,CAAC,MAAM,+DAA+D,CAAA;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAClD,OAAO,EAA0C,MAAM,YAAY,CAAA;AAEnE,uEAAuE;AACvE,2EAA2E;AAC3E,wEAAwE;AACxE,6EAA6E;AAC7E,6CAA6C;AAC7C,0EAA0E;AAC1E,qDAAqD;AACrD,8EAA8E;AAC9E,4EAA4E;AAC5E,6BA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,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAA;AACpG,CAAC,CAAA","sourcesContent":["import { DateTime, Interval } from \"luxon\"\nimport { computed, createCommentVNode, defineComponent, h, onMounted, ref, shallowRef, watch, type PropType } from \"vue\"\nimport { useBreakpoint } from \"../../composables/useBreakpoints.js\"\nimport { chunkIntoWeeks, getDaysOfMonth, isAfter, isBefore, isSameDay, isToday, weekPosition } from \"../../lib/dateUtils.js\"\nimport { waitForAnimationFrame } from \"../../lib/helpers.js\"\nimport { Button } from \"../Button/index.js\"\nimport { Check, ChevronLeft, ChevronRight } from \"../Icon/index.js\"\nimport { TransitionGroup } from \"../Transition/index.js\"\nimport s from \"@plexui/styles/components/DateRangePicker/Calendar.module.css\"\nimport { useDateRangeContext } from \"./context.js\"\nimport { type DateRange, type DateRangeShortcut } from \"./types.js\"\n\n// Vue port of packages/ui/src/components/DateRangePicker/Calendar.tsx.\n// - React's `[value]` effect is a watcher on the context value; the height\n// effect runs on mount and when the left month changes, after render.\n// - The `stable-view-N` key on the wrapper remounts the calendar view, as in\n// React, when the value jumps out of view.\n// - React's pending-focus effect is a post watcher on the left month; its\n// cleanup cancels the frame, as the effect's does.\n// - Below the `sm` breakpoint the right calendar is a placeholder, as React's\n// `{isSmallUp && ...}`: TransitionGroup still renders its (empty) wrapper\n// when animations are off.\n// - React quirk kept: the day buttons have no `type`.\n\n// The day a grid key moves to: a day, a week, the first or last day of the\n// week row, or a month (Luxon clamps Jan 31 to Feb 28/29)\nconst getKeyTarget = (key: string, day: DateTime, weekStartsOn: number): DateTime | null => {\n switch (key) {\n case \"ArrowLeft\":\n return day.minus({ days: 1 })\n case \"ArrowRight\":\n return day.plus({ days: 1 })\n case \"ArrowUp\":\n return day.minus({ days: 7 })\n case \"ArrowDown\":\n return day.plus({ days: 7 })\n case \"Home\":\n return day.minus({ days: weekPosition(day, weekStartsOn) })\n case \"End\":\n return day.plus({ days: 6 - weekPosition(day, weekStartsOn) })\n case \"PageUp\":\n return day.minus({ months: 1 })\n case \"PageDown\":\n return day.plus({ months: 1 })\n default:\n return null\n }\n}\n\nconst monthIndex = (date: DateTime) => date.year * 12 + date.month\n\nexport const DateRangeCalendar = defineComponent({\n name: \"DateRangeCalendar\",\n setup() {\n const context = useDateRangeContext()\n const isSmallUp = useBreakpoint(\"sm\")\n const calendarContainerRef = shallowRef<HTMLDivElement | null>(null)\n // The day to focus once a key has moved the view to its month\n let pendingFocus: DateTime | null = null\n const selectionRange = shallowRef<DateRange | null>(null)\n const calendarSteps = ref(0)\n const forceRenderIncrement = ref(0)\n const leftCalendarDate = shallowRef<DateTime>(\n isSmallUp.value\n ? getLeftCalendarDate(context.value?.[0] ?? DateTime.now(), context.max)\n : (context.value?.[0] ?? DateTime.now()),\n )\n\n const rightCalendarDate = computed(() =>\n isSmallUp.value\n ? leftCalendarDate.value.plus({ months: 1 }).startOf(\"month\")\n : leftCalendarDate.value.startOf(\"month\"),\n )\n\n const canGoBack = () => !context.min || isBefore(context.min, leftCalendarDate.value.startOf(\"month\"))\n const canGoForward = () => !context.max || isBefore(rightCalendarDate.value.endOf(\"month\"), context.max)\n\n const handleNext = () => {\n calendarSteps.value += 1\n leftCalendarDate.value = leftCalendarDate.value.plus({ months: 1 })\n }\n\n const handlePrevious = () => {\n calendarSteps.value -= 1\n leftCalendarDate.value = leftCalendarDate.value.minus({ months: 1 })\n }\n\n const handleDateSelect = (selectedDate: DateTime) => {\n if (!selectionRange.value) {\n selectionRange.value = [selectedDate, selectedDate]\n return\n }\n\n const [currentSelectionStartDate] = selectionRange.value\n\n // Selecting a date before the current selected start date moves the start date\n // but does not resolve the selection\n if (isBefore(selectedDate, currentSelectionStartDate)) {\n selectionRange.value = [selectedDate, selectedDate]\n return\n }\n\n // Resolve the selection by emitting the value and clearing selection\n context.onChange([currentSelectionStartDate, selectedDate])\n selectionRange.value = null\n }\n\n const handleDateMouseEnter = (hoveredDate: DateTime) => {\n // If we're not actively selecting, no-op\n const currentSelectionRange = selectionRange.value\n if (!currentSelectionRange) {\n return\n }\n\n const [currentStartDate] = currentSelectionRange\n\n // When hovering a date before the current date, don't change the selection range\n if (isBefore(hoveredDate, currentStartDate)) {\n selectionRange.value = [currentStartDate, currentStartDate]\n return\n }\n\n selectionRange.value = [currentStartDate, hoveredDate]\n }\n\n const handleCalendarMouseLeave = () => {\n // If we're not actively selecting, no-op\n const currentSelectionRange = selectionRange.value\n if (!currentSelectionRange) {\n return\n }\n\n // Reset the end selection\n const [currentStartDate] = currentSelectionRange\n selectionRange.value = [currentStartDate, currentStartDate]\n }\n\n // Days are named by their full date; skip calendars that are leaving\n const focusDay = (day: DateTime) => {\n const label = day.toLocaleString(DateTime.DATE_HUGE)\n const buttons = calendarContainerRef.value?.querySelectorAll<HTMLButtonElement>(`button[aria-label=\"${label}\"]`)\n Array.from(buttons ?? [])\n .find((button) => !button.closest(\"[data-exiting]\"))\n ?.focus()\n }\n\n const handleDayKeyDown = (event: KeyboardEvent, day: DateTime) => {\n if (event.altKey || event.ctrlKey || event.metaKey) {\n return\n }\n\n // While a move waits for its month to render, the next key starts from\n // the day it is moving to (key repeat), not the day that still has focus\n const target = getKeyTarget(event.key, pendingFocus ?? day, context.weekStartsOn)\n if (!target) {\n return\n }\n\n event.preventDefault()\n\n // A disabled day (outside min/max, or past maxRangeDays while selecting)\n // keeps focus where it is\n const { min, max, maxRangeDays } = context\n const selection = selectionRange.value\n const rangeEndLimit =\n selection && maxRangeDays != null ? selection[0].plus({ days: maxRangeDays - 1 }) : undefined\n if (\n (min && isBefore(target, min.startOf(\"day\"))) ||\n (max && isAfter(target, max.endOf(\"day\"))) ||\n (rangeEndLimit && isAfter(target, rangeEndLimit))\n ) {\n return\n }\n\n const monthsBefore = monthIndex(leftCalendarDate.value) - monthIndex(target)\n const monthsAfter = monthIndex(target) - monthIndex(rightCalendarDate.value)\n if (monthsBefore <= 0 && monthsAfter <= 0) {\n pendingFocus = null\n focusDay(target)\n return\n }\n\n // Step the view like the month buttons; a day within min/max keeps every step in bounds\n if (monthsAfter > 0 ? !canGoForward() : !canGoBack()) {\n return\n }\n\n pendingFocus = target\n for (let step = 0; step < Math.max(monthsBefore, monthsAfter); step++) {\n if (monthsAfter > 0) {\n handleNext()\n } else {\n handlePrevious()\n }\n }\n }\n\n // Force re-renders when `value` changes out of brand from direct user-selection\n watch(\n () => context.value,\n (value) => {\n // When a new value is received, it could be out of band from the control of this calendar.\n // For example, a shortcut could be selected, or clear could be pressed. In either case, selection\n // should be reset so that the new `value` can be displayed fully.\n selectionRange.value = null\n\n // Nothing else to do when value is empty\n if (!value) {\n return\n }\n\n // Check if `value` is still within view of our calendar\n const viewInterval = Interval.fromDateTimes(\n leftCalendarDate.value.startOf(\"month\"),\n rightCalendarDate.value.endOf(\"month\"),\n )\n const isValueInRangeOfCalendar = viewInterval.contains(value[0]) || viewInterval.contains(value[1])\n if (!isValueInRangeOfCalendar) {\n // Reset state the calendar view entirely\n selectionRange.value = null\n calendarSteps.value = 0\n leftCalendarDate.value = isSmallUp.value ? getLeftCalendarDate(value[0], context.max) : value[0]\n forceRenderIncrement.value += 1\n }\n },\n )\n\n // Detect height changes when new calendars are rendered\n const measureHeight = () => {\n waitForAnimationFrame(() => {\n const container = calendarContainerRef.value\n\n if (!container) {\n return\n }\n\n let maxHeight = -Infinity\n\n // Find the tallest calendar\n container.querySelectorAll<HTMLElement>(\"[data-calendar]\")?.forEach((element) => {\n // NOTE: clientHeight does not respect the scale() that popover uses to animate in, which is what we want\n // We want to know the full height of the element, without any transform applied.\n const height = element.clientHeight\n\n // Ignore calendars that are exiting\n if (element.closest(\"[data-exiting]\")) {\n return\n }\n\n if (height > maxHeight) {\n maxHeight = height\n }\n })\n\n container.style.height = `${maxHeight}px`\n\n // Don't animate the initial height.\n // This is relevant when the calendar opens to a larger size than the default.\n if (!container.style.transition) {\n waitForAnimationFrame(() => {\n container.style.transition = `height 0.25s var(--cubic-move)`\n })\n }\n })\n }\n onMounted(measureHeight)\n watch(leftCalendarDate, measureHeight, { flush: \"post\" })\n\n // Focus a pending day once its month has rendered. TransitionGroup marks\n // the leaving calendar after this render, so wait a frame like the height does\n watch(\n leftCalendarDate,\n (_date, _previous, onCleanup) => {\n if (!pendingFocus) {\n return\n }\n\n onCleanup(\n waitForAnimationFrame(() => {\n const target = pendingFocus\n pendingFocus = null\n if (target) {\n focusDay(target)\n }\n }),\n )\n },\n { flush: \"post\" },\n )\n\n const setContainer = (el: unknown) => {\n calendarContainerRef.value = (el as HTMLDivElement | null) ?? null\n }\n\n return () => {\n const { value, min, max, maxRangeDays } = context\n const left = leftCalendarDate.value\n const right = rightCalendarDate.value\n const selection = selectionRange.value\n const selectedDisplayValue = selection || value\n const viewProps = {\n selectedDates: selectedDisplayValue,\n min,\n max,\n selectionStart: selection?.[0],\n maxRangeDays,\n isSelecting: !!selection,\n onDateSelect: handleDateSelect,\n onDateMouseEnter: handleDateMouseEnter,\n onDayKeyDown: handleDayKeyDown,\n }\n\n return h(\"div\", { key: `stable-view-${forceRenderIncrement.value}`, class: s.CalendarWrapper }, [\n h(\"div\", { ref: setContainer, class: s.CalendarContainer, onMouseleave: handleCalendarMouseLeave }, [\n h(\"div\", { class: s.Previous }, [\n h(\n Button,\n {\n \"variant\": \"ghost\",\n \"color\": \"secondary\",\n \"size\": \"sm\",\n \"pill\": false,\n \"gutterSize\": \"2xs\",\n \"iconSize\": \"sm\",\n \"onClick\": handlePrevious,\n \"disabled\": !canGoBack(),\n \"aria-label\": \"Previous month\",\n },\n { default: () => [h(ChevronLeft)] },\n ),\n ]),\n h(\"div\", { class: s.Next }, [\n h(\n Button,\n {\n \"variant\": \"ghost\",\n \"color\": \"secondary\",\n \"size\": \"sm\",\n \"pill\": false,\n \"gutterSize\": \"2xs\",\n \"iconSize\": \"sm\",\n \"onClick\": handleNext,\n \"disabled\": !canGoForward(),\n \"aria-label\": \"Next month\",\n },\n { default: () => [h(ChevronRight)] },\n ),\n ]),\n h(\n \"div\",\n {\n class: s.CalendarRange,\n style: { transform: `translate(calc(${calendarSteps.value * -1} * var(--calendar-step)), 0)` },\n },\n [\n h(\n TransitionGroup,\n { enterDuration: 400, exitDuration: 400 },\n {\n default: () => [\n h(CalendarView, {\n key: left.toLocaleString({ month: \"long\", year: \"numeric\" }),\n stepPosition: calendarSteps.value,\n date: left,\n ...viewProps,\n }),\n isSmallUp.value\n ? h(CalendarView, {\n key: right.toLocaleString({ month: \"long\", year: \"numeric\" }),\n stepPosition: calendarSteps.value + 1,\n date: right,\n ...viewProps,\n })\n : createCommentVNode(),\n ],\n },\n ),\n ],\n ),\n ]),\n ])\n }\n },\n})\n\nconst daysOfTheWeekLabels = [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"]\n\nconst CalendarView = defineComponent({\n name: \"DateRangeCalendarView\",\n props: {\n // Can be any day within the given month that the calendar should render for\n date: { type: Object as PropType<DateTime>, required: true },\n selectedDates: { type: Array as unknown as PropType<DateRange | null>, default: undefined },\n onDateSelect: Function as PropType<(dt: DateTime) => void>,\n onDateMouseEnter: Function as PropType<(dt: DateTime) => void>,\n onDayKeyDown: Function as PropType<(event: KeyboardEvent, dt: DateTime) => void>,\n min: Object as PropType<DateTime>,\n max: Object as PropType<DateTime>,\n selectionStart: { type: Object as PropType<DateTime | null>, default: undefined },\n maxRangeDays: Number,\n isSelecting: Boolean,\n stepPosition: { type: Number, required: true },\n },\n setup(props) {\n const context = useDateRangeContext()\n // Lock position on mount and don't respond to changes\n const position = props.stepPosition\n const view = computed(() => {\n const { date, min, max } = props\n const { weekStartsOn } = context\n const monthStart = date.startOf(\"month\")\n const endOfMonth = date.endOf(\"month\")\n\n const daysBeforeMonthStart = weekPosition(monthStart, weekStartsOn)\n const blankDays = new Array(daysBeforeMonthStart).fill(null)\n const daysInMonth = getDaysOfMonth(monthStart)\n const calendarCells = [...blankDays, ...daysInMonth]\n\n // Cells are start-of-day values and Interval excludes its end, so widen the\n // bounds to whole days: min/max days themselves stay selectable.\n const enabledDateInterval = Interval.fromDateTimes(\n (min || monthStart).startOf(\"day\"),\n (max || endOfMonth).endOf(\"day\"),\n )\n\n return {\n startOfMonth: monthStart,\n endOfMonth,\n weeks: chunkIntoWeeks(calendarCells, 7) as Array<Array<DateTime | null>>,\n enabledInterval: enabledDateInterval,\n }\n })\n\n const selectedInterval = computed<Interval | null>(() => {\n const [selectedStart, selectedEnd] = props.selectedDates || []\n if (!selectedStart || !selectedEnd) {\n return null\n }\n\n return Interval.fromDateTimes(selectedStart.startOf(\"day\"), selectedEnd.endOf(\"day\"))\n })\n\n return () => {\n const { startOfMonth, weeks, enabledInterval } = view.value\n const { selectionStart, maxRangeDays, isSelecting } = props\n const [selectedStart, selectedEnd] = props.selectedDates || []\n const rangeEndLimit =\n selectionStart && maxRangeDays != null ? selectionStart.plus({ days: maxRangeDays - 1 }) : undefined\n\n const { weekStartsOn } = context\n const dayLabels = [...daysOfTheWeekLabels.slice(weekStartsOn), ...daysOfTheWeekLabels.slice(0, weekStartsOn)]\n return h(\"div\", { \"class\": s.Calendar, \"style\": { left: `calc(${position} * var(--calendar-step))` }, \"data-calendar\": true }, [\n h(\"p\", { class: s.MonthLabel }, [startOfMonth.monthLong, \" \", String(startOfMonth.year)]),\n h(\n \"div\",\n { class: s.Week },\n dayLabels.map((day) => h(\"div\", { key: day, class: s.DayLabel }, day)),\n ),\n ...weeks.map((week, weekIndex) =>\n h(\n \"div\",\n { class: s.Week, key: weekIndex },\n week.map((d, dayIndex) => {\n if (!d) {\n return h(\"div\", { class: s.Day, key: `${weekIndex}-${dayIndex}` })\n }\n\n // Check if 'day' is within selected range\n const enabled = enabledInterval.contains(d) && !(isSelecting && rangeEndLimit && isAfter(d, rangeEndLimit))\n const isStart = enabled && selectedStart && isSameDay(d, selectedStart)\n const isEnd = enabled && selectedEnd && isSameDay(d, selectedEnd)\n const hasRange = selectedStart && selectedEnd && !isSameDay(selectedStart, selectedEnd)\n const isInRange = hasRange && selectedInterval.value?.contains(d)\n const dayIsToday = isToday(d)\n const isFirstRangeTrail =\n d.day === 1 &&\n // Trail doesn't make sense to display at the start of the week\n weekPosition(d, weekStartsOn) !== 0 &&\n isInRange &&\n !isStart\n const isLastRangeTrail =\n d.day === d.daysInMonth &&\n // Trail doesn't make sense to display at the end of the week\n weekPosition(d, weekStartsOn) !== 6 &&\n isInRange &&\n !isEnd\n\n return h(\n \"div\",\n {\n \"class\": s.Day,\n \"key\": dayIndex,\n \"data-is-start\": isStart ? \"\" : undefined,\n \"data-is-end\": isEnd ? \"\" : undefined,\n \"data-is-in-range\": isInRange ? \"\" : undefined,\n \"data-is-first-range-trail\": isFirstRangeTrail ? \"\" : undefined,\n \"data-is-last-range-trail\": isLastRangeTrail ? \"\" : undefined,\n },\n [\n // The full date names the day, which \"15\" alone does not across months\n h(\n \"button\",\n {\n \"class\": s.InteractiveDay,\n \"disabled\": !enabled,\n \"aria-label\": d.toLocaleString(DateTime.DATE_HUGE),\n \"aria-pressed\": isStart || isEnd || isInRange ? \"true\" : \"false\",\n \"aria-current\": dayIsToday ? \"date\" : undefined,\n \"onClick\": () => d && props.onDateSelect?.(d),\n \"onMouseenter\": () => d && props.onDateMouseEnter?.(d),\n \"onKeydown\": (event: KeyboardEvent) => d && props.onDayKeyDown?.(event, d),\n },\n [String(d.day), dayIsToday ? h(\"span\", { class: s.TodayDot }) : null],\n ),\n ],\n )\n }),\n ),\n ),\n ])\n }\n },\n})\n\nexport const DateRangeShortcuts = defineComponent({\n name: \"DateRangeShortcuts\",\n props: {\n shortcuts: Array as PropType<DateRangeShortcut[]>,\n },\n setup(props) {\n const isMediumUp = useBreakpoint(\"md\")\n const context = useDateRangeContext()\n\n return () => {\n const { shortcuts } = props\n if (!isMediumUp.value || !shortcuts?.length) {\n return null\n }\n\n const { value, min, max, maxRangeDays, onChange } = context\n\n return h(\n \"div\",\n { class: s.Shortcuts },\n shortcuts.map((shortcut) => {\n const { label, getDateRange } = shortcut\n const range = getDateRange()\n const [start, end] = range\n const isActive = !!value && isSameDay(value[0], start) && isSameDay(value[1], end)\n\n return h(\n Button,\n {\n key: label,\n class: \"mb-1\",\n variant: \"ghost\",\n color: \"primary\",\n pill: false,\n size: \"md\",\n iconSize: \"sm\",\n block: true,\n selected: isActive,\n disabled: !isRangeWithinLimits(range, min, max, maxRangeDays),\n onClick: () => onChange(range, shortcut),\n },\n { default: () => [h(\"span\", { class: s.ButtonText }, label), isActive ? h(Check) : null] },\n )\n }),\n )\n }\n },\n})\n\n// A shortcut follows the calendar's limits: whole days from min to max, and\n// no more than maxRangeDays days\nconst isRangeWithinLimits = ([start, end]: DateRange, min?: DateTime, max?: DateTime, maxRangeDays?: number) =>\n !(min && isBefore(start, min.startOf(\"day\"))) &&\n !(max && isAfter(end, max.endOf(\"day\"))) &&\n !(maxRangeDays != null && isAfter(end.startOf(\"day\"), start.startOf(\"day\").plus({ days: maxRangeDays - 1 })))\n\nconst getLeftCalendarDate = (targetDate: DateTime, maxDate?: DateTime) => {\n if (!maxDate) {\n return targetDate\n }\n\n return isBefore(targetDate.endOf(\"month\"), maxDate) ? targetDate : targetDate.minus({ months: 1 })\n}\n"]}
1
+ {"version":3,"file":"Calendar.js","sourceRoot":"","sources":["../../../../src/components/DateRangePicker/Calendar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC1C,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,eAAe,EAAE,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAiB,MAAM,KAAK,CAAA;AAC7G,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAC5H,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;A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AC,CAAC,UAAU,EAAE,EAAE,KAAK,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAC3F,CAAA;YACH,CAAC,CAAC,CACH,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAEF,4EAA4E;AAC5E,iCAAiC;AACjC,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,EAAE,GAAG,CAAY,EAAE,GAAc,EAAE,GAAc,EAAE,YAAqB,EAAE,EAAE,CAC7G,CAAC,CAAC,GAAG,IAAI,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IACxC,CAAC,CAAC,YAAY,IAAI,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,YAAY,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAE/G,MAAM,mBAAmB,GAAG,CAAC,UAAoB,EAAE,OAAkB,EAAE,EAAE;IACvE,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,UAAU,CAAA;IACnB,CAAC;IAED,OAAO,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC,CAAA;AACpG,CAAC,CAAA","sourcesContent":["import { DateTime, Interval } from \"luxon\"\nimport { computed, createCommentVNode, defineComponent, h, ref, shallowRef, watch, type PropType } from \"vue\"\nimport { useBreakpoint } from \"../../composables/useBreakpoints.js\"\nimport { chunkIntoWeeks, getDaysOfMonth, isAfter, isBefore, isSameDay, isToday, weekPosition } from \"../../lib/dateUtils.js\"\nimport { waitForAnimationFrame } from \"../../lib/helpers.js\"\nimport { Button } from \"../Button/index.js\"\nimport { Check } from \"../Icon/index.js\"\nimport { CalendarNavigationIcon } from \"../DatePicker/CalendarNavigationIcon.js\"\nimport { TransitionGroup } from \"../Transition/index.js\"\nimport { isHoverPointer } from \"../../lib/inputMode.js\"\nimport s from \"@plexui/styles/components/DateRangePicker/Calendar.module.css\"\nimport { useDateRangeContext } from \"./context.js\"\nimport { type DateRange, type DateRangeShortcut } from \"./types.js\"\n\n// Vue port of packages/ui/src/components/DateRangePicker/Calendar.tsx.\n// - React's `[value]` effect is a watcher on the context value; the height\n// effect runs on mount and when the left month changes, after render.\n// - The `stable-view-N` key on the wrapper remounts the calendar view, as in\n// React, when the value jumps out of view.\n// - React's pending-focus effect is a post watcher on the left month; its\n// cleanup cancels the frame, as the effect's does.\n// - Below the `md` breakpoint the right calendar is a placeholder, as React's\n// `{isMediumUp && ...}`: TransitionGroup still renders its (empty) wrapper\n// when animations are off.\n// - React quirk kept: the day buttons have no `type`.\n\n// The day a grid key moves to: a day, a week, the first or last day of the\n// week row, or a month (Luxon clamps Jan 31 to Feb 28/29)\nconst getKeyTarget = (key: string, day: DateTime, weekStartsOn: number): DateTime | null => {\n switch (key) {\n case \"ArrowLeft\":\n return day.minus({ days: 1 })\n case \"ArrowRight\":\n return day.plus({ days: 1 })\n case \"ArrowUp\":\n return day.minus({ days: 7 })\n case \"ArrowDown\":\n return day.plus({ days: 7 })\n case \"Home\":\n return day.minus({ days: weekPosition(day, weekStartsOn) })\n case \"End\":\n return day.plus({ days: 6 - weekPosition(day, weekStartsOn) })\n case \"PageUp\":\n return day.minus({ months: 1 })\n case \"PageDown\":\n return day.plus({ months: 1 })\n default:\n return null\n }\n}\n\nconst monthIndex = (date: DateTime) => date.year * 12 + date.month\n\nexport const DateRangeCalendar = defineComponent({\n name: \"DateRangeCalendar\",\n setup() {\n const context = useDateRangeContext()\n const isMediumUp = useBreakpoint(\"md\")\n const calendarContainerRef = shallowRef<HTMLDivElement | null>(null)\n // The day to focus once a key has moved the view to its month\n let pendingFocus: DateTime | null = null\n const selectionRange = shallowRef<DateRange | null>(null)\n const calendarSteps = ref(0)\n const forceRenderIncrement = ref(0)\n const leftCalendarDate = shallowRef<DateTime>(\n isMediumUp.value\n ? getLeftCalendarDate(context.value?.[0] ?? DateTime.now(), context.max)\n : (context.value?.[0] ?? DateTime.now()),\n )\n\n const rightCalendarDate = computed(() =>\n isMediumUp.value\n ? leftCalendarDate.value.plus({ months: 1 }).startOf(\"month\")\n : leftCalendarDate.value.startOf(\"month\"),\n )\n\n const canGoBack = () => !context.min || isBefore(context.min, leftCalendarDate.value.startOf(\"month\"))\n const canGoForward = () => !context.max || isBefore(rightCalendarDate.value.endOf(\"month\"), context.max)\n\n const handleNext = () => {\n if (context.disabled) return\n calendarSteps.value += 1\n leftCalendarDate.value = leftCalendarDate.value.plus({ months: 1 })\n }\n\n const handlePrevious = () => {\n if (context.disabled) return\n calendarSteps.value -= 1\n leftCalendarDate.value = leftCalendarDate.value.minus({ months: 1 })\n }\n\n const handleDateSelect = (selectedDate: DateTime) => {\n if (context.disabled) return\n if (!selectionRange.value) {\n selectionRange.value = [selectedDate, selectedDate]\n return\n }\n\n const [currentSelectionStartDate] = selectionRange.value\n\n // Selecting a date before the current selected start date moves the start date\n // but does not resolve the selection\n if (isBefore(selectedDate, currentSelectionStartDate)) {\n selectionRange.value = [selectedDate, selectedDate]\n return\n }\n\n // Resolve the selection by emitting the value and clearing selection\n context.onChange([currentSelectionStartDate, selectedDate])\n selectionRange.value = null\n }\n\n const handleDateMouseEnter = (hoveredDate: DateTime) => {\n if (context.disabled) return\n // If we're not actively selecting, no-op\n const currentSelectionRange = selectionRange.value\n if (!currentSelectionRange) {\n return\n }\n\n const [currentStartDate] = currentSelectionRange\n\n // When hovering a date before the current date, don't change the selection range\n if (isBefore(hoveredDate, currentStartDate)) {\n selectionRange.value = [currentStartDate, currentStartDate]\n return\n }\n\n selectionRange.value = [currentStartDate, hoveredDate]\n }\n\n const handleCalendarMouseLeave = () => {\n // If we're not actively selecting, no-op\n const currentSelectionRange = selectionRange.value\n if (!currentSelectionRange) {\n return\n }\n\n // Reset the end selection\n const [currentStartDate] = currentSelectionRange\n selectionRange.value = [currentStartDate, currentStartDate]\n }\n\n // Days are named by their full date; skip calendars that are leaving\n const focusDay = (day: DateTime) => {\n const label = day.toLocaleString(DateTime.DATE_HUGE)\n const buttons = calendarContainerRef.value?.querySelectorAll<HTMLButtonElement>(`button[aria-label=\"${label}\"]`)\n Array.from(buttons ?? [])\n .find((button) => !button.closest(\"[data-exiting]\"))\n ?.focus()\n }\n\n const handleDayKeyDown = (event: KeyboardEvent, day: DateTime) => {\n if (context.disabled || event.altKey || event.ctrlKey || event.metaKey) {\n return\n }\n\n // While a move waits for its month to render, the next key starts from\n // the day it is moving to (key repeat), not the day that still has focus\n const target = getKeyTarget(event.key, pendingFocus ?? day, context.weekStartsOn)\n if (!target) {\n return\n }\n\n event.preventDefault()\n\n // A disabled day (outside min/max, or past maxRangeDays while selecting)\n // keeps focus where it is\n const { min, max, maxRangeDays } = context\n const selection = selectionRange.value\n const rangeEndLimit =\n selection && maxRangeDays != null ? selection[0].plus({ days: maxRangeDays - 1 }) : undefined\n if (\n (min && isBefore(target, min.startOf(\"day\"))) ||\n (max && isAfter(target, max.endOf(\"day\"))) ||\n (rangeEndLimit && isAfter(target, rangeEndLimit))\n ) {\n return\n }\n\n const monthsBefore = monthIndex(leftCalendarDate.value) - monthIndex(target)\n const monthsAfter = monthIndex(target) - monthIndex(rightCalendarDate.value)\n if (monthsBefore <= 0 && monthsAfter <= 0) {\n pendingFocus = null\n focusDay(target)\n return\n }\n\n // Step the view like the month buttons; a day within min/max keeps every step in bounds\n if (monthsAfter > 0 ? !canGoForward() : !canGoBack()) {\n return\n }\n\n pendingFocus = target\n for (let step = 0; step < Math.max(monthsBefore, monthsAfter); step++) {\n if (monthsAfter > 0) {\n handleNext()\n } else {\n handlePrevious()\n }\n }\n }\n\n // Force re-renders when `value` changes out of brand from direct user-selection\n watch(\n () => context.value,\n (value) => {\n // When a new value is received, it could be out of band from the control of this calendar.\n // For example, a shortcut could be selected, or clear could be pressed. In either case, selection\n // should be reset so that the new `value` can be displayed fully.\n selectionRange.value = null\n\n // Nothing else to do when value is empty\n if (!value) {\n return\n }\n\n // Check if `value` is still within view of our calendar\n const viewInterval = Interval.fromDateTimes(\n leftCalendarDate.value.startOf(\"month\"),\n rightCalendarDate.value.endOf(\"month\"),\n )\n const isValueInRangeOfCalendar = viewInterval.contains(value[0]) || viewInterval.contains(value[1])\n if (!isValueInRangeOfCalendar) {\n // Reset state the calendar view entirely\n selectionRange.value = null\n calendarSteps.value = 0\n leftCalendarDate.value = isMediumUp.value ? getLeftCalendarDate(value[0], context.max) : value[0]\n forceRenderIncrement.value += 1\n }\n },\n )\n\n // Observe calendar border boxes as Phone geometry/fonts change, as well as month changes.\n watch([leftCalendarDate, forceRenderIncrement, isMediumUp], (_value, _previous, onCleanup) => {\n let cancelTransition: (() => void) | undefined\n let observer: ResizeObserver | undefined\n const cancelMeasure = waitForAnimationFrame(() => {\n const container = calendarContainerRef.value\n if (!container) return\n const calendars = () => Array.from(container.querySelectorAll<HTMLElement>(\"[data-calendar]\"))\n .filter((element) => !element.closest(\"[data-exiting]\"))\n const measure = () => {\n const visible = calendars()\n if (!visible.length) return\n const height = `${Math.max(...visible.map((element) => element.clientHeight))}px`\n if (container.style.height !== height) container.style.height = height\n // Do not animate the initial measurement. CSS follows live reduced motion.\n if (!container.style.transition && !cancelTransition) {\n cancelTransition = waitForAnimationFrame(() => {\n container.style.transition = \"height var(--calendar-height-duration, 0.25s) var(--cubic-move)\"\n })\n }\n }\n measure()\n observer = typeof ResizeObserver !== \"undefined\" ? new ResizeObserver(measure) : undefined\n observer?.observe(container, { box: \"border-box\" })\n calendars().forEach((calendar) => observer?.observe(calendar, { box: \"border-box\" }))\n })\n onCleanup(() => {\n cancelMeasure()\n cancelTransition?.()\n observer?.disconnect()\n })\n }, { immediate: true, flush: \"post\" })\n\n // Focus a pending day once its month has rendered. TransitionGroup marks\n // the leaving calendar after this render, so wait a frame like the height does\n watch(\n leftCalendarDate,\n (_date, _previous, onCleanup) => {\n if (!pendingFocus) {\n return\n }\n\n onCleanup(\n waitForAnimationFrame(() => {\n const target = pendingFocus\n pendingFocus = null\n if (target) {\n focusDay(target)\n }\n }),\n )\n },\n { flush: \"post\" },\n )\n\n const setContainer = (el: unknown) => {\n calendarContainerRef.value = (el as HTMLDivElement | null) ?? null\n }\n\n return () => {\n const { value, min, max, maxRangeDays } = context\n const left = leftCalendarDate.value\n const right = rightCalendarDate.value\n const selection = selectionRange.value\n const selectedDisplayValue = selection || value\n const viewProps = {\n selectedDates: selectedDisplayValue,\n min,\n max,\n selectionStart: selection?.[0],\n maxRangeDays,\n isSelecting: !!selection,\n onDateSelect: handleDateSelect,\n onDateMouseEnter: handleDateMouseEnter,\n onDayKeyDown: handleDayKeyDown,\n }\n\n return h(\"div\", { key: `stable-view-${forceRenderIncrement.value}`, class: s.CalendarWrapper }, [\n h(\"div\", { ref: setContainer, class: s.CalendarContainer, onPointerleave: (event: PointerEvent) => { if (isHoverPointer(event)) handleCalendarMouseLeave() } }, [\n h(\"div\", { class: s.Previous }, [\n h(\n Button,\n {\n \"variant\": \"ghost\",\n \"color\": \"secondary\",\n \"size\": \"sm\",\n \"pill\": false,\n \"gutterSize\": \"2xs\",\n \"iconSize\": \"sm\",\n \"onClick\": handlePrevious,\n \"disabled\": context.disabled || !canGoBack(),\n \"aria-label\": \"Previous month\",\n },\n { default: () => [h(CalendarNavigationIcon, { direction: \"previous\" })] },\n ),\n ]),\n h(\"div\", { class: s.Next }, [\n h(\n Button,\n {\n \"variant\": \"ghost\",\n \"color\": \"secondary\",\n \"size\": \"sm\",\n \"pill\": false,\n \"gutterSize\": \"2xs\",\n \"iconSize\": \"sm\",\n \"onClick\": handleNext,\n \"disabled\": context.disabled || !canGoForward(),\n \"aria-label\": \"Next month\",\n },\n { default: () => [h(CalendarNavigationIcon, { direction: \"next\" })] },\n ),\n ]),\n h(\"div\", { class: s.CalendarViewport }, [\n h(\n \"div\",\n {\n class: s.CalendarRange,\n style: { transform: `translate(calc(${calendarSteps.value * -1} * var(--calendar-step)), 0)` },\n },\n [\n h(\n TransitionGroup,\n { enterDuration: 400, exitDuration: 400 },\n {\n default: () => [\n h(CalendarView, {\n key: left.toLocaleString({ month: \"long\", year: \"numeric\" }),\n stepPosition: calendarSteps.value,\n date: left,\n ...viewProps,\n }),\n isMediumUp.value\n ? h(CalendarView, {\n key: right.toLocaleString({ month: \"long\", year: \"numeric\" }),\n stepPosition: calendarSteps.value + 1,\n date: right,\n ...viewProps,\n })\n : createCommentVNode(),\n ],\n },\n ),\n ],\n ),\n ]),\n ]),\n ])\n }\n },\n})\n\nconst daysOfTheWeekLabels = [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"]\n\nconst CalendarView = defineComponent({\n name: \"DateRangeCalendarView\",\n props: {\n // Can be any day within the given month that the calendar should render for\n date: { type: Object as PropType<DateTime>, required: true },\n selectedDates: { type: Array as unknown as PropType<DateRange | null>, default: undefined },\n onDateSelect: Function as PropType<(dt: DateTime) => void>,\n onDateMouseEnter: Function as PropType<(dt: DateTime) => void>,\n onDayKeyDown: Function as PropType<(event: KeyboardEvent, dt: DateTime) => void>,\n min: Object as PropType<DateTime>,\n max: Object as PropType<DateTime>,\n selectionStart: { type: Object as PropType<DateTime | null>, default: undefined },\n maxRangeDays: Number,\n isSelecting: Boolean,\n stepPosition: { type: Number, required: true },\n },\n setup(props) {\n const context = useDateRangeContext()\n // Lock position on mount and don't respond to changes\n const position = props.stepPosition\n const view = computed(() => {\n const { date, min, max } = props\n const { weekStartsOn } = context\n const monthStart = date.startOf(\"month\")\n const endOfMonth = date.endOf(\"month\")\n\n const daysBeforeMonthStart = weekPosition(monthStart, weekStartsOn)\n const blankDays = new Array(daysBeforeMonthStart).fill(null)\n const daysInMonth = getDaysOfMonth(monthStart)\n const calendarCells = [...blankDays, ...daysInMonth]\n\n // Cells are start-of-day values and Interval excludes its end, so widen the\n // bounds to whole days: min/max days themselves stay selectable.\n const enabledDateInterval = Interval.fromDateTimes(\n (min || monthStart).startOf(\"day\"),\n (max || endOfMonth).endOf(\"day\"),\n )\n\n return {\n startOfMonth: monthStart,\n endOfMonth,\n weeks: chunkIntoWeeks(calendarCells, 7) as Array<Array<DateTime | null>>,\n enabledInterval: enabledDateInterval,\n }\n })\n\n const selectedInterval = computed<Interval | null>(() => {\n const [selectedStart, selectedEnd] = props.selectedDates || []\n if (!selectedStart || !selectedEnd) {\n return null\n }\n\n return Interval.fromDateTimes(selectedStart.startOf(\"day\"), selectedEnd.endOf(\"day\"))\n })\n\n return () => {\n const { startOfMonth, weeks, enabledInterval } = view.value\n const { selectionStart, maxRangeDays, isSelecting } = props\n const [selectedStart, selectedEnd] = props.selectedDates || []\n const rangeEndLimit =\n selectionStart && maxRangeDays != null ? selectionStart.plus({ days: maxRangeDays - 1 }) : undefined\n\n const { weekStartsOn } = context\n const dayLabels = [...daysOfTheWeekLabels.slice(weekStartsOn), ...daysOfTheWeekLabels.slice(0, weekStartsOn)]\n return h(\"div\", { \"class\": s.Calendar, \"style\": { left: `calc(${position} * var(--calendar-step))` }, \"data-calendar\": true }, [\n h(\"p\", { class: s.MonthLabel }, [startOfMonth.monthLong, \" \", String(startOfMonth.year)]),\n h(\n \"div\",\n { class: [s.Week, s.WeekdayHeader] },\n dayLabels.map((day) => h(\"div\", { key: day, class: s.DayLabel }, [\n h(\"span\", { class: s.ShortDayLabel }, day.slice(0, 2)),\n h(\"span\", { class: s.LongDayLabel }, day),\n ])),\n ),\n ...weeks.map((week, weekIndex) =>\n h(\n \"div\",\n { class: s.Week, key: weekIndex },\n week.map((d, dayIndex) => {\n if (!d) {\n return h(\"div\", { class: s.Day, key: `${weekIndex}-${dayIndex}` })\n }\n\n // Check if 'day' is within selected range\n const enabled = enabledInterval.contains(d) && !(isSelecting && rangeEndLimit && isAfter(d, rangeEndLimit))\n const isStart = enabled && selectedStart && isSameDay(d, selectedStart)\n const isEnd = enabled && selectedEnd && isSameDay(d, selectedEnd)\n const hasRange = selectedStart && selectedEnd && !isSameDay(selectedStart, selectedEnd)\n const isInRange = hasRange && selectedInterval.value?.contains(d)\n const dayIsToday = isToday(d)\n const isFirstRangeTrail =\n d.day === 1 &&\n // Trail doesn't make sense to display at the start of the week\n weekPosition(d, weekStartsOn) !== 0 &&\n isInRange &&\n !isStart\n const isLastRangeTrail =\n d.day === d.daysInMonth &&\n // Trail doesn't make sense to display at the end of the week\n weekPosition(d, weekStartsOn) !== 6 &&\n isInRange &&\n !isEnd\n\n return h(\n \"div\",\n {\n \"class\": s.Day,\n \"key\": dayIndex,\n \"data-is-start\": isStart ? \"\" : undefined,\n \"data-is-end\": isEnd ? \"\" : undefined,\n \"data-is-in-range\": isInRange ? \"\" : undefined,\n \"data-is-first-range-trail\": isFirstRangeTrail ? \"\" : undefined,\n \"data-is-last-range-trail\": isLastRangeTrail ? \"\" : undefined,\n },\n [\n // The full date names the day, which \"15\" alone does not across months\n h(\n \"button\",\n {\n \"class\": s.InteractiveDay,\n \"disabled\": context.disabled || !enabled,\n \"aria-label\": d.toLocaleString(DateTime.DATE_HUGE),\n \"aria-pressed\": isStart || isEnd || isInRange ? \"true\" : \"false\",\n \"aria-current\": dayIsToday ? \"date\" : undefined,\n \"onClick\": () => { if (!context.disabled && d) props.onDateSelect?.(d) },\n \"onPointerenter\": (event: PointerEvent) => { if (!context.disabled && d && isHoverPointer(event)) props.onDateMouseEnter?.(d) },\n \"onKeydown\": (event: KeyboardEvent) => d && props.onDayKeyDown?.(event, d),\n },\n [String(d.day), dayIsToday ? h(\"span\", { class: s.TodayDot }) : null],\n ),\n ],\n )\n }),\n ),\n ),\n ])\n }\n },\n})\n\nexport const DateRangeShortcuts = defineComponent({\n name: \"DateRangeShortcuts\",\n props: {\n shortcuts: Array as PropType<DateRangeShortcut[]>,\n },\n setup(props) {\n const isMediumUp = useBreakpoint(\"md\")\n const context = useDateRangeContext()\n\n return () => {\n const { shortcuts } = props\n if (!isMediumUp.value || !shortcuts?.length) {\n return null\n }\n\n const { value, min, max, maxRangeDays, disabled, onChange } = context\n\n return h(\n \"div\",\n { class: s.Shortcuts },\n shortcuts.map((shortcut) => {\n const { label, getDateRange } = shortcut\n const range = getDateRange()\n const [start, end] = range\n const isActive = !!value && isSameDay(value[0], start) && isSameDay(value[1], end)\n\n return h(\n Button,\n {\n key: label,\n class: \"mb-1\",\n variant: \"ghost\",\n color: \"primary\",\n pill: false,\n size: \"md\",\n iconSize: \"sm\",\n block: true,\n selected: isActive,\n disabled: disabled || !isRangeWithinLimits(range, min, max, maxRangeDays),\n onClick: () => { if (!context.disabled) onChange(range, shortcut) },\n },\n { default: () => [h(\"span\", { class: s.ButtonText }, label), isActive ? h(Check) : null] },\n )\n }),\n )\n }\n },\n})\n\n// A shortcut follows the calendar's limits: whole days from min to max, and\n// no more than maxRangeDays days\nconst isRangeWithinLimits = ([start, end]: DateRange, min?: DateTime, max?: DateTime, maxRangeDays?: number) =>\n !(min && isBefore(start, min.startOf(\"day\"))) &&\n !(max && isAfter(end, max.endOf(\"day\"))) &&\n !(maxRangeDays != null && isAfter(end.startOf(\"day\"), start.startOf(\"day\").plus({ days: maxRangeDays - 1 })))\n\nconst getLeftCalendarDate = (targetDate: DateTime, maxDate?: DateTime) => {\n if (!maxDate) {\n return targetDate\n }\n\n return isBefore(targetDate.endOf(\"month\"), maxDate) ? targetDate : targetDate.minus({ months: 1 })\n}\n"]}
@@ -1,6 +1,10 @@
1
+ import s from "@plexui/styles/components/DateRangePicker/Calendar.module.css";
2
+ import { DateTime } from "luxon";
1
3
  import { computed, defineComponent, h, provide, toRaw } from "vue";
4
+ import { useBreakpoint } from "../../composables/useBreakpoints.js";
2
5
  import { isAfter } from "../../lib/dateUtils.js";
3
6
  import { Popover, PopoverContent, PopoverTrigger } from "../Popover/index.js";
7
+ import { useCalendarGutter } from "../DatePicker/useCalendarGutter.js";
4
8
  import { DateRangeCalendar, DateRangeShortcuts } from "./Calendar.js";
5
9
  import { DateRangeContextKey } from "./context.js";
6
10
  import { DateRangeTrigger } from "./Trigger.js";
@@ -28,7 +32,7 @@ const DateRangePickerComponent = defineComponent({
28
32
  weekStartsOn: { type: Number, default: 0 },
29
33
  /** Date range shortcuts for quick selection, shown to the left of the calendar. */
30
34
  shortcuts: Array,
31
- /** The preferred side of the trigger to render against when open. @default "bottom" */
35
+ /** Preferred side; collisions can flip it. On phones, left and right prefer bottom so seven 44px day targets fit. @default "bottom" */
32
36
  side: { type: String, default: "bottom" },
33
37
  /** The distance in pixels from the trigger. @default 8 */
34
38
  sideOffset: { type: Number, default: 8 },
@@ -62,10 +66,13 @@ const DateRangePickerComponent = defineComponent({
62
66
  block: { type: Boolean, default: false },
63
67
  },
64
68
  emits: {
65
- "update:value": (_nextValue) => true,
66
- "change": (_nextValue, _shortcut) => true,
69
+ "update:value": (nextValue) => nextValue === null || nextValue.every(DateTime.isDateTime),
70
+ "change": (nextValue, shortcut) => (nextValue === null || nextValue.every(DateTime.isDateTime)) &&
71
+ (shortcut === undefined || typeof shortcut.getDateRange === "function"),
67
72
  },
68
73
  setup(props, { emit }) {
74
+ const wide = useBreakpoint("md");
75
+ const calendarGutter = useCalendarGutter();
69
76
  const unwrap = (value) => (value ? toRaw(value) : value);
70
77
  // A new range only when `value` or one of its endpoints changes, as the
71
78
  // identity React's effects see. The endpoints are read through the array
@@ -148,8 +155,10 @@ const DateRangePickerComponent = defineComponent({
148
155
  default: () => [
149
156
  h(PopoverTrigger, null, { default: () => [h(DateRangeTrigger)] }),
150
157
  h(PopoverContent, {
158
+ class: s.Popover,
151
159
  minWidth: 230,
152
- side: props.side,
160
+ collisionPadding: wide.value ? 20 : calendarGutter.value,
161
+ side: wide.value || props.side === "top" ? props.side : "bottom",
153
162
  sideOffset: props.sideOffset,
154
163
  align,
155
164
  alignOffset: props.alignOffset ?? (align === "center" ? 0 : -5),