var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

import R from 'ramda';
import React from 'react';
import seeds, { Seed } from 'react-seeds';
import rgba from 'react-sow/rgba';

import * as assets from './assets';
import * as Vanilla from './Vanilla';
import { renderTreeUsing } from './render';

var buttonTagsToClass = R.converge(R.unapply(R.join(' ')), [R.always('mui-btn'), R.ifElse(R.pathEq(['variation', 'texts'], ['raised']), R.always('mui-btn--raised'), R.always('')), R.ifElse(R.pathEq(['variation', 'texts'], ['flat']), R.always('mui-btn--flat'), R.always('')), R.cond([[R.has('primary'), R.always('mui-btn--primary')],
//[ R.has('secondary'), R.always('mui-btn--flat') ],
[R.T, R.always('')]]), R.cond([[R.has('large'), R.always('mui-btn--large')], [R.has('small'), R.always('mui-btn--small')], [R.has('extrasmall'), R.always('mui-btn--small')], [R.T, R.always('')]])]);

export var button = function button(tags, mentions, texts) {
	return React.createElement('button', _extends({}, seeds({ alignSelf: 'center', margin: { bottom: '0.5rem' }, maxWidth: '20em' }), {
		disabled: R.has('disabled', tags),
		className: buttonTagsToClass(tags),
		children: texts
	}));
};

var elementRendererForTags = Vanilla.extendTagConds([[R.has('field'), R.curry(Vanilla.makeField({ wrapperClassName: 'mui-textfield', wrapInDiv: true }))], [R.has('choice'), R.curry(Vanilla.makeChoice({ wrapperClassName: { select: 'mui-select', checkbox: 'mui-checkbox', radio: 'mui-radio' }, wrapInDiv: true }))], [R.has('button'), R.curry(button)], [R.has('cta'), R.curry(button)]]);

export var Preview = renderTreeUsing({ elementRendererForTags: elementRendererForTags });

export var title = 'MuiCSS';

export function head() {
	return [React.createElement('link', { href: '//cdn.muicss.com/mui-0.9.9-rc2/css/mui.min.css', rel: 'stylesheet', type: 'text/css' }), React.createElement('script', { src: '//cdn.muicss.com/mui-0.9.9-rc2/js/mui.min.js' })];
}