@sit-onyx/headless 0.3.0-dev-20251029143741 → 0.3.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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,8 @@
1
+ import { SelectionMode } from './createCalendar.js';
2
+ type __VLS_Props = {
3
+ mode?: SelectionMode;
4
+ };
5
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
6
+ mode: SelectionMode;
7
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
8
+ export default _default;
@@ -0,0 +1,24 @@
1
+ import { Locator, Page } from '@playwright/test';
2
+ export type CalendarTestingOptions = {
3
+ /**
4
+ * Playwright page.
5
+ */
6
+ page: Page;
7
+ /**
8
+ * Locator for the root calendar table/grid element.
9
+ */
10
+ calendarGrid: Locator;
11
+ /**
12
+ * Locator for all day buttons/cells.
13
+ */
14
+ dayButtons: Locator;
15
+ /**
16
+ * Locator for the button/cell that should initially have focus (tabindex=0).
17
+ */
18
+ initialFocusDay: Locator;
19
+ /**
20
+ * Selection mode to run specific tests for.
21
+ */
22
+ mode: "single" | "multiple" | "range";
23
+ };
24
+ export declare const calendarTesting: (options: CalendarTestingOptions) => Promise<void>;
package/dist/index.js CHANGED
@@ -67,7 +67,17 @@ const _unstableCreateCalendar = createBuilder((options) => {
67
67
  const index = WEEKDAYS.indexOf(weekStartDay);
68
68
  return names.slice(index).concat(names.slice(0, index));
69
69
  });
70
- const focusedDate = ref(/* @__PURE__ */ new Date());
70
+ const initialFocusedDate = () => {
71
+ const today = /* @__PURE__ */ new Date();
72
+ const view = viewMonth.value;
73
+ const isTodayInViewMonth = today.getFullYear() === view.getFullYear() && today.getMonth() === view.getMonth();
74
+ if (isTodayInViewMonth) {
75
+ return today;
76
+ } else {
77
+ return new Date(view.getFullYear(), view.getMonth(), 1);
78
+ }
79
+ };
80
+ const focusedDate = ref(initialFocusedDate());
71
81
  watch(
72
82
  () => toValue(options.modelValue),
73
83
  (newValue) => {
@@ -81,7 +91,8 @@ const _unstableCreateCalendar = createBuilder((options) => {
81
91
  newFocusDate = new Date(newValue);
82
92
  }
83
93
  if (newFocusDate) focusedDate.value = newFocusDate;
84
- }
94
+ },
95
+ { immediate: true }
85
96
  );
86
97
  const isToday = (date) => {
87
98
  return date.toDateString() === (/* @__PURE__ */ new Date()).toDateString();
@@ -251,6 +262,8 @@ const _unstableCreateCalendar = createBuilder((options) => {
251
262
  start.setHours(0, 0, 0, 0);
252
263
  const end = sortedRange.end ? new Date(sortedRange.end) : void 0;
253
264
  end?.setHours(23, 59, 59, 999);
265
+ if (date.toDateString() === start.toDateString() && date.toDateString() === end?.toDateString())
266
+ return;
254
267
  if (date.toDateString() === start.toDateString()) return "start";
255
268
  if (date.toDateString() === end?.toDateString()) return "end";
256
269
  if (end && isInDateRange(date, start, end)) return "middle";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sit-onyx/headless",
3
3
  "description": "Headless composables for Vue",
4
- "version": "0.3.0-dev-20251029143741",
4
+ "version": "0.3.0",
5
5
  "type": "module",
6
6
  "author": "Schwarz IT KG",
7
7
  "license": "Apache-2.0",