@fluentui-react-native/callout 0.27.17 → 0.28.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 (59) hide show
  1. package/CHANGELOG.md +64 -2
  2. package/lib/Callout.d.ts.map +1 -1
  3. package/lib/Callout.js +3 -8
  4. package/lib/Callout.js.map +1 -1
  5. package/lib/Callout.types.d.ts +2 -2
  6. package/lib/Callout.types.d.ts.map +1 -1
  7. package/lib/CalloutNativeComponent.d.ts +8 -11
  8. package/lib/CalloutNativeComponent.d.ts.map +1 -1
  9. package/lib/CalloutNativeComponent.js +0 -5
  10. package/lib/CalloutNativeComponent.js.map +1 -1
  11. package/lib/{MacOSCalloutNativeComponent.d.ts → CalloutNativeComponent.macos.d.ts} +9 -11
  12. package/lib/CalloutNativeComponent.macos.d.ts.map +1 -0
  13. package/lib/{MacOSCalloutNativeComponent.js → CalloutNativeComponent.macos.js} +1 -6
  14. package/lib/CalloutNativeComponent.macos.js.map +1 -0
  15. package/lib/__tests__/Callout.test.js +7 -3
  16. package/lib/__tests__/Callout.test.js.map +1 -1
  17. package/lib/index.d.ts +1 -1
  18. package/lib/index.d.ts.map +1 -1
  19. package/lib-commonjs/Callout.d.ts.map +1 -1
  20. package/lib-commonjs/Callout.js +21 -16
  21. package/lib-commonjs/Callout.js.map +1 -1
  22. package/lib-commonjs/Callout.types.d.ts +2 -2
  23. package/lib-commonjs/Callout.types.d.ts.map +1 -1
  24. package/lib-commonjs/CalloutNativeComponent.d.ts +8 -11
  25. package/lib-commonjs/CalloutNativeComponent.d.ts.map +1 -1
  26. package/lib-commonjs/CalloutNativeComponent.js +0 -5
  27. package/lib-commonjs/CalloutNativeComponent.js.map +1 -1
  28. package/lib-commonjs/{MacOSCalloutNativeComponent.d.ts → CalloutNativeComponent.macos.d.ts} +9 -11
  29. package/lib-commonjs/CalloutNativeComponent.macos.d.ts.map +1 -0
  30. package/lib-commonjs/{MacOSCalloutNativeComponent.js → CalloutNativeComponent.macos.js} +1 -6
  31. package/lib-commonjs/CalloutNativeComponent.macos.js.map +1 -0
  32. package/lib-commonjs/__tests__/Callout.test.js +24 -10
  33. package/lib-commonjs/__tests__/Callout.test.js.map +1 -1
  34. package/lib-commonjs/index.d.ts +1 -1
  35. package/lib-commonjs/index.d.ts.map +1 -1
  36. package/lib-commonjs/index.js +2 -2
  37. package/lib-commonjs/index.js.map +1 -1
  38. package/macos/FRNCalloutManager.m +2 -1
  39. package/package.json +63 -61
  40. package/src/Callout.tsx +3 -11
  41. package/src/Callout.types.ts +3 -2
  42. package/src/{MacOSCalloutNativeComponent.ts → CalloutNativeComponent.macos.ts} +29 -26
  43. package/src/CalloutNativeComponent.ts +26 -28
  44. package/src/__tests__/Callout.test.tsx +6 -3
  45. package/src/index.ts +1 -1
  46. package/lib/CalloutNativeCommands.types.d.ts +0 -5
  47. package/lib/CalloutNativeCommands.types.d.ts.map +0 -1
  48. package/lib/CalloutNativeCommands.types.js +0 -2
  49. package/lib/CalloutNativeCommands.types.js.map +0 -1
  50. package/lib/MacOSCalloutNativeComponent.d.ts.map +0 -1
  51. package/lib/MacOSCalloutNativeComponent.js.map +0 -1
  52. package/lib-commonjs/CalloutNativeCommands.types.d.ts +0 -5
  53. package/lib-commonjs/CalloutNativeCommands.types.d.ts.map +0 -1
  54. package/lib-commonjs/CalloutNativeCommands.types.js +0 -3
  55. package/lib-commonjs/CalloutNativeCommands.types.js.map +0 -1
  56. package/lib-commonjs/MacOSCalloutNativeComponent.d.ts.map +0 -1
  57. package/lib-commonjs/MacOSCalloutNativeComponent.js.map +0 -1
  58. package/src/CalloutNativeCommands.types.ts +0 -4
  59. package/src/codegenTypes.d.ts +0 -2
@@ -1,9 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * Copyright (c) Microsoft Corporation.
4
- * Licensed under the MIT License.
5
- * @format
6
- */
7
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
8
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
9
4
  };
@@ -15,4 +10,4 @@ exports.Commands = (0, codegenNativeCommands_1.default)({
15
10
  supportedCommands: ['blurWindow', 'focusWindow'],
16
11
  });
17
12
  exports.default = (0, codegenNativeComponent_1.default)('FRNCallout');
18
- //# sourceMappingURL=MacOSCalloutNativeComponent.js.map
13
+ //# sourceMappingURL=CalloutNativeComponent.macos.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CalloutNativeComponent.macos.js","sourceRoot":"","sources":["../src/CalloutNativeComponent.macos.ts"],"names":[],"mappings":";;;;;;AAAA,mHAA2F;AAC3F,qHAA6F;AA+DhF,QAAA,QAAQ,GAA0B,IAAA,+BAAqB,EAAwB;IAC1F,iBAAiB,EAAE,CAAC,YAAY,EAAE,aAAa,CAAC;CACjD,CAAC,CAAC;kBAEY,IAAA,gCAAsB,EAAc,YAAY,CAAyB"}
@@ -15,19 +15,33 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- const React = __importStar(require("react"));
36
+ const jsx_runtime_1 = require("react/jsx-runtime");
37
+ const react_1 = require("react");
27
38
  const renderer = __importStar(require("react-test-renderer"));
28
39
  const __1 = require("..");
29
40
  it('Callout default props', () => {
30
- const tree = renderer.create(React.createElement(__1.Callout, null)).toJSON();
31
- expect(tree).toMatchSnapshot();
41
+ let component;
42
+ (0, react_1.act)(() => {
43
+ component = renderer.create(jsx_runtime_1.jsx(__1.Callout, {}));
44
+ });
45
+ expect(component.toJSON()).toMatchSnapshot();
32
46
  });
33
47
  //# sourceMappingURL=Callout.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Callout.test.js","sourceRoot":"","sources":["../../src/__tests__/Callout.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA+B;AAE/B,8DAAgD;AAEhD,0BAA6B;AAE7B,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;IAC/B,MAAM,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"}
1
+ {"version":3,"file":"Callout.test.js","sourceRoot":"","sources":["../../src/__tests__/Callout.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAA4B;AAE5B,MAAY,QAAQ,gDAA4B;AAEhD,0BAA6B;AAE7B,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE,CAAC;IAChC,IAAI,SAAqC,CAAC;IAC1C,IAAA,WAAG,EAAC,GAAG,EAAE,CAAC;QACR,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,kBAAC,WAAO,KAAG,CAAC,CAAC;IAAA,CAC1C,CAAC,CAAC;IACH,MAAM,CAAC,SAAU,CAAC,MAAM,EAAE,CAAC,CAAC,eAAe,EAAE,CAAC;AAAA,CAC/C,CAAC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export { calloutName } from './Callout.types';
2
2
  export type { DirectionalHint, DismissBehaviors, ICalloutProps, ICalloutRenderData, ICalloutSlotProps, ICalloutTokens, ICalloutType, RestoreFocusEvent, } from './Callout.types';
3
- export type { CalloutNativeCommands } from './CalloutNativeCommands.types';
3
+ export type { CalloutNativeCommands } from './CalloutNativeComponent';
4
4
  export { Callout } from './Callout';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Callout = exports.calloutName = void 0;
4
- var Callout_types_1 = require("./Callout.types");
4
+ const Callout_types_1 = require("./Callout.types");
5
5
  Object.defineProperty(exports, "calloutName", { enumerable: true, get: function () { return Callout_types_1.calloutName; } });
6
- var Callout_1 = require("./Callout");
6
+ const Callout_1 = require("./Callout");
7
7
  Object.defineProperty(exports, "Callout", { enumerable: true, get: function () { return Callout_1.Callout; } });
8
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iDAA8C;AAArC,4GAAA,WAAW,OAAA;AAYpB,qCAAoC;AAA3B,kGAAA,OAAO,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAArC,4GAAA,WAAW,OAAA;AAYpB,uCAAoC;AAA3B,kGAAA,OAAO,OAAA"}
@@ -28,7 +28,8 @@ RCT_ENUM_CONVERTER(NSRectEdge, (@{
28
28
  @"rightTopEdge": @(NSRectEdgeMaxX),
29
29
  @"rightCenter": @(NSRectEdgeMaxX),
30
30
  @"rightBottomEdge": @(NSRectEdgeMaxX),
31
- @"bottonLeftEdge": @(NSRectEdgeMinY),
31
+ @"bottomLeftEdge": @(NSRectEdgeMinY),
32
+ @"bottonLeftEdge": @(NSRectEdgeMinY), // Add both the correct and incorrect spellings during the transition period
32
33
  @"bottomAutoEdge": @(NSRectEdgeMinY),
33
34
  @"bottomCenter": @(NSRectEdgeMinY),
34
35
  @"bottomRightEdge": @(NSRectEdgeMinY),
package/package.json CHANGED
@@ -1,97 +1,81 @@
1
1
  {
2
2
  "name": "@fluentui-react-native/callout",
3
- "version": "0.27.17",
3
+ "version": "0.28.1",
4
4
  "description": "A cross-platform Callout component using the Fluent Design System",
5
+ "homepage": "https://github.com/microsoft/fluentui-react-native",
5
6
  "license": "MIT",
6
7
  "author": "",
7
- "homepage": "https://github.com/microsoft/fluentui-react-native",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/microsoft/fluentui-react-native.git",
11
+ "directory": "packages/components/Callout"
12
+ },
8
13
  "main": "lib-commonjs/index.js",
9
14
  "module": "lib/index.js",
10
- "react-native": "src/index.ts",
15
+ "types": "lib/index.d.ts",
11
16
  "exports": {
12
17
  ".": {
18
+ "types": "./lib/index.d.ts",
13
19
  "import": "./lib/index.js",
14
20
  "require": "./lib-commonjs/index.js",
15
- "types": "./lib/index.d.ts"
21
+ "default": "./src/index.ts"
16
22
  }
17
23
  },
18
- "typings": "lib/index.d.ts",
19
24
  "scripts": {
20
25
  "build": "fluentui-scripts build",
26
+ "build-cjs": "tsgo --outDir lib-commonjs",
27
+ "build-core": "tsgo --outDir lib --module esnext --moduleResolution bundler",
21
28
  "clean": "fluentui-scripts clean",
22
29
  "depcheck": "fluentui-scripts depcheck",
23
- "just": "fluentui-scripts",
24
30
  "lint": "fluentui-scripts eslint",
31
+ "lint-package": "fluentui-scripts lint-package",
32
+ "format": "fluentui-scripts format",
25
33
  "test": "fluentui-scripts jest",
26
- "update-snapshots": "fluentui-scripts jest -u",
27
- "prettier": "fluentui-scripts prettier",
28
- "prettier-fix": "fluentui-scripts prettier --fix true"
29
- },
30
- "repository": {
31
- "type": "git",
32
- "url": "https://github.com/microsoft/fluentui-react-native.git",
33
- "directory": "packages/components/Callout"
34
+ "update-snapshots": "fluentui-scripts jest -u"
34
35
  },
35
36
  "dependencies": {
36
- "@fluentui-react-native/adapters": "0.13.5",
37
- "@fluentui-react-native/tokens": "0.23.11",
38
- "@uifabricshared/foundation-composable": "0.13.11",
39
- "@uifabricshared/foundation-compose": "1.15.17",
40
- "@uifabricshared/foundation-settings": "0.15.11"
37
+ "@fluentui-react-native/adapters": "0.14.1",
38
+ "@fluentui-react-native/tokens": "0.24.1",
39
+ "@uifabricshared/foundation-composable": "0.14.1",
40
+ "@uifabricshared/foundation-compose": "1.16.1",
41
+ "@uifabricshared/foundation-settings": "0.16.1"
41
42
  },
42
43
  "devDependencies": {
43
44
  "@babel/core": "^7.20.0",
44
45
  "@fluentui-react-native/babel-config": "0.1.1",
45
- "@fluentui-react-native/eslint-config-rules": "0.1.1",
46
- "@fluentui-react-native/jest-config": "0.1.1",
47
- "@fluentui-react-native/scripts": "0.1.1",
46
+ "@fluentui-react-native/eslint-config-rules": "0.1.2",
47
+ "@fluentui-react-native/jest-config": "0.1.0",
48
+ "@fluentui-react-native/kit-config": "0.1.2",
49
+ "@fluentui-react-native/scripts": "0.1.0",
48
50
  "@office-iss/react-native-win32": "^0.74.0",
49
- "@react-native/babel-preset": "^0.74.0",
50
- "@react-native/metro-config": "^0.74.0",
51
- "@types/react": "~18.2.0",
52
- "react": "18.2.0",
53
- "react-native": "^0.74.0",
54
- "react-native-macos": "^0.74.0",
55
- "react-native-windows": "^0.74.0",
56
- "react-test-renderer": "18.2.0"
51
+ "@react-native-community/cli": "^20.0.0",
52
+ "@react-native-community/cli-platform-android": "^20.0.0",
53
+ "@react-native-community/cli-platform-ios": "^20.0.0",
54
+ "@react-native/babel-preset": "^0.81.0",
55
+ "@react-native/metro-config": "^0.81.0",
56
+ "@types/react": "~19.1.0",
57
+ "@types/react-test-renderer": "^19.1.0",
58
+ "react": "19.1.0",
59
+ "react-native": "^0.81.0",
60
+ "react-native-macos": "^0.81.0",
61
+ "react-native-windows": "^0.81.0",
62
+ "react-test-renderer": "19.1.0"
57
63
  },
58
64
  "peerDependencies": {
59
65
  "@office-iss/react-native-win32": "^0.74.0",
60
- "react": "18.2.0",
61
- "react-native": "^0.73.0 || ^0.74.0",
62
- "react-native-macos": "^0.73.0 || ^0.74.0",
63
- "react-native-windows": "^0.73.0 || ^0.74.0"
64
- },
65
- "rnx-kit": {
66
- "kitType": "library",
67
- "alignDeps": {
68
- "presets": [
69
- "microsoft/react-native"
70
- ],
71
- "requirements": {
72
- "development": [
73
- "react-native@0.74"
74
- ],
75
- "production": [
76
- "react-native@0.73 || 0.74"
77
- ]
78
- },
79
- "capabilities": [
80
- "babel-preset-react-native",
81
- "core",
82
- "core-android",
83
- "core-ios",
84
- "core-macos",
85
- "core-windows",
86
- "react",
87
- "react-test-renderer"
88
- ]
89
- }
66
+ "@types/react": "~18.2.0 || ~19.0.0 || ~19.1.0",
67
+ "react": "18.2.0 || 19.0.0 || 19.1.0",
68
+ "react-native": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0",
69
+ "react-native-macos": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0",
70
+ "react-native-windows": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0"
90
71
  },
91
72
  "peerDependenciesMeta": {
92
73
  "@office-iss/react-native-win32": {
93
74
  "optional": true
94
75
  },
76
+ "@types/react": {
77
+ "optional": true
78
+ },
95
79
  "react-native-macos": {
96
80
  "optional": true
97
81
  },
@@ -103,5 +87,23 @@
103
87
  "name": "FRNCalloutSpec",
104
88
  "type": "components",
105
89
  "jsSrcsDir": "lib"
90
+ },
91
+ "rnx-kit": {
92
+ "kitType": "library",
93
+ "alignDeps": {
94
+ "capabilities": [
95
+ "babel-preset-react-native",
96
+ "core",
97
+ "core-android",
98
+ "core-ios",
99
+ "core-macos",
100
+ "core-windows",
101
+ "react",
102
+ "react-test-renderer",
103
+ "tools-core",
104
+ "tools-jest"
105
+ ]
106
+ },
107
+ "extends": "@fluentui-react-native/kit-config"
106
108
  }
107
- }
109
+ }
package/src/Callout.tsx CHANGED
@@ -5,8 +5,7 @@
5
5
  */
6
6
 
7
7
  import * as React from 'react';
8
- import { findNodeHandle, Platform } from 'react-native';
9
- import type { HostComponent } from 'react-native';
8
+ import { findNodeHandle } from 'react-native';
10
9
 
11
10
  import { backgroundColorTokens, borderTokens } from '@fluentui-react-native/tokens';
12
11
  import type { IUseComposeStyling } from '@uifabricshared/foundation-compose';
@@ -16,16 +15,9 @@ import { mergeSettings } from '@uifabricshared/foundation-settings';
16
15
  import { settings } from './Callout.settings';
17
16
  import type { ICalloutProps, ICalloutSlotProps, ICalloutType } from './Callout.types';
18
17
  import { calloutName } from './Callout.types';
19
- import type { NativeProps as CalloutNativeProps } from './CalloutNativeComponent';
20
- import CalloutNativeComponent from './CalloutNativeComponent';
21
- import type { NativeProps as FRNCalloutNativeProps } from './MacOSCalloutNativeComponent';
22
- import FRNCalloutNativeComponent from './MacOSCalloutNativeComponent';
23
- import { Commands } from './MacOSCalloutNativeComponent';
24
18
 
25
- const NativeCalloutView = Platform.select<HostComponent<FRNCalloutNativeProps> | HostComponent<CalloutNativeProps>>({
26
- macos: FRNCalloutNativeComponent,
27
- default: CalloutNativeComponent, // win32
28
- });
19
+ import NativeCalloutView from './CalloutNativeComponent';
20
+ import { Commands } from './CalloutNativeComponent';
29
21
 
30
22
  export const Callout = compose<ICalloutType>({
31
23
  displayName: calloutName,
@@ -5,7 +5,7 @@ import type { IViewProps } from '@fluentui-react-native/adapters';
5
5
  import type { IBackgroundColorTokens, IBorderTokens } from '@fluentui-react-native/tokens';
6
6
  import type { IRenderData } from '@uifabricshared/foundation-composable';
7
7
 
8
- import type { CalloutNativeCommands } from './CalloutNativeCommands.types';
8
+ import type { CalloutNativeCommands } from './CalloutNativeComponent';
9
9
  export const calloutName = 'Callout';
10
10
 
11
11
  /**
@@ -23,7 +23,8 @@ export type DirectionalHint =
23
23
  | 'rightTopEdge'
24
24
  | 'rightCenter'
25
25
  | 'rightBottomEdge'
26
- | 'bottonLeftEdge'
26
+ | 'bottomLeftEdge'
27
+ | 'bottonLeftEdge' // Typo in the original code, should be 'bottomLeftEdge'
27
28
  | 'bottomAutoEdge'
28
29
  | 'bottomCenter'
29
30
  | 'bottomRightEdge';
@@ -1,26 +1,39 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- * @format
5
- */
6
-
7
- import type { HostComponent, ViewProps } from 'react-native';
8
-
9
- import type { DirectEventHandler, Double, Int32, WithDefault } from 'react-native/Libraries/Types/CodegenTypes';
10
1
  import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
11
2
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
12
3
 
13
- type AnchorRect = {
4
+ import type { HostComponent, ViewProps } from 'react-native';
5
+ import type { WithDefault, UnsafeMixed, Int32, DirectEventHandler, Double } from 'react-native/Libraries/Types/CodegenTypes';
6
+
7
+ interface AnchorRect {
14
8
  screenX: Double;
15
9
  screenY: Double;
16
10
  width: Double;
17
11
  height: Double;
18
- };
12
+ }
19
13
 
14
+ /**
15
+ * Shared native props specific to Callout native component
16
+ */
20
17
  export interface NativeProps extends ViewProps {
21
18
  accessibilityLabel?: string;
22
19
  accessibilityOnShowAnnouncement?: string;
23
20
  anchorRect?: AnchorRect;
21
+
22
+ dismissBehaviors?: string[];
23
+ doNotTakePointerCapture?: boolean;
24
+ focusable?: boolean;
25
+ isBeakVisible?: boolean;
26
+ maxHeight?: Int32;
27
+ maxWidth?: Int32;
28
+ setInitialFocus?: boolean;
29
+
30
+ // targetAnchor?: string; // Win32 only Callout can target an anchor registered in the anchor registry // Can be a node id or an anchor ID - This need to be reworked as Mixed types are not supported going forward
31
+ testID?: string;
32
+
33
+ onRestoreFocus?: DirectEventHandler<{ target: Int32; containsFocus: boolean }>;
34
+ onDismiss?: DirectEventHandler<{ target: Int32 }>;
35
+ onShow?: DirectEventHandler<{ target: Int32 }>;
36
+
24
37
  directionalHint?: WithDefault<
25
38
  | 'leftTopEdge'
26
39
  | 'leftCenter'
@@ -32,28 +45,18 @@ export interface NativeProps extends ViewProps {
32
45
  | 'rightTopEdge'
33
46
  | 'rightCenter'
34
47
  | 'rightBottomEdge'
35
- | 'bottonLeftEdge'
48
+ | 'bottomLeftEdge'
49
+ | 'bottonLeftEdge' // Typo in the original code, should be 'bottomLeftEdge'
36
50
  | 'bottomAutoEdge'
37
51
  | 'bottomCenter'
38
52
  | 'bottomRightEdge',
39
- 'topLeftEdge'
53
+ 'topleftEdge'
40
54
  >;
41
- dismissBehaviors?: string[];
42
- doNotTakePointerCapture?: boolean;
43
- focusable?: boolean;
44
- isBeakVisible?: boolean;
45
- maxHeight?: Int32;
46
- maxWidth?: Int32;
47
- setInitialFocus?: boolean;
48
- target?: Int32;
49
- testID?: string;
50
-
51
- onRestoreFocus?: DirectEventHandler<{ target: Int32; containsFocus: boolean }>;
52
- onDismiss?: DirectEventHandler<{ target: Int32 }>;
53
- onShow?: DirectEventHandler<{ target: Int32 }>;
55
+ target?: UnsafeMixed;
54
56
  }
55
57
 
56
58
  export type CalloutComponentType = HostComponent<NativeProps>;
59
+
57
60
  export interface CalloutNativeCommands {
58
61
  focusWindow: (viewRef: React.ElementRef<CalloutComponentType>) => void;
59
62
  blurWindow: (viewRef: React.ElementRef<CalloutComponentType>) => void;
@@ -1,30 +1,39 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation.
3
- * Licensed under the MIT License.
4
- * @format
5
- */
6
-
7
- import type { HostComponent, ViewProps } from 'react-native';
8
-
9
- import type { WithDefault, DirectEventHandler, Double, Int32 } from 'react-native/Libraries/Types/CodegenTypes';
10
1
  import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
11
2
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
12
3
 
13
- import type { UnsafeMixed } from './codegenTypes';
14
- // Should be:
15
- // import type {UnsafeMixed} from 'react-native/Libraries/Types/CodegenTypes';
4
+ import type { HostComponent, ViewProps } from 'react-native';
5
+ import type { WithDefault, UnsafeMixed, Int32, DirectEventHandler, Double } from 'react-native/Libraries/Types/CodegenTypes';
16
6
 
17
- type AnchorRect = {
7
+ interface AnchorRect {
18
8
  screenX: Double;
19
9
  screenY: Double;
20
10
  width: Double;
21
11
  height: Double;
22
- };
12
+ }
23
13
 
14
+ /**
15
+ * Shared native props specific to Callout native component
16
+ */
24
17
  export interface NativeProps extends ViewProps {
25
18
  accessibilityLabel?: string;
26
19
  accessibilityOnShowAnnouncement?: string;
27
20
  anchorRect?: AnchorRect;
21
+
22
+ dismissBehaviors?: string[];
23
+ doNotTakePointerCapture?: boolean;
24
+ focusable?: boolean;
25
+ isBeakVisible?: boolean;
26
+ maxHeight?: Int32;
27
+ maxWidth?: Int32;
28
+ setInitialFocus?: boolean;
29
+
30
+ // targetAnchor?: string; // Win32 only Callout can target an anchor registered in the anchor registry // Can be a node id or an anchor ID - This need to be reworked as Mixed types are not supported going forward
31
+ testID?: string;
32
+
33
+ onRestoreFocus?: DirectEventHandler<{ target: Int32; containsFocus: boolean }>;
34
+ onDismiss?: DirectEventHandler<{ target: Int32 }>;
35
+ onShow?: DirectEventHandler<{ target: Int32 }>;
36
+
28
37
  directionalHint?: WithDefault<
29
38
  | 'leftTopEdge'
30
39
  | 'leftCenter'
@@ -36,29 +45,18 @@ export interface NativeProps extends ViewProps {
36
45
  | 'rightTopEdge'
37
46
  | 'rightCenter'
38
47
  | 'rightBottomEdge'
39
- | 'bottonLeftEdge'
48
+ | 'bottomLeftEdge'
49
+ | 'bottonLeftEdge' // Typo in the original code, should be 'bottomLeftEdge'
40
50
  | 'bottomAutoEdge'
41
51
  | 'bottomCenter'
42
52
  | 'bottomRightEdge',
43
53
  'bottonLeftEdge'
44
54
  >;
45
- dismissBehaviors?: string[];
46
- doNotTakePointerCapture?: boolean;
47
- focusable?: boolean;
48
- isBeakVisible?: boolean;
49
- maxHeight?: Int32;
50
- maxWidth?: Int32;
51
- setInitialFocus?: boolean;
52
55
  target?: UnsafeMixed;
53
- // targetAnchor?: string; // Win32 only Callout can target an anchor registered in the anchor registry // Can be a node id or an anchor ID - This need to be reworked as Mixed types are not supported going forward
54
- testID?: string;
55
-
56
- onRestoreFocus?: DirectEventHandler<{ target: Int32; containsFocus: boolean }>;
57
- onDismiss?: DirectEventHandler<{ target: Int32 }>;
58
- onShow?: DirectEventHandler<{ target: Int32 }>;
59
56
  }
60
57
 
61
58
  export type CalloutComponentType = HostComponent<NativeProps>;
59
+
62
60
  export interface CalloutNativeCommands {
63
61
  focusWindow: (viewRef: React.ElementRef<CalloutComponentType>) => void;
64
62
  blurWindow: (viewRef: React.ElementRef<CalloutComponentType>) => void;
@@ -1,10 +1,13 @@
1
- import * as React from 'react';
1
+ import { act } from 'react';
2
2
 
3
3
  import * as renderer from 'react-test-renderer';
4
4
 
5
5
  import { Callout } from '..';
6
6
 
7
7
  it('Callout default props', () => {
8
- const tree = renderer.create(<Callout />).toJSON();
9
- expect(tree).toMatchSnapshot();
8
+ let component: renderer.ReactTestRenderer;
9
+ act(() => {
10
+ component = renderer.create(<Callout />);
11
+ });
12
+ expect(component!.toJSON()).toMatchSnapshot();
10
13
  });
package/src/index.ts CHANGED
@@ -9,5 +9,5 @@ export type {
9
9
  ICalloutType,
10
10
  RestoreFocusEvent,
11
11
  } from './Callout.types';
12
- export type { CalloutNativeCommands } from './CalloutNativeCommands.types';
12
+ export type { CalloutNativeCommands } from './CalloutNativeComponent';
13
13
  export { Callout } from './Callout';
@@ -1,5 +0,0 @@
1
- export interface CalloutNativeCommands {
2
- focusWindow(): void;
3
- blurWindow(): void;
4
- }
5
- //# sourceMappingURL=CalloutNativeCommands.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CalloutNativeCommands.types.d.ts","sourceRoot":"","sources":["../src/CalloutNativeCommands.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,WAAW,IAAI,IAAI,CAAC;IACpB,UAAU,IAAI,IAAI,CAAC;CACpB"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=CalloutNativeCommands.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CalloutNativeCommands.types.js","sourceRoot":"","sources":["../src/CalloutNativeCommands.types.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"MacOSCalloutNativeComponent.d.ts","sourceRoot":"","sources":["../src/MacOSCalloutNativeComponent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AA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D,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,oBAAoB,CAAC,KAAK,IAAI,CAAC;IACvE,UAAU,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,oBAAoB,CAAC,KAAK,IAAI,CAAC;CACvE;AAED,eAAO,MAAM,QAAQ,EAAE,qBAErB,CAAC;;AAEH,wBAAyF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"MacOSCalloutNativeComponent.js","sourceRoot":"","sources":["../src/MacOSCalloutNativeComponent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,qBAAqB,MAAM,wDAAwD,CAAC;AAC3F,OAAO,sBAAsB,MAAM,yDAAyD,CAAC;AAmD7F,MAAM,CAAC,MAAM,QAAQ,GAA0B,qBAAqB,CAAwB;IAC1F,iBAAiB,EAAE,CAAC,YAAY,EAAE,aAAa,CAAC;CACjD,CAAC,CAAC;AAEH,eAAe,sBAAsB,CAAc,YAAY,CAAyB,CAAC"}
@@ -1,5 +0,0 @@
1
- export interface CalloutNativeCommands {
2
- focusWindow(): void;
3
- blurWindow(): void;
4
- }
5
- //# sourceMappingURL=CalloutNativeCommands.types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CalloutNativeCommands.types.d.ts","sourceRoot":"","sources":["../src/CalloutNativeCommands.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,WAAW,IAAI,IAAI,CAAC;IACpB,UAAU,IAAI,IAAI,CAAC;CACpB"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=CalloutNativeCommands.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CalloutNativeCommands.types.js","sourceRoot":"","sources":["../src/CalloutNativeCommands.types.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"MacOSCalloutNativeCompon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C/E,SAAS,CAAC,EAAE,kBAAkB,CAAC;QAAE,MAAM,EAAE,KAAK,CAAA;KAAE,CAAC,CAAC;IAClD,MAAM,CAAC,EAAE,kBAAkB,CAAC;QAAE,MAAM,EAAE,KAAK,CAAA;KAAE,CAAC,CAAC;CAChD;AAED,MAAM,MAAM,oBAAoB,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;AAC9D,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,oBAAoB,CAAC,KAAK,IAAI,CAAC;IACvE,UAAU,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,UAAU,CAAC,oBAAoB,CAAC,KAAK,IAAI,CAAC;CACvE;AAED,eAAO,MAAM,QAAQ,EAAE,qBAErB,CAAC;;AAEH,wBAAyF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"MacOSCalloutNativeComponent.js","sourceRoot":"","sources":["../src/MacOSCalloutNativeComponent.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAKH,mHAA2F;AAC3F,qHAA6F;AAmDhF,QAAA,QAAQ,GAA0B,IAAA,+BAAqB,EAAwB;IAC1F,iBAAiB,EAAE,CAAC,YAAY,EAAE,aAAa,CAAC;CACjD,CAAC,CAAC;AAEH,kBAAe,IAAA,gCAAsB,EAAc,YAAY,CAAyB,CAAC"}
@@ -1,4 +0,0 @@
1
- export interface CalloutNativeCommands {
2
- focusWindow(): void;
3
- blurWindow(): void;
4
- }
@@ -1,2 +0,0 @@
1
- // Separate .d.ts file to fool codegen, since UnsafeMixed does not existing in the TS types of RN currently.
2
- export type UnsafeMixed = any;