Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hig/themes

Package Overview
Dependencies
Maintainers
5
Versions
238
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hig/themes - npm Package Compare versions

Comparing version 0.1.0-alpha to 0.1.0-alpha.52870254

src/index.test.js

60

build/index.es.js

@@ -0,3 +1,3 @@

import PropTypes from 'prop-types';
import { Component } from 'react';
import PropTypes from 'prop-types';

@@ -9,2 +9,7 @@ var HIGLightTheme = {

var HIGDarkBlueTheme = {
themeId: 'hig-dark-blue',
themeClass: 'hig--dark-blue-theme'
};
var MatrixTheme = {

@@ -15,2 +20,9 @@ themeId: 'matrix',

var themeContextShape = {
/** Uniquely identifies a theme */
themeId: PropTypes.string,
/** A class added to each themed element */
themeClass: PropTypes.string
};
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; };

@@ -26,9 +38,2 @@

var themeContextShape = {
/** Uniquely identifies a theme */
themeId: PropTypes.string,
/** A class added to each themed element */
themeClass: PropTypes.string
};
var Provider = function (_Component) {

@@ -69,15 +74,24 @@ _inherits(Provider, _Component);

var Consumer = function (_Component2) {
_inherits(Consumer, _Component2);
var _createClass$1 = 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; }; }();
function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn$1(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$1(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 Consumer = function (_Component) {
_inherits$1(Consumer, _Component);
function Consumer() {
_classCallCheck(this, Consumer);
_classCallCheck$1(this, Consumer);
return _possibleConstructorReturn(this, (Consumer.__proto__ || Object.getPrototypeOf(Consumer)).apply(this, arguments));
return _possibleConstructorReturn$1(this, (Consumer.__proto__ || Object.getPrototypeOf(Consumer)).apply(this, arguments));
}
_createClass(Consumer, [{
_createClass$1(Consumer, [{
key: 'render',
value: function render() {
return this.props.children(this.context.themeId ? this.context : HIGLightTheme);
var theme = this.context.themeId && this.context.themeClass ? this.context : HIGLightTheme;
return this.props.children(theme);
}

@@ -94,6 +108,18 @@ }]);

Consumer.contextTypes = themeContextShape;
Consumer.__docgenInfo = {
'description': '',
'displayName': 'Consumer',
'props': {
'children': {
'type': {
'name': 'func'
},
'required': false,
'description': 'A theme provided to the consumer within'
}
}
};
var index = { Provider: Provider, Consumer: Consumer };
var ThemeContext = { Provider: Provider, Consumer: Consumer };
export { HIGLightTheme, MatrixTheme, ThemeContext };
export { HIGLightTheme, HIGDarkBlueTheme, MatrixTheme, index as ThemeContext };

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

var PropTypes = _interopDefault(require('prop-types'));
var react = require('react');
var PropTypes = _interopDefault(require('prop-types'));

@@ -16,2 +16,7 @@ var HIGLightTheme = {

var HIGDarkBlueTheme = {
themeId: 'hig-dark-blue',
themeClass: 'hig--dark-blue-theme'
};
var MatrixTheme = {

@@ -22,2 +27,9 @@ themeId: 'matrix',

var themeContextShape = {
/** Uniquely identifies a theme */
themeId: PropTypes.string,
/** A class added to each themed element */
themeClass: PropTypes.string
};
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; };

@@ -33,9 +45,2 @@

var themeContextShape = {
/** Uniquely identifies a theme */
themeId: PropTypes.string,
/** A class added to each themed element */
themeClass: PropTypes.string
};
var Provider = function (_Component) {

@@ -76,15 +81,24 @@ _inherits(Provider, _Component);

var Consumer = function (_Component2) {
_inherits(Consumer, _Component2);
var _createClass$1 = 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; }; }();
function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn$1(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$1(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 Consumer = function (_Component) {
_inherits$1(Consumer, _Component);
function Consumer() {
_classCallCheck(this, Consumer);
_classCallCheck$1(this, Consumer);
return _possibleConstructorReturn(this, (Consumer.__proto__ || Object.getPrototypeOf(Consumer)).apply(this, arguments));
return _possibleConstructorReturn$1(this, (Consumer.__proto__ || Object.getPrototypeOf(Consumer)).apply(this, arguments));
}
_createClass(Consumer, [{
_createClass$1(Consumer, [{
key: 'render',
value: function render() {
return this.props.children(this.context.themeId ? this.context : HIGLightTheme);
var theme = this.context.themeId && this.context.themeClass ? this.context : HIGLightTheme;
return this.props.children(theme);
}

@@ -101,8 +115,21 @@ }]);

Consumer.contextTypes = themeContextShape;
Consumer.__docgenInfo = {
'description': '',
'displayName': 'Consumer',
'props': {
'children': {
'type': {
'name': 'func'
},
'required': false,
'description': 'A theme provided to the consumer within'
}
}
};
var index = { Provider: Provider, Consumer: Consumer };
var ThemeContext = { Provider: Provider, Consumer: Consumer };
exports.HIGLightTheme = HIGLightTheme;
exports.HIGDarkBlueTheme = HIGDarkBlueTheme;
exports.MatrixTheme = MatrixTheme;
exports.ThemeContext = ThemeContext;
exports.ThemeContext = index;
{
"name": "@hig/themes",
"version": "0.1.0-alpha",
"version": "0.1.0-alpha.52870254",
"description": "HIG theme definitions and supporting components",

@@ -8,14 +8,16 @@ "author": "Autodesk Inc.",

"homepage": "https://hig.autodesk.com",
"publishConfig": {
"access": "public"
},
"main": "build/index.js",
"module": "build/index.es.js",
"dependencies": {
"@hig/styles": "^0.1.0-alpha",
"@hig/banner": "^0.1.1-alpha"
},
"devDependencies": {
"@hig/scripts": "^0.1.0"
"@hig/babel-preset": "0.2.0-alpha.52870254",
"@hig/banner": "0.2.0-alpha.52870254",
"@hig/scripts": "0.2.0-alpha.52870254",
"@hig/styles": "0.1.0-alpha.52870254"
},
"peerDependencies": {
"react": "^15.4.1",
"prop-types": "^15.6.1"
"prop-types": "^15.6.1",
"react": "^15.4.1"
},

@@ -22,0 +24,0 @@ "scripts": {

@@ -5,2 +5,8 @@ # ThemeContext component

## Getting started
```
yarn add @hig/themes
```
## Provide a theme to components

@@ -15,2 +21,2 @@ ```

}
```
```

@@ -9,10 +9,12 @@ import React from "react";

import Banner from "@hig/banner";
import Banner, { AVAILABLE_TYPES as BANNER_TYPES } from "@hig/banner";
import readme from '../../README.md';
import { ThemeContext, HIGLightTheme, MatrixTheme } from '@hig/themes';
import ThemeContext from "../ThemeContext";
import HIGLightTheme from "../themes/HIGLightTheme";
import HIGDarkBlueTheme from "../themes/HIGDarkBlueTheme";
import MatrixTheme from "../themes/MatrixTheme";
const typeOptions = makeSelectOptions(Banner.types);
const themeOptions = {
"hig-light": "HIG Light",
"hig-dark-blue": "HIG Dark Blue",
"matrix": "BIM360 Matrix"

@@ -23,2 +25,3 @@ }

"hig-light": HIGLightTheme,
"hig-dark-blue": HIGDarkBlueTheme,
"matrix": MatrixTheme

@@ -35,8 +38,13 @@ }

const theme = select('Theme', themeOptions, 'hig-light');
const bannerType = select("Banner type", typeOptions, Banner.types[0]);
return (
<ThemeContext.Provider value={themes[theme]}>
<Banner type={bannerType}>{`This message presented in ${themeOptions[theme]} theme`}</Banner>
<div>
{BANNER_TYPES.map((type) => (
<div style={{ marginBottom: "20px" }}>
<Banner type={type}>{`This ${type} message presented in ${themeOptions[theme]} theme`}</Banner>
</div>
))}
</div>
</ThemeContext.Provider>
);
}));

@@ -1,3 +0,4 @@

export { default as HIGLightTheme } from './HIGLightTheme';
export { default as MatrixTheme } from './MatrixTheme';
export { default as HIGLightTheme } from './themes/HIGLightTheme';
export { default as HIGDarkBlueTheme } from './themes/HIGDarkBlueTheme';
export { default as MatrixTheme } from './themes/MatrixTheme';
export { default as ThemeContext } from './ThemeContext';

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