@fluentui-react-native/framework 0.14.17 → 0.15.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/babel.config.js +1 -1
  3. package/lib/compose.d.ts +27 -12
  4. package/lib/compose.js +2 -2
  5. package/lib/compose.js.map +1 -1
  6. package/lib/compressible.d.ts +5 -2
  7. package/lib/compressible.js +8 -8
  8. package/lib/compressible.js.map +1 -1
  9. package/lib/compressible.test.d.ts +1 -1
  10. package/lib/compressible.test.js +67 -59
  11. package/lib/compressible.test.js.map +1 -1
  12. package/lib/index.d.ts +76 -6
  13. package/lib/index.js +16 -2
  14. package/lib/themeHelper.d.ts +1 -1
  15. package/lib/themeHelper.js +6 -6
  16. package/lib/themeHelper.js.map +1 -1
  17. package/lib/useFluentTheme.d.ts +1 -1
  18. package/lib/useFluentTheme.js +2 -2
  19. package/lib/useFluentTheme.js.map +1 -1
  20. package/lib/useStyling.d.ts +15 -4
  21. package/lib/useStyling.js +4 -4
  22. package/lib/useStyling.js.map +1 -1
  23. package/lib/useTokens.d.ts +1 -1
  24. package/lib/useTokens.js +2 -2
  25. package/lib/useTokens.js.map +1 -1
  26. package/lib-commonjs/compose.d.ts +27 -12
  27. package/lib-commonjs/compose.js +7 -8
  28. package/lib-commonjs/compose.js.map +1 -1
  29. package/lib-commonjs/compressible.d.ts +5 -2
  30. package/lib-commonjs/compressible.js +12 -13
  31. package/lib-commonjs/compressible.js.map +1 -1
  32. package/lib-commonjs/compressible.test.d.ts +1 -1
  33. package/lib-commonjs/compressible.test.js +134 -91
  34. package/lib-commonjs/compressible.test.js.map +1 -1
  35. package/lib-commonjs/index.d.ts +76 -6
  36. package/lib-commonjs/index.js +283 -55
  37. package/lib-commonjs/index.js.map +1 -1
  38. package/lib-commonjs/themeHelper.d.ts +1 -1
  39. package/lib-commonjs/themeHelper.js +9 -9
  40. package/lib-commonjs/themeHelper.js.map +1 -1
  41. package/lib-commonjs/useFluentTheme.d.ts +1 -1
  42. package/lib-commonjs/useFluentTheme.js +7 -8
  43. package/lib-commonjs/useFluentTheme.js.map +1 -1
  44. package/lib-commonjs/useStyling.d.ts +15 -4
  45. package/lib-commonjs/useStyling.js +10 -11
  46. package/lib-commonjs/useStyling.js.map +1 -1
  47. package/lib-commonjs/useTokens.d.ts +1 -1
  48. package/lib-commonjs/useTokens.js +33 -13
  49. package/lib-commonjs/useTokens.js.map +1 -1
  50. package/package.json +68 -66
  51. package/src/compressible.test.tsx +15 -14
package/package.json CHANGED
@@ -1,85 +1,95 @@
1
1
  {
2
2
  "name": "@fluentui-react-native/framework",
3
- "version": "0.14.17",
3
+ "version": "0.15.0",
4
4
  "description": "Component framework used by fluentui react native controls",
5
- "main": "lib-commonjs/index.js",
6
- "module": "lib/index.js",
7
- "react-native": "src/index.ts",
8
- "typings": "lib/index.d.ts",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/microsoft/fluentui-react-native.git",
8
+ "directory": "packages/framework/framework"
9
+ },
10
+ "license": "MIT",
11
+ "author": "",
9
12
  "exports": {
10
13
  ".": {
14
+ "types": "./lib/index.d.ts",
11
15
  "import": "./lib/index.js",
12
- "require": "./lib-commonjs/index.js",
13
- "types": "./lib/index.d.ts"
16
+ "require": "./lib-commonjs/index.js"
14
17
  }
15
18
  },
19
+ "main": "lib-commonjs/index.js",
20
+ "module": "lib/index.js",
21
+ "types": "lib/index.d.ts",
16
22
  "scripts": {
17
23
  "build": "fluentui-scripts build",
24
+ "build-cjs": "tsgo --outDir lib-commonjs",
25
+ "build-esm": "tsgo --outDir lib --module esnext --moduleResolution bundler",
18
26
  "clean": "fluentui-scripts clean",
19
27
  "depcheck": "fluentui-scripts depcheck",
20
- "just": "fluentui-scripts",
21
28
  "lint": "fluentui-scripts eslint",
22
- "start:tester": "react-native start --projectRoot ./src",
29
+ "lint-package": "fluentui-scripts lint-package",
30
+ "prettier": "fluentui-scripts prettier",
23
31
  "start-test": "fluentui-scripts jest-watch",
32
+ "start:tester": "rnx-cli start",
24
33
  "test": "fluentui-scripts jest",
25
- "update-snapshots": "fluentui-scripts jest -u",
26
- "prettier": "fluentui-scripts prettier",
27
- "prettier-fix": "fluentui-scripts prettier --fix true"
28
- },
29
- "repository": {
30
- "type": "git",
31
- "url": "https://github.com/microsoft/fluentui-react-native.git",
32
- "directory": "packages/framework/framework"
34
+ "update-snapshots": "fluentui-scripts jest -u"
33
35
  },
34
36
  "dependencies": {
35
- "@fluentui-react-native/composition": "0.11.12",
36
- "@fluentui-react-native/default-theme": "0.26.17",
37
- "@fluentui-react-native/framework-base": "0.2.1",
38
- "@fluentui-react-native/theme-types": "0.43.0",
39
- "@fluentui-react-native/tokens": "0.23.11",
40
- "@fluentui-react-native/use-slot": "0.6.12",
41
- "@fluentui-react-native/use-slots": "0.10.12",
42
- "@fluentui-react-native/use-styling": "0.13.12",
43
- "@fluentui-react-native/use-tokens": "0.6.12"
37
+ "@fluentui-react-native/composition": "0.12.0",
38
+ "@fluentui-react-native/default-theme": "0.27.0",
39
+ "@fluentui-react-native/framework-base": "0.3.0",
40
+ "@fluentui-react-native/theme-types": "0.44.0",
41
+ "@fluentui-react-native/tokens": "0.24.0",
42
+ "@fluentui-react-native/use-slot": "0.7.0",
43
+ "@fluentui-react-native/use-slots": "0.11.0",
44
+ "@fluentui-react-native/use-styling": "0.14.0",
45
+ "@fluentui-react-native/use-tokens": "0.7.0"
44
46
  },
45
47
  "devDependencies": {
46
48
  "@babel/core": "^7.20.0",
49
+ "@fluentui-react-native/babel-config": "0.1.1",
47
50
  "@fluentui-react-native/eslint-config-rules": "0.1.1",
48
51
  "@fluentui-react-native/jest-config": "0.1.1",
49
- "@fluentui-react-native/scripts": "0.1.1",
50
- "@react-native/babel-preset": "^0.74.0",
51
- "@react-native/metro-config": "^0.74.0",
52
- "@types/react": "^18.2.0",
53
- "@types/react-test-renderer": "^18.2.0",
54
- "react": "18.2.0",
55
- "react-native": "^0.74.0",
56
- "react-native-macos": "^0.74.0",
57
- "react-native-windows": "^0.74.0",
58
- "react-test-renderer": "18.2.0"
52
+ "@fluentui-react-native/kit-config": "0.1.2",
53
+ "@fluentui-react-native/scripts": "0.1.2",
54
+ "@react-native-community/cli": "^20.0.0",
55
+ "@react-native-community/cli-platform-android": "^20.0.0",
56
+ "@react-native-community/cli-platform-ios": "^20.0.0",
57
+ "@react-native/babel-preset": "^0.81.0",
58
+ "@react-native/metro-config": "^0.81.0",
59
+ "@rnx-kit/cli": "^1.0.0",
60
+ "@types/react": "~19.1.0",
61
+ "@types/react-test-renderer": "^19.1.0",
62
+ "react": "19.1.0",
63
+ "react-native": "^0.81.0",
64
+ "react-native-macos": "^0.81.0",
65
+ "react-native-windows": "^0.81.0",
66
+ "react-test-renderer": "19.1.0"
59
67
  },
60
68
  "peerDependencies": {
61
69
  "@office-iss/react-native-win32": "^0.74.0",
62
- "react": "18.2.0",
63
- "react-native": "^0.73.0 || ^0.74.0",
64
- "react-native-macos": "^0.73.0 || ^0.74.0",
65
- "react-native-windows": "^0.73.0 || ^0.74.0"
70
+ "@types/react": "~18.2.0 || ~19.0.0 || ~19.1.0",
71
+ "react": "18.2.0 || 19.0.0 || 19.1.0",
72
+ "react-native": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0",
73
+ "react-native-macos": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0",
74
+ "react-native-windows": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0"
75
+ },
76
+ "peerDependenciesMeta": {
77
+ "@office-iss/react-native-win32": {
78
+ "optional": true
79
+ },
80
+ "@types/react": {
81
+ "optional": true
82
+ },
83
+ "react-native-macos": {
84
+ "optional": true
85
+ },
86
+ "react-native-windows": {
87
+ "optional": true
88
+ }
66
89
  },
67
- "author": "",
68
- "license": "MIT",
69
90
  "rnx-kit": {
70
91
  "kitType": "library",
71
92
  "alignDeps": {
72
- "presets": [
73
- "microsoft/react-native"
74
- ],
75
- "requirements": {
76
- "development": [
77
- "react-native@0.74"
78
- ],
79
- "production": [
80
- "react-native@0.73 || 0.74"
81
- ]
82
- },
83
93
  "capabilities": [
84
94
  "babel-preset-react-native",
85
95
  "core",
@@ -88,19 +98,11 @@
88
98
  "core-macos",
89
99
  "core-windows",
90
100
  "react",
91
- "react-test-renderer"
101
+ "react-test-renderer",
102
+ "tools-core",
103
+ "tools-jest"
92
104
  ]
93
- }
94
- },
95
- "peerDependenciesMeta": {
96
- "@office-iss/react-native-win32": {
97
- "optional": true
98
105
  },
99
- "react-native-macos": {
100
- "optional": true
101
- },
102
- "react-native-windows": {
103
- "optional": true
104
- }
106
+ "extends": "@fluentui-react-native/kit-config"
105
107
  }
106
- }
108
+ }
@@ -1,13 +1,12 @@
1
- /** @jsxRuntime classic */
2
- /** @jsx withSlots */
1
+ /** @jsxImportSource @fluentui-react-native/framework-base */
3
2
  import * as React from 'react';
3
+ import { act } from 'react';
4
4
  import type { TextProps, TextStyle } from 'react-native';
5
5
  import { Text, View } from 'react-native';
6
6
 
7
7
  import { mergeStyles } from '@fluentui-react-native/framework-base';
8
8
  import type { Theme } from '@fluentui-react-native/theme-types';
9
9
  import { useSlot } from '@fluentui-react-native/use-slot';
10
- import { withSlots } from '@fluentui-react-native/framework-base';
11
10
  import { applyTokenLayers } from '@fluentui-react-native/use-tokens';
12
11
  import * as renderer from 'react-test-renderer';
13
12
 
@@ -54,7 +53,7 @@ const VariantText = compressible<VariantTextProps, VariantTextTokens>(
54
53
  // now apply the alternate layer tokens as appropriate
55
54
  [tokens, cache] = applyTokenLayers(tokens, ['normal', 'header', 'caption'], cache, (layer) => layer === variant);
56
55
  // merge styles together with what is passed in
57
- const mergedStyle = mergeStyles({ color: tokens.color, fontSize: tokens.fontSize, fontWeight: tokens.fontWeight }, style);
56
+ const mergedStyle = mergeStyles<TextStyle>({ color: tokens.color, fontSize: tokens.fontSize, fontWeight: tokens.fontWeight }, style);
58
57
  // now get the slot
59
58
  const InnerText = useSlot<TextProps>(Text, { ...rest, style: mergedStyle });
60
59
 
@@ -105,26 +104,28 @@ const Label = compressible<LabelProps, LabelTokens>((props: LabelProps, useToken
105
104
 
106
105
  describe('compressible tests', () => {
107
106
  it('Two labels, one with caption and one without', () => {
108
- const tree = renderer
109
- .create(
107
+ let component: renderer.ReactTestRenderer;
108
+ act(() => {
109
+ component = renderer.create(
110
110
  <View>
111
111
  <Label headerText="Header1" />
112
112
  <Label headerText="Header2" captionText="Caption2" />
113
113
  </View>,
114
- )
115
- .toJSON();
116
- expect(tree).toMatchSnapshot();
114
+ );
115
+ });
116
+ expect(component!.toJSON()).toMatchSnapshot();
117
117
  });
118
118
 
119
119
  it('Two labels, one plugging in SuperHeader instead', () => {
120
- const tree = renderer
121
- .create(
120
+ let component: renderer.ReactTestRenderer;
121
+ act(() => {
122
+ component = renderer.create(
122
123
  <View>
123
124
  <Label headerText="Super Header" headerSlot={SuperHeader} captionText="Normal caption" />
124
125
  <Label headerText="Normal Header" captionText="Another normal caption" />
125
126
  </View>,
126
- )
127
- .toJSON();
128
- expect(tree).toMatchSnapshot();
127
+ );
128
+ });
129
+ expect(component!.toJSON()).toMatchSnapshot();
129
130
  });
130
131
  });