vueless 0.0.216 → 0.0.217

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vueless",
3
- "version": "0.0.216",
3
+ "version": "0.0.217",
4
4
  "license": "MIT",
5
5
  "description": "Vue Styleless Component Framework.",
6
6
  "homepage": "https://vueless.com",
@@ -17,7 +17,7 @@
17
17
  <script setup>
18
18
  import { computed } from "vue";
19
19
  import { formatDate, dateIsOutOfRange } from "../services/calendar.service";
20
- import { isSameMonth, getDateWithoutTime } from "../services/date.service";
20
+ import { isSameMonth, getDateWithoutTime, isCurrentMoth } from "../services/date.service";
21
21
 
22
22
  import useAttrs from "../composables/attrs.composable";
23
23
 
@@ -69,7 +69,8 @@ const props = defineProps({
69
69
 
70
70
  const emit = defineEmits(["input"]);
71
71
 
72
- const { monthViewAttrs, selectedMonthAttrs, activeMonthAttrs, monthAttrs } = useAttrs(props);
72
+ const { monthViewAttrs, selectedMonthAttrs, activeMonthAttrs, monthAttrs, currentMothAttrs } =
73
+ useAttrs(props);
73
74
 
74
75
  const localSelectedDate = computed(() => {
75
76
  return props.selectedDate === null ? getDateWithoutTime() : props.selectedDate;
@@ -98,12 +99,19 @@ function getMonth(monthNumber) {
98
99
  return newDate;
99
100
  }
100
101
 
101
- function getMonthClasses(day) {
102
- if (isSelectedMonth(day)) {
102
+ function getMonthClasses(month) {
103
+ const isNotSelectedDate =
104
+ (!isSelectedMonth(month) && !isSelectedMonth(month)) || props.selectedDate === null;
105
+
106
+ if (isCurrentMoth(month) && isNotSelectedDate) {
107
+ return [currentMothAttrs.value.class];
108
+ }
109
+
110
+ if (isSelectedMonth(month)) {
103
111
  return [selectedMonthAttrs.value.class];
104
112
  }
105
113
 
106
- if (isSameMonth(props.activeMonth, day)) {
114
+ if (isSameMonth(props.activeMonth, month)) {
107
115
  return [activeMonthAttrs.value.class];
108
116
  }
109
117
  }
@@ -17,7 +17,7 @@
17
17
  <script setup>
18
18
  import { computed } from "vue";
19
19
  import { formatDate, getYearsRange, dateIsOutOfRange } from "../services/calendar.service";
20
- import { isSameMonth, getDateWithoutTime } from "../services/date.service";
20
+ import { isSameMonth, getDateWithoutTime, isCurrentYear } from "../services/date.service";
21
21
 
22
22
  import useAttrs from "../composables/attrs.composable";
23
23
 
@@ -69,7 +69,8 @@ const props = defineProps({
69
69
 
70
70
  const emit = defineEmits(["input"]);
71
71
 
72
- const { yearViewAttrs, selectedYearAttrs, activeYearAttrs, yearAttrs } = useAttrs(props);
72
+ const { yearViewAttrs, selectedYearAttrs, activeYearAttrs, yearAttrs, currentYearAttrs } =
73
+ useAttrs(props);
73
74
 
74
75
  const localSelectedDate = computed(() => {
75
76
  return props.selectedDate === null ? getDateWithoutTime() : props.selectedDate;
@@ -102,12 +103,19 @@ function getYear(year) {
102
103
  return newDate;
103
104
  }
104
105
 
105
- function getYearClasses(day) {
106
- if (isSelectedMonth(day)) {
106
+ function getYearClasses(year) {
107
+ const isNotSelectedDate =
108
+ (!isSelectedMonth(year) && !isSelectedMonth(year)) || props.selectedDate === null;
109
+
110
+ if (isCurrentYear(year) && isNotSelectedDate) {
111
+ return [currentYearAttrs.value.class];
112
+ }
113
+
114
+ if (isSelectedMonth(year)) {
107
115
  return [selectedYearAttrs.value.class];
108
116
  }
109
117
 
110
- if (isSameMonth(props.activeMonth, day)) {
118
+ if (isSameMonth(props.activeMonth, year)) {
111
119
  return [activeYearAttrs.value.class];
112
120
  }
113
121
  }
@@ -35,8 +35,10 @@ export default /*tw*/ {
35
35
  month: "{UButton} mx-auto flex h-12 w-full rounded-lg hover:!bg-brand-900 hover:text-white",
36
36
  selectedMonth: "bg-brand-900 hover:bg-brand-900 text-white",
37
37
  activeMonth: "bg-brand-100",
38
+ currentMoth: "border-2 border-brand-900",
38
39
  yearView: "grid grid-cols-4 items-center justify-center",
39
40
  year: "{UButton} mx-auto flex h-12 w-full rounded-lg hover:!bg-brand-900 hover:text-white",
41
+ currentYear: "border-2 border-brand-900",
40
42
  selectedYear: "bg-brand-900 hover:bg-brand-900 text-white",
41
43
  activeYear: "bg-brand-100",
42
44
  timepicker: "mt-2 pl-1 pt-3 text-sm flex items-center justify-between gap-2 border-t border-brand-200",
@@ -255,6 +255,14 @@ export function isToday(date) {
255
255
  return isSameDay(date, new Date());
256
256
  }
257
257
 
258
+ export function isCurrentMoth(date) {
259
+ return isSameMonth(date, new Date());
260
+ }
261
+
262
+ export function isCurrentYear(date) {
263
+ return date.getFullYear() === new Date().getFullYear();
264
+ }
265
+
258
266
  export function getLastDayOfMonth(date) {
259
267
  return new Date(date.getFullYear(), date.getMonth() + 1, 0);
260
268
  }
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "framework": "vue",
3
3
  "name": "vueless",
4
- "version": "0.0.216",
4
+ "version": "0.0.217",
5
5
  "contributions": {
6
6
  "html": {
7
7
  "description-markup": "markdown",