@fluentui-react-native/experimental-shimmer 0.13.20 → 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.
- package/CHANGELOG.md +39 -0
- package/SPEC.md +2 -2
- package/lib/Shimmer.d.ts +7 -2
- package/lib/Shimmer.d.ts.map +1 -1
- package/lib/Shimmer.js +151 -90
- package/lib/Shimmer.js.map +1 -1
- package/lib/Shimmer.styling.d.ts +1 -1
- package/lib/Shimmer.styling.js +29 -26
- package/lib/Shimmer.styling.win32.d.ts +1 -1
- package/lib/Shimmer.styling.win32.js +36 -24
- package/lib/Shimmer.test.d.ts +1 -1
- package/lib/Shimmer.test.js +48 -44
- package/lib/Shimmer.test.js.map +1 -1
- package/lib/Shimmer.types.d.ts +10 -2
- package/lib/Shimmer.types.js +1 -1
- package/lib/Shimmer.types.shared.d.ts +123 -123
- package/lib/Shimmer.types.shared.js +1 -1
- package/lib/Shimmer.types.win32.d.ts +26 -26
- package/lib/Shimmer.types.win32.js +1 -1
- package/lib/Shimmer.win32.d.ts +7 -2
- package/lib/Shimmer.win32.d.ts.map +1 -1
- package/lib/Shimmer.win32.js +138 -114
- package/lib/Shimmer.win32.js.map +1 -1
- package/lib/ShimmerTokens.android.d.ts +1 -1
- package/lib/ShimmerTokens.android.js +8 -8
- package/lib/ShimmerTokens.android.js.map +1 -1
- package/lib/ShimmerTokens.d.ts +1 -1
- package/lib/ShimmerTokens.ios.d.ts +1 -1
- package/lib/ShimmerTokens.ios.js +8 -8
- package/lib/ShimmerTokens.ios.js.map +1 -1
- package/lib/ShimmerTokens.js +9 -9
- package/lib/ShimmerTokens.js.map +1 -1
- package/lib/ShimmerTokens.win32.d.ts +1 -1
- package/lib/ShimmerTokens.win32.js +10 -10
- package/lib/ShimmerTokens.win32.js.map +1 -1
- package/lib/SvgShapeToPath.d.ts +1 -1
- package/lib/SvgShapeToPath.js +134 -120
- package/lib/SvgShapeToPath.js.map +1 -1
- package/lib/Win32ShimmerNativeComponent.d.ts +5 -5
- package/lib/Win32ShimmerNativeComponent.d.ts.map +1 -1
- package/lib/Win32ShimmerNativeComponent.js +3 -3
- package/lib/Win32ShimmerNativeComponent.js.map +1 -1
- package/lib/consts.android.d.ts +1 -1
- package/lib/consts.android.js +1 -1
- package/lib/consts.d.ts +1 -1
- package/lib/consts.ios.d.ts +1 -1
- package/lib/consts.ios.js +1 -1
- package/lib/consts.js +1 -1
- package/lib/consts.win32.d.ts +1 -1
- package/lib/consts.win32.js +1 -1
- package/lib/index.d.ts +10 -2
- package/lib/index.js +1 -1
- package/lib-commonjs/Shimmer.d.ts +7 -2
- package/lib-commonjs/Shimmer.d.ts.map +1 -1
- package/lib-commonjs/Shimmer.js +164 -101
- package/lib-commonjs/Shimmer.js.map +1 -1
- package/lib-commonjs/Shimmer.styling.d.ts +1 -1
- package/lib-commonjs/Shimmer.styling.js +34 -31
- package/lib-commonjs/Shimmer.styling.win32.d.ts +1 -1
- package/lib-commonjs/Shimmer.styling.win32.js +41 -29
- package/lib-commonjs/Shimmer.test.d.ts +1 -1
- package/lib-commonjs/Shimmer.test.js +102 -71
- package/lib-commonjs/Shimmer.test.js.map +1 -1
- package/lib-commonjs/Shimmer.types.d.ts +10 -2
- package/lib-commonjs/Shimmer.types.js +10 -5
- package/lib-commonjs/Shimmer.types.js.map +1 -1
- package/lib-commonjs/Shimmer.types.shared.d.ts +123 -123
- package/lib-commonjs/Shimmer.types.shared.js +3 -3
- package/lib-commonjs/Shimmer.types.win32.d.ts +26 -26
- package/lib-commonjs/Shimmer.types.win32.js +10 -5
- package/lib-commonjs/Shimmer.types.win32.js.map +1 -1
- package/lib-commonjs/Shimmer.win32.d.ts +7 -2
- package/lib-commonjs/Shimmer.win32.d.ts.map +1 -1
- package/lib-commonjs/Shimmer.win32.js +166 -128
- package/lib-commonjs/Shimmer.win32.js.map +1 -1
- package/lib-commonjs/ShimmerTokens.android.d.ts +1 -1
- package/lib-commonjs/ShimmerTokens.android.js +11 -11
- package/lib-commonjs/ShimmerTokens.android.js.map +1 -1
- package/lib-commonjs/ShimmerTokens.d.ts +1 -1
- package/lib-commonjs/ShimmerTokens.ios.d.ts +1 -1
- package/lib-commonjs/ShimmerTokens.ios.js +11 -11
- package/lib-commonjs/ShimmerTokens.ios.js.map +1 -1
- package/lib-commonjs/ShimmerTokens.js +13 -13
- package/lib-commonjs/ShimmerTokens.js.map +1 -1
- package/lib-commonjs/ShimmerTokens.win32.d.ts +1 -1
- package/lib-commonjs/ShimmerTokens.win32.js +13 -13
- package/lib-commonjs/ShimmerTokens.win32.js.map +1 -1
- package/lib-commonjs/SvgShapeToPath.d.ts +1 -1
- package/lib-commonjs/SvgShapeToPath.js +138 -125
- package/lib-commonjs/SvgShapeToPath.js.map +1 -1
- package/lib-commonjs/Win32ShimmerNativeComponent.d.ts +5 -5
- package/lib-commonjs/Win32ShimmerNativeComponent.d.ts.map +1 -1
- package/lib-commonjs/Win32ShimmerNativeComponent.js +5 -8
- package/lib-commonjs/Win32ShimmerNativeComponent.js.map +1 -1
- package/lib-commonjs/consts.android.d.ts +1 -1
- package/lib-commonjs/consts.android.js +3 -3
- package/lib-commonjs/consts.d.ts +1 -1
- package/lib-commonjs/consts.ios.d.ts +1 -1
- package/lib-commonjs/consts.ios.js +3 -3
- package/lib-commonjs/consts.js +3 -3
- package/lib-commonjs/consts.win32.d.ts +1 -1
- package/lib-commonjs/consts.win32.js +3 -3
- package/lib-commonjs/index.d.ts +10 -2
- package/lib-commonjs/index.js +36 -11
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +63 -62
- package/src/Shimmer.test.tsx +16 -13
- package/src/Shimmer.tsx +3 -4
- package/src/Shimmer.win32.tsx +1 -3
- 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.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "A cross-platform Fluent Shimmer component",
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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
|
-
"
|
|
23
|
-
"update-snapshots": "fluentui-scripts jest -u",
|
|
29
|
+
"lint-package": "fluentui-scripts lint-package",
|
|
24
30
|
"prettier": "fluentui-scripts prettier",
|
|
25
|
-
"
|
|
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.
|
|
34
|
-
"@fluentui-react-native/theming-utils": "0.
|
|
35
|
-
"@fluentui-react-native/tokens": "0.
|
|
36
|
-
"@fluentui-react-native/use-styling": "0.
|
|
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/
|
|
45
|
-
"@react-native/
|
|
46
|
-
"@react-native/
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"react": "
|
|
50
|
-
"react-native": "^0.
|
|
51
|
-
"react
|
|
52
|
-
"react-
|
|
53
|
-
"react
|
|
54
|
-
"react-
|
|
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
|
|
60
|
-
"react-native
|
|
61
|
-
"react-native-
|
|
62
|
-
"react-native-
|
|
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
|
-
"
|
|
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-
|
|
97
|
-
"optional": true
|
|
98
|
-
},
|
|
99
|
-
"react-native-windows": {
|
|
100
|
-
"optional": true
|
|
101
|
-
}
|
|
102
|
+
"extends": "@fluentui-react-native/kit-config"
|
|
102
103
|
}
|
|
103
|
-
}
|
|
104
|
+
}
|
package/src/Shimmer.test.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
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
|
-
|
|
43
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
-
/** @
|
|
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,
|
|
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(
|
package/src/Shimmer.win32.tsx
CHANGED
|
@@ -4,13 +4,11 @@
|
|
|
4
4
|
* @format
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
/** @
|
|
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 {
|
|
7
|
+
import type { ViewProps } from 'react-native';
|
|
8
8
|
|
|
9
9
|
import type { Double } from 'react-native/Libraries/Types/CodegenTypes';
|
|
10
|
-
import
|
|
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
|
|
17
|
+
export default requireNativeComponent<NativeProps>('RCTNativeAnimatedShimmer');
|