);
}
return;
}
render() {
return (
{this.props.children}
{this.overlay()}
);
}
}
module.exports = BottomSheet;@import '../../essence-core/src/less/mixins.less';
//Font and color:
//Text: Roboto Regular 16sp, #000 87%
//Title (optional): Roboto Regular 16sp, #000 54%
//Default bottom sheet background fill: #FFF
//Overlay shield fill: #000 20%
.e-bottom-sheet {
position: fixed;
left: 0;
bottom: -500px;
box-sizing: border-box;
margin: 0;
padding: @e-unit (@e-unit*2);
width: 100%;
z-index: 99999;
.transition(all 0.2s ease-in-out);
& ul {
list-style-type: none;
padding: 0;
margin: 0;
& a {
height: @e-unit*6;
padding: 0;
& i {
float: left;
line-height: @e-unit*6;
color: inherit;
}
& span {
display: inline-block;
font-size: 16px;
line-height: @e-unit*9;
color: rgba(0 ,0 ,0 , 0.87);
}
}
}
&.animate {
bottom: 0px;
}
&.big-icons {
padding: 0 @e-unit*3 @e-unit*3 @e-unit*3;
& li {
float: left;
width: 33%;
padding-top: @e-unit*2;
& a {
display:table;
height: inherit;
text-align: center;
& i {
display: table-header-group;
width: auto;
margin: @e-unit 0;
font-size: @e-unit*6;
}
& span {
display: table-footer-group;
width: 100%;
line-height: @e-unit*2;
font-size: @e-unit*1.75;
}
}
}
& li:nth-child(3n+1) a {
float: left;
}
& li:nth-child(3n+2) a {
margin:0 auto;
}
& li:nth-child(3n+3) a {
float: right;
}
}
}var path = require('path');
var react = require('react');
var webpack = require('webpack');
module.exports = {
entry: {
'bottomsheet': path.resolve(__dirname, './src/bottomsheet.jsx')
},
output: {
path: path.resolve(__dirname, './lib'),
filename: '[name].js'
},
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015', 'react']
}
},
{
test: /\.less$/,
loader: 'style-loader!css-loader!less-loader'
},
{
test: /\.css$/,
loader: 'style-loader!css-loader'
}
]
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: true
},
}),
]
};'use strict';
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; };
var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _essenceCore = require('essence-core');
require('./button.less');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
//require('!css!less!./button.less');
var Btn = (function (_React$Component) {
_inherits(Btn, _React$Component);
function Btn(props) {
_classCallCheck(this, Btn);
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(Btn).call(this, props));
_this.state = {
classes: (0, _classnames2.default)({ 'e-ripple': _this.props.ripple === false ? false : true }, _this.props.className, _this.props.classes),
ripple: _this.props.ripple,
type: _this.props.type,
label: _this.props.label,
isDisabled: _this.props.isDisabled,
icon: _this.props.icon,
tooltipText: _this.props.tooltipText,
tooltipPosition: _this.props.tooltipPosition,
color: '',
position: {
x: 0,
y: 0
}
};
return _this;
}
_createClass(Btn, [{
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
this.setState({
classes: (0, _classnames2.default)({ 'e-ripple': nextProps.ripple === false ? false : true }, nextProps.className, nextProps.classes),
ripple: nextProps.ripple,
type: nextProps.type,
label: nextProps.label,
isDisabled: nextProps.isDisabled,
icon: nextProps.icon,
tooltipText: nextProps.tooltipText,
tooltipPosition: nextProps.tooltipPosition
});
}
}, {
key: 'renderRipple',
value: function renderRipple() {
if (this.state.ripple === false) {
return;
}
return _react2.default.createElement(_essenceCore.RippleInk, {
color: this.state.color,
position: this.state.position });
}
}, {
key: 'renderContent',
value: function renderContent() {
if (this.state.type === 'touchpad') {
return _react2.default.createElement(
'div',
{ className: 'container' },
_react2.default.createElement(
'i',
{ key: 'touchpad-icon', className: 'e-icon-' + this.state.icon },
_react2.default.createElement(
'span',
{ key: 'touchpad-label', className: 'label' },
this.state.label
)
)
);
}
if (this.state.icon) {
return _react2.default.createElement('i', { className: 'e-icon-' + this.state.icon });
}
return this.state.label || '';
}
}, {
key: 'handleClick',
value: function handleClick(event) {
var boundingClient = this.currentButton.getBoundingClientRect();
this.setState({
color: _essenceCore.Utils.BackgroundColor(event),
position: _essenceCore.Utils.ClickPosition(event, boundingClient)
});
return this.props.onClick ? this.props.onClick(event) : true;
}
}, {
key: 'renderBtn',
value: function renderBtn() {
var _this2 = this;
var buttonType = this.state.type === 'touchpad' ? 'default flat' : this.state.type || 'default flat';
var buttonClasses = (0, _classnames2.default)(this.state.classes, 'e-btn-' + buttonType);
var disableOption = {};
if (this.state.isDisabled) {
disableOption['disabled'] = 'disabled';
} else {
disableOption = {};
}
return _react2.default.createElement(
'button',
_extends({}, this.props, {
className: buttonClasses,
onClick: this.handleClick.bind(this),
onTouch: this.handleClick.bind(this),
ref: function ref(_ref) {
return _this2.currentButton = _ref;
},
'data-tooltip': this.state.tooltipText,
'data-position': this.state.tooltipPosition || 'top'
}, disableOption, {
type: this.props.submit ? 'submit' : 'button'
}),
this.renderRipple(),
this.renderContent()
);
}
}, {
key: 'render',
value: function render() {
return this.renderBtn();
}
}]);
return Btn;
})(_react2.default.Component);
module.exports = Btn;@import '../../essence-core/src/less/mixins.less';
// General buttons properties
.e-btn {
display: inline-block;
min-height: @btn-unit*4.5;
line-height: @btn-unit*4.5;
padding: 0 @btn-unit*3;
border: 0;
margin:@btn-unit;
cursor: pointer;
.border-radius(@btn-unit*0.25);
background-clip: padding-box;
text-transform: uppercase;
font-size: @btn-unit*1.75;
&:hover:not(.flat) {
.e-shadow-2();
}
&:focus {
border: 0;
outline: none;
}
&:disabled {
pointer-events: none;
box-shadow: none ;
opacity: 0.5;
}
}
.e-dialog .e-btn {
padding: 0 @btn-unit;
}
.flat {
&:extend(.e-btn all);
background-color: transparent ;
border: none ;
min-width: @btn-unit*11;
font-weight: 500;
padding: 0 @btn-unit;
&:hover , &:focus {
background-color:darken(hsl(0,0%,100%), 10%) ;
}
&:active {
background-color:darken(hsl(0,0%,100%), 20%) ;
}
}
//Floating action button =FAB : with e-btn inherited
.fab {
&:extend(.e-btn all);
z-index: 1;
display: inline-block;
width: @btn-unit*7;
height: @btn-unit*7;
padding: 0;
margin: @btn-unit*2;
background-color: @fab-color;
text-align: center;
.border-radius(50%);
background-clip: border-box;
.e-shadow-1();
i {
padding: @btn-unit*2;
display: inline-block;
width: @btn-unit*3;
height: @btn-unit*3;
line-height: @btn-unit*3;
font-size: @btn-unit*3;
text-align: center;
font-size: @btn-unit*3;
}
&:hover {
.e-shadow-3();
}
&:active {
}
&:focus {
outline: none;
}
}
//Floating action button mini : with e-btn-fab inherited
.fab-mini {
&:extend(.fab all);
height: @btn-unit*5;
width: @btn-unit*5;
i {
padding: @btn-unit;
}
}
//Raised button : with e-btn inherited
.raised {
&:extend(.e-btn all);
.e-shadow-1();
min-width: @btn-unit*8;
padding: 0 @btn-unit*2;
color:#fff;
&:hover , &:focus {
color: #fff;
}
&:active {
color: #fff;
}
}
// special functions colors : default, primary, succes, info, warning, danger
.e-btn-default {
background-color:@e-color-grey-500;
color:#000 !important;
&:hover , &:focus {
background-color:@e-color-grey-600;
}
&:active {
background-color:@e-color-grey-700;
}
}
.e-btn-primary {
background-color:@e-color-blue-500;
color:#fff;
&:hover , &:focus {
background-color:@e-color-blue-600;
}
&:active {
background-color:@e-color-blue-700;
}
}
.e-btn-succes {
background-color: @e-color-green-500;
color:#fff;
&:hover , &:focus {
background-color:@e-color-green-600;
}
&:active {
background-color:@e-color-green-700;
}
}
.e-btn-info {
background-color: @e-color-light-blue-500;
color:#fff;
&:hover , &:focus {
background-color:@e-color-light-blue-600;
}
&:active {
background-color:@e-color-light-blue-700;
}
}
.e-btn-warning {
background-color: @e-color-orange-500;
color:#fff;
&:hover , &:focus {
background-color:@e-color-orange-600;
}
&:active {
background-color:@e-color-orange-700;
}
}
.e-btn-danger {
background-color: @e-color-red-500;
color:#fff;
&:hover , &:focus {
background-color:@e-color-red-600;
}
&:active {
background-color:@e-color-red-700;
}
}{
"name": "essence-button",
"version": "1.0.6",
"description": "Essence Button - Button component",
"author": "Hetmann W. Iohan
",
"homepage": "http://getessence.io/",
"license": "MIT",
"repository": "git://github.com/Evo-Forge/Essence",
"main": "lib/button.js",
"scripts": {
"babel": "babel --presets react,es2015 src --out-dir lib && cp src/button.less lib/button.less",
"webpack": "NODE_ENV=production webpack -p --config webpack.config.js"
},
"keywords": [
"color palette",
"component",
"essence",
"google material",
"grid lists",
"javascript",
"less css",
"less",
"lesscss",
"material components",
"material design framework",
"material design",
"material",
"module",
"react component",
"react components",
"react native",
"react",
"reactjs",
"react-component",
"template",
"templates",
"tile",
"tiles",
"UI component",
"UI kit",
"UI kits",
"UI",
"widget",
"button",
"buttons",
"flat button",
"raised button",
"persistent footer buttons",
"dropdown buttons",
"toggle buttons"
],
"devDependencies": {
"react": "^0.14.x"
},
"peerDependencies": {
"react": "^0.14.x"
},
"dependencies": {
"classnames": "^2.x",
"essence-core": "^1.x"
}
}
# Essence Button - Button component
#### Options:
- icon: name of icon
- label: the text of the button
- submit: `false` (**default**) or `true` - set type to `submit` or `button`
- onClick: callback function on click event
**NOTE**: all props will be transferred from Btn to component button
#### Ripple effect:
- ripple: `true` (**default**) - enable ripple effect & `false` - disable ripple effect
### How to use
```js
import Btn from 'essence-button';
{/* Flat buttons */}
{/* Fab buttons */}
{/* Fab buttons */}
{/* Raised buttons */}
```import React from 'react';
import ClassNames from 'classnames';
import { Utils, RippleInk } from 'essence-core';
import './button.less'; //require('!css!less!./button.less');
class Btn extends React.Component {
constructor(props) {
super(props);
this.state = {
classes: ClassNames(
{'e-ripple': this.props.ripple === false ? false : true },
this.props.className,
this.props.classes
),
ripple: this.props.ripple,
type: this.props.type,
label: this.props.label,
isDisabled: this.props.isDisabled,
icon: this.props.icon,
tooltipText: this.props.tooltipText,
tooltipPosition: this.props.tooltipPosition,
color: '',
position: {
x: 0,
y: 0
}
};
}
componentWillReceiveProps(nextProps) {
this.setState({
classes: ClassNames(
{'e-ripple': nextProps.ripple === false ? false : true },
nextProps.className,
nextProps.classes
),
ripple: nextProps.ripple,
type: nextProps.type,
label: nextProps.label,
isDisabled: nextProps.isDisabled,
icon: nextProps.icon,
tooltipText: nextProps.tooltipText,
tooltipPosition: nextProps.tooltipPosition
});
}
renderRipple() {
if (this.state.ripple === false) {
return;
}
return (
);
}
renderContent() {
if (this.state.type === 'touchpad') {
return (
{this.state.label}
);
}
if (this.state.icon) {
return (
)
}
return (this.state.label || '');
}
handleClick(event) {
let boundingClient = this.currentButton.getBoundingClientRect();
this.setState({
color: Utils.BackgroundColor(event),
position: Utils.ClickPosition(event, boundingClient)
});
return (
this.props.onClick ? this.props.onClick(event) : true
);
}
renderBtn() {
let buttonType = this.state.type === 'touchpad' ? 'default flat' : this.state.type || 'default flat';
let buttonClasses = ClassNames(this.state.classes, 'e-btn-' + buttonType);
let disableOption = {};
if (this.state.isDisabled) {
disableOption['disabled'] = 'disabled';
} else {
disableOption = {};
}
return (