diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md
index 70fbd64b380c6..11650effa7402 100644
--- a/packages/components/CHANGELOG.md
+++ b/packages/components/CHANGELOG.md
@@ -15,6 +15,7 @@
- `CustomSelectControlV2`: add root element wrapper. ([#62803](https://github.com/WordPress/gutenberg/pull/62803))
- `CustomSelectControlV2`: fix popover styles. ([#62821](https://github.com/WordPress/gutenberg/pull/62821))
- `CustomSelectControlV2`: fix trigger text alignment in RTL languages ([#62869](https://github.com/WordPress/gutenberg/pull/62869)).
+- `CustomSelectControlV2`: allow wrapping item hint to new line ([#62848](https://github.com/WordPress/gutenberg/pull/62848)).
- `CustomSelectControlV2`: fix select popover content overflow. ([#62844](https://github.com/WordPress/gutenberg/pull/62844))
- Extract `TimeInput` component from `TimePicker` ([#60613](https://github.com/WordPress/gutenberg/pull/60613)).
diff --git a/packages/components/src/custom-select-control-v2/legacy-component/index.tsx b/packages/components/src/custom-select-control-v2/legacy-component/index.tsx
index 242c264eafc67..d12d1d1e7e87a 100644
--- a/packages/components/src/custom-select-control-v2/legacy-component/index.tsx
+++ b/packages/components/src/custom-select-control-v2/legacy-component/index.tsx
@@ -64,12 +64,15 @@ function CustomSelectControl( props: LegacyCustomSelectProps ) {
const children = options.map(
( { name, key, __experimentalHint, style, className } ) => {
const withHint = (
-
+
{ name }
-
+
{ __experimentalHint }
-
-
+
+
);
return (
@@ -78,7 +81,15 @@ function CustomSelectControl( props: LegacyCustomSelectProps ) {
value={ name }
children={ __experimentalHint ? withHint : name }
style={ style }
- className={ className }
+ className={ clsx(
+ // TODO: Legacy classname. Add V1 styles are removed from the codebase
+ // 'components-custom-select-control__item',
+ className
+ // TODO: Legacy classname. Add V1 styles are removed from the codebase
+ // {
+ // 'has-hint': __experimentalHint,
+ // }
+ ) }
/>
);
}
@@ -94,7 +105,10 @@ function CustomSelectControl( props: LegacyCustomSelectProps ) {
return (
{ currentValue }
-
+
{ currentHint?.__experimentalHint }
@@ -125,7 +139,8 @@ function CustomSelectControl( props: LegacyCustomSelectProps ) {
size={ translatedSize }
store={ store }
className={ clsx(
- 'components-custom-select-control',
+ // TODO: Legacy classname. Add V1 styles are removed from the codebase
+ // 'components-custom-select-control',
classNameProp
) }
isLegacy
diff --git a/packages/components/src/custom-select-control-v2/styles.ts b/packages/components/src/custom-select-control-v2/styles.ts
index f4356c13af528..d432ac5e06ab6 100644
--- a/packages/components/src/custom-select-control-v2/styles.ts
+++ b/packages/components/src/custom-select-control-v2/styles.ts
@@ -15,37 +15,10 @@ import type { CustomSelectButtonSize } from './types';
const ITEM_PADDING = space( 2 );
-const truncateStyles = css`
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-`;
-
-export const WithHintWrapper = styled.div`
- display: flex;
- justify-content: space-between;
- flex: 1;
-`;
-
-export const SelectedExperimentalHintWrapper = styled.div`
- ${ truncateStyles }
-`;
-
-export const SelectedExperimentalHintItem = styled.span`
- color: ${ COLORS.theme.gray[ 600 ] };
- margin-inline-start: ${ space( 2 ) };
-`;
-
-export const ExperimentalHintItem = styled.span`
- color: ${ COLORS.theme.gray[ 600 ] };
- text-align: right;
- margin-inline-end: ${ space( 1 ) };
-`;
-
export const SelectLabel = styled( Ariakit.SelectLabel )`
font-size: 11px;
font-weight: 500;
- line-height: 1.4;
+ line-height: ${ CONFIG.fontLineHeightBase };
text-transform: uppercase;
margin-bottom: ${ space( 2 ) };
`;
@@ -129,6 +102,7 @@ export const SelectPopover = styled( Ariakit.SelectPopover )`
`;
export const SelectItem = styled( Ariakit.SelectItem )`
+ cursor: default;
display: flex;
align-items: center;
justify-content: space-between;
@@ -154,3 +128,35 @@ export const SelectedItemCheck = styled( Ariakit.SelectItemCheck )`
margin-inline-start: ${ ITEM_PADDING };
font-size: 24px; // Size of checkmark icon
`;
+
+const truncateStyles = css`
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+`;
+
+export const SelectedExperimentalHintWrapper = styled.div`
+ ${ truncateStyles }
+`;
+
+export const SelectedExperimentalHintItem = styled.span`
+ color: ${ COLORS.theme.gray[ 600 ] };
+ margin-inline-start: ${ space( 2 ) };
+`;
+
+export const WithHintItemWrapper = styled.div`
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ flex-wrap: wrap;
+ flex: 1;
+ column-gap: ${ space( 4 ) };
+`;
+
+export const WithHintItemHint = styled.span`
+ color: ${ COLORS.theme.gray[ 600 ] };
+ text-align: initial;
+ line-height: ${ CONFIG.fontLineHeightBase };
+ padding-inline-end: ${ space( 1 ) };
+ margin-block: ${ space( 1 ) };
+`;