Skip to content

Commit

Permalink
fix: never mix named and default exports
Browse files Browse the repository at this point in the history
BREAKING CHANGE: we don’t mix default and named exports anymore, whenever a package needs to export multiple modules, it will export all of them as named exports.

Affected packages:
- @quid/react-tooltip
- @quid/react-popover
- @quid/react-dropdown
  • Loading branch information
FezVrasta committed Jul 8, 2019
1 parent af66099 commit 06e907c
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 21 deletions.
2 changes: 1 addition & 1 deletion packages/react-dropdown/src/__mocks__/DropdownWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// @flow

import * as React from 'react';
import Dropdown from '../index';
import { Dropdown } from '../index';

type State = {
selectedItems: Array<Object>,
Expand Down
4 changes: 1 addition & 3 deletions packages/react-dropdown/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,4 @@ const Dropdown = ({
);
};

export { DropdownList };

export default Dropdown;
export { Dropdown, DropdownList };
2 changes: 1 addition & 1 deletion packages/react-dropdown/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ Depending by your use case, you may want to override the dropdown styles, for in
This can be achieved by using [Emotion's "component as selector"](https://emotion.sh/docs/styled#targeting-another-emotion-component) feature:

```js static
import Dropdown, { DropdownList } from '@quid/react-dropdown';
import { Dropdown, DropdownList } from '@quid/react-dropdown';
import styled from '@emotion/styled/macro';

const CustomDropdown = styled(Dropdown)`
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dropdown/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import ReactDOM from 'react-dom';
import { mount } from 'enzyme';
import styled from '@emotion/styled/macro';
import DropdownWrapper from './__mocks__/DropdownWrapper';
import Dropdown, { DropdownList as DL } from './index';
import { Dropdown, DropdownList as DL } from './index';
import DropdownList, { List } from './List';
import { Item, HIGHLIGHTED, SELECTED } from './Items';
import { Divider } from './Categories';
Expand Down
4 changes: 1 addition & 3 deletions packages/react-popover/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,4 @@ const Popover = ({
);
};

export { Container, Arrow };

export default Popover;
export { Popover, Container, Arrow };
4 changes: 2 additions & 2 deletions packages/react-popover/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ state in a declarative way.

```jsx
import { Button } from '@quid/react-core';
import Popover, { Container, Arrow } from '.'; // @quid/react-popover
import { Popover, Container, Arrow } from '.'; // @quid/react-popover

<Popover
renderPopover={props => (
Expand All @@ -49,7 +49,7 @@ a state change is triggered.

```jsx
import { Button } from '@quid/react-core';
import Popover, { Container, Arrow } from '.'; // @quid/react-popover
import { Popover, Container, Arrow } from '.'; // @quid/react-popover

initialState = { open: false };

Expand Down
2 changes: 1 addition & 1 deletion packages/react-popover/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import * as React from 'react';
import { act } from 'react-dom/test-utils';
import { mount } from 'enzyme';
import Popover, { Container, Arrow } from '.';
import { Popover, Container, Arrow } from '.';

jest.mock('use-debounce', () => ({
useDebouncedCallback: callback => [callback, jest.fn()],
Expand Down
7 changes: 3 additions & 4 deletions packages/react-tooltip/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import * as React from 'react';
import { type Placement, type Modifiers } from 'popper.js';
import { type PopperArrowProps } from 'react-popper';
import styled from '@emotion/styled/macro';
import Popover, {
import {
Popover,
Container as PopoverContainer,
Arrow,
type Helpers,
Expand All @@ -35,7 +36,7 @@ type Props = {
children: ({ ref: React.ElementRef<any> } & Helpers) => React.Node,
};

const Tooltip = ({ renderTooltip, ...props }: Props) => (
export const Tooltip = ({ renderTooltip, ...props }: Props) => (
<Popover renderPopover={renderTooltip} mouseMoveBehavior {...props} />
);
Tooltip.defaultProps = {
Expand All @@ -50,5 +51,3 @@ export const Container = styled(
</PopoverContainer>
))
)``;

export default Tooltip;
4 changes: 2 additions & 2 deletions packages/react-tooltip/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ state in a declarative way.

```jsx
import { Button } from '@quid/react-core';
import Tooltip, { Container } from '.'; // @quid/react-tooltip
import { Tooltip, Container } from '.'; // @quid/react-tooltip

<Tooltip
renderTooltip={props => <Container {...props}>Tooltip content</Container>}
Expand All @@ -43,7 +43,7 @@ a state change is triggered.

```jsx
import { Button } from '@quid/react-core';
import Tooltip, { Container } from '.'; // @quid/react-tooltip
import { Tooltip, Container } from '.'; // @quid/react-tooltip

initialState = { open: false };

Expand Down
5 changes: 2 additions & 3 deletions packages/react-tooltip/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
*/
// @flow
import * as React from 'react';
import { act } from 'react-dom/test-utils';
import { mount } from 'enzyme';
import Tooltip, { Container } from '.';
import { Tooltip, Container } from '.';

jest.mock('@quid/react-popover', () => ({
__esModule: true,
default: ({ children, ...props }) => children(props),
Popover: ({ children, ...props }) => children(props),
Container: 'x-popover-container',
Arrow: 'x-popover-arrow',
}));
Expand Down

0 comments on commit 06e907c

Please sign in to comment.