Skip to content

Commit

Permalink
Merge branch 'next' of github.com:IBM/carbon-addons-iot-react into 16…
Browse files Browse the repository at this point in the history
…21-card-selection
  • Loading branch information
davidicus committed Nov 3, 2020
2 parents 557209c + 35ae31e commit e7ccab2
Show file tree
Hide file tree
Showing 123 changed files with 21,891 additions and 16,337 deletions.
40 changes: 33 additions & 7 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,17 @@
// https://nolanlawson.com/2018/03/20/smaller-lodash-bundles-with-webpack-and-babel/
"lodash/chaining": [2, "never"],
"lodash/import-scope": [2, "method"],
"react/destructuring-assignment": [2, "always", { "ignoreClassFields": true }],
"react/destructuring-assignment": [
2,
"always",
{ "ignoreClassFields": true }
],
"jest/expect-expect": "error",
"jest/prefer-hooks-on-top": "error",
"jest/consistent-test-it": ["error", { "fn": "test", "withinDescribe": "it" }],
"jest/consistent-test-it": [
"error",
{ "fn": "test", "withinDescribe": "it" }
],
"unicorn/no-abusive-eslint-disable": "error",
"testing-library/prefer-screen-queries": "error",
"testing-library/prefer-wait-for": "error"
Expand All @@ -103,15 +110,34 @@
"**/*.story.{js,jsx}"
],
"rules": {
"import/no-extraneous-dependencies": ["error", { "devDependencies": true }],
"import/no-extraneous-dependencies": [
"error",
{ "devDependencies": true }
],
"no-underscore-dangle": 0,
"no-shadow": 0,
"no-console": 0,
"no-extend-native": 0,
"no-restricted-imports": ["warn", {
"name": "@testing-library/jest-dom",
"message": "@testing-library/jest-dom is already imported globally in /config/jest/setupTest.js"
}],
"no-restricted-imports": [
"error",
{
"paths": [
{
"name": "@testing-library/jest-dom",
"message": "@testing-library/jest-dom is already imported globally in /config/jest/setupTest.js"
},
{
"name": "@storybook/react",
"importNames": ["storiesOf"],
"message": "`storiesOf` is deprecated. Please use Component Story Format (CSF) instead of `storiesOf`. https://storybook.js.org/docs/react/api/csf"
}
],
// would really like this to have a custom message, but its not available for patterns
// SVGs can't be imported directly. They must be convert to react components via svgr cli first
// https://github.com/carbon-design-system/carbon-addons-iot-react/blob/next/.github/CONTRIBUTING.MD#adding-new-svg-images
"patterns": ["*.svg"]
}
],
"no-template-curly-in-string": 0,
"react/prop-types": 0,
"react/jsx-no-bind": 0
Expand Down
12 changes: 12 additions & 0 deletions .github/CONTRIBUTING.MD
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,18 @@ Do not use `styled-components`. Any components using it should be refactored to
the sass partial approach. This helps promote consistency with the Carbon Design
System.

## Adding new SVG images

If SVG files need to be added that are not already distributed by Carbon, please
take the following steps.

1. first add the SVG files to `src/icons/svg`.
2. Next, run `yarn svg-convert`. This will produce a React JSX component, as
well as update the `src/icons/components/index.jsx` exports with the newly
created component.
3. You can then import the file as a regular react componet with
`import MySvgIcon from 'src/icons/components/MySvgIcon.jsx`.

## Testing

An automated unit test bucket runs when you execute `yarn test:base`.
Expand Down
160 changes: 158 additions & 2 deletions .storybook/__snapshots__/Welcome.story.storyshot
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots 0/Getting Starte
onAnimationEnd={[Function]}
>
<button
aria-controls="accordion-item-10"
aria-controls="accordion-item-1"
aria-expanded={false}
className="bx--accordion__heading"
onClick={[Function]}
Expand Down Expand Up @@ -89,7 +89,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots 0/Getting Starte
</button>
<div
className="bx--accordion__content"
id="accordion-item-10"
id="accordion-item-1"
>
<p>
The following table shows a comparison of exports from carbon-components-react and this library. These are primarily used for snapshot purposes to track and ensure that as the exports change upstream in Carbon we continue to provide parity with their package.
Expand Down Expand Up @@ -3612,6 +3612,162 @@ exports[`Storybook Snapshot tests and console checks Storyshots 0/Getting Starte
tableActions
</div>
</div>
<div
className="bx--structured-list-row"
>
<div
className="bx--structured-list-td"
/>
<div
className="bx--structured-list-td"
>
AlertTableIcon
</div>
</div>
<div
className="bx--structured-list-row"
>
<div
className="bx--structured-list-td"
/>
<div
className="bx--structured-list-td"
>
BarGroupedGraphIcon
</div>
</div>
<div
className="bx--structured-list-row"
>
<div
className="bx--structured-list-td"
/>
<div
className="bx--structured-list-td"
>
BarStackGraphIcon
</div>
</div>
<div
className="bx--structured-list-row"
>
<div
className="bx--structured-list-td"
/>
<div
className="bx--structured-list-td"
>
ComputerChipIcon
</div>
</div>
<div
className="bx--structured-list-row"
>
<div
className="bx--structured-list-td"
/>
<div
className="bx--structured-list-td"
>
CustomCardIcon
</div>
</div>
<div
className="bx--structured-list-row"
>
<div
className="bx--structured-list-td"
/>
<div
className="bx--structured-list-td"
>
DashboardIcon
</div>
</div>
<div
className="bx--structured-list-row"
>
<div
className="bx--structured-list-td"
/>
<div
className="bx--structured-list-td"
>
DataScientistIcon
</div>
</div>
<div
className="bx--structured-list-row"
>
<div
className="bx--structured-list-td"
/>
<div
className="bx--structured-list-td"
>
DataTableIcon
</div>
</div>
<div
className="bx--structured-list-row"
>
<div
className="bx--structured-list-td"
/>
<div
className="bx--structured-list-td"
>
ImageIcon
</div>
</div>
<div
className="bx--structured-list-row"
>
<div
className="bx--structured-list-td"
/>
<div
className="bx--structured-list-td"
>
LineGraphIcon
</div>
</div>
<div
className="bx--structured-list-row"
>
<div
className="bx--structured-list-td"
/>
<div
className="bx--structured-list-td"
>
ListIcon
</div>
</div>
<div
className="bx--structured-list-row"
>
<div
className="bx--structured-list-td"
/>
<div
className="bx--structured-list-td"
>
SimpleBarGraphIcon
</div>
</div>
<div
className="bx--structured-list-row"
>
<div
className="bx--structured-list-td"
/>
<div
className="bx--structured-list-td"
>
ValueKpiIcon
</div>
</div>
</div>
</section>
</div>
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"homepage": "https://carbon-addons-iot-react.com",
"scripts": {
"build": "cross-env BABEL_ENV='production' NODE_ENV='production' yarn build:pre && rollup -c && yarn build:post",
"build": "yarn svg-convert && cross-env BABEL_ENV='production' NODE_ENV='production' yarn build:pre && rollup -c && yarn build:post",
"build:pre": "yarn test:engines && rimraf lib es umd css scss tmp storybook-static",
"build:post": "rimraf tmp",
"build:storybook": "yarn test:engines && NODE_OPTIONS='--max-old-space-size=16384' build-storybook -s public/production",
Expand All @@ -36,6 +36,7 @@
"publish-npm": "yarn semantic-release",
"start": "yarn test:engines && yarn storybook",
"storybook": "yarn test:engines && start-storybook -p 3000 -s public/development",
"svg-convert": "svgr --ext jsx -d src/icons/components src/icons/svg && prettier --write src/icons/components/index.jsx ",
"test": "yarn test:engines && yarn test:a11y && yarn test:base",
"test:base": "yarn test:engines && cross-env NODE_ICU_DATA=node_modules/full-icu TZ=America/Chicago jest --testPathPattern='.*\\.test\\.js(x)?' --coverage",
"test:a11y": "yarn test:engines && cross-env NODE_ICU_DATA=node_modules/full-icu TZ=America/Chicago jest --forceExit --testPathPattern='.*\\.a11y\\.js(x)?'",
Expand Down Expand Up @@ -89,7 +90,7 @@
},
"husky": {
"hooks": {
"pre-commit": "yarn lint-staged && yarn test:base",
"pre-commit": "yarn svg-convert && yarn lint-staged && yarn test:base",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
Expand Down Expand Up @@ -196,7 +197,7 @@
"@storybook/addon-storyshots": "^5.3.17",
"@storybook/addons": "^5.3.17",
"@storybook/react": "^5.3.17",
"@svgr/rollup": "^5.4.0",
"@svgr/cli": "^5.4.0",
"@testing-library/dom": "^7.22.2",
"@testing-library/jest-dom": "^5.11.3",
"@testing-library/react": "^10.4.8",
Expand Down
3 changes: 0 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import postcss from 'rollup-plugin-postcss';
import copy from 'rollup-plugin-copy';
import autoprefixer from 'autoprefixer';
import json from 'rollup-plugin-json';
import svgr from '@svgr/rollup';

const packageJson = require('./package.json');

Expand Down Expand Up @@ -88,7 +87,6 @@ export default [
// generate a named export for every property of the JSON object
namedExports: true, // Default: true
}),
svgr(),
...prodSettings,
],
},
Expand Down Expand Up @@ -235,7 +233,6 @@ export default [
],
verbose: env !== 'development', // logs the file copy list on production builds for easier debugging
}),
svgr(),
...prodSettings,
],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Accor
onAnimationEnd={[Function]}
>
<button
aria-controls="accordion-item-11"
aria-controls="accordion-item-2"
aria-expanded={false}
className="bx--accordion__heading"
onClick={[Function]}
Expand Down Expand Up @@ -58,7 +58,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Accor
</button>
<div
className="bx--accordion__content"
id="accordion-item-11"
id="accordion-item-2"
>
<p>
This content is always rendered to the DOM, no matter if the accordion item has been open or closed.
Expand All @@ -72,7 +72,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Accor
onAnimationEnd={[Function]}
>
<button
aria-controls="accordion-item-12"
aria-controls="accordion-item-3"
aria-expanded={false}
className="bx--accordion__heading"
onClick={[Function]}
Expand Down Expand Up @@ -102,7 +102,7 @@ exports[`Storybook Snapshot tests and console checks Storyshots Watson IoT/Accor
</button>
<div
className="bx--accordion__content"
id="accordion-item-12"
id="accordion-item-3"
/>
</li>
</ul>
Expand Down
17 changes: 13 additions & 4 deletions src/components/AddCard/AddCard.story.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import React from 'react';
import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';

import AddCard from './AddCard';
Expand All @@ -9,6 +8,16 @@ const AddCardProps = {
title: 'Click me',
};

storiesOf('Watson IoT/AddCard', module).add('handles click', () => (
<AddCard {...AddCardProps} />
));
export default {
title: 'Watson IoT/AddCard',

parameters: {
component: AddCard,
},
};

export const HandlesClick = () => <AddCard {...AddCardProps} />;

HandlesClick.story = {
name: 'handles click',
};
Loading

0 comments on commit e7ccab2

Please sign in to comment.