Skip to content

Commit aef0e73

Browse files
authored
Merge branch 'main' into innerRef-overflow-fix
2 parents 71ae07c + 517562c commit aef0e73

File tree

16 files changed

+194
-206
lines changed

16 files changed

+194
-206
lines changed

.all-contributorsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,6 +1771,15 @@
17711771
"review"
17721772
]
17731773
},
1774+
{
1775+
"login": "nchevsky",
1776+
"name": "Nick Chevsky",
1777+
"avatar_url": "https://avatars.githubusercontent.com/u/3987849?v=4",
1778+
"profile": "https://github.com/nchevsky",
1779+
"contributions": [
1780+
"code"
1781+
]
1782+
},
17741783
{
17751784
"login": "Tweakified",
17761785
"name": "Daniel Smith",

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ check out our [Contributing Guide](/.github/CONTRIBUTING.md) and our
326326
<td align="center"><a href="https://github.com/a88zach"><img src="https://avatars.githubusercontent.com/u/1724822?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Zach Tindall</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=a88zach" title="Code">💻</a></td>
327327
<td align="center"><a href="https://github.com/vsvsv"><img src="https://avatars.githubusercontent.com/u/9214692?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vsevolod Platunov</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=vsvsv" title="Code">💻</a></td>
328328
<td align="center"><a href="https://github.com/heloiselui"><img src="https://avatars.githubusercontent.com/u/71858203?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Heloise Lui</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=heloiselui" title="Code">💻</a> <a href="https://github.com/carbon-design-system/carbon/commits?author=heloiselui" title="Documentation">📖</a> <a href="#a11y-heloiselui" title="Accessibility">️️️️♿️</a> <a href="https://github.com/carbon-design-system/carbon/pulls?q=is%3Apr+reviewed-by%3Aheloiselui" title="Reviewed Pull Requests">👀</a></td>
329+
<td align="center"><a href="https://github.com/nchevsky"><img src="https://avatars.githubusercontent.com/u/3987849?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Nick Chevsky</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=nchevsky" title="Code">💻</a></td>
329330
<td align="center"><a href="https://github.com/Tweakified"><img src="https://avatars.githubusercontent.com/u/58192912?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Daniel Smith</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=Tweakified" title="Code">💻</a> <a href="#a11y-Tweakified" title="Accessibility">️️️️♿️</a> <a href="https://github.com/carbon-design-system/carbon/commits?author=Tweakified" title="Documentation">📖</a></td>
330331
<td align="center"><a href="https://github.com/enricobguedes"><img src="https://avatars.githubusercontent.com/u/45374536?v=4?s=100" width="100px;" alt=""/><br /><sub><b>enricobguedes</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=enricobguedes" title="Code">💻</a></td>
331332
<td align="center"><a href="https://github.com/gdelory"><img src="https://avatars.githubusercontent.com/u/9974707?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Guillaume Delory</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=gdelory" title="Code">💻</a></td>

packages/cli/src/commands/inline.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ async function inlineSassDependencies(
124124
await replace({
125125
files: file.path,
126126
from: REPLACE_REGEX,
127+
glob: { windowsPathsNoEscape: true },
127128
to(_, match) {
128129
return `@import '${
129130
isWin ? relativeImportPath.replace('\\', '/') : relativeImportPath

packages/react/src/components/OverflowMenu/OverflowMenu.tsx

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import { OverflowMenuVertical } from '@carbon/icons-react';
2626
import classNames from 'classnames';
2727
import invariant from 'invariant';
2828
import PropTypes from 'prop-types';
29-
import { ClickListener } from '../../internal/ClickListener';
3029
import {
3130
DIRECTION_BOTTOM,
3231
DIRECTION_TOP,
@@ -41,6 +40,7 @@ import deprecate from '../../prop-types/deprecate';
4140
import mergeRefs from '../../tools/mergeRefs';
4241
import setupGetInstanceId from '../../tools/setupGetInstanceId';
4342
import { IconButton } from '../IconButton';
43+
import { useOutsideClick } from '../../internal/useOutsideClick';
4444

4545
const getInstanceId = setupGetInstanceId();
4646

@@ -277,6 +277,7 @@ export const OverflowMenu = forwardRef<HTMLButtonElement, OverflowMenuProps>(
277277
const prevOpenState = useRef(open);
278278
/** The element ref of the tooltip's trigger button. */
279279
const triggerRef = useRef<HTMLButtonElement>(null);
280+
const wrapperRef = useRef<HTMLSpanElement>(null);
280281

281282
// Sync open prop changes.
282283
useEffect(() => {
@@ -301,6 +302,16 @@ export const OverflowMenu = forwardRef<HTMLButtonElement, OverflowMenuProps>(
301302
prevOpenState.current = open;
302303
}, [open, onClose]);
303304

305+
useOutsideClick(wrapperRef, ({ target }) => {
306+
if (
307+
open &&
308+
(!menuBodyRef.current ||
309+
(target instanceof Node && !menuBodyRef.current.contains(target)))
310+
) {
311+
closeMenu();
312+
}
313+
});
314+
304315
const focusMenuEl = useCallback(() => {
305316
if (triggerRef.current) {
306317
triggerRef.current.focus();
@@ -371,17 +382,6 @@ export const OverflowMenu = forwardRef<HTMLButtonElement, OverflowMenuProps>(
371382
}
372383
};
373384

374-
const handleClickOutside = (evt: globalThis.MouseEvent) => {
375-
if (
376-
open &&
377-
(!menuBodyRef.current ||
378-
(evt.target instanceof Node &&
379-
!menuBodyRef.current.contains(evt.target)))
380-
) {
381-
closeMenu();
382-
}
383-
};
384-
385385
/**
386386
* Focuses the next enabled overflow menu item given the currently focused
387387
* item index and direction to move.
@@ -550,10 +550,11 @@ export const OverflowMenu = forwardRef<HTMLButtonElement, OverflowMenuProps>(
550550
: mergeRefs(triggerRef, ref);
551551

552552
return (
553-
<ClickListener onClickOutside={handleClickOutside}>
553+
<>
554554
<span
555555
className={`${prefix}--overflow-menu__wrapper`}
556-
aria-owns={open ? menuBodyId : undefined}>
556+
aria-owns={open ? menuBodyId : undefined}
557+
ref={wrapperRef}>
557558
<IconButton
558559
{...other}
559560
type="button"
@@ -574,7 +575,7 @@ export const OverflowMenu = forwardRef<HTMLButtonElement, OverflowMenuProps>(
574575
</IconButton>
575576
{open && hasMountedTrigger && wrappedMenuBody}
576577
</span>
577-
</ClickListener>
578+
</>
578579
);
579580
}
580581
);

packages/react/src/components/Tooltip/story.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,7 @@
4747
.sb-definition-tooltip p {
4848
@include type.type-style('body-short-02');
4949
}
50+
51+
.cds--tooltip-content {
52+
overflow-wrap: break-word;
53+
}

packages/react/src/internal/ClickListener.ts

Lines changed: 0 additions & 64 deletions
This file was deleted.

packages/react/src/internal/__tests__/ClickListener-test.js

Lines changed: 0 additions & 63 deletions
This file was deleted.

packages/react/src/internal/__tests__/__snapshots__/ClickListener-test.js.snap

Lines changed: 0 additions & 18 deletions
This file was deleted.

packages/web-components/examples/components/layer/index.html

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,8 @@
99
<head>
1010
<title>carbon-web-components example</title>
1111
<meta charset="UTF-8" />
12-
12+
1313
<link rel="stylesheet" href="src/styles.scss" />
14-
<style>
15-
.example-layer-test-component {
16-
padding: 1rem;
17-
}
18-
</style>
1914
<script type="module" src="src/index.js"></script>
2015
</head>
2116
<body>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
@use '@carbon/styles/scss/reset';
22
@use '@carbon/styles/scss/theme';
33
@use '@carbon/styles/scss/themes';
4+
@use '@carbon/styles/scss/spacing';
45

56
:root {
67
@include theme.theme(themes.$white);
78
background-color: var(--cds-background);
89
color: var(--cds-text-primary);
910
}
11+
12+
.example-layer-test-component {
13+
padding: spacing.$spacing-05;
14+
background: theme.$layer;
15+
}

packages/web-components/src/components/inline-loading/inline-loading.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ import '@carbon/web-components/es/components/inline-loading/index.js';
4242
<cds-inline-loading status="active">Loading data...</cds-inline-loading>
4343
```
4444

45-
## `<cds-inline-loading>` attributes and properties
45+
## `<cds-inline-loading>` attributes, properties and events
4646

4747
<ArgTypes of="cds-inline-loading" />

0 commit comments

Comments
 (0)