diff --git a/spikes/form/redux-form/client/form/normalizePhone.js b/spikes/form/redux-form/client/form/normalizePhone.js
new file mode 100644
index 00000000..ce964e96
--- /dev/null
+++ b/spikes/form/redux-form/client/form/normalizePhone.js
@@ -0,0 +1,24 @@
+const normalizePhone = (value, previousValue) => {
+ if (!value) {
+ return value
+ }
+ const onlyNums = value.replace(/[^\d]/g, '')
+ if (!previousValue || value.length > previousValue.length) {
+ // typing forward
+ if (onlyNums.length === 3) {
+ return onlyNums + '-'
+ }
+ if (onlyNums.length === 6) {
+ return onlyNums.slice(0, 3) + '-' + onlyNums.slice(3) + '-'
+ }
+ }
+ if (onlyNums.length <= 3) {
+ return onlyNums
+ }
+ if (onlyNums.length <= 6) {
+ return onlyNums.slice(0, 3) + '-' + onlyNums.slice(3)
+ }
+ return onlyNums.slice(0, 3) + '-' + onlyNums.slice(3, 6) + '-' + onlyNums.slice(6, 10)
+}
+
+export default normalizePhone
diff --git a/spikes/form/redux-form/client/root.js b/spikes/form/redux-form/client/root.js
index 3eb1a96d..fc60e657 100644
--- a/spikes/form/redux-form/client/root.js
+++ b/spikes/form/redux-form/client/root.js
@@ -8,6 +8,7 @@ const Multiform = require('./form/multiform');
const FormOne = require('./form/form-one');
const FormTwo = require('./form/form-two');
const FormThree = require('./form/form-three');
+const FormNormalize = require('./form/form-normalize');
const {
AppContainer
@@ -42,6 +43,7 @@ module.exports = ({
+
diff --git a/ui/.storybook/config.js b/ui/.storybook/config.js
index 76294912..b166bbcb 100644
--- a/ui/.storybook/config.js
+++ b/ui/.storybook/config.js
@@ -1,7 +1,7 @@
const React = require('react');
const { configure, addDecorator } = require('@kadira/storybook');
-const req = require.context('../src/components', true, /story.js$/);
+const req = require.context('../src/components', true, /.+?(?=story.js$)/);
const Styled = require('styled-components');
const Base = require('../src/components/base');
diff --git a/ui/.storybook/head.html b/ui/.storybook/head.html
deleted file mode 100644
index f057aef5..00000000
--- a/ui/.storybook/head.html
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/ui/package.json b/ui/package.json
index 631258fc..36fe2eb2 100644
--- a/ui/package.json
+++ b/ui/package.json
@@ -20,7 +20,7 @@
"chart.js": "^2.5.0",
"chartjs-chart-box-plot": "prerelease",
"color": "^1.0.3",
- "d3": "^4.5.0",
+ "d3": "^4.6.0",
"lodash.find": "^4.6.0",
"lodash.first": "^3.0.0",
"lodash.flatten": "^4.4.0",
@@ -33,10 +33,13 @@
"param-case": "^2.1.0",
"random-natural": "^1.0.3",
"react": "^15.4.2",
+ "react-broadcast": "^0.1.2",
"react-dom": "^15.4.2",
+ "react-redux": "^5.0.2",
"react-router-dom": "4.0.0-beta.4",
"react-select": "^1.0.0-rc.3",
"reduce-css-calc": "^1.3.0",
+ "redux-form": "^6.5.0",
"styled-components": "^1.4.3",
"svg-react-loader": "^0.3.7",
"transform-props-with": "^2.1.0",
@@ -44,7 +47,7 @@
},
"devDependencies": {
"@kadira/storybook": "^2.35.3",
- "ava": "^0.18.1",
+ "ava": "^0.18.2",
"babel-cli": "^6.23.0",
"babel-core": "^6.23.1",
"babel-eslint": "^7.1.1",
@@ -61,12 +64,12 @@
"babel-preset-react": "^6.23.0",
"dangerously-set-inner-html": "2.0.0",
"enzyme": "^2.7.1",
- "eslint": "^3.15.0",
+ "eslint": "^3.16.0",
"eslint-config-semistandard": "^7.0.0",
"eslint-config-standard": "^6.2.1",
"eslint-plugin-babel": "^4.0.1",
"eslint-plugin-jsx-a11y": "^4.0.0",
- "eslint-plugin-promise": "^3.4.1",
+ "eslint-plugin-promise": "^3.4.2",
"eslint-plugin-react": "^6.10.0",
"eslint-plugin-standard": "^2.0.1",
"jsdom": "^9.11.0",
@@ -76,7 +79,7 @@
"pre-commit": "^1.2.2",
"react-addons-test-utils": "^15.4.2",
"st": "^1.2.0",
- "stylelint": "^7.8.0",
+ "stylelint": "^7.9.0",
"stylelint-config-standard": "^16.0.0",
"stylelint-processor-styled-components": "^0.0.4",
"tap-xunit": "^1.7.0"
diff --git a/ui/src/components/baseline-grid/story.js b/ui/src/components/baseline-grid/story.js
index 14f16695..cf82d613 100644
--- a/ui/src/components/baseline-grid/story.js
+++ b/ui/src/components/baseline-grid/story.js
@@ -6,7 +6,7 @@ const {
const Base = require('../base');
const BaseElements = require('../base-elements');
-const Input = require('../input');
+const Input = require('../form/input');
const {
H1
diff --git a/ui/src/components/checkbox/index.js b/ui/src/components/checkbox/index.js
deleted file mode 100644
index bdcc6615..00000000
--- a/ui/src/components/checkbox/index.js
+++ /dev/null
@@ -1,127 +0,0 @@
-const composers = require('../../shared/composers');
-const constants = require('../../shared/constants');
-const fns = require('../../shared/functions');
-const React = require('react');
-const Styled = require('styled-components');
-
-const {
- boxes
-} = constants;
-
-const {
- Baseline
-} = composers;
-
-const {
- remcalc
-} = fns;
-
-const {
- default: styled,
-} = Styled;
-
-const StyledInput = styled.input`
- visibility: hidden;
- &:checked + label::after {
- opacity: 1;
- }
- &:disabled + label {
- background-color: rgb(249, 249, 249);
- }
- &:disabled + label::after {
- opacity: 0.3;
- }
-`;
-
-const StyledLabel = styled.label`
- color: rgb(100, 100, 100);
- position: absolute;
- width: ${remcalc(24)};
- height: ${remcalc(24)};
- top: 0;
- border-radius: ${boxes.borderRadius};
- background-color: rgb(255, 255, 255);
- box-shadow: ${boxes.insetShaddow};
- border: ${boxes.border.unchecked};
-
- &::after {
- opacity: 0;
- content: '';
- position: absolute;
- width: ${remcalc(9)};
- height: ${remcalc(4)};
- background: transparent;
- top: ${remcalc(7)};
- left: ${remcalc(7)};
- border: ${remcalc(3)} solid #333;
- border-top: none;
- border-right: none;
- transform: rotate(-45deg);
- }
-
- &:hover {
- &::after {
- opacity: 0.3;
- }
- }
-`;
-
-const StyledDiv = styled.div`
- width: ${remcalc(24)};
- height: ${remcalc(24)};
- position: relative;
-`;
-
-const Checkbox = ({
- checked = false,
- children,
- className,
- disabled = false,
- form,
- id,
- name,
- onChange,
- readOnly,
- required,
- selectionDirection,
- style,
- tabIndex
-}) => (
-
-
-
- {children}
-
-
-);
-
-Checkbox.propTypes = {
- checked: React.PropTypes.bool,
- children: React.PropTypes.node,
- className: React.PropTypes.string,
- disabled: React.PropTypes.bool,
- form: React.PropTypes.string,
- id: React.PropTypes.string,
- name: React.PropTypes.string,
- onChange: React.PropTypes.func,
- readOnly: React.PropTypes.bool,
- required: React.PropTypes.bool,
- selectionDirection: React.PropTypes.string,
- style: React.PropTypes.object,
- tabIndex: React.PropTypes.string
-};
-
-module.exports = Baseline(
- Checkbox
-);
diff --git a/ui/src/components/checkbox/readme.md b/ui/src/components/checkbox/readme.md
deleted file mode 100644
index 71d653dd..00000000
--- a/ui/src/components/checkbox/readme.md
+++ /dev/null
@@ -1,40 +0,0 @@
-# `
`
-
-## demo
-
-```embed
-const React = require('react');
-const ReactDOM = require('react-dom/server');
-const Base = require('../base');
-const Container = require('../container');
-const Row = require('../row');
-const Column = require('../column');
-const Checkbox = require('./index.js');
-const styles = require('./style.css');
-
-nmodule.exports = ReactDOM.renderToString(
-
-
-
-
- Checkbox checked
-
-
-
-
-
-
- Checkbox unchecked
-
-
-
-
-
-
- Checkbox disabled
-
-
-
-
-);
-```
diff --git a/ui/src/components/checkbox/story.js b/ui/src/components/checkbox/story.js
deleted file mode 100644
index bdbebdab..00000000
--- a/ui/src/components/checkbox/story.js
+++ /dev/null
@@ -1,18 +0,0 @@
-const React = require('react');
-
-const {
- storiesOf
-} = require('@kadira/storybook');
-
-const Checkbox = require('./');
-
-storiesOf('Checkbox', module)
- .add('Default', () => (
-
- ))
- .add('Checked', () => (
-
- ))
- .add('Disabled', () => (
-
- ));
\ No newline at end of file
diff --git a/ui/src/components/form/base-input.js b/ui/src/components/form/base-input.js
new file mode 100644
index 00000000..5b3b5e31
--- /dev/null
+++ b/ui/src/components/form/base-input.js
@@ -0,0 +1,152 @@
+const Styled = require('styled-components');
+const ReactBroadcast = require('react-broadcast');
+const React = require('react');
+
+const constants = require('../../shared/constants');
+const fns = require('../../shared/functions');
+const is = require('../../shared/is');
+
+const {
+ colors,
+ boxes
+} = constants;
+
+const {
+ remcalc
+} = fns;
+
+const {
+ default: styled,
+ css
+} = Styled;
+
+const {
+ Subscriber
+} = ReactBroadcast;
+
+const colorWithDisabled = (props) => props.disabled
+ ? colors.inactive.default
+ : colors.fonts.regular;
+
+const colorWithDefaultValue = (props) => props.value === props.defaultValue
+ ? colors.inactive.default
+ : colorWithDisabled(props);
+
+const color = (props) => props.defaultValue
+ ? colorWithDefaultValue(props)
+ : colorWithDisabled(props);
+
+const height = (props) => !props.multiple
+ ? remcalc(48)
+ : 'auto';
+
+const paddingTop = (props) => props.multiple
+ ? remcalc(20)
+ : remcalc(13);
+
+const style = css`
+ box-sizing: border-box;
+
+ width: 100%;
+ height: ${height};
+
+ margin-bottom: ${remcalc(8)};
+ margin-top: ${remcalc(8)};
+ padding: ${paddingTop} ${remcalc(18)};
+
+ border-radius: ${boxes.borderRadius};
+ background-color: ${colors.base.white};
+ box-shadow: ${boxes.insetShaddow};
+ border: ${boxes.border.unchecked};
+
+ ${is('error')`
+ border-color: ${colors.inputError}
+ `};
+
+ ${is('warning')`
+ border-color: ${colors.inputWarning}
+ `};
+
+ ${is('success')`
+ border-color: ${colors.base.green}
+ `};
+
+ font-size: ${remcalc(16)};
+ line-height: normal !important;
+ font-weight: normal;
+ font-style: normal;
+ font-stretch: normal;
+ color: ${color};
+
+ appearance: none;
+ outline: 0;
+
+ &:focus {
+ border-color: ${colors.base.primary};
+ outline: 0;
+ }
+`;
+
+const BaseInput = (Component) => (props) => {
+ const render = (value) => {
+ const _value = (value || {});
+
+ const {
+ input = {},
+ meta = {},
+ id = ''
+ } = _value;
+
+ const hasError = !!(
+ props.error || // eslint-disable-line react/prop-types
+ _value.error ||
+ meta.error
+ );
+
+ const hasWarning = !!(
+ props.warning || // eslint-disable-line react/prop-types
+ _value.warning ||
+ meta.warning
+ );
+
+ const hasSuccess = !!(
+ props.success || // eslint-disable-line react/prop-types
+ _value.success ||
+ meta.success
+ );
+
+ return (
+
+ );
+ };
+
+ return (
+
+ {render}
+
+ );
+};
+
+BaseInput.propTypes = {
+ error: React.PropTypes.bool,
+ warning: React.PropTypes.bool
+};
+
+module.exports = BaseInput;
+
+module.exports.Stylable = (Component) => {
+ const stylable = typeof Component === 'string'
+ ? styled[Component]
+ : styled(Component);
+
+ return stylable`
+ ${style}
+ `;
+};
diff --git a/ui/src/components/form/checkbox.js b/ui/src/components/form/checkbox.js
new file mode 100644
index 00000000..a0a0589f
--- /dev/null
+++ b/ui/src/components/form/checkbox.js
@@ -0,0 +1,15 @@
+const composers = require('../../shared/composers');
+const BaseInput = require('./base-input');
+const Toggle = require('./toggle');
+
+const {
+ Baseline
+} = composers;
+
+const Checkbox = Toggle({
+ type: 'checkbox'
+});
+
+module.exports = Baseline(
+ BaseInput(Checkbox)
+);
diff --git a/ui/src/components/form/fieldset.js b/ui/src/components/form/fieldset.js
new file mode 100644
index 00000000..1e868e8c
--- /dev/null
+++ b/ui/src/components/form/fieldset.js
@@ -0,0 +1,31 @@
+const Styled = require('styled-components');
+const composers = require('../../shared/composers');
+
+const {
+ Baseline
+} = composers;
+
+const {
+ default: styled
+} = Styled;
+
+const Fieldset = styled.fieldset`
+ display: inline-block;
+ margin: 0;
+ padding: 0;
+ border: none;
+ overflow: hidden;
+ width: 100%;
+ height: auto;
+
+ -webkit-margin-start: 0;
+ -webkit-margin-end: 0;
+ -webkit-padding-before: 0;
+ -webkit-padding-start: 0;
+ -webkit-padding-end: 0;
+ -webkit-padding-after: 0;
+`;
+
+module.exports = Baseline(
+ Fieldset
+);
diff --git a/ui/src/components/form/group.js b/ui/src/components/form/group.js
new file mode 100644
index 00000000..ba2684ec
--- /dev/null
+++ b/ui/src/components/form/group.js
@@ -0,0 +1,93 @@
+const ReactBroadcast = require('react-broadcast');
+const ReduxForm = require('redux-form');
+const React = require('react');
+
+const Fieldset = require('./fieldset');
+const composers = require('../../shared/composers');
+const fns = require('../../shared/functions');
+
+const {
+ Broadcast
+} = ReactBroadcast;
+
+const {
+ Field
+} = ReduxForm;
+
+const {
+ Baseline
+} = composers;
+
+const {
+ rndId
+} = fns;
+
+const {
+ Component
+} = React;
+
+class FormGroup extends Component {
+ constructor(props) {
+ super(props);
+ this.renderGroup = this.renderGroup.bind(this);
+ }
+ renderGroup(inputProps) {
+ const {
+ className,
+ style,
+ children,
+ ...rest
+ } = this.props;
+
+ const value = {
+ id: rndId(),
+ ...rest,
+ ...inputProps
+ };
+
+ return (
+
+ );
+ }
+ render() {
+ const {
+ name = rndId(),
+ defaultValue,
+ normalize,
+ reduxForm = false
+ } = this.props;
+
+ if (!reduxForm) {
+ return this.renderGroup({});
+ }
+
+ return (
+
+ );
+ }
+}
+
+FormGroup.propTypes = {
+ children: React.PropTypes.node,
+ className: React.PropTypes.string,
+ defaultValue: React.PropTypes.string,
+ name: React.PropTypes.string,
+ normalize: React.PropTypes.func,
+ reduxForm: React.PropTypes.bool,
+ style: React.PropTypes.object
+};
+
+module.exports = Baseline(
+ FormGroup
+);
diff --git a/ui/src/components/form/index.js b/ui/src/components/form/index.js
new file mode 100644
index 00000000..3dc5373d
--- /dev/null
+++ b/ui/src/components/form/index.js
@@ -0,0 +1,10 @@
+module.exports = {
+ Checkbox: require('./checkbox'),
+ FormGroup: require('./group'),
+ FormLabel: require('./label'),
+ FormMeta: require('./meta'),
+ Input: require('./input'),
+ Select: require('./select'),
+ Radio: require('./radio').RadioList,
+ Fieldset: require('./fieldset')
+};
diff --git a/ui/src/components/form/input.js b/ui/src/components/form/input.js
new file mode 100644
index 00000000..3c5981f9
--- /dev/null
+++ b/ui/src/components/form/input.js
@@ -0,0 +1,14 @@
+const composers = require('../../shared/composers');
+const BaseInput = require('./base-input');
+
+const {
+ Baseline
+} = composers;
+
+const {
+ Stylable
+} = BaseInput;
+
+module.exports = Baseline(
+ BaseInput(Stylable('input'))
+);
diff --git a/ui/src/components/form/label-row.js b/ui/src/components/form/label-row.js
deleted file mode 100644
index 2fc0278e..00000000
--- a/ui/src/components/form/label-row.js
+++ /dev/null
@@ -1,30 +0,0 @@
-const composers = require('../../shared/composers');
-const Column = require('../column');
-const React = require('react');
-const Row = require('../row');
-
-const {
- Baseline
-} = composers;
-
-const LabelRow = (props) => {
- const labels = React.Children.map(props.children, (children) => (
-
- {children}
-
- ));
-
- return (
-
- {labels}
-
- );
-};
-
-LabelRow.propTypes = {
- children: React.PropTypes.node
-};
-
-module.exports = Baseline(
- LabelRow
-);
diff --git a/ui/src/components/form/label.js b/ui/src/components/form/label.js
index 016490d9..001a877e 100644
--- a/ui/src/components/form/label.js
+++ b/ui/src/components/form/label.js
@@ -1,33 +1,43 @@
-const composers = require('../../shared/composers');
-const constants = require('../../shared/constants');
-const fns = require('../../shared/functions');
+const React = require('react');
+const ReactBroadcast = require('react-broadcast');
const Styled = require('styled-components');
-
-const {
- colors
-} = constants;
-
-const {
- remcalc
-} = fns;
-
-const {
- Baseline
-} = composers;
+const fns = require('../../shared/functions');
const {
default: styled
} = Styled;
-const Label = styled.label`
- width: 100%;
- font-size: ${remcalc(16)};
- font-weight: 600;
- font-style: normal;
- font-stretch: normal;
- color: ${colors.base.secondary};
+const {
+ remcalc
+} = fns;
+
+const Label = require('../label');
+
+const {
+ Subscriber
+} = ReactBroadcast;
+
+const StyledLabel = styled(Label)`
+ margin-right: ${remcalc(12)};
`;
-module.exports = Baseline(
- Label
-);
+module.exports = (props) => {
+ const render = (value) => {
+ const {
+ id = ''
+ } = (value || {});
+
+ return (
+
+ );
+ };
+
+ return (
+
+ {render}
+
+ );
+};
diff --git a/ui/src/components/form/view.js b/ui/src/components/form/legend.js
similarity index 85%
rename from ui/src/components/form/view.js
rename to ui/src/components/form/legend.js
index bfa342ea..156dfa69 100644
--- a/ui/src/components/form/view.js
+++ b/ui/src/components/form/legend.js
@@ -1,5 +1,5 @@
-const composers = require('../../shared/composers');
const Styled = require('styled-components');
+const composers = require('../../shared/composers');
const {
Baseline
@@ -9,8 +9,6 @@ const {
default: styled
} = Styled;
-const View = styled.div``;
-
module.exports = Baseline(
- View
+ styled.legend``
);
diff --git a/ui/src/components/form/meta.js b/ui/src/components/form/meta.js
new file mode 100644
index 00000000..942e66c9
--- /dev/null
+++ b/ui/src/components/form/meta.js
@@ -0,0 +1,128 @@
+const Styled = require('styled-components');
+const ReactBroadcast = require('react-broadcast');
+const React = require('react');
+
+const Label = require('../label');
+const composers = require('../../shared/composers');
+const constants = require('../../shared/constants');
+const is = require('../../shared/is');
+
+const {
+ Subscriber
+} = ReactBroadcast;
+
+const {
+ breakpoints,
+ colors
+} = constants;
+
+const {
+ Baseline
+} = composers;
+
+const {
+ default: styled
+} = Styled;
+
+const StyledLabel = styled(Label)`
+ ${breakpoints.medium`
+ text-align: right;
+ `};
+
+ ${is('right')`
+ float: right;
+ `};
+
+ ${is('error')`
+ color: ${colors.inputError};
+ `};
+
+ ${is('warning')`
+ color: ${colors.inputWarning};
+ `};
+
+ ${is('success')`
+ color: ${colors.base.green};
+ `};
+`;
+
+const Meta = (props) => {
+ const render = (value) => {
+ const {
+ meta = {}
+ } = value;
+
+ const msg = (
+ props.children ||
+ props.error ||
+ props.warning ||
+ props.success ||
+ meta.error ||
+ meta.warning ||
+ meta.success ||
+ value.error ||
+ value.warning ||
+ value.success
+ );
+
+ const hasError = !!(
+ props.error ||
+ meta.error ||
+ value.error
+ );
+
+ const hasWarning = !!(
+ props.warning ||
+ meta.warning ||
+ value.warning
+ );
+
+ const hasSuccess = !!(
+ props.success ||
+ meta.success ||
+ value.success
+ );
+
+ const isRight = !props.left;
+
+ return (
+
+ {msg}
+
+ );
+ };
+
+ return (
+
+ {render}
+
+ );
+};
+
+Meta.propTypes = {
+ children: React.PropTypes.node,
+ error: React.PropTypes.oneOfType([
+ React.PropTypes.string,
+ React.PropTypes.bool
+ ]),
+ left: React.PropTypes.bool,
+ success: React.PropTypes.oneOfType([
+ React.PropTypes.string,
+ React.PropTypes.bool
+ ]),
+ warning: React.PropTypes.oneOfType([
+ React.PropTypes.string,
+ React.PropTypes.bool
+ ])
+};
+
+module.exports = Baseline(
+ Meta
+);
diff --git a/ui/src/components/form/msg.js b/ui/src/components/form/msg.js
deleted file mode 100644
index c94ab086..00000000
--- a/ui/src/components/form/msg.js
+++ /dev/null
@@ -1,38 +0,0 @@
-const composers = require('../../shared/composers');
-const constants = require('../../shared/constants');
-const Label = require('./label');
-const match = require('../../shared/match');
-const Styled = require('styled-components');
-
-const {
- breakpoints,
- colors
-} = constants;
-
-const {
- Baseline
-} = composers;
-
-const {
- default: styled
-} = Styled;
-
-const color = match.prop({
- warning: colors.inputWarning,
- error: colors.inputError,
- //disabled: colors.brandInactiveColor
-})('type');
-
-
-const Msg = styled(Label)`
- color: ${color};
-
- ${breakpoints.medium`
- float: right;
- text-align: right;
- `}
-`;
-
-module.exports = Baseline(
- Msg
-);
diff --git a/ui/src/components/form/outlet.js b/ui/src/components/form/outlet.js
deleted file mode 100644
index 0c44ce7d..00000000
--- a/ui/src/components/form/outlet.js
+++ /dev/null
@@ -1,73 +0,0 @@
-const constants = require('../../shared/constants');
-const fns = require('../../shared/functions');
-const Styled = require('styled-components');
-
-const {
- colors,
- boxes
-} = constants;
-
-const {
- remcalc
-} = fns;
-
-const {
- css
-} = Styled;
-
-const colorWithDisabled = (props) => props.disabled
- ? colors.inactive.default
- : colors.fonts.regular;
-
-const colorWithDefaultValue = (props) => props.value === props.defaultValue
- ? colors.inactive.default
- : colorWithDisabled(props);
-
-const color = (props) => props.defaultValue
- ? colorWithDefaultValue(props)
- : colorWithDisabled(props);
-
-const border = (props) => props.error
- ? boxes.border.error
- : boxes.border.unchecked;
-
-const height = (props) => !props.multiple
- ? remcalc(48)
- : 'auto';
-
-const paddingTop = (props) => props.multiple
- ? remcalc(20)
- : remcalc(13);
-
-const Outlet = css`
- box-sizing: border-box;
-
- width: 100%;
- height: ${height};
-
- margin-bottom: ${remcalc(8)};
- margin-top: ${remcalc(8)};
- padding: ${paddingTop} ${remcalc(18)};
-
- border-radius: ${boxes.borderRadius};
- background-color: ${colors.base.white};
- box-shadow: ${boxes.insetShaddow};
- border: ${border};
-
- font-size: ${remcalc(16)};
- line-height: normal;
- font-weight: normal;
- font-style: normal;
- font-stretch: normal;
- color: ${color};
-
- appearance: none;
- outline: 0;
-
- &:focus {
- border-color: ${colors.base.primary};
- outline: 0;
- }
-`;
-
-module.exports = Outlet;
diff --git a/ui/src/components/form/radio.js b/ui/src/components/form/radio.js
new file mode 100644
index 00000000..641fa4fa
--- /dev/null
+++ b/ui/src/components/form/radio.js
@@ -0,0 +1,35 @@
+const Styled = require('styled-components');
+
+const Toggle = require('./toggle');
+const composers = require('../../shared/composers');
+const BaseInput = require('./base-input');
+
+const {
+ default: styled
+} = Styled;
+
+const {
+ Baseline
+} = composers;
+
+const RadioItem = BaseInput(styled.li`
+ list-style-type: none;
+`);
+
+const RadioList = styled.ul`
+ margin: 0;
+ padding: 0;
+`;
+
+const Radio = Toggle({
+ container: RadioItem,
+ type: 'radio'
+});
+
+module.exports = Baseline(
+ Radio
+);
+
+module.exports.RadioList = Baseline(
+ RadioList
+);
diff --git a/ui/src/components/form/select.js b/ui/src/components/form/select.js
new file mode 100644
index 00000000..0be3bf65
--- /dev/null
+++ b/ui/src/components/form/select.js
@@ -0,0 +1,14 @@
+const composers = require('../../shared/composers');
+const BaseInput = require('./base-input');
+
+const {
+ Baseline
+} = composers;
+
+const {
+ Stylable
+} = BaseInput;
+
+module.exports = Baseline(
+ BaseInput(Stylable('select'))
+);
diff --git a/ui/src/components/form/toggle.js b/ui/src/components/form/toggle.js
new file mode 100644
index 00000000..263f4ae0
--- /dev/null
+++ b/ui/src/components/form/toggle.js
@@ -0,0 +1,178 @@
+const Styled = require('styled-components');
+const ReactBroadcast = require('react-broadcast');
+const React = require('react');
+
+const fns = require('../../shared/functions');
+const is = require('../../shared/is');
+const constants = require('../../shared/constants');
+const BaseInput = require('./base-input');
+
+const {
+ Subscriber
+} = ReactBroadcast;
+
+const {
+ boxes,
+ colors
+} = constants;
+
+const {
+ remcalc
+} = fns;
+
+const {
+ default: styled,
+} = Styled;
+
+const Input = styled.input`
+ display: none;
+
+ &:checked + label::after {
+ opacity: 1;
+ }
+
+ &:selected + label::after {
+ opacity: 1;
+ }
+
+ &:disabled + label {
+ background-color: rgb(249, 249, 249);
+ }
+
+ &:disabled + label::after {
+ opacity: 0.3;
+ }
+`;
+
+const Label = styled.label`
+ color: rgb(100, 100, 100);
+ position: absolute;
+ width: ${remcalc(22)};
+ height: ${remcalc(22)};
+ top: 0;
+
+ background-color: rgb(255, 255, 255);
+ box-shadow: ${boxes.insetShaddow};
+ border: ${boxes.border.unchecked};
+
+ ${is('checkbox')`
+ border-radius: ${boxes.borderRadius};
+ `};
+
+ ${is('radio')`
+ border-radius: ${remcalc(11)};
+ `};
+
+ ${is('error')`
+ border-color: ${colors.inputError}
+ `};
+
+ ${is('warning')`
+ border-color: ${colors.inputWarning}
+ `};
+
+ ${is('success')`
+ border-color: ${colors.base.green}
+ `};
+
+ ${is('radio')`
+ &::after {
+ opacity: 0;
+ content: '';
+ position: absolute;
+ width: ${remcalc(8)};
+ height: ${remcalc(8)};
+ border-radius: ${remcalc(4)};
+ background-color: ${colors.base.secondaryDark};
+ border-top: none;
+ border-right: none;
+ top: ${remcalc(8)};
+ left: ${remcalc(8)};
+ }
+ `};
+
+ ${is('checkbox')`
+ &::after {
+ opacity: 0;
+ content: '';
+ position: absolute;
+ width: ${remcalc(9)};
+ height: ${remcalc(4)};
+ background: transparent;
+ top: ${remcalc(7)};
+ left: ${remcalc(7)};
+ border: ${remcalc(3)} solid #333;
+ border-top: none;
+ border-right: none;
+ transform: rotate(-45deg);
+ }
+ `};
+
+ &:hover {
+ &::after {
+ opacity: 0.3;
+ }
+ }
+`;
+
+const InnerContainer = styled.div`
+ display: inline-block;
+ margin-right: ${remcalc(12)}
+ vertical-align: text-bottom;
+ width: ${remcalc(24)};
+ height: ${remcalc(24)};
+ position: relative;
+`;
+
+const Toggle = ({
+ container = null,
+ type = 'radio'
+}) => BaseInput(({
+ children,
+ ...props
+}) => {
+ const OuterContainer = container
+ ? container
+ : null;
+
+ const types = {
+ [type]: true
+ };
+
+ const render = (value) => {
+ const toggle = (
+
+
+
+
+ );
+
+ return !OuterContainer ? toggle : (
+
+ {toggle}
+ {children}
+
+ );
+ };
+
+ return (
+
+ {render}
+
+ );
+});
+
+module.exports = Toggle;
diff --git a/ui/src/components/input/index.js b/ui/src/components/input/index.js
deleted file mode 100644
index 75c3dca8..00000000
--- a/ui/src/components/input/index.js
+++ /dev/null
@@ -1,89 +0,0 @@
-const fns = require('../../shared/functions');
-const reduxFormProxy = require('../../shared/redux-form-proxy');
-const composers = require('../../shared/composers');
-
-const React = require('react');
-const Styled = require('styled-components');
-
-const Label = require('../form/label');
-const LabelRow = require('../form/label-row');
-const Msg = require('../form/msg');
-const Outlet = require('../form/outlet');
-const View = require('../form/view');
-
-const {
- rndId
-} = fns;
-
-const {
- Baseline
-} = composers;
-
-const {
- default: styled
-} = Styled;
-
-const StyledInput = styled.input`
- ${Outlet}
-`;
-
-const Input = (props) => {
- const {
- children,
- id = rndId(),
- label = '',
- error = '',
- warning = ''
- } = props;
-
- const viewProps = [
- 'children',
- 'style',
- 'className'
- ];
-
- // reset props for
- const newProps = Object.keys(props).reduce((sum, key) => ({
- ...sum,
- [key]: viewProps.indexOf(key) < 0 ? props[key] : null
- }),{});
-
- const _label = !label.length ? null : (
-
- );
-
- const msgType = error ? 'error' : (warning ? 'warning' : null);
-
- const _msg = !(error || warning) ? null : (
-
- {error ? error : warning}
-
- );
-
- return (
-
-
- {_label}
- {_msg}
-
-
- {children}
-
- );
-};
-
-Input.propTypes = {
- children: React.PropTypes.node,
- className: React.PropTypes.string,
- error: React.PropTypes.string,
- id: React.PropTypes.string,
- label: React.PropTypes.string,
- style: React.PropTypes.object,
- warning: React.PropTypes.string
-};
-
-module.exports = reduxFormProxy(
- Baseline(Input)
-);
diff --git a/ui/src/components/input/readme.md b/ui/src/components/input/readme.md
deleted file mode 100644
index e199c638..00000000
--- a/ui/src/components/input/readme.md
+++ /dev/null
@@ -1,60 +0,0 @@
-# Input
-
-## demo
-
-```embed
-const React = require('react');
-const ReactDOM = require('react-dom/server');
-const Base = require('../base');
-const Container = require('../container');
-const Row = require('../row');
-const Column = require('../column');
-const Input = require('./index.js');
-
-nmodule.exports = ReactDOM.renderToString(
-
-
-
-
- We'll never share your email with anyone else.
-
-
-
-
-
-
- Password
-
-
-
-
-);
-```
-
-## usage
-
-```js
-const React = require('react');
-const Input = require('ui/input');
-
-module.exports = () => {
- return (
-
-
- We'll never share your email with anyone else.
-
-
- Password
-
-
- );
-}
-```
diff --git a/ui/src/components/input/story.js b/ui/src/components/input/story.js
deleted file mode 100644
index c7571fae..00000000
--- a/ui/src/components/input/story.js
+++ /dev/null
@@ -1,42 +0,0 @@
-const React = require('react');
-
-const {
- storiesOf
-} = require('@kadira/storybook');
-
-const Base= require('../base');
-const Input = require('./');
-
-storiesOf('Input', module)
- .add('Default', () => (
-
-
-
- ))
- .add('type=email', () => (
-
-
- We'll never share your email with anyone else.
-
-
- ))
- .add('Error', () => (
-
-
-
- ))
- .add('Success', () => (
-
-
-
- ));
\ No newline at end of file
diff --git a/ui/src/components/label/index.js b/ui/src/components/label/index.js
new file mode 100644
index 00000000..b716e988
--- /dev/null
+++ b/ui/src/components/label/index.js
@@ -0,0 +1,32 @@
+const composers = require('../../shared/composers');
+const constants = require('../../shared/constants');
+const fns = require('../../shared/functions');
+const Styled = require('styled-components');
+
+const {
+ colors
+} = constants;
+
+const {
+ remcalc
+} = fns;
+
+const {
+ Baseline
+} = composers;
+
+const {
+ default: styled
+} = Styled;
+
+const Label = styled.label`
+ font-size: ${remcalc(16)};
+ font-weight: 600;
+ font-style: normal;
+ font-stretch: normal;
+ color: ${colors.base.secondary};
+`;
+
+module.exports = Baseline(
+ Label
+);
diff --git a/ui/src/components/radio-group/index.js b/ui/src/components/radio-group/index.js
deleted file mode 100644
index 677d1a14..00000000
--- a/ui/src/components/radio-group/index.js
+++ /dev/null
@@ -1,160 +0,0 @@
-/* After some time tring to make this work without messing w/ checked property,
- * I ended up using it *only* when none is defined
- *
- * This way we try to be as pure as possible and not mess with consumer's logic
- * if they have any
- */
-
-const composers = require('../../shared/composers');
-const first = require('lodash.first');
-const isUndefined = require('lodash.isundefined');
-const get = require('lodash.get');
-const Item = require('./item');
-const find = require('lodash.find');
-const classNames = require('classnames');
-const React = require('react');
-// const styles = require('./style.css');
-
-const {
- Baseline
-} = composers;
-
-const RadioGroup = React.createClass({
- propTypes: {
- children: React.PropTypes.node,
- className: React.PropTypes.string,
- id: React.PropTypes.string,
- name: React.PropTypes.string,
- onChange: React.PropTypes.func,
- style: React.PropTypes.object
- },
- getInitialState: function() {
- return this.getState(this.props);
- },
- componentWillReceiveProps: function(nextProps) {
- return this.setState(nextProps);
- },
- getState: function(props) {
- const _children = React.Children.toArray(props.children).filter((child) => {
- return get(child, 'type.displayName') === 'Radio';
- });
-
- const hasChecked = _children.some((child) => {
- return !isUndefined(get(child, 'props.checked'));
- });
-
- if (hasChecked) {
- return {
- hasChecked
- };
- }
-
- const defaultChecked = get(find(_children, (child) => {
- return get(child, 'props.defaultChecked');
- }), 'props.value');
-
- const checked = (() => {
- const stateChecked = get(this, 'state.checked');
- const fallback = isUndefined(defaultChecked)
- ? get(first(_children), 'props.value')
- : defaultChecked;
-
- return !isUndefined(stateChecked) ? stateChecked : fallback;
- })();
-
- return {
- checked
- };
- },
- handleChange: function(key) {
- return (ev) => {
- const {
- onChange = () => {}
- } = this.props;
-
- this.setState({
- checked: key
- }, () => {
- onChange(ev);
- });
- };
- },
- render: function() {
- const {
- name,
- children,
- className,
- id,
- style
- } = this.props;
-
- const {
- hasChecked,
- checked
- } = this.state;
-
- const {
- handleChange
- } = this;
-
- const cn = classNames(
- className
- );
-
- const _children = React.Children.map(children, (child, i) => {
- if (child.type.name !== 'Radio') {
- return child;
- }
-
- const tabIndex = i + 1;
- const disabled = get(child, 'props.disabled');
- const value = get(child, 'props.value');
- const itemContent = get(child, 'props.children');
-
- const _handleChange = (!hasChecked && !disabled)
- ? handleChange(value)
- : undefined;
-
- const _child = hasChecked ? (
- React.cloneElement(child, {
- name
- })
- ) : (
- React.cloneElement(child, {
- onChange: _handleChange,
- checked: value === checked,
- defaultChecked: undefined,
- name
- })
- );
-
- const _checked = get(_child, 'props.checked');
-
- return (
- -
- {_child}
-
- );
- });
-
- return (
-
- {_children}
-
- );
- }
-});
-
-module.exports = Baseline(
- RadioGroup
-);
diff --git a/ui/src/components/radio-group/readme.md b/ui/src/components/radio-group/readme.md
deleted file mode 100644
index 2245bb3f..00000000
--- a/ui/src/components/radio-group/readme.md
+++ /dev/null
@@ -1,35 +0,0 @@
-# ``
-
-## demo
-
-```embed
-const React = require('react');
-const ReactDOM = require('react-dom/server');
-const Base = require('../base');
-const Container = require('../container');
-const Row = require('../row');
-const Column = require('../column');
-const Radio = require('../radio');
-const RadioGroup = require('./index');
-const styles = require('./style.css');
-
-nmodule.exports = ReactDOM.renderToString(
-
-
-
-
-
- You get all the good bits and none of the rubbish
-
-
- You get all the good bits and extra brownies
-
-
- You get none of the good bits
-
-
-
-
-
-);
-```
\ No newline at end of file
diff --git a/ui/src/components/radio-group/story.js b/ui/src/components/radio-group/story.js
deleted file mode 100644
index 09d7b34f..00000000
--- a/ui/src/components/radio-group/story.js
+++ /dev/null
@@ -1,27 +0,0 @@
-const React = require('react');
-
-const {
- storiesOf
-} = require('@kadira/storybook');
-
-const Base= require('../base');
-const RadioGroup = require('./');
-const Radio = require('./item');
-
-
-storiesOf('Radio Group', module)
- .add('Default', () => (
-
-
-
- Video killed the radio star
-
-
- Video killed the radio star
-
-
- Video killed the radio star
-
-
-
- ));
\ No newline at end of file
diff --git a/ui/src/components/radio/readme.md b/ui/src/components/radio/readme.md
deleted file mode 100644
index 743ac817..00000000
--- a/ui/src/components/radio/readme.md
+++ /dev/null
@@ -1,43 +0,0 @@
-# ``
-
-## demo
-
-```embed
-const React = require('react');
-const ReactDOM = require('react-dom/server');
-const Base = require('../base');
-const Container = require('../container');
-const Row = require('../row');
-const Column = require('../column');
-const Radio = require('./index.js');
-const styles = require('./style.css');
-
-nmodule.exports = ReactDOM.renderToString(
-
-
-
-
- Female
-
-
- Male
-
-
-
-
-);
-```
-
-## usage
-
-```js
-const React = require('react');
-const Radio = require('ui/radio');
-
-module.exports = () => {
- return (
-
-
- );
-}
-```
diff --git a/ui/src/components/radio/story.js b/ui/src/components/radio/story.js
deleted file mode 100644
index ed9697ad..00000000
--- a/ui/src/components/radio/story.js
+++ /dev/null
@@ -1,20 +0,0 @@
-const React = require('react');
-
-const {
- storiesOf
-} = require('@kadira/storybook');
-
-const Radio = require('./');
-
-storiesOf('Radio', module)
- .add('Default', () => (
-
- Video killed the radio star
-
- ))
- .add('Checked', () => (
-
- ))
- .add('Disabled', () => (
-
- ));
\ No newline at end of file
diff --git a/ui/src/components/row/index.js b/ui/src/components/row/index.js
index a6709599..695fead4 100644
--- a/ui/src/components/row/index.js
+++ b/ui/src/components/row/index.js
@@ -3,11 +3,14 @@
* github.com/roylee0704/react-flexbox-grid/blob/master/src/components/Row.js
*/
+const Styled = require('styled-components');
+const React = require('react');
+
+const Column = require('../column');
const composers = require('../../shared/composers');
const constants = require('../../shared/constants');
const match = require('../../shared/match');
const sizeMatch = require('./size-match');
-const Styled = require('styled-components');
const {
breakpoints,
@@ -56,7 +59,7 @@ const alignItems = (size) => match(sizeMatch(size, {
*
* ```
**/
-const Row = styled.div`
+const StyledRow = styled.div`
box-sizing: border-box;
display: flex;
flex: 0 1 auto;
@@ -76,7 +79,6 @@ const Row = styled.div`
justify-content: ${justify('sm')};
text-align: ${textAlign('sm')};
align-items: ${alignItems('sm')};
-
`}
${breakpoints.medium`
@@ -94,6 +96,29 @@ const Row = styled.div`
`}
`;
+const Row = ({
+ stretch = false,
+ children,
+ ...rest
+}) => {
+ return stretch ? (
+
+
+ {children}
+
+
+ ) : (
+
+ {children}
+
+ );
+};
+
+Row.propTypes = {
+ children: React.PropTypes.node,
+ stretch: React.PropTypes.bool
+};
+
module.exports = Baseline(
Row
);
diff --git a/ui/src/components/select/index.js b/ui/src/components/select/index.js
deleted file mode 100644
index e1f94c3b..00000000
--- a/ui/src/components/select/index.js
+++ /dev/null
@@ -1,102 +0,0 @@
-const composers = require('../../shared/composers');
-const reduxFormProxy = require('../../shared/redux-form-proxy');
-const fns = require('../../shared/functions');
-const React = require('react');
-const Styled = require('styled-components');
-
-const Label = require('../form/label');
-const LabelRow = require('../form/label-row');
-const Msg = require('../form/msg');
-const Outlet = require('../form/outlet');
-const View = require('../form/view');
-
-const {
- rndId
-} = fns;
-
-const {
- Baseline
-} = composers;
-
-const {
- default: styled
-} = Styled;
-
-const defaultValue = rndId();
-
-const StyledSelect = styled.select`
- ${Outlet}
-`;
-
-const Select = (props) => {
- const {
- children,
- disabled = false,
- error = '',
- id = rndId(),
- label = '',
- multiple = false,
- name = '',
- placeholder = '',
- value = defaultValue,
- warning = ''
- } = props;
-
- const _label = !label.length ? null : (
-
- );
-
- const _placeholder = !placeholder ? null : (
-
- );
-
- const msgType = error ? 'error' : (warning ? 'warning' : null);
-
- const _msg = !(error || warning) ? null : (
-
- {error ? error : warning}
-
- );
-
- return (
-
-
- {_label}
- {_msg}
-
-
- {_placeholder}
- {children}
-
-
- );
-};
-
-Select.propTypes = {
- children: React.PropTypes.node,
- disabled: React.PropTypes.bool,
- error: React.PropTypes.string,
- id: React.PropTypes.string,
- label: React.PropTypes.string,
- multiple: React.PropTypes.bool,
- name: React.PropTypes.string,
- placeholder: React.PropTypes.string,
- value: React.PropTypes.string,
- warning: React.PropTypes.string
-};
-
-module.exports = reduxFormProxy(
- Baseline(Select)
-);
diff --git a/ui/src/components/select/readme.md b/ui/src/components/select/readme.md
deleted file mode 100644
index 78684710..00000000
--- a/ui/src/components/select/readme.md
+++ /dev/null
@@ -1,60 +0,0 @@
-# Select
-
-
-## demo
-
-```embed
-const React = require('react');
-const ReactDOM = require('react-dom/server');
-const Base = require('../base');
-const Container = require('../container');
-const Row = require('../row');
-const Column = require('../column');
-const Select = require('./index.js');
-
-nmodule.exports = ReactDOM.renderToString(
-
-
-
-
-
-
-
-
-
-
-
-
-);
-```
-
-## usage
-
-```js
-const React = require('react');
-const Select = require('ui/select');
-
-module.exports = () => {
- return (
-
- );
-}
-```
diff --git a/ui/src/components/select/story.js b/ui/src/components/select/story.js
deleted file mode 100644
index 697d5833..00000000
--- a/ui/src/components/select/story.js
+++ /dev/null
@@ -1,80 +0,0 @@
-const React = require('react');
-
-const {
- storiesOf
-} = require('@kadira/storybook');
-
-const Select = require('./');
-const Base = require('../base');
-
-
-storiesOf('Select', module)
- .add('Default', () => (
-
-
-
- ))
- .add('disabled', () => (
-
-
-
- ))
- .add('selected', () => (
-
-
-
- ))
- .add('multiple', () => (
-
-
-
- ))
- .add('warning', () => (
-
-
-
- ))
- .add('error', () => (
-
-
-
- ));
diff --git a/ui/src/components/table-data-table/index.js b/ui/src/components/table-data-table/index.js
index 3dfd5648..14a5d320 100644
--- a/ui/src/components/table-data-table/index.js
+++ b/ui/src/components/table-data-table/index.js
@@ -23,12 +23,13 @@ const StyledTableWrapper = styled.section`
const Table = ({
children,
+ className,
columns = [],
data = [],
style,
title
}) => (
-
+
{title}
(
-
+
{children}
);
Table.propTypes = {
children: React.PropTypes.node,
+ className: React.PropTypes.string,
style: React.PropTypes.object,
- title: React.PropTypes.string,
+ title: React.PropTypes.string
};
module.exports = Baseline(
diff --git a/ui/src/components/textarea/readme.md b/ui/src/components/textarea/readme.md
deleted file mode 100644
index e199c638..00000000
--- a/ui/src/components/textarea/readme.md
+++ /dev/null
@@ -1,60 +0,0 @@
-# Input
-
-## demo
-
-```embed
-const React = require('react');
-const ReactDOM = require('react-dom/server');
-const Base = require('../base');
-const Container = require('../container');
-const Row = require('../row');
-const Column = require('../column');
-const Input = require('./index.js');
-
-nmodule.exports = ReactDOM.renderToString(
-
-
-
-
- We'll never share your email with anyone else.
-
-
-
-
-
-
- Password
-
-
-
-
-);
-```
-
-## usage
-
-```js
-const React = require('react');
-const Input = require('ui/input');
-
-module.exports = () => {
- return (
-
-
- We'll never share your email with anyone else.
-
-
- Password
-
-
- );
-}
-```
diff --git a/ui/src/components/textarea/story.js b/ui/src/components/textarea/story.js
deleted file mode 100644
index d74a5ee3..00000000
--- a/ui/src/components/textarea/story.js
+++ /dev/null
@@ -1,24 +0,0 @@
-const React = require('react');
-
-const {
- storiesOf
-} = require('@kadira/storybook');
-
-const Base= require('../base');
-const Textarea = require('./');
-
-storiesOf('Textarea', module)
- .add('Default', () => (
-
-
-
- ))
- .add('Error', () => (
-
-
-
- ));
\ No newline at end of file
diff --git a/ui/src/components/topology/story-helper.js b/ui/src/components/topology/story-helper.js
index b7ca9e3d..54700e65 100644
--- a/ui/src/components/topology/story-helper.js
+++ b/ui/src/components/topology/story-helper.js
@@ -1,8 +1,8 @@
const React = require('react');
const Styled = require('styled-components');
const composers = require('../../shared/composers');
-const Input = require('../input');
-const Select = require('../select');
+const Input = require('../form/input');
+const Select = require('../form/select');
const Topology = require('./');
const data = require('./data');
diff --git a/ui/src/index.js b/ui/src/index.js
index 56484eca..80da8dc9 100644
--- a/ui/src/index.js
+++ b/ui/src/index.js
@@ -4,29 +4,28 @@ module.exports = {
Anchor: require('./components/anchor'),
Avatar: require('./components/avatar'),
Button: require('./components/button'),
- Checkbox: require('./components/checkbox'),
+ Checkbox: require('./components/form/checkbox'),
Column: require('./components/column'),
Container: require('./components/container'),
Close: require('./components/close'),
- Input: require('./components/input'),
+ Form: require('./components/form'),
+ Input: require('./components/form/input'),
List: require('./components/list'),
Modal: require('./components/modal'),
MiniMetric: require('./components/mini-metric'),
NavLink: require('./components/nav-link'),
Notificaton: require('./components/notification'),
Pagination: require('./components/pagination'),
- Radio: require('./components/radio'),
- RadioGroup: require('./components/radio-group'),
+ Radio: require('./components/form/radio').RadioList,
RangeSlider: require('./components/range-slider'),
Row: require('./components/row'),
- Select: require('./components/select'),
+ Select: require('./components/form/select'),
SelectCustom: require('./components/select-custom'),
Tab: require('./components/tabs/tab'),
Tabs: require('./components/tabs'),
Toggle: require('./components/toggle'),
Topology: require('./components/topology'),
Tooltip: require('./components/tooltip'),
- Textarea: require('./components/textarea'),
Widget: require('./components/widget'),
- BaseElements: require('./components/base-elements'),
+ BaseElements: require('./components/base-elements')
};
diff --git a/ui/src/shared/is.js b/ui/src/shared/is.js
new file mode 100644
index 00000000..6de6aff7
--- /dev/null
+++ b/ui/src/shared/is.js
@@ -0,0 +1,9 @@
+const Styled = require('styled-components');
+
+const {
+ css
+} = Styled;
+
+module.exports = (prop) => (...args) => (props) => props[prop]
+ ? css(...args)
+ : css``;
diff --git a/ui/test/index.js b/ui/test/index.js
index 74f8bcd6..6dd37aa2 100644
--- a/ui/test/index.js
+++ b/ui/test/index.js
@@ -31,7 +31,7 @@ test('renders without exploding', (t) => {
});
test('renders without exploding', (t) => {
- const Checkbox = require('../src/components/checkbox');
+ const Checkbox = require('../src/components/form/checkbox');
const wrapper = shallow();
t.deepEqual(wrapper.length, 1);
});
@@ -55,7 +55,7 @@ test('renders without exploding', (t) => {
// });
test('renders without exploding', (t) => {
- const Radio = require('../src/components/radio');
+ const Radio = require('../src/components/form/radio');
const wrapper = shallow();
t.deepEqual(wrapper.length, 1);
});
@@ -97,7 +97,7 @@ test('renders without exploding', (t) => {
});
test('renders without exploding', (t) => {
- const Input = require('../src/components/input');
+ const Input = require('../src/components/form/input');
const wrapper = shallow();
t.deepEqual(wrapper.length, 1);
});
@@ -109,7 +109,7 @@ test('renders without exploding', (t) => {
});
test('renders