Skip to content

Commit

Permalink
Merge branch 'master' into update-share-image
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Feb 25, 2021
2 parents 3b53fa5 + 6b19480 commit 3eb525d
Show file tree
Hide file tree
Showing 15 changed files with 68 additions and 188 deletions.
3 changes: 2 additions & 1 deletion packages/components/src/components/checkbox/_checkbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@
// different checkbox states.
width: rem(16px);
height: rem(16px);
margin: rem(2px);
// increase left margin for #6480
margin: rem(2px) rem(2px) rem(2px) rem(3px);

// Checkboxes with a background color look visually off against a parent container.
background-color: transparent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ $css--helpers: true;
align-items: center;
justify-content: space-between;

width: 100%;
width: calc(100% - 1px);
min-height: rem(48px);
overflow-x: auto;
background-color: $ui-01;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,13 @@
}
}

//-----------------------------
// Skeleton
//-----------------------------
.#{$prefix}--skeleton.#{$prefix}--text-input {
@include skeleton;
}

//-----------------------------
// Fluid Text Input
//-----------------------------
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/components/Accordion/AccordionItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function AccordionItem({
});

if (open !== prevIsOpen) {
setAnimation(isOpen ? 'collapsing' : 'expanding');
setIsOpen(open);
setPrevIsOpen(open);
}
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/components/Button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const Button = React.forwardRef(function Button(
let otherProps = {
disabled,
type,
'aria-pressed': hasIconOnly && kind === 'ghost' ? isSelected : null,
};
const anchorProps = {
href,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2060,6 +2060,7 @@ exports[`DataTable should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--btn bx--btn--primary"
disabled={false}
onClick={[MockFunction]}
Expand Down Expand Up @@ -2132,6 +2133,7 @@ exports[`DataTable should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--btn bx--btn--primary"
disabled={false}
onClick={[MockFunction]}
Expand Down Expand Up @@ -2204,6 +2206,7 @@ exports[`DataTable should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--btn bx--btn--primary"
disabled={false}
onClick={[MockFunction]}
Expand Down Expand Up @@ -2262,6 +2265,7 @@ exports[`DataTable should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--batch-summary__cancel bx--btn bx--btn--primary"
disabled={false}
onClick={[Function]}
Expand Down Expand Up @@ -2515,6 +2519,7 @@ exports[`DataTable should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--btn bx--btn--sm bx--btn--primary"
disabled={false}
onClick={[MockFunction]}
Expand Down Expand Up @@ -3066,6 +3071,7 @@ exports[`DataTable sticky header should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--btn bx--btn--primary"
disabled={false}
onClick={[MockFunction]}
Expand Down Expand Up @@ -3138,6 +3144,7 @@ exports[`DataTable sticky header should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--btn bx--btn--primary"
disabled={false}
onClick={[MockFunction]}
Expand Down Expand Up @@ -3210,6 +3217,7 @@ exports[`DataTable sticky header should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--btn bx--btn--primary"
disabled={false}
onClick={[MockFunction]}
Expand Down Expand Up @@ -3268,6 +3276,7 @@ exports[`DataTable sticky header should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--batch-summary__cancel bx--btn bx--btn--primary"
disabled={false}
onClick={[Function]}
Expand Down Expand Up @@ -3521,6 +3530,7 @@ exports[`DataTable sticky header should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--btn bx--btn--sm bx--btn--primary"
disabled={false}
onClick={[MockFunction]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ exports[`DataTable.TableBatchAction should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="custom-class bx--btn bx--btn--primary"
disabled={false}
tabIndex={0}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ exports[`DataTable.TableBatchActions should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--batch-summary__cancel bx--btn bx--btn--primary"
disabled={false}
onClick={[MockFunction]}
Expand Down Expand Up @@ -93,6 +94,7 @@ exports[`DataTable.TableBatchActions should render 2`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--batch-summary__cancel bx--btn bx--btn--primary"
disabled={false}
onClick={[MockFunction]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ exports[`ModalWrapper should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="btn-trigger bx--btn bx--btn--primary"
disabled={false}
onClick={[Function]}
Expand Down Expand Up @@ -171,6 +172,7 @@ exports[`ModalWrapper should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--btn bx--btn--secondary"
disabled={false}
onClick={[Function]}
Expand All @@ -192,6 +194,7 @@ exports[`ModalWrapper should render 1`] = `
type="button"
>
<button
aria-pressed={null}
className="bx--btn bx--btn--primary"
disabled={false}
onClick={[Function]}
Expand Down
8 changes: 7 additions & 1 deletion packages/react/src/components/MultiSelect/MultiSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ const MultiSelect = React.forwardRef(function MultiSelect(
...downshiftProps,
highlightedIndex,
isOpen,
itemToString,
itemToString: (items) => {
return items.map((item) => itemToString(item)).join(', ');
},
onStateChange,
selectedItem: controlledSelectedItems,
items,
Expand Down Expand Up @@ -245,6 +247,9 @@ const MultiSelect = React.forwardRef(function MultiSelect(
sortItems(items, sortOptions).map((item, index) => {
const itemProps = getItemProps({
item,
// we don't want Downshift to set aria-selected for us
// we also don't want to set 'false' for reader verbosity's sake
['aria-selected']: isChecked ? true : null,
});
const itemText = itemToString(item);
const isChecked =
Expand All @@ -254,6 +259,7 @@ const MultiSelect = React.forwardRef(function MultiSelect(
<ListBox.MenuItem
key={itemProps.id}
isActive={isChecked}
aria-label={itemText}
isHighlighted={highlightedIndex === index}
title={itemText}
{...itemProps}>
Expand Down
125 changes: 21 additions & 104 deletions packages/react/src/components/OverflowMenu/OverflowMenu-story.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
import React from 'react';
import { action } from '@storybook/addon-actions';
import { withKnobs, boolean, select, text } from '@storybook/addon-knobs';
import { withReadme } from 'storybook-readme';
import OverflowMenu from '../OverflowMenu';
import { OverflowMenu as OGOverflowMenu } from './OverflowMenu';
import OverflowMenuItem from '../OverflowMenuItem';
import OverflowREADME from './README.md';
import mdx from './OverflowMenu.mdx';
import { Filter16 } from '@carbon/icons-react';

const directions = {
'Bottom of the trigger button (bottom)': 'bottom',
Expand Down Expand Up @@ -70,126 +69,44 @@ export default {
},
};

export const Basic = withReadme(OverflowREADME, () => (
<OverflowMenu {...props.menu()}>
<OverflowMenuItem {...props.menuItem()} itemText="Option 1" />
<OverflowMenuItem
{...props.menuItem()}
itemText="Option 2 is an example of a really long string and how we recommend handling this"
requireTitle
title="Custom tooltip title"
/>
<OverflowMenuItem {...props.menuItem()} itemText="Option 3" />
<OverflowMenuItem {...props.menuItem()} itemText="Option 4" />
<OverflowMenuItem
{...props.menuItem()}
requireTitle
itemText="Danger option"
hasDivider
isDelete
/>
export const _Default = () => (
<OverflowMenu>
<OverflowMenuItem itemText="Stop app" />
<OverflowMenuItem itemText="Restart app" />
<OverflowMenuItem itemText="Rename app" />
<OverflowMenuItem itemText="Edit routes and access" requireTitle />
<OverflowMenuItem hasDivider isDelete itemText="Delete app" />
</OverflowMenu>
));

Basic.storyName = 'basic';
);

Basic.parameters = {
info: {
text: `
Overflow Menu is used when additional options are available to the user and there is a space constraint.
Create Overflow Menu Item components for each option on the menu.
`,
},
_Default.story = {
name: 'Overflow Menu',
};

export const WithLinks = withReadme(OverflowREADME, () => (
<OverflowMenu {...props.menu()}>
<OverflowMenuItem
{...{
...props.menuItem(),
href: 'https://www.ibm.com',
}}
itemText="Option 1"
/>
<OverflowMenuItem
{...{
...props.menuItem(),
href: 'https://www.ibm.com',
}}
itemText="Option 2 is an example of a really long string and how we recommend handling this"
requireTitle
/>
<OverflowMenuItem
{...{
...props.menuItem(),
href: 'https://www.ibm.com',
}}
itemText="Option 3"
/>
<OverflowMenuItem
{...{
...props.menuItem(),
href: 'https://www.ibm.com',
}}
itemText="Option 4"
/>
<OverflowMenuItem
{...{
...props.menuItem(),
href: 'https://www.ibm.com',
}}
itemText="Danger option"
hasDivider
isDelete
/>
export const RenderCustomIcon = () => (
<OverflowMenu renderIcon={Filter16}>
<OverflowMenuItem itemText="Filter A" />
<OverflowMenuItem itemText="Filter B" />
</OverflowMenu>
));

WithLinks.storyName = 'with links';
);

WithLinks.parameters = {
info: {
text: `
Overflow Menu is used when additional options are available to the user and there is a space constraint.
Create Overflow Menu Item components for each option on the menu.
When given \`href\` props, menu items render as <a> tags to facilitate usability.
`,
},
};

export const CustomTrigger = withReadme(OverflowREADME, () => (
<OverflowMenu
{...{
...props.menu(),
ariaLabel: null,
style: { width: 'auto' },
// eslint-disable-next-line react/display-name
renderIcon: () => <div style={{ padding: '0 1rem' }}>Menu</div>,
}}>
export const Playground = () => (
<OverflowMenu {...props.menu()}>
<OverflowMenuItem {...props.menuItem()} itemText="Option 1" />
<OverflowMenuItem
{...props.menuItem()}
itemText="Option 2 is an example of a really long string and how we recommend handling this"
requireTitle
title="Custom tooltip title"
/>
<OverflowMenuItem {...props.menuItem()} itemText="Option 3" />
<OverflowMenuItem {...props.menuItem()} itemText="Option 4" />
<OverflowMenuItem
{...props.menuItem()}
requireTitle
itemText="Danger option"
hasDivider
isDelete
/>
</OverflowMenu>
));

CustomTrigger.storyName = 'custom trigger';

CustomTrigger.parameters = {
info: {
text: `
Sometimes you just want to render something other than an icon
`,
},
};
);
10 changes: 10 additions & 0 deletions packages/react/src/components/OverflowMenu/OverflowMenu.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@ import { Props } from '@storybook/addon-docs/blocks';

## Overview

The overflow menu component is a clickable element that contains additional
options that are available to the user, but there is a space constraint.

### `data-floating-menu-container`

`OverflowMenu` uses React Portals to render the overflow menu into the DOM. To
determine where in the DOM the menu will be placed, it looks for a parent
element with the `data-floating-menu-container` attribute. If none parent with
this attribute is found, the menu will be placed on `document.body`.

## Component API

<Props />
Expand Down
Loading

0 comments on commit 3eb525d

Please sign in to comment.