@shival99/z-ui 1.9.5 → 1.9.7

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.
@@ -119,9 +119,18 @@ const computeRangeProperties = (date, rangeStart, rangeEnd, hoveredDate) => {
119
119
  return defaultProps;
120
120
  };
121
121
  const createCalendarDay = (date, isCurrentMonth, today, options) => {
122
- const { selectedDate, minDate, maxDate, rangeStart, rangeEnd, hoveredDate, disabledDate } = options;
122
+ const { selectedDate, minDate, maxDate, rangeStart, rangeEnd, hoveredDate, disabledDate, suppressOtherMonthRangeState, } = options;
123
+ const shouldSuppressRangeState = !isCurrentMonth && !!suppressOtherMonthRangeState;
123
124
  const isSelected = selectedDate ? isSameDay(date, selectedDate) : false;
124
- const rangeProps = computeRangeProperties(date, rangeStart, rangeEnd, hoveredDate);
125
+ let rangeProps = computeRangeProperties(date, rangeStart, rangeEnd, hoveredDate);
126
+ if (shouldSuppressRangeState) {
127
+ rangeProps = {
128
+ isRangeStart: false,
129
+ isRangeEnd: false,
130
+ isInRange: false,
131
+ isHovered: false,
132
+ };
133
+ }
125
134
  const isOutOfRange = !isDateInRange(date, minDate ?? null, maxDate ?? null);
126
135
  const isDisabledByFn = disabledDate ? disabledDate(date) : false;
127
136
  return {
@@ -493,7 +502,7 @@ const zCalendarDayVariants = cva([
493
502
  rangeStart: 'bg-primary text-primary-foreground rounded-r-none',
494
503
  rangeEnd: 'bg-primary text-primary-foreground rounded-l-none',
495
504
  rangeSingle: 'bg-primary text-primary-foreground',
496
- disabled: 'text-muted-foreground/50 cursor-not-allowed line-through',
505
+ disabled: 'text-muted-foreground/50 cursor-not-allowed',
497
506
  otherMonth: 'text-muted-foreground/40 hover:bg-primary/5',
498
507
  hovered: 'bg-primary/15 text-foreground',
499
508
  },
@@ -1150,6 +1159,7 @@ class ZCalendarComponent {
1150
1159
  minDate: this.zMinDate(),
1151
1160
  maxDate: this.zMaxDate(),
1152
1161
  disabledDate: this.zDisabledDate(),
1162
+ suppressOtherMonthRangeState: this.isRangeMode(),
1153
1163
  });
1154
1164
  }, ...(ngDevMode ? [{ debugName: "calendarDays" }] : []));
1155
1165
  endMonth = this._endMonth.asReadonly();
@@ -1170,6 +1180,7 @@ class ZCalendarComponent {
1170
1180
  minDate: this.zMinDate(),
1171
1181
  maxDate: this.zMaxDate(),
1172
1182
  disabledDate: this.zDisabledDate(),
1183
+ suppressOtherMonthRangeState: this.isRangeMode(),
1173
1184
  });
1174
1185
  }, ...(ngDevMode ? [{ debugName: "calendarDaysEnd" }] : []));
1175
1186
  formattedHourEnd = computed(() => formatTimeValue(this.zTimeFormat() === '12h' ? this._hourEnd() % 12 || 12 : this._hourEnd()), ...(ngDevMode ? [{ debugName: "formattedHourEnd" }] : []));