Skip to content

Commit 49ec4eb

Browse files
authored
Merge branch 'trunk' into fix/form-token-field-arrow-up-wrap
2 parents 2e62745 + 234d5f9 commit 49ec4eb

26 files changed

Lines changed: 769 additions & 379 deletions

File tree

‎packages/block-library/src/video/tracks-editor.jsx‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ import {
1414
__experimentalGrid as Grid,
1515
__experimentalHStack as HStack,
1616
__experimentalVStack as VStack,
17-
privateApis as componentsPrivateApis,
1817
} from '@wordpress/components';
18+
import { Badge } from '@wordpress/ui';
1919
import {
2020
MediaUpload,
2121
MediaUploadCheck,
@@ -25,9 +25,6 @@ import { upload, media } from '@wordpress/icons';
2525
import { useSelect } from '@wordpress/data';
2626
import { useState, useRef, useEffect } from '@wordpress/element';
2727
import { getFilename } from '@wordpress/url';
28-
import { unlock } from '../lock-unlock';
29-
30-
const { Badge: WCBadge } = unlock( componentsPrivateApis );
3128

3229
const ALLOWED_TYPES = [ 'text/vtt' ];
3330

@@ -58,7 +55,9 @@ function TrackList( { tracks, onEditPress } ) {
5855
>
5956
<span>{ track.label }</span>
6057
<HStack justify="flex-end">
61-
{ track.default && <WCBadge>{ __( 'Default' ) }</WCBadge> }
58+
{ track.default && (
59+
<Badge intent="none">{ __( 'Default' ) }</Badge>
60+
) }
6261
<Button
6362
__next40pxDefaultSize
6463
variant="tertiary"

‎packages/components/CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
### Bug Fixes
1616

1717
- `FormTokenField`: Wrap to the last suggestion when pressing the up arrow with no suggestion selected, instead of leaving the selection on an invalid index ([#82646](https://github.com/WordPress/gutenberg/pull/82646)).
18+
- `Disabled`: Keep the `className` passed by the consumer on the wrapper when `isDisabled` is `false`. Only `components-disabled` and the disabled styling are conditional now, so the wrapper stays styleable and targetable in both states ([#82648](https://github.com/WordPress/gutenberg/pull/82648)).
1819
- `ProgressBar`: Remove determinate transitions and use a slower, stepped indeterminate animation when reduced motion is preferred. ([#82490](https://github.com/WordPress/gutenberg/pull/82490))
1920
- `ColorPalette`: Apply the computed contrast color to the selected checkmark now that the icon is stroke-based. ([#78812](https://github.com/WordPress/gutenberg/pull/78812))
2021
- `CheckboxControl`: Color the checked and indeterminate icons with `color` rather than `fill`, so they stay visible now that those icons are stroke-based. ([#78812](https://github.com/WordPress/gutenberg/pull/78812))

‎packages/components/src/disabled/index.tsx‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ function Disabled( {
5959
<div
6060
// @ts-expect-error `inert` is not declared in React 18's HTML attribute types.
6161
inert={ isDisabled ? 'true' : undefined }
62+
// Only the disabled styling is conditional. The consumer's own
63+
// className has to stick around so the wrapper stays targetable
64+
// whether or not it is currently disabled.
6265
className={
63-
isDisabled
64-
? clsx(
65-
styles.disabled,
66-
className,
67-
'components-disabled'
68-
)
69-
: undefined
66+
clsx(
67+
className,
68+
isDisabled && [ styles.disabled, 'components-disabled' ]
69+
) || undefined
7070
}
7171
{ ...props }
7272
>

‎packages/components/src/disabled/test/index.jsdom.test.tsx‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,31 @@ describe( 'Disabled', () => {
6868
);
6969
} );
7070

71+
it( 'keeps the consumer className and toggles only the disabled classes', () => {
72+
const MaybeDisable = ( { isDisabled = true } ) => (
73+
<Disabled
74+
isDisabled={ isDisabled }
75+
className="my-wrapper"
76+
data-testid="disabled-wrapper"
77+
>
78+
<Form />
79+
</Disabled>
80+
);
81+
82+
const { rerender } = render( <MaybeDisable /> );
83+
84+
const wrapper = screen.getByTestId( 'disabled-wrapper' );
85+
expect( wrapper ).toHaveClass( 'my-wrapper' );
86+
expect( wrapper ).toHaveClass( 'components-disabled' );
87+
expect( wrapper ).toHaveClass( styles.disabled );
88+
89+
rerender( <MaybeDisable isDisabled={ false } /> );
90+
91+
expect( wrapper ).toHaveClass( 'my-wrapper' );
92+
expect( wrapper ).not.toHaveClass( 'components-disabled' );
93+
expect( wrapper ).not.toHaveClass( styles.disabled );
94+
} );
95+
7196
it( 'should preserve input values when toggling the isDisabled prop', async () => {
7297
const user = userEvent.setup();
7398

‎packages/dataviews/src/components/dataform-controls/test/date.jsdom.test.tsx‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,6 @@ describe( 'DateControl', () => {
359359
name: /august 25, 2026/i,
360360
} );
361361
await user.click( august25 );
362-
// The first click extends the existing range. Clicking its new end again
363-
// starts the replacement range from that day.
364-
await user.click( august25 );
365362
await user.click(
366363
screen.getByRole( 'button', { name: /august 27, 2026/i } )
367364
);

‎packages/dataviews/src/components/dataform-controls/test/datetime.jsdom.test.tsx‎

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,6 @@ const field = normalizeFields< TestItem >( [
3131
const getMonthGrid = ( monthLabel: string ) =>
3232
screen.getByRole( 'grid', { name: monthLabel } );
3333

34-
const supportsOffsetTimeZones = () => {
35-
try {
36-
new Intl.DateTimeFormat( 'en', { timeZone: '+05:30' } );
37-
return true;
38-
} catch {
39-
return false;
40-
}
41-
};
42-
43-
// Raw offset identifiers are supported by the target browsers and Node 22+.
44-
// Node 20 cannot mount Calendar with them because its Intl implementation
45-
// rejects the identifier before the interaction can be tested.
46-
const describeWithOffsetTimeZones = supportsOffsetTimeZones()
47-
? describe
48-
: describe.skip;
49-
5034
function DateTimeHarness( { initialValue }: { initialValue: string } ) {
5135
const [ data, setData ] = useState< TestItem >( {
5236
published: initialValue,
@@ -157,7 +141,7 @@ describe( 'DateTime control', () => {
157141
} );
158142
}
159143

160-
describeWithOffsetTimeZones( 'with a manual UTC offset', () => {
144+
describe( 'with a manual UTC offset', () => {
161145
it( 'should move to the site month after an external value change', () => {
162146
setSiteOffset( 14 );
163147
const { rerender } = render(
@@ -329,9 +313,7 @@ describe( 'DateTime control', () => {
329313
);
330314
} );
331315

332-
// The manual offset reaches Calendar as a raw offset identifier,
333-
// which Node 20 rejects — see `supportsOffsetTimeZones`.
334-
describeWithOffsetTimeZones( 'on a site with a manual offset', () => {
316+
describe( 'on a site with a manual offset', () => {
335317
it( 'falls back to the UTC offset', () => {
336318
setSiteOffset( 14 );
337319

‎packages/editor/CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
### Bug Fixes
2121

22+
- User autocompleter: Don't open the mention popup when the `@` follows other text, such as while typing an email address; mentions still trigger after a space, punctuation, or at the start of a line ([#47249](https://github.com/WordPress/gutenberg/pull/47249)).
2223
- More menu: Align SVG prefix icons with item labels using `Menu.PrefixIcon`, preserving Dashicon and custom component support. ([#82346](https://github.com/WordPress/gutenberg/pull/82346))
2324
- Attach media an Image or Gallery block displays to the post on save, when it is not already attached to another post, matching what uploading into that post has always done ([#81977](https://github.com/WordPress/gutenberg/pull/81977)).
2425
- Color the welcome guide's hovered button icon with `color` rather than `fill`, so stroke-based icons follow it. ([#78812](https://github.com/WordPress/gutenberg/pull/78812))

‎packages/editor/src/components/autocompleters/user.jsx‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ export default {
4343
className: 'editor-autocompleters__user',
4444
triggerPrefix: '@',
4545

46+
allowContext( before ) {
47+
// Only trigger when the preceding character is not a word character,
48+
// so typing an email address does not open the mention popup, while
49+
// mentions still work at the start of a line or after spaces and
50+
// punctuation such as an opening parenthesis.
51+
return /\B$/.test( before );
52+
},
53+
4654
useItems( filterValue ) {
4755
const users = useSelect(
4856
( select ) => {

‎packages/ui/CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
### Breaking Changes
66

7+
- `SearchableSelect`, `SearchableChipSelect`, and `SearchableChipSelectControl`: Hide the creatable footer when the create action is not in the filtered results. It still renders in the footer (not the main list) when it remains in `items` and matches the query. To keep a create action after an unmatched query, keep that item in `items` with a label or `filter` that matches ([#82566](https://github.com/WordPress/gutenberg/pull/82566)).
8+
- `RangeCalendar`: Start a new range by default when selecting a date after the current range is complete. Set `resetOnSelect={ false }` to preserve the previous behavior. ([#82612](https://github.com/WordPress/gutenberg/pull/82612))
79
- `Menu`: `--wp-ui-menu-selection-indicator-size` now controls the selection indicator width only. Its height follows the item label line height. ([#82346](https://github.com/WordPress/gutenberg/pull/82346))
810
- `Autocomplete.Popup`, `Combobox.Popup`, `Select.Popup`, `SearchableChipSelect`, and `SearchableChipSelectControl`: The popup now defaults to a fixed anchor width. Use `width="content"` on Popups, or `popupWidth="content"` on composites, to restore content-sized width between the anchor and available viewport bounds ([#82087](https://github.com/WordPress/gutenberg/pull/82087), [#82193](https://github.com/WordPress/gutenberg/pull/82193)).
911
- Portaled overlays (`AlertDialog`, `Autocomplete`, `Combobox`, `Dialog`, `Drawer`, `Menu`, `Popover`, and `Select`) now inherit the theme from their portal destination instead of re-emitting the trigger's nearest contextual theme. Default portals use the document root theme; custom portal containers use their DOM ancestry ([#82038](https://github.com/WordPress/gutenberg/pull/82038)).

‎packages/ui/src/calendar/range-calendar.tsx‎

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,26 @@ export function usePreviewRange( {
1717
value,
1818
hoveredDate,
1919
excludeDisabled,
20+
resetOnSelect,
2021
min,
2122
max,
2223
disabled,
2324
}: Pick<
2425
RangeCalendarProps,
25-
'value' | 'excludeDisabled' | 'min' | 'max' | 'disabled'
26+
'value' | 'excludeDisabled' | 'resetOnSelect' | 'min' | 'max' | 'disabled'
2627
> & {
2728
hoveredDate: Date | undefined;
2829
} ) {
2930
return useMemo( () => {
3031
if ( ! hoveredDate || ! value?.from ) {
3132
return;
3233
}
34+
if ( resetOnSelect && value.to ) {
35+
return {
36+
from: hoveredDate,
37+
to: hoveredDate,
38+
};
39+
}
3340

3441
let previewHighlight: DateRange | undefined;
3542
let potentialNewRange: { from: Date; to: Date } | undefined;
@@ -117,7 +124,15 @@ export function usePreviewRange( {
117124
}
118125

119126
return previewHighlight;
120-
}, [ value, hoveredDate, excludeDisabled, min, max, disabled ] );
127+
}, [
128+
value,
129+
hoveredDate,
130+
excludeDisabled,
131+
resetOnSelect,
132+
min,
133+
max,
134+
disabled,
135+
] );
121136
}
122137

123138
/**
@@ -136,6 +151,7 @@ export const RangeCalendar = forwardRef< HTMLDivElement, RangeCalendarProps >(
136151
onValueChange,
137152
numberOfMonths = 1,
138153
excludeDisabled,
154+
resetOnSelect = true,
139155
min,
140156
max,
141157
disabled,
@@ -195,6 +211,7 @@ export const RangeCalendar = forwardRef< HTMLDivElement, RangeCalendarProps >(
195211
value: selected,
196212
hoveredDate,
197213
excludeDisabled,
214+
resetOnSelect,
198215
min,
199216
max,
200217
disabled,
@@ -230,6 +247,7 @@ export const RangeCalendar = forwardRef< HTMLDivElement, RangeCalendarProps >(
230247
numberOfMonths={ clampNumberOfMonths( numberOfMonths ) }
231248
disabled={ disabled }
232249
excludeDisabled={ excludeDisabled }
250+
resetOnSelect={ resetOnSelect }
233251
min={ min }
234252
max={ max }
235253
labels={ labels }

0 commit comments

Comments
 (0)