Skip to content

Commit

Permalink
fix: [email protected] --> [email protected] & update imports (#709)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt Goo committed Mar 18, 2019
1 parent 41d8750 commit 230337e
Show file tree
Hide file tree
Showing 84 changed files with 213 additions and 83 deletions.
19 changes: 19 additions & 0 deletions docs/best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,22 @@ By not including the font icon inside your CSS file, it reduces the file size. B
### Use with MDC Ripple

If you load your font icons with a [Ripple](../packages/ripple) with the above method, you will need to set the height and width of the icons. This is because MDC Ripple calculates the ripple size from the initial height/width.

### Importing packages

References:
- https://stackoverflow.com/questions/29596714/new-es6-syntax-for-importing-commonjs-amd-modules-i-e-import-foo-require
- https://github.com/basarat/typescript-book/blob/master/docs/project/external-modules.md
- https://github.com/Microsoft/TypeScript/issues/2242#issuecomment-92218146
- https://github.com/Microsoft/TypeScript/issues/2242#issuecomment-83694181

Since `[email protected]` is exporting `default`, we should be importing as such:
```ts
// referenced in https://github.com/basarat/typescript-book/blob/master/docs/project/external-modules.md#default-exportsimports
import classnames from 'classnames';
```

In other cases where we import modules that do not use `default`, we should import like:
```ts
import * as classnames from 'classnames';
```
2 changes: 1 addition & 1 deletion packages/button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// THE SOFTWARE.

import * as React from 'react';
import * as classnames from 'classnames';
import classnames from 'classnames';
import * as Ripple from '@material/react-ripple';

const BUTTON_CLASS_NAME = 'mdc-button__icon';
Expand Down
2 changes: 1 addition & 1 deletion packages/button/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"dependencies": {
"@material/button": "^0.43.0",
"@material/react-ripple": "^0.10.0",
"classnames": "^2.2.5",
"classnames": "^2.2.6",
"react": "^16.4.2"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/card/ActionButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// THE SOFTWARE.

import * as React from 'react';
import * as classnames from 'classnames';
import classnames from 'classnames';

type ChildType = React.ReactElement<React.HTMLProps<HTMLButtonElement|HTMLAnchorElement>>;

Expand Down
2 changes: 1 addition & 1 deletion packages/card/ActionIcons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// THE SOFTWARE.

import * as React from 'react';
import * as classnames from 'classnames';
import classnames from 'classnames';

type ChildType = React.ReactElement<React.HTMLProps<HTMLImageElement|HTMLOrSVGElement>>;

Expand Down
2 changes: 1 addition & 1 deletion packages/card/Actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// THE SOFTWARE.

import * as React from 'react';
import * as classnames from 'classnames';
import classnames from 'classnames';

export interface ActionsProps extends React.HTMLProps<HTMLDivElement> {
className?: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/card/Media.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// THE SOFTWARE.

import * as React from 'react';
import * as classnames from 'classnames';
import classnames from 'classnames';

export interface MediaProps extends React.HTMLProps<HTMLDivElement> {
className?: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/card/PrimaryContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// THE SOFTWARE.

import * as React from 'react';
import * as classnames from 'classnames';
import classnames from 'classnames';
import * as Ripple from '@material/react-ripple';

export interface PrimaryContentBaseProps extends React.HTMLProps<HTMLDivElement>, Ripple.InjectedProps<HTMLDivElement>{
Expand Down
2 changes: 1 addition & 1 deletion packages/card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// THE SOFTWARE.

import * as React from 'react';
import * as classnames from 'classnames';
import classnames from 'classnames';
import ActionButtons from './ActionButtons';
import ActionIcons from './ActionIcons';
import Actions from './Actions';
Expand Down
2 changes: 1 addition & 1 deletion packages/card/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"dependencies": {
"@material/card": "^0.41.0",
"@material/react-ripple": "^0.10.0",
"classnames": "^2.2.5",
"classnames": "^2.2.6",
"react": "^16.4.2"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/checkbox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// THE SOFTWARE.

import * as React from 'react';
import * as classnames from 'classnames';
import classnames from 'classnames';
// @ts-ignore no mdc .d.ts file
import {MDCCheckboxFoundation, MDCCheckboxAdapter} from '@material/checkbox/dist/mdc.checkbox';
import * as Ripple from '@material/react-ripple';
Expand Down
2 changes: 1 addition & 1 deletion packages/checkbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"dependencies": {
"@material/checkbox": "^0.41.0",
"@material/react-ripple": "^0.10.0",
"classnames": "^2.2.5",
"classnames": "^2.2.6",
"react": "^16.3.2"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/chips/Chip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// 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 classnames from 'classnames';
import * as Ripple from '@material/react-ripple';
// @ts-ignore no mdc .d.ts file
import {MDCChipFoundation} from '@material/chips/dist/mdc.chips';
Expand Down
2 changes: 1 addition & 1 deletion packages/dialog/DialogButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// 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 classnames from 'classnames';
import {cssClasses} from './constants';
import Button, {ButtonProps} from '@material/react-button';

Expand Down
2 changes: 1 addition & 1 deletion packages/dialog/DialogContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// 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 classnames from 'classnames';
import {cssClasses} from './constants';


Expand Down
2 changes: 1 addition & 1 deletion packages/dialog/DialogFooter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// 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 classnames from 'classnames';
import {cssClasses} from './constants';


Expand Down
2 changes: 1 addition & 1 deletion packages/dialog/DialogTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// 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 classnames from 'classnames';
import {cssClasses} from './constants';


Expand Down
2 changes: 1 addition & 1 deletion packages/dialog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@material/dialog": "0.43.0",
"@material/dom": "^0.41.0",
"@material/react-button": "^0.10.0",
"classnames": "^2.2.5",
"classnames": "^2.2.6",
"focus-trap": "^4.0.2",
"react": "^16.4.2"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/drawer/AppContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// THE SOFTWARE.

import * as React from 'react';
import * as classnames from 'classnames';
import classnames from 'classnames';

export interface DrawerAppContentProps {
tag?: string,
Expand Down
2 changes: 1 addition & 1 deletion packages/drawer/Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// THE SOFTWARE.

import * as React from 'react';
import * as classnames from 'classnames';
import classnames from 'classnames';

export interface DrawerContentProps {
tag?: string,
Expand Down
2 changes: 1 addition & 1 deletion packages/drawer/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// THE SOFTWARE.

import * as React from 'react';
import * as classnames from 'classnames';
import classnames from 'classnames';

export interface DrawerHeaderProps {
tag?: string,
Expand Down
24 changes: 23 additions & 1 deletion packages/drawer/Subtitle.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
// The MIT License
//
// Copyright (c) 2018 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 classnames from 'classnames';

export interface DrawerSubTitleProps {
tag?: string;
Expand Down
24 changes: 23 additions & 1 deletion packages/drawer/Title.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
// The MIT License
//
// Copyright (c) 2018 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 classnames from 'classnames';

export interface DrawerTitleProps {
tag?: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/drawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// THE SOFTWARE.

import * as React from 'react';
import * as classnames from 'classnames';
import classnames from 'classnames';
import {
MDCDismissibleDrawerFoundation,
MDCModalDrawerFoundation,
Expand Down
2 changes: 1 addition & 1 deletion packages/drawer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"dependencies": {
"@material/drawer": "^0.41.0",
"@material/list": "^0.41.0",
"classnames": "^2.2.5",
"classnames": "^2.2.6",
"focus-trap": "^3.0.0",
"react": "^16.4.2"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/fab/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// THE SOFTWARE.

import * as React from 'react';
import * as classnames from 'classnames';
import classnames from 'classnames';
import * as Ripple from '@material/react-ripple';

export interface FabProps extends Ripple.InjectedProps<HTMLButtonElement>,
Expand Down
2 changes: 1 addition & 1 deletion packages/fab/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"dependencies": {
"@material/fab": "^0.41.0",
"@material/react-ripple": "^0.10.0",
"classnames": "^2.2.5",
"classnames": "^2.2.6",
"react": "^16.4.2"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/floating-label/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// THE SOFTWARE.

import * as React from 'react';
import * as classnames from 'classnames';
import classnames from 'classnames';
// @ts-ignore no mdc .d.ts
import {MDCFloatingLabelFoundation} from '@material/floating-label/dist/mdc.floatingLabel';

Expand Down
2 changes: 1 addition & 1 deletion packages/floating-label/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
},
"dependencies": {
"@material/floating-label": "^0.41.0",
"classnames": "^2.2.5",
"classnames": "^2.2.6",
"react": "^16.4.2"
},
"publishConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/icon-button/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"dependencies": {
"@material/icon-button": "^0.41.0",
"@material/react-ripple": "^0.10.0",
"classnames": "^2.2.5",
"classnames": "^2.2.6",
"react": "^16.3.2"
},
"publishConfig": {
Expand Down
24 changes: 23 additions & 1 deletion packages/layout-grid/Cell.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
// The MIT License
//
// Copyright (c) 2018 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 classnames from 'classnames';

export type TwelveColumn = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
export type FourColumn = 1 | 2 | 3 | 4;
Expand Down
24 changes: 23 additions & 1 deletion packages/layout-grid/Grid.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
// The MIT License
//
// Copyright (c) 2018 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 classnames from 'classnames';

export type Alignment = 'left' | 'right';
export interface GridProps<T> extends React.HTMLProps<T> {
Expand Down
Loading

0 comments on commit 230337e

Please sign in to comment.