@wework/ray-core
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -6,2 +6,13 @@ # Change Log | ||
## [1.3.1](https://github.com/wework/ray/compare/@wework/ray-core@1.3.0...@wework/ray-core@1.3.1) (2019-05-10) | ||
### Bug Fixes | ||
* add required support for labels ([#87](https://github.com/wework/ray/issues/87)) ([70675de](https://github.com/wework/ray/commit/70675de)) | ||
# [1.3.0](https://github.com/wework/ray/compare/@wework/ray-core@1.2.0...@wework/ray-core@1.3.0) (2019-05-10) | ||
@@ -8,0 +19,0 @@ |
export var CSS_CLASSES = { | ||
ACTIVE: 'ray-select--active', | ||
REQUIRED: 'ray-select--required', | ||
HAS_VALUE: 'ray-select--has-value', | ||
@@ -4,0 +5,0 @@ PLACEHOLDER_MODE: 'ray-select--placeholder-mode', |
@@ -98,2 +98,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
}, { | ||
key: "isRequired", | ||
value: function isRequired() { | ||
return this._inputElement.required; | ||
} | ||
}, { | ||
key: "value", | ||
@@ -129,2 +134,8 @@ value: function value() { | ||
} | ||
if (this.isRequired()) { | ||
this._root.classList.add(this.constructor.cssClasses.REQUIRED); | ||
} else { | ||
this._root.classList.remove(this.constructor.cssClasses.REQUIRED); | ||
} | ||
} | ||
@@ -131,0 +142,0 @@ }, { |
@@ -5,2 +5,3 @@ export var CSS_CLASSES = { | ||
ACTIVE: 'ray-text-field--active', | ||
REQUIRED: 'ray-text-field--required', | ||
EL__INPUT: 'ray-text-field__input', | ||
@@ -13,2 +14,3 @@ EL__LABEL: 'ray-text-field__label', | ||
ACTIVE: 'ray-text-area--active', | ||
REQUIRED: 'ray-text-area--required', | ||
EL__INPUT: 'ray-text-area__input', | ||
@@ -15,0 +17,0 @@ EL__LABEL: 'ray-text-area__label', |
@@ -108,2 +108,7 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
}, { | ||
key: "isRequired", | ||
value: function isRequired() { | ||
return this._inputElement.required; | ||
} | ||
}, { | ||
key: "set", | ||
@@ -121,2 +126,8 @@ value: function set(value) { | ||
} | ||
if (this.isRequired()) { | ||
this._root.classList.add(this.constructor.cssClasses.REQUIRED); | ||
} else { | ||
this._root.classList.remove(this.constructor.cssClasses.REQUIRED); | ||
} | ||
} | ||
@@ -123,0 +134,0 @@ }, { |
{ | ||
"name": "@wework/ray-core", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"main": "umd/index.js", | ||
@@ -77,3 +77,3 @@ "module": "es/index.js", | ||
], | ||
"gitHead": "ff1fd852666ddaf3cfced8cb0bc509b0cd4b078e", | ||
"gitHead": "3d0e76efddc6977ffaabe2c04c4c6e152350bb8f", | ||
"keywords": [ | ||
@@ -80,0 +80,0 @@ "wework", |
@@ -177,2 +177,3 @@ this.Ray = this.Ray || {}; | ||
ACTIVE: 'ray-select--active', | ||
REQUIRED: 'ray-select--required', | ||
HAS_VALUE: 'ray-select--has-value', | ||
@@ -277,2 +278,7 @@ PLACEHOLDER_MODE: 'ray-select--placeholder-mode', | ||
}, { | ||
key: "isRequired", | ||
value: function isRequired() { | ||
return this._inputElement.required; | ||
} | ||
}, { | ||
key: "value", | ||
@@ -308,2 +314,8 @@ value: function value() { | ||
} | ||
if (this.isRequired()) { | ||
this._root.classList.add(this.constructor.cssClasses.REQUIRED); | ||
} else { | ||
this._root.classList.remove(this.constructor.cssClasses.REQUIRED); | ||
} | ||
} | ||
@@ -334,2 +346,3 @@ }, { | ||
ACTIVE: 'ray-text-field--active', | ||
REQUIRED: 'ray-text-field--required', | ||
EL__INPUT: 'ray-text-field__input', | ||
@@ -342,2 +355,3 @@ EL__LABEL: 'ray-text-field__label', | ||
ACTIVE: 'ray-text-area--active', | ||
REQUIRED: 'ray-text-area--required', | ||
EL__INPUT: 'ray-text-area__input', | ||
@@ -439,2 +453,7 @@ EL__LABEL: 'ray-text-area__label', | ||
}, { | ||
key: "isRequired", | ||
value: function isRequired() { | ||
return this._inputElement.required; | ||
} | ||
}, { | ||
key: "set", | ||
@@ -452,2 +471,8 @@ value: function set(value) { | ||
} | ||
if (this.isRequired()) { | ||
this._root.classList.add(this.constructor.cssClasses.REQUIRED); | ||
} else { | ||
this._root.classList.remove(this.constructor.cssClasses.REQUIRED); | ||
} | ||
} | ||
@@ -454,0 +479,0 @@ }, { |
@@ -1,2 +0,2 @@ | ||
this.Ray=this.Ray||{},this.Ray.Core=function(e){"use strict";var E=require("./_ctx"),t=require("./_export"),_=require("./_to-object"),f=require("./_iter-call"),d=require("./_is-array-iter"),v=require("./_to-length"),y=require("./_create-property"),p=require("./core.get-iterator-method");t(t.S+t.F*!require("./_iter-detect")(function(e){}),"Array",{from:function(e){var t,n,s,r,i=_(e),o="function"==typeof this?this:Array,c=arguments.length,u=1<c?arguments[1]:void 0,a=void 0!==u,l=0,h=p(i);if(a&&(u=E(u,2<c?arguments[2]:void 0,2)),null==h||o==Array&&d(h))for(n=new o(t=v(i.length));l<t;l++)y(n,l,a?u(i[l],l):i[l]);else for(r=h.call(i),n=new o;!(s=r.next()).done;l++)y(n,l,a?f(r,u,[s.value,l],!0):s.value);return n.length=l,n}});var n=require("./_export"),s=require("./_string-context"),r="includes";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function c(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},s=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(s=s.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),s.forEach(function(e){u(t,e,n[e])})}return t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&L(e,t)}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function L(e,t){return(L=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function m(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}n(n.P+n.F*require("./_fails-is-regexp")(r),"String",{includes:function(e){return!!~s(this,e,r).indexOf(e,1<arguments.length?arguments[1]:void 0)}});var g={ACTIVE:"ray-select--active",HAS_VALUE:"ray-select--has-value",PLACEHOLDER_MODE:"ray-select--placeholder-mode",EL__INPUT:"ray-select__input"},A={INIT_SELECTOR:".ray-select"};function C(e){if(e.nodeType!==Node.ELEMENT_NODE&&e.nodeType!==Node.DOCUMENT_NODE)throw new TypeError("DOM document or DOM element should be given to search for and initialize this widget.")}var b=function(){function n(e){var t=this;if(i(this,n),u(this,"onFocus",function(){t._root.classList.add(t.constructor.cssClasses.ACTIVE)}),u(this,"onBlur",function(){t._root.classList.remove(t.constructor.cssClasses.ACTIVE)}),u(this,"onChange",function(){t.assignClasses()}),u(this,"_getCurrentValueOptionElement",function(){return t._inputElement.options[t._inputElement.selectedIndex]}),this._root=e,this._inputElement=this._root.querySelector(".".concat(this.constructor.cssClasses.EL__INPUT)),!this._inputElement)throw new Error("Select must have an input element with a class of .".concat(this.constructor.cssClasses.EL__INPUT));this._bindEventListeners(),this.assignClasses(),this.constructor.instances.set(this._root,this)}return c(n,null,[{key:"create",value:function(e,t){return this.instances.get(e)||new this(e,t)}},{key:"createAll",value:function(){var t=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},s=a({initSelector:this.strings.INIT_SELECTOR},n);C(e),Array.from(e.querySelectorAll(s.initSelector)).forEach(function(e){return t.create(e,s)})}},{key:"cssClasses",get:function(){return g}},{key:"strings",get:function(){return A}}]),c(n,[{key:"_bindEventListeners",value:function(){this._inputElement.addEventListener("focus",this.onFocus),this._inputElement.addEventListener("blur",this.onBlur),this._inputElement.addEventListener("change",this.onChange)}},{key:"value",value:function(){return this._inputElement.value}},{key:"set",value:function(e){this._inputElement.value=e,this._inputElement.dispatchEvent(new Event("change"))}},{key:"assignClasses",value:function(){var e=this._getCurrentValueOptionElement();e&&e.innerHTML?e.dataset.rayPlaceholder?(this._root.classList.add(this.constructor.cssClasses.PLACEHOLDER_MODE),this._root.classList.remove(this.constructor.cssClasses.HAS_VALUE)):(this._root.classList.add(this.constructor.cssClasses.HAS_VALUE),this._root.classList.remove(this.constructor.cssClasses.PLACEHOLDER_MODE)):this._root.classList.remove(this.constructor.cssClasses.PLACEHOLDER_MODE,this.constructor.cssClasses.HAS_VALUE)}},{key:"destroy",value:function(){this._inputElement.removeEventListener("focus",this.onFocus),this._inputElement.removeEventListener("blur",this.onBlur),this._inputElement.removeEventListener("change",this.onChange),this.constructor.instances.delete(this._root)}}]),n}();u(b,"instances",new WeakMap);var T={BASE:"ray-text-field",ACTIVE:"ray-text-field--active",EL__INPUT:"ray-text-field__input",EL__LABEL:"ray-text-field__label",HAS_VALUE:"ray-text-field--has-value"},O={BASE:"ray-text-area",ACTIVE:"ray-text-area--active",EL__INPUT:"ray-text-area__input",EL__LABEL:"ray-text-area__label",HAS_VALUE:"ray-text-area--has-value"},w={TEXT_FIELD:{INIT_SELECTOR:".".concat(T.BASE)},TEXT_AREA:{INIT_SELECTOR:".".concat(O.BASE)}},S=function(){function n(e){var t=this;if(i(this,n),u(this,"onMousedown",function(e){e.preventDefault(),t._inputElement.focus()}),u(this,"onFocus",function(){t._root.classList.add(t.constructor.cssClasses.ACTIVE)}),u(this,"onBlur",function(){t._root.classList.remove(t.constructor.cssClasses.ACTIVE),t.assignClasses()}),this._root=e,this._inputElement=this._root.querySelector(".".concat(this.constructor.cssClasses.EL__INPUT)),this._labelElement=this._root.querySelector(".".concat(this.constructor.cssClasses.EL__LABEL)),!this._inputElement)throw new Error("TextField must have an input element with a class of .".concat(this.constructor.cssClasses.EL__INPUT));this.assignClasses(),this._bindEventListeners(),this.constructor.instances.set(this._root,this)}return c(n,null,[{key:"create",value:function(e,t){return this.instances.get(e)||new this(e,t)}},{key:"createAll",value:function(){var t=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},s=a({initSelector:this.strings.INIT_SELECTOR},n);C(e),Array.from(e.querySelectorAll(s.initSelector)).forEach(function(e){return t.create(e,s)})}}]),c(n,[{key:"_bindEventListeners",value:function(){this._inputElement.addEventListener("focus",this.onFocus),this._inputElement.addEventListener("blur",this.onBlur),this._labelElement.addEventListener("mousedown",this.onMousedown)}},{key:"value",value:function(){return this._inputElement.value}},{key:"set",value:function(e){this._inputElement.value=e}},{key:"assignClasses",value:function(){this.value()?this._root.classList.add(this.constructor.cssClasses.HAS_VALUE):this._root.classList.remove(this.constructor.cssClasses.HAS_VALUE)}},{key:"destroy",value:function(){this._inputElement.removeEventListener("focus",this.onFocus),this._inputElement.removeEventListener("blur",this.onBlur),this._labelElement.removeEventListener("mousedown",this.onMousedown),this.constructor.instances.delete(this._root)}}]),n}(),k=function(e){function t(){return i(this,t),m(this,h(t).apply(this,arguments))}return l(t,S),c(t,null,[{key:"cssClasses",get:function(){return T}},{key:"strings",get:function(){return w.TEXT_FIELD}}]),t}();u(k,"instances",new WeakMap);var I=function(e){function t(){return i(this,t),m(this,h(t).apply(this,arguments))}return l(t,S),c(t,null,[{key:"cssClasses",get:function(){return O}},{key:"strings",get:function(){return w.TEXT_AREA}}]),t}();u(I,"instances",new WeakMap);var x=Object.freeze({Select:b,TextField:k,TextArea:I});function P(){Object.keys(x).forEach(function(e){var t=x[e];t.createAll&&t.createAll()})}return"undefined"!=typeof window&&"undefined"!=typeof document&&("complete"===document.readyState||"loaded"===document.readyState||"interactive"===document.readyState?P():window.addEventListener("DOMContentLoaded",P)),e.Select=b,e.TextArea=I,e.TextField=k,e.settings={prefix:"ray-",breakpointsInPixels:{phone:0,tablet:600,desktop:1195}},e}({}); | ||
this.Ray=this.Ray||{},this.Ray.Core=function(e){"use strict";var E=require("./_ctx"),t=require("./_export"),_=require("./_to-object"),f=require("./_iter-call"),d=require("./_is-array-iter"),v=require("./_to-length"),y=require("./_create-property"),p=require("./core.get-iterator-method");t(t.S+t.F*!require("./_iter-detect")(function(e){}),"Array",{from:function(e){var t,s,n,r,i=_(e),o="function"==typeof this?this:Array,c=arguments.length,u=1<c?arguments[1]:void 0,a=void 0!==u,l=0,h=p(i);if(a&&(u=E(u,2<c?arguments[2]:void 0,2)),null==h||o==Array&&d(h))for(s=new o(t=v(i.length));l<t;l++)y(s,l,a?u(i[l],l):i[l]);else for(r=h.call(i),s=new o;!(n=r.next()).done;l++)y(s,l,a?f(r,u,[n.value,l],!0):n.value);return s.length=l,s}});var s=require("./_export"),n=require("./_string-context"),r="includes";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var s=0;s<t.length;s++){var n=t[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function c(e,t,s){return t&&o(e.prototype,t),s&&o(e,s),e}function u(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}function a(t){for(var e=1;e<arguments.length;e++){var s=null!=arguments[e]?arguments[e]:{},n=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(s).filter(function(e){return Object.getOwnPropertyDescriptor(s,e).enumerable}))),n.forEach(function(e){u(t,e,s[e])})}return t}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&L(e,t)}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function L(e,t){return(L=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function m(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}s(s.P+s.F*require("./_fails-is-regexp")(r),"String",{includes:function(e){return!!~n(this,e,r).indexOf(e,1<arguments.length?arguments[1]:void 0)}});var C={ACTIVE:"ray-select--active",REQUIRED:"ray-select--required",HAS_VALUE:"ray-select--has-value",PLACEHOLDER_MODE:"ray-select--placeholder-mode",EL__INPUT:"ray-select__input"},g={INIT_SELECTOR:".ray-select"};function A(e){if(e.nodeType!==Node.ELEMENT_NODE&&e.nodeType!==Node.DOCUMENT_NODE)throw new TypeError("DOM document or DOM element should be given to search for and initialize this widget.")}var b=function(){function s(e){var t=this;if(i(this,s),u(this,"onFocus",function(){t._root.classList.add(t.constructor.cssClasses.ACTIVE)}),u(this,"onBlur",function(){t._root.classList.remove(t.constructor.cssClasses.ACTIVE)}),u(this,"onChange",function(){t.assignClasses()}),u(this,"_getCurrentValueOptionElement",function(){return t._inputElement.options[t._inputElement.selectedIndex]}),this._root=e,this._inputElement=this._root.querySelector(".".concat(this.constructor.cssClasses.EL__INPUT)),!this._inputElement)throw new Error("Select must have an input element with a class of .".concat(this.constructor.cssClasses.EL__INPUT));this._bindEventListeners(),this.assignClasses(),this.constructor.instances.set(this._root,this)}return c(s,null,[{key:"create",value:function(e,t){return this.instances.get(e)||new this(e,t)}},{key:"createAll",value:function(){var t=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document,s=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=a({initSelector:this.strings.INIT_SELECTOR},s);A(e),Array.from(e.querySelectorAll(n.initSelector)).forEach(function(e){return t.create(e,n)})}},{key:"cssClasses",get:function(){return C}},{key:"strings",get:function(){return g}}]),c(s,[{key:"_bindEventListeners",value:function(){this._inputElement.addEventListener("focus",this.onFocus),this._inputElement.addEventListener("blur",this.onBlur),this._inputElement.addEventListener("change",this.onChange)}},{key:"isRequired",value:function(){return this._inputElement.required}},{key:"value",value:function(){return this._inputElement.value}},{key:"set",value:function(e){this._inputElement.value=e,this._inputElement.dispatchEvent(new Event("change"))}},{key:"assignClasses",value:function(){var e=this._getCurrentValueOptionElement();e&&e.innerHTML?e.dataset.rayPlaceholder?(this._root.classList.add(this.constructor.cssClasses.PLACEHOLDER_MODE),this._root.classList.remove(this.constructor.cssClasses.HAS_VALUE)):(this._root.classList.add(this.constructor.cssClasses.HAS_VALUE),this._root.classList.remove(this.constructor.cssClasses.PLACEHOLDER_MODE)):this._root.classList.remove(this.constructor.cssClasses.PLACEHOLDER_MODE,this.constructor.cssClasses.HAS_VALUE),this.isRequired()?this._root.classList.add(this.constructor.cssClasses.REQUIRED):this._root.classList.remove(this.constructor.cssClasses.REQUIRED)}},{key:"destroy",value:function(){this._inputElement.removeEventListener("focus",this.onFocus),this._inputElement.removeEventListener("blur",this.onBlur),this._inputElement.removeEventListener("change",this.onChange),this.constructor.instances.delete(this._root)}}]),s}();u(b,"instances",new WeakMap);var T={BASE:"ray-text-field",ACTIVE:"ray-text-field--active",REQUIRED:"ray-text-field--required",EL__INPUT:"ray-text-field__input",EL__LABEL:"ray-text-field__label",HAS_VALUE:"ray-text-field--has-value"},O={BASE:"ray-text-area",ACTIVE:"ray-text-area--active",REQUIRED:"ray-text-area--required",EL__INPUT:"ray-text-area__input",EL__LABEL:"ray-text-area__label",HAS_VALUE:"ray-text-area--has-value"},w={TEXT_FIELD:{INIT_SELECTOR:".".concat(T.BASE)},TEXT_AREA:{INIT_SELECTOR:".".concat(O.BASE)}},S=function(){function s(e){var t=this;if(i(this,s),u(this,"onMousedown",function(e){e.preventDefault(),t._inputElement.focus()}),u(this,"onFocus",function(){t._root.classList.add(t.constructor.cssClasses.ACTIVE)}),u(this,"onBlur",function(){t._root.classList.remove(t.constructor.cssClasses.ACTIVE),t.assignClasses()}),this._root=e,this._inputElement=this._root.querySelector(".".concat(this.constructor.cssClasses.EL__INPUT)),this._labelElement=this._root.querySelector(".".concat(this.constructor.cssClasses.EL__LABEL)),!this._inputElement)throw new Error("TextField must have an input element with a class of .".concat(this.constructor.cssClasses.EL__INPUT));this.assignClasses(),this._bindEventListeners(),this.constructor.instances.set(this._root,this)}return c(s,null,[{key:"create",value:function(e,t){return this.instances.get(e)||new this(e,t)}},{key:"createAll",value:function(){var t=this,e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document,s=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},n=a({initSelector:this.strings.INIT_SELECTOR},s);A(e),Array.from(e.querySelectorAll(n.initSelector)).forEach(function(e){return t.create(e,n)})}}]),c(s,[{key:"_bindEventListeners",value:function(){this._inputElement.addEventListener("focus",this.onFocus),this._inputElement.addEventListener("blur",this.onBlur),this._labelElement.addEventListener("mousedown",this.onMousedown)}},{key:"value",value:function(){return this._inputElement.value}},{key:"isRequired",value:function(){return this._inputElement.required}},{key:"set",value:function(e){this._inputElement.value=e}},{key:"assignClasses",value:function(){this.value()?this._root.classList.add(this.constructor.cssClasses.HAS_VALUE):this._root.classList.remove(this.constructor.cssClasses.HAS_VALUE),this.isRequired()?this._root.classList.add(this.constructor.cssClasses.REQUIRED):this._root.classList.remove(this.constructor.cssClasses.REQUIRED)}},{key:"destroy",value:function(){this._inputElement.removeEventListener("focus",this.onFocus),this._inputElement.removeEventListener("blur",this.onBlur),this._labelElement.removeEventListener("mousedown",this.onMousedown),this.constructor.instances.delete(this._root)}}]),s}(),I=function(e){function t(){return i(this,t),m(this,h(t).apply(this,arguments))}return l(t,S),c(t,null,[{key:"cssClasses",get:function(){return T}},{key:"strings",get:function(){return w.TEXT_FIELD}}]),t}();u(I,"instances",new WeakMap);var R=function(e){function t(){return i(this,t),m(this,h(t).apply(this,arguments))}return l(t,S),c(t,null,[{key:"cssClasses",get:function(){return O}},{key:"strings",get:function(){return w.TEXT_AREA}}]),t}();u(R,"instances",new WeakMap);var k=Object.freeze({Select:b,TextField:I,TextArea:R});function x(){Object.keys(k).forEach(function(e){var t=k[e];t.createAll&&t.createAll()})}return"undefined"!=typeof window&&"undefined"!=typeof document&&("complete"===document.readyState||"loaded"===document.readyState||"interactive"===document.readyState?x():window.addEventListener("DOMContentLoaded",x)),e.Select=b,e.TextArea=R,e.TextField=I,e.settings={prefix:"ray-",breakpointsInPixels:{phone:0,tablet:600,desktop:1195}},e}({}); | ||
//# sourceMappingURL=ray-core.min.js.map |
export const CSS_CLASSES = { | ||
ACTIVE: 'ray-select--active', | ||
REQUIRED: 'ray-select--required', | ||
HAS_VALUE: 'ray-select--has-value', | ||
@@ -4,0 +5,0 @@ PLACEHOLDER_MODE: 'ray-select--placeholder-mode', |
@@ -58,2 +58,6 @@ import { CSS_CLASSES, STRINGS } from './constants'; | ||
isRequired() { | ||
return this._inputElement.required; | ||
} | ||
value() { | ||
@@ -100,2 +104,8 @@ // Current value of the Select | ||
} | ||
if (this.isRequired()) { | ||
this._root.classList.add(this.constructor.cssClasses.REQUIRED); | ||
} else { | ||
this._root.classList.remove(this.constructor.cssClasses.REQUIRED); | ||
} | ||
} | ||
@@ -102,0 +112,0 @@ |
@@ -5,2 +5,3 @@ export const CSS_CLASSES = { | ||
ACTIVE: 'ray-text-field--active', | ||
REQUIRED: 'ray-text-field--required', | ||
EL__INPUT: 'ray-text-field__input', | ||
@@ -13,2 +14,3 @@ EL__LABEL: 'ray-text-field__label', | ||
ACTIVE: 'ray-text-area--active', | ||
REQUIRED: 'ray-text-area--required', | ||
EL__INPUT: 'ray-text-area__input', | ||
@@ -15,0 +17,0 @@ EL__LABEL: 'ray-text-area__label', |
@@ -62,2 +62,6 @@ import { CSS_CLASSES, STRINGS } from './constants'; | ||
isRequired() { | ||
return this._inputElement.required; | ||
} | ||
set(value) { | ||
@@ -83,2 +87,8 @@ this._inputElement.value = value; | ||
} | ||
if (this.isRequired()) { | ||
this._root.classList.add(this.constructor.cssClasses.REQUIRED); | ||
} else { | ||
this._root.classList.remove(this.constructor.cssClasses.REQUIRED); | ||
} | ||
} | ||
@@ -85,0 +95,0 @@ |
@@ -22,2 +22,3 @@ (function (global, factory) { | ||
ACTIVE: 'ray-select--active', | ||
REQUIRED: 'ray-select--required', | ||
HAS_VALUE: 'ray-select--has-value', | ||
@@ -24,0 +25,0 @@ PLACEHOLDER_MODE: 'ray-select--placeholder-mode', |
@@ -115,2 +115,7 @@ (function (global, factory) { | ||
}, { | ||
key: "isRequired", | ||
value: function isRequired() { | ||
return this._inputElement.required; | ||
} | ||
}, { | ||
key: "value", | ||
@@ -146,2 +151,8 @@ value: function value() { | ||
} | ||
if (this.isRequired()) { | ||
this._root.classList.add(this.constructor.cssClasses.REQUIRED); | ||
} else { | ||
this._root.classList.remove(this.constructor.cssClasses.REQUIRED); | ||
} | ||
} | ||
@@ -148,0 +159,0 @@ }, { |
@@ -24,2 +24,3 @@ (function (global, factory) { | ||
ACTIVE: 'ray-text-field--active', | ||
REQUIRED: 'ray-text-field--required', | ||
EL__INPUT: 'ray-text-field__input', | ||
@@ -32,2 +33,3 @@ EL__LABEL: 'ray-text-field__label', | ||
ACTIVE: 'ray-text-area--active', | ||
REQUIRED: 'ray-text-area--required', | ||
EL__INPUT: 'ray-text-area__input', | ||
@@ -34,0 +36,0 @@ EL__LABEL: 'ray-text-area__label', |
@@ -125,2 +125,7 @@ (function (global, factory) { | ||
}, { | ||
key: "isRequired", | ||
value: function isRequired() { | ||
return this._inputElement.required; | ||
} | ||
}, { | ||
key: "set", | ||
@@ -138,2 +143,8 @@ value: function set(value) { | ||
} | ||
if (this.isRequired()) { | ||
this._root.classList.add(this.constructor.cssClasses.REQUIRED); | ||
} else { | ||
this._root.classList.remove(this.constructor.cssClasses.REQUIRED); | ||
} | ||
} | ||
@@ -140,0 +151,0 @@ }, { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
494212
4953