@fluentui-react-native/tester 0.82.12 → 0.83.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,13 +2,44 @@
2
2
  import { __assign } from "tslib";
3
3
  import { ThemeProvider } from '@fluentui-react-native/theme';
4
4
  import * as React from 'react';
5
- import { Platform } from 'react-native';
5
+ import { Platform, useWindowDimensions } from 'react-native';
6
6
  import { FluentTester } from './FluentTester';
7
7
  import { tests } from './testPages';
8
8
  import { testerTheme } from './theme/index';
9
- var isMobile = Platform.OS == 'android' || (Platform.OS === 'ios' && Platform.isPad === false);
9
+ /**
10
+ * Hook that "guesses" our Size Class on iOS based on our window width.
11
+ * Note: this is hacky and should not be used.
12
+ *
13
+ * For more information about Size Classes, see the following:
14
+ * https://developer.apple.com/documentation/uikit/uitraitcollection
15
+ * https://developer.apple.com/design/human-interface-guidelines/foundations/layout/#platform-considerations
16
+ * @returns SizeClassIOS: enum determining our size class
17
+ */
18
+ var useSizeClassIOS_DO_NOT_USE = function () {
19
+ if (Platform.OS === 'ios') {
20
+ /**
21
+ * Technically this violates the rules of hooks (calling hooks inside conditions) but Platform.OS checks are pretty non-conditional.
22
+ * This is necessary because useWindowDimensions() does not work in win32.
23
+ */
24
+ // eslint-disable-next-line react-hooks/rules-of-hooks
25
+ var width = useWindowDimensions().width;
26
+ if (Platform.isPad && width > 375) {
27
+ return 'regular';
28
+ }
29
+ else {
30
+ return 'compact';
31
+ }
32
+ }
33
+ else {
34
+ return undefined;
35
+ }
36
+ };
10
37
  export var FluentTesterApp = function (props) {
38
+ var sizeClass = useSizeClassIOS_DO_NOT_USE();
39
+ var isMobile = Platform.OS == 'android' || (Platform.OS === 'ios' && Platform.isPad === false);
40
+ // If on iPad we are presented in a Split View or Slide Over context, show the single pane view.
41
+ var shouldShowSinglePane = isMobile || (!isMobile && sizeClass === 'compact');
11
42
  return (React.createElement(ThemeProvider, { theme: testerTheme },
12
- React.createElement(FluentTester, __assign({ enabledTests: tests, enableSinglePaneView: isMobile }, props))));
43
+ React.createElement(FluentTester, __assign({ enabledTests: tests, enableSinglePaneView: shouldShowSinglePane }, props))));
13
44
  };
14
45
  //# sourceMappingURL=FluentTesterApp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FluentTesterApp.js","sourceRoot":"","sources":["../src/FluentTesterApp.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,YAAY,EAAqB,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,IAAM,QAAQ,GAAG,QAAQ,CAAC,EAAE,IAAI,SAAS,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,QAAQ,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;AAEjG,MAAM,CAAC,IAAM,eAAe,GAA+C,UAAC,KAAK;IAC/E,OAAO,CACL,oBAAC,aAAa,IAAC,KAAK,EAAE,WAAW;QAC/B,oBAAC,YAAY,aAAC,YAAY,EAAE,KAAK,EAAE,oBAAoB,EAAE,QAAQ,IAAM,KAAK,EAAI,CAClE,CACjB,CAAC;AACJ,CAAC,CAAC"}
1
+ {"version":3,"file":"FluentTesterApp.js","sourceRoot":"","sources":["../src/FluentTesterApp.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAqB,MAA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M,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAMtE,CAAC"}
1
+ {"version":3,"file":"FluentTesterApp.d.ts","sourceRoot":"","sources":["../src/FluentTesterApp.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAgB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAiCjE,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAYtE,CAAC"}
@@ -8,10 +8,41 @@ var react_native_1 = require("react-native");
8
8
  var FluentTester_1 = require("./FluentTester");
9
9
  var testPages_1 = require("./testPages");
10
10
  var index_1 = require("./theme/index");
11
- var isMobile = react_native_1.Platform.OS == 'android' || (react_native_1.Platform.OS === 'ios' && react_native_1.Platform.isPad === false);
11
+ /**
12
+ * Hook that "guesses" our Size Class on iOS based on our window width.
13
+ * Note: this is hacky and should not be used.
14
+ *
15
+ * For more information about Size Classes, see the following:
16
+ * https://developer.apple.com/documentation/uikit/uitraitcollection
17
+ * https://developer.apple.com/design/human-interface-guidelines/foundations/layout/#platform-considerations
18
+ * @returns SizeClassIOS: enum determining our size class
19
+ */
20
+ var useSizeClassIOS_DO_NOT_USE = function () {
21
+ if (react_native_1.Platform.OS === 'ios') {
22
+ /**
23
+ * Technically this violates the rules of hooks (calling hooks inside conditions) but Platform.OS checks are pretty non-conditional.
24
+ * This is necessary because useWindowDimensions() does not work in win32.
25
+ */
26
+ // eslint-disable-next-line react-hooks/rules-of-hooks
27
+ var width = (0, react_native_1.useWindowDimensions)().width;
28
+ if (react_native_1.Platform.isPad && width > 375) {
29
+ return 'regular';
30
+ }
31
+ else {
32
+ return 'compact';
33
+ }
34
+ }
35
+ else {
36
+ return undefined;
37
+ }
38
+ };
12
39
  var FluentTesterApp = function (props) {
40
+ var sizeClass = useSizeClassIOS_DO_NOT_USE();
41
+ var isMobile = react_native_1.Platform.OS == 'android' || (react_native_1.Platform.OS === 'ios' && react_native_1.Platform.isPad === false);
42
+ // If on iPad we are presented in a Split View or Slide Over context, show the single pane view.
43
+ var shouldShowSinglePane = isMobile || (!isMobile && sizeClass === 'compact');
13
44
  return (React.createElement(theme_1.ThemeProvider, { theme: index_1.testerTheme },
14
- React.createElement(FluentTester_1.FluentTester, (0, tslib_1.__assign)({ enabledTests: testPages_1.tests, enableSinglePaneView: isMobile }, props))));
45
+ React.createElement(FluentTester_1.FluentTester, (0, tslib_1.__assign)({ enabledTests: testPages_1.tests, enableSinglePaneView: shouldShowSinglePane }, props))));
15
46
  };
16
47
  exports.FluentTesterApp = FluentTesterApp;
17
48
  //# sourceMappingURL=FluentTesterApp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FluentTesterApp.js","sourceRoot":"","sources":["../src/FluentTesterApp.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;AAEb,sDAA6D;AAC7D,wDAA+B;AAC/B,6CAAwC;AACxC,+CAAiE;AACjE,yCAAoC;AACpC,uCAA4C;AAE5C,IAAM,QAAQ,GAAG,uBAAQ,CAAC,EAAE,IAAI,SAAS,IAAI,CAAC,uBAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,uBAAQ,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;AAE1F,IAAM,eAAe,GAA+C,UAAC,KAAK;IAC/E,OAAO,CACL,oBAAC,qBAAa,IAAC,KAAK,EAAE,mBAAW;QAC/B,oBAAC,2BAAY,0BAAC,YAAY,EAAE,iBAAK,EAAE,oBAAoB,EAAE,QAAQ,IAAM,KAAK,EAAI,CAClE,CACjB,CAAC;AACJ,CAAC,CAAC;AANW,QAAA,eAAe,mBAM1B"}
1
+ {"version":3,"file":"FluentTesterApp.js","sourceRoot":"","sources":["../src/FluentTesterApp.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;AAEb,sDAA6D;AAC7D,wDAA+B;AAC/B,6CAA6D;AAC7D,+CAAiE;AACjE,yCAAoC;AACpC,uCAA4C;AA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