mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update shared components
This commit is contained in:
parent
fb269362ff
commit
71811cb9e3
221 changed files with 32936 additions and 101 deletions
66
dashboard-ui/bower_components/material-design-lite/src/tooltip/_tooltip.scss
vendored
Normal file
66
dashboard-ui/bower_components/material-design-lite/src/tooltip/_tooltip.scss
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
/**
|
||||
* Copyright 2015 Google Inc. 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
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@import "../variables";
|
||||
|
||||
.mdl-tooltip {
|
||||
transform: scale(0);
|
||||
transform-origin: top center;
|
||||
will-change: transform;
|
||||
z-index: 999;
|
||||
background: $tooltip-background-color;
|
||||
border-radius: 2px;
|
||||
color: $tooltip-text-color;
|
||||
display: inline-block;
|
||||
font-size: $tooltip-font-size;
|
||||
font-weight: 500;
|
||||
line-height: 14px;
|
||||
max-width: 170px;
|
||||
position: fixed;
|
||||
top: -500px;
|
||||
left: -500px;
|
||||
padding: 8px;
|
||||
text-align: center;
|
||||
}
|
||||
.mdl-tooltip.is-active {
|
||||
animation: pulse 200ms $animation-curve-linear-out-slow-in forwards;
|
||||
}
|
||||
|
||||
.mdl-tooltip--large {
|
||||
line-height: 14px;
|
||||
font-size: $tooltip-font-size-large;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
@keyframes pulse {
|
||||
0% {
|
||||
transform: scale(0);
|
||||
opacity: 0;
|
||||
}
|
||||
50% {
|
||||
// Fixes a weird bug with the interaction between Safari and the result of
|
||||
// the SASS compilation for the animation.
|
||||
// Essentially, we need to make sure that "50%" and "100%" don't get merged
|
||||
// into a single "50%, 100%" entry, so we need to avoid them having any
|
||||
// matching properties.
|
||||
transform: scale(0.99);
|
||||
}
|
||||
100% {
|
||||
transform: scale(1);
|
||||
opacity: 1;
|
||||
visibility: visible;
|
||||
}
|
||||
}
|
5
dashboard-ui/bower_components/material-design-lite/src/tooltip/snippets/tooltip-large.html
vendored
Normal file
5
dashboard-ui/bower_components/material-design-lite/src/tooltip/snippets/tooltip-large.html
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
<!-- Large Tooltip -->
|
||||
<div id="tt2" class="icon material-icons">print</div>
|
||||
<div class="mdl-tooltip mdl-tooltip--large" for="tt2">
|
||||
Print
|
||||
</div>
|
|
@ -0,0 +1,5 @@
|
|||
<!-- Multiline Tooltip -->
|
||||
<div id="tt4" class="icon material-icons">share</div>
|
||||
<div class="mdl-tooltip" for="tt4">
|
||||
Share your content<br>via social media
|
||||
</div>
|
5
dashboard-ui/bower_components/material-design-lite/src/tooltip/snippets/tooltip-rich.html
vendored
Normal file
5
dashboard-ui/bower_components/material-design-lite/src/tooltip/snippets/tooltip-rich.html
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
<!-- Rich Tooltip -->
|
||||
<div id="tt3" class="icon material-icons">cloud_upload</div>
|
||||
<div class="mdl-tooltip" for="tt3">
|
||||
Upload <strong>file.zip</strong>
|
||||
</div>
|
5
dashboard-ui/bower_components/material-design-lite/src/tooltip/snippets/tooltip-simple.html
vendored
Normal file
5
dashboard-ui/bower_components/material-design-lite/src/tooltip/snippets/tooltip-simple.html
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
<!-- Simple Tooltip -->
|
||||
<div id="tt1" class="icon material-icons">add</div>
|
||||
<div class="mdl-tooltip" for="tt1">
|
||||
Follow
|
||||
</div>
|
152
dashboard-ui/bower_components/material-design-lite/src/tooltip/tooltip.js
vendored
Normal file
152
dashboard-ui/bower_components/material-design-lite/src/tooltip/tooltip.js
vendored
Normal file
|
@ -0,0 +1,152 @@
|
|||
/**
|
||||
* @license
|
||||
* Copyright 2015 Google Inc. 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
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Class constructor for Tooltip MDL component.
|
||||
* Implements MDL component design pattern defined at:
|
||||
* https://github.com/jasonmayes/mdl-component-design-pattern
|
||||
*
|
||||
* @constructor
|
||||
* @param {HTMLElement} element The element that will be upgraded.
|
||||
*/
|
||||
var MaterialTooltip = function MaterialTooltip(element) {
|
||||
this.element_ = element;
|
||||
|
||||
// Initialize instance.
|
||||
this.init();
|
||||
};
|
||||
window['MaterialTooltip'] = MaterialTooltip;
|
||||
|
||||
/**
|
||||
* Store constants in one place so they can be updated easily.
|
||||
*
|
||||
* @enum {string | number}
|
||||
* @private
|
||||
*/
|
||||
MaterialTooltip.prototype.Constant_ = {
|
||||
// None for now.
|
||||
};
|
||||
|
||||
/**
|
||||
* Store strings for class names defined by this component that are used in
|
||||
* JavaScript. This allows us to simply change it in one place should we
|
||||
* decide to modify at a later date.
|
||||
*
|
||||
* @enum {string}
|
||||
* @private
|
||||
*/
|
||||
MaterialTooltip.prototype.CssClasses_ = {
|
||||
IS_ACTIVE: 'is-active',
|
||||
BOTTOM: 'mdl-tooltip--bottom',
|
||||
LEFT: 'mdl-tooltip--left',
|
||||
RIGHT: 'mdl-tooltip--right',
|
||||
TOP: 'mdl-tooltip--top'
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle mouseenter for tooltip.
|
||||
*
|
||||
* @param {Event} event The event that fired.
|
||||
* @private
|
||||
*/
|
||||
MaterialTooltip.prototype.handleMouseEnter_ = function(event) {
|
||||
var props = event.target.getBoundingClientRect();
|
||||
var left = props.left + (props.width / 2);
|
||||
var top = props.top + (props.height / 2);
|
||||
var marginLeft = -1 * (this.element_.offsetWidth / 2);
|
||||
var marginTop = -1 * (this.element_.offsetHeight / 2);
|
||||
|
||||
if (this.element_.classList.contains(this.CssClasses_.LEFT) || this.element_.classList.contains(this.CssClasses_.RIGHT)) {
|
||||
left = (props.width / 2);
|
||||
if (top + marginTop < 0) {
|
||||
this.element_.style.top = 0;
|
||||
this.element_.style.marginTop = 0;
|
||||
} else {
|
||||
this.element_.style.top = top + 'px';
|
||||
this.element_.style.marginTop = marginTop + 'px';
|
||||
}
|
||||
} else {
|
||||
if (left + marginLeft < 0) {
|
||||
this.element_.style.left = 0;
|
||||
this.element_.style.marginLeft = 0;
|
||||
} else {
|
||||
this.element_.style.left = left + 'px';
|
||||
this.element_.style.marginLeft = marginLeft + 'px';
|
||||
}
|
||||
}
|
||||
|
||||
if (this.element_.classList.contains(this.CssClasses_.TOP)) {
|
||||
this.element_.style.top = props.top - this.element_.offsetHeight - 10 + 'px';
|
||||
} else if (this.element_.classList.contains(this.CssClasses_.RIGHT)) {
|
||||
this.element_.style.left = props.left + props.width + 10 + 'px';
|
||||
} else if (this.element_.classList.contains(this.CssClasses_.LEFT)) {
|
||||
this.element_.style.left = props.left - this.element_.offsetWidth - 10 + 'px';
|
||||
} else {
|
||||
this.element_.style.top = props.top + props.height + 10 + 'px';
|
||||
}
|
||||
|
||||
this.element_.classList.add(this.CssClasses_.IS_ACTIVE);
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle mouseleave for tooltip.
|
||||
*
|
||||
* @private
|
||||
*/
|
||||
MaterialTooltip.prototype.handleMouseLeave_ = function() {
|
||||
this.element_.classList.remove(this.CssClasses_.IS_ACTIVE);
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize element.
|
||||
*/
|
||||
MaterialTooltip.prototype.init = function() {
|
||||
|
||||
if (this.element_) {
|
||||
var forElId = this.element_.getAttribute('for');
|
||||
|
||||
if (forElId) {
|
||||
this.forElement_ = document.getElementById(forElId);
|
||||
}
|
||||
|
||||
if (this.forElement_) {
|
||||
// It's left here because it prevents accidental text selection on Android
|
||||
if (!this.forElement_.hasAttribute('tabindex')) {
|
||||
this.forElement_.setAttribute('tabindex', '0');
|
||||
}
|
||||
|
||||
this.boundMouseEnterHandler = this.handleMouseEnter_.bind(this);
|
||||
this.boundMouseLeaveHandler = this.handleMouseLeave_.bind(this);
|
||||
this.forElement_.addEventListener('mouseenter', this.boundMouseEnterHandler, false);
|
||||
this.forElement_.addEventListener('touchend', this.boundMouseEnterHandler, false);
|
||||
this.forElement_.addEventListener('mouseleave', this.boundMouseLeaveHandler, false);
|
||||
window.addEventListener('touchstart', this.boundMouseLeaveHandler);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// The component registers itself. It can assume componentHandler is available
|
||||
// in the global scope.
|
||||
componentHandler.register({
|
||||
constructor: MaterialTooltip,
|
||||
classAsString: 'MaterialTooltip',
|
||||
cssClass: 'mdl-tooltip'
|
||||
});
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue