@internetstiftelsen/styleguide
Advanced tools
Comparing version 1.10.7 to 1.10.8
'use strict'; | ||
require('./atoms/password-toggle/password-toggle'); | ||
require('./utilities/tab-highlighting/tab-highlighting'); | ||
require('./molecules/system-error/system-error'); | ||
require('a11y-toggle'); | ||
require('./vendor/toggle/a11y.toggle-switcher'); | ||
require('./molecules/cookie-disclaimer/cookie-disclaimer'); | ||
require('./organisms/accordion/accordion'); | ||
require('./organisms/tabs/tabs'); | ||
require('./organisms/mailchimp/mailchimp'); | ||
require('./organisms/domain-search/domain-search'); | ||
require('./organisms/mega-menu/mega-menu'); | ||
require('./molecules/share/share'); | ||
require('./atoms/tooltip/tooltip'); | ||
require('./atoms/toggle-high-contrast/toggle-high-contrast'); | ||
require('./molecules/context-menu/context-menu'); | ||
require('./atoms/password-toggle/password-toggle'); | ||
require('./molecules/modal/modal'); | ||
require('./focusTrap'); |
'use strict'; | ||
var createFocusTrap = require('focus-trap'); | ||
var _focusTrap = require('focus-trap'); | ||
var _focusTrap2 = _interopRequireDefault(_focusTrap); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
@@ -13,5 +18,9 @@ * Collect the needed elements. | ||
var footer = document.getElementById('siteFooter'); | ||
var focusTrap = createFocusTrap(megaMenu); | ||
var isIE11 = !!window.MSInputMethodContext && !!document.documentMode; | ||
var focusTrap = null; | ||
if (megaMenu) { | ||
focusTrap = (0, _focusTrap2.default)(megaMenu); | ||
} | ||
/** | ||
@@ -137,14 +146,16 @@ * Check if the element is in the viewport | ||
function hideMegaMenu() { | ||
if (megaMenu.getAttribute('aria-hidden') === 'true') { | ||
return; | ||
} | ||
if (megaMenu) { | ||
if (megaMenu.getAttribute('aria-hidden') === 'true') { | ||
return; | ||
} | ||
prepareOutAnimation(); | ||
prepareOutAnimation(); | ||
setTimeout(function () { | ||
requestAnimationFrame(animateOut); | ||
if (html.classList.contains('tab-highlight')) { | ||
focusTrap.deactivate(); | ||
} | ||
}, 50); | ||
setTimeout(function () { | ||
requestAnimationFrame(animateOut); | ||
if (html.classList.contains('tab-highlight')) { | ||
focusTrap.deactivate(); | ||
} | ||
}, 50); | ||
} | ||
} | ||
@@ -184,9 +195,13 @@ | ||
function handleMouseUp(e) { | ||
var button = e.target.closest('.js-toggle-domain-search'); | ||
if (button && megaMenu.getAttribute('aria-hidden') === 'false') { | ||
hideMegaMenu(); | ||
} | ||
} | ||
if (megaMenuButton && megaMenu) { | ||
megaMenuButton.addEventListener('click', toggleMegaMenu); | ||
} | ||
module.exports = { | ||
show: showMegaMenu, | ||
hide: hideMegaMenu | ||
}; | ||
document.addEventListener('mouseup', handleMouseUp); | ||
} |
{ | ||
"name": "@internetstiftelsen/styleguide", | ||
"version": "1.10.7", | ||
"version": "1.10.8", | ||
"main": "dist/components.js", | ||
@@ -30,3 +30,3 @@ "ports": { | ||
"watch:js": "onchange 'src/**/*.js' -- npm run build:js", | ||
"watch:icons": "onchange 'src/atoms/icon/*.svg' -- npm run create-icons-config", | ||
"watch:icons": "onchange 'src/atoms/icon/*.svg' -- npm run create-icons-config", | ||
"watch": "concurrently \"npm:watch:css\" \"npm:watch:js\" \"npm:watch:icons\"", | ||
@@ -44,6 +44,6 @@ "copy:images": "copyfiles -f src/assets/images/* public/assets/images", | ||
"package-js": "NODE_ENV=production babel src --out-dir dist --ignore src/**/*.config.js,src/app.js", | ||
"create-icons-config": "node ./createIconsJson" | ||
"create-icons-config": "node ./createIconsJson" | ||
}, | ||
"devDependencies": { | ||
"@frctl/fractal": "^1.2.1", | ||
"@frctl/fractal": "^1.3.0", | ||
"@frctl/mandelbrot": "^1.3.0", | ||
@@ -50,0 +50,0 @@ "@internetstiftelsen/eslint-config": "0.0.2", |
@@ -10,2 +10,3 @@ import createFocusTrap from 'focus-trap'; | ||
container.focusTrap = createFocusTrap(`#${container.id}`, { clickOutsideDeactivates: true }); | ||
container.setAttribute('data-focus-trap', 'true'); | ||
} | ||
@@ -83,17 +84,3 @@ } | ||
function handleMouseUp(e) { | ||
const button = e.target.closest('[data-a11y-toggle]'); | ||
const containers = document.querySelectorAll('[data-container]'); | ||
[].forEach.call(containers, (container) => { | ||
const id = (button) ? button.getAttribute('data-a11y-toggle') : ''; | ||
if (container.getAttribute('aria-hidden') === 'false' && container.id !== id) { | ||
window.a11yToggle(container); | ||
} | ||
}); | ||
} | ||
document.addEventListener('click', delegate.bind(null, handleFocusTrap)); | ||
document.addEventListener('keydown', delegate.bind(null, handleKeyDown), { once: true }); | ||
document.addEventListener('mouseup', handleMouseUp); |
module.exports = { | ||
status: 'wip', | ||
status: 'ready', | ||
context: { | ||
title: 'Du har sparat FooCoding Graduation!', | ||
text: 'En påminnelse kommer skickas till din adress <a href="#" class="u-link">15 minuter</a> innan streamen startar.', | ||
text: 'En påminnelse kommer skickas till din adress <a href="https://internetstiftelsen.se/om-webbplatsen/integritetspolicy-for-besokare-pa-internetstiftelsens-webbplatser/" class="u-link">15 minuter</a> innan streamen startar.', | ||
button_text: 'Stäng', | ||
@@ -21,3 +21,3 @@ aria_controls: '', | ||
check_text: 'Prenumerera på våra lokala nyhetsbrev:', | ||
terms_text: 'Jag godkänner Goto 10:s <a href="#" class="u-link">medlemsvillkor</a> och <a href="#" class="u-link">integritetspolicy</a>.', | ||
terms_text: 'Jag godkänner Goto 10:s <a href="#" class="u-link">medlemsvillkor</a> och <a href="https://internetstiftelsen.se/om-webbplatsen/integritetspolicy-for-besokare-pa-internetstiftelsens-webbplatser/" class="u-link">integritetspolicy</a>.', | ||
bottom_text: 'Har du redan ett konto? <a href="#" class="u-link">Logga in</a>' | ||
@@ -24,0 +24,0 @@ } |
module.exports = { | ||
status: "wip", | ||
status: 'ready', | ||
title: 'Features box', | ||
@@ -4,0 +4,0 @@ context: { |
module.exports = { | ||
status: 'wip', | ||
status: 'ready', | ||
@@ -4,0 +4,0 @@ context: { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
31692869
440
9691