Skip to content

Commit

Permalink
Merge branches 'feat/ref' and 'master' of https://github.com/Semantic…
Browse files Browse the repository at this point in the history
…-Org/Semantic-UI-React into feat/ref

# Conflicts:
#	src/addons/Ref/Ref.d.ts
#	src/addons/Ref/Ref.js
#	src/collections/Breadcrumb/BreadcrumbSection.js
#	src/index.js
#	test/specs/addons/Ref/Ref-test.js
#	test/specs/addons/Ref/fixtures.js
  • Loading branch information
Alexander Fedyashov committed Oct 2, 2017
2 parents 20f1dcf + 9c97ed9 commit 8ccf696
Show file tree
Hide file tree
Showing 17 changed files with 367 additions and 302 deletions.
10 changes: 4 additions & 6 deletions src/addons/Ref/Ref.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@ export interface RefProps {
[key: string]: any;

/** Primary content. */
children: React.ReactNode;
children?: React.ReactNode;

/**
* Called when componentDidMount.
*
* @param {HTMLElement} node - Referred node.
*/
innerRef: (node: HTMLElement) => void;
innerRef?: (node: HTMLElement) => void;
}

type withRefComponent = <P>(component: React.ReactType) => React.StatelessComponent<P>;

declare const Ref: React.ComponentClass<RefProps>;
declare class Ref extends React.Component<RefProps, {}> {
}

export default Ref;
export const withRef: withRefComponent;
5 changes: 3 additions & 2 deletions src/addons/Ref/Ref.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { TYPES } from '../../lib/META'
export default class Ref extends Component {
static propTypes = {
/** Primary content. */
children: PropTypes.element.isRequired,
children: PropTypes.element,

/**
* Called when componentDidMount.
Expand All @@ -31,7 +31,8 @@ export default class Ref extends Component {

// Heads up! Don't move this condition, it's a short circle that avoids run of `findDOMNode`
// if `innerRef` isn't passed
if (innerRef) innerRef(findDOMNode(this)) // eslint-disable-line react/no-find-dom-node
// eslint-disable-next-line react/no-find-dom-node
if (innerRef) innerRef(findDOMNode(this))
}

render() {
Expand Down
17 changes: 5 additions & 12 deletions src/collections/Breadcrumb/BreadcrumbSection.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import cx from 'classnames'
import _ from 'lodash'
import PropTypes from 'prop-types'
import React, { Component } from 'react'

Expand Down Expand Up @@ -68,11 +69,7 @@ export default class BreadcrumbSection extends Component {
if (link || onClick) return 'a'
}

handleClick = (e) => {
const { onClick } = this.props

if (onClick) onClick(e, this.props)
}
handleClick = e => _.invoke(this.props, 'onClick', e, this.props)

render() {
const {
Expand All @@ -89,14 +86,10 @@ export default class BreadcrumbSection extends Component {
className,
)
const rest = getUnhandledProps(BreadcrumbSection, this.props)
const ElementType = getElementType(BreadcrumbSection, this.props, this.computeElementType)

return (
<ElementType
{...rest}
className={classes}
href={href}
onClick={this.handleClick}
typeComputer={this.computeElementType}
>
<ElementType {...rest} className={classes} href={href} onClick={this.handleClick}>
{childrenUtils.isNil(children) ? content : children}
</ElementType>
)
Expand Down
306 changes: 153 additions & 153 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,157 +1,157 @@
// Addons
// export { default as Responsive } from './addons/Responsive'
// export { default as Confirm } from './addons/Confirm'
// export { default as Portal } from './addons/Portal'
// export { default as Radio } from './addons/Radio'
// export { default as Ref } from './addons/Ref'
// export { default as Select } from './addons/Select'
// export { default as TextArea } from './addons/TextArea'
//
// // Behaviors
// export { default as Visibility } from './behaviors/Visibility'
//
// // Collections
// export { default as Breadcrumb } from './collections/Breadcrumb'
// export { default as BreadcrumbDivider } from './collections/Breadcrumb/BreadcrumbDivider'
// export { default as BreadcrumbSection } from './collections/Breadcrumb/BreadcrumbSection'
//
// export { default as Form } from './collections/Form'
// export { default as FormButton } from './collections/Form/FormButton'
// export { default as FormCheckbox } from './collections/Form/FormCheckbox'
// export { default as FormDropdown } from './collections/Form/FormDropdown'
// export { default as FormField } from './collections/Form/FormField'
// export { default as FormGroup } from './collections/Form/FormGroup'
// export { default as FormInput } from './collections/Form/FormInput'
// export { default as FormRadio } from './collections/Form/FormRadio'
// export { default as FormSelect } from './collections/Form/FormSelect'
// export { default as FormTextArea } from './collections/Form/FormTextArea'
//
// export { default as Grid } from './collections/Grid'
// export { default as GridColumn } from './collections/Grid/GridColumn'
// export { default as GridRow } from './collections/Grid/GridRow'
//
// export { default as Menu } from './collections/Menu'
// export { default as MenuHeader } from './collections/Menu/MenuHeader'
// export { default as MenuItem } from './collections/Menu/MenuItem'
// export { default as MenuMenu } from './collections/Menu/MenuMenu'
//
// export { default as Message } from './collections/Message'
// export { default as MessageContent } from './collections/Message/MessageContent'
// export { default as MessageHeader } from './collections/Message/MessageHeader'
// export { default as MessageItem } from './collections/Message/MessageItem'
// export { default as MessageList } from './collections/Message/MessageList'
//
// export { default as Table } from './collections/Table'
// export { default as TableBody } from './collections/Table/TableBody'
// export { default as TableCell } from './collections/Table/TableCell'
// export { default as TableFooter } from './collections/Table/TableFooter'
// export { default as TableHeader } from './collections/Table/TableHeader'
// export { default as TableHeaderCell } from './collections/Table/TableHeaderCell'
// export { default as TableRow } from './collections/Table/TableRow'
//
// // Elements
// export { default as Button } from './elements/Button/Button'
// export { default as ButtonContent } from './elements/Button/ButtonContent'
// export { default as ButtonGroup } from './elements/Button/ButtonGroup'
// export { default as ButtonOr } from './elements/Button/ButtonOr'
//
// export { default as Container } from './elements/Container'
//
// export { default as Divider } from './elements/Divider'
//
// export { default as Flag } from './elements/Flag'
//
// export { default as Header } from './elements/Header'
// export { default as HeaderContent } from './elements/Header/HeaderContent'
// export { default as HeaderSubheader } from './elements/Header/HeaderSubheader'
//
// export { default as Icon } from './elements/Icon'
// export { default as IconGroup } from './elements/Icon/IconGroup'
//
// export { default as Image } from './elements/Image'
// export { default as ImageGroup } from './elements/Image/ImageGroup'
//
// export { default as Input } from './elements/Input'
//
// export { default as Label } from './elements/Label'
// export { default as LabelDetail } from './elements/Label/LabelDetail'
// export { default as LabelGroup } from './elements/Label/LabelGroup'
//
// export { default as List } from './elements/List'
// export { default as ListContent } from './elements/List/ListContent'
// export { default as ListDescription } from './elements/List/ListDescription'
// export { default as ListHeader } from './elements/List/ListHeader'
// export { default as ListIcon } from './elements/List/ListIcon'
// export { default as ListItem } from './elements/List/ListItem'
// export { default as ListList } from './elements/List/ListList'
//
// export { default as Loader } from './elements/Loader'
//
// export { default as Rail } from './elements/Rail'
//
// export { default as Reveal } from './elements/Reveal'
// export { default as RevealContent } from './elements/Reveal/RevealContent'
//
// export { default as Segment } from './elements/Segment'
// export { default as SegmentGroup } from './elements/Segment/SegmentGroup'
//
// export { default as Step } from './elements/Step'
// export { default as StepContent } from './elements/Step/StepContent'
// export { default as StepDescription } from './elements/Step/StepDescription'
// export { default as StepGroup } from './elements/Step/StepGroup'
// export { default as StepTitle } from './elements/Step/StepTitle'
//
// // Modules
// export { default as Accordion } from './modules/Accordion/Accordion'
// export { default as AccordionAccordion } from './modules/Accordion/AccordionAccordion'
// export { default as AccordionContent } from './modules/Accordion/AccordionContent'
// export { default as AccordionTitle } from './modules/Accordion/AccordionTitle'
//
// export { default as Checkbox } from './modules/Checkbox'
//
// export { default as Dimmer } from './modules/Dimmer'
// export { default as DimmerDimmable } from './modules/Dimmer/DimmerDimmable'
//
// export { default as Dropdown } from './modules/Dropdown'
// export { default as DropdownDivider } from './modules/Dropdown/DropdownDivider'
// export { default as DropdownHeader } from './modules/Dropdown/DropdownHeader'
// export { default as DropdownItem } from './modules/Dropdown/DropdownItem'
// export { default as DropdownMenu } from './modules/Dropdown/DropdownMenu'
// export { default as DropdownSearchInput } from './modules/Dropdown/DropdownSearchInput'
//
// export { default as Embed } from './modules/Embed'
//
// export { default as Modal } from './modules/Modal'
// export { default as ModalActions } from './modules/Modal/ModalActions'
// export { default as ModalContent } from './modules/Modal/ModalContent'
// export { default as ModalDescription } from './modules/Modal/ModalDescription'
// export { default as ModalHeader } from './modules/Modal/ModalHeader'
//
// export { default as Popup } from './modules/Popup'
// export { default as PopupContent } from './modules/Popup/PopupContent'
// export { default as PopupHeader } from './modules/Popup/PopupHeader'
//
// export { default as Progress } from './modules/Progress'
//
// export { default as Rating } from './modules/Rating'
// export { default as RatingIcon } from './modules/Rating/RatingIcon'
//
// export { default as Search } from './modules/Search'
// export { default as SearchCategory } from './modules/Search/SearchCategory'
// export { default as SearchResult } from './modules/Search/SearchResult'
// export { default as SearchResults } from './modules/Search/SearchResults'
//
// export { default as Sidebar } from './modules/Sidebar'
// export { default as SidebarPushable } from './modules/Sidebar/SidebarPushable'
// export { default as SidebarPusher } from './modules/Sidebar/SidebarPusher'
//
// export { default as Sticky } from './modules/Sticky'
//
// export { default as Tab } from './modules/Tab'
// export { default as TabPane } from './modules/Tab/TabPane'
//
// export { default as Transition } from './modules/Transition'
// export { default as TransitionGroup } from './modules/Transition/TransitionGroup'
export { default as Responsive } from './addons/Responsive'
export { default as Confirm } from './addons/Confirm'
export { default as Portal } from './addons/Portal'
export { default as Radio } from './addons/Radio'
export { default as Ref } from './addons/Ref'
export { default as Select } from './addons/Select'
export { default as TextArea } from './addons/TextArea'

// Behaviors
export { default as Visibility } from './behaviors/Visibility'

// Collections
export { default as Breadcrumb } from './collections/Breadcrumb'
export { default as BreadcrumbDivider } from './collections/Breadcrumb/BreadcrumbDivider'
export { default as BreadcrumbSection } from './collections/Breadcrumb/BreadcrumbSection'

export { default as Form } from './collections/Form'
export { default as FormButton } from './collections/Form/FormButton'
export { default as FormCheckbox } from './collections/Form/FormCheckbox'
export { default as FormDropdown } from './collections/Form/FormDropdown'
export { default as FormField } from './collections/Form/FormField'
export { default as FormGroup } from './collections/Form/FormGroup'
export { default as FormInput } from './collections/Form/FormInput'
export { default as FormRadio } from './collections/Form/FormRadio'
export { default as FormSelect } from './collections/Form/FormSelect'
export { default as FormTextArea } from './collections/Form/FormTextArea'

export { default as Grid } from './collections/Grid'
export { default as GridColumn } from './collections/Grid/GridColumn'
export { default as GridRow } from './collections/Grid/GridRow'

export { default as Menu } from './collections/Menu'
export { default as MenuHeader } from './collections/Menu/MenuHeader'
export { default as MenuItem } from './collections/Menu/MenuItem'
export { default as MenuMenu } from './collections/Menu/MenuMenu'

export { default as Message } from './collections/Message'
export { default as MessageContent } from './collections/Message/MessageContent'
export { default as MessageHeader } from './collections/Message/MessageHeader'
export { default as MessageItem } from './collections/Message/MessageItem'
export { default as MessageList } from './collections/Message/MessageList'

export { default as Table } from './collections/Table'
export { default as TableBody } from './collections/Table/TableBody'
export { default as TableCell } from './collections/Table/TableCell'
export { default as TableFooter } from './collections/Table/TableFooter'
export { default as TableHeader } from './collections/Table/TableHeader'
export { default as TableHeaderCell } from './collections/Table/TableHeaderCell'
export { default as TableRow } from './collections/Table/TableRow'

// Elements
export { default as Button } from './elements/Button/Button'
export { default as ButtonContent } from './elements/Button/ButtonContent'
export { default as ButtonGroup } from './elements/Button/ButtonGroup'
export { default as ButtonOr } from './elements/Button/ButtonOr'

export { default as Container } from './elements/Container'

export { default as Divider } from './elements/Divider'

export { default as Flag } from './elements/Flag'

export { default as Header } from './elements/Header'
export { default as HeaderContent } from './elements/Header/HeaderContent'
export { default as HeaderSubheader } from './elements/Header/HeaderSubheader'

export { default as Icon } from './elements/Icon'
export { default as IconGroup } from './elements/Icon/IconGroup'

export { default as Image } from './elements/Image'
export { default as ImageGroup } from './elements/Image/ImageGroup'

export { default as Input } from './elements/Input'

export { default as Label } from './elements/Label'
export { default as LabelDetail } from './elements/Label/LabelDetail'
export { default as LabelGroup } from './elements/Label/LabelGroup'

export { default as List } from './elements/List'
export { default as ListContent } from './elements/List/ListContent'
export { default as ListDescription } from './elements/List/ListDescription'
export { default as ListHeader } from './elements/List/ListHeader'
export { default as ListIcon } from './elements/List/ListIcon'
export { default as ListItem } from './elements/List/ListItem'
export { default as ListList } from './elements/List/ListList'

export { default as Loader } from './elements/Loader'

export { default as Rail } from './elements/Rail'

export { default as Reveal } from './elements/Reveal'
export { default as RevealContent } from './elements/Reveal/RevealContent'

export { default as Segment } from './elements/Segment'
export { default as SegmentGroup } from './elements/Segment/SegmentGroup'

export { default as Step } from './elements/Step'
export { default as StepContent } from './elements/Step/StepContent'
export { default as StepDescription } from './elements/Step/StepDescription'
export { default as StepGroup } from './elements/Step/StepGroup'
export { default as StepTitle } from './elements/Step/StepTitle'

// Modules
export { default as Accordion } from './modules/Accordion/Accordion'
export { default as AccordionAccordion } from './modules/Accordion/AccordionAccordion'
export { default as AccordionContent } from './modules/Accordion/AccordionContent'
export { default as AccordionTitle } from './modules/Accordion/AccordionTitle'

export { default as Checkbox } from './modules/Checkbox'

export { default as Dimmer } from './modules/Dimmer'
export { default as DimmerDimmable } from './modules/Dimmer/DimmerDimmable'

export { default as Dropdown } from './modules/Dropdown'
export { default as DropdownDivider } from './modules/Dropdown/DropdownDivider'
export { default as DropdownHeader } from './modules/Dropdown/DropdownHeader'
export { default as DropdownItem } from './modules/Dropdown/DropdownItem'
export { default as DropdownMenu } from './modules/Dropdown/DropdownMenu'
export { default as DropdownSearchInput } from './modules/Dropdown/DropdownSearchInput'

export { default as Embed } from './modules/Embed'

export { default as Modal } from './modules/Modal'
export { default as ModalActions } from './modules/Modal/ModalActions'
export { default as ModalContent } from './modules/Modal/ModalContent'
export { default as ModalDescription } from './modules/Modal/ModalDescription'
export { default as ModalHeader } from './modules/Modal/ModalHeader'

export { default as Popup } from './modules/Popup'
export { default as PopupContent } from './modules/Popup/PopupContent'
export { default as PopupHeader } from './modules/Popup/PopupHeader'

export { default as Progress } from './modules/Progress'

export { default as Rating } from './modules/Rating'
export { default as RatingIcon } from './modules/Rating/RatingIcon'

export { default as Search } from './modules/Search'
export { default as SearchCategory } from './modules/Search/SearchCategory'
export { default as SearchResult } from './modules/Search/SearchResult'
export { default as SearchResults } from './modules/Search/SearchResults'

export { default as Sidebar } from './modules/Sidebar'
export { default as SidebarPushable } from './modules/Sidebar/SidebarPushable'
export { default as SidebarPusher } from './modules/Sidebar/SidebarPusher'

export { default as Sticky } from './modules/Sticky'

export { default as Tab } from './modules/Tab'
export { default as TabPane } from './modules/Tab/TabPane'

export { default as Transition } from './modules/Transition'
export { default as TransitionGroup } from './modules/Transition/TransitionGroup'

// Views
export { default as Advertisement } from './views/Advertisement'
Expand Down
Loading

0 comments on commit 8ccf696

Please sign in to comment.