-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(filter-panel): introducing react wrapper (#7470)
### Related Ticket(s) #6644 ### Description Introducing the React wrapper for the Filter Panel component. ### Changelog **New** - added comments to the getter functions **Changed** - included the `filter-panel` and `filter-panel-modal` components in `filter-panel-composite` in order for the wrapper component to properly render <!-- React and Web Component deploy previews are enabled by default. --> <!-- To enable additional available deploy previews, apply the following --> <!-- labels for the corresponding package: --> <!-- *** "package: services": Services --> <!-- *** "package: utilities": Utilities --> <!-- *** "RTL": React / Web Components (RTL) --> <!-- *** "feature flag": React / Web Components (experimental) -->
- Loading branch information
1 parent
6467c2b
commit b828912
Showing
27 changed files
with
662 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Filter panel | ||
|
||
This component is maintained in `@carbon/ibmdotcom-web-components` library with a [React wrapper](https://ibmdotcom-web-components-react.mybluemix.net/?path=/story/components-filter-panel). |
37 changes: 37 additions & 0 deletions
37
packages/react/src/components/FilterPanel/__stories__/FilterPanel.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* Copyright IBM Corp. 2016, 2021 | ||
* | ||
* 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 readme from '../README.stories.mdx'; | ||
|
||
export default { | ||
title: 'Components|Filter panel', | ||
|
||
parameters: { | ||
...readme.parameters, | ||
percy: { | ||
skip: true, | ||
}, | ||
proxy: true, | ||
}, | ||
}; | ||
|
||
export const Default = () => { | ||
return ( | ||
<p> | ||
This component is maintained in{' '} | ||
<code>@carbon/ibmdotcom-web-components</code> library with a{' '} | ||
<a | ||
className="bx--link" | ||
target="_blank" | ||
href="https://ibmdotcom-web-components-react.mybluemix.net/?path=/story/components-filter-panel"> | ||
React wrapper | ||
</a> | ||
. | ||
</p> | ||
); | ||
}; |
2 changes: 2 additions & 0 deletions
2
packages/web-components/examples/codesandbox/components-react/filter-panel/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/build | ||
/node_modules |
22 changes: 22 additions & 0 deletions
22
packages/web-components/examples/codesandbox/components-react/filter-panel/index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!-- | ||
@license | ||
Copyright IBM Corp. 2020 | ||
This source code is licensed under the Apache-2.0 license found in the | ||
LICENSE file in the root directory of this source tree. | ||
--> | ||
|
||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> | ||
<title>carbon-web-components example with React</title> | ||
</head> | ||
<body> | ||
<noscript> | ||
You need to enable JavaScript to run this app. | ||
</noscript> | ||
<div id="root"></div> | ||
<script type="module" src="index.js"></script> | ||
</body> | ||
</html> |
35 changes: 35 additions & 0 deletions
35
packages/web-components/examples/codesandbox/components-react/filter-panel/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"name": "ibmdotcom-web-components-react-filter-panel-example", | ||
"version": "0.1.0", | ||
"private": true, | ||
"description": "Sample project for getting started with the Web Components from Carbon for IBM.com with React.", | ||
"license": "Apache-2", | ||
"scripts": { | ||
"start": "webpack serve" | ||
}, | ||
"dependencies": { | ||
"@carbon/ibmdotcom-web-components": "canary", | ||
"@carbon/icons-react": "~10.22.0", | ||
"carbon-components": "~10.23.0", | ||
"lit-element": "~2.4.0", | ||
"lit-html": "~1.3.0", | ||
"lodash-es": "^4.17.0", | ||
"prop-types": "^15.7.0", | ||
"react": "^17.0.0", | ||
"react-dom": "^17.0.0", | ||
"react-redux": "^7.2.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.0.0", | ||
"@babel/preset-react": "^7.10.0", | ||
"@types/lodash-es": "^4.17.0", | ||
"@types/react": "^16.9.0", | ||
"babel-loader": "^8.2.0", | ||
"css-loader": "^4.3.0", | ||
"html-webpack-plugin": "^4.5.0", | ||
"style-loader": "^2.0.0", | ||
"webpack": "^4.0.0", | ||
"webpack-cli": "^4.0.0", | ||
"webpack-dev-server": "^3.11.0" | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
...ges/web-components/examples/codesandbox/components-react/filter-panel/sandbox.config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"template": "node" | ||
} |
43 changes: 43 additions & 0 deletions
43
packages/web-components/examples/codesandbox/components-react/filter-panel/src/index.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* @license | ||
* | ||
* Copyright IBM Corp. 2020 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
html, | ||
body { | ||
margin: 0; | ||
} | ||
|
||
body { | ||
padding: 2rem; | ||
} | ||
|
||
/* Minimum setting to use IBM Plex font */ | ||
@font-face { | ||
font-weight: 400; | ||
font-family: 'IBM Plex Sans'; | ||
font-style: normal; | ||
src: local('IBM Plex Sans'), local('IBMPlexSans'), | ||
url(https://fonts.gstatic.com/s/ibmplexsans/v6/zYXgKVElMYYaJe8bpLHnCwDKhdHeEw.woff) format('woff'); | ||
font-display: auto; | ||
} | ||
|
||
@font-face { | ||
font-weight: 600; | ||
font-family: 'IBM Plex Sans'; | ||
font-style: normal; | ||
src: local('IBM Plex Sans SemiBold'), local('IBMPlexSans-SemiBold'), | ||
url(https://fonts.gstatic.com/s/ibmplexsans/v6/zYX9KVElMYYaJe8bpLHnCwDKjQ76AIFscg.woff) format('woff'); | ||
font-display: auto; | ||
} | ||
|
||
/* From: https://github.com/carbon-design-system/carbon/blob/v10.22.0/packages/type/scss/_reset.scss#L31-L32 */ | ||
body { | ||
font-family: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif; | ||
text-rendering: optimizeLegibility; | ||
-webkit-font-smoothing: antialiased; | ||
} |
71 changes: 71 additions & 0 deletions
71
packages/web-components/examples/codesandbox/components-react/filter-panel/src/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/** | ||
* @license | ||
* | ||
* Copyright IBM Corp. 2020, 2021 | ||
* | ||
* 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 { render } from 'react-dom'; | ||
import DDSFilterGroup from '@carbon/ibmdotcom-web-components/es/components-react/filter-panel/filter-group'; | ||
import DDSFilterGroupItem from '@carbon/ibmdotcom-web-components/es/components-react/filter-panel/filter-group-item'; | ||
import DDSFilterPanelCheckbox from '@carbon/ibmdotcom-web-components/es/components-react/filter-panel/filter-panel-checkbox'; | ||
import DDSFilterPanelComposite from '@carbon/ibmdotcom-web-components/es/components-react/filter-panel/filter-panel-composite'; | ||
import DDSFilterPanelHeading from '@carbon/ibmdotcom-web-components/es/components-react/filter-panel/filter-panel-heading'; | ||
import DDSFilterPanelInputSelect from '@carbon/ibmdotcom-web-components/es/components-react/filter-panel/filter-panel-input-select'; | ||
import DDSFilterPanelInputSelectItem from '@carbon/ibmdotcom-web-components/es/components-react/filter-panel/filter-panel-input-select-item'; | ||
import './index.css'; | ||
|
||
const App = () => ( | ||
<DDSFilterPanelComposite> | ||
<DDSFilterPanelHeading slot="heading">{heading}</DDSFilterPanelHeading> | ||
<DDSFilterGroup> | ||
<DDSFilterGroupItem title-text="Product types"> | ||
<DDSFilterPanelCheckbox value="API">API</DDSFilterPanelCheckbox> | ||
<DDSFilterPanelCheckbox value="Application">Application</DDSFilterPanelCheckbox> | ||
<DDSFilterPanelCheckbox value="Data Set">Data Set</DDSFilterPanelCheckbox> | ||
<DDSFilterPanelCheckbox value="Free Trial">Free Trial</DDSFilterPanelCheckbox> | ||
<DDSFilterPanelCheckbox value="Hardware">Hardware</DDSFilterPanelCheckbox> | ||
<DDSFilterPanelCheckbox value="Service">Service</DDSFilterPanelCheckbox> | ||
<DDSFilterPanelCheckbox value="Service Assets">Service Assets</DDSFilterPanelCheckbox> | ||
<DDSFilterPanelCheckbox value="Software">Software</DDSFilterPanelCheckbox> | ||
</DDSFilterGroupItem> | ||
<DDSFilterGroupItem title-text="Technologies"> | ||
<DDSFilterPanelInputSelect header-value="Analytics" title="Analytics"></DDSFilterPanelInputSelect> | ||
<DDSFilterPanelInputSelect header-value="Artificial intelligence" title="Artificial intelligence"> | ||
<DDSFilterPanelInputSelectItem value="Machine Learning">Machine Learning</DDSFilterPanelInputSelectItem> | ||
<DDSFilterPanelInputSelectItem value="Natural language processing"> | ||
Natural language processing | ||
</DDSFilterPanelInputSelectItem> | ||
<DDSFilterPanelInputSelectItem value="Speech recognition">Speech recognition</DDSFilterPanelInputSelectItem> | ||
</DDSFilterPanelInputSelect> | ||
<DDSFilterPanelInputSelect header-value="Automation" title="Automation"></DDSFilterPanelInputSelect> | ||
<DDSFilterPanelInputSelect header-value="Blockchain" title="Blockchain"></DDSFilterPanelInputSelect> | ||
<DDSFilterPanelInputSelect header-value="Cloud computing" title="Cloud computing"></DDSFilterPanelInputSelect> | ||
<DDSFilterPanelInputSelect header-value="IT infrastructure" title="IT infrastructure"></DDSFilterPanelInputSelect> | ||
<DDSFilterPanelInputSelect header-value="IT management" title="IT management"></DDSFilterPanelInputSelect> | ||
<DDSFilterPanelInputSelect header-value="Mobile technologys" title="Mobile technology"></DDSFilterPanelInputSelect> | ||
<DDSFilterPanelInputSelect header-value="Security" title="Security"></DDSFilterPanelInputSelect> | ||
<DDSFilterPanelInputSelect header-value="Software development" title="Software development"></DDSFilterPanelInputSelect> | ||
</DDSFilterGroupItem> | ||
<DDSFilterGroupItem title-text="Business needs"> | ||
<DDSFilterPanelInputSelect header-value="Business operations" title="Business operations"></DDSFilterPanelInputSelect> | ||
<DDSFilterPanelInputSelect header-value="Content Management" title="Content Management"></DDSFilterPanelInputSelect> | ||
<DDSFilterPanelInputSelect header-value="Customer service" title="Customer service"></DDSFilterPanelInputSelect> | ||
<DDSFilterPanelInputSelect header-value="Finance" title="Finance"></DDSFilterPanelInputSelect> | ||
<DDSFilterPanelInputSelect header-value="Marketing and sales" title="Marketing and sales"></DDSFilterPanelInputSelect> | ||
<DDSFilterPanelInputSelect | ||
header-value="Supply chain management" | ||
title="Supply chain management"></DDSFilterPanelInputSelect> | ||
</DDSFilterGroupItem> | ||
<DDSFilterGroupItem title-text="Deployment types"> | ||
<DDSFilterPanelCheckbox value="On-premises">On-premises</DDSFilterPanelCheckbox> | ||
<DDSFilterPanelCheckbox value="SaaS">SaaS</DDSFilterPanelCheckbox> | ||
</DDSFilterGroupItem> | ||
</DDSFilterGroup> | ||
</DDSFilterPanelComposite> | ||
); | ||
|
||
render(<App />, document.getElementById('root')); |
47 changes: 47 additions & 0 deletions
47
packages/web-components/examples/codesandbox/components-react/filter-panel/webpack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* @license | ||
* | ||
* Copyright IBM Corp. 2020, 2021 | ||
* | ||
* This source code is licensed under the Apache-2.0 license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
|
||
module.exports = { | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
use: [ | ||
{ | ||
loader: 'babel-loader', | ||
options: { | ||
presets: ['@babel/preset-react'], | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
test: /\.css$/, | ||
sideEffects: true, | ||
use: ['style-loader', 'css-loader'], | ||
}, | ||
], | ||
}, | ||
plugins: [ | ||
// Lets WebPack Dev Server serve `.html` file. | ||
// If you have other means to server `.html` content, this is not needed. | ||
new HtmlWebpackPlugin({ | ||
template: 'index.html', | ||
inject: false, | ||
}), | ||
], | ||
output: { | ||
library: 'index', | ||
filename: 'index.js', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.