code
stringlengths 24
2.07M
| docstring
stringlengths 25
85.3k
| func_name
stringlengths 1
92
| language
stringclasses 1
value | repo
stringlengths 5
64
| path
stringlengths 4
172
| url
stringlengths 44
218
| license
stringclasses 7
values |
---|---|---|---|---|---|---|---|
findOwnerStack = function (instance) {
if (!instance) {
return [];
}
var stack = [];
do {
stack.push(instance);
} while (instance = instance._currentElement._owner);
stack.reverse();
return stack;
} | Given a ReactCompositeComponent instance, return a list of its recursive
owners, starting at the root and ending with the instance itself. | findOwnerStack | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function getLowestCommonAncestor(instA, instB) {
!('_hostNode' in instA) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
!('_hostNode' in instB) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNodeFromInstance: Invalid argument.') : _prodInvariant('33') : void 0;
var depthA = 0;
for (var tempA = instA; tempA; tempA = tempA._hostParent) {
depthA++;
}
var depthB = 0;
for (var tempB = instB; tempB; tempB = tempB._hostParent) {
depthB++;
}
// If A is deeper, crawl up.
while (depthA - depthB > 0) {
instA = instA._hostParent;
depthA--;
}
// If B is deeper, crawl up.
while (depthB - depthA > 0) {
instB = instB._hostParent;
depthB--;
}
// Walk in lockstep until we find a match.
var depth = depthA;
while (depth--) {
if (instA === instB) {
return instA;
}
instA = instA._hostParent;
instB = instB._hostParent;
}
return null;
} | Return if A is an ancestor of B. | getLowestCommonAncestor | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function isAncestor(instA, instB) {
!('_hostNode' in instA) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0;
!('_hostNode' in instB) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'isAncestor: Invalid argument.') : _prodInvariant('35') : void 0;
while (instB) {
if (instB === instA) {
return true;
}
instB = instB._hostParent;
}
return false;
} | Simulates the traversal of a two-phase, capture/bubble event dispatch. | isAncestor | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function getParentInstance(inst) {
!('_hostNode' in inst) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getParentInstance: Invalid argument.') : _prodInvariant('36') : void 0;
return inst._hostParent;
} | Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
should would receive a `mouseEnter` or `mouseLeave` event.
Does not invoke the callback on the nearest common ancestor because nothing
"entered" or "left" that element. | getParentInstance | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function traverseTwoPhase(inst, fn, arg) {
var path = [];
while (inst) {
path.push(inst);
inst = inst._hostParent;
}
var i;
for (i = path.length; i-- > 0;) {
fn(path[i], 'captured', arg);
}
for (i = 0; i < path.length; i++) {
fn(path[i], 'bubbled', arg);
}
} | Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
should would receive a `mouseEnter` or `mouseLeave` event.
Does not invoke the callback on the nearest common ancestor because nothing
"entered" or "left" that element. | traverseTwoPhase | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
ReactDOMTextComponent = function (text) {
// TODO: This is really a ReactText (ReactNode), not a ReactElement
this._currentElement = text;
this._stringText = '' + text;
// ReactDOMComponentTree uses these:
this._hostNode = null;
this._hostParent = null;
// Properties
this._domID = 0;
this._mountIndex = 0;
this._closingComment = null;
this._commentNodes = null;
} | Creates the markup for this text node. This node is not intended to have
any features besides containing text content.
@param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
@return {string} Markup for this text node.
@internal | ReactDOMTextComponent | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function findParent(inst) {
// TODO: It may be a good idea to cache this to prevent unnecessary DOM
// traversal, but caching is difficult to do correctly without using a
// mutation observer to listen for all DOM changes.
while (inst._hostParent) {
inst = inst._hostParent;
}
var rootNode = ReactDOMComponentTree.getNodeFromInstance(inst);
var container = rootNode.parentNode;
return ReactDOMComponentTree.getClosestInstanceFromNode(container);
} | Find the deepest React component completely containing the root of the
passed-in instance (for use when entire React trees are nested within each
other). If React trees are not nested, returns null. | findParent | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
this.topLevelType = topLevelType;
this.nativeEvent = nativeEvent;
this.ancestors = [];
} | Find the deepest React component completely containing the root of the
passed-in instance (for use when entire React trees are nested within each
other). If React trees are not nested, returns null. | TopLevelCallbackBookKeeping | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function handleTopLevelImpl(bookKeeping) {
var nativeEventTarget = getEventTarget(bookKeeping.nativeEvent);
var targetInst = ReactDOMComponentTree.getClosestInstanceFromNode(nativeEventTarget);
// Loop through the hierarchy, in case there's any nested components.
// It's important that we build the array of ancestors before calling any
// event handlers, because event handlers can modify the DOM, leading to
// inconsistencies with ReactMount's node cache. See #1105.
var ancestor = targetInst;
do {
bookKeeping.ancestors.push(ancestor);
ancestor = ancestor && findParent(ancestor);
} while (ancestor);
for (var i = 0; i < bookKeeping.ancestors.length; i++) {
targetInst = bookKeeping.ancestors[i];
ReactEventListener._handleTopLevel(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
}
} | Find the deepest React component completely containing the root of the
passed-in instance (for use when entire React trees are nested within each
other). If React trees are not nested, returns null. | handleTopLevelImpl | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function scrollValueMonitor(cb) {
var scrollPosition = getUnboundedScrollPosition(window);
cb(scrollPosition);
} | Traps top-level events by using event bubbling.
@param {string} topLevelType Record from `EventConstants`.
@param {string} handlerBaseName Event name (e.g. "click").
@param {object} element Element on which to attach listener.
@return {?object} An object with a remove function which will forcefully
remove the listener.
@internal | scrollValueMonitor | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function ReactReconcileTransaction(useCreateElement) {
this.reinitializeTransaction();
// Only server-side rendering really needs this option (see
// `ReactServerRendering`), but server-side uses
// `ReactServerRenderingTransaction` instead. This option is here so that it's
// accessible and defaults to false when `ReactDOMComponent` and
// `ReactDOMTextComponent` checks it in `mountComponent`.`
this.renderToStaticMarkup = false;
this.reactMountReady = CallbackQueue.getPooled(null);
this.useCreateElement = useCreateElement;
} | @return {object} The queue to collect React async events. | ReactReconcileTransaction | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function isInDocument(node) {
return containsNode(document.documentElement, node);
} | @restoreSelection: If any selection information was potentially lost,
restore it. This is useful when performing operations that could remove dom
nodes and place them back in, resulting in focus being lost. | isInDocument | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function setIEOffsets(node, offsets) {
var range = document.selection.createRange().duplicate();
var start, end;
if (offsets.end === undefined) {
start = offsets.start;
end = start;
} else if (offsets.start > offsets.end) {
start = offsets.end;
end = offsets.start;
} else {
start = offsets.start;
end = offsets.end;
}
range.moveToElementText(node);
range.moveStart('character', start);
range.setEndPoint('EndToStart', range);
range.moveEnd('character', end - start);
range.select();
} | In modern non-IE browsers, we can support both forward and backward
selections.
Note: IE10+ supports the Selection object, but it does not support
the `extend` method, which means that even in modern IE, it's not possible
to programmatically create a backward selection. Thus, for all IE
versions, we use the old IE API to create our selections.
@param {DOMElement|DOMTextNode} node
@param {object} offsets | setIEOffsets | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function setModernOffsets(node, offsets) {
if (!window.getSelection) {
return;
}
var selection = window.getSelection();
var length = node[getTextContentAccessor()].length;
var start = Math.min(offsets.start, length);
var end = offsets.end === undefined ? start : Math.min(offsets.end, length);
// IE 11 uses modern selection, but doesn't support the extend method.
// Flip backward selections, so we can set with a single range.
if (!selection.extend && start > end) {
var temp = end;
end = start;
start = temp;
}
var startMarker = getNodeForCharacterOffset(node, start);
var endMarker = getNodeForCharacterOffset(node, end);
if (startMarker && endMarker) {
var range = document.createRange();
range.setStart(startMarker.node, startMarker.offset);
selection.removeAllRanges();
if (start > end) {
selection.addRange(range);
selection.extend(endMarker.node, endMarker.offset);
} else {
range.setEnd(endMarker.node, endMarker.offset);
selection.addRange(range);
}
}
} | In modern non-IE browsers, we can support both forward and backward
selections.
Note: IE10+ supports the Selection object, but it does not support
the `extend` method, which means that even in modern IE, it's not possible
to programmatically create a backward selection. Thus, for all IE
versions, we use the old IE API to create our selections.
@param {DOMElement|DOMTextNode} node
@param {object} offsets | setModernOffsets | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function getNodeForCharacterOffset(root, offset) {
var node = getLeafNode(root);
var nodeStart = 0;
var nodeEnd = 0;
while (node) {
if (node.nodeType === 3) {
nodeEnd = nodeStart + node.textContent.length;
if (nodeStart <= offset && nodeEnd >= offset) {
return {
node: node,
offset: offset - nodeStart
};
}
nodeStart = nodeEnd;
}
node = getLeafNode(getSiblingNode(node));
}
} | Checks if a given DOM node contains or is another DOM node. | getNodeForCharacterOffset | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function containsNode(outerNode, innerNode) {
if (!outerNode || !innerNode) {
return false;
} else if (outerNode === innerNode) {
return true;
} else if (isTextNode(outerNode)) {
return false;
} else if (isTextNode(innerNode)) {
return containsNode(outerNode, innerNode.parentNode);
} else if ('contains' in outerNode) {
return outerNode.contains(innerNode);
} else if (outerNode.compareDocumentPosition) {
return !!(outerNode.compareDocumentPosition(innerNode) & 16);
} else {
return false;
}
} | @param {*} object The object to check.
@return {boolean} Whether or not the object is a DOM text node. | containsNode | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function getSelection(node) {
if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
return {
start: node.selectionStart,
end: node.selectionEnd
};
} else if (window.getSelection) {
var selection = window.getSelection();
return {
anchorNode: selection.anchorNode,
anchorOffset: selection.anchorOffset,
focusNode: selection.focusNode,
focusOffset: selection.focusOffset
};
} else if (document.selection) {
var range = document.selection.createRange();
return {
parentElement: range.parentElement(),
text: range.text,
top: range.boundingTop,
left: range.boundingLeft
};
}
} | Poll selection to see whether it's changed.
@param {object} nativeEvent
@return {?SyntheticEvent} | getSelection | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function constructSelectEvent(nativeEvent, nativeEventTarget) {
// Ensure we have the right element, and that the user is not dragging a
// selection (this matches native `select` event behavior). In HTML5, select
// fires only on input and textarea thus if there's no focused element we
// won't dispatch.
if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {
return null;
}
// Only fire when selection has actually changed.
var currentSelection = getSelection(activeElement);
if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
lastSelection = currentSelection;
var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementInst, nativeEvent, nativeEventTarget);
syntheticEvent.type = 'select';
syntheticEvent.target = activeElement;
EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
return syntheticEvent;
}
return null;
} | Poll selection to see whether it's changed.
@param {object} nativeEvent
@return {?SyntheticEvent} | constructSelectEvent | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function getDictionaryKey(inst) {
// Prevents V8 performance issue:
// https://github.com/facebook/react/pull/7232
return '.' + inst._rootNodeID;
} | Turns
['abort', ...]
into
eventTypes = {
'abort': {
phasedRegistrationNames: {
bubbled: 'onAbort',
captured: 'onAbortCapture',
},
dependencies: ['topAbort'],
},
...
};
topLevelEventsToDispatchConfig = {
'topAbort': { sameConfig }
}; | getDictionaryKey | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function isInteractive(tag) {
return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
} | Turns
['abort', ...]
into
eventTypes = {
'abort': {
phasedRegistrationNames: {
bubbled: 'onAbort',
captured: 'onAbortCapture',
},
dependencies: ['topAbort'],
},
...
};
topLevelEventsToDispatchConfig = {
'topAbort': { sameConfig }
}; | isInteractive | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function SyntheticAnimationEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
} | @interface Event
@see http://www.w3.org/TR/clipboard-apis/ | SyntheticAnimationEvent | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
} | @param {object} dispatchConfig Configuration used to dispatch this event.
@param {string} dispatchMarker Marker identifying the event target.
@param {object} nativeEvent Native browser event.
@extends {SyntheticUIEvent} | SyntheticClipboardEvent | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
} | @interface KeyboardEvent
@see http://www.w3.org/TR/DOM-Level-3-Events/ | SyntheticFocusEvent | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
return SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
} | `charCode` represents the actual "character code" and is safe to use with
`String.fromCharCode`. As such, only keys that correspond to printable
characters produce a valid `charCode`, the only exception to this is Enter.
The Tab-key is considered non-printable and does not have a `charCode`,
presumably because it does not produce a tab-character in browsers.
@param {object} nativeEvent Native browser event.
@return {number} Normalized `charCode` property. | SyntheticKeyboardEvent | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
return SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
} | @interface TouchEvent
@see http://www.w3.org/TR/touch-events/ | SyntheticDragEvent | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function SyntheticTransitionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
return SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
} | @interface WheelEvent
@see http://www.w3.org/TR/DOM-Level-3-Events/ | SyntheticTransitionEvent | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function firstDifferenceIndex(string1, string2) {
var minLen = Math.min(string1.length, string2.length);
for (var i = 0; i < minLen; i++) {
if (string1.charAt(i) !== string2.charAt(i)) {
return i;
}
}
return string1.length === string2.length ? -1 : minLen;
} | @param {DOMElement|DOMDocument} container DOM element that may contain
a React component
@return {?*} DOM element that may have the reactRoot ID, or null. | firstDifferenceIndex | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function getReactRootElementInContainer(container) {
if (!container) {
return null;
}
if (container.nodeType === DOC_NODE_TYPE) {
return container.documentElement;
} else {
return container.firstChild;
}
} | Mounts this component and inserts it into the DOM.
@param {ReactComponent} componentInstance The instance to mount.
@param {DOMElement} container DOM element to mount into.
@param {ReactReconcileTransaction} transaction
@param {boolean} shouldReuseMarkup If true, do not insert markup | getReactRootElementInContainer | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function internalGetID(node) {
// If node is something like a window, document, or text node, none of
// which support attributes or a .getAttribute method, gracefully return
// the empty string, as if the attribute were missing.
return node.getAttribute && node.getAttribute(ATTR_NAME) || '';
} | Mounts this component and inserts it into the DOM.
@param {ReactComponent} componentInstance The instance to mount.
@param {DOMElement} container DOM element to mount into.
@param {ReactReconcileTransaction} transaction
@param {boolean} shouldReuseMarkup If true, do not insert markup | internalGetID | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function mountComponentIntoNode(wrapperInstance, container, transaction, shouldReuseMarkup, context) {
var markerName;
if (ReactFeatureFlags.logTopLevelRenders) {
var wrappedElement = wrapperInstance._currentElement.props.child;
var type = wrappedElement.type;
markerName = 'React mount: ' + (typeof type === 'string' ? type : type.displayName || type.name);
console.time(markerName);
}
var markup = ReactReconciler.mountComponent(wrapperInstance, transaction, null, ReactDOMContainerInfo(wrapperInstance, container), context, 0 /* parentDebugID */
);
if (markerName) {
console.timeEnd(markerName);
}
wrapperInstance._renderedComponent._topLevelWrapper = wrapperInstance;
ReactMount._mountImageIntoNode(markup, container, wrapperInstance, shouldReuseMarkup, transaction);
} | Batched mount.
@param {ReactComponent} componentInstance The instance to mount.
@param {DOMElement} container DOM element to mount into.
@param {boolean} shouldReuseMarkup If true, do not insert markup | mountComponentIntoNode | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function batchedMountComponentIntoNode(componentInstance, container, shouldReuseMarkup, context) {
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(
/* useCreateElement */
!shouldReuseMarkup && ReactDOMFeatureFlags.useCreateElement);
transaction.perform(mountComponentIntoNode, null, componentInstance, container, transaction, shouldReuseMarkup, context);
ReactUpdates.ReactReconcileTransaction.release(transaction);
} | Unmounts a component and removes it from the DOM.
@param {ReactComponent} instance React component instance.
@param {DOMElement} container DOM element to unmount from.
@final
@internal
@see {ReactMount.unmountComponentAtNode} | batchedMountComponentIntoNode | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function unmountComponentFromNode(instance, container, safely) {
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onBeginFlush();
}
ReactReconciler.unmountComponent(instance, safely);
if (process.env.NODE_ENV !== 'production') {
ReactInstrumentation.debugTool.onEndFlush();
}
if (container.nodeType === DOC_NODE_TYPE) {
container = container.documentElement;
}
// http://jsperf.com/emptying-a-node
while (container.lastChild) {
container.removeChild(container.lastChild);
}
} | True if the supplied DOM node has a direct React-rendered child that is
not a React root element. Useful for warning in `render`,
`unmountComponentAtNode`, etc.
@param {?DOMElement} node The candidate DOM node.
@return {boolean} True if the DOM element contains a direct child that was
rendered by React but is not a root element.
@internal | unmountComponentFromNode | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function hasNonRootReactChild(container) {
var rootEl = getReactRootElementInContainer(container);
if (rootEl) {
var inst = ReactDOMComponentTree.getInstanceFromNode(rootEl);
return !!(inst && inst._hostParent);
}
} | True if the supplied DOM node is a valid node element.
@param {?DOMElement} node The candidate DOM node.
@return {boolean} True if the DOM is a valid DOM node.
@internal | hasNonRootReactChild | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function nodeIsRenderedByOtherInstance(container) {
var rootEl = getReactRootElementInContainer(container);
return !!(rootEl && isReactNode(rootEl) && !ReactDOMComponentTree.getInstanceFromNode(rootEl));
} | True if the supplied DOM node is a valid React node element.
@param {?DOMElement} node The candidate DOM node.
@return {boolean} True if the DOM is a valid React DOM node.
@internal | nodeIsRenderedByOtherInstance | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function isValidContainer(node) {
return !!(node && (node.nodeType === ELEMENT_NODE_TYPE || node.nodeType === DOC_NODE_TYPE || node.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE));
} | Temporary (?) hack so that we can store all top-level pending updates on
composites instead of having to worry about different types of components
here. | isValidContainer | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function isReactNode(node) {
return isValidContainer(node) && (node.hasAttribute(ROOT_ATTR_NAME) || node.hasAttribute(ATTR_NAME));
} | Temporary (?) hack so that we can store all top-level pending updates on
composites instead of having to worry about different types of components
here. | isReactNode | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function getHostRootInstanceInContainer(container) {
var rootEl = getReactRootElementInContainer(container);
var prevHostInstance = rootEl && ReactDOMComponentTree.getInstanceFromNode(rootEl);
return prevHostInstance && !prevHostInstance._hostParent ? prevHostInstance : null;
} | Temporary (?) hack so that we can store all top-level pending updates on
composites instead of having to worry about different types of components
here. | getHostRootInstanceInContainer | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function getTopLevelWrapperInContainer(container) {
var root = getHostRootInstanceInContainer(container);
return root ? root._hostContainerInfo._topLevelWrapper : null;
} | Temporary (?) hack so that we can store all top-level pending updates on
composites instead of having to worry about different types of components
here. | getTopLevelWrapperInContainer | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
TopLevelWrapper = function () {
this.rootID = topLevelRootCounter++;
} | Used by devtools. The keys are not important. | TopLevelWrapper | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function findDOMNode(componentOrElement) {
if (process.env.NODE_ENV !== 'production') {
var owner = ReactCurrentOwner.current;
if (owner !== null) {
process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : void 0;
owner._warnedAboutRefsInRender = true;
}
}
if (componentOrElement == null) {
return null;
}
if (componentOrElement.nodeType === 1) {
return componentOrElement;
}
var inst = ReactInstanceMap.get(componentOrElement);
if (inst) {
inst = getHostComponentFromComposite(inst);
return inst ? ReactDOMComponentTree.getNodeFromInstance(inst) : null;
}
if (typeof componentOrElement.render === 'function') {
true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : _prodInvariant('44') : void 0;
} else {
true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : _prodInvariant('45', Object.keys(componentOrElement)) : void 0;
}
} | Returns the DOM node rendered by this element.
See https://facebook.github.io/react/docs/top-level-api.html#reactdom.finddomnode
@param {ReactComponent|DOMElement} componentOrElement
@return {?DOMElement} The root node of this element. | findDOMNode | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function getBsProps(props) {
return {
bsClass: props.bsClass,
bsSize: props.bsSize,
bsStyle: props.bsStyle,
bsRole: props.bsRole
};
} | Add a style variant to a Component. Mutates the propTypes of the component
in order to validate the new variant. | getBsProps | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function isBsProp(propName) {
return propName === 'bsClass' || propName === 'bsSize' || propName === 'bsStyle' || propName === 'bsRole';
} | Add a style variant to a Component. Mutates the propTypes of the component
in order to validate the new variant. | isBsProp | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function splitBsProps(props) {
var elementProps = {};
(0, _entries2['default'])(props).forEach(function (_ref) {
var propName = _ref[0],
propValue = _ref[1];
if (!isBsProp(propName)) {
elementProps[propName] = propValue;
}
});
return [getBsProps(props), elementProps];
} | Add a style variant to a Component. Mutates the propTypes of the component
in order to validate the new variant. | splitBsProps | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function map(children, func, context) {
var index = 0;
return _react2['default'].Children.map(children, function (child) {
if (!_react2['default'].isValidElement(child)) {
return child;
}
return func.call(context, child, index++);
});
} | Count the number of "valid components" in the Children container.
@param {?*} children Children tree container.
@returns {number} | map | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function forEach(children, func, context) {
var index = 0;
_react2['default'].Children.forEach(children, function (child) {
if (!_react2['default'].isValidElement(child)) {
return;
}
func.call(context, child, index++);
});
} | Finds children that are typically specified as `props.children`,
but only iterates over children that are "valid components".
The provided forEachFunc(child, index) will be called for each
leaf child with the index reflecting the position relative to "valid components".
@param {?*} children Children tree container.
@param {function(*, int)} func.
@param {*} context Context for func.
@returns {array} of children that meet the func return statement | forEach | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function count(children) {
var result = 0;
_react2['default'].Children.forEach(children, function (child) {
if (!_react2['default'].isValidElement(child)) {
return;
}
++result;
});
return result;
} | Finds children that are typically specified as `props.children`,
but only iterates over children that are "valid components".
The provided forEachFunc(child, index) will be called for each
leaf child with the index reflecting the position relative to "valid components".
@param {?*} children Children tree container.
@param {function(*, int)} func.
@param {*} context Context for func.
@returns {array} of children that meet the func return statement | count | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function filter(children, func, context) {
var index = 0;
var result = [];
_react2['default'].Children.forEach(children, function (child) {
if (!_react2['default'].isValidElement(child)) {
return;
}
if (func.call(context, child, index++)) {
result.push(child);
}
});
return result;
} | Finds children that are typically specified as `props.children`,
but only iterates over children that are "valid components".
The provided forEachFunc(child, index) will be called for each
leaf child with the index reflecting the position relative to "valid components".
@param {?*} children Children tree container.
@param {function(*, int)} func.
@param {*} context Context for func.
@returns {array} of children that meet the func return statement | filter | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function find(children, func, context) {
var index = 0;
var result = undefined;
_react2['default'].Children.forEach(children, function (child) {
if (result) {
return;
}
if (!_react2['default'].isValidElement(child)) {
return;
}
if (func.call(context, child, index++)) {
result = child;
}
});
return result;
} | Finds children that are typically specified as `props.children`,
but only iterates over children that are "valid components".
The provided forEachFunc(child, index) will be called for each
leaf child with the index reflecting the position relative to "valid components".
@param {?*} children Children tree container.
@param {function(*, int)} func.
@param {*} context Context for func.
@returns {array} of children that meet the func return statement | find | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function isTrivialHref(href) {
return !href || href.trim() === '#';
} | There are situations due to browser quirks or Bootstrap CSS where
an anchor tag is needed, when semantically a button tag is the
better choice. SafeAnchor ensures that when an anchor is used like a
button its accessible. It also emulates input `disabled` behavior for
links, which is usually desirable for Buttons, NavItems, MenuItems, etc. | isTrivialHref | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function SafeAnchor(props, context) {
(0, _classCallCheck3['default'])(this, SafeAnchor);
var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props, context));
_this.handleClick = _this.handleClick.bind(_this);
return _this;
} | There are situations due to browser quirks or Bootstrap CSS where
an anchor tag is needed, when semantically a button tag is the
better choice. SafeAnchor ensures that when an anchor is used like a
button its accessible. It also emulates input `disabled` behavior for
links, which is usually desirable for Buttons, NavItems, MenuItems, etc. | SafeAnchor | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function Button() {
(0, _classCallCheck3['default'])(this, Button);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
} | Defines HTML button type attribute
@defaultValue 'button' | Button | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function ButtonGroup() {
(0, _classCallCheck3['default'])(this, ButtonGroup);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
} | Display block buttons; only useful when used with the "vertical" prop.
@type {bool} | ButtonGroup | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function Carousel(props, context) {
(0, _classCallCheck3['default'])(this, Carousel);
var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props, context));
_this.handleMouseOver = _this.handleMouseOver.bind(_this);
_this.handleMouseOut = _this.handleMouseOut.bind(_this);
_this.handlePrev = _this.handlePrev.bind(_this);
_this.handleNext = _this.handleNext.bind(_this);
_this.handleItemAnimateOutEnd = _this.handleItemAnimateOutEnd.bind(_this);
var defaultActiveIndex = props.defaultActiveIndex;
_this.state = {
activeIndex: defaultActiveIndex != null ? defaultActiveIndex : 0,
previousActiveIndex: null,
direction: null
};
_this.isUnmounted = false;
return _this;
} | Label shown to screen readers only, can be used to show the next element
in the carousel.
Set to null to deactivate. | Carousel | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function detectEvents() {
var testEl = document.createElement('div');
var style = testEl.style;
// On some platforms, in particular some releases of Android 4.x,
// the un-prefixed "animation" and "transition" properties are defined on the
// style object but the events that fire will still be prefixed, so we need
// to check if the un-prefixed events are useable, and if not remove them
// from the map
if (!('AnimationEvent' in window)) {
delete EVENT_NAME_MAP.animationend.animation;
}
if (!('TransitionEvent' in window)) {
delete EVENT_NAME_MAP.transitionend.transition;
}
for (var baseEventName in EVENT_NAME_MAP) {
// eslint-disable-line guard-for-in
var baseEvents = EVENT_NAME_MAP[baseEventName];
for (var styleName in baseEvents) {
if (styleName in style) {
endEvents.push(baseEvents[styleName]);
break;
}
}
}
} | EVENT_NAME_MAP is used to determine which event fired when a
transition/animation ends, based on the style property used to
define that event. | detectEvents | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function Checkbox() {
(0, _classCallCheck3['default'])(this, Checkbox);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
} | Attaches a ref to the `<input>` element. Only functions can be used here.
```js
<Checkbox inputRef={ref => { this.input = ref; }} />
``` | Checkbox | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function Clearfix() {
(0, _classCallCheck3['default'])(this, Clearfix);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
} | Apply clearfix
on Large devices Desktops
adds class `visible-lg-block` | Clearfix | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function ControlLabel() {
(0, _classCallCheck3['default'])(this, ControlLabel);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
} | Uses `controlId` from `<FormGroup>` if not explicitly specified. | ControlLabel | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function Col() {
(0, _classCallCheck3['default'])(this, Col);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
} | Change the order of grid columns to the left
for Large devices Desktops
class-prefix `col-lg-pull-` | Col | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function triggerBrowserReflow(node) {
node.offsetHeight; // eslint-disable-line no-unused-expressions
} | Callback fired before the component expands | triggerBrowserReflow | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function getDimensionValue(dimension, elem) {
var value = elem['offset' + (0, _capitalize2['default'])(dimension)];
var margins = MARGINS[dimension];
return value + parseInt((0, _style2['default'])(elem, margins[0]), 10) + parseInt((0, _style2['default'])(elem, margins[1]), 10);
} | Callback fired after the component starts to expand | getDimensionValue | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function Transition(props, context) {
_classCallCheck(this, Transition);
var _this = _possibleConstructorReturn(this, (Transition.__proto__ || Object.getPrototypeOf(Transition)).call(this, props, context));
var initialStatus = void 0;
if (props.in) {
// Start enter transition in componentDidMount.
initialStatus = props.transitionAppear ? EXITED : ENTERED;
} else {
initialStatus = props.unmountOnExit ? UNMOUNTED : EXITED;
}
_this.state = { status: initialStatus };
_this.nextCallback = null;
return _this;
} | The Transition component lets you define and run css transitions with a simple declarative api.
It works similar to React's own [CSSTransitionGroup](http://facebook.github.io/react/docs/animation.html#high-level-api-reactcsstransitiongroup)
but is specifically optimized for transitioning a single child "in" or "out".
You don't even need to use class based css transitions if you don't want to (but it is easiest).
The extensive set of lifecyle callbacks means you have control over
the transitioning now at each step of the way. | Transition | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function ownerDocument(node) {
return node && node.ownerDocument || document;
} | Conenience method returns corresponding value for given keyName or keyCode.
@param {Mixed} keyCode {Number} or keyName {String}
@return {Mixed}
@api public | ownerDocument | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function FormControl() {
(0, _classCallCheck3['default'])(this, FormControl);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
} | Attaches a ref to the `<input>` element. Only functions can be used here.
```js
<FormControl inputRef={ref => { this.input = ref; }} />
``` | FormControl | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function FormGroup() {
(0, _classCallCheck3['default'])(this, FormGroup);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
} | Sets `id` on `<FormControl>` and `htmlFor` on `<FormGroup.Label>`. | FormGroup | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function getDefaultComponent(children) {
if (!children) {
// FIXME: This is the old behavior. Is this right?
return 'div';
}
if (_ValidComponentChildren2['default'].some(children, function (child) {
return child.type !== _ListGroupItem2['default'] || child.props.href || child.props.onClick;
})) {
return 'div';
}
return 'ul';
} | You can use a custom element type for this component.
If not specified, it will be treated as `'li'` if every child is a
non-actionable `<ListGroupItem>`, and `'div'` otherwise. | getDefaultComponent | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function ListGroup() {
(0, _classCallCheck3['default'])(this, ListGroup);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
} | You can use a custom element type for this component.
If not specified, it will be treated as `'li'` if every child is a
non-actionable `<ListGroupItem>`, and `'div'` otherwise. | ListGroup | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function MenuItem(props, context) {
(0, _classCallCheck3['default'])(this, MenuItem);
var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props, context));
_this.handleClick = _this.handleClick.bind(_this);
return _this;
} | Callback fired when the menu item is selected.
```js
(eventKey: any, event: Object) => any
``` | MenuItem | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
backdropRef = function backdropRef(ref) {
return _this.backdrop = ref;
} | A ModalManager instance used to track and manage the state of open
Modals. Useful when customizing how modals interact within a container | backdropRef | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function findIndexOf(arr, cb) {
var idx = -1;
arr.some(function (d, i) {
if (cb(d, i)) {
idx = i;
return true;
}
});
return idx;
} | Proper state managment for containers and the modals in those containers.
@internal Used by the Modal to ensure proper styling of containers. | findIndexOf | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function findContainer(data, modal) {
return findIndexOf(data, function (d) {
return d.modals.indexOf(modal) !== -1;
});
} | Proper state managment for containers and the modals in those containers.
@internal Used by the Modal to ensure proper styling of containers. | findContainer | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function setContainerStyle(state, container) {
var style = { overflow: 'hidden' };
// we are only interested in the actual `style` here
// becasue we will override it
state.style = {
overflow: container.style.overflow,
paddingRight: container.style.paddingRight
};
if (state.overflowing) {
// use computed style, here to get the real padding
// to add our scrollbar width
style.paddingRight = parseInt((0, _style2.default)(container, 'paddingRight') || 0, 10) + (0, _scrollbarSize2.default)() + 'px';
}
(0, _style2.default)(container, style);
} | Proper state managment for containers and the modals in those containers.
@internal Used by the Modal to ensure proper styling of containers. | setContainerStyle | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function removeContainerStyle(_ref, container) {
var style = _ref.style;
Object.keys(style).forEach(function (key) {
return container.style[key] = style[key];
});
} | Proper state managment for containers and the modals in those containers.
@internal Used by the Modal to ensure proper styling of containers. | removeContainerStyle | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function ModalManager() {
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var _ref2$hideSiblingNode = _ref2.hideSiblingNodes;
var hideSiblingNodes = _ref2$hideSiblingNode === undefined ? true : _ref2$hideSiblingNode;
var _ref2$handleContainer = _ref2.handleContainerOverflow;
var handleContainerOverflow = _ref2$handleContainer === undefined ? true : _ref2$handleContainer;
_classCallCheck(this, ModalManager);
this.hideSiblingNodes = hideSiblingNodes;
this.handleContainerOverflow = handleContainerOverflow;
this.modals = [];
this.containers = [];
this.data = [];
} | Proper state managment for containers and the modals in those containers.
@internal Used by the Modal to ensure proper styling of containers. | ModalManager | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
siblings = function siblings(container, mount, cb) {
mount = [].concat(mount);
[].forEach.call(container.children, function (node) {
if (mount.indexOf(node) === -1 && isHidable(node)) {
cb(node);
}
});
} | Firefox doesn't have a focusin event so using capture is easiest way to get bubbling
IE8 can't do addEventListener, but does have onfocusin, so we use that in ie8
We only allow one Listener at a time to avoid stack overflows | siblings | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function ariaHidden(show, node) {
if (!node) {
return;
}
if (show) {
node.setAttribute('aria-hidden', 'true');
} else {
node.removeAttribute('aria-hidden');
}
} | Firefox doesn't have a focusin event so using capture is easiest way to get bubbling
IE8 can't do addEventListener, but does have onfocusin, so we use that in ie8
We only allow one Listener at a time to avoid stack overflows | ariaHidden | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function ModalDialog() {
(0, _classCallCheck3['default'])(this, ModalDialog);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
} | A css class to apply to the Modal dialog DOM node. | ModalDialog | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function ModalHeader() {
(0, _classCallCheck3['default'])(this, ModalHeader);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
} | A Callback fired when the close button is clicked. If used directly inside
a Modal component, the onHide will automatically be propagated up to the
parent Modal `onHide`. | ModalHeader | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function Nav() {
(0, _classCallCheck3['default'])(this, Nav);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
} | Float the Nav to the left. When `navbar` is `true` the appropriate
contextual classes are added as well. | Nav | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function Navbar(props, context) {
(0, _classCallCheck3['default'])(this, Navbar);
var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props, context));
_this.handleToggle = _this.handleToggle.bind(_this);
_this.handleCollapse = _this.handleCollapse.bind(_this);
return _this;
} | Explicitly set the visiblity of the navbar body
@controllable onToggle | Navbar | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function createSimpleWrapper(tag, suffix, displayName) {
var Wrapper = function Wrapper(_ref, _ref2) {
var _ref2$$bs_navbar = _ref2.$bs_navbar,
navbarProps = _ref2$$bs_navbar === undefined ? { bsClass: 'navbar' } : _ref2$$bs_navbar;
var Component = _ref.componentClass,
className = _ref.className,
pullRight = _ref.pullRight,
pullLeft = _ref.pullLeft,
props = (0, _objectWithoutProperties3['default'])(_ref, ['componentClass', 'className', 'pullRight', 'pullLeft']);
return _react2['default'].createElement(Component, (0, _extends4['default'])({}, props, {
className: (0, _classnames2['default'])(className, (0, _bootstrapUtils.prefix)(navbarProps, suffix), pullRight && (0, _bootstrapUtils.prefix)(navbarProps, 'right'), pullLeft && (0, _bootstrapUtils.prefix)(navbarProps, 'left'))
}));
};
Wrapper.displayName = displayName;
Wrapper.propTypes = {
componentClass: _elementType2['default'],
pullRight: _react2['default'].PropTypes.bool,
pullLeft: _react2['default'].PropTypes.bool
};
Wrapper.defaultProps = {
componentClass: tag,
pullRight: false,
pullLeft: false
};
Wrapper.contextTypes = {
$bs_navbar: _react.PropTypes.shape({
bsClass: _react.PropTypes.string
})
};
return Wrapper;
} | Explicitly set the visiblity of the navbar body
@controllable onToggle | createSimpleWrapper | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
Wrapper = function Wrapper(_ref, _ref2) {
var _ref2$$bs_navbar = _ref2.$bs_navbar,
navbarProps = _ref2$$bs_navbar === undefined ? { bsClass: 'navbar' } : _ref2$$bs_navbar;
var Component = _ref.componentClass,
className = _ref.className,
pullRight = _ref.pullRight,
pullLeft = _ref.pullLeft,
props = (0, _objectWithoutProperties3['default'])(_ref, ['componentClass', 'className', 'pullRight', 'pullLeft']);
return _react2['default'].createElement(Component, (0, _extends4['default'])({}, props, {
className: (0, _classnames2['default'])(className, (0, _bootstrapUtils.prefix)(navbarProps, suffix), pullRight && (0, _bootstrapUtils.prefix)(navbarProps, 'right'), pullLeft && (0, _bootstrapUtils.prefix)(navbarProps, 'left'))
}));
} | Explicitly set the visiblity of the navbar body
@controllable onToggle | Wrapper | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function NavbarToggle() {
(0, _classCallCheck3['default'])(this, NavbarToggle);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
} | The toggle content, if left empty it will render the default toggle (seen above). | NavbarToggle | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function Overlay(props, context) {
_classCallCheck(this, Overlay);
var _this = _possibleConstructorReturn(this, (Overlay.__proto__ || Object.getPrototypeOf(Overlay)).call(this, props, context));
_this.state = { exited: !props.show };
_this.onHiddenListener = _this.handleHidden.bind(_this);
return _this;
} | Built on top of `<Position/>` and `<Portal/>`, the overlay component is great for custom tooltip overlays. | Overlay | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function Position(props, context) {
_classCallCheck(this, Position);
var _this = _possibleConstructorReturn(this, (Position.__proto__ || Object.getPrototypeOf(Position)).call(this, props, context));
_this.state = {
positionLeft: 0,
positionTop: 0,
arrowOffsetLeft: null,
arrowOffsetTop: null
};
_this._needsFlush = false;
_this._lastTarget = null;
return _this;
} | The Position component calculates the coordinates for its child, to position
it relative to a `target` component or node. Useful for creating callouts
and tooltips, the Position component injects a `style` props with `left` and
`top` values for positioning your component.
It also injects "arrow" `left`, and `top` values for styling callout arrows
for giving your components a sense of directionality. | Position | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function isOneOf(one, of) {
if (Array.isArray(of)) {
return of.indexOf(one) >= 0;
}
return one === of;
} | An element or text to overlay next to the target. | isOneOf | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function Pagination() {
(0, _classCallCheck3['default'])(this, Pagination);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
} | You can use a custom element for the buttons | Pagination | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function Radio() {
(0, _classCallCheck3['default'])(this, Radio);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
} | Attaches a ref to the `<input>` element. Only functions can be used here.
```js
<Radio inputRef={ref => { this.input = ref; }} />
``` | Radio | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function TabContainer() {
(0, _classCallCheck3['default'])(this, TabContainer);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
} | The `eventKey` of the currently active tab.
@controllable onSelect | TabContainer | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function TabContent(props, context) {
(0, _classCallCheck3['default'])(this, TabContent);
var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props, context));
_this.handlePaneEnter = _this.handlePaneEnter.bind(_this);
_this.handlePaneExited = _this.handlePaneExited.bind(_this);
// Active entries in state will be `null` unless `animation` is set. Need
// to track active child in case keys swap and the active child changes
// but the active key does not.
_this.state = {
activeKey: null,
activeChild: null
};
return _this;
} | Unmount tabs (remove it from the DOM) when they are no longer visible | TabContent | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function TabPane(props, context) {
(0, _classCallCheck3['default'])(this, TabPane);
var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props, context));
_this.handleEnter = _this.handleEnter.bind(_this);
_this.handleExited = _this.handleExited.bind(_this);
_this['in'] = false;
return _this;
} | We override the `<TabContainer>` context so `<Nav>`s in `<TabPane>`s don't
conflict with the top level one. | TabPane | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function getDefaultActiveKey(children) {
var defaultActiveKey = void 0;
_ValidComponentChildren2['default'].forEach(children, function (child) {
if (defaultActiveKey == null) {
defaultActiveKey = child.props.eventKey;
}
});
return defaultActiveKey;
} | Unmount tabs (remove it from the DOM) when it is no longer visible | getDefaultActiveKey | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function Tabs() {
(0, _classCallCheck3['default'])(this, Tabs);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
} | Unmount tabs (remove it from the DOM) when it is no longer visible | Tabs | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
function Tooltip() {
(0, _classCallCheck3['default'])(this, Tooltip);
return (0, _possibleConstructorReturn3['default'])(this, _React$Component.apply(this, arguments));
} | The "left" position value for the Tooltip arrow. | Tooltip | javascript | stitchfix/pyxley | tests/app/static/bundle.js | https://github.com/stitchfix/pyxley/blob/master/tests/app/static/bundle.js | MIT |
constructor(t) {
this.env = t
} | RegExp:
https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken) | constructor | javascript | Toulu-debug/enen | iOS_Cookie.js | https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js | MIT |
send(t, e = "GET") {
t = "string" == typeof t ? {url: t} : t;
let s = this.get;
return "POST" === e && (s = this.post), new Promise((e, i) => {
s.call(this, t, (t, s, r) => {
t ? i(t) : e(s)
})
})
} | RegExp:
https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken) | send | javascript | Toulu-debug/enen | iOS_Cookie.js | https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js | MIT |
get(t) {
return this.send.call(this.env, t)
} | RegExp:
https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken) | get | javascript | Toulu-debug/enen | iOS_Cookie.js | https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js | MIT |
post(t) {
return this.send.call(this.env, t, "POST")
} | RegExp:
https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken) | post | javascript | Toulu-debug/enen | iOS_Cookie.js | https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js | MIT |
isNode() {
return "undefined" != typeof module && !!module.exports
} | RegExp:
https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken) | isNode | javascript | Toulu-debug/enen | iOS_Cookie.js | https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js | MIT |
isQuanX() {
return "undefined" != typeof $task
} | RegExp:
https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken) | isQuanX | javascript | Toulu-debug/enen | iOS_Cookie.js | https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js | MIT |
isSurge() {
return "undefined" != typeof $httpClient && "undefined" == typeof $loon
} | RegExp:
https:\/\/api\.m\.jd\.com\/client\.action\?functionId=(trade_config|genToken) | isSurge | javascript | Toulu-debug/enen | iOS_Cookie.js | https://github.com/Toulu-debug/enen/blob/master/iOS_Cookie.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.