Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fab): typescript support #495

Merged
merged 113 commits into from
Dec 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
a452939
feat(typography): add component (#378)
hvolschenk Nov 2, 2018
4fe34f0
chore(infrastructure): add rc7.0 feature branch to travis
Nov 9, 2018
5075cf2
fix: added missing comma from golden.json (#426)
Nov 9, 2018
647ff52
fix(text-field): uncomment test fixed from 0.35.0 (#404)
Nov 9, 2018
3a8447a
fix(text-field): custom validation (#430)
hvolschenk Nov 13, 2018
db7daba
feat(list): allow semantic tags (mainly, nav on List and a on ListIte…
4cm4k1 Nov 14, 2018
9439e89
docs(tab-indicator): update readme typo (#418)
Nov 14, 2018
c0bda4c
docs: remove --save, which is default (#417)
Nov 14, 2018
de13e6e
feature(linear-progress): add component (#425)
hvolschenk Nov 14, 2018
110d39d
chore: update mdc web to 0.41.0 (#400)
Nov 15, 2018
a482d62
docs: outside contributions (#441)
Nov 15, 2018
8b9d680
docs: update roadmap (#445)
Nov 15, 2018
c955d2a
WIP: tsloader
Nov 16, 2018
91c378c
WIP: typescript text field
Nov 18, 2018
3e1563a
fix: screenshots textfield
Nov 18, 2018
101abcc
fix: errors
Nov 18, 2018
289d054
fix: line ripple notched outline and floating label screenshot tests
Nov 18, 2018
506c804
fix: unit tests
Nov 27, 2018
d486cef
WIP: eslint
Nov 27, 2018
a0ff9bc
Revert "WIP: eslint"
Nov 27, 2018
28f9475
Merge branch 'feat/typescript' into feat/typings
Nov 27, 2018
748febc
WIP: add back typings
Nov 27, 2018
cfb6443
WIP: remove rc7.0
Nov 27, 2018
bc91473
WIP: types/react
Nov 27, 2018
7125740
feat(infrastructure): add typescript eslint (#473)
Nov 27, 2018
b3e2601
Merge branch 'feat/typescript' into feat/typings
Nov 27, 2018
5a1f375
WIP: eslint
Nov 28, 2018
ce6d69e
WIP: typescript
Nov 28, 2018
45e079f
fix: lint
Nov 28, 2018
f763ebb
fix: lint
Nov 28, 2018
6a9bb75
fix: lint
Nov 28, 2018
f3f2b0e
fix: variants:
Nov 29, 2018
850df45
fix: path resolutoin
Nov 29, 2018
83fc613
fix: typo
Nov 29, 2018
9b8c7e7
WIP: screenshot conversion
Nov 29, 2018
17f3922
fix: packagejson
Nov 29, 2018
51f9661
fix: package
Nov 29, 2018
c828387
fix: lint
Nov 29, 2018
63e4ce7
fix: lint
Nov 29, 2018
eea57ba
fix: lint
Nov 30, 2018
e3eb569
fix: convert more screenshot files
Nov 30, 2018
c697770
fix: capturesuite
Nov 30, 2018
6b83a46
fix: text field error
Nov 30, 2018
67d2a93
fix: mocha types
Nov 30, 2018
e1f2fb1
fix: unittests
Nov 30, 2018
cf85f5f
fix: text field tests
Nov 30, 2018
a654680
feat(infrastructure): add typescript eslint (#473)
Nov 27, 2018
f00ffe6
Merge branch 'feat/typescript' into feat/typings
Nov 30, 2018
3fc8b44
fix: typescript
Nov 30, 2018
3c27624
fix: unit tests
Nov 30, 2018
c2593ef
fix: double quote
Dec 1, 2018
efc30cc
fix: error
Dec 1, 2018
36dcac0
fix: more
Dec 1, 2018
9246231
WIP: tests
Dec 1, 2018
30ce0cd
WIP;test
Dec 3, 2018
d3bd98f
fix: lint
Dec 3, 2018
c7a27c0
fix: PR changes
Dec 3, 2018
84cec0e
fix: typescript unit coverage
Dec 4, 2018
e8be0d6
fix: typescript coverage
Dec 4, 2018
64af029
fix: update to interface
Dec 4, 2018
16418b2
Merge branch 'featt /typings' into fix/coverage-typescript
Dec 4, 2018
fdc424e
feat(fab): typescript
Dec 6, 2018
1eced1b
fix: update typescript
Dec 7, 2018
680f72a
fix: typescript
Dec 7, 2018
2bdb28b
fix: conditional element
Dec 7, 2018
9158e8f
fix: tests
Dec 7, 2018
c1bd251
Merge branch 'feat/typings' into fix/coverage-typescript
Dec 7, 2018
7a8f719
feat(infrastructure): add typescript eslint (#473)
Nov 27, 2018
8b24b3f
Merge branch 'feat/typescript' into feat/typings
Dec 7, 2018
73f5218
fix: pr changes
Dec 10, 2018
989920b
fix: added ts-style from google
Dec 11, 2018
e2cb8b2
fix: tsstyle
Dec 11, 2018
3192527
fix: typescript
Dec 11, 2018
b559ba7
fix: added ref test input field test
Dec 11, 2018
a9fcee5
Merge branch 'feat/typings' into fix/coverage-typescript
Dec 11, 2018
4541969
fix: package lock
Dec 11, 2018
7377359
Merge branch 'fix/coverage-typescript' into feat/typescript-fab
Dec 12, 2018
5f51865
fix: ts-style
Dec 12, 2018
70dd75f
fix: tsstyle# Please enter the commit message for your changes. Lines…
Dec 12, 2018
14cdfac
fix: PR Changes
Dec 14, 2018
a0f33c1
WIP: change to semi
Dec 14, 2018
d46df99
WIP: add travis branch
Dec 14, 2018
07395f6
Merge branch 'fix/coverage-typescript' into feat/typescript-fab
Dec 14, 2018
51229fc
fix: golddn
Dec 14, 2018
b951a12
Merge branch 'feat/typings' into fix/coverage-typescript
Dec 14, 2018
7014800
Merge branch 'fix/coverage-typescript' into feat/typescript-fab
Dec 14, 2018
e6d14cc
fix: jsx single quote
Dec 15, 2018
db2e2a7
Merge branch 'feat/typings' into fix/coverage-typescript
Dec 15, 2018
5520c04
feat(infrastructure): add typescript eslint (#473)
Nov 27, 2018
3459f39
Merge branch 'feat/typescript' into feat/typings
Dec 17, 2018
d12ee68
Merge branch 'feat/typings' into fix/coverage-typescript
Dec 17, 2018
e261b93
fix: packagelock
Dec 17, 2018
0bfb7fe
Merge branch 'fix/coverage-typescript' into feat/typescript-fab
Dec 17, 2018
187e703
fix: normalize
Dec 17, 2018
d84c225
Merge branch 'feat/typings' into fix/coverage-typescript
Dec 17, 2018
2e3a8e6
Merge branch 'fix/coverage-typescript' into feat/typescript-fab
Dec 17, 2018
3aca012
fix: normalize
Dec 18, 2018
518dbca
fix: added sourcemap devtool
Dec 18, 2018
34080cd
fix: add webpack
Dec 18, 2018
4e921e9
Merge branch 'feat/typings' into fix/coverage-typescriptt
Dec 18, 2018
29821f6
fix: partial text field fixes
Dec 18, 2018
069f5c7
Merge branch 'feat/typings' into fix/coverage-typescriptt
Dec 18, 2018
ed953ed
fix: un-underscrore
Dec 19, 2018
79a9154
Merge branch 'feat/typings' into fix/coverage-typescript
Dec 19, 2018
0a2cc56
fix: test
Dec 19, 2018
c27c304
Merge branch 'feat/typings' into fix/coverage-typescript
Dec 19, 2018
880e359
Merge branch 'feat/two-typescript' into fix/coverage-typescript
Dec 19, 2018
38fa2e6
fix: udpate packagelock
Dec 19, 2018
e51f10b
fix: merge conflicts
Dec 19, 2018
fef15f7
Merge branch 'fix/coverage-typescript' into feat/typescript-fab
Dec 19, 2018
b540bc7
Merge branch 'feat/two-typescript' into feat/typescript-fab
Dec 19, 2018
c7d01d9
Merge branch 'feat/two-typescript' into feat/typescript-fab
Dec 20, 2018
3a429ea
fix: remove @ts-ignore
Dec 20, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
112 changes: 0 additions & 112 deletions packages/fab/index.js

This file was deleted.

80 changes: 80 additions & 0 deletions packages/fab/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// 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';
williamernest marked this conversation as resolved.
Show resolved Hide resolved
import * as classnames from 'classnames';
import * as Ripple from '@material/react-ripple';

export interface FabProps extends Ripple.InjectedProps<HTMLButtonElement> {
mini?: boolean;
icon?: React.ReactElement<HTMLElement>;
textLabel?: string;
className?: string;
initRipple: React.Ref<HTMLButtonElement>;
unbounded: boolean;
}

const Icon: React.FunctionComponent<{icon?: React.ReactElement<HTMLElement>}> = ({icon}) => {
if (!icon) {
return null;
}
const updatedProps = {
className: classnames('mdc-fab__icon', icon.props.className),
};
return React.cloneElement(icon, updatedProps);
};

const TextLabel: React.FunctionComponent<{textLabel: string}> = ({
textLabel, // eslint-disable-line react/prop-types
williamernest marked this conversation as resolved.
Show resolved Hide resolved
}) => {
if (textLabel.length === 0) {
return null;
}
return <span className='mdc-fab__label'>{textLabel}</span>;
};

export const Fab: React.FunctionComponent<FabProps & React.HTMLProps<HTMLButtonElement>> = ({
/* eslint-disable react/prop-types */
mini = false,
icon,
textLabel = '',
className = '',
initRipple = () => {},
unbounded,
/* eslint-enable react/prop-types */
...otherProps
}) => {
const extended = textLabel.length > 0;
const classes = classnames('mdc-fab', className, {
'mdc-fab--mini': mini,
'mdc-fab--extended': extended,
});

return (
<button className={classes} ref={initRipple} {...otherProps}>
<Icon icon={icon} />
<TextLabel textLabel={textLabel} />
</button>
);
};

export default Ripple.withRipple<FabProps, HTMLButtonElement>(Fab);
114 changes: 0 additions & 114 deletions test/screenshot/fab/index.js

This file was deleted.