@mcwv/floating-label
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.floatingLabel=t():(e.mcwv=e.mcwv||{},e.mcwv.floatingLabel=t())}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=33)}({2:function(e,t,n){"use strict";function r(e){return{version:"__VERSION__",install:t=>{Object.values(e).forEach(e=>t.component(e.name,e))},components:e}}n.d(t,"a",function(){return r})},33:function(e,t,n){n(89),e.exports=n(34)},34:function(e,t,n){},89:function(e,t,n){"use strict";n.r(t);var r=n(2),o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)}; | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.floatingLabel=t():(e.mcwv=e.mcwv||{},e.mcwv.floatingLabel=t())}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=34)}({2:function(e,t,n){"use strict";function r(e){return{version:"__VERSION__",install:t=>{Object.values(e).forEach(e=>t.component(e.name,e))},components:e}}n.d(t,"a",function(){return r})},34:function(e,t,n){n(92),e.exports=n(35)},35:function(e,t,n){},92:function(e,t,n){"use strict";n.r(t); | ||
/*! ***************************************************************************** | ||
@@ -15,3 +15,4 @@ Copyright (c) Microsoft Corporation. All rights reserved. | ||
and limitations under the License. | ||
***************************************************************************** */var a=function(){return(a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)}; | ||
***************************************************************************** */ | ||
var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};var o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)}; | ||
/** | ||
@@ -39,3 +40,3 @@ * @license | ||
*/ | ||
var i=function(){function e(e){void 0===e&&(e={}),this.adapter_=e}return Object.defineProperty(e,"cssClasses",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"strings",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"numbers",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{}},enumerable:!0,configurable:!0}),e.prototype.init=function(){},e.prototype.destroy=function(){},e}(),s={LABEL_FLOAT_ABOVE:"mdc-floating-label--float-above",LABEL_SHAKE:"mdc-floating-label--shake",ROOT:"mdc-floating-label"},l=function(e){function t(n){var r=e.call(this,a({},t.defaultAdapter,n))||this;return r.shakeAnimationEndHandler_=function(){return r.handleShakeAnimationEnd_()},r}return function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),Object.defineProperty(t,"cssClasses",{get:function(){return s},enumerable:!0,configurable:!0}),Object.defineProperty(t,"defaultAdapter",{get:function(){return{addClass:function(){},removeClass:function(){},getWidth:function(){return 0},registerInteractionHandler:function(){},deregisterInteractionHandler:function(){}}},enumerable:!0,configurable:!0}),t.prototype.init=function(){this.adapter_.registerInteractionHandler("animationend",this.shakeAnimationEndHandler_)},t.prototype.destroy=function(){this.adapter_.deregisterInteractionHandler("animationend",this.shakeAnimationEndHandler_)},t.prototype.getWidth=function(){return this.adapter_.getWidth()},t.prototype.shake=function(e){var n=t.cssClasses.LABEL_SHAKE;e?this.adapter_.addClass(n):this.adapter_.removeClass(n)},t.prototype.float=function(e){var n=t.cssClasses,r=n.LABEL_FLOAT_ABOVE,o=n.LABEL_SHAKE;e?this.adapter_.addClass(r):(this.adapter_.removeClass(r),this.adapter_.removeClass(o))},t.prototype.handleShakeAnimationEnd_=function(){var e=t.cssClasses.LABEL_SHAKE;this.adapter_.removeClass(e)},t}(i),u={name:"mdc-floating-label",data:()=>({labelClasses:{"mdc-floating-label":!0}}),render(e){return e("label",{class:this.labelClasses},this.$slots.default)},mounted(){this.foundation=new l({addClass:e=>{this.$set(this.labelClasses,e,!0)},removeClass:e=>{this.$delete(this.labelClasses,e)},getWidth:()=>this.$el.scrollWidth,registerInteractionHandler:(e,t)=>{this.$el.addEventListener(e,t)},deregisterInteractionHandler:(e,t)=>{this.$el.removeEventListener(e,t)}}),this.foundation.init()},beforeDestroy(){this.foundation.destroy()},methods:{getWidth(){return this.foundation.getWidth()},float(e){this.foundation.float(e)},shake(e){this.foundation.shake(e)}}};n.d(t,"mdcFloatingLabel",function(){return u});t.default=Object(r.a)({mdcFloatingLabel:u})}})}); | ||
var a=function(){function e(e){void 0===e&&(e={}),this.adapter_=e}return Object.defineProperty(e,"cssClasses",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"strings",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"numbers",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{}},enumerable:!0,configurable:!0}),e.prototype.init=function(){},e.prototype.destroy=function(){},e}(),i={LABEL_FLOAT_ABOVE:"mdc-floating-label--float-above",LABEL_SHAKE:"mdc-floating-label--shake",ROOT:"mdc-floating-label"},s=function(e){function t(n){var r=e.call(this,o({},t.defaultAdapter,n))||this;return r.shakeAnimationEndHandler_=function(){return r.handleShakeAnimationEnd_()},r}return function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),Object.defineProperty(t,"cssClasses",{get:function(){return i},enumerable:!0,configurable:!0}),Object.defineProperty(t,"defaultAdapter",{get:function(){return{addClass:function(){},removeClass:function(){},getWidth:function(){return 0},registerInteractionHandler:function(){},deregisterInteractionHandler:function(){}}},enumerable:!0,configurable:!0}),t.prototype.init=function(){this.adapter_.registerInteractionHandler("animationend",this.shakeAnimationEndHandler_)},t.prototype.destroy=function(){this.adapter_.deregisterInteractionHandler("animationend",this.shakeAnimationEndHandler_)},t.prototype.getWidth=function(){return this.adapter_.getWidth()},t.prototype.shake=function(e){var n=t.cssClasses.LABEL_SHAKE;e?this.adapter_.addClass(n):this.adapter_.removeClass(n)},t.prototype.float=function(e){var n=t.cssClasses,r=n.LABEL_FLOAT_ABOVE,o=n.LABEL_SHAKE;e?this.adapter_.addClass(r):(this.adapter_.removeClass(r),this.adapter_.removeClass(o))},t.prototype.handleShakeAnimationEnd_=function(){var e=t.cssClasses.LABEL_SHAKE;this.adapter_.removeClass(e)},t}(a),l=n(2);n.d(t,"mdcFloatingLabel",function(){return u});const u={name:"mdc-floating-label",data:()=>({labelClasses:{"mdc-floating-label":!0}}),mounted(){this.foundation=new s({addClass:e=>{this.$set(this.labelClasses,e,!0)},removeClass:e=>{this.$delete(this.labelClasses,e)},getWidth:()=>this.$el.scrollWidth,registerInteractionHandler:(e,t)=>{this.$el.addEventListener(e,t)},deregisterInteractionHandler:(e,t)=>{this.$el.removeEventListener(e,t)}}),this.foundation.init()},beforeDestroy(){this.foundation.destroy()},methods:{getWidth(){return this.foundation.getWidth()},float(e){this.foundation.float(e)},shake(e){this.foundation.shake(e)}},render(e){const{$scopedSlots:t}=this;return e("label",{class:this.labelClasses},t.default&&t.default())}};t.default=Object(l.a)({mdcFloatingLabel:u})}})}); | ||
//# sourceMappingURL=mcwv.floatingLabel.min.js.map |
56
index.js
@@ -0,4 +1,58 @@ | ||
import MDCFloatingLabelFoundation from '@material/floating-label/foundation'; | ||
import { BasePlugin } from '@mcwv/base'; | ||
import mdcFloatingLabel from './mdc-floating-label.js'; | ||
const mdcFloatingLabel = { | ||
name: 'mdc-floating-label', | ||
data() { | ||
return { | ||
labelClasses: { 'mdc-floating-label': true }, | ||
}; | ||
}, | ||
mounted() { | ||
this.foundation = new MDCFloatingLabelFoundation({ | ||
addClass: className => { | ||
this.$set(this.labelClasses, className, true); | ||
}, | ||
removeClass: className => { | ||
this.$delete(this.labelClasses, className); | ||
}, | ||
getWidth: () => this.$el.scrollWidth, | ||
registerInteractionHandler: (evtType, handler) => { | ||
this.$el.addEventListener(evtType, handler); | ||
}, | ||
deregisterInteractionHandler: (evtType, handler) => { | ||
this.$el.removeEventListener(evtType, handler); | ||
}, | ||
}); | ||
this.foundation.init(); | ||
}, | ||
beforeDestroy() { | ||
this.foundation.destroy(); | ||
}, | ||
methods: { | ||
getWidth() { | ||
return this.foundation.getWidth(); | ||
}, | ||
float(shouldFloat) { | ||
this.foundation.float(shouldFloat); | ||
}, | ||
shake(shouldShake) { | ||
this.foundation.shake(shouldShake); | ||
}, | ||
}, | ||
render(createElement) { | ||
const { $scopedSlots: scopedSlots } = this; | ||
return createElement( | ||
'label', | ||
{ class: this.labelClasses }, | ||
scopedSlots.default && scopedSlots.default(), | ||
); | ||
}, | ||
}; | ||
export { mdcFloatingLabel }; | ||
@@ -5,0 +59,0 @@ |
{ | ||
"name": "@mcwv/floating-label", | ||
"description": "The Vue Material Adapter for the web floating-label component", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"license": "MIT", | ||
@@ -20,5 +20,5 @@ "main": "dist/mcwv.floatingLabel.min.js", | ||
"@material/floating-label": "^1.1.0", | ||
"@mcwv/base": "^0.3.0" | ||
"@mcwv/base": "^0.4.0" | ||
}, | ||
"gitHead": "e5d6ff92c9c2f8986eca1182382939bdaeabef4d" | ||
"gitHead": "18ce29b68e90ce14bdc0f9e9e579904a9968cfd2" | ||
} |
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
Mixed license
License(Experimental) Package contains multiple licenses.
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
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
43292
8
+ Added@mcwv/base@0.4.0(transitive)
- Removed@mcwv/base@0.3.0(transitive)
Updated@mcwv/base@^0.4.0