@fluentui-react-native/experimental-shimmer 0.8.16 → 0.8.18
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/.eslintrc.js +3 -0
- package/CHANGELOG.json +33 -3
- package/CHANGELOG.md +18 -2
- package/lib/Shimmer.d.ts +2 -2
- package/lib/Shimmer.d.ts.map +1 -1
- package/lib/Shimmer.js.map +1 -1
- package/lib/Shimmer.styling.d.ts +2 -2
- package/lib/Shimmer.styling.d.ts.map +1 -1
- package/lib/Shimmer.styling.js.map +1 -1
- package/lib/Shimmer.styling.win32.d.ts +3 -3
- package/lib/Shimmer.styling.win32.d.ts.map +1 -1
- package/lib/Shimmer.styling.win32.js.map +1 -1
- package/lib/Shimmer.types.d.ts +1 -144
- package/lib/Shimmer.types.d.ts.map +1 -1
- package/lib/Shimmer.types.js +1 -1
- package/lib/Shimmer.types.js.map +1 -1
- package/lib/Shimmer.types.shared.d.ts +145 -0
- package/lib/Shimmer.types.shared.d.ts.map +1 -0
- package/lib/Shimmer.types.shared.js +2 -0
- package/lib/Shimmer.types.shared.js.map +1 -0
- package/lib/Shimmer.types.win32.d.ts +4 -2
- package/lib/Shimmer.types.win32.d.ts.map +1 -1
- package/lib/Shimmer.types.win32.js +1 -1
- package/lib/Shimmer.types.win32.js.map +1 -1
- package/lib/Shimmer.win32.d.ts +3 -2
- package/lib/Shimmer.win32.d.ts.map +1 -1
- package/lib/Shimmer.win32.js +1 -2
- package/lib/Shimmer.win32.js.map +1 -1
- package/lib/ShimmerTokens.android.d.ts +3 -3
- package/lib/ShimmerTokens.android.d.ts.map +1 -1
- package/lib/ShimmerTokens.d.ts +3 -3
- package/lib/ShimmerTokens.d.ts.map +1 -1
- package/lib/ShimmerTokens.win32.d.ts +3 -3
- package/lib/ShimmerTokens.win32.d.ts.map +1 -1
- package/lib/SvgShapeToPath.d.ts +1 -1
- package/lib/SvgShapeToPath.d.ts.map +1 -1
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib-commonjs/Shimmer.d.ts +2 -2
- package/lib-commonjs/Shimmer.d.ts.map +1 -1
- package/lib-commonjs/Shimmer.js.map +1 -1
- package/lib-commonjs/Shimmer.styling.d.ts +2 -2
- package/lib-commonjs/Shimmer.styling.d.ts.map +1 -1
- package/lib-commonjs/Shimmer.styling.js.map +1 -1
- package/lib-commonjs/Shimmer.styling.win32.d.ts +3 -3
- package/lib-commonjs/Shimmer.styling.win32.d.ts.map +1 -1
- package/lib-commonjs/Shimmer.styling.win32.js.map +1 -1
- package/lib-commonjs/Shimmer.types.d.ts +1 -144
- package/lib-commonjs/Shimmer.types.d.ts.map +1 -1
- package/lib-commonjs/Shimmer.types.js +2 -1
- package/lib-commonjs/Shimmer.types.js.map +1 -1
- package/lib-commonjs/Shimmer.types.shared.d.ts +145 -0
- package/lib-commonjs/Shimmer.types.shared.d.ts.map +1 -0
- package/lib-commonjs/Shimmer.types.shared.js +5 -0
- package/lib-commonjs/Shimmer.types.shared.js.map +1 -0
- package/lib-commonjs/Shimmer.types.win32.d.ts +4 -2
- package/lib-commonjs/Shimmer.types.win32.d.ts.map +1 -1
- package/lib-commonjs/Shimmer.types.win32.js +3 -0
- package/lib-commonjs/Shimmer.types.win32.js.map +1 -1
- package/lib-commonjs/Shimmer.win32.d.ts +3 -2
- package/lib-commonjs/Shimmer.win32.d.ts.map +1 -1
- package/lib-commonjs/Shimmer.win32.js +2 -3
- package/lib-commonjs/Shimmer.win32.js.map +1 -1
- package/lib-commonjs/ShimmerTokens.android.d.ts +3 -3
- package/lib-commonjs/ShimmerTokens.android.d.ts.map +1 -1
- package/lib-commonjs/ShimmerTokens.d.ts +3 -3
- package/lib-commonjs/ShimmerTokens.d.ts.map +1 -1
- package/lib-commonjs/ShimmerTokens.win32.d.ts +3 -3
- package/lib-commonjs/ShimmerTokens.win32.d.ts.map +1 -1
- package/lib-commonjs/SvgShapeToPath.d.ts +1 -1
- package/lib-commonjs/SvgShapeToPath.d.ts.map +1 -1
- package/lib-commonjs/index.d.ts +3 -2
- package/lib-commonjs/index.d.ts.map +1 -1
- package/lib-commonjs/index.js +5 -16
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +2 -2
- package/src/Shimmer.styling.ts +4 -2
- package/src/Shimmer.styling.win32.ts +5 -3
- package/src/Shimmer.test.tsx +1 -1
- package/src/Shimmer.tsx +6 -3
- package/src/Shimmer.types.shared.ts +170 -0
- package/src/Shimmer.types.ts +10 -170
- package/src/Shimmer.types.win32.ts +4 -2
- package/src/Shimmer.win32.tsx +8 -4
- package/src/ShimmerTokens.android.ts +3 -3
- package/src/ShimmerTokens.ts +3 -3
- package/src/ShimmerTokens.win32.ts +3 -3
- package/src/SvgShapeToPath.ts +1 -1
- package/src/index.ts +11 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,YAAY,EACV,oBAAoB,EACpB,mBAAmB,EACnB,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,WAAW,GACZ,MAAM,iBAAiB,CAAC"}
|
package/lib-commonjs/index.js
CHANGED
|
@@ -1,19 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
|
|
3
|
+
exports.shimmerName = exports.Shimmer = void 0;
|
|
4
|
+
var Shimmer_1 = require("./Shimmer");
|
|
5
|
+
Object.defineProperty(exports, "Shimmer", { enumerable: true, get: function () { return Shimmer_1.Shimmer; } });
|
|
6
|
+
var Shimmer_types_1 = require("./Shimmer.types");
|
|
7
|
+
Object.defineProperty(exports, "shimmerName", { enumerable: true, get: function () { return Shimmer_types_1.shimmerName; } });
|
|
19
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AAA3B,kGAAA,OAAO,OAAA;AAChB,iDAA8C;AAArC,4GAAA,WAAW,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluentui-react-native/experimental-shimmer",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.18",
|
|
4
4
|
"description": "A cross-platform Fluent Shimmer component",
|
|
5
5
|
"main": "lib-commonjs/index.js",
|
|
6
6
|
"module": "lib/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"directory": "packages/experimental/Shimmer"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@fluentui-react-native/framework": "0.
|
|
25
|
+
"@fluentui-react-native/framework": "0.9.0",
|
|
26
26
|
"@fluentui-react-native/tokens": ">=0.20.7 <1.0.0",
|
|
27
27
|
"@fluentui-react-native/theming-utils": ">=0.23.2 <1.0.0",
|
|
28
28
|
"@fluentui-react-native/component-cache": "^1.4.3",
|
package/src/Shimmer.styling.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { UseStylingOptions
|
|
2
|
-
import {
|
|
1
|
+
import type { UseStylingOptions } from '@fluentui-react-native/framework';
|
|
2
|
+
import { buildProps } from '@fluentui-react-native/framework';
|
|
3
|
+
import type { ShimmerProps, ShimmerSlotProps, ShimmerTokens } from './Shimmer.types';
|
|
4
|
+
import { shimmerName } from './Shimmer.types';
|
|
3
5
|
import { defaultShimmerTokens } from './ShimmerTokens';
|
|
4
6
|
|
|
5
7
|
export const stylingSettings: UseStylingOptions<ShimmerProps, ShimmerSlotProps, ShimmerTokens> = {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { UseStylingOptions
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { UseStylingOptions } from '@fluentui-react-native/framework';
|
|
2
|
+
import { buildProps } from '@fluentui-react-native/framework';
|
|
3
|
+
import type { ShimmerProps, ShimmerTokens } from './Shimmer.types';
|
|
4
|
+
import { shimmerName } from './Shimmer.types';
|
|
5
|
+
import type { ShimmerSlotProps } from './Shimmer.types.win32';
|
|
4
6
|
import { defaultShimmerTokens } from './ShimmerTokens.win32';
|
|
5
7
|
|
|
6
8
|
/**
|
package/src/Shimmer.test.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as renderer from 'react-test-renderer';
|
|
3
3
|
import { Shimmer } from './Shimmer';
|
|
4
|
-
import { ShimmerCircleElement, ShimmerRectElement } from './Shimmer.types';
|
|
4
|
+
import type { ShimmerCircleElement, ShimmerRectElement } from './Shimmer.types';
|
|
5
5
|
|
|
6
6
|
// mocks out setTimeout and other timer functions with mock functions, test will fail without this as we're using Animated API
|
|
7
7
|
jest.useFakeTimers();
|
package/src/Shimmer.tsx
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/** @jsx withSlots */
|
|
2
2
|
import { useRef, useEffect, useMemo, useCallback } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import type { TransformObject } from 'react-native-svg';
|
|
4
|
+
import { Circle, ClipPath, Defs, LinearGradient, Rect, Stop, Svg, G } from 'react-native-svg';
|
|
5
|
+
import type { ShimmerProps, ShimmerType } from './Shimmer.types';
|
|
6
|
+
import { shimmerName } from './Shimmer.types';
|
|
7
|
+
import type { UseSlots } from '@fluentui-react-native/framework';
|
|
8
|
+
import { compose, mergeProps, withSlots, buildUseStyling } from '@fluentui-react-native/framework';
|
|
6
9
|
import { Animated, I18nManager } from 'react-native';
|
|
7
10
|
import { stylingSettings } from './Shimmer.styling';
|
|
8
11
|
import assertNever from 'assert-never';
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import type { SvgProps } from 'react-native-svg';
|
|
2
|
+
import type { ColorValue, ViewProps } from 'react-native';
|
|
3
|
+
import type { IBackgroundColorTokens } from '@fluentui-react-native/tokens';
|
|
4
|
+
|
|
5
|
+
export const shimmerName = 'Shimmer';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Properties necessary to define a circular Shimmer element.
|
|
9
|
+
*/
|
|
10
|
+
export interface ShimmerCircleElement {
|
|
11
|
+
/**
|
|
12
|
+
* Shimmer element type.
|
|
13
|
+
*/
|
|
14
|
+
type: 'circle';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Radius of the circle element.
|
|
18
|
+
* @defaultValue 12
|
|
19
|
+
*/
|
|
20
|
+
radius?: number;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Note: cx and cy should be optional properties [or removed], with relative positioning being the default [or only] positioning mechanism.
|
|
24
|
+
* Note: The behavior of element intersections is undefined. https://www.github.com/Microsoft/fluentui-react-native Issue #866
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The x-axis center of the circle element in the Shimmer relative to the origin [top-left, (0,0)].
|
|
29
|
+
*/
|
|
30
|
+
cx: number;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The y-axis center of the circle element in the Shimmer relative to the origin [top-left, (0,0)].
|
|
34
|
+
*/
|
|
35
|
+
cy: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Properties necessary to define a rectangular Shimmer element.
|
|
40
|
+
*/
|
|
41
|
+
export interface ShimmerRectElement {
|
|
42
|
+
/**
|
|
43
|
+
* Shimmer element type.
|
|
44
|
+
*/
|
|
45
|
+
type: 'rect';
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Width of the rect.
|
|
49
|
+
* @defaultValue 100%
|
|
50
|
+
*/
|
|
51
|
+
width?: number;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Height of the rect.
|
|
55
|
+
* @defaultValue 16
|
|
56
|
+
*/
|
|
57
|
+
height?: number;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Border radius for the x-axis of a rounded rect.
|
|
61
|
+
* @defaultValue 0
|
|
62
|
+
*/
|
|
63
|
+
borderRadiusX?: number;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Border radius for the y-axis of a rounded rect.
|
|
67
|
+
* @defaultValue 0
|
|
68
|
+
*/
|
|
69
|
+
borderRadiusY?: number;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Note: x and y should be optional properties [or removed], with relative positioning being the default [or only] positioning mechanism.
|
|
73
|
+
* Note: The behavior of element intersections is undefined. https://www.github.com/Microsoft/fluentui-react-native Issue #866
|
|
74
|
+
*/
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* The x-axis position of the rect element's top-left corner in the Shimmer relative to the origin [top-left, (0,0)].
|
|
78
|
+
*/
|
|
79
|
+
x: number;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The y-axis position of the rect element's top-left corner in the Shimmer relative to the origin [top-left, (0,0)].
|
|
83
|
+
*/
|
|
84
|
+
y: number;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export type ShimmerElementTypes = ShimmerCircleElement | ShimmerRectElement;
|
|
88
|
+
|
|
89
|
+
export interface ShimmerTokens extends IBackgroundColorTokens {
|
|
90
|
+
/**
|
|
91
|
+
* Specifies the Shimmer effect angle in degrees (produced by a gradient).
|
|
92
|
+
*
|
|
93
|
+
* @defaultValue 45 on @platform Android
|
|
94
|
+
* @defaultValue 0 on other platforms.
|
|
95
|
+
*/
|
|
96
|
+
angle?: number;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Specifies the animation delay time in milliseconds.
|
|
100
|
+
*
|
|
101
|
+
* @defaultValue 500 on @platform win32
|
|
102
|
+
* @defaultValue 0 on other platforms.
|
|
103
|
+
*/
|
|
104
|
+
delay?: number;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Specifies the time required to traverse the control in milliseconds.
|
|
108
|
+
*
|
|
109
|
+
* @defaultValue 1000 on @platform Android
|
|
110
|
+
* @defaultValue 2000 on @platform win32
|
|
111
|
+
* @defaultValue 7000 on other platforms.
|
|
112
|
+
*/
|
|
113
|
+
duration?: number;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Specifies the opacity of the shimmer color.
|
|
117
|
+
* @defaultValue 1
|
|
118
|
+
*/
|
|
119
|
+
shimmerColorOpacity?: number;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Specifies the opacity of the wave color.
|
|
123
|
+
* @defaultValue 1
|
|
124
|
+
*/
|
|
125
|
+
shimmerWaveColorOpacity?: number;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Color you see when the shimmer wave is not animating.
|
|
129
|
+
*
|
|
130
|
+
* @defaultValue theme.colors.neutralStencil1 on @platform Android
|
|
131
|
+
* @defaultValue theme.colors.bodyFrameDivider on @platform win32
|
|
132
|
+
* @defaultValue #E1E1E1/#404040 for light/dark theme on other platforms.
|
|
133
|
+
*/
|
|
134
|
+
shimmerColor?: ColorValue;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Defines the tip color of the wave which has a linear gradient.
|
|
138
|
+
* from shimmerColor to shimmerWaveColor to shimmerColor.
|
|
139
|
+
*
|
|
140
|
+
* @defaultValue theme.colors.neutralStencil2 on @platform Android
|
|
141
|
+
* @defaultValue #E1E1E1 on @platform win32
|
|
142
|
+
* @defaultValue white/black for light/dark theme on other platforms.
|
|
143
|
+
*/
|
|
144
|
+
shimmerWaveColor?: ColorValue;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Width of the Shimmer wave.
|
|
148
|
+
*
|
|
149
|
+
* @defaultValue '100%' of the 'width' property
|
|
150
|
+
* @platform win32
|
|
151
|
+
*/
|
|
152
|
+
shimmerWaveWidth?: number | string;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface ShimmerSlotProps {
|
|
156
|
+
root: SvgProps;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface ShimmerProps extends ViewProps, ShimmerTokens {
|
|
160
|
+
/**
|
|
161
|
+
* Shimmer shapes that define the masking effect of the Shimmer control.
|
|
162
|
+
*/
|
|
163
|
+
elements: Array<ShimmerElementTypes>;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface ShimmerType {
|
|
167
|
+
props: ShimmerProps;
|
|
168
|
+
slotProps: ShimmerSlotProps;
|
|
169
|
+
tokens: ShimmerTokens;
|
|
170
|
+
}
|
package/src/Shimmer.types.ts
CHANGED
|
@@ -1,170 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Shimmer element type.
|
|
13
|
-
*/
|
|
14
|
-
type: 'circle';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Radius of the circle element.
|
|
18
|
-
* @defaultValue 12
|
|
19
|
-
*/
|
|
20
|
-
radius?: number;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Note: cx and cy should be optional properties [or removed], with relative positioning being the default [or only] positioning mechanism.
|
|
24
|
-
* Note: The behavior of element intersections is undefined. https://www.github.com/Microsoft/fluentui-react-native Issue #866
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* The x-axis center of the circle element in the Shimmer relative to the origin [top-left, (0,0)].
|
|
29
|
-
*/
|
|
30
|
-
cx: number;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* The y-axis center of the circle element in the Shimmer relative to the origin [top-left, (0,0)].
|
|
34
|
-
*/
|
|
35
|
-
cy: number;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Properties necessary to define a rectangular Shimmer element.
|
|
40
|
-
*/
|
|
41
|
-
export interface ShimmerRectElement {
|
|
42
|
-
/**
|
|
43
|
-
* Shimmer element type.
|
|
44
|
-
*/
|
|
45
|
-
type: 'rect';
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Width of the rect.
|
|
49
|
-
* @defaultValue 100%
|
|
50
|
-
*/
|
|
51
|
-
width?: number;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Height of the rect.
|
|
55
|
-
* @defaultValue 16
|
|
56
|
-
*/
|
|
57
|
-
height?: number;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Border radius for the x-axis of a rounded rect.
|
|
61
|
-
* @defaultValue 0
|
|
62
|
-
*/
|
|
63
|
-
borderRadiusX?: number;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Border radius for the y-axis of a rounded rect.
|
|
67
|
-
* @defaultValue 0
|
|
68
|
-
*/
|
|
69
|
-
borderRadiusY?: number;
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Note: x and y should be optional properties [or removed], with relative positioning being the default [or only] positioning mechanism.
|
|
73
|
-
* Note: The behavior of element intersections is undefined. https://www.github.com/Microsoft/fluentui-react-native Issue #866
|
|
74
|
-
*/
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* The x-axis position of the rect element's top-left corner in the Shimmer relative to the origin [top-left, (0,0)].
|
|
78
|
-
*/
|
|
79
|
-
x: number;
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* The y-axis position of the rect element's top-left corner in the Shimmer relative to the origin [top-left, (0,0)].
|
|
83
|
-
*/
|
|
84
|
-
y: number;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export type ShimmerElementTypes = ShimmerCircleElement | ShimmerRectElement;
|
|
88
|
-
|
|
89
|
-
export interface ShimmerTokens extends IBackgroundColorTokens {
|
|
90
|
-
/**
|
|
91
|
-
* Specifies the Shimmer effect angle in degrees (produced by a gradient).
|
|
92
|
-
*
|
|
93
|
-
* @defaultValue 45 on @platform Android
|
|
94
|
-
* @defaultValue 0 on other platforms.
|
|
95
|
-
*/
|
|
96
|
-
angle?: number;
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Specifies the animation delay time in milliseconds.
|
|
100
|
-
*
|
|
101
|
-
* @defaultValue 500 on @platform win32
|
|
102
|
-
* @defaultValue 0 on other platforms.
|
|
103
|
-
*/
|
|
104
|
-
delay?: number;
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Specifies the time required to traverse the control in milliseconds.
|
|
108
|
-
*
|
|
109
|
-
* @defaultValue 1000 on @platform Android
|
|
110
|
-
* @defaultValue 2000 on @platform win32
|
|
111
|
-
* @defaultValue 7000 on other platforms.
|
|
112
|
-
*/
|
|
113
|
-
duration?: number;
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Specifies the opacity of the shimmer color.
|
|
117
|
-
* @defaultValue 1
|
|
118
|
-
*/
|
|
119
|
-
shimmerColorOpacity?: number;
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Specifies the opacity of the wave color.
|
|
123
|
-
* @defaultValue 1
|
|
124
|
-
*/
|
|
125
|
-
shimmerWaveColorOpacity?: number;
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Color you see when the shimmer wave is not animating.
|
|
129
|
-
*
|
|
130
|
-
* @defaultValue theme.colors.neutralStencil1 on @platform Android
|
|
131
|
-
* @defaultValue theme.colors.bodyFrameDivider on @platform win32
|
|
132
|
-
* @defaultValue #E1E1E1/#404040 for light/dark theme on other platforms.
|
|
133
|
-
*/
|
|
134
|
-
shimmerColor?: ColorValue;
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Defines the tip color of the wave which has a linear gradient.
|
|
138
|
-
* from shimmerColor to shimmerWaveColor to shimmerColor.
|
|
139
|
-
*
|
|
140
|
-
* @defaultValue theme.colors.neutralStencil2 on @platform Android
|
|
141
|
-
* @defaultValue #E1E1E1 on @platform win32
|
|
142
|
-
* @defaultValue white/black for light/dark theme on other platforms.
|
|
143
|
-
*/
|
|
144
|
-
shimmerWaveColor?: ColorValue;
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Width of the Shimmer wave.
|
|
148
|
-
*
|
|
149
|
-
* @defaultValue '100%' of the 'width' property
|
|
150
|
-
* @platform win32
|
|
151
|
-
*/
|
|
152
|
-
shimmerWaveWidth?: number | string;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export interface ShimmerSlotProps {
|
|
156
|
-
root: SvgProps;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export interface ShimmerProps extends ViewProps, ShimmerTokens {
|
|
160
|
-
/**
|
|
161
|
-
* Shimmer shapes that define the masking effect of the Shimmer control.
|
|
162
|
-
*/
|
|
163
|
-
elements: Array<ShimmerElementTypes>;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
export interface ShimmerType {
|
|
167
|
-
props: ShimmerProps;
|
|
168
|
-
slotProps: ShimmerSlotProps;
|
|
169
|
-
tokens: ShimmerTokens;
|
|
170
|
-
}
|
|
1
|
+
export {
|
|
2
|
+
shimmerName,
|
|
3
|
+
ShimmerCircleElement,
|
|
4
|
+
ShimmerRectElement,
|
|
5
|
+
ShimmerElementTypes,
|
|
6
|
+
ShimmerTokens,
|
|
7
|
+
ShimmerSlotProps,
|
|
8
|
+
ShimmerProps,
|
|
9
|
+
ShimmerType,
|
|
10
|
+
} from './Shimmer.types.shared';
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { ViewProps } from 'react-native';
|
|
2
|
-
import { ShimmerProps, ShimmerTokens } from './Shimmer.types';
|
|
1
|
+
import type { ViewProps } from 'react-native';
|
|
2
|
+
import type { ShimmerProps, ShimmerTokens } from './Shimmer.types.shared';
|
|
3
|
+
export { ShimmerProps, ShimmerTokens };
|
|
4
|
+
export { shimmerName, ShimmerRectElement, ShimmerElementTypes, ShimmerCircleElement } from './Shimmer.types.shared';
|
|
3
5
|
|
|
4
6
|
export interface ClippingMaskProps extends ShimmerTokens {
|
|
5
7
|
/**
|
package/src/Shimmer.win32.tsx
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
/** @jsx withSlots */
|
|
2
|
-
import {
|
|
2
|
+
import type { UseSlots } from '@fluentui-react-native/framework';
|
|
3
|
+
import { compose, mergeProps } from '@fluentui-react-native/framework';
|
|
3
4
|
import { View } from 'react-native';
|
|
4
|
-
import {
|
|
5
|
+
import type { SvgProps } from 'react-native-svg';
|
|
6
|
+
import { ClipPath, Defs, LinearGradient, Path, Rect, Stop, Svg } from 'react-native-svg';
|
|
5
7
|
import { stylingSettings } from './Shimmer.styling.win32';
|
|
6
|
-
import { ShimmerElementTypes,
|
|
7
|
-
|
|
8
|
+
import type { ShimmerElementTypes, ShimmerProps, ShimmerCircleElement, ShimmerRectElement } from './Shimmer.types.shared';
|
|
9
|
+
export { ShimmerCircleElement, ShimmerRectElement };
|
|
10
|
+
import { shimmerName } from './Shimmer.types.shared';
|
|
11
|
+
import type { ClippingMaskProps, ShimmerType, ShimmerWaveProps } from './Shimmer.types.win32';
|
|
8
12
|
import { RCTNativeAnimatedShimmer } from './consts.win32';
|
|
9
13
|
import { convertRectToSvgPath, convertCircleToSvgPath } from './SvgShapeToPath';
|
|
10
14
|
import { withSlots } from '@fluentui-react-native/framework';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Theme } from '@fluentui-react-native/framework';
|
|
2
|
-
import { ShimmerTokens } from './Shimmer.types';
|
|
3
|
-
import { TokenSettings } from '@fluentui-react-native/use-styling';
|
|
1
|
+
import type { Theme } from '@fluentui-react-native/framework';
|
|
2
|
+
import type { ShimmerTokens } from './Shimmer.types';
|
|
3
|
+
import type { TokenSettings } from '@fluentui-react-native/use-styling';
|
|
4
4
|
|
|
5
5
|
export const defaultShimmerTokens: TokenSettings<ShimmerTokens, Theme> = (theme: Theme) =>
|
|
6
6
|
({
|
package/src/ShimmerTokens.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Theme } from '@fluentui-react-native/framework';
|
|
2
|
-
import { ShimmerTokens } from './Shimmer.types';
|
|
3
|
-
import { TokenSettings } from '@fluentui-react-native/use-styling';
|
|
1
|
+
import type { Theme } from '@fluentui-react-native/framework';
|
|
2
|
+
import type { ShimmerTokens } from './Shimmer.types';
|
|
3
|
+
import type { TokenSettings } from '@fluentui-react-native/use-styling';
|
|
4
4
|
import { getCurrentAppearance } from '@fluentui-react-native/theming-utils';
|
|
5
5
|
|
|
6
6
|
export const defaultShimmerTokens: TokenSettings<ShimmerTokens, Theme> = (theme: Theme) =>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Theme } from '@fluentui-react-native/framework';
|
|
2
|
-
import { ShimmerTokens } from './Shimmer.types';
|
|
3
|
-
import { TokenSettings } from '@fluentui-react-native/use-styling';
|
|
1
|
+
import type { Theme } from '@fluentui-react-native/framework';
|
|
2
|
+
import type { ShimmerTokens } from './Shimmer.types';
|
|
3
|
+
import type { TokenSettings } from '@fluentui-react-native/use-styling';
|
|
4
4
|
|
|
5
5
|
export const defaultShimmerTokens: TokenSettings<ShimmerTokens, Theme> = (theme: Theme) =>
|
|
6
6
|
({
|
package/src/SvgShapeToPath.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* as we only support rounded rects and circles, with a circle being a rounded rect of borderRadius=length/2=width/2.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
-
import { ShimmerCircleElement, ShimmerRectElement } from './Shimmer.types';
|
|
16
|
+
import type { ShimmerCircleElement, ShimmerRectElement } from './Shimmer.types';
|
|
17
17
|
|
|
18
18
|
// Note for explicit clarity: length and width represent the full length and width of the rect, and not
|
|
19
19
|
// the straight edge segments (i.e. length - 2*borderRadius).
|
package/src/index.ts
CHANGED
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export { Shimmer } from './Shimmer';
|
|
2
|
+
export { shimmerName } from './Shimmer.types';
|
|
3
|
+
export type {
|
|
4
|
+
ShimmerCircleElement,
|
|
5
|
+
ShimmerElementTypes,
|
|
6
|
+
ShimmerProps,
|
|
7
|
+
ShimmerRectElement,
|
|
8
|
+
ShimmerSlotProps,
|
|
9
|
+
ShimmerTokens,
|
|
10
|
+
ShimmerType,
|
|
11
|
+
} from './Shimmer.types';
|