-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(deps): update deps and use [email protected]
- Loading branch information
Showing
34 changed files
with
3,738 additions
and
491 deletions.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,67 @@ | ||
(function () { | ||
(() => { | ||
"use strict"; | ||
|
||
// Toggle switch component | ||
var switches = document.querySelectorAll('[role="switch"]'); | ||
|
||
switches.forEach(function (el) { | ||
el.addEventListener('click', function () { | ||
var checked = this.getAttribute('aria-checked') === 'true' || false; | ||
const switches = document.querySelectorAll('[role="switch"]'); | ||
switches.forEach(el => { | ||
el.addEventListener('click', () => { | ||
const checked = this.getAttribute('aria-checked') === 'true' || false; | ||
this.setAttribute('aria-checked', !checked); | ||
|
||
if (this.classList.contains('disable-css')) { | ||
var chart = this.parentNode.nextElementSibling; | ||
const chart = this.parentNode.nextElementSibling; | ||
chart.classList.toggle('chaarts'); | ||
} | ||
}); | ||
}); | ||
|
||
// Scrollable tables | ||
var regions = document.querySelectorAll('.table-container'); | ||
|
||
const regions = document.querySelectorAll('.table-container'); | ||
if (window.matchMedia('(min-width: 30em)').matches) { | ||
regions.forEach(function (el) { | ||
var width = el.offsetWidth; | ||
var table = el.querySelector('table'); | ||
regions.forEach(el => { | ||
const width = el.offsetWidth; | ||
const table = el.querySelector('table'); | ||
|
||
if (table.offsetWidth > width) { | ||
el.setAttribute('tabindex', '0'); | ||
} | ||
}); | ||
} | ||
|
||
// Toggles | ||
const toggles = document.querySelectorAll('.toggle'); | ||
toggles.forEach(toggle => { | ||
const buttons = toggle.querySelectorAll('button'); | ||
buttons.forEach(button => { | ||
button.addEventListener('click', () => { | ||
for (let button of buttons) { | ||
button.setAttribute('aria-pressed', 'false'); | ||
} | ||
button.setAttribute('aria-pressed', 'true'); | ||
}); | ||
}); | ||
}); | ||
|
||
// Dark mode | ||
const switcher = document.getElementById('theme'); | ||
const options = switcher.querySelectorAll('button'); | ||
//// Start with user preference | ||
const prefersDarkScheme = window.matchMedia('(prefers-color-scheme: dark)'); | ||
document.documentElement.dataset.theme = (prefersDarkScheme.matches) ? 'dark' : 'light'; | ||
//// Then check for localStorage | ||
const currentTheme = localStorage.getItem('theme'); | ||
document.documentElement.dataset.theme = (currentTheme === 'dark') ? 'dark' : 'light'; | ||
//// Apply expected theme | ||
if (document.documentElement.dataset.theme === 'dark') { | ||
document.querySelector('[data-scheme="dark"]').setAttribute('aria-pressed', 'true'); | ||
} else { | ||
document.querySelector('[data-scheme="light"]').setAttribute('aria-pressed', 'true'); | ||
} | ||
//// Finally handle overriding through buttons | ||
options.forEach(option => { | ||
option.addEventListener('click', () => { | ||
document.documentElement.dataset.theme = option.dataset.scheme; | ||
localStorage.setItem('theme', option.dataset.scheme); | ||
}); | ||
}); | ||
})(document); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.