-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Juan Manuel
committed
Sep 20, 2020
1 parent
cff7661
commit b6ea939
Showing
9 changed files
with
132 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
{ | ||
"sigeco-tools.umd.js": { | ||
"bundled": 163573, | ||
"minified": 50540, | ||
"gzipped": 13879 | ||
"bundled": 380232, | ||
"minified": 131786, | ||
"gzipped": 38780 | ||
}, | ||
"sigeco-tools.umd.min.js": { | ||
"bundled": 134175, | ||
"minified": 42782, | ||
"gzipped": 11658 | ||
"bundled": 327872, | ||
"minified": 112570, | ||
"gzipped": 32858 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import * as React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import clsx from 'clsx'; | ||
import IconButton from '@material-ui/core/IconButton'; | ||
import InputAdornment from '@material-ui/core/InputAdornment'; | ||
import TextField from '@material-ui/core/TextField'; | ||
import withStyles from '@material-ui/core/styles/withStyles'; | ||
|
||
export const styles = { | ||
root: { } | ||
}; | ||
|
||
const ActionField = React.forwardRef(function ActionField(props, ref) { | ||
const { | ||
autoComplete = 'off', | ||
autoFocus = false, | ||
classes, | ||
className, | ||
disabled = false, | ||
error = false, | ||
fullWidth = true, | ||
helperText, | ||
hiddenAction = false, | ||
iconActionCls = 'fas fa-external-link-alt', | ||
label, | ||
placeholder, | ||
readOnly = true, | ||
value, | ||
variant = 'standard', | ||
onHandleAction, | ||
onKeyPress, | ||
...other | ||
} = props; | ||
|
||
const handleKeyPress = event => { | ||
if(typeof onKeyPress === "function" ) { | ||
onKeyPress(event); | ||
} | ||
|
||
if(event.key === 'Enter') { | ||
onHandleAction(event); | ||
} | ||
}; | ||
|
||
return ( | ||
<TextField | ||
autoComplete={autoComplete} | ||
autoFocus={autoFocus} | ||
className={clsx(classes.root, className)} | ||
disabled={disabled} | ||
error={error} | ||
fullWidth={fullWidth} | ||
helperText={helperText} | ||
label={label} | ||
placeholder={placeholder} | ||
value={value} | ||
variant={variant} | ||
onKeyPress={handleKeyPress} | ||
InputProps={{ | ||
endAdornment: !hiddenAction && ( | ||
<InputAdornment position="end"> | ||
<IconButton | ||
disabled={disabled} | ||
className={iconActionCls} | ||
tabIndex={-1} | ||
style={{ fontSize: '0.8125rem' }} | ||
onClick={onHandleAction} | ||
/> | ||
</InputAdornment> | ||
), | ||
readOnly: readOnly | ||
}} | ||
ref={ref} | ||
{...other} | ||
/> | ||
); | ||
}); | ||
|
||
ActionField.propTypes = { | ||
autoComplete: PropTypes.string, | ||
autoFocus: PropTypes.bool, | ||
classes: PropTypes.object, | ||
className: PropTypes.string, | ||
disabled: PropTypes.bool, | ||
error: PropTypes.bool, | ||
fullWidth: PropTypes.bool, | ||
helperText: PropTypes.node, | ||
label: PropTypes.node, | ||
onHandleAction: PropTypes.func, | ||
onKeyPress: PropTypes.func, | ||
placeholder: PropTypes.string, | ||
readOnly: PropTypes.bool, | ||
value: PropTypes.any, | ||
/** | ||
* The variant to use. | ||
* @default 'standard' | ||
*/ | ||
variant: PropTypes.oneOf(['filled', 'outlined', 'standard']) | ||
}; | ||
|
||
export default withStyles(styles)(ActionField); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { default } from './ActionField'; | ||
export * from './ActionField'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './ActionField'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters