Skip to content

Commit

Permalink
[changed] Use named exports in index files
Browse files Browse the repository at this point in the history
  • Loading branch information
Jimmy Jia committed Jun 13, 2015
1 parent 36358d6 commit fafe46f
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 144 deletions.
4 changes: 1 addition & 3 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
"optional": [
"es7.objectRestSpread"
]
"stage": 1
}
7 changes: 6 additions & 1 deletion docs/src/GettingStartedPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ $ npm install react-bootstrap`
codeText={
`var Alert = require('react-bootstrap/lib/Alert');
// or
var Alert = require('react-bootstrap').Alert;`
var Alert = require('react-bootstrap').Alert;
// with ES6 modules
import Alert from 'react-bootstrap/lib/Alert';
// or
import {Alert} from 'react-bootstrap';`
}
/>
</div>
Expand Down
10 changes: 5 additions & 5 deletions docs/src/ReactPlayground.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import * as modClassNames from 'classnames';
import * as modAccordion from '../../src/Accordion';
import * as modAlert from '../../src/Alert';
import * as modBadge from '../../src/Badge';
import * as modmodButton from '../../src/Button';
import * as modButton from '../../src/Button';
import * as modButtonGroup from '../../src/ButtonGroup';
import * as modButtonInput from '../../src/ButtonInput';
import * as modmodButtonToolbar from '../../src/ButtonToolbar';
import * as modButtonToolbar from '../../src/ButtonToolbar';
import * as modCollapsibleNav from '../../src/CollapsibleNav';
import * as modCollapsibleMixin from '../../src/CollapsibleMixin';
import * as modCarousel from '../../src/Carousel';
Expand Down Expand Up @@ -56,17 +56,17 @@ const React = modReact.default;
const Accordion = modAccordion.default;
const Alert = modAlert.default;
const Badge = modBadge.default;
const Button = modmodButton.default;
const Button = modButton.default;
const ButtonGroup = modButtonGroup.default;
const ButtonInput = modButtonInput.default;
const ButtonToolbar = modmodButtonToolbar.default;
const ButtonToolbar = modButtonToolbar.default;
const CollapsibleNav = modCollapsibleNav.default;
const CollapsibleMixin = modCollapsibleMixin.default;
const Carousel = modCarousel.default;
const CarouselItem = modCarouselItem.default;
const Col = modCol.default;
const DropdownButton = modDropdownButton.default;
const FormControls = modFormControls.default;
const FormControls = modFormControls;
const Glyphicon = modGlyphicon.default;
const Grid = modGrid.default;
const Input = modInput.default;
Expand Down
6 changes: 1 addition & 5 deletions src/FormControls/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
import Static from './Static';

export default {
Static
};
export Static from './Static';
2 changes: 1 addition & 1 deletion src/Input.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import InputBase from './InputBase';
import FormControls from './FormControls';
import * as FormControls from './FormControls';
import deprecationWarning from './utils/deprecationWarning';

class Input extends InputBase {
Expand Down
170 changes: 56 additions & 114 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,115 +1,57 @@
import Accordion from './Accordion';
import Affix from './Affix';
import AffixMixin from './AffixMixin';
import Alert from './Alert';
import BootstrapMixin from './BootstrapMixin';
import Badge from './Badge';
import Button from './Button';
import ButtonGroup from './ButtonGroup';
import ButtonInput from './ButtonInput';
import ButtonToolbar from './ButtonToolbar';
import CollapsibleNav from './CollapsibleNav';
import Carousel from './Carousel';
import CarouselItem from './CarouselItem';
import Col from './Col';
import CollapsibleMixin from './CollapsibleMixin';
import DropdownButton from './DropdownButton';
import DropdownMenu from './DropdownMenu';
import DropdownStateMixin from './DropdownStateMixin';
import FadeMixin from './FadeMixin';
import FormControls from './FormControls';
import Glyphicon from './Glyphicon';
import Grid from './Grid';
import Input from './Input';
import Interpolate from './Interpolate';
import Jumbotron from './Jumbotron';
import Label from './Label';
import ListGroup from './ListGroup';
import ListGroupItem from './ListGroupItem';
import MenuItem from './MenuItem';
import Modal from './Modal';
import Nav from './Nav';
import Navbar from './Navbar';
import NavItem from './NavItem';
import ModalTrigger from './ModalTrigger';
import OverlayTrigger from './OverlayTrigger';
import OverlayMixin from './OverlayMixin';
import PageHeader from './PageHeader';
import Pagination from './Pagination';
import Panel from './Panel';
import PanelGroup from './PanelGroup';
import PageItem from './PageItem';
import Pager from './Pager';
import Popover from './Popover';
import ProgressBar from './ProgressBar';
import Row from './Row';
import SafeAnchor from './SafeAnchor';
import SplitButton from './SplitButton';
import SubNav from './SubNav';
import TabbedArea from './TabbedArea';
import Table from './Table';
import TabPane from './TabPane';
import Thumbnail from './Thumbnail';
import Tooltip from './Tooltip';
import utils from './utils';
import Well from './Well';
import styleMaps from './styleMaps';
export Accordion from './Accordion';
export Affix from './Affix';
export AffixMixin from './AffixMixin';
export Alert from './Alert';
export Badge from './Badge';
export BootstrapMixin from './BootstrapMixin';
export Button from './Button';
export ButtonGroup from './ButtonGroup';
export ButtonInput from './ButtonInput';
export ButtonToolbar from './ButtonToolbar';
export Carousel from './Carousel';
export CarouselItem from './CarouselItem';
export Col from './Col';
export CollapsibleMixin from './CollapsibleMixin';
export CollapsibleNav from './CollapsibleNav';
export DropdownButton from './DropdownButton';
export DropdownMenu from './DropdownMenu';
export DropdownStateMixin from './DropdownStateMixin';
export FadeMixin from './FadeMixin';
export Glyphicon from './Glyphicon';
export Grid from './Grid';
export Input from './Input';
export Interpolate from './Interpolate';
export Jumbotron from './Jumbotron';
export Label from './Label';
export ListGroup from './ListGroup';
export ListGroupItem from './ListGroupItem';
export MenuItem from './MenuItem';
export Modal from './Modal';
export ModalTrigger from './ModalTrigger';
export Nav from './Nav';
export Navbar from './Navbar';
export NavItem from './NavItem';
export OverlayMixin from './OverlayMixin';
export OverlayTrigger from './OverlayTrigger';
export PageHeader from './PageHeader';
export PageItem from './PageItem';
export Pager from './Pager';
export Pagination from './Pagination';
export Panel from './Panel';
export PanelGroup from './PanelGroup';
export Popover from './Popover';
export ProgressBar from './ProgressBar';
export Row from './Row';
export SafeAnchor from './SafeAnchor';
export SplitButton from './SplitButton';
export styleMaps from './styleMaps';
export SubNav from './SubNav';
export TabbedArea from './TabbedArea';
export Table from './Table';
export TabPane from './TabPane';
export Thumbnail from './Thumbnail';
export Tooltip from './Tooltip';
export Well from './Well';

export default {
Accordion,
Affix,
AffixMixin,
Alert,
BootstrapMixin,
Badge,
Button,
ButtonGroup,
ButtonInput,
ButtonToolbar,
CollapsibleNav,
Carousel,
CarouselItem,
Col,
CollapsibleMixin,
DropdownButton,
DropdownMenu,
DropdownStateMixin,
FadeMixin,
FormControls,
Glyphicon,
Grid,
Input,
Interpolate,
Jumbotron,
Label,
ListGroup,
ListGroupItem,
MenuItem,
Modal,
Nav,
Navbar,
NavItem,
ModalTrigger,
OverlayTrigger,
OverlayMixin,
PageHeader,
Panel,
PanelGroup,
PageItem,
Pager,
Pagination,
Popover,
ProgressBar,
Row,
SafeAnchor,
SplitButton,
SubNav,
TabbedArea,
Table,
TabPane,
Thumbnail,
Tooltip,
utils,
Well,
styleMaps
};
export * as FormControls from './FormControls';
export * as utils from './utils';
18 changes: 5 additions & 13 deletions src/utils/index.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
import childrenValueInputValidation from './childrenValueInputValidation';
import createChainedFunction from './createChainedFunction';
import CustomPropTypes from './CustomPropTypes';
import domUtils from './domUtils';
import ValidComponentChildren from './ValidComponentChildren';

export default {
childrenValueInputValidation,
createChainedFunction,
CustomPropTypes,
domUtils,
ValidComponentChildren
};
export childrenValueInputValidation from './childrenValueInputValidation';
export createChainedFunction from './createChainedFunction';
export CustomPropTypes from './CustomPropTypes';
export domUtils from './domUtils';
export ValidComponentChildren from './ValidComponentChildren';
2 changes: 1 addition & 1 deletion test/FormControlsSpec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import ReactTestUtils from 'react/lib/ReactTestUtils';
import FormControls from '../src/FormControls';
import * as FormControls from '../src/FormControls';

describe('Form Controls', function () {
describe('Static', function () {
Expand Down
2 changes: 1 addition & 1 deletion tools/public-components.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import index from '../src/index';
import * as index from '../src/index';

let components = [];
Object.keys(index).forEach(function (item) {
Expand Down

0 comments on commit fafe46f

Please sign in to comment.