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.
- package/LICENSE +9 -0
- package/README.md +142 -0
- package/dist/cjs/index.css +1133 -0
- package/dist/cjs/index.js +10699 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/es/index.js +10678 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/style.css +1134 -0
- package/dist/iife/index.js +2 -0
- package/dist/iife/index.js.map +1 -0
- package/dist/mjs/index.mjs +10678 -0
- package/dist/mjs/index.mjs.map +1 -0
- package/dist/mjs/style.css +1134 -0
- package/dist/style.css +1134 -0
- package/dist/types/components/BaseIcon/BaseIcon.vue.d.ts +41 -0
- package/dist/types/components/BaseIcon/icons/IconChevronDown.vue.d.ts +3 -0
- package/dist/types/components/BaseIcon/icons/IconChevronLeft.vue.d.ts +3 -0
- package/dist/types/components/BaseIcon/icons/IconChevronRight.vue.d.ts +3 -0
- package/dist/types/components/BaseIcon/icons/IconClock.vue.d.ts +3 -0
- package/dist/types/components/BaseIcon/icons/index.d.ts +4 -0
- package/dist/types/components/BaseSelect/BaseSelect.vue.d.ts +26 -0
- package/dist/types/components/Calendar/Calendar.vue.d.ts +2526 -0
- package/dist/types/components/Calendar/CalendarDay.vue.d.ts +83 -0
- package/dist/types/components/Calendar/CalendarDayPopover.vue.d.ts +3 -0
- package/dist/types/components/Calendar/CalendarHeader.vue.d.ts +13 -0
- package/dist/types/components/Calendar/CalendarNav.vue.d.ts +4 -0
- package/dist/types/components/Calendar/CalendarNavPopover.vue.d.ts +3 -0
- package/dist/types/components/Calendar/CalendarPage.vue.d.ts +3 -0
- package/dist/types/components/Calendar/CalendarPageProvider.vue.d.ts +17 -0
- package/dist/types/components/Calendar/CalendarSlot.vue.d.ts +15 -0
- package/dist/types/components/Calendar/CalendarTitleSelect.vue.d.ts +15 -0
- package/dist/types/components/CalendarGrid/CalendarCell.vue.d.ts +9 -0
- package/dist/types/components/CalendarGrid/CalendarCellPopover.vue.d.ts +209 -0
- package/dist/types/components/CalendarGrid/CalendarDayCell.vue.d.ts +8 -0
- package/dist/types/components/CalendarGrid/CalendarEventDetails.vue.d.ts +15 -0
- package/dist/types/components/CalendarGrid/CalendarEventEdit.vue.d.ts +26 -0
- package/dist/types/components/CalendarGrid/CalendarGrid.vue.d.ts +134 -0
- package/dist/types/components/CalendarGrid/CalendarGridWeek.vue.d.ts +8 -0
- package/dist/types/components/CalendarGrid/CalendarViewSelect.vue.d.ts +3 -0
- package/dist/types/components/CalendarGrid/CalendarWeekCell.vue.d.ts +10 -0
- package/dist/types/components/CalendarGrid/Constraints.d.ts +16 -0
- package/dist/types/components/DatePicker/DatePicker.vue.d.ts +15251 -0
- package/dist/types/components/DatePicker/DatePickerBase.vue.d.ts +3 -0
- package/dist/types/components/DatePicker/DatePickerPopover.vue.d.ts +3 -0
- package/dist/types/components/DatePicker/TimePicker.vue.d.ts +10089 -0
- package/dist/types/components/Popover/Popover.vue.d.ts +72 -0
- package/dist/types/components/Popover/PopoverRow.vue.d.ts +17 -0
- package/dist/types/components/index.d.ts +4 -0
- package/dist/types/index.d.cts +40981 -0
- package/dist/types/index.d.mts +40981 -0
- package/dist/types/index.d.ts +40981 -0
- package/dist/types/use/base.d.ts +67 -0
- package/dist/types/use/calendar.d.ts +2422 -0
- package/dist/types/use/calendarGrid.d.ts +9370 -0
- package/dist/types/use/datePicker.d.ts +20210 -0
- package/dist/types/use/page.d.ts +20 -0
- package/dist/types/use/slots.d.ts +5 -0
- package/dist/types/use/timePicker.d.ts +10089 -0
- package/dist/types/utils/attribute.d.ts +49 -0
- package/dist/types/utils/cache.d.ts +10 -0
- package/dist/types/utils/calendar/event.d.ts +111 -0
- package/dist/types/utils/config/index.d.ts +5 -0
- package/dist/types/utils/date/helpers.d.ts +161 -0
- package/dist/types/utils/date/range.d.ts +74 -0
- package/dist/types/utils/date/repeat.d.ts +34 -0
- package/dist/types/utils/date/rules.d.ts +82 -0
- package/dist/types/utils/defaults/index.d.ts +30 -0
- package/dist/types/utils/defaults/locales.d.ts +9 -0
- package/dist/types/utils/glyph.d.ts +58 -0
- package/dist/types/utils/helpers.d.ts +49 -0
- package/dist/types/utils/locale.d.ts +48 -0
- package/dist/types/utils/page.d.ts +95 -0
- package/dist/types/utils/plugins/index.d.ts +4 -0
- package/dist/types/utils/popovers.d.ts +47 -0
- package/dist/types/utils/theme.d.ts +17 -0
- package/dist/types/utils/touch.d.ts +8 -0
- package/dist/types/utils/useDisplayMode.d.ts +12 -0
- package/dist/types/utils/watchers.d.ts +6 -0
- package/package.json +115 -0
- package/src/components/BaseIcon/BaseIcon.vue +29 -0
- package/src/components/BaseIcon/icons/IconChevronDown.vue +5 -0
- package/src/components/BaseIcon/icons/IconChevronLeft.vue +5 -0
- package/src/components/BaseIcon/icons/IconChevronRight.vue +5 -0
- package/src/components/BaseIcon/icons/IconClock.vue +11 -0
- package/src/components/BaseIcon/icons/index.ts +4 -0
- package/src/components/BaseSelect/BaseSelect.vue +136 -0
- package/src/components/Calendar/Calendar.vue +116 -0
- package/src/components/Calendar/CalendarDay.vue +422 -0
- package/src/components/Calendar/CalendarDayPopover.vue +44 -0
- package/src/components/Calendar/CalendarHeader.vue +203 -0
- package/src/components/Calendar/CalendarNav.vue +325 -0
- package/src/components/Calendar/CalendarNavPopover.vue +24 -0
- package/src/components/Calendar/CalendarPage.vue +140 -0
- package/src/components/Calendar/CalendarPageProvider.vue +15 -0
- package/src/components/Calendar/CalendarSlot.vue +36 -0
- package/src/components/Calendar/CalendarTitleSelect.vue +72 -0
- package/src/components/CalendarGrid/CalendarCell.vue +112 -0
- package/src/components/CalendarGrid/CalendarCellPopover.vue +93 -0
- package/src/components/CalendarGrid/CalendarDayCell.vue +57 -0
- package/src/components/CalendarGrid/CalendarEventDetails.vue +71 -0
- package/src/components/CalendarGrid/CalendarEventEdit.vue +195 -0
- package/src/components/CalendarGrid/CalendarGrid.vue +715 -0
- package/src/components/CalendarGrid/CalendarGridWeek.vue +60 -0
- package/src/components/CalendarGrid/CalendarViewSelect.vue +34 -0
- package/src/components/CalendarGrid/CalendarWeekCell.vue +52 -0
- package/src/components/CalendarGrid/Constraints.ts +40 -0
- package/src/components/DatePicker/DatePicker.vue +27 -0
- package/src/components/DatePicker/DatePickerBase.vue +53 -0
- package/src/components/DatePicker/DatePickerPopover.vue +37 -0
- package/src/components/DatePicker/TimePicker.vue +167 -0
- package/src/components/Popover/Popover.vue +572 -0
- package/src/components/Popover/PopoverRow.vue +94 -0
- package/src/components/index.ts +4 -0
- package/src/index.ts +24 -0
- package/src/styles/index.css +48 -0
- package/src/styles/theme.css +322 -0
- package/src/styles/transitions.css +77 -0
- package/src/use/base.ts +144 -0
- package/src/use/calendar.ts +796 -0
- package/src/use/calendarGrid.ts +954 -0
- package/src/use/datePicker.ts +909 -0
- package/src/use/page.ts +78 -0
- package/src/use/slots.ts +17 -0
- package/src/use/timePicker.ts +194 -0
- package/src/utils/attribute.ts +107 -0
- package/src/utils/cache.ts +30 -0
- package/src/utils/calendar/event.ts +335 -0
- package/src/utils/config/index.ts +11 -0
- package/src/utils/date/helpers.ts +1039 -0
- package/src/utils/date/range.ts +274 -0
- package/src/utils/date/repeat.ts +135 -0
- package/src/utils/date/rules.ts +290 -0
- package/src/utils/defaults/index.ts +77 -0
- package/src/utils/defaults/locales.ts +123 -0
- package/src/utils/defaults/masks.json +15 -0
- package/src/utils/defaults/touch.json +5 -0
- package/src/utils/glyph.ts +305 -0
- package/src/utils/helpers.ts +181 -0
- package/src/utils/locale.ts +275 -0
- package/src/utils/page.ts +608 -0
- package/src/utils/plugins/index.ts +24 -0
- package/src/utils/popovers.ts +216 -0
- package/src/utils/theme.ts +58 -0
- package/src/utils/touch.ts +72 -0
- package/src/utils/useDisplayMode.ts +198 -0
- package/src/utils/watchers.ts +26 -0
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
@import './transitions.css';
|
|
2
|
+
@import './theme.css';
|
|
3
|
+
|
|
4
|
+
.vc-container {
|
|
5
|
+
position: relative;
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
width: max-content;
|
|
8
|
+
height: max-content;
|
|
9
|
+
font-family: var(--vc-font-family);
|
|
10
|
+
color: var(--vc-color);
|
|
11
|
+
background-color: var(--vc-bg);
|
|
12
|
+
-webkit-font-smoothing: antialiased;
|
|
13
|
+
-moz-osx-font-smoothing: grayscale;
|
|
14
|
+
-webkit-tap-highlight-color: transparent;
|
|
15
|
+
&,
|
|
16
|
+
& * {
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
&:focus {
|
|
19
|
+
outline: none;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/* Hides double border within popovers */
|
|
23
|
+
& .vc-container {
|
|
24
|
+
border: none;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.vc-bordered {
|
|
29
|
+
border: 1px solid;
|
|
30
|
+
border-color: var(--vc-border);
|
|
31
|
+
border-radius: var(--vc-rounded-lg);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.vc-expanded {
|
|
35
|
+
min-width: 100%;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.vc-transparent {
|
|
39
|
+
background-color: transparent;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.vc-date-picker-content {
|
|
43
|
+
padding: 0;
|
|
44
|
+
background-color: var(--vc-bg);
|
|
45
|
+
.vc-container {
|
|
46
|
+
border: 0;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--vc-white: #ffffff;
|
|
3
|
+
--vc-black: #000000;
|
|
4
|
+
|
|
5
|
+
--vc-gray-50: #f8fafc;
|
|
6
|
+
--vc-gray-100: #f1f5f9;
|
|
7
|
+
--vc-gray-200: #e2e8f0;
|
|
8
|
+
--vc-gray-300: #cbd5e1;
|
|
9
|
+
--vc-gray-400: #94a3b8;
|
|
10
|
+
--vc-gray-500: #64748b;
|
|
11
|
+
--vc-gray-600: #475569;
|
|
12
|
+
--vc-gray-700: #334155;
|
|
13
|
+
--vc-gray-800: #1e293b;
|
|
14
|
+
--vc-gray-900: #0f172a;
|
|
15
|
+
|
|
16
|
+
--vc-font-family: BlinkMacSystemFont, -apple-system, 'Segoe UI', 'Roboto',
|
|
17
|
+
'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
18
|
+
'Helvetica', 'Arial', sans-serif;
|
|
19
|
+
|
|
20
|
+
--vc-font-normal: 400;
|
|
21
|
+
--vc-font-medium: 500;
|
|
22
|
+
--vc-font-semibold: 600;
|
|
23
|
+
--vc-font-bold: 700;
|
|
24
|
+
|
|
25
|
+
--vc-text-2xs: 10px;
|
|
26
|
+
--vc-text-xs: 12px;
|
|
27
|
+
--vc-text-sm: 14px;
|
|
28
|
+
--vc-text-base: 16px;
|
|
29
|
+
--vc-text-lg: 18px;
|
|
30
|
+
--vc-text-xl: 20px;
|
|
31
|
+
--vc-text-2xl: 24px;
|
|
32
|
+
|
|
33
|
+
--vc-leading-none: 1;
|
|
34
|
+
--vc-leading-tight: 1.25;
|
|
35
|
+
--vc-leading-snug: 1.375;
|
|
36
|
+
--vc-leading-normal: 1.5;
|
|
37
|
+
|
|
38
|
+
--vc-rounded: 0.25rem;
|
|
39
|
+
--vc-rounded-md: 0.375rem;
|
|
40
|
+
--vc-rounded-lg: 0.5rem;
|
|
41
|
+
--vc-rounded-full: 9999px;
|
|
42
|
+
|
|
43
|
+
--vc-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
|
|
44
|
+
--vc-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
|
|
45
|
+
0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
|
46
|
+
--vc-shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
|
|
47
|
+
|
|
48
|
+
--vc-slide-translate: 22px;
|
|
49
|
+
--vc-slide-duration: 0.15s;
|
|
50
|
+
--vc-slide-timing: ease;
|
|
51
|
+
|
|
52
|
+
--vc-day-content-transition: all 0.13s ease-in;
|
|
53
|
+
--vc-weeknumber-offset-inside: 26px;
|
|
54
|
+
--vc-weeknumber-offset-outside: 34px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.vc-gray {
|
|
58
|
+
--vc-accent-50: var(--vc-gray-50);
|
|
59
|
+
--vc-accent-100: var(--vc-gray-100);
|
|
60
|
+
--vc-accent-200: var(--vc-gray-200);
|
|
61
|
+
--vc-accent-300: var(--vc-gray-300);
|
|
62
|
+
--vc-accent-400: var(--vc-gray-400);
|
|
63
|
+
--vc-accent-500: var(--vc-gray-500);
|
|
64
|
+
--vc-accent-600: var(--vc-gray-600);
|
|
65
|
+
--vc-accent-700: var(--vc-gray-700);
|
|
66
|
+
--vc-accent-800: var(--vc-gray-800);
|
|
67
|
+
--vc-accent-900: var(--vc-gray-900);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.vc-red {
|
|
71
|
+
--vc-accent-50: #fef2f2;
|
|
72
|
+
--vc-accent-100: #fee2e2;
|
|
73
|
+
--vc-accent-200: #fecaca;
|
|
74
|
+
--vc-accent-300: #fca5a5;
|
|
75
|
+
--vc-accent-400: #f87171;
|
|
76
|
+
--vc-accent-500: #ef4444;
|
|
77
|
+
--vc-accent-600: #dc2626;
|
|
78
|
+
--vc-accent-700: #b91c1c;
|
|
79
|
+
--vc-accent-800: #991b1b;
|
|
80
|
+
--vc-accent-900: #7f1d1d;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.vc-orange {
|
|
84
|
+
--vc-accent-50: #fff7ed;
|
|
85
|
+
--vc-accent-100: #ffedd5;
|
|
86
|
+
--vc-accent-200: #fed7aa;
|
|
87
|
+
--vc-accent-300: #fdba74;
|
|
88
|
+
--vc-accent-400: #fb923c;
|
|
89
|
+
--vc-accent-500: #f97316;
|
|
90
|
+
--vc-accent-600: #ea580c;
|
|
91
|
+
--vc-accent-700: #c2410c;
|
|
92
|
+
--vc-accent-800: #9a3412;
|
|
93
|
+
--vc-accent-900: #7c2d12;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.vc-yellow {
|
|
97
|
+
--vc-accent-50: #fefce8;
|
|
98
|
+
--vc-accent-100: #fef9c3;
|
|
99
|
+
--vc-accent-200: #fef08a;
|
|
100
|
+
--vc-accent-300: #fde047;
|
|
101
|
+
--vc-accent-400: #facc15;
|
|
102
|
+
--vc-accent-500: #eab308;
|
|
103
|
+
--vc-accent-600: #ca8a04;
|
|
104
|
+
--vc-accent-700: #a16207;
|
|
105
|
+
--vc-accent-800: #854d0e;
|
|
106
|
+
--vc-accent-900: #713f12;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.vc-green {
|
|
110
|
+
--vc-accent-50: #f0fdf4;
|
|
111
|
+
--vc-accent-100: #dcfce7;
|
|
112
|
+
--vc-accent-200: #bbf7d0;
|
|
113
|
+
--vc-accent-300: #86efac;
|
|
114
|
+
--vc-accent-400: #4ade80;
|
|
115
|
+
--vc-accent-500: #22c55e;
|
|
116
|
+
--vc-accent-600: #16a34a;
|
|
117
|
+
--vc-accent-700: #15803d;
|
|
118
|
+
--vc-accent-800: #166534;
|
|
119
|
+
--vc-accent-900: #14532d;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.vc-teal {
|
|
123
|
+
--vc-accent-50: #f0fdfa;
|
|
124
|
+
--vc-accent-100: #ccfbf1;
|
|
125
|
+
--vc-accent-200: #99f6e4;
|
|
126
|
+
--vc-accent-300: #5eead4;
|
|
127
|
+
--vc-accent-400: #2dd4bf;
|
|
128
|
+
--vc-accent-500: #14b8a6;
|
|
129
|
+
--vc-accent-600: #0d9488;
|
|
130
|
+
--vc-accent-700: #0f766e;
|
|
131
|
+
--vc-accent-800: #115e59;
|
|
132
|
+
--vc-accent-900: #134e4a;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.vc-blue {
|
|
136
|
+
--vc-accent-50: #eff6ff;
|
|
137
|
+
--vc-accent-100: #dbeafe;
|
|
138
|
+
--vc-accent-200: #bfdbfe;
|
|
139
|
+
--vc-accent-300: #93c5fd;
|
|
140
|
+
--vc-accent-400: #60a5fa;
|
|
141
|
+
--vc-accent-500: #3b82f6;
|
|
142
|
+
--vc-accent-600: #2563eb;
|
|
143
|
+
--vc-accent-700: #1d4ed8;
|
|
144
|
+
--vc-accent-800: #1e40af;
|
|
145
|
+
--vc-accent-900: #1e3a8a;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.vc-indigo {
|
|
149
|
+
--vc-accent-50: #eef2ff;
|
|
150
|
+
--vc-accent-100: #e0e7ff;
|
|
151
|
+
--vc-accent-200: #c7d2fe;
|
|
152
|
+
--vc-accent-300: #a5b4fc;
|
|
153
|
+
--vc-accent-400: #818cf8;
|
|
154
|
+
--vc-accent-500: #6366f1;
|
|
155
|
+
--vc-accent-600: #4f46e5;
|
|
156
|
+
--vc-accent-700: #4338ca;
|
|
157
|
+
--vc-accent-800: #3730a3;
|
|
158
|
+
--vc-accent-900: #312e81;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.vc-purple {
|
|
162
|
+
--vc-accent-50: #faf5ff;
|
|
163
|
+
--vc-accent-100: #f3e8ff;
|
|
164
|
+
--vc-accent-200: #e9d5ff;
|
|
165
|
+
--vc-accent-300: #d8b4fe;
|
|
166
|
+
--vc-accent-400: #c084fc;
|
|
167
|
+
--vc-accent-500: #a855f7;
|
|
168
|
+
--vc-accent-600: #9333ea;
|
|
169
|
+
--vc-accent-700: #7e22ce;
|
|
170
|
+
--vc-accent-800: #6b21a8;
|
|
171
|
+
--vc-accent-900: #581c87;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.vc-pink {
|
|
175
|
+
--vc-accent-50: #fdf2f8;
|
|
176
|
+
--vc-accent-100: #fce7f3;
|
|
177
|
+
--vc-accent-200: #fbcfe8;
|
|
178
|
+
--vc-accent-300: #f9a8d4;
|
|
179
|
+
--vc-accent-400: #f472b6;
|
|
180
|
+
--vc-accent-500: #ec4899;
|
|
181
|
+
--vc-accent-600: #db2777;
|
|
182
|
+
--vc-accent-700: #be185d;
|
|
183
|
+
--vc-accent-800: #9d174d;
|
|
184
|
+
--vc-accent-900: #831843;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.vc-focus {
|
|
188
|
+
&:focus-within {
|
|
189
|
+
outline: 0;
|
|
190
|
+
box-shadow: var(--vc-focus-ring);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.vc-light {
|
|
195
|
+
/* Base */
|
|
196
|
+
--vc-color: var(--vc-gray-900);
|
|
197
|
+
--vc-bg: var(--vc-white);
|
|
198
|
+
--vc-border: var(--vc-gray-300);
|
|
199
|
+
--vc-hover-bg: hsla(211, 25%, 84%, 0.3);
|
|
200
|
+
--vc-focus-ring: 0 0 0 2px rgb(59, 131, 246, 0.4);
|
|
201
|
+
/* Calendar header */
|
|
202
|
+
--vc-header-arrow-color: var(--vc-gray-500);
|
|
203
|
+
--vc-header-arrow-hover-bg: var(--vc-gray-200);
|
|
204
|
+
--vc-header-title-color: var(--vc-gray-900);
|
|
205
|
+
/* Calendar weekdays */
|
|
206
|
+
--vc-weekday-color: var(--vc-gray-500);
|
|
207
|
+
/* Calendar weeknumbers */
|
|
208
|
+
--vc-weeknumber-color: var(--vc-gray-400);
|
|
209
|
+
/* Calendar nav */
|
|
210
|
+
--vc-nav-hover-bg: var(--vc-gray-200);
|
|
211
|
+
--vc-nav-title-color: var(--vc-gray-900);
|
|
212
|
+
--vc-nav-item-hover-box-shadow: none;
|
|
213
|
+
--vc-nav-item-active-color: var(--vc-white);
|
|
214
|
+
--vc-nav-item-active-bg: var(--vc-accent-500);
|
|
215
|
+
--vc-nav-item-active-box-shadow: var(--vc-shadow);
|
|
216
|
+
--vc-nav-item-current-color: var(--vc-accent-600);
|
|
217
|
+
/* Calendar day popover */
|
|
218
|
+
--vc-day-popover-container-color: var(--vc-white);
|
|
219
|
+
--vc-day-popover-container-bg: var(--vc-gray-800);
|
|
220
|
+
--vc-day-popover-container-border: var(--vc-gray-700);
|
|
221
|
+
--vc-day-popover-header-color: var(--vc-gray-700);
|
|
222
|
+
/* Popover content */
|
|
223
|
+
--vc-popover-content-color: var(--vc-gray-900);
|
|
224
|
+
--vc-popover-content-bg: var(--vc-gray-50);
|
|
225
|
+
--vc-popover-content-border: var(--vc-gray-300);
|
|
226
|
+
/* Time picker */
|
|
227
|
+
--vc-time-picker-border: var(--vc-gray-300);
|
|
228
|
+
--vc-time-weekday-color: var(--vc-gray-700);
|
|
229
|
+
--vc-time-month-color: var(--vc-accent-600);
|
|
230
|
+
--vc-time-day-color: var(--vc-accent-600);
|
|
231
|
+
--vc-time-year-color: var(--vc-gray-500);
|
|
232
|
+
/* Time select group */
|
|
233
|
+
--vc-time-select-group-bg: var(--vc-gray-50);
|
|
234
|
+
--vc-time-select-group-border: var(--vc-gray-300);
|
|
235
|
+
--vc-time-select-group-icon-color: var(--vc-accent-500);
|
|
236
|
+
/* Base select */
|
|
237
|
+
--vc-select-color: var(--vc-gray-900);
|
|
238
|
+
--vc-select-bg: var(--vc-gray-100);
|
|
239
|
+
--vc-select-hover-bg: var(--vc-gray-200);
|
|
240
|
+
/* Calendar day */
|
|
241
|
+
--vc-day-content-hover-bg: var(--vc-hover-bg);
|
|
242
|
+
--vc-day-content-disabled-color: var(--vc-gray-400);
|
|
243
|
+
/* Calendar attributes */
|
|
244
|
+
&.vc-attr,
|
|
245
|
+
& .vc-attr {
|
|
246
|
+
--vc-content-color: var(--vc-accent-600);
|
|
247
|
+
--vc-highlight-outline-bg: var(--vc-white);
|
|
248
|
+
--vc-highlight-outline-border: var(--vc-accent-600);
|
|
249
|
+
--vc-highlight-outline-content-color: var(--vc-accent-700);
|
|
250
|
+
--vc-highlight-light-bg: var(--vc-accent-200);
|
|
251
|
+
--vc-highlight-light-content-color: var(--vc-accent-900);
|
|
252
|
+
--vc-highlight-solid-bg: var(--vc-accent-600);
|
|
253
|
+
--vc-highlight-solid-content-color: var(--vc-white);
|
|
254
|
+
--vc-dot-bg: var(--vc-accent-600);
|
|
255
|
+
--vc-bar-bg: var(--vc-accent-600);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.vc-dark {
|
|
260
|
+
/* Base */
|
|
261
|
+
--vc-color: var(--vc-white);
|
|
262
|
+
--vc-bg: var(--vc-gray-900);
|
|
263
|
+
--vc-border: var(--vc-gray-700);
|
|
264
|
+
--vc-hover-bg: hsla(216, 15%, 52%, 0.3);
|
|
265
|
+
--vc-focus-ring: 0 0 0 2px rgb(59 130 246 / 0.7);
|
|
266
|
+
/* Calendar header */
|
|
267
|
+
--vc-header-arrow-color: var(--vc-gray-300);
|
|
268
|
+
--vc-header-arrow-hover-bg: var(--vc-gray-800);
|
|
269
|
+
--vc-header-title-color: var(--vc-gray-100);
|
|
270
|
+
/* Calendar weekdays */
|
|
271
|
+
--vc-weekday-color: var(--vc-accent-200);
|
|
272
|
+
/* Calendar weeknumbers */
|
|
273
|
+
--vc-weeknumber-color: var(--vc-gray-500);
|
|
274
|
+
/* Calendar nav */
|
|
275
|
+
--vc-nav-hover-bg: var(--vc-gray-700);
|
|
276
|
+
--vc-nav-title-color: var(--vc-gray-100);
|
|
277
|
+
--vc-nav-item-hover-box-shadow: none;
|
|
278
|
+
--vc-nav-item-active-color: var(--vc-white);
|
|
279
|
+
--vc-nav-item-active-bg: var(--vc-accent-500);
|
|
280
|
+
--vc-nav-item-active-box-shadow: none;
|
|
281
|
+
--vc-nav-item-current-color: var(--vc-accent-400);
|
|
282
|
+
/* Calendar day popover */
|
|
283
|
+
--vc-day-popover-container-color: var(--vc-gray-800);
|
|
284
|
+
--vc-day-popover-container-bg: var(--vc-white);
|
|
285
|
+
--vc-day-popover-container-border: var(--vc-gray-100);
|
|
286
|
+
--vc-day-popover-header-color: var(--vc-gray-300);
|
|
287
|
+
/* Popover content */
|
|
288
|
+
--vc-popover-content-color: var(--vc-white);
|
|
289
|
+
--vc-popover-content-bg: var(--vc-gray-800);
|
|
290
|
+
--vc-popover-content-border: var(--vc-gray-700);
|
|
291
|
+
/* Time picker */
|
|
292
|
+
--vc-time-picker-border: var(--vc-gray-700);
|
|
293
|
+
--vc-time-weekday-color: var(--vc-gray-400);
|
|
294
|
+
--vc-time-month-color: var(--vc-accent-400);
|
|
295
|
+
--vc-time-day-color: var(--vc-accent-400);
|
|
296
|
+
--vc-time-year-color: var(--vc-gray-500);
|
|
297
|
+
/* Time select group */
|
|
298
|
+
--vc-time-select-group-bg: var(--vc-gray-700);
|
|
299
|
+
--vc-time-select-group-border: var(--vc-gray-500);
|
|
300
|
+
--vc-time-select-group-icon-color: var(--vc-accent-400);
|
|
301
|
+
/* Base select */
|
|
302
|
+
--vc-select-color: var(--vc-gray-200);
|
|
303
|
+
--vc-select-bg: var(--vc-gray-700);
|
|
304
|
+
--vc-select-hover-bg: var(--vc-gray-600);
|
|
305
|
+
/* Calendar day */
|
|
306
|
+
--vc-day-content-hover-bg: var(--vc-hover-bg);
|
|
307
|
+
--vc-day-content-disabled-color: var(--vc-gray-600);
|
|
308
|
+
/* Calendar attributes */
|
|
309
|
+
&.vc-attr,
|
|
310
|
+
& .vc-attr {
|
|
311
|
+
--vc-content-color: var(--vc-accent-500);
|
|
312
|
+
--vc-highlight-outline-bg: var(--vc-gray-900);
|
|
313
|
+
--vc-highlight-outline-border: var(--vc-accent-300);
|
|
314
|
+
--vc-highlight-outline-content-color: var(--vc-accent-200);
|
|
315
|
+
--vc-highlight-light-bg: var(--vc-accent-800);
|
|
316
|
+
--vc-highlight-light-content-color: var(--vc-accent-100);
|
|
317
|
+
--vc-highlight-solid-bg: var(--vc-accent-500);
|
|
318
|
+
--vc-highlight-solid-content-color: var(--vc-white);
|
|
319
|
+
--vc-dot-bg: var(--vc-accent-500);
|
|
320
|
+
--vc-bar-bg: var(--vc-accent-500);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
.vc-none-enter-active,
|
|
2
|
+
.vc-none-leave-active {
|
|
3
|
+
transition-duration: 0s;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.vc-fade-enter-active,
|
|
7
|
+
.vc-fade-leave-active,
|
|
8
|
+
.vc-slide-left-enter-active,
|
|
9
|
+
.vc-slide-left-leave-active,
|
|
10
|
+
.vc-slide-right-enter-active,
|
|
11
|
+
.vc-slide-right-leave-active,
|
|
12
|
+
.vc-slide-up-enter-active,
|
|
13
|
+
.vc-slide-up-leave-active,
|
|
14
|
+
.vc-slide-down-enter-active,
|
|
15
|
+
.vc-slide-down-leave-active,
|
|
16
|
+
.vc-slide-fade-enter-active,
|
|
17
|
+
.vc-slide-fade-leave-active {
|
|
18
|
+
transition: transform var(--vc-slide-duration) var(--vc-slide-timing),
|
|
19
|
+
opacity var(--vc-slide-duration) var(--vc-slide-timing);
|
|
20
|
+
backface-visibility: hidden;
|
|
21
|
+
pointer-events: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.vc-none-leave-active,
|
|
25
|
+
.vc-fade-leave-active,
|
|
26
|
+
.vc-slide-left-leave-active,
|
|
27
|
+
.vc-slide-right-leave-active,
|
|
28
|
+
.vc-slide-up-leave-active,
|
|
29
|
+
.vc-slide-down-leave-active {
|
|
30
|
+
position: absolute !important;
|
|
31
|
+
width: 100%;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.vc-none-enter-from,
|
|
35
|
+
.vc-none-leave-to,
|
|
36
|
+
.vc-fade-enter-from,
|
|
37
|
+
.vc-fade-leave-to,
|
|
38
|
+
.vc-slide-left-enter-from,
|
|
39
|
+
.vc-slide-left-leave-to,
|
|
40
|
+
.vc-slide-right-enter-from,
|
|
41
|
+
.vc-slide-right-leave-to,
|
|
42
|
+
.vc-slide-up-enter-from,
|
|
43
|
+
.vc-slide-up-leave-to,
|
|
44
|
+
.vc-slide-down-enter-from,
|
|
45
|
+
.vc-slide-down-leave-to,
|
|
46
|
+
.vc-slide-fade-enter-from,
|
|
47
|
+
.vc-slide-fade-leave-to {
|
|
48
|
+
opacity: 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.vc-slide-left-enter-from,
|
|
52
|
+
.vc-slide-right-leave-to,
|
|
53
|
+
.vc-slide-fade-enter-from.direction-left,
|
|
54
|
+
.vc-slide-fade-leave-to.direction-left {
|
|
55
|
+
transform: translateX(var(--vc-slide-translate));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.vc-slide-right-enter-from,
|
|
59
|
+
.vc-slide-left-leave-to,
|
|
60
|
+
.vc-slide-fade-enter-from.direction-right,
|
|
61
|
+
.vc-slide-fade-leave-to.direction-right {
|
|
62
|
+
transform: translateX(calc(-1 * var(--vc-slide-translate)));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.vc-slide-up-enter-from,
|
|
66
|
+
.vc-slide-down-leave-to,
|
|
67
|
+
.vc-slide-fade-enter-from.direction-top,
|
|
68
|
+
.vc-slide-fade-leave-to.direction-top {
|
|
69
|
+
transform: translateY(var(--vc-slide-translate));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.vc-slide-down-enter-from,
|
|
73
|
+
.vc-slide-up-leave-to,
|
|
74
|
+
.vc-slide-fade-enter-from.direction-bottom,
|
|
75
|
+
.vc-slide-fade-leave-to.direction-bottom {
|
|
76
|
+
transform: translateY(calc(-1 * var(--vc-slide-translate)));
|
|
77
|
+
}
|
package/src/use/base.ts
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type ExtractPropTypes,
|
|
3
|
+
type PropType,
|
|
4
|
+
computed,
|
|
5
|
+
inject,
|
|
6
|
+
provide,
|
|
7
|
+
} from 'vue';
|
|
8
|
+
import { Attribute } from '../utils/attribute';
|
|
9
|
+
import { type DayOfWeek, addDays } from '../utils/date/helpers';
|
|
10
|
+
import { getDefault } from '../utils/defaults';
|
|
11
|
+
import { isObject } from '../utils/helpers';
|
|
12
|
+
import { default as Locale, type LocaleConfig } from '../utils/locale';
|
|
13
|
+
import { Theme } from '../utils/theme';
|
|
14
|
+
import {
|
|
15
|
+
type DarkModeClassConfig,
|
|
16
|
+
useDisplayMode,
|
|
17
|
+
} from '../utils/useDisplayMode';
|
|
18
|
+
|
|
19
|
+
const contextKey = Symbol('__vc_base_context__');
|
|
20
|
+
|
|
21
|
+
export const propsDef = {
|
|
22
|
+
color: {
|
|
23
|
+
type: String,
|
|
24
|
+
default: () => getDefault('color'),
|
|
25
|
+
},
|
|
26
|
+
isDark: {
|
|
27
|
+
type: [Boolean, String, Object] as PropType<
|
|
28
|
+
boolean | 'system' | DarkModeClassConfig
|
|
29
|
+
>,
|
|
30
|
+
default: () => getDefault('isDark'),
|
|
31
|
+
},
|
|
32
|
+
firstDayOfWeek: Number as PropType<DayOfWeek>,
|
|
33
|
+
masks: Object,
|
|
34
|
+
locale: [String, Object] as PropType<string | Record<string, any> | Locale>,
|
|
35
|
+
timezone: String,
|
|
36
|
+
minDate: null,
|
|
37
|
+
maxDate: null,
|
|
38
|
+
disabledDates: null,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type BaseProps = Readonly<ExtractPropTypes<typeof propsDef>>;
|
|
42
|
+
|
|
43
|
+
export type BaseContext = ReturnType<typeof createBase>;
|
|
44
|
+
|
|
45
|
+
export function createBase(props: BaseProps) {
|
|
46
|
+
// #region Computed
|
|
47
|
+
|
|
48
|
+
const color = computed(() => props.color ?? '');
|
|
49
|
+
const isDark = computed(() => props.isDark ?? false);
|
|
50
|
+
const { displayMode } = useDisplayMode(isDark);
|
|
51
|
+
const theme = computed(() => new Theme(color.value));
|
|
52
|
+
|
|
53
|
+
const locale = computed(() => {
|
|
54
|
+
// Return the locale prop if it is an instance of the Locale class
|
|
55
|
+
if (props.locale instanceof Locale) return props.locale;
|
|
56
|
+
// Build up a base config from component props
|
|
57
|
+
const config = (
|
|
58
|
+
isObject(props.locale)
|
|
59
|
+
? props.locale
|
|
60
|
+
: {
|
|
61
|
+
id: props.locale,
|
|
62
|
+
firstDayOfWeek: props.firstDayOfWeek,
|
|
63
|
+
masks: props.masks,
|
|
64
|
+
}
|
|
65
|
+
) as Partial<LocaleConfig>;
|
|
66
|
+
// Return new locale
|
|
67
|
+
return new Locale(config, props.timezone);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const masks = computed(() => locale.value.masks);
|
|
71
|
+
|
|
72
|
+
const minDate = computed(() => props.minDate);
|
|
73
|
+
const maxDate = computed(() => props.maxDate);
|
|
74
|
+
const normalizedMinDate = computed(() =>
|
|
75
|
+
minDate.value == null ? null : locale.value.toDateOrNull(minDate.value),
|
|
76
|
+
);
|
|
77
|
+
const normalizedMaxDate = computed(() =>
|
|
78
|
+
maxDate.value == null ? null : locale.value.toDateOrNull(maxDate.value),
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
const disabledDates = computed(() => {
|
|
82
|
+
const dates: any[] = props.disabledDates ? [...props.disabledDates] : [];
|
|
83
|
+
// Add disabled range for min date
|
|
84
|
+
const min = normalizedMinDate.value;
|
|
85
|
+
if (min != null) {
|
|
86
|
+
dates.push({
|
|
87
|
+
start: null,
|
|
88
|
+
end: addDays(min, -1),
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
// Add disabled range for max date
|
|
92
|
+
const max = normalizedMaxDate.value;
|
|
93
|
+
if (max != null) {
|
|
94
|
+
dates.push({
|
|
95
|
+
start: addDays(max, 1),
|
|
96
|
+
end: null,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return locale.value.ranges(dates);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const disabledAttribute = computed(() => {
|
|
103
|
+
return new Attribute(
|
|
104
|
+
{
|
|
105
|
+
key: 'disabled',
|
|
106
|
+
dates: disabledDates.value,
|
|
107
|
+
order: 100,
|
|
108
|
+
},
|
|
109
|
+
theme.value,
|
|
110
|
+
locale.value,
|
|
111
|
+
);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
// #endregion Computed
|
|
115
|
+
|
|
116
|
+
const context = {
|
|
117
|
+
color,
|
|
118
|
+
isDark,
|
|
119
|
+
displayMode,
|
|
120
|
+
theme,
|
|
121
|
+
locale,
|
|
122
|
+
masks,
|
|
123
|
+
minDate,
|
|
124
|
+
maxDate,
|
|
125
|
+
normalizedMinDate,
|
|
126
|
+
normalizedMaxDate,
|
|
127
|
+
disabledDates,
|
|
128
|
+
disabledAttribute,
|
|
129
|
+
};
|
|
130
|
+
provide(contextKey, context);
|
|
131
|
+
return context;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function useBase() {
|
|
135
|
+
const context = inject<BaseContext>(contextKey);
|
|
136
|
+
if (context) return context;
|
|
137
|
+
throw new Error(
|
|
138
|
+
'Base context missing. Please verify this component is nested within a valid context provider.',
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function useOrCreateBase(props: BaseProps) {
|
|
143
|
+
return inject<BaseContext>(contextKey, () => createBase(props), true);
|
|
144
|
+
}
|