From 646c2840e5ccfe35d045e651b94d05a561a66aac Mon Sep 17 00:00:00 2001 From: Rinki Agarwal Date: Fri, 2 Oct 2020 16:43:17 +0530 Subject: [PATCH 01/16] Create Avatar component --- packages/react-components/package-lock.json | 2 +- packages/react-components/source/index.js | 2 + .../source/react/library/avatar/Avatar.js | 32 +++++++++++ .../source/react/library/avatar/Avatar.md | 53 +++++++++++++++++++ .../source/react/library/avatar/index.js | 3 ++ .../react/library/sidebar/SidebarFooter.js | 5 +- .../scss/library/components/_avatar.scss | 19 +++++++ .../source/scss/library/ui.scss | 2 + packages/sass-variables/package-lock.json | 2 +- 9 files changed, 115 insertions(+), 5 deletions(-) create mode 100644 packages/react-components/source/react/library/avatar/Avatar.js create mode 100644 packages/react-components/source/react/library/avatar/Avatar.md create mode 100644 packages/react-components/source/react/library/avatar/index.js create mode 100644 packages/react-components/source/scss/library/components/_avatar.scss diff --git a/packages/react-components/package-lock.json b/packages/react-components/package-lock.json index 1c0b02752..e4241678d 100644 --- a/packages/react-components/package-lock.json +++ b/packages/react-components/package-lock.json @@ -1,6 +1,6 @@ { "name": "@puppet/react-components", - "version": "5.22.4", + "version": "5.22.5", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/react-components/source/index.js b/packages/react-components/source/index.js index 0108254db..244e95739 100644 --- a/packages/react-components/source/index.js +++ b/packages/react-components/source/index.js @@ -3,6 +3,7 @@ import 'regenerator-runtime/runtime'; import ActionSelect from './react/library/action-select'; import Alert from './react/library/alert'; +import Avatar from './react/library/avatar'; import Badge from './react/library/badge'; import Breadcrumb from './react/library/breadcrumb'; import Button from './react/library/button'; @@ -36,6 +37,7 @@ import TooltipHoverArea from './react/library/tooltips/TooltipHoverArea'; export { ActionSelect, Alert, + Avatar, Badge, Breadcrumb, Button, diff --git a/packages/react-components/source/react/library/avatar/Avatar.js b/packages/react-components/source/react/library/avatar/Avatar.js new file mode 100644 index 000000000..bbda0111e --- /dev/null +++ b/packages/react-components/source/react/library/avatar/Avatar.js @@ -0,0 +1,32 @@ +import React from 'react'; +import classNames from 'classnames'; +import PropTypes from 'prop-types'; + +const propTypes = { + /** The content to render within the badge */ + children: PropTypes.node, + /** Optional additional classnames */ + className: PropTypes.string, + /** Optional avatar size */ + size: PropTypes.shape({}), + /** Optional additional inline styles */ + style: PropTypes.shape({}), +}; + +const defaultProps = { + children: null, + className: '', + size: {}, + style: {}, +}; + +const Avatar = ({ children, className, size, style, ...props }) => ( +
+ {children} +
+); + +Avatar.propTypes = propTypes; +Avatar.defaultProps = defaultProps; + +export default Avatar; diff --git a/packages/react-components/source/react/library/avatar/Avatar.md b/packages/react-components/source/react/library/avatar/Avatar.md new file mode 100644 index 000000000..60e5705f2 --- /dev/null +++ b/packages/react-components/source/react/library/avatar/Avatar.md @@ -0,0 +1,53 @@ +## Overview + +Avatar is an icon or figure representing a particular user of the application. The component can be adapted to use images, icons, or letters. + +## Type + +### Image Avatar + +```jsx +
+ + placeholder + + + placeholder + + + placeholder + +
+``` + +### Letter Avatar + +```jsx +
+ + R + + + M + + + T + +
+``` + +### Sizes + +```jsx +
+ + + + + + + + + +
+``` diff --git a/packages/react-components/source/react/library/avatar/index.js b/packages/react-components/source/react/library/avatar/index.js new file mode 100644 index 000000000..aff208f47 --- /dev/null +++ b/packages/react-components/source/react/library/avatar/index.js @@ -0,0 +1,3 @@ +import Avatar from './Avatar'; + +export default Avatar; diff --git a/packages/react-components/source/react/library/sidebar/SidebarFooter.js b/packages/react-components/source/react/library/sidebar/SidebarFooter.js index fcc7b34ac..c1304c021 100644 --- a/packages/react-components/source/react/library/sidebar/SidebarFooter.js +++ b/packages/react-components/source/react/library/sidebar/SidebarFooter.js @@ -3,6 +3,7 @@ import PropTypes from 'prop-types'; import Icon from '../icon'; import Heading from '../heading'; import Text from '../text'; +import Avatar from '../avatar'; const propTypes = { /** The root HTML element */ @@ -54,9 +55,7 @@ const SidebarFooter = ({ return (
- {profileIconProp || ( - - )} + {profileIconProp || {profileIconProp}}
{meta}
diff --git a/packages/react-components/source/scss/library/components/_avatar.scss b/packages/react-components/source/scss/library/components/_avatar.scss new file mode 100644 index 000000000..5f547dad0 --- /dev/null +++ b/packages/react-components/source/scss/library/components/_avatar.scss @@ -0,0 +1,19 @@ +.rc-avatar { + @include puppet-type-h4(); + align-items: center; + border-radius: 50%; + display: flex; + justify-content: center; + margin: $puppet-common-spacing-base; + text-transform: uppercase; + background-color: $puppet-n500; + overflow: hidden; + height: 32px; + width: 32px; + + + img { + width: 100%; + height: 100%; + } +} diff --git a/packages/react-components/source/scss/library/ui.scss b/packages/react-components/source/scss/library/ui.scss index 75f13d66c..8c66a9c27 100644 --- a/packages/react-components/source/scss/library/ui.scss +++ b/packages/react-components/source/scss/library/ui.scss @@ -34,3 +34,5 @@ @import 'components/radiobutton'; @import 'components/tag'; @import 'components/copy'; +@import 'components/avatar'; + diff --git a/packages/sass-variables/package-lock.json b/packages/sass-variables/package-lock.json index 482aa2b7e..7a3bbe947 100644 --- a/packages/sass-variables/package-lock.json +++ b/packages/sass-variables/package-lock.json @@ -1,6 +1,6 @@ { "name": "@puppet/sass-variables", - "version": "1.4.3", + "version": "1.4.4", "lockfileVersion": 1, "requires": true, "dependencies": { From 65ab0afdef8c3e69a8a39d3f999c2fd513fff6db Mon Sep 17 00:00:00 2001 From: Luke Abernethy Date: Wed, 14 Oct 2020 11:48:14 +0100 Subject: [PATCH 02/16] (LIDAR-555) Add neutral tag --- .../tablePageSelector.test.jsx.snap | 62 +++++++++++++++++++ .../source/react/library/button/Button.js | 8 ++- .../source/react/library/tag/Tag.js | 14 ++++- .../source/react/library/tag/Tag.md | 16 +++++ .../source/scss/library/components/_tag.scss | 34 ++++++++-- packages/react-components/test/tag/tag.js | 6 ++ 6 files changed, 131 insertions(+), 9 deletions(-) diff --git a/packages/data-grid/src/__test__/__snapshots__/tablePageSelector.test.jsx.snap b/packages/data-grid/src/__test__/__snapshots__/tablePageSelector.test.jsx.snap index 3865b81ef..be57be120 100644 --- a/packages/data-grid/src/__test__/__snapshots__/tablePageSelector.test.jsx.snap +++ b/packages/data-grid/src/__test__/__snapshots__/tablePageSelector.test.jsx.snap @@ -16,6 +16,7 @@ exports[`Page Navigation Check only arrow render 1`] = ` disabled={false} forwardRefAs="ref" icon="chevron-left" + iconSize="medium" innerFocus={false} loading={false} onClick={[Function]} @@ -67,6 +68,7 @@ exports[`Page Navigation Check only arrow render 1`] = ` disabled={true} forwardRefAs="ref" icon="chevron-right" + iconSize="medium" innerFocus={false} loading={false} onClick={[Function]} @@ -134,6 +136,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 1`] = ` disabled={true} forwardRefAs="ref" icon="chevron-left" + iconSize="medium" innerFocus={false} loading={false} onClick={[Function]} @@ -185,6 +188,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 1`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="0" loading={false} @@ -213,6 +217,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 1`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="1" loading={false} @@ -241,6 +246,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 1`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="2" loading={false} @@ -269,6 +275,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 1`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="3" loading={false} @@ -297,6 +304,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 1`] = ` disabled={false} forwardRefAs="ref" icon="chevron-right" + iconSize="medium" innerFocus={false} loading={false} onClick={[Function]} @@ -364,6 +372,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 2`] = ` disabled={false} forwardRefAs="ref" icon="chevron-left" + iconSize="medium" innerFocus={false} loading={false} onClick={[Function]} @@ -415,6 +424,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 2`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="0" loading={false} @@ -443,6 +453,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 2`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="1" loading={false} @@ -471,6 +482,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 2`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="2" loading={false} @@ -499,6 +511,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 2`] = ` disabled={true} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="3" loading={false} @@ -527,6 +540,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 2`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="4" loading={false} @@ -555,6 +569,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 2`] = ` disabled={false} forwardRefAs="ref" icon="chevron-right" + iconSize="medium" innerFocus={false} loading={false} onClick={[Function]} @@ -622,6 +637,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 3`] = ` disabled={false} forwardRefAs="ref" icon="chevron-left" + iconSize="medium" innerFocus={false} loading={false} onClick={[Function]} @@ -673,6 +689,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 3`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="0" loading={false} @@ -701,6 +718,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 3`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="1" loading={false} @@ -729,6 +747,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 3`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="2" loading={false} @@ -757,6 +776,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 3`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="3" loading={false} @@ -785,6 +805,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 3`] = ` disabled={true} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="4" loading={false} @@ -813,6 +834,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 3`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="5" loading={false} @@ -841,6 +863,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 3`] = ` disabled={false} forwardRefAs="ref" icon="chevron-right" + iconSize="medium" innerFocus={false} loading={false} onClick={[Function]} @@ -908,6 +931,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 4`] = ` disabled={false} forwardRefAs="ref" icon="chevron-left" + iconSize="medium" innerFocus={false} loading={false} onClick={[Function]} @@ -959,6 +983,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 4`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="0" loading={false} @@ -987,6 +1012,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 4`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="1" loading={false} @@ -1015,6 +1041,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 4`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="2" loading={false} @@ -1043,6 +1070,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 4`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="3" loading={false} @@ -1071,6 +1099,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 4`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="4" loading={false} @@ -1099,6 +1128,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 4`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="5" loading={false} @@ -1127,6 +1157,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 4`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="6" loading={false} @@ -1155,6 +1186,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 4`] = ` disabled={false} forwardRefAs="ref" icon="chevron-right" + iconSize="medium" innerFocus={false} loading={false} onClick={[Function]} @@ -1222,6 +1254,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 5`] = ` disabled={false} forwardRefAs="ref" icon="chevron-left" + iconSize="medium" innerFocus={false} loading={false} onClick={[Function]} @@ -1273,6 +1306,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 5`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="0" loading={false} @@ -1301,6 +1335,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 5`] = ` disabled={true} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="1" loading={false} @@ -1329,6 +1364,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 5`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="2" loading={false} @@ -1357,6 +1393,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 5`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="3" loading={false} @@ -1385,6 +1422,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 5`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="4" loading={false} @@ -1413,6 +1451,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 5`] = ` disabled={true} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="5" loading={false} @@ -1441,6 +1480,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 5`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="6" loading={false} @@ -1469,6 +1509,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 5`] = ` disabled={false} forwardRefAs="ref" icon="chevron-right" + iconSize="medium" innerFocus={false} loading={false} onClick={[Function]} @@ -1536,6 +1577,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 6`] = ` disabled={false} forwardRefAs="ref" icon="chevron-left" + iconSize="medium" innerFocus={false} loading={false} onClick={[Function]} @@ -1587,6 +1629,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 6`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="0" loading={false} @@ -1615,6 +1658,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 6`] = ` disabled={true} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="1" loading={false} @@ -1643,6 +1687,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 6`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="2" loading={false} @@ -1671,6 +1716,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 6`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="3" loading={false} @@ -1699,6 +1745,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 6`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="4" loading={false} @@ -1727,6 +1774,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 6`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="5" loading={false} @@ -1755,6 +1803,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 6`] = ` disabled={false} forwardRefAs="ref" icon="chevron-right" + iconSize="medium" innerFocus={false} loading={false} onClick={[Function]} @@ -1822,6 +1871,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 7`] = ` disabled={false} forwardRefAs="ref" icon="chevron-left" + iconSize="medium" innerFocus={false} loading={false} onClick={[Function]} @@ -1873,6 +1923,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 7`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="0" loading={false} @@ -1901,6 +1952,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 7`] = ` disabled={true} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="1" loading={false} @@ -1929,6 +1981,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 7`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="2" loading={false} @@ -1957,6 +2010,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 7`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="3" loading={false} @@ -1985,6 +2039,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 7`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="4" loading={false} @@ -2013,6 +2068,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 7`] = ` disabled={false} forwardRefAs="ref" icon="chevron-right" + iconSize="medium" innerFocus={false} loading={false} onClick={[Function]} @@ -2080,6 +2136,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 8`] = ` disabled={false} forwardRefAs="ref" icon="chevron-left" + iconSize="medium" innerFocus={false} loading={false} onClick={[Function]} @@ -2131,6 +2188,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 8`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="0" loading={false} @@ -2159,6 +2217,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 8`] = ` disabled={true} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="1" loading={false} @@ -2187,6 +2246,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 8`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="2" loading={false} @@ -2215,6 +2275,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 8`] = ` disabled={false} forwardRefAs="ref" icon={null} + iconSize="medium" innerFocus={false} key="3" loading={false} @@ -2243,6 +2304,7 @@ exports[`Snapshot test Check component matches previous HTML snapshot 8`] = ` disabled={true} forwardRefAs="ref" icon="chevron-right" + iconSize="medium" innerFocus={false} loading={false} onClick={[Function]} diff --git a/packages/react-components/source/react/library/button/Button.js b/packages/react-components/source/react/library/button/Button.js index 03857ff61..bdbe00da3 100644 --- a/packages/react-components/source/react/library/button/Button.js +++ b/packages/react-components/source/react/library/button/Button.js @@ -22,6 +22,8 @@ const propTypes = { weight: PropTypes.oneOf(['bold', 'subtle']), /** Optional icon to be rendered instead of / in addition to button text. If both an icon and text are present, the icon will be rendered before the text */ icon: PropTypes.oneOf(AVAILABLE_ICONS), + /** Optional prop to change the size of a leading or trailing icons */ + iconSize: PropTypes.oneOf(['tiny', 'small', 'medium', 'large']), /** Button text or other content */ children: PropTypes.node, /** Optional trailing icon rendered after button text. For icon-only buttons, please use the 'icon' prop instead */ @@ -45,6 +47,7 @@ const defaultProps = { weight: 'bold', children: null, icon: null, + iconSize: 'medium', trailingIcon: null, loading: false, innerFocus: false, @@ -78,6 +81,7 @@ const Button = forwardRef( type, weight, icon, + iconSize, trailingIcon, loading, innerFocus, @@ -116,7 +120,7 @@ const Button = forwardRef( > {icon && ( @@ -124,7 +128,7 @@ const Button = forwardRef( {children} {trailingIcon && ( diff --git a/packages/react-components/source/react/library/tag/Tag.js b/packages/react-components/source/react/library/tag/Tag.js index f4eeadab2..b36f0795b 100644 --- a/packages/react-components/source/react/library/tag/Tag.js +++ b/packages/react-components/source/react/library/tag/Tag.js @@ -1,5 +1,6 @@ import React from 'react'; -import { func, string } from 'prop-types'; +import { func, string, oneOf } from 'prop-types'; +import classNames from 'classnames'; import Button from '../button'; import Text from '../text'; @@ -8,15 +9,21 @@ const propTypes = { label: string.isRequired, /** Callback function called when clode icon is clicked */ onClick: func, + /** Type dictates tag coloring */ + type: oneOf(['primary', 'neutral']), + /** Optional additional classnames */ + className: string, }; const defaultProps = { onClick: () => {}, + type: 'primary', + className: '', }; -const Tag = ({ label, onClick }) => { +const Tag = ({ label, onClick, type, className }) => { return ( -
+
{label}
@@ -24,6 +31,7 @@ const Tag = ({ label, onClick }) => { className="rc-tag-remove-button" onClick={() => onClick()} icon="close" + iconSize="small" aria-label={`${label} Remove tag`} />
diff --git a/packages/react-components/source/react/library/tag/Tag.md b/packages/react-components/source/react/library/tag/Tag.md index 5bf44c667..25e840fe7 100644 --- a/packages/react-components/source/react/library/tag/Tag.md +++ b/packages/react-components/source/react/library/tag/Tag.md @@ -18,6 +18,22 @@ const onTagClick = () => {
; ``` +### Neutral + +The neutral tag can be selected through the type prop. This type of the tag has been developed to be used for displaying currently active filters within your application. + +```jsx +const onTagClick = () => { + console.log('The X was clicked'); +}; + +
+
+ +
+
; +``` + ## Related - [Badge](#/React%20Components/Badge) diff --git a/packages/react-components/source/scss/library/components/_tag.scss b/packages/react-components/source/scss/library/components/_tag.scss index 24291466e..8053457da 100644 --- a/packages/react-components/source/scss/library/components/_tag.scss +++ b/packages/react-components/source/scss/library/components/_tag.scss @@ -5,8 +5,7 @@ width: max-content; .rc-icon { - height: 12px !important; - width: 12px !important; + margin-left: 3px; } } @@ -18,7 +17,34 @@ @include puppet-type-button(); color: $puppet-white; height: fit-content; - padding-left: 15px; - padding-right: 4px; + padding-left: 8px; + padding-right: 8px; + } +} + +.rc-tag-neutral { + background-color: $puppet-white; + border: $puppet-common-border; + + .rc-tag-label-background { + border-right: $puppet-common-border; + + .rc-tag-text { + color: $puppet-n700; + } + } + + .rc-tag-remove-button { + background: $puppet-white; + border: $puppet-white; + fill: $puppet-b500; + + &:hover { + background-color: $puppet-n200; + } + + .rc-icon-close { + margin-left: 10; + } } } diff --git a/packages/react-components/test/tag/tag.js b/packages/react-components/test/tag/tag.js index 20dfe3278..242ee5e65 100644 --- a/packages/react-components/test/tag/tag.js +++ b/packages/react-components/test/tag/tag.js @@ -29,4 +29,10 @@ describe('', () => { expect(onClick.called).to.equal(true); }); + + it('should render the neutral tag when correct type is passed', () => { + const wrapper = shallow(); + + expect(wrapper.hasClass('rc-tag-neutral')).to.equal(true); + }); }); From c7313f0c555c8d065d85af0788f52627d7fdb2ab Mon Sep 17 00:00:00 2001 From: Jillian Keenan Date: Tue, 20 Oct 2020 15:03:56 +0100 Subject: [PATCH 03/16] (PDS-496) - Add a11y to Loading component --- packages/data-grid/src/table/Table.jsx | 2 -- .../react-components/source/react/library/loading/Loading.js | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/data-grid/src/table/Table.jsx b/packages/data-grid/src/table/Table.jsx index 112c86077..dd9fc859e 100644 --- a/packages/data-grid/src/table/Table.jsx +++ b/packages/data-grid/src/table/Table.jsx @@ -198,8 +198,6 @@ class Table extends Component { >
diff --git a/packages/react-components/source/react/library/loading/Loading.js b/packages/react-components/source/react/library/loading/Loading.js index 627def4a3..83fcd8155 100644 --- a/packages/react-components/source/react/library/loading/Loading.js +++ b/packages/react-components/source/react/library/loading/Loading.js @@ -15,7 +15,7 @@ const defaultProps = { }; const Loading = ({ className, size, ...rest }) => ( -
+
Date: Tue, 20 Oct 2020 16:52:06 +0100 Subject: [PATCH 04/16] (MAINT) - Converting tooltiphover component to function component Converting the ToolTipHoverArea component to functional component using react hooks --- .../library/tooltips/TooltipHoverArea.js | 101 ++++++++---------- 1 file changed, 44 insertions(+), 57 deletions(-) diff --git a/packages/react-components/source/react/library/tooltips/TooltipHoverArea.js b/packages/react-components/source/react/library/tooltips/TooltipHoverArea.js index a2c9bfed6..781959c0b 100644 --- a/packages/react-components/source/react/library/tooltips/TooltipHoverArea.js +++ b/packages/react-components/source/react/library/tooltips/TooltipHoverArea.js @@ -1,5 +1,5 @@ import PropTypes from 'prop-types'; -import React from 'react'; +import React, { useState } from 'react'; import classNames from 'classnames'; import Tooltip from './Tooltip'; @@ -32,82 +32,69 @@ const defaultProps = { * * The tooltip prop passed to `TooltipHoverArea`--the tooltip content--can be a string or an element. */ -class TooltipHoverArea extends React.Component { - constructor(props) { - super(props); - - this.state = { open: false }; - - this.onMouseOver = this.onMouseOver.bind(this); - this.onMouseOut = this.onMouseOut.bind(this); - this.onClick = this.onClick.bind(this); - } - - onClick(e) { - const { onClick } = this.props; - +const TooltipHoverArea = ({ + anchor, + children, + className, + onClick, + style, + tooltip, +}) => { + const [isOpen, setIsOpen] = useState(false); + const [triggerElem, setTriggerElem] = useState(null); + + function handleClick(e) { if (onClick) { // If something is going to happen on click, let's just close the tooltip. - this.setState({ open: false }); + setIsOpen(false); onClick(e); } } - onMouseOver() { - this.setState({ open: true }); + function onMouseOver() { + setIsOpen(true); } - onMouseOut() { - this.setState({ open: false }); + function onMouseOut() { + setIsOpen(false); } - renderTooltip() { - const { anchor, tooltip } = this.props; - - if (!this.elem) { + function renderTooltip() { + if (!triggerElem) { return null; } return ( - + {tooltip} ); } - render() { - const tooltip = this.renderTooltip(); - const { open } = this.state; - const { children, className, style } = this.props; - - const props = { - role: this.onClick ? 'button' : null, - onClick: this.onClick, - style, - }; - - return ( -
{ - this.elem = c; - }} - > - {tooltip} - {children} -
- ); - } -} + const props = { + role: 'button', + onClick: handleClick, + style, + }; + + return ( +
{ + setTriggerElem(elem); + }} + > + {renderTooltip()} + {children} +
+ ); +}; TooltipHoverArea.propTypes = propTypes; TooltipHoverArea.defaultProps = defaultProps; From bc65647530c9726813fe2c176545e929db913b0f Mon Sep 17 00:00:00 2001 From: Sean McKenna Date: Wed, 14 Oct 2020 20:48:53 +0100 Subject: [PATCH 05/16] (MAINT) Add dag and workspaces icons --- .../source/react/library/icon/icons.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/packages/react-components/source/react/library/icon/icons.js b/packages/react-components/source/react/library/icon/icons.js index d7270eb6e..a15ad36a8 100644 --- a/packages/react-components/source/react/library/icon/icons.js +++ b/packages/react-components/source/react/library/icon/icons.js @@ -399,6 +399,15 @@ const icons = { ), }, + dag: { + medium: ( + + ), + }, + data: { medium: ( + ), + }, + x: { medium: ( Date: Fri, 30 Oct 2020 14:31:07 -0700 Subject: [PATCH 06/16] Add `pull_request_target` event to test.yml --- .github/workflows/test.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0fb705efd..e08b046c3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,13 +2,9 @@ name: Test on: push: - branches-ignore: - - development - - master pull_request: - branches-ignore: - - development - - master + pull_request_target: + types: [opened, reopened, synchronize] jobs: test: @@ -20,7 +16,7 @@ jobs: node-version: [12.4.0] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} From c7fb94ec7624eadfcdf4afc2e6aec7d0e3401a5a Mon Sep 17 00:00:00 2001 From: Sean McKenna Date: Mon, 2 Nov 2020 09:45:55 +0000 Subject: [PATCH 07/16] (PDS-512) Add signout option to Sidebar Footer (#338) * (PDS-512) Add signout option to Sidebar onSignout callback prop will be called when signout button is clicked. * (PDS-512) Turn off signout button radius * (PDS-512) Add class when onClick is supplied to Sidebar.Footer Add a click class to the Profile button when an onClick prop is supplied, so that click styling such as cursor and highlighting are applied only when relevant. * (PDS-512) Remove outline from footer profile * (PDS-512) Fix Avatar changes and remove margin --- .../source/react/library/sidebar/Sidebar.md | 2 + .../react/library/sidebar/SidebarFooter.js | 47 +++++++++++-- .../scss/library/components/_avatar.scss | 2 - .../scss/library/components/_sidebar.scss | 70 ++++++++++++++++--- .../react-components/test/sidebar/Sidebar.js | 19 +++++ 5 files changed, 121 insertions(+), 19 deletions(-) diff --git a/packages/react-components/source/react/library/sidebar/Sidebar.md b/packages/react-components/source/react/library/sidebar/Sidebar.md index 49ddbd1bf..3e2f5ebcf 100644 --- a/packages/react-components/source/react/library/sidebar/Sidebar.md +++ b/packages/react-components/source/react/library/sidebar/Sidebar.md @@ -66,6 +66,8 @@ import Badge from '../badge'; username="Lorem Ipsum" version="1969.7.20" onClick={console.log} + enableSignout + onSignout={console.log} />
; diff --git a/packages/react-components/source/react/library/sidebar/SidebarFooter.js b/packages/react-components/source/react/library/sidebar/SidebarFooter.js index c1304c021..fe2a33f10 100644 --- a/packages/react-components/source/react/library/sidebar/SidebarFooter.js +++ b/packages/react-components/source/react/library/sidebar/SidebarFooter.js @@ -4,6 +4,8 @@ import Icon from '../icon'; import Heading from '../heading'; import Text from '../text'; import Avatar from '../avatar'; +import classnames from 'classnames'; +import Button from '../button'; const propTypes = { /** The root HTML element */ @@ -16,6 +18,10 @@ const propTypes = { minimized: PropTypes.bool, /** Displays an element of the users choice * */ profileIcon: PropTypes.node, + /** Boolean flag to enable or disable (default) signout button */ + enableSignout: PropTypes.bool, + /** Signout callback function */ + onSignout: PropTypes.func, }; const defaultProps = { @@ -24,6 +30,8 @@ const defaultProps = { version: '', minimized: false, profileIcon: null, + enableSignout: false, + onSignout: () => {}, }; const SidebarFooter = ({ @@ -32,10 +40,13 @@ const SidebarFooter = ({ version, minimized, profileIcon: profileIconProp, + enableSignout, + onSignout, ...rest }) => { const Component = as; let meta; + let signout; if (!minimized) { meta = ( @@ -50,15 +61,39 @@ const SidebarFooter = ({ )}
); + + if (enableSignout) { + signout = ( + + ); + } } return ( - -
- {profileIconProp || {profileIconProp}} -
- {meta} -
+
+ +
+ {profileIconProp ? ( + {profileIconProp} + ) : ( + + )} +
+ {meta} +
+ {signout} +
); }; diff --git a/packages/react-components/source/scss/library/components/_avatar.scss b/packages/react-components/source/scss/library/components/_avatar.scss index 5f547dad0..9ca3d753a 100644 --- a/packages/react-components/source/scss/library/components/_avatar.scss +++ b/packages/react-components/source/scss/library/components/_avatar.scss @@ -4,14 +4,12 @@ border-radius: 50%; display: flex; justify-content: center; - margin: $puppet-common-spacing-base; text-transform: uppercase; background-color: $puppet-n500; overflow: hidden; height: 32px; width: 32px; - img { width: 100%; height: 100%; diff --git a/packages/react-components/source/scss/library/components/_sidebar.scss b/packages/react-components/source/scss/library/components/_sidebar.scss index 032ae4d7f..179ddfad9 100644 --- a/packages/react-components/source/scss/library/components/_sidebar.scss +++ b/packages/react-components/source/scss/library/components/_sidebar.scss @@ -51,7 +51,9 @@ $puppet-sidebar-item-accordion-padding: 0 0 0 8px !default; $puppet-sidebar-footer-height: 72px !default; $puppet-sidebar-footer-bg: $puppet-black !default; -$puppet-sidebar-footer-meta-icon: 32px; +$puppet-sidebar-footer-meta-icon: 32px !default; +$puppet-sidebar-footer-signout-width: 56px !default; +$puppet-sidebar-footer-signout-left-margin: 3px !default; // Generic sidebar @@ -236,29 +238,73 @@ $puppet-sidebar-footer-meta-icon: 32px; // Sidebar footer .rc-sidebar-footer { - @include rc-button-reset(); - align-items: center; - background: $puppet-sidebar-footer-bg; box-sizing: border-box; display: flex; height: $puppet-sidebar-footer-height; overflow: hidden; - padding: $puppet-sidebar-padding; - text-align: left; text-decoration: none !important; + justify-content: space-between; + + .rc-sidebar-footer-button-user, + .rc-sidebar-footer-button-signout { + display: flex; + background: $puppet-sidebar-footer-bg; + height: 100%; + border-radius: 0; + align-items: center; + justify-content: center; + } + + .rc-sidebar-footer-button-user { + flex: 1; + border: 0; + outline: none; + min-width: 0; + text-align: left; + justify-content: flex-start; + padding: 0 0 0 $puppet-sidebar-padding; + + &.rc-sidebar-footer-clickable { + cursor: pointer; + } + + &.rc-sidebar-footer-button-minimized { + padding: 0; + justify-content: center; + } + } + + .rc-sidebar-footer-button-signout { + @include rc-button-reset(); + width: $puppet-sidebar-footer-signout-width; + margin-left: $puppet-sidebar-footer-signout-left-margin; + } .rc-sidebar-footer-meta-username, .rc-sidebar-footer-meta-version { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; - width: $puppet-sidebar-width - $puppet-sidebar-padding * 3 - - $puppet-sidebar-footer-meta-icon; } } -.rc-sidebar-footer:hover, -.rc-sidebar-footer:active { +.rc-sidebar-footer-button-signout:hover, +.rc-sidebar-footer-button-signout:active { + .rc-sidebar-footer-signout-icon { + fill: $puppet-sidebar-item-color-hover; + } +} + +.rc-sidebar-footer-button-signout:focus { + box-shadow: $puppet-common-focus-outline-inset; + + .rc-sidebar-footer-signout-icon { + fill: $puppet-sidebar-item-color-hover; + } +} + +.rc-sidebar-footer-clickable.rc-sidebar-footer-button-user:hover, +.rc-sidebar-footer-clickable.rc-sidebar-footer-button-user:active { .rc-sidebar-footer-meta-username, .rc-sidebar-footer-meta-version { color: $puppet-sidebar-item-color-hover; @@ -269,7 +315,7 @@ $puppet-sidebar-footer-meta-icon: 32px; } } -.rc-sidebar-footer:focus { +.rc-sidebar-footer-clickable.rc-sidebar-footer-button-user:focus { box-shadow: $puppet-common-focus-outline-inset; .rc-sidebar-footer-meta-username, @@ -284,6 +330,8 @@ $puppet-sidebar-footer-meta-icon: 32px; .rc-sidebar-footer-meta-details { display: flex; + flex: 1; + min-width: 0; flex-direction: column; margin-left: $puppet-sidebar-padding; } diff --git a/packages/react-components/test/sidebar/Sidebar.js b/packages/react-components/test/sidebar/Sidebar.js index 223191264..f976aa209 100644 --- a/packages/react-components/test/sidebar/Sidebar.js +++ b/packages/react-components/test/sidebar/Sidebar.js @@ -1,4 +1,5 @@ import React from 'react'; +import sinon from 'sinon'; import { shallow } from 'enzyme'; import { expect } from 'chai'; @@ -110,6 +111,24 @@ describe('', () => { const wrapper = shallow(); expect(wrapper.length).to.eql(1); + expect(wrapper.find('.rc-sidebar-footer-button-signout').length).to.eql( + 0, + ); + }); + + it('should render signout button', () => { + const callback = sinon.fake(); + const wrapper = shallow( + , + ); + + expect(wrapper.find('.rc-sidebar-footer-button-signout').length).to.eql( + 1, + ); + + expect(callback.callCount).to.eql(0); + wrapper.find('.rc-sidebar-footer-button-signout').simulate('click'); + expect(callback.calledOnce).to.be.true; }); }); }); From 4996deb9a1700148160650f40af8995b13c6bcd8 Mon Sep 17 00:00:00 2001 From: Luke Abernethy Date: Mon, 2 Nov 2020 13:57:26 +0000 Subject: [PATCH 08/16] (PDS-555) Change props and close icon colour --- .../source/react/library/tag/Tag.js | 14 ++++++++++++-- .../source/react/library/tag/Tag.md | 9 +++++++-- .../source/scss/library/components/_tag.scss | 4 ++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/packages/react-components/source/react/library/tag/Tag.js b/packages/react-components/source/react/library/tag/Tag.js index b36f0795b..98dc824bc 100644 --- a/packages/react-components/source/react/library/tag/Tag.js +++ b/packages/react-components/source/react/library/tag/Tag.js @@ -11,6 +11,8 @@ const propTypes = { onClick: func, /** Type dictates tag coloring */ type: oneOf(['primary', 'neutral']), + /** Currently only subtle netural supported */ + emphasis: oneOf(['bold', 'subtle']), /** Optional additional classnames */ className: string, }; @@ -19,11 +21,19 @@ const defaultProps = { onClick: () => {}, type: 'primary', className: '', + emphasis: 'bold', }; -const Tag = ({ label, onClick, type, className }) => { +const Tag = ({ label, onClick, type, emphasis, className }) => { return ( -
+
{label}
diff --git a/packages/react-components/source/react/library/tag/Tag.md b/packages/react-components/source/react/library/tag/Tag.md index 25e840fe7..b2a35c53a 100644 --- a/packages/react-components/source/react/library/tag/Tag.md +++ b/packages/react-components/source/react/library/tag/Tag.md @@ -20,7 +20,7 @@ const onTagClick = () => { ### Neutral -The neutral tag can be selected through the type prop. This type of the tag has been developed to be used for displaying currently active filters within your application. +The neutral tag can be selected through the type prop. This type of the tag has been developed to be used for displaying currently active filters within your application. Currently we only support a neutral subtle component. This also requires an emphasis="subtle" prop to be added. ```jsx const onTagClick = () => { @@ -29,7 +29,12 @@ const onTagClick = () => {
- +
; ``` diff --git a/packages/react-components/source/scss/library/components/_tag.scss b/packages/react-components/source/scss/library/components/_tag.scss index 8053457da..bc83cab17 100644 --- a/packages/react-components/source/scss/library/components/_tag.scss +++ b/packages/react-components/source/scss/library/components/_tag.scss @@ -22,7 +22,7 @@ } } -.rc-tag-neutral { +.rc-tag-neutral.rc-tag-subtle { background-color: $puppet-white; border: $puppet-common-border; @@ -37,7 +37,7 @@ .rc-tag-remove-button { background: $puppet-white; border: $puppet-white; - fill: $puppet-b500; + fill: $puppet-n700; &:hover { background-color: $puppet-n200; From 2cf4e6312d9c294ea3b3d3ff46c3c495273339f6 Mon Sep 17 00:00:00 2001 From: Luke Abernethy Date: Mon, 2 Nov 2020 14:31:23 +0000 Subject: [PATCH 09/16] (MAINT) Fix breaking tests --- packages/data-grid/src/table/Table.jsx | 4 +--- .../source/react/library/avatar/Avatar.js | 10 ++++++--- .../react/library/sidebar/SidebarFooter.js | 2 +- .../scss/library/components/_avatar.scss | 8 +++---- .../scss/library/components/_sidebar.scss | 22 +++++++++---------- 5 files changed, 24 insertions(+), 22 deletions(-) diff --git a/packages/data-grid/src/table/Table.jsx b/packages/data-grid/src/table/Table.jsx index dd9fc859e..fa2487027 100644 --- a/packages/data-grid/src/table/Table.jsx +++ b/packages/data-grid/src/table/Table.jsx @@ -196,9 +196,7 @@ class Table extends Component { className="dg-table-loading-container" colSpan={columns.length} > -
+
diff --git a/packages/react-components/source/react/library/avatar/Avatar.js b/packages/react-components/source/react/library/avatar/Avatar.js index bbda0111e..6ab76fe9d 100644 --- a/packages/react-components/source/react/library/avatar/Avatar.js +++ b/packages/react-components/source/react/library/avatar/Avatar.js @@ -9,8 +9,8 @@ const propTypes = { className: PropTypes.string, /** Optional avatar size */ size: PropTypes.shape({}), - /** Optional additional inline styles */ - style: PropTypes.shape({}), + /** Optional additional inline styles */ + style: PropTypes.shape({}), }; const defaultProps = { @@ -21,7 +21,11 @@ const defaultProps = { }; const Avatar = ({ children, className, size, style, ...props }) => ( -
+
{children}
); diff --git a/packages/react-components/source/react/library/sidebar/SidebarFooter.js b/packages/react-components/source/react/library/sidebar/SidebarFooter.js index fe2a33f10..ab1eb0f35 100644 --- a/packages/react-components/source/react/library/sidebar/SidebarFooter.js +++ b/packages/react-components/source/react/library/sidebar/SidebarFooter.js @@ -1,10 +1,10 @@ import React from 'react'; import PropTypes from 'prop-types'; +import classnames from 'classnames'; import Icon from '../icon'; import Heading from '../heading'; import Text from '../text'; import Avatar from '../avatar'; -import classnames from 'classnames'; import Button from '../button'; const propTypes = { diff --git a/packages/react-components/source/scss/library/components/_avatar.scss b/packages/react-components/source/scss/library/components/_avatar.scss index 9ca3d753a..19f795e18 100644 --- a/packages/react-components/source/scss/library/components/_avatar.scss +++ b/packages/react-components/source/scss/library/components/_avatar.scss @@ -1,17 +1,17 @@ .rc-avatar { @include puppet-type-h4(); align-items: center; + background-color: $puppet-n500; border-radius: 50%; display: flex; + height: 32px; justify-content: center; - text-transform: uppercase; - background-color: $puppet-n500; overflow: hidden; - height: 32px; + text-transform: uppercase; width: 32px; img { - width: 100%; height: 100%; + width: 100%; } } diff --git a/packages/react-components/source/scss/library/components/_sidebar.scss b/packages/react-components/source/scss/library/components/_sidebar.scss index 179ddfad9..029df3a6f 100644 --- a/packages/react-components/source/scss/library/components/_sidebar.scss +++ b/packages/react-components/source/scss/library/components/_sidebar.scss @@ -241,43 +241,43 @@ $puppet-sidebar-footer-signout-left-margin: 3px !default; box-sizing: border-box; display: flex; height: $puppet-sidebar-footer-height; + justify-content: space-between; overflow: hidden; text-decoration: none !important; - justify-content: space-between; .rc-sidebar-footer-button-user, .rc-sidebar-footer-button-signout { - display: flex; + align-items: center; background: $puppet-sidebar-footer-bg; - height: 100%; border-radius: 0; - align-items: center; + display: flex; + height: 100%; justify-content: center; } .rc-sidebar-footer-button-user { - flex: 1; border: 0; - outline: none; - min-width: 0; - text-align: left; + flex: 1; justify-content: flex-start; + min-width: 0; + outline: none; padding: 0 0 0 $puppet-sidebar-padding; + text-align: left; &.rc-sidebar-footer-clickable { cursor: pointer; } &.rc-sidebar-footer-button-minimized { - padding: 0; justify-content: center; + padding: 0; } } .rc-sidebar-footer-button-signout { @include rc-button-reset(); - width: $puppet-sidebar-footer-signout-width; margin-left: $puppet-sidebar-footer-signout-left-margin; + width: $puppet-sidebar-footer-signout-width; } .rc-sidebar-footer-meta-username, @@ -331,9 +331,9 @@ $puppet-sidebar-footer-signout-left-margin: 3px !default; .rc-sidebar-footer-meta-details { display: flex; flex: 1; - min-width: 0; flex-direction: column; margin-left: $puppet-sidebar-padding; + min-width: 0; } .rc-sidebar-footer-meta-user { From 17b85f4c4b868ead1ff547ce19528d1a4ce20082 Mon Sep 17 00:00:00 2001 From: Nathan Ward Date: Mon, 2 Nov 2020 07:58:07 -0800 Subject: [PATCH 10/16] Update test.yml Comment out the `pull_request_target` event for now because by default it runs on the PR base instead of the latest commit. --- .github/workflows/test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e08b046c3..5549a0c7b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,8 +3,9 @@ name: Test on: push: pull_request: - pull_request_target: - types: [opened, reopened, synchronize] + # TODO: See if the following event can be used to get tests running on PRs from forks. Note that we would have to change the git context from the base to the PR with actions/checkout. + # pull_request_target: + # types: [opened, reopened, synchronize] jobs: test: From c05f4c3f74e93e64ab0ba890075658b0583b05c9 Mon Sep 17 00:00:00 2001 From: Chris Leicester Date: Fri, 30 Oct 2020 12:03:53 -0700 Subject: [PATCH 11/16] (maint) Fix ability to npm link react-components Prior to this commit, @puppet/react-components made use of the npm step `prebuild` to delete the build directory prior to rebuilding the app. If another development environment was consuming a linked version of @puppet/react-components, this prebuild step caused the consuming application to rebuild immediately, and crash because the build dir was gone. With this commit, we remove the prebuild step entirely. As of Webpack 4, deleting the build dir is no longer necessary. Webpack deletes the the dir itself when adding the new files. This allows all consuming apps to utilize the linked version of @puppet/react-components during develoment. **Note:** This is the only package within the design system that used the prebuild step. I would expect linking to work as-is for all other packages, though I did not test them. --- packages/react-components/package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/react-components/package.json b/packages/react-components/package.json index 1c396039f..7c86d7c19 100644 --- a/packages/react-components/package.json +++ b/packages/react-components/package.json @@ -7,7 +7,6 @@ "scripts": { "link": "npm link", "analyze": "webpack --config webpack.analyze.config.js", - "prebuild": "rimraf build", "build": "NODE_ENV=production webpack", "prepare": "npm run build", "complexity": "es6-plato -r -d complexity source/react && open ./complexity/index.html", From 2aba90286cede0977c48e6dac6a32d4d271dfc1b Mon Sep 17 00:00:00 2001 From: Nathan Ward Date: Mon, 2 Nov 2020 13:32:14 -0800 Subject: [PATCH 12/16] Remove unused rimraf dependency --- packages/react-components/package-lock.json | 9 --------- packages/react-components/package.json | 1 - 2 files changed, 10 deletions(-) diff --git a/packages/react-components/package-lock.json b/packages/react-components/package-lock.json index c92366982..0393c0ef0 100644 --- a/packages/react-components/package-lock.json +++ b/packages/react-components/package-lock.json @@ -16437,15 +16437,6 @@ "integrity": "sha1-mUWygD8hni96ygCtuLyfZA+ELJo=", "dev": true }, - "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - }, "ripemd160": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", diff --git a/packages/react-components/package.json b/packages/react-components/package.json index 7c86d7c19..5e4eb0219 100644 --- a/packages/react-components/package.json +++ b/packages/react-components/package.json @@ -70,7 +70,6 @@ "react-router": "^5.2.0", "react-styleguidist": "^10.6.2", "resolve-url-loader": "^3.1.1", - "rimraf": "^3.0.2", "sass-loader": "^8.0.2", "sinon": "^7.5.0", "sinon-chai": "^3.5.0", From 57650f25df55da979f935798bc5822fd9b6dcd0e Mon Sep 17 00:00:00 2001 From: Nathan Ward Date: Mon, 2 Nov 2020 13:54:24 -0800 Subject: [PATCH 13/16] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c0cd7b6a..cf1f862f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# react-components NEXT + +- Fix ability to npm link react-components by removing `prebuild` step (by [chrisleicester](https://github.com/chrisleicester) in [#353](https://github.com/puppetlabs/design-system/pull/353)) + # react-components 5.24.3 (2020-10-27) - [Filter] Add onUpdate prop to filter (by [eglenfield](https://github.com/eglenfield) in [#344](https://github.com/puppetlabs/design-system/pull/344)) From 8b9bd6ecd5bcc28780d1d989f367880307331f03 Mon Sep 17 00:00:00 2001 From: Nathan Ward Date: Mon, 2 Nov 2020 23:06:16 -0800 Subject: [PATCH 14/16] Update CHANGELOG.md --- CHANGELOG.md | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf1f862f3..190e0c9aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,39 +1,44 @@ -# react-components NEXT +# react-components 5.25.0 (2020-11-02) -- Fix ability to npm link react-components by removing `prebuild` step (by [chrisleicester](https://github.com/chrisleicester) in [#353](https://github.com/puppetlabs/design-system/pull/353)) +- [Avatar] Create Avatar component (by [@niftyrinki](https://github.com/niftyrinki) in [#319](https://github.com/puppetlabs/design-system/pull/319)) +- [Sidebar] Add signout option to Sidebar.Footer (by [@sean-mckenna](https://github.com/sean-mckenna) in [#338](https://github.com/puppetlabs/design-system/pull/338)) +- [Tag] Add "neutral" Tag (by [@Lukeaber](https://github.com/Lukeaber) in [#339](https://github.com/puppetlabs/design-system/pull/339)) +- [Icon] Add "dag" and "workspaces" icons (by [@sean-mckenna](https://github.com/sean-mckenna) in [#341](https://github.com/puppetlabs/design-system/pull/341)) +- [Loading] Add a11y to Loading component (by [@jilliankeenan](https://github.com/jilliankeenan) in [#345](https://github.com/puppetlabs/design-system/pull/345)) +- Fix ability to `npm link` react-components by removing `prebuild` step (by [@chrisleicester](https://github.com/chrisleicester) in [#353](https://github.com/puppetlabs/design-system/pull/353)) # react-components 5.24.3 (2020-10-27) -- [Filter] Add onUpdate prop to filter (by [eglenfield](https://github.com/eglenfield) in [#344](https://github.com/puppetlabs/design-system/pull/344)) +- [Filter] Add onUpdate prop to filter (by [@eglenfield](https://github.com/eglenfield) in [#344](https://github.com/puppetlabs/design-system/pull/344)) # react-components 5.24.2 (2020-10-22) -- [Form.Field] Hide form field labels visually (but not to screen readers) when label is null (by [sprokusk](https://github.com/sprokusk) in [#348](https://github.com/puppetlabs/design-system/pull/348)) +- [Form.Field] Hide form field labels visually (but not to screen readers) when label is null (by [@sprokusk](https://github.com/sprokusk) in [#348](https://github.com/puppetlabs/design-system/pull/348)) - [Input] Update placeholder color to n700 to meet accessibility contrast ratios (by [@Sigler](https://github.com/Sigler) in [#347](https://github.com/puppetlabs/design-system/pull/347)) # react-components 5.24.1 (2020-10-14) -- [Toolbar] Fix toolbar tabs alignment (by [melcherry98](https://github.com/melcherry98) in [#342](https://github.com/puppetlabs/design-system/pull/342)) +- [Toolbar] Fix toolbar tabs alignment (by [@melcherry98](https://github.com/melcherry98) in [#342](https://github.com/puppetlabs/design-system/pull/342)) # react-components 5.24.0 (2020-10-12) -- [Popover] Add Popover component (by [melcherry98](https://github.com/melcherry98) in [#333](https://github.com/puppetlabs/design-system/pull/333)) +- [Popover] Add Popover component (by [@melcherry98](https://github.com/melcherry98) in [#333](https://github.com/puppetlabs/design-system/pull/333)) - [SidePanel] Add `closeButtonIcon` and `hideCloseButton` props to SidePanel (by [@jilliankeenan](https://github.com/jilliankeenan) in [#336](https://github.com/puppetlabs/design-system/pull/336)) -- [Logo] Fix logo for Comply (by [vine77](https://github.com/vine77) in [#332](https://github.com/puppetlabs/design-system/pull/332)) +- [Logo] Fix logo for Comply (by [@vine77](https://github.com/vine77) in [#332](https://github.com/puppetlabs/design-system/pull/332)) # react-components 5.23.1 (2020-10-07) -- [Logo] Add "comply" logo (by [Ioannis-Karasavvaidis](https://github.com/Ioannis-Karasavvaidis) in [#327](https://github.com/puppetlabs/design-system/pull/327)) -- [Input] Fix bug with default `size` in Input (by [sprokusk](https://github.com/sprokusk) in [016651a](https://github.com/puppetlabs/design-system/commit/016651a357d2f2f1960147229cc7909f3088b4dc)) +- [Logo] Add "comply" logo (by [@Ioannis-Karasavvaidis](https://github.com/Ioannis-Karasavvaidis) in [#327](https://github.com/puppetlabs/design-system/pull/327)) +- [Input] Fix bug with default `size` in Input (by [@sprokusk](https://github.com/sprokusk) in [016651a](https://github.com/puppetlabs/design-system/commit/016651a357d2f2f1960147229cc7909f3088b4dc)) # react-components 5.23.0 (2020-10-07) - [Tabs] Add "transparent" Tabs variant and make Tabs scrollable (at narrow widths) (by [@caseywilliams](https://github.com/caseywilliams) in [#302](https://github.com/puppetlabs/design-system/pull/302)) -- [Input] Add size and shape props to Input component to support search bars (by [melcherry98](https://github.com/melcherry98) in [#324](https://github.com/puppetlabs/design-system/pull/324)) -- [Icon] Add "scan" and "pencil-list" icons (by [Ioannis-Karasavvaidis](https://github.com/Ioannis-Karasavvaidis) in [#329](https://github.com/puppetlabs/design-system/pull/329)) -- [Alert] Change icon for "danger" Alert (by [eliely](https://github.com/eliely) in [#320](https://github.com/puppetlabs/design-system/pull/320)) -- [Copy] Properly export Copy component (by [sprokusk](https://github.com/sprokusk) in [#322](https://github.com/puppetlabs/design-system/pull/322)) -- [Form] Relax Form.Field `description` prop type (by [vine77](https://github.com/vine77) in [#305](https://github.com/puppetlabs/design-system/pull/305)) +- [Input] Add size and shape props to Input component to support search bars (by [@melcherry98](https://github.com/melcherry98) in [#324](https://github.com/puppetlabs/design-system/pull/324)) +- [Icon] Add "scan" and "pencil-list" icons (by [@Ioannis-Karasavvaidis](https://github.com/Ioannis-Karasavvaidis) in [#329](https://github.com/puppetlabs/design-system/pull/329)) +- [Alert] Change icon for "danger" Alert (by [@eliely](https://github.com/eliely) in [#320](https://github.com/puppetlabs/design-system/pull/320)) +- [Copy] Properly export Copy component (by [@sprokusk](https://github.com/sprokusk) in [#322](https://github.com/puppetlabs/design-system/pull/322)) +- [Form] Relax Form.Field `description` prop type (by [@vine77](https://github.com/vine77) in [#305](https://github.com/puppetlabs/design-system/pull/305)) # data-grid 0.5.0 (2020-10-07) From 17088d68ca67d4be7d914846a73fe4d8e9fabbcc Mon Sep 17 00:00:00 2001 From: Nathan Ward Date: Mon, 2 Nov 2020 23:12:24 -0800 Subject: [PATCH 15/16] Update test.yml --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5549a0c7b..088c90073 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,9 @@ name: Test on: push: + branches: [development, master] pull_request: + branches-ignore: [development, master] # TODO: See if the following event can be used to get tests running on PRs from forks. Note that we would have to change the git context from the base to the PR with actions/checkout. # pull_request_target: # types: [opened, reopened, synchronize] From 1c63c7cc69222a03e1fdac1363e178c92aae592d Mon Sep 17 00:00:00 2001 From: Nathan Ward Date: Mon, 2 Nov 2020 23:14:34 -0800 Subject: [PATCH 16/16] Bump version --- packages/react-components/package-lock.json | 2 +- packages/react-components/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/react-components/package-lock.json b/packages/react-components/package-lock.json index 0393c0ef0..b50b129ef 100644 --- a/packages/react-components/package-lock.json +++ b/packages/react-components/package-lock.json @@ -1,6 +1,6 @@ { "name": "@puppet/react-components", - "version": "5.24.3", + "version": "5.25.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/react-components/package.json b/packages/react-components/package.json index 5e4eb0219..c667945b1 100644 --- a/packages/react-components/package.json +++ b/packages/react-components/package.json @@ -1,6 +1,6 @@ { "name": "@puppet/react-components", - "version": "5.24.3", + "version": "5.25.0", "author": "Puppet, Inc.", "license": "Apache-2.0", "main": "build/library.js",