Skip to content

Commit

Permalink
fix(subcomponents): Make all subcomponents avaliable from base component
Browse files Browse the repository at this point in the history
This allows all subcomponents to be available from the pf-react packages.
  • Loading branch information
jeff-phillips-18 committed Nov 13, 2018
1 parent 65c9d4f commit b63fc27
Show file tree
Hide file tree
Showing 19 changed files with 175 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
import { Button } from 'react-bootstrap';
import ButtonGroup from './ButtonGroup';
import DropdownButton from './DropdownButton';
import SplitButton from './SplitButton';

Button.Dropdown = DropdownButton;
Button.Group = ButtonGroup;
Button.Split = SplitButton;

export default Button;
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ import CardBody from './CardBody';
import CardHeading from './CardHeading';
import CardFooter from './CardFooter';
import CardLink from './CardLink';
import CardGrid from './CardGrid';
import CardDropdownButton from './CardDropdownButton';
import CardHeightMatching from './CardHeightMatching';
import UtilizationTrendCard from './UtilizationTrendCard';
import { AggregateStatusCount, AggregateStatusNotifications, AggregateStatusNotification } from './AggregateStatusCard';

/**
* Card Component for PatternFly React
Expand Down Expand Up @@ -63,7 +66,12 @@ Card.Body = CardBody;
Card.Heading = CardHeading;
Card.Footer = CardFooter;
Card.Link = CardLink;
Card.Grid = CardGrid;
Card.DropdownButton = CardDropdownButton;
Card.HeightMatching = CardHeightMatching;
Card.UtilizationTrend = UtilizationTrendCard;
Card.AggregateStatusCount = AggregateStatusCount;
Card.AggregateStatusNotifications = AggregateStatusNotifications;
Card.AggregateStatuAggregateStatusNotificationsCount = AggregateStatusNotification;

export default Card;
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { default as AreaChart } from './AreaChart';
import { default as BarChart } from './BarChart';
import { BulletChart } from './BulletChart/index';
import { default as DonutChart } from './DonutChart';
import { default as GroupedBarChart } from './GroupedBarChart';
import { default as LineChart } from './LineChart';
import { default as PieChart } from './PieChart';
import { default as SingleAreaChart } from './SingleAreaChart';
import { default as SingleLineChart } from './SingleLineChart';
import { default as SparklineChart } from './SparklineChart';
import { default as StackedBarChart } from './StackedBarChart';

const Chart = {
AreaChart,
BarChart,
BulletChart,
DonutChart,
GroupedBarChart,
LineChart,
PieChart,
SingleAreaChart,
SingleLineChart,
SparklineChart,
StackedBarChart
};

export default Chart;
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { default as NavDropdown } from './NavDropdown';
import { Dropdown } from 'react-bootstrap';

Dropdown.NavDropdown = NavDropdown;

export default Dropdown;
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { default as HorizontalNavMenu } from './HorizontalNavMenu';
import { default as HorizontalNavMenuItem } from './HorizontalNavMenuItem';

const HorizontalNav = props => {
const { children } = props;
Expand All @@ -15,4 +17,7 @@ HorizontalNav.defaultProps = {
children: null
};

HorizontalNav.Menu = HorizontalNavMenu;
HorizontalNav.MenuItem = HorizontalNavMenuItem;

export default HorizontalNav;
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import PropTypes from 'prop-types';
import { default as ConfirmButton } from './ConfirmButton';
import { default as CancelButton } from './CancelButton';

const InlineEdit = ({ value, isEditing, additionalData, renderValue, renderEdit }) => {
if (isEditing(additionalData)) {
Expand All @@ -19,4 +21,7 @@ InlineEdit.propTypes = {
renderEdit: PropTypes.func
};

InlineEdit.ConfirmButton = ConfirmButton;
InlineEdit.CancelButton = CancelButton;

export default InlineEdit;
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
import React from 'react';
import Label from './Label';
import PropTypes from 'prop-types';
import { noop } from '../../common/helpers';
import { Label as BsLabel } from 'react-bootstrap';
import Label from './Label';

const DisposableLabel = props => <Label {...props} />;

DisposableLabel.propTypes = {
...Label.propTypes
...BsLabel.propTypes,
/** Children nodes */
children: PropTypes.node,
/** Label type */
type: PropTypes.string,
/** callback when Label is removed */
onRemoveClick: PropTypes.func
};

DisposableLabel.defaultProps = {
...Label.defaultProps,
children: null,
type: 'default',
onRemoveClick: noop
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React from 'react';
import { Label as BsLabel } from 'react-bootstrap';
import PropTypes from 'prop-types';
import RemoveButton from './RemoveButton';
import DisposableLabel from './DisposableLabel';
import CompoundLabel from './CompoundLabel';

const Label = ({ children, onRemoveClick, type, ...props }) => (
<BsLabel bsStyle={type} {...props}>
Expand All @@ -10,6 +12,7 @@ const Label = ({ children, onRemoveClick, type, ...props }) => (
</BsLabel>
);

// WARNING: If you change propTypes you MUST also change DisposableLabel.propTypes
Label.propTypes = {
...BsLabel.propTypes,
/** Children nodes */
Expand All @@ -20,10 +23,15 @@ Label.propTypes = {
onRemoveClick: PropTypes.func
};

// WARNING: If you change defaultProps you MUST also change DisposableLabel.defaultProps
Label.defaultProps = {
children: null,
type: 'default',
onRemoveClick: undefined
};

Label.RemoveButton = RemoveButton;
Label.DisposableLabel = DisposableLabel;
Label.CompoundLabel = CompoundLabel;

export default Label;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Label from './Label';
import DisposableLabel from './DisposableLabel';
import RemoveButton from './RemoveButton';
import CompoundLabel from './CompoundLabel';

export { default as Label } from './Label';
export { DisposableLabel, RemoveButton, CompoundLabel };
export { Label, DisposableLabel, RemoveButton, CompoundLabel };
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { ListGroup } from 'react-bootstrap';
import { default as ListGroupItem } from './ListGroupItem';

ListGroup.ListGroupItem = ListGroupItem;

export default ListGroup;
Original file line number Diff line number Diff line change
@@ -1,16 +1,32 @@
import React from 'react';
import PropTypes from 'prop-types';
import LoginPageAlert from './components/LoginPageComponents/LoginPageAlert';
import Container from './components/LoginPageComponents/LoginPageContainer';
import Header from './components/LoginPageComponents/LoginPageHeader';
import Footer from './components/LoginPageComponents/LoginPageFooter';
import FooterLinks from './components/LoginPageComponents/LoginFooterLinks';
import LoginCard from './components/LoginCardComponents/LoginCard';
import WithTranslation from './components/LoginPageComponents/LoginPageWithTranslation';
import LoginPageAlert from './components/LoginPageComponents/LoginPageAlert';
import LoginPageLink from './components/LoginPageComponents/LoginPageLink';
import SocialLoginPage from './SocialLoginPage';
import SocialLoginPageContainer from './components/LoginPageComponents/SocialLoginPageContainer';
import BasicLoginPageLayout from './components/LoginPageComponents/BasicLoginPageLayout';
import LoginCardHeader from './components/LoginCardComponents/LoginCardHeader';
import LoginLanguagePicker from './components/LoginCardComponents/LoginLanguagePicker';
import LoginCardWithValidation from './components/LoginCardComponents/LoginCardWithValidation';
import LoginCardForm from './components/LoginCardComponents/LoginCardForm';
import LoginCardSignUp from './components/LoginCardComponents/LoginCardSignUp';
import LoginCardInput from './components/LoginCardComponents/LoginCardInput';
import LoginCardInputWarning from './components/LoginCardComponents/LoginCardInputWarning';
import LoginCardSettings from './components/LoginCardComponents/LoginCardSettings';
import LoginFormError from './components/LoginCardComponents/LoginFormError';
import LoginCardForgotPassword from './components/LoginCardComponents/LoginCardForgotPassword';
import LoginCardRememberMe from './components/LoginCardComponents/LoginCardRememberMe';
import LoginCardSocialSection from './components/LoginCardComponents/LoginCardSocialSection';
import LoginCardSocialLink from './components/LoginCardComponents/LoginCardSocialLink';
import LoginCardSocialColumns from './components/LoginCardComponents/LoginCardSocialColumns';
import SocialLoginCard from './components/LoginCardComponents/SocialLoginCard';
import BasicLoginCardLayout from './components/LoginCardComponents/BasicLoginCardLayout';

const LoginPagePattern = ({ container, header, footerLinks, card }) => (
<LoginPage.Container {...container}>
Expand Down Expand Up @@ -56,6 +72,22 @@ LoginPage.Social = SocialLoginPage;
LoginPage.SocialContainer = SocialLoginPageContainer;
LoginPage.BasicLayout = BasicLoginPageLayout;
LoginPage.Link = LoginPageLink;
LoginPage.CardHeaer = LoginCardHeader;
LoginPage.LanguagePicker = LoginLanguagePicker;
LoginPage.CardWithValidation = LoginCardWithValidation;
LoginPage.CardForm = LoginCardForm;
LoginPage.CardSignUp = LoginCardSignUp;
LoginPage.CardInput = LoginCardInput;
LoginPage.CardInputWarning = LoginCardInputWarning;
LoginPage.CardSettings = LoginCardSettings;
LoginPage.FormError = LoginFormError;
LoginPage.CardForgotPassword = LoginCardForgotPassword;
LoginPage.CardRememberMe = LoginCardRememberMe;
LoginPage.CardSocialSection = LoginCardSocialSection;
LoginPage.CardSocialLink = LoginCardSocialLink;
LoginPage.CardSocialColumns = LoginCardSocialColumns;
LoginPage.SocialLoginCard = SocialLoginCard;
LoginPage.BasicLoginCardLayout = BasicLoginCardLayout;

LoginPagePattern.propTypes = {
container: PropTypes.shape({ ...LoginPage.Container.propTypes }),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { Nav } from 'react-bootstrap';
import { default as NavItem } from './NavItem';

Nav.Item = NavItem;

export default Nav;
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import paginate from './paginate';
import { PAGINATION_VIEW, PAGINATION_VIEW_TYPES } from './PaginationConstants';
import Pager from './Pager';
import Paginator from './Paginator';
import PaginationRow from './PaginationRow';
import PaginationRowAmountOfPages from './PaginationRowAmountOfPages';
import PaginationRowArrowIcon from './PaginationRowArrowIcon';
import PaginationRowBack from './PaginationRowBack';
import PaginationRowButtonGroup from './PaginationRowButtonGroup';
import PaginationRowForward from './PaginationRowForward';
import PaginationRowItems from './PaginationRowItems';

export const Pagination = {
paginate,
Pager,
Paginator,
PAGINATION_VIEW,
PAGINATION_VIEW_TYPES,
Row: PaginationRow,
RowAmountOfPages: PaginationRowAmountOfPages,
RowArrowIcon: PaginationRowArrowIcon,
RowBack: PaginationRowBack,
RowButtonGroup: PaginationRowButtonGroup,
RowForward: PaginationRowForward,
RowItems: PaginationRowItems
};
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Icon, MessageDialog } from '../../index';
import CountDownSessionTimeout from './CountDownSessionTimeout';

const SessionTimeout = props => (
<MessageDialog
Expand Down Expand Up @@ -40,4 +41,6 @@ SessionTimeout.defaultProps = {
)
};

SessionTimeout.CountDown = CountDownSessionTimeout;

export default SessionTimeout;
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
import { Tabs } from 'react-bootstrap';
import { default as TabContainer } from './TabContainer';
import { default as TabContent } from './TabContent';
import { default as TabPane } from './TabPane';
import { default as Tab } from './Tab';

Tabs.Tab = Tab;
Tabs.TabContainer = TabContainer;
Tabs.TabContent = TabContent;
Tabs.TabPane = TabPane;

export default Tabs;
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import Timer from '../../common/Timer';
import ToastNotification from './ToastNotification';
import { Alert } from '../Alert';

/**
* TimedToastNotification Component for Patternfly React
Expand Down Expand Up @@ -65,7 +66,7 @@ class TimedToastNotification extends React.Component {
}

TimedToastNotification.propTypes = {
...ToastNotification.propTypes,
...Alert.propTypes,
/** pauses notification from dismissing */
paused: PropTypes.bool,
/** persistent keeps the notification up endlessly until closed */
Expand All @@ -78,12 +79,12 @@ TimedToastNotification.propTypes = {
onMouseLeave: PropTypes.func
};
TimedToastNotification.defaultProps = {
...ToastNotification.defaultProps,
...Alert.defaultProps,
paused: false,
timerdelay: 8000
};

TimedToastNotification.TOAST_NOTIFICATION_TYPES = [...ToastNotification.TOAST_NOTIFICATION_TYPES];
TimedToastNotification.TOAST_NOTIFICATION_TYPES = [...Alert.ALERT_TYPES];

TimedToastNotification.displayName = 'TimedToastNotification';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import classNames from 'classnames';
import React from 'react';
import { Alert } from '../Alert';
import { default as TimedToastNotification } from './TimedToastNotification';
import { default as ToastNotificationList } from './ToastNotificationList';

/**
* ToastNotification Component for Patternfly React
Expand All @@ -15,9 +17,13 @@ const ToastNotification = ({ children, className, ...props }) => {
);
};

// WARNING: If you change propTypes OR defaultProps you MUST also change TimedToastNotification
ToastNotification.propTypes = { ...Alert.propTypes };
ToastNotification.defaultProps = { ...Alert.defaultProps };

// WARNING: If you change TOAST_NOTIFICATION_TYPES you MUST also change TimedToastNotification
ToastNotification.TOAST_NOTIFICATION_TYPES = [...Alert.ALERT_TYPES];
ToastNotification.Timed = TimedToastNotification;
ToastNotification.List = ToastNotificationList;

export default ToastNotification;
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import classNames from 'classnames';
import { noop, KEYS } from '../../common/helpers';

import TreeViewNode from './TreeViewNode';
import TreeViewExpand from './TreeViewExpand';
import TreeViewIcon from './TreeViewIcon';
import TreeViewIndents from './TreeViewIndents';

class TreeView extends React.Component {
state = {
Expand Down Expand Up @@ -126,4 +129,9 @@ TreeView.defaultProps = {
accessibleName: ''
};

TreeView.Node = TreeViewNode;
TreeView.Expand = TreeViewExpand;
TreeView.Icon = TreeViewIcon;
TreeView.Indents = TreeViewIndents;

export default TreeView;
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
menuItemContainer,
tokenContainer
} from 'react-bootstrap-typeahead';
import AsyncTypeAheadSelect from './AsyncTypeAheadSelect';

TypeAheadSelect.Highlighter = Highlighter;
TypeAheadSelect.Menu = Menu;
Expand All @@ -19,4 +20,6 @@ TypeAheadSelect.asyncContainer = asyncContainer;
TypeAheadSelect.menuItemContainer = menuItemContainer;
TypeAheadSelect.tokenContainer = tokenContainer;

TypeAheadSelect.Async = AsyncTypeAheadSelect;

export default TypeAheadSelect;

0 comments on commit b63fc27

Please sign in to comment.