@fluentui-react-native/callout 0.17.29 → 0.19.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.
Files changed (47) hide show
  1. package/.eslintrc.js +2 -4
  2. package/CHANGELOG.json +179 -1
  3. package/CHANGELOG.md +54 -2
  4. package/FRNCallout.podspec +23 -0
  5. package/lib/Callout.d.ts.map +1 -1
  6. package/lib/Callout.js +6 -3
  7. package/lib/Callout.js.map +1 -1
  8. package/lib/Callout.settings.macos.d.ts +4 -0
  9. package/lib/Callout.settings.macos.d.ts.map +1 -0
  10. package/lib/Callout.settings.macos.js +21 -0
  11. package/lib/Callout.settings.macos.js.map +1 -0
  12. package/lib/Callout.types.d.ts +9 -3
  13. package/lib/Callout.types.d.ts.map +1 -1
  14. package/lib/__tests__/Callout.test.d.ts +2 -0
  15. package/lib/__tests__/Callout.test.d.ts.map +1 -0
  16. package/lib/__tests__/{Callout.test.win32.js → Callout.test.js} +1 -1
  17. package/lib/__tests__/Callout.test.js.map +1 -0
  18. package/lib-commonjs/Callout.d.ts.map +1 -1
  19. package/lib-commonjs/Callout.js +5 -2
  20. package/lib-commonjs/Callout.js.map +1 -1
  21. package/lib-commonjs/Callout.settings.macos.d.ts +4 -0
  22. package/lib-commonjs/Callout.settings.macos.d.ts.map +1 -0
  23. package/lib-commonjs/Callout.settings.macos.js +23 -0
  24. package/lib-commonjs/Callout.settings.macos.js.map +1 -0
  25. package/lib-commonjs/Callout.types.d.ts +9 -3
  26. package/lib-commonjs/Callout.types.d.ts.map +1 -1
  27. package/lib-commonjs/__tests__/Callout.test.d.ts +2 -0
  28. package/lib-commonjs/__tests__/Callout.test.d.ts.map +1 -0
  29. package/lib-commonjs/__tests__/{Callout.test.win32.js → Callout.test.js} +1 -1
  30. package/lib-commonjs/__tests__/Callout.test.js.map +1 -0
  31. package/macos/Callout.swift +320 -0
  32. package/macos/CalloutManager.swift +12 -0
  33. package/macos/CalloutWindow.swift +52 -0
  34. package/macos/FRNCalloutManager.h +4 -0
  35. package/macos/FRNCalloutManager.m +49 -0
  36. package/package.json +17 -15
  37. package/src/Callout.settings.macos.ts +22 -0
  38. package/src/Callout.tsx +6 -3
  39. package/src/Callout.types.ts +7 -13
  40. package/src/__tests__/{Callout.test.win32.tsx → Callout.test.tsx} +0 -0
  41. package/src/__tests__/__snapshots__/{Callout.test.win32.tsx.snap → Callout.test.tsx.snap} +0 -0
  42. package/lib/__tests__/Callout.test.win32.d.ts +0 -2
  43. package/lib/__tests__/Callout.test.win32.d.ts.map +0 -1
  44. package/lib/__tests__/Callout.test.win32.js.map +0 -1
  45. package/lib-commonjs/__tests__/Callout.test.win32.d.ts +0 -2
  46. package/lib-commonjs/__tests__/Callout.test.win32.d.ts.map +0 -1
  47. package/lib-commonjs/__tests__/Callout.test.win32.js.map +0 -1
package/.eslintrc.js CHANGED
@@ -1,5 +1,3 @@
1
1
  module.exports = {
2
- extends: [
3
- "@uifabricshared/eslint-config-rules"
4
- ]
5
- }
2
+ extends: ['@fluentui-react-native/eslint-config-rules'],
3
+ };
package/CHANGELOG.json CHANGED
@@ -2,7 +2,185 @@
2
2
  "name": "@fluentui-react-native/callout",
3
3
  "entries": [
4
4
  {
5
- "date": "Mon, 01 Nov 2021 18:51:49 GMT",
5
+ "date": "Thu, 16 Dec 2021 06:26:41 GMT",
6
+ "tag": "@fluentui-react-native/callout_v0.19.1",
7
+ "version": "0.19.1",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "sanajmi@microsoft.com",
12
+ "package": "@fluentui-react-native/callout",
13
+ "commit": "dd2f47a0a2d6aab7361301a16407c76497b45ce7",
14
+ "comment": "remove focus style overrides for macOS contextual menu items"
15
+ },
16
+ {
17
+ "author": "sanajmi@microsoft.com",
18
+ "package": "@fluentui-react-native/callout",
19
+ "commit": "e597717b14dce4916740076786391449dd4a7c69",
20
+ "comment": "Rename Jest snapshots to be platform agnostic "
21
+ },
22
+ {
23
+ "author": "sanajmi@microsoft.com",
24
+ "package": "@fluentui-react-native/callout",
25
+ "commit": "51cbf7c64d5c52feeec2e845cd4dbd4e23c96e1e",
26
+ "comment": "Add up/down arrow key support to macOS ContextualMenu"
27
+ },
28
+ {
29
+ "author": "beachball",
30
+ "package": "@fluentui-react-native/callout",
31
+ "comment": "Bump @fluentui-react-native/adapters to v0.8.1",
32
+ "commit": "841d2998e8b97fabe0b6dac9c74c3d63d2b3bbd4"
33
+ },
34
+ {
35
+ "author": "beachball",
36
+ "package": "@fluentui-react-native/callout",
37
+ "comment": "Bump @fluentui-react-native/interactive-hooks to v0.11.1",
38
+ "commit": "841d2998e8b97fabe0b6dac9c74c3d63d2b3bbd4"
39
+ },
40
+ {
41
+ "author": "beachball",
42
+ "package": "@fluentui-react-native/callout",
43
+ "comment": "Bump @fluentui-react-native/tokens to v0.11.1",
44
+ "commit": "841d2998e8b97fabe0b6dac9c74c3d63d2b3bbd4"
45
+ },
46
+ {
47
+ "author": "beachball",
48
+ "package": "@fluentui-react-native/callout",
49
+ "comment": "Bump @uifabricshared/foundation-compose to v1.11.1",
50
+ "commit": "841d2998e8b97fabe0b6dac9c74c3d63d2b3bbd4"
51
+ }
52
+ ]
53
+ }
54
+ },
55
+ {
56
+ "date": "Wed, 17 Nov 2021 19:28:07 GMT",
57
+ "tag": "@fluentui-react-native/callout_v0.19.0",
58
+ "version": "0.19.0",
59
+ "comments": {
60
+ "minor": [
61
+ {
62
+ "comment": "Update to react-native 0.64",
63
+ "author": "afoxman@microsoft.com",
64
+ "commit": "f16d742b5c2d5b97e49ac1ef7b740cbf89fc42e6",
65
+ "package": "@fluentui-react-native/callout"
66
+ }
67
+ ],
68
+ "patch": [
69
+ {
70
+ "comment": "Bump @fluentui-react-native/interactive-hooks to v0.11.0",
71
+ "author": "afoxman@microsoft.com",
72
+ "commit": "f16d742b5c2d5b97e49ac1ef7b740cbf89fc42e6",
73
+ "package": "@fluentui-react-native/callout"
74
+ },
75
+ {
76
+ "comment": "Bump @fluentui-react-native/tokens to v0.11.0",
77
+ "author": "afoxman@microsoft.com",
78
+ "commit": "f16d742b5c2d5b97e49ac1ef7b740cbf89fc42e6",
79
+ "package": "@fluentui-react-native/callout"
80
+ },
81
+ {
82
+ "comment": "Bump @fluentui-react-native/component-cache to v1.3.0",
83
+ "author": "afoxman@microsoft.com",
84
+ "commit": "f16d742b5c2d5b97e49ac1ef7b740cbf89fc42e6",
85
+ "package": "@fluentui-react-native/callout"
86
+ },
87
+ {
88
+ "comment": "Bump @uifabricshared/foundation-compose to v1.11.0",
89
+ "author": "afoxman@microsoft.com",
90
+ "commit": "f16d742b5c2d5b97e49ac1ef7b740cbf89fc42e6",
91
+ "package": "@fluentui-react-native/callout"
92
+ },
93
+ {
94
+ "comment": "Bump @uifabricshared/foundation-composable to v0.10.0",
95
+ "author": "afoxman@microsoft.com",
96
+ "commit": "f16d742b5c2d5b97e49ac1ef7b740cbf89fc42e6",
97
+ "package": "@fluentui-react-native/callout"
98
+ },
99
+ {
100
+ "comment": "Bump @uifabricshared/foundation-settings to v0.11.0",
101
+ "author": "afoxman@microsoft.com",
102
+ "commit": "f16d742b5c2d5b97e49ac1ef7b740cbf89fc42e6",
103
+ "package": "@fluentui-react-native/callout"
104
+ }
105
+ ]
106
+ }
107
+ },
108
+ {
109
+ "date": "Fri, 12 Nov 2021 16:07:20 GMT",
110
+ "tag": "@fluentui-react-native/callout_v0.18.1",
111
+ "version": "0.18.1",
112
+ "comments": {
113
+ "none": [
114
+ {
115
+ "comment": "Bump @fluentui-react-native/interactive-hooks to v0.10.54",
116
+ "author": "4123478+tido64@users.noreply.github.com",
117
+ "commit": "25673699e6c6c064b41f1246c2c995baa67a74ad",
118
+ "package": "@fluentui-react-native/callout"
119
+ }
120
+ ]
121
+ }
122
+ },
123
+ {
124
+ "date": "Thu, 11 Nov 2021 23:17:41 GMT",
125
+ "tag": "@fluentui-react-native/callout_v0.18.1",
126
+ "version": "0.18.1",
127
+ "comments": {
128
+ "none": [
129
+ {
130
+ "comment": "Rename uifabricshared/eslint-config-rules to fluentui-react-native/eslint-config-rules",
131
+ "author": "ruaraki@microsoft.com",
132
+ "commit": "110fba2a1721a914501404f6040f07656307549e",
133
+ "package": "@fluentui-react-native/callout"
134
+ }
135
+ ]
136
+ }
137
+ },
138
+ {
139
+ "date": "Tue, 09 Nov 2021 23:04:33 GMT",
140
+ "tag": "@fluentui-react-native/callout_v0.18.1",
141
+ "version": "0.18.1",
142
+ "comments": {
143
+ "patch": [
144
+ {
145
+ "comment": "Bump @uifabricshared/foundation-compose to v1.10.22",
146
+ "author": "67026167+chiuam@users.noreply.github.com",
147
+ "commit": "8baa72ed4ec06f90a51cf757e1924e946f76a537",
148
+ "package": "@fluentui-react-native/callout"
149
+ }
150
+ ]
151
+ }
152
+ },
153
+ {
154
+ "date": "Mon, 08 Nov 2021 20:52:15 GMT",
155
+ "tag": "@fluentui-react-native/callout_v0.18.0",
156
+ "version": "0.18.0",
157
+ "comments": {
158
+ "patch": [
159
+ {
160
+ "comment": "Bump macOS minimum version to 10.15",
161
+ "author": "sanajmi@microsoft.com",
162
+ "commit": "f6e7e6523713e641227f91113728da3d9816ef22",
163
+ "package": "@fluentui-react-native/callout"
164
+ },
165
+ {
166
+ "comment": "Use \"FRN\" prefix over \"RCT\" for macOS Callout native code",
167
+ "author": "sanajmi@microsoft.com",
168
+ "commit": "10d9d09b2af1bf71ff4253cc17e536dd6d8bfae1",
169
+ "package": "@fluentui-react-native/callout"
170
+ }
171
+ ],
172
+ "minor": [
173
+ {
174
+ "comment": "Added macOS support",
175
+ "author": "sanajmi@microsoft.com",
176
+ "commit": "ae20d8c84bb0f87703d2fa4d16b54abbea4c5b90",
177
+ "package": "@fluentui-react-native/callout"
178
+ }
179
+ ]
180
+ }
181
+ },
182
+ {
183
+ "date": "Mon, 01 Nov 2021 18:53:37 GMT",
6
184
  "tag": "@fluentui-react-native/callout_v0.17.29",
7
185
  "version": "0.17.29",
8
186
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,64 @@
1
1
  # Change Log - @fluentui-react-native/callout
2
2
 
3
- This log was last generated on Mon, 01 Nov 2021 18:51:49 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 16 Dec 2021 06:26:41 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## 0.19.1
8
+
9
+ Thu, 16 Dec 2021 06:26:41 GMT
10
+
11
+ ### Patches
12
+
13
+ - remove focus style overrides for macOS contextual menu items (sanajmi@microsoft.com)
14
+ - Rename Jest snapshots to be platform agnostic (sanajmi@microsoft.com)
15
+ - Add up/down arrow key support to macOS ContextualMenu (sanajmi@microsoft.com)
16
+ - Bump @fluentui-react-native/adapters to v0.8.1
17
+ - Bump @fluentui-react-native/interactive-hooks to v0.11.1
18
+ - Bump @fluentui-react-native/tokens to v0.11.1
19
+ - Bump @uifabricshared/foundation-compose to v1.11.1
20
+
21
+ ## 0.19.0
22
+
23
+ Wed, 17 Nov 2021 19:28:07 GMT
24
+
25
+ ### Minor changes
26
+
27
+ - Update to react-native 0.64 (afoxman@microsoft.com)
28
+
29
+ ### Patches
30
+
31
+ - Bump @fluentui-react-native/interactive-hooks to v0.11.0 (afoxman@microsoft.com)
32
+ - Bump @fluentui-react-native/tokens to v0.11.0 (afoxman@microsoft.com)
33
+ - Bump @fluentui-react-native/component-cache to v1.3.0 (afoxman@microsoft.com)
34
+ - Bump @uifabricshared/foundation-compose to v1.11.0 (afoxman@microsoft.com)
35
+ - Bump @uifabricshared/foundation-composable to v0.10.0 (afoxman@microsoft.com)
36
+ - Bump @uifabricshared/foundation-settings to v0.11.0 (afoxman@microsoft.com)
37
+
38
+ ## 0.18.1
39
+
40
+ Tue, 09 Nov 2021 23:04:33 GMT
41
+
42
+ ### Patches
43
+
44
+ - Bump @uifabricshared/foundation-compose to v1.10.22 (67026167+chiuam@users.noreply.github.com)
45
+
46
+ ## 0.18.0
47
+
48
+ Mon, 08 Nov 2021 20:52:15 GMT
49
+
50
+ ### Minor changes
51
+
52
+ - Added macOS support (sanajmi@microsoft.com)
53
+
54
+ ### Patches
55
+
56
+ - Bump macOS minimum version to 10.15 (sanajmi@microsoft.com)
57
+ - Use "FRN" prefix over "RCT" for macOS Callout native code (sanajmi@microsoft.com)
58
+
7
59
  ## 0.17.29
8
60
 
9
- Mon, 01 Nov 2021 18:51:49 GMT
61
+ Mon, 01 Nov 2021 18:53:37 GMT
10
62
 
11
63
  ### Patches
12
64
 
@@ -0,0 +1,23 @@
1
+ require 'json'
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
+
5
+ Pod::Spec.new do |s|
6
+ s.name = 'FRNCallout'
7
+ s.version = package['version']
8
+ s.summary = package['description']
9
+ s.license = package['license']
10
+
11
+ s.authors = package['author']
12
+ s.homepage = "https://github.com/microsoft/fluentui-react-native"
13
+
14
+ s.source = { :git => "https://github.com/microsoft/fluentui-react-native.git", :tag => "#{s.version}" }
15
+ s.swift_version = "5"
16
+
17
+ s.pod_target_xcconfig = { 'BUILD_LIBRARY_FOR_DISTRIBUTION' => 'YES', 'OTHER_SWIFT_FLAGS' => '-gline-tables-only' }
18
+
19
+ s.osx.deployment_target = "10.15"
20
+ s.osx.source_files = "macos/*.{swift,h,m}"
21
+
22
+ s.dependency 'React'
23
+ end
@@ -1 +1 @@
1
- {"version":3,"file":"Callout.d.ts","sourceRoot":"","sources":["../src/Callout.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAe,aAAa,EAAE,iBAAiB,EAAgB,MAAM,iBAAiB,CAAC;AAK9F,eAAO,MAAM,OAAO,6JAkClB,CAAC;AAEH,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"Callout.d.ts","sourceRoot":"","sources":["../src/Callout.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAe,aAAa,EAAE,iBAAiB,EAAgB,MAAM,iBAAiB,CAAC;AAQ9F,eAAO,MAAM,OAAO,6JAkClB,CAAC;AAEH,eAAe,OAAO,CAAC"}
package/lib/Callout.js CHANGED
@@ -25,11 +25,14 @@ import { backgroundColorTokens, borderTokens } from '@fluentui-react-native/toke
25
25
  import { compose } from '@uifabricshared/foundation-compose';
26
26
  import { mergeSettings } from '@uifabricshared/foundation-settings';
27
27
  import * as React from 'react';
28
- import { findNodeHandle } from 'react-native';
28
+ import { findNodeHandle, Platform } from 'react-native';
29
29
  import { settings } from './Callout.settings';
30
30
  import { calloutName } from './Callout.types';
31
31
  import { ensureNativeComponent } from '@fluentui-react-native/component-cache';
32
- var RCTCallout = ensureNativeComponent('RCTCallout');
32
+ var NativeCalloutView = Platform.select({
33
+ macos: ensureNativeComponent('FRNCallout'),
34
+ default: ensureNativeComponent('RCTCallout'),
35
+ });
33
36
  export var Callout = compose({
34
37
  displayName: calloutName,
35
38
  usePrepareProps: function (props, useStyling) {
@@ -53,7 +56,7 @@ export var Callout = compose({
53
56
  },
54
57
  settings: settings,
55
58
  slots: {
56
- root: RCTCallout,
59
+ root: NativeCalloutView,
57
60
  },
58
61
  styles: {
59
62
  root: [backgroundColorTokens, borderTokens],
@@ -1 +1 @@
1
- {"version":3,"file":"Callout.js","sourceRoot":"","sources":["../src/Callout.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AACpF,OAAO,EAAE,OAAO,EAAsB,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAkD,MAAM,iBAAiB,CAAC;AAC9F,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAE/E,IAAM,UAA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b,IAAM,SAAS,GAAG,aAAa,CAAoB,UAAU,CAAC,KAAK,CAAC,EAAE;YACpE,IAAI,sBACF,GAAG,EAAE,UAAU,IACZ,CAAC,YAAY,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,GAC1C,IAAI,CACR;SACF,CAAC,CAAC;QAEH,OAAO,EAAE,SAAS,WAAA,EAAE,CAAC;IACvB,CAAC;IACD,QAAQ,EAAE,QAAQ;IAClB,KAAK,EAAE;QACL,IAAI,EAAE,iBAAiB;KACxB;IACD,MAAM,EAAE;QACN,IAAI,EAAE,CAAC,qBAAqB,EAAE,YAAY,CAAC;KAC5C;CACF,CAAC,CAAC;AAEH,eAAe,OAAO,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { ICalloutType } from './Callout.types';
2
+ import { IComposeSettings } from '@uifabricshared/foundation-compose';
3
+ export declare const settings: IComposeSettings<ICalloutType>;
4
+ //# sourceMappingURL=Callout.settings.macos.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Callout.settings.macos.d.ts","sourceRoot":"","sources":["../src/Callout.settings.macos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAEtE,eAAO,MAAM,QAAQ,EAAE,gBAAgB,CAAC,YAAY,CAkBnD,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { calloutName } from './Callout.types';
2
+ export var settings = [
3
+ {
4
+ tokens: {
5
+ backgroundColor: 'bodyStandoutBackground',
6
+ beakWidth: 20,
7
+ borderColor: 'bodyFrameBackground',
8
+ borderWidth: 1,
9
+ directionalHint: 'bottonLeftEdge',
10
+ gapSpace: 0,
11
+ minPadding: 0,
12
+ },
13
+ root: {
14
+ style: {
15
+ position: 'absolute',
16
+ },
17
+ },
18
+ },
19
+ calloutName,
20
+ ];
21
+ //# sourceMappingURL=Callout.settings.macos.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Callout.settings.macos.js","sourceRoot":"","sources":["../src/Callout.settings.macos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,iBAAiB,CAAC;AAG5D,MAAM,CAAC,IAAM,QAAQ,GAAmC;IACtD;QACE,MAAM,EAAE;YACN,eAAe,EAAE,wBAAwB;YACzC,SAAS,EAAE,EAAE;YACb,WAAW,EAAE,qBAAqB;YAClC,WAAW,EAAE,CAAC;YACd,eAAe,EAAE,gBAAgB;YACjC,QAAQ,EAAE,CAAC;YACX,UAAU,EAAE,CAAC;SACd;QACD,IAAI,EAAE;YACJ,KAAK,EAAE;gBACL,QAAQ,EAAE,UAAU;aACrB;SACF;KACF;IACD,WAAW;CACZ,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { ScreenRect, ViewStyle } from 'react-native';
3
+ import { IViewProps } from '@fluentui-react-native/adapters';
3
4
  import { IRenderData } from '@uifabricshared/foundation-composable';
4
5
  import { IBackgroundColorTokens, IBorderTokens } from '@fluentui-react-native/tokens';
5
6
  import { IFocusable } from '@fluentui-react-native/interactive-hooks';
@@ -68,15 +69,18 @@ export interface ICalloutTokens extends IBackgroundColorTokens, CalloutBorderTok
68
69
  */
69
70
  minPadding?: number;
70
71
  }
71
- export interface ICalloutProps extends ICalloutTokens {
72
- accessibilityLabel?: string;
72
+ export interface ICalloutProps extends IViewProps, ICalloutTokens {
73
+ /**
74
+ * @platform win32
75
+ * A string that should be announced when the callout is shown.
76
+ */
73
77
  accessibilityOnShowAnnouncement?: string;
74
- accessibilityRole?: string;
75
78
  /**
76
79
  * A RefObject to access the IFocusable interface. Use this to access the public methods and properties of the component.
77
80
  */
78
81
  componentRef?: React.RefObject<IFocusable>;
79
82
  /**
83
+ * @platform win32
80
84
  * Adds a beak to the Callout, pointing to the anchor target.
81
85
  * Notable Win32 limitation: Beak rendering currently limits the border width to its default, and the
82
86
  * border width prop will not be honored.
@@ -87,6 +91,7 @@ export interface ICalloutProps extends ICalloutTokens {
87
91
  */
88
92
  onDismiss?: () => void;
89
93
  /**
94
+ * @platform win32
90
95
  * Callback invoked during callout dismissal; if set, focus will not be restored by the callout and onRestoreFocus must
91
96
  * result in focus being moved to the appropriate focusable target.
92
97
  *
@@ -102,6 +107,7 @@ export interface ICalloutProps extends ICalloutTokens {
102
107
  */
103
108
  onShow?: () => void;
104
109
  /**
110
+ * @platform win32
105
111
  * If true then the callout will attempt to focus the first focusable element that it contains.
106
112
  * If it doesn't find an element, no focus will be set. This means that it's the contents responsibility
107
113
  * to either set focus or have focusable items.
@@ -1 +1 @@
1
- {"version":3,"file":"Callout.types.d.ts","sourceRoot":"","sources":["../src/Callout.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,eAAO,MAAM,WAAW,YAAY,CAAC;AAErC;;GAEG;AAEH,oBAAY,eAAe,GACvB,aAAa,GACb,YAAY,GACZ,gBAAgB,GAChB,aAAa,GACb,aAAa,GACb,WAAW,GACX,cAAc,GACd,cAAc,GACd,aAAa,GACb,iBAAiB,GACjB,gBAAgB,GAChB,gBAAgB,GAChB,cAAc,GACd,iBAAiB,CAAC;AAEtB,oBAAY,gBAAgB,GAAG,yBAAyB,GAAG,8BAA8B,CAAC;AAE1F,MAAM,WAAW,iBAAiB;IAChC,WAAW,EAAE;QACX;;WAEG;QACH,aAAa,EAAE,OAAO,CAAC;KACxB,CAAC;CACH;AAED,UAAU,mBAAmB;IAC3B,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,WAAW,CAAC,EAAE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ACrB,CAAC;AAEF,oBAAY,kBAAkB,GAAG,WAAW,CAAC,iBAAiB,CAAC,CAAC;AAEhE,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,iBAAiB,CAAC;IAC7B,MAAM,EAAE,cAAc,CAAC;CACxB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Callout.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Callout.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/Callout.test.tsx"],"names":[],"mappings":""}
@@ -5,4 +5,4 @@ it('Callout default props', function () {
5
5
  var tree = renderer.create(React.createElement(Callout, null)).toJSON();
6
6
  expect(tree).toMatchSnapshot();
7
7
  });
8
- //# sourceMappingURL=Callout.test.win32.js.map
8
+ //# sourceMappingURL=Callout.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Callout.test.js","sourceRoot":"","sources":["../../src/__tests__/Callout.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAEhD,EAAE,CAAC,uBAAuB,EAAE;IAC1B,IAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,oBAAC,OAAO,OAAG,CAAC,CAAC,MAAM,EAAE,CAAC;IACnD,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;AACjC,CAAC,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Callout.d.ts","sourceRoot":"","sources":["../src/Callout.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAe,aAAa,EAAE,iBAAiB,EAAgB,MAAM,iBAAiB,CAAC;AAK9F,eAAO,MAAM,OAAO,6JAkClB,CAAC;AAEH,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"Callout.d.ts","sourceRoot":"","sources":["../src/Callout.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAe,aAAa,EAAE,iBAAiB,EAAgB,MAAM,iBAAiB,CAAC;AAQ9F,eAAO,MAAM,OAAO,6JAkClB,CAAC;AAEH,eAAe,OAAO,CAAC"}
@@ -38,7 +38,10 @@ var react_native_1 = require("react-native");
38
38
  var Callout_settings_1 = require("./Callout.settings");
39
39
  var Callout_types_1 = require("./Callout.types");
40
40
  var component_cache_1 = require("@fluentui-react-native/component-cache");
41
- var RCTCallout = component_cache_1.ensureNativeComponent('RCTCallout');
41
+ var NativeCalloutView = react_native_1.Platform.select({
42
+ macos: component_cache_1.ensureNativeComponent('FRNCallout'),
43
+ default: component_cache_1.ensureNativeComponent('RCTCallout'),
44
+ });
42
45
  exports.Callout = foundation_compose_1.compose({
43
46
  displayName: Callout_types_1.calloutName,
44
47
  usePrepareProps: function (props, useStyling) {
@@ -62,7 +65,7 @@ exports.Callout = foundation_compose_1.compose({
62
65
  },
63
66
  settings: Callout_settings_1.settings,
64
67
  slots: {
65
- root: RCTCallout,
68
+ root: NativeCalloutView,
66
69
  },
67
70
  styles: {
68
71
  root: [tokens_1.backgroundColorTokens, tokens_1.borderTokens],
@@ -1 +1 @@
1
- {"version":3,"file":"Callout.js","sourceRoot":"","sources":["../src/Callout.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8EAA+E;AAC/E,wDAAoF;AACpF,yEAAiF;AACjF,2EAAoE;AACpE,2CAA+B;AAC/B,6CAA8C;AAC9C,uDAA8C;AAC9C,iDAA8F;AAC9F,0EAA+E;AAE/E,IAAM,UAAU,GAAG,uCAAqB,CAAC,YAAY,CAAC,CAAC;AAE1C,QAAA,OAAO,GAAG,4BAAO,CAAe;IAC3C,WAAW,EAAE,2BAAW;IACxB,eAAe,EAAE,UAAC,KAAoB,EAAE,UAA4C;QAC1E,IAAA,iCAAY,EAAE,qBAAM,EAAE,gDAAO,CAAW;QAChD,IAA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AO,EAAE,uCAAqB,CAAC,YAAY,CAAC;CAC7C,CAAC,CAAC;AAEU,QAAA,OAAO,GAAG,4BAAO,CAAe;IAC3C,WAAW,EAAE,2BAAW;IACxB,eAAe,EAAE,UAAC,KAAoB,EAAE,UAA4C;QAC1E,IAAA,iCAAY,EAAE,qBAAM,EAAE,gDAAO,CAAW;QAChD,IAAM,UAAU,GAAG,uCAAmB,CAAC,YAAY,CAAC,CAAC;QAC/C,IAAA,yBAA8E,EAA7E,oBAAY,EAAE,uBAA+D,CAAC;QAErF,KAAK,CAAC,eAAe,CAAC;YACpB,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;gBAC9B,qCAAqC;gBACrC,eAAe,CAAC,MAAM,CAAC,CAAC;aACzB;iBAAM,IAAI,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,EAAE;gBAC1B,0CAA0C;gBAC1C,eAAe,CAAC,6BAAc,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;aACjD;QACH,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QAEb,IAAM,SAAS,GAAG,mCAAa,CAAoB,UAAU,CAAC,KAAK,CAAC,EAAE;YACpE,IAAI,sBACF,GAAG,EAAE,UAAU,IACZ,CAAC,YAAY,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC,GAC1C,IAAI,CACR;SACF,CAAC,CAAC;QAEH,OAAO,EAAE,SAAS,WAAA,EAAE,CAAC;IACvB,CAAC;IACD,QAAQ,EAAE,2BAAQ;IAClB,KAAK,EAAE;QACL,IAAI,EAAE,iBAAiB;KACxB;IACD,MAAM,EAAE;QACN,IAAI,EAAE,CAAC,8BAAqB,EAAE,qBAAY,CAAC;KAC5C;CACF,CAAC,CAAC;AAEH,kBAAe,eAAO,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { ICalloutType } from './Callout.types';
2
+ import { IComposeSettings } from '@uifabricshared/foundation-compose';
3
+ export declare const settings: IComposeSettings<ICalloutType>;
4
+ //# sourceMappingURL=Callout.settings.macos.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Callout.settings.macos.d.ts","sourceRoot":"","sources":["../src/Callout.settings.macos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAEtE,eAAO,MAAM,QAAQ,EAAE,gBAAgB,CAAC,YAAY,CAkBnD,CAAC"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var Callout_types_1 = require("./Callout.types");
4
+ exports.settings = [
5
+ {
6
+ tokens: {
7
+ backgroundColor: 'bodyStandoutBackground',
8
+ beakWidth: 20,
9
+ borderColor: 'bodyFrameBackground',
10
+ borderWidth: 1,
11
+ directionalHint: 'bottonLeftEdge',
12
+ gapSpace: 0,
13
+ minPadding: 0,
14
+ },
15
+ root: {
16
+ style: {
17
+ position: 'absolute',
18
+ },
19
+ },
20
+ },
21
+ Callout_types_1.calloutName,
22
+ ];
23
+ //# sourceMappingURL=Callout.settings.macos.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Callout.settings.macos.js","sourceRoot":"","sources":["../src/Callout.settings.macos.ts"],"names":[],"mappings":";;AAAA,iDAA4D;AAG/C,QAAA,QAAQ,GAAmC;IACtD;QACE,MAAM,EAAE;YACN,eAAe,EAAE,wBAAwB;YACzC,SAAS,EAAE,EAAE;YACb,WAAW,EAAE,qBAAqB;YAClC,WAAW,EAAE,CAAC;YACd,eAAe,EAAE,gBAAgB;YACjC,QAAQ,EAAE,CAAC;YACX,UAAU,EAAE,CAAC;SACd;QACD,IAAI,EAAE;YACJ,KAAK,EAAE;gBACL,QAAQ,EAAE,UAAU;aACrB;SACF;KACF;IACD,2BAAW;CACZ,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { ScreenRect, ViewStyle } from 'react-native';
3
+ import { IViewProps } from '@fluentui-react-native/adapters';
3
4
  import { IRenderData } from '@uifabricshared/foundation-composable';
4
5
  import { IBackgroundColorTokens, IBorderTokens } from '@fluentui-react-native/tokens';
5
6
  import { IFocusable } from '@fluentui-react-native/interactive-hooks';
@@ -68,15 +69,18 @@ export interface ICalloutTokens extends IBackgroundColorTokens, CalloutBorderTok
68
69
  */
69
70
  minPadding?: number;
70
71
  }
71
- export interface ICalloutProps extends ICalloutTokens {
72
- accessibilityLabel?: string;
72
+ export interface ICalloutProps extends IViewProps, ICalloutTokens {
73
+ /**
74
+ * @platform win32
75
+ * A string that should be announced when the callout is shown.
76
+ */
73
77
  accessibilityOnShowAnnouncement?: string;
74
- accessibilityRole?: string;
75
78
  /**
76
79
  * A RefObject to access the IFocusable interface. Use this to access the public methods and properties of the component.
77
80
  */
78
81
  componentRef?: React.RefObject<IFocusable>;
79
82
  /**
83
+ * @platform win32
80
84
  * Adds a beak to the Callout, pointing to the anchor target.
81
85
  * Notable Win32 limitation: Beak rendering currently limits the border width to its default, and the
82
86
  * border width prop will not be honored.
@@ -87,6 +91,7 @@ export interface ICalloutProps extends ICalloutTokens {
87
91
  */
88
92
  onDismiss?: () => void;
89
93
  /**
94
+ * @platform win32
90
95
  * Callback invoked during callout dismissal; if set, focus will not be restored by the callout and onRestoreFocus must
91
96
  * result in focus being moved to the appropriate focusable target.
92
97
  *
@@ -102,6 +107,7 @@ export interface ICalloutProps extends ICalloutTokens {
102
107
  */
103
108
  onShow?: () => void;
104
109
  /**
110
+ * @platform win32
105
111
  * If true then the callout will attempt to focus the first focusable element that it contains.
106
112
  * If it doesn't find an element, no focus will be set. This means that it's the contents responsibility
107
113
  * to either set focus or have focusable items.
@@ -1 +1 @@
1
- {"version":3,"file":"Callout.types.d.ts","sourceRoot":"","sources":["../src/Callout.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,SAAS,EA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AC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAc,SAAQ,UAAU,EAAE,cAAc;IAC/D;;;OAGG;IACH,+BAA+B,CAAC,EAAE,MAAM,CAAC;IAEzC;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAE3C;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IAEvB;;;;;;;;;;OAUG;IACH,cAAc,CAAC,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAEhE;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IAEpB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;;OAIG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC;CACpD;AAED,oBAAY,iBAAiB,GAAG;IAC9B,IAAI,EAAE,aAAa,CAAC;CACrB,CAAC;AAEF,oBAAY,kBAAkB,GAAG,WAAW,CAAC,iBAAiB,CAAC,CAAC;AAEhE,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,iBAAiB,CAAC;IAC7B,MAAM,EAAE,cAAc,CAAC;CACxB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Callout.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Callout.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/Callout.test.tsx"],"names":[],"mappings":""}
@@ -14,4 +14,4 @@ it('Callout default props', function () {
14
14
  var tree = renderer.create(React.createElement(__1.Callout, null)).toJSON();
15
15
  expect(tree).toMatchSnapshot();
16
16
  });
17
- //# sourceMappingURL=Callout.test.win32.js.map
17
+ //# sourceMappingURL=Callout.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Callout.test.js","sourceRoot":"","sources":["../../src/__tests__/Callout.test.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA+B;AAC/B,wBAA6B;AAC7B,4DAAgD;AAEhD,EAAE,CAAC,uBAAuB,EAAE;IAC1B,IAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,oBAAC,WAAO,OAAG,CAAC,CAAC,MAAM,EAAE,CAAC;IACnD,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;AACjC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,320 @@
1
+ import Foundation
2
+ import AppKit
3
+
4
+ @objc(FRNCalloutView)
5
+ class CalloutView: RCTView, CalloutWindowLifeCycleDelegate {
6
+
7
+ @objc public var target: NSNumber? {
8
+ didSet {
9
+ guard let targetView = bridge?.uiManager.view(forReactTag: target) else {
10
+ preconditionFailure("Invalid target react tag")
11
+ }
12
+ anchorView = targetView
13
+ updateCalloutFrameToAnchor()
14
+ }
15
+ }
16
+
17
+ @objc public var anchorRect: NSRect = .null {
18
+ didSet {
19
+ updateCalloutFrameToAnchor()
20
+ }
21
+ }
22
+
23
+ @objc public var directionalHint: NSRectEdge = .maxY {
24
+ didSet {
25
+ updateCalloutFrameToAnchor()
26
+ }
27
+ }
28
+
29
+ @objc public var onShow: RCTBubblingEventBlock?
30
+
31
+ @objc public var onDismiss: RCTBubblingEventBlock?
32
+
33
+ public weak var bridge: RCTBridge?
34
+
35
+ private init() {
36
+ super.init(frame: .zero)
37
+ }
38
+
39
+ required init?(coder: NSCoder) {
40
+ preconditionFailure()
41
+ }
42
+
43
+ convenience init(bridge: RCTBridge) {
44
+ self.init()
45
+ self.bridge = bridge
46
+ }
47
+
48
+ override func viewDidMoveToWindow() {
49
+ super.viewDidMoveToWindow()
50
+ if (window != nil) {
51
+ showCallout()
52
+ } else {
53
+ dismissCallout()
54
+ }
55
+ }
56
+
57
+
58
+ // MARK: RCTComponent Overrides
59
+
60
+ override func insertReactSubview(_ subview: NSView!, at atIndex: Int) {
61
+ /*
62
+ If we attach a touch handler to the proxy view directly, the touch coordinates
63
+ are incorrect and the wrong subview recieves the touch event, most likely
64
+ because macOS screen coordinates have a flipped Y axis. The workaround is to
65
+ attach a separate touch handler to each subview
66
+ */
67
+ guard let touchHandler = RCTTouchHandler(bridge: bridge) else {
68
+ preconditionFailure("Callout could not create RCTTouchHandler")
69
+ }
70
+ touchHandler.attach(to: subview as? RCTUIView)
71
+
72
+ proxyView.insertReactSubview(subview, at: atIndex)
73
+ }
74
+
75
+ override func didUpdateReactSubviews() {
76
+ proxyView.didUpdateReactSubviews()
77
+ }
78
+
79
+ override func reactSetFrame(_ frame: CGRect) {
80
+ proxyView.reactSetFrame(frame)
81
+ updateCalloutFrameToAnchor()
82
+ }
83
+
84
+ // MARK: WindowLifeCycleDelegate
85
+
86
+ func didDetectHitOutsideCallout(calloutWindow: CalloutWindow) {
87
+ dismissCallout()
88
+ }
89
+
90
+ func applicationDidResignActiveForCalloutWindow(calloutWindow: CalloutWindow) {
91
+ dismissCallout()
92
+ }
93
+
94
+ // MARK: Private methods
95
+
96
+ private func showCallout() {
97
+ updateCalloutFrameToAnchor()
98
+ calloutWindow.makeKeyAndOrderFront(self)
99
+ didShowCallout()
100
+ }
101
+
102
+ private func dismissCallout() {
103
+ calloutWindow.close()
104
+ didDismissCallout()
105
+ }
106
+
107
+ /// Sets the frame of the Callout Window (in screen coordinates to be off of the Anchor on the preferred edge
108
+ private func updateCalloutFrameToAnchor() {
109
+ guard window != nil else {
110
+ return
111
+ }
112
+
113
+ // Prefer anchorRect over anchorView if available
114
+ let anchorScreenRect = anchorRect.equalTo(.null) ? calculateAnchorViewScreenRect() : calculateAnchorRectScreenRect()
115
+ let calloutScreenRect = bestCalloutRect(relativeTo: anchorScreenRect)
116
+
117
+ calloutWindow.setFrame(calloutScreenRect, display: false)
118
+ }
119
+
120
+ /// Calculates the NSRect of the Anchor Rect in screen coordinates
121
+ private func calculateAnchorRectScreenRect() -> NSRect {
122
+ guard let window = window else {
123
+ preconditionFailure("No window found")
124
+ }
125
+
126
+ guard let screenFrame = window.screen?.visibleFrame ?? NSScreen.main?.visibleFrame else {
127
+ preconditionFailure("No screen Available")
128
+ }
129
+
130
+ // The anchor Rect is given in the coordinate space of the root view.
131
+ // Find the root view to convert to screen coordinates
132
+ var rootView: NSView = self
133
+ while (!rootView.isReactRootView()) {
134
+ rootView = rootView.reactSuperview()
135
+ }
136
+ let rootViewBoundsInWindow = rootView.convert(rootView.bounds, to: nil)
137
+ let rootViewRectInScreenCoordinates = window.convertToScreen(rootViewBoundsInWindow)
138
+
139
+ // macOS uses a flipped Y coordinate (I.E: (0,0) is on the bottom left of the screen). However,
140
+ // React Native assumes a standard Y coordinate. Let's flip the Y coordinate of our rect to match
141
+ let anchorScreenRectOrigin = NSPoint(
142
+ x: rootViewRectInScreenCoordinates.origin.x + self.anchorRect.origin.x,
143
+ y: screenFrame.height - (rootViewRectInScreenCoordinates.origin.y + self.anchorRect.origin.y)
144
+ )
145
+ let anchorRectInScreenCoordinates = NSRect(origin: anchorScreenRectOrigin, size: anchorRect.size)
146
+
147
+ return anchorRectInScreenCoordinates
148
+ }
149
+
150
+ /// Calculates the NSRect of the anchorView in the coordinate space of the current screen
151
+ private func calculateAnchorViewScreenRect() -> NSRect {
152
+ guard let anchorView = anchorView else {
153
+ preconditionFailure("No anchor view provided to position the Callout")
154
+ }
155
+
156
+ guard let window = window else {
157
+ preconditionFailure("No window found")
158
+ }
159
+
160
+ let anchorBoundsInWindow = anchorView.convert(anchorView.bounds, to: nil)
161
+ let anchorFrameInScreenCoordinates = window.convertToScreen(anchorBoundsInWindow)
162
+
163
+ return anchorFrameInScreenCoordinates
164
+ }
165
+
166
+ /// Calculates the rect in screen coordinates the callout should be positioned in relative to the anchor rect, adjusting if we are close to a screen edge
167
+ private func bestCalloutRect(relativeTo anchorScreenRect: NSRect) -> NSRect {
168
+
169
+ guard let screenFrame = window?.screen?.visibleFrame ?? NSScreen.main?.visibleFrame else {
170
+ preconditionFailure("No Screen Available")
171
+ }
172
+
173
+ let calloutFrame = proxyView.frame
174
+
175
+ // Find our preferred origin based on the directional hint
176
+ let calloutOrigin: NSPoint = {
177
+ var origin = NSPoint()
178
+
179
+ switch(directionalHint) {
180
+ case .minX:
181
+ origin.x = NSMinX(anchorScreenRect) - calloutFrame.size.width
182
+ origin.y = NSMaxY(anchorScreenRect) - calloutFrame.size.height
183
+ case .minY:
184
+ origin.x = NSMinX(anchorScreenRect)
185
+ origin.y = NSMaxY(anchorScreenRect)
186
+ case .maxX:
187
+ origin.x = NSMaxX(anchorScreenRect)
188
+ origin.y = NSMaxY(anchorScreenRect) - calloutFrame.size.height
189
+ case .maxY:
190
+ // When in RTL mode, align the right edges of the menu and flyout anchor
191
+ if (NSApp.userInterfaceLayoutDirection == .rightToLeft) {
192
+ origin.x = NSMaxX(anchorScreenRect) - calloutFrame.size.width
193
+ } else {
194
+ origin.x = NSMinX(anchorScreenRect);
195
+ }
196
+ origin.y = NSMinY(anchorScreenRect) - calloutFrame.size.height
197
+ @unknown default:
198
+ preconditionFailure("Unknown directional hint")
199
+ }
200
+ return origin
201
+ }()
202
+
203
+ var calloutScreenRect = NSRect(origin: calloutOrigin, size: calloutFrame.size)
204
+
205
+ // Reposition the callout if it doesn't fit on screen
206
+ if (!NSContainsRect(screenFrame, calloutScreenRect)) {
207
+ switch(directionalHint) {
208
+ case .minX:
209
+ // If we go off the left edge, we may need to flip to presenting rightward from the rightEdge of anchorScreenRect
210
+ if (NSMinX(calloutScreenRect) < NSMinX(screenFrame)) {
211
+ let maxXEdgeSpace = NSMaxX(screenFrame) - NSMaxX(anchorScreenRect)
212
+ let minXEdgeSpace = NSMinX(anchorScreenRect) - NSMinX(screenFrame)
213
+ if (maxXEdgeSpace > minXEdgeSpace) {
214
+ calloutScreenRect.origin.x = NSMaxX(anchorScreenRect);
215
+ }
216
+ }
217
+ // If we go off the bottom of the screen, just slide up until we fit
218
+ if (NSMinY(calloutScreenRect) < NSMinY(screenFrame)) {
219
+ calloutScreenRect.origin.y = NSMinY(screenFrame)
220
+ }
221
+ case .minY:
222
+ // If we go off the top of the screen, check if there's more room on screen below the anchorScreenRect.
223
+ if (NSMaxY(calloutScreenRect) > NSMaxY(screenFrame)) {
224
+ let maxYEdgeSpace = NSMaxY(screenFrame) - NSMaxY(anchorScreenRect)
225
+ let minYEdgeSpace = NSMinY(anchorScreenRect) - NSMinY(screenFrame)
226
+
227
+ // Flip to presenting below anchorScreenRect
228
+ if (minYEdgeSpace > maxYEdgeSpace) {
229
+ calloutScreenRect.origin.y = NSMinY(anchorScreenRect) - NSHeight(calloutScreenRect)
230
+ }
231
+ }
232
+ // If we go off the right edge, just slide to the left until we fit
233
+ if (NSMaxX(calloutScreenRect) > NSMaxX(screenFrame)) {
234
+ calloutScreenRect.origin.x = NSMaxY(screenFrame) - NSWidth(calloutScreenRect)
235
+ }
236
+ case .maxX:
237
+ // If we go off the right edge, we may need to flip to presenting leftward from the leftEdge of anchorScreenRect
238
+ if (NSMaxX(calloutScreenRect) > NSMaxX(screenFrame)) {
239
+ let maxXEdgeSpace = NSMaxX(screenFrame) - NSMaxX(anchorScreenRect)
240
+ let minXEdgeSpace = NSMinX(anchorScreenRect) - NSMinX(screenFrame)
241
+ if (minXEdgeSpace > maxXEdgeSpace) {
242
+ calloutScreenRect.origin.x = NSMinX(anchorScreenRect) - NSWidth(calloutScreenRect)
243
+ }
244
+ }
245
+ // If we go off the bottom of the screen, just slide up until we fit
246
+ if (NSMinY(calloutScreenRect) < NSMinY(screenFrame)) {
247
+ calloutScreenRect.origin.y = NSMinY(screenFrame);
248
+ }
249
+ case .maxY:
250
+ // If we go off the bottom of the screen, check if there's more room on screen above the anchorScreenRect.
251
+ if (NSMinY(calloutScreenRect) < NSMinY(screenFrame)) {
252
+ let maxYEdgeSpace = NSMaxY(screenFrame) - NSMaxY(anchorScreenRect)
253
+ let minYEdgeSpace = NSMinY(anchorScreenRect) - NSMinY(screenFrame)
254
+
255
+ // Flip to presenting above anchorScreenRect
256
+ if (maxYEdgeSpace > minYEdgeSpace) {
257
+ calloutScreenRect.origin.y = NSMaxY(anchorScreenRect)
258
+ }
259
+ }
260
+ // If we go off the right edge, just slide to the left until we fit
261
+ if (NSMaxX(calloutScreenRect) > NSMaxX(screenFrame)) {
262
+ calloutScreenRect.origin.x = NSMaxX(screenFrame) - NSWidth(calloutScreenRect)
263
+ }
264
+ @unknown default:
265
+ preconditionFailure("Unknown directional hint")
266
+ }
267
+ }
268
+ return calloutScreenRect
269
+ }
270
+
271
+ private func didShowCallout() {
272
+ onShow?([:])
273
+ }
274
+
275
+ private func didDismissCallout() {
276
+ if let onDismiss = onDismiss {
277
+ guard let reactTag = reactTag else {
278
+ preconditionFailure("React Tag missing")
279
+ }
280
+ let event: [AnyHashable: Any] = ["target": reactTag]
281
+ onDismiss(event)
282
+ }
283
+ }
284
+
285
+ // MARK: Private variables
286
+
287
+ private var anchorView: NSView?
288
+
289
+ private var proxyView: RCTView = RCTView()
290
+
291
+ private lazy var calloutWindow: CalloutWindow = {
292
+ let window = CalloutWindow()
293
+ window.windowLifeCycleDelegate = self
294
+
295
+ let visualEffect = NSVisualEffectView()
296
+ visualEffect.translatesAutoresizingMaskIntoConstraints = false
297
+ visualEffect.material = .menu
298
+ visualEffect.state = .active
299
+ visualEffect.wantsLayer = true
300
+ visualEffect.layer?.cornerRadius = calloutWindowCornerRadius
301
+
302
+ guard let contentView = window.contentView else {
303
+ preconditionFailure("Callout window has no content view")
304
+ }
305
+
306
+ contentView.addSubview(visualEffect)
307
+ NSLayoutConstraint.activate([
308
+ visualEffect.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
309
+ visualEffect.trailingAnchor.constraint(equalTo: contentView.trailingAnchor),
310
+ visualEffect.topAnchor.constraint(equalTo: contentView.topAnchor),
311
+ visualEffect.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
312
+ ])
313
+
314
+ visualEffect.addSubview(proxyView)
315
+
316
+ return window
317
+ }()
318
+ }
319
+
320
+ private var calloutWindowCornerRadius: CGFloat = 5.0
@@ -0,0 +1,12 @@
1
+ import Foundation
2
+
3
+ @objc(FRNCalloutManager)
4
+ class CalloutManager: RCTViewManager {
5
+ override func view()->NSView! {
6
+ return CalloutView(bridge: bridge)
7
+ }
8
+
9
+ override class func requiresMainQueueSetup() -> Bool {
10
+ return true
11
+ }
12
+ }
@@ -0,0 +1,52 @@
1
+ import Foundation
2
+ import AppKit
3
+
4
+ protocol CalloutWindowLifeCycleDelegate {
5
+ /*
6
+ * Notify the CalloutWindowLifeCycle object that the user touched/clicked outside the bounds of the callout.
7
+ */
8
+ func didDetectHitOutsideCallout(calloutWindow: CalloutWindow)
9
+
10
+ /*
11
+ * Notify the CalloutWindowLifeCycle object that the window the callout is in is no longer active.
12
+ */
13
+ func applicationDidResignActiveForCalloutWindow(calloutWindow: CalloutWindow)
14
+ }
15
+
16
+ class CalloutWindow: NSWindow {
17
+
18
+ public var windowLifeCycleDelegate: CalloutWindowLifeCycleDelegate?
19
+
20
+ override init(contentRect: NSRect, styleMask style: NSWindow.StyleMask, backing backingStoreType: NSWindow.BackingStoreType, defer flag: Bool) {
21
+ super.init(contentRect: contentRect, styleMask: style, backing: backingStoreType, defer: flag)
22
+ isReleasedWhenClosed = true
23
+
24
+ styleMask = .borderless
25
+ level = .popUpMenu
26
+ backgroundColor = .clear
27
+ isMovable = false
28
+
29
+ NotificationCenter.default.addObserver(self, selector: #selector(appDidChangeActive(notification:)), name: NSApplication.didResignActiveNotification, object: nil)
30
+
31
+ mouseEventMonitor = NSEvent.addLocalMonitorForEvents(matching: .leftMouseUp, handler: { (event) -> NSEvent? in
32
+ if (event.window != self) {
33
+ self.windowLifeCycleDelegate?.didDetectHitOutsideCallout(calloutWindow: self)
34
+ }
35
+ return event
36
+ })
37
+ }
38
+
39
+ override var canBecomeKey: Bool {
40
+ return true
41
+ }
42
+
43
+ override var canBecomeMain: Bool {
44
+ return false
45
+ }
46
+
47
+ @objc func appDidChangeActive(notification: NSNotification) {
48
+ windowLifeCycleDelegate?.applicationDidResignActiveForCalloutWindow(calloutWindow: self)
49
+ }
50
+
51
+ private var mouseEventMonitor: Any?
52
+ }
@@ -0,0 +1,4 @@
1
+ #import <React/RCTTouchHandler.h>
2
+ #import <React/RCTUIManager.h>
3
+ #import <React/RCTView.h>
4
+ #import <React/RCTViewManager.h>
@@ -0,0 +1,49 @@
1
+ #import <FRNCalloutManager.h>
2
+
3
+ @implementation RCTConvert (FRNCalloutAdditions)
4
+
5
+ // RCTConvert does not properly convert a JS screenRect into a native CGRect/NSRect,
6
+ // due to the mismatch of x/y and screenX/screenY. Let's do it manually.
7
+ // Note this does not take into account that macOS uses a flipped Y axis.
8
+ + (NSRect)screenRect:(id)json
9
+ {
10
+ CGFloat x = [RCTConvert CGFloat:json[@"screenX"]];
11
+ CGFloat y = [RCTConvert CGFloat:json[@"screenX"]];
12
+ CGFloat width = [RCTConvert CGFloat:json[@"width"]];
13
+ CGFloat height = [RCTConvert CGFloat:json[@"height"]];
14
+ return NSMakeRect(x, y, width, height);
15
+ }
16
+
17
+ // Collapse the directional hint options to the 4 NSRectEdge options
18
+ RCT_ENUM_CONVERTER(NSRectEdge, (@{
19
+ @"leftTopEdge": @(NSRectEdgeMinX),
20
+ @"leftCenter": @(NSRectEdgeMinX),
21
+ @"leftBottomEdge": @(NSRectEdgeMinX),
22
+ @"topLeftEdge": @(NSRectEdgeMaxY),
23
+ @"topAutoEdge": @(NSRectEdgeMaxY),
24
+ @"topCenter": @(NSRectEdgeMaxY),
25
+ @"topRightEdge": @(NSRectEdgeMaxY),
26
+ @"rightTopEdge": @(NSRectEdgeMaxX),
27
+ @"rightCenter": @(NSRectEdgeMaxX),
28
+ @"rightBottomEdge": @(NSRectEdgeMaxX),
29
+ @"bottonLeftEdge": @(NSRectEdgeMinY),
30
+ @"bottomAutoEdge": @(NSRectEdgeMinY),
31
+ @"bottomCenter": @(NSRectEdgeMinY),
32
+ @"bottomRightEdge": @(NSRectEdgeMinY),
33
+ }), NSRectEdgeMaxY, integerValue);
34
+
35
+ @end
36
+
37
+ @interface RCT_EXTERN_MODULE(FRNCalloutManager, RCTViewManager)
38
+
39
+ RCT_EXPORT_VIEW_PROPERTY(target, NSNumber)
40
+
41
+ RCT_EXPORT_VIEW_PROPERTY(anchorRect, screenRect)
42
+
43
+ RCT_EXPORT_VIEW_PROPERTY(directionalHint, NSRectEdge)
44
+
45
+ RCT_EXPORT_VIEW_PROPERTY(onShow, RCTBubblingEventBlock)
46
+
47
+ RCT_EXPORT_VIEW_PROPERTY(onDismiss, RCTBubblingEventBlock)
48
+
49
+ @end
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@fluentui-react-native/callout",
3
- "version": "0.17.29",
3
+ "version": "0.19.1",
4
4
  "description": "A cross-platform Callout component using the Fluent Design System",
5
+ "license": "MIT",
6
+ "author": "",
7
+ "homepage": "https://github.com/microsoft/fluentui-react-native",
5
8
  "main": "lib-commonjs/index.js",
6
9
  "module": "lib/index.js",
7
10
  "typings": "lib/index.d.ts",
@@ -17,23 +20,22 @@
17
20
  "prettier-fix": "fluentui-scripts prettier --fix true"
18
21
  },
19
22
  "dependencies": {
20
- "@uifabricshared/foundation-compose": "^1.10.21",
21
- "@fluentui-react-native/component-cache": "^1.2.3",
22
- "@fluentui-react-native/interactive-hooks": ">=0.10.53 <1.0.0",
23
- "@fluentui-react-native/tokens": ">=0.10.3 <1.0.0",
24
- "@uifabricshared/foundation-composable": ">=0.9.3 <1.0.0",
25
- "@uifabricshared/foundation-settings": ">=0.10.3 <1.0.0"
23
+ "@fluentui-react-native/adapters": "^0.8.1",
24
+ "@fluentui-react-native/component-cache": "^1.3.0",
25
+ "@fluentui-react-native/interactive-hooks": ">=0.11.1 <1.0.0",
26
+ "@fluentui-react-native/tokens": ">=0.11.1 <1.0.0",
27
+ "@uifabricshared/foundation-composable": ">=0.10.0 <1.0.0",
28
+ "@uifabricshared/foundation-compose": "^1.11.1",
29
+ "@uifabricshared/foundation-settings": ">=0.11.0 <1.0.0"
26
30
  },
27
31
  "devDependencies": {
28
- "@types/react-native": "^0.63.0",
32
+ "@fluentui-react-native/eslint-config-rules": "^0.1.1",
33
+ "@types/react-native": "^0.64.0",
29
34
  "@uifabricshared/build-native": "^0.1.1",
30
- "@uifabricshared/eslint-config-rules": "^0.1.1",
31
- "react-native": "^0.63.4"
35
+ "react-native": "^0.64.3"
32
36
  },
33
37
  "peerDependencies": {
34
- "react": ">=16.13.1",
35
- "react-native": ">=0.63.4"
36
- },
37
- "author": "",
38
- "license": "MIT"
38
+ "react": ">=17.0.1",
39
+ "react-native": ">=0.64.3"
40
+ }
39
41
  }
@@ -0,0 +1,22 @@
1
+ import { calloutName, ICalloutType } from './Callout.types';
2
+ import { IComposeSettings } from '@uifabricshared/foundation-compose';
3
+
4
+ export const settings: IComposeSettings<ICalloutType> = [
5
+ {
6
+ tokens: {
7
+ backgroundColor: 'bodyStandoutBackground',
8
+ beakWidth: 20,
9
+ borderColor: 'bodyFrameBackground',
10
+ borderWidth: 1,
11
+ directionalHint: 'bottonLeftEdge',
12
+ gapSpace: 0,
13
+ minPadding: 0,
14
+ },
15
+ root: {
16
+ style: {
17
+ position: 'absolute',
18
+ },
19
+ },
20
+ },
21
+ calloutName,
22
+ ];
package/src/Callout.tsx CHANGED
@@ -3,12 +3,15 @@ import { backgroundColorTokens, borderTokens } from '@fluentui-react-native/toke
3
3
  import { compose, IUseComposeStyling } from '@uifabricshared/foundation-compose';
4
4
  import { mergeSettings } from '@uifabricshared/foundation-settings';
5
5
  import * as React from 'react';
6
- import { findNodeHandle } from 'react-native';
6
+ import { findNodeHandle, Platform } from 'react-native';
7
7
  import { settings } from './Callout.settings';
8
8
  import { calloutName, ICalloutProps, ICalloutSlotProps, ICalloutType } from './Callout.types';
9
9
  import { ensureNativeComponent } from '@fluentui-react-native/component-cache';
10
10
 
11
- const RCTCallout = ensureNativeComponent('RCTCallout');
11
+ const NativeCalloutView = Platform.select({
12
+ macos: ensureNativeComponent('FRNCallout'),
13
+ default: ensureNativeComponent('RCTCallout'), // win32
14
+ });
12
15
 
13
16
  export const Callout = compose<ICalloutType>({
14
17
  displayName: calloutName,
@@ -39,7 +42,7 @@ export const Callout = compose<ICalloutType>({
39
42
  },
40
43
  settings: settings,
41
44
  slots: {
42
- root: RCTCallout,
45
+ root: NativeCalloutView,
43
46
  },
44
47
  styles: {
45
48
  root: [backgroundColorTokens, borderTokens],
@@ -1,9 +1,9 @@
1
1
  import * as React from 'react';
2
2
  import { ScreenRect, ViewStyle } from 'react-native';
3
+ import { IViewProps } from '@fluentui-react-native/adapters';
3
4
  import { IRenderData } from '@uifabricshared/foundation-composable';
4
5
  import { IBackgroundColorTokens, IBorderTokens } from '@fluentui-react-native/tokens';
5
6
  import { IFocusable } from '@fluentui-react-native/interactive-hooks';
6
-
7
7
  export const calloutName = 'Callout';
8
8
 
9
9
  /**
@@ -98,28 +98,20 @@ export interface ICalloutTokens extends IBackgroundColorTokens, CalloutBorderTok
98
98
  minPadding?: number;
99
99
  }
100
100
 
101
- export interface ICalloutProps extends ICalloutTokens {
102
- /*
103
- * Used by screen readers to inform the user about the control.
104
- */
105
- accessibilityLabel?: string;
106
-
107
- /*
101
+ export interface ICalloutProps extends IViewProps, ICalloutTokens {
102
+ /**
103
+ * @platform win32
108
104
  * A string that should be announced when the callout is shown.
109
105
  */
110
106
  accessibilityOnShowAnnouncement?: string;
111
107
 
112
- /*
113
- * Used by screen readers to inform the user about the purpose of the control.
114
- */
115
- accessibilityRole?: string;
116
-
117
108
  /**
118
109
  * A RefObject to access the IFocusable interface. Use this to access the public methods and properties of the component.
119
110
  */
120
111
  componentRef?: React.RefObject<IFocusable>;
121
112
 
122
113
  /**
114
+ * @platform win32
123
115
  * Adds a beak to the Callout, pointing to the anchor target.
124
116
  * Notable Win32 limitation: Beak rendering currently limits the border width to its default, and the
125
117
  * border width prop will not be honored.
@@ -132,6 +124,7 @@ export interface ICalloutProps extends ICalloutTokens {
132
124
  onDismiss?: () => void;
133
125
 
134
126
  /**
127
+ * @platform win32
135
128
  * Callback invoked during callout dismissal; if set, focus will not be restored by the callout and onRestoreFocus must
136
129
  * result in focus being moved to the appropriate focusable target.
137
130
  *
@@ -149,6 +142,7 @@ export interface ICalloutProps extends ICalloutTokens {
149
142
  onShow?: () => void;
150
143
 
151
144
  /**
145
+ * @platform win32
152
146
  * If true then the callout will attempt to focus the first focusable element that it contains.
153
147
  * If it doesn't find an element, no focus will be set. This means that it's the contents responsibility
154
148
  * to either set focus or have focusable items.
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=Callout.test.win32.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Callout.test.win32.d.ts","sourceRoot":"","sources":["../../src/__tests__/Callout.test.win32.tsx"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Callout.test.win32.js","sourceRoot":"","sources":["../../src/__tests__/Callout.test.win32.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAEhD,EAAE,CAAC,uBAAuB,EAAE;IAC1B,IAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,oBAAC,OAAO,OAAG,CAAC,CAAC,MAAM,EAAE,CAAC;IACnD,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;AACjC,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=Callout.test.win32.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Callout.test.win32.d.ts","sourceRoot":"","sources":["../../src/__tests__/Callout.test.win32.tsx"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Callout.test.win32.js","sourceRoot":"","sources":["../../src/__tests__/Callout.test.win32.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,2CAA+B;AAC/B,wBAA6B;AAC7B,4DAAgD;AAEhD,EAAE,CAAC,uBAAuB,EAAE;IAC1B,IAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,oBAAC,WAAO,OAAG,CAAC,CAAC,MAAM,EAAE,CAAC;IACnD,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;AACjC,CAAC,CAAC,CAAC"}