@cfpb/cfpb-design-system
Advanced tools
Comparing version 0.17.12 to 0.17.14
@@ -1,1 +0,1 @@ | ||
!function(){"use strict";var t={852:function(t){function e(t){this.listenerMap=[{},{}],t&&this.root(t),this.handle=e.prototype.handle.bind(this),this._removedListeners=[]}t.exports=e,e.prototype.root=function(t){var e,i=this.listenerMap;if(this.rootElement){for(e in i[1])i[1].hasOwnProperty(e)&&this.rootElement.removeEventListener(e,this.handle,!0);for(e in i[0])i[0].hasOwnProperty(e)&&this.rootElement.removeEventListener(e,this.handle,!1)}if(!t||!t.addEventListener)return this.rootElement&&delete this.rootElement,this;for(e in this.rootElement=t,i[1])i[1].hasOwnProperty(e)&&this.rootElement.addEventListener(e,this.handle,!0);for(e in i[0])i[0].hasOwnProperty(e)&&this.rootElement.addEventListener(e,this.handle,!1);return this},e.prototype.captureForType=function(t){return-1!==["blur","error","focus","load","resize","scroll"].indexOf(t)},e.prototype.on=function(t,e,o,a){var l,h,c,u;if(!t)throw new TypeError("Invalid event type: "+t);if("function"==typeof e&&(a=o,o=e,e=null),void 0===a&&(a=this.captureForType(t)),"function"!=typeof o)throw new TypeError("Handler must be a type of Function");return l=this.rootElement,(h=this.listenerMap[a?1:0])[t]||(l&&l.addEventListener(t,this.handle,a),h[t]=[]),e?/^[a-z]+$/i.test(e)?(u=e,c=n):/^#[a-z0-9\-_]+$/i.test(e)?(u=e.slice(1),c=r):(u=e,c=i):(u=null,c=s.bind(this)),h[t].push({selector:e,handler:o,matcher:c,matcherParam:u}),this},e.prototype.off=function(t,e,i,n){var s,r,o,a,l;if("function"==typeof e&&(n=i,i=e,e=null),void 0===n)return this.off(t,e,i,!0),this.off(t,e,i,!1),this;if(o=this.listenerMap[n?1:0],!t){for(l in o)o.hasOwnProperty(l)&&this.off(l,e,i);return this}if(!(a=o[t])||!a.length)return this;for(s=a.length-1;s>=0;s--)r=a[s],e&&e!==r.selector||i&&i!==r.handler||(this._removedListeners.push(r),a.splice(s,1));return a.length||(delete o[t],this.rootElement&&this.rootElement.removeEventListener(t,this.handle,n)),this},e.prototype.handle=function(t){var e,i,n,s,r,o=t.type,a=[],l="ftLabsDelegateIgnore";if(!0!==t[l]){switch(3===(r=t.target).nodeType&&(r=r.parentNode),r.correspondingUseElement&&(r=r.correspondingUseElement),n=this.rootElement,t.eventPhase||(t.target!==t.currentTarget?3:2)){case 1:a=this.listenerMap[1][o];break;case 2:this.listenerMap[0]&&this.listenerMap[0][o]&&(a=a.concat(this.listenerMap[0][o])),this.listenerMap[1]&&this.listenerMap[1][o]&&(a=a.concat(this.listenerMap[1][o]));break;case 3:a=this.listenerMap[0][o]}var h,c=[];for(i=a.length;r&&i;){for(e=0;e<i&&(s=a[e]);e++)r.tagName&&["button","input","select","textarea"].indexOf(r.tagName.toLowerCase())>-1&&r.hasAttribute("disabled")?c=[]:s.matcher.call(r,s.matcherParam,r)&&c.push([t,r,s]);if(r===n)break;if(i=a.length,(r=r.parentElement||r.parentNode)instanceof HTMLDocument)break}for(e=0;e<c.length;e++)if(!(this._removedListeners.indexOf(c[e][2])>-1)&&!1===this.fire.apply(this,c[e])){c[e][0][l]=!0,c[e][0].preventDefault(),h=!1;break}return h}},e.prototype.fire=function(t,e,i){return i.handler.call(e,t,e)};var i=function(t){if(t){var e=t.prototype;return e.matches||e.matchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector}}(Element);function n(t,e){return t.toLowerCase()===e.tagName.toLowerCase()}function s(t,e){return this.rootElement===window?e===document||e===document.documentElement||e===window:this.rootElement===e}function r(t,e){return t===e.id}e.prototype.destroy=function(){this.off(),this.root()}},161:function(t,e,i){var n=i(852);t.exports=function(t){return new n(t)},t.exports.Delegate=n}},e={};function i(n){var s=e[n];if(void 0!==s)return s.exports;var r=e[n]={exports:{}};return t[n](r,r.exports,i),r.exports}!function(){var t="data-js-hook";var e={UP:0,RIGHT:1,DOWN:-1,LEFT:-2};function n(e,i){if(!e)return!1;var n=e.getAttribute(t);return!!n&&(n=n.split(" ")).indexOf(i)>-1}var s="state_atomic_init";function r(e){return!n(e,s)&&(function(e,i){if(-1!==i.indexOf(" "))throw new Error("data-js-hook values cannot contain spaces!");var n=e.getAttribute(t);null!==n&&(i=n+" "+i),e.setAttribute(t,i)}(e,s),!0)}function o(t){return"[object Object]"===Object.prototype.toString.call(t)}function a(t){t=t||{};for(var e=1,i=arguments.length;e<i;e++){var n=arguments[e]||{},s=void 0;for(s in n)if(Object.prototype.hasOwnProperty.call(n,s)){var r=n[s];o(r)?a(t[s]||(t[s]={}),r):t[s]=r}}return t}var l=function(){var t={};return this.addEventListener=function(e,i){return t.hasOwnProperty(e)?t[e].push(i):t[e]=[i],this},this.removeEventListener=function(e,i){if(!t.hasOwnProperty(e))return this;var n=t[e].indexOf(i);return-1!==n&&t[e].splice(n,1),this},this.dispatchEvent=function(e,i){if(!t.hasOwnProperty(e))return this;i=i||{};for(var n=t[e],s=0,r=n.length;s<r;s++)n[s].call(this,i);return this},this.getRegisteredEvents=function(){return t},this};function h(t){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h(t)}var c=Object.prototype.toString;function u(t){return void 0===t}function d(t){return"[object String]"===c.call(t)}var p={isUndefined:u,isDefined:function(t){return void 0!==t},isObject:function(t){return null!==t&&"object"===h(t)},isString:d,isNumber:function(t){return"[object Number]"===c.call(t)},isDate:function(t){return"[object Date]"===c.call(t)},isArray:Array.isArray||function(t){return"[object Array]"===c.call(t)},isFunction:function(t){return"[object Function]"===c.call(t)},isEmpty:function(t){return u(t)||null===t||d(t)&&t.length<=0||/^\s*$/.test(t)}},f=i(161).Delegate;function v(t,e){this.element=t,this.initializers=[],this.uId=this.uniqueId("ac"),a(this,e),this.processModifiers(),this.ensureElement(),this.setCachedElements(),this.initializers.push(this.initialize)}a(v.prototype,new l,{init:function(){return this.initializers.forEach((function(t){p.isFunction(t)&&t.apply(this,arguments)}),this),this.dispatchEvent("component:initialized"),this},processModifiers:function(){this.modifiers&&this.modifiers.forEach((function(t){var e=t.ui.base.substring(1);this.element.classList.contains(e)&&(t.initialize&&this.initializers.push(t.initialize),a(this,t))}),this)},render:function(){return this},ensureElement:function(){if(this.element)this.setElement(this.element);else{var t=a({},this.attributes);t.id=this.id||this.u_id,this.className&&(t.class=this.className),this.setElement(document.createElement("div")),this.setElementAttributes(t)}r(this.element)},setElement:function(t){return this.element&&this.undelegateEvents(),this.element=t,this.delegateEvents(),this},setCachedElements:function(){var t,e,i=a({},this.ui);for(t in i)i.hasOwnProperty(t)&&(1===(e=this.element.querySelectorAll(i[t])).length?i[t]=e[0]:e.length>1?i[t]=e:i[t]=null);return this.ui=i,i},destroy:function(){return this.element&&(this.element.parentNode.removeChild(this.element),this.element.view&&delete this.element.view,delete this.element),this.undelegateEvents(),this.dispatchEvent("component:destroyed"),!0},setElementAttributes:function(t){var e;for(e in t)t.hasOwnProperty(e)&&this.element.setAttribute(e,t[e])},delegateEvents:function(t){var e,i,n,s=/^(\S+)\s*(.*)$/;if(!(t=t||(t=this.events)))return this;for(e in this.undelegateEvents(),this._delegate=new f(this.element),t)({}).hasOwnProperty.call(t,e)&&(i=t[e],p.isFunction(this[i])&&(i=this[i]),i&&(n=e.match(s),this.delegate(n[1],n[2],i.bind(this))));return this.dispatchEvent("component:bound"),this},delegate:function(t,e,i){return this._delegate.on(t,e,i),this},undelegateEvents:function(){return this._delegate&&this._delegate.destroy(),this.element.removeAttribute("data-js-hook"),this},uniqueId:function(t){return t+"_"+Math.random().toString(36).substr(2,9)}}),v.init=function(t){var e=function(t,e,i){for(var r,o,a=(i||document).querySelectorAll(t),l=[],h=0,c=a.length;h<c;h++)!1===n(o=a[h],s)&&((r=new e(o)).init(),l.push(r));return l}(this.selector,this,t);return e},v.extend=function(t){function e(){return this._super=v.prototype,v.apply(this,arguments)}return e.prototype=Object.create(v.prototype),a(e.prototype,t),a(e,v),t.hasOwnProperty("ui")&&t.ui.hasOwnProperty("base")&&(e.selector=t.ui.base),e.constants={},e};var m=v;function E(t,e){var i,n,s,r,o,a=e,h=!1,c=!1;if(void 0===a.CSS_PROPERTY||void 0===a.BASE_CLASS)throw new Error("Transitions require CSS_PROPERTY and BASE_CLASS to be passed into BaseTransition.");function u(t){i&&(g(),d()),(i=t).classList.add(a.BASE_CLASS),s=function(t){if(!t){throw new Error("Element does not have TransitionEnd event. It may be null!")}var e,i,n={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(i in n)if(n.hasOwnProperty(i)&&void 0!==t.style[i]){e=n[i];break}return e}(i)}function d(){return i?(i.classList.remove(E.NO_ANIMATION_CLASS),this):this}function p(){h&&(i.style.webkitTransitionDuration="0",i.style.mozTransitionDuration="0",i.style.oTransitionDuration="0",i.style.transitionDuration="0",i.removeEventListener(s,r),r(),i.style.webkitTransitionDuration="",i.style.mozTransitionDuration="",i.style.oTransitionDuration="",i.style.transitionDuration="")}function f(){i.classList.add(E.ANIMATING_CLASS),h=!0,s&&!i.classList.contains(E.NO_ANIMATION_CLASS)?(i.addEventListener(s,r),this.dispatchEvent(E.BEGIN_EVENT,{target:this})):(this.dispatchEvent(E.BEGIN_EVENT,{target:this}),r())}function v(){i.removeEventListener(s,r)}function m(t){return(!t||t.propertyName===a.CSS_PROPERTY)&&(v(),i.classList.remove(E.ANIMATING_CLASS),this.dispatchEvent(E.END_EVENT,{target:this}),h=!1,!0)}function b(){var t;for(t in a)a.hasOwnProperty(t)&&a[t]!==a.BASE_CLASS&&i.classList.contains(a[t])&&i.classList.remove(a[t])}function g(){return!!i&&(p(),i.classList.remove(a.BASE_CLASS),b(),!0)}var y=new l;return this.addEventListener=y.addEventListener,this.dispatchEvent=y.dispatchEvent,this.removeEventListener=y.removeEventListener,this.animateOff=function(){return i?(i.classList.add(E.NO_ANIMATION_CLASS),this):this},this.animateOn=d,this.applyClass=function(t){return!!i&&(c||(b(),c=!0),!i.classList.contains(t)&&(v(),i.classList.remove(n),n=t,o(),i.classList.add(n),!0))},this.halt=p,this.init=function(){return r=m.bind(this),o=f.bind(this),u(t),this},this.isAnimated=function(){return!!i&&!i.classList.contains(E.NO_ANIMATION_CLASS)},this.remove=g,this.setElement=u,this}E.BEGIN_EVENT="transitionBegin",E.END_EVENT="transitionEnd",E.NO_ANIMATION_CLASS="u-no-animation",E.ANIMATING_CLASS="u-is-animating";var b=E,g={CSS_PROPERTY:"max-height",BASE_CLASS:"o-expandable_content__transition",EXPANDED:"o-expandable_content__expanded",COLLAPSED:"o-expandable_content__collapsed",OPEN_DEFAULT:"o-expandable_content__onload-open"};function y(t){var e,i=new b(t,g);function n(){t.classList.contains(g.EXPANDED)?(this.dispatchEvent("expandEnd",{target:this}),t.scrollHeight>e&&(t.style.maxHeight=t.scrollHeight+"px")):t.classList.contains(g.COLLAPSED)&&this.dispatchEvent("collapseEnd",{target:this})}var s=new l;return this.addEventListener=s.addEventListener,this.dispatchEvent=s.dispatchEvent,this.removeEventListener=s.removeEventListener,this.animateOff=i.animateOff,this.animateOn=i.animateOn,this.halt=i.halt,this.isAnimated=i.isAnimated,this.setElement=i.setElement,this.remove=i.remove,this.init=function(){return i.init(),i.addEventListener(b.END_EVENT,n.bind(this)),t.classList.contains(g.OPEN_DEFAULT)?this.expand():this.collapse(),this},this.toggleExpandable=function(){return t.classList.contains(g.COLLAPSED)?this.expand():this.collapse(),this},this.collapse=function(){return this.dispatchEvent("collapseBegin",{target:this}),e=t.scrollHeight,t.style.maxHeight="0",i.applyClass(g.COLLAPSED),this},this.expand=function(){return this.dispatchEvent("expandBegin",{target:this}),(!e||t.scrollHeight>e)&&(e=t.scrollHeight),t.style.maxHeight=e+"px",i.applyClass(g.EXPANDED),this},this}y.CLASSES=g;var L=y;function A(t,e){if("closest"in t)return t.closest(e);var i=function(t){return t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector}(t);try{for(var n,s=t;s;)if(i.bind(s)(e)?n=s:s=s.parentNode,n)return s}catch(t){return null}return null}var S=new l;function _(){this.activeAccordion&&(this.transition.toggleExpandable(),this.toggleTargetState(this.ui.target),this.activeAccordion=!1)}function x(){this.ui.content.classList.remove("u-hidden")}function C(){this.ui.content.classList.add("u-hidden")}var D=m.extend({ui:{base:".o-expandable",target:".o-expandable_target",content:".o-expandable_content",header:".o-expandable_header",label:".o-expandable_label"},classes:{targetExpanded:"o-expandable_target__expanded",targetCollapsed:"o-expandable_target__collapsed",group:"o-expandable-group",groupAccordion:"o-expandable-group__accordion"},events:{"click .o-expandable_target":"expandableClickHandler"},transition:null,isAccordionGroup:!1,activeAccordion:!1,initialize:function(){var t=new L(this.ui.content);this.transition=t.init(),this.transition.addEventListener("expandBegin",x.bind(this)),this.transition.addEventListener("collapseEnd",C.bind(this)),this.ui.content.classList.contains(L.CLASSES.EXPANDED)?this.ui.target.classList.add(this.classes.targetExpanded):(this.ui.target.classList.add(this.classes.targetCollapsed),this.ui.content.classList.add("u-hidden"));var e=A(this.ui.target,"."+this.classes.group);this.isAccordionGroup=null!==e&&e.classList.contains(this.classes.groupAccordion),this.isAccordionGroup&&S.addEventListener("accordionActivated",_.bind(this))},expandableClickHandler:function(){this.transition.toggleExpandable(),this.toggleTargetState(this.ui.target),this.isAccordionGroup&&(this.activeAccordion?this.activeAccordion=!1:(S.dispatchEvent("accordionActivated",{target:this}),this.activeAccordion=!0))},toggleTargetState:function(t){t.classList.contains(this.classes.targetExpanded)?(this.ui.target.classList.add(this.classes.targetCollapsed),this.ui.target.classList.remove(this.classes.targetExpanded)):(this.ui.target.classList.add(this.classes.targetExpanded),this.ui.target.classList.remove(this.classes.targetCollapsed))},getLabelText:function(){return this.ui.label.textContent.trim()}});var O,w={ui:{base:".o-table__row-links"},events:{"click tbody tr":"onRowLinkClick"},onRowLinkClick:function(t){var e=t.target;if(e&&"A"===e.tagName)return;var i=(e=A(t.target,"tr")).querySelector("a");i&&(window.location=i.getAttribute("href"))}};var N={ui:{base:".o-table__sortable",tableBody:"tbody",sortButton:".sorted-up, .sorted-down"},classes:{sortDown:"sorted-down",sortUp:"sorted-up"},events:{"click .sortable":"onSortableClick"},initialize:function(){this.sortClass=O,this.sortColumnIndex=O,this.sortDirection=O,this.tableData=[],this.bindProperties(),this.ui.sortButton&&(this.sortColumnIndex=this.getColumnIndex(),this.sortDirection=e.UP,this.ui.sortButton.classList.contains(this.classes.sortDown)&&(this.sortDirection=e.DOWN),this.updateTable())},bindProperties:function(){var t;Object.defineProperty(this,"sortDirection",{configurable:!0,get:function(){return t},set:function(i){i===e.UP?this.sortClass=this.classes.sortUp:i===e.DOWN&&(this.sortClass=this.classes.sortDown),t=i}})},getColumnIndex:function(t){return A(t||this.ui.sortButton,"td, th").cellIndex},updateTable:function(){return this.updateTableData()&&this.updateTableDom()},updateTableData:function(t){var e,i=this.ui.tableBody.querySelectorAll("tr");this.tableData=[],t=t||this.sortColumnIndex;for(var n=0,s=i.length;n<s;++n)(e=i[n].cells[t])&&(e=e.textContent.trim()),this.tableData.push([e,i[n]]);var r=this.ui.sortButton.getAttribute("data-sort_type");return this.tableData.sort(this.tableDataSorter(this.sortDirection,r)),this.tableData},updateTableDom:function(){var t=this.ui.tableBody;for(;t.lastChild;)t.removeChild(t.lastChild);for(var e=document.createDocumentFragment(),i=0;i<this.tableData.length;i++)e.appendChild(this.tableData[i][1]);return t.appendChild(e),this.dispatchEvent("table:updated"),t},tableDataSorter:function(t,i){return function(n,s){var r=t===e.DOWN?-1:1,o=0,a=/[^\d.-]/g;return n=n[0],s=s[0],"number"===i&&(n=Number(n.replace(a,"")),s=Number(s.replace(a,""))),n<s?o=-1*r:n>s&&(o=r),o}},onSortableClick:function(t){this.ui.sortButton&&this.ui.sortButton.classList.remove(this.sortClass);this.ui.sortButton===t.target?this.sortDirection=~this.sortDirection:(this.ui.sortButton=t.target,this.sortColumnIndex=this.getColumnIndex(),this.sortDirection=e.UP);return this.ui.sortButton.classList.add(this.sortClass),this.updateTable(),this}},T=m.extend({ui:{base:".o-table"},modifiers:[N,w]});T.constants.DIRECTIONS=e;var P=T;D.init(),P.init()}()}(); | ||
!function(){"use strict";var t={852:function(t){function e(t){this.listenerMap=[{},{}],t&&this.root(t),this.handle=e.prototype.handle.bind(this),this._removedListeners=[]}t.exports=e,e.prototype.root=function(t){var e,i=this.listenerMap;if(this.rootElement){for(e in i[1])i[1].hasOwnProperty(e)&&this.rootElement.removeEventListener(e,this.handle,!0);for(e in i[0])i[0].hasOwnProperty(e)&&this.rootElement.removeEventListener(e,this.handle,!1)}if(!t||!t.addEventListener)return this.rootElement&&delete this.rootElement,this;for(e in this.rootElement=t,i[1])i[1].hasOwnProperty(e)&&this.rootElement.addEventListener(e,this.handle,!0);for(e in i[0])i[0].hasOwnProperty(e)&&this.rootElement.addEventListener(e,this.handle,!1);return this},e.prototype.captureForType=function(t){return-1!==["blur","error","focus","load","resize","scroll"].indexOf(t)},e.prototype.on=function(t,e,o,a){var l,h,c,u;if(!t)throw new TypeError("Invalid event type: "+t);if("function"==typeof e&&(a=o,o=e,e=null),void 0===a&&(a=this.captureForType(t)),"function"!=typeof o)throw new TypeError("Handler must be a type of Function");return l=this.rootElement,(h=this.listenerMap[a?1:0])[t]||(l&&l.addEventListener(t,this.handle,a),h[t]=[]),e?/^[a-z]+$/i.test(e)?(u=e,c=n):/^#[a-z0-9\-_]+$/i.test(e)?(u=e.slice(1),c=r):(u=e,c=i):(u=null,c=s.bind(this)),h[t].push({selector:e,handler:o,matcher:c,matcherParam:u}),this},e.prototype.off=function(t,e,i,n){var s,r,o,a,l;if("function"==typeof e&&(n=i,i=e,e=null),void 0===n)return this.off(t,e,i,!0),this.off(t,e,i,!1),this;if(o=this.listenerMap[n?1:0],!t){for(l in o)o.hasOwnProperty(l)&&this.off(l,e,i);return this}if(!(a=o[t])||!a.length)return this;for(s=a.length-1;s>=0;s--)r=a[s],e&&e!==r.selector||i&&i!==r.handler||(this._removedListeners.push(r),a.splice(s,1));return a.length||(delete o[t],this.rootElement&&this.rootElement.removeEventListener(t,this.handle,n)),this},e.prototype.handle=function(t){var e,i,n,s,r,o=t.type,a=[],l="ftLabsDelegateIgnore";if(!0!==t[l]){switch(3===(r=t.target).nodeType&&(r=r.parentNode),r.correspondingUseElement&&(r=r.correspondingUseElement),n=this.rootElement,t.eventPhase||(t.target!==t.currentTarget?3:2)){case 1:a=this.listenerMap[1][o];break;case 2:this.listenerMap[0]&&this.listenerMap[0][o]&&(a=a.concat(this.listenerMap[0][o])),this.listenerMap[1]&&this.listenerMap[1][o]&&(a=a.concat(this.listenerMap[1][o]));break;case 3:a=this.listenerMap[0][o]}var h,c=[];for(i=a.length;r&&i;){for(e=0;e<i&&(s=a[e]);e++)r.tagName&&["button","input","select","textarea"].indexOf(r.tagName.toLowerCase())>-1&&r.hasAttribute("disabled")?c=[]:s.matcher.call(r,s.matcherParam,r)&&c.push([t,r,s]);if(r===n)break;if(i=a.length,(r=r.parentElement||r.parentNode)instanceof HTMLDocument)break}for(e=0;e<c.length;e++)if(!(this._removedListeners.indexOf(c[e][2])>-1)&&!1===this.fire.apply(this,c[e])){c[e][0][l]=!0,c[e][0].preventDefault(),h=!1;break}return h}},e.prototype.fire=function(t,e,i){return i.handler.call(e,t,e)};var i=function(t){if(t){var e=t.prototype;return e.matches||e.matchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector}}(Element);function n(t,e){return t.toLowerCase()===e.tagName.toLowerCase()}function s(t,e){return this.rootElement===window?e===document||e===document.documentElement||e===window:this.rootElement===e}function r(t,e){return t===e.id}e.prototype.destroy=function(){this.off(),this.root()}},161:function(t,e,i){var n=i(852);t.exports=function(t){return new n(t)},t.exports.Delegate=n}},e={};function i(n){var s=e[n];if(void 0!==s)return s.exports;var r=e[n]={exports:{}};return t[n](r,r.exports,i),r.exports}!function(){var t="data-js-hook";var e={UP:0,RIGHT:1,DOWN:-1,LEFT:-2};function n(e,i){if(!e)return!1;var n=e.getAttribute(t);return!!n&&(n=n.split(" ")).indexOf(i)>-1}var s="state_atomic_init";function r(e){return!n(e,s)&&(function(e,i){if(-1!==i.indexOf(" "))throw new Error("data-js-hook values cannot contain spaces!");var n=e.getAttribute(t);null!==n&&(i=n+" "+i),e.setAttribute(t,i)}(e,s),!0)}function o(t){return"[object Object]"===Object.prototype.toString.call(t)}function a(t){t=t||{};for(var e=1,i=arguments.length;e<i;e++){var n=arguments[e]||{},s=void 0;for(s in n)if({}.hasOwnProperty.call(n,s)){var r=n[s];o(r)?a(t[s]||(t[s]={}),r):t[s]=r}}return t}var l=function(){var t={};return this.addEventListener=function(e,i){return!{}.hasOwnProperty.call(t,e)?t[e]=[i]:t[e].push(i),this},this.removeEventListener=function(e,i){if(!{}.hasOwnProperty.call(t,e))return this;var n=t[e].indexOf(i);return-1!==n&&t[e].splice(n,1),this},this.dispatchEvent=function(e,i){if(!{}.hasOwnProperty.call(t,e))return this;i=i||{};for(var n=t[e],s=0,r=n.length;s<r;s++)n[s].call(this,i);return this},this.getRegisteredEvents=function(){return t},this};function h(t){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},h(t)}var c=Object.prototype.toString;function u(t){return void 0===t}function d(t){return"[object String]"===c.call(t)}var p={isUndefined:u,isDefined:function(t){return void 0!==t},isObject:function(t){return null!==t&&"object"===h(t)},isString:d,isNumber:function(t){return"[object Number]"===c.call(t)},isDate:function(t){return"[object Date]"===c.call(t)},isArray:Array.isArray||function(t){return"[object Array]"===c.call(t)},isFunction:function(t){return"[object Function]"===c.call(t)},isEmpty:function(t){return u(t)||null===t||d(t)&&t.length<=0||/^\s*$/.test(t)}},f=i(161).Delegate;function v(t,e){this.element=t,this.initializers=[],this.uId=this.uniqueId("ac"),a(this,e),this.processModifiers(),this.ensureElement(),this.setCachedElements(),this.initializers.push(this.initialize)}a(v.prototype,new l,{init:function(){return this.initializers.forEach((function(t){p.isFunction(t)&&t.apply(this,arguments)}),this),this.dispatchEvent("component:initialized"),this},processModifiers:function(){this.modifiers&&this.modifiers.forEach((function(t){var e=t.ui.base.substring(1);this.element.classList.contains(e)&&(t.initialize&&this.initializers.push(t.initialize),a(this,t))}),this)},render:function(){return this},ensureElement:function(){if(this.element)this.setElement(this.element);else{var t=a({},this.attributes);t.id=this.id||this.u_id,this.className&&(t.class=this.className),this.setElement(document.createElement("div")),this.setElementAttributes(t)}r(this.element)},setElement:function(t){return this.element&&this.undelegateEvents(),this.element=t,this.delegateEvents(),this},setCachedElements:function(){var t,e,i=a({},this.ui);for(t in i)({}).hasOwnProperty.call(i,t)&&(1===(e=this.element.querySelectorAll(i[t])).length?i[t]=e[0]:e.length>1?i[t]=e:i[t]=null);return this.ui=i,i},destroy:function(){return this.element&&(this.element.parentNode.removeChild(this.element),this.element.view&&delete this.element.view,delete this.element),this.undelegateEvents(),this.dispatchEvent("component:destroyed"),!0},setElementAttributes:function(t){var e;for(e in t)({}).hasOwnProperty.call(t,e)&&this.element.setAttribute(e,t[e])},delegateEvents:function(t){var e,i,n,s=/^(\S+)\s*(.*)$/;if(!(t=t||(t=this.events)))return this;for(e in this.undelegateEvents(),this._delegate=new f(this.element),t)({}).hasOwnProperty.call(t,e)&&(i=t[e],p.isFunction(this[i])&&(i=this[i]),i&&(n=e.match(s),this.delegate(n[1],n[2],i.bind(this))));return this.dispatchEvent("component:bound"),this},delegate:function(t,e,i){return this._delegate.on(t,e,i),this},undelegateEvents:function(){return this._delegate&&this._delegate.destroy(),this.element.removeAttribute("data-js-hook"),this},uniqueId:function(t){return t+"_"+Math.random().toString(36).substr(2,9)}}),v.init=function(t){var e=function(t,e,i){for(var r,o,a=(i||document).querySelectorAll(t),l=[],h=0,c=a.length;h<c;h++)!1===n(o=a[h],s)&&((r=new e(o)).init(),l.push(r));return l}(this.selector,this,t);return e},v.extend=function(t){function e(){return this._super=v.prototype,v.apply(this,arguments)}return e.prototype=Object.create(v.prototype),a(e.prototype,t),a(e,v),{}.hasOwnProperty.call(t,"ui")&&{}.hasOwnProperty.call(t.ui,"base")&&(e.selector=t.ui.base),e.constants={},e};var m=v;function E(t,e){var i,n,s,r,o,a=e,h=!1,c=!1;if(void 0===a.CSS_PROPERTY||void 0===a.BASE_CLASS)throw new Error("Transitions require CSS_PROPERTY and BASE_CLASS to be passed into BaseTransition.");function u(){i.classList.add(E.ANIMATING_CLASS),h=!0,s&&!i.classList.contains(E.NO_ANIMATION_CLASS)?(i.addEventListener(s,r),this.dispatchEvent(E.BEGIN_EVENT,{target:this})):(this.dispatchEvent(E.BEGIN_EVENT,{target:this}),r())}function d(){i.removeEventListener(s,r)}function p(t){return(!t||t.propertyName===a.CSS_PROPERTY)&&(d(),i.classList.remove(E.ANIMATING_CLASS),this.dispatchEvent(E.END_EVENT,{target:this}),h=!1,!0)}function f(){var t;for(t in a)({}).hasOwnProperty.call(a,t)&&a[t]!==a.BASE_CLASS&&i.classList.contains(a[t])&&i.classList.remove(a[t])}function v(){h&&(i.style.webkitTransitionDuration="0",i.style.mozTransitionDuration="0",i.style.oTransitionDuration="0",i.style.transitionDuration="0",i.removeEventListener(s,r),r(),i.style.webkitTransitionDuration="",i.style.mozTransitionDuration="",i.style.oTransitionDuration="",i.style.transitionDuration="")}function m(){return!!i&&(v(),i.classList.remove(a.BASE_CLASS),f(),!0)}function b(){return i?(i.classList.remove(E.NO_ANIMATION_CLASS),this):this}function g(t){i&&(m(),b()),(i=t).classList.add(a.BASE_CLASS),s=function(t){if(!t)throw new Error("Element does not have TransitionEnd event. It may be null!");var e,i,n={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(i in n)if({}.hasOwnProperty.call(n,i)&&void 0!==t.style[i]){e=n[i];break}return e}(i)}var y=new l;return this.addEventListener=y.addEventListener,this.dispatchEvent=y.dispatchEvent,this.removeEventListener=y.removeEventListener,this.animateOff=function(){return i?(i.classList.add(E.NO_ANIMATION_CLASS),this):this},this.animateOn=b,this.applyClass=function(t){return!!i&&(c||(f(),c=!0),!i.classList.contains(t)&&(d(),i.classList.remove(n),n=t,o(),i.classList.add(n),!0))},this.halt=v,this.init=function(){return r=p.bind(this),o=u.bind(this),g(t),this},this.isAnimated=function(){return!!i&&!i.classList.contains(E.NO_ANIMATION_CLASS)},this.remove=m,this.setElement=g,this}E.BEGIN_EVENT="transitionBegin",E.END_EVENT="transitionEnd",E.NO_ANIMATION_CLASS="u-no-animation",E.ANIMATING_CLASS="u-is-animating";var b=E,g={CSS_PROPERTY:"max-height",BASE_CLASS:"o-expandable_content__transition",EXPANDED:"o-expandable_content__expanded",COLLAPSED:"o-expandable_content__collapsed",OPEN_DEFAULT:"o-expandable_content__onload-open"};function y(t){var e,i=new b(t,g);function n(){t.classList.contains(g.EXPANDED)?(this.dispatchEvent("expandEnd",{target:this}),t.scrollHeight>e&&(t.style.maxHeight=t.scrollHeight+"px")):t.classList.contains(g.COLLAPSED)&&this.dispatchEvent("collapseEnd",{target:this})}var s=new l;return this.addEventListener=s.addEventListener,this.dispatchEvent=s.dispatchEvent,this.removeEventListener=s.removeEventListener,this.animateOff=i.animateOff,this.animateOn=i.animateOn,this.halt=i.halt,this.isAnimated=i.isAnimated,this.setElement=i.setElement,this.remove=i.remove,this.init=function(){return i.init(),i.addEventListener(b.END_EVENT,n.bind(this)),t.classList.contains(g.OPEN_DEFAULT)?this.expand():this.collapse(),this},this.toggleExpandable=function(){return t.classList.contains(g.COLLAPSED)?this.expand():this.collapse(),this},this.collapse=function(){return this.dispatchEvent("collapseBegin",{target:this}),e=t.scrollHeight,t.style.maxHeight="0",i.applyClass(g.COLLAPSED),this},this.expand=function(){return this.dispatchEvent("expandBegin",{target:this}),(!e||t.scrollHeight>e)&&(e=t.scrollHeight),t.style.maxHeight=e+"px",i.applyClass(g.EXPANDED),this},this}y.CLASSES=g;var L=y;function A(t,e){if("closest"in t)return t.closest(e);var i=function(t){return t.matches||t.webkitMatchesSelector||t.mozMatchesSelector||t.msMatchesSelector}(t);try{for(var n,s=t;s;)if(i.bind(s)(e)?n=s:s=s.parentNode,n)return s}catch(t){return null}return null}var S=new l;function _(){this.ui.content.classList.remove("u-hidden")}function x(){this.ui.content.classList.add("u-hidden")}function C(){this.activeAccordion&&(this.transition.toggleExpandable(),this.toggleTargetState(this.ui.target),this.activeAccordion=!1)}var D=m.extend({ui:{base:".o-expandable",target:".o-expandable_target",content:".o-expandable_content",header:".o-expandable_header",label:".o-expandable_label"},classes:{targetExpanded:"o-expandable_target__expanded",targetCollapsed:"o-expandable_target__collapsed",group:"o-expandable-group",groupAccordion:"o-expandable-group__accordion"},events:{"click .o-expandable_target":"expandableClickHandler"},transition:null,isAccordionGroup:!1,activeAccordion:!1,initialize:function(){var t=new L(this.ui.content);this.transition=t.init(),this.transition.addEventListener("expandBegin",_.bind(this)),this.transition.addEventListener("collapseEnd",x.bind(this)),this.ui.content.classList.contains(L.CLASSES.EXPANDED)?this.ui.target.classList.add(this.classes.targetExpanded):(this.ui.target.classList.add(this.classes.targetCollapsed),this.ui.content.classList.add("u-hidden"));var e=A(this.ui.target,"."+this.classes.group);this.isAccordionGroup=null!==e&&e.classList.contains(this.classes.groupAccordion),this.isAccordionGroup&&S.addEventListener("accordionActivated",C.bind(this))},expandableClickHandler:function(){this.transition.toggleExpandable(),this.toggleTargetState(this.ui.target),this.isAccordionGroup&&(this.activeAccordion?this.activeAccordion=!1:(S.dispatchEvent("accordionActivated",{target:this}),this.activeAccordion=!0))},toggleTargetState:function(t){t.classList.contains(this.classes.targetExpanded)?(this.ui.target.classList.add(this.classes.targetCollapsed),this.ui.target.classList.remove(this.classes.targetExpanded)):(this.ui.target.classList.add(this.classes.targetExpanded),this.ui.target.classList.remove(this.classes.targetCollapsed))},getLabelText:function(){return this.ui.label.textContent.trim()}});var w,O={ui:{base:".o-table__row-links"},events:{"click tbody tr":"onRowLinkClick"},onRowLinkClick:function(t){var e=t.target;if(!e||"A"!==e.tagName){var i=(e=A(t.target,"tr")).querySelector("a");i&&(window.location=i.getAttribute("href"))}}};var N={ui:{base:".o-table__sortable",tableBody:"tbody",sortButton:".sorted-up, .sorted-down"},classes:{sortDown:"sorted-down",sortUp:"sorted-up"},events:{"click .sortable":"onSortableClick"},initialize:function(){this.sortClass=w,this.sortColumnIndex=w,this.sortDirection=w,this.tableData=[],this.bindProperties(),this.ui.sortButton&&(this.sortColumnIndex=this.getColumnIndex(),this.sortDirection=e.UP,this.ui.sortButton.classList.contains(this.classes.sortDown)&&(this.sortDirection=e.DOWN),this.updateTable())},bindProperties:function(){var t;Object.defineProperty(this,"sortDirection",{configurable:!0,get:function(){return t},set:function(i){i===e.UP?this.sortClass=this.classes.sortUp:i===e.DOWN&&(this.sortClass=this.classes.sortDown),t=i}})},getColumnIndex:function(t){return A(t||this.ui.sortButton,"td, th").cellIndex},updateTable:function(){return this.updateTableData()&&this.updateTableDom()},updateTableData:function(t){var e,i=this.ui.tableBody.querySelectorAll("tr");this.tableData=[],t=t||this.sortColumnIndex;for(var n=0,s=i.length;n<s;++n)(e=i[n].cells[t])&&(e=e.textContent.trim()),this.tableData.push([e,i[n]]);var r=this.ui.sortButton.getAttribute("data-sort_type");return this.tableData.sort(this.tableDataSorter(this.sortDirection,r)),this.tableData},updateTableDom:function(){for(var t=this.ui.tableBody;t.lastChild;)t.removeChild(t.lastChild);for(var e=document.createDocumentFragment(),i=0;i<this.tableData.length;i++)e.appendChild(this.tableData[i][1]);return t.appendChild(e),this.dispatchEvent("table:updated"),t},tableDataSorter:function(t,i){return function(n,s){var r=t===e.DOWN?-1:1,o=0,a=/[^\d.-]/g;return n=n[0],s=s[0],"number"===i&&(n=Number(n.replace(a,"")),s=Number(s.replace(a,""))),n<s?o=-1*r:n>s&&(o=r),o}},onSortableClick:function(t){return this.ui.sortButton&&this.ui.sortButton.classList.remove(this.sortClass),this.ui.sortButton===t.target?this.sortDirection=~this.sortDirection:(this.ui.sortButton=t.target,this.sortColumnIndex=this.getColumnIndex(),this.sortDirection=e.UP),this.ui.sortButton.classList.add(this.sortClass),this.updateTable(),this}},T=m.extend({ui:{base:".o-table"},modifiers:[N,O]});T.constants.DIRECTIONS=e;var P=T;D.init(),P.init()}()}(); |
{ | ||
"name": "@cfpb/cfpb-design-system", | ||
"version": "0.17.12", | ||
"version": "0.17.14", | ||
"description": "CFPB's UI framework", | ||
@@ -24,16 +24,16 @@ "main": "src/cfpb-design-system.js", | ||
"dependencies": { | ||
"@cfpb/cfpb-atomic-component": "^0.17.9", | ||
"@cfpb/cfpb-buttons": "^0.17.9", | ||
"@cfpb/cfpb-core": "^0.17.9", | ||
"@cfpb/cfpb-expandables": "^0.17.12", | ||
"@cfpb/cfpb-forms": "^0.17.9", | ||
"@cfpb/cfpb-grid": "^0.17.9", | ||
"@cfpb/cfpb-icons": "^0.17.9", | ||
"@cfpb/cfpb-layout": "^0.17.9", | ||
"@cfpb/cfpb-notifications": "^0.17.9", | ||
"@cfpb/cfpb-pagination": "^0.17.9", | ||
"@cfpb/cfpb-tables": "^0.17.9", | ||
"@cfpb/cfpb-typography": "^0.17.9" | ||
"@cfpb/cfpb-atomic-component": "^0.17.14", | ||
"@cfpb/cfpb-buttons": "^0.17.14", | ||
"@cfpb/cfpb-core": "^0.17.14", | ||
"@cfpb/cfpb-expandables": "^0.17.14", | ||
"@cfpb/cfpb-forms": "^0.17.14", | ||
"@cfpb/cfpb-grid": "^0.17.14", | ||
"@cfpb/cfpb-icons": "^0.17.14", | ||
"@cfpb/cfpb-layout": "^0.17.14", | ||
"@cfpb/cfpb-notifications": "^0.17.14", | ||
"@cfpb/cfpb-pagination": "^0.17.14", | ||
"@cfpb/cfpb-tables": "^0.17.14", | ||
"@cfpb/cfpb-typography": "^0.17.14" | ||
}, | ||
"gitHead": "9d907ced535ee4ead998629df126884d5b97ff33" | ||
"gitHead": "887291915f64eb35d804fb7ec7d010e81c2bee8d" | ||
} |
@@ -11,3 +11,2 @@ # CFPB's Design System [](https://travis-ci.org/cfpb/design-system) [](https://www.npmjs.com/package/design-system) | ||
## Getting involved | ||
@@ -23,4 +22,5 @@ | ||
## Open source licensing info | ||
1. [TERMS](TERMS.md) | ||
2. [LICENSE](LICENSE) | ||
3. [CFPB Source Code Policy](https://github.com/cfpb/source-code-policy/) |
13
TERMS.md
@@ -14,6 +14,5 @@ As a work of the United States Government, this package is in the | ||
## CC0 1.0 Universal Summary | ||
This is a human-readable summary of the [Legal Code (read the full text)][CC0]. | ||
This is a human-readable summary of the [Legal Code (read the full text)][cc0]. | ||
@@ -27,3 +26,3 @@ ### No Copyright | ||
You can copy, modify, distribute and perform the work, even for commercial | ||
You can copy, modify, distribute and perform the work, even for commercial | ||
purposes, all without asking permission. See Other Information below. | ||
@@ -44,8 +43,8 @@ | ||
[policy]: https://github.com/cfpb/design-system/blob/main/TERMS.md | ||
[CC0]: http://creativecommons.org/publicdomain/zero/1.0/legalcode | ||
[cc0]: http://creativecommons.org/publicdomain/zero/1.0/legalcode | ||
## This project makes use of: | ||
* [Respond.js](https://github.com/scottjehl/Respond) by Scott Jehl, licensed under the MIT license. | ||
* [The HTML5 Shiv](https://github.com/aFarkas/html5shiv), dual licensed under the MIT or GPL Version 2 licenses. | ||
* | ||
- [Respond.js](https://github.com/scottjehl/Respond) by Scott Jehl, licensed under the MIT license. | ||
- [The HTML5 Shiv](https://github.com/aFarkas/html5shiv), dual licensed under the MIT or GPL Version 2 licenses. | ||
- |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
148396
5035
1
Updated@cfpb/cfpb-buttons@^0.17.14
Updated@cfpb/cfpb-core@^0.17.14
Updated@cfpb/cfpb-forms@^0.17.14
Updated@cfpb/cfpb-grid@^0.17.14
Updated@cfpb/cfpb-icons@^0.17.14
Updated@cfpb/cfpb-layout@^0.17.14
Updated@cfpb/cfpb-tables@^0.17.14