Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit 4f22b5a

Browse files
author
Matt Goo
committed
fix: classnames@2.2.5 --> classnames@2.2.6 & update imports (#709)
1 parent 4f5164c commit 4f22b5a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+213
-83
lines changed

docs/best-practices.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,22 @@ By not including the font icon inside your CSS file, it reduces the file size. B
1414
### Use with MDC Ripple
1515

1616
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.
17+
18+
### Importing packages
19+
20+
References:
21+
- https://stackoverflow.com/questions/29596714/new-es6-syntax-for-importing-commonjs-amd-modules-i-e-import-foo-require
22+
- https://github.com/basarat/typescript-book/blob/master/docs/project/external-modules.md
23+
- https://github.com/Microsoft/TypeScript/issues/2242#issuecomment-92218146
24+
- https://github.com/Microsoft/TypeScript/issues/2242#issuecomment-83694181
25+
26+
Since `classnames@2.2.6` is exporting `default`, we should be importing as such:
27+
```ts
28+
// referenced in https://github.com/basarat/typescript-book/blob/master/docs/project/external-modules.md#default-exportsimports
29+
import classnames from 'classnames';
30+
```
31+
32+
In other cases where we import modules that do not use `default`, we should import like:
33+
```ts
34+
import * as classnames from 'classnames';
35+
```

packages/button/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import * as React from 'react';
24-
import * as classnames from 'classnames';
24+
import classnames from 'classnames';
2525
import * as Ripple from '@material/react-ripple';
2626

2727
const BUTTON_CLASS_NAME = 'mdc-button__icon';

packages/button/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"dependencies": {
2020
"@material/button": "^0.43.0",
2121
"@material/react-ripple": "^0.10.0",
22-
"classnames": "^2.2.5",
22+
"classnames": "^2.2.6",
2323
"react": "^16.4.2"
2424
},
2525
"publishConfig": {

packages/card/ActionButtons.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import * as React from 'react';
24-
import * as classnames from 'classnames';
24+
import classnames from 'classnames';
2525

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

packages/card/ActionIcons.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import * as React from 'react';
24-
import * as classnames from 'classnames';
24+
import classnames from 'classnames';
2525

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

packages/card/Actions.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import * as React from 'react';
24-
import * as classnames from 'classnames';
24+
import classnames from 'classnames';
2525

2626
export interface ActionsProps extends React.HTMLProps<HTMLDivElement> {
2727
className?: string;

packages/card/Media.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import * as React from 'react';
24-
import * as classnames from 'classnames';
24+
import classnames from 'classnames';
2525

2626
export interface MediaProps extends React.HTMLProps<HTMLDivElement> {
2727
className?: string;

packages/card/PrimaryContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import * as React from 'react';
24-
import * as classnames from 'classnames';
24+
import classnames from 'classnames';
2525
import * as Ripple from '@material/react-ripple';
2626

2727
export interface PrimaryContentBaseProps extends React.HTMLProps<HTMLDivElement>, Ripple.InjectedProps<HTMLDivElement>{

packages/card/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import * as React from 'react';
24-
import * as classnames from 'classnames';
24+
import classnames from 'classnames';
2525
import ActionButtons from './ActionButtons';
2626
import ActionIcons from './ActionIcons';
2727
import Actions from './Actions';

packages/card/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"dependencies": {
2020
"@material/card": "^0.41.0",
2121
"@material/react-ripple": "^0.10.0",
22-
"classnames": "^2.2.5",
22+
"classnames": "^2.2.6",
2323
"react": "^16.4.2"
2424
},
2525
"publishConfig": {

packages/checkbox/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import * as React from 'react';
24-
import * as classnames from 'classnames';
24+
import classnames from 'classnames';
2525
// @ts-ignore no mdc .d.ts file
2626
import {MDCCheckboxFoundation, MDCCheckboxAdapter} from '@material/checkbox/dist/mdc.checkbox';
2727
import * as Ripple from '@material/react-ripple';

packages/checkbox/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"dependencies": {
1919
"@material/checkbox": "^0.41.0",
2020
"@material/react-ripple": "^0.10.0",
21-
"classnames": "^2.2.5",
21+
"classnames": "^2.2.6",
2222
"react": "^16.3.2"
2323
},
2424
"publishConfig": {

packages/chips/Chip.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222
import * as React from 'react';
23-
import * as classnames from 'classnames';
23+
import classnames from 'classnames';
2424
import * as Ripple from '@material/react-ripple';
2525
// @ts-ignore no mdc .d.ts file
2626
import {MDCChipFoundation} from '@material/chips/dist/mdc.chips';

packages/dialog/DialogButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222
import * as React from 'react';
23-
import * as classnames from 'classnames';
23+
import classnames from 'classnames';
2424
import {cssClasses} from './constants';
2525
import Button, {ButtonProps} from '@material/react-button';
2626

packages/dialog/DialogContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222
import * as React from 'react';
23-
import * as classnames from 'classnames';
23+
import classnames from 'classnames';
2424
import {cssClasses} from './constants';
2525

2626

packages/dialog/DialogFooter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222
import * as React from 'react';
23-
import * as classnames from 'classnames';
23+
import classnames from 'classnames';
2424
import {cssClasses} from './constants';
2525

2626

packages/dialog/DialogTitle.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
// THE SOFTWARE.
2222
import * as React from 'react';
23-
import * as classnames from 'classnames';
23+
import classnames from 'classnames';
2424
import {cssClasses} from './constants';
2525

2626

packages/dialog/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@material/dialog": "0.43.0",
1515
"@material/dom": "^0.41.0",
1616
"@material/react-button": "^0.10.0",
17-
"classnames": "^2.2.5",
17+
"classnames": "^2.2.6",
1818
"focus-trap": "^4.0.2",
1919
"react": "^16.4.2"
2020
},

packages/drawer/AppContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import * as React from 'react';
24-
import * as classnames from 'classnames';
24+
import classnames from 'classnames';
2525

2626
export interface DrawerAppContentProps {
2727
tag?: string,

packages/drawer/Content.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import * as React from 'react';
24-
import * as classnames from 'classnames';
24+
import classnames from 'classnames';
2525

2626
export interface DrawerContentProps {
2727
tag?: string,

packages/drawer/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import * as React from 'react';
24-
import * as classnames from 'classnames';
24+
import classnames from 'classnames';
2525

2626
export interface DrawerHeaderProps {
2727
tag?: string,

packages/drawer/Subtitle.tsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
1+
// The MIT License
2+
//
3+
// Copyright (c) 2018 Google, Inc.
4+
//
5+
// Permission is hereby granted, free of charge, to any person obtaining a copy
6+
// of this software and associated documentation files (the "Software"), to deal
7+
// in the Software without restriction, including without limitation the rights
8+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
// copies of the Software, and to permit persons to whom the Software is
10+
// furnished to do so, subject to the following conditions:
11+
//
12+
// The above copyright notice and this permission notice shall be included in
13+
// all copies or substantial portions of the Software.
14+
//
15+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
// THE SOFTWARE.
22+
123
import * as React from 'react';
2-
import * as classnames from 'classnames';
24+
import classnames from 'classnames';
325

426
export interface DrawerSubTitleProps {
527
tag?: string;

packages/drawer/Title.tsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
1+
// The MIT License
2+
//
3+
// Copyright (c) 2018 Google, Inc.
4+
//
5+
// Permission is hereby granted, free of charge, to any person obtaining a copy
6+
// of this software and associated documentation files (the "Software"), to deal
7+
// in the Software without restriction, including without limitation the rights
8+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
// copies of the Software, and to permit persons to whom the Software is
10+
// furnished to do so, subject to the following conditions:
11+
//
12+
// The above copyright notice and this permission notice shall be included in
13+
// all copies or substantial portions of the Software.
14+
//
15+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
// THE SOFTWARE.
22+
123
import * as React from 'react';
2-
import * as classnames from 'classnames';
24+
import classnames from 'classnames';
325

426
export interface DrawerTitleProps {
527
tag?: string;

packages/drawer/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import * as React from 'react';
24-
import * as classnames from 'classnames';
24+
import classnames from 'classnames';
2525
import {
2626
MDCDismissibleDrawerFoundation,
2727
MDCModalDrawerFoundation,

packages/drawer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"dependencies": {
2020
"@material/drawer": "^0.41.0",
2121
"@material/list": "^0.41.0",
22-
"classnames": "^2.2.5",
22+
"classnames": "^2.2.6",
2323
"focus-trap": "^3.0.0",
2424
"react": "^16.4.2"
2525
},

packages/fab/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// THE SOFTWARE.
2222

2323
import * as React from 'react';
24-
import * as classnames from 'classnames';
24+
import classnames from 'classnames';
2525
import * as Ripple from '@material/react-ripple';
2626

2727
export interface FabProps extends Ripple.InjectedProps<HTMLButtonElement>,

packages/fab/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"dependencies": {
2020
"@material/fab": "^0.41.0",
2121
"@material/react-ripple": "^0.10.0",
22-
"classnames": "^2.2.5",
22+
"classnames": "^2.2.6",
2323
"react": "^16.4.2"
2424
},
2525
"publishConfig": {

packages/floating-label/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// THE SOFTWARE.
2222

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

packages/floating-label/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
},
2020
"dependencies": {
2121
"@material/floating-label": "^0.41.0",
22-
"classnames": "^2.2.5",
22+
"classnames": "^2.2.6",
2323
"react": "^16.4.2"
2424
},
2525
"publishConfig": {

packages/icon-button/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"dependencies": {
2020
"@material/icon-button": "^0.41.0",
2121
"@material/react-ripple": "^0.10.0",
22-
"classnames": "^2.2.5",
22+
"classnames": "^2.2.6",
2323
"react": "^16.3.2"
2424
},
2525
"publishConfig": {

packages/layout-grid/Cell.tsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
1+
// The MIT License
2+
//
3+
// Copyright (c) 2018 Google, Inc.
4+
//
5+
// Permission is hereby granted, free of charge, to any person obtaining a copy
6+
// of this software and associated documentation files (the "Software"), to deal
7+
// in the Software without restriction, including without limitation the rights
8+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
// copies of the Software, and to permit persons to whom the Software is
10+
// furnished to do so, subject to the following conditions:
11+
//
12+
// The above copyright notice and this permission notice shall be included in
13+
// all copies or substantial portions of the Software.
14+
//
15+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
// THE SOFTWARE.
22+
123
import * as React from 'react';
2-
import * as classnames from 'classnames';
24+
import classnames from 'classnames';
325

426
export type TwelveColumn = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
527
export type FourColumn = 1 | 2 | 3 | 4;

packages/layout-grid/Grid.tsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
1+
// The MIT License
2+
//
3+
// Copyright (c) 2018 Google, Inc.
4+
//
5+
// Permission is hereby granted, free of charge, to any person obtaining a copy
6+
// of this software and associated documentation files (the "Software"), to deal
7+
// in the Software without restriction, including without limitation the rights
8+
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
// copies of the Software, and to permit persons to whom the Software is
10+
// furnished to do so, subject to the following conditions:
11+
//
12+
// The above copyright notice and this permission notice shall be included in
13+
// all copies or substantial portions of the Software.
14+
//
15+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
// THE SOFTWARE.
22+
123
import * as React from 'react';
2-
import * as classnames from 'classnames';
24+
import classnames from 'classnames';
325

426
export type Alignment = 'left' | 'right';
527
export interface GridProps<T> extends React.HTMLProps<T> {

0 commit comments

Comments
 (0)