code stringlengths 24 2.07M | docstring stringlengths 25 85.3k | func_name stringlengths 1 92 | language stringclasses 1
value | repo stringlengths 5 64 | path stringlengths 4 172 | url stringlengths 44 218 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
function getClientRect(offsets) {
return _extends({}, offsets, {
right: offsets.left + offsets.width,
bottom: offsets.top + offsets.height
});
} | Given element offsets, generate an output similar to getBoundingClientRect
@method
@memberof Popper.Utils
@argument {Object} offsets
@returns {Object} ClientRect like output | getClientRect | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function getBoundingClientRect(element) {
var rect = {};
// IE10 10 FIX: Please, don't ask, the element isn't
// considered in DOM in some circumstances...
// This isn't reproducible in IE10 compatibility mode of IE11
try {
if (isIE(10)) {
rect = element.getBoundingClientRect();
var scrollTop... | Get bounding client rect of given element
@method
@memberof Popper.Utils
@param {HTMLElement} element
@return {Object} client rect | getBoundingClientRect | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function getOffsetRectRelativeToArbitraryNode(children, parent) {
var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var isIE10 = isIE(10);
var isHTML = parent.nodeName === 'HTML';
var childrenRect = getBoundingClientRect(children);
var parentRect = getBoundingClie... | Get bounding client rect of given element
@method
@memberof Popper.Utils
@param {HTMLElement} element
@return {Object} client rect | getOffsetRectRelativeToArbitraryNode | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function getViewportOffsetRectRelativeToArtbitraryNode(element) {
var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var html = element.ownerDocument.documentElement;
var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
var width = Math.max(html.... | Get bounding client rect of given element
@method
@memberof Popper.Utils
@param {HTMLElement} element
@return {Object} client rect | getViewportOffsetRectRelativeToArtbitraryNode | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function isFixed(element) {
var nodeName = element.nodeName;
if (nodeName === 'BODY' || nodeName === 'HTML') {
return false;
}
if (getStyleComputedProperty(element, 'position') === 'fixed') {
return true;
}
var parentNode = getParentNode(element);
if (!parentNode) {
return false;
}
return ... | Check if the given element is fixed or is inside a fixed parent
@method
@memberof Popper.Utils
@argument {Element} element
@argument {Element} customContainer
@returns {Boolean} answer to "isFixed?" | isFixed | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function getFixedPositionOffsetParent(element) {
// This check is needed to avoid errors in case one of the elements isn't defined for any reason
if (!element || !element.parentElement || isIE()) {
return document.documentElement;
}
var el = element.parentElement;
while (el && getStyleComputedProperty(el,... | Finds the first parent of an element that has a transformed property defined
@method
@memberof Popper.Utils
@argument {Element} element
@returns {Element} first transformed parent or documentElement | getFixedPositionOffsetParent | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
if (placement.indexOf('auto') === -1) {
return placement;
}
var boundaries = getBoundaries(popper, reference, padding, boundariesEl... | Utility used to transform the `auto` placement to the placement with more
available space.
@method
@memberof Popper.Utils
@argument {Object} data - The data object generated by update method
@argument {Object} options - Modifiers configuration and options
@returns {Object} The data object, properly modified | computeAutoPlacement | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function getReferenceOffsets(state, popper, reference) {
var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference);
return getOffsetRectRelativeToArbitrary... | Get offsets to the reference element
@method
@memberof Popper.Utils
@param {Object} state
@param {Element} popper - the popper element
@param {Element} reference - the reference element (the popper will be relative to this)
@param {Element} fixedPosition - is in fixed position mode
@returns {Object} An object containin... | getReferenceOffsets | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function getOuterSizes(element) {
var window = element.ownerDocument.defaultView;
var styles = window.getComputedStyle(element);
var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
var result = {
... | Get the outer sizes of the given element (offset size + margins)
@method
@memberof Popper.Utils
@argument {Element} element
@returns {Object} object containing width and height properties | getOuterSizes | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function getOppositePlacement(placement) {
var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
return placement.replace(/left|right|bottom|top/g, function (matched) {
return hash[matched];
});
} | Get the opposite placement of the given one
@method
@memberof Popper.Utils
@argument {String} placement
@returns {String} flipped placement | getOppositePlacement | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function getPopperOffsets(popper, referenceOffsets, placement) {
placement = placement.split('-')[0];
// Get popper node sizes
var popperRect = getOuterSizes(popper);
// Add position, width and height to our offsets object
var popperOffsets = {
width: popperRect.width,
height: popperRect.height
};... | Get offsets to the popper
@method
@memberof Popper.Utils
@param {Object} position - CSS position the Popper will get applied
@param {HTMLElement} popper - the popper element
@param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
@param {String} placement - one of the valid placem... | getPopperOffsets | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function find(arr, check) {
// use native find if supported
if (Array.prototype.find) {
return arr.find(check);
}
// use `filter` to obtain the same behavior of `find`
return arr.filter(check)[0];
} | Mimics the `find` method of Array
@method
@memberof Popper.Utils
@argument {Array} arr
@argument prop
@argument value
@returns index or -1 | find | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function findIndex(arr, prop, value) {
// use native findIndex if supported
if (Array.prototype.findIndex) {
return arr.findIndex(function (cur) {
return cur[prop] === value;
});
}
// use `find` + `indexOf` if `findIndex` isn't supported
var match = find(arr, function (obj) {
return obj[pro... | Return the index of the matching object
@method
@memberof Popper.Utils
@argument {Array} arr
@argument prop
@argument value
@returns index or -1 | findIndex | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function runModifiers(modifiers, data, ends) {
var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
modifiersToRun.forEach(function (modifier) {
if (modifier['function']) {
// eslint-disable-line dot-notation
console.warn('`modifier.function`... | Loop trough the list of modifiers and run them in order,
each of them will then edit the data object.
@method
@memberof Popper.Utils
@param {dataObject} data
@param {Array} modifiers
@param {String} ends - Optional modifier name used as stopper
@returns {dataObject} | runModifiers | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function update() {
// if popper is destroyed, don't perform any further update
if (this.state.isDestroyed) {
return;
}
var data = {
instance: this,
styles: {},
arrowStyles: {},
attributes: {},
flipped: false,
offsets: {}
};
// compute reference element offsets
data.offsets.r... | Updates the position of the popper, computing the new offsets and applying
the new style.<br />
Prefer `scheduleUpdate` over `update` because of performance reasons.
@method
@memberof Popper | update | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function isModifierEnabled(modifiers, modifierName) {
return modifiers.some(function (_ref) {
var name = _ref.name,
enabled = _ref.enabled;
return enabled && name === modifierName;
});
} | Helper used to know if the given modifier is enabled.
@method
@memberof Popper.Utils
@returns {Boolean} | isModifierEnabled | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function getSupportedPropertyName(property) {
var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
for (var i = 0; i < prefixes.length; i++) {
var prefix = prefixes[i];
var toCheck = prefix ? '' + prefix + upperProp : property;
if (... | Get the prefixed supported property name
@method
@memberof Popper.Utils
@argument {String} property (camelCase)
@returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix) | getSupportedPropertyName | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function destroy() {
this.state.isDestroyed = true;
// touch DOM only if `applyStyle` modifier is enabled
if (isModifierEnabled(this.modifiers, 'applyStyle')) {
this.popper.removeAttribute('x-placement');
this.popper.style.position = '';
this.popper.style.top = '';
this.popper.style.left = '';
... | Destroys the popper.
@method
@memberof Popper | destroy | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function getWindow(element) {
var ownerDocument = element.ownerDocument;
return ownerDocument ? ownerDocument.defaultView : window;
} | Get the window associated with the element
@argument {Element} element
@returns {Window} | getWindow | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function attachToScrollParents(scrollParent, event, callback, scrollParents) {
var isBody = scrollParent.nodeName === 'BODY';
var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
target.addEventListener(event, callback, { passive: true });
if (!isBody) {
attachToScrollParents(getScr... | Get the window associated with the element
@argument {Element} element
@returns {Window} | attachToScrollParents | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function setupEventListeners(reference, options, state, updateBound) {
// Resize event listener on window
state.updateBound = updateBound;
getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
// Scroll event listener on scroll parents
var scrollElement = getScrollParent(refe... | Setup needed event listeners used to update the popper position
@method
@memberof Popper.Utils
@private | setupEventListeners | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function enableEventListeners() {
if (!this.state.eventsEnabled) {
this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
}
} | It will add resize/scroll events and start recalculating
position of the popper element when they are triggered.
@method
@memberof Popper | enableEventListeners | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function removeEventListeners(reference, state) {
// Remove resize event listener on window
getWindow(reference).removeEventListener('resize', state.updateBound);
// Remove scroll event listener on scroll parents
state.scrollParents.forEach(function (target) {
target.removeEventListener('scroll', state.upd... | Remove event listeners used to update the popper position
@method
@memberof Popper.Utils
@private | removeEventListeners | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function disableEventListeners() {
if (this.state.eventsEnabled) {
cancelAnimationFrame(this.scheduleUpdate);
this.state = removeEventListeners(this.reference, this.state);
}
} | It will remove resize/scroll events and won't recalculate popper position
when they are triggered. It also won't trigger `onUpdate` callback anymore,
unless you call `update` method manually.
@method
@memberof Popper | disableEventListeners | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function isNumeric(n) {
return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
} | Tells if a given input is a number
@method
@memberof Popper.Utils
@param {*} input to check
@return {Boolean} | isNumeric | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function setStyles(element, styles) {
Object.keys(styles).forEach(function (prop) {
var unit = '';
// add unit if the value is numeric and is one of the following
if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
unit = 'px';
}
eleme... | Set the style to the given popper
@method
@memberof Popper.Utils
@argument {Element} element - Element to apply the style to
@argument {Object} styles
Object with a list of properties and values which will be applied to the element | setStyles | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function setAttributes(element, attributes) {
Object.keys(attributes).forEach(function (prop) {
var value = attributes[prop];
if (value !== false) {
element.setAttribute(prop, attributes[prop]);
} else {
element.removeAttribute(prop);
}
});
} | Set the attributes to the given popper
@method
@memberof Popper.Utils
@argument {Element} element - Element to apply the attributes to
@argument {Object} styles
Object with a list of properties and values which will be applied to the element | setAttributes | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function applyStyle(data) {
// any property present in `data.styles` will be applied to the popper,
// in this way we can make the 3rd party modifiers add custom styles to it
// Be aware, modifiers could override the properties defined in the previous
// lines of this modifier!
setStyles(data.instance.popper,... | @function
@memberof Modifiers
@argument {Object} data - The data object generated by `update` method
@argument {Object} data.styles - List of style properties - values to apply to popper element
@argument {Object} data.attributes - List of attribute properties - values to apply to popper element
@argument {Object} opti... | applyStyle | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
// compute reference element offsets
var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
// compute auto placement, store placement inside the data object,
// modifiers will be able to edit ... | Set the x-placement attribute before everything else because it could be used
to add margins to the popper margins needs to be calculated to get the
correct popper offsets.
@method
@memberof Popper.modifiers
@param {HTMLElement} reference - The reference element used to position the popper
@param {HTMLElement} popper -... | applyStyleOnLoad | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function getRoundedOffsets(data, shouldRound) {
var _data$offsets = data.offsets,
popper = _data$offsets.popper,
reference = _data$offsets.reference;
var round = Math.round,
floor = Math.floor;
var noRound = function noRound(v) {
return v;
};
var referenceWidth = round(reference.width)... | @function
@memberof Popper.Utils
@argument {Object} data - The data object generated by `update` method
@argument {Boolean} shouldRound - If the offsets should be rounded at all
@returns {Object} The popper's position offsets rounded
The tale of pixel-perfect positioning. It's still not 100% perfect, but as
good as it... | getRoundedOffsets | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
noRound = function noRound(v) {
return v;
} | @function
@memberof Popper.Utils
@argument {Object} data - The data object generated by `update` method
@argument {Boolean} shouldRound - If the offsets should be rounded at all
@returns {Object} The popper's position offsets rounded
The tale of pixel-perfect positioning. It's still not 100% perfect, but as
good as it... | noRound | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function computeStyle(data, options) {
var x = options.x,
y = options.y;
var popper = data.offsets.popper;
// Remove this legacy support in Popper.js v2
var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
return modifier.name === 'applyStyle';
}).gpuAcceleration;
... | @function
@memberof Modifiers
@argument {Object} data - The data object generated by `update` method
@argument {Object} options - Modifiers configuration and options
@returns {Object} The data object, properly modified | computeStyle | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function isModifierRequired(modifiers, requestingName, requestedName) {
var requesting = find(modifiers, function (_ref) {
var name = _ref.name;
return name === requestingName;
});
var isRequired = !!requesting && modifiers.some(function (modifier) {
return modifier.name === requestedName && modifier... | Helper used to know if the given modifier depends from another one.<br />
It checks if the needed modifier is listed and enabled.
@method
@memberof Popper.Utils
@param {Array} modifiers - list of modifiers
@param {String} requestingName - name of requesting modifier
@param {String} requestedName - name of requested mod... | isModifierRequired | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function arrow(data, options) {
var _data$offsets$arrow;
// arrow depends on keepTogether in order to work
if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
return data;
}
var arrowElement = options.element;
// if arrowElement is a string, suppose it's a CSS selector
if (... | @function
@memberof Modifiers
@argument {Object} data - The data object generated by update method
@argument {Object} options - Modifiers configuration and options
@returns {Object} The data object, properly modified | arrow | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function getOppositeVariation(variation) {
if (variation === 'end') {
return 'start';
} else if (variation === 'start') {
return 'end';
}
return variation;
} | Get the opposite placement variation of the given one
@method
@memberof Popper.Utils
@argument {String} placement variation
@returns {String} flipped placement variation | getOppositeVariation | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function clockwise(placement) {
var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
var index = validPlacements.indexOf(placement);
var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
return counter ? arr.reverse() : arr;
} | Given an initial placement, returns all the subsequent placements
clockwise (or counter-clockwise).
@method
@memberof Popper.Utils
@argument {String} placement - A valid placement (it accepts variations)
@argument {Boolean} counter - Set to true to walk the placements counterclockwise
@returns {Array} placements inclu... | clockwise | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function flip(data, options) {
// if `inner` modifier is enabled, we can't use the `flip` modifier
if (isModifierEnabled(data.instance.modifiers, 'inner')) {
return data;
}
if (data.flipped && data.placement === data.originalPlacement) {
// seems like flip is trying to loop, probably there's not enough... | @function
@memberof Modifiers
@argument {Object} data - The data object generated by update method
@argument {Object} options - Modifiers configuration and options
@returns {Object} The data object, properly modified | flip | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function keepTogether(data) {
var _data$offsets = data.offsets,
popper = _data$offsets.popper,
reference = _data$offsets.reference;
var placement = data.placement.split('-')[0];
var floor = Math.floor;
var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
var side = isVertical ? 'right' :... | @function
@memberof Modifiers
@argument {Object} data - The data object generated by update method
@argument {Object} options - Modifiers configuration and options
@returns {Object} The data object, properly modified | keepTogether | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function toValue(str, measurement, popperOffsets, referenceOffsets) {
// separate value from unit
var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
var value = +split[1];
var unit = split[2];
// If it's not a number it's an operator, I guess
if (!value) {
return str;
}
if (unit.indexOf('%') === ... | Converts a string containing value + unit into a px value number
@function
@memberof {modifiers~offset}
@private
@argument {String} str - Value + unit string
@argument {String} measurement - `height` or `width`
@argument {Object} popperOffsets
@argument {Object} referenceOffsets
@returns {Number|String}
Value in pixels... | toValue | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
var offsets = [0, 0];
// Use height if placement is left or right and index is 0 otherwise use width
// in this way the first offset will use an axis and the second one
// will use the other one
var useHeight = ['right', 'left'].i... | Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
@function
@memberof {modifiers~offset}
@private
@argument {String} offset
@argument {Object} popperOffsets
@argument {Object} referenceOffsets
@argument {String} basePlacement
@returns {Array} a two cells array with x and y offsets in numbers | parseOffset | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function offset(data, _ref) {
var offset = _ref.offset;
var placement = data.placement,
_data$offsets = data.offsets,
popper = _data$offsets.popper,
reference = _data$offsets.reference;
var basePlacement = placement.split('-')[0];
var offsets = void 0;
if (isNumeric(+offset)) {
offsets... | @function
@memberof Modifiers
@argument {Object} data - The data object generated by update method
@argument {Object} options - Modifiers configuration and options
@argument {Number|String} options.offset=0
The offset value as described in the modifier description
@returns {Object} The data object, properly modified | offset | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function preventOverflow(data, options) {
var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
// If offsetParent is the reference element, we really want to
// go one step up and use the next offsetParent as reference to
// avoid to make this modifier completely useless ... | @function
@memberof Modifiers
@argument {Object} data - The data object generated by `update` method
@argument {Object} options - Modifiers configuration and options
@returns {Object} The data object, properly modified | preventOverflow | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function shift(data) {
var placement = data.placement;
var basePlacement = placement.split('-')[0];
var shiftvariation = placement.split('-')[1];
// if shift shiftvariation is specified, run the modifier
if (shiftvariation) {
var _data$offsets = data.offsets,
reference = _data$offsets.reference,
... | @function
@memberof Modifiers
@argument {Object} data - The data object generated by `update` method
@argument {Object} options - Modifiers configuration and options
@returns {Object} The data object, properly modified | shift | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function hide(data) {
if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
return data;
}
var refRect = data.offsets.reference;
var bound = find(data.instance.modifiers, function (modifier) {
return modifier.name === 'preventOverflow';
}).boundaries;
if (refRect.bottom < ... | @function
@memberof Modifiers
@argument {Object} data - The data object generated by update method
@argument {Object} options - Modifiers configuration and options
@returns {Object} The data object, properly modified | hide | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function inner(data) {
var placement = data.placement;
var basePlacement = placement.split('-')[0];
var _data$offsets = data.offsets,
popper = _data$offsets.popper,
reference = _data$offsets.reference;
var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
var subtractLength = ['top', 'l... | @function
@memberof Modifiers
@argument {Object} data - The data object generated by `update` method
@argument {Object} options - Modifiers configuration and options
@returns {Object} The data object, properly modified | inner | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function Popper(reference, popper) {
var _this = this;
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
classCallCheck(this, Popper);
this.scheduleUpdate = function () {
return requestAnimationFrame(_this.update);
};
// make update() debounced, so th... | Creates a new Popper.js instance.
@class Popper
@param {HTMLElement|referenceObject} reference - The reference element used to position the popper
@param {HTMLElement} popper - The HTML element used as the popper
@param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
@return... | Popper | javascript | JosephusPaye/Keen-UI | lib/UiConfirm.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiConfirm.js | MIT |
function arrayFrom(value) {
return [].slice.call(value);
} | Ponyfill for Array.from - converts iterable values to an array | arrayFrom | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function closestCallback(element, callback) {
while (element) {
if (callback(element)) {
return element;
}
element = element.parentElement;
}
} | Works like Element.prototype.closest, but uses a callback instead | closestCallback | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function getDataAttributeOptions(reference) {
return keys.reduce(function (acc, key) {
var valueAsString = (reference.getAttribute("data-tippy-".concat(key)) || '').trim();
if (!valueAsString) {
return acc;
}
if (key === 'content') {
acc[key] = valueAsString;
} else {
try {
... | Returns an object of optional props from data-tippy-* attributes | getDataAttributeOptions | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function polyfillElementPrototypeProperties(virtualReference) {
var polyfills = {
isVirtual: true,
attributes: virtualReference.attributes || {},
setAttribute: function setAttribute(key, value) {
virtualReference.attributes[key] = value;
},
getAttribute: function getAttribute(key) {
re... | Polyfills the virtual reference (plain object) with Element.prototype props
Mutating because DOM elements are mutated, adds `_tippy` property | polyfillElementPrototypeProperties | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function isBareVirtualElement(value) {
return {}.toString.call(value) === '[object Object]' && !value.addEventListener;
} | Determines if a value is a "bare" virtual element (before mutations done
by `polyfillElementPrototypeProperties()`). JSDOM elements show up as
[object Object], we can check if the value is "element-like" if it has
`addEventListener` | isBareVirtualElement | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function hasOwnProperty(obj, key) {
return {}.hasOwnProperty.call(obj, key);
} | Safe .hasOwnProperty check, for prototype-less objects | hasOwnProperty | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function getArrayOfElements(value) {
if (isSingular(value)) {
// TODO: VirtualReference is not compatible to type Element
return [value];
}
if (value instanceof NodeList) {
return arrayFrom(value);
}
if (Array.isArray(value)) {
return value;
}
try {
return arrayFrom(document.querySe... | Returns an array of elements based on the value | getArrayOfElements | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function getValue(value, index, defaultValue) {
if (Array.isArray(value)) {
var v = value[index];
return v == null ? defaultValue : v;
}
return value;
} | Returns a value at a given index depending on if it's an array or number | getValue | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function getModifier(obj, key) {
return obj && obj.modifiers && obj.modifiers[key];
} | Prevents errors from being thrown while accessing nested modifier objects
in `popperOptions` | getModifier | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function includes(a, b) {
return a.indexOf(b) > -1;
} | Determines if an array or string includes a value | includes | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function isSingular(value) {
return !!(value && hasOwnProperty(value, 'isVirtual')) || value instanceof Element;
} | Determines if the value is singular-like | isSingular | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function innerHTML() {
return 'innerHTML';
} | Firefox extensions don't allow setting .innerHTML directly, this will trick it | innerHTML | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function evaluateValue(value, args) {
return typeof value === 'function' ? value.apply(null, args) : value;
} | Evaluates a function if one, or returns the value | evaluateValue | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function setFlipModifierEnabled(modifiers, value) {
modifiers.filter(function (m) {
return m.name === 'flip';
})[0].enabled = value;
} | Sets a popperInstance `flip` modifier's enabled state | setFlipModifierEnabled | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function canReceiveFocus(element) {
return element instanceof Element ? matches.call(element, 'a[href],area[href],button,details,input,textarea,select,iframe,[tabindex]') && !element.hasAttribute('disabled') : true;
} | Determines if an element can receive focus
Always returns true for virtual objects | canReceiveFocus | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function setTransitionDuration(els, value) {
els.forEach(function (el) {
if (el) {
el.style.transitionDuration = "".concat(value, "ms");
}
});
} | Applies a transition duration to a list of elements | setTransitionDuration | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function setVisibilityState(els, state) {
els.forEach(function (el) {
if (el) {
el.setAttribute('data-state', state);
}
});
} | Sets the visibility state to elements so they can begin to transition | setVisibilityState | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function evaluateProps(reference, props) {
var out = _extends({}, props, {
content: evaluateValue(props.content, [reference])
}, props.ignoreAttributes ? {} : getDataAttributeOptions(reference));
if (out.arrow || isUCBrowser) {
out.animateFill = false;
}
return out;
} | Evaluates the props object by merging data attributes and
disabling conflicting options where necessary | evaluateProps | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function validateOptions(options, defaultProps) {
Object.keys(options).forEach(function (option) {
if (!hasOwnProperty(defaultProps, option)) {
throw new Error("[tippy]: `".concat(option, "` is not a valid option"));
}
});
} | Validates an object of options with the valid default props object | validateOptions | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function setInnerHTML(element, html) {
element[innerHTML()] = html instanceof Element ? html[innerHTML()] : html;
} | Sets the innerHTML of an element | setInnerHTML | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function getChildren(popper) {
return {
tooltip: popper.querySelector(TOOLTIP_SELECTOR),
backdrop: popper.querySelector(BACKDROP_SELECTOR),
content: popper.querySelector(CONTENT_SELECTOR),
arrow: popper.querySelector(ARROW_SELECTOR) || popper.querySelector(ROUND_ARROW_SELECTOR)
};
} | Returns the child elements of a popper element | getChildren | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function createArrowElement(arrowType) {
var arrow = div();
if (arrowType === 'round') {
arrow.className = 'tippy-roundarrow';
setInnerHTML(arrow, '<svg viewBox="0 0 18 7" xmlns="http://www.w3.org/2000/svg"><path d="M0 7s2.021-.015 5.253-4.218C6.584 1.051 7.797.007 9 0c1.203-.007 2.416 1.035 3.761 2.782C16... | Creates an arrow element and returns it | createArrowElement | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function createBackdropElement() {
var backdrop = div();
backdrop.className = 'tippy-backdrop';
backdrop.setAttribute('data-state', 'hidden');
return backdrop;
} | Creates a backdrop element and returns it | createBackdropElement | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function updateTransitionEndListener(tooltip, action, listener) {
// UC Browser hasn't adopted the `transitionend` event despite supporting
// unprefixed transitions...
var eventName = isUCBrowser && document.body.style.webkitTransition !== undefined ? 'webkitTransitionEnd' : 'transitionend';
tooltip[action + '... | Add/remove transitionend listener from tooltip | updateTransitionEndListener | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function getBasicPlacement(popper) {
var fullPlacement = popper.getAttribute(PLACEMENT_ATTRIBUTE);
return fullPlacement ? fullPlacement.split('-')[0] : '';
} | Returns the popper's placement, ignoring shifting (top-start, etc) | getBasicPlacement | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function updateTheme(tooltip, action, theme) {
theme.split(' ').forEach(function (themeName) {
tooltip.classList[action](themeName + '-theme');
});
} | Adds/removes theme from tooltip's classList | updateTheme | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function createPopperElement(id, props) {
var popper = div();
popper.className = 'tippy-popper';
popper.id = "tippy-".concat(id);
popper.style.zIndex = '' + props.zIndex;
if (props.role) {
popper.setAttribute('role', props.role);
}
var tooltip = div();
tooltip.className = 'tippy-tooltip';
toolti... | Constructs the popper element and returns it | createPopperElement | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function updatePopperElement(popper, prevProps, nextProps) {
var _getChildren = getChildren(popper),
tooltip = _getChildren.tooltip,
content = _getChildren.content,
backdrop = _getChildren.backdrop,
arrow = _getChildren.arrow;
popper.style.zIndex = '' + nextProps.zIndex;
tooltip.setAttrib... | Updates the popper element based on the new props | updatePopperElement | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function afterPopperPositionUpdates(popperInstance, callback) {
var popper = popperInstance.popper,
options = popperInstance.options;
var onCreate = options.onCreate,
onUpdate = options.onUpdate;
options.onCreate = options.onUpdate = function (data) {
reflow(popper);
callback();
if (onUp... | Runs the callback after the popper's position has been updated
update() is debounced with Promise.resolve() or setTimeout()
scheduleUpdate() is update() wrapped in requestAnimationFrame() | afterPopperPositionUpdates | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function hideAll() {
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
checkHideOnClick = _ref.checkHideOnClick,
exclude = _ref.exclude,
duration = _ref.duration;
arrayFrom(document.querySelectorAll(POPPER_SELECTOR)).forEach(function (popper) {
var instance = ... | Hides all visible poppers on the document | hideAll | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function isCursorOutsideInteractiveBorder(popperPlacement, popperRect, event, props) {
if (!popperPlacement) {
return true;
}
var x = event.clientX,
y = event.clientY;
var interactiveBorder = props.interactiveBorder,
distance = props.distance;
var exceedsTop = popperRect.top - y > (popperPlac... | Determines if the mouse cursor is outside of the popper's interactive border
region | isCursorOutsideInteractiveBorder | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function getOffsetDistanceInPx(distance) {
return -(distance - 10) + 'px';
} | Returns the distance offset, taking into account the default offset due to
the transform: translate() rule (10px) in CSS | getOffsetDistanceInPx | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function onDocumentTouch() {
if (isUsingTouch) {
return;
}
isUsingTouch = true;
if (isIOS) {
document.body.classList.add(IOS_CLASS);
}
if (window.performance) {
document.addEventListener('mousemove', onDocumentMouseMove);
}
} | Returns the distance offset, taking into account the default offset due to
the transform: translate() rule (10px) in CSS | onDocumentTouch | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function onDocumentMouseMove() {
var now = performance.now(); // Chrome 60+ is 1 mousemove per animation frame, use 20ms time difference
if (now - lastMouseMoveTime < 20) {
isUsingTouch = false;
document.removeEventListener('mousemove', onDocumentMouseMove);
if (!isIOS) {
document.body.classList... | Returns the distance offset, taking into account the default offset due to
the transform: translate() rule (10px) in CSS | onDocumentMouseMove | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function onDocumentClick(event) {
// Simulated events dispatched on the document
if (!(event.target instanceof Element)) {
return hideAll();
} // Clicked on an interactive popper
var popper = closest(event.target, POPPER_SELECTOR);
if (popper && popper._tippy && popper._tippy.props.interactive) {
r... | Returns the distance offset, taking into account the default offset due to
the transform: translate() rule (10px) in CSS | onDocumentClick | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function onWindowBlur() {
var _document = document,
activeElement = _document.activeElement;
if (activeElement && activeElement.blur && activeElement._tippy) {
activeElement.blur();
}
} | Returns the distance offset, taking into account the default offset due to
the transform: translate() rule (10px) in CSS | onWindowBlur | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function bindGlobalEventListeners() {
document.addEventListener('click', onDocumentClick, true);
document.addEventListener('touchstart', onDocumentTouch, PASSIVE);
window.addEventListener('blur', onWindowBlur);
} | Adds the needed global event listeners | bindGlobalEventListeners | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function getTransitionableElements() {
return [instance.popperChildren.tooltip, instance.popperChildren.backdrop, instance.popperChildren.content];
} | Returns transitionable inner elements used in show/hide methods | getTransitionableElements | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function hasFollowCursorBehavior() {
return instance.props.followCursor && !isUsingTouch && lastTriggerEventType !== 'focus';
} | Determines if the instance is in `followCursor` mode | hasFollowCursorBehavior | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function makeSticky() {
setTransitionDuration([instance.popper], isIE ? 0 : instance.props.updateDuration);
function updatePosition() {
if (instance.popperInstance) {
instance.popperInstance.scheduleUpdate();
}
if (instance.state.isMounted) {
requestAnimationFrame(updatePosit... | Updates the tooltip's position on each animation frame | makeSticky | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function updatePosition() {
if (instance.popperInstance) {
instance.popperInstance.scheduleUpdate();
}
if (instance.state.isMounted) {
requestAnimationFrame(updatePosition);
} else {
setTransitionDuration([instance.popper], 0);
}
} | Updates the tooltip's position on each animation frame | updatePosition | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function onTransitionedOut(duration, callback) {
onTransitionEnd(duration, function () {
if (!instance.state.isVisible && currentParentNode && currentParentNode.contains(instance.popper)) {
callback();
}
});
} | Invokes a callback once the tooltip has fully transitioned out | onTransitionedOut | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function onTransitionedIn(duration, callback) {
onTransitionEnd(duration, callback);
} | Invokes a callback once the tooltip has fully transitioned in | onTransitionedIn | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function onTransitionEnd(duration, callback) {
var tooltip = instance.popperChildren.tooltip;
/**
* Listener added as the `transitionend` handler
*/
function listener(event) {
if (event.target === tooltip) {
updateTransitionEndListener(tooltip, 'remove', listener);
callback(... | Invokes a callback once the tooltip's CSS transition ends | onTransitionEnd | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function listener(event) {
if (event.target === tooltip) {
updateTransitionEndListener(tooltip, 'remove', listener);
callback();
}
} // Make callback synchronous if duration is 0 | Listener added as the `transitionend` handler | listener | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function on(eventType, handler) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
instance.reference.addEventListener(eventType, handler, options);
listeners.push({
eventType: eventType,
handler: handler,
options: options
});
} | Adds an event listener to the reference and stores it in `listeners` | on | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function addTriggersToReference() {
if (instance.props.touchHold && !instance.props.target) {
on('touchstart', onTrigger, PASSIVE);
on('touchend', onMouseLeave, PASSIVE);
}
instance.props.trigger.trim().split(' ').forEach(function (eventType) {
if (eventType === 'manual') {
return... | Adds event listeners to the reference based on the `trigger` prop | addTriggersToReference | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function removeTriggersFromReference() {
listeners.forEach(function (_ref) {
var eventType = _ref.eventType,
handler = _ref.handler,
options = _ref.options;
instance.reference.removeEventListener(eventType, handler, options);
});
listeners = [];
} | Removes event listeners from the reference | removeTriggersFromReference | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function positionVirtualReferenceNearCursor(event) {
var _lastMouseMoveEvent = lastMouseMoveEvent = event,
clientX = _lastMouseMoveEvent.clientX,
clientY = _lastMouseMoveEvent.clientY;
if (!instance.popperInstance) {
return;
} // Ensure virtual reference is padded to prevent tooltip f... | Positions the virtual reference near the cursor | positionVirtualReferenceNearCursor | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function createDelegateChildTippy(event) {
if (event) {
var targetEl = closest(event.target, instance.props.target);
if (targetEl && !targetEl._tippy) {
createTippy(targetEl, _extends({}, instance.props, {
content: evaluateValue(collectionProps.content, [targetEl]),
appendTo... | Creates the tippy instance for a delegate when it's been triggered | createDelegateChildTippy | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function onMouseMove(event) {
var referenceTheCursorIsOver = closestCallback(event.target, function (el) {
return el._tippy;
});
var isCursorOverPopper = closest(event.target, POPPER_SELECTOR) === instance.popper;
var isCursorOverReference = referenceTheCursorIsOver === instance.reference;
if... | Event listener used for interactive tooltips to detect when they should
hide | onMouseMove | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function onDelegateShow(event) {
if (closest(event.target, instance.props.target)) {
scheduleShow(event);
}
} | Event listener invoked when a child target is triggered | onDelegateShow | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function onDelegateHide(event) {
if (closest(event.target, instance.props.target)) {
scheduleHide();
}
} | Event listener invoked when a child target should hide | onDelegateHide | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
function isEventListenerStopped(event) {
var supportsTouch = 'ontouchstart' in window;
var isTouchEvent = includes(event.type, 'touch');
var touchHold = instance.props.touchHold;
return supportsTouch && isUsingTouch && touchHold && !isTouchEvent || isUsingTouch && !touchHold && isTouchEvent;
} | Determines if an event listener should stop further execution due to the
`touchHold` option | isEventListenerStopped | javascript | JosephusPaye/Keen-UI | lib/UiDatepicker.js | https://github.com/JosephusPaye/Keen-UI/blob/master/lib/UiDatepicker.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.