Comparing version 0.0.8 to 0.0.9
@@ -12,19 +12,19 @@ | ||
(global = global || self, factory(global.eyzy = {}, global.React)); | ||
}(this, function (exports, React) { 'use strict'; | ||
}(this, (function (exports, React) { 'use strict'; | ||
React = React && React.hasOwnProperty('default') ? React['default'] : React; | ||
React = React && Object.prototype.hasOwnProperty.call(React, 'default') ? React['default'] : React; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Copyright (c) Microsoft Corporation. | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
@@ -174,2 +174,21 @@ /* global Reflect, Promise */ | ||
var _this = _super.call(this, props) || this; | ||
_this.header = React.createRef(); | ||
_this.wrap = React.createRef(); | ||
_this.tryHeaderScroll = function () { | ||
var _a; | ||
try { | ||
var activeTab = (_a = _this.wrap.current) === null || _a === void 0 ? void 0 : _a.querySelector('.active'); | ||
if (!activeTab) { | ||
return; | ||
} | ||
var headerEl = _this.header.current; | ||
var headerBounds = headerEl.getBoundingClientRect(); | ||
var tabBounds = activeTab.getBoundingClientRect(); | ||
var diff = (headerBounds.left + headerEl.clientWidth) - tabBounds.left; | ||
if (diff < tabBounds.width) { | ||
headerEl.scrollLeft = diff + tabBounds.width; | ||
} | ||
} | ||
catch (e) { } | ||
}; | ||
_this.getChildNodes = function (children) { | ||
@@ -219,2 +238,8 @@ if (children === void 0) { children = _this.props.children; } | ||
}; | ||
Tabs.prototype.componentDidMount = function () { | ||
this.tryHeaderScroll(); | ||
}; | ||
Tabs.prototype.componentDidUpdate = function () { | ||
this.tryHeaderScroll(); | ||
}; | ||
Tabs.prototype.renderHeader = function () { | ||
@@ -240,3 +265,4 @@ var _this = this; | ||
return (React.createElement("div", { className: className }, | ||
React.createElement("div", { className: "eyzy-tabs-header" }, this.renderHeader()), | ||
React.createElement("div", { className: "eyzy-tabs-header", ref: this.header }, | ||
React.createElement("div", { className: "eyzy-tabs-wrap", ref: this.wrap }, this.renderHeader())), | ||
React.createElement("div", { className: "eyzy-tabs-content" }, this.getActiveContent()))); | ||
@@ -350,3 +376,3 @@ }; | ||
})); | ||
}))); | ||
//# sourceMappingURL=eyzy.js.map |
@@ -11,14 +11,14 @@ | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Copyright (c) Microsoft Corporation. | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
@@ -168,2 +168,21 @@ /* global Reflect, Promise */ | ||
var _this = _super.call(this, props) || this; | ||
_this.header = React.createRef(); | ||
_this.wrap = React.createRef(); | ||
_this.tryHeaderScroll = function () { | ||
var _a; | ||
try { | ||
var activeTab = (_a = _this.wrap.current) === null || _a === void 0 ? void 0 : _a.querySelector('.active'); | ||
if (!activeTab) { | ||
return; | ||
} | ||
var headerEl = _this.header.current; | ||
var headerBounds = headerEl.getBoundingClientRect(); | ||
var tabBounds = activeTab.getBoundingClientRect(); | ||
var diff = (headerBounds.left + headerEl.clientWidth) - tabBounds.left; | ||
if (diff < tabBounds.width) { | ||
headerEl.scrollLeft = diff + tabBounds.width; | ||
} | ||
} | ||
catch (e) { } | ||
}; | ||
_this.getChildNodes = function (children) { | ||
@@ -213,2 +232,8 @@ if (children === void 0) { children = _this.props.children; } | ||
}; | ||
Tabs.prototype.componentDidMount = function () { | ||
this.tryHeaderScroll(); | ||
}; | ||
Tabs.prototype.componentDidUpdate = function () { | ||
this.tryHeaderScroll(); | ||
}; | ||
Tabs.prototype.renderHeader = function () { | ||
@@ -234,3 +259,4 @@ var _this = this; | ||
return (React.createElement("div", { className: className }, | ||
React.createElement("div", { className: "eyzy-tabs-header" }, this.renderHeader()), | ||
React.createElement("div", { className: "eyzy-tabs-header", ref: this.header }, | ||
React.createElement("div", { className: "eyzy-tabs-wrap", ref: this.wrap }, this.renderHeader())), | ||
React.createElement("div", { className: "eyzy-tabs-content" }, this.getActiveContent()))); | ||
@@ -237,0 +263,0 @@ }; |
{ | ||
"name": "eyzy", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"author": "Kostiantyn", | ||
@@ -5,0 +5,0 @@ "description": "React UI Toolkit", |
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
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
98400
0
1080