Socket
Socket
Sign inDemoInstall

terra-base

Package Overview
Dependencies
Maintainers
6
Versions
132
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

terra-base - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

lib/baseStyles.js

62

lib/Base.js

@@ -7,4 +7,2 @@ 'use strict';

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; }; }();
var _react = require('react');

@@ -14,3 +12,3 @@

require('./Base.scss');
require('./baseStyles');

@@ -21,8 +19,2 @@ 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; }
var propTypes = {

@@ -35,49 +27,15 @@ /**

var Base = function (_React$Component) {
_inherits(Base, _React$Component);
var Base = function Base(_ref) {
var children = _ref.children,
customProps = _objectWithoutProperties(_ref, ['children']);
function Base() {
_classCallCheck(this, Base);
return _react2.default.createElement(
'div',
customProps,
children
);
};
return _possibleConstructorReturn(this, (Base.__proto__ || Object.getPrototypeOf(Base)).apply(this, arguments));
}
_createClass(Base, [{
key: 'componentDidMount',
value: function componentDidMount() {
// Checks to run when not in production
if (process.env.NODE_ENV !== 'production') {
// Check to ensure terra-Base class is set on html element
if (!new RegExp('(^|\\s)terra-Base(\\s|$)').test(document.documentElement.className)) {
// eslint-disable-next-line
console.warn('The html element is missing the terra-Base class.');
}
// Check to ensure dir attribute is set on html element
if (!document.documentElement.hasAttribute('dir')) {
// eslint-disable-next-line
console.warn('The html element is missing the dir attribute. For terra directionality based styles to render correctly, add dir="ltr" or dir="rtl" to the html element.');
}
}
}
}, {
key: 'render',
value: function render() {
var _props = this.props,
children = _props.children,
customProps = _objectWithoutProperties(_props, ['children']);
return _react2.default.createElement(
'div',
customProps,
children
);
}
}]);
return Base;
}(_react2.default.Component);
Base.propTypes = propTypes;
exports.default = Base;
{
"name": "terra-base",
"main": "lib/Base.js",
"version": "0.2.0",
"version": "0.3.0",
"description": "The base component sets minimal global styles for an application.",

@@ -6,0 +6,0 @@ "repository": {

import React, { PropTypes } from 'react';
import './Base.scss';
import './baseStyles';

@@ -11,29 +11,10 @@ const propTypes = {

class Base extends React.Component {
const Base = ({ children, ...customProps }) => (
<div {...customProps}>
{children}
</div>
);
componentDidMount() {
// Checks to run when not in production
if (process.env.NODE_ENV !== 'production') {
// Check to ensure terra-Base class is set on html element
if (!new RegExp('(^|\\s)terra-Base(\\s|$)').test(document.documentElement.className)) {
// eslint-disable-next-line
console.warn('The html element is missing the terra-Base class.');
}
// Check to ensure dir attribute is set on html element
if (!document.documentElement.hasAttribute('dir')) {
// eslint-disable-next-line
console.warn('The html element is missing the dir attribute. For terra directionality based styles to render correctly, add dir="ltr" or dir="rtl" to the html element.');
}
}
}
render() {
const { children, ...customProps } = this.props;
return <div {...customProps}>{children}</div>;
}
}
Base.propTypes = propTypes;
export default Base;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc