@entur/component-library
Advanced tools
Comparing version 0.2.10 to 0.2.11
@@ -116,3 +116,3 @@ 'use strict'; | ||
var CHILDREN_WHITELIST = [_.RadioFormButton, _.CheckboxFormButton]; | ||
var CHILDREN_WHITELIST = [_.RadioFormButton, _.CheckboxFormButton, _.LinkFormButton]; | ||
@@ -119,0 +119,0 @@ function ButtonGroup(_ref) { |
@@ -129,3 +129,3 @@ 'use strict'; | ||
label: _propTypes2.default.string.isRequired, | ||
value: _propTypes2.default.string.isRequired | ||
value: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]).isRequired | ||
}; | ||
@@ -148,3 +148,8 @@ | ||
var classNames = (0, _.getClassNames)(_styles.rootClassName, { | ||
variant: variant, size: size, width: width, valid: valid, prepend: prepend, append: append | ||
variant: variant, | ||
size: size, | ||
width: width, | ||
valid: valid, | ||
prepend: prepend, | ||
append: append | ||
}); | ||
@@ -151,0 +156,0 @@ |
@@ -15,2 +15,3 @@ 'use strict'; | ||
exports.RadioFormButton = RadioFormButton; | ||
exports.LinkFormButton = LinkFormButton; | ||
@@ -395,2 +396,36 @@ var _react = require('react'); | ||
RadioFormButton.propTypes = propTypes; | ||
RadioFormButton.defaultProps = defaultProps; | ||
RadioFormButton.defaultProps = defaultProps; | ||
function LinkFormButton(_ref7) { | ||
var className = _ref7.className, | ||
children = _ref7.children, | ||
variant = _ref7.variant, | ||
size = _ref7.size, | ||
width = _ref7.width, | ||
active = _ref7.active, | ||
disabled = _ref7.disabled, | ||
href = _ref7.href, | ||
rest = _objectWithoutProperties(_ref7, ['className', 'children', 'variant', 'size', 'width', 'active', 'disabled', 'href']); | ||
var classNames = getClassNames(_styles.rootClassName, { | ||
className: className, | ||
variant: variant, | ||
size: size, | ||
width: width, | ||
active: active, | ||
disabled: disabled | ||
}, _styles.buttonClassName); | ||
return _react2.default.createElement( | ||
'a', | ||
_extends({}, rest, { | ||
href: disabled || active ? '' : href, | ||
className: classNames, | ||
disabled: disabled | ||
}), | ||
children | ||
); | ||
} | ||
LinkFormButton.propTypes = propTypes; | ||
LinkFormButton.defaultProps = defaultProps; |
@@ -169,2 +169,8 @@ 'use strict'; | ||
}); | ||
Object.defineProperty(exports, 'LinkFormButton', { | ||
enumerable: true, | ||
get: function get() { | ||
return _formControl.LinkFormButton; | ||
} | ||
}); | ||
@@ -171,0 +177,0 @@ var _dropdown = require('./components/formControl/dropdown'); |
{ | ||
"name": "@entur/component-library", | ||
"version": "0.2.10", | ||
"version": "0.2.11", | ||
"license": "EUPL-1.2", | ||
"main": "lib/index.js", | ||
"homepage": "https://entur-component-library-ae8fd.firebaseapp.com", | ||
"homepage": "https://component-library.entur.org", | ||
"scripts": { | ||
@@ -15,2 +15,3 @@ "storybook": "start-storybook -s ./public -c .storybook -p 9009", | ||
"prepublishOnly": "npm run build", | ||
"deploy": "npm run build-storybook && firebase deploy", | ||
"eslint": "eslint src/**/*.js stories/**/*.js" | ||
@@ -17,0 +18,0 @@ }, |
@@ -5,7 +5,7 @@ import React from 'react'; | ||
import { RadioFormButton, CheckboxFormButton } from './'; | ||
import { RadioFormButton, CheckboxFormButton, LinkFormButton } from './'; | ||
import { buttonGroupClassName } from './styles.scss'; | ||
const CHILDREN_WHITELIST = [RadioFormButton, CheckboxFormButton]; | ||
const CHILDREN_WHITELIST = [RadioFormButton, CheckboxFormButton, LinkFormButton]; | ||
@@ -12,0 +12,0 @@ export function ButtonGroup({ |
@@ -8,7 +8,3 @@ import React from 'react'; | ||
export function DropDownOptions({ | ||
value, | ||
label, | ||
...rest | ||
}) { | ||
export function DropDownOptions({ value, label, ...rest }) { | ||
return ( | ||
@@ -23,3 +19,3 @@ <option value={value} {...rest}> | ||
label: PropTypes.string.isRequired, | ||
value: PropTypes.string.isRequired | ||
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).isRequired | ||
}; | ||
@@ -41,5 +37,9 @@ | ||
}) { | ||
const classNames = getClassNames(rootClassName, { | ||
variant, size, width, valid, prepend, append | ||
variant, | ||
size, | ||
width, | ||
valid, | ||
prepend, | ||
append | ||
}); | ||
@@ -70,3 +70,2 @@ | ||
return ( | ||
@@ -102,3 +101,3 @@ <FormControlWrapper | ||
valid: PropTypes.oneOf(['success', 'error', 'warning', 'info', 'none']), | ||
variant: PropTypes.oneOf(['midnight']), | ||
variant: PropTypes.oneOf(['midnight']) | ||
}; | ||
@@ -108,3 +107,3 @@ | ||
size: 'md', | ||
value: '', | ||
value: '' | ||
}; |
@@ -300,1 +300,40 @@ import React from 'react'; | ||
RadioFormButton.defaultProps = defaultProps; | ||
export function LinkFormButton({ | ||
className, | ||
children, | ||
variant, | ||
size, | ||
width, | ||
active, | ||
disabled, | ||
href, | ||
...rest | ||
}) { | ||
const classNames = getClassNames( | ||
rootClassName, | ||
{ | ||
className, | ||
variant, | ||
size, | ||
width, | ||
active, | ||
disabled | ||
}, | ||
buttonClassName | ||
); | ||
return ( | ||
<a | ||
{...rest} | ||
href={disabled || active ? '' : href} | ||
className={classNames} | ||
disabled={disabled} | ||
> | ||
{children} | ||
</a> | ||
); | ||
} | ||
LinkFormButton.propTypes = propTypes; | ||
LinkFormButton.defaultProps = defaultProps; |
@@ -11,3 +11,3 @@ // config | ||
export { SlideSwitch } from './components/slideSwitch'; | ||
export { TextField, TextArea, RadioFormButton, CheckboxFormButton } from './components/formControl'; | ||
export { TextField, TextArea, RadioFormButton, CheckboxFormButton, LinkFormButton } from './components/formControl'; | ||
export { DropDown, DropDownOptions } from './components/formControl/dropdown'; | ||
@@ -14,0 +14,0 @@ export { ButtonGroup } from './components/formControl/buttonGroup'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
498312
5776