@instructure/ui-utils
Advanced tools
Comparing version 4.7.0 to 4.7.1-dev.0
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -2,0 +26,0 @@ * --- |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -2,0 +26,0 @@ * --- |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -2,0 +26,0 @@ * --- |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode'; | ||
@@ -2,0 +26,0 @@ |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode'; | ||
@@ -2,0 +26,0 @@ import getBoundingClientRect from './getBoundingClientRect'; |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode'; | ||
@@ -2,0 +26,0 @@ import requestAnimationFrame from './requestAnimationFrame'; |
@@ -1,448 +0,35 @@ | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
import getBoundingClientRect from './getBoundingClientRect'; | ||
import getScrollParents from './getScrollParents'; | ||
import getOffsetParents from './getOffsetParents'; | ||
import canUseDOM from './canUseDOM'; | ||
import findDOMNode from './findDOMNode'; | ||
import ownerDocument from './ownerDocument'; | ||
import ownerWindow from './ownerWindow'; | ||
/** | ||
* --- | ||
* category: utilities/DOM | ||
* --- | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Calculate the coordinates to attach an element | ||
* to a designated target with specified constraints | ||
* @module | ||
* @param {ReactComponent|DomNode} el - component or DOM node | ||
* @param {DomNode} target - the target DOM node | ||
* @param {Object} options - constraints for the positioning | ||
* @param {string} options.placement - designates where the element will be attached | ||
* ('top', 'bottom', 'left', 'right', 'top left' etc.) | ||
* @param {DomNode} options.container - DOM node where the element is contained | ||
* @param {boolean} options.over - whether or not you want the element to position over the target | ||
* @param {string} options.constrain - if the element should be constrained to 'window', | ||
* 'scroll-parent', 'parent', or 'none' | ||
* @param {string|number} options.offsetX - the horizontal offset for the positioned element | ||
* @param {string|number} options.offsetY - the vertical offset for the positioned element | ||
* @returns {Object} object containing style with the calculated position in the 'transform' | ||
* property | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
export default function calculateElementPosition(element, target, options) { | ||
if (!element || options.placement === 'offscreen') { | ||
return { | ||
placement: options.placement, | ||
style: { | ||
left: '-9999em', | ||
overflow: 'hidden', | ||
position: 'absolute' | ||
} | ||
}; | ||
} | ||
var pos = new PositionData(element, target, options); | ||
// Relative import here because we cannot import ui-layout without creating a circular dependency. It | ||
// will be removed along with this file when we eliminate calculateElementPosition from ui-utils completely. | ||
import UIcalculateElementPosition from '../../../ui-layout/lib/utils/calculateElementPosition'; | ||
return { | ||
placement: pos.placement, | ||
style: pos.style | ||
}; | ||
} | ||
import { changedPackageWarning } from '../react/deprecated'; | ||
import warning from '../warning'; | ||
var PositionedElement = function () { | ||
function PositionedElement(element, placement) { | ||
var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { top: 0, left: 0 }; | ||
_classCallCheck(this, PositionedElement); | ||
this.node = findDOMNode(element); | ||
if (typeof placement === 'string') { | ||
this.placement = parsePlacement(placement); | ||
} else if (Array.isArray(placement)) { | ||
this.placement = placement; | ||
} else { | ||
this.placement = ['bottom', 'center']; | ||
} | ||
this.rect = getBoundingClientRect(this.node); | ||
this._offset = offsetToPx(offset, this.size); | ||
} | ||
_createClass(PositionedElement, [{ | ||
key: 'calculateOffset', | ||
value: function calculateOffset(placement) { | ||
var offsetMap = { | ||
top: 0, | ||
start: 0, | ||
center: '50%', | ||
bottom: '100%', | ||
end: '100%', | ||
stretch: 0 | ||
}; | ||
var _placement = _slicedToArray(placement, 2), | ||
first = _placement[0], | ||
second = _placement[1]; | ||
if (['start', 'end'].indexOf(first) >= 0) { | ||
var _ref = [second, first]; | ||
first = _ref[0]; | ||
second = _ref[1]; | ||
} | ||
var top = 0; | ||
var left = 0; | ||
if (typeof offsetMap[first] !== 'undefined') { | ||
top = offsetMap[first]; | ||
} | ||
if (typeof offsetMap[second] !== 'undefined') { | ||
left = offsetMap[second]; | ||
} | ||
return addOffsets([offsetToPx({ top: top, left: left }, this.size), parseOffset(this._offset, this.placement)]); | ||
} | ||
}, { | ||
key: 'width', | ||
get: function get() { | ||
return this.rect.width; | ||
} | ||
}, { | ||
key: 'height', | ||
get: function get() { | ||
return this.rect.height; | ||
} | ||
}, { | ||
key: 'size', | ||
get: function get() { | ||
return { | ||
width: this.width, | ||
height: this.height | ||
}; | ||
} | ||
}, { | ||
key: 'position', | ||
get: function get() { | ||
return { | ||
top: this.rect.top, | ||
left: this.rect.left | ||
}; | ||
} | ||
}, { | ||
key: 'hasVerticalPlacement', | ||
get: function get() { | ||
return ['top', 'bottom'].indexOf(this.placement[0]) >= 0; | ||
} | ||
}, { | ||
key: 'hasHorizontalPlacement', | ||
get: function get() { | ||
return ['start', 'end'].indexOf(this.placement[0]) >= 0; | ||
} | ||
}, { | ||
key: 'shouldStretchVertically', | ||
get: function get() { | ||
return this.placement[1] === 'stretch' && this.hasVerticalPlacement; | ||
} | ||
}, { | ||
key: 'shouldStretchHorizontally', | ||
get: function get() { | ||
return this.placement[1] === 'stretch' && this.hasHorizontalPlacement; | ||
} | ||
}, { | ||
key: 'mirroredPlacement', | ||
get: function get() { | ||
var _placement2 = _slicedToArray(this.placement, 2), | ||
first = _placement2[0], | ||
second = _placement2[1]; | ||
var mirror = { | ||
center: 'center', | ||
start: 'end', | ||
end: 'start', | ||
top: 'bottom', | ||
bottom: 'top', | ||
stretch: 'stretch' | ||
}; | ||
return [mirror[first], second]; | ||
} | ||
}, { | ||
key: 'scrollParentsOffset', | ||
get: function get() { | ||
var parents = getScrollParents(this.node); | ||
var offsetY = 0; | ||
var offsetX = 0; | ||
for (var i = 1; i < parents.length; i++) { | ||
var parent = parents[i]; | ||
var child = parents[i - 1]; | ||
offsetY = offsetY + (parent.scrollTop - child.scrollTop); | ||
offsetX = offsetX + (parent.scrollLeft - child.scrollLeft); | ||
} | ||
return { top: offsetY, left: offsetX }; | ||
} | ||
}, { | ||
key: 'positionedParentsOffset', | ||
get: function get() { | ||
// If the element container is within a positioned | ||
// element, it will position absolutely with respect to that | ||
// ancestor. We calculate the offset between the child and | ||
// positioned parent so we can negate that distance | ||
var parents = getOffsetParents(this.node); | ||
var offsetY = 0; | ||
var offsetX = 0; | ||
for (var i = 1; i < parents.length; i++) { | ||
var parent = getBoundingClientRect(parents[i]); | ||
var child = getBoundingClientRect(parents[i - 1]); | ||
offsetY = offsetY + (child.top - parent.top); | ||
offsetX = offsetX + (child.left - parent.left); | ||
} | ||
return { top: offsetY, left: offsetX }; | ||
} | ||
}]); | ||
return PositionedElement; | ||
}(); | ||
var PositionData = function () { | ||
function PositionData(element, target, options) { | ||
_classCallCheck(this, PositionData); | ||
this.options = options || {}; | ||
var _options = this.options, | ||
container = _options.container, | ||
constrain = _options.constrain, | ||
placement = _options.placement, | ||
over = _options.over; | ||
if (!element || placement === 'offscreen') return; | ||
this.container = container || ownerDocument(element).body; | ||
this.element = new PositionedElement(element, placement, { top: this.options.offsetY, left: this.options.offsetX }); | ||
this.target = new PositionedElement(target || this.container, over ? this.element.placement : this.element.mirroredPlacement); | ||
if (constrain === 'window') { | ||
this.constrainTo(ownerWindow(element)); | ||
} else if (constrain === 'scroll-parent') { | ||
this.constrainTo(getScrollParents(this.target.node)[0]); | ||
} else if (constrain === 'parent') { | ||
this.constrainTo(this.container); | ||
} | ||
} | ||
_createClass(PositionData, [{ | ||
key: 'constrainTo', | ||
value: function constrainTo(element) { | ||
if (!element) return; | ||
var _addOffsets = addOffsets([this.target.position, this.offset]), | ||
top = _addOffsets.top, | ||
left = _addOffsets.left; | ||
var bounds = getBoundingClientRect(element); | ||
var right = left + this.element.positionedParentsOffset.left + this.element.width; | ||
var oob = { | ||
top: top < bounds.top, | ||
bottom: top + this.element.height > bounds.bottom, | ||
left: left < bounds.left, | ||
right: right > bounds.right | ||
}; | ||
if (this.element.hasVerticalPlacement) { | ||
if (oob.left && oob.right) { | ||
this.element.placement[1] = 'center'; | ||
this.target.placement[1] = 'center'; | ||
} else if (oob.left) { | ||
this.element.placement[1] = 'start'; | ||
this.target.placement[1] = 'start'; | ||
} else if (oob.right) { | ||
this.element.placement[1] = 'end'; | ||
this.target.placement[1] = 'end'; | ||
} | ||
if (oob.top) { | ||
this.element.placement[0] = 'bottom'; | ||
this.target.placement[0] = 'top'; | ||
} else if (oob.bottom) { | ||
this.element.placement[0] = 'top'; | ||
this.target.placement[0] = 'bottom'; | ||
} | ||
} else if (this.element.hasHorizontalPlacement) { | ||
if (oob.top && oob.bottom) { | ||
this.element.placement[1] = 'center'; | ||
this.target.placement[1] = 'center'; | ||
} else if (oob.top) { | ||
this.element.placement[1] = 'top'; | ||
this.target.placement[1] = 'top'; | ||
} else if (oob.bottom) { | ||
this.element.placement[1] = 'bottom'; | ||
this.target.placement[1] = 'bottom'; | ||
} | ||
if (oob.left) { | ||
this.element.placement[0] = 'end'; | ||
this.target.placement[0] = 'start'; | ||
} else if (oob.right) { | ||
this.element.placement[0] = 'start'; | ||
this.target.placement[0] = 'end'; | ||
} | ||
} | ||
} | ||
}, { | ||
key: 'offset', | ||
get: function get() { | ||
var _target$calculateOffs = this.target.calculateOffset(this.element.placement), | ||
top = _target$calculateOffs.top, | ||
left = _target$calculateOffs.left; | ||
var offset = addOffsets([this.element.calculateOffset(this.target.placement), this.element.scrollParentsOffset, this.element.positionedParentsOffset]); | ||
return { | ||
top: top - offset.top, | ||
left: left - offset.left | ||
}; | ||
} | ||
}, { | ||
key: 'placement', | ||
get: function get() { | ||
return formatPlacement(this.element.placement); | ||
} | ||
}, { | ||
key: 'minWidth', | ||
get: function get() { | ||
return this.element.shouldStretchVertically ? this.target.width : null; | ||
} | ||
}, { | ||
key: 'minHeight', | ||
get: function get() { | ||
return this.element.shouldStretchHorizontally ? this.target.height : null; | ||
} | ||
}, { | ||
key: 'position', | ||
get: function get() { | ||
var win = ownerWindow(this.target.node); | ||
var _addOffsets2 = addOffsets([this.target.position, this.offset]), | ||
left = _addOffsets2.left, | ||
top = _addOffsets2.top; | ||
if (canUseDOM && win.matchMedia) { | ||
var retina = win.matchMedia('only screen and (min-resolution: 1.3dppx)').matches || win.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 1.3)').matches; | ||
if (!retina) { | ||
left = Math.round(left); | ||
top = Math.round(top); | ||
} | ||
} | ||
return { left: left, top: top }; | ||
} | ||
}, { | ||
key: 'style', | ||
get: function get() { | ||
return { | ||
top: 0, | ||
left: 0, | ||
minWidth: this.minWidth, | ||
minHeight: this.minHeight, | ||
position: 'absolute', | ||
transform: 'translateX(' + this.position.left + 'px) translateY(' + this.position.top + 'px) translateZ(0)' | ||
}; | ||
} | ||
}]); | ||
return PositionData; | ||
}(); | ||
function addOffsets(offsets) { | ||
return offsets.reduce(function (sum, offset) { | ||
return { | ||
top: sum.top + offset.top, | ||
left: sum.left + offset.left | ||
}; | ||
}, { top: 0, left: 0 }); | ||
} | ||
function parseOffset(offset, placement) { | ||
var top = offset.top, | ||
left = offset.left; | ||
if (placement[0] === 'bottom') { | ||
top = 0 - parseFloat(top, 10); | ||
} | ||
if (placement[0] === 'end') { | ||
left = 0 - parseFloat(left, 10); | ||
} | ||
return { | ||
top: top, | ||
left: left | ||
}; | ||
} | ||
function offsetToPx(offset, size) { | ||
var left = offset.left, | ||
top = offset.top; | ||
if (typeof left === 'string' && left.indexOf('%') !== -1) { | ||
left = parseFloat(left, 10) / 100 * size.width; // eslint-disable-line no-mixed-operators | ||
} else { | ||
left = parseFloat(left, 10); | ||
} | ||
if (typeof top === 'string' && top.indexOf('%') !== -1) { | ||
top = parseFloat(top, 10) / 100 * size.height; // eslint-disable-line no-mixed-operators | ||
} else { | ||
top = parseFloat(top, 10); | ||
} | ||
return { top: top, left: left }; | ||
} | ||
function sortPlacement(placement) { | ||
var _placement3 = _slicedToArray(placement, 2), | ||
first = _placement3[0], | ||
second = _placement3[1]; | ||
if (first === 'center' || first === 'stretch') { | ||
var _ref2 = [second, first]; | ||
first = _ref2[0]; | ||
second = _ref2[1]; | ||
} | ||
return [first, second]; | ||
} | ||
export function parsePlacement(placement) { | ||
var parsed = placement.split(' '); | ||
if (parsed.length === 1) { | ||
parsed = [placement, 'center']; | ||
} | ||
return sortPlacement(parsed); | ||
} | ||
function formatPlacement(placement) { | ||
return placement.join(' '); | ||
export default function calculateElementPosition(element, target, options) { | ||
warning(false, '[%s] was deprecated in version %s. %s', 'calculateElementPosition', '5.0.0', changedPackageWarning('ui-utils', 'ui-layout')); | ||
return UIcalculateElementPosition(element, target, options); | ||
} |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -2,0 +26,0 @@ * --- |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode'; | ||
@@ -2,0 +26,0 @@ import canUseDOM from './canUseDOM'; |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode'; | ||
@@ -2,0 +26,0 @@ import getActiveElement from './getActiveElement'; |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import ReactDOM from 'react-dom'; | ||
@@ -2,0 +26,0 @@ |
@@ -1,76 +0,33 @@ | ||
/** | ||
* Adapted from jQuery UI core | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* http://jqueryui.com | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Copyright 2014 jQuery Foundation and other contributors | ||
* Released under the MIT license. | ||
* http://jquery.org/license | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* http://api.jqueryui.com/category/ui-core/ | ||
**/ | ||
import getComputedStyle from './getComputedStyle'; | ||
import findDOMNode from './findDOMNode'; | ||
/** | ||
* --- | ||
* category: utilities/DOM | ||
* --- | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* Given an element, finds and returns all tabbable children. | ||
* Tabbable elements include input, select, textarea, button, and object. | ||
* Anchor tags are also tabbable if they include an href or positive | ||
* tabindex attribute. | ||
* | ||
* @param {ReactComponent|DomNode} el - component or DOM node | ||
* @returns {Array} array of all tabbable children | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
export default function findTabbable(el) { | ||
var element = findDOMNode(el); | ||
if (!element || typeof element.querySelectorAll !== 'function') { | ||
return []; | ||
} | ||
import UIFindTabbable from '@instructure/ui-a11y/lib/utils/findTabbable'; | ||
var focusableSelector = 'a[href],frame,iframe,object,input:not([type=hidden]),select,textarea,button,*[tabindex]'; | ||
var matches = element.querySelectorAll(focusableSelector); | ||
return [].slice.call(matches, 0).filter(function (el) { | ||
return tabbable(el); | ||
}); | ||
} | ||
import { changedPackageWarning } from '../react/deprecated'; | ||
import warning from '../warning'; | ||
function focusable(element) { | ||
return !element.disabled && visible(element); | ||
} | ||
function hidden(element) { | ||
var cs = getComputedStyle(element); | ||
return cs.display !== 'inline' && element.offsetWidth <= 0 && element.offsetHeight <= 0 || cs.display === 'none'; | ||
} | ||
function positioned(element) { | ||
var POS = ['fixed', 'absolute']; | ||
if (POS.includes(element.style.position.toLowerCase())) return true; | ||
if (POS.includes(getComputedStyle(element).getPropertyValue('position').toLowerCase())) return true; | ||
return false; | ||
} | ||
function visible(element) { | ||
/* eslint no-param-reassign:0 */ | ||
while (element) { | ||
if (element === document.body) break; | ||
if (hidden(element)) return false; | ||
if (positioned(element)) break; | ||
element = element.parentNode; | ||
} | ||
return true; | ||
} | ||
function isInvalidTabIndex(tabIndex) { | ||
return !isNaN(tabIndex) && tabIndex < 0; | ||
} | ||
function tabbable(element) { | ||
return !isInvalidTabIndex(element.getAttribute('tabindex')) && focusable(element); | ||
export default function findTabbable(el) { | ||
warning(false, '[%s] was deprecated in version %s. %s', 'findTabbable', '5.0.0', changedPackageWarning('ui-utils', 'ui-a11y') || ''); | ||
return UIFindTabbable(el); | ||
} |
@@ -1,113 +0,50 @@ | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
import findDOMNode from './findDOMNode'; | ||
import findTabbable from './findTabbable'; | ||
import ownerDocument from './ownerDocument'; | ||
import ownerWindow from './ownerWindow'; | ||
import getActiveElement from './getActiveElement'; | ||
import addEventListener from './addEventListener'; | ||
import containsActiveElement from './containsActiveElement'; | ||
import warning from '../warning'; | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
/** | ||
* --- | ||
* category: utilities/DOM | ||
* --- | ||
* @module FocusManager | ||
* Class for focus operations. | ||
* - Scoping focus within a given context, | ||
* - Mark active element for focus later | ||
* - Return focus to the marked element | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import UIFocusManager from '@instructure/ui-a11y/lib/utils/focusManager'; | ||
var FocusManager = function () { | ||
import { changedPackageWarning } from '../react/deprecated'; | ||
import warning from '../warning'; | ||
var FocusManager = function (_UIFocusManager) { | ||
_inherits(FocusManager, _UIFocusManager); | ||
function FocusManager() { | ||
var _this = this; | ||
_classCallCheck(this, FocusManager); | ||
this.contextElement = null; | ||
this.focusLaterElement = null; | ||
this.needToFocus = false; | ||
this.listeners = []; | ||
this.timeouts = []; | ||
var _this = _possibleConstructorReturn(this, (FocusManager.__proto__ || Object.getPrototypeOf(FocusManager)).call(this)); | ||
this.handleBlur = function (event) { | ||
_this.needToFocus = true; | ||
}; | ||
this.handleFocus = function (event) { | ||
if (_this.needToFocus) { | ||
_this.needToFocus = false; | ||
if (!_this.contextElement) { | ||
return; | ||
} | ||
// need to see how jQuery shims document.on('focusin') so we don't need the | ||
// setTimeout, firefox doesn't support focusin, if it did, we could focus | ||
// the element outside of a setTimeout. Side-effect of this implementation | ||
// is that the document.body gets focus, and then we focus our element right | ||
// after, seems fine. | ||
_this.timeouts.push(setTimeout(function () { | ||
if (containsActiveElement(_this.contextElement)) { | ||
return; | ||
} | ||
var el = findTabbable(_this.contextElement)[0]; | ||
el.focus(); | ||
}, 0)); | ||
} | ||
}; | ||
warning(false, '[%s] was deprecated in version %s. %s', 'FocusManager', '5.0.0', changedPackageWarning('ui-utils', 'ui-a11y') || ''); | ||
return _this; | ||
} | ||
_createClass(FocusManager, [{ | ||
key: 'markForFocusLater', | ||
value: function markForFocusLater() { | ||
this.focusLaterElement = getActiveElement(ownerDocument(this.contextElement)); | ||
} | ||
}, { | ||
key: 'returnFocus', | ||
value: function returnFocus() { | ||
try { | ||
this.focusLaterElement.focus(); | ||
} catch (e) { | ||
warning(false, '\n You tried to return focus to ' + this.focusLaterElement + '\n but it is not in the DOM anymore: ' + e + '\n '); | ||
} | ||
this.focusLaterElement = null; | ||
} | ||
}, { | ||
key: 'setupScopedFocus', | ||
value: function setupScopedFocus(el) { | ||
if (this.contextElement) { | ||
warning(false, '\n Focus is already scoped to ' + this.contextElement + '.\n '); | ||
return; | ||
} | ||
this.contextElement = findDOMNode(el); | ||
var win = ownerWindow(this.contextElement); | ||
this.listeners.push(addEventListener(ownerWindow(this.contextElement), 'blur', this.handleBlur, false)); | ||
this.listeners.push(addEventListener(ownerDocument(this.contextElement), 'focus', this.handleFocus, true)); | ||
} | ||
}, { | ||
key: 'teardownScopedFocus', | ||
value: function teardownScopedFocus() { | ||
this.listeners.forEach(function (listener) { | ||
listener.remove(); | ||
}); | ||
this.listeners = []; | ||
this.timeouts.forEach(function (timeout) { | ||
clearTimeout(timeout); | ||
}); | ||
this.timeouts = []; | ||
this.contextElement = null; | ||
} | ||
}]); | ||
return FocusManager; | ||
}(); | ||
}(UIFocusManager); | ||
export default new FocusManager(); | ||
export { FocusManager as default }; |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -2,0 +26,0 @@ * --- |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode'; | ||
@@ -2,0 +26,0 @@ import canUseDOM from './canUseDOM'; |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode'; | ||
@@ -2,0 +26,0 @@ |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode'; | ||
@@ -2,0 +26,0 @@ import canUseDOM from './canUseDOM'; |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -2,0 +26,0 @@ * --- |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode'; | ||
@@ -30,2 +54,3 @@ import canUseDOM from './canUseDOM'; | ||
// eslint-disable-next-line no-cond-assign | ||
while ((parent = parent.parentNode) && parent && parent.nodeType === 1 && parent.tagName !== 'BODY') { | ||
@@ -32,0 +57,0 @@ if (getComputedStyle(parent).position !== 'static') { |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode'; | ||
@@ -38,2 +62,3 @@ import canUseDOM from './canUseDOM'; | ||
var parent = node; | ||
// eslint-disable-next-line no-cond-assign | ||
while (parent && parent.nodeType === 1 && (parent = parent.parentNode)) { | ||
@@ -40,0 +65,0 @@ var style = void 0; |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import contains from './contains'; | ||
@@ -2,0 +26,0 @@ |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/* list utils in alphabetical order */ | ||
@@ -20,4 +44,4 @@ import _addEventListener from './addEventListener'; | ||
export { _findTabbable as findTabbable }; | ||
import _focusManager from './focusManager'; | ||
export { _focusManager as focusManager }; | ||
import _FocusManager from './focusManager'; | ||
export { _FocusManager as FocusManager }; | ||
import _getActiveElement from './getActiveElement'; | ||
@@ -24,0 +48,0 @@ export { _getActiveElement as getActiveElement }; |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode'; | ||
@@ -2,0 +26,0 @@ import getActiveElement from './getActiveElement'; |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode'; | ||
@@ -2,0 +26,0 @@ |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode'; | ||
@@ -2,0 +26,0 @@ import ownerDocument from './ownerDocument'; |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import canUseDOM from './canUseDOM'; | ||
@@ -2,0 +26,0 @@ |
@@ -0,3 +1,28 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findTabbable from '@instructure/ui-a11y/lib/utils/findTabbable'; | ||
import findDOMNode from './findDOMNode'; | ||
import findTabbable from './findTabbable'; | ||
import isActiveElement from './isActiveElement'; | ||
@@ -4,0 +29,0 @@ import containsActiveElement from './containsActiveElement'; |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -2,0 +26,0 @@ * --- |
@@ -1,4 +0,30 @@ | ||
import moment from 'moment'; // eslint-disable-line import/no-extraneous-dependencies | ||
import 'moment-timezone/builds/moment-timezone-with-data'; | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import DateTime from '@instructure/ui-i18n/lib/DateTime'; | ||
import { changedPackageWarning } from '../react/deprecated'; | ||
import warning from '../warning'; | ||
/** | ||
@@ -19,4 +45,4 @@ * --- | ||
export function now(locale, timezone) { | ||
checkParams(locale, timezone); | ||
return moment().locale(locale).tz(timezone); | ||
warning(false, '[%s] was deprecated in version %s. %s', 'DateTime.now', '5.0.0', changedPackageWarning('ui-utils', 'ui-i18n')); | ||
return DateTime.now(locale, timezone); | ||
} | ||
@@ -32,4 +58,4 @@ | ||
export function parse(dateString, locale, timezone) { | ||
checkParams(locale, timezone); | ||
return moment.tz(dateString, [moment.ISO_8601, 'l', 'L', 'll', 'LL'], locale, timezone); | ||
warning(false, '[%s] was deprecated in version %s. %s', 'DateTime.parse', '5.0.0', changedPackageWarning('ui-utils', 'ui-i18n')); | ||
return DateTime.parse(dateString, locale, timezone); | ||
} | ||
@@ -43,3 +69,4 @@ | ||
export function isValid(dateString) { | ||
return moment(dateString, [moment.ISO_8601]).isValid(); | ||
warning(false, '[%s] was deprecated in version %s. %s', 'DateTime.isValid', '5.0.0', changedPackageWarning('ui-utils', 'ui-i18n')); | ||
return DateTime.isValid(dateString); | ||
} | ||
@@ -53,3 +80,4 @@ | ||
export function browserTimeZone() { | ||
return moment.tz.guess(); | ||
warning(false, '[%s] was deprecated in version %s. %s', 'DateTime.browserTimeZone', '5.0.0', changedPackageWarning('ui-utils', 'ui-i18n')); | ||
return DateTime.browserTimeZone(); | ||
} | ||
@@ -62,7 +90,2 @@ | ||
isValid: isValid | ||
}; | ||
function checkParams(locale, timezone) { | ||
if (locale == null) throw Error('locale must be specified'); | ||
if (timezone == null) throw Error('timezone must be specified'); | ||
} | ||
}; |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/* list utils in alphabetical order */ | ||
@@ -5,2 +29,4 @@ import _DateTime from './DateTime'; | ||
import _Locale from './Locale'; | ||
export { _Locale as Locale }; | ||
export { _Locale as Locale }; | ||
import _Numeral from './Numeral'; | ||
export { _Numeral as Numeral }; |
@@ -0,1 +1,30 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import Locale from '@instructure/ui-i18n/lib/Locale'; | ||
import { changedPackageWarning } from '../react/deprecated'; | ||
import warning from '../warning'; | ||
/** | ||
@@ -16,7 +45,6 @@ * --- | ||
if (typeof nav !== 'undefined') { | ||
return nav.language; | ||
} | ||
return 'en'; | ||
warning(false, '[%s] was deprecated in version %s. %s', 'Locale.browserLocale', '5.0.0', changedPackageWarning('ui-utils', 'ui-i18n')); | ||
return Locale.browserLocale(nav); | ||
} | ||
}; |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import * as dom from './dom'; | ||
@@ -2,0 +26,0 @@ import * as i18n from './i18n'; |
@@ -5,2 +5,26 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -7,0 +31,0 @@ * --- |
24
es/ms.js
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import parseUnit from './parseUnit'; | ||
@@ -4,0 +28,0 @@ |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -21,3 +45,5 @@ * --- | ||
var value = '' + str; | ||
return [parseFloat(value, 10), value.match(/[\d.\-\+]*\s*(.*)/)[1] || '']; | ||
return [parseFloat(value, 10), | ||
// eslint-disable-next-line no-useless-escape | ||
value.match(/[\d.\-\+]*\s*(.*)/)[1] || '']; | ||
} |
24
es/px.js
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import getFontSize from './dom/getFontSize'; | ||
@@ -4,0 +28,0 @@ import parseUnit from './parseUnit'; |
@@ -13,2 +13,26 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import React, { Component } from 'react'; | ||
@@ -66,5 +90,2 @@ import PropTypes from 'prop-types'; | ||
key: 'render', | ||
/* eslint-enable react/require-default-props */ | ||
value: function render() { | ||
@@ -77,4 +98,2 @@ var _props = this.props, | ||
} | ||
/* eslint-disable react/require-default-props */ | ||
}]); | ||
@@ -89,3 +108,4 @@ | ||
*/ | ||
children: PropTypes.node }, _temp); | ||
children: PropTypes.node | ||
}, _temp); | ||
@@ -92,0 +112,0 @@ /** |
@@ -13,2 +13,27 @@ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import PropTypes from 'prop-types'; | ||
import getDisplayName from './getDisplayName'; | ||
@@ -30,3 +55,4 @@ import findDOMNode from '../dom/findDOMNode'; | ||
* | ||
* The `size` will be updated whenever the dimensions of the container change. | ||
* The `size` will be updated whenever the dimensions of the container change, | ||
* and will be passed as a parameter to the onSizeChange prop provided. | ||
* | ||
@@ -41,3 +67,3 @@ * So that CSS rules can be applied based on the dimensions of the container, | ||
var getSelectorMap = function getSelectorMap(el) { | ||
return parseQuery(query, el); | ||
return query && parseQuery(query, el); | ||
}; | ||
@@ -67,7 +93,15 @@ | ||
_this._size = size; | ||
if (typeof _this.props.onSizeChange === 'function') { | ||
_this.props.onSizeChange(size); | ||
} | ||
var container = findDOMNode(_this); | ||
if (typeof getSelectorMap(container) !== 'function') { | ||
return; | ||
} | ||
var selectorMap = getSelectorMap(container)(size); | ||
_this._size = size; | ||
// eslint-disable-next-line no-restricted-syntax | ||
@@ -147,3 +181,3 @@ var _iteratorNormalCompletion = true; | ||
get: function get() { | ||
this._size; | ||
return this._size; | ||
} | ||
@@ -153,3 +187,5 @@ }]); | ||
return _class; | ||
}(ComposedComponent), _class.displayName = getDisplayName(ComposedComponent), _class.getSelectorMap = getSelectorMap, _temp2; | ||
}(ComposedComponent), _class.displayName = getDisplayName(ComposedComponent), _class.getSelectorMap = getSelectorMap, _class.propTypes = Object.assign({}, ComposedComponent.propTypes, { | ||
onSizeChange: PropTypes.func | ||
}), _temp2; | ||
}; | ||
@@ -156,0 +192,0 @@ } |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -12,6 +36,6 @@ * --- | ||
import PropTypes from 'prop-types'; | ||
import moment from 'moment'; | ||
import DateTime from '@instructure/ui-i18n/lib/DateTime'; | ||
import getDisplayName from './getDisplayName'; | ||
import warning from '../warning'; | ||
import canUseDOM from '../dom/canUseDOM'; | ||
@@ -306,3 +330,3 @@ | ||
return function (props, propName, componentName) { | ||
var error = propType.apply(null, arguments); // eslint-disable-line prefer-spread | ||
var error = propType.apply(null, arguments); | ||
if (error) { | ||
@@ -434,4 +458,3 @@ return error; | ||
var parsedMoment = moment(propValue, [moment.ISO_8601]); | ||
if (!parsedMoment.isValid()) { | ||
if (!DateTime.isValid(propValue)) { | ||
return new Error('Invalid ' + location + ' `' + propName + '` `' + propValue + '` supplied to `' + componentName + '`, expected ' + 'an ISO 8601 formatted string.'); | ||
@@ -438,0 +461,0 @@ } |
@@ -11,2 +11,26 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import getDisplayName from './getDisplayName'; | ||
@@ -36,6 +60,7 @@ import warning from '../warning'; | ||
* @param {string} version | ||
* @param {object} oldProps | ||
* @param {object} oldProps (if this argument is null or undefined, the entire component is deprecated) | ||
* @param {string} message | ||
* @return {function} React component with deprecated props behavior | ||
*/ | ||
export default function deprecated(version, oldProps) { | ||
export default function deprecated(version, oldProps, message) { | ||
return function (ComposedComponent) { | ||
@@ -49,14 +74,29 @@ var _class, _temp; | ||
function DeprecatedComponent(props, context) { | ||
function DeprecatedComponent() { | ||
_classCallCheck(this, DeprecatedComponent); | ||
checkProps(version, props, oldProps); | ||
return _possibleConstructorReturn(this, (DeprecatedComponent.__proto__ || Object.getPrototypeOf(DeprecatedComponent)).call(this, props, context)); | ||
return _possibleConstructorReturn(this, (DeprecatedComponent.__proto__ || Object.getPrototypeOf(DeprecatedComponent)).apply(this, arguments)); | ||
} | ||
_createClass(DeprecatedComponent, [{ | ||
key: 'componentDidMount', | ||
value: function componentDidMount() { | ||
if (oldProps) { | ||
warnDeprecatedProps(displayName, version, this.props, oldProps, message); | ||
} else { | ||
warnDeprecatedComponent(version, displayName, message); | ||
} | ||
if (_get(DeprecatedComponent.prototype.__proto__ || Object.getPrototypeOf(DeprecatedComponent.prototype), 'componentDidMount', this)) { | ||
_get(DeprecatedComponent.prototype.__proto__ || Object.getPrototypeOf(DeprecatedComponent.prototype), 'componentDidMount', this).call(this); | ||
} | ||
} | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(nextProps) { | ||
checkProps(version, nextProps, oldProps); | ||
if (oldProps) { | ||
warnDeprecatedProps(displayName, version, nextProps, oldProps, message); | ||
} else { | ||
warnDeprecatedComponent(version, displayName, message); | ||
} | ||
@@ -77,3 +117,3 @@ if (_get(DeprecatedComponent.prototype.__proto__ || Object.getPrototypeOf(DeprecatedComponent.prototype), 'componentWillReceiveProps', this)) { | ||
function checkProps(version, props, oldProps) { | ||
function warnDeprecatedProps(displayName, version, props, oldProps, message) { | ||
Object.keys(oldProps).forEach(function (oldProp) { | ||
@@ -83,5 +123,13 @@ if (typeof props[oldProp] !== 'undefined') { | ||
warning(false, '%s was deprecated in %s%s', oldProp, version, newProp ? ' use ' + newProp + ' instead' : ''); | ||
warning(false, '[%s] `%s` was deprecated in %s%s. %s', displayName, oldProp, version, newProp ? '. Use `' + newProp + '` instead' : '', message || ''); | ||
} | ||
}); | ||
} | ||
function warnDeprecatedComponent(version, displayName, message) { | ||
warning(false, '[%s] was deprecated in version %s. %s', displayName, version, message || ''); | ||
} | ||
export function changedPackageWarning(prevPackage, newPackage) { | ||
return 'It has been moved from @instructure/' + prevPackage + ' to @instructure/' + newPackage + '.'; | ||
} |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import React, { Children } from 'react'; | ||
@@ -2,0 +26,0 @@ import safeCloneElement from './safeCloneElement'; |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import warning from '../warning'; | ||
@@ -2,0 +26,0 @@ |
@@ -1,13 +0,25 @@ | ||
/** | ||
* --- | ||
* category: utilities/react | ||
* --- | ||
* Get the React element type for a component. | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* @module getElementType | ||
* @param {ReactComponent} Component | ||
* @param {Object} props | ||
* @param {Function} getDefault an optional function that returns the default element type | ||
* @returns {String} the element type | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
export default function (Component, props, getDefault) { | ||
@@ -14,0 +26,0 @@ if (props.as && props.as !== Component.defaultProps.as) { |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/* list utils in alphabetical order */ | ||
@@ -18,4 +42,4 @@ import _ComponentIdentifier from './ComponentIdentifier'; | ||
export { _matchComponentTypes as matchComponentTypes }; | ||
import _passthroughProps from './passthroughProps'; | ||
export { _passthroughProps as passthroughProps }; | ||
export { omitProps, pickProps } from './passthroughProps'; | ||
import _safeCloneElement from './safeCloneElement'; | ||
@@ -22,0 +46,0 @@ export { _safeCloneElement as safeCloneElement }; |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import getDisplayName from './getDisplayName'; | ||
@@ -2,0 +26,0 @@ |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import omit from 'object.omit'; | ||
@@ -2,0 +26,0 @@ import pick from 'object.pick'; |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import React from 'react'; | ||
@@ -2,0 +26,0 @@ import warning from '../warning'; |
@@ -11,2 +11,26 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import getDisplayName from './getDisplayName'; | ||
@@ -13,0 +37,0 @@ import ownerWindow from '../dom/ownerWindow'; |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
// https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/shallowEqual.js | ||
@@ -4,0 +28,0 @@ var hasOwnProperty = Object.prototype.hasOwnProperty; |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import shortid from 'shortid'; | ||
@@ -2,0 +26,0 @@ |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -2,0 +26,0 @@ * --- |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -2,0 +26,0 @@ * --- |
@@ -7,2 +7,26 @@ "use strict"; | ||
exports.default = capitalizeFirstLetter; | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -9,0 +33,0 @@ * --- |
@@ -7,2 +7,26 @@ 'use strict'; | ||
exports.default = createChainedFunction; | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -9,0 +33,0 @@ * --- |
@@ -7,2 +7,26 @@ 'use strict'; | ||
exports.default = debounce; | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -9,0 +33,0 @@ * --- |
@@ -35,2 +35,24 @@ 'use strict'; | ||
}; | ||
} | ||
} /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ |
@@ -65,2 +65,24 @@ 'use strict'; | ||
}; | ||
} | ||
} /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ |
@@ -32,2 +32,26 @@ 'use strict'; | ||
*/ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
function addResizeListener(el, handler) { | ||
@@ -34,0 +58,0 @@ var node = (0, _findDOMNode2.default)(el); |
@@ -6,475 +6,44 @@ 'use strict'; | ||
}); | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
exports.default = calculateElementPosition; | ||
exports.parsePlacement = parsePlacement; | ||
var _getBoundingClientRect = require('./getBoundingClientRect'); | ||
var _calculateElementPosition = require('../../../ui-layout/lib/utils/calculateElementPosition'); | ||
var _getBoundingClientRect2 = _interopRequireDefault(_getBoundingClientRect); | ||
var _calculateElementPosition2 = _interopRequireDefault(_calculateElementPosition); | ||
var _getScrollParents = require('./getScrollParents'); | ||
var _deprecated = require('../react/deprecated'); | ||
var _getScrollParents2 = _interopRequireDefault(_getScrollParents); | ||
var _warning = require('../warning'); | ||
var _getOffsetParents = require('./getOffsetParents'); | ||
var _warning2 = _interopRequireDefault(_warning); | ||
var _getOffsetParents2 = _interopRequireDefault(_getOffsetParents); | ||
var _canUseDOM = require('./canUseDOM'); | ||
var _canUseDOM2 = _interopRequireDefault(_canUseDOM); | ||
var _findDOMNode = require('./findDOMNode'); | ||
var _findDOMNode2 = _interopRequireDefault(_findDOMNode); | ||
var _ownerDocument = require('./ownerDocument'); | ||
var _ownerDocument2 = _interopRequireDefault(_ownerDocument); | ||
var _ownerWindow = require('./ownerWindow'); | ||
var _ownerWindow2 = _interopRequireDefault(_ownerWindow); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
/** | ||
* --- | ||
* category: utilities/DOM | ||
* --- | ||
* | ||
* Calculate the coordinates to attach an element | ||
* to a designated target with specified constraints | ||
* @module | ||
* @param {ReactComponent|DomNode} el - component or DOM node | ||
* @param {DomNode} target - the target DOM node | ||
* @param {Object} options - constraints for the positioning | ||
* @param {string} options.placement - designates where the element will be attached | ||
* ('top', 'bottom', 'left', 'right', 'top left' etc.) | ||
* @param {DomNode} options.container - DOM node where the element is contained | ||
* @param {boolean} options.over - whether or not you want the element to position over the target | ||
* @param {string} options.constrain - if the element should be constrained to 'window', | ||
* 'scroll-parent', 'parent', or 'none' | ||
* @param {string|number} options.offsetX - the horizontal offset for the positioned element | ||
* @param {string|number} options.offsetY - the vertical offset for the positioned element | ||
* @returns {Object} object containing style with the calculated position in the 'transform' | ||
* property | ||
*/ | ||
function calculateElementPosition(element, target, options) { | ||
if (!element || options.placement === 'offscreen') { | ||
return { | ||
placement: options.placement, | ||
style: { | ||
left: '-9999em', | ||
overflow: 'hidden', | ||
position: 'absolute' | ||
} | ||
}; | ||
} | ||
(0, _warning2.default)(false, '[%s] was deprecated in version %s. %s', 'calculateElementPosition', '5.0.0', (0, _deprecated.changedPackageWarning)('ui-utils', 'ui-layout')); | ||
return (0, _calculateElementPosition2.default)(element, target, options); | ||
} /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
var pos = new PositionData(element, target, options); | ||
return { | ||
placement: pos.placement, | ||
style: pos.style | ||
}; | ||
} | ||
var PositionedElement = function () { | ||
function PositionedElement(element, placement) { | ||
var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { top: 0, left: 0 }; | ||
_classCallCheck(this, PositionedElement); | ||
this.node = (0, _findDOMNode2.default)(element); | ||
if (typeof placement === 'string') { | ||
this.placement = parsePlacement(placement); | ||
} else if (Array.isArray(placement)) { | ||
this.placement = placement; | ||
} else { | ||
this.placement = ['bottom', 'center']; | ||
} | ||
this.rect = (0, _getBoundingClientRect2.default)(this.node); | ||
this._offset = offsetToPx(offset, this.size); | ||
} | ||
_createClass(PositionedElement, [{ | ||
key: 'calculateOffset', | ||
value: function calculateOffset(placement) { | ||
var offsetMap = { | ||
top: 0, | ||
start: 0, | ||
center: '50%', | ||
bottom: '100%', | ||
end: '100%', | ||
stretch: 0 | ||
}; | ||
var _placement = _slicedToArray(placement, 2), | ||
first = _placement[0], | ||
second = _placement[1]; | ||
if (['start', 'end'].indexOf(first) >= 0) { | ||
var _ref = [second, first]; | ||
first = _ref[0]; | ||
second = _ref[1]; | ||
} | ||
var top = 0; | ||
var left = 0; | ||
if (typeof offsetMap[first] !== 'undefined') { | ||
top = offsetMap[first]; | ||
} | ||
if (typeof offsetMap[second] !== 'undefined') { | ||
left = offsetMap[second]; | ||
} | ||
return addOffsets([offsetToPx({ top: top, left: left }, this.size), parseOffset(this._offset, this.placement)]); | ||
} | ||
}, { | ||
key: 'width', | ||
get: function get() { | ||
return this.rect.width; | ||
} | ||
}, { | ||
key: 'height', | ||
get: function get() { | ||
return this.rect.height; | ||
} | ||
}, { | ||
key: 'size', | ||
get: function get() { | ||
return { | ||
width: this.width, | ||
height: this.height | ||
}; | ||
} | ||
}, { | ||
key: 'position', | ||
get: function get() { | ||
return { | ||
top: this.rect.top, | ||
left: this.rect.left | ||
}; | ||
} | ||
}, { | ||
key: 'hasVerticalPlacement', | ||
get: function get() { | ||
return ['top', 'bottom'].indexOf(this.placement[0]) >= 0; | ||
} | ||
}, { | ||
key: 'hasHorizontalPlacement', | ||
get: function get() { | ||
return ['start', 'end'].indexOf(this.placement[0]) >= 0; | ||
} | ||
}, { | ||
key: 'shouldStretchVertically', | ||
get: function get() { | ||
return this.placement[1] === 'stretch' && this.hasVerticalPlacement; | ||
} | ||
}, { | ||
key: 'shouldStretchHorizontally', | ||
get: function get() { | ||
return this.placement[1] === 'stretch' && this.hasHorizontalPlacement; | ||
} | ||
}, { | ||
key: 'mirroredPlacement', | ||
get: function get() { | ||
var _placement2 = _slicedToArray(this.placement, 2), | ||
first = _placement2[0], | ||
second = _placement2[1]; | ||
var mirror = { | ||
center: 'center', | ||
start: 'end', | ||
end: 'start', | ||
top: 'bottom', | ||
bottom: 'top', | ||
stretch: 'stretch' | ||
}; | ||
return [mirror[first], second]; | ||
} | ||
}, { | ||
key: 'scrollParentsOffset', | ||
get: function get() { | ||
var parents = (0, _getScrollParents2.default)(this.node); | ||
var offsetY = 0; | ||
var offsetX = 0; | ||
for (var i = 1; i < parents.length; i++) { | ||
var parent = parents[i]; | ||
var child = parents[i - 1]; | ||
offsetY = offsetY + (parent.scrollTop - child.scrollTop); | ||
offsetX = offsetX + (parent.scrollLeft - child.scrollLeft); | ||
} | ||
return { top: offsetY, left: offsetX }; | ||
} | ||
}, { | ||
key: 'positionedParentsOffset', | ||
get: function get() { | ||
// If the element container is within a positioned | ||
// element, it will position absolutely with respect to that | ||
// ancestor. We calculate the offset between the child and | ||
// positioned parent so we can negate that distance | ||
var parents = (0, _getOffsetParents2.default)(this.node); | ||
var offsetY = 0; | ||
var offsetX = 0; | ||
for (var i = 1; i < parents.length; i++) { | ||
var parent = (0, _getBoundingClientRect2.default)(parents[i]); | ||
var child = (0, _getBoundingClientRect2.default)(parents[i - 1]); | ||
offsetY = offsetY + (child.top - parent.top); | ||
offsetX = offsetX + (child.left - parent.left); | ||
} | ||
return { top: offsetY, left: offsetX }; | ||
} | ||
}]); | ||
return PositionedElement; | ||
}(); | ||
var PositionData = function () { | ||
function PositionData(element, target, options) { | ||
_classCallCheck(this, PositionData); | ||
this.options = options || {}; | ||
var _options = this.options, | ||
container = _options.container, | ||
constrain = _options.constrain, | ||
placement = _options.placement, | ||
over = _options.over; | ||
if (!element || placement === 'offscreen') return; | ||
this.container = container || (0, _ownerDocument2.default)(element).body; | ||
this.element = new PositionedElement(element, placement, { top: this.options.offsetY, left: this.options.offsetX }); | ||
this.target = new PositionedElement(target || this.container, over ? this.element.placement : this.element.mirroredPlacement); | ||
if (constrain === 'window') { | ||
this.constrainTo((0, _ownerWindow2.default)(element)); | ||
} else if (constrain === 'scroll-parent') { | ||
this.constrainTo((0, _getScrollParents2.default)(this.target.node)[0]); | ||
} else if (constrain === 'parent') { | ||
this.constrainTo(this.container); | ||
} | ||
} | ||
_createClass(PositionData, [{ | ||
key: 'constrainTo', | ||
value: function constrainTo(element) { | ||
if (!element) return; | ||
var _addOffsets = addOffsets([this.target.position, this.offset]), | ||
top = _addOffsets.top, | ||
left = _addOffsets.left; | ||
var bounds = (0, _getBoundingClientRect2.default)(element); | ||
var right = left + this.element.positionedParentsOffset.left + this.element.width; | ||
var oob = { | ||
top: top < bounds.top, | ||
bottom: top + this.element.height > bounds.bottom, | ||
left: left < bounds.left, | ||
right: right > bounds.right | ||
}; | ||
if (this.element.hasVerticalPlacement) { | ||
if (oob.left && oob.right) { | ||
this.element.placement[1] = 'center'; | ||
this.target.placement[1] = 'center'; | ||
} else if (oob.left) { | ||
this.element.placement[1] = 'start'; | ||
this.target.placement[1] = 'start'; | ||
} else if (oob.right) { | ||
this.element.placement[1] = 'end'; | ||
this.target.placement[1] = 'end'; | ||
} | ||
if (oob.top) { | ||
this.element.placement[0] = 'bottom'; | ||
this.target.placement[0] = 'top'; | ||
} else if (oob.bottom) { | ||
this.element.placement[0] = 'top'; | ||
this.target.placement[0] = 'bottom'; | ||
} | ||
} else if (this.element.hasHorizontalPlacement) { | ||
if (oob.top && oob.bottom) { | ||
this.element.placement[1] = 'center'; | ||
this.target.placement[1] = 'center'; | ||
} else if (oob.top) { | ||
this.element.placement[1] = 'top'; | ||
this.target.placement[1] = 'top'; | ||
} else if (oob.bottom) { | ||
this.element.placement[1] = 'bottom'; | ||
this.target.placement[1] = 'bottom'; | ||
} | ||
if (oob.left) { | ||
this.element.placement[0] = 'end'; | ||
this.target.placement[0] = 'start'; | ||
} else if (oob.right) { | ||
this.element.placement[0] = 'start'; | ||
this.target.placement[0] = 'end'; | ||
} | ||
} | ||
} | ||
}, { | ||
key: 'offset', | ||
get: function get() { | ||
var _target$calculateOffs = this.target.calculateOffset(this.element.placement), | ||
top = _target$calculateOffs.top, | ||
left = _target$calculateOffs.left; | ||
var offset = addOffsets([this.element.calculateOffset(this.target.placement), this.element.scrollParentsOffset, this.element.positionedParentsOffset]); | ||
return { | ||
top: top - offset.top, | ||
left: left - offset.left | ||
}; | ||
} | ||
}, { | ||
key: 'placement', | ||
get: function get() { | ||
return formatPlacement(this.element.placement); | ||
} | ||
}, { | ||
key: 'minWidth', | ||
get: function get() { | ||
return this.element.shouldStretchVertically ? this.target.width : null; | ||
} | ||
}, { | ||
key: 'minHeight', | ||
get: function get() { | ||
return this.element.shouldStretchHorizontally ? this.target.height : null; | ||
} | ||
}, { | ||
key: 'position', | ||
get: function get() { | ||
var win = (0, _ownerWindow2.default)(this.target.node); | ||
var _addOffsets2 = addOffsets([this.target.position, this.offset]), | ||
left = _addOffsets2.left, | ||
top = _addOffsets2.top; | ||
if (_canUseDOM2.default && win.matchMedia) { | ||
var retina = win.matchMedia('only screen and (min-resolution: 1.3dppx)').matches || win.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 1.3)').matches; | ||
if (!retina) { | ||
left = Math.round(left); | ||
top = Math.round(top); | ||
} | ||
} | ||
return { left: left, top: top }; | ||
} | ||
}, { | ||
key: 'style', | ||
get: function get() { | ||
return { | ||
top: 0, | ||
left: 0, | ||
minWidth: this.minWidth, | ||
minHeight: this.minHeight, | ||
position: 'absolute', | ||
transform: 'translateX(' + this.position.left + 'px) translateY(' + this.position.top + 'px) translateZ(0)' | ||
}; | ||
} | ||
}]); | ||
return PositionData; | ||
}(); | ||
function addOffsets(offsets) { | ||
return offsets.reduce(function (sum, offset) { | ||
return { | ||
top: sum.top + offset.top, | ||
left: sum.left + offset.left | ||
}; | ||
}, { top: 0, left: 0 }); | ||
} | ||
function parseOffset(offset, placement) { | ||
var top = offset.top, | ||
left = offset.left; | ||
if (placement[0] === 'bottom') { | ||
top = 0 - parseFloat(top, 10); | ||
} | ||
if (placement[0] === 'end') { | ||
left = 0 - parseFloat(left, 10); | ||
} | ||
return { | ||
top: top, | ||
left: left | ||
}; | ||
} | ||
function offsetToPx(offset, size) { | ||
var left = offset.left, | ||
top = offset.top; | ||
if (typeof left === 'string' && left.indexOf('%') !== -1) { | ||
left = parseFloat(left, 10) / 100 * size.width; // eslint-disable-line no-mixed-operators | ||
} else { | ||
left = parseFloat(left, 10); | ||
} | ||
if (typeof top === 'string' && top.indexOf('%') !== -1) { | ||
top = parseFloat(top, 10) / 100 * size.height; // eslint-disable-line no-mixed-operators | ||
} else { | ||
top = parseFloat(top, 10); | ||
} | ||
return { top: top, left: left }; | ||
} | ||
function sortPlacement(placement) { | ||
var _placement3 = _slicedToArray(placement, 2), | ||
first = _placement3[0], | ||
second = _placement3[1]; | ||
if (first === 'center' || first === 'stretch') { | ||
var _ref2 = [second, first]; | ||
first = _ref2[0]; | ||
second = _ref2[1]; | ||
} | ||
return [first, second]; | ||
} | ||
function parsePlacement(placement) { | ||
var parsed = placement.split(' '); | ||
if (parsed.length === 1) { | ||
parsed = [placement, 'center']; | ||
} | ||
return sortPlacement(parsed); | ||
} | ||
function formatPlacement(placement) { | ||
return placement.join(' '); | ||
} | ||
// Relative import here because we cannot import ui-layout without creating a circular dependency. It | ||
// will be removed along with this file when we eliminate calculateElementPosition from ui-utils completely. |
@@ -6,2 +6,26 @@ 'use strict'; | ||
}); | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -8,0 +32,0 @@ * --- |
@@ -17,2 +17,26 @@ 'use strict'; | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
exports.default = _canUseDOM2.default ? contains : fallback; | ||
@@ -19,0 +43,0 @@ |
@@ -28,2 +28,26 @@ 'use strict'; | ||
*/ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
function containsActiveElement(el) { | ||
@@ -30,0 +54,0 @@ var node = el && (0, _findDOMNode2.default)(el); |
@@ -32,2 +32,24 @@ 'use strict'; | ||
} | ||
} | ||
} /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ |
@@ -8,84 +8,39 @@ 'use strict'; | ||
var _getComputedStyle = require('./getComputedStyle'); | ||
var _findTabbable = require('@instructure/ui-a11y/lib/utils/findTabbable'); | ||
var _getComputedStyle2 = _interopRequireDefault(_getComputedStyle); | ||
var _findTabbable2 = _interopRequireDefault(_findTabbable); | ||
var _findDOMNode = require('./findDOMNode'); | ||
var _deprecated = require('../react/deprecated'); | ||
var _findDOMNode2 = _interopRequireDefault(_findDOMNode); | ||
var _warning = require('../warning'); | ||
var _warning2 = _interopRequireDefault(_warning); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
* --- | ||
* category: utilities/DOM | ||
* --- | ||
* | ||
* Given an element, finds and returns all tabbable children. | ||
* Tabbable elements include input, select, textarea, button, and object. | ||
* Anchor tags are also tabbable if they include an href or positive | ||
* tabindex attribute. | ||
* | ||
* @param {ReactComponent|DomNode} el - component or DOM node | ||
* @returns {Array} array of all tabbable children | ||
*/ | ||
/** | ||
* Adapted from jQuery UI core | ||
* | ||
* http://jqueryui.com | ||
* | ||
* Copyright 2014 jQuery Foundation and other contributors | ||
* Released under the MIT license. | ||
* http://jquery.org/license | ||
* | ||
* http://api.jqueryui.com/category/ui-core/ | ||
**/ | ||
function findTabbable(el) { | ||
var element = (0, _findDOMNode2.default)(el); | ||
if (!element || typeof element.querySelectorAll !== 'function') { | ||
return []; | ||
} | ||
var focusableSelector = 'a[href],frame,iframe,object,input:not([type=hidden]),select,textarea,button,*[tabindex]'; | ||
var matches = element.querySelectorAll(focusableSelector); | ||
return [].slice.call(matches, 0).filter(function (el) { | ||
return tabbable(el); | ||
}); | ||
} | ||
function focusable(element) { | ||
return !element.disabled && visible(element); | ||
} | ||
function hidden(element) { | ||
var cs = (0, _getComputedStyle2.default)(element); | ||
return cs.display !== 'inline' && element.offsetWidth <= 0 && element.offsetHeight <= 0 || cs.display === 'none'; | ||
} | ||
function positioned(element) { | ||
var POS = ['fixed', 'absolute']; | ||
if (POS.includes(element.style.position.toLowerCase())) return true; | ||
if (POS.includes((0, _getComputedStyle2.default)(element).getPropertyValue('position').toLowerCase())) return true; | ||
return false; | ||
} | ||
function visible(element) { | ||
/* eslint no-param-reassign:0 */ | ||
while (element) { | ||
if (element === document.body) break; | ||
if (hidden(element)) return false; | ||
if (positioned(element)) break; | ||
element = element.parentNode; | ||
} | ||
return true; | ||
} | ||
function isInvalidTabIndex(tabIndex) { | ||
return !isNaN(tabIndex) && tabIndex < 0; | ||
} | ||
function tabbable(element) { | ||
return !isInvalidTabIndex(element.getAttribute('tabindex')) && focusable(element); | ||
} | ||
(0, _warning2.default)(false, '[%s] was deprecated in version %s. %s', 'findTabbable', '5.0.0', (0, _deprecated.changedPackageWarning)('ui-utils', 'ui-a11y') || ''); | ||
return (0, _findTabbable2.default)(el); | ||
} /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ |
@@ -6,33 +6,10 @@ 'use strict'; | ||
}); | ||
exports.default = undefined; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
var _focusManager = require('@instructure/ui-a11y/lib/utils/focusManager'); | ||
var _findDOMNode = require('./findDOMNode'); | ||
var _focusManager2 = _interopRequireDefault(_focusManager); | ||
var _findDOMNode2 = _interopRequireDefault(_findDOMNode); | ||
var _deprecated = require('../react/deprecated'); | ||
var _findTabbable = require('./findTabbable'); | ||
var _findTabbable2 = _interopRequireDefault(_findTabbable); | ||
var _ownerDocument = require('./ownerDocument'); | ||
var _ownerDocument2 = _interopRequireDefault(_ownerDocument); | ||
var _ownerWindow = require('./ownerWindow'); | ||
var _ownerWindow2 = _interopRequireDefault(_ownerWindow); | ||
var _getActiveElement = require('./getActiveElement'); | ||
var _getActiveElement2 = _interopRequireDefault(_getActiveElement); | ||
var _addEventListener = require('./addEventListener'); | ||
var _addEventListener2 = _interopRequireDefault(_addEventListener); | ||
var _containsActiveElement = require('./containsActiveElement'); | ||
var _containsActiveElement2 = _interopRequireDefault(_containsActiveElement); | ||
var _warning = require('../warning'); | ||
@@ -46,100 +23,44 @@ | ||
/** | ||
* --- | ||
* category: utilities/DOM | ||
* --- | ||
* @module FocusManager | ||
* Class for focus operations. | ||
* - Scoping focus within a given context, | ||
* - Mark active element for focus later | ||
* - Return focus to the marked element | ||
*/ | ||
var FocusManager = function () { | ||
function FocusManager() { | ||
var _this = this; | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
_classCallCheck(this, FocusManager); | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
this.contextElement = null; | ||
this.focusLaterElement = null; | ||
this.needToFocus = false; | ||
this.listeners = []; | ||
this.timeouts = []; | ||
this.handleBlur = function (event) { | ||
_this.needToFocus = true; | ||
}; | ||
var FocusManager = function (_UIFocusManager) { | ||
_inherits(FocusManager, _UIFocusManager); | ||
this.handleFocus = function (event) { | ||
if (_this.needToFocus) { | ||
_this.needToFocus = false; | ||
function FocusManager() { | ||
_classCallCheck(this, FocusManager); | ||
if (!_this.contextElement) { | ||
return; | ||
} | ||
var _this = _possibleConstructorReturn(this, (FocusManager.__proto__ || Object.getPrototypeOf(FocusManager)).call(this)); | ||
// need to see how jQuery shims document.on('focusin') so we don't need the | ||
// setTimeout, firefox doesn't support focusin, if it did, we could focus | ||
// the element outside of a setTimeout. Side-effect of this implementation | ||
// is that the document.body gets focus, and then we focus our element right | ||
// after, seems fine. | ||
_this.timeouts.push(setTimeout(function () { | ||
if ((0, _containsActiveElement2.default)(_this.contextElement)) { | ||
return; | ||
} | ||
var el = (0, _findTabbable2.default)(_this.contextElement)[0]; | ||
el.focus(); | ||
}, 0)); | ||
} | ||
}; | ||
(0, _warning2.default)(false, '[%s] was deprecated in version %s. %s', 'FocusManager', '5.0.0', (0, _deprecated.changedPackageWarning)('ui-utils', 'ui-a11y') || ''); | ||
return _this; | ||
} | ||
_createClass(FocusManager, [{ | ||
key: 'markForFocusLater', | ||
value: function markForFocusLater() { | ||
this.focusLaterElement = (0, _getActiveElement2.default)((0, _ownerDocument2.default)(this.contextElement)); | ||
} | ||
}, { | ||
key: 'returnFocus', | ||
value: function returnFocus() { | ||
try { | ||
this.focusLaterElement.focus(); | ||
} catch (e) { | ||
(0, _warning2.default)(false, '\n You tried to return focus to ' + this.focusLaterElement + '\n but it is not in the DOM anymore: ' + e + '\n '); | ||
} | ||
this.focusLaterElement = null; | ||
} | ||
}, { | ||
key: 'setupScopedFocus', | ||
value: function setupScopedFocus(el) { | ||
if (this.contextElement) { | ||
(0, _warning2.default)(false, '\n Focus is already scoped to ' + this.contextElement + '.\n '); | ||
return; | ||
} | ||
this.contextElement = (0, _findDOMNode2.default)(el); | ||
var win = (0, _ownerWindow2.default)(this.contextElement); | ||
this.listeners.push((0, _addEventListener2.default)((0, _ownerWindow2.default)(this.contextElement), 'blur', this.handleBlur, false)); | ||
this.listeners.push((0, _addEventListener2.default)((0, _ownerDocument2.default)(this.contextElement), 'focus', this.handleFocus, true)); | ||
} | ||
}, { | ||
key: 'teardownScopedFocus', | ||
value: function teardownScopedFocus() { | ||
this.listeners.forEach(function (listener) { | ||
listener.remove(); | ||
}); | ||
this.listeners = []; | ||
this.timeouts.forEach(function (timeout) { | ||
clearTimeout(timeout); | ||
}); | ||
this.timeouts = []; | ||
this.contextElement = null; | ||
} | ||
}]); | ||
return FocusManager; | ||
}(); | ||
}(_focusManager2.default); | ||
exports.default = new FocusManager(); | ||
exports.default = FocusManager; |
@@ -7,2 +7,26 @@ "use strict"; | ||
exports.default = getActiveElement; | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -9,0 +33,0 @@ * --- |
@@ -36,2 +36,26 @@ 'use strict'; | ||
*/ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
function getBoundingClientRect(el) { | ||
@@ -38,0 +62,0 @@ var rect = { top: 0, left: 0, height: 0, width: 0 }; |
@@ -29,2 +29,26 @@ 'use strict'; | ||
*/ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
function getClassList(element) { | ||
@@ -31,0 +55,0 @@ var node = (0, _findDOMNode2.default)(element); |
@@ -29,2 +29,26 @@ 'use strict'; | ||
*/ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
function getComputedStyle(el) { | ||
@@ -31,0 +55,0 @@ var style = {}; |
@@ -7,2 +7,26 @@ 'use strict'; | ||
exports.default = getFontSize; | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -9,0 +33,0 @@ * --- |
@@ -38,2 +38,26 @@ 'use strict'; | ||
*/ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
function getOffsetParents(el) { | ||
@@ -51,2 +75,3 @@ var parents = []; | ||
// eslint-disable-next-line no-cond-assign | ||
while ((parent = parent.parentNode) && parent && parent.nodeType === 1 && parent.tagName !== 'BODY') { | ||
@@ -53,0 +78,0 @@ if ((0, _getComputedStyle2.default)(parent).position !== 'static') { |
@@ -55,2 +55,3 @@ 'use strict'; | ||
var parent = node; | ||
// eslint-disable-next-line no-cond-assign | ||
while (parent && parent.nodeType === 1 && (parent = parent.parentNode)) { | ||
@@ -89,2 +90,24 @@ var style = void 0; | ||
return parents; | ||
} | ||
} /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ |
@@ -34,2 +34,24 @@ 'use strict'; | ||
} | ||
} | ||
} /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.transformSelection = exports.scopeTab = exports.requestAnimationFrame = exports.ownerWindow = exports.ownerDocument = exports.isActiveElement = exports.handleMouseOverOut = exports.getScrollParents = exports.getOffsetParents = exports.getFontSize = exports.getComputedStyle = exports.getClassList = exports.getBoundingClientRect = exports.getActiveElement = exports.focusManager = exports.findTabbable = exports.findDOMNode = exports.containsActiveElement = exports.contains = exports.canUseDOM = exports.calculateElementPosition = exports.addResizeListener = exports.addPositionChangeListener = exports.addEventListener = undefined; | ||
exports.transformSelection = exports.scopeTab = exports.requestAnimationFrame = exports.ownerWindow = exports.ownerDocument = exports.isActiveElement = exports.handleMouseOverOut = exports.getScrollParents = exports.getOffsetParents = exports.getFontSize = exports.getComputedStyle = exports.getClassList = exports.getBoundingClientRect = exports.getActiveElement = exports.FocusManager = exports.findTabbable = exports.findDOMNode = exports.containsActiveElement = exports.contains = exports.canUseDOM = exports.calculateElementPosition = exports.addResizeListener = exports.addPositionChangeListener = exports.addEventListener = undefined; | ||
@@ -45,5 +45,5 @@ var _addEventListener2 = require('./addEventListener'); | ||
var _focusManager2 = require('./focusManager'); | ||
var _focusManager = require('./focusManager'); | ||
var _focusManager3 = _interopRequireDefault(_focusManager2); | ||
var _focusManager2 = _interopRequireDefault(_focusManager); | ||
@@ -108,4 +108,28 @@ var _getActiveElement2 = require('./getActiveElement'); | ||
exports.addEventListener = _addEventListener3.default; /* list utils in alphabetical order */ | ||
exports.addEventListener = _addEventListener3.default; /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/* list utils in alphabetical order */ | ||
exports.addPositionChangeListener = _addPositionChangeListener3.default; | ||
@@ -119,3 +143,3 @@ exports.addResizeListener = _addResizeListener3.default; | ||
exports.findTabbable = _findTabbable3.default; | ||
exports.focusManager = _focusManager3.default; | ||
exports.FocusManager = _focusManager2.default; | ||
exports.getActiveElement = _getActiveElement3.default; | ||
@@ -122,0 +146,0 @@ exports.getBoundingClientRect = _getBoundingClientRect3.default; |
@@ -28,2 +28,26 @@ 'use strict'; | ||
*/ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
function isActiveElement(el) { | ||
@@ -30,0 +54,0 @@ var node = el && (0, _findDOMNode2.default)(el); |
@@ -27,2 +27,24 @@ 'use strict'; | ||
return node && node.ownerDocument || document; | ||
} | ||
} /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ |
@@ -55,2 +55,24 @@ 'use strict'; | ||
return requestAnimationFrame; | ||
}(); | ||
}(); /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ |
@@ -8,2 +8,6 @@ 'use strict'; | ||
var _findTabbable = require('@instructure/ui-a11y/lib/utils/findTabbable'); | ||
var _findTabbable2 = _interopRequireDefault(_findTabbable); | ||
var _findDOMNode = require('./findDOMNode'); | ||
@@ -13,6 +17,2 @@ | ||
var _findTabbable = require('./findTabbable'); | ||
var _findTabbable2 = _interopRequireDefault(_findTabbable); | ||
var _isActiveElement = require('./isActiveElement'); | ||
@@ -71,2 +71,24 @@ | ||
target.focus(); | ||
} | ||
} /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ |
@@ -8,2 +8,26 @@ 'use strict'; | ||
exports.transformCursor = transformCursor; | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -10,0 +34,0 @@ * --- |
@@ -11,8 +11,12 @@ 'use strict'; | ||
var _moment = require('moment'); | ||
var _DateTime = require('@instructure/ui-i18n/lib/DateTime'); | ||
var _moment2 = _interopRequireDefault(_moment); | ||
var _DateTime2 = _interopRequireDefault(_DateTime); | ||
require('moment-timezone/builds/moment-timezone-with-data'); | ||
var _deprecated = require('../react/deprecated'); | ||
var _warning = require('../warning'); | ||
var _warning2 = _interopRequireDefault(_warning); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -35,4 +39,4 @@ | ||
function now(locale, timezone) { | ||
checkParams(locale, timezone); | ||
return (0, _moment2.default)().locale(locale).tz(timezone); | ||
(0, _warning2.default)(false, '[%s] was deprecated in version %s. %s', 'DateTime.now', '5.0.0', (0, _deprecated.changedPackageWarning)('ui-utils', 'ui-i18n')); | ||
return _DateTime2.default.now(locale, timezone); | ||
} | ||
@@ -47,6 +51,29 @@ | ||
*/ | ||
// eslint-disable-line import/no-extraneous-dependencies | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
function parse(dateString, locale, timezone) { | ||
checkParams(locale, timezone); | ||
return _moment2.default.tz(dateString, [_moment2.default.ISO_8601, 'l', 'L', 'll', 'LL'], locale, timezone); | ||
(0, _warning2.default)(false, '[%s] was deprecated in version %s. %s', 'DateTime.parse', '5.0.0', (0, _deprecated.changedPackageWarning)('ui-utils', 'ui-i18n')); | ||
return _DateTime2.default.parse(dateString, locale, timezone); | ||
} | ||
@@ -60,3 +87,4 @@ | ||
function isValid(dateString) { | ||
return (0, _moment2.default)(dateString, [_moment2.default.ISO_8601]).isValid(); | ||
(0, _warning2.default)(false, '[%s] was deprecated in version %s. %s', 'DateTime.isValid', '5.0.0', (0, _deprecated.changedPackageWarning)('ui-utils', 'ui-i18n')); | ||
return _DateTime2.default.isValid(dateString); | ||
} | ||
@@ -70,3 +98,4 @@ | ||
function browserTimeZone() { | ||
return _moment2.default.tz.guess(); | ||
(0, _warning2.default)(false, '[%s] was deprecated in version %s. %s', 'DateTime.browserTimeZone', '5.0.0', (0, _deprecated.changedPackageWarning)('ui-utils', 'ui-i18n')); | ||
return _DateTime2.default.browserTimeZone(); | ||
} | ||
@@ -79,8 +108,2 @@ | ||
isValid: isValid | ||
}; | ||
function checkParams(locale, timezone) { | ||
if (locale == null) throw Error('locale must be specified'); | ||
if (timezone == null) throw Error('timezone must be specified'); | ||
} | ||
}; |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.Locale = exports.DateTime = undefined; | ||
exports.Numeral = exports.Locale = exports.DateTime = undefined; | ||
@@ -17,6 +17,35 @@ var _DateTime2 = require('./DateTime'); | ||
var _Numeral2 = require('./Numeral'); | ||
var _Numeral3 = _interopRequireDefault(_Numeral2); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
exports.DateTime = _DateTime3.default; /* list utils in alphabetical order */ | ||
exports.DateTime = _DateTime3.default; /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
exports.Locale = _Locale3.default; | ||
/* list utils in alphabetical order */ | ||
exports.Locale = _Locale3.default; | ||
exports.Numeral = _Numeral3.default; |
@@ -6,2 +6,15 @@ 'use strict'; | ||
}); | ||
var _Locale = require('@instructure/ui-i18n/lib/Locale'); | ||
var _Locale2 = _interopRequireDefault(_Locale); | ||
var _deprecated = require('../react/deprecated'); | ||
var _warning = require('../warning'); | ||
var _warning2 = _interopRequireDefault(_warning); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
/** | ||
@@ -22,7 +35,28 @@ * --- | ||
if (typeof nav !== 'undefined') { | ||
return nav.language; | ||
} | ||
return 'en'; | ||
(0, _warning2.default)(false, '[%s] was deprecated in version %s. %s', 'Locale.browserLocale', '5.0.0', (0, _deprecated.changedPackageWarning)('ui-utils', 'ui-i18n')); | ||
return _Locale2.default.browserLocale(nav); | ||
} | ||
}; | ||
}; /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ |
@@ -25,2 +25,24 @@ 'use strict'; | ||
react: react | ||
}; | ||
}; /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ |
@@ -13,2 +13,26 @@ 'use strict'; | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -15,0 +39,0 @@ * --- |
@@ -7,3 +7,25 @@ 'use strict'; | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
@@ -10,0 +32,0 @@ exports.default = ms; |
@@ -7,2 +7,26 @@ 'use strict'; | ||
exports.default = parseUnit; | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -28,3 +52,5 @@ * --- | ||
var value = '' + str; | ||
return [parseFloat(value, 10), value.match(/[\d.\-\+]*\s*(.*)/)[1] || '']; | ||
return [parseFloat(value, 10), | ||
// eslint-disable-next-line no-useless-escape | ||
value.match(/[\d.\-\+]*\s*(.*)/)[1] || '']; | ||
} |
@@ -7,3 +7,25 @@ 'use strict'; | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); | ||
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
@@ -10,0 +32,0 @@ exports.default = px; |
@@ -10,3 +10,25 @@ 'use strict'; | ||
var _class, _temp; | ||
var _class, _temp; /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
@@ -88,5 +110,2 @@ exports.pick = pick; | ||
key: 'render', | ||
/* eslint-enable react/require-default-props */ | ||
value: function render() { | ||
@@ -99,4 +118,2 @@ var _props = this.props, | ||
} | ||
/* eslint-disable react/require-default-props */ | ||
}]); | ||
@@ -111,3 +128,4 @@ | ||
*/ | ||
children: _propTypes2.default.node }, _temp); | ||
children: _propTypes2.default.node | ||
}, _temp); | ||
@@ -114,0 +132,0 @@ /** |
@@ -15,2 +15,6 @@ 'use strict'; | ||
var _propTypes = require('prop-types'); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _getDisplayName = require('./getDisplayName'); | ||
@@ -42,3 +46,25 @@ | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
@@ -55,3 +81,4 @@ /** | ||
* | ||
* The `size` will be updated whenever the dimensions of the container change. | ||
* The `size` will be updated whenever the dimensions of the container change, | ||
* and will be passed as a parameter to the onSizeChange prop provided. | ||
* | ||
@@ -66,3 +93,3 @@ * So that CSS rules can be applied based on the dimensions of the container, | ||
var getSelectorMap = function getSelectorMap(el) { | ||
return parseQuery(query, el); | ||
return query && parseQuery(query, el); | ||
}; | ||
@@ -92,7 +119,15 @@ | ||
_this._size = size; | ||
if (typeof _this.props.onSizeChange === 'function') { | ||
_this.props.onSizeChange(size); | ||
} | ||
var container = (0, _findDOMNode2.default)(_this); | ||
if (typeof getSelectorMap(container) !== 'function') { | ||
return; | ||
} | ||
var selectorMap = getSelectorMap(container)(size); | ||
_this._size = size; | ||
// eslint-disable-next-line no-restricted-syntax | ||
@@ -172,3 +207,3 @@ var _iteratorNormalCompletion = true; | ||
get: function get() { | ||
this._size; | ||
return this._size; | ||
} | ||
@@ -178,3 +213,5 @@ }]); | ||
return _class; | ||
}(ComposedComponent), _class.displayName = (0, _getDisplayName2.default)(ComposedComponent), _class.getSelectorMap = getSelectorMap, _temp2; | ||
}(ComposedComponent), _class.displayName = (0, _getDisplayName2.default)(ComposedComponent), _class.getSelectorMap = getSelectorMap, _class.propTypes = Object.assign({}, ComposedComponent.propTypes, { | ||
onSizeChange: _propTypes2.default.func | ||
}), _temp2; | ||
}; | ||
@@ -181,0 +218,0 @@ } |
@@ -7,11 +7,35 @@ 'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /** | ||
* --- | ||
* category: utilities/react | ||
* --- | ||
* Custom prop types for React components. | ||
* @module CustomPropTypes | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
* --- | ||
* category: utilities/react | ||
* --- | ||
* Custom prop types for React components. | ||
* @module CustomPropTypes | ||
*/ | ||
var _react = require('react'); | ||
@@ -25,5 +49,5 @@ | ||
var _moment = require('moment'); | ||
var _DateTime = require('@instructure/ui-i18n/lib/DateTime'); | ||
var _moment2 = _interopRequireDefault(_moment); | ||
var _DateTime2 = _interopRequireDefault(_DateTime); | ||
@@ -331,3 +355,3 @@ var _getDisplayName = require('./getDisplayName'); | ||
return function (props, propName, componentName) { | ||
var error = propType.apply(null, arguments); // eslint-disable-line prefer-spread | ||
var error = propType.apply(null, arguments); | ||
if (error) { | ||
@@ -459,4 +483,3 @@ return error; | ||
var parsedMoment = (0, _moment2.default)(propValue, [_moment2.default.ISO_8601]); | ||
if (!parsedMoment.isValid()) { | ||
if (!_DateTime2.default.isValid(propValue)) { | ||
return new Error('Invalid ' + location + ' `' + propName + '` `' + propValue + '` supplied to `' + componentName + '`, expected ' + 'an ISO 8601 formatted string.'); | ||
@@ -463,0 +486,0 @@ } |
@@ -12,2 +12,3 @@ 'use strict'; | ||
exports.default = deprecated; | ||
exports.changedPackageWarning = changedPackageWarning; | ||
@@ -28,3 +29,25 @@ var _getDisplayName = require('./getDisplayName'); | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
@@ -52,6 +75,7 @@ /** | ||
* @param {string} version | ||
* @param {object} oldProps | ||
* @param {object} oldProps (if this argument is null or undefined, the entire component is deprecated) | ||
* @param {string} message | ||
* @return {function} React component with deprecated props behavior | ||
*/ | ||
function deprecated(version, oldProps) { | ||
function deprecated(version, oldProps, message) { | ||
return function (ComposedComponent) { | ||
@@ -65,14 +89,29 @@ var _class, _temp; | ||
function DeprecatedComponent(props, context) { | ||
function DeprecatedComponent() { | ||
_classCallCheck(this, DeprecatedComponent); | ||
checkProps(version, props, oldProps); | ||
return _possibleConstructorReturn(this, (DeprecatedComponent.__proto__ || Object.getPrototypeOf(DeprecatedComponent)).call(this, props, context)); | ||
return _possibleConstructorReturn(this, (DeprecatedComponent.__proto__ || Object.getPrototypeOf(DeprecatedComponent)).apply(this, arguments)); | ||
} | ||
_createClass(DeprecatedComponent, [{ | ||
key: 'componentDidMount', | ||
value: function componentDidMount() { | ||
if (oldProps) { | ||
warnDeprecatedProps(displayName, version, this.props, oldProps, message); | ||
} else { | ||
warnDeprecatedComponent(version, displayName, message); | ||
} | ||
if (_get(DeprecatedComponent.prototype.__proto__ || Object.getPrototypeOf(DeprecatedComponent.prototype), 'componentDidMount', this)) { | ||
_get(DeprecatedComponent.prototype.__proto__ || Object.getPrototypeOf(DeprecatedComponent.prototype), 'componentDidMount', this).call(this); | ||
} | ||
} | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(nextProps) { | ||
checkProps(version, nextProps, oldProps); | ||
if (oldProps) { | ||
warnDeprecatedProps(displayName, version, nextProps, oldProps, message); | ||
} else { | ||
warnDeprecatedComponent(version, displayName, message); | ||
} | ||
@@ -93,3 +132,3 @@ if (_get(DeprecatedComponent.prototype.__proto__ || Object.getPrototypeOf(DeprecatedComponent.prototype), 'componentWillReceiveProps', this)) { | ||
function checkProps(version, props, oldProps) { | ||
function warnDeprecatedProps(displayName, version, props, oldProps, message) { | ||
Object.keys(oldProps).forEach(function (oldProp) { | ||
@@ -99,5 +138,13 @@ if (typeof props[oldProp] !== 'undefined') { | ||
(0, _warning2.default)(false, '%s was deprecated in %s%s', oldProp, version, newProp ? ' use ' + newProp + ' instead' : ''); | ||
(0, _warning2.default)(false, '[%s] `%s` was deprecated in %s%s. %s', displayName, oldProp, version, newProp ? '. Use `' + newProp + '` instead' : '', message || ''); | ||
} | ||
}); | ||
} | ||
function warnDeprecatedComponent(version, displayName, message) { | ||
(0, _warning2.default)(false, '[%s] was deprecated in version %s. %s', displayName, version, message || ''); | ||
} | ||
function changedPackageWarning(prevPackage, newPackage) { | ||
return 'It has been moved from @instructure/' + prevPackage + ' to @instructure/' + newPackage + '.'; | ||
} |
@@ -32,2 +32,26 @@ 'use strict'; | ||
*/ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
function ensureSingleChild(child) { | ||
@@ -34,0 +58,0 @@ var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; |
@@ -29,2 +29,24 @@ 'use strict'; | ||
return typeof Component === 'string' ? Component : Component.displayName; | ||
} | ||
} /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ |
@@ -6,4 +6,19 @@ 'use strict'; | ||
}); | ||
exports.windowMessageListener = exports.safeCloneElement = exports.passthroughProps = exports.matchComponentTypes = exports.getElementType = exports.getDisplayName = exports.ensureSingleChild = exports.deprecated = exports.CustomPropTypes = exports.containerQuery = exports.ComponentIdentifier = undefined; | ||
exports.windowMessageListener = exports.safeCloneElement = exports.pickProps = exports.omitProps = exports.matchComponentTypes = exports.getElementType = exports.getDisplayName = exports.ensureSingleChild = exports.deprecated = exports.CustomPropTypes = exports.containerQuery = exports.ComponentIdentifier = undefined; | ||
var _passthroughProps = require('./passthroughProps'); | ||
Object.defineProperty(exports, 'omitProps', { | ||
enumerable: true, | ||
get: function get() { | ||
return _passthroughProps.omitProps; | ||
} | ||
}); | ||
Object.defineProperty(exports, 'pickProps', { | ||
enumerable: true, | ||
get: function get() { | ||
return _passthroughProps.pickProps; | ||
} | ||
}); | ||
var _ComponentIdentifier2 = require('./ComponentIdentifier'); | ||
@@ -41,6 +56,2 @@ | ||
var _passthroughProps2 = require('./passthroughProps'); | ||
var _passthroughProps3 = _interopRequireDefault(_passthroughProps2); | ||
var _safeCloneElement2 = require('./safeCloneElement'); | ||
@@ -56,4 +67,28 @@ | ||
exports.ComponentIdentifier = _ComponentIdentifier3.default; /* list utils in alphabetical order */ | ||
exports.ComponentIdentifier = _ComponentIdentifier3.default; /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/* list utils in alphabetical order */ | ||
exports.containerQuery = _containerQuery3.default; | ||
@@ -66,4 +101,3 @@ exports.CustomPropTypes = _CustomPropTypes3.default; | ||
exports.matchComponentTypes = _matchComponentTypes3.default; | ||
exports.passthroughProps = _passthroughProps3.default; | ||
exports.safeCloneElement = _safeCloneElement3.default; | ||
exports.windowMessageListener = _windowMessageListener3.default; |
@@ -36,2 +36,24 @@ 'use strict'; | ||
} | ||
} | ||
} /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ |
@@ -35,2 +35,26 @@ 'use strict'; | ||
*/ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
function omitProps(props) { | ||
@@ -37,0 +61,0 @@ var propTypes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; |
@@ -75,2 +75,24 @@ 'use strict'; | ||
})].concat(children)); | ||
} | ||
} /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ |
@@ -28,3 +28,25 @@ 'use strict'; | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
@@ -31,0 +53,0 @@ /** |
@@ -10,2 +10,26 @@ 'use strict'; | ||
exports.default = shallowEqual; | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
// https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/shallowEqual.js | ||
@@ -12,0 +36,0 @@ var hasOwnProperty = Object.prototype.hasOwnProperty; |
@@ -23,2 +23,24 @@ 'use strict'; | ||
*/ | ||
exports.default = _shortid2.default.generate; | ||
exports.default = _shortid2.default.generate; /* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ |
@@ -7,2 +7,26 @@ 'use strict'; | ||
exports.default = warning; | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -9,0 +33,0 @@ * --- |
@@ -7,2 +7,26 @@ "use strict"; | ||
exports.default = within; | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -9,0 +33,0 @@ * --- |
{ | ||
"name": "@instructure/ui-utils", | ||
"version": "4.7.0", | ||
"version": "4.7.1-dev.0", | ||
"description": "A collection of utilities for UI components", | ||
@@ -25,15 +25,13 @@ "author": "Instructure, Inc. Engineering and Product Design", | ||
"devDependencies": { | ||
"@instructure/ui-presets": "^4.7.0", | ||
"react": "15.6.1", | ||
"react-dom": "15.6.1" | ||
"@instructure/ui-presets": "^4.7.1-dev.0", | ||
"react": "15.6.2", | ||
"react-dom": "15.6.2" | ||
}, | ||
"dependencies": { | ||
"bowser": "^1.7.0", | ||
"decimal.js": "^7.2.1", | ||
"@instructure/ui-i18n": "^4.7.1-dev.0", | ||
"bowser": "^1.9.1", | ||
"decimal.js": "^9.0.1", | ||
"deep-equal": "^1.0.1", | ||
"keycode": "^2.1.8", | ||
"moment": "^2.10.6", | ||
"moment-timezone": "^0.5.14", | ||
"no-scroll": "^2.1.0", | ||
"numeral": "^2.0.6", | ||
"object.omit": "^3.0.0", | ||
@@ -45,4 +43,4 @@ "object.pick": "^1.2.0", | ||
"peerDependencies": { | ||
"react": "^0.14.9 || ^15.6.1", | ||
"react-dom": "^0.14.9 || ^15.6.1" | ||
"react": "^0.14.9 || ^15.6.2", | ||
"react-dom": "^0.14.9 || ^15.6.2" | ||
}, | ||
@@ -49,0 +47,0 @@ "publishConfig": { |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -2,0 +26,0 @@ * --- |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -2,0 +26,0 @@ * --- |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -2,0 +26,0 @@ * --- |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode' | ||
@@ -2,0 +26,0 @@ |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode' | ||
@@ -2,0 +26,0 @@ import getBoundingClientRect from './getBoundingClientRect' |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode' | ||
@@ -2,0 +26,0 @@ import requestAnimationFrame from './requestAnimationFrame' |
@@ -1,395 +0,40 @@ | ||
import getBoundingClientRect from './getBoundingClientRect' | ||
import getScrollParents from './getScrollParents' | ||
import getOffsetParents from './getOffsetParents' | ||
import canUseDOM from './canUseDOM' | ||
import findDOMNode from './findDOMNode' | ||
import ownerDocument from './ownerDocument' | ||
import ownerWindow from './ownerWindow' | ||
/** | ||
* --- | ||
* category: utilities/DOM | ||
* --- | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Calculate the coordinates to attach an element | ||
* to a designated target with specified constraints | ||
* @module | ||
* @param {ReactComponent|DomNode} el - component or DOM node | ||
* @param {DomNode} target - the target DOM node | ||
* @param {Object} options - constraints for the positioning | ||
* @param {string} options.placement - designates where the element will be attached | ||
* ('top', 'bottom', 'left', 'right', 'top left' etc.) | ||
* @param {DomNode} options.container - DOM node where the element is contained | ||
* @param {boolean} options.over - whether or not you want the element to position over the target | ||
* @param {string} options.constrain - if the element should be constrained to 'window', | ||
* 'scroll-parent', 'parent', or 'none' | ||
* @param {string|number} options.offsetX - the horizontal offset for the positioned element | ||
* @param {string|number} options.offsetY - the vertical offset for the positioned element | ||
* @returns {Object} object containing style with the calculated position in the 'transform' | ||
* property | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
export default function calculateElementPosition (element, target, options) { | ||
if (!element || options.placement === 'offscreen') { | ||
return { | ||
placement: options.placement, | ||
style: { | ||
left: '-9999em', | ||
overflow: 'hidden', | ||
position: 'absolute' | ||
} | ||
} | ||
} | ||
const pos = new PositionData(element, target, options) | ||
// Relative import here because we cannot import ui-layout without creating a circular dependency. It | ||
// will be removed along with this file when we eliminate calculateElementPosition from ui-utils completely. | ||
import UIcalculateElementPosition from '../../../ui-layout/lib/utils/calculateElementPosition' | ||
return { | ||
placement: pos.placement, | ||
style: pos.style | ||
} | ||
} | ||
import { changedPackageWarning } from '../react/deprecated' | ||
import warning from '../warning' | ||
class PositionedElement { | ||
constructor (element, placement, offset = { top: 0, left: 0 }) { | ||
this.node = findDOMNode(element) | ||
if (typeof placement === 'string') { | ||
this.placement = parsePlacement(placement) | ||
} else if (Array.isArray(placement)) { | ||
this.placement = placement | ||
} else { | ||
this.placement = ['bottom', 'center'] | ||
} | ||
this.rect = getBoundingClientRect(this.node) | ||
this._offset = offsetToPx(offset, this.size) | ||
} | ||
get width () { | ||
return this.rect.width | ||
} | ||
get height () { | ||
return this.rect.height | ||
} | ||
get size () { | ||
return { | ||
width: this.width, | ||
height: this.height | ||
} | ||
} | ||
get position () { | ||
return { | ||
top: this.rect.top, | ||
left: this.rect.left | ||
} | ||
} | ||
get hasVerticalPlacement () { | ||
return ['top', 'bottom'].indexOf(this.placement[0]) >= 0 | ||
} | ||
get hasHorizontalPlacement () { | ||
return ['start', 'end'].indexOf(this.placement[0]) >= 0 | ||
} | ||
get shouldStretchVertically () { | ||
return this.placement[1] === 'stretch' && this.hasVerticalPlacement | ||
} | ||
get shouldStretchHorizontally () { | ||
return this.placement[1] === 'stretch' && this.hasHorizontalPlacement | ||
} | ||
get mirroredPlacement () { | ||
const [first, second] = this.placement | ||
const mirror = { | ||
center: 'center', | ||
start: 'end', | ||
end: 'start', | ||
top: 'bottom', | ||
bottom: 'top', | ||
stretch: 'stretch' | ||
} | ||
return [mirror[first], second] | ||
} | ||
calculateOffset (placement) { | ||
const offsetMap = { | ||
top: 0, | ||
start: 0, | ||
center: '50%', | ||
bottom: '100%', | ||
end: '100%', | ||
stretch: 0 | ||
} | ||
let [first, second] = placement | ||
if (['start', 'end'].indexOf(first) >= 0) { | ||
[first, second] = [second, first] | ||
} | ||
let top = 0 | ||
let left = 0 | ||
if (typeof offsetMap[first] !== 'undefined') { | ||
top = offsetMap[first] | ||
} | ||
if (typeof offsetMap[second] !== 'undefined') { | ||
left = offsetMap[second] | ||
} | ||
return addOffsets([offsetToPx({ top, left }, this.size), parseOffset(this._offset, this.placement)]) | ||
} | ||
get scrollParentsOffset () { | ||
const parents = getScrollParents(this.node) | ||
let offsetY = 0 | ||
let offsetX = 0 | ||
for (let i = 1; i < parents.length; i++) { | ||
const parent = parents[i] | ||
const child = parents[i - 1] | ||
offsetY = offsetY + (parent.scrollTop - child.scrollTop) | ||
offsetX = offsetX + (parent.scrollLeft - child.scrollLeft) | ||
} | ||
return { top: offsetY, left: offsetX } | ||
} | ||
get positionedParentsOffset () { | ||
// If the element container is within a positioned | ||
// element, it will position absolutely with respect to that | ||
// ancestor. We calculate the offset between the child and | ||
// positioned parent so we can negate that distance | ||
const parents = getOffsetParents(this.node) | ||
let offsetY = 0 | ||
let offsetX = 0 | ||
for (let i = 1; i < parents.length; i++) { | ||
const parent = getBoundingClientRect(parents[i]) | ||
const child = getBoundingClientRect(parents[i - 1]) | ||
offsetY = offsetY + (child.top - parent.top) | ||
offsetX = offsetX + (child.left - parent.left) | ||
} | ||
return { top: offsetY, left: offsetX } | ||
} | ||
} | ||
class PositionData { | ||
constructor (element, target, options) { | ||
this.options = options || {} | ||
const { container, constrain, placement, over } = this.options | ||
if (!element || placement === 'offscreen') return | ||
this.container = container || ownerDocument(element).body | ||
this.element = new PositionedElement(element, placement, { top: this.options.offsetY, left: this.options.offsetX }) | ||
this.target = new PositionedElement( | ||
target || this.container, | ||
over ? this.element.placement : this.element.mirroredPlacement | ||
export default function calculateElementPosition (element, target, options) { | ||
warning(false, '[%s] was deprecated in version %s. %s', 'calculateElementPosition', '5.0.0', | ||
changedPackageWarning( | ||
'ui-utils', | ||
'ui-layout' | ||
) | ||
if (constrain === 'window') { | ||
this.constrainTo(ownerWindow(element)) | ||
} else if (constrain === 'scroll-parent') { | ||
this.constrainTo(getScrollParents(this.target.node)[0]) | ||
} else if (constrain === 'parent') { | ||
this.constrainTo(this.container) | ||
} | ||
} | ||
get offset () { | ||
const { top, left } = this.target.calculateOffset(this.element.placement) | ||
const offset = addOffsets([ | ||
this.element.calculateOffset(this.target.placement), | ||
this.element.scrollParentsOffset, | ||
this.element.positionedParentsOffset | ||
]) | ||
return { | ||
top: top - offset.top, | ||
left: left - offset.left | ||
} | ||
} | ||
get placement () { | ||
return formatPlacement(this.element.placement) | ||
} | ||
get minWidth () { | ||
return this.element.shouldStretchVertically ? this.target.width : null | ||
} | ||
get minHeight () { | ||
return this.element.shouldStretchHorizontally ? this.target.height : null | ||
} | ||
get position () { | ||
const win = ownerWindow(this.target.node) | ||
let { left, top } = addOffsets([this.target.position, this.offset]) | ||
if (canUseDOM && win.matchMedia) { | ||
const retina = | ||
win.matchMedia('only screen and (min-resolution: 1.3dppx)').matches || | ||
win.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 1.3)').matches | ||
if (!retina) { | ||
left = Math.round(left) | ||
top = Math.round(top) | ||
} | ||
} | ||
return { left, top } | ||
} | ||
get style () { | ||
return { | ||
top: 0, | ||
left: 0, | ||
minWidth: this.minWidth, | ||
minHeight: this.minHeight, | ||
position: 'absolute', | ||
transform: `translateX(${this.position.left}px) translateY(${this.position.top}px) translateZ(0)` | ||
} | ||
} | ||
constrainTo (element) { | ||
if (!element) return | ||
const { top, left } = addOffsets([this.target.position, this.offset]) | ||
const bounds = getBoundingClientRect(element) | ||
const right = left + this.element.positionedParentsOffset.left + this.element.width | ||
const oob = { | ||
top: top < bounds.top, | ||
bottom: top + this.element.height > bounds.bottom, | ||
left: left < bounds.left, | ||
right: right > bounds.right | ||
} | ||
if (this.element.hasVerticalPlacement) { | ||
if (oob.left && oob.right) { | ||
this.element.placement[1] = 'center' | ||
this.target.placement[1] = 'center' | ||
} else if (oob.left) { | ||
this.element.placement[1] = 'start' | ||
this.target.placement[1] = 'start' | ||
} else if (oob.right) { | ||
this.element.placement[1] = 'end' | ||
this.target.placement[1] = 'end' | ||
} | ||
if (oob.top) { | ||
this.element.placement[0] = 'bottom' | ||
this.target.placement[0] = 'top' | ||
} else if (oob.bottom) { | ||
this.element.placement[0] = 'top' | ||
this.target.placement[0] = 'bottom' | ||
} | ||
} else if (this.element.hasHorizontalPlacement) { | ||
if (oob.top && oob.bottom) { | ||
this.element.placement[1] = 'center' | ||
this.target.placement[1] = 'center' | ||
} else if (oob.top) { | ||
this.element.placement[1] = 'top' | ||
this.target.placement[1] = 'top' | ||
} else if (oob.bottom) { | ||
this.element.placement[1] = 'bottom' | ||
this.target.placement[1] = 'bottom' | ||
} | ||
if (oob.left) { | ||
this.element.placement[0] = 'end' | ||
this.target.placement[0] = 'start' | ||
} else if (oob.right) { | ||
this.element.placement[0] = 'start' | ||
this.target.placement[0] = 'end' | ||
} | ||
} | ||
} | ||
} | ||
function addOffsets (offsets) { | ||
return offsets.reduce( | ||
(sum, offset) => { | ||
return { | ||
top: sum.top + offset.top, | ||
left: sum.left + offset.left | ||
} | ||
}, | ||
{ top: 0, left: 0 } | ||
) | ||
return UIcalculateElementPosition(element, target, options) | ||
} | ||
function parseOffset (offset, placement) { | ||
let { top, left } = offset | ||
if (placement[0] === 'bottom') { | ||
top = 0 - parseFloat(top, 10) | ||
} | ||
if (placement[0] === 'end') { | ||
left = 0 - parseFloat(left, 10) | ||
} | ||
return { | ||
top, | ||
left | ||
} | ||
} | ||
function offsetToPx (offset, size) { | ||
let { left, top } = offset | ||
if (typeof left === 'string' && left.indexOf('%') !== -1) { | ||
left = parseFloat(left, 10) / 100 * size.width // eslint-disable-line no-mixed-operators | ||
} else { | ||
left = parseFloat(left, 10) | ||
} | ||
if (typeof top === 'string' && top.indexOf('%') !== -1) { | ||
top = parseFloat(top, 10) / 100 * size.height // eslint-disable-line no-mixed-operators | ||
} else { | ||
top = parseFloat(top, 10) | ||
} | ||
return { top, left } | ||
} | ||
function sortPlacement (placement) { | ||
let [first, second] = placement | ||
if (first === 'center' || first === 'stretch') { | ||
[first, second] = [second, first] | ||
} | ||
return [first, second] | ||
} | ||
export function parsePlacement (placement) { | ||
let parsed = placement.split(' ') | ||
if (parsed.length === 1) { | ||
parsed = [placement, 'center'] | ||
} | ||
return sortPlacement(parsed) | ||
} | ||
function formatPlacement (placement) { | ||
return placement.join(' ') | ||
} |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -2,0 +26,0 @@ * --- |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode' | ||
@@ -2,0 +26,0 @@ import canUseDOM from './canUseDOM' |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode' | ||
@@ -2,0 +26,0 @@ import getActiveElement from './getActiveElement' |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import ReactDOM from 'react-dom' | ||
@@ -2,0 +26,0 @@ |
@@ -1,74 +0,36 @@ | ||
/** | ||
* Adapted from jQuery UI core | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* http://jqueryui.com | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Copyright 2014 jQuery Foundation and other contributors | ||
* Released under the MIT license. | ||
* http://jquery.org/license | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* http://api.jqueryui.com/category/ui-core/ | ||
**/ | ||
import getComputedStyle from './getComputedStyle' | ||
import findDOMNode from './findDOMNode' | ||
/** | ||
* --- | ||
* category: utilities/DOM | ||
* --- | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* Given an element, finds and returns all tabbable children. | ||
* Tabbable elements include input, select, textarea, button, and object. | ||
* Anchor tags are also tabbable if they include an href or positive | ||
* tabindex attribute. | ||
* | ||
* @param {ReactComponent|DomNode} el - component or DOM node | ||
* @returns {Array} array of all tabbable children | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
export default function findTabbable (el) { | ||
const element = findDOMNode(el) | ||
if (!element || typeof element.querySelectorAll !== 'function') { | ||
return [] | ||
} | ||
import UIFindTabbable from '@instructure/ui-a11y/lib/utils/findTabbable' | ||
const focusableSelector = 'a[href],frame,iframe,object,input:not([type=hidden]),select,textarea,button,*[tabindex]' | ||
const matches = element.querySelectorAll(focusableSelector) | ||
return [].slice.call(matches, 0).filter(el => tabbable(el)) | ||
} | ||
import { changedPackageWarning } from '../react/deprecated' | ||
import warning from '../warning' | ||
function focusable (element) { | ||
return !element.disabled && visible(element) | ||
} | ||
function hidden (element) { | ||
const cs = getComputedStyle(element) | ||
return (cs.display !== 'inline' && element.offsetWidth <= 0 && element.offsetHeight <= 0) || cs.display === 'none' | ||
} | ||
function positioned (element) { | ||
const POS = ['fixed', 'absolute'] | ||
if (POS.includes(element.style.position.toLowerCase())) return true | ||
if (POS.includes(getComputedStyle(element).getPropertyValue('position').toLowerCase())) return true | ||
return false | ||
} | ||
function visible (element) { | ||
/* eslint no-param-reassign:0 */ | ||
while (element) { | ||
if (element === document.body) break | ||
if (hidden(element)) return false | ||
if (positioned(element)) break | ||
element = element.parentNode | ||
} | ||
return true | ||
} | ||
function isInvalidTabIndex (tabIndex) { | ||
return !isNaN(tabIndex) && tabIndex < 0 | ||
} | ||
function tabbable (element) { | ||
return !isInvalidTabIndex(element.getAttribute('tabindex')) && focusable(element) | ||
} | ||
export default function findTabbable (el) { | ||
warning(false, '[%s] was deprecated in version %s. %s', 'findTabbable', '5.0.0', changedPackageWarning( | ||
'ui-utils', | ||
'ui-a11y' | ||
) || '') | ||
return UIFindTabbable(el) | ||
} |
@@ -1,107 +0,37 @@ | ||
import findDOMNode from './findDOMNode' | ||
import findTabbable from './findTabbable' | ||
import ownerDocument from './ownerDocument' | ||
import ownerWindow from './ownerWindow' | ||
import getActiveElement from './getActiveElement' | ||
import addEventListener from './addEventListener' | ||
import containsActiveElement from './containsActiveElement' | ||
import warning from '../warning' | ||
/** | ||
* --- | ||
* category: utilities/DOM | ||
* --- | ||
* @module FocusManager | ||
* Class for focus operations. | ||
* - Scoping focus within a given context, | ||
* - Mark active element for focus later | ||
* - Return focus to the marked element | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
class FocusManager { | ||
contextElement = null | ||
focusLaterElement = null | ||
needToFocus = false | ||
listeners = [] | ||
timeouts = [] | ||
import UIFocusManager from '@instructure/ui-a11y/lib/utils/focusManager' | ||
handleBlur = event => { | ||
this.needToFocus = true | ||
} | ||
import { changedPackageWarning } from '../react/deprecated' | ||
import warning from '../warning' | ||
handleFocus = event => { | ||
if (this.needToFocus) { | ||
this.needToFocus = false | ||
if (!this.contextElement) { | ||
return | ||
} | ||
// need to see how jQuery shims document.on('focusin') so we don't need the | ||
// setTimeout, firefox doesn't support focusin, if it did, we could focus | ||
// the element outside of a setTimeout. Side-effect of this implementation | ||
// is that the document.body gets focus, and then we focus our element right | ||
// after, seems fine. | ||
this.timeouts.push( | ||
setTimeout(() => { | ||
if (containsActiveElement(this.contextElement)) { | ||
return | ||
} | ||
const el = findTabbable(this.contextElement)[0] | ||
el.focus() | ||
}, 0) | ||
) | ||
} | ||
export default class FocusManager extends UIFocusManager { | ||
constructor () { | ||
super() | ||
warning(false, '[%s] was deprecated in version %s. %s', 'FocusManager', '5.0.0', changedPackageWarning( | ||
'ui-utils', | ||
'ui-a11y' | ||
) || '') | ||
} | ||
markForFocusLater () { | ||
this.focusLaterElement = getActiveElement(ownerDocument(this.contextElement)) | ||
} | ||
returnFocus () { | ||
try { | ||
this.focusLaterElement.focus() | ||
} catch (e) { | ||
warning( | ||
false, | ||
` | ||
You tried to return focus to ${this.focusLaterElement} | ||
but it is not in the DOM anymore: ${e} | ||
` | ||
) | ||
} | ||
this.focusLaterElement = null | ||
} | ||
setupScopedFocus (el) { | ||
if (this.contextElement) { | ||
warning( | ||
false, | ||
` | ||
Focus is already scoped to ${this.contextElement}. | ||
` | ||
) | ||
return | ||
} | ||
this.contextElement = findDOMNode(el) | ||
const win = ownerWindow(this.contextElement) | ||
this.listeners.push(addEventListener(ownerWindow(this.contextElement), 'blur', this.handleBlur, false)) | ||
this.listeners.push(addEventListener(ownerDocument(this.contextElement), 'focus', this.handleFocus, true)) | ||
} | ||
teardownScopedFocus () { | ||
this.listeners.forEach(listener => { | ||
listener.remove() | ||
}) | ||
this.listeners = [] | ||
this.timeouts.forEach(timeout => { | ||
clearTimeout(timeout) | ||
}) | ||
this.timeouts = [] | ||
this.contextElement = null | ||
} | ||
} | ||
export default new FocusManager() |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -2,0 +26,0 @@ * --- |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode' | ||
@@ -2,0 +26,0 @@ import canUseDOM from './canUseDOM' |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode' | ||
@@ -2,0 +26,0 @@ |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode' | ||
@@ -2,0 +26,0 @@ import canUseDOM from './canUseDOM' |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -2,0 +26,0 @@ * --- |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode' | ||
@@ -30,2 +54,3 @@ import canUseDOM from './canUseDOM' | ||
// eslint-disable-next-line no-cond-assign | ||
while ((parent = parent.parentNode) && parent && parent.nodeType === 1 && parent.tagName !== 'BODY') { | ||
@@ -32,0 +57,0 @@ if (getComputedStyle(parent).position !== 'static') { |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode' | ||
@@ -38,2 +62,3 @@ import canUseDOM from './canUseDOM' | ||
let parent = node | ||
// eslint-disable-next-line no-cond-assign | ||
while (parent && parent.nodeType === 1 && (parent = parent.parentNode)) { | ||
@@ -40,0 +65,0 @@ let style |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import contains from './contains' | ||
@@ -2,0 +26,0 @@ |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/* list utils in alphabetical order */ | ||
@@ -11,3 +35,3 @@ export addEventListener from './addEventListener' | ||
export findTabbable from './findTabbable' | ||
export focusManager from './focusManager' | ||
export FocusManager from './focusManager' | ||
export getActiveElement from './getActiveElement' | ||
@@ -14,0 +38,0 @@ export getBoundingClientRect from './getBoundingClientRect' |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode' | ||
@@ -2,0 +26,0 @@ import getActiveElement from './getActiveElement' |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode' | ||
@@ -2,0 +26,0 @@ |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findDOMNode from './findDOMNode' | ||
@@ -2,0 +26,0 @@ import ownerDocument from './ownerDocument' |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import canUseDOM from './canUseDOM' | ||
@@ -2,0 +26,0 @@ |
@@ -0,3 +1,28 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import findTabbable from '@instructure/ui-a11y/lib/utils/findTabbable' | ||
import findDOMNode from './findDOMNode' | ||
import findTabbable from './findTabbable' | ||
import isActiveElement from './isActiveElement' | ||
@@ -4,0 +29,0 @@ import containsActiveElement from './containsActiveElement' |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -2,0 +26,0 @@ * --- |
@@ -1,4 +0,30 @@ | ||
import moment from 'moment' // eslint-disable-line import/no-extraneous-dependencies | ||
import 'moment-timezone/builds/moment-timezone-with-data' | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import DateTime from '@instructure/ui-i18n/lib/DateTime' | ||
import { changedPackageWarning } from '../react/deprecated' | ||
import warning from '../warning' | ||
/** | ||
@@ -19,4 +45,10 @@ * --- | ||
export function now (locale, timezone) { | ||
checkParams(locale, timezone) | ||
return moment().locale(locale).tz(timezone) | ||
warning( | ||
false, | ||
'[%s] was deprecated in version %s. %s', | ||
'DateTime.now', | ||
'5.0.0', | ||
changedPackageWarning('ui-utils', 'ui-i18n') | ||
) | ||
return DateTime.now(locale, timezone) | ||
} | ||
@@ -32,4 +64,10 @@ | ||
export function parse (dateString, locale, timezone) { | ||
checkParams(locale, timezone) | ||
return moment.tz(dateString, [moment.ISO_8601, 'l', 'L', 'll', 'LL'], locale, timezone) | ||
warning( | ||
false, | ||
'[%s] was deprecated in version %s. %s', | ||
'DateTime.parse', | ||
'5.0.0', | ||
changedPackageWarning('ui-utils', 'ui-i18n') | ||
) | ||
return DateTime.parse(dateString, locale, timezone) | ||
} | ||
@@ -43,3 +81,10 @@ | ||
export function isValid (dateString) { | ||
return moment(dateString, [moment.ISO_8601]).isValid() | ||
warning( | ||
false, | ||
'[%s] was deprecated in version %s. %s', | ||
'DateTime.isValid', | ||
'5.0.0', | ||
changedPackageWarning('ui-utils', 'ui-i18n') | ||
) | ||
return DateTime.isValid(dateString) | ||
} | ||
@@ -53,3 +98,10 @@ | ||
export function browserTimeZone () { | ||
return moment.tz.guess() | ||
warning( | ||
false, | ||
'[%s] was deprecated in version %s. %s', | ||
'DateTime.browserTimeZone', | ||
'5.0.0', | ||
changedPackageWarning('ui-utils', 'ui-i18n') | ||
) | ||
return DateTime.browserTimeZone() | ||
} | ||
@@ -63,6 +115,1 @@ | ||
} | ||
function checkParams (locale, timezone) { | ||
if (locale == null) throw Error('locale must be specified') | ||
if (timezone == null) throw Error('timezone must be specified') | ||
} |
@@ -0,3 +1,28 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/* list utils in alphabetical order */ | ||
export DateTime from './DateTime' | ||
export Locale from './Locale' | ||
export Numeral from './Numeral' |
@@ -0,1 +1,30 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import Locale from '@instructure/ui-i18n/lib/Locale' | ||
import { changedPackageWarning } from '../react/deprecated' | ||
import warning from '../warning' | ||
/** | ||
@@ -14,7 +43,12 @@ * --- | ||
browserLocale (nav = navigator) { | ||
if (typeof nav !== 'undefined') { | ||
return nav.language | ||
} | ||
return 'en' | ||
warning( | ||
false, | ||
'[%s] was deprecated in version %s. %s', | ||
'Locale.browserLocale', | ||
'5.0.0', | ||
changedPackageWarning('ui-utils', 'ui-i18n') | ||
) | ||
return Locale.browserLocale(nav) | ||
} | ||
} |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import * as dom from './dom' | ||
@@ -2,0 +26,0 @@ import * as i18n from './i18n' |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -2,0 +26,0 @@ * --- |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import parseUnit from './parseUnit' | ||
@@ -2,0 +26,0 @@ |
@@ -0,1 +1,26 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -23,4 +48,5 @@ * --- | ||
parseFloat(value, 10), | ||
// eslint-disable-next-line no-useless-escape | ||
value.match(/[\d.\-\+]*\s*(.*)/)[1] || '' | ||
] | ||
} |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import getFontSize from './dom/getFontSize' | ||
@@ -2,0 +26,0 @@ import parseUnit from './parseUnit' |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import React, { Component } from 'react' | ||
@@ -44,3 +68,2 @@ import PropTypes from 'prop-types' | ||
export default class ComponentIdentifier extends Component { | ||
/* eslint-disable react/require-default-props */ | ||
static propTypes = { | ||
@@ -52,3 +75,2 @@ /** | ||
} | ||
/* eslint-enable react/require-default-props */ | ||
@@ -55,0 +77,0 @@ render () { |
@@ -0,1 +1,26 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import PropTypes from 'prop-types' | ||
import getDisplayName from './getDisplayName' | ||
@@ -17,3 +42,4 @@ import findDOMNode from '../dom/findDOMNode' | ||
* | ||
* The `size` will be updated whenever the dimensions of the container change. | ||
* The `size` will be updated whenever the dimensions of the container change, | ||
* and will be passed as a parameter to the onSizeChange prop provided. | ||
* | ||
@@ -28,3 +54,3 @@ * So that CSS rules can be applied based on the dimensions of the container, | ||
const getSelectorMap = function (el) { | ||
return parseQuery(query, el) | ||
return query && parseQuery(query, el) | ||
} | ||
@@ -37,2 +63,7 @@ | ||
static propTypes = { | ||
...ComposedComponent.propTypes, | ||
onSizeChange: PropTypes.func | ||
} | ||
updateAttributes = (size) => { | ||
@@ -43,7 +74,15 @@ if (this._size && (this._size.width === size.width && this._size.height === size.height)) { | ||
this._size = size | ||
if (typeof this.props.onSizeChange === 'function') { | ||
this.props.onSizeChange(size) | ||
} | ||
const container = findDOMNode(this) | ||
if (typeof getSelectorMap(container) !== 'function') { | ||
return | ||
} | ||
const selectorMap = getSelectorMap(container)(size) | ||
this._size = size | ||
// eslint-disable-next-line no-restricted-syntax | ||
@@ -92,3 +131,3 @@ for (const [selectorName, isOn] of toPairs(selectorMap)) { | ||
get size () { | ||
this._size | ||
return this._size | ||
} | ||
@@ -95,0 +134,0 @@ } |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -10,6 +34,6 @@ * --- | ||
import PropTypes from 'prop-types' | ||
import moment from 'moment' | ||
import DateTime from '@instructure/ui-i18n/lib/DateTime' | ||
import getDisplayName from './getDisplayName' | ||
import warning from '../warning' | ||
import canUseDOM from '../dom/canUseDOM' | ||
@@ -295,3 +319,3 @@ | ||
return function (props, propName, componentName) { | ||
const error = propType.apply(null, arguments) // eslint-disable-line prefer-spread | ||
const error = propType.apply(null, arguments) | ||
if (error) { | ||
@@ -457,4 +481,3 @@ return error | ||
const parsedMoment = moment(propValue, [moment.ISO_8601]) | ||
if (!parsedMoment.isValid()) { | ||
if (!DateTime.isValid(propValue)) { | ||
return new Error( | ||
@@ -461,0 +484,0 @@ `Invalid ${location} \`${propName}\` \`${propValue}\` supplied to \`${componentName}\`, expected ` + |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import getDisplayName from './getDisplayName' | ||
@@ -25,6 +49,7 @@ import warning from '../warning' | ||
* @param {string} version | ||
* @param {object} oldProps | ||
* @param {object} oldProps (if this argument is null or undefined, the entire component is deprecated) | ||
* @param {string} message | ||
* @return {function} React component with deprecated props behavior | ||
*/ | ||
export default function deprecated (version, oldProps) { | ||
export default function deprecated (version, oldProps, message) { | ||
return function (ComposedComponent) { | ||
@@ -36,10 +61,20 @@ const displayName = getDisplayName(ComposedComponent) | ||
constructor (props, context) { | ||
checkProps(version, props, oldProps) | ||
componentDidMount () { | ||
if (oldProps) { | ||
warnDeprecatedProps(displayName, version, this.props, oldProps, message) | ||
} else { | ||
warnDeprecatedComponent(version, displayName, message) | ||
} | ||
super(props, context) | ||
if (super.componentDidMount) { | ||
super.componentDidMount() | ||
} | ||
} | ||
componentWillReceiveProps (nextProps) { | ||
checkProps(version, nextProps, oldProps) | ||
if (oldProps) { | ||
warnDeprecatedProps(displayName, version, nextProps, oldProps, message) | ||
} else { | ||
warnDeprecatedComponent(version, displayName, message) | ||
} | ||
@@ -56,3 +91,3 @@ if (super.componentWillReceiveProps) { | ||
function checkProps (version, props, oldProps) { | ||
function warnDeprecatedProps (displayName, version, props, oldProps, message) { | ||
Object.keys(oldProps).forEach((oldProp) => { | ||
@@ -66,4 +101,4 @@ if (typeof props[oldProp] !== 'undefined') { | ||
false, | ||
'%s was deprecated in %s%s', | ||
oldProp, version, (newProp ? ` use ${newProp} instead` : '') | ||
'[%s] `%s` was deprecated in %s%s. %s', | ||
displayName, oldProp, version, (newProp ? `. Use \`${newProp}\` instead` : ''), message || '' | ||
) | ||
@@ -73,1 +108,9 @@ } | ||
} | ||
function warnDeprecatedComponent (version, displayName, message) { | ||
warning(false, '[%s] was deprecated in version %s. %s', displayName, version, message || '') | ||
} | ||
export function changedPackageWarning (prevPackage, newPackage) { | ||
return `It has been moved from @instructure/${prevPackage} to @instructure/${newPackage}.` | ||
} |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import React, { Children } from 'react' | ||
@@ -2,0 +26,0 @@ import safeCloneElement from './safeCloneElement' |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import warning from '../warning' | ||
@@ -2,0 +26,0 @@ |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -2,0 +26,0 @@ * --- |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/* list utils in alphabetical order */ | ||
@@ -10,4 +34,4 @@ export ComponentIdentifier from './ComponentIdentifier' | ||
export matchComponentTypes from './matchComponentTypes' | ||
export passthroughProps from './passthroughProps' | ||
export { omitProps, pickProps } from './passthroughProps' | ||
export safeCloneElement from './safeCloneElement' | ||
export windowMessageListener from './windowMessageListener' |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import getDisplayName from './getDisplayName' | ||
@@ -2,0 +26,0 @@ |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import omit from 'object.omit' | ||
@@ -2,0 +26,0 @@ import pick from 'object.pick' |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import React from 'react' | ||
@@ -2,0 +26,0 @@ import warning from '../warning' |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import getDisplayName from './getDisplayName' | ||
@@ -2,0 +26,0 @@ import ownerWindow from '../dom/ownerWindow' |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
// https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/core/shallowEqual.js | ||
@@ -2,0 +26,0 @@ const hasOwnProperty = Object.prototype.hasOwnProperty |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
import shortid from 'shortid' | ||
@@ -2,0 +26,0 @@ |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -2,0 +26,0 @@ * --- |
@@ -0,1 +1,25 @@ | ||
/* | ||
* The MIT License (MIT) | ||
* | ||
* Copyright (c) 2015 - present Instructure, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in all | ||
* copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
/** | ||
@@ -2,0 +26,0 @@ * --- |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
592804
12
173
11617
1
+ Added@instructure/ui-i18n@4.7.1-dev.1(transitive)
+ Addeddecimal.js@9.0.1(transitive)
- Removedmoment@^2.10.6
- Removedmoment-timezone@^0.5.14
- Removednumeral@^2.0.6
- Removeddecimal.js@7.5.1(transitive)
Updatedbowser@^1.9.1
Updateddecimal.js@^9.0.1