diff --git a/CHANGELOG.md b/CHANGELOG.md index 676a5d193..52e00a9dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] +### Added + +- The option to place data attributes in the `Checkbox` component. + ## [9.146.13] - 2024-08-20 ## [9.146.12] - 2024-08-20 diff --git a/package.json b/package.json index 08424b201..7bd8b5776 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@vtex/styleguide", - "version": "9.146.13", + "version": "9.146.14", "scripts": { "lint": "eslint react --ext js,jsx,ts,tsx", "test": "node config/test.js", diff --git a/react/components/Checkbox/index.js b/react/components/Checkbox/index.js index dd3c36a4f..4f1eb7867 100755 --- a/react/components/Checkbox/index.js +++ b/react/components/Checkbox/index.js @@ -41,8 +41,16 @@ class Checkbox extends PureComponent { value, partial, forwardedRef, + ...remainingProps } = this.props + const dataAttributes = Object.keys(remainingProps) + .filter(key => key.startsWith('data-')) + .reduce((obj, key) => { + obj[key] = remainingProps[key] + return obj + }, {}) + return (
@@ -162,6 +171,14 @@ Checkbox.propTypes = { value: PropTypes.string, /** Partial state */ partial: PropTypes.bool, + + /** (Input spec attributes) */ + initialQuery: PropTypes.string, + initialMap: PropTypes.string, + fullText: PropTypes.string, + facetKey: PropTypes.string, + facetValue: PropTypes.string, + isClicked: PropTypes.string, } export default withForwardedRef(Checkbox)