@noriginmedia/react-spatial-navigation
Advanced tools
Comparing version 2.0.5 to 2.0.6
@@ -437,2 +437,3 @@ 'use strict'; | ||
propagateFocus = _ref2.propagateFocus, | ||
trackChildren = _ref2.trackChildren, | ||
onUpdateFocus = _ref2.onUpdateFocus, | ||
@@ -451,2 +452,3 @@ onUpdateHasFocusedChild = _ref2.onUpdateHasFocusedChild; | ||
forgetLastFocusedChild: forgetLastFocusedChild, | ||
trackChildren: trackChildren, | ||
lastFocusedChildKey: null, | ||
@@ -562,3 +564,3 @@ layout: { | ||
parentComponent && parentComponent.onUpdateHasFocusedChild(false); | ||
parentComponent && parentComponent.trackChildren && parentComponent.onUpdateHasFocusedChild(false); | ||
}); | ||
@@ -569,3 +571,3 @@ | ||
parentComponent && parentComponent.onUpdateHasFocusedChild(true); | ||
parentComponent && parentComponent.trackChildren && parentComponent.onUpdateHasFocusedChild(true); | ||
}); | ||
@@ -617,3 +619,3 @@ | ||
var targetFocusKey = overwriteFocusKey && this.isFocusableComponent(overwriteFocusKey) ? overwriteFocusKey : focusKey; | ||
var targetFocusKey = overwriteFocusKey || focusKey; | ||
@@ -620,0 +622,0 @@ var newFocusKey = this.getNextFocusKey(targetFocusKey); |
@@ -108,7 +108,7 @@ 'use strict'; | ||
}, | ||
onUpdateHasFocusedChild: function onUpdateHasFocusedChild(oldState, props) { | ||
onUpdateHasFocusedChild: function onUpdateHasFocusedChild() { | ||
return function () { | ||
var hasFocusedChild = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; | ||
return { | ||
hasFocusedChild: configTrackChildren || props.trackChildren ? hasFocusedChild : oldState.hasFocusedChild | ||
hasFocusedChild: hasFocusedChild | ||
}; | ||
@@ -166,3 +166,4 @@ }; | ||
onUpdateFocus = _props.onUpdateFocus, | ||
onUpdateHasFocusedChild = _props.onUpdateHasFocusedChild; | ||
onUpdateHasFocusedChild = _props.onUpdateHasFocusedChild, | ||
trackChildren = _props.trackChildren; | ||
@@ -181,3 +182,4 @@ | ||
propagateFocus: configPropagateFocus || propagateFocus, | ||
forgetLastFocusedChild: configForgetLastFocusedChild || forgetLastFocusedChild | ||
forgetLastFocusedChild: configForgetLastFocusedChild || forgetLastFocusedChild, | ||
trackChildren: configTrackChildren || trackChildren | ||
}); | ||
@@ -184,0 +186,0 @@ }, |
{ | ||
"name": "@noriginmedia/react-spatial-navigation", | ||
"version": "2.0.5", | ||
"version": "2.0.6", | ||
"description": "HOC-based Spatial Navigation (key navigation) solution for React", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
# react-spatial-navigation | ||
[![npm version](https://badge.fury.io/js/%40noriginmedia%2Freact-spatial-navigation.svg)](https://badge.fury.io/js/%40noriginmedia%2Freact-spatial-navigation) | ||
## Motivation | ||
@@ -3,0 +5,0 @@ The main motivation to create this package was to bring the best Developer Experience and Performance when working with Key Navigation and React. Ideally you wouldn't want to have any logic to define the navigation in your app. It should be as easy as just to tell which components should be navigable. With this package all you have to do is to initialize it, wrap your components with the HOC and set initial focus. The spatial navigation system will automatically figure out which components to focus next when you navigate with the directional keys. |
@@ -373,2 +373,3 @@ import filter from 'lodash/filter'; | ||
propagateFocus, | ||
trackChildren, | ||
onUpdateFocus, | ||
@@ -387,2 +388,3 @@ onUpdateHasFocusedChild | ||
forgetLastFocusedChild, | ||
trackChildren, | ||
lastFocusedChildKey: null, | ||
@@ -487,3 +489,3 @@ layout: { | ||
parentComponent && parentComponent.onUpdateHasFocusedChild(false); | ||
parentComponent && parentComponent.trackChildren && parentComponent.onUpdateHasFocusedChild(false); | ||
}); | ||
@@ -494,3 +496,3 @@ | ||
parentComponent && parentComponent.onUpdateHasFocusedChild(true); | ||
parentComponent && parentComponent.trackChildren && parentComponent.onUpdateHasFocusedChild(true); | ||
}); | ||
@@ -538,4 +540,3 @@ | ||
const targetFocusKey = overwriteFocusKey && this.isFocusableComponent(overwriteFocusKey) ? | ||
overwriteFocusKey : focusKey; | ||
const targetFocusKey = overwriteFocusKey || focusKey; | ||
@@ -542,0 +543,0 @@ const newFocusKey = this.getNextFocusKey(targetFocusKey); |
@@ -45,4 +45,4 @@ /* eslint-disable react/no-find-dom-node */ | ||
}), | ||
onUpdateHasFocusedChild: (oldState, props) => (hasFocusedChild = false) => ({ | ||
hasFocusedChild: configTrackChildren || props.trackChildren ? hasFocusedChild : oldState.hasFocusedChild | ||
onUpdateHasFocusedChild: () => (hasFocusedChild = false) => ({ | ||
hasFocusedChild | ||
}) | ||
@@ -87,3 +87,4 @@ }), | ||
onUpdateFocus, | ||
onUpdateHasFocusedChild | ||
onUpdateHasFocusedChild, | ||
trackChildren | ||
} = this.props; | ||
@@ -102,3 +103,4 @@ | ||
propagateFocus: (configPropagateFocus || propagateFocus), | ||
forgetLastFocusedChild: (configForgetLastFocusedChild || forgetLastFocusedChild) | ||
forgetLastFocusedChild: (configForgetLastFocusedChild || forgetLastFocusedChild), | ||
trackChildren: (configTrackChildren || trackChildren) | ||
}); | ||
@@ -105,0 +107,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
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
4626676
2249
335