ratchet_design 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f6297919184307b0129029a416712ee65e6c1d94
4
- data.tar.gz: 83c451f5339b4c0f4e83959962459f6733a618b9
3
+ metadata.gz: 1fc2311dc5080095eb03f2876cb7686e0794990d
4
+ data.tar.gz: ec3de307313bbfc214f314d2bb7e4fa711c14cc0
5
5
  SHA512:
6
- metadata.gz: d5dc301107da8ff1a7f52a96e9e3d183d6adb48605c11a71d8546bb6942aa60f3e7885fe4594a5cf2546a1e268c5781bd7eeedd4516eaaafbdce903370b4f2e7
7
- data.tar.gz: 80fb37a9190e8ad60ad1aef7c89efa0c74aaa5f7e747a469635a7bcc63f23e71cfe1de0094cc0e895a7d34b612d734598012c10b903924080e28e1ada1962d87
6
+ metadata.gz: 78e33fe9a6155c349c6b881c495a2e8ac68a76d8e8e67a4edcb865e142b03ebfa94bd814e7d6e2159c05c100eed2cd4adf1257ad7a59bf01c4b1e32d64b7300d
7
+ data.tar.gz: ed6ea44d5c4e7b1d62cf0375fa1f9fe7f89c3e6d39e0a3e511aae628b7206debbbad7753184071f1467fed7331ef07f229e4860180adcb855de720b90bc77cb2
@@ -531,7 +531,7 @@ button[type=submit] {
531
531
  * ------------------------------------- */
532
532
 
533
533
  // Apply validation styles to inputs & textareas
534
- textarea, #{$text-inputs} {
534
+ textarea, #{$text-inputs}, select {
535
535
 
536
536
  // Strip default styling
537
537
  &:invalid {
@@ -1,3 +1,3 @@
1
1
  module RatchetDesign
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
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");return!t||(checkInput(t),showMessage(t),focus(t),!1)}function checkInput(e,t){var o=statusEl(e),a=isValid(e),n=!a&&"keydown"==t;n&&e==document.activeElement?o.classList.remove("invalid","valid"):(o.classList.toggle("invalid",!a),o.classList.toggle("valid",a))}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 o=e.dataset[t+"Words"],a=wordCount(e.value)<o,n="min"==t?"at least ":"no more than ",i="min"==t?!a:a,s="";e.value&&!i&&(s="Please write "+n+o+" 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"),o=t.querySelector(".validation-message");o&&o.parentNode.removeChild(o)}function showMessage(e){hideMessage(e);var t=getClosest(e,"label"),o=e.dataset.message||e.validationMessage;t&&t.insertAdjacentHTML("beforeend",'<aside class="validation-message"><p>'+o+"</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,"keydown","[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),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};
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.2.map.json
133
+ //# sourceMappingURL=/assets/ratchet/core-0.1.3.map.json