@fluentui-react-native/focus-zone 0.10.24 → 0.10.26

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.json CHANGED
@@ -2,7 +2,43 @@
2
2
  "name": "@fluentui-react-native/focus-zone",
3
3
  "entries": [
4
4
  {
5
- "date": "Tue, 18 Oct 2022 04:04:58 GMT",
5
+ "date": "Thu, 20 Oct 2022 19:20:31 GMT",
6
+ "tag": "@fluentui-react-native/focus-zone_v0.10.26",
7
+ "version": "0.10.26",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "sanajmi@microsoft.com",
12
+ "package": "@fluentui-react-native/focus-zone",
13
+ "commit": "9e827dde137238cae829145564cbc880bbdc5a90",
14
+ "comment": "FocusZone (macOS): Fix RTL bug"
15
+ }
16
+ ]
17
+ }
18
+ },
19
+ {
20
+ "date": "Thu, 20 Oct 2022 18:30:02 GMT",
21
+ "tag": "@fluentui-react-native/focus-zone_v0.10.25",
22
+ "version": "0.10.25",
23
+ "comments": {
24
+ "patch": [
25
+ {
26
+ "author": "sanajmi@microsoft.com",
27
+ "package": "@fluentui-react-native/focus-zone",
28
+ "commit": "860fa561d4887cee5f1eb2aa88ce7064620bcae1",
29
+ "comment": "FocusZone (macOS): Calculate distance from origin"
30
+ },
31
+ {
32
+ "author": "beachball",
33
+ "package": "@fluentui-react-native/focus-zone",
34
+ "comment": "Bump @fluentui-react-native/interactive-hooks to v0.19.1",
35
+ "commit": "9e827dde137238cae829145564cbc880bbdc5a90"
36
+ }
37
+ ]
38
+ }
39
+ },
40
+ {
41
+ "date": "Tue, 18 Oct 2022 04:06:27 GMT",
6
42
  "tag": "@fluentui-react-native/focus-zone_v0.10.24",
7
43
  "version": "0.10.24",
8
44
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,29 @@
1
1
  # Change Log - @fluentui-react-native/focus-zone
2
2
 
3
- This log was last generated on Tue, 18 Oct 2022 04:04:58 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 20 Oct 2022 19:20:31 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 0.10.26
8
+
9
+ Thu, 20 Oct 2022 19:20:31 GMT
10
+
11
+ ### Patches
12
+
13
+ - FocusZone (macOS): Fix RTL bug (sanajmi@microsoft.com)
14
+
15
+ ## 0.10.25
16
+
17
+ Thu, 20 Oct 2022 18:30:02 GMT
18
+
19
+ ### Patches
20
+
21
+ - FocusZone (macOS): Calculate distance from origin (sanajmi@microsoft.com)
22
+ - Bump @fluentui-react-native/interactive-hooks to v0.19.1
23
+
7
24
  ## 0.10.24
8
25
 
9
- Tue, 18 Oct 2022 04:04:58 GMT
26
+ Tue, 18 Oct 2022 04:06:27 GMT
10
27
 
11
28
  ### Patches
12
29
 
@@ -1,5 +1,6 @@
1
1
  #import "KeyCodes.h"
2
2
  #import "RCTFocusZone.h"
3
+ #import "RCTi18nUtil.h"
3
4
 
4
5
  typedef enum {
5
6
  FocusZoneActionNone,
@@ -25,14 +26,18 @@ static inline CGFloat GetDistanceBetweenPoints(NSPoint point1, NSPoint point2)
25
26
  return sqrt(delta.x * delta.x + delta.y * delta.y);
26
27
  }
27
28
 
28
- static inline NSPoint GetCenterOfRect(NSRect rect)
29
+ static inline CGFloat GetDistanceBetweenRects(NSRect rect1, NSRect rect2)
29
30
  {
30
- return NSMakePoint(NSMidX(rect), NSMidY(rect));
31
- }
31
+ // Get the top left corner of the rect, top right in RTL
32
+ bool isRTL = [[RCTI18nUtil sharedInstance] isRTL];
32
33
 
33
- static inline CGFloat GetDistanceBetweenCentersOfRects(NSRect rect1, NSRect rect2)
34
- {
35
- return GetDistanceBetweenPoints(GetCenterOfRect(rect1), GetCenterOfRect(rect2));
34
+ CGFloat rect1Offset = isRTL ? rect1.size.width : 0;
35
+ CGFloat rect2Offset = isRTL ? rect2.size.width : 0;
36
+
37
+ NSPoint rect1Corner = NSMakePoint(rect1.origin.x + rect1Offset , rect1.origin.y);
38
+ NSPoint rect2Corner = NSMakePoint(rect2.origin.x + rect2Offset , rect2.origin.y);
39
+
40
+ return GetDistanceBetweenPoints(rect1Corner, rect2Corner);
36
41
  }
37
42
 
38
43
  static inline CGFloat GetMinDistanceBetweenRectVerticesAndPoint(NSRect rect, NSPoint point)
@@ -275,7 +280,7 @@ static BOOL ShouldSkipFocusZone(NSView *view)
275
280
 
276
281
  if (!skip)
277
282
  {
278
- CGFloat distance = GetDistanceBetweenCentersOfRects(firstResponderRect, candidateRect);
283
+ CGFloat distance = GetDistanceBetweenRects(firstResponderRect, candidateRect);
279
284
 
280
285
  // If there are other candidate views inside the same ScrollView as the firstResponder,
281
286
  // prefer those views over other views outside the scrollview, even if they are closer.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui-react-native/focus-zone",
3
- "version": "0.10.24",
3
+ "version": "0.10.26",
4
4
  "description": "A cross-platform FocusZone component using the Fluent Design System",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "@fluentui-react-native/component-cache": "^1.4.2",
26
- "@fluentui-react-native/interactive-hooks": ">=0.19.0 <1.0.0",
26
+ "@fluentui-react-native/interactive-hooks": ">=0.19.1 <1.0.0",
27
27
  "@uifabricshared/foundation-composable": ">=0.11.1 <1.0.0",
28
28
  "@uifabricshared/foundation-settings": ">=0.12.1 <1.0.0"
29
29
  },