ratchet_design 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1fc2311dc5080095eb03f2876cb7686e0794990d
4
- data.tar.gz: ec3de307313bbfc214f314d2bb7e4fa711c14cc0
3
+ metadata.gz: 5d2320e24c510e2e6703b715afa95bcd04b706e7
4
+ data.tar.gz: 1fba8086569909bace533d6c966f620d69e95dfa
5
5
  SHA512:
6
- metadata.gz: 78e33fe9a6155c349c6b881c495a2e8ac68a76d8e8e67a4edcb865e142b03ebfa94bd814e7d6e2159c05c100eed2cd4adf1257ad7a59bf01c4b1e32d64b7300d
7
- data.tar.gz: ed6ea44d5c4e7b1d62cf0375fa1f9fe7f89c3e6d39e0a3e511aae628b7206debbbad7753184071f1467fed7331ef07f229e4860180adcb855de720b90bc77cb2
6
+ metadata.gz: 4699c0e4c66e216bb29999e88259871a35f65d4014d998486d5a45de9f1172c934b15887e04a912c7b82226c3fd1a572450017e85da617a50dc6e046cb5c8186
7
+ data.tar.gz: ad613599b9c83604a992d12cb1ac09ca154a46c9b78a20673b9f28c80704dc8cbfa25f01ce563d569bdd9935b177378cd3cb82f8bbe11ee6fa40cd1ea94924c7
@@ -1,3 +1,3 @@
1
1
  module RatchetDesign
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -99,7 +99,7 @@ var validation=require("./lib/validation"),progressive=require("./lib/progressiv
99
99
  },{"./lib/progressive":48,"./lib/validation":49}],48:[function(require,module,exports){
100
100
  function reset(){formCallbacks={next:[]},registerdForms=[]}function newForm(e){function t(){return l[s]}function o(){return l[s+1]}function n(){return t()&&!t().disabled}function r(e){return n()?c(function(){r(e)}):void(o()&&(s+=1,e?Event.delay(a,e):a()))}function i(e){e?Event.delay(a,e):a()}function c(e){t().classList.remove("step-visited","arrived"),t().classList.add("departed"),Event.afterAnimation(t(),function(){f(),"function"==typeof e&&e()})}function a(){t().disabled=!1,t().classList.add("arrived");var e=t().querySelector("input:not([hidden])");e&&e.focus()}function f(){t().disabled=!0,t().classList.add("step-visited"),t().classList.remove("departed","arrived")}if(e){var l=toolbox.slice(e.querySelectorAll(".form-step")),s=-1;0!=l.length&&(l.forEach(function(e){e.disabled=!0}),r(),registerdForms.push(function(n){if(e==n.target&&!t().querySelector(":invalid")){o()&&n.preventDefault();var a=getCallbacks(e);a?(n.preventDefault(),c(function(){a(n,{fieldset:t(),form:e,forward:r,back:i,complete:!!o(),formData:toolbox.formData(t())})})):r()}}))}}function fire(e){registerdForms.forEach(function(t){t(e)})}function getCallbacks(e,t){t=t||"next";var o,n=[];return formCallbacks[t].forEach(function(t){(o=t(e))&&n.push(o)}),!!n.length&&function(){var e=toolbox.slice(arguments);n.forEach(function(t){t.apply(t,e)})}}function next(e,t){on(e,"next",t)}function on(e,t,o){if("object"==typeof t)for(type in t)on(e,type,t[type]);else if(formCallbacks[t]){var n=function(t){if(t==e)return o};formCallbacks[t].push(n)}}var toolbox=require("compose-toolbox"),Event=toolbox.event,Callback=toolbox.event.callback,formSelector="form.progressive",watching=!1,formCallbacks,registerdForms;Event.ready(function(){reset(),Event.bubbleFormEvents(),Event.on(document,"submit",formSelector,fire),Event.change(function(){reset(),toolbox.each(document.querySelectorAll(formSelector),function(e){newForm(e)})})}),module.exports={next:next,new:newForm};
101
101
  },{"compose-toolbox":51}],49:[function(require,module,exports){
102
- function supported(){return"function"==typeof document.createElement("input").checkValidity}function validateForm(e){var t=e.querySelector("input:invalid, textarea:invalid, select:invalid");return!t||(checkInput(t),showMessage(t),focus(t),!1)}function checkInput(e,t){var a=statusEl(e),n=isValid(e),o=!n&&"input"==t;o&&e==document.activeElement?a.classList.remove("invalid","valid"):(a.classList.toggle("invalid",!n),a.classList.toggle("valid",n))}function isValid(e){return e.value.replace(/\s/g,"").length||(e.value=""),e.dataset.minWords&&checkCount(e,"min"),e.dataset.maxWords&&checkCount(e,"max"),e.checkValidity()}function checkCount(e,t){var a=e.dataset[t+"Words"],n=wordCount(e.value)<a,o="min"==t?"at least ":"no more than ",i="min"==t?!n:n,s="";e.value&&!i&&(s="Please write "+o+a+" words."),e.setCustomValidity(s)}function statusEl(e){return getClosest(e,"label")||e}function focus(e){e="none"!==e.style.display?e:e.nextSibling,e.focus()}function submit(e){validateForm(e.target)||(checkValidation.stop(),Event.delay(checkValidation.start,500),e.preventDefault())}function hideMessage(e){var t=getClosest(e,"form"),a=t.querySelector(".validation-message");a&&a.parentNode.removeChild(a)}function showMessage(e){hideMessage(e);var t=getClosest(e,"label"),a=e.dataset.message||e.validationMessage;t&&t.insertAdjacentHTML("beforeend",'<aside class="validation-message"><p>'+a+"</p></aside>")}var toolbox=require("compose-toolbox"),Event=toolbox.event,matches=toolbox.matches,getClosest=toolbox.getClosest,wordCount=toolbox.wordCount,textSelectors="[required]";Event.ready(function(){supported()&&(Event.bubbleFormEvents(),Event.on(document.body,{invalid:function(e){e.preventDefault()},submit:submit}),Event.on(document,"blur","[required]",checkValidation),Event.on(document,"input","[required]",Event.debounce(checkValidation,200)))});var checkValidation=Event.callback.new(function(e){hideMessage(e.target),checkInput(e.target,e.type)});module.exports={validate:validateForm};
102
+ function supported(){return"function"==typeof document.createElement("input").checkValidity}function validateForm(e){var t=e.querySelector("input:invalid, textarea:invalid, select:invalid");return!t||(checkInput(t),showMessage(t),focus(t),!1)}function checkInput(e,t){var a=statusEl(e),n=isValid(e),i=!n&&"input"==t;i&&e==document.activeElement?a.classList.remove("invalid","valid"):(a.classList.toggle("invalid",!n),a.classList.toggle("valid",n))}function isValid(e){e.value.replace(/\s/g,"").length||(e.value="");var t=checkCount(e,"min")||checkCount(e,"max")||checkValue(e)||"";return e.setCustomValidity(t),e.checkValidity()}function checkValue(e){var t=e.dataset.invalidValue;if(t&&e.value.match(new RegExp("^"+t+"$","i")))return e.dataset.invalidValueMessage||"Cannot equal '"+t+"'"}function checkCount(e,t){var a=e.dataset[t+"Words"];if(a){var n=wordCount(e.value)<a;if(phrasing="min"==t?"at least ":"no more than ",valid="min"==t?!n:n,e.value&&!valid)return"Please write "+phrasing+a+" words."}}function statusEl(e){return getClosest(e,"label")||e}function focus(e){e="none"!==e.style.display?e:e.nextSibling,e.focus()}function submit(e){validateForm(e.target)||(checkValidation.stop(),Event.delay(checkValidation.start,500),e.preventDefault())}function hideMessage(e){var t=getClosest(e,"form"),a=t.querySelector(".validation-message");a&&a.parentNode.removeChild(a)}function showMessage(e){hideMessage(e);var t=getClosest(e,"label"),a=e.dataset.message||e.validationMessage;t&&t.insertAdjacentHTML("beforeend",'<aside class="validation-message"><p>'+a+"</p></aside>")}var toolbox=require("compose-toolbox"),Event=toolbox.event,matches=toolbox.matches,getClosest=toolbox.getClosest,wordCount=toolbox.wordCount,textSelectors="[required]";Event.ready(function(){supported()&&(Event.bubbleFormEvents(),document.addEventListener("invalid",function(e){e.preventDefault()},!0),Event.on(document.body,"submit",submit),Event.on(document,"blur","[required]",checkValidation),Event.on(document,"input","[required]",Event.debounce(checkValidation,200)))});var checkValidation=Event.callback.new(function(e){hideMessage(e.target),checkInput(e.target,e.type)});module.exports={validate:validateForm};
103
103
  },{"compose-toolbox":51}],50:[function(require,module,exports){
104
104
  var classify=function(e){return"."+e.replace(/\s/g,".")},Loader={options:{className:"loader"},init:function(){return Loader.element()||document.body.insertAdjacentHTML("afterbegin",'<div class="'+Loader.options.className+'"></div>'),Loader.element()},element:function(){return document.querySelector(classify(Loader.options.className))},loading:function(e){Loader.show(e||"Hang tight…","loading")},success:function(e){Loader.show(e||"Got it!","success")},failure:function(e){Loader.show(e||"Hold up!","failure")},show:function(e,o){el=Loader.init(),el.textContent=e,el.className=Loader.options.className,el.classList.add(o)},remove:function(){var e=Loader.element();e.parentNode.removeChild(e)}};module.exports=Loader;
105
105
  },{}],51:[function(require,module,exports){
@@ -130,4 +130,4 @@ function request(e,n,t){return"function"==typeof t?new e("GET",n).end(t):2==argu
130
130
  });
131
131
 
132
132
 
133
- //# sourceMappingURL=/assets/ratchet/core-0.1.3.map.json
133
+ //# sourceMappingURL=/assets/ratchet/core-0.1.4.map.json