Skip to content

Commit

Permalink
Merge branch 'master' into update-file-loader
Browse files Browse the repository at this point in the history
  • Loading branch information
Hypnosphi authored Nov 6, 2017
2 parents 1609d04 + 69ecd1e commit 1c5a7d1
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 14 deletions.
2 changes: 1 addition & 1 deletion addons/storyshots/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"babel-runtime": "^6.26.0",
"global": "^4.3.2",
"prop-types": "^15.6.0",
"read-pkg-up": "^2.0.0"
"read-pkg-up": "^3.0.0"
},
"devDependencies": {
"@storybook/addons": "^3.2.14",
Expand Down
1 change: 0 additions & 1 deletion app/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@
"postcss-loader": "^2.0.8",
"prop-types": "^15.6.0",
"qs": "^6.5.1",
"react-modal": "^2.4.1",
"redux": "^3.7.2",
"request": "^2.83.0",
"serve-favicon": "^2.4.5",
Expand Down
1 change: 0 additions & 1 deletion app/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
"qs": "^6.5.1",
"react": "^16.0.0",
"react-dom": "^16.0.0",
"react-modal": "^2.4.1",
"redux": "^3.7.2",
"request": "^2.83.0",
"serve-favicon": "^2.4.5",
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"react-icons": "^2.2.7",
"react-inspector": "^2.2.1",
"react-komposer": "^2.0.0",
"react-modal": "^2.4.1",
"react-modal": "^3.1.0",
"react-split-pane": "^0.1.68",
"react-treebeard": "^2.0.3",
"redux": "^3.7.2"
Expand Down
21 changes: 15 additions & 6 deletions lib/ui/src/modules/ui/components/search_box.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { document } from 'global';
import PropTypes from 'prop-types';
import React from 'react';
import ReactModal from 'react-modal';
Expand All @@ -20,6 +19,7 @@ const modalStyle = {
},
overlay: {
background: 'transparent',
zIndex: '1',
},
};

Expand Down Expand Up @@ -68,13 +68,13 @@ export default class SearchBox extends React.Component {
this.onSelect = this.onSelect.bind(this);
this.fireOnStory = this.fireOnStory.bind(this);
this.fireOnKind = this.fireOnKind.bind(this);
this.inputRef = this.inputRef.bind(this);
}

// TODO: Remove this if and when https://github.com/reactjs/react-modal/issues/464 resolves
componentDidUpdate(prevProps) {
// remove current focus on opening to prevent firing 'enter' keyDowns on it when modal closes
if (this.props.showSearchBox && !prevProps.showSearchBox && document.activeElement) {
document.activeElement.blur();
// focus search box on opening
if (this.props.showSearchBox && !prevProps.showSearchBox && this.input != null) {
this.input.focus();
}
}

Expand All @@ -95,20 +95,29 @@ export default class SearchBox extends React.Component {
if (onSelectStory) onSelectStory(kind, story);
}

inputRef(fuzzy) {
if (fuzzy != null) {
this.input = fuzzy.refs.searchBox;
}
}

render() {
return (
<ReactModal
isOpen={this.props.showSearchBox}
onRequestClose={this.props.onClose}
style={modalStyle}
contentLabel="Search"
shouldReturnFocusAfterClose={false}
// see https://github.com/reactjs/react-modal/pull/540/files#r148984350
shouldFocusAfterRender={false}
>
<FuzzySearch
list={formatStories(this.props.stories)}
onSelect={this.onSelect}
keys={['value', 'type']}
resultsTemplate={suggestionTemplate}
autoFocus
ref={this.inputRef}
/>
</ReactModal>
);
Expand Down
1 change: 0 additions & 1 deletion lib/ui/src/modules/ui/components/search_box.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ describe('manager.ui.components.search_box', () => {
const search = modal.find(FuzzySearch);
expect(search).toBePresent();
expect(search).toHaveProp('keys', ['value', 'type']);
expect(search).toHaveProp('autoFocus', true);
});

test('should format stories', () => {
Expand Down
47 changes: 44 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6818,6 +6818,10 @@ json-loader@^0.5.4, json-loader@^0.5.7:
version "0.5.7"
resolved "https://registry.yarnpkg.com/json-loader/-/json-loader-0.5.7.tgz#dca14a70235ff82f0ac9a3abeb60d337a365185d"

json-parse-better-errors@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.1.tgz#50183cd1b2d25275de069e9e71b467ac9eab973a"

json-schema-traverse@^0.3.0:
version "0.3.1"
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz#349a6d44c53a51de89b40805c5d5e59b417d3340"
Expand Down Expand Up @@ -7105,6 +7109,15 @@ load-json-file@^3.0.0:
pify "^2.0.0"
strip-bom "^3.0.0"

load-json-file@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b"
dependencies:
graceful-fs "^4.1.2"
parse-json "^4.0.0"
pify "^3.0.0"
strip-bom "^3.0.0"

load-plugin@^2.0.0:
version "2.2.1"
resolved "https://registry.yarnpkg.com/load-plugin/-/load-plugin-2.2.1.tgz#384def2b47be6edd65db0f18f368fd749b463edd"
Expand Down Expand Up @@ -8421,6 +8434,13 @@ parse-json@^3.0.0:
dependencies:
error-ex "^1.3.1"

parse-json@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0"
dependencies:
error-ex "^1.3.1"
json-parse-better-errors "^1.0.1"

parse-link-header@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/parse-link-header/-/parse-link-header-1.0.1.tgz#bedfe0d2118aeb84be75e7b025419ec8a61140a7"
Expand Down Expand Up @@ -8514,6 +8534,12 @@ path-type@^2.0.0:
dependencies:
pify "^2.0.0"

path-type@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f"
dependencies:
pify "^3.0.0"

path@^0.12.7:
version "0.12.7"
resolved "https://registry.yarnpkg.com/path/-/path-0.12.7.tgz#d4dc2a506c4ce2197eb481ebfcd5b36c0140b10f"
Expand Down Expand Up @@ -9363,9 +9389,9 @@ react-komposer@^2.0.0:
react-stubber "^1.0.0"
shallowequal "^0.2.2"

react-modal@^2.4.1:
version "2.4.1"
resolved "https://registry.yarnpkg.com/react-modal/-/react-modal-2.4.1.tgz#cb09b26711b148eb9f59cb180e1b7d82980ded05"
react-modal@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/react-modal/-/react-modal-3.1.0.tgz#ce594f88f9ab7338ee265cfec4be3cc5253f5baa"
dependencies:
exenv "^1.2.0"
prop-types "^15.5.10"
Expand Down Expand Up @@ -9609,6 +9635,13 @@ read-pkg-up@^2.0.0:
find-up "^2.0.0"
read-pkg "^2.0.0"

read-pkg-up@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-3.0.0.tgz#3ed496685dba0f8fe118d0691dc51f4a1ff96f07"
dependencies:
find-up "^2.0.0"
read-pkg "^3.0.0"

read-pkg@^1.0.0, read-pkg@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-1.1.0.tgz#f5ffaa5ecd29cb31c0474bca7d756b6bb29e3f28"
Expand All @@ -9625,6 +9658,14 @@ read-pkg@^2.0.0:
normalize-package-data "^2.3.2"
path-type "^2.0.0"

read-pkg@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389"
dependencies:
load-json-file "^4.0.0"
normalize-package-data "^2.3.2"
path-type "^3.0.0"

[email protected]:
version "1.0.34"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-1.0.34.tgz#125820e34bc842d2f2aaafafe4c2916ee32c157c"
Expand Down

0 comments on commit 1c5a7d1

Please sign in to comment.