@fluentui-react-native/experimental-shimmer 0.13.19 → 0.14.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 (110) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/SPEC.md +2 -2
  3. package/lib/Shimmer.d.ts +7 -2
  4. package/lib/Shimmer.d.ts.map +1 -1
  5. package/lib/Shimmer.js +151 -90
  6. package/lib/Shimmer.js.map +1 -1
  7. package/lib/Shimmer.styling.d.ts +1 -1
  8. package/lib/Shimmer.styling.js +29 -26
  9. package/lib/Shimmer.styling.win32.d.ts +1 -1
  10. package/lib/Shimmer.styling.win32.js +36 -24
  11. package/lib/Shimmer.test.d.ts +1 -1
  12. package/lib/Shimmer.test.js +48 -44
  13. package/lib/Shimmer.test.js.map +1 -1
  14. package/lib/Shimmer.types.d.ts +10 -2
  15. package/lib/Shimmer.types.js +1 -1
  16. package/lib/Shimmer.types.shared.d.ts +123 -123
  17. package/lib/Shimmer.types.shared.js +1 -1
  18. package/lib/Shimmer.types.win32.d.ts +26 -26
  19. package/lib/Shimmer.types.win32.js +1 -1
  20. package/lib/Shimmer.win32.d.ts +7 -2
  21. package/lib/Shimmer.win32.d.ts.map +1 -1
  22. package/lib/Shimmer.win32.js +138 -114
  23. package/lib/Shimmer.win32.js.map +1 -1
  24. package/lib/ShimmerTokens.android.d.ts +1 -1
  25. package/lib/ShimmerTokens.android.js +8 -8
  26. package/lib/ShimmerTokens.android.js.map +1 -1
  27. package/lib/ShimmerTokens.d.ts +1 -1
  28. package/lib/ShimmerTokens.ios.d.ts +1 -1
  29. package/lib/ShimmerTokens.ios.js +8 -8
  30. package/lib/ShimmerTokens.ios.js.map +1 -1
  31. package/lib/ShimmerTokens.js +9 -9
  32. package/lib/ShimmerTokens.js.map +1 -1
  33. package/lib/ShimmerTokens.win32.d.ts +1 -1
  34. package/lib/ShimmerTokens.win32.js +10 -10
  35. package/lib/ShimmerTokens.win32.js.map +1 -1
  36. package/lib/SvgShapeToPath.d.ts +1 -1
  37. package/lib/SvgShapeToPath.js +134 -120
  38. package/lib/SvgShapeToPath.js.map +1 -1
  39. package/lib/Win32ShimmerNativeComponent.d.ts +5 -5
  40. package/lib/Win32ShimmerNativeComponent.d.ts.map +1 -1
  41. package/lib/Win32ShimmerNativeComponent.js +3 -3
  42. package/lib/Win32ShimmerNativeComponent.js.map +1 -1
  43. package/lib/consts.android.d.ts +1 -1
  44. package/lib/consts.android.js +1 -1
  45. package/lib/consts.d.ts +1 -1
  46. package/lib/consts.ios.d.ts +1 -1
  47. package/lib/consts.ios.js +1 -1
  48. package/lib/consts.js +1 -1
  49. package/lib/consts.win32.d.ts +1 -1
  50. package/lib/consts.win32.js +1 -1
  51. package/lib/index.d.ts +10 -2
  52. package/lib/index.js +1 -1
  53. package/lib-commonjs/Shimmer.d.ts +7 -2
  54. package/lib-commonjs/Shimmer.d.ts.map +1 -1
  55. package/lib-commonjs/Shimmer.js +164 -101
  56. package/lib-commonjs/Shimmer.js.map +1 -1
  57. package/lib-commonjs/Shimmer.styling.d.ts +1 -1
  58. package/lib-commonjs/Shimmer.styling.js +34 -31
  59. package/lib-commonjs/Shimmer.styling.win32.d.ts +1 -1
  60. package/lib-commonjs/Shimmer.styling.win32.js +41 -29
  61. package/lib-commonjs/Shimmer.test.d.ts +1 -1
  62. package/lib-commonjs/Shimmer.test.js +102 -71
  63. package/lib-commonjs/Shimmer.test.js.map +1 -1
  64. package/lib-commonjs/Shimmer.types.d.ts +10 -2
  65. package/lib-commonjs/Shimmer.types.js +10 -5
  66. package/lib-commonjs/Shimmer.types.js.map +1 -1
  67. package/lib-commonjs/Shimmer.types.shared.d.ts +123 -123
  68. package/lib-commonjs/Shimmer.types.shared.js +3 -3
  69. package/lib-commonjs/Shimmer.types.win32.d.ts +26 -26
  70. package/lib-commonjs/Shimmer.types.win32.js +10 -5
  71. package/lib-commonjs/Shimmer.types.win32.js.map +1 -1
  72. package/lib-commonjs/Shimmer.win32.d.ts +7 -2
  73. package/lib-commonjs/Shimmer.win32.d.ts.map +1 -1
  74. package/lib-commonjs/Shimmer.win32.js +166 -128
  75. package/lib-commonjs/Shimmer.win32.js.map +1 -1
  76. package/lib-commonjs/ShimmerTokens.android.d.ts +1 -1
  77. package/lib-commonjs/ShimmerTokens.android.js +11 -11
  78. package/lib-commonjs/ShimmerTokens.android.js.map +1 -1
  79. package/lib-commonjs/ShimmerTokens.d.ts +1 -1
  80. package/lib-commonjs/ShimmerTokens.ios.d.ts +1 -1
  81. package/lib-commonjs/ShimmerTokens.ios.js +11 -11
  82. package/lib-commonjs/ShimmerTokens.ios.js.map +1 -1
  83. package/lib-commonjs/ShimmerTokens.js +13 -13
  84. package/lib-commonjs/ShimmerTokens.js.map +1 -1
  85. package/lib-commonjs/ShimmerTokens.win32.d.ts +1 -1
  86. package/lib-commonjs/ShimmerTokens.win32.js +13 -13
  87. package/lib-commonjs/ShimmerTokens.win32.js.map +1 -1
  88. package/lib-commonjs/SvgShapeToPath.d.ts +1 -1
  89. package/lib-commonjs/SvgShapeToPath.js +138 -125
  90. package/lib-commonjs/SvgShapeToPath.js.map +1 -1
  91. package/lib-commonjs/Win32ShimmerNativeComponent.d.ts +5 -5
  92. package/lib-commonjs/Win32ShimmerNativeComponent.d.ts.map +1 -1
  93. package/lib-commonjs/Win32ShimmerNativeComponent.js +5 -8
  94. package/lib-commonjs/Win32ShimmerNativeComponent.js.map +1 -1
  95. package/lib-commonjs/consts.android.d.ts +1 -1
  96. package/lib-commonjs/consts.android.js +3 -3
  97. package/lib-commonjs/consts.d.ts +1 -1
  98. package/lib-commonjs/consts.ios.d.ts +1 -1
  99. package/lib-commonjs/consts.ios.js +3 -3
  100. package/lib-commonjs/consts.js +3 -3
  101. package/lib-commonjs/consts.win32.d.ts +1 -1
  102. package/lib-commonjs/consts.win32.js +3 -3
  103. package/lib-commonjs/index.d.ts +10 -2
  104. package/lib-commonjs/index.js +36 -11
  105. package/lib-commonjs/index.js.map +1 -1
  106. package/package.json +63 -62
  107. package/src/Shimmer.test.tsx +16 -13
  108. package/src/Shimmer.tsx +3 -4
  109. package/src/Shimmer.win32.tsx +1 -3
  110. package/src/Win32ShimmerNativeComponent.ts +3 -3
package/package.json CHANGED
@@ -1,82 +1,91 @@
1
1
  {
2
2
  "name": "@fluentui-react-native/experimental-shimmer",
3
- "version": "0.13.19",
3
+ "version": "0.14.0",
4
4
  "description": "A cross-platform Fluent Shimmer component",
5
- "main": "lib-commonjs/index.js",
6
- "module": "lib/index.js",
7
- "react-native": "src/index.ts",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/microsoft/fluentui-react-native.git",
8
+ "directory": "packages/experimental/Shimmer"
9
+ },
10
+ "license": "MIT",
11
+ "author": "",
8
12
  "exports": {
9
13
  ".": {
14
+ "types": "./lib/index.d.ts",
10
15
  "import": "./lib/index.js",
11
- "require": "./lib-commonjs/index.js",
12
- "types": "./lib/index.d.ts"
16
+ "require": "./lib-commonjs/index.js"
13
17
  }
14
18
  },
15
- "typings": "lib/index.d.ts",
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",
18
- "just": "fluentui-scripts",
24
+ "build-cjs": "tsgo --outDir lib-commonjs",
25
+ "build-esm": "tsgo --outDir lib --module esnext --moduleResolution bundler",
19
26
  "clean": "fluentui-scripts clean",
20
27
  "depcheck": "fluentui-scripts depcheck",
21
28
  "lint": "fluentui-scripts eslint",
22
- "test": "fluentui-scripts jest",
23
- "update-snapshots": "fluentui-scripts jest -u",
29
+ "lint-package": "fluentui-scripts lint-package",
24
30
  "prettier": "fluentui-scripts prettier",
25
- "prettier-fix": "fluentui-scripts prettier --fix true"
26
- },
27
- "repository": {
28
- "type": "git",
29
- "url": "https://github.com/microsoft/fluentui-react-native.git",
30
- "directory": "packages/experimental/Shimmer"
31
+ "test": "fluentui-scripts jest",
32
+ "update-snapshots": "fluentui-scripts jest -u"
31
33
  },
32
34
  "dependencies": {
33
- "@fluentui-react-native/framework": "0.14.16",
34
- "@fluentui-react-native/theming-utils": "0.26.10",
35
- "@fluentui-react-native/tokens": "0.23.10",
36
- "@fluentui-react-native/use-styling": "0.13.12",
35
+ "@fluentui-react-native/framework": "0.15.0",
36
+ "@fluentui-react-native/theming-utils": "0.27.0",
37
+ "@fluentui-react-native/tokens": "0.24.0",
38
+ "@fluentui-react-native/use-styling": "0.14.0",
37
39
  "assert-never": "^1.2.1"
38
40
  },
39
41
  "devDependencies": {
40
42
  "@babel/core": "^7.20.0",
41
43
  "@fluentui-react-native/babel-config": "0.1.1",
42
44
  "@fluentui-react-native/eslint-config-rules": "0.1.1",
45
+ "@fluentui-react-native/framework-base": "0.3.0",
43
46
  "@fluentui-react-native/jest-config": "0.1.1",
44
- "@fluentui-react-native/scripts": "0.1.1",
45
- "@react-native/babel-preset": "^0.74.0",
46
- "@react-native/metro-config": "^0.74.0",
47
- "@types/react": "~18.2.0",
48
- "@types/react-test-renderer": "^18.2.0",
49
- "react": "18.2.0",
50
- "react-native": "^0.74.0",
51
- "react-native-macos": "^0.74.0",
52
- "react-native-svg": "^15.4.0",
53
- "react-native-windows": "^0.74.0",
54
- "react-test-renderer": "18.2.0"
47
+ "@fluentui-react-native/kit-config": "0.1.2",
48
+ "@fluentui-react-native/scripts": "0.1.2",
49
+ "@react-native-community/cli": "^20.0.0",
50
+ "@react-native-community/cli-platform-android": "^20.0.0",
51
+ "@react-native-community/cli-platform-ios": "^20.0.0",
52
+ "@react-native/babel-preset": "^0.81.0",
53
+ "@react-native/metro-config": "^0.81.0",
54
+ "@types/react": "~19.1.0",
55
+ "@types/react-test-renderer": "^19.1.0",
56
+ "react": "19.1.0",
57
+ "react-native": "^0.81.0",
58
+ "react-native-macos": "^0.81.0",
59
+ "react-native-svg": "^15.12.1",
60
+ "react-native-windows": "^0.81.0",
61
+ "react-test-renderer": "19.1.0"
55
62
  },
56
63
  "peerDependencies": {
57
64
  "@office-iss/react-native-win32": "^0.74.0",
58
- "react": "18.2.0",
59
- "react-native": "^0.73.0 || ^0.74.0",
60
- "react-native-macos": "^0.73.0 || ^0.74.0",
61
- "react-native-svg": "^15.0.0 || ^15.4.0",
62
- "react-native-windows": "^0.73.0 || ^0.74.0"
65
+ "@types/react": "~18.2.0 || ~19.0.0 || ~19.1.0",
66
+ "react": "18.2.0 || 19.0.0 || 19.1.0",
67
+ "react-native": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0",
68
+ "react-native-macos": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0",
69
+ "react-native-svg": ">=15.0.0 <15.13.0 || >=15.4.0 <15.13.0 || ^15.11.2 || ^15.12.1",
70
+ "react-native-windows": "^0.73.0 || ^0.74.0 || ^0.78.0 || ^0.81.0"
71
+ },
72
+ "peerDependenciesMeta": {
73
+ "@office-iss/react-native-win32": {
74
+ "optional": true
75
+ },
76
+ "@types/react": {
77
+ "optional": true
78
+ },
79
+ "react-native-macos": {
80
+ "optional": true
81
+ },
82
+ "react-native-windows": {
83
+ "optional": true
84
+ }
63
85
  },
64
- "author": "",
65
- "license": "MIT",
66
86
  "rnx-kit": {
67
87
  "kitType": "library",
68
88
  "alignDeps": {
69
- "presets": [
70
- "microsoft/react-native"
71
- ],
72
- "requirements": {
73
- "development": [
74
- "react-native@0.74"
75
- ],
76
- "production": [
77
- "react-native@0.73 || 0.74"
78
- ]
79
- },
80
89
  "capabilities": [
81
90
  "babel-preset-react-native",
82
91
  "core",
@@ -84,20 +93,12 @@
84
93
  "core-ios",
85
94
  "core-macos",
86
95
  "core-windows",
96
+ "react-test-renderer",
87
97
  "svg",
88
- "react-test-renderer"
98
+ "tools-core",
99
+ "tools-jest"
89
100
  ]
90
- }
91
- },
92
- "peerDependenciesMeta": {
93
- "@office-iss/react-native-win32": {
94
- "optional": true
95
101
  },
96
- "react-native-macos": {
97
- "optional": true
98
- },
99
- "react-native-windows": {
100
- "optional": true
101
- }
102
+ "extends": "@fluentui-react-native/kit-config"
102
103
  }
103
- }
104
+ }
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { act } from 'react';
2
2
 
3
3
  import * as renderer from 'react-test-renderer';
4
4
 
@@ -39,22 +39,25 @@ function shimmerRects(): Array<ShimmerRectElement | ShimmerCircleElement> {
39
39
 
40
40
  const style = { width: 300, height: 100 };
41
41
 
42
- describe('Shimmer component tests', () => {
43
- beforeAll(() => {
44
- // mocks out setTimeout and other timer functions with mock functions, test will fail without this as we're using Animated API
45
- jest.useFakeTimers();
46
- jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper');
47
- });
42
+ // mocks out setTimeout and other timer functions with mock functions, test will fail without this as we're using Animated API
43
+ jest.useFakeTimers();
48
44
 
45
+ describe('Shimmer component tests', () => {
49
46
  it('Shimmer default', async () => {
50
- const tree = renderer.create(<Shimmer elements={shimmerRects()} />).toJSON();
51
- expect(tree).toMatchSnapshot();
52
- await renderer.act(async () => null);
47
+ let component: renderer.ReactTestRenderer;
48
+ act(() => {
49
+ component = renderer.create(<Shimmer elements={shimmerRects()} />);
50
+ });
51
+ expect(component!.toJSON()).toMatchSnapshot();
52
+ await act(async () => null);
53
53
  });
54
54
 
55
55
  it('Shimmer with style prop', async () => {
56
- const tree = renderer.create(<Shimmer elements={shimmerRects()} style={style} />).toJSON();
57
- expect(tree).toMatchSnapshot();
58
- await renderer.act(async () => null);
56
+ let component: renderer.ReactTestRenderer;
57
+ act(() => {
58
+ component = renderer.create(<Shimmer elements={shimmerRects()} style={style} />);
59
+ });
60
+ expect(component!.toJSON()).toMatchSnapshot();
61
+ await act(async () => null);
59
62
  });
60
63
  });
package/src/Shimmer.tsx CHANGED
@@ -1,11 +1,10 @@
1
- /** @jsxRuntime classic */
2
- /** @jsx withSlots */
1
+ /** @jsxImportSource @fluentui-react-native/framework-base */
3
2
  import { useRef, useEffect, useMemo, useCallback } from 'react';
4
3
  import type { ScaleXTransform, TranslateXTransform } from 'react-native';
5
4
  import { Animated, I18nManager } from 'react-native';
6
5
 
7
6
  import type { UseSlots } from '@fluentui-react-native/framework';
8
- import { compose, mergeProps, withSlots, buildUseStyling } from '@fluentui-react-native/framework';
7
+ import { compose, mergeProps, buildUseStyling } from '@fluentui-react-native/framework';
9
8
  import assertNever from 'assert-never';
10
9
  import { Circle, ClipPath, Defs, LinearGradient, Rect, Stop, Svg, G } from 'react-native-svg';
11
10
 
@@ -22,7 +21,7 @@ export const Shimmer = compose<ShimmerType>({
22
21
  },
23
22
  useRender: (props: ShimmerProps, useSlots: UseSlots<ShimmerType>) => {
24
23
  const Slots = useSlots(props);
25
- props = mergeProps(props, Slots.root({}).props);
24
+ props = mergeProps(props, Slots.root({}).props as ShimmerProps);
26
25
  const AnimatedLinearGradient = Animated.createAnimatedComponent(LinearGradient);
27
26
  const tokens = useStyling(props).root;
28
27
  const memoizedShimmerData = useMemo(
@@ -4,13 +4,11 @@
4
4
  * @format
5
5
  */
6
6
 
7
- /** @jsxRuntime classic */
8
- /** @jsx withSlots */
7
+ /** @jsxImportSource @fluentui-react-native/framework-base */
9
8
  import { processColor, View } from 'react-native';
10
9
 
11
10
  import type { UseSlots } from '@fluentui-react-native/framework';
12
11
  import { compose, mergeProps } from '@fluentui-react-native/framework';
13
- import { withSlots } from '@fluentui-react-native/framework';
14
12
  import { assertNever } from 'assert-never';
15
13
  import type { SvgProps } from 'react-native-svg';
16
14
  import { ClipPath, Defs, LinearGradient, Path, Rect, Stop, Svg } from 'react-native-svg';
@@ -4,14 +4,14 @@
4
4
  * @format
5
5
  */
6
6
 
7
- import type { HostComponent, ViewProps } from 'react-native';
7
+ import type { ViewProps } from 'react-native';
8
8
 
9
9
  import type { Double } from 'react-native/Libraries/Types/CodegenTypes';
10
- import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
10
+ import { requireNativeComponent } from 'react-native';
11
11
 
12
12
  export interface NativeProps extends ViewProps {
13
13
  delay?: Double;
14
14
  duration?: Double;
15
15
  }
16
16
 
17
- export default codegenNativeComponent<NativeProps>('RCTNativeAnimatedShimmer') as HostComponent<NativeProps>;
17
+ export default requireNativeComponent<NativeProps>('RCTNativeAnimatedShimmer');