From 3cdd0a572703c5d430c00e8830b141113351cfe0 Mon Sep 17 00:00:00 2001 From: William Almnes Date: Thu, 15 Mar 2018 11:25:23 +0100 Subject: [PATCH] Add missing dependency in toggle (#4) * add ReactDOM to core-toggle * fix minor spacing issue * run build --- bundle/jsx/index.js | 2 +- bundle/jsx/index.js.map | 2 +- packages/core-toggle/core-toggle.jsx | 3 ++- packages/core-toggle/jsx/index.js | 2 +- packages/core-toggle/jsx/index.js.map | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/bundle/jsx/index.js b/bundle/jsx/index.js index beaa7199..5ba096ba 100644 --- a/bundle/jsx/index.js +++ b/bundle/jsx/index.js @@ -1,2 +1,2 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e(t.Components={},t.React)}(this,function(t,e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var n="undefined"!=typeof window&&/(android)/i.test(window.navigator.userAgent),o='a,button,input,select,textarea,iframe,[tabindex],[contenteditable="true"]';function r(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];return e.filter(Boolean).forEach(function(e){Object.keys(e).forEach(function(n){return t[n]=e[n]})}),t}function i(t,e){var n=u(t),o="true"===t.getAttribute("aria-expanded"),r="boolean"==typeof e?e:"toggle"===e?!o:o,i=o===r||function(t,e,n){void 0===n&&(n={});return t.dispatchEvent(new a(e,{bubbles:!0,cancelable:!0,detail:n}))}(t,"toggle",{relatedTarget:n,isOpen:o})?r:o;return n[i?"removeAttribute":"setAttribute"]("hidden",""),t.setAttribute("aria-expanded",i),i}function u(t,e,o){var r=t.getAttribute("aria-controls")||t.getAttribute("aria-owns")||t.getAttribute("list"),i=o||document.getElementById(r)||t.nextElementSibling,u=n?"data":"aria";if(!i)throw new Error("missing nextElementSibling on "+t.outerHTML);return e&&(t.setAttribute("aria-"+e,i.id=i.id||p()),i.setAttribute(u+"-labelledby",t.id=t.id||p())),i}var a=function(){if("undefined"!=typeof window)return"function"==typeof window.CustomEvent?window.CustomEvent:(t.prototype=window.Event.prototype,t);function t(t,e){void 0===e&&(e={});var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,Boolean(e.bubbles),Boolean(e.cancelable),e.detail),n}}();function p(t,e){return Date.now().toString(36)+Math.random().toString(36).slice(2,5)}function d(t,e){return void 0===e&&(e=document),":focusable"===t?d(o,e).filter(function(t){return!t.disabled&&function(t){return t.offsetWidth&&t.offsetHeight&&"hidden"!==window.getComputedStyle(t).getPropertyValue("visibility")}(t)}):"string"==typeof t?d(e.querySelectorAll(t)):t.length?[].slice.call(t):t.nodeType?[t]:[]}var c,l,f,s="data-@nrk/core-toggle-1.0.0".replace(/\W+/g,"-"),b="aria-expanded",g="aria-haspopup",v=function(t){return"boolean"==typeof t};function y(t,e){var n="object"==typeof e?e:{open:e},o=d(t);return o.forEach(function(t){var e=v(n.open)?n.open:"true"===t.getAttribute(b),o=v(n.popup)?n.popup:"true"===t.getAttribute(g);t.setAttribute(s,""),t.setAttribute(g,o),u(t,"controls"),i(t,e)}),o}function h(t){y(ReactDOM.findDOMNode(t).firstElementChild)}c=s,l="click",f=function(t){var e=t.target;d("["+s+"]").forEach(function(t){var n="true"===t.getAttribute(b),o="true"===t.getAttribute(g);t.contains(e)?y(t,!n):o&&y(t,u(t).contains(e))})},"undefined"==typeof window||window[c+"-"+l]||document.addEventListener(l,f,window[c+"-"+l]=!0);var m=function(t){function n(){t.apply(this,arguments)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.componentDidMount=function(){h(this)},n.prototype.componentDidUpdate=function(){h(this)},n.prototype.render=function(){var t=this;return e.createElement("div",r({},this.props,{open:null,popup:null}),e.Children.map(this.props.children,function(e,n){return r({},e,{props:r({},e.props,n?{hidden:!t.props.open}:{"aria-expanded":String(Boolean(t.props.open)),"aria-haspopup":String(Boolean(t.props.popup))})})}))},n}(e.Component);t.Toggle=m,t.Input=function(){return e.createElement("div",null,"Testing input")},Object.defineProperty(t,"__esModule",{value:!0})}); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["exports","react","react-dom"],e):e(t.Components={},t.React,t.ReactDOM)}(this,function(t,e,n){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e,n=n&&n.hasOwnProperty("default")?n.default:n;var o="undefined"!=typeof window&&/(android)/i.test(window.navigator.userAgent),r='a,button,input,select,textarea,iframe,[tabindex],[contenteditable="true"]';function i(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];return e.filter(Boolean).forEach(function(e){Object.keys(e).forEach(function(n){return t[n]=e[n]})}),t}function u(t,e){var n=a(t),o="true"===t.getAttribute("aria-expanded"),r="boolean"==typeof e?e:"toggle"===e?!o:o,i=o===r||function(t,e,n){void 0===n&&(n={});return t.dispatchEvent(new p(e,{bubbles:!0,cancelable:!0,detail:n}))}(t,"toggle",{relatedTarget:n,isOpen:o})?r:o;return n[i?"removeAttribute":"setAttribute"]("hidden",""),t.setAttribute("aria-expanded",i),i}function a(t,e,n){var r=t.getAttribute("aria-controls")||t.getAttribute("aria-owns")||t.getAttribute("list"),i=n||document.getElementById(r)||t.nextElementSibling,u=o?"data":"aria";if(!i)throw new Error("missing nextElementSibling on "+t.outerHTML);return e&&(t.setAttribute("aria-"+e,i.id=i.id||d()),i.setAttribute(u+"-labelledby",t.id=t.id||d())),i}var p=function(){if("undefined"!=typeof window)return"function"==typeof window.CustomEvent?window.CustomEvent:(t.prototype=window.Event.prototype,t);function t(t,e){void 0===e&&(e={});var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,Boolean(e.bubbles),Boolean(e.cancelable),e.detail),n}}();function d(t,e){return Date.now().toString(36)+Math.random().toString(36).slice(2,5)}function c(t,e){return void 0===e&&(e=document),":focusable"===t?c(r,e).filter(function(t){return!t.disabled&&function(t){return t.offsetWidth&&t.offsetHeight&&"hidden"!==window.getComputedStyle(t).getPropertyValue("visibility")}(t)}):"string"==typeof t?c(e.querySelectorAll(t)):t.length?[].slice.call(t):t.nodeType?[t]:[]}var l,f,s,b="data-@nrk/core-toggle-1.0.0".replace(/\W+/g,"-"),g="aria-expanded",y="aria-haspopup",v=function(t){return"boolean"==typeof t};function h(t,e){var n="object"==typeof e?e:{open:e},o=c(t);return o.forEach(function(t){var e=v(n.open)?n.open:"true"===t.getAttribute(g),o=v(n.popup)?n.popup:"true"===t.getAttribute(y);t.setAttribute(b,""),t.setAttribute(y,o),a(t,"controls"),u(t,e)}),o}function m(t){h(n.findDOMNode(t).firstElementChild)}l=b,f="click",s=function(t){var e=t.target;c("["+b+"]").forEach(function(t){var n="true"===t.getAttribute(g),o="true"===t.getAttribute(y);t.contains(e)?h(t,!n):o&&h(t,a(t).contains(e))})},"undefined"==typeof window||window[l+"-"+f]||document.addEventListener(f,s,window[l+"-"+f]=!0);var w=function(t){function n(){t.apply(this,arguments)}return t&&(n.__proto__=t),n.prototype=Object.create(t&&t.prototype),n.prototype.constructor=n,n.prototype.componentDidMount=function(){m(this)},n.prototype.componentDidUpdate=function(){m(this)},n.prototype.render=function(){var t=this;return e.createElement("div",i({},this.props,{open:null,popup:null}),e.Children.map(this.props.children,function(e,n){return i({},e,{props:i({},e.props,n?{hidden:!t.props.open}:{"aria-expanded":String(Boolean(t.props.open)),"aria-haspopup":String(Boolean(t.props.popup))})})}))},n}(e.Component);t.Toggle=w,t.Input=function(){return e.createElement("div",null,"Testing input")},Object.defineProperty(t,"__esModule",{value:!0})}); //# sourceMappingURL=index.js.map diff --git a/bundle/jsx/index.js.map b/bundle/jsx/index.js.map index 416bba5e..ed66d0cd 100644 --- a/bundle/jsx/index.js.map +++ b/bundle/jsx/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sources":["../../packages/utils.js","../../packages/core-toggle/core-toggle.js","../../packages/core-toggle/core-toggle.jsx","../../packages/core-input/core-input.jsx"],"sourcesContent":["const IS_ANDROID = typeof window !== 'undefined' && /(android)/i.test(window.navigator.userAgent) // Bad, but needed\nconst FOCUSABLE = 'a,button,input,select,textarea,iframe,[tabindex],[contenteditable=\"true\"]'\n\n/**\n* assign\n* @param {Object} target The target object\n* @param {Object} sources The source object(s)\n* @return {Object} The target object\n*/\nexport function assign (target, ...sources) {\n sources.filter(Boolean).forEach((source) => {\n Object.keys(source).forEach((key) => (target[key] = source[key]))\n })\n return target\n}\n\n/**\n* addEvent\n* @param {String} uuid An unique ID of the event to bind - ensurnes single instance\n* @param {String} type The type of event to bind\n* @param {Function} handler The function to call on event\n*/\nexport function addEvent (uuid, type, handler) {\n if (typeof window === 'undefined' || window[`${uuid}-${type}`]) return // Ensure single instance\n document.addEventListener(type, handler, window[`${uuid}-${type}`] = true) // Use capture for old Firefox\n}\n\nexport function ariaExpand (master, open) {\n const relatedTarget = ariaTarget(master)\n const prevState = master.getAttribute('aria-expanded') === 'true'\n const wantState = typeof open === 'boolean' ? open : (open === 'toggle' ? !prevState : prevState)\n const canUpdate = prevState === wantState || dispatchEvent(master, 'toggle', {relatedTarget, isOpen: prevState})\n const nextState = canUpdate ? wantState : prevState\n\n relatedTarget[nextState ? 'removeAttribute' : 'setAttribute']('hidden', '') // Toggle hidden attribute\n master.setAttribute('aria-expanded', nextState) // Set expand always\n return nextState\n}\n\nexport function ariaTarget (master, relationType, targetElement) {\n const targetId = master.getAttribute('aria-controls') || master.getAttribute('aria-owns') || master.getAttribute('list')\n const target = targetElement || document.getElementById(targetId) || master.nextElementSibling\n const label = IS_ANDROID ? 'data' : 'aria' // Andriod has a bug and reads only label instead of content\n\n if (!target) throw new Error(`missing nextElementSibling on ${master.outerHTML}`)\n if (relationType) {\n master.setAttribute(`aria-${relationType}`, target.id = target.id || getUUID())\n target.setAttribute(`${label}-labelledby`, master.id = master.id || getUUID())\n }\n return target\n}\n\n/**\n* CustomEvent\n* See {@link https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent}\n* @param {String} eventName A case-sensitive string representing the event type to create\n* @param {Object} params.detail Any data passed when initializing the event\n* @param {Boolean} params.cancelable A Boolean indicating whether the event is cancelable.\n* @param {Boolean} params.bubbles A Boolean indicating whether the event bubbles up through the DOM or not.\n* @return {CustomEvent} Creates a CustomEvent.\n*/\nexport const CustomEvent = (() => {\n if (typeof window === 'undefined') return\n if (typeof window.CustomEvent === 'function') return window.CustomEvent\n\n function CustomEvent (name, params = {}) {\n const event = document.createEvent('CustomEvent')\n event.initCustomEvent(name, Boolean(params.bubbles), Boolean(params.cancelable), params.detail)\n return event\n }\n\n CustomEvent.prototype = window.Event.prototype\n return CustomEvent\n})()\n\n/**\n* debounce\n* @param {Function} callback The function to debounce\n* @param {Number} ms The number of milliseconds to delay\n* @return {Function} The new debounced function\n*/\nexport function debounce (callback, ms) {\n let timer\n return function (...args) {\n const self = this\n clearTimeout(timer)\n timer = setTimeout(() => callback.apply(self, args), ms)\n }\n}\n\n/**\n* dispatchEvent\n* @param {Element} elem The target object\n* @param {String} name The source object(s)\n* @param {Object} detail Detail object (bubbles and cancelable defaults to true)\n* @return {Boolean} Whether the event was cance\n*/\nexport function dispatchEvent (elem, name, detail = {}) {\n return elem.dispatchEvent(new CustomEvent(name, {\n bubbles: true,\n cancelable: true,\n detail\n }))\n}\n\n/**\n* getUUID\n* @return {String} A generated unique ID\n*/\nexport function getUUID (el, attr) {\n return Date.now().toString(36) + Math.random().toString(36).slice(2, 5)\n}\n\n/**\n* isVisible\n* @param {Element} el A element to check visibility on\n* @return {Boolean} True of false based on visibility\n*/\nexport function isVisible (el) {\n return el.offsetWidth && el.offsetHeight && window.getComputedStyle(el).getPropertyValue('visibility') !== 'hidden'\n}\n\n/**\n* queryAll\n* @param {String|NodeList|Array|Element} elements A CSS selector string, nodeList, element array, or single element\n* @return {Array} Array of elements\n*/\nexport function queryAll (elements, context = document) {\n if (elements === ':focusable') return queryAll(FOCUSABLE, context).filter((el) => !el.disabled && isVisible(el))\n if (typeof elements === 'string') return queryAll(context.querySelectorAll(elements))\n if (elements.length) return [].slice.call(elements)\n return elements.nodeType ? [elements] : []\n}\n","import {name, version} from './package.json'\nimport {addEvent, ariaExpand, ariaTarget, queryAll} from '../utils'\n\nconst UUID = `data-${name}-${version}`.replace(/\\W+/g, '-') // Strip invalid attribute characters\nconst OPEN = 'aria-expanded'\nconst POPS = 'aria-haspopup'\n\nconst isBool = (val) => typeof val === 'boolean'\n\nexport default function toggle (selector, open) {\n const options = typeof open === 'object' ? open : {open}\n const buttons = queryAll(selector)\n\n buttons.forEach((button) => {\n const open = isBool(options.open) ? options.open : button.getAttribute(OPEN) === 'true'\n const pops = isBool(options.popup) ? options.popup : button.getAttribute(POPS) === 'true'\n\n button.setAttribute(UUID, '')\n button.setAttribute(POPS, pops)\n\n ariaTarget(button, 'controls')\n ariaExpand(button, open)\n })\n\n return buttons\n}\n\naddEvent(UUID, 'click', ({target}) => {\n queryAll(`[${UUID}]`).forEach((el) => {\n const open = el.getAttribute(OPEN) === 'true'\n const pops = el.getAttribute(POPS) === 'true'\n\n if (el.contains(target)) toggle(el, !open) // Click on toggle\n else if (pops) toggle(el, ariaTarget(el).contains(target)) // Click in target or outside\n })\n})\n","import React from 'react'\nimport coreToggle from '../core-toggle/core-toggle'\nimport {assign} from '../utils'\n\nfunction mountToggle (self) {\n coreToggle(ReactDOM.findDOMNode(self).firstElementChild) // Button must be first child\n}\n\nexport default class Toggle extends React.Component {\n componentDidMount() { mountToggle(this) } // Mount client side only to avoid rerender\n componentDidUpdate () { mountToggle(this) } // Must mount also on update in case content changes\n render () {\n return
\n {React.Children.map(this.props.children, (child, i) => { // Augment children with aria-attributes\n return assign({}, child, {\n props: assign({}, child.props, i ?\n {'hidden': !this.props.open} :\n {\n 'aria-expanded': String(Boolean(this.props.open)),\n 'aria-haspopup': String(Boolean(this.props.popup))\n }\n )\n })\n })}\n
\n }\n}\n","import React from 'react'\n\nexport default function Input () {\n return
Testing input
\n}\n"],"names":["IS_ANDROID","window","test","navigator","userAgent","FOCUSABLE","assign","target","sources","filter","Boolean","forEach","source","Object","keys","key","ariaExpand","master","open","const","relatedTarget","ariaTarget","prevState","getAttribute","wantState","nextState","elem","name","detail","dispatchEvent","CustomEvent","bubbles","cancelable","isOpen","setAttribute","relationType","targetElement","targetId","document","getElementById","nextElementSibling","label","Error","id","getUUID","prototype","Event","params","event","createEvent","initCustomEvent","el","attr","Date","now","toString","Math","random","slice","queryAll","elements","context","disabled","offsetWidth","offsetHeight","getComputedStyle","getPropertyValue","isVisible","querySelectorAll","length","call","nodeType","uuid","type","handler","UUID","replace","OPEN","POPS","isBool","val","toggle","selector","options","buttons","button","pops","popup","mountToggle","self","coreToggle","ReactDOM","findDOMNode","firstElementChild","ref","contains","addEventListener","Toggle","componentDidMount","this","componentDidUpdate","render","React","props","Children","map","children","child","i","hidden","aria-expanded","String","aria-haspopup","Component"],"mappings":"iRAAMA,EAA+B,oBAAXC,QAA0B,aAAaC,KAAKD,OAAOE,UAAUC,WACjFC,EAAY,4EAQlB,SAAgBC,EAAQC,iEAItB,OAHAC,EAAQC,OAAOC,SAASC,iBAASC,GAC/BC,OAAOC,KAAKF,GAAQD,iBAASI,UAASR,EAAOQ,GAAOH,EAAOG,OAEtDR,EAcT,SAAgBS,EAAYC,EAAQC,GAClCC,IAAMC,EAAgBC,EAAWJ,GAC3BK,EAAqD,SAAzCL,EAAOM,aAAa,iBAChCC,EAA4B,kBAATN,EAAqBA,EAAiB,WAATA,GAAqBI,EAAYA,EAEjFG,EADYH,IAAcE,GAkElC,SAA+BE,EAAMC,EAAMC,sBACzC,OAAOF,EAAKG,cAAc,IAAIC,EAAYH,GACxCI,SAAS,EACTC,YAAY,SACZJ,KAtE2CC,CAAcZ,EAAQ,wBAAWG,EAAea,OAAQX,IACvEE,EAAYF,EAI1C,OAFAF,EAAcK,EAAY,kBAAoB,gBAAgB,SAAU,IACxER,EAAOiB,aAAa,gBAAiBT,GAC9BA,EAGT,SAAgBJ,EAAYJ,EAAQkB,EAAcC,GAChDjB,IAAMk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AMrF,OAC3C8F,gBAAiBD,OAAOrG,QAAQyF,EAAKI,MAAMhB,mBAXrBe,EAAMW,8BCN3B,WACb,OAAOX,2BAAK"} \ No newline at end of file +{"version":3,"file":"index.js","sources":["../../packages/utils.js","../../packages/core-toggle/core-toggle.js","../../packages/core-toggle/core-toggle.jsx","../../packages/core-input/core-input.jsx"],"sourcesContent":["const IS_ANDROID = typeof window !== 'undefined' && /(android)/i.test(window.navigator.userAgent) // Bad, but needed\nconst FOCUSABLE = 'a,button,input,select,textarea,iframe,[tabindex],[contenteditable=\"true\"]'\n\n/**\n* assign\n* @param {Object} target The target object\n* @param {Object} sources The source object(s)\n* @return {Object} The target object\n*/\nexport function assign (target, ...sources) {\n sources.filter(Boolean).forEach((source) => {\n Object.keys(source).forEach((key) => (target[key] = source[key]))\n })\n return target\n}\n\n/**\n* addEvent\n* @param {String} uuid An unique ID of the event to bind - ensurnes single instance\n* @param {String} type The type of event to bind\n* @param {Function} handler The function to call on event\n*/\nexport function addEvent (uuid, type, handler) {\n if (typeof window === 'undefined' || window[`${uuid}-${type}`]) return // Ensure single instance\n document.addEventListener(type, handler, window[`${uuid}-${type}`] = true) // Use capture for old Firefox\n}\n\nexport function ariaExpand (master, open) {\n const relatedTarget = ariaTarget(master)\n const prevState = master.getAttribute('aria-expanded') === 'true'\n const wantState = typeof open === 'boolean' ? open : (open === 'toggle' ? !prevState : prevState)\n const canUpdate = prevState === wantState || dispatchEvent(master, 'toggle', {relatedTarget, isOpen: prevState})\n const nextState = canUpdate ? wantState : prevState\n\n relatedTarget[nextState ? 'removeAttribute' : 'setAttribute']('hidden', '') // Toggle hidden attribute\n master.setAttribute('aria-expanded', nextState) // Set expand always\n return nextState\n}\n\nexport function ariaTarget (master, relationType, targetElement) {\n const targetId = master.getAttribute('aria-controls') || master.getAttribute('aria-owns') || master.getAttribute('list')\n const target = targetElement || document.getElementById(targetId) || master.nextElementSibling\n const label = IS_ANDROID ? 'data' : 'aria' // Andriod has a bug and reads only label instead of content\n\n if (!target) throw new Error(`missing nextElementSibling on ${master.outerHTML}`)\n if (relationType) {\n master.setAttribute(`aria-${relationType}`, target.id = target.id || getUUID())\n target.setAttribute(`${label}-labelledby`, master.id = master.id || getUUID())\n }\n return target\n}\n\n/**\n* CustomEvent\n* See {@link https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent}\n* @param {String} eventName A case-sensitive string representing the event type to create\n* @param {Object} params.detail Any data passed when initializing the event\n* @param {Boolean} params.cancelable A Boolean indicating whether the event is cancelable.\n* @param {Boolean} params.bubbles A Boolean indicating whether the event bubbles up through the DOM or not.\n* @return {CustomEvent} Creates a CustomEvent.\n*/\nexport const CustomEvent = (() => {\n if (typeof window === 'undefined') return\n if (typeof window.CustomEvent === 'function') return window.CustomEvent\n\n function CustomEvent (name, params = {}) {\n const event = document.createEvent('CustomEvent')\n event.initCustomEvent(name, Boolean(params.bubbles), Boolean(params.cancelable), params.detail)\n return event\n }\n\n CustomEvent.prototype = window.Event.prototype\n return CustomEvent\n})()\n\n/**\n* debounce\n* @param {Function} callback The function to debounce\n* @param {Number} ms The number of milliseconds to delay\n* @return {Function} The new debounced function\n*/\nexport function debounce (callback, ms) {\n let timer\n return function (...args) {\n const self = this\n clearTimeout(timer)\n timer = setTimeout(() => callback.apply(self, args), ms)\n }\n}\n\n/**\n* dispatchEvent\n* @param {Element} elem The target object\n* @param {String} name The source object(s)\n* @param {Object} detail Detail object (bubbles and cancelable defaults to true)\n* @return {Boolean} Whether the event was cance\n*/\nexport function dispatchEvent (elem, name, detail = {}) {\n return elem.dispatchEvent(new CustomEvent(name, {\n bubbles: true,\n cancelable: true,\n detail\n }))\n}\n\n/**\n* getUUID\n* @return {String} A generated unique ID\n*/\nexport function getUUID (el, attr) {\n return Date.now().toString(36) + Math.random().toString(36).slice(2, 5)\n}\n\n/**\n* isVisible\n* @param {Element} el A element to check visibility on\n* @return {Boolean} True of false based on visibility\n*/\nexport function isVisible (el) {\n return el.offsetWidth && el.offsetHeight && window.getComputedStyle(el).getPropertyValue('visibility') !== 'hidden'\n}\n\n/**\n* queryAll\n* @param {String|NodeList|Array|Element} elements A CSS selector string, nodeList, element array, or single element\n* @return {Array} Array of elements\n*/\nexport function queryAll (elements, context = document) {\n if (elements === ':focusable') return queryAll(FOCUSABLE, context).filter((el) => !el.disabled && isVisible(el))\n if (typeof elements === 'string') return queryAll(context.querySelectorAll(elements))\n if (elements.length) return [].slice.call(elements)\n return elements.nodeType ? [elements] : []\n}\n","import {name, version} from './package.json'\nimport {addEvent, ariaExpand, ariaTarget, queryAll} from '../utils'\n\nconst UUID = `data-${name}-${version}`.replace(/\\W+/g, '-') // Strip invalid attribute characters\nconst OPEN = 'aria-expanded'\nconst POPS = 'aria-haspopup'\n\nconst isBool = (val) => typeof val === 'boolean'\n\nexport default function toggle (selector, open) {\n const options = typeof open === 'object' ? open : {open}\n const buttons = queryAll(selector)\n\n buttons.forEach((button) => {\n const open = isBool(options.open) ? options.open : button.getAttribute(OPEN) === 'true'\n const pops = isBool(options.popup) ? options.popup : button.getAttribute(POPS) === 'true'\n\n button.setAttribute(UUID, '')\n button.setAttribute(POPS, pops)\n\n ariaTarget(button, 'controls')\n ariaExpand(button, open)\n })\n\n return buttons\n}\n\naddEvent(UUID, 'click', ({target}) => {\n queryAll(`[${UUID}]`).forEach((el) => {\n const open = el.getAttribute(OPEN) === 'true'\n const pops = el.getAttribute(POPS) === 'true'\n\n if (el.contains(target)) toggle(el, !open) // Click on toggle\n else if (pops) toggle(el, ariaTarget(el).contains(target)) // Click in target or outside\n })\n})\n","import React from 'react'\nimport ReactDOM from 'react-dom';\nimport coreToggle from '../core-toggle/core-toggle'\nimport {assign} from '../utils'\n\nfunction mountToggle (self) {\n coreToggle(ReactDOM.findDOMNode(self).firstElementChild) // Button must be first child\n}\n\nexport default class Toggle extends React.Component {\n componentDidMount () { mountToggle(this) } // Mount client side only to avoid rerender\n componentDidUpdate () { mountToggle(this) } // Must mount also on update in case content changes\n render () {\n return
\n {React.Children.map(this.props.children, (child, i) => { // Augment children with aria-attributes\n return assign({}, child, {\n props: assign({}, child.props, i ?\n {'hidden': !this.props.open} :\n {\n 'aria-expanded': String(Boolean(this.props.open)),\n 'aria-haspopup': String(Boolean(this.props.popup))\n }\n )\n })\n })}\n
\n }\n}\n","import React from 'react'\n\nexport default function Input () {\n return
Testing input
\n}\n"],"names":["IS_ANDROID","window","test","navigator","userAgent","FOCUSABLE","assign","target","sources","filter","Boolean","forEach","source","Object","keys","key","ariaExpand","master","open","const","relatedTarget","ariaTarget","prevState","getAttribute","wantState","nextState","elem","name","detail","dispatchEvent","CustomEvent","bubbles","cancelable","isOpen","setAttribute","relationType","targetElement","targetId","document","getElementById","nextElementSibling","label","Error","id","getUUID","prototype","Event","params","event","createEvent","initCustomEvent","el","attr","Date","now","toString","Math","random","slice","queryAll","elements","context","disabled","offsetWidth","offsetHeight","getComputedStyle","getPropertyValue","isVisible","querySelectorAll","length","call","nodeType","uuid","type","handler","UUID","replace","OPEN","POPS","isBool","val","toggle","selector","options","buttons","button","pops","popup","mountToggle","self","coreToggle","ReactDOM","findDOMNode","firstElementChild","ref","contains","addEventListener","Toggle","componentDidMount","this","componentDidUpdate","render","React","props","Children","map","children","child","i","hidden","aria-expanded","String","aria-haspopup","Component"],"mappings":"4WAAMA,EAA+B,oBAAXC,QAA0B,aAAaC,KAAKD,OAAOE,UAAUC,WACjFC,EAAY,4EAQlB,SAAgBC,EAAQC,iEAItB,OAHAC,EAAQC,OAAOC,SAASC,iBAASC,GAC/BC,OAAOC,KAAKF,GAAQD,iBAASI,UAASR,EAAOQ,GAAOH,EAAOG,OAEtDR,EAcT,SAAgBS,EAAYC,EAAQC,GAClCC,IAAMC,EAAgBC,EAAWJ,GAC3BK,EAAqD,SAAzCL,EAAOM,aAAa,iBAChCC,EAA4B,kBAATN,EAAqBA,EAAiB,WAATA,GAAqBI,EAAYA,EAEjFG,EADYH,IAAcE,GAkElC,SAA+BE,EAAMC,EAAMC,sBACzC,OAAOF,EAA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OAAOC,sBAAKhG,KAAe6F,KAAKI,OAAQrF,KAAM,KAAMqE,MAAO,OACzDe,EAAOE,SAASC,IAAIN,KAAKI,MAAMG,kBAAWC,EAAOC,GAC/C,OAAOtG,KAAWqG,GAChBJ,MAAOjG,KAAWqG,EAAMJ,MAAOK,GAC5BC,QAAWV,EAAKI,MAAMrF,OAErB4F,gBAAiBC,OAAOrG,QAAQyF,EAAKI,MAAMrF,OAC3C8F,gBAAiBD,OAAOrG,QAAQyF,EAAKI,MAAMhB,mBAXrBe,EAAMW,8BCP3B,WACb,OAAOX,2BAAK"} \ No newline at end of file diff --git a/packages/core-toggle/core-toggle.jsx b/packages/core-toggle/core-toggle.jsx index 0674d9b0..0ab4ae15 100644 --- a/packages/core-toggle/core-toggle.jsx +++ b/packages/core-toggle/core-toggle.jsx @@ -1,4 +1,5 @@ import React from 'react' +import ReactDOM from 'react-dom'; import coreToggle from '../core-toggle/core-toggle' import {assign} from '../utils' @@ -7,7 +8,7 @@ function mountToggle (self) { } export default class Toggle extends React.Component { - componentDidMount() { mountToggle(this) } // Mount client side only to avoid rerender + componentDidMount () { mountToggle(this) } // Mount client side only to avoid rerender componentDidUpdate () { mountToggle(this) } // Must mount also on update in case content changes render () { return
diff --git a/packages/core-toggle/jsx/index.js b/packages/core-toggle/jsx/index.js index e063e743..5bb9b078 100644 --- a/packages/core-toggle/jsx/index.js +++ b/packages/core-toggle/jsx/index.js @@ -1,2 +1,2 @@ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):t.Toggle=e(t.React)}(this,function(t){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t;var e="undefined"!=typeof window&&/(android)/i.test(window.navigator.userAgent),n='a,button,input,select,textarea,iframe,[tabindex],[contenteditable="true"]';function o(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];return e.filter(Boolean).forEach(function(e){Object.keys(e).forEach(function(n){return t[n]=e[n]})}),t}function r(t,e){var n=i(t),o="true"===t.getAttribute("aria-expanded"),r="boolean"==typeof e?e:"toggle"===e?!o:o,a=o===r||function(t,e,n){void 0===n&&(n={});return t.dispatchEvent(new u(e,{bubbles:!0,cancelable:!0,detail:n}))}(t,"toggle",{relatedTarget:n,isOpen:o})?r:o;return n[a?"removeAttribute":"setAttribute"]("hidden",""),t.setAttribute("aria-expanded",a),a}function i(t,n,o){var r=t.getAttribute("aria-controls")||t.getAttribute("aria-owns")||t.getAttribute("list"),i=o||document.getElementById(r)||t.nextElementSibling,u=e?"data":"aria";if(!i)throw new Error("missing nextElementSibling on "+t.outerHTML);return n&&(t.setAttribute("aria-"+n,i.id=i.id||a()),i.setAttribute(u+"-labelledby",t.id=t.id||a())),i}var u=function(){if("undefined"!=typeof window)return"function"==typeof window.CustomEvent?window.CustomEvent:(t.prototype=window.Event.prototype,t);function t(t,e){void 0===e&&(e={});var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,Boolean(e.bubbles),Boolean(e.cancelable),e.detail),n}}();function a(t,e){return Date.now().toString(36)+Math.random().toString(36).slice(2,5)}function p(t,e){return void 0===e&&(e=document),":focusable"===t?p(n,e).filter(function(t){return!t.disabled&&function(t){return t.offsetWidth&&t.offsetHeight&&"hidden"!==window.getComputedStyle(t).getPropertyValue("visibility")}(t)}):"string"==typeof t?p(e.querySelectorAll(t)):t.length?[].slice.call(t):t.nodeType?[t]:[]}var d,c,f,l="data-@nrk/core-toggle-1.0.0".replace(/\W+/g,"-"),s="aria-expanded",b="aria-haspopup",g=function(t){return"boolean"==typeof t};function y(t,e){var n="object"==typeof e?e:{open:e},o=p(t);return o.forEach(function(t){var e=g(n.open)?n.open:"true"===t.getAttribute(s),o=g(n.popup)?n.popup:"true"===t.getAttribute(b);t.setAttribute(l,""),t.setAttribute(b,o),i(t,"controls"),r(t,e)}),o}function h(t){y(ReactDOM.findDOMNode(t).firstElementChild)}return d=l,c="click",f=function(t){var e=t.target;p("["+l+"]").forEach(function(t){var n="true"===t.getAttribute(s),o="true"===t.getAttribute(b);t.contains(e)?y(t,!n):o&&y(t,i(t).contains(e))})},"undefined"==typeof window||window[d+"-"+c]||document.addEventListener(c,f,window[d+"-"+c]=!0),function(e){function n(){e.apply(this,arguments)}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.componentDidMount=function(){h(this)},n.prototype.componentDidUpdate=function(){h(this)},n.prototype.render=function(){var e=this;return t.createElement("div",o({},this.props,{open:null,popup:null}),t.Children.map(this.props.children,function(t,n){return o({},t,{props:o({},t.props,n?{hidden:!e.props.open}:{"aria-expanded":String(Boolean(e.props.open)),"aria-haspopup":String(Boolean(e.props.popup))})})}))},n}(t.Component)}); +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],e):t.Toggle=e(t.React,t.ReactDOM)}(this,function(t,e){"use strict";t=t&&t.hasOwnProperty("default")?t.default:t,e=e&&e.hasOwnProperty("default")?e.default:e;var n="undefined"!=typeof window&&/(android)/i.test(window.navigator.userAgent),o='a,button,input,select,textarea,iframe,[tabindex],[contenteditable="true"]';function r(t){for(var e=[],n=arguments.length-1;n-- >0;)e[n]=arguments[n+1];return e.filter(Boolean).forEach(function(e){Object.keys(e).forEach(function(n){return t[n]=e[n]})}),t}function i(t,e){var n=u(t),o="true"===t.getAttribute("aria-expanded"),r="boolean"==typeof e?e:"toggle"===e?!o:o,i=o===r||function(t,e,n){void 0===n&&(n={});return t.dispatchEvent(new a(e,{bubbles:!0,cancelable:!0,detail:n}))}(t,"toggle",{relatedTarget:n,isOpen:o})?r:o;return n[i?"removeAttribute":"setAttribute"]("hidden",""),t.setAttribute("aria-expanded",i),i}function u(t,e,o){var r=t.getAttribute("aria-controls")||t.getAttribute("aria-owns")||t.getAttribute("list"),i=o||document.getElementById(r)||t.nextElementSibling,u=n?"data":"aria";if(!i)throw new Error("missing nextElementSibling on "+t.outerHTML);return e&&(t.setAttribute("aria-"+e,i.id=i.id||p()),i.setAttribute(u+"-labelledby",t.id=t.id||p())),i}var a=function(){if("undefined"!=typeof window)return"function"==typeof window.CustomEvent?window.CustomEvent:(t.prototype=window.Event.prototype,t);function t(t,e){void 0===e&&(e={});var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,Boolean(e.bubbles),Boolean(e.cancelable),e.detail),n}}();function p(t,e){return Date.now().toString(36)+Math.random().toString(36).slice(2,5)}function d(t,e){return void 0===e&&(e=document),":focusable"===t?d(o,e).filter(function(t){return!t.disabled&&function(t){return t.offsetWidth&&t.offsetHeight&&"hidden"!==window.getComputedStyle(t).getPropertyValue("visibility")}(t)}):"string"==typeof t?d(e.querySelectorAll(t)):t.length?[].slice.call(t):t.nodeType?[t]:[]}var c,f,l,s="data-@nrk/core-toggle-1.0.0".replace(/\W+/g,"-"),b="aria-expanded",g="aria-haspopup",y=function(t){return"boolean"==typeof t};function h(t,e){var n="object"==typeof e?e:{open:e},o=d(t);return o.forEach(function(t){var e=y(n.open)?n.open:"true"===t.getAttribute(b),o=y(n.popup)?n.popup:"true"===t.getAttribute(g);t.setAttribute(s,""),t.setAttribute(g,o),u(t,"controls"),i(t,e)}),o}function m(t){h(e.findDOMNode(t).firstElementChild)}return c=s,f="click",l=function(t){var e=t.target;d("["+s+"]").forEach(function(t){var n="true"===t.getAttribute(b),o="true"===t.getAttribute(g);t.contains(e)?h(t,!n):o&&h(t,u(t).contains(e))})},"undefined"==typeof window||window[c+"-"+f]||document.addEventListener(f,l,window[c+"-"+f]=!0),function(e){function n(){e.apply(this,arguments)}return e&&(n.__proto__=e),n.prototype=Object.create(e&&e.prototype),n.prototype.constructor=n,n.prototype.componentDidMount=function(){m(this)},n.prototype.componentDidUpdate=function(){m(this)},n.prototype.render=function(){var e=this;return t.createElement("div",r({},this.props,{open:null,popup:null}),t.Children.map(this.props.children,function(t,n){return r({},t,{props:r({},t.props,n?{hidden:!e.props.open}:{"aria-expanded":String(Boolean(e.props.open)),"aria-haspopup":String(Boolean(e.props.popup))})})}))},n}(t.Component)}); //# sourceMappingURL=index.js.map diff --git a/packages/core-toggle/jsx/index.js.map b/packages/core-toggle/jsx/index.js.map index ca4d50e1..3abc7510 100644 --- a/packages/core-toggle/jsx/index.js.map +++ b/packages/core-toggle/jsx/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sources":["../../utils.js","../core-toggle.js","../core-toggle.jsx"],"sourcesContent":["const IS_ANDROID = typeof window !== 'undefined' && /(android)/i.test(window.navigator.userAgent) // Bad, but needed\nconst FOCUSABLE = 'a,button,input,select,textarea,iframe,[tabindex],[contenteditable=\"true\"]'\n\n/**\n* assign\n* @param {Object} target The target object\n* @param {Object} sources The source object(s)\n* @return {Object} The target object\n*/\nexport function assign (target, ...sources) {\n sources.filter(Boolean).forEach((source) => {\n Object.keys(source).forEach((key) => (target[key] = source[key]))\n })\n return target\n}\n\n/**\n* addEvent\n* @param {String} uuid An unique ID of the event to bind - ensurnes single instance\n* @param {String} type The type of event to bind\n* @param {Function} handler The function to call on event\n*/\nexport function addEvent (uuid, type, handler) {\n if (typeof window === 'undefined' || window[`${uuid}-${type}`]) return // Ensure single instance\n document.addEventListener(type, handler, window[`${uuid}-${type}`] = true) // Use capture for old Firefox\n}\n\nexport function ariaExpand (master, open) {\n const relatedTarget = ariaTarget(master)\n const prevState = master.getAttribute('aria-expanded') === 'true'\n const wantState = typeof open === 'boolean' ? open : (open === 'toggle' ? !prevState : prevState)\n const canUpdate = prevState === wantState || dispatchEvent(master, 'toggle', {relatedTarget, isOpen: prevState})\n const nextState = canUpdate ? wantState : prevState\n\n relatedTarget[nextState ? 'removeAttribute' : 'setAttribute']('hidden', '') // Toggle hidden attribute\n master.setAttribute('aria-expanded', nextState) // Set expand always\n return nextState\n}\n\nexport function ariaTarget (master, relationType, targetElement) {\n const targetId = master.getAttribute('aria-controls') || master.getAttribute('aria-owns') || master.getAttribute('list')\n const target = targetElement || document.getElementById(targetId) || master.nextElementSibling\n const label = IS_ANDROID ? 'data' : 'aria' // Andriod has a bug and reads only label instead of content\n\n if (!target) throw new Error(`missing nextElementSibling on ${master.outerHTML}`)\n if (relationType) {\n master.setAttribute(`aria-${relationType}`, target.id = target.id || getUUID())\n target.setAttribute(`${label}-labelledby`, master.id = master.id || getUUID())\n }\n return target\n}\n\n/**\n* CustomEvent\n* See {@link https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent}\n* @param {String} eventName A case-sensitive string representing the event type to create\n* @param {Object} params.detail Any data passed when initializing the event\n* @param {Boolean} params.cancelable A Boolean indicating whether the event is cancelable.\n* @param {Boolean} params.bubbles A Boolean indicating whether the event bubbles up through the DOM or not.\n* @return {CustomEvent} Creates a CustomEvent.\n*/\nexport const CustomEvent = (() => {\n if (typeof window === 'undefined') return\n if (typeof window.CustomEvent === 'function') return window.CustomEvent\n\n function CustomEvent (name, params = {}) {\n const event = document.createEvent('CustomEvent')\n event.initCustomEvent(name, Boolean(params.bubbles), Boolean(params.cancelable), params.detail)\n return event\n }\n\n CustomEvent.prototype = window.Event.prototype\n return CustomEvent\n})()\n\n/**\n* debounce\n* @param {Function} callback The function to debounce\n* @param {Number} ms The number of milliseconds to delay\n* @return {Function} The new debounced function\n*/\nexport function debounce (callback, ms) {\n let timer\n return function (...args) {\n const self = this\n clearTimeout(timer)\n timer = setTimeout(() => callback.apply(self, args), ms)\n }\n}\n\n/**\n* dispatchEvent\n* @param {Element} elem The target object\n* @param {String} name The source object(s)\n* @param {Object} detail Detail object (bubbles and cancelable defaults to true)\n* @return {Boolean} Whether the event was cance\n*/\nexport function dispatchEvent (elem, name, detail = {}) {\n return elem.dispatchEvent(new CustomEvent(name, {\n bubbles: true,\n cancelable: true,\n detail\n }))\n}\n\n/**\n* getUUID\n* @return {String} A generated unique ID\n*/\nexport function getUUID (el, attr) {\n return Date.now().toString(36) + Math.random().toString(36).slice(2, 5)\n}\n\n/**\n* isVisible\n* @param {Element} el A element to check visibility on\n* @return {Boolean} True of false based on visibility\n*/\nexport function isVisible (el) {\n return el.offsetWidth && el.offsetHeight && window.getComputedStyle(el).getPropertyValue('visibility') !== 'hidden'\n}\n\n/**\n* queryAll\n* @param {String|NodeList|Array|Element} elements A CSS selector string, nodeList, element array, or single element\n* @return {Array} Array of elements\n*/\nexport function queryAll (elements, context = document) {\n if (elements === ':focusable') return queryAll(FOCUSABLE, context).filter((el) => !el.disabled && isVisible(el))\n if (typeof elements === 'string') return queryAll(context.querySelectorAll(elements))\n if (elements.length) return [].slice.call(elements)\n return elements.nodeType ? [elements] : []\n}\n","import {name, version} from './package.json'\nimport {addEvent, ariaExpand, ariaTarget, queryAll} from '../utils'\n\nconst UUID = `data-${name}-${version}`.replace(/\\W+/g, '-') // Strip invalid attribute characters\nconst OPEN = 'aria-expanded'\nconst POPS = 'aria-haspopup'\n\nconst isBool = (val) => typeof val === 'boolean'\n\nexport default function toggle (selector, open) {\n const options = typeof open === 'object' ? open : {open}\n const buttons = queryAll(selector)\n\n buttons.forEach((button) => {\n const open = isBool(options.open) ? options.open : button.getAttribute(OPEN) === 'true'\n const pops = isBool(options.popup) ? options.popup : button.getAttribute(POPS) === 'true'\n\n button.setAttribute(UUID, '')\n button.setAttribute(POPS, pops)\n\n ariaTarget(button, 'controls')\n ariaExpand(button, open)\n })\n\n return buttons\n}\n\naddEvent(UUID, 'click', ({target}) => {\n queryAll(`[${UUID}]`).forEach((el) => {\n const open = el.getAttribute(OPEN) === 'true'\n const pops = el.getAttribute(POPS) === 'true'\n\n if (el.contains(target)) toggle(el, !open) // Click on toggle\n else if (pops) toggle(el, ariaTarget(el).contains(target)) // Click in target or outside\n })\n})\n","import React from 'react'\nimport coreToggle from '../core-toggle/core-toggle'\nimport {assign} from '../utils'\n\nfunction mountToggle (self) {\n coreToggle(ReactDOM.findDOMNode(self).firstElementChild) // Button must be first child\n}\n\nexport default class Toggle extends React.Component {\n componentDidMount() { mountToggle(this) } // Mount client side only to avoid rerender\n componentDidUpdate () { mountToggle(this) } // Must mount also on update in case content changes\n render () {\n return
\n {React.Children.map(this.props.children, (child, i) => { // Augment children with aria-attributes\n return assign({}, child, {\n props: assign({}, child.props, i ?\n {'hidden': !this.props.open} :\n {\n 'aria-expanded': String(Boolean(this.props.open)),\n 'aria-haspopup': String(Boolean(this.props.popup))\n }\n )\n })\n })}\n
\n }\n}\n"],"names":["IS_ANDROID","window","test","navigator","userAgent","FOCUSABLE","assign","target","sources","filter","Boolean","forEach","source","Object","keys","key","ariaExpand","master","open","const","relatedTarget","ariaTarget","prevState","getAttribute","wantState","nextState","elem","name","detail","dispatchEvent","CustomEvent","bubbles","cancelable","isOpen","setAttribute","relationType","targetElement","targetId","document","getElementById","nextElementSibling","label","Error","id","getUUID","prototype","Event","params","event","createEvent","initCustomEvent","el","attr","Date","now","toString","Math","random","slice","queryAll","elements","context","disabled","offsetWidth","offsetHeight","getComputedStyle","getPropertyValue","isVisible","querySelectorAll","length","call","nodeType","uuid","type","handler","UUID","replace","OPEN","POPS","isBool","val","toggle","selector","options","buttons","button","pops","popup","mountToggle","self","coreToggle","ReactDOM","findDOMNode","firstElementChild","ref","contains","addEventListener","componentDidMount","this","componentDidUpdate","render","React","props","Children","map","children","child","i","hidden","aria-expanded","String","aria-haspopup","Component"],"mappings":"qQAAMA,EAA+B,oBAAXC,QAA0B,aAAaC,KAAKD,OAAOE,UAAUC,WACjFC,EAAY,4EAQlB,SAAgBC,EAAQC,iEAItB,OAHAC,EAAQC,OAAOC,SAASC,iBAASC,GAC/BC,OAAOC,KAAKF,GAAQD,iBAASI,UAASR,EAAOQ,GAAOH,EAAOG,OAEtDR,EAcT,SAAgBS,EAAYC,EAAQC,GAClCC,IAAMC,EAAgBC,EAAWJ,GAC3BK,EAAqD,SAAzCL,EAAOM,aAAa,iBAChCC,EAA4B,kBAATN,EAAqBA,EAAiB,WAATA,GAAqBI,EAAYA,EAEjFG,EADYH,IAAcE,GAkElC,SAA+BE,EAAMC,EAAMC,sBACzC,OAAOF,EAAKG,cAAc,IAAIC,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OAAQpF,KAAM,KAAMqE,MAAO,OACzDc,EAAOE,SAASC,IAAIN,KAAKI,MAAMG,kBAAWC,EAAOC,GAC/C,OAAOrG,KAAWoG,GAChBJ,MAAOhG,KAAWoG,EAAMJ,MAAOK,GAC5BC,QAAWV,EAAKI,MAAMpF,OAErB2F,gBAAiBC,OAAOpG,QAAQwF,EAAKI,MAAMpF,OAC3C6F,gBAAiBD,OAAOpG,QAAQwF,EAAKI,MAAMf,mBAXrBc,EAAMW"} \ No newline at end of file +{"version":3,"file":"index.js","sources":["../../utils.js","../core-toggle.js","../core-toggle.jsx"],"sourcesContent":["const IS_ANDROID = typeof window !== 'undefined' && /(android)/i.test(window.navigator.userAgent) // Bad, but needed\nconst FOCUSABLE = 'a,button,input,select,textarea,iframe,[tabindex],[contenteditable=\"true\"]'\n\n/**\n* assign\n* @param {Object} target The target object\n* @param {Object} sources The source object(s)\n* @return {Object} The target object\n*/\nexport function assign (target, ...sources) {\n sources.filter(Boolean).forEach((source) => {\n Object.keys(source).forEach((key) => (target[key] = source[key]))\n })\n return target\n}\n\n/**\n* addEvent\n* @param {String} uuid An unique ID of the event to bind - ensurnes single instance\n* @param {String} type The type of event to bind\n* @param {Function} handler The function to call on event\n*/\nexport function addEvent (uuid, type, handler) {\n if (typeof window === 'undefined' || window[`${uuid}-${type}`]) return // Ensure single instance\n document.addEventListener(type, handler, window[`${uuid}-${type}`] = true) // Use capture for old Firefox\n}\n\nexport function ariaExpand (master, open) {\n const relatedTarget = ariaTarget(master)\n const prevState = master.getAttribute('aria-expanded') === 'true'\n const wantState = typeof open === 'boolean' ? open : (open === 'toggle' ? !prevState : prevState)\n const canUpdate = prevState === wantState || dispatchEvent(master, 'toggle', {relatedTarget, isOpen: prevState})\n const nextState = canUpdate ? wantState : prevState\n\n relatedTarget[nextState ? 'removeAttribute' : 'setAttribute']('hidden', '') // Toggle hidden attribute\n master.setAttribute('aria-expanded', nextState) // Set expand always\n return nextState\n}\n\nexport function ariaTarget (master, relationType, targetElement) {\n const targetId = master.getAttribute('aria-controls') || master.getAttribute('aria-owns') || master.getAttribute('list')\n const target = targetElement || document.getElementById(targetId) || master.nextElementSibling\n const label = IS_ANDROID ? 'data' : 'aria' // Andriod has a bug and reads only label instead of content\n\n if (!target) throw new Error(`missing nextElementSibling on ${master.outerHTML}`)\n if (relationType) {\n master.setAttribute(`aria-${relationType}`, target.id = target.id || getUUID())\n target.setAttribute(`${label}-labelledby`, master.id = master.id || getUUID())\n }\n return target\n}\n\n/**\n* CustomEvent\n* See {@link https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent}\n* @param {String} eventName A case-sensitive string representing the event type to create\n* @param {Object} params.detail Any data passed when initializing the event\n* @param {Boolean} params.cancelable A Boolean indicating whether the event is cancelable.\n* @param {Boolean} params.bubbles A Boolean indicating whether the event bubbles up through the DOM or not.\n* @return {CustomEvent} Creates a CustomEvent.\n*/\nexport const CustomEvent = (() => {\n if (typeof window === 'undefined') return\n if (typeof window.CustomEvent === 'function') return window.CustomEvent\n\n function CustomEvent (name, params = {}) {\n const event = document.createEvent('CustomEvent')\n event.initCustomEvent(name, Boolean(params.bubbles), Boolean(params.cancelable), params.detail)\n return event\n }\n\n CustomEvent.prototype = window.Event.prototype\n return CustomEvent\n})()\n\n/**\n* debounce\n* @param {Function} callback The function to debounce\n* @param {Number} ms The number of milliseconds to delay\n* @return {Function} The new debounced function\n*/\nexport function debounce (callback, ms) {\n let timer\n return function (...args) {\n const self = this\n clearTimeout(timer)\n timer = setTimeout(() => callback.apply(self, args), ms)\n }\n}\n\n/**\n* dispatchEvent\n* @param {Element} elem The target object\n* @param {String} name The source object(s)\n* @param {Object} detail Detail object (bubbles and cancelable defaults to true)\n* @return {Boolean} Whether the event was cance\n*/\nexport function dispatchEvent (elem, name, detail = {}) {\n return elem.dispatchEvent(new CustomEvent(name, {\n bubbles: true,\n cancelable: true,\n detail\n }))\n}\n\n/**\n* getUUID\n* @return {String} A generated unique ID\n*/\nexport function getUUID (el, attr) {\n return Date.now().toString(36) + Math.random().toString(36).slice(2, 5)\n}\n\n/**\n* isVisible\n* @param {Element} el A element to check visibility on\n* @return {Boolean} True of false based on visibility\n*/\nexport function isVisible (el) {\n return el.offsetWidth && el.offsetHeight && window.getComputedStyle(el).getPropertyValue('visibility') !== 'hidden'\n}\n\n/**\n* queryAll\n* @param {String|NodeList|Array|Element} elements A CSS selector string, nodeList, element array, or single element\n* @return {Array} Array of elements\n*/\nexport function queryAll (elements, context = document) {\n if (elements === ':focusable') return queryAll(FOCUSABLE, context).filter((el) => !el.disabled && isVisible(el))\n if (typeof elements === 'string') return queryAll(context.querySelectorAll(elements))\n if (elements.length) return [].slice.call(elements)\n return elements.nodeType ? [elements] : []\n}\n","import {name, version} from './package.json'\nimport {addEvent, ariaExpand, ariaTarget, queryAll} from '../utils'\n\nconst UUID = `data-${name}-${version}`.replace(/\\W+/g, '-') // Strip invalid attribute characters\nconst OPEN = 'aria-expanded'\nconst POPS = 'aria-haspopup'\n\nconst isBool = (val) => typeof val === 'boolean'\n\nexport default function toggle (selector, open) {\n const options = typeof open === 'object' ? open : {open}\n const buttons = queryAll(selector)\n\n buttons.forEach((button) => {\n const open = isBool(options.open) ? options.open : button.getAttribute(OPEN) === 'true'\n const pops = isBool(options.popup) ? options.popup : button.getAttribute(POPS) === 'true'\n\n button.setAttribute(UUID, '')\n button.setAttribute(POPS, pops)\n\n ariaTarget(button, 'controls')\n ariaExpand(button, open)\n })\n\n return buttons\n}\n\naddEvent(UUID, 'click', ({target}) => {\n queryAll(`[${UUID}]`).forEach((el) => {\n const open = el.getAttribute(OPEN) === 'true'\n const pops = el.getAttribute(POPS) === 'true'\n\n if (el.contains(target)) toggle(el, !open) // Click on toggle\n else if (pops) toggle(el, ariaTarget(el).contains(target)) // Click in target or outside\n })\n})\n","import React from 'react'\nimport ReactDOM from 'react-dom';\nimport coreToggle from '../core-toggle/core-toggle'\nimport {assign} from '../utils'\n\nfunction mountToggle (self) {\n coreToggle(ReactDOM.findDOMNode(self).firstElementChild) // Button must be first child\n}\n\nexport default class Toggle extends React.Component {\n componentDidMount () { mountToggle(this) } // Mount client side only to avoid rerender\n componentDidUpdate () { mountToggle(this) } // Must mount also on update in case content changes\n render () {\n return
\n {React.Children.map(this.props.children, (child, i) => { // Augment children with aria-attributes\n return assign({}, child, {\n props: assign({}, child.props, i ?\n {'hidden': !this.props.open} :\n {\n 'aria-expanded': String(Boolean(this.props.open)),\n 'aria-haspopup': String(Boolean(this.props.popup))\n }\n )\n })\n })}\n
\n }\n}\n"],"names":["IS_ANDROID","window","test","navigator","userAgent","FOCUSABLE","assign","target","sources","filter","Boolean","forEach","source","Object","keys","key","ariaExpand","master","open","const","relatedTarget","ariaTarget","prevState","getAttribute","wantState","nextState","elem","name","detail","dispatchEvent","CustomEvent","bubbles","cancelable","isOpen","setAttribute","relationType","targetElement","targetId","document","getElementById","nextElementSibling","label","Error","id","getUUID","prototype","Event","params","event","createEvent","initCustomEvent","el","attr","Date","now","toString","Math","random","slice","queryAll","elements","context","disabled","offsetWidth","offsetHeight","getComputedStyle","getPropertyValue","isVisible","querySelectorAll","length","call","nodeType","uuid","type","handler","UUID","replace","OPEN","POPS","isBool","val","toggle","selector","options","buttons","button","pops","popup","mountToggle","self","coreToggle","ReactDOM","findDOMNode","firstElementChild","ref","contains","addEventListener","componentDidMount","this","componentDidUpdate","render","React","props","Children","map","children","child","i","hidden","aria-expanded","String","aria-haspopup","Component"],"mappings":"gWAAMA,EAA+B,oBAAXC,QAA0B,aAAaC,KAAKD,OAAOE,UAAUC,WACjFC,EAAY,4EAQlB,SAAgBC,EAAQC,iEAItB,OAHAC,EAAQC,OAAOC,SAASC,iBAASC,GAC/BC,OAAOC,KAAKF,GAAQD,iBAASI,UAASR,EAAOQ,GAAOH,EAAOG,OAEtDR,EAcT,SAAgBS,EAAYC,EAAQC,GAClCC,IAAMC,EAAgBC,EAAWJ,GAC3BK,EAAqD,SAAzCL,EAAOM,aAAa,iBAChCC,EAA4B,kBAATN,EAA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