@wordpress/components 27.0.0 → 27.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/build/base-control/index.native.js.map +1 -1
- package/build/border-box-control/border-box-control/component.js.map +1 -1
- package/build/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build/border-control/border-control-dropdown/component.js.map +1 -1
- package/build/button/index.js +2 -2
- package/build/button/index.js.map +1 -1
- package/build/button/index.native.js.map +1 -1
- package/build/confirm-dialog/component.js.map +1 -1
- package/build/custom-select-control-v2/default-component/index.js.map +1 -1
- package/build/custom-select-control-v2/index.js +2 -2
- package/build/custom-select-control-v2/index.js.map +1 -1
- package/build/custom-select-control-v2/types.js.map +1 -1
- package/build/draggable/index.native.js +2 -2
- package/build/draggable/index.native.js.map +1 -1
- package/build/dropdown-menu/index.native.js.map +1 -1
- package/build/flex/flex/hook.js +1 -1
- package/build/flex/flex/hook.js.map +1 -1
- package/build/font-size-picker/index.native.js.map +1 -1
- package/build/form-token-field/index.js.map +1 -1
- package/build/h-stack/hook.js +6 -1
- package/build/h-stack/hook.js.map +1 -1
- package/build/mobile/bottom-sheet/button.native.js.map +1 -1
- package/build/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet/range-cell.native.js.map +1 -1
- package/build/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
- package/build/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
- package/build/mobile/gradient/index.native.js.map +1 -1
- package/build/mobile/image/index.native.js +4 -13
- package/build/mobile/image/index.native.js.map +1 -1
- package/build/mobile/media-edit/index.native.js.map +1 -1
- package/build/palette-edit/index.js.map +1 -1
- package/build/query-controls/index.native.js.map +1 -1
- package/build/range-control/index.js.map +1 -1
- package/build/search-control/index.native.js.map +1 -1
- package/build/snackbar/index.js +3 -2
- package/build/snackbar/index.js.map +1 -1
- package/build/snackbar/list.js +2 -1
- package/build/snackbar/list.js.map +1 -1
- package/build/snackbar/types.js.map +1 -1
- package/build/tabs/index.js +7 -7
- package/build/tabs/index.js.map +1 -1
- package/build/tabs/types.js.map +1 -1
- package/build/utils/hooks/index.js +0 -7
- package/build/utils/hooks/index.js.map +1 -1
- package/build-module/base-control/index.native.js.map +1 -1
- package/build-module/border-box-control/border-box-control/component.js.map +1 -1
- package/build-module/border-box-control/border-box-control-split-controls/component.js.map +1 -1
- package/build-module/border-control/border-control-dropdown/component.js.map +1 -1
- package/build-module/button/index.js +2 -2
- package/build-module/button/index.js.map +1 -1
- package/build-module/button/index.native.js.map +1 -1
- package/build-module/confirm-dialog/component.js.map +1 -1
- package/build-module/custom-select-control-v2/default-component/index.js.map +1 -1
- package/build-module/custom-select-control-v2/index.js +1 -1
- package/build-module/custom-select-control-v2/index.js.map +1 -1
- package/build-module/custom-select-control-v2/types.js.map +1 -1
- package/build-module/draggable/index.native.js +2 -2
- package/build-module/draggable/index.native.js.map +1 -1
- package/build-module/dropdown-menu/index.native.js.map +1 -1
- package/build-module/flex/flex/hook.js +1 -1
- package/build-module/flex/flex/hook.js.map +1 -1
- package/build-module/font-size-picker/index.native.js.map +1 -1
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/h-stack/hook.js +6 -1
- package/build-module/h-stack/hook.js.map +1 -1
- package/build-module/mobile/bottom-sheet/button.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/range-cell.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet/stepper-cell/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet-select-control/index.native.js.map +1 -1
- package/build-module/mobile/bottom-sheet-text-control/index.native.js.map +1 -1
- package/build-module/mobile/gradient/index.native.js.map +1 -1
- package/build-module/mobile/image/index.native.js +6 -15
- package/build-module/mobile/image/index.native.js.map +1 -1
- package/build-module/mobile/media-edit/index.native.js.map +1 -1
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/query-controls/index.native.js.map +1 -1
- package/build-module/range-control/index.js.map +1 -1
- package/build-module/search-control/index.native.js.map +1 -1
- package/build-module/snackbar/index.js +3 -2
- package/build-module/snackbar/index.js.map +1 -1
- package/build-module/snackbar/list.js +2 -1
- package/build-module/snackbar/list.js.map +1 -1
- package/build-module/snackbar/types.js.map +1 -1
- package/build-module/tabs/index.js +7 -7
- package/build-module/tabs/index.js.map +1 -1
- package/build-module/tabs/types.js.map +1 -1
- package/build-module/utils/hooks/index.js +0 -1
- package/build-module/utils/hooks/index.js.map +1 -1
- package/build-style/style-rtl.css +8 -1
- package/build-style/style.css +8 -1
- package/build-types/custom-select-control-v2/default-component/index.d.ts +2 -1
- package/build-types/custom-select-control-v2/default-component/index.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/index.d.ts +1 -1
- package/build-types/custom-select-control-v2/index.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/legacy-component/test/index.d.ts +2 -0
- package/build-types/custom-select-control-v2/legacy-component/test/index.d.ts.map +1 -0
- package/build-types/custom-select-control-v2/stories/default.story.d.ts +4 -3
- package/build-types/custom-select-control-v2/stories/default.story.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/stories/legacy.story.d.ts +2 -2
- package/build-types/custom-select-control-v2/stories/legacy.story.d.ts.map +1 -1
- package/build-types/custom-select-control-v2/types.d.ts +0 -1
- package/build-types/custom-select-control-v2/types.d.ts.map +1 -1
- package/build-types/flex/flex/hook.d.ts +2 -3
- package/build-types/flex/flex/hook.d.ts.map +1 -1
- package/build-types/h-stack/hook.d.ts +2 -4
- package/build-types/h-stack/hook.d.ts.map +1 -1
- package/build-types/navigation/stories/utils/hide-if-empty.d.ts.map +1 -1
- package/build-types/radio-group/stories/index.story.d.ts.map +1 -1
- package/build-types/snackbar/index.d.ts +5 -2
- package/build-types/snackbar/index.d.ts.map +1 -1
- package/build-types/snackbar/list.d.ts.map +1 -1
- package/build-types/snackbar/test/index.d.ts +2 -0
- package/build-types/snackbar/test/index.d.ts.map +1 -0
- package/build-types/snackbar/test/list.d.ts +2 -0
- package/build-types/snackbar/test/list.d.ts.map +1 -0
- package/build-types/snackbar/types.d.ts +18 -2
- package/build-types/snackbar/types.d.ts.map +1 -1
- package/build-types/tabs/index.d.ts +1 -1
- package/build-types/tabs/types.d.ts +1 -1
- package/build-types/utils/hooks/index.d.ts +0 -1
- package/build-types/v-stack/hook.d.ts +2 -4
- package/build-types/v-stack/hook.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/base-control/index.native.js +1 -1
- package/src/base-control/test/index.tsx +1 -1
- package/src/border-box-control/border-box-control/component.tsx +1 -1
- package/src/border-box-control/border-box-control-split-controls/component.tsx +4 -4
- package/src/border-control/border-control-dropdown/component.tsx +1 -1
- package/src/button/index.native.js +1 -1
- package/src/button/index.tsx +1 -1
- package/src/button/style.scss +1 -3
- package/src/circular-option-picker/test/index.tsx +2 -4
- package/src/combobox-control/test/index.tsx +1 -1
- package/src/confirm-dialog/component.tsx +1 -1
- package/src/confirm-dialog/test/index.tsx +5 -21
- package/src/custom-select-control-v2/default-component/index.tsx +4 -1
- package/src/custom-select-control-v2/index.tsx +1 -1
- package/src/custom-select-control-v2/legacy-component/test/index.tsx +457 -0
- package/src/custom-select-control-v2/stories/legacy.story.tsx +5 -6
- package/src/custom-select-control-v2/test/index.tsx +279 -749
- package/src/custom-select-control-v2/types.ts +0 -1
- package/src/disabled/test/index.tsx +1 -1
- package/src/draggable/index.native.js +2 -2
- package/src/draggable/test/index.native.js +6 -2
- package/src/dropdown-menu/index.native.js +2 -2
- package/src/flex/flex/hook.ts +1 -1
- package/src/font-size-picker/index.native.js +2 -2
- package/src/form-token-field/index.tsx +1 -1
- package/src/h-stack/hook.tsx +2 -1
- package/src/h-stack/test/index.tsx +10 -0
- package/src/item-group/test/index.js +2 -2
- package/src/mobile/bottom-sheet/bottom-sheet-navigation/test/navigation-container.native.js +10 -15
- package/src/mobile/bottom-sheet/button.native.js +1 -5
- package/src/mobile/bottom-sheet/index.native.js +2 -2
- package/src/mobile/bottom-sheet/range-cell.native.js +1 -1
- package/src/mobile/bottom-sheet/stepper-cell/index.native.js +2 -2
- package/src/mobile/bottom-sheet-select-control/index.native.js +1 -1
- package/src/mobile/bottom-sheet-text-control/index.native.js +1 -1
- package/src/mobile/gradient/index.native.js +1 -1
- package/src/mobile/image/index.native.js +8 -23
- package/src/mobile/media-edit/index.native.js +1 -1
- package/src/modal/test/index.tsx +1 -1
- package/src/navigation/stories/utils/hide-if-empty.tsx +2 -6
- package/src/palette-edit/index.tsx +2 -2
- package/src/popover/test/index.tsx +1 -4
- package/src/query-controls/index.native.js +2 -2
- package/src/radio-group/stories/index.story.tsx +1 -0
- package/src/range-control/index.tsx +3 -3
- package/src/range-control/test/index.tsx +2 -2
- package/src/search-control/index.native.js +1 -1
- package/src/snackbar/index.tsx +5 -2
- package/src/snackbar/list.tsx +6 -1
- package/src/snackbar/stories/list.story.tsx +0 -3
- package/src/snackbar/test/index.tsx +267 -0
- package/src/snackbar/test/list.tsx +46 -0
- package/src/snackbar/types.ts +31 -3
- package/src/tabs/README.md +18 -18
- package/src/tabs/index.tsx +7 -7
- package/src/tabs/stories/index.story.tsx +1 -1
- package/src/tabs/test/index.tsx +30 -30
- package/src/tabs/types.ts +1 -1
- package/src/toggle-group-control/test/index.tsx +1 -1
- package/src/tools-panel/stories/index.story.tsx +8 -8
- package/src/tools-panel/test/index.tsx +10 -28
- package/src/tooltip/style.scss +2 -1
- package/src/tooltip/test/index.native.js +3 -3
- package/src/tree-grid/test/index.tsx +1 -1
- package/src/utils/hooks/index.js +0 -1
- package/src/v-stack/test/index.tsx +10 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/custom-select-control-v2/legacy-adapter.js +0 -29
- package/build/custom-select-control-v2/legacy-adapter.js.map +0 -1
- package/build/utils/hooks/use-latest-ref.js +0 -33
- package/build/utils/hooks/use-latest-ref.js.map +0 -1
- package/build-module/custom-select-control-v2/legacy-adapter.js +0 -21
- package/build-module/custom-select-control-v2/legacy-adapter.js.map +0 -1
- package/build-module/utils/hooks/use-latest-ref.js +0 -27
- package/build-module/utils/hooks/use-latest-ref.js.map +0 -1
- package/build-types/custom-select-control-v2/legacy-adapter.d.ts +0 -6
- package/build-types/custom-select-control-v2/legacy-adapter.d.ts.map +0 -1
- package/build-types/utils/hooks/use-latest-ref.d.ts +0 -15
- package/build-types/utils/hooks/use-latest-ref.d.ts.map +0 -1
- package/src/custom-select-control-v2/legacy-adapter.tsx +0 -25
- package/src/utils/hooks/test/use-latest-ref.js +0 -119
- package/src/utils/hooks/use-latest-ref.ts +0 -29
|
@@ -94,7 +94,7 @@ describe( 'Disabled', () => {
|
|
|
94
94
|
'This is contentEditable.'
|
|
95
95
|
);
|
|
96
96
|
|
|
97
|
-
rerender( <MaybeDisable isDisabled
|
|
97
|
+
rerender( <MaybeDisable isDisabled /> );
|
|
98
98
|
expect( getInput() ).toHaveValue( 'This is input.' );
|
|
99
99
|
expect( getContentEditable() ).toHaveTextContent(
|
|
100
100
|
'This is contentEditable.'
|
|
@@ -63,7 +63,7 @@ const Draggable = ( {
|
|
|
63
63
|
useAnimatedReaction(
|
|
64
64
|
() => isDragging.value,
|
|
65
65
|
( result, previous ) => {
|
|
66
|
-
if ( result === previous
|
|
66
|
+
if ( result === previous ) {
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -75,7 +75,7 @@ const Draggable = ( {
|
|
|
75
75
|
id: draggingId.value,
|
|
76
76
|
} );
|
|
77
77
|
}
|
|
78
|
-
} else if ( onDragEnd ) {
|
|
78
|
+
} else if ( previous !== null && onDragEnd ) {
|
|
79
79
|
onDragEnd( {
|
|
80
80
|
x: lastPosition.x.value,
|
|
81
81
|
y: lastPosition.y.value,
|
|
@@ -28,10 +28,12 @@ const TouchEventType = {
|
|
|
28
28
|
// For testing, we mock the "requestAnimationFrame" so it calls the callback passed instantly.
|
|
29
29
|
let requestAnimationFrameCopy;
|
|
30
30
|
beforeEach( () => {
|
|
31
|
+
jest.useFakeTimers();
|
|
31
32
|
requestAnimationFrameCopy = global.requestAnimationFrame;
|
|
32
33
|
global.requestAnimationFrame = ( callback ) => callback();
|
|
33
34
|
} );
|
|
34
35
|
afterEach( () => {
|
|
36
|
+
jest.useRealTimers();
|
|
35
37
|
global.requestAnimationFrame = requestAnimationFrameCopy;
|
|
36
38
|
} );
|
|
37
39
|
|
|
@@ -43,7 +45,7 @@ describe( 'Draggable', () => {
|
|
|
43
45
|
<Draggable>
|
|
44
46
|
<DraggableTrigger
|
|
45
47
|
id={ triggerId }
|
|
46
|
-
enabled
|
|
48
|
+
enabled
|
|
47
49
|
minDuration={ 500 }
|
|
48
50
|
onLongPress={ onLongPress }
|
|
49
51
|
testID="draggableTrigger"
|
|
@@ -58,6 +60,7 @@ describe( 'Draggable', () => {
|
|
|
58
60
|
{ oldState: State.BEGAN, state: State.ACTIVE },
|
|
59
61
|
{ state: State.ACTIVE },
|
|
60
62
|
] );
|
|
63
|
+
jest.runOnlyPendingTimers();
|
|
61
64
|
|
|
62
65
|
expect( onLongPress ).toHaveBeenCalledTimes( 1 );
|
|
63
66
|
expect( onLongPress ).toHaveBeenCalledWith( triggerId );
|
|
@@ -93,6 +96,7 @@ describe( 'Draggable', () => {
|
|
|
93
96
|
{ oldState: State.BEGAN, state: State.ACTIVE },
|
|
94
97
|
{ state: State.ACTIVE },
|
|
95
98
|
] );
|
|
99
|
+
jest.runOnlyPendingTimers();
|
|
96
100
|
fireGestureHandler( draggable, [
|
|
97
101
|
// TOUCHES_DOWN event is only received on ACTIVE state, so we have to fire it manually.
|
|
98
102
|
{ oldState: State.BEGAN, state: State.ACTIVE },
|
|
@@ -112,7 +116,7 @@ describe( 'Draggable', () => {
|
|
|
112
116
|
] );
|
|
113
117
|
// TODO(jest-console): Fix the warning and remove the expect below.
|
|
114
118
|
expect( console ).toHaveWarnedWith(
|
|
115
|
-
'[Reanimated]
|
|
119
|
+
'[Reanimated] setGestureState() cannot be used with Jest.'
|
|
116
120
|
);
|
|
117
121
|
|
|
118
122
|
expect( onDragStart ).toHaveBeenCalledTimes( 1 );
|
|
@@ -108,7 +108,7 @@ function DropdownMenu( {
|
|
|
108
108
|
renderContent={ ( { isOpen, onClose, ...props } ) => {
|
|
109
109
|
return (
|
|
110
110
|
<BottomSheet
|
|
111
|
-
hideHeader
|
|
111
|
+
hideHeader
|
|
112
112
|
isVisible={ isOpen }
|
|
113
113
|
onClose={ onClose }
|
|
114
114
|
>
|
|
@@ -135,7 +135,7 @@ function DropdownMenu( {
|
|
|
135
135
|
} }
|
|
136
136
|
editable={ false }
|
|
137
137
|
icon={ control.icon }
|
|
138
|
-
leftAlign
|
|
138
|
+
leftAlign
|
|
139
139
|
isSelected={ control.isActive }
|
|
140
140
|
separatorType={
|
|
141
141
|
Platform.OS === 'android'
|
package/src/flex/flex/hook.ts
CHANGED
|
@@ -22,7 +22,7 @@ import type { FlexProps } from '../types';
|
|
|
22
22
|
|
|
23
23
|
function useDeprecatedProps(
|
|
24
24
|
props: WordPressComponentProps< FlexProps, 'div' >
|
|
25
|
-
):
|
|
25
|
+
): Omit< typeof props, 'isReversed' > {
|
|
26
26
|
const { isReversed, ...otherProps } = props;
|
|
27
27
|
|
|
28
28
|
if ( typeof isReversed !== 'undefined' ) {
|
|
@@ -111,7 +111,7 @@ function FontSizePicker( {
|
|
|
111
111
|
separatorType="none"
|
|
112
112
|
label={ __( 'Default' ) }
|
|
113
113
|
onPress={ onChangeValue( undefined ) }
|
|
114
|
-
leftAlign
|
|
114
|
+
leftAlign
|
|
115
115
|
key={ 'default' }
|
|
116
116
|
accessibilityRole={ 'button' }
|
|
117
117
|
accessibilityLabel={ __( 'Selected: Default' ) }
|
|
@@ -137,7 +137,7 @@ function FontSizePicker( {
|
|
|
137
137
|
label={ item.name }
|
|
138
138
|
subLabel={ item.sizePx }
|
|
139
139
|
onPress={ onChangeValue( item.sizePx ) }
|
|
140
|
-
leftAlign
|
|
140
|
+
leftAlign
|
|
141
141
|
key={ index }
|
|
142
142
|
accessibilityRole={ 'button' }
|
|
143
143
|
accessibilityLabel={
|
package/src/h-stack/hook.tsx
CHANGED
|
@@ -47,7 +47,8 @@ export function useHStack( props: WordPressComponentProps< Props, 'div' > ) {
|
|
|
47
47
|
gap: spacing,
|
|
48
48
|
};
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
// Omit `isColumn` because it's not used in HStack.
|
|
51
|
+
const { isColumn, ...flexProps } = useFlex( propsForFlex );
|
|
51
52
|
|
|
52
53
|
return flexProps;
|
|
53
54
|
}
|
|
@@ -39,4 +39,14 @@ describe( 'props', () => {
|
|
|
39
39
|
);
|
|
40
40
|
expect( container ).toMatchSnapshot();
|
|
41
41
|
} );
|
|
42
|
+
|
|
43
|
+
test( 'should not pass through invalid props to the `as` component', () => {
|
|
44
|
+
const AsComponent = ( props: JSX.IntrinsicElements[ 'div' ] ) => {
|
|
45
|
+
return <div { ...props } />;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
render( <HStack as={ AsComponent }>foobar</HStack> );
|
|
49
|
+
|
|
50
|
+
expect( console ).not.toHaveErrored();
|
|
51
|
+
} );
|
|
42
52
|
} );
|
|
@@ -29,7 +29,7 @@ describe( 'ItemGroup', () => {
|
|
|
29
29
|
);
|
|
30
30
|
|
|
31
31
|
const { container: withBorders } = render(
|
|
32
|
-
<ItemGroup isBordered
|
|
32
|
+
<ItemGroup isBordered>
|
|
33
33
|
<Item>Code is poetry</Item>
|
|
34
34
|
</ItemGroup>
|
|
35
35
|
);
|
|
@@ -63,7 +63,7 @@ describe( 'ItemGroup', () => {
|
|
|
63
63
|
);
|
|
64
64
|
|
|
65
65
|
const { container: separatedItems } = render(
|
|
66
|
-
<ItemGroup isSeparated
|
|
66
|
+
<ItemGroup isSeparated>
|
|
67
67
|
<Item>Code is poetry</Item>
|
|
68
68
|
</ItemGroup>
|
|
69
69
|
);
|
|
@@ -2,12 +2,7 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { Text } from 'react-native';
|
|
5
|
-
import {
|
|
6
|
-
render,
|
|
7
|
-
fireEvent,
|
|
8
|
-
withReanimatedTimer,
|
|
9
|
-
advanceAnimationByTime,
|
|
10
|
-
} from 'test/helpers';
|
|
5
|
+
import { act, render, fireEvent, withReanimatedTimer } from 'test/helpers';
|
|
11
6
|
import { useNavigation } from '@react-navigation/native';
|
|
12
7
|
|
|
13
8
|
/**
|
|
@@ -63,7 +58,7 @@ it( 'animates height transitioning from non-full-screen to non-full-screen', asy
|
|
|
63
58
|
screen.getByTestId( 'navigation-screen-test-screen-1' ),
|
|
64
59
|
screen1Layout
|
|
65
60
|
);
|
|
66
|
-
|
|
61
|
+
act( () => jest.advanceTimersByTime( 1 ) );
|
|
67
62
|
expect( navigationContainer ).toHaveAnimatedStyle( screen1Layout );
|
|
68
63
|
|
|
69
64
|
// Navigate to screen 2
|
|
@@ -75,7 +70,7 @@ it( 'animates height transitioning from non-full-screen to non-full-screen', asy
|
|
|
75
70
|
);
|
|
76
71
|
// The animation takes 300 ms, so we wait that time plus 1 ms
|
|
77
72
|
// to the completion.
|
|
78
|
-
|
|
73
|
+
act( () => jest.advanceTimersByTime( 301 ) );
|
|
79
74
|
expect( navigationContainer ).toHaveAnimatedStyle( screen2Layout );
|
|
80
75
|
} ) );
|
|
81
76
|
|
|
@@ -105,14 +100,14 @@ it( 'animates height transitioning from non-full-screen to full-screen', async (
|
|
|
105
100
|
screen.getByTestId( 'navigation-screen-test-screen-1' ),
|
|
106
101
|
screen1Layout
|
|
107
102
|
);
|
|
108
|
-
|
|
103
|
+
act( () => jest.advanceTimersByTime( 1 ) );
|
|
109
104
|
expect( navigationContainer ).toHaveAnimatedStyle( screen1Layout );
|
|
110
105
|
|
|
111
106
|
// Navigate to screen 2
|
|
112
107
|
fireEvent.press( screen.getByText( /test-screen-1/ ) );
|
|
113
108
|
// The animation takes 300 ms, so we wait that time plus 1 ms
|
|
114
109
|
// to the completion.
|
|
115
|
-
|
|
110
|
+
act( () => jest.advanceTimersByTime( 301 ) );
|
|
116
111
|
expect( navigationContainer ).toHaveAnimatedStyle( {
|
|
117
112
|
height: WINDOW_HEIGHT,
|
|
118
113
|
} );
|
|
@@ -144,14 +139,14 @@ it( 'animates height transitioning from full-screen to non-full-screen', async (
|
|
|
144
139
|
screen.getByTestId( 'navigation-screen-test-screen-1' ),
|
|
145
140
|
screen1Layout
|
|
146
141
|
);
|
|
147
|
-
|
|
142
|
+
act( () => jest.advanceTimersByTime( 1 ) );
|
|
148
143
|
expect( navigationContainer ).toHaveAnimatedStyle( screen1Layout );
|
|
149
144
|
|
|
150
145
|
// Navigate to screen 2
|
|
151
146
|
fireEvent.press( screen.getByText( /test-screen-1/ ) );
|
|
152
147
|
// The animation takes 300 ms, so we wait that time plus 1 ms
|
|
153
148
|
// to the completion.
|
|
154
|
-
|
|
149
|
+
act( () => jest.advanceTimersByTime( 301 ) );
|
|
155
150
|
expect( navigationContainer ).toHaveAnimatedStyle( {
|
|
156
151
|
height: WINDOW_HEIGHT,
|
|
157
152
|
} );
|
|
@@ -160,7 +155,7 @@ it( 'animates height transitioning from full-screen to non-full-screen', async (
|
|
|
160
155
|
fireEvent.press( await screen.findByText( /test-screen-2/ ) );
|
|
161
156
|
// The animation takes 300 ms, so we wait that time plus 1 ms
|
|
162
157
|
// to the completion.
|
|
163
|
-
|
|
158
|
+
act( () => jest.advanceTimersByTime( 301 ) );
|
|
164
159
|
expect( navigationContainer ).toHaveAnimatedStyle( screen1Layout );
|
|
165
160
|
} ) );
|
|
166
161
|
|
|
@@ -187,7 +182,7 @@ it( 'does not animate height transitioning from full-screen to full-screen', asy
|
|
|
187
182
|
|
|
188
183
|
// First height value should be set without animation, but we need
|
|
189
184
|
// to wait for a frame to let animated styles be updated.
|
|
190
|
-
|
|
185
|
+
act( () => jest.advanceTimersByTime( 1 ) );
|
|
191
186
|
expect( navigationContainer ).toHaveAnimatedStyle( {
|
|
192
187
|
height: WINDOW_HEIGHT,
|
|
193
188
|
} );
|
|
@@ -195,7 +190,7 @@ it( 'does not animate height transitioning from full-screen to full-screen', asy
|
|
|
195
190
|
// Navigate to screen 2
|
|
196
191
|
fireEvent.press( screen.getByText( /test-screen-1/ ) );
|
|
197
192
|
// We wait some milliseconds to check if height has changed.
|
|
198
|
-
|
|
193
|
+
act( () => jest.advanceTimersByTime( 10 ) );
|
|
199
194
|
expect( navigationContainer ).toHaveAnimatedStyle( {
|
|
200
195
|
height: WINDOW_HEIGHT,
|
|
201
196
|
} );
|
|
@@ -9,11 +9,7 @@ import { TouchableOpacity, View, Text } from 'react-native';
|
|
|
9
9
|
import styles from './styles.scss';
|
|
10
10
|
|
|
11
11
|
const BottomSheetButton = ( { onPress, disabled, text, color } ) => (
|
|
12
|
-
<TouchableOpacity
|
|
13
|
-
accessible={ true }
|
|
14
|
-
onPress={ onPress }
|
|
15
|
-
disabled={ disabled }
|
|
16
|
-
>
|
|
12
|
+
<TouchableOpacity accessible onPress={ onPress } disabled={ disabled }>
|
|
17
13
|
<View style={ { flexDirection: 'row', justifyContent: 'center' } }>
|
|
18
14
|
<Text style={ { ...styles.buttonText, color } }>{ text }</Text>
|
|
19
15
|
</View>
|
|
@@ -540,8 +540,8 @@ class BottomSheet extends Component {
|
|
|
540
540
|
}
|
|
541
541
|
onAccessibilityEscape={ this.onCloseBottomSheet }
|
|
542
542
|
testID="bottom-sheet"
|
|
543
|
-
hardwareAccelerated
|
|
544
|
-
useNativeDriverForBackdrop
|
|
543
|
+
hardwareAccelerated
|
|
544
|
+
useNativeDriverForBackdrop
|
|
545
545
|
{ ...rest }
|
|
546
546
|
>
|
|
547
547
|
<KeyboardAvoidingView
|
|
@@ -174,7 +174,7 @@ class BottomSheetStepperCell extends Component {
|
|
|
174
174
|
|
|
175
175
|
return (
|
|
176
176
|
<View
|
|
177
|
-
accessible
|
|
177
|
+
accessible
|
|
178
178
|
accessibilityRole="adjustable"
|
|
179
179
|
accessibilityLabel={ accessibilityLabel }
|
|
180
180
|
accessibilityHint={ getAccessibilityHint() }
|
|
@@ -214,7 +214,7 @@ class BottomSheetStepperCell extends Component {
|
|
|
214
214
|
icon={ icon }
|
|
215
215
|
label={ label }
|
|
216
216
|
labelStyle={ labelStyle }
|
|
217
|
-
leftAlign
|
|
217
|
+
leftAlign
|
|
218
218
|
separatorType={ separatorType }
|
|
219
219
|
disabled={ disabled }
|
|
220
220
|
>
|
|
@@ -82,7 +82,7 @@ const BottomSheetTextControl = ( {
|
|
|
82
82
|
label={ label }
|
|
83
83
|
onChangeText={ ( text ) => onChange( text ) }
|
|
84
84
|
defaultValue={ initialValue }
|
|
85
|
-
multiline
|
|
85
|
+
multiline
|
|
86
86
|
placeholder={ placeholder }
|
|
87
87
|
placeholderTextColor={ '#87a6bc' }
|
|
88
88
|
style={ textEditorStyle }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { Image as RNImage, Text, View } from 'react-native';
|
|
5
5
|
import FastImage from 'react-native-fast-image';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -11,7 +11,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
11
11
|
import { Icon } from '@wordpress/components';
|
|
12
12
|
import { image, offline } from '@wordpress/icons';
|
|
13
13
|
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
|
|
14
|
-
import { useEffect, useState,
|
|
14
|
+
import { useEffect, useState, Platform } from '@wordpress/element';
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Internal dependencies
|
|
@@ -218,19 +218,8 @@ const ImageComponent = ( {
|
|
|
218
218
|
focalPoint && styles.focalPointContainer,
|
|
219
219
|
];
|
|
220
220
|
|
|
221
|
-
const opacityValue = useRef( new Animated.Value( 1 ) ).current;
|
|
222
|
-
|
|
223
|
-
useEffect( () => {
|
|
224
|
-
Animated.timing( opacityValue, {
|
|
225
|
-
toValue: isUploadInProgress ? 0.3 : 1,
|
|
226
|
-
duration: 100,
|
|
227
|
-
useNativeDriver: true,
|
|
228
|
-
} ).start();
|
|
229
|
-
}, [ isUploadInProgress, opacityValue ] );
|
|
230
|
-
|
|
231
221
|
const imageStyles = [
|
|
232
222
|
{
|
|
233
|
-
opacity: opacityValue,
|
|
234
223
|
height: containerSize?.height,
|
|
235
224
|
},
|
|
236
225
|
! resizeMode && {
|
|
@@ -300,13 +289,9 @@ const ImageComponent = ( {
|
|
|
300
289
|
key={ url }
|
|
301
290
|
style={ imageContainerStyles }
|
|
302
291
|
>
|
|
303
|
-
{ isSelected &&
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
isUploadInProgress ||
|
|
307
|
-
isUploadFailed ||
|
|
308
|
-
isUploadPaused
|
|
309
|
-
) && <View style={ imageSelectedStyles } /> }
|
|
292
|
+
{ isSelected && highlightSelected && (
|
|
293
|
+
<View style={ imageSelectedStyles } />
|
|
294
|
+
) }
|
|
310
295
|
|
|
311
296
|
{ ! imageData ? (
|
|
312
297
|
<View style={ placeholderStyles }>
|
|
@@ -319,7 +304,7 @@ const ImageComponent = ( {
|
|
|
319
304
|
{ Platform.isAndroid && (
|
|
320
305
|
<>
|
|
321
306
|
{ networkImageLoaded && networkURL && (
|
|
322
|
-
<
|
|
307
|
+
<Image
|
|
323
308
|
style={ imageStyles }
|
|
324
309
|
fadeDuration={ 0 }
|
|
325
310
|
source={ { uri: networkURL } }
|
|
@@ -331,7 +316,7 @@ const ImageComponent = ( {
|
|
|
331
316
|
/>
|
|
332
317
|
) }
|
|
333
318
|
{ ! networkImageLoaded && ! networkURL && (
|
|
334
|
-
<
|
|
319
|
+
<Image
|
|
335
320
|
style={ imageStyles }
|
|
336
321
|
fadeDuration={ 0 }
|
|
337
322
|
source={ { uri: localURL } }
|
|
@@ -345,7 +330,7 @@ const ImageComponent = ( {
|
|
|
345
330
|
) }
|
|
346
331
|
{ Platform.isIOS && (
|
|
347
332
|
<>
|
|
348
|
-
<
|
|
333
|
+
<Image
|
|
349
334
|
style={ imageStyles }
|
|
350
335
|
source={ {
|
|
351
336
|
uri:
|
|
@@ -103,7 +103,7 @@ export class MediaEdit extends Component {
|
|
|
103
103
|
hideCancelButton
|
|
104
104
|
ref={ ( instance ) => ( this.picker = instance ) }
|
|
105
105
|
options={ this.getMediaOptionsItems() }
|
|
106
|
-
leftAlign
|
|
106
|
+
leftAlign
|
|
107
107
|
onChange={ this.onPickerSelect }
|
|
108
108
|
// translators: %s: block title e.g: "Paragraph".
|
|
109
109
|
title={ __( 'Media options' ) }
|
package/src/modal/test/index.tsx
CHANGED
|
@@ -335,7 +335,7 @@ describe( 'Modal', () => {
|
|
|
335
335
|
it( 'should focus the Modal dialog when `true` passed as value for `focusOnMount` prop', async () => {
|
|
336
336
|
const user = userEvent.setup();
|
|
337
337
|
|
|
338
|
-
render( <FocusMountDemo focusOnMount
|
|
338
|
+
render( <FocusMountDemo focusOnMount /> );
|
|
339
339
|
|
|
340
340
|
const opener = screen.getByRole( 'button', {
|
|
341
341
|
name: 'Toggle Modal',
|
|
@@ -42,11 +42,7 @@ export const HideIfEmptyStory: StoryFn< typeof Navigation > = ( {
|
|
|
42
42
|
/>
|
|
43
43
|
</NavigationMenu>
|
|
44
44
|
|
|
45
|
-
<NavigationMenu
|
|
46
|
-
menu="root-sub-1"
|
|
47
|
-
parentMenu="root"
|
|
48
|
-
isEmpty={ true }
|
|
49
|
-
/>
|
|
45
|
+
<NavigationMenu menu="root-sub-1" parentMenu="root" isEmpty />
|
|
50
46
|
<NavigationMenu
|
|
51
47
|
menu="root-sub-2"
|
|
52
48
|
parentMenu="root"
|
|
@@ -57,7 +53,7 @@ export const HideIfEmptyStory: StoryFn< typeof Navigation > = ( {
|
|
|
57
53
|
<NavigationMenu
|
|
58
54
|
menu="root-sub-1-sub-1"
|
|
59
55
|
parentMenu="root-sub-1"
|
|
60
|
-
isEmpty
|
|
56
|
+
isEmpty
|
|
61
57
|
/>
|
|
62
58
|
</Navigation>
|
|
63
59
|
|
|
@@ -592,14 +592,14 @@ export function PaletteEdit( {
|
|
|
592
592
|
gradients={ gradients }
|
|
593
593
|
onChange={ onSelectPaletteItem }
|
|
594
594
|
clearable={ false }
|
|
595
|
-
disableCustomGradients
|
|
595
|
+
disableCustomGradients
|
|
596
596
|
/>
|
|
597
597
|
) : (
|
|
598
598
|
<ColorPalette
|
|
599
599
|
colors={ colors }
|
|
600
600
|
onChange={ onSelectPaletteItem }
|
|
601
601
|
clearable={ false }
|
|
602
|
-
disableCustomColors
|
|
602
|
+
disableCustomColors
|
|
603
603
|
/>
|
|
604
604
|
) ) }
|
|
605
605
|
</>
|
|
@@ -182,10 +182,7 @@ describe( 'Popover', () => {
|
|
|
182
182
|
describe( 'focus behavior', () => {
|
|
183
183
|
it( 'should focus the popover container when opened', async () => {
|
|
184
184
|
render(
|
|
185
|
-
<Popover
|
|
186
|
-
focusOnMount={ true }
|
|
187
|
-
data-testid="popover-element"
|
|
188
|
-
>
|
|
185
|
+
<Popover focusOnMount data-testid="popover-element">
|
|
189
186
|
Popover content
|
|
190
187
|
</Popover>
|
|
191
188
|
);
|
|
@@ -69,7 +69,7 @@ const QueryControls = memo(
|
|
|
69
69
|
value={ `${ orderBy }/${ order }` }
|
|
70
70
|
options={ options }
|
|
71
71
|
onChange={ onChange }
|
|
72
|
-
hideCancelButton
|
|
72
|
+
hideCancelButton
|
|
73
73
|
/>
|
|
74
74
|
) }
|
|
75
75
|
{ onCategoryChange && (
|
|
@@ -79,7 +79,7 @@ const QueryControls = memo(
|
|
|
79
79
|
noOptionLabel={ _x( 'All', 'categories' ) }
|
|
80
80
|
selectedCategoryId={ selectedCategoryId }
|
|
81
81
|
onChange={ onCategoryChange }
|
|
82
|
-
hideCancelButton
|
|
82
|
+
hideCancelButton
|
|
83
83
|
/>
|
|
84
84
|
) }
|
|
85
85
|
{ onNumberOfItemsChange && (
|
|
@@ -16,6 +16,7 @@ import { useState } from '@wordpress/element';
|
|
|
16
16
|
|
|
17
17
|
const meta: Meta< typeof RadioGroup > = {
|
|
18
18
|
title: 'Components (Deprecated)/RadioGroup',
|
|
19
|
+
id: 'components-radiogroup',
|
|
19
20
|
component: RadioGroup,
|
|
20
21
|
// @ts-expect-error - See https://github.com/storybookjs/storybook/issues/23170
|
|
21
22
|
subcomponents: { Radio },
|
|
@@ -253,7 +253,7 @@ function UnforwardedRangeControl(
|
|
|
253
253
|
value={ inputSliderValue ?? undefined }
|
|
254
254
|
/>
|
|
255
255
|
<RangeRail
|
|
256
|
-
aria-hidden
|
|
256
|
+
aria-hidden
|
|
257
257
|
disabled={ disabled }
|
|
258
258
|
marks={ marks }
|
|
259
259
|
max={ max }
|
|
@@ -263,7 +263,7 @@ function UnforwardedRangeControl(
|
|
|
263
263
|
value={ rangeFillValue }
|
|
264
264
|
/>
|
|
265
265
|
<Track
|
|
266
|
-
aria-hidden
|
|
266
|
+
aria-hidden
|
|
267
267
|
className="components-range-control__track"
|
|
268
268
|
disabled={ disabled }
|
|
269
269
|
style={ { width: fillValueOffset } }
|
|
@@ -275,7 +275,7 @@ function UnforwardedRangeControl(
|
|
|
275
275
|
disabled={ disabled }
|
|
276
276
|
>
|
|
277
277
|
<Thumb
|
|
278
|
-
aria-hidden
|
|
278
|
+
aria-hidden
|
|
279
279
|
isFocused={ isThumbFocused }
|
|
280
280
|
disabled={ disabled }
|
|
281
281
|
/>
|
|
@@ -297,7 +297,7 @@ describe( 'RangeControl', () => {
|
|
|
297
297
|
render(
|
|
298
298
|
<RangeControl
|
|
299
299
|
initialPosition={ 10 }
|
|
300
|
-
allowReset
|
|
300
|
+
allowReset
|
|
301
301
|
onChange={ spy }
|
|
302
302
|
resetFallbackValue={ 33 }
|
|
303
303
|
/>
|
|
@@ -320,7 +320,7 @@ describe( 'RangeControl', () => {
|
|
|
320
320
|
initialPosition={ undefined }
|
|
321
321
|
min={ 0 }
|
|
322
322
|
max={ 100 }
|
|
323
|
-
allowReset
|
|
323
|
+
allowReset
|
|
324
324
|
resetFallbackValue={ undefined }
|
|
325
325
|
/>
|
|
326
326
|
);
|
|
@@ -235,7 +235,7 @@ function SearchControl( {
|
|
|
235
235
|
<Text
|
|
236
236
|
onPress={ onCancel }
|
|
237
237
|
style={ cancelButtonTextStyle }
|
|
238
|
-
accessible
|
|
238
|
+
accessible
|
|
239
239
|
accessibilityRole={ 'button' }
|
|
240
240
|
accessibilityLabel={ __( 'Cancel search' ) }
|
|
241
241
|
accessibilityHint={ __( 'Cancel search' ) }
|
package/src/snackbar/index.tsx
CHANGED
|
@@ -138,9 +138,12 @@ function UnforwardedSnackbar(
|
|
|
138
138
|
className={ classes }
|
|
139
139
|
onClick={ ! explicitDismiss ? dismissMe : undefined }
|
|
140
140
|
tabIndex={ 0 }
|
|
141
|
-
role={ ! explicitDismiss ? 'button' :
|
|
141
|
+
role={ ! explicitDismiss ? 'button' : undefined }
|
|
142
142
|
onKeyPress={ ! explicitDismiss ? dismissMe : undefined }
|
|
143
|
-
aria-label={
|
|
143
|
+
aria-label={
|
|
144
|
+
! explicitDismiss ? __( 'Dismiss this notice' ) : undefined
|
|
145
|
+
}
|
|
146
|
+
data-testid="snackbar"
|
|
144
147
|
>
|
|
145
148
|
<div className={ snackbarContentClassnames }>
|
|
146
149
|
{ icon && (
|
package/src/snackbar/list.tsx
CHANGED
|
@@ -73,7 +73,12 @@ export function SnackbarList( {
|
|
|
73
73
|
( notice: SnackbarListProps[ 'notices' ][ number ] ) => () =>
|
|
74
74
|
onRemove?.( notice.id );
|
|
75
75
|
return (
|
|
76
|
-
<div
|
|
76
|
+
<div
|
|
77
|
+
className={ className }
|
|
78
|
+
tabIndex={ -1 }
|
|
79
|
+
ref={ listRef }
|
|
80
|
+
data-testid="snackbar-list"
|
|
81
|
+
>
|
|
77
82
|
{ children }
|
|
78
83
|
<AnimatePresence>
|
|
79
84
|
{ notices.map( ( notice ) => {
|
|
@@ -70,7 +70,6 @@ Default.args = {
|
|
|
70
70
|
},
|
|
71
71
|
],
|
|
72
72
|
content: 'Post published.',
|
|
73
|
-
isDismissible: true,
|
|
74
73
|
explicitDismiss: false,
|
|
75
74
|
},
|
|
76
75
|
{
|
|
@@ -83,7 +82,6 @@ Default.args = {
|
|
|
83
82
|
},
|
|
84
83
|
],
|
|
85
84
|
content: 'Post updated.',
|
|
86
|
-
isDismissible: true,
|
|
87
85
|
explicitDismiss: false,
|
|
88
86
|
},
|
|
89
87
|
{
|
|
@@ -91,7 +89,6 @@ Default.args = {
|
|
|
91
89
|
spokenMessage: 'All content copied.',
|
|
92
90
|
actions: [],
|
|
93
91
|
content: 'All content copied.',
|
|
94
|
-
isDismissible: true,
|
|
95
92
|
explicitDismiss: false,
|
|
96
93
|
},
|
|
97
94
|
],
|