Skip to content

Commit

Permalink
1.0.0-alpha.6
Browse files Browse the repository at this point in the history
Merge pull request #40 from CMSgov/staging
  • Loading branch information
sawyerh authored Apr 18, 2017
2 parents ffaf353 + 855fad0 commit 020784f
Show file tree
Hide file tree
Showing 45 changed files with 268 additions and 157 deletions.
16 changes: 12 additions & 4 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,34 @@
// rule to the ESLint config file relative to the directory you want it
// applied to.
{
"extends": ["nava", "plugin:react/recommended"],
"extends": [
"nava",
"plugin:jsx-a11y/recommended",
"plugin:react/recommended"
],
"env": {
"browser": true,
"es6": true,
"jest": true,
"node": true
"jest": true
},
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"sourceType": "module"
},
"plugins": ["jest", "react"],
"plugins": [
"jest",
"jsx-a11y",
"react"
],
"rules": {
"eol-last": "warn",
"jest/no-disabled-tests": "warn",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"no-unused-vars": ["error", {ignoreRestSiblings: true}],
"sort-imports": "error",
"react/forbid-prop-types": "error",
"react/jsx-closing-bracket-location": "error",
"react/jsx-first-prop-new-line": ["error", "multiline"],
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
"ejs": "^2.5.6",
"eslint": "^3.19.0",
"eslint-config-nava": "^1.0.0",
"eslint-plugin-filenames": "^1.2.0",
"eslint-plugin-jest": "^19.0.1",
"eslint-plugin-jsx-a11y": "^4.0.0",
"eslint-plugin-react": "^6.10.3",
"front-matter": "^2.1.2",
"generator-cmsgov": "file:./packages/generator-cmsgov",
Expand Down
64 changes: 1 addition & 63 deletions packages/core/README.md
Original file line number Diff line number Diff line change
@@ -1,77 +1,15 @@
# CMSGov Design System

A UI component library and styleguide that is living, tested, importable, and iterable. The goal is to promote consistency across agency websites, speed up productivity, and serve as a future-friendly foundation.

## Installation

You can download a .zip of the design system directly from GitHub's [Releases](CMSgov/design-system/releases) page, however we suggest using a package manager like NPM or Yarn to install the design system package if you're working on a real world project. This way you can easily update the package when there's a new release.

**Important:** The NPM package is currently a private package. In order to install it you must have access to the package.

```
npm login
npm install --save @cmsgov/design-system-core
```

or if you're using Yarn:

```
yarn login
yarn add @cmsgov/design-system-core
```

## Usage

Source files can be imported from the `src` directory. Transpiled files can be found in the `dist` directory.

Import all Sass styles:

```css
@import 'node_modules/@cmsgov/design-system-core/src/index';
```

Link to transpiled CSS:

```html
<link rel="stylesheet" src="node_modules/@cmsgov/design-system-core/dist/index.css" />
```

Import JSX component:

```jsx
import {Button} from '@cmsgov/design-system-core';
...
<Button>Foo</Button>;
```

Apply base-level of styles and use a utility class:

```html
<html>
<head>
<link rel="stylesheet" src="node_modules/@cmsgov/design-system-core/dist/index.css" />
</head>
<body class="ds-base">
<h1 class="ds-u-font-size--title">Hello world</h1>
</body>
</html>
```

## Directory reference
<!-- You can regenerate the tree by running tree -d -I "node_modules" -->

```
├── dist Transpiled CSS and fonts
└── src Sass and JSX
├── base Base HTML styles (scoped to .ds-base)
├── components Sass and React components
│   ├── Button
│   └── etc...
├── fonts
├── generics Far reaching selectors
├── layouts Structural patterns; No cosmetics.
├── settings Globally-available settings and config options
├── tools Helper functions and public mixins
├── utilities Functional CSS classes to apply individual traits
└── vendor Third-party libraries
```
Please view the documentation site for usage information. Each release has its own version of the documentation site, and can be found in the [release notes on GitHub](https://github.com/CMSgov/design-system/releases).
8 changes: 4 additions & 4 deletions packages/core/dist/components/Alert/Alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ exports.Alert = undefined;

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');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);
Expand Down
8 changes: 4 additions & 4 deletions packages/core/dist/components/Badge/Badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ Object.defineProperty(exports, "__esModule", {
});
exports.Badge = undefined;

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Badge = exports.Badge = function Badge(props) {
Expand Down
8 changes: 4 additions & 4 deletions packages/core/dist/components/Button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument

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');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);
Expand Down
8 changes: 4 additions & 4 deletions packages/core/dist/components/ChoiceList/Choice.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ exports.Choice = undefined;

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 _classnames = require('classnames');
var _propTypes = require('prop-types');

var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes2 = _interopRequireDefault(_propTypes);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');
var _classnames = require('classnames');

var _propTypes2 = _interopRequireDefault(_propTypes);
var _classnames2 = _interopRequireDefault(_classnames);

var _lodash = require('lodash.uniqueid');

Expand Down
8 changes: 4 additions & 4 deletions packages/core/dist/components/Form/FormLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ exports.FormLabel = undefined;

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 _classnames = require('classnames');
var _propTypes = require('prop-types');

var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes2 = _interopRequireDefault(_propTypes);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');
var _classnames = require('classnames');

var _propTypes2 = _interopRequireDefault(_propTypes);
var _classnames2 = _interopRequireDefault(_classnames);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

Expand Down
8 changes: 4 additions & 4 deletions packages/core/dist/components/Select/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ exports.Select = undefined;

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

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _classnames = require('classnames');

var _classnames2 = _interopRequireDefault(_classnames);
Expand Down
12 changes: 12 additions & 0 deletions packages/core/dist/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ Object.keys(_Alert).forEach(function (key) {
});
});

var _Badge = require('./Badge/Badge');

Object.keys(_Badge).forEach(function (key) {
if (key === "default" || key === "__esModule") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _Badge[key];
}
});
});

var _Button = require('./Button/Button');

Object.keys(_Button).forEach(function (key) {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/dist/index.css

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"name": "@cmsgov/design-system-core",
"version": "1.0.0-alpha.5",
"version": "1.0.0-alpha.6",
"publishConfig": {
"access": "public"
},
"description": "Core CSS and React components",
"repository": "CMSgov/design-system",
"main": "dist/index.js",
Expand All @@ -15,6 +18,7 @@
},
"devDependencies": {
"enzyme": "^2.8.1",
"mz": "^2.6.0",
"react-addons-test-utils": "^15.5.1",
"react-test-renderer": "^15.5.4"
}
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
// to apply a stricter set of rules to our package's JavaScript versus the
// documentation site's.
{
"plugins": [
"filenames"
],
"rules": {
"filenames/match-exported": [2, "pascal"],
// We want a displayName for the generated React docs
"react/display-name": "error",
// Avoid exploits. If you need dangerouslySetInnerHTML, then temporarily
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/Alert/Alert.example.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable react/display-name */
import React from 'react';
import Alert from './Alert';
import React from 'react';

export default function() {
return (
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/Alert/Alert.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import React from 'react';
import classNames from 'classnames';

export class Alert extends React.PureComponent {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/Alert/Alert.test.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Alert from './Alert';
import React from 'react';
import {shallow} from 'enzyme';
import Alert from './Alert';

describe('Alert', function() {
const text = 'Ruhroh';
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/Badge/Badge.example.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable react/display-name */
import React from 'react';
import Badge from './Badge';
import React from 'react';

export default function() {
return <Badge>Today</Badge>;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/Badge/Badge.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import React from 'react';

export const Badge = (props) => {
return <span className='ds-c-badge'>{props.children}</span>;
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/components/Badge/Badge.test.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import Badge from './Badge';
import React from 'react';
import {shallow} from 'enzyme';

import Badge from './Badge';

describe('Badge', () => {
it('should include children as label', () => {
expect(
Expand Down
10 changes: 1 addition & 9 deletions packages/core/src/components/Button/Button.example.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable react/display-name */
import React from 'react';
import Button from './Button';
import React from 'react';

export default function() {
return (
Expand All @@ -13,14 +13,6 @@ export default function() {
target='_blank'
variation='primary'
>
<svg
className='ds-u-margin-right--1'
xmlns='http://www.w3.org/2000/svg'
aria-hidden='true'
viewBox='0 0 24 24'
>
<use xlinkHref='/1.0.0-alpha.4/public/images/symbols.svg#download' />
</svg>
React anchor button
</Button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/Button/Button.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import React from 'react';
import classNames from 'classnames';

/**
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/components/Button/Button.test.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import Button from './Button.jsx';
import React from 'react';
import {shallow} from 'enzyme';

import Button from './Button.jsx';

/* eslint-disable react/display-name, react/prop-types */
const Link = (props) => {
return <div {...props}>{props.children}</div>;
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/components/ChoiceList/Choice.example.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable react/display-name */
import React from 'react';
import Choice from './Choice';
import React from 'react';

export default function() {
return (
Expand Down
Loading

0 comments on commit 020784f

Please sign in to comment.