Skip to content

feat(popperjs): use popperjs instead of tether#561

Merged
TheSharpieOne merged 8 commits intov5from
popper
Sep 9, 2017
Merged

feat(popperjs): use popperjs instead of tether#561
TheSharpieOne merged 8 commits intov5from
popper

Conversation

@TheSharpieOne
Copy link
Copy Markdown
Member

@TheSharpieOne TheSharpieOne commented Sep 1, 2017

This replaces tether and TetherConent with PopperJS via react-popper.
Things touched:

  • Dropdown (and Dropdown<Things>)
  • Tooltip
  • Popover

It also includes an update to react-scripts as I needed new features. This updates other things, such as jest as well as eslint. This causes some of the tests to change due to the jest 19/20 changes and caused other code files to change due to new eslint rules.

Test have been updated and coverage has been improved.
Docs have been updated

I have done my best to keep the expose API (props and such) the same, but some things such as tether and tetherRef props are no longer relevant and have been removed. Other props have been changed to better align with other components.

@FezVrasta
Copy link
Copy Markdown

Popper.js exports the placements as Popper.placements

No need to hard code them in this code

Copy link
Copy Markdown
Collaborator

@virgofx virgofx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code-wise looks excellent. Clean implementation of Popper and a lot of test refactoring to Jest. Wondering if we made any speed improvements in the test framework?

Looks good. Need to test it live

Comment thread docs/lib/Home/index.js
@@ -100,7 +100,7 @@ npm install --save reactstrap react-addons-transition-group react-addons-css-tra
<p>Check out the demo <a href="http://output.jsbin.com/dimive/latest">here</a></p>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this link no longer works. Need to figure out replacement.

I know this is carry over from existing docs not related to popper but I remember see it .. Might as well either remove it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll have to update this later, after v5 so that the example can include v5 things. I am thinking that we should use webpackbin or codesandbox.

Comment thread src/Button.js
outline: PropTypes.bool,
tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
getRef: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious ... I know getRef() was used in a lot of places. Are we switching to innerRef() ? It actually makes more sense intuitively as I ran into this issue during development and forgot the actual ref was getRef().

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was to line up with other libraries. I considered keeping both, aliasing one to the other but thought doing so might cause some complications.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, let's just use innerRef and make sure all other components use that.

Comment thread src/Dropdown.js
return <Manager {...attrs} className={classes}>{}</Manager>;
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codewise, even cleaner and easier to read. Removed unnecessary logic in a few areas. 👍

Comment thread src/Popover.js
clearTimeout(this._hideTimeout);
this._hideTimeout = undefined;
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will all the show/hide timeout logic ... will this also fix the few issues we have with fast enable/disabling of popovers/tooltips where it was previously crashing? If not, maybe test with delays of 2000 (2s) to make sure we can close those issues too.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Animations still need to be reworked, but the way this works it should better handle timeouts and toggles. I don't really want to have a long running test; there are tests to ensure the timeouts are cleared.

Comment thread src/Tooltip.js
import classNames from 'classnames';
import TetherContent from './TetherContent';
import { getTetherAttachments, mapToCssModules, omit, tetherAttachements } from './utils';
import Popper from './PopperContent';
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we switched from Tether to Popper. Keeping it as PopperContent makes sense to avoid confusion with main popper.js library; however, since this is not really an exposed component persay, it's cleaner to just use it as Popper as you did here. If so ... should we rename ./PopperContent to Popper. Otherwise, maybe keep the class name as PopperContent for consistency.

@TheSharpieOne TheSharpieOne merged commit 5413022 into v5 Sep 9, 2017
@TheSharpieOne TheSharpieOne deleted the popper branch September 9, 2017 14:55
@fuchsberger
Copy link
Copy Markdown

fuchsberger commented Sep 9, 2017

many thanks! i am very much anticipating this release! Is there a planned release date for v5?
If not is there a npm package available?

@TheSharpieOne
Copy link
Copy Markdown
Member Author

@Sathras I would like to get #557 in before v5, though I would like to get a beta release asap, but I need @eddywashere to help with that.

virgofx pushed a commit to virgofx/reactstrap that referenced this pull request Sep 29, 2017
Add tests
Update existing tests (jest has been upgraded) 
improve code coverage 
Breaking change: getRef has been renamed to innerRef to line up with other libraries.
Breaking change: tether props have been removed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants