diff --git a/packages/react-core/src/components/Toolbar/ToolbarContent.tsx b/packages/react-core/src/components/Toolbar/ToolbarContent.tsx index a5003a378a2..99e7db4394a 100644 --- a/packages/react-core/src/components/Toolbar/ToolbarContent.tsx +++ b/packages/react-core/src/components/Toolbar/ToolbarContent.tsx @@ -17,14 +17,8 @@ export interface ToolbarContentProps extends React.HTMLProps { xl?: 'hidden' | 'visible'; '2xl'?: 'hidden' | 'visible'; }; - /** Alignment at various breakpoints. */ - alignment?: { - default?: 'alignRight' | 'alignLeft'; - md?: 'alignRight' | 'alignLeft'; - lg?: 'alignRight' | 'alignLeft'; - xl?: 'alignRight' | 'alignLeft'; - '2xl'?: 'alignRight' | 'alignLeft'; - }; + /** Vertical alignment of children */ + alignItems?: 'center' | 'default'; /** Content to be rendered as children of the content row */ children?: React.ReactNode; /** Flag indicating if a data toolbar toggle group's expandable content is expanded */ @@ -57,7 +51,7 @@ export class ToolbarContent extends React.Component { isExpanded, toolbarId, visibility, - alignment, + alignItems, clearAllFilters, showClearFiltersButton, clearFiltersButtonText, @@ -71,7 +65,6 @@ export class ToolbarContent extends React.Component { className={css( styles.toolbarContent, formatBreakpointMods(visibility, styles, '', getBreakpoint(width)), - formatBreakpointMods(alignment, styles, '', getBreakpoint(width)), className )} {...props} @@ -93,7 +86,14 @@ export class ToolbarContent extends React.Component { chipContainerRef: this.chipContainerRef }} > -
{children}
+
+ {children} +
, xl?: 'hidden' | 'visible'; '2xl'?: 'hidden' | 'visible'; }; - /** Alignment at various breakpoints. */ - alignment?: { + /** Applies to a child of a flex layout, and aligns that child (and any adjacent children on the other side of it) to one side of the main axis */ + align?: { default?: 'alignRight' | 'alignLeft'; md?: 'alignRight' | 'alignLeft'; lg?: 'alignRight' | 'alignLeft'; xl?: 'alignRight' | 'alignLeft'; '2xl'?: 'alignRight' | 'alignLeft'; }; + /** Vertical alignment of children */ + alignItems?: 'center' | 'baseline' | 'default'; + /** Vertical alignment */ + alignSelf?: 'center' | 'baseline' | 'default'; /** Spacers at various breakpoints. */ spacer?: { default?: 'spacerNone' | 'spacerSm' | 'spacerMd' | 'spacerLg'; @@ -55,7 +59,19 @@ export interface ToolbarGroupProps extends Omit, class ToolbarGroupWithRef extends React.Component { render() { - const { visibility, alignment, spacer, spaceItems, className, variant, children, innerRef, ...props } = this.props; + const { + visibility, + align, + alignItems, + alignSelf, + spacer, + spaceItems, + className, + variant, + children, + innerRef, + ...props + } = this.props; return ( @@ -65,9 +81,13 @@ class ToolbarGroupWithRef extends React.Component { styles.toolbarGroup, variant && styles.modifiers[toCamel(variant) as 'filterGroup' | 'iconButtonGroup' | 'buttonGroup'], formatBreakpointMods(visibility, styles, '', getBreakpoint(width)), - formatBreakpointMods(alignment, styles, '', getBreakpoint(width)), + formatBreakpointMods(align, styles, '', getBreakpoint(width)), formatBreakpointMods(spacer, styles, '', getBreakpoint(width)), formatBreakpointMods(spaceItems, styles, '', getBreakpoint(width)), + alignItems === 'center' && styles.modifiers.alignItemsCenter, + alignItems === 'baseline' && styles.modifiers.alignItemsBaseline, + alignSelf === 'center' && styles.modifiers.alignSelfCenter, + alignSelf === 'baseline' && styles.modifiers.alignSelfBaseline, className )} {...props} diff --git a/packages/react-core/src/components/Toolbar/ToolbarItem.tsx b/packages/react-core/src/components/Toolbar/ToolbarItem.tsx index d74c3d561d0..dfa21ca2596 100644 --- a/packages/react-core/src/components/Toolbar/ToolbarItem.tsx +++ b/packages/react-core/src/components/Toolbar/ToolbarItem.tsx @@ -39,14 +39,16 @@ export interface ToolbarItemProps extends React.HTMLProps { xl?: 'hidden' | 'visible'; '2xl'?: 'hidden' | 'visible'; }; - /** Alignment at various breakpoints. */ - alignment?: { + /** Applies to a child of a flex layout, and aligns that child (and any adjacent children on the other side of it) to one side of the main axis */ + align?: { default?: 'alignRight' | 'alignLeft'; md?: 'alignRight' | 'alignLeft'; lg?: 'alignRight' | 'alignLeft'; xl?: 'alignRight' | 'alignLeft'; '2xl'?: 'alignRight' | 'alignLeft'; }; + /** Vertical alignment */ + alignSelf?: 'center' | 'baseline' | 'default'; /** Spacers at various breakpoints. */ spacer?: { default?: 'spacerNone' | 'spacerSm' | 'spacerMd' | 'spacerLg'; @@ -76,9 +78,10 @@ export const ToolbarItem: React.FunctionComponent = ({ className, variant, visibility, - alignment, spacer, widths, + align, + alignSelf, id, children, isAllExpanded, @@ -114,8 +117,10 @@ export const ToolbarItem: React.FunctionComponent = ({ ], isAllExpanded && styles.modifiers.expanded, formatBreakpointMods(visibility, styles, '', getBreakpoint(width)), - formatBreakpointMods(alignment, styles, '', getBreakpoint(width)), + formatBreakpointMods(align, styles, '', getBreakpoint(width)), formatBreakpointMods(spacer, styles, '', getBreakpoint(width)), + alignSelf === 'center' && styles.modifiers.alignSelfCenter, + alignSelf === 'baseline' && styles.modifiers.alignSelfBaseline, className )} {...(variant === 'label' && { 'aria-hidden': true })} diff --git a/packages/react-core/src/components/Toolbar/examples/ToolbarStacked.tsx b/packages/react-core/src/components/Toolbar/examples/ToolbarStacked.tsx index 26d902b8e7f..8bd16ab6abd 100644 --- a/packages/react-core/src/components/Toolbar/examples/ToolbarStacked.tsx +++ b/packages/react-core/src/components/Toolbar/examples/ToolbarStacked.tsx @@ -228,7 +228,7 @@ export const ToolbarStacked: React.FunctionComponent = () => { dropdownItems={splitButtonDropdownItems} /> - + - + {this.renderPagination()} diff --git a/packages/react-core/src/demos/NotificationDrawer/NotificationDrawer.md b/packages/react-core/src/demos/NotificationDrawer/NotificationDrawer.md index 8e1635e6072..7814540bf3f 100644 --- a/packages/react-core/src/demos/NotificationDrawer/NotificationDrawer.md +++ b/packages/react-core/src/demos/NotificationDrawer/NotificationDrawer.md @@ -238,7 +238,7 @@ class BasicNotificationDrawer extends React.Component { const headerToolbar = ( - + - + - {leftAlignedItems} - {rightAlignedItems} + {leftAlignedItems} + {rightAlignedItems} ); diff --git a/packages/react-core/src/demos/examples/DashboardHeader.js b/packages/react-core/src/demos/examples/DashboardHeader.js index d6dcefd53be..0961ea0547a 100644 --- a/packages/react-core/src/demos/examples/DashboardHeader.js +++ b/packages/react-core/src/demos/examples/DashboardHeader.js @@ -145,7 +145,7 @@ export default class DashboardHeader extends React.Component { {notificationBadge ? ( diff --git a/packages/react-core/src/demos/examples/Masthead/MastheadWithUtilitiesAndUserDropdownMenu.tsx b/packages/react-core/src/demos/examples/Masthead/MastheadWithUtilitiesAndUserDropdownMenu.tsx index 8163a7e4578..e32601732b3 100644 --- a/packages/react-core/src/demos/examples/Masthead/MastheadWithUtilitiesAndUserDropdownMenu.tsx +++ b/packages/react-core/src/demos/examples/Masthead/MastheadWithUtilitiesAndUserDropdownMenu.tsx @@ -157,7 +157,7 @@ export const MastheadWithUtilitiesAndUserDropdownMenu: React.FunctionComponent = diff --git a/packages/react-core/src/demos/examples/Page/PageStickySectionBreadcrumb.tsx b/packages/react-core/src/demos/examples/Page/PageStickySectionBreadcrumb.tsx index 085dec5d174..e293f9719ff 100644 --- a/packages/react-core/src/demos/examples/Page/PageStickySectionBreadcrumb.tsx +++ b/packages/react-core/src/demos/examples/Page/PageStickySectionBreadcrumb.tsx @@ -157,7 +157,7 @@ export const PageStickySectionBreadcrumb: React.FunctionComponent = () => { diff --git a/packages/react-core/src/demos/examples/Page/PageStickySectionGroup.tsx b/packages/react-core/src/demos/examples/Page/PageStickySectionGroup.tsx index 9c8e053c927..19f602ad443 100644 --- a/packages/react-core/src/demos/examples/Page/PageStickySectionGroup.tsx +++ b/packages/react-core/src/demos/examples/Page/PageStickySectionGroup.tsx @@ -157,7 +157,7 @@ export const PageStickySectionGroup: React.FunctionComponent = () => { diff --git a/packages/react-core/src/demos/examples/Page/PageStickySectionGroupAlternate.tsx b/packages/react-core/src/demos/examples/Page/PageStickySectionGroupAlternate.tsx index 3c5c34240aa..d1daf4d3fa1 100644 --- a/packages/react-core/src/demos/examples/Page/PageStickySectionGroupAlternate.tsx +++ b/packages/react-core/src/demos/examples/Page/PageStickySectionGroupAlternate.tsx @@ -148,7 +148,7 @@ export const PageStickySectionGroupAlternate: React.FunctionComponent = () => { diff --git a/packages/react-integration/demo-app-ts/src/components/demos/MastheadDemo/MastheadDemo.tsx b/packages/react-integration/demo-app-ts/src/components/demos/MastheadDemo/MastheadDemo.tsx index 79bacf05e87..02282f20ff2 100644 --- a/packages/react-integration/demo-app-ts/src/components/demos/MastheadDemo/MastheadDemo.tsx +++ b/packages/react-integration/demo-app-ts/src/components/demos/MastheadDemo/MastheadDemo.tsx @@ -155,7 +155,7 @@ export class MastheadDemo extends React.Component { ))} - +