Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(subcomponents): Make all subcomponents available from base component #916

Merged
merged 1 commit into from
Nov 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,19 @@ 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 {
UtilizationCard,
UtilizationCardDetails,
UtilizationCardDetailsCount,
UtilizationCardDetailsDesc,
UtilizationCardDetailsLine1,
UtilizationCardDetailsLine2
} from './UtilizationTrendCard';

import { AggregateStatusCount, AggregateStatusNotifications, AggregateStatusNotification } from './AggregateStatusCard';

/**
* Card Component for PatternFly React
Expand Down Expand Up @@ -63,7 +74,17 @@ Card.Body = CardBody;
Card.Heading = CardHeading;
Card.Footer = CardFooter;
Card.Link = CardLink;
Card.Grid = CardGrid;
Card.DropdownButton = CardDropdownButton;
Card.HeightMatching = CardHeightMatching;
Card.UtilizationCard = UtilizationCard;
Card.UtilizationCardDetails = UtilizationCardDetails;
Card.UtilizationCardDetailsCount = UtilizationCardDetailsCount;
Card.UtilizationCardDetailsDesc = UtilizationCardDetailsDesc;
Card.UtilizationCardDetailsLine1 = UtilizationCardDetailsLine1;
Card.UtilizationCardDetailsLine2 = UtilizationCardDetailsLine2;
Card.AggregateStatusCount = AggregateStatusCount;
Card.AggregateStatusNotifications = AggregateStatusNotifications;
Card.AggregateStatusNotification = 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,26 @@
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} />;

// WARNING: This should be kept consistent with Label.propTypes
DisposableLabel.propTypes = {
...Label.propTypes
...BsLabel.propTypes,
/** Children nodes */
children: PropTypes.node,
/** Label type */
type: PropTypes.string,
/** callback when Label is removed */
onRemoveClick: PropTypes.func
};

// WARNING: This should be kept consistent with Label.defaultProps
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,9 @@ 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';
import LabelWithTooltip from './LabelWithTooltip';

const Label = ({ children, onRemoveClick, type, ...props }) => (
<BsLabel bsStyle={type} {...props}>
Expand All @@ -10,6 +13,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 +24,16 @@ 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;
Label.WithTooltop = LabelWithTooltip;

cdcabrera marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -64,8 +65,9 @@ class TimedToastNotification extends React.Component {
}
}

// WARNING: This should be kept consistent with ToastNotification.propTypes
TimedToastNotification.propTypes = {
...ToastNotification.propTypes,
...Alert.propTypes,
/** pauses notification from dismissing */
paused: PropTypes.bool,
/** persistent keeps the notification up endlessly until closed */
Expand All @@ -77,13 +79,14 @@ TimedToastNotification.propTypes = {
/** onMouseLeave callback */
onMouseLeave: PropTypes.func
};
// WARNING: This should be kept consistent with ToastNotification.defaultProps
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];
cdcabrera marked this conversation as resolved.
Show resolved Hide resolved

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;
Loading