Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wework/ray-core

Package Overview
Dependencies
Maintainers
37
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wework/ray-core - npm Package Compare versions

Comparing version 1.8.6-alpha.13 to 1.8.6-alpha.14

es/components/chip/index.js

3

es/components/index.js
import Select from './select';
import { TextField, TextArea } from './text-field';
export { Select, TextField, TextArea };
import Chip from './chip';
export { Select, TextField, TextArea, Chip };
{
"name": "@wework/ray-core",
"version": "1.8.6-alpha.13+c947915",
"version": "1.8.6-alpha.14+5784303",
"main": "umd/index.js",

@@ -80,3 +80,3 @@ "module": "es/index.js",

],
"gitHead": "c947915a9c48ab383c2c1ad2190e891f474bd065",
"gitHead": "57843035dbcc61e0ea9de93f206aba61168b130b",
"repository": {

@@ -83,0 +83,0 @@ "type": "git",

@@ -959,8 +959,117 @@ this.Ray = this.Ray || {};

var Chip =
/*#__PURE__*/
function () {
_createClass(Chip, null, [{
key: "create",
value: function create(element, options) {
return this.instances.get(element) || new this(element, options);
}
}, {
key: "createAll",
value: function createAll() {
var _this = this;
var target = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
var _options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
active: false
};
// Finds all instances of select on the document or within a given element and instantiates them.
var options = _objectSpread({
initSelector: this.strings.INIT_SELECTOR
}, _options);
var chips = Array.from(target.querySelectorAll(options.initSelector));
chips.forEach(function (select) {
return _this.create(select, options);
});
}
}, {
key: "cssClasses",
get: function get() {
return {
ACTIVE: 'ray-chip--active'
};
}
}, {
key: "strings",
get: function get() {
return {
INIT_SELECTOR: '.ray-chip'
};
}
}]);
function Chip(root, options) {
var _this2 = this;
_classCallCheck(this, Chip);
_defineProperty(this, "onClick", function () {
_this2.state.active = !_this2.state.active;
_this2.assignClasses();
});
_defineProperty(this, "onSpace", function (event) {
if (event.code === 'Space' || event.key === ' ') {
_this2.state.active = !_this2.state.active;
_this2.assignClasses();
}
});
this._root = root;
this._options = options;
this.constructor.instances.set(this._root, this);
this.state = {
active: this._root.classList.contains(this.constructor.cssClasses.ACTIVE)
};
this._bindEventListeners();
this.assignClasses();
}
_createClass(Chip, [{
key: "_bindEventListeners",
value: function _bindEventListeners() {
this._root.addEventListener('mousedown', this.onClick);
this._root.addEventListener('keydown', this.onSpace);
}
}, {
key: "assignClasses",
value: function assignClasses() {
if (this.state.active) {
this._root.classList.add(this.constructor.cssClasses.ACTIVE);
} else {
this._root.classList.remove(this.constructor.cssClasses.ACTIVE);
}
}
}, {
key: "destroy",
value: function destroy() {
// Implement this method to release any resources / deregister any listeners they have
// attached. An example of this might be deregistering a resize event from the window object.
this._root.removeEventListener('mousedown', this.onClick);
this.constructor.instances.delete(this._root);
}
}]);
return Chip;
}();
_defineProperty(Chip, "instances", new WeakMap());
var components = /*#__PURE__*/Object.freeze({
Select: Select,
TextField: TextField,
TextArea: TextArea
TextArea: TextArea,
Chip: Chip
});

@@ -996,2 +1105,3 @@

exports.Chip = Chip;
exports.Select = Select;

@@ -998,0 +1108,0 @@ exports.TextArea = TextArea;

@@ -1,2 +0,2 @@

this.Ray=this.Ray||{},this.Ray.Core=function(t){"use strict";var E=function(r,o,t){if(function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!")}(r),void 0===o)return r;switch(t){case 1:return function(t){return r.call(o,t)};case 2:return function(t,e){return r.call(o,t,e)};case 3:return function(t,e,n){return r.call(o,t,e,n)}}return function(){return r.apply(o,arguments)}};function e(t,e){return t(e={exports:{}},e.exports),e.exports}var v=e(function(t){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)}),p=e(function(t){var e=t.exports={version:"2.6.5"};"number"==typeof __e&&(__e=e)});p.version;function n(t){return(n="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})(t)}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function s(t,e,n){return e&&o(t.prototype,e),n&&o(t,n),t}function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),r.forEach(function(t){i(e,t,n[t])})}return e}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&l(t,e)}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}var h=function(t){return"object"===n(t)?null!==t:"function"==typeof t},d=function(t){if(!h(t))throw TypeError(t+" is not an object!");return t},y=function(t){try{return!!t()}catch(t){return!0}},_=!y(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),m=v.document,L=h(m)&&h(m.createElement),b=!_&&!y(function(){return 7!=Object.defineProperty((t="div",L?m.createElement(t):{}),"a",{get:function(){return 7}}).a;var t}),g=Object.defineProperty,S={f:_?Object.defineProperty:function(t,e,n){if(d(t),e=function(t,e){if(!h(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!h(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!h(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!h(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")}(e,!0),d(n),b)try{return g(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},w=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},C=_?function(t,e,n){return S.f(t,e,w(1,n))}:function(t,e,n){return t[e]=n,t},A={}.hasOwnProperty,T=function(t,e){return A.call(t,e)},O=0,I=Math.random(),R=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++O+I).toString(36))},k=e(function(t){var e="__core-js_shared__",n=v[e]||(v[e]={});(t.exports=function(t,e){return n[t]||(n[t]=void 0!==e?e:{})})("versions",[]).push({version:p.version,mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})}),x=k("native-function-to-string",Function.toString),P=e(function(t){var s=R("src"),e="toString",i=(""+x).split(e);p.inspectSource=function(t){return x.call(t)},(t.exports=function(t,e,n,r){var o="function"==typeof n;o&&(T(n,"name")||C(n,"name",e)),t[e]!==n&&(o&&(T(n,s)||C(n,s,t[e]?""+t[e]:i.join(String(e)))),t===v?t[e]=n:r?t[e]?t[e]=n:C(t,e,n):(delete t[e],C(t,e,n)))})(Function.prototype,e,function(){return"function"==typeof this&&this[s]||x.call(this)})}),j="prototype",D=function t(e,n,r){var o,s,i,c,u=e&t.F,a=e&t.G,l=e&t.P,f=e&t.B,h=a?v:e&t.S?v[n]||(v[n]={}):(v[n]||{})[j],d=a?p:p[n]||(p[n]={}),y=d[j]||(d[j]={});for(o in a&&(r=n),r)i=((s=!u&&h&&void 0!==h[o])?h:r)[o],c=f&&s?E(i,v):l&&"function"==typeof i?E(Function.call,i):i,h&&P(h,o,i,e&t.U),d[o]!=i&&C(d,o,c),l&&y[o]!=i&&(y[o]=i)};v.core=p,D.F=1,D.G=2,D.S=4,D.P=8,D.B=16,D.W=32,D.U=64,D.R=128;var U=D,M=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},N=function(e,t,n,r){try{return r?t(d(n)[0],n[1]):t(n)}catch(t){var o=e.return;throw void 0!==o&&d(o.call(e)),t}},F={},V=e(function(t){var e=k("wks"),n=v.Symbol,r="function"==typeof n;(t.exports=function(t){return e[t]||(e[t]=r&&n[t]||(r?n:R)("Symbol."+t))}).store=e}),B=V("iterator"),q=Array.prototype,H=Math.ceil,Q=Math.floor,W=Math.min,X=function(t){return 0<t?W((e=t,isNaN(e=+e)?0:(0<e?Q:H)(e)),9007199254740991):0;var e},z=function(t,e,n){e in t?S.f(t,e,w(0,n)):t[e]=n},G={}.toString,J=function(t){return G.call(t).slice(8,-1)},K=V("toStringTag"),Y="Arguments"==J(function(){return arguments}()),Z=V("iterator"),$=p.getIteratorMethod=function(t){if(null!=t)return t[Z]||t["@@iterator"]||F[(e=t,void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(t,e){try{return t[e]}catch(t){}}(n=Object(e),K))?r:Y?J(n):"Object"==(o=J(n))&&"function"==typeof n.callee?"Arguments":o)];var e,n,r,o},tt=V("iterator"),et=!1;try{[7][tt]().return=function(){et=!0}}catch(t){}U(U.S+U.F*!function(t,e){if(!e&&!et)return!1;var n=!1;try{var r=[7],o=r[tt]();o.next=function(){return{done:n=!0}},r[tt]=function(){return o},t(r)}catch(t){}return n}(function(t){}),"Array",{from:function(t){var e,n,r,o,s,i=Object(M(t)),c="function"==typeof this?this:Array,u=arguments.length,a=1<u?arguments[1]:void 0,l=void 0!==a,f=0,h=$(i);if(l&&(a=E(a,2<u?arguments[2]:void 0,2)),null!=h&&(c!=Array||(void 0===(s=h)||F.Array!==s&&q[B]!==s)))for(o=h.call(i),n=new c;!(r=o.next()).done;f++)z(n,f,l?N(o,a,[r.value,f],!0):r.value);else for(n=new c(e=X(i.length));f<e;f++)z(n,f,l?a(i[f],f):i[f]);return n.length=f,n}});var nt=V("match"),rt=function(t,e,n){if(h(r=e)&&(void 0!==(o=r[nt])?o:"RegExp"==J(r)))throw TypeError("String#"+n+" doesn't accept regex!");var r,o;return String(M(t))},ot=V("match"),st="includes";U(U.P+U.F*function(e){var n=/./;try{"/./"[e](n)}catch(t){try{return n[ot]=!1,!"/./"[e](n)}catch(t){}}return!0}(st),"String",{includes:function(t){return!!~rt(this,t,st).indexOf(t,1<arguments.length?arguments[1]:void 0)}});var it={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"},ct={INIT_SELECTOR:".ray-select"};function ut(t){if(t.nodeType!==Node.ELEMENT_NODE&&t.nodeType!==Node.DOCUMENT_NODE)throw new TypeError("DOM document or DOM element should be given to search for and initialize this widget.")}var at=function(){function n(t){var e=this;if(r(this,n),i(this,"onFocus",function(){e._root.classList.add(e.constructor.cssClasses.ACTIVE)}),i(this,"onBlur",function(){e._root.classList.remove(e.constructor.cssClasses.ACTIVE)}),i(this,"onChange",function(){e.assignClasses()}),i(this,"_getCurrentValueOptionElement",function(){return e._inputElement.options[e._inputElement.selectedIndex]}),this._root=t,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 s(n,null,[{key:"create",value:function(t,e){return this.instances.get(t)||new this(t,e)}},{key:"createAll",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=c({initSelector:this.strings.INIT_SELECTOR},n);ut(t),Array.from(t.querySelectorAll(r.initSelector)).forEach(function(t){return e.create(t,r)})}},{key:"cssClasses",get:function(){return it}},{key:"strings",get:function(){return ct}}]),s(n,[{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(t){this._inputElement.value=t,this._inputElement.dispatchEvent(new Event("change"))}},{key:"assignClasses",value:function(){var t=this._getCurrentValueOptionElement();t&&t.innerHTML?t.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)}}]),n}();i(at,"instances",new WeakMap);var lt={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"},ft={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"},ht={TEXT_FIELD:{INIT_SELECTOR:".".concat(lt.BASE)},TEXT_AREA:{INIT_SELECTOR:".".concat(ft.BASE)}},dt=function(){function n(t){var e=this;if(r(this,n),i(this,"onMousedown",function(t){t.preventDefault(),e._inputElement.focus()}),i(this,"onFocus",function(){e._root.classList.add(e.constructor.cssClasses.ACTIVE)}),i(this,"onBlur",function(){e._root.classList.remove(e.constructor.cssClasses.ACTIVE),e.assignClasses()}),this._root=t,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 s(n,null,[{key:"create",value:function(t,e){return this.instances.get(t)||new this(t,e)}},{key:"createAll",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=c({initSelector:this.strings.INIT_SELECTOR},n);ut(t),Array.from(t.querySelectorAll(r.initSelector)).forEach(function(t){return e.create(t,r)})}}]),s(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:"isRequired",value:function(){return this._inputElement.required}},{key:"set",value:function(t){this._inputElement.value=t}},{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)}}]),n}(),yt=function(t){function e(){return r(this,e),f(this,a(e).apply(this,arguments))}return u(e,dt),s(e,null,[{key:"cssClasses",get:function(){return lt}},{key:"strings",get:function(){return ht.TEXT_FIELD}}]),e}();i(yt,"instances",new WeakMap);var Et=function(t){function e(){return r(this,e),f(this,a(e).apply(this,arguments))}return u(e,dt),s(e,null,[{key:"cssClasses",get:function(){return ft}},{key:"strings",get:function(){return ht.TEXT_AREA}}]),e}();i(Et,"instances",new WeakMap);var vt=Object.freeze({Select:at,TextField:yt,TextArea:Et});function pt(){Object.keys(vt).forEach(function(t){vt[t].createAll()})}return"undefined"!=typeof window&&"undefined"!=typeof document&&("complete"===document.readyState||"loaded"===document.readyState||"interactive"===document.readyState?pt():window.addEventListener("DOMContentLoaded",pt)),function(){if("undefined"!=typeof document){var t="js-ray-enable-accessibility";document.addEventListener("keydown",function(){document.body.classList.add(t)}),document.addEventListener("mousedown",function(){document.body.classList.remove(t)})}}(),t.Select=at,t.TextArea=Et,t.TextField=yt,t.settings={prefix:"ray-",breakpointsInPixels:{phone:0,tablet:600,desktop:1195}},t}({});
this.Ray=this.Ray||{},this.Ray.Core=function(t){"use strict";var y=function(r,s,t){if(function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!")}(r),void 0===s)return r;switch(t){case 1:return function(t){return r.call(s,t)};case 2:return function(t,e){return r.call(s,t,e)};case 3:return function(t,e,n){return r.call(s,t,e,n)}}return function(){return r.apply(s,arguments)}};function e(t,e){return t(e={exports:{}},e.exports),e.exports}var E=e(function(t){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)}),p=e(function(t){var e=t.exports={version:"2.6.5"};"number"==typeof __e&&(__e=e)});p.version;function n(t){return(n="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})(t)}function s(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function o(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),r.forEach(function(t){i(e,t,n[t])})}return e}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&l(t,e)}function a(t){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}var h=function(t){return"object"===n(t)?null!==t:"function"==typeof t},d=function(t){if(!h(t))throw TypeError(t+" is not an object!");return t},v=function(t){try{return!!t()}catch(t){return!0}},_=!v(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),m=E.document,L=h(m)&&h(m.createElement),g=!_&&!v(function(){return 7!=Object.defineProperty((t="div",L?m.createElement(t):{}),"a",{get:function(){return 7}}).a;var t}),b=Object.defineProperty,C={f:_?Object.defineProperty:function(t,e,n){if(d(t),e=function(t,e){if(!h(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!h(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!h(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!h(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")}(e,!0),d(n),g)try{return b(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},S=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},w=_?function(t,e,n){return C.f(t,e,S(1,n))}:function(t,e,n){return t[e]=n,t},A={}.hasOwnProperty,T=function(t,e){return A.call(t,e)},O=0,k=Math.random(),I=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++O+k).toString(36))},R=e(function(t){var e="__core-js_shared__",n=E[e]||(E[e]={});(t.exports=function(t,e){return n[t]||(n[t]=void 0!==e?e:{})})("versions",[]).push({version:p.version,mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})}),x=R("native-function-to-string",Function.toString),P=e(function(t){var o=I("src"),e="toString",i=(""+x).split(e);p.inspectSource=function(t){return x.call(t)},(t.exports=function(t,e,n,r){var s="function"==typeof n;s&&(T(n,"name")||w(n,"name",e)),t[e]!==n&&(s&&(T(n,o)||w(n,o,t[e]?""+t[e]:i.join(String(e)))),t===E?t[e]=n:r?t[e]?t[e]=n:w(t,e,n):(delete t[e],w(t,e,n)))})(Function.prototype,e,function(){return"function"==typeof this&&this[o]||x.call(this)})}),j="prototype",D=function t(e,n,r){var s,o,i,c,u=e&t.F,a=e&t.G,l=e&t.P,f=e&t.B,h=a?E:e&t.S?E[n]||(E[n]={}):(E[n]||{})[j],d=a?p:p[n]||(p[n]={}),v=d[j]||(d[j]={});for(s in a&&(r=n),r)i=((o=!u&&h&&void 0!==h[s])?h:r)[s],c=f&&o?y(i,E):l&&"function"==typeof i?y(Function.call,i):i,h&&P(h,s,i,e&t.U),d[s]!=i&&w(d,s,c),l&&v[s]!=i&&(v[s]=i)};E.core=p,D.F=1,D.G=2,D.S=4,D.P=8,D.B=16,D.W=32,D.U=64,D.R=128;var M=D,U=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},N=function(e,t,n,r){try{return r?t(d(n)[0],n[1]):t(n)}catch(t){var s=e.return;throw void 0!==s&&d(s.call(e)),t}},V={},F=e(function(t){var e=R("wks"),n=E.Symbol,r="function"==typeof n;(t.exports=function(t){return e[t]||(e[t]=r&&n[t]||(r?n:I)("Symbol."+t))}).store=e}),q=F("iterator"),B=Array.prototype,H=Math.ceil,Q=Math.floor,W=Math.min,X=function(t){return 0<t?W((e=t,isNaN(e=+e)?0:(0<e?Q:H)(e)),9007199254740991):0;var e},z=function(t,e,n){e in t?C.f(t,e,S(0,n)):t[e]=n},G={}.toString,J=function(t){return G.call(t).slice(8,-1)},K=F("toStringTag"),Y="Arguments"==J(function(){return arguments}()),Z=F("iterator"),$=p.getIteratorMethod=function(t){if(null!=t)return t[Z]||t["@@iterator"]||V[(e=t,void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(t,e){try{return t[e]}catch(t){}}(n=Object(e),K))?r:Y?J(n):"Object"==(s=J(n))&&"function"==typeof n.callee?"Arguments":s)];var e,n,r,s},tt=F("iterator"),et=!1;try{[7][tt]().return=function(){et=!0}}catch(t){}M(M.S+M.F*!function(t,e){if(!e&&!et)return!1;var n=!1;try{var r=[7],s=r[tt]();s.next=function(){return{done:n=!0}},r[tt]=function(){return s},t(r)}catch(t){}return n}(function(t){}),"Array",{from:function(t){var e,n,r,s,o,i=Object(U(t)),c="function"==typeof this?this:Array,u=arguments.length,a=1<u?arguments[1]:void 0,l=void 0!==a,f=0,h=$(i);if(l&&(a=y(a,2<u?arguments[2]:void 0,2)),null!=h&&(c!=Array||(void 0===(o=h)||V.Array!==o&&B[q]!==o)))for(s=h.call(i),n=new c;!(r=s.next()).done;f++)z(n,f,l?N(s,a,[r.value,f],!0):r.value);else for(n=new c(e=X(i.length));f<e;f++)z(n,f,l?a(i[f],f):i[f]);return n.length=f,n}});var nt=F("match"),rt=function(t,e,n){if(h(r=e)&&(void 0!==(s=r[nt])?s:"RegExp"==J(r)))throw TypeError("String#"+n+" doesn't accept regex!");var r,s;return String(U(t))},st=F("match"),ot="includes";M(M.P+M.F*function(e){var n=/./;try{"/./"[e](n)}catch(t){try{return n[st]=!1,!"/./"[e](n)}catch(t){}}return!0}(ot),"String",{includes:function(t){return!!~rt(this,t,ot).indexOf(t,1<arguments.length?arguments[1]:void 0)}});var it={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"},ct={INIT_SELECTOR:".ray-select"};function ut(t){if(t.nodeType!==Node.ELEMENT_NODE&&t.nodeType!==Node.DOCUMENT_NODE)throw new TypeError("DOM document or DOM element should be given to search for and initialize this widget.")}var at=function(){function n(t){var e=this;if(s(this,n),i(this,"onFocus",function(){e._root.classList.add(e.constructor.cssClasses.ACTIVE)}),i(this,"onBlur",function(){e._root.classList.remove(e.constructor.cssClasses.ACTIVE)}),i(this,"onChange",function(){e.assignClasses()}),i(this,"_getCurrentValueOptionElement",function(){return e._inputElement.options[e._inputElement.selectedIndex]}),this._root=t,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 o(n,null,[{key:"create",value:function(t,e){return this.instances.get(t)||new this(t,e)}},{key:"createAll",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=c({initSelector:this.strings.INIT_SELECTOR},n);ut(t),Array.from(t.querySelectorAll(r.initSelector)).forEach(function(t){return e.create(t,r)})}},{key:"cssClasses",get:function(){return it}},{key:"strings",get:function(){return ct}}]),o(n,[{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(t){this._inputElement.value=t,this._inputElement.dispatchEvent(new Event("change"))}},{key:"assignClasses",value:function(){var t=this._getCurrentValueOptionElement();t&&t.innerHTML?t.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)}}]),n}();i(at,"instances",new WeakMap);var lt={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"},ft={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"},ht={TEXT_FIELD:{INIT_SELECTOR:".".concat(lt.BASE)},TEXT_AREA:{INIT_SELECTOR:".".concat(ft.BASE)}},dt=function(){function n(t){var e=this;if(s(this,n),i(this,"onMousedown",function(t){t.preventDefault(),e._inputElement.focus()}),i(this,"onFocus",function(){e._root.classList.add(e.constructor.cssClasses.ACTIVE)}),i(this,"onBlur",function(){e._root.classList.remove(e.constructor.cssClasses.ACTIVE),e.assignClasses()}),this._root=t,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 o(n,null,[{key:"create",value:function(t,e){return this.instances.get(t)||new this(t,e)}},{key:"createAll",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},r=c({initSelector:this.strings.INIT_SELECTOR},n);ut(t),Array.from(t.querySelectorAll(r.initSelector)).forEach(function(t){return e.create(t,r)})}}]),o(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:"isRequired",value:function(){return this._inputElement.required}},{key:"set",value:function(t){this._inputElement.value=t}},{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)}}]),n}(),vt=function(t){function e(){return s(this,e),f(this,a(e).apply(this,arguments))}return u(e,dt),o(e,null,[{key:"cssClasses",get:function(){return lt}},{key:"strings",get:function(){return ht.TEXT_FIELD}}]),e}();i(vt,"instances",new WeakMap);var yt=function(t){function e(){return s(this,e),f(this,a(e).apply(this,arguments))}return u(e,dt),o(e,null,[{key:"cssClasses",get:function(){return ft}},{key:"strings",get:function(){return ht.TEXT_AREA}}]),e}();i(yt,"instances",new WeakMap);var Et=function(){function r(t,e){var n=this;s(this,r),i(this,"onClick",function(){n.state.active=!n.state.active,n.assignClasses()}),i(this,"onSpace",function(t){"Space"!==t.code&&" "!==t.key||(n.state.active=!n.state.active,n.assignClasses())}),this._root=t,this._options=e,this.constructor.instances.set(this._root,this),this.state={active:this._root.classList.contains(this.constructor.cssClasses.ACTIVE)},this._bindEventListeners(),this.assignClasses()}return o(r,null,[{key:"create",value:function(t,e){return this.instances.get(t)||new this(t,e)}},{key:"createAll",value:function(){var e=this,t=0<arguments.length&&void 0!==arguments[0]?arguments[0]:document,n=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{active:!1},r=c({initSelector:this.strings.INIT_SELECTOR},n);Array.from(t.querySelectorAll(r.initSelector)).forEach(function(t){return e.create(t,r)})}},{key:"cssClasses",get:function(){return{ACTIVE:"ray-chip--active"}}},{key:"strings",get:function(){return{INIT_SELECTOR:".ray-chip"}}}]),o(r,[{key:"_bindEventListeners",value:function(){this._root.addEventListener("mousedown",this.onClick),this._root.addEventListener("keydown",this.onSpace)}},{key:"assignClasses",value:function(){this.state.active?this._root.classList.add(this.constructor.cssClasses.ACTIVE):this._root.classList.remove(this.constructor.cssClasses.ACTIVE)}},{key:"destroy",value:function(){this._root.removeEventListener("mousedown",this.onClick),this.constructor.instances.delete(this._root)}}]),r}();i(Et,"instances",new WeakMap);var pt=Object.freeze({Select:at,TextField:vt,TextArea:yt,Chip:Et});function _t(){Object.keys(pt).forEach(function(t){pt[t].createAll()})}return"undefined"!=typeof window&&"undefined"!=typeof document&&("complete"===document.readyState||"loaded"===document.readyState||"interactive"===document.readyState?_t():window.addEventListener("DOMContentLoaded",_t)),function(){if("undefined"!=typeof document){var t="js-ray-enable-accessibility";document.addEventListener("keydown",function(){document.body.classList.add(t)}),document.addEventListener("mousedown",function(){document.body.classList.remove(t)})}}(),t.Chip=Et,t.Select=at,t.TextArea=yt,t.TextField=vt,t.settings={prefix:"ray-",breakpointsInPixels:{phone:0,tablet:600,desktop:1195}},t}({});
//# sourceMappingURL=ray-core.min.js.map
import Select from './select';
import { TextField, TextArea } from './text-field';
import Chip from './chip';
export { Select, TextField, TextArea };
export { Select, TextField, TextArea, Chip };
(function (global, factory) {
if (typeof define === "function" && define.amd) {
define(["exports", "./select", "./text-field"], factory);
define(["exports", "./select", "./text-field", "./chip"], factory);
} else if (typeof exports !== "undefined") {
factory(exports, require("./select"), require("./text-field"));
factory(exports, require("./select"), require("./text-field"), require("./chip"));
} else {

@@ -10,6 +10,6 @@ var mod = {

};
factory(mod.exports, global.select, global.textField);
factory(mod.exports, global.select, global.textField, global.chip);
global.index = mod.exports;
}
})(this, function (_exports, _select, _textField) {
})(this, function (_exports, _select, _textField, _chip) {
"use strict";

@@ -38,5 +38,12 @@

});
Object.defineProperty(_exports, "Chip", {
enumerable: true,
get: function get() {
return _chip.default;
}
});
_select = _interopRequireDefault(_select);
_chip = _interopRequireDefault(_chip);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
});

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc