v-calendar-3 1.0.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 (147) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +142 -0
  3. package/dist/cjs/index.css +1133 -0
  4. package/dist/cjs/index.js +10699 -0
  5. package/dist/cjs/index.js.map +1 -0
  6. package/dist/cjs/package.json +1 -0
  7. package/dist/es/index.js +10678 -0
  8. package/dist/es/index.js.map +1 -0
  9. package/dist/es/style.css +1134 -0
  10. package/dist/iife/index.js +2 -0
  11. package/dist/iife/index.js.map +1 -0
  12. package/dist/mjs/index.mjs +10678 -0
  13. package/dist/mjs/index.mjs.map +1 -0
  14. package/dist/mjs/style.css +1134 -0
  15. package/dist/style.css +1134 -0
  16. package/dist/types/components/BaseIcon/BaseIcon.vue.d.ts +41 -0
  17. package/dist/types/components/BaseIcon/icons/IconChevronDown.vue.d.ts +3 -0
  18. package/dist/types/components/BaseIcon/icons/IconChevronLeft.vue.d.ts +3 -0
  19. package/dist/types/components/BaseIcon/icons/IconChevronRight.vue.d.ts +3 -0
  20. package/dist/types/components/BaseIcon/icons/IconClock.vue.d.ts +3 -0
  21. package/dist/types/components/BaseIcon/icons/index.d.ts +4 -0
  22. package/dist/types/components/BaseSelect/BaseSelect.vue.d.ts +26 -0
  23. package/dist/types/components/Calendar/Calendar.vue.d.ts +2526 -0
  24. package/dist/types/components/Calendar/CalendarDay.vue.d.ts +83 -0
  25. package/dist/types/components/Calendar/CalendarDayPopover.vue.d.ts +3 -0
  26. package/dist/types/components/Calendar/CalendarHeader.vue.d.ts +13 -0
  27. package/dist/types/components/Calendar/CalendarNav.vue.d.ts +4 -0
  28. package/dist/types/components/Calendar/CalendarNavPopover.vue.d.ts +3 -0
  29. package/dist/types/components/Calendar/CalendarPage.vue.d.ts +3 -0
  30. package/dist/types/components/Calendar/CalendarPageProvider.vue.d.ts +17 -0
  31. package/dist/types/components/Calendar/CalendarSlot.vue.d.ts +15 -0
  32. package/dist/types/components/Calendar/CalendarTitleSelect.vue.d.ts +15 -0
  33. package/dist/types/components/CalendarGrid/CalendarCell.vue.d.ts +9 -0
  34. package/dist/types/components/CalendarGrid/CalendarCellPopover.vue.d.ts +209 -0
  35. package/dist/types/components/CalendarGrid/CalendarDayCell.vue.d.ts +8 -0
  36. package/dist/types/components/CalendarGrid/CalendarEventDetails.vue.d.ts +15 -0
  37. package/dist/types/components/CalendarGrid/CalendarEventEdit.vue.d.ts +26 -0
  38. package/dist/types/components/CalendarGrid/CalendarGrid.vue.d.ts +134 -0
  39. package/dist/types/components/CalendarGrid/CalendarGridWeek.vue.d.ts +8 -0
  40. package/dist/types/components/CalendarGrid/CalendarViewSelect.vue.d.ts +3 -0
  41. package/dist/types/components/CalendarGrid/CalendarWeekCell.vue.d.ts +10 -0
  42. package/dist/types/components/CalendarGrid/Constraints.d.ts +16 -0
  43. package/dist/types/components/DatePicker/DatePicker.vue.d.ts +15251 -0
  44. package/dist/types/components/DatePicker/DatePickerBase.vue.d.ts +3 -0
  45. package/dist/types/components/DatePicker/DatePickerPopover.vue.d.ts +3 -0
  46. package/dist/types/components/DatePicker/TimePicker.vue.d.ts +10089 -0
  47. package/dist/types/components/Popover/Popover.vue.d.ts +72 -0
  48. package/dist/types/components/Popover/PopoverRow.vue.d.ts +17 -0
  49. package/dist/types/components/index.d.ts +4 -0
  50. package/dist/types/index.d.cts +40981 -0
  51. package/dist/types/index.d.mts +40981 -0
  52. package/dist/types/index.d.ts +40981 -0
  53. package/dist/types/use/base.d.ts +67 -0
  54. package/dist/types/use/calendar.d.ts +2422 -0
  55. package/dist/types/use/calendarGrid.d.ts +9370 -0
  56. package/dist/types/use/datePicker.d.ts +20210 -0
  57. package/dist/types/use/page.d.ts +20 -0
  58. package/dist/types/use/slots.d.ts +5 -0
  59. package/dist/types/use/timePicker.d.ts +10089 -0
  60. package/dist/types/utils/attribute.d.ts +49 -0
  61. package/dist/types/utils/cache.d.ts +10 -0
  62. package/dist/types/utils/calendar/event.d.ts +111 -0
  63. package/dist/types/utils/config/index.d.ts +5 -0
  64. package/dist/types/utils/date/helpers.d.ts +161 -0
  65. package/dist/types/utils/date/range.d.ts +74 -0
  66. package/dist/types/utils/date/repeat.d.ts +34 -0
  67. package/dist/types/utils/date/rules.d.ts +82 -0
  68. package/dist/types/utils/defaults/index.d.ts +30 -0
  69. package/dist/types/utils/defaults/locales.d.ts +9 -0
  70. package/dist/types/utils/glyph.d.ts +58 -0
  71. package/dist/types/utils/helpers.d.ts +49 -0
  72. package/dist/types/utils/locale.d.ts +48 -0
  73. package/dist/types/utils/page.d.ts +95 -0
  74. package/dist/types/utils/plugins/index.d.ts +4 -0
  75. package/dist/types/utils/popovers.d.ts +47 -0
  76. package/dist/types/utils/theme.d.ts +17 -0
  77. package/dist/types/utils/touch.d.ts +8 -0
  78. package/dist/types/utils/useDisplayMode.d.ts +12 -0
  79. package/dist/types/utils/watchers.d.ts +6 -0
  80. package/package.json +115 -0
  81. package/src/components/BaseIcon/BaseIcon.vue +29 -0
  82. package/src/components/BaseIcon/icons/IconChevronDown.vue +5 -0
  83. package/src/components/BaseIcon/icons/IconChevronLeft.vue +5 -0
  84. package/src/components/BaseIcon/icons/IconChevronRight.vue +5 -0
  85. package/src/components/BaseIcon/icons/IconClock.vue +11 -0
  86. package/src/components/BaseIcon/icons/index.ts +4 -0
  87. package/src/components/BaseSelect/BaseSelect.vue +136 -0
  88. package/src/components/Calendar/Calendar.vue +116 -0
  89. package/src/components/Calendar/CalendarDay.vue +422 -0
  90. package/src/components/Calendar/CalendarDayPopover.vue +44 -0
  91. package/src/components/Calendar/CalendarHeader.vue +203 -0
  92. package/src/components/Calendar/CalendarNav.vue +325 -0
  93. package/src/components/Calendar/CalendarNavPopover.vue +24 -0
  94. package/src/components/Calendar/CalendarPage.vue +140 -0
  95. package/src/components/Calendar/CalendarPageProvider.vue +15 -0
  96. package/src/components/Calendar/CalendarSlot.vue +36 -0
  97. package/src/components/Calendar/CalendarTitleSelect.vue +72 -0
  98. package/src/components/CalendarGrid/CalendarCell.vue +112 -0
  99. package/src/components/CalendarGrid/CalendarCellPopover.vue +93 -0
  100. package/src/components/CalendarGrid/CalendarDayCell.vue +57 -0
  101. package/src/components/CalendarGrid/CalendarEventDetails.vue +71 -0
  102. package/src/components/CalendarGrid/CalendarEventEdit.vue +195 -0
  103. package/src/components/CalendarGrid/CalendarGrid.vue +715 -0
  104. package/src/components/CalendarGrid/CalendarGridWeek.vue +60 -0
  105. package/src/components/CalendarGrid/CalendarViewSelect.vue +34 -0
  106. package/src/components/CalendarGrid/CalendarWeekCell.vue +52 -0
  107. package/src/components/CalendarGrid/Constraints.ts +40 -0
  108. package/src/components/DatePicker/DatePicker.vue +27 -0
  109. package/src/components/DatePicker/DatePickerBase.vue +53 -0
  110. package/src/components/DatePicker/DatePickerPopover.vue +37 -0
  111. package/src/components/DatePicker/TimePicker.vue +167 -0
  112. package/src/components/Popover/Popover.vue +572 -0
  113. package/src/components/Popover/PopoverRow.vue +94 -0
  114. package/src/components/index.ts +4 -0
  115. package/src/index.ts +24 -0
  116. package/src/styles/index.css +48 -0
  117. package/src/styles/theme.css +322 -0
  118. package/src/styles/transitions.css +77 -0
  119. package/src/use/base.ts +144 -0
  120. package/src/use/calendar.ts +796 -0
  121. package/src/use/calendarGrid.ts +954 -0
  122. package/src/use/datePicker.ts +909 -0
  123. package/src/use/page.ts +78 -0
  124. package/src/use/slots.ts +17 -0
  125. package/src/use/timePicker.ts +194 -0
  126. package/src/utils/attribute.ts +107 -0
  127. package/src/utils/cache.ts +30 -0
  128. package/src/utils/calendar/event.ts +335 -0
  129. package/src/utils/config/index.ts +11 -0
  130. package/src/utils/date/helpers.ts +1039 -0
  131. package/src/utils/date/range.ts +274 -0
  132. package/src/utils/date/repeat.ts +135 -0
  133. package/src/utils/date/rules.ts +290 -0
  134. package/src/utils/defaults/index.ts +77 -0
  135. package/src/utils/defaults/locales.ts +123 -0
  136. package/src/utils/defaults/masks.json +15 -0
  137. package/src/utils/defaults/touch.json +5 -0
  138. package/src/utils/glyph.ts +305 -0
  139. package/src/utils/helpers.ts +181 -0
  140. package/src/utils/locale.ts +275 -0
  141. package/src/utils/page.ts +608 -0
  142. package/src/utils/plugins/index.ts +24 -0
  143. package/src/utils/popovers.ts +216 -0
  144. package/src/utils/theme.ts +58 -0
  145. package/src/utils/touch.ts +72 -0
  146. package/src/utils/useDisplayMode.ts +198 -0
  147. package/src/utils/watchers.ts +26 -0
@@ -0,0 +1,48 @@
1
+ import { type PageConfig, type CachedPage } from './page';
2
+ import { type DateSource, type DateOptions, type DayOfWeek, type MonthParts, type SimpleDateParts, type TimeNames } from './date/helpers';
3
+ import Cache from './cache';
4
+ import { type DateRangeSource, DateRange } from './date/range';
5
+ export interface LocaleConfig {
6
+ id: string;
7
+ firstDayOfWeek: number;
8
+ masks: any;
9
+ monthCacheSize: number;
10
+ pageCacheSize: number;
11
+ }
12
+ export declare function resolveConfig(config: string | Partial<LocaleConfig> | undefined, locales: any): LocaleConfig;
13
+ export default class Locale {
14
+ id: any;
15
+ daysInWeek: number;
16
+ firstDayOfWeek: DayOfWeek;
17
+ masks: any;
18
+ timezone: string | undefined;
19
+ hourLabels: string[];
20
+ dayNames: string[];
21
+ dayNamesShort: string[];
22
+ dayNamesShorter: string[];
23
+ dayNamesNarrow: string[];
24
+ monthNames: string[];
25
+ monthNamesShort: string[];
26
+ relativeTimeNames: TimeNames;
27
+ amPm: [string, string];
28
+ monthCache: Cache<MonthParts>;
29
+ pageCache: Cache<CachedPage>;
30
+ constructor(config?: Partial<LocaleConfig> | string | undefined, timezone?: string);
31
+ formatDate(date: Date, masks: string | string[]): string;
32
+ parseDate(dateString: string, mask: string | string[]): Date;
33
+ toDate(d: DateSource | Partial<SimpleDateParts>, opts?: Partial<DateOptions>): Date;
34
+ toDateOrNull(d: DateSource | Partial<SimpleDateParts>, opts?: Partial<DateOptions>): Date | null;
35
+ fromDate(date: Date | null, { type, mask }?: Partial<DateOptions>): string | number | Date | import("./date/helpers").DateParts | null;
36
+ range(source: DateRangeSource): DateRange;
37
+ ranges(ranges: DateRangeSource | DateRangeSource[]): DateRange[];
38
+ getDateParts(date: Date): import("./date/helpers").DateParts;
39
+ getDateFromParts(parts: Partial<SimpleDateParts>): Date;
40
+ getDateFromParams(year: number, month: number, day: number, hours: number, minutes: number, seconds: number, milliseconds: number): Date;
41
+ getPage(config: PageConfig): import("./page").Page;
42
+ getMonthParts(month: number, year: number): MonthParts;
43
+ getThisMonthParts(): MonthParts;
44
+ getPrevMonthParts(month: number, year: number): MonthParts;
45
+ getNextMonthParts(month: number, year: number): MonthParts;
46
+ getHourLabels(): string[];
47
+ getDayId(date: Date): string;
48
+ }
@@ -0,0 +1,95 @@
1
+ import { type DateSource, type DayParts, type MonthParts } from './date/helpers';
2
+ import Locale from './locale';
3
+ export interface CalendarDay extends DayParts {
4
+ id: string;
5
+ position: number;
6
+ label: string;
7
+ ariaLabel: string;
8
+ weekdayPosition: number;
9
+ weekdayPositionFromEnd: number;
10
+ weekPosition: number;
11
+ isoWeeknumber: number;
12
+ startDate: Date;
13
+ noonDate: Date;
14
+ endDate: Date;
15
+ isToday: boolean;
16
+ isFirstDay: boolean;
17
+ isLastDay: boolean;
18
+ isDisabled: boolean;
19
+ isFocusable: boolean;
20
+ isFocused: boolean;
21
+ inMonth: boolean;
22
+ inPrevMonth: boolean;
23
+ inNextMonth: boolean;
24
+ onTop: boolean;
25
+ onBottom: boolean;
26
+ onLeft: boolean;
27
+ onRight: boolean;
28
+ classes: Array<string | object>;
29
+ locale: Locale;
30
+ }
31
+ export interface CalendarWeek {
32
+ id: string;
33
+ week: number;
34
+ weekPosition: number;
35
+ weeknumber: number;
36
+ isoWeeknumber: number;
37
+ weeknumberDisplay?: number;
38
+ days: CalendarDay[];
39
+ title: string;
40
+ }
41
+ export interface CalendarWeekday {
42
+ weekday: number;
43
+ label: string;
44
+ }
45
+ export type PageView = 'daily' | 'weekly' | 'monthly';
46
+ export type TitlePosition = 'center' | 'left' | 'right';
47
+ export interface Page {
48
+ id: string;
49
+ day?: number;
50
+ week?: number;
51
+ month: number;
52
+ year: number;
53
+ view: PageView;
54
+ trimWeeks: boolean;
55
+ position: number;
56
+ row: number;
57
+ rowFromEnd: number;
58
+ column: number;
59
+ columnFromEnd: number;
60
+ showWeeknumbers: boolean;
61
+ showIsoWeeknumbers: boolean;
62
+ weeknumberPosition: string;
63
+ monthTitle: string;
64
+ weekTitle?: string;
65
+ dayTitle?: string;
66
+ title: string;
67
+ titlePosition: TitlePosition;
68
+ shortMonthLabel: string;
69
+ monthLabel: string;
70
+ shortYearLabel: string;
71
+ yearLabel: string;
72
+ monthComps: MonthParts;
73
+ prevMonthComps: MonthParts;
74
+ nextMonthComps: MonthParts;
75
+ days: CalendarDay[];
76
+ weeks: CalendarWeek[];
77
+ weekdays: CalendarWeekday[];
78
+ viewDays: CalendarDay[];
79
+ viewWeeks: CalendarWeek[];
80
+ }
81
+ export type PageAddress = Pick<Page, 'day' | 'week' | 'month' | 'year'>;
82
+ export type PageConfig = Pick<Page, 'day' | 'week' | 'month' | 'year' | 'view' | 'titlePosition' | 'trimWeeks' | 'position' | 'row' | 'rowFromEnd' | 'column' | 'columnFromEnd' | 'showWeeknumbers' | 'showIsoWeeknumbers' | 'weeknumberPosition'>;
83
+ export type CachedPage = Pick<Page, 'id' | 'month' | 'year' | 'monthTitle' | 'shortMonthLabel' | 'monthLabel' | 'shortYearLabel' | 'yearLabel' | 'monthComps' | 'prevMonthComps' | 'nextMonthComps' | 'days' | 'weeks' | 'weekdays'>;
84
+ export declare function getPageId(month: number, year: number): string;
85
+ export declare function getPageAddressForDate(date: DateSource, view: PageView, locale: Locale): PageAddress;
86
+ export declare function addPages({ day, week, month, year }: PageAddress, count: number, view: PageView, locale: Locale): PageAddress;
87
+ export declare function pageIsValid(page: PageAddress | null | undefined): boolean;
88
+ export declare function pageIsBeforePage(page: PageAddress | null | undefined, comparePage: PageAddress | null | undefined): boolean;
89
+ export declare function pageIsAfterPage(page: PageAddress | null | undefined, comparePage: PageAddress | null | undefined): boolean;
90
+ export declare function pageIsBetweenPages(page: PageAddress | null | undefined, fromPage: PageAddress | null | undefined, toPage: PageAddress | null | undefined): boolean;
91
+ export declare function pageIsEqualToPage(aPage: PageAddress | null | undefined, bPage: PageAddress | null | undefined): boolean;
92
+ export declare function pageRangeToArray(from: PageAddress, to: PageAddress, view: PageView, locale: Locale): PageAddress[];
93
+ export declare function getPageKey(config: PageConfig): string;
94
+ export declare function getCachedPage(config: PageConfig, locale: Locale): CachedPage;
95
+ export declare function getPage(config: PageConfig, cachedPage: CachedPage): Page;
@@ -0,0 +1,4 @@
1
+ import type { App as Application, Component } from 'vue';
2
+ import type { Defaults } from '../defaults';
3
+ export declare const registerComponent: (instance: Application, component: Component, defaults?: Defaults) => void;
4
+ export declare const registerComponentProgrammatic: (instance: Application, property: string, component: Component) => void;
@@ -0,0 +1,47 @@
1
+ import type { Placement } from '@popperjs/core';
2
+ import type { Directive } from 'vue';
3
+ export type PopoverVisibility = 'click' | 'hover' | 'hover-focus' | 'focus';
4
+ export interface PopoverOptions {
5
+ id: PropertyKey;
6
+ visibility: PopoverVisibility;
7
+ isInteractive: boolean;
8
+ autoHide: boolean;
9
+ force: boolean;
10
+ target: unknown;
11
+ placement: Placement;
12
+ modifiers: any;
13
+ data: any;
14
+ showDelay: number;
15
+ hideDelay: number;
16
+ }
17
+ export interface PopoverState {
18
+ isVisible: boolean;
19
+ target: unknown;
20
+ data: any;
21
+ transition: string;
22
+ placement: Placement;
23
+ direction: string;
24
+ positionFixed: false;
25
+ modifiers: any[];
26
+ isInteractive: boolean;
27
+ visibility: PopoverVisibility;
28
+ isHovered: boolean;
29
+ isFocused: boolean;
30
+ autoHide: boolean;
31
+ force: boolean;
32
+ }
33
+ export interface PopoverEvent {
34
+ detail: Partial<PopoverOptions>;
35
+ }
36
+ export interface PopoverEventHandlers {
37
+ click: (e: MouseEvent) => void;
38
+ mousemove: (e: MouseEvent) => void;
39
+ mouseleave: (e: MouseEvent) => void;
40
+ focusin: (e: MouseEvent) => void;
41
+ focusout: (e: MouseEvent) => void;
42
+ }
43
+ export declare function showPopover(opts: Partial<PopoverOptions>): void;
44
+ export declare function hidePopover(opts: Partial<PopoverOptions>): void;
45
+ export declare function togglePopover(opts: Partial<PopoverOptions>): void;
46
+ export declare function getPopoverEventHandlers(opts: Partial<PopoverOptions>): Partial<PopoverEventHandlers>;
47
+ export declare const popoverDirective: Directive;
@@ -0,0 +1,17 @@
1
+ import type { DateRangeCell } from './date/range';
2
+ import { Attribute } from './attribute';
3
+ import { type Bar, type Content, type Dot, type Glyph, type GlyphRenderer, type Highlight } from './glyph';
4
+ export interface Glyphs {
5
+ highlights: Highlight[];
6
+ dots: Dot[];
7
+ bars: Bar[];
8
+ content: Content[];
9
+ }
10
+ export declare class Theme {
11
+ color: string;
12
+ renderers: GlyphRenderer<Glyph>[];
13
+ constructor(color: string);
14
+ normalizeGlyphs(attr: Attribute): void;
15
+ prepareRender(glyphs?: Partial<Glyphs>): Partial<Glyphs>;
16
+ render(cell: DateRangeCell<Attribute>, glyphs: Partial<Glyphs>): void;
17
+ }
@@ -0,0 +1,8 @@
1
+ import type { CustomElement } from './helpers';
2
+ interface SwipeHandlerOptions {
3
+ maxSwipeTime: number;
4
+ minHorizontalSwipeDistance: number;
5
+ maxVerticalSwipeDistance: number;
6
+ }
7
+ export declare const addHorizontalSwipeHandler: (element: CustomElement, handler: Function, { maxSwipeTime, minHorizontalSwipeDistance, maxVerticalSwipeDistance, }: SwipeHandlerOptions) => (() => void) | null;
8
+ export {};
@@ -0,0 +1,12 @@
1
+ import { type ComputedRef, type Ref } from 'vue';
2
+ export interface DarkModeClassConfig {
3
+ selector?: string;
4
+ darkClass?: string;
5
+ }
6
+ export type DarkModeConfig = boolean | 'system' | DarkModeClassConfig;
7
+ interface DisplayModeState {
8
+ isDark: Ref<boolean>;
9
+ displayMode: ComputedRef<'dark' | 'light'>;
10
+ }
11
+ export declare function useDisplayMode(config: Ref<DarkModeConfig>): DisplayModeState;
12
+ export {};
@@ -0,0 +1,6 @@
1
+ export declare const createWatcherController: () => {
2
+ skipWatcher: (watcher: string, durationMs?: number) => void;
3
+ unskipWatcher: (watcher: string) => void;
4
+ handleWatcher: (watcher: string, handler: Function) => void;
5
+ };
6
+ export declare const skipWatcher: (watcher: string, durationMs?: number) => void, unskipWatcher: (watcher: string) => void, handleWatcher: (watcher: string, handler: Function) => void;
package/package.json ADDED
@@ -0,0 +1,115 @@
1
+ {
2
+ "name": "v-calendar-3",
3
+ "type": "module",
4
+ "version": "1.0.0",
5
+ "description": "A calendar and date picker plugin for Vue 3.",
6
+ "author": "ujidesu",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/BEJIbXEOP/v-calendar.git"
10
+ },
11
+ "homepage": "https://vcalendar.io",
12
+ "main": "dist/cjs/index.js",
13
+ "module": "dist/es/index.js",
14
+ "jsdelivr": "dist/iife/index.js",
15
+ "unpkg": "dist/iife/index.js",
16
+ "types": "dist/types/index.d.ts",
17
+ "sideEffects": [
18
+ "**/*.css"
19
+ ],
20
+ "keywords": [
21
+ "vue",
22
+ "vue3",
23
+ "vuejs",
24
+ "plugin",
25
+ "calendar",
26
+ "v-calendar",
27
+ "datepicker",
28
+ "date picker"
29
+ ],
30
+ "license": "MIT",
31
+ "files": [
32
+ "src",
33
+ "dist",
34
+ "package.json",
35
+ "README.md"
36
+ ],
37
+ "exports": {
38
+ ".": {
39
+ "import": {
40
+ "types": "./dist/types/index.d.mts",
41
+ "node": "./dist/mjs/index.mjs",
42
+ "default": "./dist/es/index.js"
43
+ },
44
+ "require": {
45
+ "types": "./dist/types/index.d.cts",
46
+ "default": "./dist/cjs/index.js"
47
+ }
48
+ },
49
+ "./style.css": "./dist/style.css",
50
+ "./dist/*": "./dist/*"
51
+ },
52
+ "scripts": {
53
+ "build": "tsx build/build.ts",
54
+ "build:docs": "cd docs && yarn build",
55
+ "build:all": "yarn build && yarn build:docs",
56
+ "dev": "vite --host 127.0.0.1",
57
+ "format": "prettier --write .",
58
+ "lint": "eslint .",
59
+ "typecheck": "vue-tsc --noEmit -p tsconfig.json",
60
+ "test": "npm run test:unit",
61
+ "test:unit": "vitest run",
62
+ "test:browser": "playwright test",
63
+ "check:package": "publint && attw --pack . --ignore-rules no-resolution",
64
+ "validate": "npm run lint && npm run typecheck && npm run test:unit && npm run test:browser && npm run build && npm run check:package"
65
+ },
66
+ "dependencies": {
67
+ "date-fns": "^4.4.0",
68
+ "date-fns-tz": "^3.2.0",
69
+ "lodash": "^4.18.1"
70
+ },
71
+ "peerDependencies": {
72
+ "@popperjs/core": "^2.11.8",
73
+ "vue": "^3.5.16"
74
+ },
75
+ "devDependencies": {
76
+ "@arethetypeswrong/cli": "^0.18.5",
77
+ "@eslint/js": "^10.0.1",
78
+ "@playwright/test": "^1.61.1",
79
+ "@popperjs/core": "^2.11.8",
80
+ "@types/lodash": "^4.17.24",
81
+ "@types/jsdom": "^28.0.3",
82
+ "@types/node": "^24.13.3",
83
+ "@vitejs/plugin-vue": "^6.0.7",
84
+ "@vue/compiler-sfc": "^3.5.39",
85
+ "@vue/test-utils": "^2.4.11",
86
+ "autoprefixer": "^10.5.2",
87
+ "eslint": "^10.7.0",
88
+ "eslint-plugin-vue": "^10.9.2",
89
+ "globals": "^17.7.0",
90
+ "jsdom": "^29.1.1",
91
+ "postcss": "^8.5.19",
92
+ "postcss-import": "^16.1.1",
93
+ "postcss-nested": "^7.0.2",
94
+ "prettier": "^3.9.5",
95
+ "publint": "^0.3.21",
96
+ "rollup-plugin-visualizer": "^7.0.1",
97
+ "rollup-plugin-dts": "^6.4.1",
98
+ "terser": "^5.49.0",
99
+ "tsx": "^4.23.1",
100
+ "typescript": "^5.9.3",
101
+ "typescript-eslint": "^8.63.0",
102
+ "vite": "^8.1.4",
103
+ "vitest": "^4.1.10",
104
+ "vue": "^3.5.39",
105
+ "vue-tsc": "^3.3.7"
106
+ },
107
+ "engines": {
108
+ "node": "^20.19.0 || >=22.12.0"
109
+ },
110
+ "browserslist": [
111
+ "> 0.5%",
112
+ "not dead",
113
+ "not op_mini all"
114
+ ]
115
+ }
@@ -0,0 +1,29 @@
1
+ <template>
2
+ <component :is="icon" :width="width" :height="height" class="vc-base-icon" />
3
+ </template>
4
+
5
+ <script setup lang="ts">
6
+ import { computed } from 'vue';
7
+ import * as icons from './icons';
8
+
9
+ const props = defineProps({
10
+ name: { type: String, required: true },
11
+ width: { type: String },
12
+ height: { type: String },
13
+ size: { type: String, default: '26' },
14
+ viewBox: { type: String },
15
+ });
16
+
17
+ const width = computed(() => props.width || props.size);
18
+ const height = computed(() => props.height || props.size);
19
+ const icon = computed(() => (icons as any)[`Icon${props.name}`]);
20
+ </script>
21
+
22
+ <style lang="css">
23
+ .vc-base-icon {
24
+ display: inline-block;
25
+ stroke: currentColor;
26
+ stroke-width: 2;
27
+ fill: none;
28
+ }
29
+ </style>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <svg stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24">
3
+ <polyline points="6 9 12 15 18 9"></polyline>
4
+ </svg>
5
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <svg stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24">
3
+ <polyline points="15 18 9 12 15 6"></polyline>
4
+ </svg>
5
+ </template>
@@ -0,0 +1,5 @@
1
+ <template>
2
+ <svg stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24">
3
+ <polyline points="9 18 15 12 9 6"></polyline>
4
+ </svg>
5
+ </template>
@@ -0,0 +1,11 @@
1
+ <template>
2
+ <svg
3
+ fill="none"
4
+ stroke-linecap="round"
5
+ stroke-linejoin="round"
6
+ stroke-width="2"
7
+ viewBox="0 0 24 24"
8
+ >
9
+ <path d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />
10
+ </svg>
11
+ </template>
@@ -0,0 +1,4 @@
1
+ export { default as IconChevronRight } from './IconChevronRight.vue';
2
+ export { default as IconChevronLeft } from './IconChevronLeft.vue';
3
+ export { default as IconChevronDown } from './IconChevronDown.vue';
4
+ export { default as IconClock } from './IconClock.vue';
@@ -0,0 +1,136 @@
1
+ <template>
2
+ <div
3
+ class="vc-base-select"
4
+ :class="{
5
+ 'vc-fit-content': fitContent,
6
+ 'vc-has-icon': showIcon,
7
+ }"
8
+ >
9
+ <select
10
+ v-bind="$attrs"
11
+ :value="modelValue"
12
+ class="vc-focus"
13
+ :class="{
14
+ 'vc-align-right': alignRight,
15
+ 'vc-align-left': alignLeft,
16
+ }"
17
+ @change="
18
+ $emit('update:modelValue', ($event.target as HTMLSelectElement).value)
19
+ "
20
+ >
21
+ <option
22
+ v-for="option in options"
23
+ :key="option.value"
24
+ :value="option.value"
25
+ :disabled="option.disabled"
26
+ >
27
+ {{ option.label }}
28
+ </option>
29
+ </select>
30
+ <BaseIcon v-if="showIcon" name="ChevronDown" size="18" />
31
+ <div v-if="fitContent" class="vc-base-sizer" aria-hidden="true">
32
+ {{ selectedLabel }}
33
+ </div>
34
+ </div>
35
+ </template>
36
+
37
+ <script lang="ts">
38
+ interface BaseOption {
39
+ value: any;
40
+ label: string;
41
+ disabled?: boolean;
42
+ }
43
+
44
+ export default {
45
+ inheritAttrs: false,
46
+ };
47
+ </script>
48
+
49
+ <script setup lang="ts">
50
+ import { computed } from 'vue';
51
+ import BaseIcon from '../BaseIcon/BaseIcon.vue';
52
+
53
+ const props = defineProps<{
54
+ options: BaseOption[];
55
+ modelValue: any;
56
+ alignRight?: boolean;
57
+ alignLeft?: boolean;
58
+ showIcon?: boolean;
59
+ fitContent?: boolean;
60
+ }>();
61
+ defineEmits(['update:modelValue']);
62
+
63
+ const selectedLabel = computed(() => {
64
+ const option = props.options.find(opt => opt.value === props.modelValue);
65
+ return option?.label;
66
+ });
67
+ </script>
68
+
69
+ <style lang="css">
70
+ .vc-base-select {
71
+ position: relative;
72
+ display: flex;
73
+ justify-content: center;
74
+ align-items: center;
75
+ height: 30px;
76
+ font-size: var(--vc-text-base);
77
+ font-weight: var(--vc-font-medium);
78
+ &.vc-has-icon {
79
+ & select {
80
+ padding: 0 27px 0 9px;
81
+ }
82
+ & .vc-base-sizer {
83
+ padding: 0 28px 0 10px;
84
+ }
85
+ }
86
+ &.vc-fit-content {
87
+ & select {
88
+ position: absolute;
89
+ top: 0;
90
+ left: 0;
91
+ width: 100%;
92
+ }
93
+ }
94
+ & .vc-base-icon {
95
+ position: absolute;
96
+ top: 6px;
97
+ right: 4px;
98
+ opacity: 0.6;
99
+ pointer-events: none;
100
+ }
101
+ & .vc-base-sizer {
102
+ font-size: var(--vc-text-base);
103
+ font-weight: var(--vc-font-medium);
104
+ color: transparent;
105
+ padding: 0px 8px;
106
+ margin: 0;
107
+ }
108
+ & select {
109
+ display: inline-flex;
110
+ justify-content: center;
111
+ color: var(--vc-select-color);
112
+ display: block;
113
+ appearance: none;
114
+ background-color: var(--vc-select-bg);
115
+ border-radius: var(--vc-rounded);
116
+ height: 30px;
117
+ width: max-content;
118
+ padding: 0px 7px;
119
+ margin: 0;
120
+ line-height: var(--leading-none);
121
+ text-indent: 0px;
122
+ background-image: none;
123
+ cursor: pointer;
124
+ text-align: center;
125
+ &:hover {
126
+ background-color: var(--vc-select-hover-bg);
127
+ }
128
+ &.vc-align-left {
129
+ text-align: left;
130
+ }
131
+ &.vc-align-right {
132
+ text-align: right;
133
+ }
134
+ }
135
+ }
136
+ </style>
@@ -0,0 +1,116 @@
1
+ <template>
2
+ <div
3
+ data-helptext="Press the arrow keys to navigate by day, Home and End to navigate to week ends, PageUp and PageDown to navigate by month, Alt+PageUp and Alt+PageDown to navigate by year"
4
+ v-bind="$attrs"
5
+ :class="[
6
+ 'vc-container',
7
+ `vc-${view}`,
8
+ `vc-${color}`,
9
+ `vc-${displayMode}`,
10
+ {
11
+ 'vc-expanded': expanded,
12
+ 'vc-bordered': !borderless,
13
+ 'vc-transparent': transparent,
14
+ },
15
+ ]"
16
+ @mouseup.prevent
17
+ ref="containerRef"
18
+ >
19
+ <!--Calendar Container-->
20
+ <div :class="['vc-pane-container', { 'in-transition': inTransition }]">
21
+ <div class="vc-pane-header-wrapper">
22
+ <CalendarHeader v-if="firstPage" :page="firstPage!" is-lg hide-title />
23
+ </div>
24
+ <Transition
25
+ :name="`vc-${transitionName}`"
26
+ @before-enter="onTransitionBeforeEnter"
27
+ @after-enter="onTransitionAfterEnter"
28
+ >
29
+ <!--Calendar Layout-->
30
+ <div
31
+ :key="pages[0].id"
32
+ class="vc-pane-layout"
33
+ :style="{
34
+ gridTemplateColumns: `repeat(${columns}, 1fr)`,
35
+ }"
36
+ >
37
+ <!--Calendar pages-->
38
+ <CalendarPageProvider
39
+ v-for="page in pages"
40
+ :key="page.id"
41
+ :page="page"
42
+ >
43
+ <CalendarSlot name="page" :page="page">
44
+ <CalendarPage />
45
+ </CalendarSlot>
46
+ </CalendarPageProvider>
47
+ </div>
48
+ </Transition>
49
+ <CalendarSlot name="footer" />
50
+ </div>
51
+ </div>
52
+ <!--Day popover-->
53
+ <CalendarDayPopover />
54
+ <!--Nav popover-->
55
+ <CalendarNavPopover />
56
+ </template>
57
+
58
+ <script lang="ts">
59
+ import { defineComponent } from 'vue';
60
+ import { createCalendar, emitsDef, propsDef } from '../../use/calendar';
61
+ import CalendarDayPopover from './CalendarDayPopover.vue';
62
+ import CalendarHeader from './CalendarHeader.vue';
63
+ import CalendarNavPopover from './CalendarNavPopover.vue';
64
+ import CalendarPage from './CalendarPage.vue';
65
+ import CalendarPageProvider from './CalendarPageProvider.vue';
66
+ import CalendarSlot from './CalendarSlot.vue';
67
+
68
+ export default defineComponent({
69
+ components: {
70
+ CalendarHeader,
71
+ CalendarPage,
72
+ CalendarNavPopover,
73
+ CalendarDayPopover,
74
+ CalendarPageProvider,
75
+ CalendarSlot,
76
+ },
77
+ props: propsDef,
78
+ emits: emitsDef,
79
+ setup(props, { emit, slots }) {
80
+ return createCalendar(props, { emit, slots });
81
+ },
82
+ });
83
+ </script>
84
+
85
+ <style>
86
+ .vc-pane-container {
87
+ width: 100%;
88
+ position: relative;
89
+ &.in-transition {
90
+ overflow: hidden;
91
+ }
92
+ }
93
+
94
+ .vc-pane-layout {
95
+ display: grid;
96
+ }
97
+
98
+ .vc-pane-header-wrapper {
99
+ position: absolute;
100
+ top: 0;
101
+ width: 100%;
102
+ pointer-events: none;
103
+ }
104
+
105
+ .vc-day-popover-container {
106
+ font-size: var(--vc-text-xs);
107
+ font-weight: var(--vc-font-medium);
108
+ }
109
+
110
+ .vc-day-popover-header {
111
+ font-size: var(--vc-text-xs);
112
+ color: var(--vc-day-popover-header-color);
113
+ font-weight: var(--vc-font-semibold);
114
+ text-align: center;
115
+ }
116
+ </style>