Skip to content

Commit

Permalink
Merge remote-tracking branch 'base/rc0.10.0' into react-snackbar
Browse files Browse the repository at this point in the history
  • Loading branch information
gugu committed Jan 25, 2019
2 parents eae6174 + 6b80188 commit 3358695
Show file tree
Hide file tree
Showing 52 changed files with 2,128 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sudo: required
branches:
only:
- master
- rc0.9.0
- rc0.10.0

matrix:
include:
Expand Down
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
# [](https://github.com/material-components/material-components-web-react/compare/v0.7.1...v) (2018-12-28)
# [](https://github.com/material-components/material-components-web-react/compare/v0.8.0...v) (2019-01-23)


### Bug Fixes

* **list:** Support null as a child element for ListItem ([#584](https://github.com/material-components/material-components-web-react/issues/584)) ([bf487d7](https://github.com/material-components/material-components-web-react/commit/bf487d7))
* **ripple:** add missing dependency to package.json ([#612](https://github.com/material-components/material-components-web-react/issues/612)) ([f6e4725](https://github.com/material-components/material-components-web-react/commit/f6e4725))
* **ripple:** Adds HTMLElement shim to fix regression for SSR projects ([#592](https://github.com/material-components/material-components-web-react/issues/592)) ([3aaf871](https://github.com/material-components/material-components-web-react/commit/3aaf871))
* **text field:** adds missing adapter method `notifyIconAction` on Icon ([#600](https://github.com/material-components/material-components-web-react/issues/600)) ([632896a](https://github.com/material-components/material-components-web-react/commit/632896a))
* **top-app-bar:** make top app bar props optional ([#587](https://github.com/material-components/material-components-web-react/issues/587)) ([1585c95](https://github.com/material-components/material-components-web-react/commit/1585c95))


### Features

* **button:** trailing icon support ([#622](https://github.com/material-components/material-components-web-react/issues/622)) ([796850b](https://github.com/material-components/material-components-web-react/commit/796850b))
* **dialog:** new component ([#611](https://github.com/material-components/material-components-web-react/issues/611)) ([555e61f](https://github.com/material-components/material-components-web-react/commit/555e61f))



# [0.8.0](https://github.com/material-components/material-components-web-react/compare/v0.7.1...v0.8.0) (2018-12-28)


### Bug Fixes
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Component | Spec | MDC Web
[Card](./packages/card) | [Card Design Page](https://material.io/design/components/cards.html) | [MDC Card](https://github.com/material-components/material-components-web/tree/master/packages/mdc-card)
[Checkbox](./packages/checkbox) | [Checkbox Design Page](https://material.io/design/components/selection-controls.html#checkboxes) | [MDC Checkbox](https://github.com/material-components/material-components-web/tree/master/packages/mdc-checkbox)
[Chips](./packages/chips) | [Chips Design Page](https://material.io/design/components/chips.html) | [MDC Chips](https://github.com/material-components/material-components-web/tree/master/packages/mdc-chips)
[Dialog](./packages/dialog) | [Dialog Design Page](https://material.io/design/components/dialogs.html) | [MDC Dialog](https://github.com/material-components/material-components-web/tree/master/packages/mdc-dialog)
[Drawer](./packages/drawer) | [Drawer Design Page](https://material.io/design/components/navigation-drawer.html) | [MDC Drawer](https://github.com/material-components/material-components-web/tree/master/packages/mdc-drawer)
[Fab](./packages/fab) | [Fab Design Page](https://material.io/design/components/buttons-floating-action-button.html) | [MDC Fab](https://github.com/material-components/material-components-web/tree/master/packages/mdc-fab)
[Floating Label](./packages/floating-label) | [Text Field Design Page](https://material.io/design/components/text-fields.html) | [MDC Floating Label](https://github.com/material-components/material-components-web/tree/master/packages/mdc-floating-label)
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
"packages": [
"packages/*"
],
"version": "0.8.0"
"version": "0.9.0"
}
26 changes: 18 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"card",
"checkbox",
"chips",
"dialog",
"drawer",
"fab",
"floating-label",
Expand Down Expand Up @@ -59,10 +60,12 @@
},
"devDependencies": {
"@google-cloud/storage": "^1.6.0",
"@material/button": "^0.41.0",
"@material/button": "^0.43.0",
"@material/card": "^0.41.0",
"@material/checkbox": "^0.41.0",
"@material/chips": "^0.41.0",
"@material/dialog": "^0.43.0",
"@material/dom": "^0.41.0",
"@material/drawer": "^0.41.0",
"@material/fab": "^0.41.0",
"@material/floating-label": "^0.41.0",
Expand Down
1 change: 1 addition & 0 deletions packages/button/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ unelevated | Boolean | Enables unelevated variant.
outlined | Boolean | Enables outlined variant.
dense | Boolean | Enables dense variant.
icon | Element | Icon to render within root element.
trailingIcon | Element | Icon to render on the right side of the element
children | String | Text to be displayed within root element.
disabled | Boolean | Disables button if true.
href | String | Sets a hyperlink & uses anchor tag instead of a button.
Expand Down
16 changes: 12 additions & 4 deletions packages/button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export interface ButtonProps<T extends ButtonTypes> extends Ripple.InjectedProps
className?: string;
icon?: React.ReactElement<React.HTMLProps<HTMLOrSVGElement>>;
href?: string;
trailingIcon?: React.ReactElement<React.HTMLProps<HTMLOrSVGElement>>;
}

export const Button = <T extends ButtonTypes>(
Expand All @@ -51,6 +52,7 @@ export const Button = <T extends ButtonTypes>(
href,
children,
initRipple,
trailingIcon,
// eslint disabled since we do not want to include
// this in ...otherProps.
// if unbounded is passed to the <button> element, it will throw
Expand All @@ -74,16 +76,22 @@ export const Button = <T extends ButtonTypes>(
if (href) {
return (
<a {...props as React.HTMLProps<HTMLAnchorElement>} href={href}>
{renderIcon(icon)}
{children}
{!trailingIcon ? renderIcon(icon) : null}
<span className='mdc-button__label'>
{children}
</span>
{trailingIcon ? renderIcon(trailingIcon) : null}
</a>
);
}

return (
<button {...props as React.HTMLProps<HTMLButtonElement>}>
{renderIcon(icon)}
{children}
{!trailingIcon ? renderIcon(icon) : null}
<span className='mdc-button__label'>
{children}
</span>
{trailingIcon ? renderIcon(trailingIcon) : null}
</button>
);
};
Expand Down
6 changes: 3 additions & 3 deletions packages/button/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@material/react-button",
"version": "0.8.0",
"version": "0.9.0",
"description": "Material Components React Button",
"license": "MIT",
"main": "dist/index.js",
Expand All @@ -17,8 +17,8 @@
"url": "https://github.com/material-components/material-components-web-react.git"
},
"dependencies": {
"@material/button": "^0.41.0",
"@material/react-ripple": "^0.8.0",
"@material/button": "^0.43.0",
"@material/react-ripple": "^0.9.0",
"classnames": "^2.2.5",
"react": "^16.4.2"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/card/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@material/react-card",
"version": "0.8.0",
"version": "0.9.0",
"description": "Material Components React Card",
"license": "MIT",
"main": "dist/index.js",
Expand All @@ -18,7 +18,7 @@
},
"dependencies": {
"@material/card": "^0.41.0",
"@material/react-ripple": "^0.8.0",
"@material/react-ripple": "^0.9.0",
"classnames": "^2.2.5",
"react": "^16.4.2"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/checkbox/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@material/react-checkbox",
"version": "0.8.0",
"version": "0.9.0",
"description": "Material Components React Checkbox",
"license": "MIT",
"main": "dist/index.js",
Expand All @@ -17,7 +17,7 @@
},
"dependencies": {
"@material/checkbox": "^0.41.0",
"@material/react-ripple": "^0.8.0",
"@material/react-ripple": "^0.9.0",
"classnames": "^2.2.5",
"react": "^16.3.2"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/chips/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class MyChoiceChips extends React.Component {
<ChipSet
choice
selectedChipIds={this.state.selectedChipIds}
handleSelect={(selectedChipIds) => this.setState(selectedChipIds)}
handleSelect={(selectedChipIds) => this.setState({selectedChipIds})}
>
<Chip id={'chip1'} label='Small' />
<Chip id={'chip2'} label='Medium' />
Expand All @@ -85,7 +85,7 @@ class MyFilterChips extends React.Component {
<ChipSet
filter
selectedChipIds={this.state.selectedChipIds}
handleSelect={(selectedChipIds) => this.setState(selectedChipIds)}
handleSelect={(selectedChipIds) => this.setState({selectedChipIds})}
>
<Chip id={'chip1'} label='Tops' />
<Chip id={'chip2'} label='Bottoms' />
Expand Down
4 changes: 2 additions & 2 deletions packages/chips/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@material/react-chips",
"version": "0.8.0",
"version": "0.9.0",
"description": "Material Components React Chips",
"license": "MIT",
"main": "dist/index.js",
Expand All @@ -20,7 +20,7 @@
},
"dependencies": {
"@material/chips": "^0.41.0",
"@material/react-ripple": "^0.8.0",
"@material/react-ripple": "^0.9.0",
"classnames": "^2.2.5",
"react": "^16.4.2"
},
Expand Down
56 changes: 56 additions & 0 deletions packages/dialog/DialogButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// The MIT License
//
// Copyright (c) 2019 Google, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
import * as React from 'react';
import * as classnames from 'classnames';
import {cssClasses} from './constants';
import Button, {ButtonProps} from '@material/react-button';

type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
type ButtonTypes = HTMLAnchorElement | HTMLButtonElement;
export interface DialogButtonProps<T extends ButtonTypes> extends Omit<ButtonProps<T>, 'initRipple'> {
action: string,
className?: string,
isDefault?: boolean,
};


const DialogButton: <T extends ButtonTypes>(props: DialogButtonProps<T>) =>
React.ReactElement<any> = ({
/* eslint-disable react/prop-types */
action,
className = '',
children,
isDefault = false,
...otherProps
/* eslint-enable react/prop-types */
}) => (
// @ts-ignore https://github.com/Microsoft/TypeScript/issues/28892
<Button
className={classnames(className, cssClasses.BUTTON, {
[cssClasses.DEFAULT_BUTTON]: isDefault})}
data-mdc-dialog-action={action}
{...otherProps}
>{children}</Button>
);

type DialogButton<T extends ButtonTypes> = React.ReactElement<DialogButtonProps<T>>;
export default DialogButton;

0 comments on commit 3358695

Please sign in to comment.