Skip to content

Commit

Permalink
Merge branch 'main' into select-audit
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored Feb 18, 2022
2 parents e01e3e0 + cdacbe8 commit 515ec03
Show file tree
Hide file tree
Showing 85 changed files with 715 additions and 258 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/BUG_REPORT.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ body:
- '@carbon/pictograms'
- '@carbon/pictograms-react'
- '@carbon/react'
- '@carbon/styles'
- '@carbon/themes'
- '@carbon/type'
- '@carbon/upgrade'
Expand Down
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ packages/icons-react/next/**
**/_inlined/**

# Examples
**/examples/**
packages/**/examples/**
!packages/themes/examples/**

# Yarn
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/resolve-patch-b4a69197d3-a0dd7d16a8.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
24 changes: 24 additions & 0 deletions examples/codesandbox-styles/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
15 changes: 15 additions & 0 deletions examples/codesandbox-styles/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions examples/codesandbox-styles/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Carbon Styles Sandbox</title>
</head>
<body>
<button class="cds--btn cds--btn--primary">Hello world</button>
<script type="module" src="/main.js"></script>
</body>
</html>
1 change: 1 addition & 0 deletions examples/codesandbox-styles/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './style.scss';
15 changes: 15 additions & 0 deletions examples/codesandbox-styles/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "codesandbox-styles",
"private": true,
"version": "0.0.0",
"scripts": {
"develop": "vite"
},
"devDependencies": {
"vite": "^2.8.0"
},
"dependencies": {
"@carbon/styles": "0.14.0",
"sass": "^1.49.7"
}
}
3 changes: 3 additions & 0 deletions examples/codesandbox-styles/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@use '@carbon/styles' with (
$font-path: '@ibm/plex'
);
24 changes: 24 additions & 0 deletions examples/codesandbox/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
13 changes: 13 additions & 0 deletions examples/codesandbox/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/src/favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
18 changes: 18 additions & 0 deletions examples/codesandbox/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "codesandbox",
"private": true,
"version": "0.0.0",
"scripts": {
"develop": "vite"
},
"dependencies": {
"@carbon/react": "0.14.0",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"@vitejs/plugin-react": "^1.0.7",
"sass": "^1.49.7",
"vite": "^2.8.0"
}
}
7 changes: 7 additions & 0 deletions examples/codesandbox/src/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Button } from '@carbon/react';

function App() {
return <Button>Hello world</Button>;
}

export default App
15 changes: 15 additions & 0 deletions examples/codesandbox/src/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions examples/codesandbox/src/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@use '@carbon/react' with (
$font-path: '@ibm/plex',
);
12 changes: 12 additions & 0 deletions examples/codesandbox/src/main.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import './index.scss'

import React from 'react'
import ReactDOM from 'react-dom'
import App from './App'

ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
)
7 changes: 7 additions & 0 deletions examples/codesandbox/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
});
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"workspaces": [
"actions/*",
"config/*",
"examples/*",
"packages/*",
"www"
],
Expand Down Expand Up @@ -55,7 +56,7 @@
"all-contributors-cli": "^6.19.0",
"cross-env": "^7.0.0",
"cross-spawn": "^7.0.0",
"doctoc": "^1.4.0",
"doctoc": "^2.0.0",
"eslint": "^7.28.0",
"fs-extra": "^10.0.0",
"glob": "^7.1.4",
Expand Down
7 changes: 6 additions & 1 deletion packages/cli/src/workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ const WORKSPACE_ROOT = getProjectRoot(__dirname);
const packageJson = fs.readJsonSync(path.join(WORKSPACE_ROOT, 'package.json'));
const packagePaths = Array.isArray(packageJson.workspaces)
? glob
.sync(packageJson.workspaces.map((pattern) => `${pattern}/package.json`))
.sync(
packageJson.workspaces.map((pattern) => `${pattern}/package.json`),
{
cwd: WORKSPACE_ROOT,
}
)
.map((match) => {
const packageJsonPath = path.join(WORKSPACE_ROOT, match);
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@
transform: scaleY(0);
transform-origin: bottom;
transition: all $duration--moderate-01 motion(standard, productive);

@media (prefers-reduced-motion: reduce) {
transition: none;
}
}

&:disabled::after {
Expand Down
2 changes: 2 additions & 0 deletions packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3732,6 +3732,7 @@ Map {
},
},
"ModalBody" => Object {
"$$typeof": Symbol(react.forward_ref),
"propTypes": Object {
"aria-label": [Function],
"children": Object {
Expand All @@ -3747,6 +3748,7 @@ Map {
"type": "bool",
},
},
"render": [Function],
},
"ModalFooter" => Object {
"contextType": Object {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
"cypress": "^9.2.0",
"cypress-real-events": "^1.6.0",
"fast-glob": "^3.2.7",
"fast-sass-loader": "^1.5.0",
"fast-sass-loader": "^2.0.0",
"gzip-size": "^6.0.0",
"lcov2badge": "^0.1.0",
"mini-css-extract-plugin": "^2.4.5",
Expand Down
36 changes: 36 additions & 0 deletions packages/react/src/components/ComposedModal/ComposedModal-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ describe('<ModalHeader />', () => {
labelWrapper.find(`.${prefix}--modal-header__label`).exists()
).toBe(true);
});

it('should render with ref', () => {
const ref = React.createRef();
mount(<ModalHeader title="Something" forwardedRef={ref} />);

expect(ref.current).toHaveClass(`${prefix}--modal-header`);
});
});
});

Expand All @@ -70,6 +77,16 @@ describe('<ModalBody />', () => {
wrapper.find(`.${prefix}--modal-content`).hasClass('extra-class')
).toEqual(true);
});
it('should render with ref', () => {
const ref = React.createRef();
mount(
<ModalBody className="extra-class" ref={ref}>
<p>Test</p>
</ModalBody>
);

expect(ref.current).toHaveClass(`${prefix}--modal-content`);
});
});
});

Expand Down Expand Up @@ -187,6 +204,13 @@ describe('<ModalFooter />', () => {
expect(buttonComponents.at(1).props().kind).toBe('secondary');
});
});

it('should render with ref', () => {
const ref = React.createRef();
mount(<ModalFooter primaryButtonText="test" forwardedRef={ref} />);

expect(ref.current).toHaveClass(`${prefix}--modal-footer`);
});
});

describe('<ComposedModal />', () => {
Expand All @@ -204,6 +228,18 @@ describe('<ComposedModal />', () => {
expect(wrapper).toMatchSnapshot();
});

it('renders with a ref', () => {
const ref = React.createRef();
mount(<ComposedModal open forwardedRef={ref} />);
expect(ref.current).toHaveClass(`${prefix}--modal`);
});

it('renders with a callbackRef', () => {
const ref = jest.fn();
const wrapper = mount(<ComposedModal open forwardedRef={ref} />);
expect(ref).toHaveBeenCalledWith(wrapper.getDOMNode());
});

it('changes the open state upon change in props', () => {
const wrapper = mount(<ComposedModal open />);
expect(wrapper.state().open).toEqual(true);
Expand Down
Loading

0 comments on commit 515ec03

Please sign in to comment.