Skip to content

Commit 3b440f1

Browse files
authored
Merge branch 'main' into 19228-controlled-tag
2 parents d4acbe9 + cd03c8a commit 3b440f1

File tree

37 files changed

+682
-492
lines changed

37 files changed

+682
-492
lines changed

.all-contributorsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1857,6 +1857,15 @@
18571857
"contributions": [
18581858
"code"
18591859
]
1860+
},
1861+
{
1862+
"login": "Code-Suji",
1863+
"name": "SUJITH C S",
1864+
"avatar_url": "https://avatars.githubusercontent.com/u/43125517?v=4",
1865+
"profile": "https://www.linkedin.com/in/sujithcs",
1866+
"contributions": [
1867+
"code"
1868+
]
18601869
}
18611870
],
18621871
"commitConvention": "none"

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ jobs:
2424

2525
# Initializes the CodeQL tools for scanning.
2626
- name: Initialize CodeQL
27-
uses: github/codeql-action/init@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
27+
uses: github/codeql-action/init@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17
2828
with:
2929
languages: javascript-typescript
3030
config: |
3131
paths-ignore:
3232
- 'packages/cli/src/component/templates/**'
3333
3434
- name: Perform CodeQL Analysis
35-
uses: github/codeql-action/analyze@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
35+
uses: github/codeql-action/analyze@60168efe1c415ce0f5521ea06d5c2062adbeed1b # v3.28.17

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ check out our [Contributing Guide](/.github/CONTRIBUTING.md) and our
337337
<td align="center"><a href="https://github.com/warrenmblood"><img src="https://avatars.githubusercontent.com/u/69060697?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Warren Blood</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=warrenmblood" title="Code">💻</a></td>
338338
<td align="center"><a href="https://github.com/vcherneny"><img src="https://avatars.githubusercontent.com/u/11604315?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Vlad Cherneny</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=vcherneny" title="Code">💻</a></td>
339339
<td align="center"><a href="https://github.com/murito"><img src="https://avatars.githubusercontent.com/u/2628140?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Francisco Alcalá</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=murito" title="Code">💻</a></td>
340+
<td align="center"><a href="https://www.linkedin.com/in/sujithcs"><img src="https://avatars.githubusercontent.com/u/43125517?v=4?s=100" width="100px;" alt=""/><br /><sub><b>SUJITH C S</b></sub></a><br /><a href="https://github.com/carbon-design-system/carbon/commits?author=Code-Suji" title="Code">💻</a></td>
340341
</tr>
341342
</table>
342343

docs/experimental-code.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ All breaking changes will be shipped as `enable-v12-*` flags within the current
101101
major release (v11). This enables projects to opt-in to breaking changes earlier
102102
and at their own pace avoiding one huge changeset when upgrading to the next
103103
major release. In theory, if all `enable-v12-*` flags are enabled within your
104-
project before the v12 release, no changes should need to be made when updating
105-
to v12.
104+
project before the v12 release, no changes should need to be made to the
105+
affected components when updating to v12.
106106

107107
For a flag to be committed to a release and renamed to `enable-v#-*` it must:
108108

docs/release-schedule.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,32 @@ major versions of the Carbon Design System.
88
| `main` | unstable | unstable | unstable | unstable | unstable |
99
| v9 | End of life | 2018-06-04 | 2018-06-04 | 2019-03-29 | 2022-03-31 |
1010
| v10 | End of life | 2019-03-29 | 2019-03-29 | 2022-03-31 | 2024-09-30 |
11-
| v11 | Active | 2021-08-06 | 2022-03-31 | 2026-03-31 | 2028-03-31 |
12-
| v12 | Unreleased | 2025-08-01 | 2026-03-31 | 2028-03-31 | 2029-03-31 |
11+
| v11 | Active | 2021-08-06 | 2022-03-31 | TBD | TBD |
12+
| v12 | Preview | 2023-05-25 | TBD | TBD | TBD |
1313

1414
> Dates are subject to change
1515
16-
![schedule](https://github.com/carbon-design-system/carbon/assets/3360588/b8014b83-a743-4ace-83a3-ff1c96eef194)
16+
![schedule](https://github.com/user-attachments/assets/bc5ccd5a-8781-4ba5-9024-2aaaf0a53121)
1717

1818
## Release phases
1919

20+
### Preview
21+
22+
The preview phase allows consumers to incrementally opt in to changes that will
23+
be present in the next major, but through the current active release. This phase
24+
begins when the first feature flag is "committed" to be on-by-default in a
25+
future major version.
26+
27+
Once committed, flag names contain the version they've been committed to with
28+
the prefix `enable-v#-*`. At this point the API or functionality behind this
29+
flag is now fixed and won't change. We intend to ship this flag as "on by
30+
default" in the major version indicated in the name. e.g.
31+
`enable-v12-tile-default-icons`
32+
33+
In theory, if all `enable-v12-*` flags are enabled within your project before
34+
the v12 release, no changes should need to be made to the affected components
35+
when updating to v12.
36+
2037
### Prerelease
2138

2239
The prerelease phase is intended to be the opportunity for early adopters,

packages/react/src/components/Breadcrumb/Breadcrumb.tsx

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
/**
2-
* Copyright IBM Corp. 2016, 2023
2+
* Copyright IBM Corp. 2016, 2025
33
*
44
* This source code is licensed under the Apache-2.0 license found in the
55
* LICENSE file in the root directory of this source tree.
66
*/
77

88
import PropTypes from 'prop-types';
9-
import React, { PropsWithChildren } from 'react';
9+
import React, { forwardRef } from 'react';
1010
import cx from 'classnames';
1111
import { usePrefix } from '../../internal/usePrefix';
12-
import { ForwardRefReturn } from '../../types/common';
1312

1413
export interface BreadcrumbProps extends React.HTMLAttributes<HTMLElement> {
1514
/**
@@ -34,36 +33,33 @@ export interface BreadcrumbProps extends React.HTMLAttributes<HTMLElement> {
3433
size?: 'sm' | 'md';
3534
}
3635

37-
const Breadcrumb: ForwardRefReturn<HTMLElement, BreadcrumbProps> =
38-
React.forwardRef(function Breadcrumb(
39-
{
40-
'aria-label': ariaLabel,
41-
children,
42-
className: customClassNameNav,
43-
noTrailingSlash,
44-
size,
45-
...rest
46-
}: PropsWithChildren<BreadcrumbProps>,
47-
ref: React.Ref<HTMLElement>
48-
) {
49-
const prefix = usePrefix();
50-
const className = cx({
51-
[`${prefix}--breadcrumb`]: true,
52-
[`${prefix}--breadcrumb--no-trailing-slash`]: noTrailingSlash,
53-
[`${prefix}--breadcrumb--sm`]: size === 'sm',
54-
});
55-
56-
return (
57-
<nav
58-
className={customClassNameNav}
59-
aria-label={ariaLabel ? ariaLabel : 'Breadcrumb'}
60-
ref={ref}
61-
{...rest}>
62-
<ol className={className}>{children}</ol>
63-
</nav>
64-
);
36+
const Breadcrumb = forwardRef<HTMLElement, BreadcrumbProps>((props, ref) => {
37+
const {
38+
'aria-label': ariaLabel,
39+
children,
40+
className: customClassNameNav,
41+
noTrailingSlash,
42+
size,
43+
...rest
44+
} = props;
45+
const prefix = usePrefix();
46+
const className = cx({
47+
[`${prefix}--breadcrumb`]: true,
48+
[`${prefix}--breadcrumb--no-trailing-slash`]: noTrailingSlash,
49+
[`${prefix}--breadcrumb--sm`]: size === 'sm',
6550
});
6651

52+
return (
53+
<nav
54+
className={customClassNameNav}
55+
aria-label={ariaLabel ? ariaLabel : 'Breadcrumb'}
56+
ref={ref}
57+
{...rest}>
58+
<ol className={className}>{children}</ol>
59+
</nav>
60+
);
61+
});
62+
6763
Breadcrumb.displayName = 'Breadcrumb';
6864
Breadcrumb.propTypes = {
6965
/**

packages/react/src/components/Breadcrumb/BreadcrumbItem.tsx

Lines changed: 64 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
/**
2-
* Copyright IBM Corp. 2016, 2023
2+
* Copyright IBM Corp. 2016, 2025
33
*
44
* This source code is licensed under the Apache-2.0 license found in the
55
* LICENSE file in the root directory of this source tree.
66
*/
77

88
import PropTypes from 'prop-types';
9-
import React, { AriaAttributes, PropsWithChildren } from 'react';
9+
import React, { forwardRef, type AriaAttributes } from 'react';
1010
import cx from 'classnames';
1111
import Link from '../Link';
1212
import { OverflowMenuHorizontal } from '@carbon/icons-react';
1313
import { usePrefix } from '../../internal/usePrefix';
14-
import { ForwardRefReturn } from '../../types/common';
1514
import { Text } from '../Text';
1615

1716
export interface BreadcrumbItemProps
@@ -34,75 +33,74 @@ export interface BreadcrumbItemProps
3433
isCurrentPage?: boolean;
3534
}
3635

37-
const BreadcrumbItem: ForwardRefReturn<HTMLLIElement, BreadcrumbItemProps> =
38-
React.forwardRef(function BreadcrumbItem(
39-
{
40-
'aria-current': ariaCurrent,
41-
children,
42-
className: customClassName = '',
43-
href,
44-
isCurrentPage,
45-
...rest
46-
}: PropsWithChildren<BreadcrumbItemProps>,
47-
ref: React.Ref<HTMLLIElement>
48-
) {
49-
const prefix = usePrefix();
50-
const className = cx({
51-
[`${prefix}--breadcrumb-item`]: true,
52-
// We set the current class only if `isCurrentPage` is passed in and we do
53-
// not have an `aria-current="page"` set for the breadcrumb item
54-
[`${prefix}--breadcrumb-item--current`]:
55-
isCurrentPage && ariaCurrent !== 'page',
56-
[customClassName]: !!customClassName,
57-
});
58-
59-
const child = children as React.FunctionComponentElement<any>;
60-
if (
61-
child.type &&
62-
child.type.displayName !== undefined &&
63-
child.type.displayName.includes('OverflowMenu')
64-
) {
65-
const horizontalOverflowIcon = (
66-
<OverflowMenuHorizontal className={`${prefix}--overflow-menu__icon`} />
67-
);
68-
return (
69-
<li className={className} {...rest}>
70-
{React.cloneElement(child, {
71-
menuOptionsClass: `${prefix}--breadcrumb-menu-options`,
72-
menuOffset: { top: 10, left: 59 },
73-
renderIcon: () => horizontalOverflowIcon,
74-
})}
75-
</li>
76-
);
77-
}
78-
79-
if (typeof children === 'string') {
80-
return (
81-
<li className={className} ref={ref} {...rest}>
82-
{href ? (
83-
<Link href={href} aria-current={ariaCurrent || isCurrentPage}>
84-
{children}
85-
</Link>
86-
) : (
87-
<Text
88-
aria-current={ariaCurrent || isCurrentPage}
89-
className={`${prefix}--link`}>
90-
{children}
91-
</Text>
92-
)}
93-
</li>
94-
);
95-
}
36+
const frFn = forwardRef<HTMLLIElement, BreadcrumbItemProps>;
37+
38+
const BreadcrumbItem = frFn((props, ref) => {
39+
const {
40+
'aria-current': ariaCurrent,
41+
children,
42+
className: customClassName = '',
43+
href,
44+
isCurrentPage,
45+
...rest
46+
} = props;
47+
const prefix = usePrefix();
48+
const className = cx({
49+
[`${prefix}--breadcrumb-item`]: true,
50+
// We set the current class only if `isCurrentPage` is passed in and we do
51+
// not have an `aria-current="page"` set for the breadcrumb item
52+
[`${prefix}--breadcrumb-item--current`]:
53+
isCurrentPage && ariaCurrent !== 'page',
54+
[customClassName]: !!customClassName,
55+
});
9656

57+
const child = children as React.FunctionComponentElement<any>;
58+
if (
59+
child.type &&
60+
child.type.displayName !== undefined &&
61+
child.type.displayName.includes('OverflowMenu')
62+
) {
63+
const horizontalOverflowIcon = (
64+
<OverflowMenuHorizontal className={`${prefix}--overflow-menu__icon`} />
65+
);
9766
return (
98-
<li className={className} ref={ref} {...rest}>
67+
<li className={className} {...rest}>
9968
{React.cloneElement(child, {
100-
'aria-current': ariaCurrent,
101-
className: cx(`${prefix}--link`, child.props.className),
69+
menuOptionsClass: `${prefix}--breadcrumb-menu-options`,
70+
menuOffset: { top: 10, left: 59 },
71+
renderIcon: () => horizontalOverflowIcon,
10272
})}
10373
</li>
10474
);
105-
});
75+
}
76+
77+
if (typeof children === 'string') {
78+
return (
79+
<li className={className} ref={ref} {...rest}>
80+
{href ? (
81+
<Link href={href} aria-current={ariaCurrent || isCurrentPage}>
82+
{children}
83+
</Link>
84+
) : (
85+
<Text
86+
aria-current={ariaCurrent || isCurrentPage}
87+
className={`${prefix}--link`}>
88+
{children}
89+
</Text>
90+
)}
91+
</li>
92+
);
93+
}
94+
95+
return (
96+
<li className={className} ref={ref} {...rest}>
97+
{React.cloneElement(child, {
98+
'aria-current': ariaCurrent,
99+
className: cx(`${prefix}--link`, child.props.className),
100+
})}
101+
</li>
102+
);
103+
});
106104

107105
BreadcrumbItem.displayName = 'BreadcrumbItem';
108106

packages/react/src/components/ButtonSet/ButtonSet.tsx

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
/**
2-
* Copyright IBM Corp. 2016, 2023
2+
* Copyright IBM Corp. 2016, 2025
33
*
44
* This source code is licensed under the Apache-2.0 license found in the
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
import React from 'react';
8+
import React, { forwardRef } from 'react';
99
import PropTypes from 'prop-types';
1010
import classNames from 'classnames';
1111
import { usePrefix } from '../../internal/usePrefix';
12-
import { ForwardRefReturn } from '../../types/common';
1312

1413
export interface ButtonSetProps extends React.HTMLAttributes<HTMLDivElement> {
1514
/**
@@ -19,21 +18,18 @@ export interface ButtonSetProps extends React.HTMLAttributes<HTMLDivElement> {
1918
stacked?: boolean;
2019
}
2120

22-
const ButtonSet: ForwardRefReturn<HTMLDivElement, ButtonSetProps> =
23-
React.forwardRef(function ButtonSet(
24-
{ children, className, stacked, ...rest }: ButtonSetProps,
25-
ref: React.Ref<HTMLDivElement>
26-
) {
27-
const prefix = usePrefix();
28-
const buttonSetClasses = classNames(className, `${prefix}--btn-set`, {
29-
[`${prefix}--btn-set--stacked`]: stacked,
30-
});
31-
return (
32-
<div {...rest} className={buttonSetClasses} ref={ref}>
33-
{children}
34-
</div>
35-
);
21+
const ButtonSet = forwardRef<HTMLDivElement, ButtonSetProps>((props, ref) => {
22+
const { children, className, stacked, ...rest } = props;
23+
const prefix = usePrefix();
24+
const buttonSetClasses = classNames(className, `${prefix}--btn-set`, {
25+
[`${prefix}--btn-set--stacked`]: stacked,
3626
});
27+
return (
28+
<div {...rest} className={buttonSetClasses} ref={ref}>
29+
{children}
30+
</div>
31+
);
32+
});
3733

3834
ButtonSet.displayName = 'ButtonSet';
3935
ButtonSet.propTypes = {

packages/react/src/components/CodeSnippet/CodeSnippet.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { ChevronDown } from '@carbon/icons-react';
1919
import Copy from '../Copy';
2020
import Button from '../Button';
2121
import CopyButton from '../CopyButton';
22-
import getUniqueId from '../../tools/uniqueId';
22+
import { uniqueId } from '../../tools/uniqueId';
2323
import copy from 'copy-to-clipboard';
2424
import deprecate from '../../prop-types/deprecate';
2525
import { usePrefix } from '../../internal/usePrefix';
@@ -202,7 +202,7 @@ function CodeSnippet({
202202
}: PropsWithChildren<CodeSnippetProps>) {
203203
const [expandedCode, setExpandedCode] = useState(false);
204204
const [shouldShowMoreLessBtn, setShouldShowMoreLessBtn] = useState(false);
205-
const { current: uid } = useRef(getUniqueId());
205+
const { current: uid } = useRef(uniqueId());
206206
const codeContentRef = useRef<HTMLPreElement>(null);
207207
const codeContainerRef = useRef<HTMLDivElement>(null);
208208
const innerCodeRef = useRef<HTMLElement>(null);

0 commit comments

Comments
 (0)