diff --git a/CHANGELOG.md b/CHANGELOG.md index b62a1d0b..7ad4d2b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,9 @@ ## HEAD -- Add **MbxButton** component. -- Add **MbxIconText** component. -- Add **MbxUnderlineTabs** component. +- Add **Button** component. +- Add **IconText** component. +- Add **UnderlineTabs** component. - **PopoverTrigger** - If the trigger responds to focus but not click, and you focus the trigger *first* and *then* click, that click *closes* the popover instead of leaving it open even after you move the mouse away. diff --git a/src/components/mbx-button/__tests__/__snapshots__/mbx-button.test.js.snap b/src/components/button/__tests__/__snapshots__/button.test.js.snap similarity index 98% rename from src/components/mbx-button/__tests__/__snapshots__/mbx-button.test.js.snap rename to src/components/button/__tests__/__snapshots__/button.test.js.snap index 0075c14b..c8c21494 100644 --- a/src/components/mbx-button/__tests__/__snapshots__/mbx-button.test.js.snap +++ b/src/components/button/__tests__/__snapshots__/button.test.js.snap @@ -76,12 +76,12 @@ exports[`Link with outline and icon text, extra padding renders as expected 1`] href="#" onClick={[MockFunction]} > - Go do things - + `; diff --git a/src/components/mbx-button/__tests__/mbx-button-test-cases.js b/src/components/button/__tests__/button-test-cases.js similarity index 83% rename from src/components/mbx-button/__tests__/mbx-button-test-cases.js rename to src/components/button/__tests__/button-test-cases.js index d0b6652d..a75f11b0 100644 --- a/src/components/mbx-button/__tests__/mbx-button-test-cases.js +++ b/src/components/button/__tests__/button-test-cases.js @@ -1,13 +1,13 @@ import React from 'react'; import safeSpy from '../../../test-utils/safe-spy'; -import MbxButton from '../mbx-button'; -import MbxIconText from '../../mbx-icon-text'; +import Button from '../button'; +import IconText from '../../icon-text'; const testCases = {}; testCases.primary = { description: 'Primary', - component: MbxButton, + component: Button, props: { children: 'Primary', onClick: safeSpy() @@ -16,7 +16,7 @@ testCases.primary = { testCases.secondary = { description: 'Secondary', - component: MbxButton, + component: Button, props: { children: 'Secondary', variant: 'secondary', @@ -26,7 +26,7 @@ testCases.secondary = { testCases.discouraging = { description: 'Discouraging', - component: MbxButton, + component: Button, props: { children: 'Discouraging', variant: 'discouraging', @@ -36,7 +36,7 @@ testCases.discouraging = { testCases.destructive = { description: 'Destructive', - component: MbxButton, + component: Button, props: { children: 'Destructive', variant: 'destructive', @@ -46,7 +46,7 @@ testCases.destructive = { testCases.appPrimary = { description: 'AppPrimary', - component: MbxButton, + component: Button, props: { children: 'AppPrimary', variant: 'appPrimary', @@ -56,7 +56,7 @@ testCases.appPrimary = { testCases.appSecondary = { description: 'AppSecondary', - component: MbxButton, + component: Button, props: { children: 'AppSecondary', variant: 'appSecondary', @@ -66,9 +66,9 @@ testCases.appSecondary = { testCases.linkOutlinePadding = { description: 'Link with outline and icon text, extra padding', - component: MbxButton, + component: Button, props: { - children: Go do things, + children: Go do things, href: '#', onClick: safeSpy(), outline: true, @@ -78,7 +78,7 @@ testCases.linkOutlinePadding = { testCases.fullWidthPurple = { description: 'Full width, alternate color', - component: MbxButton, + component: Button, props: { children: 'Here we are', color: 'purple', @@ -89,7 +89,7 @@ testCases.fullWidthPurple = { testCases.weird = { description: 'Div styled like a medium destructive button with some extended props and transformed classes', - component: MbxButton, + component: Button, props: { children: 'Save', size: 'medium', @@ -106,7 +106,7 @@ testCases.weird = { testCases.disabled = { description: 'Disabled', - component: MbxButton, + component: Button, props: { children: 'Oops', disabled: true @@ -115,7 +115,7 @@ testCases.disabled = { testCases.disabledSecondary = { description: 'Disabled secondary', - component: MbxButton, + component: Button, props: { children: 'Oops', disabled: true, @@ -126,7 +126,7 @@ testCases.disabledSecondary = { testCases.disabledSpecial = { description: 'Disabled appPrimary with color', - component: MbxButton, + component: Button, props: { children: 'Oops', variant: 'appPrimary', diff --git a/src/components/mbx-button/__tests__/mbx-button.test.js b/src/components/button/__tests__/button.test.js similarity index 98% rename from src/components/mbx-button/__tests__/mbx-button.test.js rename to src/components/button/__tests__/button.test.js index 12e09a74..975c6956 100644 --- a/src/components/mbx-button/__tests__/mbx-button.test.js +++ b/src/components/button/__tests__/button.test.js @@ -2,7 +2,7 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { testCases } from './mbx-button-test-cases'; +import { testCases } from './button-test-cases'; describe(testCases.primary.description, () => { let testCase; diff --git a/src/components/mbx-button/mbx-button.js b/src/components/button/button.js similarity index 96% rename from src/components/mbx-button/mbx-button.js rename to src/components/button/button.js index 4a38a433..b5a56f56 100644 --- a/src/components/mbx-button/mbx-button.js +++ b/src/components/button/button.js @@ -30,14 +30,14 @@ const propNames = [ * render a different element altogether.) * * If you'd like to put an icon before or after the text of your button, - * use [MbxIconText](#mbxicontext) for the content. + * use [IconText](#mbxicontext) for the content. * * Any props you provide other than those documented here are passed through * directly to the element itself. This can be useful if you want to disable * the button, assign an ID for testing, add an ARIA attribute, toss in some * custom style properties, etc. */ -class MbxButton extends React.Component { +class Button extends React.Component { render() { const props = applyVariant(this.props); @@ -151,11 +151,11 @@ function applyVariant(props) { } } -MbxButton.propTypes = { +Button.propTypes = { /** * The button's content. A string is recommended, but you can put an element * in here if you think that's right. If you do, it should be inline-level, - * using ``s instead of `
`s. ([MbxIconText](#mbxicontext) is + * using ``s instead of `
`s. ([IconText](#mbxicontext) is * inline-level.) */ children: PropTypes.node.isRequired, @@ -245,10 +245,10 @@ MbxButton.propTypes = { component: PropTypes.oneOfType([PropTypes.func, PropTypes.string]) }; -MbxButton.defaultProps = { +Button.defaultProps = { variant: 'primary', block: false, transformClasses: x => x }; -export default MbxButton; +export default Button; diff --git a/src/components/mbx-button/examples/mbx-button-a.js b/src/components/button/examples/button-a.js similarity index 53% rename from src/components/mbx-button/examples/mbx-button-a.js rename to src/components/button/examples/button-a.js index ad1dbd9e..05b672eb 100644 --- a/src/components/mbx-button/examples/mbx-button-a.js +++ b/src/components/button/examples/button-a.js @@ -2,39 +2,39 @@ All the standard variants. */ import React from 'react'; -import MbxButton from '../mbx-button'; +import Button from '../button'; export default class Example extends React.Component { render() { return (
- Primary +
- +
- +
- +
- +
- +
); diff --git a/src/components/button/examples/button-b.js b/src/components/button/examples/button-b.js new file mode 100644 index 00000000..337bea24 --- /dev/null +++ b/src/components/button/examples/button-b.js @@ -0,0 +1,16 @@ +/* +A slightly wider, outlined button with an alternate color, using [IconText](#mbxicontext) to prefix the text with an icon. +*/ +import React from 'react'; +import Button from '../button'; +import IconText from '../../icon-text'; + +export default class Example extends React.Component { + render() { + return ( + + ); + } +} diff --git a/src/components/mbx-button/examples/mbx-button-c.js b/src/components/button/examples/button-c.js similarity index 80% rename from src/components/mbx-button/examples/mbx-button-c.js rename to src/components/button/examples/button-c.js index 84614546..ea822dd9 100644 --- a/src/components/mbx-button/examples/mbx-button-c.js +++ b/src/components/button/examples/button-c.js @@ -6,7 +6,7 @@ The additional prop `data-test` is passed on directly to the ``. Also, `transformClasses` is used to add the drop-shadow class. */ import React from 'react'; -import MbxButton from '../mbx-button'; +import Button from '../button'; export default class Example extends React.Component { render() { @@ -14,15 +14,15 @@ export default class Example extends React.Component { return `${variantClasses} shadow-darken25`; }; return ( -
- +
); } diff --git a/src/components/mbx-button/examples/mbx-button-d.js b/src/components/button/examples/button-d.js similarity index 74% rename from src/components/mbx-button/examples/mbx-button-d.js rename to src/components/button/examples/button-d.js index ce068967..26ea9701 100644 --- a/src/components/mbx-button/examples/mbx-button-d.js +++ b/src/components/button/examples/button-d.js @@ -5,7 +5,7 @@ wrapper container with an Assembly width class. Sometimes, for example, you might want a column or row of equal-width buttons. */ import React from 'react'; -import MbxButton from '../mbx-button'; +import Button from '../button'; export default class Example extends React.Component { render() { @@ -13,51 +13,51 @@ export default class Example extends React.Component {
- +
- +
- +
- A - +
- B - +
- C - +
diff --git a/src/components/button/index.js b/src/components/button/index.js new file mode 100644 index 00000000..ec63ae79 --- /dev/null +++ b/src/components/button/index.js @@ -0,0 +1,3 @@ +import main from './button'; + +export default main; diff --git a/src/components/mbx-icon-text/__tests__/__snapshots__/mbx-icon-text.test.js.snap b/src/components/icon-text/__tests__/__snapshots__/icon-text.test.js.snap similarity index 100% rename from src/components/mbx-icon-text/__tests__/__snapshots__/mbx-icon-text.test.js.snap rename to src/components/icon-text/__tests__/__snapshots__/icon-text.test.js.snap diff --git a/src/components/mbx-icon-text/__tests__/mbx-icon-text-test-cases.js b/src/components/icon-text/__tests__/icon-text-test-cases.js similarity index 79% rename from src/components/mbx-icon-text/__tests__/mbx-icon-text-test-cases.js rename to src/components/icon-text/__tests__/icon-text-test-cases.js index 986cb41b..66443e5d 100644 --- a/src/components/mbx-icon-text/__tests__/mbx-icon-text-test-cases.js +++ b/src/components/icon-text/__tests__/icon-text-test-cases.js @@ -1,12 +1,12 @@ import React from 'react'; -import MbxIconText from '../mbx-icon-text'; +import IconText from '../icon-text'; import Icon from '../../icon'; const testCases = {}; testCases.iconBefore = { description: 'icon before', - component: MbxIconText, + component: IconText, props: { children: 'Copy', iconBefore: 'clipboard' @@ -15,7 +15,7 @@ testCases.iconBefore = { testCases.iconAfter = { description: 'icon after', - component: MbxIconText, + component: IconText, props: { children: 'Next', iconAfter: 'chevron-right' @@ -24,7 +24,7 @@ testCases.iconAfter = { testCases.largeSpacing = { description: 'large spacing', - component: MbxIconText, + component: IconText, props: { children: 'Done', iconBefore: 'check', @@ -34,7 +34,7 @@ testCases.largeSpacing = { testCases.bothIcons = { description: 'icons on both sides, including a non-string one', - component: MbxIconText, + component: IconText, props: { children: 'What', iconBefore: 'check', @@ -46,7 +46,7 @@ testCases.buttonyDisplay = { description: 'a buttony look', element: ( ) }; diff --git a/src/components/mbx-icon-text/__tests__/mbx-icon-text.test.js b/src/components/icon-text/__tests__/icon-text.test.js similarity index 95% rename from src/components/mbx-icon-text/__tests__/mbx-icon-text.test.js rename to src/components/icon-text/__tests__/icon-text.test.js index 4f8234f3..3b3ab5df 100644 --- a/src/components/mbx-icon-text/__tests__/mbx-icon-text.test.js +++ b/src/components/icon-text/__tests__/icon-text.test.js @@ -1,6 +1,6 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { testCases } from './mbx-icon-text-test-cases'; +import { testCases } from './icon-text-test-cases'; let testCase; let wrapper; diff --git a/src/components/mbx-icon-text/examples/mbx-icon-text-a.js b/src/components/icon-text/examples/icon-text-a.js similarity index 71% rename from src/components/mbx-icon-text/examples/mbx-icon-text-a.js rename to src/components/icon-text/examples/icon-text-a.js index 0c447356..13d3e467 100644 --- a/src/components/mbx-icon-text/examples/mbx-icon-text-a.js +++ b/src/components/icon-text/examples/icon-text-a.js @@ -2,13 +2,13 @@ The standard button-without-a-background look. Also useful for menu items. */ import React from 'react'; -import MbxIconText from '../mbx-icon-text'; +import IconText from '../icon-text'; export default class Example extends React.Component { render() { return ( ); } diff --git a/src/components/mbx-icon-text/examples/mbx-icon-text-b.js b/src/components/icon-text/examples/icon-text-b.js similarity index 65% rename from src/components/mbx-icon-text/examples/mbx-icon-text-b.js rename to src/components/icon-text/examples/icon-text-b.js index 08ad0ec1..ad4e7b77 100644 --- a/src/components/mbx-icon-text/examples/mbx-icon-text-b.js +++ b/src/components/icon-text/examples/icon-text-b.js @@ -2,13 +2,13 @@ Go see the next thing! */ import React from 'react'; -import MbxIconText from '../mbx-icon-text'; +import IconText from '../icon-text'; export default class Example extends React.Component { render() { return ( ); } diff --git a/src/components/mbx-icon-text/mbx-icon-text.js b/src/components/icon-text/icon-text.js similarity index 93% rename from src/components/mbx-icon-text/mbx-icon-text.js rename to src/components/icon-text/icon-text.js index ae66add4..4768b462 100644 --- a/src/components/mbx-icon-text/mbx-icon-text.js +++ b/src/components/icon-text/icon-text.js @@ -7,7 +7,7 @@ import Icon from '../icon'; * * The icon and text will be vertically centered, with standard spacing between. */ -class MbxIconText extends React.Component { +class IconText extends React.Component { renderIcon(icon) { if (typeof icon === 'string') { return ; @@ -41,7 +41,7 @@ class MbxIconText extends React.Component { } } -MbxIconText.propTypes = { +IconText.propTypes = { /** * The text. A string is recommended, but you can put an element in here if * you think it's right. If you do, it should be inline-level, @@ -64,8 +64,8 @@ MbxIconText.propTypes = { iconAfter: PropTypes.oneOfType([PropTypes.node, PropTypes.string]) }; -MbxIconText.defaultProps = { +IconText.defaultProps = { spacing: 'small' }; -export default MbxIconText; +export default IconText; diff --git a/src/components/icon-text/index.js b/src/components/icon-text/index.js new file mode 100644 index 00000000..84cde856 --- /dev/null +++ b/src/components/icon-text/index.js @@ -0,0 +1,3 @@ +import main from './icon-text'; + +export default main; diff --git a/src/components/mbx-button/examples/mbx-button-b.js b/src/components/mbx-button/examples/mbx-button-b.js deleted file mode 100644 index c81944ba..00000000 --- a/src/components/mbx-button/examples/mbx-button-b.js +++ /dev/null @@ -1,16 +0,0 @@ -/* -A slightly wider, outlined button with an alternate color, using [MbxIconText](#mbxicontext) to prefix the text with an icon. -*/ -import React from 'react'; -import MbxButton from '../mbx-button'; -import MbxIconText from '../../mbx-icon-text'; - -export default class Example extends React.Component { - render() { - return ( - {}} width="large" outline={true} color="purple"> - Save your map - - ); - } -} diff --git a/src/components/mbx-button/index.js b/src/components/mbx-button/index.js deleted file mode 100644 index f5a42cc3..00000000 --- a/src/components/mbx-button/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import main from './mbx-button'; - -export default main; diff --git a/src/components/mbx-icon-text/index.js b/src/components/mbx-icon-text/index.js deleted file mode 100644 index 7fef3004..00000000 --- a/src/components/mbx-icon-text/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import main from './mbx-icon-text'; - -export default main; diff --git a/src/components/mbx-underline-tabs/index.js b/src/components/mbx-underline-tabs/index.js deleted file mode 100644 index b96b53ae..00000000 --- a/src/components/mbx-underline-tabs/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import main from './mbx-underline-tabs'; - -export default main; diff --git a/src/components/mbx-underline-tabs/__tests__/__snapshots__/mbx-underline-tabs.test.js.snap b/src/components/underline-tabs/__tests__/__snapshots__/underline-tabs.test.js.snap similarity index 99% rename from src/components/mbx-underline-tabs/__tests__/__snapshots__/mbx-underline-tabs.test.js.snap rename to src/components/underline-tabs/__tests__/__snapshots__/underline-tabs.test.js.snap index 7f426dbb..3737cd1e 100644 --- a/src/components/mbx-underline-tabs/__tests__/__snapshots__/mbx-underline-tabs.test.js.snap +++ b/src/components/underline-tabs/__tests__/__snapshots__/underline-tabs.test.js.snap @@ -289,7 +289,7 @@ exports[`large links with icons renders as expected 1`] = ` - MbxIconText + IconText - MbxIconText + IconText
@@ -344,7 +344,7 @@ exports[`large links with icons renders as expected 1`] = ` - MbxIconText + IconText diff --git a/src/components/mbx-underline-tabs/__tests__/mbx-underline-tabs-test-cases.js b/src/components/underline-tabs/__tests__/underline-tabs-test-cases.js similarity index 87% rename from src/components/mbx-underline-tabs/__tests__/mbx-underline-tabs-test-cases.js rename to src/components/underline-tabs/__tests__/underline-tabs-test-cases.js index 92ead6b7..71561df3 100644 --- a/src/components/mbx-underline-tabs/__tests__/mbx-underline-tabs-test-cases.js +++ b/src/components/underline-tabs/__tests__/underline-tabs-test-cases.js @@ -1,7 +1,7 @@ import React from 'react'; import PropTypes from 'prop-types'; -import MbxIconText from '../../mbx-icon-text'; -import MbxUnderlineTabs from '../mbx-underline-tabs'; +import IconText from '../../icon-text'; +import UnderlineTabs from '../underline-tabs'; import safeSpy from '../../../test-utils/safe-spy'; const testCases = {}; @@ -36,7 +36,7 @@ class InteractiveDemo extends React.Component { return (
- Disk, + label: Disk, href: '#' }, { id: 'B', - label: Alert, + label: Alert, href: '#' }, { id: 'C', - label: Book, + label: Book, href: '#' } ], @@ -229,7 +229,7 @@ testCases.largeLinksIcons = { testCases.customized = { description: 'customized', - component: MbxUnderlineTabs, + component: UnderlineTabs, props: { items: [ { @@ -257,7 +257,7 @@ testCases.customized = { testCases.idLabelsAndDisabledItem = { description: 'ID labels and a disabled item', - component: MbxUnderlineTabs, + component: UnderlineTabs, props: { items: [ { diff --git a/src/components/mbx-underline-tabs/__tests__/mbx-underline-tabs.test.js b/src/components/underline-tabs/__tests__/underline-tabs.test.js similarity index 94% rename from src/components/mbx-underline-tabs/__tests__/mbx-underline-tabs.test.js rename to src/components/underline-tabs/__tests__/underline-tabs.test.js index 5ab48b7c..da844734 100644 --- a/src/components/mbx-underline-tabs/__tests__/mbx-underline-tabs.test.js +++ b/src/components/underline-tabs/__tests__/underline-tabs.test.js @@ -1,11 +1,11 @@ /* eslint-disable react/display-name */ import React from 'react'; import { mount } from 'enzyme'; -import { testCases } from './mbx-underline-tabs-test-cases'; +import { testCases } from './underline-tabs-test-cases'; -jest.mock('../../mbx-icon-text', () => () => 'MbxIconText'); +jest.mock('../../icon-text', () => () => 'IconText'); -// Using Enzyme's mount instead of shallow in order to test MbxUnderlineTabItem +// Using Enzyme's mount instead of shallow in order to test UnderlineTabItem // at the same time, since its independent existence is an implementation // detail that may change. diff --git a/src/components/mbx-underline-tabs/examples/mbx-underline-tabs-a.js b/src/components/underline-tabs/examples/underline-tabs-a.js similarity index 77% rename from src/components/mbx-underline-tabs/examples/mbx-underline-tabs-a.js rename to src/components/underline-tabs/examples/underline-tabs-a.js index c6536acc..416da203 100644 --- a/src/components/mbx-underline-tabs/examples/mbx-underline-tabs-a.js +++ b/src/components/underline-tabs/examples/underline-tabs-a.js @@ -2,7 +2,7 @@ Standard usage. */ import React from 'react'; -import MbxUnderlineTabs from '../mbx-underline-tabs'; +import UnderlineTabs from '../underline-tabs'; const items = [ { @@ -20,7 +20,7 @@ const items = [ { label: 'Link here', id: 'link', - href: '#mbx-underline-tabs-a' + href: '#underline-tabs-a' } ]; @@ -35,8 +35,8 @@ export default class Example extends React.Component { render() { return ( -