Skip to content

Commit

Permalink
feat(datepicker): add disabled dates styles
Browse files Browse the repository at this point in the history
  • Loading branch information
zoltanszogyenyi committed Jun 11, 2024
1 parent 658b8cc commit 802fe4c
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 13 deletions.
2 changes: 1 addition & 1 deletion demo/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html class="dark" dir="rtl">
<html class="">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
Expand Down
6 changes: 4 additions & 2 deletions dist/js/datepicker-full.js
Original file line number Diff line number Diff line change
Expand Up @@ -998,10 +998,12 @@
classList.add('today', 'bg-gray-100', 'dark:bg-gray-600');
}
if (current < this.minDate || current > this.maxDate || this.disabled.includes(current)) {
classList.add('disabled', 'cursor-not-allowed');
classList.add('disabled', 'cursor-not-allowed', 'text-gray-400', 'dark:text-gray-500');
classList.remove('hover:bg-gray-100', 'dark:hover:bg-gray-600', 'text-gray-900', 'dark:text-white', 'cursor-pointer');
}
if (this.daysOfWeekDisabled.includes(day)) {
classList.add('disabled', 'cursor-not-allowed');
classList.add('disabled', 'cursor-not-allowed', 'text-gray-400', 'dark:text-gray-500');
classList.remove('hover:bg-gray-100', 'dark:hover:bg-gray-600', 'text-gray-900', 'dark:text-white', 'cursor-pointer');
pushUnique(this.disabled, current);
}
if (this.daysOfWeekHighlighted.includes(day)) {
Expand Down
6 changes: 4 additions & 2 deletions dist/js/datepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -998,10 +998,12 @@ var Datepicker = (function () {
classList.add('today', 'bg-gray-100', 'dark:bg-gray-600');
}
if (current < this.minDate || current > this.maxDate || this.disabled.includes(current)) {
classList.add('disabled', 'cursor-not-allowed');
classList.add('disabled', 'cursor-not-allowed', 'text-gray-400', 'dark:text-gray-500');
classList.remove('hover:bg-gray-100', 'dark:hover:bg-gray-600', 'text-gray-900', 'dark:text-white', 'cursor-pointer');
}
if (this.daysOfWeekDisabled.includes(day)) {
classList.add('disabled', 'cursor-not-allowed');
classList.add('disabled', 'cursor-not-allowed', 'text-gray-400', 'dark:text-gray-500');
classList.remove('hover:bg-gray-100', 'dark:hover:bg-gray-600', 'text-gray-900', 'dark:text-white', 'cursor-pointer');
pushUnique(this.disabled, current);
}
if (this.daysOfWeekHighlighted.includes(day)) {
Expand Down
6 changes: 4 additions & 2 deletions js/picker/views/DaysView.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,12 @@ export default class DaysView extends View {
classList.add('today', 'bg-gray-100', 'dark:bg-gray-600');
}
if (current < this.minDate || current > this.maxDate || this.disabled.includes(current)) {
classList.add('disabled', 'cursor-not-allowed');
classList.add('disabled', 'cursor-not-allowed', 'text-gray-400', 'dark:text-gray-500');
classList.remove('hover:bg-gray-100', 'dark:hover:bg-gray-600', 'text-gray-900', 'dark:text-white', 'cursor-pointer');
}
if (this.daysOfWeekDisabled.includes(day)) {
classList.add('disabled', 'cursor-not-allowed');
classList.add('disabled', 'cursor-not-allowed', 'text-gray-400', 'dark:text-gray-500');
classList.remove('hover:bg-gray-100', 'dark:hover:bg-gray-600', 'text-gray-900', 'dark:text-white', 'cursor-pointer');
pushUnique(this.disabled, current);
}
if (this.daysOfWeekHighlighted.includes(day)) {
Expand Down
81 changes: 75 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 802fe4c

Please sign in to comment.