@fluentui-react-native/focus-zone 0.22.0 → 0.22.1
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 +14 -0
- package/lib/FocusZone.d.ts +2 -5
- package/lib/FocusZone.js +30 -28
- package/lib/FocusZone.types.d.ts +70 -74
- package/lib/FocusZone.types.js +1 -1
- package/lib/FocusZoneNativeComponent.d.ts +10 -16
- package/lib/FocusZoneNativeComponent.d.ts.map +1 -1
- package/lib/FocusZoneNativeComponent.js +3 -3
- package/lib/FocusZoneNativeComponent.js.map +1 -1
- package/lib/__tests__/FocusZone.test.d.ts +1 -1
- package/lib/__tests__/FocusZone.test.js +79 -133
- package/lib/index.d.ts +2 -13
- package/lib/index.js +1 -1
- package/lib-commonjs/FocusZone.d.ts +2 -5
- package/lib-commonjs/FocusZone.js +70 -87
- package/lib-commonjs/FocusZone.types.d.ts +70 -74
- package/lib-commonjs/FocusZone.types.js +3 -3
- package/lib-commonjs/FocusZoneNativeComponent.d.ts +10 -16
- package/lib-commonjs/FocusZoneNativeComponent.d.ts.map +1 -1
- package/lib-commonjs/FocusZoneNativeComponent.js +8 -5
- package/lib-commonjs/FocusZoneNativeComponent.js.map +1 -1
- package/lib-commonjs/__tests__/FocusZone.test.d.ts +1 -1
- package/lib-commonjs/__tests__/FocusZone.test.js +114 -190
- package/lib-commonjs/index.d.ts +2 -13
- package/lib-commonjs/index.js +7 -17
- package/package.json +17 -16
- package/src/FocusZoneNativeComponent.ts +3 -5
- package/src/codegenTypes.d.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Change Log - @fluentui-react-native/focus-zone
|
|
2
2
|
|
|
3
|
+
## 0.22.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f72b43a: Fix codegen definitions for native components in repo
|
|
8
|
+
- 0d6e9c1: chore: migrate to `oxfmt`
|
|
9
|
+
- ac6e7af: Ensure packages have a default export that references the typescript entrypoint and clean up build dependency ordering
|
|
10
|
+
- Updated dependencies [0d6e9c1]
|
|
11
|
+
- Updated dependencies [ac6e7af]
|
|
12
|
+
- @uifabricshared/foundation-composable@0.14.1
|
|
13
|
+
- @uifabricshared/foundation-settings@0.16.1
|
|
14
|
+
- @fluentui-react-native/interactive-hooks@0.28.1
|
|
15
|
+
- @fluentui-react-native/adapters@0.14.1
|
|
16
|
+
|
|
3
17
|
## 0.22.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/lib/FocusZone.d.ts
CHANGED
|
@@ -5,8 +5,5 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import type { FocusZoneProps, FocusZoneSlotProps } from './FocusZone.types';
|
|
8
|
-
export declare const FocusZone: import(
|
|
9
|
-
|
|
10
|
-
import('@uifabricshared/foundation-composable').IComposable<FocusZoneProps, FocusZoneSlotProps, {}>
|
|
11
|
-
>;
|
|
12
|
-
//# sourceMappingURL=FocusZone.d.ts.map
|
|
8
|
+
export declare const FocusZone: import("@uifabricshared/foundation-composable").IWithComposable<React.FunctionComponent<FocusZoneProps>, import("@uifabricshared/foundation-composable").IComposable<FocusZoneProps, FocusZoneSlotProps, {}>>;
|
|
9
|
+
//# sourceMappingURL=FocusZone.d.ts.map
|
package/lib/FocusZone.js
CHANGED
|
@@ -11,32 +11,34 @@ import { mergeSettings } from '@uifabricshared/foundation-settings';
|
|
|
11
11
|
import RCTFocusZone from './FocusZoneNativeComponent';
|
|
12
12
|
const filterOutComponentRef = (propName) => propName !== 'componentRef';
|
|
13
13
|
export const FocusZone = composable({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
14
|
+
usePrepareProps: (userProps, useStyling) => {
|
|
15
|
+
const { componentRef, defaultTabbableElement, isCircularNavigation, ...rest } = userProps;
|
|
16
|
+
const ftzRef = useViewCommandFocus(componentRef);
|
|
17
|
+
const [targetFirstFocus, setTargetFirstFocus] = React.useState(undefined);
|
|
18
|
+
React.useLayoutEffect(() => {
|
|
19
|
+
if (typeof defaultTabbableElement === 'string') {
|
|
20
|
+
setTargetFirstFocus(defaultTabbableElement);
|
|
21
|
+
}
|
|
22
|
+
else if (defaultTabbableElement?.current) {
|
|
23
|
+
setTargetFirstFocus(findNodeHandle(defaultTabbableElement.current));
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
setTargetFirstFocus(undefined);
|
|
27
|
+
}
|
|
28
|
+
}, [defaultTabbableElement]);
|
|
29
|
+
return {
|
|
30
|
+
slotProps: mergeSettings(useStyling(userProps), {
|
|
31
|
+
root: {
|
|
32
|
+
navigateAtEnd: isCircularNavigation ? 'NavigateWrap' : 'NavigateStopAtEnds', // let rest override
|
|
33
|
+
...rest,
|
|
34
|
+
defaultTabbableElement: targetFirstFocus,
|
|
35
|
+
ref: ftzRef,
|
|
36
|
+
},
|
|
37
|
+
}),
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
slots: {
|
|
41
|
+
root: { slotType: RCTFocusZone, filter: filterOutComponentRef },
|
|
42
|
+
},
|
|
41
43
|
});
|
|
42
|
-
//# sourceMappingURL=FocusZone.js.map
|
|
44
|
+
//# sourceMappingURL=FocusZone.js.map
|
package/lib/FocusZone.types.d.ts
CHANGED
|
@@ -2,95 +2,91 @@ import type * as React from 'react';
|
|
|
2
2
|
import type { IViewProps } from '@fluentui-react-native/adapters';
|
|
3
3
|
import type { IFocusable } from '@fluentui-react-native/interactive-hooks';
|
|
4
4
|
import type { IRenderData } from '@uifabricshared/foundation-composable';
|
|
5
|
-
export declare const focusZoneName =
|
|
5
|
+
export declare const focusZoneName = "FocusZone";
|
|
6
6
|
type EmptyInterface = {};
|
|
7
7
|
export type FocusZoneState = EmptyInterface;
|
|
8
8
|
export type FocusZoneProps = IViewProps & {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
9
|
+
/**
|
|
10
|
+
* A RefObject to access the IFocusable interface. Use this to access the public methods and properties of the component.
|
|
11
|
+
*/
|
|
12
|
+
componentRef?: React.RefObject<IFocusable>;
|
|
13
|
+
/**
|
|
14
|
+
* Optionally defines the initial tabbable element inside the FocusZone
|
|
15
|
+
*/
|
|
16
|
+
defaultTabbableElement?: React.RefObject<React.Component> | string;
|
|
17
|
+
/**
|
|
18
|
+
** Defines which arrows to react to
|
|
19
|
+
*/
|
|
20
|
+
focusZoneDirection?: FocusZoneDirection;
|
|
21
|
+
/**
|
|
22
|
+
** If set, the FocusZone will not be tabbable and keyboard navigation will be disabled
|
|
23
|
+
*/
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
isCircularNavigation?: boolean;
|
|
26
|
+
/**
|
|
27
27
|
*Allows for 2D navigation. This navigation strategy takes into account the position of elements
|
|
28
28
|
on screen, and navigates in the direction the user selects to the nearest element.
|
|
29
29
|
*/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
30
|
+
use2DNavigation?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* By default, pressing Tab within a FocusZone moves focus out of the FocusZone.
|
|
33
|
+
* This prop allows you to change that behavior.
|
|
34
|
+
*
|
|
35
|
+
* "None" : Default
|
|
36
|
+
* "NavigateWrap" : Tab allowed within FZ with circular navigation behavior
|
|
37
|
+
* "NavigateStopAtEnds" : Tab allowed within FZ and stops at ends
|
|
38
|
+
* "Normal" : Tab allowed within FZ, and focus is not trapped. Tabbing at the last element bring you out of the FZ.
|
|
39
|
+
*
|
|
40
|
+
* Recommended Usage - Moving focus OUT of the FocusZone - Custom Key Handlers
|
|
41
|
+
* Example: Subscribe to key events. On the pressing of "Escape", move focus out of the FocusZone.
|
|
42
|
+
*
|
|
43
|
+
* Recommended Usage - Moving focus INTO the FocusZone
|
|
44
|
+
* Let's take a CardList, for example. If a user is navigating through elements of the List, we don't want
|
|
45
|
+
* focus to land within the FocusZone on initial focus. If it does, it will trap focus within the FocusZone and
|
|
46
|
+
* ruin the user's workflow.
|
|
47
|
+
* Instead, once focus lands on the parent of the FocusZone, implement a custom key handler that will enable
|
|
48
|
+
* the FocusZone.
|
|
49
|
+
*/
|
|
50
|
+
tabKeyNavigation?: FocusZoneTabNavigation;
|
|
51
|
+
/**
|
|
52
|
+
* Callback called when “focus” event triggered in FocusZone
|
|
53
|
+
*/
|
|
54
|
+
onFocus?: (e?: any) => void;
|
|
55
|
+
/**
|
|
56
|
+
* @platform macos
|
|
57
|
+
* By default, the Apple KeyView loop is calculated based on the UI tree hierarchy, accessibility properties,
|
|
58
|
+
* custom element overrides of navigation order, and positions in layout.
|
|
59
|
+
*
|
|
60
|
+
* Normally this produces the appropriate accessible experience for users, but occasionally we may need to
|
|
61
|
+
* clarify the intended order of navigation. The navigationOrderInRenderOrder prop will have the FocusZone
|
|
62
|
+
* establish the navigation order of its children according to their order in the UI tree
|
|
63
|
+
* (i.e. as returned by accessibilityChildren).
|
|
64
|
+
*
|
|
65
|
+
* Note that to participate in the KeyView loop calculation, the FocusZone itself must be part of the
|
|
66
|
+
* accessibility tree (i.e. 'accessible') with an appropriate role, e.g. 'group'.
|
|
67
|
+
*
|
|
68
|
+
* Extra note: This property is unlikely to perform well if changed from its initial value due to finer details
|
|
69
|
+
* of the MacOS KeyView loop mechanics.
|
|
70
|
+
*/
|
|
71
|
+
navigationOrderInRenderOrder?: boolean;
|
|
72
72
|
};
|
|
73
73
|
export interface NativeProps extends Omit<FocusZoneProps, 'isCircularNavigation'> {
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
navigateAtEnd?: NavigateAtEnd;
|
|
75
|
+
tabKeyNavigation?: FocusZoneTabNavigation;
|
|
76
76
|
}
|
|
77
|
-
export type FocusZoneDirection =
|
|
78
|
-
| 'bidirectional' /** React to all arrows. */
|
|
79
|
-
| 'vertical' /** Only react to up/down arrows. */
|
|
80
|
-
| 'horizontal' /** Only react to left/right arrows. */
|
|
81
|
-
| 'none'; /** Doesn't respond to any arrow keys. */
|
|
77
|
+
export type FocusZoneDirection = 'bidirectional' /** React to all arrows. */ | 'vertical' /** Only react to up/down arrows. */ | 'horizontal' /** Only react to left/right arrows. */ | 'none'; /** Doesn't respond to any arrow keys. */
|
|
82
78
|
export type NavigateAtEnd = 'NavigateStopAtEnds' | 'NavigateWrap' | 'NavigateContinue';
|
|
83
79
|
export type FocusZoneTabNavigation = 'None' | 'NavigateWrap' | 'NavigateStopAtEnds' | 'Normal';
|
|
84
80
|
export type FocusZoneTokens = EmptyInterface;
|
|
85
81
|
export interface FocusZoneSlotProps {
|
|
86
|
-
|
|
82
|
+
root: NativeProps;
|
|
87
83
|
}
|
|
88
84
|
export type FocusZoneRenderData = IRenderData<FocusZoneSlotProps, FocusZoneState>;
|
|
89
85
|
export interface FocusZoneType {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
props: FocusZoneProps;
|
|
87
|
+
tokens: FocusZoneTokens;
|
|
88
|
+
slotProps: FocusZoneSlotProps;
|
|
89
|
+
state: FocusZoneState;
|
|
94
90
|
}
|
|
95
91
|
export {};
|
|
96
|
-
//# sourceMappingURL=FocusZone.types.d.ts.map
|
|
92
|
+
//# sourceMappingURL=FocusZone.types.d.ts.map
|
package/lib/FocusZone.types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const focusZoneName = 'FocusZone';
|
|
2
|
-
//# sourceMappingURL=FocusZone.types.js.map
|
|
2
|
+
//# sourceMappingURL=FocusZone.types.js.map
|
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) Microsoft Corporation.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
* @format
|
|
5
|
-
*/
|
|
6
1
|
import type { ViewProps } from 'react-native';
|
|
7
|
-
import type { WithDefault } from 'react-native/Libraries/Types/CodegenTypes';
|
|
8
|
-
import type { UnsafeMixed } from './codegenTypes';
|
|
2
|
+
import type { WithDefault, UnsafeMixed } from 'react-native/Libraries/Types/CodegenTypes';
|
|
9
3
|
export interface NativeProps extends ViewProps {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
4
|
+
navigateAtEnd?: WithDefault<'NavigateStopAtEnds' | 'NavigateWrap' | 'NavigateContinue', 'NavigateStopAtEnds'>;
|
|
5
|
+
defaultTabbableElement?: UnsafeMixed;
|
|
6
|
+
focusZoneDirection?: WithDefault<'bidirectional' | 'vertical' | 'horizontal' | 'none', 'bidirectional'>;
|
|
7
|
+
use2DNavigation?: boolean;
|
|
8
|
+
tabKeyNavigation?: WithDefault<'None' | 'NavigateWrap' | 'NavigateStopAtEnds' | 'Normal', 'None'>;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
isTabNavigation?: boolean;
|
|
17
11
|
}
|
|
18
|
-
declare const _default: import(
|
|
12
|
+
declare const _default: import("react-native/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
|
|
19
13
|
export default _default;
|
|
20
|
-
//# sourceMappingURL=FocusZoneNativeComponent.d.ts.map
|
|
14
|
+
//# sourceMappingURL=FocusZoneNativeComponent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FocusZoneNativeComponent.d.ts","sourceRoot":"","sources":["../src/FocusZoneNativeComponent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FocusZoneNativeComponent.d.ts","sourceRoot":"","sources":["../src/FocusZoneNativeComponent.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAK1F,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,aAAa,CAAC,EAAE,WAAW,CAAC,oBAAoB,GAAG,cAAc,GAAG,kBAAkB,EAAE,oBAAoB,CAAC,CAAC;IAC9G,sBAAsB,CAAC,EAAE,WAAW,CAAC;IACrC,kBAAkB,CAAC,EAAE,WAAW,CAAC,eAAe,GAAG,UAAU,GAAG,YAAY,GAAG,MAAM,EAAE,eAAe,CAAC,CAAC;IACxG,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,GAAG,cAAc,GAAG,oBAAoB,GAAG,QAAQ,EAAE,MAAM,CAAC,CAAC;IAClG,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;;AAED,wBAAmE"}
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
* @format
|
|
5
5
|
*/
|
|
6
|
-
import
|
|
7
|
-
export default
|
|
8
|
-
//# sourceMappingURL=FocusZoneNativeComponent.js.map
|
|
6
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
7
|
+
export default codegenNativeComponent('RCTFocusZone');
|
|
8
|
+
//# sourceMappingURL=FocusZoneNativeComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FocusZoneNativeComponent.js","sourceRoot":"","sources":["../src/FocusZoneNativeComponent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"FocusZoneNativeComponent.js","sourceRoot":"","sources":["../src/FocusZoneNativeComponent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,sBAAsB,MAAM,yDAAyD,CAAC;AAkB7F,eAAe,sBAAsB,CAAc,cAAc,CAAC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export {};
|
|
2
|
-
//# sourceMappingURL=FocusZone.test.d.ts.map
|
|
2
|
+
//# sourceMappingURL=FocusZone.test.d.ts.map
|
|
@@ -1,153 +1,99 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { act } from 'react';
|
|
3
3
|
import { Button } from 'react-native';
|
|
4
4
|
import * as renderer from 'react-test-renderer';
|
|
5
5
|
import { FocusZone } from '..';
|
|
6
6
|
const onPress = () => {
|
|
7
|
-
|
|
7
|
+
return;
|
|
8
8
|
};
|
|
9
9
|
describe('FocusZone No Props', () => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
it('No children', () => {
|
|
11
|
+
let component;
|
|
12
|
+
act(() => {
|
|
13
|
+
component = renderer.create(_jsx(FocusZone, {}));
|
|
14
|
+
});
|
|
15
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
14
16
|
});
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
it('One child', () => {
|
|
18
|
+
let component;
|
|
19
|
+
act(() => {
|
|
20
|
+
component = renderer.create(_jsx(FocusZone, { children: _jsx(Button, { title: "button", onPress: onPress }) }));
|
|
21
|
+
});
|
|
22
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
21
23
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}),
|
|
31
|
-
);
|
|
24
|
+
it('Two children', () => {
|
|
25
|
+
let component;
|
|
26
|
+
act(() => {
|
|
27
|
+
component = renderer.create(_jsxs(FocusZone, { children: [
|
|
28
|
+
_jsx(Button, { title: "button", onPress: onPress }), _jsx(Button, { title: "button", onPress: onPress })
|
|
29
|
+
] }));
|
|
30
|
+
});
|
|
31
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
32
32
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
_jsx(Button, { title: 'button', onPress: onPress }),
|
|
42
|
-
_jsx(Button, { title: 'button', onPress: onPress }),
|
|
43
|
-
_jsx(Button, { title: 'button', onPress: onPress }),
|
|
44
|
-
],
|
|
45
|
-
}),
|
|
46
|
-
);
|
|
33
|
+
it('Three children', () => {
|
|
34
|
+
let component;
|
|
35
|
+
act(() => {
|
|
36
|
+
component = renderer.create(_jsxs(FocusZone, { children: [
|
|
37
|
+
_jsx(Button, { title: "button", onPress: onPress }), _jsx(Button, { title: "button", onPress: onPress }), _jsx(Button, { title: "button", onPress: onPress })
|
|
38
|
+
] }));
|
|
39
|
+
});
|
|
40
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
47
41
|
});
|
|
48
|
-
expect(component.toJSON()).toMatchSnapshot();
|
|
49
|
-
});
|
|
50
42
|
});
|
|
51
43
|
describe('FocusZone With Props', () => {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
_jsx(Button, { title: 'button', onPress: onPress }),
|
|
61
|
-
_jsx(Button, { title: 'button', onPress: onPress }),
|
|
62
|
-
],
|
|
63
|
-
}),
|
|
64
|
-
);
|
|
44
|
+
it('defaultTabbableElement Prop', () => {
|
|
45
|
+
let component;
|
|
46
|
+
act(() => {
|
|
47
|
+
component = renderer.create(_jsxs(FocusZone, { defaultTabbableElement: null, children: [
|
|
48
|
+
_jsx(Button, { title: "button", onPress: onPress }), _jsx(Button, { title: "button", onPress: onPress }), _jsx(Button, { title: "button", onPress: onPress })
|
|
49
|
+
] }));
|
|
50
|
+
});
|
|
51
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
65
52
|
});
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
children: [
|
|
75
|
-
_jsx(Button, { title: 'button', onPress: onPress }),
|
|
76
|
-
_jsx(Button, { title: 'button', onPress: onPress }),
|
|
77
|
-
_jsx(Button, { title: 'button', onPress: onPress }),
|
|
78
|
-
],
|
|
79
|
-
}),
|
|
80
|
-
);
|
|
53
|
+
it('focusZoneDirection Prop', () => {
|
|
54
|
+
let component;
|
|
55
|
+
act(() => {
|
|
56
|
+
component = renderer.create(_jsxs(FocusZone, { focusZoneDirection: "bidirectional", children: [
|
|
57
|
+
_jsx(Button, { title: "button", onPress: onPress }), _jsx(Button, { title: "button", onPress: onPress }), _jsx(Button, { title: "button", onPress: onPress })
|
|
58
|
+
] }));
|
|
59
|
+
});
|
|
60
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
81
61
|
});
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
children: [
|
|
91
|
-
_jsx(Button, { title: 'button', onPress: onPress }),
|
|
92
|
-
_jsx(Button, { title: 'button', onPress: onPress }),
|
|
93
|
-
_jsx(Button, { title: 'button', onPress: onPress }),
|
|
94
|
-
],
|
|
95
|
-
}),
|
|
96
|
-
);
|
|
62
|
+
it('disabled Prop', () => {
|
|
63
|
+
let component;
|
|
64
|
+
act(() => {
|
|
65
|
+
component = renderer.create(_jsxs(FocusZone, { disabled: true, children: [
|
|
66
|
+
_jsx(Button, { title: "button", onPress: onPress }), _jsx(Button, { title: "button", onPress: onPress }), _jsx(Button, { title: "button", onPress: onPress })
|
|
67
|
+
] }));
|
|
68
|
+
});
|
|
69
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
97
70
|
});
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
children: [
|
|
107
|
-
_jsx(Button, { title: 'button', onPress: onPress }),
|
|
108
|
-
_jsx(Button, { title: 'button', onPress: onPress }),
|
|
109
|
-
_jsx(Button, { title: 'button', onPress: onPress }),
|
|
110
|
-
],
|
|
111
|
-
}),
|
|
112
|
-
);
|
|
71
|
+
it('isCircularNavigation Prop', () => {
|
|
72
|
+
let component;
|
|
73
|
+
act(() => {
|
|
74
|
+
component = renderer.create(_jsxs(FocusZone, { isCircularNavigation: true, children: [
|
|
75
|
+
_jsx(Button, { title: "button", onPress: onPress }), _jsx(Button, { title: "button", onPress: onPress }), _jsx(Button, { title: "button", onPress: onPress })
|
|
76
|
+
] }));
|
|
77
|
+
});
|
|
78
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
113
79
|
});
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
children: [
|
|
123
|
-
_jsx(Button, { title: 'button', onPress: onPress }),
|
|
124
|
-
_jsx(Button, { title: 'button', onPress: onPress }),
|
|
125
|
-
_jsx(Button, { title: 'button', onPress: onPress }),
|
|
126
|
-
],
|
|
127
|
-
}),
|
|
128
|
-
);
|
|
80
|
+
it('use2DNavigation Prop', () => {
|
|
81
|
+
let component;
|
|
82
|
+
act(() => {
|
|
83
|
+
component = renderer.create(_jsxs(FocusZone, { use2DNavigation: true, children: [
|
|
84
|
+
_jsx(Button, { title: "button", onPress: onPress }), _jsx(Button, { title: "button", onPress: onPress }), _jsx(Button, { title: "button", onPress: onPress })
|
|
85
|
+
] }));
|
|
86
|
+
});
|
|
87
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
129
88
|
});
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
use2DNavigation: true,
|
|
139
|
-
defaultTabbableElement: null,
|
|
140
|
-
isCircularNavigation: false,
|
|
141
|
-
focusZoneDirection: 'vertical',
|
|
142
|
-
children: [
|
|
143
|
-
_jsx(Button, { title: 'button', onPress: onPress }),
|
|
144
|
-
_jsx(Button, { title: 'button', onPress: onPress }),
|
|
145
|
-
_jsx(Button, { title: 'button', onPress: onPress }),
|
|
146
|
-
],
|
|
147
|
-
}),
|
|
148
|
-
);
|
|
89
|
+
it('All Props', () => {
|
|
90
|
+
let component;
|
|
91
|
+
act(() => {
|
|
92
|
+
component = renderer.create(_jsxs(FocusZone, { disabled: false, use2DNavigation: true, defaultTabbableElement: null, isCircularNavigation: false, focusZoneDirection: "vertical", children: [
|
|
93
|
+
_jsx(Button, { title: "button", onPress: onPress }), _jsx(Button, { title: "button", onPress: onPress }), _jsx(Button, { title: "button", onPress: onPress })
|
|
94
|
+
] }));
|
|
95
|
+
});
|
|
96
|
+
expect(component.toJSON()).toMatchSnapshot();
|
|
149
97
|
});
|
|
150
|
-
expect(component.toJSON()).toMatchSnapshot();
|
|
151
|
-
});
|
|
152
98
|
});
|
|
153
|
-
//# sourceMappingURL=FocusZone.test.js.map
|
|
99
|
+
//# sourceMappingURL=FocusZone.test.js.map
|
package/lib/index.d.ts
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
export { focusZoneName } from './FocusZone.types';
|
|
2
|
-
export type {
|
|
3
|
-
FocusZoneDirection,
|
|
4
|
-
FocusZoneProps,
|
|
5
|
-
FocusZoneRenderData,
|
|
6
|
-
FocusZoneSlotProps,
|
|
7
|
-
FocusZoneState,
|
|
8
|
-
FocusZoneTabNavigation,
|
|
9
|
-
FocusZoneTokens,
|
|
10
|
-
FocusZoneType,
|
|
11
|
-
NativeProps,
|
|
12
|
-
NavigateAtEnd,
|
|
13
|
-
} from './FocusZone.types';
|
|
2
|
+
export type { FocusZoneDirection, FocusZoneProps, FocusZoneRenderData, FocusZoneSlotProps, FocusZoneState, FocusZoneTabNavigation, FocusZoneTokens, FocusZoneType, NativeProps, NavigateAtEnd, } from './FocusZone.types';
|
|
14
3
|
export { FocusZone } from './FocusZone';
|
|
15
|
-
//# sourceMappingURL=index.d.ts.map
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.js
CHANGED
|
@@ -5,8 +5,5 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import type { FocusZoneProps, FocusZoneSlotProps } from './FocusZone.types';
|
|
8
|
-
export declare const FocusZone: import(
|
|
9
|
-
|
|
10
|
-
import('@uifabricshared/foundation-composable').IComposable<FocusZoneProps, FocusZoneSlotProps, {}>
|
|
11
|
-
>;
|
|
12
|
-
//# sourceMappingURL=FocusZone.d.ts.map
|
|
8
|
+
export declare const FocusZone: import("@uifabricshared/foundation-composable").IWithComposable<React.FunctionComponent<FocusZoneProps>, import("@uifabricshared/foundation-composable").IComposable<FocusZoneProps, FocusZoneSlotProps, {}>>;
|
|
9
|
+
//# sourceMappingURL=FocusZone.d.ts.map
|