Skip to content

Commit

Permalink
Merge branch 'main' into number-input-value-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sstrubberg authored Jul 7, 2021
2 parents 1887aed + 0e2b53b commit 20ae401
Show file tree
Hide file tree
Showing 47 changed files with 1,789 additions and 242 deletions.
2 changes: 1 addition & 1 deletion config/eslint-config-carbon/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "eslint-config-carbon",
"description": "ESLint configuration for Carbon",
"version": "2.6.0",
"version": "2.7.0-rc.0",
"license": "Apache-2.0",
"main": "index.js",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion config/jest-config-carbon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "jest-config-carbon",
"private": true,
"description": "Jest configuration and preset for Carbon",
"version": "0.5.0",
"version": "0.6.0-rc.0",
"license": "Apache-2.0",
"main": "index.js",
"repository": {
Expand Down
2 changes: 2 additions & 0 deletions config/jest-config-carbon/setup/setupAfterEnv.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const util = require('util');
const toHaveNoAxeViolations = require('../matchers/toHaveNoAxeViolations');
const toHaveNoACViolations = require('../matchers/toHaveNoACViolations');

require('@testing-library/jest-dom');

// We can extend `expect` using custom matchers as defined by:
// https://jest-bot.github.io/jest/docs/expect.html#expectextendmatchers
//
Expand Down
12 changes: 6 additions & 6 deletions packages/carbon-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@carbon/react",
"private": true,
"description": "React components for the Carbon Design System",
"version": "0.6.0",
"version": "0.7.0-rc.0",
"license": "Apache-2.0",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down Expand Up @@ -41,11 +41,11 @@
},
"dependencies": {
"@carbon/feature-flags": "^0.5.0",
"@carbon/icons-react": "^10.34.0",
"@carbon/styles": "^0.9.0",
"@carbon/icons-react": "^10.35.0-rc.0",
"@carbon/styles": "^0.10.0-rc.0",
"@carbon/telemetry": "0.0.0-alpha.6",
"@ibm/plex": "6.0.0-next.6",
"carbon-components-react": "^7.38.0"
"carbon-components-react": "^7.39.0-rc.0"
},
"devDependencies": {
"@babel/core": "^7.14.2",
Expand All @@ -55,8 +55,8 @@
"@babel/plugin-transform-react-constant-elements": "^7.13.13",
"@babel/preset-env": "^7.14.2",
"@babel/preset-react": "^7.13.13",
"@carbon/styles": "^0.9.0-rc.0",
"@carbon/themes": "^10.37.0",
"@carbon/styles": "^0.10.0-rc.0",
"@carbon/themes": "^10.38.0-rc.0",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^18.0.0",
"@rollup/plugin-node-resolve": "^11.2.1",
Expand Down
44 changes: 44 additions & 0 deletions packages/carbon-react/src/components/Tabs/Tabs.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Copyright IBM Corp. 2016, 2018
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import React from 'react';
import { Button, Tab, Tabs, TabsSkeleton } from '../Tabs';

export default {
title: 'Components/Tabs',
parameters: {
component: Tabs,
subcomponents: {
Tab,
TabsSkeleton,
},
},
};

export const Default = () => (
<Tabs>
<Tab id="tab-1" label="Tab label 1">
<p>Content for first tab goes here.</p>
</Tab>
<Tab id="tab-2" label="Tab label 2">
<p>Content for second tab goes here.</p>
<Button>With a button</Button>
</Tab>
<Tab id="tab-3" label="Tab label 3" disabled>
<p>Content for third tab goes here.</p>
</Tab>
<Tab
id="tab-4"
label="Tab label 4 shows truncation"
title="Tab label 4 shows truncation">
<p>Content for fourth tab goes here.</p>
</Tab>
<Tab label={<div>Custom Label</div>}>
<p>Content for fifth tab goes here.</p>
</Tab>
</Tabs>
);
8 changes: 8 additions & 0 deletions packages/carbon-react/src/components/Tabs/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Copyright IBM Corp. 2016, 2018
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

export { Tab, Tabs, TabsSkeleton, Button } from 'carbon-components-react';
251 changes: 251 additions & 0 deletions packages/carbon-react/src/components/Treeview/Treeview.stories.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
/**
* Copyright IBM Corp. 2016, 2018
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import React, { useState } from 'react';
import { Document16, Folder16 } from '@carbon/icons-react';
import {
unstable_TreeView as TreeView,
unstable_TreeNode as TreeNode,
InlineNotification,
} from 'carbon-components-react';
import './story.scss';

const props = () => ({
active: '5',
hideLabel: false,
label: 'Tree view',
multiselect: false,
selected: ['5'],
size: 'default',
});
const nodes = [
{
id: '1',
value: 'Artificial intelligence',
label: <span>Artificial intelligence</span>,
renderIcon: Document16,
},
{
id: '2',
value: 'Blockchain',
label: 'Blockchain',
renderIcon: Document16,
},
{
id: '3',
value: 'Business automation',
label: 'Business automation',
renderIcon: Folder16,
children: [
{
id: '3-1',
value: 'Business process automation',
label: 'Business process automation',
renderIcon: Document16,
},
{
id: '3-2',
value: 'Business process mapping',
label: 'Business process mapping',
renderIcon: Document16,
},
],
},
{
id: '4',
value: 'Business operations',
label: 'Business operations',
renderIcon: Document16,
},
{
id: '5',
value: 'Cloud computing',
label: 'Cloud computing',
isExpanded: true,
renderIcon: Folder16,
children: [
{
id: '5-1',
value: 'Containers',
label: 'Containers',
renderIcon: Document16,
},
{
id: '5-2',
value: 'Databases',
label: 'Databases',
renderIcon: Document16,
},
{
id: '5-3',
value: 'DevOps',
label: 'DevOps',
isExpanded: true,
renderIcon: Folder16,
children: [
{
id: '5-4',
value: 'Solutions',
label: 'Solutions',
renderIcon: Document16,
},
{
id: '5-5',
value: 'Case studies',
label: 'Case studies',
isExpanded: true,
renderIcon: Folder16,
children: [
{
id: '5-6',
value: 'Resources',
label: 'Resources',
renderIcon: Document16,
},
],
},
],
},
],
},
{
id: '6',
value: 'Data & Analytics',
label: 'Data & Analytics',
renderIcon: Folder16,
children: [
{
id: '6-1',
value: 'Big data',
label: 'Big data',
renderIcon: Document16,
},
{
id: '6-2',
value: 'Business intelligence',
label: 'Business intelligence',
renderIcon: Document16,
},
],
},
{
id: '7',
value: 'IT infrastructure',
label: 'IT infrastructure',
isExpanded: true,
disabled: true,
renderIcon: Folder16,
children: [
{
id: '7-1',
value: 'Data storage',
label: 'Data storage',
renderIcon: Document16,
},
{
id: '7-2',
value: 'Enterprise servers',
label: 'Enterprise servers',
renderIcon: Document16,
},
{
id: '8',
value: 'Hybrid cloud infrastructure',
label: 'Hybrid cloud infrastructure',
isExpanded: true,
renderIcon: Folder16,
children: [
{
id: '8-1',
value: 'Insights',
label: 'Insights',
renderIcon: Document16,
},
{
id: '8-2',
value: 'Benefits',
label: 'Benefits',
renderIcon: Document16,
},
],
},
],
},
];

function renderTree({ nodes, expanded, withIcons = false }) {
if (!nodes) {
return;
}
return nodes.map(({ children, renderIcon, isExpanded, ...nodeProps }) => (
<TreeNode
key={nodeProps.id}
renderIcon={withIcons ? renderIcon : null}
isExpanded={expanded ?? isExpanded}
{...nodeProps}>
{renderTree({ nodes: children, expanded, withIcons })}
</TreeNode>
));
}

export default {
title: 'Experimental/unstable_TreeView',
parameters: { component: TreeView },
};

export const Default = () => (
<>
<InlineNotification
kind="info"
title="Experimental component"
subtitle="An accessibility review of this component is in progress"
/>
<TreeView {...props()}>{renderTree({ nodes })}</TreeView>
</>
);

Default.storyName = 'default';
Default.parameters = {
info: {
text: ``,
},
};

export const WithIcons = () => (
<>
<InlineNotification
kind="info"
title="Experimental component"
subtitle="An accessibility review of this component is in progress"
/>
<TreeView {...props()}>{renderTree({ nodes, withIcons: true })}</TreeView>
</>
);

WithIcons.storyName = 'with icons';

export const WithControlledExpansion = () => {
const [expanded, setExpanded] = useState(undefined);
return (
<>
<InlineNotification
kind="info"
title="Experimental component"
subtitle="An accessibility review of this component is in progress"
/>
<div style={{ marginBottom: '1rem' }}>
<button type="button" onClick={() => setExpanded(true)}>
expand all
</button>
<button type="button" onClick={() => setExpanded(false)}>
collapse all
</button>
</div>
<TreeView {...props()}>{renderTree({ nodes, expanded })}</TreeView>
</>
);
};
8 changes: 8 additions & 0 deletions packages/carbon-react/src/components/Treeview/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Copyright IBM Corp. 2016, 2018
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

export { InlineNotification, Treeview } from 'carbon-components-react';
10 changes: 10 additions & 0 deletions packages/carbon-react/src/components/Treeview/story.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//
// Copyright IBM Corp. 2016, 2018
//
// This source code is licensed under the Apache-2.0 license found in the
// LICENSE file in the root directory of this source tree.
//

.bx--tree {
width: 16rem;
}
2 changes: 1 addition & 1 deletion packages/colors/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@carbon/colors",
"description": "Colors for digital and software products using the Carbon Design System",
"version": "10.27.0",
"version": "10.28.0-rc.0",
"license": "Apache-2.0",
"main": "lib/index.js",
"module": "es/index.js",
Expand Down
Loading

0 comments on commit 20ae401

Please sign in to comment.