Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/packages/react/examp…
Browse files Browse the repository at this point in the history
…les/custom-css-prefix/url-parse-1.5.3
  • Loading branch information
kodiakhq[bot] authored Oct 7, 2021
2 parents bfe03ce + 269867c commit d6203a4
Show file tree
Hide file tree
Showing 24 changed files with 111 additions and 68 deletions.
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,15 @@
"contributions": [
"code"
]
},
{
"login": "ColbyJohnIBM",
"name": "ColbyJohnIBM",
"avatar_url": "https://avatars.githubusercontent.com/u/19613692?v=4",
"profile": "https://github.com/ColbyJohnIBM",
"contributions": [
"code"
]
}
],
"commitConvention": "none"
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ check out our [Contributing Guide](/.github/CONTRIBUTING.md) and our
<td align="center"><a href="https://github.com/adamalston"><img src="https://avatars.githubusercontent.com/u/18297826?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Adam Alston</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=adamalston" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/Kiittyka"><img src="https://avatars.githubusercontent.com/u/41021851?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Krithika S Udupa</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=Kiittyka" title="Documentation">📖</a></td>
<td align="center"><a href="https://github.com/egriff38"><img src="https://avatars.githubusercontent.com/u/6627718?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Eshin Griffith</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=egriff38" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/ColbyJohnIBM"><img src="https://avatars.githubusercontent.com/u/19613692?v=4?s=100" width="100px;" alt=""/><br /><sub><b>ColbyJohnIBM</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=ColbyJohnIBM" title="Code">💻</a></td>
</tr>
</table>

Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/globals/scss/_helper-mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
/// @example @include box-shadow;
/// @group global-helpers
@mixin box-shadow {
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
box-shadow: 0 2px 6px $shadow;
}

/// Adds outline styles depending on specific type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ Array [
"scale",
"selectedLightUI",
"selectedUI",
"shadow",
"size2XLarge",
"sizeLarge",
"sizeMedium",
Expand Down
46 changes: 19 additions & 27 deletions packages/react/src/components/Modal/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,32 +451,6 @@ export default class Modal extends Component {
alertDialogProps['aria-describedby'] = this.modalBodyId;
}

const SecondaryButtonSet = () => {
if (Array.isArray(secondaryButtons) && secondaryButtons.length <= 2) {
return secondaryButtons.map(
({ buttonText, onClick: onButtonClick }, i) => (
<Button
key={`${buttonText}-${i}`}
kind="secondary"
onClick={onButtonClick}>
{buttonText}
</Button>
)
);
}
if (secondaryButtonText) {
return (
<Button
kind="secondary"
onClick={onSecondaryButtonClick}
ref={this.secondaryButton}>
{secondaryButtonText}
</Button>
);
}
return null;
};

const modalBody = (
<div
ref={this.innerModal}
Expand Down Expand Up @@ -514,7 +488,25 @@ export default class Modal extends Component {
)}
{!passiveModal && (
<ButtonSet className={footerClasses}>
<SecondaryButtonSet />
{Array.isArray(secondaryButtons) && secondaryButtons.length <= 2
? secondaryButtons.map(
({ buttonText, onClick: onButtonClick }, i) => (
<Button
key={`${buttonText}-${i}`}
kind="secondary"
onClick={onButtonClick}>
{buttonText}
</Button>
)
)
: secondaryButtonText && (
<Button
kind="secondary"
onClick={onSecondaryButtonClick}
ref={this.secondaryButton}>
{secondaryButtonText}
</Button>
)}
<Button
kind={danger ? 'danger' : 'primary'}
disabled={primaryButtonDisabled}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,36 +167,34 @@ exports[`ModalWrapper should render 1`] = `
<div
className="bx--modal-footer bx--btn-set"
>
<SecondaryButtonSet>
<Button
dangerDescription="danger"
<Button
dangerDescription="danger"
disabled={false}
isExpressive={false}
kind="secondary"
onClick={[Function]}
size="default"
tabIndex={0}
tooltipAlignment="center"
tooltipPosition="top"
type="button"
>
<button
aria-describedby={null}
aria-pressed={null}
className="bx--btn bx--btn--secondary"
disabled={false}
isExpressive={false}
kind="secondary"
onBlur={[Function]}
onClick={[Function]}
size="default"
onFocus={[Function]}
onMouseEnter={[Function]}
onMouseLeave={[Function]}
tabIndex={0}
tooltipAlignment="center"
tooltipPosition="top"
type="button"
>
<button
aria-describedby={null}
aria-pressed={null}
className="bx--btn bx--btn--secondary"
disabled={false}
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
onMouseEnter={[Function]}
onMouseLeave={[Function]}
tabIndex={0}
type="button"
>
Cancel
</button>
</Button>
</SecondaryButtonSet>
Cancel
</button>
</Button>
<Button
dangerDescription="danger"
disabled={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,15 @@ describe('OverflowMenu', () => {
);
});

it('fires onClick only once per button click', () => {
const mockOnClick = jest.fn();
const rootWrapper = mount(<OverflowMenu onClick={mockOnClick} />);

rootWrapper.find('button').simulate('click');

expect(mockOnClick).toHaveBeenCalledTimes(1);
});

it('should NOT toggle state in response to Enter or Space when the menu is open', () => {
const enterKey = 13;
const spaceKey = 32;
Expand Down
1 change: 1 addition & 0 deletions packages/react/src/components/OverflowMenu/OverflowMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ class OverflowMenu extends Component {
}

handleClick = (evt) => {
evt.stopPropagation();
if (!this._menuBody || !this._menuBody.contains(evt.target)) {
this.setState({ open: !this.state.open });
this.props.onClick(evt);
Expand Down
1 change: 1 addition & 0 deletions packages/styles/scss/__tests__/theme-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ Array [
"highlight",
"overlay",
"toggle-off",
"shadow",
"focus",
"focus-inset",
"focus-inverse",
Expand Down
4 changes: 3 additions & 1 deletion packages/styles/scss/utilities/_box-shadow.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
// LICENSE file in the root directory of this source tree.
//

@use '../theme';

/// Adds box shadow
/// @access public
/// @example @include box-shadow;
/// @group utilities
@mixin box-shadow {
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
box-shadow: 0 2px 6px theme.$shadow;
}
2 changes: 2 additions & 0 deletions packages/themes/src/g10.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {

// Constants
white,
black,

// Tools
rgba,
Expand Down Expand Up @@ -182,6 +183,7 @@ export const supportInfoInverse = inverseSupport04;

export const overlay = overlay01;
export const toggleOff = ui04;
export const shadow = rgba(black, 0.3);

export const buttonPrimary = interactive01;
export const buttonSecondary = interactive02;
Expand Down
4 changes: 3 additions & 1 deletion packages/themes/src/g100.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {

// Constants
white,
black,

// Tools
rgba,
Expand Down Expand Up @@ -86,7 +87,7 @@ export const inverseSupport02 = green50;
export const inverseSupport03 = yellow;
export const inverseSupport04 = blue60;

export const overlay01 = rgba(gray100, 0.7);
export const overlay01 = rgba(black, 0.65);

export const danger01 = red60;
export const danger02 = red50;
Expand Down Expand Up @@ -181,6 +182,7 @@ export const supportInfoInverse = inverseSupport04;

export const overlay = overlay01;
export const toggleOff = ui04;
export const shadow = rgba(black, 0.8);

export const buttonPrimary = interactive01;
export const buttonSecondary = interactive02;
Expand Down
4 changes: 3 additions & 1 deletion packages/themes/src/g80.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {

// Constants
white,
black,

// Tools
rgba,
Expand Down Expand Up @@ -86,8 +87,9 @@ export const supportSuccessInverse = green50;
export const supportWarningInverse = yellow30;
export const supportInfoInverse = blue60;

export const overlay = rgba(gray100, 0.7);
export const overlay = rgba(black, 0.65);
export const toggleOff = gray50;
export const shadow = rgba(black, 0.8);

export const buttonPrimary = blue60;
export const buttonSecondary = gray60;
Expand Down
4 changes: 3 additions & 1 deletion packages/themes/src/g90.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import {

// Constants
white,
black,

// Tools
rgba,
Expand Down Expand Up @@ -88,7 +89,7 @@ export const inverseSupport02 = green50;
export const inverseSupport03 = yellow;
export const inverseSupport04 = blue60;

export const overlay01 = rgba(gray100, 0.7);
export const overlay01 = rgba(black, 0.65);

export const danger01 = red60;
export const danger02 = red40;
Expand Down Expand Up @@ -183,6 +184,7 @@ export const supportInfoInverse = inverseSupport04;

export const overlay = overlay01;
export const toggleOff = ui04;
export const shadow = rgba(black, 0.8);

export const buttonPrimary = interactive01;
export const buttonSecondary = interactive02;
Expand Down
1 change: 1 addition & 0 deletions packages/themes/src/next/g10.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ export const interactive = blue60;
export const highlight = blue20;
export const overlay = 'rgba(22, 22, 22, 0.5)';
export const toggleOff = gray50;
export const shadow = 'rgba(0, 0, 0, 0.3)';

export {
// Type
Expand Down
7 changes: 6 additions & 1 deletion packages/themes/src/next/g100.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ import {

// Constants
white,
black,

// Tools
rgba,
} from '@carbon/colors';
import { adjustLightness } from '../tools';

Expand Down Expand Up @@ -193,8 +197,9 @@ export const skeletonElement = gray80;
// Misc
export const interactive = blue50;
export const highlight = blue20;
export const overlay = 'rgba(22, 22, 22, 0.5)';
export const overlay = rgba(black, 0.65);
export const toggleOff = gray50;
export const shadow = rgba(black, 0.8);

export {
// Type
Expand Down
7 changes: 6 additions & 1 deletion packages/themes/src/next/g90.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ import {

// Constants
white,
black,

// Tools
rgba,
} from '@carbon/colors';
import { adjustLightness } from '../tools';

Expand Down Expand Up @@ -192,8 +196,9 @@ export const skeletonElement = gray70;
// Misc
export const interactive = blue50;
export const highlight = blue70;
export const overlay = 'rgba(22, 22, 22, 0.7)';
export const overlay = rgba(black, 0.65);
export const toggleOff = gray50;
export const shadow = rgba(black, 0.8);

export {
// Type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ Array [
"highlight",
"overlay",
"toggle-off",
"shadow",
"focus",
"focus-inset",
"focus-inverse",
Expand Down
3 changes: 3 additions & 0 deletions packages/themes/src/next/tokens/v11TokenGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,9 @@ export const group = TokenGroup.create({
{
name: 'toggle-off',
},
{
name: 'shadow',
},

focus,
skeleton,
Expand Down
1 change: 1 addition & 0 deletions packages/themes/src/next/white.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ export const interactive = blue60;
export const highlight = blue20;
export const overlay = 'rgba(22, 22, 22, 0.5)';
export const toggleOff = gray50;
export const shadow = 'rgba(0, 0, 0, 0.3)';

// Type
export {
Expand Down
2 changes: 2 additions & 0 deletions packages/themes/src/tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ const colors = [

'overlay',
'toggleOff',
'shadow',

'buttonPrimary',
'buttonSecondary',
Expand Down Expand Up @@ -346,6 +347,7 @@ export const unstable__meta = {

'overlay',
'toggleOff',
'shadow',

'buttonPrimary',
'buttonSecondary',
Expand Down
Loading

0 comments on commit d6203a4

Please sign in to comment.